@thunderid/react 0.4.0 → 0.6.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 (96) hide show
  1. package/dist/cjs/components/auth/Callback/OAuthCallback.cjs +10 -4
  2. package/dist/cjs/components/auth/Callback/OAuthCallback.cjs.map +1 -1
  3. package/dist/cjs/components/auth/Callback/TokenCallback.cjs +8 -7
  4. package/dist/cjs/components/auth/Callback/TokenCallback.cjs.map +1 -1
  5. package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs +13 -4
  6. package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs.map +1 -1
  7. package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +52 -9
  8. package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
  9. package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs +11 -1
  10. package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs.map +1 -1
  11. package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs +18 -14
  12. package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs.map +1 -1
  13. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs +35 -9
  14. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs.map +1 -1
  15. package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs +7 -6
  16. package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs.map +1 -1
  17. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs +16 -13
  18. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -1
  19. package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs +88 -0
  20. package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs.map +1 -0
  21. package/dist/cjs/components/primitives/AffixedField/AffixedField.styles.cjs +130 -0
  22. package/dist/cjs/components/primitives/AffixedField/AffixedField.styles.cjs.map +1 -0
  23. package/dist/cjs/contexts/ComponentRenderer/ComponentRendererContext.cjs.map +1 -1
  24. package/dist/cjs/contexts/I18n/I18nProvider.cjs +2 -3
  25. package/dist/cjs/contexts/I18n/I18nProvider.cjs.map +1 -1
  26. package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs +4 -1
  27. package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs.map +1 -1
  28. package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs +5 -2
  29. package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
  30. package/dist/cjs/utils/composeAffixedInputs.cjs +74 -0
  31. package/dist/cjs/utils/composeAffixedInputs.cjs.map +1 -0
  32. package/dist/cjs/utils/oauth.cjs +3 -2
  33. package/dist/cjs/utils/oauth.cjs.map +1 -1
  34. package/dist/components/auth/Callback/OAuthCallback.d.ts.map +1 -1
  35. package/dist/components/auth/Callback/OAuthCallback.js +12 -6
  36. package/dist/components/auth/Callback/OAuthCallback.js.map +1 -1
  37. package/dist/components/auth/Callback/TokenCallback.d.ts.map +1 -1
  38. package/dist/components/auth/Callback/TokenCallback.js +8 -7
  39. package/dist/components/auth/Callback/TokenCallback.js.map +1 -1
  40. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.d.ts.map +1 -1
  41. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js +13 -4
  42. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js.map +1 -1
  43. package/dist/components/presentation/auth/AuthOptionFactory.d.ts +12 -4
  44. package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
  45. package/dist/components/presentation/auth/AuthOptionFactory.js +52 -9
  46. package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
  47. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.d.ts.map +1 -1
  48. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js +11 -1
  49. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js.map +1 -1
  50. package/dist/components/presentation/auth/Recovery/BaseRecovery.d.ts.map +1 -1
  51. package/dist/components/presentation/auth/Recovery/BaseRecovery.js +19 -15
  52. package/dist/components/presentation/auth/Recovery/BaseRecovery.js.map +1 -1
  53. package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts.map +1 -1
  54. package/dist/components/presentation/auth/SignIn/BaseSignIn.js +37 -11
  55. package/dist/components/presentation/auth/SignIn/BaseSignIn.js.map +1 -1
  56. package/dist/components/presentation/auth/SignIn/SignIn.d.ts.map +1 -1
  57. package/dist/components/presentation/auth/SignIn/SignIn.js +7 -6
  58. package/dist/components/presentation/auth/SignIn/SignIn.js.map +1 -1
  59. package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts.map +1 -1
  60. package/dist/components/presentation/auth/SignUp/BaseSignUp.js +16 -13
  61. package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -1
  62. package/dist/components/primitives/AffixedField/AffixedField.d.ts +52 -0
  63. package/dist/components/primitives/AffixedField/AffixedField.d.ts.map +1 -0
  64. package/dist/components/primitives/AffixedField/AffixedField.js +83 -0
  65. package/dist/components/primitives/AffixedField/AffixedField.js.map +1 -0
  66. package/dist/components/primitives/AffixedField/AffixedField.styles.d.ts +25 -0
  67. package/dist/components/primitives/AffixedField/AffixedField.styles.d.ts.map +1 -0
  68. package/dist/components/primitives/AffixedField/AffixedField.styles.js +127 -0
  69. package/dist/components/primitives/AffixedField/AffixedField.styles.js.map +1 -0
  70. package/dist/components/primitives/AffixedField/index.d.ts +20 -0
  71. package/dist/components/primitives/AffixedField/index.d.ts.map +1 -0
  72. package/dist/components/primitives/Dialog/Dialog.js +3 -3
  73. package/dist/components/primitives/Dialog/Dialog.js.map +1 -1
  74. package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts +1 -0
  75. package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts.map +1 -1
  76. package/dist/contexts/ComponentRenderer/ComponentRendererContext.js.map +1 -1
  77. package/dist/contexts/I18n/I18nProvider.d.ts +6 -0
  78. package/dist/contexts/I18n/I18nProvider.d.ts.map +1 -1
  79. package/dist/contexts/I18n/I18nProvider.js +3 -4
  80. package/dist/contexts/I18n/I18nProvider.js.map +1 -1
  81. package/dist/contexts/ThunderID/ThunderIDContext.d.ts +5 -0
  82. package/dist/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -1
  83. package/dist/contexts/ThunderID/ThunderIDContext.js +3 -1
  84. package/dist/contexts/ThunderID/ThunderIDContext.js.map +1 -1
  85. package/dist/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
  86. package/dist/contexts/ThunderID/ThunderIDProvider.js +6 -3
  87. package/dist/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
  88. package/dist/utils/composeAffixedInputs.d.ts +52 -0
  89. package/dist/utils/composeAffixedInputs.d.ts.map +1 -0
  90. package/dist/utils/composeAffixedInputs.js +70 -0
  91. package/dist/utils/composeAffixedInputs.js.map +1 -0
  92. package/dist/utils/oauth.d.ts +2 -1
  93. package/dist/utils/oauth.d.ts.map +1 -1
  94. package/dist/utils/oauth.js +4 -3
  95. package/dist/utils/oauth.js.map +1 -1
  96. package/package.json +2 -2
