@nuvei-connect/nc-websdk 1.12.3 → 1.12.5

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 CHANGED
@@ -8,15 +8,16 @@ A practical guide for integrating **Nuvei WebSDK** into a React application usin
8
8
 
9
9
  | Item | Description | Example |
10
10
  |---|---|---|
11
- | **Backend Access Token** | A valid access token required by the backend to authenticate with Nuvei services. | `634f59fa0917b38886a2a781d24362c405:79ac4c2087d6053430e6abc2734f4c42fd` |
12
- | **Authentication Endpoint** | Backend endpoint used by the WebSDK to create the MFE session. | `POST https://api.example.com/api/auth/session` |
11
+ | **Backend Access Token** | A valid access token required by your backend to authenticate with Nuvei services. | `634f59fa0917b38886a2a781d24362c405:79ac4c2087d6053430e6abc2734f4c42fd` |
12
+ | **Authentication Endpoint** | Backend nuvei endpoint to create the MFE session. | `POST https://nuvei_backend_url/auth/micro-frontend/tokens` |
13
13
  | **Module Name** | The Nuvei module to be loaded by the WebSDK. | `ONBOARDING`,`DOC_UTILITY` |
14
- | **Merchant / Partner Distinguishers** | Values used to identify whether the current request is for a Merchant or Partner. | `isGuest: true`, `emailAddress: "user@example.com"`, `partnerId: "partner_123"` |
14
+ | **Merchant / Partner Distinguishers** | Values used to identify whether the current request is for a Merchant or Partner. | **Partner:** `isGuest: false`,`partnerId(optional):'your_partner_id'`, <br>**Merchant:** `isGuest: true`, `emailAddress: "user@example.com"` |
15
+
15
16
  ---
16
17
 
17
18
  # Step 1 - Installation
18
19
 
19
- Install the Nuvei WebSDK package:
20
+ Install the Nuvei WebSDK package in your `React` project:
20
21
 
21
22
  ```bash
22
23
  npm install @nuvei-connect/nc-websdk
@@ -41,31 +42,31 @@ import React, { useEffect, useRef } from "react";
41
42
 
42
43
  import NuveiSDK, { ModulesNameEnum } from "@nuvei-connect/nc-websdk";
43
44
 
44
- const containerRef = useRef<HTMLDivElement>(null);
45
45
  ```
46
46
 
47
47
  ---
48
48
 
49
49
  # Step 3 – Mount the Nuvei WebSDK
50
50
 
51
- Initialize the SDK once the container is available. In `App.tsx`.
51
+ Initialize the SDK once the container is available. Inside `App.tsx`.
52
52
 
53
53
  ```ts
54
- useEffect(() => {
54
+ const containerRef = useRef<HTMLDivElement>(null);
55
+
56
+ useEffect(() => {
55
57
  if (!containerRef.current) {
56
58
  return;
57
59
  }
58
60
 
59
61
  NuveiSDK.mount({
60
- config: {environment: "dev2"},
62
+ config: {environment: "websdk_environment"},
61
63
  container: containerRef.current.id,
62
- componentName: ModulesNameEnum.ONBOARDING_MERCHANT,
64
+ componentName: ModulesNameEnum.ONBOARDING_PARTNER,
63
65
  fetchClientSession : async() => {
64
66
  const response = await fetch(`${backendApiUrl}/api/auth/session`, { method: "POST"});
65
67
  if (!response.ok) { throw new Error(`Session error: ${response.status}`);}
66
68
  return await response.json();
67
- };,
68
-
69
+ },
69
70
  onError: (error: any) => { console.error("NuveiWebSDK Error:", error)},
70
71
  }).catch((error: any) => {
71
72
  console.error("NuveiWebSDK Mount Error:", error);
@@ -79,12 +80,12 @@ return (
79
80
 
80
81
  # Step 4. Backend Configuration
81
82
 
82
- The backend then calls the Nuvei token/session endpoint : in nodejs backend
83
+ The backend then calls the Nuvei token/session endpoint : `server.ts`
83
84
 
84
85
  ```ts
