@thunderid/react 0.11.2 → 0.11.4

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 (652) hide show
  1. package/dist/ThunderIDReactClient.d.ts +0 -17
  2. package/dist/ThunderIDReactClient.d.ts.map +1 -1
  3. package/dist/ThunderIDReactClient.js +13 -7
  4. package/dist/ThunderIDReactClient.js.map +1 -1
  5. package/dist/api/getUsersMe.d.ts +0 -17
  6. package/dist/api/getUsersMe.d.ts.map +1 -1
  7. package/dist/api/getUsersMe.js.map +1 -1
  8. package/dist/api/updateMeProfile.d.ts +0 -17
  9. package/dist/api/updateMeProfile.d.ts.map +1 -1
  10. package/dist/api/updateMeProfile.js.map +1 -1
  11. package/dist/cjs/ThunderIDReactClient.cjs +12 -6
  12. package/dist/cjs/ThunderIDReactClient.cjs.map +1 -1
  13. package/dist/cjs/api/getUsersMe.cjs.map +1 -1
  14. package/dist/cjs/api/updateMeProfile.cjs.map +1 -1
  15. package/dist/cjs/components/actions/SignInButton/BaseSignInButton.cjs.map +1 -1
  16. package/dist/cjs/components/actions/SignInButton/SignInButton.cjs.map +1 -1
  17. package/dist/cjs/components/actions/SignOutButton/BaseSignOutButton.cjs.map +1 -1
  18. package/dist/cjs/components/actions/SignOutButton/SignOutButton.cjs.map +1 -1
  19. package/dist/cjs/components/actions/SignUpButton/BaseSignUpButton.cjs.map +1 -1
  20. package/dist/cjs/components/actions/SignUpButton/SignUpButton.cjs.map +1 -1
  21. package/dist/cjs/components/adapters/Consent.cjs.map +1 -1
  22. package/dist/cjs/components/adapters/ConsentCheckboxList.cjs.map +1 -1
  23. package/dist/cjs/components/adapters/ConsentCheckboxList.styles.cjs.map +1 -1
  24. package/dist/cjs/components/adapters/FacebookButton.cjs.map +1 -1
  25. package/dist/cjs/components/adapters/FlowTimer.cjs.map +1 -1
  26. package/dist/cjs/components/adapters/GitHubButton.cjs.map +1 -1
  27. package/dist/cjs/components/adapters/GoogleButton.cjs.map +1 -1
  28. package/dist/cjs/components/adapters/ImageComponent.cjs.map +1 -1
  29. package/dist/cjs/components/adapters/LinkedInButton.cjs.map +1 -1
  30. package/dist/cjs/components/adapters/MicrosoftButton.cjs.map +1 -1
  31. package/dist/cjs/components/adapters/SignInWithEthereumButton.cjs.map +1 -1
  32. package/dist/cjs/components/adapters/SmsOtpButton.cjs.map +1 -1
  33. package/dist/cjs/components/auth/Callback/Callback.cjs.map +1 -1
  34. package/dist/cjs/components/auth/Callback/OAuthCallback.cjs.map +1 -1
  35. package/dist/cjs/components/auth/Callback/TokenCallback.cjs.map +1 -1
  36. package/dist/cjs/components/control/Loading.cjs.map +1 -1
  37. package/dist/cjs/components/control/SignedIn.cjs.map +1 -1
  38. package/dist/cjs/components/control/SignedOut.cjs.map +1 -1
  39. package/dist/cjs/components/factories/FieldFactory.cjs.map +1 -1
  40. package/dist/cjs/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.cjs.map +1 -1
  41. package/dist/cjs/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.cjs.map +1 -1
  42. package/dist/cjs/components/presentation/LanguageSwitcher/LanguageSwitcher.cjs.map +1 -1
  43. package/dist/cjs/components/presentation/User/BaseUser.cjs.map +1 -1
  44. package/dist/cjs/components/presentation/User/User.cjs.map +1 -1
  45. package/dist/cjs/components/presentation/UserAvatar/BaseUserAvatar.cjs.map +1 -1
  46. package/dist/cjs/components/presentation/UserAvatar/UserAvatar.cjs.map +1 -1
  47. package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.cjs.map +1 -1
  48. package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.styles.cjs.map +1 -1
  49. package/dist/cjs/components/presentation/UserDropdown/UserDropdown.cjs.map +1 -1
  50. package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.cjs.map +1 -1
  51. package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.styles.cjs.map +1 -1
  52. package/dist/cjs/components/presentation/UserProfile/UserProfile.cjs.map +1 -1
  53. package/dist/cjs/components/presentation/auth/AcceptInvite/AcceptInvite.cjs +3 -4
  54. package/dist/cjs/components/presentation/auth/AcceptInvite/AcceptInvite.cjs.map +1 -1
  55. package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs.map +1 -1
  56. package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.styles.cjs.map +1 -1
  57. package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
  58. package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs.map +1 -1
  59. package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.styles.cjs.map +1 -1
  60. package/dist/cjs/components/presentation/auth/InviteUser/InviteUser.cjs +4 -3
  61. package/dist/cjs/components/presentation/auth/InviteUser/InviteUser.cjs.map +1 -1
  62. package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs.map +1 -1
  63. package/dist/cjs/components/presentation/auth/Recovery/Recovery.cjs.map +1 -1
  64. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs.map +1 -1
  65. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.styles.cjs.map +1 -1
  66. package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs +10 -1
  67. package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs.map +1 -1
  68. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -1
  69. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.styles.cjs.map +1 -1
  70. package/dist/cjs/components/presentation/auth/SignUp/SignUp.cjs.map +1 -1
  71. package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs.map +1 -1
  72. package/dist/cjs/components/primitives/AffixedField/AffixedField.styles.cjs.map +1 -1
  73. package/dist/cjs/components/primitives/Alert/Alert.cjs.map +1 -1
  74. package/dist/cjs/components/primitives/Alert/Alert.styles.cjs.map +1 -1
  75. package/dist/cjs/components/primitives/Avatar/Avatar.cjs.map +1 -1
  76. package/dist/cjs/components/primitives/Avatar/Avatar.styles.cjs.map +1 -1
  77. package/dist/cjs/components/primitives/Button/Button.cjs.map +1 -1
  78. package/dist/cjs/components/primitives/Button/Button.styles.cjs.map +1 -1
  79. package/dist/cjs/components/primitives/Card/Card.cjs.map +1 -1
  80. package/dist/cjs/components/primitives/Card/Card.styles.cjs.map +1 -1
  81. package/dist/cjs/components/primitives/Checkbox/Checkbox.cjs.map +1 -1
  82. package/dist/cjs/components/primitives/Checkbox/Checkbox.styles.cjs.map +1 -1
  83. package/dist/cjs/components/primitives/CopyableText/CopyableText.cjs.map +1 -1
  84. package/dist/cjs/components/primitives/CopyableText/CopyableText.styles.cjs.map +1 -1
  85. package/dist/cjs/components/primitives/DatePicker/DatePicker.cjs.map +1 -1
  86. package/dist/cjs/components/primitives/DatePicker/DatePicker.styles.cjs.map +1 -1
  87. package/dist/cjs/components/primitives/Dialog/Dialog.cjs.map +1 -1
  88. package/dist/cjs/components/primitives/Dialog/Dialog.styles.cjs.map +1 -1
  89. package/dist/cjs/components/primitives/Divider/Divider.cjs.map +1 -1
  90. package/dist/cjs/components/primitives/Divider/Divider.styles.cjs.map +1 -1
  91. package/dist/cjs/components/primitives/FormControl/FormControl.cjs.map +1 -1
  92. package/dist/cjs/components/primitives/FormControl/FormControl.styles.cjs.map +1 -1
  93. package/dist/cjs/components/primitives/Icons/ArrowLeftRight.cjs.map +1 -1
  94. package/dist/cjs/components/primitives/Icons/ArrowRightLeft.cjs.map +1 -1
  95. package/dist/cjs/components/primitives/Icons/BuildingAlt.cjs.map +1 -1
  96. package/dist/cjs/components/primitives/Icons/Check.cjs.map +1 -1
  97. package/dist/cjs/components/primitives/Icons/ChevronDown.cjs.map +1 -1
  98. package/dist/cjs/components/primitives/Icons/CircleAlert.cjs.map +1 -1
  99. package/dist/cjs/components/primitives/Icons/CircleCheck.cjs.map +1 -1
  100. package/dist/cjs/components/primitives/Icons/Eye.cjs.map +1 -1
  101. package/dist/cjs/components/primitives/Icons/EyeOff.cjs.map +1 -1
  102. package/dist/cjs/components/primitives/Icons/Info.cjs.map +1 -1
  103. package/dist/cjs/components/primitives/Icons/LogOut.cjs.map +1 -1
  104. package/dist/cjs/components/primitives/Icons/Plus.cjs.map +1 -1
  105. package/dist/cjs/components/primitives/Icons/TriangleAlert.cjs.map +1 -1
  106. package/dist/cjs/components/primitives/Icons/User.cjs.map +1 -1
  107. package/dist/cjs/components/primitives/Icons/X.cjs.map +1 -1
  108. package/dist/cjs/components/primitives/Icons/flowIconRegistry.cjs.map +1 -1
  109. package/dist/cjs/components/primitives/InputLabel/InputLabel.cjs.map +1 -1
  110. package/dist/cjs/components/primitives/InputLabel/InputLabel.styles.cjs.map +1 -1
  111. package/dist/cjs/components/primitives/KeyValueInput/KeyValueInput.cjs.map +1 -1
  112. package/dist/cjs/components/primitives/KeyValueInput/KeyValueInput.styles.cjs.map +1 -1
  113. package/dist/cjs/components/primitives/Logo/Logo.cjs.map +1 -1
  114. package/dist/cjs/components/primitives/Logo/Logo.styles.cjs.map +1 -1
  115. package/dist/cjs/components/primitives/MultiInput/MultiInput.cjs.map +1 -1
  116. package/dist/cjs/components/primitives/MultiInput/MultiInput.styles.cjs.map +1 -1
  117. package/dist/cjs/components/primitives/OtpField/OtpField.cjs.map +1 -1
  118. package/dist/cjs/components/primitives/OtpField/OtpField.styles.cjs.map +1 -1
  119. package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs.map +1 -1
  120. package/dist/cjs/components/primitives/PasswordField/PasswordField.styles.cjs.map +1 -1
  121. package/dist/cjs/components/primitives/Select/Select.cjs.map +1 -1
  122. package/dist/cjs/components/primitives/Select/Select.styles.cjs.map +1 -1
  123. package/dist/cjs/components/primitives/Spinner/Spinner.cjs.map +1 -1
  124. package/dist/cjs/components/primitives/Spinner/Spinner.styles.cjs.map +1 -1
  125. package/dist/cjs/components/primitives/TextField/TextField.cjs.map +1 -1
  126. package/dist/cjs/components/primitives/TextField/TextField.styles.cjs.map +1 -1
  127. package/dist/cjs/components/primitives/Toggle/Toggle.cjs.map +1 -1
  128. package/dist/cjs/components/primitives/Toggle/Toggle.styles.cjs.map +1 -1
  129. package/dist/cjs/components/primitives/Tooltip/Tooltip.cjs.map +1 -1
  130. package/dist/cjs/components/primitives/Tooltip/Tooltip.styles.cjs.map +1 -1
  131. package/dist/cjs/components/primitives/Typography/Typography.cjs.map +1 -1
  132. package/dist/cjs/components/primitives/Typography/Typography.styles.cjs.map +1 -1
  133. package/dist/cjs/contexts/ComponentRenderer/ComponentRendererContext.cjs.map +1 -1
  134. package/dist/cjs/contexts/ComponentRenderer/ComponentRendererProvider.cjs.map +1 -1
  135. package/dist/cjs/contexts/Flow/FlowContext.cjs.map +1 -1
  136. package/dist/cjs/contexts/Flow/FlowProvider.cjs.map +1 -1
  137. package/dist/cjs/contexts/Flow/useFlow.cjs.map +1 -1
  138. package/dist/cjs/contexts/FlowMeta/FlowMetaContext.cjs.map +1 -1
  139. package/dist/cjs/contexts/FlowMeta/FlowMetaProvider.cjs +5 -1
  140. package/dist/cjs/contexts/FlowMeta/FlowMetaProvider.cjs.map +1 -1
  141. package/dist/cjs/contexts/FlowMeta/useFlowMeta.cjs.map +1 -1
  142. package/dist/cjs/contexts/I18n/ComponentPreferencesContext.cjs.map +1 -1
  143. package/dist/cjs/contexts/I18n/I18nContext.cjs.map +1 -1
  144. package/dist/cjs/contexts/I18n/I18nProvider.cjs.map +1 -1
  145. package/dist/cjs/contexts/I18n/useI18n.cjs.map +1 -1
  146. package/dist/cjs/contexts/Theme/ThemeContext.cjs.map +1 -1
  147. package/dist/cjs/contexts/Theme/ThemeProvider.cjs.map +1 -1
  148. package/dist/cjs/contexts/Theme/useTheme.cjs.map +1 -1
  149. package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs.map +1 -1
  150. package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs +33 -17
  151. package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
  152. package/dist/cjs/contexts/ThunderID/useThunderID.cjs.map +1 -1
  153. package/dist/cjs/contexts/User/UserContext.cjs.map +1 -1
  154. package/dist/cjs/contexts/User/UserProvider.cjs.map +1 -1
  155. package/dist/cjs/contexts/User/useUser.cjs.map +1 -1
  156. package/dist/cjs/hooks/useBrowserUrl.cjs.map +1 -1
  157. package/dist/cjs/hooks/useForm.cjs.map +1 -1
  158. package/dist/cjs/hooks/useOAuthCallback.cjs.map +1 -1
  159. package/dist/cjs/hooks/useTranslation.cjs.map +1 -1
  160. package/dist/cjs/utils/applyThemeToDOM.cjs.map +1 -1
  161. package/dist/cjs/utils/buildThemeConfigFromFlowMeta.cjs.map +1 -1
  162. package/dist/cjs/utils/composeAffixedInputs.cjs.map +1 -1
  163. package/dist/cjs/utils/flowTransformer.cjs.map +1 -1
  164. package/dist/cjs/utils/getAuthComponentHeadings.cjs.map +1 -1
  165. package/dist/cjs/utils/getDisplayName.cjs.map +1 -1
  166. package/dist/cjs/utils/getMappedUserProfileValue.cjs.map +1 -1
  167. package/dist/cjs/utils/normalizeThemeConfig.cjs.map +1 -1
  168. package/dist/cjs/utils/oauth.cjs.map +1 -1
  169. package/dist/cjs/utils/passkey.cjs.map +1 -1
  170. package/dist/cjs/utils/resolveTranslationsInArray.cjs.map +1 -1
  171. package/dist/cjs/utils/resolveTranslationsInObject.cjs.map +1 -1
  172. package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +0 -17
  173. package/dist/components/actions/SignInButton/BaseSignInButton.d.ts.map +1 -1
  174. package/dist/components/actions/SignInButton/BaseSignInButton.js.map +1 -1
  175. package/dist/components/actions/SignInButton/SignInButton.d.ts +0 -17
  176. package/dist/components/actions/SignInButton/SignInButton.d.ts.map +1 -1
  177. package/dist/components/actions/SignInButton/SignInButton.js.map +1 -1
  178. package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +0 -17
  179. package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts.map +1 -1
  180. package/dist/components/actions/SignOutButton/BaseSignOutButton.js.map +1 -1
  181. package/dist/components/actions/SignOutButton/SignOutButton.d.ts +0 -17
  182. package/dist/components/actions/SignOutButton/SignOutButton.d.ts.map +1 -1
  183. package/dist/components/actions/SignOutButton/SignOutButton.js.map +1 -1
  184. package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +0 -17
  185. package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts.map +1 -1
  186. package/dist/components/actions/SignUpButton/BaseSignUpButton.js.map +1 -1
  187. package/dist/components/actions/SignUpButton/SignUpButton.d.ts +0 -17
  188. package/dist/components/actions/SignUpButton/SignUpButton.d.ts.map +1 -1
  189. package/dist/components/actions/SignUpButton/SignUpButton.js.map +1 -1
  190. package/dist/components/adapters/Consent.d.ts +0 -17
  191. package/dist/components/adapters/Consent.d.ts.map +1 -1
  192. package/dist/components/adapters/Consent.js.map +1 -1
  193. package/dist/components/adapters/ConsentCheckboxList.d.ts +0 -17
  194. package/dist/components/adapters/ConsentCheckboxList.d.ts.map +1 -1
  195. package/dist/components/adapters/ConsentCheckboxList.js.map +1 -1
  196. package/dist/components/adapters/ConsentCheckboxList.styles.d.ts +0 -17
  197. package/dist/components/adapters/ConsentCheckboxList.styles.d.ts.map +1 -1
  198. package/dist/components/adapters/ConsentCheckboxList.styles.js.map +1 -1
  199. package/dist/components/adapters/FacebookButton.d.ts +0 -17
  200. package/dist/components/adapters/FacebookButton.d.ts.map +1 -1
  201. package/dist/components/adapters/FacebookButton.js.map +1 -1
  202. package/dist/components/adapters/FlowTimer.d.ts +0 -17
  203. package/dist/components/adapters/FlowTimer.d.ts.map +1 -1
  204. package/dist/components/adapters/FlowTimer.js.map +1 -1
  205. package/dist/components/adapters/GitHubButton.d.ts +0 -17
  206. package/dist/components/adapters/GitHubButton.d.ts.map +1 -1
  207. package/dist/components/adapters/GitHubButton.js.map +1 -1
  208. package/dist/components/adapters/GoogleButton.d.ts +0 -17
  209. package/dist/components/adapters/GoogleButton.d.ts.map +1 -1
  210. package/dist/components/adapters/GoogleButton.js.map +1 -1
  211. package/dist/components/adapters/ImageComponent.d.ts +0 -17
  212. package/dist/components/adapters/ImageComponent.d.ts.map +1 -1
  213. package/dist/components/adapters/ImageComponent.js.map +1 -1
  214. package/dist/components/adapters/LinkedInButton.d.ts +0 -17
  215. package/dist/components/adapters/LinkedInButton.d.ts.map +1 -1
  216. package/dist/components/adapters/LinkedInButton.js.map +1 -1
  217. package/dist/components/adapters/MicrosoftButton.d.ts +0 -17
  218. package/dist/components/adapters/MicrosoftButton.d.ts.map +1 -1
  219. package/dist/components/adapters/MicrosoftButton.js.map +1 -1
  220. package/dist/components/adapters/SignInWithEthereumButton.d.ts +0 -17
  221. package/dist/components/adapters/SignInWithEthereumButton.d.ts.map +1 -1
  222. package/dist/components/adapters/SignInWithEthereumButton.js.map +1 -1
  223. package/dist/components/adapters/SmsOtpButton.d.ts +0 -17
  224. package/dist/components/adapters/SmsOtpButton.d.ts.map +1 -1
  225. package/dist/components/adapters/SmsOtpButton.js.map +1 -1
  226. package/dist/components/auth/Callback/Callback.d.ts.map +1 -1
  227. package/dist/components/auth/Callback/Callback.js.map +1 -1
  228. package/dist/components/auth/Callback/OAuthCallback.d.ts +0 -17
  229. package/dist/components/auth/Callback/OAuthCallback.d.ts.map +1 -1
  230. package/dist/components/auth/Callback/OAuthCallback.js.map +1 -1
  231. package/dist/components/auth/Callback/TokenCallback.d.ts +0 -16
  232. package/dist/components/auth/Callback/TokenCallback.d.ts.map +1 -1
  233. package/dist/components/auth/Callback/TokenCallback.js.map +1 -1
  234. package/dist/components/control/Loading.d.ts +0 -17
  235. package/dist/components/control/Loading.d.ts.map +1 -1
  236. package/dist/components/control/Loading.js.map +1 -1
  237. package/dist/components/control/SignedIn.d.ts +0 -17
  238. package/dist/components/control/SignedIn.d.ts.map +1 -1
  239. package/dist/components/control/SignedIn.js.map +1 -1
  240. package/dist/components/control/SignedOut.d.ts +0 -17
  241. package/dist/components/control/SignedOut.d.ts.map +1 -1
  242. package/dist/components/control/SignedOut.js.map +1 -1
  243. package/dist/components/factories/FieldFactory.d.ts +0 -17
  244. package/dist/components/factories/FieldFactory.d.ts.map +1 -1
  245. package/dist/components/factories/FieldFactory.js.map +1 -1
  246. package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.d.ts +0 -17
  247. package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.d.ts.map +1 -1
  248. package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.js.map +1 -1
  249. package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.d.ts +0 -17
  250. package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.d.ts.map +1 -1
  251. package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.js.map +1 -1
  252. package/dist/components/presentation/LanguageSwitcher/LanguageSwitcher.d.ts +0 -17
  253. package/dist/components/presentation/LanguageSwitcher/LanguageSwitcher.d.ts.map +1 -1
  254. package/dist/components/presentation/LanguageSwitcher/LanguageSwitcher.js.map +1 -1
  255. package/dist/components/presentation/User/BaseUser.d.ts +0 -17
  256. package/dist/components/presentation/User/BaseUser.d.ts.map +1 -1
  257. package/dist/components/presentation/User/BaseUser.js.map +1 -1
  258. package/dist/components/presentation/User/User.d.ts +0 -17
  259. package/dist/components/presentation/User/User.d.ts.map +1 -1
  260. package/dist/components/presentation/User/User.js.map +1 -1
  261. package/dist/components/presentation/UserAvatar/BaseUserAvatar.d.ts +0 -17
  262. package/dist/components/presentation/UserAvatar/BaseUserAvatar.d.ts.map +1 -1
  263. package/dist/components/presentation/UserAvatar/BaseUserAvatar.js.map +1 -1
  264. package/dist/components/presentation/UserAvatar/UserAvatar.d.ts +0 -17
  265. package/dist/components/presentation/UserAvatar/UserAvatar.d.ts.map +1 -1
  266. package/dist/components/presentation/UserAvatar/UserAvatar.js.map +1 -1
  267. package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +0 -17
  268. package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts.map +1 -1
  269. package/dist/components/presentation/UserDropdown/BaseUserDropdown.js.map +1 -1
  270. package/dist/components/presentation/UserDropdown/BaseUserDropdown.styles.d.ts +0 -17
  271. package/dist/components/presentation/UserDropdown/BaseUserDropdown.styles.d.ts.map +1 -1
  272. package/dist/components/presentation/UserDropdown/BaseUserDropdown.styles.js.map +1 -1
  273. package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +0 -17
  274. package/dist/components/presentation/UserDropdown/UserDropdown.d.ts.map +1 -1
  275. package/dist/components/presentation/UserDropdown/UserDropdown.js.map +1 -1
  276. package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +0 -17
  277. package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts.map +1 -1
  278. package/dist/components/presentation/UserProfile/BaseUserProfile.js.map +1 -1
  279. package/dist/components/presentation/UserProfile/BaseUserProfile.styles.d.ts +0 -17
  280. package/dist/components/presentation/UserProfile/BaseUserProfile.styles.d.ts.map +1 -1
  281. package/dist/components/presentation/UserProfile/BaseUserProfile.styles.js.map +1 -1
  282. package/dist/components/presentation/UserProfile/UserProfile.d.ts +0 -17
  283. package/dist/components/presentation/UserProfile/UserProfile.d.ts.map +1 -1
  284. package/dist/components/presentation/UserProfile/UserProfile.js.map +1 -1
  285. package/dist/components/presentation/auth/AcceptInvite/AcceptInvite.d.ts +0 -17
  286. package/dist/components/presentation/auth/AcceptInvite/AcceptInvite.d.ts.map +1 -1
  287. package/dist/components/presentation/auth/AcceptInvite/AcceptInvite.js +2 -4
  288. package/dist/components/presentation/auth/AcceptInvite/AcceptInvite.js.map +1 -1
  289. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.d.ts +0 -17
  290. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.d.ts.map +1 -1
  291. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js.map +1 -1
  292. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.styles.d.ts +0 -17
  293. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.styles.d.ts.map +1 -1
  294. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.styles.js.map +1 -1
  295. package/dist/components/presentation/auth/AcceptInvite/index.d.ts +0 -17
  296. package/dist/components/presentation/auth/AcceptInvite/index.d.ts.map +1 -1
  297. package/dist/components/presentation/auth/AuthOptionFactory.d.ts +0 -17
  298. package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
  299. package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
  300. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.d.ts +0 -17
  301. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.d.ts.map +1 -1
  302. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js.map +1 -1
  303. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.styles.d.ts +0 -17
  304. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.styles.d.ts.map +1 -1
  305. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.styles.js.map +1 -1
  306. package/dist/components/presentation/auth/InviteUser/InviteUser.d.ts +0 -17
  307. package/dist/components/presentation/auth/InviteUser/InviteUser.d.ts.map +1 -1
  308. package/dist/components/presentation/auth/InviteUser/InviteUser.js +5 -4
  309. package/dist/components/presentation/auth/InviteUser/InviteUser.js.map +1 -1
  310. package/dist/components/presentation/auth/InviteUser/index.d.ts +0 -17
  311. package/dist/components/presentation/auth/InviteUser/index.d.ts.map +1 -1
  312. package/dist/components/presentation/auth/Recovery/BaseRecovery.d.ts +0 -17
  313. package/dist/components/presentation/auth/Recovery/BaseRecovery.d.ts.map +1 -1
  314. package/dist/components/presentation/auth/Recovery/BaseRecovery.js.map +1 -1
  315. package/dist/components/presentation/auth/Recovery/Recovery.d.ts +0 -17
  316. package/dist/components/presentation/auth/Recovery/Recovery.d.ts.map +1 -1
  317. package/dist/components/presentation/auth/Recovery/Recovery.js.map +1 -1
  318. package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts +0 -17
  319. package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts.map +1 -1
  320. package/dist/components/presentation/auth/SignIn/BaseSignIn.js.map +1 -1
  321. package/dist/components/presentation/auth/SignIn/BaseSignIn.styles.d.ts +0 -17
  322. package/dist/components/presentation/auth/SignIn/BaseSignIn.styles.d.ts.map +1 -1
  323. package/dist/components/presentation/auth/SignIn/BaseSignIn.styles.js.map +1 -1
  324. package/dist/components/presentation/auth/SignIn/SignIn.d.ts +0 -17
  325. package/dist/components/presentation/auth/SignIn/SignIn.d.ts.map +1 -1
  326. package/dist/components/presentation/auth/SignIn/SignIn.js +10 -1
  327. package/dist/components/presentation/auth/SignIn/SignIn.js.map +1 -1
  328. package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts +0 -17
  329. package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts.map +1 -1
  330. package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -1
  331. package/dist/components/presentation/auth/SignUp/BaseSignUp.styles.d.ts +0 -17
  332. package/dist/components/presentation/auth/SignUp/BaseSignUp.styles.d.ts.map +1 -1
  333. package/dist/components/presentation/auth/SignUp/BaseSignUp.styles.js.map +1 -1
  334. package/dist/components/presentation/auth/SignUp/SignUp.d.ts +0 -17
  335. package/dist/components/presentation/auth/SignUp/SignUp.d.ts.map +1 -1
  336. package/dist/components/presentation/auth/SignUp/SignUp.js.map +1 -1
  337. package/dist/components/primitives/AffixedField/AffixedField.d.ts +0 -17
  338. package/dist/components/primitives/AffixedField/AffixedField.d.ts.map +1 -1
  339. package/dist/components/primitives/AffixedField/AffixedField.js.map +1 -1
  340. package/dist/components/primitives/AffixedField/AffixedField.styles.d.ts +0 -17
  341. package/dist/components/primitives/AffixedField/AffixedField.styles.d.ts.map +1 -1
  342. package/dist/components/primitives/AffixedField/AffixedField.styles.js.map +1 -1
  343. package/dist/components/primitives/AffixedField/index.d.ts +0 -17
  344. package/dist/components/primitives/AffixedField/index.d.ts.map +1 -1
  345. package/dist/components/primitives/Alert/Alert.d.ts +0 -17
  346. package/dist/components/primitives/Alert/Alert.d.ts.map +1 -1
  347. package/dist/components/primitives/Alert/Alert.js.map +1 -1
  348. package/dist/components/primitives/Alert/Alert.styles.d.ts +0 -17
  349. package/dist/components/primitives/Alert/Alert.styles.d.ts.map +1 -1
  350. package/dist/components/primitives/Alert/Alert.styles.js.map +1 -1
  351. package/dist/components/primitives/Avatar/Avatar.d.ts +0 -17
  352. package/dist/components/primitives/Avatar/Avatar.d.ts.map +1 -1
  353. package/dist/components/primitives/Avatar/Avatar.js.map +1 -1
  354. package/dist/components/primitives/Avatar/Avatar.styles.d.ts +0 -17
  355. package/dist/components/primitives/Avatar/Avatar.styles.d.ts.map +1 -1
  356. package/dist/components/primitives/Avatar/Avatar.styles.js.map +1 -1
  357. package/dist/components/primitives/Button/Button.d.ts +0 -17
  358. package/dist/components/primitives/Button/Button.d.ts.map +1 -1
  359. package/dist/components/primitives/Button/Button.js.map +1 -1
  360. package/dist/components/primitives/Button/Button.styles.d.ts +0 -17
  361. package/dist/components/primitives/Button/Button.styles.d.ts.map +1 -1
  362. package/dist/components/primitives/Button/Button.styles.js.map +1 -1
  363. package/dist/components/primitives/Card/Card.d.ts +0 -17
  364. package/dist/components/primitives/Card/Card.d.ts.map +1 -1
  365. package/dist/components/primitives/Card/Card.js.map +1 -1
  366. package/dist/components/primitives/Card/Card.styles.d.ts +0 -17
  367. package/dist/components/primitives/Card/Card.styles.d.ts.map +1 -1
  368. package/dist/components/primitives/Card/Card.styles.js.map +1 -1
  369. package/dist/components/primitives/Checkbox/Checkbox.d.ts +0 -17
  370. package/dist/components/primitives/Checkbox/Checkbox.d.ts.map +1 -1
  371. package/dist/components/primitives/Checkbox/Checkbox.js.map +1 -1
  372. package/dist/components/primitives/Checkbox/Checkbox.styles.d.ts +0 -17
  373. package/dist/components/primitives/Checkbox/Checkbox.styles.d.ts.map +1 -1
  374. package/dist/components/primitives/Checkbox/Checkbox.styles.js.map +1 -1
  375. package/dist/components/primitives/CopyableText/CopyableText.d.ts +0 -17
  376. package/dist/components/primitives/CopyableText/CopyableText.d.ts.map +1 -1
  377. package/dist/components/primitives/CopyableText/CopyableText.js.map +1 -1
  378. package/dist/components/primitives/CopyableText/CopyableText.styles.d.ts +0 -17
  379. package/dist/components/primitives/CopyableText/CopyableText.styles.d.ts.map +1 -1
  380. package/dist/components/primitives/CopyableText/CopyableText.styles.js.map +1 -1
  381. package/dist/components/primitives/CopyableText/index.d.ts +0 -17
  382. package/dist/components/primitives/CopyableText/index.d.ts.map +1 -1
  383. package/dist/components/primitives/DatePicker/DatePicker.d.ts +0 -17
  384. package/dist/components/primitives/DatePicker/DatePicker.d.ts.map +1 -1
  385. package/dist/components/primitives/DatePicker/DatePicker.js.map +1 -1
  386. package/dist/components/primitives/DatePicker/DatePicker.styles.d.ts +0 -17
  387. package/dist/components/primitives/DatePicker/DatePicker.styles.d.ts.map +1 -1
  388. package/dist/components/primitives/DatePicker/DatePicker.styles.js.map +1 -1
  389. package/dist/components/primitives/Dialog/Dialog.d.ts +0 -17
  390. package/dist/components/primitives/Dialog/Dialog.d.ts.map +1 -1
  391. package/dist/components/primitives/Dialog/Dialog.js.map +1 -1
  392. package/dist/components/primitives/Dialog/Dialog.styles.d.ts +0 -17
  393. package/dist/components/primitives/Dialog/Dialog.styles.d.ts.map +1 -1
  394. package/dist/components/primitives/Dialog/Dialog.styles.js.map +1 -1
  395. package/dist/components/primitives/Divider/Divider.d.ts +0 -17
  396. package/dist/components/primitives/Divider/Divider.d.ts.map +1 -1
  397. package/dist/components/primitives/Divider/Divider.js.map +1 -1
  398. package/dist/components/primitives/Divider/Divider.styles.d.ts +0 -17
  399. package/dist/components/primitives/Divider/Divider.styles.d.ts.map +1 -1
  400. package/dist/components/primitives/Divider/Divider.styles.js.map +1 -1
  401. package/dist/components/primitives/FormControl/FormControl.d.ts +0 -17
  402. package/dist/components/primitives/FormControl/FormControl.d.ts.map +1 -1
  403. package/dist/components/primitives/FormControl/FormControl.js.map +1 -1
  404. package/dist/components/primitives/FormControl/FormControl.styles.d.ts +0 -17
  405. package/dist/components/primitives/FormControl/FormControl.styles.d.ts.map +1 -1
  406. package/dist/components/primitives/FormControl/FormControl.styles.js.map +1 -1
  407. package/dist/components/primitives/Icons/ArrowLeftRight.d.ts +0 -17
  408. package/dist/components/primitives/Icons/ArrowLeftRight.d.ts.map +1 -1
  409. package/dist/components/primitives/Icons/ArrowLeftRight.js.map +1 -1
  410. package/dist/components/primitives/Icons/ArrowRightLeft.d.ts +0 -17
  411. package/dist/components/primitives/Icons/ArrowRightLeft.d.ts.map +1 -1
  412. package/dist/components/primitives/Icons/ArrowRightLeft.js.map +1 -1
  413. package/dist/components/primitives/Icons/Building.d.ts +0 -17
  414. package/dist/components/primitives/Icons/Building.d.ts.map +1 -1
  415. package/dist/components/primitives/Icons/BuildingAlt.d.ts +0 -17
  416. package/dist/components/primitives/Icons/BuildingAlt.d.ts.map +1 -1
  417. package/dist/components/primitives/Icons/BuildingAlt.js.map +1 -1
  418. package/dist/components/primitives/Icons/Check.d.ts +0 -17
  419. package/dist/components/primitives/Icons/Check.d.ts.map +1 -1
  420. package/dist/components/primitives/Icons/Check.js.map +1 -1
  421. package/dist/components/primitives/Icons/ChevronDown.d.ts +0 -17
  422. package/dist/components/primitives/Icons/ChevronDown.d.ts.map +1 -1
  423. package/dist/components/primitives/Icons/ChevronDown.js.map +1 -1
  424. package/dist/components/primitives/Icons/CircleAlert.d.ts +0 -17
  425. package/dist/components/primitives/Icons/CircleAlert.d.ts.map +1 -1
  426. package/dist/components/primitives/Icons/CircleAlert.js.map +1 -1
  427. package/dist/components/primitives/Icons/CircleCheck.d.ts +0 -17
  428. package/dist/components/primitives/Icons/CircleCheck.d.ts.map +1 -1
  429. package/dist/components/primitives/Icons/CircleCheck.js.map +1 -1
  430. package/dist/components/primitives/Icons/Eye.d.ts +0 -17
  431. package/dist/components/primitives/Icons/Eye.d.ts.map +1 -1
  432. package/dist/components/primitives/Icons/Eye.js.map +1 -1
  433. package/dist/components/primitives/Icons/EyeOff.d.ts +0 -17
  434. package/dist/components/primitives/Icons/EyeOff.d.ts.map +1 -1
  435. package/dist/components/primitives/Icons/EyeOff.js.map +1 -1
  436. package/dist/components/primitives/Icons/Info.d.ts +0 -17
  437. package/dist/components/primitives/Icons/Info.d.ts.map +1 -1
  438. package/dist/components/primitives/Icons/Info.js.map +1 -1
  439. package/dist/components/primitives/Icons/LogOut.d.ts +0 -17
  440. package/dist/components/primitives/Icons/LogOut.d.ts.map +1 -1
  441. package/dist/components/primitives/Icons/LogOut.js.map +1 -1
  442. package/dist/components/primitives/Icons/Plus.d.ts +0 -17
  443. package/dist/components/primitives/Icons/Plus.d.ts.map +1 -1
  444. package/dist/components/primitives/Icons/Plus.js.map +1 -1
  445. package/dist/components/primitives/Icons/TriangleAlert.d.ts +0 -17
  446. package/dist/components/primitives/Icons/TriangleAlert.d.ts.map +1 -1
  447. package/dist/components/primitives/Icons/TriangleAlert.js.map +1 -1
  448. package/dist/components/primitives/Icons/User.d.ts +0 -17
  449. package/dist/components/primitives/Icons/User.d.ts.map +1 -1
  450. package/dist/components/primitives/Icons/User.js.map +1 -1
  451. package/dist/components/primitives/Icons/X.d.ts +0 -17
  452. package/dist/components/primitives/Icons/X.d.ts.map +1 -1
  453. package/dist/components/primitives/Icons/X.js.map +1 -1
  454. package/dist/components/primitives/Icons/flowIconRegistry.d.ts +0 -17
  455. package/dist/components/primitives/Icons/flowIconRegistry.d.ts.map +1 -1
  456. package/dist/components/primitives/Icons/flowIconRegistry.js.map +1 -1
  457. package/dist/components/primitives/Icons/index.d.ts +0 -17
  458. package/dist/components/primitives/Icons/index.d.ts.map +1 -1
  459. package/dist/components/primitives/InputLabel/InputLabel.d.ts +0 -17
  460. package/dist/components/primitives/InputLabel/InputLabel.d.ts.map +1 -1
  461. package/dist/components/primitives/InputLabel/InputLabel.js.map +1 -1
  462. package/dist/components/primitives/InputLabel/InputLabel.styles.d.ts +0 -17
  463. package/dist/components/primitives/InputLabel/InputLabel.styles.d.ts.map +1 -1
  464. package/dist/components/primitives/InputLabel/InputLabel.styles.js.map +1 -1
  465. package/dist/components/primitives/KeyValueInput/KeyValueInput.d.ts +0 -17
  466. package/dist/components/primitives/KeyValueInput/KeyValueInput.d.ts.map +1 -1
  467. package/dist/components/primitives/KeyValueInput/KeyValueInput.js.map +1 -1
  468. package/dist/components/primitives/KeyValueInput/KeyValueInput.styles.d.ts +0 -17
  469. package/dist/components/primitives/KeyValueInput/KeyValueInput.styles.d.ts.map +1 -1
  470. package/dist/components/primitives/KeyValueInput/KeyValueInput.styles.js.map +1 -1
  471. package/dist/components/primitives/Logo/Logo.d.ts +0 -17
  472. package/dist/components/primitives/Logo/Logo.d.ts.map +1 -1
  473. package/dist/components/primitives/Logo/Logo.js.map +1 -1
  474. package/dist/components/primitives/Logo/Logo.styles.d.ts +0 -17
  475. package/dist/components/primitives/Logo/Logo.styles.d.ts.map +1 -1
  476. package/dist/components/primitives/Logo/Logo.styles.js.map +1 -1
  477. package/dist/components/primitives/MultiInput/MultiInput.d.ts +0 -17
  478. package/dist/components/primitives/MultiInput/MultiInput.d.ts.map +1 -1
  479. package/dist/components/primitives/MultiInput/MultiInput.js.map +1 -1
  480. package/dist/components/primitives/MultiInput/MultiInput.styles.d.ts +0 -17
  481. package/dist/components/primitives/MultiInput/MultiInput.styles.d.ts.map +1 -1
  482. package/dist/components/primitives/MultiInput/MultiInput.styles.js.map +1 -1
  483. package/dist/components/primitives/OtpField/OtpField.d.ts +0 -17
  484. package/dist/components/primitives/OtpField/OtpField.d.ts.map +1 -1
  485. package/dist/components/primitives/OtpField/OtpField.js.map +1 -1
  486. package/dist/components/primitives/OtpField/OtpField.styles.d.ts +0 -17
  487. package/dist/components/primitives/OtpField/OtpField.styles.d.ts.map +1 -1
  488. package/dist/components/primitives/OtpField/OtpField.styles.js.map +1 -1
  489. package/dist/components/primitives/PasswordField/PasswordField.d.ts +0 -17
  490. package/dist/components/primitives/PasswordField/PasswordField.d.ts.map +1 -1
  491. package/dist/components/primitives/PasswordField/PasswordField.js.map +1 -1
  492. package/dist/components/primitives/PasswordField/PasswordField.styles.d.ts +0 -17
  493. package/dist/components/primitives/PasswordField/PasswordField.styles.d.ts.map +1 -1
  494. package/dist/components/primitives/PasswordField/PasswordField.styles.js.map +1 -1
  495. package/dist/components/primitives/Select/Select.d.ts +0 -17
  496. package/dist/components/primitives/Select/Select.d.ts.map +1 -1
  497. package/dist/components/primitives/Select/Select.js.map +1 -1
  498. package/dist/components/primitives/Select/Select.styles.d.ts +0 -17
  499. package/dist/components/primitives/Select/Select.styles.d.ts.map +1 -1
  500. package/dist/components/primitives/Select/Select.styles.js.map +1 -1
  501. package/dist/components/primitives/Spinner/Spinner.d.ts +0 -17
  502. package/dist/components/primitives/Spinner/Spinner.d.ts.map +1 -1
  503. package/dist/components/primitives/Spinner/Spinner.js.map +1 -1
  504. package/dist/components/primitives/Spinner/Spinner.styles.d.ts +0 -17
  505. package/dist/components/primitives/Spinner/Spinner.styles.d.ts.map +1 -1
  506. package/dist/components/primitives/Spinner/Spinner.styles.js.map +1 -1
  507. package/dist/components/primitives/TextField/TextField.d.ts +0 -17
  508. package/dist/components/primitives/TextField/TextField.d.ts.map +1 -1
  509. package/dist/components/primitives/TextField/TextField.js.map +1 -1
  510. package/dist/components/primitives/TextField/TextField.styles.d.ts +0 -17
  511. package/dist/components/primitives/TextField/TextField.styles.d.ts.map +1 -1
  512. package/dist/components/primitives/TextField/TextField.styles.js.map +1 -1
  513. package/dist/components/primitives/Toggle/Toggle.d.ts +0 -17
  514. package/dist/components/primitives/Toggle/Toggle.d.ts.map +1 -1
  515. package/dist/components/primitives/Toggle/Toggle.js.map +1 -1
  516. package/dist/components/primitives/Toggle/Toggle.styles.d.ts +0 -17
  517. package/dist/components/primitives/Toggle/Toggle.styles.d.ts.map +1 -1
  518. package/dist/components/primitives/Toggle/Toggle.styles.js.map +1 -1
  519. package/dist/components/primitives/Tooltip/Tooltip.d.ts +0 -17
  520. package/dist/components/primitives/Tooltip/Tooltip.d.ts.map +1 -1
  521. package/dist/components/primitives/Tooltip/Tooltip.js.map +1 -1
  522. package/dist/components/primitives/Tooltip/Tooltip.styles.d.ts +0 -17
  523. package/dist/components/primitives/Tooltip/Tooltip.styles.d.ts.map +1 -1
  524. package/dist/components/primitives/Tooltip/Tooltip.styles.js.map +1 -1
  525. package/dist/components/primitives/Typography/Typography.d.ts +0 -17
  526. package/dist/components/primitives/Typography/Typography.d.ts.map +1 -1
  527. package/dist/components/primitives/Typography/Typography.js.map +1 -1
  528. package/dist/components/primitives/Typography/Typography.styles.d.ts +0 -17
  529. package/dist/components/primitives/Typography/Typography.styles.d.ts.map +1 -1
  530. package/dist/components/primitives/Typography/Typography.styles.js.map +1 -1
  531. package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts +0 -17
  532. package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts.map +1 -1
  533. package/dist/contexts/ComponentRenderer/ComponentRendererContext.js.map +1 -1
  534. package/dist/contexts/ComponentRenderer/ComponentRendererProvider.d.ts +0 -17
  535. package/dist/contexts/ComponentRenderer/ComponentRendererProvider.d.ts.map +1 -1
  536. package/dist/contexts/ComponentRenderer/ComponentRendererProvider.js.map +1 -1
  537. package/dist/contexts/Flow/FlowContext.d.ts +0 -17
  538. package/dist/contexts/Flow/FlowContext.d.ts.map +1 -1
  539. package/dist/contexts/Flow/FlowContext.js.map +1 -1
  540. package/dist/contexts/Flow/FlowProvider.d.ts +0 -17
  541. package/dist/contexts/Flow/FlowProvider.d.ts.map +1 -1
  542. package/dist/contexts/Flow/FlowProvider.js.map +1 -1
  543. package/dist/contexts/Flow/useFlow.d.ts +0 -17
  544. package/dist/contexts/Flow/useFlow.d.ts.map +1 -1
  545. package/dist/contexts/Flow/useFlow.js.map +1 -1
  546. package/dist/contexts/FlowMeta/FlowMetaContext.d.ts +0 -17
  547. package/dist/contexts/FlowMeta/FlowMetaContext.d.ts.map +1 -1
  548. package/dist/contexts/FlowMeta/FlowMetaContext.js.map +1 -1
  549. package/dist/contexts/FlowMeta/FlowMetaProvider.d.ts +0 -17
  550. package/dist/contexts/FlowMeta/FlowMetaProvider.d.ts.map +1 -1
  551. package/dist/contexts/FlowMeta/FlowMetaProvider.js +6 -2
  552. package/dist/contexts/FlowMeta/FlowMetaProvider.js.map +1 -1
  553. package/dist/contexts/FlowMeta/useFlowMeta.d.ts +0 -17
  554. package/dist/contexts/FlowMeta/useFlowMeta.d.ts.map +1 -1
  555. package/dist/contexts/FlowMeta/useFlowMeta.js.map +1 -1
  556. package/dist/contexts/I18n/ComponentPreferencesContext.d.ts +0 -17
  557. package/dist/contexts/I18n/ComponentPreferencesContext.d.ts.map +1 -1
  558. package/dist/contexts/I18n/ComponentPreferencesContext.js.map +1 -1
  559. package/dist/contexts/I18n/I18nContext.d.ts +0 -17
  560. package/dist/contexts/I18n/I18nContext.d.ts.map +1 -1
  561. package/dist/contexts/I18n/I18nContext.js.map +1 -1
  562. package/dist/contexts/I18n/I18nProvider.d.ts +0 -17
  563. package/dist/contexts/I18n/I18nProvider.d.ts.map +1 -1
  564. package/dist/contexts/I18n/I18nProvider.js.map +1 -1
  565. package/dist/contexts/I18n/useI18n.d.ts +0 -17
  566. package/dist/contexts/I18n/useI18n.d.ts.map +1 -1
  567. package/dist/contexts/I18n/useI18n.js.map +1 -1
  568. package/dist/contexts/Theme/ThemeContext.d.ts +0 -17
  569. package/dist/contexts/Theme/ThemeContext.d.ts.map +1 -1
  570. package/dist/contexts/Theme/ThemeContext.js.map +1 -1
  571. package/dist/contexts/Theme/ThemeProvider.d.ts +0 -17
  572. package/dist/contexts/Theme/ThemeProvider.d.ts.map +1 -1
  573. package/dist/contexts/Theme/ThemeProvider.js.map +1 -1
  574. package/dist/contexts/Theme/types.d.ts +0 -17
  575. package/dist/contexts/Theme/types.d.ts.map +1 -1
  576. package/dist/contexts/Theme/useTheme.d.ts +0 -17
  577. package/dist/contexts/Theme/useTheme.d.ts.map +1 -1
  578. package/dist/contexts/Theme/useTheme.js.map +1 -1
  579. package/dist/contexts/ThunderID/ThunderIDContext.d.ts +5 -17
  580. package/dist/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -1
  581. package/dist/contexts/ThunderID/ThunderIDContext.js.map +1 -1
  582. package/dist/contexts/ThunderID/ThunderIDProvider.d.ts +0 -17
  583. package/dist/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
  584. package/dist/contexts/ThunderID/ThunderIDProvider.js +34 -18
  585. package/dist/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
  586. package/dist/contexts/ThunderID/useThunderID.d.ts +0 -17
  587. package/dist/contexts/ThunderID/useThunderID.d.ts.map +1 -1
  588. package/dist/contexts/ThunderID/useThunderID.js.map +1 -1
  589. package/dist/contexts/User/UserContext.d.ts +0 -17
  590. package/dist/contexts/User/UserContext.d.ts.map +1 -1
  591. package/dist/contexts/User/UserContext.js.map +1 -1
  592. package/dist/contexts/User/UserProvider.d.ts +0 -17
  593. package/dist/contexts/User/UserProvider.d.ts.map +1 -1
  594. package/dist/contexts/User/UserProvider.js.map +1 -1
  595. package/dist/contexts/User/useUser.d.ts +0 -17
  596. package/dist/contexts/User/useUser.d.ts.map +1 -1
  597. package/dist/contexts/User/useUser.js.map +1 -1
  598. package/dist/hooks/useBrowserUrl.d.ts +0 -17
  599. package/dist/hooks/useBrowserUrl.d.ts.map +1 -1
  600. package/dist/hooks/useBrowserUrl.js.map +1 -1
  601. package/dist/hooks/useForm.d.ts +0 -17
  602. package/dist/hooks/useForm.d.ts.map +1 -1
  603. package/dist/hooks/useForm.js.map +1 -1
  604. package/dist/hooks/useOAuthCallback.d.ts +0 -17
  605. package/dist/hooks/useOAuthCallback.d.ts.map +1 -1
  606. package/dist/hooks/useOAuthCallback.js.map +1 -1
  607. package/dist/hooks/useTranslation.d.ts +0 -17
  608. package/dist/hooks/useTranslation.d.ts.map +1 -1
  609. package/dist/hooks/useTranslation.js.map +1 -1
  610. package/dist/index.d.ts +0 -17
  611. package/dist/index.d.ts.map +1 -1
  612. package/dist/models/adapters.d.ts +0 -17
  613. package/dist/models/adapters.d.ts.map +1 -1
  614. package/dist/models/config.d.ts +0 -17
  615. package/dist/models/config.d.ts.map +1 -1
  616. package/dist/utils/applyThemeToDOM.d.ts +0 -17
  617. package/dist/utils/applyThemeToDOM.d.ts.map +1 -1
  618. package/dist/utils/applyThemeToDOM.js.map +1 -1
  619. package/dist/utils/buildThemeConfigFromFlowMeta.d.ts +0 -17
  620. package/dist/utils/buildThemeConfigFromFlowMeta.d.ts.map +1 -1
  621. package/dist/utils/buildThemeConfigFromFlowMeta.js.map +1 -1
  622. package/dist/utils/composeAffixedInputs.d.ts +0 -17
  623. package/dist/utils/composeAffixedInputs.d.ts.map +1 -1
  624. package/dist/utils/composeAffixedInputs.js.map +1 -1
  625. package/dist/utils/flowTransformer.d.ts +0 -17
  626. package/dist/utils/flowTransformer.d.ts.map +1 -1
  627. package/dist/utils/flowTransformer.js.map +1 -1
  628. package/dist/utils/getAuthComponentHeadings.d.ts +0 -17
  629. package/dist/utils/getAuthComponentHeadings.d.ts.map +1 -1
  630. package/dist/utils/getAuthComponentHeadings.js.map +1 -1
  631. package/dist/utils/getDisplayName.d.ts +0 -17
  632. package/dist/utils/getDisplayName.d.ts.map +1 -1
  633. package/dist/utils/getDisplayName.js.map +1 -1
  634. package/dist/utils/getMappedUserProfileValue.d.ts +0 -17
  635. package/dist/utils/getMappedUserProfileValue.d.ts.map +1 -1
  636. package/dist/utils/getMappedUserProfileValue.js.map +1 -1
  637. package/dist/utils/normalizeThemeConfig.d.ts +0 -17
  638. package/dist/utils/normalizeThemeConfig.d.ts.map +1 -1
  639. package/dist/utils/normalizeThemeConfig.js.map +1 -1
  640. package/dist/utils/oauth.d.ts +0 -17
  641. package/dist/utils/oauth.d.ts.map +1 -1
  642. package/dist/utils/oauth.js.map +1 -1
  643. package/dist/utils/passkey.d.ts +0 -17
  644. package/dist/utils/passkey.d.ts.map +1 -1
  645. package/dist/utils/passkey.js.map +1 -1
  646. package/dist/utils/resolveTranslationsInArray.d.ts +0 -17
  647. package/dist/utils/resolveTranslationsInArray.d.ts.map +1 -1
  648. package/dist/utils/resolveTranslationsInArray.js.map +1 -1
  649. package/dist/utils/resolveTranslationsInObject.d.ts +0 -17
  650. package/dist/utils/resolveTranslationsInObject.d.ts.map +1 -1
  651. package/dist/utils/resolveTranslationsInObject.js.map +1 -1
  652. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.cjs","names":["ThemeProvider: FC<PropsWithChildren<ThemeProviderProps>>","themeOverride: RecursivePartial<ThemeConfig> | undefined","normalizeThemeConfig","flowMetaContext: FlowMetaContextValue | null","FlowMetaContext","flowMetaTheme: FlowMetaTheme | null","toggleTheme: () => void","finalThemeConfig: RecursivePartial<ThemeConfig> | undefined","metaConfig: RecursivePartial<ThemeConfig>","buildThemeConfigFromFlowMeta","theme: Theme","direction: 'ltr' | 'rtl'","value: any","ThemeContext"],"sources":["../../../../src/contexts/Theme/ThemeProvider.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 {createTheme, Theme, ThemeConfig, ThemeMode, RecursivePartial, FlowMetaTheme} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, useCallback, useContext, useEffect, useMemo, useState} from 'react';\nimport ThemeContext from './ThemeContext';\nimport applyThemeToDOM from '../../utils/applyThemeToDOM';\nimport buildThemeConfigFromFlowMeta from '../../utils/buildThemeConfigFromFlowMeta';\nimport normalizeThemeConfig from '../../utils/normalizeThemeConfig';\nimport FlowMetaContext, {FlowMetaContextValue} from '../FlowMeta/FlowMetaContext';\n\nexport interface ThemeProviderProps {\n /**\n * Initial color scheme override. Overrides the server default when provided.\n */\n mode?: ThemeMode;\n\n /**\n * Optional theme overrides merged on top of the server-side flow meta theme.\n * User-supplied values take highest precedence.\n */\n theme?: RecursivePartial<ThemeConfig>;\n}\n\n/**\n * ThemeProvider is the v2 drop-in replacement for `ThemeProvider`.\n *\n * It reads the design theme from the nearest `FlowMetaContext` (provided by\n * `FlowMetaProvider`) and publishes a resolved `Theme` object through the\n * **same** `ThemeContext` that `useTheme` consumes. This means all existing\n * components that call `useTheme` continue to work without any changes.\n *\n * The `defaultColorScheme` field returned by the server is used to seed the\n * active color scheme; the user can still toggle it locally via the\n * `toggleTheme` value exposed in the context.\n *\n * @example\n * ```tsx\n * <FlowMetaProvider config={{ baseUrl, type: FlowMetaType.App, id: appId }}>\n * <ThemeProvider>\n * <App /> {/* useTheme() works here as usual *\\/}\n * </ThemeProvider>\n * </FlowMetaProvider>\n * ```\n *\n * @example\n * With user theme overrides (user values win over server values):\n * ```tsx\n * <ThemeProvider theme={{ colors: { primary: { main: '#ff0000' } } }}>\n * <App />\n * </ThemeProvider>\n * ```\n */\nconst ThemeProvider: FC<PropsWithChildren<ThemeProviderProps>> = ({\n children,\n theme: themeOverrideProp,\n}: PropsWithChildren<ThemeProviderProps>): ReactElement => {\n const themeOverride: RecursivePartial<ThemeConfig> | undefined = normalizeThemeConfig(themeOverrideProp);\n const flowMetaContext: FlowMetaContextValue | null = useContext(FlowMetaContext);\n\n const flowMetaTheme: FlowMetaTheme | null = flowMetaContext?.meta?.design?.theme ?? null;\n const isLoading: boolean = flowMetaContext?.isLoading ?? false;\n const error: Error | null = flowMetaContext?.error ?? null;\n\n // Seed the color scheme from the server's defaultColorScheme; allow local toggling.\n const [colorScheme, setColorScheme] = useState<'light' | 'dark'>(() => flowMetaTheme?.defaultColorScheme ?? 'light');\n\n // When meta finishes loading, sync the color scheme with the server default.\n useEffect(() => {\n if (flowMetaTheme?.defaultColorScheme) {\n setColorScheme(flowMetaTheme.defaultColorScheme);\n }\n }, [flowMetaTheme?.defaultColorScheme]);\n\n const toggleTheme: () => void = useCallback(() => {\n setColorScheme((prev: 'light' | 'dark') => (prev === 'light' ? 'dark' : 'light'));\n }, []);\n\n // Build the resolved ThemeConfig: flow meta base → user overrides on top.\n const finalThemeConfig: RecursivePartial<ThemeConfig> | undefined = useMemo(() => {\n if (!flowMetaTheme) {\n return themeOverride;\n }\n\n const metaConfig: RecursivePartial<ThemeConfig> = buildThemeConfigFromFlowMeta(flowMetaTheme, colorScheme);\n\n if (!themeOverride) {\n return metaConfig;\n }\n\n return {\n ...metaConfig,\n ...themeOverride,\n borderRadius: {\n ...metaConfig.borderRadius,\n ...themeOverride.borderRadius,\n },\n colors: {\n ...metaConfig.colors,\n ...themeOverride.colors,\n },\n ...(metaConfig.typography || themeOverride.typography\n ? {\n typography: {\n ...(metaConfig as any).typography,\n ...themeOverride.typography,\n },\n }\n : {}),\n };\n }, [flowMetaTheme, colorScheme, themeOverride]);\n\n const theme: Theme = useMemo(\n () => createTheme(finalThemeConfig, colorScheme === 'dark'),\n [finalThemeConfig, colorScheme],\n );\n\n const direction: 'ltr' | 'rtl' = flowMetaTheme?.direction ?? 'ltr';\n\n // Apply CSS variables to the document root.\n useEffect(() => {\n applyThemeToDOM(theme);\n }, [theme]);\n\n // Apply text direction to the document root.\n useEffect(() => {\n if (typeof document !== 'undefined') {\n document.documentElement.dir = direction;\n }\n }, [direction]);\n\n const value: any = {\n colorScheme,\n direction,\n theme,\n toggleTheme,\n };\n\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;\n};\n\nexport default ThemeProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,MAAMA,iBAA4D,EAChE,UACA,OAAO,w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>>","themeOverride: RecursivePartial<ThemeConfig> | undefined","normalizeThemeConfig","flowMetaContext: FlowMetaContextValue | null","FlowMetaContext","flowMetaTheme: FlowMetaTheme | null","toggleTheme: () => void","finalThemeConfig: RecursivePartial<ThemeConfig> | undefined","metaConfig: RecursivePartial<ThemeConfig>","buildThemeConfigFromFlowMeta","theme: Theme","direction: 'ltr' | 'rtl'","value: any","ThemeContext"],"sources":["../../../../src/contexts/Theme/ThemeProvider.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {createTheme, Theme, ThemeConfig, ThemeMode, RecursivePartial, FlowMetaTheme} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, useCallback, useContext, useEffect, useMemo, useState} from 'react';\nimport ThemeContext from './ThemeContext';\nimport applyThemeToDOM from '../../utils/applyThemeToDOM';\nimport buildThemeConfigFromFlowMeta from '../../utils/buildThemeConfigFromFlowMeta';\nimport normalizeThemeConfig from '../../utils/normalizeThemeConfig';\nimport FlowMetaContext, {FlowMetaContextValue} from '../FlowMeta/FlowMetaContext';\n\nexport interface ThemeProviderProps {\n /**\n * Initial color scheme override. Overrides the server default when provided.\n */\n mode?: ThemeMode;\n\n /**\n * Optional theme overrides merged on top of the server-side flow meta theme.\n * User-supplied values take highest precedence.\n */\n theme?: RecursivePartial<ThemeConfig>;\n}\n\n/**\n * ThemeProvider is the v2 drop-in replacement for `ThemeProvider`.\n *\n * It reads the design theme from the nearest `FlowMetaContext` (provided by\n * `FlowMetaProvider`) and publishes a resolved `Theme` object through the\n * **same** `ThemeContext` that `useTheme` consumes. This means all existing\n * components that call `useTheme` continue to work without any changes.\n *\n * The `defaultColorScheme` field returned by the server is used to seed the\n * active color scheme; the user can still toggle it locally via the\n * `toggleTheme` value exposed in the context.\n *\n * @example\n * ```tsx\n * <FlowMetaProvider config={{ baseUrl, type: FlowMetaType.App, id: appId }}>\n * <ThemeProvider>\n * <App /> {/* useTheme() works here as usual *\\/}\n * </ThemeProvider>\n * </FlowMetaProvider>\n * ```\n *\n * @example\n * With user theme overrides (user values win over server values):\n * ```tsx\n * <ThemeProvider theme={{ colors: { primary: { main: '#ff0000' } } }}>\n * <App />\n * </ThemeProvider>\n * ```\n */\nconst ThemeProvider: FC<PropsWithChildren<ThemeProviderProps>> = ({\n children,\n theme: themeOverrideProp,\n}: PropsWithChildren<ThemeProviderProps>): ReactElement => {\n const themeOverride: RecursivePartial<ThemeConfig> | undefined = normalizeThemeConfig(themeOverrideProp);\n const flowMetaContext: FlowMetaContextValue | null = useContext(FlowMetaContext);\n\n const flowMetaTheme: FlowMetaTheme | null = flowMetaContext?.meta?.design?.theme ?? null;\n const isLoading: boolean = flowMetaContext?.isLoading ?? false;\n const error: Error | null = flowMetaContext?.error ?? null;\n\n // Seed the color scheme from the server's defaultColorScheme; allow local toggling.\n const [colorScheme, setColorScheme] = useState<'light' | 'dark'>(() => flowMetaTheme?.defaultColorScheme ?? 'light');\n\n // When meta finishes loading, sync the color scheme with the server default.\n useEffect(() => {\n if (flowMetaTheme?.defaultColorScheme) {\n setColorScheme(flowMetaTheme.defaultColorScheme);\n }\n }, [flowMetaTheme?.defaultColorScheme]);\n\n const toggleTheme: () => void = useCallback(() => {\n setColorScheme((prev: 'light' | 'dark') => (prev === 'light' ? 'dark' : 'light'));\n }, []);\n\n // Build the resolved ThemeConfig: flow meta base → user overrides on top.\n const finalThemeConfig: RecursivePartial<ThemeConfig> | undefined = useMemo(() => {\n if (!flowMetaTheme) {\n return themeOverride;\n }\n\n const metaConfig: RecursivePartial<ThemeConfig> = buildThemeConfigFromFlowMeta(flowMetaTheme, colorScheme);\n\n if (!themeOverride) {\n return metaConfig;\n }\n\n return {\n ...metaConfig,\n ...themeOverride,\n borderRadius: {\n ...metaConfig.borderRadius,\n ...themeOverride.borderRadius,\n },\n colors: {\n ...metaConfig.colors,\n ...themeOverride.colors,\n },\n ...(metaConfig.typography || themeOverride.typography\n ? {\n typography: {\n ...(metaConfig as any).typography,\n ...themeOverride.typography,\n },\n }\n : {}),\n };\n }, [flowMetaTheme, colorScheme, themeOverride]);\n\n const theme: Theme = useMemo(\n () => createTheme(finalThemeConfig, colorScheme === 'dark'),\n [finalThemeConfig, colorScheme],\n );\n\n const direction: 'ltr' | 'rtl' = flowMetaTheme?.direction ?? 'ltr';\n\n // Apply CSS variables to the document root.\n useEffect(() => {\n applyThemeToDOM(theme);\n }, [theme]);\n\n // Apply text direction to the document root.\n useEffect(() => {\n if (typeof document !== 'undefined') {\n document.documentElement.dir = direction;\n }\n }, [direction]);\n\n const value: any = {\n colorScheme,\n direction,\n theme,\n toggleTheme,\n };\n\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;\n};\n\nexport default ThemeProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAMA,iBAA4D,EAChE,UACA,OAAO,wBACkD;CACzD,MAAMC,gBAA2DC,qCAAqB,kBAAkB;CACxG,MAAMC,wCAA0DC,gCAAgB;CAEhF,MAAMC,gBAAsC,iBAAiB,MAAM,QAAQ,SAAS;AACzD,kBAAiB;AAChB,kBAAiB;CAG7C,MAAM,CAAC,aAAa,4CAAmD,eAAe,sBAAsB,QAAQ;AAGpH,4BAAgB;AACd,MAAI,eAAe,mBACjB,gBAAe,cAAc,mBAAmB;IAEjD,CAAC,eAAe,mBAAmB,CAAC;CAEvC,MAAMC,2CAA4C;AAChD,kBAAgB,SAA4B,SAAS,UAAU,SAAS,QAAS;IAChF,EAAE,CAAC;CAGN,MAAMC,4CAA4E;AAChF,MAAI,CAAC,cACH,QAAO;EAGT,MAAMC,aAA4CC,6CAA6B,eAAe,YAAY;AAE1G,MAAI,CAAC,cACH,QAAO;AAGT,SAAO;GACL,GAAG;GACH,GAAG;GACH,cAAc;IACZ,GAAG,WAAW;IACd,GAAG,cAAc;IAClB;GACD,QAAQ;IACN,GAAG,WAAW;IACd,GAAG,cAAc;IAClB;GACD,GAAI,WAAW,cAAc,cAAc,aACvC,EACE,YAAY;IACV,GAAI,WAAmB;IACvB,GAAG,cAAc;IAClB,EACF,GACD,EAAE;GACP;IACA;EAAC;EAAe;EAAa;EAAc,CAAC;CAE/C,MAAMC,sEACc,kBAAkB,gBAAgB,OAAO,EAC3D,CAAC,kBAAkB,YAAY,CAChC;CAED,MAAMC,YAA2B,eAAe,aAAa;AAG7D,4BAAgB;AACd,kCAAgB,MAAM;IACrB,CAAC,MAAM,CAAC;AAGX,4BAAgB;AACd,MAAI,OAAO,aAAa,YACtB,UAAS,gBAAgB,MAAM;IAEhC,CAAC,UAAU,CAAC;CAEf,MAAMC,QAAa;EACjB;EACA;EACA;EACA;EACD;AAED,QAAO,2CAACC,6BAAa;EAAgB;EAAQ;GAAiC;;AAGhF,4BAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTheme.cjs","names":["context: ThemeContextValue | null","ThemeContext"],"sources":["../../../../src/contexts/Theme/useTheme.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, 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 {useContext} from 'react';\nimport ThemeContext, {ThemeContextValue} from './ThemeContext';\n\nconst useTheme = (): ThemeContextValue => {\n const context: ThemeContextValue | null = useContext(ThemeContext);\n if (!context) {\n throw new Error('useTheme must be used within a ThemeProvider');\n }\n\n return context;\n};\n\nexport default useTheme;\n"],"mappings":";;;;;;AAqBA,MAAM,iBAAoC;CACxC,MAAMA,gCAA+CC,6BAAa;AAClE,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,+CAA+C;AAGjE,QAAO;;AAGT,uBAAe"}
1
+ {"version":3,"file":"useTheme.cjs","names":["context: ThemeContextValue | null","ThemeContext"],"sources":["../../../../src/contexts/Theme/useTheme.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {useContext} from 'react';\nimport ThemeContext, {ThemeContextValue} from './ThemeContext';\n\nconst useTheme = (): ThemeContextValue => {\n const context: ThemeContextValue | null = useContext(ThemeContext);\n if (!context) {\n throw new Error('useTheme must be used within a ThemeProvider');\n }\n\n return context;\n};\n\nexport default useTheme;\n"],"mappings":";;;;;;AAMA,MAAM,iBAAoC;CACxC,MAAMA,gCAA+CC,6BAAa;AAClE,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,+CAA+C;AAGjE,QAAO;;AAGT,uBAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThunderIDContext.cjs","names":["ThunderIDContext: Context<ThunderIDContextProps | null>","VendorConstants"],"sources":["../../../../src/contexts/ThunderID/ThunderIDContext.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, 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 {\n FlowMetadataResponse,\n HttpRequestConfig,\n HttpResponse,\n IdToken,\n OIDCDiscoveryApiResponse,\n SignInOptions,\n TokenExchangeRequestConfig,\n TokenResponse,\n VendorConstants,\n} from '@thunderid/browser';\nimport {Context, createContext} from 'react';\nimport {ThunderIDReactConfig} from '../../models/config';\nimport ThunderIDReactClient from '../../ThunderIDReactClient';\n\n/**\n * Props interface of {@link ThunderIDContext}\n */\nexport type ThunderIDContextProps = {\n afterSignInUrl: string | undefined;\n applicationId: string | undefined;\n baseUrl: string | undefined;\n clientId: string | undefined;\n preferences?: ThunderIDReactConfig['preferences'];\n scopes: string | string[] | undefined;\n /**\n * OIDC discovery data.\n */\n discovery: {\n /**\n * The response from the `.well-known/openid-configuration` endpoint.\n * Contains server capabilities, supported endpoints, and metadata.\n * `null` while loading or when discovery has not been fetched.\n */\n wellKnown: OIDCDiscoveryApiResponse | null;\n };\n /**\n * Swaps the current access token with a new one based on the provided configuration (with a grant type).\n * @param config - Configuration for the token exchange request.\n * @returns A promise that resolves to the token response or the raw response.\n */\n exchangeToken: (config: TokenExchangeRequestConfig) => Promise<TokenResponse | Response>;\n /**\n * Retrieves the access token stored in the storage.\n * This function retrieves the access token and returns it.\n * @remarks This does not work in the `webWorker` or any other worker environment.\n * @returns A promise that resolves to the access token.\n */\n getAccessToken: () => Promise<string>;\n /**\n * Function to retrieve the decoded ID token.\n * This function decodes the ID token and returns its payload.\n * It can be used to access user claims and other information contained in the ID token.\n *\n * @returns A promise that resolves to the decoded ID token payload.\n */\n getDecodedIdToken: () => Promise<IdToken>;\n /**\n * Function to retrieve the ID token.\n * This function retrieves the ID token and returns it.\n *\n * @returns A promise that resolves to the ID token.\n */\n getIdToken: () => Promise<string>;\n /**\n * Returns the underlying StorageManager instance for reading and writing SDK-managed storage.\n */\n getStorageManager: () => Promise<any>;\n /**\n * HTTP request function to make API calls.\n * @param requestConfig - Configuration for the HTTP request.\n * @returns A promise that resolves to the HTTP response.\n */\n http: {\n /**\n * Makes an HTTP request using the provided configuration.\n * @param requestConfig - Configuration for the HTTP request.\n * @returns A promise that resolves to the HTTP response.\n */\n request: (requestConfig?: HttpRequestConfig) => Promise<HttpResponse<any>>;\n /**\n * Makes multiple HTTP requests based on the provided configuration.\n * @param requestConfigs - Set of configurations for the HTTP requests.\n * @returns A promise that resolves to an array of HTTP responses.\n */\n requestAll: (requestConfigs?: HttpRequestConfig[]) => Promise<HttpResponse<any>[]>;\n };\n /**\n * Instance ID for multi-instance support.\n */\n instanceId: number;\n isInitialized: boolean;\n /**\n * Flag indicating whether the SDK is working in the background.\n */\n isLoading: boolean;\n /**\n * Flag indicating whether flow metadata is currently being fetched.\n */\n isMetaLoading: boolean;\n /**\n * Flag indicating whether the user is signed in or not.\n */\n isSignedIn: boolean;\n\n /**\n * Flow metadata returned by `GET /flow/meta` (v2 platform only).\n * `null` while loading or when `resolveFromMeta` is disabled.\n */\n meta: FlowMetadataResponse | null;\n\n organizationHandle: string | undefined;\n\n /**\n * Re-initializes the client with a new configuration.\n *\n * @remarks\n * This can be partial configuration to update only specific fields.\n *\n * @param config - New configuration to re-initialize the client with.\n * @returns Promise resolving to boolean indicating success.\n */\n reInitialize: (config: Partial<ThunderIDReactConfig>) => Promise<boolean>;\n\n /**\n * Recovery function to initiate the account/password recovery flow.\n */\n recover: (...args: any[]) => Promise<any>;\n\n /**\n * Resolves `{{ t(key) }}` and `{{ meta(path) }}` template expressions in a string,\n * using the current i18n translation function and flow metadata from context.\n *\n * Useful in render-props patterns where consumers need to expand template strings\n * that come from the server (e.g. component labels, placeholders, headings).\n *\n * @example\n * const {resolveFlowTemplateLiterals} = useThunderID();\n * resolveFlowTemplateLiterals('{{ t(signin.heading.label) }}') // → 'Sign In'\n * resolveFlowTemplateLiterals('Login to {{ meta(application.name) }}') // → 'Login to My App'\n */\n resolveFlowTemplateLiterals: (text: string | undefined) => string;\n\n /**\n * Sign-in function to initiate the authentication process.\n * @remark This is the programmatic version of the `SignInButton` component.\n * TODO: Fix the types.\n */\n signIn: (...args: any) => Promise<any>;\n\n /**\n * Optional additional parameters to be sent in the sign-in request.\n * This can include custom parameters that your authorization server supports.\n * These parameters will be included in the authorization request sent to the server.\n * If not provided, no additional parameters will be sent.\n *\n * @example\n * signInOptions: { prompt: \"login\", fidp: \"OrganizationSSO\" }\n */\n signInOptions?: SignInOptions;\n\n /**\n * Optional token request configuration. params are appended to the token endpoint POST body.\n *\n * @example\n * tokenRequest: { params: { resource: \"https://api.example.com\" } }\n */\n tokenRequest?: {\n params?: Record<string, unknown>;\n };\n\n /**\n * Silent sign-in function to re-authenticate the user without user interaction.\n * @remark This is the programmatic version of the `SilentSignIn` component.\n */\n signInSilently: ThunderIDReactClient['signInSilently'];\n\n signInUrl: string | undefined;\n /**\n * Sign-out function to terminate the authentication session.\n * @remark This is the programmatic version of the `SignOutButton` component.\n * FIXME: Fix the types.\n */\n signOut: any;\n\n /**\n * Sign-up function to initiate the registration process.\n * @remark This is the programmatic version of the `SignUpButton` component.\n */\n signUp: (...args: any[]) => Promise<any>;\n\n signUpUrl: string | undefined;\n\n user: any;\n\n /**\n * Vendor/brand namespace used to prefix storage keys, cookie names, and CSS class names.\n * Resolved from the `vendor` config option, defaulting to `'thunderid'`.\n */\n vendor: string;\n} & Pick<ThunderIDReactClient, 'clearSession'>;\n\n/**\n * Context object for managing the Authentication flow builder core context.\n */\nconst ThunderIDContext: Context<ThunderIDContextProps | null> = createContext<null | ThunderIDContextProps>({\n afterSignInUrl: undefined,\n applicationId: undefined,\n baseUrl: undefined,\n clearSession: () => {},\n clientId: undefined,\n preferences: undefined,\n scopes: undefined,\n discovery: {\n wellKnown: null,\n },\n exchangeToken: null as unknown as ThunderIDContextProps['exchangeToken'],\n getAccessToken: null as unknown as ThunderIDContextProps['getAccessToken'],\n getDecodedIdToken: null as unknown as ThunderIDContextProps['getDecodedIdToken'],\n getIdToken: null as unknown as ThunderIDContextProps['getIdToken'],\n getStorageManager: () => Promise.resolve(null),\n http: {\n request: () => null as unknown as Promise<HttpResponse<any>>,\n requestAll: () => null as unknown as Promise<HttpResponse<any>[]>,\n },\n instanceId: 0,\n isInitialized: false,\n isLoading: true,\n isMetaLoading: false,\n isSignedIn: false,\n meta: null,\n organizationHandle: undefined,\n reInitialize: null as unknown as ThunderIDContextProps['reInitialize'],\n recover: () => Promise.resolve({} as any),\n resolveFlowTemplateLiterals: (text: string | undefined) => text ?? '',\n signIn: () => Promise.resolve({} as any),\n signInSilently: () => Promise.resolve({} as any),\n signInUrl: undefined,\n signOut: () => Promise.resolve({} as any),\n signUp: () => Promise.resolve({} as any),\n signUpUrl: undefined,\n user: null,\n vendor: VendorConstants.VENDOR_PREFIX,\n});\n\nThunderIDContext.displayName = 'ThunderIDContext';\n\nexport default ThunderIDContext;\n"],"mappings":";;;;;;;;;;AA+NA,MAAMA,4CAAsG;CAC1G,gBAAgB;CAChB,eAAe;CACf,SAAS;CACT,oBAAoB;CACpB,UAAU;CACV,aAAa;CACb,QAAQ;CACR,WAAW,EACT,WAAW,MACZ;CACD,eAAe;CACf,gBAAgB;CAChB,mBAAmB;CACnB,YAAY;CACZ,yBAAyB,QAAQ,QAAQ,KAAK;CAC9C,MAAM;EACJ,eAAe;EACf,kBAAkB;EACnB;CACD,YAAY;CACZ,eAAe;CACf,WAAW;CACX,eAAe;CACf,YAAY;CACZ,MAAM;CACN,oBAAoB;CACpB,cAAc;CACd,eAAe,QAAQ,QAAQ,EAAE,CAAQ;CACzC,8BAA8B,SAA6B,QAAQ;CACnE,cAAc,QAAQ,QAAQ,EAAE,CAAQ;CACxC,sBAAsB,QAAQ,QAAQ,EAAE,CAAQ;CAChD,WAAW;CACX,eAAe,QAAQ,QAAQ,EAAE,CAAQ;CACzC,cAAc,QAAQ,QAAQ,EAAE,CAAQ;CACxC,WAAW;CACX,MAAM;CACN,QAAQC,oCAAgB;CACzB,CAAC;AAEF,iBAAiB,cAAc;AAE/B,+BAAe"}
1
+ {"version":3,"file":"ThunderIDContext.cjs","names":["ThunderIDContext: Context<ThunderIDContextProps | null>","VendorConstants"],"sources":["../../../../src/contexts/ThunderID/ThunderIDContext.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n FlowMetadataResponse,\n HttpRequestConfig,\n HttpResponse,\n IdToken,\n OIDCDiscoveryApiResponse,\n SignInOptions,\n TokenExchangeRequestConfig,\n TokenResponse,\n VendorConstants,\n} from '@thunderid/browser';\nimport {Context, createContext} from 'react';\nimport {ThunderIDReactConfig} from '../../models/config';\nimport ThunderIDReactClient from '../../ThunderIDReactClient';\n\n/**\n * Props interface of {@link ThunderIDContext}\n */\nexport type ThunderIDContextProps = {\n afterSignInUrl: string | undefined;\n applicationId: string | undefined;\n baseUrl: string | undefined;\n clientId: string | undefined;\n /**\n * Optional endpoint URL overrides from the client config. Used to resolve resource-server\n * endpoints (e.g. flow/user-management) independently of `baseUrl` — see `resolveResourceEndpoint`.\n */\n endpoints?: ThunderIDReactConfig['endpoints'];\n preferences?: ThunderIDReactConfig['preferences'];\n scopes: string | string[] | undefined;\n /**\n * OIDC discovery data.\n */\n discovery: {\n /**\n * The response from the `.well-known/openid-configuration` endpoint.\n * Contains server capabilities, supported endpoints, and metadata.\n * `null` while loading or when discovery has not been fetched.\n */\n wellKnown: OIDCDiscoveryApiResponse | null;\n };\n /**\n * Swaps the current access token with a new one based on the provided configuration (with a grant type).\n * @param config - Configuration for the token exchange request.\n * @returns A promise that resolves to the token response or the raw response.\n */\n exchangeToken: (config: TokenExchangeRequestConfig) => Promise<TokenResponse | Response>;\n /**\n * Retrieves the access token stored in the storage.\n * This function retrieves the access token and returns it.\n * @remarks This does not work in the `webWorker` or any other worker environment.\n * @returns A promise that resolves to the access token.\n */\n getAccessToken: () => Promise<string>;\n /**\n * Function to retrieve the decoded ID token.\n * This function decodes the ID token and returns its payload.\n * It can be used to access user claims and other information contained in the ID token.\n *\n * @returns A promise that resolves to the decoded ID token payload.\n */\n getDecodedIdToken: () => Promise<IdToken>;\n /**\n * Function to retrieve the ID token.\n * This function retrieves the ID token and returns it.\n *\n * @returns A promise that resolves to the ID token.\n */\n getIdToken: () => Promise<string>;\n /**\n * Returns the underlying StorageManager instance for reading and writing SDK-managed storage.\n */\n getStorageManager: () => Promise<any>;\n /**\n * HTTP request function to make API calls.\n * @param requestConfig - Configuration for the HTTP request.\n * @returns A promise that resolves to the HTTP response.\n */\n http: {\n /**\n * Makes an HTTP request using the provided configuration.\n * @param requestConfig - Configuration for the HTTP request.\n * @returns A promise that resolves to the HTTP response.\n */\n request: (requestConfig?: HttpRequestConfig) => Promise<HttpResponse<any>>;\n /**\n * Makes multiple HTTP requests based on the provided configuration.\n * @param requestConfigs - Set of configurations for the HTTP requests.\n * @returns A promise that resolves to an array of HTTP responses.\n */\n requestAll: (requestConfigs?: HttpRequestConfig[]) => Promise<HttpResponse<any>[]>;\n };\n /**\n * Instance ID for multi-instance support.\n */\n instanceId: number;\n isInitialized: boolean;\n /**\n * Flag indicating whether the SDK is working in the background.\n */\n isLoading: boolean;\n /**\n * Flag indicating whether flow metadata is currently being fetched.\n */\n isMetaLoading: boolean;\n /**\n * Flag indicating whether the user is signed in or not.\n */\n isSignedIn: boolean;\n\n /**\n * Flow metadata returned by `GET /flow/meta` (v2 platform only).\n * `null` while loading or when `resolveFromMeta` is disabled.\n */\n meta: FlowMetadataResponse | null;\n\n organizationHandle: string | undefined;\n\n /**\n * Re-initializes the client with a new configuration.\n *\n * @remarks\n * This can be partial configuration to update only specific fields.\n *\n * @param config - New configuration to re-initialize the client with.\n * @returns Promise resolving to boolean indicating success.\n */\n reInitialize: (config: Partial<ThunderIDReactConfig>) => Promise<boolean>;\n\n /**\n * Recovery function to initiate the account/password recovery flow.\n */\n recover: (...args: any[]) => Promise<any>;\n\n /**\n * Resolves `{{ t(key) }}` and `{{ meta(path) }}` template expressions in a string,\n * using the current i18n translation function and flow metadata from context.\n *\n * Useful in render-props patterns where consumers need to expand template strings\n * that come from the server (e.g. component labels, placeholders, headings).\n *\n * @example\n * const {resolveFlowTemplateLiterals} = useThunderID();\n * resolveFlowTemplateLiterals('{{ t(signin.heading.label) }}') // → 'Sign In'\n * resolveFlowTemplateLiterals('Login to {{ meta(application.name) }}') // → 'Login to My App'\n */\n resolveFlowTemplateLiterals: (text: string | undefined) => string;\n\n /**\n * Sign-in function to initiate the authentication process.\n * @remark This is the programmatic version of the `SignInButton` component.\n * TODO: Fix the types.\n */\n signIn: (...args: any) => Promise<any>;\n\n /**\n * Optional additional parameters to be sent in the sign-in request.\n * This can include custom parameters that your authorization server supports.\n * These parameters will be included in the authorization request sent to the server.\n * If not provided, no additional parameters will be sent.\n *\n * @example\n * signInOptions: { prompt: \"login\", fidp: \"OrganizationSSO\" }\n */\n signInOptions?: SignInOptions;\n\n /**\n * Optional token request configuration. params are appended to the token endpoint POST body.\n *\n * @example\n * tokenRequest: { params: { resource: \"https://api.example.com\" } }\n */\n tokenRequest?: {\n params?: Record<string, unknown>;\n };\n\n /**\n * Silent sign-in function to re-authenticate the user without user interaction.\n * @remark This is the programmatic version of the `SilentSignIn` component.\n */\n signInSilently: ThunderIDReactClient['signInSilently'];\n\n signInUrl: string | undefined;\n /**\n * Sign-out function to terminate the authentication session.\n * @remark This is the programmatic version of the `SignOutButton` component.\n * FIXME: Fix the types.\n */\n signOut: any;\n\n /**\n * Sign-up function to initiate the registration process.\n * @remark This is the programmatic version of the `SignUpButton` component.\n */\n signUp: (...args: any[]) => Promise<any>;\n\n signUpUrl: string | undefined;\n\n user: any;\n\n /**\n * Vendor/brand namespace used to prefix storage keys, cookie names, and CSS class names.\n * Resolved from the `vendor` config option, defaulting to `'thunderid'`.\n */\n vendor: string;\n} & Pick<ThunderIDReactClient, 'clearSession'>;\n\n/**\n * Context object for managing the Authentication flow builder core context.\n */\nconst ThunderIDContext: Context<ThunderIDContextProps | null> = createContext<null | ThunderIDContextProps>({\n afterSignInUrl: undefined,\n applicationId: undefined,\n baseUrl: undefined,\n clearSession: () => {},\n clientId: undefined,\n preferences: undefined,\n scopes: undefined,\n discovery: {\n wellKnown: null,\n },\n exchangeToken: null as unknown as ThunderIDContextProps['exchangeToken'],\n getAccessToken: null as unknown as ThunderIDContextProps['getAccessToken'],\n getDecodedIdToken: null as unknown as ThunderIDContextProps['getDecodedIdToken'],\n getIdToken: null as unknown as ThunderIDContextProps['getIdToken'],\n getStorageManager: () => Promise.resolve(null),\n http: {\n request: () => null as unknown as Promise<HttpResponse<any>>,\n requestAll: () => null as unknown as Promise<HttpResponse<any>[]>,\n },\n instanceId: 0,\n isInitialized: false,\n isLoading: true,\n isMetaLoading: false,\n isSignedIn: false,\n meta: null,\n organizationHandle: undefined,\n reInitialize: null as unknown as ThunderIDContextProps['reInitialize'],\n recover: () => Promise.resolve({} as any),\n resolveFlowTemplateLiterals: (text: string | undefined) => text ?? '',\n signIn: () => Promise.resolve({} as any),\n signInSilently: () => Promise.resolve({} as any),\n signInUrl: undefined,\n signOut: () => Promise.resolve({} as any),\n signUp: () => Promise.resolve({} as any),\n signUpUrl: undefined,\n user: null,\n vendor: VendorConstants.VENDOR_PREFIX,\n});\n\nThunderIDContext.displayName = 'ThunderIDContext';\n\nexport default ThunderIDContext;\n"],"mappings":";;;;;;;;;;AAqNA,MAAMA,4CAAsG;CAC1G,gBAAgB;CAChB,eAAe;CACf,SAAS;CACT,oBAAoB;CACpB,UAAU;CACV,aAAa;CACb,QAAQ;CACR,WAAW,EACT,WAAW,MACZ;CACD,eAAe;CACf,gBAAgB;CAChB,mBAAmB;CACnB,YAAY;CACZ,yBAAyB,QAAQ,QAAQ,KAAK;CAC9C,MAAM;EACJ,eAAe;EACf,kBAAkB;EACnB;CACD,YAAY;CACZ,eAAe;CACf,WAAW;CACX,eAAe;CACf,YAAY;CACZ,MAAM;CACN,oBAAoB;CACpB,cAAc;CACd,eAAe,QAAQ,QAAQ,EAAE,CAAQ;CACzC,8BAA8B,SAA6B,QAAQ;CACnE,cAAc,QAAQ,QAAQ,EAAE,CAAQ;CACxC,sBAAsB,QAAQ,QAAQ,EAAE,CAAQ;CAChD,WAAW;CACX,eAAe,QAAQ,QAAQ,EAAE,CAAQ;CACzC,cAAc,QAAQ,QAAQ,EAAE,CAAQ;CACxC,WAAW;CACX,MAAM;CACN,QAAQC,oCAAgB;CACzB,CAAC;AAEF,iBAAiB,cAAc;AAE/B,+BAAe"}
@@ -47,6 +47,7 @@ const ThunderIDProvider = ({ afterSignInUrl, afterSignOutUrl, baseUrl: initialBa
47
47
  });
48
48
  const [isUpdatingSession, setIsUpdatingSession] = (0, react.useState)(false);
49
49
  const [wellKnown, setWellKnown] = (0, react.useState)(null);
50
+ const pendingSessionUpdateRef = (0, react.useRef)(null);
50
51
  (0, react.useEffect)(() => {
51
52
  setBaseUrl(initialBaseUrl ?? "");
52
53
  }, [initialBaseUrl]);
@@ -57,7 +58,7 @@ const ThunderIDProvider = ({ afterSignInUrl, afterSignOutUrl, baseUrl: initialBa
57
58
  setWellKnown(await client.getDiscoveryResponse());
58
59
  })();
59
60
  }, []);
