intrpay-payments 1.0.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 +91 -0
- package/dist/index.cjs +207 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +41 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +180 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# intrpay-payment-package
|
|
2
|
+
|
|
3
|
+
A lightweight React drawer component with an embedded iframe for payment integration.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install intrpay-payment-package
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { useState } from "react";
|
|
15
|
+
import { PaymentDrawer } from "intrpay-payment-package";
|
|
16
|
+
|
|
17
|
+
function App() {
|
|
18
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<button onClick={() => setIsOpen(true)}>Open Payment</button>
|
|
23
|
+
|
|
24
|
+
<PaymentDrawer
|
|
25
|
+
isOpen={isOpen}
|
|
26
|
+
onClose={() => setIsOpen(false)}
|
|
27
|
+
paymentLinkId="your-payment-link-id"
|
|
28
|
+
params={{
|
|
29
|
+
amount: 99.99,
|
|
30
|
+
firstName: "John",
|
|
31
|
+
lastName: "Doe",
|
|
32
|
+
email: "john@example.com",
|
|
33
|
+
}}
|
|
34
|
+
/>
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
### PaymentDrawerProps
|
|
43
|
+
|
|
44
|
+
| Prop | Type | Default | Description |
|
|
45
|
+
| --------------------- | ------------------- | --------- | ------------------------------------------ |
|
|
46
|
+
| `isOpen` | `boolean` | required | Whether the drawer is open |
|
|
47
|
+
| `onClose` | `() => void` | required | Callback when the drawer should close |
|
|
48
|
+
| `paymentLinkId` | `string` | required | Payment link ID |
|
|
49
|
+
| `params` | `PaymentParams` | - | Payment parameters (see below) |
|
|
50
|
+
| `width` | `string \| number` | `400` | Width of the drawer |
|
|
51
|
+
| `position` | `'left' \| 'right'` | `'right'` | Position of the drawer |
|
|
52
|
+
| `showOverlay` | `boolean` | `true` | Whether to show overlay backdrop |
|
|
53
|
+
| `closeOnOverlayClick` | `boolean` | `true` | Whether clicking overlay closes the drawer |
|
|
54
|
+
| `zIndex` | `number` | `1000` | Z-index for the drawer |
|
|
55
|
+
|
|
56
|
+
### PaymentParams
|
|
57
|
+
|
|
58
|
+
| Param | Type | Description |
|
|
59
|
+
| ----------------- | ----------------------------- | ------------------------------------- |
|
|
60
|
+
| `amount` | `number` | Payment amount |
|
|
61
|
+
| `firstName` | `string` | Customer's first name |
|
|
62
|
+
| `lastName` | `string` | Customer's last name |
|
|
63
|
+
| `email` | `string` | Customer's email |
|
|
64
|
+
| `phone` | `string` | Customer's phone number |
|
|
65
|
+
| `companyName` | `string` | Company name |
|
|
66
|
+
| `showContactForm` | `boolean` | Whether to show the contact form |
|
|
67
|
+
| `currency` | `string` | Currency code (e.g., 'USD', 'EUR') |
|
|
68
|
+
| `reference` | `string` | Custom reference/order ID |
|
|
69
|
+
| `redirectUrl` | `string` | Redirect URL after successful payment |
|
|
70
|
+
| `[key: string]` | `string \| number \| boolean` | Additional custom parameters |
|
|
71
|
+
|
|
72
|
+
## Development
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Install dependencies
|
|
76
|
+
npm install
|
|
77
|
+
|
|
78
|
+
# Build the library
|
|
79
|
+
npm run build
|
|
80
|
+
|
|
81
|
+
# Watch mode
|
|
82
|
+
npm run dev
|
|
83
|
+
|
|
84
|
+
# Lint
|
|
85
|
+
npm run lint
|
|
86
|
+
npm run lint:fix
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
ISC
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
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.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
PaymentDrawer: () => PaymentDrawer
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/PaymentDrawer.tsx
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
var BASE_URL = "https://pay.intrpay.us";
|
|
31
|
+
var baseParams = {
|
|
32
|
+
showHeader: false
|
|
33
|
+
};
|
|
34
|
+
function PaymentDrawer({
|
|
35
|
+
isOpen,
|
|
36
|
+
onClose,
|
|
37
|
+
paymentLinkId,
|
|
38
|
+
params,
|
|
39
|
+
width = 400,
|
|
40
|
+
position = "right",
|
|
41
|
+
showOverlay = true,
|
|
42
|
+
closeOnOverlayClick = true,
|
|
43
|
+
zIndex = 1e3
|
|
44
|
+
}) {
|
|
45
|
+
const iframeUrl = (0, import_react.useMemo)(() => {
|
|
46
|
+
const url = new URL(`${BASE_URL}/${paymentLinkId}`);
|
|
47
|
+
const combinedParams = { ...baseParams, ...params };
|
|
48
|
+
Object.entries(combinedParams).forEach(([key, value]) => {
|
|
49
|
+
if (value !== void 0 && value !== null && value !== "") {
|
|
50
|
+
url.searchParams.set(key, String(value));
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return url.toString();
|
|
54
|
+
}, [paymentLinkId, params]);
|
|
55
|
+
const handleKeyDown = (0, import_react.useCallback)(
|
|
56
|
+
(event) => {
|
|
57
|
+
if (event.key === "Escape" && isOpen) {
|
|
58
|
+
onClose();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
[isOpen, onClose]
|
|
62
|
+
);
|
|
63
|
+
(0, import_react.useEffect)(() => {
|
|
64
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
65
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
66
|
+
}, [handleKeyDown]);
|
|
67
|
+
(0, import_react.useEffect)(() => {
|
|
68
|
+
if (isOpen) {
|
|
69
|
+
document.body.style.overflow = "hidden";
|
|
70
|
+
} else {
|
|
71
|
+
document.body.style.overflow = "";
|
|
72
|
+
}
|
|
73
|
+
return () => {
|
|
74
|
+
document.body.style.overflow = "";
|
|
75
|
+
};
|
|
76
|
+
}, [isOpen]);
|
|
77
|
+
const handleOverlayClick = () => {
|
|
78
|
+
if (closeOnOverlayClick) {
|
|
79
|
+
onClose();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const drawerWidth = typeof width === "number" ? `${width}px` : width;
|
|
83
|
+
const styles = {
|
|
84
|
+
overlay: {
|
|
85
|
+
position: "fixed",
|
|
86
|
+
top: 0,
|
|
87
|
+
left: 0,
|
|
88
|
+
right: 0,
|
|
89
|
+
bottom: 0,
|
|
90
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
91
|
+
zIndex,
|
|
92
|
+
opacity: isOpen ? 1 : 0,
|
|
93
|
+
visibility: isOpen ? "visible" : "hidden",
|
|
94
|
+
transition: "opacity 0.3s ease, visibility 0.3s ease"
|
|
95
|
+
},
|
|
96
|
+
drawer: {
|
|
97
|
+
position: "fixed",
|
|
98
|
+
top: 0,
|
|
99
|
+
bottom: 0,
|
|
100
|
+
[position]: 0,
|
|
101
|
+
width: drawerWidth,
|
|
102
|
+
maxWidth: "100%",
|
|
103
|
+
backgroundColor: "#ffffff",
|
|
104
|
+
zIndex: zIndex + 1,
|
|
105
|
+
boxShadow: position === "right" ? "-4px 0 20px rgba(0, 0, 0, 0.15)" : "4px 0 20px rgba(0, 0, 0, 0.15)",
|
|
106
|
+
transform: isOpen ? "translateX(0)" : `translateX(${position === "right" ? "100%" : "-100%"})`,
|
|
107
|
+
transition: "transform 0.3s ease",
|
|
108
|
+
display: "flex",
|
|
109
|
+
flexDirection: "column"
|
|
110
|
+
},
|
|
111
|
+
closeButton: {
|
|
112
|
+
position: "absolute",
|
|
113
|
+
top: 12,
|
|
114
|
+
right: 12,
|
|
115
|
+
width: 36,
|
|
116
|
+
height: 36,
|
|
117
|
+
border: "none",
|
|
118
|
+
backgroundColor: "#f3f4f6",
|
|
119
|
+
borderRadius: "50%",
|
|
120
|
+
cursor: "pointer",
|
|
121
|
+
display: "flex",
|
|
122
|
+
alignItems: "center",
|
|
123
|
+
justifyContent: "center",
|
|
124
|
+
color: "#6b7280",
|
|
125
|
+
zIndex: 1
|
|
126
|
+
},
|
|
127
|
+
content: {
|
|
128
|
+
flex: 1,
|
|
129
|
+
overflow: "hidden",
|
|
130
|
+
paddingTop: 60
|
|
131
|
+
},
|
|
132
|
+
iframe: {
|
|
133
|
+
width: "100%",
|
|
134
|
+
height: "100%",
|
|
135
|
+
border: "none"
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
139
|
+
showOverlay && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
140
|
+
"div",
|
|
141
|
+
{
|
|
142
|
+
style: styles.overlay,
|
|
143
|
+
onClick: handleOverlayClick,
|
|
144
|
+
"aria-hidden": "true"
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
style: styles.drawer,
|
|
151
|
+
role: "dialog",
|
|
152
|
+
"aria-modal": "true",
|
|
153
|
+
"aria-label": "Payment",
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
|
+
"button",
|
|
157
|
+
{
|
|
158
|
+
style: styles.closeButton,
|
|
159
|
+
onClick: onClose,
|
|
160
|
+
"aria-label": "Close drawer",
|
|
161
|
+
type: "button",
|
|
162
|
+
onMouseEnter: (e) => {
|
|
163
|
+
e.currentTarget.style.backgroundColor = "#e5e7eb";
|
|
164
|
+
e.currentTarget.style.color = "#374151";
|
|
165
|
+
},
|
|
166
|
+
onMouseLeave: (e) => {
|
|
167
|
+
e.currentTarget.style.backgroundColor = "#f3f4f6";
|
|
168
|
+
e.currentTarget.style.color = "#6b7280";
|
|
169
|
+
},
|
|
170
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
171
|
+
"svg",
|
|
172
|
+
{
|
|
173
|
+
width: "24",
|
|
174
|
+
height: "24",
|
|
175
|
+
viewBox: "0 0 24 24",
|
|
176
|
+
fill: "none",
|
|
177
|
+
stroke: "currentColor",
|
|
178
|
+
strokeWidth: "2",
|
|
179
|
+
strokeLinecap: "round",
|
|
180
|
+
strokeLinejoin: "round",
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
183
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: styles.content, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
190
|
+
"iframe",
|
|
191
|
+
{
|
|
192
|
+
src: isOpen ? iframeUrl : "about:blank",
|
|
193
|
+
title: "Payment",
|
|
194
|
+
style: styles.iframe,
|
|
195
|
+
allow: "payment; clipboard-write"
|
|
196
|
+
}
|
|
197
|
+
) })
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
] });
|
|
202
|
+
}
|
|
203
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
204
|
+
0 && (module.exports = {
|
|
205
|
+
PaymentDrawer
|
|
206
|
+
});
|
|
207
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/components/PaymentDrawer.tsx"],"sourcesContent":["export { PaymentDrawer } from './components/PaymentDrawer';\nexport type { PaymentDrawerProps, PaymentParams } from './components/PaymentDrawer';\n","import React, { useEffect, useCallback, useMemo, CSSProperties } from \"react\";\n\nconst BASE_URL = \"https://pay.intrpay.us\";\n\nconst baseParams = {\n showHeader: false,\n};\n\nexport interface PaymentParams {\n /** Payment amount */\n amount?: number;\n /** Customer's first name */\n firstName?: string;\n /** Customer's last name */\n lastName?: string;\n /** Customer's email */\n email?: string;\n /** Customer's phone number */\n phone?: string;\n /** Company name */\n companyName?: string;\n /** Whether to show the contact form */\n showContactForm?: boolean;\n /** Currency code (e.g., 'USD', 'EUR') */\n // currency?: string;\n // /** Custom reference/order ID */\n // reference?: string;\n // /** Redirect URL after successful payment */\n // redirectUrl?: string;\n // /** Additional custom parameters */\n // [key: string]: string | number | boolean | undefined;\n}\n\nexport interface PaymentDrawerProps {\n /** Whether the drawer is open */\n isOpen: boolean;\n /** Callback when the drawer should close */\n onClose: () => void;\n /** Payment link ID */\n paymentLinkId: string;\n /** Payment parameters to pass as URL query params */\n params?: PaymentParams;\n /** Width of the drawer (default: 400px) */\n width?: string | number;\n /** Position of the drawer */\n position?: \"left\" | \"right\";\n /** Whether to show overlay backdrop */\n showOverlay?: boolean;\n /** Whether clicking overlay closes the drawer */\n closeOnOverlayClick?: boolean;\n /** Z-index for the drawer */\n zIndex?: number;\n}\n\nexport function PaymentDrawer({\n isOpen,\n onClose,\n paymentLinkId,\n params,\n width = 400,\n position = \"right\",\n showOverlay = true,\n closeOnOverlayClick = true,\n zIndex = 1000,\n}: PaymentDrawerProps) {\n const iframeUrl = useMemo(() => {\n const url = new URL(`${BASE_URL}/${paymentLinkId}`);\n\n // Combine base params with user params (user params override base)\n const combinedParams = { ...baseParams, ...params };\n\n Object.entries(combinedParams).forEach(([key, value]) => {\n if (value !== undefined && value !== null && value !== \"\") {\n url.searchParams.set(key, String(value));\n }\n });\n\n return url.toString();\n }, [paymentLinkId, params]);\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === \"Escape\" && isOpen) {\n onClose();\n }\n },\n [isOpen, onClose],\n );\n\n useEffect(() => {\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => document.removeEventListener(\"keydown\", handleKeyDown);\n }, [handleKeyDown]);\n\n useEffect(() => {\n if (isOpen) {\n document.body.style.overflow = \"hidden\";\n } else {\n document.body.style.overflow = \"\";\n }\n return () => {\n document.body.style.overflow = \"\";\n };\n }, [isOpen]);\n\n const handleOverlayClick = () => {\n if (closeOnOverlayClick) {\n onClose();\n }\n };\n\n const drawerWidth = typeof width === \"number\" ? `${width}px` : width;\n\n const styles: Record<string, CSSProperties> = {\n overlay: {\n position: \"fixed\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: \"rgba(0, 0, 0, 0.5)\",\n zIndex,\n opacity: isOpen ? 1 : 0,\n visibility: isOpen ? \"visible\" : \"hidden\",\n transition: \"opacity 0.3s ease, visibility 0.3s ease\",\n },\n drawer: {\n position: \"fixed\",\n top: 0,\n bottom: 0,\n [position]: 0,\n width: drawerWidth,\n maxWidth: \"100%\",\n backgroundColor: \"#ffffff\",\n zIndex: zIndex + 1,\n boxShadow:\n position === \"right\"\n ? \"-4px 0 20px rgba(0, 0, 0, 0.15)\"\n : \"4px 0 20px rgba(0, 0, 0, 0.15)\",\n transform: isOpen\n ? \"translateX(0)\"\n : `translateX(${position === \"right\" ? \"100%\" : \"-100%\"})`,\n transition: \"transform 0.3s ease\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n closeButton: {\n position: \"absolute\",\n top: 12,\n right: 12,\n width: 36,\n height: 36,\n border: \"none\",\n backgroundColor: \"#f3f4f6\",\n borderRadius: \"50%\",\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n color: \"#6b7280\",\n zIndex: 1,\n },\n content: {\n flex: 1,\n overflow: \"hidden\",\n paddingTop: 60,\n },\n iframe: {\n width: \"100%\",\n height: \"100%\",\n border: \"none\",\n },\n };\n\n return (\n <>\n {showOverlay && (\n <div\n style={styles.overlay}\n onClick={handleOverlayClick}\n aria-hidden=\"true\"\n />\n )}\n <div\n style={styles.drawer}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Payment\"\n >\n <button\n style={styles.closeButton}\n onClick={onClose}\n aria-label=\"Close drawer\"\n type=\"button\"\n onMouseEnter={(e: React.MouseEvent<HTMLButtonElement>) => {\n e.currentTarget.style.backgroundColor = \"#e5e7eb\";\n e.currentTarget.style.color = \"#374151\";\n }}\n onMouseLeave={(e: React.MouseEvent<HTMLButtonElement>) => {\n e.currentTarget.style.backgroundColor = \"#f3f4f6\";\n e.currentTarget.style.color = \"#6b7280\";\n }}\n >\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n <div style={styles.content}>\n <iframe\n src={isOpen ? iframeUrl : \"about:blank\"}\n title=\"Payment\"\n style={styles.iframe}\n allow=\"payment; clipboard-write\"\n />\n </div>\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAsE;AA+KlE;AA7KJ,IAAM,WAAW;AAEjB,IAAM,aAAa;AAAA,EACjB,YAAY;AACd;AAgDO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,cAAc;AAAA,EACd,sBAAsB;AAAA,EACtB,SAAS;AACX,GAAuB;AACrB,QAAM,gBAAY,sBAAQ,MAAM;AAC9B,UAAM,MAAM,IAAI,IAAI,GAAG,QAAQ,IAAI,aAAa,EAAE;AAGlD,UAAM,iBAAiB,EAAE,GAAG,YAAY,GAAG,OAAO;AAElD,WAAO,QAAQ,cAAc,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACvD,UAAI,UAAU,UAAa,UAAU,QAAQ,UAAU,IAAI;AACzD,YAAI,aAAa,IAAI,KAAK,OAAO,KAAK,CAAC;AAAA,MACzC;AAAA,IACF,CAAC;AAED,WAAO,IAAI,SAAS;AAAA,EACtB,GAAG,CAAC,eAAe,MAAM,CAAC;AAE1B,QAAM,oBAAgB;AAAA,IACpB,CAAC,UAAyB;AACxB,UAAI,MAAM,QAAQ,YAAY,QAAQ;AACpC,gBAAQ;AAAA,MACV;AAAA,IACF;AAAA,IACA,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,UACF;AAAA,UACA,4CAAC,SAAI,OAAO,OAAO,SACjB;AAAA,YAAC;AAAA;AAAA,cACC,KAAK,SAAS,YAAY;AAAA,cAC1B,OAAM;AAAA,cACN,OAAO,OAAO;AAAA,cACd,OAAM;AAAA;AAAA,UACR,GACF;AAAA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface PaymentParams {
|
|
4
|
+
/** Payment amount */
|
|
5
|
+
amount?: number;
|
|
6
|
+
/** Customer's first name */
|
|
7
|
+
firstName?: string;
|
|
8
|
+
/** Customer's last name */
|
|
9
|
+
lastName?: string;
|
|
10
|
+
/** Customer's email */
|
|
11
|
+
email?: string;
|
|
12
|
+
/** Customer's phone number */
|
|
13
|
+
phone?: string;
|
|
14
|
+
/** Company name */
|
|
15
|
+
companyName?: string;
|
|
16
|
+
/** Whether to show the contact form */
|
|
17
|
+
showContactForm?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface PaymentDrawerProps {
|
|
20
|
+
/** Whether the drawer is open */
|
|
21
|
+
isOpen: boolean;
|
|
22
|
+
/** Callback when the drawer should close */
|
|
23
|
+
onClose: () => void;
|
|
24
|
+
/** Payment link ID */
|
|
25
|
+
paymentLinkId: string;
|
|
26
|
+
/** Payment parameters to pass as URL query params */
|
|
27
|
+
params?: PaymentParams;
|
|
28
|
+
/** Width of the drawer (default: 400px) */
|
|
29
|
+
width?: string | number;
|
|
30
|
+
/** Position of the drawer */
|
|
31
|
+
position?: "left" | "right";
|
|
32
|
+
/** Whether to show overlay backdrop */
|
|
33
|
+
showOverlay?: boolean;
|
|
34
|
+
/** Whether clicking overlay closes the drawer */
|
|
35
|
+
closeOnOverlayClick?: boolean;
|
|
36
|
+
/** Z-index for the drawer */
|
|
37
|
+
zIndex?: number;
|
|
38
|
+
}
|
|
39
|
+
declare function PaymentDrawer({ isOpen, onClose, paymentLinkId, params, width, position, showOverlay, closeOnOverlayClick, zIndex, }: PaymentDrawerProps): react_jsx_runtime.JSX.Element;
|
|
40
|
+
|
|
41
|
+
export { PaymentDrawer, type PaymentDrawerProps, type PaymentParams };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface PaymentParams {
|
|
4
|
+
/** Payment amount */
|
|
5
|
+
amount?: number;
|
|
6
|
+
/** Customer's first name */
|
|
7
|
+
firstName?: string;
|
|
8
|
+
/** Customer's last name */
|
|
9
|
+
lastName?: string;
|
|
10
|
+
/** Customer's email */
|
|
11
|
+
email?: string;
|
|
12
|
+
/** Customer's phone number */
|
|
13
|
+
phone?: string;
|
|
14
|
+
/** Company name */
|
|
15
|
+
companyName?: string;
|
|
16
|
+
/** Whether to show the contact form */
|
|
17
|
+
showContactForm?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface PaymentDrawerProps {
|
|
20
|
+
/** Whether the drawer is open */
|
|
21
|
+
isOpen: boolean;
|
|
22
|
+
/** Callback when the drawer should close */
|
|
23
|
+
onClose: () => void;
|
|
24
|
+
/** Payment link ID */
|
|
25
|
+
paymentLinkId: string;
|
|
26
|
+
/** Payment parameters to pass as URL query params */
|
|
27
|
+
params?: PaymentParams;
|
|
28
|
+
/** Width of the drawer (default: 400px) */
|
|
29
|
+
width?: string | number;
|
|
30
|
+
/** Position of the drawer */
|
|
31
|
+
position?: "left" | "right";
|
|
32
|
+
/** Whether to show overlay backdrop */
|
|
33
|
+
showOverlay?: boolean;
|
|
34
|
+
/** Whether clicking overlay closes the drawer */
|
|
35
|
+
closeOnOverlayClick?: boolean;
|
|
36
|
+
/** Z-index for the drawer */
|
|
37
|
+
zIndex?: number;
|
|
38
|
+
}
|
|
39
|
+
declare function PaymentDrawer({ isOpen, onClose, paymentLinkId, params, width, position, showOverlay, closeOnOverlayClick, zIndex, }: PaymentDrawerProps): react_jsx_runtime.JSX.Element;
|
|
40
|
+
|
|
41
|
+
export { PaymentDrawer, type PaymentDrawerProps, type PaymentParams };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
// src/components/PaymentDrawer.tsx
|
|
2
|
+
import { useEffect, useCallback, useMemo } from "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var BASE_URL = "https://pay.intrpay.us";
|
|
5
|
+
var baseParams = {
|
|
6
|
+
showHeader: false
|
|
7
|
+
};
|
|
8
|
+
function PaymentDrawer({
|
|
9
|
+
isOpen,
|
|
10
|
+
onClose,
|
|
11
|
+
paymentLinkId,
|
|
12
|
+
params,
|
|
13
|
+
width = 400,
|
|
14
|
+
position = "right",
|
|
15
|
+
showOverlay = true,
|
|
16
|
+
closeOnOverlayClick = true,
|
|
17
|
+
zIndex = 1e3
|
|
18
|
+
}) {
|
|
19
|
+
const iframeUrl = useMemo(() => {
|
|
20
|
+
const url = new URL(`${BASE_URL}/${paymentLinkId}`);
|
|
21
|
+
const combinedParams = { ...baseParams, ...params };
|
|
22
|
+
Object.entries(combinedParams).forEach(([key, value]) => {
|
|
23
|
+
if (value !== void 0 && value !== null && value !== "") {
|
|
24
|
+
url.searchParams.set(key, String(value));
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return url.toString();
|
|
28
|
+
}, [paymentLinkId, params]);
|
|
29
|
+
const handleKeyDown = useCallback(
|
|
30
|
+
(event) => {
|
|
31
|
+
if (event.key === "Escape" && isOpen) {
|
|
32
|
+
onClose();
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
[isOpen, onClose]
|
|
36
|
+
);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
39
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
40
|
+
}, [handleKeyDown]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (isOpen) {
|
|
43
|
+
document.body.style.overflow = "hidden";
|
|
44
|
+
} else {
|
|
45
|
+
document.body.style.overflow = "";
|
|
46
|
+
}
|
|
47
|
+
return () => {
|
|
48
|
+
document.body.style.overflow = "";
|
|
49
|
+
};
|
|
50
|
+
}, [isOpen]);
|
|
51
|
+
const handleOverlayClick = () => {
|
|
52
|
+
if (closeOnOverlayClick) {
|
|
53
|
+
onClose();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const drawerWidth = typeof width === "number" ? `${width}px` : width;
|
|
57
|
+
const styles = {
|
|
58
|
+
overlay: {
|
|
59
|
+
position: "fixed",
|
|
60
|
+
top: 0,
|
|
61
|
+
left: 0,
|
|
62
|
+
right: 0,
|
|
63
|
+
bottom: 0,
|
|
64
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
65
|
+
zIndex,
|
|
66
|
+
opacity: isOpen ? 1 : 0,
|
|
67
|
+
visibility: isOpen ? "visible" : "hidden",
|
|
68
|
+
transition: "opacity 0.3s ease, visibility 0.3s ease"
|
|
69
|
+
},
|
|
70
|
+
drawer: {
|
|
71
|
+
position: "fixed",
|
|
72
|
+
top: 0,
|
|
73
|
+
bottom: 0,
|
|
74
|
+
[position]: 0,
|
|
75
|
+
width: drawerWidth,
|
|
76
|
+
maxWidth: "100%",
|
|
77
|
+
backgroundColor: "#ffffff",
|
|
78
|
+
zIndex: zIndex + 1,
|
|
79
|
+
boxShadow: position === "right" ? "-4px 0 20px rgba(0, 0, 0, 0.15)" : "4px 0 20px rgba(0, 0, 0, 0.15)",
|
|
80
|
+
transform: isOpen ? "translateX(0)" : `translateX(${position === "right" ? "100%" : "-100%"})`,
|
|
81
|
+
transition: "transform 0.3s ease",
|
|
82
|
+
display: "flex",
|
|
83
|
+
flexDirection: "column"
|
|
84
|
+
},
|
|
85
|
+
closeButton: {
|
|
86
|
+
position: "absolute",
|
|
87
|
+
top: 12,
|
|
88
|
+
right: 12,
|
|
89
|
+
width: 36,
|
|
90
|
+
height: 36,
|
|
91
|
+
border: "none",
|
|
92
|
+
backgroundColor: "#f3f4f6",
|
|
93
|
+
borderRadius: "50%",
|
|
94
|
+
cursor: "pointer",
|
|
95
|
+
display: "flex",
|
|
96
|
+
alignItems: "center",
|
|
97
|
+
justifyContent: "center",
|
|
98
|
+
color: "#6b7280",
|
|
99
|
+
zIndex: 1
|
|
100
|
+
},
|
|
101
|
+
content: {
|
|
102
|
+
flex: 1,
|
|
103
|
+
overflow: "hidden",
|
|
104
|
+
paddingTop: 60
|
|
105
|
+
},
|
|
106
|
+
iframe: {
|
|
107
|
+
width: "100%",
|
|
108
|
+
height: "100%",
|
|
109
|
+
border: "none"
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
113
|
+
showOverlay && /* @__PURE__ */ jsx(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
style: styles.overlay,
|
|
117
|
+
onClick: handleOverlayClick,
|
|
118
|
+
"aria-hidden": "true"
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
/* @__PURE__ */ jsxs(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
style: styles.drawer,
|
|
125
|
+
role: "dialog",
|
|
126
|
+
"aria-modal": "true",
|
|
127
|
+
"aria-label": "Payment",
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ jsx(
|
|
130
|
+
"button",
|
|
131
|
+
{
|
|
132
|
+
style: styles.closeButton,
|
|
133
|
+
onClick: onClose,
|
|
134
|
+
"aria-label": "Close drawer",
|
|
135
|
+
type: "button",
|
|
136
|
+
onMouseEnter: (e) => {
|
|
137
|
+
e.currentTarget.style.backgroundColor = "#e5e7eb";
|
|
138
|
+
e.currentTarget.style.color = "#374151";
|
|
139
|
+
},
|
|
140
|
+
onMouseLeave: (e) => {
|
|
141
|
+
e.currentTarget.style.backgroundColor = "#f3f4f6";
|
|
142
|
+
e.currentTarget.style.color = "#6b7280";
|
|
143
|
+
},
|
|
144
|
+
children: /* @__PURE__ */ jsxs(
|
|
145
|
+
"svg",
|
|
146
|
+
{
|
|
147
|
+
width: "24",
|
|
148
|
+
height: "24",
|
|
149
|
+
viewBox: "0 0 24 24",
|
|
150
|
+
fill: "none",
|
|
151
|
+
stroke: "currentColor",
|
|
152
|
+
strokeWidth: "2",
|
|
153
|
+
strokeLinecap: "round",
|
|
154
|
+
strokeLinejoin: "round",
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
157
|
+
/* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ jsx("div", { style: styles.content, children: /* @__PURE__ */ jsx(
|
|
164
|
+
"iframe",
|
|
165
|
+
{
|
|
166
|
+
src: isOpen ? iframeUrl : "about:blank",
|
|
167
|
+
title: "Payment",
|
|
168
|
+
style: styles.iframe,
|
|
169
|
+
allow: "payment; clipboard-write"
|
|
170
|
+
}
|
|
171
|
+
) })
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
] });
|
|
176
|
+
}
|
|
177
|
+
export {
|
|
178
|
+
PaymentDrawer
|
|
179
|
+
};
|
|
180
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/PaymentDrawer.tsx"],"sourcesContent":["import React, { useEffect, useCallback, useMemo, CSSProperties } from \"react\";\n\nconst BASE_URL = \"https://pay.intrpay.us\";\n\nconst baseParams = {\n showHeader: false,\n};\n\nexport interface PaymentParams {\n /** Payment amount */\n amount?: number;\n /** Customer's first name */\n firstName?: string;\n /** Customer's last name */\n lastName?: string;\n /** Customer's email */\n email?: string;\n /** Customer's phone number */\n phone?: string;\n /** Company name */\n companyName?: string;\n /** Whether to show the contact form */\n showContactForm?: boolean;\n /** Currency code (e.g., 'USD', 'EUR') */\n // currency?: string;\n // /** Custom reference/order ID */\n // reference?: string;\n // /** Redirect URL after successful payment */\n // redirectUrl?: string;\n // /** Additional custom parameters */\n // [key: string]: string | number | boolean | undefined;\n}\n\nexport interface PaymentDrawerProps {\n /** Whether the drawer is open */\n isOpen: boolean;\n /** Callback when the drawer should close */\n onClose: () => void;\n /** Payment link ID */\n paymentLinkId: string;\n /** Payment parameters to pass as URL query params */\n params?: PaymentParams;\n /** Width of the drawer (default: 400px) */\n width?: string | number;\n /** Position of the drawer */\n position?: \"left\" | \"right\";\n /** Whether to show overlay backdrop */\n showOverlay?: boolean;\n /** Whether clicking overlay closes the drawer */\n closeOnOverlayClick?: boolean;\n /** Z-index for the drawer */\n zIndex?: number;\n}\n\nexport function PaymentDrawer({\n isOpen,\n onClose,\n paymentLinkId,\n params,\n width = 400,\n position = \"right\",\n showOverlay = true,\n closeOnOverlayClick = true,\n zIndex = 1000,\n}: PaymentDrawerProps) {\n const iframeUrl = useMemo(() => {\n const url = new URL(`${BASE_URL}/${paymentLinkId}`);\n\n // Combine base params with user params (user params override base)\n const combinedParams = { ...baseParams, ...params };\n\n Object.entries(combinedParams).forEach(([key, value]) => {\n if (value !== undefined && value !== null && value !== \"\") {\n url.searchParams.set(key, String(value));\n }\n });\n\n return url.toString();\n }, [paymentLinkId, params]);\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === \"Escape\" && isOpen) {\n onClose();\n }\n },\n [isOpen, onClose],\n );\n\n useEffect(() => {\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => document.removeEventListener(\"keydown\", handleKeyDown);\n }, [handleKeyDown]);\n\n useEffect(() => {\n if (isOpen) {\n document.body.style.overflow = \"hidden\";\n } else {\n document.body.style.overflow = \"\";\n }\n return () => {\n document.body.style.overflow = \"\";\n };\n }, [isOpen]);\n\n const handleOverlayClick = () => {\n if (closeOnOverlayClick) {\n onClose();\n }\n };\n\n const drawerWidth = typeof width === \"number\" ? `${width}px` : width;\n\n const styles: Record<string, CSSProperties> = {\n overlay: {\n position: \"fixed\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: \"rgba(0, 0, 0, 0.5)\",\n zIndex,\n opacity: isOpen ? 1 : 0,\n visibility: isOpen ? \"visible\" : \"hidden\",\n transition: \"opacity 0.3s ease, visibility 0.3s ease\",\n },\n drawer: {\n position: \"fixed\",\n top: 0,\n bottom: 0,\n [position]: 0,\n width: drawerWidth,\n maxWidth: \"100%\",\n backgroundColor: \"#ffffff\",\n zIndex: zIndex + 1,\n boxShadow:\n position === \"right\"\n ? \"-4px 0 20px rgba(0, 0, 0, 0.15)\"\n : \"4px 0 20px rgba(0, 0, 0, 0.15)\",\n transform: isOpen\n ? \"translateX(0)\"\n : `translateX(${position === \"right\" ? \"100%\" : \"-100%\"})`,\n transition: \"transform 0.3s ease\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n closeButton: {\n position: \"absolute\",\n top: 12,\n right: 12,\n width: 36,\n height: 36,\n border: \"none\",\n backgroundColor: \"#f3f4f6\",\n borderRadius: \"50%\",\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n color: \"#6b7280\",\n zIndex: 1,\n },\n content: {\n flex: 1,\n overflow: \"hidden\",\n paddingTop: 60,\n },\n iframe: {\n width: \"100%\",\n height: \"100%\",\n border: \"none\",\n },\n };\n\n return (\n <>\n {showOverlay && (\n <div\n style={styles.overlay}\n onClick={handleOverlayClick}\n aria-hidden=\"true\"\n />\n )}\n <div\n style={styles.drawer}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Payment\"\n >\n <button\n style={styles.closeButton}\n onClick={onClose}\n aria-label=\"Close drawer\"\n type=\"button\"\n onMouseEnter={(e: React.MouseEvent<HTMLButtonElement>) => {\n e.currentTarget.style.backgroundColor = \"#e5e7eb\";\n e.currentTarget.style.color = \"#374151\";\n }}\n onMouseLeave={(e: React.MouseEvent<HTMLButtonElement>) => {\n e.currentTarget.style.backgroundColor = \"#f3f4f6\";\n e.currentTarget.style.color = \"#6b7280\";\n }}\n >\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n <div style={styles.content}>\n <iframe\n src={isOpen ? iframeUrl : \"about:blank\"}\n title=\"Payment\"\n style={styles.iframe}\n allow=\"payment; clipboard-write\"\n />\n </div>\n </div>\n </>\n );\n}\n"],"mappings":";AAAA,SAAgB,WAAW,aAAa,eAA8B;AA+KlE,mBAEI,KA0BE,YA5BN;AA7KJ,IAAM,WAAW;AAEjB,IAAM,aAAa;AAAA,EACjB,YAAY;AACd;AAgDO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,cAAc;AAAA,EACd,sBAAsB;AAAA,EACtB,SAAS;AACX,GAAuB;AACrB,QAAM,YAAY,QAAQ,MAAM;AAC9B,UAAM,MAAM,IAAI,IAAI,GAAG,QAAQ,IAAI,aAAa,EAAE;AAGlD,UAAM,iBAAiB,EAAE,GAAG,YAAY,GAAG,OAAO;AAElD,WAAO,QAAQ,cAAc,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACvD,UAAI,UAAU,UAAa,UAAU,QAAQ,UAAU,IAAI;AACzD,YAAI,aAAa,IAAI,KAAK,OAAO,KAAK,CAAC;AAAA,MACzC;AAAA,IACF,CAAC;AAED,WAAO,IAAI,SAAS;AAAA,EACtB,GAAG,CAAC,eAAe,MAAM,CAAC;AAE1B,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,IAAG,MAAK;AAAA,oBACpC,oBAAC,UAAK,IAAG,KAAI,IAAG,KAAI,IAAG,MAAK,IAAG,MAAK;AAAA;AAAA;AAAA,cACtC;AAAA;AAAA,UACF;AAAA,UACA,oBAAC,SAAI,OAAO,OAAO,SACjB;AAAA,YAAC;AAAA;AAAA,cACC,KAAK,SAAS,YAAY;AAAA,cAC1B,OAAM;AAAA,cACN,OAAO,OAAO;AAAA,cACd,OAAM;AAAA;AAAA,UACR,GACF;AAAA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "intrpay-payments",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A package for integrating Intrpay payments into your React application",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
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": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsup",
|
|
21
|
+
"dev": "tsup --watch",
|
|
22
|
+
"lint": "eslint src",
|
|
23
|
+
"lint:fix": "eslint src --fix",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"react",
|
|
28
|
+
"drawer",
|
|
29
|
+
"iframe",
|
|
30
|
+
"payment",
|
|
31
|
+
"component"
|
|
32
|
+
],
|
|
33
|
+
"author": "Intrsync",
|
|
34
|
+
"license": "ISC",
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"react": ">=17.0.0",
|
|
37
|
+
"react-dom": ">=17.0.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@eslint/js": "^9.0.0",
|
|
41
|
+
"@types/react": "^18.2.0",
|
|
42
|
+
"@types/react-dom": "^18.2.0",
|
|
43
|
+
"eslint": "^9.0.0",
|
|
44
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
45
|
+
"react": "^18.2.0",
|
|
46
|
+
"react-dom": "^18.2.0",
|
|
47
|
+
"tsup": "^8.0.0",
|
|
48
|
+
"typescript": "^5.0.0",
|
|
49
|
+
"typescript-eslint": "^8.0.0"
|
|
50
|
+
}
|
|
51
|
+
}
|