@thunderid/javascript 0.3.0 → 0.3.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/StorageManager.d.ts +2 -2
- package/dist/StorageManager.d.ts.map +1 -1
- package/dist/ThunderIDJavaScriptClient.d.ts +2 -12
- package/dist/ThunderIDJavaScriptClient.d.ts.map +1 -1
- package/dist/api/{v2/executeEmbeddedRecoveryFlowV2.d.ts → executeEmbeddedRecoveryFlow.d.ts} +7 -7
- package/dist/api/executeEmbeddedRecoveryFlow.d.ts.map +1 -0
- package/dist/api/executeEmbeddedSignInFlow.d.ts +3 -3
- package/dist/api/executeEmbeddedSignInFlow.d.ts.map +1 -1
- package/dist/api/executeEmbeddedSignUpFlow.d.ts +4 -27
- package/dist/api/executeEmbeddedSignUpFlow.d.ts.map +1 -1
- package/dist/api/{v2/executeEmbeddedUserOnboardingFlowV2.d.ts → executeEmbeddedUserOnboardingFlow.d.ts} +6 -6
- package/dist/api/executeEmbeddedUserOnboardingFlow.d.ts.map +1 -0
- package/dist/api/{v2/getFlowMetaV2.d.ts → getFlowMeta.d.ts} +7 -7
- package/dist/api/getFlowMeta.d.ts.map +1 -0
- package/dist/api/getOrganizationUnitChildren.d.ts +86 -0
- package/dist/api/getOrganizationUnitChildren.d.ts.map +1 -0
- package/dist/cjs/index.cjs +1440 -2496
- package/dist/edge/index.js +1428 -2464
- package/dist/errors/exception.d.ts +1 -3
- package/dist/errors/exception.d.ts.map +1 -1
- package/dist/i18n/models/i18n.d.ts +3 -0
- package/dist/i18n/models/i18n.d.ts.map +1 -1
- package/dist/i18n/translations/en-US.d.ts.map +1 -1
- package/dist/i18n/translations/fr-FR.d.ts.map +1 -1
- package/dist/i18n/translations/hi-IN.d.ts.map +1 -1
- package/dist/i18n/translations/ja-JP.d.ts.map +1 -1
- package/dist/i18n/translations/pt-BR.d.ts.map +1 -1
- package/dist/i18n/translations/pt-PT.d.ts.map +1 -1
- package/dist/i18n/translations/si-LK.d.ts.map +1 -1
- package/dist/i18n/translations/ta-IN.d.ts.map +1 -1
- package/dist/i18n/translations/te-IN.d.ts.map +1 -1
- package/dist/index.d.ts +29 -53
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1428 -2464
- package/dist/models/client.d.ts +3 -53
- package/dist/models/client.d.ts.map +1 -1
- package/dist/models/config.d.ts +1 -16
- package/dist/models/config.d.ts.map +1 -1
- package/dist/models/embedded-flow.d.ts +572 -92
- package/dist/models/embedded-flow.d.ts.map +1 -1
- package/dist/models/{v2/embedded-recovery-flow-v2.d.ts → embedded-recovery-flow.d.ts} +2 -3
- package/dist/models/embedded-recovery-flow.d.ts.map +1 -0
- package/dist/models/embedded-signin-flow.d.ts +310 -66
- package/dist/models/embedded-signin-flow.d.ts.map +1 -1
- package/dist/models/{v2/embedded-signup-flow-v2.d.ts → embedded-signup-flow.d.ts} +4 -5
- package/dist/models/embedded-signup-flow.d.ts.map +1 -0
- package/dist/models/extensions/components.d.ts +55 -0
- package/dist/models/extensions/components.d.ts.map +1 -0
- package/dist/models/{v2/flow-meta-v2.d.ts → flow-meta.d.ts} +1 -1
- package/dist/models/flow-meta.d.ts.map +1 -0
- package/dist/models/translation.d.ts.map +1 -0
- package/dist/models/{v2/vars.d.ts → vars.d.ts} +1 -1
- package/dist/models/vars.d.ts.map +1 -0
- package/dist/utils/buildValidatorFromRules.d.ts +31 -0
- package/dist/utils/buildValidatorFromRules.d.ts.map +1 -0
- package/dist/utils/containsMetaFlowTemplateLiteral.d.ts.map +1 -0
- package/dist/utils/countryCodeToFlagEmoji.d.ts.map +1 -0
- package/dist/utils/evaluateValidationRule.d.ts +42 -0
- package/dist/utils/evaluateValidationRule.d.ts.map +1 -0
- package/dist/utils/extractEmojiFromUri.d.ts.map +1 -0
- package/dist/utils/getRedirectBasedSignUpUrl.d.ts +1 -1
- package/dist/utils/getRedirectBasedSignUpUrl.d.ts.map +1 -1
- package/dist/utils/injectRequestedPermissions.d.ts.map +1 -0
- package/dist/utils/isEmojiUri.d.ts.map +1 -0
- package/dist/utils/isMetaFlowTemplateLiteral.d.ts.map +1 -0
- package/dist/utils/isTranslationFlowTemplateLiteral.d.ts.map +1 -0
- package/dist/utils/parseApiErrorMessage.d.ts.map +1 -1
- package/dist/utils/parseFlowTemplateLiteral.d.ts.map +1 -0
- package/dist/utils/{v2/resolveFlowTemplateLiterals.d.ts → resolveFlowTemplateLiterals.d.ts} +2 -2
- package/dist/utils/resolveFlowTemplateLiterals.d.ts.map +1 -0
- package/dist/utils/resolveLocaleDisplayName.d.ts.map +1 -0
- package/dist/utils/resolveLocaleEmoji.d.ts.map +1 -0
- package/dist/utils/{v2/resolveMeta.d.ts → resolveMeta.d.ts} +1 -1
- package/dist/utils/resolveMeta.d.ts.map +1 -0
- package/package.json +7 -7
- package/dist/api/createOrganization.d.ts +0 -130
- package/dist/api/createOrganization.d.ts.map +0 -1
- package/dist/api/getAllOrganizations.d.ts +0 -104
- package/dist/api/getAllOrganizations.d.ts.map +0 -1
- package/dist/api/getBrandingPreference.d.ts +0 -104
- package/dist/api/getBrandingPreference.d.ts.map +0 -1
- package/dist/api/getMeOrganizations.d.ts +0 -120
- package/dist/api/getMeOrganizations.d.ts.map +0 -1
- package/dist/api/getOrganization.d.ts +0 -110
- package/dist/api/getOrganization.d.ts.map +0 -1
- package/dist/api/initializeEmbeddedSignInFlow.d.ts +0 -52
- package/dist/api/initializeEmbeddedSignInFlow.d.ts.map +0 -1
- package/dist/api/updateOrganization.d.ts +0 -119
- package/dist/api/updateOrganization.d.ts.map +0 -1
- package/dist/api/v2/executeEmbeddedRecoveryFlowV2.d.ts.map +0 -1
- package/dist/api/v2/executeEmbeddedSignInFlowV2.d.ts +0 -22
- package/dist/api/v2/executeEmbeddedSignInFlowV2.d.ts.map +0 -1
- package/dist/api/v2/executeEmbeddedSignUpFlowV2.d.ts +0 -22
- package/dist/api/v2/executeEmbeddedSignUpFlowV2.d.ts.map +0 -1
- package/dist/api/v2/executeEmbeddedUserOnboardingFlowV2.d.ts.map +0 -1
- package/dist/api/v2/getFlowMetaV2.d.ts.map +0 -1
- package/dist/api/v2/getOrganizationUnitChildren.d.ts +0 -43
- package/dist/api/v2/getOrganizationUnitChildren.d.ts.map +0 -1
- package/dist/constants/v2/OIDCDiscoveryConstants.d.ts +0 -40
- package/dist/constants/v2/OIDCDiscoveryConstants.d.ts.map +0 -1
- package/dist/models/branding-preference.d.ts +0 -249
- package/dist/models/branding-preference.d.ts.map +0 -1
- package/dist/models/organization.d.ts +0 -34
- package/dist/models/organization.d.ts.map +0 -1
- package/dist/models/platforms.d.ts +0 -33
- package/dist/models/platforms.d.ts.map +0 -1
- package/dist/models/v2/embedded-flow-v2.d.ts +0 -550
- package/dist/models/v2/embedded-flow-v2.d.ts.map +0 -1
- package/dist/models/v2/embedded-recovery-flow-v2.d.ts.map +0 -1
- package/dist/models/v2/embedded-signin-flow-v2.d.ts +0 -345
- package/dist/models/v2/embedded-signin-flow-v2.d.ts.map +0 -1
- package/dist/models/v2/embedded-signup-flow-v2.d.ts.map +0 -1
- package/dist/models/v2/extensions/components.d.ts +0 -89
- package/dist/models/v2/extensions/components.d.ts.map +0 -1
- package/dist/models/v2/flow-meta-v2.d.ts.map +0 -1
- package/dist/models/v2/organization-unit.d.ts +0 -103
- package/dist/models/v2/organization-unit.d.ts.map +0 -1
- package/dist/models/v2/translation.d.ts.map +0 -1
- package/dist/models/v2/vars.d.ts.map +0 -1
- package/dist/utils/deriveOrganizationHandleFromBaseUrl.d.ts +0 -40
- package/dist/utils/deriveOrganizationHandleFromBaseUrl.d.ts.map +0 -1
- package/dist/utils/identifyPlatform.d.ts +0 -31
- package/dist/utils/identifyPlatform.d.ts.map +0 -1
- package/dist/utils/resolveFieldType.d.ts +0 -21
- package/dist/utils/resolveFieldType.d.ts.map +0 -1
- package/dist/utils/transformBrandingPreferenceToTheme.d.ts +0 -49
- package/dist/utils/transformBrandingPreferenceToTheme.d.ts.map +0 -1
- package/dist/utils/v2/containsMetaFlowTemplateLiteral.d.ts.map +0 -1
- package/dist/utils/v2/countryCodeToFlagEmoji.d.ts.map +0 -1
- package/dist/utils/v2/extractEmojiFromUri.d.ts.map +0 -1
- package/dist/utils/v2/injectRequestedPermissions.d.ts.map +0 -1
- package/dist/utils/v2/isEmojiUri.d.ts.map +0 -1
- package/dist/utils/v2/isMetaFlowTemplateLiteral.d.ts.map +0 -1
- package/dist/utils/v2/isTranslationFlowTemplateLiteral.d.ts.map +0 -1
- package/dist/utils/v2/parseFlowTemplateLiteral.d.ts.map +0 -1
- package/dist/utils/v2/resolveFlowTemplateLiterals.d.ts.map +0 -1
- package/dist/utils/v2/resolveLocaleDisplayName.d.ts.map +0 -1
- package/dist/utils/v2/resolveLocaleEmoji.d.ts.map +0 -1
- package/dist/utils/v2/resolveMeta.d.ts.map +0 -1
- /package/dist/models/{v2/translation.d.ts → translation.d.ts} +0 -0
- /package/dist/utils/{v2/containsMetaFlowTemplateLiteral.d.ts → containsMetaFlowTemplateLiteral.d.ts} +0 -0
- /package/dist/utils/{v2/countryCodeToFlagEmoji.d.ts → countryCodeToFlagEmoji.d.ts} +0 -0
- /package/dist/utils/{v2/extractEmojiFromUri.d.ts → extractEmojiFromUri.d.ts} +0 -0
- /package/dist/utils/{v2/injectRequestedPermissions.d.ts → injectRequestedPermissions.d.ts} +0 -0
- /package/dist/utils/{v2/isEmojiUri.d.ts → isEmojiUri.d.ts} +0 -0
- /package/dist/utils/{v2/isMetaFlowTemplateLiteral.d.ts → isMetaFlowTemplateLiteral.d.ts} +0 -0
- /package/dist/utils/{v2/isTranslationFlowTemplateLiteral.d.ts → isTranslationFlowTemplateLiteral.d.ts} +0 -0
- /package/dist/utils/{v2/parseFlowTemplateLiteral.d.ts → parseFlowTemplateLiteral.d.ts} +0 -0
- /package/dist/utils/{v2/resolveLocaleDisplayName.d.ts → resolveLocaleDisplayName.d.ts} +0 -0
- /package/dist/utils/{v2/resolveLocaleEmoji.d.ts → resolveLocaleEmoji.d.ts} +0 -0
package/dist/edge/index.js
CHANGED
|
@@ -82,12 +82,10 @@ var TokenConstants_default = TokenConstants;
|
|
|
82
82
|
/**
|
|
83
83
|
* @deprecated Use `ThunderIDRuntimeError` for runtime errors and `ThunderIDAPIError` for API errors.
|
|
84
84
|
*/
|
|
85
|
-
var ThunderIDAuthException = class {
|
|
86
|
-
name;
|
|
85
|
+
var ThunderIDAuthException = class extends Error {
|
|
87
86
|
code;
|
|
88
|
-
message;
|
|
89
87
|
constructor(code, name, message) {
|
|
90
|
-
|
|
88
|
+
super(message);
|
|
91
89
|
this.name = name;
|
|
92
90
|
this.code = code;
|
|
93
91
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
@@ -329,101 +327,91 @@ var ThunderIDAPIError = class extends ThunderIDError {
|
|
|
329
327
|
};
|
|
330
328
|
|
|
331
329
|
//#endregion
|
|
332
|
-
//#region src/
|
|
330
|
+
//#region src/models/embedded-signin-flow.ts
|
|
333
331
|
/**
|
|
334
|
-
*
|
|
332
|
+
* Status enumeration for ThunderID embedded sign-in flow operations.
|
|
335
333
|
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
334
|
+
* These statuses indicate the current state of the sign-in flow and determine
|
|
335
|
+
* the next action required by the client application. Each status provides
|
|
336
|
+
* specific guidance on how to proceed with the authentication process.
|
|
339
337
|
*
|
|
340
338
|
* @example
|
|
341
339
|
* ```typescript
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
* code_challenge_method: "S256"
|
|
353
|
-
* }
|
|
354
|
-
* });
|
|
355
|
-
* console.log(authResponse);
|
|
356
|
-
* } catch (error) {
|
|
357
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
358
|
-
* console.error('Authorization failed:', error.message);
|
|
359
|
-
* }
|
|
340
|
+
* switch (response.flowStatus) {
|
|
341
|
+
* case EmbeddedSignInFlowStatus.Incomplete:
|
|
342
|
+
* // More user input needed - render form components
|
|
343
|
+
* break;
|
|
344
|
+
* case EmbeddedSignInFlowStatus.Complete:
|
|
345
|
+
* // Authentication successful - handle completion
|
|
346
|
+
* break;
|
|
347
|
+
* case EmbeddedSignInFlowStatus.Error:
|
|
348
|
+
* // Authentication failed - show error message
|
|
349
|
+
* break;
|
|
360
350
|
* }
|
|
361
351
|
* ```
|
|
352
|
+
*
|
|
353
|
+
* @experimental Part of the new ThunderID API
|
|
362
354
|
*/
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "executeEmbeddedSignInFlow-NetworkError-001", "javascript", 0, "Network Error");
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
var executeEmbeddedSignInFlow_default = executeEmbeddedSignInFlow;
|
|
355
|
+
let EmbeddedSignInFlowStatus = /* @__PURE__ */ function(EmbeddedSignInFlowStatus$1) {
|
|
356
|
+
/**
|
|
357
|
+
* Sign-in flow completed successfully.
|
|
358
|
+
*
|
|
359
|
+
* The user has been authenticated and the flow can proceed to
|
|
360
|
+
* OAuth2 completion or redirection. Check for redirectUrl or
|
|
361
|
+
* assertion data in the response.
|
|
362
|
+
*/
|
|
363
|
+
EmbeddedSignInFlowStatus$1["Complete"] = "COMPLETE";
|
|
364
|
+
/**
|
|
365
|
+
* Sign-in flow encountered an error.
|
|
366
|
+
*
|
|
367
|
+
* Authentication failed due to invalid credentials, system error,
|
|
368
|
+
* or other issues. Check error details in the response and handle
|
|
369
|
+
* appropriately (retry, show error message, etc.).
|
|
370
|
+
*/
|
|
371
|
+
EmbeddedSignInFlowStatus$1["Error"] = "ERROR";
|
|
372
|
+
/**
|
|
373
|
+
* Sign-in flow requires additional user input.
|
|
374
|
+
*
|
|
375
|
+
* More authentication steps are needed. The response will contain
|
|
376
|
+
* components in data.meta.components that should be rendered to
|
|
377
|
+
* collect additional user input (e.g., MFA, password, etc.).
|
|
378
|
+
*/
|
|
379
|
+
EmbeddedSignInFlowStatus$1["Incomplete"] = "INCOMPLETE";
|
|
380
|
+
return EmbeddedSignInFlowStatus$1;
|
|
381
|
+
}({});
|
|
382
|
+
/**
|
|
383
|
+
* Type enumeration for ThunderID embedded sign-in flow responses.
|
|
384
|
+
*
|
|
385
|
+
* Determines the nature of the flow response and how the client should
|
|
386
|
+
* handle the returned data. This affects both UI rendering and flow
|
|
387
|
+
* continuation logic.
|
|
388
|
+
*
|
|
389
|
+
* @experimental Part of the new ThunderID API
|
|
390
|
+
*/
|
|
391
|
+
let EmbeddedSignInFlowType = /* @__PURE__ */ function(EmbeddedSignInFlowType$1) {
|
|
392
|
+
/**
|
|
393
|
+
* Response requires external redirection.
|
|
394
|
+
*
|
|
395
|
+
* Used for social login providers, external identity providers,
|
|
396
|
+
* or other flows that require navigating to an external URL.
|
|
397
|
+
* The response will contain redirection information.
|
|
398
|
+
*/
|
|
399
|
+
EmbeddedSignInFlowType$1["Redirection"] = "REDIRECTION";
|
|
400
|
+
/**
|
|
401
|
+
* Response contains view components for rendering.
|
|
402
|
+
*
|
|
403
|
+
* Standard embedded flow response containing UI components
|
|
404
|
+
* that should be rendered within the current application
|
|
405
|
+
* context. Most common type for embedded authentication.
|
|
406
|
+
*/
|
|
407
|
+
EmbeddedSignInFlowType$1["View"] = "VIEW";
|
|
408
|
+
return EmbeddedSignInFlowType$1;
|
|
409
|
+
}({});
|
|
422
410
|
|
|
423
411
|
//#endregion
|
|
424
|
-
//#region src/
|
|
412
|
+
//#region src/utils/injectRequestedPermissions.ts
|
|
425
413
|
/**
|
|
426
|
-
* Copyright (c)
|
|
414
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
427
415
|
*
|
|
428
416
|
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
429
417
|
* Version 2.0 (the "License"); you may not use this file except
|
|
@@ -439,140 +427,286 @@ var executeEmbeddedSignInFlow_default = executeEmbeddedSignInFlow;
|
|
|
439
427
|
* specific language governing permissions and limitations
|
|
440
428
|
* under the License.
|
|
441
429
|
*/
|
|
442
|
-
let EmbeddedFlowType = /* @__PURE__ */ function(EmbeddedFlowType$1) {
|
|
443
|
-
EmbeddedFlowType$1["Authentication"] = "AUTHENTICATION";
|
|
444
|
-
EmbeddedFlowType$1["Recovery"] = "RECOVERY";
|
|
445
|
-
EmbeddedFlowType$1["Registration"] = "REGISTRATION";
|
|
446
|
-
EmbeddedFlowType$1["UserOnboarding"] = "USER_ONBOARDING";
|
|
447
|
-
return EmbeddedFlowType$1;
|
|
448
|
-
}({});
|
|
449
|
-
let EmbeddedFlowStatus = /* @__PURE__ */ function(EmbeddedFlowStatus$1) {
|
|
450
|
-
EmbeddedFlowStatus$1["Complete"] = "COMPLETE";
|
|
451
|
-
EmbeddedFlowStatus$1["Incomplete"] = "INCOMPLETE";
|
|
452
|
-
return EmbeddedFlowStatus$1;
|
|
453
|
-
}({});
|
|
454
|
-
let EmbeddedFlowResponseType = /* @__PURE__ */ function(EmbeddedFlowResponseType$1) {
|
|
455
|
-
EmbeddedFlowResponseType$1["Redirection"] = "REDIRECTION";
|
|
456
|
-
EmbeddedFlowResponseType$1["View"] = "VIEW";
|
|
457
|
-
return EmbeddedFlowResponseType$1;
|
|
458
|
-
}({});
|
|
459
|
-
let EmbeddedFlowComponentType = /* @__PURE__ */ function(EmbeddedFlowComponentType$2) {
|
|
460
|
-
EmbeddedFlowComponentType$2["Button"] = "BUTTON";
|
|
461
|
-
EmbeddedFlowComponentType$2["Checkbox"] = "CHECKBOX";
|
|
462
|
-
EmbeddedFlowComponentType$2["Divider"] = "DIVIDER";
|
|
463
|
-
EmbeddedFlowComponentType$2["Form"] = "FORM";
|
|
464
|
-
EmbeddedFlowComponentType$2["Image"] = "IMAGE";
|
|
465
|
-
EmbeddedFlowComponentType$2["Input"] = "INPUT";
|
|
466
|
-
EmbeddedFlowComponentType$2["Radio"] = "RADIO";
|
|
467
|
-
EmbeddedFlowComponentType$2["Select"] = "SELECT";
|
|
468
|
-
EmbeddedFlowComponentType$2["Typography"] = "TYPOGRAPHY";
|
|
469
|
-
return EmbeddedFlowComponentType$2;
|
|
470
|
-
}({});
|
|
471
|
-
|
|
472
|
-
//#endregion
|
|
473
|
-
//#region src/api/executeEmbeddedSignUpFlow.ts
|
|
474
430
|
/**
|
|
475
|
-
*
|
|
476
|
-
*
|
|
477
|
-
* @param requestConfig - Request configuration object containing URL and payload.
|
|
478
|
-
* @returns A promise that resolves with the flow execution response.
|
|
479
|
-
* @throws ThunderIDAPIError when the request fails or URL is invalid.
|
|
431
|
+
* Strips the top-level `scopes` field from a payload and injects it as
|
|
432
|
+
* `inputs.requested_permissions` (space-separated string).
|
|
480
433
|
*
|
|
481
|
-
*
|
|
482
|
-
* ```typescript
|
|
483
|
-
* try {
|
|
484
|
-
* const embeddedSignUpResponse = await executeEmbeddedSignUpFlow({
|
|
485
|
-
* url: "https://localhost:8090/api/server/v1/flow/execute",
|
|
486
|
-
* payload: {
|
|
487
|
-
* flowType: "REGISTRATION"
|
|
488
|
-
* }
|
|
489
|
-
* });
|
|
490
|
-
* console.log(embeddedSignUpResponse);
|
|
491
|
-
* } catch (error) {
|
|
492
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
493
|
-
* console.error('Embedded SignUp flow execution failed:', error.message);
|
|
494
|
-
* }
|
|
495
|
-
* }
|
|
496
|
-
* ```
|
|
434
|
+
* The backend reads requested_permissions from UserInputs (the `inputs` map), not a top-level field.
|
|
497
435
|
*/
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
436
|
+
const injectRequestedPermissions = (payload) => {
|
|
437
|
+
const { scopes,...rest } = payload;
|
|
438
|
+
const normalizedScopes = Array.isArray(scopes) ? scopes.map((s) => String(s).trim()).filter(Boolean).join(" ") : typeof scopes === "string" ? scopes.trim() : "";
|
|
439
|
+
if (!normalizedScopes) return rest;
|
|
440
|
+
const existingInputs = rest["inputs"] != null && typeof rest["inputs"] === "object" && !Array.isArray(rest["inputs"]) ? rest["inputs"] : {};
|
|
441
|
+
return {
|
|
442
|
+
...rest,
|
|
443
|
+
inputs: {
|
|
444
|
+
...existingInputs,
|
|
445
|
+
requested_permissions: normalizedScopes
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
var injectRequestedPermissions_default = injectRequestedPermissions;
|
|
450
|
+
|
|
451
|
+
//#endregion
|
|
452
|
+
//#region src/api/executeEmbeddedSignInFlow.ts
|
|
453
|
+
const executeEmbeddedSignInFlow = async ({ url, baseUrl, payload, authId,...requestConfig }) => {
|
|
454
|
+
if (!payload) throw new ThunderIDAPIError("Authorization payload is required", "executeEmbeddedSignInFlow-ValidationError-002", "javascript", 400, "If an authorization payload is not provided, the request cannot be constructed correctly.");
|
|
455
|
+
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
456
|
+
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
457
|
+
const isNewFlowStart = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload;
|
|
458
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
459
|
+
const basePayload = isNewFlowStart ? injectRequestedPermissions_default(cleanPayload) : cleanPayload;
|
|
460
|
+
const requestPayload = isNewFlowStart || hasOnlyFlowId ? {
|
|
461
|
+
...basePayload,
|
|
462
|
+
verbose: true
|
|
463
|
+
} : basePayload;
|
|
464
|
+
const response = await fetch(endpoint, {
|
|
465
|
+
...requestConfig,
|
|
466
|
+
body: JSON.stringify(requestPayload),
|
|
467
|
+
headers: {
|
|
468
|
+
Accept: "application/json",
|
|
469
|
+
"Content-Type": "application/json",
|
|
470
|
+
...requestConfig.headers
|
|
471
|
+
},
|
|
472
|
+
method: requestConfig.method || "POST"
|
|
473
|
+
});
|
|
474
|
+
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedSignInFlow-ResponseError-001", "javascript", response.status, response.statusText, "Authorization request failed");
|
|
475
|
+
const flowResponse = await response.json();
|
|
476
|
+
if (flowResponse.flowStatus === EmbeddedSignInFlowStatus.Complete && flowResponse.assertion && authId) try {
|
|
477
|
+
const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
|
|
508
478
|
body: JSON.stringify({
|
|
509
|
-
|
|
510
|
-
|
|
479
|
+
assertion: flowResponse.assertion,
|
|
480
|
+
authId
|
|
511
481
|
}),
|
|
482
|
+
credentials: "include",
|
|
512
483
|
headers: {
|
|
513
484
|
Accept: "application/json",
|
|
514
485
|
"Content-Type": "application/json",
|
|
515
486
|
...requestConfig.headers
|
|
516
487
|
},
|
|
517
|
-
method:
|
|
488
|
+
method: "POST"
|
|
518
489
|
});
|
|
519
|
-
if (!
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
490
|
+
if (!oauth2Response.ok) throw new ThunderIDAPIError(await oauth2Response.text(), "executeEmbeddedSignInFlow-OAuth2Error-002", "javascript", oauth2Response.status, oauth2Response.statusText, "OAuth2 authorization failed");
|
|
491
|
+
const oauth2Result = await oauth2Response.json();
|
|
492
|
+
return {
|
|
493
|
+
flowStatus: flowResponse.flowStatus,
|
|
494
|
+
redirectUrl: oauth2Result["redirect_uri"]
|
|
495
|
+
};
|
|
496
|
+
} catch (authError) {
|
|
497
|
+
if (authError instanceof ThunderIDAPIError) throw authError;
|
|
498
|
+
throw new ThunderIDAPIError(authError instanceof Error ? authError.message : "Unknown error", "executeEmbeddedSignInFlow-OAuth2Error-001", "javascript", 500, "Failed to complete OAuth2 authorization after successful embedded sign-in flow.", "OAuth2 authorization failed");
|
|
524
499
|
}
|
|
500
|
+
return flowResponse;
|
|
525
501
|
};
|
|
526
|
-
var
|
|
502
|
+
var executeEmbeddedSignInFlow_default = executeEmbeddedSignInFlow;
|
|
527
503
|
|
|
528
504
|
//#endregion
|
|
529
|
-
//#region src/
|
|
505
|
+
//#region src/models/embedded-signup-flow.ts
|
|
530
506
|
/**
|
|
531
|
-
*
|
|
507
|
+
* Status enumeration for ThunderID embedded sign-up flow operations.
|
|
532
508
|
*
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
*
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
509
|
+
* These statuses indicate the current state of the registration flow and determine
|
|
510
|
+
* the next action required by the client application. Each status provides specific
|
|
511
|
+
* guidance on how to proceed with the user registration process.
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
* ```typescript
|
|
515
|
+
* switch (response.flowStatus) {
|
|
516
|
+
* case EmbeddedSignUpFlowStatus.Incomplete:
|
|
517
|
+
* // More user input needed - render registration form components
|
|
518
|
+
* break;
|
|
519
|
+
* case EmbeddedSignUpFlowStatus.Complete:
|
|
520
|
+
* // Registration successful - handle completion
|
|
521
|
+
* break;
|
|
522
|
+
* case EmbeddedSignUpFlowStatus.Error:
|
|
523
|
+
* // Registration failed - show error details
|
|
524
|
+
* const errorResponse = response as EmbeddedSignUpFlowErrorResponse;
|
|
525
|
+
* showError(errorResponse.error.description.defaultValue);
|
|
526
|
+
* break;
|
|
544
527
|
* }
|
|
545
528
|
* ```
|
|
529
|
+
*
|
|
530
|
+
* @experimental Part of the new ThunderID API
|
|
546
531
|
*/
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
532
|
+
let EmbeddedSignUpFlowStatus = /* @__PURE__ */ function(EmbeddedSignUpFlowStatus$1) {
|
|
533
|
+
/**
|
|
534
|
+
* Sign-up flow completed successfully.
|
|
535
|
+
*
|
|
536
|
+
* The user has successfully registered and the flow can proceed to
|
|
537
|
+
* OAuth2 completion or redirection. Check for redirectUrl or assertion
|
|
538
|
+
* data in the response for next steps.
|
|
539
|
+
*/
|
|
540
|
+
EmbeddedSignUpFlowStatus$1["Complete"] = "COMPLETE";
|
|
541
|
+
/**
|
|
542
|
+
* Sign-up flow encountered an error and cannot proceed.
|
|
543
|
+
*
|
|
544
|
+
* Registration failed due to validation errors, duplicate user,
|
|
545
|
+
* system errors, or other issues. The response will be of type
|
|
546
|
+
* `EmbeddedSignUpFlowErrorResponse` containing detailed failure
|
|
547
|
+
* information that can be displayed to the user.
|
|
548
|
+
*
|
|
549
|
+
* @see {@link EmbeddedSignUpFlowErrorResponse} for error response structure
|
|
550
|
+
*/
|
|
551
|
+
EmbeddedSignUpFlowStatus$1["Error"] = "ERROR";
|
|
552
|
+
/**
|
|
553
|
+
* Sign-up flow requires additional user input.
|
|
554
|
+
*
|
|
555
|
+
* More registration steps are needed. The response will contain
|
|
556
|
+
* components in data.meta.components that should be rendered to
|
|
557
|
+
* collect additional user information (e.g., profile data, verification).
|
|
558
|
+
*/
|
|
559
|
+
EmbeddedSignUpFlowStatus$1["Incomplete"] = "INCOMPLETE";
|
|
560
|
+
return EmbeddedSignUpFlowStatus$1;
|
|
561
|
+
}({});
|
|
562
|
+
/**
|
|
563
|
+
* Type enumeration for ThunderID embedded sign-up flow responses.
|
|
564
|
+
*
|
|
565
|
+
* Determines the nature of the registration flow response and how the client
|
|
566
|
+
* should handle the returned data. This affects both UI rendering and flow
|
|
567
|
+
* continuation logic during the user registration process.
|
|
568
|
+
*
|
|
569
|
+
* @experimental Part of the new ThunderID API
|
|
570
|
+
*/
|
|
571
|
+
let EmbeddedSignUpFlowType = /* @__PURE__ */ function(EmbeddedSignUpFlowType$1) {
|
|
572
|
+
/**
|
|
573
|
+
* Response requires external redirection.
|
|
574
|
+
*
|
|
575
|
+
* Used for social registration providers, external identity providers,
|
|
576
|
+
* or other flows that require navigating to an external URL during
|
|
577
|
+
* the registration process. The response will contain redirection information.
|
|
578
|
+
*/
|
|
579
|
+
EmbeddedSignUpFlowType$1["Redirection"] = "REDIRECTION";
|
|
580
|
+
/**
|
|
581
|
+
* Response contains view components for rendering.
|
|
582
|
+
*
|
|
583
|
+
* Standard embedded registration flow response containing UI components
|
|
584
|
+
* that should be rendered within the current application context.
|
|
585
|
+
* Most common type for embedded user registration.
|
|
586
|
+
*/
|
|
587
|
+
EmbeddedSignUpFlowType$1["View"] = "VIEW";
|
|
588
|
+
return EmbeddedSignUpFlowType$1;
|
|
589
|
+
}({});
|
|
590
|
+
|
|
591
|
+
//#endregion
|
|
592
|
+
//#region src/api/executeEmbeddedSignUpFlow.ts
|
|
593
|
+
const executeEmbeddedSignUpFlow = async ({ url, baseUrl, payload, authId,...requestConfig }) => {
|
|
594
|
+
if (!payload) throw new ThunderIDAPIError("Registration payload is required", "executeEmbeddedSignUpFlow-ValidationError-002", "javascript", 400, "If a registration payload is not provided, the request cannot be constructed correctly.");
|
|
595
|
+
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
596
|
+
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
597
|
+
const isNewFlowStart = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload;
|
|
598
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
599
|
+
const basePayload = isNewFlowStart ? injectRequestedPermissions_default(cleanPayload) : cleanPayload;
|
|
600
|
+
const requestPayload = isNewFlowStart || hasOnlyFlowId ? {
|
|
601
|
+
...basePayload,
|
|
602
|
+
verbose: true
|
|
603
|
+
} : basePayload;
|
|
604
|
+
const response = await fetch(endpoint, {
|
|
605
|
+
...requestConfig,
|
|
606
|
+
body: JSON.stringify(requestPayload),
|
|
607
|
+
headers: {
|
|
608
|
+
Accept: "application/json",
|
|
609
|
+
"Content-Type": "application/json",
|
|
610
|
+
...requestConfig.headers
|
|
611
|
+
},
|
|
612
|
+
method: requestConfig.method || "POST"
|
|
613
|
+
});
|
|
614
|
+
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedSignUpFlow-ResponseError-001", "javascript", response.status, response.statusText, "Registration request failed");
|
|
615
|
+
const flowResponse = await response.json();
|
|
616
|
+
if (flowResponse.flowStatus === EmbeddedSignUpFlowStatus.Complete && flowResponse.assertion && authId) try {
|
|
617
|
+
const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
|
|
618
|
+
body: JSON.stringify({
|
|
619
|
+
assertion: flowResponse.assertion,
|
|
620
|
+
authId
|
|
621
|
+
}),
|
|
622
|
+
credentials: "include",
|
|
623
|
+
headers: {
|
|
557
624
|
Accept: "application/json",
|
|
558
625
|
"Content-Type": "application/json",
|
|
559
626
|
...requestConfig.headers
|
|
560
627
|
},
|
|
561
|
-
method: "
|
|
628
|
+
method: "POST"
|
|
562
629
|
});
|
|
563
|
-
if (!
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
630
|
+
if (!oauth2Response.ok) throw new ThunderIDAPIError(await oauth2Response.text(), "executeEmbeddedSignUpFlow-OAuth2Error-002", "javascript", oauth2Response.status, oauth2Response.statusText, "OAuth2 authorization failed");
|
|
631
|
+
const oauth2Result = await oauth2Response.json();
|
|
632
|
+
return {
|
|
633
|
+
flowStatus: flowResponse.flowStatus,
|
|
634
|
+
redirectUrl: oauth2Result["redirect_uri"]
|
|
635
|
+
};
|
|
636
|
+
} catch (authError) {
|
|
637
|
+
if (authError instanceof ThunderIDAPIError) throw authError;
|
|
638
|
+
throw new ThunderIDAPIError(authError instanceof Error ? authError.message : "Unknown error", "executeEmbeddedSignUpFlow-OAuth2Error-001", "javascript", 500, "Failed to complete OAuth2 authorization after successful embedded sign-up flow.", "OAuth2 authorization failed");
|
|
568
639
|
}
|
|
640
|
+
return flowResponse;
|
|
569
641
|
};
|
|
570
|
-
var
|
|
642
|
+
var executeEmbeddedSignUpFlow_default = executeEmbeddedSignUpFlow;
|
|
571
643
|
|
|
572
644
|
//#endregion
|
|
573
|
-
//#region src/
|
|
645
|
+
//#region src/api/executeEmbeddedRecoveryFlow.ts
|
|
574
646
|
/**
|
|
575
|
-
*
|
|
647
|
+
* Executes an embedded recovery flow by sending a request to the flow execution endpoint.
|
|
648
|
+
*
|
|
649
|
+
* This function handles password-recovery and account-recovery flows driven by the
|
|
650
|
+
* ThunderID server. The server returns UI components for each step (e.g. username
|
|
651
|
+
* collection, OTP verification, password reset) and this function forwards the
|
|
652
|
+
* user's responses back to the server.
|
|
653
|
+
*
|
|
654
|
+
* @param requestConfig - Request configuration containing URL, payload, and optional headers.
|
|
655
|
+
* @returns A promise that resolves with the flow execution response.
|
|
656
|
+
* @throws ThunderIDAPIError when the request fails or a payload is missing.
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* ```typescript
|
|
660
|
+
* // Initiate recovery flow
|
|
661
|
+
* const response = await executeEmbeddedRecoveryFlow({
|
|
662
|
+
* baseUrl: 'https://localhost:8090',
|
|
663
|
+
* payload: {
|
|
664
|
+
* flowType: 'RECOVERY',
|
|
665
|
+
* applicationId: 'my-app-id',
|
|
666
|
+
* },
|
|
667
|
+
* });
|
|
668
|
+
*
|
|
669
|
+
* // Continue recovery flow with user input
|
|
670
|
+
* const nextResponse = await executeEmbeddedRecoveryFlow({
|
|
671
|
+
* baseUrl: 'https://localhost:8090',
|
|
672
|
+
* payload: {
|
|
673
|
+
* executionId: response.executionId,
|
|
674
|
+
* action: 'submit',
|
|
675
|
+
* inputs: { username: 'user@example.com' },
|
|
676
|
+
* challengeToken: response.challengeToken,
|
|
677
|
+
* },
|
|
678
|
+
* });
|
|
679
|
+
* ```
|
|
680
|
+
*/
|
|
681
|
+
const executeEmbeddedRecoveryFlow = async ({ url, baseUrl, payload,...requestConfig }) => {
|
|
682
|
+
if (!payload) throw new ThunderIDAPIError("Recovery payload is required", "executeEmbeddedRecoveryFlow-ValidationError-002", "javascript", 400, "If a recovery payload is not provided, the request cannot be constructed correctly.");
|
|
683
|
+
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
684
|
+
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
685
|
+
const hasOnlyAppIdAndFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 2;
|
|
686
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
687
|
+
const requestPayload = hasOnlyAppIdAndFlowType || hasOnlyFlowId ? {
|
|
688
|
+
...cleanPayload,
|
|
689
|
+
verbose: true
|
|
690
|
+
} : cleanPayload;
|
|
691
|
+
const response = await fetch(endpoint, {
|
|
692
|
+
...requestConfig,
|
|
693
|
+
body: JSON.stringify(requestPayload),
|
|
694
|
+
headers: {
|
|
695
|
+
Accept: "application/json",
|
|
696
|
+
"Content-Type": "application/json",
|
|
697
|
+
...requestConfig.headers
|
|
698
|
+
},
|
|
699
|
+
method: requestConfig.method || "POST"
|
|
700
|
+
});
|
|
701
|
+
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedRecoveryFlow-ResponseError-001", "javascript", response.status, response.statusText, "Recovery request failed");
|
|
702
|
+
return await response.json();
|
|
703
|
+
};
|
|
704
|
+
var executeEmbeddedRecoveryFlow_default = executeEmbeddedRecoveryFlow;
|
|
705
|
+
|
|
706
|
+
//#endregion
|
|
707
|
+
//#region src/models/embedded-flow.ts
|
|
708
|
+
/**
|
|
709
|
+
* Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com).
|
|
576
710
|
*
|
|
577
711
|
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
578
712
|
* Version 2.0 (the "License"); you may not use this file except
|
|
@@ -588,1510 +722,371 @@ var getUserInfo_default = getUserInfo;
|
|
|
588
722
|
* specific language governing permissions and limitations
|
|
589
723
|
* under the License.
|
|
590
724
|
*/
|
|
725
|
+
let EmbeddedFlowType = /* @__PURE__ */ function(EmbeddedFlowType$1) {
|
|
726
|
+
EmbeddedFlowType$1["Authentication"] = "AUTHENTICATION";
|
|
727
|
+
EmbeddedFlowType$1["Recovery"] = "RECOVERY";
|
|
728
|
+
EmbeddedFlowType$1["Registration"] = "REGISTRATION";
|
|
729
|
+
EmbeddedFlowType$1["UserOnboarding"] = "USER_ONBOARDING";
|
|
730
|
+
return EmbeddedFlowType$1;
|
|
731
|
+
}({});
|
|
732
|
+
let EmbeddedFlowResponseType = /* @__PURE__ */ function(EmbeddedFlowResponseType$1) {
|
|
733
|
+
EmbeddedFlowResponseType$1["Redirection"] = "REDIRECTION";
|
|
734
|
+
EmbeddedFlowResponseType$1["View"] = "VIEW";
|
|
735
|
+
return EmbeddedFlowResponseType$1;
|
|
736
|
+
}({});
|
|
591
737
|
/**
|
|
592
|
-
*
|
|
593
|
-
* Matches patterns like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
594
|
-
* The pattern matches any uppercase letters, numbers, and underscores followed by a forward slash.
|
|
595
|
-
*/
|
|
596
|
-
const USERSTORE_PREFIX_REGEX = /^[A-Z_][A-Z0-9_]*\//;
|
|
597
|
-
/**
|
|
598
|
-
* Removes userstore prefixes from a username if they exist.
|
|
599
|
-
* This is commonly used to clean usernames returned from SCIM2 endpoints
|
|
600
|
-
* that include userstore prefixes like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
738
|
+
* Component types supported by the ThunderID embedded flow API.
|
|
601
739
|
*
|
|
602
|
-
*
|
|
603
|
-
*
|
|
740
|
+
* These types define the different UI components that can be rendered
|
|
741
|
+
* as part of the embedded authentication flows. Each type corresponds
|
|
742
|
+
* to a specific UI element with its own behavior and properties.
|
|
604
743
|
*
|
|
605
744
|
* @example
|
|
606
745
|
* ```typescript
|
|
607
|
-
*
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
*
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
* const primaryUser = removeUserstorePrefix("PRIMARY/admin");
|
|
614
|
-
* console.log(primaryUser); // "admin"
|
|
615
|
-
*
|
|
616
|
-
* const alreadyClean = removeUserstorePrefix("user.name");
|
|
617
|
-
* console.log(alreadyClean); // "user.name"
|
|
618
|
-
*
|
|
619
|
-
* const emptyInput = removeUserstorePrefix("");
|
|
620
|
-
* console.log(emptyInput); // ""
|
|
746
|
+
* // Check component type to render appropriate UI
|
|
747
|
+
* if (component.type === EmbeddedFlowComponentType.TextInput) {
|
|
748
|
+
* // Render text input field
|
|
749
|
+
* } else if (component.type === EmbeddedFlowComponentType.Action) {
|
|
750
|
+
* // Render button/action
|
|
751
|
+
* }
|
|
621
752
|
* ```
|
|
753
|
+
*
|
|
754
|
+
* @experimental This API may change in future versions
|
|
622
755
|
*/
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
756
|
+
let EmbeddedFlowComponentType = /* @__PURE__ */ function(EmbeddedFlowComponentType$1) {
|
|
757
|
+
/** Interactive action component (buttons, links) for user interactions */
|
|
758
|
+
EmbeddedFlowComponentType$1["Action"] = "ACTION";
|
|
759
|
+
/** Container block component that groups other components */
|
|
760
|
+
EmbeddedFlowComponentType$1["Block"] = "BLOCK";
|
|
761
|
+
/** Consent component for displaying consent purposes and attributes */
|
|
762
|
+
EmbeddedFlowComponentType$1["Consent"] = "CONSENT";
|
|
763
|
+
/** Copyable text display component that shows text with a copy-to-clipboard action */
|
|
764
|
+
EmbeddedFlowComponentType$1["CopyableText"] = "COPYABLE_TEXT";
|
|
765
|
+
/** Date input field for selecting a calendar date */
|
|
766
|
+
EmbeddedFlowComponentType$1["DateInput"] = "DATE_INPUT";
|
|
767
|
+
/** Divider component for visual separation of content */
|
|
768
|
+
EmbeddedFlowComponentType$1["Divider"] = "DIVIDER";
|
|
769
|
+
/** Email input field with validation for email addresses. */
|
|
770
|
+
EmbeddedFlowComponentType$1["EmailInput"] = "EMAIL_INPUT";
|
|
771
|
+
/** Icon display component for rendering named vector icons */
|
|
772
|
+
EmbeddedFlowComponentType$1["Icon"] = "ICON";
|
|
773
|
+
/** Image display component for logos and illustrations */
|
|
774
|
+
EmbeddedFlowComponentType$1["Image"] = "IMAGE";
|
|
775
|
+
/** One-time password input field for multi-factor authentication */
|
|
776
|
+
EmbeddedFlowComponentType$1["OtpInput"] = "OTP_INPUT";
|
|
777
|
+
/** Organization unit tree picker for selecting an OU */
|
|
778
|
+
EmbeddedFlowComponentType$1["OuSelect"] = "OU_SELECT";
|
|
779
|
+
/** Password input field with masking for sensitive data */
|
|
780
|
+
EmbeddedFlowComponentType$1["PasswordInput"] = "PASSWORD_INPUT";
|
|
781
|
+
/** Phone number input field with country code support */
|
|
782
|
+
EmbeddedFlowComponentType$1["PhoneInput"] = "PHONE_INPUT";
|
|
783
|
+
/** Rich text display component that renders formatted HTML content */
|
|
784
|
+
EmbeddedFlowComponentType$1["RichText"] = "RICH_TEXT";
|
|
785
|
+
/** Select/dropdown input component for single choice selection */
|
|
786
|
+
EmbeddedFlowComponentType$1["Select"] = "SELECT";
|
|
787
|
+
/** Stack layout component for arranging children in a row or column */
|
|
788
|
+
EmbeddedFlowComponentType$1["Stack"] = "STACK";
|
|
789
|
+
/** Text display component for labels, headings, and messages */
|
|
790
|
+
EmbeddedFlowComponentType$1["Text"] = "TEXT";
|
|
791
|
+
/** Standard text input field for user data entry */
|
|
792
|
+
EmbeddedFlowComponentType$1["TextInput"] = "TEXT_INPUT";
|
|
793
|
+
/** Timer component for displaying a countdown */
|
|
794
|
+
EmbeddedFlowComponentType$1["Timer"] = "TIMER";
|
|
795
|
+
/** QR code display component for wallet-based flows (e.g. OpenID4VP) */
|
|
796
|
+
EmbeddedFlowComponentType$1["QrCode"] = "QR_CODE";
|
|
797
|
+
return EmbeddedFlowComponentType$1;
|
|
798
|
+
}({});
|
|
627
799
|
/**
|
|
628
|
-
*
|
|
629
|
-
* This is a helper function for processing user objects returned from SCIM2 endpoints.
|
|
630
|
-
* Handles various username field variations: username, userName, and user_name.
|
|
631
|
-
*
|
|
632
|
-
* @param user - The user object to process
|
|
633
|
-
* @returns The user object with processed username fields
|
|
800
|
+
* Action variant types for buttons and interactive elements.
|
|
634
801
|
*
|
|
635
|
-
* @
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
802
|
+
* @experimental This API may change in future versions
|
|
803
|
+
*/
|
|
804
|
+
let EmbeddedFlowActionVariant = /* @__PURE__ */ function(EmbeddedFlowActionVariant$1) {
|
|
805
|
+
/** Danger action button for destructive operations */
|
|
806
|
+
EmbeddedFlowActionVariant$1["Danger"] = "DANGER";
|
|
807
|
+
/** Info action button for informational purposes */
|
|
808
|
+
EmbeddedFlowActionVariant$1["Info"] = "INFO";
|
|
809
|
+
/** Link-styled action button */
|
|
810
|
+
EmbeddedFlowActionVariant$1["Link"] = "LINK";
|
|
811
|
+
/** Outlined action button for secondary emphasis */
|
|
812
|
+
EmbeddedFlowActionVariant$1["Outlined"] = "OUTLINED";
|
|
813
|
+
/** Primary action button with highest visual emphasis */
|
|
814
|
+
EmbeddedFlowActionVariant$1["Primary"] = "PRIMARY";
|
|
815
|
+
/** Secondary action button with moderate visual emphasis */
|
|
816
|
+
EmbeddedFlowActionVariant$1["Secondary"] = "SECONDARY";
|
|
817
|
+
/** Success action button for positive confirmations */
|
|
818
|
+
EmbeddedFlowActionVariant$1["Success"] = "SUCCESS";
|
|
819
|
+
/** Tertiary action button with minimal visual emphasis */
|
|
820
|
+
EmbeddedFlowActionVariant$1["Tertiary"] = "TERTIARY";
|
|
821
|
+
/** Warning action button for cautionary actions */
|
|
822
|
+
EmbeddedFlowActionVariant$1["Warning"] = "WARNING";
|
|
823
|
+
return EmbeddedFlowActionVariant$1;
|
|
824
|
+
}({});
|
|
825
|
+
/**
|
|
826
|
+
* Text variant types for typography components.
|
|
640
827
|
*
|
|
641
|
-
*
|
|
642
|
-
|
|
643
|
-
|
|
828
|
+
* @experimental This API may change in future versions
|
|
829
|
+
*/
|
|
830
|
+
let EmbeddedFlowTextVariant = /* @__PURE__ */ function(EmbeddedFlowTextVariant$1) {
|
|
831
|
+
/** Primary body text for main content */
|
|
832
|
+
EmbeddedFlowTextVariant$1["Body1"] = "BODY_1";
|
|
833
|
+
/** Secondary body text for supplementary content */
|
|
834
|
+
EmbeddedFlowTextVariant$1["Body2"] = "BODY_2";
|
|
835
|
+
/** Text styled for button labels */
|
|
836
|
+
EmbeddedFlowTextVariant$1["ButtonText"] = "BUTTON_TEXT";
|
|
837
|
+
/** Small caption text for annotations and descriptions */
|
|
838
|
+
EmbeddedFlowTextVariant$1["Caption"] = "CAPTION";
|
|
839
|
+
/** Largest heading level for main titles */
|
|
840
|
+
EmbeddedFlowTextVariant$1["Heading1"] = "HEADING_1";
|
|
841
|
+
/** Second level heading for major sections */
|
|
842
|
+
EmbeddedFlowTextVariant$1["Heading2"] = "HEADING_2";
|
|
843
|
+
/** Third level heading for subsections */
|
|
844
|
+
EmbeddedFlowTextVariant$1["Heading3"] = "HEADING_3";
|
|
845
|
+
/** Fourth level heading for minor sections */
|
|
846
|
+
EmbeddedFlowTextVariant$1["Heading4"] = "HEADING_4";
|
|
847
|
+
/** Fifth level heading for detailed sections */
|
|
848
|
+
EmbeddedFlowTextVariant$1["Heading5"] = "HEADING_5";
|
|
849
|
+
/** Smallest heading level for fine-grained sections */
|
|
850
|
+
EmbeddedFlowTextVariant$1["Heading6"] = "HEADING_6";
|
|
851
|
+
/** Overline text for labels and categories */
|
|
852
|
+
EmbeddedFlowTextVariant$1["Overline"] = "OVERLINE";
|
|
853
|
+
/** Primary subtitle text with larger emphasis */
|
|
854
|
+
EmbeddedFlowTextVariant$1["Subtitle1"] = "SUBTITLE_1";
|
|
855
|
+
/** Secondary subtitle text with moderate emphasis */
|
|
856
|
+
EmbeddedFlowTextVariant$1["Subtitle2"] = "SUBTITLE_2";
|
|
857
|
+
return EmbeddedFlowTextVariant$1;
|
|
858
|
+
}({});
|
|
859
|
+
/**
|
|
860
|
+
* Event types for action components.
|
|
644
861
|
*
|
|
645
|
-
*
|
|
646
|
-
* const processedSnakeCaseUser = processUserUsername(snakeCaseUser);
|
|
647
|
-
* console.log(processedSnakeCaseUser.user_name); // "admin"
|
|
648
|
-
* ```
|
|
862
|
+
* @experimental This API may change in future versions
|
|
649
863
|
*/
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
864
|
+
let EmbeddedFlowEventType = /* @__PURE__ */ function(EmbeddedFlowEventType$1) {
|
|
865
|
+
/** Navigate back to the previous step */
|
|
866
|
+
EmbeddedFlowEventType$1["Back"] = "BACK";
|
|
867
|
+
/** Cancel the current operation */
|
|
868
|
+
EmbeddedFlowEventType$1["Cancel"] = "CANCEL";
|
|
869
|
+
/** Navigate to a different flow step or page */
|
|
870
|
+
EmbeddedFlowEventType$1["Navigate"] = "NAVIGATE";
|
|
871
|
+
/** Reset form fields to initial state */
|
|
872
|
+
EmbeddedFlowEventType$1["Reset"] = "RESET";
|
|
873
|
+
/** Submit form data to the server */
|
|
874
|
+
EmbeddedFlowEventType$1["Submit"] = "SUBMIT";
|
|
875
|
+
/** Trigger an action or event */
|
|
876
|
+
EmbeddedFlowEventType$1["Trigger"] = "TRIGGER";
|
|
877
|
+
return EmbeddedFlowEventType$1;
|
|
878
|
+
}({});
|
|
659
879
|
|
|
660
880
|
//#endregion
|
|
661
|
-
//#region src/api/
|
|
881
|
+
//#region src/api/executeEmbeddedUserOnboardingFlow.ts
|
|
662
882
|
/**
|
|
663
|
-
*
|
|
883
|
+
* Executes an embedded user onboarding flow by sending a request to the flow execution endpoint.
|
|
884
|
+
*
|
|
885
|
+
* This function handles both:
|
|
886
|
+
* - Admin flow: Initiates onboarding, collects user details, generates invite link
|
|
887
|
+
* - End-user flow: Validates invite token and allows password setting
|
|
888
|
+
*
|
|
889
|
+
* @param requestConfig - Request configuration object containing URL, payload, and optional auth token.
|
|
890
|
+
* @returns A promise that resolves with the flow execution response.
|
|
891
|
+
* @throws ThunderIDAPIError when the request fails or URL is invalid.
|
|
664
892
|
*
|
|
665
|
-
* @param config - Request configuration object.
|
|
666
|
-
* @returns A promise that resolves with the user profile information.
|
|
667
893
|
* @example
|
|
668
894
|
* ```typescript
|
|
669
|
-
* //
|
|
670
|
-
*
|
|
671
|
-
*
|
|
672
|
-
*
|
|
673
|
-
*
|
|
674
|
-
*
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
-
* console.error('Failed to get user profile:', error.message);
|
|
895
|
+
* // Admin initiating user onboarding (requires auth token)
|
|
896
|
+
* const response = await executeEmbeddedUserOnboardingFlow({
|
|
897
|
+
* baseUrl: "https://api.thunder.io",
|
|
898
|
+
* payload: {
|
|
899
|
+
* flowType: "USER_ONBOARDING"
|
|
900
|
+
* },
|
|
901
|
+
* headers: {
|
|
902
|
+
* Authorization: `Bearer ${accessToken}`
|
|
678
903
|
* }
|
|
679
|
-
* }
|
|
904
|
+
* });
|
|
905
|
+
*
|
|
906
|
+
* // End-user accepting invite (no auth required)
|
|
907
|
+
* const response = await executeEmbeddedUserOnboardingFlow({
|
|
908
|
+
* baseUrl: "https://api.thunder.io",
|
|
909
|
+
* payload: {
|
|
910
|
+
* executionId: "flow-id-from-url",
|
|
911
|
+
* inputs: { inviteToken: "token-from-url" }
|
|
912
|
+
* }
|
|
913
|
+
* });
|
|
680
914
|
* ```
|
|
915
|
+
*/
|
|
916
|
+
const executeEmbeddedUserOnboardingFlow = async ({ url, baseUrl, payload,...requestConfig }) => {
|
|
917
|
+
if (!payload) throw new ThunderIDAPIError("User onboarding payload is required", "executeEmbeddedUserOnboardingFlow-ValidationError-002", "javascript", 400, "If a user onboarding payload is not provided, the request cannot be constructed correctly.");
|
|
918
|
+
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
919
|
+
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
920
|
+
const hasOnlyFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
921
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
922
|
+
const hasFlowIdWithInputs = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && "inputs" in cleanPayload;
|
|
923
|
+
const requestPayload = hasOnlyFlowType || hasOnlyFlowId || hasFlowIdWithInputs ? {
|
|
924
|
+
...cleanPayload,
|
|
925
|
+
verbose: true
|
|
926
|
+
} : cleanPayload;
|
|
927
|
+
if ("flowType" in requestPayload && requestPayload["flowType"] !== EmbeddedFlowType.UserOnboarding) requestPayload["flowType"] = EmbeddedFlowType.UserOnboarding;
|
|
928
|
+
const response = await fetch(endpoint, {
|
|
929
|
+
...requestConfig,
|
|
930
|
+
body: JSON.stringify(requestPayload),
|
|
931
|
+
headers: {
|
|
932
|
+
Accept: "application/json",
|
|
933
|
+
"Content-Type": "application/json",
|
|
934
|
+
...requestConfig.headers
|
|
935
|
+
},
|
|
936
|
+
method: requestConfig.method || "POST"
|
|
937
|
+
});
|
|
938
|
+
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedUserOnboardingFlow-ResponseError-001", "javascript", response.status, response.statusText, "User onboarding request failed");
|
|
939
|
+
return await response.json();
|
|
940
|
+
};
|
|
941
|
+
var executeEmbeddedUserOnboardingFlow_default = executeEmbeddedUserOnboardingFlow;
|
|
942
|
+
|
|
943
|
+
//#endregion
|
|
944
|
+
//#region src/api/getFlowMeta.ts
|
|
945
|
+
/**
|
|
946
|
+
* Fetches aggregated flow metadata from the `GET /flow/meta` endpoint.
|
|
947
|
+
*
|
|
948
|
+
* The response includes:
|
|
949
|
+
* - Application or OU details depending on the `type` parameter
|
|
950
|
+
* - Resolved design configuration (theme and layout)
|
|
951
|
+
* - i18n translations filtered by `language` and `namespace`
|
|
952
|
+
* - Registration flow enablement status
|
|
953
|
+
*
|
|
954
|
+
* @param config - Request configuration including `baseUrl`/`url`, and optional
|
|
955
|
+
* `type`, `id`, `language`, and `namespace` filters. When `type`
|
|
956
|
+
* and `id` are omitted the server returns i18n-only metadata.
|
|
957
|
+
* @returns A promise that resolves to the {@link FlowMetadataResponse}.
|
|
958
|
+
*
|
|
959
|
+
* @throws {ThunderIDAPIError} When the server returns a non-OK response.
|
|
681
960
|
*
|
|
682
961
|
* @example
|
|
683
962
|
* ```typescript
|
|
684
|
-
*
|
|
685
|
-
*
|
|
686
|
-
*
|
|
687
|
-
*
|
|
688
|
-
*
|
|
689
|
-
*
|
|
690
|
-
*
|
|
691
|
-
*
|
|
692
|
-
*
|
|
693
|
-
*
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
698
|
-
* status: response.status,
|
|
699
|
-
* statusText: response.statusText,
|
|
700
|
-
* json: () => Promise.resolve(response.data),
|
|
701
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
702
|
-
* } as Response;
|
|
703
|
-
* }
|
|
704
|
-
* });
|
|
705
|
-
* console.log(userProfile);
|
|
706
|
-
* } catch (error) {
|
|
707
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
708
|
-
* console.error('Failed to get user profile:', error.message);
|
|
709
|
-
* }
|
|
710
|
-
* }
|
|
963
|
+
* import getFlowMeta from './api/getFlowMeta';
|
|
964
|
+
* import { FlowMetaType } from './models/flow-meta';
|
|
965
|
+
*
|
|
966
|
+
* const meta = await getFlowMeta({
|
|
967
|
+
* baseUrl: 'https://localhost:8090',
|
|
968
|
+
* type: FlowMetaType.App,
|
|
969
|
+
* id: '60a9b38b-6eba-9f9e-55f9-267067de4680',
|
|
970
|
+
* language: 'en',
|
|
971
|
+
* namespace: 'auth',
|
|
972
|
+
* });
|
|
973
|
+
*
|
|
974
|
+
* console.log(meta.application?.name);
|
|
975
|
+
* console.log(meta.i18n.translations);
|
|
711
976
|
* ```
|
|
977
|
+
*
|
|
978
|
+
* @experimental This function targets the ThunderID V2 platform API
|
|
712
979
|
*/
|
|
713
|
-
const
|
|
980
|
+
const getFlowMeta = async ({ url, baseUrl, type, id, language, namespace,...requestConfig }) => {
|
|
981
|
+
const queryParams = new URLSearchParams({
|
|
982
|
+
...id ? { id } : {},
|
|
983
|
+
...type ? { type } : {},
|
|
984
|
+
...language ? { language } : {},
|
|
985
|
+
...namespace ? { namespace } : {}
|
|
986
|
+
});
|
|
987
|
+
const endpoint = `${url ?? `${baseUrl}/flow/meta`}?${queryParams.toString()}`;
|
|
988
|
+
const response = await fetch(endpoint, {
|
|
989
|
+
...requestConfig,
|
|
990
|
+
headers: {
|
|
991
|
+
Accept: "application/json",
|
|
992
|
+
...requestConfig.headers
|
|
993
|
+
},
|
|
994
|
+
method: "GET"
|
|
995
|
+
});
|
|
996
|
+
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "getFlowMeta-ResponseError-001", "javascript", response.status, response.statusText, "Flow metadata request failed");
|
|
997
|
+
return await response.json();
|
|
998
|
+
};
|
|
999
|
+
var getFlowMeta_default = getFlowMeta;
|
|
1000
|
+
|
|
1001
|
+
//#endregion
|
|
1002
|
+
//#region src/api/getOrganizationUnitChildren.ts
|
|
1003
|
+
/**
|
|
1004
|
+
* Retrieves the child organization units of a given organization unit.
|
|
1005
|
+
*
|
|
1006
|
+
* @param config - Request configuration object.
|
|
1007
|
+
* @returns A promise that resolves with the list of child organization units.
|
|
1008
|
+
*/
|
|
1009
|
+
const getOrganizationUnitChildren = async ({ url, baseUrl, organizationUnitId, limit, offset, fetcher,...requestConfig }) => {
|
|
714
1010
|
try {
|
|
715
1011
|
new URL(url ?? baseUrl);
|
|
716
1012
|
} catch (error$1) {
|
|
717
|
-
throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "
|
|
1013
|
+
throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "getOrganizationUnitChildren-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
|
|
718
1014
|
}
|
|
719
1015
|
const fetchFn = fetcher || fetch;
|
|
720
|
-
const
|
|
1016
|
+
const queryParams = new URLSearchParams();
|
|
1017
|
+
if (limit !== void 0) queryParams.set("limit", String(limit));
|
|
1018
|
+
if (offset !== void 0) queryParams.set("offset", String(offset));
|
|
1019
|
+
const query = queryParams.toString();
|
|
1020
|
+
const resolvedBase = url ?? `${baseUrl}/api/server/v1/organization-units/${organizationUnitId}/children`;
|
|
1021
|
+
const resolvedUrl = query ? `${resolvedBase}?${query}` : resolvedBase;
|
|
721
1022
|
const requestInit = {
|
|
722
1023
|
...requestConfig,
|
|
723
1024
|
headers: {
|
|
724
1025
|
Accept: "application/json",
|
|
725
|
-
"Content-Type": "application/
|
|
1026
|
+
"Content-Type": "application/json",
|
|
726
1027
|
...requestConfig.headers
|
|
727
1028
|
},
|
|
728
1029
|
method: "GET"
|
|
729
1030
|
};
|
|
730
1031
|
try {
|
|
731
1032
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
732
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "
|
|
733
|
-
return
|
|
1033
|
+
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getOrganizationUnitChildren-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch organization unit children");
|
|
1034
|
+
return await response.json();
|
|
734
1035
|
} catch (error$1) {
|
|
735
1036
|
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
736
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "
|
|
1037
|
+
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getOrganizationUnitChildren-NetworkError-001", "javascript", 0, "Network Error");
|
|
737
1038
|
}
|
|
738
1039
|
};
|
|
739
|
-
var
|
|
1040
|
+
var getOrganizationUnitChildren_default = getOrganizationUnitChildren;
|
|
740
1041
|
|
|
741
1042
|
//#endregion
|
|
742
|
-
//#region src/api/
|
|
1043
|
+
//#region src/api/getUserInfo.ts
|
|
743
1044
|
/**
|
|
744
|
-
* Retrieves the
|
|
1045
|
+
* Retrieves the user information from the specified OIDC userinfo endpoint.
|
|
745
1046
|
*
|
|
746
|
-
* @param
|
|
747
|
-
* @returns A promise that resolves with the
|
|
748
|
-
* @
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
* try {
|
|
752
|
-
* const schemas = await getSchemas({
|
|
753
|
-
* url: "https://localhost:8090/scim2/Schemas",
|
|
754
|
-
* });
|
|
755
|
-
* console.log(schemas);
|
|
756
|
-
* } catch (error) {
|
|
757
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
758
|
-
* console.error('Failed to get schemas:', error.message);
|
|
759
|
-
* }
|
|
760
|
-
* }
|
|
761
|
-
* ```
|
|
762
|
-
*
|
|
763
|
-
* @example
|
|
764
|
-
* ```typescript
|
|
765
|
-
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
766
|
-
* try {
|
|
767
|
-
* const schemas = await getSchemas({
|
|
768
|
-
* url: "https://localhost:8090/scim2/Schemas",
|
|
769
|
-
* fetcher: async (url, config) => {
|
|
770
|
-
* const response = await httpClient({
|
|
771
|
-
* url,
|
|
772
|
-
* method: config.method,
|
|
773
|
-
* headers: config.headers,
|
|
774
|
-
* ...config
|
|
775
|
-
* });
|
|
776
|
-
* // Convert axios-like response to fetch-like Response
|
|
777
|
-
* return {
|
|
778
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
779
|
-
* status: response.status,
|
|
780
|
-
* statusText: response.statusText,
|
|
781
|
-
* json: () => Promise.resolve(response.data),
|
|
782
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
783
|
-
* } as Response;
|
|
784
|
-
* }
|
|
785
|
-
* });
|
|
786
|
-
* console.log(schemas);
|
|
787
|
-
* } catch (error) {
|
|
788
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
789
|
-
* console.error('Failed to get schemas:', error.message);
|
|
790
|
-
* }
|
|
791
|
-
* }
|
|
792
|
-
* ```
|
|
793
|
-
*/
|
|
794
|
-
const getSchemas = async ({ url, baseUrl, fetcher,...requestConfig }) => {
|
|
795
|
-
try {
|
|
796
|
-
new URL(url ?? baseUrl);
|
|
797
|
-
} catch (error$1) {
|
|
798
|
-
throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "getSchemas-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
|
|
799
|
-
}
|
|
800
|
-
const fetchFn = fetcher || fetch;
|
|
801
|
-
const resolvedUrl = url ?? `${baseUrl}/scim2/Schemas`;
|
|
802
|
-
const requestInit = {
|
|
803
|
-
...requestConfig,
|
|
804
|
-
headers: {
|
|
805
|
-
Accept: "application/json",
|
|
806
|
-
"Content-Type": "application/json",
|
|
807
|
-
...requestConfig.headers
|
|
808
|
-
},
|
|
809
|
-
method: "GET"
|
|
810
|
-
};
|
|
811
|
-
try {
|
|
812
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
813
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getSchemas-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch SCIM2 schemas");
|
|
814
|
-
return await response.json();
|
|
815
|
-
} catch (error$1) {
|
|
816
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
817
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getSchemas-NetworkError-001", "javascript", 0, "Network Error");
|
|
818
|
-
}
|
|
819
|
-
};
|
|
820
|
-
var getSchemas_default = getSchemas;
|
|
821
|
-
|
|
822
|
-
//#endregion
|
|
823
|
-
//#region src/api/getAllOrganizations.ts
|
|
824
|
-
/**
|
|
825
|
-
* Retrieves all organizations with pagination support.
|
|
826
|
-
*
|
|
827
|
-
* @param config - Configuration object containing baseUrl, optional query parameters, and request config.
|
|
828
|
-
* @returns A promise that resolves with the paginated organizations information.
|
|
829
|
-
* @example
|
|
830
|
-
* ```typescript
|
|
831
|
-
* // Using default fetch
|
|
832
|
-
* try {
|
|
833
|
-
* const response = await getAllOrganizations({
|
|
834
|
-
* baseUrl: "https://localhost:8090",
|
|
835
|
-
* filter: "",
|
|
836
|
-
* limit: 10,
|
|
837
|
-
* recursive: false
|
|
838
|
-
* });
|
|
839
|
-
* console.log(response.organizations);
|
|
840
|
-
* } catch (error) {
|
|
841
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
842
|
-
* console.error('Failed to get organizations:', error.message);
|
|
843
|
-
* }
|
|
844
|
-
* }
|
|
845
|
-
* ```
|
|
846
|
-
*
|
|
847
|
-
* @example
|
|
848
|
-
* ```typescript
|
|
849
|
-
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
850
|
-
* try {
|
|
851
|
-
* const response = await getAllOrganizations({
|
|
852
|
-
* baseUrl: "https://localhost:8090",
|
|
853
|
-
* filter: "",
|
|
854
|
-
* limit: 10,
|
|
855
|
-
* recursive: false,
|
|
856
|
-
* fetcher: async (url, config) => {
|
|
857
|
-
* const response = await httpClient({
|
|
858
|
-
* url,
|
|
859
|
-
* method: config.method,
|
|
860
|
-
* headers: config.headers,
|
|
861
|
-
* ...config
|
|
862
|
-
* });
|
|
863
|
-
* // Convert axios-like response to fetch-like Response
|
|
864
|
-
* return {
|
|
865
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
866
|
-
* status: response.status,
|
|
867
|
-
* statusText: response.statusText,
|
|
868
|
-
* json: () => Promise.resolve(response.data),
|
|
869
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
870
|
-
* } as Response;
|
|
871
|
-
* }
|
|
872
|
-
* });
|
|
873
|
-
* console.log(response.organizations);
|
|
874
|
-
* } catch (error) {
|
|
875
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
876
|
-
* console.error('Failed to get organizations:', error.message);
|
|
877
|
-
* }
|
|
878
|
-
* }
|
|
879
|
-
* ```
|
|
880
|
-
*/
|
|
881
|
-
const getAllOrganizations = async ({ baseUrl, filter = "", limit = 10, recursive = false, fetcher,...requestConfig }) => {
|
|
882
|
-
try {
|
|
883
|
-
new URL(baseUrl);
|
|
884
|
-
} catch (error$1) {
|
|
885
|
-
throw new ThunderIDAPIError(`Invalid base URL provided. ${error$1?.toString()}`, "getAllOrganizations-ValidationError-001", "javascript", 400, "The provided `baseUrl` does not adhere to the URL schema.");
|
|
886
|
-
}
|
|
887
|
-
const queryParams = new URLSearchParams(Object.fromEntries(Object.entries({
|
|
888
|
-
filter,
|
|
889
|
-
limit: limit.toString(),
|
|
890
|
-
recursive: recursive.toString()
|
|
891
|
-
}).filter(([, value]) => Boolean(value))));
|
|
892
|
-
const fetchFn = fetcher || fetch;
|
|
893
|
-
const resolvedUrl = `${baseUrl}/api/server/v1/organizations?${queryParams.toString()}`;
|
|
894
|
-
const requestInit = {
|
|
895
|
-
...requestConfig,
|
|
896
|
-
headers: {
|
|
897
|
-
...requestConfig.headers,
|
|
898
|
-
Accept: "application/json",
|
|
899
|
-
"Content-Type": "application/json"
|
|
900
|
-
},
|
|
901
|
-
method: "GET"
|
|
902
|
-
};
|
|
903
|
-
try {
|
|
904
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
905
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getAllOrganizations-ResponseError-001", "javascript", response.status, response.statusText, "Failed to get organizations");
|
|
906
|
-
const data = await response.json();
|
|
907
|
-
return {
|
|
908
|
-
hasMore: data.hasMore,
|
|
909
|
-
nextCursor: data.nextCursor,
|
|
910
|
-
organizations: data.organizations || [],
|
|
911
|
-
totalCount: data.totalCount
|
|
912
|
-
};
|
|
913
|
-
} catch (error$1) {
|
|
914
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
915
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getAllOrganizations-NetworkError-001", "javascript", 0, "Network Error");
|
|
916
|
-
}
|
|
917
|
-
};
|
|
918
|
-
var getAllOrganizations_default = getAllOrganizations;
|
|
919
|
-
|
|
920
|
-
//#endregion
|
|
921
|
-
//#region src/api/createOrganization.ts
|
|
922
|
-
/**
|
|
923
|
-
* Creates a new organization.
|
|
924
|
-
*
|
|
925
|
-
* @param config - Configuration object containing baseUrl, payload and optional request config.
|
|
926
|
-
* @returns A promise that resolves with the created organization information.
|
|
927
|
-
* @example
|
|
928
|
-
* ```typescript
|
|
929
|
-
* // Using default fetch
|
|
930
|
-
* try {
|
|
931
|
-
* const organization = await createOrganization({
|
|
932
|
-
* baseUrl: "https://localhost:8090",
|
|
933
|
-
* payload: {
|
|
934
|
-
* description: "Share your screens",
|
|
935
|
-
* name: "Team Viewer",
|
|
936
|
-
* orgHandle: "team-viewer",
|
|
937
|
-
* parentId: "f4825104-4948-40d9-ab65-a960eee3e3d5",
|
|
938
|
-
* type: "TENANT"
|
|
939
|
-
* }
|
|
940
|
-
* });
|
|
941
|
-
* console.log(organization);
|
|
942
|
-
* } catch (error) {
|
|
943
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
944
|
-
* console.error('Failed to create organization:', error.message);
|
|
945
|
-
* }
|
|
946
|
-
* }
|
|
947
|
-
* ```
|
|
948
|
-
*
|
|
949
|
-
* @example
|
|
950
|
-
* ```typescript
|
|
951
|
-
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
952
|
-
* try {
|
|
953
|
-
* const organization = await createOrganization({
|
|
954
|
-
* baseUrl: "https://localhost:8090",
|
|
955
|
-
* payload: {
|
|
956
|
-
* description: "Share your screens",
|
|
957
|
-
* name: "Team Viewer",
|
|
958
|
-
* orgHandle: "team-viewer",
|
|
959
|
-
* parentId: "f4825104-4948-40d9-ab65-a960eee3e3d5",
|
|
960
|
-
* type: "TENANT"
|
|
961
|
-
* },
|
|
962
|
-
* fetcher: async (url, config) => {
|
|
963
|
-
* const response = await httpClient({
|
|
964
|
-
* url,
|
|
965
|
-
* method: config.method,
|
|
966
|
-
* headers: config.headers,
|
|
967
|
-
* data: config.body,
|
|
968
|
-
* ...config
|
|
969
|
-
* });
|
|
970
|
-
* // Convert axios-like response to fetch-like Response
|
|
971
|
-
* return {
|
|
972
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
973
|
-
* status: response.status,
|
|
974
|
-
* statusText: response.statusText,
|
|
975
|
-
* json: () => Promise.resolve(response.data),
|
|
976
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
977
|
-
* } as Response;
|
|
978
|
-
* }
|
|
979
|
-
* });
|
|
980
|
-
* console.log(organization);
|
|
981
|
-
* } catch (error) {
|
|
982
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
983
|
-
* console.error('Failed to create organization:', error.message);
|
|
984
|
-
* }
|
|
985
|
-
* }
|
|
986
|
-
* ```
|
|
987
|
-
*/
|
|
988
|
-
const createOrganization = async ({ baseUrl, payload, fetcher,...requestConfig }) => {
|
|
989
|
-
try {
|
|
990
|
-
new URL(baseUrl);
|
|
991
|
-
} catch (error$1) {
|
|
992
|
-
throw new ThunderIDAPIError(`Invalid base URL provided. ${error$1?.toString()}`, "createOrganization-ValidationError-001", "javascript", 400, "The provided `baseUrl` does not adhere to the URL schema.");
|
|
993
|
-
}
|
|
994
|
-
if (!payload) throw new ThunderIDAPIError("Organization payload is required", "createOrganization-ValidationError-002", "javascript", 400, "Invalid Request");
|
|
995
|
-
const organizationPayload = {
|
|
996
|
-
...payload,
|
|
997
|
-
type: "TENANT"
|
|
998
|
-
};
|
|
999
|
-
const fetchFn = fetcher || fetch;
|
|
1000
|
-
const resolvedUrl = `${baseUrl}/api/server/v1/organizations`;
|
|
1001
|
-
const requestInit = {
|
|
1002
|
-
...requestConfig,
|
|
1003
|
-
body: JSON.stringify(organizationPayload),
|
|
1004
|
-
headers: {
|
|
1005
|
-
Accept: "application/json",
|
|
1006
|
-
"Content-Type": "application/json",
|
|
1007
|
-
...requestConfig.headers
|
|
1008
|
-
},
|
|
1009
|
-
method: "POST"
|
|
1010
|
-
};
|
|
1011
|
-
try {
|
|
1012
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1013
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "createOrganization-ResponseError-001", "javascript", response.status, response.statusText, "Failed to create organization");
|
|
1014
|
-
return await response.json();
|
|
1015
|
-
} catch (error$1) {
|
|
1016
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1017
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "createOrganization-NetworkError-001", "javascript", 0, "Network Error");
|
|
1018
|
-
}
|
|
1019
|
-
};
|
|
1020
|
-
var createOrganization_default = createOrganization;
|
|
1021
|
-
|
|
1022
|
-
//#endregion
|
|
1023
|
-
//#region src/api/getMeOrganizations.ts
|
|
1024
|
-
/**
|
|
1025
|
-
* Retrieves the organizations associated with the current user.
|
|
1026
|
-
*
|
|
1027
|
-
* @param config - Configuration object containing baseUrl, optional query parameters, and request config.
|
|
1028
|
-
* @returns A promise that resolves with the organizations information.
|
|
1029
|
-
* @example
|
|
1030
|
-
* ```typescript
|
|
1031
|
-
* // Using default fetch
|
|
1032
|
-
* try {
|
|
1033
|
-
* const organizations = await getMeOrganizations({
|
|
1034
|
-
* baseUrl: "https://localhost:8090",
|
|
1035
|
-
* after: "",
|
|
1036
|
-
* before: "",
|
|
1037
|
-
* filter: "",
|
|
1038
|
-
* limit: 10,
|
|
1039
|
-
* recursive: false
|
|
1040
|
-
* });
|
|
1041
|
-
* console.log(organizations);
|
|
1042
|
-
* } catch (error) {
|
|
1043
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1044
|
-
* console.error('Failed to get organizations:', error.message);
|
|
1045
|
-
* }
|
|
1046
|
-
* }
|
|
1047
|
-
* ```
|
|
1048
|
-
*
|
|
1049
|
-
* @example
|
|
1050
|
-
* ```typescript
|
|
1051
|
-
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1052
|
-
* try {
|
|
1053
|
-
* const organizations = await getMeOrganizations({
|
|
1054
|
-
* baseUrl: "https://localhost:8090",
|
|
1055
|
-
* after: "",
|
|
1056
|
-
* before: "",
|
|
1057
|
-
* filter: "",
|
|
1058
|
-
* limit: 10,
|
|
1059
|
-
* recursive: false,
|
|
1060
|
-
* fetcher: async (url, config) => {
|
|
1061
|
-
* const response = await httpClient({
|
|
1062
|
-
* url,
|
|
1063
|
-
* method: config.method,
|
|
1064
|
-
* headers: config.headers,
|
|
1065
|
-
* ...config
|
|
1066
|
-
* });
|
|
1067
|
-
* // Convert axios-like response to fetch-like Response
|
|
1068
|
-
* return {
|
|
1069
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
1070
|
-
* status: response.status,
|
|
1071
|
-
* statusText: response.statusText,
|
|
1072
|
-
* json: () => Promise.resolve(response.data),
|
|
1073
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1074
|
-
* } as Response;
|
|
1075
|
-
* }
|
|
1076
|
-
* });
|
|
1077
|
-
* console.log(organizations);
|
|
1078
|
-
* } catch (error) {
|
|
1079
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1080
|
-
* console.error('Failed to get organizations:', error.message);
|
|
1081
|
-
* }
|
|
1082
|
-
* }
|
|
1083
|
-
* ```
|
|
1084
|
-
*/
|
|
1085
|
-
const getMeOrganizations = async ({ baseUrl, after = "", authorizedAppName = "", before = "", filter = "", limit = 10, recursive = false, fetcher,...requestConfig }) => {
|
|
1086
|
-
try {
|
|
1087
|
-
new URL(baseUrl);
|
|
1088
|
-
} catch (error$1) {
|
|
1089
|
-
throw new ThunderIDAPIError(`Invalid base URL provided. ${error$1?.toString()}`, "getMeOrganizations-ValidationError-001", "javascript", 400, "The provided `baseUrl` does not adhere to the URL schema.");
|
|
1090
|
-
}
|
|
1091
|
-
const queryParams = new URLSearchParams(Object.fromEntries(Object.entries({
|
|
1092
|
-
after,
|
|
1093
|
-
authorizedAppName,
|
|
1094
|
-
before,
|
|
1095
|
-
filter,
|
|
1096
|
-
limit: limit.toString(),
|
|
1097
|
-
recursive: recursive.toString()
|
|
1098
|
-
}).filter(([, value]) => Boolean(value))));
|
|
1099
|
-
const fetchFn = fetcher || fetch;
|
|
1100
|
-
const resolvedUrl = `${baseUrl}/api/users/v1/me/organizations?${queryParams.toString()}`;
|
|
1101
|
-
const requestInit = {
|
|
1102
|
-
...requestConfig,
|
|
1103
|
-
headers: {
|
|
1104
|
-
Accept: "application/json",
|
|
1105
|
-
"Content-Type": "application/json",
|
|
1106
|
-
...requestConfig.headers
|
|
1107
|
-
},
|
|
1108
|
-
method: "GET"
|
|
1109
|
-
};
|
|
1110
|
-
try {
|
|
1111
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1112
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getMeOrganizations-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch associated organizations of the user");
|
|
1113
|
-
return (await response.json())["organizations"] || [];
|
|
1114
|
-
} catch (error$1) {
|
|
1115
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1116
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getMeOrganizations-NetworkError-001", "javascript", 0, "Network Error");
|
|
1117
|
-
}
|
|
1118
|
-
};
|
|
1119
|
-
var getMeOrganizations_default = getMeOrganizations;
|
|
1120
|
-
|
|
1121
|
-
//#endregion
|
|
1122
|
-
//#region src/api/getOrganization.ts
|
|
1123
|
-
/**
|
|
1124
|
-
* Retrieves detailed information for a specific organization.
|
|
1125
|
-
*
|
|
1126
|
-
* @param config - Configuration object containing baseUrl, organizationId, and request config.
|
|
1127
|
-
* @returns A promise that resolves with the organization details.
|
|
1128
|
-
* @example
|
|
1129
|
-
* ```typescript
|
|
1130
|
-
* // Using default fetch
|
|
1131
|
-
* try {
|
|
1132
|
-
* const organization = await getOrganization({
|
|
1133
|
-
* baseUrl: "https://localhost:8090",
|
|
1134
|
-
* organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
|
|
1135
|
-
* });
|
|
1136
|
-
* console.log(organization);
|
|
1137
|
-
* } catch (error) {
|
|
1138
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1139
|
-
* console.error('Failed to get organization:', error.message);
|
|
1140
|
-
* }
|
|
1141
|
-
* }
|
|
1142
|
-
* ```
|
|
1143
|
-
*
|
|
1144
|
-
* @example
|
|
1145
|
-
* ```typescript
|
|
1146
|
-
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1147
|
-
* try {
|
|
1148
|
-
* const organization = await getOrganization({
|
|
1149
|
-
* baseUrl: "https://localhost:8090",
|
|
1150
|
-
* organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
|
|
1151
|
-
* fetcher: async (url, config) => {
|
|
1152
|
-
* const response = await httpClient({
|
|
1153
|
-
* url,
|
|
1154
|
-
* method: config.method,
|
|
1155
|
-
* headers: config.headers,
|
|
1156
|
-
* ...config
|
|
1157
|
-
* });
|
|
1158
|
-
* // Convert axios-like response to fetch-like Response
|
|
1159
|
-
* return {
|
|
1160
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
1161
|
-
* status: response.status,
|
|
1162
|
-
* statusText: response.statusText,
|
|
1163
|
-
* json: () => Promise.resolve(response.data),
|
|
1164
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1165
|
-
* } as Response;
|
|
1166
|
-
* }
|
|
1167
|
-
* });
|
|
1168
|
-
* console.log(organization);
|
|
1169
|
-
* } catch (error) {
|
|
1170
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1171
|
-
* console.error('Failed to get organization:', error.message);
|
|
1172
|
-
* }
|
|
1173
|
-
* }
|
|
1174
|
-
* ```
|
|
1175
|
-
*/
|
|
1176
|
-
const getOrganization = async ({ baseUrl, organizationId, fetcher,...requestConfig }) => {
|
|
1177
|
-
try {
|
|
1178
|
-
new URL(baseUrl);
|
|
1179
|
-
} catch (error$1) {
|
|
1180
|
-
throw new ThunderIDAPIError(`Invalid base URL provided. ${error$1?.toString()}`, "getOrganization-ValidationError-001", "javascript", 400, "The provided `baseUrl` does not adhere to the URL schema.");
|
|
1181
|
-
}
|
|
1182
|
-
if (!organizationId) throw new ThunderIDAPIError("Organization ID is required", "getOrganization-ValidationError-002", "javascript", 400, "Invalid Request");
|
|
1183
|
-
const fetchFn = fetcher || fetch;
|
|
1184
|
-
const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;
|
|
1185
|
-
const requestInit = {
|
|
1186
|
-
...requestConfig,
|
|
1187
|
-
headers: {
|
|
1188
|
-
Accept: "application/json",
|
|
1189
|
-
"Content-Type": "application/json",
|
|
1190
|
-
...requestConfig.headers
|
|
1191
|
-
},
|
|
1192
|
-
method: "GET"
|
|
1193
|
-
};
|
|
1194
|
-
try {
|
|
1195
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1196
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getOrganization-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch organization details");
|
|
1197
|
-
return await response.json();
|
|
1198
|
-
} catch (error$1) {
|
|
1199
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1200
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getOrganization-NetworkError-001", "javascript", 0, "Network Error");
|
|
1201
|
-
}
|
|
1202
|
-
};
|
|
1203
|
-
var getOrganization_default = getOrganization;
|
|
1204
|
-
|
|
1205
|
-
//#endregion
|
|
1206
|
-
//#region src/utils/isEmpty.ts
|
|
1207
|
-
/**
|
|
1208
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
1209
|
-
*
|
|
1210
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
1211
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
1212
|
-
* in compliance with the License.
|
|
1213
|
-
* You may obtain a copy of the License at
|
|
1214
|
-
*
|
|
1215
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1216
|
-
*
|
|
1217
|
-
* Unless required by applicable law or agreed to in writing,
|
|
1218
|
-
* software distributed under the License is distributed on an
|
|
1219
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
1220
|
-
* KIND, either express or implied. See the License for the
|
|
1221
|
-
* specific language governing permissions and limitations
|
|
1222
|
-
* under the License.
|
|
1223
|
-
*/
|
|
1224
|
-
/**
|
|
1225
|
-
* Checks if a value is considered empty.
|
|
1226
|
-
*
|
|
1227
|
-
* A value is considered empty if it is:
|
|
1228
|
-
* - null
|
|
1229
|
-
* - undefined
|
|
1230
|
-
* - empty string ("")
|
|
1231
|
-
* - string containing only whitespace characters
|
|
1232
|
-
* - empty array ([])
|
|
1233
|
-
* - empty object ({})
|
|
1234
|
-
*
|
|
1235
|
-
* @param value - The value to check
|
|
1236
|
-
* @returns true if the value is empty, false otherwise
|
|
1237
|
-
*
|
|
1238
|
-
* @example
|
|
1239
|
-
* ```typescript
|
|
1240
|
-
* isEmpty(null); // true
|
|
1241
|
-
* isEmpty(undefined); // true
|
|
1242
|
-
* isEmpty(""); // true
|
|
1243
|
-
* isEmpty(" "); // true
|
|
1244
|
-
* isEmpty("hello"); // false
|
|
1245
|
-
* isEmpty([]); // true
|
|
1246
|
-
* isEmpty([1, 2, 3]); // false
|
|
1247
|
-
* isEmpty({}); // true
|
|
1248
|
-
* isEmpty({ name: "John" }); // false
|
|
1249
|
-
* isEmpty(0); // false
|
|
1250
|
-
* isEmpty(false); // false
|
|
1251
|
-
* ```
|
|
1252
|
-
*/
|
|
1253
|
-
const isEmpty = (value) => {
|
|
1254
|
-
if (value === null || value === void 0) return true;
|
|
1255
|
-
if (typeof value === "string") return value.trim() === "";
|
|
1256
|
-
if (Array.isArray(value)) return value.length === 0;
|
|
1257
|
-
if (typeof value === "object" && value.constructor === Object) return Object.keys(value).length === 0;
|
|
1258
|
-
return false;
|
|
1259
|
-
};
|
|
1260
|
-
var isEmpty_default = isEmpty;
|
|
1261
|
-
|
|
1262
|
-
//#endregion
|
|
1263
|
-
//#region src/api/updateOrganization.ts
|
|
1264
|
-
/**
|
|
1265
|
-
* Updates the organization information using the Organizations Management API.
|
|
1266
|
-
*
|
|
1267
|
-
* @param config - Configuration object with baseUrl, organizationId, operations and optional request config.
|
|
1268
|
-
* @returns A promise that resolves with the updated organization information.
|
|
1269
|
-
* @example
|
|
1270
|
-
* ```typescript
|
|
1271
|
-
* // Using the helper function to create operations automatically
|
|
1272
|
-
* const operations = createPatchOperations({
|
|
1273
|
-
* name: "Updated Organization Name", // Will use REPLACE
|
|
1274
|
-
* description: "", // Will use REMOVE (empty string)
|
|
1275
|
-
* customField: "Some value" // Will use REPLACE
|
|
1276
|
-
* });
|
|
1277
|
-
*
|
|
1278
|
-
* await updateOrganization({
|
|
1279
|
-
* baseUrl: "https://localhost:8090",
|
|
1280
|
-
* organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
|
|
1281
|
-
* operations
|
|
1282
|
-
* });
|
|
1283
|
-
*
|
|
1284
|
-
* // Or manually specify operations
|
|
1285
|
-
* await updateOrganization({
|
|
1286
|
-
* baseUrl: "https://localhost:8090",
|
|
1287
|
-
* organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
|
|
1288
|
-
* operations: [
|
|
1289
|
-
* { operation: "REPLACE", path: "/name", value: "Updated Organization Name" },
|
|
1290
|
-
* { operation: "REMOVE", path: "/description" }
|
|
1291
|
-
* ]
|
|
1292
|
-
* });
|
|
1293
|
-
* ```
|
|
1294
|
-
*
|
|
1295
|
-
* @example
|
|
1296
|
-
* ```typescript
|
|
1297
|
-
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1298
|
-
* await updateOrganization({
|
|
1299
|
-
* baseUrl: "https://localhost:8090",
|
|
1300
|
-
* organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
|
|
1301
|
-
* operations: [
|
|
1302
|
-
* { operation: "REPLACE", path: "/name", value: "Updated Organization Name" }
|
|
1303
|
-
* ],
|
|
1304
|
-
* fetcher: async (url, config) => {
|
|
1305
|
-
* const response = await httpClient({
|
|
1306
|
-
* url,
|
|
1307
|
-
* method: config.method,
|
|
1308
|
-
* headers: config.headers,
|
|
1309
|
-
* data: config.body,
|
|
1310
|
-
* ...config
|
|
1311
|
-
* });
|
|
1312
|
-
* // Convert axios-like response to fetch-like Response
|
|
1313
|
-
* return {
|
|
1314
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
1315
|
-
* status: response.status,
|
|
1316
|
-
* statusText: response.statusText,
|
|
1317
|
-
* json: () => Promise.resolve(response.data),
|
|
1318
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1319
|
-
* } as Response;
|
|
1320
|
-
* }
|
|
1321
|
-
* });
|
|
1322
|
-
* ```
|
|
1323
|
-
*/
|
|
1324
|
-
const updateOrganization = async ({ baseUrl, organizationId, operations, fetcher,...requestConfig }) => {
|
|
1325
|
-
try {
|
|
1326
|
-
new URL(baseUrl);
|
|
1327
|
-
} catch (error$1) {
|
|
1328
|
-
throw new ThunderIDAPIError(`Invalid base URL provided. ${error$1?.toString()}`, "updateOrganization-ValidationError-001", "javascript", 400, "The provided `baseUrl` does not adhere to the URL schema.");
|
|
1329
|
-
}
|
|
1330
|
-
if (!organizationId) throw new ThunderIDAPIError("Organization ID is required", "updateOrganization-ValidationError-002", "javascript", 400, "Invalid Request");
|
|
1331
|
-
if (!operations || !Array.isArray(operations) || operations.length === 0) throw new ThunderIDAPIError("Operations array is required and cannot be empty", "updateOrganization-ValidationError-003", "javascript", 400, "Invalid Request");
|
|
1332
|
-
const fetchFn = fetcher || fetch;
|
|
1333
|
-
const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;
|
|
1334
|
-
const requestInit = {
|
|
1335
|
-
...requestConfig,
|
|
1336
|
-
body: JSON.stringify(operations),
|
|
1337
|
-
headers: {
|
|
1338
|
-
Accept: "application/json",
|
|
1339
|
-
"Content-Type": "application/json",
|
|
1340
|
-
...requestConfig.headers
|
|
1341
|
-
},
|
|
1342
|
-
method: "PATCH"
|
|
1343
|
-
};
|
|
1344
|
-
try {
|
|
1345
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1346
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "updateOrganization-ResponseError-001", "javascript", response.status, response.statusText, "Failed to update organization");
|
|
1347
|
-
return await response.json();
|
|
1348
|
-
} catch (error$1) {
|
|
1349
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1350
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "updateOrganization-NetworkError-001", "javascript", 0, "Network Error");
|
|
1351
|
-
}
|
|
1352
|
-
};
|
|
1353
|
-
/**
|
|
1354
|
-
* Helper function to convert field updates to patch operations format.
|
|
1355
|
-
* Uses REMOVE operation when the value is empty, otherwise uses REPLACE.
|
|
1356
|
-
*
|
|
1357
|
-
* @param payload - Object containing field updates
|
|
1358
|
-
* @returns Array of patch operations
|
|
1359
|
-
*/
|
|
1360
|
-
const createPatchOperations = (payload) => Object.entries(payload).map(([key, value]) => {
|
|
1361
|
-
if (isEmpty_default(value)) return {
|
|
1362
|
-
operation: "REMOVE",
|
|
1363
|
-
path: `/${key}`
|
|
1364
|
-
};
|
|
1365
|
-
return {
|
|
1366
|
-
operation: "REPLACE",
|
|
1367
|
-
path: `/${key}`,
|
|
1368
|
-
value
|
|
1369
|
-
};
|
|
1370
|
-
});
|
|
1371
|
-
var updateOrganization_default = updateOrganization;
|
|
1372
|
-
|
|
1373
|
-
//#endregion
|
|
1374
|
-
//#region src/api/updateMeProfile.ts
|
|
1375
|
-
/**
|
|
1376
|
-
* Updates the user profile information at the specified SCIM2 Me endpoint.
|
|
1377
|
-
*
|
|
1378
|
-
* @param config - Configuration object with URL, payload and optional request config.
|
|
1379
|
-
* @returns A promise that resolves with the updated user profile information.
|
|
1380
|
-
* @example
|
|
1381
|
-
* ```typescript
|
|
1382
|
-
* // Using default fetch
|
|
1383
|
-
* await updateMeProfile({
|
|
1384
|
-
* url: "https://localhost:8090/scim2/Me",
|
|
1385
|
-
* payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } }
|
|
1386
|
-
* });
|
|
1387
|
-
* ```
|
|
1388
|
-
*
|
|
1389
|
-
* @example
|
|
1390
|
-
* ```typescript
|
|
1391
|
-
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1392
|
-
* await updateMeProfile({
|
|
1393
|
-
* url: "https://localhost:8090/scim2/Me",
|
|
1394
|
-
* payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } },
|
|
1395
|
-
* fetcher: async (url, config) => {
|
|
1396
|
-
* const response = await httpClient({
|
|
1397
|
-
* url,
|
|
1398
|
-
* method: config.method,
|
|
1399
|
-
* headers: config.headers,
|
|
1400
|
-
* data: config.body,
|
|
1401
|
-
* ...config
|
|
1402
|
-
* });
|
|
1403
|
-
* // Convert axios-like response to fetch-like Response
|
|
1404
|
-
* return {
|
|
1405
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
1406
|
-
* status: response.status,
|
|
1407
|
-
* statusText: response.statusText,
|
|
1408
|
-
* json: () => Promise.resolve(response.data),
|
|
1409
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1410
|
-
* } as Response;
|
|
1411
|
-
* }
|
|
1412
|
-
* });
|
|
1413
|
-
* ```
|
|
1414
|
-
*/
|
|
1415
|
-
const updateMeProfile = async ({ url, baseUrl, payload, fetcher,...requestConfig }) => {
|
|
1416
|
-
try {
|
|
1417
|
-
new URL(url ?? baseUrl);
|
|
1418
|
-
} catch (error$1) {
|
|
1419
|
-
throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "updateMeProfile-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
|
|
1420
|
-
}
|
|
1421
|
-
const data = {
|
|
1422
|
-
Operations: [{
|
|
1423
|
-
op: "replace",
|
|
1424
|
-
value: payload
|
|
1425
|
-
}],
|
|
1426
|
-
schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]
|
|
1427
|
-
};
|
|
1428
|
-
const fetchFn = fetcher || fetch;
|
|
1429
|
-
const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
|
|
1430
|
-
const requestInit = {
|
|
1431
|
-
method: "PATCH",
|
|
1432
|
-
...requestConfig,
|
|
1433
|
-
body: JSON.stringify(data),
|
|
1434
|
-
headers: {
|
|
1435
|
-
...requestConfig.headers,
|
|
1436
|
-
Accept: "application/json",
|
|
1437
|
-
"Content-Type": "application/scim+json"
|
|
1438
|
-
}
|
|
1439
|
-
};
|
|
1440
|
-
try {
|
|
1441
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1442
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "updateMeProfile-ResponseError-001", "javascript", response.status, response.statusText, "Failed to update user profile");
|
|
1443
|
-
return processUsername_default(await response.json());
|
|
1444
|
-
} catch (error$1) {
|
|
1445
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1446
|
-
throw new ThunderIDAPIError(error$1?.response?.data?.detail || "An error occurred while updating the user profile. Please try again.", "updateMeProfile-NetworkError-001", "javascript", error$1?.data?.status, "Network Error");
|
|
1447
|
-
}
|
|
1448
|
-
};
|
|
1449
|
-
var updateMeProfile_default = updateMeProfile;
|
|
1450
|
-
|
|
1451
|
-
//#endregion
|
|
1452
|
-
//#region src/models/platforms.ts
|
|
1453
|
-
/**
|
|
1454
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
1455
|
-
*
|
|
1456
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
1457
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
1458
|
-
* in compliance with the License.
|
|
1459
|
-
* You may obtain a copy of the License at
|
|
1460
|
-
*
|
|
1461
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1462
|
-
*
|
|
1463
|
-
* Unless required by applicable law or agreed to in writing,
|
|
1464
|
-
* software distributed under the License is distributed on an
|
|
1465
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
1466
|
-
* KIND, either express or implied. See the License for the
|
|
1467
|
-
* specific language governing permissions and limitations
|
|
1468
|
-
* under the License.
|
|
1469
|
-
*/
|
|
1470
|
-
/**
|
|
1471
|
-
* Enumeration of supported identity platforms.
|
|
1472
|
-
*
|
|
1473
|
-
* - `ThunderID`: Represents the ThunderID identity platform.
|
|
1474
|
-
* - `IdentityServer`: Represents WSO2 Identity Server (on-prem or custom domains).
|
|
1475
|
-
* - `Unknown`: Used when the platform cannot be determined from the configuration.
|
|
1476
|
-
*/
|
|
1477
|
-
let Platform = /* @__PURE__ */ function(Platform$1) {
|
|
1478
|
-
/** ThunderID identity platform */
|
|
1479
|
-
Platform$1["ThunderID"] = "THUNDERID";
|
|
1480
|
-
/** WSO2 Identity Server (on-prem or custom domains) */
|
|
1481
|
-
Platform$1["IdentityServer"] = "IDENTITY_SERVER";
|
|
1482
|
-
/** Unknown or unsupported platform */
|
|
1483
|
-
Platform$1["Unknown"] = "UNKNOWN";
|
|
1484
|
-
return Platform$1;
|
|
1485
|
-
}({});
|
|
1486
|
-
|
|
1487
|
-
//#endregion
|
|
1488
|
-
//#region src/utils/logger.ts
|
|
1489
|
-
const PREFIX = "⚡ ThunderID";
|
|
1490
|
-
/**
|
|
1491
|
-
* Default logger configuration
|
|
1492
|
-
*/
|
|
1493
|
-
const DEFAULT_CONFIG$1 = {
|
|
1494
|
-
level: "info",
|
|
1495
|
-
prefix: `${PREFIX}`,
|
|
1496
|
-
showLevel: true,
|
|
1497
|
-
timestamps: true
|
|
1498
|
-
};
|
|
1499
|
-
/**
|
|
1500
|
-
* Environment detection utilities
|
|
1501
|
-
*/
|
|
1502
|
-
const isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
1503
|
-
const isNode = () => typeof process !== "undefined" && void 0;
|
|
1504
|
-
/**
|
|
1505
|
-
* Color codes for terminal output (Node.js)
|
|
1506
|
-
*/
|
|
1507
|
-
const COLORS = {
|
|
1508
|
-
blue: "\x1B[34m",
|
|
1509
|
-
bright: "\x1B[1m",
|
|
1510
|
-
cyan: "\x1B[36m",
|
|
1511
|
-
dim: "\x1B[2m",
|
|
1512
|
-
gray: "\x1B[90m",
|
|
1513
|
-
green: "\x1B[32m",
|
|
1514
|
-
magenta: "\x1B[35m",
|
|
1515
|
-
red: "\x1B[31m",
|
|
1516
|
-
reset: "\x1B[0m",
|
|
1517
|
-
white: "\x1B[37m",
|
|
1518
|
-
yellow: "\x1B[33m"
|
|
1519
|
-
};
|
|
1520
|
-
/**
|
|
1521
|
-
* Browser console styling
|
|
1522
|
-
*/
|
|
1523
|
-
const BROWSER_STYLES = {
|
|
1524
|
-
debug: "color: #6b7280; font-weight: normal;",
|
|
1525
|
-
error: "color: #dc2626; font-weight: bold;",
|
|
1526
|
-
info: "color: #2563eb; font-weight: bold;",
|
|
1527
|
-
prefix: "color: #7c3aed; font-weight: bold;",
|
|
1528
|
-
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
1529
|
-
warn: "color: #d97706; font-weight: bold;"
|
|
1530
|
-
};
|
|
1531
|
-
const LOG_LEVEL_ORDER = {
|
|
1532
|
-
debug: 0,
|
|
1533
|
-
error: 3,
|
|
1534
|
-
info: 1,
|
|
1535
|
-
warn: 2
|
|
1536
|
-
};
|
|
1537
|
-
/**
|
|
1538
|
-
* Universal logger class that works in both browser and Node.js environments
|
|
1539
|
-
*/
|
|
1540
|
-
var Logger = class Logger {
|
|
1541
|
-
config;
|
|
1542
|
-
constructor(config = {}) {
|
|
1543
|
-
this.config = {
|
|
1544
|
-
...DEFAULT_CONFIG$1,
|
|
1545
|
-
...config
|
|
1546
|
-
};
|
|
1547
|
-
}
|
|
1548
|
-
/**
|
|
1549
|
-
* Update logger configuration
|
|
1550
|
-
*/
|
|
1551
|
-
configure(config) {
|
|
1552
|
-
this.config = {
|
|
1553
|
-
...this.config,
|
|
1554
|
-
...config
|
|
1555
|
-
};
|
|
1556
|
-
}
|
|
1557
|
-
/**
|
|
1558
|
-
* Get current configuration
|
|
1559
|
-
*/
|
|
1560
|
-
getConfig() {
|
|
1561
|
-
return { ...this.config };
|
|
1562
|
-
}
|
|
1563
|
-
/**
|
|
1564
|
-
* Check if a log level should be output
|
|
1565
|
-
*/
|
|
1566
|
-
shouldLog(level) {
|
|
1567
|
-
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
1568
|
-
}
|
|
1569
|
-
/**
|
|
1570
|
-
* Get timestamp string
|
|
1571
|
-
*/
|
|
1572
|
-
static getTimestamp() {
|
|
1573
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
1574
|
-
}
|
|
1575
|
-
/**
|
|
1576
|
-
* Get log level string
|
|
1577
|
-
*/
|
|
1578
|
-
static getLevelString(level) {
|
|
1579
|
-
switch (level) {
|
|
1580
|
-
case "debug": return "DEBUG";
|
|
1581
|
-
case "info": return "INFO";
|
|
1582
|
-
case "warn": return "WARN";
|
|
1583
|
-
case "error": return "ERROR";
|
|
1584
|
-
default: return "UNKNOWN";
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
/**
|
|
1588
|
-
* Format message for Node.js terminal
|
|
1589
|
-
*/
|
|
1590
|
-
formatForNode(level, message) {
|
|
1591
|
-
const parts = [];
|
|
1592
|
-
if (this.config.timestamps) parts.push(`${COLORS.gray}[${Logger.getTimestamp()}]${COLORS.reset}`);
|
|
1593
|
-
if (this.config.prefix) parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);
|
|
1594
|
-
if (this.config.showLevel) {
|
|
1595
|
-
const levelStr = Logger.getLevelString(level);
|
|
1596
|
-
let coloredLevel;
|
|
1597
|
-
switch (level) {
|
|
1598
|
-
case "debug":
|
|
1599
|
-
coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
|
|
1600
|
-
break;
|
|
1601
|
-
case "info":
|
|
1602
|
-
coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
|
|
1603
|
-
break;
|
|
1604
|
-
case "warn":
|
|
1605
|
-
coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
|
|
1606
|
-
break;
|
|
1607
|
-
case "error":
|
|
1608
|
-
coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
|
|
1609
|
-
break;
|
|
1610
|
-
default: coloredLevel = `[${levelStr}]`;
|
|
1611
|
-
}
|
|
1612
|
-
parts.push(coloredLevel);
|
|
1613
|
-
}
|
|
1614
|
-
parts.push(message);
|
|
1615
|
-
return parts.join(" ");
|
|
1616
|
-
}
|
|
1617
|
-
/**
|
|
1618
|
-
* Log message using appropriate method
|
|
1619
|
-
*/
|
|
1620
|
-
logMessage(level, message, ...args) {
|
|
1621
|
-
if (!this.shouldLog(level)) return;
|
|
1622
|
-
if (this.config.formatter) {
|
|
1623
|
-
this.config.formatter(level, message, ...args);
|
|
1624
|
-
return;
|
|
1625
|
-
}
|
|
1626
|
-
if (isBrowser()) this.logToBrowser(level, message, ...args);
|
|
1627
|
-
else if (isNode()) this.logToNode(level, message, ...args);
|
|
1628
|
-
else console.log(message, ...args);
|
|
1629
|
-
}
|
|
1630
|
-
/**
|
|
1631
|
-
* Log to browser console with styling
|
|
1632
|
-
*/
|
|
1633
|
-
logToBrowser(level, message, ...args) {
|
|
1634
|
-
const parts = [];
|
|
1635
|
-
const styles = [];
|
|
1636
|
-
if (this.config.timestamps) {
|
|
1637
|
-
parts.push(`%c[${Logger.getTimestamp()}]`);
|
|
1638
|
-
styles.push(BROWSER_STYLES.timestamp);
|
|
1639
|
-
}
|
|
1640
|
-
if (this.config.prefix) {
|
|
1641
|
-
parts.push(`%c${this.config.prefix}`);
|
|
1642
|
-
styles.push(BROWSER_STYLES.prefix);
|
|
1643
|
-
}
|
|
1644
|
-
if (this.config.showLevel) {
|
|
1645
|
-
const levelStr = Logger.getLevelString(level);
|
|
1646
|
-
parts.push(`%c[${levelStr}]`);
|
|
1647
|
-
switch (level) {
|
|
1648
|
-
case "debug":
|
|
1649
|
-
styles.push(BROWSER_STYLES.debug);
|
|
1650
|
-
break;
|
|
1651
|
-
case "info":
|
|
1652
|
-
styles.push(BROWSER_STYLES.info);
|
|
1653
|
-
break;
|
|
1654
|
-
case "warn":
|
|
1655
|
-
styles.push(BROWSER_STYLES.warn);
|
|
1656
|
-
break;
|
|
1657
|
-
case "error":
|
|
1658
|
-
styles.push(BROWSER_STYLES.error);
|
|
1659
|
-
break;
|
|
1660
|
-
default: styles.push("");
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
parts.push(`%c${message}`);
|
|
1664
|
-
styles.push("color: inherit; font-weight: normal;");
|
|
1665
|
-
const formattedMessage = parts.join(" ");
|
|
1666
|
-
switch (level) {
|
|
1667
|
-
case "debug":
|
|
1668
|
-
console.debug(formattedMessage, ...styles, ...args);
|
|
1669
|
-
break;
|
|
1670
|
-
case "info":
|
|
1671
|
-
console.info(formattedMessage, ...styles, ...args);
|
|
1672
|
-
break;
|
|
1673
|
-
case "warn":
|
|
1674
|
-
console.warn(formattedMessage, ...styles, ...args);
|
|
1675
|
-
break;
|
|
1676
|
-
case "error":
|
|
1677
|
-
console.error(formattedMessage, ...styles, ...args);
|
|
1678
|
-
break;
|
|
1679
|
-
default: console.log(formattedMessage, ...styles, ...args);
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
/**
|
|
1683
|
-
* Log to Node.js console
|
|
1684
|
-
*/
|
|
1685
|
-
logToNode(level, message, ...args) {
|
|
1686
|
-
const formattedMessage = this.formatForNode(level, message);
|
|
1687
|
-
switch (level) {
|
|
1688
|
-
case "debug":
|
|
1689
|
-
console.debug(formattedMessage, ...args);
|
|
1690
|
-
break;
|
|
1691
|
-
case "info":
|
|
1692
|
-
console.info(formattedMessage, ...args);
|
|
1693
|
-
break;
|
|
1694
|
-
case "warn":
|
|
1695
|
-
console.warn(formattedMessage, ...args);
|
|
1696
|
-
break;
|
|
1697
|
-
case "error":
|
|
1698
|
-
console.error(formattedMessage, ...args);
|
|
1699
|
-
break;
|
|
1700
|
-
default: console.log(formattedMessage, ...args);
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
/**
|
|
1704
|
-
* Log debug message
|
|
1705
|
-
*/
|
|
1706
|
-
debug(message, ...args) {
|
|
1707
|
-
this.logMessage("debug", message, ...args);
|
|
1708
|
-
}
|
|
1709
|
-
/**
|
|
1710
|
-
* Log info message
|
|
1711
|
-
*/
|
|
1712
|
-
info(message, ...args) {
|
|
1713
|
-
this.logMessage("info", message, ...args);
|
|
1714
|
-
}
|
|
1715
|
-
/**
|
|
1716
|
-
* Log warning message
|
|
1717
|
-
*/
|
|
1718
|
-
warn(message, ...args) {
|
|
1719
|
-
this.logMessage("warn", message, ...args);
|
|
1720
|
-
}
|
|
1721
|
-
/**
|
|
1722
|
-
* Log error message
|
|
1723
|
-
*/
|
|
1724
|
-
error(message, ...args) {
|
|
1725
|
-
this.logMessage("error", message, ...args);
|
|
1726
|
-
}
|
|
1727
|
-
/**
|
|
1728
|
-
* Create a child logger with additional prefix
|
|
1729
|
-
*/
|
|
1730
|
-
child(prefix) {
|
|
1731
|
-
const childPrefix = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;
|
|
1732
|
-
return new Logger({
|
|
1733
|
-
...this.config,
|
|
1734
|
-
prefix: childPrefix
|
|
1735
|
-
});
|
|
1736
|
-
}
|
|
1737
|
-
/**
|
|
1738
|
-
* Set log level
|
|
1739
|
-
*/
|
|
1740
|
-
setLevel(level) {
|
|
1741
|
-
this.config.level = level;
|
|
1742
|
-
}
|
|
1743
|
-
/**
|
|
1744
|
-
* Get current log level
|
|
1745
|
-
*/
|
|
1746
|
-
getLevel() {
|
|
1747
|
-
return this.config.level;
|
|
1748
|
-
}
|
|
1749
|
-
};
|
|
1750
|
-
/**
|
|
1751
|
-
* Default logger instance
|
|
1752
|
-
*/
|
|
1753
|
-
const logger = new Logger();
|
|
1754
|
-
/**
|
|
1755
|
-
* Create a new logger instance with custom configuration
|
|
1756
|
-
*/
|
|
1757
|
-
const createLogger = (config) => new Logger(config);
|
|
1758
|
-
/**
|
|
1759
|
-
* Default export - global logger instance
|
|
1760
|
-
*/
|
|
1761
|
-
var logger_default = logger;
|
|
1762
|
-
/**
|
|
1763
|
-
* Named exports for convenience
|
|
1764
|
-
*/
|
|
1765
|
-
const debug = (message, ...args) => logger.debug(message, ...args);
|
|
1766
|
-
const info = (message, ...args) => logger.info(message, ...args);
|
|
1767
|
-
const warn = (message, ...args) => logger.warn(message, ...args);
|
|
1768
|
-
const error = (message, ...args) => logger.error(message, ...args);
|
|
1769
|
-
/**
|
|
1770
|
-
* Configure the default logger
|
|
1771
|
-
*/
|
|
1772
|
-
const configure = (config) => logger.configure(config);
|
|
1773
|
-
/**
|
|
1774
|
-
* Create component-specific loggers
|
|
1775
|
-
*/
|
|
1776
|
-
const createComponentLogger = (component) => logger.child(component);
|
|
1777
|
-
/**
|
|
1778
|
-
* Create package-specific logger
|
|
1779
|
-
*/
|
|
1780
|
-
const createPackageLogger = (packageName) => createLogger({
|
|
1781
|
-
level: "info",
|
|
1782
|
-
prefix: `${PREFIX} - ${packageName}`,
|
|
1783
|
-
showLevel: true,
|
|
1784
|
-
timestamps: true
|
|
1785
|
-
});
|
|
1786
|
-
/**
|
|
1787
|
-
* Create package component logger (package + component)
|
|
1788
|
-
*/
|
|
1789
|
-
const createPackageComponentLogger = (packageName, component) => {
|
|
1790
|
-
return createPackageLogger(packageName).child(component);
|
|
1791
|
-
};
|
|
1792
|
-
|
|
1793
|
-
//#endregion
|
|
1794
|
-
//#region src/errors/ThunderIDRuntimeError.ts
|
|
1795
|
-
/**
|
|
1796
|
-
* Base class for all runtime errors in ThunderID. This class extends ThunderIDError
|
|
1797
|
-
* and adds support for additional error details. Use this class for errors that occur
|
|
1798
|
-
* during runtime execution that are not related to API calls.
|
|
1799
|
-
*
|
|
1800
|
-
* @example
|
|
1801
|
-
* ```typescript
|
|
1802
|
-
* throw new ThunderIDRuntimeError(
|
|
1803
|
-
* "Failed to parse configuration",
|
|
1804
|
-
* "CONFIG_PARSE_ERROR",
|
|
1805
|
-
* { invalidField: "redirectUri" }
|
|
1806
|
-
* );
|
|
1807
|
-
* ```
|
|
1808
|
-
*/
|
|
1809
|
-
var ThunderIDRuntimeError = class extends ThunderIDError {
|
|
1810
|
-
/**
|
|
1811
|
-
* Creates an instance of ThunderIDRuntimeError.
|
|
1812
|
-
*
|
|
1813
|
-
* @param message - Human-readable description of the error
|
|
1814
|
-
* @param code - A unique error code that identifies the error type
|
|
1815
|
-
* @param details - Additional details about the error that might be helpful for debugging
|
|
1816
|
-
* @param origin - Optional. The SDK origin (e.g. 'react', 'vue'). Defaults to generic 'ThunderID'
|
|
1817
|
-
* @constructor
|
|
1818
|
-
*/
|
|
1819
|
-
constructor(message, code, origin, details) {
|
|
1820
|
-
super(message, code, origin);
|
|
1821
|
-
this.details = details;
|
|
1822
|
-
Object.defineProperty(this, "name", {
|
|
1823
|
-
configurable: true,
|
|
1824
|
-
value: "ThunderIDRuntimeError",
|
|
1825
|
-
writable: true
|
|
1826
|
-
});
|
|
1827
|
-
}
|
|
1828
|
-
/**
|
|
1829
|
-
* Returns a string representation of the runtime error
|
|
1830
|
-
* @returns Formatted error string with name, code, details, and message
|
|
1831
|
-
*/
|
|
1832
|
-
toString() {
|
|
1833
|
-
const details = this.details ? `\nDetails: ${JSON.stringify(this.details, null, 2)}` : "";
|
|
1834
|
-
return `[${this.name}] (code="${this.code}")${details}\nMessage: ${this.message}`;
|
|
1835
|
-
}
|
|
1836
|
-
};
|
|
1837
|
-
|
|
1838
|
-
//#endregion
|
|
1839
|
-
//#region src/utils/isRecognizedBaseUrlPattern.ts
|
|
1840
|
-
/**
|
|
1841
|
-
* Utility to determine if sensible ThunderID fallbacks can be used based on the given base URL.
|
|
1842
|
-
*
|
|
1843
|
-
* This checks if the URL follows the standard ThunderID pattern: /t/{orgHandle}
|
|
1844
|
-
* Returns true if sensible fallbacks (like deriving organization handle, tenant, etc.) can be used, false otherwise.
|
|
1845
|
-
*
|
|
1846
|
-
* @param baseUrl - The base URL of the ThunderID identity server (string or undefined)
|
|
1847
|
-
* @returns boolean - true if sensible fallbacks can be used, false otherwise
|
|
1848
|
-
*
|
|
1849
|
-
* @example
|
|
1850
|
-
* isRecognizedBaseUrlPattern('https://localhost:8090/t/dxlab'); // true
|
|
1851
|
-
* isRecognizedBaseUrlPattern('https://custom.example.com/auth'); // false
|
|
1852
|
-
*/
|
|
1853
|
-
const isRecognizedBaseUrlPattern = (baseUrl) => {
|
|
1854
|
-
if (!baseUrl) throw new ThunderIDRuntimeError("Base URL is required to derive if the `baseUrl` is recognized.", "isRecognizedBaseUrlPattern-ValidationError-001", "javascript", "A valid base URL must be provided to derive if the `baseUrl` is recognized to use the sensible fallbacks.");
|
|
1855
|
-
let parsedUrl;
|
|
1856
|
-
try {
|
|
1857
|
-
parsedUrl = new URL(baseUrl);
|
|
1858
|
-
} catch (error$1) {
|
|
1859
|
-
throw new ThunderIDRuntimeError(`Invalid base URL format: ${baseUrl}`, "isRecognizedBaseUrlPattern-ValidationError-002", "javascript", "The provided base URL does not conform to valid URL syntax.");
|
|
1860
|
-
}
|
|
1861
|
-
const pathSegments = parsedUrl.pathname?.split("/")?.filter((segment) => segment?.length > 0);
|
|
1862
|
-
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
1863
|
-
logger_default.warn("[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle}).");
|
|
1864
|
-
return false;
|
|
1865
|
-
}
|
|
1866
|
-
return true;
|
|
1867
|
-
};
|
|
1868
|
-
var isRecognizedBaseUrlPattern_default = isRecognizedBaseUrlPattern;
|
|
1869
|
-
|
|
1870
|
-
//#endregion
|
|
1871
|
-
//#region src/utils/identifyPlatform.ts
|
|
1872
|
-
/**
|
|
1873
|
-
* Identifies the platform based on the given base URL.
|
|
1874
|
-
*
|
|
1875
|
-
* If the URL is recognized and matches the ThunderID domain, returns Platform.ThunderID.
|
|
1876
|
-
* Otherwise, returns Platform.IdentityServer.
|
|
1877
|
-
*
|
|
1878
|
-
* @param baseUrl - The base URL to check
|
|
1879
|
-
* @returns Platform enum value
|
|
1880
|
-
*/
|
|
1881
|
-
const identifyPlatform = (config) => {
|
|
1882
|
-
const { baseUrl } = config;
|
|
1883
|
-
try {
|
|
1884
|
-
if (isRecognizedBaseUrlPattern_default(baseUrl)) {
|
|
1885
|
-
try {
|
|
1886
|
-
const url = new URL(baseUrl);
|
|
1887
|
-
if (/\.thunderid\.io$/i.test(url.hostname) || /thunderid\.io$/i.test(url.hostname)) return Platform.ThunderID;
|
|
1888
|
-
} catch {
|
|
1889
|
-
logger_default.debug(`[identifyPlatform] Could not identify platform from the base URL: ${baseUrl}. Defaulting to WSO2 Identity Server as the platform.`);
|
|
1890
|
-
}
|
|
1891
|
-
return Platform.IdentityServer;
|
|
1892
|
-
}
|
|
1893
|
-
return Platform.Unknown;
|
|
1894
|
-
} catch (error$1) {
|
|
1895
|
-
logger_default.debug(`[identifyPlatform] Error identifying platform from base URL: ${baseUrl}. Error: ${error$1.message}`);
|
|
1896
|
-
return Platform.Unknown;
|
|
1897
|
-
}
|
|
1898
|
-
};
|
|
1899
|
-
var identifyPlatform_default = identifyPlatform;
|
|
1900
|
-
|
|
1901
|
-
//#endregion
|
|
1902
|
-
//#region src/api/getBrandingPreference.ts
|
|
1903
|
-
/**
|
|
1904
|
-
* Retrieves branding preference configuration.
|
|
1905
|
-
*
|
|
1906
|
-
* @param config - Configuration object containing baseUrl, optional query parameters, and request config.
|
|
1907
|
-
* @returns A promise that resolves with the branding preference information.
|
|
1908
|
-
* @example
|
|
1909
|
-
* ```typescript
|
|
1910
|
-
* // Using default fetch
|
|
1911
|
-
* try {
|
|
1912
|
-
* const response = await getBrandingPreference({
|
|
1913
|
-
* baseUrl: "https://localhost:8090",
|
|
1914
|
-
* locale: "en-US",
|
|
1915
|
-
* name: "my-branding",
|
|
1916
|
-
* type: "org"
|
|
1917
|
-
* });
|
|
1918
|
-
* console.log(response.theme);
|
|
1919
|
-
* } catch (error) {
|
|
1920
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1921
|
-
* console.error('Failed to get branding preference:', error.message);
|
|
1922
|
-
* }
|
|
1923
|
-
* }
|
|
1924
|
-
* ```
|
|
1925
|
-
*
|
|
1926
|
-
* @example
|
|
1927
|
-
* ```typescript
|
|
1928
|
-
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1929
|
-
* try {
|
|
1930
|
-
* const response = await getBrandingPreference({
|
|
1931
|
-
* baseUrl: "https://localhost:8090",
|
|
1932
|
-
* locale: "en-US",
|
|
1933
|
-
* name: "my-branding",
|
|
1934
|
-
* type: "org",
|
|
1935
|
-
* fetcher: async (url, config) => {
|
|
1936
|
-
* const response = await httpClient({
|
|
1937
|
-
* url,
|
|
1938
|
-
* method: config.method,
|
|
1939
|
-
* headers: config.headers,
|
|
1940
|
-
* ...config
|
|
1941
|
-
* });
|
|
1942
|
-
* // Convert axios-like response to fetch-like Response
|
|
1943
|
-
* return {
|
|
1944
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
1945
|
-
* status: response.status,
|
|
1946
|
-
* statusText: response.statusText,
|
|
1947
|
-
* json: () => Promise.resolve(response.data),
|
|
1948
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1949
|
-
* } as Response;
|
|
1950
|
-
* }
|
|
1047
|
+
* @param requestConfig - Request configuration object.
|
|
1048
|
+
* @returns A promise that resolves with the user information.
|
|
1049
|
+
* @throw
|
|
1050
|
+
* const userInfo = await getUserInfo({
|
|
1051
|
+
* url: "https://localhost:8090/oauth2/userinfo",
|
|
1951
1052
|
* });
|
|
1952
|
-
* console.log(
|
|
1053
|
+
* console.log(userInfo);
|
|
1953
1054
|
* } catch (error) {
|
|
1954
1055
|
* if (error instanceof ThunderIDAPIError) {
|
|
1955
|
-
* console.error('Failed to get
|
|
1956
|
-
* }
|
|
1957
|
-
* }
|
|
1958
|
-
* ```
|
|
1959
|
-
*/
|
|
1960
|
-
const
|
|
1961
|
-
try {
|
|
1962
|
-
new URL(
|
|
1963
|
-
} catch (error$1) {
|
|
1964
|
-
throw new ThunderIDAPIError(
|
|
1965
|
-
}
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
if (!response?.ok) {
|
|
1985
|
-
const errorText = await response.text();
|
|
1986
|
-
const platform = identifyPlatform_default({ baseUrl });
|
|
1987
|
-
let errorDescription;
|
|
1988
|
-
try {
|
|
1989
|
-
const errorBody = JSON.parse(errorText);
|
|
1990
|
-
errorDescription = errorBody?.description || errorBody?.message || errorText;
|
|
1991
|
-
} catch {
|
|
1992
|
-
errorDescription = errorText;
|
|
1993
|
-
}
|
|
1994
|
-
let platformConsoleGuidance;
|
|
1995
|
-
if (platform === Platform.ThunderID) platformConsoleGuidance = "configure branding preferences in the ThunderID console";
|
|
1996
|
-
else if (platform === Platform.IdentityServer) platformConsoleGuidance = "configure branding preferences in the WSO2 Identity Server console";
|
|
1997
|
-
else platformConsoleGuidance = "configure branding preferences in the platform console";
|
|
1998
|
-
logger_default.warn(`[BrandingError] ${errorDescription} To resolve this issue, please ${platformConsoleGuidance}. If you want to suppress this warning and stop fetching branding preferences, set \`<ThunderIDProvider>\` -> \`preferences\` -> \`theme\` -> \`inheritFromBranding\` to false.`);
|
|
1999
|
-
throw new ThunderIDAPIError(errorText, "getBrandingPreference-ResponseError-001", "javascript", response.status, response.statusText, "Failed to get branding preference");
|
|
2000
|
-
}
|
|
2001
|
-
return await response.json();
|
|
2002
|
-
} catch (error$1) {
|
|
2003
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
2004
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getBrandingPreference-NetworkError-001", "javascript", 0, "Network Error");
|
|
2005
|
-
}
|
|
2006
|
-
};
|
|
2007
|
-
var getBrandingPreference_default = getBrandingPreference;
|
|
2008
|
-
|
|
2009
|
-
//#endregion
|
|
2010
|
-
//#region src/models/v2/embedded-signin-flow-v2.ts
|
|
2011
|
-
/**
|
|
2012
|
-
* Status enumeration for ThunderID embedded sign-in flow operations.
|
|
2013
|
-
*
|
|
2014
|
-
* These statuses indicate the current state of the sign-in flow and determine
|
|
2015
|
-
* the next action required by the client application. Each status provides
|
|
2016
|
-
* specific guidance on how to proceed with the authentication process.
|
|
2017
|
-
*
|
|
2018
|
-
* @example
|
|
2019
|
-
* ```typescript
|
|
2020
|
-
* switch (response.flowStatus) {
|
|
2021
|
-
* case EmbeddedSignInFlowStatus.Incomplete:
|
|
2022
|
-
* // More user input needed - render form components
|
|
2023
|
-
* break;
|
|
2024
|
-
* case EmbeddedSignInFlowStatus.Complete:
|
|
2025
|
-
* // Authentication successful - handle completion
|
|
2026
|
-
* break;
|
|
2027
|
-
* case EmbeddedSignInFlowStatus.Error:
|
|
2028
|
-
* // Authentication failed - show error message
|
|
2029
|
-
* break;
|
|
2030
|
-
* }
|
|
2031
|
-
* ```
|
|
2032
|
-
*
|
|
2033
|
-
* @experimental Part of the new ThunderID API
|
|
2034
|
-
*/
|
|
2035
|
-
let EmbeddedSignInFlowStatus$1 = /* @__PURE__ */ function(EmbeddedSignInFlowStatus$2) {
|
|
2036
|
-
/**
|
|
2037
|
-
* Sign-in flow completed successfully.
|
|
2038
|
-
*
|
|
2039
|
-
* The user has been authenticated and the flow can proceed to
|
|
2040
|
-
* OAuth2 completion or redirection. Check for redirectUrl or
|
|
2041
|
-
* assertion data in the response.
|
|
2042
|
-
*/
|
|
2043
|
-
EmbeddedSignInFlowStatus$2["Complete"] = "COMPLETE";
|
|
2044
|
-
/**
|
|
2045
|
-
* Sign-in flow encountered an error.
|
|
2046
|
-
*
|
|
2047
|
-
* Authentication failed due to invalid credentials, system error,
|
|
2048
|
-
* or other issues. Check error details in the response and handle
|
|
2049
|
-
* appropriately (retry, show error message, etc.).
|
|
2050
|
-
*/
|
|
2051
|
-
EmbeddedSignInFlowStatus$2["Error"] = "ERROR";
|
|
2052
|
-
/**
|
|
2053
|
-
* Sign-in flow requires additional user input.
|
|
2054
|
-
*
|
|
2055
|
-
* More authentication steps are needed. The response will contain
|
|
2056
|
-
* components in data.meta.components that should be rendered to
|
|
2057
|
-
* collect additional user input (e.g., MFA, password, etc.).
|
|
2058
|
-
*/
|
|
2059
|
-
EmbeddedSignInFlowStatus$2["Incomplete"] = "INCOMPLETE";
|
|
2060
|
-
return EmbeddedSignInFlowStatus$2;
|
|
2061
|
-
}({});
|
|
2062
|
-
/**
|
|
2063
|
-
* Type enumeration for ThunderID embedded sign-in flow responses.
|
|
2064
|
-
*
|
|
2065
|
-
* Determines the nature of the flow response and how the client should
|
|
2066
|
-
* handle the returned data. This affects both UI rendering and flow
|
|
2067
|
-
* continuation logic.
|
|
2068
|
-
*
|
|
2069
|
-
* @experimental Part of the new ThunderID API
|
|
2070
|
-
*/
|
|
2071
|
-
let EmbeddedSignInFlowType$1 = /* @__PURE__ */ function(EmbeddedSignInFlowType$2) {
|
|
2072
|
-
/**
|
|
2073
|
-
* Response requires external redirection.
|
|
2074
|
-
*
|
|
2075
|
-
* Used for social login providers, external identity providers,
|
|
2076
|
-
* or other flows that require navigating to an external URL.
|
|
2077
|
-
* The response will contain redirection information.
|
|
2078
|
-
*/
|
|
2079
|
-
EmbeddedSignInFlowType$2["Redirection"] = "REDIRECTION";
|
|
2080
|
-
/**
|
|
2081
|
-
* Response contains view components for rendering.
|
|
2082
|
-
*
|
|
2083
|
-
* Standard embedded flow response containing UI components
|
|
2084
|
-
* that should be rendered within the current application
|
|
2085
|
-
* context. Most common type for embedded authentication.
|
|
2086
|
-
*/
|
|
2087
|
-
EmbeddedSignInFlowType$2["View"] = "VIEW";
|
|
2088
|
-
return EmbeddedSignInFlowType$2;
|
|
2089
|
-
}({});
|
|
1056
|
+
* console.error('Failed to get user info:', error.message);
|
|
1057
|
+
* }
|
|
1058
|
+
* }
|
|
1059
|
+
* ```
|
|
1060
|
+
*/
|
|
1061
|
+
const getUserInfo = async ({ url,...requestConfig }) => {
|
|
1062
|
+
try {
|
|
1063
|
+
new URL(url);
|
|
1064
|
+
} catch (error$1) {
|
|
1065
|
+
throw new ThunderIDAPIError("Invalid endpoint URL provided", "getUserInfo-ValidationError-001", "javascript", 400, "Invalid Request");
|
|
1066
|
+
}
|
|
1067
|
+
try {
|
|
1068
|
+
const response = await fetch(url, {
|
|
1069
|
+
...requestConfig,
|
|
1070
|
+
headers: {
|
|
1071
|
+
Accept: "application/json",
|
|
1072
|
+
"Content-Type": "application/json",
|
|
1073
|
+
...requestConfig.headers
|
|
1074
|
+
},
|
|
1075
|
+
method: "GET"
|
|
1076
|
+
});
|
|
1077
|
+
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "getUserInfo-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch user info");
|
|
1078
|
+
return await response.json();
|
|
1079
|
+
} catch (error$1) {
|
|
1080
|
+
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1081
|
+
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getUserInfo-NetworkError-001", "javascript", 0, "Network Error");
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
var getUserInfo_default = getUserInfo;
|
|
2090
1085
|
|
|
2091
1086
|
//#endregion
|
|
2092
|
-
//#region src/utils/
|
|
1087
|
+
//#region src/utils/processUsername.ts
|
|
2093
1088
|
/**
|
|
2094
|
-
* Copyright (c)
|
|
1089
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
2095
1090
|
*
|
|
2096
1091
|
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
2097
1092
|
* Version 2.0 (the "License"); you may not use this file except
|
|
@@ -2108,445 +1103,313 @@ let EmbeddedSignInFlowType$1 = /* @__PURE__ */ function(EmbeddedSignInFlowType$2
|
|
|
2108
1103
|
* under the License.
|
|
2109
1104
|
*/
|
|
2110
1105
|
/**
|
|
2111
|
-
*
|
|
2112
|
-
*
|
|
2113
|
-
*
|
|
2114
|
-
* The backend reads requested_permissions from UserInputs (the `inputs` map), not a top-level field.
|
|
1106
|
+
* Regular expression to match userstore prefixes in usernames.
|
|
1107
|
+
* Matches patterns like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
1108
|
+
* The pattern matches any uppercase letters, numbers, and underscores followed by a forward slash.
|
|
2115
1109
|
*/
|
|
2116
|
-
const
|
|
2117
|
-
const { scopes,...rest } = payload;
|
|
2118
|
-
const normalizedScopes = Array.isArray(scopes) ? scopes.map((s) => String(s).trim()).filter(Boolean).join(" ") : typeof scopes === "string" ? scopes.trim() : "";
|
|
2119
|
-
if (!normalizedScopes) return rest;
|
|
2120
|
-
const existingInputs = rest["inputs"] != null && typeof rest["inputs"] === "object" && !Array.isArray(rest["inputs"]) ? rest["inputs"] : {};
|
|
2121
|
-
return {
|
|
2122
|
-
...rest,
|
|
2123
|
-
inputs: {
|
|
2124
|
-
...existingInputs,
|
|
2125
|
-
requested_permissions: normalizedScopes
|
|
2126
|
-
}
|
|
2127
|
-
};
|
|
2128
|
-
};
|
|
2129
|
-
var injectRequestedPermissions_default = injectRequestedPermissions;
|
|
2130
|
-
|
|
2131
|
-
//#endregion
|
|
2132
|
-
//#region src/api/v2/executeEmbeddedSignInFlowV2.ts
|
|
2133
|
-
const executeEmbeddedSignInFlowV2 = async ({ url, baseUrl, payload, authId,...requestConfig }) => {
|
|
2134
|
-
if (!payload) throw new ThunderIDAPIError("Authorization payload is required", "executeEmbeddedSignInFlow-ValidationError-002", "javascript", 400, "If an authorization payload is not provided, the request cannot be constructed correctly.");
|
|
2135
|
-
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
2136
|
-
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
2137
|
-
const isNewFlowStart = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload;
|
|
2138
|
-
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
2139
|
-
const basePayload = isNewFlowStart ? injectRequestedPermissions_default(cleanPayload) : cleanPayload;
|
|
2140
|
-
const requestPayload = isNewFlowStart || hasOnlyFlowId ? {
|
|
2141
|
-
...basePayload,
|
|
2142
|
-
verbose: true
|
|
2143
|
-
} : basePayload;
|
|
2144
|
-
const response = await fetch(endpoint, {
|
|
2145
|
-
...requestConfig,
|
|
2146
|
-
body: JSON.stringify(requestPayload),
|
|
2147
|
-
headers: {
|
|
2148
|
-
Accept: "application/json",
|
|
2149
|
-
"Content-Type": "application/json",
|
|
2150
|
-
...requestConfig.headers
|
|
2151
|
-
},
|
|
2152
|
-
method: requestConfig.method || "POST"
|
|
2153
|
-
});
|
|
2154
|
-
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedSignInFlow-ResponseError-001", "javascript", response.status, response.statusText, "Authorization request failed");
|
|
2155
|
-
const flowResponse = await response.json();
|
|
2156
|
-
if (flowResponse.flowStatus === EmbeddedSignInFlowStatus$1.Complete && flowResponse.assertion && authId) try {
|
|
2157
|
-
const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
|
|
2158
|
-
body: JSON.stringify({
|
|
2159
|
-
assertion: flowResponse.assertion,
|
|
2160
|
-
authId
|
|
2161
|
-
}),
|
|
2162
|
-
credentials: "include",
|
|
2163
|
-
headers: {
|
|
2164
|
-
Accept: "application/json",
|
|
2165
|
-
"Content-Type": "application/json",
|
|
2166
|
-
...requestConfig.headers
|
|
2167
|
-
},
|
|
2168
|
-
method: "POST"
|
|
2169
|
-
});
|
|
2170
|
-
if (!oauth2Response.ok) throw new ThunderIDAPIError(await oauth2Response.text(), "executeEmbeddedSignInFlow-OAuth2Error-002", "javascript", oauth2Response.status, oauth2Response.statusText, "OAuth2 authorization failed");
|
|
2171
|
-
const oauth2Result = await oauth2Response.json();
|
|
2172
|
-
return {
|
|
2173
|
-
flowStatus: flowResponse.flowStatus,
|
|
2174
|
-
redirectUrl: oauth2Result["redirect_uri"]
|
|
2175
|
-
};
|
|
2176
|
-
} catch (authError) {
|
|
2177
|
-
if (authError instanceof ThunderIDAPIError) throw authError;
|
|
2178
|
-
throw new ThunderIDAPIError(authError instanceof Error ? authError.message : "Unknown error", "executeEmbeddedSignInFlow-OAuth2Error-001", "javascript", 500, "Failed to complete OAuth2 authorization after successful embedded sign-in flow.", "OAuth2 authorization failed");
|
|
2179
|
-
}
|
|
2180
|
-
return flowResponse;
|
|
2181
|
-
};
|
|
2182
|
-
var executeEmbeddedSignInFlowV2_default = executeEmbeddedSignInFlowV2;
|
|
2183
|
-
|
|
2184
|
-
//#endregion
|
|
2185
|
-
//#region src/models/v2/embedded-signup-flow-v2.ts
|
|
1110
|
+
const USERSTORE_PREFIX_REGEX = /^[A-Z_][A-Z0-9_]*\//;
|
|
2186
1111
|
/**
|
|
2187
|
-
*
|
|
1112
|
+
* Removes userstore prefixes from a username if they exist.
|
|
1113
|
+
* This is commonly used to clean usernames returned from SCIM2 endpoints
|
|
1114
|
+
* that include userstore prefixes like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
2188
1115
|
*
|
|
2189
|
-
*
|
|
2190
|
-
* the
|
|
2191
|
-
* guidance on how to proceed with the user registration process.
|
|
1116
|
+
* @param username - The username string to process
|
|
1117
|
+
* @returns The username without the userstore prefix, or the original username if no prefix exists
|
|
2192
1118
|
*
|
|
2193
1119
|
* @example
|
|
2194
1120
|
* ```typescript
|
|
2195
|
-
*
|
|
2196
|
-
*
|
|
2197
|
-
* // More user input needed - render registration form components
|
|
2198
|
-
* break;
|
|
2199
|
-
* case EmbeddedSignUpFlowStatus.Complete:
|
|
2200
|
-
* // Registration successful - handle completion
|
|
2201
|
-
* break;
|
|
2202
|
-
* case EmbeddedSignUpFlowStatus.Error:
|
|
2203
|
-
* // Registration failed - show error details
|
|
2204
|
-
* const errorResponse = response as EmbeddedSignUpFlowErrorResponse;
|
|
2205
|
-
* showError(errorResponse.error.description.defaultValue);
|
|
2206
|
-
* break;
|
|
2207
|
-
* }
|
|
2208
|
-
* ```
|
|
1121
|
+
* const cleanUsername = removeUserstorePrefix("DEFAULT/john.doe");
|
|
1122
|
+
* console.log(cleanUsername); // "john.doe"
|
|
2209
1123
|
*
|
|
2210
|
-
*
|
|
2211
|
-
|
|
2212
|
-
let EmbeddedSignUpFlowStatus = /* @__PURE__ */ function(EmbeddedSignUpFlowStatus$1) {
|
|
2213
|
-
/**
|
|
2214
|
-
* Sign-up flow completed successfully.
|
|
2215
|
-
*
|
|
2216
|
-
* The user has successfully registered and the flow can proceed to
|
|
2217
|
-
* OAuth2 completion or redirection. Check for redirectUrl or assertion
|
|
2218
|
-
* data in the response for next steps.
|
|
2219
|
-
*/
|
|
2220
|
-
EmbeddedSignUpFlowStatus$1["Complete"] = "COMPLETE";
|
|
2221
|
-
/**
|
|
2222
|
-
* Sign-up flow encountered an error and cannot proceed.
|
|
2223
|
-
*
|
|
2224
|
-
* Registration failed due to validation errors, duplicate user,
|
|
2225
|
-
* system errors, or other issues. The response will be of type
|
|
2226
|
-
* `EmbeddedSignUpFlowErrorResponse` containing detailed failure
|
|
2227
|
-
* information that can be displayed to the user.
|
|
2228
|
-
*
|
|
2229
|
-
* @see {@link EmbeddedSignUpFlowErrorResponse} for error response structure
|
|
2230
|
-
*/
|
|
2231
|
-
EmbeddedSignUpFlowStatus$1["Error"] = "ERROR";
|
|
2232
|
-
/**
|
|
2233
|
-
* Sign-up flow requires additional user input.
|
|
2234
|
-
*
|
|
2235
|
-
* More registration steps are needed. The response will contain
|
|
2236
|
-
* components in data.meta.components that should be rendered to
|
|
2237
|
-
* collect additional user information (e.g., profile data, verification).
|
|
2238
|
-
*/
|
|
2239
|
-
EmbeddedSignUpFlowStatus$1["Incomplete"] = "INCOMPLETE";
|
|
2240
|
-
return EmbeddedSignUpFlowStatus$1;
|
|
2241
|
-
}({});
|
|
2242
|
-
/**
|
|
2243
|
-
* Type enumeration for ThunderID embedded sign-up flow responses.
|
|
1124
|
+
* const thunderidUser = removeUserstorePrefix("ASGARDEO_USER/jane.doe");
|
|
1125
|
+
* console.log(thunderidUser); // "jane.doe"
|
|
2244
1126
|
*
|
|
2245
|
-
*
|
|
2246
|
-
*
|
|
2247
|
-
* continuation logic during the user registration process.
|
|
1127
|
+
* const primaryUser = removeUserstorePrefix("PRIMARY/admin");
|
|
1128
|
+
* console.log(primaryUser); // "admin"
|
|
2248
1129
|
*
|
|
2249
|
-
*
|
|
1130
|
+
* const alreadyClean = removeUserstorePrefix("user.name");
|
|
1131
|
+
* console.log(alreadyClean); // "user.name"
|
|
1132
|
+
*
|
|
1133
|
+
* const emptyInput = removeUserstorePrefix("");
|
|
1134
|
+
* console.log(emptyInput); // ""
|
|
1135
|
+
* ```
|
|
2250
1136
|
*/
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
*
|
|
2255
|
-
* Used for social registration providers, external identity providers,
|
|
2256
|
-
* or other flows that require navigating to an external URL during
|
|
2257
|
-
* the registration process. The response will contain redirection information.
|
|
2258
|
-
*/
|
|
2259
|
-
EmbeddedSignUpFlowType$1["Redirection"] = "REDIRECTION";
|
|
2260
|
-
/**
|
|
2261
|
-
* Response contains view components for rendering.
|
|
2262
|
-
*
|
|
2263
|
-
* Standard embedded registration flow response containing UI components
|
|
2264
|
-
* that should be rendered within the current application context.
|
|
2265
|
-
* Most common type for embedded user registration.
|
|
2266
|
-
*/
|
|
2267
|
-
EmbeddedSignUpFlowType$1["View"] = "VIEW";
|
|
2268
|
-
return EmbeddedSignUpFlowType$1;
|
|
2269
|
-
}({});
|
|
2270
|
-
|
|
2271
|
-
//#endregion
|
|
2272
|
-
//#region src/api/v2/executeEmbeddedSignUpFlowV2.ts
|
|
2273
|
-
const executeEmbeddedSignUpFlowV2 = async ({ url, baseUrl, payload, authId,...requestConfig }) => {
|
|
2274
|
-
if (!payload) throw new ThunderIDAPIError("Registration payload is required", "executeEmbeddedSignUpFlow-ValidationError-002", "javascript", 400, "If a registration payload is not provided, the request cannot be constructed correctly.");
|
|
2275
|
-
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
2276
|
-
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
2277
|
-
const isNewFlowStart = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload;
|
|
2278
|
-
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
2279
|
-
const basePayload = isNewFlowStart ? injectRequestedPermissions_default(cleanPayload) : cleanPayload;
|
|
2280
|
-
const requestPayload = isNewFlowStart || hasOnlyFlowId ? {
|
|
2281
|
-
...basePayload,
|
|
2282
|
-
verbose: true
|
|
2283
|
-
} : basePayload;
|
|
2284
|
-
const response = await fetch(endpoint, {
|
|
2285
|
-
...requestConfig,
|
|
2286
|
-
body: JSON.stringify(requestPayload),
|
|
2287
|
-
headers: {
|
|
2288
|
-
Accept: "application/json",
|
|
2289
|
-
"Content-Type": "application/json",
|
|
2290
|
-
...requestConfig.headers
|
|
2291
|
-
},
|
|
2292
|
-
method: requestConfig.method || "POST"
|
|
2293
|
-
});
|
|
2294
|
-
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedSignUpFlow-ResponseError-001", "javascript", response.status, response.statusText, "Registration request failed");
|
|
2295
|
-
const flowResponse = await response.json();
|
|
2296
|
-
if (flowResponse.flowStatus === EmbeddedSignUpFlowStatus.Complete && flowResponse.assertion && authId) try {
|
|
2297
|
-
const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
|
|
2298
|
-
body: JSON.stringify({
|
|
2299
|
-
assertion: flowResponse.assertion,
|
|
2300
|
-
authId
|
|
2301
|
-
}),
|
|
2302
|
-
credentials: "include",
|
|
2303
|
-
headers: {
|
|
2304
|
-
Accept: "application/json",
|
|
2305
|
-
"Content-Type": "application/json",
|
|
2306
|
-
...requestConfig.headers
|
|
2307
|
-
},
|
|
2308
|
-
method: "POST"
|
|
2309
|
-
});
|
|
2310
|
-
if (!oauth2Response.ok) throw new ThunderIDAPIError(await oauth2Response.text(), "executeEmbeddedSignUpFlow-OAuth2Error-002", "javascript", oauth2Response.status, oauth2Response.statusText, "OAuth2 authorization failed");
|
|
2311
|
-
const oauth2Result = await oauth2Response.json();
|
|
2312
|
-
return {
|
|
2313
|
-
flowStatus: flowResponse.flowStatus,
|
|
2314
|
-
redirectUrl: oauth2Result["redirect_uri"]
|
|
2315
|
-
};
|
|
2316
|
-
} catch (authError) {
|
|
2317
|
-
if (authError instanceof ThunderIDAPIError) throw authError;
|
|
2318
|
-
throw new ThunderIDAPIError(authError instanceof Error ? authError.message : "Unknown error", "executeEmbeddedSignUpFlow-OAuth2Error-001", "javascript", 500, "Failed to complete OAuth2 authorization after successful embedded sign-up flow.", "OAuth2 authorization failed");
|
|
2319
|
-
}
|
|
2320
|
-
return flowResponse;
|
|
1137
|
+
const removeUserstorePrefix = (username) => {
|
|
1138
|
+
if (!username) return "";
|
|
1139
|
+
return username.replace(USERSTORE_PREFIX_REGEX, "");
|
|
2321
1140
|
};
|
|
2322
|
-
var executeEmbeddedSignUpFlowV2_default = executeEmbeddedSignUpFlowV2;
|
|
2323
|
-
|
|
2324
|
-
//#endregion
|
|
2325
|
-
//#region src/api/v2/executeEmbeddedRecoveryFlowV2.ts
|
|
2326
1141
|
/**
|
|
2327
|
-
*
|
|
2328
|
-
*
|
|
2329
|
-
*
|
|
2330
|
-
* ThunderID server. The server returns UI components for each step (e.g. username
|
|
2331
|
-
* collection, OTP verification, password reset) and this function forwards the
|
|
2332
|
-
* user's responses back to the server.
|
|
1142
|
+
* Processes a user object to remove userstore prefixes from username fields.
|
|
1143
|
+
* This is a helper function for processing user objects returned from SCIM2 endpoints.
|
|
1144
|
+
* Handles various username field variations: username, userName, and user_name.
|
|
2333
1145
|
*
|
|
2334
|
-
* @param
|
|
2335
|
-
* @returns
|
|
2336
|
-
* @throws ThunderIDAPIError when the request fails or a payload is missing.
|
|
1146
|
+
* @param user - The user object to process
|
|
1147
|
+
* @returns The user object with processed username fields
|
|
2337
1148
|
*
|
|
2338
1149
|
* @example
|
|
2339
1150
|
* ```typescript
|
|
2340
|
-
*
|
|
2341
|
-
* const
|
|
2342
|
-
*
|
|
2343
|
-
* payload: {
|
|
2344
|
-
* flowType: 'RECOVERY',
|
|
2345
|
-
* applicationId: 'my-app-id',
|
|
2346
|
-
* },
|
|
2347
|
-
* });
|
|
1151
|
+
* const user = { username: "DEFAULT/john.doe", email: "john@example.com" };
|
|
1152
|
+
* const processedUser = processUserUsername(user);
|
|
1153
|
+
* console.log(processedUser.username); // "john.doe"
|
|
2348
1154
|
*
|
|
2349
|
-
*
|
|
2350
|
-
* const
|
|
2351
|
-
*
|
|
2352
|
-
*
|
|
2353
|
-
*
|
|
2354
|
-
*
|
|
2355
|
-
*
|
|
2356
|
-
* challengeToken: response.challengeToken,
|
|
2357
|
-
* },
|
|
2358
|
-
* });
|
|
1155
|
+
* const camelCaseUser = { userName: "ASGARDEO_USER/jane.doe", email: "jane@example.com" };
|
|
1156
|
+
* const processedCamelCaseUser = processUserUsername(camelCaseUser);
|
|
1157
|
+
* console.log(processedCamelCaseUser.userName); // "jane.doe"
|
|
1158
|
+
*
|
|
1159
|
+
* const snakeCaseUser = { user_name: "PRIMARY/admin", email: "admin@example.com" };
|
|
1160
|
+
* const processedSnakeCaseUser = processUserUsername(snakeCaseUser);
|
|
1161
|
+
* console.log(processedSnakeCaseUser.user_name); // "admin"
|
|
2359
1162
|
* ```
|
|
2360
1163
|
*/
|
|
2361
|
-
const
|
|
2362
|
-
if (!
|
|
2363
|
-
const
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
...cleanPayload,
|
|
2369
|
-
verbose: true
|
|
2370
|
-
} : cleanPayload;
|
|
2371
|
-
const response = await fetch(endpoint, {
|
|
2372
|
-
...requestConfig,
|
|
2373
|
-
body: JSON.stringify(requestPayload),
|
|
2374
|
-
headers: {
|
|
2375
|
-
Accept: "application/json",
|
|
2376
|
-
"Content-Type": "application/json",
|
|
2377
|
-
...requestConfig.headers
|
|
2378
|
-
},
|
|
2379
|
-
method: requestConfig.method || "POST"
|
|
2380
|
-
});
|
|
2381
|
-
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedRecoveryFlow-ResponseError-001", "javascript", response.status, response.statusText, "Recovery request failed");
|
|
2382
|
-
return await response.json();
|
|
1164
|
+
const processUsername = (user) => {
|
|
1165
|
+
if (!user) return user;
|
|
1166
|
+
const processedUser = { ...user };
|
|
1167
|
+
if (processedUser.username) processedUser.username = removeUserstorePrefix(processedUser.username);
|
|
1168
|
+
if (processedUser.userName) processedUser.userName = removeUserstorePrefix(processedUser.userName);
|
|
1169
|
+
if (processedUser.user_name) processedUser.user_name = removeUserstorePrefix(processedUser.user_name);
|
|
1170
|
+
return processedUser;
|
|
2383
1171
|
};
|
|
2384
|
-
var
|
|
1172
|
+
var processUsername_default = processUsername;
|
|
2385
1173
|
|
|
2386
1174
|
//#endregion
|
|
2387
|
-
//#region src/api/
|
|
1175
|
+
//#region src/api/getScim2Me.ts
|
|
2388
1176
|
/**
|
|
2389
|
-
*
|
|
2390
|
-
*
|
|
2391
|
-
* This function handles both:
|
|
2392
|
-
* - Admin flow: Initiates onboarding, collects user details, generates invite link
|
|
2393
|
-
* - End-user flow: Validates invite token and allows password setting
|
|
2394
|
-
*
|
|
2395
|
-
* @param requestConfig - Request configuration object containing URL, payload, and optional auth token.
|
|
2396
|
-
* @returns A promise that resolves with the flow execution response.
|
|
2397
|
-
* @throws ThunderIDAPIError when the request fails or URL is invalid.
|
|
1177
|
+
* Retrieves the user profile information from the specified SCIM2 /Me endpoint.
|
|
2398
1178
|
*
|
|
1179
|
+
* @param config - Request configuration object.
|
|
1180
|
+
* @returns A promise that resolves with the user profile information.
|
|
2399
1181
|
* @example
|
|
2400
1182
|
* ```typescript
|
|
2401
|
-
* //
|
|
2402
|
-
*
|
|
2403
|
-
*
|
|
2404
|
-
*
|
|
2405
|
-
*
|
|
2406
|
-
*
|
|
2407
|
-
*
|
|
2408
|
-
*
|
|
1183
|
+
* // Using default fetch
|
|
1184
|
+
* try {
|
|
1185
|
+
* const userProfile = await getScim2Me({
|
|
1186
|
+
* url: "https://localhost:8090/scim2/Me",
|
|
1187
|
+
* });
|
|
1188
|
+
* console.log(userProfile);
|
|
1189
|
+
* } catch (error) {
|
|
1190
|
+
* if (error instanceof ThunderIDAPIError) {
|
|
1191
|
+
* console.error('Failed to get user profile:', error.message);
|
|
2409
1192
|
* }
|
|
2410
|
-
* }
|
|
1193
|
+
* }
|
|
1194
|
+
* ```
|
|
2411
1195
|
*
|
|
2412
|
-
*
|
|
2413
|
-
*
|
|
2414
|
-
*
|
|
2415
|
-
*
|
|
2416
|
-
*
|
|
2417
|
-
*
|
|
1196
|
+
* @example
|
|
1197
|
+
* ```typescript
|
|
1198
|
+
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1199
|
+
* try {
|
|
1200
|
+
* const userProfile = await getScim2Me({
|
|
1201
|
+
* url: "https://localhost:8090/scim2/Me",
|
|
1202
|
+
* fetcher: async (url, config) => {
|
|
1203
|
+
* const response = await httpClient({
|
|
1204
|
+
* url,
|
|
1205
|
+
* method: config.method,
|
|
1206
|
+
* headers: config.headers,
|
|
1207
|
+
* ...config
|
|
1208
|
+
* });
|
|
1209
|
+
* // Convert axios-like response to fetch-like Response
|
|
1210
|
+
* return {
|
|
1211
|
+
* ok: response.status >= 200 && response.status < 300,
|
|
1212
|
+
* status: response.status,
|
|
1213
|
+
* statusText: response.statusText,
|
|
1214
|
+
* json: () => Promise.resolve(response.data),
|
|
1215
|
+
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1216
|
+
* } as Response;
|
|
1217
|
+
* }
|
|
1218
|
+
* });
|
|
1219
|
+
* console.log(userProfile);
|
|
1220
|
+
* } catch (error) {
|
|
1221
|
+
* if (error instanceof ThunderIDAPIError) {
|
|
1222
|
+
* console.error('Failed to get user profile:', error.message);
|
|
2418
1223
|
* }
|
|
2419
|
-
* }
|
|
1224
|
+
* }
|
|
2420
1225
|
* ```
|
|
2421
1226
|
*/
|
|
2422
|
-
const
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
const
|
|
2429
|
-
const
|
|
2430
|
-
|
|
2431
|
-
verbose: true
|
|
2432
|
-
} : cleanPayload;
|
|
2433
|
-
if ("flowType" in requestPayload && requestPayload["flowType"] !== EmbeddedFlowType.UserOnboarding) requestPayload["flowType"] = EmbeddedFlowType.UserOnboarding;
|
|
2434
|
-
const response = await fetch(endpoint, {
|
|
1227
|
+
const getScim2Me = async ({ url, baseUrl, fetcher,...requestConfig }) => {
|
|
1228
|
+
try {
|
|
1229
|
+
new URL(url ?? baseUrl);
|
|
1230
|
+
} catch (error$1) {
|
|
1231
|
+
throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "getScim2Me-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
|
|
1232
|
+
}
|
|
1233
|
+
const fetchFn = fetcher || fetch;
|
|
1234
|
+
const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
|
|
1235
|
+
const requestInit = {
|
|
2435
1236
|
...requestConfig,
|
|
2436
|
-
body: JSON.stringify(requestPayload),
|
|
2437
1237
|
headers: {
|
|
2438
1238
|
Accept: "application/json",
|
|
2439
|
-
"Content-Type": "application/json",
|
|
1239
|
+
"Content-Type": "application/scim+json",
|
|
2440
1240
|
...requestConfig.headers
|
|
2441
1241
|
},
|
|
2442
|
-
method:
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
|
|
1242
|
+
method: "GET"
|
|
1243
|
+
};
|
|
1244
|
+
try {
|
|
1245
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1246
|
+
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getScim2Me-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch user profile");
|
|
1247
|
+
return processUsername_default(await response.json());
|
|
1248
|
+
} catch (error$1) {
|
|
1249
|
+
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1250
|
+
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getScim2Me-NetworkError-001", "javascript", 0, "Network Error");
|
|
1251
|
+
}
|
|
2446
1252
|
};
|
|
2447
|
-
var
|
|
1253
|
+
var getScim2Me_default = getScim2Me;
|
|
2448
1254
|
|
|
2449
1255
|
//#endregion
|
|
2450
|
-
//#region src/api/
|
|
1256
|
+
//#region src/api/getSchemas.ts
|
|
2451
1257
|
/**
|
|
2452
|
-
*
|
|
2453
|
-
*
|
|
2454
|
-
* The response includes:
|
|
2455
|
-
* - Application or OU details depending on the `type` parameter
|
|
2456
|
-
* - Resolved design configuration (theme and layout)
|
|
2457
|
-
* - i18n translations filtered by `language` and `namespace`
|
|
2458
|
-
* - Registration flow enablement status
|
|
2459
|
-
*
|
|
2460
|
-
* @param config - Request configuration including `baseUrl`/`url`, and optional
|
|
2461
|
-
* `type`, `id`, `language`, and `namespace` filters. When `type`
|
|
2462
|
-
* and `id` are omitted the server returns i18n-only metadata.
|
|
2463
|
-
* @returns A promise that resolves to the {@link FlowMetadataResponse}.
|
|
2464
|
-
*
|
|
2465
|
-
* @throws {ThunderIDAPIError} When the server returns a non-OK response.
|
|
1258
|
+
* Retrieves the SCIM2 schemas from the specified endpoint.
|
|
2466
1259
|
*
|
|
1260
|
+
* @param config - Request configuration object.
|
|
1261
|
+
* @returns A promise that resolves with the SCIM2 schemas information.
|
|
2467
1262
|
* @example
|
|
2468
1263
|
* ```typescript
|
|
2469
|
-
*
|
|
2470
|
-
*
|
|
2471
|
-
*
|
|
2472
|
-
*
|
|
2473
|
-
*
|
|
2474
|
-
*
|
|
2475
|
-
*
|
|
2476
|
-
*
|
|
2477
|
-
*
|
|
2478
|
-
*
|
|
2479
|
-
*
|
|
2480
|
-
* console.log(meta.application?.name);
|
|
2481
|
-
* console.log(meta.i18n.translations);
|
|
1264
|
+
* // Using default fetch
|
|
1265
|
+
* try {
|
|
1266
|
+
* const schemas = await getSchemas({
|
|
1267
|
+
* url: "https://localhost:8090/scim2/Schemas",
|
|
1268
|
+
* });
|
|
1269
|
+
* console.log(schemas);
|
|
1270
|
+
* } catch (error) {
|
|
1271
|
+
* if (error instanceof ThunderIDAPIError) {
|
|
1272
|
+
* console.error('Failed to get schemas:', error.message);
|
|
1273
|
+
* }
|
|
1274
|
+
* }
|
|
2482
1275
|
* ```
|
|
2483
1276
|
*
|
|
2484
|
-
* @
|
|
1277
|
+
* @example
|
|
1278
|
+
* ```typescript
|
|
1279
|
+
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1280
|
+
* try {
|
|
1281
|
+
* const schemas = await getSchemas({
|
|
1282
|
+
* url: "https://localhost:8090/scim2/Schemas",
|
|
1283
|
+
* fetcher: async (url, config) => {
|
|
1284
|
+
* const response = await httpClient({
|
|
1285
|
+
* url,
|
|
1286
|
+
* method: config.method,
|
|
1287
|
+
* headers: config.headers,
|
|
1288
|
+
* ...config
|
|
1289
|
+
* });
|
|
1290
|
+
* // Convert axios-like response to fetch-like Response
|
|
1291
|
+
* return {
|
|
1292
|
+
* ok: response.status >= 200 && response.status < 300,
|
|
1293
|
+
* status: response.status,
|
|
1294
|
+
* statusText: response.statusText,
|
|
1295
|
+
* json: () => Promise.resolve(response.data),
|
|
1296
|
+
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1297
|
+
* } as Response;
|
|
1298
|
+
* }
|
|
1299
|
+
* });
|
|
1300
|
+
* console.log(schemas);
|
|
1301
|
+
* } catch (error) {
|
|
1302
|
+
* if (error instanceof ThunderIDAPIError) {
|
|
1303
|
+
* console.error('Failed to get schemas:', error.message);
|
|
1304
|
+
* }
|
|
1305
|
+
* }
|
|
1306
|
+
* ```
|
|
2485
1307
|
*/
|
|
2486
|
-
const
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
const
|
|
2494
|
-
const
|
|
1308
|
+
const getSchemas = async ({ url, baseUrl, fetcher,...requestConfig }) => {
|
|
1309
|
+
try {
|
|
1310
|
+
new URL(url ?? baseUrl);
|
|
1311
|
+
} catch (error$1) {
|
|
1312
|
+
throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "getSchemas-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
|
|
1313
|
+
}
|
|
1314
|
+
const fetchFn = fetcher || fetch;
|
|
1315
|
+
const resolvedUrl = url ?? `${baseUrl}/scim2/Schemas`;
|
|
1316
|
+
const requestInit = {
|
|
2495
1317
|
...requestConfig,
|
|
2496
1318
|
headers: {
|
|
2497
1319
|
Accept: "application/json",
|
|
1320
|
+
"Content-Type": "application/json",
|
|
2498
1321
|
...requestConfig.headers
|
|
2499
1322
|
},
|
|
2500
1323
|
method: "GET"
|
|
2501
|
-
}
|
|
2502
|
-
|
|
2503
|
-
|
|
1324
|
+
};
|
|
1325
|
+
try {
|
|
1326
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1327
|
+
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getSchemas-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch SCIM2 schemas");
|
|
1328
|
+
return await response.json();
|
|
1329
|
+
} catch (error$1) {
|
|
1330
|
+
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1331
|
+
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getSchemas-NetworkError-001", "javascript", 0, "Network Error");
|
|
1332
|
+
}
|
|
2504
1333
|
};
|
|
2505
|
-
var
|
|
1334
|
+
var getSchemas_default = getSchemas;
|
|
2506
1335
|
|
|
2507
1336
|
//#endregion
|
|
2508
|
-
//#region src/api/
|
|
1337
|
+
//#region src/api/updateMeProfile.ts
|
|
2509
1338
|
/**
|
|
2510
|
-
*
|
|
2511
|
-
*
|
|
2512
|
-
* @param config - Request configuration including `baseUrl`/`url`, `organizationUnitId`,
|
|
2513
|
-
* and optional `limit`/`offset` pagination parameters.
|
|
2514
|
-
* @returns A promise that resolves with the paginated list of child organization units.
|
|
2515
|
-
*
|
|
2516
|
-
* @throws {ThunderIDAPIError} When the server returns a non-OK response.
|
|
1339
|
+
* Updates the user profile information at the specified SCIM2 Me endpoint.
|
|
2517
1340
|
*
|
|
1341
|
+
* @param config - Configuration object with URL, payload and optional request config.
|
|
1342
|
+
* @returns A promise that resolves with the updated user profile information.
|
|
2518
1343
|
* @example
|
|
2519
1344
|
* ```typescript
|
|
2520
|
-
*
|
|
2521
|
-
*
|
|
2522
|
-
*
|
|
2523
|
-
*
|
|
2524
|
-
* offset: 0,
|
|
1345
|
+
* // Using default fetch
|
|
1346
|
+
* await updateMeProfile({
|
|
1347
|
+
* url: "https://localhost:8090/scim2/Me",
|
|
1348
|
+
* payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } }
|
|
2525
1349
|
* });
|
|
2526
|
-
* console.log(children.organizationUnits);
|
|
2527
1350
|
* ```
|
|
2528
1351
|
*
|
|
2529
|
-
* @
|
|
1352
|
+
* @example
|
|
1353
|
+
* ```typescript
|
|
1354
|
+
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1355
|
+
* await updateMeProfile({
|
|
1356
|
+
* url: "https://localhost:8090/scim2/Me",
|
|
1357
|
+
* payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } },
|
|
1358
|
+
* fetcher: async (url, config) => {
|
|
1359
|
+
* const response = await httpClient({
|
|
1360
|
+
* url,
|
|
1361
|
+
* method: config.method,
|
|
1362
|
+
* headers: config.headers,
|
|
1363
|
+
* data: config.body,
|
|
1364
|
+
* ...config
|
|
1365
|
+
* });
|
|
1366
|
+
* // Convert axios-like response to fetch-like Response
|
|
1367
|
+
* return {
|
|
1368
|
+
* ok: response.status >= 200 && response.status < 300,
|
|
1369
|
+
* status: response.status,
|
|
1370
|
+
* statusText: response.statusText,
|
|
1371
|
+
* json: () => Promise.resolve(response.data),
|
|
1372
|
+
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1373
|
+
* } as Response;
|
|
1374
|
+
* }
|
|
1375
|
+
* });
|
|
1376
|
+
* ```
|
|
2530
1377
|
*/
|
|
2531
|
-
const
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
}
|
|
2537
|
-
const
|
|
2538
|
-
|
|
1378
|
+
const updateMeProfile = async ({ url, baseUrl, payload, fetcher,...requestConfig }) => {
|
|
1379
|
+
try {
|
|
1380
|
+
new URL(url ?? baseUrl);
|
|
1381
|
+
} catch (error$1) {
|
|
1382
|
+
throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "updateMeProfile-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
|
|
1383
|
+
}
|
|
1384
|
+
const data = {
|
|
1385
|
+
Operations: [{
|
|
1386
|
+
op: "replace",
|
|
1387
|
+
value: payload
|
|
1388
|
+
}],
|
|
1389
|
+
schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]
|
|
1390
|
+
};
|
|
1391
|
+
const fetchFn = fetcher || fetch;
|
|
1392
|
+
const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
|
|
1393
|
+
const requestInit = {
|
|
1394
|
+
method: "PATCH",
|
|
2539
1395
|
...requestConfig,
|
|
1396
|
+
body: JSON.stringify(data),
|
|
2540
1397
|
headers: {
|
|
1398
|
+
...requestConfig.headers,
|
|
2541
1399
|
Accept: "application/json",
|
|
2542
|
-
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
1400
|
+
"Content-Type": "application/scim+json"
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
try {
|
|
1404
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1405
|
+
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "updateMeProfile-ResponseError-001", "javascript", response.status, response.statusText, "Failed to update user profile");
|
|
1406
|
+
return processUsername_default(await response.json());
|
|
1407
|
+
} catch (error$1) {
|
|
1408
|
+
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1409
|
+
throw new ThunderIDAPIError(error$1?.response?.data?.detail || "An error occurred while updating the user profile. Please try again.", "updateMeProfile-NetworkError-001", "javascript", error$1?.data?.status, "Network Error");
|
|
1410
|
+
}
|
|
2548
1411
|
};
|
|
2549
|
-
var
|
|
1412
|
+
var updateMeProfile_default = updateMeProfile;
|
|
2550
1413
|
|
|
2551
1414
|
//#endregion
|
|
2552
1415
|
//#region src/constants/ApplicationNativeAuthenticationConstants.ts
|
|
@@ -2688,198 +1551,52 @@ const VendorConstants = { VENDOR_PREFIX: "thunderid" };
|
|
|
2688
1551
|
var VendorConstants_default = VendorConstants;
|
|
2689
1552
|
|
|
2690
1553
|
//#endregion
|
|
2691
|
-
//#region src/
|
|
2692
|
-
let EmbeddedSignInFlowStatus = /* @__PURE__ */ function(EmbeddedSignInFlowStatus$2) {
|
|
2693
|
-
EmbeddedSignInFlowStatus$2["FailCompleted"] = "FAIL_COMPLETED";
|
|
2694
|
-
EmbeddedSignInFlowStatus$2["FailIncomplete"] = "FAIL_INCOMPLETE";
|
|
2695
|
-
EmbeddedSignInFlowStatus$2["Incomplete"] = "INCOMPLETE";
|
|
2696
|
-
EmbeddedSignInFlowStatus$2["SuccessCompleted"] = "SUCCESS_COMPLETED";
|
|
2697
|
-
return EmbeddedSignInFlowStatus$2;
|
|
2698
|
-
}({});
|
|
2699
|
-
let EmbeddedSignInFlowType = /* @__PURE__ */ function(EmbeddedSignInFlowType$2) {
|
|
2700
|
-
EmbeddedSignInFlowType$2["Authentication"] = "AUTHENTICATION";
|
|
2701
|
-
return EmbeddedSignInFlowType$2;
|
|
2702
|
-
}({});
|
|
2703
|
-
let EmbeddedSignInFlowStepType = /* @__PURE__ */ function(EmbeddedSignInFlowStepType$1) {
|
|
2704
|
-
EmbeddedSignInFlowStepType$1["AuthenticatorPrompt"] = "AUTHENTICATOR_PROMPT";
|
|
2705
|
-
EmbeddedSignInFlowStepType$1["MultiOptionsPrompt"] = "MULTI_OPTIONS_PROMPT";
|
|
2706
|
-
return EmbeddedSignInFlowStepType$1;
|
|
2707
|
-
}({});
|
|
2708
|
-
let EmbeddedSignInFlowAuthenticatorParamType = /* @__PURE__ */ function(EmbeddedSignInFlowAuthenticatorParamType$1) {
|
|
2709
|
-
EmbeddedSignInFlowAuthenticatorParamType$1["Integer"] = "INTEGER";
|
|
2710
|
-
EmbeddedSignInFlowAuthenticatorParamType$1["MultiValued"] = "MULTI_VALUED";
|
|
2711
|
-
EmbeddedSignInFlowAuthenticatorParamType$1["String"] = "STRING";
|
|
2712
|
-
return EmbeddedSignInFlowAuthenticatorParamType$1;
|
|
2713
|
-
}({});
|
|
2714
|
-
let EmbeddedSignInFlowAuthenticatorExtendedParamType = /* @__PURE__ */ function(EmbeddedSignInFlowAuthenticatorExtendedParamType$1) {
|
|
2715
|
-
EmbeddedSignInFlowAuthenticatorExtendedParamType$1["Otp"] = "OTPCode";
|
|
2716
|
-
return EmbeddedSignInFlowAuthenticatorExtendedParamType$1;
|
|
2717
|
-
}({});
|
|
2718
|
-
let EmbeddedSignInFlowAuthenticatorKnownIdPType = /* @__PURE__ */ function(EmbeddedSignInFlowAuthenticatorKnownIdPType$1) {
|
|
2719
|
-
EmbeddedSignInFlowAuthenticatorKnownIdPType$1["Local"] = "LOCAL";
|
|
2720
|
-
return EmbeddedSignInFlowAuthenticatorKnownIdPType$1;
|
|
2721
|
-
}({});
|
|
2722
|
-
let EmbeddedSignInFlowAuthenticatorPromptType = /* @__PURE__ */ function(EmbeddedSignInFlowAuthenticatorPromptType$1) {
|
|
2723
|
-
/**
|
|
2724
|
-
* Prompt for internal system use, such as API keys or tokens.
|
|
2725
|
-
*/
|
|
2726
|
-
EmbeddedSignInFlowAuthenticatorPromptType$1["InternalPrompt"] = "INTERNAL_PROMPT";
|
|
2727
|
-
/**
|
|
2728
|
-
* Prompt for redirection to another page or service.
|
|
2729
|
-
*/
|
|
2730
|
-
EmbeddedSignInFlowAuthenticatorPromptType$1["RedirectionPrompt"] = "REDIRECTION_PROMPT";
|
|
2731
|
-
/**
|
|
2732
|
-
* Prompt for user input, typically for username/password or similar credentials.
|
|
2733
|
-
*/
|
|
2734
|
-
EmbeddedSignInFlowAuthenticatorPromptType$1["UserPrompt"] = "USER_PROMPT";
|
|
2735
|
-
return EmbeddedSignInFlowAuthenticatorPromptType$1;
|
|
2736
|
-
}({});
|
|
2737
|
-
|
|
2738
|
-
//#endregion
|
|
2739
|
-
//#region src/models/v2/embedded-flow-v2.ts
|
|
1554
|
+
//#region src/errors/ThunderIDRuntimeError.ts
|
|
2740
1555
|
/**
|
|
2741
|
-
*
|
|
2742
|
-
*
|
|
2743
|
-
*
|
|
2744
|
-
* as part of the embedded authentication flows. Each type corresponds
|
|
2745
|
-
* to a specific UI element with its own behavior and properties.
|
|
1556
|
+
* Base class for all runtime errors in ThunderID. This class extends ThunderIDError
|
|
1557
|
+
* and adds support for additional error details. Use this class for errors that occur
|
|
1558
|
+
* during runtime execution that are not related to API calls.
|
|
2746
1559
|
*
|
|
2747
1560
|
* @example
|
|
2748
1561
|
* ```typescript
|
|
2749
|
-
*
|
|
2750
|
-
*
|
|
2751
|
-
*
|
|
2752
|
-
*
|
|
2753
|
-
*
|
|
2754
|
-
* }
|
|
1562
|
+
* throw new ThunderIDRuntimeError(
|
|
1563
|
+
* "Failed to parse configuration",
|
|
1564
|
+
* "CONFIG_PARSE_ERROR",
|
|
1565
|
+
* { invalidField: "redirectUri" }
|
|
1566
|
+
* );
|
|
2755
1567
|
* ```
|
|
2756
|
-
*
|
|
2757
|
-
* @experimental This API may change in future versions
|
|
2758
1568
|
*/
|
|
2759
|
-
|
|
2760
|
-
/**
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
/**
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
EmbeddedFlowComponentType$2["Select"] = "SELECT";
|
|
2788
|
-
/** Stack layout component for arranging children in a row or column */
|
|
2789
|
-
EmbeddedFlowComponentType$2["Stack"] = "STACK";
|
|
2790
|
-
/** Text display component for labels, headings, and messages */
|
|
2791
|
-
EmbeddedFlowComponentType$2["Text"] = "TEXT";
|
|
2792
|
-
/** Standard text input field for user data entry */
|
|
2793
|
-
EmbeddedFlowComponentType$2["TextInput"] = "TEXT_INPUT";
|
|
2794
|
-
/** Timer component for displaying a countdown */
|
|
2795
|
-
EmbeddedFlowComponentType$2["Timer"] = "TIMER";
|
|
2796
|
-
/** QR code display component for wallet-based flows (e.g. OpenID4VP) */
|
|
2797
|
-
EmbeddedFlowComponentType$2["QrCode"] = "QR_CODE";
|
|
2798
|
-
return EmbeddedFlowComponentType$2;
|
|
2799
|
-
}({});
|
|
2800
|
-
/**
|
|
2801
|
-
* Action variant types for buttons and interactive elements.
|
|
2802
|
-
*
|
|
2803
|
-
* @experimental This API may change in future versions
|
|
2804
|
-
*/
|
|
2805
|
-
let EmbeddedFlowActionVariant = /* @__PURE__ */ function(EmbeddedFlowActionVariant$1) {
|
|
2806
|
-
/** Danger action button for destructive operations */
|
|
2807
|
-
EmbeddedFlowActionVariant$1["Danger"] = "DANGER";
|
|
2808
|
-
/** Info action button for informational purposes */
|
|
2809
|
-
EmbeddedFlowActionVariant$1["Info"] = "INFO";
|
|
2810
|
-
/** Link-styled action button */
|
|
2811
|
-
EmbeddedFlowActionVariant$1["Link"] = "LINK";
|
|
2812
|
-
/** Outlined action button for secondary emphasis */
|
|
2813
|
-
EmbeddedFlowActionVariant$1["Outlined"] = "OUTLINED";
|
|
2814
|
-
/** Primary action button with highest visual emphasis */
|
|
2815
|
-
EmbeddedFlowActionVariant$1["Primary"] = "PRIMARY";
|
|
2816
|
-
/** Secondary action button with moderate visual emphasis */
|
|
2817
|
-
EmbeddedFlowActionVariant$1["Secondary"] = "SECONDARY";
|
|
2818
|
-
/** Success action button for positive confirmations */
|
|
2819
|
-
EmbeddedFlowActionVariant$1["Success"] = "SUCCESS";
|
|
2820
|
-
/** Tertiary action button with minimal visual emphasis */
|
|
2821
|
-
EmbeddedFlowActionVariant$1["Tertiary"] = "TERTIARY";
|
|
2822
|
-
/** Warning action button for cautionary actions */
|
|
2823
|
-
EmbeddedFlowActionVariant$1["Warning"] = "WARNING";
|
|
2824
|
-
return EmbeddedFlowActionVariant$1;
|
|
2825
|
-
}({});
|
|
2826
|
-
/**
|
|
2827
|
-
* Text variant types for typography components.
|
|
2828
|
-
*
|
|
2829
|
-
* @experimental This API may change in future versions
|
|
2830
|
-
*/
|
|
2831
|
-
let EmbeddedFlowTextVariant = /* @__PURE__ */ function(EmbeddedFlowTextVariant$1) {
|
|
2832
|
-
/** Primary body text for main content */
|
|
2833
|
-
EmbeddedFlowTextVariant$1["Body1"] = "BODY_1";
|
|
2834
|
-
/** Secondary body text for supplementary content */
|
|
2835
|
-
EmbeddedFlowTextVariant$1["Body2"] = "BODY_2";
|
|
2836
|
-
/** Text styled for button labels */
|
|
2837
|
-
EmbeddedFlowTextVariant$1["ButtonText"] = "BUTTON_TEXT";
|
|
2838
|
-
/** Small caption text for annotations and descriptions */
|
|
2839
|
-
EmbeddedFlowTextVariant$1["Caption"] = "CAPTION";
|
|
2840
|
-
/** Largest heading level for main titles */
|
|
2841
|
-
EmbeddedFlowTextVariant$1["Heading1"] = "HEADING_1";
|
|
2842
|
-
/** Second level heading for major sections */
|
|
2843
|
-
EmbeddedFlowTextVariant$1["Heading2"] = "HEADING_2";
|
|
2844
|
-
/** Third level heading for subsections */
|
|
2845
|
-
EmbeddedFlowTextVariant$1["Heading3"] = "HEADING_3";
|
|
2846
|
-
/** Fourth level heading for minor sections */
|
|
2847
|
-
EmbeddedFlowTextVariant$1["Heading4"] = "HEADING_4";
|
|
2848
|
-
/** Fifth level heading for detailed sections */
|
|
2849
|
-
EmbeddedFlowTextVariant$1["Heading5"] = "HEADING_5";
|
|
2850
|
-
/** Smallest heading level for fine-grained sections */
|
|
2851
|
-
EmbeddedFlowTextVariant$1["Heading6"] = "HEADING_6";
|
|
2852
|
-
/** Overline text for labels and categories */
|
|
2853
|
-
EmbeddedFlowTextVariant$1["Overline"] = "OVERLINE";
|
|
2854
|
-
/** Primary subtitle text with larger emphasis */
|
|
2855
|
-
EmbeddedFlowTextVariant$1["Subtitle1"] = "SUBTITLE_1";
|
|
2856
|
-
/** Secondary subtitle text with moderate emphasis */
|
|
2857
|
-
EmbeddedFlowTextVariant$1["Subtitle2"] = "SUBTITLE_2";
|
|
2858
|
-
return EmbeddedFlowTextVariant$1;
|
|
2859
|
-
}({});
|
|
2860
|
-
/**
|
|
2861
|
-
* Event types for action components.
|
|
2862
|
-
*
|
|
2863
|
-
* @experimental This API may change in future versions
|
|
2864
|
-
*/
|
|
2865
|
-
let EmbeddedFlowEventType = /* @__PURE__ */ function(EmbeddedFlowEventType$1) {
|
|
2866
|
-
/** Navigate back to the previous step */
|
|
2867
|
-
EmbeddedFlowEventType$1["Back"] = "BACK";
|
|
2868
|
-
/** Cancel the current operation */
|
|
2869
|
-
EmbeddedFlowEventType$1["Cancel"] = "CANCEL";
|
|
2870
|
-
/** Navigate to a different flow step or page */
|
|
2871
|
-
EmbeddedFlowEventType$1["Navigate"] = "NAVIGATE";
|
|
2872
|
-
/** Reset form fields to initial state */
|
|
2873
|
-
EmbeddedFlowEventType$1["Reset"] = "RESET";
|
|
2874
|
-
/** Submit form data to the server */
|
|
2875
|
-
EmbeddedFlowEventType$1["Submit"] = "SUBMIT";
|
|
2876
|
-
/** Trigger an action or event */
|
|
2877
|
-
EmbeddedFlowEventType$1["Trigger"] = "TRIGGER";
|
|
2878
|
-
return EmbeddedFlowEventType$1;
|
|
2879
|
-
}({});
|
|
1569
|
+
var ThunderIDRuntimeError = class extends ThunderIDError {
|
|
1570
|
+
/**
|
|
1571
|
+
* Creates an instance of ThunderIDRuntimeError.
|
|
1572
|
+
*
|
|
1573
|
+
* @param message - Human-readable description of the error
|
|
1574
|
+
* @param code - A unique error code that identifies the error type
|
|
1575
|
+
* @param details - Additional details about the error that might be helpful for debugging
|
|
1576
|
+
* @param origin - Optional. The SDK origin (e.g. 'react', 'vue'). Defaults to generic 'ThunderID'
|
|
1577
|
+
* @constructor
|
|
1578
|
+
*/
|
|
1579
|
+
constructor(message, code, origin, details) {
|
|
1580
|
+
super(message, code, origin);
|
|
1581
|
+
this.details = details;
|
|
1582
|
+
Object.defineProperty(this, "name", {
|
|
1583
|
+
configurable: true,
|
|
1584
|
+
value: "ThunderIDRuntimeError",
|
|
1585
|
+
writable: true
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* Returns a string representation of the runtime error
|
|
1590
|
+
* @returns Formatted error string with name, code, details, and message
|
|
1591
|
+
*/
|
|
1592
|
+
toString() {
|
|
1593
|
+
const details = this.details ? `\nDetails: ${JSON.stringify(this.details, null, 2)}` : "";
|
|
1594
|
+
return `[${this.name}] (code="${this.code}")${details}\nMessage: ${this.message}`;
|
|
1595
|
+
}
|
|
1596
|
+
};
|
|
2880
1597
|
|
|
2881
1598
|
//#endregion
|
|
2882
|
-
//#region src/models/
|
|
1599
|
+
//#region src/models/embedded-recovery-flow.ts
|
|
2883
1600
|
/**
|
|
2884
1601
|
* Status enumeration for the embedded recovery flow operations.
|
|
2885
1602
|
*
|
|
@@ -2920,7 +1637,7 @@ let EmbeddedRecoveryFlowType = /* @__PURE__ */ function(EmbeddedRecoveryFlowType
|
|
|
2920
1637
|
}({});
|
|
2921
1638
|
|
|
2922
1639
|
//#endregion
|
|
2923
|
-
//#region src/models/
|
|
1640
|
+
//#region src/models/flow-meta.ts
|
|
2924
1641
|
/**
|
|
2925
1642
|
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
2926
1643
|
*
|
|
@@ -3244,47 +1961,346 @@ var DefaultCrypto = class {
|
|
|
3244
1961
|
});
|
|
3245
1962
|
return true;
|
|
3246
1963
|
}
|
|
3247
|
-
};
|
|
3248
|
-
|
|
3249
|
-
//#endregion
|
|
3250
|
-
//#region src/models/
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
1964
|
+
};
|
|
1965
|
+
|
|
1966
|
+
//#endregion
|
|
1967
|
+
//#region src/models/store.ts
|
|
1968
|
+
/**
|
|
1969
|
+
* Enum representing different types of data stores used in the application.
|
|
1970
|
+
*/
|
|
1971
|
+
let Stores = /* @__PURE__ */ function(Stores$1) {
|
|
1972
|
+
/**
|
|
1973
|
+
* Store for configuration data that defines the application's behavior and settings.
|
|
1974
|
+
*/
|
|
1975
|
+
Stores$1["ConfigData"] = "config_data";
|
|
1976
|
+
/**
|
|
1977
|
+
* Store for OpenID Connect provider metadata, including endpoints and configuration.
|
|
1978
|
+
*/
|
|
1979
|
+
Stores$1["OIDCProviderMetaData"] = "oidc_provider_meta_data";
|
|
1980
|
+
/**
|
|
1981
|
+
* Store for persisted data that needs to be retained across sessions and application restarts.
|
|
1982
|
+
*/
|
|
1983
|
+
Stores$1["PersistedData"] = "persisted_data";
|
|
1984
|
+
/**
|
|
1985
|
+
* Store for user session-related data like tokens and authentication state.
|
|
1986
|
+
*/
|
|
1987
|
+
Stores$1["SessionData"] = "session_data";
|
|
1988
|
+
/**
|
|
1989
|
+
* Store for temporary data that needs to persist only for a short duration.
|
|
1990
|
+
*/
|
|
1991
|
+
Stores$1["TemporaryData"] = "temporary_data";
|
|
1992
|
+
/**
|
|
1993
|
+
* Store for data that leverages local storage if available, falling back to the configured storage.
|
|
1994
|
+
*/
|
|
1995
|
+
Stores$1["HybridData"] = "hybrid_data";
|
|
1996
|
+
return Stores$1;
|
|
1997
|
+
}({});
|
|
1998
|
+
|
|
1999
|
+
//#endregion
|
|
2000
|
+
//#region src/utils/logger.ts
|
|
2001
|
+
const PREFIX = "⚡ ThunderID";
|
|
2002
|
+
/**
|
|
2003
|
+
* Default logger configuration
|
|
2004
|
+
*/
|
|
2005
|
+
const DEFAULT_CONFIG$1 = {
|
|
2006
|
+
level: "info",
|
|
2007
|
+
prefix: `${PREFIX}`,
|
|
2008
|
+
showLevel: true,
|
|
2009
|
+
timestamps: true
|
|
2010
|
+
};
|
|
2011
|
+
/**
|
|
2012
|
+
* Environment detection utilities
|
|
2013
|
+
*/
|
|
2014
|
+
const isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
2015
|
+
const isNode = () => typeof process !== "undefined" && void 0;
|
|
2016
|
+
/**
|
|
2017
|
+
* Color codes for terminal output (Node.js)
|
|
2018
|
+
*/
|
|
2019
|
+
const COLORS = {
|
|
2020
|
+
blue: "\x1B[34m",
|
|
2021
|
+
bright: "\x1B[1m",
|
|
2022
|
+
cyan: "\x1B[36m",
|
|
2023
|
+
dim: "\x1B[2m",
|
|
2024
|
+
gray: "\x1B[90m",
|
|
2025
|
+
green: "\x1B[32m",
|
|
2026
|
+
magenta: "\x1B[35m",
|
|
2027
|
+
red: "\x1B[31m",
|
|
2028
|
+
reset: "\x1B[0m",
|
|
2029
|
+
white: "\x1B[37m",
|
|
2030
|
+
yellow: "\x1B[33m"
|
|
2031
|
+
};
|
|
2032
|
+
/**
|
|
2033
|
+
* Browser console styling
|
|
2034
|
+
*/
|
|
2035
|
+
const BROWSER_STYLES = {
|
|
2036
|
+
debug: "color: #6b7280; font-weight: normal;",
|
|
2037
|
+
error: "color: #dc2626; font-weight: bold;",
|
|
2038
|
+
info: "color: #2563eb; font-weight: bold;",
|
|
2039
|
+
prefix: "color: #7c3aed; font-weight: bold;",
|
|
2040
|
+
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
2041
|
+
warn: "color: #d97706; font-weight: bold;"
|
|
2042
|
+
};
|
|
2043
|
+
const LOG_LEVEL_ORDER = {
|
|
2044
|
+
debug: 0,
|
|
2045
|
+
error: 3,
|
|
2046
|
+
info: 1,
|
|
2047
|
+
warn: 2
|
|
2048
|
+
};
|
|
2049
|
+
/**
|
|
2050
|
+
* Universal logger class that works in both browser and Node.js environments
|
|
2051
|
+
*/
|
|
2052
|
+
var Logger = class Logger {
|
|
2053
|
+
config;
|
|
2054
|
+
constructor(config = {}) {
|
|
2055
|
+
this.config = {
|
|
2056
|
+
...DEFAULT_CONFIG$1,
|
|
2057
|
+
...config
|
|
2058
|
+
};
|
|
2059
|
+
}
|
|
2060
|
+
/**
|
|
2061
|
+
* Update logger configuration
|
|
2062
|
+
*/
|
|
2063
|
+
configure(config) {
|
|
2064
|
+
this.config = {
|
|
2065
|
+
...this.config,
|
|
2066
|
+
...config
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
/**
|
|
2070
|
+
* Get current configuration
|
|
2071
|
+
*/
|
|
2072
|
+
getConfig() {
|
|
2073
|
+
return { ...this.config };
|
|
2074
|
+
}
|
|
2075
|
+
/**
|
|
2076
|
+
* Check if a log level should be output
|
|
2077
|
+
*/
|
|
2078
|
+
shouldLog(level) {
|
|
2079
|
+
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
2080
|
+
}
|
|
2081
|
+
/**
|
|
2082
|
+
* Get timestamp string
|
|
2083
|
+
*/
|
|
2084
|
+
static getTimestamp() {
|
|
2085
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
2086
|
+
}
|
|
2087
|
+
/**
|
|
2088
|
+
* Get log level string
|
|
2089
|
+
*/
|
|
2090
|
+
static getLevelString(level) {
|
|
2091
|
+
switch (level) {
|
|
2092
|
+
case "debug": return "DEBUG";
|
|
2093
|
+
case "info": return "INFO";
|
|
2094
|
+
case "warn": return "WARN";
|
|
2095
|
+
case "error": return "ERROR";
|
|
2096
|
+
default: return "UNKNOWN";
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
/**
|
|
2100
|
+
* Format message for Node.js terminal
|
|
2101
|
+
*/
|
|
2102
|
+
formatForNode(level, message) {
|
|
2103
|
+
const parts = [];
|
|
2104
|
+
if (this.config.timestamps) parts.push(`${COLORS.gray}[${Logger.getTimestamp()}]${COLORS.reset}`);
|
|
2105
|
+
if (this.config.prefix) parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);
|
|
2106
|
+
if (this.config.showLevel) {
|
|
2107
|
+
const levelStr = Logger.getLevelString(level);
|
|
2108
|
+
let coloredLevel;
|
|
2109
|
+
switch (level) {
|
|
2110
|
+
case "debug":
|
|
2111
|
+
coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
|
|
2112
|
+
break;
|
|
2113
|
+
case "info":
|
|
2114
|
+
coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
|
|
2115
|
+
break;
|
|
2116
|
+
case "warn":
|
|
2117
|
+
coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
|
|
2118
|
+
break;
|
|
2119
|
+
case "error":
|
|
2120
|
+
coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
|
|
2121
|
+
break;
|
|
2122
|
+
default: coloredLevel = `[${levelStr}]`;
|
|
2123
|
+
}
|
|
2124
|
+
parts.push(coloredLevel);
|
|
2125
|
+
}
|
|
2126
|
+
parts.push(message);
|
|
2127
|
+
return parts.join(" ");
|
|
2128
|
+
}
|
|
2129
|
+
/**
|
|
2130
|
+
* Log message using appropriate method
|
|
2131
|
+
*/
|
|
2132
|
+
logMessage(level, message, ...args) {
|
|
2133
|
+
if (!this.shouldLog(level)) return;
|
|
2134
|
+
if (this.config.formatter) {
|
|
2135
|
+
this.config.formatter(level, message, ...args);
|
|
2136
|
+
return;
|
|
2137
|
+
}
|
|
2138
|
+
if (isBrowser()) this.logToBrowser(level, message, ...args);
|
|
2139
|
+
else if (isNode()) this.logToNode(level, message, ...args);
|
|
2140
|
+
else console.log(message, ...args);
|
|
2141
|
+
}
|
|
2142
|
+
/**
|
|
2143
|
+
* Log to browser console with styling
|
|
2144
|
+
*/
|
|
2145
|
+
logToBrowser(level, message, ...args) {
|
|
2146
|
+
const parts = [];
|
|
2147
|
+
const styles = [];
|
|
2148
|
+
if (this.config.timestamps) {
|
|
2149
|
+
parts.push(`%c[${Logger.getTimestamp()}]`);
|
|
2150
|
+
styles.push(BROWSER_STYLES.timestamp);
|
|
2151
|
+
}
|
|
2152
|
+
if (this.config.prefix) {
|
|
2153
|
+
parts.push(`%c${this.config.prefix}`);
|
|
2154
|
+
styles.push(BROWSER_STYLES.prefix);
|
|
2155
|
+
}
|
|
2156
|
+
if (this.config.showLevel) {
|
|
2157
|
+
const levelStr = Logger.getLevelString(level);
|
|
2158
|
+
parts.push(`%c[${levelStr}]`);
|
|
2159
|
+
switch (level) {
|
|
2160
|
+
case "debug":
|
|
2161
|
+
styles.push(BROWSER_STYLES.debug);
|
|
2162
|
+
break;
|
|
2163
|
+
case "info":
|
|
2164
|
+
styles.push(BROWSER_STYLES.info);
|
|
2165
|
+
break;
|
|
2166
|
+
case "warn":
|
|
2167
|
+
styles.push(BROWSER_STYLES.warn);
|
|
2168
|
+
break;
|
|
2169
|
+
case "error":
|
|
2170
|
+
styles.push(BROWSER_STYLES.error);
|
|
2171
|
+
break;
|
|
2172
|
+
default: styles.push("");
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
parts.push(`%c${message}`);
|
|
2176
|
+
styles.push("color: inherit; font-weight: normal;");
|
|
2177
|
+
const formattedMessage = parts.join(" ");
|
|
2178
|
+
switch (level) {
|
|
2179
|
+
case "debug":
|
|
2180
|
+
console.debug(formattedMessage, ...styles, ...args);
|
|
2181
|
+
break;
|
|
2182
|
+
case "info":
|
|
2183
|
+
console.info(formattedMessage, ...styles, ...args);
|
|
2184
|
+
break;
|
|
2185
|
+
case "warn":
|
|
2186
|
+
console.warn(formattedMessage, ...styles, ...args);
|
|
2187
|
+
break;
|
|
2188
|
+
case "error":
|
|
2189
|
+
console.error(formattedMessage, ...styles, ...args);
|
|
2190
|
+
break;
|
|
2191
|
+
default: console.log(formattedMessage, ...styles, ...args);
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
/**
|
|
2195
|
+
* Log to Node.js console
|
|
2196
|
+
*/
|
|
2197
|
+
logToNode(level, message, ...args) {
|
|
2198
|
+
const formattedMessage = this.formatForNode(level, message);
|
|
2199
|
+
switch (level) {
|
|
2200
|
+
case "debug":
|
|
2201
|
+
console.debug(formattedMessage, ...args);
|
|
2202
|
+
break;
|
|
2203
|
+
case "info":
|
|
2204
|
+
console.info(formattedMessage, ...args);
|
|
2205
|
+
break;
|
|
2206
|
+
case "warn":
|
|
2207
|
+
console.warn(formattedMessage, ...args);
|
|
2208
|
+
break;
|
|
2209
|
+
case "error":
|
|
2210
|
+
console.error(formattedMessage, ...args);
|
|
2211
|
+
break;
|
|
2212
|
+
default: console.log(formattedMessage, ...args);
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
/**
|
|
2216
|
+
* Log debug message
|
|
2217
|
+
*/
|
|
2218
|
+
debug(message, ...args) {
|
|
2219
|
+
this.logMessage("debug", message, ...args);
|
|
2220
|
+
}
|
|
3262
2221
|
/**
|
|
3263
|
-
*
|
|
2222
|
+
* Log info message
|
|
3264
2223
|
*/
|
|
3265
|
-
|
|
2224
|
+
info(message, ...args) {
|
|
2225
|
+
this.logMessage("info", message, ...args);
|
|
2226
|
+
}
|
|
3266
2227
|
/**
|
|
3267
|
-
*
|
|
2228
|
+
* Log warning message
|
|
3268
2229
|
*/
|
|
3269
|
-
|
|
2230
|
+
warn(message, ...args) {
|
|
2231
|
+
this.logMessage("warn", message, ...args);
|
|
2232
|
+
}
|
|
3270
2233
|
/**
|
|
3271
|
-
*
|
|
2234
|
+
* Log error message
|
|
3272
2235
|
*/
|
|
3273
|
-
|
|
2236
|
+
error(message, ...args) {
|
|
2237
|
+
this.logMessage("error", message, ...args);
|
|
2238
|
+
}
|
|
3274
2239
|
/**
|
|
3275
|
-
*
|
|
2240
|
+
* Create a child logger with additional prefix
|
|
3276
2241
|
*/
|
|
3277
|
-
|
|
2242
|
+
child(prefix) {
|
|
2243
|
+
const childPrefix = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;
|
|
2244
|
+
return new Logger({
|
|
2245
|
+
...this.config,
|
|
2246
|
+
prefix: childPrefix
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
3278
2249
|
/**
|
|
3279
|
-
*
|
|
2250
|
+
* Set log level
|
|
3280
2251
|
*/
|
|
3281
|
-
|
|
2252
|
+
setLevel(level) {
|
|
2253
|
+
this.config.level = level;
|
|
2254
|
+
}
|
|
3282
2255
|
/**
|
|
3283
|
-
*
|
|
2256
|
+
* Get current log level
|
|
3284
2257
|
*/
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
}
|
|
2258
|
+
getLevel() {
|
|
2259
|
+
return this.config.level;
|
|
2260
|
+
}
|
|
2261
|
+
};
|
|
2262
|
+
/**
|
|
2263
|
+
* Default logger instance
|
|
2264
|
+
*/
|
|
2265
|
+
const logger = new Logger();
|
|
2266
|
+
/**
|
|
2267
|
+
* Create a new logger instance with custom configuration
|
|
2268
|
+
*/
|
|
2269
|
+
const createLogger = (config) => new Logger(config);
|
|
2270
|
+
/**
|
|
2271
|
+
* Default export - global logger instance
|
|
2272
|
+
*/
|
|
2273
|
+
var logger_default = logger;
|
|
2274
|
+
/**
|
|
2275
|
+
* Named exports for convenience
|
|
2276
|
+
*/
|
|
2277
|
+
const debug = (message, ...args) => logger.debug(message, ...args);
|
|
2278
|
+
const info = (message, ...args) => logger.info(message, ...args);
|
|
2279
|
+
const warn = (message, ...args) => logger.warn(message, ...args);
|
|
2280
|
+
const error = (message, ...args) => logger.error(message, ...args);
|
|
2281
|
+
/**
|
|
2282
|
+
* Configure the default logger
|
|
2283
|
+
*/
|
|
2284
|
+
const configure = (config) => logger.configure(config);
|
|
2285
|
+
/**
|
|
2286
|
+
* Create component-specific loggers
|
|
2287
|
+
*/
|
|
2288
|
+
const createComponentLogger = (component) => logger.child(component);
|
|
2289
|
+
/**
|
|
2290
|
+
* Create package-specific logger
|
|
2291
|
+
*/
|
|
2292
|
+
const createPackageLogger = (packageName) => createLogger({
|
|
2293
|
+
level: "info",
|
|
2294
|
+
prefix: `${PREFIX} - ${packageName}`,
|
|
2295
|
+
showLevel: true,
|
|
2296
|
+
timestamps: true
|
|
2297
|
+
});
|
|
2298
|
+
/**
|
|
2299
|
+
* Create package component logger (package + component)
|
|
2300
|
+
*/
|
|
2301
|
+
const createPackageComponentLogger = (packageName, component) => {
|
|
2302
|
+
return createPackageLogger(packageName).child(component);
|
|
2303
|
+
};
|
|
3288
2304
|
|
|
3289
2305
|
//#endregion
|
|
3290
2306
|
//#region src/StorageManager.ts
|
|
@@ -4224,22 +3240,10 @@ var ThunderIDJavaScriptClient = class {
|
|
|
4224
3240
|
signInSilently(_options) {
|
|
4225
3241
|
throw new Error("Method not implemented.");
|
|
4226
3242
|
}
|
|
4227
|
-
signUp(
|
|
3243
|
+
signUp(_options) {
|
|
4228
3244
|
throw new Error("Method not implemented.");
|
|
4229
3245
|
}
|
|
4230
|
-
recover(
|
|
4231
|
-
throw new Error("Method not implemented.");
|
|
4232
|
-
}
|
|
4233
|
-
switchOrganization(_organization, _sessionId) {
|
|
4234
|
-
throw new Error("Method not implemented.");
|
|
4235
|
-
}
|
|
4236
|
-
getCurrentOrganization(_sessionId) {
|
|
4237
|
-
throw new Error("Method not implemented.");
|
|
4238
|
-
}
|
|
4239
|
-
getAllOrganizations(_options, _sessionId) {
|
|
4240
|
-
throw new Error("Method not implemented.");
|
|
4241
|
-
}
|
|
4242
|
-
getMyOrganizations(_options, _sessionId) {
|
|
3246
|
+
recover() {
|
|
4243
3247
|
throw new Error("Method not implemented.");
|
|
4244
3248
|
}
|
|
4245
3249
|
getUserProfile(_options) {
|
|
@@ -4597,40 +3601,11 @@ var ThunderIDJavaScriptClient = class {
|
|
|
4597
3601
|
const error$1 = Boolean(url.searchParams.get("error"));
|
|
4598
3602
|
return stateParam ? stateParam === OIDCRequestConstants_default.Params.SIGN_OUT_SUCCESS && error$1 : false;
|
|
4599
3603
|
}
|
|
4600
|
-
async getAgentToken(agentConfig) {
|
|
4601
|
-
const authorizeURL = new URL(await this.getSignInUrl({ response_mode: "direct" }));
|
|
4602
|
-
const authorizeResponse = await initializeEmbeddedSignInFlow_default({
|
|
4603
|
-
payload: Object.fromEntries(authorizeURL.searchParams.entries()),
|
|
4604
|
-
url: `${authorizeURL.origin}${authorizeURL.pathname}`
|
|
4605
|
-
});
|
|
4606
|
-
const authenticatorName = agentConfig.authenticatorName ?? AgentConfig.DEFAULT_AUTHENTICATOR_NAME;
|
|
4607
|
-
const targetAuthenticator = authorizeResponse.nextStep.authenticators.find((auth) => auth.authenticator === authenticatorName);
|
|
4608
|
-
if (!targetAuthenticator) throw new Error(`Authenticator '${authenticatorName}' not found among authentication steps.`);
|
|
4609
|
-
const authnResponse = await executeEmbeddedSignInFlow_default({
|
|
4610
|
-
baseUrl: this.baseURL,
|
|
4611
|
-
payload: {
|
|
4612
|
-
flowId: authorizeResponse.flowId,
|
|
4613
|
-
selectedAuthenticator: {
|
|
4614
|
-
authenticatorId: targetAuthenticator.authenticatorId,
|
|
4615
|
-
params: {
|
|
4616
|
-
password: agentConfig.agentSecret,
|
|
4617
|
-
username: agentConfig.agentID
|
|
4618
|
-
}
|
|
4619
|
-
}
|
|
4620
|
-
}
|
|
4621
|
-
});
|
|
4622
|
-
if (authnResponse.flowStatus !== EmbeddedSignInFlowStatus.SuccessCompleted) throw new Error("Agent authentication failed.");
|
|
4623
|
-
return this.requestAccessToken(authnResponse.authData["code"], authnResponse.authData["session_state"], authnResponse.authData["state"]);
|
|
4624
|
-
}
|
|
4625
3604
|
async getOBOSignInURL(agentConfig) {
|
|
4626
3605
|
const authURL = await this.getSignInUrl({ requested_actor: agentConfig.agentID });
|
|
4627
3606
|
if (authURL) return authURL.toString();
|
|
4628
3607
|
throw new Error("Could not build Authorize URL");
|
|
4629
3608
|
}
|
|
4630
|
-
async getOBOToken(agentConfig, authCodeResponse) {
|
|
4631
|
-
const agentToken = await this.getAgentToken(agentConfig);
|
|
4632
|
-
return this.requestAccessToken(authCodeResponse.code, authCodeResponse.session_state, authCodeResponse.state, void 0, { params: { actor_token: agentToken.accessToken } });
|
|
4633
|
-
}
|
|
4634
3609
|
};
|
|
4635
3610
|
var ThunderIDJavaScriptClient_default = ThunderIDJavaScriptClient;
|
|
4636
3611
|
|
|
@@ -5306,48 +4281,36 @@ const formatDate = (dateString) => {
|
|
|
5306
4281
|
var formatDate_default = formatDate;
|
|
5307
4282
|
|
|
5308
4283
|
//#endregion
|
|
5309
|
-
//#region src/utils/
|
|
4284
|
+
//#region src/utils/isRecognizedBaseUrlPattern.ts
|
|
5310
4285
|
/**
|
|
5311
|
-
*
|
|
4286
|
+
* Utility to determine if sensible ThunderID fallbacks can be used based on the given base URL.
|
|
5312
4287
|
*
|
|
5313
|
-
*
|
|
4288
|
+
* This checks if the URL follows the standard ThunderID pattern: /t/{orgHandle}
|
|
4289
|
+
* Returns true if sensible fallbacks (like deriving organization handle, tenant, etc.) can be used, false otherwise.
|
|
5314
4290
|
*
|
|
5315
|
-
* @param baseUrl - The base URL of the ThunderID identity server
|
|
5316
|
-
* @returns
|
|
5317
|
-
* @throws {ThunderIDRuntimeError} When the URL doesn't match the expected ThunderID pattern,
|
|
5318
|
-
* indicating a custom domain is configured and organizationHandle must be provided explicitly
|
|
4291
|
+
* @param baseUrl - The base URL of the ThunderID identity server (string or undefined)
|
|
4292
|
+
* @returns boolean - true if sensible fallbacks can be used, false otherwise
|
|
5319
4293
|
*
|
|
5320
4294
|
* @example
|
|
5321
|
-
*
|
|
5322
|
-
*
|
|
5323
|
-
* // Returns: 'dxlab'
|
|
5324
|
-
*
|
|
5325
|
-
* // Custom domain - returns empty string with a warning
|
|
5326
|
-
* const handle2 = deriveOrganizationHandleFromBaseUrl('https://custom.example.com/auth');
|
|
5327
|
-
* // Returns: '' and logs a warning
|
|
5328
|
-
* ```
|
|
4295
|
+
* isRecognizedBaseUrlPattern('https://localhost:8090/t/dxlab'); // true
|
|
4296
|
+
* isRecognizedBaseUrlPattern('https://custom.example.com/auth'); // false
|
|
5329
4297
|
*/
|
|
5330
|
-
const
|
|
5331
|
-
if (!baseUrl) throw new ThunderIDRuntimeError("Base URL is required to derive
|
|
4298
|
+
const isRecognizedBaseUrlPattern = (baseUrl) => {
|
|
4299
|
+
if (!baseUrl) throw new ThunderIDRuntimeError("Base URL is required to derive if the `baseUrl` is recognized.", "isRecognizedBaseUrlPattern-ValidationError-001", "javascript", "A valid base URL must be provided to derive if the `baseUrl` is recognized to use the sensible fallbacks.");
|
|
5332
4300
|
let parsedUrl;
|
|
5333
4301
|
try {
|
|
5334
4302
|
parsedUrl = new URL(baseUrl);
|
|
5335
4303
|
} catch (error$1) {
|
|
5336
|
-
throw new ThunderIDRuntimeError(`Invalid base URL format: ${baseUrl}`, "
|
|
4304
|
+
throw new ThunderIDRuntimeError(`Invalid base URL format: ${baseUrl}`, "isRecognizedBaseUrlPattern-ValidationError-002", "javascript", "The provided base URL does not conform to valid URL syntax.");
|
|
5337
4305
|
}
|
|
5338
4306
|
const pathSegments = parsedUrl.pathname?.split("/")?.filter((segment) => segment?.length > 0);
|
|
5339
4307
|
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
5340
|
-
logger_default.warn(
|
|
5341
|
-
return
|
|
5342
|
-
}
|
|
5343
|
-
const organizationHandle = pathSegments[1];
|
|
5344
|
-
if (!organizationHandle || organizationHandle.trim().length === 0) {
|
|
5345
|
-
logger_default.warn(new ThunderIDRuntimeError("Organization handle is required since a custom domain is configured.", "javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-003", "javascript", "The organization handle could not be extracted from the base URL. Please provide the organizationHandle explicitly in the configuration.").toString());
|
|
5346
|
-
return "";
|
|
4308
|
+
logger_default.warn("[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle}).");
|
|
4309
|
+
return false;
|
|
5347
4310
|
}
|
|
5348
|
-
return
|
|
4311
|
+
return true;
|
|
5349
4312
|
};
|
|
5350
|
-
var
|
|
4313
|
+
var isRecognizedBaseUrlPattern_default = isRecognizedBaseUrlPattern;
|
|
5351
4314
|
|
|
5352
4315
|
//#endregion
|
|
5353
4316
|
//#region src/utils/flattenUserSchema.ts
|
|
@@ -5697,14 +4660,14 @@ var generateFlattenedUserProfile_default = generateFlattenedUserProfile;
|
|
|
5697
4660
|
* If the baseUrl is recognized (standard ThunderID pattern), constructs the sign-up URL.
|
|
5698
4661
|
* Otherwise, returns an empty string.
|
|
5699
4662
|
*
|
|
5700
|
-
* @param
|
|
4663
|
+
* @param config - The ThunderID client configuration
|
|
5701
4664
|
* @returns The sign-up URL if baseUrl is recognized, otherwise an empty string
|
|
5702
4665
|
*/
|
|
5703
4666
|
const getRedirectBasedSignUpUrl = (config) => {
|
|
5704
4667
|
const { baseUrl } = config;
|
|
5705
4668
|
if (!isRecognizedBaseUrlPattern_default(baseUrl)) return "";
|
|
5706
4669
|
let signUpBaseUrl = baseUrl;
|
|
5707
|
-
|
|
4670
|
+
try {
|
|
5708
4671
|
const url$1 = new URL(baseUrl);
|
|
5709
4672
|
if (/([a-z0-9-]+\.)*api\.thunderid\.io$/i.test(url$1.hostname)) {
|
|
5710
4673
|
url$1.hostname = url$1.hostname.replace("api.", "accounts.");
|
|
@@ -5722,7 +4685,64 @@ const getRedirectBasedSignUpUrl = (config) => {
|
|
|
5722
4685
|
var getRedirectBasedSignUpUrl_default = getRedirectBasedSignUpUrl;
|
|
5723
4686
|
|
|
5724
4687
|
//#endregion
|
|
5725
|
-
//#region src/utils/
|
|
4688
|
+
//#region src/utils/isEmpty.ts
|
|
4689
|
+
/**
|
|
4690
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
4691
|
+
*
|
|
4692
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4693
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
4694
|
+
* in compliance with the License.
|
|
4695
|
+
* You may obtain a copy of the License at
|
|
4696
|
+
*
|
|
4697
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4698
|
+
*
|
|
4699
|
+
* Unless required by applicable law or agreed to in writing,
|
|
4700
|
+
* software distributed under the License is distributed on an
|
|
4701
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4702
|
+
* KIND, either express or implied. See the License for the
|
|
4703
|
+
* specific language governing permissions and limitations
|
|
4704
|
+
* under the License.
|
|
4705
|
+
*/
|
|
4706
|
+
/**
|
|
4707
|
+
* Checks if a value is considered empty.
|
|
4708
|
+
*
|
|
4709
|
+
* A value is considered empty if it is:
|
|
4710
|
+
* - null
|
|
4711
|
+
* - undefined
|
|
4712
|
+
* - empty string ("")
|
|
4713
|
+
* - string containing only whitespace characters
|
|
4714
|
+
* - empty array ([])
|
|
4715
|
+
* - empty object ({})
|
|
4716
|
+
*
|
|
4717
|
+
* @param value - The value to check
|
|
4718
|
+
* @returns true if the value is empty, false otherwise
|
|
4719
|
+
*
|
|
4720
|
+
* @example
|
|
4721
|
+
* ```typescript
|
|
4722
|
+
* isEmpty(null); // true
|
|
4723
|
+
* isEmpty(undefined); // true
|
|
4724
|
+
* isEmpty(""); // true
|
|
4725
|
+
* isEmpty(" "); // true
|
|
4726
|
+
* isEmpty("hello"); // false
|
|
4727
|
+
* isEmpty([]); // true
|
|
4728
|
+
* isEmpty([1, 2, 3]); // false
|
|
4729
|
+
* isEmpty({}); // true
|
|
4730
|
+
* isEmpty({ name: "John" }); // false
|
|
4731
|
+
* isEmpty(0); // false
|
|
4732
|
+
* isEmpty(false); // false
|
|
4733
|
+
* ```
|
|
4734
|
+
*/
|
|
4735
|
+
const isEmpty = (value) => {
|
|
4736
|
+
if (value === null || value === void 0) return true;
|
|
4737
|
+
if (typeof value === "string") return value.trim() === "";
|
|
4738
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
4739
|
+
if (typeof value === "object" && value.constructor === Object) return Object.keys(value).length === 0;
|
|
4740
|
+
return false;
|
|
4741
|
+
};
|
|
4742
|
+
var isEmpty_default = isEmpty;
|
|
4743
|
+
|
|
4744
|
+
//#endregion
|
|
4745
|
+
//#region src/utils/isEmojiUri.ts
|
|
5726
4746
|
/**
|
|
5727
4747
|
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
5728
4748
|
*
|
|
@@ -5758,7 +4778,7 @@ const isEmojiUri = (uri) => typeof uri === "string" && uri.startsWith(EMOJI_URI_
|
|
|
5758
4778
|
var isEmojiUri_default = isEmojiUri;
|
|
5759
4779
|
|
|
5760
4780
|
//#endregion
|
|
5761
|
-
//#region src/utils/
|
|
4781
|
+
//#region src/utils/extractEmojiFromUri.ts
|
|
5762
4782
|
/**
|
|
5763
4783
|
* Extracts the emoji character from an `emoji:` URI.
|
|
5764
4784
|
*
|
|
@@ -5811,18 +4831,6 @@ var extractEmojiFromUri_default = extractEmojiFromUri;
|
|
|
5811
4831
|
const removeTrailingSlash = (path) => path.endsWith("/") ? path.slice(0, -1) : path;
|
|
5812
4832
|
var removeTrailingSlash_default = removeTrailingSlash;
|
|
5813
4833
|
|
|
5814
|
-
//#endregion
|
|
5815
|
-
//#region src/utils/resolveFieldType.ts
|
|
5816
|
-
const resolveFieldType = (field) => {
|
|
5817
|
-
if (field.type === EmbeddedSignInFlowAuthenticatorParamType.String) {
|
|
5818
|
-
if (field.param === EmbeddedSignInFlowAuthenticatorExtendedParamType.Otp) return FieldType.Otp;
|
|
5819
|
-
if (field?.confidential) return FieldType.Password;
|
|
5820
|
-
return FieldType.Text;
|
|
5821
|
-
}
|
|
5822
|
-
throw new ThunderIDRuntimeError(`Field type is not supported: ${field.type}`, "resolveFieldType-Invalid-001", "javascript", "The provided field type is not supported. Please check the field configuration.");
|
|
5823
|
-
};
|
|
5824
|
-
var resolveFieldType_default = resolveFieldType;
|
|
5825
|
-
|
|
5826
4834
|
//#endregion
|
|
5827
4835
|
//#region src/utils/resolveFieldName.ts
|
|
5828
4836
|
const resolveFieldName = (field) => {
|
|
@@ -5832,7 +4840,7 @@ const resolveFieldName = (field) => {
|
|
|
5832
4840
|
var resolveFieldName_default = resolveFieldName;
|
|
5833
4841
|
|
|
5834
4842
|
//#endregion
|
|
5835
|
-
//#region src/utils/
|
|
4843
|
+
//#region src/utils/resolveMeta.ts
|
|
5836
4844
|
/**
|
|
5837
4845
|
* Resolves a dot-path expression against a FlowMetadataResponse object.
|
|
5838
4846
|
*
|
|
@@ -5859,7 +4867,7 @@ function resolveMeta(path, meta) {
|
|
|
5859
4867
|
}
|
|
5860
4868
|
|
|
5861
4869
|
//#endregion
|
|
5862
|
-
//#region src/utils/
|
|
4870
|
+
//#region src/utils/parseFlowTemplateLiteral.ts
|
|
5863
4871
|
/**
|
|
5864
4872
|
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
5865
4873
|
*
|
|
@@ -5955,7 +4963,7 @@ function parseFlowTemplateLiteral(content) {
|
|
|
5955
4963
|
}
|
|
5956
4964
|
|
|
5957
4965
|
//#endregion
|
|
5958
|
-
//#region src/utils/
|
|
4966
|
+
//#region src/utils/resolveFlowTemplateLiterals.ts
|
|
5959
4967
|
/**
|
|
5960
4968
|
* Global version of {@link FLOW_TEMPLATE_LITERAL_REGEX} for use with `String.prototype.replace`.
|
|
5961
4969
|
*/
|
|
@@ -5992,7 +5000,7 @@ function resolveFlowTemplateLiterals(text, { t, meta }) {
|
|
|
5992
5000
|
}
|
|
5993
5001
|
|
|
5994
5002
|
//#endregion
|
|
5995
|
-
//#region src/utils/
|
|
5003
|
+
//#region src/utils/countryCodeToFlagEmoji.ts
|
|
5996
5004
|
/**
|
|
5997
5005
|
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
5998
5006
|
*
|
|
@@ -6022,7 +5030,7 @@ function countryCodeToFlagEmoji(countryCode) {
|
|
|
6022
5030
|
}
|
|
6023
5031
|
|
|
6024
5032
|
//#endregion
|
|
6025
|
-
//#region src/utils/
|
|
5033
|
+
//#region src/utils/resolveLocaleDisplayName.ts
|
|
6026
5034
|
/**
|
|
6027
5035
|
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
6028
5036
|
*
|
|
@@ -6060,7 +5068,7 @@ function resolveLocaleDisplayName(locale, displayLocale) {
|
|
|
6060
5068
|
}
|
|
6061
5069
|
|
|
6062
5070
|
//#endregion
|
|
6063
|
-
//#region src/utils/
|
|
5071
|
+
//#region src/utils/resolveLocaleEmoji.ts
|
|
6064
5072
|
/**
|
|
6065
5073
|
* Maps BCP 47 language subtags to ISO 3166-1 alpha-2 country codes used for
|
|
6066
5074
|
* flag emoji resolution when no country subtag is present in the locale.
|
|
@@ -6126,165 +5134,97 @@ function resolveLocaleEmoji(locale) {
|
|
|
6126
5134
|
var resolveLocaleEmoji_default = resolveLocaleEmoji;
|
|
6127
5135
|
|
|
6128
5136
|
//#endregion
|
|
6129
|
-
//#region src/utils/
|
|
5137
|
+
//#region src/utils/evaluateValidationRule.ts
|
|
6130
5138
|
/**
|
|
6131
|
-
*
|
|
6132
|
-
*
|
|
6133
|
-
*
|
|
6134
|
-
* @returns A new string with the vendor prefix added to the class name
|
|
6135
|
-
*
|
|
6136
|
-
* @example
|
|
6137
|
-
* ```typescript
|
|
6138
|
-
* // Usage with clsx
|
|
6139
|
-
* clsx(withVendorCSSClassPrefix('sign-in-button'), className)
|
|
6140
|
-
* // Result: "wso2-sign-in-button"
|
|
6141
|
-
* ```
|
|
5139
|
+
* Default i18n fallback keys returned when a `ValidationRule.message` is not provided.
|
|
5140
|
+
* Match the server-side defaults so a flow author who omits `message` sees the same
|
|
5141
|
+
* string regardless of whether the rule was evaluated client-side or server-side.
|
|
6142
5142
|
*/
|
|
6143
|
-
const
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
//#region src/utils/transformBrandingPreferenceToTheme.ts
|
|
6148
|
-
const extractColorValue = (colorVariant, preferDark = false) => {
|
|
6149
|
-
if (preferDark && colorVariant?.dark?.trim()) return colorVariant.dark;
|
|
6150
|
-
return colorVariant?.main;
|
|
5143
|
+
const DEFAULT_VALIDATION_MESSAGE_KEYS = {
|
|
5144
|
+
regex: "validation.pattern.invalid",
|
|
5145
|
+
minLength: "validation.minLength.invalid",
|
|
5146
|
+
maxLength: "validation.maxLength.invalid"
|
|
6151
5147
|
};
|
|
6152
5148
|
/**
|
|
6153
|
-
*
|
|
6154
|
-
|
|
6155
|
-
|
|
5149
|
+
* Evaluates a single validation rule against the given input value.
|
|
5150
|
+
*
|
|
5151
|
+
* Returns `null` when the rule passes, or the rule's `message` (or the default
|
|
5152
|
+
* fallback key if `message` is absent) when it fails.
|
|
5153
|
+
*
|
|
5154
|
+
* Behavior notes:
|
|
5155
|
+
* - **regex**: an invalid regex pattern (one that cannot be compiled) is treated as
|
|
5156
|
+
* **passing** on the client. This is lenient — the server is authoritative and
|
|
5157
|
+
* will still enforce the rule if it can compile the pattern. Failing closed in the
|
|
5158
|
+
* SDK risks denial-of-service for misconfigured flows.
|
|
5159
|
+
* - **minLength / maxLength**: compared against `value.length`. A non-numeric `value`
|
|
5160
|
+
* on the rule is treated as the rule passing.
|
|
5161
|
+
* - Unknown rule types are treated as passing (forward compatibility with future types).
|
|
5162
|
+
*/
|
|
5163
|
+
const evaluateValidationRule = (rule, value) => {
|
|
5164
|
+
const fail = () => rule.message ?? DEFAULT_VALIDATION_MESSAGE_KEYS[rule.type];
|
|
5165
|
+
switch (rule.type) {
|
|
5166
|
+
case "regex": {
|
|
5167
|
+
if (typeof rule.value !== "string" || rule.value === "") return null;
|
|
5168
|
+
let re;
|
|
5169
|
+
try {
|
|
5170
|
+
re = new RegExp(rule.value);
|
|
5171
|
+
} catch {
|
|
5172
|
+
return null;
|
|
5173
|
+
}
|
|
5174
|
+
return re.test(value) ? null : fail();
|
|
5175
|
+
}
|
|
5176
|
+
case "minLength":
|
|
5177
|
+
if (typeof rule.value !== "number" || Number.isNaN(rule.value)) return null;
|
|
5178
|
+
return value.length >= rule.value ? null : fail();
|
|
5179
|
+
case "maxLength":
|
|
5180
|
+
if (typeof rule.value !== "number" || Number.isNaN(rule.value)) return null;
|
|
5181
|
+
return value.length <= rule.value ? null : fail();
|
|
5182
|
+
default: return null;
|
|
5183
|
+
}
|
|
5184
|
+
};
|
|
5185
|
+
var evaluateValidationRule_default = evaluateValidationRule;
|
|
5186
|
+
|
|
5187
|
+
//#endregion
|
|
5188
|
+
//#region src/utils/buildValidatorFromRules.ts
|
|
6156
5189
|
/**
|
|
6157
|
-
*
|
|
5190
|
+
* Composes an array of `ValidationRule`s into a single validator function suitable for
|
|
5191
|
+
* `useForm`'s `FormField.validator` slot.
|
|
5192
|
+
*
|
|
5193
|
+
* The composed validator evaluates rules in declaration order and returns the **first**
|
|
5194
|
+
* failing rule's message — matching the SDK's render-prop shape of a single string per
|
|
5195
|
+
* field. When all rules pass it returns `null`.
|
|
5196
|
+
*
|
|
5197
|
+
* Returns `null` when no rules are supplied so callers can compose conditionally.
|
|
6158
5198
|
*/
|
|
6159
|
-
const
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
colors: {
|
|
6166
|
-
action: {
|
|
6167
|
-
activatedOpacity: .12,
|
|
6168
|
-
active: isDark ? "rgba(255, 255, 255, 0.70)" : "rgba(0, 0, 0, 0.54)",
|
|
6169
|
-
disabled: isDark ? "rgba(255, 255, 255, 0.26)" : "rgba(0, 0, 0, 0.26)",
|
|
6170
|
-
disabledBackground: isDark ? "rgba(255, 255, 255, 0.12)" : "rgba(0, 0, 0, 0.12)",
|
|
6171
|
-
disabledOpacity: .38,
|
|
6172
|
-
focus: isDark ? "rgba(255, 255, 255, 0.12)" : "rgba(0, 0, 0, 0.12)",
|
|
6173
|
-
focusOpacity: .12,
|
|
6174
|
-
hover: isDark ? "rgba(255, 255, 255, 0.04)" : "rgba(0, 0, 0, 0.04)",
|
|
6175
|
-
hoverOpacity: .04,
|
|
6176
|
-
selected: isDark ? "rgba(255, 255, 255, 0.08)" : "rgba(0, 0, 0, 0.08)",
|
|
6177
|
-
selectedOpacity: .08
|
|
6178
|
-
},
|
|
6179
|
-
background: {
|
|
6180
|
-
body: {
|
|
6181
|
-
dark: (colors?.background?.body)?.dark || (colors?.background?.body)?.main,
|
|
6182
|
-
main: extractColorValue(colors?.background?.body, isDark) ?? ""
|
|
6183
|
-
},
|
|
6184
|
-
dark: (colors?.background?.surface)?.dark || (colors?.background?.surface)?.main,
|
|
6185
|
-
disabled: extractColorValue(colors?.background?.surface, isDark) ?? "",
|
|
6186
|
-
surface: extractColorValue(colors?.background?.surface, isDark) ?? ""
|
|
6187
|
-
},
|
|
6188
|
-
border: colors?.outlined?.default ?? "",
|
|
6189
|
-
error: {
|
|
6190
|
-
contrastText: extractContrastText(colors?.alerts?.error) ?? "",
|
|
6191
|
-
dark: (colors?.alerts?.error)?.dark || (colors?.alerts?.error)?.main,
|
|
6192
|
-
main: extractColorValue(colors?.alerts?.error, isDark) ?? ""
|
|
6193
|
-
},
|
|
6194
|
-
info: {
|
|
6195
|
-
contrastText: extractContrastText(colors?.alerts?.info) ?? "",
|
|
6196
|
-
dark: (colors?.alerts?.info)?.dark || (colors?.alerts?.info)?.main,
|
|
6197
|
-
main: extractColorValue(colors?.alerts?.info, isDark) ?? ""
|
|
6198
|
-
},
|
|
6199
|
-
primary: {
|
|
6200
|
-
contrastText: extractContrastText(colors?.primary) ?? "",
|
|
6201
|
-
dark: colors?.primary?.dark || (colors?.primary)?.main,
|
|
6202
|
-
main: extractColorValue(colors?.primary, isDark) ?? ""
|
|
6203
|
-
},
|
|
6204
|
-
secondary: {
|
|
6205
|
-
contrastText: extractContrastText(colors?.secondary) ?? "",
|
|
6206
|
-
dark: colors?.secondary?.dark || (colors?.secondary)?.main,
|
|
6207
|
-
main: extractColorValue(colors?.secondary, isDark) ?? ""
|
|
6208
|
-
},
|
|
6209
|
-
success: {
|
|
6210
|
-
contrastText: extractContrastText(colors?.alerts?.neutral) ?? "",
|
|
6211
|
-
dark: (colors?.alerts?.neutral)?.dark || (colors?.alerts?.neutral)?.main,
|
|
6212
|
-
main: extractColorValue(colors?.alerts?.neutral, isDark) ?? ""
|
|
6213
|
-
},
|
|
6214
|
-
text: {
|
|
6215
|
-
dark: (colors?.text)?.dark || (colors?.text)?.primary,
|
|
6216
|
-
primary: (colors?.text)?.primary ?? "",
|
|
6217
|
-
secondary: (colors?.text)?.secondary ?? ""
|
|
6218
|
-
},
|
|
6219
|
-
warning: {
|
|
6220
|
-
contrastText: extractContrastText(colors?.alerts?.warning) ?? "",
|
|
6221
|
-
dark: (colors?.alerts?.warning)?.dark || (colors?.alerts?.warning)?.main,
|
|
6222
|
-
main: extractColorValue(colors?.alerts?.warning, isDark) ?? ""
|
|
6223
|
-
}
|
|
6224
|
-
},
|
|
6225
|
-
images: {
|
|
6226
|
-
favicon: images?.favicon ? {
|
|
6227
|
-
alt: images.favicon.altText,
|
|
6228
|
-
title: images.favicon.title,
|
|
6229
|
-
url: images.favicon.imgURL
|
|
6230
|
-
} : void 0,
|
|
6231
|
-
logo: images?.logo ? {
|
|
6232
|
-
alt: images.logo.altText,
|
|
6233
|
-
title: images.logo.title,
|
|
6234
|
-
url: images.logo.imgURL
|
|
6235
|
-
} : void 0
|
|
5199
|
+
const buildValidatorFromRules = (rules) => {
|
|
5200
|
+
if (!rules || rules.length === 0) return null;
|
|
5201
|
+
return (value) => {
|
|
5202
|
+
for (const rule of rules) {
|
|
5203
|
+
const message = evaluateValidationRule_default(rule, value);
|
|
5204
|
+
if (message !== null) return message;
|
|
6236
5205
|
}
|
|
5206
|
+
return null;
|
|
6237
5207
|
};
|
|
6238
|
-
const buttonBorderRadius = buttons?.primary?.base?.border?.borderRadius;
|
|
6239
|
-
const fieldBorderRadius = inputs?.base?.border?.borderRadius;
|
|
6240
|
-
if (buttonBorderRadius || fieldBorderRadius) config.components = {
|
|
6241
|
-
...buttonBorderRadius && { Button: { styleOverrides: { root: { borderRadius: buttonBorderRadius } } } },
|
|
6242
|
-
...fieldBorderRadius && { Field: { styleOverrides: { root: { borderRadius: fieldBorderRadius } } } }
|
|
6243
|
-
};
|
|
6244
|
-
return config;
|
|
6245
5208
|
};
|
|
5209
|
+
var buildValidatorFromRules_default = buildValidatorFromRules;
|
|
5210
|
+
|
|
5211
|
+
//#endregion
|
|
5212
|
+
//#region src/utils/withVendorCSSClassPrefix.ts
|
|
6246
5213
|
/**
|
|
6247
|
-
*
|
|
6248
|
-
*
|
|
6249
|
-
* @param brandingPreference - The branding preference response from getBrandingPreference
|
|
6250
|
-
* @param forceTheme - Optional parameter to force a specific theme ('light' or 'dark'),
|
|
6251
|
-
* if not provided, will use the activeTheme from branding preference
|
|
6252
|
-
* @returns Theme object that can be used with the theme system
|
|
5214
|
+
* Adds a vendor-specific prefix to a CSS class name.
|
|
6253
5215
|
*
|
|
6254
|
-
* The
|
|
6255
|
-
*
|
|
6256
|
-
* - Border radius from buttons and inputs
|
|
6257
|
-
* - Images (logo and favicon with their URLs, titles, and alt text)
|
|
6258
|
-
* - Typography settings
|
|
5216
|
+
* @param className - The original CSS class name to be prefixed
|
|
5217
|
+
* @returns A new string with the vendor prefix added to the class name
|
|
6259
5218
|
*
|
|
6260
5219
|
* @example
|
|
6261
5220
|
* ```typescript
|
|
6262
|
-
*
|
|
6263
|
-
*
|
|
6264
|
-
*
|
|
6265
|
-
* // Access image URLs via CSS variables
|
|
6266
|
-
* // Logo: var(--wso2-image-logo-url)
|
|
6267
|
-
* // Favicon: var(--wso2-image-favicon-url)
|
|
6268
|
-
*
|
|
6269
|
-
* // Force light theme regardless of branding preference activeTheme
|
|
6270
|
-
* const lightTheme = transformBrandingPreferenceToTheme(brandingPreference, 'light');
|
|
5221
|
+
* // Usage with clsx
|
|
5222
|
+
* clsx(withVendorCSSClassPrefix('sign-in-button'), className)
|
|
5223
|
+
* // Result: "wso2-sign-in-button"
|
|
6271
5224
|
* ```
|
|
6272
5225
|
*/
|
|
6273
|
-
const
|
|
6274
|
-
|
|
6275
|
-
if (!themeConfig) return createTheme_default({}, false);
|
|
6276
|
-
let activeThemeKey;
|
|
6277
|
-
if (forceTheme) activeThemeKey = forceTheme.toUpperCase();
|
|
6278
|
-
else activeThemeKey = themeConfig.activeTheme || "LIGHT";
|
|
6279
|
-
const themeVariant = themeConfig[activeThemeKey];
|
|
6280
|
-
if (!themeVariant) {
|
|
6281
|
-
const fallbackVariant = themeConfig.LIGHT || themeConfig.DARK;
|
|
6282
|
-
if (fallbackVariant) return createTheme_default(transformThemeVariant(fallbackVariant, activeThemeKey === "DARK"), activeThemeKey === "DARK");
|
|
6283
|
-
return createTheme_default({}, activeThemeKey === "DARK");
|
|
6284
|
-
}
|
|
6285
|
-
return createTheme_default(transformThemeVariant(themeVariant, activeThemeKey === "DARK"), activeThemeKey === "DARK");
|
|
6286
|
-
};
|
|
6287
|
-
var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTheme;
|
|
5226
|
+
const withVendorCSSClassPrefix = (className) => `${VendorConstants_default.VENDOR_PREFIX}-${className}`;
|
|
5227
|
+
var withVendorCSSClassPrefix_default = withVendorCSSClassPrefix;
|
|
6288
5228
|
|
|
6289
5229
|
//#endregion
|
|
6290
5230
|
//#region src/HttpClient.ts
|
|
@@ -6426,6 +5366,9 @@ const en_US = {
|
|
|
6426
5366
|
"elements.fields.organization.select.label": "Select Organization",
|
|
6427
5367
|
"elements.fields.organization.select.placeholder": "Choose an organization",
|
|
6428
5368
|
"validations.required.field.error": "This field is required",
|
|
5369
|
+
"validation.pattern.invalid": "This value does not match the required format.",
|
|
5370
|
+
"validation.minLength.invalid": "This value is too short.",
|
|
5371
|
+
"validation.maxLength.invalid": "This value is too long.",
|
|
6429
5372
|
"signin.heading": "Sign In",
|
|
6430
5373
|
"signin.subheading": "Welcome back! Please sign in to continue.",
|
|
6431
5374
|
"signup.heading": "Sign Up",
|
|
@@ -6536,6 +5479,9 @@ const fr_FR = {
|
|
|
6536
5479
|
"elements.fields.organization.select.label": "Sélectionner l'organisation",
|
|
6537
5480
|
"elements.fields.organization.select.placeholder": "Choisissez une organisation",
|
|
6538
5481
|
"validations.required.field.error": "Ce champ est obligatoire",
|
|
5482
|
+
"validation.pattern.invalid": "Cette valeur ne correspond pas au format requis.",
|
|
5483
|
+
"validation.minLength.invalid": "Cette valeur est trop courte.",
|
|
5484
|
+
"validation.maxLength.invalid": "Cette valeur est trop longue.",
|
|
6539
5485
|
"signin.heading": "Se connecter",
|
|
6540
5486
|
"signin.subheading": "Entrez vos identifiants pour continuer.",
|
|
6541
5487
|
"signup.heading": "S'inscrire",
|
|
@@ -6646,6 +5592,9 @@ const te_IN = {
|
|
|
6646
5592
|
"elements.fields.organization.select.label": "ఆర్గనైజేషన్ను ఎంచుకోండి",
|
|
6647
5593
|
"elements.fields.organization.select.placeholder": "సంస్థను ఎంచుకోండి",
|
|
6648
5594
|
"validations.required.field.error": "ఈ ఫీల్డ్ అవసరం",
|
|
5595
|
+
"validation.pattern.invalid": "ఈ విలువ అవసరమైన ఆకృతికి సరిపోలడం లేదు.",
|
|
5596
|
+
"validation.minLength.invalid": "ఈ విలువ చాలా చిన్నది.",
|
|
5597
|
+
"validation.maxLength.invalid": "ఈ విలువ చాలా పెద్దది.",
|
|
6649
5598
|
"signin.heading": "సైన్ ఇన్ చేయండి",
|
|
6650
5599
|
"signin.subheading": "కొనసాగించడానికి మీ వివరాలు ఇవ్వండి.",
|
|
6651
5600
|
"signup.heading": "సైన్ అప్ చేయండి",
|
|
@@ -6756,6 +5705,9 @@ const hi_IN = {
|
|
|
6756
5705
|
"elements.fields.organization.select.label": "संगठन चुनें",
|
|
6757
5706
|
"elements.fields.organization.select.placeholder": "एक संगठन चुनें",
|
|
6758
5707
|
"validations.required.field.error": "यह फील्ड आवश्यक है",
|
|
5708
|
+
"validation.pattern.invalid": "यह मान आवश्यक प्रारूप से मेल नहीं खाता।",
|
|
5709
|
+
"validation.minLength.invalid": "यह मान बहुत छोटा है।",
|
|
5710
|
+
"validation.maxLength.invalid": "यह मान बहुत लंबा है।",
|
|
6759
5711
|
"signin.heading": "साइन इन",
|
|
6760
5712
|
"signin.subheading": "जारी रखने के लिए अपनी प्रमाणिक जानकारी दर्ज करें।",
|
|
6761
5713
|
"signup.heading": "साइन अप",
|
|
@@ -6866,6 +5818,9 @@ const pt_BR = {
|
|
|
6866
5818
|
"elements.fields.organization.select.label": "Selecionar Organização",
|
|
6867
5819
|
"elements.fields.organization.select.placeholder": "Selecione uma organização",
|
|
6868
5820
|
"validations.required.field.error": "Este campo é obrigatório",
|
|
5821
|
+
"validation.pattern.invalid": "Este valor não corresponde ao formato necessário.",
|
|
5822
|
+
"validation.minLength.invalid": "Este valor é muito curto.",
|
|
5823
|
+
"validation.maxLength.invalid": "Este valor é muito longo.",
|
|
6869
5824
|
"signin.heading": "Entrar",
|
|
6870
5825
|
"signin.subheading": "Digite suas credencias para continuar.",
|
|
6871
5826
|
"signup.heading": "Cadastra-se",
|
|
@@ -6976,6 +5931,9 @@ const pt_PT = {
|
|
|
6976
5931
|
"elements.fields.organization.select.label": "Selecionar Organização",
|
|
6977
5932
|
"elements.fields.organization.select.placeholder": "Selecione uma organização",
|
|
6978
5933
|
"validations.required.field.error": "Este campo é obrigatório",
|
|
5934
|
+
"validation.pattern.invalid": "Este valor não corresponde ao formato necessário.",
|
|
5935
|
+
"validation.minLength.invalid": "Este valor é demasiado curto.",
|
|
5936
|
+
"validation.maxLength.invalid": "Este valor é demasiado longo.",
|
|
6979
5937
|
"signin.heading": "Iniciar Sessão",
|
|
6980
5938
|
"signin.subheading": "Introduza as suas credenciais para continuar.",
|
|
6981
5939
|
"signup.heading": "Registar-se",
|
|
@@ -7086,6 +6044,9 @@ const ta_IN = {
|
|
|
7086
6044
|
"elements.fields.organization.select.label": "அமைப்பை தேர்ந்தெடு",
|
|
7087
6045
|
"elements.fields.organization.select.placeholder": "அமைப்பை தெரிந்தெடுக்கவும்",
|
|
7088
6046
|
"validations.required.field.error": "இந்த புலம் தேவை",
|
|
6047
|
+
"validation.pattern.invalid": "இந்த மதிப்பு தேவையான வடிவத்துடன் பொருந்தவில்லை.",
|
|
6048
|
+
"validation.minLength.invalid": "இந்த மதிப்பு மிகவும் குறுகியது.",
|
|
6049
|
+
"validation.maxLength.invalid": "இந்த மதிப்பு மிகவும் நீளமானது.",
|
|
7089
6050
|
"signin.heading": "உள்நுழை",
|
|
7090
6051
|
"signin.subheading": "தொடர உங்கள் சான்றுகளை உள்ளிடவும்.",
|
|
7091
6052
|
"signup.heading": "பதிவு செய்",
|
|
@@ -7196,6 +6157,9 @@ const si_LK = {
|
|
|
7196
6157
|
"elements.fields.organization.select.label": "සංවිධානය තෝරන්න",
|
|
7197
6158
|
"elements.fields.organization.select.placeholder": "සංවිධානයක් සැළුම් කරන්න",
|
|
7198
6159
|
"validations.required.field.error": "මෙම ක්ෂේත්රය අවශ්යයි",
|
|
6160
|
+
"validation.pattern.invalid": "මෙම අගය අවශ්ය ආකෘතියට නොගැලපේ.",
|
|
6161
|
+
"validation.minLength.invalid": "මෙම අගය ඉතා කෙටියි.",
|
|
6162
|
+
"validation.maxLength.invalid": "මෙම අගය ඉතා දිගයි.",
|
|
7199
6163
|
"signin.heading": "ලොග් වෙන්න",
|
|
7200
6164
|
"signin.subheading": "ඉදිරියට යාමට ඔබේ සත්යාපන තොරතුරු ඇතුළත් කරන්න.",
|
|
7201
6165
|
"signup.heading": "ලියාපදිංචි වන්න",
|
|
@@ -7351,4 +6315,4 @@ const normalizeTranslations = (translations) => {
|
|
|
7351
6315
|
var normalizeTranslations_default = normalizeTranslations;
|
|
7352
6316
|
|
|
7353
6317
|
//#endregion
|
|
7354
|
-
export { ApplicationNativeAuthenticationConstants_default as ApplicationNativeAuthenticationConstants, AuthenticationHelper_default as AuthenticationHelper, DEFAULT_THEME, EMOJI_URI_SCHEME, EmbeddedFlowActionVariant
|
|
6318
|
+
export { ApplicationNativeAuthenticationConstants_default as ApplicationNativeAuthenticationConstants, AuthenticationHelper_default as AuthenticationHelper, DEFAULT_THEME, DEFAULT_VALIDATION_MESSAGE_KEYS, EMOJI_URI_SCHEME, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowEventType, EmbeddedFlowResponseType, EmbeddedFlowTextVariant, EmbeddedFlowType, EmbeddedRecoveryFlowStatus, EmbeddedRecoveryFlowType, EmbeddedSignInFlowStatus, EmbeddedSignInFlowType, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowType, FieldType, FlowMetaType, FlowMode, HttpClient, IsomorphicCrypto, OIDCRequestConstants_default as OIDCRequestConstants, StorageManager_default as StorageManager, ThunderIDAPIError, ThunderIDAuthException, ThunderIDError, ThunderIDJavaScriptClient_default as ThunderIDJavaScriptClient, ThunderIDRuntimeError, TokenConstants_default as TokenConstants, TranslationBundleConstants_default as TranslationBundleConstants, VendorConstants_default as VendorConstants, WellKnownSchemaIds, arrayBufferToBase64url_default as arrayBufferToBase64url, base64urlToArrayBuffer_default as base64urlToArrayBuffer, bem_default as bem, buildValidatorFromRules_default as buildValidatorFromRules, configure as configureLogger, countryCodeToFlagEmoji, createComponentLogger, createLogger, createPackageComponentLogger, createPackageLogger, createTheme_default as createTheme, debug, deepMerge_default as deepMerge, error, evaluateValidationRule_default as evaluateValidationRule, executeEmbeddedRecoveryFlow_default as executeEmbeddedRecoveryFlow, executeEmbeddedSignInFlow_default as executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow_default as executeEmbeddedSignUpFlow, executeEmbeddedUserOnboardingFlow_default as executeEmbeddedUserOnboardingFlow, extractEmojiFromUri_default as extractEmojiFromUri, extractPkceStorageKeyFromState_default as extractPkceStorageKeyFromState, extractUserClaimsFromIdToken_default as extractUserClaimsFromIdToken, flattenUserSchema_default as flattenUserSchema, formatDate_default as formatDate, generateFlattenedUserProfile_default as generateFlattenedUserProfile, generateUserProfile_default as generateUserProfile, get_default as get, getDefaultI18nBundles_default as getDefaultI18nBundles, getFlowMeta_default as getFlowMeta, getLatestStateParam_default as getLatestStateParam, getOrganizationUnitChildren_default as getOrganizationUnitChildren, getRedirectBasedSignUpUrl_default as getRedirectBasedSignUpUrl, getSchemas_default as getSchemas, getScim2Me_default as getScim2Me, getUserInfo_default as getUserInfo, info, isEmojiUri_default as isEmojiUri, isEmpty_default as isEmpty, isRecognizedBaseUrlPattern_default as isRecognizedBaseUrlPattern, logger_default as logger, normalizeTranslations_default as normalizeTranslations, processOpenIDScopes_default as processOpenIDScopes, processUsername_default as processUsername, removeTrailingSlash_default as removeTrailingSlash, resolveFieldName_default as resolveFieldName, resolveFlowTemplateLiterals, resolveLocaleDisplayName, resolveLocaleEmoji_default as resolveLocaleEmoji, resolveMeta, set_default as set, updateMeProfile_default as updateMeProfile, warn, withVendorCSSClassPrefix_default as withVendorCSSClassPrefix };
|