@thunderid/javascript 0.11.2 → 0.12.0

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.
Files changed (234) hide show
  1. package/dist/DefaultCacheStore.d.ts +0 -17
  2. package/dist/DefaultCacheStore.d.ts.map +1 -1
  3. package/dist/DefaultCrypto.d.ts +0 -17
  4. package/dist/DefaultCrypto.d.ts.map +1 -1
  5. package/dist/HttpClient.d.ts +0 -17
  6. package/dist/HttpClient.d.ts.map +1 -1
  7. package/dist/IsomorphicCrypto.d.ts +0 -17
  8. package/dist/IsomorphicCrypto.d.ts.map +1 -1
  9. package/dist/StorageManager.d.ts +0 -17
  10. package/dist/StorageManager.d.ts.map +1 -1
  11. package/dist/ThunderIDJavaScriptClient.d.ts +0 -17
  12. package/dist/ThunderIDJavaScriptClient.d.ts.map +1 -1
  13. package/dist/api/executeEmbeddedRecoveryFlow.d.ts +0 -17
  14. package/dist/api/executeEmbeddedRecoveryFlow.d.ts.map +1 -1
  15. package/dist/api/executeEmbeddedSignInFlow.d.ts +0 -17
  16. package/dist/api/executeEmbeddedSignInFlow.d.ts.map +1 -1
  17. package/dist/api/executeEmbeddedSignUpFlow.d.ts +0 -17
  18. package/dist/api/executeEmbeddedSignUpFlow.d.ts.map +1 -1
  19. package/dist/api/executeEmbeddedUserOnboardingFlow.d.ts +0 -17
  20. package/dist/api/executeEmbeddedUserOnboardingFlow.d.ts.map +1 -1
  21. package/dist/api/getFlowMeta.d.ts +0 -17
  22. package/dist/api/getFlowMeta.d.ts.map +1 -1
  23. package/dist/api/getOrganizationUnitChildren.d.ts +0 -17
  24. package/dist/api/getOrganizationUnitChildren.d.ts.map +1 -1
  25. package/dist/api/getUserInfo.d.ts +0 -17
  26. package/dist/api/getUserInfo.d.ts.map +1 -1
  27. package/dist/api/getUsersMe.d.ts +0 -17
  28. package/dist/api/getUsersMe.d.ts.map +1 -1
  29. package/dist/api/updateMeProfile.d.ts +0 -17
  30. package/dist/api/updateMeProfile.d.ts.map +1 -1
  31. package/dist/cjs/index.cjs +808 -1280
  32. package/dist/constants/ApplicationNativeAuthenticationConstants.d.ts +0 -17
  33. package/dist/constants/ApplicationNativeAuthenticationConstants.d.ts.map +1 -1
  34. package/dist/constants/ConsentConstants.d.ts +22 -0
  35. package/dist/constants/ConsentConstants.d.ts.map +1 -0
  36. package/dist/constants/OIDCDiscoveryConstants.d.ts +0 -17
  37. package/dist/constants/OIDCDiscoveryConstants.d.ts.map +1 -1
  38. package/dist/constants/OIDCRequestConstants.d.ts +0 -17
  39. package/dist/constants/OIDCRequestConstants.d.ts.map +1 -1
  40. package/dist/constants/PKCEConstants.d.ts +0 -17
  41. package/dist/constants/PKCEConstants.d.ts.map +1 -1
  42. package/dist/constants/ScopeConstants.d.ts +0 -17
  43. package/dist/constants/ScopeConstants.d.ts.map +1 -1
  44. package/dist/constants/TokenConstants.d.ts +0 -17
  45. package/dist/constants/TokenConstants.d.ts.map +1 -1
  46. package/dist/constants/TokenExchangeConstants.d.ts +0 -17
  47. package/dist/constants/TokenExchangeConstants.d.ts.map +1 -1
  48. package/dist/constants/VendorConstants.d.ts +0 -17
  49. package/dist/constants/VendorConstants.d.ts.map +1 -1
  50. package/dist/edge/index.js +808 -1281
  51. package/dist/errors/ThunderIDAPIError.d.ts +0 -17
  52. package/dist/errors/ThunderIDAPIError.d.ts.map +1 -1
  53. package/dist/errors/ThunderIDError.d.ts +0 -17
  54. package/dist/errors/ThunderIDError.d.ts.map +1 -1
  55. package/dist/errors/ThunderIDRuntimeError.d.ts +0 -17
  56. package/dist/errors/ThunderIDRuntimeError.d.ts.map +1 -1
  57. package/dist/errors/exception.d.ts +0 -17
  58. package/dist/errors/exception.d.ts.map +1 -1
  59. package/dist/i18n/constants/TranslationBundleConstants.d.ts +0 -17
  60. package/dist/i18n/constants/TranslationBundleConstants.d.ts.map +1 -1
  61. package/dist/i18n/models/i18n.d.ts +0 -17
  62. package/dist/i18n/models/i18n.d.ts.map +1 -1
  63. package/dist/i18n/translations/en-US.d.ts +0 -17
  64. package/dist/i18n/translations/en-US.d.ts.map +1 -1
  65. package/dist/i18n/translations/fr-FR.d.ts +0 -17
  66. package/dist/i18n/translations/fr-FR.d.ts.map +1 -1
  67. package/dist/i18n/translations/hi-IN.d.ts +0 -17
  68. package/dist/i18n/translations/hi-IN.d.ts.map +1 -1
  69. package/dist/i18n/translations/index.d.ts +0 -17
  70. package/dist/i18n/translations/index.d.ts.map +1 -1
  71. package/dist/i18n/translations/ja-JP.d.ts +0 -17
  72. package/dist/i18n/translations/ja-JP.d.ts.map +1 -1
  73. package/dist/i18n/translations/pt-BR.d.ts +0 -17
  74. package/dist/i18n/translations/pt-BR.d.ts.map +1 -1
  75. package/dist/i18n/translations/pt-PT.d.ts +0 -17
  76. package/dist/i18n/translations/pt-PT.d.ts.map +1 -1
  77. package/dist/i18n/translations/si-LK.d.ts +0 -17
  78. package/dist/i18n/translations/si-LK.d.ts.map +1 -1
  79. package/dist/i18n/translations/ta-IN.d.ts +0 -17
  80. package/dist/i18n/translations/ta-IN.d.ts.map +1 -1
  81. package/dist/i18n/translations/te-IN.d.ts +0 -17
  82. package/dist/i18n/translations/te-IN.d.ts.map +1 -1
  83. package/dist/i18n/utils/getDefaultI18nBundles.d.ts +0 -17
  84. package/dist/i18n/utils/getDefaultI18nBundles.d.ts.map +1 -1
  85. package/dist/i18n/utils/normalizeTranslations.d.ts +0 -17
  86. package/dist/i18n/utils/normalizeTranslations.d.ts.map +1 -1
  87. package/dist/index.d.ts +1 -17
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +808 -1281
  90. package/dist/models/agent.d.ts +0 -17
  91. package/dist/models/agent.d.ts.map +1 -1
  92. package/dist/models/auth-code-response.d.ts +0 -17
  93. package/dist/models/auth-code-response.d.ts.map +1 -1
  94. package/dist/models/ciba.d.ts +0 -17
  95. package/dist/models/ciba.d.ts.map +1 -1
  96. package/dist/models/client.d.ts +0 -17
  97. package/dist/models/client.d.ts.map +1 -1
  98. package/dist/models/config.d.ts +0 -17
  99. package/dist/models/config.d.ts.map +1 -1
  100. package/dist/models/crypto.d.ts +0 -17
  101. package/dist/models/crypto.d.ts.map +1 -1
  102. package/dist/models/embedded-flow.d.ts +8 -17
  103. package/dist/models/embedded-flow.d.ts.map +1 -1
  104. package/dist/models/embedded-recovery-flow.d.ts +0 -17
  105. package/dist/models/embedded-recovery-flow.d.ts.map +1 -1
  106. package/dist/models/embedded-signin-flow.d.ts +5 -17
  107. package/dist/models/embedded-signin-flow.d.ts.map +1 -1
  108. package/dist/models/embedded-signup-flow.d.ts +0 -17
  109. package/dist/models/embedded-signup-flow.d.ts.map +1 -1
  110. package/dist/models/extensions/components.d.ts +0 -17
  111. package/dist/models/extensions/components.d.ts.map +1 -1
  112. package/dist/models/field.d.ts +0 -17
  113. package/dist/models/field.d.ts.map +1 -1
  114. package/dist/models/flow-meta.d.ts +0 -17
  115. package/dist/models/flow-meta.d.ts.map +1 -1
  116. package/dist/models/flow.d.ts +1 -19
  117. package/dist/models/flow.d.ts.map +1 -1
  118. package/dist/models/http.d.ts +0 -17
  119. package/dist/models/http.d.ts.map +1 -1
  120. package/dist/models/oauth-request.d.ts +0 -17
  121. package/dist/models/oauth-request.d.ts.map +1 -1
  122. package/dist/models/oauth-response.d.ts +0 -17
  123. package/dist/models/oauth-response.d.ts.map +1 -1
  124. package/dist/models/oidc-discovery.d.ts +0 -17
  125. package/dist/models/oidc-discovery.d.ts.map +1 -1
  126. package/dist/models/oidc-endpoints.d.ts +0 -17
  127. package/dist/models/oidc-endpoints.d.ts.map +1 -1
  128. package/dist/models/session.d.ts +0 -17
  129. package/dist/models/session.d.ts.map +1 -1
  130. package/dist/models/store.d.ts +0 -17
  131. package/dist/models/store.d.ts.map +1 -1
  132. package/dist/models/token-endpoint-auth.d.ts +0 -17
  133. package/dist/models/token-endpoint-auth.d.ts.map +1 -1
  134. package/dist/models/token.d.ts +0 -17
  135. package/dist/models/token.d.ts.map +1 -1
  136. package/dist/models/translation.d.ts +0 -17
  137. package/dist/models/translation.d.ts.map +1 -1
  138. package/dist/models/user.d.ts +0 -17
  139. package/dist/models/user.d.ts.map +1 -1
  140. package/dist/models/utility-types.d.ts +0 -17
  141. package/dist/models/utility-types.d.ts.map +1 -1
  142. package/dist/models/vars.d.ts +0 -17
  143. package/dist/models/vars.d.ts.map +1 -1
  144. package/dist/theme/createTheme.d.ts +0 -17
  145. package/dist/theme/createTheme.d.ts.map +1 -1
  146. package/dist/theme/types.d.ts +0 -17
  147. package/dist/theme/types.d.ts.map +1 -1
  148. package/dist/utils/AuthenticationHelper.d.ts +0 -17
  149. package/dist/utils/AuthenticationHelper.d.ts.map +1 -1
  150. package/dist/utils/arrayBufferToBase64url.d.ts +0 -17
  151. package/dist/utils/arrayBufferToBase64url.d.ts.map +1 -1
  152. package/dist/utils/base64Encode.d.ts +0 -17
  153. package/dist/utils/base64Encode.d.ts.map +1 -1
  154. package/dist/utils/base64urlToArrayBuffer.d.ts +0 -17
  155. package/dist/utils/base64urlToArrayBuffer.d.ts.map +1 -1
  156. package/dist/utils/bem.d.ts +0 -17
  157. package/dist/utils/bem.d.ts.map +1 -1
  158. package/dist/utils/buildValidatorFromRules.d.ts +0 -17
  159. package/dist/utils/buildValidatorFromRules.d.ts.map +1 -1
  160. package/dist/utils/containsMetaFlowTemplateLiteral.d.ts +0 -17
  161. package/dist/utils/containsMetaFlowTemplateLiteral.d.ts.map +1 -1
  162. package/dist/utils/countryCodeToFlagEmoji.d.ts +0 -17
  163. package/dist/utils/countryCodeToFlagEmoji.d.ts.map +1 -1
  164. package/dist/utils/deepMerge.d.ts +0 -17
  165. package/dist/utils/deepMerge.d.ts.map +1 -1
  166. package/dist/utils/evaluateValidationRule.d.ts +0 -17
  167. package/dist/utils/evaluateValidationRule.d.ts.map +1 -1
  168. package/dist/utils/extractEmojiFromUri.d.ts +0 -17
  169. package/dist/utils/extractEmojiFromUri.d.ts.map +1 -1
  170. package/dist/utils/extractPkceStorageKeyFromState.d.ts +0 -17
  171. package/dist/utils/extractPkceStorageKeyFromState.d.ts.map +1 -1
  172. package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts +0 -17
  173. package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts.map +1 -1
  174. package/dist/utils/extractUserClaimsFromIdToken.d.ts +0 -17
  175. package/dist/utils/extractUserClaimsFromIdToken.d.ts.map +1 -1
  176. package/dist/utils/formatDate.d.ts +0 -17
  177. package/dist/utils/formatDate.d.ts.map +1 -1
  178. package/dist/utils/generatePkceStorageKey.d.ts +0 -17
  179. package/dist/utils/generatePkceStorageKey.d.ts.map +1 -1
  180. package/dist/utils/generateStateParamForRequestCorrelation.d.ts +0 -17
  181. package/dist/utils/generateStateParamForRequestCorrelation.d.ts.map +1 -1
  182. package/dist/utils/get.d.ts +0 -17
  183. package/dist/utils/get.d.ts.map +1 -1
  184. package/dist/utils/getAuthorizeRequestUrlParams.d.ts +0 -17
  185. package/dist/utils/getAuthorizeRequestUrlParams.d.ts.map +1 -1
  186. package/dist/utils/getLatestStateParam.d.ts +0 -17
  187. package/dist/utils/getLatestStateParam.d.ts.map +1 -1
  188. package/dist/utils/getRedirectBasedSignUpUrl.d.ts +0 -17
  189. package/dist/utils/getRedirectBasedSignUpUrl.d.ts.map +1 -1
  190. package/dist/utils/getVendorPrefix.d.ts +0 -17
  191. package/dist/utils/getVendorPrefix.d.ts.map +1 -1
  192. package/dist/utils/injectRequestedPermissions.d.ts +0 -17
  193. package/dist/utils/injectRequestedPermissions.d.ts.map +1 -1
  194. package/dist/utils/isEmojiUri.d.ts +0 -17
  195. package/dist/utils/isEmojiUri.d.ts.map +1 -1
  196. package/dist/utils/isEmpty.d.ts +0 -17
  197. package/dist/utils/isEmpty.d.ts.map +1 -1
  198. package/dist/utils/isMetaFlowTemplateLiteral.d.ts +0 -17
  199. package/dist/utils/isMetaFlowTemplateLiteral.d.ts.map +1 -1
  200. package/dist/utils/isRecognizedBaseUrlPattern.d.ts +0 -17
  201. package/dist/utils/isRecognizedBaseUrlPattern.d.ts.map +1 -1
  202. package/dist/utils/isTranslationFlowTemplateLiteral.d.ts +0 -17
  203. package/dist/utils/isTranslationFlowTemplateLiteral.d.ts.map +1 -1
  204. package/dist/utils/logger.d.ts +0 -17
  205. package/dist/utils/logger.d.ts.map +1 -1
  206. package/dist/utils/parseApiErrorMessage.d.ts +0 -17
  207. package/dist/utils/parseApiErrorMessage.d.ts.map +1 -1
  208. package/dist/utils/parseFlowTemplateLiteral.d.ts +0 -17
  209. package/dist/utils/parseFlowTemplateLiteral.d.ts.map +1 -1
  210. package/dist/utils/processOpenIDScopes.d.ts +0 -17
  211. package/dist/utils/processOpenIDScopes.d.ts.map +1 -1
  212. package/dist/utils/processUsername.d.ts +0 -17
  213. package/dist/utils/processUsername.d.ts.map +1 -1
  214. package/dist/utils/removeTrailingSlash.d.ts +0 -17
  215. package/dist/utils/removeTrailingSlash.d.ts.map +1 -1
  216. package/dist/utils/resolveFieldName.d.ts +0 -17
  217. package/dist/utils/resolveFieldName.d.ts.map +1 -1
  218. package/dist/utils/resolveFlowTemplateLiterals.d.ts +0 -17
  219. package/dist/utils/resolveFlowTemplateLiterals.d.ts.map +1 -1
  220. package/dist/utils/resolveLocaleDisplayName.d.ts +0 -17
  221. package/dist/utils/resolveLocaleDisplayName.d.ts.map +1 -1
  222. package/dist/utils/resolveLocaleEmoji.d.ts +0 -17
  223. package/dist/utils/resolveLocaleEmoji.d.ts.map +1 -1
  224. package/dist/utils/resolveMeta.d.ts +0 -17
  225. package/dist/utils/resolveMeta.d.ts.map +1 -1
  226. package/dist/utils/resolveResourceEndpoint.d.ts +0 -17
  227. package/dist/utils/resolveResourceEndpoint.d.ts.map +1 -1
  228. package/dist/utils/set.d.ts +0 -17
  229. package/dist/utils/set.d.ts.map +1 -1
  230. package/dist/utils/startCase.d.ts +0 -17
  231. package/dist/utils/startCase.d.ts.map +1 -1
  232. package/dist/utils/withVendorCSSClassPrefix.d.ts +1 -18
  233. package/dist/utils/withVendorCSSClassPrefix.d.ts.map +1 -1
  234. package/package.json +2 -2
