@nium/nium-sdk 0.1.7 → 0.1.8

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 CHANGED
@@ -23,9 +23,17 @@ interface NiumInitOptions {
23
23
  }
24
24
  /** Theme options for embedded components */
25
25
  interface NiumTheme {
26
- primaryColor?: string;
27
26
  borderRadius?: string;
28
27
  fontFamily?: string;
28
+ formBackgroundColor?: string;
29
+ inputFieldBackgroundColor?: string;
30
+ inputFieldBorderColor?: string;
31
+ inputFieldPlaceholderColor?: string;
32
+ inputFieldTextColor?: string;
33
+ inputFieldBorderRadius?: string;
34
+ formHeadingColor?: string;
35
+ labelBackgroundColor?: string;
36
+ radioColor?: string;
29
37
  }
30
38
  /** Per-field UI customization options for SDK beneficiary form fields. */
31
39
  interface NiumFieldCustomization {
@@ -37,10 +45,12 @@ interface NiumSectionCustomization {
37
45
  hidden?: boolean;
38
46
  }
39
47
  /** Supported beneficiary form field paths for `customizations.fields`. */
40
- type NiumBeneficiaryFieldPath = 'line1' | 'line2' | 'city' | 'state' | 'postalCode' | 'countryCode' | 'communicationPreference' | 'contactNumber' | 'email' | 'termsCheckbox' | 'helperText';
48
+ type NiumBeneficiaryFieldPath = 'name' | 'entityType' | 'line1' | 'line2' | 'city' | 'state' | 'postalCode' | 'countryCode' | 'communicationPreference' | 'contactNumber' | 'email' | 'termsCheckbox' | 'helperText';
41
49
  type NiumBeneficiarySectionPath = 'demographicInfo' | 'communicationPreferences' | 'accountType' | 'bankAccountDetails';
42
50
  type NiumBeneficiaryFieldCustomizations = Partial<Record<NiumBeneficiaryFieldPath | string, NiumFieldCustomization>>;
43
51
  type NiumBeneficiarySectionCustomizations = Partial<Record<NiumBeneficiarySectionPath | string, NiumSectionCustomization>>;
52
+ /** Intent for the payment (beneficiary) form */
53
+ type NiumPaymentIntent = 'create_beneficiary' | 'return_payload' | 'update_beneficiary';
44
54
  /** Prefill data for the payment (beneficiary) form */
45
55
  interface NiumPaymentPrefill {
46
56
  name?: string;
@@ -64,8 +74,10 @@ interface NiumElementOptions {
64
74
  prefill?: NiumPaymentPrefill;
65
75
  /** Custom theme overrides */
66
76
  theme?: NiumTheme;
67
- /** If true, the form will call the create beneficiary API directly instead of returning the payload */
68
- createBeneficiary?: boolean;
77
+ /** Form intent: 'create_beneficiary' creates and returns beneficiaryId + payload; 'return_payload' returns payload only; 'update_beneficiary' updates an existing beneficiary */
78
+ intent?: NiumPaymentIntent;
79
+ /** Beneficiary hash ID (required for 'update_beneficiary' intent) */
80
+ beneficiaryHashId?: string;
69
81
  /** Custom minimum height for the iframe (default: 400) */
70
82
  customizations?: {
71
83
  minHeight?: number;
@@ -191,4 +203,4 @@ declare const init: (options: NiumInitOptions) => Promise<void>;
191
203
  */
192
204
  declare const createElement: (type: NiumElementType, options?: NiumElementOptions) => Promise<NiumElement>;
193
205
 
194
- export { type NiumBeneficiaryFieldCustomizations, type NiumBeneficiaryFieldPath, type NiumCancelEvent, type NiumChangeEvent, NiumElement, type NiumElementOptions, type NiumElementType, type NiumEnv, type NiumErrorEvent, type NiumEvent, type NiumEventCallback, type NiumEventMap, type NiumFieldCustomization, type NiumInitOptions, type NiumPaymentPrefill, type NiumReadyEvent, type NiumResizeEvent, type NiumSubmitEvent, type NiumSubmitResult, type NiumTheme, createElement, init };
206
+ export { type NiumBeneficiaryFieldCustomizations, type NiumBeneficiaryFieldPath, type NiumCancelEvent, type NiumChangeEvent, NiumElement, type NiumElementOptions, type NiumElementType, type NiumEnv, type NiumErrorEvent, type NiumEvent, type NiumEventCallback, type NiumEventMap, type NiumFieldCustomization, type NiumInitOptions, type NiumPaymentIntent, type NiumPaymentPrefill, type NiumReadyEvent, type NiumResizeEvent, type NiumSubmitEvent, type NiumSubmitResult, type NiumTheme, createElement, init };
package/dist/index.d.ts CHANGED
@@ -23,9 +23,17 @@ interface NiumInitOptions {
23
23
  }
24
24
  /** Theme options for embedded components */
25
25
  interface NiumTheme {
26
- primaryColor?: string;
27
26
  borderRadius?: string;
28
27
  fontFamily?: string;
28
+ formBackgroundColor?: string;
29
+ inputFieldBackgroundColor?: string;
30
+ inputFieldBorderColor?: string;
31
+ inputFieldPlaceholderColor?: string;
32
+ inputFieldTextColor?: string;
33
+ inputFieldBorderRadius?: string;
34
+ formHeadingColor?: string;
35
+ labelBackgroundColor?: string;
36
+ radioColor?: string;
29
37
  }
30
38
  /** Per-field UI customization options for SDK beneficiary form fields. */
31
39
  interface NiumFieldCustomization {
@@ -37,10 +45,12 @@ interface NiumSectionCustomization {
37
45
  hidden?: boolean;
38
46
  }
39
47
  /** Supported beneficiary form field paths for `customizations.fields`. */
40
- type NiumBeneficiaryFieldPath = 'line1' | 'line2' | 'city' | 'state' | 'postalCode' | 'countryCode' | 'communicationPreference' | 'contactNumber' | 'email' | 'termsCheckbox' | 'helperText';
48
+ type NiumBeneficiaryFieldPath = 'name' | 'entityType' | 'line1' | 'line2' | 'city' | 'state' | 'postalCode' | 'countryCode' | 'communicationPreference' | 'contactNumber' | 'email' | 'termsCheckbox' | 'helperText';
41
49
  type NiumBeneficiarySectionPath = 'demographicInfo' | 'communicationPreferences' | 'accountType' | 'bankAccountDetails';
42
50
  type NiumBeneficiaryFieldCustomizations = Partial<Record<NiumBeneficiaryFieldPath | string, NiumFieldCustomization>>;
43
51
  type NiumBeneficiarySectionCustomizations = Partial<Record<NiumBeneficiarySectionPath | string, NiumSectionCustomization>>;
52
+ /** Intent for the payment (beneficiary) form */
53
+ type NiumPaymentIntent = 'create_beneficiary' | 'return_payload' | 'update_beneficiary';
44
54
  /** Prefill data for the payment (beneficiary) form */
45
55
  interface NiumPaymentPrefill {
46
56
  name?: string;
@@ -64,8 +74,10 @@ interface NiumElementOptions {
64
74
  prefill?: NiumPaymentPrefill;
65
75
  /** Custom theme overrides */
66
76
  theme?: NiumTheme;
67
- /** If true, the form will call the create beneficiary API directly instead of returning the payload */
68
- createBeneficiary?: boolean;
77
+ /** Form intent: 'create_beneficiary' creates and returns beneficiaryId + payload; 'return_payload' returns payload only; 'update_beneficiary' updates an existing beneficiary */
78
+ intent?: NiumPaymentIntent;
79
+ /** Beneficiary hash ID (required for 'update_beneficiary' intent) */
80
+ beneficiaryHashId?: string;
69
81
  /** Custom minimum height for the iframe (default: 400) */
70
82
  customizations?: {
71
83
  minHeight?: number;
@@ -191,4 +203,4 @@ declare const init: (options: NiumInitOptions) => Promise<void>;
191
203
  */
192
204
  declare const createElement: (type: NiumElementType, options?: NiumElementOptions) => Promise<NiumElement>;
193
205
 
194
- export { type NiumBeneficiaryFieldCustomizations, type NiumBeneficiaryFieldPath, type NiumCancelEvent, type NiumChangeEvent, NiumElement, type NiumElementOptions, type NiumElementType, type NiumEnv, type NiumErrorEvent, type NiumEvent, type NiumEventCallback, type NiumEventMap, type NiumFieldCustomization, type NiumInitOptions, type NiumPaymentPrefill, type NiumReadyEvent, type NiumResizeEvent, type NiumSubmitEvent, type NiumSubmitResult, type NiumTheme, createElement, init };
206
+ export { type NiumBeneficiaryFieldCustomizations, type NiumBeneficiaryFieldPath, type NiumCancelEvent, type NiumChangeEvent, NiumElement, type NiumElementOptions, type NiumElementType, type NiumEnv, type NiumErrorEvent, type NiumEvent, type NiumEventCallback, type NiumEventMap, type NiumFieldCustomization, type NiumInitOptions, type NiumPaymentIntent, type NiumPaymentPrefill, type NiumReadyEvent, type NiumResizeEvent, type NiumSubmitEvent, type NiumSubmitResult, type NiumTheme, createElement, init };
package/dist/index.js CHANGED
@@ -241,8 +241,14 @@ var createElement = async (type, options = {}) => {
241
241
  if (options.customerHashId) {
242
242
  url.searchParams.set("customerHashId", options.customerHashId);
243
243
  }
244
- if (options.createBeneficiary) {
245
- url.searchParams.set("createBeneficiary", "true");
244
+ if (options.intent) {
245
+ if (options.intent === "update_beneficiary" && !options.beneficiaryHashId) {
246
+ throw new Error("@nium/nium-sdk: beneficiaryHashId is required for update_beneficiary intent");
247
+ }
248
+ url.searchParams.set("intent", options.intent);
249
+ }
250
+ if (options.beneficiaryHashId) {
251
+ url.searchParams.set("beneficiaryHashId", options.beneficiaryHashId);
246
252
  }
247
253
  if (initConfig.locale) {
248
254
  url.searchParams.set("locale", initConfig.locale);
package/dist/index.mjs CHANGED
@@ -213,8 +213,14 @@ var createElement = async (type, options = {}) => {
213
213
  if (options.customerHashId) {
214
214
  url.searchParams.set("customerHashId", options.customerHashId);
215
215
  }
216
- if (options.createBeneficiary) {
217
- url.searchParams.set("createBeneficiary", "true");
216
+ if (options.intent) {
217
+ if (options.intent === "update_beneficiary" && !options.beneficiaryHashId) {
218
+ throw new Error("@nium/nium-sdk: beneficiaryHashId is required for update_beneficiary intent");
219
+ }
220
+ url.searchParams.set("intent", options.intent);
221
+ }
222
+ if (options.beneficiaryHashId) {
223
+ url.searchParams.set("beneficiaryHashId", options.beneficiaryHashId);
218
224
  }
219
225
  if (initConfig.locale) {
220
226
  url.searchParams.set("locale", initConfig.locale);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nium/nium-sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "NIUM Onboarding SDK - Embed hosted onboarding forms with a clean JavaScript API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -8,12 +8,6 @@
8
8
  "files": [
9
9
  "dist"
10
10
  ],
11
- "scripts": {
12
- "build": "tsup src/index.ts --format cjs,esm --dts --clean",
13
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
14
- "type": "tsc --noEmit",
15
- "lint": "eslint src/"
16
- },
17
11
  "devDependencies": {
18
12
  "@rollup/rollup-darwin-arm64": "^4.60.1",
19
13
  "tsup": "^8.0.0",
@@ -22,5 +16,11 @@
22
16
  "license": "UNLICENSED",
23
17
  "publishConfig": {
24
18
  "access": "public"
19
+ },
20
+ "scripts": {
21
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean",
22
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
23
+ "type": "tsc --noEmit",
24
+ "lint": "eslint src/"
25
25
  }
26
- }
26
+ }