@nium/nium-sdk 0.1.6 → 0.1.7

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
@@ -27,6 +27,20 @@ interface NiumTheme {
27
27
  borderRadius?: string;
28
28
  fontFamily?: string;
29
29
  }
30
+ /** Per-field UI customization options for SDK beneficiary form fields. */
31
+ interface NiumFieldCustomization {
32
+ hidden?: boolean;
33
+ disabled?: boolean;
34
+ }
35
+ /** Per-section UI customization options for SDK beneficiary form sections. */
36
+ interface NiumSectionCustomization {
37
+ hidden?: boolean;
38
+ }
39
+ /** Supported beneficiary form field paths for `customizations.fields`. */
40
+ type NiumBeneficiaryFieldPath = 'line1' | 'line2' | 'city' | 'state' | 'postalCode' | 'countryCode' | 'communicationPreference' | 'contactNumber' | 'email' | 'termsCheckbox' | 'helperText';
41
+ type NiumBeneficiarySectionPath = 'demographicInfo' | 'communicationPreferences' | 'accountType' | 'bankAccountDetails';
42
+ type NiumBeneficiaryFieldCustomizations = Partial<Record<NiumBeneficiaryFieldPath | string, NiumFieldCustomization>>;
43
+ type NiumBeneficiarySectionCustomizations = Partial<Record<NiumBeneficiarySectionPath | string, NiumSectionCustomization>>;
30
44
  /** Prefill data for the payment (beneficiary) form */
31
45
  interface NiumPaymentPrefill {
32
46
  name?: string;
@@ -56,6 +70,8 @@ interface NiumElementOptions {
56
70
  customizations?: {
57
71
  minHeight?: number;
58
72
  maxHeight?: number;
73
+ fields?: NiumBeneficiaryFieldCustomizations;
74
+ sections?: NiumBeneficiarySectionCustomizations;
59
75
  };
60
76
  }
61
77
  interface NiumReadyEvent {
@@ -175,4 +191,4 @@ declare const init: (options: NiumInitOptions) => Promise<void>;
175
191
  */
176
192
  declare const createElement: (type: NiumElementType, options?: NiumElementOptions) => Promise<NiumElement>;
177
193
 
178
- export { type NiumCancelEvent, type NiumChangeEvent, NiumElement, type NiumElementOptions, type NiumElementType, type NiumEnv, type NiumErrorEvent, type NiumEvent, type NiumEventCallback, type NiumEventMap, type NiumInitOptions, type NiumPaymentPrefill, type NiumReadyEvent, type NiumResizeEvent, type NiumSubmitEvent, type NiumSubmitResult, type NiumTheme, createElement, init };
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 };
package/dist/index.d.ts CHANGED
@@ -27,6 +27,20 @@ interface NiumTheme {
27
27
  borderRadius?: string;
28
28
  fontFamily?: string;
29
29
  }
30
+ /** Per-field UI customization options for SDK beneficiary form fields. */
31
+ interface NiumFieldCustomization {
32
+ hidden?: boolean;
33
+ disabled?: boolean;
34
+ }
35
+ /** Per-section UI customization options for SDK beneficiary form sections. */
36
+ interface NiumSectionCustomization {
37
+ hidden?: boolean;
38
+ }
39
+ /** Supported beneficiary form field paths for `customizations.fields`. */
40
+ type NiumBeneficiaryFieldPath = 'line1' | 'line2' | 'city' | 'state' | 'postalCode' | 'countryCode' | 'communicationPreference' | 'contactNumber' | 'email' | 'termsCheckbox' | 'helperText';
41
+ type NiumBeneficiarySectionPath = 'demographicInfo' | 'communicationPreferences' | 'accountType' | 'bankAccountDetails';
42
+ type NiumBeneficiaryFieldCustomizations = Partial<Record<NiumBeneficiaryFieldPath | string, NiumFieldCustomization>>;
43
+ type NiumBeneficiarySectionCustomizations = Partial<Record<NiumBeneficiarySectionPath | string, NiumSectionCustomization>>;
30
44
  /** Prefill data for the payment (beneficiary) form */
31
45
  interface NiumPaymentPrefill {
32
46
  name?: string;
@@ -56,6 +70,8 @@ interface NiumElementOptions {
56
70
  customizations?: {
57
71
  minHeight?: number;
58
72
  maxHeight?: number;
73
+ fields?: NiumBeneficiaryFieldCustomizations;
74
+ sections?: NiumBeneficiarySectionCustomizations;
59
75
  };
60
76
  }
61
77
  interface NiumReadyEvent {
@@ -175,4 +191,4 @@ declare const init: (options: NiumInitOptions) => Promise<void>;
175
191
  */
176
192
  declare const createElement: (type: NiumElementType, options?: NiumElementOptions) => Promise<NiumElement>;
177
193
 
178
- export { type NiumCancelEvent, type NiumChangeEvent, NiumElement, type NiumElementOptions, type NiumElementType, type NiumEnv, type NiumErrorEvent, type NiumEvent, type NiumEventCallback, type NiumEventMap, type NiumInitOptions, type NiumPaymentPrefill, type NiumReadyEvent, type NiumResizeEvent, type NiumSubmitEvent, type NiumSubmitResult, type NiumTheme, createElement, init };
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 };
package/dist/index.js CHANGED
@@ -259,6 +259,18 @@ var createElement = async (type, options = {}) => {
259
259
  btoa(JSON.stringify(options.theme))
260
260
  );
261
261
  }
262
+ const iframeCustomizations = {
263
+ ...options.customizations?.fields ? { fields: options.customizations.fields } : {},
264
+ ...options.customizations?.sections ? { sections: options.customizations.sections } : {}
265
+ };
266
+ if (Object.keys(iframeCustomizations).length > 0) {
267
+ url.searchParams.set(
268
+ "customizations",
269
+ btoa(
270
+ JSON.stringify(iframeCustomizations)
271
+ )
272
+ );
273
+ }
262
274
  return new NiumElement(url.toString(), type, options, origin);
263
275
  };
264
276
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -231,6 +231,18 @@ var createElement = async (type, options = {}) => {
231
231
  btoa(JSON.stringify(options.theme))
232
232
  );
233
233
  }
234
+ const iframeCustomizations = {
235
+ ...options.customizations?.fields ? { fields: options.customizations.fields } : {},
236
+ ...options.customizations?.sections ? { sections: options.customizations.sections } : {}
237
+ };
238
+ if (Object.keys(iframeCustomizations).length > 0) {
239
+ url.searchParams.set(
240
+ "customizations",
241
+ btoa(
242
+ JSON.stringify(iframeCustomizations)
243
+ )
244
+ );
245
+ }
234
246
  return new NiumElement(url.toString(), type, options, origin);
235
247
  };
236
248
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nium/nium-sdk",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
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",
@@ -15,6 +15,7 @@
15
15
  "lint": "eslint src/"
16
16
  },
17
17
  "devDependencies": {
18
+ "@rollup/rollup-darwin-arm64": "^4.60.1",
18
19
  "tsup": "^8.0.0",
19
20
  "typescript": "^5.0.0"
20
21
  },