@whop/checkout 0.0.36 → 0.0.38
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 +151 -5
- 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/react/index.cjs +1 -0
- package/dist/static/checkout/react/index.d.mts +140 -0
- package/dist/static/checkout/react/index.d.ts +140 -0
- package/dist/static/checkout/react/index.js +1 -0
- package/dist/static/checkout/react/index.mjs +1 -0
- 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 +19 -3
- package/dist/static/checkout/chunk-EAN646K5.mjs +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Embedded checkout allows you to embed Whop's checkout flow on your own website in two easy steps. This allows you to offer your users a seamless checkout experience without leaving your website.
|
|
4
4
|
|
|
5
|
-
React users
|
|
5
|
+
**For React users**: This package now includes React components! Use `@whop/checkout/react` for React integration. Alternatively, you can still use the standalone `@whop/react` package which provides additional React-specific features.
|
|
6
6
|
|
|
7
7
|
## Step 1: Add the script tag
|
|
8
8
|
|
|
@@ -28,23 +28,142 @@ This will now mount an iframe inside of the element with the plan id you provide
|
|
|
28
28
|
|
|
29
29
|
You can configure the redirect url in your [whop's settings](https://whop.com/dashboard/whops/) or in your [company's settings](https://whop.com/dashboard/settings/checkout/) on the dashboard. If both are specified, the redirect url specified in the whop's settings will take precedence.
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## React Integration
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
For React applications, you can use the React component instead of the script-based approach:
|
|
34
|
+
|
|
35
|
+
### Installation and Setup
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @whop/checkout
|
|
39
|
+
# or
|
|
40
|
+
pnpm add @whop/checkout
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Basic Usage
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { WhopCheckoutEmbed } from "@whop/checkout/react";
|
|
47
|
+
|
|
48
|
+
export default function CheckoutPage() {
|
|
49
|
+
return (
|
|
50
|
+
<WhopCheckoutEmbed
|
|
51
|
+
planId="plan_XXXXXXXXX"
|
|
52
|
+
onComplete={(planId, receiptId) => {
|
|
53
|
+
console.log("Checkout completed!", { planId, receiptId });
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Advanced Usage with Controls
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { WhopCheckoutEmbed, useCheckoutEmbedControls } from "@whop/checkout/react";
|
|
64
|
+
|
|
65
|
+
export default function CheckoutPage() {
|
|
66
|
+
const checkoutRef = useCheckoutEmbedControls();
|
|
67
|
+
|
|
68
|
+
const handleSubmit = () => {
|
|
69
|
+
checkoutRef.current?.submit();
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const handleGetEmail = async () => {
|
|
73
|
+
try {
|
|
74
|
+
const email = await checkoutRef.current?.getEmail();
|
|
75
|
+
console.log("Current email:", email);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error("Failed to get email:", error);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<div>
|
|
83
|
+
<WhopCheckoutEmbed
|
|
84
|
+
ref={checkoutRef}
|
|
85
|
+
planId="plan_XXXXXXXXX"
|
|
86
|
+
theme="dark"
|
|
87
|
+
onComplete={(planId, receiptId) => {
|
|
88
|
+
console.log("Checkout completed!", { planId, receiptId });
|
|
89
|
+
}}
|
|
90
|
+
onStateChange={(state) => {
|
|
91
|
+
console.log("Checkout state changed:", state);
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
<button onClick={handleSubmit}>Submit Checkout</button>
|
|
95
|
+
<button onClick={handleGetEmail}>Get Email</button>
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### React Component Props
|
|
102
|
+
|
|
103
|
+
The `WhopCheckoutEmbed` component accepts the following props:
|
|
104
|
+
|
|
105
|
+
- `planId` (required): The plan ID you want to checkout
|
|
106
|
+
- `theme`: Theme preference (`"light"`, `"dark"`, or `"system"`)
|
|
107
|
+
- `sessionId`: Session ID for attaching metadata
|
|
108
|
+
- `hidePrice`: Hide the price in the checkout form
|
|
109
|
+
- `skipRedirect`: Skip the final redirect after completion
|
|
110
|
+
- `onComplete`: Callback when checkout is complete
|
|
111
|
+
- `onStateChange`: Callback when checkout state changes
|
|
112
|
+
- `utm`: UTM parameters for tracking
|
|
113
|
+
- `styles`: Custom styles for the embed
|
|
114
|
+
- `prefill`: Prefill options (e.g., email)
|
|
115
|
+
- `themeOptions`: Theme customization options
|
|
116
|
+
- `hideSubmitButton`: Hide the submit button
|
|
117
|
+
- `hideTermsAndConditions`: Hide terms and conditions
|
|
118
|
+
- `hideEmail`: Hide the email input
|
|
119
|
+
- `disableEmail`: Disable the email input
|
|
120
|
+
- `fallback`: Fallback content while loading
|
|
121
|
+
|
|
122
|
+
### React Version Compatibility
|
|
123
|
+
|
|
124
|
+
This package is compatible with React 18+ and React 19. It uses:
|
|
125
|
+
|
|
126
|
+
- Modern React 18+ type definitions for better type safety
|
|
127
|
+
- React hooks and modern patterns
|
|
128
|
+
- Server-side rendering safe patterns
|
|
129
|
+
- forwardRef for proper ref handling
|
|
130
|
+
|
|
131
|
+
### TypeScript Support
|
|
132
|
+
|
|
133
|
+
Full TypeScript support is included with proper type definitions for all components and hooks.
|
|
134
|
+
|
|
135
|
+
## Available methods
|
|
34
136
|
|
|
35
|
-
To submit checkout programmatically, you can use the `submit` method on the checkout element.
|
|
36
137
|
First, attach an `id` to the checkout container:
|
|
37
138
|
|
|
38
139
|
```md
|
|
39
140
|
<div id="whop-embedded-checkout" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
40
141
|
```
|
|
41
142
|
|
|
42
|
-
|
|
143
|
+
### **`submit`**
|
|
144
|
+
|
|
145
|
+
To submit checkout programmatically, you can use the `submit` method on the checkout element.
|
|
43
146
|
|
|
44
147
|
```js
|
|
45
148
|
wco.submit("whop-embedded-checkout");
|
|
46
149
|
```
|
|
47
150
|
|
|
151
|
+
### **`getEmail`**
|
|
152
|
+
|
|
153
|
+
To get the email of the user who is checking out, you can use the `getEmail` method on the checkout element.
|
|
154
|
+
|
|
155
|
+
```js
|
|
156
|
+
const email = await wco.getEmail("whop-embedded-checkout");
|
|
157
|
+
console.log(email);
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### **`setEmail`**
|
|
161
|
+
|
|
162
|
+
To set the email of the user who is checking out, you can use the `setEmail` method on the checkout element.
|
|
163
|
+
|
|
164
|
+
```js
|
|
165
|
+
wco.setEmail("whop-embedded-checkout", "example@domain.com");
|
|
166
|
+
```
|
|
48
167
|
|
|
49
168
|
## Available attributes
|
|
50
169
|
|
|
@@ -204,6 +323,33 @@ Used to prefill the email in the embedded checkout form. This setting can be hel
|
|
|
204
323
|
<div data-whop-checkout-prefill-email="example@domain.com" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
205
324
|
```
|
|
206
325
|
|
|
326
|
+
|
|
327
|
+
#### **`data-whop-checkout-hide-email`**
|
|
328
|
+
|
|
329
|
+
**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.
|
|
330
|
+
|
|
331
|
+
Defaults to `false`
|
|
332
|
+
|
|
333
|
+
Use this in conjunction with the `data-whop-checkout-prefill-email` attribute or the `setEmail` method to control the email input.
|
|
334
|
+
|
|
335
|
+
```md
|
|
336
|
+
<div data-whop-checkout-hide-email="true" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
#### **`data-whop-checkout-disable-email`**
|
|
340
|
+
|
|
341
|
+
**Optional** - Set to `true` to disable the email input in the embedded checkout form.
|
|
342
|
+
|
|
343
|
+
Defaults to `false`
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
Use this in conjunction with the `data-whop-checkout-prefill-email` attribute or the `setEmail` method to control the email input.
|
|
347
|
+
|
|
348
|
+
```md
|
|
349
|
+
<div data-whop-checkout-disable-email="true" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
|
|
207
353
|
## Full example
|
|
208
354
|
|
|
209
355
|
```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")}}}());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e){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,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 i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var u=e.apply(t,r);function a(e){o(u,n,i,a,c,"next",e)}function c(e){o(u,n,i,a,c,"throw",e)}a(undefined)})}}function u(e,t,r){t=f(t);return E(e,x()?Reflect.construct(t,r||[],f(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 c(e,t,r){if(x()){c=Reflect.construct}else{c=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)j(i,r.prototype);return i}}return c.apply(null,arguments)}function l(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)j(e,t)}function d(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 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 m(){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 h(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){l(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 w(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 g(e,t){if(e==null)return{};var r=O(e,t);var n,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++){n=i[o];if(t.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;r[n]=e[n]}}return r}function O(e,t){if(e==null)return{};var r={};var n=Object.keys(e);var o,i;for(i=0;i<n.length;i++){o=n[i];if(t.indexOf(o)>=0)continue;r[o]=e[o]}return r}function E(e,t){if(t&&(_(t)==="object"||typeof t==="function")){return t}return n(e)}function j(e,t){j=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return j(e,t)}function P(e,r){return t(e)||v(e,r)||S(e,r)||m()}function k(e){return r(e)||p(e)||S(e)||y()}function _(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function S(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function C(e){var t=typeof Map==="function"?new Map:undefined;C=function e(e){if(e===null||!d(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 c(e,arguments,f(this).constructor)}r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});return j(r,e)};return C(e)}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(x=function(){return!!e})()}function R(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 W=Object.create;var A=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var L=function(e,t,r){return t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var D=function(e,t){for(var r in t)A(e,r,{get:t[r],enumerable:!0})},q=function(e,t,r,n){var o=true,i=false,u=undefined;if(t&&(typeof t==="undefined"?"undefined":_(t))=="object"||typeof t=="function")try{var a=function(){var o=l.value;!U.call(e,o)&&o!==r&&A(e,o,{get:function(){return t[o]},enumerable:!(n=I(t,o))||n.enumerable})};for(var c=T(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 N=function(e,t,r){return r=e!=null?W(M(e)):{},q(t||!e||!e.__esModule?A(r,"default",{value:e,enumerable:!0}):r,e)},V=function(e){return q(A({},"__esModule",{value:!0}),e)};var z=function(e,t,r){return L(e,(typeof t==="undefined"?"undefined":_(t))!="symbol"?t+"":t,r)};var B={};D(B,{WhopCheckoutEmbed:function(){return eO},useCheckoutEmbedControls:function(){return ej}});module.exports=V(B);var F=N(require("react"));var G=/*#__PURE__*/function(e){s(t,e);function t(){a(this,t);var e;e=u(this,t,arguments);z(e,"type","WhopCheckoutError");return e}return t}(C(Error));var $=/*#__PURE__*/function(e){s(t,e);function t(e){a(this,t);var r;r=u(this,t,[e!==null&&e!==void 0?e:"Timeout waiting for embed response"]);z(r,"name","WhopCheckoutRpcTimeoutError");return r}return t}(G);var H=/*#__PURE__*/function(e){s(t,e);function t(){a(this,t);var e;e=u(this,t,arguments);z(e,"name","WhopCheckoutSetEmailError");return e}return t}(G);var J=["resize","center","complete","state","get-email-result","set-email-result"];function K(e){return _(e.data)=="object"&&e.data!==null&&"event"in e.data&&J.includes(e.data.event)}function Q(e,t){return K(e)&&e.data.event===t}var X=[];function Y(e){return X[e]||(X[e]=(e+256).toString(16).slice(1))}function Z(){var e=new Uint8Array(16);if((typeof crypto==="undefined"?"undefined":_(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,Y(e[0])+Y(e[1])+Y(e[2])+Y(e[3])+"-"+Y(e[4])+Y(e[5])+"-"+Y(e[6])+Y(e[7])+"-"+Y(e[8])+Y(e[9])+"-"+Y(e[10])+Y(e[11])+Y(e[12])+Y(e[13])+Y(e[14])+Y(e[15])}function ee(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=Z();return(i=e.contentWindow)===null||i===void 0?void 0:i.postMessage(w(h({},t),{__scope:"whop-embedded-checkout",event_id:a}),u),new Promise(function(t,i){var u=setTimeout(function(){i(new $),window.removeEventListener("message",c)},o),c=function(o){if(o.source===e.contentWindow&&Q(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 et(e,t){function r(r){r.source===e.contentWindow&&K(r)&&t(r.data)}return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}}function er(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return i(function(){return R(this,function(n){return[2,ee(e,{event:"set-email",email:t},"set-email-result",function(e){if(!e.ok)throw new H(e.error)},r)]})})()}function en(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return i(function(){return R(this,function(r){return[2,ee(e,{event:"get-email"},"get-email-result",function(e){return e.email},t)]})})()}function eo(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 ei(e,t,r,n,o,i,u,a,c,l,f,s,d,p){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"),i&&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"),p&&v.searchParams.set("email.disabled","1"),u){var m=true,y=false,h=undefined,b=true,w=false,g=undefined;try{for(var O=Object.entries(u).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),E;!(b=(E=O.next()).done);b=true){var j=P(E.value,2),k=j[0],_=j[1];if(k.startsWith("utm_"))if(Array.isArray(_))try{for(var S=_[Symbol.iterator](),C;!(m=(C=S.next()).done);m=true){var x=C.value;v.searchParams.append(k,x)}}catch(e){y=true;h=e}finally{try{if(!m&&S.return!=null){S.return()}}finally{if(y){throw h}}}else v.searchParams.set(k,_)}}catch(e){w=true;g=e}finally{try{if(!b&&O.return!=null){O.return()}}finally{if(w){throw g}}}}if(a){var R=true,W=false,A=undefined,I=true,T=false,M=undefined;try{for(var U=Object.entries(a)[Symbol.iterator](),L;!(I=(L=U.next()).done);I=true){var D=P(L.value,2),q=D[0],N=D[1];if(N)try{for(var V=Object.entries(N)[Symbol.iterator](),z;!(R=(z=V.next()).done);R=true){var B=P(z.value,2),F=B[0],G=B[1];v.searchParams.set("style.".concat(q,".").concat(F),G.toString())}}catch(e){W=true;A=e}finally{try{if(!R&&V.return!=null){V.return()}}finally{if(W){throw A}}}}}catch(e){T=true;M=e}finally{try{if(!I&&U.return!=null){U.return()}}finally{if(T){throw M}}}}var $=true,H=false,J=undefined;if((c===null||c===void 0?void 0:c.email)&&v.searchParams.set("email",c.email),l)try{for(var K=Object.entries(l)[Symbol.iterator](),Q;!($=(Q=K.next()).done);$=true){var X=P(Q.value,2),Y=X[0],Z=X[1];Z&&v.searchParams.set("theme.".concat(Y),Z)}}catch(e){H=true;J=e}finally{try{if(!$&&K.return!=null){K.return()}}finally{if(H){throw J}}}return v.toString()}var eu=["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"],ea="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";var ec=require("react");function el(){return function(){}}function ef(){return(0,ec.useSyncExternalStore)(el,function(){return!0},function(){return!1})}var es=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","cyan","teal","jade","green","grass","brown","blue","orange","indigo","sky","mint","yellow","amber","lime","lemon","magenta","gold","bronze","gray"];function ed(e){return e?es.includes(e):!1}var ep=require("react");var ev=require("react"),em=Symbol("none");function ey(e){var t=(0,ev.useRef)(em);return t.current===em&&(t.current=e()),t}function eh(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=ey(function(){return ei.apply(void 0,k(t))}),o=n.current;return o&&eb.apply(void 0,[o].concat(k(t))),o}function eb(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}var o=P(r,12),i=o[0],u=o[1],a=o[2],c=o[3],l=o[4],f=o[5],s=o[6],d=o[7],p=o[8],v=o[9],m=o[10],y=o[11];var h=(0,ep.useMemo)(function(){return ei(i,u,a,void 0,l,f,s,d,p,v,m,y)},[i,u,a,l,f,s,d,p,v,m,y]);(0,ep.useEffect)(function(){e!==h&&process.env.NODE_ENV==="development"&&console.warn("[WhopCheckoutEmbed] iframeUrl changed from ".concat(e," to ").concat(h,". Updating props on the checkout embed is not supported. Please rerender the component."))},[e,h])}var ew=eu.join(" ");var eg=(0,F.forwardRef)(function(e,t){var r=e.planId,n=e.theme,o=e.sessionId,i=e.hidePrice,u=i===void 0?!1:i,a=e.skipRedirect,c=a===void 0?!1:a,l=e.onComplete,f=e.onStateChange,s=e.utm,d=e.styles,p=e.prefill,v=e.themeOptions,m=e.hideSubmitButton,y=m===void 0?!1:m,h=e.hideTermsAndConditions,b=h===void 0?!1:h,w=e.hideEmail,g=w===void 0?!1:w,O=e.disableEmail,E=O===void 0?!1:O;var j=(0,F.useMemo)(function(){return{accentColor:ed(v===null||v===void 0?void 0:v.accentColor)?v.accentColor:void 0}},[v===null||v===void 0?void 0:v.accentColor]),k=eh(r,n,o,void 0,u,c||!!l,s,d,p,j,y,b,g,E),_=(0,F.useRef)(null),S=P((0,F.useState)(480),2),C=S[0],x=S[1];return(0,F.useEffect)(function(){var e=_.current;if(e)return et(e,function(t){switch(t.event){case"resize":{x(t.height);break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{l&&l(t.plan_id,t.receipt_id);break}case"state":{f&&f(t.state);break}}})},[l,f]),t&&(typeof t=="function"?t({submit:function(e){_.current&&eo(_.current,e)},getEmail:function(e){if(!_.current)throw new Error("Whop embedded checkout frame not found");return en(_.current,e)},setEmail:function(e,t){if(!_.current)throw new Error("Whop embedded checkout frame not found");return er(_.current,e,t)}}):t.current={submit:function(e){_.current&&eo(_.current,e)},getEmail:function(e){if(!_.current)throw new Error("Whop embedded checkout frame not found");return en(_.current,e)},setEmail:function(e,t){if(!_.current)throw new Error("Whop embedded checkout frame not found");return er(_.current,e,t)}}),F.default.createElement("iframe",{ref:_,allow:ea,sandbox:ew,title:"Whop Embedded Checkout",src:k!==null&&k!==void 0?k:void 0,style:{border:"none",height:"".concat(C,"px"),width:"100%",overflow:"hidden"}})});eg.displayName="WhopCheckoutEmbedInner";var eO=(0,F.forwardRef)(function(e,t){var r=e.fallback,n=g(e,["fallback"]);return ef()?F.default.createElement(eg,w(h({},n),{ref:t})):r!==null&&r!==void 0?r:null});eO.displayName="WhopCheckoutEmbed";var eE=require("react");function ej(){return(0,eE.useRef)(null)}0&&(module.exports={WhopCheckoutEmbed:WhopCheckoutEmbed,useCheckoutEmbedControls:useCheckoutEmbedControls});
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { MutableRefObject, ReactNode } from 'react';
|
|
3
|
+
import { WhopCheckoutSubmitDetails, WhopCheckoutState, WhopEmbeddedCheckoutStyleOptions, WhopEmbeddedCheckoutPrefillOptions } from '../util.mjs';
|
|
4
|
+
|
|
5
|
+
declare const accentColorValues: readonly ["tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "cyan", "teal", "jade", "green", "grass", "brown", "blue", "orange", "indigo", "sky", "mint", "yellow", "amber", "lime", "lemon", "magenta", "gold", "bronze", "gray"];
|
|
6
|
+
type AccentColor = (typeof accentColorValues)[number];
|
|
7
|
+
|
|
8
|
+
interface WhopCheckoutEmbedControls {
|
|
9
|
+
submit: (opts?: WhopCheckoutSubmitDetails) => void;
|
|
10
|
+
getEmail: (timeout?: number) => Promise<string>;
|
|
11
|
+
setEmail: (email: string, timeout?: number) => Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface WhopCheckoutEmbedThemeOptions {
|
|
15
|
+
/**
|
|
16
|
+
* **Optional** - The accent color you want to use in the embed.
|
|
17
|
+
*
|
|
18
|
+
* defaults to `blue`
|
|
19
|
+
*/
|
|
20
|
+
accentColor?: AccentColor;
|
|
21
|
+
}
|
|
22
|
+
interface WhopCheckoutEmbedProps {
|
|
23
|
+
/**
|
|
24
|
+
* **Required** - The plan id you want to checkout.
|
|
25
|
+
*/
|
|
26
|
+
planId: string;
|
|
27
|
+
/**
|
|
28
|
+
* **Optional** - A ref to the embed controls.
|
|
29
|
+
*
|
|
30
|
+
* This can be used to submit the checkout form.
|
|
31
|
+
*/
|
|
32
|
+
ref?: MutableRefObject<WhopCheckoutEmbedControls | null>;
|
|
33
|
+
/**
|
|
34
|
+
* **Optional** - The theme you want to use for the checkout.
|
|
35
|
+
*
|
|
36
|
+
* Possible values are `light`, `dark` or `system`.
|
|
37
|
+
*
|
|
38
|
+
* @default "system"
|
|
39
|
+
*/
|
|
40
|
+
theme?: "light" | "dark" | "system";
|
|
41
|
+
/**
|
|
42
|
+
* **Optional** - The session id to use for the checkout.
|
|
43
|
+
*
|
|
44
|
+
* This can be used to attach metadata to a checkout by first creating a session through the API and then passing the session id to the checkout element.
|
|
45
|
+
*/
|
|
46
|
+
sessionId?: string;
|
|
47
|
+
/**
|
|
48
|
+
* **Optional** - Turn on to hide the price in the embedded checkout form.
|
|
49
|
+
*
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
hidePrice?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* **Optional** - Set to `true` to skip the final redirect and keep the top frame loaded.
|
|
55
|
+
*
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
skipRedirect?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* **Optional** - A callback function that will be called when the checkout is complete.
|
|
61
|
+
*/
|
|
62
|
+
onComplete?: (
|
|
63
|
+
/** The plan id of the plan that was purchased. */
|
|
64
|
+
plan_id: string,
|
|
65
|
+
/** The receipt id of the purchase. */
|
|
66
|
+
receipt_id?: string) => void;
|
|
67
|
+
/**
|
|
68
|
+
* **Optional** - A callback function that will be called when the checkout state changes.
|
|
69
|
+
*/
|
|
70
|
+
onStateChange?: (
|
|
71
|
+
/** The new state of the checkout. */
|
|
72
|
+
state: WhopCheckoutState) => void;
|
|
73
|
+
/**
|
|
74
|
+
* **Optional** - The UTM parameters to add to the checkout URL.
|
|
75
|
+
*
|
|
76
|
+
* **Note** - The keys must start with `utm_`
|
|
77
|
+
*/
|
|
78
|
+
utm?: Record<string, string | string[]>;
|
|
79
|
+
/**
|
|
80
|
+
* **Optional** - The styles to apply to the checkout embed.
|
|
81
|
+
*/
|
|
82
|
+
styles?: WhopEmbeddedCheckoutStyleOptions;
|
|
83
|
+
/**
|
|
84
|
+
* **Optional** - The prefill options to apply to the checkout embed.
|
|
85
|
+
*
|
|
86
|
+
* Used to prefill the email in the embedded checkout form.
|
|
87
|
+
* This setting can be helpful when integrating the embed into a funnel that collects the email prior to payment already.
|
|
88
|
+
*/
|
|
89
|
+
prefill?: WhopEmbeddedCheckoutPrefillOptions;
|
|
90
|
+
/**
|
|
91
|
+
* **Optional** - The theme options to apply to the checkout embed.
|
|
92
|
+
*/
|
|
93
|
+
themeOptions?: WhopCheckoutEmbedThemeOptions;
|
|
94
|
+
/**
|
|
95
|
+
* **Optional** - Set to `true` to hide the submit button in the embedded checkout form.
|
|
96
|
+
*
|
|
97
|
+
* @default false
|
|
98
|
+
*/
|
|
99
|
+
hideSubmitButton?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* **Optional** - Set to `true` to hide the terms and conditions in the embedded checkout form.
|
|
102
|
+
*
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
hideTermsAndConditions?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* **Optional** - Set to `true` to hide the email input in the embedded checkout form.
|
|
108
|
+
*
|
|
109
|
+
* @default false
|
|
110
|
+
*/
|
|
111
|
+
hideEmail?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* **Optional** - Set to `true` to disable the email input in the embedded checkout form.
|
|
114
|
+
*
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
117
|
+
disableEmail?: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* This component can be used to embed whop checkout in your react app:
|
|
122
|
+
*
|
|
123
|
+
* ```tsx
|
|
124
|
+
* import { WhopCheckoutEmbed } from "@whop/react/checkout";
|
|
125
|
+
*
|
|
126
|
+
* export default function Home() {
|
|
127
|
+
* return <WhopCheckoutEmbed planId="plan_XXXXXXXXX" />;
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
declare const WhopCheckoutEmbed: React__default.ForwardRefExoticComponent<Omit<WhopCheckoutEmbedProps & {
|
|
132
|
+
/**
|
|
133
|
+
* **Optional** - The fallback content to show while the checkout is loading.
|
|
134
|
+
*/
|
|
135
|
+
fallback?: ReactNode;
|
|
136
|
+
}, "ref"> & React__default.RefAttributes<WhopCheckoutEmbedControls>>;
|
|
137
|
+
|
|
138
|
+
declare function useCheckoutEmbedControls(): React.RefObject<WhopCheckoutEmbedControls>;
|
|
139
|
+
|
|
140
|
+
export { WhopCheckoutEmbed, type WhopCheckoutEmbedProps, type WhopCheckoutEmbedThemeOptions, WhopEmbeddedCheckoutPrefillOptions, WhopEmbeddedCheckoutStyleOptions, useCheckoutEmbedControls };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { MutableRefObject, ReactNode } from 'react';
|
|
3
|
+
import { WhopCheckoutSubmitDetails, WhopCheckoutState, WhopEmbeddedCheckoutStyleOptions, WhopEmbeddedCheckoutPrefillOptions } from '../util.js';
|
|
4
|
+
|
|
5
|
+
declare const accentColorValues: readonly ["tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "cyan", "teal", "jade", "green", "grass", "brown", "blue", "orange", "indigo", "sky", "mint", "yellow", "amber", "lime", "lemon", "magenta", "gold", "bronze", "gray"];
|
|
6
|
+
type AccentColor = (typeof accentColorValues)[number];
|
|
7
|
+
|
|
8
|
+
interface WhopCheckoutEmbedControls {
|
|
9
|
+
submit: (opts?: WhopCheckoutSubmitDetails) => void;
|
|
10
|
+
getEmail: (timeout?: number) => Promise<string>;
|
|
11
|
+
setEmail: (email: string, timeout?: number) => Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface WhopCheckoutEmbedThemeOptions {
|
|
15
|
+
/**
|
|
16
|
+
* **Optional** - The accent color you want to use in the embed.
|
|
17
|
+
*
|
|
18
|
+
* defaults to `blue`
|
|
19
|
+
*/
|
|
20
|
+
accentColor?: AccentColor;
|
|
21
|
+
}
|
|
22
|
+
interface WhopCheckoutEmbedProps {
|
|
23
|
+
/**
|
|
24
|
+
* **Required** - The plan id you want to checkout.
|
|
25
|
+
*/
|
|
26
|
+
planId: string;
|
|
27
|
+
/**
|
|
28
|
+
* **Optional** - A ref to the embed controls.
|
|
29
|
+
*
|
|
30
|
+
* This can be used to submit the checkout form.
|
|
31
|
+
*/
|
|
32
|
+
ref?: MutableRefObject<WhopCheckoutEmbedControls | null>;
|
|
33
|
+
/**
|
|
34
|
+
* **Optional** - The theme you want to use for the checkout.
|
|
35
|
+
*
|
|
36
|
+
* Possible values are `light`, `dark` or `system`.
|
|
37
|
+
*
|
|
38
|
+
* @default "system"
|
|
39
|
+
*/
|
|
40
|
+
theme?: "light" | "dark" | "system";
|
|
41
|
+
/**
|
|
42
|
+
* **Optional** - The session id to use for the checkout.
|
|
43
|
+
*
|
|
44
|
+
* This can be used to attach metadata to a checkout by first creating a session through the API and then passing the session id to the checkout element.
|
|
45
|
+
*/
|
|
46
|
+
sessionId?: string;
|
|
47
|
+
/**
|
|
48
|
+
* **Optional** - Turn on to hide the price in the embedded checkout form.
|
|
49
|
+
*
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
hidePrice?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* **Optional** - Set to `true` to skip the final redirect and keep the top frame loaded.
|
|
55
|
+
*
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
skipRedirect?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* **Optional** - A callback function that will be called when the checkout is complete.
|
|
61
|
+
*/
|
|
62
|
+
onComplete?: (
|
|
63
|
+
/** The plan id of the plan that was purchased. */
|
|
64
|
+
plan_id: string,
|
|
65
|
+
/** The receipt id of the purchase. */
|
|
66
|
+
receipt_id?: string) => void;
|
|
67
|
+
/**
|
|
68
|
+
* **Optional** - A callback function that will be called when the checkout state changes.
|
|
69
|
+
*/
|
|
70
|
+
onStateChange?: (
|
|
71
|
+
/** The new state of the checkout. */
|
|
72
|
+
state: WhopCheckoutState) => void;
|
|
73
|
+
/**
|
|
74
|
+
* **Optional** - The UTM parameters to add to the checkout URL.
|
|
75
|
+
*
|
|
76
|
+
* **Note** - The keys must start with `utm_`
|
|
77
|
+
*/
|
|
78
|
+
utm?: Record<string, string | string[]>;
|
|
79
|
+
/**
|
|
80
|
+
* **Optional** - The styles to apply to the checkout embed.
|
|
81
|
+
*/
|
|
82
|
+
styles?: WhopEmbeddedCheckoutStyleOptions;
|
|
83
|
+
/**
|
|
84
|
+
* **Optional** - The prefill options to apply to the checkout embed.
|
|
85
|
+
*
|
|
86
|
+
* Used to prefill the email in the embedded checkout form.
|
|
87
|
+
* This setting can be helpful when integrating the embed into a funnel that collects the email prior to payment already.
|
|
88
|
+
*/
|
|
89
|
+
prefill?: WhopEmbeddedCheckoutPrefillOptions;
|
|
90
|
+
/**
|
|
91
|
+
* **Optional** - The theme options to apply to the checkout embed.
|
|
92
|
+
*/
|
|
93
|
+
themeOptions?: WhopCheckoutEmbedThemeOptions;
|
|
94
|
+
/**
|
|
95
|
+
* **Optional** - Set to `true` to hide the submit button in the embedded checkout form.
|
|
96
|
+
*
|
|
97
|
+
* @default false
|
|
98
|
+
*/
|
|
99
|
+
hideSubmitButton?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* **Optional** - Set to `true` to hide the terms and conditions in the embedded checkout form.
|
|
102
|
+
*
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
hideTermsAndConditions?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* **Optional** - Set to `true` to hide the email input in the embedded checkout form.
|
|
108
|
+
*
|
|
109
|
+
* @default false
|
|
110
|
+
*/
|
|
111
|
+
hideEmail?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* **Optional** - Set to `true` to disable the email input in the embedded checkout form.
|
|
114
|
+
*
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
117
|
+
disableEmail?: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* This component can be used to embed whop checkout in your react app:
|
|
122
|
+
*
|
|
123
|
+
* ```tsx
|
|
124
|
+
* import { WhopCheckoutEmbed } from "@whop/react/checkout";
|
|
125
|
+
*
|
|
126
|
+
* export default function Home() {
|
|
127
|
+
* return <WhopCheckoutEmbed planId="plan_XXXXXXXXX" />;
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
declare const WhopCheckoutEmbed: React__default.ForwardRefExoticComponent<Omit<WhopCheckoutEmbedProps & {
|
|
132
|
+
/**
|
|
133
|
+
* **Optional** - The fallback content to show while the checkout is loading.
|
|
134
|
+
*/
|
|
135
|
+
fallback?: ReactNode;
|
|
136
|
+
}, "ref"> & React__default.RefAttributes<WhopCheckoutEmbedControls>>;
|
|
137
|
+
|
|
138
|
+
declare function useCheckoutEmbedControls(): React.RefObject<WhopCheckoutEmbedControls>;
|
|
139
|
+
|
|
140
|
+
export { WhopCheckoutEmbed, type WhopCheckoutEmbedProps, type WhopCheckoutEmbedThemeOptions, WhopEmbeddedCheckoutPrefillOptions, WhopEmbeddedCheckoutStyleOptions, useCheckoutEmbedControls };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(r){if(Array.isArray(r))return e(r)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function o(e,r,t,n,o,i,u){try{var a=e[i](u);var c=a.value}catch(e){t(e);return}if(a.done){r(c)}else{Promise.resolve(c).then(n,o)}}function i(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var u=e.apply(r,t);function a(e){o(u,n,i,a,c,"next",e)}function c(e){o(u,n,i,a,c,"throw",e)}a(undefined)})}}function u(e,r,t){r=f(r);return P(e,R()?Reflect.construct(r,t||[],f(e).constructor):r.apply(e,t))}function a(e,r){if(!(e instanceof r)){throw new TypeError("Cannot call a class as a function")}}function c(e,r,t){if(R()){c=Reflect.construct}else{c=function e(e,r,t){var n=[null];n.push.apply(n,r);var o=Function.bind.apply(e,n);var i=new o;if(t)j(i,t.prototype);return i}}return c.apply(null,arguments)}function l(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}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,r){if(typeof r!=="function"&&r!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:true,configurable:true}});if(r)j(e,r)}function d(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,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var o=true;var i=false;var u,a;try{for(t=t.call(e);!(o=(u=t.next()).done);o=true){n.push(u.value);if(r&&n.length===r)break}}catch(e){i=true;a=e}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(i)throw a}}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 m(){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 h(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}n.forEach(function(r){l(e,r,t[r])})}return e}function b(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function w(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{b(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function g(e,r){if(e==null)return{};var t=O(e,r);var n,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++){n=i[o];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function O(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var o,i;for(i=0;i<n.length;i++){o=n[i];if(r.indexOf(o)>=0)continue;t[o]=e[o]}return t}function P(e,r){if(r&&(S(r)==="object"||typeof r==="function")){return r}return n(e)}function j(e,r){j=Object.setPrototypeOf||function e(e,r){e.__proto__=r;return e};return j(e,r)}function E(e,t){return r(e)||v(e,t)||_(e,t)||y()}function k(e){return t(e)||p(e)||_(e)||m()}function S(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function _(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}function x(e){var r=typeof Map==="function"?new Map:undefined;x=function e(e){if(e===null||!d(e))return e;if(typeof e!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof r!=="undefined"){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return c(e,arguments,f(this).constructor)}t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:false,writable:true,configurable:true}});return j(t,e)};return x(e)}function R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(R=function(){return!!e})()}function C(e,r){var t,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(r){return c([e,r])}}function c(a){if(t)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(i=0)),i)try{if(t=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=r.call(e,i)}catch(e){a=[6,e];n=0}finally{t=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}(function(){var e=function e(e){return S(e.data)=="object"&&e.data!==null&&"event"in e.data&&F.includes(e.data.event)};var r=function r(r,t){return e(r)&&r.data.event===t};var t=function e(e){return G[e]||(G[e]=(e+256).toString(16).slice(1))};var n=function e(){var e=new Uint8Array(16);if((typeof crypto==="undefined"?"undefined":S(crypto))<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(var r=0;r<16;r++)e[r]=Math.random()*256|0;return e[6]=e[6]&15|64,e[8]=e[8]&63|128,t(e[0])+t(e[1])+t(e[2])+t(e[3])+"-"+t(e[4])+t(e[5])+"-"+t(e[6])+t(e[7])+"-"+t(e[8])+t(e[9])+"-"+t(e[10])+t(e[11])+t(e[12])+t(e[13])+t(e[14])+t(e[15])};var o=function e(e,t,o,i){var u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:2e3;var a;var c=new URL(e.src).origin,l=n();return(a=e.contentWindow)===null||a===void 0?void 0:a.postMessage(w(h({},t),{__scope:"whop-embedded-checkout",event_id:l}),c),new Promise(function(t,n){var a=setTimeout(function(){n(new z),window.removeEventListener("message",c)},u),c=function(u){if(u.source===e.contentWindow&&r(u,o)&&u.data.event===o&&u.data.event_id===l){clearTimeout(a),window.removeEventListener("message",c);try{t(i(u.data))}catch(e){n(e)}}};window.addEventListener("message",c)})};var c=function r(r,t){function n(n){n.source===r.contentWindow&&e(n)&&t(n.data)}return window.addEventListener("message",n),function(){window.removeEventListener("message",n)}};var l=function e(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return i(function(){return C(this,function(n){return[2,o(e,{event:"set-email",email:r},"set-email-result",function(e){if(!e.ok)throw new B(e.error)},t)]})})()};var f=function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return i(function(){return C(this,function(t){return[2,o(e,{event:"get-email"},"get-email-result",function(e){return e.email},r)]})})()};var d=function e(e,r){var t;var n=new URL(e.src).origin;(t=e.contentWindow)===null||t===void 0?void 0:t.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)};var p=function e(e,r,t,n,o,i,u,a,c,l,f,s,d,p){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),r&&v.searchParams.set("theme",r),t&&v.searchParams.set("session",t),o&&v.searchParams.set("hide_price","true"),i&&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"),p&&v.searchParams.set("email.disabled","1"),u){var y=true,m=false,h=undefined,b=true,w=false,g=undefined;try{for(var O=Object.entries(u).sort(function(e,r){return e[0].localeCompare(r[0])})[Symbol.iterator](),P;!(b=(P=O.next()).done);b=true){var j=E(P.value,2),k=j[0],S=j[1];if(k.startsWith("utm_"))if(Array.isArray(S))try{for(var _=S[Symbol.iterator](),x;!(y=(x=_.next()).done);y=true){var R=x.value;v.searchParams.append(k,R)}}catch(e){m=true;h=e}finally{try{if(!y&&_.return!=null){_.return()}}finally{if(m){throw h}}}else v.searchParams.set(k,S)}}catch(e){w=true;g=e}finally{try{if(!b&&O.return!=null){O.return()}}finally{if(w){throw g}}}}if(a){var C=true,W=false,A=undefined,I=true,q=false,T=undefined;try{for(var U=Object.entries(a)[Symbol.iterator](),M;!(I=(M=U.next()).done);I=true){var D=E(M.value,2),L=D[0],N=D[1];if(N)try{for(var V=Object.entries(N)[Symbol.iterator](),z;!(C=(z=V.next()).done);C=true){var B=E(z.value,2),F=B[0],G=B[1];v.searchParams.set("style.".concat(L,".").concat(F),G.toString())}}catch(e){W=true;A=e}finally{try{if(!C&&V.return!=null){V.return()}}finally{if(W){throw A}}}}}catch(e){q=true;T=e}finally{try{if(!I&&U.return!=null){U.return()}}finally{if(q){throw T}}}}var $=true,H=false,J=undefined;if((c===null||c===void 0?void 0:c.email)&&v.searchParams.set("email",c.email),l)try{for(var K=Object.entries(l)[Symbol.iterator](),Q;!($=(Q=K.next()).done);$=true){var X=E(Q.value,2),Y=X[0],Z=X[1];Z&&v.searchParams.set("theme.".concat(Y),Z)}}catch(e){H=true;J=e}finally{try{if(!$&&K.return!=null){K.return()}}finally{if(H){throw J}}}return v.toString()};var v=function e(){return function(){}};var y=function e(){return(0,J.useSyncExternalStore)(v,function(){return!0},function(){return!1})};var m=function e(e){return e?K.includes(e):!1};var b=function e(e){var r=(0,X.useRef)(Y);return r.current===Y&&(r.current=e()),r};var O=function e(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n=b(function(){return p.apply(void 0,k(r))}),o=n.current;return o&&P.apply(void 0,[o].concat(k(r))),o};var P=function e(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++){t[n-1]=arguments[n]}var o=E(t,12),i=o[0],u=o[1],a=o[2],c=o[3],l=o[4],f=o[5],s=o[6],d=o[7],v=o[8],y=o[9],m=o[10],h=o[11];var b=(0,Q.useMemo)(function(){return p(i,u,a,void 0,l,f,s,d,v,y,m,h)},[i,u,a,l,f,s,d,v,y,m,h]);(0,Q.useEffect)(function(){e!==b&&process.env.NODE_ENV==="development"&&console.warn("[WhopCheckoutEmbed] iframeUrl changed from ".concat(e," to ").concat(b,". Updating props on the checkout embed is not supported. Please rerender the component."))},[e,b])};var j=function e(){return(0,et.useRef)(null)};var _=Object.create;var R=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var T=function(e,r,t){return r in e?R(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t};var U=function(e){return(typeof require==="undefined"?"undefined":S(require))<"u"?require:(typeof Proxy==="undefined"?"undefined":S(Proxy))<"u"?new Proxy(e,{get:function(e,r){return((typeof require==="undefined"?"undefined":S(require))<"u"?require:e)[r]}}):e}(function(e){if((typeof require==="undefined"?"undefined":S(require))<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var M=function(e,r,t,n){var o=true,i=false,u=undefined;if(r&&(typeof r==="undefined"?"undefined":S(r))=="object"||typeof r=="function")try{var a=function(){var o=l.value;!q.call(e,o)&&o!==t&&R(e,o,{get:function(){return r[o]},enumerable:!(n=W(r,o))||n.enumerable})};for(var c=A(r)[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 D=function(e,r,t){return t=e!=null?_(I(e)):{},M(r||!e||!e.__esModule?R(t,"default",{value:e,enumerable:!0}):t,e)};var L=function(e,r,t){return T(e,(typeof r==="undefined"?"undefined":S(r))!="symbol"?r+"":r,t)};var N=D(U("react"));var V=/*#__PURE__*/function(e){s(r,e);function r(){a(this,r);var e;e=u(this,r,arguments);L(e,"type","WhopCheckoutError");return e}return r}(x(Error));var z=/*#__PURE__*/function(e){s(r,e);function r(e){a(this,r);var t;t=u(this,r,[e!==null&&e!==void 0?e:"Timeout waiting for embed response"]);L(t,"name","WhopCheckoutRpcTimeoutError");return t}return r}(V);var B=/*#__PURE__*/function(e){s(r,e);function r(){a(this,r);var e;e=u(this,r,arguments);L(e,"name","WhopCheckoutSetEmailError");return e}return r}(V);var F=["resize","center","complete","state","get-email-result","set-email-result"];var G=[];var $=["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"],H="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";var J=U("react");var K=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","cyan","teal","jade","green","grass","brown","blue","orange","indigo","sky","mint","yellow","amber","lime","lemon","magenta","gold","bronze","gray"];var Q=U("react");var X=U("react"),Y=Symbol("none");var Z=$.join(" ");var ee=(0,N.forwardRef)(function(e,r){var t=e.planId,n=e.theme,o=e.sessionId,i=e.hidePrice,u=i===void 0?!1:i,a=e.skipRedirect,s=a===void 0?!1:a,p=e.onComplete,v=e.onStateChange,y=e.utm,h=e.styles,b=e.prefill,w=e.themeOptions,g=e.hideSubmitButton,P=g===void 0?!1:g,j=e.hideTermsAndConditions,k=j===void 0?!1:j,S=e.hideEmail,_=S===void 0?!1:S,x=e.disableEmail,R=x===void 0?!1:x;var C=(0,N.useMemo)(function(){return{accentColor:m(w===null||w===void 0?void 0:w.accentColor)?w.accentColor:void 0}},[w===null||w===void 0?void 0:w.accentColor]),W=O(t,n,o,void 0,u,s||!!p,y,h,b,C,P,k,_,R),A=(0,N.useRef)(null),I=E((0,N.useState)(480),2),q=I[0],T=I[1];return(0,N.useEffect)(function(){var e=A.current;if(e)return c(e,function(r){switch(r.event){case"resize":{T(r.height);break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{p&&p(r.plan_id,r.receipt_id);break}case"state":{v&&v(r.state);break}}})},[p,v]),r&&(typeof r=="function"?r({submit:function(e){A.current&&d(A.current,e)},getEmail:function(e){if(!A.current)throw new Error("Whop embedded checkout frame not found");return f(A.current,e)},setEmail:function(e,r){if(!A.current)throw new Error("Whop embedded checkout frame not found");return l(A.current,e,r)}}):r.current={submit:function(e){A.current&&d(A.current,e)},getEmail:function(e){if(!A.current)throw new Error("Whop embedded checkout frame not found");return f(A.current,e)},setEmail:function(e,r){if(!A.current)throw new Error("Whop embedded checkout frame not found");return l(A.current,e,r)}}),N.default.createElement("iframe",{ref:A,allow:H,sandbox:Z,title:"Whop Embedded Checkout",src:W!==null&&W!==void 0?W:void 0,style:{border:"none",height:"".concat(q,"px"),width:"100%",overflow:"hidden"}})});ee.displayName="WhopCheckoutEmbedInner";var er=(0,N.forwardRef)(function(e,r){var t=e.fallback,n=g(e,["fallback"]);return y()?N.default.createElement(ee,w(h({},n),{ref:r})):t!==null&&t!==void 0?t:null});er.displayName="WhopCheckoutEmbed";var et=U("react")})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(r){if(Array.isArray(r))return e(r)}function n(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(e,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var o=true;var i=false;var u,a;try{for(t=t.call(e);!(o=(u=t.next()).done);o=true){n.push(u.value);if(r&&n.length===r)break}}catch(e){i=true;a=e}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(i)throw a}}return n}function u(){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(){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 c(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var o=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}o.forEach(function(r){n(e,r,t[r])})}return e}function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function f(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{l(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,r){if(e==null)return{};var t=d(e,r);var n,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++){n=i[o];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function d(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var o,i;for(i=0;i<n.length;i++){o=n[i];if(r.indexOf(o)>=0)continue;t[o]=e[o]}return t}function m(e,t){return r(e)||i(e,t)||b(e,t)||u()}function p(e){return t(e)||o(e)||b(e)||a()}function b(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}import{b as y,c as h,d as v,e as g,f as w,g as O,h as E}from"../chunk-N2KVERZN.mjs";import j,{forwardRef as k,useEffect as S,useMemo as P,useRef as C,useState as A}from"react";import{useSyncExternalStore as I}from"react";function W(){return function(){}}function x(){return I(W,function(){return!0},function(){return!1})}var D=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","cyan","teal","jade","green","grass","brown","blue","orange","indigo","sky","mint","yellow","amber","lime","lemon","magenta","gold","bronze","gray"];function N(e){return e?D.includes(e):!1}import{useEffect as R,useMemo as M}from"react";import{useRef as T}from"react";var U=Symbol("none");function V(e){var r=T(U);return r.current===U&&(r.current=e()),r}function _(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n=V(function(){return w.apply(void 0,p(r))}),o=n.current;return o&&z.apply(void 0,[o].concat(p(r))),o}function z(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++){t[n-1]=arguments[n]}var o=m(t,12),i=o[0],u=o[1],a=o[2],c=o[3],l=o[4],f=o[5],s=o[6],d=o[7],p=o[8],b=o[9],y=o[10],h=o[11];var v=M(function(){return w(i,u,a,void 0,l,f,s,d,p,b,y,h)},[i,u,a,l,f,s,d,p,b,y,h]);R(function(){e!==v&&process.env.NODE_ENV==="development"&&console.warn("[WhopCheckoutEmbed] iframeUrl changed from ".concat(e," to ").concat(v,". Updating props on the checkout embed is not supported. Please rerender the component."))},[e,v])}var Z=O.join(" ");var B=k(function(e,r){var t=e.planId,n=e.theme,o=e.sessionId,i=e.hidePrice,u=i===void 0?!1:i,a=e.skipRedirect,c=a===void 0?!1:a,l=e.onComplete,f=e.onStateChange,s=e.utm,d=e.styles,p=e.prefill,b=e.themeOptions,w=e.hideSubmitButton,O=w===void 0?!1:w,k=e.hideTermsAndConditions,I=k===void 0?!1:k,W=e.hideEmail,x=W===void 0?!1:W,D=e.disableEmail,R=D===void 0?!1:D;var M=P(function(){return{accentColor:N(b===null||b===void 0?void 0:b.accentColor)?b.accentColor:void 0}},[b===null||b===void 0?void 0:b.accentColor]),T=_(t,n,o,void 0,u,c||!!l,s,d,p,M,O,I,x,R),U=C(null),V=m(A(480),2),z=V[0],B=V[1];return S(function(){var e=U.current;if(e)return y(e,function(r){switch(r.event){case"resize":{B(r.height);break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{l&&l(r.plan_id,r.receipt_id);break}case"state":{f&&f(r.state);break}}})},[l,f]),r&&(typeof r=="function"?r({submit:function(e){U.current&&g(U.current,e)},getEmail:function(e){if(!U.current)throw new Error("Whop embedded checkout frame not found");return v(U.current,e)},setEmail:function(e,r){if(!U.current)throw new Error("Whop embedded checkout frame not found");return h(U.current,e,r)}}):r.current={submit:function(e){U.current&&g(U.current,e)},getEmail:function(e){if(!U.current)throw new Error("Whop embedded checkout frame not found");return v(U.current,e)},setEmail:function(e,r){if(!U.current)throw new Error("Whop embedded checkout frame not found");return h(U.current,e,r)}}),j.createElement("iframe",{ref:U,allow:E,sandbox:Z,title:"Whop Embedded Checkout",src:T!==null&&T!==void 0?T:void 0,style:{border:"none",height:"".concat(z,"px"),width:"100%",overflow:"hidden"}})});B.displayName="WhopCheckoutEmbedInner";var K=k(function(e,r){var t=e.fallback,n=s(e,["fallback"]);return x()?j.createElement(B,f(c({},n),{ref:r})):t!==null&&t!==void 0?t:null});K.displayName="WhopCheckoutEmbed";import{useRef as $}from"react";function q(){return $(null)}export{K as WhopCheckoutEmbed,q as useCheckoutEmbedControls};
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whop/checkout",
|
|
3
3
|
"description": "Embed Whop checkout on any website",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.38",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/whopio/whop-sdk-ts",
|
|
@@ -24,26 +24,42 @@
|
|
|
24
24
|
],
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
|
+
"types": "./dist/static/checkout/index.d.ts",
|
|
27
28
|
"import": "./dist/static/checkout/index.mjs",
|
|
28
29
|
"require": "./dist/static/checkout/index.cjs",
|
|
29
|
-
"types": "./dist/static/checkout/index.d.ts",
|
|
30
30
|
"default": "./dist/static/checkout/index.js"
|
|
31
31
|
},
|
|
32
32
|
"./loader": "./dist/static/checkout/loader.js",
|
|
33
|
+
"./react": {
|
|
34
|
+
"types": "./dist/static/checkout/react/index.d.ts",
|
|
35
|
+
"import": "./dist/static/checkout/react/index.mjs",
|
|
36
|
+
"require": "./dist/static/checkout/react/index.cjs",
|
|
37
|
+
"default": "./dist/static/checkout/react/index.js"
|
|
38
|
+
},
|
|
33
39
|
"./util": {
|
|
40
|
+
"types": "./dist/static/checkout/util.d.ts",
|
|
34
41
|
"import": "./dist/static/checkout/util.mjs",
|
|
35
42
|
"require": "./dist/static/checkout/util.cjs",
|
|
36
|
-
"types": "./dist/static/checkout/util.d.ts",
|
|
37
43
|
"default": "./dist/static/checkout/util.js"
|
|
38
44
|
}
|
|
39
45
|
},
|
|
40
46
|
"devDependencies": {
|
|
41
47
|
"@swc/core": "1.11.29",
|
|
42
48
|
"@types/node": "latest",
|
|
49
|
+
"@types/react": "^18.0.0",
|
|
50
|
+
"react": "^18.0.0",
|
|
43
51
|
"tsup": "8.5.0",
|
|
44
52
|
"typescript": "latest",
|
|
45
53
|
"wrangler": "^4.19.1"
|
|
46
54
|
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"react": {
|
|
60
|
+
"optional": true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
47
63
|
"engines": {
|
|
48
64
|
"node": "22.x",
|
|
49
65
|
"pnpm": "9.15.9"
|
|
@@ -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};
|