@whop/checkout 0.0.25 → 0.0.26-canary.0

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/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Embedded checkout allows you to embed Whop's checkout flow on your own website in two easy steps. This allows you to offer your users a seamless checkout experience without leaving your website.
4
4
 
5
+ React users should use the `@whop/react` package which includes a version of this feature optimized for react.
6
+
5
7
  ## Step 1: Add the script tag
6
8
 
7
9
  To embed checkout, you need to add the following script tag into the `<head>` of your page:
@@ -0,0 +1 @@
1
+ function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function o(o){return e(o.data)=="object"&&o.data!==null&&"event"in o.data&&(o.data.event==="resize"||o.data.event==="center")}function t(e,t){function n(n){n.source===e.contentWindow&&o(n)&&t(n.data)}return window.addEventListener("message",n),function(){window.removeEventListener("message",n)}}function n(e,o,t,n){var a=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");return a.searchParams.set("h",window.location.origin),o&&a.searchParams.set("theme",o),t&&a.searchParams.set("session",t),a.toString()}var a=["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"],s="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";export{o as a,t as b,n as c,a as d,s as e};
@@ -0,0 +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 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,l;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;l=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)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)||a(e,r)||s(e,r)||i()}function c(e){return r(e)||o(e)||s(e)||l()}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)}function f(e){return d(e.data)=="object"&&e.data!==null&&"event"in e.data&&(e.data.event==="resize"||e.data.event==="center")}function w(e,t){function r(r){r.source===e.contentWindow&&f(r)&&t(r.data)}return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}}function y(e,t,r,n){var o=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");return o.searchParams.set("h",window.location.origin),t&&o.searchParams.set("theme",t),r&&o.searchParams.set("session",r),o.toString()}var h=["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;";function m(e){var t;(t=window.wco)===null||t===void 0?void 0:t.frames.set(e,w(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}}}))}function p(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),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,c(h)),o.allow=v,e.dataset.whopCheckoutMounted="true",e.appendChild(o),m(o)}if((typeof window==="undefined"?"undefined":d(window))<"u"&&window.wco&&!window.wco.listening){var b=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 l=i.value;var c,d;var s=true,f=false,w=undefined;try{for(var y=l.addedNodes[Symbol.iterator](),h;!(s=(h=y.next()).done);s=true){var v=h.value;n(v,HTMLElement)&&v.dataset.whopCheckoutPlanId&&p(v)}}catch(e){f=true;w=e}finally{try{if(!s&&y.return!=null){y.return()}}finally{if(f){throw w}}}var m=Array.from(l.removedNodes);var b;var S=true,g=false,k=undefined;try{for(var A=((b=(c=window.wco)===null||c===void 0?void 0:c.frames)!==null&&b!==void 0?b:[])[Symbol.iterator](),x;!(S=(x=A.next()).done);S=true){var I=u(x.value,2),C=I[0],E=I[1];m.includes(C)&&(E(),(d=window.wco)===null||d===void 0?void 0:d.frames.delete(C))}}catch(e){g=true;k=e}finally{try{if(!S&&A.return!=null){A.return()}}finally{if(g){throw k}}}}}catch(e){r=true;o=e}finally{try{if(!t&&a.return!=null){a.return()}}finally{if(r){throw o}}}});var S=true,g=false,k=undefined;try{for(var A=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),x;!(S=(x=A.next()).done);S=true){var I=x.value;n(I,HTMLElement)&&p(I)}}catch(e){g=true;k=e}finally{try{if(!S&&A.return!=null){A.return()}}finally{if(g){throw k}}}b.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -1 +1 @@
1
- "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function r(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var o=true;var a=false;var i,l;try{for(n=n.call(e);!(o=(i=n.next()).done);o=true){r.push(i.value);if(t&&r.length===t)break}}catch(e){a=true;l=e}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(a)throw l}}return r}function o(){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 a(e,n){return t(e)||r(e,n)||l(e,n)||o()}function i(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}(function(){var e=function e(e){return i(e.data)=="object"&&e.data!==null&&"event"in e.data&&(e.data.event==="resize"||e.data.event==="center")};var t=function t(t){var n;function r(n){n.source===t.contentWindow&&e(n)&&(n.data.event==="resize"&&(t.style.height="".concat(n.data.height,"px")),n.data.event==="center"&&t.scrollIntoView({block:"center",inline:"center"}))}window.addEventListener("message",r),(n=window.wco)===null||n===void 0?void 0:n.frames.set(t,function(){window.removeEventListener("message",r)})};var r=function e(e){if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var r;var o=(r=e.dataset.whopCheckoutOrigin)!==null&&r!==void 0?r:"https://whop.com/",a=new URL("/embedded/checkout/".concat(n,"/"),o),i=e.dataset.whopCheckoutTheme;i&&a.searchParams.set("theme",i);var l=e.dataset.whopCheckoutSession;l&&a.searchParams.set("session",l);var u=new URL(window.location.href).origin;a.searchParams.set("h",u);var d=document.createElement("iframe");d.src=a.toString(),d.style.width="100%",d.style.height="480px",d.style.border="none",d.style.overflow="hidden",d.sandbox.add("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"),d.allow="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;",e.dataset.whopCheckoutMounted="true",e.appendChild(d),t(d)};if((typeof window==="undefined"?"undefined":i(window))<"u"&&window.wco&&!window.wco.listening){var o=new MutationObserver(function(e){var t=true,o=false,i=undefined;try{for(var l=e[Symbol.iterator](),u;!(t=(u=l.next()).done);t=true){var d=u.value;var c,s;var f=true,w=false,v=undefined;try{for(var y=d.addedNodes[Symbol.iterator](),h;!(f=(h=y.next()).done);f=true){var m=h.value;n(m,HTMLElement)&&m.dataset.whopCheckoutPlanId&&r(m)}}catch(e){w=true;v=e}finally{try{if(!f&&y.return!=null){y.return()}}finally{if(w){throw v}}}var p=Array.from(d.removedNodes);var b;var g=true,S=false,k=undefined;try{for(var x=((b=(c=window.wco)===null||c===void 0?void 0:c.frames)!==null&&b!==void 0?b:[])[Symbol.iterator](),C;!(g=(C=x.next()).done);g=true){var A=a(C.value,2),I=A[0],L=A[1];p.includes(I)&&(L(),(s=window.wco)===null||s===void 0?void 0:s.frames.delete(I))}}catch(e){S=true;k=e}finally{try{if(!g&&x.return!=null){x.return()}}finally{if(S){throw k}}}}}catch(e){o=true;i=e}finally{try{if(!t&&l.return!=null){l.return()}}finally{if(o){throw i}}}});var l=true,u=false,d=undefined;try{for(var c=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),s;!(l=(s=c.next()).done);l=true){var f=s.value;n(f,HTMLElement)&&r(f)}}catch(e){u=true;d=e}finally{try{if(!l&&c.return!=null){c.return()}}finally{if(u){throw d}}}o.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 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,l;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;l=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)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)||a(e,r)||s(e,r)||i()}function c(e){return r(e)||o(e)||s(e)||l()}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)}(function(){var e=function e(e){return d(e.data)=="object"&&e.data!==null&&"event"in e.data&&(e.data.event==="resize"||e.data.event==="center")};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){var o=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");return o.searchParams.set("h",window.location.origin),t&&o.searchParams.set("theme",t),r&&o.searchParams.set("session",r),o.toString()};var o=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}}}))};var a=function e(e){var t;if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var a=r(n,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin),u=document.createElement("iframe");u.src=a,u.style.width="100%",u.style.height="480px",u.style.border="none",u.style.overflow="hidden",(t=u.sandbox).add.apply(t,c(i)),u.allow=l,e.dataset.whopCheckoutMounted="true",e.appendChild(u),o(u)};var i=["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"],l="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";if((typeof window==="undefined"?"undefined":d(window))<"u"&&window.wco&&!window.wco.listening){var s=new MutationObserver(function(e){var t=true,r=false,o=undefined;try{for(var i=e[Symbol.iterator](),l;!(t=(l=i.next()).done);t=true){var c=l.value;var d,s;var f=true,w=false,y=undefined;try{for(var v=c.addedNodes[Symbol.iterator](),h;!(f=(h=v.next()).done);f=true){var m=h.value;n(m,HTMLElement)&&m.dataset.whopCheckoutPlanId&&a(m)}}catch(e){w=true;y=e}finally{try{if(!f&&v.return!=null){v.return()}}finally{if(w){throw y}}}var p=Array.from(c.removedNodes);var b;var S=true,g=false,k=undefined;try{for(var A=((b=(d=window.wco)===null||d===void 0?void 0:d.frames)!==null&&b!==void 0?b:[])[Symbol.iterator](),x;!(S=(x=A.next()).done);S=true){var I=u(x.value,2),C=I[0],E=I[1];p.includes(C)&&(E(),(s=window.wco)===null||s===void 0?void 0:s.frames.delete(C))}}catch(e){g=true;k=e}finally{try{if(!S&&A.return!=null){A.return()}}finally{if(g){throw k}}}}}catch(e){r=true;o=e}finally{try{if(!t&&i.return!=null){i.return()}}finally{if(r){throw o}}}});var f=true,w=false,y=undefined;try{for(var v=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),h;!(f=(h=v.next()).done);f=true){var m=h.value;n(m,HTMLElement)&&a(m)}}catch(e){w=true;y=e}finally{try{if(!f&&v.return!=null){v.return()}}finally{if(w){throw y}}}s.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}})();
@@ -0,0 +1 @@
1
+ function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(r){if(Array.isArray(r))return e(r)}function n(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(e,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var o=true;var a=false;var i,l;try{for(t=t.call(e);!(o=(i=t.next()).done);o=true){n.push(i.value);if(r&&n.length===r)break}}catch(e){a=true;l=e}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(a)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,t){return r(e)||a(e,t)||c(e,t)||i()}function f(e){return t(e)||o(e)||c(e)||l()}function d(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function c(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.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(r,t)}import{b as s,c as y,d as h,e as v}from"./chunk-IJYI3M7Q.mjs";function w(e){var r;(r=window.wco)===null||r===void 0?void 0:r.frames.set(e,s(e,function(r){switch(r.event){case"resize":{e.style.height="".concat(r.height,"px");break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}}}))}function m(e){var r;if(e.dataset.whopCheckoutMounted)return;var t=e.dataset.whopCheckoutPlanId;if(!t)return;var n=y(t,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin),o=document.createElement("iframe");o.src=n,o.style.width="100%",o.style.height="480px",o.style.border="none",o.style.overflow="hidden",(r=o.sandbox).add.apply(r,f(h)),o.allow=v,e.dataset.whopCheckoutMounted="true",e.appendChild(o),w(o)}if((typeof window==="undefined"?"undefined":d(window))<"u"&&window.wco&&!window.wco.listening){var b=new MutationObserver(function(e){var r=true,t=false,o=undefined;try{for(var a=e[Symbol.iterator](),i;!(r=(i=a.next()).done);r=true){var l=i.value;var f,d;var c=true,s=false,y=undefined;try{for(var h=l.addedNodes[Symbol.iterator](),v;!(c=(v=h.next()).done);c=true){var w=v.value;n(w,HTMLElement)&&w.dataset.whopCheckoutPlanId&&m(w)}}catch(e){s=true;y=e}finally{try{if(!c&&h.return!=null){h.return()}}finally{if(s){throw y}}}var b=Array.from(l.removedNodes);var p;var S=true,k=false,g=undefined;try{for(var I=((p=(f=window.wco)===null||f===void 0?void 0:f.frames)!==null&&p!==void 0?p:[])[Symbol.iterator](),A;!(S=(A=I.next()).done);S=true){var C=u(A.value,2),x=C[0],M=C[1];b.includes(x)&&(M(),(d=window.wco)===null||d===void 0?void 0:d.frames.delete(x))}}catch(e){k=true;g=e}finally{try{if(!S&&I.return!=null){I.return()}}finally{if(k){throw g}}}}}catch(e){t=true;o=e}finally{try{if(!r&&a.return!=null){a.return()}}finally{if(t){throw o}}}});var p=true,S=false,k=undefined;try{for(var g=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),I;!(p=(I=g.next()).done);p=true){var A=I.value;n(A,HTMLElement)&&m(A)}}catch(e){S=true;k=e}finally{try{if(!p&&g.return!=null){g.return()}}finally{if(S){throw k}}}b.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}
@@ -0,0 +1 @@
1
+ "use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var n=document.currentScript,o=n===null||n===void 0?void 0:n.src;var d;(typeof window==="undefined"?"undefined":e(window))<"u"&&o&&((d=window.wco)!==null&&d!==void 0?d:window.wco=function(){var e=document.createElement("script");return e.src=o.replace(/loader\.js$/,"index.js"),e.async=!0,e.defer=!0,document.head.appendChild(e),{injected:!0,listening:!1,frames:new Map}}());
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1 @@
1
+ function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var n=document.currentScript,o=n===null||n===void 0?void 0:n.src;var d;(typeof window==="undefined"?"undefined":e(window))<"u"&&o&&((d=window.wco)!==null&&d!==void 0?d:window.wco=function(){var e=document.createElement("script");return e.src=o.replace(/loader\.js$/,"index.js"),e.async=!0,e.defer=!0,document.head.appendChild(e),{injected:!0,listening:!1,frames:new Map}}());
@@ -0,0 +1 @@
1
+ "use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var t=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var a=function(e,o){for(var n in o)t(e,n,{get:o[n],enumerable:!0})},u=function(a,u,i,c){var s=true,l=false,d=undefined;if(u&&(typeof u==="undefined"?"undefined":e(u))=="object"||typeof u=="function")try{var f=function(){var e=E.value;!r.call(a,e)&&e!==i&&t(a,e,{get:function(){return u[e]},enumerable:!(c=o(u,e))||c.enumerable})};for(var p=n(u)[Symbol.iterator](),E;!(s=(E=p.next()).done);s=true)f()}catch(e){l=true;d=e}finally{try{if(!s&&p.return!=null){p.return()}}finally{if(l){throw d}}}return a};var i=function(e){return u(t({},"__esModule",{value:!0}),e)};var c={};a(c,{EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING:function(){return p},EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST:function(){return f},getEmbeddedCheckoutIframeUrl:function(){return d},isWhopCheckoutMessage:function(){return s},onWhopCheckoutMessage:function(){return l}});module.exports=i(c);function s(t){return e(t.data)=="object"&&t.data!==null&&"event"in t.data&&(t.data.event==="resize"||t.data.event==="center")}function l(e,t){function o(o){o.source===e.contentWindow&&s(o)&&t(o.data)}return window.addEventListener("message",o),function(){window.removeEventListener("message",o)}}function d(e,t,o,n){var r=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");return r.searchParams.set("h",window.location.origin),t&&r.searchParams.set("theme",t),o&&r.searchParams.set("session",o),r.toString()}var f=["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"],p="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";0&&(module.exports={EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING:EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING,EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST:EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST,getEmbeddedCheckoutIframeUrl:getEmbeddedCheckoutIframeUrl,isWhopCheckoutMessage:isWhopCheckoutMessage,onWhopCheckoutMessage:onWhopCheckoutMessage});
@@ -0,0 +1,13 @@
1
+ type WhopCheckoutMessage = {
2
+ event: "resize";
3
+ height: number;
4
+ } | {
5
+ event: "center";
6
+ };
7
+ declare function isWhopCheckoutMessage(event: MessageEvent<unknown>): event is MessageEvent<WhopCheckoutMessage>;
8
+ declare function onWhopCheckoutMessage(iframe: HTMLIFrameElement, callback: (message: WhopCheckoutMessage) => void): () => void;
9
+ declare function getEmbeddedCheckoutIframeUrl(planId: string, theme?: "light" | "dark" | "system", sessionId?: string, origin?: string): string;
10
+ declare const EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST: string[];
11
+ declare const EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING = "document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";
12
+
13
+ export { EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING, EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST, type WhopCheckoutMessage, getEmbeddedCheckoutIframeUrl, isWhopCheckoutMessage, onWhopCheckoutMessage };
@@ -0,0 +1,13 @@
1
+ type WhopCheckoutMessage = {
2
+ event: "resize";
3
+ height: number;
4
+ } | {
5
+ event: "center";
6
+ };
7
+ declare function isWhopCheckoutMessage(event: MessageEvent<unknown>): event is MessageEvent<WhopCheckoutMessage>;
8
+ declare function onWhopCheckoutMessage(iframe: HTMLIFrameElement, callback: (message: WhopCheckoutMessage) => void): () => void;
9
+ declare function getEmbeddedCheckoutIframeUrl(planId: string, theme?: "light" | "dark" | "system", sessionId?: string, origin?: string): string;
10
+ declare const EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST: string[];
11
+ declare const EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING = "document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";
12
+
13
+ export { EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING, EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST, type WhopCheckoutMessage, getEmbeddedCheckoutIframeUrl, isWhopCheckoutMessage, onWhopCheckoutMessage };
@@ -0,0 +1 @@
1
+ "use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}(function(){var o=function o(o){return e(o.data)=="object"&&o.data!==null&&"event"in o.data&&(o.data.event==="resize"||o.data.event==="center")};var t=function e(e,t){function n(n){n.source===e.contentWindow&&o(n)&&t(n.data)}return window.addEventListener("message",n),function(){window.removeEventListener("message",n)}};var n=function e(e,o,t,n){var a=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");return a.searchParams.set("h",window.location.origin),o&&a.searchParams.set("theme",o),t&&a.searchParams.set("session",t),a.toString()};var a=["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"],i="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;"})();
@@ -0,0 +1 @@
1
+ import{a as e,b as s,c as E,d as a,e as o}from"./chunk-IJYI3M7Q.mjs";export{o as EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING,a as EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST,E as getEmbeddedCheckoutIframeUrl,e as isWhopCheckoutMessage,s as onWhopCheckoutMessage};
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.25",
4
+ "version": "0.0.26-canary.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/whopio/whop-sdk-ts",
@@ -23,8 +23,19 @@
23
23
  "dist"
24
24
  ],
25
25
  "exports": {
26
- ".": "./dist/static/checkout/index.js",
27
- "./loader": "./dist/static/checkout/loader.js"
26
+ ".": {
27
+ "import": "./dist/static/checkout/index.mjs",
28
+ "require": "./dist/static/checkout/index.cjs",
29
+ "types": "./dist/static/checkout/index.d.ts",
30
+ "default": "./dist/static/checkout/index.js"
31
+ },
32
+ "./loader": "./dist/static/checkout/loader.js",
33
+ "./util": {
34
+ "import": "./dist/static/checkout/util.mjs",
35
+ "require": "./dist/static/checkout/util.cjs",
36
+ "types": "./dist/static/checkout/util.d.ts",
37
+ "default": "./dist/static/checkout/util.js"
38
+ }
28
39
  },
29
40
  "devDependencies": {
30
41
  "@swc/core": "1.11.29",
@@ -44,6 +55,7 @@
44
55
  "build": "tsup",
45
56
  "check-types": "tsc --noEmit",
46
57
  "deploy": "wrangler deploy",
58
+ "deploy:canary": "wrangler versions upload",
47
59
  "dev": "wrangler dev --port 8000",
48
60
  "lint:fix": "biome check --write --unsafe"
49
61
  }