@thunderid/javascript 0.11.2 → 0.11.3
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/DefaultCacheStore.d.ts +0 -17
- package/dist/DefaultCacheStore.d.ts.map +1 -1
- package/dist/DefaultCrypto.d.ts +0 -17
- package/dist/DefaultCrypto.d.ts.map +1 -1
- package/dist/HttpClient.d.ts +0 -17
- package/dist/HttpClient.d.ts.map +1 -1
- package/dist/IsomorphicCrypto.d.ts +0 -17
- package/dist/IsomorphicCrypto.d.ts.map +1 -1
- package/dist/StorageManager.d.ts +0 -17
- package/dist/StorageManager.d.ts.map +1 -1
- package/dist/ThunderIDJavaScriptClient.d.ts +0 -17
- package/dist/ThunderIDJavaScriptClient.d.ts.map +1 -1
- package/dist/api/executeEmbeddedRecoveryFlow.d.ts +0 -17
- package/dist/api/executeEmbeddedRecoveryFlow.d.ts.map +1 -1
- package/dist/api/executeEmbeddedSignInFlow.d.ts +0 -17
- package/dist/api/executeEmbeddedSignInFlow.d.ts.map +1 -1
- package/dist/api/executeEmbeddedSignUpFlow.d.ts +0 -17
- package/dist/api/executeEmbeddedSignUpFlow.d.ts.map +1 -1
- package/dist/api/executeEmbeddedUserOnboardingFlow.d.ts +0 -17
- package/dist/api/executeEmbeddedUserOnboardingFlow.d.ts.map +1 -1
- package/dist/api/getFlowMeta.d.ts +0 -17
- package/dist/api/getFlowMeta.d.ts.map +1 -1
- package/dist/api/getOrganizationUnitChildren.d.ts +0 -17
- package/dist/api/getOrganizationUnitChildren.d.ts.map +1 -1
- package/dist/api/getUserInfo.d.ts +0 -17
- package/dist/api/getUserInfo.d.ts.map +1 -1
- package/dist/api/getUsersMe.d.ts +0 -17
- package/dist/api/getUsersMe.d.ts.map +1 -1
- package/dist/api/updateMeProfile.d.ts +0 -17
- package/dist/api/updateMeProfile.d.ts.map +1 -1
- package/dist/cjs/index.cjs +1378 -1875
- package/dist/constants/ApplicationNativeAuthenticationConstants.d.ts +0 -17
- package/dist/constants/ApplicationNativeAuthenticationConstants.d.ts.map +1 -1
- package/dist/constants/OIDCDiscoveryConstants.d.ts +0 -17
- package/dist/constants/OIDCDiscoveryConstants.d.ts.map +1 -1
- package/dist/constants/OIDCRequestConstants.d.ts +0 -17
- package/dist/constants/OIDCRequestConstants.d.ts.map +1 -1
- package/dist/constants/PKCEConstants.d.ts +0 -17
- package/dist/constants/PKCEConstants.d.ts.map +1 -1
- package/dist/constants/ScopeConstants.d.ts +0 -17
- package/dist/constants/ScopeConstants.d.ts.map +1 -1
- package/dist/constants/TokenConstants.d.ts +0 -17
- package/dist/constants/TokenConstants.d.ts.map +1 -1
- package/dist/constants/TokenExchangeConstants.d.ts +0 -17
- package/dist/constants/TokenExchangeConstants.d.ts.map +1 -1
- package/dist/constants/VendorConstants.d.ts +0 -17
- package/dist/constants/VendorConstants.d.ts.map +1 -1
- package/dist/edge/index.js +1378 -1875
- package/dist/errors/ThunderIDAPIError.d.ts +0 -17
- package/dist/errors/ThunderIDAPIError.d.ts.map +1 -1
- package/dist/errors/ThunderIDError.d.ts +0 -17
- package/dist/errors/ThunderIDError.d.ts.map +1 -1
- package/dist/errors/ThunderIDRuntimeError.d.ts +0 -17
- package/dist/errors/ThunderIDRuntimeError.d.ts.map +1 -1
- package/dist/errors/exception.d.ts +0 -17
- package/dist/errors/exception.d.ts.map +1 -1
- package/dist/i18n/constants/TranslationBundleConstants.d.ts +0 -17
- package/dist/i18n/constants/TranslationBundleConstants.d.ts.map +1 -1
- package/dist/i18n/models/i18n.d.ts +0 -17
- package/dist/i18n/models/i18n.d.ts.map +1 -1
- package/dist/i18n/translations/en-US.d.ts +0 -17
- package/dist/i18n/translations/en-US.d.ts.map +1 -1
- package/dist/i18n/translations/fr-FR.d.ts +0 -17
- package/dist/i18n/translations/fr-FR.d.ts.map +1 -1
- package/dist/i18n/translations/hi-IN.d.ts +0 -17
- package/dist/i18n/translations/hi-IN.d.ts.map +1 -1
- package/dist/i18n/translations/index.d.ts +0 -17
- package/dist/i18n/translations/index.d.ts.map +1 -1
- package/dist/i18n/translations/ja-JP.d.ts +0 -17
- package/dist/i18n/translations/ja-JP.d.ts.map +1 -1
- package/dist/i18n/translations/pt-BR.d.ts +0 -17
- package/dist/i18n/translations/pt-BR.d.ts.map +1 -1
- package/dist/i18n/translations/pt-PT.d.ts +0 -17
- package/dist/i18n/translations/pt-PT.d.ts.map +1 -1
- package/dist/i18n/translations/si-LK.d.ts +0 -17
- package/dist/i18n/translations/si-LK.d.ts.map +1 -1
- package/dist/i18n/translations/ta-IN.d.ts +0 -17
- package/dist/i18n/translations/ta-IN.d.ts.map +1 -1
- package/dist/i18n/translations/te-IN.d.ts +0 -17
- package/dist/i18n/translations/te-IN.d.ts.map +1 -1
- package/dist/i18n/utils/getDefaultI18nBundles.d.ts +0 -17
- package/dist/i18n/utils/getDefaultI18nBundles.d.ts.map +1 -1
- package/dist/i18n/utils/normalizeTranslations.d.ts +0 -17
- package/dist/i18n/utils/normalizeTranslations.d.ts.map +1 -1
- package/dist/index.d.ts +0 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1378 -1875
- package/dist/models/agent.d.ts +0 -17
- package/dist/models/agent.d.ts.map +1 -1
- package/dist/models/auth-code-response.d.ts +0 -17
- package/dist/models/auth-code-response.d.ts.map +1 -1
- package/dist/models/ciba.d.ts +0 -17
- package/dist/models/ciba.d.ts.map +1 -1
- package/dist/models/client.d.ts +0 -17
- package/dist/models/client.d.ts.map +1 -1
- package/dist/models/config.d.ts +0 -17
- package/dist/models/config.d.ts.map +1 -1
- package/dist/models/crypto.d.ts +0 -17
- package/dist/models/crypto.d.ts.map +1 -1
- package/dist/models/embedded-flow.d.ts +0 -17
- package/dist/models/embedded-flow.d.ts.map +1 -1
- package/dist/models/embedded-recovery-flow.d.ts +0 -17
- package/dist/models/embedded-recovery-flow.d.ts.map +1 -1
- package/dist/models/embedded-signin-flow.d.ts +5 -17
- package/dist/models/embedded-signin-flow.d.ts.map +1 -1
- package/dist/models/embedded-signup-flow.d.ts +0 -17
- package/dist/models/embedded-signup-flow.d.ts.map +1 -1
- package/dist/models/extensions/components.d.ts +0 -17
- package/dist/models/extensions/components.d.ts.map +1 -1
- package/dist/models/field.d.ts +0 -17
- package/dist/models/field.d.ts.map +1 -1
- package/dist/models/flow-meta.d.ts +0 -17
- package/dist/models/flow-meta.d.ts.map +1 -1
- package/dist/models/flow.d.ts +1 -19
- package/dist/models/flow.d.ts.map +1 -1
- package/dist/models/http.d.ts +0 -17
- package/dist/models/http.d.ts.map +1 -1
- package/dist/models/oauth-request.d.ts +0 -17
- package/dist/models/oauth-request.d.ts.map +1 -1
- package/dist/models/oauth-response.d.ts +0 -17
- package/dist/models/oauth-response.d.ts.map +1 -1
- package/dist/models/oidc-discovery.d.ts +0 -17
- package/dist/models/oidc-discovery.d.ts.map +1 -1
- package/dist/models/oidc-endpoints.d.ts +0 -17
- package/dist/models/oidc-endpoints.d.ts.map +1 -1
- package/dist/models/session.d.ts +0 -17
- package/dist/models/session.d.ts.map +1 -1
- package/dist/models/store.d.ts +0 -17
- package/dist/models/store.d.ts.map +1 -1
- package/dist/models/token-endpoint-auth.d.ts +0 -17
- package/dist/models/token-endpoint-auth.d.ts.map +1 -1
- package/dist/models/token.d.ts +0 -17
- package/dist/models/token.d.ts.map +1 -1
- package/dist/models/translation.d.ts +0 -17
- package/dist/models/translation.d.ts.map +1 -1
- package/dist/models/user.d.ts +0 -17
- package/dist/models/user.d.ts.map +1 -1
- package/dist/models/utility-types.d.ts +0 -17
- package/dist/models/utility-types.d.ts.map +1 -1
- package/dist/models/vars.d.ts +0 -17
- package/dist/models/vars.d.ts.map +1 -1
- package/dist/theme/createTheme.d.ts +0 -17
- package/dist/theme/createTheme.d.ts.map +1 -1
- package/dist/theme/types.d.ts +0 -17
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/utils/AuthenticationHelper.d.ts +0 -17
- package/dist/utils/AuthenticationHelper.d.ts.map +1 -1
- package/dist/utils/arrayBufferToBase64url.d.ts +0 -17
- package/dist/utils/arrayBufferToBase64url.d.ts.map +1 -1
- package/dist/utils/base64Encode.d.ts +0 -17
- package/dist/utils/base64Encode.d.ts.map +1 -1
- package/dist/utils/base64urlToArrayBuffer.d.ts +0 -17
- package/dist/utils/base64urlToArrayBuffer.d.ts.map +1 -1
- package/dist/utils/bem.d.ts +0 -17
- package/dist/utils/bem.d.ts.map +1 -1
- package/dist/utils/buildValidatorFromRules.d.ts +0 -17
- package/dist/utils/buildValidatorFromRules.d.ts.map +1 -1
- package/dist/utils/containsMetaFlowTemplateLiteral.d.ts +0 -17
- package/dist/utils/containsMetaFlowTemplateLiteral.d.ts.map +1 -1
- package/dist/utils/countryCodeToFlagEmoji.d.ts +0 -17
- package/dist/utils/countryCodeToFlagEmoji.d.ts.map +1 -1
- package/dist/utils/deepMerge.d.ts +0 -17
- package/dist/utils/deepMerge.d.ts.map +1 -1
- package/dist/utils/evaluateValidationRule.d.ts +0 -17
- package/dist/utils/evaluateValidationRule.d.ts.map +1 -1
- package/dist/utils/extractEmojiFromUri.d.ts +0 -17
- package/dist/utils/extractEmojiFromUri.d.ts.map +1 -1
- package/dist/utils/extractPkceStorageKeyFromState.d.ts +0 -17
- package/dist/utils/extractPkceStorageKeyFromState.d.ts.map +1 -1
- package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts +0 -17
- package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts.map +1 -1
- package/dist/utils/extractUserClaimsFromIdToken.d.ts +0 -17
- package/dist/utils/extractUserClaimsFromIdToken.d.ts.map +1 -1
- package/dist/utils/formatDate.d.ts +0 -17
- package/dist/utils/formatDate.d.ts.map +1 -1
- package/dist/utils/generatePkceStorageKey.d.ts +0 -17
- package/dist/utils/generatePkceStorageKey.d.ts.map +1 -1
- package/dist/utils/generateStateParamForRequestCorrelation.d.ts +0 -17
- package/dist/utils/generateStateParamForRequestCorrelation.d.ts.map +1 -1
- package/dist/utils/get.d.ts +0 -17
- package/dist/utils/get.d.ts.map +1 -1
- package/dist/utils/getAuthorizeRequestUrlParams.d.ts +0 -17
- package/dist/utils/getAuthorizeRequestUrlParams.d.ts.map +1 -1
- package/dist/utils/getLatestStateParam.d.ts +0 -17
- package/dist/utils/getLatestStateParam.d.ts.map +1 -1
- package/dist/utils/getRedirectBasedSignUpUrl.d.ts +0 -17
- package/dist/utils/getRedirectBasedSignUpUrl.d.ts.map +1 -1
- package/dist/utils/getVendorPrefix.d.ts +0 -17
- package/dist/utils/getVendorPrefix.d.ts.map +1 -1
- package/dist/utils/injectRequestedPermissions.d.ts +0 -17
- package/dist/utils/injectRequestedPermissions.d.ts.map +1 -1
- package/dist/utils/isEmojiUri.d.ts +0 -17
- package/dist/utils/isEmojiUri.d.ts.map +1 -1
- package/dist/utils/isEmpty.d.ts +0 -17
- package/dist/utils/isEmpty.d.ts.map +1 -1
- package/dist/utils/isMetaFlowTemplateLiteral.d.ts +0 -17
- package/dist/utils/isMetaFlowTemplateLiteral.d.ts.map +1 -1
- package/dist/utils/isRecognizedBaseUrlPattern.d.ts +0 -17
- package/dist/utils/isRecognizedBaseUrlPattern.d.ts.map +1 -1
- package/dist/utils/isTranslationFlowTemplateLiteral.d.ts +0 -17
- package/dist/utils/isTranslationFlowTemplateLiteral.d.ts.map +1 -1
- package/dist/utils/logger.d.ts +0 -17
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/parseApiErrorMessage.d.ts +0 -17
- package/dist/utils/parseApiErrorMessage.d.ts.map +1 -1
- package/dist/utils/parseFlowTemplateLiteral.d.ts +0 -17
- package/dist/utils/parseFlowTemplateLiteral.d.ts.map +1 -1
- package/dist/utils/processOpenIDScopes.d.ts +0 -17
- package/dist/utils/processOpenIDScopes.d.ts.map +1 -1
- package/dist/utils/processUsername.d.ts +0 -17
- package/dist/utils/processUsername.d.ts.map +1 -1
- package/dist/utils/removeTrailingSlash.d.ts +0 -17
- package/dist/utils/removeTrailingSlash.d.ts.map +1 -1
- package/dist/utils/resolveFieldName.d.ts +0 -17
- package/dist/utils/resolveFieldName.d.ts.map +1 -1
- package/dist/utils/resolveFlowTemplateLiterals.d.ts +0 -17
- package/dist/utils/resolveFlowTemplateLiterals.d.ts.map +1 -1
- package/dist/utils/resolveLocaleDisplayName.d.ts +0 -17
- package/dist/utils/resolveLocaleDisplayName.d.ts.map +1 -1
- package/dist/utils/resolveLocaleEmoji.d.ts +0 -17
- package/dist/utils/resolveLocaleEmoji.d.ts.map +1 -1
- package/dist/utils/resolveMeta.d.ts +0 -17
- package/dist/utils/resolveMeta.d.ts.map +1 -1
- package/dist/utils/resolveResourceEndpoint.d.ts +0 -17
- package/dist/utils/resolveResourceEndpoint.d.ts.map +1 -1
- package/dist/utils/set.d.ts +0 -17
- package/dist/utils/set.d.ts.map +1 -1
- package/dist/utils/startCase.d.ts +0 -17
- package/dist/utils/startCase.d.ts.map +1 -1
- package/dist/utils/withVendorCSSClassPrefix.d.ts +1 -18
- package/dist/utils/withVendorCSSClassPrefix.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -14,23 +14,6 @@ var __export = (all) => {
|
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/constants/TokenConstants.ts
|
|
16
16
|
/**
|
|
17
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
18
|
-
*
|
|
19
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
20
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
21
|
-
* in compliance with the License.
|
|
22
|
-
* You may obtain a copy of the License at
|
|
23
|
-
*
|
|
24
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
-
*
|
|
26
|
-
* Unless required by applicable law or agreed to in writing,
|
|
27
|
-
* software distributed under the License is distributed on an
|
|
28
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
29
|
-
* KIND, either express or implied. See the License for the
|
|
30
|
-
* specific language governing permissions and limitations
|
|
31
|
-
* under the License.
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
17
|
* Constants related to OIDC token management and storage.
|
|
35
18
|
* This object contains configuration values and storage keys
|
|
36
19
|
* used in token validation and management processes.
|
|
@@ -67,23 +50,6 @@ var TokenConstants_default = TokenConstants;
|
|
|
67
50
|
//#endregion
|
|
68
51
|
//#region src/errors/exception.ts
|
|
69
52
|
/**
|
|
70
|
-
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
71
|
-
*
|
|
72
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
73
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
74
|
-
* in compliance with the License.
|
|
75
|
-
* You may obtain a copy of the License at
|
|
76
|
-
*
|
|
77
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
78
|
-
*
|
|
79
|
-
* Unless required by applicable law or agreed to in writing,
|
|
80
|
-
* software distributed under the License is distributed on an
|
|
81
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
82
|
-
* KIND, either express or implied. See the License for the
|
|
83
|
-
* specific language governing permissions and limitations
|
|
84
|
-
* under the License.
|
|
85
|
-
*/
|
|
86
|
-
/**
|
|
87
53
|
* @deprecated Use `ThunderIDRuntimeError` for runtime errors and `ThunderIDAPIError` for API errors.
|
|
88
54
|
*/
|
|
89
55
|
var ThunderIDAuthException = class extends Error {
|
|
@@ -171,23 +137,6 @@ var IsomorphicCrypto = class {
|
|
|
171
137
|
//#endregion
|
|
172
138
|
//#region src/errors/ThunderIDError.ts
|
|
173
139
|
/**
|
|
174
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
175
|
-
*
|
|
176
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
177
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
178
|
-
* in compliance with the License.
|
|
179
|
-
* You may obtain a copy of the License at
|
|
180
|
-
*
|
|
181
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
182
|
-
*
|
|
183
|
-
* Unless required by applicable law or agreed to in writing,
|
|
184
|
-
* software distributed under the License is distributed on an
|
|
185
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
186
|
-
* KIND, either express or implied. See the License for the
|
|
187
|
-
* specific language governing permissions and limitations
|
|
188
|
-
* under the License.
|
|
189
|
-
*/
|
|
190
|
-
/**
|
|
191
140
|
* Base class for all ThunderID errors. This class extends the native Error class
|
|
192
141
|
* and adds support for error codes and proper stack traces. Each error is prefixed
|
|
193
142
|
* with a lightning emoji and the SDK name for easy identification.
|
|
@@ -236,23 +185,6 @@ var ThunderIDError = class ThunderIDError extends Error {
|
|
|
236
185
|
//#endregion
|
|
237
186
|
//#region src/utils/parseApiErrorMessage.ts
|
|
238
187
|
/**
|
|
239
|
-
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
240
|
-
*
|
|
241
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
242
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
243
|
-
* in compliance with the License.
|
|
244
|
-
* You may obtain a copy of the License at
|
|
245
|
-
*
|
|
246
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
247
|
-
*
|
|
248
|
-
* Unless required by applicable law or agreed to in writing,
|
|
249
|
-
* software distributed under the License is distributed on an
|
|
250
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
251
|
-
* KIND, either express or implied. See the License for the
|
|
252
|
-
* specific language governing permissions and limitations
|
|
253
|
-
* under the License.
|
|
254
|
-
*/
|
|
255
|
-
/**
|
|
256
188
|
* Attempts to extract a human-readable message from a structured API error response body.
|
|
257
189
|
*
|
|
258
190
|
* The backend returns errors in the following form:
|
|
@@ -415,23 +347,6 @@ let EmbeddedSignInFlowType = /* @__PURE__ */ function(EmbeddedSignInFlowType$1)
|
|
|
415
347
|
//#endregion
|
|
416
348
|
//#region src/utils/injectRequestedPermissions.ts
|
|
417
349
|
/**
|
|
418
|
-
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
419
|
-
*
|
|
420
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
421
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
422
|
-
* in compliance with the License.
|
|
423
|
-
* You may obtain a copy of the License at
|
|
424
|
-
*
|
|
425
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
426
|
-
*
|
|
427
|
-
* Unless required by applicable law or agreed to in writing,
|
|
428
|
-
* software distributed under the License is distributed on an
|
|
429
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
430
|
-
* KIND, either express or implied. See the License for the
|
|
431
|
-
* specific language governing permissions and limitations
|
|
432
|
-
* under the License.
|
|
433
|
-
*/
|
|
434
|
-
/**
|
|
435
350
|
* Strips the top-level `scopes` field from a payload and injects it as
|
|
436
351
|
* `inputs.requested_permissions` (space-separated string).
|
|
437
352
|
*
|
|
@@ -453,1758 +368,1601 @@ const injectRequestedPermissions = (payload) => {
|
|
|
453
368
|
var injectRequestedPermissions_default = injectRequestedPermissions;
|
|
454
369
|
|
|
455
370
|
//#endregion
|
|
456
|
-
//#region src/
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
verbose: true
|
|
467
|
-
} : basePayload;
|
|
468
|
-
const response = await fetch(endpoint, {
|
|
469
|
-
...requestConfig,
|
|
470
|
-
body: JSON.stringify(requestPayload),
|
|
471
|
-
headers: {
|
|
472
|
-
Accept: "application/json",
|
|
473
|
-
"Content-Type": "application/json",
|
|
474
|
-
...isNewFlowStart && flowSecret ? { "Flow-Secret": flowSecret } : {},
|
|
475
|
-
...requestConfig.headers
|
|
476
|
-
},
|
|
477
|
-
method: requestConfig.method || "POST"
|
|
478
|
-
});
|
|
479
|
-
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedSignInFlow-ResponseError-001", "javascript", response.status, response.statusText, "Authorization request failed");
|
|
480
|
-
const flowResponse = await response.json();
|
|
481
|
-
if (flowResponse.flowStatus === EmbeddedSignInFlowStatus.Complete && flowResponse.assertion && authId) try {
|
|
482
|
-
const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
|
|
483
|
-
body: JSON.stringify({
|
|
484
|
-
assertion: flowResponse.assertion,
|
|
485
|
-
authId
|
|
486
|
-
}),
|
|
487
|
-
credentials: "include",
|
|
488
|
-
headers: {
|
|
489
|
-
Accept: "application/json",
|
|
490
|
-
"Content-Type": "application/json",
|
|
491
|
-
...requestConfig.headers
|
|
492
|
-
},
|
|
493
|
-
method: "POST"
|
|
494
|
-
});
|
|
495
|
-
if (!oauth2Response.ok) throw new ThunderIDAPIError(await oauth2Response.text(), "executeEmbeddedSignInFlow-OAuth2Error-002", "javascript", oauth2Response.status, oauth2Response.statusText, "OAuth2 authorization failed");
|
|
496
|
-
const oauth2Result = await oauth2Response.json();
|
|
497
|
-
return {
|
|
498
|
-
flowStatus: flowResponse.flowStatus,
|
|
499
|
-
redirectUrl: oauth2Result["redirect_uri"]
|
|
500
|
-
};
|
|
501
|
-
} catch (authError) {
|
|
502
|
-
if (authError instanceof ThunderIDAPIError) throw authError;
|
|
503
|
-
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");
|
|
504
|
-
}
|
|
505
|
-
return flowResponse;
|
|
371
|
+
//#region src/utils/logger.ts
|
|
372
|
+
const PREFIX = "⚡ ThunderID";
|
|
373
|
+
/**
|
|
374
|
+
* Default logger configuration
|
|
375
|
+
*/
|
|
376
|
+
const DEFAULT_CONFIG$1 = {
|
|
377
|
+
level: "info",
|
|
378
|
+
prefix: `${PREFIX}`,
|
|
379
|
+
showLevel: true,
|
|
380
|
+
timestamps: true
|
|
506
381
|
};
|
|
507
|
-
var executeEmbeddedSignInFlow_default = executeEmbeddedSignInFlow;
|
|
508
|
-
|
|
509
|
-
//#endregion
|
|
510
|
-
//#region src/models/embedded-signup-flow.ts
|
|
511
382
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
* These statuses indicate the current state of the registration flow and determine
|
|
515
|
-
* the next action required by the client application. Each status provides specific
|
|
516
|
-
* guidance on how to proceed with the user registration process.
|
|
517
|
-
*
|
|
518
|
-
* @example
|
|
519
|
-
* ```typescript
|
|
520
|
-
* switch (response.flowStatus) {
|
|
521
|
-
* case EmbeddedSignUpFlowStatus.Incomplete:
|
|
522
|
-
* // More user input needed - render registration form components
|
|
523
|
-
* break;
|
|
524
|
-
* case EmbeddedSignUpFlowStatus.Complete:
|
|
525
|
-
* // Registration successful - handle completion
|
|
526
|
-
* break;
|
|
527
|
-
* case EmbeddedSignUpFlowStatus.Error:
|
|
528
|
-
* // Registration failed - show error details
|
|
529
|
-
* const errorResponse = response as EmbeddedSignUpFlowErrorResponse;
|
|
530
|
-
* showError(errorResponse.error.description.defaultValue);
|
|
531
|
-
* break;
|
|
532
|
-
* }
|
|
533
|
-
* ```
|
|
534
|
-
*
|
|
535
|
-
* @experimental Part of the new ThunderID API
|
|
383
|
+
* Environment detection utilities
|
|
536
384
|
*/
|
|
537
|
-
|
|
385
|
+
const isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
386
|
+
const isNode = () => typeof process !== "undefined" && process.versions && process.versions.node;
|
|
387
|
+
/**
|
|
388
|
+
* Color codes for terminal output (Node.js)
|
|
389
|
+
*/
|
|
390
|
+
const COLORS = {
|
|
391
|
+
blue: "\x1B[34m",
|
|
392
|
+
bright: "\x1B[1m",
|
|
393
|
+
cyan: "\x1B[36m",
|
|
394
|
+
dim: "\x1B[2m",
|
|
395
|
+
gray: "\x1B[90m",
|
|
396
|
+
green: "\x1B[32m",
|
|
397
|
+
magenta: "\x1B[35m",
|
|
398
|
+
red: "\x1B[31m",
|
|
399
|
+
reset: "\x1B[0m",
|
|
400
|
+
white: "\x1B[37m",
|
|
401
|
+
yellow: "\x1B[33m"
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* Browser console styling
|
|
405
|
+
*/
|
|
406
|
+
const BROWSER_STYLES = {
|
|
407
|
+
debug: "color: #6b7280; font-weight: normal;",
|
|
408
|
+
error: "color: #dc2626; font-weight: bold;",
|
|
409
|
+
info: "color: #2563eb; font-weight: bold;",
|
|
410
|
+
prefix: "color: #7c3aed; font-weight: bold;",
|
|
411
|
+
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
412
|
+
warn: "color: #d97706; font-weight: bold;"
|
|
413
|
+
};
|
|
414
|
+
const LOG_LEVEL_ORDER = {
|
|
415
|
+
debug: 0,
|
|
416
|
+
error: 3,
|
|
417
|
+
info: 1,
|
|
418
|
+
warn: 2
|
|
419
|
+
};
|
|
420
|
+
/**
|
|
421
|
+
* Universal logger class that works in both browser and Node.js environments
|
|
422
|
+
*/
|
|
423
|
+
var Logger = class Logger {
|
|
424
|
+
config;
|
|
425
|
+
constructor(config = {}) {
|
|
426
|
+
this.config = {
|
|
427
|
+
...DEFAULT_CONFIG$1,
|
|
428
|
+
...config
|
|
429
|
+
};
|
|
430
|
+
}
|
|
538
431
|
/**
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
* The user has successfully registered and the flow can proceed to
|
|
542
|
-
* OAuth2 completion or redirection. Check for redirectUrl or assertion
|
|
543
|
-
* data in the response for next steps.
|
|
432
|
+
* Update logger configuration
|
|
544
433
|
*/
|
|
545
|
-
|
|
434
|
+
configure(config) {
|
|
435
|
+
this.config = {
|
|
436
|
+
...this.config,
|
|
437
|
+
...config
|
|
438
|
+
};
|
|
439
|
+
}
|
|
546
440
|
/**
|
|
547
|
-
*
|
|
548
|
-
*
|
|
549
|
-
* Registration failed due to validation errors, duplicate user,
|
|
550
|
-
* system errors, or other issues. The response will be of type
|
|
551
|
-
* `EmbeddedSignUpFlowErrorResponse` containing detailed failure
|
|
552
|
-
* information that can be displayed to the user.
|
|
553
|
-
*
|
|
554
|
-
* @see {@link EmbeddedSignUpFlowErrorResponse} for error response structure
|
|
441
|
+
* Get current configuration
|
|
555
442
|
*/
|
|
556
|
-
|
|
443
|
+
getConfig() {
|
|
444
|
+
return { ...this.config };
|
|
445
|
+
}
|
|
557
446
|
/**
|
|
558
|
-
*
|
|
559
|
-
*
|
|
560
|
-
* More registration steps are needed. The response will contain
|
|
561
|
-
* components in data.meta.components that should be rendered to
|
|
562
|
-
* collect additional user information (e.g., profile data, verification).
|
|
447
|
+
* Check if a log level should be output
|
|
563
448
|
*/
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
* Type enumeration for ThunderID embedded sign-up flow responses.
|
|
569
|
-
*
|
|
570
|
-
* Determines the nature of the registration flow response and how the client
|
|
571
|
-
* should handle the returned data. This affects both UI rendering and flow
|
|
572
|
-
* continuation logic during the user registration process.
|
|
573
|
-
*
|
|
574
|
-
* @experimental Part of the new ThunderID API
|
|
575
|
-
*/
|
|
576
|
-
let EmbeddedSignUpFlowType = /* @__PURE__ */ function(EmbeddedSignUpFlowType$1) {
|
|
449
|
+
shouldLog(level) {
|
|
450
|
+
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
451
|
+
}
|
|
577
452
|
/**
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
* Used for social registration providers, external identity providers,
|
|
581
|
-
* or other flows that require navigating to an external URL during
|
|
582
|
-
* the registration process. The response will contain redirection information.
|
|
453
|
+
* Get timestamp string
|
|
583
454
|
*/
|
|
584
|
-
|
|
455
|
+
static getTimestamp() {
|
|
456
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
457
|
+
}
|
|
585
458
|
/**
|
|
586
|
-
*
|
|
587
|
-
*
|
|
588
|
-
* Standard embedded registration flow response containing UI components
|
|
589
|
-
* that should be rendered within the current application context.
|
|
590
|
-
* Most common type for embedded user registration.
|
|
459
|
+
* Get log level string
|
|
591
460
|
*/
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
461
|
+
static getLevelString(level) {
|
|
462
|
+
switch (level) {
|
|
463
|
+
case "debug": return "DEBUG";
|
|
464
|
+
case "info": return "INFO";
|
|
465
|
+
case "warn": return "WARN";
|
|
466
|
+
case "error": return "ERROR";
|
|
467
|
+
default: return "UNKNOWN";
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Format message for Node.js terminal
|
|
472
|
+
*/
|
|
473
|
+
formatForNode(level, message) {
|
|
474
|
+
const parts = [];
|
|
475
|
+
if (this.config.timestamps) parts.push(`${COLORS.gray}[${Logger.getTimestamp()}]${COLORS.reset}`);
|
|
476
|
+
if (this.config.prefix) parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);
|
|
477
|
+
if (this.config.showLevel) {
|
|
478
|
+
const levelStr = Logger.getLevelString(level);
|
|
479
|
+
let coloredLevel;
|
|
480
|
+
switch (level) {
|
|
481
|
+
case "debug":
|
|
482
|
+
coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
|
|
483
|
+
break;
|
|
484
|
+
case "info":
|
|
485
|
+
coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
|
|
486
|
+
break;
|
|
487
|
+
case "warn":
|
|
488
|
+
coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
|
|
489
|
+
break;
|
|
490
|
+
case "error":
|
|
491
|
+
coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
|
|
492
|
+
break;
|
|
493
|
+
default: coloredLevel = `[${levelStr}]`;
|
|
494
|
+
}
|
|
495
|
+
parts.push(coloredLevel);
|
|
496
|
+
}
|
|
497
|
+
parts.push(message);
|
|
498
|
+
return parts.join(" ");
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Log message using appropriate method
|
|
502
|
+
*/
|
|
503
|
+
logMessage(level, message, ...args) {
|
|
504
|
+
if (!this.shouldLog(level)) return;
|
|
505
|
+
if (this.config.formatter) {
|
|
506
|
+
this.config.formatter(level, message, ...args);
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
if (isBrowser()) this.logToBrowser(level, message, ...args);
|
|
510
|
+
else if (isNode()) this.logToNode(level, message, ...args);
|
|
511
|
+
else console.log(message, ...args);
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Log to browser console with styling
|
|
515
|
+
*/
|
|
516
|
+
logToBrowser(level, message, ...args) {
|
|
517
|
+
const parts = [];
|
|
518
|
+
const styles = [];
|
|
519
|
+
if (this.config.timestamps) {
|
|
520
|
+
parts.push(`%c[${Logger.getTimestamp()}]`);
|
|
521
|
+
styles.push(BROWSER_STYLES.timestamp);
|
|
522
|
+
}
|
|
523
|
+
if (this.config.prefix) {
|
|
524
|
+
parts.push(`%c${this.config.prefix}`);
|
|
525
|
+
styles.push(BROWSER_STYLES.prefix);
|
|
526
|
+
}
|
|
527
|
+
if (this.config.showLevel) {
|
|
528
|
+
const levelStr = Logger.getLevelString(level);
|
|
529
|
+
parts.push(`%c[${levelStr}]`);
|
|
530
|
+
switch (level) {
|
|
531
|
+
case "debug":
|
|
532
|
+
styles.push(BROWSER_STYLES.debug);
|
|
533
|
+
break;
|
|
534
|
+
case "info":
|
|
535
|
+
styles.push(BROWSER_STYLES.info);
|
|
536
|
+
break;
|
|
537
|
+
case "warn":
|
|
538
|
+
styles.push(BROWSER_STYLES.warn);
|
|
539
|
+
break;
|
|
540
|
+
case "error":
|
|
541
|
+
styles.push(BROWSER_STYLES.error);
|
|
542
|
+
break;
|
|
543
|
+
default: styles.push("");
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
parts.push(`%c${message}`);
|
|
547
|
+
styles.push("color: inherit; font-weight: normal;");
|
|
548
|
+
const formattedMessage = parts.join(" ");
|
|
549
|
+
switch (level) {
|
|
550
|
+
case "debug":
|
|
551
|
+
console.debug(formattedMessage, ...styles, ...args);
|
|
552
|
+
break;
|
|
553
|
+
case "info":
|
|
554
|
+
console.info(formattedMessage, ...styles, ...args);
|
|
555
|
+
break;
|
|
556
|
+
case "warn":
|
|
557
|
+
console.warn(formattedMessage, ...styles, ...args);
|
|
558
|
+
break;
|
|
559
|
+
case "error":
|
|
560
|
+
console.error(formattedMessage, ...styles, ...args);
|
|
561
|
+
break;
|
|
562
|
+
default: console.log(formattedMessage, ...styles, ...args);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Log to Node.js console
|
|
567
|
+
*/
|
|
568
|
+
logToNode(level, message, ...args) {
|
|
569
|
+
const formattedMessage = this.formatForNode(level, message);
|
|
570
|
+
switch (level) {
|
|
571
|
+
case "debug":
|
|
572
|
+
console.debug(formattedMessage, ...args);
|
|
573
|
+
break;
|
|
574
|
+
case "info":
|
|
575
|
+
console.info(formattedMessage, ...args);
|
|
576
|
+
break;
|
|
577
|
+
case "warn":
|
|
578
|
+
console.warn(formattedMessage, ...args);
|
|
579
|
+
break;
|
|
580
|
+
case "error":
|
|
581
|
+
console.error(formattedMessage, ...args);
|
|
582
|
+
break;
|
|
583
|
+
default: console.log(formattedMessage, ...args);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Log debug message
|
|
588
|
+
*/
|
|
589
|
+
debug(message, ...args) {
|
|
590
|
+
this.logMessage("debug", message, ...args);
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Log info message
|
|
594
|
+
*/
|
|
595
|
+
info(message, ...args) {
|
|
596
|
+
this.logMessage("info", message, ...args);
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Log warning message
|
|
600
|
+
*/
|
|
601
|
+
warn(message, ...args) {
|
|
602
|
+
this.logMessage("warn", message, ...args);
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Log error message
|
|
606
|
+
*/
|
|
607
|
+
error(message, ...args) {
|
|
608
|
+
this.logMessage("error", message, ...args);
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Create a child logger with additional prefix
|
|
612
|
+
*/
|
|
613
|
+
child(prefix) {
|
|
614
|
+
const childPrefix = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;
|
|
615
|
+
return new Logger({
|
|
616
|
+
...this.config,
|
|
617
|
+
prefix: childPrefix
|
|
634
618
|
});
|
|
635
|
-
if (!oauth2Response.ok) throw new ThunderIDAPIError(await oauth2Response.text(), "executeEmbeddedSignUpFlow-OAuth2Error-002", "javascript", oauth2Response.status, oauth2Response.statusText, "OAuth2 authorization failed");
|
|
636
|
-
const oauth2Result = await oauth2Response.json();
|
|
637
|
-
return {
|
|
638
|
-
flowStatus: flowResponse.flowStatus,
|
|
639
|
-
redirectUrl: oauth2Result["redirect_uri"]
|
|
640
|
-
};
|
|
641
|
-
} catch (authError) {
|
|
642
|
-
if (authError instanceof ThunderIDAPIError) throw authError;
|
|
643
|
-
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");
|
|
644
619
|
}
|
|
645
|
-
|
|
620
|
+
/**
|
|
621
|
+
* Set log level
|
|
622
|
+
*/
|
|
623
|
+
setLevel(level) {
|
|
624
|
+
this.config.level = level;
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Get current log level
|
|
628
|
+
*/
|
|
629
|
+
getLevel() {
|
|
630
|
+
return this.config.level;
|
|
631
|
+
}
|
|
646
632
|
};
|
|
647
|
-
var executeEmbeddedSignUpFlow_default = executeEmbeddedSignUpFlow;
|
|
648
|
-
|
|
649
|
-
//#endregion
|
|
650
|
-
//#region src/api/executeEmbeddedRecoveryFlow.ts
|
|
651
633
|
/**
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
* This function handles password-recovery and account-recovery flows driven by the
|
|
655
|
-
* ThunderID server. The server returns UI components for each step (e.g. username
|
|
656
|
-
* collection, OTP verification, password reset) and this function forwards the
|
|
657
|
-
* user's responses back to the server.
|
|
658
|
-
*
|
|
659
|
-
* @param requestConfig - Request configuration containing URL, payload, and optional headers.
|
|
660
|
-
* @returns A promise that resolves with the flow execution response.
|
|
661
|
-
* @throws ThunderIDAPIError when the request fails or a payload is missing.
|
|
662
|
-
*
|
|
663
|
-
* @example
|
|
664
|
-
* ```typescript
|
|
665
|
-
* // Initiate recovery flow
|
|
666
|
-
* const response = await executeEmbeddedRecoveryFlow({
|
|
667
|
-
* baseUrl: 'https://localhost:8090',
|
|
668
|
-
* payload: {
|
|
669
|
-
* flowType: 'RECOVERY',
|
|
670
|
-
* applicationId: 'my-app-id',
|
|
671
|
-
* },
|
|
672
|
-
* });
|
|
673
|
-
*
|
|
674
|
-
* // Continue recovery flow with user input
|
|
675
|
-
* const nextResponse = await executeEmbeddedRecoveryFlow({
|
|
676
|
-
* baseUrl: 'https://localhost:8090',
|
|
677
|
-
* payload: {
|
|
678
|
-
* executionId: response.executionId,
|
|
679
|
-
* action: 'submit',
|
|
680
|
-
* inputs: { username: 'user@example.com' },
|
|
681
|
-
* challengeToken: response.challengeToken,
|
|
682
|
-
* },
|
|
683
|
-
* });
|
|
684
|
-
* ```
|
|
634
|
+
* Default logger instance
|
|
685
635
|
*/
|
|
686
|
-
const
|
|
687
|
-
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.");
|
|
688
|
-
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
689
|
-
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
690
|
-
const hasOnlyAppIdAndFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 2;
|
|
691
|
-
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
692
|
-
const requestPayload = hasOnlyAppIdAndFlowType || hasOnlyFlowId ? {
|
|
693
|
-
...cleanPayload,
|
|
694
|
-
verbose: true
|
|
695
|
-
} : cleanPayload;
|
|
696
|
-
const response = await fetch(endpoint, {
|
|
697
|
-
...requestConfig,
|
|
698
|
-
body: JSON.stringify(requestPayload),
|
|
699
|
-
headers: {
|
|
700
|
-
Accept: "application/json",
|
|
701
|
-
"Content-Type": "application/json",
|
|
702
|
-
...requestConfig.headers
|
|
703
|
-
},
|
|
704
|
-
method: requestConfig.method || "POST"
|
|
705
|
-
});
|
|
706
|
-
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedRecoveryFlow-ResponseError-001", "javascript", response.status, response.statusText, "Recovery request failed");
|
|
707
|
-
return await response.json();
|
|
708
|
-
};
|
|
709
|
-
var executeEmbeddedRecoveryFlow_default = executeEmbeddedRecoveryFlow;
|
|
710
|
-
|
|
711
|
-
//#endregion
|
|
712
|
-
//#region src/models/embedded-flow.ts
|
|
636
|
+
const logger = new Logger();
|
|
713
637
|
/**
|
|
714
|
-
*
|
|
715
|
-
*
|
|
716
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
717
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
718
|
-
* in compliance with the License.
|
|
719
|
-
* You may obtain a copy of the License at
|
|
720
|
-
*
|
|
721
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
722
|
-
*
|
|
723
|
-
* Unless required by applicable law or agreed to in writing,
|
|
724
|
-
* software distributed under the License is distributed on an
|
|
725
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
726
|
-
* KIND, either express or implied. See the License for the
|
|
727
|
-
* specific language governing permissions and limitations
|
|
728
|
-
* under the License.
|
|
638
|
+
* Create a new logger instance with custom configuration
|
|
729
639
|
*/
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
640
|
+
const createLogger = (config) => new Logger(config);
|
|
641
|
+
/**
|
|
642
|
+
* Default export - global logger instance
|
|
643
|
+
*/
|
|
644
|
+
var logger_default = logger;
|
|
645
|
+
/**
|
|
646
|
+
* Named exports for convenience
|
|
647
|
+
*/
|
|
648
|
+
const debug = (message, ...args) => logger.debug(message, ...args);
|
|
649
|
+
const info = (message, ...args) => logger.info(message, ...args);
|
|
650
|
+
const warn = (message, ...args) => logger.warn(message, ...args);
|
|
651
|
+
const error = (message, ...args) => logger.error(message, ...args);
|
|
742
652
|
/**
|
|
743
|
-
*
|
|
744
|
-
*
|
|
745
|
-
* These types define the different UI components that can be rendered
|
|
746
|
-
* as part of the embedded authentication flows. Each type corresponds
|
|
747
|
-
* to a specific UI element with its own behavior and properties.
|
|
748
|
-
*
|
|
749
|
-
* @example
|
|
750
|
-
* ```typescript
|
|
751
|
-
* // Check component type to render appropriate UI
|
|
752
|
-
* if (component.type === EmbeddedFlowComponentType.TextInput) {
|
|
753
|
-
* // Render text input field
|
|
754
|
-
* } else if (component.type === EmbeddedFlowComponentType.Action) {
|
|
755
|
-
* // Render button/action
|
|
756
|
-
* }
|
|
757
|
-
* ```
|
|
758
|
-
*
|
|
759
|
-
* @experimental This API may change in future versions
|
|
653
|
+
* Configure the default logger
|
|
760
654
|
*/
|
|
761
|
-
|
|
762
|
-
/** Interactive action component (buttons, links) for user interactions */
|
|
763
|
-
EmbeddedFlowComponentType$1["Action"] = "ACTION";
|
|
764
|
-
/** Container block component that groups other components */
|
|
765
|
-
EmbeddedFlowComponentType$1["Block"] = "BLOCK";
|
|
766
|
-
/** Consent component for displaying consent purposes and attributes */
|
|
767
|
-
EmbeddedFlowComponentType$1["Consent"] = "CONSENT";
|
|
768
|
-
/** Copyable text display component that shows text with a copy-to-clipboard action */
|
|
769
|
-
EmbeddedFlowComponentType$1["CopyableText"] = "COPYABLE_TEXT";
|
|
770
|
-
/** Date input field for selecting a calendar date */
|
|
771
|
-
EmbeddedFlowComponentType$1["DateInput"] = "DATE_INPUT";
|
|
772
|
-
/** Divider component for visual separation of content */
|
|
773
|
-
EmbeddedFlowComponentType$1["Divider"] = "DIVIDER";
|
|
774
|
-
/** Email input field with validation for email addresses. */
|
|
775
|
-
EmbeddedFlowComponentType$1["EmailInput"] = "EMAIL_INPUT";
|
|
776
|
-
/** Icon display component for rendering named vector icons */
|
|
777
|
-
EmbeddedFlowComponentType$1["Icon"] = "ICON";
|
|
778
|
-
/** Image display component for logos and illustrations */
|
|
779
|
-
EmbeddedFlowComponentType$1["Image"] = "IMAGE";
|
|
780
|
-
/** One-time password input field for multi-factor authentication */
|
|
781
|
-
EmbeddedFlowComponentType$1["OtpInput"] = "OTP_INPUT";
|
|
782
|
-
/** Organization unit tree picker for selecting an OU */
|
|
783
|
-
EmbeddedFlowComponentType$1["OuSelect"] = "OU_SELECT";
|
|
784
|
-
/** Password input field with masking for sensitive data */
|
|
785
|
-
EmbeddedFlowComponentType$1["PasswordInput"] = "PASSWORD_INPUT";
|
|
786
|
-
/** Phone number input field with country code support */
|
|
787
|
-
EmbeddedFlowComponentType$1["PhoneInput"] = "PHONE_INPUT";
|
|
788
|
-
/** Rich text display component that renders formatted HTML content */
|
|
789
|
-
EmbeddedFlowComponentType$1["RichText"] = "RICH_TEXT";
|
|
790
|
-
/** Select/dropdown input component for single choice selection */
|
|
791
|
-
EmbeddedFlowComponentType$1["Select"] = "SELECT";
|
|
792
|
-
/** Stack layout component for arranging children in a row or column */
|
|
793
|
-
EmbeddedFlowComponentType$1["Stack"] = "STACK";
|
|
794
|
-
/** Text display component for labels, headings, and messages */
|
|
795
|
-
EmbeddedFlowComponentType$1["Text"] = "TEXT";
|
|
796
|
-
/** Standard text input field for user data entry */
|
|
797
|
-
EmbeddedFlowComponentType$1["TextInput"] = "TEXT_INPUT";
|
|
798
|
-
/** Timer component for displaying a countdown */
|
|
799
|
-
EmbeddedFlowComponentType$1["Timer"] = "TIMER";
|
|
800
|
-
/** QR code display component for wallet-based flows (e.g. OpenID4VP) */
|
|
801
|
-
EmbeddedFlowComponentType$1["QrCode"] = "QR_CODE";
|
|
802
|
-
return EmbeddedFlowComponentType$1;
|
|
803
|
-
}({});
|
|
655
|
+
const configure = (config) => logger.configure(config);
|
|
804
656
|
/**
|
|
805
|
-
*
|
|
806
|
-
*
|
|
807
|
-
* @experimental This API may change in future versions
|
|
657
|
+
* Create component-specific loggers
|
|
808
658
|
*/
|
|
809
|
-
|
|
810
|
-
/** Danger action button for destructive operations */
|
|
811
|
-
EmbeddedFlowActionVariant$1["Danger"] = "DANGER";
|
|
812
|
-
/** Info action button for informational purposes */
|
|
813
|
-
EmbeddedFlowActionVariant$1["Info"] = "INFO";
|
|
814
|
-
/** Link-styled action button */
|
|
815
|
-
EmbeddedFlowActionVariant$1["Link"] = "LINK";
|
|
816
|
-
/** Outlined action button for secondary emphasis */
|
|
817
|
-
EmbeddedFlowActionVariant$1["Outlined"] = "OUTLINED";
|
|
818
|
-
/** Primary action button with highest visual emphasis */
|
|
819
|
-
EmbeddedFlowActionVariant$1["Primary"] = "PRIMARY";
|
|
820
|
-
/** Secondary action button with moderate visual emphasis */
|
|
821
|
-
EmbeddedFlowActionVariant$1["Secondary"] = "SECONDARY";
|
|
822
|
-
/** Success action button for positive confirmations */
|
|
823
|
-
EmbeddedFlowActionVariant$1["Success"] = "SUCCESS";
|
|
824
|
-
/** Tertiary action button with minimal visual emphasis */
|
|
825
|
-
EmbeddedFlowActionVariant$1["Tertiary"] = "TERTIARY";
|
|
826
|
-
/** Warning action button for cautionary actions */
|
|
827
|
-
EmbeddedFlowActionVariant$1["Warning"] = "WARNING";
|
|
828
|
-
return EmbeddedFlowActionVariant$1;
|
|
829
|
-
}({});
|
|
659
|
+
const createComponentLogger = (component) => logger.child(component);
|
|
830
660
|
/**
|
|
831
|
-
*
|
|
832
|
-
*
|
|
833
|
-
* @experimental This API may change in future versions
|
|
661
|
+
* Create package-specific logger
|
|
834
662
|
*/
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
EmbeddedFlowTextVariant$1["ButtonText"] = "BUTTON_TEXT";
|
|
842
|
-
/** Small caption text for annotations and descriptions */
|
|
843
|
-
EmbeddedFlowTextVariant$1["Caption"] = "CAPTION";
|
|
844
|
-
/** Largest heading level for main titles */
|
|
845
|
-
EmbeddedFlowTextVariant$1["Heading1"] = "HEADING_1";
|
|
846
|
-
/** Second level heading for major sections */
|
|
847
|
-
EmbeddedFlowTextVariant$1["Heading2"] = "HEADING_2";
|
|
848
|
-
/** Third level heading for subsections */
|
|
849
|
-
EmbeddedFlowTextVariant$1["Heading3"] = "HEADING_3";
|
|
850
|
-
/** Fourth level heading for minor sections */
|
|
851
|
-
EmbeddedFlowTextVariant$1["Heading4"] = "HEADING_4";
|
|
852
|
-
/** Fifth level heading for detailed sections */
|
|
853
|
-
EmbeddedFlowTextVariant$1["Heading5"] = "HEADING_5";
|
|
854
|
-
/** Smallest heading level for fine-grained sections */
|
|
855
|
-
EmbeddedFlowTextVariant$1["Heading6"] = "HEADING_6";
|
|
856
|
-
/** Overline text for labels and categories */
|
|
857
|
-
EmbeddedFlowTextVariant$1["Overline"] = "OVERLINE";
|
|
858
|
-
/** Primary subtitle text with larger emphasis */
|
|
859
|
-
EmbeddedFlowTextVariant$1["Subtitle1"] = "SUBTITLE_1";
|
|
860
|
-
/** Secondary subtitle text with moderate emphasis */
|
|
861
|
-
EmbeddedFlowTextVariant$1["Subtitle2"] = "SUBTITLE_2";
|
|
862
|
-
return EmbeddedFlowTextVariant$1;
|
|
863
|
-
}({});
|
|
663
|
+
const createPackageLogger = (packageName) => createLogger({
|
|
664
|
+
level: "info",
|
|
665
|
+
prefix: `${PREFIX} - ${packageName}`,
|
|
666
|
+
showLevel: true,
|
|
667
|
+
timestamps: true
|
|
668
|
+
});
|
|
864
669
|
/**
|
|
865
|
-
*
|
|
866
|
-
*
|
|
867
|
-
* @experimental This API may change in future versions
|
|
670
|
+
* Create package component logger (package + component)
|
|
868
671
|
*/
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
/** Cancel the current operation */
|
|
873
|
-
EmbeddedFlowEventType$1["Cancel"] = "CANCEL";
|
|
874
|
-
/** Navigate to a different flow step or page */
|
|
875
|
-
EmbeddedFlowEventType$1["Navigate"] = "NAVIGATE";
|
|
876
|
-
/** Reset form fields to initial state */
|
|
877
|
-
EmbeddedFlowEventType$1["Reset"] = "RESET";
|
|
878
|
-
/** Submit form data to the server */
|
|
879
|
-
EmbeddedFlowEventType$1["Submit"] = "SUBMIT";
|
|
880
|
-
/** Trigger an action or event */
|
|
881
|
-
EmbeddedFlowEventType$1["Trigger"] = "TRIGGER";
|
|
882
|
-
return EmbeddedFlowEventType$1;
|
|
883
|
-
}({});
|
|
672
|
+
const createPackageComponentLogger = (packageName, component) => {
|
|
673
|
+
return createPackageLogger(packageName).child(component);
|
|
674
|
+
};
|
|
884
675
|
|
|
885
676
|
//#endregion
|
|
886
|
-
//#region src/api/
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
* @example
|
|
899
|
-
* ```typescript
|
|
900
|
-
* // Admin initiating user onboarding (requires auth token)
|
|
901
|
-
* const response = await executeEmbeddedUserOnboardingFlow({
|
|
902
|
-
* baseUrl: "https://api.thunder.io",
|
|
903
|
-
* payload: {
|
|
904
|
-
* flowType: "USER_ONBOARDING"
|
|
905
|
-
* },
|
|
906
|
-
* headers: {
|
|
907
|
-
* Authorization: `Bearer ${accessToken}`
|
|
908
|
-
* }
|
|
909
|
-
* });
|
|
910
|
-
*
|
|
911
|
-
* // End-user accepting invite (no auth required)
|
|
912
|
-
* const response = await executeEmbeddedUserOnboardingFlow({
|
|
913
|
-
* baseUrl: "https://api.thunder.io",
|
|
914
|
-
* payload: {
|
|
915
|
-
* executionId: "flow-id-from-url",
|
|
916
|
-
* inputs: { inviteToken: "token-from-url" }
|
|
917
|
-
* }
|
|
918
|
-
* });
|
|
919
|
-
* ```
|
|
920
|
-
*/
|
|
921
|
-
const executeEmbeddedUserOnboardingFlow = async ({ url, baseUrl, payload,...requestConfig }) => {
|
|
922
|
-
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.");
|
|
923
|
-
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
924
|
-
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
925
|
-
const hasOnlyFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
926
|
-
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
927
|
-
const hasFlowIdWithInputs = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && "inputs" in cleanPayload;
|
|
928
|
-
const requestPayload = hasOnlyFlowType || hasOnlyFlowId || hasFlowIdWithInputs ? {
|
|
929
|
-
...cleanPayload,
|
|
930
|
-
verbose: true
|
|
931
|
-
} : cleanPayload;
|
|
932
|
-
if ("flowType" in requestPayload && requestPayload["flowType"] !== EmbeddedFlowType.UserOnboarding) requestPayload["flowType"] = EmbeddedFlowType.UserOnboarding;
|
|
933
|
-
const response = await fetch(endpoint, {
|
|
934
|
-
...requestConfig,
|
|
935
|
-
body: JSON.stringify(requestPayload),
|
|
677
|
+
//#region src/api/executeEmbeddedSignInFlow.ts
|
|
678
|
+
const readErrorAssertion = (body) => {
|
|
679
|
+
try {
|
|
680
|
+
return JSON.parse(body).errorAssertion;
|
|
681
|
+
} catch {
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
const postAuthCallback = async (baseUrl, body, headers) => {
|
|
686
|
+
const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
|
|
687
|
+
body: JSON.stringify(body),
|
|
688
|
+
credentials: "include",
|
|
936
689
|
headers: {
|
|
937
690
|
Accept: "application/json",
|
|
938
691
|
"Content-Type": "application/json",
|
|
939
|
-
...
|
|
692
|
+
...headers
|
|
940
693
|
},
|
|
941
|
-
method:
|
|
694
|
+
method: "POST"
|
|
942
695
|
});
|
|
943
|
-
if (!
|
|
944
|
-
|
|
696
|
+
if (!oauth2Response.ok) {
|
|
697
|
+
const oauth2ErrorText = await oauth2Response.text();
|
|
698
|
+
logger_default.error(`OAuth2 authorization failed. The callback responded ${oauth2Response.status} ${oauth2Response.statusText}:`, oauth2ErrorText);
|
|
699
|
+
throw new ThunderIDAPIError("OAuth2 authorization failed", "executeEmbeddedSignInFlow-OAuth2Error-002", "javascript", oauth2Response.status, oauth2Response.statusText);
|
|
700
|
+
}
|
|
701
|
+
return oauth2Response.json();
|
|
945
702
|
};
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
* import getFlowMeta from './api/getFlowMeta';
|
|
969
|
-
* import { FlowMetaType } from './models/flow-meta';
|
|
970
|
-
*
|
|
971
|
-
* const meta = await getFlowMeta({
|
|
972
|
-
* baseUrl: 'https://localhost:8090',
|
|
973
|
-
* type: FlowMetaType.App,
|
|
974
|
-
* id: '60a9b38b-6eba-9f9e-55f9-267067de4680',
|
|
975
|
-
* language: 'en',
|
|
976
|
-
* namespace: 'auth',
|
|
977
|
-
* });
|
|
978
|
-
*
|
|
979
|
-
* console.log(meta.application?.name);
|
|
980
|
-
* console.log(meta.i18n.translations);
|
|
981
|
-
* ```
|
|
982
|
-
*
|
|
983
|
-
* @experimental This function targets the ThunderID V2 platform API
|
|
984
|
-
*/
|
|
985
|
-
const getFlowMeta = async ({ url, baseUrl, type, id, language, namespace,...requestConfig }) => {
|
|
986
|
-
const queryParams = new URLSearchParams({
|
|
987
|
-
...id ? { id } : {},
|
|
988
|
-
...type ? { type } : {},
|
|
989
|
-
...language ? { language } : {},
|
|
990
|
-
...namespace ? { namespace } : {}
|
|
991
|
-
});
|
|
992
|
-
const endpoint = `${url ?? `${baseUrl}/flow/meta`}?${queryParams.toString()}`;
|
|
703
|
+
const relayFailure = async (baseUrl, authId, errorAssertion, headers, flowResponse) => {
|
|
704
|
+
const oauth2Result = await postAuthCallback(baseUrl, {
|
|
705
|
+
assertion: errorAssertion,
|
|
706
|
+
authId
|
|
707
|
+
}, headers);
|
|
708
|
+
return {
|
|
709
|
+
...flowResponse,
|
|
710
|
+
flowStatus: EmbeddedSignInFlowStatus.Error,
|
|
711
|
+
redirectUrl: oauth2Result["redirect_uri"]
|
|
712
|
+
};
|
|
713
|
+
};
|
|
714
|
+
const executeEmbeddedSignInFlow = async ({ url, baseUrl, payload, authId, flowSecret,...requestConfig }) => {
|
|
715
|
+
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.");
|
|
716
|
+
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
717
|
+
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
718
|
+
const isNewFlowStart = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload;
|
|
719
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
720
|
+
const basePayload = isNewFlowStart ? injectRequestedPermissions_default(cleanPayload) : cleanPayload;
|
|
721
|
+
const requestPayload = isNewFlowStart || hasOnlyFlowId ? {
|
|
722
|
+
...basePayload,
|
|
723
|
+
verbose: true
|
|
724
|
+
} : basePayload;
|
|
993
725
|
const response = await fetch(endpoint, {
|
|
994
726
|
...requestConfig,
|
|
727
|
+
body: JSON.stringify(requestPayload),
|
|
995
728
|
headers: {
|
|
996
729
|
Accept: "application/json",
|
|
730
|
+
"Content-Type": "application/json",
|
|
731
|
+
...isNewFlowStart && flowSecret ? { "Flow-Secret": flowSecret } : {},
|
|
997
732
|
...requestConfig.headers
|
|
998
733
|
},
|
|
999
|
-
method: "
|
|
734
|
+
method: requestConfig.method || "POST"
|
|
1000
735
|
});
|
|
1001
|
-
if (!response.ok)
|
|
1002
|
-
|
|
736
|
+
if (!response.ok) {
|
|
737
|
+
const errorText = await response.text();
|
|
738
|
+
const errorAssertion = readErrorAssertion(errorText);
|
|
739
|
+
if (authId && errorAssertion) return await relayFailure(baseUrl, authId, errorAssertion, requestConfig.headers);
|
|
740
|
+
throw new ThunderIDAPIError(errorText, "executeEmbeddedSignInFlow-ResponseError-001", "javascript", response.status, response.statusText, "Authorization request failed");
|
|
741
|
+
}
|
|
742
|
+
const flowResponse = await response.json();
|
|
743
|
+
if (flowResponse.flowStatus === EmbeddedSignInFlowStatus.Complete && flowResponse.assertion && authId) try {
|
|
744
|
+
const oauth2Result = await postAuthCallback(baseUrl, {
|
|
745
|
+
assertion: flowResponse.assertion,
|
|
746
|
+
authId
|
|
747
|
+
}, requestConfig.headers);
|
|
748
|
+
return {
|
|
749
|
+
flowStatus: flowResponse.flowStatus,
|
|
750
|
+
redirectUrl: oauth2Result["redirect_uri"]
|
|
751
|
+
};
|
|
752
|
+
} catch (authError) {
|
|
753
|
+
if (authError instanceof ThunderIDAPIError) throw authError;
|
|
754
|
+
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");
|
|
755
|
+
}
|
|
756
|
+
if (flowResponse.flowStatus === EmbeddedSignInFlowStatus.Error && flowResponse.errorAssertion && authId) return relayFailure(baseUrl, authId, flowResponse.errorAssertion, requestConfig.headers, flowResponse);
|
|
757
|
+
return flowResponse;
|
|
1003
758
|
};
|
|
1004
|
-
var
|
|
759
|
+
var executeEmbeddedSignInFlow_default = executeEmbeddedSignInFlow;
|
|
1005
760
|
|
|
1006
761
|
//#endregion
|
|
1007
|
-
//#region src/
|
|
762
|
+
//#region src/models/embedded-signup-flow.ts
|
|
1008
763
|
/**
|
|
1009
|
-
*
|
|
764
|
+
* Status enumeration for ThunderID embedded sign-up flow operations.
|
|
1010
765
|
*
|
|
1011
|
-
*
|
|
1012
|
-
*
|
|
766
|
+
* These statuses indicate the current state of the registration flow and determine
|
|
767
|
+
* the next action required by the client application. Each status provides specific
|
|
768
|
+
* guidance on how to proceed with the user registration process.
|
|
769
|
+
*
|
|
770
|
+
* @example
|
|
771
|
+
* ```typescript
|
|
772
|
+
* switch (response.flowStatus) {
|
|
773
|
+
* case EmbeddedSignUpFlowStatus.Incomplete:
|
|
774
|
+
* // More user input needed - render registration form components
|
|
775
|
+
* break;
|
|
776
|
+
* case EmbeddedSignUpFlowStatus.Complete:
|
|
777
|
+
* // Registration successful - handle completion
|
|
778
|
+
* break;
|
|
779
|
+
* case EmbeddedSignUpFlowStatus.Error:
|
|
780
|
+
* // Registration failed - show error details
|
|
781
|
+
* const errorResponse = response as EmbeddedSignUpFlowErrorResponse;
|
|
782
|
+
* showError(errorResponse.error.description.defaultValue);
|
|
783
|
+
* break;
|
|
784
|
+
* }
|
|
785
|
+
* ```
|
|
786
|
+
*
|
|
787
|
+
* @experimental Part of the new ThunderID API
|
|
1013
788
|
*/
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
789
|
+
let EmbeddedSignUpFlowStatus = /* @__PURE__ */ function(EmbeddedSignUpFlowStatus$1) {
|
|
790
|
+
/**
|
|
791
|
+
* Sign-up flow completed successfully.
|
|
792
|
+
*
|
|
793
|
+
* The user has successfully registered and the flow can proceed to
|
|
794
|
+
* OAuth2 completion or redirection. Check for redirectUrl or assertion
|
|
795
|
+
* data in the response for next steps.
|
|
796
|
+
*/
|
|
797
|
+
EmbeddedSignUpFlowStatus$1["Complete"] = "COMPLETE";
|
|
798
|
+
/**
|
|
799
|
+
* Sign-up flow encountered an error and cannot proceed.
|
|
800
|
+
*
|
|
801
|
+
* Registration failed due to validation errors, duplicate user,
|
|
802
|
+
* system errors, or other issues. The response will be of type
|
|
803
|
+
* `EmbeddedSignUpFlowErrorResponse` containing detailed failure
|
|
804
|
+
* information that can be displayed to the user.
|
|
805
|
+
*
|
|
806
|
+
* @see {@link EmbeddedSignUpFlowErrorResponse} for error response structure
|
|
807
|
+
*/
|
|
808
|
+
EmbeddedSignUpFlowStatus$1["Error"] = "ERROR";
|
|
809
|
+
/**
|
|
810
|
+
* Sign-up flow requires additional user input.
|
|
811
|
+
*
|
|
812
|
+
* More registration steps are needed. The response will contain
|
|
813
|
+
* components in data.meta.components that should be rendered to
|
|
814
|
+
* collect additional user information (e.g., profile data, verification).
|
|
815
|
+
*/
|
|
816
|
+
EmbeddedSignUpFlowStatus$1["Incomplete"] = "INCOMPLETE";
|
|
817
|
+
return EmbeddedSignUpFlowStatus$1;
|
|
818
|
+
}({});
|
|
819
|
+
/**
|
|
820
|
+
* Type enumeration for ThunderID embedded sign-up flow responses.
|
|
821
|
+
*
|
|
822
|
+
* Determines the nature of the registration flow response and how the client
|
|
823
|
+
* should handle the returned data. This affects both UI rendering and flow
|
|
824
|
+
* continuation logic during the user registration process.
|
|
825
|
+
*
|
|
826
|
+
* @experimental Part of the new ThunderID API
|
|
827
|
+
*/
|
|
828
|
+
let EmbeddedSignUpFlowType = /* @__PURE__ */ function(EmbeddedSignUpFlowType$1) {
|
|
829
|
+
/**
|
|
830
|
+
* Response requires external redirection.
|
|
831
|
+
*
|
|
832
|
+
* Used for social registration providers, external identity providers,
|
|
833
|
+
* or other flows that require navigating to an external URL during
|
|
834
|
+
* the registration process. The response will contain redirection information.
|
|
835
|
+
*/
|
|
836
|
+
EmbeddedSignUpFlowType$1["Redirection"] = "REDIRECTION";
|
|
837
|
+
/**
|
|
838
|
+
* Response contains view components for rendering.
|
|
839
|
+
*
|
|
840
|
+
* Standard embedded registration flow response containing UI components
|
|
841
|
+
* that should be rendered within the current application context.
|
|
842
|
+
* Most common type for embedded user registration.
|
|
843
|
+
*/
|
|
844
|
+
EmbeddedSignUpFlowType$1["View"] = "VIEW";
|
|
845
|
+
return EmbeddedSignUpFlowType$1;
|
|
846
|
+
}({});
|
|
847
|
+
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region src/api/executeEmbeddedSignUpFlow.ts
|
|
850
|
+
const executeEmbeddedSignUpFlow = async ({ url, baseUrl, payload, authId,...requestConfig }) => {
|
|
851
|
+
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.");
|
|
852
|
+
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
853
|
+
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
854
|
+
const isNewFlowStart = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload;
|
|
855
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
856
|
+
const basePayload = isNewFlowStart ? injectRequestedPermissions_default(cleanPayload) : cleanPayload;
|
|
857
|
+
const requestPayload = isNewFlowStart || hasOnlyFlowId ? {
|
|
858
|
+
...basePayload,
|
|
859
|
+
verbose: true
|
|
860
|
+
} : basePayload;
|
|
861
|
+
const response = await fetch(endpoint, {
|
|
1028
862
|
...requestConfig,
|
|
863
|
+
body: JSON.stringify(requestPayload),
|
|
1029
864
|
headers: {
|
|
1030
865
|
Accept: "application/json",
|
|
1031
866
|
"Content-Type": "application/json",
|
|
1032
867
|
...requestConfig.headers
|
|
1033
868
|
},
|
|
1034
|
-
method: "
|
|
1035
|
-
};
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
var getOrganizationUnitChildren_default = getOrganizationUnitChildren;
|
|
1046
|
-
|
|
1047
|
-
//#endregion
|
|
1048
|
-
//#region src/api/getUserInfo.ts
|
|
1049
|
-
/**
|
|
1050
|
-
* Retrieves the user information from the specified OIDC userinfo endpoint.
|
|
1051
|
-
*
|
|
1052
|
-
* @param requestConfig - Request configuration object.
|
|
1053
|
-
* @returns A promise that resolves with the user information.
|
|
1054
|
-
* @throw
|
|
1055
|
-
* const userInfo = await getUserInfo({
|
|
1056
|
-
* url: "https://localhost:8090/oauth2/userinfo",
|
|
1057
|
-
* });
|
|
1058
|
-
* console.log(userInfo);
|
|
1059
|
-
* } catch (error) {
|
|
1060
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1061
|
-
* console.error('Failed to get user info:', error.message);
|
|
1062
|
-
* }
|
|
1063
|
-
* }
|
|
1064
|
-
* ```
|
|
1065
|
-
*/
|
|
1066
|
-
const getUserInfo = async ({ url,...requestConfig }) => {
|
|
1067
|
-
try {
|
|
1068
|
-
new URL(url);
|
|
1069
|
-
} catch (error$1) {
|
|
1070
|
-
throw new ThunderIDAPIError("Invalid endpoint URL provided", "getUserInfo-ValidationError-001", "javascript", 400, "Invalid Request");
|
|
1071
|
-
}
|
|
1072
|
-
try {
|
|
1073
|
-
const response = await fetch(url, {
|
|
1074
|
-
...requestConfig,
|
|
869
|
+
method: requestConfig.method || "POST"
|
|
870
|
+
});
|
|
871
|
+
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedSignUpFlow-ResponseError-001", "javascript", response.status, response.statusText, "Registration request failed");
|
|
872
|
+
const flowResponse = await response.json();
|
|
873
|
+
if (flowResponse.flowStatus === EmbeddedSignUpFlowStatus.Complete && flowResponse.assertion && authId) try {
|
|
874
|
+
const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
|
|
875
|
+
body: JSON.stringify({
|
|
876
|
+
assertion: flowResponse.assertion,
|
|
877
|
+
authId
|
|
878
|
+
}),
|
|
879
|
+
credentials: "include",
|
|
1075
880
|
headers: {
|
|
1076
881
|
Accept: "application/json",
|
|
1077
882
|
"Content-Type": "application/json",
|
|
1078
883
|
...requestConfig.headers
|
|
1079
884
|
},
|
|
1080
|
-
method: "
|
|
885
|
+
method: "POST"
|
|
1081
886
|
});
|
|
1082
|
-
if (!
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
/**
|
|
1094
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
1095
|
-
*
|
|
1096
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
1097
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
1098
|
-
* in compliance with the License.
|
|
1099
|
-
* You may obtain a copy of the License at
|
|
1100
|
-
*
|
|
1101
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1102
|
-
*
|
|
1103
|
-
* Unless required by applicable law or agreed to in writing,
|
|
1104
|
-
* software distributed under the License is distributed on an
|
|
1105
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
1106
|
-
* KIND, either express or implied. See the License for the
|
|
1107
|
-
* specific language governing permissions and limitations
|
|
1108
|
-
* under the License.
|
|
1109
|
-
*/
|
|
1110
|
-
/**
|
|
1111
|
-
* Regular expression to match userstore prefixes in usernames.
|
|
1112
|
-
* Matches patterns like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
1113
|
-
* The pattern matches any uppercase letters, numbers, and underscores followed by a forward slash.
|
|
1114
|
-
*/
|
|
1115
|
-
const USERSTORE_PREFIX_REGEX = /^[A-Z_][A-Z0-9_]*\//;
|
|
1116
|
-
/**
|
|
1117
|
-
* Removes userstore prefixes from a username if they exist.
|
|
1118
|
-
* This is commonly used to clean usernames returned from profile endpoints
|
|
1119
|
-
* that include userstore prefixes like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
1120
|
-
*
|
|
1121
|
-
* @param username - The username string to process
|
|
1122
|
-
* @returns The username without the userstore prefix, or the original username if no prefix exists
|
|
1123
|
-
*
|
|
1124
|
-
* @example
|
|
1125
|
-
* ```typescript
|
|
1126
|
-
* const cleanUsername = removeUserstorePrefix("DEFAULT/john.doe");
|
|
1127
|
-
* console.log(cleanUsername); // "john.doe"
|
|
1128
|
-
*
|
|
1129
|
-
* const thunderidUser = removeUserstorePrefix("ASGARDEO_USER/jane.doe");
|
|
1130
|
-
* console.log(thunderidUser); // "jane.doe"
|
|
1131
|
-
*
|
|
1132
|
-
* const primaryUser = removeUserstorePrefix("PRIMARY/admin");
|
|
1133
|
-
* console.log(primaryUser); // "admin"
|
|
1134
|
-
*
|
|
1135
|
-
* const alreadyClean = removeUserstorePrefix("user.name");
|
|
1136
|
-
* console.log(alreadyClean); // "user.name"
|
|
1137
|
-
*
|
|
1138
|
-
* const emptyInput = removeUserstorePrefix("");
|
|
1139
|
-
* console.log(emptyInput); // ""
|
|
1140
|
-
* ```
|
|
1141
|
-
*/
|
|
1142
|
-
const removeUserstorePrefix = (username) => {
|
|
1143
|
-
if (!username) return "";
|
|
1144
|
-
return username.replace(USERSTORE_PREFIX_REGEX, "");
|
|
887
|
+
if (!oauth2Response.ok) throw new ThunderIDAPIError(await oauth2Response.text(), "executeEmbeddedSignUpFlow-OAuth2Error-002", "javascript", oauth2Response.status, oauth2Response.statusText, "OAuth2 authorization failed");
|
|
888
|
+
const oauth2Result = await oauth2Response.json();
|
|
889
|
+
return {
|
|
890
|
+
flowStatus: flowResponse.flowStatus,
|
|
891
|
+
redirectUrl: oauth2Result["redirect_uri"]
|
|
892
|
+
};
|
|
893
|
+
} catch (authError) {
|
|
894
|
+
if (authError instanceof ThunderIDAPIError) throw authError;
|
|
895
|
+
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");
|
|
896
|
+
}
|
|
897
|
+
return flowResponse;
|
|
1145
898
|
};
|
|
899
|
+
var executeEmbeddedSignUpFlow_default = executeEmbeddedSignUpFlow;
|
|
900
|
+
|
|
901
|
+
//#endregion
|
|
902
|
+
//#region src/api/executeEmbeddedRecoveryFlow.ts
|
|
1146
903
|
/**
|
|
1147
|
-
*
|
|
1148
|
-
* This is a helper function for processing user objects returned from profile endpoints.
|
|
1149
|
-
* Handles various username field variations: username, userName, and user_name.
|
|
904
|
+
* Executes an embedded recovery flow by sending a request to the flow execution endpoint.
|
|
1150
905
|
*
|
|
1151
|
-
*
|
|
1152
|
-
*
|
|
906
|
+
* This function handles password-recovery and account-recovery flows driven by the
|
|
907
|
+
* ThunderID server. The server returns UI components for each step (e.g. username
|
|
908
|
+
* collection, OTP verification, password reset) and this function forwards the
|
|
909
|
+
* user's responses back to the server.
|
|
910
|
+
*
|
|
911
|
+
* @param requestConfig - Request configuration containing URL, payload, and optional headers.
|
|
912
|
+
* @returns A promise that resolves with the flow execution response.
|
|
913
|
+
* @throws ThunderIDAPIError when the request fails or a payload is missing.
|
|
1153
914
|
*
|
|
1154
915
|
* @example
|
|
1155
916
|
* ```typescript
|
|
1156
|
-
*
|
|
1157
|
-
* const
|
|
1158
|
-
*
|
|
1159
|
-
*
|
|
1160
|
-
*
|
|
1161
|
-
*
|
|
1162
|
-
*
|
|
917
|
+
* // Initiate recovery flow
|
|
918
|
+
* const response = await executeEmbeddedRecoveryFlow({
|
|
919
|
+
* baseUrl: 'https://localhost:8090',
|
|
920
|
+
* payload: {
|
|
921
|
+
* flowType: 'RECOVERY',
|
|
922
|
+
* applicationId: 'my-app-id',
|
|
923
|
+
* },
|
|
924
|
+
* });
|
|
1163
925
|
*
|
|
1164
|
-
*
|
|
1165
|
-
* const
|
|
1166
|
-
*
|
|
926
|
+
* // Continue recovery flow with user input
|
|
927
|
+
* const nextResponse = await executeEmbeddedRecoveryFlow({
|
|
928
|
+
* baseUrl: 'https://localhost:8090',
|
|
929
|
+
* payload: {
|
|
930
|
+
* executionId: response.executionId,
|
|
931
|
+
* action: 'submit',
|
|
932
|
+
* inputs: { username: 'user@example.com' },
|
|
933
|
+
* challengeToken: response.challengeToken,
|
|
934
|
+
* },
|
|
935
|
+
* });
|
|
1167
936
|
* ```
|
|
1168
937
|
*/
|
|
1169
|
-
const
|
|
1170
|
-
if (!
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
938
|
+
const executeEmbeddedRecoveryFlow = async ({ url, baseUrl, payload,...requestConfig }) => {
|
|
939
|
+
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.");
|
|
940
|
+
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
941
|
+
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
942
|
+
const hasOnlyAppIdAndFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 2;
|
|
943
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
944
|
+
const requestPayload = hasOnlyAppIdAndFlowType || hasOnlyFlowId ? {
|
|
945
|
+
...cleanPayload,
|
|
946
|
+
verbose: true
|
|
947
|
+
} : cleanPayload;
|
|
948
|
+
const response = await fetch(endpoint, {
|
|
949
|
+
...requestConfig,
|
|
950
|
+
body: JSON.stringify(requestPayload),
|
|
951
|
+
headers: {
|
|
952
|
+
Accept: "application/json",
|
|
953
|
+
"Content-Type": "application/json",
|
|
954
|
+
...requestConfig.headers
|
|
955
|
+
},
|
|
956
|
+
method: requestConfig.method || "POST"
|
|
957
|
+
});
|
|
958
|
+
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedRecoveryFlow-ResponseError-001", "javascript", response.status, response.statusText, "Recovery request failed");
|
|
959
|
+
return await response.json();
|
|
1176
960
|
};
|
|
1177
|
-
var
|
|
961
|
+
var executeEmbeddedRecoveryFlow_default = executeEmbeddedRecoveryFlow;
|
|
1178
962
|
|
|
1179
963
|
//#endregion
|
|
1180
|
-
//#region src/
|
|
964
|
+
//#region src/models/embedded-flow.ts
|
|
965
|
+
let EmbeddedFlowType = /* @__PURE__ */ function(EmbeddedFlowType$1) {
|
|
966
|
+
EmbeddedFlowType$1["Authentication"] = "AUTHENTICATION";
|
|
967
|
+
EmbeddedFlowType$1["Recovery"] = "RECOVERY";
|
|
968
|
+
EmbeddedFlowType$1["Registration"] = "REGISTRATION";
|
|
969
|
+
EmbeddedFlowType$1["UserOnboarding"] = "USER_ONBOARDING";
|
|
970
|
+
return EmbeddedFlowType$1;
|
|
971
|
+
}({});
|
|
972
|
+
let EmbeddedFlowResponseType = /* @__PURE__ */ function(EmbeddedFlowResponseType$1) {
|
|
973
|
+
EmbeddedFlowResponseType$1["Redirection"] = "REDIRECTION";
|
|
974
|
+
EmbeddedFlowResponseType$1["View"] = "VIEW";
|
|
975
|
+
return EmbeddedFlowResponseType$1;
|
|
976
|
+
}({});
|
|
1181
977
|
/**
|
|
1182
|
-
*
|
|
978
|
+
* Component types supported by the ThunderID embedded flow API.
|
|
1183
979
|
*
|
|
1184
|
-
*
|
|
1185
|
-
*
|
|
1186
|
-
*
|
|
1187
|
-
* ```typescript
|
|
1188
|
-
* // Using default fetch
|
|
1189
|
-
* try {
|
|
1190
|
-
* const userProfile = await getUsersMe({
|
|
1191
|
-
* url: "https://localhost:8090/users/me",
|
|
1192
|
-
* });
|
|
1193
|
-
* console.log(userProfile);
|
|
1194
|
-
* } catch (error) {
|
|
1195
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1196
|
-
* console.error('Failed to get user profile:', error.message);
|
|
1197
|
-
* }
|
|
1198
|
-
* }
|
|
1199
|
-
* ```
|
|
980
|
+
* These types define the different UI components that can be rendered
|
|
981
|
+
* as part of the embedded authentication flows. Each type corresponds
|
|
982
|
+
* to a specific UI element with its own behavior and properties.
|
|
1200
983
|
*
|
|
1201
984
|
* @example
|
|
1202
985
|
* ```typescript
|
|
1203
|
-
* //
|
|
1204
|
-
*
|
|
1205
|
-
*
|
|
1206
|
-
*
|
|
1207
|
-
*
|
|
1208
|
-
* const response = await httpClient({
|
|
1209
|
-
* url,
|
|
1210
|
-
* method: config.method,
|
|
1211
|
-
* headers: config.headers,
|
|
1212
|
-
* ...config
|
|
1213
|
-
* });
|
|
1214
|
-
* // Convert axios-like response to fetch-like Response
|
|
1215
|
-
* return {
|
|
1216
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
1217
|
-
* status: response.status,
|
|
1218
|
-
* statusText: response.statusText,
|
|
1219
|
-
* json: () => Promise.resolve(response.data),
|
|
1220
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1221
|
-
* } as Response;
|
|
1222
|
-
* }
|
|
1223
|
-
* });
|
|
1224
|
-
* console.log(userProfile);
|
|
1225
|
-
* } catch (error) {
|
|
1226
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1227
|
-
* console.error('Failed to get user profile:', error.message);
|
|
1228
|
-
* }
|
|
986
|
+
* // Check component type to render appropriate UI
|
|
987
|
+
* if (component.type === EmbeddedFlowComponentType.TextInput) {
|
|
988
|
+
* // Render text input field
|
|
989
|
+
* } else if (component.type === EmbeddedFlowComponentType.Action) {
|
|
990
|
+
* // Render button/action
|
|
1229
991
|
* }
|
|
1230
992
|
* ```
|
|
993
|
+
*
|
|
994
|
+
* @experimental This API may change in future versions
|
|
995
|
+
*/
|
|
996
|
+
let EmbeddedFlowComponentType = /* @__PURE__ */ function(EmbeddedFlowComponentType$1) {
|
|
997
|
+
/** Interactive action component (buttons, links) for user interactions */
|
|
998
|
+
EmbeddedFlowComponentType$1["Action"] = "ACTION";
|
|
999
|
+
/** Container block component that groups other components */
|
|
1000
|
+
EmbeddedFlowComponentType$1["Block"] = "BLOCK";
|
|
1001
|
+
/** Consent component for displaying consent purposes and attributes */
|
|
1002
|
+
EmbeddedFlowComponentType$1["Consent"] = "CONSENT";
|
|
1003
|
+
/** Copyable text display component that shows text with a copy-to-clipboard action */
|
|
1004
|
+
EmbeddedFlowComponentType$1["CopyableText"] = "COPYABLE_TEXT";
|
|
1005
|
+
/** Date input field for selecting a calendar date */
|
|
1006
|
+
EmbeddedFlowComponentType$1["DateInput"] = "DATE_INPUT";
|
|
1007
|
+
/** Divider component for visual separation of content */
|
|
1008
|
+
EmbeddedFlowComponentType$1["Divider"] = "DIVIDER";
|
|
1009
|
+
/** Email input field with validation for email addresses. */
|
|
1010
|
+
EmbeddedFlowComponentType$1["EmailInput"] = "EMAIL_INPUT";
|
|
1011
|
+
/** Icon display component for rendering named vector icons */
|
|
1012
|
+
EmbeddedFlowComponentType$1["Icon"] = "ICON";
|
|
1013
|
+
/** Image display component for logos and illustrations */
|
|
1014
|
+
EmbeddedFlowComponentType$1["Image"] = "IMAGE";
|
|
1015
|
+
/** One-time password input field for multi-factor authentication */
|
|
1016
|
+
EmbeddedFlowComponentType$1["OtpInput"] = "OTP_INPUT";
|
|
1017
|
+
/** Organization unit tree picker for selecting an OU */
|
|
1018
|
+
EmbeddedFlowComponentType$1["OuSelect"] = "OU_SELECT";
|
|
1019
|
+
/** Password input field with masking for sensitive data */
|
|
1020
|
+
EmbeddedFlowComponentType$1["PasswordInput"] = "PASSWORD_INPUT";
|
|
1021
|
+
/** Phone number input field with country code support */
|
|
1022
|
+
EmbeddedFlowComponentType$1["PhoneInput"] = "PHONE_INPUT";
|
|
1023
|
+
/** Rich text display component that renders formatted HTML content */
|
|
1024
|
+
EmbeddedFlowComponentType$1["RichText"] = "RICH_TEXT";
|
|
1025
|
+
/** Select/dropdown input component for single choice selection */
|
|
1026
|
+
EmbeddedFlowComponentType$1["Select"] = "SELECT";
|
|
1027
|
+
/** Stack layout component for arranging children in a row or column */
|
|
1028
|
+
EmbeddedFlowComponentType$1["Stack"] = "STACK";
|
|
1029
|
+
/** Text display component for labels, headings, and messages */
|
|
1030
|
+
EmbeddedFlowComponentType$1["Text"] = "TEXT";
|
|
1031
|
+
/** Standard text input field for user data entry */
|
|
1032
|
+
EmbeddedFlowComponentType$1["TextInput"] = "TEXT_INPUT";
|
|
1033
|
+
/** Timer component for displaying a countdown */
|
|
1034
|
+
EmbeddedFlowComponentType$1["Timer"] = "TIMER";
|
|
1035
|
+
/** QR code display component for wallet-based flows (e.g. OpenID4VP) */
|
|
1036
|
+
EmbeddedFlowComponentType$1["QrCode"] = "QR_CODE";
|
|
1037
|
+
return EmbeddedFlowComponentType$1;
|
|
1038
|
+
}({});
|
|
1039
|
+
/**
|
|
1040
|
+
* Action variant types for buttons and interactive elements.
|
|
1041
|
+
*
|
|
1042
|
+
* @experimental This API may change in future versions
|
|
1043
|
+
*/
|
|
1044
|
+
let EmbeddedFlowActionVariant = /* @__PURE__ */ function(EmbeddedFlowActionVariant$1) {
|
|
1045
|
+
/** Danger action button for destructive operations */
|
|
1046
|
+
EmbeddedFlowActionVariant$1["Danger"] = "DANGER";
|
|
1047
|
+
/** Info action button for informational purposes */
|
|
1048
|
+
EmbeddedFlowActionVariant$1["Info"] = "INFO";
|
|
1049
|
+
/** Link-styled action button */
|
|
1050
|
+
EmbeddedFlowActionVariant$1["Link"] = "LINK";
|
|
1051
|
+
/** Outlined action button for secondary emphasis */
|
|
1052
|
+
EmbeddedFlowActionVariant$1["Outlined"] = "OUTLINED";
|
|
1053
|
+
/** Primary action button with highest visual emphasis */
|
|
1054
|
+
EmbeddedFlowActionVariant$1["Primary"] = "PRIMARY";
|
|
1055
|
+
/** Secondary action button with moderate visual emphasis */
|
|
1056
|
+
EmbeddedFlowActionVariant$1["Secondary"] = "SECONDARY";
|
|
1057
|
+
/** Success action button for positive confirmations */
|
|
1058
|
+
EmbeddedFlowActionVariant$1["Success"] = "SUCCESS";
|
|
1059
|
+
/** Tertiary action button with minimal visual emphasis */
|
|
1060
|
+
EmbeddedFlowActionVariant$1["Tertiary"] = "TERTIARY";
|
|
1061
|
+
/** Warning action button for cautionary actions */
|
|
1062
|
+
EmbeddedFlowActionVariant$1["Warning"] = "WARNING";
|
|
1063
|
+
return EmbeddedFlowActionVariant$1;
|
|
1064
|
+
}({});
|
|
1065
|
+
/**
|
|
1066
|
+
* Text variant types for typography components.
|
|
1067
|
+
*
|
|
1068
|
+
* @experimental This API may change in future versions
|
|
1069
|
+
*/
|
|
1070
|
+
let EmbeddedFlowTextVariant = /* @__PURE__ */ function(EmbeddedFlowTextVariant$1) {
|
|
1071
|
+
/** Primary body text for main content */
|
|
1072
|
+
EmbeddedFlowTextVariant$1["Body1"] = "BODY_1";
|
|
1073
|
+
/** Secondary body text for supplementary content */
|
|
1074
|
+
EmbeddedFlowTextVariant$1["Body2"] = "BODY_2";
|
|
1075
|
+
/** Text styled for button labels */
|
|
1076
|
+
EmbeddedFlowTextVariant$1["ButtonText"] = "BUTTON_TEXT";
|
|
1077
|
+
/** Small caption text for annotations and descriptions */
|
|
1078
|
+
EmbeddedFlowTextVariant$1["Caption"] = "CAPTION";
|
|
1079
|
+
/** Largest heading level for main titles */
|
|
1080
|
+
EmbeddedFlowTextVariant$1["Heading1"] = "HEADING_1";
|
|
1081
|
+
/** Second level heading for major sections */
|
|
1082
|
+
EmbeddedFlowTextVariant$1["Heading2"] = "HEADING_2";
|
|
1083
|
+
/** Third level heading for subsections */
|
|
1084
|
+
EmbeddedFlowTextVariant$1["Heading3"] = "HEADING_3";
|
|
1085
|
+
/** Fourth level heading for minor sections */
|
|
1086
|
+
EmbeddedFlowTextVariant$1["Heading4"] = "HEADING_4";
|
|
1087
|
+
/** Fifth level heading for detailed sections */
|
|
1088
|
+
EmbeddedFlowTextVariant$1["Heading5"] = "HEADING_5";
|
|
1089
|
+
/** Smallest heading level for fine-grained sections */
|
|
1090
|
+
EmbeddedFlowTextVariant$1["Heading6"] = "HEADING_6";
|
|
1091
|
+
/** Overline text for labels and categories */
|
|
1092
|
+
EmbeddedFlowTextVariant$1["Overline"] = "OVERLINE";
|
|
1093
|
+
/** Primary subtitle text with larger emphasis */
|
|
1094
|
+
EmbeddedFlowTextVariant$1["Subtitle1"] = "SUBTITLE_1";
|
|
1095
|
+
/** Secondary subtitle text with moderate emphasis */
|
|
1096
|
+
EmbeddedFlowTextVariant$1["Subtitle2"] = "SUBTITLE_2";
|
|
1097
|
+
return EmbeddedFlowTextVariant$1;
|
|
1098
|
+
}({});
|
|
1099
|
+
/**
|
|
1100
|
+
* Event types for action components.
|
|
1101
|
+
*
|
|
1102
|
+
* @experimental This API may change in future versions
|
|
1231
1103
|
*/
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
method: "GET"
|
|
1248
|
-
};
|
|
1249
|
-
try {
|
|
1250
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1251
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getUsersMe-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch user profile");
|
|
1252
|
-
const user = await response.json();
|
|
1253
|
-
const attributes = user["attributes"] ?? {};
|
|
1254
|
-
return processUsername_default({
|
|
1255
|
-
...user,
|
|
1256
|
-
...attributes
|
|
1257
|
-
});
|
|
1258
|
-
} catch (error$1) {
|
|
1259
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1260
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getUsersMe-NetworkError-001", "javascript", 0, "Network Error");
|
|
1261
|
-
}
|
|
1262
|
-
};
|
|
1263
|
-
var getUsersMe_default = getUsersMe;
|
|
1104
|
+
let EmbeddedFlowEventType = /* @__PURE__ */ function(EmbeddedFlowEventType$1) {
|
|
1105
|
+
/** Navigate back to the previous step */
|
|
1106
|
+
EmbeddedFlowEventType$1["Back"] = "BACK";
|
|
1107
|
+
/** Cancel the current operation */
|
|
1108
|
+
EmbeddedFlowEventType$1["Cancel"] = "CANCEL";
|
|
1109
|
+
/** Navigate to a different flow step or page */
|
|
1110
|
+
EmbeddedFlowEventType$1["Navigate"] = "NAVIGATE";
|
|
1111
|
+
/** Reset form fields to initial state */
|
|
1112
|
+
EmbeddedFlowEventType$1["Reset"] = "RESET";
|
|
1113
|
+
/** Submit form data to the server */
|
|
1114
|
+
EmbeddedFlowEventType$1["Submit"] = "SUBMIT";
|
|
1115
|
+
/** Trigger an action or event */
|
|
1116
|
+
EmbeddedFlowEventType$1["Trigger"] = "TRIGGER";
|
|
1117
|
+
return EmbeddedFlowEventType$1;
|
|
1118
|
+
}({});
|
|
1264
1119
|
|
|
1265
1120
|
//#endregion
|
|
1266
|
-
//#region src/api/
|
|
1121
|
+
//#region src/api/executeEmbeddedUserOnboardingFlow.ts
|
|
1267
1122
|
/**
|
|
1268
|
-
*
|
|
1123
|
+
* Executes an embedded user onboarding flow by sending a request to the flow execution endpoint.
|
|
1124
|
+
*
|
|
1125
|
+
* This function handles both:
|
|
1126
|
+
* - Admin flow: Initiates onboarding, collects user details, generates invite link
|
|
1127
|
+
* - End-user flow: Validates invite token and allows password setting
|
|
1128
|
+
*
|
|
1129
|
+
* @param requestConfig - Request configuration object containing URL, payload, and optional auth token.
|
|
1130
|
+
* @returns A promise that resolves with the flow execution response.
|
|
1131
|
+
* @throws ThunderIDAPIError when the request fails or URL is invalid.
|
|
1269
1132
|
*
|
|
1270
|
-
* @param config - Configuration object with URL, payload and optional request config.
|
|
1271
|
-
* @returns A promise that resolves with the updated user profile information.
|
|
1272
1133
|
* @example
|
|
1273
1134
|
* ```typescript
|
|
1274
|
-
* //
|
|
1275
|
-
* await
|
|
1276
|
-
*
|
|
1277
|
-
* payload: {
|
|
1135
|
+
* // Admin initiating user onboarding (requires auth token)
|
|
1136
|
+
* const response = await executeEmbeddedUserOnboardingFlow({
|
|
1137
|
+
* baseUrl: "https://api.thunder.io",
|
|
1138
|
+
* payload: {
|
|
1139
|
+
* flowType: "USER_ONBOARDING"
|
|
1140
|
+
* },
|
|
1141
|
+
* headers: {
|
|
1142
|
+
* Authorization: `Bearer ${accessToken}`
|
|
1143
|
+
* }
|
|
1278
1144
|
* });
|
|
1279
|
-
* ```
|
|
1280
1145
|
*
|
|
1281
|
-
*
|
|
1282
|
-
*
|
|
1283
|
-
*
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1286
|
-
*
|
|
1287
|
-
* fetcher: async (url, config) => {
|
|
1288
|
-
* const response = await httpClient({
|
|
1289
|
-
* url,
|
|
1290
|
-
* method: config.method,
|
|
1291
|
-
* headers: config.headers,
|
|
1292
|
-
* data: config.body,
|
|
1293
|
-
* ...config
|
|
1294
|
-
* });
|
|
1295
|
-
* // Convert axios-like response to fetch-like Response
|
|
1296
|
-
* return {
|
|
1297
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
1298
|
-
* status: response.status,
|
|
1299
|
-
* statusText: response.statusText,
|
|
1300
|
-
* json: () => Promise.resolve(response.data),
|
|
1301
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1302
|
-
* } as Response;
|
|
1146
|
+
* // End-user accepting invite (no auth required)
|
|
1147
|
+
* const response = await executeEmbeddedUserOnboardingFlow({
|
|
1148
|
+
* baseUrl: "https://api.thunder.io",
|
|
1149
|
+
* payload: {
|
|
1150
|
+
* executionId: "flow-id-from-url",
|
|
1151
|
+
* inputs: { inviteToken: "token-from-url" }
|
|
1303
1152
|
* }
|
|
1304
1153
|
* });
|
|
1305
1154
|
* ```
|
|
1306
1155
|
*/
|
|
1307
|
-
const
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
const
|
|
1314
|
-
const
|
|
1315
|
-
|
|
1316
|
-
|
|
1156
|
+
const executeEmbeddedUserOnboardingFlow = async ({ url, baseUrl, payload,...requestConfig }) => {
|
|
1157
|
+
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.");
|
|
1158
|
+
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
1159
|
+
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
1160
|
+
const hasOnlyFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
1161
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
1162
|
+
const hasFlowIdWithInputs = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && "inputs" in cleanPayload;
|
|
1163
|
+
const requestPayload = hasOnlyFlowType || hasOnlyFlowId || hasFlowIdWithInputs ? {
|
|
1164
|
+
...cleanPayload,
|
|
1165
|
+
verbose: true
|
|
1166
|
+
} : cleanPayload;
|
|
1167
|
+
if ("flowType" in requestPayload && requestPayload["flowType"] !== EmbeddedFlowType.UserOnboarding) requestPayload["flowType"] = EmbeddedFlowType.UserOnboarding;
|
|
1168
|
+
const response = await fetch(endpoint, {
|
|
1317
1169
|
...requestConfig,
|
|
1318
|
-
|
|
1319
|
-
body: JSON.stringify(data),
|
|
1170
|
+
body: JSON.stringify(requestPayload),
|
|
1320
1171
|
headers: {
|
|
1321
|
-
...requestConfig.headers,
|
|
1322
1172
|
Accept: "application/json",
|
|
1323
|
-
"Content-Type": "application/json"
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
const attributes = user["attributes"] ?? {};
|
|
1331
|
-
return processUsername_default({
|
|
1332
|
-
...user,
|
|
1333
|
-
...attributes
|
|
1334
|
-
});
|
|
1335
|
-
} catch (error$1) {
|
|
1336
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1337
|
-
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");
|
|
1338
|
-
}
|
|
1173
|
+
"Content-Type": "application/json",
|
|
1174
|
+
...requestConfig.headers
|
|
1175
|
+
},
|
|
1176
|
+
method: requestConfig.method || "POST"
|
|
1177
|
+
});
|
|
1178
|
+
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedUserOnboardingFlow-ResponseError-001", "javascript", response.status, response.statusText, "User onboarding request failed");
|
|
1179
|
+
return await response.json();
|
|
1339
1180
|
};
|
|
1340
|
-
var
|
|
1341
|
-
|
|
1342
|
-
//#endregion
|
|
1343
|
-
//#region src/constants/ApplicationNativeAuthenticationConstants.ts
|
|
1344
|
-
/**
|
|
1345
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
1346
|
-
*
|
|
1347
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
1348
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
1349
|
-
* in compliance with the License.
|
|
1350
|
-
* You may obtain a copy of the License at
|
|
1351
|
-
*
|
|
1352
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1353
|
-
*
|
|
1354
|
-
* Unless required by applicable law or agreed to in writing,
|
|
1355
|
-
* software distributed under the License is distributed on an
|
|
1356
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
1357
|
-
* KIND, either express or implied. See the License for the
|
|
1358
|
-
* specific language governing permissions and limitations
|
|
1359
|
-
* under the License.
|
|
1360
|
-
*/
|
|
1361
|
-
/**
|
|
1362
|
-
* Constants representing Application Native Authentication related configurations and constants.
|
|
1363
|
-
*/
|
|
1364
|
-
const ApplicationNativeAuthenticationConstants = { SupportedAuthenticators: {
|
|
1365
|
-
EmailOtp: "ZW1haWwtb3RwLWF1dGhlbnRpY2F0b3I6TE9DQUw",
|
|
1366
|
-
Facebook: "RmFjZWJvb2tBdXRoZW50aWNhdG9yOkZhY2Vib29r",
|
|
1367
|
-
GitHub: "R2l0aHViQXV0aGVudGljYXRvcjpHaXRIdWI",
|
|
1368
|
-
Google: "R29vZ2xlT0lEQ0F1dGhlbnRpY2F0b3I6R29vZ2xl",
|
|
1369
|
-
IdentifierFirst: "SWRlbnRpZmllckV4ZWN1dG9yOkxPQ0FM",
|
|
1370
|
-
LinkedIn: "TGlua2VkSW5PSURDOkxpbmtlZElu",
|
|
1371
|
-
MagicLink: "TWFnaWNMaW5rQXV0aGVudGljYXRvcjpMT0NBTA",
|
|
1372
|
-
Microsoft: "T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6TWljcm9zb2Z0",
|
|
1373
|
-
Passkey: "RklET0F1dGhlbnRpY2F0b3I6TE9DQUw",
|
|
1374
|
-
PushNotification: "cHVzaC1ub3RpZmljYXRpb24tYXV0aGVudGljYXRvcjpMT0NBTA",
|
|
1375
|
-
SignInWithEthereum: "T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6U2lnbiBJbiBXaXRoIEV0aGVyZXVt",
|
|
1376
|
-
SmsOtp: "c21zLW90cC1hdXRoZW50aWNhdG9yOkxPQ0FM",
|
|
1377
|
-
Totp: "dG90cDpMT0NBTA",
|
|
1378
|
-
UsernamePassword: "QmFzaWNBdXRoZW50aWNhdG9yOkxPQ0FM"
|
|
1379
|
-
} };
|
|
1380
|
-
var ApplicationNativeAuthenticationConstants_default = ApplicationNativeAuthenticationConstants;
|
|
1181
|
+
var executeEmbeddedUserOnboardingFlow_default = executeEmbeddedUserOnboardingFlow;
|
|
1381
1182
|
|
|
1382
1183
|
//#endregion
|
|
1383
|
-
//#region src/
|
|
1184
|
+
//#region src/api/getFlowMeta.ts
|
|
1384
1185
|
/**
|
|
1385
|
-
*
|
|
1386
|
-
*
|
|
1387
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
1388
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
1389
|
-
* in compliance with the License.
|
|
1390
|
-
* You may obtain a copy of the License at
|
|
1186
|
+
* Fetches aggregated flow metadata from the `GET /flow/meta` endpoint.
|
|
1391
1187
|
*
|
|
1392
|
-
*
|
|
1188
|
+
* The response includes:
|
|
1189
|
+
* - Application or OU details depending on the `type` parameter
|
|
1190
|
+
* - Resolved design configuration (theme and layout)
|
|
1191
|
+
* - i18n translations filtered by `language` and `namespace`
|
|
1192
|
+
* - Registration flow enablement status
|
|
1393
1193
|
*
|
|
1394
|
-
*
|
|
1395
|
-
*
|
|
1396
|
-
*
|
|
1397
|
-
*
|
|
1398
|
-
* specific language governing permissions and limitations
|
|
1399
|
-
* under the License.
|
|
1400
|
-
*/
|
|
1401
|
-
/**
|
|
1402
|
-
* Constants for OAuth 2.0 and OpenID Connect scopes.
|
|
1403
|
-
* These scopes define the level of access that the client application
|
|
1404
|
-
* is requesting from the authorization server.
|
|
1194
|
+
* @param config - Request configuration including `baseUrl`/`url`, and optional
|
|
1195
|
+
* `type`, `id`, `language`, and `namespace` filters. When `type`
|
|
1196
|
+
* and `id` are omitted the server returns i18n-only metadata.
|
|
1197
|
+
* @returns A promise that resolves to the {@link FlowMetadataResponse}.
|
|
1405
1198
|
*
|
|
1406
|
-
* @
|
|
1407
|
-
* Scopes are space-separated strings that represent different permissions.
|
|
1408
|
-
* The 'openid' scope is required for OpenID Connect flows, while other
|
|
1409
|
-
* scopes provide access to different resources or user information.
|
|
1199
|
+
* @throws {ThunderIDAPIError} When the server returns a non-OK response.
|
|
1410
1200
|
*
|
|
1411
1201
|
* @example
|
|
1412
1202
|
* ```typescript
|
|
1413
|
-
*
|
|
1414
|
-
*
|
|
1415
|
-
*
|
|
1416
|
-
* // Requesting profile information
|
|
1417
|
-
* const scopes = [ScopeConstants.OPENID, ScopeConstants.PROFILE];
|
|
1418
|
-
* ```
|
|
1419
|
-
*/
|
|
1420
|
-
const ScopeConstants = {
|
|
1421
|
-
OPENID: "openid",
|
|
1422
|
-
PROFILE: "profile"
|
|
1423
|
-
};
|
|
1424
|
-
var ScopeConstants_default = ScopeConstants;
|
|
1425
|
-
|
|
1426
|
-
//#endregion
|
|
1427
|
-
//#region src/constants/OIDCRequestConstants.ts
|
|
1428
|
-
/**
|
|
1429
|
-
* Constants representing standard OpenID Connect (OIDC) request and response parameters.
|
|
1430
|
-
* These parameters are commonly used during authorization, token exchange, and logout flows.
|
|
1431
|
-
*/
|
|
1432
|
-
const OIDCRequestConstants = {
|
|
1433
|
-
Params: {
|
|
1434
|
-
AUTHORIZATION_CODE: "code",
|
|
1435
|
-
SESSION_STATE: "session_state",
|
|
1436
|
-
SIGN_OUT_SUCCESS: "sign_out_success",
|
|
1437
|
-
STATE: "state"
|
|
1438
|
-
},
|
|
1439
|
-
SignIn: { Payload: { DEFAULT_SCOPES: [ScopeConstants_default.OPENID, ScopeConstants_default.PROFILE] } },
|
|
1440
|
-
SignOut: { Storage: { StorageKeys: { SIGN_OUT_URL: "sign_out_url" } } }
|
|
1441
|
-
};
|
|
1442
|
-
var OIDCRequestConstants_default = OIDCRequestConstants;
|
|
1443
|
-
|
|
1444
|
-
//#endregion
|
|
1445
|
-
//#region src/constants/VendorConstants.ts
|
|
1446
|
-
/**
|
|
1447
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
1448
|
-
*
|
|
1449
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
1450
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
1451
|
-
* in compliance with the License.
|
|
1452
|
-
* You may obtain a copy of the License at
|
|
1453
|
-
*
|
|
1454
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1203
|
+
* import getFlowMeta from './api/getFlowMeta';
|
|
1204
|
+
* import { FlowMetaType } from './models/flow-meta';
|
|
1455
1205
|
*
|
|
1456
|
-
*
|
|
1457
|
-
*
|
|
1458
|
-
*
|
|
1459
|
-
*
|
|
1460
|
-
*
|
|
1461
|
-
*
|
|
1462
|
-
|
|
1463
|
-
/**
|
|
1464
|
-
* Constants for vendor-specific configurations.
|
|
1465
|
-
* By default, the vendor is inferred as ThunderID.
|
|
1206
|
+
* const meta = await getFlowMeta({
|
|
1207
|
+
* baseUrl: 'https://localhost:8090',
|
|
1208
|
+
* type: FlowMetaType.App,
|
|
1209
|
+
* id: '60a9b38b-6eba-9f9e-55f9-267067de4680',
|
|
1210
|
+
* language: 'en',
|
|
1211
|
+
* namespace: 'auth',
|
|
1212
|
+
* });
|
|
1466
1213
|
*
|
|
1467
|
-
*
|
|
1468
|
-
*
|
|
1469
|
-
* // Using the vendor prefix in a URL
|
|
1470
|
-
* const apiUrl = `${VendorConstants.VENDOR_PREFIX}/api/v1/resource`;
|
|
1214
|
+
* console.log(meta.application?.name);
|
|
1215
|
+
* console.log(meta.i18n.translations);
|
|
1471
1216
|
* ```
|
|
1217
|
+
*
|
|
1218
|
+
* @experimental This function targets the ThunderID V2 platform API
|
|
1472
1219
|
*/
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1220
|
+
const getFlowMeta = async ({ url, baseUrl, type, id, language, namespace,...requestConfig }) => {
|
|
1221
|
+
const queryParams = new URLSearchParams({
|
|
1222
|
+
...id ? { id } : {},
|
|
1223
|
+
...type ? { type } : {},
|
|
1224
|
+
...language ? { language } : {},
|
|
1225
|
+
...namespace ? { namespace } : {}
|
|
1226
|
+
});
|
|
1227
|
+
const endpoint = `${url ?? `${baseUrl}/flow/meta`}?${queryParams.toString()}`;
|
|
1228
|
+
const response = await fetch(endpoint, {
|
|
1229
|
+
...requestConfig,
|
|
1230
|
+
headers: {
|
|
1231
|
+
Accept: "application/json",
|
|
1232
|
+
...requestConfig.headers
|
|
1233
|
+
},
|
|
1234
|
+
method: "GET"
|
|
1235
|
+
});
|
|
1236
|
+
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "getFlowMeta-ResponseError-001", "javascript", response.status, response.statusText, "Flow metadata request failed");
|
|
1237
|
+
return await response.json();
|
|
1238
|
+
};
|
|
1239
|
+
var getFlowMeta_default = getFlowMeta;
|
|
1475
1240
|
|
|
1476
1241
|
//#endregion
|
|
1477
|
-
//#region src/
|
|
1242
|
+
//#region src/api/getOrganizationUnitChildren.ts
|
|
1478
1243
|
/**
|
|
1479
|
-
*
|
|
1480
|
-
* and adds support for additional error details. Use this class for errors that occur
|
|
1481
|
-
* during runtime execution that are not related to API calls.
|
|
1244
|
+
* Retrieves the child organization units of a given organization unit.
|
|
1482
1245
|
*
|
|
1483
|
-
* @
|
|
1484
|
-
*
|
|
1485
|
-
* throw new ThunderIDRuntimeError(
|
|
1486
|
-
* "Failed to parse configuration",
|
|
1487
|
-
* "CONFIG_PARSE_ERROR",
|
|
1488
|
-
* { invalidField: "redirectUri" }
|
|
1489
|
-
* );
|
|
1490
|
-
* ```
|
|
1246
|
+
* @param config - Request configuration object.
|
|
1247
|
+
* @returns A promise that resolves with the list of child organization units.
|
|
1491
1248
|
*/
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
* @param code - A unique error code that identifies the error type
|
|
1498
|
-
* @param details - Additional details about the error that might be helpful for debugging
|
|
1499
|
-
* @param origin - Optional. The SDK origin (e.g. 'react', 'vue'). Defaults to generic 'ThunderID'
|
|
1500
|
-
* @constructor
|
|
1501
|
-
*/
|
|
1502
|
-
constructor(message, code, origin, details) {
|
|
1503
|
-
super(message, code, origin);
|
|
1504
|
-
this.details = details;
|
|
1505
|
-
Object.defineProperty(this, "name", {
|
|
1506
|
-
configurable: true,
|
|
1507
|
-
value: "ThunderIDRuntimeError",
|
|
1508
|
-
writable: true
|
|
1509
|
-
});
|
|
1249
|
+
const getOrganizationUnitChildren = async ({ url, baseUrl, organizationUnitId, limit, offset, fetcher,...requestConfig }) => {
|
|
1250
|
+
try {
|
|
1251
|
+
new URL(url ?? baseUrl);
|
|
1252
|
+
} catch (error$1) {
|
|
1253
|
+
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.");
|
|
1510
1254
|
}
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
toString()
|
|
1516
|
-
|
|
1517
|
-
|
|
1255
|
+
const fetchFn = fetcher || fetch;
|
|
1256
|
+
const queryParams = new URLSearchParams();
|
|
1257
|
+
if (limit !== void 0) queryParams.set("limit", String(limit));
|
|
1258
|
+
if (offset !== void 0) queryParams.set("offset", String(offset));
|
|
1259
|
+
const query = queryParams.toString();
|
|
1260
|
+
const resolvedBase = url ?? `${baseUrl}/api/server/v1/organization-units/${organizationUnitId}/children`;
|
|
1261
|
+
const resolvedUrl = query ? `${resolvedBase}?${query}` : resolvedBase;
|
|
1262
|
+
const requestInit = {
|
|
1263
|
+
...requestConfig,
|
|
1264
|
+
headers: {
|
|
1265
|
+
Accept: "application/json",
|
|
1266
|
+
"Content-Type": "application/json",
|
|
1267
|
+
...requestConfig.headers
|
|
1268
|
+
},
|
|
1269
|
+
method: "GET"
|
|
1270
|
+
};
|
|
1271
|
+
try {
|
|
1272
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1273
|
+
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getOrganizationUnitChildren-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch organization unit children");
|
|
1274
|
+
return await response.json();
|
|
1275
|
+
} catch (error$1) {
|
|
1276
|
+
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1277
|
+
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getOrganizationUnitChildren-NetworkError-001", "javascript", 0, "Network Error");
|
|
1518
1278
|
}
|
|
1519
1279
|
};
|
|
1280
|
+
var getOrganizationUnitChildren_default = getOrganizationUnitChildren;
|
|
1520
1281
|
|
|
1521
1282
|
//#endregion
|
|
1522
|
-
//#region src/
|
|
1523
|
-
/**
|
|
1524
|
-
* Status enumeration for the embedded recovery flow operations.
|
|
1525
|
-
*
|
|
1526
|
-
* @experimental Part of the new ThunderID API
|
|
1527
|
-
*/
|
|
1528
|
-
let EmbeddedRecoveryFlowStatus = /* @__PURE__ */ function(EmbeddedRecoveryFlowStatus$1) {
|
|
1529
|
-
/**
|
|
1530
|
-
* Recovery flow completed successfully.
|
|
1531
|
-
*/
|
|
1532
|
-
EmbeddedRecoveryFlowStatus$1["Complete"] = "COMPLETE";
|
|
1533
|
-
/**
|
|
1534
|
-
* Recovery flow encountered an error and cannot proceed.
|
|
1535
|
-
*
|
|
1536
|
-
* @see {@link EmbeddedRecoveryFlowErrorResponse} for error response structure
|
|
1537
|
-
*/
|
|
1538
|
-
EmbeddedRecoveryFlowStatus$1["Error"] = "ERROR";
|
|
1539
|
-
/**
|
|
1540
|
-
* Recovery flow requires additional user input.
|
|
1541
|
-
*/
|
|
1542
|
-
EmbeddedRecoveryFlowStatus$1["Incomplete"] = "INCOMPLETE";
|
|
1543
|
-
return EmbeddedRecoveryFlowStatus$1;
|
|
1544
|
-
}({});
|
|
1283
|
+
//#region src/api/getUserInfo.ts
|
|
1545
1284
|
/**
|
|
1546
|
-
*
|
|
1285
|
+
* Retrieves the user information from the specified OIDC userinfo endpoint.
|
|
1547
1286
|
*
|
|
1548
|
-
* @
|
|
1287
|
+
* @param requestConfig - Request configuration object.
|
|
1288
|
+
* @returns A promise that resolves with the user information.
|
|
1289
|
+
* @throw
|
|
1290
|
+
* const userInfo = await getUserInfo({
|
|
1291
|
+
* url: "https://localhost:8090/oauth2/userinfo",
|
|
1292
|
+
* });
|
|
1293
|
+
* console.log(userInfo);
|
|
1294
|
+
* } catch (error) {
|
|
1295
|
+
* if (error instanceof ThunderIDAPIError) {
|
|
1296
|
+
* console.error('Failed to get user info:', error.message);
|
|
1297
|
+
* }
|
|
1298
|
+
* }
|
|
1299
|
+
* ```
|
|
1549
1300
|
*/
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1301
|
+
const getUserInfo = async ({ url,...requestConfig }) => {
|
|
1302
|
+
try {
|
|
1303
|
+
new URL(url);
|
|
1304
|
+
} catch (error$1) {
|
|
1305
|
+
throw new ThunderIDAPIError("Invalid endpoint URL provided", "getUserInfo-ValidationError-001", "javascript", 400, "Invalid Request");
|
|
1306
|
+
}
|
|
1307
|
+
try {
|
|
1308
|
+
const response = await fetch(url, {
|
|
1309
|
+
...requestConfig,
|
|
1310
|
+
headers: {
|
|
1311
|
+
Accept: "application/json",
|
|
1312
|
+
"Content-Type": "application/json",
|
|
1313
|
+
...requestConfig.headers
|
|
1314
|
+
},
|
|
1315
|
+
method: "GET"
|
|
1316
|
+
});
|
|
1317
|
+
if (!response.ok) throw new ThunderIDAPIError(await response.text(), "getUserInfo-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch user info");
|
|
1318
|
+
return await response.json();
|
|
1319
|
+
} catch (error$1) {
|
|
1320
|
+
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1321
|
+
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getUserInfo-NetworkError-001", "javascript", 0, "Network Error");
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
var getUserInfo_default = getUserInfo;
|
|
1561
1325
|
|
|
1562
1326
|
//#endregion
|
|
1563
|
-
//#region src/
|
|
1327
|
+
//#region src/utils/processUsername.ts
|
|
1564
1328
|
/**
|
|
1565
|
-
*
|
|
1566
|
-
*
|
|
1567
|
-
*
|
|
1568
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
1569
|
-
* in compliance with the License.
|
|
1570
|
-
* You may obtain a copy of the License at
|
|
1571
|
-
*
|
|
1572
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1573
|
-
*
|
|
1574
|
-
* Unless required by applicable law or agreed to in writing,
|
|
1575
|
-
* software distributed under the License is distributed on an
|
|
1576
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
1577
|
-
* KIND, either express or implied. See the License for the
|
|
1578
|
-
* specific language governing permissions and limitations
|
|
1579
|
-
* under the License.
|
|
1329
|
+
* Regular expression to match userstore prefixes in usernames.
|
|
1330
|
+
* Matches patterns like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
1331
|
+
* The pattern matches any uppercase letters, numbers, and underscores followed by a forward slash.
|
|
1580
1332
|
*/
|
|
1333
|
+
const USERSTORE_PREFIX_REGEX = /^[A-Z_][A-Z0-9_]*\//;
|
|
1581
1334
|
/**
|
|
1582
|
-
*
|
|
1335
|
+
* Removes userstore prefixes from a username if they exist.
|
|
1336
|
+
* This is commonly used to clean usernames returned from profile endpoints
|
|
1337
|
+
* that include userstore prefixes like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
1338
|
+
*
|
|
1339
|
+
* @param username - The username string to process
|
|
1340
|
+
* @returns The username without the userstore prefix, or the original username if no prefix exists
|
|
1583
1341
|
*
|
|
1584
1342
|
* @example
|
|
1585
1343
|
* ```typescript
|
|
1586
|
-
* const
|
|
1587
|
-
*
|
|
1588
|
-
* type: FlowMetaType.App,
|
|
1589
|
-
* id: '60a9b38b-6eba-9f9e-55f9-267067de4680',
|
|
1590
|
-
* };
|
|
1591
|
-
* ```
|
|
1344
|
+
* const cleanUsername = removeUserstorePrefix("DEFAULT/john.doe");
|
|
1345
|
+
* console.log(cleanUsername); // "john.doe"
|
|
1592
1346
|
*
|
|
1593
|
-
*
|
|
1594
|
-
|
|
1595
|
-
let FlowMetaType = /* @__PURE__ */ function(FlowMetaType$1) {
|
|
1596
|
-
/** Retrieve metadata scoped to a specific application */
|
|
1597
|
-
FlowMetaType$1["App"] = "APP";
|
|
1598
|
-
/** Retrieve metadata scoped to a specific organization unit */
|
|
1599
|
-
FlowMetaType$1["Ou"] = "OU";
|
|
1600
|
-
return FlowMetaType$1;
|
|
1601
|
-
}({});
|
|
1602
|
-
|
|
1603
|
-
//#endregion
|
|
1604
|
-
//#region src/models/flow.ts
|
|
1605
|
-
/**
|
|
1606
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
1347
|
+
* const thunderidUser = removeUserstorePrefix("ASGARDEO_USER/jane.doe");
|
|
1348
|
+
* console.log(thunderidUser); // "jane.doe"
|
|
1607
1349
|
*
|
|
1608
|
-
*
|
|
1609
|
-
*
|
|
1610
|
-
* in compliance with the License.
|
|
1611
|
-
* You may obtain a copy of the License at
|
|
1350
|
+
* const primaryUser = removeUserstorePrefix("PRIMARY/admin");
|
|
1351
|
+
* console.log(primaryUser); // "admin"
|
|
1612
1352
|
*
|
|
1613
|
-
*
|
|
1353
|
+
* const alreadyClean = removeUserstorePrefix("user.name");
|
|
1354
|
+
* console.log(alreadyClean); // "user.name"
|
|
1614
1355
|
*
|
|
1615
|
-
*
|
|
1616
|
-
*
|
|
1617
|
-
*
|
|
1618
|
-
* KIND, either express or implied. See the License for the
|
|
1619
|
-
* specific language governing permissions and limitations
|
|
1620
|
-
* under the License.
|
|
1356
|
+
* const emptyInput = removeUserstorePrefix("");
|
|
1357
|
+
* console.log(emptyInput); // ""
|
|
1358
|
+
* ```
|
|
1621
1359
|
*/
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
* @see {@link https://is.docs.wso2.com/en/7.1.0/references/app-native-authentication/}
|
|
1627
|
-
*/
|
|
1628
|
-
FlowMode$1["Embedded"] = "DIRECT";
|
|
1629
|
-
/**
|
|
1630
|
-
* Traditional redirect based sign-in, sign-up, etc. flows where the authentication
|
|
1631
|
-
* UIs are from a external Identity Provider (ex: WSO2 Identity Server or ThunderID).
|
|
1632
|
-
*/
|
|
1633
|
-
FlowMode$1["Redirect"] = "REDIRECTION";
|
|
1634
|
-
return FlowMode$1;
|
|
1635
|
-
}({});
|
|
1636
|
-
|
|
1637
|
-
//#endregion
|
|
1638
|
-
//#region src/models/field.ts
|
|
1360
|
+
const removeUserstorePrefix = (username) => {
|
|
1361
|
+
if (!username) return "";
|
|
1362
|
+
return username.replace(USERSTORE_PREFIX_REGEX, "");
|
|
1363
|
+
};
|
|
1639
1364
|
/**
|
|
1640
|
-
*
|
|
1365
|
+
* Processes a user object to remove userstore prefixes from username fields.
|
|
1366
|
+
* This is a helper function for processing user objects returned from profile endpoints.
|
|
1367
|
+
* Handles various username field variations: username, userName, and user_name.
|
|
1368
|
+
*
|
|
1369
|
+
* @param user - The user object to process
|
|
1370
|
+
* @returns The user object with processed username fields
|
|
1641
1371
|
*
|
|
1642
|
-
*
|
|
1643
|
-
*
|
|
1644
|
-
*
|
|
1645
|
-
*
|
|
1372
|
+
* @example
|
|
1373
|
+
* ```typescript
|
|
1374
|
+
* const user = { username: "DEFAULT/john.doe", email: "john@example.com" };
|
|
1375
|
+
* const processedUser = processUserUsername(user);
|
|
1376
|
+
* console.log(processedUser.username); // "john.doe"
|
|
1646
1377
|
*
|
|
1647
|
-
*
|
|
1378
|
+
* const camelCaseUser = { userName: "ASGARDEO_USER/jane.doe", email: "jane@example.com" };
|
|
1379
|
+
* const processedCamelCaseUser = processUserUsername(camelCaseUser);
|
|
1380
|
+
* console.log(processedCamelCaseUser.userName); // "jane.doe"
|
|
1648
1381
|
*
|
|
1649
|
-
*
|
|
1650
|
-
*
|
|
1651
|
-
*
|
|
1652
|
-
*
|
|
1653
|
-
* specific language governing permissions and limitations
|
|
1654
|
-
* under the License.
|
|
1382
|
+
* const snakeCaseUser = { user_name: "PRIMARY/admin", email: "admin@example.com" };
|
|
1383
|
+
* const processedSnakeCaseUser = processUserUsername(snakeCaseUser);
|
|
1384
|
+
* console.log(processedSnakeCaseUser.user_name); // "admin"
|
|
1385
|
+
* ```
|
|
1655
1386
|
*/
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
FieldType$1["Tel"] = "TEL";
|
|
1666
|
-
FieldType$1["Text"] = "TEXT";
|
|
1667
|
-
FieldType$1["Textarea"] = "TEXTAREA";
|
|
1668
|
-
FieldType$1["Time"] = "TIME";
|
|
1669
|
-
return FieldType$1;
|
|
1670
|
-
}({});
|
|
1387
|
+
const processUsername = (user) => {
|
|
1388
|
+
if (!user) return user;
|
|
1389
|
+
const processedUser = { ...user };
|
|
1390
|
+
if (processedUser.username) processedUser.username = removeUserstorePrefix(processedUser.username);
|
|
1391
|
+
if (processedUser.userName) processedUser.userName = removeUserstorePrefix(processedUser.userName);
|
|
1392
|
+
if (processedUser.user_name) processedUser.user_name = removeUserstorePrefix(processedUser.user_name);
|
|
1393
|
+
return processedUser;
|
|
1394
|
+
};
|
|
1395
|
+
var processUsername_default = processUsername;
|
|
1671
1396
|
|
|
1672
1397
|
//#endregion
|
|
1673
|
-
//#region src/
|
|
1398
|
+
//#region src/api/getUsersMe.ts
|
|
1674
1399
|
/**
|
|
1675
|
-
*
|
|
1676
|
-
*
|
|
1677
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
1678
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
1679
|
-
* in compliance with the License.
|
|
1680
|
-
* You may obtain a copy of the License at
|
|
1400
|
+
* Retrieves the user profile information from the specified /users/me endpoint.
|
|
1681
1401
|
*
|
|
1682
|
-
*
|
|
1402
|
+
* @param config - Request configuration object.
|
|
1403
|
+
* @returns A promise that resolves with the user profile information.
|
|
1404
|
+
* @example
|
|
1405
|
+
* ```typescript
|
|
1406
|
+
* // Using default fetch
|
|
1407
|
+
* try {
|
|
1408
|
+
* const userProfile = await getUsersMe({
|
|
1409
|
+
* url: "https://localhost:8090/users/me",
|
|
1410
|
+
* });
|
|
1411
|
+
* console.log(userProfile);
|
|
1412
|
+
* } catch (error) {
|
|
1413
|
+
* if (error instanceof ThunderIDAPIError) {
|
|
1414
|
+
* console.error('Failed to get user profile:', error.message);
|
|
1415
|
+
* }
|
|
1416
|
+
* }
|
|
1417
|
+
* ```
|
|
1683
1418
|
*
|
|
1684
|
-
*
|
|
1685
|
-
*
|
|
1686
|
-
*
|
|
1687
|
-
*
|
|
1688
|
-
*
|
|
1689
|
-
*
|
|
1419
|
+
* @example
|
|
1420
|
+
* ```typescript
|
|
1421
|
+
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1422
|
+
* try {
|
|
1423
|
+
* const userProfile = await getUsersMe({
|
|
1424
|
+
* url: "https://localhost:8090/users/me",
|
|
1425
|
+
* fetcher: async (url, config) => {
|
|
1426
|
+
* const response = await httpClient({
|
|
1427
|
+
* url,
|
|
1428
|
+
* method: config.method,
|
|
1429
|
+
* headers: config.headers,
|
|
1430
|
+
* ...config
|
|
1431
|
+
* });
|
|
1432
|
+
* // Convert axios-like response to fetch-like Response
|
|
1433
|
+
* return {
|
|
1434
|
+
* ok: response.status >= 200 && response.status < 300,
|
|
1435
|
+
* status: response.status,
|
|
1436
|
+
* statusText: response.statusText,
|
|
1437
|
+
* json: () => Promise.resolve(response.data),
|
|
1438
|
+
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1439
|
+
* } as Response;
|
|
1440
|
+
* }
|
|
1441
|
+
* });
|
|
1442
|
+
* console.log(userProfile);
|
|
1443
|
+
* } catch (error) {
|
|
1444
|
+
* if (error instanceof ThunderIDAPIError) {
|
|
1445
|
+
* console.error('Failed to get user profile:', error.message);
|
|
1446
|
+
* }
|
|
1447
|
+
* }
|
|
1448
|
+
* ```
|
|
1690
1449
|
*/
|
|
1450
|
+
const getUsersMe = async ({ url, baseUrl, fetcher,...requestConfig }) => {
|
|
1451
|
+
try {
|
|
1452
|
+
new URL(url ?? baseUrl);
|
|
1453
|
+
} catch (error$1) {
|
|
1454
|
+
throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "getUsersMe-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
|
|
1455
|
+
}
|
|
1456
|
+
const fetchFn = fetcher || fetch;
|
|
1457
|
+
const resolvedUrl = url ?? `${baseUrl}/users/me`;
|
|
1458
|
+
const requestInit = {
|
|
1459
|
+
...requestConfig,
|
|
1460
|
+
headers: {
|
|
1461
|
+
Accept: "application/json",
|
|
1462
|
+
"Content-Type": "application/json",
|
|
1463
|
+
...requestConfig.headers
|
|
1464
|
+
},
|
|
1465
|
+
method: "GET"
|
|
1466
|
+
};
|
|
1467
|
+
try {
|
|
1468
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1469
|
+
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getUsersMe-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch user profile");
|
|
1470
|
+
const user = await response.json();
|
|
1471
|
+
const attributes = user["attributes"] ?? {};
|
|
1472
|
+
return processUsername_default({
|
|
1473
|
+
...user,
|
|
1474
|
+
...attributes
|
|
1475
|
+
});
|
|
1476
|
+
} catch (error$1) {
|
|
1477
|
+
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1478
|
+
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getUsersMe-NetworkError-001", "javascript", 0, "Network Error");
|
|
1479
|
+
}
|
|
1480
|
+
};
|
|
1481
|
+
var getUsersMe_default = getUsersMe;
|
|
1482
|
+
|
|
1483
|
+
//#endregion
|
|
1484
|
+
//#region src/api/updateMeProfile.ts
|
|
1691
1485
|
/**
|
|
1692
|
-
*
|
|
1693
|
-
* This object contains all the standard OIDC endpoints and storage keys
|
|
1694
|
-
* used throughout the application for authentication and authorization.
|
|
1695
|
-
*
|
|
1696
|
-
* @remarks
|
|
1697
|
-
* The constants are organized into two main sections:
|
|
1698
|
-
* 1. Endpoints - Contains all OIDC standard endpoint paths
|
|
1699
|
-
* 2. Storage - Contains keys used for storing OIDC-related data
|
|
1486
|
+
* Updates the user profile information at the specified /users/me endpoint.
|
|
1700
1487
|
*
|
|
1488
|
+
* @param config - Configuration object with URL, payload and optional request config.
|
|
1489
|
+
* @returns A promise that resolves with the updated user profile information.
|
|
1701
1490
|
* @example
|
|
1702
1491
|
* ```typescript
|
|
1703
|
-
* // Using
|
|
1704
|
-
*
|
|
1492
|
+
* // Using default fetch
|
|
1493
|
+
* await updateMeProfile({
|
|
1494
|
+
* url: "https://localhost:8090/users/me",
|
|
1495
|
+
* payload: { mobileNumbers: ["0777933830"] }
|
|
1496
|
+
* });
|
|
1497
|
+
* ```
|
|
1705
1498
|
*
|
|
1706
|
-
*
|
|
1707
|
-
*
|
|
1499
|
+
* @example
|
|
1500
|
+
* ```typescript
|
|
1501
|
+
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1502
|
+
* await updateMeProfile({
|
|
1503
|
+
* url: "https://localhost:8090/users/me",
|
|
1504
|
+
* payload: { mobileNumbers: ["0777933830"] },
|
|
1505
|
+
* fetcher: async (url, config) => {
|
|
1506
|
+
* const response = await httpClient({
|
|
1507
|
+
* url,
|
|
1508
|
+
* method: config.method,
|
|
1509
|
+
* headers: config.headers,
|
|
1510
|
+
* data: config.body,
|
|
1511
|
+
* ...config
|
|
1512
|
+
* });
|
|
1513
|
+
* // Convert axios-like response to fetch-like Response
|
|
1514
|
+
* return {
|
|
1515
|
+
* ok: response.status >= 200 && response.status < 300,
|
|
1516
|
+
* status: response.status,
|
|
1517
|
+
* statusText: response.statusText,
|
|
1518
|
+
* json: () => Promise.resolve(response.data),
|
|
1519
|
+
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1520
|
+
* } as Response;
|
|
1521
|
+
* }
|
|
1522
|
+
* });
|
|
1708
1523
|
* ```
|
|
1709
1524
|
*/
|
|
1710
|
-
const
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1525
|
+
const updateMeProfile = async ({ url, baseUrl, payload, fetcher,...requestConfig }) => {
|
|
1526
|
+
try {
|
|
1527
|
+
new URL(url ?? baseUrl);
|
|
1528
|
+
} catch (error$1) {
|
|
1529
|
+
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.");
|
|
1530
|
+
}
|
|
1531
|
+
const data = { attributes: payload };
|
|
1532
|
+
const fetchFn = fetcher || fetch;
|
|
1533
|
+
const resolvedUrl = url ?? `${baseUrl}/users/me`;
|
|
1534
|
+
const requestInit = {
|
|
1535
|
+
...requestConfig,
|
|
1536
|
+
method: "PUT",
|
|
1537
|
+
body: JSON.stringify(data),
|
|
1538
|
+
headers: {
|
|
1539
|
+
...requestConfig.headers,
|
|
1540
|
+
Accept: "application/json",
|
|
1541
|
+
"Content-Type": "application/json"
|
|
1542
|
+
}
|
|
1543
|
+
};
|
|
1544
|
+
try {
|
|
1545
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1546
|
+
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "updateMeProfile-ResponseError-001", "javascript", response.status, response.statusText, "Failed to update user profile");
|
|
1547
|
+
const user = await response.json();
|
|
1548
|
+
const attributes = user["attributes"] ?? {};
|
|
1549
|
+
return processUsername_default({
|
|
1550
|
+
...user,
|
|
1551
|
+
...attributes
|
|
1552
|
+
});
|
|
1553
|
+
} catch (error$1) {
|
|
1554
|
+
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1555
|
+
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");
|
|
1556
|
+
}
|
|
1734
1557
|
};
|
|
1735
|
-
var
|
|
1558
|
+
var updateMeProfile_default = updateMeProfile;
|
|
1736
1559
|
|
|
1737
1560
|
//#endregion
|
|
1738
|
-
//#region src/constants/
|
|
1561
|
+
//#region src/constants/ApplicationNativeAuthenticationConstants.ts
|
|
1739
1562
|
/**
|
|
1740
|
-
*
|
|
1741
|
-
*
|
|
1742
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
1743
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
1744
|
-
* in compliance with the License.
|
|
1745
|
-
* You may obtain a copy of the License at
|
|
1746
|
-
*
|
|
1747
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1748
|
-
*
|
|
1749
|
-
* Unless required by applicable law or agreed to in writing,
|
|
1750
|
-
* software distributed under the License is distributed on an
|
|
1751
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
1752
|
-
* KIND, either express or implied. See the License for the
|
|
1753
|
-
* specific language governing permissions and limitations
|
|
1754
|
-
* under the License.
|
|
1563
|
+
* Constants representing Application Native Authentication related configurations and constants.
|
|
1755
1564
|
*/
|
|
1565
|
+
const ApplicationNativeAuthenticationConstants = { SupportedAuthenticators: {
|
|
1566
|
+
EmailOtp: "ZW1haWwtb3RwLWF1dGhlbnRpY2F0b3I6TE9DQUw",
|
|
1567
|
+
Facebook: "RmFjZWJvb2tBdXRoZW50aWNhdG9yOkZhY2Vib29r",
|
|
1568
|
+
GitHub: "R2l0aHViQXV0aGVudGljYXRvcjpHaXRIdWI",
|
|
1569
|
+
Google: "R29vZ2xlT0lEQ0F1dGhlbnRpY2F0b3I6R29vZ2xl",
|
|
1570
|
+
IdentifierFirst: "SWRlbnRpZmllckV4ZWN1dG9yOkxPQ0FM",
|
|
1571
|
+
LinkedIn: "TGlua2VkSW5PSURDOkxpbmtlZElu",
|
|
1572
|
+
MagicLink: "TWFnaWNMaW5rQXV0aGVudGljYXRvcjpMT0NBTA",
|
|
1573
|
+
Microsoft: "T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6TWljcm9zb2Z0",
|
|
1574
|
+
Passkey: "RklET0F1dGhlbnRpY2F0b3I6TE9DQUw",
|
|
1575
|
+
PushNotification: "cHVzaC1ub3RpZmljYXRpb24tYXV0aGVudGljYXRvcjpMT0NBTA",
|
|
1576
|
+
SignInWithEthereum: "T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6U2lnbiBJbiBXaXRoIEV0aGVyZXVt",
|
|
1577
|
+
SmsOtp: "c21zLW90cC1hdXRoZW50aWNhdG9yOkxPQ0FM",
|
|
1578
|
+
Totp: "dG90cDpMT0NBTA",
|
|
1579
|
+
UsernamePassword: "QmFzaWNBdXRoZW50aWNhdG9yOkxPQ0FM"
|
|
1580
|
+
} };
|
|
1581
|
+
var ApplicationNativeAuthenticationConstants_default = ApplicationNativeAuthenticationConstants;
|
|
1582
|
+
|
|
1583
|
+
//#endregion
|
|
1584
|
+
//#region src/constants/ScopeConstants.ts
|
|
1756
1585
|
/**
|
|
1757
|
-
* Constants
|
|
1758
|
-
*
|
|
1759
|
-
*
|
|
1586
|
+
* Constants for OAuth 2.0 and OpenID Connect scopes.
|
|
1587
|
+
* These scopes define the level of access that the client application
|
|
1588
|
+
* is requesting from the authorization server.
|
|
1760
1589
|
*
|
|
1761
1590
|
* @remarks
|
|
1762
|
-
*
|
|
1763
|
-
*
|
|
1764
|
-
*
|
|
1591
|
+
* Scopes are space-separated strings that represent different permissions.
|
|
1592
|
+
* The 'openid' scope is required for OpenID Connect flows, while other
|
|
1593
|
+
* scopes provide access to different resources or user information.
|
|
1765
1594
|
*
|
|
1766
1595
|
* @example
|
|
1767
1596
|
* ```typescript
|
|
1768
|
-
* //
|
|
1769
|
-
* const
|
|
1770
|
-
*
|
|
1597
|
+
* // Requesting OpenID Connect authentication
|
|
1598
|
+
* const scope = [ScopeConstants.OPENID];
|
|
1599
|
+
*
|
|
1600
|
+
* // Requesting profile information
|
|
1601
|
+
* const scopes = [ScopeConstants.OPENID, ScopeConstants.PROFILE];
|
|
1771
1602
|
* ```
|
|
1772
1603
|
*/
|
|
1773
|
-
const
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
CODE_VERIFIER: "pkce_code_verifier",
|
|
1777
|
-
SEPARATOR: "#"
|
|
1778
|
-
} }
|
|
1604
|
+
const ScopeConstants = {
|
|
1605
|
+
OPENID: "openid",
|
|
1606
|
+
PROFILE: "profile"
|
|
1779
1607
|
};
|
|
1780
|
-
var
|
|
1608
|
+
var ScopeConstants_default = ScopeConstants;
|
|
1781
1609
|
|
|
1782
1610
|
//#endregion
|
|
1783
|
-
//#region src/
|
|
1611
|
+
//#region src/constants/OIDCRequestConstants.ts
|
|
1784
1612
|
/**
|
|
1785
|
-
*
|
|
1786
|
-
*
|
|
1787
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
1788
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
1789
|
-
* in compliance with the License.
|
|
1790
|
-
* You may obtain a copy of the License at
|
|
1791
|
-
*
|
|
1792
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1793
|
-
*
|
|
1794
|
-
* Unless required by applicable law or agreed to in writing,
|
|
1795
|
-
* software distributed under the License is distributed on an
|
|
1796
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
1797
|
-
* KIND, either express or implied. See the License for the
|
|
1798
|
-
* specific language governing permissions and limitations
|
|
1799
|
-
* under the License.
|
|
1613
|
+
* Constants representing standard OpenID Connect (OIDC) request and response parameters.
|
|
1614
|
+
* These parameters are commonly used during authorization, token exchange, and logout flows.
|
|
1800
1615
|
*/
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
|
-
return this.cache.get(key) ?? null;
|
|
1811
|
-
}
|
|
1812
|
-
setItem(key, value) {
|
|
1813
|
-
this.cache.set(key, value);
|
|
1814
|
-
}
|
|
1815
|
-
removeItem(key) {
|
|
1816
|
-
this.cache.delete(key);
|
|
1817
|
-
}
|
|
1818
|
-
clear() {
|
|
1819
|
-
this.cache.clear();
|
|
1820
|
-
}
|
|
1821
|
-
key(index) {
|
|
1822
|
-
return Array.from(this.cache.keys())[index] ?? null;
|
|
1823
|
-
}
|
|
1824
|
-
async setData(key, value) {
|
|
1825
|
-
this.cache.set(key, value);
|
|
1826
|
-
}
|
|
1827
|
-
async getData(key) {
|
|
1828
|
-
return this.cache.get(key) ?? "{}";
|
|
1829
|
-
}
|
|
1830
|
-
async removeData(key) {
|
|
1831
|
-
this.cache.delete(key);
|
|
1832
|
-
}
|
|
1616
|
+
const OIDCRequestConstants = {
|
|
1617
|
+
Params: {
|
|
1618
|
+
AUTHORIZATION_CODE: "code",
|
|
1619
|
+
SESSION_STATE: "session_state",
|
|
1620
|
+
SIGN_OUT_SUCCESS: "sign_out_success",
|
|
1621
|
+
STATE: "state"
|
|
1622
|
+
},
|
|
1623
|
+
SignIn: { Payload: { DEFAULT_SCOPES: [ScopeConstants_default.OPENID, ScopeConstants_default.PROFILE] } },
|
|
1624
|
+
SignOut: { Storage: { StorageKeys: { SIGN_OUT_URL: "sign_out_url" } } }
|
|
1833
1625
|
};
|
|
1626
|
+
var OIDCRequestConstants_default = OIDCRequestConstants;
|
|
1834
1627
|
|
|
1835
1628
|
//#endregion
|
|
1836
|
-
//#region src/
|
|
1629
|
+
//#region src/constants/VendorConstants.ts
|
|
1837
1630
|
/**
|
|
1838
|
-
*
|
|
1839
|
-
*
|
|
1631
|
+
* Constants for vendor-specific configurations.
|
|
1632
|
+
* By default, the vendor is inferred as ThunderID.
|
|
1633
|
+
*
|
|
1634
|
+
* @example
|
|
1635
|
+
* ```typescript
|
|
1636
|
+
* // Using the vendor prefix in a URL
|
|
1637
|
+
* const apiUrl = `${VendorConstants.VENDOR_PREFIX}/api/v1/resource`;
|
|
1638
|
+
* ```
|
|
1840
1639
|
*/
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
const decodedArray = jose.base64url.decode(value);
|
|
1844
|
-
return new TextDecoder().decode(decodedArray);
|
|
1845
|
-
}
|
|
1846
|
-
base64URLEncode(value) {
|
|
1847
|
-
return jose.base64url.encode(value);
|
|
1848
|
-
}
|
|
1849
|
-
generateRandomBytes(length) {
|
|
1850
|
-
return crypto.getRandomValues(new Uint8Array(length));
|
|
1851
|
-
}
|
|
1852
|
-
async hashSha256(data) {
|
|
1853
|
-
const dataBuffer = new TextEncoder().encode(data);
|
|
1854
|
-
const hashBuffer = await crypto.subtle.digest("SHA-256", dataBuffer);
|
|
1855
|
-
return new Uint8Array(hashBuffer);
|
|
1856
|
-
}
|
|
1857
|
-
async verifyJwt(idToken, jwk, algorithms, clientId, issuer, subject, clockTolerance, validateJwtIssuer = true) {
|
|
1858
|
-
const key = await jose.importJWK(jwk);
|
|
1859
|
-
await jose.jwtVerify(idToken, key, {
|
|
1860
|
-
algorithms,
|
|
1861
|
-
audience: [clientId],
|
|
1862
|
-
clockTolerance,
|
|
1863
|
-
issuer: validateJwtIssuer ? issuer : void 0,
|
|
1864
|
-
subject
|
|
1865
|
-
});
|
|
1866
|
-
return true;
|
|
1867
|
-
}
|
|
1868
|
-
};
|
|
1640
|
+
const VendorConstants = { VENDOR_PREFIX: "thunderid" };
|
|
1641
|
+
var VendorConstants_default = VendorConstants;
|
|
1869
1642
|
|
|
1870
1643
|
//#endregion
|
|
1871
|
-
//#region src/
|
|
1644
|
+
//#region src/errors/ThunderIDRuntimeError.ts
|
|
1872
1645
|
/**
|
|
1873
|
-
*
|
|
1646
|
+
* Base class for all runtime errors in ThunderID. This class extends ThunderIDError
|
|
1647
|
+
* and adds support for additional error details. Use this class for errors that occur
|
|
1648
|
+
* during runtime execution that are not related to API calls.
|
|
1649
|
+
*
|
|
1650
|
+
* @example
|
|
1651
|
+
* ```typescript
|
|
1652
|
+
* throw new ThunderIDRuntimeError(
|
|
1653
|
+
* "Failed to parse configuration",
|
|
1654
|
+
* "CONFIG_PARSE_ERROR",
|
|
1655
|
+
* { invalidField: "redirectUri" }
|
|
1656
|
+
* );
|
|
1657
|
+
* ```
|
|
1874
1658
|
*/
|
|
1875
|
-
|
|
1876
|
-
/**
|
|
1877
|
-
* Store for configuration data that defines the application's behavior and settings.
|
|
1878
|
-
*/
|
|
1879
|
-
Stores$1["ConfigData"] = "config_data";
|
|
1880
|
-
/**
|
|
1881
|
-
* Store for OpenID Connect provider metadata, including endpoints and configuration.
|
|
1882
|
-
*/
|
|
1883
|
-
Stores$1["OIDCProviderMetaData"] = "oidc_provider_meta_data";
|
|
1884
|
-
/**
|
|
1885
|
-
* Store for persisted data that needs to be retained across sessions and application restarts.
|
|
1886
|
-
*/
|
|
1887
|
-
Stores$1["PersistedData"] = "persisted_data";
|
|
1888
|
-
/**
|
|
1889
|
-
* Store for user session-related data like tokens and authentication state.
|
|
1890
|
-
*/
|
|
1891
|
-
Stores$1["SessionData"] = "session_data";
|
|
1659
|
+
var ThunderIDRuntimeError = class extends ThunderIDError {
|
|
1892
1660
|
/**
|
|
1893
|
-
*
|
|
1661
|
+
* Creates an instance of ThunderIDRuntimeError.
|
|
1662
|
+
*
|
|
1663
|
+
* @param message - Human-readable description of the error
|
|
1664
|
+
* @param code - A unique error code that identifies the error type
|
|
1665
|
+
* @param details - Additional details about the error that might be helpful for debugging
|
|
1666
|
+
* @param origin - Optional. The SDK origin (e.g. 'react', 'vue'). Defaults to generic 'ThunderID'
|
|
1667
|
+
* @constructor
|
|
1894
1668
|
*/
|
|
1895
|
-
|
|
1669
|
+
constructor(message, code, origin, details) {
|
|
1670
|
+
super(message, code, origin);
|
|
1671
|
+
this.details = details;
|
|
1672
|
+
Object.defineProperty(this, "name", {
|
|
1673
|
+
configurable: true,
|
|
1674
|
+
value: "ThunderIDRuntimeError",
|
|
1675
|
+
writable: true
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1896
1678
|
/**
|
|
1897
|
-
*
|
|
1679
|
+
* Returns a string representation of the runtime error
|
|
1680
|
+
* @returns Formatted error string with name, code, details, and message
|
|
1898
1681
|
*/
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
}({})
|
|
1682
|
+
toString() {
|
|
1683
|
+
const details = this.details ? `\nDetails: ${JSON.stringify(this.details, null, 2)}` : "";
|
|
1684
|
+
return `[${this.name}] (code="${this.code}")${details}\nMessage: ${this.message}`;
|
|
1685
|
+
}
|
|
1686
|
+
};
|
|
1902
1687
|
|
|
1903
1688
|
//#endregion
|
|
1904
|
-
//#region src/
|
|
1905
|
-
const PREFIX = "⚡ ThunderID";
|
|
1906
|
-
/**
|
|
1907
|
-
* Default logger configuration
|
|
1908
|
-
*/
|
|
1909
|
-
const DEFAULT_CONFIG$1 = {
|
|
1910
|
-
level: "info",
|
|
1911
|
-
prefix: `${PREFIX}`,
|
|
1912
|
-
showLevel: true,
|
|
1913
|
-
timestamps: true
|
|
1914
|
-
};
|
|
1915
|
-
/**
|
|
1916
|
-
* Environment detection utilities
|
|
1917
|
-
*/
|
|
1918
|
-
const isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
1919
|
-
const isNode = () => typeof process !== "undefined" && process.versions && process.versions.node;
|
|
1920
|
-
/**
|
|
1921
|
-
* Color codes for terminal output (Node.js)
|
|
1922
|
-
*/
|
|
1923
|
-
const COLORS = {
|
|
1924
|
-
blue: "\x1B[34m",
|
|
1925
|
-
bright: "\x1B[1m",
|
|
1926
|
-
cyan: "\x1B[36m",
|
|
1927
|
-
dim: "\x1B[2m",
|
|
1928
|
-
gray: "\x1B[90m",
|
|
1929
|
-
green: "\x1B[32m",
|
|
1930
|
-
magenta: "\x1B[35m",
|
|
1931
|
-
red: "\x1B[31m",
|
|
1932
|
-
reset: "\x1B[0m",
|
|
1933
|
-
white: "\x1B[37m",
|
|
1934
|
-
yellow: "\x1B[33m"
|
|
1935
|
-
};
|
|
1936
|
-
/**
|
|
1937
|
-
* Browser console styling
|
|
1938
|
-
*/
|
|
1939
|
-
const BROWSER_STYLES = {
|
|
1940
|
-
debug: "color: #6b7280; font-weight: normal;",
|
|
1941
|
-
error: "color: #dc2626; font-weight: bold;",
|
|
1942
|
-
info: "color: #2563eb; font-weight: bold;",
|
|
1943
|
-
prefix: "color: #7c3aed; font-weight: bold;",
|
|
1944
|
-
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
1945
|
-
warn: "color: #d97706; font-weight: bold;"
|
|
1946
|
-
};
|
|
1947
|
-
const LOG_LEVEL_ORDER = {
|
|
1948
|
-
debug: 0,
|
|
1949
|
-
error: 3,
|
|
1950
|
-
info: 1,
|
|
1951
|
-
warn: 2
|
|
1952
|
-
};
|
|
1689
|
+
//#region src/models/embedded-recovery-flow.ts
|
|
1953
1690
|
/**
|
|
1954
|
-
*
|
|
1691
|
+
* Status enumeration for the embedded recovery flow operations.
|
|
1692
|
+
*
|
|
1693
|
+
* @experimental Part of the new ThunderID API
|
|
1955
1694
|
*/
|
|
1956
|
-
|
|
1957
|
-
config;
|
|
1958
|
-
constructor(config = {}) {
|
|
1959
|
-
this.config = {
|
|
1960
|
-
...DEFAULT_CONFIG$1,
|
|
1961
|
-
...config
|
|
1962
|
-
};
|
|
1963
|
-
}
|
|
1964
|
-
/**
|
|
1965
|
-
* Update logger configuration
|
|
1966
|
-
*/
|
|
1967
|
-
configure(config) {
|
|
1968
|
-
this.config = {
|
|
1969
|
-
...this.config,
|
|
1970
|
-
...config
|
|
1971
|
-
};
|
|
1972
|
-
}
|
|
1695
|
+
let EmbeddedRecoveryFlowStatus = /* @__PURE__ */ function(EmbeddedRecoveryFlowStatus$1) {
|
|
1973
1696
|
/**
|
|
1974
|
-
*
|
|
1697
|
+
* Recovery flow completed successfully.
|
|
1975
1698
|
*/
|
|
1976
|
-
|
|
1977
|
-
return { ...this.config };
|
|
1978
|
-
}
|
|
1699
|
+
EmbeddedRecoveryFlowStatus$1["Complete"] = "COMPLETE";
|
|
1979
1700
|
/**
|
|
1980
|
-
*
|
|
1701
|
+
* Recovery flow encountered an error and cannot proceed.
|
|
1702
|
+
*
|
|
1703
|
+
* @see {@link EmbeddedRecoveryFlowErrorResponse} for error response structure
|
|
1981
1704
|
*/
|
|
1982
|
-
|
|
1983
|
-
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
1984
|
-
}
|
|
1705
|
+
EmbeddedRecoveryFlowStatus$1["Error"] = "ERROR";
|
|
1985
1706
|
/**
|
|
1986
|
-
*
|
|
1707
|
+
* Recovery flow requires additional user input.
|
|
1987
1708
|
*/
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1709
|
+
EmbeddedRecoveryFlowStatus$1["Incomplete"] = "INCOMPLETE";
|
|
1710
|
+
return EmbeddedRecoveryFlowStatus$1;
|
|
1711
|
+
}({});
|
|
1712
|
+
/**
|
|
1713
|
+
* Type enumeration for embedded recovery flow responses.
|
|
1714
|
+
*
|
|
1715
|
+
* @experimental Part of the new ThunderID API
|
|
1716
|
+
*/
|
|
1717
|
+
let EmbeddedRecoveryFlowType = /* @__PURE__ */ function(EmbeddedRecoveryFlowType$1) {
|
|
1991
1718
|
/**
|
|
1992
|
-
*
|
|
1719
|
+
* Response requires external redirection.
|
|
1993
1720
|
*/
|
|
1994
|
-
|
|
1995
|
-
switch (level) {
|
|
1996
|
-
case "debug": return "DEBUG";
|
|
1997
|
-
case "info": return "INFO";
|
|
1998
|
-
case "warn": return "WARN";
|
|
1999
|
-
case "error": return "ERROR";
|
|
2000
|
-
default: return "UNKNOWN";
|
|
2001
|
-
}
|
|
2002
|
-
}
|
|
1721
|
+
EmbeddedRecoveryFlowType$1["Redirection"] = "REDIRECTION";
|
|
2003
1722
|
/**
|
|
2004
|
-
*
|
|
1723
|
+
* Response contains view components for rendering.
|
|
2005
1724
|
*/
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
1725
|
+
EmbeddedRecoveryFlowType$1["View"] = "VIEW";
|
|
1726
|
+
return EmbeddedRecoveryFlowType$1;
|
|
1727
|
+
}({});
|
|
1728
|
+
|
|
1729
|
+
//#endregion
|
|
1730
|
+
//#region src/models/flow-meta.ts
|
|
1731
|
+
/**
|
|
1732
|
+
* The type of entity to retrieve flow metadata for.
|
|
1733
|
+
*
|
|
1734
|
+
* @example
|
|
1735
|
+
* ```typescript
|
|
1736
|
+
* const config: GetFlowMetaRequestConfig = {
|
|
1737
|
+
* baseUrl: 'https://localhost:8090',
|
|
1738
|
+
* type: FlowMetaType.App,
|
|
1739
|
+
* id: '60a9b38b-6eba-9f9e-55f9-267067de4680',
|
|
1740
|
+
* };
|
|
1741
|
+
* ```
|
|
1742
|
+
*
|
|
1743
|
+
* @experimental This API may change in future versions
|
|
1744
|
+
*/
|
|
1745
|
+
let FlowMetaType = /* @__PURE__ */ function(FlowMetaType$1) {
|
|
1746
|
+
/** Retrieve metadata scoped to a specific application */
|
|
1747
|
+
FlowMetaType$1["App"] = "APP";
|
|
1748
|
+
/** Retrieve metadata scoped to a specific organization unit */
|
|
1749
|
+
FlowMetaType$1["Ou"] = "OU";
|
|
1750
|
+
return FlowMetaType$1;
|
|
1751
|
+
}({});
|
|
1752
|
+
|
|
1753
|
+
//#endregion
|
|
1754
|
+
//#region src/models/flow.ts
|
|
1755
|
+
let FlowMode = /* @__PURE__ */ function(FlowMode$1) {
|
|
2033
1756
|
/**
|
|
2034
|
-
*
|
|
1757
|
+
* This mode is suitable for embedded sign-in, sign-up, etc. flows where the authentication
|
|
1758
|
+
* UIs are rendered within the application.
|
|
2035
1759
|
*/
|
|
2036
|
-
|
|
2037
|
-
if (!this.shouldLog(level)) return;
|
|
2038
|
-
if (this.config.formatter) {
|
|
2039
|
-
this.config.formatter(level, message, ...args);
|
|
2040
|
-
return;
|
|
2041
|
-
}
|
|
2042
|
-
if (isBrowser()) this.logToBrowser(level, message, ...args);
|
|
2043
|
-
else if (isNode()) this.logToNode(level, message, ...args);
|
|
2044
|
-
else console.log(message, ...args);
|
|
2045
|
-
}
|
|
1760
|
+
FlowMode$1["Embedded"] = "DIRECT";
|
|
2046
1761
|
/**
|
|
2047
|
-
*
|
|
1762
|
+
* Traditional redirect based sign-in, sign-up, etc. flows where the authentication
|
|
1763
|
+
* UIs are from a external Identity Provider (ex: ThunderID).
|
|
2048
1764
|
*/
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
1765
|
+
FlowMode$1["Redirect"] = "REDIRECTION";
|
|
1766
|
+
return FlowMode$1;
|
|
1767
|
+
}({});
|
|
1768
|
+
|
|
1769
|
+
//#endregion
|
|
1770
|
+
//#region src/models/field.ts
|
|
1771
|
+
let FieldType = /* @__PURE__ */ function(FieldType$1) {
|
|
1772
|
+
FieldType$1["Checkbox"] = "CHECKBOX";
|
|
1773
|
+
FieldType$1["Date"] = "DATE";
|
|
1774
|
+
FieldType$1["Email"] = "EMAIL";
|
|
1775
|
+
FieldType$1["Number"] = "NUMBER";
|
|
1776
|
+
FieldType$1["Otp"] = "OTP";
|
|
1777
|
+
FieldType$1["Password"] = "PASSWORD";
|
|
1778
|
+
FieldType$1["Radio"] = "RADIO";
|
|
1779
|
+
FieldType$1["Select"] = "SELECT";
|
|
1780
|
+
FieldType$1["Tel"] = "TEL";
|
|
1781
|
+
FieldType$1["Text"] = "TEXT";
|
|
1782
|
+
FieldType$1["Textarea"] = "TEXTAREA";
|
|
1783
|
+
FieldType$1["Time"] = "TIME";
|
|
1784
|
+
return FieldType$1;
|
|
1785
|
+
}({});
|
|
1786
|
+
|
|
1787
|
+
//#endregion
|
|
1788
|
+
//#region src/constants/OIDCDiscoveryConstants.ts
|
|
1789
|
+
/**
|
|
1790
|
+
* Constants related to OpenID Connect (OIDC) metadata and endpoints.
|
|
1791
|
+
* This object contains all the standard OIDC endpoints and storage keys
|
|
1792
|
+
* used throughout the application for authentication and authorization.
|
|
1793
|
+
*
|
|
1794
|
+
* @remarks
|
|
1795
|
+
* The constants are organized into two main sections:
|
|
1796
|
+
* 1. Endpoints - Contains all OIDC standard endpoint paths
|
|
1797
|
+
* 2. Storage - Contains keys used for storing OIDC-related data
|
|
1798
|
+
*
|
|
1799
|
+
* @example
|
|
1800
|
+
* ```typescript
|
|
1801
|
+
* // Using an endpoint
|
|
1802
|
+
* const authEndpoint = OIDCDiscoveryConstants.Endpoints.AUTHORIZATION;
|
|
1803
|
+
*
|
|
1804
|
+
* // Using a storage key
|
|
1805
|
+
* const tokenKey = OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.TOKEN;
|
|
1806
|
+
* ```
|
|
1807
|
+
*/
|
|
1808
|
+
const OIDCDiscoveryConstants = {
|
|
1809
|
+
Endpoints: {
|
|
1810
|
+
AUTHORIZATION: "/oauth2/authorize",
|
|
1811
|
+
END_SESSION: "/oauth2/logout",
|
|
1812
|
+
ISSUER: "/oauth2/token",
|
|
1813
|
+
JWKS: "/oauth2/jwks",
|
|
1814
|
+
REVOCATION: "/oauth2/revoke",
|
|
1815
|
+
SESSION_IFRAME: "/oidc/checksession",
|
|
1816
|
+
TOKEN: "/oauth2/token",
|
|
1817
|
+
USERINFO: "/oauth2/userinfo"
|
|
1818
|
+
},
|
|
1819
|
+
Storage: { StorageKeys: {
|
|
1820
|
+
Endpoints: {
|
|
1821
|
+
AUTHORIZATION: "authorization_endpoint",
|
|
1822
|
+
END_SESSION: "end_session_endpoint",
|
|
1823
|
+
ISSUER: "issuer",
|
|
1824
|
+
JWKS: "jwks_uri",
|
|
1825
|
+
REVOCATION: "revocation_endpoint",
|
|
1826
|
+
SESSION_IFRAME: "check_session_iframe",
|
|
1827
|
+
TOKEN: "token_endpoint",
|
|
1828
|
+
USERINFO: "userinfo_endpoint"
|
|
1829
|
+
},
|
|
1830
|
+
OPENID_PROVIDER_CONFIG_INITIATED: "op_config_initiated"
|
|
1831
|
+
} }
|
|
1832
|
+
};
|
|
1833
|
+
var OIDCDiscoveryConstants_default = OIDCDiscoveryConstants;
|
|
1834
|
+
|
|
1835
|
+
//#endregion
|
|
1836
|
+
//#region src/constants/PKCEConstants.ts
|
|
1837
|
+
/**
|
|
1838
|
+
* Constants related to Proof Key for Code Exchange (PKCE) implementation.
|
|
1839
|
+
* This object contains all the necessary constants for implementing PKCE
|
|
1840
|
+
* flow in the OAuth 2.0 authorization code grant.
|
|
1841
|
+
*
|
|
1842
|
+
* @remarks
|
|
1843
|
+
* PKCE is an extension to the authorization code flow to prevent CSRF and
|
|
1844
|
+
* authorization code injection attacks. The constants are organized into
|
|
1845
|
+
* storage-related sections for managing PKCE state.
|
|
1846
|
+
*
|
|
1847
|
+
* @example
|
|
1848
|
+
* ```typescript
|
|
1849
|
+
* // Using storage keys
|
|
1850
|
+
* const codeVerifierKey = PKCEConstants.Storage.StorageKeys.CODE_VERIFIER;
|
|
1851
|
+
* const separator = PKCEConstants.Storage.StorageKeys.SEPARATOR;
|
|
1852
|
+
* ```
|
|
1853
|
+
*/
|
|
1854
|
+
const PKCEConstants = {
|
|
1855
|
+
DEFAULT_CODE_CHALLENGE_METHOD: "S256",
|
|
1856
|
+
Storage: { StorageKeys: {
|
|
1857
|
+
CODE_VERIFIER: "pkce_code_verifier",
|
|
1858
|
+
SEPARATOR: "#"
|
|
1859
|
+
} }
|
|
1860
|
+
};
|
|
1861
|
+
var PKCEConstants_default = PKCEConstants;
|
|
1862
|
+
|
|
1863
|
+
//#endregion
|
|
1864
|
+
//#region src/DefaultCacheStore.ts
|
|
1865
|
+
var DefaultCacheStore = class {
|
|
1866
|
+
cache;
|
|
1867
|
+
constructor() {
|
|
1868
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
2097
1869
|
}
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
*/
|
|
2101
|
-
logToNode(level, message, ...args) {
|
|
2102
|
-
const formattedMessage = this.formatForNode(level, message);
|
|
2103
|
-
switch (level) {
|
|
2104
|
-
case "debug":
|
|
2105
|
-
console.debug(formattedMessage, ...args);
|
|
2106
|
-
break;
|
|
2107
|
-
case "info":
|
|
2108
|
-
console.info(formattedMessage, ...args);
|
|
2109
|
-
break;
|
|
2110
|
-
case "warn":
|
|
2111
|
-
console.warn(formattedMessage, ...args);
|
|
2112
|
-
break;
|
|
2113
|
-
case "error":
|
|
2114
|
-
console.error(formattedMessage, ...args);
|
|
2115
|
-
break;
|
|
2116
|
-
default: console.log(formattedMessage, ...args);
|
|
2117
|
-
}
|
|
1870
|
+
get length() {
|
|
1871
|
+
return this.cache.size;
|
|
2118
1872
|
}
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
this.
|
|
1873
|
+
getItem(key) {
|
|
1874
|
+
return this.cache.get(key) ?? null;
|
|
1875
|
+
}
|
|
1876
|
+
setItem(key, value) {
|
|
1877
|
+
this.cache.set(key, value);
|
|
1878
|
+
}
|
|
1879
|
+
removeItem(key) {
|
|
1880
|
+
this.cache.delete(key);
|
|
1881
|
+
}
|
|
1882
|
+
clear() {
|
|
1883
|
+
this.cache.clear();
|
|
1884
|
+
}
|
|
1885
|
+
key(index) {
|
|
1886
|
+
return Array.from(this.cache.keys())[index] ?? null;
|
|
1887
|
+
}
|
|
1888
|
+
async setData(key, value) {
|
|
1889
|
+
this.cache.set(key, value);
|
|
1890
|
+
}
|
|
1891
|
+
async getData(key) {
|
|
1892
|
+
return this.cache.get(key) ?? "{}";
|
|
1893
|
+
}
|
|
1894
|
+
async removeData(key) {
|
|
1895
|
+
this.cache.delete(key);
|
|
1896
|
+
}
|
|
1897
|
+
};
|
|
1898
|
+
|
|
1899
|
+
//#endregion
|
|
1900
|
+
//#region src/DefaultCrypto.ts
|
|
1901
|
+
/**
|
|
1902
|
+
* Default implementation of the Crypto interface using the 'jose' library
|
|
1903
|
+
* and the native Web Crypto API.
|
|
1904
|
+
*/
|
|
1905
|
+
var DefaultCrypto = class {
|
|
1906
|
+
base64URLDecode(value) {
|
|
1907
|
+
const decodedArray = jose.base64url.decode(value);
|
|
1908
|
+
return new TextDecoder().decode(decodedArray);
|
|
1909
|
+
}
|
|
1910
|
+
base64URLEncode(value) {
|
|
1911
|
+
return jose.base64url.encode(value);
|
|
1912
|
+
}
|
|
1913
|
+
generateRandomBytes(length) {
|
|
1914
|
+
return crypto.getRandomValues(new Uint8Array(length));
|
|
1915
|
+
}
|
|
1916
|
+
async hashSha256(data) {
|
|
1917
|
+
const dataBuffer = new TextEncoder().encode(data);
|
|
1918
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", dataBuffer);
|
|
1919
|
+
return new Uint8Array(hashBuffer);
|
|
1920
|
+
}
|
|
1921
|
+
async verifyJwt(idToken, jwk, algorithms, clientId, issuer, subject, clockTolerance, validateJwtIssuer = true) {
|
|
1922
|
+
const key = await jose.importJWK(jwk);
|
|
1923
|
+
await jose.jwtVerify(idToken, key, {
|
|
1924
|
+
algorithms,
|
|
1925
|
+
audience: [clientId],
|
|
1926
|
+
clockTolerance,
|
|
1927
|
+
issuer: validateJwtIssuer ? issuer : void 0,
|
|
1928
|
+
subject
|
|
1929
|
+
});
|
|
1930
|
+
return true;
|
|
2124
1931
|
}
|
|
1932
|
+
};
|
|
1933
|
+
|
|
1934
|
+
//#endregion
|
|
1935
|
+
//#region src/models/store.ts
|
|
1936
|
+
/**
|
|
1937
|
+
* Enum representing different types of data stores used in the application.
|
|
1938
|
+
*/
|
|
1939
|
+
let Stores = /* @__PURE__ */ function(Stores$1) {
|
|
2125
1940
|
/**
|
|
2126
|
-
*
|
|
1941
|
+
* Store for configuration data that defines the application's behavior and settings.
|
|
2127
1942
|
*/
|
|
2128
|
-
|
|
2129
|
-
this.logMessage("info", message, ...args);
|
|
2130
|
-
}
|
|
1943
|
+
Stores$1["ConfigData"] = "config_data";
|
|
2131
1944
|
/**
|
|
2132
|
-
*
|
|
1945
|
+
* Store for OpenID Connect provider metadata, including endpoints and configuration.
|
|
2133
1946
|
*/
|
|
2134
|
-
|
|
2135
|
-
this.logMessage("warn", message, ...args);
|
|
2136
|
-
}
|
|
1947
|
+
Stores$1["OIDCProviderMetaData"] = "oidc_provider_meta_data";
|
|
2137
1948
|
/**
|
|
2138
|
-
*
|
|
1949
|
+
* Store for persisted data that needs to be retained across sessions and application restarts.
|
|
2139
1950
|
*/
|
|
2140
|
-
|
|
2141
|
-
this.logMessage("error", message, ...args);
|
|
2142
|
-
}
|
|
1951
|
+
Stores$1["PersistedData"] = "persisted_data";
|
|
2143
1952
|
/**
|
|
2144
|
-
*
|
|
1953
|
+
* Store for user session-related data like tokens and authentication state.
|
|
2145
1954
|
*/
|
|
2146
|
-
|
|
2147
|
-
const childPrefix = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;
|
|
2148
|
-
return new Logger({
|
|
2149
|
-
...this.config,
|
|
2150
|
-
prefix: childPrefix
|
|
2151
|
-
});
|
|
2152
|
-
}
|
|
1955
|
+
Stores$1["SessionData"] = "session_data";
|
|
2153
1956
|
/**
|
|
2154
|
-
*
|
|
1957
|
+
* Store for temporary data that needs to persist only for a short duration.
|
|
2155
1958
|
*/
|
|
2156
|
-
|
|
2157
|
-
this.config.level = level;
|
|
2158
|
-
}
|
|
1959
|
+
Stores$1["TemporaryData"] = "temporary_data";
|
|
2159
1960
|
/**
|
|
2160
|
-
*
|
|
1961
|
+
* Store for data that leverages local storage if available, falling back to the configured storage.
|
|
2161
1962
|
*/
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
};
|
|
2166
|
-
/**
|
|
2167
|
-
* Default logger instance
|
|
2168
|
-
*/
|
|
2169
|
-
const logger = new Logger();
|
|
2170
|
-
/**
|
|
2171
|
-
* Create a new logger instance with custom configuration
|
|
2172
|
-
*/
|
|
2173
|
-
const createLogger = (config) => new Logger(config);
|
|
2174
|
-
/**
|
|
2175
|
-
* Default export - global logger instance
|
|
2176
|
-
*/
|
|
2177
|
-
var logger_default = logger;
|
|
2178
|
-
/**
|
|
2179
|
-
* Named exports for convenience
|
|
2180
|
-
*/
|
|
2181
|
-
const debug = (message, ...args) => logger.debug(message, ...args);
|
|
2182
|
-
const info = (message, ...args) => logger.info(message, ...args);
|
|
2183
|
-
const warn = (message, ...args) => logger.warn(message, ...args);
|
|
2184
|
-
const error = (message, ...args) => logger.error(message, ...args);
|
|
2185
|
-
/**
|
|
2186
|
-
* Configure the default logger
|
|
2187
|
-
*/
|
|
2188
|
-
const configure = (config) => logger.configure(config);
|
|
2189
|
-
/**
|
|
2190
|
-
* Create component-specific loggers
|
|
2191
|
-
*/
|
|
2192
|
-
const createComponentLogger = (component) => logger.child(component);
|
|
2193
|
-
/**
|
|
2194
|
-
* Create package-specific logger
|
|
2195
|
-
*/
|
|
2196
|
-
const createPackageLogger = (packageName) => createLogger({
|
|
2197
|
-
level: "info",
|
|
2198
|
-
prefix: `${PREFIX} - ${packageName}`,
|
|
2199
|
-
showLevel: true,
|
|
2200
|
-
timestamps: true
|
|
2201
|
-
});
|
|
2202
|
-
/**
|
|
2203
|
-
* Create package component logger (package + component)
|
|
2204
|
-
*/
|
|
2205
|
-
const createPackageComponentLogger = (packageName, component) => {
|
|
2206
|
-
return createPackageLogger(packageName).child(component);
|
|
2207
|
-
};
|
|
1963
|
+
Stores$1["HybridData"] = "hybrid_data";
|
|
1964
|
+
return Stores$1;
|
|
1965
|
+
}({});
|
|
2208
1966
|
|
|
2209
1967
|
//#endregion
|
|
2210
1968
|
//#region src/StorageManager.ts
|
|
@@ -2565,23 +2323,6 @@ var resolveResourceEndpoint_default = resolveResourceEndpoint;
|
|
|
2565
2323
|
//#endregion
|
|
2566
2324
|
//#region src/constants/TokenExchangeConstants.ts
|
|
2567
2325
|
/**
|
|
2568
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
2569
|
-
*
|
|
2570
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
2571
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
2572
|
-
* in compliance with the License.
|
|
2573
|
-
* You may obtain a copy of the License at
|
|
2574
|
-
*
|
|
2575
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2576
|
-
*
|
|
2577
|
-
* Unless required by applicable law or agreed to in writing,
|
|
2578
|
-
* software distributed under the License is distributed on an
|
|
2579
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
2580
|
-
* KIND, either express or implied. See the License for the
|
|
2581
|
-
* specific language governing permissions and limitations
|
|
2582
|
-
* under the License.
|
|
2583
|
-
*/
|
|
2584
|
-
/**
|
|
2585
2326
|
* Constants for OAuth 2.0 Token Exchange operations.
|
|
2586
2327
|
* This object contains placeholders used in token exchange requests
|
|
2587
2328
|
* and responses for dynamic value substitution.
|
|
@@ -2856,23 +2597,6 @@ var base64Encode_default = base64Encode;
|
|
|
2856
2597
|
//#endregion
|
|
2857
2598
|
//#region src/utils/deepMerge.ts
|
|
2858
2599
|
/**
|
|
2859
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
2860
|
-
*
|
|
2861
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
2862
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
2863
|
-
* in compliance with the License.
|
|
2864
|
-
* You may obtain a copy of the License at
|
|
2865
|
-
*
|
|
2866
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2867
|
-
*
|
|
2868
|
-
* Unless required by applicable law or agreed to in writing,
|
|
2869
|
-
* software distributed under the License is distributed on an
|
|
2870
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
2871
|
-
* KIND, either express or implied. See the License for the
|
|
2872
|
-
* specific language governing permissions and limitations
|
|
2873
|
-
* under the License.
|
|
2874
|
-
*/
|
|
2875
|
-
/**
|
|
2876
2600
|
* Checks if a value is a plain object (not an array, function, date, etc.)
|
|
2877
2601
|
*
|
|
2878
2602
|
* @param value - The value to check
|
|
@@ -4096,23 +3820,6 @@ var createTheme_default = createTheme;
|
|
|
4096
3820
|
//#endregion
|
|
4097
3821
|
//#region src/utils/arrayBufferToBase64url.ts
|
|
4098
3822
|
/**
|
|
4099
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
4100
|
-
*
|
|
4101
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4102
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
4103
|
-
* in compliance with the License.
|
|
4104
|
-
* You may obtain a copy of the License at
|
|
4105
|
-
*
|
|
4106
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4107
|
-
*
|
|
4108
|
-
* Unless required by applicable law or agreed to in writing,
|
|
4109
|
-
* software distributed under the License is distributed on an
|
|
4110
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4111
|
-
* KIND, either express or implied. See the License for the
|
|
4112
|
-
* specific language governing permissions and limitations
|
|
4113
|
-
* under the License.
|
|
4114
|
-
*/
|
|
4115
|
-
/**
|
|
4116
3823
|
* Converts an ArrayBuffer to a base64url encoded string.
|
|
4117
3824
|
*
|
|
4118
3825
|
* Base64url encoding is a URL-safe variant of base64 encoding that:
|
|
@@ -4152,23 +3859,6 @@ var arrayBufferToBase64url_default = arrayBufferToBase64url;
|
|
|
4152
3859
|
//#endregion
|
|
4153
3860
|
//#region src/utils/base64urlToArrayBuffer.ts
|
|
4154
3861
|
/**
|
|
4155
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
4156
|
-
*
|
|
4157
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4158
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
4159
|
-
* in compliance with the License.
|
|
4160
|
-
* You may obtain a copy of the License at
|
|
4161
|
-
*
|
|
4162
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4163
|
-
*
|
|
4164
|
-
* Unless required by applicable law or agreed to in writing,
|
|
4165
|
-
* software distributed under the License is distributed on an
|
|
4166
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4167
|
-
* KIND, either express or implied. See the License for the
|
|
4168
|
-
* specific language governing permissions and limitations
|
|
4169
|
-
* under the License.
|
|
4170
|
-
*/
|
|
4171
|
-
/**
|
|
4172
3862
|
* Converts a base64url encoded string back to an ArrayBuffer.
|
|
4173
3863
|
*
|
|
4174
3864
|
* This function performs the inverse operation of base64url encoding by:
|
|
@@ -4217,23 +3907,6 @@ var base64urlToArrayBuffer_default = base64urlToArrayBuffer;
|
|
|
4217
3907
|
//#endregion
|
|
4218
3908
|
//#region src/utils/bem.ts
|
|
4219
3909
|
/**
|
|
4220
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
4221
|
-
*
|
|
4222
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4223
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
4224
|
-
* in compliance with the License.
|
|
4225
|
-
* You may obtain a copy of the License at
|
|
4226
|
-
*
|
|
4227
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4228
|
-
*
|
|
4229
|
-
* Unless required by applicable law or agreed to in writing,
|
|
4230
|
-
* software distributed under the License is distributed on an
|
|
4231
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4232
|
-
* KIND, either express or implied. See the License for the
|
|
4233
|
-
* specific language governing permissions and limitations
|
|
4234
|
-
* under the License.
|
|
4235
|
-
*/
|
|
4236
|
-
/**
|
|
4237
3910
|
* Creates a BEM-style class name by combining a base class with element and/or modifier
|
|
4238
3911
|
*
|
|
4239
3912
|
* @param baseClass - The base CSS class string (usually from emotion's css function)
|
|
@@ -4271,23 +3944,6 @@ var bem_default = bem;
|
|
|
4271
3944
|
//#endregion
|
|
4272
3945
|
//#region src/utils/formatDate.ts
|
|
4273
3946
|
/**
|
|
4274
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
4275
|
-
*
|
|
4276
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4277
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
4278
|
-
* in compliance with the License.
|
|
4279
|
-
* You may obtain a copy of the License at
|
|
4280
|
-
*
|
|
4281
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4282
|
-
*
|
|
4283
|
-
* Unless required by applicable law or agreed to in writing,
|
|
4284
|
-
* software distributed under the License is distributed on an
|
|
4285
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4286
|
-
* KIND, either express or implied. See the License for the
|
|
4287
|
-
* specific language governing permissions and limitations
|
|
4288
|
-
* under the License.
|
|
4289
|
-
*/
|
|
4290
|
-
/**
|
|
4291
3947
|
* Formats a date string to a human-readable format.
|
|
4292
3948
|
*
|
|
4293
3949
|
* @param dateString - The date string to format (optional)
|
|
@@ -4438,23 +4094,6 @@ var getRedirectBasedSignUpUrl_default = getRedirectBasedSignUpUrl;
|
|
|
4438
4094
|
//#endregion
|
|
4439
4095
|
//#region src/utils/isEmpty.ts
|
|
4440
4096
|
/**
|
|
4441
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
4442
|
-
*
|
|
4443
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4444
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
4445
|
-
* in compliance with the License.
|
|
4446
|
-
* You may obtain a copy of the License at
|
|
4447
|
-
*
|
|
4448
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4449
|
-
*
|
|
4450
|
-
* Unless required by applicable law or agreed to in writing,
|
|
4451
|
-
* software distributed under the License is distributed on an
|
|
4452
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4453
|
-
* KIND, either express or implied. See the License for the
|
|
4454
|
-
* specific language governing permissions and limitations
|
|
4455
|
-
* under the License.
|
|
4456
|
-
*/
|
|
4457
|
-
/**
|
|
4458
4097
|
* Checks if a value is considered empty.
|
|
4459
4098
|
*
|
|
4460
4099
|
* A value is considered empty if it is:
|
|
@@ -4494,23 +4133,6 @@ var isEmpty_default = isEmpty;
|
|
|
4494
4133
|
|
|
4495
4134
|
//#endregion
|
|
4496
4135
|
//#region src/utils/isEmojiUri.ts
|
|
4497
|
-
/**
|
|
4498
|
-
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
4499
|
-
*
|
|
4500
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4501
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
4502
|
-
* in compliance with the License.
|
|
4503
|
-
* You may obtain a copy of the License at
|
|
4504
|
-
*
|
|
4505
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4506
|
-
*
|
|
4507
|
-
* Unless required by applicable law or agreed to in writing,
|
|
4508
|
-
* software distributed under the License is distributed on an
|
|
4509
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4510
|
-
* KIND, either express or implied. See the License for the
|
|
4511
|
-
* specific language governing permissions and limitations
|
|
4512
|
-
* under the License.
|
|
4513
|
-
*/
|
|
4514
4136
|
const EMOJI_URI_SCHEME = "emoji:";
|
|
4515
4137
|
/**
|
|
4516
4138
|
* Checks whether a given URI uses the `emoji:` scheme (e.g. `"emoji:🐯"`).
|
|
@@ -4551,23 +4173,6 @@ var extractEmojiFromUri_default = extractEmojiFromUri;
|
|
|
4551
4173
|
//#endregion
|
|
4552
4174
|
//#region src/utils/set.ts
|
|
4553
4175
|
/**
|
|
4554
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
4555
|
-
*
|
|
4556
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4557
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
4558
|
-
* in compliance with the License.
|
|
4559
|
-
* You may obtain a copy of the License at
|
|
4560
|
-
*
|
|
4561
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4562
|
-
*
|
|
4563
|
-
* Unless required by applicable law or agreed to in writing,
|
|
4564
|
-
* software distributed under the License is distributed on an
|
|
4565
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4566
|
-
* KIND, either express or implied. See the License for the
|
|
4567
|
-
* specific language governing permissions and limitations
|
|
4568
|
-
* under the License.
|
|
4569
|
-
*/
|
|
4570
|
-
/**
|
|
4571
4176
|
* Sets the value at path of object. If a portion of path doesn't exist,
|
|
4572
4177
|
* it's created. Arrays are created for missing index properties while
|
|
4573
4178
|
* objects are created for all other missing properties.
|
|
@@ -4597,23 +4202,6 @@ var set_default = set;
|
|
|
4597
4202
|
//#endregion
|
|
4598
4203
|
//#region src/utils/get.ts
|
|
4599
4204
|
/**
|
|
4600
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
4601
|
-
*
|
|
4602
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4603
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
4604
|
-
* in compliance with the License.
|
|
4605
|
-
* You may obtain a copy of the License at
|
|
4606
|
-
*
|
|
4607
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4608
|
-
*
|
|
4609
|
-
* Unless required by applicable law or agreed to in writing,
|
|
4610
|
-
* software distributed under the License is distributed on an
|
|
4611
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4612
|
-
* KIND, either express or implied. See the License for the
|
|
4613
|
-
* specific language governing permissions and limitations
|
|
4614
|
-
* under the License.
|
|
4615
|
-
*/
|
|
4616
|
-
/**
|
|
4617
4205
|
* Gets the value at path of object. If the resolved value is undefined,
|
|
4618
4206
|
* the defaultValue is returned in its place.
|
|
4619
4207
|
* Similar to Lodash's get() function
|
|
@@ -4633,23 +4221,6 @@ var get_default = get;
|
|
|
4633
4221
|
//#endregion
|
|
4634
4222
|
//#region src/utils/startCase.ts
|
|
4635
4223
|
/**
|
|
4636
|
-
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
4637
|
-
*
|
|
4638
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4639
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
4640
|
-
* in compliance with the License.
|
|
4641
|
-
* You may obtain a copy of the License at
|
|
4642
|
-
*
|
|
4643
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4644
|
-
*
|
|
4645
|
-
* Unless required by applicable law or agreed to in writing,
|
|
4646
|
-
* software distributed under the License is distributed on an
|
|
4647
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4648
|
-
* KIND, either express or implied. See the License for the
|
|
4649
|
-
* specific language governing permissions and limitations
|
|
4650
|
-
* under the License.
|
|
4651
|
-
*/
|
|
4652
|
-
/**
|
|
4653
4224
|
* Converts the first character of `string` to upper case.
|
|
4654
4225
|
*
|
|
4655
4226
|
* @param string - The string to convert.
|
|
@@ -4674,23 +4245,6 @@ var startCase_default = startCase;
|
|
|
4674
4245
|
//#endregion
|
|
4675
4246
|
//#region src/utils/removeTrailingSlash.ts
|
|
4676
4247
|
/**
|
|
4677
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
4678
|
-
*
|
|
4679
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4680
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
4681
|
-
* in compliance with the License.
|
|
4682
|
-
* You may obtain a copy of the License at
|
|
4683
|
-
*
|
|
4684
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4685
|
-
*
|
|
4686
|
-
* Unless required by applicable law or agreed to in writing,
|
|
4687
|
-
* software distributed under the License is distributed on an
|
|
4688
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4689
|
-
* KIND, either express or implied. See the License for the
|
|
4690
|
-
* specific language governing permissions and limitations
|
|
4691
|
-
* under the License.
|
|
4692
|
-
*/
|
|
4693
|
-
/**
|
|
4694
4248
|
* Removes a trailing slash from a path string if it exists.
|
|
4695
4249
|
*
|
|
4696
4250
|
* @param path - The string path to process
|
|
@@ -4743,23 +4297,6 @@ function resolveMeta(path, meta) {
|
|
|
4743
4297
|
//#endregion
|
|
4744
4298
|
//#region src/utils/parseFlowTemplateLiteral.ts
|
|
4745
4299
|
/**
|
|
4746
|
-
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
4747
|
-
*
|
|
4748
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4749
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
4750
|
-
* in compliance with the License.
|
|
4751
|
-
* You may obtain a copy of the License at
|
|
4752
|
-
*
|
|
4753
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4754
|
-
*
|
|
4755
|
-
* Unless required by applicable law or agreed to in writing,
|
|
4756
|
-
* software distributed under the License is distributed on an
|
|
4757
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4758
|
-
* KIND, either express or implied. See the License for the
|
|
4759
|
-
* specific language governing permissions and limitations
|
|
4760
|
-
* under the License.
|
|
4761
|
-
*/
|
|
4762
|
-
/**
|
|
4763
4300
|
* Regular expression to detect a flow template literal wrapped in double braces.
|
|
4764
4301
|
* Matches patterns like `{{ t(key) }}`, `{{ meta(key) }}`, etc.
|
|
4765
4302
|
*
|
|
@@ -4876,23 +4413,6 @@ function resolveFlowTemplateLiterals(text, { t, meta }) {
|
|
|
4876
4413
|
//#endregion
|
|
4877
4414
|
//#region src/utils/countryCodeToFlagEmoji.ts
|
|
4878
4415
|
/**
|
|
4879
|
-
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
4880
|
-
*
|
|
4881
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4882
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
4883
|
-
* in compliance with the License.
|
|
4884
|
-
* You may obtain a copy of the License at
|
|
4885
|
-
*
|
|
4886
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4887
|
-
*
|
|
4888
|
-
* Unless required by applicable law or agreed to in writing,
|
|
4889
|
-
* software distributed under the License is distributed on an
|
|
4890
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4891
|
-
* KIND, either express or implied. See the License for the
|
|
4892
|
-
* specific language governing permissions and limitations
|
|
4893
|
-
* under the License.
|
|
4894
|
-
*/
|
|
4895
|
-
/**
|
|
4896
4416
|
* Converts a two-letter ISO 3166-1 alpha-2 country code to a flag emoji using
|
|
4897
4417
|
* Unicode Regional Indicator Symbols (U+1F1E6–U+1F1FF).
|
|
4898
4418
|
*
|
|
@@ -4906,23 +4426,6 @@ function countryCodeToFlagEmoji(countryCode) {
|
|
|
4906
4426
|
//#endregion
|
|
4907
4427
|
//#region src/utils/resolveLocaleDisplayName.ts
|
|
4908
4428
|
/**
|
|
4909
|
-
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
4910
|
-
*
|
|
4911
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4912
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
4913
|
-
* in compliance with the License.
|
|
4914
|
-
* You may obtain a copy of the License at
|
|
4915
|
-
*
|
|
4916
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4917
|
-
*
|
|
4918
|
-
* Unless required by applicable law or agreed to in writing,
|
|
4919
|
-
* software distributed under the License is distributed on an
|
|
4920
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4921
|
-
* KIND, either express or implied. See the License for the
|
|
4922
|
-
* specific language governing permissions and limitations
|
|
4923
|
-
* under the License.
|
|
4924
|
-
*/
|
|
4925
|
-
/**
|
|
4926
4429
|
* Resolves a BCP 47 locale tag to a human-readable display name using the
|
|
4927
4430
|
* `Intl.DisplayNames` API.
|
|
4928
4431
|
*
|
|
@@ -5094,7 +4597,7 @@ var buildValidatorFromRules_default = buildValidatorFromRules;
|
|
|
5094
4597
|
* ```typescript
|
|
5095
4598
|
* // Usage with clsx
|
|
5096
4599
|
* clsx(withVendorCSSClassPrefix('sign-in-button'), className)
|
|
5097
|
-
* // Result: "
|
|
4600
|
+
* // Result: "thunderid-sign-in-button"
|
|
5098
4601
|
* ```
|
|
5099
4602
|
*/
|
|
5100
4603
|
const withVendorCSSClassPrefix = (className) => `${VendorConstants_default.VENDOR_PREFIX}-${className}`;
|