@whop/checkout 0.0.31 → 0.0.32

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.
@@ -1 +1 @@
1
- "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function o(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var a=true;var o=false;var i,l;try{for(r=r.call(e);!(a=(i=r.next()).done);a=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){o=true;l=e}finally{try{if(!a&&r["return"]!=null)r["return"]()}finally{if(o)throw l}}return n}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,r){return t(e)||o(e,r)||d(e,r)||i()}function c(e){return t(e)||a(e)||d(e)||i()}function s(e){return r(e)||a(e)||d(e)||l()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function d(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function y(e){return f(e.data)=="object"&&e.data!==null&&"event"in e.data&&(e.data.event==="resize"||e.data.event==="center"||e.data.event==="complete")}function h(e,t){function r(r){r.source===e.contentWindow&&y(r)&&t(r.data)}return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}}function v(e,t,r,n,a,o,i,l){var c=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(c.searchParams.set("h",window.location.origin),t&&c.searchParams.set("theme",t),r&&c.searchParams.set("session",r),a&&c.searchParams.set("hide_price","true"),o&&c.searchParams.set("skip_redirect","true"),i){var s=true,f=false,d=undefined,y=true,h=false,v=undefined;try{for(var w=Object.entries(i).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),m;!(y=(m=w.next()).done);y=true){var p=u(m.value,2),b=p[0],S=p[1];if(b.startsWith("utm_"))if(Array.isArray(S))try{for(var k=S[Symbol.iterator](),g;!(s=(g=k.next()).done);s=true){var C=g.value;c.searchParams.append(b,C)}}catch(e){f=true;d=e}finally{try{if(!s&&k.return!=null){k.return()}}finally{if(f){throw d}}}else c.searchParams.set(b,S)}}catch(e){h=true;v=e}finally{try{if(!y&&w.return!=null){w.return()}}finally{if(h){throw v}}}}if(l){var x=true,A=false,P=undefined,I=true,j=false,O=undefined;try{for(var E=Object.entries(l)[Symbol.iterator](),L;!(I=(L=E.next()).done);I=true){var M=u(L.value,2),_=M[0],T=M[1];if(T)try{for(var U=Object.entries(T)[Symbol.iterator](),R;!(x=(R=U.next()).done);x=true){var W=u(R.value,2),H=W[0],q=W[1];c.searchParams.set("style.".concat(_,".").concat(H),q.toString())}}catch(e){A=true;P=e}finally{try{if(!x&&U.return!=null){U.return()}}finally{if(A){throw P}}}}}catch(e){j=true;O=e}finally{try{if(!I&&E.return!=null){E.return()}}finally{if(j){throw O}}}}return c.toString()}var w=["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"],m="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";function p(e){var t;(t=window.wco)===null||t===void 0?void 0:t.frames.set(e,h(e,function(t){switch(t.event){case"resize":{e.style.height="".concat(t.height,"px");break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{var r=e.dataset.whopCheckoutOnComplete;if(r){var n=window[r];n===null||n===void 0?void 0:n(t.plan_id,t.receipt_id)}break}}}))}function b(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})}var S="data-whop-checkout-style-";function k(e){var t={};var r=true,n=false,a=undefined;try{for(var o=e.attributes[Symbol.iterator](),i;!(r=(i=o.next()).done);r=true){var l=i.value;if(l.name.startsWith(S)){var u=l.name.slice(S.length),s=l.value,f=c(u.split("-")),d=f[0],y=f.slice(1);if(d&&y.length>0){var h=y.reduce(function(e,t,r){if(r===0)return t;var n=c(e),a=n[0],o=n.slice(1);return"".concat(e).concat(a.toUpperCase()).concat(o.join(""))},"");var v;(v=t[d])!==null&&v!==void 0?v:t[d]={},t[d][h]=s}}}}catch(e){n=true;a=e}finally{try{if(!r&&o.return!=null){o.return()}}finally{if(n){throw a}}}return t}function g(e){var t;if(e.dataset.whopCheckoutMounted)return;var r=e.dataset.whopCheckoutPlanId;if(!r)return;var n=v(r,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:b(),k(e)),a=document.createElement("iframe");a.src=n,a.style.width="100%",a.style.height="480px",a.style.border="none",a.style.overflow="hidden",(t=a.sandbox).add.apply(t,s(w)),a.allow=m,e.dataset.whopCheckoutMounted="true",e.appendChild(a),p(a)}if((typeof window==="undefined"?"undefined":f(window))<"u"&&window.wco&&!window.wco.listening){var C=new MutationObserver(function(e){var t=true,r=false,a=undefined;try{for(var o=e[Symbol.iterator](),i;!(t=(i=o.next()).done);t=true){var l=i.value;var c,s;var f=true,d=false,y=undefined;try{for(var h=l.addedNodes[Symbol.iterator](),v;!(f=(v=h.next()).done);f=true){var w=v.value;n(w,HTMLElement)&&w.dataset.whopCheckoutPlanId&&g(w)}}catch(e){d=true;y=e}finally{try{if(!f&&h.return!=null){h.return()}}finally{if(d){throw y}}}var m=Array.from(l.removedNodes);var p;var b=true,S=false,k=undefined;try{for(var C=((p=(c=window.wco)===null||c===void 0?void 0:c.frames)!==null&&p!==void 0?p:[])[Symbol.iterator](),x;!(b=(x=C.next()).done);b=true){var A=u(x.value,2),P=A[0],I=A[1];m.includes(P)&&(I(),(s=window.wco)===null||s===void 0?void 0:s.frames.delete(P))}}catch(e){S=true;k=e}finally{try{if(!b&&C.return!=null){C.return()}}finally{if(S){throw k}}}}}catch(e){r=true;a=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(r){throw a}}}});var x=true,A=false,P=undefined;try{for(var I=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),j;!(x=(j=I.next()).done);x=true){var O=j.value;n(O,HTMLElement)&&g(O)}}catch(e){A=true;P=e}finally{try{if(!x&&I.return!=null){I.return()}}finally{if(A){throw P}}}C.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}
1
+ "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function o(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var a=true;var o=false;var i,l;try{for(r=r.call(e);!(a=(i=r.next()).done);a=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){o=true;l=e}finally{try{if(!a&&r["return"]!=null)r["return"]()}finally{if(o)throw l}}return n}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,r){return t(e)||o(e,r)||d(e,r)||i()}function c(e){return t(e)||a(e)||d(e)||i()}function s(e){return r(e)||a(e)||d(e)||l()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function d(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function y(e){return f(e.data)=="object"&&e.data!==null&&"event"in e.data&&(e.data.event==="resize"||e.data.event==="center"||e.data.event==="complete")}function h(e,t){function r(r){r.source===e.contentWindow&&y(r)&&t(r.data)}return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}}function v(e,t,r,n,a,o,i,l){var c=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(c.searchParams.set("h",window.location.origin),t&&c.searchParams.set("theme",t),r&&c.searchParams.set("session",r),a&&c.searchParams.set("hide_price","true"),o&&c.searchParams.set("skip_redirect","true"),i){var s=true,f=false,d=undefined,y=true,h=false,v=undefined;try{for(var w=Object.entries(i).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),m;!(y=(m=w.next()).done);y=true){var p=u(m.value,2),b=p[0],S=p[1];if(b.startsWith("utm_"))if(Array.isArray(S))try{for(var k=S[Symbol.iterator](),g;!(s=(g=k.next()).done);s=true){var C=g.value;c.searchParams.append(b,C)}}catch(e){f=true;d=e}finally{try{if(!s&&k.return!=null){k.return()}}finally{if(f){throw d}}}else c.searchParams.set(b,S)}}catch(e){h=true;v=e}finally{try{if(!y&&w.return!=null){w.return()}}finally{if(h){throw v}}}}if(l){var x=true,A=false,P=undefined,I=true,j=false,O=undefined;try{for(var E=Object.entries(l)[Symbol.iterator](),L;!(I=(L=E.next()).done);I=true){var M=u(L.value,2),_=M[0],T=M[1];if(T)try{for(var U=Object.entries(T)[Symbol.iterator](),R;!(x=(R=U.next()).done);x=true){var W=u(R.value,2),H=W[0],q=W[1];c.searchParams.set("style.".concat(_,".").concat(H),q.toString())}}catch(e){A=true;P=e}finally{try{if(!x&&U.return!=null){U.return()}}finally{if(A){throw P}}}}}catch(e){j=true;O=e}finally{try{if(!I&&E.return!=null){E.return()}}finally{if(j){throw O}}}}return c.toString()}var w=["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"],m="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";function p(e){var t;(t=window.wco)===null||t===void 0?void 0:t.frames.set(e,h(e,function(t){switch(t.event){case"resize":{e.style.height="".concat(t.height,"px");break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{var r=e.dataset.whopCheckoutOnComplete;if(r){var n=window[r];n===null||n===void 0?void 0:n(t.plan_id,t.receipt_id)}break}}}))}function b(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})}var S="data-whop-checkout-style-";function k(e){var t={};var r=true,n=false,a=undefined;try{for(var o=e.attributes[Symbol.iterator](),i;!(r=(i=o.next()).done);r=true){var l=i.value;if(l.name.startsWith(S)){var u=l.name.slice(S.length),s=l.value,f=c(u.split("-")),d=f[0],y=f.slice(1);if(d&&y.length>0){var h=y.reduce(function(e,t,r){if(r===0)return t;var n=c(t),a=n[0],o=n.slice(1);return"".concat(e).concat(a.toUpperCase()).concat(o.join(""))},"");var v;(v=t[d])!==null&&v!==void 0?v:t[d]={},t[d][h]=s}}}}catch(e){n=true;a=e}finally{try{if(!r&&o.return!=null){o.return()}}finally{if(n){throw a}}}return t}function g(e){var t;if(e.dataset.whopCheckoutMounted)return;var r=e.dataset.whopCheckoutPlanId;if(!r)return;var n=v(r,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:b(),k(e)),a=document.createElement("iframe");a.src=n,a.style.width="100%",a.style.height="480px",a.style.border="none",a.style.overflow="hidden",(t=a.sandbox).add.apply(t,s(w)),a.allow=m,e.dataset.whopCheckoutMounted="true",e.appendChild(a),p(a)}if((typeof window==="undefined"?"undefined":f(window))<"u"&&window.wco&&!window.wco.listening){var C=new MutationObserver(function(e){var t=true,r=false,a=undefined;try{for(var o=e[Symbol.iterator](),i;!(t=(i=o.next()).done);t=true){var l=i.value;var c,s;var f=true,d=false,y=undefined;try{for(var h=l.addedNodes[Symbol.iterator](),v;!(f=(v=h.next()).done);f=true){var w=v.value;n(w,HTMLElement)&&w.dataset.whopCheckoutPlanId&&g(w)}}catch(e){d=true;y=e}finally{try{if(!f&&h.return!=null){h.return()}}finally{if(d){throw y}}}var m=Array.from(l.removedNodes);var p;var b=true,S=false,k=undefined;try{for(var C=((p=(c=window.wco)===null||c===void 0?void 0:c.frames)!==null&&p!==void 0?p:[])[Symbol.iterator](),x;!(b=(x=C.next()).done);b=true){var A=u(x.value,2),P=A[0],I=A[1];m.includes(P)&&(I(),(s=window.wco)===null||s===void 0?void 0:s.frames.delete(P))}}catch(e){S=true;k=e}finally{try{if(!b&&C.return!=null){C.return()}}finally{if(S){throw k}}}}}catch(e){r=true;a=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(r){throw a}}}});var x=true,A=false,P=undefined;try{for(var I=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),j;!(x=(j=I.next()).done);x=true){var O=j.value;n(O,HTMLElement)&&g(O)}}catch(e){A=true;P=e}finally{try{if(!x&&I.return!=null){I.return()}}finally{if(A){throw P}}}C.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}
@@ -1 +1 @@
1
- "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function o(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var a=true;var o=false;var i,l;try{for(r=r.call(e);!(a=(i=r.next()).done);a=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){o=true;l=e}finally{try{if(!a&&r["return"]!=null)r["return"]()}finally{if(o)throw l}}return n}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,r){return t(e)||o(e,r)||d(e,r)||i()}function c(e){return t(e)||a(e)||d(e)||i()}function s(e){return r(e)||a(e)||d(e)||l()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function d(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}(function(){var e=function e(e){return f(e.data)=="object"&&e.data!==null&&"event"in e.data&&(e.data.event==="resize"||e.data.event==="center"||e.data.event==="complete")};var t=function t(t,r){function n(n){n.source===t.contentWindow&&e(n)&&r(n.data)}return window.addEventListener("message",n),function(){window.removeEventListener("message",n)}};var r=function e(e,t,r,n,a,o,i,l){var c=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(c.searchParams.set("h",window.location.origin),t&&c.searchParams.set("theme",t),r&&c.searchParams.set("session",r),a&&c.searchParams.set("hide_price","true"),o&&c.searchParams.set("skip_redirect","true"),i){var s=true,f=false,d=undefined,v=true,y=false,h=undefined;try{for(var w=Object.entries(i).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),m;!(v=(m=w.next()).done);v=true){var p=u(m.value,2),b=p[0],S=p[1];if(b.startsWith("utm_"))if(Array.isArray(S))try{for(var k=S[Symbol.iterator](),g;!(s=(g=k.next()).done);s=true){var C=g.value;c.searchParams.append(b,C)}}catch(e){f=true;d=e}finally{try{if(!s&&k.return!=null){k.return()}}finally{if(f){throw d}}}else c.searchParams.set(b,S)}}catch(e){y=true;h=e}finally{try{if(!v&&w.return!=null){w.return()}}finally{if(y){throw h}}}}if(l){var x=true,A=false,P=undefined,I=true,j=false,O=undefined;try{for(var E=Object.entries(l)[Symbol.iterator](),L;!(I=(L=E.next()).done);I=true){var M=u(L.value,2),_=M[0],T=M[1];if(T)try{for(var U=Object.entries(T)[Symbol.iterator](),R;!(x=(R=U.next()).done);x=true){var W=u(R.value,2),H=W[0],q=W[1];c.searchParams.set("style.".concat(_,".").concat(H),q.toString())}}catch(e){A=true;P=e}finally{try{if(!x&&U.return!=null){U.return()}}finally{if(A){throw P}}}}}catch(e){j=true;O=e}finally{try{if(!I&&E.return!=null){E.return()}}finally{if(j){throw O}}}}return c.toString()};var a=function e(e){var r;(r=window.wco)===null||r===void 0?void 0:r.frames.set(e,t(e,function(t){switch(t.event){case"resize":{e.style.height="".concat(t.height,"px");break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{var r=e.dataset.whopCheckoutOnComplete;if(r){var n=window[r];n===null||n===void 0?void 0:n(t.plan_id,t.receipt_id)}break}}}))};var o=function e(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})};var i=function e(e){var t={};var r=true,n=false,a=undefined;try{for(var o=e.attributes[Symbol.iterator](),i;!(r=(i=o.next()).done);r=true){var l=i.value;if(l.name.startsWith(y)){var u=l.name.slice(y.length),s=l.value,f=c(u.split("-")),d=f[0],v=f.slice(1);if(d&&v.length>0){var h=v.reduce(function(e,t,r){if(r===0)return t;var n=c(e),a=n[0],o=n.slice(1);return"".concat(e).concat(a.toUpperCase()).concat(o.join(""))},"");var w;(w=t[d])!==null&&w!==void 0?w:t[d]={},t[d][h]=s}}}}catch(e){n=true;a=e}finally{try{if(!r&&o.return!=null){o.return()}}finally{if(n){throw a}}}return t};var l=function e(e){var t;if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var l=r(n,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:o(),i(e)),u=document.createElement("iframe");u.src=l,u.style.width="100%",u.style.height="480px",u.style.border="none",u.style.overflow="hidden",(t=u.sandbox).add.apply(t,s(d)),u.allow=v,e.dataset.whopCheckoutMounted="true",e.appendChild(u),a(u)};var d=["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"],v="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";var y="data-whop-checkout-style-";if((typeof window==="undefined"?"undefined":f(window))<"u"&&window.wco&&!window.wco.listening){var h=new MutationObserver(function(e){var t=true,r=false,a=undefined;try{for(var o=e[Symbol.iterator](),i;!(t=(i=o.next()).done);t=true){var c=i.value;var s,f;var d=true,v=false,y=undefined;try{for(var h=c.addedNodes[Symbol.iterator](),w;!(d=(w=h.next()).done);d=true){var m=w.value;n(m,HTMLElement)&&m.dataset.whopCheckoutPlanId&&l(m)}}catch(e){v=true;y=e}finally{try{if(!d&&h.return!=null){h.return()}}finally{if(v){throw y}}}var p=Array.from(c.removedNodes);var b;var S=true,k=false,g=undefined;try{for(var C=((b=(s=window.wco)===null||s===void 0?void 0:s.frames)!==null&&b!==void 0?b:[])[Symbol.iterator](),x;!(S=(x=C.next()).done);S=true){var A=u(x.value,2),P=A[0],I=A[1];p.includes(P)&&(I(),(f=window.wco)===null||f===void 0?void 0:f.frames.delete(P))}}catch(e){k=true;g=e}finally{try{if(!S&&C.return!=null){C.return()}}finally{if(k){throw g}}}}}catch(e){r=true;a=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(r){throw a}}}});var w=true,m=false,p=undefined;try{for(var b=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),S;!(w=(S=b.next()).done);w=true){var k=S.value;n(k,HTMLElement)&&l(k)}}catch(e){m=true;p=e}finally{try{if(!w&&b.return!=null){b.return()}}finally{if(m){throw p}}}h.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}})();
1
+ "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function o(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var a=true;var o=false;var i,l;try{for(r=r.call(e);!(a=(i=r.next()).done);a=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){o=true;l=e}finally{try{if(!a&&r["return"]!=null)r["return"]()}finally{if(o)throw l}}return n}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,r){return t(e)||o(e,r)||d(e,r)||i()}function c(e){return t(e)||a(e)||d(e)||i()}function s(e){return r(e)||a(e)||d(e)||l()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function d(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}(function(){var e=function e(e){return f(e.data)=="object"&&e.data!==null&&"event"in e.data&&(e.data.event==="resize"||e.data.event==="center"||e.data.event==="complete")};var t=function t(t,r){function n(n){n.source===t.contentWindow&&e(n)&&r(n.data)}return window.addEventListener("message",n),function(){window.removeEventListener("message",n)}};var r=function e(e,t,r,n,a,o,i,l){var c=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(c.searchParams.set("h",window.location.origin),t&&c.searchParams.set("theme",t),r&&c.searchParams.set("session",r),a&&c.searchParams.set("hide_price","true"),o&&c.searchParams.set("skip_redirect","true"),i){var s=true,f=false,d=undefined,v=true,y=false,h=undefined;try{for(var w=Object.entries(i).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),m;!(v=(m=w.next()).done);v=true){var p=u(m.value,2),b=p[0],S=p[1];if(b.startsWith("utm_"))if(Array.isArray(S))try{for(var k=S[Symbol.iterator](),g;!(s=(g=k.next()).done);s=true){var C=g.value;c.searchParams.append(b,C)}}catch(e){f=true;d=e}finally{try{if(!s&&k.return!=null){k.return()}}finally{if(f){throw d}}}else c.searchParams.set(b,S)}}catch(e){y=true;h=e}finally{try{if(!v&&w.return!=null){w.return()}}finally{if(y){throw h}}}}if(l){var x=true,A=false,P=undefined,I=true,j=false,O=undefined;try{for(var E=Object.entries(l)[Symbol.iterator](),L;!(I=(L=E.next()).done);I=true){var M=u(L.value,2),_=M[0],T=M[1];if(T)try{for(var U=Object.entries(T)[Symbol.iterator](),R;!(x=(R=U.next()).done);x=true){var W=u(R.value,2),H=W[0],q=W[1];c.searchParams.set("style.".concat(_,".").concat(H),q.toString())}}catch(e){A=true;P=e}finally{try{if(!x&&U.return!=null){U.return()}}finally{if(A){throw P}}}}}catch(e){j=true;O=e}finally{try{if(!I&&E.return!=null){E.return()}}finally{if(j){throw O}}}}return c.toString()};var a=function e(e){var r;(r=window.wco)===null||r===void 0?void 0:r.frames.set(e,t(e,function(t){switch(t.event){case"resize":{e.style.height="".concat(t.height,"px");break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{var r=e.dataset.whopCheckoutOnComplete;if(r){var n=window[r];n===null||n===void 0?void 0:n(t.plan_id,t.receipt_id)}break}}}))};var o=function e(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})};var i=function e(e){var t={};var r=true,n=false,a=undefined;try{for(var o=e.attributes[Symbol.iterator](),i;!(r=(i=o.next()).done);r=true){var l=i.value;if(l.name.startsWith(y)){var u=l.name.slice(y.length),s=l.value,f=c(u.split("-")),d=f[0],v=f.slice(1);if(d&&v.length>0){var h=v.reduce(function(e,t,r){if(r===0)return t;var n=c(t),a=n[0],o=n.slice(1);return"".concat(e).concat(a.toUpperCase()).concat(o.join(""))},"");var w;(w=t[d])!==null&&w!==void 0?w:t[d]={},t[d][h]=s}}}}catch(e){n=true;a=e}finally{try{if(!r&&o.return!=null){o.return()}}finally{if(n){throw a}}}return t};var l=function e(e){var t;if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var l=r(n,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:o(),i(e)),u=document.createElement("iframe");u.src=l,u.style.width="100%",u.style.height="480px",u.style.border="none",u.style.overflow="hidden",(t=u.sandbox).add.apply(t,s(d)),u.allow=v,e.dataset.whopCheckoutMounted="true",e.appendChild(u),a(u)};var d=["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"],v="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";var y="data-whop-checkout-style-";if((typeof window==="undefined"?"undefined":f(window))<"u"&&window.wco&&!window.wco.listening){var h=new MutationObserver(function(e){var t=true,r=false,a=undefined;try{for(var o=e[Symbol.iterator](),i;!(t=(i=o.next()).done);t=true){var c=i.value;var s,f;var d=true,v=false,y=undefined;try{for(var h=c.addedNodes[Symbol.iterator](),w;!(d=(w=h.next()).done);d=true){var m=w.value;n(m,HTMLElement)&&m.dataset.whopCheckoutPlanId&&l(m)}}catch(e){v=true;y=e}finally{try{if(!d&&h.return!=null){h.return()}}finally{if(v){throw y}}}var p=Array.from(c.removedNodes);var b;var S=true,k=false,g=undefined;try{for(var C=((b=(s=window.wco)===null||s===void 0?void 0:s.frames)!==null&&b!==void 0?b:[])[Symbol.iterator](),x;!(S=(x=C.next()).done);S=true){var A=u(x.value,2),P=A[0],I=A[1];p.includes(P)&&(I(),(f=window.wco)===null||f===void 0?void 0:f.frames.delete(P))}}catch(e){k=true;g=e}finally{try{if(!S&&C.return!=null){C.return()}}finally{if(k){throw g}}}}}catch(e){r=true;a=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(r){throw a}}}});var w=true,m=false,p=undefined;try{for(var b=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),S;!(w=(S=b.next()).done);w=true){var k=S.value;n(k,HTMLElement)&&l(k)}}catch(e){m=true;p=e}finally{try{if(!w&&b.return!=null){b.return()}}finally{if(m){throw p}}}h.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}})();
@@ -1 +1 @@
1
- function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var o=true;var a=false;var i,u;try{for(r=r.call(e);!(o=(i=r.next()).done);o=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){a=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}return n}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,r){return t(e)||a(e,r)||s(e,r)||i()}function c(e){return t(e)||o(e)||s(e)||i()}function f(e){return r(e)||o(e)||s(e)||u()}function d(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function s(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}import{b as h,c as y,d as v,e as w}from"./chunk-76N4LNNK.mjs";function m(e){var t;(t=window.wco)===null||t===void 0?void 0:t.frames.set(e,h(e,function(t){switch(t.event){case"resize":{e.style.height="".concat(t.height,"px");break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{var r=e.dataset.whopCheckoutOnComplete;if(r){var n=window[r];n===null||n===void 0?void 0:n(t.plan_id,t.receipt_id)}break}}}))}function p(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})}var b="data-whop-checkout-style-";function k(e){var t={};var r=true,n=false,o=undefined;try{for(var a=e.attributes[Symbol.iterator](),i;!(r=(i=a.next()).done);r=true){var u=i.value;if(u.name.startsWith(b)){var l=u.name.slice(b.length),f=u.value,d=c(l.split("-")),s=d[0],h=d.slice(1);if(s&&h.length>0){var y=h.reduce(function(e,t,r){if(r===0)return t;var n=c(e),o=n[0],a=n.slice(1);return"".concat(e).concat(o.toUpperCase()).concat(a.join(""))},"");var v;(v=t[s])!==null&&v!==void 0?v:t[s]={},t[s][y]=f}}}}catch(e){n=true;o=e}finally{try{if(!r&&a.return!=null){a.return()}}finally{if(n){throw o}}}return t}function S(e){var t;if(e.dataset.whopCheckoutMounted)return;var r=e.dataset.whopCheckoutPlanId;if(!r)return;var n=y(r,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:p(),k(e)),o=document.createElement("iframe");o.src=n,o.style.width="100%",o.style.height="480px",o.style.border="none",o.style.overflow="hidden",(t=o.sandbox).add.apply(t,f(v)),o.allow=w,e.dataset.whopCheckoutMounted="true",e.appendChild(o),m(o)}if((typeof window==="undefined"?"undefined":d(window))<"u"&&window.wco&&!window.wco.listening){var C=new MutationObserver(function(e){var t=true,r=false,o=undefined;try{for(var a=e[Symbol.iterator](),i;!(t=(i=a.next()).done);t=true){var u=i.value;var c,f;var d=true,s=false,h=undefined;try{for(var y=u.addedNodes[Symbol.iterator](),v;!(d=(v=y.next()).done);d=true){var w=v.value;n(w,HTMLElement)&&w.dataset.whopCheckoutPlanId&&S(w)}}catch(e){s=true;h=e}finally{try{if(!d&&y.return!=null){y.return()}}finally{if(s){throw h}}}var m=Array.from(u.removedNodes);var p;var b=true,k=false,C=undefined;try{for(var g=((p=(c=window.wco)===null||c===void 0?void 0:c.frames)!==null&&p!==void 0?p:[])[Symbol.iterator](),A;!(b=(A=g.next()).done);b=true){var I=l(A.value,2),x=I[0],j=I[1];m.includes(x)&&(j(),(f=window.wco)===null||f===void 0?void 0:f.frames.delete(x))}}catch(e){k=true;C=e}finally{try{if(!b&&g.return!=null){g.return()}}finally{if(k){throw C}}}}}catch(e){r=true;o=e}finally{try{if(!t&&a.return!=null){a.return()}}finally{if(r){throw o}}}});var g=true,A=false,I=undefined;try{for(var x=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),j;!(g=(j=x.next()).done);g=true){var M=j.value;n(M,HTMLElement)&&S(M)}}catch(e){A=true;I=e}finally{try{if(!g&&x.return!=null){x.return()}}finally{if(A){throw I}}}C.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}
1
+ function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var o=true;var a=false;var i,u;try{for(r=r.call(e);!(o=(i=r.next()).done);o=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){a=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}return n}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,r){return t(e)||a(e,r)||s(e,r)||i()}function c(e){return t(e)||o(e)||s(e)||i()}function f(e){return r(e)||o(e)||s(e)||u()}function d(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function s(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}import{b as h,c as y,d as v,e as w}from"./chunk-76N4LNNK.mjs";function m(e){var t;(t=window.wco)===null||t===void 0?void 0:t.frames.set(e,h(e,function(t){switch(t.event){case"resize":{e.style.height="".concat(t.height,"px");break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{var r=e.dataset.whopCheckoutOnComplete;if(r){var n=window[r];n===null||n===void 0?void 0:n(t.plan_id,t.receipt_id)}break}}}))}function p(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})}var b="data-whop-checkout-style-";function k(e){var t={};var r=true,n=false,o=undefined;try{for(var a=e.attributes[Symbol.iterator](),i;!(r=(i=a.next()).done);r=true){var u=i.value;if(u.name.startsWith(b)){var l=u.name.slice(b.length),f=u.value,d=c(l.split("-")),s=d[0],h=d.slice(1);if(s&&h.length>0){var y=h.reduce(function(e,t,r){if(r===0)return t;var n=c(t),o=n[0],a=n.slice(1);return"".concat(e).concat(o.toUpperCase()).concat(a.join(""))},"");var v;(v=t[s])!==null&&v!==void 0?v:t[s]={},t[s][y]=f}}}}catch(e){n=true;o=e}finally{try{if(!r&&a.return!=null){a.return()}}finally{if(n){throw o}}}return t}function S(e){var t;if(e.dataset.whopCheckoutMounted)return;var r=e.dataset.whopCheckoutPlanId;if(!r)return;var n=y(r,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:p(),k(e)),o=document.createElement("iframe");o.src=n,o.style.width="100%",o.style.height="480px",o.style.border="none",o.style.overflow="hidden",(t=o.sandbox).add.apply(t,f(v)),o.allow=w,e.dataset.whopCheckoutMounted="true",e.appendChild(o),m(o)}if((typeof window==="undefined"?"undefined":d(window))<"u"&&window.wco&&!window.wco.listening){var C=new MutationObserver(function(e){var t=true,r=false,o=undefined;try{for(var a=e[Symbol.iterator](),i;!(t=(i=a.next()).done);t=true){var u=i.value;var c,f;var d=true,s=false,h=undefined;try{for(var y=u.addedNodes[Symbol.iterator](),v;!(d=(v=y.next()).done);d=true){var w=v.value;n(w,HTMLElement)&&w.dataset.whopCheckoutPlanId&&S(w)}}catch(e){s=true;h=e}finally{try{if(!d&&y.return!=null){y.return()}}finally{if(s){throw h}}}var m=Array.from(u.removedNodes);var p;var b=true,k=false,C=undefined;try{for(var g=((p=(c=window.wco)===null||c===void 0?void 0:c.frames)!==null&&p!==void 0?p:[])[Symbol.iterator](),A;!(b=(A=g.next()).done);b=true){var I=l(A.value,2),x=I[0],j=I[1];m.includes(x)&&(j(),(f=window.wco)===null||f===void 0?void 0:f.frames.delete(x))}}catch(e){k=true;C=e}finally{try{if(!b&&g.return!=null){g.return()}}finally{if(k){throw C}}}}}catch(e){r=true;o=e}finally{try{if(!t&&a.return!=null){a.return()}}finally{if(r){throw o}}}});var g=true,A=false,I=undefined;try{for(var x=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),j;!(g=(j=x.next()).done);g=true){var M=j.value;n(M,HTMLElement)&&S(M)}}catch(e){A=true;I=e}finally{try{if(!g&&x.return!=null){x.return()}}finally{if(A){throw I}}}C.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@whop/checkout",
3
3
  "description": "Embed Whop checkout on any website",
4
- "version": "0.0.31",
4
+ "version": "0.0.32",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/whopio/whop-sdk-ts",