@usethrottle/checkout-react 0.1.0
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 +41 -0
- package/dist/index.cjs +76 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @usethrottle/checkout-react
|
|
2
|
+
|
|
3
|
+
React component for embedding Throttle checkout in your app.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @usethrottle/checkout-react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { ThrottleCheckout } from '@usethrottle/checkout-react';
|
|
15
|
+
|
|
16
|
+
export function CheckoutPage({ sessionId }: { sessionId: string }) {
|
|
17
|
+
return (
|
|
18
|
+
<ThrottleCheckout
|
|
19
|
+
sessionId={sessionId}
|
|
20
|
+
onCompleted={(orderId, paymentId) => {
|
|
21
|
+
// navigate to thank-you page, clear cart, etc.
|
|
22
|
+
}}
|
|
23
|
+
onError={(code, message) => {
|
|
24
|
+
// surface to user
|
|
25
|
+
}}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The component renders an iframe pointed at `https://throttle-checkout-web.onrender.com/c/<sessionId>?embed=1`. Override `baseUrl` to point at a different deployment.
|
|
32
|
+
|
|
33
|
+
## Events
|
|
34
|
+
|
|
35
|
+
| Event | Callback | Payload |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `throttle.ready` | `onReady` | — |
|
|
38
|
+
| `throttle.resize` | (auto-handled, resizes iframe) | `{ height: number }` |
|
|
39
|
+
| `throttle.completed` | `onCompleted(orderId, paymentId)` | `{ orderId, paymentId }` |
|
|
40
|
+
| `throttle.cancelled` | `onCancelled` | — |
|
|
41
|
+
| `throttle.error` | `onError(code, message)` | `{ code, message }` |
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.tsx
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
ThrottleCheckout: () => ThrottleCheckout
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var DEFAULT_BASE_URL = "https://throttle-checkout-web.onrender.com";
|
|
29
|
+
function ThrottleCheckout({
|
|
30
|
+
sessionId,
|
|
31
|
+
baseUrl = DEFAULT_BASE_URL,
|
|
32
|
+
initialHeight = 480,
|
|
33
|
+
className,
|
|
34
|
+
style,
|
|
35
|
+
onReady,
|
|
36
|
+
onCompleted,
|
|
37
|
+
onCancelled,
|
|
38
|
+
onError
|
|
39
|
+
}) {
|
|
40
|
+
const iframeRef = (0, import_react.useRef)(null);
|
|
41
|
+
(0, import_react.useEffect)(() => {
|
|
42
|
+
function handle(ev) {
|
|
43
|
+
const data = ev?.data;
|
|
44
|
+
if (!data || typeof data !== "object" || typeof data.type !== "string") return;
|
|
45
|
+
if (!data.type.startsWith("throttle.")) return;
|
|
46
|
+
if (iframeRef.current && ev.source !== iframeRef.current.contentWindow) return;
|
|
47
|
+
if (data.type === "throttle.resize" && typeof data.height === "number" && iframeRef.current) {
|
|
48
|
+
iframeRef.current.style.height = `${data.height}px`;
|
|
49
|
+
}
|
|
50
|
+
if (data.type === "throttle.ready") onReady?.();
|
|
51
|
+
else if (data.type === "throttle.completed") onCompleted?.(data.orderId, data.paymentId);
|
|
52
|
+
else if (data.type === "throttle.cancelled") onCancelled?.();
|
|
53
|
+
else if (data.type === "throttle.error") onError?.(data.code, data.message);
|
|
54
|
+
}
|
|
55
|
+
window.addEventListener("message", handle);
|
|
56
|
+
return () => window.removeEventListener("message", handle);
|
|
57
|
+
}, [onReady, onCompleted, onCancelled, onError]);
|
|
58
|
+
const cleanBase = baseUrl.replace(/\/$/, "");
|
|
59
|
+
const src = `${cleanBase}/c/${encodeURIComponent(sessionId)}?embed=1`;
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
|
+
"iframe",
|
|
62
|
+
{
|
|
63
|
+
ref: iframeRef,
|
|
64
|
+
src,
|
|
65
|
+
className,
|
|
66
|
+
style: { border: 0, width: "100%", minHeight: initialHeight, ...style },
|
|
67
|
+
allow: "payment *",
|
|
68
|
+
title: "Throttle checkout"
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
ThrottleCheckout
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nexport interface ThrottleCheckoutProps {\n /** The throttle checkout session id (sess_*). Required. */\n sessionId: string;\n /** Base URL of the deployed checkout-web app. Defaults to https://throttle-checkout-web.onrender.com */\n baseUrl?: string;\n /** Initial iframe height in pixels. Auto-resizes on throttle.resize events. */\n initialHeight?: number;\n /** Optional className for the iframe. */\n className?: string;\n /** Optional inline style for the iframe. */\n style?: React.CSSProperties;\n /** Fires once the iframe is ready to receive interactions. */\n onReady?: () => void;\n /** Fires after a successful payment. */\n onCompleted?: (orderId: string, paymentId: string) => void;\n /** Fires when the buyer cancels checkout. */\n onCancelled?: () => void;\n /** Fires on any error inside the iframe (Gr4vy decline, network, etc.). */\n onError?: (code: string, message: string) => void;\n}\n\nconst DEFAULT_BASE_URL = 'https://throttle-checkout-web.onrender.com';\n\n/**\n * Embedded Throttle checkout for React apps.\n *\n * Renders an iframe pointed at <baseUrl>/c/<sessionId>?embed=1 and\n * subscribes to the postMessage v1 protocol. Events fire on the\n * provided callbacks. Auto-resizes the iframe on throttle.resize.\n */\nexport function ThrottleCheckout({\n sessionId,\n baseUrl = DEFAULT_BASE_URL,\n initialHeight = 480,\n className,\n style,\n onReady,\n onCompleted,\n onCancelled,\n onError,\n}: ThrottleCheckoutProps) {\n const iframeRef = useRef<HTMLIFrameElement>(null);\n\n useEffect(() => {\n function handle(ev: MessageEvent) {\n const data = ev?.data;\n if (!data || typeof data !== 'object' || typeof data.type !== 'string') return;\n if (!data.type.startsWith('throttle.')) return;\n if (iframeRef.current && ev.source !== iframeRef.current.contentWindow) return;\n\n if (data.type === 'throttle.resize' && typeof data.height === 'number' && iframeRef.current) {\n iframeRef.current.style.height = `${data.height}px`;\n }\n if (data.type === 'throttle.ready') onReady?.();\n else if (data.type === 'throttle.completed') onCompleted?.(data.orderId, data.paymentId);\n else if (data.type === 'throttle.cancelled') onCancelled?.();\n else if (data.type === 'throttle.error') onError?.(data.code, data.message);\n }\n window.addEventListener('message', handle);\n return () => window.removeEventListener('message', handle);\n }, [onReady, onCompleted, onCancelled, onError]);\n\n const cleanBase = baseUrl.replace(/\\/$/, '');\n const src = `${cleanBase}/c/${encodeURIComponent(sessionId)}?embed=1`;\n\n return (\n <iframe\n ref={iframeRef}\n src={src}\n className={className}\n style={{ border: 0, width: '100%', minHeight: initialHeight, ...style }}\n allow=\"payment *\"\n title=\"Throttle checkout\"\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AAoE9B;AA7CJ,IAAM,mBAAmB;AASlB,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA0B;AACxB,QAAM,gBAAY,qBAA0B,IAAI;AAEhD,8BAAU,MAAM;AACd,aAAS,OAAO,IAAkB;AAChC,YAAM,OAAO,IAAI;AACjB,UAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,OAAO,KAAK,SAAS,SAAU;AACxE,UAAI,CAAC,KAAK,KAAK,WAAW,WAAW,EAAG;AACxC,UAAI,UAAU,WAAW,GAAG,WAAW,UAAU,QAAQ,cAAe;AAExE,UAAI,KAAK,SAAS,qBAAqB,OAAO,KAAK,WAAW,YAAY,UAAU,SAAS;AAC3F,kBAAU,QAAQ,MAAM,SAAS,GAAG,KAAK,MAAM;AAAA,MACjD;AACA,UAAI,KAAK,SAAS,iBAAkB,WAAU;AAAA,eACrC,KAAK,SAAS,qBAAsB,eAAc,KAAK,SAAS,KAAK,SAAS;AAAA,eAC9E,KAAK,SAAS,qBAAsB,eAAc;AAAA,eAClD,KAAK,SAAS,iBAAkB,WAAU,KAAK,MAAM,KAAK,OAAO;AAAA,IAC5E;AACA,WAAO,iBAAiB,WAAW,MAAM;AACzC,WAAO,MAAM,OAAO,oBAAoB,WAAW,MAAM;AAAA,EAC3D,GAAG,CAAC,SAAS,aAAa,aAAa,OAAO,CAAC;AAE/C,QAAM,YAAY,QAAQ,QAAQ,OAAO,EAAE;AAC3C,QAAM,MAAM,GAAG,SAAS,MAAM,mBAAmB,SAAS,CAAC;AAE3D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,OAAO,EAAE,QAAQ,GAAG,OAAO,QAAQ,WAAW,eAAe,GAAG,MAAM;AAAA,MACtE,OAAM;AAAA,MACN,OAAM;AAAA;AAAA,EACR;AAEJ;","names":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface ThrottleCheckoutProps {
|
|
4
|
+
/** The throttle checkout session id (sess_*). Required. */
|
|
5
|
+
sessionId: string;
|
|
6
|
+
/** Base URL of the deployed checkout-web app. Defaults to https://throttle-checkout-web.onrender.com */
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
/** Initial iframe height in pixels. Auto-resizes on throttle.resize events. */
|
|
9
|
+
initialHeight?: number;
|
|
10
|
+
/** Optional className for the iframe. */
|
|
11
|
+
className?: string;
|
|
12
|
+
/** Optional inline style for the iframe. */
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
/** Fires once the iframe is ready to receive interactions. */
|
|
15
|
+
onReady?: () => void;
|
|
16
|
+
/** Fires after a successful payment. */
|
|
17
|
+
onCompleted?: (orderId: string, paymentId: string) => void;
|
|
18
|
+
/** Fires when the buyer cancels checkout. */
|
|
19
|
+
onCancelled?: () => void;
|
|
20
|
+
/** Fires on any error inside the iframe (Gr4vy decline, network, etc.). */
|
|
21
|
+
onError?: (code: string, message: string) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Embedded Throttle checkout for React apps.
|
|
25
|
+
*
|
|
26
|
+
* Renders an iframe pointed at <baseUrl>/c/<sessionId>?embed=1 and
|
|
27
|
+
* subscribes to the postMessage v1 protocol. Events fire on the
|
|
28
|
+
* provided callbacks. Auto-resizes the iframe on throttle.resize.
|
|
29
|
+
*/
|
|
30
|
+
declare function ThrottleCheckout({ sessionId, baseUrl, initialHeight, className, style, onReady, onCompleted, onCancelled, onError, }: ThrottleCheckoutProps): react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
export { ThrottleCheckout, type ThrottleCheckoutProps };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface ThrottleCheckoutProps {
|
|
4
|
+
/** The throttle checkout session id (sess_*). Required. */
|
|
5
|
+
sessionId: string;
|
|
6
|
+
/** Base URL of the deployed checkout-web app. Defaults to https://throttle-checkout-web.onrender.com */
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
/** Initial iframe height in pixels. Auto-resizes on throttle.resize events. */
|
|
9
|
+
initialHeight?: number;
|
|
10
|
+
/** Optional className for the iframe. */
|
|
11
|
+
className?: string;
|
|
12
|
+
/** Optional inline style for the iframe. */
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
/** Fires once the iframe is ready to receive interactions. */
|
|
15
|
+
onReady?: () => void;
|
|
16
|
+
/** Fires after a successful payment. */
|
|
17
|
+
onCompleted?: (orderId: string, paymentId: string) => void;
|
|
18
|
+
/** Fires when the buyer cancels checkout. */
|
|
19
|
+
onCancelled?: () => void;
|
|
20
|
+
/** Fires on any error inside the iframe (Gr4vy decline, network, etc.). */
|
|
21
|
+
onError?: (code: string, message: string) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Embedded Throttle checkout for React apps.
|
|
25
|
+
*
|
|
26
|
+
* Renders an iframe pointed at <baseUrl>/c/<sessionId>?embed=1 and
|
|
27
|
+
* subscribes to the postMessage v1 protocol. Events fire on the
|
|
28
|
+
* provided callbacks. Auto-resizes the iframe on throttle.resize.
|
|
29
|
+
*/
|
|
30
|
+
declare function ThrottleCheckout({ sessionId, baseUrl, initialHeight, className, style, onReady, onCompleted, onCancelled, onError, }: ThrottleCheckoutProps): react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
export { ThrottleCheckout, type ThrottleCheckoutProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/index.tsx
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var DEFAULT_BASE_URL = "https://throttle-checkout-web.onrender.com";
|
|
5
|
+
function ThrottleCheckout({
|
|
6
|
+
sessionId,
|
|
7
|
+
baseUrl = DEFAULT_BASE_URL,
|
|
8
|
+
initialHeight = 480,
|
|
9
|
+
className,
|
|
10
|
+
style,
|
|
11
|
+
onReady,
|
|
12
|
+
onCompleted,
|
|
13
|
+
onCancelled,
|
|
14
|
+
onError
|
|
15
|
+
}) {
|
|
16
|
+
const iframeRef = useRef(null);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
function handle(ev) {
|
|
19
|
+
const data = ev?.data;
|
|
20
|
+
if (!data || typeof data !== "object" || typeof data.type !== "string") return;
|
|
21
|
+
if (!data.type.startsWith("throttle.")) return;
|
|
22
|
+
if (iframeRef.current && ev.source !== iframeRef.current.contentWindow) return;
|
|
23
|
+
if (data.type === "throttle.resize" && typeof data.height === "number" && iframeRef.current) {
|
|
24
|
+
iframeRef.current.style.height = `${data.height}px`;
|
|
25
|
+
}
|
|
26
|
+
if (data.type === "throttle.ready") onReady?.();
|
|
27
|
+
else if (data.type === "throttle.completed") onCompleted?.(data.orderId, data.paymentId);
|
|
28
|
+
else if (data.type === "throttle.cancelled") onCancelled?.();
|
|
29
|
+
else if (data.type === "throttle.error") onError?.(data.code, data.message);
|
|
30
|
+
}
|
|
31
|
+
window.addEventListener("message", handle);
|
|
32
|
+
return () => window.removeEventListener("message", handle);
|
|
33
|
+
}, [onReady, onCompleted, onCancelled, onError]);
|
|
34
|
+
const cleanBase = baseUrl.replace(/\/$/, "");
|
|
35
|
+
const src = `${cleanBase}/c/${encodeURIComponent(sessionId)}?embed=1`;
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
"iframe",
|
|
38
|
+
{
|
|
39
|
+
ref: iframeRef,
|
|
40
|
+
src,
|
|
41
|
+
className,
|
|
42
|
+
style: { border: 0, width: "100%", minHeight: initialHeight, ...style },
|
|
43
|
+
allow: "payment *",
|
|
44
|
+
title: "Throttle checkout"
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
ThrottleCheckout
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nexport interface ThrottleCheckoutProps {\n /** The throttle checkout session id (sess_*). Required. */\n sessionId: string;\n /** Base URL of the deployed checkout-web app. Defaults to https://throttle-checkout-web.onrender.com */\n baseUrl?: string;\n /** Initial iframe height in pixels. Auto-resizes on throttle.resize events. */\n initialHeight?: number;\n /** Optional className for the iframe. */\n className?: string;\n /** Optional inline style for the iframe. */\n style?: React.CSSProperties;\n /** Fires once the iframe is ready to receive interactions. */\n onReady?: () => void;\n /** Fires after a successful payment. */\n onCompleted?: (orderId: string, paymentId: string) => void;\n /** Fires when the buyer cancels checkout. */\n onCancelled?: () => void;\n /** Fires on any error inside the iframe (Gr4vy decline, network, etc.). */\n onError?: (code: string, message: string) => void;\n}\n\nconst DEFAULT_BASE_URL = 'https://throttle-checkout-web.onrender.com';\n\n/**\n * Embedded Throttle checkout for React apps.\n *\n * Renders an iframe pointed at <baseUrl>/c/<sessionId>?embed=1 and\n * subscribes to the postMessage v1 protocol. Events fire on the\n * provided callbacks. Auto-resizes the iframe on throttle.resize.\n */\nexport function ThrottleCheckout({\n sessionId,\n baseUrl = DEFAULT_BASE_URL,\n initialHeight = 480,\n className,\n style,\n onReady,\n onCompleted,\n onCancelled,\n onError,\n}: ThrottleCheckoutProps) {\n const iframeRef = useRef<HTMLIFrameElement>(null);\n\n useEffect(() => {\n function handle(ev: MessageEvent) {\n const data = ev?.data;\n if (!data || typeof data !== 'object' || typeof data.type !== 'string') return;\n if (!data.type.startsWith('throttle.')) return;\n if (iframeRef.current && ev.source !== iframeRef.current.contentWindow) return;\n\n if (data.type === 'throttle.resize' && typeof data.height === 'number' && iframeRef.current) {\n iframeRef.current.style.height = `${data.height}px`;\n }\n if (data.type === 'throttle.ready') onReady?.();\n else if (data.type === 'throttle.completed') onCompleted?.(data.orderId, data.paymentId);\n else if (data.type === 'throttle.cancelled') onCancelled?.();\n else if (data.type === 'throttle.error') onError?.(data.code, data.message);\n }\n window.addEventListener('message', handle);\n return () => window.removeEventListener('message', handle);\n }, [onReady, onCompleted, onCancelled, onError]);\n\n const cleanBase = baseUrl.replace(/\\/$/, '');\n const src = `${cleanBase}/c/${encodeURIComponent(sessionId)}?embed=1`;\n\n return (\n <iframe\n ref={iframeRef}\n src={src}\n className={className}\n style={{ border: 0, width: '100%', minHeight: initialHeight, ...style }}\n allow=\"payment *\"\n title=\"Throttle checkout\"\n />\n );\n}\n"],"mappings":";AAAA,SAAS,WAAW,cAAc;AAoE9B;AA7CJ,IAAM,mBAAmB;AASlB,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA0B;AACxB,QAAM,YAAY,OAA0B,IAAI;AAEhD,YAAU,MAAM;AACd,aAAS,OAAO,IAAkB;AAChC,YAAM,OAAO,IAAI;AACjB,UAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,OAAO,KAAK,SAAS,SAAU;AACxE,UAAI,CAAC,KAAK,KAAK,WAAW,WAAW,EAAG;AACxC,UAAI,UAAU,WAAW,GAAG,WAAW,UAAU,QAAQ,cAAe;AAExE,UAAI,KAAK,SAAS,qBAAqB,OAAO,KAAK,WAAW,YAAY,UAAU,SAAS;AAC3F,kBAAU,QAAQ,MAAM,SAAS,GAAG,KAAK,MAAM;AAAA,MACjD;AACA,UAAI,KAAK,SAAS,iBAAkB,WAAU;AAAA,eACrC,KAAK,SAAS,qBAAsB,eAAc,KAAK,SAAS,KAAK,SAAS;AAAA,eAC9E,KAAK,SAAS,qBAAsB,eAAc;AAAA,eAClD,KAAK,SAAS,iBAAkB,WAAU,KAAK,MAAM,KAAK,OAAO;AAAA,IAC5E;AACA,WAAO,iBAAiB,WAAW,MAAM;AACzC,WAAO,MAAM,OAAO,oBAAoB,WAAW,MAAM;AAAA,EAC3D,GAAG,CAAC,SAAS,aAAa,aAAa,OAAO,CAAC;AAE/C,QAAM,YAAY,QAAQ,QAAQ,OAAO,EAAE;AAC3C,QAAM,MAAM,GAAG,SAAS,MAAM,mBAAmB,SAAS,CAAC;AAE3D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,OAAO,EAAE,QAAQ,GAAG,OAAO,QAAQ,WAAW,eAAe,GAAG,MAAM;AAAA,MACtE,OAAM;AAAA,MACN,OAAM;AAAA;AAAA,EACR;AAEJ;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@usethrottle/checkout-react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React component for embedded Throttle checkout",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": ["dist", "README.md"],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsup",
|
|
19
|
+
"dev": "tsup --watch",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"react": ">=18"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@testing-library/react": "^16.1.0",
|
|
28
|
+
"@types/react": "^19.1.0",
|
|
29
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
30
|
+
"jsdom": "^25.0.1",
|
|
31
|
+
"react": "^19.1.0",
|
|
32
|
+
"react-dom": "^19.1.0",
|
|
33
|
+
"tsup": "^8.0.0",
|
|
34
|
+
"typescript": "^5.7.0",
|
|
35
|
+
"vitest": "^2.1.9"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
}
|
|
40
|
+
}
|