@whop/checkout 0.0.23 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@ To embed checkout, you need to add the following script tag into the `<head>` of
10
10
  <script
11
11
  async
12
12
  defer
13
- src="https://cdn.jsdelivr.net/npm/@whop/checkout@0.0.21-canary.8/dist/loader.js"
13
+ src="https://js.whop.com/static/checkout/loader.js"
14
14
  ></script>
15
15
  ```
16
16
 
@@ -65,7 +65,7 @@ This can be used to attach metadata to a checkout by first creating a session th
65
65
  <script
66
66
  async
67
67
  defer
68
- src="https://cdn.jsdelivr.net/npm/@whop/checkout@0.0.21-canary.8/dist/loader.js"
68
+ src="https://js.whop.com/static/checkout/loader.js"
69
69
  ></script>
70
70
  <title>Whop embedded checkout example</title>
71
71
  <style>
@@ -80,7 +80,7 @@ This can be used to attach metadata to a checkout by first creating a session th
80
80
  <body>
81
81
  <div
82
82
  data-whop-checkout-plan-id="plan_XXXXXXXXX"
83
- data-whop-checkout-session-id="ch_XXXXXXXXX"
83
+ data-whop-checkout-session-id="ch_XXXXXXXXX"
84
84
  data-whop-checkout-theme="light"
85
85
  style="height: fit-content; overflow: hidden; max-width: 50%;"
86
86
  ></div>
@@ -0,0 +1 @@
1
+ "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function r(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var o=true;var a=false;var i,l;try{for(n=n.call(e);!(o=(i=n.next()).done);o=true){r.push(i.value);if(t&&r.length===t)break}}catch(e){a=true;l=e}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(a)throw l}}return r}function o(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(e,n){return t(e)||r(e,n)||l(e,n)||o()}function i(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}(function(){var e=function e(e){return i(e.data)=="object"&&e.data!==null&&"event"in e.data&&(e.data.event==="resize"||e.data.event==="center")};var t=function t(t){var n;function r(n){n.source===t.contentWindow&&e(n)&&(n.data.event==="resize"&&(t.style.height="".concat(n.data.height,"px")),n.data.event==="center"&&t.scrollIntoView({block:"center",inline:"center"}))}window.addEventListener("message",r),(n=window.wco)===null||n===void 0?void 0:n.frames.set(t,function(){window.removeEventListener("message",r)})};var r=function e(e){if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var r;var o=(r=e.dataset.whopCheckoutOrigin)!==null&&r!==void 0?r:"https://whop.com/",a=new URL("/embedded/checkout/".concat(n,"/"),o),i=e.dataset.whopCheckoutTheme;i&&a.searchParams.set("theme",i);var l=e.dataset.whopCheckoutSession;l&&a.searchParams.set("session",l);var u=new URL(window.location.href).origin;a.searchParams.set("h",u);var d=document.createElement("iframe");d.src=a.toString(),d.style.width="100%",d.style.height="480px",d.style.border="none",d.style.overflow="hidden",d.sandbox.add("allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"),d.allow="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;",e.dataset.whopCheckoutMounted="true",e.appendChild(d),t(d)};if((typeof window==="undefined"?"undefined":i(window))<"u"&&window.wco&&!window.wco.listening){var o=new MutationObserver(function(e){var t=true,o=false,i=undefined;try{for(var l=e[Symbol.iterator](),u;!(t=(u=l.next()).done);t=true){var d=u.value;var c,s;var f=true,w=false,v=undefined;try{for(var y=d.addedNodes[Symbol.iterator](),h;!(f=(h=y.next()).done);f=true){var m=h.value;n(m,HTMLElement)&&m.dataset.whopCheckoutPlanId&&r(m)}}catch(e){w=true;v=e}finally{try{if(!f&&y.return!=null){y.return()}}finally{if(w){throw v}}}var p=Array.from(d.removedNodes);var b;var g=true,S=false,k=undefined;try{for(var x=((b=(c=window.wco)===null||c===void 0?void 0:c.frames)!==null&&b!==void 0?b:[])[Symbol.iterator](),C;!(g=(C=x.next()).done);g=true){var A=a(C.value,2),I=A[0],L=A[1];p.includes(I)&&(L(),(s=window.wco)===null||s===void 0?void 0:s.frames.delete(I))}}catch(e){S=true;k=e}finally{try{if(!g&&x.return!=null){x.return()}}finally{if(S){throw k}}}}}catch(e){o=true;i=e}finally{try{if(!t&&l.return!=null){l.return()}}finally{if(o){throw i}}}});var l=true,u=false,d=undefined;try{for(var c=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),s;!(l=(s=c.next()).done);l=true){var f=s.value;n(f,HTMLElement)&&r(f)}}catch(e){u=true;d=e}finally{try{if(!l&&c.return!=null){c.return()}}finally{if(u){throw d}}}o.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}})();
@@ -1 +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,o=n===null||n===void 0?void 0:n.src;var d;(typeof window==="undefined"?"undefined":e(window))<"u"&&o&&((d=window.wco)!==null&&d!==void 0?d:window.wco=function(){var e=document.createElement("script");return e.src=o.replace(/loader\.js$/,"index.js"),e.async=!0,e.defer=!0,document.head.appendChild(e),{injected:!0,listening:!1}}())})();
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,o=n===null||n===void 0?void 0:n.src;var d;(typeof window==="undefined"?"undefined":e(window))<"u"&&o&&((d=window.wco)!==null&&d!==void 0?d:window.wco=function(){var e=document.createElement("script");return e.src=o.replace(/loader\.js$/,"index.js"),e.async=!0,e.defer=!0,document.head.appendChild(e),{injected:!0,listening:!1,frames:new Map}}())})();
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.23",
4
+ "version": "0.0.25",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/whopio/whop-sdk-ts",
@@ -22,15 +22,16 @@
22
22
  "files": [
23
23
  "dist"
24
24
  ],
25
+ "exports": {
26
+ ".": "./dist/static/checkout/index.js",
27
+ "./loader": "./dist/static/checkout/loader.js"
28
+ },
25
29
  "devDependencies": {
26
30
  "@swc/core": "1.11.29",
27
31
  "@types/node": "latest",
28
- "concurrently": "9.1.2",
29
- "dotenv": "16.5.0",
30
- "serve": "14.2.4",
31
- "ts-proto": "2.7.1",
32
32
  "tsup": "8.5.0",
33
- "typescript": "latest"
33
+ "typescript": "latest",
34
+ "wrangler": "^4.19.1"
34
35
  },
35
36
  "engines": {
36
37
  "node": "22.x",
@@ -41,10 +42,9 @@
41
42
  },
42
43
  "scripts": {
43
44
  "build": "tsup",
44
- "dev": "concurrently \"pnpm run dev:tsup\" \"pnpm run dev:serve\"",
45
- "dev:tsup": "tsup --watch",
46
- "dev:serve": "serve ./dist",
47
45
  "check-types": "tsc --noEmit",
46
+ "deploy": "wrangler deploy",
47
+ "dev": "wrangler dev --port 8000",
48
48
  "lint:fix": "biome check --write --unsafe"
49
49
  }
50
50
  }
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";function e(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function t(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function n(e){return t(e.data)=="object"&&e.data!==null&&"event"in e.data&&e.data.event==="resize"}function o(e){window.addEventListener("message",function(t){t.source===e.contentWindow&&n(t)&&t.data.event==="resize"&&(e.style.height="".concat(t.data.height,"px"))})}function a(e){if(e.dataset.whopCheckoutMounted)return;var t=e.dataset.whopCheckoutPlanId;if(!t)return;var n;var a=(n=e.dataset.whopCheckoutOrigin)!==null&&n!==void 0?n:"https://whop.com/",r=new URL("/embedded/checkout/".concat(t,"/"),a),i=e.dataset.whopCheckoutTheme;i&&r.searchParams.set("theme",i);var l=e.dataset.whopCheckoutSession;l&&r.searchParams.set("session",l);var d=new URL(window.location.href).origin;r.searchParams.set("h",d);var u=document.createElement("iframe");u.src=r.toString(),u.style.width="100%",u.style.height="480px",u.style.border="none",u.style.overflow="hidden",u.sandbox.add("allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"),u.allow="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;",e.dataset.whopCheckoutMounted="true",e.appendChild(u),o(u)}if((typeof window==="undefined"?"undefined":t(window))<"u"&&window.wco&&!window.wco.listening){new MutationObserver(function(t){var n=true,o=false,r=undefined,i=true,l=false,d=undefined;try{for(var u=t[Symbol.iterator](),s;!(i=(s=u.next()).done);i=true){var c=s.value;try{for(var w=c.addedNodes[Symbol.iterator](),f;!(n=(f=w.next()).done);n=true){var h=f.value;e(h,HTMLElement)&&h.dataset.whopCheckoutPlanId&&a(h)}}catch(e){o=true;r=e}finally{try{if(!n&&w.return!=null){w.return()}}finally{if(o){throw r}}}}}catch(e){l=true;d=e}finally{try{if(!i&&u.return!=null){u.return()}}finally{if(l){throw d}}}}).observe(document.body,{childList:!0,subtree:!0});var r=true,i=false,l=undefined;try{for(var d=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),u;!(r=(u=d.next()).done);r=true){var s=u.value;e(s,HTMLElement)&&a(s)}}catch(e){i=true;l=e}finally{try{if(!r&&d.return!=null){d.return()}}finally{if(i){throw l}}}window.wco.listening=!0}
package/dist/index.d.mts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }
package/dist/index.html DELETED
@@ -1,21 +0,0 @@
1
- <!DOCTYPE html>
2
- <html style="height: 100%">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width">
6
- <script src="http://localhost:3000/loader.js"></script>
7
- <title>Whop embedded checkout</title>
8
- <style>
9
- div {
10
- box-sizing: border-box;
11
- }
12
- body {
13
- margin: 0
14
- }
15
- </style>
16
- </head>
17
- <body style="display: flex; height: fit-content; width: 100%">
18
- <div style="flex: 1; height: fit-content; overflow: hidden; max-width: 50%;" data-whop-checkout-theme="light" data-whop-checkout-origin="http://localhost:8004" data-whop-checkout-plan-id="plan_ziYsgX0C9r4rG"></div>
19
- <div style="flex: 1; height: fit-content; overflow: hidden; max-width: 50%;" data-whop-checkout-theme="light" data-whop-checkout-origin="http://localhost:8004" data-whop-checkout-plan-id="plan_ziYsgX0C9r4rG"></div>
20
- </body>
21
- </html>
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";function e(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function t(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}(function(){var n=function e(e){return t(e.data)=="object"&&e.data!==null&&"event"in e.data&&e.data.event==="resize"};var o=function e(e){window.addEventListener("message",function(t){t.source===e.contentWindow&&n(t)&&t.data.event==="resize"&&(e.style.height="".concat(t.data.height,"px"))})};var a=function e(e){if(e.dataset.whopCheckoutMounted)return;var t=e.dataset.whopCheckoutPlanId;if(!t)return;var n;var a=(n=e.dataset.whopCheckoutOrigin)!==null&&n!==void 0?n:"https://whop.com/",r=new URL("/embedded/checkout/".concat(t,"/"),a),i=e.dataset.whopCheckoutTheme;i&&r.searchParams.set("theme",i);var l=e.dataset.whopCheckoutSession;l&&r.searchParams.set("session",l);var d=new URL(window.location.href).origin;r.searchParams.set("h",d);var u=document.createElement("iframe");u.src=r.toString(),u.style.width="100%",u.style.height="480px",u.style.border="none",u.style.overflow="hidden",u.sandbox.add("allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"),u.allow="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;",e.dataset.whopCheckoutMounted="true",e.appendChild(u),o(u)};if((typeof window==="undefined"?"undefined":t(window))<"u"&&window.wco&&!window.wco.listening){new MutationObserver(function(t){var n=true,o=false,r=undefined,i=true,l=false,d=undefined;try{for(var u=t[Symbol.iterator](),s;!(i=(s=u.next()).done);i=true){var c=s.value;try{for(var w=c.addedNodes[Symbol.iterator](),f;!(n=(f=w.next()).done);n=true){var h=f.value;e(h,HTMLElement)&&h.dataset.whopCheckoutPlanId&&a(h)}}catch(e){o=true;r=e}finally{try{if(!n&&w.return!=null){w.return()}}finally{if(o){throw r}}}}}catch(e){l=true;d=e}finally{try{if(!i&&u.return!=null){u.return()}}finally{if(l){throw d}}}}).observe(document.body,{childList:!0,subtree:!0});var r=true,i=false,l=undefined;try{for(var d=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),u;!(r=(u=d.next()).done);r=true){var s=u.value;e(s,HTMLElement)&&a(s)}}catch(e){i=true;l=e}finally{try{if(!r&&d.return!=null){d.return()}}finally{if(i){throw l}}}window.wco.listening=!0}})();
package/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
- function e(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function t(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function n(e){return t(e.data)=="object"&&e.data!==null&&"event"in e.data&&e.data.event==="resize"}function o(e){window.addEventListener("message",function(t){t.source===e.contentWindow&&n(t)&&t.data.event==="resize"&&(e.style.height="".concat(t.data.height,"px"))})}function a(e){if(e.dataset.whopCheckoutMounted)return;var t=e.dataset.whopCheckoutPlanId;if(!t)return;var n;var a=(n=e.dataset.whopCheckoutOrigin)!==null&&n!==void 0?n:"https://whop.com/",r=new URL("/embedded/checkout/".concat(t,"/"),a),l=e.dataset.whopCheckoutTheme;l&&r.searchParams.set("theme",l);var i=e.dataset.whopCheckoutSession;i&&r.searchParams.set("session",i);var d=new URL(window.location.href).origin;r.searchParams.set("h",d);var u=document.createElement("iframe");u.src=r.toString(),u.style.width="100%",u.style.height="480px",u.style.border="none",u.style.overflow="hidden",u.sandbox.add("allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"),u.allow="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;",e.dataset.whopCheckoutMounted="true",e.appendChild(u),o(u)}if((typeof window==="undefined"?"undefined":t(window))<"u"&&window.wco&&!window.wco.listening){new MutationObserver(function(t){var n=true,o=false,r=undefined,l=true,i=false,d=undefined;try{for(var u=t[Symbol.iterator](),s;!(l=(s=u.next()).done);l=true){var c=s.value;try{for(var w=c.addedNodes[Symbol.iterator](),f;!(n=(f=w.next()).done);n=true){var h=f.value;e(h,HTMLElement)&&h.dataset.whopCheckoutPlanId&&a(h)}}catch(e){o=true;r=e}finally{try{if(!n&&w.return!=null){w.return()}}finally{if(o){throw r}}}}}catch(e){i=true;d=e}finally{try{if(!l&&u.return!=null){u.return()}}finally{if(i){throw d}}}}).observe(document.body,{childList:!0,subtree:!0});var r=true,l=false,i=undefined;try{for(var d=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),u;!(r=(u=d.next()).done);r=true){var s=u.value;e(s,HTMLElement)&&a(s)}}catch(e){l=true;i=e}finally{try{if(!r&&d.return!=null){d.return()}}finally{if(l){throw i}}}window.wco.listening=!0}
package/dist/loader.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var n=document.currentScript,o=n===null||n===void 0?void 0:n.src;var d;(typeof window==="undefined"?"undefined":e(window))<"u"&&o&&((d=window.wco)!==null&&d!==void 0?d:window.wco=function(){var e=document.createElement("script");return e.src=o.replace(/loader\.js$/,"index.js"),e.async=!0,e.defer=!0,document.head.appendChild(e),{injected:!0,listening:!1}}());
package/dist/loader.d.mts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }
package/dist/loader.mjs DELETED
@@ -1 +0,0 @@
1
- function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var n=document.currentScript,o=n===null||n===void 0?void 0:n.src;var d;(typeof window==="undefined"?"undefined":e(window))<"u"&&o&&((d=window.wco)!==null&&d!==void 0?d:window.wco=function(){var e=document.createElement("script");return e.src=o.replace(/loader\.js$/,"index.js"),e.async=!0,e.defer=!0,document.head.appendChild(e),{injected:!0,listening:!1}}());
File without changes