@nium/nium-sdk 0.1.4 → 0.1.6
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/dist/index.d.mts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +11 -5
- package/dist/index.mjs +11 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -18,6 +18,8 @@ interface NiumInitOptions {
|
|
|
18
18
|
customerHashId?: string;
|
|
19
19
|
/** Client ID */
|
|
20
20
|
clientId?: string;
|
|
21
|
+
/** Pre-exchanged session token (temporary — bypasses auth code exchange) */
|
|
22
|
+
sessionToken?: string;
|
|
21
23
|
}
|
|
22
24
|
/** Theme options for embedded components */
|
|
23
25
|
interface NiumTheme {
|
|
@@ -42,10 +44,14 @@ interface NiumPaymentPrefill {
|
|
|
42
44
|
}
|
|
43
45
|
/** Options passed to `createElement()` */
|
|
44
46
|
interface NiumElementOptions {
|
|
47
|
+
/** Customer hash ID */
|
|
48
|
+
customerHashId?: string;
|
|
45
49
|
/** Pre-fill form fields */
|
|
46
50
|
prefill?: NiumPaymentPrefill;
|
|
47
51
|
/** Custom theme overrides */
|
|
48
52
|
theme?: NiumTheme;
|
|
53
|
+
/** If true, the form will call the create beneficiary API directly instead of returning the payload */
|
|
54
|
+
createBeneficiary?: boolean;
|
|
49
55
|
/** Custom minimum height for the iframe (default: 400) */
|
|
50
56
|
customizations?: {
|
|
51
57
|
minHeight?: number;
|
|
@@ -63,11 +69,7 @@ interface NiumChangeEvent {
|
|
|
63
69
|
type: 'change';
|
|
64
70
|
data: Record<string, unknown>;
|
|
65
71
|
}
|
|
66
|
-
|
|
67
|
-
beneficiaryId?: string;
|
|
68
|
-
filerHashId?: string;
|
|
69
|
-
status: 'success';
|
|
70
|
-
}
|
|
72
|
+
type NiumSubmitResult = Record<string, unknown>;
|
|
71
73
|
interface NiumSubmitEvent {
|
|
72
74
|
type: 'submit';
|
|
73
75
|
result: NiumSubmitResult;
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ interface NiumInitOptions {
|
|
|
18
18
|
customerHashId?: string;
|
|
19
19
|
/** Client ID */
|
|
20
20
|
clientId?: string;
|
|
21
|
+
/** Pre-exchanged session token (temporary — bypasses auth code exchange) */
|
|
22
|
+
sessionToken?: string;
|
|
21
23
|
}
|
|
22
24
|
/** Theme options for embedded components */
|
|
23
25
|
interface NiumTheme {
|
|
@@ -42,10 +44,14 @@ interface NiumPaymentPrefill {
|
|
|
42
44
|
}
|
|
43
45
|
/** Options passed to `createElement()` */
|
|
44
46
|
interface NiumElementOptions {
|
|
47
|
+
/** Customer hash ID */
|
|
48
|
+
customerHashId?: string;
|
|
45
49
|
/** Pre-fill form fields */
|
|
46
50
|
prefill?: NiumPaymentPrefill;
|
|
47
51
|
/** Custom theme overrides */
|
|
48
52
|
theme?: NiumTheme;
|
|
53
|
+
/** If true, the form will call the create beneficiary API directly instead of returning the payload */
|
|
54
|
+
createBeneficiary?: boolean;
|
|
49
55
|
/** Custom minimum height for the iframe (default: 400) */
|
|
50
56
|
customizations?: {
|
|
51
57
|
minHeight?: number;
|
|
@@ -63,11 +69,7 @@ interface NiumChangeEvent {
|
|
|
63
69
|
type: 'change';
|
|
64
70
|
data: Record<string, unknown>;
|
|
65
71
|
}
|
|
66
|
-
|
|
67
|
-
beneficiaryId?: string;
|
|
68
|
-
filerHashId?: string;
|
|
69
|
-
status: 'success';
|
|
70
|
-
}
|
|
72
|
+
type NiumSubmitResult = Record<string, unknown>;
|
|
71
73
|
interface NiumSubmitEvent {
|
|
72
74
|
type: 'submit';
|
|
73
75
|
result: NiumSubmitResult;
|
package/dist/index.js
CHANGED
|
@@ -207,8 +207,8 @@ var ELEMENT_ROUTES = {
|
|
|
207
207
|
full: "/sdk/full-form"
|
|
208
208
|
};
|
|
209
209
|
var init = async (options) => {
|
|
210
|
-
if (!options.authCode) {
|
|
211
|
-
throw new Error("@nium/nium-sdk: authCode is required");
|
|
210
|
+
if (!options.authCode && !options.sessionToken) {
|
|
211
|
+
throw new Error("@nium/nium-sdk: authCode or sessionToken is required");
|
|
212
212
|
}
|
|
213
213
|
if (!options.env) {
|
|
214
214
|
throw new Error("@nium/nium-sdk: env is required");
|
|
@@ -232,12 +232,18 @@ var createElement = async (type, options = {}) => {
|
|
|
232
232
|
if (initConfig.codeVerifier) {
|
|
233
233
|
url.searchParams.set("codeVerifier", initConfig.codeVerifier);
|
|
234
234
|
}
|
|
235
|
-
if (initConfig.customerHashId) {
|
|
236
|
-
url.searchParams.set("customerHashId", initConfig.customerHashId);
|
|
237
|
-
}
|
|
238
235
|
if (initConfig.clientId) {
|
|
239
236
|
url.searchParams.set("clientId", initConfig.clientId);
|
|
240
237
|
}
|
|
238
|
+
if (initConfig.sessionToken) {
|
|
239
|
+
url.searchParams.set("sessionToken", initConfig.sessionToken);
|
|
240
|
+
}
|
|
241
|
+
if (options.customerHashId) {
|
|
242
|
+
url.searchParams.set("customerHashId", options.customerHashId);
|
|
243
|
+
}
|
|
244
|
+
if (options.createBeneficiary) {
|
|
245
|
+
url.searchParams.set("createBeneficiary", "true");
|
|
246
|
+
}
|
|
241
247
|
if (initConfig.locale) {
|
|
242
248
|
url.searchParams.set("locale", initConfig.locale);
|
|
243
249
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -179,8 +179,8 @@ var ELEMENT_ROUTES = {
|
|
|
179
179
|
full: "/sdk/full-form"
|
|
180
180
|
};
|
|
181
181
|
var init = async (options) => {
|
|
182
|
-
if (!options.authCode) {
|
|
183
|
-
throw new Error("@nium/nium-sdk: authCode is required");
|
|
182
|
+
if (!options.authCode && !options.sessionToken) {
|
|
183
|
+
throw new Error("@nium/nium-sdk: authCode or sessionToken is required");
|
|
184
184
|
}
|
|
185
185
|
if (!options.env) {
|
|
186
186
|
throw new Error("@nium/nium-sdk: env is required");
|
|
@@ -204,12 +204,18 @@ var createElement = async (type, options = {}) => {
|
|
|
204
204
|
if (initConfig.codeVerifier) {
|
|
205
205
|
url.searchParams.set("codeVerifier", initConfig.codeVerifier);
|
|
206
206
|
}
|
|
207
|
-
if (initConfig.customerHashId) {
|
|
208
|
-
url.searchParams.set("customerHashId", initConfig.customerHashId);
|
|
209
|
-
}
|
|
210
207
|
if (initConfig.clientId) {
|
|
211
208
|
url.searchParams.set("clientId", initConfig.clientId);
|
|
212
209
|
}
|
|
210
|
+
if (initConfig.sessionToken) {
|
|
211
|
+
url.searchParams.set("sessionToken", initConfig.sessionToken);
|
|
212
|
+
}
|
|
213
|
+
if (options.customerHashId) {
|
|
214
|
+
url.searchParams.set("customerHashId", options.customerHashId);
|
|
215
|
+
}
|
|
216
|
+
if (options.createBeneficiary) {
|
|
217
|
+
url.searchParams.set("createBeneficiary", "true");
|
|
218
|
+
}
|
|
213
219
|
if (initConfig.locale) {
|
|
214
220
|
url.searchParams.set("locale", initConfig.locale);
|
|
215
221
|
}
|