@@ -34,23 +34,6 @@ jose = __toESM(jose);
34
34
 
35
35
  //#region src/constants/TokenConstants.ts
36
36
  /**
37
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
38
- *
39
- * WSO2 LLC. licenses this file to you under the Apache License,
40
- * Version 2.0 (the "License"); you may not use this file except
41
- * in compliance with the License.
42
- * You may obtain a copy of the License at
43
- *
44
- * http://www.apache.org/licenses/LICENSE-2.0
45
- *
46
- * Unless required by applicable law or agreed to in writing,
47
- * software distributed under the License is distributed on an
48
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
49
- * KIND, either express or implied. See the License for the
50
- * specific language governing permissions and limitations
51
- * under the License.
52
- */
53
- /**
54
37
  * Constants related to OIDC token management and storage.
55
38
  * This object contains configuration values and storage keys
56
39
  * used in token validation and management processes.
@@ -87,23 +70,6 @@ var TokenConstants_default = TokenConstants;
87
70
  //#endregion
88
71
  //#region src/errors/exception.ts
89
72
  /**
90
- * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
91
- *
92
- * WSO2 LLC. licenses this file to you under the Apache License,
93
- * Version 2.0 (the "License"); you may not use this file except
94
- * in compliance with the License.
95
- * You may obtain a copy of the License at
96
- *
97
- * http://www.apache.org/licenses/LICENSE-2.0
98
- *
99
- * Unless required by applicable law or agreed to in writing,
100
- * software distributed under the License is distributed on an
101
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
102
- * KIND, either express or implied. See the License for the
103
- * specific language governing permissions and limitations
104
- * under the License.
105
- */
106
- /**
107
73
  * @deprecated Use `ThunderIDRuntimeError` for runtime errors and `ThunderIDAPIError` for API errors.
108
74
  */