85
86
  app.post("/api/auth/session", async (_req: Request, res: Response) => {
86
87
  try {
87
- const response = await fetch('https://nuvei_backend_url/dev2/v1/auth/micro-frontend/tokens', {
88
+ const response = await fetch('nuvei_auth_endpoint_for_mfe_token', {
88
89
  method: "POST",
89
90
  headers: {
90
91
  "Content-Type": "application/json",
@@ -97,8 +98,6 @@ app.post("/api/auth/session", async (_req: Request, res: Response) => {
97
98
  },
98
99
  ],
99
100
  isGuest: false,
100
- emailAddress: "your_email_address",
101
- partnerId:"your_partner_id"
102
101
  }),
103
102
  });
104
103
 
@@ -115,76 +114,29 @@ These are the **minimum requirements** needed to integrate the Nuvei Web SDK.
115
114
 
116
115
  If additional configuration or advanced options are required, please refer to the **sections below in this documentation** for detailed configuration references and usage examples.
117
116
 
118
- ---
119
-
120
- # Complete React Implementation
121
-
122
- ## `App.tsx`
123
-
124
- The following is the complete minimal React implementation:
125
-
126
- ```tsx
127
- import React, { useEffect, useRef } from "react";
128
-
129
- import NuveiSDK, { ModulesNameEnum } from "@nuvei-connect/nc-websdk";
130
-
131
- const App: React.FC = () => {
132
- const containerRef = useRef<HTMLDivElement>(null);
133
-
134
- const backendApiUrl =
135
- import.meta.env.BACKEND_API_URL || "http://localhost:3005";
136
-
137
- useEffect(() => {
138
- if (!containerRef.current) {
139
- return;
140
- }
141
-
142
- NuveiSDK.mount({
143
- config: {environment: "dev2"},
144
- container: containerRef.current.id,
145
- componentName: ModulesNameEnum.ONBOARDING_MERCHANT,
146
- fetchClientSession : async() => {
147
- const response = await fetch(`${backendApiUrl}/api/auth/session`, { method: "POST"});
148
- if (!response.ok) { throw new Error(`Session error: ${response.status}`);}
149
- return await response.json();
150
- },
151
-
152
- onError: (error: any) => { console.error("NuveiWebSDK Error:", error)},
153
- }).catch((error: any) => {
154
- console.error("NuveiWebSDK Mount Error:", error);
155
- });
156
- }, []);
157
-
158
-
159
- return (<div id="nuvei-websdk-container" ref={containerRef} style={{width: "100%",height: "100%" }}/>);
160
- };
161
-
162
- export default App;
163
- ```
164
117
 
165
118
  ---
166
119
 
167
- # 5. Loading Different Modules
120
+ # Loading Different Modules
168
121
 
169
122
  The Nuvei WebSDK supports separate modules for different use cases:
170
123
 
171
124
  | Module | Purpose | Component |
172
125
  | --------------- | ------------------------------- | -------------------------------------------- |
173
- | **ONBOARDING** | Merchant and Partner onboarding | `ONBOARDING_MERCHANT` / `ONBOARDING_PARTNER` |
126
+ | **ONBOARDING** | Merchant Onboarding and Merchant Invitation | `ONBOARDING_MERCHANT` / `ONBOARDING_PARTNER` |
174
127
  | **DOC_UTILITY** | Document utility operations | `DOC_UTILITY` |
175
128
 
176
129
  For **Onboarding**, the backend authentication request and the SDK `componentName` determine whether the flow is for a **Merchant** or **Partner**.
177
130
 
178
131
  ---
179
132
 
180
- ## 5.1 Partner Onboarding
133
+ ## a. Merchant Invitation
181
134
 
182
- For Partner onboarding, provide the following values when authenticating with the Nuvei backend:
135
+ For Merchant Invitation, provide the following values when authenticating with the Nuvei backend:
183
136
 
184
137
  * **Module:** `ONBOARDING`
185
138
  * **isGuest:** `false`
186
- * **emailAddress(optional):** Partner email address
187
- * **partnerId(optional):** Partner ID
139
+ * **partnerId(required for partnerStaff, optional for nuveiStaff):** Partner ID
188
140
 
189
141
  Backend Authentication Request:
190
142
 
@@ -196,7 +148,6 @@ body: JSON.stringify({
196
148
  },
197
149
  ],
198
150
  isGuest: false,
199
- emailAddress: "your_partner_email_address",
200
151
  partnerId: "your_partner_id",
201
152
  }),
202
153
  ```
@@ -212,14 +163,14 @@ NuveiSDK.mount({
212
163
 
213
164
  ---
214
165
 
215
- ## 5.2 Merchant Onboarding
166
+ ## b. Merchant Onboarding
216
167
 
217
168
  For Merchant onboarding, provide the following values when authenticating with the Nuvei backend:
218
169
 
219
170
  * **Module:** `ONBOARDING`
220
171
  * **isGuest:** `true`
221
172
  * **emailAddress:** Merchant email address
222
- * **partnerId(optional):** Partner ID
173
+ * **partnerId(optional):** Partner ID to which specific merchant belongs to
223
174
 
224
175
  Backend Authentication Request:
225
176
 
@@ -231,8 +182,7 @@ body: JSON.stringify({
231
182
  },
232
183
  ],
233
184
  isGuest: true,
234
- emailAddress: "your_merchant_email_address",
235
- partnerId: "your_partner_id",
185
+ emailAddress: "your_merchant_email_address"
236
186
  }),
237
187
  ```
238
188
 
@@ -246,7 +196,7 @@ NuveiSDK.mount({
246
196
 
247
197
  ---
248
198
 
249
- ## 5.3 Document Utility
199
+ ## c. Document Utility
250
200
 
251
201
  Document Utility is a separate module from Onboarding.
252
202
 
@@ -261,6 +211,7 @@ Example:
261
211
  NuveiSDK.mount({
262
212
  container: containerRef.current.id,
263
213
  componentName: ModulesNameEnum.DOC_UTILITY,
214
+ config: {environment: "websdk_environment" , documentRequestId : 'your_document_request_id'},
264
215
  });
265
216
  ```
266
217
 
@@ -270,11 +221,11 @@ The authentication/session request should include the module required by the Doc
270
221
 
271
222
 
272
223
 
273
- # 6. Session Lifecycle Callbacks
224
+ # Session Lifecycle Callbacks
274
225
 
275
226
  For applications that need full session lifecycle management, the SDK can receive:
276
227
 
277
- 1.`fetchClientSession`
228
+ a. `fetchClientSession`
278
229
  Creates or retrieves the each session required by the SDK to communicate with the Nuvei backend.
279
230
  ```tsx
280
231
  const fetchClientSession = async () => {
@@ -290,7 +241,7 @@ const fetchClientSession = async () => {
290
241
  };
291
242
  ```
292
243
 
293
- 2.`refreshClientSession`
244
+ b.`refreshClientSession`
294
245
  Refreshes the current session using the refresh token. The SDK can use this callback when the existing session is expired or approaching expiration
295
246
  ```tsx
296
247
  const refreshClientSession = async (refreshToken: string) => {
@@ -314,7 +265,7 @@ const refreshClientSession = async (refreshToken: string) => {
314
265
  };
315
266
  ```
316
267
 
317
- 3.`destroySession`
268
+ c.`destroySession`
318
269
  Terminates the current session on the backend. This is typically used when the user logs out or when the SDK session needs to be explicitly invalidated.
319
270
  ```tsx
320
271
  const destroySession = async () => {
@@ -332,154 +283,128 @@ const destroySession = async () => {
332
283
 
333
284
  ---
334
285
 
335
- ## 13. Configuration References
286
+ ## Modules Switching
336
287
 
337
- | Property | Type | Default | Description |
338
- | ----------------------- | --------------------------- | ----------------------- | ---------------------------------------------------------- |
339
- | **`moduleName`** | `ModulesNameEnum \| string` | `ONBOARDING_MERCHANT` | Nuvei module to render |
340
- | **`requestId`** | `string` | `undefined` | Onboarding application/request ID |
341
- | **`documentRequestId`** | `string` | `undefined` | Document Utility request ID |
342
- | **`environment`** | `string` | — | Target environment |
343
- | **`apiBaseUrl`** | `string` | `http://localhost:3005` | Base URL for your backend API
344
- | **`nuveiBackendUrl`** | `string` | `https://nuvei_backend_url/dev2/v1/auth/micro-frontend/tokens` | Base URL for the Nuvei backend API |
345
- | **`isGuest`** | `boolean` | `false` | Indicates whether the current user is a guest |
346
- | **`emailAddress`** | `string` | `undefined` | Email address used to identify the current user |
347
- | **`partnerId`** | `string` | `undefined` | Partner ID used when accessing the Partner onboarding flow |
348
- | **`onCompleted`** | `(data) => void` | `undefined` | Callback invoked when the flow is completed |
349
- | **`onError`** | `(error) => void` | `undefined` | Callback invoked when an error occurs |
350
- | **`style`** | `React.CSSProperties` | `undefined` | Optional container styling |
288
+ Module switching should be implemented with one React page for each WebSDK module. In the demo project, the pages are exposed through these routes:
351
289
 
290
+ | Route | Page | WebSDK component |
291
+ |---|---|---|
292
+ | `/` | Redirects to the partner page | — |
293
+ | `/partner` | Partner invitation | `ModulesNameEnum.ONBOARDING_PARTNER` |
294
+ | `/merchant` | Merchant onboarding | `ModulesNameEnum.ONBOARDING_MERCHANT` |
295
+ | `/doc-utility` | Document utility | `ModulesNameEnum.DOC_UTILITY` |
352
296
 
353
- # 15. Production Checklist
354
-
355
- Before deploying the integration, verify:
356
-
357
- ### Frontend
358
-
359
- - [ ] `@nuvei-connect/nc-websdk` is installed.
360
- - [ ] Correct `ModulesNameEnum` is selected.
361
- - [ ] SDK container has a stable `id`.
362
- - [ ] `BACKEND_API_URL` points to the correct backend.
363
- - [ ] `onError` is configured.
364
- - [ ] Required session callbacks are supplied.
365
-
366
- ### Backend
367
-
368
- - [ ] Nuvei authorization is stored securely.
369
- - [ ] Nuvei credentials are never exposed to the browser.
370
- - [ ] `/api/auth/session` is implemented.
371
- - [ ] Refresh endpoint is implemented when required.
372
- - [ ] Destroy/logout endpoint is implemented when required.
373
- - [ ] `emailAddress`, `partnerId`, and `isGuest` are populated from the appropriate application context.
374
- - [ ] Correct Nuvei environment endpoints are configured.
375
-
376
- ### Environment
377
-
378
- - [ ] Development environment is verified.
379
- - [ ] UAT environment is verified.
380
- - [ ] Production configuration is separated from development configuration.
381
- - [ ] Backend API uses HTTPS in production.
382
-
383
- ---
384
-
385
- # 16. Common Errors
297
+ The partner page is the default page when the React application starts. The merchant and partner pages mount the onboarding modules. The document utility page is mounted separately and receives its `documentRequestId` from the URL.
386
298
 
387
- ## SDK does not render
299
+ ### 1. Mount the partner and merchant modules
388
300
 
389
- Check:
301
+ The partner page uses `ONBOARDING_PARTNER` and the merchant page uses `ONBOARDING_MERCHANT`. Both pages listen for the `SWITCH_MODULE` message.
390
302
 
391
303
  ```tsx
392
- if (!containerRef.current) {
393
- return;
394
- }
304
+ NuveiSDK.mount({
305
+ container: containerRef.current,
306
+ componentName: ModulesNameEnum.ONBOARDING_PARTNER,
307
+ config: { environment: "uat" },
308
+ fetchClientSession,
309
+ onMessage: (message: any) => {
310
+ if (
311
+ message.source === "NUVEI_IFRAME" &&
312
+ message.action === "SWITCH_MODULE"
313
+ ) {
314
+ const documentRequestId =
315
+ message.data?.payload?.documentRequestId;
316
+
317
+ const query = documentRequestId
318
+ ? `?documentRequestId=${encodeURIComponent(documentRequestId)}`
319
+ : "";
320
+
321
+ navigate(`/doc-utility${query}`);
322
+ }
323
+ },
324
+ });
395
325
  ```
396
326
 
397
- and confirm that the container exists:
327
+ For the merchant page, only the component name changes:
398
328
 
399
329
  ```tsx
400
- <div id="nuvei-websdk-container" ref={containerRef} />
330
+ componentName: ModulesNameEnum.ONBOARDING_MERCHANT
401
331
  ```
402
332
 
403
- ---
333
+ The session request must also use the correct onboarding details for the page. For example, partner invitation uses `isGuest: false`, while merchant onboarding uses `isGuest: true`:
404
334
 
405
- ## Session request fails
406
-
407
- Check the browser network request:
408
-
409
- ```text
410
- POST /api/auth/session
335
+ ```tsx
336
+ body: JSON.stringify({
337
+ modules: [{ name: "ONBOARDING" }],
338
+ isGuest: false,
339
+ }),
411
340
  ```
412
341
 
413
- Then verify:
414
-
415
- 1. Backend is running.
416
- 2. `BACKEND_API_URL` is correct.
417
- 3. Backend can reach Nuvei.
418
- 4. `NUVEI_AUTHORIZATION` is valid.
419
- 5. Required session parameters are populated.
420
- 6. The backend returns valid JSON.
342
+ ### 2. Mount Document Utility on its own page
421
343
 
422
- ---
423
-
424
- ## SDK mount fails
425
-
426
- Check the SDK error callback:
344
+ The document utility page reads `documentRequestId` from the current URL and passes it to the SDK configuration:
427
345
 
428
346
  ```tsx
429
- onError: (error) => {
430
- console.error("NuveiWebSDK Error:", error);
431
- };
432
- ```
433
-
434
- Also check the promise rejection:
347
+ const documentRequestId = new URLSearchParams(
348
+ window.location.search,
349
+ ).get("documentRequestId");
435
350
 
436
- ```tsx
437
- .catch((error) => {
438
- console.error(
439
- "NuveiWebSDK Mount Error:",
440
- error
441
- );
351
+ NuveiSDK.mount({
352
+ container: containerRef.current,
353
+ componentName: ModulesNameEnum.DOC_UTILITY,
354
+ config: {
355
+ environment: "uat",
356
+ documentRequestId: documentRequestId ?? undefined,
357
+ },
358
+ fetchClientSession,
359
+ onMessage: (message: any) => {
360
+ if (
361
+ message.source === "NUVEI_IFRAME" &&
362
+ message.action === "SWITCH_MODULE"
363
+ ) {
364
+ navigate("/partner");
365
+ }
366
+ },
442
367
  });
443
368
  ```
444
369
 
445
- ---
370
+ When an onboarding module sends `SWITCH_MODULE`, the app navigates to a URL such as:
446
371
 
447
- # 17. Minimal Integration
372
+ ```text
373
+ /doc-utility?documentRequestId=your_document_request_id
374
+ ```
448
375
 
449
- If you only need the simplest integration, the essential flow is:
376
+ The document utility page then uses that value to initialize the requested document flow. The backend session request for this page must include the `DOC_UTILITY` module:
450
377
 
451
378
  ```tsx
452
- const fetchClientSession = async () => {
453
- const response = await fetch(`${backendApiUrl}/api/auth/session`, {
454
- method: "POST",
455
- });
456
-
457
- if (!response.ok) {
458
- throw new Error(`Session error: ${response.status}`);
459
- }
460
-
461
- return response.json();
462
- };
463
-
464
- useEffect(() => {
465
- if (!containerRef.current) {
466
- return;
467
- }
468
-
469
- NuveiSDK.mount({
470
- container: containerRef.current.id,
471
- componentName: ModulesNameEnum.ONBOARDING_MERCHANT,
472
- fetchClientSession,
473
-
474
- config: {
475
- environment: "dev2",
476
- },
477
- });
478
- }, []);
379
+ body: JSON.stringify({
380
+ modules: [{ name: "DOC_UTILITY" }],
381
+ isGuest: true,
382
+ }),
479
383
  ```
480
384
 
481
- This is the recommended starting point for a basic React integration.
385
+ Each page is responsible for mounting its own SDK component. The partner and merchant pages navigate to Document Utility with `documentRequestId`. The Document Utility page listens for `SWITCH_MODULE` and navigates back to the partner page.
386
+
387
+
388
+ ## Configuration References
389
+
390
+ | Property | Type | Example / Default | Configure in | Description |
391
+ |---|---|---|---|---|
392
+ | `componentName` | `ModulesNameEnum` | `ModulesNameEnum.ONBOARDING_MERCHANT` | `NuveiSDK.mount()` | SDK component to render. Use `ONBOARDING_MERCHANT`, `ONBOARDING_PARTNER`, or `DOC_UTILITY`. |
393
+ | `config.environment` | ` "uat" \| "prod"` | `config` inside `NuveiSDK.mount()` | Nuvei environment used by the WebSDK. This value must be provided inside the `config` object. |
394
+ | `config.requestId` | `string` | `"onboarding-request-123"` | `config` inside `NuveiSDK.mount()` | Optional onboarding application or request identifier. Provide this inside `config` when continuing or loading a specific onboarding request. |
395
+ | `config.documentRequestId` | `string` | `"document-request-456"` | `config` inside `NuveiSDK.mount()` | Optional Document Utility request identifier. Provide this inside `config` when operating on a specific document request. |
396
+ | `config.initialPath` | `string` | `"/_admin/my-organization"` | `config` inside `NuveiSDK.mount()` | Optional path the iframe opens on, used in place of the module's default path. Use it to open a specific page without first loading the default one. |
397
+ | `container` | `HTMLElement \| string` | `"nuvei-websdk-container"` | `NuveiSDK.mount()` | DOM element or element ID where the SDK iframe will be rendered. |
398
+ | `fetchClientSession` | `() => Promise<IClientSession>` | `fetchClientSession` | `NuveiSDK.mount()` | Required callback that requests a client session from your backend. |
399
+ | `refreshClientSession` | `(params: { refreshToken: string; accessToken: string }) => Promise<IClientRefreshSession>` | `refreshClientSession` | `NuveiSDK.mount()` | Optional callback used to refresh an expired or expiring client session. |
400
+ | `destroySession` | `() => Promise<boolean>` | `destroySession` | `NuveiSDK.mount()` | Optional callback used to invalidate or destroy the backend session. |
401
+ | `onReady` | `(instance) => void` | `onReady` | `NuveiSDK.mount()` | Optional callback invoked when the SDK is initialized and ready. |
402
+ | `onError` | `(error: unknown) => void` | `onError` | `NuveiSDK.mount()` | Optional callback invoked when the SDK encounters an error. |
403
+ | `onMessage` | `(message: unknown) => void` | `onMessage` | `NuveiSDK.mount()` | Optional callback for messages received from the SDK iframe. Use this if the SDK integration provides completion events through messages. |
404
+ | `apiBaseUrl` | `string` | `"/api"` | Frontend application configuration | Base URL of your own backend API. This is not a Nuvei SDK configuration property. |
405
+ | `nuveiBackendUrl` | `string` | `"https://<nuvei-host>/dev2/v1/auth/micro-frontend/tokens"` | Backend environment configuration | Nuvei session endpoint called by your backend. Keep this value on the server. |
406
+ | `isGuest` | `boolean` | `true` or `false` | Backend session request | Indicates whether the session is being created for a guest merchant or an authenticated partner. |
407
+ | `emailAddress` | `string` | `"merchant@example.com"` | Backend session request | Email address used by Nuvei to identify the current user or merchant. |
408
+ | `partnerId` | `string` | `"partner_123"` | Backend session request | Optional partner identifier used for partner-related onboarding flows. |
482
409
 
483
410
  ---
484
-
485
- The frontend remains responsible for rendering the WebSDK, while the backend handles the Nuvei session lifecycle and secure communication with Nuvei
package/dist/cdn-index.js CHANGED
@@ -45,6 +45,7 @@
45
45
  ModulesNameEnum3["ONBOARDING_PARTNER"] = "ONBOARDING_PARTNER";
46
46
  ModulesNameEnum3["ONBOARDING_MERCHANT"] = "ONBOARDING_MERCHANT";
47
47
  ModulesNameEnum3["DOC_UTILITY"] = "DOC_UTILITY";
48
+ ModulesNameEnum3["USER_MANAGEMENT"] = "USER_MANAGEMENT";
48
49
  return ModulesNameEnum3;
49
50
  })(ModulesNameEnum || {});
50
51
 
@@ -284,7 +285,7 @@
284
285
  },
285
286
  sessionCheckInterval: 10 * 60 * 1e3,
286
287
  // 5 minutes
287
- environment: "uat"
288
+ environment: "uat2"
288
289
  };
289
290
 
290
291
  // src/utils/date.utils.ts
@@ -310,31 +311,49 @@
310
311
  local: "http://localhost:4000",
311
312
  dev3: "https://dev3-non-pci.eastus.cloudapp.azure.com",
312
313
  dev2: "https://dev2-non-pci.eastus.cloudapp.azure.com",
313
- uat: "https://ignite-preprod.nuvei.com",
314
- prod: "https://ignite.nuvei.com"
314
+ uat2: "https://ignite-preprod.nuvei.com",
315
+ "prod-na": "https://ignite.nuvei.com",
316
+ "prod-eu": "https://ignite-eu.nuvei.com",
317
+ "dev2-2": "https://dev2-non-pci-2.eastus.cloudapp.azure.com"
315
318
  };
316
319
  var DOCUMENT_UTILITY_BASE_URLS = {
317
320
  local: "http://localhost:5000",
318
321
  dev3: "https://dev3-non-pci.eastus.cloudapp.azure.com",
319
322
  dev2: "https://dev2-non-pci.eastus.cloudapp.azure.com",
320
- uat: "https://ignite-preprod.nuvei.com",
321
- prod: "https://ignite.nuvei.com"
323
+ uat2: "https://ignite-preprod.nuvei.com",
324
+ "prod-na": "https://ignite.nuvei.com",
325
+ "prod-eu": "https://ignite-eu.nuvei.com",
326
+ "dev2-2": "https://dev2-non-pci-2.eastus.cloudapp.azure.com"
327
+ };
328
+ var USER_MANAGEMENT_BASE_URLS = {
329
+ local: "http://localhost:5001",
330
+ dev3: "https://dev3-non-pci.eastus.cloudapp.azure.com",
331
+ dev2: "https://dev2-non-pci.eastus.cloudapp.azure.com",
332
+ uat2: "https://ignite-preprod.nuvei.com",
333
+ "prod-na": "https://ignite.nuvei.com",
334
+ "prod-eu": "https://ignite-eu.nuvei.com",
335
+ "dev2-2": "https://dev2-non-pci-2.eastus.cloudapp.azure.com"
322
336
  };
323
337
  var MODULE_PATHS = {
324
338
  ["ONBOARDING_PARTNER" /* ONBOARDING_PARTNER */]: "/_onboarding/partner/application",
325
339
  ["ONBOARDING_MERCHANT" /* ONBOARDING_MERCHANT */]: "/_onboarding/merchant/application",
326
- ["DOC_UTILITY" /* DOC_UTILITY */]: "/_document-upload"
340
+ ["DOC_UTILITY" /* DOC_UTILITY */]: "/_document-upload",
341
+ ["USER_MANAGEMENT" /* USER_MANAGEMENT */]: "/_admin/user-management"
327
342
  };
328
343
  var DOCUMENT_REQUEST_ID_PARAM = "documentRequestId";
329
344
  var REQUEST_ID_PARAM = "requestId";
330
- var getEnvironmentBaseUrl = (environment = "prod") => {
345
+ var getEnvironmentBaseUrl = (environment) => {
331
346
  var _a;
332
347
  return (_a = ENVIRONMENT_BASE_URLS[environment]) != null ? _a : ENVIRONMENT_BASE_URLS.prod;
333
348
  };
334
- var getDocumentUtilityBaseUrl = (environment = "prod") => {
349
+ var getDocumentUtilityBaseUrl = (environment) => {
335
350
  var _a;
336
351
  return (_a = DOCUMENT_UTILITY_BASE_URLS[environment]) != null ? _a : DOCUMENT_UTILITY_BASE_URLS.prod;
337
352
  };
353
+ var getUserManagementBaseUrl = (environment = "prod") => {
354
+ var _a;
355
+ return (_a = USER_MANAGEMENT_BASE_URLS[environment]) != null ? _a : USER_MANAGEMENT_BASE_URLS.prod;
356
+ };
338
357
  var getModulePath = (componentName) => {
339
358
  var _a;
340
359
  return (_a = MODULE_PATHS[componentName]) != null ? _a : "";
@@ -360,25 +379,27 @@
360
379
  if (componentName === "DOC_UTILITY" /* DOC_UTILITY */) {
361
380
  return getDocumentUtilityBaseUrl(environment);
362
381
  }
382
+ if (componentName === "USER_MANAGEMENT" /* USER_MANAGEMENT */) {
383
+ return getUserManagementBaseUrl(environment);
384
+ }
363
385
  return getEnvironmentBaseUrl(environment);
364
386
  };
365
387
  var resolveIframeUrl = (componentName, config) => {
366
- var _a, _b, _c;
367
- const environment = (_a = config.environment) != null ? _a : "prod";
368
- const baseUrl = getBaseUrl(
369
- componentName,
370
- environment,
371
- config
372
- );
373
- const path = getModulePath(componentName);
388
+ var _a, _b;
389
+ const environment = config.environment;
390
+ if (!environment) {
391
+ throw new Error("Websdk Environment is not configured");
392
+ }
393
+ const baseUrl = getBaseUrl(componentName, environment, config);
394
+ const path = config.initialPath || getModulePath(componentName);
374
395
  let queryParams = {};
375
396
  if (componentName === "DOC_UTILITY" /* DOC_UTILITY */) {
376
- const documentRequestId = (_b = config.documentRequestId) != null ? _b : getDocumentRequestIdFromUrl();
397
+ const documentRequestId = (_a = config.documentRequestId) != null ? _a : getDocumentRequestIdFromUrl();
377
398
  queryParams = {
378
399
  [DOCUMENT_REQUEST_ID_PARAM]: documentRequestId
379
400
  };
380
401
  } else if (componentName === "ONBOARDING_MERCHANT" /* ONBOARDING_MERCHANT */ || componentName === "ONBOARDING_PARTNER" /* ONBOARDING_PARTNER */) {
381
- const requestId = (_c = config.requestId) != null ? _c : getRequestIdFromUrl();
402
+ const requestId = (_b = config.requestId) != null ? _b : getRequestIdFromUrl();
382
403
  queryParams = {
383
404
  [REQUEST_ID_PARAM]: requestId
384
405
  };
@@ -1,3 +1,3 @@
1
- "use strict";(()=>{var P=Object.defineProperty,U=Object.defineProperties;var _=Object.getOwnPropertyDescriptors;var C=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;var w=(r,e,s)=>e in r?P(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s,h=(r,e)=>{for(var s in e||(e={}))K.call(e,s)&&w(r,s,e[s]);if(C)for(var s of C(e))L.call(e,s)&&w(r,s,e[s]);return r},E=(r,e)=>U(r,_(e));var u=(r,e,s)=>new Promise((t,n)=>{var i=c=>{try{o(s.next(c))}catch(l){n(l)}},a=c=>{try{o(s.throw(c))}catch(l){n(l)}},o=c=>c.done?t(c.value):Promise.resolve(c.value).then(i,a);o((s=s.apply(r,e)).next())});var p=(t=>(t.ONBOARDING_PARTNER="ONBOARDING_PARTNER",t.ONBOARDING_MERCHANT="ONBOARDING_MERCHANT",t.DOC_UTILITY="DOC_UTILITY",t))(p||{});var N=r=>{if(r&&typeof r=="object"){let e=Object.keys(r),s=e.length,t=e.length?"?":"";return e.forEach((n,i)=>{let a=i+1,o=r[n],c=r[e[a]];if(a<s&&I(o)){let l=t+n+"="+o;I(c)?t=l+"&":t=l}else I(o)&&(t=t+n+"="+o)}),t}return""},I=r=>!(r==null||r===""||typeof r=="number"&&Number.isNaN(r)||typeof r=="string"&&r.trim()===""),y=r=>{let e=t=>t!=null&&!(Array.isArray(t)&&t.length===0)&&!(typeof t=="object"&&Object.keys(t).length===0)&&!(typeof t=="string"&&t.trim()==="");if(!r||typeof r!="object")return;let s={};for(let t in r)if(r.hasOwnProperty(t)){let n=r[t];if(e(n))if(Array.isArray(n)){let i=n.filter(a=>e(a)).map(y).filter(a=>e(a));i.length&&(s[t]=i)}else if(typeof n=="object"){let i=y(n);e(i)&&(s[t]=i)}else s[t]=n}return Object.keys(s).length?s:void 0};var F={isSuccess:!1,accessToken:"",accessTokenExpiry:"",refreshToken:"",refreshTokenExpiry:""},W={isSuccess:!1,accessToken:"",accessTokenExpiry:""},g=class{constructor(e,s){this.currentAccessToken="";this.fetchClientSession=()=>u(this,null,function*(){let e=this.getAuthUrl("/auth/micro-frontend/tokens"),s=y({modules:[{name:this.getAuthModuleName()}],referenceId:this.authConfig.referenceId});try{let t=yield fetch(e,{method:"POST",headers:this.getHeaders(),body:JSON.stringify(s)}),n=yield this.parseJsonResponse(t,e,"Frontend AccessToken");return this.currentAccessToken=n.accessToken||"",E(h(h({},F),n),{isSuccess:!0})}catch(t){throw this.createAuthError("Frontend AccessToken",e,t)}});this.refreshClientSession=e=>u(this,null,function*(){let s=this.getAuthUrl("/auth/micro-frontend/tokens/refresh");try{let t=yield fetch(s,{method:"POST",headers:this.getHeaders(),body:JSON.stringify(y(e))}),n=yield this.parseJsonResponse(t,s,"Frontend AccessToken Refresh");return this.currentAccessToken=n.accessToken||this.currentAccessToken,E(h(h({},W),n),{isSuccess:!0})}catch(t){throw this.createAuthError("Frontend AccessToken Refresh",s,t)}});this.destroySession=()=>u(this,null,function*(){if(!this.currentAccessToken)return!0;let e=this.getAuthUrl("/auth/access-token/revoke");try{let s=yield fetch(e,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({accessToken:this.currentAccessToken})});if(!s.ok){let t=yield s.text();throw new Error(`Session revoke failed(Web SDK): ${s.status} ${s.statusText}. URL: ${e}. Response: ${t.slice(0,200)}`)}return this.currentAccessToken="",!0}catch(s){return console.error(this.createAuthError("Session revoke",e,s).message),!1}});this.getAuthModuleName=()=>{switch(this.moduleName){case"ONBOARDING_PARTNER":case"ONBOARDING_MERCHANT":return"ONBOARDING";default:return this.moduleName||""}};this.getHeaders=()=>({Authorization:this.authConfig.authToken||"","Content-Type":"application/json"});this.getAuthUrl=e=>{var t;let s=(t=this.authConfig.authApiUrl)==null?void 0:t.trim();if(!s)throw new Error("authConfig.authApiUrl is required(Web SDK)");return`${s.replace(/\/$/,"")}${e}`};this.parseJsonResponse=(e,s,t)=>u(null,null,function*(){let n=yield e.text();if(!e.ok)throw new Error(`${t} Error Response(Web SDK): ${e.status} ${e.statusText}. URL: ${s}. Response: ${n.slice(0,200)}`);let i=e.headers.get("content-type")||"";if(!i.includes("application/json"))throw new Error(`${t} expected JSON response(Web SDK). URL: ${s}. Content-Type: ${i||"unknown"}. Response: ${n.slice(0,200)}`);try{return JSON.parse(n)}catch(a){throw new Error(`${t} JSON parse failed(Web SDK). URL: ${s}. Response: ${n.slice(0,200)}`)}});this.createAuthError=(e,s,t)=>{if(t instanceof Error&&t.message.includes("(Web SDK)"))return t;let i=(t instanceof Error?t.message:String(t)).includes("Failed to fetch")?" This usually means the browser blocked the request because of CORS, the URL is unreachable, or the request was blocked before a response was returned.":"";return new Error(`${e} Request Failed(Web SDK). URL: ${s}.${i}`)};this.authConfig=e,this.moduleName=s}};function T(r,e){let s=h({},r);for(let t of Object.keys(e))r[t]&&typeof r[t]=="object"&&typeof e[t]=="object"&&!Array.isArray(r[t])&&!Array.isArray(e[t])?s[t]=T(r[t],e[t]):s[t]=e[t];return s}var R={iframeId:"nc-web-sdk-iframe",containerId:"websdk-container",iframeStyle:{width:"100%",height:"100vh",border:"none",display:"block"},sessionValidation:(r,e)=>!r||!e?!1:new Date(e)>new Date,sessionCheckInterval:600*1e3,environment:"uat"};var D=r=>{if(!r)return!0;let e;if(r instanceof Date)e=r;else if(typeof r=="number")e=new Date(r);else if(typeof r=="string"){let s=r.trim().replace(" ","T");e=new Date(s)}else return!0;return isNaN(e.getTime())?!0:Date.now()>e.getTime()};var v={local:"http://localhost:4000",dev3:"https://dev3-non-pci.eastus.cloudapp.azure.com",dev2:"https://dev2-non-pci.eastus.cloudapp.azure.com",uat:"https://ignite-preprod.nuvei.com",prod:"https://ignite.nuvei.com"},b={local:"http://localhost:5000",dev3:"https://dev3-non-pci.eastus.cloudapp.azure.com",dev2:"https://dev2-non-pci.eastus.cloudapp.azure.com",uat:"https://ignite-preprod.nuvei.com",prod:"https://ignite.nuvei.com"},$={ONBOARDING_PARTNER:"/_onboarding/partner/application",ONBOARDING_MERCHANT:"/_onboarding/merchant/application",DOC_UTILITY:"/_document-upload"},M="documentRequestId",O="requestId",B=(r="prod")=>{var e;return(e=v[r])!=null?e:v.prod},H=(r="prod")=>{var e;return(e=b[r])!=null?e:b.prod},V=r=>{var e;return(e=$[r])!=null?e:""},q=()=>typeof window=="undefined"?null:new URLSearchParams(window.location.search).get(M),G=()=>typeof window=="undefined"?null:new URLSearchParams(window.location.search).get(O),Q=(r,e,s)=>s.iframeBaseUrl?s.iframeBaseUrl:r==="DOC_UTILITY"?H(e):B(e),x=(r,e)=>{var o,c,l;let s=(o=e.environment)!=null?o:"prod",t=Q(r,s,e),n=V(r),i={};if(r==="DOC_UTILITY"){let d=(c=e.documentRequestId)!=null?c:q();i={[M]:d}}else if(r==="ONBOARDING_MERCHANT"||r==="ONBOARDING_PARTNER"){let d=(l=e.requestId)!=null?l:G();i={[O]:d}}let a=N(i);return`${t}${n}${a}`};var f=class f{constructor(e){this.sdkConfig=h({},R);this.currentIframe=null;this.iframeUrl="";this.isIframeReady=!1;this.messageQueue=[];this.cachedSession=null;this.sessionCheckInterval=null;this.expiryTimeout=null;this.retryAttempts=0;this.MAX_RETRIES=3;this.REFRESH_BUFFER_MS=60*1e3;this.isListeningToIframeEvents=!1;this.isDestroyed=!1;this.initialize=()=>u(this,null,function*(){var e,s;if(this.isDestroyed=!1,!this.componentName)throw new Error("componentName is required to initialize the SDK(Web SDK)");try{let t=yield this.loadComponent(this.componentName);return this.isDestroyed||(yield(e=this.onReady)==null?void 0:e.call(this,this)),t}catch(t){throw(s=this.onError)==null||s.call(this,t),t}});this.loadComponent=e=>u(this,null,function*(){console.log("Component Requested to Load(Web SDK): ",e);try{let s=yield this.getClientSession();if(!this.sdkConfig.sessionValidation(s==null?void 0:s.accessToken,s==null?void 0:s.accessTokenExpiry))throw new Error("Token Validation FailedLoad(Web SDK)");this.iframeUrl=x(e,this.sdkConfig),console.log(`
1
+ "use strict";(()=>{var x=Object.defineProperty,P=Object.defineProperties;var K=Object.getOwnPropertyDescriptors;var v=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var w=(r,e,s)=>e in r?x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s,h=(r,e)=>{for(var s in e||(e={}))L.call(e,s)&&w(r,s,e[s]);if(v)for(var s of v(e))F.call(e,s)&&w(r,s,e[s]);return r},S=(r,e)=>P(r,K(e));var l=(r,e,s)=>new Promise((t,n)=>{var i=c=>{try{o(s.next(c))}catch(u){n(u)}},a=c=>{try{o(s.throw(c))}catch(u){n(u)}},o=c=>c.done?t(c.value):Promise.resolve(c.value).then(i,a);o((s=s.apply(r,e)).next())});var p=(n=>(n.ONBOARDING_PARTNER="ONBOARDING_PARTNER",n.ONBOARDING_MERCHANT="ONBOARDING_MERCHANT",n.DOC_UTILITY="DOC_UTILITY",n.USER_MANAGEMENT="USER_MANAGEMENT",n))(p||{});var C=r=>{if(r&&typeof r=="object"){let e=Object.keys(r),s=e.length,t=e.length?"?":"";return e.forEach((n,i)=>{let a=i+1,o=r[n],c=r[e[a]];if(a<s&&y(o)){let u=t+n+"="+o;y(c)?t=u+"&":t=u}else y(o)&&(t=t+n+"="+o)}),t}return""},y=r=>!(r==null||r===""||typeof r=="number"&&Number.isNaN(r)||typeof r=="string"&&r.trim()===""),m=r=>{let e=t=>t!=null&&!(Array.isArray(t)&&t.length===0)&&!(typeof t=="object"&&Object.keys(t).length===0)&&!(typeof t=="string"&&t.trim()==="");if(!r||typeof r!="object")return;let s={};for(let t in r)if(r.hasOwnProperty(t)){let n=r[t];if(e(n))if(Array.isArray(n)){let i=n.filter(a=>e(a)).map(m).filter(a=>e(a));i.length&&(s[t]=i)}else if(typeof n=="object"){let i=m(n);e(i)&&(s[t]=i)}else s[t]=n}return Object.keys(s).length?s:void 0};var W={isSuccess:!1,accessToken:"",accessTokenExpiry:"",refreshToken:"",refreshTokenExpiry:""},$={isSuccess:!1,accessToken:"",accessTokenExpiry:""},g=class{constructor(e,s){this.currentAccessToken="";this.fetchClientSession=()=>l(this,null,function*(){let e=this.getAuthUrl("/auth/micro-frontend/tokens"),s=m({modules:[{name:this.getAuthModuleName()}],referenceId:this.authConfig.referenceId});try{let t=yield fetch(e,{method:"POST",headers:this.getHeaders(),body:JSON.stringify(s)}),n=yield this.parseJsonResponse(t,e,"Frontend AccessToken");return this.currentAccessToken=n.accessToken||"",S(h(h({},W),n),{isSuccess:!0})}catch(t){throw this.createAuthError("Frontend AccessToken",e,t)}});this.refreshClientSession=e=>l(this,null,function*(){let s=this.getAuthUrl("/auth/micro-frontend/tokens/refresh");try{let t=yield fetch(s,{method:"POST",headers:this.getHeaders(),body:JSON.stringify(m(e))}),n=yield this.parseJsonResponse(t,s,"Frontend AccessToken Refresh");return this.currentAccessToken=n.accessToken||this.currentAccessToken,S(h(h({},$),n),{isSuccess:!0})}catch(t){throw this.createAuthError("Frontend AccessToken Refresh",s,t)}});this.destroySession=()=>l(this,null,function*(){if(!this.currentAccessToken)return!0;let e=this.getAuthUrl("/auth/access-token/revoke");try{let s=yield fetch(e,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({accessToken:this.currentAccessToken})});if(!s.ok){let t=yield s.text();throw new Error(`Session revoke failed(Web SDK): ${s.status} ${s.statusText}. URL: ${e}. Response: ${t.slice(0,200)}`)}return this.currentAccessToken="",!0}catch(s){return console.error(this.createAuthError("Session revoke",e,s).message),!1}});this.getAuthModuleName=()=>{switch(this.moduleName){case"ONBOARDING_PARTNER":case"ONBOARDING_MERCHANT":return"ONBOARDING";default:return this.moduleName||""}};this.getHeaders=()=>({Authorization:this.authConfig.authToken||"","Content-Type":"application/json"});this.getAuthUrl=e=>{var t;let s=(t=this.authConfig.authApiUrl)==null?void 0:t.trim();if(!s)throw new Error("authConfig.authApiUrl is required(Web SDK)");return`${s.replace(/\/$/,"")}${e}`};this.parseJsonResponse=(e,s,t)=>l(null,null,function*(){let n=yield e.text();if(!e.ok)throw new Error(`${t} Error Response(Web SDK): ${e.status} ${e.statusText}. URL: ${s}. Response: ${n.slice(0,200)}`);let i=e.headers.get("content-type")||"";if(!i.includes("application/json"))throw new Error(`${t} expected JSON response(Web SDK). URL: ${s}. Content-Type: ${i||"unknown"}. Response: ${n.slice(0,200)}`);try{return JSON.parse(n)}catch(a){throw new Error(`${t} JSON parse failed(Web SDK). URL: ${s}. Response: ${n.slice(0,200)}`)}});this.createAuthError=(e,s,t)=>{if(t instanceof Error&&t.message.includes("(Web SDK)"))return t;let i=(t instanceof Error?t.message:String(t)).includes("Failed to fetch")?" This usually means the browser blocked the request because of CORS, the URL is unreachable, or the request was blocked before a response was returned.":"";return new Error(`${e} Request Failed(Web SDK). URL: ${s}.${i}`)};this.authConfig=e,this.moduleName=s}};function E(r,e){let s=h({},r);for(let t of Object.keys(e))r[t]&&typeof r[t]=="object"&&typeof e[t]=="object"&&!Array.isArray(r[t])&&!Array.isArray(e[t])?s[t]=E(r[t],e[t]):s[t]=e[t];return s}var T={iframeId:"nc-web-sdk-iframe",containerId:"websdk-container",iframeStyle:{width:"100%",height:"100vh",border:"none",display:"block"},sessionValidation:(r,e)=>!r||!e?!1:new Date(e)>new Date,sessionCheckInterval:600*1e3,environment:"uat2"};var N=r=>{if(!r)return!0;let e;if(r instanceof Date)e=r;else if(typeof r=="number")e=new Date(r);else if(typeof r=="string"){let s=r.trim().replace(" ","T");e=new Date(s)}else return!0;return isNaN(e.getTime())?!0:Date.now()>e.getTime()};var D={local:"http://localhost:4000",dev3:"https://dev3-non-pci.eastus.cloudapp.azure.com",dev2:"https://dev2-non-pci.eastus.cloudapp.azure.com",uat2:"https://ignite-preprod.nuvei.com","prod-na":"https://ignite.nuvei.com","prod-eu":"https://ignite-eu.nuvei.com","dev2-2":"https://dev2-non-pci-2.eastus.cloudapp.azure.com"},M={local:"http://localhost:5000",dev3:"https://dev3-non-pci.eastus.cloudapp.azure.com",dev2:"https://dev2-non-pci.eastus.cloudapp.azure.com",uat2:"https://ignite-preprod.nuvei.com","prod-na":"https://ignite.nuvei.com","prod-eu":"https://ignite-eu.nuvei.com","dev2-2":"https://dev2-non-pci-2.eastus.cloudapp.azure.com"},b={local:"http://localhost:5001",dev3:"https://dev3-non-pci.eastus.cloudapp.azure.com",dev2:"https://dev2-non-pci.eastus.cloudapp.azure.com",uat2:"https://ignite-preprod.nuvei.com","prod-na":"https://ignite.nuvei.com","prod-eu":"https://ignite-eu.nuvei.com","dev2-2":"https://dev2-non-pci-2.eastus.cloudapp.azure.com"},B={ONBOARDING_PARTNER:"/_onboarding/partner/application",ONBOARDING_MERCHANT:"/_onboarding/merchant/application",DOC_UTILITY:"/_document-upload",USER_MANAGEMENT:"/_admin/user-management"},O="documentRequestId",U="requestId",H=r=>{var e;return(e=D[r])!=null?e:D.prod},V=r=>{var e;return(e=M[r])!=null?e:M.prod},q=(r="prod")=>{var e;return(e=b[r])!=null?e:b.prod},G=r=>{var e;return(e=B[r])!=null?e:""},z=()=>typeof window=="undefined"?null:new URLSearchParams(window.location.search).get(O),Q=()=>typeof window=="undefined"?null:new URLSearchParams(window.location.search).get(U),Y=(r,e,s)=>s.iframeBaseUrl?s.iframeBaseUrl:r==="DOC_UTILITY"?V(e):r==="USER_MANAGEMENT"?q(e):H(e),_=(r,e)=>{var o,c;let s=e.environment;if(!s)throw new Error("Websdk Environment is not configured");let t=Y(r,s,e),n=e.initialPath||G(r),i={};if(r==="DOC_UTILITY"){let u=(o=e.documentRequestId)!=null?o:z();i={[O]:u}}else if(r==="ONBOARDING_MERCHANT"||r==="ONBOARDING_PARTNER"){let u=(c=e.requestId)!=null?c:Q();i={[U]:u}}let a=C(i);return`${t}${n}${a}`};var d=class d{constructor(e){this.sdkConfig=h({},T);this.currentIframe=null;this.iframeUrl="";this.isIframeReady=!1;this.messageQueue=[];this.cachedSession=null;this.sessionCheckInterval=null;this.expiryTimeout=null;this.retryAttempts=0;this.MAX_RETRIES=3;this.REFRESH_BUFFER_MS=60*1e3;this.isListeningToIframeEvents=!1;this.isDestroyed=!1;this.initialize=()=>l(this,null,function*(){var e,s;if(this.isDestroyed=!1,!this.componentName)throw new Error("componentName is required to initialize the SDK(Web SDK)");try{let t=yield this.loadComponent(this.componentName);return this.isDestroyed||(yield(e=this.onReady)==null?void 0:e.call(this,this)),t}catch(t){throw(s=this.onError)==null||s.call(this,t),t}});this.loadComponent=e=>l(this,null,function*(){console.log("Component Requested to Load(Web SDK): ",e);try{let s=yield this.getClientSession();if(!this.sdkConfig.sessionValidation(s==null?void 0:s.accessToken,s==null?void 0:s.accessTokenExpiry))throw new Error("Token Validation FailedLoad(Web SDK)");this.iframeUrl=_(e,this.sdkConfig),console.log(`
2
2
  Iframe URL(Web SDK): `,this.iframeUrl,`
3
- `);let t=yield this.createIframeWithSource(this.iframeUrl,e);return this.currentIframe=t,this.updateIframeToken(s.accessToken),t}catch(s){throw this.destroyIframe(),s}});this.destroyIframe=()=>{this.currentIframe&&(this.currentIframe.remove(),this.currentIframe=null),this.stopSessionExpiryCheck()};this.destroy=()=>{this.isDestroyed=!0,this.destroyIframe(),this.messageQueue=[],this.isIframeReady=!1,window.removeEventListener("message",this.handleIframeMessage),this.isListeningToIframeEvents=!1};this.logout=()=>u(this,null,function*(){let e=!0;this.authProvider.destroySession&&(e=yield this.authProvider.destroySession()),e?(this.stopSessionExpiryCheck(),this.destroyIframe()):console.error("Logout failed(Web SDK)")});this.updateIframeNavigation=e=>{this.enqueueMessage("NAVIGATE",e)};this.sendCustomDataToIframe=e=>{this.enqueueMessage("CUSTOM_DATA",e)};this.getClientSession=()=>u(this,null,function*(){var e,s,t,n;try{if(this.cachedSession&&((t=this.sdkConfig)!=null&&t.sessionValidation((e=this.cachedSession)==null?void 0:e.accessToken,(s=this.cachedSession)==null?void 0:s.accessTokenExpiry)))return this.cachedSession;{let i=yield this.authProvider.fetchClientSession();if(!(i!=null&&i.accessToken))throw new Error("Client Session Fetch Failed(Web SDK)");if(!((n=this.sdkConfig)!=null&&n.sessionValidation(i.accessToken,i.accessTokenExpiry)))throw new Error("Client Session Validation Failed(Web SDK)");return this.cachedSession=i,this.retryAttempts=0,i}}catch(i){throw i}});this.refreshedClientSession=()=>u(this,null,function*(){var e,s;if(!((e=this.cachedSession)!=null&&e.refreshToken)||!this.cachedSession.accessToken)throw console.error("Invalid or missing refreshToken or accessToken in cashed session. Destroying iframe(Web SDK)."),this.destroyIframe(),new Error("No session found(Web SDK)");if(!this.authProvider.refreshClientSession)throw new Error("refreshClientSession is not provided(Web SDK)");try{let t=yield this.authProvider.refreshClientSession({accessToken:this.cachedSession.accessToken,refreshToken:this.cachedSession.refreshToken});if(!(t!=null&&t.accessToken))throw console.log("Invalid refresh session token(Called From Web SDK)"),new Error("Refresh Client Session Failed");if(!((s=this.sdkConfig)!=null&&s.sessionValidation(t.accessToken,t.accessTokenExpiry)))throw console.log("Invalid refresh session token(Called From Web SDK)"),new Error("Refresh Client Session Validation Failed");let n=h({},this.cachedSession);return n.accessToken=t.accessToken,n.accessTokenExpiry=t.accessTokenExpiry,this.cachedSession=n,this.retryAttempts=0,t}catch(t){throw console.error("Session Refresh Failed(Web SDK):",t),t}});this.createIframeWithSource=(e,s)=>new Promise((t,n)=>{let i=this.getContainerElement();if(!i)return n(new Error("SDK container not found(Web SDK)"));let a=this.getIframeId(s),o=document.getElementById(a);if(o){console.log(`Iframe with Id: ${a} already exists, reusing it(Web SDK)`),t(o);return}o=document.createElement("iframe"),o.src=e,o.id=a;let c=h({},this.sdkConfig.iframeStyle);c&&Object.assign(o.style,c),o.setAttribute("allow","clipboard-write *"),o.onload=()=>{console.log("Iframe loaded successfully(Web SDK)"),this.startSessionExpiryCheck(),t(o)},o.onerror=()=>{n(new Error("Iframe failed to load(Web SDK)"))},i.appendChild(o)});this.getContainerElement=()=>this.container instanceof HTMLElement?this.container:typeof this.container=="string"?document.querySelector(this.container)||document.getElementById(this.container):document.getElementById(this.sdkConfig.containerId);this.getIframeId=e=>{let s=String(e).toLowerCase().replace(/_/g,"-");return`${this.sdkConfig.iframeId}-${s}`};this.startSessionExpiryCheck=()=>u(this,null,function*(){var o,c;if(!this.authProvider.refreshClientSession){console.warn("refreshClientSession not provided, session will not be refreshed automatically(Web SDK)");return}if(D((o=this.cachedSession)==null?void 0:o.refreshTokenExpiry)){console.error("Refresh token is expired. Stopping session expiry check(Web SDK)."),this.destroyIframe();return}let s=new Date,t=(c=this.cachedSession)==null?void 0:c.accessTokenExpiry,n=t?new Date(t):null;if(!n||isNaN(n.getTime())){console.error("Invalid or missing accessTokenExpiry in session. Stopping session expiry check(Web SDK)."),this.destroyIframe();return}let i=n.getTime()-s.getTime()-this.REFRESH_BUFFER_MS,a=()=>u(this,null,function*(){try{if(this.retryAttempts>=this.MAX_RETRIES){console.warn(`Max retry attempts (${this.MAX_RETRIES}) reached. Stopping session check(Web SDK).`),this.stopSessionExpiryCheck(),this.destroyIframe();return}let l=yield this.refreshedClientSession();this.updateIframeToken(l.accessToken),this.retryAttempts=0,this.startSessionExpiryCheck()}catch(l){console.error("Failed to perform session refresh(Web SDK):",l),this.retryAttempts++,this.stopSessionExpiryCheck(),this.expiryTimeout=setTimeout(a,5e3)}});this.stopSessionExpiryCheck(),i<=0?a():this.expiryTimeout=setTimeout(a,i)});this.stopSessionExpiryCheck=()=>{this.expiryTimeout&&(clearTimeout(this.expiryTimeout),this.expiryTimeout=null),this.sessionCheckInterval&&(clearInterval(this.sessionCheckInterval),this.sessionCheckInterval=null)};this.updateIframeToken=e=>{this.enqueueMessage("UPDATE_TOKEN",e)};this.enqueueMessage=(e,s)=>{let t={action:e,source:"NUVEI_WEB_SDK",data:s};if(!this.isIframeReady){console.log("Iframe not ready, queueing message(Web SDK):",t),this.messageQueue.push(t);return}this.postMessageToIframe(t)};this.flushMessageQueue=()=>{for(console.log("Flushing message queue(Web SDK):",this.messageQueue);this.messageQueue.length>0;){let e=this.messageQueue.shift();e&&this.postMessageToIframe(e)}};this.listenToIframeEvents=()=>{this.isListeningToIframeEvents||(window.addEventListener("message",this.handleIframeMessage),this.isListeningToIframeEvents=!0)};this.handleIframeMessage=e=>{var n,i,a;if(!this.iframeUrl)return;let s=new URL(this.iframeUrl).origin;if(e.origin!==s)return;let t=e.data;if((t==null?void 0:t.source)==="NUVEI_IFRAME"&&!this.isDestroyed){if(console.log("Received from iframe:(Web SDK)",t),t.action==="CHECK_SESSION_EXPIRY"&&typeof t.requestId=="string"){let o=(n=this.cachedSession)==null?void 0:n.accessTokenExpiry,c=o?new Date(o).getTime():Number.NaN;Number.isFinite(c)&&((a=(i=this.currentIframe)==null?void 0:i.contentWindow)==null||a.postMessage({source:"NUVEI_PORTAL",action:"CHECK_SESSION_EXPIRY_RESULT",requestId:t.requestId,data:{valid:c>Date.now()}},s))}switch(this.onMessage&&this.onMessage(t),t.action){case"IFRAME_READY":this.handleIframeReady();break;default:break}}};this.handleIframeReady=()=>{console.log("Iframe is READY(Web SDK)"),this.isIframeReady=!0,this.flushMessageQueue()};this.postMessageToIframe=e=>{var t;if(!((t=this==null?void 0:this.currentIframe)!=null&&t.contentWindow)){console.warn("Iframe not available(Web SDK)");return}let s=new URL(this.iframeUrl).origin;console.log("Sending message to microfrontend(Web SDK):",e),this.currentIframe.contentWindow.postMessage(e,s)};let{fetchClientSession:s,refreshClientSession:t,destroySession:n,componentName:i,container:a,authConfig:o,config:c,onReady:l,onError:d,onMessage:k}=e;if(o){let S=new g(o,i);this.authProvider={fetchClientSession:s!=null?s:S.fetchClientSession,refreshClientSession:t!=null?t:S.refreshClientSession,destroySession:n!=null?n:S.destroySession}}else if(typeof s=="function")this.authProvider={fetchClientSession:s,refreshClientSession:t,destroySession:n};else throw new Error("authConfig or fetchClientSession is required to initialize SDK(Web SDK)");this.componentName=i,this.container=a,c&&(this.sdkConfig=T(R,c)),l&&(this.onReady=l),d&&(this.onError=d),k&&(this.onMessage=k),this.listenToIframeEvents()}};f.mount=e=>u(null,null,function*(){let s=new f(e);return yield s.initialize(),s}),f.create=f.mount;var m=f;var A=window;A.NCWebSDK=m;A.NuveiSDK=m;A.ModulesNameEnum=p;})();
3
+ `);let t=yield this.createIframeWithSource(this.iframeUrl,e);return this.currentIframe=t,this.updateIframeToken(s.accessToken),t}catch(s){throw this.destroyIframe(),s}});this.destroyIframe=()=>{this.currentIframe&&(this.currentIframe.remove(),this.currentIframe=null),this.stopSessionExpiryCheck()};this.destroy=()=>{this.isDestroyed=!0,this.destroyIframe(),this.messageQueue=[],this.isIframeReady=!1,window.removeEventListener("message",this.handleIframeMessage),this.isListeningToIframeEvents=!1};this.logout=()=>l(this,null,function*(){let e=!0;this.authProvider.destroySession&&(e=yield this.authProvider.destroySession()),e?(this.stopSessionExpiryCheck(),this.destroyIframe()):console.error("Logout failed(Web SDK)")});this.updateIframeNavigation=e=>{this.enqueueMessage("NAVIGATE",e)};this.sendCustomDataToIframe=e=>{this.enqueueMessage("CUSTOM_DATA",e)};this.getClientSession=()=>l(this,null,function*(){var e,s,t,n;try{if(this.cachedSession&&((t=this.sdkConfig)!=null&&t.sessionValidation((e=this.cachedSession)==null?void 0:e.accessToken,(s=this.cachedSession)==null?void 0:s.accessTokenExpiry)))return this.cachedSession;{let i=yield this.authProvider.fetchClientSession();if(!(i!=null&&i.accessToken))throw new Error("Client Session Fetch Failed(Web SDK)");if(!((n=this.sdkConfig)!=null&&n.sessionValidation(i.accessToken,i.accessTokenExpiry)))throw new Error("Client Session Validation Failed(Web SDK)");return this.cachedSession=i,this.retryAttempts=0,i}}catch(i){throw i}});this.refreshedClientSession=()=>l(this,null,function*(){var e,s;if(!((e=this.cachedSession)!=null&&e.refreshToken)||!this.cachedSession.accessToken)throw console.error("Invalid or missing refreshToken or accessToken in cashed session. Destroying iframe(Web SDK)."),this.destroyIframe(),new Error("No session found(Web SDK)");if(!this.authProvider.refreshClientSession)throw new Error("refreshClientSession is not provided(Web SDK)");try{let t=yield this.authProvider.refreshClientSession({accessToken:this.cachedSession.accessToken,refreshToken:this.cachedSession.refreshToken});if(!(t!=null&&t.accessToken))throw console.log("Invalid refresh session token(Called From Web SDK)"),new Error("Refresh Client Session Failed");if(!((s=this.sdkConfig)!=null&&s.sessionValidation(t.accessToken,t.accessTokenExpiry)))throw console.log("Invalid refresh session token(Called From Web SDK)"),new Error("Refresh Client Session Validation Failed");let n=h({},this.cachedSession);return n.accessToken=t.accessToken,n.accessTokenExpiry=t.accessTokenExpiry,this.cachedSession=n,this.retryAttempts=0,t}catch(t){throw console.error("Session Refresh Failed(Web SDK):",t),t}});this.createIframeWithSource=(e,s)=>new Promise((t,n)=>{let i=this.getContainerElement();if(!i)return n(new Error("SDK container not found(Web SDK)"));let a=this.getIframeId(s),o=document.getElementById(a);if(o){console.log(`Iframe with Id: ${a} already exists, reusing it(Web SDK)`),t(o);return}o=document.createElement("iframe"),o.src=e,o.id=a;let c=h({},this.sdkConfig.iframeStyle);c&&Object.assign(o.style,c),o.setAttribute("allow","clipboard-write *"),o.onload=()=>{console.log("Iframe loaded successfully(Web SDK)"),this.startSessionExpiryCheck(),t(o)},o.onerror=()=>{n(new Error("Iframe failed to load(Web SDK)"))},i.appendChild(o)});this.getContainerElement=()=>this.container instanceof HTMLElement?this.container:typeof this.container=="string"?document.querySelector(this.container)||document.getElementById(this.container):document.getElementById(this.sdkConfig.containerId);this.getIframeId=e=>{let s=String(e).toLowerCase().replace(/_/g,"-");return`${this.sdkConfig.iframeId}-${s}`};this.startSessionExpiryCheck=()=>l(this,null,function*(){var o,c;if(!this.authProvider.refreshClientSession){console.warn("refreshClientSession not provided, session will not be refreshed automatically(Web SDK)");return}if(N((o=this.cachedSession)==null?void 0:o.refreshTokenExpiry)){console.error("Refresh token is expired. Stopping session expiry check(Web SDK)."),this.destroyIframe();return}let s=new Date,t=(c=this.cachedSession)==null?void 0:c.accessTokenExpiry,n=t?new Date(t):null;if(!n||isNaN(n.getTime())){console.error("Invalid or missing accessTokenExpiry in session. Stopping session expiry check(Web SDK)."),this.destroyIframe();return}let i=n.getTime()-s.getTime()-this.REFRESH_BUFFER_MS,a=()=>l(this,null,function*(){try{if(this.retryAttempts>=this.MAX_RETRIES){console.warn(`Max retry attempts (${this.MAX_RETRIES}) reached. Stopping session check(Web SDK).`),this.stopSessionExpiryCheck(),this.destroyIframe();return}let u=yield this.refreshedClientSession();this.updateIframeToken(u.accessToken),this.retryAttempts=0,this.startSessionExpiryCheck()}catch(u){console.error("Failed to perform session refresh(Web SDK):",u),this.retryAttempts++,this.stopSessionExpiryCheck(),this.expiryTimeout=setTimeout(a,5e3)}});this.stopSessionExpiryCheck(),i<=0?a():this.expiryTimeout=setTimeout(a,i)});this.stopSessionExpiryCheck=()=>{this.expiryTimeout&&(clearTimeout(this.expiryTimeout),this.expiryTimeout=null),this.sessionCheckInterval&&(clearInterval(this.sessionCheckInterval),this.sessionCheckInterval=null)};this.updateIframeToken=e=>{this.enqueueMessage("UPDATE_TOKEN",e)};this.enqueueMessage=(e,s)=>{let t={action:e,source:"NUVEI_WEB_SDK",data:s};if(!this.isIframeReady){console.log("Iframe not ready, queueing message(Web SDK):",t),this.messageQueue.push(t);return}this.postMessageToIframe(t)};this.flushMessageQueue=()=>{for(console.log("Flushing message queue(Web SDK):",this.messageQueue);this.messageQueue.length>0;){let e=this.messageQueue.shift();e&&this.postMessageToIframe(e)}};this.listenToIframeEvents=()=>{this.isListeningToIframeEvents||(window.addEventListener("message",this.handleIframeMessage),this.isListeningToIframeEvents=!0)};this.handleIframeMessage=e=>{var n,i,a;if(!this.iframeUrl)return;let s=new URL(this.iframeUrl).origin;if(e.origin!==s)return;let t=e.data;if((t==null?void 0:t.source)==="NUVEI_IFRAME"&&!this.isDestroyed){if(console.log("Received from iframe:(Web SDK)",t),t.action==="CHECK_SESSION_EXPIRY"&&typeof t.requestId=="string"){let o=(n=this.cachedSession)==null?void 0:n.accessTokenExpiry,c=o?new Date(o).getTime():Number.NaN;Number.isFinite(c)&&((a=(i=this.currentIframe)==null?void 0:i.contentWindow)==null||a.postMessage({source:"NUVEI_PORTAL",action:"CHECK_SESSION_EXPIRY_RESULT",requestId:t.requestId,data:{valid:c>Date.now()}},s))}switch(this.onMessage&&this.onMessage(t),t.action){case"IFRAME_READY":this.handleIframeReady();break;default:break}}};this.handleIframeReady=()=>{console.log("Iframe is READY(Web SDK)"),this.isIframeReady=!0,this.flushMessageQueue()};this.postMessageToIframe=e=>{var t;if(!((t=this==null?void 0:this.currentIframe)!=null&&t.contentWindow)){console.warn("Iframe not available(Web SDK)");return}let s=new URL(this.iframeUrl).origin;console.log("Sending message to microfrontend(Web SDK):",e),this.currentIframe.contentWindow.postMessage(e,s)};let{fetchClientSession:s,refreshClientSession:t,destroySession:n,componentName:i,container:a,authConfig:o,config:c,onReady:u,onError:A,onMessage:k}=e;if(o){let I=new g(o,i);this.authProvider={fetchClientSession:s!=null?s:I.fetchClientSession,refreshClientSession:t!=null?t:I.refreshClientSession,destroySession:n!=null?n:I.destroySession}}else if(typeof s=="function")this.authProvider={fetchClientSession:s,refreshClientSession:t,destroySession:n};else throw new Error("authConfig or fetchClientSession is required to initialize SDK(Web SDK)");this.componentName=i,this.container=a,c&&(this.sdkConfig=E(T,c)),u&&(this.onReady=u),A&&(this.onError=A),k&&(this.onMessage=k),this.listenToIframeEvents()}};d.mount=e=>l(null,null,function*(){let s=new d(e);return yield s.initialize(),s}),d.create=d.mount;var f=d;var R=window;R.NCWebSDK=f;R.NuveiSDK=f;R.ModulesNameEnum=p;})();
@@ -1,7 +1,8 @@
1
1
  export declare enum ModulesNameEnum {
2
2
  ONBOARDING_PARTNER = "ONBOARDING_PARTNER",
3
3
  ONBOARDING_MERCHANT = "ONBOARDING_MERCHANT",
4
- DOC_UTILITY = "DOC_UTILITY"
4
+ DOC_UTILITY = "DOC_UTILITY",
5
+ USER_MANAGEMENT = "USER_MANAGEMENT"
5
6
  }
6
7
  export type ModulesNameType = keyof typeof ModulesNameEnum;
7
8
  export declare enum PostMessageActionEnum {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/enums/index.ts"],"names":[],"mappings":"AACA,oBAAY,eAAe;IACzB,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;IAC3C,WAAW,gBAAgB;CAC5B;AACD,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,eAAe,CAAC;AAG3D,oBAAY,qBAAqB;IAC/B,YAAY,iBAAiB;IAC7B,QAAQ,aAAa;IACrB,WAAW,gBAAgB;CAC5B;AACD,MAAM,MAAM,qBAAqB,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAGvE,oBAAY,4BAA4B;IACtC,YAAY,iBAAiB;IAC7B,oBAAoB,yBAAyB;CAC9C;AACD,MAAM,MAAM,4BAA4B,GAAG,MAAM,OAAO,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/enums/index.ts"],"names":[],"mappings":"AACA,oBAAY,eAAe;IACzB,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;IAC3C,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;CACpC;AACD,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,eAAe,CAAC;AAG3D,oBAAY,qBAAqB;IAC/B,YAAY,iBAAiB;IAC7B,QAAQ,aAAa;IACrB,WAAW,gBAAgB;CAC5B;AACD,MAAM,MAAM,qBAAqB,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAGvE,oBAAY,4BAA4B;IACtC,YAAY,iBAAiB;IAC7B,oBAAoB,yBAAyB;CAC9C;AACD,MAAM,MAAM,4BAA4B,GAAG,MAAM,OAAO,4BAA4B,CAAC"}
@@ -7,6 +7,7 @@ var ModulesNameEnum;
7
7
  ModulesNameEnum["ONBOARDING_PARTNER"] = "ONBOARDING_PARTNER";
8
8
  ModulesNameEnum["ONBOARDING_MERCHANT"] = "ONBOARDING_MERCHANT";
9
9
  ModulesNameEnum["DOC_UTILITY"] = "DOC_UTILITY";
10
+ ModulesNameEnum["USER_MANAGEMENT"] = "USER_MANAGEMENT";
10
11
  })(ModulesNameEnum || (exports.ModulesNameEnum = ModulesNameEnum = {}));
11
12
  ;
12
13
  var PostMessageActionEnum;
@@ -20,5 +20,5 @@ exports.DEFAULT_CONFIG = {
20
20
  return expiryDate > currentDate;
21
21
  },
22
22
  sessionCheckInterval: 10 * 60 * 1000, // 5 minutes
23
- environment: 'uat',
23
+ environment: 'uat2',
24
24
  };
@@ -53,10 +53,15 @@ export interface INuveiSdkConfig {
53
53
  iframeStyle: Record<string, string>;
54
54
  sessionValidation: (token: string, tokenExpiry?: string) => boolean;
55
55
  sessionCheckInterval: number;
56
- environment: 'local' | 'dev3' | 'dev2' | 'uat' | 'prod';
56
+ environment: 'local' | 'dev3' | 'dev2' | 'uat2' | 'prod-na' | 'prod-eu' | 'dev2-2';
57
57
  iframeBaseUrl?: string;
58
58
  requestId?: string;
59
59
  documentRequestId?: string;
60
+ /**
61
+ * Optional path to open in the iframe instead of the module's default path.
62
+ * It is appended to the module's base URL, e.g. `/_admin/my-organization`.
63
+ */
64
+ initialPath?: string;
60
65
  }
61
66
  export interface HTMLIFrameElement extends HTMLElement {
62
67
  allow: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM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AAM,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IACpD,aAAa,EAAE,CAAC,aAAa,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IACrF,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,MAAM,EAAE,MAAM,IAAI,CAAC;CAGpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"iframe-url.utils.d.ts","sourceRoot":"","sources":["../../src/utils/iframe-url.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAmDpD,eAAO,MAAM,aAAa,GACxB,eAAe,eAAe,KAC7B,MAEF,CAAC;AAqDF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC3B,eAAe,eAAe,EAC9B,QAAQ,eAAe,KACtB,MAiCF,CAAC"}
1
+ {"version":3,"file":"iframe-url.utils.d.ts","sourceRoot":"","sources":["../../src/utils/iframe-url.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA+DpD,eAAO,MAAM,aAAa,GAAI,eAAe,eAAe,KAAG,MAE9D,CAAC;AAyDF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC3B,eAAe,eAAe,EAC9B,QAAQ,eAAe,KACtB,MAgCF,CAAC"}
@@ -8,32 +8,49 @@ var ENVIRONMENT_BASE_URLS = {
8
8
  local: 'http://localhost:4000',
9
9
  dev3: 'https://dev3-non-pci.eastus.cloudapp.azure.com',
10
10
  dev2: 'https://dev2-non-pci.eastus.cloudapp.azure.com',
11
- uat: 'https://ignite-preprod.nuvei.com',
12
- prod: 'https://ignite.nuvei.com',
11
+ uat2: 'https://ignite-preprod.nuvei.com',
12
+ 'prod-na': 'https://ignite.nuvei.com',
13
+ 'prod-eu': 'https://ignite-eu.nuvei.com',
14
+ 'dev2-2': 'https://dev2-non-pci-2.eastus.cloudapp.azure.com'
13
15
  };
14
16
  var DOCUMENT_UTILITY_BASE_URLS = {
15
17
  local: 'http://localhost:5000',
16
18
  dev3: 'https://dev3-non-pci.eastus.cloudapp.azure.com',
17
19
  dev2: 'https://dev2-non-pci.eastus.cloudapp.azure.com',
18
- uat: 'https://ignite-preprod.nuvei.com',
19
- prod: 'https://ignite.nuvei.com',
20
+ uat2: 'https://ignite-preprod.nuvei.com',
21
+ 'prod-na': 'https://ignite.nuvei.com',
22
+ 'prod-eu': 'https://ignite-eu.nuvei.com',
23
+ 'dev2-2': 'https://dev2-non-pci-2.eastus.cloudapp.azure.com'
24
+ };
25
+ var USER_MANAGEMENT_BASE_URLS = {
26
+ local: 'http://localhost:5001',
27
+ dev3: 'https://dev3-non-pci.eastus.cloudapp.azure.com',
28
+ dev2: 'https://dev2-non-pci.eastus.cloudapp.azure.com',
29
+ uat2: 'https://ignite-preprod.nuvei.com',
30
+ 'prod-na': 'https://ignite.nuvei.com',
31
+ 'prod-eu': 'https://ignite-eu.nuvei.com',
32
+ 'dev2-2': 'https://dev2-non-pci-2.eastus.cloudapp.azure.com'
20
33
  };
21
34
  var MODULE_PATHS = (_a = {},
22
35
  _a[enums_1.ModulesNameEnum.ONBOARDING_PARTNER] = '/_onboarding/partner/application',
23
36
  _a[enums_1.ModulesNameEnum.ONBOARDING_MERCHANT] = '/_onboarding/merchant/application',
24
37
  _a[enums_1.ModulesNameEnum.DOC_UTILITY] = '/_document-upload',
38
+ _a[enums_1.ModulesNameEnum.USER_MANAGEMENT] = '/_admin/user-management',
25
39
  _a);
26
40
  var DOCUMENT_REQUEST_ID_PARAM = 'documentRequestId';
27
41
  var REQUEST_ID_PARAM = 'requestId';
28
42
  var getEnvironmentBaseUrl = function (environment) {
29
43
  var _a;
30
- if (environment === void 0) { environment = 'prod'; }
31
- return ((_a = ENVIRONMENT_BASE_URLS[environment]) !== null && _a !== void 0 ? _a : ENVIRONMENT_BASE_URLS.prod);
44
+ return (_a = ENVIRONMENT_BASE_URLS[environment]) !== null && _a !== void 0 ? _a : ENVIRONMENT_BASE_URLS.prod;
32
45
  };
33
46
  var getDocumentUtilityBaseUrl = function (environment) {
47
+ var _a;
48
+ return (_a = DOCUMENT_UTILITY_BASE_URLS[environment]) !== null && _a !== void 0 ? _a : DOCUMENT_UTILITY_BASE_URLS.prod;
49
+ };
50
+ var getUserManagementBaseUrl = function (environment) {
34
51
  var _a;
35
52
  if (environment === void 0) { environment = 'prod'; }
36
- return ((_a = DOCUMENT_UTILITY_BASE_URLS[environment]) !== null && _a !== void 0 ? _a : DOCUMENT_UTILITY_BASE_URLS.prod);
53
+ return ((_a = USER_MANAGEMENT_BASE_URLS[environment]) !== null && _a !== void 0 ? _a : USER_MANAGEMENT_BASE_URLS.prod);
37
54
  };
38
55
  var getModulePath = function (componentName) {
39
56
  var _a;
@@ -76,6 +93,9 @@ var getBaseUrl = function (componentName, environment, config) {
76
93
  if (componentName === enums_1.ModulesNameEnum.DOC_UTILITY) {
77
94
  return getDocumentUtilityBaseUrl(environment);
78
95
  }
96
+ if (componentName === enums_1.ModulesNameEnum.USER_MANAGEMENT) {
97
+ return getUserManagementBaseUrl(environment);
98
+ }
79
99
  return getEnvironmentBaseUrl(environment);
80
100
  };
81
101
  /**
@@ -87,20 +107,23 @@ var getBaseUrl = function (componentName, environment, config) {
87
107
  */
88
108
  var resolveIframeUrl = function (componentName, config) {
89
109
  var _a, _b;
90
- var _c, _d, _e;
91
- var environment = (_c = config.environment) !== null && _c !== void 0 ? _c : 'prod';
110
+ var _c, _d;
111
+ var environment = config.environment;
112
+ if (!environment) {
113
+ throw new Error("Websdk Environment is not configured");
114
+ }
92
115
  var baseUrl = getBaseUrl(componentName, environment, config);
93
- var path = (0, exports.getModulePath)(componentName);
116
+ var path = config.initialPath || (0, exports.getModulePath)(componentName);
94
117
  var queryParams = {};
95
118
  if (componentName === enums_1.ModulesNameEnum.DOC_UTILITY) {
96
- var documentRequestId = (_d = config.documentRequestId) !== null && _d !== void 0 ? _d : getDocumentRequestIdFromUrl();
119
+ var documentRequestId = (_c = config.documentRequestId) !== null && _c !== void 0 ? _c : getDocumentRequestIdFromUrl();
97
120
  queryParams = (_a = {},
98
121
  _a[DOCUMENT_REQUEST_ID_PARAM] = documentRequestId,
99
122
  _a);
100
123
  }
101
124
  else if (componentName === enums_1.ModulesNameEnum.ONBOARDING_MERCHANT ||
102
125
  componentName === enums_1.ModulesNameEnum.ONBOARDING_PARTNER) {
103
- var requestId = (_e = config.requestId) !== null && _e !== void 0 ? _e : getRequestIdFromUrl();
126
+ var requestId = (_d = config.requestId) !== null && _d !== void 0 ? _d : getRequestIdFromUrl();
104
127
  queryParams = (_b = {},
105
128
  _b[REQUEST_ID_PARAM] = requestId,
106
129
  _b);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuvei-connect/nc-websdk",
3
- "version": "1.12.3",
3
+ "version": "1.12.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",