@@ -0,0 +1,74 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __thunderid_browser = require("@thunderid/browser");
3
+ __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
4
+
5
+ //#region src/utils/composeAffixedInputs.ts
6
+ /**
7
+ * Returns the runtime sentinel prefix used to tag "selected prefix" entries in the
8
+ * form-state map. Resolved through the vendor namespace so white-labeled deployments
9
+ * do not collide with each other or with a real field identifier.
10
+ */
11
+ const prefixSentinel = (vendor) => `__${(0, __thunderid_browser.getVendorPrefix)(vendor)}_prefix__`;
12
+ /**
13
+ * Returns the runtime sentinel prefix used to tag "postfix" entries in the form-state
14
+ * map. See {@link prefixSentinel}.
15
+ */
16
+ const postfixSentinel = (vendor) => `__${(0, __thunderid_browser.getVendorPrefix)(vendor)}_postfix__`;
17
+ /**
18
+ * Returns the sentinel key used to store the selected prefix `value` for the affixed
19
+ * field addressed by `identifier`. The vendor namespace controls the runtime string
20
+ * so consumers overriding `vendor` do not conflict with the SDK default.
21
+ */
22
+ const affixPrefixKey = (identifier, vendor) => `${prefixSentinel(vendor)}${identifier}`;
23
+ /**
24
+ * Returns the sentinel key used to store the postfix `value` for the affixed field
25
+ * addressed by `identifier`. See {@link affixPrefixKey}.
26
+ */
27
+ const affixPostfixKey = (identifier, vendor) => `${postfixSentinel(vendor)}${identifier}`;
28
+ /**
29
+ * Rewrites `formData` (returns a new object) so that any affixed-input identifier
30
+ * tracked by matching sentinel prefix/postfix keys is replaced with its composed
31
+ * form `${prefix}${typed}${postfix}`. Sentinel keys are stripped from the result.
32
+ *
33
+ * Behaviour:
34
+ * - Prefix present, postfix present → `prefix + typed + postfix`.
35
+ * - Only prefix present → `prefix + typed`.
36
+ * - Only postfix present → `typed + postfix`.
37
+ * - Both empty / typed empty → the identifier is left untouched.
38
+ * - No sentinel keys → returns a shallow copy of `formData` unchanged.
39
+ *
40
+ * The input object is not mutated. This is component-type agnostic: any field carrying
41
+ * matching sentinel keys is composed, regardless of whether it originated from a
42
+ * TEXT_INPUT, EMAIL_INPUT, PASSWORD_INPUT, or PHONE_INPUT.
43
+ *
44
+ * @param formData - The current form values map (values indexed by field identifier).
45
+ * @param vendor - The vendor namespace configured on the SDK client, if any. Sentinel
46
+ * keys are resolved through this namespace so composition ignores unrelated keys
47
+ * written by other vendors when multiple SDK instances share a form.
48
+ */
49
+ const composeAffixedInputs = (formData, vendor) => {
50
+ const composed = { ...formData };
51
+ const prefixTag = prefixSentinel(vendor);
52
+ const postfixTag = postfixSentinel(vendor);
53
+ for (const key of Object.keys(formData)) {
54
+ if (!key.startsWith(prefixTag) && !key.startsWith(postfixTag)) continue;
55
+ const identifier = key.startsWith(prefixTag) ? key.slice(prefixTag.length) : key.slice(postfixTag.length);
56
+ const typed = composed[identifier] ?? "";
57
+ if (typed === "") {
58
+ delete composed[affixPrefixKey(identifier, vendor)];
59
+ delete composed[affixPostfixKey(identifier, vendor)];
60
+ continue;
61
+ }
62
+ composed[identifier] = `${composed[affixPrefixKey(identifier, vendor)] ?? ""}${typed}${composed[affixPostfixKey(identifier, vendor)] ?? ""}`;
63
+ delete composed[affixPrefixKey(identifier, vendor)];
64
+ delete composed[affixPostfixKey(identifier, vendor)];
65
+ }
66
+ return composed;
67
+ };
68
+ var composeAffixedInputs_default = composeAffixedInputs;
69
+
70
+ //#endregion
71
+ exports.affixPostfixKey = affixPostfixKey;
72
+ exports.affixPrefixKey = affixPrefixKey;
73
+ exports.default = composeAffixedInputs_default;
74
+ //# sourceMappingURL=composeAffixedInputs.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composeAffixedInputs.cjs","names":["composed: Record<string, string>","prefixTag: string","postfixTag: string","identifier: string","typed: string"],"sources":["../../../src/utils/composeAffixedInputs.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {getVendorPrefix} from '@thunderid/browser';\n\n/**\n * Returns the runtime sentinel prefix used to tag \"selected prefix\" entries in the\n * form-state map. Resolved through the vendor namespace so white-labeled deployments\n * do not collide with each other or with a real field identifier.\n */\nconst prefixSentinel = (vendor?: string): string => `__${getVendorPrefix(vendor)}_prefix__`;\n\n/**\n * Returns the runtime sentinel prefix used to tag \"postfix\" entries in the form-state\n * map. See {@link prefixSentinel}.\n */\nconst postfixSentinel = (vendor?: string): string => `__${getVendorPrefix(vendor)}_postfix__`;\n\n/**\n * Returns the sentinel key used to store the selected prefix `value` for the affixed\n * field addressed by `identifier`. The vendor namespace controls the runtime string\n * so consumers overriding `vendor` do not conflict with the SDK default.\n */\nexport const affixPrefixKey = (identifier: string, vendor?: string): string => `${prefixSentinel(vendor)}${identifier}`;\n\n/**\n * Returns the sentinel key used to store the postfix `value` for the affixed field\n * addressed by `identifier`. See {@link affixPrefixKey}.\n */\nexport const affixPostfixKey = (identifier: string, vendor?: string): string =>\n `${postfixSentinel(vendor)}${identifier}`;\n\n/**\n * Rewrites `formData` (returns a new object) so that any affixed-input identifier\n * tracked by matching sentinel prefix/postfix keys is replaced with its composed\n * form `${prefix}${typed}${postfix}`. Sentinel keys are stripped from the result.\n *\n * Behaviour:\n * - Prefix present, postfix present → `prefix + typed + postfix`.\n * - Only prefix present → `prefix + typed`.\n * - Only postfix present → `typed + postfix`.\n * - Both empty / typed empty → the identifier is left untouched.\n * - No sentinel keys → returns a shallow copy of `formData` unchanged.\n *\n * The input object is not mutated. This is component-type agnostic: any field carrying\n * matching sentinel keys is composed, regardless of whether it originated from a\n * TEXT_INPUT, EMAIL_INPUT, PASSWORD_INPUT, or PHONE_INPUT.\n *\n * @param formData - The current form values map (values indexed by field identifier).\n * @param vendor - The vendor namespace configured on the SDK client, if any. Sentinel\n * keys are resolved through this namespace so composition ignores unrelated keys\n * written by other vendors when multiple SDK instances share a form.\n */\nconst composeAffixedInputs = (formData: Record<string, string>, vendor?: string): Record<string, string> => {\n const composed: Record<string, string> = {...formData};\n const prefixTag: string = prefixSentinel(vendor);\n const postfixTag: string = postfixSentinel(vendor);\n\n for (const key of Object.keys(formData)) {\n if (!key.startsWith(prefixTag) && !key.startsWith(postfixTag)) {\n continue;\n }\n\n const identifier: string = key.startsWith(prefixTag) ? key.slice(prefixTag.length) : key.slice(postfixTag.length);\n\n const typed: string = composed[identifier] ?? '';\n if (typed === '') {\n // Preserve emptiness — required-field checks are the caller's responsibility.\n delete composed[affixPrefixKey(identifier, vendor)];\n delete composed[affixPostfixKey(identifier, vendor)];\n continue;\n }\n\n const prefix: string = composed[affixPrefixKey(identifier, vendor)] ?? '';\n const postfix: string = composed[affixPostfixKey(identifier, vendor)] ?? '';\n\n composed[identifier] = `${prefix}${typed}${postfix}`;\n delete composed[affixPrefixKey(identifier, vendor)];\n delete composed[affixPostfixKey(identifier, vendor)];\n }\n\n return composed;\n};\n\nexport default composeAffixedInputs;\n"],"mappings":";;;;;;;;;;AAyBA,MAAM,kBAAkB,WAA4B,8CAAqB,OAAO,CAAC;;;;;AAMjF,MAAM,mBAAmB,WAA4B,8CAAqB,OAAO,CAAC;;;;;;AAOlF,MAAa,kBAAkB,YAAoB,WAA4B,GAAG,eAAe,OAAO,GAAG;;;;;AAM3G,MAAa,mBAAmB,YAAoB,WAClD,GAAG,gBAAgB,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;AAuB/B,MAAM,wBAAwB,UAAkC,WAA4C;CAC1G,MAAMA,WAAmC,EAAC,GAAG,UAAS;CACtD,MAAMC,YAAoB,eAAe,OAAO;CAChD,MAAMC,aAAqB,gBAAgB,OAAO;AAElD,MAAK,MAAM,OAAO,OAAO,KAAK,SAAS,EAAE;AACvC,MAAI,CAAC,IAAI,WAAW,UAAU,IAAI,CAAC,IAAI,WAAW,WAAW,CAC3D;EAGF,MAAMC,aAAqB,IAAI,WAAW,UAAU,GAAG,IAAI,MAAM,UAAU,OAAO,GAAG,IAAI,MAAM,WAAW,OAAO;EAEjH,MAAMC,QAAgB,SAAS,eAAe;AAC9C,MAAI,UAAU,IAAI;AAEhB,UAAO,SAAS,eAAe,YAAY,OAAO;AAClD,UAAO,SAAS,gBAAgB,YAAY,OAAO;AACnD;;AAMF,WAAS,cAAc,GAHA,SAAS,eAAe,YAAY,OAAO,KAAK,KAGpC,QAFX,SAAS,gBAAgB,YAAY,OAAO,KAAK;AAGzE,SAAO,SAAS,eAAe,YAAY,OAAO;AAClD,SAAO,SAAS,gBAAgB,YAAY,OAAO;;AAGrD,QAAO;;AAGT,mCAAe"}
@@ -8,13 +8,14 @@ __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
8
8
  * Generates random state, stores return path in sessionStorage, and redirects to OAuth provider.
9
9
  *
10
10
  * @param redirectURL - OAuth authorization URL from the server
11
+ * @param vendor - Vendor/brand namespace used to prefix the sessionStorage key. Defaults to `'thunderid'`.
11
12
  */