109
75
  var ThunderIDAuthException = class extends Error {
@@ -191,23 +157,6 @@ var IsomorphicCrypto = class {
191
157
  //#endregion
192
158
  //#region src/errors/ThunderIDError.ts
193
159
  /**
194
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
195
- *
196
- * WSO2 LLC. licenses this file to you under the Apache License,
197
- * Version 2.0 (the "License"); you may not use this file except
198
- * in compliance with the License.
199
- * You may obtain a copy of the License at
200
- *
201
- * http://www.apache.org/licenses/LICENSE-2.0
202
- *
203
- * Unless required by applicable law or agreed to in writing,
204
- * software distributed under the License is distributed on an
205
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
206
- * KIND, either express or implied. See the License for the
207
- * specific language governing permissions and limitations
208
- * under the License.
209
- */
210
- /**
211
160
  * Base class for all ThunderID errors. This class extends the native Error class
212
161
  * and adds support for error codes and proper stack traces. Each error is prefixed
213
162
  * with a lightning emoji and the SDK name for easy identification.
@@ -256,23 +205,6 @@ var ThunderIDError = class ThunderIDError extends Error {
256
205
  //#endregion
257
206
  //#region src/utils/parseApiErrorMessage.ts
258
207
  /**
259
- * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
260
- *
261
- * WSO2 LLC. licenses this file to you under the Apache License,
262
- * Version 2.0 (the "License"); you may not use this file except
263
- * in compliance with the License.
264
- * You may obtain a copy of the License at
265
- *
266
- * http://www.apache.org/licenses/LICENSE-2.0
267
- *
268
- * Unless required by applicable law or agreed to in writing,
269
- * software distributed under the License is distributed on an
270
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
271
- * KIND, either express or implied. See the License for the
272
- * specific language governing permissions and limitations
273
- * under the License.
274
- */
275
- /**
276
208
  * Attempts to extract a human-readable message from a structured API error response body.
277
209
  *
278
210
  * The backend returns errors in the following form:
@@ -435,23 +367,6 @@ let EmbeddedSignInFlowType = /* @__PURE__ */ function(EmbeddedSignInFlowType$1)
435
367
  //#endregion
436
368
  //#region src/utils/injectRequestedPermissions.ts
437
369
  /**
438
- * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
439
- *
440
- * WSO2 LLC. licenses this file to you under the Apache License,
441
- * Version 2.0 (the "License"); you may not use this file except
442
- * in compliance with the License.
443
- * You may obtain a copy of the License at
444
- *
445
- * http://www.apache.org/licenses/LICENSE-2.0
446
- *
447
- * Unless required by applicable law or agreed to in writing,
448
- * software distributed under the License is distributed on an
449
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
450
- * KIND, either express or implied. See the License for the
451
- * specific language governing permissions and limitations
452
- * under the License.
453
- */
454
- /**
455
370
  * Strips the top-level `scopes` field from a payload and injects it as
456
371
  * `inputs.requested_permissions` (space-separated string).
457
372
  *
@@ -473,175 +388,512 @@ const injectRequestedPermissions = (payload) => {
473
388
  var injectRequestedPermissions_default = injectRequestedPermissions;
474
389
 
475
390
  //#endregion
476
- //#region src/api/executeEmbeddedSignInFlow.ts
477
- const executeEmbeddedSignInFlow = async ({ url, baseUrl, payload, authId, flowSecret,...requestConfig }) => {
478
- 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.");
479
- const endpoint = url ?? `${baseUrl}/flow/execute`;
480
- const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
481
- const isNewFlowStart = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload;
482
- const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
483
- const basePayload = isNewFlowStart ? injectRequestedPermissions_default(cleanPayload) : cleanPayload;
484
- const requestPayload = isNewFlowStart || hasOnlyFlowId ? {
485
- ...basePayload,
486
- verbose: true
487
- } : basePayload;
488
- const response = await fetch(endpoint, {
489
- ...requestConfig,
490
- body: JSON.stringify(requestPayload),
491
- headers: {
492
- Accept: "application/json",
493
- "Content-Type": "application/json",
494
- ...isNewFlowStart && flowSecret ? { "Flow-Secret": flowSecret } : {},
495
- ...requestConfig.headers
496
- },
497
- method: requestConfig.method || "POST"
498
- });
499
- if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedSignInFlow-ResponseError-001", "javascript", response.status, response.statusText, "Authorization request failed");
500
- const flowResponse = await response.json();
501
- if (flowResponse.flowStatus === EmbeddedSignInFlowStatus.Complete && flowResponse.assertion && authId) try {
502
- const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
503
- body: JSON.stringify({
504
- assertion: flowResponse.assertion,
505
- authId
506
- }),
507
- credentials: "include",
508
- headers: {
509
- Accept: "application/json",
510
- "Content-Type": "application/json",
511
- ...requestConfig.headers
512
- },
513
- method: "POST"
514
- });
515
- if (!oauth2Response.ok) throw new ThunderIDAPIError(await oauth2Response.text(), "executeEmbeddedSignInFlow-OAuth2Error-002", "javascript", oauth2Response.status, oauth2Response.statusText, "OAuth2 authorization failed");
516
- const oauth2Result = await oauth2Response.json();
517
- return {
518
- flowStatus: flowResponse.flowStatus,
519
- redirectUrl: oauth2Result["redirect_uri"]
520
- };
521
- } catch (authError) {
522
- if (authError instanceof ThunderIDAPIError) throw authError;
523
- throw new ThunderIDAPIError(authError instanceof Error ? authError.message : "Unknown error", "executeEmbeddedSignInFlow-OAuth2Error-001", "javascript", 500, "Failed to complete OAuth2 authorization after successful embedded sign-in flow.", "OAuth2 authorization failed");
524
- }
525
- return flowResponse;
391
+ //#region src/utils/logger.ts
392
+ const PREFIX = "⚡ ThunderID";
393
+ /**
394
+ * Default logger configuration
395
+ */
396
+ const DEFAULT_CONFIG$1 = {
397
+ level: "info",
398
+ prefix: `${PREFIX}`,
399
+ showLevel: true,
400
+ timestamps: true
526
401
  };
527
- var executeEmbeddedSignInFlow_default = executeEmbeddedSignInFlow;
528
-
529
- //#endregion
530
- //#region src/models/embedded-signup-flow.ts
531
402
  /**
532
- * Status enumeration for ThunderID embedded sign-up flow operations.
533
- *
534
- * These statuses indicate the current state of the registration flow and determine
535
- * the next action required by the client application. Each status provides specific
536
- * guidance on how to proceed with the user registration process.
537
- *
538
- * @example
539
- * ```typescript
540
- * switch (response.flowStatus) {
541
- * case EmbeddedSignUpFlowStatus.Incomplete:
542
- * // More user input needed - render registration form components
543
- * break;
544
- * case EmbeddedSignUpFlowStatus.Complete:
545
- * // Registration successful - handle completion
546
- * break;
547
- * case EmbeddedSignUpFlowStatus.Error:
548
- * // Registration failed - show error details
549
- * const errorResponse = response as EmbeddedSignUpFlowErrorResponse;
550
- * showError(errorResponse.error.description.defaultValue);
551
- * break;
552
- * }
553
- * ```
554
- *
555
- * @experimental Part of the new ThunderID API
403
+ * Environment detection utilities
556
404
  */
557
- let EmbeddedSignUpFlowStatus = /* @__PURE__ */ function(EmbeddedSignUpFlowStatus$1) {
405
+ const isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
406
+ const isNode = () => typeof process !== "undefined" && process.versions && process.versions.node;
407
+ /**
408
+ * Color codes for terminal output (Node.js)
409
+ */
410
+ const COLORS = {
411
+ blue: "\x1B[34m",
412
+ bright: "\x1B[1m",
413
+ cyan: "\x1B[36m",
414
+ dim: "\x1B[2m",
415
+ gray: "\x1B[90m",
416
+ green: "\x1B[32m",
417
+ magenta: "\x1B[35m",
418
+ red: "\x1B[31m",
419
+ reset: "\x1B[0m",
420
+ white: "\x1B[37m",
421
+ yellow: "\x1B[33m"
422
+ };
423
+ /**
424
+ * Browser console styling
425
+ */
426
+ const BROWSER_STYLES = {
427
+ debug: "color: #6b7280; font-weight: normal;",
428
+ error: "color: #dc2626; font-weight: bold;",
429
+ info: "color: #2563eb; font-weight: bold;",
430
+ prefix: "color: #7c3aed; font-weight: bold;",
431
+ timestamp: "color: #6b7280; font-size: 0.9em;",
432
+ warn: "color: #d97706; font-weight: bold;"
433
+ };
434
+ const LOG_LEVEL_ORDER = {
435
+ debug: 0,
436
+ error: 3,
437
+ info: 1,
438
+ warn: 2
439
+ };
440
+ /**
441
+ * Universal logger class that works in both browser and Node.js environments
442
+ */
443
+ var Logger = class Logger {
444
+ config;
445
+ constructor(config = {}) {
446
+ this.config = {
447
+ ...DEFAULT_CONFIG$1,
448
+ ...config
449
+ };
450
+ }
558
451
  /**
559
- * Sign-up flow completed successfully.
560
- *
561
- * The user has successfully registered and the flow can proceed to
562
- * OAuth2 completion or redirection. Check for redirectUrl or assertion
563
- * data in the response for next steps.
452
+ * Update logger configuration
564
453
  */
565
- EmbeddedSignUpFlowStatus$1["Complete"] = "COMPLETE";
454
+ configure(config) {
455
+ this.config = {
456
+ ...this.config,
457
+ ...config
458
+ };
459
+ }
566
460
  /**
567
- * Sign-up flow encountered an error and cannot proceed.
568
- *
569
- * Registration failed due to validation errors, duplicate user,
570
- * system errors, or other issues. The response will be of type
571
- * `EmbeddedSignUpFlowErrorResponse` containing detailed failure
572
- * information that can be displayed to the user.
573
- *
574
- * @see {@link EmbeddedSignUpFlowErrorResponse} for error response structure
461
+ * Get current configuration
575
462
  */
576
- EmbeddedSignUpFlowStatus$1["Error"] = "ERROR";
463
+ getConfig() {
464
+ return { ...this.config };
465
+ }
577
466
  /**
578
- * Sign-up flow requires additional user input.
579
- *
580
- * More registration steps are needed. The response will contain
581
- * components in data.meta.components that should be rendered to
582
- * collect additional user information (e.g., profile data, verification).
467
+ * Check if a log level should be output
583
468
  */
584
- EmbeddedSignUpFlowStatus$1["Incomplete"] = "INCOMPLETE";
585
- return EmbeddedSignUpFlowStatus$1;
586
- }({});
587
- /**
588
- * Type enumeration for ThunderID embedded sign-up flow responses.
589
- *
590
- * Determines the nature of the registration flow response and how the client
591
- * should handle the returned data. This affects both UI rendering and flow
592
- * continuation logic during the user registration process.
593
- *
594
- * @experimental Part of the new ThunderID API
595
- */
596
- let EmbeddedSignUpFlowType = /* @__PURE__ */ function(EmbeddedSignUpFlowType$1) {
469
+ shouldLog(level) {
470
+ return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
471
+ }
597
472
  /**
598
- * Response requires external redirection.
599
- *
600
- * Used for social registration providers, external identity providers,
601
- * or other flows that require navigating to an external URL during
602
- * the registration process. The response will contain redirection information.
473
+ * Get timestamp string
603
474
  */
604
- EmbeddedSignUpFlowType$1["Redirection"] = "REDIRECTION";
475
+ static getTimestamp() {
476
+ return (/* @__PURE__ */ new Date()).toISOString();
477
+ }
605
478
  /**
606
- * Response contains view components for rendering.
607
- *
608
- * Standard embedded registration flow response containing UI components
609
- * that should be rendered within the current application context.
610
- * Most common type for embedded user registration.
479
+ * Get log level string
611
480
  */
612
- EmbeddedSignUpFlowType$1["View"] = "VIEW";
613
- return EmbeddedSignUpFlowType$1;
614
- }({});
615
-
616
- //#endregion
617
- //#region src/api/executeEmbeddedSignUpFlow.ts
618
- const executeEmbeddedSignUpFlow = async ({ url, baseUrl, payload, authId,...requestConfig }) => {
619
- 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.");
620
- const endpoint = url ?? `${baseUrl}/flow/execute`;
621
- const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
622
- const isNewFlowStart = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload;
623
- const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
624
- const basePayload = isNewFlowStart ? injectRequestedPermissions_default(cleanPayload) : cleanPayload;
625
- const requestPayload = isNewFlowStart || hasOnlyFlowId ? {
626
- ...basePayload,
627
- verbose: true
628
- } : basePayload;
629
- const response = await fetch(endpoint, {
630
- ...requestConfig,
631
- body: JSON.stringify(requestPayload),
632
- headers: {
633
- Accept: "application/json",
634
- "Content-Type": "application/json",
635
- ...requestConfig.headers
636
- },
637
- method: requestConfig.method || "POST"
638
- });
639
- if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedSignUpFlow-ResponseError-001", "javascript", response.status, response.statusText, "Registration request failed");
640
- const flowResponse = await response.json();
641
- if (flowResponse.flowStatus === EmbeddedSignUpFlowStatus.Complete && flowResponse.assertion && authId) try {
642
- const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
643
- body: JSON.stringify({
644
- assertion: flowResponse.assertion,
481
+ static getLevelString(level) {
482
+ switch (level) {
483
+ case "debug": return "DEBUG";
484
+ case "info": return "INFO";
485
+ case "warn": return "WARN";
486
+ case "error": return "ERROR";
487
+ default: return "UNKNOWN";
488
+ }
489
+ }
490
+ /**
491
+ * Format message for Node.js terminal
492
+ */
493
+ formatForNode(level, message) {
494
+ const parts = [];
495
+ if (this.config.timestamps) parts.push(`${COLORS.gray}[${Logger.getTimestamp()}]${COLORS.reset}`);
496
+ if (this.config.prefix) parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);
497
+ if (this.config.showLevel) {
498
+ const levelStr = Logger.getLevelString(level);
499
+ let coloredLevel;
500
+ switch (level) {
501
+ case "debug":
502
+ coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
503
+ break;
504
+ case "info":
505
+ coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
506
+ break;
507
+ case "warn":
508
+ coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
509
+ break;
510
+ case "error":
511
+ coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
512
+ break;
513
+ default: coloredLevel = `[${levelStr}]`;
514
+ }
515
+ parts.push(coloredLevel);
516
+ }
517
+ parts.push(message);
518
+ return parts.join(" ");
519
+ }
520
+ /**
521
+ * Log message using appropriate method
522
+ */
523
+ logMessage(level, message, ...args) {
524
+ if (!this.shouldLog(level)) return;
525
+ if (this.config.formatter) {
526
+ this.config.formatter(level, message, ...args);
527
+ return;
528
+ }
529
+ if (isBrowser()) this.logToBrowser(level, message, ...args);
530
+ else if (isNode()) this.logToNode(level, message, ...args);
531
+ else console.log(message, ...args);
532
+ }
533
+ /**
534
+ * Log to browser console with styling
535
+ */
536
+ logToBrowser(level, message, ...args) {
537
+ const parts = [];
538
+ const styles = [];
539
+ if (this.config.timestamps) {
540
+ parts.push(`%c[${Logger.getTimestamp()}]`);
541
+ styles.push(BROWSER_STYLES.timestamp);
542
+ }
543
+ if (this.config.prefix) {
544
+ parts.push(`%c${this.config.prefix}`);
545
+ styles.push(BROWSER_STYLES.prefix);
546
+ }
547
+ if (this.config.showLevel) {
548
+ const levelStr = Logger.getLevelString(level);
549
+ parts.push(`%c[${levelStr}]`);
550
+ switch (level) {
551
+ case "debug":
552
+ styles.push(BROWSER_STYLES.debug);
553
+ break;
554
+ case "info":
555
+ styles.push(BROWSER_STYLES.info);
556
+ break;
557
+ case "warn":
558
+ styles.push(BROWSER_STYLES.warn);
559
+ break;
560
+ case "error":
561
+ styles.push(BROWSER_STYLES.error);
562
+ break;
563
+ default: styles.push("");
564
+ }
565
+ }
566
+ parts.push(`%c${message}`);
567
+ styles.push("color: inherit; font-weight: normal;");
568
+ const formattedMessage = parts.join(" ");
569
+ switch (level) {
570
+ case "debug":
571
+ console.debug(formattedMessage, ...styles, ...args);
572
+ break;
573
+ case "info":
574
+ console.info(formattedMessage, ...styles, ...args);
575
+ break;
576
+ case "warn":
577
+ console.warn(formattedMessage, ...styles, ...args);
578
+ break;
579
+ case "error":
580
+ console.error(formattedMessage, ...styles, ...args);
581
+ break;
582
+ default: console.log(formattedMessage, ...styles, ...args);
583
+ }
584
+ }
585
+ /**
586
+ * Log to Node.js console
587
+ */
588
+ logToNode(level, message, ...args) {
589
+ const formattedMessage = this.formatForNode(level, message);
590
+ switch (level) {
591
+ case "debug":
592
+ console.debug(formattedMessage, ...args);
593
+ break;
594
+ case "info":
595
+ console.info(formattedMessage, ...args);
596
+ break;
597
+ case "warn":
598
+ console.warn(formattedMessage, ...args);
599
+ break;
600
+ case "error":
601
+ console.error(formattedMessage, ...args);
602
+ break;
603
+ default: console.log(formattedMessage, ...args);
604
+ }
605
+ }
606
+ /**
607
+ * Log debug message
608
+ */
609
+ debug(message, ...args) {
610
+ this.logMessage("debug", message, ...args);
611
+ }
612
+ /**
613
+ * Log info message
614
+ */
615
+ info(message, ...args) {
616
+ this.logMessage("info", message, ...args);
617
+ }
618
+ /**
619
+ * Log warning message
620
+ */
621
+ warn(message, ...args) {
622
+ this.logMessage("warn", message, ...args);
623
+ }
624
+ /**
625
+ * Log error message
626
+ */
627
+ error(message, ...args) {
628
+ this.logMessage("error", message, ...args);
629
+ }
630
+ /**
631
+ * Create a child logger with additional prefix
632
+ */
633
+ child(prefix) {
634
+ const childPrefix = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;
635
+ return new Logger({
636
+ ...this.config,
637
+ prefix: childPrefix
638
+ });
639
+ }
640
+ /**
641
+ * Set log level
642
+ */
643
+ setLevel(level) {
644
+ this.config.level = level;
645
+ }
646
+ /**
647
+ * Get current log level
648
+ */
649
+ getLevel() {
650
+ return this.config.level;
651
+ }
652
+ };
653
+ /**
654
+ * Default logger instance
655
+ */
656
+ const logger = new Logger();
657
+ /**
658
+ * Create a new logger instance with custom configuration
659
+ */
660
+ const createLogger = (config) => new Logger(config);
661
+ /**
662
+ * Default export - global logger instance
663
+ */
664
+ var logger_default = logger;
665
+ /**
666
+ * Named exports for convenience
667
+ */
668
+ const debug = (message, ...args) => logger.debug(message, ...args);
669
+ const info = (message, ...args) => logger.info(message, ...args);
670
+ const warn = (message, ...args) => logger.warn(message, ...args);
671
+ const error = (message, ...args) => logger.error(message, ...args);
672
+ /**
673
+ * Configure the default logger
674
+ */
675
+ const configure = (config) => logger.configure(config);
676
+ /**
677
+ * Create component-specific loggers
678
+ */
679
+ const createComponentLogger = (component) => logger.child(component);
680
+ /**
681
+ * Create package-specific logger
682
+ */
683
+ const createPackageLogger = (packageName) => createLogger({
684
+ level: "info",
685
+ prefix: `${PREFIX} - ${packageName}`,
686
+ showLevel: true,
687
+ timestamps: true
688
+ });
689
+ /**
690
+ * Create package component logger (package + component)
691
+ */
692
+ const createPackageComponentLogger = (packageName, component) => {
693
+ return createPackageLogger(packageName).child(component);
694
+ };
695
+
696
+ //#endregion
697
+ //#region src/api/executeEmbeddedSignInFlow.ts
698
+ const readErrorAssertion = (body) => {
699
+ try {
700
+ return JSON.parse(body).errorAssertion;
701
+ } catch {
702
+ return;
703
+ }
704
+ };
705
+ const postAuthCallback = async (baseUrl, body, headers) => {
706
+ const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
707
+ body: JSON.stringify(body),
708
+ credentials: "include",
709
+ headers: {
710
+ Accept: "application/json",
711
+ "Content-Type": "application/json",
712
+ ...headers
713
+ },
714
+ method: "POST"
715
+ });
716
+ if (!oauth2Response.ok) {
717
+ const oauth2ErrorText = await oauth2Response.text();
718
+ logger_default.error(`OAuth2 authorization failed. The callback responded ${oauth2Response.status} ${oauth2Response.statusText}:`, oauth2ErrorText);
719
+ throw new ThunderIDAPIError("OAuth2 authorization failed", "executeEmbeddedSignInFlow-OAuth2Error-002", "javascript", oauth2Response.status, oauth2Response.statusText);
720
+ }
721
+ return oauth2Response.json();
722
+ };
723
+ const relayFailure = async (baseUrl, authId, errorAssertion, headers, flowResponse) => {
724
+ const oauth2Result = await postAuthCallback(baseUrl, {
725
+ assertion: errorAssertion,
726
+ authId
727
+ }, headers);
728
+ return {
729
+ ...flowResponse,
730
+ flowStatus: EmbeddedSignInFlowStatus.Error,
731
+ redirectUrl: oauth2Result["redirect_uri"]
732
+ };
733
+ };
734
+ const executeEmbeddedSignInFlow = async ({ url, baseUrl, payload, authId, flowSecret,...requestConfig }) => {
735
+ 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.");
736
+ const endpoint = url ?? `${baseUrl}/flow/execute`;
737
+ const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
738
+ const isNewFlowStart = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload;
739
+ const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
740
+ const basePayload = isNewFlowStart ? injectRequestedPermissions_default(cleanPayload) : cleanPayload;
741
+ const requestPayload = isNewFlowStart || hasOnlyFlowId ? {
742
+ ...basePayload,
743
+ verbose: true
744
+ } : basePayload;
745
+ const response = await fetch(endpoint, {
746
+ ...requestConfig,
747
+ body: JSON.stringify(requestPayload),
748
+ headers: {
749
+ Accept: "application/json",
750
+ "Content-Type": "application/json",
751
+ ...isNewFlowStart && flowSecret ? { "Flow-Secret": flowSecret } : {},
752
+ ...requestConfig.headers
753
+ },
754
+ method: requestConfig.method || "POST"
755
+ });
756
+ if (!response.ok) {
757
+ const errorText = await response.text();
758
+ const errorAssertion = readErrorAssertion(errorText);
759
+ if (authId && errorAssertion) return await relayFailure(baseUrl, authId, errorAssertion, requestConfig.headers);
760
+ throw new ThunderIDAPIError(errorText, "executeEmbeddedSignInFlow-ResponseError-001", "javascript", response.status, response.statusText, "Authorization request failed");
761
+ }
762
+ const flowResponse = await response.json();
763
+ if (flowResponse.flowStatus === EmbeddedSignInFlowStatus.Complete && flowResponse.assertion && authId) try {
764
+ const oauth2Result = await postAuthCallback(baseUrl, {
765
+ assertion: flowResponse.assertion,
766
+ authId
767
+ }, requestConfig.headers);
768
+ return {
769
+ flowStatus: flowResponse.flowStatus,
770
+ redirectUrl: oauth2Result["redirect_uri"]
771
+ };
772
+ } catch (authError) {
773
+ if (authError instanceof ThunderIDAPIError) throw authError;
774
+ 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");
775
+ }
776
+ if (flowResponse.flowStatus === EmbeddedSignInFlowStatus.Error && flowResponse.errorAssertion && authId) return relayFailure(baseUrl, authId, flowResponse.errorAssertion, requestConfig.headers, flowResponse);
777
+ return flowResponse;
778
+ };
779
+ var executeEmbeddedSignInFlow_default = executeEmbeddedSignInFlow;
780
+
781
+ //#endregion
782
+ //#region src/models/embedded-signup-flow.ts
783
+ /**
784
+ * Status enumeration for ThunderID embedded sign-up flow operations.
785
+ *
786
+ * These statuses indicate the current state of the registration flow and determine
787
+ * the next action required by the client application. Each status provides specific
788
+ * guidance on how to proceed with the user registration process.
789
+ *
790
+ * @example
791
+ * ```typescript
792
+ * switch (response.flowStatus) {
793
+ * case EmbeddedSignUpFlowStatus.Incomplete:
794
+ * // More user input needed - render registration form components
795
+ * break;
796
+ * case EmbeddedSignUpFlowStatus.Complete:
797
+ * // Registration successful - handle completion
798
+ * break;
799
+ * case EmbeddedSignUpFlowStatus.Error:
800
+ * // Registration failed - show error details
801
+ * const errorResponse = response as EmbeddedSignUpFlowErrorResponse;
802
+ * showError(errorResponse.error.description.defaultValue);
803
+ * break;
804
+ * }
805
+ * ```
806
+ *
807
+ * @experimental Part of the new ThunderID API
808
+ */
809
+ let EmbeddedSignUpFlowStatus = /* @__PURE__ */ function(EmbeddedSignUpFlowStatus$1) {
810
+ /**
811
+ * Sign-up flow completed successfully.
812
+ *
813
+ * The user has successfully registered and the flow can proceed to
814
+ * OAuth2 completion or redirection. Check for redirectUrl or assertion
815
+ * data in the response for next steps.
816
+ */
817
+ EmbeddedSignUpFlowStatus$1["Complete"] = "COMPLETE";
818
+ /**
819
+ * Sign-up flow encountered an error and cannot proceed.
820
+ *
821
+ * Registration failed due to validation errors, duplicate user,
822
+ * system errors, or other issues. The response will be of type
823
+ * `EmbeddedSignUpFlowErrorResponse` containing detailed failure
824
+ * information that can be displayed to the user.
825
+ *
826
+ * @see {@link EmbeddedSignUpFlowErrorResponse} for error response structure
827
+ */
828
+ EmbeddedSignUpFlowStatus$1["Error"] = "ERROR";
829
+ /**
830
+ * Sign-up flow requires additional user input.
831
+ *
832
+ * More registration steps are needed. The response will contain
833
+ * components in data.meta.components that should be rendered to
834
+ * collect additional user information (e.g., profile data, verification).
835
+ */
836
+ EmbeddedSignUpFlowStatus$1["Incomplete"] = "INCOMPLETE";
837
+ return EmbeddedSignUpFlowStatus$1;
838
+ }({});
839
+ /**
840
+ * Type enumeration for ThunderID embedded sign-up flow responses.
841
+ *
842
+ * Determines the nature of the registration flow response and how the client
843
+ * should handle the returned data. This affects both UI rendering and flow
844
+ * continuation logic during the user registration process.
845
+ *
846
+ * @experimental Part of the new ThunderID API
847
+ */
848
+ let EmbeddedSignUpFlowType = /* @__PURE__ */ function(EmbeddedSignUpFlowType$1) {
849
+ /**
850
+ * Response requires external redirection.
851
+ *
852
+ * Used for social registration providers, external identity providers,
853
+ * or other flows that require navigating to an external URL during
854
+ * the registration process. The response will contain redirection information.
855
+ */
856
+ EmbeddedSignUpFlowType$1["Redirection"] = "REDIRECTION";
857
+ /**
858
+ * Response contains view components for rendering.
859
+ *
860
+ * Standard embedded registration flow response containing UI components
861
+ * that should be rendered within the current application context.
862
+ * Most common type for embedded user registration.
863
+ */
864
+ EmbeddedSignUpFlowType$1["View"] = "VIEW";
865
+ return EmbeddedSignUpFlowType$1;
866
+ }({});
867
+
868
+ //#endregion
869
+ //#region src/api/executeEmbeddedSignUpFlow.ts
870
+ const executeEmbeddedSignUpFlow = async ({ url, baseUrl, payload, authId,...requestConfig }) => {
871
+ 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.");
872
+ const endpoint = url ?? `${baseUrl}/flow/execute`;
873
+ const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
874
+ const isNewFlowStart = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload;
875
+ const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
876
+ const basePayload = isNewFlowStart ? injectRequestedPermissions_default(cleanPayload) : cleanPayload;
877
+ const requestPayload = isNewFlowStart || hasOnlyFlowId ? {
878
+ ...basePayload,
879
+ verbose: true
880
+ } : basePayload;
881
+ const response = await fetch(endpoint, {
882
+ ...requestConfig,
883
+ body: JSON.stringify(requestPayload),
884
+ headers: {
885
+ Accept: "application/json",
886
+ "Content-Type": "application/json",
887
+ ...requestConfig.headers
888
+ },
889
+ method: requestConfig.method || "POST"
890
+ });
891
+ if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedSignUpFlow-ResponseError-001", "javascript", response.status, response.statusText, "Registration request failed");
892
+ const flowResponse = await response.json();
893
+ if (flowResponse.flowStatus === EmbeddedSignUpFlowStatus.Complete && flowResponse.assertion && authId) try {
894
+ const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
895
+ body: JSON.stringify({
896
+ assertion: flowResponse.assertion,
645
897
  authId
646
898
  }),
647
899
  credentials: "include",
@@ -730,23 +982,6 @@ var executeEmbeddedRecoveryFlow_default = executeEmbeddedRecoveryFlow;
730
982
 
731
983
  //#endregion
732
984
  //#region src/models/embedded-flow.ts
733
- /**
734
- * Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com).
735
- *
736
- * WSO2 LLC. licenses this file to you under the Apache License,
737
- * Version 2.0 (the "License"); you may not use this file except
738
- * in compliance with the License.
739
- * You may obtain a copy of the License at
740
- *
741
- * http://www.apache.org/licenses/LICENSE-2.0
742
- *
743
- * Unless required by applicable law or agreed to in writing,
744
- * software distributed under the License is distributed on an
745
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
746
- * KIND, either express or implied. See the License for the
747
- * specific language governing permissions and limitations
748
- * under the License.
749
- */
750
985
  let EmbeddedFlowType = /* @__PURE__ */ function(EmbeddedFlowType$1) {
751
986
  EmbeddedFlowType$1["Authentication"] = "AUTHENTICATION";
752
987
  EmbeddedFlowType$1["Recovery"] = "RECOVERY";
@@ -1111,23 +1346,6 @@ var getUserInfo_default = getUserInfo;
1111
1346
  //#endregion
1112
1347
  //#region src/utils/processUsername.ts
1113
1348
  /**
1114
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
1115
- *
1116
- * WSO2 LLC. licenses this file to you under the Apache License,
1117
- * Version 2.0 (the "License"); you may not use this file except
1118
- * in compliance with the License.
1119
- * You may obtain a copy of the License at
1120
- *
1121
- * http://www.apache.org/licenses/LICENSE-2.0
1122
- *
1123
- * Unless required by applicable law or agreed to in writing,
1124
- * software distributed under the License is distributed on an
1125
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1126
- * KIND, either express or implied. See the License for the
1127
- * specific language governing permissions and limitations
1128
- * under the License.
1129
- */
1130
- /**
1131
1349
  * Regular expression to match userstore prefixes in usernames.
1132
1350
  * Matches patterns like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
1133
1351
  * The pattern matches any uppercase letters, numbers, and underscores followed by a forward slash.
@@ -1362,23 +1580,6 @@ var updateMeProfile_default = updateMeProfile;
1362
1580
  //#endregion
1363
1581
  //#region src/constants/ApplicationNativeAuthenticationConstants.ts
1364
1582
  /**
1365
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
1366
- *
1367
- * WSO2 LLC. licenses this file to you under the Apache License,
1368
- * Version 2.0 (the "License"); you may not use this file except
1369
- * in compliance with the License.
1370
- * You may obtain a copy of the License at
1371
- *
1372
- * http://www.apache.org/licenses/LICENSE-2.0
1373
- *
1374
- * Unless required by applicable law or agreed to in writing,
1375
- * software distributed under the License is distributed on an
1376
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1377
- * KIND, either express or implied. See the License for the
1378
- * specific language governing permissions and limitations
1379
- * under the License.
1380
- */
1381
- /**
1382
1583
  * Constants representing Application Native Authentication related configurations and constants.
1383
1584
  */
1384
1585
  const ApplicationNativeAuthenticationConstants = { SupportedAuthenticators: {
@@ -1402,23 +1603,6 @@ var ApplicationNativeAuthenticationConstants_default = ApplicationNativeAuthenti
1402
1603
  //#endregion
1403
1604
  //#region src/constants/ScopeConstants.ts
1404
1605
  /**
1405
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
1406
- *
1407
- * WSO2 LLC. licenses this file to you under the Apache License,
1408
- * Version 2.0 (the "License"); you may not use this file except
1409
- * in compliance with the License.
1410
- * You may obtain a copy of the License at
1411
- *
1412
- * http://www.apache.org/licenses/LICENSE-2.0
1413
- *
1414
- * Unless required by applicable law or agreed to in writing,
1415
- * software distributed under the License is distributed on an
1416
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1417
- * KIND, either express or implied. See the License for the
1418
- * specific language governing permissions and limitations
1419
- * under the License.
1420
- */
1421
- /**
1422
1606
  * Constants for OAuth 2.0 and OpenID Connect scopes.
1423
1607
  * These scopes define the level of access that the client application
1424
1608
  * is requesting from the authorization server.
@@ -1453,778 +1637,376 @@ const OIDCRequestConstants = {
1453
1637
  Params: {
1454
1638
  AUTHORIZATION_CODE: "code",
1455
1639
  SESSION_STATE: "session_state",
1456
- SIGN_OUT_SUCCESS: "sign_out_success",
1457
- STATE: "state"
1458
- },
1459
- SignIn: { Payload: { DEFAULT_SCOPES: [ScopeConstants_default.OPENID, ScopeConstants_default.PROFILE] } },
1460
- SignOut: { Storage: { StorageKeys: { SIGN_OUT_URL: "sign_out_url" } } }
1461
- };
1462
- var OIDCRequestConstants_default = OIDCRequestConstants;
1463
-
1464
- //#endregion
1465
- //#region src/constants/VendorConstants.ts
1466
- /**
1467
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
1468
- *
1469
- * WSO2 LLC. licenses this file to you under the Apache License,
1470
- * Version 2.0 (the "License"); you may not use this file except
1471
- * in compliance with the License.
1472
- * You may obtain a copy of the License at
1473
- *
1474
- * http://www.apache.org/licenses/LICENSE-2.0
1475
- *
1476
- * Unless required by applicable law or agreed to in writing,
1477
- * software distributed under the License is distributed on an
1478
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1479
- * KIND, either express or implied. See the License for the
1480
- * specific language governing permissions and limitations
1481
- * under the License.
1482
- */
1483
- /**
1484
- * Constants for vendor-specific configurations.
1485
- * By default, the vendor is inferred as ThunderID.
1486
- *
1487
- * @example
1488
- * ```typescript
1489
- * // Using the vendor prefix in a URL
1490
- * const apiUrl = `${VendorConstants.VENDOR_PREFIX}/api/v1/resource`;
1491
- * ```
1492
- */
1493
- const VendorConstants = { VENDOR_PREFIX: "thunderid" };
1494
- var VendorConstants_default = VendorConstants;
1495
-
1496
- //#endregion
1497
- //#region src/errors/ThunderIDRuntimeError.ts
1498
- /**
1499
- * Base class for all runtime errors in ThunderID. This class extends ThunderIDError
1500
- * and adds support for additional error details. Use this class for errors that occur
1501
- * during runtime execution that are not related to API calls.
1502
- *
1503
- * @example
1504
- * ```typescript
1505
- * throw new ThunderIDRuntimeError(
1506
- * "Failed to parse configuration",
1507
- * "CONFIG_PARSE_ERROR",
1508
- * { invalidField: "redirectUri" }
1509
- * );
1510
- * ```
1511
- */
1512
- var ThunderIDRuntimeError = class extends ThunderIDError {
1513
- /**
1514
- * Creates an instance of ThunderIDRuntimeError.
1515
- *
1516
- * @param message - Human-readable description of the error
1517
- * @param code - A unique error code that identifies the error type
1518
- * @param details - Additional details about the error that might be helpful for debugging
1519
- * @param origin - Optional. The SDK origin (e.g. 'react', 'vue'). Defaults to generic 'ThunderID'
1520
- * @constructor
1521
- */
1522
- constructor(message, code, origin, details) {
1523
- super(message, code, origin);
1524
- this.details = details;
1525
- Object.defineProperty(this, "name", {
1526
- configurable: true,
1527
- value: "ThunderIDRuntimeError",
1528
- writable: true
1529
- });
1530
- }
1531
- /**
1532
- * Returns a string representation of the runtime error
1533
- * @returns Formatted error string with name, code, details, and message
1534
- */
1535
- toString() {
1536
- const details = this.details ? `\nDetails: ${JSON.stringify(this.details, null, 2)}` : "";
1537
- return `[${this.name}] (code="${this.code}")${details}\nMessage: ${this.message}`;
1538
- }
1539
- };
1540
-
1541
- //#endregion
1542
- //#region src/models/embedded-recovery-flow.ts
1543
- /**
1544
- * Status enumeration for the embedded recovery flow operations.
1545
- *
1546
- * @experimental Part of the new ThunderID API
1547
- */
1548
- let EmbeddedRecoveryFlowStatus = /* @__PURE__ */ function(EmbeddedRecoveryFlowStatus$1) {
1549
- /**
1550
- * Recovery flow completed successfully.
1551
- */
1552
- EmbeddedRecoveryFlowStatus$1["Complete"] = "COMPLETE";
1553
- /**
1554
- * Recovery flow encountered an error and cannot proceed.
1555
- *
1556
- * @see {@link EmbeddedRecoveryFlowErrorResponse} for error response structure
1557
- */
1558
- EmbeddedRecoveryFlowStatus$1["Error"] = "ERROR";
1559
- /**
1560
- * Recovery flow requires additional user input.
1561
- */
1562
- EmbeddedRecoveryFlowStatus$1["Incomplete"] = "INCOMPLETE";
1563
- return EmbeddedRecoveryFlowStatus$1;
1564
- }({});
1565
- /**
1566
- * Type enumeration for embedded recovery flow responses.
1567
- *
1568
- * @experimental Part of the new ThunderID API
1569
- */
1570
- let EmbeddedRecoveryFlowType = /* @__PURE__ */ function(EmbeddedRecoveryFlowType$1) {
1571
- /**
1572
- * Response requires external redirection.
1573
- */
1574
- EmbeddedRecoveryFlowType$1["Redirection"] = "REDIRECTION";
1575
- /**
1576
- * Response contains view components for rendering.
1577
- */
1578
- EmbeddedRecoveryFlowType$1["View"] = "VIEW";
1579
- return EmbeddedRecoveryFlowType$1;
1580
- }({});
1581
-
1582
- //#endregion
1583
- //#region src/models/flow-meta.ts
1584
- /**
1585
- * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
1586
- *
1587
- * WSO2 LLC. licenses this file to you under the Apache License,
1588
- * Version 2.0 (the "License"); you may not use this file except
1589
- * in compliance with the License.
1590
- * You may obtain a copy of the License at
1591
- *
1592
- * http://www.apache.org/licenses/LICENSE-2.0
1593
- *
1594
- * Unless required by applicable law or agreed to in writing,
1595
- * software distributed under the License is distributed on an
1596
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1597
- * KIND, either express or implied. See the License for the
1598
- * specific language governing permissions and limitations
1599
- * under the License.
1600
- */
1601
- /**
1602
- * The type of entity to retrieve flow metadata for.
1603
- *
1604
- * @example
1605
- * ```typescript
1606
- * const config: GetFlowMetaRequestConfig = {
1607
- * baseUrl: 'https://localhost:8090',
1608
- * type: FlowMetaType.App,
1609
- * id: '60a9b38b-6eba-9f9e-55f9-267067de4680',
1610
- * };
1611
- * ```
1612
- *
1613
- * @experimental This API may change in future versions
1614
- */
1615
- let FlowMetaType = /* @__PURE__ */ function(FlowMetaType$1) {
1616
- /** Retrieve metadata scoped to a specific application */
1617
- FlowMetaType$1["App"] = "APP";
1618
- /** Retrieve metadata scoped to a specific organization unit */
1619
- FlowMetaType$1["Ou"] = "OU";
1620
- return FlowMetaType$1;
1621
- }({});
1622
-
1623
- //#endregion
1624
- //#region src/models/flow.ts
1625
- /**
1626
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
1627
- *
1628
- * WSO2 LLC. licenses this file to you under the Apache License,
1629
- * Version 2.0 (the "License"); you may not use this file except
1630
- * in compliance with the License.
1631
- * You may obtain a copy of the License at
1632
- *
1633
- * http://www.apache.org/licenses/LICENSE-2.0
1634
- *
1635
- * Unless required by applicable law or agreed to in writing,
1636
- * software distributed under the License is distributed on an
1637
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1638
- * KIND, either express or implied. See the License for the
1639
- * specific language governing permissions and limitations
1640
- * under the License.
1641
- */
1642
- let FlowMode = /* @__PURE__ */ function(FlowMode$1) {
1643
- /**
1644
- * This mode is suitable for embedded sign-in, sign-up, etc. flows where the authentication
1645
- * UIs are rendered within the application.
1646
- * @see {@link https://is.docs.wso2.com/en/7.1.0/references/app-native-authentication/}
1647
- */
1648
- FlowMode$1["Embedded"] = "DIRECT";
1649
- /**
1650
- * Traditional redirect based sign-in, sign-up, etc. flows where the authentication
1651
- * UIs are from a external Identity Provider (ex: WSO2 Identity Server or ThunderID).
1652
- */
1653
- FlowMode$1["Redirect"] = "REDIRECTION";
1654
- return FlowMode$1;
1655
- }({});
1656
-
1657
- //#endregion
1658
- //#region src/models/field.ts
1659
- /**
1660
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
1661
- *
1662
- * WSO2 LLC. licenses this file to you under the Apache License,
1663
- * Version 2.0 (the "License"); you may not use this file except
1664
- * in compliance with the License.
1665
- * You may obtain a copy of the License at
1666
- *
1667
- * http://www.apache.org/licenses/LICENSE-2.0
1668
- *
1669
- * Unless required by applicable law or agreed to in writing,
1670
- * software distributed under the License is distributed on an
1671
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1672
- * KIND, either express or implied. See the License for the
1673
- * specific language governing permissions and limitations
1674
- * under the License.
1675
- */
1676
- let FieldType = /* @__PURE__ */ function(FieldType$1) {
1677
- FieldType$1["Checkbox"] = "CHECKBOX";
1678
- FieldType$1["Date"] = "DATE";
1679
- FieldType$1["Email"] = "EMAIL";
1680
- FieldType$1["Number"] = "NUMBER";
1681
- FieldType$1["Otp"] = "OTP";
1682
- FieldType$1["Password"] = "PASSWORD";
1683
- FieldType$1["Radio"] = "RADIO";
1684
- FieldType$1["Select"] = "SELECT";
1685
- FieldType$1["Tel"] = "TEL";
1686
- FieldType$1["Text"] = "TEXT";
1687
- FieldType$1["Textarea"] = "TEXTAREA";
1688
- FieldType$1["Time"] = "TIME";
1689
- return FieldType$1;
1690
- }({});
1691
-
1692
- //#endregion
1693
- //#region src/constants/OIDCDiscoveryConstants.ts
1694
- /**
1695
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
1696
- *
1697
- * WSO2 LLC. licenses this file to you under the Apache License,
1698
- * Version 2.0 (the "License"); you may not use this file except
1699
- * in compliance with the License.
1700
- * You may obtain a copy of the License at
1701
- *
1702
- * http://www.apache.org/licenses/LICENSE-2.0
1703
- *
1704
- * Unless required by applicable law or agreed to in writing,
1705
- * software distributed under the License is distributed on an
1706
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1707
- * KIND, either express or implied. See the License for the
1708
- * specific language governing permissions and limitations
1709
- * under the License.
1710
- */
1711
- /**
1712
- * Constants related to OpenID Connect (OIDC) metadata and endpoints.
1713
- * This object contains all the standard OIDC endpoints and storage keys
1714
- * used throughout the application for authentication and authorization.
1715
- *
1716
- * @remarks
1717
- * The constants are organized into two main sections:
1718
- * 1. Endpoints - Contains all OIDC standard endpoint paths
1719
- * 2. Storage - Contains keys used for storing OIDC-related data
1720
- *
1721
- * @example
1722
- * ```typescript
1723
- * // Using an endpoint
1724
- * const authEndpoint = OIDCDiscoveryConstants.Endpoints.AUTHORIZATION;
1725
- *
1726
- * // Using a storage key
1727
- * const tokenKey = OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.TOKEN;
1728
- * ```
1729
- */
1730
- const OIDCDiscoveryConstants = {
1731
- Endpoints: {
1732
- AUTHORIZATION: "/oauth2/authorize",
1733
- END_SESSION: "/oauth2/logout",
1734
- ISSUER: "/oauth2/token",
1735
- JWKS: "/oauth2/jwks",
1736
- REVOCATION: "/oauth2/revoke",
1737
- SESSION_IFRAME: "/oidc/checksession",
1738
- TOKEN: "/oauth2/token",
1739
- USERINFO: "/oauth2/userinfo"
1740
- },
1741
- Storage: { StorageKeys: {
1742
- Endpoints: {
1743
- AUTHORIZATION: "authorization_endpoint",
1744
- END_SESSION: "end_session_endpoint",
1745
- ISSUER: "issuer",
1746
- JWKS: "jwks_uri",
1747
- REVOCATION: "revocation_endpoint",
1748
- SESSION_IFRAME: "check_session_iframe",
1749
- TOKEN: "token_endpoint",
1750
- USERINFO: "userinfo_endpoint"
1751
- },
1752
- OPENID_PROVIDER_CONFIG_INITIATED: "op_config_initiated"
1753
- } }
1640
+ SIGN_OUT_SUCCESS: "sign_out_success",
1641
+ STATE: "state"
1642
+ },
1643
+ SignIn: { Payload: { DEFAULT_SCOPES: [ScopeConstants_default.OPENID, ScopeConstants_default.PROFILE] } },
1644
+ SignOut: { Storage: { StorageKeys: { SIGN_OUT_URL: "sign_out_url" } } }
1754
1645
  };
1755
- var OIDCDiscoveryConstants_default = OIDCDiscoveryConstants;
1646
+ var OIDCRequestConstants_default = OIDCRequestConstants;
1756
1647
 
1757
1648
  //#endregion
1758
- //#region src/constants/PKCEConstants.ts
1759
- /**
1760
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
1761
- *
1762
- * WSO2 LLC. licenses this file to you under the Apache License,
1763
- * Version 2.0 (the "License"); you may not use this file except
1764
- * in compliance with the License.
1765
- * You may obtain a copy of the License at
1766
- *
1767
- * http://www.apache.org/licenses/LICENSE-2.0
1768
- *
1769
- * Unless required by applicable law or agreed to in writing,
1770
- * software distributed under the License is distributed on an
1771
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1772
- * KIND, either express or implied. See the License for the
1773
- * specific language governing permissions and limitations
1774
- * under the License.
1775
- */
1649
+ //#region src/constants/VendorConstants.ts
1776
1650
  /**
1777
- * Constants related to Proof Key for Code Exchange (PKCE) implementation.
1778
- * This object contains all the necessary constants for implementing PKCE
1779
- * flow in the OAuth 2.0 authorization code grant.
1780
- *
1781
- * @remarks
1782
- * PKCE is an extension to the authorization code flow to prevent CSRF and
1783
- * authorization code injection attacks. The constants are organized into
1784
- * storage-related sections for managing PKCE state.
1651
+ * Constants for vendor-specific configurations.
1652
+ * By default, the vendor is inferred as ThunderID.
1785
1653
  *
1786
1654
  * @example
1787
1655
  * ```typescript
1788
- * // Using storage keys
1789
- * const codeVerifierKey = PKCEConstants.Storage.StorageKeys.CODE_VERIFIER;
1790
- * const separator = PKCEConstants.Storage.StorageKeys.SEPARATOR;
1656
+ * // Using the vendor prefix in a URL
1657
+ * const apiUrl = `${VendorConstants.VENDOR_PREFIX}/api/v1/resource`;
1791
1658
  * ```
1792
1659
  */
1793
- const PKCEConstants = {
1794
- DEFAULT_CODE_CHALLENGE_METHOD: "S256",
1795
- Storage: { StorageKeys: {
1796
- CODE_VERIFIER: "pkce_code_verifier",
1797
- SEPARATOR: "#"
1798
- } }
1799
- };
1800
- var PKCEConstants_default = PKCEConstants;
1660
+ const VendorConstants = { VENDOR_PREFIX: "thunderid" };
1661
+ var VendorConstants_default = VendorConstants;
1801
1662
 
1802
1663
  //#endregion
1803
- //#region src/DefaultCacheStore.ts
1664
+ //#region src/constants/ConsentConstants.ts
1804
1665
  /**
1805
- * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
1666
+ * Constants describing why a set of consent decisions was submitted.
1806
1667
  *
1807
- * WSO2 LLC. licenses this file to you under the Apache License,
1808
- * Version 2.0 (the "License"); you may not use this file except
1809
- * in compliance with the License.
1810
- * You may obtain a copy of the License at
1811
- *
1812
- * http://www.apache.org/licenses/LICENSE-2.0
1668
+ * @remarks
1669
+ * The reason travels on `ConsentDecisions.reason` and explains a submission the server cannot infer
1670
+ * from the decisions alone. It is omitted when the user approves.
1813
1671
  *
1814
- * Unless required by applicable law or agreed to in writing,
1815
- * software distributed under the License is distributed on an
1816
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1817
- * KIND, either express or implied. See the License for the
1818
- * specific language governing permissions and limitations
1819
- * under the License.
1820
- */
1821
- var DefaultCacheStore = class {
1822
- cache;
1823
- constructor() {
1824
- this.cache = /* @__PURE__ */ new Map();
1825
- }
1826
- get length() {
1827
- return this.cache.size;
1828
- }
1829
- getItem(key) {
1830
- return this.cache.get(key) ?? null;
1831
- }
1832
- setItem(key, value) {
1833
- this.cache.set(key, value);
1834
- }
1835
- removeItem(key) {
1836
- this.cache.delete(key);
1837
- }
1838
- clear() {
1839
- this.cache.clear();
1840
- }
1841
- key(index) {
1842
- return Array.from(this.cache.keys())[index] ?? null;
1843
- }
1844
- async setData(key, value) {
1845
- this.cache.set(key, value);
1846
- }
1847
- async getData(key) {
1848
- return this.cache.get(key) ?? "{}";
1849
- }
1850
- async removeData(key) {
1851
- this.cache.delete(key);
1852
- }
1853
- };
1854
-
1855
- //#endregion
1856
- //#region src/DefaultCrypto.ts
1857
- /**
1858
- * Default implementation of the Crypto interface using the 'jose' library
1859
- * and the native Web Crypto API.
1672
+ * @example
1673
+ * ```typescript
1674
+ * const decisions: ConsentDecisions = {
1675
+ * approved: false,
1676
+ * reason: ConsentConstants.REASON_TIMEOUT,
1677
+ * purposes: [],
1678
+ * };
1679
+ * ```
1860
1680
  */
1861
- var DefaultCrypto = class {
1862
- base64URLDecode(value) {
1863
- const decodedArray = jose.base64url.decode(value);
1864
- return new TextDecoder().decode(decodedArray);
1865
- }
1866
- base64URLEncode(value) {
1867
- return jose.base64url.encode(value);
1868
- }
1869
- generateRandomBytes(length) {
1870
- return crypto.getRandomValues(new Uint8Array(length));
1871
- }
1872
- async hashSha256(data) {
1873
- const dataBuffer = new TextEncoder().encode(data);
1874
- const hashBuffer = await crypto.subtle.digest("SHA-256", dataBuffer);
1875
- return new Uint8Array(hashBuffer);
1876
- }
1877
- async verifyJwt(idToken, jwk, algorithms, clientId, issuer, subject, clockTolerance, validateJwtIssuer = true) {
1878
- const key = await jose.importJWK(jwk);
1879
- await jose.jwtVerify(idToken, key, {
1880
- algorithms,
1881
- audience: [clientId],
1882
- clockTolerance,
1883
- issuer: validateJwtIssuer ? issuer : void 0,
1884
- subject
1885
- });
1886
- return true;
1887
- }
1681
+ const ConsentConstants = {
1682
+ REASON_TIMEOUT: "timeout",
1683
+ REASON_USER_DENIED: "user_denied"
1888
1684
  };
1685
+ var ConsentConstants_default = ConsentConstants;
1889
1686
 
1890
1687
  //#endregion
1891
- //#region src/models/store.ts
1688
+ //#region src/errors/ThunderIDRuntimeError.ts
1892
1689
  /**
1893
- * Enum representing different types of data stores used in the application.
1690
+ * Base class for all runtime errors in ThunderID. This class extends ThunderIDError
1691
+ * and adds support for additional error details. Use this class for errors that occur
1692
+ * during runtime execution that are not related to API calls.
1693
+ *
1694
+ * @example
1695
+ * ```typescript
1696
+ * throw new ThunderIDRuntimeError(
1697
+ * "Failed to parse configuration",
1698
+ * "CONFIG_PARSE_ERROR",
1699
+ * { invalidField: "redirectUri" }
1700
+ * );
1701
+ * ```
1894
1702
  */
1895
- let Stores = /* @__PURE__ */ function(Stores$1) {
1896
- /**
1897
- * Store for configuration data that defines the application's behavior and settings.
1898
- */
1899
- Stores$1["ConfigData"] = "config_data";
1900
- /**
1901
- * Store for OpenID Connect provider metadata, including endpoints and configuration.
1902
- */
1903
- Stores$1["OIDCProviderMetaData"] = "oidc_provider_meta_data";
1904
- /**
1905
- * Store for persisted data that needs to be retained across sessions and application restarts.
1906
- */
1907
- Stores$1["PersistedData"] = "persisted_data";
1908
- /**
1909
- * Store for user session-related data like tokens and authentication state.
1910
- */
1911
- Stores$1["SessionData"] = "session_data";
1703
+ var ThunderIDRuntimeError = class extends ThunderIDError {
1912
1704
  /**
1913
- * Store for temporary data that needs to persist only for a short duration.
1705
+ * Creates an instance of ThunderIDRuntimeError.
1706
+ *
1707
+ * @param message - Human-readable description of the error
1708
+ * @param code - A unique error code that identifies the error type
1709
+ * @param details - Additional details about the error that might be helpful for debugging
1710
+ * @param origin - Optional. The SDK origin (e.g. 'react', 'vue'). Defaults to generic 'ThunderID'
1711
+ * @constructor
1914
1712
  */
1915
- Stores$1["TemporaryData"] = "temporary_data";
1713
+ constructor(message, code, origin, details) {
1714
+ super(message, code, origin);
1715
+ this.details = details;
1716
+ Object.defineProperty(this, "name", {
1717
+ configurable: true,
1718
+ value: "ThunderIDRuntimeError",
1719
+ writable: true
1720
+ });
1721
+ }
1916
1722
  /**
1917
- * Store for data that leverages local storage if available, falling back to the configured storage.
1723
+ * Returns a string representation of the runtime error
1724
+ * @returns Formatted error string with name, code, details, and message
1918
1725
  */
1919
- Stores$1["HybridData"] = "hybrid_data";
1920
- return Stores$1;
1921
- }({});
1726
+ toString() {
1727
+ const details = this.details ? `\nDetails: ${JSON.stringify(this.details, null, 2)}` : "";
1728
+ return `[${this.name}] (code="${this.code}")${details}\nMessage: ${this.message}`;
1729
+ }
1730
+ };
1922
1731
 
1923
1732
  //#endregion
1924
- //#region src/utils/logger.ts
1925
- const PREFIX = "⚡ ThunderID";
1926
- /**
1927
- * Default logger configuration
1928
- */
1929
- const DEFAULT_CONFIG$1 = {
1930
- level: "info",
1931
- prefix: `${PREFIX}`,
1932
- showLevel: true,
1933
- timestamps: true
1934
- };
1935
- /**
1936
- * Environment detection utilities
1937
- */
1938
- const isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
1939
- const isNode = () => typeof process !== "undefined" && process.versions && process.versions.node;
1940
- /**
1941
- * Color codes for terminal output (Node.js)
1942
- */
1943
- const COLORS = {
1944
- blue: "\x1B[34m",
1945
- bright: "\x1B[1m",
1946
- cyan: "\x1B[36m",
1947
- dim: "\x1B[2m",
1948
- gray: "\x1B[90m",
1949
- green: "\x1B[32m",
1950
- magenta: "\x1B[35m",
1951
- red: "\x1B[31m",
1952
- reset: "\x1B[0m",
1953
- white: "\x1B[37m",
1954
- yellow: "\x1B[33m"
1955
- };
1956
- /**
1957
- * Browser console styling
1958
- */
1959
- const BROWSER_STYLES = {
1960
- debug: "color: #6b7280; font-weight: normal;",
1961
- error: "color: #dc2626; font-weight: bold;",
1962
- info: "color: #2563eb; font-weight: bold;",
1963
- prefix: "color: #7c3aed; font-weight: bold;",
1964
- timestamp: "color: #6b7280; font-size: 0.9em;",
1965
- warn: "color: #d97706; font-weight: bold;"
1966
- };
1967
- const LOG_LEVEL_ORDER = {
1968
- debug: 0,
1969
- error: 3,
1970
- info: 1,
1971
- warn: 2
1972
- };
1733
+ //#region src/models/embedded-recovery-flow.ts
1973
1734
  /**
1974
- * Universal logger class that works in both browser and Node.js environments
1735
+ * Status enumeration for the embedded recovery flow operations.
1736
+ *
1737
+ * @experimental Part of the new ThunderID API
1975
1738
  */
1976
- var Logger = class Logger {
1977
- config;
1978
- constructor(config = {}) {
1979
- this.config = {
1980
- ...DEFAULT_CONFIG$1,
1981
- ...config
1982
- };
1983
- }
1984
- /**
1985
- * Update logger configuration
1986
- */
1987
- configure(config) {
1988
- this.config = {
1989
- ...this.config,
1990
- ...config
1991
- };
1992
- }
1739
+ let EmbeddedRecoveryFlowStatus = /* @__PURE__ */ function(EmbeddedRecoveryFlowStatus$1) {
1993
1740
  /**
1994
- * Get current configuration
1741
+ * Recovery flow completed successfully.
1995
1742
  */
1996
- getConfig() {
1997
- return { ...this.config };
1998
- }
1743
+ EmbeddedRecoveryFlowStatus$1["Complete"] = "COMPLETE";
1999
1744
  /**
2000
- * Check if a log level should be output
1745
+ * Recovery flow encountered an error and cannot proceed.
1746
+ *
1747
+ * @see {@link EmbeddedRecoveryFlowErrorResponse} for error response structure
2001
1748
  */
2002
- shouldLog(level) {
2003
- return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
2004
- }
1749
+ EmbeddedRecoveryFlowStatus$1["Error"] = "ERROR";
2005
1750
  /**
2006
- * Get timestamp string
1751
+ * Recovery flow requires additional user input.
2007
1752
  */
2008
- static getTimestamp() {
2009
- return (/* @__PURE__ */ new Date()).toISOString();
2010
- }
1753
+ EmbeddedRecoveryFlowStatus$1["Incomplete"] = "INCOMPLETE";
1754
+ return EmbeddedRecoveryFlowStatus$1;
1755
+ }({});
1756
+ /**
1757
+ * Type enumeration for embedded recovery flow responses.
1758
+ *
1759
+ * @experimental Part of the new ThunderID API
1760
+ */
1761
+ let EmbeddedRecoveryFlowType = /* @__PURE__ */ function(EmbeddedRecoveryFlowType$1) {
2011
1762
  /**
2012
- * Get log level string
1763
+ * Response requires external redirection.
2013
1764
  */
2014
- static getLevelString(level) {
2015
- switch (level) {
2016
- case "debug": return "DEBUG";
2017
- case "info": return "INFO";
2018
- case "warn": return "WARN";
2019
- case "error": return "ERROR";
2020
- default: return "UNKNOWN";
2021
- }
2022
- }
1765
+ EmbeddedRecoveryFlowType$1["Redirection"] = "REDIRECTION";
2023
1766
  /**
2024
- * Format message for Node.js terminal
1767
+ * Response contains view components for rendering.
2025
1768
  */
2026
- formatForNode(level, message) {
2027
- const parts = [];
2028
- if (this.config.timestamps) parts.push(`${COLORS.gray}[${Logger.getTimestamp()}]${COLORS.reset}`);
2029
- if (this.config.prefix) parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);
2030
- if (this.config.showLevel) {
2031
- const levelStr = Logger.getLevelString(level);
2032
- let coloredLevel;
2033
- switch (level) {
2034
- case "debug":
2035
- coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
2036
- break;
2037
- case "info":
2038
- coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
2039
- break;
2040
- case "warn":
2041
- coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
2042
- break;
2043
- case "error":
2044
- coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
2045
- break;
2046
- default: coloredLevel = `[${levelStr}]`;
2047
- }
2048
- parts.push(coloredLevel);
2049
- }
2050
- parts.push(message);
2051
- return parts.join(" ");
2052
- }
1769
+ EmbeddedRecoveryFlowType$1["View"] = "VIEW";
1770
+ return EmbeddedRecoveryFlowType$1;
1771
+ }({});
1772
+
1773
+ //#endregion
1774
+ //#region src/models/flow-meta.ts
1775
+ /**
1776
+ * The type of entity to retrieve flow metadata for.
1777
+ *
1778
+ * @example
1779
+ * ```typescript
1780
+ * const config: GetFlowMetaRequestConfig = {
1781
+ * baseUrl: 'https://localhost:8090',
1782
+ * type: FlowMetaType.App,
1783
+ * id: '60a9b38b-6eba-9f9e-55f9-267067de4680',
1784
+ * };
1785
+ * ```
1786
+ *
1787
+ * @experimental This API may change in future versions
1788
+ */
1789
+ let FlowMetaType = /* @__PURE__ */ function(FlowMetaType$1) {
1790
+ /** Retrieve metadata scoped to a specific application */
1791
+ FlowMetaType$1["App"] = "APP";
1792
+ /** Retrieve metadata scoped to a specific organization unit */
1793
+ FlowMetaType$1["Ou"] = "OU";
1794
+ return FlowMetaType$1;
1795
+ }({});
1796
+
1797
+ //#endregion
1798
+ //#region src/models/flow.ts
1799
+ let FlowMode = /* @__PURE__ */ function(FlowMode$1) {
2053
1800
  /**
2054
- * Log message using appropriate method
1801
+ * This mode is suitable for embedded sign-in, sign-up, etc. flows where the authentication
1802
+ * UIs are rendered within the application.
2055
1803
  */
2056
- logMessage(level, message, ...args) {
2057
- if (!this.shouldLog(level)) return;
2058
- if (this.config.formatter) {
2059
- this.config.formatter(level, message, ...args);
2060
- return;
2061
- }
2062
- if (isBrowser()) this.logToBrowser(level, message, ...args);
2063
- else if (isNode()) this.logToNode(level, message, ...args);
2064
- else console.log(message, ...args);
2065
- }
1804
+ FlowMode$1["Embedded"] = "DIRECT";
2066
1805
  /**
2067
- * Log to browser console with styling
1806
+ * Traditional redirect based sign-in, sign-up, etc. flows where the authentication
1807
+ * UIs are from a external Identity Provider (ex: ThunderID).
2068
1808
  */
2069
- logToBrowser(level, message, ...args) {
2070
- const parts = [];
2071
- const styles = [];
2072
- if (this.config.timestamps) {
2073
- parts.push(`%c[${Logger.getTimestamp()}]`);
2074
- styles.push(BROWSER_STYLES.timestamp);
2075
- }
2076
- if (this.config.prefix) {
2077
- parts.push(`%c${this.config.prefix}`);
2078
- styles.push(BROWSER_STYLES.prefix);
2079
- }
2080
- if (this.config.showLevel) {
2081
- const levelStr = Logger.getLevelString(level);
2082
- parts.push(`%c[${levelStr}]`);
2083
- switch (level) {
2084
- case "debug":
2085
- styles.push(BROWSER_STYLES.debug);
2086
- break;
2087
- case "info":
2088
- styles.push(BROWSER_STYLES.info);
2089
- break;
2090
- case "warn":
2091
- styles.push(BROWSER_STYLES.warn);
2092
- break;
2093
- case "error":
2094
- styles.push(BROWSER_STYLES.error);
2095
- break;
2096
- default: styles.push("");
2097
- }
2098
- }
2099
- parts.push(`%c${message}`);
2100
- styles.push("color: inherit; font-weight: normal;");
2101
- const formattedMessage = parts.join(" ");
2102
- switch (level) {
2103
- case "debug":
2104
- console.debug(formattedMessage, ...styles, ...args);
2105
- break;
2106
- case "info":
2107
- console.info(formattedMessage, ...styles, ...args);
2108
- break;
2109
- case "warn":
2110
- console.warn(formattedMessage, ...styles, ...args);
2111
- break;
2112
- case "error":
2113
- console.error(formattedMessage, ...styles, ...args);
2114
- break;
2115
- default: console.log(formattedMessage, ...styles, ...args);
2116
- }
1809
+ FlowMode$1["Redirect"] = "REDIRECTION";
1810
+ return FlowMode$1;
1811
+ }({});
1812
+
1813
+ //#endregion
1814
+ //#region src/models/field.ts
1815
+ let FieldType = /* @__PURE__ */ function(FieldType$1) {
1816
+ FieldType$1["Checkbox"] = "CHECKBOX";
1817
+ FieldType$1["Date"] = "DATE";
1818
+ FieldType$1["Email"] = "EMAIL";
1819
+ FieldType$1["Number"] = "NUMBER";
1820
+ FieldType$1["Otp"] = "OTP";
1821
+ FieldType$1["Password"] = "PASSWORD";
1822
+ FieldType$1["Radio"] = "RADIO";
1823
+ FieldType$1["Select"] = "SELECT";
1824
+ FieldType$1["Tel"] = "TEL";
1825
+ FieldType$1["Text"] = "TEXT";
1826
+ FieldType$1["Textarea"] = "TEXTAREA";
1827
+ FieldType$1["Time"] = "TIME";
1828
+ return FieldType$1;
1829
+ }({});
1830
+
1831
+ //#endregion
1832
+ //#region src/constants/OIDCDiscoveryConstants.ts
1833
+ /**
1834
+ * Constants related to OpenID Connect (OIDC) metadata and endpoints.
1835
+ * This object contains all the standard OIDC endpoints and storage keys
1836
+ * used throughout the application for authentication and authorization.
1837
+ *
1838
+ * @remarks
1839
+ * The constants are organized into two main sections:
1840
+ * 1. Endpoints - Contains all OIDC standard endpoint paths
1841
+ * 2. Storage - Contains keys used for storing OIDC-related data
1842
+ *
1843
+ * @example
1844
+ * ```typescript
1845
+ * // Using an endpoint
1846
+ * const authEndpoint = OIDCDiscoveryConstants.Endpoints.AUTHORIZATION;
1847
+ *
1848
+ * // Using a storage key
1849
+ * const tokenKey = OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.TOKEN;
1850
+ * ```
1851
+ */
1852
+ const OIDCDiscoveryConstants = {
1853
+ Endpoints: {
1854
+ AUTHORIZATION: "/oauth2/authorize",
1855
+ END_SESSION: "/oauth2/logout",
1856
+ ISSUER: "/oauth2/token",
1857
+ JWKS: "/oauth2/jwks",
1858
+ REVOCATION: "/oauth2/revoke",
1859
+ SESSION_IFRAME: "/oidc/checksession",
1860
+ TOKEN: "/oauth2/token",
1861
+ USERINFO: "/oauth2/userinfo"
1862
+ },
1863
+ Storage: { StorageKeys: {
1864
+ Endpoints: {
1865
+ AUTHORIZATION: "authorization_endpoint",
1866
+ END_SESSION: "end_session_endpoint",
1867
+ ISSUER: "issuer",
1868
+ JWKS: "jwks_uri",
1869
+ REVOCATION: "revocation_endpoint",
1870
+ SESSION_IFRAME: "check_session_iframe",
1871
+ TOKEN: "token_endpoint",
1872
+ USERINFO: "userinfo_endpoint"
1873
+ },
1874
+ OPENID_PROVIDER_CONFIG_INITIATED: "op_config_initiated"
1875
+ } }
1876
+ };
1877
+ var OIDCDiscoveryConstants_default = OIDCDiscoveryConstants;
1878
+
1879
+ //#endregion
1880
+ //#region src/constants/PKCEConstants.ts
1881
+ /**
1882
+ * Constants related to Proof Key for Code Exchange (PKCE) implementation.
1883
+ * This object contains all the necessary constants for implementing PKCE
1884
+ * flow in the OAuth 2.0 authorization code grant.
1885
+ *
1886
+ * @remarks
1887
+ * PKCE is an extension to the authorization code flow to prevent CSRF and
1888
+ * authorization code injection attacks. The constants are organized into
1889
+ * storage-related sections for managing PKCE state.
1890
+ *
1891
+ * @example
1892
+ * ```typescript
1893
+ * // Using storage keys
1894
+ * const codeVerifierKey = PKCEConstants.Storage.StorageKeys.CODE_VERIFIER;
1895
+ * const separator = PKCEConstants.Storage.StorageKeys.SEPARATOR;
1896
+ * ```
1897
+ */
1898
+ const PKCEConstants = {
1899
+ DEFAULT_CODE_CHALLENGE_METHOD: "S256",
1900
+ Storage: { StorageKeys: {
1901
+ CODE_VERIFIER: "pkce_code_verifier",
1902
+ SEPARATOR: "#"
1903
+ } }
1904
+ };
1905
+ var PKCEConstants_default = PKCEConstants;
1906
+
1907
+ //#endregion
1908
+ //#region src/DefaultCacheStore.ts
1909
+ var DefaultCacheStore = class {
1910
+ cache;
1911
+ constructor() {
1912
+ this.cache = /* @__PURE__ */ new Map();
2117
1913
  }
2118
- /**
2119
- * Log to Node.js console
2120
- */
2121
- logToNode(level, message, ...args) {
2122
- const formattedMessage = this.formatForNode(level, message);
2123
- switch (level) {
2124
- case "debug":
2125
- console.debug(formattedMessage, ...args);
2126
- break;
2127
- case "info":
2128
- console.info(formattedMessage, ...args);
2129
- break;
2130
- case "warn":
2131
- console.warn(formattedMessage, ...args);
2132
- break;
2133
- case "error":
2134
- console.error(formattedMessage, ...args);
2135
- break;
2136
- default: console.log(formattedMessage, ...args);
2137
- }
1914
+ get length() {
1915
+ return this.cache.size;
2138
1916
  }
2139
- /**
2140
- * Log debug message
2141
- */
2142
- debug(message, ...args) {
2143
- this.logMessage("debug", message, ...args);
1917
+ getItem(key) {
1918
+ return this.cache.get(key) ?? null;
1919
+ }
1920
+ setItem(key, value) {
1921
+ this.cache.set(key, value);
1922
+ }
1923
+ removeItem(key) {
1924
+ this.cache.delete(key);
1925
+ }
1926
+ clear() {
1927
+ this.cache.clear();
1928
+ }
1929
+ key(index) {
1930
+ return Array.from(this.cache.keys())[index] ?? null;
1931
+ }
1932
+ async setData(key, value) {
1933
+ this.cache.set(key, value);
1934
+ }
1935
+ async getData(key) {
1936
+ return this.cache.get(key) ?? "{}";
1937
+ }
1938
+ async removeData(key) {
1939
+ this.cache.delete(key);
1940
+ }
1941
+ };
1942
+
1943
+ //#endregion
1944
+ //#region src/DefaultCrypto.ts
1945
+ /**
1946
+ * Default implementation of the Crypto interface using the 'jose' library
1947
+ * and the native Web Crypto API.
1948
+ */
1949
+ var DefaultCrypto = class {
1950
+ base64URLDecode(value) {
1951
+ const decodedArray = jose.base64url.decode(value);
1952
+ return new TextDecoder().decode(decodedArray);
1953
+ }
1954
+ base64URLEncode(value) {
1955
+ return jose.base64url.encode(value);
1956
+ }
1957
+ generateRandomBytes(length) {
1958
+ return crypto.getRandomValues(new Uint8Array(length));
1959
+ }
1960
+ async hashSha256(data) {
1961
+ const dataBuffer = new TextEncoder().encode(data);
1962
+ const hashBuffer = await crypto.subtle.digest("SHA-256", dataBuffer);
1963
+ return new Uint8Array(hashBuffer);
1964
+ }
1965
+ async verifyJwt(idToken, jwk, algorithms, clientId, issuer, subject, clockTolerance, validateJwtIssuer = true) {
1966
+ const key = await jose.importJWK(jwk);
1967
+ await jose.jwtVerify(idToken, key, {
1968
+ algorithms,
1969
+ audience: [clientId],
1970
+ clockTolerance,
1971
+ issuer: validateJwtIssuer ? issuer : void 0,
1972
+ subject
1973
+ });
1974
+ return true;
2144
1975
  }
1976
+ };
1977
+
1978
+ //#endregion
1979
+ //#region src/models/store.ts
1980
+ /**
1981
+ * Enum representing different types of data stores used in the application.
1982
+ */
1983
+ let Stores = /* @__PURE__ */ function(Stores$1) {
2145
1984
  /**
2146
- * Log info message
1985
+ * Store for configuration data that defines the application's behavior and settings.
2147
1986
  */
2148
- info(message, ...args) {
2149
- this.logMessage("info", message, ...args);
2150
- }
1987
+ Stores$1["ConfigData"] = "config_data";
2151
1988
  /**
2152
- * Log warning message
1989
+ * Store for OpenID Connect provider metadata, including endpoints and configuration.
2153
1990
  */
2154
- warn(message, ...args) {
2155
- this.logMessage("warn", message, ...args);
2156
- }
1991
+ Stores$1["OIDCProviderMetaData"] = "oidc_provider_meta_data";
2157
1992
  /**
2158
- * Log error message
1993
+ * Store for persisted data that needs to be retained across sessions and application restarts.
2159
1994
  */
2160
- error(message, ...args) {
2161
- this.logMessage("error", message, ...args);
2162
- }
1995
+ Stores$1["PersistedData"] = "persisted_data";
2163
1996
  /**
2164
- * Create a child logger with additional prefix
1997
+ * Store for user session-related data like tokens and authentication state.
2165
1998
  */
2166
- child(prefix) {
2167
- const childPrefix = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;
2168
- return new Logger({
2169
- ...this.config,
2170
- prefix: childPrefix
2171
- });
2172
- }
1999
+ Stores$1["SessionData"] = "session_data";
2173
2000
  /**
2174
- * Set log level
2001
+ * Store for temporary data that needs to persist only for a short duration.
2175
2002
  */
2176
- setLevel(level) {
2177
- this.config.level = level;
2178
- }
2003
+ Stores$1["TemporaryData"] = "temporary_data";
2179
2004
  /**
2180
- * Get current log level
2005
+ * Store for data that leverages local storage if available, falling back to the configured storage.
2181
2006
  */
2182
- getLevel() {
2183
- return this.config.level;
2184
- }
2185
- };
2186
- /**
2187
- * Default logger instance
2188
- */
2189
- const logger = new Logger();
2190
- /**
2191
- * Create a new logger instance with custom configuration
2192
- */
2193
- const createLogger = (config) => new Logger(config);
2194
- /**
2195
- * Default export - global logger instance
2196
- */
2197
- var logger_default = logger;
2198
- /**
2199
- * Named exports for convenience
2200
- */
2201
- const debug = (message, ...args) => logger.debug(message, ...args);
2202
- const info = (message, ...args) => logger.info(message, ...args);
2203
- const warn = (message, ...args) => logger.warn(message, ...args);
2204
- const error = (message, ...args) => logger.error(message, ...args);
2205
- /**
2206
- * Configure the default logger
2207
- */
2208
- const configure = (config) => logger.configure(config);
2209
- /**
2210
- * Create component-specific loggers
2211
- */
2212
- const createComponentLogger = (component) => logger.child(component);
2213
- /**
2214
- * Create package-specific logger
2215
- */
2216
- const createPackageLogger = (packageName) => createLogger({
2217
- level: "info",
2218
- prefix: `${PREFIX} - ${packageName}`,
2219
- showLevel: true,
2220
- timestamps: true
2221
- });
2222
- /**
2223
- * Create package component logger (package + component)
2224
- */
2225
- const createPackageComponentLogger = (packageName, component) => {
2226
- return createPackageLogger(packageName).child(component);
2227
- };
2007
+ Stores$1["HybridData"] = "hybrid_data";
2008
+ return Stores$1;
2009
+ }({});
2228
2010
 
2229
2011
  //#endregion
2230
2012
  //#region src/StorageManager.ts
@@ -2585,23 +2367,6 @@ var resolveResourceEndpoint_default = resolveResourceEndpoint;
2585
2367
  //#endregion
2586
2368
  //#region src/constants/TokenExchangeConstants.ts
2587
2369
  /**
2588
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
2589
- *
2590
- * WSO2 LLC. licenses this file to you under the Apache License,
2591
- * Version 2.0 (the "License"); you may not use this file except
2592
- * in compliance with the License.
2593
- * You may obtain a copy of the License at
2594
- *
2595
- * http://www.apache.org/licenses/LICENSE-2.0
2596
- *
2597
- * Unless required by applicable law or agreed to in writing,
2598
- * software distributed under the License is distributed on an
2599
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
2600
- * KIND, either express or implied. See the License for the
2601
- * specific language governing permissions and limitations
2602
- * under the License.
2603
- */
2604
- /**
2605
2370
  * Constants for OAuth 2.0 Token Exchange operations.
2606
2371
  * This object contains placeholders used in token exchange requests
2607
2372
  * and responses for dynamic value substitution.
@@ -2876,23 +2641,6 @@ var base64Encode_default = base64Encode;
2876
2641
  //#endregion
2877
2642
  //#region src/utils/deepMerge.ts
2878
2643
  /**
2879
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
2880
- *
2881
- * WSO2 LLC. licenses this file to you under the Apache License,
2882
- * Version 2.0 (the "License"); you may not use this file except
2883
- * in compliance with the License.
2884
- * You may obtain a copy of the License at
2885
- *
2886
- * http://www.apache.org/licenses/LICENSE-2.0
2887
- *
2888
- * Unless required by applicable law or agreed to in writing,
2889
- * software distributed under the License is distributed on an
2890
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
2891
- * KIND, either express or implied. See the License for the
2892
- * specific language governing permissions and limitations
2893
- * under the License.
2894
- */
2895
- /**
2896
2644
  * Checks if a value is a plain object (not an array, function, date, etc.)
2897
2645
  *
2898
2646
  * @param value - The value to check
@@ -4116,23 +3864,6 @@ var createTheme_default = createTheme;
4116
3864
  //#endregion
4117
3865
  //#region src/utils/arrayBufferToBase64url.ts
4118
3866
  /**
4119
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4120
- *
4121
- * WSO2 LLC. licenses this file to you under the Apache License,
4122
- * Version 2.0 (the "License"); you may not use this file except
4123
- * in compliance with the License.
4124
- * You may obtain a copy of the License at
4125
- *
4126
- * http://www.apache.org/licenses/LICENSE-2.0
4127
- *
4128
- * Unless required by applicable law or agreed to in writing,
4129
- * software distributed under the License is distributed on an
4130
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4131
- * KIND, either express or implied. See the License for the
4132
- * specific language governing permissions and limitations
4133
- * under the License.
4134
- */
4135
- /**
4136
3867
  * Converts an ArrayBuffer to a base64url encoded string.
4137
3868
  *
4138
3869
  * Base64url encoding is a URL-safe variant of base64 encoding that:
@@ -4172,23 +3903,6 @@ var arrayBufferToBase64url_default = arrayBufferToBase64url;
4172
3903
  //#endregion
4173
3904
  //#region src/utils/base64urlToArrayBuffer.ts
4174
3905
  /**
4175
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4176
- *
4177
- * WSO2 LLC. licenses this file to you under the Apache License,
4178
- * Version 2.0 (the "License"); you may not use this file except
4179
- * in compliance with the License.
4180
- * You may obtain a copy of the License at
4181
- *
4182
- * http://www.apache.org/licenses/LICENSE-2.0
4183
- *
4184
- * Unless required by applicable law or agreed to in writing,
4185
- * software distributed under the License is distributed on an
4186
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4187
- * KIND, either express or implied. See the License for the
4188
- * specific language governing permissions and limitations
4189
- * under the License.
4190
- */
4191
- /**
4192
3906
  * Converts a base64url encoded string back to an ArrayBuffer.
4193
3907
  *
4194
3908
  * This function performs the inverse operation of base64url encoding by:
@@ -4237,23 +3951,6 @@ var base64urlToArrayBuffer_default = base64urlToArrayBuffer;
4237
3951
  //#endregion
4238
3952
  //#region src/utils/bem.ts
4239
3953
  /**
4240
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4241
- *
4242
- * WSO2 LLC. licenses this file to you under the Apache License,
4243
- * Version 2.0 (the "License"); you may not use this file except
4244
- * in compliance with the License.
4245
- * You may obtain a copy of the License at
4246
- *
4247
- * http://www.apache.org/licenses/LICENSE-2.0
4248
- *
4249
- * Unless required by applicable law or agreed to in writing,
4250
- * software distributed under the License is distributed on an
4251
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4252
- * KIND, either express or implied. See the License for the
4253
- * specific language governing permissions and limitations
4254
- * under the License.
4255
- */
4256
- /**
4257
3954
  * Creates a BEM-style class name by combining a base class with element and/or modifier
4258
3955
  *
4259
3956
  * @param baseClass - The base CSS class string (usually from emotion's css function)
@@ -4291,23 +3988,6 @@ var bem_default = bem;
4291
3988
  //#endregion
4292
3989
  //#region src/utils/formatDate.ts
4293
3990
  /**
4294
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4295
- *
4296
- * WSO2 LLC. licenses this file to you under the Apache License,
4297
- * Version 2.0 (the "License"); you may not use this file except
4298
- * in compliance with the License.
4299
- * You may obtain a copy of the License at
4300
- *
4301
- * http://www.apache.org/licenses/LICENSE-2.0
4302
- *
4303
- * Unless required by applicable law or agreed to in writing,
4304
- * software distributed under the License is distributed on an
4305
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4306
- * KIND, either express or implied. See the License for the
4307
- * specific language governing permissions and limitations
4308
- * under the License.
4309
- */
4310
- /**
4311
3991
  * Formats a date string to a human-readable format.
4312
3992
  *
4313
3993
  * @param dateString - The date string to format (optional)
@@ -4458,23 +4138,6 @@ var getRedirectBasedSignUpUrl_default = getRedirectBasedSignUpUrl;
4458
4138
  //#endregion
4459
4139
  //#region src/utils/isEmpty.ts
4460
4140
  /**
4461
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4462
- *
4463
- * WSO2 LLC. licenses this file to you under the Apache License,
4464
- * Version 2.0 (the "License"); you may not use this file except
4465
- * in compliance with the License.
4466
- * You may obtain a copy of the License at
4467
- *
4468
- * http://www.apache.org/licenses/LICENSE-2.0
4469
- *
4470
- * Unless required by applicable law or agreed to in writing,
4471
- * software distributed under the License is distributed on an
4472
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4473
- * KIND, either express or implied. See the License for the
4474
- * specific language governing permissions and limitations
4475
- * under the License.
4476
- */
4477
- /**
4478
4141
  * Checks if a value is considered empty.
4479
4142
  *
4480
4143
  * A value is considered empty if it is:
@@ -4514,23 +4177,6 @@ var isEmpty_default = isEmpty;
4514
4177
 
4515
4178
  //#endregion
4516
4179
  //#region src/utils/isEmojiUri.ts
4517
- /**
4518
- * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
4519
- *
4520
- * WSO2 LLC. licenses this file to you under the Apache License,
4521
- * Version 2.0 (the "License"); you may not use this file except
4522
- * in compliance with the License.
4523
- * You may obtain a copy of the License at
4524
- *
4525
- * http://www.apache.org/licenses/LICENSE-2.0
4526
- *
4527
- * Unless required by applicable law or agreed to in writing,
4528
- * software distributed under the License is distributed on an
4529
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4530
- * KIND, either express or implied. See the License for the
4531
- * specific language governing permissions and limitations
4532
- * under the License.
4533
- */
4534
4180
  const EMOJI_URI_SCHEME = "emoji:";
4535
4181
  /**
4536
4182
  * Checks whether a given URI uses the `emoji:` scheme (e.g. `"emoji:🐯"`).
@@ -4571,23 +4217,6 @@ var extractEmojiFromUri_default = extractEmojiFromUri;
4571
4217
  //#endregion
4572
4218
  //#region src/utils/set.ts
4573
4219
  /**
4574
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4575
- *
4576
- * WSO2 LLC. licenses this file to you under the Apache License,
4577
- * Version 2.0 (the "License"); you may not use this file except
4578
- * in compliance with the License.
4579
- * You may obtain a copy of the License at
4580
- *
4581
- * http://www.apache.org/licenses/LICENSE-2.0
4582
- *
4583
- * Unless required by applicable law or agreed to in writing,
4584
- * software distributed under the License is distributed on an
4585
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4586
- * KIND, either express or implied. See the License for the
4587
- * specific language governing permissions and limitations
4588
- * under the License.
4589
- */
4590
- /**
4591
4220
  * Sets the value at path of object. If a portion of path doesn't exist,
4592
4221
  * it's created. Arrays are created for missing index properties while
4593
4222
  * objects are created for all other missing properties.
@@ -4617,23 +4246,6 @@ var set_default = set;
4617
4246
  //#endregion
4618
4247
  //#region src/utils/get.ts
4619
4248
  /**
4620
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4621
- *
4622
- * WSO2 LLC. licenses this file to you under the Apache License,
4623
- * Version 2.0 (the "License"); you may not use this file except
4624
- * in compliance with the License.
4625
- * You may obtain a copy of the License at
4626
- *
4627
- * http://www.apache.org/licenses/LICENSE-2.0
4628
- *
4629
- * Unless required by applicable law or agreed to in writing,
4630
- * software distributed under the License is distributed on an
4631
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4632
- * KIND, either express or implied. See the License for the
4633
- * specific language governing permissions and limitations
4634
- * under the License.
4635
- */
4636
- /**
4637
4249
  * Gets the value at path of object. If the resolved value is undefined,
4638
4250
  * the defaultValue is returned in its place.
4639
4251
  * Similar to Lodash's get() function
@@ -4653,23 +4265,6 @@ var get_default = get;
4653
4265
  //#endregion
4654
4266
  //#region src/utils/startCase.ts
4655
4267
  /**
4656
- * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
4657
- *
4658
- * WSO2 LLC. licenses this file to you under the Apache License,
4659
- * Version 2.0 (the "License"); you may not use this file except
4660
- * in compliance with the License.
4661
- * You may obtain a copy of the License at
4662
- *
4663
- * http://www.apache.org/licenses/LICENSE-2.0
4664
- *
4665
- * Unless required by applicable law or agreed to in writing,
4666
- * software distributed under the License is distributed on an
4667
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4668
- * KIND, either express or implied. See the License for the
4669
- * specific language governing permissions and limitations
4670
- * under the License.
4671
- */
4672
- /**
4673
4268
  * Converts the first character of `string` to upper case.
4674
4269
  *
4675
4270
  * @param string - The string to convert.
@@ -4694,23 +4289,6 @@ var startCase_default = startCase;
4694
4289
  //#endregion
4695
4290
  //#region src/utils/removeTrailingSlash.ts
4696
4291
  /**
4697
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4698
- *
4699
- * WSO2 LLC. licenses this file to you under the Apache License,
4700
- * Version 2.0 (the "License"); you may not use this file except
4701
- * in compliance with the License.
4702
- * You may obtain a copy of the License at
4703
- *
4704
- * http://www.apache.org/licenses/LICENSE-2.0
4705
- *
4706
- * Unless required by applicable law or agreed to in writing,
4707
- * software distributed under the License is distributed on an
4708
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4709
- * KIND, either express or implied. See the License for the
4710
- * specific language governing permissions and limitations
4711
- * under the License.
4712
- */
4713
- /**
4714
4292
  * Removes a trailing slash from a path string if it exists.
4715
4293
  *
4716
4294
  * @param path - The string path to process
@@ -4763,23 +4341,6 @@ function resolveMeta(path, meta) {
4763
4341
  //#endregion
4764
4342
  //#region src/utils/parseFlowTemplateLiteral.ts
4765
4343
  /**
4766
- * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
4767
- *
4768
- * WSO2 LLC. licenses this file to you under the Apache License,
4769
- * Version 2.0 (the "License"); you may not use this file except
4770
- * in compliance with the License.
4771
- * You may obtain a copy of the License at
4772
- *
4773
- * http://www.apache.org/licenses/LICENSE-2.0
4774
- *
4775
- * Unless required by applicable law or agreed to in writing,
4776
- * software distributed under the License is distributed on an
4777
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4778
- * KIND, either express or implied. See the License for the
4779
- * specific language governing permissions and limitations
4780
- * under the License.
4781
- */
4782
- /**
4783
4344
  * Regular expression to detect a flow template literal wrapped in double braces.
4784
4345
  * Matches patterns like `{{ t(key) }}`, `{{ meta(key) }}`, etc.
4785
4346
  *
@@ -4896,23 +4457,6 @@ function resolveFlowTemplateLiterals(text, { t, meta }) {
4896
4457
  //#endregion
4897
4458
  //#region src/utils/countryCodeToFlagEmoji.ts
4898
4459
  /**
4899
- * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
4900
- *
4901
- * WSO2 LLC. licenses this file to you under the Apache License,
4902
- * Version 2.0 (the "License"); you may not use this file except
4903
- * in compliance with the License.
4904
- * You may obtain a copy of the License at
4905
- *
4906
- * http://www.apache.org/licenses/LICENSE-2.0
4907
- *
4908
- * Unless required by applicable law or agreed to in writing,
4909
- * software distributed under the License is distributed on an
4910
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4911
- * KIND, either express or implied. See the License for the
4912
- * specific language governing permissions and limitations
4913
- * under the License.
4914
- */
4915
- /**
4916
4460
  * Converts a two-letter ISO 3166-1 alpha-2 country code to a flag emoji using
4917
4461
  * Unicode Regional Indicator Symbols (U+1F1E6–U+1F1FF).
4918
4462
  *
@@ -4926,23 +4470,6 @@ function countryCodeToFlagEmoji(countryCode) {
4926
4470
  //#endregion
4927
4471
  //#region src/utils/resolveLocaleDisplayName.ts
4928
4472
  /**
4929
- * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
4930
- *
4931
- * WSO2 LLC. licenses this file to you under the Apache License,
4932
- * Version 2.0 (the "License"); you may not use this file except
4933
- * in compliance with the License.
4934
- * You may obtain a copy of the License at
4935
- *
4936
- * http://www.apache.org/licenses/LICENSE-2.0
4937
- *
4938
- * Unless required by applicable law or agreed to in writing,
4939
- * software distributed under the License is distributed on an
4940
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4941
- * KIND, either express or implied. See the License for the
4942
- * specific language governing permissions and limitations
4943
- * under the License.
4944
- */
4945
- /**
4946
4473
  * Resolves a BCP 47 locale tag to a human-readable display name using the
4947
4474
  * `Intl.DisplayNames` API.
4948
4475
  *
@@ -5114,7 +4641,7 @@ var buildValidatorFromRules_default = buildValidatorFromRules;
5114
4641
  * ```typescript
5115
4642
  * // Usage with clsx
5116
4643
  * clsx(withVendorCSSClassPrefix('sign-in-button'), className)
5117
- * // Result: "wso2-sign-in-button"
4644
+ * // Result: "thunderid-sign-in-button"
5118
4645
  * ```
5119
4646
  */
5120
4647
  const withVendorCSSClassPrefix = (className) => `${VendorConstants_default.VENDOR_PREFIX}-${className}`;
@@ -6224,6 +5751,7 @@ var normalizeTranslations_default = normalizeTranslations;
6224
5751
  //#endregion
6225
5752
  exports.ApplicationNativeAuthenticationConstants = ApplicationNativeAuthenticationConstants_default;
6226
5753
  exports.AuthenticationHelper = AuthenticationHelper_default;
5754
+ exports.ConsentConstants = ConsentConstants_default;
6227
5755
  exports.DEFAULT_THEME = DEFAULT_THEME;
6228
5756
  exports.DEFAULT_VALIDATION_MESSAGE_KEYS = DEFAULT_VALIDATION_MESSAGE_KEYS;
6229
5757
  exports.EMOJI_URI_SCHEME = EMOJI_URI_SCHEME;