@whop/checkout 0.0.28 → 0.0.29
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 +17 -5
- package/dist/static/checkout/chunk-STKWEWDA.mjs +1 -0
- package/dist/static/checkout/index.cjs +1 -1
- package/dist/static/checkout/index.js +1 -1
- package/dist/static/checkout/index.mjs +1 -1
- package/dist/static/checkout/util.cjs +1 -1
- package/dist/static/checkout/util.d.mts +4 -0
- package/dist/static/checkout/util.d.ts +4 -0
- package/dist/static/checkout/util.js +1 -1
- package/dist/static/checkout/util.mjs +1 -1
- package/package.json +1 -1
- package/dist/static/checkout/chunk-T4YFVF5T.mjs +0 -1
package/README.md
CHANGED
|
@@ -46,14 +46,14 @@ Possible values are `light`, `dark` or `system`.
|
|
|
46
46
|
<div data-whop-checkout-theme="light" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
### **`data-whop-checkout-session
|
|
49
|
+
### **`data-whop-checkout-session`**
|
|
50
50
|
|
|
51
51
|
**Optional** - The session id to use for the checkout.
|
|
52
52
|
|
|
53
53
|
This can be used to attach metadata to a checkout by first creating a session through the API and then passing the session id to the checkout element.
|
|
54
54
|
|
|
55
55
|
```md
|
|
56
|
-
<div data-whop-checkout-session
|
|
56
|
+
<div data-whop-checkout-session="ch_XXXXXXXXX" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
### **`data-whop-checkout-hide-price`**
|
|
@@ -72,8 +72,20 @@ Defaults to `false`
|
|
|
72
72
|
|
|
73
73
|
Defaults to `false`
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
### **`data-whop-checkout-on-complete`**
|
|
76
|
+
|
|
77
|
+
**Optional** - The callback to call when the checkout succeed.
|
|
78
|
+
|
|
79
|
+
**Note** - This option will set `data-whop-checkout-skip-redirect` to `true`
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<script>
|
|
83
|
+
window.onCheckoutComplete = (planId, receiptId) => {
|
|
84
|
+
console.log(planId, receiptId);
|
|
85
|
+
}
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<div data-whop-checkout-on-complete="onCheckoutComplete" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
77
89
|
```
|
|
78
90
|
|
|
79
91
|
|
|
@@ -103,7 +115,7 @@ Defaults to `false`
|
|
|
103
115
|
<body>
|
|
104
116
|
<div
|
|
105
117
|
data-whop-checkout-plan-id="plan_XXXXXXXXX"
|
|
106
|
-
data-whop-checkout-session
|
|
118
|
+
data-whop-checkout-session="ch_XXXXXXXXX"
|
|
107
119
|
data-whop-checkout-theme="light"
|
|
108
120
|
style="height: fit-content; overflow: hidden; max-width: 50%;"
|
|
109
121
|
></div>
|
|
@@ -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"||t.data.event==="complete")}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,s){var r=new URL("/embedded/checkout/".concat(e,"/"),a!==null&&a!==void 0?a:"https://whop.com/");return r.searchParams.set("h",window.location.origin),t&&r.searchParams.set("theme",t),o&&r.searchParams.set("session",o),n&&r.searchParams.set("hide_price","true"),s&&r.searchParams.set("skip_redirect","true"),r.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"],s="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,s 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
|
|
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"||e.data.event==="complete")}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 h(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 y=["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}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(e){var t;if(e.dataset.whopCheckoutMounted)return;var r=e.dataset.whopCheckoutPlanId;if(!r)return;var n=h(r,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete),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(y)),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 h=l.addedNodes[Symbol.iterator](),y;!(s=(y=h.next()).done);s=true){var v=y.value;n(v,HTMLElement)&&v.dataset.whopCheckoutPlanId&&p(v)}}catch(e){f=true;w=e}finally{try{if(!s&&h.return!=null){h.return()}}finally{if(f){throw w}}}var m=Array.from(l.removedNodes);var b;var k=true,S=false,g=undefined;try{for(var C=((b=(c=window.wco)===null||c===void 0?void 0:c.frames)!==null&&b!==void 0?b:[])[Symbol.iterator](),A;!(k=(A=C.next()).done);k=true){var x=u(A.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){S=true;g=e}finally{try{if(!k&&C.return!=null){C.return()}}finally{if(S){throw g}}}}}catch(e){r=true;o=e}finally{try{if(!t&&a.return!=null){a.return()}}finally{if(r){throw o}}}});var k=true,S=false,g=undefined;try{for(var C=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),A;!(k=(A=C.next()).done);k=true){var x=A.value;n(x,HTMLElement)&&p(x)}}catch(e){S=true;g=e}finally{try{if(!k&&C.return!=null){C.return()}}finally{if(S){throw g}}}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,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,
|
|
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"||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,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}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 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"||!!e.dataset.whopCheckoutOnComplete),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,h=undefined;try{for(var v=c.addedNodes[Symbol.iterator](),y;!(f=(y=v.next()).done);f=true){var m=y.value;n(m,HTMLElement)&&m.dataset.whopCheckoutPlanId&&a(m)}}catch(e){w=true;h=e}finally{try{if(!f&&v.return!=null){v.return()}}finally{if(w){throw h}}}var p=Array.from(c.removedNodes);var b;var k=true,S=false,g=undefined;try{for(var C=((b=(d=window.wco)===null||d===void 0?void 0:d.frames)!==null&&b!==void 0?b:[])[Symbol.iterator](),A;!(k=(A=C.next()).done);k=true){var x=u(A.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){S=true;g=e}finally{try{if(!k&&C.return!=null){C.return()}}finally{if(S){throw g}}}}}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,h=undefined;try{for(var v=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),y;!(f=(y=v.next()).done);f=true){var m=y.value;n(m,HTMLElement)&&a(m)}}catch(e){w=true;h=e}finally{try{if(!f&&v.return!=null){v.return()}}finally{if(w){throw h}}}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
|
|
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 d(e){return r(e)||o(e)||c(e)||l()}function f(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-STKWEWDA.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}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 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"||!!e.dataset.whopCheckoutOnComplete),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,d(h)),o.allow=w,e.dataset.whopCheckoutMounted="true",e.appendChild(o),v(o)}if((typeof window==="undefined"?"undefined":f(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 d,f;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,C=undefined;try{for(var g=((b=(d=window.wco)===null||d===void 0?void 0:d.frames)!==null&&b!==void 0?b:[])[Symbol.iterator](),A;!(S=(A=g.next()).done);S=true){var I=u(A.value,2),x=I[0],E=I[1];p.includes(x)&&(E(),(f=window.wco)===null||f===void 0?void 0:f.frames.delete(x))}}catch(e){k=true;C=e}finally{try{if(!S&&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 b=true,S=false,k=undefined;try{for(var C=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),g;!(b=(g=C.next()).done);b=true){var A=g.value;n(A,HTMLElement)&&m(A)}}catch(e){S=true;k=e}finally{try{if(!b&&C.return!=null){C.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=
|
|
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=m.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](),m;!(c=(m=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"||t.data.event==="complete")}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});
|
|
@@ -3,6 +3,10 @@ type WhopCheckoutMessage = {
|
|
|
3
3
|
height: number;
|
|
4
4
|
} | {
|
|
5
5
|
event: "center";
|
|
6
|
+
} | {
|
|
7
|
+
event: "complete";
|
|
8
|
+
receipt_id?: string;
|
|
9
|
+
plan_id: string;
|
|
6
10
|
};
|
|
7
11
|
declare function isWhopCheckoutMessage(event: MessageEvent<unknown>): event is MessageEvent<WhopCheckoutMessage>;
|
|
8
12
|
declare function onWhopCheckoutMessage(iframe: HTMLIFrameElement, callback: (message: WhopCheckoutMessage) => void): () => void;
|
|
@@ -3,6 +3,10 @@ type WhopCheckoutMessage = {
|
|
|
3
3
|
height: number;
|
|
4
4
|
} | {
|
|
5
5
|
event: "center";
|
|
6
|
+
} | {
|
|
7
|
+
event: "complete";
|
|
8
|
+
receipt_id?: string;
|
|
9
|
+
plan_id: string;
|
|
6
10
|
};
|
|
7
11
|
declare function isWhopCheckoutMessage(event: MessageEvent<unknown>): event is MessageEvent<WhopCheckoutMessage>;
|
|
8
12
|
declare function onWhopCheckoutMessage(iframe: HTMLIFrameElement, callback: (message: WhopCheckoutMessage) => void): () => void;
|
|
@@ -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,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
|
+
"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"||t.data.event==="complete")};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
|
|
1
|
+
import{a as e,b as E,c as s,d as a,e as o}from"./chunk-STKWEWDA.mjs";export{o as EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING,a as EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST,s as getEmbeddedCheckoutIframeUrl,e as isWhopCheckoutMessage,E as onWhopCheckoutMessage};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
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};
|