12
- function initiateOAuthRedirect(redirectURL) {
13
+ function initiateOAuthRedirect(redirectURL, vendor) {
13
14
  const basePath = document.querySelector("base")?.getAttribute("href") || "";
14
15
  let returnPath = window.location.pathname;
15
16
  if (basePath && returnPath.startsWith(basePath)) returnPath = returnPath.slice(basePath.length) || "/";
16
17
  const state = crypto.randomUUID();
17
- sessionStorage.setItem(`thunderid_oauth_${state}`, JSON.stringify({
18
+ sessionStorage.setItem(`${(0, __thunderid_browser.getVendorPrefix)(vendor)}_oauth_${state}`, JSON.stringify({
18
19
  path: returnPath,
19
20
  timestamp: Date.now()
20
21
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.cjs","names":["basePath: string","returnPath: string","state: string","redirectUrlObj: URL"],"sources":["../../../src/utils/oauth.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {navigate} from '@thunderid/browser';\n\n/**\n * Initiates OAuth redirect with CSRF protection.\n * Generates random state, stores return path in sessionStorage, and redirects to OAuth provider.\n *\n * @param redirectURL - OAuth authorization URL from the server\n */\nexport function initiateOAuthRedirect(redirectURL: string): void {\n const basePath: string = document.querySelector('base')?.getAttribute('href') || '';\n let returnPath: string = window.location.pathname;\n\n if (basePath && returnPath.startsWith(basePath)) {\n returnPath = returnPath.slice(basePath.length) || '/';\n }\n\n const state: string = crypto.randomUUID();\n\n sessionStorage.setItem(\n `thunderid_oauth_${state}`,\n JSON.stringify({\n path: returnPath,\n timestamp: Date.now(),\n }),\n );\n\n const redirectUrlObj: URL = new URL(redirectURL);\n redirectUrlObj.searchParams.set('state', state);\n\n navigate(redirectUrlObj.toString());\n}\n"],"mappings":";;;;;;;;;;;AA0BA,SAAgB,sBAAsB,aAA2B;CAC/D,MAAMA,WAAmB,SAAS,cAAc,OAAO,EAAE,aAAa,OAAO,IAAI;CACjF,IAAIC,aAAqB,OAAO,SAAS;AAEzC,KAAI,YAAY,WAAW,WAAW,SAAS,CAC7C,cAAa,WAAW,MAAM,SAAS,OAAO,IAAI;CAGpD,MAAMC,QAAgB,OAAO,YAAY;AAEzC,gBAAe,QACb,mBAAmB,SACnB,KAAK,UAAU;EACb,MAAM;EACN,WAAW,KAAK,KAAK;EACtB,CAAC,CACH;CAED,MAAMC,iBAAsB,IAAI,IAAI,YAAY;AAChD,gBAAe,aAAa,IAAI,SAAS,MAAM;AAE/C,mCAAS,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"oauth.cjs","names":["basePath: string","returnPath: string","state: string","redirectUrlObj: URL"],"sources":["../../../src/utils/oauth.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {navigate, getVendorPrefix} from '@thunderid/browser';\n\n/**\n * Initiates OAuth redirect with CSRF protection.\n * Generates random state, stores return path in sessionStorage, and redirects to OAuth provider.\n *\n * @param redirectURL - OAuth authorization URL from the server\n * @param vendor - Vendor/brand namespace used to prefix the sessionStorage key. Defaults to `'thunderid'`.\n */\nexport function initiateOAuthRedirect(redirectURL: string, vendor?: string): void {\n const basePath: string = document.querySelector('base')?.getAttribute('href') || '';\n let returnPath: string = window.location.pathname;\n\n if (basePath && returnPath.startsWith(basePath)) {\n returnPath = returnPath.slice(basePath.length) || '/';\n }\n\n const state: string = crypto.randomUUID();\n\n sessionStorage.setItem(\n `${getVendorPrefix(vendor)}_oauth_${state}`,\n JSON.stringify({\n path: returnPath,\n timestamp: Date.now(),\n }),\n );\n\n const redirectUrlObj: URL = new URL(redirectURL);\n redirectUrlObj.searchParams.set('state', state);\n\n navigate(redirectUrlObj.toString());\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,SAAgB,sBAAsB,aAAqB,QAAuB;CAChF,MAAMA,WAAmB,SAAS,cAAc,OAAO,EAAE,aAAa,OAAO,IAAI;CACjF,IAAIC,aAAqB,OAAO,SAAS;AAEzC,KAAI,YAAY,WAAW,WAAW,SAAS,CAC7C,cAAa,WAAW,MAAM,SAAS,OAAO,IAAI;CAGpD,MAAMC,QAAgB,OAAO,YAAY;AAEzC,gBAAe,QACb,4CAAmB,OAAO,CAAC,SAAS,SACpC,KAAK,UAAU;EACb,MAAM;EACN,WAAW,KAAK,KAAK;EACtB,CAAC,CACH;CAED,MAAMC,iBAAsB,IAAI,IAAI,YAAY;AAChD,gBAAe,aAAa,IAAI,SAAS,MAAM;AAE/C,mCAAS,eAAe,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"OAuthCallback.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/Callback/OAuthCallback.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,EAAE,EAAoB,MAAM,OAAO,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAkIhD,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"OAuthCallback.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/Callback/OAuthCallback.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,EAAE,EAAgC,MAAM,OAAO,CAAC;AAGxD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAuIhD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,5 +1,6 @@
1
- import { navigate } from "@thunderid/browser";
2
- import { useEffect, useRef } from "react";
1
+ import ThunderIDContext_default from "../../../contexts/ThunderID/ThunderIDContext.js";
2
+ import { getVendorPrefix, navigate } from "@thunderid/browser";
3
+ import { useContext, useEffect, useRef } from "react";
3
4
 
4
5
  //#region src/components/auth/Callback/OAuthCallback.tsx
5
6
  /**
@@ -20,6 +21,7 @@ import { useEffect, useRef } from "react";
20
21
  */
21
22
  const OAuthCallback = ({ onNavigate, onError }) => {
22
23
  const processingRef = useRef(false);
24
+ const vendor = getVendorPrefix(useContext(ThunderIDContext_default)?.vendor);
23
25
  const navigate$1 = (path) => {
24
26
  if (onNavigate) onNavigate(path);
25
27
  else navigate(path);
@@ -47,7 +49,7 @@ const OAuthCallback = ({ onNavigate, onError }) => {
47
49
  return;
48
50
  }
49
51
  if (!state) throw new Error("Missing OAuth state parameter - possible security issue");
50
- const storedData = sessionStorage.getItem(`thunderid_oauth_${state}`);
52
+ const storedData = sessionStorage.getItem(`${vendor}_oauth_${state}`);
51
53
  if (!storedData) {
52
54
  if (oauthError) {
53
55
  const errorMsg = errorDescription || oauthError || "OAuth authentication failed";
@@ -63,10 +65,10 @@ const OAuthCallback = ({ onNavigate, onError }) => {
63
65
  const { path, timestamp } = JSON.parse(storedData);
64
66
  returnPath = path || "/";
65
67
  if (Date.now() - timestamp > 6e5) {
66
- sessionStorage.removeItem(`thunderid_oauth_${state}`);
68
+ sessionStorage.removeItem(`${vendor}_oauth_${state}`);
67
69
  throw new Error("OAuth state expired - please try again");
68
70
  }
69
- sessionStorage.removeItem(`thunderid_oauth_${state}`);
71
+ sessionStorage.removeItem(`${vendor}_oauth_${state}`);
70
72
  if (oauthError) {
71
73
  const errorMsg = errorDescription || oauthError || "OAuth authentication failed";
72
74
  onError?.(new Error(errorMsg));
@@ -92,7 +94,11 @@ const OAuthCallback = ({ onNavigate, onError }) => {
92
94
  }
93
95
  };
94
96
  processOAuthCallback();
95
- }, [onNavigate, onError]);
97
+ }, [
98
+ onNavigate,
99
+ onError,
100
+ vendor
101
+ ]);
96
102
  return null;
97
103
  };
98
104
 
@@ -1 +1 @@
1
- {"version":3,"file":"OAuthCallback.js","names":["OAuthCallback: FC<OAuthCallbackProps>","processingRef: any","navigate","urlParams: URLSearchParams","code: string | null","state: string | null","nonce: string | null","oauthError: string | null","errorDescription: string | null","storedData: string | null","errorMsg: string","params: URLSearchParams","params","errorMessage: string"],"sources":["../../../../src/components/auth/Callback/OAuthCallback.tsx"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {navigate as browserNavigate} from '@thunderid/browser';\nimport {FC, useEffect, useRef} from 'react';\n\n/**\n * Props for Callback component\n */\nexport interface OAuthCallbackProps {\n /**\n * Callback function called when an error occurs\n */\n onError?: (error: Error) => void;\n\n /**\n * Function to navigate to a different path.\n * If not provided, falls back to the browser navigate utility (SPA navigation via History API for same-origin paths).\n * Provide this prop to enable framework-specific navigation (e.g., from React Router).\n */\n onNavigate?: (path: string) => void;\n}\n\n/**\n * BaseCallback is a headless component that handles OAuth callback parameter forwarding.\n * This component extracts OAuth parameters (code, state, error) from the URL and forwards them\n * to the original component that initiated the OAuth flow.\n *\n * Works standalone using the browser navigate utility (History API) for navigation by default.\n * Pass an onNavigate prop to enable framework-specific navigation (e.g., via React Router).\n *\n * Flow: Extract OAuth parameters from URL -> Parse state parameter -> Redirect to original path with parameters\n *\n * The original component (SignIn/AcceptInvite) is responsible for:\n * - Processing the OAuth code via the SDK\n * - Calling /flow/execute\n * - Handling the assertion and auth/callback POST\n * - Managing the authenticated session\n */\nexport const OAuthCallback: FC<OAuthCallbackProps> = ({onNavigate, onError}: OAuthCallbackProps) => {\n // Prevent double execution in React Strict Mode\n const processingRef: any = useRef(false);\n\n // Resolve navigation: use provided onNavigate (router-aware) or fall back to browser navigate utility\n const navigate = (path: string): void => {\n if (onNavigate) {\n onNavigate(path);\n } else {\n browserNavigate(path);\n }\n };\n\n useEffect(() => {\n const processOAuthCallback = (): void => {\n // Guard against double execution\n if (processingRef.current) {\n return;\n }\n processingRef.current = true;\n\n // Declare variables outside try block for use in catch\n let returnPath = '/';\n\n try {\n // 1. Extract OAuth parameters from URL\n const urlParams: URLSearchParams = new URLSearchParams(window.location.search);\n const code: string | null = urlParams.get('code');\n const state: string | null = urlParams.get('state');\n const nonce: string | null = urlParams.get('nonce');\n const oauthError: string | null = urlParams.get('error');\n const errorDescription: string | null = urlParams.get('error_description');\n\n // 1a. If running inside a popup (e.g. social signup), send OAuth params\n // back to the opener via postMessage. The parent window's handler will\n // close this popup after processing the code.\n if (window.opener) {\n window.opener.postMessage({code, error: oauthError, errorDescription, nonce, state}, window.location.origin);\n return;\n }\n\n // 2. Validate and retrieve OAuth state from sessionStorage\n if (!state) {\n throw new Error('Missing OAuth state parameter - possible security issue');\n }\n\n const storedData: string | null = sessionStorage.getItem(`thunderid_oauth_${state}`);\n if (!storedData) {\n // If state not found, might be an error callback - try to handle gracefully\n if (oauthError) {\n const errorMsg: string = errorDescription || oauthError || 'OAuth authentication failed';\n const err: Error = new Error(errorMsg);\n onError?.(err);\n\n const params: URLSearchParams = new URLSearchParams();\n params.set('error', oauthError);\n if (errorDescription) {\n params.set('error_description', errorDescription);\n }\n\n navigate(`/?${params.toString()}`);\n return;\n }\n throw new Error('Invalid OAuth state - possible CSRF attack');\n }\n\n const {path, timestamp} = JSON.parse(storedData);\n returnPath = path || '/';\n\n // 3. Validate state freshness\n const MAX_STATE_AGE = 600000; // 10 minutes\n if (Date.now() - timestamp > MAX_STATE_AGE) {\n sessionStorage.removeItem(`thunderid_oauth_${state}`);\n throw new Error('OAuth state expired - please try again');\n }\n\n // 4. Clean up state\n sessionStorage.removeItem(`thunderid_oauth_${state}`);\n\n // 5. Handle OAuth error response\n if (oauthError) {\n const errorMsg: string = errorDescription || oauthError || 'OAuth authentication failed';\n const err: Error = new Error(errorMsg);\n onError?.(err);\n\n const params: URLSearchParams = new URLSearchParams();\n params.set('error', oauthError);\n if (errorDescription) {\n params.set('error_description', errorDescription);\n }\n\n navigate(`${returnPath}?${params.toString()}`);\n return;\n }\n\n // 6. Validate required parameters\n if (!code) {\n throw new Error('Missing OAuth authorization code');\n }\n\n // 7. Forward OAuth code to original component\n // The component (SignIn/AcceptInvite) will retrieve flowId/authId from sessionStorage\n const params: URLSearchParams = new URLSearchParams();\n params.set('code', code);\n if (nonce) {\n params.set('nonce', nonce);\n }\n\n navigate(`${returnPath}?${params.toString()}`);\n } catch (err) {\n const errorMessage: string = err instanceof Error ? err.message : 'OAuth callback processing failed';\n // eslint-disable-next-line no-console\n console.error('OAuth callback error:', err);\n\n onError?.(err instanceof Error ? err : new Error(errorMessage));\n\n // Redirect back with OAuth error format\n const params: URLSearchParams = new URLSearchParams();\n params.set('error', 'callback_error');\n params.set('error_description', errorMessage);\n\n navigate(`${returnPath}?${params.toString()}`);\n }\n };\n\n processOAuthCallback();\n }, [onNavigate, onError]);\n\n // Headless component - no UI, just processing logic\n return null;\n};\n\nexport default OAuthCallback;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsDA,MAAaA,iBAAyC,EAAC,YAAY,cAAiC;CAElG,MAAMC,gBAAqB,OAAO,MAAM;CAGxC,MAAMC,cAAY,SAAuB;AACvC,MAAI,WACF,YAAW,KAAK;MAEhB,UAAgB,KAAK;;AAIzB,iBAAgB;EACd,MAAM,6BAAmC;AAEvC,OAAI,cAAc,QAChB;AAEF,iBAAc,UAAU;GAGxB,IAAI,aAAa;AAEjB,OAAI;IAEF,MAAMC,YAA6B,IAAI,gBAAgB,OAAO,SAAS,OAAO;IAC9E,MAAMC,OAAsB,UAAU,IAAI,OAAO;IACjD,MAAMC,QAAuB,UAAU,IAAI,QAAQ;IACnD,MAAMC,QAAuB,UAAU,IAAI,QAAQ;IACnD,MAAMC,aAA4B,UAAU,IAAI,QAAQ;IACxD,MAAMC,mBAAkC,UAAU,IAAI,oBAAoB;AAK1E,QAAI,OAAO,QAAQ;AACjB,YAAO,OAAO,YAAY;MAAC;MAAM,OAAO;MAAY;MAAkB;MAAO;MAAM,EAAE,OA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AQ,MAAM,IAAI,MAAM,aAAa,CAAC;IAG/D,MAAMF,SAA0B,IAAI,iBAAiB;AACrD,WAAO,IAAI,SAAS,iBAAiB;AACrC,WAAO,IAAI,qBAAqB,aAAa;AAE7C,eAAS,GAAG,WAAW,GAAG,OAAO,UAAU,GAAG;;;AAIlD,wBAAsB;IACrB,CAAC,YAAY,QAAQ,CAAC;AAGzB,QAAO"}
1
+ {"version":3,"file":"OAuthCallback.js","names":["OAuthCallback: FC<OAuthCallbackProps>","processingRef: any","vendor: string","ThunderIDContext","navigate","urlParams: URLSearchParams","code: string | null","state: string | null","nonce: string | null","oauthError: string | null","errorDescription: string | null","storedData: string | null","errorMsg: string","params: URLSearchParams","params","errorMessage: string"],"sources":["../../../../src/components/auth/Callback/OAuthCallback.tsx"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {navigate as browserNavigate, getVendorPrefix} from '@thunderid/browser';\nimport {FC, useContext, useEffect, useRef} from 'react';\nimport ThunderIDContext from '../../../contexts/ThunderID/ThunderIDContext';\n\n/**\n * Props for Callback component\n */\nexport interface OAuthCallbackProps {\n /**\n * Callback function called when an error occurs\n */\n onError?: (error: Error) => void;\n\n /**\n * Function to navigate to a different path.\n * If not provided, falls back to the browser navigate utility (SPA navigation via History API for same-origin paths).\n * Provide this prop to enable framework-specific navigation (e.g., from React Router).\n */\n onNavigate?: (path: string) => void;\n}\n\n/**\n * BaseCallback is a headless component that handles OAuth callback parameter forwarding.\n * This component extracts OAuth parameters (code, state, error) from the URL and forwards them\n * to the original component that initiated the OAuth flow.\n *\n * Works standalone using the browser navigate utility (History API) for navigation by default.\n * Pass an onNavigate prop to enable framework-specific navigation (e.g., via React Router).\n *\n * Flow: Extract OAuth parameters from URL -> Parse state parameter -> Redirect to original path with parameters\n *\n * The original component (SignIn/AcceptInvite) is responsible for:\n * - Processing the OAuth code via the SDK\n * - Calling /flow/execute\n * - Handling the assertion and auth/callback POST\n * - Managing the authenticated session\n */\nexport const OAuthCallback: FC<OAuthCallbackProps> = ({onNavigate, onError}: OAuthCallbackProps) => {\n // Prevent double execution in React Strict Mode\n const processingRef: any = useRef(false);\n\n // Read the vendor prefix directly from context (rather than the throwing useThunderID hook)\n // so this component keeps working standalone, without a ThunderIDProvider ancestor.\n const thunderIDContext = useContext(ThunderIDContext);\n const vendor: string = getVendorPrefix(thunderIDContext?.vendor);\n\n // Resolve navigation: use provided onNavigate (router-aware) or fall back to browser navigate utility\n const navigate = (path: string): void => {\n if (onNavigate) {\n onNavigate(path);\n } else {\n browserNavigate(path);\n }\n };\n\n useEffect(() => {\n const processOAuthCallback = (): void => {\n // Guard against double execution\n if (processingRef.current) {\n return;\n }\n processingRef.current = true;\n\n // Declare variables outside try block for use in catch\n let returnPath = '/';\n\n try {\n // 1. Extract OAuth parameters from URL\n const urlParams: URLSearchParams = new URLSearchParams(window.location.search);\n const code: string | null = urlParams.get('code');\n const state: string | null = urlParams.get('state');\n const nonce: string | null = urlParams.get('nonce');\n const oauthError: string | null = urlParams.get('error');\n const errorDescription: string | null = urlParams.get('error_description');\n\n // 1a. If running inside a popup (e.g. social signup), send OAuth params\n // back to the opener via postMessage. The parent window's handler will\n // close this popup after processing the code.\n if (window.opener) {\n window.opener.postMessage({code, error: oauthError, errorDescription, nonce, state}, window.location.origin);\n return;\n }\n\n // 2. Validate and retrieve OAuth state from sessionStorage\n if (!state) {\n throw new Error('Missing OAuth state parameter - possible security issue');\n }\n\n const storedData: string | null = sessionStorage.getItem(`${vendor}_oauth_${state}`);\n if (!storedData) {\n // If state not found, might be an error callback - try to handle gracefully\n if (oauthError) {\n const errorMsg: string = errorDescription || oauthError || 'OAuth authentication failed';\n const err: Error = new Error(errorMsg);\n onError?.(err);\n\n const params: URLSearchParams = new URLSearchParams();\n params.set('error', oauthError);\n if (errorDescription) {\n params.set('error_description', errorDescription);\n }\n\n navigate(`/?${params.toString()}`);\n return;\n }\n throw new Error('Invalid OAuth state - possible CSRF attack');\n }\n\n const {path, timestamp} = JSON.parse(storedData);\n returnPath = path || '/';\n\n // 3. Validate state freshness\n const MAX_STATE_AGE = 600000; // 10 minutes\n if (Date.now() - timestamp > MAX_STATE_AGE) {\n sessionStorage.removeItem(`${vendor}_oauth_${state}`);\n throw new Error('OAuth state expired - please try again');\n }\n\n // 4. Clean up state\n sessionStorage.removeItem(`${vendor}_oauth_${state}`);\n\n // 5. Handle OAuth error response\n if (oauthError) {\n const errorMsg: string = errorDescription || oauthError || 'OAuth authentication failed';\n const err: Error = new Error(errorMsg);\n onError?.(err);\n\n const params: URLSearchParams = new URLSearchParams();\n params.set('error', oauthError);\n if (errorDescription) {\n params.set('error_description', errorDescription);\n }\n\n navigate(`${returnPath}?${params.toString()}`);\n return;\n }\n\n // 6. Validate required parameters\n if (!code) {\n throw new Error('Missing OAuth authorization code');\n }\n\n // 7. Forward OAuth code to original component\n // The component (SignIn/AcceptInvite) will retrieve flowId/authId from sessionStorage\n const params: URLSearchParams = new URLSearchParams();\n params.set('code', code);\n if (nonce) {\n params.set('nonce', nonce);\n }\n\n navigate(`${returnPath}?${params.toString()}`);\n } catch (err) {\n const errorMessage: string = err instanceof Error ? err.message : 'OAuth callback processing failed';\n // eslint-disable-next-line no-console\n console.error('OAuth callback error:', err);\n\n onError?.(err instanceof Error ? err : new Error(errorMessage));\n\n // Redirect back with OAuth error format\n const params: URLSearchParams = new URLSearchParams();\n params.set('error', 'callback_error');\n params.set('error_description', errorMessage);\n\n navigate(`${returnPath}?${params.toString()}`);\n }\n };\n\n processOAuthCallback();\n }, [onNavigate, onError, vendor]);\n\n // Headless component - no UI, just processing logic\n return null;\n};\n\nexport default OAuthCallback;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuDA,MAAaA,iBAAyC,EAAC,YAAY,cAAiC;CAElG,MAAMC,gBAAqB,OAAO,MAAM;CAKxC,MAAMC,SAAiB,gBADE,WAAWC,yBAAiB,EACI,OAAO;CAGhE,MAAMC,cAAY,SAAuB;AACvC,MAAI,WACF,YAAW,KAAK;MAEhB,UAAgB,KAAK;;AAIzB,iBAAgB;EACd,MAAM,6BAAmC;AAEvC,OAAI,cAAc,QAChB;AAEF,iBAAc,UAAU;GAGxB,IAAI,aAAa;AAEjB,OAAI;IAEF,MAAMC,YAA6B,IAAI,gBAAgB,OAAO,SAAS,OAAO;IAC9E,MAAMC,OAAsB,UAAU,IAAI,OAAO;IACjD,MAAMC,QAAuB,UAAU,IAAI,QAAQ;IACnD,MAAMC,QAAuB,UAAU,IAAI,QAAQ;IACnD,MAAMC,aAA4B,UAAU,IAAI,QAAQ;IACxD,MAAMC,mBAAkC,UAAU,IAAI,oBAAoB;AAK1E,QAAI,OAAO,QAAQ;AACjB,YAAO,OAAO,YAAY;MAAC;MAAM,OAAO;MAAY;MAAkB;MAAO;MAAM,EAAE,OAAO,SAAS,OAAO;AAC5G;;AAIF,QAAI,CAAC,MACH,OAAM,IAAI,MAAM,0DAA0D;IAG5E,MAAMC,aAA4B,eAAe,QAAQ,GAAG,OAAO,SAAS,QAAQ;AACpF,QAAI,CAAC,YAAY;AAEf,SAAI,YAAY;MACd,MAAMC,WAAmB,oBAAoB,cAAc;AAE3D,gBADmB,IAAI,MAAM,SAAS,CACxB;MAEd,MAAMC,WAA0B,IAAI,iBAAiB;AACrD,eAAO,IAAI,SAAS,WAAW;AAC/B,UAAI,iBACF,UAAO,IAAI,qBAAqB,iBAAiB;AAGnD,iBAAS,KAAKC,SAAO,UAAU,GAAG;AAClC;;AAEF,WAAM,IAAI,MAAM,6CAA6C;;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,EAAoB,MAAM,OAAO,CAAC;AAG5C,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEpC;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAEpD;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAwLhD,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"TokenCallback.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/Callback/TokenCallback.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAC,EAAE,EAAoB,MAAM,OAAO,CAAC;AAG5C,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEpC;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAEpD;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAyLhD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -5,7 +5,7 @@ import { useEffect, useRef } from "react";
5
5
  //#region src/components/auth/Callback/TokenCallback.tsx
6
6
  const TokenCallback = ({ onNavigate, onError, onSuccess, signInPath = "/signin", signUpPath = "/signup" }) => {
7
7
  const processingRef = useRef(false);
8
- const { isInitialized, isLoading, signIn, signUp, getStorageManager } = useThunderID_default();
8
+ const { isInitialized, isLoading, signIn, signUp, getStorageManager, vendor } = useThunderID_default();
9
9
  const navigate$1 = (path) => {
10
10
  if (onNavigate) onNavigate(path);
11
11
  else navigate(path);
@@ -20,7 +20,7 @@ const TokenCallback = ({ onNavigate, onError, onSuccess, signInPath = "/signin",
20
20
  const initiateOAuthRedirect = (redirectURL, isRegistrationFlow) => {
21
21
  const redirectUrlObj = new URL(redirectURL);
22
22
  const state = redirectUrlObj.searchParams.get("state") || crypto.randomUUID();
23
- sessionStorage.setItem(`thunderid_oauth_${state}`, JSON.stringify({
23
+ sessionStorage.setItem(`${vendor}_oauth_${state}`, JSON.stringify({
24
24
  path: isRegistrationFlow ? signUpPath : signInPath,
25
25
  timestamp: Date.now()
26
26
  }));
@@ -34,7 +34,7 @@ const TokenCallback = ({ onNavigate, onError, onSuccess, signInPath = "/signin",
34
34
  return params.toString() ? `${basePath}?${params.toString()}` : basePath;
35
35
  };
36
36
  const redirectWithError = (error, isRegistrationFlow) => {
37
- sessionStorage.removeItem("thunderid_execution_id");
37
+ sessionStorage.removeItem(`${vendor}_execution_id`);
38
38
  onError?.(error);
39
39
  const params = new URLSearchParams();
40
40
  params.set("error", "token_verification_failed");
@@ -70,7 +70,7 @@ const TokenCallback = ({ onNavigate, onError, onSuccess, signInPath = "/signin",
70
70
  if (response.type === EmbeddedSignInFlowType.Redirection) {
71
71
  const redirectURL = response.data?.redirectURL || response?.redirectURL;
72
72
  const nextExecutionId$1 = response.executionId || executionId;
73
- sessionStorage.setItem("thunderid_execution_id", nextExecutionId$1);
73
+ sessionStorage.setItem(`${vendor}_execution_id`, nextExecutionId$1);
74
74
  if (redirectURL) {
75
75
  initiateOAuthRedirect(redirectURL, isRegistrationFlow);
76
76
  return;
@@ -78,7 +78,7 @@ const TokenCallback = ({ onNavigate, onError, onSuccess, signInPath = "/signin",
78
78
  }
79
79
  if (response.flowStatus === EmbeddedSignInFlowStatus.Complete) {
80
80
  const redirectUrl = response?.redirectUrl || response?.redirect_uri;
81
- sessionStorage.removeItem("thunderid_execution_id");
81
+ sessionStorage.removeItem(`${vendor}_execution_id`);
82
82
  await storageManager.removeHybridDataParameter("authId");
83
83
  onSuccess?.({
84
84
  redirectUrl,
@@ -99,7 +99,7 @@ const TokenCallback = ({ onNavigate, onError, onSuccess, signInPath = "/signin",
99
99
  return;
100
100
  }
101
101
  const nextExecutionId = response.executionId || executionId;
102
- sessionStorage.setItem("thunderid_execution_id", nextExecutionId);
102
+ sessionStorage.setItem(`${vendor}_execution_id`, nextExecutionId);
103
103
  if (response.challengeToken) await storageManager.setTemporaryDataParameter("challengeToken", response.challengeToken);
104
104
  navigate$1(buildSignInPath(nextExecutionId, applicationId, isRegistrationFlow));
105
105
  } catch (err) {
@@ -121,7 +121,8 @@ const TokenCallback = ({ onNavigate, onError, onSuccess, signInPath = "/signin",
121
121
  signIn,
122
122
  signUp,
123
123
  signInPath,
124
- signUpPath
124
+ signUpPath,
125
+ vendor
125
126
  ]);
126
127
  return null;
127
128
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TokenCallback.js","names":["TokenCallback: FC<TokenCallbackProps>","processingRef: any","useThunderID","navigate","url: URL","redirectUrlObj: URL","state: string","params: URLSearchParams","searchParams: URLSearchParams","executionId: string | null","token: string | null","applicationId: string | null","isRegistrationFlow: boolean","storageManager: any","response: any","redirectURL: string | undefined","nextExecutionId: string","nextExecutionId","redirectUrl: string | undefined","failureReason: string | undefined","error: Error"],"sources":["../../../../src/components/auth/Callback/TokenCallback.tsx"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\nimport {EmbeddedSignInFlowStatus, EmbeddedSignInFlowType, navigate as browserNavigate} from '@thunderid/browser';\nimport {FC, useEffect, useRef} from 'react';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\n\nexport interface TokenCallbackProps {\n /**\n * Callback function called when an error occurs\n */\n onError?: (error: Error) => void;\n\n /**\n * Function to navigate to a different path.\n * If not provided, falls back to the browser navigate utility (SPA navigation via History API for same-origin paths).\n * Provide this prop to enable framework-specific navigation (e.g., from React Router).\n */\n onNavigate?: (path: string) => void;\n\n /**\n * Callback function called when authentication is successful\n */\n onSuccess?: (authData: Record<string, any>) => void;\n\n /**\n * Custom path for the sign-in page. Defaults to '/signin'\n */\n signInPath?: string;\n\n /**\n * Custom path for the sign-up page. Defaults to '/signup'\n */\n signUpPath?: string;\n}\n\nexport const TokenCallback: FC<TokenCallbackProps> = ({\n onNavigate,\n onError,\n onSuccess,\n signInPath = '/signin',\n signUpPath = '/signup',\n}: TokenCallbackProps) => {\n const processingRef: any = useRef(false);\n const {isInitialized, isLoading, signIn, signUp, getStorageManager} = useThunderID();\n\n const navigate = (path: string): void => {\n if (onNavigate) {\n onNavigate(path);\n } else {\n browserNavigate(path);\n }\n };\n\n const clearTokenFromUrl = (): void => {\n if (!window?.location?.href) {\n return;\n }\n\n const url: URL = new URL(window.location.href);\n url.searchParams.delete('token');\n url.searchParams.delete('type');\n window.history.replaceState({}, '', url.toString());\n };\n\n const initiateOAuthRedirect = (redirectURL: string, isRegistrationFlow?: boolean): void => {\n const redirectUrlObj: URL = new URL(redirectURL);\n const state: string = redirectUrlObj.searchParams.get('state') || crypto.randomUUID();\n\n sessionStorage.setItem(\n `thunderid_oauth_${state}`,\n JSON.stringify({\n path: isRegistrationFlow ? signUpPath : signInPath,\n timestamp: Date.now(),\n }),\n );\n\n browserNavigate(redirectUrlObj.toString());\n };\n\n const buildSignInPath = (\n executionId?: string | null,\n applicationId?: string | null,\n isRegistrationFlow?: boolean,\n ): string => {\n const params: URLSearchParams = new URLSearchParams();\n if (executionId) {\n params.set('executionId', executionId);\n }\n if (applicationId) {\n params.set('applicationId', applicationId);\n }\n\n const basePath = isRegistrationFlow ? signUpPath : signInPath;\n return params.toString() ? `${basePath}?${params.toString()}` : basePath;\n };\n\n const redirectWithError = (error: Error, isRegistrationFlow?: boolean): void => {\n sessionStorage.removeItem('thunderid_execution_id');\n\n onError?.(error);\n\n const params: URLSearchParams = new URLSearchParams();\n params.set('error', 'token_verification_failed');\n params.set('error_description', error.message);\n const basePath = isRegistrationFlow ? signUpPath : signInPath;\n navigate(`${basePath}?${params.toString()}`);\n };\n\n useEffect(() => {\n if (!isInitialized || isLoading) {\n return;\n }\n\n const processTokenCallback = async (): Promise<void> => {\n if (processingRef.current) {\n return;\n }\n processingRef.current = true;\n\n // Read URL params before clearing them so they're accessible in both try and catch.\n const searchParams: URLSearchParams = new URLSearchParams(window.location.search);\n const executionId: string | null = searchParams.get('id') || searchParams.get('executionId');\n const token: string | null = searchParams.get('token');\n const applicationId: string | null = searchParams.get('applicationId');\n const isRegistrationFlow: boolean = searchParams.get('type') === 'REGISTRATION';\n\n clearTokenFromUrl();\n\n try {\n const storageManager: any = await getStorageManager();\n\n if (!executionId || !token) {\n const error: Error = new Error('Missing executionId or token in callback URL');\n redirectWithError(error, isRegistrationFlow);\n return;\n }\n\n let response: any;\n\n if (isRegistrationFlow) {\n response = await signUp({executionId, inputs: {token}});\n } else {\n response = await signIn({executionId, inputs: {token}});\n }\n\n if (response.type === EmbeddedSignInFlowType.Redirection) {\n const redirectURL: string | undefined = response.data?.redirectURL || response?.redirectURL;\n const nextExecutionId: string = response.executionId || executionId;\n sessionStorage.setItem('thunderid_execution_id', nextExecutionId);\n\n if (redirectURL) {\n initiateOAuthRedirect(redirectURL, isRegistrationFlow);\n return;\n }\n }\n\n if (response.flowStatus === EmbeddedSignInFlowStatus.Complete) {\n const redirectUrl: string | undefined = response?.redirectUrl || response?.redirect_uri;\n\n sessionStorage.removeItem('thunderid_execution_id');\n await storageManager.removeHybridDataParameter('authId');\n\n onSuccess?.({\n redirectUrl,\n ...((response.data as Record<string, any>) || {}),\n });\n\n if (redirectUrl) {\n window.location.href = redirectUrl;\n return;\n }\n\n navigate(isRegistrationFlow ? signUpPath : signInPath);\n return;\n }\n\n if (response.flowStatus === EmbeddedSignInFlowStatus.Error) {\n const failureReason: string | undefined = response?.failureReason;\n const error: Error = new Error(failureReason || 'Token validation failed. Please try again.');\n await storageManager.removeHybridDataParameter('authId');\n redirectWithError(error, isRegistrationFlow);\n return;\n }\n\n const nextExecutionId: string = response.executionId || executionId;\n sessionStorage.setItem('thunderid_execution_id', nextExecutionId);\n\n if (response.challengeToken) {\n await storageManager.setTemporaryDataParameter('challengeToken', response.challengeToken);\n }\n\n navigate(buildSignInPath(nextExecutionId, applicationId, isRegistrationFlow));\n } catch (err) {\n const error: Error = err instanceof Error ? err : new Error('Token callback processing failed');\n // eslint-disable-next-line no-console\n console.error('Token callback error:', err);\n const storageManager: any = await getStorageManager();\n if (storageManager) {\n await storageManager.removeHybridDataParameter('authId');\n }\n redirectWithError(error, isRegistrationFlow);\n }\n };\n\n processTokenCallback();\n }, [\n getStorageManager,\n isInitialized,\n isLoading,\n onError,\n onNavigate,\n onSuccess,\n signIn,\n signUp,\n signInPath,\n signUpPath,\n ]);\n\n return null;\n};\n\nexport default TokenCallback;\n"],"mappings":";;;;;AAkDA,MAAaA,iBAAyC,EACpD,YACA,SACA,WACA,aAAa,WACb,aAAa,gBACW;CACxB,MAAMC,gBAAqB,OAAO,MAAM;CACxC,MAAM,EAAC,eAAe,WAAW,QAAQ,QAAQ,sBAAqBC,sBAAc;CAEpF,MAAMC,cAAY,SA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MAAMJ,kBAA0B,SAAS,eAAe;AACxD,mBAAe,QAAQ,0BAA0B,gBAAgB;AAEjE,QAAI,SAAS,eACX,OAAM,eAAe,0BAA0B,kBAAkB,SAAS,eAAe;AAG3F,eAAS,gBAAgB,iBAAiB,eAAe,mBAAmB,CAAC;YACtE,KAAK;IACZ,MAAMI,QAAe,eAAe,QAAQ,sBAAM,IAAI,MAAM,mCAAmC;AAE/F,YAAQ,MAAM,yBAAyB,IAAI;IAC3C,MAAMP,iBAAsB,MAAM,mBAAmB;AACrD,QAAI,eACF,OAAM,eAAe,0BAA0B,SAAS;AAE1D,sBAAkB,OAAO,mBAAmB;;;AAIhD,wBAAsB;IACrB;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QAAO"}
1
+ {"version":3,"file":"TokenCallback.js","names":["TokenCallback: FC<TokenCallbackProps>","processingRef: any","useThunderID","navigate","url: URL","redirectUrlObj: URL","state: string","params: URLSearchParams","searchParams: URLSearchParams","executionId: string | null","token: string | null","applicationId: string | null","isRegistrationFlow: boolean","storageManager: any","response: any","redirectURL: string | undefined","nextExecutionId: string","nextExecutionId","redirectUrl: string | undefined","failureReason: string | undefined","error: Error"],"sources":["../../../../src/components/auth/Callback/TokenCallback.tsx"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\nimport {EmbeddedSignInFlowStatus, EmbeddedSignInFlowType, navigate as browserNavigate} from '@thunderid/browser';\nimport {FC, useEffect, useRef} from 'react';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\n\nexport interface TokenCallbackProps {\n /**\n * Callback function called when an error occurs\n */\n onError?: (error: Error) => void;\n\n /**\n * Function to navigate to a different path.\n * If not provided, falls back to the browser navigate utility (SPA navigation via History API for same-origin paths).\n * Provide this prop to enable framework-specific navigation (e.g., from React Router).\n */\n onNavigate?: (path: string) => void;\n\n /**\n * Callback function called when authentication is successful\n */\n onSuccess?: (authData: Record<string, any>) => void;\n\n /**\n * Custom path for the sign-in page. Defaults to '/signin'\n */\n signInPath?: string;\n\n /**\n * Custom path for the sign-up page. Defaults to '/signup'\n */\n signUpPath?: string;\n}\n\nexport const TokenCallback: FC<TokenCallbackProps> = ({\n onNavigate,\n onError,\n onSuccess,\n signInPath = '/signin',\n signUpPath = '/signup',\n}: TokenCallbackProps) => {\n const processingRef: any = useRef(false);\n const {isInitialized, isLoading, signIn, signUp, getStorageManager, vendor} = useThunderID();\n\n const navigate = (path: string): void => {\n if (onNavigate) {\n onNavigate(path);\n } else {\n browserNavigate(path);\n }\n };\n\n const clearTokenFromUrl = (): void => {\n if (!window?.location?.href) {\n return;\n }\n\n const url: URL = new URL(window.location.href);\n url.searchParams.delete('token');\n url.searchParams.delete('type');\n window.history.replaceState({}, '', url.toString());\n };\n\n const initiateOAuthRedirect = (redirectURL: string, isRegistrationFlow?: boolean): void => {\n const redirectUrlObj: URL = new URL(redirectURL);\n const state: string = redirectUrlObj.searchParams.get('state') || crypto.randomUUID();\n\n sessionStorage.setItem(\n `${vendor}_oauth_${state}`,\n JSON.stringify({\n path: isRegistrationFlow ? signUpPath : signInPath,\n timestamp: Date.now(),\n }),\n );\n\n browserNavigate(redirectUrlObj.toString());\n };\n\n const buildSignInPath = (\n executionId?: string | null,\n applicationId?: string | null,\n isRegistrationFlow?: boolean,\n ): string => {\n const params: URLSearchParams = new URLSearchParams();\n if (executionId) {\n params.set('executionId', executionId);\n }\n if (applicationId) {\n params.set('applicationId', applicationId);\n }\n\n const basePath = isRegistrationFlow ? signUpPath : signInPath;\n return params.toString() ? `${basePath}?${params.toString()}` : basePath;\n };\n\n const redirectWithError = (error: Error, isRegistrationFlow?: boolean): void => {\n sessionStorage.removeItem(`${vendor}_execution_id`);\n\n onError?.(error);\n\n const params: URLSearchParams = new URLSearchParams();\n params.set('error', 'token_verification_failed');\n params.set('error_description', error.message);\n const basePath = isRegistrationFlow ? signUpPath : signInPath;\n navigate(`${basePath}?${params.toString()}`);\n };\n\n useEffect(() => {\n if (!isInitialized || isLoading) {\n return;\n }\n\n const processTokenCallback = async (): Promise<void> => {\n if (processingRef.current) {\n return;\n }\n processingRef.current = true;\n\n // Read URL params before clearing them so they're accessible in both try and catch.\n const searchParams: URLSearchParams = new URLSearchParams(window.location.search);\n const executionId: string | null = searchParams.get('id') || searchParams.get('executionId');\n const token: string | null = searchParams.get('token');\n const applicationId: string | null = searchParams.get('applicationId');\n const isRegistrationFlow: boolean = searchParams.get('type') === 'REGISTRATION';\n\n clearTokenFromUrl();\n\n try {\n const storageManager: any = await getStorageManager();\n\n if (!executionId || !token) {\n const error: Error = new Error('Missing executionId or token in callback URL');\n redirectWithError(error, isRegistrationFlow);\n return;\n }\n\n let response: any;\n\n if (isRegistrationFlow) {\n response = await signUp({executionId, inputs: {token}});\n } else {\n response = await signIn({executionId, inputs: {token}});\n }\n\n if (response.type === EmbeddedSignInFlowType.Redirection) {\n const redirectURL: string | undefined = response.data?.redirectURL || response?.redirectURL;\n const nextExecutionId: string = response.executionId || executionId;\n sessionStorage.setItem(`${vendor}_execution_id`, nextExecutionId);\n\n if (redirectURL) {\n initiateOAuthRedirect(redirectURL, isRegistrationFlow);\n return;\n }\n }\n\n if (response.flowStatus === EmbeddedSignInFlowStatus.Complete) {\n const redirectUrl: string | undefined = response?.redirectUrl || response?.redirect_uri;\n\n sessionStorage.removeItem(`${vendor}_execution_id`);\n await storageManager.removeHybridDataParameter('authId');\n\n onSuccess?.({\n redirectUrl,\n ...((response.data as Record<string, any>) || {}),\n });\n\n if (redirectUrl) {\n window.location.href = redirectUrl;\n return;\n }\n\n navigate(isRegistrationFlow ? signUpPath : signInPath);\n return;\n }\n\n if (response.flowStatus === EmbeddedSignInFlowStatus.Error) {\n const failureReason: string | undefined = response?.failureReason;\n const error: Error = new Error(failureReason || 'Token validation failed. Please try again.');\n await storageManager.removeHybridDataParameter('authId');\n redirectWithError(error, isRegistrationFlow);\n return;\n }\n\n const nextExecutionId: string = response.executionId || executionId;\n sessionStorage.setItem(`${vendor}_execution_id`, nextExecutionId);\n\n if (response.challengeToken) {\n await storageManager.setTemporaryDataParameter('challengeToken', response.challengeToken);\n }\n\n navigate(buildSignInPath(nextExecutionId, applicationId, isRegistrationFlow));\n } catch (err) {\n const error: Error = err instanceof Error ? err : new Error('Token callback processing failed');\n // eslint-disable-next-line no-console\n console.error('Token callback error:', err);\n const storageManager: any = await getStorageManager();\n if (storageManager) {\n await storageManager.removeHybridDataParameter('authId');\n }\n redirectWithError(error, isRegistrationFlow);\n }\n };\n\n processTokenCallback();\n }, [\n getStorageManager,\n isInitialized,\n isLoading,\n onError,\n onNavigate,\n onSuccess,\n signIn,\n signUp,\n signInPath,\n signUpPath,\n vendor,\n ]);\n\n return null;\n};\n\nexport default TokenCallback;\n"],"mappings":";;;;;AAkDA,MAAaA,iBAAyC,EACpD,YACA,SACA,WACA,aAAa,WACb,aAAa,gBACW;CACxB,MAAMC,gBAAqB,OAAO,MAAM;CACxC,MAAM,EAAC,eAAe,WAAW,QAAQ,QAAQ,mBAAmB,WAAUC,sBAAc;CAE5F,MAAMC,cAAY,SAAuB;AACvC,MAAI,WACF,YAAW,KAAK;MAEhB,UAAgB,KAAK;;CAIzB,MAAM,0BAAgC;AACpC,MAAI,CAAC,QAAQ,UAAU,KACrB;EAGF,MAAMC,MAAW,IAAI,IAAI,OAAO,SAAS,KAAK;AAC9C,MAAI,aAAa,OAAO,QAAQ;AAChC,MAAI,aAAa,OAAO,OAAO;AAC/B,SAAO,QAAQ,aAAa,EAAE,EAAE,IAA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Ae,QAAQ,sBAAM,IAAI,MAAM,mCAAmC;AAE/F,YAAQ,MAAM,yBAAyB,IAAI;IAC3C,MAAMP,iBAAsB,MAAM,mBAAmB;AACrD,QAAI,eACF,OAAM,eAAe,0BAA0B,SAAS;AAE1D,sBAAkB,OAAO,mBAAmB;;;AAIhD,wBAAsB;IACrB;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"BaseAcceptInvite.d.ts","sourceRoot":"","sources":["../../../../../src/components/presentation/auth/AcceptInvite/BaseAcceptInvite.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EAEZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,EAAE,EAAgB,SAAS,EAAuD,MAAM,OAAO,CAAC;AAcxG,OAAsB,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AAKvE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE;QACL,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACxC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;QACnB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;QAC3B,IAAI,CAAC,EAAE;YACL,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;SACpB,CAAC;QACF,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;IAChD,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,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EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,SAAS,CAAC;IAE7D;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IAExB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAE5D;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAE1B;;;OAGG;IACH,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAE9E;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAEpC;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC;AAED;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA2oB/C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"BaseAcceptInvite.d.ts","sourceRoot":"","sources":["../../../../../src/components/presentation/auth/AcceptInvite/BaseAcceptInvite.tsx"],"names":[],"mappings":"AAA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,IAAI,CAAC;IAEjC;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAE5D;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAE1B;;;OAGG;IACH,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAE9E;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAEpC;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC;AAED;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAspB/C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -34,7 +34,7 @@ import { cx } from "@emotion/css";
34
34
  * 3. Flow completion
35
35
  */
36
36
  const BaseAcceptInvite = ({ executionId, inviteToken, onSubmit, onComplete, onError, onFlowChange, onGoToSignIn, className = "", children, preferences, size = "medium", variant = "outlined", showTitle = true, showSubtitle = true }) => {
37
- const { meta, isInitialized, getStorageManager } = useThunderID_default();
37
+ const { meta, isInitialized, getStorageManager, vendor } = useThunderID_default();
38
38
  const { t } = useTranslation_default(preferences?.i18n);
39
39
  const { theme } = useTheme_default();
40
40
  const customRenderers = useContext(ComponentRendererContext_default);
@@ -134,6 +134,7 @@ const BaseAcceptInvite = ({ executionId, inviteToken, onSubmit, onComplete, onEr
134
134
  */
135
135
  useOAuthCallback({
136
136
  currentExecutionId: executionId ?? null,
137
+ executionIdStorageKey: `${vendor}_execution_id`,
137
138
  isInitialized: isStorageReady,
138
139
  onComplete: () => {
139
140
  setIsValidatingToken(false);
@@ -280,7 +281,7 @@ const BaseAcceptInvite = ({ executionId, inviteToken, onSubmit, onComplete, onEr
280
281
  if (response.type === "REDIRECTION") {
281
282
  const redirectURL = response.data?.redirectURL || response?.redirectURL;
282
283
  if (redirectURL && typeof window !== "undefined") {
283
- initiateOAuthRedirect(redirectURL);
284
+ initiateOAuthRedirect(redirectURL, vendor);
284
285
  return;
285
286
  }
286
287
  }
@@ -314,6 +315,14 @@ const BaseAcceptInvite = ({ executionId, inviteToken, onSubmit, onComplete, onEr
314
315
  normalizeFlowResponseLocal
315
316
  ]);
316
317
  /**
318
+ * reset form values, errors, and touched fields to initial state
319
+ */
320
+ const resetForm = useCallback(() => {
321
+ setFormValues({});
322
+ setFormErrors({});
323
+ setTouchedFields({});
324
+ }, []);
325
+ /**
317
326
  * Validate invite token on component mount.
318
327
  */
319
328
  useEffect(() => {
@@ -330,7 +339,7 @@ const BaseAcceptInvite = ({ executionId, inviteToken, onSubmit, onComplete, onEr
330
339
  setIsValidatingToken(true);
331
340
  setApiError(null);
332
341
  try {
333
- if (executionId) sessionStorage.setItem("thunderid_execution_id", executionId);
342
+ if (executionId) sessionStorage.setItem(`${vendor}_execution_id`, executionId);
334
343
  const response = normalizeFlowResponseLocal(await onSubmit({
335
344
  executionId,
336
345
  inputs: { inviteToken },
@@ -475,7 +484,7 @@ const BaseAcceptInvite = ({ executionId, inviteToken, onSubmit, onComplete, onEr
475
484
  children: /* @__PURE__ */ jsx(Alert_default.Description, { children: apiError.message })
476
485
  })
477
486
  }),
478
- /* @__PURE__ */ jsxs("div", { children: [componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderInviteUserComponents(componentsWithoutHeadings, formValues, touchedFields, formErrors, isLoading, isFormValid, handleInputChange, {
487
+ /* @__PURE__ */ jsxs("div", { children: [componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderInviteUserComponents(componentsWithoutHeadings, formValues, touchedFields, formErrors, isLoading, isFormValid, resetForm, handleInputChange, {
479
488
  _customRenderers: customRenderers,
480
489
  _theme: theme,
481
490
  onInputBlur: handleInputBlur,