@automattic/newspack-blocks 4.26.4-alpha.1 → 4.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -3
- package/dist/carousel/view-rtl.css +1 -1
- package/dist/carousel/view.asset.php +1 -1
- package/dist/carousel/view.css +1 -1
- package/dist/donate/view.asset.php +1 -1
- package/dist/donate/view.js +1 -1
- package/dist/editor-rtl.css +23 -20
- package/dist/editor.asset.php +1 -1
- package/dist/editor.css +23 -20
- package/dist/editor.js +27 -27
- package/dist/modal.asset.php +1 -1
- package/dist/modal.js +1 -1
- package/dist/tiersBased.asset.php +1 -1
- package/dist/tiersBased.js +1 -1
- package/newspack-blocks.php +2 -2
- package/package.json +9 -7
- package/release.config.js +1 -0
- package/vendor/composer/installed.php +6 -6
- package/commitlint.config.js +0 -1
package/dist/modal.asset.php
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<?php return array('dependencies' => array(), 'version' => '
|
|
1
|
+
<?php return array('dependencies' => array(), 'version' => 'e4b12a75d8e0dcf45035');
|
package/dist/modal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";function e(e,t=!1){const o=e.querySelectorAll('button, [href], input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"])');if(0===o.length)return!1;const n=o?.[0];let c;n.focus(),t?(document.addEventListener("keydown",function(e){if(("Tab"===e.key||9===e.keyCode)&&e.shiftKey&&document.activeElement===n){const o=t.contentWindow.document,n=o.getElementById("checkout-after-success");c=null!==n?n:o.getElementById("checkout_cancel"),c.focus(),e.preventDefault()}}),document.getElementById("newspack-a11y-last-element").addEventListener("focus",()=>{n.focus()})):(c=o[o.length-1],document.addEventListener("keydown",function(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement===n&&(c.focus(),e.preventDefault()):document.activeElement===c&&(n.focus(),e.preventDefault()))}))}const t=(e,t={})=>({...t,action:e}),o=["action","action_type","amount","currency","product_id","product_type","variation_id","variation_ids","is_variable","is_grouped","child_ids","price_summary","newspack_popup_id","prompt_title","gate_post_id","recurrence","referrer"],n=(e,t="np_modal_checkout_interaction")=>{if("function"==typeof window.gtag&&e){const n={};for(const t of o)e[t]&&("boolean"==typeof e[t]?e[t]=e[t]?"yes":"no":"true"===e[t]?e[t]="yes":"false"===e[t]&&(e[t]="no"),n[t]=e[t].toString());window.gtag("event",t,n)}},c=e=>{if("function"!=typeof window.gtag)return;let o="opened";const{amount:c="",is_variable:a="",is_grouped:r="",price:s="",variation_id:i=""}=e,l={...e};(c||s)&&(l.amount=c||s),a&&!i&&(o="opened_variations"),r&&(o="opened_grouped");const d=t(o,l);n(d)};function a(e,t=null){const o=document.createElement("input");return o.type="hidden",o.name=e,t&&(o.value=t),o}function r(e){e.requestSubmit(e.querySelector('button[type="submit"]'))}function s(e){const t="string"==typeof e?document.getElementById(e):e;if(!t)return console.warn("No container found for checkout data"),{};let o={};if("FORM"===t.tagName){const e=new FormData(t);o=Object.fromEntries(e)}const n=t.dataset.checkout;if(!n)return console.warn("No checkout data found"),o;try{o={...o,...JSON.parse(n)}}catch(e){console.warn("Error parsing checkout data")}const c=new URL(t.ownerDocument.defaultView.location.href);return c.searchParams.get("action_type")&&(o.action_type=c.searchParams.get("action_type")),o}const i=e=>{if("function"!=typeof window.gtag)return;e=e||s("newspack_modal_checkout");const o=t("dismissed",e);n(o)},l=newspackBlocksModal.newspack_class_prefix,d="newspack_modal_checkout_iframe",u="newspack_modal_checkout_container",p=`${l}__modal`,m="newspack-blocks__modal-variation",_=`${l}__processing-payment-text`,h=newspackBlocksModal.processing_payment_messages;let y=!1,k=newspackBlocksModal.labels.checkout_modal_title,w=null;const f=e=>{e.overlayId&&window.newspackReaderActivation?.overlays&&window.newspackReaderActivation?.overlays.remove(e.overlayId),e.setAttribute("data-state","closed"),document.body.style.overflow="auto"};window.onpageshow=e=>{e.persisted&&(document.querySelectorAll(".modal-processing").forEach(e=>e.classList.remove("modal-processing")),document.querySelectorAll(".non-modal-checkout-loading").forEach(e=>e.classList.remove("non-modal-checkout-loading")),document.querySelectorAll(`.${p}-container`).forEach(e=>f(e)))};const v=new CustomEvent("checkout-closed");var g;window.newspackRAS=window.newspackRAS||[],g=()=>{const t=document.querySelector("#newspack_modal_checkout");if(!t)return;const o=t.querySelector(`.${p}__content`),n=a("modal_checkout","1"),g=o.querySelector(`.${l}__spinner`);let b=document.querySelector(".newspack-reader__account-link")?.[0];const S="600px",E=document.createElement("iframe");E.name=d,E.style.height=S,E.style.visibility="hidden";const A=e=>{M.observe(e),"none"!==g.style.display&&(g.style.display="none"),"visible"!==E.style.visibility&&(E.style.visibility="visible"),E._ready=!0};!function(e,t,o){e._ready=!1,e._readyTimer&&clearTimeout(e._readyTimer);let n=!1,c="";function a(){n||(n=!0,clearTimeout(e._readyTimer),t.call(this))}function r(){"complete"===this.readyState&&a.call(this)}function s(){e._ready=!1,o&&o(),e._readyTimer&&clearTimeout(e._readyTimer);const t=e.contentDocument||e.contentWindow?.document;t&&(t.removeEventListener("DOMContentLoaded",a),t.removeEventListener("readystatechange",r))}function i(){if(e._ready)return void s();const t=e.contentDocument||e.contentWindow?.document;t&&0!==t.URL.indexOf("about:")?"complete"===t?.readyState?a.call(t):(t.addEventListener("DOMContentLoaded",a),t.addEventListener("readystatechange",r)):e._readyTimer=setTimeout(i,10)}e._observer||(e._observer=new MutationObserver(e=>{e.forEach(e=>{"attributes"===e.type&&"src"===e.attributeName&&(n=!1,s(),i())})}),e._observer.observe(e,{attributes:!0})),e._locationObserver||(e._locationObserver=setInterval(function(){const t=e.contentDocument||e.contentWindow?.document;t&&t.URL!==c&&(c=t.URL,n=!1,s(),i())},50)),i()}(E,function(){const o=E.contentWindow?.location;if(window.newspackReaderActivation&&o?.href?.includes("order-received")){const e=window.newspackReaderActivation,t=new Proxy(new URLSearchParams(o.search),{get:(e,t)=>e.get(t)});t.email&&(e.setReaderEmail(t.email),e.setAuthenticated(!0))}const n=E?.contentDocument?.querySelector(`#${u}`);if(!n)return;const c=n.querySelector("#modal-checkout-product-details"),a=s(c),r=document.createElement("p");r.classList.add(_);let i=[];const l=()=>{i.forEach(e=>clearTimeout(e)),i=[]},d=()=>{g.style.display="none",l(),g.querySelectorAll(`.${_}`).forEach(e=>e.remove())};!function(e,t){e.checkoutCancel?t():e.addEventListener("checkout-cancel",t)}(n,()=>{C()}),function(e,t){e.checkoutPlaceOrderStart?t():e.addEventListener("checkout-place-order-start",t)}(n,e=>{var t;g.querySelectorAll(`.${_}`).forEach(e=>e.remove()),g.style.display="flex",l(),r.textContent=null!==(t=h[0]?.text)&&void 0!==t?t:"",h.slice(1).forEach(({text:t,delay:o})=>{const n=setTimeout(()=>{e.target.dispatchEvent(new CustomEvent("checkout-place-order-processing")),r.textContent=t},o);i.push(n)}),g.appendChild(r)}),function(e,t){e.checkoutPlaceOrderError?t():e.addEventListener("checkout-place-order-error",t)}(n,d),function(e,t){e.checkoutReady?t():e.addEventListener("checkout-ready",t)}(n,()=>{const e=c?.querySelector("strong");if(e&&(e.textContent=a.price_summary),t.initialErrors){const e=document.createElement("div");e.classList.add("woocommerce-error"),e.textContent=t.initialErrors,n.prepend(e),delete t.initialErrors}P(),O(k),E.contentWindow?.newspackBlocksModalCheckout?.checkout_nonce&&(t.checkout_nonce=E.contentWindow.newspackBlocksModalCheckout.checkout_nonce),A(n)}),function(e,t){e.checkoutComplete?t():e.addEventListener("checkout-complete",t)}(n,()=>{window.newspackRAS.push(["checkout_completed",a]),window?.newspackReaderActivation?.refreshNewslettersSignupModal&&window?.newspackReaderActivation?.getReader()?.email&&window.newspackReaderActivation.refreshNewslettersSignupModal(window.newspackReaderActivation.getReader().email),P("small"),O(newspackBlocksModal.labels.thankyou_modal_title),A(n),e(t.querySelector(`.${p}`)),d()}),function(e,t){e.checkoutPlaceOrderCriticalError?t():e.addEventListener("checkout-place-order-critical-error",t)}(n,()=>{var e;(e=w)&&(C(),g.style.display="none",t.initialErrors=newspackBlocksModal.labels.critical_error,e.requestSubmit(e.querySelector('button[type="submit"]')),d())})},()=>{g.style.display="flex"});const q=e=>new Promise((t,o)=>{const n=new URLSearchParams(e);n.append("action","modal_checkout_request"),fetch(newspackBlocksModal.ajax_url+"?"+n.toString()).then(e=>{e.ok||o(e),e.json().then(e=>{t(e.url)}).catch(o)}).catch(o)}),L=()=>"undefined"!=typeof newspack_ras_config&&!newspack_ras_config?.is_logged_in&&!window?.newspackReaderActivation?.getReader?.()?.authenticated&&newspackBlocksModal?.is_registration_required&&window?.newspackReaderActivation?.openAuthModal,$=t=>{const o=!newspackBlocksModal.has_unsupported_payment_gateway;o||t.preventDefault();const n=t.target;n.classList.add("modal-processing");const u=s(n);if(u.newspack_donate){const e=u.donation_frequency,t=[...n.querySelectorAll(`.donation-tier__${e}, .donation-frequency__${e}`)],o=u.donation_tier_index;let c,a;o?(c=t[o],a=u[`donation_value_${e}`]):(c=t[0],u[`donation_value_${e}_untiered`]?a=u[`donation_value_${e}_untiered`]:(a=u[`donation_value_${e}`],"other"===a&&(a=u[`donation_value_${e}_other`])));const r=s(c);for(const e in r)u[e]=r[e];u.amount=a,u.price_summary=u.summary_template.replace("{{PRICE}}",function(e,t="USD"){return parseFloat(e).toLocaleString(document.documentElement.lang,{style:"currency",currency:t,currencyDisplay:"narrowSymbol"})}(u.amount,u.currency))}u&&Object.keys(u).forEach(e=>{0===n.querySelectorAll('input[name="'+e+'"]').length&&n.prepend(a(e,u[e]))}),u.variation_id||(b=t.submitter);const p=document.querySelectorAll(`.${m}`);if(p.forEach(e=>{(L()||o)&&f(e)}),u.is_grouped||u.is_variable&&!u.variation_id){const o=[...p].find(e=>e.dataset.productId===u.product_id);if(o)return o.querySelectorAll(`form[target="${d}"]`).forEach(e=>{["after_success_behavior","after_success_url","after_success_button_label","gate_post_id","newspack_popup_id","prompt_title"].forEach(t=>{0===e.querySelectorAll('input[name="'+t+'"]').length&&e.prepend(a(t,u[t]))});const t=e.dataset.checkout;if(t){const o=JSON.parse(t);Object.keys(o).forEach(t=>{0===e.querySelectorAll('input[name="'+t+'"]').length&&e.prepend(a(t,o[t]))})}}),t.preventDefault(),n.classList.remove("modal-processing"),B(o),e(o,!1),y||c(u),void document.getElementById("newspack_modal_checkout").setAttribute("data-checkout",JSON.stringify(u))}if(o||L()){if(n.classList.remove("modal-processing"),y||c(u),y=!0,L()){t.preventDefault();const e=u.price_summary,n=e?`<div class="order-details-summary ${l}__box ${l}__box--text-center"><p><strong>${e}</strong></p></div>`:"",c=q(u);c.then(e=>{window.newspackReaderActivation?.setPendingCheckout?.(e)}),window.newspackReaderActivation.openAuthModal({title:newspackBlocksModal.labels.auth_modal_title,onSuccess:(e,t)=>{c.then(e=>{t?.registered&&o&&(e+=`&${newspackBlocksModal.checkout_registration_flag}=1`),o?r(R(e)):q(u).then(window.location.href=e)}).catch(e=>{console.warn("Unable to generate cart:",e),C()})},onError:()=>{C()},onDismiss:()=>{i(u),y=!1,document.getElementById("newspack_modal_checkout").removeAttribute("data-checkout")},skipSuccess:!0,skipNewslettersSignup:!0,labels:{signin:{title:newspackBlocksModal.labels.signin_modal_title},register:{title:newspackBlocksModal.labels.register_modal_title}},content:n,trigger:t.submitter,closeOnSuccess:o})}else x(),document.getElementById("newspack_modal_checkout").setAttribute("data-checkout",JSON.stringify(u));w=n}else q(u).then(e=>{window.location.href=e}),(!u.is_variable||u.variation_id)&&n.querySelectorAll("button[type=submit]:focus").forEach(e=>{e.classList.add("non-modal-checkout-loading");const t=e.innerHTML;e.innerHTML="<span>"+t+"</span>"})},R=e=>{const t=document.createElement("form");t.method="POST",t.action=e,t.target=d,t.style.display="none";const o=document.createElement("button");return o.setAttribute("type","submit"),t.appendChild(o),document.body.appendChild(t),t.addEventListener("submit",$),t},M=new ResizeObserver(e=>{if(!e||!e.length)return;if(!E.contentDocument)return;const n=e[0].contentRect;if(n){const e=.01*Math.max(document.documentElement.clientHeight,window.innerHeight||0)*90-(t.querySelector(`.${p}__header`)?.offsetHeight||0),c=n.top+n.bottom,a=Math.min(c,e);if(0===a)return void(E.style.visibility="hidden");o.style.height=a+"px",E.style.height=a+"px"}}),C=()=>{const e=E?.contentDocument?.querySelector(`#${u}`),n=e?.querySelector('input[name="after_success_url"]'),c=e?.querySelector('input[name="after_success_behavior"]'),a=document?.querySelector(".newspack-newsletters-signup-modal"),r=s(e?.querySelector("#modal-checkout-product-details"));e?.checkoutComplete||(async()=>{const e=new FormData;newspackBlocksModal.has_unsupported_payment_gateway||e.append("modal_checkout","1"),e.append("action","abandon_modal_checkout"),e.append("_wpnonce",t.checkout_nonce),t.checkout_nonce=null;try{await fetch(newspackBlocksModal.ajax_url,{method:"POST",body:e})}catch(e){console.warn("Unable to empty cart:",e)}})();const l=!(E.contentDocument&&n&&c&&e?.checkoutComplete);if((l||a)&&(g.style.display="flex",E&&o.contains(E)&&(E._ready=!1,E.src="about:blank",E.style.height=S,E.style.visibility="hidden",o.style.height=S,o.removeChild(E)),M&&M.disconnect(),document.querySelectorAll(`.${p}-container`).forEach(e=>f(e)),b&&b.focus(),document.dispatchEvent(v)),e?.checkoutComplete){const e=()=>{if(n&&c){const e=n.getAttribute("value"),t=c.getAttribute("value");"custom"===t?window.location.href=e:"referrer"===t&&window.history.back()}window?.newspackReaderActivation?.setPendingCheckout?.(),y=!1};"subscription_switch"!==r.action_type&&window?.newspackReaderActivation?.openNewslettersSignupModal?window.newspackReaderActivation.openNewslettersSignupModal({onSuccess:e,onError:e,closeOnSuccess:l}):e(),l&&(k=newspackBlocksModal.labels.checkout_modal_title,P(),O(k))}else window?.newspackReaderActivation?.setPendingCheckout?.(),i(),y=!1,document.getElementById("newspack_modal_checkout").removeAttribute("data-checkout");document.removeEventListener("keydown",D)},x=n=>{n&&(E.src=n),g.style.display="flex",B(t),o.appendChild(E),t.addEventListener("click",e=>{e.target===t&&C()}),e(t,E),document.addEventListener("keydown",D)},B=e=>{window.newspackReaderActivation?.overlays&&(e.overlayId=window.newspackReaderActivation?.overlays.add()),e.setAttribute("data-state","open"),document.body.style.overflow="hidden"},O=e=>{const o=t.querySelector(`.${p}__header h2`);o&&(o.innerText=e)},P=(e="default")=>{const o=t.querySelector(`.${p}`);o&&("small"===e?o.classList.add(`${p}--small`):o.classList.remove(`${p}--small`))};t.querySelectorAll(`.${p}__close`).forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),C()})}),document.querySelectorAll(".newspack-blocks__modal-variation").forEach(e=>{e.addEventListener("click",t=>{t.target===e&&C()}),e.querySelectorAll(`.${p}__close`).forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),C()})})});const D=e=>{"Escape"===e.key&&C()};document.querySelectorAll(".wpbnbd.wpbnbd--platform-wc, .wp-block-newspack-blocks-checkout-button, .newspack-blocks__modal-variation").forEach(e=>{e.querySelectorAll("form").forEach(e=>{newspackBlocksModal.has_unsupported_payment_gateway||e.prepend(n.cloneNode()),e.target=d,e.addEventListener("submit",$)})}),(()=>{const e=new URLSearchParams(window.location.search);if(!e.has("checkout"))return;const t=e.get("type");if("donate"===t){const t=e.get("layout"),o=e.get("frequency"),n=e.get("amount"),c=e.get("other");t&&o&&n&&((e,t,o,n=null)=>{let c;document.querySelectorAll(".wpbnbd.wpbnbd--platform-wc form").forEach(a=>{const r=a.querySelector(`input[name="donation_frequency"][value="${t}"]`);if(r)if("tiered"===e){const e=document.querySelector(`button[data-frequency-slug="${t}"]`);if(!e)return;e.click();const n=a.querySelector(`button[type="submit"][name="donation_value_${t}"][value="${o}"]`);if(!n)return;n.click()}else{const s="untiered"===e?a.querySelector(`input[name="donation_value_${t}_untiered"]`):a.querySelector(`input[name="donation_value_${t}"][value="${o}"]`);if(r&&s){if(r.checked=!0,"untiered"===e)s.value=o;else if("other"===o){s.click();const e=a.querySelector(`input[name="donation_value_${t}_other"]`);e&&n&&(e.value=n)}else s.checked=!0;c=a}}}),c&&r(c)})(t,o,n,c)}else if("checkout_button"===t){const t=e.get("product_id"),o=e.get("variation_id");t&&((e,t=null)=>{let o;if(t&&t!==e){const n=[...document.querySelectorAll(`.${m}`)].find(t=>t.dataset.productId===e);n&&n.querySelectorAll(`form[target="${d}"]`).forEach(e=>{const n=JSON.parse(e.dataset.checkout);n?.variation_id===Number(t)&&(o=e)})}else document.querySelectorAll(".wp-block-newspack-blocks-checkout-button").forEach(t=>{const n=t.querySelector("form");if(!n)return;const c=JSON.parse(n.dataset.checkout);c?.product_id===e&&(o=n)});o&&r(o)})(t,o)}else{const e=window.newspackReaderActivation?.getPendingCheckout?.();e&&r(R(e))}window.history.replaceState(null,null,window.location.pathname)})(),window.newspackOpenModalCheckout=({url:e=null,title:t=null,actionType:o=null,afterSuccess:n={},onCheckoutComplete:c=null,onClose:a=null})=>{if(k=t||newspackBlocksModal.labels.checkout_modal_title,O(k),(e=new URL(e||newspackBlocksModal.checkout_url)).searchParams.has("my_account_checkout")&&e.searchParams.delete("my_account_checkout"),e.searchParams.has("modal_checkout")||e.searchParams.set("modal_checkout","1"),o&&e.searchParams.set("action_type",o),n?.url&&e.searchParams.set("after_success_url",n.url),(n?.behavior||n?.url)&&e.searchParams.set("after_success_behavior",n.behavior||"custom"),n?.buttonLabel&&e.searchParams.set("after_success_button_label",n.buttonLabel),c){const e=({detail:{action:e,data:t}})=>{"checkout_completed"===e&&c(t)};window.newspackRAS.push(t=>{t.on("activity",e);const o=()=>{t.off("activity",e),document.removeEventListener("checkout-closed",o)};document.addEventListener("checkout-closed",o)})}if(a){const e=()=>{a(),document.removeEventListener("checkout-closed",e)};document.addEventListener("checkout-closed",e)}x(e.toString())},window.newspackCloseModalCheckout=C},"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",g):g())})();
|
|
1
|
+
(()=>{"use strict";function e(e,t=!1){const o=e.querySelectorAll('button, [href], input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"])');if(0===o.length)return!1;const n=o?.[0];let c;n.focus(),t?(document.addEventListener("keydown",function(e){if(("Tab"===e.key||9===e.keyCode)&&e.shiftKey&&document.activeElement===n){const o=t.contentWindow.document,n=o.getElementById("checkout-after-success");c=null!==n?n:o.getElementById("checkout_cancel"),c.focus(),e.preventDefault()}}),document.getElementById("newspack-a11y-last-element").addEventListener("focus",()=>{n.focus()})):(c=o[o.length-1],document.addEventListener("keydown",function(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement===n&&(c.focus(),e.preventDefault()):document.activeElement===c&&(n.focus(),e.preventDefault()))}))}const t=(e,t={})=>({...t,action:e}),o=["action","action_type","amount","currency","product_id","product_type","variation_id","variation_ids","is_variable","is_grouped","child_ids","price_summary","newspack_popup_id","prompt_title","gate_post_id","recurrence","referrer"],n=(e,t="np_modal_checkout_interaction")=>{if("function"==typeof window.gtag&&e){const n={};for(const t of o)e[t]&&("boolean"==typeof e[t]?e[t]=e[t]?"yes":"no":"true"===e[t]?e[t]="yes":"false"===e[t]&&(e[t]="no"),n[t]=e[t].toString());window.gtag("event",t,n)}},c=e=>{if("function"!=typeof window.gtag)return;let o="opened";const{amount:c="",is_variable:a="",is_grouped:r="",price:s="",variation_id:i=""}=e,l={...e};(c||s)&&(l.amount=c||s),a&&!i&&(o="opened_variations"),r&&(o="opened_grouped");const d=t(o,l);n(d)};function a(e,t=null){const o=document.createElement("input");return o.type="hidden",o.name=e,t&&(o.value=t),o}function r(e){e.requestSubmit(e.querySelector('button[type="submit"]'))}function s(e){const t="string"==typeof e?document.getElementById(e):e;if(!t)return console.warn("No container found for checkout data"),{};let o={};if("FORM"===t.tagName){const e=new FormData(t);o=Object.fromEntries(e)}const n=t.dataset.checkout;if(!n)return console.warn("No checkout data found"),o;try{o={...o,...JSON.parse(n)}}catch(e){console.warn("Error parsing checkout data")}const c=new URL(t.ownerDocument.defaultView.location.href);return c.searchParams.get("action_type")&&(o.action_type=c.searchParams.get("action_type")),o}const i=e=>{if("function"!=typeof window.gtag)return;e=e||s("newspack_modal_checkout");const o=t("dismissed",e);n(o)},l=newspackBlocksModal.newspack_class_prefix,d="newspack_modal_checkout_iframe",u="newspack_modal_checkout_container",p=`${l}__modal`,m="newspack-blocks__modal-variation",_=`${l}__processing-payment-text`,h=newspackBlocksModal.processing_payment_messages;let y=!1,k=newspackBlocksModal.labels.checkout_modal_title,w=null;const f=e=>{e.overlayId&&window.newspackReaderActivation?.overlays&&window.newspackReaderActivation?.overlays.remove(e.overlayId),e.setAttribute("data-state","closed"),document.body.style.overflow="auto"};window.onpageshow=e=>{e.persisted&&(document.querySelectorAll(".modal-processing").forEach(e=>e.classList.remove("modal-processing")),document.querySelectorAll(".non-modal-checkout-loading").forEach(e=>e.classList.remove("non-modal-checkout-loading")),document.querySelectorAll(`.${p}-container`).forEach(e=>f(e)))};const v=new CustomEvent("checkout-closed");var g;window.newspackRAS=window.newspackRAS||[],g=()=>{const t=document.querySelector("#newspack_modal_checkout");if(!t)return;const o=t.querySelector(`.${p}__content`),n=a("modal_checkout","1"),g=o.querySelector(`.${l}__spinner`);let b=document.querySelector(".newspack-reader__account-link")?.[0];const S="600px",E=document.createElement("iframe");E.name=d,E.style.height=S,E.style.visibility="hidden";const A=e=>{M.observe(e),"none"!==g.style.display&&(g.style.display="none"),"visible"!==E.style.visibility&&(E.style.visibility="visible"),E._ready=!0};!function(e,t,o){e._ready=!1,e._readyTimer&&clearTimeout(e._readyTimer);let n=!1,c="";function a(){n||(n=!0,clearTimeout(e._readyTimer),t.call(this))}function r(){"complete"===this.readyState&&a.call(this)}function s(){e._ready=!1,o&&o(),e._readyTimer&&clearTimeout(e._readyTimer);const t=e.contentDocument||e.contentWindow?.document;t&&(t.removeEventListener("DOMContentLoaded",a),t.removeEventListener("readystatechange",r))}function i(){if(e._ready)return void s();const t=e.contentDocument||e.contentWindow?.document;t&&0!==t.URL.indexOf("about:")?"complete"===t?.readyState?a.call(t):(t.addEventListener("DOMContentLoaded",a),t.addEventListener("readystatechange",r)):e._readyTimer=setTimeout(i,10)}e._observer||(e._observer=new MutationObserver(e=>{e.forEach(e=>{"attributes"===e.type&&"src"===e.attributeName&&(n=!1,s(),i())})}),e._observer.observe(e,{attributes:!0})),e._locationObserver||(e._locationObserver=setInterval(function(){const t=e.contentDocument||e.contentWindow?.document;t&&t.URL!==c&&(c=t.URL,n=!1,s(),i())},50)),i()}(E,function(){const o=E.contentWindow?.location;if(window.newspackReaderActivation&&o?.href?.includes("order-received")){const e=window.newspackReaderActivation,t=new Proxy(new URLSearchParams(o.search),{get:(e,t)=>e.get(t)});t.email&&(e.setReaderEmail(t.email),e.setAuthenticated(!0))}const n=E?.contentDocument?.querySelector(`#${u}`);if(!n)return;const c=n.querySelector("#modal-checkout-product-details"),a=s(c),r=document.createElement("p");r.classList.add(_);let i=[];const l=()=>{i.forEach(e=>clearTimeout(e)),i=[]},d=()=>{g.style.display="none",l(),g.querySelectorAll(`.${_}`).forEach(e=>e.remove())};!function(e,t){e.checkoutCancel?t():e.addEventListener("checkout-cancel",t)}(n,()=>{C()}),function(e,t){e.checkoutPlaceOrderStart?t():e.addEventListener("checkout-place-order-start",t)}(n,e=>{g.querySelectorAll(`.${_}`).forEach(e=>e.remove()),g.style.display="flex",l(),r.textContent=h[0]?.text??"",h.slice(1).forEach(({text:t,delay:o})=>{const n=setTimeout(()=>{e.target.dispatchEvent(new CustomEvent("checkout-place-order-processing")),r.textContent=t},o);i.push(n)}),g.appendChild(r)}),function(e,t){e.checkoutPlaceOrderError?t():e.addEventListener("checkout-place-order-error",t)}(n,d),function(e,t){e.checkoutReady?t():e.addEventListener("checkout-ready",t)}(n,()=>{const e=c?.querySelector("strong");if(e&&(e.textContent=a.price_summary),t.initialErrors){const e=document.createElement("div");e.classList.add("woocommerce-error"),e.textContent=t.initialErrors,n.prepend(e),delete t.initialErrors}P(),O(k),E.contentWindow?.newspackBlocksModalCheckout?.checkout_nonce&&(t.checkout_nonce=E.contentWindow.newspackBlocksModalCheckout.checkout_nonce),A(n)}),function(e,t){e.checkoutComplete?t():e.addEventListener("checkout-complete",t)}(n,()=>{window.newspackRAS.push(["checkout_completed",a]),window?.newspackReaderActivation?.refreshNewslettersSignupModal&&window?.newspackReaderActivation?.getReader()?.email&&window.newspackReaderActivation.refreshNewslettersSignupModal(window.newspackReaderActivation.getReader().email),P("small"),O(newspackBlocksModal.labels.thankyou_modal_title),A(n),e(t.querySelector(`.${p}`)),d()}),function(e,t){e.checkoutPlaceOrderCriticalError?t():e.addEventListener("checkout-place-order-critical-error",t)}(n,()=>{var e;(e=w)&&(C(),g.style.display="none",t.initialErrors=newspackBlocksModal.labels.critical_error,e.requestSubmit(e.querySelector('button[type="submit"]')),d())})},()=>{g.style.display="flex"});const q=e=>new Promise((t,o)=>{const n=new URLSearchParams(e);n.append("action","modal_checkout_request"),fetch(newspackBlocksModal.ajax_url+"?"+n.toString()).then(e=>{e.ok||o(e),e.json().then(e=>{t(e.url)}).catch(o)}).catch(o)}),L=()=>"undefined"!=typeof newspack_ras_config&&!newspack_ras_config?.is_logged_in&&!window?.newspackReaderActivation?.getReader?.()?.authenticated&&newspackBlocksModal?.is_registration_required&&window?.newspackReaderActivation?.openAuthModal,$=t=>{const o=!newspackBlocksModal.has_unsupported_payment_gateway;o||t.preventDefault();const n=t.target;n.classList.add("modal-processing");const u=s(n);if(u.newspack_donate){const e=u.donation_frequency,t=[...n.querySelectorAll(`.donation-tier__${e}, .donation-frequency__${e}`)],o=u.donation_tier_index;let c,a;o?(c=t[o],a=u[`donation_value_${e}`]):(c=t[0],u[`donation_value_${e}_untiered`]?a=u[`donation_value_${e}_untiered`]:(a=u[`donation_value_${e}`],"other"===a&&(a=u[`donation_value_${e}_other`])));const r=s(c);for(const e in r)u[e]=r[e];u.amount=a,u.price_summary=u.summary_template.replace("{{PRICE}}",function(e,t="USD"){return parseFloat(e).toLocaleString(document.documentElement.lang,{style:"currency",currency:t,currencyDisplay:"narrowSymbol"})}(u.amount,u.currency))}u&&Object.keys(u).forEach(e=>{0===n.querySelectorAll('input[name="'+e+'"]').length&&n.prepend(a(e,u[e]))}),u.variation_id||(b=t.submitter);const p=document.querySelectorAll(`.${m}`);if(p.forEach(e=>{(L()||o)&&f(e)}),u.is_grouped||u.is_variable&&!u.variation_id){const o=[...p].find(e=>e.dataset.productId===u.product_id);if(o)return o.querySelectorAll(`form[target="${d}"]`).forEach(e=>{["after_success_behavior","after_success_url","after_success_button_label","gate_post_id","newspack_popup_id","prompt_title"].forEach(t=>{0===e.querySelectorAll('input[name="'+t+'"]').length&&e.prepend(a(t,u[t]))});const t=e.dataset.checkout;if(t){const o=JSON.parse(t);Object.keys(o).forEach(t=>{0===e.querySelectorAll('input[name="'+t+'"]').length&&e.prepend(a(t,o[t]))})}}),t.preventDefault(),n.classList.remove("modal-processing"),B(o),e(o,!1),y||c(u),void document.getElementById("newspack_modal_checkout").setAttribute("data-checkout",JSON.stringify(u))}if(o||L()){if(n.classList.remove("modal-processing"),y||c(u),y=!0,L()){t.preventDefault();const e=u.price_summary,n=e?`<div class="order-details-summary ${l}__box ${l}__box--text-center"><p><strong>${e}</strong></p></div>`:"",c=q(u);c.then(e=>{window.newspackReaderActivation?.setPendingCheckout?.(e)}),window.newspackReaderActivation.openAuthModal({title:newspackBlocksModal.labels.auth_modal_title,onSuccess:(e,t)=>{c.then(e=>{t?.registered&&o&&(e+=`&${newspackBlocksModal.checkout_registration_flag}=1`),o?r(R(e)):q(u).then(window.location.href=e)}).catch(e=>{console.warn("Unable to generate cart:",e),C()})},onError:()=>{C()},onDismiss:()=>{i(u),y=!1,document.getElementById("newspack_modal_checkout").removeAttribute("data-checkout")},skipSuccess:!0,skipNewslettersSignup:!0,labels:{signin:{title:newspackBlocksModal.labels.signin_modal_title},register:{title:newspackBlocksModal.labels.register_modal_title}},content:n,trigger:t.submitter,closeOnSuccess:o})}else x(),document.getElementById("newspack_modal_checkout").setAttribute("data-checkout",JSON.stringify(u));w=n}else q(u).then(e=>{window.location.href=e}),(!u.is_variable||u.variation_id)&&n.querySelectorAll("button[type=submit]:focus").forEach(e=>{e.classList.add("non-modal-checkout-loading");const t=e.innerHTML;e.innerHTML="<span>"+t+"</span>"})},R=e=>{const t=document.createElement("form");t.method="POST",t.action=e,t.target=d,t.style.display="none";const o=document.createElement("button");return o.setAttribute("type","submit"),t.appendChild(o),document.body.appendChild(t),t.addEventListener("submit",$),t},M=new ResizeObserver(e=>{if(!e||!e.length)return;if(!E.contentDocument)return;const n=e[0].contentRect;if(n){const e=.01*Math.max(document.documentElement.clientHeight,window.innerHeight||0)*90-(t.querySelector(`.${p}__header`)?.offsetHeight||0),c=n.top+n.bottom,a=Math.min(c,e);if(0===a)return void(E.style.visibility="hidden");o.style.height=a+"px",E.style.height=a+"px"}}),C=()=>{const e=E?.contentDocument?.querySelector(`#${u}`),n=e?.querySelector('input[name="after_success_url"]'),c=e?.querySelector('input[name="after_success_behavior"]'),a=document?.querySelector(".newspack-newsletters-signup-modal"),r=s(e?.querySelector("#modal-checkout-product-details"));e?.checkoutComplete||(async()=>{const e=new FormData;newspackBlocksModal.has_unsupported_payment_gateway||e.append("modal_checkout","1"),e.append("action","abandon_modal_checkout"),e.append("_wpnonce",t.checkout_nonce),t.checkout_nonce=null;try{await fetch(newspackBlocksModal.ajax_url,{method:"POST",body:e})}catch(e){console.warn("Unable to empty cart:",e)}})();const l=!(E.contentDocument&&n&&c&&e?.checkoutComplete);if((l||a)&&(g.style.display="flex",E&&o.contains(E)&&(E._ready=!1,E.src="about:blank",E.style.height=S,E.style.visibility="hidden",o.style.height=S,o.removeChild(E)),M&&M.disconnect(),document.querySelectorAll(`.${p}-container`).forEach(e=>f(e)),b&&b.focus(),document.dispatchEvent(v)),e?.checkoutComplete){const e=()=>{if(n&&c){const e=n.getAttribute("value"),t=c.getAttribute("value");"custom"===t?window.location.href=e:"referrer"===t&&window.history.back()}window?.newspackReaderActivation?.setPendingCheckout?.(),y=!1};"subscription_switch"!==r.action_type&&window?.newspackReaderActivation?.openNewslettersSignupModal?window.newspackReaderActivation.openNewslettersSignupModal({onSuccess:e,onError:e,closeOnSuccess:l}):e(),l&&(k=newspackBlocksModal.labels.checkout_modal_title,P(),O(k))}else window?.newspackReaderActivation?.setPendingCheckout?.(),i(),y=!1,document.getElementById("newspack_modal_checkout").removeAttribute("data-checkout");document.removeEventListener("keydown",D)},x=n=>{n&&(E.src=n),g.style.display="flex",B(t),o.appendChild(E),t.addEventListener("click",e=>{e.target===t&&C()}),e(t,E),document.addEventListener("keydown",D)},B=e=>{window.newspackReaderActivation?.overlays&&(e.overlayId=window.newspackReaderActivation?.overlays.add()),e.setAttribute("data-state","open"),document.body.style.overflow="hidden"},O=e=>{const o=t.querySelector(`.${p}__header h2`);o&&(o.innerText=e)},P=(e="default")=>{const o=t.querySelector(`.${p}`);o&&("small"===e?o.classList.add(`${p}--small`):o.classList.remove(`${p}--small`))};t.querySelectorAll(`.${p}__close`).forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),C()})}),document.querySelectorAll(".newspack-blocks__modal-variation").forEach(e=>{e.addEventListener("click",t=>{t.target===e&&C()}),e.querySelectorAll(`.${p}__close`).forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),C()})})});const D=e=>{"Escape"===e.key&&C()};document.querySelectorAll(".wpbnbd.wpbnbd--platform-wc, .wp-block-newspack-blocks-checkout-button, .newspack-blocks__modal-variation").forEach(e=>{e.querySelectorAll("form").forEach(e=>{newspackBlocksModal.has_unsupported_payment_gateway||e.prepend(n.cloneNode()),e.target=d,e.addEventListener("submit",$)})}),(()=>{const e=new URLSearchParams(window.location.search);if(!e.has("checkout"))return;const t=e.get("type");if("donate"===t){const t=e.get("layout"),o=e.get("frequency"),n=e.get("amount"),c=e.get("other");t&&o&&n&&((e,t,o,n=null)=>{let c;document.querySelectorAll(".wpbnbd.wpbnbd--platform-wc form").forEach(a=>{const r=a.querySelector(`input[name="donation_frequency"][value="${t}"]`);if(r)if("tiered"===e){const e=document.querySelector(`button[data-frequency-slug="${t}"]`);if(!e)return;e.click();const n=a.querySelector(`button[type="submit"][name="donation_value_${t}"][value="${o}"]`);if(!n)return;n.click()}else{const s="untiered"===e?a.querySelector(`input[name="donation_value_${t}_untiered"]`):a.querySelector(`input[name="donation_value_${t}"][value="${o}"]`);if(r&&s){if(r.checked=!0,"untiered"===e)s.value=o;else if("other"===o){s.click();const e=a.querySelector(`input[name="donation_value_${t}_other"]`);e&&n&&(e.value=n)}else s.checked=!0;c=a}}}),c&&r(c)})(t,o,n,c)}else if("checkout_button"===t){const t=e.get("product_id"),o=e.get("variation_id");t&&((e,t=null)=>{let o;if(t&&t!==e){const n=[...document.querySelectorAll(`.${m}`)].find(t=>t.dataset.productId===e);n&&n.querySelectorAll(`form[target="${d}"]`).forEach(e=>{const n=JSON.parse(e.dataset.checkout);n?.variation_id===Number(t)&&(o=e)})}else document.querySelectorAll(".wp-block-newspack-blocks-checkout-button").forEach(t=>{const n=t.querySelector("form");if(!n)return;const c=JSON.parse(n.dataset.checkout);c?.product_id===e&&(o=n)});o&&r(o)})(t,o)}else{const e=window.newspackReaderActivation?.getPendingCheckout?.();e&&r(R(e))}window.history.replaceState(null,null,window.location.pathname)})(),window.newspackOpenModalCheckout=({url:e=null,title:t=null,actionType:o=null,afterSuccess:n={},onCheckoutComplete:c=null,onClose:a=null})=>{if(k=t||newspackBlocksModal.labels.checkout_modal_title,O(k),(e=new URL(e||newspackBlocksModal.checkout_url)).searchParams.has("my_account_checkout")&&e.searchParams.delete("my_account_checkout"),e.searchParams.has("modal_checkout")||e.searchParams.set("modal_checkout","1"),o&&e.searchParams.set("action_type",o),n?.url&&e.searchParams.set("after_success_url",n.url),(n?.behavior||n?.url)&&e.searchParams.set("after_success_behavior",n.behavior||"custom"),n?.buttonLabel&&e.searchParams.set("after_success_button_label",n.buttonLabel),c){const e=({detail:{action:e,data:t}})=>{"checkout_completed"===e&&c(t)};window.newspackRAS.push(t=>{t.on("activity",e);const o=()=>{t.off("activity",e),document.removeEventListener("checkout-closed",o)};document.addEventListener("checkout-closed",o)})}if(a){const e=()=>{a(),document.removeEventListener("checkout-closed",e)};document.addEventListener("checkout-closed",e)}x(e.toString())},window.newspackCloseModalCheckout=C},"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",g):g())})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<?php return array('dependencies' => array(), 'version' => '
|
|
1
|
+
<?php return array('dependencies' => array(), 'version' => '3b868383477d32961de1');
|
package/dist/tiersBased.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var t={
|
|
1
|
+
(()=>{var t={7759(t,e,r){var n=r(907).Symbol;t.exports=n},1490(t,e,r){var n=r(7759),o=r(4817),i=r(7748),a=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?o(t):i(t)}},6(t,e,r){var n=r(5082),o=/^\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(o,""):t}},6710(t){var e="object"==typeof globalThis&&globalThis&&globalThis.Object===Object&&globalThis;t.exports=e},4817(t,e,r){var n=r(7759),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,u=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,u),r=t[u];try{t[u]=void 0;var n=!0}catch(t){}var o=a.call(t);return n&&(e?t[u]=r:delete t[u]),o}},7748(t){var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},907(t,e,r){var n=r(6710),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},5082(t){var e=/\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},671(t,e,r){var n=r(9323),o=r(5062),i=r(9480),a=Math.max,u=Math.min;t.exports=function(t,e,r){var c,s,l,d,f,p,b=0,y=!1,v=!1,_=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){var r=c,n=s;return c=s=void 0,b=e,d=t.apply(n,r)}function h(t){var r=t-p;return void 0===p||r>=e||r<0||v&&t-b>=l}function g(){var t=o();if(h(t))return w(t);f=setTimeout(g,function(t){var r=e-(t-p);return v?u(r,l-(t-b)):r}(t))}function w(t){return f=void 0,_&&c?m(t):(c=s=void 0,d)}function x(){var t=o(),r=h(t);if(c=arguments,s=this,p=t,r){if(void 0===f)return function(t){return b=t,f=setTimeout(g,e),y?m(t):d}(p);if(v)return clearTimeout(f),f=setTimeout(g,e),m(p)}return void 0===f&&(f=setTimeout(g,e)),d}return e=i(e)||0,n(r)&&(y=!!r.leading,l=(v="maxWait"in r)?a(i(r.maxWait)||0,e):l,_="trailing"in r?!!r.trailing:_),x.cancel=function(){void 0!==f&&clearTimeout(f),b=0,c=p=s=f=void 0},x.flush=function(){return void 0===f?d:w(o())},x}},9323(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},2292(t){t.exports=function(t){return null!=t&&"object"==typeof t}},7964(t,e,r){var n=r(1490),o=r(2292);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},5062(t,e,r){var n=r(907);t.exports=function(){return n.Date.now()}},9480(t,e,r){var n=r(6),o=r(9323),i=r(7964),a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,s=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=u.test(t);return r||c.test(t)?s(t.slice(2),r?2:8):a.test(t)?NaN:+t}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t=r(671),e=r.n(t);const n="wpbnbd__button--active",o=t=>`.wpbnbd__tiers__amount [data-frequency-slug="${t}"]`,i=t=>{const r=((t="")=>{try{const e=JSON.parse(t);return{params:{frequency:e[0],tierPrefix:e[1]},initialFrequency:e[2],tiersBasedOptions:e[3],amounts:e[4],renewsAt:{month:e[5],year:e[6]},buttonColor:e[7]}}catch(t){return!1}})(t.getAttribute("data-tiers-based-config")||"");if(!r)return;const i=t.querySelectorAll(".wpbnbd__tiers__selection button"),a=t.querySelectorAll(".wpbnbd__tiers__amount [data-frequency-slug]"),u=t.querySelector(`input[name="${r.params.frequency}"]`),c=t.querySelector("form[data-is-init-form]");if(!(i&&a&&u&&c))return;((t,r)=>{const n=t.querySelector(".wpbnbd__tiers__options"),o=t.querySelector(".wpbnbd__tiers__options__dots");if(!n||!o||!r)return;const i=()=>Array.from(n.children).map(t=>({el:t,width:t.clientWidth}));let a=i();const u=Math.round(a.length/2)-1,c=()=>a[u].width,s=()=>a.map((t,e)=>l*e);let l=c(),d=s();const f=u*l;window.addEventListener("resize",()=>{a=i(),l=c(),d=s(),n.scrollTo(f,0)});const p=Array.from(o.children),b=e()(()=>{const t=((t,e)=>{const r=t.reduce((t,r)=>Math.abs(r-e)<Math.abs(t)?r-e:t,1/0)+e;return t.indexOf(r)})(d,n.scrollLeft);p.forEach((e,n)=>{e.style.backgroundColor=n===t?r.buttonColor:""})},100);n.addEventListener("scroll",b),p.forEach((t,e)=>{t.addEventListener("click",()=>{n.scrollTo({left:e*l,behavior:"smooth"})})}),n.scrollTo(f,0)})(t,r);let s=r.initialFrequency;i.forEach(e=>{e.addEventListener("click",()=>{const c=e.getAttribute("data-frequency-slug");c&&(s=c,u.setAttribute("value",s),a.forEach(t=>t.style.display="none"),t.querySelectorAll(o(s)).forEach(t=>t.style.display="inline"),i.forEach(t=>{s===t.getAttribute("data-frequency-slug")?t.classList.add(n):t.classList.remove(n)}),t.querySelectorAll('button[type="submit"]').forEach(t=>{if(!s)return;t.setAttribute("name",`${r.params.tierPrefix}${s}`);const e=t.getAttribute("data-tier-index"),n=document.querySelector(`${o(s)}[data-tier-index="${e}"]`);if(!n)return;const i=n.getAttribute("data-amount");i&&t.setAttribute("value",i)}))})});const l=t.querySelector("button.wpbnbd__tiers__back-button"),d=t.querySelectorAll(".wpbnbd__tiers__tier button"),f=t.querySelectorAll(".wpbnbd__tiers__view");d.forEach(e=>{e.addEventListener("click",()=>{const n=parseInt(e.getAttribute("data-tier-index")||""),o=c.querySelector('input[name="donation_tier_index"]'),i=c.querySelector(`input[name="donation_value_${s}"]`);o&&o.remove(),i&&i.remove();const a=document.createElement("input"),u=document.createElement("input");a.setAttribute("type","hidden"),u.setAttribute("type","hidden"),a.setAttribute("name","donation_tier_index"),u.setAttribute("name",`donation_value_${s}`),a.setAttribute("value",n.toString()),u.setAttribute("value",r.amounts[s][n]),c.appendChild(a),c.appendChild(u);const l=t.querySelector(".wpbnbd__tiers__tier-tile h2"),d=t.querySelector(".wpbnbd__tiers__tier-tile span[data-amount]"),p=t.querySelector(".wpbnbd__tiers__tier-tile span[data-frequency]"),b=t.querySelector(".wpbnbd__tiers__tier-tile span[data-renews-date]");if(isNaN(n)||!l||!d||!p||!b)return;const y=r.tiersBasedOptions[n],v=t.querySelector(`[data-frequency-slug="${s}"]`)?.getAttribute("data-frequency-label");l.textContent=y.heading,p.textContent=v||"",d.textContent=r.amounts[s][n],b.textContent=r.renewsAt[s],f.forEach(t=>t.classList.toggle("wpbnbd__tiers__view--hidden"))})}),window.addEventListener(`newspackPaymentFlowComplete-${t.id}`,()=>{l&&(l.style.display="none")})};var a;(Object.getOwnPropertyDescriptor(i,"name")||{}).writable||Object.defineProperty(i,"name",{value:"default",configurable:!0}),"undefined"!=typeof window&&(a=()=>((t=document)=>{t.querySelectorAll(".wpbnbd--tiers-based").forEach(i)})(),"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",a):a()))})()})();
|
package/newspack-blocks.php
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Author URI: https://newspack.com/
|
|
8
8
|
* Text Domain: newspack-blocks
|
|
9
9
|
* Domain Path: /languages
|
|
10
|
-
* Version: 4.26.4
|
|
10
|
+
* Version: 4.26.4
|
|
11
11
|
*
|
|
12
12
|
* @package Newspack_Blocks
|
|
13
13
|
*/
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
define( 'NEWSPACK_BLOCKS__PLUGIN_FILE', __FILE__ );
|
|
16
16
|
define( 'NEWSPACK_BLOCKS__BLOCKS_DIRECTORY', 'dist/' );
|
|
17
17
|
define( 'NEWSPACK_BLOCKS__PLUGIN_DIR', plugin_dir_path( NEWSPACK_BLOCKS__PLUGIN_FILE ) );
|
|
18
|
-
define( 'NEWSPACK_BLOCKS__VERSION', '4.26.4
|
|
18
|
+
define( 'NEWSPACK_BLOCKS__VERSION', '4.26.4' );
|
|
19
19
|
|
|
20
20
|
require_once NEWSPACK_BLOCKS__PLUGIN_DIR . 'includes/class-newspack-blocks.php';
|
|
21
21
|
require_once NEWSPACK_BLOCKS__PLUGIN_DIR . 'includes/class-newspack-blocks-api.php';
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/newspack-blocks",
|
|
3
|
-
"version": "4.26.4
|
|
3
|
+
"version": "4.26.4",
|
|
4
4
|
"author": "Automattic",
|
|
5
5
|
"description": "=== Newspack Blocks === Contributors: (this should be a list of wordpress.org userid's) Donate link: https://example.com/ Tags: comments, spam Requires at least: 4.5 Tested up to: 5.1.1 Stable tag: 0.1.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/Automattic/newspack-
|
|
8
|
+
"url": "git+https://github.com/Automattic/newspack-workspace.git",
|
|
9
|
+
"directory": "plugins/newspack-blocks"
|
|
9
10
|
},
|
|
10
|
-
"license": "GPL-
|
|
11
|
+
"license": "GPL-2.0-or-later",
|
|
11
12
|
"bugs": {
|
|
12
13
|
"url": "https://github.com/Automattic/newspack-blocks/issues"
|
|
13
14
|
},
|
|
@@ -44,8 +45,9 @@
|
|
|
44
45
|
],
|
|
45
46
|
"dependencies": {
|
|
46
47
|
"classnames": "^2.5.1",
|
|
47
|
-
"
|
|
48
|
-
"newspack-
|
|
48
|
+
"lodash": "^4.17.21",
|
|
49
|
+
"newspack-colors": "1.1.0",
|
|
50
|
+
"newspack-icons": "1.0.8",
|
|
49
51
|
"redux": "^5.0.0",
|
|
50
52
|
"redux-saga": "^1.4.2",
|
|
51
53
|
"regenerator-runtime": "^0.14.1",
|
|
@@ -53,8 +55,8 @@
|
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
57
|
"@types/lodash": "^4.17.23",
|
|
56
|
-
"newspack-components": "
|
|
57
|
-
"newspack-scripts": "
|
|
58
|
+
"newspack-components": "4.3.0",
|
|
59
|
+
"newspack-scripts": "5.9.8"
|
|
58
60
|
},
|
|
59
61
|
"overrides": {
|
|
60
62
|
"path-to-regexp": "1.7.0"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require( '../../config/release' )( { name: 'newspack-blocks', phpFile: 'newspack-blocks.php', npmPublish: true } );
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<?php return array(
|
|
2
2
|
'root' => array(
|
|
3
3
|
'name' => 'automattic/newspack-blocks',
|
|
4
|
-
'pretty_version' => 'dev-
|
|
5
|
-
'version' => 'dev-
|
|
6
|
-
'reference' => '
|
|
4
|
+
'pretty_version' => 'dev-main',
|
|
5
|
+
'version' => 'dev-main',
|
|
6
|
+
'reference' => 'e6af2c45db24228ad7eca429986c1b42e24605f9',
|
|
7
7
|
'type' => 'wordpress-plugin',
|
|
8
8
|
'install_path' => __DIR__ . '/../../',
|
|
9
9
|
'aliases' => array(),
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
),
|
|
12
12
|
'versions' => array(
|
|
13
13
|
'automattic/newspack-blocks' => array(
|
|
14
|
-
'pretty_version' => 'dev-
|
|
15
|
-
'version' => 'dev-
|
|
16
|
-
'reference' => '
|
|
14
|
+
'pretty_version' => 'dev-main',
|
|
15
|
+
'version' => 'dev-main',
|
|
16
|
+
'reference' => 'e6af2c45db24228ad7eca429986c1b42e24605f9',
|
|
17
17
|
'type' => 'wordpress-plugin',
|
|
18
18
|
'install_path' => __DIR__ . '/../../',
|
|
19
19
|
'aliases' => array(),
|
package/commitlint.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = { extends: [ '@commitlint/config-conventional' ] };
|