Changeset 3155283
- Timestamp:
- 09/20/2024 03:48:05 PM (18 months ago)
- Location:
- wallkit
- Files:
-
- 4 added
- 24 edited
- 1 copied
-
tags/3.3.7 (copied) (copied from wallkit/trunk)
-
tags/3.3.7/admin/class-wallkit-wp-admin.php (modified) (7 diffs)
-
tags/3.3.7/admin/partials/settings/template-settings.php (modified) (2 diffs)
-
tags/3.3.7/includes/class-wallkit-rest-controller.php (added)
-
tags/3.3.7/includes/class-wallkit-wp-access.php (modified) (2 diffs)
-
tags/3.3.7/includes/class-wallkit-wp-settings.php (modified) (1 diff)
-
tags/3.3.7/includes/class-wallkit-wp.php (modified) (2 diffs)
-
tags/3.3.7/public/class-wallkit-wp-public.php (modified) (2 diffs)
-
tags/3.3.7/public/js/wallkit-setup.js (modified) (7 diffs)
-
tags/3.3.7/public/js/wallkit-setup.min.js (modified) (1 diff)
-
tags/3.3.7/readme.txt (modified) (1 diff)
-
tags/3.3.7/vendor/wallkit-php-sdk/src/WallkitClient.php (modified) (4 diffs)
-
tags/3.3.7/vendor/wallkit-php-sdk/src/WallkitSDK.php (modified) (4 diffs)
-
tags/3.3.7/vendor/wallkit-php-sdk/src/WallkitSession.php (added)
-
tags/3.3.7/wallkit-wp.php (modified) (2 diffs)
-
trunk/admin/class-wallkit-wp-admin.php (modified) (7 diffs)
-
trunk/admin/partials/settings/template-settings.php (modified) (2 diffs)
-
trunk/includes/class-wallkit-rest-controller.php (added)
-
trunk/includes/class-wallkit-wp-access.php (modified) (2 diffs)
-
trunk/includes/class-wallkit-wp-settings.php (modified) (1 diff)
-
trunk/includes/class-wallkit-wp.php (modified) (2 diffs)
-
trunk/public/class-wallkit-wp-public.php (modified) (2 diffs)
-
trunk/public/js/wallkit-setup.js (modified) (7 diffs)
-
trunk/public/js/wallkit-setup.min.js (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/vendor/wallkit-php-sdk/src/WallkitClient.php (modified) (4 diffs)
-
trunk/vendor/wallkit-php-sdk/src/WallkitSDK.php (modified) (4 diffs)
-
trunk/vendor/wallkit-php-sdk/src/WallkitSession.php (added)
-
trunk/wallkit-wp.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wallkit/tags/3.3.7/admin/class-wallkit-wp-admin.php
r3074025 r3155283 443 443 if(is_singular()) { 444 444 switch ($paywallType) { 445 case 0: $content = $this->get_ backend_paywalled($content); break;445 case 0: $content = $this->get_hard_css_paywalled($content); break; 446 446 case 1: $content = $this->get_frontend_paywalled($content); break; 447 case 3: $content = $this->get_backend_paywalled($content); break; 447 448 } 448 449 } … … 465 466 466 467 public function update_wallkit_popup_settings($settings) { 467 var_dump('ASDASDASD');468 468 $settings['integration']['ui'] = [ 469 469 'type' => 'inline', … … 505 505 * @return string 506 506 */ 507 p rivatefunction get_content_body_paragraph($content, $cut_paragraph_count = 1) {507 public static function get_content_body_paragraph($content, $cut_paragraph_count = 1) { 508 508 if($cut_paragraph_count < 0) { 509 509 return force_balance_tags( apply_filters('wallkit_customize_post_locked_content', '') ); … … 524 524 525 525 /** 526 * Get locked content not displayed for user 527 * 528 * @since 3.3.7 529 * @param $content 530 * @param int $cut_paragraph_count 531 * @return string 532 */ 533 private function get_content_body_paragraphs_count($content, $cut_paragraph_count = 1) { 534 if($cut_paragraph_count < 0) { 535 return force_balance_tags( apply_filters('wallkit_customize_post_locked_content', '') ); 536 } 537 538 $parts = count(explode("</p>", $content)); 539 540 return force_balance_tags( apply_filters('wallkit_customize_post_locked_paragraphs_count', $parts-1) ); 541 } 542 543 /** 526 544 * @param $content 527 545 * @return int … … 536 554 * @return string 537 555 */ 538 private function get_ backend_paywalled($content) {556 private function get_hard_css_paywalled($content) { 539 557 $cut_paragraph_count = $this->collection->get_settings() 540 558 ->get_option("wk_free_paragraph", 1); … … 556 574 } 557 575 558 $content .= $this->get_content_body_paragraph($source_content, $cut_paragraph_count); 576 $content .= self::get_content_body_paragraph($source_content, $cut_paragraph_count); 577 578 $content .= '</div>'; 579 $content .= '</div>'; 580 581 return $content; 582 } 583 584 /** 585 * Paywalled and blocked content on backend 586 * 587 * @since 3.3.7 588 * @param $content 589 * @return string 590 */ 591 private function get_backend_paywalled($content) { 592 $cut_paragraph_count = $this->collection->get_settings() 593 ->get_option("wk_free_paragraph", 1); 594 595 $source_content = $this->get_formatted_content($content); 596 $content = '<div class="wpwp-non-paywall">' . $this->get_content_intro_paragraph($source_content, $cut_paragraph_count) . '</div>'; 597 598 $content .= '<div class="wkwp-paywall">'; 599 $content .= '<div class="wkwp-paywall-block">'; 600 $content .= force_balance_tags(wpautop(base64_decode($this->collection->get_settings() 601 ->get_option("wk_content_access_html")))); 602 $content .= '</div>'; 603 604 if ($this->collection->get_settings() 605 ->get_option("wk_show_blur")) { 606 $count_paragraps = $this->get_content_body_paragraphs_count($source_content, $cut_paragraph_count); 607 $content .= '<div class="wkwp-content-inner wkwp-content-blured" data-paragraphs="' . $count_paragraps . '">'; 608 } else { 609 $content .= '<div class="wkwp-content-inner">'; 610 } 559 611 560 612 $content .= '</div>'; … … 589 641 * @return string 590 642 */ 591 public function get_formatted_content($content) {643 public static function get_formatted_content($content) { 592 644 $blocks = parse_blocks( $content ); 593 645 $output = ''; -
wallkit/tags/3.3.7/admin/partials/settings/template-settings.php
r3017147 r3155283 155 155 <input type="hidden" name="wk_settings[wk_paywall_display_type]" value="0" /> 156 156 <div> 157 <label for="wk_paywall_display_type_ backend">158 <input type="radio" id="wk_paywall_display_type_ backend" name="wk_settings[wk_paywall_display_type]" value="0" <?php checked($wk_paywall_display_type, 0);?> >159 Backend</label>157 <label for="wk_paywall_display_type_css"> 158 <input type="radio" id="wk_paywall_display_type_css" name="wk_settings[wk_paywall_display_type]" value="0" <?php checked($wk_paywall_display_type, 0);?> > 159 Frontend (by CSS)</label> 160 160 </div> 161 161 … … 163 163 <label for="wk_paywall_display_type_frontend"> 164 164 <input type="radio" id="wk_paywall_display_type_frontend" name="wk_settings[wk_paywall_display_type]" value="1" <?php checked($wk_paywall_display_type, 1);?> > 165 Frontend</label> 165 Frontend (by JavaScript)</label> 166 </div> 167 168 <div> 169 <label for="wk_paywall_display_type_backend"> 170 <input type="radio" id="wk_paywall_display_type_backend" name="wk_settings[wk_paywall_display_type]" value="3" <?php checked($wk_paywall_display_type, 3);?> > 171 Backend</label> 166 172 </div> 167 173 -
wallkit/tags/3.3.7/includes/class-wallkit-wp-access.php
r3017147 r3155283 32 32 static::$wallkit_Wp_Collection = $wallkit_Wp_Collection; 33 33 $this->setContentKeyPrefix(); 34 add_filter('wallkit_check_post_access', array($this, 'check_post_access_wk_request'), 10, 2); 34 35 } 35 36 … … 126 127 } 127 128 129 /** 130 * Check post access in wallkit 131 * 132 * @since 3.3.7 133 * @param \WP_Post|null $WP_Post 134 * @param bool $autoCreate 135 * @return array|bool 136 */ 137 public function check_post_access_wk_request(WP_Post $WP_Post = null, $autoCreate = true) { 138 139 if(!$WP_Post instanceof WP_Post || !isset($WP_Post->ID)) 140 { 141 return true; 142 } 143 144 if(!isset($WP_Post->post_type) || empty($WP_Post->post_type)) 145 { 146 return true; 147 } 148 149 $disablePaywallOnPost = get_post_meta($WP_Post->ID, 'disable_paywall_on_post', true); 150 if($disablePaywallOnPost === '1') 151 { 152 return true; 153 } 154 155 /** 156 * Disable locked content if user logged in admin area 157 */ 158 if(is_user_logged_in() && !self::$wallkit_Wp_Collection->get_settings()->get_option("wk_admin_paywall")) 159 { 160 return true; 161 } 162 163 try { 164 165 $Sdk = static::$wallkit_Wp_Collection->get_settings()->get_sdk(); 166 167 if(!$Sdk instanceof \WallkitSDK\WallkitSDK) 168 { 169 return true; 170 } 171 172 /** 173 * Locked content for checked post types 174 */ 175 $registeredPostTypes = self::$wallkit_Wp_Collection->get_settings()->get_option("wk_check_post_type_access"); 176 if( !(!empty($registeredPostTypes) && array_key_exists($WP_Post->post_type, $registeredPostTypes) && $registeredPostTypes[$WP_Post->post_type]) ) { 177 return true; 178 } 179 180 $access = $Sdk 181 ->get("/user/content/" . $this->content_key_prefix . $WP_Post->ID) 182 ->toArray(); 183 184 return [ 185 'allow' => (bool) (isset($access["allow"]) ? $access["allow"] : false), 186 'response' => $access, 187 ]; 188 } 189 catch(\WallkitSDK\Exceptions\WallkitException $exception) 190 { 191 if($exception->getMessage() !== 'Content not exist') { 192 return [ 193 'allow' => false, 194 'reason' => $exception->getMessage(), 195 'message' => 'Content check access error' 196 ]; 197 } 198 199 if(self::$wallkit_Wp_Collection->get_settings()->get_option("wk_is_auto_sync") && $autoCreate) { 200 try { 201 $this->get_wk_posts()->createPost($WP_Post->ID, $WP_Post); 202 203 return $this->check_post_access_wk_request($WP_Post, false); 204 } 205 catch(\Exception $exception) { 206 return [ 207 'allow' => false, 208 'reason' => $exception->getMessage(), 209 'message' => 'Sync content error' 210 ]; 211 } 212 } 213 } 214 catch (\Exception $exception) 215 { 216 return [ 217 'allow' => false, 218 'reason' => $exception->getMessage(), 219 'message' => 'Exception check access error' 220 ]; 221 } 222 } 128 223 } -
wallkit/tags/3.3.7/includes/class-wallkit-wp-settings.php
r3058402 r3155283 430 430 'wk_auth_migrated_users_text' => base64_decode($this->get_option('wk_auth_migrated_users_text', '')), 431 431 'skip_lorem' => false, 432 'parse_scripts' => true, 432 433 'inline_modals_selector' => $this->get_inline_modals_selector(), 433 434 'wk_modal_after_sign_in' => apply_filters( 'wallkit_override_inline_modal_after_sign_in', 'account-settings'), -
wallkit/tags/3.3.7/includes/class-wallkit-wp.php
r3058402 r3155283 203 203 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wallkit-wp-access.php'; 204 204 205 /** 206 * Class of the REST API routes. 207 */ 208 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wallkit-rest-controller.php'; 209 205 210 206 211 /** … … 287 292 if($this->settings->get_option("wk_is_active") && $this->get_collection()->get_settings()->get_sdk()) 288 293 { 294 $this->loader->add_action( 'rest_api_init', $plugin_public, 'rest_api_init' ); 289 295 $this->loader->add_action( 'wp_head', $plugin_public, 'print_post_data' ); 290 296 $this->loader->add_filter( 'body_class', $plugin_public, 'add_body_class' ); -
wallkit/tags/3.3.7/public/class-wallkit-wp-public.php
r3058402 r3155283 44 44 45 45 /** 46 * The instance of the REST API controller class used to extend the REST API. 47 * 48 * @since 3.3.7 49 * 50 */ 51 public $wk_rest_api; 52 53 /** 46 54 * Wallkit_Wp_Public constructor. 47 55 * … … 73 81 $this->content_key_prefix = $this->wallkit_Wp_Collection->get_settings()->get_option("wk_content_key_prefix") . '_' . $this->content_key_prefix; 74 82 } 83 } 84 85 /** 86 * Initialize the REST API routes. 87 * 88 * @since 3.3.7 89 * 90 */ 91 public function rest_api_init() { 92 $this->wk_rest_api = new Wallkit_REST_Controller(); 93 $this->wk_rest_api->register_routes(); 75 94 } 76 95 -
wallkit/tags/3.3.7/public/js/wallkit-setup.js
r3058402 r3155283 427 427 428 428 window.wkwpCheckAccessPromise = new Promise((resolve, reject) => { 429 //If this is backed paywalled skip check post access on frontend, check access on backend. 430 if(window.wallkitPostData.config.wk_paywall_display_type === 3) { 431 resolve({}); 432 return; 433 } 434 429 435 wkPost.checkAccess().then((response) => { 430 436 wkwpDebug('F=>wkCheckPostAccess.wkPost.checkAccess', response); … … 443 449 switch (window.wallkitPostData.config.wk_paywall_display_type) { 444 450 case 1: checkAccessHandlingFrontend(response); break; 445 default: checkAccessHandling(response); 451 case 3: checkAccessHandlingBackend(); break; 452 default: checkAccessHandlingCSS(response); 446 453 } 447 454 … … 471 478 switch (window.wallkitPostData.config.wk_paywall_display_type) { 472 479 case 1: checkAccessHandlingFrontend({allowed: true}); break; 473 default: checkAccessHandling ({allowed: true});480 default: checkAccessHandlingCSS({allowed: true}); 474 481 } 475 482 } … … 477 484 // Change view for user based on access. Partial process on backend. 478 485 // Hard locking content 479 function checkAccessHandling (response) {486 function checkAccessHandlingCSS(response) { 480 487 let wkSettings = window["wallkitSettings"] || {}; 481 488 const postContentWrapper = document.querySelector(".wkwp-paywall"); 482 489 const postContentBody = document.querySelector(".wkwp-paywall .wkwp-content-inner"); 483 490 let postPaywallBlock = document.querySelector(".wkwp-paywall .wkwp-paywall-block"); 484 wkwpDebug('F=>checkAccessHandling ',491 wkwpDebug('F=>checkAccessHandlingCSS', 485 492 '\nresponse', response, 486 493 '\nwindow.wallkitPostData', window.wallkitPostData, … … 532 539 postContentWrapper.style = "display:block;"; 533 540 } 541 } 542 543 // Change view for user based on access. Partial process on backend. 544 // Hard locking content 545 async function checkAccessHandlingBackend() { 546 let wkSettings = window["wallkitSettings"] || {}; 547 const postContentWrapper = document.querySelector(".wkwp-paywall"); 548 const postContentBody = document.querySelector(".wkwp-paywall .wkwp-content-inner"); 549 let postPaywallBlock = document.querySelector(".wkwp-paywall .wkwp-paywall-block"); 550 wkwpDebug('F=>checkAccessHandlingBackend', 551 '\nwindow.wallkitPostData', window.wallkitPostData, 552 '\npostContentWrapper', postContentWrapper, 553 '\npostContentBody', postContentBody, 554 '\npostPaywallBlock', postPaywallBlock, 555 '\nwkPaywallBlock', wkPaywallBlock); 556 557 let contentData = await get_content_part(); 558 wkwpDebug('F=>checkAccessHandlingBackend=>get_content_part', 559 '\ncontentPart', contentData.contentPart, 560 '\ncontentScripts', contentData.contentScripts); 561 if (!contentData) { 562 if (postContentBody) { 563 const p_count = parseInt(postContentBody.dataset.paragraphs) || 0; 564 postContentBody.innerHTML = get_lorem(p_count); 565 566 if (!window.wallkitPostData.config.show_blur) { 567 postContentBody.style = "display:none;"; 568 } else { 569 postContentBody.classList.add('wkwp-content-blured'); 570 } 571 } 572 573 if (!postPaywallBlock && wkSettings.config.paywall.content) { 574 postPaywallBlock = document.createElement('div'); 575 postPaywallBlock.classList.add('wkwp-paywall-block'); 576 postPaywallBlock.insertAdjacentHTML('beforeend', wkSettings.config.paywall.content); 577 postContentBody.parentNode.insertBefore(postPaywallBlock, postContentBody); 578 } 579 580 paywallDisplayLoginLink(postPaywallBlock); 581 582 postContentWrapper.style = "display:block;"; 583 } else { 584 if (postPaywallBlock) { 585 postPaywallBlock.remove(); 586 } 587 588 if (postContentBody) { 589 postContentBody.innerHTML = contentData.contentPart || ''; 590 if(contentData.contentScripts) { 591 contentData.contentScripts.forEach(script => document.body.appendChild(script)); 592 } 593 postContentBody.classList.remove('wkwp-content-blured'); 594 postContentBody.style = "display:block;"; 595 } 596 597 postContentWrapper.style = "display:block;"; 598 } 599 } 600 601 async function get_content_part() { 602 const post_id = window.wallkitPostData.data.id.split('_').slice(-1); 603 const url_params = { 604 post_id: post_id 605 }; 606 let headers = {}; 607 if(Wallkit.getToken()) { 608 headers['wk-token'] = Wallkit.getToken(); 609 } 610 if(Wallkit.getFirebaseToken()) { 611 headers['firebase-token'] = Wallkit.getFirebaseToken(); 612 } 613 if(WallkitClient.session) { 614 headers['wk-session'] = WallkitClient.session; 615 } 616 617 wkwpDebug('F=>get_content_part', 618 '\npost_id', post_id, 619 '\nurl_params', url_params, 620 '\nheaders', headers, 621 '\nwindow.wallkitSettings.config.parse_scripts', window.wallkitSettings.config.parse_scripts 622 ); 623 624 const contentAccessResponce = await fetch("/wp-json/wallkit/v1/get-content-part?" + new URLSearchParams(url_params).toString(), { 625 method: "GET", 626 headers: headers, 627 }) 628 .then(response => { 629 if(response.status !== 200) { 630 return false; 631 } 632 return response.json(); 633 }) 634 .catch((error) => { 635 console.log('WKWP ERROR: get_content_part->contentAccessResponce', error); 636 return false; 637 }); 638 639 640 wkwpDebug('F=>get_content_part', 641 '\ncontentAccessResponce', contentAccessResponce 642 ); 643 644 if(contentAccessResponce.content_part 645 && window.wallkitSettings.config.parse_scripts) { 646 return { 647 contentScripts: parseScripts(contentAccessResponce.content_part), 648 contentPart: removeScriptsFromString(contentAccessResponce.content_part) 649 }; 650 } 651 652 if(contentAccessResponce.content_part) { 653 return { 654 contentScripts: [], 655 contentPart: contentAccessResponce.content_part 656 }; 657 } 658 659 return false; 660 } 661 662 function parseScripts(content) { 663 // Find all script tags and execute them 664 const newScriptsElements = []; 665 const tempDiv = document.createElement('div'); 666 tempDiv.innerHTML = content; 667 const scripts = tempDiv.getElementsByTagName('script'); 668 669 wkwpDebug('F=>parseScripts', 670 '\ncontent', content, 671 '\nscripts', scripts, 672 ); 673 for (let i = 0; i < scripts.length; i++) { 674 const script = scripts[i]; 675 const newScript = document.createElement('script'); 676 677 if (script.src) { 678 // If it's an external script (with src attribute), copy the src 679 newScript.src = script.src; 680 newScript.async = false; // Ensure synchronous execution if needed 681 } else { 682 // If it's an inline script, copy the text content 683 newScript.text = script.innerHTML; 684 } 685 686 // Append the new script tag to the document to execute it 687 newScriptsElements.push(newScript); 688 } 689 690 wkwpDebug('F=>parseScripts', 691 '\nnewScriptsElements', newScriptsElements 692 ); 693 return newScriptsElements; 694 } 695 696 function removeScriptsFromString(content) { 697 wkwpDebug('F=>removeScriptsFromString', 698 '\ncontent', content 699 ); 700 701 // Create a temporary DOM element 702 const tempDiv = document.createElement('div'); 703 tempDiv.innerHTML = content; 704 705 // Find all script elements and remove them 706 const scripts = tempDiv.getElementsByTagName('script'); 707 while (scripts.length > 0) { 708 scripts[0].parentNode.removeChild(scripts[0]); 709 } 710 711 wkwpDebug('F=>removeScriptsFromString', 712 '\ntempDiv.innerHTML', tempDiv.innerHTML 713 ); 714 // Return the HTML content without scripts 715 return tempDiv.innerHTML; 534 716 } 535 717 … … 661 843 // Replace hidden part of content by lorem 662 844 function build_lorem_content(el) { 845 if(el && el.querySelectorAll('p').length > 0 ) { 846 let length = el.querySelectorAll('p').length; 847 848 return get_lorem(length); 849 } 850 851 return ''; 852 } 853 854 function get_lorem(p_count) { 663 855 const loremText = [ 664 856 `Inventore molestiae accusantium fuga delectus. Sed exercitationem aut quis reiciendis nesciunt dolore et. Voluptatibus at suscipit eius ratione perspiciatis provident. Totam minima quia occaecati maxime mollitia.`, … … 684 876 ]; 685 877 686 if(el && el.querySelectorAll('p').length > 0 ) { 687 let length = el.querySelectorAll('p').length; 688 let tempText = []; 689 for ( var i = 0; i < length; i++ ) { 690 tempText.push( loremText[Math.floor(Math.random() * loremText.length)] ); 691 } 692 tempText = tempText.map(item => `<p>${item}</p>`).join(""); 693 694 return tempText; 695 } 696 697 return ''; 878 let tempText = []; 879 for ( var i = 0; i < p_count; i++ ) { 880 tempText.push( loremText[Math.floor(Math.random() * loremText.length)] ); 881 } 882 tempText = tempText.map(item => `<p>${item}</p>`).join(""); 883 884 return tempText; 698 885 } 699 886 -
wallkit/tags/3.3.7/public/js/wallkit-setup.min.js
r3058402 r3155283 1 !function(){var e=document.querySelector("body");e.classList.contains("wkwp-user-hide")||e.classList.add("wkwp-user-hide")}(),function(){window.wkwpCheckAccessPromise=null;var s="",a="";function t(){let r=window.wallkitSettings||{},t=document.querySelector(r.config.inline_modals_selector);m("F=>runInitWkProcess.wkSettings",r),void 0!==r.integration&&(r.config.inline_modals_selector&&t&&t.dataset.modal&&(m("F=>runInitWkProcess.inlineModalsContainer","\ninline_modals_selector",r.config.inline_modals_selector,"\ninlineModalsContainer",t,"\ninlineModalsContainer.dataset.modal",t.dataset.modal),window.location.hash="WkModal("+t.dataset.modal+")"),window.wk=window.wk||[],window.wk.push(["ready",e=>{m("F=>runInitWkProcess.window.wk ready callback",window.wk,e),m("F=>runInitWkProcess.window.wk.authentication",window.wk.authentication,"\nwindow.wk.authentication.isAuthenticated()=>",window.wk.authentication.isAuthenticated()), i(),o(!1),window.wk.on("wk-event-auth",function(){m("E=>wk.events.subscribe=>wk-event-auth"),i(),o()}),window.wk.on("wk-event-registration",function(){m("E=>wk.events.subscribe=>wk-event-registration"),i(),o()}),window.wk.on("success-auth",function({register:e}){m("E=>wk.events.subscribe=>success-auth",e),!0===r.config.wk_auth_migrated_users&&(e=document.querySelector(".wk-user-update-info"),m("E=>wk.events.subscribe=>success-auth","\nwk_auth_migrated_users=>",r.config.wk_auth_migrated_users,"\nuserWithoutSessionInfo=>",e),e)&&w(),r.config.inline_modals_selector&&t&&window.wk.modal(r.config.wk_modal_after_sign_in),i(),o()}),window.wk.on("logout",function(){m("E=>wk.events.subscribe=>logout",r.config.reload_on_logout),!0!==r.config.reload_on_logout?(i(),o(),window.wk.popup.hide()):location.reload()}),window.wk.on("wk-event-transaction",function(){m("E=>wk.events.subscribe=>wk-event-transaction"),o()}),!0===r.config.wk_auth_migrated_users&&window.wk.on("pre-sign-in",async e=>{m("E=>wk.events.subscribe=>pre-sign-in",e);var t,i,o=document.querySelector("#auth-modal-wallkit-modal-spinner");o.style.display="flex";let n=!0,s=!1,a=!1;return await Wallkit.checkUserActivity(e.email).then(e=>{m("E=>wk.events.subscribe=>pre-sign-in=>Wallkit.checkUserActivity.data",e),void 0!==e&&(void 0!==e.is_exist_sessions&&"boolean"==typeof e.is_exist_sessions&&(n=e.is_exist_sessions),void 0!==e.has_user_resource_relationship_password)&&"boolean"==typeof e.has_user_resource_relationship_password&&(a=e.has_user_resource_relationship_password)},e=>{m("E=>wk.events.subscribe=>pre-sign-in=>Wallkit.checkUserActivity.error",e)}),n||a||(m("E=>wk.events.subscribe=>pre-sign-in=>password-reset","\nis_exist_sessions=>",n,"\nuser_has_password=>",a),await window.wk.sdk.methods.client.post({path:"/firebase/password-reset",data:{email:e.email}}).then(e=>{m("E=>wk.events.subscribe=>pre-sign-in=>password-reset.responce",e),s=!0},e=>{m("E=>wk.events.subscribe=>pre-sign-in=>password-reset.error",e)})),s&&(e=document.querySelector("#wk-email-auth-form"),m("E=>wk.events.subscribe=>pre-sign-in","\nis_password_reset=>",s,"\nauthForm=>",e),(t=e.querySelector(".wk-form").querySelector(".wk-form__error"))&&(t.style.display="none"),t=document.createElement("div"),i='<div style="padding: 24px 24px 0 24px;">'+r.config.wk_auth_migrated_users_text+"</div>",t.classList.add("wk-user-update-info"),t.insertAdjacentHTML("beforeend",i),e.parentNode.insertBefore(t,e),e.style.display="none",document.addEventListener("click",u)),o.style.display="none",!0})}]),r.config.inline_modals_selector&&t&&(r.integration.ui={type:"inline",selector:r.config.inline_modals_selector}),"function"==typeof WallkitIntegration?window.wk=new WallkitIntegration(r.integration):console.log("WKWP ERROR: WallkitIntegration function does not exist"))}async function i(){let i=window.wallkitSettings||{},o=window.wallkitTranslations||{};const n=document.querySelectorAll(".wkwp-user-my-account-button");if(m("F=>wkShowUserStatus","\nwkSettings=>",i,"\naccountStatusSpanEls=>",o,"\naccountStatusSpanEls=>",n),n.length){const r=document.querySelectorAll(".wkwp-login-block"),l="https://www.gravatar.com/avatar/?d=mp",c=document.querySelectorAll(".wkwp-user-my-account-img"),u=document.querySelectorAll(".wkwp-site-logo");let t=i.integration.call.classForHandleClick||"wk-call";const w=document.querySelector("body.wkwp-user-hide");var e,s,a;m("F=>wkShowUserStatus.args","\nuserAccountBlock",r,"\nimgDefaultSrc",l,"\naccountStatusImgEls",c,"\naccountSiteLogo",u,"\nwkCallClass",t,"\nwindow.wk.authentication.isAuthenticated()=>",window.wk.authentication.isAuthenticated()),window.wkwpGetUser=new Promise((t,i)=>{window.wk.authentication.isAuthenticated()?window.wk.sdk.methods.client.get({path:"/user"}).then(e=>{m("F=>wkShowUserStatus.wkwpGetUser.wk.sdk.methods.client(/user)",e),0<e.id&&(window.wk.sdk.methods.user=e),t(e)},e=>{console.log("F=>wkShowUserStatus.wkwpGetUser ERROR",e),i(e)}):(m("F=>wkShowUserStatus.wkwpGetUser.wk.authentication.isAuthenticated()",window.wk.authentication.isAuthenticated()),i())}),await window.wkwpGetUser.then(e=>{m("F=>wkShowUserStatus.wkwpGetUser.then.response",e),m("F=>wkShowUserStatus.dispatchEvent.wkwpGetUserCompleted"),window.dispatchEvent(new CustomEvent("wkwpGetUserCompleted",{detail:e})),0<e.id&&(0<c.length&&c.forEach(e=>{e.src=window.wk.sdk.methods.user.photos.image_100,e.classList.remove(t,"wk–sign-in"),e.classList.add(t,"wk–account-settings"),e.style="display:block;"}),0<n.length&&n.forEach(e=>{(e="LI"===e.tagName?e.querySelector("a"):e).innerHTML=i.titles.myAccountButton||o.my_account||"My Account",e.classList.remove(t,"wk–sign-in"),e.classList.add(t,"wk–account-settings")}),0<u.length)&&u.forEach(e=>{e.style="display:none;"}),0<r.length&&r.forEach(e=>{e.style="display:block;"}),w&&w.classList.remove("wkwp-user-hide")}).catch(e=>{m("F=>wkShowUserStatus.wkwpGetUser.catch.error",e),m("F=>wkShowUserStatus.dispatchEvent.wkwpGetUserCompleted.error"),window.dispatchEvent(new CustomEvent("wkwpGetUserCompleted",{detail:!1})),0<c.length&&c.forEach(e=>{e.src=l,e.classList.remove(t,"wk–account-settings"),e.classList.add(t,"wk–sign-in"),e.style="display:none;"}),0<n.length&&n.forEach(e=>{(e="LI"===e.tagName?e.querySelector("a"):e).classList.remove(t,"wk–account-settings"),e.classList.add(t,"wk–sign-in"),e.innerHTML=i.titles.signInButton||o.sign_in||"Sign in"}),0<u.length&&u.forEach(e=>{e.style="display:block;"}),0<r.length&&r.forEach(e=>{e.style="display:block;"}),w&&w.classList.remove("wkwp-user-hide")}),e=window.wallkitSettings||{},s=e.integration.call.classForHandleClick||"wk-call",e.config.wk_my_account_page_url&&((a=document.querySelectorAll(".wk–sign-in")).length&&d(a,e.config.wk_my_account_page_url,[s,"wk–sign-in"]),(a=document.querySelectorAll(".wk–account-settings")).length)&&d(a,e.config.wk_my_account_page_url,[s,"wk–account-settings"])}}function d(e,i,o=[]){e&&i&&e.forEach(e=>{let t=e;o.length&&e.classList.remove(...o),(t="A"!==e.tagName?e.querySelector("a"):t)&&t.setAttribute("href",i)})}function o(e=!0){var t=window.wallkitSettings||{};if(m("F=>wkCheckPostAccess","\nwkSettings",t,"\nnewCheckAccessPromise",e,"\nwindow.wkwpCheckAccessPromise",window.wkwpCheckAccessPromise,"\nwindow.wallkitPostData",window.wallkitPostData,"\n.wkwp-paywall",document.querySelector(".wkwp-paywall")),!0===e&&(window.wkwpCheckAccessPromise=null),!window.wkwpCheckAccessPromise&&void 0!==window.wallkitPostData.config&&void 0!==window.wallkitPostData.config.check_post&&!1!==window.wallkitPostData.config.check_post&&void 0!==window.wallkitPostData.data&&void 0!==window.wallkitPostData.data.id&&""!==window.wallkitPostData.data.id&&(document.querySelector(".wkwp-paywall")||t.config.content_class_selector&&document.querySelector("."+t.config.content_class_selector)||t.config.custom_content_selector&&document.querySelector(""+t.config.custom_content_selector))){e=window.wallkitPostData.data;const o=new window.wk.content(e);m("F=>wkCheckPostAccess.checkAccess","\npostInfo",e,"\nwkPost",o),window.wkwpCheckAccessPromise=new Promise((t,i)=>{o.checkAccess().then(e=>{m("F=>wkCheckPostAccess.wkPost.checkAccess",e),t(e)}).catch(e=>{console.log("WKWP wkPost ERROR",e),i(e)})})}window.wkwpCheckAccessPromise&&window.wkwpCheckAccessPromise.then(e=>{window.removeEventListener("unlockContent",n),m("F=>wkCheckPostAccess.wkwpCheckAccessPromise",e),(1===window.wallkitPostData.config.wk_paywall_display_type?l:r)(e),window.addEventListener("unlockContent",n),m("F=>wkCheckPostAccess.dispatchEvent.wkwpContentLocked"),window.dispatchEvent(new CustomEvent("wkwpContentLocked",{detail:e}))}).catch(e=>{console.log("WKWP ERROR: wkwpCheckAccessPromise",e)})}function n(e){m("F=>handleUnlockContentEvent.addEventListener.unlockContent",e),(1===window.wallkitPostData.config.wk_paywall_display_type?l:r)({allowed:!0})}function r(e){var t=window.wallkitSettings||{},i=document.querySelector(".wkwp-paywall"),o=document.querySelector(".wkwp-paywall .wkwp-content-inner");let n=document.querySelector(".wkwp-paywall .wkwp-paywall-block");m("F=>checkAccessHandling","\nresponse",e,"\nwindow.wallkitPostData",window.wallkitPostData,"\npostContentWrapper",i,"\npostContentBody",o,"\npostPaywallBlock",n,"\nwkContentBody",s,"\nwkPaywallBlock",a),o&&!s&&(s=o.innerHTML),e.allowed?(n&&n.remove(),o&&(s&&!1===t.config.skip_lorem&&(o.innerHTML=s),o.classList.remove("wkwp-content-blured"),o.style="display:block;")):(o&&(!1===t.config.skip_lorem&&(o.innerHTML=function(t){var i=["Inventore molestiae accusantium fuga delectus. Sed exercitationem aut quis reiciendis nesciunt dolore et. Voluptatibus at suscipit eius ratione perspiciatis provident. Totam minima quia occaecati maxime mollitia.","Laborum occaecati sapiente nesciunt voluptatem. Voluptatibus asperiores optio ut. Pariatur perspiciatis voluptatem beatae commodi libero modi.","Aut et ipsum beatae tenetur sit. Necessitatibus harum ea et. Natus aut quas sit dolores odio ut. Ipsum sit corporis maxime voluptatum et. Et labore id rerum nobis quia voluptatibus veniam dolores.","Sed aut repudiandae alias. Sunt est ab dignissimos quasi recusandae labore. Amet vitae illo debitis beatae nesciunt dolor dignissimos. Voluptatum consequuntur error at omnis. Tenetur quaerat facere placeat enim doloribus.","Id tempora quo placeat dolore. Eos sunt sapiente et facere. Ex facere et voluptate praesentium. Modi mollitia at non eum rerum perferendis. Nobis blanditiis consequatur incidunt.","Sint voluptas nam sed. Eligendi beatae corporis omnis ipsum facilis dicta a repudiandae. Suscipit et eligendi eveniet ipsum veritatis aut. Aspernatur adipisci fugit deserunt eos hic ut omnis. Corporis et itaque dicta similique.","Fugit dolores vitae iste qui. Dignissimos quo molestiae cumque. Sequi illo non saepe facere aut aliquid consequuntur sunt. Amet non illo dolor molestiae nulla eligendi quae. Id aut et velit quos sit ratione earum rerum.","Soluta error neque dolor perspiciatis mollitia. Voluptatem corporis doloribus fugiat et. Unde et rerum magni. Dolores nisi laudantium laboriosam voluptatem.","Dolores in illo exercitationem est enim pariatur quam corporis. Non ipsa sequi explicabo. Placeat earum aspernatur quod et quia.","Et sed amet ipsa. Qui et corrupti eaque et at dicta nesciunt vero. Est quasi eius possimus repellat ea ut. Inventore vel et possimus officiis quo consectetur similique. Culpa ut voluptatem non pariatur illum autem sapiente. Et et quidem est dolorum ab.","Amet id ipsam deleniti minima aut laboriosam. Odio ut reiciendis delectus repudiandae dolorem quaerat. Alias asperiores eum molestiae libero assumenda non voluptatibus quo. Et esse laboriosam ab velit et. Eligendi sint assumenda et.","Soluta ex voluptas minima et magnam est. Deserunt error molestiae veritatis amet. Quia provident sint molestiae omnis optio sunt sint. Commodi praesentium est perferendis inventore aut atque dolor doloribus. Minima enim velit eaque qui sed non dignissimos debitis. Rerum placeat in qui reprehenderit blanditiis nemo sed.","Magni dolore enim asperiores quae asperiores. Et quia eligendi ad quo aut labore ut iste. Quia qui esse aperiam eos illum exercitationem minus quod.","Sed ut dolorum sunt. Tempora incidunt aspernatur doloremque voluptatem quidem voluptatem magni. Est voluptatum minus id. Totam repudiandae reiciendis et.","Sint natus tenetur qui earum recusandae id optio. Dolore voluptates et accusamus et tempora sint. Dolores reiciendis iusto et quos aut. Sequi et officiis ipsum distinctio. Expedita voluptatibus corporis odio blanditiis iusto.","Ipsum dolores ut ut. Quia et voluptates accusamus neque quidem exercitationem dignissimos. Libero velit nemo omnis dolores ea repudiandae commodi accusamus. Sint tempore aut officia iste odit odio. Quibusdam sed debitis officiis.","Voluptatem quo est eius occaecati voluptatem tempore. Iste voluptas animi a voluptatem. Debitis est dolore aut fuga sunt voluptatem itaque assumenda. Id magnam officiis sint recusandae dolorum. Architecto numquam dignissimos quam corporis hic. Sit rerum amet provident.","Sed eum reiciendis aspernatur ab cupiditate. Ut atque dolores rerum veritatis voluptatem quidem ex voluptatum. Perspiciatis tempore quia quia animi vel distinctio. Id officia odit iusto facilis aliquid sequi eaque. Magnam eaque laudantium et et exercitationem.","Quod et ut voluptatibus assumenda sed. Nesciunt ea sed asperiores veniam temporibus blanditiis possimus. Quisquam eos voluptas assumenda molestiae.","Labore ipsum vitae dolorem est sed repellendus. Animi qui sequi similique dolorem sed vel omnis. Rerum saepe id atque animi."];if(t&&0<t.querySelectorAll("p").length){var o=t.querySelectorAll("p").length;let e=[];for(var n=0;n<o;n++)e.push(i[Math.floor(Math.random()*i.length)]);return e=e.map(e=>`<p>${e}</p>`).join("")}return""}(o)),window.wallkitPostData.config.show_blur?o.classList.add("wkwp-content-blured"):o.style="display:none;"),!n&&t.config.paywall.content&&((n=document.createElement("div")).classList.add("wkwp-paywall-block"),n.insertAdjacentHTML("beforeend",t.config.paywall.content),o.parentNode.insertBefore(n,o)),c(n)),i.style="display:block;"}function l(e){var t=window.wallkitSettings||{};let i=document.querySelector(".wkwp-paywall"),o="."+t.config.content_class_selector;t.config.custom_content_selector&&(o=t.config.custom_content_selector);var n=document.querySelector(""+o),s=document.querySelectorAll(o+" > *"),a=document.querySelectorAll(o+" > p");if(m("F=>checkAccessHandlingFrontend","\nwkPaywallBlock",e,"\nwkSettings",t,"\nwkwpPaywall",i,"\ntopElement",n,"\nallElements",s,"\nparagraphs",a),n)if(e.allowed)i&&i.remove(),s.forEach(e=>{e.classList.contains("wkwp-element")&&e.classList.remove("wkwp-element","wkwp-blur","wkwp-non-blur")});else if(n.querySelectorAll(".wkwp-element").length)c(i);else{var e=a.length>t.config.wk_free_paragraph&&0<=t.config.wk_free_paragraph?t.config.wk_free_paragraph:a.length,a=a[0<e?e-1:0],r=0===e?0:Array.prototype.indexOf.call(n.children,a)+1,l=["wkwp-element"];window.wallkitPostData.config.show_blur?l.push("wkwp-blur"):l.push("wkwp-non-blur"),m("F=>checkAccessHandlingFrontend.!allowed","\nshowParagraphs",e,"\nlastVisibleParagraph",a,"\nlastVisibleParagraphIndex",r,"\nitemClass",l);for(let e=r;e<s.length;e++)s[e].classList.add(...l);i||((i=document.createElement("div")).classList.add("wkwp-paywall"),i.insertAdjacentHTML("beforeend",`<div class="wkwp-paywall-block">${t.config.paywall.content}</div>`)),0===e?n.insertBefore(i,a):n.insertBefore(i,a.nextSibling),c(i),i.style="display:block;"}}function c(e){m("F=>paywallDisplayLoginLink",e),e&&(e=e.querySelector(".wallkit-paywall-block__login_plans"))&&(window.wk.authentication.isAuthenticated()?e.style="display:none;":e.style="display:block;")}function u(e){switch(m("F=>hideUserWithoutSessionInfo",e),e.target.id){case"auth-signup-link":case"auth-modal-close-btn":case"auth-modal-wrapper":case"auth-password-link":w()}e.target.classList.contains("wk-form-button")&&w()}function w(){var e=document.querySelector(".wk-user-update-info"),t=document.querySelector("#wk-email-auth-form"),i=document.querySelector("#wk-email-auth-form .wk-form .wk-form-header .wk-form__error");m("F=>hideUserWithoutSessionText","\nuserWithoutSessionInfo",e,"\nauthForm",t,"\nauthFormHeaderError",i),document.removeEventListener("click",u),e.remove(),t.style.display="block",i&&(i.style.display="")}function m(e="",...t){void 0!==window.wallkitSettings.config&&window.wallkitSettings.config.debug&&console.log("WKWP DEBUG: ",e,...t)}window.addEventListener("DOMContentLoaded",e=>{m("DOMContentLoaded"),window.runInitWKPromise?(m("window.runInitWKPromise",window.runInitWKPromise),window.runInitWKPromise.then(e=>{m("window.runInitWKPromise.response",e),!0===e.init&&t()}).catch(e=>{console.log("WKWP ERROR: runInitWKPromise",e)})):(m("else runInitWkProcess"),t())})}();1 !function(){var e=document.querySelector("body");e.classList.contains("wkwp-user-hide")||e.classList.add("wkwp-user-hide")}(),function(){window.wkwpCheckAccessPromise=null;var s="",a="";function t(){let r=window.wallkitSettings||{},t=document.querySelector(r.config.inline_modals_selector);m("F=>runInitWkProcess.wkSettings",r),void 0!==r.integration&&(r.config.inline_modals_selector&&t&&t.dataset.modal&&(m("F=>runInitWkProcess.inlineModalsContainer","\ninline_modals_selector",r.config.inline_modals_selector,"\ninlineModalsContainer",t,"\ninlineModalsContainer.dataset.modal",t.dataset.modal),window.location.hash="WkModal("+t.dataset.modal+")"),window.wk=window.wk||[],window.wk.push(["ready",e=>{m("F=>runInitWkProcess.window.wk ready callback",window.wk,e),m("F=>runInitWkProcess.window.wk.authentication",window.wk.authentication,"\nwindow.wk.authentication.isAuthenticated()=>",window.wk.authentication.isAuthenticated()),n(),i(!1),window.wk.on("wk-event-auth",function(){m("E=>wk.events.subscribe=>wk-event-auth"),n(),i()}),window.wk.on("wk-event-registration",function(){m("E=>wk.events.subscribe=>wk-event-registration"),n(),i()}),window.wk.on("success-auth",function({register:e}){m("E=>wk.events.subscribe=>success-auth",e),!0===r.config.wk_auth_migrated_users&&(e=document.querySelector(".wk-user-update-info"),m("E=>wk.events.subscribe=>success-auth","\nwk_auth_migrated_users=>",r.config.wk_auth_migrated_users,"\nuserWithoutSessionInfo=>",e),e)&&w(),r.config.inline_modals_selector&&t&&window.wk.modal(r.config.wk_modal_after_sign_in),n(),i()}),window.wk.on("logout",function(){m("E=>wk.events.subscribe=>logout",r.config.reload_on_logout),!0!==r.config.reload_on_logout?(n(),i(),window.wk.popup.hide()):location.reload()}),window.wk.on("wk-event-transaction",function(){m("E=>wk.events.subscribe=>wk-event-transaction"),i()}),!0===r.config.wk_auth_migrated_users&&window.wk.on("pre-sign-in",async e=>{m("E=>wk.events.subscribe=>pre-sign-in",e);var t,n,i=document.querySelector("#auth-modal-wallkit-modal-spinner");i.style.display="flex";let o=!0,s=!1,a=!1;return await Wallkit.checkUserActivity(e.email).then(e=>{m("E=>wk.events.subscribe=>pre-sign-in=>Wallkit.checkUserActivity.data",e),void 0!==e&&(void 0!==e.is_exist_sessions&&"boolean"==typeof e.is_exist_sessions&&(o=e.is_exist_sessions),void 0!==e.has_user_resource_relationship_password)&&"boolean"==typeof e.has_user_resource_relationship_password&&(a=e.has_user_resource_relationship_password)},e=>{m("E=>wk.events.subscribe=>pre-sign-in=>Wallkit.checkUserActivity.error",e)}),o||a||(m("E=>wk.events.subscribe=>pre-sign-in=>password-reset","\nis_exist_sessions=>",o,"\nuser_has_password=>",a),await window.wk.sdk.methods.client.post({path:"/firebase/password-reset",data:{email:e.email}}).then(e=>{m("E=>wk.events.subscribe=>pre-sign-in=>password-reset.responce",e),s=!0},e=>{m("E=>wk.events.subscribe=>pre-sign-in=>password-reset.error",e)})),s&&(e=document.querySelector("#wk-email-auth-form"),m("E=>wk.events.subscribe=>pre-sign-in","\nis_password_reset=>",s,"\nauthForm=>",e),(t=e.querySelector(".wk-form").querySelector(".wk-form__error"))&&(t.style.display="none"),t=document.createElement("div"),n='<div style="padding: 24px 24px 0 24px;">'+r.config.wk_auth_migrated_users_text+"</div>",t.classList.add("wk-user-update-info"),t.insertAdjacentHTML("beforeend",n),e.parentNode.insertBefore(t,e),e.style.display="none",document.addEventListener("click",u)),i.style.display="none",!0})}]),r.config.inline_modals_selector&&t&&(r.integration.ui={type:"inline",selector:r.config.inline_modals_selector}),"function"==typeof WallkitIntegration?window.wk=new WallkitIntegration(r.integration):console.log("WKWP ERROR: WallkitIntegration function does not exist"))}async function n(){let n=window.wallkitSettings||{},i=window.wallkitTranslations||{};const o=document.querySelectorAll(".wkwp-user-my-account-button");if(m("F=>wkShowUserStatus","\nwkSettings=>",n,"\naccountStatusSpanEls=>",i,"\naccountStatusSpanEls=>",o),o.length){const r=document.querySelectorAll(".wkwp-login-block"),l="https://www.gravatar.com/avatar/?d=mp",c=document.querySelectorAll(".wkwp-user-my-account-img"),u=document.querySelectorAll(".wkwp-site-logo");let t=n.integration.call.classForHandleClick||"wk-call";const w=document.querySelector("body.wkwp-user-hide");var e,s,a;m("F=>wkShowUserStatus.args","\nuserAccountBlock",r,"\nimgDefaultSrc",l,"\naccountStatusImgEls",c,"\naccountSiteLogo",u,"\nwkCallClass",t,"\nwindow.wk.authentication.isAuthenticated()=>",window.wk.authentication.isAuthenticated()),window.wkwpGetUser=new Promise((t,n)=>{window.wk.authentication.isAuthenticated()?window.wk.sdk.methods.client.get({path:"/user"}).then(e=>{m("F=>wkShowUserStatus.wkwpGetUser.wk.sdk.methods.client(/user)",e),0<e.id&&(window.wk.sdk.methods.user=e),t(e)},e=>{console.log("F=>wkShowUserStatus.wkwpGetUser ERROR",e),n(e)}):(m("F=>wkShowUserStatus.wkwpGetUser.wk.authentication.isAuthenticated()",window.wk.authentication.isAuthenticated()),n())}),await window.wkwpGetUser.then(e=>{m("F=>wkShowUserStatus.wkwpGetUser.then.response",e),m("F=>wkShowUserStatus.dispatchEvent.wkwpGetUserCompleted"),window.dispatchEvent(new CustomEvent("wkwpGetUserCompleted",{detail:e})),0<e.id&&(0<c.length&&c.forEach(e=>{e.src=window.wk.sdk.methods.user.photos.image_100,e.classList.remove(t,"wk–sign-in"),e.classList.add(t,"wk–account-settings"),e.style="display:block;"}),0<o.length&&o.forEach(e=>{(e="LI"===e.tagName?e.querySelector("a"):e).innerHTML=n.titles.myAccountButton||i.my_account||"My Account",e.classList.remove(t,"wk–sign-in"),e.classList.add(t,"wk–account-settings")}),0<u.length)&&u.forEach(e=>{e.style="display:none;"}),0<r.length&&r.forEach(e=>{e.style="display:block;"}),w&&w.classList.remove("wkwp-user-hide")}).catch(e=>{m("F=>wkShowUserStatus.wkwpGetUser.catch.error",e),m("F=>wkShowUserStatus.dispatchEvent.wkwpGetUserCompleted.error"),window.dispatchEvent(new CustomEvent("wkwpGetUserCompleted",{detail:!1})),0<c.length&&c.forEach(e=>{e.src=l,e.classList.remove(t,"wk–account-settings"),e.classList.add(t,"wk–sign-in"),e.style="display:none;"}),0<o.length&&o.forEach(e=>{(e="LI"===e.tagName?e.querySelector("a"):e).classList.remove(t,"wk–account-settings"),e.classList.add(t,"wk–sign-in"),e.innerHTML=n.titles.signInButton||i.sign_in||"Sign in"}),0<u.length&&u.forEach(e=>{e.style="display:block;"}),0<r.length&&r.forEach(e=>{e.style="display:block;"}),w&&w.classList.remove("wkwp-user-hide")}),e=window.wallkitSettings||{},s=e.integration.call.classForHandleClick||"wk-call",e.config.wk_my_account_page_url&&((a=document.querySelectorAll(".wk–sign-in")).length&&d(a,e.config.wk_my_account_page_url,[s,"wk–sign-in"]),(a=document.querySelectorAll(".wk–account-settings")).length)&&d(a,e.config.wk_my_account_page_url,[s,"wk–account-settings"])}}function d(e,n,i=[]){e&&n&&e.forEach(e=>{let t=e;i.length&&e.classList.remove(...i),(t="A"!==e.tagName?e.querySelector("a"):t)&&t.setAttribute("href",n)})}function i(e=!0){var t=window.wallkitSettings||{};if(m("F=>wkCheckPostAccess","\nwkSettings",t,"\nnewCheckAccessPromise",e,"\nwindow.wkwpCheckAccessPromise",window.wkwpCheckAccessPromise,"\nwindow.wallkitPostData",window.wallkitPostData,"\n.wkwp-paywall",document.querySelector(".wkwp-paywall")),!0===e&&(window.wkwpCheckAccessPromise=null),!window.wkwpCheckAccessPromise&&void 0!==window.wallkitPostData.config&&void 0!==window.wallkitPostData.config.check_post&&!1!==window.wallkitPostData.config.check_post&&void 0!==window.wallkitPostData.data&&void 0!==window.wallkitPostData.data.id&&""!==window.wallkitPostData.data.id&&(document.querySelector(".wkwp-paywall")||t.config.content_class_selector&&document.querySelector("."+t.config.content_class_selector)||t.config.custom_content_selector&&document.querySelector(""+t.config.custom_content_selector))){e=window.wallkitPostData.data;const i=new window.wk.content(e);m("F=>wkCheckPostAccess.checkAccess","\npostInfo",e,"\nwkPost",i),window.wkwpCheckAccessPromise=new Promise((t,n)=>{3===window.wallkitPostData.config.wk_paywall_display_type?t({}):i.checkAccess().then(e=>{m("F=>wkCheckPostAccess.wkPost.checkAccess",e),t(e)}).catch(e=>{console.log("WKWP wkPost ERROR",e),n(e)})})}window.wkwpCheckAccessPromise&&window.wkwpCheckAccessPromise.then(e=>{switch(window.removeEventListener("unlockContent",o),m("F=>wkCheckPostAccess.wkwpCheckAccessPromise",e),window.wallkitPostData.config.wk_paywall_display_type){case 1:l(e);break;case 3:!async function(){var e=window.wallkitSettings||{};var t=document.querySelector(".wkwp-paywall"),n=document.querySelector(".wkwp-paywall .wkwp-content-inner");let i=document.querySelector(".wkwp-paywall .wkwp-paywall-block"),o=(m("F=>checkAccessHandlingBackend","\nwindow.wallkitPostData",window.wallkitPostData,"\npostContentWrapper",t,"\npostContentBody",n,"\npostPaywallBlock",i,"\nwkPaywallBlock",a),await async function(){var e=window.wallkitPostData.data.id.split("_").slice(-1),t={post_id:e};var n={};Wallkit.getToken()&&(n["wk-token"]=Wallkit.getToken());Wallkit.getFirebaseToken()&&(n["firebase-token"]=Wallkit.getFirebaseToken());WallkitClient.session&&(n["wk-session"]=WallkitClient.session);m("F=>get_content_part","\npost_id",e,"\nurl_params",t,"\nheaders",n,"\nwindow.wallkitSettings.config.parse_scripts",window.wallkitSettings.config.parse_scripts);e=await fetch("/wp-json/wallkit/v1/get-content-part?"+new URLSearchParams(t).toString(),{method:"GET",headers:n}).then(e=>200===e.status&&e.json()).catch(e=>(console.log("WKWP ERROR: get_content_part->contentAccessResponce",e),!1));if(m("F=>get_content_part","\ncontentAccessResponce",e),e.content_part&&window.wallkitSettings.config.parse_scripts)return{contentScripts:function(e){var t=[],n=document.createElement("div"),i=(n.innerHTML=e,n.getElementsByTagName("script"));m("F=>parseScripts","\ncontent",e,"\nscripts",i);for(let e=0;e<i.length;e++){var o=i[e],s=document.createElement("script");o.src?(s.src=o.src,s.async=!1):s.text=o.innerHTML,t.push(s)}return m("F=>parseScripts","\nnewScriptsElements",t),t}(e.content_part),contentPart:function(e){m("F=>removeScriptsFromString","\ncontent",e);var t=document.createElement("div"),n=(t.innerHTML=e,t.getElementsByTagName("script"));for(;0<n.length;)n[0].parentNode.removeChild(n[0]);return m("F=>removeScriptsFromString","\ntempDiv.innerHTML",t.innerHTML),t.innerHTML}(e.content_part)};if(e.content_part)return{contentScripts:[],contentPart:e.content_part};return!1}());{var s;m("F=>checkAccessHandlingBackend=>get_content_part","\ncontentPart",o.contentPart,"\ncontentScripts",o.contentScripts),o?(i&&i.remove(),n&&(n.innerHTML=o.contentPart||"",o.contentScripts&&o.contentScripts.forEach(e=>document.body.appendChild(e)),n.classList.remove("wkwp-content-blured"),n.style="display:block;")):(n&&(s=parseInt(n.dataset.paragraphs)||0,n.innerHTML=p(s),window.wallkitPostData.config.show_blur?n.classList.add("wkwp-content-blured"):n.style="display:none;"),!i&&e.config.paywall.content&&((i=document.createElement("div")).classList.add("wkwp-paywall-block"),i.insertAdjacentHTML("beforeend",e.config.paywall.content),n.parentNode.insertBefore(i,n)),c(i)),t.style="display:block;"}}();break;default:r(e)}window.addEventListener("unlockContent",o),m("F=>wkCheckPostAccess.dispatchEvent.wkwpContentLocked"),window.dispatchEvent(new CustomEvent("wkwpContentLocked",{detail:e}))}).catch(e=>{console.log("WKWP ERROR: wkwpCheckAccessPromise",e)})}function o(e){m("F=>handleUnlockContentEvent.addEventListener.unlockContent",e),(1===window.wallkitPostData.config.wk_paywall_display_type?l:r)({allowed:!0})}function r(e){var t=window.wallkitSettings||{},n=document.querySelector(".wkwp-paywall"),i=document.querySelector(".wkwp-paywall .wkwp-content-inner");let o=document.querySelector(".wkwp-paywall .wkwp-paywall-block");m("F=>checkAccessHandlingCSS","\nresponse",e,"\nwindow.wallkitPostData",window.wallkitPostData,"\npostContentWrapper",n,"\npostContentBody",i,"\npostPaywallBlock",o,"\nwkContentBody",s,"\nwkPaywallBlock",a),i&&!s&&(s=i.innerHTML),e.allowed?(o&&o.remove(),i&&(s&&!1===t.config.skip_lorem&&(i.innerHTML=s),i.classList.remove("wkwp-content-blured"),i.style="display:block;")):(i&&(!1===t.config.skip_lorem&&(i.innerHTML=function(e){if(e&&0<e.querySelectorAll("p").length)return p(e.querySelectorAll("p").length);return""}(i)),window.wallkitPostData.config.show_blur?i.classList.add("wkwp-content-blured"):i.style="display:none;"),!o&&t.config.paywall.content&&((o=document.createElement("div")).classList.add("wkwp-paywall-block"),o.insertAdjacentHTML("beforeend",t.config.paywall.content),i.parentNode.insertBefore(o,i)),c(o)),n.style="display:block;"}function l(e){var t=window.wallkitSettings||{};let n=document.querySelector(".wkwp-paywall"),i="."+t.config.content_class_selector;t.config.custom_content_selector&&(i=t.config.custom_content_selector);var o=document.querySelector(""+i),s=document.querySelectorAll(i+" > *"),a=document.querySelectorAll(i+" > p");if(m("F=>checkAccessHandlingFrontend","\nwkPaywallBlock",e,"\nwkSettings",t,"\nwkwpPaywall",n,"\ntopElement",o,"\nallElements",s,"\nparagraphs",a),o)if(e.allowed)n&&n.remove(),s.forEach(e=>{e.classList.contains("wkwp-element")&&e.classList.remove("wkwp-element","wkwp-blur","wkwp-non-blur")});else if(o.querySelectorAll(".wkwp-element").length)c(n);else{var e=a.length>t.config.wk_free_paragraph&&0<=t.config.wk_free_paragraph?t.config.wk_free_paragraph:a.length,a=a[0<e?e-1:0],r=0===e?0:Array.prototype.indexOf.call(o.children,a)+1,l=["wkwp-element"];window.wallkitPostData.config.show_blur?l.push("wkwp-blur"):l.push("wkwp-non-blur"),m("F=>checkAccessHandlingFrontend.!allowed","\nshowParagraphs",e,"\nlastVisibleParagraph",a,"\nlastVisibleParagraphIndex",r,"\nitemClass",l);for(let e=r;e<s.length;e++)s[e].classList.add(...l);n||((n=document.createElement("div")).classList.add("wkwp-paywall"),n.insertAdjacentHTML("beforeend",`<div class="wkwp-paywall-block">${t.config.paywall.content}</div>`)),0===e?o.insertBefore(n,a):o.insertBefore(n,a.nextSibling),c(n),n.style="display:block;"}}function c(e){m("F=>paywallDisplayLoginLink",e),e&&(e=e.querySelector(".wallkit-paywall-block__login_plans"))&&(window.wk.authentication.isAuthenticated()?e.style="display:none;":e.style="display:block;")}function u(e){switch(m("F=>hideUserWithoutSessionInfo",e),e.target.id){case"auth-signup-link":case"auth-modal-close-btn":case"auth-modal-wrapper":case"auth-password-link":w()}e.target.classList.contains("wk-form-button")&&w()}function w(){var e=document.querySelector(".wk-user-update-info"),t=document.querySelector("#wk-email-auth-form"),n=document.querySelector("#wk-email-auth-form .wk-form .wk-form-header .wk-form__error");m("F=>hideUserWithoutSessionText","\nuserWithoutSessionInfo",e,"\nauthForm",t,"\nauthFormHeaderError",n),document.removeEventListener("click",u),e.remove(),t.style.display="block",n&&(n.style.display="")}function p(e){var t=["Inventore molestiae accusantium fuga delectus. Sed exercitationem aut quis reiciendis nesciunt dolore et. Voluptatibus at suscipit eius ratione perspiciatis provident. Totam minima quia occaecati maxime mollitia.","Laborum occaecati sapiente nesciunt voluptatem. Voluptatibus asperiores optio ut. Pariatur perspiciatis voluptatem beatae commodi libero modi.","Aut et ipsum beatae tenetur sit. Necessitatibus harum ea et. Natus aut quas sit dolores odio ut. Ipsum sit corporis maxime voluptatum et. Et labore id rerum nobis quia voluptatibus veniam dolores.","Sed aut repudiandae alias. Sunt est ab dignissimos quasi recusandae labore. Amet vitae illo debitis beatae nesciunt dolor dignissimos. Voluptatum consequuntur error at omnis. Tenetur quaerat facere placeat enim doloribus.","Id tempora quo placeat dolore. Eos sunt sapiente et facere. Ex facere et voluptate praesentium. Modi mollitia at non eum rerum perferendis. Nobis blanditiis consequatur incidunt.","Sint voluptas nam sed. Eligendi beatae corporis omnis ipsum facilis dicta a repudiandae. Suscipit et eligendi eveniet ipsum veritatis aut. Aspernatur adipisci fugit deserunt eos hic ut omnis. Corporis et itaque dicta similique.","Fugit dolores vitae iste qui. Dignissimos quo molestiae cumque. Sequi illo non saepe facere aut aliquid consequuntur sunt. Amet non illo dolor molestiae nulla eligendi quae. Id aut et velit quos sit ratione earum rerum.","Soluta error neque dolor perspiciatis mollitia. Voluptatem corporis doloribus fugiat et. Unde et rerum magni. Dolores nisi laudantium laboriosam voluptatem.","Dolores in illo exercitationem est enim pariatur quam corporis. Non ipsa sequi explicabo. Placeat earum aspernatur quod et quia.","Et sed amet ipsa. Qui et corrupti eaque et at dicta nesciunt vero. Est quasi eius possimus repellat ea ut. Inventore vel et possimus officiis quo consectetur similique. Culpa ut voluptatem non pariatur illum autem sapiente. Et et quidem est dolorum ab.","Amet id ipsam deleniti minima aut laboriosam. Odio ut reiciendis delectus repudiandae dolorem quaerat. Alias asperiores eum molestiae libero assumenda non voluptatibus quo. Et esse laboriosam ab velit et. Eligendi sint assumenda et.","Soluta ex voluptas minima et magnam est. Deserunt error molestiae veritatis amet. Quia provident sint molestiae omnis optio sunt sint. Commodi praesentium est perferendis inventore aut atque dolor doloribus. Minima enim velit eaque qui sed non dignissimos debitis. Rerum placeat in qui reprehenderit blanditiis nemo sed.","Magni dolore enim asperiores quae asperiores. Et quia eligendi ad quo aut labore ut iste. Quia qui esse aperiam eos illum exercitationem minus quod.","Sed ut dolorum sunt. Tempora incidunt aspernatur doloremque voluptatem quidem voluptatem magni. Est voluptatum minus id. Totam repudiandae reiciendis et.","Sint natus tenetur qui earum recusandae id optio. Dolore voluptates et accusamus et tempora sint. Dolores reiciendis iusto et quos aut. Sequi et officiis ipsum distinctio. Expedita voluptatibus corporis odio blanditiis iusto.","Ipsum dolores ut ut. Quia et voluptates accusamus neque quidem exercitationem dignissimos. Libero velit nemo omnis dolores ea repudiandae commodi accusamus. Sint tempore aut officia iste odit odio. Quibusdam sed debitis officiis.","Voluptatem quo est eius occaecati voluptatem tempore. Iste voluptas animi a voluptatem. Debitis est dolore aut fuga sunt voluptatem itaque assumenda. Id magnam officiis sint recusandae dolorum. Architecto numquam dignissimos quam corporis hic. Sit rerum amet provident.","Sed eum reiciendis aspernatur ab cupiditate. Ut atque dolores rerum veritatis voluptatem quidem ex voluptatum. Perspiciatis tempore quia quia animi vel distinctio. Id officia odit iusto facilis aliquid sequi eaque. Magnam eaque laudantium et et exercitationem.","Quod et ut voluptatibus assumenda sed. Nesciunt ea sed asperiores veniam temporibus blanditiis possimus. Quisquam eos voluptas assumenda molestiae.","Labore ipsum vitae dolorem est sed repellendus. Animi qui sequi similique dolorem sed vel omnis. Rerum saepe id atque animi."];let n=[];for(var i=0;i<e;i++)n.push(t[Math.floor(Math.random()*t.length)]);return n=n.map(e=>`<p>${e}</p>`).join("")}function m(e="",...t){void 0!==window.wallkitSettings.config&&window.wallkitSettings.config.debug&&console.log("WKWP DEBUG: ",e,...t)}window.addEventListener("DOMContentLoaded",e=>{m("DOMContentLoaded"),window.runInitWKPromise?(m("window.runInitWKPromise",window.runInitWKPromise),window.runInitWKPromise.then(e=>{m("window.runInitWKPromise.response",e),!0===e.init&&t()}).catch(e=>{console.log("WKWP ERROR: runInitWKPromise",e)})):(m("else runInitWkProcess"),t())})}(); -
wallkit/tags/3.3.7/readme.txt
r3117047 r3155283 28 28 == Changelog == 29 29 30 = 3.3.7 = 31 *Release Date - 20 September 2024* 32 33 #### Updates including: 34 - Core updates. 35 - Added fully backend paywalled, in this mode content will returned from backend if user has access. 36 30 37 = 3.3.6 = 31 38 *Release Date - 12 July 2024* -
wallkit/tags/3.3.7/vendor/wallkit-php-sdk/src/WallkitClient.php
r2874245 r3155283 15 15 protected $token; 16 16 17 18 /** 19 * @var FirebaseToken $token 17 /** 18 * @var FirebaseToken $firebase_token 20 19 */ 21 20 protected $firebase_token; 21 22 /** 23 * @var WallkitSession $session_token 24 */ 25 protected $session_token; 22 26 23 27 protected $host; … … 63 67 $this->firebase_token = $token; 64 68 } 69 70 /** 71 * @param WallkitSession $session_token 72 * @throws WallkitException 73 */ 74 function setSessionToken($session_token) 75 { 76 if (!$session_token instanceof WallkitSession) 77 throw new WallkitException('Invalid Firebase Token'); 78 79 $this->session_token = $session_token; 80 } 65 81 66 82 /** … … 83 99 return false; 84 100 } 101 102 /** 103 * @return bool|String 104 */ 105 public function getSessionTokenValue() { 106 if ($this->session_token) 107 return $this->session_token->getValue(); 108 return false; 109 } 85 110 86 111 /** … … 98 123 { 99 124 $headers['firebase-token'] = $this->getFirebaseTokenValue(); 125 } 126 127 if($this->session_token instanceof WallkitSession) 128 { 129 $headers['session'] = $this->getSessionTokenValue(); 100 130 } 101 131 -
wallkit/tags/3.3.7/vendor/wallkit-php-sdk/src/WallkitSDK.php
r3117047 r3155283 38 38 */ 39 39 protected $firebase_token; 40 41 /** 42 * @var WallkitSession $token 43 */ 44 protected $session_token; 40 45 41 46 /** … … 79 84 self::$instance->token = $this->getRequestToken(); 80 85 self::$instance->firebase_token = $this->getRequestFirebaseToken(); 86 self::$instance->session_token = $this->getRequestSessionToken(); 81 87 self::$instance->client = new WallkitClient($this->token,$config['api_host'],$config['api_version'],$config['public_key']); 82 88 … … 88 94 { 89 95 self::$instance->client->setFirebaseToken(self::$instance->firebase_token); 96 } 97 98 if(self::$instance->session_token instanceof WallkitSession) 99 { 100 self::$instance->client->setSessionToken(self::$instance->session_token); 90 101 } 91 102 … … 163 174 164 175 /** 176 * @since 3.3.7 177 * 178 * @return null|WallkitSession 179 */ 180 function getRequestSessionToken() 181 { 182 if (isset($_SERVER['HTTP_WK_SESSION'])){ 183 return new WallkitSession(stripcslashes($_SERVER['HTTP_WK_SESSION'])); 184 } 185 186 if (isset($_COOKIE['wk-session_'.self::$instance->resource_id])){ 187 return new WallkitSession(stripcslashes($_COOKIE['wk-session_'.self::$instance->resource_id])); 188 } 189 190 return null; 191 } 192 193 /** 165 194 * @return User 166 195 */ -
wallkit/tags/3.3.7/wallkit-wp.php
r3117047 r3155283 10 10 * Plugin URI: https://wallkit.net 11 11 * Description: A Plug & Play paid-content system to manage subscribers, gather fees and drive additional content sales. 12 * Version: 3.3. 612 * Version: 3.3.7 13 13 * Author: Wallkit <dev@wallkit.net> 14 14 * Author URI: https://wallkit.net/ … … 27 27 * Rename this for your plugin and update it as you release new versions. 28 28 */ 29 define( 'WPWKP_VERSION', '3.3. 6' );29 define( 'WPWKP_VERSION', '3.3.7' ); 30 30 31 31 /** -
wallkit/trunk/admin/class-wallkit-wp-admin.php
r3074025 r3155283 443 443 if(is_singular()) { 444 444 switch ($paywallType) { 445 case 0: $content = $this->get_ backend_paywalled($content); break;445 case 0: $content = $this->get_hard_css_paywalled($content); break; 446 446 case 1: $content = $this->get_frontend_paywalled($content); break; 447 case 3: $content = $this->get_backend_paywalled($content); break; 447 448 } 448 449 } … … 465 466 466 467 public function update_wallkit_popup_settings($settings) { 467 var_dump('ASDASDASD');468 468 $settings['integration']['ui'] = [ 469 469 'type' => 'inline', … … 505 505 * @return string 506 506 */ 507 p rivatefunction get_content_body_paragraph($content, $cut_paragraph_count = 1) {507 public static function get_content_body_paragraph($content, $cut_paragraph_count = 1) { 508 508 if($cut_paragraph_count < 0) { 509 509 return force_balance_tags( apply_filters('wallkit_customize_post_locked_content', '') ); … … 524 524 525 525 /** 526 * Get locked content not displayed for user 527 * 528 * @since 3.3.7 529 * @param $content 530 * @param int $cut_paragraph_count 531 * @return string 532 */ 533 private function get_content_body_paragraphs_count($content, $cut_paragraph_count = 1) { 534 if($cut_paragraph_count < 0) { 535 return force_balance_tags( apply_filters('wallkit_customize_post_locked_content', '') ); 536 } 537 538 $parts = count(explode("</p>", $content)); 539 540 return force_balance_tags( apply_filters('wallkit_customize_post_locked_paragraphs_count', $parts-1) ); 541 } 542 543 /** 526 544 * @param $content 527 545 * @return int … … 536 554 * @return string 537 555 */ 538 private function get_ backend_paywalled($content) {556 private function get_hard_css_paywalled($content) { 539 557 $cut_paragraph_count = $this->collection->get_settings() 540 558 ->get_option("wk_free_paragraph", 1); … … 556 574 } 557 575 558 $content .= $this->get_content_body_paragraph($source_content, $cut_paragraph_count); 576 $content .= self::get_content_body_paragraph($source_content, $cut_paragraph_count); 577 578 $content .= '</div>'; 579 $content .= '</div>'; 580 581 return $content; 582 } 583 584 /** 585 * Paywalled and blocked content on backend 586 * 587 * @since 3.3.7 588 * @param $content 589 * @return string 590 */ 591 private function get_backend_paywalled($content) { 592 $cut_paragraph_count = $this->collection->get_settings() 593 ->get_option("wk_free_paragraph", 1); 594 595 $source_content = $this->get_formatted_content($content); 596 $content = '<div class="wpwp-non-paywall">' . $this->get_content_intro_paragraph($source_content, $cut_paragraph_count) . '</div>'; 597 598 $content .= '<div class="wkwp-paywall">'; 599 $content .= '<div class="wkwp-paywall-block">'; 600 $content .= force_balance_tags(wpautop(base64_decode($this->collection->get_settings() 601 ->get_option("wk_content_access_html")))); 602 $content .= '</div>'; 603 604 if ($this->collection->get_settings() 605 ->get_option("wk_show_blur")) { 606 $count_paragraps = $this->get_content_body_paragraphs_count($source_content, $cut_paragraph_count); 607 $content .= '<div class="wkwp-content-inner wkwp-content-blured" data-paragraphs="' . $count_paragraps . '">'; 608 } else { 609 $content .= '<div class="wkwp-content-inner">'; 610 } 559 611 560 612 $content .= '</div>'; … … 589 641 * @return string 590 642 */ 591 public function get_formatted_content($content) {643 public static function get_formatted_content($content) { 592 644 $blocks = parse_blocks( $content ); 593 645 $output = ''; -
wallkit/trunk/admin/partials/settings/template-settings.php
r3017147 r3155283 155 155 <input type="hidden" name="wk_settings[wk_paywall_display_type]" value="0" /> 156 156 <div> 157 <label for="wk_paywall_display_type_ backend">158 <input type="radio" id="wk_paywall_display_type_ backend" name="wk_settings[wk_paywall_display_type]" value="0" <?php checked($wk_paywall_display_type, 0);?> >159 Backend</label>157 <label for="wk_paywall_display_type_css"> 158 <input type="radio" id="wk_paywall_display_type_css" name="wk_settings[wk_paywall_display_type]" value="0" <?php checked($wk_paywall_display_type, 0);?> > 159 Frontend (by CSS)</label> 160 160 </div> 161 161 … … 163 163 <label for="wk_paywall_display_type_frontend"> 164 164 <input type="radio" id="wk_paywall_display_type_frontend" name="wk_settings[wk_paywall_display_type]" value="1" <?php checked($wk_paywall_display_type, 1);?> > 165 Frontend</label> 165 Frontend (by JavaScript)</label> 166 </div> 167 168 <div> 169 <label for="wk_paywall_display_type_backend"> 170 <input type="radio" id="wk_paywall_display_type_backend" name="wk_settings[wk_paywall_display_type]" value="3" <?php checked($wk_paywall_display_type, 3);?> > 171 Backend</label> 166 172 </div> 167 173 -
wallkit/trunk/includes/class-wallkit-wp-access.php
r3017147 r3155283 32 32 static::$wallkit_Wp_Collection = $wallkit_Wp_Collection; 33 33 $this->setContentKeyPrefix(); 34 add_filter('wallkit_check_post_access', array($this, 'check_post_access_wk_request'), 10, 2); 34 35 } 35 36 … … 126 127 } 127 128 129 /** 130 * Check post access in wallkit 131 * 132 * @since 3.3.7 133 * @param \WP_Post|null $WP_Post 134 * @param bool $autoCreate 135 * @return array|bool 136 */ 137 public function check_post_access_wk_request(WP_Post $WP_Post = null, $autoCreate = true) { 138 139 if(!$WP_Post instanceof WP_Post || !isset($WP_Post->ID)) 140 { 141 return true; 142 } 143 144 if(!isset($WP_Post->post_type) || empty($WP_Post->post_type)) 145 { 146 return true; 147 } 148 149 $disablePaywallOnPost = get_post_meta($WP_Post->ID, 'disable_paywall_on_post', true); 150 if($disablePaywallOnPost === '1') 151 { 152 return true; 153 } 154 155 /** 156 * Disable locked content if user logged in admin area 157 */ 158 if(is_user_logged_in() && !self::$wallkit_Wp_Collection->get_settings()->get_option("wk_admin_paywall")) 159 { 160 return true; 161 } 162 163 try { 164 165 $Sdk = static::$wallkit_Wp_Collection->get_settings()->get_sdk(); 166 167 if(!$Sdk instanceof \WallkitSDK\WallkitSDK) 168 { 169 return true; 170 } 171 172 /** 173 * Locked content for checked post types 174 */ 175 $registeredPostTypes = self::$wallkit_Wp_Collection->get_settings()->get_option("wk_check_post_type_access"); 176 if( !(!empty($registeredPostTypes) && array_key_exists($WP_Post->post_type, $registeredPostTypes) && $registeredPostTypes[$WP_Post->post_type]) ) { 177 return true; 178 } 179 180 $access = $Sdk 181 ->get("/user/content/" . $this->content_key_prefix . $WP_Post->ID) 182 ->toArray(); 183 184 return [ 185 'allow' => (bool) (isset($access["allow"]) ? $access["allow"] : false), 186 'response' => $access, 187 ]; 188 } 189 catch(\WallkitSDK\Exceptions\WallkitException $exception) 190 { 191 if($exception->getMessage() !== 'Content not exist') { 192 return [ 193 'allow' => false, 194 'reason' => $exception->getMessage(), 195 'message' => 'Content check access error' 196 ]; 197 } 198 199 if(self::$wallkit_Wp_Collection->get_settings()->get_option("wk_is_auto_sync") && $autoCreate) { 200 try { 201 $this->get_wk_posts()->createPost($WP_Post->ID, $WP_Post); 202 203 return $this->check_post_access_wk_request($WP_Post, false); 204 } 205 catch(\Exception $exception) { 206 return [ 207 'allow' => false, 208 'reason' => $exception->getMessage(), 209 'message' => 'Sync content error' 210 ]; 211 } 212 } 213 } 214 catch (\Exception $exception) 215 { 216 return [ 217 'allow' => false, 218 'reason' => $exception->getMessage(), 219 'message' => 'Exception check access error' 220 ]; 221 } 222 } 128 223 } -
wallkit/trunk/includes/class-wallkit-wp-settings.php
r3058402 r3155283 430 430 'wk_auth_migrated_users_text' => base64_decode($this->get_option('wk_auth_migrated_users_text', '')), 431 431 'skip_lorem' => false, 432 'parse_scripts' => true, 432 433 'inline_modals_selector' => $this->get_inline_modals_selector(), 433 434 'wk_modal_after_sign_in' => apply_filters( 'wallkit_override_inline_modal_after_sign_in', 'account-settings'), -
wallkit/trunk/includes/class-wallkit-wp.php
r3058402 r3155283 203 203 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wallkit-wp-access.php'; 204 204 205 /** 206 * Class of the REST API routes. 207 */ 208 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wallkit-rest-controller.php'; 209 205 210 206 211 /** … … 287 292 if($this->settings->get_option("wk_is_active") && $this->get_collection()->get_settings()->get_sdk()) 288 293 { 294 $this->loader->add_action( 'rest_api_init', $plugin_public, 'rest_api_init' ); 289 295 $this->loader->add_action( 'wp_head', $plugin_public, 'print_post_data' ); 290 296 $this->loader->add_filter( 'body_class', $plugin_public, 'add_body_class' ); -
wallkit/trunk/public/class-wallkit-wp-public.php
r3058402 r3155283 44 44 45 45 /** 46 * The instance of the REST API controller class used to extend the REST API. 47 * 48 * @since 3.3.7 49 * 50 */ 51 public $wk_rest_api; 52 53 /** 46 54 * Wallkit_Wp_Public constructor. 47 55 * … … 73 81 $this->content_key_prefix = $this->wallkit_Wp_Collection->get_settings()->get_option("wk_content_key_prefix") . '_' . $this->content_key_prefix; 74 82 } 83 } 84 85 /** 86 * Initialize the REST API routes. 87 * 88 * @since 3.3.7 89 * 90 */ 91 public function rest_api_init() { 92 $this->wk_rest_api = new Wallkit_REST_Controller(); 93 $this->wk_rest_api->register_routes(); 75 94 } 76 95 -
wallkit/trunk/public/js/wallkit-setup.js
r3058402 r3155283 427 427 428 428 window.wkwpCheckAccessPromise = new Promise((resolve, reject) => { 429 //If this is backed paywalled skip check post access on frontend, check access on backend. 430 if(window.wallkitPostData.config.wk_paywall_display_type === 3) { 431 resolve({}); 432 return; 433 } 434 429 435 wkPost.checkAccess().then((response) => { 430 436 wkwpDebug('F=>wkCheckPostAccess.wkPost.checkAccess', response); … … 443 449 switch (window.wallkitPostData.config.wk_paywall_display_type) { 444 450 case 1: checkAccessHandlingFrontend(response); break; 445 default: checkAccessHandling(response); 451 case 3: checkAccessHandlingBackend(); break; 452 default: checkAccessHandlingCSS(response); 446 453 } 447 454 … … 471 478 switch (window.wallkitPostData.config.wk_paywall_display_type) { 472 479 case 1: checkAccessHandlingFrontend({allowed: true}); break; 473 default: checkAccessHandling ({allowed: true});480 default: checkAccessHandlingCSS({allowed: true}); 474 481 } 475 482 } … … 477 484 // Change view for user based on access. Partial process on backend. 478 485 // Hard locking content 479 function checkAccessHandling (response) {486 function checkAccessHandlingCSS(response) { 480 487 let wkSettings = window["wallkitSettings"] || {}; 481 488 const postContentWrapper = document.querySelector(".wkwp-paywall"); 482 489 const postContentBody = document.querySelector(".wkwp-paywall .wkwp-content-inner"); 483 490 let postPaywallBlock = document.querySelector(".wkwp-paywall .wkwp-paywall-block"); 484 wkwpDebug('F=>checkAccessHandling ',491 wkwpDebug('F=>checkAccessHandlingCSS', 485 492 '\nresponse', response, 486 493 '\nwindow.wallkitPostData', window.wallkitPostData, … … 532 539 postContentWrapper.style = "display:block;"; 533 540 } 541 } 542 543 // Change view for user based on access. Partial process on backend. 544 // Hard locking content 545 async function checkAccessHandlingBackend() { 546 let wkSettings = window["wallkitSettings"] || {}; 547 const postContentWrapper = document.querySelector(".wkwp-paywall"); 548 const postContentBody = document.querySelector(".wkwp-paywall .wkwp-content-inner"); 549 let postPaywallBlock = document.querySelector(".wkwp-paywall .wkwp-paywall-block"); 550 wkwpDebug('F=>checkAccessHandlingBackend', 551 '\nwindow.wallkitPostData', window.wallkitPostData, 552 '\npostContentWrapper', postContentWrapper, 553 '\npostContentBody', postContentBody, 554 '\npostPaywallBlock', postPaywallBlock, 555 '\nwkPaywallBlock', wkPaywallBlock); 556 557 let contentData = await get_content_part(); 558 wkwpDebug('F=>checkAccessHandlingBackend=>get_content_part', 559 '\ncontentPart', contentData.contentPart, 560 '\ncontentScripts', contentData.contentScripts); 561 if (!contentData) { 562 if (postContentBody) { 563 const p_count = parseInt(postContentBody.dataset.paragraphs) || 0; 564 postContentBody.innerHTML = get_lorem(p_count); 565 566 if (!window.wallkitPostData.config.show_blur) { 567 postContentBody.style = "display:none;"; 568 } else { 569 postContentBody.classList.add('wkwp-content-blured'); 570 } 571 } 572 573 if (!postPaywallBlock && wkSettings.config.paywall.content) { 574 postPaywallBlock = document.createElement('div'); 575 postPaywallBlock.classList.add('wkwp-paywall-block'); 576 postPaywallBlock.insertAdjacentHTML('beforeend', wkSettings.config.paywall.content); 577 postContentBody.parentNode.insertBefore(postPaywallBlock, postContentBody); 578 } 579 580 paywallDisplayLoginLink(postPaywallBlock); 581 582 postContentWrapper.style = "display:block;"; 583 } else { 584 if (postPaywallBlock) { 585 postPaywallBlock.remove(); 586 } 587 588 if (postContentBody) { 589 postContentBody.innerHTML = contentData.contentPart || ''; 590 if(contentData.contentScripts) { 591 contentData.contentScripts.forEach(script => document.body.appendChild(script)); 592 } 593 postContentBody.classList.remove('wkwp-content-blured'); 594 postContentBody.style = "display:block;"; 595 } 596 597 postContentWrapper.style = "display:block;"; 598 } 599 } 600 601 async function get_content_part() { 602 const post_id = window.wallkitPostData.data.id.split('_').slice(-1); 603 const url_params = { 604 post_id: post_id 605 }; 606 let headers = {}; 607 if(Wallkit.getToken()) { 608 headers['wk-token'] = Wallkit.getToken(); 609 } 610 if(Wallkit.getFirebaseToken()) { 611 headers['firebase-token'] = Wallkit.getFirebaseToken(); 612 } 613 if(WallkitClient.session) { 614 headers['wk-session'] = WallkitClient.session; 615 } 616 617 wkwpDebug('F=>get_content_part', 618 '\npost_id', post_id, 619 '\nurl_params', url_params, 620 '\nheaders', headers, 621 '\nwindow.wallkitSettings.config.parse_scripts', window.wallkitSettings.config.parse_scripts 622 ); 623 624 const contentAccessResponce = await fetch("/wp-json/wallkit/v1/get-content-part?" + new URLSearchParams(url_params).toString(), { 625 method: "GET", 626 headers: headers, 627 }) 628 .then(response => { 629 if(response.status !== 200) { 630 return false; 631 } 632 return response.json(); 633 }) 634 .catch((error) => { 635 console.log('WKWP ERROR: get_content_part->contentAccessResponce', error); 636 return false; 637 }); 638 639 640 wkwpDebug('F=>get_content_part', 641 '\ncontentAccessResponce', contentAccessResponce 642 ); 643 644 if(contentAccessResponce.content_part 645 && window.wallkitSettings.config.parse_scripts) { 646 return { 647 contentScripts: parseScripts(contentAccessResponce.content_part), 648 contentPart: removeScriptsFromString(contentAccessResponce.content_part) 649 }; 650 } 651 652 if(contentAccessResponce.content_part) { 653 return { 654 contentScripts: [], 655 contentPart: contentAccessResponce.content_part 656 }; 657 } 658 659 return false; 660 } 661 662 function parseScripts(content) { 663 // Find all script tags and execute them 664 const newScriptsElements = []; 665 const tempDiv = document.createElement('div'); 666 tempDiv.innerHTML = content; 667 const scripts = tempDiv.getElementsByTagName('script'); 668 669 wkwpDebug('F=>parseScripts', 670 '\ncontent', content, 671 '\nscripts', scripts, 672 ); 673 for (let i = 0; i < scripts.length; i++) { 674 const script = scripts[i]; 675 const newScript = document.createElement('script'); 676 677 if (script.src) { 678 // If it's an external script (with src attribute), copy the src 679 newScript.src = script.src; 680 newScript.async = false; // Ensure synchronous execution if needed 681 } else { 682 // If it's an inline script, copy the text content 683 newScript.text = script.innerHTML; 684 } 685 686 // Append the new script tag to the document to execute it 687 newScriptsElements.push(newScript); 688 } 689 690 wkwpDebug('F=>parseScripts', 691 '\nnewScriptsElements', newScriptsElements 692 ); 693 return newScriptsElements; 694 } 695 696 function removeScriptsFromString(content) { 697 wkwpDebug('F=>removeScriptsFromString', 698 '\ncontent', content 699 ); 700 701 // Create a temporary DOM element 702 const tempDiv = document.createElement('div'); 703 tempDiv.innerHTML = content; 704 705 // Find all script elements and remove them 706 const scripts = tempDiv.getElementsByTagName('script'); 707 while (scripts.length > 0) { 708 scripts[0].parentNode.removeChild(scripts[0]); 709 } 710 711 wkwpDebug('F=>removeScriptsFromString', 712 '\ntempDiv.innerHTML', tempDiv.innerHTML 713 ); 714 // Return the HTML content without scripts 715 return tempDiv.innerHTML; 534 716 } 535 717 … … 661 843 // Replace hidden part of content by lorem 662 844 function build_lorem_content(el) { 845 if(el && el.querySelectorAll('p').length > 0 ) { 846 let length = el.querySelectorAll('p').length; 847 848 return get_lorem(length); 849 } 850 851 return ''; 852 } 853 854 function get_lorem(p_count) { 663 855 const loremText = [ 664 856 `Inventore molestiae accusantium fuga delectus. Sed exercitationem aut quis reiciendis nesciunt dolore et. Voluptatibus at suscipit eius ratione perspiciatis provident. Totam minima quia occaecati maxime mollitia.`, … … 684 876 ]; 685 877 686 if(el && el.querySelectorAll('p').length > 0 ) { 687 let length = el.querySelectorAll('p').length; 688 let tempText = []; 689 for ( var i = 0; i < length; i++ ) { 690 tempText.push( loremText[Math.floor(Math.random() * loremText.length)] ); 691 } 692 tempText = tempText.map(item => `<p>${item}</p>`).join(""); 693 694 return tempText; 695 } 696 697 return ''; 878 let tempText = []; 879 for ( var i = 0; i < p_count; i++ ) { 880 tempText.push( loremText[Math.floor(Math.random() * loremText.length)] ); 881 } 882 tempText = tempText.map(item => `<p>${item}</p>`).join(""); 883 884 return tempText; 698 885 } 699 886 -
wallkit/trunk/public/js/wallkit-setup.min.js
r3058402 r3155283 1 !function(){var e=document.querySelector("body");e.classList.contains("wkwp-user-hide")||e.classList.add("wkwp-user-hide")}(),function(){window.wkwpCheckAccessPromise=null;var s="",a="";function t(){let r=window.wallkitSettings||{},t=document.querySelector(r.config.inline_modals_selector);m("F=>runInitWkProcess.wkSettings",r),void 0!==r.integration&&(r.config.inline_modals_selector&&t&&t.dataset.modal&&(m("F=>runInitWkProcess.inlineModalsContainer","\ninline_modals_selector",r.config.inline_modals_selector,"\ninlineModalsContainer",t,"\ninlineModalsContainer.dataset.modal",t.dataset.modal),window.location.hash="WkModal("+t.dataset.modal+")"),window.wk=window.wk||[],window.wk.push(["ready",e=>{m("F=>runInitWkProcess.window.wk ready callback",window.wk,e),m("F=>runInitWkProcess.window.wk.authentication",window.wk.authentication,"\nwindow.wk.authentication.isAuthenticated()=>",window.wk.authentication.isAuthenticated()), i(),o(!1),window.wk.on("wk-event-auth",function(){m("E=>wk.events.subscribe=>wk-event-auth"),i(),o()}),window.wk.on("wk-event-registration",function(){m("E=>wk.events.subscribe=>wk-event-registration"),i(),o()}),window.wk.on("success-auth",function({register:e}){m("E=>wk.events.subscribe=>success-auth",e),!0===r.config.wk_auth_migrated_users&&(e=document.querySelector(".wk-user-update-info"),m("E=>wk.events.subscribe=>success-auth","\nwk_auth_migrated_users=>",r.config.wk_auth_migrated_users,"\nuserWithoutSessionInfo=>",e),e)&&w(),r.config.inline_modals_selector&&t&&window.wk.modal(r.config.wk_modal_after_sign_in),i(),o()}),window.wk.on("logout",function(){m("E=>wk.events.subscribe=>logout",r.config.reload_on_logout),!0!==r.config.reload_on_logout?(i(),o(),window.wk.popup.hide()):location.reload()}),window.wk.on("wk-event-transaction",function(){m("E=>wk.events.subscribe=>wk-event-transaction"),o()}),!0===r.config.wk_auth_migrated_users&&window.wk.on("pre-sign-in",async e=>{m("E=>wk.events.subscribe=>pre-sign-in",e);var t,i,o=document.querySelector("#auth-modal-wallkit-modal-spinner");o.style.display="flex";let n=!0,s=!1,a=!1;return await Wallkit.checkUserActivity(e.email).then(e=>{m("E=>wk.events.subscribe=>pre-sign-in=>Wallkit.checkUserActivity.data",e),void 0!==e&&(void 0!==e.is_exist_sessions&&"boolean"==typeof e.is_exist_sessions&&(n=e.is_exist_sessions),void 0!==e.has_user_resource_relationship_password)&&"boolean"==typeof e.has_user_resource_relationship_password&&(a=e.has_user_resource_relationship_password)},e=>{m("E=>wk.events.subscribe=>pre-sign-in=>Wallkit.checkUserActivity.error",e)}),n||a||(m("E=>wk.events.subscribe=>pre-sign-in=>password-reset","\nis_exist_sessions=>",n,"\nuser_has_password=>",a),await window.wk.sdk.methods.client.post({path:"/firebase/password-reset",data:{email:e.email}}).then(e=>{m("E=>wk.events.subscribe=>pre-sign-in=>password-reset.responce",e),s=!0},e=>{m("E=>wk.events.subscribe=>pre-sign-in=>password-reset.error",e)})),s&&(e=document.querySelector("#wk-email-auth-form"),m("E=>wk.events.subscribe=>pre-sign-in","\nis_password_reset=>",s,"\nauthForm=>",e),(t=e.querySelector(".wk-form").querySelector(".wk-form__error"))&&(t.style.display="none"),t=document.createElement("div"),i='<div style="padding: 24px 24px 0 24px;">'+r.config.wk_auth_migrated_users_text+"</div>",t.classList.add("wk-user-update-info"),t.insertAdjacentHTML("beforeend",i),e.parentNode.insertBefore(t,e),e.style.display="none",document.addEventListener("click",u)),o.style.display="none",!0})}]),r.config.inline_modals_selector&&t&&(r.integration.ui={type:"inline",selector:r.config.inline_modals_selector}),"function"==typeof WallkitIntegration?window.wk=new WallkitIntegration(r.integration):console.log("WKWP ERROR: WallkitIntegration function does not exist"))}async function i(){let i=window.wallkitSettings||{},o=window.wallkitTranslations||{};const n=document.querySelectorAll(".wkwp-user-my-account-button");if(m("F=>wkShowUserStatus","\nwkSettings=>",i,"\naccountStatusSpanEls=>",o,"\naccountStatusSpanEls=>",n),n.length){const r=document.querySelectorAll(".wkwp-login-block"),l="https://www.gravatar.com/avatar/?d=mp",c=document.querySelectorAll(".wkwp-user-my-account-img"),u=document.querySelectorAll(".wkwp-site-logo");let t=i.integration.call.classForHandleClick||"wk-call";const w=document.querySelector("body.wkwp-user-hide");var e,s,a;m("F=>wkShowUserStatus.args","\nuserAccountBlock",r,"\nimgDefaultSrc",l,"\naccountStatusImgEls",c,"\naccountSiteLogo",u,"\nwkCallClass",t,"\nwindow.wk.authentication.isAuthenticated()=>",window.wk.authentication.isAuthenticated()),window.wkwpGetUser=new Promise((t,i)=>{window.wk.authentication.isAuthenticated()?window.wk.sdk.methods.client.get({path:"/user"}).then(e=>{m("F=>wkShowUserStatus.wkwpGetUser.wk.sdk.methods.client(/user)",e),0<e.id&&(window.wk.sdk.methods.user=e),t(e)},e=>{console.log("F=>wkShowUserStatus.wkwpGetUser ERROR",e),i(e)}):(m("F=>wkShowUserStatus.wkwpGetUser.wk.authentication.isAuthenticated()",window.wk.authentication.isAuthenticated()),i())}),await window.wkwpGetUser.then(e=>{m("F=>wkShowUserStatus.wkwpGetUser.then.response",e),m("F=>wkShowUserStatus.dispatchEvent.wkwpGetUserCompleted"),window.dispatchEvent(new CustomEvent("wkwpGetUserCompleted",{detail:e})),0<e.id&&(0<c.length&&c.forEach(e=>{e.src=window.wk.sdk.methods.user.photos.image_100,e.classList.remove(t,"wk–sign-in"),e.classList.add(t,"wk–account-settings"),e.style="display:block;"}),0<n.length&&n.forEach(e=>{(e="LI"===e.tagName?e.querySelector("a"):e).innerHTML=i.titles.myAccountButton||o.my_account||"My Account",e.classList.remove(t,"wk–sign-in"),e.classList.add(t,"wk–account-settings")}),0<u.length)&&u.forEach(e=>{e.style="display:none;"}),0<r.length&&r.forEach(e=>{e.style="display:block;"}),w&&w.classList.remove("wkwp-user-hide")}).catch(e=>{m("F=>wkShowUserStatus.wkwpGetUser.catch.error",e),m("F=>wkShowUserStatus.dispatchEvent.wkwpGetUserCompleted.error"),window.dispatchEvent(new CustomEvent("wkwpGetUserCompleted",{detail:!1})),0<c.length&&c.forEach(e=>{e.src=l,e.classList.remove(t,"wk–account-settings"),e.classList.add(t,"wk–sign-in"),e.style="display:none;"}),0<n.length&&n.forEach(e=>{(e="LI"===e.tagName?e.querySelector("a"):e).classList.remove(t,"wk–account-settings"),e.classList.add(t,"wk–sign-in"),e.innerHTML=i.titles.signInButton||o.sign_in||"Sign in"}),0<u.length&&u.forEach(e=>{e.style="display:block;"}),0<r.length&&r.forEach(e=>{e.style="display:block;"}),w&&w.classList.remove("wkwp-user-hide")}),e=window.wallkitSettings||{},s=e.integration.call.classForHandleClick||"wk-call",e.config.wk_my_account_page_url&&((a=document.querySelectorAll(".wk–sign-in")).length&&d(a,e.config.wk_my_account_page_url,[s,"wk–sign-in"]),(a=document.querySelectorAll(".wk–account-settings")).length)&&d(a,e.config.wk_my_account_page_url,[s,"wk–account-settings"])}}function d(e,i,o=[]){e&&i&&e.forEach(e=>{let t=e;o.length&&e.classList.remove(...o),(t="A"!==e.tagName?e.querySelector("a"):t)&&t.setAttribute("href",i)})}function o(e=!0){var t=window.wallkitSettings||{};if(m("F=>wkCheckPostAccess","\nwkSettings",t,"\nnewCheckAccessPromise",e,"\nwindow.wkwpCheckAccessPromise",window.wkwpCheckAccessPromise,"\nwindow.wallkitPostData",window.wallkitPostData,"\n.wkwp-paywall",document.querySelector(".wkwp-paywall")),!0===e&&(window.wkwpCheckAccessPromise=null),!window.wkwpCheckAccessPromise&&void 0!==window.wallkitPostData.config&&void 0!==window.wallkitPostData.config.check_post&&!1!==window.wallkitPostData.config.check_post&&void 0!==window.wallkitPostData.data&&void 0!==window.wallkitPostData.data.id&&""!==window.wallkitPostData.data.id&&(document.querySelector(".wkwp-paywall")||t.config.content_class_selector&&document.querySelector("."+t.config.content_class_selector)||t.config.custom_content_selector&&document.querySelector(""+t.config.custom_content_selector))){e=window.wallkitPostData.data;const o=new window.wk.content(e);m("F=>wkCheckPostAccess.checkAccess","\npostInfo",e,"\nwkPost",o),window.wkwpCheckAccessPromise=new Promise((t,i)=>{o.checkAccess().then(e=>{m("F=>wkCheckPostAccess.wkPost.checkAccess",e),t(e)}).catch(e=>{console.log("WKWP wkPost ERROR",e),i(e)})})}window.wkwpCheckAccessPromise&&window.wkwpCheckAccessPromise.then(e=>{window.removeEventListener("unlockContent",n),m("F=>wkCheckPostAccess.wkwpCheckAccessPromise",e),(1===window.wallkitPostData.config.wk_paywall_display_type?l:r)(e),window.addEventListener("unlockContent",n),m("F=>wkCheckPostAccess.dispatchEvent.wkwpContentLocked"),window.dispatchEvent(new CustomEvent("wkwpContentLocked",{detail:e}))}).catch(e=>{console.log("WKWP ERROR: wkwpCheckAccessPromise",e)})}function n(e){m("F=>handleUnlockContentEvent.addEventListener.unlockContent",e),(1===window.wallkitPostData.config.wk_paywall_display_type?l:r)({allowed:!0})}function r(e){var t=window.wallkitSettings||{},i=document.querySelector(".wkwp-paywall"),o=document.querySelector(".wkwp-paywall .wkwp-content-inner");let n=document.querySelector(".wkwp-paywall .wkwp-paywall-block");m("F=>checkAccessHandling","\nresponse",e,"\nwindow.wallkitPostData",window.wallkitPostData,"\npostContentWrapper",i,"\npostContentBody",o,"\npostPaywallBlock",n,"\nwkContentBody",s,"\nwkPaywallBlock",a),o&&!s&&(s=o.innerHTML),e.allowed?(n&&n.remove(),o&&(s&&!1===t.config.skip_lorem&&(o.innerHTML=s),o.classList.remove("wkwp-content-blured"),o.style="display:block;")):(o&&(!1===t.config.skip_lorem&&(o.innerHTML=function(t){var i=["Inventore molestiae accusantium fuga delectus. Sed exercitationem aut quis reiciendis nesciunt dolore et. Voluptatibus at suscipit eius ratione perspiciatis provident. Totam minima quia occaecati maxime mollitia.","Laborum occaecati sapiente nesciunt voluptatem. Voluptatibus asperiores optio ut. Pariatur perspiciatis voluptatem beatae commodi libero modi.","Aut et ipsum beatae tenetur sit. Necessitatibus harum ea et. Natus aut quas sit dolores odio ut. Ipsum sit corporis maxime voluptatum et. Et labore id rerum nobis quia voluptatibus veniam dolores.","Sed aut repudiandae alias. Sunt est ab dignissimos quasi recusandae labore. Amet vitae illo debitis beatae nesciunt dolor dignissimos. Voluptatum consequuntur error at omnis. Tenetur quaerat facere placeat enim doloribus.","Id tempora quo placeat dolore. Eos sunt sapiente et facere. Ex facere et voluptate praesentium. Modi mollitia at non eum rerum perferendis. Nobis blanditiis consequatur incidunt.","Sint voluptas nam sed. Eligendi beatae corporis omnis ipsum facilis dicta a repudiandae. Suscipit et eligendi eveniet ipsum veritatis aut. Aspernatur adipisci fugit deserunt eos hic ut omnis. Corporis et itaque dicta similique.","Fugit dolores vitae iste qui. Dignissimos quo molestiae cumque. Sequi illo non saepe facere aut aliquid consequuntur sunt. Amet non illo dolor molestiae nulla eligendi quae. Id aut et velit quos sit ratione earum rerum.","Soluta error neque dolor perspiciatis mollitia. Voluptatem corporis doloribus fugiat et. Unde et rerum magni. Dolores nisi laudantium laboriosam voluptatem.","Dolores in illo exercitationem est enim pariatur quam corporis. Non ipsa sequi explicabo. Placeat earum aspernatur quod et quia.","Et sed amet ipsa. Qui et corrupti eaque et at dicta nesciunt vero. Est quasi eius possimus repellat ea ut. Inventore vel et possimus officiis quo consectetur similique. Culpa ut voluptatem non pariatur illum autem sapiente. Et et quidem est dolorum ab.","Amet id ipsam deleniti minima aut laboriosam. Odio ut reiciendis delectus repudiandae dolorem quaerat. Alias asperiores eum molestiae libero assumenda non voluptatibus quo. Et esse laboriosam ab velit et. Eligendi sint assumenda et.","Soluta ex voluptas minima et magnam est. Deserunt error molestiae veritatis amet. Quia provident sint molestiae omnis optio sunt sint. Commodi praesentium est perferendis inventore aut atque dolor doloribus. Minima enim velit eaque qui sed non dignissimos debitis. Rerum placeat in qui reprehenderit blanditiis nemo sed.","Magni dolore enim asperiores quae asperiores. Et quia eligendi ad quo aut labore ut iste. Quia qui esse aperiam eos illum exercitationem minus quod.","Sed ut dolorum sunt. Tempora incidunt aspernatur doloremque voluptatem quidem voluptatem magni. Est voluptatum minus id. Totam repudiandae reiciendis et.","Sint natus tenetur qui earum recusandae id optio. Dolore voluptates et accusamus et tempora sint. Dolores reiciendis iusto et quos aut. Sequi et officiis ipsum distinctio. Expedita voluptatibus corporis odio blanditiis iusto.","Ipsum dolores ut ut. Quia et voluptates accusamus neque quidem exercitationem dignissimos. Libero velit nemo omnis dolores ea repudiandae commodi accusamus. Sint tempore aut officia iste odit odio. Quibusdam sed debitis officiis.","Voluptatem quo est eius occaecati voluptatem tempore. Iste voluptas animi a voluptatem. Debitis est dolore aut fuga sunt voluptatem itaque assumenda. Id magnam officiis sint recusandae dolorum. Architecto numquam dignissimos quam corporis hic. Sit rerum amet provident.","Sed eum reiciendis aspernatur ab cupiditate. Ut atque dolores rerum veritatis voluptatem quidem ex voluptatum. Perspiciatis tempore quia quia animi vel distinctio. Id officia odit iusto facilis aliquid sequi eaque. Magnam eaque laudantium et et exercitationem.","Quod et ut voluptatibus assumenda sed. Nesciunt ea sed asperiores veniam temporibus blanditiis possimus. Quisquam eos voluptas assumenda molestiae.","Labore ipsum vitae dolorem est sed repellendus. Animi qui sequi similique dolorem sed vel omnis. Rerum saepe id atque animi."];if(t&&0<t.querySelectorAll("p").length){var o=t.querySelectorAll("p").length;let e=[];for(var n=0;n<o;n++)e.push(i[Math.floor(Math.random()*i.length)]);return e=e.map(e=>`<p>${e}</p>`).join("")}return""}(o)),window.wallkitPostData.config.show_blur?o.classList.add("wkwp-content-blured"):o.style="display:none;"),!n&&t.config.paywall.content&&((n=document.createElement("div")).classList.add("wkwp-paywall-block"),n.insertAdjacentHTML("beforeend",t.config.paywall.content),o.parentNode.insertBefore(n,o)),c(n)),i.style="display:block;"}function l(e){var t=window.wallkitSettings||{};let i=document.querySelector(".wkwp-paywall"),o="."+t.config.content_class_selector;t.config.custom_content_selector&&(o=t.config.custom_content_selector);var n=document.querySelector(""+o),s=document.querySelectorAll(o+" > *"),a=document.querySelectorAll(o+" > p");if(m("F=>checkAccessHandlingFrontend","\nwkPaywallBlock",e,"\nwkSettings",t,"\nwkwpPaywall",i,"\ntopElement",n,"\nallElements",s,"\nparagraphs",a),n)if(e.allowed)i&&i.remove(),s.forEach(e=>{e.classList.contains("wkwp-element")&&e.classList.remove("wkwp-element","wkwp-blur","wkwp-non-blur")});else if(n.querySelectorAll(".wkwp-element").length)c(i);else{var e=a.length>t.config.wk_free_paragraph&&0<=t.config.wk_free_paragraph?t.config.wk_free_paragraph:a.length,a=a[0<e?e-1:0],r=0===e?0:Array.prototype.indexOf.call(n.children,a)+1,l=["wkwp-element"];window.wallkitPostData.config.show_blur?l.push("wkwp-blur"):l.push("wkwp-non-blur"),m("F=>checkAccessHandlingFrontend.!allowed","\nshowParagraphs",e,"\nlastVisibleParagraph",a,"\nlastVisibleParagraphIndex",r,"\nitemClass",l);for(let e=r;e<s.length;e++)s[e].classList.add(...l);i||((i=document.createElement("div")).classList.add("wkwp-paywall"),i.insertAdjacentHTML("beforeend",`<div class="wkwp-paywall-block">${t.config.paywall.content}</div>`)),0===e?n.insertBefore(i,a):n.insertBefore(i,a.nextSibling),c(i),i.style="display:block;"}}function c(e){m("F=>paywallDisplayLoginLink",e),e&&(e=e.querySelector(".wallkit-paywall-block__login_plans"))&&(window.wk.authentication.isAuthenticated()?e.style="display:none;":e.style="display:block;")}function u(e){switch(m("F=>hideUserWithoutSessionInfo",e),e.target.id){case"auth-signup-link":case"auth-modal-close-btn":case"auth-modal-wrapper":case"auth-password-link":w()}e.target.classList.contains("wk-form-button")&&w()}function w(){var e=document.querySelector(".wk-user-update-info"),t=document.querySelector("#wk-email-auth-form"),i=document.querySelector("#wk-email-auth-form .wk-form .wk-form-header .wk-form__error");m("F=>hideUserWithoutSessionText","\nuserWithoutSessionInfo",e,"\nauthForm",t,"\nauthFormHeaderError",i),document.removeEventListener("click",u),e.remove(),t.style.display="block",i&&(i.style.display="")}function m(e="",...t){void 0!==window.wallkitSettings.config&&window.wallkitSettings.config.debug&&console.log("WKWP DEBUG: ",e,...t)}window.addEventListener("DOMContentLoaded",e=>{m("DOMContentLoaded"),window.runInitWKPromise?(m("window.runInitWKPromise",window.runInitWKPromise),window.runInitWKPromise.then(e=>{m("window.runInitWKPromise.response",e),!0===e.init&&t()}).catch(e=>{console.log("WKWP ERROR: runInitWKPromise",e)})):(m("else runInitWkProcess"),t())})}();1 !function(){var e=document.querySelector("body");e.classList.contains("wkwp-user-hide")||e.classList.add("wkwp-user-hide")}(),function(){window.wkwpCheckAccessPromise=null;var s="",a="";function t(){let r=window.wallkitSettings||{},t=document.querySelector(r.config.inline_modals_selector);m("F=>runInitWkProcess.wkSettings",r),void 0!==r.integration&&(r.config.inline_modals_selector&&t&&t.dataset.modal&&(m("F=>runInitWkProcess.inlineModalsContainer","\ninline_modals_selector",r.config.inline_modals_selector,"\ninlineModalsContainer",t,"\ninlineModalsContainer.dataset.modal",t.dataset.modal),window.location.hash="WkModal("+t.dataset.modal+")"),window.wk=window.wk||[],window.wk.push(["ready",e=>{m("F=>runInitWkProcess.window.wk ready callback",window.wk,e),m("F=>runInitWkProcess.window.wk.authentication",window.wk.authentication,"\nwindow.wk.authentication.isAuthenticated()=>",window.wk.authentication.isAuthenticated()),n(),i(!1),window.wk.on("wk-event-auth",function(){m("E=>wk.events.subscribe=>wk-event-auth"),n(),i()}),window.wk.on("wk-event-registration",function(){m("E=>wk.events.subscribe=>wk-event-registration"),n(),i()}),window.wk.on("success-auth",function({register:e}){m("E=>wk.events.subscribe=>success-auth",e),!0===r.config.wk_auth_migrated_users&&(e=document.querySelector(".wk-user-update-info"),m("E=>wk.events.subscribe=>success-auth","\nwk_auth_migrated_users=>",r.config.wk_auth_migrated_users,"\nuserWithoutSessionInfo=>",e),e)&&w(),r.config.inline_modals_selector&&t&&window.wk.modal(r.config.wk_modal_after_sign_in),n(),i()}),window.wk.on("logout",function(){m("E=>wk.events.subscribe=>logout",r.config.reload_on_logout),!0!==r.config.reload_on_logout?(n(),i(),window.wk.popup.hide()):location.reload()}),window.wk.on("wk-event-transaction",function(){m("E=>wk.events.subscribe=>wk-event-transaction"),i()}),!0===r.config.wk_auth_migrated_users&&window.wk.on("pre-sign-in",async e=>{m("E=>wk.events.subscribe=>pre-sign-in",e);var t,n,i=document.querySelector("#auth-modal-wallkit-modal-spinner");i.style.display="flex";let o=!0,s=!1,a=!1;return await Wallkit.checkUserActivity(e.email).then(e=>{m("E=>wk.events.subscribe=>pre-sign-in=>Wallkit.checkUserActivity.data",e),void 0!==e&&(void 0!==e.is_exist_sessions&&"boolean"==typeof e.is_exist_sessions&&(o=e.is_exist_sessions),void 0!==e.has_user_resource_relationship_password)&&"boolean"==typeof e.has_user_resource_relationship_password&&(a=e.has_user_resource_relationship_password)},e=>{m("E=>wk.events.subscribe=>pre-sign-in=>Wallkit.checkUserActivity.error",e)}),o||a||(m("E=>wk.events.subscribe=>pre-sign-in=>password-reset","\nis_exist_sessions=>",o,"\nuser_has_password=>",a),await window.wk.sdk.methods.client.post({path:"/firebase/password-reset",data:{email:e.email}}).then(e=>{m("E=>wk.events.subscribe=>pre-sign-in=>password-reset.responce",e),s=!0},e=>{m("E=>wk.events.subscribe=>pre-sign-in=>password-reset.error",e)})),s&&(e=document.querySelector("#wk-email-auth-form"),m("E=>wk.events.subscribe=>pre-sign-in","\nis_password_reset=>",s,"\nauthForm=>",e),(t=e.querySelector(".wk-form").querySelector(".wk-form__error"))&&(t.style.display="none"),t=document.createElement("div"),n='<div style="padding: 24px 24px 0 24px;">'+r.config.wk_auth_migrated_users_text+"</div>",t.classList.add("wk-user-update-info"),t.insertAdjacentHTML("beforeend",n),e.parentNode.insertBefore(t,e),e.style.display="none",document.addEventListener("click",u)),i.style.display="none",!0})}]),r.config.inline_modals_selector&&t&&(r.integration.ui={type:"inline",selector:r.config.inline_modals_selector}),"function"==typeof WallkitIntegration?window.wk=new WallkitIntegration(r.integration):console.log("WKWP ERROR: WallkitIntegration function does not exist"))}async function n(){let n=window.wallkitSettings||{},i=window.wallkitTranslations||{};const o=document.querySelectorAll(".wkwp-user-my-account-button");if(m("F=>wkShowUserStatus","\nwkSettings=>",n,"\naccountStatusSpanEls=>",i,"\naccountStatusSpanEls=>",o),o.length){const r=document.querySelectorAll(".wkwp-login-block"),l="https://www.gravatar.com/avatar/?d=mp",c=document.querySelectorAll(".wkwp-user-my-account-img"),u=document.querySelectorAll(".wkwp-site-logo");let t=n.integration.call.classForHandleClick||"wk-call";const w=document.querySelector("body.wkwp-user-hide");var e,s,a;m("F=>wkShowUserStatus.args","\nuserAccountBlock",r,"\nimgDefaultSrc",l,"\naccountStatusImgEls",c,"\naccountSiteLogo",u,"\nwkCallClass",t,"\nwindow.wk.authentication.isAuthenticated()=>",window.wk.authentication.isAuthenticated()),window.wkwpGetUser=new Promise((t,n)=>{window.wk.authentication.isAuthenticated()?window.wk.sdk.methods.client.get({path:"/user"}).then(e=>{m("F=>wkShowUserStatus.wkwpGetUser.wk.sdk.methods.client(/user)",e),0<e.id&&(window.wk.sdk.methods.user=e),t(e)},e=>{console.log("F=>wkShowUserStatus.wkwpGetUser ERROR",e),n(e)}):(m("F=>wkShowUserStatus.wkwpGetUser.wk.authentication.isAuthenticated()",window.wk.authentication.isAuthenticated()),n())}),await window.wkwpGetUser.then(e=>{m("F=>wkShowUserStatus.wkwpGetUser.then.response",e),m("F=>wkShowUserStatus.dispatchEvent.wkwpGetUserCompleted"),window.dispatchEvent(new CustomEvent("wkwpGetUserCompleted",{detail:e})),0<e.id&&(0<c.length&&c.forEach(e=>{e.src=window.wk.sdk.methods.user.photos.image_100,e.classList.remove(t,"wk–sign-in"),e.classList.add(t,"wk–account-settings"),e.style="display:block;"}),0<o.length&&o.forEach(e=>{(e="LI"===e.tagName?e.querySelector("a"):e).innerHTML=n.titles.myAccountButton||i.my_account||"My Account",e.classList.remove(t,"wk–sign-in"),e.classList.add(t,"wk–account-settings")}),0<u.length)&&u.forEach(e=>{e.style="display:none;"}),0<r.length&&r.forEach(e=>{e.style="display:block;"}),w&&w.classList.remove("wkwp-user-hide")}).catch(e=>{m("F=>wkShowUserStatus.wkwpGetUser.catch.error",e),m("F=>wkShowUserStatus.dispatchEvent.wkwpGetUserCompleted.error"),window.dispatchEvent(new CustomEvent("wkwpGetUserCompleted",{detail:!1})),0<c.length&&c.forEach(e=>{e.src=l,e.classList.remove(t,"wk–account-settings"),e.classList.add(t,"wk–sign-in"),e.style="display:none;"}),0<o.length&&o.forEach(e=>{(e="LI"===e.tagName?e.querySelector("a"):e).classList.remove(t,"wk–account-settings"),e.classList.add(t,"wk–sign-in"),e.innerHTML=n.titles.signInButton||i.sign_in||"Sign in"}),0<u.length&&u.forEach(e=>{e.style="display:block;"}),0<r.length&&r.forEach(e=>{e.style="display:block;"}),w&&w.classList.remove("wkwp-user-hide")}),e=window.wallkitSettings||{},s=e.integration.call.classForHandleClick||"wk-call",e.config.wk_my_account_page_url&&((a=document.querySelectorAll(".wk–sign-in")).length&&d(a,e.config.wk_my_account_page_url,[s,"wk–sign-in"]),(a=document.querySelectorAll(".wk–account-settings")).length)&&d(a,e.config.wk_my_account_page_url,[s,"wk–account-settings"])}}function d(e,n,i=[]){e&&n&&e.forEach(e=>{let t=e;i.length&&e.classList.remove(...i),(t="A"!==e.tagName?e.querySelector("a"):t)&&t.setAttribute("href",n)})}function i(e=!0){var t=window.wallkitSettings||{};if(m("F=>wkCheckPostAccess","\nwkSettings",t,"\nnewCheckAccessPromise",e,"\nwindow.wkwpCheckAccessPromise",window.wkwpCheckAccessPromise,"\nwindow.wallkitPostData",window.wallkitPostData,"\n.wkwp-paywall",document.querySelector(".wkwp-paywall")),!0===e&&(window.wkwpCheckAccessPromise=null),!window.wkwpCheckAccessPromise&&void 0!==window.wallkitPostData.config&&void 0!==window.wallkitPostData.config.check_post&&!1!==window.wallkitPostData.config.check_post&&void 0!==window.wallkitPostData.data&&void 0!==window.wallkitPostData.data.id&&""!==window.wallkitPostData.data.id&&(document.querySelector(".wkwp-paywall")||t.config.content_class_selector&&document.querySelector("."+t.config.content_class_selector)||t.config.custom_content_selector&&document.querySelector(""+t.config.custom_content_selector))){e=window.wallkitPostData.data;const i=new window.wk.content(e);m("F=>wkCheckPostAccess.checkAccess","\npostInfo",e,"\nwkPost",i),window.wkwpCheckAccessPromise=new Promise((t,n)=>{3===window.wallkitPostData.config.wk_paywall_display_type?t({}):i.checkAccess().then(e=>{m("F=>wkCheckPostAccess.wkPost.checkAccess",e),t(e)}).catch(e=>{console.log("WKWP wkPost ERROR",e),n(e)})})}window.wkwpCheckAccessPromise&&window.wkwpCheckAccessPromise.then(e=>{switch(window.removeEventListener("unlockContent",o),m("F=>wkCheckPostAccess.wkwpCheckAccessPromise",e),window.wallkitPostData.config.wk_paywall_display_type){case 1:l(e);break;case 3:!async function(){var e=window.wallkitSettings||{};var t=document.querySelector(".wkwp-paywall"),n=document.querySelector(".wkwp-paywall .wkwp-content-inner");let i=document.querySelector(".wkwp-paywall .wkwp-paywall-block"),o=(m("F=>checkAccessHandlingBackend","\nwindow.wallkitPostData",window.wallkitPostData,"\npostContentWrapper",t,"\npostContentBody",n,"\npostPaywallBlock",i,"\nwkPaywallBlock",a),await async function(){var e=window.wallkitPostData.data.id.split("_").slice(-1),t={post_id:e};var n={};Wallkit.getToken()&&(n["wk-token"]=Wallkit.getToken());Wallkit.getFirebaseToken()&&(n["firebase-token"]=Wallkit.getFirebaseToken());WallkitClient.session&&(n["wk-session"]=WallkitClient.session);m("F=>get_content_part","\npost_id",e,"\nurl_params",t,"\nheaders",n,"\nwindow.wallkitSettings.config.parse_scripts",window.wallkitSettings.config.parse_scripts);e=await fetch("/wp-json/wallkit/v1/get-content-part?"+new URLSearchParams(t).toString(),{method:"GET",headers:n}).then(e=>200===e.status&&e.json()).catch(e=>(console.log("WKWP ERROR: get_content_part->contentAccessResponce",e),!1));if(m("F=>get_content_part","\ncontentAccessResponce",e),e.content_part&&window.wallkitSettings.config.parse_scripts)return{contentScripts:function(e){var t=[],n=document.createElement("div"),i=(n.innerHTML=e,n.getElementsByTagName("script"));m("F=>parseScripts","\ncontent",e,"\nscripts",i);for(let e=0;e<i.length;e++){var o=i[e],s=document.createElement("script");o.src?(s.src=o.src,s.async=!1):s.text=o.innerHTML,t.push(s)}return m("F=>parseScripts","\nnewScriptsElements",t),t}(e.content_part),contentPart:function(e){m("F=>removeScriptsFromString","\ncontent",e);var t=document.createElement("div"),n=(t.innerHTML=e,t.getElementsByTagName("script"));for(;0<n.length;)n[0].parentNode.removeChild(n[0]);return m("F=>removeScriptsFromString","\ntempDiv.innerHTML",t.innerHTML),t.innerHTML}(e.content_part)};if(e.content_part)return{contentScripts:[],contentPart:e.content_part};return!1}());{var s;m("F=>checkAccessHandlingBackend=>get_content_part","\ncontentPart",o.contentPart,"\ncontentScripts",o.contentScripts),o?(i&&i.remove(),n&&(n.innerHTML=o.contentPart||"",o.contentScripts&&o.contentScripts.forEach(e=>document.body.appendChild(e)),n.classList.remove("wkwp-content-blured"),n.style="display:block;")):(n&&(s=parseInt(n.dataset.paragraphs)||0,n.innerHTML=p(s),window.wallkitPostData.config.show_blur?n.classList.add("wkwp-content-blured"):n.style="display:none;"),!i&&e.config.paywall.content&&((i=document.createElement("div")).classList.add("wkwp-paywall-block"),i.insertAdjacentHTML("beforeend",e.config.paywall.content),n.parentNode.insertBefore(i,n)),c(i)),t.style="display:block;"}}();break;default:r(e)}window.addEventListener("unlockContent",o),m("F=>wkCheckPostAccess.dispatchEvent.wkwpContentLocked"),window.dispatchEvent(new CustomEvent("wkwpContentLocked",{detail:e}))}).catch(e=>{console.log("WKWP ERROR: wkwpCheckAccessPromise",e)})}function o(e){m("F=>handleUnlockContentEvent.addEventListener.unlockContent",e),(1===window.wallkitPostData.config.wk_paywall_display_type?l:r)({allowed:!0})}function r(e){var t=window.wallkitSettings||{},n=document.querySelector(".wkwp-paywall"),i=document.querySelector(".wkwp-paywall .wkwp-content-inner");let o=document.querySelector(".wkwp-paywall .wkwp-paywall-block");m("F=>checkAccessHandlingCSS","\nresponse",e,"\nwindow.wallkitPostData",window.wallkitPostData,"\npostContentWrapper",n,"\npostContentBody",i,"\npostPaywallBlock",o,"\nwkContentBody",s,"\nwkPaywallBlock",a),i&&!s&&(s=i.innerHTML),e.allowed?(o&&o.remove(),i&&(s&&!1===t.config.skip_lorem&&(i.innerHTML=s),i.classList.remove("wkwp-content-blured"),i.style="display:block;")):(i&&(!1===t.config.skip_lorem&&(i.innerHTML=function(e){if(e&&0<e.querySelectorAll("p").length)return p(e.querySelectorAll("p").length);return""}(i)),window.wallkitPostData.config.show_blur?i.classList.add("wkwp-content-blured"):i.style="display:none;"),!o&&t.config.paywall.content&&((o=document.createElement("div")).classList.add("wkwp-paywall-block"),o.insertAdjacentHTML("beforeend",t.config.paywall.content),i.parentNode.insertBefore(o,i)),c(o)),n.style="display:block;"}function l(e){var t=window.wallkitSettings||{};let n=document.querySelector(".wkwp-paywall"),i="."+t.config.content_class_selector;t.config.custom_content_selector&&(i=t.config.custom_content_selector);var o=document.querySelector(""+i),s=document.querySelectorAll(i+" > *"),a=document.querySelectorAll(i+" > p");if(m("F=>checkAccessHandlingFrontend","\nwkPaywallBlock",e,"\nwkSettings",t,"\nwkwpPaywall",n,"\ntopElement",o,"\nallElements",s,"\nparagraphs",a),o)if(e.allowed)n&&n.remove(),s.forEach(e=>{e.classList.contains("wkwp-element")&&e.classList.remove("wkwp-element","wkwp-blur","wkwp-non-blur")});else if(o.querySelectorAll(".wkwp-element").length)c(n);else{var e=a.length>t.config.wk_free_paragraph&&0<=t.config.wk_free_paragraph?t.config.wk_free_paragraph:a.length,a=a[0<e?e-1:0],r=0===e?0:Array.prototype.indexOf.call(o.children,a)+1,l=["wkwp-element"];window.wallkitPostData.config.show_blur?l.push("wkwp-blur"):l.push("wkwp-non-blur"),m("F=>checkAccessHandlingFrontend.!allowed","\nshowParagraphs",e,"\nlastVisibleParagraph",a,"\nlastVisibleParagraphIndex",r,"\nitemClass",l);for(let e=r;e<s.length;e++)s[e].classList.add(...l);n||((n=document.createElement("div")).classList.add("wkwp-paywall"),n.insertAdjacentHTML("beforeend",`<div class="wkwp-paywall-block">${t.config.paywall.content}</div>`)),0===e?o.insertBefore(n,a):o.insertBefore(n,a.nextSibling),c(n),n.style="display:block;"}}function c(e){m("F=>paywallDisplayLoginLink",e),e&&(e=e.querySelector(".wallkit-paywall-block__login_plans"))&&(window.wk.authentication.isAuthenticated()?e.style="display:none;":e.style="display:block;")}function u(e){switch(m("F=>hideUserWithoutSessionInfo",e),e.target.id){case"auth-signup-link":case"auth-modal-close-btn":case"auth-modal-wrapper":case"auth-password-link":w()}e.target.classList.contains("wk-form-button")&&w()}function w(){var e=document.querySelector(".wk-user-update-info"),t=document.querySelector("#wk-email-auth-form"),n=document.querySelector("#wk-email-auth-form .wk-form .wk-form-header .wk-form__error");m("F=>hideUserWithoutSessionText","\nuserWithoutSessionInfo",e,"\nauthForm",t,"\nauthFormHeaderError",n),document.removeEventListener("click",u),e.remove(),t.style.display="block",n&&(n.style.display="")}function p(e){var t=["Inventore molestiae accusantium fuga delectus. Sed exercitationem aut quis reiciendis nesciunt dolore et. Voluptatibus at suscipit eius ratione perspiciatis provident. Totam minima quia occaecati maxime mollitia.","Laborum occaecati sapiente nesciunt voluptatem. Voluptatibus asperiores optio ut. Pariatur perspiciatis voluptatem beatae commodi libero modi.","Aut et ipsum beatae tenetur sit. Necessitatibus harum ea et. Natus aut quas sit dolores odio ut. Ipsum sit corporis maxime voluptatum et. Et labore id rerum nobis quia voluptatibus veniam dolores.","Sed aut repudiandae alias. Sunt est ab dignissimos quasi recusandae labore. Amet vitae illo debitis beatae nesciunt dolor dignissimos. Voluptatum consequuntur error at omnis. Tenetur quaerat facere placeat enim doloribus.","Id tempora quo placeat dolore. Eos sunt sapiente et facere. Ex facere et voluptate praesentium. Modi mollitia at non eum rerum perferendis. Nobis blanditiis consequatur incidunt.","Sint voluptas nam sed. Eligendi beatae corporis omnis ipsum facilis dicta a repudiandae. Suscipit et eligendi eveniet ipsum veritatis aut. Aspernatur adipisci fugit deserunt eos hic ut omnis. Corporis et itaque dicta similique.","Fugit dolores vitae iste qui. Dignissimos quo molestiae cumque. Sequi illo non saepe facere aut aliquid consequuntur sunt. Amet non illo dolor molestiae nulla eligendi quae. Id aut et velit quos sit ratione earum rerum.","Soluta error neque dolor perspiciatis mollitia. Voluptatem corporis doloribus fugiat et. Unde et rerum magni. Dolores nisi laudantium laboriosam voluptatem.","Dolores in illo exercitationem est enim pariatur quam corporis. Non ipsa sequi explicabo. Placeat earum aspernatur quod et quia.","Et sed amet ipsa. Qui et corrupti eaque et at dicta nesciunt vero. Est quasi eius possimus repellat ea ut. Inventore vel et possimus officiis quo consectetur similique. Culpa ut voluptatem non pariatur illum autem sapiente. Et et quidem est dolorum ab.","Amet id ipsam deleniti minima aut laboriosam. Odio ut reiciendis delectus repudiandae dolorem quaerat. Alias asperiores eum molestiae libero assumenda non voluptatibus quo. Et esse laboriosam ab velit et. Eligendi sint assumenda et.","Soluta ex voluptas minima et magnam est. Deserunt error molestiae veritatis amet. Quia provident sint molestiae omnis optio sunt sint. Commodi praesentium est perferendis inventore aut atque dolor doloribus. Minima enim velit eaque qui sed non dignissimos debitis. Rerum placeat in qui reprehenderit blanditiis nemo sed.","Magni dolore enim asperiores quae asperiores. Et quia eligendi ad quo aut labore ut iste. Quia qui esse aperiam eos illum exercitationem minus quod.","Sed ut dolorum sunt. Tempora incidunt aspernatur doloremque voluptatem quidem voluptatem magni. Est voluptatum minus id. Totam repudiandae reiciendis et.","Sint natus tenetur qui earum recusandae id optio. Dolore voluptates et accusamus et tempora sint. Dolores reiciendis iusto et quos aut. Sequi et officiis ipsum distinctio. Expedita voluptatibus corporis odio blanditiis iusto.","Ipsum dolores ut ut. Quia et voluptates accusamus neque quidem exercitationem dignissimos. Libero velit nemo omnis dolores ea repudiandae commodi accusamus. Sint tempore aut officia iste odit odio. Quibusdam sed debitis officiis.","Voluptatem quo est eius occaecati voluptatem tempore. Iste voluptas animi a voluptatem. Debitis est dolore aut fuga sunt voluptatem itaque assumenda. Id magnam officiis sint recusandae dolorum. Architecto numquam dignissimos quam corporis hic. Sit rerum amet provident.","Sed eum reiciendis aspernatur ab cupiditate. Ut atque dolores rerum veritatis voluptatem quidem ex voluptatum. Perspiciatis tempore quia quia animi vel distinctio. Id officia odit iusto facilis aliquid sequi eaque. Magnam eaque laudantium et et exercitationem.","Quod et ut voluptatibus assumenda sed. Nesciunt ea sed asperiores veniam temporibus blanditiis possimus. Quisquam eos voluptas assumenda molestiae.","Labore ipsum vitae dolorem est sed repellendus. Animi qui sequi similique dolorem sed vel omnis. Rerum saepe id atque animi."];let n=[];for(var i=0;i<e;i++)n.push(t[Math.floor(Math.random()*t.length)]);return n=n.map(e=>`<p>${e}</p>`).join("")}function m(e="",...t){void 0!==window.wallkitSettings.config&&window.wallkitSettings.config.debug&&console.log("WKWP DEBUG: ",e,...t)}window.addEventListener("DOMContentLoaded",e=>{m("DOMContentLoaded"),window.runInitWKPromise?(m("window.runInitWKPromise",window.runInitWKPromise),window.runInitWKPromise.then(e=>{m("window.runInitWKPromise.response",e),!0===e.init&&t()}).catch(e=>{console.log("WKWP ERROR: runInitWKPromise",e)})):(m("else runInitWkProcess"),t())})}(); -
wallkit/trunk/readme.txt
r3117047 r3155283 28 28 == Changelog == 29 29 30 = 3.3.7 = 31 *Release Date - 20 September 2024* 32 33 #### Updates including: 34 - Core updates. 35 - Added fully backend paywalled, in this mode content will returned from backend if user has access. 36 30 37 = 3.3.6 = 31 38 *Release Date - 12 July 2024* -
wallkit/trunk/vendor/wallkit-php-sdk/src/WallkitClient.php
r2874245 r3155283 15 15 protected $token; 16 16 17 18 /** 19 * @var FirebaseToken $token 17 /** 18 * @var FirebaseToken $firebase_token 20 19 */ 21 20 protected $firebase_token; 21 22 /** 23 * @var WallkitSession $session_token 24 */ 25 protected $session_token; 22 26 23 27 protected $host; … … 63 67 $this->firebase_token = $token; 64 68 } 69 70 /** 71 * @param WallkitSession $session_token 72 * @throws WallkitException 73 */ 74 function setSessionToken($session_token) 75 { 76 if (!$session_token instanceof WallkitSession) 77 throw new WallkitException('Invalid Firebase Token'); 78 79 $this->session_token = $session_token; 80 } 65 81 66 82 /** … … 83 99 return false; 84 100 } 101 102 /** 103 * @return bool|String 104 */ 105 public function getSessionTokenValue() { 106 if ($this->session_token) 107 return $this->session_token->getValue(); 108 return false; 109 } 85 110 86 111 /** … … 98 123 { 99 124 $headers['firebase-token'] = $this->getFirebaseTokenValue(); 125 } 126 127 if($this->session_token instanceof WallkitSession) 128 { 129 $headers['session'] = $this->getSessionTokenValue(); 100 130 } 101 131 -
wallkit/trunk/vendor/wallkit-php-sdk/src/WallkitSDK.php
r3117047 r3155283 38 38 */ 39 39 protected $firebase_token; 40 41 /** 42 * @var WallkitSession $token 43 */ 44 protected $session_token; 40 45 41 46 /** … … 79 84 self::$instance->token = $this->getRequestToken(); 80 85 self::$instance->firebase_token = $this->getRequestFirebaseToken(); 86 self::$instance->session_token = $this->getRequestSessionToken(); 81 87 self::$instance->client = new WallkitClient($this->token,$config['api_host'],$config['api_version'],$config['public_key']); 82 88 … … 88 94 { 89 95 self::$instance->client->setFirebaseToken(self::$instance->firebase_token); 96 } 97 98 if(self::$instance->session_token instanceof WallkitSession) 99 { 100 self::$instance->client->setSessionToken(self::$instance->session_token); 90 101 } 91 102 … … 163 174 164 175 /** 176 * @since 3.3.7 177 * 178 * @return null|WallkitSession 179 */ 180 function getRequestSessionToken() 181 { 182 if (isset($_SERVER['HTTP_WK_SESSION'])){ 183 return new WallkitSession(stripcslashes($_SERVER['HTTP_WK_SESSION'])); 184 } 185 186 if (isset($_COOKIE['wk-session_'.self::$instance->resource_id])){ 187 return new WallkitSession(stripcslashes($_COOKIE['wk-session_'.self::$instance->resource_id])); 188 } 189 190 return null; 191 } 192 193 /** 165 194 * @return User 166 195 */ -
wallkit/trunk/wallkit-wp.php
r3117047 r3155283 10 10 * Plugin URI: https://wallkit.net 11 11 * Description: A Plug & Play paid-content system to manage subscribers, gather fees and drive additional content sales. 12 * Version: 3.3. 612 * Version: 3.3.7 13 13 * Author: Wallkit <dev@wallkit.net> 14 14 * Author URI: https://wallkit.net/ … … 27 27 * Rename this for your plugin and update it as you release new versions. 28 28 */ 29 define( 'WPWKP_VERSION', '3.3. 6' );29 define( 'WPWKP_VERSION', '3.3.7' ); 30 30 31 31 /**
Note: See TracChangeset
for help on using the changeset viewer.