@whop/checkout 0.0.36 → 0.0.37
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 +46 -4
- package/dist/static/checkout/chunk-N2KVERZN.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/loader.cjs +1 -1
- package/dist/static/checkout/loader.js +1 -1
- package/dist/static/checkout/loader.mjs +1 -1
- package/dist/static/checkout/util.cjs +1 -1
- package/dist/static/checkout/util.d.mts +40 -17
- package/dist/static/checkout/util.d.ts +40 -17
- 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-EAN646K5.mjs +0 -1
package/README.md
CHANGED
|
@@ -30,21 +30,36 @@ You can configure the redirect url in your [whop's settings](https://whop.com/da
|
|
|
30
30
|
|
|
31
31
|
## Available methods
|
|
32
32
|
|
|
33
|
-
### **`submit`**
|
|
34
|
-
|
|
35
|
-
To submit checkout programmatically, you can use the `submit` method on the checkout element.
|
|
36
33
|
First, attach an `id` to the checkout container:
|
|
37
34
|
|
|
38
35
|
```md
|
|
39
36
|
<div id="whop-embedded-checkout" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
40
37
|
```
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
### **`submit`**
|
|
40
|
+
|
|
41
|
+
To submit checkout programmatically, you can use the `submit` method on the checkout element.
|
|
43
42
|
|
|
44
43
|
```js
|
|
45
44
|
wco.submit("whop-embedded-checkout");
|
|
46
45
|
```
|
|
47
46
|
|
|
47
|
+
### **`getEmail`**
|
|
48
|
+
|
|
49
|
+
To get the email of the user who is checking out, you can use the `getEmail` method on the checkout element.
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
const email = await wco.getEmail("whop-embedded-checkout");
|
|
53
|
+
console.log(email);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### **`setEmail`**
|
|
57
|
+
|
|
58
|
+
To set the email of the user who is checking out, you can use the `setEmail` method on the checkout element.
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
wco.setEmail("whop-embedded-checkout", "example@domain.com");
|
|
62
|
+
```
|
|
48
63
|
|
|
49
64
|
## Available attributes
|
|
50
65
|
|
|
@@ -204,6 +219,33 @@ Used to prefill the email in the embedded checkout form. This setting can be hel
|
|
|
204
219
|
<div data-whop-checkout-prefill-email="example@domain.com" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
205
220
|
```
|
|
206
221
|
|
|
222
|
+
|
|
223
|
+
#### **`data-whop-checkout-hide-email`**
|
|
224
|
+
|
|
225
|
+
**Optional** - Set to `true` to hide the email input in the embedded checkout form. Make sure to display the users email in the parent page when setting this attribute.
|
|
226
|
+
|
|
227
|
+
Defaults to `false`
|
|
228
|
+
|
|
229
|
+
Use this in conjunction with the `data-whop-checkout-prefill-email` attribute or the `setEmail` method to control the email input.
|
|
230
|
+
|
|
231
|
+
```md
|
|
232
|
+
<div data-whop-checkout-hide-email="true" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### **`data-whop-checkout-disable-email`**
|
|
236
|
+
|
|
237
|
+
**Optional** - Set to `true` to disable the email input in the embedded checkout form.
|
|
238
|
+
|
|
239
|
+
Defaults to `false`
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
Use this in conjunction with the `data-whop-checkout-prefill-email` attribute or the `setEmail` method to control the email input.
|
|
243
|
+
|
|
244
|
+
```md
|
|
245
|
+
<div data-whop-checkout-disable-email="true" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
|
|
207
249
|
## Full example
|
|
208
250
|
|
|
209
251
|
```md
|
|
@@ -0,0 +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(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function n(e,t,r,n,o,i,a){try{var u=e[i](a);var c=u.value}catch(e){r(e);return}if(u.done){t(c)}else{Promise.resolve(c).then(n,o)}}function o(e){return function(){var t=this,r=arguments;return new Promise(function(o,i){var a=e.apply(t,r);function u(e){n(a,o,i,u,c,"next",e)}function c(e){n(a,o,i,u,c,"throw",e)}u(undefined)})}}function i(e,t,r){t=l(t);return m(e,j()?Reflect.construct(t,r||[],l(e).constructor):t.apply(e,r))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function u(e,t,r){if(j()){u=Reflect.construct}else{u=function e(e,t,r){var n=[null];n.push.apply(n,t);var o=Function.bind.apply(e,n);var i=new o;if(r)b(i,r.prototype);return i}}return u.apply(null,arguments)}function c(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function l(e){l=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return l(e)}function s(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)b(e,t)}function f(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function p(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 i=false;var a,u;try{for(r=r.call(e);!(o=(a=r.next()).done);o=true){n.push(a.value);if(t&&n.length===t)break}}catch(e){i=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(i)throw u}}return n}function y(){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 d(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){c(e,t,r[t])})}return e}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function h(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{v(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function m(e,t){if(t&&(g(t)==="object"||typeof t==="function")){return t}return r(e)}function b(e,t){b=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return b(e,t)}function w(e,r){return t(e)||p(e,r)||O(e,r)||y()}function g(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function O(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 P(e){var t=typeof Map==="function"?new Map:undefined;P=function e(e){if(e===null||!f(e))return e;if(typeof e!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof t!=="undefined"){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,l(this).constructor)}r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});return b(r,e)};return P(e)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function _(e,t){var r,n,o,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=u(0),a["throw"]=u(1),a["return"]=u(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(t){return c([e,t])}}function c(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(i=0)),i)try{if(r=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:i.label++;return{value:u[1],done:false};case 5:i.label++;n=u[1];u=[0];continue;case 7:u=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){i=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(u[0]===6&&i.label<o[1]){i.label=o[1];o=u;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(u);break}if(o[2])i.ops.pop();i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e];n=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}var S=Object.defineProperty;var E=function(e,t,r){return t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var k=function(e,t,r){return E(e,(typeof t==="undefined"?"undefined":g(t))!="symbol"?t+"":t,r)};var x=/*#__PURE__*/function(e){"use strict";s(t,e);function t(){a(this,t);var e;e=i(this,t,arguments);k(e,"type","WhopCheckoutError");return e}return t}(P(Error));var R=/*#__PURE__*/function(e){"use strict";s(t,e);function t(e){a(this,t);var r;r=i(this,t,[e!==null&&e!==void 0?e:"Timeout waiting for embed response"]);k(r,"name","WhopCheckoutRpcTimeoutError");return r}return t}(x);var A=/*#__PURE__*/function(e){"use strict";s(t,e);function t(){a(this,t);var e;e=i(this,t,arguments);k(e,"name","WhopCheckoutSetEmailError");return e}return t}(x);var T=["resize","center","complete","state","get-email-result","set-email-result"];function L(e){return g(e.data)=="object"&&e.data!==null&&"event"in e.data&&T.includes(e.data.event)}function U(e,t){return L(e)&&e.data.event===t}var W=[];function C(e){return W[e]||(W[e]=(e+256).toString(16).slice(1))}function M(){var e=new Uint8Array(16);if((typeof crypto==="undefined"?"undefined":g(crypto))<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(var t=0;t<16;t++)e[t]=Math.random()*256|0;return e[6]=e[6]&15|64,e[8]=e[8]&63|128,C(e[0])+C(e[1])+C(e[2])+C(e[3])+"-"+C(e[4])+C(e[5])+"-"+C(e[6])+C(e[7])+"-"+C(e[8])+C(e[9])+"-"+C(e[10])+C(e[11])+C(e[12])+C(e[13])+C(e[14])+C(e[15])}function D(e,t,r,n){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:2e3;var i;var a=new URL(e.src).origin,u=M();return(i=e.contentWindow)===null||i===void 0?void 0:i.postMessage(h(d({},t),{__scope:"whop-embedded-checkout",event_id:u}),a),new Promise(function(t,i){var a=setTimeout(function(){i(new R),window.removeEventListener("message",c)},o),c=function(o){if(o.source===e.contentWindow&&U(o,r)&&o.data.event===r&&o.data.event_id===u){clearTimeout(a),window.removeEventListener("message",c);try{t(n(o.data))}catch(e){i(e)}}};window.addEventListener("message",c)})}function I(e,t){function r(r){r.source===e.contentWindow&&L(r)&&t(r.data)}return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}}function B(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return o(function(){return _(this,function(n){return[2,D(e,{event:"set-email",email:t},"set-email-result",function(e){if(!e.ok)throw new A(e.error)},r)]})})()}function F(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return o(function(){return _(this,function(r){return[2,D(e,{event:"get-email"},"get-email-result",function(e){return e.email},t)]})})()}function G(e,t){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)}function V(e,t,r,n,o,i,a,u,c,l,s,f,p,y){var d=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(d.searchParams.set("h",window.location.origin),t&&d.searchParams.set("theme",t),r&&d.searchParams.set("session",r),o&&d.searchParams.set("hide_price","true"),i&&d.searchParams.set("skip_redirect","true"),s&&d.searchParams.set("hide_submit_button","true"),f&&d.searchParams.set("hide_tos","true"),p&&d.searchParams.set("email.hidden","1"),y&&d.searchParams.set("email.disabled","1"),a){var v=true,h=false,m=undefined,b=true,g=false,O=undefined;try{for(var P=Object.entries(a).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),j;!(b=(j=P.next()).done);b=true){var _=w(j.value,2),S=_[0],E=_[1];if(S.startsWith("utm_"))if(Array.isArray(E))try{for(var k=E[Symbol.iterator](),x;!(v=(x=k.next()).done);v=true){var R=x.value;d.searchParams.append(S,R)}}catch(e){h=true;m=e}finally{try{if(!v&&k.return!=null){k.return()}}finally{if(h){throw m}}}else d.searchParams.set(S,E)}}catch(e){g=true;O=e}finally{try{if(!b&&P.return!=null){P.return()}}finally{if(g){throw O}}}}if(u){var A=true,T=false,L=undefined,U=true,W=false,C=undefined;try{for(var M=Object.entries(u)[Symbol.iterator](),D;!(U=(D=M.next()).done);U=true){var I=w(D.value,2),B=I[0],F=I[1];if(F)try{for(var G=Object.entries(F)[Symbol.iterator](),V;!(A=(V=G.next()).done);A=true){var q=w(V.value,2),z=q[0],J=q[1];d.searchParams.set("style.".concat(B,".").concat(z),J.toString())}}catch(e){T=true;L=e}finally{try{if(!A&&G.return!=null){G.return()}}finally{if(T){throw L}}}}}catch(e){W=true;C=e}finally{try{if(!U&&M.return!=null){M.return()}}finally{if(W){throw C}}}}var Q=true,Z=false,$=undefined;if((c===null||c===void 0?void 0:c.email)&&d.searchParams.set("email",c.email),l)try{for(var H=Object.entries(l)[Symbol.iterator](),K;!(Q=(K=H.next()).done);Q=true){var N=w(K.value,2),X=N[0],Y=N[1];Y&&d.searchParams.set("theme.".concat(X),Y)}}catch(e){Z=true;$=e}finally{try{if(!Q&&H.return!=null){H.return()}}finally{if(Z){throw $}}}return d.toString()}var q=["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"],z="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";export{L as a,I as b,B as c,F as d,G as e,V as f,q as g,z as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function o(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var a=true;var o=false;var i,l;try{for(r=r.call(e);!(a=(i=r.next()).done);a=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){o=true;l=e}finally{try{if(!a&&r["return"]!=null)r["return"]()}finally{if(o)throw l}}return n}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,r){return t(e)||o(e,r)||f(e,r)||i()}function c(e){return t(e)||a(e)||f(e)||i()}function s(e){return r(e)||a(e)||f(e)||l()}function d(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function f(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)}var h=["resize","center","complete","state"];function v(e){return d(e.data)=="object"&&e.data!==null&&"event"in e.data&&h.includes(e.data.event)}function w(e,t){function r(r){r.source===e.contentWindow&&v(r)&&t(r.data)}return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}}function y(e,t){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)}function m(e,t,r,n,a,o,i,l,c,s,d,f){var h=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(h.searchParams.set("h",window.location.origin),t&&h.searchParams.set("theme",t),r&&h.searchParams.set("session",r),a&&h.searchParams.set("hide_price","true"),o&&h.searchParams.set("skip_redirect","true"),d&&h.searchParams.set("hide_submit_button","true"),f&&h.searchParams.set("hide_tos","true"),i){var v=true,w=false,y=undefined,m=true,p=false,b=undefined;try{for(var k=Object.entries(i).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),C;!(m=(C=k.next()).done);m=true){var S=u(C.value,2),g=S[0],A=S[1];if(g.startsWith("utm_"))if(Array.isArray(A))try{for(var P=A[Symbol.iterator](),x;!(v=(x=P.next()).done);v=true){var I=x.value;h.searchParams.append(g,I)}}catch(e){w=true;y=e}finally{try{if(!v&&P.return!=null){P.return()}}finally{if(w){throw y}}}else h.searchParams.set(g,A)}}catch(e){p=true;b=e}finally{try{if(!m&&k.return!=null){k.return()}}finally{if(p){throw b}}}}if(l){var O=true,_=false,j=undefined,E=true,L=false,T=undefined;try{for(var M=Object.entries(l)[Symbol.iterator](),U;!(E=(U=M.next()).done);E=true){var H=u(U.value,2),R=H[0],W=H[1];if(W)try{for(var q=Object.entries(W)[Symbol.iterator](),z;!(O=(z=q.next()).done);O=true){var F=u(z.value,2),N=F[0],B=F[1];h.searchParams.set("style.".concat(R,".").concat(N),B.toString())}}catch(e){_=true;j=e}finally{try{if(!O&&q.return!=null){q.return()}}finally{if(_){throw j}}}}}catch(e){L=true;T=e}finally{try{if(!E&&M.return!=null){M.return()}}finally{if(L){throw T}}}}var V=true,$=false,D=undefined;if((c===null||c===void 0?void 0:c.email)&&h.searchParams.set("email",c.email),s)try{for(var G=Object.entries(s)[Symbol.iterator](),J;!(V=(J=G.next()).done);V=true){var K=u(J.value,2),Q=K[0],X=K[1];X&&h.searchParams.set("theme.".concat(Q),X)}}catch(e){$=true;D=e}finally{try{if(!V&&G.return!=null){G.return()}}finally{if($){throw D}}}return h.toString()}var p=["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"],b="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";function k(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}if(!e)return;var a=window[e];a===null||a===void 0?void 0:a.apply(void 0,s(r))}function C(e,t){var r;e.addEventListener("checkout:submit",function(t){y(e,t.detail)}),(r=window.wco)===null||r===void 0?void 0:r.frames.set(e,w(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}case"complete":{k(t.dataset.whopCheckoutOnComplete,r.plan_id,r.receipt_id);break}case"state":{k(t.dataset.whopCheckoutOnStateChange,r.state);break}}}))}function S(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})}var g="data-whop-checkout-style-";function A(e){var t={};var r=true,n=false,a=undefined;try{for(var o=e.attributes[Symbol.iterator](),i;!(r=(i=o.next()).done);r=true){var l=i.value;if(l.name.startsWith(g)){var u=l.name.slice(g.length),s=l.value,d=c(u.split("-")),f=d[0],h=d.slice(1);if(f&&h.length>0){var v=h.reduce(function(e,t,r){if(r===0)return t;var n=c(t),a=n[0],o=n.slice(1);return"".concat(e).concat(a.toUpperCase()).concat(o.join(""))},"");var w;(w=t[f])!==null&&w!==void 0?w:t[f]={},t[f][v]=s}}}}catch(e){n=true;a=e}finally{try{if(!r&&o.return!=null){o.return()}}finally{if(n){throw a}}}return t}function P(e){var t={};return e.dataset.whopCheckoutThemeAccentColor&&(t.accentColor=e.dataset.whopCheckoutThemeAccentColor),t}function x(e){var t={};return e.dataset.whopCheckoutPrefillEmail&&(t.email=e.dataset.whopCheckoutPrefillEmail),t}function I(e){var t;var r;if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var a=m(n,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:S(),A(e),x(e),P(e),e.dataset.whopCheckoutHideSubmitButton==="true",e.dataset.whopCheckoutHideTos==="true"),o=document.createElement("iframe");o.src=a,o.style.width="100%",o.style.height="480px",o.style.border="none",o.style.overflow="hidden",(t=o.sandbox).add.apply(t,s(p)),o.allow=b,e.dataset.whopCheckoutMounted="true",e.appendChild(o);var i=e.id;i&&((r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.set(i,o),o.dataset.whopCheckoutIdentifier=i),C(o,e)}if((typeof window==="undefined"?"undefined":d(window))<"u"&&window.wco&&!window.wco.listening){var O=new MutationObserver(function(e){var t=true,r=false,a=undefined;try{for(var o=e[Symbol.iterator](),i;!(t=(i=o.next()).done);t=true){var l=i.value;var c,s,d;var f=true,h=false,v=undefined;try{for(var w=l.addedNodes[Symbol.iterator](),y;!(f=(y=w.next()).done);f=true){var m=y.value;n(m,HTMLElement)&&m.dataset.whopCheckoutPlanId&&I(m)}}catch(e){h=true;v=e}finally{try{if(!f&&w.return!=null){w.return()}}finally{if(h){throw v}}}var p=Array.from(l.removedNodes);var b;var k=true,C=false,S=undefined;try{for(var g=((b=(c=window.wco)===null||c===void 0?void 0:c.frames)!==null&&b!==void 0?b:[])[Symbol.iterator](),A;!(k=(A=g.next()).done);k=true){var P=u(A.value,2),x=P[0],O=P[1];p.includes(x)&&(x.dataset.whopCheckoutIdentifier&&((s=window.wco)===null||s===void 0?void 0:s.identifiedFrames.delete(x.dataset.whopCheckoutIdentifier)),O(),(d=window.wco)===null||d===void 0?void 0:d.frames.delete(x))}}catch(e){C=true;S=e}finally{try{if(!k&&g.return!=null){g.return()}}finally{if(C){throw S}}}}}catch(e){r=true;a=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(r){throw a}}}});var _=true,j=false,E=undefined;try{for(var L=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),T;!(_=(T=L.next()).done);_=true){var M=T.value;n(M,HTMLElement)&&I(M)}}catch(e){j=true;E=e}finally{try{if(!_&&L.return!=null){L.return()}}finally{if(j){throw E}}}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){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function o(e,t,r,n,o,a,i){try{var u=e[a](i);var l=u.value}catch(e){r(e);return}if(u.done){t(l)}else{Promise.resolve(l).then(n,o)}}function a(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var i=e.apply(t,r);function u(e){o(i,n,a,u,l,"next",e)}function l(e){o(i,n,a,u,l,"throw",e)}u(undefined)})}}function i(e,t,r){t=f(t);return k(e,x()?Reflect.construct(t,r||[],f(e).constructor):t.apply(e,r))}function u(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function l(e,t,r){if(x()){l=Reflect.construct}else{l=function e(e,t,r){var n=[null];n.push.apply(n,t);var o=Function.bind.apply(e,n);var a=new o;if(r)O(a,r.prototype);return a}}return l.apply(null,arguments)}function c(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function f(e){f=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return f(e)}function s(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)O(e,t)}function d(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function h(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function p(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function v(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var o=true;var a=false;var i,u;try{for(r=r.call(e);!(o=(i=r.next()).done);o=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){a=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}return n}function w(){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 y(){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 m(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){c(e,t,r[t])})}return e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function g(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{b(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function k(e,t){if(t&&(j(t)==="object"||typeof t==="function")){return t}return n(e)}function O(e,t){O=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return O(e,t)}function P(e,r){return t(e)||v(e,r)||_(e,r)||w()}function S(e){return t(e)||p(e)||_(e)||w()}function C(e){return r(e)||p(e)||_(e)||y()}function j(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function _(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 E(e){var t=typeof Map==="function"?new Map:undefined;E=function e(e){if(e===null||!h(e))return e;if(typeof e!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof t!=="undefined"){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return l(e,arguments,f(this).constructor)}r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});return O(r,e)};return E(e)}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(x=function(){return!!e})()}function A(e,t){var r,n,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=u(0),i["throw"]=u(1),i["return"]=u(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(e){return function(t){return l([e,t])}}function l(u){if(r)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(a=0)),a)try{if(r=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e];n=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}var R=Object.defineProperty;var T=function(e,t,r){return t in e?R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var I=function(e,t,r){return T(e,(typeof t==="undefined"?"undefined":j(t))!="symbol"?t+"":t,r)};var L=/*#__PURE__*/function(e){s(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);I(e,"type","WhopCheckoutError");return e}return t}(E(Error));var W=/*#__PURE__*/function(e){s(t,e);function t(e){u(this,t);var r;r=i(this,t,[e!==null&&e!==void 0?e:"Timeout waiting for embed response"]);I(r,"name","WhopCheckoutRpcTimeoutError");return r}return t}(L);var M=/*#__PURE__*/function(e){s(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);I(e,"name","WhopCheckoutSetEmailError");return e}return t}(L);var U=["resize","center","complete","state","get-email-result","set-email-result"];function F(e){return j(e.data)=="object"&&e.data!==null&&"event"in e.data&&U.includes(e.data.event)}function D(e,t){return F(e)&&e.data.event===t}var H=[];function N(e){return H[e]||(H[e]=(e+256).toString(16).slice(1))}function B(){var e=new Uint8Array(16);if((typeof crypto==="undefined"?"undefined":j(crypto))<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(var t=0;t<16;t++)e[t]=Math.random()*256|0;return e[6]=e[6]&15|64,e[8]=e[8]&63|128,N(e[0])+N(e[1])+N(e[2])+N(e[3])+"-"+N(e[4])+N(e[5])+"-"+N(e[6])+N(e[7])+"-"+N(e[8])+N(e[9])+"-"+N(e[10])+N(e[11])+N(e[12])+N(e[13])+N(e[14])+N(e[15])}function V(e,t,r,n){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:2e3;var a;var i=new URL(e.src).origin,u=B();return(a=e.contentWindow)===null||a===void 0?void 0:a.postMessage(g(m({},t),{__scope:"whop-embedded-checkout",event_id:u}),i),new Promise(function(t,a){var i=setTimeout(function(){a(new W),window.removeEventListener("message",l)},o),l=function(o){if(o.source===e.contentWindow&&D(o,r)&&o.data.event===r&&o.data.event_id===u){clearTimeout(i),window.removeEventListener("message",l);try{t(n(o.data))}catch(e){a(e)}}};window.addEventListener("message",l)})}function q(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 z(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return a(function(){return A(this,function(n){return[2,V(e,{event:"set-email",email:t},"set-email-result",function(e){if(!e.ok)throw new M(e.error)},r)]})})()}function G(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return a(function(){return A(this,function(r){return[2,V(e,{event:"get-email"},"get-email-result",function(e){return e.email},t)]})})()}function $(e,t){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)}function J(e,t,r,n,o,a,i,u,l,c,f,s,d,h){var p=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(p.searchParams.set("h",window.location.origin),t&&p.searchParams.set("theme",t),r&&p.searchParams.set("session",r),o&&p.searchParams.set("hide_price","true"),a&&p.searchParams.set("skip_redirect","true"),f&&p.searchParams.set("hide_submit_button","true"),s&&p.searchParams.set("hide_tos","true"),d&&p.searchParams.set("email.hidden","1"),h&&p.searchParams.set("email.disabled","1"),i){var v=true,w=false,y=undefined,m=true,b=false,g=undefined;try{for(var k=Object.entries(i).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),O;!(m=(O=k.next()).done);m=true){var S=P(O.value,2),C=S[0],j=S[1];if(C.startsWith("utm_"))if(Array.isArray(j))try{for(var _=j[Symbol.iterator](),E;!(v=(E=_.next()).done);v=true){var x=E.value;p.searchParams.append(C,x)}}catch(e){w=true;y=e}finally{try{if(!v&&_.return!=null){_.return()}}finally{if(w){throw y}}}else p.searchParams.set(C,j)}}catch(e){b=true;g=e}finally{try{if(!m&&k.return!=null){k.return()}}finally{if(b){throw g}}}}if(u){var A=true,R=false,T=undefined,I=true,L=false,W=undefined;try{for(var M=Object.entries(u)[Symbol.iterator](),U;!(I=(U=M.next()).done);I=true){var F=P(U.value,2),D=F[0],H=F[1];if(H)try{for(var N=Object.entries(H)[Symbol.iterator](),B;!(A=(B=N.next()).done);A=true){var V=P(B.value,2),q=V[0],z=V[1];p.searchParams.set("style.".concat(D,".").concat(q),z.toString())}}catch(e){R=true;T=e}finally{try{if(!A&&N.return!=null){N.return()}}finally{if(R){throw T}}}}}catch(e){L=true;W=e}finally{try{if(!I&&M.return!=null){M.return()}}finally{if(L){throw W}}}}var G=true,$=false,J=undefined;if((l===null||l===void 0?void 0:l.email)&&p.searchParams.set("email",l.email),c)try{for(var K=Object.entries(c)[Symbol.iterator](),Q;!(G=(Q=K.next()).done);G=true){var X=P(Q.value,2),Y=X[0],Z=X[1];Z&&p.searchParams.set("theme.".concat(Y),Z)}}catch(e){$=true;J=e}finally{try{if(!G&&K.return!=null){K.return()}}finally{if($){throw J}}}return p.toString()}var K=["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"],Q="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";function X(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}if(!e)return;var o=window[e];o===null||o===void 0?void 0:o.apply(void 0,C(r))}function Y(e,t){var r;e.addEventListener("checkout:submit",function(t){$(e,t.detail)}),(r=window.wco)===null||r===void 0?void 0:r.frames.set(e,q(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}case"complete":{X(t.dataset.whopCheckoutOnComplete,r.plan_id,r.receipt_id);break}case"state":{X(t.dataset.whopCheckoutOnStateChange,r.state);break}}}))}function Z(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})}var ee="data-whop-checkout-style-";function et(e){var t={};var r=true,n=false,o=undefined;try{for(var a=e.attributes[Symbol.iterator](),i;!(r=(i=a.next()).done);r=true){var u=i.value;if(u.name.startsWith(ee)){var l=u.name.slice(ee.length),c=u.value,f=S(l.split("-")),s=f[0],d=f.slice(1);if(s&&d.length>0){var h=d.reduce(function(e,t,r){if(r===0)return t;var n=S(t),o=n[0],a=n.slice(1);return"".concat(e).concat(o.toUpperCase()).concat(a.join(""))},"");var p;(p=t[s])!==null&&p!==void 0?p:t[s]={},t[s][h]=c}}}}catch(e){n=true;o=e}finally{try{if(!r&&a.return!=null){a.return()}}finally{if(n){throw o}}}return t}function er(e){var t={};return e.dataset.whopCheckoutThemeAccentColor&&(t.accentColor=e.dataset.whopCheckoutThemeAccentColor),t}function en(e){var t={};return e.dataset.whopCheckoutPrefillEmail&&(t.email=e.dataset.whopCheckoutPrefillEmail),t}function eo(e){var t;var r;if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var o=J(n,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:Z(),et(e),en(e),er(e),e.dataset.whopCheckoutHideSubmitButton==="true",e.dataset.whopCheckoutHideTos==="true",e.dataset.whopCheckoutHideEmail==="true",e.dataset.whopCheckoutDisableEmail==="true"),a=document.createElement("iframe");a.src=o,a.style.width="100%",a.style.height="480px",a.style.border="none",a.style.overflow="hidden",(t=a.sandbox).add.apply(t,C(K)),a.allow=Q,e.dataset.whopCheckoutMounted="true",e.appendChild(a);var i=e.id;i&&((r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.set(i,a),a.dataset.whopCheckoutIdentifier=i),Y(a,e)}if((typeof window==="undefined"?"undefined":j(window))<"u"&&window.wco&&!window.wco.listening){window.wco.getEmail=function(e,t){var r;var n=(r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.get(e);if(!n)throw new Error("Failed to get email for Whop embedded checkout. No embed with identifier ".concat(e," found."));return G(n,t)},window.wco.setEmail=function(e,t,r){var n;var o=(n=window.wco)===null||n===void 0?void 0:n.identifiedFrames.get(e);if(!o)throw new Error("Failed to set email for Whop embedded checkout. No embed with identifier ".concat(e," found."));return z(o,t,r)};var ea=new MutationObserver(function(e){var t=true,r=false,n=undefined;try{for(var o=e[Symbol.iterator](),a;!(t=(a=o.next()).done);t=true){var i=a.value;var u,l,c;var f=true,s=false,h=undefined;try{for(var p=i.addedNodes[Symbol.iterator](),v;!(f=(v=p.next()).done);f=true){var w=v.value;d(w,HTMLElement)&&w.dataset.whopCheckoutPlanId&&eo(w)}}catch(e){s=true;h=e}finally{try{if(!f&&p.return!=null){p.return()}}finally{if(s){throw h}}}var y=Array.from(i.removedNodes);var m;var b=true,g=false,k=undefined;try{for(var O=((m=(u=window.wco)===null||u===void 0?void 0:u.frames)!==null&&m!==void 0?m:[])[Symbol.iterator](),S;!(b=(S=O.next()).done);b=true){var C=P(S.value,2),j=C[0],_=C[1];y.includes(j)&&(j.dataset.whopCheckoutIdentifier&&((l=window.wco)===null||l===void 0?void 0:l.identifiedFrames.delete(j.dataset.whopCheckoutIdentifier)),_(),(c=window.wco)===null||c===void 0?void 0:c.frames.delete(j))}}catch(e){g=true;k=e}finally{try{if(!b&&O.return!=null){O.return()}}finally{if(g){throw k}}}}}catch(e){r=true;n=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(r){throw n}}}});var ei=true,eu=false,el=undefined;try{for(var ec=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),ef;!(ei=(ef=ec.next()).done);ei=true){var es=ef.value;d(es,HTMLElement)&&eo(es)}}catch(e){eu=true;el=e}finally{try{if(!ei&&ec.return!=null){ec.return()}}finally{if(eu){throw el}}}ea.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function o(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var a=true;var o=false;var i,l;try{for(r=r.call(e);!(a=(i=r.next()).done);a=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){o=true;l=e}finally{try{if(!a&&r["return"]!=null)r["return"]()}finally{if(o)throw l}}return n}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,r){return t(e)||o(e,r)||f(e,r)||i()}function c(e){return t(e)||a(e)||f(e)||i()}function s(e){return r(e)||a(e)||f(e)||l()}function d(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function f(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&&y.includes(e.data.event)};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){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)};var a=function e(e,t,r,n,a,o,i,l,c,s,d,f){var h=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(h.searchParams.set("h",window.location.origin),t&&h.searchParams.set("theme",t),r&&h.searchParams.set("session",r),a&&h.searchParams.set("hide_price","true"),o&&h.searchParams.set("skip_redirect","true"),d&&h.searchParams.set("hide_submit_button","true"),f&&h.searchParams.set("hide_tos","true"),i){var v=true,w=false,y=undefined,m=true,p=false,b=undefined;try{for(var k=Object.entries(i).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),C;!(m=(C=k.next()).done);m=true){var S=u(C.value,2),g=S[0],A=S[1];if(g.startsWith("utm_"))if(Array.isArray(A))try{for(var P=A[Symbol.iterator](),x;!(v=(x=P.next()).done);v=true){var I=x.value;h.searchParams.append(g,I)}}catch(e){w=true;y=e}finally{try{if(!v&&P.return!=null){P.return()}}finally{if(w){throw y}}}else h.searchParams.set(g,A)}}catch(e){p=true;b=e}finally{try{if(!m&&k.return!=null){k.return()}}finally{if(p){throw b}}}}if(l){var O=true,_=false,j=undefined,E=true,L=false,T=undefined;try{for(var M=Object.entries(l)[Symbol.iterator](),U;!(E=(U=M.next()).done);E=true){var H=u(U.value,2),R=H[0],W=H[1];if(W)try{for(var q=Object.entries(W)[Symbol.iterator](),z;!(O=(z=q.next()).done);O=true){var F=u(z.value,2),N=F[0],B=F[1];h.searchParams.set("style.".concat(R,".").concat(N),B.toString())}}catch(e){_=true;j=e}finally{try{if(!O&&q.return!=null){q.return()}}finally{if(_){throw j}}}}}catch(e){L=true;T=e}finally{try{if(!E&&M.return!=null){M.return()}}finally{if(L){throw T}}}}var V=true,$=false,D=undefined;if((c===null||c===void 0?void 0:c.email)&&h.searchParams.set("email",c.email),s)try{for(var G=Object.entries(s)[Symbol.iterator](),J;!(V=(J=G.next()).done);V=true){var K=u(J.value,2),Q=K[0],X=K[1];X&&h.searchParams.set("theme.".concat(Q),X)}}catch(e){$=true;D=e}finally{try{if(!V&&G.return!=null){G.return()}}finally{if($){throw D}}}return h.toString()};var o=function e(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}if(!e)return;var a=window[e];a===null||a===void 0?void 0:a.apply(void 0,s(r))};var i=function e(e,n){var a;e.addEventListener("checkout:submit",function(t){r(e,t.detail)}),(a=window.wco)===null||a===void 0?void 0:a.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":{o(n.dataset.whopCheckoutOnComplete,t.plan_id,t.receipt_id);break}case"state":{o(n.dataset.whopCheckoutOnStateChange,t.state);break}}}))};var l=function e(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})};var f=function e(e){var t={};var r=true,n=false,a=undefined;try{for(var o=e.attributes[Symbol.iterator](),i;!(r=(i=o.next()).done);r=true){var l=i.value;if(l.name.startsWith(b)){var u=l.name.slice(b.length),s=l.value,d=c(u.split("-")),f=d[0],h=d.slice(1);if(f&&h.length>0){var v=h.reduce(function(e,t,r){if(r===0)return t;var n=c(t),a=n[0],o=n.slice(1);return"".concat(e).concat(a.toUpperCase()).concat(o.join(""))},"");var w;(w=t[f])!==null&&w!==void 0?w:t[f]={},t[f][v]=s}}}}catch(e){n=true;a=e}finally{try{if(!r&&o.return!=null){o.return()}}finally{if(n){throw a}}}return t};var h=function e(e){var t={};return e.dataset.whopCheckoutThemeAccentColor&&(t.accentColor=e.dataset.whopCheckoutThemeAccentColor),t};var v=function e(e){var t={};return e.dataset.whopCheckoutPrefillEmail&&(t.email=e.dataset.whopCheckoutPrefillEmail),t};var w=function e(e){var t;var r;if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var o=a(n,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:l(),f(e),v(e),h(e),e.dataset.whopCheckoutHideSubmitButton==="true",e.dataset.whopCheckoutHideTos==="true"),u=document.createElement("iframe");u.src=o,u.style.width="100%",u.style.height="480px",u.style.border="none",u.style.overflow="hidden",(t=u.sandbox).add.apply(t,s(m)),u.allow=p,e.dataset.whopCheckoutMounted="true",e.appendChild(u);var c=e.id;c&&((r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.set(c,u),u.dataset.whopCheckoutIdentifier=c),i(u,e)};var y=["resize","center","complete","state"];var m=["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;";var b="data-whop-checkout-style-";if((typeof window==="undefined"?"undefined":d(window))<"u"&&window.wco&&!window.wco.listening){var k=new MutationObserver(function(e){var t=true,r=false,a=undefined;try{for(var o=e[Symbol.iterator](),i;!(t=(i=o.next()).done);t=true){var l=i.value;var c,s,d;var f=true,h=false,v=undefined;try{for(var y=l.addedNodes[Symbol.iterator](),m;!(f=(m=y.next()).done);f=true){var p=m.value;n(p,HTMLElement)&&p.dataset.whopCheckoutPlanId&&w(p)}}catch(e){h=true;v=e}finally{try{if(!f&&y.return!=null){y.return()}}finally{if(h){throw v}}}var b=Array.from(l.removedNodes);var k;var C=true,S=false,g=undefined;try{for(var A=((k=(c=window.wco)===null||c===void 0?void 0:c.frames)!==null&&k!==void 0?k:[])[Symbol.iterator](),P;!(C=(P=A.next()).done);C=true){var x=u(P.value,2),I=x[0],O=x[1];b.includes(I)&&(I.dataset.whopCheckoutIdentifier&&((s=window.wco)===null||s===void 0?void 0:s.identifiedFrames.delete(I.dataset.whopCheckoutIdentifier)),O(),(d=window.wco)===null||d===void 0?void 0:d.frames.delete(I))}}catch(e){S=true;g=e}finally{try{if(!C&&A.return!=null){A.return()}}finally{if(S){throw g}}}}}catch(e){r=true;a=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(r){throw a}}}});var C=true,S=false,g=undefined;try{for(var A=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),P;!(C=(P=A.next()).done);C=true){var x=P.value;n(x,HTMLElement)&&w(x)}}catch(e){S=true;g=e}finally{try{if(!C&&A.return!=null){A.return()}}finally{if(S){throw g}}}k.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){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function o(e,t,r,n,o,a,i){try{var u=e[a](i);var l=u.value}catch(e){r(e);return}if(u.done){t(l)}else{Promise.resolve(l).then(n,o)}}function a(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var i=e.apply(t,r);function u(e){o(i,n,a,u,l,"next",e)}function l(e){o(i,n,a,u,l,"throw",e)}u(undefined)})}}function i(e,t,r){t=f(t);return k(e,x()?Reflect.construct(t,r||[],f(e).constructor):t.apply(e,r))}function u(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function l(e,t,r){if(x()){l=Reflect.construct}else{l=function e(e,t,r){var n=[null];n.push.apply(n,t);var o=Function.bind.apply(e,n);var a=new o;if(r)O(a,r.prototype);return a}}return l.apply(null,arguments)}function c(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function f(e){f=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return f(e)}function s(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)O(e,t)}function d(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function h(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function v(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function p(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var o=true;var a=false;var i,u;try{for(r=r.call(e);!(o=(i=r.next()).done);o=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){a=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}return n}function w(){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 y(){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 m(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){c(e,t,r[t])})}return e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function g(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{b(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function k(e,t){if(t&&(j(t)==="object"||typeof t==="function")){return t}return n(e)}function O(e,t){O=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return O(e,t)}function P(e,r){return t(e)||p(e,r)||_(e,r)||w()}function S(e){return t(e)||v(e)||_(e)||w()}function C(e){return r(e)||v(e)||_(e)||y()}function j(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function _(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 E(e){var t=typeof Map==="function"?new Map:undefined;E=function e(e){if(e===null||!h(e))return e;if(typeof e!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof t!=="undefined"){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return l(e,arguments,f(this).constructor)}r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});return O(r,e)};return E(e)}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(x=function(){return!!e})()}function A(e,t){var r,n,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=u(0),i["throw"]=u(1),i["return"]=u(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(e){return function(t){return l([e,t])}}function l(u){if(r)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(a=0)),a)try{if(r=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e];n=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}(function(){var e=function e(e){return j(e.data)=="object"&&e.data!==null&&"event"in e.data&&M.includes(e.data.event)};var t=function t(t,r){return e(t)&&t.data.event===r};var r=function e(e){return U[e]||(U[e]=(e+256).toString(16).slice(1))};var n=function e(){var e=new Uint8Array(16);if((typeof crypto==="undefined"?"undefined":j(crypto))<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(var t=0;t<16;t++)e[t]=Math.random()*256|0;return e[6]=e[6]&15|64,e[8]=e[8]&63|128,r(e[0])+r(e[1])+r(e[2])+r(e[3])+"-"+r(e[4])+r(e[5])+"-"+r(e[6])+r(e[7])+"-"+r(e[8])+r(e[9])+"-"+r(e[10])+r(e[11])+r(e[12])+r(e[13])+r(e[14])+r(e[15])};var o=function e(e,r,o,a){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:2e3;var u;var l=new URL(e.src).origin,c=n();return(u=e.contentWindow)===null||u===void 0?void 0:u.postMessage(g(m({},r),{__scope:"whop-embedded-checkout",event_id:c}),l),new Promise(function(r,n){var u=setTimeout(function(){n(new L),window.removeEventListener("message",l)},i),l=function(i){if(i.source===e.contentWindow&&t(i,o)&&i.data.event===o&&i.data.event_id===c){clearTimeout(u),window.removeEventListener("message",l);try{r(a(i.data))}catch(e){n(e)}}};window.addEventListener("message",l)})};var l=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 c=function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return a(function(){return A(this,function(n){return[2,o(e,{event:"set-email",email:t},"set-email-result",function(e){if(!e.ok)throw new W(e.error)},r)]})})()};var f=function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return a(function(){return A(this,function(r){return[2,o(e,{event:"get-email"},"get-email-result",function(e){return e.email},t)]})})()};var h=function e(e,t){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)};var v=function e(e,t,r,n,o,a,i,u,l,c,f,s,d,h){var v=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(v.searchParams.set("h",window.location.origin),t&&v.searchParams.set("theme",t),r&&v.searchParams.set("session",r),o&&v.searchParams.set("hide_price","true"),a&&v.searchParams.set("skip_redirect","true"),f&&v.searchParams.set("hide_submit_button","true"),s&&v.searchParams.set("hide_tos","true"),d&&v.searchParams.set("email.hidden","1"),h&&v.searchParams.set("email.disabled","1"),i){var p=true,w=false,y=undefined,m=true,b=false,g=undefined;try{for(var k=Object.entries(i).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),O;!(m=(O=k.next()).done);m=true){var S=P(O.value,2),C=S[0],j=S[1];if(C.startsWith("utm_"))if(Array.isArray(j))try{for(var _=j[Symbol.iterator](),E;!(p=(E=_.next()).done);p=true){var x=E.value;v.searchParams.append(C,x)}}catch(e){w=true;y=e}finally{try{if(!p&&_.return!=null){_.return()}}finally{if(w){throw y}}}else v.searchParams.set(C,j)}}catch(e){b=true;g=e}finally{try{if(!m&&k.return!=null){k.return()}}finally{if(b){throw g}}}}if(u){var A=true,R=false,T=undefined,I=true,L=false,W=undefined;try{for(var M=Object.entries(u)[Symbol.iterator](),U;!(I=(U=M.next()).done);I=true){var F=P(U.value,2),D=F[0],H=F[1];if(H)try{for(var N=Object.entries(H)[Symbol.iterator](),B;!(A=(B=N.next()).done);A=true){var V=P(B.value,2),q=V[0],z=V[1];v.searchParams.set("style.".concat(D,".").concat(q),z.toString())}}catch(e){R=true;T=e}finally{try{if(!A&&N.return!=null){N.return()}}finally{if(R){throw T}}}}}catch(e){L=true;W=e}finally{try{if(!I&&M.return!=null){M.return()}}finally{if(L){throw W}}}}var G=true,$=false,J=undefined;if((l===null||l===void 0?void 0:l.email)&&v.searchParams.set("email",l.email),c)try{for(var K=Object.entries(c)[Symbol.iterator](),Q;!(G=(Q=K.next()).done);G=true){var X=P(Q.value,2),Y=X[0],Z=X[1];Z&&v.searchParams.set("theme.".concat(Y),Z)}}catch(e){$=true;J=e}finally{try{if(!G&&K.return!=null){K.return()}}finally{if($){throw J}}}return v.toString()};var p=function e(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}if(!e)return;var o=window[e];o===null||o===void 0?void 0:o.apply(void 0,C(r))};var w=function e(e,t){var r;e.addEventListener("checkout:submit",function(t){h(e,t.detail)}),(r=window.wco)===null||r===void 0?void 0:r.frames.set(e,l(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}case"complete":{p(t.dataset.whopCheckoutOnComplete,r.plan_id,r.receipt_id);break}case"state":{p(t.dataset.whopCheckoutOnStateChange,r.state);break}}}))};var y=function e(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})};var b=function e(e){var t={};var r=true,n=false,o=undefined;try{for(var a=e.attributes[Symbol.iterator](),i;!(r=(i=a.next()).done);r=true){var u=i.value;if(u.name.startsWith(H)){var l=u.name.slice(H.length),c=u.value,f=S(l.split("-")),s=f[0],d=f.slice(1);if(s&&d.length>0){var h=d.reduce(function(e,t,r){if(r===0)return t;var n=S(t),o=n[0],a=n.slice(1);return"".concat(e).concat(o.toUpperCase()).concat(a.join(""))},"");var v;(v=t[s])!==null&&v!==void 0?v:t[s]={},t[s][h]=c}}}}catch(e){n=true;o=e}finally{try{if(!r&&a.return!=null){a.return()}}finally{if(n){throw o}}}return t};var k=function e(e){var t={};return e.dataset.whopCheckoutThemeAccentColor&&(t.accentColor=e.dataset.whopCheckoutThemeAccentColor),t};var O=function e(e){var t={};return e.dataset.whopCheckoutPrefillEmail&&(t.email=e.dataset.whopCheckoutPrefillEmail),t};var _=function e(e){var t;var r;if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var o=v(n,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:y(),b(e),O(e),k(e),e.dataset.whopCheckoutHideSubmitButton==="true",e.dataset.whopCheckoutHideTos==="true",e.dataset.whopCheckoutHideEmail==="true",e.dataset.whopCheckoutDisableEmail==="true"),a=document.createElement("iframe");a.src=o,a.style.width="100%",a.style.height="480px",a.style.border="none",a.style.overflow="hidden",(t=a.sandbox).add.apply(t,C(F)),a.allow=D,e.dataset.whopCheckoutMounted="true",e.appendChild(a);var i=e.id;i&&((r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.set(i,a),a.dataset.whopCheckoutIdentifier=i),w(a,e)};var x=Object.defineProperty;var R=function(e,t,r){return t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var T=function(e,t,r){return R(e,(typeof t==="undefined"?"undefined":j(t))!="symbol"?t+"":t,r)};var I=/*#__PURE__*/function(e){s(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);T(e,"type","WhopCheckoutError");return e}return t}(E(Error));var L=/*#__PURE__*/function(e){s(t,e);function t(e){u(this,t);var r;r=i(this,t,[e!==null&&e!==void 0?e:"Timeout waiting for embed response"]);T(r,"name","WhopCheckoutRpcTimeoutError");return r}return t}(I);var W=/*#__PURE__*/function(e){s(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);T(e,"name","WhopCheckoutSetEmailError");return e}return t}(I);var M=["resize","center","complete","state","get-email-result","set-email-result"];var U=[];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"],D="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";var H="data-whop-checkout-style-";if((typeof window==="undefined"?"undefined":j(window))<"u"&&window.wco&&!window.wco.listening){window.wco.getEmail=function(e,t){var r;var n=(r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.get(e);if(!n)throw new Error("Failed to get email for Whop embedded checkout. No embed with identifier ".concat(e," found."));return f(n,t)},window.wco.setEmail=function(e,t,r){var n;var o=(n=window.wco)===null||n===void 0?void 0:n.identifiedFrames.get(e);if(!o)throw new Error("Failed to set email for Whop embedded checkout. No embed with identifier ".concat(e," found."));return c(o,t,r)};var N=new MutationObserver(function(e){var t=true,r=false,n=undefined;try{for(var o=e[Symbol.iterator](),a;!(t=(a=o.next()).done);t=true){var i=a.value;var u,l,c;var f=true,s=false,h=undefined;try{for(var v=i.addedNodes[Symbol.iterator](),p;!(f=(p=v.next()).done);f=true){var w=p.value;d(w,HTMLElement)&&w.dataset.whopCheckoutPlanId&&_(w)}}catch(e){s=true;h=e}finally{try{if(!f&&v.return!=null){v.return()}}finally{if(s){throw h}}}var y=Array.from(i.removedNodes);var m;var b=true,g=false,k=undefined;try{for(var O=((m=(u=window.wco)===null||u===void 0?void 0:u.frames)!==null&&m!==void 0?m:[])[Symbol.iterator](),S;!(b=(S=O.next()).done);b=true){var C=P(S.value,2),j=C[0],E=C[1];y.includes(j)&&(j.dataset.whopCheckoutIdentifier&&((l=window.wco)===null||l===void 0?void 0:l.identifiedFrames.delete(j.dataset.whopCheckoutIdentifier)),E(),(c=window.wco)===null||c===void 0?void 0:c.frames.delete(j))}}catch(e){g=true;k=e}finally{try{if(!b&&O.return!=null){O.return()}}finally{if(g){throw k}}}}}catch(e){r=true;n=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(r){throw n}}}});var B=true,V=false,q=undefined;try{for(var z=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),G;!(B=(G=z.next()).done);B=true){var $=G.value;d($,HTMLElement)&&_($)}}catch(e){V=true;q=e}finally{try{if(!B&&z.return!=null){z.return()}}finally{if(V){throw q}}}N.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var o=true;var a=false;var i,u;try{for(r=r.call(e);!(o=(i=r.next()).done);o=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){a=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}return n}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,r){return t(e)||a(e,r)||s(e,r)||i()}function
|
|
1
|
+
function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var o=true;var a=false;var i,u;try{for(r=r.call(e);!(o=(i=r.next()).done);o=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){a=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}return n}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,r){return t(e)||a(e,r)||s(e,r)||i()}function d(e){return t(e)||o(e)||s(e)||i()}function c(e){return r(e)||o(e)||s(e)||u()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function s(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}import{b as h,c as w,d as v,e as y,f as m,g as p,h as b}from"./chunk-N2KVERZN.mjs";function k(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}if(!e)return;var o=window[e];o===null||o===void 0?void 0:o.apply(void 0,c(r))}function C(e,t){var r;e.addEventListener("checkout:submit",function(t){y(e,t.detail)}),(r=window.wco)===null||r===void 0?void 0:r.frames.set(e,h(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}case"complete":{k(t.dataset.whopCheckoutOnComplete,r.plan_id,r.receipt_id);break}case"state":{k(t.dataset.whopCheckoutOnStateChange,r.state);break}}}))}function S(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})}var g="data-whop-checkout-style-";function A(e){var t={};var r=true,n=false,o=undefined;try{for(var a=e.attributes[Symbol.iterator](),i;!(r=(i=a.next()).done);r=true){var u=i.value;if(u.name.startsWith(g)){var l=u.name.slice(g.length),c=u.value,f=d(l.split("-")),s=f[0],h=f.slice(1);if(s&&h.length>0){var w=h.reduce(function(e,t,r){if(r===0)return t;var n=d(t),o=n[0],a=n.slice(1);return"".concat(e).concat(o.toUpperCase()).concat(a.join(""))},"");var v;(v=t[s])!==null&&v!==void 0?v:t[s]={},t[s][w]=c}}}}catch(e){n=true;o=e}finally{try{if(!r&&a.return!=null){a.return()}}finally{if(n){throw o}}}return t}function E(e){var t={};return e.dataset.whopCheckoutThemeAccentColor&&(t.accentColor=e.dataset.whopCheckoutThemeAccentColor),t}function I(e){var t={};return e.dataset.whopCheckoutPrefillEmail&&(t.email=e.dataset.whopCheckoutPrefillEmail),t}function x(e){var t;var r;if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var o=m(n,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:S(),A(e),I(e),E(e),e.dataset.whopCheckoutHideSubmitButton==="true",e.dataset.whopCheckoutHideTos==="true",e.dataset.whopCheckoutHideEmail==="true",e.dataset.whopCheckoutDisableEmail==="true"),a=document.createElement("iframe");a.src=o,a.style.width="100%",a.style.height="480px",a.style.border="none",a.style.overflow="hidden",(t=a.sandbox).add.apply(t,c(p)),a.allow=b,e.dataset.whopCheckoutMounted="true",e.appendChild(a);var i=e.id;i&&((r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.set(i,a),a.dataset.whopCheckoutIdentifier=i),C(a,e)}if((typeof window==="undefined"?"undefined":f(window))<"u"&&window.wco&&!window.wco.listening){window.wco.getEmail=function(e,t){var r;var n=(r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.get(e);if(!n)throw new Error("Failed to get email for Whop embedded checkout. No embed with identifier ".concat(e," found."));return v(n,t)},window.wco.setEmail=function(e,t,r){var n;var o=(n=window.wco)===null||n===void 0?void 0:n.identifiedFrames.get(e);if(!o)throw new Error("Failed to set email for Whop embedded checkout. No embed with identifier ".concat(e," found."));return w(o,t,r)};var T=new MutationObserver(function(e){var t=true,r=false,o=undefined;try{for(var a=e[Symbol.iterator](),i;!(t=(i=a.next()).done);t=true){var u=i.value;var d,c,f;var s=true,h=false,w=undefined;try{for(var v=u.addedNodes[Symbol.iterator](),y;!(s=(y=v.next()).done);s=true){var m=y.value;n(m,HTMLElement)&&m.dataset.whopCheckoutPlanId&&x(m)}}catch(e){h=true;w=e}finally{try{if(!s&&v.return!=null){v.return()}}finally{if(h){throw w}}}var p=Array.from(u.removedNodes);var b;var k=true,C=false,S=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;!(k=(A=g.next()).done);k=true){var E=l(A.value,2),I=E[0],T=E[1];p.includes(I)&&(I.dataset.whopCheckoutIdentifier&&((c=window.wco)===null||c===void 0?void 0:c.identifiedFrames.delete(I.dataset.whopCheckoutIdentifier)),T(),(f=window.wco)===null||f===void 0?void 0:f.frames.delete(I))}}catch(e){C=true;S=e}finally{try{if(!k&&g.return!=null){g.return()}}finally{if(C){throw S}}}}}catch(e){r=true;o=e}finally{try{if(!t&&a.return!=null){a.return()}}finally{if(r){throw o}}}});var O=true,j=false,F=undefined;try{for(var H=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),M;!(O=(M=H.next()).done);O=true){var N=M.value;n(N,HTMLElement)&&x(N)}}catch(e){j=true;F=e}finally{try{if(!O&&H.return!=null){H.return()}}finally{if(j){throw F}}}T.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 n=document.currentScript,i=n===null||n===void 0?void 0:n.src;var
|
|
1
|
+
"use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var n=document.currentScript,i=n===null||n===void 0?void 0:n.src;var t;(typeof window==="undefined"?"undefined":e(window))<"u"&&i&&((t=window.wco)!==null&&t!==void 0?t:window.wco=function(){var e=document.createElement("script");return e.src=i.replace(/loader\.js$/,"index.js"),e.async=!0,e.defer=!0,document.head.appendChild(e),{injected:!0,listening:!1,frames:new Map,identifiedFrames:new Map,submit:function(e,n){var i;var t=(i=window.wco)===null||i===void 0?void 0:i.identifiedFrames.get(e);if(!t)throw new Error("Failed to submit Whop embedded checkout. No embed with identifier ".concat(e," found."));t.dispatchEvent(new CustomEvent("checkout:submit",{detail:n,cancelable:!0,bubbles:!1,composed:!0}))},getEmail:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;throw new Error("Whop Embedded checkout script not initialized")},setEmail:function(e,n){throw new Error("Whop Embedded checkout script not initialized")}}}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}(function(){var n=document.currentScript,i=n===null||n===void 0?void 0:n.src;var
|
|
1
|
+
"use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}(function(){var n=document.currentScript,i=n===null||n===void 0?void 0:n.src;var t;(typeof window==="undefined"?"undefined":e(window))<"u"&&i&&((t=window.wco)!==null&&t!==void 0?t:window.wco=function(){var e=document.createElement("script");return e.src=i.replace(/loader\.js$/,"index.js"),e.async=!0,e.defer=!0,document.head.appendChild(e),{injected:!0,listening:!1,frames:new Map,identifiedFrames:new Map,submit:function(e,n){var i;var t=(i=window.wco)===null||i===void 0?void 0:i.identifiedFrames.get(e);if(!t)throw new Error("Failed to submit Whop embedded checkout. No embed with identifier ".concat(e," found."));t.dispatchEvent(new CustomEvent("checkout:submit",{detail:n,cancelable:!0,bubbles:!1,composed:!0}))},getEmail:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;throw new Error("Whop Embedded checkout script not initialized")},setEmail:function(e,n){throw new Error("Whop Embedded checkout script not initialized")}}}())})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var n=document.currentScript,
|
|
1
|
+
function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var n=document.currentScript,i=n===null||n===void 0?void 0:n.src;var o;(typeof window==="undefined"?"undefined":e(window))<"u"&&i&&((o=window.wco)!==null&&o!==void 0?o:window.wco=function(){var e=document.createElement("script");return e.src=i.replace(/loader\.js$/,"index.js"),e.async=!0,e.defer=!0,document.head.appendChild(e),{injected:!0,listening:!1,frames:new Map,identifiedFrames:new Map,submit:function(e,n){var i;var o=(i=window.wco)===null||i===void 0?void 0:i.identifiedFrames.get(e);if(!o)throw new Error("Failed to submit Whop embedded checkout. No embed with identifier ".concat(e," found."));o.dispatchEvent(new CustomEvent("checkout:submit",{detail:n,cancelable:!0,bubbles:!1,composed:!0}))},getEmail:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;throw new Error("Whop Embedded checkout script not initialized")},setEmail:function(e,n){throw new Error("Whop Embedded checkout script not initialized")}}}());
|
|
@@ -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(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var a=true;var o=false;var i,u;try{for(r=r.call(e);!(a=(i=r.next()).done);a=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){o=true;u=e}finally{try{if(!a&&r["return"]!=null)r["return"]()}finally{if(o)throw u}}return n}function n(){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,a){return t(e)||r(e,a)||i(e,a)||n()}function o(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function i(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)}var u=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var f=function(e,t){for(var r in t)u(e,r,{get:t[r],enumerable:!0})},d=function(e,t,r,n){var a=true,i=false,f=undefined;if(t&&(typeof t==="undefined"?"undefined":o(t))=="object"||typeof t=="function")try{var d=function(){var a=h.value;!c.call(e,a)&&a!==r&&u(e,a,{get:function(){return t[a]},enumerable:!(n=l(t,a))||n.enumerable})};for(var m=s(t)[Symbol.iterator](),h;!(a=(h=m.next()).done);a=true)d()}catch(e){i=true;f=e}finally{try{if(!a&&m.return!=null){m.return()}}finally{if(i){throw f}}}return e};var m=function(e){return d(u({},"__esModule",{value:!0}),e)};var h={};f(h,{EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING:function(){return _},EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST:function(){return E},getEmbeddedCheckoutIframeUrl:function(){return w},isWhopCheckoutMessage:function(){return v},onWhopCheckoutMessage:function(){return p},submitCheckoutFrame:function(){return b}});module.exports=m(h);var y=["resize","center","complete","state"];function v(e){return o(e.data)=="object"&&e.data!==null&&"event"in e.data&&y.includes(e.data.event)}function p(e,t){function r(r){r.source===e.contentWindow&&v(r)&&t(r.data)}return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}}function b(e,t){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)}function w(e,t,r,n,o,i,u,l,s,c,f,d){var m=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(m.searchParams.set("h",window.location.origin),t&&m.searchParams.set("theme",t),r&&m.searchParams.set("session",r),o&&m.searchParams.set("hide_price","true"),i&&m.searchParams.set("skip_redirect","true"),f&&m.searchParams.set("hide_submit_button","true"),d&&m.searchParams.set("hide_tos","true"),u){var h=true,y=false,v=undefined,p=true,b=false,w=undefined;try{for(var E=Object.entries(u).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),_;!(p=(_=E.next()).done);p=true){var g=a(_.value,2),C=g[0],O=g[1];if(C.startsWith("utm_"))if(Array.isArray(O))try{for(var S=O[Symbol.iterator](),D;!(h=(D=S.next()).done);h=true){var M=D.value;m.searchParams.append(C,M)}}catch(e){y=true;v=e}finally{try{if(!h&&S.return!=null){S.return()}}finally{if(y){throw v}}}else m.searchParams.set(C,O)}}catch(e){b=true;w=e}finally{try{if(!p&&E.return!=null){E.return()}}finally{if(b){throw w}}}}if(l){var A=true,k=false,I=undefined,P=true,j=false,L=undefined;try{for(var T=Object.entries(l)[Symbol.iterator](),R;!(P=(R=T.next()).done);P=true){var U=a(R.value,2),W=U[0],x=U[1];if(x)try{for(var B=Object.entries(x)[Symbol.iterator](),F;!(A=(F=B.next()).done);A=true){var N=a(F.value,2),H=N[0],K=N[1];m.searchParams.set("style.".concat(W,".").concat(H),K.toString())}}catch(e){k=true;I=e}finally{try{if(!A&&B.return!=null){B.return()}}finally{if(k){throw I}}}}}catch(e){j=true;L=e}finally{try{if(!P&&T.return!=null){T.return()}}finally{if(j){throw L}}}}var G=true,X=false,q=undefined;if((s===null||s===void 0?void 0:s.email)&&m.searchParams.set("email",s.email),c)try{for(var z=Object.entries(c)[Symbol.iterator](),$;!(G=($=z.next()).done);G=true){var J=a($.value,2),Q=J[0],V=J[1];V&&m.searchParams.set("theme.".concat(Q),V)}}catch(e){X=true;q=e}finally{try{if(!G&&z.return!=null){z.return()}}finally{if(X){throw q}}}return m.toString()}var E=["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"],_="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,submitCheckoutFrame:submitCheckoutFrame});
|
|
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(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function n(e,t,r,n,o,i,u){try{var a=e[i](u);var c=a.value}catch(e){r(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(n,o)}}function o(e){return function(){var t=this,r=arguments;return new Promise(function(o,i){var u=e.apply(t,r);function a(e){n(u,o,i,a,c,"next",e)}function c(e){n(u,o,i,a,c,"throw",e)}a(undefined)})}}function i(e,t,r){t=l(t);return v(e,_()?Reflect.construct(t,r||[],l(e).constructor):t.apply(e,r))}function u(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function a(e,t,r){if(_()){a=Reflect.construct}else{a=function e(e,t,r){var n=[null];n.push.apply(n,t);var o=Function.bind.apply(e,n);var i=new o;if(r)b(i,r.prototype);return i}}return a.apply(null,arguments)}function c(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function l(e){l=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return l(e)}function f(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)b(e,t)}function s(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function p(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 i=false;var u,a;try{for(r=r.call(e);!(o=(u=r.next()).done);o=true){n.push(u.value);if(t&&n.length===t)break}}catch(e){i=true;a=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(i)throw a}}return n}function d(){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 y(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){c(e,t,r[t])})}return e}function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function m(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{h(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function v(e,t){if(t&&(g(t)==="object"||typeof t==="function")){return t}return r(e)}function b(e,t){b=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return b(e,t)}function w(e,r){return t(e)||p(e,r)||O(e,r)||d()}function g(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function O(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 E(e){var t=typeof Map==="function"?new Map:undefined;E=function e(e){if(e===null||!s(e))return e;if(typeof e!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof t!=="undefined"){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return a(e,arguments,l(this).constructor)}r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});return b(r,e)};return E(e)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function P(e,t){var r,n,o,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},u=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return u.next=a(0),u["throw"]=a(1),u["return"]=a(2),typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(e){return function(t){return c([e,t])}}function c(a){if(r)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(i=0)),i)try{if(r=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];n=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var j=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var D=function(e,t,r){return t in e?j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var M=function(e,t){for(var r in t)j(e,r,{get:t[r],enumerable:!0})},R=function(e,t,r,n){var o=true,i=false,u=undefined;if(t&&(typeof t==="undefined"?"undefined":g(t))=="object"||typeof t=="function")try{var a=function(){var o=l.value;!k.call(e,o)&&o!==r&&j(e,o,{get:function(){return t[o]},enumerable:!(n=S(t,o))||n.enumerable})};for(var c=C(t)[Symbol.iterator](),l;!(o=(l=c.next()).done);o=true)a()}catch(e){i=true;u=e}finally{try{if(!o&&c.return!=null){c.return()}}finally{if(i){throw u}}}return e};var A=function(e){return R(j({},"__esModule",{value:!0}),e)};var T=function(e,t,r){return D(e,(typeof t==="undefined"?"undefined":g(t))!="symbol"?t+"":t,r)};var I={};M(I,{EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING:function(){return Q},EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST:function(){return J},getEmail:function(){return q},getEmbeddedCheckoutIframeUrl:function(){return $},isWhopCheckoutMessage:function(){return B},onWhopCheckoutMessage:function(){return X},setEmail:function(){return V},submitCheckoutFrame:function(){return z}});module.exports=A(I);var x=/*#__PURE__*/function(e){f(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);T(e,"type","WhopCheckoutError");return e}return t}(E(Error));var L=/*#__PURE__*/function(e){f(t,e);function t(e){u(this,t);var r;r=i(this,t,[e!==null&&e!==void 0?e:"Timeout waiting for embed response"]);T(r,"name","WhopCheckoutRpcTimeoutError");return r}return t}(x);var U=/*#__PURE__*/function(e){f(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);T(e,"name","WhopCheckoutSetEmailError");return e}return t}(x);var W=["resize","center","complete","state","get-email-result","set-email-result"];function B(e){return g(e.data)=="object"&&e.data!==null&&"event"in e.data&&W.includes(e.data.event)}function F(e,t){return B(e)&&e.data.event===t}var N=[];function H(e){return N[e]||(N[e]=(e+256).toString(16).slice(1))}function K(){var e=new Uint8Array(16);if((typeof crypto==="undefined"?"undefined":g(crypto))<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(var t=0;t<16;t++)e[t]=Math.random()*256|0;return e[6]=e[6]&15|64,e[8]=e[8]&63|128,H(e[0])+H(e[1])+H(e[2])+H(e[3])+"-"+H(e[4])+H(e[5])+"-"+H(e[6])+H(e[7])+"-"+H(e[8])+H(e[9])+"-"+H(e[10])+H(e[11])+H(e[12])+H(e[13])+H(e[14])+H(e[15])}function G(e,t,r,n){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:2e3;var i;var u=new URL(e.src).origin,a=K();return(i=e.contentWindow)===null||i===void 0?void 0:i.postMessage(m(y({},t),{__scope:"whop-embedded-checkout",event_id:a}),u),new Promise(function(t,i){var u=setTimeout(function(){i(new L),window.removeEventListener("message",c)},o),c=function(o){if(o.source===e.contentWindow&&F(o,r)&&o.data.event===r&&o.data.event_id===a){clearTimeout(u),window.removeEventListener("message",c);try{t(n(o.data))}catch(e){i(e)}}};window.addEventListener("message",c)})}function X(e,t){function r(r){r.source===e.contentWindow&&B(r)&&t(r.data)}return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}}function V(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return o(function(){return P(this,function(n){return[2,G(e,{event:"set-email",email:t},"set-email-result",function(e){if(!e.ok)throw new U(e.error)},r)]})})()}function q(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return o(function(){return P(this,function(r){return[2,G(e,{event:"get-email"},"get-email-result",function(e){return e.email},t)]})})()}function z(e,t){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)}function $(e,t,r,n,o,i,u,a,c,l,f,s,p,d){var y=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(y.searchParams.set("h",window.location.origin),t&&y.searchParams.set("theme",t),r&&y.searchParams.set("session",r),o&&y.searchParams.set("hide_price","true"),i&&y.searchParams.set("skip_redirect","true"),f&&y.searchParams.set("hide_submit_button","true"),s&&y.searchParams.set("hide_tos","true"),p&&y.searchParams.set("email.hidden","1"),d&&y.searchParams.set("email.disabled","1"),u){var h=true,m=false,v=undefined,b=true,g=false,O=undefined;try{for(var E=Object.entries(u).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),_;!(b=(_=E.next()).done);b=true){var P=w(_.value,2),j=P[0],S=P[1];if(j.startsWith("utm_"))if(Array.isArray(S))try{for(var C=S[Symbol.iterator](),k;!(h=(k=C.next()).done);h=true){var D=k.value;y.searchParams.append(j,D)}}catch(e){m=true;v=e}finally{try{if(!h&&C.return!=null){C.return()}}finally{if(m){throw v}}}else y.searchParams.set(j,S)}}catch(e){g=true;O=e}finally{try{if(!b&&E.return!=null){E.return()}}finally{if(g){throw O}}}}if(a){var M=true,R=false,A=undefined,T=true,I=false,x=undefined;try{for(var L=Object.entries(a)[Symbol.iterator](),U;!(T=(U=L.next()).done);T=true){var W=w(U.value,2),B=W[0],F=W[1];if(F)try{for(var N=Object.entries(F)[Symbol.iterator](),H;!(M=(H=N.next()).done);M=true){var K=w(H.value,2),G=K[0],X=K[1];y.searchParams.set("style.".concat(B,".").concat(G),X.toString())}}catch(e){R=true;A=e}finally{try{if(!M&&N.return!=null){N.return()}}finally{if(R){throw A}}}}}catch(e){I=true;x=e}finally{try{if(!T&&L.return!=null){L.return()}}finally{if(I){throw x}}}}var V=true,q=false,z=undefined;if((c===null||c===void 0?void 0:c.email)&&y.searchParams.set("email",c.email),l)try{for(var $=Object.entries(l)[Symbol.iterator](),J;!(V=(J=$.next()).done);V=true){var Q=w(J.value,2),Y=Q[0],Z=Q[1];Z&&y.searchParams.set("theme.".concat(Y),Z)}}catch(e){q=true;z=e}finally{try{if(!V&&$.return!=null){$.return()}}finally{if(q){throw z}}}return y.toString()}var J=["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"],Q="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,getEmail:getEmail,getEmbeddedCheckoutIframeUrl:getEmbeddedCheckoutIframeUrl,isWhopCheckoutMessage:isWhopCheckoutMessage,onWhopCheckoutMessage:onWhopCheckoutMessage,setEmail:setEmail,submitCheckoutFrame:submitCheckoutFrame});
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
type WhopCheckoutState = "loading" | "ready" | "disabled";
|
|
2
|
+
type WhopCheckoutMessage = {
|
|
3
|
+
event: "resize";
|
|
4
|
+
height: number;
|
|
5
|
+
} | {
|
|
6
|
+
event: "center";
|
|
7
|
+
} | {
|
|
8
|
+
event: "complete";
|
|
9
|
+
receipt_id?: string;
|
|
10
|
+
plan_id: string;
|
|
11
|
+
} | {
|
|
12
|
+
event: "state";
|
|
13
|
+
state: WhopCheckoutState;
|
|
14
|
+
} | {
|
|
15
|
+
event: "get-email-result";
|
|
16
|
+
email: string;
|
|
17
|
+
event_id: string;
|
|
18
|
+
} | {
|
|
19
|
+
event: "set-email-result";
|
|
20
|
+
ok: true;
|
|
21
|
+
error?: never;
|
|
22
|
+
event_id: string;
|
|
23
|
+
} | {
|
|
24
|
+
event: "set-email-result";
|
|
25
|
+
ok: false;
|
|
26
|
+
error: string;
|
|
27
|
+
event_id: string;
|
|
28
|
+
};
|
|
29
|
+
declare function isWhopCheckoutMessage(event: MessageEvent<unknown>): event is MessageEvent<WhopCheckoutMessage>;
|
|
30
|
+
|
|
1
31
|
declare global {
|
|
2
32
|
interface Window {
|
|
3
33
|
wco?: {
|
|
@@ -11,6 +41,12 @@ declare global {
|
|
|
11
41
|
email?: string;
|
|
12
42
|
},
|
|
13
43
|
) => void;
|
|
44
|
+
getEmail: (identifier: string, timeout?: number) => Promise<string>;
|
|
45
|
+
setEmail: (
|
|
46
|
+
identifier: string,
|
|
47
|
+
email: string,
|
|
48
|
+
timeout?: number,
|
|
49
|
+
) => Promise<void>;
|
|
14
50
|
};
|
|
15
51
|
}
|
|
16
52
|
|
|
@@ -21,22 +57,9 @@ declare global {
|
|
|
21
57
|
|
|
22
58
|
type WhopCheckoutSubmitDetails = Record<never, never>;
|
|
23
59
|
|
|
24
|
-
type WhopCheckoutState = "loading" | "ready" | "disabled";
|
|
25
|
-
type WhopCheckoutMessage = {
|
|
26
|
-
event: "resize";
|
|
27
|
-
height: number;
|
|
28
|
-
} | {
|
|
29
|
-
event: "center";
|
|
30
|
-
} | {
|
|
31
|
-
event: "complete";
|
|
32
|
-
receipt_id?: string;
|
|
33
|
-
plan_id: string;
|
|
34
|
-
} | {
|
|
35
|
-
event: "state";
|
|
36
|
-
state: WhopCheckoutState;
|
|
37
|
-
};
|
|
38
|
-
declare function isWhopCheckoutMessage(event: MessageEvent<unknown>): event is MessageEvent<WhopCheckoutMessage>;
|
|
39
60
|
declare function onWhopCheckoutMessage(iframe: HTMLIFrameElement, callback: (message: WhopCheckoutMessage) => void): () => void;
|
|
61
|
+
declare function setEmail(frame: HTMLIFrameElement, email: string, timeout?: number): Promise<void>;
|
|
62
|
+
declare function getEmail(frame: HTMLIFrameElement, timeout?: number): Promise<string>;
|
|
40
63
|
declare function submitCheckoutFrame(frame: HTMLIFrameElement, _data?: WhopCheckoutSubmitDetails): void;
|
|
41
64
|
|
|
42
65
|
interface WhopEmbeddedCheckoutStyleOptions {
|
|
@@ -52,8 +75,8 @@ interface WhopEmbeddedCheckoutPrefillOptions {
|
|
|
52
75
|
interface WhopEmbeddedCheckoutThemeOptions {
|
|
53
76
|
accentColor?: string;
|
|
54
77
|
}
|
|
55
|
-
declare function getEmbeddedCheckoutIframeUrl(planId: string, theme?: "light" | "dark" | "system", sessionId?: string, origin?: string, hidePrice?: boolean, skipRedirect?: boolean, utm?: Record<string, string | string[]>, styles?: WhopEmbeddedCheckoutStyleOptions, prefill?: WhopEmbeddedCheckoutPrefillOptions, themeOptions?: WhopEmbeddedCheckoutThemeOptions, hideSubmitButton?: boolean, hideTermsAndConditions?: boolean): string;
|
|
78
|
+
declare function getEmbeddedCheckoutIframeUrl(planId: string, theme?: "light" | "dark" | "system", sessionId?: string, origin?: string, hidePrice?: boolean, skipRedirect?: boolean, utm?: Record<string, string | string[]>, styles?: WhopEmbeddedCheckoutStyleOptions, prefill?: WhopEmbeddedCheckoutPrefillOptions, themeOptions?: WhopEmbeddedCheckoutThemeOptions, hideSubmitButton?: boolean, hideTermsAndConditions?: boolean, hideEmail?: boolean, disableEmail?: boolean): string;
|
|
56
79
|
declare const EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST: string[];
|
|
57
80
|
declare const EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING = "document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";
|
|
58
81
|
|
|
59
|
-
export { EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING, EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST, type WhopCheckoutMessage, type WhopCheckoutState, type WhopCheckoutSubmitDetails, type WhopEmbeddedCheckoutPrefillOptions, type WhopEmbeddedCheckoutStyleOptions, type WhopEmbeddedCheckoutThemeOptions, getEmbeddedCheckoutIframeUrl, isWhopCheckoutMessage, onWhopCheckoutMessage, submitCheckoutFrame };
|
|
82
|
+
export { EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING, EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST, type WhopCheckoutMessage, type WhopCheckoutState, type WhopCheckoutSubmitDetails, type WhopEmbeddedCheckoutPrefillOptions, type WhopEmbeddedCheckoutStyleOptions, type WhopEmbeddedCheckoutThemeOptions, getEmail, getEmbeddedCheckoutIframeUrl, isWhopCheckoutMessage, onWhopCheckoutMessage, setEmail, submitCheckoutFrame };
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
type WhopCheckoutState = "loading" | "ready" | "disabled";
|
|
2
|
+
type WhopCheckoutMessage = {
|
|
3
|
+
event: "resize";
|
|
4
|
+
height: number;
|
|
5
|
+
} | {
|
|
6
|
+
event: "center";
|
|
7
|
+
} | {
|
|
8
|
+
event: "complete";
|
|
9
|
+
receipt_id?: string;
|
|
10
|
+
plan_id: string;
|
|
11
|
+
} | {
|
|
12
|
+
event: "state";
|
|
13
|
+
state: WhopCheckoutState;
|
|
14
|
+
} | {
|
|
15
|
+
event: "get-email-result";
|
|
16
|
+
email: string;
|
|
17
|
+
event_id: string;
|
|
18
|
+
} | {
|
|
19
|
+
event: "set-email-result";
|
|
20
|
+
ok: true;
|
|
21
|
+
error?: never;
|
|
22
|
+
event_id: string;
|
|
23
|
+
} | {
|
|
24
|
+
event: "set-email-result";
|
|
25
|
+
ok: false;
|
|
26
|
+
error: string;
|
|
27
|
+
event_id: string;
|
|
28
|
+
};
|
|
29
|
+
declare function isWhopCheckoutMessage(event: MessageEvent<unknown>): event is MessageEvent<WhopCheckoutMessage>;
|
|
30
|
+
|
|
1
31
|
declare global {
|
|
2
32
|
interface Window {
|
|
3
33
|
wco?: {
|
|
@@ -11,6 +41,12 @@ declare global {
|
|
|
11
41
|
email?: string;
|
|
12
42
|
},
|
|
13
43
|
) => void;
|
|
44
|
+
getEmail: (identifier: string, timeout?: number) => Promise<string>;
|
|
45
|
+
setEmail: (
|
|
46
|
+
identifier: string,
|
|
47
|
+
email: string,
|
|
48
|
+
timeout?: number,
|
|
49
|
+
) => Promise<void>;
|
|
14
50
|
};
|
|
15
51
|
}
|
|
16
52
|
|
|
@@ -21,22 +57,9 @@ declare global {
|
|
|
21
57
|
|
|
22
58
|
type WhopCheckoutSubmitDetails = Record<never, never>;
|
|
23
59
|
|
|
24
|
-
type WhopCheckoutState = "loading" | "ready" | "disabled";
|
|
25
|
-
type WhopCheckoutMessage = {
|
|
26
|
-
event: "resize";
|
|
27
|
-
height: number;
|
|
28
|
-
} | {
|
|
29
|
-
event: "center";
|
|
30
|
-
} | {
|
|
31
|
-
event: "complete";
|
|
32
|
-
receipt_id?: string;
|
|
33
|
-
plan_id: string;
|
|
34
|
-
} | {
|
|
35
|
-
event: "state";
|
|
36
|
-
state: WhopCheckoutState;
|
|
37
|
-
};
|
|
38
|
-
declare function isWhopCheckoutMessage(event: MessageEvent<unknown>): event is MessageEvent<WhopCheckoutMessage>;
|
|
39
60
|
declare function onWhopCheckoutMessage(iframe: HTMLIFrameElement, callback: (message: WhopCheckoutMessage) => void): () => void;
|
|
61
|
+
declare function setEmail(frame: HTMLIFrameElement, email: string, timeout?: number): Promise<void>;
|
|
62
|
+
declare function getEmail(frame: HTMLIFrameElement, timeout?: number): Promise<string>;
|
|
40
63
|
declare function submitCheckoutFrame(frame: HTMLIFrameElement, _data?: WhopCheckoutSubmitDetails): void;
|
|
41
64
|
|
|
42
65
|
interface WhopEmbeddedCheckoutStyleOptions {
|
|
@@ -52,8 +75,8 @@ interface WhopEmbeddedCheckoutPrefillOptions {
|
|
|
52
75
|
interface WhopEmbeddedCheckoutThemeOptions {
|
|
53
76
|
accentColor?: string;
|
|
54
77
|
}
|
|
55
|
-
declare function getEmbeddedCheckoutIframeUrl(planId: string, theme?: "light" | "dark" | "system", sessionId?: string, origin?: string, hidePrice?: boolean, skipRedirect?: boolean, utm?: Record<string, string | string[]>, styles?: WhopEmbeddedCheckoutStyleOptions, prefill?: WhopEmbeddedCheckoutPrefillOptions, themeOptions?: WhopEmbeddedCheckoutThemeOptions, hideSubmitButton?: boolean, hideTermsAndConditions?: boolean): string;
|
|
78
|
+
declare function getEmbeddedCheckoutIframeUrl(planId: string, theme?: "light" | "dark" | "system", sessionId?: string, origin?: string, hidePrice?: boolean, skipRedirect?: boolean, utm?: Record<string, string | string[]>, styles?: WhopEmbeddedCheckoutStyleOptions, prefill?: WhopEmbeddedCheckoutPrefillOptions, themeOptions?: WhopEmbeddedCheckoutThemeOptions, hideSubmitButton?: boolean, hideTermsAndConditions?: boolean, hideEmail?: boolean, disableEmail?: boolean): string;
|
|
56
79
|
declare const EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST: string[];
|
|
57
80
|
declare const EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING = "document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";
|
|
58
81
|
|
|
59
|
-
export { EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING, EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST, type WhopCheckoutMessage, type WhopCheckoutState, type WhopCheckoutSubmitDetails, type WhopEmbeddedCheckoutPrefillOptions, type WhopEmbeddedCheckoutStyleOptions, type WhopEmbeddedCheckoutThemeOptions, getEmbeddedCheckoutIframeUrl, isWhopCheckoutMessage, onWhopCheckoutMessage, submitCheckoutFrame };
|
|
82
|
+
export { EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING, EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST, type WhopCheckoutMessage, type WhopCheckoutState, type WhopCheckoutSubmitDetails, type WhopEmbeddedCheckoutPrefillOptions, type WhopEmbeddedCheckoutStyleOptions, type WhopEmbeddedCheckoutThemeOptions, getEmail, getEmbeddedCheckoutIframeUrl, isWhopCheckoutMessage, onWhopCheckoutMessage, setEmail, submitCheckoutFrame };
|
|
@@ -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(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var a=true;var o=false;var i,l;try{for(r=r.call(e);!(a=(i=r.next()).done);a=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){o=true;l=e}finally{try{if(!a&&r["return"]!=null)r["return"]()}finally{if(o)throw l}}return n}function n(){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,a){return t(e)||r(e,a)||i(e,a)||n()}function o(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function i(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 o(e.data)=="object"&&e.data!==null&&"event"in e.data&&i.includes(e.data.event)};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){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)};var n=function e(e,t,r,n,o,i,l,u,s,c,f,d){var y=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(y.searchParams.set("h",window.location.origin),t&&y.searchParams.set("theme",t),r&&y.searchParams.set("session",r),o&&y.searchParams.set("hide_price","true"),i&&y.searchParams.set("skip_redirect","true"),f&&y.searchParams.set("hide_submit_button","true"),d&&y.searchParams.set("hide_tos","true"),l){var m=true,v=false,h=undefined,w=true,p=false,b=undefined;try{for(var g=Object.entries(l).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),S;!(w=(S=g.next()).done);w=true){var P=a(S.value,2),j=P[0],x=P[1];if(j.startsWith("utm_"))if(Array.isArray(x))try{for(var A=x[Symbol.iterator](),_;!(m=(_=A.next()).done);m=true){var k=_.value;y.searchParams.append(j,k)}}catch(e){v=true;h=e}finally{try{if(!m&&A.return!=null){A.return()}}finally{if(v){throw h}}}else y.searchParams.set(j,x)}}catch(e){p=true;b=e}finally{try{if(!w&&g.return!=null){g.return()}}finally{if(p){throw b}}}}if(u){var O=true,L=false,E=undefined,I=true,R=false,U=undefined;try{for(var W=Object.entries(u)[Symbol.iterator](),C;!(I=(C=W.next()).done);I=true){var M=a(C.value,2),q=M[0],z=M[1];if(z)try{for(var T=Object.entries(z)[Symbol.iterator](),$;!(O=($=T.next()).done);O=true){var B=a($.value,2),D=B[0],F=B[1];y.searchParams.set("style.".concat(q,".").concat(D),F.toString())}}catch(e){L=true;E=e}finally{try{if(!O&&T.return!=null){T.return()}}finally{if(L){throw E}}}}}catch(e){R=true;U=e}finally{try{if(!I&&W.return!=null){W.return()}}finally{if(R){throw U}}}}var G=true,H=false,J=undefined;if((s===null||s===void 0?void 0:s.email)&&y.searchParams.set("email",s.email),c)try{for(var K=Object.entries(c)[Symbol.iterator](),N;!(G=(N=K.next()).done);G=true){var Q=a(N.value,2),V=Q[0],X=Q[1];X&&y.searchParams.set("theme.".concat(V),X)}}catch(e){H=true;J=e}finally{try{if(!G&&K.return!=null){K.return()}}finally{if(H){throw J}}}return y.toString()};var i=["resize","center","complete","state"];var l=["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"],u="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;"})();
|
|
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(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function n(e,t,r,n,o,i,a){try{var u=e[i](a);var c=u.value}catch(e){r(e);return}if(u.done){t(c)}else{Promise.resolve(c).then(n,o)}}function o(e){return function(){var t=this,r=arguments;return new Promise(function(o,i){var a=e.apply(t,r);function u(e){n(a,o,i,u,c,"next",e)}function c(e){n(a,o,i,u,c,"throw",e)}u(undefined)})}}function i(e,t,r){t=l(t);return m(e,j()?Reflect.construct(t,r||[],l(e).constructor):t.apply(e,r))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function u(e,t,r){if(j()){u=Reflect.construct}else{u=function e(e,t,r){var n=[null];n.push.apply(n,t);var o=Function.bind.apply(e,n);var i=new o;if(r)b(i,r.prototype);return i}}return u.apply(null,arguments)}function c(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function l(e){l=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return l(e)}function f(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)b(e,t)}function s(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function p(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 i=false;var a,u;try{for(r=r.call(e);!(o=(a=r.next()).done);o=true){n.push(a.value);if(t&&n.length===t)break}}catch(e){i=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(i)throw u}}return n}function y(){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 d(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){c(e,t,r[t])})}return e}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function h(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{v(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function m(e,t){if(t&&(g(t)==="object"||typeof t==="function")){return t}return r(e)}function b(e,t){b=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return b(e,t)}function w(e,r){return t(e)||p(e,r)||O(e,r)||y()}function g(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function O(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 P(e){var t=typeof Map==="function"?new Map:undefined;P=function e(e){if(e===null||!s(e))return e;if(typeof e!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof t!=="undefined"){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,l(this).constructor)}r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});return b(r,e)};return P(e)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function _(e,t){var r,n,o,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=u(0),a["throw"]=u(1),a["return"]=u(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(t){return c([e,t])}}function c(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(i=0)),i)try{if(r=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:i.label++;return{value:u[1],done:false};case 5:i.label++;n=u[1];u=[0];continue;case 7:u=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){i=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(u[0]===6&&i.label<o[1]){i.label=o[1];o=u;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(u);break}if(o[2])i.ops.pop();i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e];n=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}(function(){var e=function e(e){return g(e.data)=="object"&&e.data!==null&&"event"in e.data&&E.includes(e.data.event)};var t=function t(t,r){return e(t)&&t.data.event===r};var r=function e(e){return k[e]||(k[e]=(e+256).toString(16).slice(1))};var n=function e(){var e=new Uint8Array(16);if((typeof crypto==="undefined"?"undefined":g(crypto))<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(var t=0;t<16;t++)e[t]=Math.random()*256|0;return e[6]=e[6]&15|64,e[8]=e[8]&63|128,r(e[0])+r(e[1])+r(e[2])+r(e[3])+"-"+r(e[4])+r(e[5])+"-"+r(e[6])+r(e[7])+"-"+r(e[8])+r(e[9])+"-"+r(e[10])+r(e[11])+r(e[12])+r(e[13])+r(e[14])+r(e[15])};var u=function e(e,r,o,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:2e3;var u;var c=new URL(e.src).origin,l=n();return(u=e.contentWindow)===null||u===void 0?void 0:u.postMessage(h(d({},r),{__scope:"whop-embedded-checkout",event_id:l}),c),new Promise(function(r,n){var u=setTimeout(function(){n(new j),window.removeEventListener("message",c)},a),c=function(a){if(a.source===e.contentWindow&&t(a,o)&&a.data.event===o&&a.data.event_id===l){clearTimeout(u),window.removeEventListener("message",c);try{r(i(a.data))}catch(e){n(e)}}};window.addEventListener("message",c)})};var c=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 l=function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return o(function(){return _(this,function(n){return[2,u(e,{event:"set-email",email:t},"set-email-result",function(e){if(!e.ok)throw new S(e.error)},r)]})})()};var s=function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return o(function(){return _(this,function(r){return[2,u(e,{event:"get-email"},"get-email-result",function(e){return e.email},t)]})})()};var p=function e(e,t){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)};var y=function e(e,t,r,n,o,i,a,u,c,l,f,s,p,y){var d=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(d.searchParams.set("h",window.location.origin),t&&d.searchParams.set("theme",t),r&&d.searchParams.set("session",r),o&&d.searchParams.set("hide_price","true"),i&&d.searchParams.set("skip_redirect","true"),f&&d.searchParams.set("hide_submit_button","true"),s&&d.searchParams.set("hide_tos","true"),p&&d.searchParams.set("email.hidden","1"),y&&d.searchParams.set("email.disabled","1"),a){var v=true,h=false,m=undefined,b=true,g=false,O=undefined;try{for(var P=Object.entries(a).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),j;!(b=(j=P.next()).done);b=true){var _=w(j.value,2),S=_[0],E=_[1];if(S.startsWith("utm_"))if(Array.isArray(E))try{for(var k=E[Symbol.iterator](),x;!(v=(x=k.next()).done);v=true){var R=x.value;d.searchParams.append(S,R)}}catch(e){h=true;m=e}finally{try{if(!v&&k.return!=null){k.return()}}finally{if(h){throw m}}}else d.searchParams.set(S,E)}}catch(e){g=true;O=e}finally{try{if(!b&&P.return!=null){P.return()}}finally{if(g){throw O}}}}if(u){var A=true,T=false,L=undefined,U=true,W=false,C=undefined;try{for(var M=Object.entries(u)[Symbol.iterator](),D;!(U=(D=M.next()).done);U=true){var I=w(D.value,2),B=I[0],F=I[1];if(F)try{for(var V=Object.entries(F)[Symbol.iterator](),q;!(A=(q=V.next()).done);A=true){var z=w(q.value,2),G=z[0],$=z[1];d.searchParams.set("style.".concat(B,".").concat(G),$.toString())}}catch(e){T=true;L=e}finally{try{if(!A&&V.return!=null){V.return()}}finally{if(T){throw L}}}}}catch(e){W=true;C=e}finally{try{if(!U&&M.return!=null){M.return()}}finally{if(W){throw C}}}}var H=true,J=false,K=undefined;if((c===null||c===void 0?void 0:c.email)&&d.searchParams.set("email",c.email),l)try{for(var N=Object.entries(l)[Symbol.iterator](),Q;!(H=(Q=N.next()).done);H=true){var X=w(Q.value,2),Y=X[0],Z=X[1];Z&&d.searchParams.set("theme.".concat(Y),Z)}}catch(e){J=true;K=e}finally{try{if(!H&&N.return!=null){N.return()}}finally{if(J){throw K}}}return d.toString()};var v=Object.defineProperty;var m=function(e,t,r){return t in e?v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var b=function(e,t,r){return m(e,(typeof t==="undefined"?"undefined":g(t))!="symbol"?t+"":t,r)};var O=/*#__PURE__*/function(e){f(t,e);function t(){a(this,t);var e;e=i(this,t,arguments);b(e,"type","WhopCheckoutError");return e}return t}(P(Error));var j=/*#__PURE__*/function(e){f(t,e);function t(e){a(this,t);var r;r=i(this,t,[e!==null&&e!==void 0?e:"Timeout waiting for embed response"]);b(r,"name","WhopCheckoutRpcTimeoutError");return r}return t}(O);var S=/*#__PURE__*/function(e){f(t,e);function t(){a(this,t);var e;e=i(this,t,arguments);b(e,"name","WhopCheckoutSetEmailError");return e}return t}(O);var E=["resize","center","complete","state","get-email-result","set-email-result"];var k=[];var x=["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
|
|
1
|
+
import{a as e,b as s,c as a,d as E,e as o,f as t,g as m,h}from"./chunk-N2KVERZN.mjs";export{h as EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING,m as EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST,E as getEmail,t as getEmbeddedCheckoutIframeUrl,e as isWhopCheckoutMessage,s as onWhopCheckoutMessage,a as setEmail,o as submitCheckoutFrame};
|
package/package.json
CHANGED
|
@@ -1 +0,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(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var a=true;var o=false;var i,l;try{for(r=r.call(e);!(a=(i=r.next()).done);a=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){o=true;l=e}finally{try{if(!a&&r["return"]!=null)r["return"]()}finally{if(o)throw l}}return n}function n(){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,a){return t(e)||r(e,a)||i(e,a)||n()}function o(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function i(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)}var l=["resize","center","complete","state"];function u(e){return o(e.data)=="object"&&e.data!==null&&"event"in e.data&&l.includes(e.data.event)}function s(e,t){function r(r){r.source===e.contentWindow&&u(r)&&t(r.data)}return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}}function c(e,t){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)}function f(e,t,r,n,o,i,l,u,s,c,f,d){var y=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(y.searchParams.set("h",window.location.origin),t&&y.searchParams.set("theme",t),r&&y.searchParams.set("session",r),o&&y.searchParams.set("hide_price","true"),i&&y.searchParams.set("skip_redirect","true"),f&&y.searchParams.set("hide_submit_button","true"),d&&y.searchParams.set("hide_tos","true"),l){var m=true,v=false,h=undefined,w=true,p=false,b=undefined;try{for(var g=Object.entries(l).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),S;!(w=(S=g.next()).done);w=true){var P=a(S.value,2),x=P[0],_=P[1];if(x.startsWith("utm_"))if(Array.isArray(_))try{for(var j=_[Symbol.iterator](),A;!(m=(A=j.next()).done);m=true){var k=A.value;y.searchParams.append(x,k)}}catch(e){v=true;h=e}finally{try{if(!m&&j.return!=null){j.return()}}finally{if(v){throw h}}}else y.searchParams.set(x,_)}}catch(e){p=true;b=e}finally{try{if(!w&&g.return!=null){g.return()}}finally{if(p){throw b}}}}if(u){var O=true,L=false,W=undefined,E=true,I=false,R=undefined;try{for(var U=Object.entries(u)[Symbol.iterator](),C;!(E=(C=U.next()).done);E=true){var M=a(C.value,2),q=M[0],z=M[1];if(z)try{for(var T=Object.entries(z)[Symbol.iterator](),$;!(O=($=T.next()).done);O=true){var B=a($.value,2),D=B[0],F=B[1];y.searchParams.set("style.".concat(q,".").concat(D),F.toString())}}catch(e){L=true;W=e}finally{try{if(!O&&T.return!=null){T.return()}}finally{if(L){throw W}}}}}catch(e){I=true;R=e}finally{try{if(!E&&U.return!=null){U.return()}}finally{if(I){throw R}}}}var G=true,H=false,J=undefined;if((s===null||s===void 0?void 0:s.email)&&y.searchParams.set("email",s.email),c)try{for(var K=Object.entries(c)[Symbol.iterator](),N;!(G=(N=K.next()).done);G=true){var Q=a(N.value,2),V=Q[0],X=Q[1];X&&y.searchParams.set("theme.".concat(V),X)}}catch(e){H=true;J=e}finally{try{if(!G&&K.return!=null){K.return()}}finally{if(H){throw J}}}return y.toString()}var d=["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"],y="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";export{u as a,s as b,c as c,f as d,d as e,y as f};
|