60
- async function updateSession() {
61
+ async function performSessionUpdate() {
61
62
  try {
62
63
  setIsUpdatingSession(true);
63
64
  setIsLoadingSync(true);
@@ -74,6 +75,7 @@ const ThunderIDProvider = ({ afterSignInUrl, afterSignOutUrl, baseUrl: initialBa
74
75
  if (currentSignInStatus && shouldFetchProfile) try {
75
76
  const fetchedProfile = await require_getUsersMe.default({
76
77
  baseUrl: resolvedBaseUrl,
78
+ url: (0, __thunderid_browser.resolveResourceEndpoint)("usersMe", config),
77
79
  instanceId
78
80
  });
79
81
  profileData = {
@@ -94,6 +96,20 @@ const ThunderIDProvider = ({ afterSignInUrl, afterSignOutUrl, baseUrl: initialBa
94
96
  setIsLoadingSync(client.isLoading());
95
97
  }
96
98
  }
99
+ /**
100
+ * Single-flight wrapper around {@link performSessionUpdate}.
101
+ *
102
+ * Concurrent callers share the in-flight request instead of each issuing their own `/users/me`.
103
+ * This is not a cache: once the request settles the ref is cleared, so a later caller (e.g.
104
+ * revalidation after a profile update) fetches again.
105
+ */
106
+ async function updateSession() {
107
+ if (pendingSessionUpdateRef.current) return pendingSessionUpdateRef.current;
108
+ pendingSessionUpdateRef.current = performSessionUpdate().finally(() => {
109
+ pendingSessionUpdateRef.current = null;
110
+ });
111
+ return pendingSessionUpdateRef.current;
112
+ }
97
113
  async function signIn(...args) {
98
114
  const arg1 = args[0];
99
115
  const isV2FlowRequest = typeof arg1 === "object" && arg1 !== null && ("executionId" in arg1 || "applicationId" in arg1);
@@ -122,22 +138,13 @@ const ThunderIDProvider = ({ afterSignInUrl, afterSignOutUrl, baseUrl: initialBa
122
138
  await client.on("sign-in", async () => {
123
139
  await updateSession();
124
140
  });
125
- const isAlreadySignedIn = await client.isSignedIn();
126
- const scheduleAutoRefresh = async () => {
127
- try {
128
- await client.startAutoRefreshToken();
129
- } catch (error) {
130
- logger.warn("Failed to schedule automatic token refresh.", error);
131
- }
132
- };
133
- const resumeSession = async () => {
134
- await updateSession();
135
- await scheduleAutoRefresh();
136
- };
137
- if (isAlreadySignedIn) await resumeSession();
138
- await scheduleAutoRefresh();
141
+ try {
142
+ await client.startAutoRefreshToken();
143
+ } catch (error) {
144
+ logger.warn("Failed to schedule automatic token refresh.", error);
145
+ }
139
146
  if (await client.isSignedIn()) {
140
- await resumeSession();
147
+ await updateSession();
141
148
  return;
142
149
  }
143
150
  const currentUrl = new URL(window.location.href);
@@ -241,11 +248,19 @@ const ThunderIDProvider = ({ afterSignInUrl, afterSignOutUrl, baseUrl: initialBa
241
248
  const recover = (0, react.useCallback)(async (payload) => client.recover(payload), [client]);
242
249
  const signUp = (0, react.useCallback)(async (...args) => client.signUp(...args), [client]);
243
250
  const clearSession = (0, react.useCallback)(async (...args) => client.clearSession(...args), [client]);
244
- const reInitialize = (0, react.useCallback)(async (reInitConfig) => client.reInitialize(reInitConfig), [client]);
251
+ const reInitialize = (0, react.useCallback)(async (reInitConfig) => {
252
+ const result = await client.reInitialize(reInitConfig);
253
+ const reinitializedConfig = await client.getConfiguration();
254
+ setConfig(reinitializedConfig);
255
+ setBaseUrl(reinitializedConfig.baseUrl ?? "");
256
+ setWellKnown(await client.getDiscoveryResponse());
257
+ return result;
258
+ }, [client]);
245
259
  const value = (0, react.useMemo)(() => ({
246
260
  afterSignInUrl: config.afterSignInUrl,
247
261
  applicationId: config.applicationId,
248
262
  baseUrl,
263
+ endpoints: config.endpoints,
249
264
  scopes: config.scopes,
250
265
  clearSession,
251
266
  clientId,
@@ -284,6 +299,7 @@ const ThunderIDProvider = ({ afterSignInUrl, afterSignOutUrl, baseUrl: initialBa
284
299
  config?.organizationHandle,
285
300
  config.vendor,
286
301
  config.afterSignInUrl,
302
+ config.endpoints,
287
303
  config.scopes,
288
304
  signInUrl,
289
305
  signUpUrl,
@@ -1 +1 @@
1
- {"version":3,"file":"ThunderIDProvider.cjs","names":["logger: ReturnType<typeof createPackageComponentLogger>","ThunderIDProvider: FC<PropsWithChildren<ThunderIDProviderProps>>","reRenderCheckRef: RefObject<boolean>","client: ThunderIDReactClient","ThunderIDReactClient","storageManagerRef: any","useBrowserUrl","resolvedBaseUrl: string","decodedToken: IdToken","shouldFetchProfile: boolean","claims: User","currentSignInStatus: boolean","getUsersMe","arg1: any","isV2FlowRequest: boolean","ThunderIDRuntimeError","isAlreadySignedIn: boolean","currentUrl: URL","urlParams: URLSearchParams","code: string | null","executionIdFromUrl: string | null","storedExecutionId: string | null","interval: NodeJS.Timeout","status: boolean","getDecodedIdToken: () => Promise<IdToken>","getIdToken: () => Promise<string>","getAccessToken: () => Promise<string>","getStorageManager: () => Promise<any>","storageManager: any","request: (...args: any[]) => Promise<any>","requestAll: (...args: any[]) => Promise<any>","exchangeToken: (exchangeConfig: any) => Promise<any>","signOut: (...args: any[]) => Promise<any>","recover: (payload: any) => Promise<any>","signUp: (...args: any[]) => Promise<any>","clearSession: (...args: any[]) => Promise<any>","reInitialize: (reInitConfig: any) => Promise<any>","value: any","ThunderIDContext","I18nProvider","FlowMetaProvider","ThemeProvider","FlowProvider","UserProvider","ComponentRendererProvider"],"sources":["../../../../src/contexts/ThunderID/ThunderIDProvider.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025-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 {\n ThunderIDRuntimeError,\n generateFlattenedUserProfile,\n OIDCDiscoveryApiResponse,\n SignInOptions,\n User,\n UserProfile,\n IdToken,\n extractUserClaimsFromIdToken,\n EmbeddedSignInFlowResponse,\n createPackageComponentLogger,\n getVendorPrefix,\n} from '@thunderid/browser';\nimport {FC, RefObject, PropsWithChildren, ReactElement, useEffect, useMemo, useRef, useState, useCallback} from 'react';\nimport ThunderIDContext from './ThunderIDContext';\nimport useBrowserUrl from '../../hooks/useBrowserUrl';\nimport {ThunderIDReactConfig} from '../../models/config';\nimport ThunderIDReactClient from '../../ThunderIDReactClient';\nimport ComponentRendererProvider from '../ComponentRenderer/ComponentRendererProvider';\nimport FlowProvider from '../Flow/FlowProvider';\nimport FlowMetaProvider from '../FlowMeta/FlowMetaProvider';\nimport I18nProvider from '../I18n/I18nProvider';\nimport ThemeProvider from '../Theme/ThemeProvider';\nimport UserProvider from '../User/UserProvider';\nimport getUsersMe from '../../api/getUsersMe';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'ThunderIDProvider',\n);\n\n/**\n * Props interface of {@link ThunderIDProvider}\n */\nexport type ThunderIDProviderProps = ThunderIDReactConfig;\n\nconst ThunderIDProvider: FC<PropsWithChildren<ThunderIDProviderProps>> = ({\n afterSignInUrl,\n afterSignOutUrl,\n baseUrl: initialBaseUrl,\n clientId,\n children,\n extensions,\n scopes,\n preferences,\n signInUrl,\n signUpUrl,\n organizationHandle,\n applicationId,\n signInOptions,\n tokenRequest,\n syncSession,\n instanceId = 0,\n organizationChain,\n ...rest\n}: PropsWithChildren<ThunderIDProviderProps>): ReactElement => {\n const reRenderCheckRef: RefObject<boolean> = useRef(false);\n const client: ThunderIDReactClient = useMemo(() => new ThunderIDReactClient(instanceId), [instanceId]);\n const storageManagerRef: any = useRef<any>(null);\n const {hasAuthParams, hasCalledForThisInstance} = useBrowserUrl();\n const [user, setUser] = useState<any | null>(null);\n const [isSignedInSync, setIsSignedInSync] = useState<boolean>(false);\n const [isInitializedSync, setIsInitializedSync] = useState<boolean>(false);\n const [isLoadingSync, setIsLoadingSync] = useState<boolean>(true);\n\n const [userProfile, setUserProfile] = useState<UserProfile | null>(null);\n const [baseUrl, setBaseUrl] = useState<string>(initialBaseUrl ?? '');\n const [config, setConfig] = useState<ThunderIDReactConfig>({\n afterSignInUrl: afterSignInUrl ?? window.location.origin,\n afterSignOutUrl: afterSignOutUrl ?? window.location.origin,\n applicationId,\n baseUrl,\n clientId,\n organizationChain,\n organizationHandle,\n scopes,\n signInOptions,\n tokenRequest,\n signInUrl,\n signUpUrl,\n syncSession,\n ...rest,\n });\n\n const [isUpdatingSession, setIsUpdatingSession] = useState<boolean>(false);\n const [wellKnown, setWellKnown] = useState<OIDCDiscoveryApiResponse | null>(null);\n\n useEffect(() => {\n setBaseUrl(initialBaseUrl ?? '');\n }, [initialBaseUrl]);\n\n useEffect(() => {\n (async (): Promise<void> => {\n await client.initialize(config);\n const initializedConfig: ThunderIDReactConfig = await client.getConfiguration();\n setConfig(initializedConfig);\n setWellKnown(await client.getDiscoveryResponse());\n })();\n }, []);\n\n async function updateSession(): Promise<void> {\n try {\n // Set flag to prevent loading state tracking from interfering\n setIsUpdatingSession(true);\n setIsLoadingSync(true);\n let resolvedBaseUrl: string = baseUrl;\n\n const decodedToken: IdToken = await client.getDecodedIdToken();\n\n // If there's a `user_org` claim in the ID token,\n // Treat this login as a organization login.\n if (decodedToken?.['user_org']) {\n resolvedBaseUrl = `${(await client.getConfiguration()).baseUrl}/o`;\n setBaseUrl(resolvedBaseUrl);\n }\n\n const shouldFetchProfile: boolean = preferences?.user?.fetchUserProfile !== false;\n const claims: User = extractUserClaimsFromIdToken(decodedToken) as User;\n let profileData = claims;\n const currentSignInStatus: boolean = await client.isSignedIn();\n\n if (currentSignInStatus && shouldFetchProfile) {\n try {\n const fetchedProfile = await getUsersMe({baseUrl: resolvedBaseUrl, instanceId});\n profileData = {...claims, ...fetchedProfile};\n } catch (err) {\n logger.warn('Failed to fetch user profile from /users/me:', err);\n }\n }\n\n setUser(profileData);\n setUserProfile({\n flattenedProfile: generateFlattenedUserProfile(profileData, []),\n profile: profileData,\n });\n\n // CRITICAL: Update sign-in status BEFORE setting loading to false\n // This prevents the race condition where ProtectedRoute sees isLoading=false but isSignedIn=false\n setIsSignedInSync(currentSignInStatus);\n } catch (error) {\n // TODO: Add an error log.\n } finally {\n // Clear the flag and set final loading state\n setIsUpdatingSession(false);\n setIsLoadingSync(client.isLoading());\n }\n }\n\n async function signIn(...args: any): Promise<User | EmbeddedSignInFlowResponse> {\n // Check if this is a V2 embedded flow request BEFORE calling signIn\n // This allows us to skip session checks entirely for V2 flows\n const arg1: any = args[0];\n const isV2FlowRequest: boolean =\n typeof arg1 === 'object' && arg1 !== null && ('executionId' in arg1 || 'applicationId' in arg1);\n\n try {\n if (!isV2FlowRequest) {\n setIsUpdatingSession(true);\n setIsLoadingSync(true);\n }\n\n return await client.signIn(...args);\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Sign in failed: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'thunderid-signIn-Error',\n 'react',\n 'An error occurred while trying to sign in.',\n );\n } finally {\n if (!isV2FlowRequest) {\n setIsUpdatingSession(false);\n setIsLoadingSync(client.isLoading());\n }\n }\n }\n\n /**\n * Try signing in when the component is mounted.\n */\n useEffect(() => {\n // React 18.x Strict.Mode has a new check for `Ensuring reusable state` to facilitate an upcoming react feature.\n // https://reactjs.org/docs/strict-mode.html#ensuring-reusable-state\n // This will remount all the useEffects to ensure that there are no unexpected side effects.\n // When react remounts the signIn hook of the AuthProvider, it will cause a race condition. Hence, we have to\n // prevent the re-render of this hook as suggested in the following discussion.\n // https://github.com/reactwg/react-18/discussions/18#discussioncomment-795623\n if (reRenderCheckRef.current) {\n return;\n }\n\n reRenderCheckRef.current = true;\n\n (async (): Promise<void> => {\n // Sync session state whenever sign-in completes (both redirect and embedded V2 flows).\n // Pass the user returned by the SDK's sign-in flow so users/me result is not discarded.\n await client.on('sign-in', async () => {\n await updateSession();\n });\n\n // User is already authenticated. Skip...\n const isAlreadySignedIn: boolean = await client.isSignedIn();\n\n // Start auto-refresh with a soft failure.\n const scheduleAutoRefresh = async (): Promise<void> => {\n try {\n await client.startAutoRefreshToken();\n } catch (error) {\n logger.warn('Failed to schedule automatic token refresh.', error);\n }\n };\n\n // Restore session state and kick off the refresh timer.\n const resumeSession = async (): Promise<void> => {\n await updateSession();\n await scheduleAutoRefresh();\n };\n\n if (isAlreadySignedIn) {\n await resumeSession();\n }\n\n // The access token may have expired while the refresh token is still valid.\n // Attempt a silent refresh — startAutoRefreshToken() calls refreshAccessToken()\n // immediately when timeUntilRefresh <= 0, then re-check sign-in status.\n await scheduleAutoRefresh();\n\n if (await client.isSignedIn()) {\n await resumeSession();\n return;\n }\n\n const currentUrl: URL = new URL(window.location.href);\n const hasAuthParamsResult: boolean =\n hasAuthParams(currentUrl, config.afterSignInUrl!) && hasCalledForThisInstance(currentUrl, instanceId ?? 0);\n\n if (hasAuthParamsResult) {\n try {\n const urlParams: URLSearchParams = currentUrl.searchParams;\n const code: string | null = urlParams.get('code');\n const executionIdFromUrl: string | null = urlParams.get('executionId');\n const storedExecutionId: string | null = sessionStorage.getItem(\n `${getVendorPrefix(config.vendor)}_execution_id`,\n );\n\n if (code && !executionIdFromUrl && !storedExecutionId) {\n await signIn();\n }\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Sign in failed: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'thunderid-signIn-Error',\n 'react',\n 'An error occurred while trying to sign in.',\n );\n }\n }\n })();\n }, []);\n\n /**\n * Check if the user is signed in and update the state accordingly.\n * This will also set an interval to check for the sign-in status every second\n * until the user is signed in.\n */\n useEffect(() => {\n let interval: NodeJS.Timeout;\n\n (async (): Promise<void> => {\n try {\n const status: boolean = await client.isSignedIn();\n\n setIsSignedInSync(status);\n\n if (!status) {\n interval = setInterval(async () => {\n const newStatus: boolean = await client.isSignedIn();\n\n if (newStatus) {\n setIsSignedInSync(true);\n clearInterval(interval);\n }\n }, 1000);\n } else {\n // TODO: Add a debug log to indicate that the user is already signed in.\n }\n } catch (error) {\n setIsSignedInSync(false);\n }\n })();\n\n return (): void => {\n if (interval) {\n clearInterval(interval);\n }\n };\n }, [client]);\n\n useEffect(() => {\n (async (): Promise<void> => {\n try {\n const status: boolean = await client.isInitialized();\n\n setIsInitializedSync(status);\n } catch (error) {\n setIsInitializedSync(false);\n }\n })();\n }, [client]);\n\n /**\n * Track loading state changes from the ThunderID client\n */\n useEffect(() => {\n const checkLoadingState = (): void => {\n // Don't override loading state during critical session updates\n if (isUpdatingSession) {\n return;\n }\n\n // Don't set loading=false while auth params are in the URL and user isn't signed in yet.\n // This prevents ProtectedRoute from redirecting before the sign-in effect processes the auth code.\n const currentUrl: URL = new URL(window.location.href);\n if (!isSignedInSync && hasAuthParams(currentUrl, config.afterSignInUrl!)) {\n return;\n }\n\n setIsLoadingSync(client.isLoading());\n };\n\n // Initial check\n checkLoadingState();\n\n // Set up an interval to check for loading state changes\n const interval: NodeJS.Timeout = setInterval(checkLoadingState, 100);\n\n return (): void => {\n clearInterval(interval);\n };\n }, [client, isLoadingSync, isSignedInSync, isUpdatingSession]);\n\n const signInSilently = async (options?: SignInOptions): Promise<User | boolean> => {\n try {\n setIsUpdatingSession(true);\n setIsLoadingSync(true);\n return await client.signInSilently(options);\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Error while signing in silently: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'thunderid-signInSilently-Error',\n 'react',\n 'An error occurred while trying to sign in silently.',\n );\n } finally {\n setIsUpdatingSession(false);\n setIsLoadingSync(client.isLoading());\n }\n };\n\n const handleProfileUpdate = (payload: User): void => {\n setUser(payload);\n setUserProfile((prev: UserProfile | null) => ({\n flattenedProfile: generateFlattenedUserProfile(payload),\n profile: payload,\n }));\n };\n\n const getDecodedIdToken: () => Promise<IdToken> = useCallback(\n async (): Promise<IdToken> => client.getDecodedIdToken(),\n [client],\n );\n\n const getIdToken: () => Promise<string> = useCallback(async (): Promise<string> => client.getIdToken(), [client]);\n\n const getAccessToken: () => Promise<string> = useCallback(\n async (): Promise<string> => client.getAccessToken(),\n [client],\n );\n\n const getStorageManager: () => Promise<any> = useCallback(async (): Promise<any> => {\n const storageManager: any = storageManagerRef.current ?? (await client.getStorageManager());\n if (storageManager) {\n storageManagerRef.current = storageManager;\n }\n return storageManager;\n }, [client]);\n\n const request: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.request(...args),\n [client],\n );\n\n const requestAll: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.requestAll(...args),\n [client],\n );\n\n const exchangeToken: (exchangeConfig: any) => Promise<any> = useCallback(\n async (exchangeConfig: any): Promise<any> => client.exchangeToken(exchangeConfig),\n [client],\n );\n\n const signOut: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.signOut(...args),\n [client],\n );\n\n const recover: (payload: any) => Promise<any> = useCallback(\n async (payload: any): Promise<any> => client.recover(payload),\n [client],\n );\n\n const signUp: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.signUp(...args),\n [client],\n );\n\n const clearSession: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.clearSession(...args),\n [client],\n );\n\n const reInitialize: (reInitConfig: any) => Promise<any> = useCallback(\n async (reInitConfig: any): Promise<any> => client.reInitialize(reInitConfig),\n [client],\n );\n\n const value: any = useMemo(\n () => ({\n afterSignInUrl: config.afterSignInUrl,\n applicationId: config.applicationId,\n baseUrl,\n scopes: config.scopes,\n clearSession,\n clientId,\n discovery: {\n wellKnown,\n },\n exchangeToken,\n getAccessToken,\n getDecodedIdToken,\n getIdToken,\n getStorageManager,\n http: {\n request,\n requestAll,\n },\n instanceId,\n isInitialized: isInitializedSync,\n isLoading: isLoadingSync,\n isSignedIn: isSignedInSync,\n organizationChain,\n organizationHandle: config?.organizationHandle,\n preferences,\n reInitialize,\n recover,\n signIn,\n signInOptions,\n tokenRequest,\n signInSilently,\n signInUrl,\n signOut,\n signUp,\n signUpUrl,\n syncSession,\n user,\n vendor: getVendorPrefix(config.vendor),\n }),\n [\n applicationId,\n config?.organizationHandle,\n config.vendor,\n config.afterSignInUrl,\n config.scopes,\n signInUrl,\n signUpUrl,\n baseUrl,\n clientId,\n wellKnown,\n isInitializedSync,\n isLoadingSync,\n isSignedInSync,\n signIn,\n signInSilently,\n user,\n client,\n signInOptions,\n tokenRequest,\n syncSession,\n getDecodedIdToken,\n clearSession,\n exchangeToken,\n getAccessToken,\n getStorageManager,\n instanceId,\n organizationChain,\n preferences,\n recover,\n reInitialize,\n request,\n requestAll,\n signOut,\n signUp,\n ],\n );\n\n return (\n <ThunderIDContext.Provider value={value}>\n <I18nProvider preferences={preferences?.i18n} vendor={getVendorPrefix(config.vendor)}>\n <FlowMetaProvider enabled={preferences?.resolveFromMeta !== false}>\n <ThemeProvider\n theme={{\n ...preferences?.theme?.overrides,\n direction: preferences?.theme?.direction,\n }}\n >\n <FlowProvider>\n <UserProvider profile={userProfile!} onUpdateProfile={handleProfileUpdate}>\n <ComponentRendererProvider renderers={(extensions?.components?.renderers ?? {}) as any}>\n {children}\n </ComponentRendererProvider>\n </UserProvider>\n </FlowProvider>\n </ThemeProvider>\n </FlowMetaProvider>\n </I18nProvider>\n </ThunderIDContext.Provider>\n );\n};\n\nexport default ThunderIDProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4CA,MAAMA,+DACJ,oBACA,oBACD;AAOD,MAAMC,qBAAoE,EACxE,gBACA,iBACA,SAAS,gBACT,UACA,U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B;cAC1D,2CAACC;KACC,OAAO;MACL,GAAG,aAAa,OAAO;MACvB,WAAW,aAAa,OAAO;MAChC;eAED,2CAACC,0CACC,2CAACC;MAAa,SAAS;MAAc,iBAAiB;gBACpD,2CAACC;OAA0B,WAAY,YAAY,YAAY,aAAa,EAAE;OAC3E;QACyB;OACf,GACF;MACD;KACC;IACN;GACW;;AAIhC,gCAAe"}
1
+ {"version":3,"file":"ThunderIDProvider.cjs","names":["logger: ReturnType<typeof createPackageComponentLogger>","ThunderIDProvider: FC<PropsWithChildren<ThunderIDProviderProps>>","reRenderCheckRef: RefObject<boolean>","client: ThunderIDReactClient","ThunderIDReactClient","storageManagerRef: any","useBrowserUrl","pendingSessionUpdateRef: RefObject<Promise<void> | null>","resolvedBaseUrl: string","decodedToken: IdToken","shouldFetchProfile: boolean","claims: User","currentSignInStatus: boolean","getUsersMe","arg1: any","isV2FlowRequest: boolean","ThunderIDRuntimeError","currentUrl: URL","urlParams: URLSearchParams","code: string | null","executionIdFromUrl: string | null","storedExecutionId: string | null","interval: NodeJS.Timeout","status: boolean","getDecodedIdToken: () => Promise<IdToken>","getIdToken: () => Promise<string>","getAccessToken: () => Promise<string>","getStorageManager: () => Promise<any>","storageManager: any","request: (...args: any[]) => Promise<any>","requestAll: (...args: any[]) => Promise<any>","exchangeToken: (exchangeConfig: any) => Promise<any>","signOut: (...args: any[]) => Promise<any>","recover: (payload: any) => Promise<any>","signUp: (...args: any[]) => Promise<any>","clearSession: (...args: any[]) => Promise<any>","reInitialize: (reInitConfig: any) => Promise<any>","result: any","reinitializedConfig: ThunderIDReactConfig","value: any","ThunderIDContext","I18nProvider","FlowMetaProvider","ThemeProvider","FlowProvider","UserProvider","ComponentRendererProvider"],"sources":["../../../../src/contexts/ThunderID/ThunderIDProvider.tsx"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ThunderIDRuntimeError,\n generateFlattenedUserProfile,\n OIDCDiscoveryApiResponse,\n SignInOptions,\n User,\n UserProfile,\n IdToken,\n extractUserClaimsFromIdToken,\n EmbeddedSignInFlowResponse,\n createPackageComponentLogger,\n getVendorPrefix,\n resolveResourceEndpoint,\n} from '@thunderid/browser';\nimport {FC, RefObject, PropsWithChildren, ReactElement, useEffect, useMemo, useRef, useState, useCallback} from 'react';\nimport ThunderIDContext from './ThunderIDContext';\nimport useBrowserUrl from '../../hooks/useBrowserUrl';\nimport {ThunderIDReactConfig} from '../../models/config';\nimport ThunderIDReactClient from '../../ThunderIDReactClient';\nimport ComponentRendererProvider from '../ComponentRenderer/ComponentRendererProvider';\nimport FlowProvider from '../Flow/FlowProvider';\nimport FlowMetaProvider from '../FlowMeta/FlowMetaProvider';\nimport I18nProvider from '../I18n/I18nProvider';\nimport ThemeProvider from '../Theme/ThemeProvider';\nimport UserProvider from '../User/UserProvider';\nimport getUsersMe from '../../api/getUsersMe';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'ThunderIDProvider',\n);\n\n/**\n * Props interface of {@link ThunderIDProvider}\n */\nexport type ThunderIDProviderProps = ThunderIDReactConfig;\n\nconst ThunderIDProvider: FC<PropsWithChildren<ThunderIDProviderProps>> = ({\n afterSignInUrl,\n afterSignOutUrl,\n baseUrl: initialBaseUrl,\n clientId,\n children,\n extensions,\n scopes,\n preferences,\n signInUrl,\n signUpUrl,\n organizationHandle,\n applicationId,\n signInOptions,\n tokenRequest,\n syncSession,\n instanceId = 0,\n organizationChain,\n ...rest\n}: PropsWithChildren<ThunderIDProviderProps>): ReactElement => {\n const reRenderCheckRef: RefObject<boolean> = useRef(false);\n const client: ThunderIDReactClient = useMemo(() => new ThunderIDReactClient(instanceId), [instanceId]);\n const storageManagerRef: any = useRef<any>(null);\n const {hasAuthParams, hasCalledForThisInstance} = useBrowserUrl();\n const [user, setUser] = useState<any | null>(null);\n const [isSignedInSync, setIsSignedInSync] = useState<boolean>(false);\n const [isInitializedSync, setIsInitializedSync] = useState<boolean>(false);\n const [isLoadingSync, setIsLoadingSync] = useState<boolean>(true);\n\n const [userProfile, setUserProfile] = useState<UserProfile | null>(null);\n const [baseUrl, setBaseUrl] = useState<string>(initialBaseUrl ?? '');\n const [config, setConfig] = useState<ThunderIDReactConfig>({\n afterSignInUrl: afterSignInUrl ?? window.location.origin,\n afterSignOutUrl: afterSignOutUrl ?? window.location.origin,\n applicationId,\n baseUrl,\n clientId,\n organizationChain,\n organizationHandle,\n scopes,\n signInOptions,\n tokenRequest,\n signInUrl,\n signUpUrl,\n syncSession,\n ...rest,\n });\n\n const [isUpdatingSession, setIsUpdatingSession] = useState<boolean>(false);\n const [wellKnown, setWellKnown] = useState<OIDCDiscoveryApiResponse | null>(null);\n\n // Holds the in-flight `updateSession()` promise so concurrent callers coalesce onto a single\n // `/users/me` request instead of issuing one each.\n const pendingSessionUpdateRef: RefObject<Promise<void> | null> = useRef<Promise<void> | null>(null);\n\n useEffect(() => {\n setBaseUrl(initialBaseUrl ?? '');\n }, [initialBaseUrl]);\n\n useEffect(() => {\n (async (): Promise<void> => {\n await client.initialize(config);\n const initializedConfig: ThunderIDReactConfig = await client.getConfiguration();\n setConfig(initializedConfig);\n setWellKnown(await client.getDiscoveryResponse());\n })();\n }, []);\n\n async function performSessionUpdate(): Promise<void> {\n try {\n // Set flag to prevent loading state tracking from interfering\n setIsUpdatingSession(true);\n setIsLoadingSync(true);\n let resolvedBaseUrl: string = baseUrl;\n\n const decodedToken: IdToken = await client.getDecodedIdToken();\n\n // If there's a `user_org` claim in the ID token,\n // Treat this login as a organization login.\n if (decodedToken?.['user_org']) {\n resolvedBaseUrl = `${(await client.getConfiguration()).baseUrl}/o`;\n setBaseUrl(resolvedBaseUrl);\n }\n\n const shouldFetchProfile: boolean = preferences?.user?.fetchUserProfile !== false;\n const claims: User = extractUserClaimsFromIdToken(decodedToken) as User;\n let profileData = claims;\n const currentSignInStatus: boolean = await client.isSignedIn();\n\n if (currentSignInStatus && shouldFetchProfile) {\n try {\n const fetchedProfile = await getUsersMe({\n baseUrl: resolvedBaseUrl,\n url: resolveResourceEndpoint('usersMe', config),\n instanceId,\n });\n profileData = {...claims, ...fetchedProfile};\n } catch (err) {\n logger.warn('Failed to fetch user profile from /users/me:', err);\n }\n }\n\n setUser(profileData);\n setUserProfile({\n flattenedProfile: generateFlattenedUserProfile(profileData, []),\n profile: profileData,\n });\n\n // CRITICAL: Update sign-in status BEFORE setting loading to false\n // This prevents the race condition where ProtectedRoute sees isLoading=false but isSignedIn=false\n setIsSignedInSync(currentSignInStatus);\n } catch (error) {\n // TODO: Add an error log.\n } finally {\n // Clear the flag and set final loading state\n setIsUpdatingSession(false);\n setIsLoadingSync(client.isLoading());\n }\n }\n\n /**\n * Single-flight wrapper around {@link performSessionUpdate}.\n *\n * Concurrent callers share the in-flight request instead of each issuing their own `/users/me`.\n * This is not a cache: once the request settles the ref is cleared, so a later caller (e.g.\n * revalidation after a profile update) fetches again.\n */\n async function updateSession(): Promise<void> {\n if (pendingSessionUpdateRef.current) {\n return pendingSessionUpdateRef.current;\n }\n\n pendingSessionUpdateRef.current = performSessionUpdate().finally(() => {\n pendingSessionUpdateRef.current = null;\n });\n\n return pendingSessionUpdateRef.current;\n }\n\n async function signIn(...args: any): Promise<User | EmbeddedSignInFlowResponse> {\n // Check if this is a V2 embedded flow request BEFORE calling signIn\n // This allows us to skip session checks entirely for V2 flows\n const arg1: any = args[0];\n const isV2FlowRequest: boolean =\n typeof arg1 === 'object' && arg1 !== null && ('executionId' in arg1 || 'applicationId' in arg1);\n\n try {\n if (!isV2FlowRequest) {\n setIsUpdatingSession(true);\n setIsLoadingSync(true);\n }\n\n return await client.signIn(...args);\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Sign in failed: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'thunderid-signIn-Error',\n 'react',\n 'An error occurred while trying to sign in.',\n );\n } finally {\n if (!isV2FlowRequest) {\n setIsUpdatingSession(false);\n setIsLoadingSync(client.isLoading());\n }\n }\n }\n\n /**\n * Try signing in when the component is mounted.\n */\n useEffect(() => {\n // React 18.x Strict.Mode has a new check for `Ensuring reusable state` to facilitate an upcoming react feature.\n // https://reactjs.org/docs/strict-mode.html#ensuring-reusable-state\n // This will remount all the useEffects to ensure that there are no unexpected side effects.\n // When react remounts the signIn hook of the AuthProvider, it will cause a race condition. Hence, we have to\n // prevent the re-render of this hook as suggested in the following discussion.\n // https://github.com/reactwg/react-18/discussions/18#discussioncomment-795623\n if (reRenderCheckRef.current) {\n return;\n }\n\n reRenderCheckRef.current = true;\n\n (async (): Promise<void> => {\n // Sync session state whenever sign-in completes (both redirect and embedded V2 flows).\n // Pass the user returned by the SDK's sign-in flow so users/me result is not discarded.\n await client.on('sign-in', async () => {\n await updateSession();\n });\n\n // Start auto-refresh with a soft failure. This also covers the case where the access token\n // expired while the refresh token is still valid — startAutoRefreshToken() calls\n // refreshAccessToken() immediately when timeUntilRefresh <= 0 — so the sign-in check below\n // sees the refreshed state.\n try {\n await client.startAutoRefreshToken();\n } catch (error) {\n logger.warn('Failed to schedule automatic token refresh.', error);\n }\n\n // User is already authenticated. Restore the session and skip the sign-in path.\n if (await client.isSignedIn()) {\n await updateSession();\n\n return;\n }\n\n const currentUrl: URL = new URL(window.location.href);\n const hasAuthParamsResult: boolean =\n hasAuthParams(currentUrl, config.afterSignInUrl!) && hasCalledForThisInstance(currentUrl, instanceId ?? 0);\n\n if (hasAuthParamsResult) {\n try {\n const urlParams: URLSearchParams = currentUrl.searchParams;\n const code: string | null = urlParams.get('code');\n const executionIdFromUrl: string | null = urlParams.get('executionId');\n const storedExecutionId: string | null = sessionStorage.getItem(\n `${getVendorPrefix(config.vendor)}_execution_id`,\n );\n\n if (code && !executionIdFromUrl && !storedExecutionId) {\n await signIn();\n }\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Sign in failed: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'thunderid-signIn-Error',\n 'react',\n 'An error occurred while trying to sign in.',\n );\n }\n }\n })();\n }, []);\n\n /**\n * Check if the user is signed in and update the state accordingly.\n * This will also set an interval to check for the sign-in status every second\n * until the user is signed in.\n */\n useEffect(() => {\n let interval: NodeJS.Timeout;\n\n (async (): Promise<void> => {\n try {\n const status: boolean = await client.isSignedIn();\n\n setIsSignedInSync(status);\n\n if (!status) {\n interval = setInterval(async () => {\n const newStatus: boolean = await client.isSignedIn();\n\n if (newStatus) {\n setIsSignedInSync(true);\n clearInterval(interval);\n }\n }, 1000);\n } else {\n // TODO: Add a debug log to indicate that the user is already signed in.\n }\n } catch (error) {\n setIsSignedInSync(false);\n }\n })();\n\n return (): void => {\n if (interval) {\n clearInterval(interval);\n }\n };\n }, [client]);\n\n useEffect(() => {\n (async (): Promise<void> => {\n try {\n const status: boolean = await client.isInitialized();\n\n setIsInitializedSync(status);\n } catch (error) {\n setIsInitializedSync(false);\n }\n })();\n }, [client]);\n\n /**\n * Track loading state changes from the ThunderID client\n */\n useEffect(() => {\n const checkLoadingState = (): void => {\n // Don't override loading state during critical session updates\n if (isUpdatingSession) {\n return;\n }\n\n // Don't set loading=false while auth params are in the URL and user isn't signed in yet.\n // This prevents ProtectedRoute from redirecting before the sign-in effect processes the auth code.\n const currentUrl: URL = new URL(window.location.href);\n if (!isSignedInSync && hasAuthParams(currentUrl, config.afterSignInUrl!)) {\n return;\n }\n\n setIsLoadingSync(client.isLoading());\n };\n\n // Initial check\n checkLoadingState();\n\n // Set up an interval to check for loading state changes\n const interval: NodeJS.Timeout = setInterval(checkLoadingState, 100);\n\n return (): void => {\n clearInterval(interval);\n };\n }, [client, isLoadingSync, isSignedInSync, isUpdatingSession]);\n\n const signInSilently = async (options?: SignInOptions): Promise<User | boolean> => {\n try {\n setIsUpdatingSession(true);\n setIsLoadingSync(true);\n return await client.signInSilently(options);\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Error while signing in silently: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'thunderid-signInSilently-Error',\n 'react',\n 'An error occurred while trying to sign in silently.',\n );\n } finally {\n setIsUpdatingSession(false);\n setIsLoadingSync(client.isLoading());\n }\n };\n\n const handleProfileUpdate = (payload: User): void => {\n setUser(payload);\n setUserProfile((prev: UserProfile | null) => ({\n flattenedProfile: generateFlattenedUserProfile(payload),\n profile: payload,\n }));\n };\n\n const getDecodedIdToken: () => Promise<IdToken> = useCallback(\n async (): Promise<IdToken> => client.getDecodedIdToken(),\n [client],\n );\n\n const getIdToken: () => Promise<string> = useCallback(async (): Promise<string> => client.getIdToken(), [client]);\n\n const getAccessToken: () => Promise<string> = useCallback(\n async (): Promise<string> => client.getAccessToken(),\n [client],\n );\n\n const getStorageManager: () => Promise<any> = useCallback(async (): Promise<any> => {\n const storageManager: any = storageManagerRef.current ?? (await client.getStorageManager());\n if (storageManager) {\n storageManagerRef.current = storageManager;\n }\n return storageManager;\n }, [client]);\n\n const request: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.request(...args),\n [client],\n );\n\n const requestAll: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.requestAll(...args),\n [client],\n );\n\n const exchangeToken: (exchangeConfig: any) => Promise<any> = useCallback(\n async (exchangeConfig: any): Promise<any> => client.exchangeToken(exchangeConfig),\n [client],\n );\n\n const signOut: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.signOut(...args),\n [client],\n );\n\n const recover: (payload: any) => Promise<any> = useCallback(\n async (payload: any): Promise<any> => client.recover(payload),\n [client],\n );\n\n const signUp: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.signUp(...args),\n [client],\n );\n\n const clearSession: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.clearSession(...args),\n [client],\n );\n\n const reInitialize: (reInitConfig: any) => Promise<any> = useCallback(\n async (reInitConfig: any): Promise<any> => {\n const result: any = await client.reInitialize(reInitConfig);\n\n // Refresh React state from the reinitialized client so the context (config.endpoints,\n // baseUrl, discovery) reflects the new configuration instead of the pre-reinitialization state.\n const reinitializedConfig: ThunderIDReactConfig = await client.getConfiguration();\n setConfig(reinitializedConfig);\n setBaseUrl(reinitializedConfig.baseUrl ?? '');\n setWellKnown(await client.getDiscoveryResponse());\n\n return result;\n },\n [client],\n );\n\n const value: any = useMemo(\n () => ({\n afterSignInUrl: config.afterSignInUrl,\n applicationId: config.applicationId,\n baseUrl,\n endpoints: config.endpoints,\n scopes: config.scopes,\n clearSession,\n clientId,\n discovery: {\n wellKnown,\n },\n exchangeToken,\n getAccessToken,\n getDecodedIdToken,\n getIdToken,\n getStorageManager,\n http: {\n request,\n requestAll,\n },\n instanceId,\n isInitialized: isInitializedSync,\n isLoading: isLoadingSync,\n isSignedIn: isSignedInSync,\n organizationChain,\n organizationHandle: config?.organizationHandle,\n preferences,\n reInitialize,\n recover,\n signIn,\n signInOptions,\n tokenRequest,\n signInSilently,\n signInUrl,\n signOut,\n signUp,\n signUpUrl,\n syncSession,\n user,\n vendor: getVendorPrefix(config.vendor),\n }),\n [\n applicationId,\n config?.organizationHandle,\n config.vendor,\n config.afterSignInUrl,\n config.endpoints,\n config.scopes,\n signInUrl,\n signUpUrl,\n baseUrl,\n clientId,\n wellKnown,\n isInitializedSync,\n isLoadingSync,\n isSignedInSync,\n signIn,\n signInSilently,\n user,\n client,\n signInOptions,\n tokenRequest,\n syncSession,\n getDecodedIdToken,\n clearSession,\n exchangeToken,\n getAccessToken,\n getStorageManager,\n instanceId,\n organizationChain,\n preferences,\n recover,\n reInitialize,\n request,\n requestAll,\n signOut,\n signUp,\n ],\n );\n\n return (\n <ThunderIDContext.Provider value={value}>\n <I18nProvider preferences={preferences?.i18n} vendor={getVendorPrefix(config.vendor)}>\n <FlowMetaProvider enabled={preferences?.resolveFromMeta !== false}>\n <ThemeProvider\n theme={{\n ...preferences?.theme?.overrides,\n direction: preferences?.theme?.direction,\n }}\n >\n <FlowProvider>\n <UserProvider profile={userProfile!} onUpdateProfile={handleProfileUpdate}>\n <ComponentRendererProvider renderers={(extensions?.components?.renderers ?? {}) as any}>\n {children}\n </ComponentRendererProvider>\n </UserProvider>\n </FlowProvider>\n </ThemeProvider>\n </FlowMetaProvider>\n </I18nProvider>\n </ThunderIDContext.Provider>\n );\n};\n\nexport default ThunderIDProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,MAAMA,+DACJ,oBACA,oBACD;AAOD,MAAMC,qBAAoE,EACxE,gBACA,iBACA,SAAS,gBACT,UACA,UACA,YACA,QACA,aACA,WACA,WACA,oBACA,eACA,eACA,cACA,aACA,aAAa,GACb,kBACA,GAAG,WAC0D;CAC7D,MAAMC,qCAA8C,MAAM;CAC1D,MAAMC,kCAA6C,IAAIC,qCAAqB,WAAW,EAAE,CAAC,WAAW,CAAC;CACtG,MAAMC,sCAAqC,KAAK;CAChD,MAAM,EAAC,eAAe,6BAA4BC,+BAAe;CACjE,MAAM,CAAC,MAAM,+BAAgC,KAAK;CAClD,MAAM,CAAC,gBAAgB,yCAAuC,MAAM;CACpE,MAAM,CAAC,mBAAmB,4CAA0C,MAAM;CAC1E,MAAM,CAAC,eAAe,wCAAsC,KAAK;CAEjE,MAAM,CAAC,aAAa,sCAA+C,KAAK;CACxE,MAAM,CAAC,SAAS,kCAA+B,kBAAkB,GAAG;CACpE,MAAM,CAAC,QAAQ,iCAA4C;EACzD,gBAAgB,kBAAkB,OAAO,SAAS;EAClD,iBAAiB,mBAAmB,OAAO,SAAS;EACpD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG;EACJ,CAAC;CAEF,MAAM,CAAC,mBAAmB,4CAA0C,MAAM;CAC1E,MAAM,CAAC,WAAW,oCAA0D,KAAK;CAIjF,MAAMC,4CAAwF,KAAK;AAEnG,4BAAgB;AACd,aAAW,kBAAkB,GAAG;IAC/B,CAAC,eAAe,CAAC;AAEpB,4BAAgB;AACd,GAAC,YAA2B;AAC1B,SAAM,OAAO,W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EACA;EACA;EACA;EACA;EACA,MAAM;GACJ;GACA;GACD;EACD;EACA,eAAe;EACf,WAAW;EACX,YAAY;EACZ;EACA,oBAAoB,QAAQ;EAC5B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iDAAwB,OAAO,OAAO;EACvC,GACD;EACE;EACA,QAAQ;EACR,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AAED,QACE,2CAACC,iCAAiB;EAAgB;YAChC,2CAACC;GAAa,aAAa,aAAa;GAAM,iDAAwB,OAAO,OAAO;aAClF,2CAACC;IAAiB,SAAS,aAAa,oBAAoB;cAC1D,2CAACC;KACC,OAAO;MACL,GAAG,aAAa,OAAO;MACvB,WAAW,aAAa,OAAO;MAChC;eAED,2CAACC,0CACC,2CAACC;MAAa,SAAS;MAAc,iBAAiB;gBACpD,2CAACC;OAA0B,WAAY,YAAY,YAAY,aAAa,EAAE;OAC3E;QACyB;OACf,GACF;MACD;KACC;IACN;GACW;;AAIhC,gCAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"useThunderID.cjs","names":["context: ThunderIDContextProps | null","ThunderIDContext","flowMetaContext: FlowMetaContextValue | null","FlowMetaContext","i18nContext: I18nContextValue | null","I18nContext","meta: FlowMetaContextValue['meta']","isMetaLoading: boolean"],"sources":["../../../../src/contexts/ThunderID/useThunderID.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, 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 {resolveFlowTemplateLiterals} from '@thunderid/browser';\nimport {useContext} from 'react';\nimport ThunderIDContext, {ThunderIDContextProps} from './ThunderIDContext';\nimport FlowMetaContext, {FlowMetaContextValue} from '../FlowMeta/FlowMetaContext';\nimport I18nContext, {I18nContextValue} from '../I18n/I18nContext';\n\nconst useThunderID = (): ThunderIDContextProps => {\n const context: ThunderIDContextProps | null = useContext(ThunderIDContext);\n\n if (!context) {\n throw new Error('useThunderID must be used within an ThunderIDProvider');\n }\n\n // FlowMetaContext lives inside ThunderIDProvider, so it is always present in\n // normal usage. Optional chaining keeps the hook safe in unit tests that\n // don't render FlowMetaProvider.\n const flowMetaContext: FlowMetaContextValue | null = useContext(FlowMetaContext);\n\n // I18nContext provides the translation function. Direct useContext (rather\n // than useTranslation) avoids throwing in test environments without I18nProvider.\n const i18nContext: I18nContextValue | null = useContext(I18nContext);\n\n const meta: FlowMetaContextValue['meta'] = flowMetaContext?.meta ?? null;\n const isMetaLoading: boolean = flowMetaContext?.isLoading ?? false;\n\n return {\n ...context,\n isMetaLoading,\n meta,\n resolveFlowTemplateLiterals: (text: string | undefined): string =>\n resolveFlowTemplateLiterals(text, {\n meta,\n t: i18nContext?.t ?? ((key: string): string => key),\n }),\n };\n};\n\nexport default useThunderID;\n"],"mappings":";;;;;;;;;;AAwBA,MAAM,qBAA4C;CAChD,MAAMA,gCAAmDC,iCAAiB;AAE1E,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,wDAAwD;CAM1E,MAAMC,wCAA0DC,gCAAgB;CAIhF,MAAMC,oCAAkDC,4BAAY;CAEpE,MAAMC,OAAqC,iBAAiB,QAAQ;CACpE,MAAMC,gBAAyB,iBAAiB,aAAa;AAE7D,QAAO;EACL,GAAG;EACH;EACA;EACA,8BAA8B,8DACA,MAAM;GAChC;GACA,GAAG,aAAa,OAAO,QAAwB;GAChD,CAAC;EACL;;AAGH,2BAAe"}
1
+ {"version":3,"file":"useThunderID.cjs","names":["context: ThunderIDContextProps | null","ThunderIDContext","flowMetaContext: FlowMetaContextValue | null","FlowMetaContext","i18nContext: I18nContextValue | null","I18nContext","meta: FlowMetaContextValue['meta']","isMetaLoading: boolean"],"sources":["../../../../src/contexts/ThunderID/useThunderID.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {resolveFlowTemplateLiterals} from '@thunderid/browser';\nimport {useContext} from 'react';\nimport ThunderIDContext, {ThunderIDContextProps} from './ThunderIDContext';\nimport FlowMetaContext, {FlowMetaContextValue} from '../FlowMeta/FlowMetaContext';\nimport I18nContext, {I18nContextValue} from '../I18n/I18nContext';\n\nconst useThunderID = (): ThunderIDContextProps => {\n const context: ThunderIDContextProps | null = useContext(ThunderIDContext);\n\n if (!context) {\n throw new Error('useThunderID must be used within an ThunderIDProvider');\n }\n\n // FlowMetaContext lives inside ThunderIDProvider, so it is always present in\n // normal usage. Optional chaining keeps the hook safe in unit tests that\n // don't render FlowMetaProvider.\n const flowMetaContext: FlowMetaContextValue | null = useContext(FlowMetaContext);\n\n // I18nContext provides the translation function. Direct useContext (rather\n // than useTranslation) avoids throwing in test environments without I18nProvider.\n const i18nContext: I18nContextValue | null = useContext(I18nContext);\n\n const meta: FlowMetaContextValue['meta'] = flowMetaContext?.meta ?? null;\n const isMetaLoading: boolean = flowMetaContext?.isLoading ?? false;\n\n return {\n ...context,\n isMetaLoading,\n meta,\n resolveFlowTemplateLiterals: (text: string | undefined): string =>\n resolveFlowTemplateLiterals(text, {\n meta,\n t: i18nContext?.t ?? ((key: string): string => key),\n }),\n };\n};\n\nexport default useThunderID;\n"],"mappings":";;;;;;;;;;AASA,MAAM,qBAA4C;CAChD,MAAMA,gCAAmDC,iCAAiB;AAE1E,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,wDAAwD;CAM1E,MAAMC,wCAA0DC,gCAAgB;CAIhF,MAAMC,oCAAkDC,4BAAY;CAEpE,MAAMC,OAAqC,iBAAiB,QAAQ;CACpE,MAAMC,gBAAyB,iBAAiB,aAAa;AAE7D,QAAO;EACL,GAAG;EACH;EACA;EACA,8BAA8B,8DACA,MAAM;GAChC;GACA,GAAG,aAAa,OAAO,QAAwB;GAChD,CAAC;EACL;;AAGH,2BAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"UserContext.cjs","names":["UserContext: Context<UserContextProps | null>"],"sources":["../../../../src/contexts/User/UserContext.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, 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 {User, UpdateMeProfileConfig} from '@thunderid/browser';\nimport {Context, createContext} from 'react';\n\n/**\n * Props interface of {@link UserContext}\n */\nexport interface UserContextProps {\n flattenedProfile: User | null;\n onUpdateProfile: (payload: User) => void;\n profile: User | null;\n revalidateProfile: () => Promise<void>;\n updateProfile: (\n requestConfig: UpdateMeProfileConfig,\n sessionId?: string,\n ) => Promise<{data: {user: User}; error: string; success: boolean}>;\n}\n\n/**\n * Context object for managing user profile data and related operations.\n */\nconst UserContext: Context<UserContextProps | null> = createContext<null | UserContextProps>({\n flattenedProfile: null,\n onUpdateProfile: () => null,\n profile: null,\n revalidateProfile: () => null as unknown as Promise<void>,\n updateProfile: () => null as unknown as Promise<{data: {user: User}; error: string; success: boolean}>,\n});\n\nUserContext.displayName = 'UserContext';\n\nexport default UserContext;\n"],"mappings":";;;;;;;;AAsCA,MAAMA,uCAAuF;CAC3F,kBAAkB;CAClB,uBAAuB;CACvB,SAAS;CACT,yBAAyB;CACzB,qBAAqB;CACtB,CAAC;AAEF,YAAY,cAAc;AAE1B,0BAAe"}
1
+ {"version":3,"file":"UserContext.cjs","names":["UserContext: Context<UserContextProps | null>"],"sources":["../../../../src/contexts/User/UserContext.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {User, UpdateMeProfileConfig} from '@thunderid/browser';\nimport {Context, createContext} from 'react';\n\n/**\n * Props interface of {@link UserContext}\n */\nexport interface UserContextProps {\n flattenedProfile: User | null;\n onUpdateProfile: (payload: User) => void;\n profile: User | null;\n revalidateProfile: () => Promise<void>;\n updateProfile: (\n requestConfig: UpdateMeProfileConfig,\n sessionId?: string,\n ) => Promise<{data: {user: User}; error: string; success: boolean}>;\n}\n\n/**\n * Context object for managing user profile data and related operations.\n */\nconst UserContext: Context<UserContextProps | null> = createContext<null | UserContextProps>({\n flattenedProfile: null,\n onUpdateProfile: () => null,\n profile: null,\n revalidateProfile: () => null as unknown as Promise<void>,\n updateProfile: () => null as unknown as Promise<{data: {user: User}; error: string; success: boolean}>,\n});\n\nUserContext.displayName = 'UserContext';\n\nexport default UserContext;\n"],"mappings":";;;;;;;;AAuBA,MAAMA,uCAAuF;CAC3F,kBAAkB;CAClB,uBAAuB;CACvB,SAAS;CACT,yBAAyB;CACzB,qBAAqB;CACtB,CAAC;AAEF,YAAY,cAAc;AAE1B,0BAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"UserProvider.cjs","names":["UserProvider: FC<PropsWithChildren<UserProviderProps>>","contextValue: any","UserContext"],"sources":["../../../../src/contexts/User/UserProvider.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025, 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 {UpdateMeProfileConfig, User, UserProfile} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, useMemo} from 'react';\nimport UserContext from './UserContext';\n\n/**\n * Props interface of {@link UserProvider}\n */\nexport interface UserProviderProps {\n onUpdateProfile?: (payload: User) => void;\n profile: UserProfile;\n revalidateProfile?: () => Promise<void>;\n updateProfile?: (\n requestConfig: UpdateMeProfileConfig,\n sessionId?: string,\n ) => Promise<{data: {user: User}; error: string; success: boolean}>;\n}\n\n/**\n * UserProvider component that manages user profile data and provides it through UserContext.\n *\n * This provider:\n * - Fetches user profile data from the ME endpoint\n * - Generates both nested and flattened user profiles\n * - Provides functions for refreshing and updating user data\n * - Handles loading states and errors\n *\n * @example\n * ```tsx\n * // Basic usage\n * <UserProvider>\n * <App />\n * </UserProvider>\n *\n * // With custom error handling\n * <UserProvider onError={(error) => console.error('User error:', error)}>\n * <App />\n * </UserProvider>\n *\n * // Disable auto-fetch (fetch manually using refreshUser)\n * <UserProvider autoFetch={false}>\n * <App />\n * </UserProvider>\n * ```\n */\nconst UserProvider: FC<PropsWithChildren<UserProviderProps>> = ({\n children,\n profile,\n revalidateProfile,\n onUpdateProfile,\n updateProfile,\n}: PropsWithChildren<UserProviderProps>): ReactElement => {\n const contextValue: any = useMemo(\n () => ({\n flattenedProfile: profile?.flattenedProfile,\n onUpdateProfile,\n profile: profile?.profile,\n revalidateProfile,\n updateProfile,\n }),\n [profile, onUpdateProfile, revalidateProfile, updateProfile],\n );\n\n return <UserContext.Provider value={contextValue}>{children}</UserContext.Provider>;\n};\n\nexport default UserProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,MAAMA,gBAA0D,EAC9D,UACA,SACA,mBACA,iBACA,oBACwD;CACxD,MAAMC,yCACG;EACL,kBAAkB,SAAS;EAC3B;EACA,SAAS,SAAS;EAClB;EACA;EACD,GACD;EAAC;EAAS;EAAiB;EAAmB;EAAc,CAC7D;AAED,QAAO,2CAACC,4BAAY;EAAS,OAAO;EAAe;GAAgC;;AAGrF,2BAAe"}
1
+ {"version":3,"file":"UserProvider.cjs","names":["UserProvider: FC<PropsWithChildren<UserProviderProps>>","contextValue: any","UserContext"],"sources":["../../../../src/contexts/User/UserProvider.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {UpdateMeProfileConfig, User, UserProfile} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, useMemo} from 'react';\nimport UserContext from './UserContext';\n\n/**\n * Props interface of {@link UserProvider}\n */\nexport interface UserProviderProps {\n onUpdateProfile?: (payload: User) => void;\n profile: UserProfile;\n revalidateProfile?: () => Promise<void>;\n updateProfile?: (\n requestConfig: UpdateMeProfileConfig,\n sessionId?: string,\n ) => Promise<{data: {user: User}; error: string; success: boolean}>;\n}\n\n/**\n * UserProvider component that manages user profile data and provides it through UserContext.\n *\n * This provider:\n * - Fetches user profile data from the ME endpoint\n * - Generates both nested and flattened user profiles\n * - Provides functions for refreshing and updating user data\n * - Handles loading states and errors\n *\n * @example\n * ```tsx\n * // Basic usage\n * <UserProvider>\n * <App />\n * </UserProvider>\n *\n * // With custom error handling\n * <UserProvider onError={(error) => console.error('User error:', error)}>\n * <App />\n * </UserProvider>\n *\n * // Disable auto-fetch (fetch manually using refreshUser)\n * <UserProvider autoFetch={false}>\n * <App />\n * </UserProvider>\n * ```\n */\nconst UserProvider: FC<PropsWithChildren<UserProviderProps>> = ({\n children,\n profile,\n revalidateProfile,\n onUpdateProfile,\n updateProfile,\n}: PropsWithChildren<UserProviderProps>): ReactElement => {\n const contextValue: any = useMemo(\n () => ({\n flattenedProfile: profile?.flattenedProfile,\n onUpdateProfile,\n profile: profile?.profile,\n revalidateProfile,\n updateProfile,\n }),\n [profile, onUpdateProfile, revalidateProfile, updateProfile],\n );\n\n return <UserContext.Provider value={contextValue}>{children}</UserContext.Provider>;\n};\n\nexport default UserProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAMA,gBAA0D,EAC9D,UACA,SACA,mBACA,iBACA,oBACwD;CACxD,MAAMC,yCACG;EACL,kBAAkB,SAAS;EAC3B;EACA,SAAS,SAAS;EAClB;EACA;EACD,GACD;EAAC;EAAS;EAAiB;EAAmB;EAAc,CAC7D;AAED,QAAO,2CAACC,4BAAY;EAAS,OAAO;EAAe;GAAgC;;AAGrF,2BAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"useUser.cjs","names":["context: UserContextProps | null","UserContext"],"sources":["../../../../src/contexts/User/useUser.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, 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 {useContext} from 'react';\nimport UserContext, {UserContextProps} from './UserContext';\n\n/**\n * Hook to access the User context.\n *\n * This hook provides access to user profile data including:\n * - Raw profile API response\n * - Nested user object\n * - Flattened user profile\n * - Functions to refresh and update user data\n * - Loading states and error handling\n *\n * @returns {UserContextProps} The user context value containing all user-related data and functions\n * @throws {Error} Throws an error if used outside of UserProvider\n *\n * @example\n * ```tsx\n * import {useUser} from '@thunderid/react';\n *\n * function ProfileComponent() {\n * const {\n * isLoading,\n * profile,\n * schemas,\n * user,\n * flattenedUser,\n * refreshUser,\n * updateUser,\n * error\n * } = useUser();\n *\n * if (isLoading) {\n * return <div>Loading user data...</div>;\n * }\n *\n * if (error) {\n * return <div>Error: {error.message}</div>;\n * }\n *\n * return (\n * <div>\n * <h1>Welcome {user?.name?.givenName}!</h1>\n * <p>Email: {flattenedUser?.emails}</p>\n * <button onClick={refreshUser}>Refresh Profile</button>\n * </div>\n * );\n * }\n *\n * // Access specific user properties\n * function UserEmail() {\n * const {flattenedUser} = useUser();\n * return <span>{flattenedUser?.emails?.[0]}</span>;\n * }\n *\n * // Update user profile\n * function EditProfile() {\n * const {updateUser, user} = useUser();\n *\n * const handleUpdate = async () => {\n * try {\n * await updateUser({\n * name: {\n * givenName: 'John',\n * familyName: 'Doe'\n * }\n * });\n * } catch (error) {\n * console.error('Update failed:', error);\n * }\n * };\n *\n * return <button onClick={handleUpdate}>Update Name</button>;\n * }\n * ```\n */\nconst useUser = (): UserContextProps => {\n const context: UserContextProps | null = useContext(UserContext);\n\n if (!context) {\n throw new Error('useUser must be used within a UserProvider');\n }\n\n return context;\n};\n\nexport default useUser;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA,MAAM,gBAAkC;CACtC,MAAMA,gCAA8CC,4BAAY;AAEhE,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,6CAA6C;AAG/D,QAAO;;AAGT,sBAAe"}
1
+ {"version":3,"file":"useUser.cjs","names":["context: UserContextProps | null","UserContext"],"sources":["../../../../src/contexts/User/useUser.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {useContext} from 'react';\nimport UserContext, {UserContextProps} from './UserContext';\n\n/**\n * Hook to access the User context.\n *\n * This hook provides access to user profile data including:\n * - Raw profile API response\n * - Nested user object\n * - Flattened user profile\n * - Functions to refresh and update user data\n * - Loading states and error handling\n *\n * @returns {UserContextProps} The user context value containing all user-related data and functions\n * @throws {Error} Throws an error if used outside of UserProvider\n *\n * @example\n * ```tsx\n * import {useUser} from '@thunderid/react';\n *\n * function ProfileComponent() {\n * const {\n * isLoading,\n * profile,\n * schemas,\n * user,\n * flattenedUser,\n * refreshUser,\n * updateUser,\n * error\n * } = useUser();\n *\n * if (isLoading) {\n * return <div>Loading user data...</div>;\n * }\n *\n * if (error) {\n * return <div>Error: {error.message}</div>;\n * }\n *\n * return (\n * <div>\n * <h1>Welcome {user?.name?.givenName}!</h1>\n * <p>Email: {flattenedUser?.emails}</p>\n * <button onClick={refreshUser}>Refresh Profile</button>\n * </div>\n * );\n * }\n *\n * // Access specific user properties\n * function UserEmail() {\n * const {flattenedUser} = useUser();\n * return <span>{flattenedUser?.emails?.[0]}</span>;\n * }\n *\n * // Update user profile\n * function EditProfile() {\n * const {updateUser, user} = useUser();\n *\n * const handleUpdate = async () => {\n * try {\n * await updateUser({\n * name: {\n * givenName: 'John',\n * familyName: 'Doe'\n * }\n * });\n * } catch (error) {\n * console.error('Update failed:', error);\n * }\n * };\n *\n * return <button onClick={handleUpdate}>Update Name</button>;\n * }\n * ```\n */\nconst useUser = (): UserContextProps => {\n const context: UserContextProps | null = useContext(UserContext);\n\n if (!context) {\n throw new Error('useUser must be used within a UserProvider');\n }\n\n return context;\n};\n\nexport default useUser;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,MAAM,gBAAkC;CACtC,MAAMA,gCAA8CC,4BAAY;AAEhE,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,6CAA6C;AAG/D,QAAO;;AAGT,sBAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"useBrowserUrl.cjs","names":[],"sources":["../../../src/hooks/useBrowserUrl.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, 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 {hasAuthParamsInUrl, hasCalledForThisInstanceInUrl} from '@thunderid/browser';\n\n/**\n * Interface for the useBrowserUrl hook return value.\n */\nexport interface UseBrowserUrl {\n /**\n * Checks if the current URL contains authentication parameters.\n *\n * @param url - The URL object to check for authentication parameters\n * @param afterSignInUrl - The URL where the authorization server should redirect after authentication\n * @returns True if the URL contains authentication parameters and matches the afterSignInUrl, or if it contains an error parameter\n */\n hasAuthParams: (url: URL, afterSignInUrl: string) => boolean;\n\n /**\n * Checks if the URL indicates that the authentication flow has been called for this instance.\n *\n * @param url - The URL object to check\n * @param instanceId - The instance ID to check against\n * @returns True if the URL indicates the flow has been called for this instance\n */\n hasCalledForThisInstance: (url: URL, instanceId: number) => boolean;\n}\n\n/**\n * Hook that provides utilities for handling browser URLs in authentication flows.\n *\n * @returns An object containing URL utility functions\n *\n * @example\n * ```tsx\n * const { hasAuthParams } = useBrowserUrl();\n * const url = new URL(window.location.href);\n *\n * if (hasAuthParams(url, \"/after-signin\")) {\n * // Handle authentication callback\n * }\n * ```\n */\nconst useBrowserUrl = (): UseBrowserUrl => {\n const hasAuthParams = (url: URL, afterSignInUrl: string): boolean =>\n (hasAuthParamsInUrl() && new URL(url.origin + url.pathname).toString() === new URL(afterSignInUrl).toString()) ||\n // authParams?.authorizationCode || // FIXME: These are sent externally. Need to see what we can do about this.\n url.searchParams.get('error') !== null;\n\n const hasCalledForThisInstance = (url: URL, instanceId: number): boolean =>\n hasCalledForThisInstanceInUrl(instanceId, url.search);\n\n return {hasAuthParams, hasCalledForThisInstance};\n};\n\nexport default useBrowserUrl;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0DA,MAAM,sBAAqC;CACzC,MAAM,iBAAiB,KAAU,gEACV,IAAI,IAAI,IAAI,IAAI,SAAS,IAAI,SAAS,CAAC,UAAU,KAAK,IAAI,IAAI,eAAe,CAAC,UAAU,IAE7G,IAAI,aAAa,IAAI,QAAQ,KAAK;CAEpC,MAAM,4BAA4B,KAAU,sEACZ,YAAY,IAAI,OAAO;AAEvD,QAAO;EAAC;EAAe;EAAyB;;AAGlD,4BAAe"}
1
+ {"version":3,"file":"useBrowserUrl.cjs","names":[],"sources":["../../../src/hooks/useBrowserUrl.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {hasAuthParamsInUrl, hasCalledForThisInstanceInUrl} from '@thunderid/browser';\n\n/**\n * Interface for the useBrowserUrl hook return value.\n */\nexport interface UseBrowserUrl {\n /**\n * Checks if the current URL contains authentication parameters.\n *\n * @param url - The URL object to check for authentication parameters\n * @param afterSignInUrl - The URL where the authorization server should redirect after authentication\n * @returns True if the URL contains authentication parameters and matches the afterSignInUrl, or if it contains an error parameter\n */\n hasAuthParams: (url: URL, afterSignInUrl: string) => boolean;\n\n /**\n * Checks if the URL indicates that the authentication flow has been called for this instance.\n *\n * @param url - The URL object to check\n * @param instanceId - The instance ID to check against\n * @returns True if the URL indicates the flow has been called for this instance\n */\n hasCalledForThisInstance: (url: URL, instanceId: number) => boolean;\n}\n\n/**\n * Hook that provides utilities for handling browser URLs in authentication flows.\n *\n * @returns An object containing URL utility functions\n *\n * @example\n * ```tsx\n * const { hasAuthParams } = useBrowserUrl();\n * const url = new URL(window.location.href);\n *\n * if (hasAuthParams(url, \"/after-signin\")) {\n * // Handle authentication callback\n * }\n * ```\n */\nconst useBrowserUrl = (): UseBrowserUrl => {\n const hasAuthParams = (url: URL, afterSignInUrl: string): boolean =>\n (hasAuthParamsInUrl() && new URL(url.origin + url.pathname).toString() === new URL(afterSignInUrl).toString()) ||\n // authParams?.authorizationCode || // FIXME: These are sent externally. Need to see what we can do about this.\n url.searchParams.get('error') !== null;\n\n const hasCalledForThisInstance = (url: URL, instanceId: number): boolean =>\n hasCalledForThisInstanceInUrl(instanceId, url.search);\n\n return {hasAuthParams, hasCalledForThisInstance};\n};\n\nexport default useBrowserUrl;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,sBAAqC;CACzC,MAAM,iBAAiB,KAAU,gEACV,IAAI,IAAI,IAAI,IAAI,SAAS,IAAI,SAAS,CAAC,UAAU,KAAK,IAAI,IAAI,eAAe,CAAC,UAAU,IAE7G,IAAI,aAAa,IAAI,QAAQ,KAAK;CAEpC,MAAM,4BAA4B,KAAU,sEACZ,YAAY,IAAI,OAAO;AAEvD,QAAO;EAAC;EAAe;EAAyB;;AAGlD,4BAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"useForm.cjs","names":["fieldError: string | null","getFieldConfig: (name: keyof T) => FormField | undefined","validateField: (name: keyof T) => string | null","validateForm: () => ValidationResult","newErrors: Record<keyof T, string>","error: string | null","globalErrors: Record<string, string>","isValid: boolean","setValue: (name: keyof T, value: string) => void","setValues: (newValues: Partial<T>) => void","setTouched: (name: keyof T, isTouched?: boolean) => void","setTouchedFields: (touchedFields: Partial<Record<keyof T, boolean>>) => void","touchAllFields: () => void","setError: (name: keyof T, error: string) => void","setErrors: (newErrors: Partial<Record<keyof T, string>>) => void","clearErrors: () => void","reset: () => void","handleSubmit: (onSubmit: (values: T) => void | Promise<void>) => (e?: FormEvent) => Promise<void>","fieldConfig: FormField | undefined"],"sources":["../../../src/hooks/useForm.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, 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 {useState, useCallback, FormEvent} from 'react';\n\n/**\n * Generic form field configuration\n */\nexport interface FormField {\n initialValue?: string;\n name: string;\n required?: boolean;\n validator?: (value: string) => string | null;\n}\n\n/**\n * Form validation result\n */\nexport interface ValidationResult {\n errors: Record<string, string>;\n isValid: boolean;\n}\n\n/**\n * Configuration for the useForm hook\n */\nexport interface UseFormConfig<T extends Record<string, string>> {\n /**\n * Form field definitions\n */\n fields?: FormField[];\n /**\n * Initial form values\n */\n initialValues?: Partial<T>;\n /**\n * Custom required field validation message\n */\n requiredMessage?: string;\n /**\n * When a field has been touched (blurred at least once), re-run validation on every\n * subsequent change so a rendered error clears the moment the value becomes valid.\n *\n * Independent of `validateOnChange`: this only affects fields that have already been\n * blurred, so users don't see errors while initially typing. Default `false` to\n * preserve prior behavior; enable per-form for a \"correct-as-you-type\" UX.\n */\n revalidateOnChangeAfterBlur?: boolean;\n /**\n * Whether to validate on blur (default: true)\n */\n validateOnBlur?: boolean;\n /**\n * Whether to validate on change (default: false). When true, every keystroke\n * triggers validation — including the first, which surfaces errors before the user\n * has had a chance to finish typing. Prefer `revalidateOnChangeAfterBlur` for the\n * common \"clear the error as the user corrects\" UX.\n */\n validateOnChange?: boolean;\n /**\n * Global form validator function\n */\n validator?: (values: T) => Record<string, string>;\n}\n\n/**\n * Pure per-field validator. Kept outside `useForm` so `setValue` can validate against\n * the value it just wrote — inline validation via the closure-based `validateField`\n * inside the hook would read stale `values` (state is committed asynchronously).\n */\nconst computeFieldError = (\n value: string,\n fieldConfig: FormField | undefined,\n requiredMessage: string,\n): string | null => {\n if (fieldConfig?.required && (!value || value.trim() === '')) {\n return requiredMessage;\n }\n if (fieldConfig?.validator) {\n const fieldError: string | null = fieldConfig.validator(value);\n if (fieldError) return fieldError;\n }\n return null;\n};\n\n/**\n * Return type for the useForm hook\n */\nexport interface UseFormReturn<T extends Record<string, string>> {\n /**\n * Clear all errors\n */\n clearErrors: () => void;\n /**\n * Current validation errors\n */\n errors: Record<keyof T, string>;\n /**\n * Get field props for easy integration with form components\n */\n getFieldProps: (name: keyof T) => {\n error: string | undefined;\n name: keyof T;\n onBlur: () => void;\n onChange: (value: string) => void;\n required: boolean;\n touched: boolean;\n value: string;\n };\n /**\n * Handle form submission\n */\n handleSubmit: (onSubmit: (values: T) => void | Promise<void>) => (e?: FormEvent) => Promise<void>;\n /**\n * Whether the form has been submitted\n */\n isSubmitted: boolean;\n /**\n * Whether the form is currently valid\n */\n isValid: boolean;\n /**\n * Reset the form to initial values\n */\n reset: () => void;\n /**\n * Set a field error\n */\n setError: (name: keyof T, error: string) => void;\n /**\n * Set multiple field errors\n */\n setErrors: (errors: Partial<Record<keyof T, string>>) => void;\n /**\n * Mark a field as touched\n */\n setTouched: (name: keyof T, touched?: boolean) => void;\n /**\n * Mark multiple fields as touched\n */\n setTouchedFields: (touched: Partial<Record<keyof T, boolean>>) => void;\n /**\n * Set a single field value\n */\n setValue: (name: keyof T, value: string) => void;\n /**\n * Set multiple field values\n */\n setValues: (values: Partial<T>) => void;\n /**\n * Mark all fields as touched\n */\n touchAllFields: () => void;\n /**\n * Fields that have been touched by the user\n */\n touched: Record<keyof T, boolean>;\n /**\n * Validate a single field\n */\n validateField: (name: keyof T) => string | null;\n /**\n * Validate all fields\n */\n validateForm: () => ValidationResult;\n /**\n * Current form values\n */\n values: T;\n}\n\n/**\n * Generic form hook that provides comprehensive form state management and validation.\n *\n * @template T - The type of form values (must extend Record<string, string>)\n * @param config - Configuration options for the form\n * @returns Form state and methods\n *\n * @example\n * ```tsx\n * interface LoginForm {\n * username: string;\n * password: string;\n * }\n *\n * const {\n * values,\n * touched,\n * errors,\n * isValid,\n * setValue,\n * handleSubmit,\n * getFieldProps\n * } = useForm<LoginForm>({\n * initialValues: { username: '', password: '' },\n * fields: [\n * { name: 'username', required: true },\n * { name: 'password', required: true }\n * ]\n * });\n *\n * const onSubmit = handleSubmit((values) => {\n * console.log('Form submitted:', values);\n * });\n *\n * return (\n * <form onSubmit={onSubmit}>\n * <input {...getFieldProps('username')} />\n * <input {...getFieldProps('password')} type=\"password\" />\n * <button type=\"submit\" disabled={!isValid}>Submit</button>\n * </form>\n * );\n * ```\n */\nexport const useForm = <T extends Record<string, string>>(config: UseFormConfig<T> = {}): UseFormReturn<T> => {\n const {\n initialValues = {} as T,\n fields = [],\n validator,\n validateOnChange = false,\n validateOnBlur = true,\n revalidateOnChangeAfterBlur = false,\n requiredMessage = 'This field is required',\n } = config;\n\n // Initialize form state\n const [values, setFormValues] = useState<T>({...initialValues} as T);\n const [touched, setFormTouched] = useState<Record<keyof T, boolean>>({} as Record<keyof T, boolean>);\n const [errors, setFormErrors] = useState<Record<keyof T, string>>({} as Record<keyof T, string>);\n const [isSubmitted, setIsSubmitted] = useState(false);\n\n // Get field configuration by name\n const getFieldConfig: (name: keyof T) => FormField | undefined = useCallback(\n (name: keyof T): FormField | undefined => fields.find((field: FormField) => field.name === name),\n [fields],\n );\n\n // Validate a single field against currently-committed state. Used by the blur path\n // (where `values` is already up-to-date) and by `validateForm`.\n const validateField: (name: keyof T) => string | null = useCallback(\n (name: keyof T): string | null => {\n const value: string = values[name] || '';\n const fieldConfig: FormField | undefined = getFieldConfig(name);\n return computeFieldError(value, fieldConfig, requiredMessage);\n },\n [values, getFieldConfig, requiredMessage],\n );\n\n // Validate the entire form\n const validateForm: () => ValidationResult = useCallback((): ValidationResult => {\n const newErrors: Record<keyof T, string> = {} as Record<keyof T, string>;\n\n // Validate individual fields\n fields.forEach((field: FormField) => {\n const error: string | null = validateField(field.name as keyof T);\n if (error) {\n newErrors[field.name as keyof T] = error;\n }\n });\n\n // Run global validator if provided\n if (validator) {\n const globalErrors: Record<string, string> = validator(values);\n Object.keys(globalErrors).forEach((key: string) => {\n if (globalErrors[key]) {\n newErrors[key as keyof T] = globalErrors[key];\n }\n });\n }\n\n return {\n errors: newErrors,\n isValid: Object.keys(newErrors).length === 0,\n };\n }, [fields, validateField, validator, values]);\n\n // Check if form is currently valid\n const isValid: boolean = Object.keys(errors).length === 0;\n\n // Set a single field value.\n //\n // Validation policy:\n // - `validateOnChange: true` → validate on every keystroke.\n // - `revalidateOnChangeAfterBlur: true` → validate only if the field has\n // already been touched (blurred once),\n // so errors clear as the user corrects\n // without appearing while first typing.\n // - both false → no on-change validation.\n //\n // Validation runs against the NEXT value (the string being written) rather than\n // going through `validateField` which reads the stale closed-over `values`. This\n // prevents the one-keystroke-lag bug where the error clears one character late.\n const setValue: (name: keyof T, value: string) => void = useCallback(\n (name: keyof T, value: string): void => {\n setFormValues((prev: T) => ({\n ...prev,\n [name]: value,\n }));\n\n const shouldValidate: boolean = validateOnChange || (revalidateOnChangeAfterBlur && touched[name] === true);\n if (!shouldValidate) {\n return;\n }\n\n const error: string | null = computeFieldError(value, getFieldConfig(name), requiredMessage);\n setFormErrors((prev: Record<keyof T, string>) => {\n const newErrors: Record<keyof T, string> = {...prev};\n if (error) {\n newErrors[name] = error;\n } else {\n delete newErrors[name];\n }\n return newErrors;\n });\n },\n [validateOnChange, revalidateOnChangeAfterBlur, touched, getFieldConfig, requiredMessage],\n );\n\n // Set multiple field values\n const setValues: (newValues: Partial<T>) => void = useCallback((newValues: Partial<T>): void => {\n setFormValues((prev: T) => ({\n ...prev,\n ...newValues,\n }));\n }, []);\n\n // Mark a field as touched\n const setTouched: (name: keyof T, isTouched?: boolean) => void = useCallback(\n (name: keyof T, isTouched = true): void => {\n setFormTouched((prev: Record<keyof T, boolean>) => ({\n ...prev,\n [name]: isTouched,\n }));\n\n // Validate on blur if enabled and field is touched\n if (validateOnBlur && isTouched) {\n const error: string | null = validateField(name);\n setFormErrors((prev: Record<keyof T, string>) => {\n const newErrors: Record<keyof T, string> = {...prev};\n if (error) {\n newErrors[name] = error;\n } else {\n delete newErrors[name];\n }\n return newErrors;\n });\n }\n },\n [validateField, validateOnBlur],\n );\n\n // Set multiple touched fields\n const setTouchedFields: (touchedFields: Partial<Record<keyof T, boolean>>) => void = useCallback(\n (touchedFields: Partial<Record<keyof T, boolean>>): void => {\n setFormTouched((prev: Record<keyof T, boolean>) => ({\n ...prev,\n ...touchedFields,\n }));\n },\n [],\n );\n\n // Mark all fields as touched\n const touchAllFields: () => void = useCallback((): void => {\n const allTouched: Record<keyof T, boolean> = fields.reduce(\n (acc: Record<keyof T, boolean>, field: FormField) => {\n acc[field.name as keyof T] = true;\n return acc;\n },\n {} as Record<keyof T, boolean>,\n );\n\n setFormTouched(allTouched);\n\n // Validate all fields\n const validation: ValidationResult = validateForm();\n setFormErrors(validation.errors as Record<keyof T, string>);\n }, [fields, validateForm]);\n\n // Set a field error\n const setError: (name: keyof T, error: string) => void = useCallback((name: keyof T, error: string): void => {\n setFormErrors((prev: Record<keyof T, string>) => ({\n ...prev,\n [name]: error,\n }));\n }, []);\n\n // Set multiple field errors\n const setErrors: (newErrors: Partial<Record<keyof T, string>>) => void = useCallback(\n (newErrors: Partial<Record<keyof T, string>>): void => {\n setFormErrors((prev: Record<keyof T, string>) => ({\n ...prev,\n ...newErrors,\n }));\n },\n [],\n );\n\n // Clear all errors\n const clearErrors: () => void = useCallback((): void => {\n setFormErrors({} as Record<keyof T, string>);\n }, []);\n\n // Reset form to initial state\n const reset: () => void = useCallback((): void => {\n setFormValues({...initialValues} as T);\n setFormTouched({} as Record<keyof T, boolean>);\n setFormErrors({} as Record<keyof T, string>);\n setIsSubmitted(false);\n }, [initialValues]);\n\n // Handle form submission\n const handleSubmit: (onSubmit: (values: T) => void | Promise<void>) => (e?: FormEvent) => Promise<void> = useCallback(\n (onSubmit: (values: T) => void | Promise<void>) =>\n async (e?: FormEvent): Promise<void> => {\n if (e) {\n e.preventDefault();\n }\n\n setIsSubmitted(true);\n touchAllFields();\n\n const validation: ValidationResult = validateForm();\n\n if (validation.isValid) {\n await onSubmit(values);\n }\n },\n [values, touchAllFields, validateForm],\n );\n\n // Get field props for easy integration\n const getFieldProps: (name: keyof T) => any = useCallback(\n (name: keyof T) => {\n const fieldConfig: FormField | undefined = getFieldConfig(name);\n\n return {\n error: touched[name] ? errors[name] : undefined,\n name,\n onBlur: (): void => setTouched(name, true),\n onChange: (value: string): void => setValue(name, value),\n required: fieldConfig?.required || false,\n touched: touched[name] || false,\n value: values[name] || '',\n };\n },\n [values, errors, touched, setValue, setTouched, getFieldConfig],\n );\n\n return {\n clearErrors,\n errors,\n getFieldProps,\n handleSubmit,\n isSubmitted,\n isValid,\n reset,\n setError,\n setErrors,\n setTouched,\n setTouchedFields,\n setValue,\n setValues,\n touchAllFields,\n touched,\n validateField,\n validateForm,\n values,\n };\n};\n\nexport default useForm;\n"],"mappings":";;;;;;;;;;AAqFA,MAAM,qBACJ,OACA,aACA,oBACkB;AAClB,KAAI,aAAa,aAAa,CAAC,SAAS,MAAM,MAAM,KAAK,IACvD,QAAO;AAET,KAAI,aAAa,WAAW;EAC1B,MAAMA,aAA4B,YAAY,UAAU,MAAM;AAC9D,MAAI,WAAY,QAAO;;AAEzB,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoIT,MAAa,WAA6C,SAA2B,EAAE,KAAuB;CAC5G,MAAM,EACJ,gBAAgB,EAAE,EAClB,SAAS,EAAE,EACX,WACA,mBAAmB,OACnB,iBAAiB,MACjB,8BAA8B,OAC9B,kBAAkB,6BAChB;CAGJ,MAAM,CAAC,QAAQ,qCAA6B,EAAC,GAAG,eAAc,CAAM;CACpE,MAAM,CAAC,SAAS,sCAAqD,EAAE,CAA6B;CACpG,MAAM,CAAC,QAAQ,qCAAmD,EAAE,CAA4B;CAChG,MAAM,CAAC,aAAa,sCAA2B,MAAM;CAGrD,MAAMC,yCACH,SAAyC,OAAO,MAAM,UAAqB,MAAM,SAAS,KAAK,EAChG,CAAC,OAAO,CACT;CAID,MAAMC,wCACH,SAAiC;AAGhC,SAAO,kBAFe,OAAO,S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AAM;IACxD,UAAU,aAAa,YAAY;IACnC,SAAS,QAAQ,SAAS;IAC1B,OAAO,OAAO,SAAS;IACxB;KAEH;GAAC;GAAQ;GAAQ;GAAS;GAAU;GAAY;GAAe,CAChE;EAMC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;;AAGH,sBAAe"}
1
+ {"version":3,"file":"useForm.cjs","names":["fieldError: string | null","getFieldConfig: (name: keyof T) => FormField | undefined","validateField: (name: keyof T) => string | null","validateForm: () => ValidationResult","newErrors: Record<keyof T, string>","error: string | null","globalErrors: Record<string, string>","isValid: boolean","setValue: (name: keyof T, value: string) => void","setValues: (newValues: Partial<T>) => void","setTouched: (name: keyof T, isTouched?: boolean) => void","setTouchedFields: (touchedFields: Partial<Record<keyof T, boolean>>) => void","touchAllFields: () => void","setError: (name: keyof T, error: string) => void","setErrors: (newErrors: Partial<Record<keyof T, string>>) => void","clearErrors: () => void","reset: () => void","handleSubmit: (onSubmit: (values: T) => void | Promise<void>) => (e?: FormEvent) => Promise<void>","fieldConfig: FormField | undefined"],"sources":["../../../src/hooks/useForm.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {useState, useCallback, FormEvent} from 'react';\n\n/**\n * Generic form field configuration\n */\nexport interface FormField {\n initialValue?: string;\n name: string;\n required?: boolean;\n validator?: (value: string) => string | null;\n}\n\n/**\n * Form validation result\n */\nexport interface ValidationResult {\n errors: Record<string, string>;\n isValid: boolean;\n}\n\n/**\n * Configuration for the useForm hook\n */\nexport interface UseFormConfig<T extends Record<string, string>> {\n /**\n * Form field definitions\n */\n fields?: FormField[];\n /**\n * Initial form values\n */\n initialValues?: Partial<T>;\n /**\n * Custom required field validation message\n */\n requiredMessage?: string;\n /**\n * When a field has been touched (blurred at least once), re-run validation on every\n * subsequent change so a rendered error clears the moment the value becomes valid.\n *\n * Independent of `validateOnChange`: this only affects fields that have already been\n * blurred, so users don't see errors while initially typing. Default `false` to\n * preserve prior behavior; enable per-form for a \"correct-as-you-type\" UX.\n */\n revalidateOnChangeAfterBlur?: boolean;\n /**\n * Whether to validate on blur (default: true)\n */\n validateOnBlur?: boolean;\n /**\n * Whether to validate on change (default: false). When true, every keystroke\n * triggers validation — including the first, which surfaces errors before the user\n * has had a chance to finish typing. Prefer `revalidateOnChangeAfterBlur` for the\n * common \"clear the error as the user corrects\" UX.\n */\n validateOnChange?: boolean;\n /**\n * Global form validator function\n */\n validator?: (values: T) => Record<string, string>;\n}\n\n/**\n * Pure per-field validator. Kept outside `useForm` so `setValue` can validate against\n * the value it just wrote — inline validation via the closure-based `validateField`\n * inside the hook would read stale `values` (state is committed asynchronously).\n */\nconst computeFieldError = (\n value: string,\n fieldConfig: FormField | undefined,\n requiredMessage: string,\n): string | null => {\n if (fieldConfig?.required && (!value || value.trim() === '')) {\n return requiredMessage;\n }\n if (fieldConfig?.validator) {\n const fieldError: string | null = fieldConfig.validator(value);\n if (fieldError) return fieldError;\n }\n return null;\n};\n\n/**\n * Return type for the useForm hook\n */\nexport interface UseFormReturn<T extends Record<string, string>> {\n /**\n * Clear all errors\n */\n clearErrors: () => void;\n /**\n * Current validation errors\n */\n errors: Record<keyof T, string>;\n /**\n * Get field props for easy integration with form components\n */\n getFieldProps: (name: keyof T) => {\n error: string | undefined;\n name: keyof T;\n onBlur: () => void;\n onChange: (value: string) => void;\n required: boolean;\n touched: boolean;\n value: string;\n };\n /**\n * Handle form submission\n */\n handleSubmit: (onSubmit: (values: T) => void | Promise<void>) => (e?: FormEvent) => Promise<void>;\n /**\n * Whether the form has been submitted\n */\n isSubmitted: boolean;\n /**\n * Whether the form is currently valid\n */\n isValid: boolean;\n /**\n * Reset the form to initial values\n */\n reset: () => void;\n /**\n * Set a field error\n */\n setError: (name: keyof T, error: string) => void;\n /**\n * Set multiple field errors\n */\n setErrors: (errors: Partial<Record<keyof T, string>>) => void;\n /**\n * Mark a field as touched\n */\n setTouched: (name: keyof T, touched?: boolean) => void;\n /**\n * Mark multiple fields as touched\n */\n setTouchedFields: (touched: Partial<Record<keyof T, boolean>>) => void;\n /**\n * Set a single field value\n */\n setValue: (name: keyof T, value: string) => void;\n /**\n * Set multiple field values\n */\n setValues: (values: Partial<T>) => void;\n /**\n * Mark all fields as touched\n */\n touchAllFields: () => void;\n /**\n * Fields that have been touched by the user\n */\n touched: Record<keyof T, boolean>;\n /**\n * Validate a single field\n */\n validateField: (name: keyof T) => string | null;\n /**\n * Validate all fields\n */\n validateForm: () => ValidationResult;\n /**\n * Current form values\n */\n values: T;\n}\n\n/**\n * Generic form hook that provides comprehensive form state management and validation.\n *\n * @template T - The type of form values (must extend Record<string, string>)\n * @param config - Configuration options for the form\n * @returns Form state and methods\n *\n * @example\n * ```tsx\n * interface LoginForm {\n * username: string;\n * password: string;\n * }\n *\n * const {\n * values,\n * touched,\n * errors,\n * isValid,\n * setValue,\n * handleSubmit,\n * getFieldProps\n * } = useForm<LoginForm>({\n * initialValues: { username: '', password: '' },\n * fields: [\n * { name: 'username', required: true },\n * { name: 'password', required: true }\n * ]\n * });\n *\n * const onSubmit = handleSubmit((values) => {\n * console.log('Form submitted:', values);\n * });\n *\n * return (\n * <form onSubmit={onSubmit}>\n * <input {...getFieldProps('username')} />\n * <input {...getFieldProps('password')} type=\"password\" />\n * <button type=\"submit\" disabled={!isValid}>Submit</button>\n * </form>\n * );\n * ```\n */\nexport const useForm = <T extends Record<string, string>>(config: UseFormConfig<T> = {}): UseFormReturn<T> => {\n const {\n initialValues = {} as T,\n fields = [],\n validator,\n validateOnChange = false,\n validateOnBlur = true,\n revalidateOnChangeAfterBlur = false,\n requiredMessage = 'This field is required',\n } = config;\n\n // Initialize form state\n const [values, setFormValues] = useState<T>({...initialValues} as T);\n const [touched, setFormTouched] = useState<Record<keyof T, boolean>>({} as Record<keyof T, boolean>);\n const [errors, setFormErrors] = useState<Record<keyof T, string>>({} as Record<keyof T, string>);\n const [isSubmitted, setIsSubmitted] = useState(false);\n\n // Get field configuration by name\n const getFieldConfig: (name: keyof T) => FormField | undefined = useCallback(\n (name: keyof T): FormField | undefined => fields.find((field: FormField) => field.name === name),\n [fields],\n );\n\n // Validate a single field against currently-committed state. Used by the blur path\n // (where `values` is already up-to-date) and by `validateForm`.\n const validateField: (name: keyof T) => string | null = useCallback(\n (name: keyof T): string | null => {\n const value: string = values[name] || '';\n const fieldConfig: FormField | undefined = getFieldConfig(name);\n return computeFieldError(value, fieldConfig, requiredMessage);\n },\n [values, getFieldConfig, requiredMessage],\n );\n\n // Validate the entire form\n const validateForm: () => ValidationResult = useCallback((): ValidationResult => {\n const newErrors: Record<keyof T, string> = {} as Record<keyof T, string>;\n\n // Validate individual fields\n fields.forEach((field: FormField) => {\n const error: string | null = validateField(field.name as keyof T);\n if (error) {\n newErrors[field.name as keyof T] = error;\n }\n });\n\n // Run global validator if provided\n if (validator) {\n const globalErrors: Record<string, string> = validator(values);\n Object.keys(globalErrors).forEach((key: string) => {\n if (globalErrors[key]) {\n newErrors[key as keyof T] = globalErrors[key];\n }\n });\n }\n\n return {\n errors: newErrors,\n isValid: Object.keys(newErrors).length === 0,\n };\n }, [fields, validateField, validator, values]);\n\n // Check if form is currently valid\n const isValid: boolean = Object.keys(errors).length === 0;\n\n // Set a single field value.\n //\n // Validation policy:\n // - `validateOnChange: true` → validate on every keystroke.\n // - `revalidateOnChangeAfterBlur: true` → validate only if the field has\n // already been touched (blurred once),\n // so errors clear as the user corrects\n // without appearing while first typing.\n // - both false → no on-change validation.\n //\n // Validation runs against the NEXT value (the string being written) rather than\n // going through `validateField` which reads the stale closed-over `values`. This\n // prevents the one-keystroke-lag bug where the error clears one character late.\n const setValue: (name: keyof T, value: string) => void = useCallback(\n (name: keyof T, value: string): void => {\n setFormValues((prev: T) => ({\n ...prev,\n [name]: value,\n }));\n\n const shouldValidate: boolean = validateOnChange || (revalidateOnChangeAfterBlur && touched[name] === true);\n if (!shouldValidate) {\n return;\n }\n\n const error: string | null = computeFieldError(value, getFieldConfig(name), requiredMessage);\n setFormErrors((prev: Record<keyof T, string>) => {\n const newErrors: Record<keyof T, string> = {...prev};\n if (error) {\n newErrors[name] = error;\n } else {\n delete newErrors[name];\n }\n return newErrors;\n });\n },\n [validateOnChange, revalidateOnChangeAfterBlur, touched, getFieldConfig, requiredMessage],\n );\n\n // Set multiple field values\n const setValues: (newValues: Partial<T>) => void = useCallback((newValues: Partial<T>): void => {\n setFormValues((prev: T) => ({\n ...prev,\n ...newValues,\n }));\n }, []);\n\n // Mark a field as touched\n const setTouched: (name: keyof T, isTouched?: boolean) => void = useCallback(\n (name: keyof T, isTouched = true): void => {\n setFormTouched((prev: Record<keyof T, boolean>) => ({\n ...prev,\n [name]: isTouched,\n }));\n\n // Validate on blur if enabled and field is touched\n if (validateOnBlur && isTouched) {\n const error: string | null = validateField(name);\n setFormErrors((prev: Record<keyof T, string>) => {\n const newErrors: Record<keyof T, string> = {...prev};\n if (error) {\n newErrors[name] = error;\n } else {\n delete newErrors[name];\n }\n return newErrors;\n });\n }\n },\n [validateField, validateOnBlur],\n );\n\n // Set multiple touched fields\n const setTouchedFields: (touchedFields: Partial<Record<keyof T, boolean>>) => void = useCallback(\n (touchedFields: Partial<Record<keyof T, boolean>>): void => {\n setFormTouched((prev: Record<keyof T, boolean>) => ({\n ...prev,\n ...touchedFields,\n }));\n },\n [],\n );\n\n // Mark all fields as touched\n const touchAllFields: () => void = useCallback((): void => {\n const allTouched: Record<keyof T, boolean> = fields.reduce(\n (acc: Record<keyof T, boolean>, field: FormField) => {\n acc[field.name as keyof T] = true;\n return acc;\n },\n {} as Record<keyof T, boolean>,\n );\n\n setFormTouched(allTouched);\n\n // Validate all fields\n const validation: ValidationResult = validateForm();\n setFormErrors(validation.errors as Record<keyof T, string>);\n }, [fields, validateForm]);\n\n // Set a field error\n const setError: (name: keyof T, error: string) => void = useCallback((name: keyof T, error: string): void => {\n setFormErrors((prev: Record<keyof T, string>) => ({\n ...prev,\n [name]: error,\n }));\n }, []);\n\n // Set multiple field errors\n const setErrors: (newErrors: Partial<Record<keyof T, string>>) => void = useCallback(\n (newErrors: Partial<Record<keyof T, string>>): void => {\n setFormErrors((prev: Record<keyof T, string>) => ({\n ...prev,\n ...newErrors,\n }));\n },\n [],\n );\n\n // Clear all errors\n const clearErrors: () => void = useCallback((): void => {\n setFormErrors({} as Record<keyof T, string>);\n }, []);\n\n // Reset form to initial state\n const reset: () => void = useCallback((): void => {\n setFormValues({...initialValues} as T);\n setFormTouched({} as Record<keyof T, boolean>);\n setFormErrors({} as Record<keyof T, string>);\n setIsSubmitted(false);\n }, [initialValues]);\n\n // Handle form submission\n const handleSubmit: (onSubmit: (values: T) => void | Promise<void>) => (e?: FormEvent) => Promise<void> = useCallback(\n (onSubmit: (values: T) => void | Promise<void>) =>\n async (e?: FormEvent): Promise<void> => {\n if (e) {\n e.preventDefault();\n }\n\n setIsSubmitted(true);\n touchAllFields();\n\n const validation: ValidationResult = validateForm();\n\n if (validation.isValid) {\n await onSubmit(values);\n }\n },\n [values, touchAllFields, validateForm],\n );\n\n // Get field props for easy integration\n const getFieldProps: (name: keyof T) => any = useCallback(\n (name: keyof T) => {\n const fieldConfig: FormField | undefined = getFieldConfig(name);\n\n return {\n error: touched[name] ? errors[name] : undefined,\n name,\n onBlur: (): void => setTouched(name, true),\n onChange: (value: string): void => setValue(name, value),\n required: fieldConfig?.required || false,\n touched: touched[name] || false,\n value: values[name] || '',\n };\n },\n [values, errors, touched, setValue, setTouched, getFieldConfig],\n );\n\n return {\n clearErrors,\n errors,\n getFieldProps,\n handleSubmit,\n isSubmitted,\n isValid,\n reset,\n setError,\n setErrors,\n setTouched,\n setTouchedFields,\n setValue,\n setValues,\n touchAllFields,\n touched,\n validateField,\n validateForm,\n values,\n };\n};\n\nexport default useForm;\n"],"mappings":";;;;;;;;;;AAsEA,MAAM,qBACJ,OACA,aACA,oBACkB;AAClB,KAAI,aAAa,aAAa,CAAC,SAAS,MAAM,MAAM,KAAK,IACvD,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H,GAAG;GACJ,EAAE;IAEL,EAAE,CACH;CAGD,MAAMC,2CAAkD;AACtD,gBAAc,EAAE,CAA4B;IAC3C,EAAE,CAAC;CAGN,MAAMC,qCAA4C;AAChD,gBAAc,EAAC,GAAG,eAAc,CAAM;AACtC,iBAAe,EAAE,CAA6B;AAC9C,gBAAc,EAAE,CAA4B;AAC5C,iBAAe,MAAM;IACpB,CAAC,cAAc,CAAC;CAGnB,MAAMC,uCACH,aACC,OAAO,MAAiC;AACtC,MAAI,EACF,GAAE,gBAAgB;AAGpB,iBAAe,KAAK;AACpB,kBAAgB;AAIhB,MAFqC,cAAc,CAEpC,QACb,OAAM,SAAS,OAAO;IAG5B;EAAC;EAAQ;EAAgB;EAAa,CACvC;AAoBD,QAAO;EACL;EACA;EACA,uCAnBC,SAAkB;GACjB,MAAMC,cAAqC,eAAe,KAAK;AAE/D,UAAO;IACL,OAAO,QAAQ,QAAQ,OAAO,QAAQ;IACtC;IACA,cAAoB,WAAW,MAAM,KAAK;IAC1C,WAAW,UAAwB,SAAS,MAAM,MAAM;IACxD,UAAU,aAAa,YAAY;IACnC,SAAS,QAAQ,SAAS;IAC1B,OAAO,OAAO,SAAS;IACxB;KAEH;GAAC;GAAQ;GAAQ;GAAS;GAAU;GAAY;GAAe,CAChE;EAMC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;;AAGH,sBAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"useOAuthCallback.cjs","names":["url: URL","internalRef: any","oauthCodeProcessedRef: any","urlParams: URLSearchParams","code: string | null","nonce: string | null","state: string | null","executionIdFromUrl: string | null","error: string | null","errorDescription: string | null","storedExecutionId: string | null","executionIdToUse: string | null","response: any"],"sources":["../../../src/hooks/useOAuthCallback.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 {useEffect, useRef, type RefObject} from 'react';\n\nexport interface UseOAuthCallbackOptions {\n /**\n * Current executionId from component state\n */\n currentExecutionId: string | null;\n\n /**\n * SessionStorage key for executionId (defaults to 'thunderid_execution_id')\n */\n executionIdStorageKey?: string;\n\n /**\n * Whether the component is initialized and ready to process OAuth callback\n */\n isInitialized: boolean;\n\n /**\n * Whether a submission is currently in progress\n */\n isSubmitting?: boolean;\n\n /**\n * Callback when OAuth flow completes successfully\n */\n onComplete?: () => void;\n\n /**\n * Callback when OAuth flow encounters an error\n */\n onError?: (error: any) => void;\n\n /**\n * Function to handle flow response after submission\n */\n onFlowChange?: (response: any) => void;\n\n /**\n * Callback to set loading state at the start of OAuth processing\n */\n onProcessingStart?: () => void;\n\n /**\n * Function to submit OAuth code to the server\n */\n onSubmit: (payload: OAuthCallbackPayload) => Promise<any>;\n\n /**\n * Optional external ref to track processed state. If provided, the component\n * manages the ref (allowing resets on flow clear/retry). Otherwise hook manages internally.\n */\n processedRef?: RefObject<boolean>;\n\n /**\n * Additional handler for setting state (e.g., setExecutionId)\n */\n setExecutionId?: (executionId: string) => void;\n\n /**\n * Ref to mark that token validation was attempted (prevents duplicate validation)\n * Used in AcceptInvite to coordinate between OAuth callback and token validation\n */\n tokenValidationAttemptedRef?: RefObject<boolean>;\n}\n\nexport interface OAuthCallbackPayload {\n executionId: string;\n inputs: {\n code: string;\n nonce?: string;\n };\n}\n\nfunction cleanupUrlParams(): void {\n if (typeof window === 'undefined') return;\n\n const url: URL = new URL(window.location.href);\n url.searchParams.delete('code');\n url.searchParams.delete('nonce');\n url.searchParams.delete('state');\n url.searchParams.delete('error');\n url.searchParams.delete('error_description');\n\n window.history.replaceState({}, '', url.toString());\n}\n\n/**\n * Processes OAuth callbacks by detecting auth code in URL, resolving executionId, and submitting to server.\n * Used by SignIn, SignUp, and AcceptInvite components.\n */\nexport function useOAuthCallback({\n currentExecutionId,\n executionIdStorageKey = 'thunderid_execution_id',\n isInitialized,\n isSubmitting = false,\n onComplete,\n onError,\n onFlowChange,\n onProcessingStart,\n onSubmit,\n processedRef,\n setExecutionId: setExecExecutionId,\n tokenValidationAttemptedRef,\n}: UseOAuthCallbackOptions): void {\n const internalRef: any = useRef(false);\n const oauthCodeProcessedRef: any = processedRef ?? internalRef;\n\n useEffect(() => {\n if (!isInitialized || isSubmitting) {\n return;\n }\n\n const urlParams: URLSearchParams = new URLSearchParams(window.location.search);\n const code: string | null = urlParams.get('code');\n const nonce: string | null = urlParams.get('nonce');\n const state: string | null = urlParams.get('state');\n const executionIdFromUrl: string | null = urlParams.get('executionId');\n const error: string | null = urlParams.get('error');\n const errorDescription: string | null = urlParams.get('error_description');\n\n if (error) {\n oauthCodeProcessedRef.current = true;\n if (tokenValidationAttemptedRef) {\n tokenValidationAttemptedRef.current = true;\n }\n onError?.(new Error(errorDescription || error || 'OAuth authentication failed'));\n cleanupUrlParams();\n return;\n }\n\n if (!code || oauthCodeProcessedRef.current) {\n return;\n }\n\n if (tokenValidationAttemptedRef?.current) {\n return;\n }\n\n const storedExecutionId: string | null = sessionStorage.getItem(executionIdStorageKey);\n const executionIdToUse: string | null =\n currentExecutionId || storedExecutionId || executionIdFromUrl || state || null;\n\n if (!executionIdToUse) {\n oauthCodeProcessedRef.current = true;\n onError?.(new Error('Invalid flow. Missing executionId.'));\n cleanupUrlParams();\n return;\n }\n\n oauthCodeProcessedRef.current = true;\n\n if (tokenValidationAttemptedRef) {\n tokenValidationAttemptedRef.current = true;\n }\n\n onProcessingStart?.();\n\n if (!currentExecutionId && setExecExecutionId) {\n setExecExecutionId(executionIdToUse);\n }\n\n (async (): Promise<void> => {\n try {\n const payload: OAuthCallbackPayload = {\n executionId: executionIdToUse,\n inputs: {\n code,\n ...(nonce && {nonce}),\n },\n };\n\n const response: any = await onSubmit(payload);\n\n onFlowChange?.(response);\n\n if (response?.flowStatus === 'COMPLETE' || response?.status === 'COMPLETE') {\n onComplete?.();\n }\n\n if (response?.flowStatus === 'ERROR' || response?.status === 'ERROR') {\n onError?.(response);\n }\n\n cleanupUrlParams();\n } catch (err) {\n onError?.(err);\n cleanupUrlParams();\n }\n })();\n }, [\n isInitialized,\n currentExecutionId,\n isSubmitting,\n onSubmit,\n onComplete,\n onError,\n onFlowChange,\n setExecExecutionId,\n executionIdStorageKey,\n ]);\n}\n"],"mappings":";;;;;AA4FA,SAAS,mBAAyB;AAChC,KAAI,OAAO,WAAW,YAAa;CAEnC,MAAMA,MAAW,IAAI,IAAI,OAAO,SAAS,KAAK;AAC9C,KAAI,aAAa,OAAO,OAAO;AAC/B,KAAI,aAAa,OAAO,QAAQ;AAChC,KAAI,aAAa,OAAO,QAAQ;AAChC,KAAI,aAAa,OAAO,QAAQ;AAChC,KAAI,aAAa,OAAO,oBAAoB;AAE5C,QAAO,QAAQ,aAAa,EAAE,EAAE,IAAI,IAAI,UAAU,CAAC;;;;;;AAOrD,SAAgB,iBAAiB,EAC/B,oBACA,wBAAwB,0BACxB,eACA,eAAe,OACf,YACA,SACA,cACA,mBACA,UACA,cACA,gBAAgB,oBAChB,+BACgC;CAChC,MAAMC,gCAA0B,MAAM;CACtC,MAAMC,wBAA6B,gBAAgB;AAEnD,4BAAgB;AACd,MAAI,CAAC,iBAAiB,aACpB;EAGF,MAAMC,YAA6B,IAAI,gBAAgB,OAAO,SAAS,OAAO;EAC9E,MAAMC,OAAsB,UAAU,IAAI,OAAO;EACjD,MAAMC,QAAuB,UAAU,IAAI,QAAQ;EACnD,MAAMC,QAAuB,UAAU,IAAI,QAAQ;EACnD,MAAMC,qBAAoC,UAAU,IAAI,cAAc;EACtE,MAAMC,QAAuB,UAAU,IAAI,QAAQ;EACnD,MAAMC,mBAAkC,UAAU,IAAI,oBAAoB;AAE1E,MAAI,OAAO;AACT,yBAAsB,UAAU;AAChC,OAAI,4BACF,6BAA4B,UAAU;AAExC,aAAU,IAAI,MAAM,oBAAoB,SAAS,8BAA8B,CAAC;AAChF,qBAAkB;AAClB;;AAGF,MAAI,CAAC,QAAQ,sBAAsB,QACjC;AAGF,MAAI,6BAA6B,QAC/B;EAGF,MAAMC,oBAAmC,eAAe,QAAQ,sBAAsB;EACtF,MAAMC,mBACJ,sBAAsB,qBAAqB,sBAAsB,SAAS;AAE5E,MAAI,CAAC,kBAAkB;AACrB,yBAAsB,UAAU;AAChC,6BAAU,IAAI,MAAM,qCAAqC,CAAC;AAC1D,qBAAkB;AAClB;;AAGF,wBAAsB,UAAU;AAEhC,MAAI,4BACF,6BAA4B,UAAU;AAGxC,uBAAqB;AAErB,MAAI,CAAC,sBAAsB,mBACzB,oBAAmB,iBAAiB;AAGtC,GAAC,YAA2B;AAC1B,OAAI;IASF,MAAMC,WAAgB,MAAM,SARU;KACpC,aAAa;KACb,QAAQ;MACN;MACA,GAAI,SAAS,EAAC,OAAM;MACrB;KACF,CAE4C;AAE7C,mBAAe,SAAS;AAExB,QAAI,UAAU,eAAe,cAAc,UAAU,WAAW,WAC9D,eAAc;AAGhB,QAAI,UAAU,eAAe,WAAW,UAAU,WAAW,QAC3D,WAAU,SAAS;AAGrB,sBAAkB;YACX,KAAK;AACZ,cAAU,IAAI;AACd,sBAAkB;;MAElB;IACH;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC"}
1
+ {"version":3,"file":"useOAuthCallback.cjs","names":["url: URL","internalRef: any","oauthCodeProcessedRef: any","urlParams: URLSearchParams","code: string | null","nonce: string | null","state: string | null","executionIdFromUrl: string | null","error: string | null","errorDescription: string | null","storedExecutionId: string | null","executionIdToUse: string | null","response: any"],"sources":["../../../src/hooks/useOAuthCallback.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {useEffect, useRef, type RefObject} from 'react';\n\nexport interface UseOAuthCallbackOptions {\n /**\n * Current executionId from component state\n */\n currentExecutionId: string | null;\n\n /**\n * SessionStorage key for executionId (defaults to 'thunderid_execution_id')\n */\n executionIdStorageKey?: string;\n\n /**\n * Whether the component is initialized and ready to process OAuth callback\n */\n isInitialized: boolean;\n\n /**\n * Whether a submission is currently in progress\n */\n isSubmitting?: boolean;\n\n /**\n * Callback when OAuth flow completes successfully\n */\n onComplete?: () => void;\n\n /**\n * Callback when OAuth flow encounters an error\n */\n onError?: (error: any) => void;\n\n /**\n * Function to handle flow response after submission\n */\n onFlowChange?: (response: any) => void;\n\n /**\n * Callback to set loading state at the start of OAuth processing\n */\n onProcessingStart?: () => void;\n\n /**\n * Function to submit OAuth code to the server\n */\n onSubmit: (payload: OAuthCallbackPayload) => Promise<any>;\n\n /**\n * Optional external ref to track processed state. If provided, the component\n * manages the ref (allowing resets on flow clear/retry). Otherwise hook manages internally.\n */\n processedRef?: RefObject<boolean>;\n\n /**\n * Additional handler for setting state (e.g., setExecutionId)\n */\n setExecutionId?: (executionId: string) => void;\n\n /**\n * Ref to mark that token validation was attempted (prevents duplicate validation)\n * Used in AcceptInvite to coordinate between OAuth callback and token validation\n */\n tokenValidationAttemptedRef?: RefObject<boolean>;\n}\n\nexport interface OAuthCallbackPayload {\n executionId: string;\n inputs: {\n code: string;\n nonce?: string;\n };\n}\n\nfunction cleanupUrlParams(): void {\n if (typeof window === 'undefined') return;\n\n const url: URL = new URL(window.location.href);\n url.searchParams.delete('code');\n url.searchParams.delete('nonce');\n url.searchParams.delete('state');\n url.searchParams.delete('error');\n url.searchParams.delete('error_description');\n\n window.history.replaceState({}, '', url.toString());\n}\n\n/**\n * Processes OAuth callbacks by detecting auth code in URL, resolving executionId, and submitting to server.\n * Used by SignIn, SignUp, and AcceptInvite components.\n */\nexport function useOAuthCallback({\n currentExecutionId,\n executionIdStorageKey = 'thunderid_execution_id',\n isInitialized,\n isSubmitting = false,\n onComplete,\n onError,\n onFlowChange,\n onProcessingStart,\n onSubmit,\n processedRef,\n setExecutionId: setExecExecutionId,\n tokenValidationAttemptedRef,\n}: UseOAuthCallbackOptions): void {\n const internalRef: any = useRef(false);\n const oauthCodeProcessedRef: any = processedRef ?? internalRef;\n\n useEffect(() => {\n if (!isInitialized || isSubmitting) {\n return;\n }\n\n const urlParams: URLSearchParams = new URLSearchParams(window.location.search);\n const code: string | null = urlParams.get('code');\n const nonce: string | null = urlParams.get('nonce');\n const state: string | null = urlParams.get('state');\n const executionIdFromUrl: string | null = urlParams.get('executionId');\n const error: string | null = urlParams.get('error');\n const errorDescription: string | null = urlParams.get('error_description');\n\n if (error) {\n oauthCodeProcessedRef.current = true;\n if (tokenValidationAttemptedRef) {\n tokenValidationAttemptedRef.current = true;\n }\n onError?.(new Error(errorDescription || error || 'OAuth authentication failed'));\n cleanupUrlParams();\n return;\n }\n\n if (!code || oauthCodeProcessedRef.current) {\n return;\n }\n\n if (tokenValidationAttemptedRef?.current) {\n return;\n }\n\n const storedExecutionId: string | null = sessionStorage.getItem(executionIdStorageKey);\n const executionIdToUse: string | null =\n currentExecutionId || storedExecutionId || executionIdFromUrl || state || null;\n\n if (!executionIdToUse) {\n oauthCodeProcessedRef.current = true;\n onError?.(new Error('Invalid flow. Missing executionId.'));\n cleanupUrlParams();\n return;\n }\n\n oauthCodeProcessedRef.current = true;\n\n if (tokenValidationAttemptedRef) {\n tokenValidationAttemptedRef.current = true;\n }\n\n onProcessingStart?.();\n\n if (!currentExecutionId && setExecExecutionId) {\n setExecExecutionId(executionIdToUse);\n }\n\n (async (): Promise<void> => {\n try {\n const payload: OAuthCallbackPayload = {\n executionId: executionIdToUse,\n inputs: {\n code,\n ...(nonce && {nonce}),\n },\n };\n\n const response: any = await onSubmit(payload);\n\n onFlowChange?.(response);\n\n if (response?.flowStatus === 'COMPLETE' || response?.status === 'COMPLETE') {\n onComplete?.();\n }\n\n if (response?.flowStatus === 'ERROR' || response?.status === 'ERROR') {\n onError?.(response);\n }\n\n cleanupUrlParams();\n } catch (err) {\n onError?.(err);\n cleanupUrlParams();\n }\n })();\n }, [\n isInitialized,\n currentExecutionId,\n isSubmitting,\n onSubmit,\n onComplete,\n onError,\n onFlowChange,\n setExecExecutionId,\n executionIdStorageKey,\n ]);\n}\n"],"mappings":";;;;;AA6EA,SAAS,mBAAyB;AAChC,KAAI,OAAO,WAAW,YAAa;CAEnC,MAAMA,MAAW,IAAI,IAAI,OAAO,SAAS,KAAK;AAC9C,KAAI,aAAa,OAAO,OAAO;AAC/B,KAAI,aAAa,OAAO,QAAQ;AAChC,KAAI,aAAa,OAAO,QAAQ;AAChC,KAAI,aAAa,OAAO,QAAQ;AAChC,KAAI,aAAa,OAAO,oBAAoB;AAE5C,QAAO,QAAQ,aAAa,EAAE,EAAE,IAAI,IAAI,UAAU,CAAC;;;;;;AAOrD,SAAgB,iBAAiB,EAC/B,oBACA,wBAAwB,0BACxB,eACA,eAAe,OACf,YACA,SACA,cACA,mBACA,UACA,cACA,gBAAgB,oBAChB,+BACgC;CAChC,MAAMC,gCAA0B,MAAM;CACtC,MAAMC,wBAA6B,gBAAgB;AAEnD,4BAAgB;AACd,MAAI,CAAC,iBAAiB,aACpB;EAGF,MAAMC,YAA6B,IAAI,gBAAgB,OAAO,SAAS,OAAO;EAC9E,MAAMC,OAAsB,UAAU,IAAI,OAAO;EACjD,MAAMC,QAAuB,UAAU,IAAI,QAAQ;EACnD,MAAMC,QAAuB,UAAU,IAAI,QAAQ;EACnD,MAAMC,qBAAoC,UAAU,IAAI,cAAc;EACtE,MAAMC,QAAuB,UAAU,IAAI,QAAQ;EACnD,MAAMC,mBAAkC,UAAU,IAAI,oBAAoB;AAE1E,MAAI,OAAO;AACT,yBAAsB,UAAU;AAChC,OAAI,4BACF,6BAA4B,UAAU;AAExC,aAAU,IAAI,MAAM,oBAAoB,SAAS,8BAA8B,CAAC;AAChF,qBAAkB;AAClB;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