@nium/nium-sdk 0.1.2 → 0.1.4

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
@@ -6,12 +6,18 @@ type NiumElementType = 'payment' | 'tax' | 'identity' | 'full';
6
6
  interface NiumInitOptions {
7
7
  /** Target environment */
8
8
  env: NiumEnv;
9
- /** Session code returned by marketplace-service /init */
10
- sessionCode: string;
11
9
  /** Optional locale (defaults to 'en') */
12
10
  locale?: string;
13
11
  /** Override the hosted form base URL (useful for local dev) */
14
12
  hostedFormUrl?: string;
13
+ /** Authorization code from NIAM oauth/authcode */
14
+ authCode?: string;
15
+ /** PKCE code verifier corresponding to the code challenge sent to get authCode */
16
+ codeVerifier?: string;
17
+ /** Customer hash ID */
18
+ customerHashId?: string;
19
+ /** Client ID */
20
+ clientId?: string;
15
21
  }
16
22
  /** Theme options for embedded components */
17
23
  interface NiumTheme {
@@ -23,7 +29,7 @@ interface NiumTheme {
23
29
  interface NiumPaymentPrefill {
24
30
  name?: string;
25
31
  email?: string;
26
- entityType?: 'individual' | 'business';
32
+ entityType?: 'individual' | 'corporate';
27
33
  contactNumber?: string;
28
34
  address?: {
29
35
  line1?: string;
@@ -144,7 +150,7 @@ declare class NiumElement {
144
150
  *
145
151
  * await init({
146
152
  * env: 'sandbox',
147
- * sessionCode: '<code-from-server>',
153
+ * authCode: '<auth-code-from-niam>',
148
154
  * })
149
155
  *
150
156
  * const element = await createElement('payment')
package/dist/index.d.ts CHANGED
@@ -6,12 +6,18 @@ type NiumElementType = 'payment' | 'tax' | 'identity' | 'full';
6
6
  interface NiumInitOptions {
7
7
  /** Target environment */
8
8
  env: NiumEnv;
9
- /** Session code returned by marketplace-service /init */
10
- sessionCode: string;
11
9
  /** Optional locale (defaults to 'en') */
12
10
  locale?: string;
13
11
  /** Override the hosted form base URL (useful for local dev) */
14
12
  hostedFormUrl?: string;
13
+ /** Authorization code from NIAM oauth/authcode */
14
+ authCode?: string;
15
+ /** PKCE code verifier corresponding to the code challenge sent to get authCode */
16
+ codeVerifier?: string;
17
+ /** Customer hash ID */
18
+ customerHashId?: string;
19
+ /** Client ID */
20
+ clientId?: string;
15
21
  }
16
22
  /** Theme options for embedded components */
17
23
  interface NiumTheme {
@@ -23,7 +29,7 @@ interface NiumTheme {
23
29
  interface NiumPaymentPrefill {
24
30
  name?: string;
25
31
  email?: string;
26
- entityType?: 'individual' | 'business';
32
+ entityType?: 'individual' | 'corporate';
27
33
  contactNumber?: string;
28
34
  address?: {
29
35
  line1?: string;
@@ -144,7 +150,7 @@ declare class NiumElement {
144
150
  *
145
151
  * await init({
146
152
  * env: 'sandbox',
147
- * sessionCode: '<code-from-server>',
153
+ * authCode: '<auth-code-from-niam>',
148
154
  * })
149
155
  *
150
156
  * const element = await createElement('payment')
package/dist/index.js CHANGED
@@ -196,9 +196,9 @@ var NiumElement = class {
196
196
  var initConfig = null;
197
197
  var ENV_URLS = {
198
198
  local: "http://localhost:3000",
199
- sandbox: "https://onboard.sandbox.niumops.com",
200
199
  qa: "https://onboard-qa.nium.com",
201
- production: "https://onboard.niumops.com"
200
+ sandbox: "https://onboard-sandbox.nium.com/",
201
+ production: "https://onboard.nium.com"
202
202
  };
203
203
  var ELEMENT_ROUTES = {
204
204
  payment: "/sdk/beneficiary-form",
@@ -207,8 +207,8 @@ var ELEMENT_ROUTES = {
207
207
  full: "/sdk/full-form"
208
208
  };
209
209
  var init = async (options) => {
210
- if (!options.sessionCode) {
211
- throw new Error("@nium/nium-sdk: sessionCode is required");
210
+ if (!options.authCode) {
211
+ throw new Error("@nium/nium-sdk: authCode is required");
212
212
  }
213
213
  if (!options.env) {
214
214
  throw new Error("@nium/nium-sdk: env is required");
@@ -226,7 +226,18 @@ var createElement = async (type, options = {}) => {
226
226
  const origin = new URL(baseUrl).origin;
227
227
  const route = ELEMENT_ROUTES[type];
228
228
  const url = new URL(`${baseUrl}${route}`);
229
- url.searchParams.set("code", initConfig.sessionCode);
229
+ if (initConfig.authCode) {
230
+ url.searchParams.set("authCode", initConfig.authCode);
231
+ }
232
+ if (initConfig.codeVerifier) {
233
+ url.searchParams.set("codeVerifier", initConfig.codeVerifier);
234
+ }
235
+ if (initConfig.customerHashId) {
236
+ url.searchParams.set("customerHashId", initConfig.customerHashId);
237
+ }
238
+ if (initConfig.clientId) {
239
+ url.searchParams.set("clientId", initConfig.clientId);
240
+ }
230
241
  if (initConfig.locale) {
231
242
  url.searchParams.set("locale", initConfig.locale);
232
243
  }
package/dist/index.mjs CHANGED
@@ -168,9 +168,9 @@ var NiumElement = class {
168
168
  var initConfig = null;
169
169
  var ENV_URLS = {
170
170
  local: "http://localhost:3000",
171
- sandbox: "https://onboard.sandbox.niumops.com",
172
171
  qa: "https://onboard-qa.nium.com",
173
- production: "https://onboard.niumops.com"
172
+ sandbox: "https://onboard-sandbox.nium.com/",
173
+ production: "https://onboard.nium.com"
174
174
  };
175
175
  var ELEMENT_ROUTES = {
176
176
  payment: "/sdk/beneficiary-form",
@@ -179,8 +179,8 @@ var ELEMENT_ROUTES = {
179
179
  full: "/sdk/full-form"
180
180
  };
181
181
  var init = async (options) => {
182
- if (!options.sessionCode) {
183
- throw new Error("@nium/nium-sdk: sessionCode is required");
182
+ if (!options.authCode) {
183
+ throw new Error("@nium/nium-sdk: authCode is required");
184
184
  }
185
185
  if (!options.env) {
186
186
  throw new Error("@nium/nium-sdk: env is required");
@@ -198,7 +198,18 @@ var createElement = async (type, options = {}) => {
198
198
  const origin = new URL(baseUrl).origin;
199
199
  const route = ELEMENT_ROUTES[type];
200
200
  const url = new URL(`${baseUrl}${route}`);
201
- url.searchParams.set("code", initConfig.sessionCode);
201
+ if (initConfig.authCode) {
202
+ url.searchParams.set("authCode", initConfig.authCode);
203
+ }
204
+ if (initConfig.codeVerifier) {
205
+ url.searchParams.set("codeVerifier", initConfig.codeVerifier);
206
+ }
207
+ if (initConfig.customerHashId) {
208
+ url.searchParams.set("customerHashId", initConfig.customerHashId);
209
+ }
210
+ if (initConfig.clientId) {
211
+ url.searchParams.set("clientId", initConfig.clientId);
212
+ }
202
213
  if (initConfig.locale) {
203
214
  url.searchParams.set("locale", initConfig.locale);
204
215
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nium/nium-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
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",