flintn-checkout 0.0.1 → 0.0.2
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 +10 -12
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +4 -5
- package/dist/react.mjs +4 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ import { useFlintNPayment } from 'flintn-checkout/react';
|
|
|
16
16
|
function Checkout() {
|
|
17
17
|
const { containerRef, isReady, paymentResult, error } = useFlintNPayment({
|
|
18
18
|
config: {
|
|
19
|
-
|
|
19
|
+
clientSessionId: 'your_client_session_id',
|
|
20
20
|
},
|
|
21
21
|
onPayment: (result) => {
|
|
22
22
|
if (result.status === 'PAYMENT_SUCCESS') {
|
|
@@ -32,7 +32,7 @@ function Checkout() {
|
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
|
35
|
-
<div ref={containerRef} style={{ width: '100%',
|
|
35
|
+
<div ref={containerRef} style={{ width: '100%', height: '600px' }} />
|
|
36
36
|
</div>
|
|
37
37
|
);
|
|
38
38
|
}
|
|
@@ -44,10 +44,7 @@ import { FlintNPayment } from 'flintn-checkout';
|
|
|
44
44
|
|
|
45
45
|
const payment = new FlintNPayment({
|
|
46
46
|
config: {
|
|
47
|
-
|
|
48
|
-
maxWidth: '440px',
|
|
49
|
-
isCardHolderRequired: true,
|
|
50
|
-
successRedirectUrl: 'https://example.com/success',
|
|
47
|
+
clientSessionId: 'your_client_session_id',
|
|
51
48
|
},
|
|
52
49
|
onPayment: (result) => {
|
|
53
50
|
if (result.status === 'PAYMENT_SUCCESS') {
|
|
@@ -86,7 +83,7 @@ payment.unmount();
|
|
|
86
83
|
|
|
87
84
|
const payment = new FlintNPayment({
|
|
88
85
|
config: {
|
|
89
|
-
|
|
86
|
+
clientSessionId: 'your_client_session_id',
|
|
90
87
|
},
|
|
91
88
|
onPayment: (result) => {
|
|
92
89
|
console.log('Payment result:', result);
|
|
@@ -103,11 +100,12 @@ payment.unmount();
|
|
|
103
100
|
|
|
104
101
|
| Option | Type | Required | Default | Description |
|
|
105
102
|
|--------|------|----------|---------|-------------|
|
|
106
|
-
| `
|
|
107
|
-
| `maxWidth` | `string` | ❌ | `'440px'` | Maximum width of widget |
|
|
103
|
+
| `clientSessionId` | `string` | ✅ | — | Client session ID from backend |
|
|
108
104
|
| `isCardHolderRequired` | `boolean` | ❌ | `true` | Show cardholder name field |
|
|
109
105
|
| `successRedirectUrl` | `string` | ❌ | — | Redirect URL after successful payment |
|
|
110
106
|
|
|
107
|
+
> **Note:** `isCardHolderRequired` only applies when using Primer as the payment provider.
|
|
108
|
+
|
|
111
109
|
## Callbacks
|
|
112
110
|
|
|
113
111
|
| Callback | Description |
|
|
@@ -132,7 +130,7 @@ payment.unmount();
|
|
|
132
130
|
```typescript
|
|
133
131
|
interface PaymentResult {
|
|
134
132
|
status: 'PAYMENT_SUCCESS' | 'PAYMENT_ERROR' | 'PAYMENT_CANCELLED';
|
|
135
|
-
data?: string;
|
|
133
|
+
data?: string; // Payment ID on success
|
|
136
134
|
error?: {
|
|
137
135
|
code: string;
|
|
138
136
|
message: string;
|
|
@@ -161,13 +159,13 @@ Enable debug logs in console:
|
|
|
161
159
|
```typescript
|
|
162
160
|
// React
|
|
163
161
|
useFlintNPayment({
|
|
164
|
-
config: {
|
|
162
|
+
config: { clientSessionId: '...' },
|
|
165
163
|
debug: true,
|
|
166
164
|
});
|
|
167
165
|
|
|
168
166
|
// Vanilla JS
|
|
169
167
|
new FlintNPayment({
|
|
170
|
-
config: {
|
|
168
|
+
config: { clientSessionId: '...' },
|
|
171
169
|
debug: true,
|
|
172
170
|
});
|
|
173
171
|
```
|
package/dist/index.d.mts
CHANGED
|
@@ -10,7 +10,7 @@ declare const EventType: {
|
|
|
10
10
|
};
|
|
11
11
|
type TEventType = (typeof EventType)[keyof typeof EventType];
|
|
12
12
|
interface FlintNConfig {
|
|
13
|
-
|
|
13
|
+
clientSessionId: string;
|
|
14
14
|
maxWidth?: string;
|
|
15
15
|
isCardHolderRequired?: boolean;
|
|
16
16
|
successRedirectUrl?: string;
|
|
@@ -59,7 +59,7 @@ declare const parseOrigin: (origin: string) => string;
|
|
|
59
59
|
declare const buildIframeSrc: (origin: string) => string;
|
|
60
60
|
declare const createIframeElement: (src: string) => HTMLIFrameElement;
|
|
61
61
|
declare const validateConfig: (config: {
|
|
62
|
-
|
|
62
|
+
clientSessionId?: string;
|
|
63
63
|
}) => void;
|
|
64
64
|
declare const sanitizeToken: (token: string) => string;
|
|
65
65
|
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare const EventType: {
|
|
|
10
10
|
};
|
|
11
11
|
type TEventType = (typeof EventType)[keyof typeof EventType];
|
|
12
12
|
interface FlintNConfig {
|
|
13
|
-
|
|
13
|
+
clientSessionId: string;
|
|
14
14
|
maxWidth?: string;
|
|
15
15
|
isCardHolderRequired?: boolean;
|
|
16
16
|
successRedirectUrl?: string;
|
|
@@ -59,7 +59,7 @@ declare const parseOrigin: (origin: string) => string;
|
|
|
59
59
|
declare const buildIframeSrc: (origin: string) => string;
|
|
60
60
|
declare const createIframeElement: (src: string) => HTMLIFrameElement;
|
|
61
61
|
declare const validateConfig: (config: {
|
|
62
|
-
|
|
62
|
+
clientSessionId?: string;
|
|
63
63
|
}) => void;
|
|
64
64
|
declare const sanitizeToken: (token: string) => string;
|
|
65
65
|
|
package/dist/index.js
CHANGED
|
@@ -67,8 +67,8 @@ var createIframeElement = (src) => {
|
|
|
67
67
|
return iframe;
|
|
68
68
|
};
|
|
69
69
|
var validateConfig = (config) => {
|
|
70
|
-
if (!config.
|
|
71
|
-
throw new Error("[FlintN SDK]
|
|
70
|
+
if (!config.clientSessionId) {
|
|
71
|
+
throw new Error("[FlintN SDK] clientSessionId is required");
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
var sanitizeToken = (token) => {
|
|
@@ -177,7 +177,7 @@ var FlintNPayment = class {
|
|
|
177
177
|
},
|
|
178
178
|
this.origin
|
|
179
179
|
);
|
|
180
|
-
this.log("Sent config:", sanitizeToken(this.options.config.
|
|
180
|
+
this.log("Sent config:", sanitizeToken(this.options.config.clientSessionId));
|
|
181
181
|
}
|
|
182
182
|
log(...args) {
|
|
183
183
|
if (this.options.debug) {
|
package/dist/index.mjs
CHANGED
|
@@ -35,8 +35,8 @@ var createIframeElement = (src) => {
|
|
|
35
35
|
return iframe;
|
|
36
36
|
};
|
|
37
37
|
var validateConfig = (config) => {
|
|
38
|
-
if (!config.
|
|
39
|
-
throw new Error("[FlintN SDK]
|
|
38
|
+
if (!config.clientSessionId) {
|
|
39
|
+
throw new Error("[FlintN SDK] clientSessionId is required");
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
var sanitizeToken = (token) => {
|
|
@@ -145,7 +145,7 @@ var FlintNPayment = class {
|
|
|
145
145
|
},
|
|
146
146
|
this.origin
|
|
147
147
|
);
|
|
148
|
-
this.log("Sent config:", sanitizeToken(this.options.config.
|
|
148
|
+
this.log("Sent config:", sanitizeToken(this.options.config.clientSessionId));
|
|
149
149
|
}
|
|
150
150
|
log(...args) {
|
|
151
151
|
if (this.options.debug) {
|
package/dist/react.d.mts
CHANGED
|
@@ -10,7 +10,7 @@ declare const EventType: {
|
|
|
10
10
|
};
|
|
11
11
|
type TEventType = (typeof EventType)[keyof typeof EventType];
|
|
12
12
|
interface FlintNConfig {
|
|
13
|
-
|
|
13
|
+
clientSessionId: string;
|
|
14
14
|
maxWidth?: string;
|
|
15
15
|
isCardHolderRequired?: boolean;
|
|
16
16
|
successRedirectUrl?: string;
|
package/dist/react.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare const EventType: {
|
|
|
10
10
|
};
|
|
11
11
|
type TEventType = (typeof EventType)[keyof typeof EventType];
|
|
12
12
|
interface FlintNConfig {
|
|
13
|
-
|
|
13
|
+
clientSessionId: string;
|
|
14
14
|
maxWidth?: string;
|
|
15
15
|
isCardHolderRequired?: boolean;
|
|
16
16
|
successRedirectUrl?: string;
|
package/dist/react.js
CHANGED
|
@@ -65,8 +65,8 @@ var createIframeElement = (src) => {
|
|
|
65
65
|
return iframe;
|
|
66
66
|
};
|
|
67
67
|
var validateConfig = (config) => {
|
|
68
|
-
if (!config.
|
|
69
|
-
throw new Error("[FlintN SDK]
|
|
68
|
+
if (!config.clientSessionId) {
|
|
69
|
+
throw new Error("[FlintN SDK] clientSessionId is required");
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
var sanitizeToken = (token) => {
|
|
@@ -175,7 +175,7 @@ var FlintNPayment = class {
|
|
|
175
175
|
},
|
|
176
176
|
this.origin
|
|
177
177
|
);
|
|
178
|
-
this.log("Sent config:", sanitizeToken(this.options.config.
|
|
178
|
+
this.log("Sent config:", sanitizeToken(this.options.config.clientSessionId));
|
|
179
179
|
}
|
|
180
180
|
log(...args) {
|
|
181
181
|
if (this.options.debug) {
|
|
@@ -232,8 +232,7 @@ function useFlintNPayment(options) {
|
|
|
232
232
|
}, [
|
|
233
233
|
options.origin,
|
|
234
234
|
options.debug,
|
|
235
|
-
options.config.
|
|
236
|
-
options.config.maxWidth,
|
|
235
|
+
options.config.clientSessionId,
|
|
237
236
|
options.config.isCardHolderRequired,
|
|
238
237
|
options.config.successRedirectUrl
|
|
239
238
|
]);
|
package/dist/react.mjs
CHANGED
|
@@ -38,8 +38,8 @@ var createIframeElement = (src) => {
|
|
|
38
38
|
return iframe;
|
|
39
39
|
};
|
|
40
40
|
var validateConfig = (config) => {
|
|
41
|
-
if (!config.
|
|
42
|
-
throw new Error("[FlintN SDK]
|
|
41
|
+
if (!config.clientSessionId) {
|
|
42
|
+
throw new Error("[FlintN SDK] clientSessionId is required");
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
var sanitizeToken = (token) => {
|
|
@@ -148,7 +148,7 @@ var FlintNPayment = class {
|
|
|
148
148
|
},
|
|
149
149
|
this.origin
|
|
150
150
|
);
|
|
151
|
-
this.log("Sent config:", sanitizeToken(this.options.config.
|
|
151
|
+
this.log("Sent config:", sanitizeToken(this.options.config.clientSessionId));
|
|
152
152
|
}
|
|
153
153
|
log(...args) {
|
|
154
154
|
if (this.options.debug) {
|
|
@@ -205,8 +205,7 @@ function useFlintNPayment(options) {
|
|
|
205
205
|
}, [
|
|
206
206
|
options.origin,
|
|
207
207
|
options.debug,
|
|
208
|
-
options.config.
|
|
209
|
-
options.config.maxWidth,
|
|
208
|
+
options.config.clientSessionId,
|
|
210
209
|
options.config.isCardHolderRequired,
|
|
211
210
|
options.config.successRedirectUrl
|
|
212
211
|
]);
|
package/package.json
CHANGED