@whop/checkout 0.0.27 → 0.0.28

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
@@ -56,6 +56,27 @@ This can be used to attach metadata to a checkout by first creating a session th
56
56
  <div data-whop-checkout-session-id="ch_XXXXXXXXX" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
57
57
  ```
58
58
 
59
+ ### **`data-whop-checkout-hide-price`**
60
+
61
+ **Optional** - Set to `true` to hide the price in the embedded checkout form.
62
+
63
+ Defaults to `false`
64
+
65
+ ```md
66
+ <div data-whop-checkout-hide-price="true" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
67
+ ```
68
+
69
+ ### **`data-whop-checkout-skip-redirect`**
70
+
71
+ **Optional** - Set to `true` to skip the final redirect and keep the top frame loaded.
72
+
73
+ Defaults to `false`
74
+
75
+ ```md
76
+ <div data-whop-checkout-skip-redirect="true" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
77
+ ```
78
+
79
+
59
80
  ## Full example
60
81
 
61
82
  ```md
@@ -0,0 +1 @@
1
+ function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function t(t){return e(t.data)=="object"&&t.data!==null&&"event"in t.data&&(t.data.event==="resize"||t.data.event==="center")}function o(e,o){function a(a){a.source===e.contentWindow&&t(a)&&o(a.data)}return window.addEventListener("message",a),function(){window.removeEventListener("message",a)}}function a(e,t,o,a,n,r){var s=new URL("/embedded/checkout/".concat(e,"/"),a!==null&&a!==void 0?a:"https://whop.com/");return s.searchParams.set("h",window.location.origin),t&&s.searchParams.set("theme",t),o&&s.searchParams.set("session",o),n&&s.searchParams.set("hide_price","true"),r&&s.searchParams.set("skip_redirect","true"),s.toString()}var n=["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"],r="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";export{t as a,o as b,a as c,n as d,r as e};
@@ -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 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,o){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),t&&a.searchParams.set("theme",t),r&&a.searchParams.set("session",r),o&&a.searchParams.set("hide_price","true"),a.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,e.dataset.whopCheckoutHidePrice==="true"),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 C=u(x.value,2),I=C[0],E=C[1];m.includes(I)&&(E(),(d=window.wco)===null||d===void 0?void 0:d.frames.delete(I))}}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 C=x.value;n(C,HTMLElement)&&p(C)}}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}
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,o,a){var i=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");return i.searchParams.set("h",window.location.origin),t&&i.searchParams.set("theme",t),r&&i.searchParams.set("session",r),o&&i.searchParams.set("hide_price","true"),a&&i.searchParams.set("skip_redirect","true"),i.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,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"),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](),C;!(S=(C=A.next()).done);S=true){var x=u(C.value,2),I=x[0],P=x[1];m.includes(I)&&(P(),(d=window.wco)===null||d===void 0?void 0:d.frames.delete(I))}}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](),C;!(S=(C=A.next()).done);S=true){var x=C.value;n(x,HTMLElement)&&p(x)}}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}
@@ -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 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,o){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),t&&a.searchParams.set("theme",t),r&&a.searchParams.set("session",r),o&&a.searchParams.set("hide_price","true"),a.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,e.dataset.whopCheckoutHidePrice==="true"),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 C=u(x.value,2),I=C[0],E=C[1];p.includes(I)&&(E(),(s=window.wco)===null||s===void 0?void 0:s.frames.delete(I))}}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}})();
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,o,a){var i=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");return i.searchParams.set("h",window.location.origin),t&&i.searchParams.set("theme",t),r&&i.searchParams.set("session",r),o&&i.searchParams.set("hide_price","true"),a&&i.searchParams.set("skip_redirect","true"),i.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,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"),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 h=c.addedNodes[Symbol.iterator](),v;!(f=(v=h.next()).done);f=true){var m=v.value;n(m,HTMLElement)&&m.dataset.whopCheckoutPlanId&&a(m)}}catch(e){w=true;y=e}finally{try{if(!f&&h.return!=null){h.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](),C;!(S=(C=A.next()).done);S=true){var x=u(C.value,2),I=x[0],P=x[1];p.includes(I)&&(P(),(s=window.wco)===null||s===void 0?void 0:s.frames.delete(I))}}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 h=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),v;!(f=(v=h.next()).done);f=true){var m=v.value;n(m,HTMLElement)&&a(m)}}catch(e){w=true;y=e}finally{try{if(!f&&h.return!=null){h.return()}}finally{if(w){throw y}}}s.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,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)||c(e,r)||i()}function f(e){return r(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(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 s,c as y,d as h,e as v}from"./chunk-6UN3SZWF.mjs";function w(e){var t;(t=window.wco)===null||t===void 0?void 0:t.frames.set(e,s(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 m(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"),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(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 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 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 A=((p=(f=window.wco)===null||f===void 0?void 0:f.frames)!==null&&p!==void 0?p:[])[Symbol.iterator](),C;!(S=(C=A.next()).done);S=true){var I=u(C.value,2),x=I[0],M=I[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&&A.return!=null){A.return()}}finally{if(k){throw g}}}}}catch(e){r=true;o=e}finally{try{if(!t&&a.return!=null){a.return()}}finally{if(r){throw o}}}});var p=true,S=false,k=undefined;try{for(var g=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),A;!(p=(A=g.next()).done);p=true){var C=A.value;n(C,HTMLElement)&&m(C)}}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}
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,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)||c(e,r)||i()}function f(e){return r(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(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 s,c as y,d as h,e as w}from"./chunk-T4YFVF5T.mjs";function v(e){var t;(t=window.wco)===null||t===void 0?void 0:t.frames.set(e,s(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 m(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"),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(h)),o.allow=w,e.dataset.whopCheckoutMounted="true",e.appendChild(o),v(o)}if((typeof window==="undefined"?"undefined":d(window))<"u"&&window.wco&&!window.wco.listening){var p=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 f,d;var c=true,s=false,y=undefined;try{for(var h=l.addedNodes[Symbol.iterator](),w;!(c=(w=h.next()).done);c=true){var v=w.value;n(v,HTMLElement)&&v.dataset.whopCheckoutPlanId&&m(v)}}catch(e){s=true;y=e}finally{try{if(!c&&h.return!=null){h.return()}}finally{if(s){throw y}}}var p=Array.from(l.removedNodes);var b;var S=true,k=false,g=undefined;try{for(var A=((b=(f=window.wco)===null||f===void 0?void 0:f.frames)!==null&&b!==void 0?b:[])[Symbol.iterator](),C;!(S=(C=A.next()).done);S=true){var I=u(C.value,2),x=I[0],T=I[1];p.includes(x)&&(T(),(d=window.wco)===null||d===void 0?void 0:d.frames.delete(x))}}catch(e){k=true;g=e}finally{try{if(!S&&A.return!=null){A.return()}}finally{if(k){throw g}}}}}catch(e){r=true;o=e}finally{try{if(!t&&a.return!=null){a.return()}}finally{if(r){throw o}}}});var b=true,S=false,k=undefined;try{for(var g=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),A;!(b=(A=g.next()).done);b=true){var C=A.value;n(C,HTMLElement)&&m(C)}}catch(e){S=true;k=e}finally{try{if(!b&&g.return!=null){g.return()}}finally{if(S){throw k}}}p.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}
@@ -1 +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})},i=function(a,i,u,s){var c=true,l=false,d=undefined;if(i&&(typeof i==="undefined"?"undefined":e(i))=="object"||typeof i=="function")try{var f=function(){var e=E.value;!r.call(a,e)&&e!==u&&t(a,e,{get:function(){return i[e]},enumerable:!(s=o(i,e))||s.enumerable})};for(var p=n(i)[Symbol.iterator](),E;!(c=(E=p.next()).done);c=true)f()}catch(e){l=true;d=e}finally{try{if(!c&&p.return!=null){p.return()}}finally{if(l){throw d}}}return a};var u=function(e){return i(t({},"__esModule",{value:!0}),e)};var s={};a(s,{EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING:function(){return p},EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST:function(){return f},getEmbeddedCheckoutIframeUrl:function(){return d},isWhopCheckoutMessage:function(){return c},onWhopCheckoutMessage:function(){return l}});module.exports=u(s);function c(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&&c(o)&&t(o.data)}return window.addEventListener("message",o),function(){window.removeEventListener("message",o)}}function d(e,t,o,n,r){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),t&&a.searchParams.set("theme",t),o&&a.searchParams.set("session",o),r&&a.searchParams.set("hide_price","true"),a.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});
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})},i=function(a,i,u,s){var c=true,l=false,d=undefined;if(i&&(typeof i==="undefined"?"undefined":e(i))=="object"||typeof i=="function")try{var f=function(){var e=E.value;!r.call(a,e)&&e!==u&&t(a,e,{get:function(){return i[e]},enumerable:!(s=o(i,e))||s.enumerable})};for(var p=n(i)[Symbol.iterator](),E;!(c=(E=p.next()).done);c=true)f()}catch(e){l=true;d=e}finally{try{if(!c&&p.return!=null){p.return()}}finally{if(l){throw d}}}return a};var u=function(e){return i(t({},"__esModule",{value:!0}),e)};var s={};a(s,{EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING:function(){return p},EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST:function(){return f},getEmbeddedCheckoutIframeUrl:function(){return d},isWhopCheckoutMessage:function(){return c},onWhopCheckoutMessage:function(){return l}});module.exports=u(s);function c(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&&c(o)&&t(o.data)}return window.addEventListener("message",o),function(){window.removeEventListener("message",o)}}function d(e,t,o,n,r,a){var i=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");return i.searchParams.set("h",window.location.origin),t&&i.searchParams.set("theme",t),o&&i.searchParams.set("session",o),r&&i.searchParams.set("hide_price","true"),a&&i.searchParams.set("skip_redirect","true"),i.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});
@@ -6,7 +6,7 @@ type WhopCheckoutMessage = {
6
6
  };
7
7
  declare function isWhopCheckoutMessage(event: MessageEvent<unknown>): event is MessageEvent<WhopCheckoutMessage>;
8
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, hidePrice?: boolean): string;
9
+ declare function getEmbeddedCheckoutIframeUrl(planId: string, theme?: "light" | "dark" | "system", sessionId?: string, origin?: string, hidePrice?: boolean, skipRedirect?: boolean): string;
10
10
  declare const EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST: string[];
11
11
  declare const EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING = "document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";
12
12
 
@@ -6,7 +6,7 @@ type WhopCheckoutMessage = {
6
6
  };
7
7
  declare function isWhopCheckoutMessage(event: MessageEvent<unknown>): event is MessageEvent<WhopCheckoutMessage>;
8
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, hidePrice?: boolean): string;
9
+ declare function getEmbeddedCheckoutIframeUrl(planId: string, theme?: "light" | "dark" | "system", sessionId?: string, origin?: string, hidePrice?: boolean, skipRedirect?: boolean): string;
10
10
  declare const EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST: string[];
11
11
  declare const EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING = "document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";
12
12
 
@@ -1 +1 @@
1
- "use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}(function(){var t=function t(t){return e(t.data)=="object"&&t.data!==null&&"event"in t.data&&(t.data.event==="resize"||t.data.event==="center")};var o=function e(e,o){function n(n){n.source===e.contentWindow&&t(n)&&o(n.data)}return window.addEventListener("message",n),function(){window.removeEventListener("message",n)}};var n=function e(e,t,o,n,a){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),a&&r.searchParams.set("hide_price","true"),r.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"],r="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;"})();
1
+ "use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}(function(){var t=function t(t){return e(t.data)=="object"&&t.data!==null&&"event"in t.data&&(t.data.event==="resize"||t.data.event==="center")};var o=function e(e,o){function n(n){n.source===e.contentWindow&&t(n)&&o(n.data)}return window.addEventListener("message",n),function(){window.removeEventListener("message",n)}};var n=function e(e,t,o,n,a,r){var i=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");return i.searchParams.set("h",window.location.origin),t&&i.searchParams.set("theme",t),o&&i.searchParams.set("session",o),a&&i.searchParams.set("hide_price","true"),r&&i.searchParams.set("skip_redirect","true"),i.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"],r="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;"})();
@@ -1 +1 @@
1
- import{a as e,b as s,c as E,d as a,e as o}from"./chunk-6UN3SZWF.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};
1
+ import{a as e,b as s,c as E,d as a,e as o}from"./chunk-T4YFVF5T.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.27",
4
+ "version": "0.0.28",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/whopio/whop-sdk-ts",
@@ -1 +0,0 @@
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,a){var s=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");return s.searchParams.set("h",window.location.origin),o&&s.searchParams.set("theme",o),t&&s.searchParams.set("session",t),a&&s.searchParams.set("hide_price","true"),s.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};