@thunderid/react 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (930) hide show
  1. package/dist/ThunderIDReactClient.d.ts.map +1 -1
  2. package/dist/ThunderIDReactClient.js +233 -0
  3. package/dist/ThunderIDReactClient.js.map +1 -0
  4. package/dist/api/createOrganization.d.ts +2 -2
  5. package/dist/api/createOrganization.js +80 -0
  6. package/dist/api/createOrganization.js.map +1 -0
  7. package/dist/api/getAllOrganizations.d.ts +2 -2
  8. package/dist/api/getAllOrganizations.js +71 -0
  9. package/dist/api/getAllOrganizations.js.map +1 -0
  10. package/dist/api/getMeOrganizations.d.ts +2 -2
  11. package/dist/api/getMeOrganizations.js +75 -0
  12. package/dist/api/getMeOrganizations.js.map +1 -0
  13. package/dist/api/getOrganization.d.ts +2 -2
  14. package/dist/api/getOrganization.js +67 -0
  15. package/dist/api/getOrganization.js.map +1 -0
  16. package/dist/api/getSchemas.d.ts +2 -2
  17. package/dist/api/getSchemas.js +65 -0
  18. package/dist/api/getSchemas.js.map +1 -0
  19. package/dist/api/getScim2Me.d.ts +2 -2
  20. package/dist/api/getScim2Me.js +65 -0
  21. package/dist/api/getScim2Me.js.map +1 -0
  22. package/dist/api/updateMeProfile.d.ts +2 -2
  23. package/dist/api/updateMeProfile.js +54 -0
  24. package/dist/api/updateMeProfile.js.map +1 -0
  25. package/dist/api/updateOrganization.d.ts +3 -3
  26. package/dist/api/updateOrganization.js +74 -0
  27. package/dist/api/updateOrganization.js.map +1 -0
  28. package/dist/cjs/ThunderIDReactClient.cjs +235 -0
  29. package/dist/cjs/ThunderIDReactClient.cjs.map +1 -0
  30. package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
  31. package/dist/cjs/api/createOrganization.cjs +82 -0
  32. package/dist/cjs/api/createOrganization.cjs.map +1 -0
  33. package/dist/cjs/api/getAllOrganizations.cjs +73 -0
  34. package/dist/cjs/api/getAllOrganizations.cjs.map +1 -0
  35. package/dist/cjs/api/getMeOrganizations.cjs +77 -0
  36. package/dist/cjs/api/getMeOrganizations.cjs.map +1 -0
  37. package/dist/cjs/api/getOrganization.cjs +69 -0
  38. package/dist/cjs/api/getOrganization.cjs.map +1 -0
  39. package/dist/cjs/api/getSchemas.cjs +67 -0
  40. package/dist/cjs/api/getSchemas.cjs.map +1 -0
  41. package/dist/cjs/api/getScim2Me.cjs +67 -0
  42. package/dist/cjs/api/getScim2Me.cjs.map +1 -0
  43. package/dist/cjs/api/updateMeProfile.cjs +56 -0
  44. package/dist/cjs/api/updateMeProfile.cjs.map +1 -0
  45. package/dist/cjs/api/updateOrganization.cjs +76 -0
  46. package/dist/cjs/api/updateOrganization.cjs.map +1 -0
  47. package/dist/cjs/components/actions/SignInButton/BaseSignInButton.cjs +54 -0
  48. package/dist/cjs/components/actions/SignInButton/BaseSignInButton.cjs.map +1 -0
  49. package/dist/cjs/components/actions/SignInButton/SignInButton.cjs +88 -0
  50. package/dist/cjs/components/actions/SignInButton/SignInButton.cjs.map +1 -0
  51. package/dist/cjs/components/actions/SignOutButton/BaseSignOutButton.cjs +54 -0
  52. package/dist/cjs/components/actions/SignOutButton/BaseSignOutButton.cjs.map +1 -0
  53. package/dist/cjs/components/actions/SignOutButton/SignOutButton.cjs +84 -0
  54. package/dist/cjs/components/actions/SignOutButton/SignOutButton.cjs.map +1 -0
  55. package/dist/cjs/components/actions/SignUpButton/BaseSignUpButton.cjs +56 -0
  56. package/dist/cjs/components/actions/SignUpButton/BaseSignUpButton.cjs.map +1 -0
  57. package/dist/cjs/components/actions/SignUpButton/SignUpButton.cjs +86 -0
  58. package/dist/cjs/components/actions/SignUpButton/SignUpButton.cjs.map +1 -0
  59. package/dist/cjs/components/adapters/CheckboxInput.cjs +30 -0
  60. package/dist/cjs/components/adapters/CheckboxInput.cjs.map +1 -0
  61. package/dist/cjs/components/adapters/Consent.cjs +69 -0
  62. package/dist/cjs/components/adapters/Consent.cjs.map +1 -0
  63. package/dist/cjs/components/adapters/ConsentCheckboxList.cjs +81 -0
  64. package/dist/cjs/components/adapters/ConsentCheckboxList.cjs.map +1 -0
  65. package/dist/cjs/components/adapters/ConsentCheckboxList.styles.cjs +46 -0
  66. package/dist/cjs/components/adapters/ConsentCheckboxList.styles.cjs.map +1 -0
  67. package/dist/cjs/components/adapters/DateInput.cjs +30 -0
  68. package/dist/cjs/components/adapters/DateInput.cjs.map +1 -0
  69. package/dist/cjs/components/adapters/DividerComponent.cjs +24 -0
  70. package/dist/cjs/components/adapters/DividerComponent.cjs.map +1 -0
  71. package/dist/cjs/components/adapters/EmailInput.cjs +30 -0
  72. package/dist/cjs/components/adapters/EmailInput.cjs.map +1 -0
  73. package/dist/cjs/components/adapters/FacebookButton.cjs +41 -0
  74. package/dist/cjs/components/adapters/FacebookButton.cjs.map +1 -0
  75. package/dist/cjs/components/adapters/FlowTimer.cjs +52 -0
  76. package/dist/cjs/components/adapters/FlowTimer.cjs.map +1 -0
  77. package/dist/cjs/components/adapters/FormContainer.cjs +36 -0
  78. package/dist/cjs/components/adapters/FormContainer.cjs.map +1 -0
  79. package/dist/cjs/components/adapters/GitHubButton.cjs +41 -0
  80. package/dist/cjs/components/adapters/GitHubButton.cjs.map +1 -0
  81. package/dist/cjs/components/adapters/GoogleButton.cjs +59 -0
  82. package/dist/cjs/components/adapters/GoogleButton.cjs.map +1 -0
  83. package/dist/cjs/components/adapters/ImageComponent.cjs +77 -0
  84. package/dist/cjs/components/adapters/ImageComponent.cjs.map +1 -0
  85. package/dist/cjs/components/adapters/LinkedInButton.cjs +38 -0
  86. package/dist/cjs/components/adapters/LinkedInButton.cjs.map +1 -0
  87. package/dist/cjs/components/adapters/MicrosoftButton.cjs +56 -0
  88. package/dist/cjs/components/adapters/MicrosoftButton.cjs.map +1 -0
  89. package/dist/cjs/components/adapters/NumberInput.cjs +30 -0
  90. package/dist/cjs/components/adapters/NumberInput.cjs.map +1 -0
  91. package/dist/cjs/components/adapters/PasswordInput.cjs +52 -0
  92. package/dist/cjs/components/adapters/PasswordInput.cjs.map +1 -0
  93. package/dist/cjs/components/adapters/SelectInput.cjs +36 -0
  94. package/dist/cjs/components/adapters/SelectInput.cjs.map +1 -0
  95. package/dist/cjs/components/adapters/SignInWithEthereumButton.cjs +38 -0
  96. package/dist/cjs/components/adapters/SignInWithEthereumButton.cjs.map +1 -0
  97. package/dist/cjs/components/adapters/SmsOtpButton.cjs +38 -0
  98. package/dist/cjs/components/adapters/SmsOtpButton.cjs.map +1 -0
  99. package/dist/cjs/components/adapters/SubmitButton.cjs +61 -0
  100. package/dist/cjs/components/adapters/SubmitButton.cjs.map +1 -0
  101. package/dist/cjs/components/adapters/TelephoneInput.cjs +32 -0
  102. package/dist/cjs/components/adapters/TelephoneInput.cjs.map +1 -0
  103. package/dist/cjs/components/adapters/TextInput.cjs +30 -0
  104. package/dist/cjs/components/adapters/TextInput.cjs.map +1 -0
  105. package/dist/cjs/components/adapters/Typography.cjs +60 -0
  106. package/dist/cjs/components/adapters/Typography.cjs.map +1 -0
  107. package/dist/cjs/components/auth/Callback/Callback.cjs +26 -0
  108. package/dist/cjs/components/auth/Callback/Callback.cjs.map +1 -0
  109. package/dist/cjs/components/auth/Callback/OAuthCallback.cjs +104 -0
  110. package/dist/cjs/components/auth/Callback/OAuthCallback.cjs.map +1 -0
  111. package/dist/cjs/components/auth/Callback/TokenCallback.cjs +134 -0
  112. package/dist/cjs/components/auth/Callback/TokenCallback.cjs.map +1 -0
  113. package/dist/cjs/components/control/Loading.cjs +35 -0
  114. package/dist/cjs/components/control/Loading.cjs.map +1 -0
  115. package/dist/cjs/components/control/OrganizationContext/OrganizationContext.cjs +34 -0
  116. package/dist/cjs/components/control/OrganizationContext/OrganizationContext.cjs.map +1 -0
  117. package/dist/cjs/components/control/OrganizationContext/OrganizationContextController.cjs +58 -0
  118. package/dist/cjs/components/control/OrganizationContext/OrganizationContextController.cjs.map +1 -0
  119. package/dist/cjs/components/control/SignedIn.cjs +35 -0
  120. package/dist/cjs/components/control/SignedIn.cjs.map +1 -0
  121. package/dist/cjs/components/control/SignedOut.cjs +35 -0
  122. package/dist/cjs/components/control/SignedOut.cjs.map +1 -0
  123. package/dist/cjs/components/factories/FieldFactory.cjs +142 -0
  124. package/dist/cjs/components/factories/FieldFactory.cjs.map +1 -0
  125. package/dist/cjs/components/presentation/CreateOrganization/BaseCreateOrganization.cjs +183 -0
  126. package/dist/cjs/components/presentation/CreateOrganization/BaseCreateOrganization.cjs.map +1 -0
  127. package/dist/cjs/components/presentation/CreateOrganization/BaseCreateOrganization.styles.cjs +150 -0
  128. package/dist/cjs/components/presentation/CreateOrganization/BaseCreateOrganization.styles.cjs.map +1 -0
  129. package/dist/cjs/components/presentation/CreateOrganization/CreateOrganization.cjs +90 -0
  130. package/dist/cjs/components/presentation/CreateOrganization/CreateOrganization.cjs.map +1 -0
  131. package/dist/cjs/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.cjs +118 -0
  132. package/dist/cjs/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.cjs.map +1 -0
  133. package/dist/cjs/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.cjs +118 -0
  134. package/dist/cjs/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.cjs.map +1 -0
  135. package/dist/cjs/components/presentation/LanguageSwitcher/LanguageSwitcher.cjs +76 -0
  136. package/dist/cjs/components/presentation/LanguageSwitcher/LanguageSwitcher.cjs.map +1 -0
  137. package/dist/cjs/components/presentation/Organization/BaseOrganization.cjs +41 -0
  138. package/dist/cjs/components/presentation/Organization/BaseOrganization.cjs.map +1 -0
  139. package/dist/cjs/components/presentation/Organization/Organization.cjs +49 -0
  140. package/dist/cjs/components/presentation/Organization/Organization.cjs.map +1 -0
  141. package/dist/cjs/components/presentation/OrganizationList/BaseOrganizationList.cjs +257 -0
  142. package/dist/cjs/components/presentation/OrganizationList/BaseOrganizationList.cjs.map +1 -0
  143. package/dist/cjs/components/presentation/OrganizationList/BaseOrganizationList.styles.cjs +236 -0
  144. package/dist/cjs/components/presentation/OrganizationList/BaseOrganizationList.styles.cjs.map +1 -0
  145. package/dist/cjs/components/presentation/OrganizationList/OrganizationList.cjs +86 -0
  146. package/dist/cjs/components/presentation/OrganizationList/OrganizationList.cjs.map +1 -0
  147. package/dist/cjs/components/presentation/OrganizationList/OrganizationList.styles.cjs +75 -0
  148. package/dist/cjs/components/presentation/OrganizationList/OrganizationList.styles.cjs.map +1 -0
  149. package/dist/cjs/components/presentation/OrganizationProfile/BaseOrganizationProfile.cjs +328 -0
  150. package/dist/cjs/components/presentation/OrganizationProfile/BaseOrganizationProfile.cjs.map +1 -0
  151. package/dist/cjs/components/presentation/OrganizationProfile/BaseOrganizationProfile.styles.cjs +166 -0
  152. package/dist/cjs/components/presentation/OrganizationProfile/BaseOrganizationProfile.styles.cjs.map +1 -0
  153. package/dist/cjs/components/presentation/OrganizationProfile/OrganizationProfile.cjs +126 -0
  154. package/dist/cjs/components/presentation/OrganizationProfile/OrganizationProfile.cjs.map +1 -0
  155. package/dist/cjs/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.cjs +288 -0
  156. package/dist/cjs/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.cjs.map +1 -0
  157. package/dist/cjs/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.styles.cjs +237 -0
  158. package/dist/cjs/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.styles.cjs.map +1 -0
  159. package/dist/cjs/components/presentation/OrganizationSwitcher/OrganizationSwitcher.cjs +127 -0
  160. package/dist/cjs/components/presentation/OrganizationSwitcher/OrganizationSwitcher.cjs.map +1 -0
  161. package/dist/cjs/components/presentation/User/BaseUser.cjs +41 -0
  162. package/dist/cjs/components/presentation/User/BaseUser.cjs.map +1 -0
  163. package/dist/cjs/components/presentation/User/User.cjs +45 -0
  164. package/dist/cjs/components/presentation/User/User.cjs.map +1 -0
  165. package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.cjs +191 -0
  166. package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.cjs.map +1 -0
  167. package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.styles.cjs +201 -0
  168. package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.styles.cjs.map +1 -0
  169. package/dist/cjs/components/presentation/UserDropdown/UserDropdown.cjs +111 -0
  170. package/dist/cjs/components/presentation/UserDropdown/UserDropdown.cjs.map +1 -0
  171. package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.cjs +460 -0
  172. package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.cjs.map +1 -0
  173. package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.styles.cjs +217 -0
  174. package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.styles.cjs.map +1 -0
  175. package/dist/cjs/components/presentation/UserProfile/UserProfile.cjs +81 -0
  176. package/dist/cjs/components/presentation/UserProfile/UserProfile.cjs.map +1 -0
  177. package/dist/cjs/components/presentation/auth/AcceptInvite/v2/AcceptInvite.cjs +109 -0
  178. package/dist/cjs/components/presentation/auth/AcceptInvite/v2/AcceptInvite.cjs.map +1 -0
  179. package/dist/cjs/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.cjs +504 -0
  180. package/dist/cjs/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.cjs.map +1 -0
  181. package/dist/cjs/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.styles.cjs +52 -0
  182. package/dist/cjs/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.styles.cjs.map +1 -0
  183. package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +454 -0
  184. package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -0
  185. package/dist/cjs/components/presentation/auth/InviteUser/v2/BaseInviteUser.cjs +419 -0
  186. package/dist/cjs/components/presentation/auth/InviteUser/v2/BaseInviteUser.cjs.map +1 -0
  187. package/dist/cjs/components/presentation/auth/InviteUser/v2/BaseInviteUser.styles.cjs +52 -0
  188. package/dist/cjs/components/presentation/auth/InviteUser/v2/BaseInviteUser.styles.cjs.map +1 -0
  189. package/dist/cjs/components/presentation/auth/InviteUser/v2/InviteUser.cjs +118 -0
  190. package/dist/cjs/components/presentation/auth/InviteUser/v2/InviteUser.cjs.map +1 -0
  191. package/dist/cjs/components/presentation/auth/OrganizationUnitPicker/v2/OrganizationUnitPicker.cjs +183 -0
  192. package/dist/cjs/components/presentation/auth/OrganizationUnitPicker/v2/OrganizationUnitPicker.cjs.map +1 -0
  193. package/dist/cjs/components/presentation/auth/OrganizationUnitPicker/v2/OrganizationUnitPicker.styles.cjs +128 -0
  194. package/dist/cjs/components/presentation/auth/OrganizationUnitPicker/v2/OrganizationUnitPicker.styles.cjs.map +1 -0
  195. package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs +20 -0
  196. package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs.map +1 -0
  197. package/dist/cjs/components/presentation/auth/Recovery/Recovery.cjs +49 -0
  198. package/dist/cjs/components/presentation/auth/Recovery/Recovery.cjs.map +1 -0
  199. package/dist/cjs/components/presentation/auth/Recovery/v1/BaseRecovery.cjs +293 -0
  200. package/dist/cjs/components/presentation/auth/Recovery/v1/BaseRecovery.cjs.map +1 -0
  201. package/dist/cjs/components/presentation/auth/Recovery/v1/Recovery.cjs +43 -0
  202. package/dist/cjs/components/presentation/auth/Recovery/v1/Recovery.cjs.map +1 -0
  203. package/dist/cjs/components/presentation/auth/Recovery/v1/RecoveryOptionFactory.cjs +163 -0
  204. package/dist/cjs/components/presentation/auth/Recovery/v1/RecoveryOptionFactory.cjs.map +1 -0
  205. package/dist/cjs/components/presentation/auth/Recovery/v2/BaseRecovery.cjs +378 -0
  206. package/dist/cjs/components/presentation/auth/Recovery/v2/BaseRecovery.cjs.map +1 -0
  207. package/dist/cjs/components/presentation/auth/Recovery/v2/Recovery.cjs +78 -0
  208. package/dist/cjs/components/presentation/auth/Recovery/v2/Recovery.cjs.map +1 -0
  209. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs +20 -0
  210. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs.map +1 -0
  211. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.styles.cjs +154 -0
  212. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.styles.cjs.map +1 -0
  213. package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs +86 -0
  214. package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs.map +1 -0
  215. package/dist/cjs/components/presentation/auth/SignIn/v1/BaseSignIn.cjs +734 -0
  216. package/dist/cjs/components/presentation/auth/SignIn/v1/BaseSignIn.cjs.map +1 -0
  217. package/dist/cjs/components/presentation/auth/SignIn/v1/options/EmailOtp.cjs +68 -0
  218. package/dist/cjs/components/presentation/auth/SignIn/v1/options/EmailOtp.cjs.map +1 -0
  219. package/dist/cjs/components/presentation/auth/SignIn/v1/options/IdentifierFirst.cjs +59 -0
  220. package/dist/cjs/components/presentation/auth/SignIn/v1/options/IdentifierFirst.cjs.map +1 -0
  221. package/dist/cjs/components/presentation/auth/SignIn/v1/options/MultiOptionButton.cjs +139 -0
  222. package/dist/cjs/components/presentation/auth/SignIn/v1/options/MultiOptionButton.cjs.map +1 -0
  223. package/dist/cjs/components/presentation/auth/SignIn/v1/options/SignInOptionFactory.cjs +147 -0
  224. package/dist/cjs/components/presentation/auth/SignIn/v1/options/SignInOptionFactory.cjs.map +1 -0
  225. package/dist/cjs/components/presentation/auth/SignIn/v1/options/SmsOtp.cjs +68 -0
  226. package/dist/cjs/components/presentation/auth/SignIn/v1/options/SmsOtp.cjs.map +1 -0
  227. package/dist/cjs/components/presentation/auth/SignIn/v1/options/SocialButton.cjs +38 -0
  228. package/dist/cjs/components/presentation/auth/SignIn/v1/options/SocialButton.cjs.map +1 -0
  229. package/dist/cjs/components/presentation/auth/SignIn/v1/options/Totp.cjs +68 -0
  230. package/dist/cjs/components/presentation/auth/SignIn/v1/options/Totp.cjs.map +1 -0
  231. package/dist/cjs/components/presentation/auth/SignIn/v1/options/UsernamePassword.cjs +60 -0
  232. package/dist/cjs/components/presentation/auth/SignIn/v1/options/UsernamePassword.cjs.map +1 -0
  233. package/dist/cjs/components/presentation/auth/SignIn/v2/BaseSignIn.cjs +330 -0
  234. package/dist/cjs/components/presentation/auth/SignIn/v2/BaseSignIn.cjs.map +1 -0
  235. package/dist/cjs/components/presentation/auth/SignIn/v2/SignIn.cjs +560 -0
  236. package/dist/cjs/components/presentation/auth/SignIn/v2/SignIn.cjs.map +1 -0
  237. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs +20 -0
  238. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -0
  239. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.styles.cjs +150 -0
  240. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.styles.cjs.map +1 -0
  241. package/dist/cjs/components/presentation/auth/SignUp/SignUp.cjs +90 -0
  242. package/dist/cjs/components/presentation/auth/SignUp/SignUp.cjs.map +1 -0
  243. package/dist/cjs/components/presentation/auth/SignUp/v1/BaseSignUp.cjs +451 -0
  244. package/dist/cjs/components/presentation/auth/SignUp/v1/BaseSignUp.cjs.map +1 -0
  245. package/dist/cjs/components/presentation/auth/SignUp/v1/SignUp.cjs +54 -0
  246. package/dist/cjs/components/presentation/auth/SignUp/v1/SignUp.cjs.map +1 -0
  247. package/dist/cjs/components/presentation/auth/SignUp/v1/SignUpOptionFactory.cjs +164 -0
  248. package/dist/cjs/components/presentation/auth/SignUp/v1/SignUpOptionFactory.cjs.map +1 -0
  249. package/dist/cjs/components/presentation/auth/SignUp/v2/BaseSignUp.cjs +656 -0
  250. package/dist/cjs/components/presentation/auth/SignUp/v2/BaseSignUp.cjs.map +1 -0
  251. package/dist/cjs/components/presentation/auth/SignUp/v2/SignUp.cjs +80 -0
  252. package/dist/cjs/components/presentation/auth/SignUp/v2/SignUp.cjs.map +1 -0
  253. package/dist/cjs/components/primitives/Alert/Alert.cjs +107 -0
  254. package/dist/cjs/components/primitives/Alert/Alert.cjs.map +1 -0
  255. package/dist/cjs/components/primitives/Alert/Alert.styles.cjs +89 -0
  256. package/dist/cjs/components/primitives/Alert/Alert.styles.cjs.map +1 -0
  257. package/dist/cjs/components/primitives/Avatar/Avatar.cjs +65 -0
  258. package/dist/cjs/components/primitives/Avatar/Avatar.cjs.map +1 -0
  259. package/dist/cjs/components/primitives/Avatar/Avatar.styles.cjs +87 -0
  260. package/dist/cjs/components/primitives/Avatar/Avatar.styles.cjs.map +1 -0
  261. package/dist/cjs/components/primitives/Button/Button.cjs +97 -0
  262. package/dist/cjs/components/primitives/Button/Button.cjs.map +1 -0
  263. package/dist/cjs/components/primitives/Button/Button.styles.cjs +347 -0
  264. package/dist/cjs/components/primitives/Button/Button.styles.cjs.map +1 -0
  265. package/dist/cjs/components/primitives/Card/Card.cjs +178 -0
  266. package/dist/cjs/components/primitives/Card/Card.cjs.map +1 -0
  267. package/dist/cjs/components/primitives/Card/Card.styles.cjs +100 -0
  268. package/dist/cjs/components/primitives/Card/Card.styles.cjs.map +1 -0
  269. package/dist/cjs/components/primitives/Checkbox/Checkbox.cjs +46 -0
  270. package/dist/cjs/components/primitives/Checkbox/Checkbox.cjs.map +1 -0
  271. package/dist/cjs/components/primitives/Checkbox/Checkbox.styles.cjs +79 -0
  272. package/dist/cjs/components/primitives/Checkbox/Checkbox.styles.cjs.map +1 -0
  273. package/dist/cjs/components/primitives/CopyableText/CopyableText.cjs +63 -0
  274. package/dist/cjs/components/primitives/CopyableText/CopyableText.cjs.map +1 -0
  275. package/dist/cjs/components/primitives/CopyableText/CopyableText.styles.cjs +48 -0
  276. package/dist/cjs/components/primitives/CopyableText/CopyableText.styles.cjs.map +1 -0
  277. package/dist/cjs/components/primitives/DatePicker/DatePicker.cjs +47 -0
  278. package/dist/cjs/components/primitives/DatePicker/DatePicker.cjs.map +1 -0
  279. package/dist/cjs/components/primitives/DatePicker/DatePicker.styles.cjs +87 -0
  280. package/dist/cjs/components/primitives/DatePicker/DatePicker.styles.cjs.map +1 -0
  281. package/dist/cjs/components/primitives/Dialog/Dialog.cjs +200 -0
  282. package/dist/cjs/components/primitives/Dialog/Dialog.cjs.map +1 -0
  283. package/dist/cjs/components/primitives/Dialog/Dialog.styles.cjs +75 -0
  284. package/dist/cjs/components/primitives/Dialog/Dialog.styles.cjs.map +1 -0
  285. package/dist/cjs/components/primitives/Divider/Divider.cjs +71 -0
  286. package/dist/cjs/components/primitives/Divider/Divider.cjs.map +1 -0
  287. package/dist/cjs/components/primitives/Divider/Divider.styles.cjs +72 -0
  288. package/dist/cjs/components/primitives/Divider/Divider.styles.cjs.map +1 -0
  289. package/dist/cjs/components/primitives/FormControl/FormControl.cjs +33 -0
  290. package/dist/cjs/components/primitives/FormControl/FormControl.cjs.map +1 -0
  291. package/dist/cjs/components/primitives/FormControl/FormControl.styles.cjs +43 -0
  292. package/dist/cjs/components/primitives/FormControl/FormControl.styles.cjs.map +1 -0
  293. package/dist/cjs/components/primitives/Icons/ArrowLeftRight.cjs +31 -0
  294. package/dist/cjs/components/primitives/Icons/ArrowLeftRight.cjs.map +1 -0
  295. package/dist/cjs/components/primitives/Icons/ArrowRightLeft.cjs +31 -0
  296. package/dist/cjs/components/primitives/Icons/ArrowRightLeft.cjs.map +1 -0
  297. package/dist/cjs/components/primitives/Icons/Building.cjs +75 -0
  298. package/dist/cjs/components/primitives/Icons/Building.cjs.map +1 -0
  299. package/dist/cjs/components/primitives/Icons/BuildingAlt.cjs +37 -0
  300. package/dist/cjs/components/primitives/Icons/BuildingAlt.cjs.map +1 -0
  301. package/dist/cjs/components/primitives/Icons/Check.cjs +31 -0
  302. package/dist/cjs/components/primitives/Icons/Check.cjs.map +1 -0
  303. package/dist/cjs/components/primitives/Icons/ChevronDown.cjs +31 -0
  304. package/dist/cjs/components/primitives/Icons/ChevronDown.cjs.map +1 -0
  305. package/dist/cjs/components/primitives/Icons/CircleAlert.cjs +44 -0
  306. package/dist/cjs/components/primitives/Icons/CircleAlert.cjs.map +1 -0
  307. package/dist/cjs/components/primitives/Icons/CircleCheck.cjs +30 -0
  308. package/dist/cjs/components/primitives/Icons/CircleCheck.cjs.map +1 -0
  309. package/dist/cjs/components/primitives/Icons/Eye.cjs +30 -0
  310. package/dist/cjs/components/primitives/Icons/Eye.cjs.map +1 -0
  311. package/dist/cjs/components/primitives/Icons/EyeOff.cjs +31 -0
  312. package/dist/cjs/components/primitives/Icons/EyeOff.cjs.map +1 -0
  313. package/dist/cjs/components/primitives/Icons/Info.cjs +34 -0
  314. package/dist/cjs/components/primitives/Icons/Info.cjs.map +1 -0
  315. package/dist/cjs/components/primitives/Icons/LogOut.cjs +30 -0
  316. package/dist/cjs/components/primitives/Icons/LogOut.cjs.map +1 -0
  317. package/dist/cjs/components/primitives/Icons/Plus.cjs +26 -0
  318. package/dist/cjs/components/primitives/Icons/Plus.cjs.map +1 -0
  319. package/dist/cjs/components/primitives/Icons/TriangleAlert.cjs +30 -0
  320. package/dist/cjs/components/primitives/Icons/TriangleAlert.cjs.map +1 -0
  321. package/dist/cjs/components/primitives/Icons/User.cjs +30 -0
  322. package/dist/cjs/components/primitives/Icons/User.cjs.map +1 -0
  323. package/dist/cjs/components/primitives/Icons/X.cjs +26 -0
  324. package/dist/cjs/components/primitives/Icons/X.cjs.map +1 -0
  325. package/dist/cjs/components/primitives/Icons/flowIconRegistry.cjs +17 -0
  326. package/dist/cjs/components/primitives/Icons/flowIconRegistry.cjs.map +1 -0
  327. package/dist/cjs/components/primitives/InputLabel/InputLabel.cjs +32 -0
  328. package/dist/cjs/components/primitives/InputLabel/InputLabel.cjs.map +1 -0
  329. package/dist/cjs/components/primitives/InputLabel/InputLabel.styles.cjs +58 -0
  330. package/dist/cjs/components/primitives/InputLabel/InputLabel.styles.cjs.map +1 -0
  331. package/dist/cjs/components/primitives/KeyValueInput/KeyValueInput.cjs +215 -0
  332. package/dist/cjs/components/primitives/KeyValueInput/KeyValueInput.cjs.map +1 -0
  333. package/dist/cjs/components/primitives/KeyValueInput/KeyValueInput.styles.cjs +175 -0
  334. package/dist/cjs/components/primitives/KeyValueInput/KeyValueInput.styles.cjs.map +1 -0
  335. package/dist/cjs/components/primitives/Logo/Logo.cjs +37 -0
  336. package/dist/cjs/components/primitives/Logo/Logo.cjs.map +1 -0
  337. package/dist/cjs/components/primitives/Logo/Logo.styles.cjs +53 -0
  338. package/dist/cjs/components/primitives/Logo/Logo.styles.cjs.map +1 -0
  339. package/dist/cjs/components/primitives/MultiInput/MultiInput.cjs +142 -0
  340. package/dist/cjs/components/primitives/MultiInput/MultiInput.cjs.map +1 -0
  341. package/dist/cjs/components/primitives/MultiInput/MultiInput.styles.cjs +115 -0
  342. package/dist/cjs/components/primitives/MultiInput/MultiInput.styles.cjs.map +1 -0
  343. package/dist/cjs/components/primitives/OtpField/OtpField.cjs +129 -0
  344. package/dist/cjs/components/primitives/OtpField/OtpField.cjs.map +1 -0
  345. package/dist/cjs/components/primitives/OtpField/OtpField.styles.cjs +85 -0
  346. package/dist/cjs/components/primitives/OtpField/OtpField.styles.cjs.map +1 -0
  347. package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs +49 -0
  348. package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs.map +1 -0
  349. package/dist/cjs/components/primitives/PasswordField/PasswordField.styles.cjs +49 -0
  350. package/dist/cjs/components/primitives/PasswordField/PasswordField.styles.cjs.map +1 -0
  351. package/dist/cjs/components/primitives/Select/Select.cjs +50 -0
  352. package/dist/cjs/components/primitives/Select/Select.cjs.map +1 -0
  353. package/dist/cjs/components/primitives/Select/Select.styles.cjs +98 -0
  354. package/dist/cjs/components/primitives/Select/Select.styles.cjs.map +1 -0
  355. package/dist/cjs/components/primitives/Spinner/Spinner.cjs +41 -0
  356. package/dist/cjs/components/primitives/Spinner/Spinner.cjs.map +1 -0
  357. package/dist/cjs/components/primitives/Spinner/Spinner.styles.cjs +67 -0
  358. package/dist/cjs/components/primitives/Spinner/Spinner.styles.cjs.map +1 -0
  359. package/dist/cjs/components/primitives/TextField/TextField.cjs +66 -0
  360. package/dist/cjs/components/primitives/TextField/TextField.cjs.map +1 -0
  361. package/dist/cjs/components/primitives/TextField/TextField.styles.cjs +132 -0
  362. package/dist/cjs/components/primitives/TextField/TextField.styles.cjs.map +1 -0
  363. package/dist/cjs/components/primitives/Toggle/Toggle.cjs +64 -0
  364. package/dist/cjs/components/primitives/Toggle/Toggle.cjs.map +1 -0
  365. package/dist/cjs/components/primitives/Toggle/Toggle.styles.cjs +101 -0
  366. package/dist/cjs/components/primitives/Toggle/Toggle.styles.cjs.map +1 -0
  367. package/dist/cjs/components/primitives/Typography/Typography.cjs +64 -0
  368. package/dist/cjs/components/primitives/Typography/Typography.cjs.map +1 -0
  369. package/dist/cjs/components/primitives/Typography/Typography.styles.cjs +276 -0
  370. package/dist/cjs/components/primitives/Typography/Typography.styles.cjs.map +1 -0
  371. package/dist/cjs/contexts/Branding/BrandingContext.cjs +12 -0
  372. package/dist/cjs/contexts/Branding/BrandingContext.cjs.map +1 -0
  373. package/dist/cjs/contexts/Branding/BrandingProvider.cjs +96 -0
  374. package/dist/cjs/contexts/Branding/BrandingProvider.cjs.map +1 -0
  375. package/dist/cjs/contexts/Branding/useBrandingContext.cjs +40 -0
  376. package/dist/cjs/contexts/Branding/useBrandingContext.cjs.map +1 -0
  377. package/dist/cjs/contexts/ComponentRenderer/ComponentRendererContext.cjs +11 -0
  378. package/dist/cjs/contexts/ComponentRenderer/ComponentRendererContext.cjs.map +1 -0
  379. package/dist/cjs/contexts/ComponentRenderer/ComponentRendererProvider.cjs +15 -0
  380. package/dist/cjs/contexts/ComponentRenderer/ComponentRendererProvider.cjs.map +1 -0
  381. package/dist/cjs/contexts/Flow/FlowContext.cjs +17 -0
  382. package/dist/cjs/contexts/Flow/FlowContext.cjs.map +1 -0
  383. package/dist/cjs/contexts/Flow/FlowProvider.cjs +135 -0
  384. package/dist/cjs/contexts/Flow/FlowProvider.cjs.map +1 -0
  385. package/dist/cjs/contexts/Flow/useFlow.cjs +44 -0
  386. package/dist/cjs/contexts/Flow/useFlow.cjs.map +1 -0
  387. package/dist/cjs/contexts/FlowMeta/FlowMetaContext.cjs +12 -0
  388. package/dist/cjs/contexts/FlowMeta/FlowMetaContext.cjs.map +1 -0
  389. package/dist/cjs/contexts/FlowMeta/FlowMetaProvider.cjs +154 -0
  390. package/dist/cjs/contexts/FlowMeta/FlowMetaProvider.cjs.map +1 -0
  391. package/dist/cjs/contexts/FlowMeta/useFlowMeta.cjs +16 -0
  392. package/dist/cjs/contexts/FlowMeta/useFlowMeta.cjs.map +1 -0
  393. package/dist/cjs/contexts/I18n/ComponentPreferencesContext.cjs +16 -0
  394. package/dist/cjs/contexts/I18n/ComponentPreferencesContext.cjs.map +1 -0
  395. package/dist/cjs/contexts/I18n/I18nContext.cjs +12 -0
  396. package/dist/cjs/contexts/I18n/I18nContext.cjs.map +1 -0
  397. package/dist/cjs/contexts/I18n/I18nProvider.cjs +217 -0
  398. package/dist/cjs/contexts/I18n/I18nProvider.cjs.map +1 -0
  399. package/dist/cjs/contexts/I18n/useI18n.cjs +23 -0
  400. package/dist/cjs/contexts/I18n/useI18n.cjs.map +1 -0
  401. package/dist/cjs/contexts/Organization/OrganizationContext.cjs +27 -0
  402. package/dist/cjs/contexts/Organization/OrganizationContext.cjs.map +1 -0
  403. package/dist/cjs/contexts/Organization/OrganizationProvider.cjs +97 -0
  404. package/dist/cjs/contexts/Organization/OrganizationProvider.cjs.map +1 -0
  405. package/dist/cjs/contexts/Organization/useOrganization.cjs +100 -0
  406. package/dist/cjs/contexts/Organization/useOrganization.cjs.map +1 -0
  407. package/dist/cjs/contexts/Theme/ThemeContext.cjs +12 -0
  408. package/dist/cjs/contexts/Theme/ThemeContext.cjs.map +1 -0
  409. package/dist/cjs/contexts/Theme/ThemeProvider.cjs +69 -0
  410. package/dist/cjs/contexts/Theme/ThemeProvider.cjs.map +1 -0
  411. package/dist/cjs/contexts/Theme/useTheme.cjs +16 -0
  412. package/dist/cjs/contexts/Theme/useTheme.cjs.map +1 -0
  413. package/dist/cjs/contexts/Theme/v1/ThemeProvider.cjs +190 -0
  414. package/dist/cjs/contexts/Theme/v1/ThemeProvider.cjs.map +1 -0
  415. package/dist/cjs/contexts/Theme/v2/ThemeProvider.cjs +108 -0
  416. package/dist/cjs/contexts/Theme/v2/ThemeProvider.cjs.map +1 -0
  417. package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs +52 -0
  418. package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs.map +1 -0
  419. package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs +407 -0
  420. package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -0
  421. package/dist/cjs/contexts/ThunderID/useThunderID.cjs +32 -0
  422. package/dist/cjs/contexts/ThunderID/useThunderID.cjs.map +1 -0
  423. package/dist/cjs/contexts/User/UserContext.cjs +22 -0
  424. package/dist/cjs/contexts/User/UserContext.cjs.map +1 -0
  425. package/dist/cjs/contexts/User/UserProvider.cjs +60 -0
  426. package/dist/cjs/contexts/User/UserProvider.cjs.map +1 -0
  427. package/dist/cjs/contexts/User/useUser.cjs +90 -0
  428. package/dist/cjs/contexts/User/useUser.cjs.map +1 -0
  429. package/dist/cjs/hooks/useBranding.cjs +71 -0
  430. package/dist/cjs/hooks/useBranding.cjs.map +1 -0
  431. package/dist/cjs/hooks/useBrowserUrl.cjs +33 -0
  432. package/dist/cjs/hooks/useBrowserUrl.cjs.map +1 -0
  433. package/dist/cjs/hooks/useForm.cjs +217 -0
  434. package/dist/cjs/hooks/useForm.cjs.map +1 -0
  435. package/dist/cjs/hooks/useTranslation.cjs +79 -0
  436. package/dist/cjs/hooks/useTranslation.cjs.map +1 -0
  437. package/dist/cjs/hooks/v2/useOAuthCallback.cjs +86 -0
  438. package/dist/cjs/hooks/v2/useOAuthCallback.cjs.map +1 -0
  439. package/dist/cjs/index.cjs +375 -0
  440. package/dist/cjs/utils/applyThemeToDOM.cjs +16 -0
  441. package/dist/cjs/utils/applyThemeToDOM.cjs.map +1 -0
  442. package/dist/cjs/utils/getDisplayName.cjs +50 -0
  443. package/dist/cjs/utils/getDisplayName.cjs.map +1 -0
  444. package/dist/cjs/utils/getMappedUserProfileValue.cjs +61 -0
  445. package/dist/cjs/utils/getMappedUserProfileValue.cjs.map +1 -0
  446. package/dist/cjs/utils/normalizeThemeConfig.cjs +43 -0
  447. package/dist/cjs/utils/normalizeThemeConfig.cjs.map +1 -0
  448. package/dist/cjs/utils/oauth.cjs +28 -0
  449. package/dist/cjs/utils/oauth.cjs.map +1 -0
  450. package/dist/cjs/utils/v2/buildThemeConfigFromFlowMeta.cjs +48 -0
  451. package/dist/cjs/utils/v2/buildThemeConfigFromFlowMeta.cjs.map +1 -0
  452. package/dist/cjs/utils/v2/flowTransformer.cjs +153 -0
  453. package/dist/cjs/utils/v2/flowTransformer.cjs.map +1 -0
  454. package/dist/cjs/utils/v2/getAuthComponentHeadings.cjs +103 -0
  455. package/dist/cjs/utils/v2/getAuthComponentHeadings.cjs.map +1 -0
  456. package/dist/cjs/utils/v2/passkey.cjs +93 -0
  457. package/dist/cjs/utils/v2/passkey.cjs.map +1 -0
  458. package/dist/cjs/utils/v2/resolveTranslationsInArray.cjs +21 -0
  459. package/dist/cjs/utils/v2/resolveTranslationsInArray.cjs.map +1 -0
  460. package/dist/cjs/utils/v2/resolveTranslationsInObject.cjs +33 -0
  461. package/dist/cjs/utils/v2/resolveTranslationsInObject.cjs.map +1 -0
  462. package/dist/components/actions/SignInButton/BaseSignInButton.js +49 -0
  463. package/dist/components/actions/SignInButton/BaseSignInButton.js.map +1 -0
  464. package/dist/components/actions/SignInButton/SignInButton.d.ts +6 -0
  465. package/dist/components/actions/SignInButton/SignInButton.d.ts.map +1 -1
  466. package/dist/components/actions/SignInButton/SignInButton.js +84 -0
  467. package/dist/components/actions/SignInButton/SignInButton.js.map +1 -0
  468. package/dist/components/actions/SignOutButton/BaseSignOutButton.js +49 -0
  469. package/dist/components/actions/SignOutButton/BaseSignOutButton.js.map +1 -0
  470. package/dist/components/actions/SignOutButton/SignOutButton.js +80 -0
  471. package/dist/components/actions/SignOutButton/SignOutButton.js.map +1 -0
  472. package/dist/components/actions/SignUpButton/BaseSignUpButton.js +51 -0
  473. package/dist/components/actions/SignUpButton/BaseSignUpButton.js.map +1 -0
  474. package/dist/components/actions/SignUpButton/SignUpButton.js +82 -0
  475. package/dist/components/actions/SignUpButton/SignUpButton.js.map +1 -0
  476. package/dist/components/adapters/CheckboxInput.js +28 -0
  477. package/dist/components/adapters/CheckboxInput.js.map +1 -0
  478. package/dist/components/adapters/Consent.js +67 -0
  479. package/dist/components/adapters/Consent.js.map +1 -0
  480. package/dist/components/adapters/ConsentCheckboxList.js +76 -0
  481. package/dist/components/adapters/ConsentCheckboxList.js.map +1 -0
  482. package/dist/components/adapters/ConsentCheckboxList.styles.js +43 -0
  483. package/dist/components/adapters/ConsentCheckboxList.styles.js.map +1 -0
  484. package/dist/components/adapters/DateInput.js +28 -0
  485. package/dist/components/adapters/DateInput.js.map +1 -0
  486. package/dist/components/adapters/DividerComponent.js +22 -0
  487. package/dist/components/adapters/DividerComponent.js.map +1 -0
  488. package/dist/components/adapters/EmailInput.js +28 -0
  489. package/dist/components/adapters/EmailInput.js.map +1 -0
  490. package/dist/components/adapters/FacebookButton.js +39 -0
  491. package/dist/components/adapters/FacebookButton.js.map +1 -0
  492. package/dist/components/adapters/FlowTimer.js +49 -0
  493. package/dist/components/adapters/FlowTimer.js.map +1 -0
  494. package/dist/components/adapters/FormContainer.js +34 -0
  495. package/dist/components/adapters/FormContainer.js.map +1 -0
  496. package/dist/components/adapters/GitHubButton.js +39 -0
  497. package/dist/components/adapters/GitHubButton.js.map +1 -0
  498. package/dist/components/adapters/GoogleButton.js +57 -0
  499. package/dist/components/adapters/GoogleButton.js.map +1 -0
  500. package/dist/components/adapters/ImageComponent.js +74 -0
  501. package/dist/components/adapters/ImageComponent.js.map +1 -0
  502. package/dist/components/adapters/LinkedInButton.js +36 -0
  503. package/dist/components/adapters/LinkedInButton.js.map +1 -0
  504. package/dist/components/adapters/MicrosoftButton.js +54 -0
  505. package/dist/components/adapters/MicrosoftButton.js.map +1 -0
  506. package/dist/components/adapters/NumberInput.js +28 -0
  507. package/dist/components/adapters/NumberInput.js.map +1 -0
  508. package/dist/components/adapters/PasswordInput.js +50 -0
  509. package/dist/components/adapters/PasswordInput.js.map +1 -0
  510. package/dist/components/adapters/SelectInput.js +34 -0
  511. package/dist/components/adapters/SelectInput.js.map +1 -0
  512. package/dist/components/adapters/SignInWithEthereumButton.js +36 -0
  513. package/dist/components/adapters/SignInWithEthereumButton.js.map +1 -0
  514. package/dist/components/adapters/SmsOtpButton.js +36 -0
  515. package/dist/components/adapters/SmsOtpButton.js.map +1 -0
  516. package/dist/components/adapters/SubmitButton.js +59 -0
  517. package/dist/components/adapters/SubmitButton.js.map +1 -0
  518. package/dist/components/adapters/TelephoneInput.js +30 -0
  519. package/dist/components/adapters/TelephoneInput.js.map +1 -0
  520. package/dist/components/adapters/TextInput.js +28 -0
  521. package/dist/components/adapters/TextInput.js.map +1 -0
  522. package/dist/components/adapters/Typography.js +58 -0
  523. package/dist/components/adapters/Typography.js.map +1 -0
  524. package/dist/components/auth/Callback/Callback.d.ts +6 -44
  525. package/dist/components/auth/Callback/Callback.d.ts.map +1 -1
  526. package/dist/components/auth/Callback/Callback.js +23 -0
  527. package/dist/components/auth/Callback/Callback.js.map +1 -0
  528. package/dist/components/auth/Callback/OAuthCallback.d.ts +52 -0
  529. package/dist/components/auth/Callback/OAuthCallback.d.ts.map +1 -0
  530. package/dist/components/auth/Callback/OAuthCallback.js +101 -0
  531. package/dist/components/auth/Callback/OAuthCallback.js.map +1 -0
  532. package/dist/components/auth/Callback/TokenCallback.d.ts +44 -0
  533. package/dist/components/auth/Callback/TokenCallback.d.ts.map +1 -0
  534. package/dist/components/auth/Callback/TokenCallback.js +131 -0
  535. package/dist/components/auth/Callback/TokenCallback.js.map +1 -0
  536. package/dist/components/control/Loading.js +33 -0
  537. package/dist/components/control/Loading.js.map +1 -0
  538. package/dist/components/control/OrganizationContext/OrganizationContext.js +32 -0
  539. package/dist/components/control/OrganizationContext/OrganizationContext.js.map +1 -0
  540. package/dist/components/control/OrganizationContext/OrganizationContextController.js +55 -0
  541. package/dist/components/control/OrganizationContext/OrganizationContextController.js.map +1 -0
  542. package/dist/components/control/SignedIn.js +33 -0
  543. package/dist/components/control/SignedIn.js.map +1 -0
  544. package/dist/components/control/SignedOut.js +33 -0
  545. package/dist/components/control/SignedOut.js.map +1 -0
  546. package/dist/components/factories/FieldFactory.js +137 -0
  547. package/dist/components/factories/FieldFactory.js.map +1 -0
  548. package/dist/components/presentation/CreateOrganization/BaseCreateOrganization.js +178 -0
  549. package/dist/components/presentation/CreateOrganization/BaseCreateOrganization.js.map +1 -0
  550. package/dist/components/presentation/CreateOrganization/BaseCreateOrganization.styles.js +147 -0
  551. package/dist/components/presentation/CreateOrganization/BaseCreateOrganization.styles.js.map +1 -0
  552. package/dist/components/presentation/CreateOrganization/CreateOrganization.d.ts +1 -1
  553. package/dist/components/presentation/CreateOrganization/CreateOrganization.d.ts.map +1 -1
  554. package/dist/components/presentation/CreateOrganization/CreateOrganization.js +87 -0
  555. package/dist/components/presentation/CreateOrganization/CreateOrganization.js.map +1 -0
  556. package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.js +113 -0
  557. package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.js.map +1 -0
  558. package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.js +115 -0
  559. package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.js.map +1 -0
  560. package/dist/components/presentation/LanguageSwitcher/LanguageSwitcher.js +72 -0
  561. package/dist/components/presentation/LanguageSwitcher/LanguageSwitcher.js.map +1 -0
  562. package/dist/components/presentation/Organization/BaseOrganization.js +39 -0
  563. package/dist/components/presentation/Organization/BaseOrganization.js.map +1 -0
  564. package/dist/components/presentation/Organization/Organization.js +47 -0
  565. package/dist/components/presentation/Organization/Organization.js.map +1 -0
  566. package/dist/components/presentation/OrganizationList/BaseOrganizationList.js +252 -0
  567. package/dist/components/presentation/OrganizationList/BaseOrganizationList.js.map +1 -0
  568. package/dist/components/presentation/OrganizationList/BaseOrganizationList.styles.js +233 -0
  569. package/dist/components/presentation/OrganizationList/BaseOrganizationList.styles.js.map +1 -0
  570. package/dist/components/presentation/OrganizationList/OrganizationList.js +82 -0
  571. package/dist/components/presentation/OrganizationList/OrganizationList.js.map +1 -0
  572. package/dist/components/presentation/OrganizationList/OrganizationList.styles.js +72 -0
  573. package/dist/components/presentation/OrganizationList/OrganizationList.styles.js.map +1 -0
  574. package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.d.ts +1 -1
  575. package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.d.ts.map +1 -1
  576. package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.js +323 -0
  577. package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.js.map +1 -0
  578. package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.styles.js +163 -0
  579. package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.styles.js.map +1 -0
  580. package/dist/components/presentation/OrganizationProfile/OrganizationProfile.js +122 -0
  581. package/dist/components/presentation/OrganizationProfile/OrganizationProfile.js.map +1 -0
  582. package/dist/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.d.ts +1 -1
  583. package/dist/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.d.ts.map +1 -1
  584. package/dist/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.js +282 -0
  585. package/dist/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.js.map +1 -0
  586. package/dist/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.styles.js +234 -0
  587. package/dist/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.styles.js.map +1 -0
  588. package/dist/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +1 -1
  589. package/dist/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts.map +1 -1
  590. package/dist/components/presentation/OrganizationSwitcher/OrganizationSwitcher.js +124 -0
  591. package/dist/components/presentation/OrganizationSwitcher/OrganizationSwitcher.js.map +1 -0
  592. package/dist/components/presentation/User/BaseUser.js +39 -0
  593. package/dist/components/presentation/User/BaseUser.js.map +1 -0
  594. package/dist/components/presentation/User/User.js +43 -0
  595. package/dist/components/presentation/User/User.js.map +1 -0
  596. package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +1 -1
  597. package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts.map +1 -1
  598. package/dist/components/presentation/UserDropdown/BaseUserDropdown.js +184 -0
  599. package/dist/components/presentation/UserDropdown/BaseUserDropdown.js.map +1 -0
  600. package/dist/components/presentation/UserDropdown/BaseUserDropdown.styles.js +198 -0
  601. package/dist/components/presentation/UserDropdown/BaseUserDropdown.styles.js.map +1 -0
  602. package/dist/components/presentation/UserDropdown/UserDropdown.js +108 -0
  603. package/dist/components/presentation/UserDropdown/UserDropdown.js.map +1 -0
  604. package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +1 -1
  605. package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts.map +1 -1
  606. package/dist/components/presentation/UserProfile/BaseUserProfile.js +455 -0
  607. package/dist/components/presentation/UserProfile/BaseUserProfile.js.map +1 -0
  608. package/dist/components/presentation/UserProfile/BaseUserProfile.styles.js +213 -0
  609. package/dist/components/presentation/UserProfile/BaseUserProfile.styles.js.map +1 -0
  610. package/dist/components/presentation/UserProfile/UserProfile.js +77 -0
  611. package/dist/components/presentation/UserProfile/UserProfile.js.map +1 -0
  612. package/dist/components/presentation/auth/AcceptInvite/v2/AcceptInvite.js +106 -0
  613. package/dist/components/presentation/auth/AcceptInvite/v2/AcceptInvite.js.map +1 -0
  614. package/dist/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.d.ts +7 -3
  615. package/dist/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.d.ts.map +1 -1
  616. package/dist/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.js +500 -0
  617. package/dist/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.js.map +1 -0
  618. package/dist/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.styles.js +49 -0
  619. package/dist/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.styles.js.map +1 -0
  620. package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
  621. package/dist/components/presentation/auth/AuthOptionFactory.js +445 -0
  622. package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -0
  623. package/dist/components/presentation/auth/InviteUser/v2/BaseInviteUser.d.ts +3 -3
  624. package/dist/components/presentation/auth/InviteUser/v2/BaseInviteUser.d.ts.map +1 -1
  625. package/dist/components/presentation/auth/InviteUser/v2/BaseInviteUser.js +414 -0
  626. package/dist/components/presentation/auth/InviteUser/v2/BaseInviteUser.js.map +1 -0
  627. package/dist/components/presentation/auth/InviteUser/v2/BaseInviteUser.styles.js +49 -0
  628. package/dist/components/presentation/auth/InviteUser/v2/BaseInviteUser.styles.js.map +1 -0
  629. package/dist/components/presentation/auth/InviteUser/v2/InviteUser.js +114 -0
  630. package/dist/components/presentation/auth/InviteUser/v2/InviteUser.js.map +1 -0
  631. package/dist/components/presentation/auth/OrganizationUnitPicker/v2/OrganizationUnitPicker.js +179 -0
  632. package/dist/components/presentation/auth/OrganizationUnitPicker/v2/OrganizationUnitPicker.js.map +1 -0
  633. package/dist/components/presentation/auth/OrganizationUnitPicker/v2/OrganizationUnitPicker.styles.js +125 -0
  634. package/dist/components/presentation/auth/OrganizationUnitPicker/v2/OrganizationUnitPicker.styles.js.map +1 -0
  635. package/dist/components/presentation/auth/Recovery/BaseRecovery.js +17 -0
  636. package/dist/components/presentation/auth/Recovery/BaseRecovery.js.map +1 -0
  637. package/dist/components/presentation/auth/Recovery/Recovery.js +46 -0
  638. package/dist/components/presentation/auth/Recovery/Recovery.js.map +1 -0
  639. package/dist/components/presentation/auth/Recovery/v1/BaseRecovery.js +288 -0
  640. package/dist/components/presentation/auth/Recovery/v1/BaseRecovery.js.map +1 -0
  641. package/dist/components/presentation/auth/Recovery/v1/Recovery.js +40 -0
  642. package/dist/components/presentation/auth/Recovery/v1/Recovery.js.map +1 -0
  643. package/dist/components/presentation/auth/Recovery/v1/RecoveryOptionFactory.js +160 -0
  644. package/dist/components/presentation/auth/Recovery/v1/RecoveryOptionFactory.js.map +1 -0
  645. package/dist/components/presentation/auth/Recovery/v2/BaseRecovery.d.ts +5 -5
  646. package/dist/components/presentation/auth/Recovery/v2/BaseRecovery.d.ts.map +1 -1
  647. package/dist/components/presentation/auth/Recovery/v2/BaseRecovery.js +373 -0
  648. package/dist/components/presentation/auth/Recovery/v2/BaseRecovery.js.map +1 -0
  649. package/dist/components/presentation/auth/Recovery/v2/Recovery.d.ts.map +1 -1
  650. package/dist/components/presentation/auth/Recovery/v2/Recovery.js +74 -0
  651. package/dist/components/presentation/auth/Recovery/v2/Recovery.js.map +1 -0
  652. package/dist/components/presentation/auth/SignIn/BaseSignIn.js +17 -0
  653. package/dist/components/presentation/auth/SignIn/BaseSignIn.js.map +1 -0
  654. package/dist/components/presentation/auth/SignIn/BaseSignIn.styles.js +151 -0
  655. package/dist/components/presentation/auth/SignIn/BaseSignIn.styles.js.map +1 -0
  656. package/dist/components/presentation/auth/SignIn/SignIn.js +83 -0
  657. package/dist/components/presentation/auth/SignIn/SignIn.js.map +1 -0
  658. package/dist/components/presentation/auth/SignIn/v1/BaseSignIn.d.ts.map +1 -1
  659. package/dist/components/presentation/auth/SignIn/v1/BaseSignIn.js +729 -0
  660. package/dist/components/presentation/auth/SignIn/v1/BaseSignIn.js.map +1 -0
  661. package/dist/components/presentation/auth/SignIn/v1/options/EmailOtp.js +64 -0
  662. package/dist/components/presentation/auth/SignIn/v1/options/EmailOtp.js.map +1 -0
  663. package/dist/components/presentation/auth/SignIn/v1/options/IdentifierFirst.js +55 -0
  664. package/dist/components/presentation/auth/SignIn/v1/options/IdentifierFirst.js.map +1 -0
  665. package/dist/components/presentation/auth/SignIn/v1/options/MultiOptionButton.js +136 -0
  666. package/dist/components/presentation/auth/SignIn/v1/options/MultiOptionButton.js.map +1 -0
  667. package/dist/components/presentation/auth/SignIn/v1/options/SignInOptionFactory.js +143 -0
  668. package/dist/components/presentation/auth/SignIn/v1/options/SignInOptionFactory.js.map +1 -0
  669. package/dist/components/presentation/auth/SignIn/v1/options/SmsOtp.js +64 -0
  670. package/dist/components/presentation/auth/SignIn/v1/options/SmsOtp.js.map +1 -0
  671. package/dist/components/presentation/auth/SignIn/v1/options/SocialButton.js +36 -0
  672. package/dist/components/presentation/auth/SignIn/v1/options/SocialButton.js.map +1 -0
  673. package/dist/components/presentation/auth/SignIn/v1/options/Totp.js +64 -0
  674. package/dist/components/presentation/auth/SignIn/v1/options/Totp.js.map +1 -0
  675. package/dist/components/presentation/auth/SignIn/v1/options/UsernamePassword.js +56 -0
  676. package/dist/components/presentation/auth/SignIn/v1/options/UsernamePassword.js.map +1 -0
  677. package/dist/components/presentation/auth/SignIn/v2/BaseSignIn.d.ts +1 -1
  678. package/dist/components/presentation/auth/SignIn/v2/BaseSignIn.d.ts.map +1 -1
  679. package/dist/components/presentation/auth/SignIn/v2/BaseSignIn.js +325 -0
  680. package/dist/components/presentation/auth/SignIn/v2/BaseSignIn.js.map +1 -0
  681. package/dist/components/presentation/auth/SignIn/v2/SignIn.d.ts +1 -1
  682. package/dist/components/presentation/auth/SignIn/v2/SignIn.d.ts.map +1 -1
  683. package/dist/components/presentation/auth/SignIn/v2/SignIn.js +556 -0
  684. package/dist/components/presentation/auth/SignIn/v2/SignIn.js.map +1 -0
  685. package/dist/components/presentation/auth/SignUp/BaseSignUp.js +17 -0
  686. package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -0
  687. package/dist/components/presentation/auth/SignUp/BaseSignUp.styles.js +147 -0
  688. package/dist/components/presentation/auth/SignUp/BaseSignUp.styles.js.map +1 -0
  689. package/dist/components/presentation/auth/SignUp/SignUp.js +87 -0
  690. package/dist/components/presentation/auth/SignUp/SignUp.js.map +1 -0
  691. package/dist/components/presentation/auth/SignUp/v1/BaseSignUp.js +446 -0
  692. package/dist/components/presentation/auth/SignUp/v1/BaseSignUp.js.map +1 -0
  693. package/dist/components/presentation/auth/SignUp/v1/SignUp.js +51 -0
  694. package/dist/components/presentation/auth/SignUp/v1/SignUp.js.map +1 -0
  695. package/dist/components/presentation/auth/SignUp/v1/SignUpOptionFactory.js +160 -0
  696. package/dist/components/presentation/auth/SignUp/v1/SignUpOptionFactory.js.map +1 -0
  697. package/dist/components/presentation/auth/SignUp/v2/BaseSignUp.d.ts +6 -6
  698. package/dist/components/presentation/auth/SignUp/v2/BaseSignUp.d.ts.map +1 -1
  699. package/dist/components/presentation/auth/SignUp/v2/BaseSignUp.js +651 -0
  700. package/dist/components/presentation/auth/SignUp/v2/BaseSignUp.js.map +1 -0
  701. package/dist/components/presentation/auth/SignUp/v2/SignUp.d.ts +1 -1
  702. package/dist/components/presentation/auth/SignUp/v2/SignUp.d.ts.map +1 -1
  703. package/dist/components/presentation/auth/SignUp/v2/SignUp.js +77 -0
  704. package/dist/components/presentation/auth/SignUp/v2/SignUp.js.map +1 -0
  705. package/dist/components/primitives/Alert/Alert.js +102 -0
  706. package/dist/components/primitives/Alert/Alert.js.map +1 -0
  707. package/dist/components/primitives/Alert/Alert.styles.js +86 -0
  708. package/dist/components/primitives/Alert/Alert.styles.js.map +1 -0
  709. package/dist/components/primitives/Avatar/Avatar.js +60 -0
  710. package/dist/components/primitives/Avatar/Avatar.js.map +1 -0
  711. package/dist/components/primitives/Avatar/Avatar.styles.js +84 -0
  712. package/dist/components/primitives/Avatar/Avatar.styles.js.map +1 -0
  713. package/dist/components/primitives/Button/Button.js +92 -0
  714. package/dist/components/primitives/Button/Button.js.map +1 -0
  715. package/dist/components/primitives/Button/Button.styles.js +344 -0
  716. package/dist/components/primitives/Button/Button.styles.js.map +1 -0
  717. package/dist/components/primitives/Card/Card.js +173 -0
  718. package/dist/components/primitives/Card/Card.js.map +1 -0
  719. package/dist/components/primitives/Card/Card.styles.js +97 -0
  720. package/dist/components/primitives/Card/Card.styles.js.map +1 -0
  721. package/dist/components/primitives/Checkbox/Checkbox.js +42 -0
  722. package/dist/components/primitives/Checkbox/Checkbox.js.map +1 -0
  723. package/dist/components/primitives/Checkbox/Checkbox.styles.js +76 -0
  724. package/dist/components/primitives/Checkbox/Checkbox.styles.js.map +1 -0
  725. package/dist/components/primitives/CopyableText/CopyableText.js +60 -0
  726. package/dist/components/primitives/CopyableText/CopyableText.js.map +1 -0
  727. package/dist/components/primitives/CopyableText/CopyableText.styles.js +45 -0
  728. package/dist/components/primitives/CopyableText/CopyableText.styles.js.map +1 -0
  729. package/dist/components/primitives/DatePicker/DatePicker.js +43 -0
  730. package/dist/components/primitives/DatePicker/DatePicker.js.map +1 -0
  731. package/dist/components/primitives/DatePicker/DatePicker.styles.js +84 -0
  732. package/dist/components/primitives/DatePicker/DatePicker.styles.js.map +1 -0
  733. package/dist/components/primitives/Dialog/Dialog.js +194 -0
  734. package/dist/components/primitives/Dialog/Dialog.js.map +1 -0
  735. package/dist/components/primitives/Dialog/Dialog.styles.js +72 -0
  736. package/dist/components/primitives/Dialog/Dialog.styles.js.map +1 -0
  737. package/dist/components/primitives/Divider/Divider.js +67 -0
  738. package/dist/components/primitives/Divider/Divider.js.map +1 -0
  739. package/dist/components/primitives/Divider/Divider.styles.js +69 -0
  740. package/dist/components/primitives/Divider/Divider.styles.js.map +1 -0
  741. package/dist/components/primitives/FormControl/FormControl.js +29 -0
  742. package/dist/components/primitives/FormControl/FormControl.js.map +1 -0
  743. package/dist/components/primitives/FormControl/FormControl.styles.js +40 -0
  744. package/dist/components/primitives/FormControl/FormControl.styles.js.map +1 -0
  745. package/dist/components/primitives/Icons/ArrowLeftRight.js +29 -0
  746. package/dist/components/primitives/Icons/ArrowLeftRight.js.map +1 -0
  747. package/dist/components/primitives/Icons/ArrowRightLeft.js +29 -0
  748. package/dist/components/primitives/Icons/ArrowRightLeft.js.map +1 -0
  749. package/dist/components/primitives/Icons/Building.js +73 -0
  750. package/dist/components/primitives/Icons/Building.js.map +1 -0
  751. package/dist/components/primitives/Icons/BuildingAlt.js +35 -0
  752. package/dist/components/primitives/Icons/BuildingAlt.js.map +1 -0
  753. package/dist/components/primitives/Icons/Check.js +29 -0
  754. package/dist/components/primitives/Icons/Check.js.map +1 -0
  755. package/dist/components/primitives/Icons/ChevronDown.js +29 -0
  756. package/dist/components/primitives/Icons/ChevronDown.js.map +1 -0
  757. package/dist/components/primitives/Icons/CircleAlert.js +42 -0
  758. package/dist/components/primitives/Icons/CircleAlert.js.map +1 -0
  759. package/dist/components/primitives/Icons/CircleCheck.js +28 -0
  760. package/dist/components/primitives/Icons/CircleCheck.js.map +1 -0
  761. package/dist/components/primitives/Icons/Eye.js +28 -0
  762. package/dist/components/primitives/Icons/Eye.js.map +1 -0
  763. package/dist/components/primitives/Icons/EyeOff.js +29 -0
  764. package/dist/components/primitives/Icons/EyeOff.js.map +1 -0
  765. package/dist/components/primitives/Icons/Info.js +32 -0
  766. package/dist/components/primitives/Icons/Info.js.map +1 -0
  767. package/dist/components/primitives/Icons/LogOut.js +28 -0
  768. package/dist/components/primitives/Icons/LogOut.js.map +1 -0
  769. package/dist/components/primitives/Icons/Plus.js +24 -0
  770. package/dist/components/primitives/Icons/Plus.js.map +1 -0
  771. package/dist/components/primitives/Icons/TriangleAlert.js +28 -0
  772. package/dist/components/primitives/Icons/TriangleAlert.js.map +1 -0
  773. package/dist/components/primitives/Icons/User.js +28 -0
  774. package/dist/components/primitives/Icons/User.js.map +1 -0
  775. package/dist/components/primitives/Icons/X.js +24 -0
  776. package/dist/components/primitives/Icons/X.js.map +1 -0
  777. package/dist/components/primitives/Icons/flowIconRegistry.js +17 -0
  778. package/dist/components/primitives/Icons/flowIconRegistry.js.map +1 -0
  779. package/dist/components/primitives/InputLabel/InputLabel.js +28 -0
  780. package/dist/components/primitives/InputLabel/InputLabel.js.map +1 -0
  781. package/dist/components/primitives/InputLabel/InputLabel.styles.js +55 -0
  782. package/dist/components/primitives/InputLabel/InputLabel.styles.js.map +1 -0
  783. package/dist/components/primitives/KeyValueInput/KeyValueInput.js +210 -0
  784. package/dist/components/primitives/KeyValueInput/KeyValueInput.js.map +1 -0
  785. package/dist/components/primitives/KeyValueInput/KeyValueInput.styles.js +172 -0
  786. package/dist/components/primitives/KeyValueInput/KeyValueInput.styles.js.map +1 -0
  787. package/dist/components/primitives/Logo/Logo.js +33 -0
  788. package/dist/components/primitives/Logo/Logo.js.map +1 -0
  789. package/dist/components/primitives/Logo/Logo.styles.js +50 -0
  790. package/dist/components/primitives/Logo/Logo.styles.js.map +1 -0
  791. package/dist/components/primitives/MultiInput/MultiInput.js +137 -0
  792. package/dist/components/primitives/MultiInput/MultiInput.js.map +1 -0
  793. package/dist/components/primitives/MultiInput/MultiInput.styles.js +112 -0
  794. package/dist/components/primitives/MultiInput/MultiInput.styles.js.map +1 -0
  795. package/dist/components/primitives/OtpField/OtpField.js +124 -0
  796. package/dist/components/primitives/OtpField/OtpField.js.map +1 -0
  797. package/dist/components/primitives/OtpField/OtpField.styles.js +82 -0
  798. package/dist/components/primitives/OtpField/OtpField.styles.js.map +1 -0
  799. package/dist/components/primitives/PasswordField/PasswordField.js +44 -0
  800. package/dist/components/primitives/PasswordField/PasswordField.js.map +1 -0
  801. package/dist/components/primitives/PasswordField/PasswordField.styles.js +46 -0
  802. package/dist/components/primitives/PasswordField/PasswordField.styles.js.map +1 -0
  803. package/dist/components/primitives/Select/Select.js +46 -0
  804. package/dist/components/primitives/Select/Select.js.map +1 -0
  805. package/dist/components/primitives/Select/Select.styles.js +95 -0
  806. package/dist/components/primitives/Select/Select.styles.js.map +1 -0
  807. package/dist/components/primitives/Spinner/Spinner.js +37 -0
  808. package/dist/components/primitives/Spinner/Spinner.js.map +1 -0
  809. package/dist/components/primitives/Spinner/Spinner.styles.js +64 -0
  810. package/dist/components/primitives/Spinner/Spinner.styles.js.map +1 -0
  811. package/dist/components/primitives/TextField/TextField.d.ts.map +1 -1
  812. package/dist/components/primitives/TextField/TextField.js +62 -0
  813. package/dist/components/primitives/TextField/TextField.js.map +1 -0
  814. package/dist/components/primitives/TextField/TextField.styles.js +129 -0
  815. package/dist/components/primitives/TextField/TextField.styles.js.map +1 -0
  816. package/dist/components/primitives/Toggle/Toggle.js +60 -0
  817. package/dist/components/primitives/Toggle/Toggle.js.map +1 -0
  818. package/dist/components/primitives/Toggle/Toggle.styles.js +98 -0
  819. package/dist/components/primitives/Toggle/Toggle.styles.js.map +1 -0
  820. package/dist/components/primitives/Typography/Typography.js +60 -0
  821. package/dist/components/primitives/Typography/Typography.js.map +1 -0
  822. package/dist/components/primitives/Typography/Typography.styles.js +273 -0
  823. package/dist/components/primitives/Typography/Typography.styles.js.map +1 -0
  824. package/dist/contexts/Branding/BrandingContext.js +10 -0
  825. package/dist/contexts/Branding/BrandingContext.js.map +1 -0
  826. package/dist/contexts/Branding/BrandingProvider.js +92 -0
  827. package/dist/contexts/Branding/BrandingProvider.js.map +1 -0
  828. package/dist/contexts/Branding/useBrandingContext.js +38 -0
  829. package/dist/contexts/Branding/useBrandingContext.js.map +1 -0
  830. package/dist/contexts/ComponentRenderer/ComponentRendererContext.js +9 -0
  831. package/dist/contexts/ComponentRenderer/ComponentRendererContext.js.map +1 -0
  832. package/dist/contexts/ComponentRenderer/ComponentRendererProvider.js +13 -0
  833. package/dist/contexts/ComponentRenderer/ComponentRendererProvider.js.map +1 -0
  834. package/dist/contexts/Flow/FlowContext.js +15 -0
  835. package/dist/contexts/Flow/FlowContext.js.map +1 -0
  836. package/dist/contexts/Flow/FlowProvider.js +132 -0
  837. package/dist/contexts/Flow/FlowProvider.js.map +1 -0
  838. package/dist/contexts/Flow/useFlow.js +42 -0
  839. package/dist/contexts/Flow/useFlow.js.map +1 -0
  840. package/dist/contexts/FlowMeta/FlowMetaContext.js +10 -0
  841. package/dist/contexts/FlowMeta/FlowMetaContext.js.map +1 -0
  842. package/dist/contexts/FlowMeta/FlowMetaProvider.d.ts.map +1 -1
  843. package/dist/contexts/FlowMeta/FlowMetaProvider.js +150 -0
  844. package/dist/contexts/FlowMeta/FlowMetaProvider.js.map +1 -0
  845. package/dist/contexts/FlowMeta/useFlowMeta.js +14 -0
  846. package/dist/contexts/FlowMeta/useFlowMeta.js.map +1 -0
  847. package/dist/contexts/I18n/ComponentPreferencesContext.js +14 -0
  848. package/dist/contexts/I18n/ComponentPreferencesContext.js.map +1 -0
  849. package/dist/contexts/I18n/I18nContext.js +10 -0
  850. package/dist/contexts/I18n/I18nContext.js.map +1 -0
  851. package/dist/contexts/I18n/I18nProvider.js +213 -0
  852. package/dist/contexts/I18n/I18nProvider.js.map +1 -0
  853. package/dist/contexts/I18n/useI18n.js +21 -0
  854. package/dist/contexts/I18n/useI18n.js.map +1 -0
  855. package/dist/contexts/Organization/OrganizationContext.js +25 -0
  856. package/dist/contexts/Organization/OrganizationContext.js.map +1 -0
  857. package/dist/contexts/Organization/OrganizationProvider.d.ts.map +1 -1
  858. package/dist/contexts/Organization/OrganizationProvider.js +93 -0
  859. package/dist/contexts/Organization/OrganizationProvider.js.map +1 -0
  860. package/dist/contexts/Organization/useOrganization.js +98 -0
  861. package/dist/contexts/Organization/useOrganization.js.map +1 -0
  862. package/dist/contexts/Theme/ThemeContext.js +10 -0
  863. package/dist/contexts/Theme/ThemeContext.js.map +1 -0
  864. package/dist/contexts/Theme/ThemeProvider.js +66 -0
  865. package/dist/contexts/Theme/ThemeProvider.js.map +1 -0
  866. package/dist/contexts/Theme/useTheme.js +14 -0
  867. package/dist/contexts/Theme/useTheme.js.map +1 -0
  868. package/dist/contexts/Theme/v1/ThemeProvider.js +186 -0
  869. package/dist/contexts/Theme/v1/ThemeProvider.js.map +1 -0
  870. package/dist/contexts/Theme/v2/ThemeProvider.js +104 -0
  871. package/dist/contexts/Theme/v2/ThemeProvider.js.map +1 -0
  872. package/dist/contexts/ThunderID/ThunderIDContext.d.ts +12 -2
  873. package/dist/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -1
  874. package/dist/contexts/ThunderID/ThunderIDContext.js +50 -0
  875. package/dist/contexts/ThunderID/ThunderIDContext.js.map +1 -0
  876. package/dist/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
  877. package/dist/contexts/ThunderID/ThunderIDProvider.js +403 -0
  878. package/dist/contexts/ThunderID/ThunderIDProvider.js.map +1 -0
  879. package/dist/contexts/ThunderID/useThunderID.js +29 -0
  880. package/dist/contexts/ThunderID/useThunderID.js.map +1 -0
  881. package/dist/contexts/User/UserContext.js +20 -0
  882. package/dist/contexts/User/UserContext.js.map +1 -0
  883. package/dist/contexts/User/UserProvider.js +57 -0
  884. package/dist/contexts/User/UserProvider.js.map +1 -0
  885. package/dist/contexts/User/useUser.js +88 -0
  886. package/dist/contexts/User/useUser.js.map +1 -0
  887. package/dist/hooks/useBranding.d.ts +1 -1
  888. package/dist/hooks/useBranding.js +69 -0
  889. package/dist/hooks/useBranding.js.map +1 -0
  890. package/dist/hooks/useBrowserUrl.js +31 -0
  891. package/dist/hooks/useBrowserUrl.js.map +1 -0
  892. package/dist/hooks/useForm.js +214 -0
  893. package/dist/hooks/useForm.js.map +1 -0
  894. package/dist/hooks/useTranslation.js +76 -0
  895. package/dist/hooks/useTranslation.js.map +1 -0
  896. package/dist/hooks/v2/useOAuthCallback.js +84 -0
  897. package/dist/hooks/v2/useOAuthCallback.js.map +1 -0
  898. package/dist/index.d.ts +4 -1
  899. package/dist/index.d.ts.map +1 -1
  900. package/dist/index.js +123 -19542
  901. package/dist/utils/applyThemeToDOM.js +15 -0
  902. package/dist/utils/applyThemeToDOM.js.map +1 -0
  903. package/dist/utils/getDisplayName.d.ts.map +1 -1
  904. package/dist/utils/getDisplayName.js +50 -0
  905. package/dist/utils/getDisplayName.js.map +1 -0
  906. package/dist/utils/getMappedUserProfileValue.js +59 -0
  907. package/dist/utils/getMappedUserProfileValue.js.map +1 -0
  908. package/dist/utils/normalizeThemeConfig.js +42 -0
  909. package/dist/utils/normalizeThemeConfig.js.map +1 -0
  910. package/dist/utils/oauth.js +26 -0
  911. package/dist/utils/oauth.js.map +1 -0
  912. package/dist/utils/v2/buildThemeConfigFromFlowMeta.js +47 -0
  913. package/dist/utils/v2/buildThemeConfigFromFlowMeta.js.map +1 -0
  914. package/dist/utils/v2/flowTransformer.d.ts +17 -8
  915. package/dist/utils/v2/flowTransformer.d.ts.map +1 -1
  916. package/dist/utils/v2/flowTransformer.js +152 -0
  917. package/dist/utils/v2/flowTransformer.js.map +1 -0
  918. package/dist/utils/v2/getAuthComponentHeadings.d.ts.map +1 -1
  919. package/dist/utils/v2/getAuthComponentHeadings.js +102 -0
  920. package/dist/utils/v2/getAuthComponentHeadings.js.map +1 -0
  921. package/dist/utils/v2/passkey.js +90 -0
  922. package/dist/utils/v2/passkey.js.map +1 -0
  923. package/dist/utils/v2/resolveTranslationsInArray.js +21 -0
  924. package/dist/utils/v2/resolveTranslationsInArray.js.map +1 -0
  925. package/dist/utils/v2/resolveTranslationsInObject.js +31 -0
  926. package/dist/utils/v2/resolveTranslationsInObject.js.map +1 -0
  927. package/package.json +8 -7
  928. package/dist/cjs/index.js +0 -19819
  929. package/dist/cjs/index.js.map +0 -1
  930. package/dist/index.js.map +0 -1
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["ThunderIDContext: Context<ThunderIDContextProps | null>","getAllOrganizations","response: HttpResponse<any>","baseGetAllOrganizations","getMeOrganizations","response: HttpResponse<any>","baseGetMeOrganizations","resolvedOrganizationHandle: string | undefined","isInitialized: boolean","ThunderIDRuntimeError","claims: User","baseUrl: string","getMeOrganizations","getAllOrganizations","idToken: IdToken","sourceInstanceId: number | undefined","exchangeConfig: TokenExchangeRequestConfig","arg1: any","arg2: any","config: ThunderIDReactConfig | undefined","authIdFromUrl: string","authIdFromStorage: string","authId: string","response: EmbeddedSignInFlowResponseV2","decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }","createdAt: number","expiresIn: number","config: ThunderIDReactConfig","firstArg: any","BrandingContext: Context<BrandingContextValue | null>","BrandingProvider: FC<PropsWithChildren<BrandingProviderProps>>","activeThemeFromBranding: string | undefined","extractedActiveTheme: 'light' | 'dark' | null","themeMode: string","fetchBranding: () => Promise<void>","value: any","BrandingContext","ComponentRendererContext: Context<ComponentRendererMap>","ComponentRendererProvider: FC<PropsWithChildren<ComponentRendererProviderProps>>","ComponentRendererContext","FlowContext: Context<FlowContextValue | undefined>","FlowProvider: FC<PropsWithChildren<FlowProviderProps>>","setCurrentStep: (step: FlowStep) => void","addMessage: (message: FlowMessage) => void","messageWithId: FlowMessage","removeMessage: (messageId: string) => void","clearMessages: () => void","reset: () => void","navigateToFlow: (\n flowType: NonNullable<FlowStep>['type'],\n options?: {metadata?: Record<string, any>; subtitle?: string; title?: string},\n ) => void","contextValue: FlowContextValue","FlowContext","FlowMetaContext: Context<FlowMetaContextValue | null>","I18nContext: Context<I18nContextValue | null>","context: I18nContextValue | null","I18nContext","context: ThunderIDContextProps | null","ThunderIDContext","flowMetaContext: FlowMetaContextValue | null","FlowMetaContext","i18nContext: I18nContextValue | null","I18nContext","meta: FlowMetaContextValue['meta']","isMetaLoading: boolean","resolveFlowTemplateLiterals","FlowMetaProvider: FC<PropsWithChildren<FlowMetaProviderProps>>","useThunderID","i18nContext: I18nContextValue","useI18n","lastFetchedRef: RefObject<(() => Promise<void>) | null>","fetchFlowMeta: () => Promise<void>","err: unknown","switchLanguage: (language: string) => Promise<void>","result: FlowMetadataResponse","flatTranslations: Record<string, string>","value","bundle: I18nBundle","metaLanguage: string","bundlesToInject: Record<string, I18nBundle>","value: any","FlowMetaContext","logger: ReturnType<typeof createPackageComponentLogger>","parts: string[]","match: RegExpMatchArray | null","maxAge: number","secure: string","domain: string","I18nProvider: FC<PropsWithChildren<I18nProviderProps>>","defaultBundles: Record<string, I18nBundle>","storageStrategy: I18nStorageStrategy","storageKey: string","urlParamConfig: string | false","resolvedCookieDomain: string | undefined","storage: StorageAdapter","urlLanguage: string | null","storedLanguage: string | null","browserLanguage: string","injectBundles: (newBundles: Record<string, I18nBundle>) => void","merged: Record<string, I18nBundle>","normalizedTranslations: I18nTranslations","mergedBundles: Record<string, I18nBundle>","languageKey: string","fallbackLanguage: string","t: (key: string, params?: Record<string, string | number>) => string","translation: string | undefined","currentBundle: I18nBundle | undefined","fallbackBundle: I18nBundle | undefined","setLanguage: (language: string) => void","contextValue: I18nContextValue","I18nContext","OrganizationContext: Context<OrganizationContextProps | null>","OrganizationContext","OrganizationProvider: FC<PropsWithChildren<OrganizationProviderProps>>","switchOrganization: (organization: Organization) => Promise<void>","ThunderIDRuntimeError","errorMessage: string","contextValue: OrganizationContextProps","getAllOrganizations","createOrganization","OrganizationContext","context: BrandingContextValue | null","BrandingContext","ThemeContext: Context<ThemeContextValue | null>","logger: ReturnType<typeof createPackageComponentLogger>","ThemeProvider: FC<PropsWithChildren<ThemeProviderProps>>","themeConfig: RecursivePartial<ThemeConfig> | undefined","normalizeThemeConfig","brandingTheme: Theme | null","brandingActiveTheme: 'light' | 'dark' | null","brandingError: Error | null","brandingContext: any","useBrandingContext","finalThemeConfig: RecursivePartial<ThemeConfig> | undefined","brandingThemeConfig: RecursivePartial<ThemeConfig>","theme: Theme","direction: string","handleThemeChange: (isDark: boolean) => void","toggleTheme: () => void","observer: MutationObserver | null","mediaQuery: MediaQueryList | null","targetElement: HTMLElement","value: any","ThemeContext","ThemeProvider","scheme: FlowMetaThemeColorScheme | undefined","borderRadius: number | undefined","borderRadiusStr: string | undefined","colors: RecursivePartial<ThemeConfig['colors']> | undefined","bg: RecursivePartial<ThemeConfig['colors']['background']>","ThemeProvider: FC<PropsWithChildren<ThemeProviderProps>>","themeOverride: RecursivePartial<ThemeConfig> | undefined","normalizeThemeConfig","flowMetaContext: FlowMetaContextValue | null","FlowMetaContext","flowMetaTheme: FlowMetaTheme | null","isLoading: boolean","error: Error | null","toggleTheme: () => void","finalThemeConfig: RecursivePartial<ThemeConfig> | undefined","metaConfig: RecursivePartial<ThemeConfig>","buildThemeConfigFromFlowMeta","theme: Theme","direction: 'ltr' | 'rtl'","value: any","ThemeContext","ThemeProvider","ThemeProvider: FC<PropsWithChildren<ThemeProviderProps>>","useThunderID","ThemeProviderV2","V1ThemeProvider","UserContext: Context<UserContextProps | null>","UserProvider: FC<PropsWithChildren<UserProviderProps>>","contextValue: any","UserContext","logger: ReturnType<typeof createPackageComponentLogger>","ThunderIDProvider: FC<PropsWithChildren<ThunderIDProviderProps>>","reRenderCheckRef: RefObject<boolean>","client: ThunderIDReactClient","ThunderIDReactClient","storageManagerRef: any","useBrowserUrl","resolvedBaseUrl: string","decodedToken: IdToken","claims: User","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","fetchBranding: () => Promise<void>","refetchBranding: () => Promise<void>","response: TokenResponse | Response","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","BrandingProvider","ThemeProvider","getActiveTheme","FlowProvider","UserProvider","OrganizationProvider","ComponentRendererProvider","context: UserContextProps | null","UserContext","context: OrganizationContextProps | null","OrganizationContext","context: FlowContextValue | undefined","FlowContext","context: ThemeContextValue | null","ThemeContext","ComponentPreferencesContext: Context<Preferences | undefined>","context: any","I18nContext","contextPreferences: I18nPreferences | undefined","ComponentPreferencesContext","effectivePreferences: I18nPreferences | undefined","mergedBundles: Record<string, I18nBundle>","merged: Record<string, I18nBundle>","normalizedTranslations: I18nTranslations","enhancedT: (key: string, params?: Record<string, string | number>) => string","translation: string | undefined","currentBundle: I18nBundle | undefined","fallbackBundle: I18nBundle | undefined","getFieldConfig: (name: keyof T) => FormField | undefined","validateField: (name: keyof T) => string | null","value: string","fieldConfig: FormField | undefined","fieldError: 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>","logger: ReturnType<typeof createPackageComponentLogger>","useBrandingContext","useStyles","iconSizeMap: Record<string, string>","iconDimension: string","baseButton: string","sizeStyles: Record<string, string>","variantStyles: Record<string, string>","spinnerStyles: string","iconStyles: string","useStyles","spinnerColor: string","spinnerSizes: Record<string, string>","spinnerSize: string","spinner: string","spinnerSmall: string","spinnerMedium: string","Spinner: FC<SpinnerProps>","useTheme","styles: Record<string, string>","useStyles","Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLButtonElement>>","useTheme","styles: Record<string, string>","useStyles","isIconVariant: boolean","spinnerWidth: string","Spinner","BaseSignInButton: ForwardRefExoticComponent<BaseSignInButtonProps & RefAttributes<HTMLButtonElement>>","Button","SignInButton: ForwardRefExoticComponent<SignInButtonProps & RefAttributes<HTMLButtonElement>>","useThunderID","useTranslation","ThunderIDRuntimeError","BaseSignInButton","BaseSignOutButton: ForwardRefExoticComponent<BaseSignOutButtonProps & RefAttributes<HTMLButtonElement>>","Button","SignOutButton: ForwardRefExoticComponent<SignOutButtonProps & RefAttributes<HTMLButtonElement>>","useThunderID","useTranslation","ThunderIDRuntimeError","BaseSignOutButton","BaseSignUpButton: ForwardRefExoticComponent<BaseSignUpButtonProps & RefAttributes<HTMLButtonElement>>","Button","SignUpButton: ForwardRefExoticComponent<SignUpButtonProps & RefAttributes<HTMLButtonElement>>","useThunderID","useTranslation","ThunderIDRuntimeError","BaseSignUpButton","SignedIn: FC<PropsWithChildren<SignedInProps>>","useThunderID","SignedOut: FC<PropsWithChildren<SignedOutProps>>","useThunderID","Loading: FC<PropsWithChildren<LoadingProps>>","useThunderID","OrganizationContextController: FC<OrganizationContextControllerProps>","useThunderID","hasAuthenticatedRef: React.MutableRefObject<boolean>","isAuthenticatingRef: React.MutableRefObject<boolean>","OrganizationContext: FC<PropsWithChildren<OrganizationContextProps>>","useThunderID","ThunderIDProvider","OrganizationContextController","useStyles","containerStyles: string","inputStyles: string","errorInputStyles: string","labelStyles: string","errorLabelStyles: string","requiredStyles: string","useStyles","useStyles","variantStyles: Record<string, string | number>","colorValue: string","typography: string","typographyNoWrap: string","typographyInline: string","typographyGutterBottom: string","typographyH1: string","typographyH2: string","typographyH3: string","typographyH4: string","typographyH5: string","typographyH6: string","typographySubtitle1: string","typographySubtitle2: string","typographyBody1: string","typographyBody2: string","typographyCaption: string","typographyOverline: string","variantMapping: Record<TypographyVariant, ElementType>","Typography: FC<TypographyProps>","useTheme","styles: Record<string, string>","useStyles","Component: ElementType","FormControl: FC<FormControlProps>","useTheme","styles: Record<string, string>","useStyles","Typography","useStyles","baseLabel: string","errorLabel: string","requiredIndicator: string","InputLabel: FC<InputLabelProps>","useTheme","styles: Record<string, string>","useStyles","Checkbox: FC<CheckboxProps>","useTheme","styles: Record<string, string>","useStyles","FormControl","InputLabel","useStyles","inputStyles: string","errorInputStyles: string","disabledInputStyles: string","labelStyles: string","DatePicker: FC<DatePickerProps>","useTheme","styles: Record<string, string>","useStyles","FormControl","InputLabel","useStyles","inputContainer: string","input: string","inputError: string","OtpField: FC<OtpInputProps>","useTheme","styles: Record<string, string>","useStyles","inputRefs: MutableRefObject<HTMLInputElement[]>","newOtp: string[]","newValue: string","otpValue: string","pastedData: string","nextEmptyIndex: number","focusIndex: number","FormControl","InputLabel","useStyles","toggleIcon: string","visibleIcon: string","Eye: FC<SVGProps<SVGSVGElement>>","EyeOff: FC<SVGProps<SVGSVGElement>>","useStyles","inlineStartPadding: string","inlineEndPadding: string","inputContainer: string","input: string","inputError: string","inputDisabled: string","icon: string","startIcon: string","TextField: FC<TextFieldProps>","useTheme","styles: Record<string, string>","useStyles","inputClassName: string","containerClassName: string","startIconClassName: string","endIconClassName: string","FormControl","InputLabel","PasswordField: FC<PasswordFieldProps>","useTheme","styles: Record<string, string>","useStyles","IconComponent: FC<SVGProps<SVGSVGElement>>","EyeOff","Eye","TextField","useStyles","select: string","selectError: string","selectDisabled: string","Select: FC<SelectProps>","useTheme","styles: Record<string, string>","useStyles","selectClassName: string","FormControl","InputLabel","numValue: number","validationError: string | null","commonProps: Record<string, any>","PasswordField","TextField","DatePicker","isChecked: boolean","Checkbox","OtpField","fieldOptions: SelectOption[]","Select","FieldFactory: FC<FieldConfig>","EmailOtp: FC<BaseSignInOptionProps>","useTheme","useTranslation","useFlow","formFields: any","hasOtpField: any","OtpField","Button","IdentifierFirst: FC<BaseSignInOptionProps>","useTheme","useTranslation","useFlow","formFields: any","Button","MultiOptionButton: FC<BaseSignInOptionProps>","useTranslation","getDisplayName","authenticatorName: any","Button","SmsOtp: FC<BaseSignInOptionProps>","useTheme","useTranslation","useFlow","formFields: any","hasOtpField: any","OtpField","Button","SocialLogin: FC<BaseSignInOptionProps & HTMLAttributes<HTMLButtonElement>>","useTranslation","Button","Totp: FC<BaseSignInOptionProps>","useTheme","useTranslation","useFlow","formFields: any","hasTotpField: any","OtpField","Button","UsernamePassword: FC<BaseSignInOptionProps>","useTheme","useTranslation","useFlow","formFields: any","Button","FacebookButton: FC<FacebookButtonProps & HTMLAttributes<HTMLButtonElement>>","useTranslation","Button","GitHubButton: FC<GithubButtonProps & HTMLAttributes<HTMLButtonElement>>","useTranslation","Button","GoogleButton: FC<GoogleButtonProps & HTMLAttributes<HTMLButtonElement>>","useTranslation","Button","LinkedInButton: FC<LinkedInButtonProps & HTMLAttributes<HTMLButtonElement>>","useTranslation","Button","MicrosoftButton: FC<MicrosoftButtonProps & HTMLAttributes<HTMLButtonElement>>","useTranslation","Button","SignInWithEthereumButton: FC<SignInWithEthereumButtonProps & HTMLAttributes<HTMLButtonElement>>","useTranslation","Button","hasParams: any","UsernamePassword","IdentifierFirst","GoogleButton","GitHubButton","MicrosoftButton","FacebookButton","LinkedInButton","SignInWithEthereumButton","EmailOtp","MultiOptionButton","Totp","SmsOtp","SocialButton","useStyles","baseAlert: string","variantStyles: Record<string, string>","iconStyles: string","contentStyles: string","titleStyles: string","CircleAlert: FC<SVGProps<SVGSVGElement>>","CircleCheck: FC<SVGProps<SVGSVGElement>>","Info: FC<SVGProps<SVGSVGElement>>","TriangleAlert: FC<SVGProps<SVGSVGElement>>","CircleCheck","CircleAlert","TriangleAlert","Info","AlertVariantContext: Context<AlertVariant>","Alert: ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>>","useTheme","styles: ReturnType<typeof useStyles>","useStyles","IconComponent: FC<SVGProps<SVGSVGElement>>","AlertTitle: FC<AlertTitleProps>","Typography","AlertDescription: FC<AlertDescriptionProps>","useStyles","baseCard: string","variantStyles: Record<string, string>","clickableStyles: string","headerStyles: string","titleStyles: string","descriptionStyles: string","actionStyles: string","contentStyles: string","footerStyles: string","Card: ForwardRefExoticComponent<CardProps & RefAttributes<HTMLDivElement>>","useTheme","styles: Record<string, string>","useStyles","CardHeader: ForwardRefExoticComponent<CardHeaderProps & RefAttributes<HTMLDivElement>>","CardTitle: FC<CardTitleProps>","Typography","CardDescription: FC<CardDescriptionProps>","CardAction: ForwardRefExoticComponent<CardActionProps & RefAttributes<HTMLDivElement>>","CardContent: ForwardRefExoticComponent<CardContentProps & RefAttributes<HTMLDivElement>>","CardFooter: ForwardRefExoticComponent<CardFooterProps & RefAttributes<HTMLDivElement>>","useStyles","baseColor: string","borderStyle: string","baseDivider: string","verticalDivider: string","Divider: FC<DividerProps>","useTheme","styles: Record<string, string>","useStyles","Typography","useStyles","baseLogo: string","smallLogo: string","mediumLogo: string","largeLogo: string","Logo: FC<LogoProps>","useTheme","styles: Record<string, string>","useStyles","logoConfig: Record<string, string> | undefined","logoSrc: string | undefined","logoAlt: string","logoTitle: string | undefined","useStyles","signIn: string","card: string","logoContainer: string","header: string","title: string","subtitle: string","messagesContainer: string","messageItem: string","errorContainer: string","contentContainer: string","loadingContainer: string","loadingText: string","divider: string","centeredContainer: string","passkeyContainer: string","passkeyText: string","form: string","formDivider: string","authenticatorSection: string","authenticatorItem: string","noAuthenticatorCard: string","errorAlert: string","messagesAlert: string","flowMessagesContainer: string","logger: ReturnType<typeof createPackageComponentLogger>","HIDDEN_AUTHENTICATORS: string[]","BaseSignInContent: FC<BaseSignInProps>","useTheme","useTranslation","useFlow","styles: ReturnType<typeof useStyles>","useStyles","isLoading: boolean","reRenderCheckRef: RefObject<boolean>","setupFormFields: any","initialValues: Record<string, string>","responseAuthenticator: any","redirectUrl: string","popup: Window | null","messageHandler: any","popupMonitor: any","expectedOrigin: string","popupUrl: string","url: URL","code: string | null","state: string | null","submitResponse: any","EmbeddedSignInFlowStatus","response: any","nextStepResponse: any","nextAuthenticator: any","challengeData: any","tokenResponse: any","errorMessage: string","formResponse: any","hasMultipleOptions: any","getAvailableAuthenticators: any","containerClasses: string","inputClasses: string","buttonClasses: string","errorClasses: string","messageClasses: string","authenticator: any","CardPrimitive","Spinner","Typography","availableAuthenticators: EmbeddedSignInFlowAuthenticator[]","userPromptAuthenticators: any[]","optionAuthenticators: any[]","AlertPrimitive","messageVariant: AlertVariant","lowerType: string","Divider","formData: Record<string, string>","BaseSignIn: FC<BaseSignInProps>","Logo","FlowProvider","BaseSignInContent","BaseSignIn","resolved: T","resolveFlowTemplateLiterals","resolved: T","mapping: Map<string, string>","transformedComponent: any","inputData: any","value: string","refMapping: Map<string, string>","actionMapping: Map<string, string>","inputsData: any[]","resolveTranslationsInArray","additionalData: Record<string, any>","parsed: any","useStyles","container: string","node: string","nodeSelected: string","toggleButton: string","togglePlaceholder: string","nodeName: string","useTheme","styles: Record<string, string>","useStyles","loadChildren: (parentId: string, offset?: number) => Promise<void>","response: OrganizationUnitListResponse","offset","newChildren: OrganizationUnit[]","existing: NodeState","mergedChildren: OrganizationUnit[]","newOffset: number","handleToggle: (ouId: string) => void","state: NodeState | undefined","handleLoadMore: (parentId: string) => void","isSelected: boolean","isExpanded: boolean","isLoading: boolean","hasChildren: boolean","rootState: NodeState | undefined","isRootLoading: boolean","useStyles","useStyles","containerStyles: string","inputStyles: string","trackStyles: string","thumbStyles: string","labelStyles: string","errorLabelStyles: string","Toggle: FC<ToggleProps>","useTheme","styles: Record<string, string>","useStyles","FormControl","InputLabel","ConsentCheckboxList: FC<ConsentCheckboxListProps>","useTheme","styles: Record<string, string>","useStyles","attributes: string[]","isEssential: boolean","checked: boolean","Typography","Toggle","Divider","Consent: FC<ConsentProps>","purposes: ConsentPurposeData[]","parsed: ConsentPurposeData[] | {purposes: ConsentPurposeData[]}","Typography","ConsentCheckboxList","FlowTimer: FC<FlowTimerProps>","interval: NodeJS.Timeout","isExpired: boolean","formattedTime: string","Typography","ImageComponent: FC<AdapterProps>","useTheme","config: Record<string, unknown>","src: string","alt: string","width: string","height: string","variant: string","imageStyle: CSSProperties","isEmojiUri","cssWidth: string","cssHeight: string","containerHeight: string","extractEmojiFromUri","SmsOtpButton: FC<SmsOtpButtonProps & HTMLAttributes<HTMLButtonElement>>","useTranslation","Button","useStyles","CopyableText: FC<CopyableTextProps>","useTheme","styles: Record<string, string>","useStyles","useTranslation","handleCopy: ReturnType<typeof useCallback>","textArea: HTMLTextAreaElement","Button","ArrowLeftRight: FC<ArrowLeftRightProps>","ArrowRightLeft: FC<ArrowRightLeftProps>","flowIconRegistry: Record<string, FC<FlowIconProps>>","logger: ReturnType<typeof createPackageComponentLogger>","richTextClass: string","EmbeddedFlowComponentType","providerId: any","providerMatches: any","theme: any","customRenderers: ComponentRendererMap","key: string | number","customRenderer: ComponentRenderer | undefined","resolveFlowTemplateLiterals","identifier: string","value: string","error: string","fieldType: string","actionId: string","eventType: string","buttonText: string","componentVariant: string","shouldSkipValidation: boolean","EmbeddedFlowEventType","formData: Record<string, any>","consentPrompt: ConsentPromptData | undefined","isDeny: boolean","decisions: ConsentDecisions","GoogleButton","GitHubButton","FacebookButton","MicrosoftButton","LinkedInButton","SignInWithEthereumButton","SmsOtpButton","startIconEl: ReactElement | null","endIconEl: ReactElement | null","Button","Typography","Divider","selectOptions: any","Select","rootOuId: string | undefined","OrganizationUnitPicker","formStyles: CSSProperties","blockComponents: any","resolveEmojiUrisInHtml","explicitHeight: string","explicitWidth: string","ImageComponent","iconName: string","IconComponent: any","flowIconRegistry","direction: string","gap: number","align: string","justify: string","consentPromptRawData: ConsentPromptData | string | undefined","Consent","textTemplate: string","timeoutMs: number","FlowTimer","sourceKey: string | undefined","CopyableText","BaseSignInContent: FC<BaseSignInProps>","useThunderID","useTheme","customRenderers: ComponentRendererMap","ComponentRendererContext","useTranslation","useFlow","styles: any","useStyles","isLoading: boolean","handleError: any","errorMessage: string","extractFormFields: (components: EmbeddedFlowComponent[]) => FormField[]","fields: FormField[]","identifier: string","filteredInputs: Record<string, any>","payload: EmbeddedSignInFlowRequest","containerClasses: any","inputClasses: any","buttonClasses: any","messageClasses: any","renderComponents: any","renderProps: BaseSignInRenderProps","result: any","CardPrimitive","Spinner","AlertPrimitive","Typography","BaseSignIn: FC<BaseSignInProps>","content: ReactElement","FlowProvider","ComponentPreferencesContext","BaseSignIn","BaseSignIn: FC<BaseSignInProps>","useThunderID","BaseSignInV2","BaseSignInV1","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","basePath: string","returnPath: string","state: string","redirectUrlObj: URL","ThunderIDRuntimeError","creationOptions: any","publicKey: any","credential: PublicKeyCredential","response: AuthenticatorAttestationResponse","registrationResponse: any","requestOptions: any","response: AuthenticatorAssertionResponse","authenticationResponse: any","SignIn: FC<SignInProps>","useThunderID","useTranslation","challengeTokenRef: any","initializationAttemptedRef: any","oauthCodeProcessedRef: any","passkeyProcessedRef: any","tempData: any","storageManager: any","getUrlParams","urlParams: any","url: any","ThunderIDRuntimeError","redirectURL: any","effectiveApplicationId: any","error: any","response: EmbeddedSignInFlowResponseV2","err: any","errorMessage: any","currentUrlParams: any","timeoutMs: number","remaining: number","errorMessage: string","timerId: any","effectiveExecutionId: any","processedInputs: Record<string, any>","consentPromptRawData: any","purposes: any[]","found: any","submitAction: any","decisions: any","effectiveExecutionIdForPasskey: any","finalRedirectUrl: any","inputs: Record<string, string>","passkeyResponse: any","passkeyResponseObj: any","BaseSignIn","SignIn","SignIn: FC<SignInProps>","useThunderID","url: URL","SignInV2","BaseSignIn","CheckboxInput: FC<AdapterProps>","config: Record<string, unknown>","fieldName: string","value: string | boolean","DateInput: FC<AdapterProps>","config: Record<string, unknown>","fieldName: string","value: string","DividerComponent: FC<AdapterProps>","useTheme","text: string","Divider","EmailInput: FC<AdapterProps>","config: Record<string, unknown>","fieldName: string","value: string","FormContainer: FC<AdapterProps>","handleFormSubmit: (e: FormEvent) => void","submitButton: any","NumberInput: FC<AdapterProps>","config: Record<string, unknown>","fieldName: string","value: string","PasswordInput: FC<AdapterProps>","config: Record<string, unknown>","fieldName: string","value: string","error: string | undefined","validations: {\n conditions?: {key: string; value: string}[];\n name: string;\n }[]","validationHints: string[]","minLength: string | undefined","maxLength: string | undefined","SelectInput: FC<AdapterProps>","config: Record<string, unknown>","fieldName: string","value: string","error: string","options: SelectOption[]","ButtonComponent: FC<AdapterProps>","config: Record<string, unknown>","buttonText: string","buttonType: string","componentVariant: string","Button","Spinner","TelephoneInput: FC<AdapterProps>","config: Record<string, unknown>","fieldName: string","value: string","error: string | undefined","TextField","TextInput: FC<AdapterProps>","config: Record<string, unknown>","fieldName: string","value: string","TypographyComponent: FC<AdapterProps>","useTheme","config: Record<string, unknown>","text: string","variant: string","typographyVariant: any","Typography","EmbeddedFlowComponentType","Typography","inputVariant: string","inputType: string","EmailInput","PasswordInput","TelephoneInput","NumberInput","DateInput","CheckboxInput","TextInput","buttonVariant: string | undefined","buttonText: string","GoogleButton","GitHubButton","MicrosoftButton","FacebookButton","LinkedInButton","SignInWithEthereumButton","ButtonComponent","FormContainer","SelectInput","DividerComponent","ImageComponent","renderSignUpComponents","useStyles","signUp: string","card: string","logoContainer: string","header: string","title: string","subtitle: string","messageItem: string","errorContainer: string","contentContainer: string","loadingContainer: string","loadingText: string","divider: string","centeredContainer: string","passkeyContainer: string","passkeyText: string","form: string","formDivider: string","authenticatorSection: string","authenticatorItem: string","noAuthenticatorCard: string","errorAlert: string","messagesAlert: string","flowMessagesContainer: string","logger: ReturnType<typeof createPackageComponentLogger>","BaseSignUpContent: FC<BaseSignUpProps>","useTheme","useTranslation","useFlow","styles: any","useStyles","handleError: any","errorMessage: string","errorResponse: any","initializationAttemptedRef: any","extractFormFields: any","fields: FormField[]","EmbeddedFlowComponentType","config: any","setupFormFields: any","fields: any","initialValues: Record<string, string>","redirectUrl: any","popup: any","hasProcessedCallback: any","popupMonitor: any","messageHandler: (event: MessageEvent) => Promise<void>","expectedOrigin: any","payload: EmbeddedFlowExecuteRequestPayload","continueResponse: any","popupUrl: any","url: any","code: any","state: any","filteredInputs: Record<string, any>","actionId: string","response: any","containerClasses: any","inputClasses: any","buttonClasses: any","errorClasses: any","messageClasses: any","renderComponents: any","renderSignUpComponents","CardPrimitive","Spinner","AlertPrimitive","Typography","BaseSignUp: FC<BaseSignUpProps>","Logo","FlowProvider","BaseSignUpContent","BaseSignUp","heading: EmbeddedFlowComponent | null","subheading: EmbeddedFlowComponent | null","filteredNestedComponents: EmbeddedFlowComponent[]","headingText: string","subheadingText: string","logger: ReturnType<typeof createPackageComponentLogger>","BaseSignUpContent: FC<BaseSignUpProps>","useTheme","customRenderers: ComponentRendererMap","ComponentRendererContext","useTranslation","useFlow","useThunderID","styles: any","useStyles","challengeTokenRef: any","initializationAttemptedRef: any","passkeyProcessedRef: any","tempData: any","storageManager: any","handleError: any","errorMessage: string","normalizeFlowResponseLocal: any","extractFormFields: any","fields: FormField[]","EmbeddedFlowComponentType","fieldName: any","setupFormFields: any","fields: any","initialValues: Record<string, string>","redirectUrl: any","popup: any","hasProcessedCallback: any","popupMonitor: ReturnType<typeof setInterval> | null","messageHandler: ((event: MessageEvent) => Promise<void>) | null","expectedOrigin: any","payload: EmbeddedFlowExecuteRequestPayload","continueResponse: any","popupUrl: any","url: any","code: any","state: any","filteredInputs: Record<string, any>","response: any","effectiveExecutionIdForPasskey: any","passkeyResponse: any","passkeyResponseObj: any","inputs: any","processedResponse: any","containerClasses: any","inputClasses: any","buttonClasses: any","errorClasses: any","messageClasses: any","renderComponents: any","getUrlParams","urlParams: any","result: any","CardPrimitive","Spinner","AlertPrimitive","getAuthComponentHeadings","Typography","BaseSignUp: FC<BaseSignUpProps>","content: ReactElement","Logo","FlowProvider","ComponentPreferencesContext","BaseSignUp","BaseSignUp: FC<BaseSignUpProps>","useThunderID","BaseSignUpV2","BaseSignUpV1","SignUp: FC<SignUpProps>","useThunderID","BaseSignUp","SignUp","SignUp: FC<SignUpProps>","useThunderID","applicationIdFromUrl: string","effectiveApplicationId: any","oauthRedirectUrl: any","BaseSignUp","SignUp","SignUp: FC<SignUpProps>","useThunderID","SignUpV2","SignUpV1","EmbeddedFlowComponentType","Typography","inputVariant: string","inputType: string","EmailInput","PasswordInput","TelephoneInput","NumberInput","DateInput","CheckboxInput","TextInput","buttonVariant: string | undefined","buttonText: string","GoogleButton","GitHubButton","MicrosoftButton","FacebookButton","LinkedInButton","SignInWithEthereumButton","ButtonComponent","FormContainer","SelectInput","DividerComponent","ImageComponent","renderRecoveryComponents","BaseRecoveryContent: FC<PropsWithChildren<BaseRecoveryProps>>","useTheme","useTranslation","useFlow","styles: any","useStyles","handleError: any","errorMessage: string","errorResponse: any","initializationAttemptedRef: any","extractFormFields: any","fields: FormField[]","EmbeddedFlowComponentType","config: any","setupFormFields: any","fields: any","initialValues: Record<string, string>","handleInputChange: (name: string, value: string) => void","filteredInputs: Record<string, any>","payload: EmbeddedFlowExecuteRequestPayload","response: any","containerClasses: any","inputClasses: any","buttonClasses: any","errorClasses: any","messageClasses: any","renderComponents: any","renderRecoveryComponents","CardPrimitive","Spinner","AlertPrimitive","Typography","BaseRecovery: FC<PropsWithChildren<BaseRecoveryProps>>","Logo","FlowProvider","BaseRecoveryContent","BaseRecovery","BaseRecoveryContent: FC<BaseRecoveryProps>","useTheme","customRenderers: ComponentRendererMap","ComponentRendererContext","useTranslation","useFlow","useThunderID","styles: any","useStyles","initializationAttemptedRef: any","challengeTokenRef: any","handleError: any","errorMessage: string","normalizeFlowResponseLocal: any","extractFormFields: any","fields: FormField[]","EmbeddedFlowComponentType","fieldName: any","setupFormFields: any","fields: any","initialValues: Record<string, string>","filteredInputs: Record<string, any>","payload: EmbeddedFlowExecuteRequestPayload","rawResponse: any","response: any","containerClasses: any","inputClasses: any","buttonClasses: any","errorClasses: any","messageClasses: any","renderComponents: any","result: ReturnType<typeof validateForm>","CardPrimitive","Spinner","AlertPrimitive","getAuthComponentHeadings","Typography","BaseRecovery: FC<BaseRecoveryProps>","content: ReactElement","Logo","FlowProvider","ComponentPreferencesContext","BaseRecovery","BaseRecovery: FC<BaseRecoveryProps>","useThunderID","BaseRecoveryV2","BaseRecoveryV1","Recovery: FC<RecoveryProps>","useThunderID","BaseRecovery","Recovery","Recovery: FC<RecoveryProps>","useThunderID","BaseRecovery","urlParams: URLSearchParams","applicationIdFromUrl: string | null","effectiveApplicationId: string | null","executionId: string | null","tokenValue: string | null","Recovery","Recovery: FC<RecoveryProps>","useThunderID","RecoveryV2","RecoveryV1","useStyles","card: string","header: string","title: string","BaseInviteUser: FC<BaseInviteUserProps>","useThunderID","useTranslation","useTheme","customRenderers: ComponentRendererMap","ComponentRendererContext","styles: any","useStyles","challengeTokenRef: any","initializationAttemptedRef: any","tempData: any","storageManager: any","handleError: any","errorMessage: string","normalizeFlowResponseLocal: any","components","handleInputChange: any","newErrors: any","handleInputBlur: any","validateForm: any","errors: Record<string, string>","value: any","handleSubmit: any","validation: any","touched: Record<string, boolean>","inputs: any","payload: Record<string, any>","response: any","resetFlow: any","components: any","extractHeadings: any","title: string | undefined","subtitle: string | undefined","title","subtitle","filterHeadings: any","renderComponents: any","componentsWithoutHeadings: any","renderProps: BaseInviteUserRenderProps","CardPrimitive","Spinner","AlertPrimitive","Typography","InviteUser: FC<InviteUserProps>","useThunderID","http","BaseInviteUser","useStyles","card: string","header: string","title: string","BaseAcceptInvite: FC<BaseAcceptInviteProps>","useThunderID","useTranslation","useTheme","customRenderers: ComponentRendererMap","ComponentRendererContext","styles: any","useStyles","challengeTokenRef: any","tokenValidationAttemptedRef: any","tempData: any","storageManager: any","handleError: any","errorMessage: string","normalizeFlowResponseLocal: any","components","response: any","handleInputChange: any","newErrors: any","handleInputBlur: any","validateForm: any","errors: Record<string, string>","value: any","handleSubmit: any","validation: any","touched: Record<string, boolean>","inputs: any","payload: Record<string, any>","redirectURL: any","extractHeadings: any","title: string | undefined","subtitle: string | undefined","title","subtitle","filterHeadings: any","components: any","componentsWithoutHeadings: any","renderProps: BaseAcceptInviteRenderProps","CardPrimitive","Spinner","Typography","AlertPrimitive","Button","params: any","AcceptInvite: FC<AcceptInviteProps>","executionId: any","inviteToken: any","apiBaseUrl: any","response: any","errorText: any","BaseAcceptInvite","Callback: FC<CallbackProps>","processingRef: any","navigate","urlParams: URLSearchParams","code: string | null","state: string | null","nonce: string | null","oauthError: string | null","errorDescription: string | null","storedData: string | null","errorMsg: string","params: URLSearchParams","params","errorMessage: string","BaseUser: FC<BaseUserProps>","User: FC<UserProps>","useThunderID","BaseUser","User","BaseOrganization: FC<BaseOrganizationProps>","Organization: FC<OrganizationProps>","useOrganization","BaseOrganization","useStyles","valuePlaceholder: string","editButton: string","fieldInner: string","fieldActions: string","complexTextarea: string","objectKey: string","objectValue: string","root: string","card: string","header: string","profileInfo: string","name: string","profileSummary: string","sectionRow: string","sectionLabel: string","sectionValue: string","infoContainer: string","info: string","field: string","lastField: string","label: string","value: string","popup: string","mapping: string | string[]","foundValue: any","value: any","foundValue: string | undefined","value: any","getMappedUserProfileValue","firstName: any","lastName: any","useStyles","baseAvatar: string","variantStyles: Record<string, string>","imageStyles: string","skeletonStyles: string","Avatar: FC<AvatarProps>","useTheme","hash: number","charCode: number","seed: number","hue1: number","offset","hue2: number","saturation: number","styles: ReturnType<typeof useStyles>","useStyles","isDefaultState: boolean","useStyles","overlay: string","content: string","dropdownContent: string","header: string","headerTitle: string","LogOut: FC<SVGProps<SVGSVGElement>>","Plus: FC<SVGProps<SVGSVGElement>>","User: FC<SVGProps<SVGSVGElement>>","X: FC<SVGProps<SVGSVGElement>>","open: boolean","setOpen: (openVal: boolean) => void","data: UseFloatingReturn","interactions: UseInteractionsReturn","DialogContext: Context<DialogContextType>","context: DialogContextType","dialog: DialogHookReturn","DialogTrigger: ForwardRefExoticComponent<\n HTMLProps<HTMLElement> & DialogTriggerProps & RefAttributes<HTMLElement>\n>","context: DialogHookReturn","childrenRef: Ref<HTMLElement>","ref: ReturnType<typeof useMergeRefs>","DialogContent: ForwardRefExoticComponent<HTMLProps<HTMLDivElement> & RefAttributes<HTMLDivElement>>","useTheme","styles: Record<string, string>","useStyles","DialogHeading: ForwardRefExoticComponent<\n HTMLProps<HTMLHeadingElement> & RefAttributes<HTMLHeadingElement>\n>","id: string","Button","X","DialogDescription: ForwardRefExoticComponent<\n HTMLProps<HTMLParagraphElement> & RefAttributes<HTMLParagraphElement>\n>","DialogClose: ForwardRefExoticComponent<\n ButtonHTMLAttributes<HTMLButtonElement> & DialogCloseProps & RefAttributes<HTMLButtonElement>\n>","childrenRef: Ref<HTMLButtonElement>","useStyles","container: string","inputRow: string","inputWrapper: string","plusIcon: string","listContainer: string","listItem: string","listItemText: string","removeButton: string","MultiInput: FC<MultiInputProps>","useTheme","canAddMore: boolean","canRemove: boolean","styles: Record<string, string>","useStyles","PlusIcon: FC<IconProps>","BinIcon: FC<IconProps>","handleAddValue: ReturnType<typeof useCallback>","handleRemoveValue: ReturnType<typeof useCallback>","renderInputField: ReturnType<typeof useCallback>","commonProps: Record<string, unknown>","DatePicker","Checkbox","TextField","handleInputSubmit: ReturnType<typeof useCallback>","FormControl","InputLabel","fieldsToSkip: string[]","readonlyFields: string[]","BaseUserProfile: FC<BaseUserProfileProps>","useTheme","useTranslation","shouldShowField: any","toggleFieldEdit: any","getFieldPlaceholder: any","fieldLabel: any","formatLabel: any","styles: any","useStyles","ObjectDisplay: FC<{data: unknown}>","keys: any","current: any","i: any","key: any","handleFieldSave: any","fieldName: string","fieldValue: any","payload: Record<string, any>","handleFieldCancel: any","currentUser: any","currentUser","mergedMappings: Record<string, string | string[] | undefined>","label: any","displayValue: string","displayValue","hasValues: any","isEditable: any","isEditable","currentValue: any","fieldValues: string[]","MultiInput","Button","commonProps: any","field: ReactElement","TextField","DatePicker","Checkbox","hasValue: any","isFieldEditing: any","isReadonlyField: any","tempEditedUser: any","containerClasses: any","displayName: any","getDisplayName","profileEntries: any","getMappedUserProfileValue","Typography","Divider","profileContent: any","CardPrimitive","AlertPrimitive","value: any","schemaWithValue: any","DialogPrimitive","updateMeProfile","response: HttpResponse<any>","baseUpdateMeProfile","UserProfile: FC<UserProfileProps>","useThunderID","useUser","useTranslation","updateMeProfile","caughtError: unknown","message: string","BaseUserProfile","useStyles","trigger: string","userName: string","dropdownContent: string","dropdownMenu: string","menuItem: string","menuItemAnchor: string","divider: string","dropdownHeader: string","headerInfo: string","headerName: string","BaseUserDropdown: FC<BaseUserDropdownProps>","useTheme","styles: Record<string, string>","useStyles","mergedMappings: Record<string, string | string[] | undefined>","defaultMenuItems: MenuItem[]","User","LogOut","allMenuItems: MenuItem[]","Button","getMappedUserProfileValue","getDisplayName","Typography","UserDropdown: FC<UserDropdownProps>","useThunderID","renderProps: UserDropdownRenderProps","UserProfile","BaseUserDropdownComponent","useStyles","root: string","trigger: string","triggerLabel: string","content: string","header: string","headerInfo: string","headerName: string","headerMeta: string","headerRole: string","manageButton: string","menu: string","menuItem: string","menuDivider: string","organizationInfo: string","organizationName: string","organizationMeta: string","loadingContainer: string","loadingText: string","errorContainer: string","errorText: string","sectionHeader: string","sectionHeaderContainer: string","Building: FC<BuildingProps>","Check: FC<CheckProps>","ChevronDown: FC<ChevronDownProps>","BaseOrganizationSwitcher: FC<BaseOrganizationSwitcherProps>","useTheme","styles: Record<string, string>","useStyles","useTranslation","isRTL: boolean","switchableOrganizations: Organization[]","defaultRenderOrganization","Typography","Check","defaultRenderLoading","defaultRenderError","Button","Building","ChevronDown","BuildingAlt: FC<BuildingAltProps>","useStyles","root: string","card: string","content: string","form: string","header: string","field: string","fieldGroup: string","textarea: string","textareaError: string","input: string","avatarContainer: string","actions: string","infoContainer: string","value: string","popup: string","logger: ReturnType<typeof createPackageComponentLogger>","BaseCreateOrganization: FC<BaseCreateOrganizationProps>","useTheme","styles: ReturnType<typeof useStyles>","useStyles","useTranslation","errors: Partial<OrganizationFormData>","payload: CreateOrganizationPayload","createOrganizationContent: ReactElement","AlertPrimitive","TextField","FormControl","InputLabel","Button","DialogPrimitive","createOrganization","response: HttpResponse<any>","baseCreateOrganization","CreateOrganization: FC<CreateOrganizationProps>","useThunderID","useOrganization","parentId: string","result: any","createOrganization","useStyles","root: string","header: string","headerInfo: string","title: string","subtitle: string","refreshButton: string","listContainer: string","organizationItem: string","organizationContent: string","organizationInfo: string","organizationName: string","organizationHandle: string","organizationStatus: string","statusText: string","statusTextActive: string","statusTextInactive: string","organizationActions: string","badge: string","badgeSuccess: string","badgeError: string","loadingContainer: string","loadingText: string","errorContainer: string","emptyContainer: string","emptyText: string","loadMoreButton: string","AvatarPrimitive","Typography","Button","Spinner","BaseOrganizationList: FC<BaseOrganizationListProps>","useTheme","styles: ReturnType<typeof useStyles>","useStyles","useTranslation","organizationsWithSwitchAccess: OrganizationWithSwitchAccess[]","renderLoadingWithStyles: () => ReactNode","renderErrorWithStyles: (errorMsg: string) => ReactNode","renderEmptyWithStyles: () => ReactNode","renderLoadMoreWithStyles: (onLoadMore: () => Promise<void>, loadingMore: boolean) => ReactNode","renderOrganizationWithStyles: (org: OrganizationWithSwitchAccess, index: number) => ReactNode","loadingContent: ReactElement","DialogPrimitive","errorContent: ReactElement","emptyContent: ReactElement","organizationListContent: ReactElement","useStyles","cssOrganizationListWrapper: string","OrganizationList: FC<OrganizationListProps>","useTheme","styles: ReturnType<typeof useStyles>","useStyles","useOrganization","getAllOrganizations","BaseOrganizationListComponent","useStyles","useStyles","container: string","label: string","requiredIndicator: string","pairsList: string","pairRow: string","pairInput: string","addRow: string","removeButton: string","addButton: string","helperText: string","emptyState: string","readOnlyPair: string","readOnlyKey: string","readOnlyValue: string","KeyValueInput: FC<KeyValueInputProps>","useTheme","styles: Record<string, string>","useStyles","handleAddPair: ReturnType<typeof useCallback>","newPair: KeyValuePair","updatedPairs: KeyValuePair[]","handleRemovePair: ReturnType<typeof useCallback>","pairToRemove: KeyValuePair","handleUpdatePair: ReturnType<typeof useCallback>","canAddMore: boolean","isAddDisabled: boolean","TextField","X","Plus","BaseOrganizationProfile: FC<BaseOrganizationProfileProps>","useTheme","styles: Record<string, string>","useStyles","toggleFieldEdit: (fieldName: string) => void","getFieldPlaceholder: (fieldKey: string) => string","handleFieldSave: (fieldKey: string) => void","fieldValue: any","handleFieldCancel: (fieldKey: string) => void","value: any","renderedValue: any","commonProps: any","fieldInput: ReactElement","KeyValueInput","TextField","hasValue: boolean","isFieldEditable: boolean","displayValue: string | ReactElement","Button","isFieldEditing: boolean","tempEditedOrganization: any","profileContent: ReactElement","CardPrimitive","DialogPrimitive","getOrganization","response: HttpResponse<any>","baseGetOrganization","updateOrganization","response: HttpResponse<any>","baseUpdateOrganization","logger: ReturnType<typeof createPackageComponentLogger>","OrganizationProfile: FC<OrganizationProfileProps>","useThunderID","useTranslation","getOrganization","updateOrganization","BaseOrganizationProfile","OrganizationSwitcher: FC<OrganizationSwitcherProps>","useThunderID","useOrganization","useTranslation","organizations: Organization[]","currentOrganization: Organization | null","onOrganizationSwitch: (organization: Organization) => Promise<void> | void","defaultMenuItems: {icon?: ReactElement; label: string; onClick: () => void}[]","BuildingAlt","BaseOrganizationSwitcherComponent","OrganizationProfile","OrganizationListComponent","root: string","trigger: string","triggerEmoji: string","triggerLabel: string","content: string","option: string","optionActive: string","optionEmoji: string","optionLabel: string","BaseLanguageSwitcher: FC<BaseLanguageSwitcherProps>","useTheme","styles: Record<string, string>","useStyles","hasMultipleLanguages: boolean","currentOption: LanguageOption | undefined","ChevronDown","Check","context: FlowMetaContextValue | null","FlowMetaContext","LanguageSwitcher: FC<LanguageSwitcherProps>","useFlowMeta","useTranslation","availableLanguageCodes: string[]","effectiveLanguageCodes: string[]","languages: LanguageOption[]","resolveLocaleDisplayName","resolveLocaleEmoji","BaseLanguageSwitcher","getSchemas","response: HttpResponse<any>","baseGetSchemas","getScim2Me","response: HttpResponse<any>","baseGetScim2Me"],"sources":["../src/contexts/ThunderID/ThunderIDContext.ts","../src/hooks/useBrowserUrl.ts","../src/api/getAllOrganizations.ts","../src/api/getMeOrganizations.ts","../src/ThunderIDReactClient.ts","../src/contexts/Branding/BrandingContext.ts","../src/contexts/Branding/BrandingProvider.tsx","../src/contexts/ComponentRenderer/ComponentRendererContext.ts","../src/contexts/ComponentRenderer/ComponentRendererProvider.tsx","../src/contexts/Flow/FlowContext.ts","../src/contexts/Flow/FlowProvider.tsx","../src/contexts/FlowMeta/FlowMetaContext.ts","../src/contexts/I18n/I18nContext.ts","../src/contexts/I18n/useI18n.ts","../src/contexts/ThunderID/useThunderID.ts","../src/contexts/FlowMeta/FlowMetaProvider.tsx","../src/contexts/I18n/I18nProvider.tsx","../src/contexts/Organization/OrganizationContext.ts","../src/contexts/Organization/OrganizationProvider.tsx","../src/utils/applyThemeToDOM.ts","../src/utils/normalizeThemeConfig.ts","../src/contexts/Branding/useBrandingContext.ts","../src/contexts/Theme/ThemeContext.ts","../src/contexts/Theme/v1/ThemeProvider.tsx","../src/utils/v2/buildThemeConfigFromFlowMeta.ts","../src/contexts/Theme/v2/ThemeProvider.tsx","../src/contexts/Theme/ThemeProvider.tsx","../src/contexts/User/UserContext.ts","../src/contexts/User/UserProvider.tsx","../src/contexts/ThunderID/ThunderIDProvider.tsx","../src/contexts/User/useUser.ts","../src/contexts/Organization/useOrganization.ts","../src/contexts/Flow/useFlow.ts","../src/contexts/Theme/useTheme.ts","../src/contexts/I18n/ComponentPreferencesContext.ts","../src/hooks/useTranslation.ts","../src/hooks/useForm.ts","../src/hooks/useBranding.ts","../src/components/primitives/Button/Button.styles.ts","../src/components/primitives/Spinner/Spinner.styles.ts","../src/components/primitives/Spinner/Spinner.tsx","../src/components/primitives/Button/Button.tsx","../src/components/actions/SignInButton/BaseSignInButton.tsx","../src/components/actions/SignInButton/SignInButton.tsx","../src/components/actions/SignOutButton/BaseSignOutButton.tsx","../src/components/actions/SignOutButton/SignOutButton.tsx","../src/components/actions/SignUpButton/BaseSignUpButton.tsx","../src/components/actions/SignUpButton/SignUpButton.tsx","../src/components/control/SignedIn.tsx","../src/components/control/SignedOut.tsx","../src/components/control/Loading.tsx","../src/components/control/OrganizationContext/OrganizationContextController.tsx","../src/components/control/OrganizationContext/OrganizationContext.tsx","../src/components/primitives/Checkbox/Checkbox.styles.ts","../src/components/primitives/FormControl/FormControl.styles.ts","../src/components/primitives/Typography/Typography.styles.ts","../src/components/primitives/Typography/Typography.tsx","../src/components/primitives/FormControl/FormControl.tsx","../src/components/primitives/InputLabel/InputLabel.styles.ts","../src/components/primitives/InputLabel/InputLabel.tsx","../src/components/primitives/Checkbox/Checkbox.tsx","../src/components/primitives/DatePicker/DatePicker.styles.ts","../src/components/primitives/DatePicker/DatePicker.tsx","../src/components/primitives/OtpField/OtpField.styles.ts","../src/components/primitives/OtpField/OtpField.tsx","../src/components/primitives/PasswordField/PasswordField.styles.ts","../src/components/primitives/Icons/Eye.tsx","../src/components/primitives/Icons/EyeOff.tsx","../src/components/primitives/TextField/TextField.styles.ts","../src/components/primitives/TextField/TextField.tsx","../src/components/primitives/PasswordField/PasswordField.tsx","../src/components/primitives/Select/Select.styles.ts","../src/components/primitives/Select/Select.tsx","../src/components/factories/FieldFactory.tsx","../src/components/presentation/auth/SignIn/v1/options/EmailOtp.tsx","../src/components/presentation/auth/SignIn/v1/options/IdentifierFirst.tsx","../src/components/presentation/auth/SignIn/v1/options/MultiOptionButton.tsx","../src/components/presentation/auth/SignIn/v1/options/SmsOtp.tsx","../src/components/presentation/auth/SignIn/v1/options/SocialButton.tsx","../src/components/presentation/auth/SignIn/v1/options/Totp.tsx","../src/components/presentation/auth/SignIn/v1/options/UsernamePassword.tsx","../src/components/adapters/FacebookButton.tsx","../src/components/adapters/GitHubButton.tsx","../src/components/adapters/GoogleButton.tsx","../src/components/adapters/LinkedInButton.tsx","../src/components/adapters/MicrosoftButton.tsx","../src/components/adapters/SignInWithEthereumButton.tsx","../src/components/presentation/auth/SignIn/v1/options/SignInOptionFactory.tsx","../src/components/primitives/Alert/Alert.styles.ts","../src/components/primitives/Icons/CircleAlert.tsx","../src/components/primitives/Icons/CircleCheck.tsx","../src/components/primitives/Icons/Info.tsx","../src/components/primitives/Icons/TriangleAlert.tsx","../src/components/primitives/Alert/Alert.tsx","../src/components/primitives/Card/Card.styles.ts","../src/components/primitives/Card/Card.tsx","../src/components/primitives/Divider/Divider.styles.ts","../src/components/primitives/Divider/Divider.tsx","../src/components/primitives/Logo/Logo.styles.ts","../src/components/primitives/Logo/Logo.tsx","../src/components/presentation/auth/SignIn/BaseSignIn.styles.ts","../src/components/presentation/auth/SignIn/v1/BaseSignIn.tsx","../src/utils/v2/resolveTranslationsInObject.ts","../src/utils/v2/resolveTranslationsInArray.ts","../src/utils/v2/flowTransformer.ts","../src/components/presentation/auth/OrganizationUnitPicker/v2/OrganizationUnitPicker.styles.ts","../src/components/presentation/auth/OrganizationUnitPicker/v2/OrganizationUnitPicker.tsx","../src/components/adapters/ConsentCheckboxList.styles.ts","../src/components/primitives/Toggle/Toggle.styles.ts","../src/components/primitives/Toggle/Toggle.tsx","../src/components/adapters/ConsentCheckboxList.tsx","../src/components/adapters/Consent.tsx","../src/components/adapters/FlowTimer.tsx","../src/components/adapters/ImageComponent.tsx","../src/components/adapters/SmsOtpButton.tsx","../src/components/primitives/CopyableText/CopyableText.styles.ts","../src/components/primitives/CopyableText/CopyableText.tsx","../src/components/primitives/Icons/ArrowLeftRight.tsx","../src/components/primitives/Icons/ArrowRightLeft.tsx","../src/components/primitives/Icons/flowIconRegistry.tsx","../src/components/presentation/auth/AuthOptionFactory.tsx","../src/components/presentation/auth/SignIn/v2/BaseSignIn.tsx","../src/components/presentation/auth/SignIn/BaseSignIn.tsx","../src/hooks/v2/useOAuthCallback.ts","../src/utils/oauth.ts","../src/utils/v2/passkey.ts","../src/components/presentation/auth/SignIn/v2/SignIn.tsx","../src/components/presentation/auth/SignIn/SignIn.tsx","../src/components/adapters/CheckboxInput.tsx","../src/components/adapters/DateInput.tsx","../src/components/adapters/DividerComponent.tsx","../src/components/adapters/EmailInput.tsx","../src/components/adapters/FormContainer.tsx","../src/components/adapters/NumberInput.tsx","../src/components/adapters/PasswordInput.tsx","../src/components/adapters/SelectInput.tsx","../src/components/adapters/SubmitButton.tsx","../src/components/adapters/TelephoneInput.tsx","../src/components/adapters/TextInput.tsx","../src/components/adapters/Typography.tsx","../src/components/presentation/auth/SignUp/v1/SignUpOptionFactory.tsx","../src/components/presentation/auth/SignUp/BaseSignUp.styles.ts","../src/components/presentation/auth/SignUp/v1/BaseSignUp.tsx","../src/utils/v2/getAuthComponentHeadings.ts","../src/components/presentation/auth/SignUp/v2/BaseSignUp.tsx","../src/components/presentation/auth/SignUp/BaseSignUp.tsx","../src/components/presentation/auth/SignUp/v1/SignUp.tsx","../src/components/presentation/auth/SignUp/v2/SignUp.tsx","../src/components/presentation/auth/SignUp/SignUp.tsx","../src/components/presentation/auth/Recovery/v1/RecoveryOptionFactory.tsx","../src/components/presentation/auth/Recovery/v1/BaseRecovery.tsx","../src/components/presentation/auth/Recovery/v2/BaseRecovery.tsx","../src/components/presentation/auth/Recovery/BaseRecovery.tsx","../src/components/presentation/auth/Recovery/v1/Recovery.tsx","../src/components/presentation/auth/Recovery/v2/Recovery.tsx","../src/components/presentation/auth/Recovery/Recovery.tsx","../src/components/presentation/auth/InviteUser/v2/BaseInviteUser.styles.ts","../src/components/presentation/auth/InviteUser/v2/BaseInviteUser.tsx","../src/components/presentation/auth/InviteUser/v2/InviteUser.tsx","../src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.styles.ts","../src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.tsx","../src/components/presentation/auth/AcceptInvite/v2/AcceptInvite.tsx","../src/components/auth/Callback/Callback.tsx","../src/components/presentation/User/BaseUser.tsx","../src/components/presentation/User/User.tsx","../src/components/presentation/Organization/BaseOrganization.tsx","../src/components/presentation/Organization/Organization.tsx","../src/components/presentation/UserProfile/BaseUserProfile.styles.ts","../src/utils/getMappedUserProfileValue.ts","../src/utils/getDisplayName.ts","../src/components/primitives/Avatar/Avatar.styles.ts","../src/components/primitives/Avatar/Avatar.tsx","../src/components/primitives/Dialog/Dialog.styles.ts","../src/components/primitives/Icons/LogOut.tsx","../src/components/primitives/Icons/Plus.tsx","../src/components/primitives/Icons/User.tsx","../src/components/primitives/Icons/X.tsx","../src/components/primitives/Dialog/Dialog.tsx","../src/components/primitives/MultiInput/MultiInput.styles.ts","../src/components/primitives/MultiInput/MultiInput.tsx","../src/components/presentation/UserProfile/BaseUserProfile.tsx","../src/api/updateMeProfile.ts","../src/components/presentation/UserProfile/UserProfile.tsx","../src/components/presentation/UserDropdown/BaseUserDropdown.styles.ts","../src/components/presentation/UserDropdown/BaseUserDropdown.tsx","../src/components/presentation/UserDropdown/UserDropdown.tsx","../src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.styles.ts","../src/components/primitives/Icons/Building.tsx","../src/components/primitives/Icons/Check.tsx","../src/components/primitives/Icons/ChevronDown.tsx","../src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx","../src/components/primitives/Icons/BuildingAlt.tsx","../src/components/presentation/CreateOrganization/BaseCreateOrganization.styles.ts","../src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx","../src/api/createOrganization.ts","../src/components/presentation/CreateOrganization/CreateOrganization.tsx","../src/components/presentation/OrganizationList/BaseOrganizationList.styles.ts","../src/components/presentation/OrganizationList/BaseOrganizationList.tsx","../src/components/presentation/OrganizationList/OrganizationList.styles.ts","../src/components/presentation/OrganizationList/OrganizationList.tsx","../src/components/presentation/OrganizationProfile/BaseOrganizationProfile.styles.ts","../src/components/primitives/KeyValueInput/KeyValueInput.styles.ts","../src/components/primitives/KeyValueInput/KeyValueInput.tsx","../src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx","../src/api/getOrganization.ts","../src/api/updateOrganization.ts","../src/components/presentation/OrganizationProfile/OrganizationProfile.tsx","../src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx","../src/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.ts","../src/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.tsx","../src/contexts/FlowMeta/useFlowMeta.ts","../src/components/presentation/LanguageSwitcher/LanguageSwitcher.tsx","../src/api/getSchemas.ts","../src/api/getScim2Me.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 Organization,\n Platform,\n SignInOptions,\n TokenExchangeRequestConfig,\n TokenResponse,\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 * 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 organization: Organization;\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 * 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 platform?: Platform;\n} & Pick<ThunderIDReactConfig, 'storage'> &\n Pick<ThunderIDReactClient, 'clearSession' | 'switchOrganization'>;\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 discovery: {\n wellKnown: null,\n },\n exchangeToken: null,\n getAccessToken: null,\n getDecodedIdToken: null,\n getIdToken: null,\n getStorageManager: () => Promise.resolve(null),\n http: {\n request: () => null,\n requestAll: () => null,\n },\n instanceId: 0,\n isInitialized: false,\n isLoading: true,\n isMetaLoading: false,\n isSignedIn: false,\n meta: null,\n organization: null,\n organizationHandle: undefined,\n platform: undefined,\n reInitialize: null,\n recover: () => Promise.resolve({} as any),\n resolveFlowTemplateLiterals: (text: string | undefined) => text ?? '',\n signIn: () => Promise.resolve({} as any),\n signInOptions: {},\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 storage: 'sessionStorage',\n switchOrganization: null,\n user: null,\n});\n\nThunderIDContext.displayName = 'ThunderIDContext';\n\nexport default ThunderIDContext;\n","/**\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","/**\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 HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n getAllOrganizations as baseGetAllOrganizations,\n GetAllOrganizationsConfig as BaseGetAllOrganizationsConfig,\n AllOrganizationsApiResponse,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the getAllOrganizations request (React-specific)\n */\nexport interface GetAllOrganizationsConfig extends Omit<BaseGetAllOrganizationsConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Retrieves all organizations with pagination support.\n * This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.\n *\n * @param config - Configuration object containing baseUrl, optional query parameters, and request config.\n * @returns A promise that resolves with the paginated organizations information.\n * @example\n * ```typescript\n * // Using default ThunderID SPA client httpClient\n * try {\n * const response = await getAllOrganizations({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * filter: \"\",\n * limit: 10,\n * recursive: false\n * });\n * console.log(response.organizations);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get organizations:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher\n * try {\n * const response = await getAllOrganizations({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * filter: \"\",\n * limit: 10,\n * recursive: false,\n * fetcher: customFetchFunction\n * });\n * console.log(response.organizations);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get organizations:', error.message);\n * }\n * }\n * ```\n */\nconst getAllOrganizations = async ({\n fetcher,\n instanceId = 0,\n ...requestConfig\n}: GetAllOrganizationsConfig): Promise<AllOrganizationsApiResponse> => {\n const defaultFetcher = async (url: string, config: RequestInit): Promise<Response> => {\n const httpClient: FetchHttpClient = FetchHttpClient.getInstance(instanceId);\n const response: HttpResponse<any> = await httpClient.request({\n headers: config.headers as Record<string, string>,\n method: config.method || 'GET',\n url,\n } as HttpRequestConfig);\n\n return {\n json: () => Promise.resolve(response.data),\n ok: response.status >= 200 && response.status < 300,\n status: response.status,\n statusText: response.statusText || '',\n text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data)),\n } as Response;\n };\n\n return baseGetAllOrganizations({\n ...requestConfig,\n fetcher: fetcher || defaultFetcher,\n });\n};\n\nexport default getAllOrganizations;\n","/**\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 Organization,\n HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n getMeOrganizations as baseGetMeOrganizations,\n GetMeOrganizationsConfig as BaseGetMeOrganizationsConfig,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the getMeOrganizations request (React-specific)\n */\nexport interface GetMeOrganizationsConfig extends Omit<BaseGetMeOrganizationsConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Retrieves the organizations associated with the current user.\n * This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.\n *\n * @param config - Configuration object containing baseUrl, optional query parameters, and request config.\n * @returns A promise that resolves with the organizations information.\n * @example\n * ```typescript\n * // Using default ThunderID SPA client httpClient\n * try {\n * const organizations = await getMeOrganizations({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * after: \"\",\n * before: \"\",\n * filter: \"\",\n * limit: 10,\n * recursive: false\n * });\n * console.log(organizations);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get organizations:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher\n * try {\n * const organizations = await getMeOrganizations({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * after: \"\",\n * before: \"\",\n * filter: \"\",\n * limit: 10,\n * recursive: false,\n * fetcher: customFetchFunction\n * });\n * console.log(organizations);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get organizations:', error.message);\n * }\n * }\n * ```\n */\nconst getMeOrganizations = async ({\n fetcher,\n instanceId = 0,\n ...requestConfig\n}: GetMeOrganizationsConfig): Promise<Organization[]> => {\n const defaultFetcher = async (url: string, config: RequestInit): Promise<Response> => {\n const httpClient: FetchHttpClient = FetchHttpClient.getInstance(instanceId);\n const response: HttpResponse<any> = await httpClient.request({\n headers: config.headers as Record<string, string>,\n method: config.method || 'GET',\n url,\n } as HttpRequestConfig);\n\n return {\n json: () => Promise.resolve(response.data),\n ok: response.status >= 200 && response.status < 300,\n status: response.status,\n statusText: response.statusText || '',\n text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data)),\n } as Response;\n };\n\n return baseGetMeOrganizations({\n ...requestConfig,\n fetcher: fetcher || defaultFetcher,\n });\n};\n\nexport default getMeOrganizations;\n","/**\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 ThunderIDBrowserClient,\n UserProfile,\n SignInOptions,\n User,\n EmbeddedFlowExecuteResponse,\n SignUpOptions,\n EmbeddedFlowExecuteRequestPayload,\n ThunderIDRuntimeError,\n EmbeddedSignInFlowHandleRequestPayload,\n executeEmbeddedSignInFlowV2,\n Organization,\n IdToken,\n deriveOrganizationHandleFromBaseUrl,\n AllOrganizationsApiResponse,\n extractUserClaimsFromIdToken,\n TokenResponse,\n HttpRequestConfig,\n HttpResponse,\n TokenExchangeRequestConfig,\n isEmpty,\n EmbeddedSignInFlowResponseV2,\n executeEmbeddedSignUpFlowV2,\n executeEmbeddedRecoveryFlowV2,\n EmbeddedSignInFlowStatusV2,\n} from '@thunderid/browser';\nimport getAllOrganizations from './api/getAllOrganizations';\nimport getMeOrganizations from './api/getMeOrganizations';\nimport {ThunderIDReactConfig} from './models/config';\n\nclass ThunderIDReactClient<T extends ThunderIDReactConfig = ThunderIDReactConfig> extends ThunderIDBrowserClient<T> {\n private loadingState = false;\n\n private _initializeConfig: ThunderIDReactConfig | undefined;\n\n constructor(instanceId = 0) {\n super(instanceId);\n }\n\n private setLoading(loading: boolean): void {\n this.loadingState = loading;\n }\n\n private async withLoading<TResult>(operation: () => Promise<TResult>): Promise<TResult> {\n this.setLoading(true);\n try {\n const result: TResult = await operation();\n return result;\n } finally {\n this.setLoading(false);\n }\n }\n\n override initialize(config: ThunderIDReactConfig): Promise<boolean> {\n let resolvedOrganizationHandle: string | undefined = config?.organizationHandle;\n\n if (!resolvedOrganizationHandle) {\n resolvedOrganizationHandle = deriveOrganizationHandleFromBaseUrl(config?.baseUrl);\n }\n\n return this.withLoading(async () => {\n this._initializeConfig = {\n ...config,\n organizationHandle: resolvedOrganizationHandle,\n periodicTokenRefresh:\n config?.tokenLifecycle?.refreshToken?.autoRefresh ?? (config as any)?.periodicTokenRefresh,\n } as any;\n\n return super.initialize(this._initializeConfig as unknown as T);\n });\n }\n\n override reInitialize(config: Partial<ThunderIDReactConfig>): Promise<boolean> {\n return this.withLoading(async () => {\n let isInitialized: boolean;\n\n try {\n await super.reInitialize(config as Partial<T>);\n isInitialized = true;\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Failed to check if the client is initialized: ${error instanceof Error ? error.message : String(error)}`,\n 'ThunderIDReactClient-reInitialize-RuntimeError-001',\n 'react',\n 'An error occurred while checking the initialization status of the client.',\n );\n }\n\n return isInitialized;\n });\n }\n\n override async updateUserProfile(): Promise<User> {\n throw new Error('Not implemented');\n }\n\n override async getUser(): Promise<User> {\n return extractUserClaimsFromIdToken(await this.getDecodedIdToken());\n }\n\n override async getDecodedIdToken(sessionId?: string): Promise<IdToken> {\n return super.getDecodedIdToken(sessionId) as Promise<IdToken>;\n }\n\n override async getIdToken(): Promise<string> {\n return this.withLoading(async () => super.getIdToken() as Promise<string>);\n }\n\n override async getUserProfile(): Promise<UserProfile> {\n return this.withLoading(async () => {\n const claims: User = extractUserClaimsFromIdToken(await this.getDecodedIdToken());\n return {\n flattenedProfile: claims,\n profile: claims,\n schemas: [],\n };\n });\n }\n\n override async getMyOrganizations(options?: any): Promise<Organization[]> {\n try {\n let baseUrl: string = options?.baseUrl;\n\n if (!baseUrl) {\n const configData: any = await (this.getStorageManager() as any).getConfigData();\n baseUrl = configData?.baseUrl;\n }\n\n return await getMeOrganizations({baseUrl, instanceId: this.getInstanceId()});\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Failed to fetch the user's associated organizations: ${\n error instanceof Error ? error.message : String(error)\n }`,\n 'ThunderIDReactClient-getMyOrganizations-RuntimeError-001',\n 'react',\n 'An error occurred while fetching associated organizations of the signed-in user.',\n );\n }\n }\n\n override async getAllOrganizations(options?: any): Promise<AllOrganizationsApiResponse> {\n try {\n let baseUrl: string = options?.baseUrl;\n\n if (!baseUrl) {\n const configData: any = await (this.getStorageManager() as any).getConfigData();\n baseUrl = configData?.baseUrl;\n }\n\n return await getAllOrganizations({baseUrl, instanceId: this.getInstanceId()});\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Failed to fetch all organizations: ${error instanceof Error ? error.message : String(error)}`,\n 'ThunderIDReactClient-getAllOrganizations-RuntimeError-001',\n 'react',\n 'An error occurred while fetching all the organizations associated with the user.',\n );\n }\n }\n\n override async getCurrentOrganization(): Promise<Organization | null> {\n try {\n return await this.withLoading(async () => {\n const idToken: IdToken = await this.getDecodedIdToken();\n return {\n id: idToken?.org_id,\n name: idToken?.org_name,\n orgHandle: idToken?.org_handle,\n };\n });\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Failed to fetch the current organization: ${error instanceof Error ? error.message : String(error)}`,\n 'ThunderIDReactClient-getCurrentOrganization-RuntimeError-001',\n 'react',\n 'An error occurred while fetching the current organization of the signed-in user.',\n );\n }\n }\n\n override async switchOrganization(organization: Organization): Promise<TokenResponse | Response> {\n return this.withLoading(async () => {\n try {\n const configData: any = await (this.getStorageManager() as any).getConfigData();\n const sourceInstanceId: number | undefined = configData?.organizationChain?.sourceInstanceId;\n\n if (!organization.id) {\n throw new ThunderIDRuntimeError(\n 'Organization ID is required for switching organizations',\n 'react-ThunderIDReactClient-SwitchOrganizationError-001',\n 'react',\n 'The organization object must contain a valid ID to perform the organization switch.',\n );\n }\n\n const exchangeConfig: TokenExchangeRequestConfig = {\n attachToken: false,\n data: {\n client_id: '{{clientId}}',\n grant_type: 'organization_switch',\n scope: '{{scopes}}',\n switching_organization: organization.id,\n token: '{{accessToken}}',\n },\n id: 'organization-switch',\n returnsSession: true,\n signInRequired: sourceInstanceId === undefined,\n };\n\n return (await super.exchangeToken(exchangeConfig)) as TokenResponse | Response;\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Failed to switch organization: ${error.message || error}`,\n 'react-ThunderIDReactClient-SwitchOrganizationError-003',\n 'react',\n 'An error occurred while switching to the specified organization. Please try again.',\n );\n }\n });\n }\n\n override isLoading(): boolean {\n return this.loadingState;\n }\n\n override async isSignedIn(): Promise<boolean> {\n return super.isSignedIn() as Promise<boolean>;\n }\n\n override async exchangeToken(config: TokenExchangeRequestConfig): Promise<TokenResponse | Response> {\n return this.withLoading(\n async () => super.exchangeToken(config) as unknown as TokenResponse | Response,\n );\n }\n\n override async signIn(...args: any[]): Promise<User | EmbeddedSignInFlowResponseV2> {\n return this.withLoading(async () => {\n const arg1: any = args[0];\n const arg2: any = args[1];\n\n const config: ThunderIDReactConfig | undefined = (await (this.getStorageManager() as any).getConfigData()) as\n | ThunderIDReactConfig\n | undefined;\n\n // NOTE: With React 19 strict mode, the initialization logic runs twice, and there's an intermittent\n // issue where the config object is not getting stored in the storage layer with Vite scaffolding.\n // Hence, we need to check if the client is initialized but the config object is empty, and reinitialize.\n // Tracker: https://github.com/asgardeo/asgardeo-auth-react-sdk/issues/240\n if (!config || Object.keys(config).length === 0) {\n await this.initialize(this._initializeConfig);\n }\n\n if (typeof arg1 === 'object' && arg1 !== null && arg1.callOnlyOnRedirect === true) {\n return undefined as any;\n }\n\n if (\n typeof arg1 === 'object' &&\n arg1 !== null &&\n !isEmpty(arg1) &&\n ('executionId' in arg1 || 'applicationId' in arg1)\n ) {\n const authIdFromUrl: string = new URL(window.location.href).searchParams.get('authId');\n const authIdFromStorage: string = sessionStorage.getItem('thunderid_auth_id');\n const authId: string = authIdFromUrl || authIdFromStorage;\n const baseUrl: string = config?.baseUrl;\n\n const response: EmbeddedSignInFlowResponseV2 = await executeEmbeddedSignInFlowV2({\n authId,\n baseUrl,\n payload: arg1 as EmbeddedSignInFlowHandleRequestPayload,\n url: arg2?.url,\n });\n\n if (\n response &&\n typeof response === 'object' &&\n response.flowStatus === EmbeddedSignInFlowStatusV2.Complete &&\n response.assertion\n ) {\n const decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n } = await this.decodeJwtToken<{\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }>(response.assertion);\n\n const createdAt: number = decodedAssertion.iat ? decodedAssertion.iat * 1000 : Date.now();\n const expiresIn: number =\n decodedAssertion.exp && decodedAssertion.iat ? decodedAssertion.exp - decodedAssertion.iat : 3600;\n\n await this.setSession({\n access_token: response.assertion,\n created_at: createdAt,\n expires_in: expiresIn,\n id_token: response.assertion,\n scope: decodedAssertion.scope,\n token_type: 'Bearer',\n });\n\n this.notifySignIn(extractUserClaimsFromIdToken(decodedAssertion as IdToken) as User);\n }\n\n return response;\n }\n\n return (await super.signIn(arg1)) as unknown as User;\n });\n }\n\n override async signInSilently(options?: SignInOptions): Promise<User | boolean> {\n return super.signInSilently(options as Record<string, string | boolean>) as Promise<User | boolean>;\n }\n\n override async signUp(options?: SignUpOptions): Promise<void>;\n override async signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;\n override async signUp(...args: any[]): Promise<void | EmbeddedFlowExecuteResponse> {\n const config: ThunderIDReactConfig = (await (this.getStorageManager() as any).getConfigData()) as ThunderIDReactConfig;\n const firstArg: any = args[0];\n const baseUrl: string = config?.baseUrl;\n\n const authIdFromUrl: string = new URL(window.location.href).searchParams.get('authId');\n const authIdFromStorage: string = sessionStorage.getItem('thunderid_auth_id');\n const authId: string = authIdFromUrl || authIdFromStorage;\n\n if (authIdFromUrl && !authIdFromStorage) {\n sessionStorage.setItem('thunderid_auth_id', authIdFromUrl);\n }\n\n return executeEmbeddedSignUpFlowV2({\n authId,\n baseUrl,\n payload:\n typeof firstArg === 'object' && 'flowType' in firstArg\n ? {...(firstArg as EmbeddedFlowExecuteRequestPayload), verbose: true}\n : (firstArg as EmbeddedFlowExecuteRequestPayload),\n }) as any;\n }\n\n override async recover(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse> {\n const config: ThunderIDReactConfig = (await (this.getStorageManager() as any).getConfigData()) as ThunderIDReactConfig;\n\n return executeEmbeddedRecoveryFlowV2({\n baseUrl: config?.baseUrl,\n payload: {...payload, verbose: true},\n }) as any;\n }\n\n public override getStorageManager(): any {\n return super.getStorageManager();\n }\n\n async request(requestConfig?: HttpRequestConfig): Promise<HttpResponse<any>> {\n return super.httpRequest(requestConfig);\n }\n\n async requestAll(requestConfigs?: HttpRequestConfig[]): Promise<HttpResponse<any>[]> {\n return super.httpRequestAll(requestConfigs) as Promise<HttpResponse<any>[]>;\n }\n}\n\nexport default ThunderIDReactClient;\n","/**\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 {BrandingPreference, Theme} from '@thunderid/browser';\nimport {Context, createContext} from 'react';\n\nexport interface BrandingContextValue {\n /**\n * The active theme mode from branding preference ('light' | 'dark')\n */\n activeTheme: 'light' | 'dark' | null;\n /**\n * The raw branding preference data\n */\n brandingPreference: BrandingPreference | null;\n /**\n * Error state\n */\n error: Error | null;\n /**\n * Function to manually fetch branding preference\n */\n fetchBranding: () => Promise<void>;\n /**\n * Loading state\n */\n isLoading: boolean;\n /**\n * Function to refetch branding preference\n * This bypasses the single-call restriction and forces a new API call\n */\n refetch: () => Promise<void>;\n /**\n * The transformed theme object\n */\n theme: Theme | null;\n}\n\nconst BrandingContext: Context<BrandingContextValue | null> = createContext<BrandingContextValue | null>(null);\n\nBrandingContext.displayName = 'BrandingContext';\n\nexport default BrandingContext;\n","/**\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 {BrandingPreference, Theme, transformBrandingPreferenceToTheme} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, useCallback, useEffect, useState} from 'react';\nimport BrandingContext from './BrandingContext';\n\n/**\n * Configuration options for the BrandingProvider\n */\nexport interface BrandingProviderProps {\n /**\n * The branding preference data passed from parent (typically ThunderIDProvider)\n */\n brandingPreference?: BrandingPreference | null;\n /**\n * Whether the branding provider is enabled\n * @default true\n */\n enabled?: boolean;\n /**\n * Error state passed from parent\n */\n error?: Error | null;\n /**\n * Force a specific theme ('light' or 'dark')\n * If not provided, will use the activeTheme from branding preference\n */\n forceTheme?: 'light' | 'dark';\n /**\n * Loading state passed from parent\n */\n isLoading?: boolean;\n /**\n * Function to refetch branding preference passed from parent\n */\n refetch?: () => Promise<void>;\n}\n\n/**\n * BrandingProvider component that manages branding state and provides branding context to child components.\n *\n * This provider receives branding preferences from a parent component (typically ThunderIDProvider)\n * and transforms them into theme objects, making them available to all child components.\n *\n * Features:\n * - Receives branding preferences as props\n * - Theme transformation from branding preferences\n * - Loading and error states\n * - Support for custom theme forcing\n *\n * @example\n * Basic usage (typically used within ThunderIDProvider):\n * ```tsx\n * <BrandingProvider\n * brandingPreference={brandingData}\n * isLoading={isFetching}\n * error={fetchError}\n * >\n * <App />\n * </BrandingProvider>\n * ```\n *\n * @example\n * With custom theme forcing:\n * ```tsx\n * <BrandingProvider\n * brandingPreference={brandingData}\n * forceTheme=\"dark\"\n * enabled={true}\n * >\n * <App />\n * </BrandingProvider>\n * ```\n */\nconst BrandingProvider: FC<PropsWithChildren<BrandingProviderProps>> = ({\n children,\n brandingPreference: externalBrandingPreference,\n forceTheme,\n enabled = true,\n isLoading: externalIsLoading = false,\n error: externalError = null,\n refetch: externalRefetch,\n}: PropsWithChildren<BrandingProviderProps>): ReactElement => {\n const [theme, setTheme] = useState<Theme | null>(null);\n const [activeTheme, setActiveTheme] = useState<'light' | 'dark' | null>(null);\n\n // Process branding preference when it changes\n useEffect(() => {\n if (!enabled || !externalBrandingPreference) {\n setTheme(null);\n setActiveTheme(null);\n return;\n }\n\n // Extract active theme from branding preference\n const activeThemeFromBranding: string | undefined = externalBrandingPreference?.preference?.theme?.activeTheme;\n let extractedActiveTheme: 'light' | 'dark' | null = null;\n\n if (activeThemeFromBranding) {\n // Convert to lowercase and map to our expected values\n const themeMode: string = activeThemeFromBranding.toLowerCase();\n if (themeMode === 'light' || themeMode === 'dark') {\n extractedActiveTheme = themeMode;\n }\n }\n\n setActiveTheme(extractedActiveTheme);\n\n // Transform branding preference to theme\n const transformedTheme: Theme | null = transformBrandingPreferenceToTheme(externalBrandingPreference, forceTheme);\n setTheme(transformedTheme);\n }, [externalBrandingPreference, forceTheme, enabled]);\n\n // Reset state when disabled\n useEffect(() => {\n if (!enabled) {\n setTheme(null);\n setActiveTheme(null);\n }\n }, [enabled]);\n\n // Dummy fetchBranding for backward compatibility\n const fetchBranding: () => Promise<void> = useCallback(async (): Promise<void> => {\n if (externalRefetch) {\n await externalRefetch();\n }\n }, [externalRefetch]);\n\n const value: any = {\n activeTheme,\n brandingPreference: externalBrandingPreference || null,\n error: externalError,\n fetchBranding,\n isLoading: externalIsLoading,\n refetch: externalRefetch || fetchBranding,\n theme,\n };\n\n return <BrandingContext.Provider value={value}>{children}</BrandingContext.Provider>;\n};\n\nexport default BrandingProvider;\n","/**\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 {EmbeddedFlowComponentV2 as EmbeddedFlowComponent, FlowMetadataResponse} from '@thunderid/browser';\nimport {Context, createContext, ReactElement} from 'react';\n\nexport interface ComponentRenderContext {\n additionalData?: Record<string, any>;\n authType: 'signin' | 'signup' | 'recovery';\n formErrors: Record<string, string>;\n formValues: Record<string, string>;\n isFormValid: boolean;\n isLoading: boolean;\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onInputChange: (name: string, value: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n touchedFields: Record<string, boolean>;\n}\n\nexport type ComponentRenderer = (\n component: EmbeddedFlowComponent,\n context: ComponentRenderContext,\n) => ReactElement | null;\n\nexport type ComponentRendererMap = Record<string, ComponentRenderer>;\n\nconst ComponentRendererContext: Context<ComponentRendererMap> = createContext<ComponentRendererMap>({});\n\nexport default ComponentRendererContext;\n","/**\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 {FC, PropsWithChildren, ReactElement} from 'react';\nimport ComponentRendererContext, {ComponentRendererMap} from './ComponentRendererContext';\n\ninterface ComponentRendererProviderProps {\n renderers: ComponentRendererMap;\n}\n\nconst ComponentRendererProvider: FC<PropsWithChildren<ComponentRendererProviderProps>> = ({\n renderers,\n children,\n}: PropsWithChildren<ComponentRendererProviderProps>): ReactElement => (\n <ComponentRendererContext.Provider value={renderers}>{children}</ComponentRendererContext.Provider>\n);\n\nexport default ComponentRendererProvider;\n","/**\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 {Context, createContext} from 'react';\n\n/**\n * Types of authentication flows/steps that can be displayed.\n */\nexport type FlowStep = {\n canGoBack?: boolean;\n id: string;\n metadata?: Record<string, any>;\n subtitle?: string;\n title: string;\n type: 'signin' | 'signup' | 'organization-signin' | 'forgot-password' | 'reset-password' | 'verify-email' | 'mfa';\n} | null;\n\n/**\n * Message types for displaying in authentication flows.\n */\nexport interface FlowMessage {\n dismissible?: boolean;\n id?: string;\n message: string;\n type: 'success' | 'error' | 'warning' | 'info';\n}\n\n/**\n * Context value for managing authentication flow UI state.\n */\nexport interface FlowContextValue {\n addMessage: (message: FlowMessage) => void;\n clearMessages: () => void;\n\n // Current step/flow\n currentStep: FlowStep;\n // Error state\n error: string | null;\n // Loading state\n isLoading: boolean;\n // Messages\n messages: FlowMessage[];\n\n navigateToFlow: (\n flowType: NonNullable<FlowStep>['type'],\n options?: {\n metadata?: Record<string, any>;\n subtitle?: string;\n title?: string;\n },\n ) => void;\n onGoBack?: () => void;\n removeMessage: (messageId: string) => void;\n // Utilities\n reset: () => void;\n\n setCurrentStep: (step: FlowStep) => void;\n setError: (error: string | null) => void;\n\n setIsLoading: (loading: boolean) => void;\n setOnGoBack: (callback?: () => void) => void;\n\n setShowBackButton: (show: boolean) => void;\n setSubtitle: (subtitle?: string) => void;\n setTitle: (title: string) => void;\n\n // Navigation\n showBackButton: boolean;\n\n subtitle?: string;\n\n // Title and subtitle\n title: string;\n}\n\n/**\n * Context for managing authentication flow UI state.\n * This context handles titles, messages, navigation, and loading states\n * for authentication flows like SignIn, SignUp, organization signin, etc.\n */\nconst FlowContext: Context<FlowContextValue | undefined> = createContext<FlowContextValue | undefined>(undefined);\n\nFlowContext.displayName = 'FlowContext';\n\nexport default FlowContext;\n","/**\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 {FC, PropsWithChildren, ReactElement, useCallback, useMemo, useState} from 'react';\nimport FlowContext, {FlowContextValue, FlowMessage, FlowStep} from './FlowContext';\n\n/**\n * Props for the FlowProvider component.\n */\nexport interface FlowProviderProps {\n /**\n * Initial step to start with.\n */\n initialStep?: FlowStep;\n\n /**\n * Initial subtitle.\n */\n initialSubtitle?: string;\n\n /**\n * Initial title.\n */\n initialTitle?: string;\n\n /**\n * Callback when flow type changes.\n */\n onFlowChange?: (step: FlowStep) => void;\n}\n\n/**\n * Provider component for flow context.\n * Manages shared UI state for authentication flows including titles, messages, and navigation.\n */\nconst FlowProvider: FC<PropsWithChildren<FlowProviderProps>> = ({\n children,\n initialStep = null,\n initialTitle = '',\n initialSubtitle,\n onFlowChange,\n}: PropsWithChildren<FlowProviderProps>): ReactElement => {\n const [currentStep, setCurrentStepState] = useState<FlowStep>(initialStep);\n const [title, setTitle] = useState<string>(initialTitle);\n const [subtitle, setSubtitle] = useState<string | undefined>(initialSubtitle);\n const [messages, setMessages] = useState<FlowMessage[]>([]);\n const [error, setError] = useState<string | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const [showBackButton, setShowBackButton] = useState<boolean>(false);\n const [onGoBack, setOnGoBack] = useState<(() => void) | undefined>(undefined);\n\n /**\n * Set the current flow step and notify listeners.\n */\n const setCurrentStep: (step: FlowStep) => void = useCallback(\n (step: FlowStep) => {\n setCurrentStepState(step);\n if (step) {\n setTitle(step.title);\n setSubtitle(step.subtitle);\n setShowBackButton(step.canGoBack ?? false);\n }\n onFlowChange?.(step);\n },\n [onFlowChange],\n );\n\n /**\n * Add a message to the message list.\n */\n const addMessage: (message: FlowMessage) => void = useCallback((message: FlowMessage) => {\n const messageWithId: FlowMessage = {\n ...message,\n id: message.id ?? `msg-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n };\n\n setMessages((prev: FlowMessage[]) => [...prev, messageWithId]);\n }, []);\n\n /**\n * Remove a specific message by ID.\n */\n const removeMessage: (messageId: string) => void = useCallback((messageId: string) => {\n setMessages((prev: FlowMessage[]) => prev.filter((msg: FlowMessage) => msg.id !== messageId));\n }, []);\n\n /**\n * Clear all messages.\n */\n const clearMessages: () => void = useCallback(() => {\n setMessages([]);\n }, []);\n\n /**\n * Reset the flow context to initial state.\n */\n const reset: () => void = useCallback(() => {\n setCurrentStepState(initialStep);\n setTitle(initialTitle);\n setSubtitle(initialSubtitle);\n setMessages([]);\n setError(null);\n setIsLoading(false);\n setShowBackButton(false);\n setOnGoBack(undefined);\n }, [initialStep, initialTitle, initialSubtitle]);\n\n /**\n * Navigate to a different authentication flow.\n */\n const navigateToFlow: (\n flowType: NonNullable<FlowStep>['type'],\n options?: {metadata?: Record<string, any>; subtitle?: string; title?: string},\n ) => void = useCallback(\n (\n flowType: NonNullable<FlowStep>['type'],\n options?: {\n metadata?: Record<string, any>;\n subtitle?: string;\n title?: string;\n },\n ) => {\n const stepId = `${flowType}-${Date.now()}`;\n const step: NonNullable<FlowStep> = {\n canGoBack: flowType !== 'signin', // Usually allow going back except for main signin\n id: stepId,\n metadata: options?.metadata,\n subtitle: options?.subtitle,\n title: options?.title,\n type: flowType,\n };\n\n setCurrentStep(step);\n clearMessages();\n setError(null);\n },\n [setCurrentStep, clearMessages],\n );\n\n const contextValue: FlowContextValue = useMemo(\n () => ({\n addMessage,\n clearMessages,\n currentStep,\n error,\n isLoading,\n messages,\n navigateToFlow,\n onGoBack,\n removeMessage,\n reset,\n setCurrentStep,\n setError,\n setIsLoading,\n setOnGoBack,\n setShowBackButton,\n setSubtitle,\n setTitle,\n showBackButton,\n subtitle,\n title,\n }),\n [\n currentStep,\n setCurrentStep,\n title,\n subtitle,\n messages,\n addMessage,\n removeMessage,\n clearMessages,\n error,\n isLoading,\n showBackButton,\n onGoBack,\n reset,\n navigateToFlow,\n ],\n );\n\n return <FlowContext.Provider value={contextValue}>{children}</FlowContext.Provider>;\n};\n\nexport default FlowProvider;\n","/**\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 {FlowMetadataResponse} from '@thunderid/browser';\nimport {Context, createContext} from 'react';\n\nexport interface FlowMetaContextValue {\n /**\n * Error from the flow meta fetch, if any\n */\n error: Error | null;\n /**\n * Manually re-fetch flow metadata\n */\n fetchFlowMeta: () => Promise<void>;\n /**\n * Whether flow metadata is currently being fetched\n */\n isLoading: boolean;\n /**\n * The fetched flow metadata response, or null while loading / on error\n */\n meta: FlowMetadataResponse | null;\n /**\n * Fetches flow metadata for the given language and activates it in the i18n system.\n * Use this to switch the UI language at runtime.\n */\n switchLanguage: (language: string) => Promise<void>;\n}\n\nconst FlowMetaContext: Context<FlowMetaContextValue | null> = createContext<FlowMetaContextValue | null>(null);\n\nFlowMetaContext.displayName = 'FlowMetaContext';\n\nexport default FlowMetaContext;\n","/**\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 {I18nBundle} from '@thunderid/browser';\nimport {Context, createContext} from 'react';\n\nexport interface I18nContextValue {\n /**\n * All available i18n bundles (default + user provided)\n */\n bundles: Record<string, I18nBundle>;\n\n /**\n * The current language code (e.g., 'en-US', 'fr-FR')\n */\n currentLanguage: string;\n\n /**\n * The fallback language code\n */\n fallbackLanguage: string;\n\n /**\n * Injects additional bundles into the i18n system (e.g., from flow metadata).\n * Injected bundles take precedence over defaults but are overridden by prop-provided bundles.\n */\n injectBundles: (bundles: Record<string, I18nBundle>) => void;\n\n /**\n * Function to change the current language\n */\n setLanguage: (language: string) => void;\n\n /**\n * Function to get a translation by key with optional parameters\n */\n t: (key: string, params?: Record<string, string | number>) => string;\n}\n\nconst I18nContext: Context<I18nContextValue | null> = createContext<I18nContextValue | null>(null);\n\nI18nContext.displayName = 'I18nContext';\n\nexport default I18nContext;\n","/**\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 I18nContext, {I18nContextValue} from './I18nContext';\n\n/**\n * Hook for accessing the I18n context directly.\n * Provides access to the full i18n context including bundles and all utilities.\n *\n * @returns The complete I18n context value\n * @throws Error if used outside of I18nProvider context\n */\nconst useI18n = (): I18nContextValue => {\n const context: I18nContextValue | null = useContext(I18nContext);\n\n if (!context) {\n throw new Error(\n 'useI18n must be used within an I18nProvider. Make sure your component is wrapped with ThunderIDProvider which includes I18nProvider.',\n );\n }\n\n return context;\n};\n\nexport default useI18n;\n","/**\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","/**\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 {\n FlowMetadataResponse,\n FlowMetaType,\n getFlowMetaV2,\n Platform,\n I18nBundle,\n TranslationBundleConstants,\n} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, RefObject, useCallback, useEffect, useRef, useState} from 'react';\nimport FlowMetaContext from './FlowMetaContext';\nimport {I18nContextValue} from '../I18n/I18nContext';\nimport useI18n from '../I18n/useI18n';\nimport useThunderID from '../ThunderID/useThunderID';\n\nexport interface FlowMetaProviderProps {\n /**\n * When false the provider skips fetching and provides null meta.\n * @default true\n */\n enabled?: boolean;\n}\n\n/**\n * FlowMetaProvider fetches flow metadata from the `GET /flow/meta` endpoint\n * (v2 API) and makes it available to child components through `FlowMetaContext`.\n *\n * It is designed to be used in v2 embedded-flow scenarios and integrates with\n * `ThemeProvider` so that theme settings (colors, direction, typography, …)\n * from the server-side design configuration are applied automatically.\n *\n * @example\n * ```tsx\n * <FlowMetaProvider\n * config={{\n * baseUrl: 'https://localhost:8090',\n * type: FlowMetaType.App,\n * id: 'your-app-id',\n * }}\n * >\n * <ThemeProvider>\n * <App />\n * </ThemeProvider>\n * </FlowMetaProvider>\n * ```\n */\nconst FlowMetaProvider: FC<PropsWithChildren<FlowMetaProviderProps>> = ({\n children,\n enabled = true,\n}: PropsWithChildren<FlowMetaProviderProps>): ReactElement => {\n const {baseUrl, applicationId, platform, isInitialized} = useThunderID();\n const i18nContext: I18nContextValue = useI18n();\n\n const [meta, setMeta] = useState<FlowMetadataResponse | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [error, setError] = useState<Error | null>(null);\n const [pendingLanguage, setPendingLanguage] = useState<string | null>(null);\n\n // Track the last fetchFlowMeta reference that was actually dispatched.\n // This prevents two classes of double-fetch:\n // 1. React StrictMode simulates unmount+remount — the re-mount fires the\n // effect again with the same fetchFlowMeta reference; without this guard\n // the else-branch would issue a redundant second network request.\n // 2. Rapid dependency changes (e.g. baseUrl stabilising) that produce two\n // effect firings before the first fetch completes.\n const lastFetchedRef: RefObject<(() => Promise<void>) | null> = useRef<(() => Promise<void>) | null>(null);\n\n const fetchFlowMeta: () => Promise<void> = useCallback(async (): Promise<void> => {\n if (!enabled || platform !== Platform.ThunderID) {\n setMeta(null);\n setIsLoading(false);\n return;\n }\n\n // Defer until ThunderID finishes initializing (e.g. loading applicationId\n // from storage on refresh). Once initialized, proceed even if applicationId\n // is absent — some flows (e.g. AcceptInvite) have no applicationId by design.\n if (!isInitialized && !applicationId) {\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n const result: FlowMetadataResponse = await getFlowMetaV2({\n baseUrl,\n ...(applicationId ? {id: applicationId, type: FlowMetaType.App} : {}),\n language: i18nContext?.currentLanguage,\n });\n setMeta(result);\n } catch (err: unknown) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n }, [enabled, platform, baseUrl, applicationId, isInitialized, i18nContext?.currentLanguage]);\n\n const switchLanguage: (language: string) => Promise<void> = useCallback(\n async (language: string): Promise<void> => {\n if (!enabled || platform !== Platform.ThunderID) return;\n\n setIsLoading(true);\n setError(null);\n\n try {\n const result: FlowMetadataResponse = await getFlowMetaV2({\n baseUrl,\n ...(applicationId ? {id: applicationId, type: FlowMetaType.App} : {}),\n language,\n });\n\n // Inject translations for the new language before switching\n if (result.i18n?.translations && i18nContext?.injectBundles) {\n const flatTranslations: Record<string, string> = {};\n Object.entries(result.i18n.translations).forEach(([namespace, keys]: [string, Record<string, string>]) => {\n Object.entries(keys).forEach(([key, value]: [string, string]) => {\n flatTranslations[`${namespace}.${key}`] = value;\n });\n });\n const bundle: I18nBundle = {translations: flatTranslations} as unknown as I18nBundle;\n i18nContext.injectBundles({[language]: bundle});\n }\n\n // Defer setLanguage to the next effect cycle so injectBundles state\n // is committed before I18nProvider's setLanguage checks mergedBundles.\n setPendingLanguage(language);\n setMeta(result);\n } catch (err: unknown) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n },\n [enabled, platform, baseUrl, applicationId, i18nContext],\n );\n\n // After injectBundles + setPendingLanguage are batched and committed, this\n // effect fires with the updated i18nContext (mergedBundles now includes the\n // new language), so setLanguage succeeds on the first switch.\n useEffect(() => {\n if (pendingLanguage && i18nContext?.setLanguage) {\n i18nContext.setLanguage(pendingLanguage);\n setPendingLanguage(null);\n }\n }, [pendingLanguage, i18nContext?.setLanguage]);\n\n useEffect(() => {\n if (lastFetchedRef.current === fetchFlowMeta) {\n // Same reference as the last dispatch — this is a StrictMode re-mount\n // or an effect re-fire with unchanged deps. Skip to avoid a duplicate fetch.\n return;\n }\n\n lastFetchedRef.current = fetchFlowMeta;\n fetchFlowMeta();\n }, [fetchFlowMeta]);\n\n // When meta loads with i18n translations, inject them into the i18n system.\n // Meta translations act as the base layer — prop-provided bundles still take precedence.\n useEffect(() => {\n if (!meta?.i18n?.translations || !i18nContext?.injectBundles) {\n return;\n }\n\n const metaLanguage: string = meta.i18n.language || TranslationBundleConstants.FALLBACK_LOCALE;\n\n // Flatten namespace-keyed translations to dot-path keys:\n // { \"signin\": { \"heading\": \"Sign In\" } } → { \"signin.heading\": \"Sign In\" }\n const flatTranslations: Record<string, string> = {};\n Object.entries(meta.i18n.translations).forEach(([namespace, keys]: [string, Record<string, string>]) => {\n Object.entries(keys).forEach(([key, value]: [string, string]) => {\n flatTranslations[`${namespace}.${key}`] = value;\n });\n });\n\n const bundle: I18nBundle = {translations: flatTranslations} as unknown as I18nBundle;\n\n // Inject under the meta language code and the i18n current language so\n // lookups succeed regardless of whether the system uses \"en\" or \"en-US\".\n const bundlesToInject: Record<string, I18nBundle> = {[metaLanguage]: bundle};\n if (i18nContext.currentLanguage && i18nContext.currentLanguage !== metaLanguage) {\n bundlesToInject[i18nContext.currentLanguage] = bundle;\n }\n if (i18nContext.fallbackLanguage && i18nContext.fallbackLanguage !== metaLanguage) {\n bundlesToInject[i18nContext.fallbackLanguage] = bundle;\n }\n\n i18nContext.injectBundles(bundlesToInject);\n }, [meta?.i18n?.translations, i18nContext?.injectBundles]);\n\n const value: any = {\n error,\n fetchFlowMeta,\n isLoading,\n meta,\n switchLanguage,\n };\n\n return <FlowMetaContext.Provider value={value}>{children}</FlowMetaContext.Provider>;\n};\n\nexport default FlowMetaProvider;\n","/**\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 deepMerge,\n I18nPreferences,\n I18nStorageStrategy,\n createPackageComponentLogger,\n I18nBundle,\n I18nTranslations,\n TranslationBundleConstants,\n getDefaultI18nBundles,\n normalizeTranslations,\n} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, useCallback, useEffect, useMemo, useState} from 'react';\nimport I18nContext, {I18nContextValue} from './I18nContext';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'I18nProvider',\n);\n\nconst DEFAULT_STORAGE_KEY = 'thunderid-i18n-language';\nconst DEFAULT_URL_PARAM = 'lang';\n\nexport interface I18nProviderProps {\n /**\n * The i18n preferences from the ThunderIDProvider\n */\n preferences?: I18nPreferences;\n}\n\nconst detectBrowserLanguage = (): string => {\n if (typeof window !== 'undefined' && window.navigator) {\n return window.navigator.language || TranslationBundleConstants.FALLBACK_LOCALE;\n }\n\n return TranslationBundleConstants.FALLBACK_LOCALE;\n};\n\nconst deriveRootDomain = (hostname: string): string => {\n const parts: string[] = hostname.split('.');\n return parts.length > 1 ? parts.slice(-2).join('.') : hostname;\n};\n\nconst getCookie = (name: string): string | null => {\n if (typeof document === 'undefined') return null;\n const match: RegExpMatchArray | null = new RegExp(\n `(?:^|; )${name.replace(/([.*+?^${}()|[\\]\\\\])/g, '\\\\$1')}=([^;]*)`,\n ).exec(document.cookie);\n return match ? decodeURIComponent(match[1]) : null;\n};\n\nconst setCookie = (name: string, value: string, domain: string): void => {\n if (typeof document === 'undefined') return;\n const maxAge: number = 365 * 24 * 60 * 60;\n const secure: string = typeof window !== 'undefined' && window.location.protocol === 'https:' ? '; Secure' : '';\n document.cookie =\n `${encodeURIComponent(name)}=${encodeURIComponent(value)}` +\n `; Max-Age=${maxAge}` +\n `; Path=/` +\n `; Domain=${domain}` +\n `; SameSite=Lax${secure}`;\n};\n\ninterface StorageAdapter {\n read: () => string | null;\n write: (language: string) => void;\n}\n\nconst createStorageAdapter = (strategy: I18nStorageStrategy, key: string, cookieDomain?: string): StorageAdapter => {\n switch (strategy) {\n case 'cookie':\n return {\n read: (): string | null => getCookie(key),\n write: (language: string): void => {\n const domain: string =\n cookieDomain ?? (typeof window !== 'undefined' ? deriveRootDomain(window.location.hostname) : '');\n if (domain) setCookie(key, language, domain);\n },\n };\n case 'localStorage':\n return {\n read: (): string | null => {\n if (typeof window === 'undefined' || !window.localStorage) return null;\n try {\n return window.localStorage.getItem(key);\n } catch {\n return null;\n }\n },\n write: (language: string): void => {\n if (typeof window === 'undefined' || !window.localStorage) return;\n try {\n window.localStorage.setItem(key, language);\n } catch {\n logger.warn('Failed to persist language preference to localStorage.');\n }\n },\n };\n case 'none':\n default:\n return {read: (): null => null, write: (): void => {}};\n }\n};\n\nconst detectUrlParamLanguage = (paramName: string): string | null => {\n if (typeof window === 'undefined') return null;\n try {\n return new URLSearchParams(window.location.search).get(paramName);\n } catch {\n return null;\n }\n};\n\n/**\n * I18nProvider component that manages internationalization state and provides\n * translation functions to child components.\n */\nconst I18nProvider: FC<PropsWithChildren<I18nProviderProps>> = ({\n children,\n preferences,\n}: PropsWithChildren<I18nProviderProps>): ReactElement => {\n // Get default bundles from the browser package\n const defaultBundles: Record<string, I18nBundle> = getDefaultI18nBundles();\n\n const storageStrategy: I18nStorageStrategy = preferences?.storageStrategy ?? 'cookie';\n const storageKey: string = preferences?.storageKey ?? DEFAULT_STORAGE_KEY;\n const urlParamConfig: string | false = preferences?.urlParam === undefined ? DEFAULT_URL_PARAM : preferences.urlParam;\n\n const resolvedCookieDomain: string | undefined = useMemo((): string | undefined => {\n if (storageStrategy !== 'cookie') return undefined;\n if (preferences?.cookieDomain) return preferences.cookieDomain;\n return typeof window !== 'undefined' ? deriveRootDomain(window.location.hostname) : undefined;\n }, [storageStrategy, preferences?.cookieDomain]);\n\n const storage: StorageAdapter = useMemo(\n () => createStorageAdapter(storageStrategy, storageKey, resolvedCookieDomain),\n [storageStrategy, storageKey, resolvedCookieDomain],\n );\n\n const determineInitialLanguage = (): string => {\n if (preferences?.language) return preferences.language;\n if (urlParamConfig !== false) {\n const urlLanguage: string | null = detectUrlParamLanguage(urlParamConfig);\n if (urlLanguage) {\n storage.write(urlLanguage);\n return urlLanguage;\n }\n }\n const storedLanguage: string | null = storage.read();\n if (storedLanguage) return storedLanguage;\n const browserLanguage: string = detectBrowserLanguage();\n if (browserLanguage) return browserLanguage;\n return preferences?.fallbackLanguage || TranslationBundleConstants.FALLBACK_LOCALE;\n };\n\n const [currentLanguage, setCurrentLanguage] = useState<string>(determineInitialLanguage);\n\n // Bundles injected at runtime (e.g., from flow metadata i18n translations).\n // These take precedence over defaults but are overridden by prop-provided bundles.\n const [injectedBundles, setInjectedBundles] = useState<Record<string, I18nBundle>>({});\n\n const injectBundles: (newBundles: Record<string, I18nBundle>) => void = useCallback(\n (newBundles: Record<string, I18nBundle>): void => {\n setInjectedBundles((prev: Record<string, I18nBundle>) => {\n const merged: Record<string, I18nBundle> = {...prev};\n Object.entries(newBundles).forEach(([key, bundle]: [string, I18nBundle]) => {\n const normalizedTranslations: I18nTranslations = normalizeTranslations(\n bundle.translations as unknown as Record<string, string | Record<string, string>>,\n );\n if (merged[key]) {\n merged[key] = {\n ...merged[key],\n translations: deepMerge(merged[key].translations, normalizedTranslations),\n };\n } else {\n merged[key] = {...bundle, translations: normalizedTranslations};\n }\n });\n return merged;\n });\n },\n [],\n );\n\n /**\n * Merge bundles in priority order: defaults → injected (meta) → prop-provided\n */\n const mergedBundles: Record<string, I18nBundle> = useMemo(() => {\n const merged: Record<string, I18nBundle> = {};\n\n // 1. Default bundles\n Object.entries(defaultBundles).forEach(([key, bundle]: [string, I18nBundle]) => {\n // Convert key format (e.g., 'en_US' to 'en-US')\n const languageKey: string = key.replace('_', '-');\n merged[languageKey] = bundle;\n });\n\n // 2. Injected bundles (e.g., from flow metadata) — override defaults\n Object.entries(injectedBundles).forEach(([key, bundle]: [string, I18nBundle]) => {\n const normalizedTranslations: I18nTranslations = normalizeTranslations(\n bundle.translations as unknown as Record<string, string | Record<string, string>>,\n );\n if (merged[key]) {\n merged[key] = {\n ...merged[key],\n translations: deepMerge(merged[key].translations, normalizedTranslations),\n };\n } else {\n merged[key] = {...bundle, translations: normalizedTranslations};\n }\n });\n\n // 3. User-provided bundles (from props) — highest priority, override everything\n if (preferences?.bundles) {\n Object.entries(preferences.bundles).forEach(([key, userBundle]: [string, I18nBundle]) => {\n const normalizedTranslations: I18nTranslations = normalizeTranslations(\n userBundle.translations as unknown as Record<string, string | Record<string, string>>,\n );\n if (merged[key]) {\n merged[key] = {\n ...merged[key],\n metadata: userBundle.metadata ? {...merged[key].metadata, ...userBundle.metadata} : merged[key].metadata,\n translations: deepMerge(merged[key].translations, normalizedTranslations),\n };\n } else {\n merged[key] = {...userBundle, translations: normalizedTranslations};\n }\n });\n }\n\n return merged;\n }, [defaultBundles, injectedBundles, preferences?.bundles]);\n\n const fallbackLanguage: string = preferences?.fallbackLanguage || TranslationBundleConstants.FALLBACK_LOCALE;\n\n // Persist language changes to the configured storage.\n useEffect(() => {\n storage.write(currentLanguage);\n }, [currentLanguage, storage]);\n\n // Translation function\n const t: (key: string, params?: Record<string, string | number>) => string = useCallback(\n (key: string, params?: Record<string, string | number>): string => {\n let translation: string | undefined;\n\n // Try to get translation from current language bundle\n const currentBundle: I18nBundle | undefined = mergedBundles[currentLanguage];\n if (currentBundle?.translations[key]) {\n translation = currentBundle.translations[key];\n }\n\n // Fallback to fallback language if translation not found\n if (!translation && currentLanguage !== fallbackLanguage) {\n const fallbackBundle: I18nBundle | undefined = mergedBundles[fallbackLanguage];\n if (fallbackBundle?.translations[key]) {\n translation = fallbackBundle.translations[key];\n }\n }\n\n // If still no translation found, return the key itself\n if (!translation) {\n translation = key;\n }\n\n // Replace parameters if provided\n if (params && Object.keys(params).length > 0) {\n return Object.entries(params).reduce(\n (acc: string, [paramKey, paramValue]: [string, string | number]) =>\n acc.replace(new RegExp(`\\\\{${paramKey}\\\\}`, 'g'), String(paramValue)),\n translation,\n );\n }\n\n return translation;\n },\n [mergedBundles, currentLanguage, fallbackLanguage],\n );\n\n // Language setter function\n const setLanguage: (language: string) => void = useCallback(\n (language: string) => {\n if (mergedBundles[language]) {\n setCurrentLanguage(language);\n } else {\n logger.warn(\n `Language '${language}' is not available. Available languages: ${Object.keys(mergedBundles).join(', ')}`,\n );\n }\n },\n [mergedBundles],\n );\n\n const contextValue: I18nContextValue = useMemo(\n () => ({\n bundles: mergedBundles,\n currentLanguage,\n fallbackLanguage,\n injectBundles,\n setLanguage,\n t,\n }),\n [currentLanguage, fallbackLanguage, injectBundles, mergedBundles, setLanguage, t],\n );\n\n return <I18nContext.Provider value={contextValue}>{children}</I18nContext.Provider>;\n};\n\nexport default I18nProvider;\n","/**\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 {AllOrganizationsApiResponse, Organization, CreateOrganizationPayload} from '@thunderid/browser';\nimport {Context, createContext} from 'react';\n\n/**\n * Props interface of {@link OrganizationContext}\n */\nexport interface OrganizationContextProps {\n /**\n * Function to create a new organization.\n */\n createOrganization?: (payload: CreateOrganizationPayload, sessionId: string) => Promise<Organization>;\n currentOrganization: Organization | null;\n error: string | null;\n getAllOrganizations: () => Promise<AllOrganizationsApiResponse>;\n isLoading: boolean;\n myOrganizations: Organization[];\n revalidateMyOrganizations: () => Promise<Organization[]>;\n switchOrganization: (organization: Organization) => Promise<void>;\n}\n\n/**\n * Context object for managing organization data and related operations.\n */\nconst OrganizationContext: Context<OrganizationContextProps | null> = createContext<null | OrganizationContextProps>({\n createOrganization: () => null,\n currentOrganization: null,\n error: null,\n getAllOrganizations: () =>\n Promise.resolve({\n count: 0,\n organizations: [],\n }),\n isLoading: false,\n myOrganizations: null,\n revalidateMyOrganizations: () => Promise.resolve([]),\n switchOrganization: () => Promise.resolve(),\n});\n\nOrganizationContext.displayName = 'OrganizationContext';\n\nexport default OrganizationContext;\n","/**\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 ThunderIDRuntimeError,\n Organization,\n AllOrganizationsApiResponse,\n CreateOrganizationPayload,\n TokenResponse,\n} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, useCallback, useMemo, useState} from 'react';\nimport OrganizationContext, {OrganizationContextProps} from './OrganizationContext';\n\n/**\n * Props interface of {@link OrganizationProvider}\n */\nexport interface OrganizationProviderProps {\n /**\n * Whether to automatically fetch organizations on mount\n */\n autoFetch?: boolean;\n /**\n * Function to create a new organization.\n */\n createOrganization?: (payload: CreateOrganizationPayload, sessionId: string) => Promise<Organization>;\n /**\n * Initial current organization\n */\n currentOrganization?: Organization | null;\n /**\n * Initial list of organizations\n */\n getAllOrganizations?: () => Promise<AllOrganizationsApiResponse>;\n /**\n * List of organizations the signed-in user belongs to.\n */\n myOrganizations?: Organization[];\n /**\n * Callback function called when an error occurs\n */\n onError?: (error: string) => void;\n /**\n * Callback function called when switching organizations\n */\n onOrganizationSwitch?: (organization: Organization) => Promise<TokenResponse | Response>;\n /**\n * Refetch the my organizations list.\n * @returns\n */\n revalidateMyOrganizations: () => Promise<Organization[]>;\n}\n\n/**\n * OrganizationProvider component that manages organization data and provides it through OrganizationContext.\n *\n * This provider:\n * - Fetches organization data from the organizations endpoint\n * - Manages current organization state\n * - Provides functions for switching organizations and refreshing data\n * - Handles loading states and errors\n *\n * @example\n * ```tsx\n * // Basic usage with auto-fetch (uses internal API)\n * <OrganizationProvider>\n * <App />\n * </OrganizationProvider>\n *\n * // With custom error handling\n * <OrganizationProvider onError={(error) => console.error('Organization error:', error)}>\n * <App />\n * </OrganizationProvider>\n *\n * // With custom organization switch handler\n * <OrganizationProvider\n * onOrganizationSwitch={(org) => console.log('Switched to:', org.name)}\n * >\n * <App />\n * </OrganizationProvider>\n *\n * // Disable auto-fetch (fetch manually using revalidateMyOrganizations)\n * <OrganizationProvider autoFetch={false}>\n * <App />\n * </OrganizationProvider>\n * ```\n */\nconst OrganizationProvider: FC<PropsWithChildren<OrganizationProviderProps>> = ({\n children,\n currentOrganization,\n onError,\n myOrganizations,\n onOrganizationSwitch,\n revalidateMyOrganizations,\n getAllOrganizations,\n createOrganization,\n}: PropsWithChildren<OrganizationProviderProps>): ReactElement => {\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const [error, setError] = useState<string | null>(null);\n\n /**\n * Switches to a different organization\n */\n const switchOrganization: (organization: Organization) => Promise<void> = useCallback(\n async (organization: Organization): Promise<void> => {\n if (!onOrganizationSwitch) {\n throw new ThunderIDRuntimeError(\n 'onOrganizationSwitch callback is required',\n 'OrganizationProvider-SwitchError-001',\n 'react',\n 'The onOrganizationSwitch callback must be provided to handle organization switching.',\n );\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n await onOrganizationSwitch(organization);\n // The organization state will be updated by the parent provider\n } catch (switchError) {\n const errorMessage: string =\n switchError instanceof Error ? switchError.message : 'Failed to switch organization';\n setError(errorMessage);\n if (onError) {\n onError(errorMessage);\n }\n throw switchError; // Re-throw so the UI can handle it\n } finally {\n setIsLoading(false);\n }\n },\n [onOrganizationSwitch, onError],\n );\n\n const contextValue: OrganizationContextProps = useMemo(\n () => ({\n createOrganization,\n currentOrganization,\n error,\n getAllOrganizations,\n isLoading,\n myOrganizations,\n revalidateMyOrganizations,\n switchOrganization,\n }),\n [\n currentOrganization,\n error,\n isLoading,\n myOrganizations,\n switchOrganization,\n revalidateMyOrganizations,\n getAllOrganizations,\n createOrganization,\n ],\n );\n\n return <OrganizationContext.Provider value={contextValue}>{children}</OrganizationContext.Provider>;\n};\n\nexport default OrganizationProvider;\n","/**\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 {Theme} from '@thunderid/browser';\n\n/**\n * Writes all CSS custom properties from a resolved `Theme` onto the document root.\n * Called inside a `useEffect` whenever the active theme changes.\n */\nconst applyThemeToDOM = (theme: Theme): void => {\n Object.entries(theme.cssVariables).forEach(([key, value]: [string, string]) => {\n document.documentElement.style.setProperty(key, value);\n });\n};\n\nexport default applyThemeToDOM;\n","/**\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 {RecursivePartial, ThemeConfig} from '@thunderid/browser';\n\ninterface ColorWithMain {\n [key: string]: unknown;\n main: string;\n}\n\n/**\n * Normalizes a single color value that may have been supplied as a shorthand\n * CSS color string (`'#2563eb'`) instead of the expected object form\n * (`{ main: '#2563eb' }`).\n *\n * This makes the `preferences.theme.overrides.colors.*` API forgiving for\n * JavaScript callers who don't have TypeScript's type-checker to catch the\n * mismatch at compile time.\n */\nconst normalizeColorValue = (color: string | ColorWithMain): ColorWithMain =>\n typeof color === 'string' ? {main: color} : color;\n\n/**\n * Normalizes a `RecursivePartial<ThemeConfig>` so that color fields which are\n * supplied as plain CSS color strings are coerced into `{ main: string }`\n * objects before being handed to `createTheme`.\n *\n * Only the color groups that `toCssVariables` in `createTheme` actually reads\n * individual sub-keys from are normalized here (`primary`, `secondary`,\n * `error`, `success`, `warning`, `info`). `border` is left alone because it\n * IS a plain string in `ThemeConfig`.\n */\nconst normalizeThemeConfig = (\n config: RecursivePartial<ThemeConfig> | undefined,\n): RecursivePartial<ThemeConfig> | undefined => {\n if (!config?.colors) {\n return config;\n }\n\n const {primary, secondary, error, success, warning, info, ...restColors} = config.colors as any;\n\n return {\n ...config,\n colors: {\n ...restColors,\n ...(primary !== undefined ? {primary: normalizeColorValue(primary)} : {}),\n ...(secondary !== undefined ? {secondary: normalizeColorValue(secondary)} : {}),\n ...(error !== undefined ? {error: normalizeColorValue(error)} : {}),\n ...(success !== undefined ? {success: normalizeColorValue(success)} : {}),\n ...(warning !== undefined ? {warning: normalizeColorValue(warning)} : {}),\n ...(info !== undefined ? {info: normalizeColorValue(info)} : {}),\n },\n };\n};\n\nexport default normalizeThemeConfig;\n","/**\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 BrandingContext, {BrandingContextValue} from './BrandingContext';\n\n/**\n * Hook to access the branding context.\n * This hook provides access to branding preferences, theme data, and loading states.\n *\n * @returns The branding context value containing branding preference data, theme, and control functions\n * @throws Error if used outside of a BrandingProvider\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { theme, activeTheme, isLoading, error } = useBrandingContext();\n *\n * if (isLoading) return <div>Loading branding...</div>;\n * if (error) return <div>Error: {error.message}</div>;\n *\n * return (\n * <div style={{ color: theme?.colors?.primary?.main }}>\n * <p>Active theme mode: {activeTheme}</p>\n * <p>Styled with ThunderID branding</p>\n * </div>\n * );\n * }\n * ```\n */\nconst useBrandingContext = (): BrandingContextValue => {\n const context: BrandingContextValue | null = useContext(BrandingContext);\n if (!context) {\n throw new Error('useBrandingContext must be used within a BrandingProvider');\n }\n return context;\n};\n\nexport default useBrandingContext;\n","/**\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 {Theme} from '@thunderid/browser';\nimport {Context, createContext} from 'react';\n\nexport interface ThemeContextValue {\n /**\n * Error from branding theme fetch, if any\n */\n brandingError?: Error | null;\n colorScheme: 'light' | 'dark';\n /**\n * The text direction for the UI.\n */\n direction: 'ltr' | 'rtl';\n /**\n * Whether branding inheritance is enabled\n */\n inheritFromBranding?: boolean;\n /**\n * Whether branding theme is currently loading\n */\n isBrandingLoading?: boolean;\n theme: Theme;\n toggleTheme: () => void;\n}\n\nconst ThemeContext: Context<ThemeContextValue | null> = createContext<ThemeContextValue | null>(null);\n\nThemeContext.displayName = 'ThemeContext';\n\nexport default ThemeContext;\n","/**\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 {\n createTheme,\n Theme,\n ThemeConfig,\n ThemeMode,\n RecursivePartial,\n detectThemeMode,\n createClassObserver,\n createMediaQueryListener,\n BrowserThemeDetection,\n ThemePreferences,\n DEFAULT_THEME,\n createPackageComponentLogger,\n} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, useEffect, useMemo, useState, useCallback} from 'react';\nimport applyThemeToDOM from '../../../utils/applyThemeToDOM';\nimport normalizeThemeConfig from '../../../utils/normalizeThemeConfig';\n\nimport useBrandingContext from '../../Branding/useBrandingContext';\nimport ThemeContext from '../ThemeContext';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'ThemeProvider',\n);\n\nexport interface ThemeProviderProps {\n /**\n * Configuration for theme detection when using 'class' or 'system' mode\n */\n detection?: BrowserThemeDetection;\n /**\n * Configuration for branding integration\n */\n inheritFromBranding?: ThemePreferences['inheritFromBranding'];\n /**\n * The theme mode to use for automatic detection\n * - 'light': Always use light theme\n * - 'dark': Always use dark theme\n * - 'system': Use system preference (prefers-color-scheme media query)\n * - 'class': Detect theme based on CSS classes on HTML element\n * - 'branding': Use active theme from branding preference (requires inheritFromBranding=true)\n */\n mode?: ThemeMode | 'branding';\n theme?: RecursivePartial<ThemeConfig>;\n}\n\n/**\n * ThemeProvider component that manages theme state and provides theme context to child components.\n *\n * This provider integrates with ThunderID branding preferences to automatically apply\n * organization-specific themes while allowing for custom theme overrides.\n *\n * Features:\n * - Automatic theme mode detection (light/dark/system/class)\n * - Integration with ThunderID branding API through useBranding hook\n * - Merging of branding themes with custom theme configurations\n * - CSS variable injection for easy styling\n * - Loading and error states for branding integration\n *\n * @example\n * Basic usage with branding integration:\n * ```tsx\n * <ThemeProvider inheritFromBranding={true}>\n * <App />\n * </ThemeProvider>\n * ```\n *\n * @example\n * With custom theme overrides:\n * ```tsx\n * <ThemeProvider\n * theme={{\n * colors: {\n * primary: { main: '#custom-color' }\n * }\n * }}\n * inheritFromBranding={true}\n * >\n * <App />\n * </ThemeProvider>\n * ```\n *\n * @example\n * With branding-driven theme mode:\n * ```tsx\n * <ThemeProvider\n * mode=\"branding\"\n * inheritFromBranding={true}\n * >\n * <App />\n * </ThemeProvider>\n * ```\n */\nconst ThemeProvider: FC<PropsWithChildren<ThemeProviderProps>> = ({\n children,\n theme: themeConfigProp,\n mode = DEFAULT_THEME,\n detection = {},\n inheritFromBranding = true,\n}: PropsWithChildren<ThemeProviderProps>): ReactElement => {\n const themeConfig: RecursivePartial<ThemeConfig> | undefined = normalizeThemeConfig(themeConfigProp);\n\n const [colorScheme, setColorScheme] = useState<'light' | 'dark'>(() => {\n // Initialize with detected theme mode or fallback to defaultMode\n if (mode === 'light' || mode === 'dark') {\n return mode;\n }\n // For 'branding' mode, start with system preference and update when branding loads\n if (mode === 'branding') {\n return detectThemeMode('system', detection);\n }\n return detectThemeMode(mode, detection);\n });\n\n // Use branding theme if inheritFromBranding is enabled\n // Handle case where BrandingProvider might not be available\n let brandingTheme: Theme | null = null;\n let brandingActiveTheme: 'light' | 'dark' | null = null;\n let isBrandingLoading = false;\n let brandingError: Error | null = null;\n\n try {\n const brandingContext: any = useBrandingContext();\n brandingTheme = brandingContext.theme;\n brandingActiveTheme = brandingContext.activeTheme;\n isBrandingLoading = brandingContext.isLoading;\n brandingError = brandingContext.error;\n } catch (error) {\n // BrandingProvider not available, fall back to no branding\n if (inheritFromBranding) {\n logger.warn(\n 'ThemeProvider: inheritFromBranding is enabled but BrandingProvider is not available. ' +\n 'Make sure to wrap your app with BrandingProvider or ThunderIDProvider with branding preferences.',\n );\n }\n }\n\n // Update color scheme based on branding active theme when available\n useEffect(() => {\n if (inheritFromBranding && brandingActiveTheme) {\n // Update color scheme based on mode preference\n if (mode === 'branding') {\n // Always follow branding active theme\n setColorScheme(brandingActiveTheme);\n } else if (mode === 'system' && !isBrandingLoading) {\n // For system mode, prefer branding but allow system override if no branding\n setColorScheme(brandingActiveTheme);\n }\n }\n }, [inheritFromBranding, brandingActiveTheme, mode, isBrandingLoading]);\n\n // Merge user-provided theme config with branding theme\n const finalThemeConfig: RecursivePartial<ThemeConfig> | undefined = useMemo(() => {\n if (!inheritFromBranding || !brandingTheme) {\n return themeConfig;\n }\n\n // Convert branding theme to our theme config format\n const brandingThemeConfig: RecursivePartial<ThemeConfig> = {\n borderRadius: brandingTheme.borderRadius,\n colors: brandingTheme.colors,\n components: brandingTheme.components,\n images: brandingTheme.images,\n shadows: brandingTheme.shadows,\n spacing: brandingTheme.spacing,\n };\n\n // Merge branding theme with user-provided theme config\n // User-provided config takes precedence over branding\n return {\n ...brandingThemeConfig,\n ...themeConfig,\n borderRadius: {\n ...brandingThemeConfig.borderRadius,\n ...themeConfig?.borderRadius,\n },\n colors: {\n ...brandingThemeConfig.colors,\n ...themeConfig?.colors,\n },\n components: {\n ...brandingThemeConfig.components,\n ...themeConfig?.components,\n },\n images: {\n ...brandingThemeConfig.images,\n ...themeConfig?.images,\n },\n shadows: {\n ...brandingThemeConfig.shadows,\n ...themeConfig?.shadows,\n },\n spacing: {\n ...brandingThemeConfig.spacing,\n ...themeConfig?.spacing,\n },\n };\n }, [inheritFromBranding, brandingTheme, themeConfig]);\n\n const theme: Theme = useMemo(\n () => createTheme(finalThemeConfig, colorScheme === 'dark'),\n [finalThemeConfig, colorScheme],\n );\n\n // Get direction from theme config or default to 'ltr'\n const direction: string = (finalThemeConfig as any)?.direction || 'ltr';\n\n const handleThemeChange: (isDark: boolean) => void = useCallback((isDark: boolean) => {\n setColorScheme(isDark ? 'dark' : 'light');\n }, []);\n\n const toggleTheme: () => void = useCallback(() => {\n setColorScheme((prev: 'light' | 'dark') => (prev === 'light' ? 'dark' : 'light'));\n }, []);\n\n useEffect(() => {\n let observer: MutationObserver | null = null;\n let mediaQuery: MediaQueryList | null = null;\n\n // Don't set up automatic theme detection for branding mode\n if (mode === 'branding') {\n return null;\n }\n\n if (mode === 'class') {\n const targetElement: HTMLElement = detection.targetElement || document.documentElement;\n if (targetElement) {\n observer = createClassObserver(targetElement, handleThemeChange, detection);\n }\n } else if (mode === 'system') {\n // Only set up system listener if not using branding or branding hasn't loaded yet\n if (!inheritFromBranding || !brandingActiveTheme) {\n mediaQuery = createMediaQueryListener(handleThemeChange);\n }\n }\n\n return () => {\n if (observer) {\n observer.disconnect();\n }\n if (mediaQuery) {\n // Clean up media query listener\n if (mediaQuery.removeEventListener) {\n mediaQuery.removeEventListener('change', handleThemeChange as any);\n } else {\n // Fallback for older browsers\n mediaQuery.removeListener(handleThemeChange as any);\n }\n }\n };\n }, [mode, detection, handleThemeChange, inheritFromBranding, brandingActiveTheme]);\n\n useEffect(() => {\n applyThemeToDOM(theme);\n }, [theme]);\n\n // Apply direction to document\n useEffect(() => {\n if (typeof document !== 'undefined') {\n document.documentElement.dir = direction;\n }\n }, [direction]);\n\n const value: any = {\n brandingError,\n colorScheme,\n direction,\n inheritFromBranding,\n isBrandingLoading,\n theme,\n toggleTheme,\n };\n\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;\n};\n\nexport default ThemeProvider;\n","/**\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 {FlowMetaTheme, FlowMetaThemeColorScheme, RecursivePartial, ThemeConfig} from '@thunderid/browser';\n\n/**\n * Converts a v2 `FlowMetaTheme` into a `RecursivePartial<ThemeConfig>` that\n * `createTheme` can consume.\n *\n * Only fields explicitly present in the FlowMeta response are included so that\n * `createTheme` can deep-merge them onto its base (light/dark) defaults without\n * accidentally dropping sibling keys that were not returned by the server.\n *\n * For example, when FlowMeta returns only `background.default` and\n * `background.paper`, only `body.main` and `surface` are set — the base\n * theme's `background.disabled` and `background.dark` are **not** overridden\n * and therefore keep their default CSS variable values.\n */\nconst buildThemeConfigFromFlowMeta = (\n flowMetaTheme: FlowMetaTheme,\n colorScheme: 'light' | 'dark',\n): RecursivePartial<ThemeConfig> => {\n const scheme: FlowMetaThemeColorScheme | undefined = flowMetaTheme.colorSchemes?.[colorScheme];\n const borderRadius: number | undefined = flowMetaTheme.shape?.borderRadius;\n const borderRadiusStr: string | undefined = borderRadius !== undefined ? `${borderRadius}px` : undefined;\n\n // Build only the colors that the server actually provided.\n // Each nested object is constructed incrementally so that absent fields are\n // simply omitted rather than set to `undefined`, which would shadow the\n // base-theme defaults inside `createTheme`.\n let colors: RecursivePartial<ThemeConfig['colors']> | undefined;\n\n if (scheme?.palette) {\n colors = {};\n\n if (scheme.palette.primary) {\n colors.primary = scheme.palette.primary;\n }\n if (scheme.palette.secondary) {\n colors.secondary = scheme.palette.secondary;\n }\n if (scheme.palette.text) {\n colors.text = scheme.palette.text;\n }\n\n // Build background incrementally to avoid replacing the full base object.\n if (scheme.palette.background) {\n const bg: RecursivePartial<ThemeConfig['colors']['background']> = {};\n\n if (scheme.palette.background.default) {\n bg.body = {main: scheme.palette.background.default};\n }\n if (scheme.palette.background.paper) {\n bg.surface = scheme.palette.background.paper;\n }\n\n if (Object.keys(bg).length > 0) {\n colors.background = bg;\n }\n }\n }\n\n return {\n ...(flowMetaTheme.direction ? {direction: flowMetaTheme.direction} : {}),\n ...(borderRadiusStr\n ? {\n borderRadius: {\n large: borderRadiusStr,\n medium: borderRadiusStr,\n small: borderRadiusStr,\n },\n }\n : {}),\n ...(colors && Object.keys(colors).length > 0 ? {colors} : {}),\n ...(flowMetaTheme.typography?.fontFamily ? {typography: {fontFamily: flowMetaTheme.typography.fontFamily}} : {}),\n };\n};\n\nexport default buildThemeConfigFromFlowMeta;\n","/**\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, RecursivePartial, FlowMetaTheme} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, useCallback, useContext, useEffect, useMemo, useState} from 'react';\nimport applyThemeToDOM from '../../../utils/applyThemeToDOM';\nimport normalizeThemeConfig from '../../../utils/normalizeThemeConfig';\nimport buildThemeConfigFromFlowMeta from '../../../utils/v2/buildThemeConfigFromFlowMeta';\nimport FlowMetaContext, {FlowMetaContextValue} from '../../FlowMeta/FlowMetaContext';\nimport ThemeContext from '../ThemeContext';\n\nexport interface ThemeProviderProps {\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 brandingError: error,\n colorScheme,\n direction,\n inheritFromBranding: false,\n isBrandingLoading: isLoading,\n theme,\n toggleTheme,\n };\n\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;\n};\n\nexport default ThemeProvider;\n","/**\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 BrowserThemeDetection,\n Platform,\n RecursivePartial,\n ThemeConfig,\n ThemeMode,\n ThemePreferences,\n} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement} from 'react';\nimport V1ThemeProvider from './v1/ThemeProvider';\nimport ThemeProviderV2, {ThemeProviderProps as ThemeProviderV2Props} from './v2/ThemeProvider';\nimport useThunderID from '../ThunderID/useThunderID';\n\nexport interface ThemeProviderProps {\n // ─── v1 props (ignored in v2 mode) ──────────────────────────────────────────\n /**\n * Configuration for theme detection when using 'class' or 'system' mode.\n */\n detection?: BrowserThemeDetection;\n /**\n * Whether to inherit the theme from the ThunderID branding preference.\n * @default true\n */\n inheritFromBranding?: ThemePreferences['inheritFromBranding'];\n /**\n * The theme mode to use for automatic detection.\n * - `'light'` | `'dark'`: Fixed color scheme.\n * - `'system'`: Follows the OS preference.\n * - `'class'`: Detects theme from CSS classes on the `<html>` element.\n * - `'branding'`: Follows the active theme from the branding preference.\n */\n mode?: ThemeMode | 'branding';\n\n // ─── shared ──────────────────────────────────────────────────────────────────\n /**\n * Optional partial theme overrides applied on top of the resolved theme.\n * User-supplied values always take the highest precedence.\n */\n theme?: RecursivePartial<ThemeConfig>;\n}\n\n/**\n * ThemeProvider is the single entry-point for theme management in `@thunderid/react`.\n *\n * It transparently switches between two internal implementations:\n *\n * **v1** (`ThemeProvider` classic): Sources colors from the ThunderID Branding API.\n * Used automatically when no `FlowMetaProvider` is present in the component tree.\n *\n * **v2** (`FlowMetaThemeProvider`): Sources colors from the `GET /flow/meta` endpoint\n * via `FlowMetaProvider`. Used automatically when a `FlowMetaProvider` is present\n * in the tree — or when `version=\"v2\"` is set explicitly.\n *\n * The active version can also be pinned explicitly via the `version` prop.\n * All components that consume `useTheme()` continue to work regardless of which\n * version is active.\n *\n * @example\n * Auto-detection (recommended):\n * ```tsx\n * // v2 mode – FlowMetaProvider is present\n * <FlowMetaProvider config={{ baseUrl, type: FlowMetaType.App, id: appId }}>\n * <ThemeProvider>\n * <App />\n * </ThemeProvider>\n * </FlowMetaProvider>\n *\n * // v1 mode – no FlowMetaProvider\n * <ThemeProvider>\n * <App />\n * </ThemeProvider>\n * ```\n *\n * @example\n * Explicit version pinning:\n * ```tsx\n * <ThemeProvider version=\"v2\">\n * <App />\n * </ThemeProvider>\n * ```\n */\nconst ThemeProvider: FC<PropsWithChildren<ThemeProviderProps>> = ({\n children,\n theme,\n detection,\n inheritFromBranding,\n mode,\n}: PropsWithChildren<ThemeProviderProps>): ReactElement => {\n const {platform} = useThunderID();\n\n if (platform === Platform.ThunderID) {\n const v2Props: ThemeProviderV2Props = {theme};\n\n return <ThemeProviderV2 {...v2Props}>{children}</ThemeProviderV2>;\n }\n\n return (\n <V1ThemeProvider detection={detection} inheritFromBranding={inheritFromBranding} mode={mode} theme={theme}>\n {children}\n </V1ThemeProvider>\n );\n};\n\nexport default ThemeProvider;\n","/**\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, Schema, 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 schemas: Schema[] | null;\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,\n schemas: null,\n updateProfile: () => null,\n});\n\nUserContext.displayName = 'UserContext';\n\nexport default UserContext;\n","/**\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 * - Retrieves SCIM2 schemas for profile structure\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 schemas: profile?.schemas,\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","/**\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 AllOrganizationsApiResponse,\n ThunderIDRuntimeError,\n generateFlattenedUserProfile,\n OIDCDiscoveryApiResponse,\n Organization,\n SignInOptions,\n User,\n UserProfile,\n getBrandingPreference,\n GetBrandingPreferenceConfig,\n BrandingPreference,\n IdToken,\n getActiveTheme,\n Platform,\n extractUserClaimsFromIdToken,\n EmbeddedSignInFlowResponseV2,\n TokenResponse,\n createPackageComponentLogger,\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 BrandingProvider from '../Branding/BrandingProvider';\nimport ComponentRendererProvider from '../ComponentRenderer/ComponentRendererProvider';\nimport FlowProvider from '../Flow/FlowProvider';\nimport FlowMetaProvider from '../FlowMeta/FlowMetaProvider';\nimport I18nProvider from '../I18n/I18nProvider';\nimport OrganizationProvider from '../Organization/OrganizationProvider';\nimport ThemeProvider from '../Theme/ThemeProvider';\nimport UserProvider from '../User/UserProvider';\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 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 [currentOrganization, setCurrentOrganization] = useState<Organization | null>(null);\n\n const [isSignedInSync, setIsSignedInSync] = useState<boolean>(false);\n const [isInitializedSync, setIsInitializedSync] = useState<boolean>(false);\n const [isLoadingSync, setIsLoadingSync] = useState<boolean>(true);\n\n const [myOrganizations, setMyOrganizations] = useState<Organization[]>([]);\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 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 // Branding state\n const [brandingPreference, setBrandingPreference] = useState<BrandingPreference | null>(null);\n const [isBrandingLoading, setIsBrandingLoading] = useState<boolean>(false);\n const [brandingError, setBrandingError] = useState<Error | null>(null);\n const [hasFetchedBranding, setHasFetchedBranding] = useState<boolean>(false);\n\n useEffect(() => {\n setBaseUrl(initialBaseUrl);\n // Reset branding state when baseUrl changes\n if (initialBaseUrl !== baseUrl) {\n setHasFetchedBranding(false);\n setBrandingPreference(null);\n setBrandingError(null);\n }\n }, [initialBaseUrl, baseUrl]);\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 // TEMPORARY: SCIM2 and Organizations endpoints are not yet supported.\n // Tracker: https://github.com/asgardeo/javascript/issues/212\n const claims: User = extractUserClaimsFromIdToken(decodedToken) as User;\n setUser(claims);\n setUserProfile({\n flattenedProfile: claims,\n profile: claims,\n schemas: [],\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 const currentSignInStatus: boolean = await client.isSignedIn();\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 | EmbeddedSignInFlowResponseV2> {\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 SCIM2/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('thunderid_execution_id');\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 // Branding fetch function\n const fetchBranding: () => Promise<void> = useCallback(async (): Promise<void> => {\n if (!baseUrl) {\n return;\n }\n\n // Prevent multiple calls if already fetching\n if (isBrandingLoading) {\n return;\n }\n\n setIsBrandingLoading(true);\n setBrandingError(null);\n\n try {\n const getBrandingConfig: GetBrandingPreferenceConfig = {\n baseUrl,\n locale: preferences?.i18n?.language,\n // Add other branding config options as needed\n };\n\n const brandingData: BrandingPreference = await getBrandingPreference(getBrandingConfig);\n setBrandingPreference(brandingData);\n setHasFetchedBranding(true);\n } catch (err) {\n const errorMessage: Error = err instanceof Error ? err : new Error('Failed to fetch branding preference');\n setBrandingError(errorMessage);\n setBrandingPreference(null);\n setHasFetchedBranding(true); // Mark as fetched even on error to prevent retries\n } finally {\n setIsBrandingLoading(false);\n }\n }, [baseUrl, preferences?.i18n?.language]);\n\n // Refetch branding function\n const refetchBranding: () => Promise<void> = useCallback(async (): Promise<void> => {\n setHasFetchedBranding(false); // Reset the flag to allow refetching\n await fetchBranding();\n }, [fetchBranding]);\n\n // Auto-fetch branding when initialized and configured\n useEffect(() => {\n // TEMPORARY: Branding preference is not yet supported.\n // Tracker: https://github.com/asgardeo/javascript/issues/212\n return;\n\n // Only fetch branding when explicitly enabled via preferences.theme.inheritFromBranding\n const shouldFetchBranding: boolean = preferences?.theme?.inheritFromBranding === true;\n\n if (shouldFetchBranding && isInitializedSync && baseUrl && !hasFetchedBranding && !isBrandingLoading) {\n fetchBranding();\n }\n }, [\n preferences?.theme?.inheritFromBranding,\n isInitializedSync,\n baseUrl,\n hasFetchedBranding,\n isBrandingLoading,\n fetchBranding,\n ]);\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 switchOrganization = async (organization: Organization): Promise<TokenResponse | Response> => {\n try {\n setIsUpdatingSession(true);\n setIsLoadingSync(true);\n const response: TokenResponse | Response = await client.switchOrganization(organization);\n\n if (await client.isSignedIn()) {\n await updateSession();\n }\n\n return response;\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Failed to switch organization: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'thunderid-switchOrganization-Error',\n 'react',\n 'An error occurred while switching to the specified organization.',\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 ...prev,\n flattenedProfile: generateFlattenedUserProfile(payload, prev?.schemas),\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 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 organization: currentOrganization,\n organizationChain,\n organizationHandle: config?.organizationHandle,\n platform: Platform.ThunderID,\n reInitialize,\n recover,\n signIn,\n signInOptions,\n signInSilently,\n signInUrl,\n signOut,\n signUp,\n signUpUrl,\n switchOrganization,\n syncSession,\n user,\n }),\n [\n applicationId,\n config?.organizationHandle,\n config.afterSignInUrl,\n signInUrl,\n signUpUrl,\n baseUrl,\n clientId,\n wellKnown,\n isInitializedSync,\n isLoadingSync,\n isSignedInSync,\n currentOrganization,\n signIn,\n signInSilently,\n user,\n client,\n signInOptions,\n syncSession,\n switchOrganization,\n getDecodedIdToken,\n clearSession,\n exchangeToken,\n getAccessToken,\n getStorageManager,\n instanceId,\n organizationChain,\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}>\n <FlowMetaProvider enabled={preferences?.resolveFromMeta !== false}>\n <BrandingProvider\n brandingPreference={brandingPreference}\n isLoading={isBrandingLoading}\n error={brandingError}\n enabled={preferences?.theme?.inheritFromBranding === true}\n refetch={refetchBranding}\n >\n <ThemeProvider\n inheritFromBranding={preferences?.theme?.inheritFromBranding}\n theme={{\n ...preferences?.theme?.overrides,\n direction: preferences?.theme?.direction,\n }}\n mode={getActiveTheme(preferences?.theme?.mode)}\n >\n <FlowProvider>\n <UserProvider profile={userProfile} onUpdateProfile={handleProfileUpdate}>\n <OrganizationProvider\n getAllOrganizations={async (): Promise<AllOrganizationsApiResponse> => client.getAllOrganizations()}\n myOrganizations={myOrganizations}\n currentOrganization={currentOrganization}\n onOrganizationSwitch={switchOrganization}\n revalidateMyOrganizations={async (): Promise<Organization[]> => client.getMyOrganizations()}\n >\n <ComponentRendererProvider renderers={(extensions?.components?.renderers ?? {}) as any}>\n {children}\n </ComponentRendererProvider>\n </OrganizationProvider>\n </UserProvider>\n </FlowProvider>\n </ThemeProvider>\n </BrandingProvider>\n </FlowMetaProvider>\n </I18nProvider>\n </ThunderIDContext.Provider>\n );\n};\n\nexport default ThunderIDProvider;\n","/**\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 * - SCIM2 schemas\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","/**\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 OrganizationContext, {OrganizationContextProps} from './OrganizationContext';\n\n/**\n * Hook to access the Organization context.\n *\n * This hook provides access to organization data including:\n * - List of organizations the user belongs to\n * - Current organization\n * - Functions to switch organizations and refresh data\n * - Function to fetch organizations programmatically\n * - Loading states and error handling\n *\n * @returns {OrganizationContextProps} The organization context value containing all organization-related data and functions\n * @throws {Error} Throws an error if used outside of OrganizationProvider\n *\n * @example\n * ```tsx\n * import {useOrganization} from '@thunderid/react';\n *\n * function OrganizationSelector() {\n * const {\n * organizations,\n * currentOrganization,\n * switchOrganization,\n * revalidateMyOrganizations,\n * getOrganizations,\n * isLoading,\n * error\n * } = useOrganization();\n *\n * if (isLoading) {\n * return <div>Loading organizations...</div>;\n * }\n *\n * if (error) {\n * return <div>Error: {error}</div>;\n * }\n *\n * return (\n * <div>\n * <h2>Current: {currentOrganization?.name}</h2>\n * <select\n * value={currentOrganization?.id || ''}\n * onChange={(e) => {\n * const org = organizations?.find(o => o.id === e.target.value);\n * if (org) switchOrganization(org);\n * }}\n * >\n * {organizations?.map(org => (\n * <option key={org.id} value={org.id}>\n * {org.name}\n * </option>\n * ))}\n * </select>\n * <button onClick={revalidateMyOrganizations}>\n * Refresh Organizations\n * </button>\n * <button onClick={async () => {\n * const fresh = await getOrganizations();\n * console.log('Fresh organizations:', fresh);\n * }}>\n * Get Organizations Manually\n * </button>\n * </div>\n * );\n * }\n *\n * // Switch to a specific organization\n * function SwitchOrgButton() {\n * const {organizations, switchOrganization} = useOrganization();\n *\n * const handleSwitch = (orgId: string) => {\n * const org = organizations?.find(o => o.id === orgId);\n * if (org) {\n * switchOrganization(org);\n * }\n * };\n *\n * return (\n * <button onClick={() => handleSwitch('org-123')}>\n * Switch to Organization\n * </button>\n * );\n * }\n * ```\n */\nconst useOrganization = (): OrganizationContextProps => {\n const context: OrganizationContextProps | null = useContext(OrganizationContext);\n\n if (!context) {\n throw new Error('useOrganization must be used within an OrganizationProvider');\n }\n\n return context;\n};\n\nexport default useOrganization;\n","/**\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 FlowContext, {FlowContextValue} from './FlowContext';\n\n/**\n * Hook to access the flow context.\n * Must be used within a FlowProvider.\n *\n * @example\n * ```tsx\n * const MyAuthComponent = () => {\n * const { title, setTitle, addMessage, isLoading } = useFlow();\n *\n * const handleSuccess = () => {\n * addMessage({\n * type: 'success',\n * message: 'Authentication successful!'\n * });\n * };\n *\n * return (\n * <div>\n * <h1>{title}</h1>\n * {isLoading && <p>Loading...</p>}\n * </div>\n * );\n * };\n * ```\n *\n * @returns The flow context value\n * @throws Error if used outside of FlowProvider\n */\nconst useFlow = (): FlowContextValue => {\n const context: FlowContextValue | undefined = useContext(FlowContext);\n\n if (!context) {\n throw new Error('useFlow must be used within a FlowProvider');\n }\n\n return context;\n};\n\nexport default useFlow;\n","/**\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","/**\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 {Preferences} from '@thunderid/browser';\nimport {Context, createContext} from 'react';\n\n/**\n * Context for component-level preferences overrides.\n * Presentational components can provide this context to override the global i18n\n * and theme settings for their entire subtree, including all nested components.\n */\nconst ComponentPreferencesContext: Context<Preferences | undefined> = createContext<Preferences | undefined>(undefined);\n\nexport default ComponentPreferencesContext;\n","/**\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 deepMerge,\n I18nPreferences,\n Preferences,\n I18nBundle,\n I18nTranslations,\n normalizeTranslations,\n} from '@thunderid/browser';\nimport {useContext, useMemo} from 'react';\nimport ComponentPreferencesContext from '../contexts/I18n/ComponentPreferencesContext';\nimport I18nContext from '../contexts/I18n/I18nContext';\n\nexport interface UseTranslation {\n /**\n * All available language codes\n */\n availableLanguages: string[];\n\n /**\n * The current language code\n */\n currentLanguage: string;\n\n /**\n * Function to change the current language\n */\n setLanguage: (language: string) => void;\n\n /**\n * Translation function that returns a translated string for the given key\n */\n t: (key: string, params?: Record<string, string | number>) => string;\n}\n\nexport interface UseTranslationWithPreferences extends UseTranslation {\n /**\n * Enhanced translation function that merges component-level preferences\n */\n t: (key: string, params?: Record<string, string | number>) => string;\n}\n\n/**\n * Hook for accessing translation functions and language management.\n * Must be used within an I18nProvider context.\n *\n * @param componentPreferences - Optional component-level i18n preferences to merge with global ones\n * @returns An object containing translation function and language management utilities\n * @throws Error if used outside of I18nProvider context\n */\nconst useTranslation = (componentPreferences?: I18nPreferences): UseTranslationWithPreferences => {\n const context: any = useContext(I18nContext);\n const componentPrefs: Preferences | undefined = useContext(ComponentPreferencesContext);\n const contextPreferences: I18nPreferences | undefined = componentPrefs?.i18n;\n\n if (!context) {\n throw new Error(\n 'useTranslation must be used within an I18nProvider. Make sure your component is wrapped with ThunderIDProvider which includes I18nProvider.',\n );\n }\n\n // Direct parameter takes precedence over context-provided preferences\n const effectivePreferences: I18nPreferences | undefined = componentPreferences ?? contextPreferences;\n\n const {t: globalT, currentLanguage, setLanguage, bundles: globalBundles, fallbackLanguage} = context;\n\n // Merge global bundles with component-level bundles if provided\n const mergedBundles: Record<string, I18nBundle> = useMemo(() => {\n if (!effectivePreferences?.bundles) {\n return globalBundles;\n }\n\n const merged: Record<string, I18nBundle> = {};\n\n // Start with global bundles\n Object.entries(globalBundles).forEach(([key, bundle]: [string, I18nBundle]) => {\n merged[key] = bundle;\n });\n\n // Merge component-level bundles using deepMerge for better merging\n Object.entries(effectivePreferences.bundles).forEach(([key, componentBundle]: [string, I18nBundle]) => {\n const normalizedTranslations: I18nTranslations = normalizeTranslations(\n componentBundle.translations as unknown as Record<string, string | Record<string, string>>,\n );\n if (merged[key]) {\n // Deep merge component bundle with existing global bundle\n merged[key] = {\n ...merged[key],\n metadata: componentBundle.metadata\n ? {...merged[key].metadata, ...componentBundle.metadata}\n : merged[key].metadata,\n translations: deepMerge(merged[key].translations, normalizedTranslations),\n };\n } else {\n // No global bundle for this language, use component bundle as-is\n merged[key] = {...componentBundle, translations: normalizedTranslations};\n }\n });\n\n return merged;\n }, [globalBundles, effectivePreferences?.bundles]);\n\n // Create enhanced translation function that uses merged bundles\n const enhancedT: (key: string, params?: Record<string, string | number>) => string = useMemo(() => {\n if (!effectivePreferences?.bundles) {\n // No component preferences, use global translation function\n return globalT;\n }\n\n return (key: string, params?: Record<string, string | number>): string => {\n let translation: string | undefined;\n\n // Try to get translation from current language bundle\n const currentBundle: I18nBundle | undefined = mergedBundles[currentLanguage];\n if (currentBundle?.translations?.[key]) {\n translation = currentBundle.translations[key];\n }\n\n // Fallback to fallback language if translation not found\n if (!translation && currentLanguage !== fallbackLanguage) {\n const fallbackBundle: I18nBundle | undefined = mergedBundles[fallbackLanguage];\n if (fallbackBundle?.translations?.[key]) {\n translation = fallbackBundle.translations[key];\n }\n }\n\n // If still no translation found, return the key itself\n if (!translation) {\n translation = key;\n }\n\n // Replace parameters if provided\n if (params && Object.keys(params).length > 0) {\n return Object.entries(params).reduce(\n (acc: string, [paramKey, paramValue]: [string, string | number]) =>\n acc.replace(new RegExp(`\\\\{${paramKey}\\\\}`, 'g'), String(paramValue)),\n translation,\n );\n }\n\n return translation;\n };\n }, [mergedBundles, currentLanguage, fallbackLanguage, globalT, effectivePreferences?.bundles]);\n\n return {\n availableLanguages: Object.keys(mergedBundles),\n currentLanguage,\n setLanguage,\n t: enhancedT,\n };\n};\n\nexport default useTranslation;\n","/**\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 * Whether to validate on blur (default: true)\n */\n validateOnBlur?: boolean;\n /**\n * Whether to validate on change (default: false)\n */\n validateOnChange?: boolean;\n /**\n * Global form validator function\n */\n validator?: (values: T) => Record<string, string>;\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 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\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\n // Check required validation\n if (fieldConfig?.required && (!value || value.trim() === '')) {\n return requiredMessage;\n }\n\n // Run custom field validator\n if (fieldConfig?.validator) {\n const fieldError: string | null = fieldConfig.validator(value);\n if (fieldError) return fieldError;\n }\n\n return null;\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 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 // Validate on change if enabled\n if (validateOnChange) {\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, validateOnChange],\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","/**\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 {BrandingPreference, Theme, createPackageComponentLogger} from '@thunderid/browser';\nimport useBrandingContext from '../contexts/Branding/useBrandingContext';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'useBranding',\n);\n\n/**\n * Configuration options for the useBranding hook\n * @deprecated Use BrandingProvider instead for better performance and consistency\n */\nexport interface UseBrandingConfig {\n /**\n * @deprecated This configuration is now handled by BrandingProvider\n */\n autoFetch?: boolean;\n /**\n * @deprecated This configuration is now handled by BrandingProvider\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * @deprecated This configuration is now handled by BrandingProvider\n */\n forceTheme?: 'light' | 'dark';\n /**\n * @deprecated This configuration is now handled by BrandingProvider\n */\n locale?: string;\n /**\n * @deprecated This configuration is now handled by BrandingProvider\n */\n name?: string;\n /**\n * @deprecated This configuration is now handled by BrandingProvider\n */\n type?: string;\n}\n\n/**\n * Return type of the useBranding hook\n */\nexport interface UseBrandingReturn {\n /**\n * The active theme mode from branding preference ('light' | 'dark')\n */\n activeTheme: 'light' | 'dark' | null;\n /**\n * The raw branding preference data\n */\n brandingPreference: BrandingPreference | null;\n /**\n * Error state\n */\n error: Error | null;\n /**\n * Function to manually fetch branding preference\n */\n fetchBranding: () => Promise<void>;\n /**\n * Loading state\n */\n isLoading: boolean;\n /**\n * Function to refetch branding preference\n * This bypasses the single-call restriction and forces a new API call\n */\n refetch: () => Promise<void>;\n /**\n * The transformed theme object\n */\n theme: Theme | null;\n}\n\n/**\n * React hook for accessing branding preferences from the BrandingProvider context.\n * This hook provides access to branding preferences, theme data, and loading states.\n *\n * @deprecated Consider using useBrandingContext directly for better performance.\n * This hook is maintained for backward compatibility.\n *\n * @param config - Configuration options (deprecated, use BrandingProvider props instead)\n * @returns Object containing branding preference data, theme, loading state, error, and refetch function\n *\n * @example\n * Basic usage:\n * ```tsx\n * function MyComponent() {\n * const { theme, activeTheme, isLoading, error } = useBranding();\n *\n * if (isLoading) return <div>Loading branding...</div>;\n * if (error) return <div>Error: {error.message}</div>;\n *\n * return (\n * <div style={{ color: theme?.colors?.primary?.main }}>\n * <p>Active theme mode: {activeTheme}</p>\n * <p>Styled with ThunderID branding</p>\n * </div>\n * );\n * }\n * ```\n *\n * @example\n * For new implementations, use BrandingProvider with useBrandingContext:\n * ```tsx\n * // In your root component\n * <BrandingProvider baseUrl=\"https://api.asgardeo.io/t/your-org\">\n * <App />\n * </BrandingProvider>\n *\n * // In your component\n * function MyComponent() {\n * const { theme, activeTheme, isLoading, error } = useBrandingContext();\n * // ... rest of your component\n * }\n * ```\n */\nexport const useBranding = (): UseBrandingReturn => {\n try {\n return useBrandingContext();\n } catch (error) {\n logger.warn(\n 'useBranding: BrandingProvider not available. ' +\n 'Make sure to wrap your app with BrandingProvider or ThunderIDProvider with branding preferences.',\n );\n\n return {\n activeTheme: null,\n brandingPreference: null,\n error: new Error('BrandingProvider not available'),\n fetchBranding: async (): Promise<void> => {},\n isLoading: false,\n refetch: async (): Promise<void> => {},\n theme: null,\n };\n }\n};\n\nexport default useBranding;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nexport type ButtonColor = 'primary' | 'secondary' | 'tertiary' | string;\nexport type ButtonVariant = 'solid' | 'outline' | 'text' | 'icon';\nexport type ButtonSize = 'small' | 'medium' | 'large';\n\n/**\n * Creates styles for the Button component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param color - The button color\n * @param variant - The button variant\n * @param size - The button size\n * @param fullWidth - Whether the button should take full width\n * @param disabled - Whether the button is disabled\n * @param loading - Whether the button is in loading state\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n color: ButtonColor,\n variant: ButtonVariant,\n size: ButtonSize,\n fullWidth: boolean,\n disabled: boolean,\n loading: boolean,\n shape: 'square' | 'round' = 'square',\n): Record<string, string | null> =>\n useMemo(() => {\n const iconSizeMap: Record<string, string> = {\n large: `calc(${theme.vars.spacing.unit} * 5)`,\n medium: `calc(${theme.vars.spacing.unit} * 4)`,\n small: `calc(${theme.vars.spacing.unit} * 3)`,\n };\n\n const iconDimension: string = iconSizeMap[size] || iconSizeMap['medium'];\n\n const baseButton: string = css`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: calc(${theme.vars.spacing.unit} * 1);\n border-radius: ${shape === 'round'\n ? '50%'\n : theme.vars.components?.Button?.root?.borderRadius || theme.vars.borderRadius.medium};\n font-weight: 500;\n cursor: ${disabled || loading ? 'not-allowed' : 'pointer'};\n outline: none;\n text-decoration: none;\n white-space: nowrap;\n width: ${fullWidth ? '100%' : 'auto'};\n opacity: ${disabled || loading ? 0.6 : 1};\n font-family: ${theme.vars.typography.fontFamily};\n border-width: 1px;\n border-style: solid;\n ${variant === 'icon'\n ? `\n padding: 0;\n min-width: unset;\n min-height: unset;\n width: ${iconDimension};\n height: ${iconDimension};\n justify-content: center;\n align-items: center;\n `\n : ''}\n `;\n\n const sizeStyles: Record<string, string> = {\n large: css`\n ${variant === 'icon'\n ? `font-size: ${theme.vars.typography.fontSizes.lg};`\n : `padding: calc(${theme.vars.spacing.unit} * 1.5) calc(${theme.vars.spacing.unit} * 3);\n font-size: ${theme.vars.typography.fontSizes.lg};\n min-height: calc(${theme.vars.spacing.unit} * 5);`}\n `,\n medium: css`\n ${variant === 'icon'\n ? `font-size: ${theme.vars.typography.fontSizes.md};`\n : `padding: calc(${theme.vars.spacing.unit} * 1) calc(${theme.vars.spacing.unit} * 2);\n font-size: ${theme.vars.typography.fontSizes.md};\n min-height: calc(${theme.vars.spacing.unit} * 4);`}\n `,\n small: css`\n ${variant === 'icon'\n ? `font-size: ${theme.vars.typography.fontSizes.sm};`\n : `padding: calc(${theme.vars.spacing.unit} * 0.5) calc(${theme.vars.spacing.unit} * 1);\n font-size: ${theme.vars.typography.fontSizes.sm};\n min-height: calc(${theme.vars.spacing.unit} * 3);`}\n `,\n };\n\n const variantStyles: Record<string, string> = {\n 'primary-icon': css`\n background-color: transparent;\n color: ${theme.vars.colors.primary.main};\n border-color: transparent;\n &:hover:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.hover};\n color: ${theme.vars.colors.primary.dark};\n }\n &:active:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.selected};\n color: ${theme.vars.colors.primary.dark};\n }\n &:focus:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.focus};\n color: ${theme.vars.colors.primary.dark};\n outline: none;\n }\n `,\n 'primary-outline': css`\n background-color: transparent;\n color: ${theme.vars.colors.primary.main};\n border-color: ${theme.vars.colors.primary.main};\n &:hover:not(:disabled) {\n background-color: ${theme.vars.colors.primary.main};\n color: ${theme.vars.colors.primary.contrastText};\n }\n &:active:not(:disabled) {\n background-color: ${theme.vars.colors.primary.main};\n color: ${theme.vars.colors.primary.contrastText};\n opacity: 0.9;\n }\n &:focus:not(:disabled) {\n background-color: ${theme.vars.colors.primary.main};\n color: ${theme.vars.colors.primary.contrastText};\n opacity: 0.9;\n }\n `,\n 'primary-solid': css`\n background-color: ${theme.vars.colors.primary.main};\n color: ${theme.vars.colors.primary.contrastText};\n border-color: ${theme.vars.colors.primary.main};\n &:hover:not(:disabled) {\n background-color: ${theme.vars.colors.primary.main};\n opacity: 0.9;\n }\n &:active:not(:disabled) {\n background-color: ${theme.vars.colors.primary.main};\n opacity: 0.8;\n }\n &:focus:not(:disabled) {\n background-color: ${theme.vars.colors.primary.main};\n opacity: 0.8;\n }\n `,\n 'primary-text': css`\n background-color: transparent;\n color: ${theme.vars.colors.primary.main};\n border-color: transparent;\n &:hover:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.hover};\n }\n &:active:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.selected};\n }\n &:focus:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.focus};\n outline: none;\n }\n `,\n 'secondary-icon': css`\n background-color: transparent;\n color: ${theme.vars.colors.secondary.main};\n border-color: transparent;\n &:hover:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.hover};\n color: ${theme.vars.colors.secondary.dark};\n }\n &:active:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.selected};\n color: ${theme.vars.colors.secondary.dark};\n }\n &:focus:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.focus};\n color: ${theme.vars.colors.secondary.dark};\n outline: none;\n }\n `,\n 'secondary-outline': css`\n background-color: transparent;\n color: ${theme.vars.colors.secondary.main};\n border-color: ${theme.vars.colors.secondary.main};\n &:hover:not(:disabled) {\n background-color: ${theme.vars.colors.secondary.main};\n color: ${theme.vars.colors.secondary.contrastText};\n }\n &:active:not(:disabled) {\n background-color: ${theme.vars.colors.secondary.main};\n color: ${theme.vars.colors.secondary.contrastText};\n opacity: 0.9;\n }\n &:focus:not(:disabled) {\n background-color: ${theme.vars.colors.secondary.main};\n color: ${theme.vars.colors.secondary.contrastText};\n opacity: 0.9;\n }\n `,\n 'secondary-solid': css`\n background-color: ${theme.vars.colors.secondary.main};\n color: ${theme.vars.colors.secondary.contrastText};\n border-color: ${theme.vars.colors.secondary.main};\n &:hover:not(:disabled) {\n background-color: ${theme.vars.colors.secondary.main};\n opacity: 0.9;\n }\n &:active:not(:disabled) {\n background-color: ${theme.vars.colors.secondary.main};\n opacity: 0.8;\n }\n &:focus:not(:disabled) {\n background-color: ${theme.vars.colors.secondary.main};\n opacity: 0.8;\n }\n `,\n 'secondary-text': css`\n background-color: transparent;\n color: ${theme.vars.colors.secondary.main};\n border-color: transparent;\n &:hover:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.hover};\n }\n &:active:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.selected};\n }\n &:focus:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.focus};\n outline: none;\n }\n `,\n 'tertiary-icon': css`\n background-color: transparent;\n color: ${theme.vars.colors.text.secondary};\n border-color: transparent;\n &:hover:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.hover};\n color: ${theme.vars.colors.text.primary};\n }\n &:active:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.selected};\n color: ${theme.vars.colors.text.primary};\n }\n &:focus:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.focus};\n color: ${theme.vars.colors.text.primary};\n outline: none;\n }\n `,\n 'tertiary-outline': css`\n background-color: transparent;\n color: ${theme.vars.colors.text.secondary};\n border-color: ${theme.vars.colors.border};\n &:hover:not(:disabled) {\n background-color: ${theme.vars.colors.action.hover};\n border-color: ${theme.vars.colors.text.secondary};\n }\n &:active:not(:disabled) {\n background-color: ${theme.vars.colors.action.selected};\n border-color: ${theme.vars.colors.text.primary};\n }\n &:focus:not(:disabled) {\n background-color: ${theme.vars.colors.action.focus};\n border-color: ${theme.vars.colors.text.primary};\n }\n `,\n 'tertiary-solid': css`\n background-color: ${theme.vars.colors.text.secondary};\n color: ${theme.vars.colors.background.surface};\n border-color: ${theme.vars.colors.text.secondary};\n &:hover:not(:disabled) {\n background-color: ${theme.vars.colors.text.primary};\n color: ${theme.vars.colors.background.surface};\n }\n &:active:not(:disabled) {\n background-color: ${theme.vars.colors.text.primary};\n color: ${theme.vars.colors.background.surface};\n opacity: 0.9;\n }\n &:focus:not(:disabled) {\n background-color: ${theme.vars.colors.text.primary};\n color: ${theme.vars.colors.background.surface};\n opacity: 0.9;\n }\n `,\n 'tertiary-text': css`\n background-color: transparent;\n color: ${theme.vars.colors.text.secondary};\n border-color: transparent;\n &:hover:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.hover};\n color: ${theme.vars.colors.text.primary};\n }\n &:active:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.selected};\n color: ${theme.vars.colors.text.primary};\n }\n &:focus:not(:disabled) {\n border-color: transparent;\n background-color: ${theme.vars.colors.action.focus};\n color: ${theme.vars.colors.text.primary};\n outline: none;\n }\n `,\n };\n\n const spinnerStyles: string = css`\n display: flex;\n align-items: center;\n justify-content: center;\n `;\n\n const iconStyles: string = css`\n display: flex;\n align-items: center;\n justify-content: center;\n `;\n\n const contentStyles: string = css`\n display: flex;\n align-items: center;\n justify-content: center;\n `;\n\n return {\n button: baseButton,\n content: contentStyles,\n endIcon: iconStyles,\n fullWidth: fullWidth\n ? css`\n width: 100%;\n `\n : null,\n icon: iconStyles,\n loading: loading\n ? css`\n pointer-events: none;\n `\n : null,\n shape:\n shape === 'round'\n ? css`\n border-radius: 50%;\n `\n : null,\n size: sizeStyles[size],\n spinner: spinnerStyles,\n startIcon: iconStyles,\n variant: variantStyles[`${color}-${variant}`] || variantStyles['primary-solid'],\n };\n }, [theme, colorScheme, color, variant, size, fullWidth, disabled, loading]);\n\nexport default useStyles;\n","/**\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 {css, keyframes} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nexport type SpinnerSize = 'small' | 'medium' | 'large';\n\n/**\n * Creates styles for the Spinner component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param size - The size of the spinner\n * @param color - The color of the spinner\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string, size: SpinnerSize, color?: string): Record<string, string> =>\n useMemo(() => {\n const spinnerColor: string = color || theme.vars.colors.primary.main;\n\n const spinnerSizes: Record<string, string> = {\n large: '32px',\n medium: '20px',\n small: '16px',\n };\n\n const spinnerSize: string = spinnerSizes[size];\n\n const spinAnimation: string = keyframes`\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n `;\n\n const spinner: string = css`\n width: ${spinnerSize};\n height: ${spinnerSize};\n border: 2px solid transparent;\n border-top: 2px solid ${spinnerColor};\n border-radius: 50%;\n animation: ${spinAnimation} 1s linear infinite;\n display: inline-block;\n `;\n\n const spinnerSmall: string = css`\n width: ${spinnerSizes['small']};\n height: ${spinnerSizes['small']};\n `;\n\n const spinnerMedium: string = css`\n width: ${spinnerSizes['medium']};\n height: ${spinnerSizes['medium']};\n `;\n\n const spinnerLarge: string = css`\n width: ${spinnerSizes['large']};\n height: ${spinnerSizes['large']};\n `;\n\n return {\n spinner,\n spinnerLarge,\n spinnerMedium,\n spinnerSmall,\n };\n }, [theme, colorScheme, size, color]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC, CSSProperties} from 'react';\nimport useStyles from './Spinner.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\n\nexport type SpinnerSize = 'small' | 'medium' | 'large';\n\nexport interface SpinnerProps {\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Custom color for the spinner\n */\n color?: string;\n /**\n * Size of the spinner\n */\n size?: SpinnerSize;\n /**\n * Custom styles\n */\n style?: CSSProperties;\n}\n\n/**\n * Spinner component for loading states\n *\n * @example\n * ```tsx\n * // Basic spinner\n * <Spinner />\n *\n * // Large spinner with custom color\n * <Spinner size=\"large\" color=\"#3b82f6\" />\n *\n * // Small spinner\n * <Spinner size=\"small\" />\n * ```\n */\nconst Spinner: FC<SpinnerProps> = ({size = 'medium', color, className, style}: SpinnerProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, size, color);\n\n const spinnerClassName: string = cx(\n withVendorCSSClassPrefix(bem('spinner')),\n styles['spinner'],\n size === 'small' && styles['spinnerSmall'],\n size === 'medium' && styles['spinnerMedium'],\n size === 'large' && styles['spinnerLarge'],\n className,\n );\n\n return <span className={spinnerClassName} style={style} role=\"status\" aria-label=\"Loading\" />;\n};\n\nexport default Spinner;\n","/**\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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {ButtonHTMLAttributes, forwardRef, ReactNode, ForwardRefExoticComponent, RefAttributes, Ref} from 'react';\nimport useStyles from './Button.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport Spinner, {SpinnerSize} from '../Spinner/Spinner';\n\nexport type ButtonColor = 'primary' | 'secondary' | 'tertiary' | string;\nexport type ButtonVariant = 'solid' | 'outline' | 'text' | 'icon';\nexport type ButtonSize = 'small' | 'medium' | 'large';\n\nexport interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'> {\n /**\n * The button color that determines the color scheme\n */\n color?: ButtonColor;\n /**\n * Icon to display after the button text\n */\n endIcon?: ReactNode;\n /**\n * Whether the button should take the full width of its container\n */\n fullWidth?: boolean;\n /**\n * Whether the button is in a loading state\n */\n loading?: boolean;\n /**\n * The shape of the button: square or round\n */\n shape?: 'square' | 'round';\n /**\n * The size of the button\n */\n size?: ButtonSize;\n /**\n * Icon to display before the button text\n */\n startIcon?: ReactNode;\n /**\n * The button variant that determines the visual style\n */\n variant?: ButtonVariant;\n}\n\nconst getSpinnerWidth = (sizeVal: ButtonSize, spacingUnit: string): string => {\n if (sizeVal === 'small') {\n return `calc(${spacingUnit} * 1.5)`;\n }\n if (sizeVal === 'medium') {\n return `calc(${spacingUnit} * 2)`;\n }\n return `calc(${spacingUnit} * 2.5)`;\n};\n\n/**\n * Button component with multiple variants and types.\n *\n * @example\n * ```tsx\n * // Primary solid button\n * <Button color=\"primary\" variant=\"solid\">\n * Click me\n * </Button>\n *\n * // Secondary outline button\n * <Button color=\"secondary\" variant=\"outline\" size=\"large\">\n * Cancel\n * </Button>\n *\n * // Text button with loading state\n * <Button color=\"tertiary\" variant=\"text\" loading>\n * Loading...\n * </Button>\n *\n * // Button with icons\n * <Button\n * color=\"primary\"\n * startIcon={<Icon />}\n * endIcon={<Arrow />}\n * >\n * Save and Continue\n * </Button>\n * ```\n */\nconst Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLButtonElement>> = forwardRef<\n HTMLButtonElement,\n ButtonProps\n>(\n (\n {\n color = 'primary',\n variant = 'solid',\n size = 'medium',\n fullWidth = false,\n loading = false,\n startIcon,\n endIcon,\n children,\n className,\n disabled,\n style,\n shape = 'square',\n ...rest\n }: ButtonProps,\n ref: Ref<HTMLButtonElement>,\n ) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(\n theme,\n colorScheme,\n color,\n variant,\n size,\n fullWidth,\n disabled || false,\n loading,\n shape,\n );\n\n const isIconVariant: boolean = variant === 'icon';\n\n const spinnerWidth: string = getSpinnerWidth(size, theme.vars.spacing.unit);\n\n return (\n <button\n ref={ref}\n style={style}\n className={cx(\n withVendorCSSClassPrefix(bem('button')),\n withVendorCSSClassPrefix(bem('button', variant)),\n withVendorCSSClassPrefix(bem('button', color)),\n withVendorCSSClassPrefix(bem('button', size)),\n withVendorCSSClassPrefix(bem('button', shape)),\n fullWidth ? withVendorCSSClassPrefix(bem('button', 'fullWidth')) : undefined,\n loading ? withVendorCSSClassPrefix(bem('button', 'loading')) : undefined,\n disabled || loading ? withVendorCSSClassPrefix(bem('button', 'disabled')) : undefined,\n styles['button'],\n styles['size'],\n styles['variant'],\n styles['fullWidth'],\n styles['loading'],\n styles['shape'],\n className,\n )}\n disabled={disabled || loading}\n {...rest}\n >\n {loading && (\n <span className={cx(withVendorCSSClassPrefix(bem('button', 'spinner')), styles['spinner'])}>\n <Spinner\n size={size as SpinnerSize}\n color=\"currentColor\"\n style={{\n height: spinnerWidth,\n width: spinnerWidth,\n }}\n />\n </span>\n )}\n {!loading && isIconVariant && (\n <span className={cx(withVendorCSSClassPrefix(bem('button', 'icon')), styles['icon'])}>\n {children || startIcon || endIcon}\n </span>\n )}\n {!loading && !isIconVariant && startIcon && (\n <span className={cx(withVendorCSSClassPrefix(bem('button', 'start-icon')), styles['startIcon'])}>\n {startIcon}\n </span>\n )}\n {!isIconVariant && children && (\n <span className={cx(withVendorCSSClassPrefix(bem('button', 'content')), styles['content'])}>{children}</span>\n )}\n {!loading && !isIconVariant && endIcon && (\n <span className={cx(withVendorCSSClassPrefix(bem('button', 'end-icon')), styles['endIcon'])}>{endIcon}</span>\n )}\n </button>\n );\n },\n);\n\nButton.displayName = 'Button';\n\nexport default Button;\n","/**\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 {cx} from '@emotion/css';\nimport {FlowMetadataResponse, WithPreferences, withVendorCSSClassPrefix} from '@thunderid/browser';\nimport {\n ButtonHTMLAttributes,\n forwardRef,\n ForwardRefExoticComponent,\n ReactElement,\n ReactNode,\n Ref,\n RefAttributes,\n} from 'react';\nimport Button from '../../primitives/Button/Button';\n\n/**\n * Common props shared by all {@link BaseSignInButton} components.\n */\nexport interface CommonBaseSignInButtonProps {\n /**\n * Loading state during sign-in process\n */\n isLoading?: boolean;\n /**\n * Flow metadata returned by the platform (v2 only). `null` while loading or unavailable.\n */\n meta?: FlowMetadataResponse | null;\n /**\n * Function to initiate the sign-in process\n */\n signIn: () => Promise<void>;\n}\n\n/**\n * Props passed to the render function of {@link BaseSignInButton}\n */\nexport type BaseSignInButtonRenderProps = CommonBaseSignInButtonProps;\n\n/**\n * Props interface of {@link BaseSignInButton}\n */\nexport interface BaseSignInButtonProps\n extends Partial<CommonBaseSignInButtonProps>,\n Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>,\n WithPreferences {\n /**\n * Render prop function that receives sign-in props, or traditional ReactNode children\n */\n children?: ((props: BaseSignInButtonRenderProps) => ReactNode) | ReactNode;\n}\n\n/**\n * Base SignInButton component that supports both render props and traditional props patterns.\n *\n * @example Using render props\n * ```tsx\n * <BaseSignInButton>\n * {({signIn, isLoading}) => (\n * <button onClick={signIn} disabled={isLoading}>\n * {isLoading ? 'Signing in...' : 'Sign In'}\n * </button>\n * )}\n * </BaseSignInButton>\n * ```\n *\n * @example Using traditional props\n * ```tsx\n * <BaseSignInButton className=\"custom-button\">Sign In</BaseSignInButton>\n * ```\n */\nconst BaseSignInButton: ForwardRefExoticComponent<BaseSignInButtonProps & RefAttributes<HTMLButtonElement>> =\n forwardRef<HTMLButtonElement, BaseSignInButtonProps>(\n (\n {children, className, style, signIn, isLoading, meta, preferences, ...rest}: BaseSignInButtonProps,\n ref: Ref<HTMLButtonElement>,\n ): ReactElement => {\n if (typeof children === 'function') {\n return <>{children({isLoading, meta, signIn})}</>;\n }\n\n return (\n <Button\n ref={ref}\n className={cx(withVendorCSSClassPrefix('sign-in-button'), className)}\n style={style}\n disabled={isLoading}\n loading={isLoading}\n type=\"button\"\n {...rest}\n >\n {children}\n </Button>\n );\n },\n );\n\nBaseSignInButton.displayName = 'BaseSignInButton';\n\nexport default BaseSignInButton;\n","/**\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 {ThunderIDRuntimeError, navigate} from '@thunderid/browser';\nimport {forwardRef, ForwardRefExoticComponent, MouseEvent, ReactElement, Ref, RefAttributes, useState} from 'react';\nimport BaseSignInButton, {BaseSignInButtonProps} from './BaseSignInButton';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\nimport useTranslation from '../../../hooks/useTranslation';\n\n/**\n * Props interface of {@link SignInButton}\n */\nexport type SignInButtonProps = BaseSignInButtonProps & {\n /**\n * Additional parameters to pass to the `authorize` request.\n */\n signInOptions?: Record<string, any>;\n};\n\n/**\n * SignInButton component that supports both render props and traditional props patterns.\n *\n * @remarks This component is only supported in browser based React applications (CSR).\n *\n * @example Using render props\n * ```tsx\n * <SignInButton>\n * {({signIn, isLoading}) => (\n * <button onClick={signIn} disabled={isLoading}>\n * {isLoading ? 'Signing in...' : 'Sign In'}\n * </button>\n * )}\n * </SignInButton>\n * ```\n *\n * @example Using traditional props\n * ```tsx\n * <SignInButton className=\"custom-button\">Sign In</SignInButton>\n * ```\n *\n * @example Using component-level preferences\n * ```tsx\n * <SignInButton\n * preferences={{\n * i18n: {\n * bundles: {\n * 'en-US': {\n * translations: {\n * 'buttons.signIn': 'Custom Sign In Text'\n * }\n * }\n * }\n * }\n * }}\n * >\n * Custom Sign In\n * </SignInButton>\n * ```\n */\nconst SignInButton: ForwardRefExoticComponent<SignInButtonProps & RefAttributes<HTMLButtonElement>> = forwardRef<\n HTMLButtonElement,\n SignInButtonProps\n>(\n (\n {children, onClick, preferences, signInOptions: overriddenSignInOptions = {}, ...rest}: SignInButtonProps,\n ref: Ref<HTMLButtonElement>,\n ): ReactElement => {\n const {signIn, signInUrl, signInOptions, meta} = useThunderID();\n const {t} = useTranslation(preferences?.i18n);\n\n const [isLoading, setIsLoading] = useState(false);\n\n const handleSignIn = async (e?: MouseEvent<HTMLButtonElement>): Promise<void> => {\n try {\n setIsLoading(true);\n\n // If a custom `signInUrl` is provided, use it for navigation.\n if (signInUrl) {\n navigate(signInUrl);\n } else {\n await signIn(overriddenSignInOptions ?? signInOptions);\n }\n\n if (onClick) {\n onClick(e);\n }\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Sign in failed: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'SignInButton-handleSignIn-RuntimeError-001',\n 'react',\n 'Something went wrong while trying to sign in. Please try again later.',\n );\n } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <BaseSignInButton\n ref={ref}\n onClick={handleSignIn}\n isLoading={isLoading}\n meta={meta}\n signIn={handleSignIn}\n preferences={preferences}\n {...rest}\n >\n {children ?? t('elements.buttons.signin.text')}\n </BaseSignInButton>\n );\n },\n);\n\nSignInButton.displayName = 'SignInButton';\n\nexport default SignInButton;\n","/**\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 {cx} from '@emotion/css';\nimport {FlowMetadataResponse, WithPreferences, withVendorCSSClassPrefix} from '@thunderid/browser';\nimport {\n forwardRef,\n ForwardRefExoticComponent,\n ButtonHTMLAttributes,\n ReactElement,\n ReactNode,\n Ref,\n RefAttributes,\n} from 'react';\nimport Button from '../../primitives/Button/Button';\n\n/**\n * Common props shared by all {@link BaseSignOutButton} components.\n */\nexport interface CommonBaseSignOutButtonProps {\n /**\n * Loading state during sign-out process\n */\n isLoading?: boolean;\n /**\n * Flow metadata returned by the platform (v2 only). `null` while loading or unavailable.\n */\n meta?: FlowMetadataResponse | null;\n /**\n * Function to initiate the sign-out process\n */\n signOut: () => Promise<void>;\n}\n\n/**\n * Props passed to the render function of {@link BaseSignOutButton}\n */\nexport type BaseSignOutButtonRenderProps = CommonBaseSignOutButtonProps;\n\n/**\n * Props interface of {@link BaseSignOutButton}\n */\nexport interface BaseSignOutButtonProps\n extends Partial<CommonBaseSignOutButtonProps>,\n Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>,\n WithPreferences {\n /**\n * Render prop function that receives sign-out props, or traditional ReactNode children\n */\n children?: ((props: BaseSignOutButtonRenderProps) => ReactNode) | ReactNode;\n}\n\n/**\n * Base SignOutButton component that supports both render props and traditional props patterns.\n *\n * @example Using render props\n * ```tsx\n * <BaseSignOutButton>\n * {({signOut, isLoading}) => (\n * <button onClick={signOut} disabled={isLoading}>\n * {isLoading ? 'Signing out...' : 'Sign Out'}\n * </button>\n * )}\n * </BaseSignOutButton>\n * ```\n *\n * @example Using traditional props\n * ```tsx\n * <BaseSignOutButton className=\"custom-button\">Sign Out</BaseSignOutButton>\n * ```\n */\nconst BaseSignOutButton: ForwardRefExoticComponent<BaseSignOutButtonProps & RefAttributes<HTMLButtonElement>> =\n forwardRef<HTMLButtonElement, BaseSignOutButtonProps>(\n (\n {children, className, style, signOut, isLoading, meta, preferences, ...rest}: BaseSignOutButtonProps,\n ref: Ref<HTMLButtonElement>,\n ): ReactElement => {\n if (typeof children === 'function') {\n return <>{children({isLoading, meta, signOut})}</>;\n }\n\n return (\n <Button\n ref={ref}\n className={cx(withVendorCSSClassPrefix('sign-out-button'), className)}\n style={style}\n disabled={isLoading}\n loading={isLoading}\n type=\"button\"\n {...rest}\n >\n {children}\n </Button>\n );\n },\n );\n\nBaseSignOutButton.displayName = 'BaseSignOutButton';\n\nexport default BaseSignOutButton;\n","/**\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 {ThunderIDRuntimeError} from '@thunderid/browser';\nimport {forwardRef, ForwardRefExoticComponent, MouseEvent, ReactElement, Ref, RefAttributes, useState} from 'react';\nimport BaseSignOutButton, {BaseSignOutButtonProps} from './BaseSignOutButton';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\nimport useTranslation from '../../../hooks/useTranslation';\n\n/**\n * Props interface of {@link SignOutButton}\n */\nexport type SignOutButtonProps = BaseSignOutButtonProps;\n\n/**\n * SignOutButton component that supports both render props and traditional props patterns.\n *\n * @remarks This component is only supported in browser based React applications (CSR).\n *\n * @example Using render props pattern\n * ```tsx\n * <SignOutButton>\n * {({signOut, isLoading}) => (\n * <button onClick={signOut} disabled={isLoading}>\n * {isLoading ? 'Signing out...' : 'Sign Out'}\n * </button>\n * )}\n * </SignOutButton>\n * ```\n *\n * @example Using traditional props pattern\n * ```tsx\n * <SignOutButton className=\"custom-button\">Sign Out</SignOutButton>\n * ```\n *\n * @example Using component-level preferences\n * ```tsx\n * <SignOutButton\n * preferences={{\n * i18n: {\n * bundles: {\n * 'en-US': {\n * translations: {\n * 'buttons.signOut': 'Custom Sign Out Text'\n * }\n * }\n * }\n * }\n * }}\n * >\n * Custom Sign Out\n * </SignOutButton>\n * ```\n */\nconst SignOutButton: ForwardRefExoticComponent<SignOutButtonProps & RefAttributes<HTMLButtonElement>> = forwardRef<\n HTMLButtonElement,\n SignOutButtonProps\n>(({children, onClick, preferences, ...rest}: SignOutButtonProps, ref: Ref<HTMLButtonElement>): ReactElement => {\n const {signOut, meta} = useThunderID();\n const {t} = useTranslation(preferences?.i18n);\n\n const [isLoading, setIsLoading] = useState(false);\n\n const handleSignOut = async (e?: MouseEvent<HTMLButtonElement>): Promise<void> => {\n try {\n setIsLoading(true);\n\n await signOut();\n\n if (onClick) {\n onClick(e);\n }\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Sign out failed: ${error instanceof Error ? error.message : String(error)}`,\n 'SignOutButton-handleSignOut-RuntimeError-001',\n 'react',\n 'Something went wrong while trying to sign out. Please try again later.',\n );\n } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <BaseSignOutButton\n ref={ref}\n onClick={handleSignOut}\n isLoading={isLoading}\n meta={meta}\n signOut={handleSignOut}\n preferences={preferences}\n {...rest}\n >\n {children ?? t('elements.buttons.signout.text')}\n </BaseSignOutButton>\n );\n});\n\nSignOutButton.displayName = 'SignOutButton';\n\nexport default SignOutButton;\n","/**\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 {cx} from '@emotion/css';\nimport {FlowMetadataResponse, WithPreferences, withVendorCSSClassPrefix} from '@thunderid/browser';\nimport {\n forwardRef,\n ForwardRefExoticComponent,\n ButtonHTMLAttributes,\n ReactElement,\n ReactNode,\n Ref,\n RefAttributes,\n} from 'react';\nimport Button from '../../primitives/Button/Button';\n\n/**\n * Common props shared by all {@link BaseSignUpButton} components.\n */\nexport interface CommonBaseSignUpButtonProps {\n /**\n * Loading state during sign-up process\n */\n isLoading?: boolean;\n /**\n * Flow metadata returned by the platform (v2 only). `null` while loading or unavailable.\n */\n meta?: FlowMetadataResponse | null;\n /**\n * Function to initiate the sign-up process\n */\n signUp?: () => Promise<void>;\n}\n\n/**\n * Props passed to the render function of {@link BaseSignUpButton}\n */\nexport type BaseSignUpButtonRenderProps = CommonBaseSignUpButtonProps;\n\n/**\n * Props interface of {@link BaseSignUpButton}\n */\nexport interface BaseSignUpButtonProps\n extends CommonBaseSignUpButtonProps,\n Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>,\n WithPreferences {\n /**\n * Render prop function that receives sign-up props, or traditional ReactNode children\n */\n children?: ((props: BaseSignUpButtonRenderProps) => ReactNode) | ReactNode;\n}\n\n/**\n * Base SignUpButton component that supports both render props and traditional props patterns.\n *\n * @example Using render props\n * ```tsx\n * <BaseSignUpButton>\n * {({ signUp, isLoading }) => (\n * <button onClick={signUp} disabled={isLoading}>\n * {isLoading ? 'Creating account...' : 'Create Account'}\n * </button>\n * )}\n * </BaseSignUpButton>\n * ```\n *\n * @example Using traditional props\n * ```tsx\n * <BaseSignUpButton className=\"custom-button\">Create Account</BaseSignUpButton>\n * ```\n */\nconst BaseSignUpButton: ForwardRefExoticComponent<BaseSignUpButtonProps & RefAttributes<HTMLButtonElement>> =\n forwardRef<HTMLButtonElement, BaseSignUpButtonProps>(\n (\n {children, className, style, signUp, isLoading, meta, preferences, ...rest}: BaseSignUpButtonProps,\n ref: Ref<HTMLButtonElement>,\n ): ReactElement => {\n if (typeof children === 'function') {\n return <>{children({isLoading, meta, signUp})}</>;\n }\n\n return (\n <Button\n ref={ref}\n className={cx(withVendorCSSClassPrefix('sign-up-button'), className)}\n style={style}\n disabled={isLoading}\n loading={isLoading}\n type=\"button\"\n color=\"primary\"\n variant=\"solid\"\n {...rest}\n >\n {children}\n </Button>\n );\n },\n );\n\nBaseSignUpButton.displayName = 'BaseSignUpButton';\n\nexport default BaseSignUpButton;\n","/**\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 {ThunderIDRuntimeError, navigate} from '@thunderid/browser';\nimport {forwardRef, ForwardRefExoticComponent, MouseEvent, ReactElement, Ref, RefAttributes, useState} from 'react';\nimport BaseSignUpButton, {BaseSignUpButtonProps} from './BaseSignUpButton';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\nimport useTranslation from '../../../hooks/useTranslation';\n\n/**\n * Props interface of {@link SignUpButton}\n */\nexport type SignUpButtonProps = BaseSignUpButtonProps;\n\n/**\n * SignUpButton component that supports both render props and traditional props patterns.\n * It redirects the user to the ThunderID sign-up page configured for the application.\n *\n * @remarks This component is only supported in browser based React applications (CSR).\n *\n * @example Using render props pattern\n * ```tsx\n * <SignUpButton>\n * {({ signUp, isLoading }) => (\n * <button onClick={signUp} disabled={isLoading}>\n * {isLoading ? 'Creating Account...' : 'Create Account'}\n * </button>\n * )}\n * </SignUpButton>\n * ```\n *\n * @example Using traditional props pattern\n * ```tsx\n * <SignUpButton className=\"custom-button\">Create Account</SignUpButton>\n * ```\n *\n * @example Using component-level preferences\n * ```tsx\n * <SignUpButton\n * preferences={{\n * i18n: {\n * bundles: {\n * 'en-US': {\n * translations: {\n * 'buttons.signUp': 'Custom Sign Up Text'\n * }\n * }\n * }\n * }\n * }}\n * >\n * Custom Sign Up\n * </SignUpButton>\n * ```\n */\nconst SignUpButton: ForwardRefExoticComponent<SignUpButtonProps & RefAttributes<HTMLButtonElement>> = forwardRef<\n HTMLButtonElement,\n SignUpButtonProps\n>(({children, onClick, preferences, ...rest}: SignUpButtonProps, ref: Ref<HTMLButtonElement>): ReactElement => {\n const {signUp, signUpUrl, meta} = useThunderID();\n const {t} = useTranslation(preferences?.i18n);\n\n const [isLoading, setIsLoading] = useState(false);\n\n const handleSignUp = async (e?: MouseEvent<HTMLButtonElement>): Promise<void> => {\n try {\n setIsLoading(true);\n\n // If a custom `signUpUrl` is provided, use it for navigation.\n if (signUpUrl) {\n navigate(signUpUrl);\n } else {\n await signUp();\n }\n\n if (onClick) {\n onClick(e);\n }\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Sign up failed: ${error instanceof Error ? error.message : String(error)}`,\n 'SignUpButton-handleSignUp-RuntimeError-001',\n 'react',\n 'Something went wrong while trying to sign up. Please try again later.',\n );\n } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <BaseSignUpButton\n ref={ref}\n onClick={handleSignUp}\n isLoading={isLoading}\n meta={meta}\n signUp={handleSignUp}\n preferences={preferences}\n {...rest}\n >\n {children ?? t('elements.buttons.signup.text')}\n </BaseSignUpButton>\n );\n});\n\nSignUpButton.displayName = 'SignUpButton';\n\nexport default SignUpButton;\n","/**\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 {FC, PropsWithChildren, ReactNode} from 'react';\nimport useThunderID from '../../contexts/ThunderID/useThunderID';\n\n/**\n * Props for the SignedIn component.\n */\nexport interface SignedInProps {\n /**\n * Content to show when the user is not signed in.\n */\n fallback?: ReactNode;\n}\n\n/**\n * A component that only renders its children when the user is signed in.\n *\n * @remarks This component is only supported in browser based React applications (CSR).\n *\n * @example\n * ```tsx\n * import { SignedIn } from '@thunderid/auth-react';\n *\n * const App = () => {\n * return (\n * <SignedIn fallback={<p>Please sign in to continue</p>}>\n * <p>Welcome! You are signed in.</p>\n * </SignedIn>\n * );\n * }\n * ```\n */\nconst SignedIn: FC<PropsWithChildren<SignedInProps>> = ({\n children,\n fallback = null,\n}: PropsWithChildren<SignedInProps>) => {\n const {isSignedIn} = useThunderID();\n\n if (!isSignedIn) {\n return <>{fallback}</>;\n }\n\n return <>{children}</>;\n};\n\nSignedIn.displayName = 'SignedIn';\n\nexport default SignedIn;\n","/**\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 {FC, PropsWithChildren, ReactNode} from 'react';\nimport useThunderID from '../../contexts/ThunderID/useThunderID';\n\n/**\n * Props for the SignedOut component.\n */\nexport interface SignedOutProps {\n /**\n * Content to show when the user is signed in.\n */\n fallback?: ReactNode;\n}\n\n/**\n * A component that only renders its children when the user is signed out.\n *\n * @remarks This component is only supported in browser based React applications (CSR).\n *\n * @example\n * ```tsx\n * import { SignedOut } from '@thunderid/auth-react';\n *\n * const App = () => {\n * return (\n * <SignedOut fallback={<p>You are already signed in</p>}>\n * <p>Please sign in to continue</p>\n * </SignedOut>\n * );\n * }\n * ```\n */\nconst SignedOut: FC<PropsWithChildren<SignedOutProps>> = ({\n children,\n fallback = null,\n}: PropsWithChildren<SignedOutProps>) => {\n const {isSignedIn} = useThunderID();\n\n if (!isSignedIn) {\n return <>{children}</>;\n }\n\n return <>{fallback}</>;\n};\n\nSignedOut.displayName = 'SignedOut';\n\nexport default SignedOut;\n","/**\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 {FC, PropsWithChildren, ReactNode} from 'react';\nimport useThunderID from '../../contexts/ThunderID/useThunderID';\n\n/**\n * Props for the Loading component.\n */\nexport interface LoadingProps {\n /**\n * Content to show when the user is not signed in.\n */\n fallback?: ReactNode;\n}\n\n/**\n * A component that only renders its children when the ThunderID is loading.\n *\n * @remarks This component is only supported in browser based React applications (CSR).\n *\n * @example\n * ```tsx\n * import { Loading } from '@thunderid/auth-react';\n *\n * const App = () => {\n * return (\n * <Loading fallback={<p>Finished Loading...</p>}>\n * <p>Loading...</p>\n * </Loading>\n * );\n * }\n * ```\n */\nconst Loading: FC<PropsWithChildren<LoadingProps>> = ({children, fallback = null}: PropsWithChildren<LoadingProps>) => {\n const {isLoading} = useThunderID();\n\n if (!isLoading) {\n return <>{fallback}</>;\n }\n\n return <>{children}</>;\n};\n\nLoading.displayName = 'Loading';\n\nexport default Loading;\n","/**\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 {Organization} from '@thunderid/browser';\nimport {FC, useEffect, useRef} from 'react';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\n\ninterface OrganizationContextControllerProps {\n /**\n * Children to render\n */\n children: React.ReactNode;\n /**\n * Whether the source provider is signed in\n */\n isSourceSignedIn: boolean;\n /**\n * ID of the organization to authenticate with\n */\n targetOrganizationId: string;\n}\n\nconst OrganizationContextController: FC<OrganizationContextControllerProps> = ({\n targetOrganizationId,\n isSourceSignedIn,\n children,\n}: OrganizationContextControllerProps) => {\n const {isInitialized, isSignedIn, switchOrganization, isLoading} = useThunderID();\n const hasAuthenticatedRef: React.MutableRefObject<boolean> = useRef(false);\n const isAuthenticatingRef: React.MutableRefObject<boolean> = useRef(false);\n\n /**\n * Handle the organization switch when:\n * - Current instance is initialized and NOT signed in\n * - Source provider IS signed in\n * Uses the `switchOrganization` function from the ThunderID context.\n */\n useEffect(() => {\n const performOrganizationSwitch = async (): Promise<void> => {\n // Prevent multiple authentication attempts\n if (hasAuthenticatedRef.current || isAuthenticatingRef.current) {\n return;\n }\n\n // Wait for initialization to complete\n if (!isInitialized || isLoading) {\n return;\n }\n\n // Only proceed if user is not already signed in to this instance\n if (isSignedIn) {\n hasAuthenticatedRef.current = true;\n return;\n }\n\n // CRITICAL: Only proceed if source provider is signed in\n if (!isSourceSignedIn) {\n return;\n }\n\n try {\n isAuthenticatingRef.current = true;\n hasAuthenticatedRef.current = true;\n\n // Build the organization object for authentication\n const targetOrganization: Organization = {\n id: targetOrganizationId,\n name: '', // Name will be populated after authentication\n orgHandle: '', // Will be populated after authentication\n };\n\n // Call the switchOrganization API from context (handles token exchange)\n await switchOrganization(targetOrganization);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Linked organization authentication failed:', error);\n\n // Reset the flag to allow retry\n hasAuthenticatedRef.current = false;\n } finally {\n isAuthenticatingRef.current = false;\n }\n };\n\n performOrganizationSwitch();\n }, [isInitialized, isSignedIn, isLoading, isSourceSignedIn, targetOrganizationId, switchOrganization]);\n\n return <>{children}</>;\n};\n\nexport default OrganizationContextController;\n","/**\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 {FC, PropsWithChildren} from 'react';\nimport OrganizationContextController from './OrganizationContextController';\nimport ThunderIDProvider, {ThunderIDProviderProps} from '../../../contexts/ThunderID/ThunderIDProvider';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\n\nexport interface OrganizationContextProps extends Omit<ThunderIDProviderProps, 'organizationChain' | 'baseUrl'> {\n /**\n * Optional base URL for the organization context. If not provided, it will default to the source provider's base URL.\n */\n baseUrl?: string;\n /**\n * Instance ID for this organization context. Must be unique across the app if multiple contexts are used.\n */\n instanceId: number;\n /**\n * Optional source instance ID. If not provided, immediate parent provider is used as source.\n */\n sourceInstanceId?: number;\n /**\n * ID of the organization to authenticate with\n */\n targetOrganizationId: string;\n}\n\nconst OrganizationContext: FC<PropsWithChildren<OrganizationContextProps>> = ({\n instanceId,\n baseUrl,\n clientId,\n afterSignInUrl,\n afterSignOutUrl,\n targetOrganizationId,\n sourceInstanceId,\n scopes,\n children,\n ...rest\n}: PropsWithChildren<OrganizationContextProps>) => {\n // Get the source provider's signed-in status\n const {\n isSignedIn: isSourceSignedIn,\n instanceId: sourceInstanceIdFromContext,\n baseUrl: sourceBaseUrl,\n clientId: sourceClientId,\n } = useThunderID();\n\n return (\n <ThunderIDProvider\n instanceId={instanceId}\n baseUrl={baseUrl || sourceBaseUrl}\n clientId={clientId || sourceClientId}\n afterSignInUrl={afterSignInUrl}\n afterSignOutUrl={afterSignOutUrl}\n scopes={scopes}\n organizationChain={{\n sourceInstanceId: sourceInstanceId || sourceInstanceIdFromContext,\n targetOrganizationId,\n }}\n {...rest}\n >\n <OrganizationContextController targetOrganizationId={targetOrganizationId} isSourceSignedIn={isSourceSignedIn}>\n {children}\n </OrganizationContextController>\n </ThunderIDProvider>\n );\n};\n\nexport default OrganizationContext;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the Checkbox component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param hasError - Whether the checkbox has an error state\n * @param required - Whether the checkbox is required\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string, hasError: boolean, required: boolean): Record<string, string> =>\n useMemo(() => {\n const containerStyles: string = css`\n display: flex;\n align-items: center;\n `;\n\n const inputStyles: string = css`\n width: calc(${theme.vars.spacing.unit} * 2.5);\n height: calc(${theme.vars.spacing.unit} * 2.5);\n margin-inline-end: ${theme.vars.spacing.unit};\n accent-color: ${theme.vars.colors.primary.main};\n cursor: pointer;\n\n &:focus {\n outline: 2px solid ${theme.vars.colors.primary.main};\n outline-offset: 2px;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n `;\n\n const errorInputStyles: string = css`\n accent-color: ${theme.vars.colors.error.main};\n\n &:focus {\n outline-color: ${theme.vars.colors.error.main};\n }\n `;\n\n const labelStyles: string = css`\n color: ${theme.vars.colors.text.primary};\n font-size: ${theme.vars.typography.fontSizes.sm};\n font-family: ${theme.vars.typography.fontFamily};\n cursor: pointer;\n\n &:hover {\n color: ${theme.vars.colors.text.primary};\n }\n `;\n\n const errorLabelStyles: string = css`\n color: ${theme.vars.colors.error.main};\n `;\n\n const requiredStyles: string = css`\n /* Required indicator styles will be handled by InputLabel */\n `;\n\n return {\n container: containerStyles,\n errorInput: hasError ? errorInputStyles : '',\n errorLabel: hasError ? errorLabelStyles : '',\n input: inputStyles,\n label: labelStyles,\n required: required ? requiredStyles : '',\n };\n }, [theme, colorScheme, hasError, required]);\n\nexport default useStyles;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nexport type FormControlHelperTextAlign = 'left' | 'center';\n\n/**\n * Creates styles for the FormControl component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param helperTextAlign - The alignment for helper text\n * @param helperTextMarginLeft - Custom margin left for helper text\n * @param hasError - Whether the form control has an error\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n helperTextAlign: FormControlHelperTextAlign,\n helperTextMarginLeft?: string,\n hasError?: boolean,\n): Record<string, string> =>\n useMemo(() => {\n const formControl: string = css`\n text-align: start;\n font-family: ${theme.vars.typography.fontFamily};\n `;\n\n const helperText: string = css`\n margin-top: calc(${theme.vars.spacing.unit} / 2);\n text-align: ${helperTextAlign === 'left' ? 'start' : helperTextAlign};\n ${helperTextMarginLeft && `margin-inline-start: ${helperTextMarginLeft};`}\n `;\n\n const helperTextError: string = css`\n color: ${theme.vars.colors.error.main};\n `;\n\n return {\n formControl,\n helperText,\n helperTextError,\n };\n }, [theme, colorScheme, helperTextAlign, helperTextMarginLeft, hasError]);\n\nexport default useStyles;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nexport type TypographyVariant =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'subtitle1'\n | 'subtitle2'\n | 'body1'\n | 'body2'\n | 'caption'\n | 'overline'\n | 'button';\n\nexport type TypographyAlign = 'left' | 'center' | 'right' | 'justify';\n\nexport type TypographyColor =\n | 'primary'\n | 'secondary'\n | 'error'\n | 'success'\n | 'warning'\n | 'info'\n | 'textPrimary'\n | 'textSecondary'\n | 'inherit';\n\n/**\n * Creates styles for the Typography component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param variant - The typography variant\n * @param align - Text alignment\n * @param color - Color variant\n * @param noWrap - Whether text should be truncated with ellipsis\n * @param inline - Whether text should be displayed inline\n * @param gutterBottom - Whether to add bottom margin\n * @param fontWeight - Custom font weight\n * @param fontSize - Custom font size\n * @param lineHeight - Custom line height\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n variant: TypographyVariant,\n align: TypographyAlign,\n color: TypographyColor,\n noWrap: boolean,\n inline: boolean,\n gutterBottom: boolean,\n fontWeight?: 'normal' | 'medium' | 'semibold' | 'bold' | number,\n fontSize?: string | number,\n lineHeight?: string | number,\n): Record<string, string> =>\n useMemo(() => {\n const getColorValue = (colorVariant: TypographyColor): string => {\n switch (colorVariant) {\n case 'primary':\n return theme.colors.primary.main;\n case 'secondary':\n return theme.colors.secondary.main;\n case 'error':\n return theme.colors.error.main;\n case 'textPrimary':\n return theme.colors.text.primary;\n case 'textSecondary':\n return theme.colors.text.secondary;\n case 'inherit':\n return 'inherit';\n default:\n return theme.colors.text.primary;\n }\n };\n\n const getVariantStyles = (variantName: TypographyVariant): Record<string, string | number> => {\n switch (variantName) {\n case 'h1':\n return {\n fontSize: theme.vars.typography.fontSizes['3xl'],\n fontWeight: 600,\n letterSpacing: '-0.00735em',\n lineHeight: 1.235,\n };\n case 'h2':\n return {\n fontSize: theme.vars.typography.fontSizes['2xl'],\n fontWeight: 600,\n letterSpacing: '0em',\n lineHeight: 1.334,\n };\n case 'h3':\n return {\n fontSize: theme.vars.typography.fontSizes.xl,\n fontWeight: 600,\n letterSpacing: '0.0075em',\n lineHeight: 1.6,\n };\n case 'h4':\n return {\n fontSize: theme.vars.typography.fontSizes.lg,\n fontWeight: 600,\n letterSpacing: '0.00938em',\n lineHeight: 1.5,\n };\n case 'h5':\n return {\n fontSize: theme.vars.typography.fontSizes.md,\n fontWeight: 600,\n letterSpacing: '0em',\n lineHeight: 1.334,\n };\n case 'h6':\n return {\n fontSize: theme.vars.typography.fontSizes.sm,\n fontWeight: 500,\n letterSpacing: '0.0075em',\n lineHeight: 1.6,\n };\n case 'subtitle1':\n return {\n fontSize: theme.vars.typography.fontSizes.md,\n fontWeight: 400,\n letterSpacing: '0.00938em',\n lineHeight: 1.75,\n };\n case 'subtitle2':\n return {\n fontSize: theme.vars.typography.fontSizes.sm,\n fontWeight: 500,\n letterSpacing: '0.00714em',\n lineHeight: 1.57,\n };\n case 'body1':\n return {\n fontSize: theme.vars.typography.fontSizes.md,\n fontWeight: 400,\n letterSpacing: '0.00938em',\n lineHeight: 1.5,\n };\n case 'body2':\n return {\n fontSize: theme.vars.typography.fontSizes.sm,\n fontWeight: 400,\n letterSpacing: '0.01071em',\n lineHeight: 1.43,\n };\n case 'caption':\n return {\n fontSize: theme.vars.typography.fontSizes.xs,\n fontWeight: 400,\n letterSpacing: '0.03333em',\n lineHeight: 1.66,\n };\n case 'overline':\n return {\n fontSize: theme.vars.typography.fontSizes.xs,\n fontWeight: 400,\n letterSpacing: '0.08333em',\n lineHeight: 2.66,\n textTransform: 'uppercase' as const,\n };\n case 'button':\n return {\n fontSize: theme.vars.typography.fontSizes.sm,\n fontWeight: 500,\n letterSpacing: '0.02857em',\n lineHeight: 1.75,\n textTransform: 'uppercase' as const,\n };\n default:\n return {};\n }\n };\n\n const variantStyles: Record<string, string | number> = getVariantStyles(variant);\n const colorValue: string = getColorValue(color);\n\n const typography: string = css`\n margin: 0;\n font-family: ${theme.vars.typography.fontFamily};\n color: ${colorValue};\n text-align: ${align};\n display: ${inline ? 'inline' : 'block'};\n ${variantStyles['fontSize'] ? `font-size: ${variantStyles['fontSize']};` : ''}\n ${variantStyles['fontWeight'] ? `font-weight: ${variantStyles['fontWeight']};` : ''}\n ${variantStyles['lineHeight'] ? `line-height: ${variantStyles['lineHeight']};` : ''}\n ${variantStyles['letterSpacing'] ? `letter-spacing: ${variantStyles['letterSpacing']};` : ''}\n ${variantStyles['textTransform'] ? `text-transform: ${variantStyles['textTransform']};` : ''}\n\n /* Custom overrides */\n ${fontWeight ? `font-weight: ${fontWeight} !important;` : ''}\n ${fontSize ? `font-size: ${typeof fontSize === 'number' ? `${fontSize}px` : fontSize} !important;` : ''}\n ${lineHeight ? `line-height: ${lineHeight} !important;` : ''}\n\n /* Conditional styles */\n ${noWrap\n ? `\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `\n : ''}\n\n ${gutterBottom\n ? `\n margin-bottom: ${theme.spacing.unit}px;\n `\n : ''}\n `;\n\n const typographyNoWrap: string = css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `;\n\n const typographyInline: string = css`\n display: inline;\n `;\n\n const typographyGutterBottom: string = css`\n margin-bottom: ${theme.spacing.unit}px;\n `;\n\n const typographyH1: string = css`\n font-size: ${theme.vars.typography.fontSizes['3xl']};\n font-weight: 600;\n line-height: 1.235;\n letter-spacing: -0.00735em;\n `;\n\n const typographyH2: string = css`\n font-size: ${theme.vars.typography.fontSizes['2xl']};\n font-weight: 600;\n line-height: 1.334;\n letter-spacing: 0em;\n `;\n\n const typographyH3: string = css`\n font-size: ${theme.vars.typography.fontSizes.xl};\n font-weight: 600;\n line-height: 1.6;\n letter-spacing: 0.0075em;\n `;\n\n const typographyH4: string = css`\n font-size: ${theme.vars.typography.fontSizes.lg};\n font-weight: 600;\n line-height: 1.5;\n letter-spacing: 0.00938em;\n `;\n\n const typographyH5: string = css`\n font-size: ${theme.vars.typography.fontSizes.md};\n font-weight: 600;\n line-height: 1.334;\n letter-spacing: 0em;\n `;\n\n const typographyH6: string = css`\n font-size: ${theme.vars.typography.fontSizes.sm};\n font-weight: 500;\n line-height: 1.6;\n letter-spacing: 0.0075em;\n `;\n\n const typographySubtitle1: string = css`\n font-size: ${theme.vars.typography.fontSizes.md};\n font-weight: 400;\n line-height: 1.75;\n letter-spacing: 0.00938em;\n `;\n\n const typographySubtitle2: string = css`\n font-size: ${theme.vars.typography.fontSizes.sm};\n font-weight: 500;\n line-height: 1.57;\n letter-spacing: 0.00714em;\n `;\n\n const typographyBody1: string = css`\n font-size: ${theme.vars.typography.fontSizes.md};\n font-weight: 400;\n line-height: 1.5;\n letter-spacing: 0.00938em;\n `;\n\n const typographyBody2: string = css`\n font-size: ${theme.vars.typography.fontSizes.sm};\n font-weight: 400;\n line-height: 1.43;\n letter-spacing: 0.01071em;\n `;\n\n const typographyCaption: string = css`\n font-size: ${theme.vars.typography.fontSizes.xs};\n font-weight: 400;\n line-height: 1.66;\n letter-spacing: 0.03333em;\n `;\n\n const typographyOverline: string = css`\n font-size: ${theme.vars.typography.fontSizes.xs};\n font-weight: 400;\n line-height: 2.66;\n letter-spacing: 0.08333em;\n text-transform: uppercase;\n `;\n\n const typographyButton: string = css`\n font-size: ${theme.vars.typography.fontSizes.sm};\n font-weight: 500;\n line-height: 1.75;\n letter-spacing: 0.02857em;\n text-transform: uppercase;\n `;\n\n return {\n typography,\n typographyBody1,\n typographyBody2,\n typographyButton,\n typographyCaption,\n typographyGutterBottom,\n typographyH1,\n typographyH2,\n typographyH3,\n typographyH4,\n typographyH5,\n typographyH6,\n typographyInline,\n typographyNoWrap,\n typographyOverline,\n typographySubtitle1,\n typographySubtitle2,\n };\n }, [theme, colorScheme, variant, align, color, noWrap, inline, gutterBottom, fontWeight, fontSize, lineHeight]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {CSSProperties, FC, ReactNode, ElementType} from 'react';\nimport useStyles, {TypographyVariant, TypographyAlign, TypographyColor} from './Typography.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\n\nexport interface TypographyProps {\n /**\n * Text alignment\n */\n align?: TypographyAlign;\n /**\n * The content to be rendered\n */\n children: ReactNode;\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Color variant\n */\n color?: TypographyColor;\n /**\n * The HTML element or React component to render\n */\n component?: ElementType;\n /**\n * Custom font size (overrides variant sizing)\n */\n fontSize?: string | number;\n /**\n * Custom font weight\n */\n fontWeight?: 'normal' | 'medium' | 'semibold' | 'bold' | number;\n /**\n * Whether to disable gutters (margin bottom)\n */\n gutterBottom?: boolean;\n /**\n * Whether the text should be displayed inline\n */\n inline?: boolean;\n /**\n * Line height\n */\n lineHeight?: string | number;\n /**\n * Whether the text should be clipped with ellipsis when it overflows\n */\n noWrap?: boolean;\n /**\n * Custom styles\n */\n style?: CSSProperties;\n /**\n * The typography variant to apply\n */\n variant?: TypographyVariant;\n}\n\n// Default component mapping for variants\nconst variantMapping: Record<TypographyVariant, ElementType> = {\n body1: 'p',\n body2: 'p',\n button: 'span',\n caption: 'span',\n h1: 'h1',\n h2: 'h2',\n h3: 'h3',\n h4: 'h4',\n h5: 'h5',\n h6: 'h6',\n overline: 'span',\n subtitle1: 'h6',\n subtitle2: 'h6',\n};\n\n/**\n * Typography component for consistent text rendering throughout the application.\n * Integrates with the theme system and provides semantic HTML elements.\n */\nconst Typography: FC<TypographyProps> = ({\n children,\n variant = 'body1',\n component,\n align = 'left',\n color = 'textPrimary',\n noWrap = false,\n className,\n style = {},\n inline = false,\n fontWeight,\n fontSize,\n lineHeight,\n gutterBottom = false,\n ...rest\n}: TypographyProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(\n theme,\n colorScheme,\n variant,\n align,\n color,\n noWrap,\n inline,\n gutterBottom,\n fontWeight,\n fontSize,\n lineHeight,\n );\n\n const Component: ElementType = component || variantMapping[variant] || 'span';\n\n const getVariantClass = (variantName: TypographyVariant): string => {\n switch (variantName) {\n case 'h1':\n return styles['typographyH1'];\n case 'h2':\n return styles['typographyH2'];\n case 'h3':\n return styles['typographyH3'];\n case 'h4':\n return styles['typographyH4'];\n case 'h5':\n return styles['typographyH5'];\n case 'h6':\n return styles['typographyH6'];\n case 'subtitle1':\n return styles['typographySubtitle1'];\n case 'subtitle2':\n return styles['typographySubtitle2'];\n case 'body1':\n return styles['typographyBody1'];\n case 'body2':\n return styles['typographyBody2'];\n case 'caption':\n return styles['typographyCaption'];\n case 'overline':\n return styles['typographyOverline'];\n case 'button':\n return styles['typographyButton'];\n default:\n return '';\n }\n };\n\n const typographyClassName: string = cx(\n withVendorCSSClassPrefix(bem('typography')),\n withVendorCSSClassPrefix(bem('typography', variant)),\n styles['typography'],\n getVariantClass(variant),\n noWrap && styles['typographyNoWrap'],\n inline && styles['typographyInline'],\n gutterBottom && styles['typographyGutterBottom'],\n className,\n );\n\n return (\n <Component className={typographyClassName} style={style} {...rest}>\n {children}\n </Component>\n );\n};\n\nexport default Typography;\n","/**\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 {cx} from '@emotion/css';\nimport {bem, withVendorCSSClassPrefix} from '@thunderid/browser';\nimport {CSSProperties, FC, ReactNode} from 'react';\nimport useStyles from './FormControl.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport Typography from '../Typography/Typography';\n\nexport type FormControlHelperTextAlign = 'left' | 'center';\n\nexport interface FormControlProps {\n /**\n * The content to be wrapped by the form control\n */\n children: ReactNode;\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Error message to display below the content\n */\n error?: string;\n /**\n * Helper text to display below the content\n */\n helperText?: string;\n /**\n * Custom alignment for helper text (default: left, center for OTP)\n */\n helperTextAlign?: FormControlHelperTextAlign;\n /**\n * Custom margin left for helper text (for components like Checkbox)\n */\n helperTextMarginLeft?: string;\n /**\n * Custom container style\n */\n style?: CSSProperties;\n}\n\nconst FormControl: FC<FormControlProps> = ({\n children,\n error,\n helperText,\n className,\n helperTextAlign = 'left',\n helperTextMarginLeft,\n}: FormControlProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, helperTextAlign, helperTextMarginLeft, !!error);\n\n return (\n <div className={cx(withVendorCSSClassPrefix(bem('form-control')), styles['formControl'], className)}>\n {children}\n {(error || helperText) && (\n <Typography\n variant=\"caption\"\n color={error ? 'error' : 'textSecondary'}\n className={cx(withVendorCSSClassPrefix(bem('form-control', 'helper-text')), styles['helperText'], {\n [withVendorCSSClassPrefix(bem('form-control', 'helper-text', 'error'))]: !!error,\n [styles['helperTextError']]: !!error,\n })}\n >\n {error || helperText}\n </Typography>\n )}\n </div>\n );\n};\n\nexport default FormControl;\n","/**\n * Copyright (c) 2024, 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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nexport type InputLabelVariant = 'block' | 'inline';\n\n/**\n * Creates styles for the InputLabel component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param variant - The display variant of the label\n * @param error - Whether the label has an error state\n * @param marginBottom - Custom margin bottom value\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n variant: InputLabelVariant,\n error: boolean,\n marginBottom?: string,\n): Record<string, string> =>\n useMemo(() => {\n const baseLabel: string = css`\n display: ${variant};\n margin-bottom: ${marginBottom || (variant === 'block' ? `calc(${theme.vars.spacing.unit} + 1px)` : '0')};\n color: ${error ? theme.vars.colors.error.main : theme.vars.colors.text.secondary};\n font-size: ${theme.vars.typography.fontSizes.sm};\n font-family: ${theme.vars.typography.fontFamily};\n font-weight: ${variant === 'block' ? 500 : 'normal'};\n `;\n\n const errorLabel: string = css`\n color: ${theme.vars.colors.error.main};\n `;\n\n const requiredIndicator: string = css`\n color: ${theme.vars.colors.error.main};\n `;\n\n const blockVariant: string = css`\n display: block;\n font-weight: 500;\n margin-bottom: ${marginBottom || `calc(${theme.vars.spacing.unit} + 1px)`};\n `;\n\n const inlineVariant: string = css`\n display: inline;\n font-weight: normal;\n margin-bottom: 0;\n `;\n\n return {\n block: blockVariant,\n error: errorLabel,\n inline: inlineVariant,\n label: baseLabel,\n requiredIndicator,\n };\n }, [theme, colorScheme, variant, error, marginBottom]);\n\nexport default useStyles;\n","/**\n * Copyright (c) 2024, 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 {cx} from '@emotion/css';\nimport {bem, withVendorCSSClassPrefix} from '@thunderid/browser';\nimport {CSSProperties, FC, LabelHTMLAttributes, ReactNode} from 'react';\nimport useStyles from './InputLabel.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\n\nexport type InputLabelVariant = 'block' | 'inline';\n\nexport interface InputLabelProps extends Omit<LabelHTMLAttributes<HTMLLabelElement>, 'style'> {\n /**\n * Label text or content\n */\n children: ReactNode;\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Whether there's an error state\n */\n error?: boolean;\n /**\n * Custom margin bottom (useful for different form layouts)\n */\n marginBottom?: string;\n /**\n * Whether the field is required\n */\n required?: boolean;\n /**\n * Custom style overrides\n */\n style?: CSSProperties;\n /**\n * Display type for label positioning\n */\n variant?: InputLabelVariant;\n}\n\nconst InputLabel: FC<InputLabelProps> = ({\n children,\n required = false,\n error = false,\n variant = 'block',\n marginBottom,\n className,\n style = {},\n ...rest\n}: InputLabelProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, variant, error, marginBottom);\n\n return (\n <label\n className={cx(\n withVendorCSSClassPrefix(bem('input-label')),\n withVendorCSSClassPrefix(bem('input-label', variant)),\n styles['label'],\n variant === 'block' ? styles['block'] : styles['inline'],\n {\n [withVendorCSSClassPrefix(bem('input-label', 'error'))]: error,\n [styles['error']]: error,\n },\n className,\n )}\n style={style}\n {...rest}\n >\n {children}\n {required && (\n <span className={cx(withVendorCSSClassPrefix(bem('input-label', 'required')), styles['requiredIndicator'])}>\n {' *'}\n </span>\n )}\n </label>\n );\n};\n\nexport default InputLabel;\n","/**\n * Copyright (c) 2024, 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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC, InputHTMLAttributes} from 'react';\nimport useStyles from './Checkbox.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\n\nexport interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'type'> {\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Error message to display below the checkbox\n */\n error?: string;\n /**\n * Helper text to display below the checkbox\n */\n helperText?: string;\n /**\n * Label text to display next to the checkbox\n */\n label?: string;\n /**\n * Whether the field is required\n */\n required?: boolean;\n}\n\nconst Checkbox: FC<CheckboxProps> = ({\n label,\n error,\n className,\n required,\n helperText,\n style = {},\n ...rest\n}: CheckboxProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const hasError = !!error;\n const styles: Record<string, string> = useStyles(theme, colorScheme, hasError, !!required);\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n className={cx(withVendorCSSClassPrefix(bem('checkbox')), className)}\n helperTextMarginLeft={`calc(${theme.vars.spacing.unit} * 3.5)`}\n >\n <div style={style} className={cx(withVendorCSSClassPrefix(bem('checkbox', 'container')), styles['container'])}>\n <input\n type=\"checkbox\"\n className={cx(withVendorCSSClassPrefix(bem('checkbox', 'input')), styles['input'], styles['errorInput'], {\n [withVendorCSSClassPrefix(bem('checkbox', 'input', 'error'))]: hasError,\n })}\n aria-invalid={hasError}\n aria-required={required}\n {...rest}\n />\n {label && (\n <InputLabel\n required={required}\n error={hasError}\n variant=\"inline\"\n className={cx(withVendorCSSClassPrefix(bem('checkbox', 'label')), styles['label'], styles['errorLabel'], {\n [withVendorCSSClassPrefix(bem('checkbox', 'label', 'error'))]: hasError,\n })}\n >\n {label}\n </InputLabel>\n )}\n </div>\n </FormControl>\n );\n};\n\nexport default Checkbox;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the DatePicker component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param hasError - Whether the date picker has an error state\n * @param disabled - Whether the date picker is disabled\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string, hasError: boolean, disabled: boolean): Record<string, string> =>\n useMemo(() => {\n const inputStyles: string = css`\n width: 100%;\n padding: ${theme.vars.spacing.unit} calc(${theme.vars.spacing.unit} * 1.5);\n border: 1px solid ${theme.vars.colors.border};\n border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};\n font-size: 1rem;\n font-family: ${theme.vars.typography.fontFamily};\n color: ${theme.vars.colors.text.primary};\n background-color: ${theme.vars.colors.background.surface};\n outline: none;\n transition:\n border-color 0.2s ease,\n box-shadow 0.2s ease;\n\n &:focus {\n border-color: ${theme.vars.colors.primary.main};\n box-shadow: 0 0 0 2px ${theme.vars.colors.primary.main}20;\n }\n\n &:hover:not(:disabled) {\n border-color: ${theme.vars.colors.primary.main};\n }\n\n &::placeholder {\n color: ${theme.vars.colors.text.secondary};\n }\n `;\n\n const errorInputStyles: string = css`\n border-color: ${theme.vars.colors.error.main};\n\n &:focus {\n border-color: ${theme.vars.colors.error.main};\n box-shadow: 0 0 0 2px ${theme.vars.colors.error.main}20;\n }\n\n &:hover:not(:disabled) {\n border-color: ${theme.vars.colors.error.main};\n }\n `;\n\n const disabledInputStyles: string = css`\n background-color: ${theme.vars.colors.background.disabled};\n color: ${theme.vars.colors.text.secondary};\n cursor: not-allowed;\n opacity: 0.6;\n\n &:hover,\n &:focus {\n border-color: ${theme.vars.colors.border};\n box-shadow: none;\n }\n `;\n\n const labelStyles: string = css`\n /* Label styles will be handled by InputLabel component */\n `;\n\n return {\n disabledInput: disabled ? disabledInputStyles : '',\n errorInput: hasError ? errorInputStyles : '',\n input: inputStyles,\n label: labelStyles,\n };\n }, [theme, colorScheme, hasError, disabled]);\n\nexport default useStyles;\n","/**\n * Copyright (c) 2024, 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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC, InputHTMLAttributes} from 'react';\nimport useStyles from './DatePicker.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\n\nexport interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'type'> {\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Custom date format for the regex pattern\n */\n dateFormat?: string;\n /**\n * Whether the field is disabled\n */\n disabled?: boolean;\n /**\n * Error message to display below the input\n */\n error?: string;\n /**\n * Helper text to display below the input\n */\n helperText?: string;\n /**\n * Label text to display above the input\n */\n label?: string;\n /**\n * Whether the field is required\n */\n required?: boolean;\n}\n\nconst DatePicker: FC<DatePickerProps> = ({\n label,\n error,\n className,\n required,\n disabled,\n helperText,\n dateFormat = 'yyyy-MM-dd',\n style = {},\n ...rest\n}: DatePickerProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const hasError = !!error;\n const styles: Record<string, string> = useStyles(theme, colorScheme, hasError, !!disabled);\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n className={cx(withVendorCSSClassPrefix(bem('date-picker')), className)}\n style={style}\n >\n {label && (\n <InputLabel\n required={required}\n error={hasError}\n className={cx(withVendorCSSClassPrefix(bem('date-picker', 'label')), styles['label'])}\n >\n {label}\n </InputLabel>\n )}\n <input\n type=\"date\"\n pattern=\"\\d{4}-\\d{2}-\\d{2}\"\n placeholder={dateFormat}\n className={cx(\n withVendorCSSClassPrefix(bem('date-picker', 'input')),\n styles['input'],\n styles['errorInput'],\n styles['disabledInput'],\n {\n [withVendorCSSClassPrefix(bem('date-picker', 'input', 'error'))]: hasError,\n [withVendorCSSClassPrefix(bem('date-picker', 'input', 'disabled'))]: disabled,\n },\n )}\n disabled={disabled}\n aria-invalid={hasError}\n aria-required={required}\n {...rest}\n />\n </FormControl>\n );\n};\n\nexport default DatePicker;\n","/**\n * Copyright (c) 2024, 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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nexport type OtpFieldType = 'text' | 'number' | 'password';\n\n/**\n * Creates styles for the OtpField component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param disabled - Whether the component is disabled\n * @param hasError - Whether the component has an error\n * @param length - Number of OTP input fields\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n disabled: boolean,\n hasError: boolean,\n length: number,\n): Record<string, string> =>\n useMemo(() => {\n const inputContainer: string = css`\n display: flex;\n gap: ${theme.vars.spacing.unit};\n justify-content: space-between;\n align-items: center;\n flex-wrap: wrap;\n `;\n\n const input: string = css`\n width: calc(${theme.vars.spacing.unit} * 6);\n height: calc(${theme.vars.spacing.unit} * 6);\n text-align: center;\n font-size: ${theme.vars.typography.fontSizes.xl};\n font-family: ${theme.vars.typography.fontFamily};\n font-weight: 500;\n border: 2px solid ${hasError ? theme.vars.colors.error.main : theme.vars.colors.border};\n border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};\n color: ${theme.vars.colors.text.primary};\n background-color: ${disabled ? theme.vars.colors.background.disabled : theme.vars.colors.background.surface};\n outline: none;\n transition:\n border-color 0.2s ease,\n box-shadow 0.2s ease;\n\n &:focus {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n box-shadow: 0 0 0 2px ${hasError ? `${theme.vars.colors.error.main}20` : `${theme.vars.colors.primary.main}20`};\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n\n &::placeholder {\n color: ${theme.vars.colors.text.secondary};\n opacity: 0.7;\n }\n `;\n\n const inputError: string = css`\n border-color: ${theme.vars.colors.error.main};\n\n &:focus {\n border-color: ${theme.vars.colors.error.main};\n box-shadow: 0 0 0 2px ${theme.vars.colors.error.main}20;\n }\n `;\n\n const inputDisabled: string = css`\n background-color: ${theme.vars.colors.background.disabled};\n cursor: not-allowed;\n opacity: 0.6;\n `;\n\n return {\n input,\n inputContainer,\n inputDisabled,\n inputError,\n };\n }, [theme, colorScheme, disabled, hasError, length]);\n\nexport default useStyles;\n","/**\n * Copyright (c) 2024, 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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {\n ClipboardEvent,\n FC,\n KeyboardEvent,\n ChangeEvent,\n MutableRefObject,\n useRef,\n useEffect,\n useState,\n CSSProperties,\n} from 'react';\nimport useStyles from './OtpField.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\n\nexport type OtpFieldType = 'text' | 'number' | 'password';\n\nexport interface OtpInputProps {\n /**\n * Auto focus the first input on mount\n */\n autoFocus?: boolean;\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Whether the field is disabled\n */\n disabled?: boolean;\n /**\n * Error message to display below the OTP input\n */\n error?: string;\n /**\n * Helper text to display below the OTP input\n */\n helperText?: string;\n /**\n * Label text to display above the OTP input\n */\n label?: string;\n /**\n * Number of OTP input fields\n */\n length?: number;\n /**\n * Callback function called when OTP value changes\n */\n onChange?: (event: {target: {value: string}}) => void;\n /**\n * Callback function called when OTP input is complete\n */\n onComplete?: (value: string) => void;\n /**\n * Pattern for numeric input validation\n */\n pattern?: string;\n /**\n * Placeholder character for each input field\n */\n placeholder?: string;\n /**\n * Whether the field is required\n */\n required?: boolean;\n /**\n * Custom container style\n */\n style?: CSSProperties;\n /**\n * Type of input (text, number, password)\n */\n type?: OtpFieldType;\n /**\n * Current OTP value\n */\n value?: string;\n}\n\nconst OtpField: FC<OtpInputProps> = ({\n label,\n error,\n className,\n required,\n disabled,\n helperText,\n length = 6,\n value = '',\n onChange,\n onComplete,\n type = 'text',\n placeholder = '',\n style = {},\n autoFocus = false,\n pattern,\n}: OtpInputProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, !!disabled, !!error, length);\n const [otp, setOtp] = useState<string[]>(Array(length).fill(''));\n const inputRefs: MutableRefObject<HTMLInputElement[]> = useRef<HTMLInputElement[]>([]);\n\n useEffect(() => {\n inputRefs.current = inputRefs.current.slice(0, length);\n }, [length]);\n\n useEffect(() => {\n if (value) {\n const newOtp: string[] = value.split('').slice(0, length);\n while (newOtp.length < length) {\n newOtp.push('');\n }\n setOtp(newOtp);\n } else {\n setOtp(Array(length).fill(''));\n }\n }, [value, length]);\n\n useEffect(() => {\n if (autoFocus && inputRefs.current[0]) {\n inputRefs.current[0].focus();\n }\n }, [autoFocus]);\n\n const handleChange = (index: number, event: ChangeEvent<HTMLInputElement>): void => {\n const newValue: string = event.target.value;\n\n if (newValue.length > 1) return;\n\n if (type === 'number' && newValue && !/^\\d$/.test(newValue)) return;\n\n if (pattern && newValue && !new RegExp(pattern).test(newValue)) return;\n\n const newOtp: string[] = [...otp];\n newOtp[index] = newValue;\n setOtp(newOtp);\n\n const otpValue: string = newOtp.join('');\n\n onChange?.({target: {value: otpValue}});\n\n if (newValue && index < length - 1) {\n inputRefs.current[index + 1]?.focus();\n }\n\n if (newOtp.every((digit: string) => digit !== '') && onComplete) {\n onComplete(otpValue);\n }\n };\n\n const handleKeyDown = (index: number, event: KeyboardEvent<HTMLInputElement>): void => {\n if (event.key === 'Backspace') {\n if (!otp[index] && index > 0) {\n const newOtp: string[] = [...otp];\n\n newOtp[index - 1] = '';\n setOtp(newOtp);\n inputRefs.current[index - 1]?.focus();\n onChange?.({target: {value: newOtp.join('')}});\n } else if (otp[index]) {\n const newOtp: string[] = [...otp];\n\n newOtp[index] = '';\n setOtp(newOtp);\n onChange?.({target: {value: newOtp.join('')}});\n }\n } else if (event.key === 'ArrowLeft' && index > 0) {\n inputRefs.current[index - 1]?.focus();\n } else if (event.key === 'ArrowRight' && index < length - 1) {\n inputRefs.current[index + 1]?.focus();\n } else if (event.key === 'Enter') {\n event.preventDefault();\n\n if (otp.every((digit: string) => digit !== '') && onComplete) {\n onComplete(otp.join(''));\n }\n }\n };\n\n const handlePaste = (event: ClipboardEvent<HTMLInputElement>): void => {\n event.preventDefault();\n\n const pastedData: string = event.clipboardData.getData('text').slice(0, length);\n\n let validData = '';\n\n Array.from(pastedData).forEach((char: string) => {\n if (type === 'number' && !/^\\d$/.test(char)) return;\n if (pattern && !new RegExp(pattern).test(char)) return;\n validData += char;\n });\n\n const newOtp: string[] = Array(length).fill('');\n\n for (let i = 0; i < Math.min(validData.length, length); i += 1) {\n newOtp[i] = validData[i];\n }\n\n setOtp(newOtp);\n onChange?.({target: {value: newOtp.join('')}});\n\n const nextEmptyIndex: number = newOtp.findIndex((digit: string) => digit === '');\n const focusIndex: number = nextEmptyIndex !== -1 ? nextEmptyIndex : length - 1;\n\n inputRefs.current[focusIndex]?.focus();\n\n if (newOtp.every((digit: string) => digit !== '') && onComplete) {\n onComplete(newOtp.join(''));\n }\n };\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n className={cx(withVendorCSSClassPrefix(bem('otp-field')), className)}\n helperTextAlign=\"center\"\n style={style}\n >\n {label && (\n <InputLabel required={required} error={!!error}>\n {label}\n </InputLabel>\n )}\n <div className={cx(withVendorCSSClassPrefix(bem('otp-field', 'input-container')), styles['inputContainer'])}>\n {Array.from({length}, (_: unknown, index: number) => (\n <input\n key={index}\n ref={(el: HTMLInputElement | null): void => {\n if (el) inputRefs.current[index] = el;\n }}\n type={type === 'password' ? 'password' : 'text'}\n inputMode={type === 'number' ? 'numeric' : 'text'}\n value={otp[index] || ''}\n onChange={(event: ChangeEvent<HTMLInputElement>): void => handleChange(index, event)}\n onKeyDown={(event: KeyboardEvent<HTMLInputElement>): void => handleKeyDown(index, event)}\n onPaste={handlePaste}\n className={cx(withVendorCSSClassPrefix(bem('otp-field', 'input')), styles['input'], {\n [withVendorCSSClassPrefix(bem('otp-field', 'input', 'error'))]: !!error,\n [styles['inputError']]: !!error,\n [withVendorCSSClassPrefix(bem('otp-field', 'input', 'disabled'))]: !!disabled,\n [styles['inputDisabled']]: !!disabled,\n })}\n maxLength={1}\n placeholder={placeholder}\n disabled={disabled}\n aria-label={`${label || 'OTP'} digit ${index + 1}`}\n aria-invalid={!!error}\n aria-required={required}\n autoComplete=\"one-time-code\"\n />\n ))}\n </div>\n </FormControl>\n );\n};\n\nexport default OtpField;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the PasswordField component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param showPassword - Whether the password is currently visible\n * @param disabled - Whether the component is disabled\n * @param hasError - Whether the component has an error\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n showPassword: boolean,\n disabled: boolean,\n hasError: boolean,\n): Record<string, string> =>\n useMemo(() => {\n const toggleIcon: string = css`\n cursor: ${disabled ? 'not-allowed' : 'pointer'};\n color: ${theme.vars.colors.text.secondary};\n opacity: ${disabled ? 0.6 : 1};\n transition: color 0.2s ease;\n\n &:hover {\n color: ${!disabled ? theme.vars.colors.text.primary : theme.vars.colors.text.secondary};\n }\n `;\n\n const visibleIcon: string = css`\n color: ${theme.vars.colors.primary.main};\n `;\n\n const hiddenIcon: string = css`\n color: ${theme.vars.colors.text.secondary};\n `;\n\n return {\n hiddenIcon,\n toggleIcon,\n visibleIcon,\n };\n }, [theme, colorScheme, showPassword, disabled, hasError]);\n\nexport default useStyles;\n","/**\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 {FC, SVGProps} from 'react';\n\n/**\n * Eye icon component.\n */\nconst Eye: FC<SVGProps<SVGSVGElement>> = (props: SVGProps<SVGSVGElement>) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n);\n\nexport default Eye;\n","/**\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 {FC, SVGProps} from 'react';\n\n/**\n * EyeOff icon component.\n */\nconst EyeOff: FC<SVGProps<SVGSVGElement>> = (props: SVGProps<SVGSVGElement>) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49\" />\n <path d=\"M14.084 14.158a3 3 0 0 1-4.242-4.242\" />\n <path d=\"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143\" />\n <path d=\"m2 2 20 20\" />\n </svg>\n);\n\nexport default EyeOff;\n","/**\n * Copyright (c) 2024, 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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the TextField component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param disabled - Whether the component is disabled\n * @param hasError - Whether the component has an error\n * @param hasStartIcon - Whether the component has a start icon\n * @param hasEndIcon - Whether the component has an end icon\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n disabled: boolean,\n hasError: boolean,\n hasStartIcon: boolean,\n hasEndIcon: boolean,\n): Record<string, string> =>\n useMemo(() => {\n const inlineStartPadding: string = hasStartIcon\n ? `calc(${theme.vars.spacing.unit} * 5)`\n : `calc(${theme.vars.spacing.unit} * 1.5)`;\n const inlineEndPadding: string = hasEndIcon\n ? `calc(${theme.vars.spacing.unit} * 5)`\n : `calc(${theme.vars.spacing.unit} * 1.5)`;\n\n const inputContainer: string = css`\n position: relative;\n display: flex;\n align-items: center;\n `;\n\n const input: string = css`\n width: 100%;\n padding-block: ${theme.vars.spacing.unit};\n padding-inline-start: ${inlineStartPadding};\n padding-inline-end: ${inlineEndPadding};\n border: 1px solid ${hasError ? theme.vars.colors.error.main : theme.vars.colors.border};\n border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};\n font-size: ${theme.vars.typography.fontSizes.md};\n font-family: ${theme.vars.typography.fontFamily};\n color: ${theme.vars.colors.text.primary};\n background-color: ${disabled ? theme.vars.colors.background.disabled : theme.vars.colors.background.surface};\n outline: none;\n transition:\n border-color 0.2s ease,\n box-shadow 0.2s ease;\n\n &:focus {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n box-shadow: 0 0 0 2px ${hasError ? `${theme.vars.colors.error.main}20` : `${theme.vars.colors.primary.main}20`};\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n &:hover:not(:disabled) {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n }\n\n &::placeholder {\n color: ${theme.vars.colors.text.secondary};\n opacity: 0.7;\n }\n `;\n\n const inputError: string = css`\n border-color: ${theme.vars.colors.error.main};\n\n &:focus {\n border-color: ${theme.vars.colors.error.main};\n box-shadow: 0 0 0 2px ${theme.vars.colors.error.main}20;\n }\n\n &:hover:not(:disabled) {\n border-color: ${theme.vars.colors.error.main};\n }\n `;\n\n const inputDisabled: string = css`\n background-color: ${theme.vars.colors.background.disabled};\n opacity: 0.6;\n cursor: not-allowed;\n `;\n\n const icon: string = css`\n position: absolute;\n background: none;\n border: none;\n cursor: ${disabled ? 'not-allowed' : 'pointer'};\n padding: calc(${theme.vars.spacing.unit} / 2);\n display: flex;\n align-items: center;\n justify-content: center;\n color: ${theme.vars.colors.text.secondary};\n opacity: ${disabled ? 0.5 : 1};\n top: 50%;\n transform: translateY(-50%);\n transition:\n color 0.2s ease,\n opacity 0.2s ease;\n\n &:hover:not(:disabled) {\n color: ${theme.vars.colors.text.primary};\n }\n\n &:focus {\n outline: 2px solid ${theme.vars.colors.primary.main};\n outline-offset: 2px;\n }\n `;\n\n const startIcon: string = css`\n ${icon};\n inset-inline-start: ${theme.vars.spacing.unit};\n `;\n\n const endIcon: string = css`\n ${icon};\n inset-inline-end: ${theme.vars.spacing.unit};\n `;\n\n return {\n endIcon,\n icon,\n input,\n inputContainer,\n inputDisabled,\n inputError,\n startIcon,\n };\n }, [theme, colorScheme, disabled, hasError, hasStartIcon, hasEndIcon]);\n\nexport default useStyles;\n","/**\n * Copyright (c) 2024, 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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC, InputHTMLAttributes, ReactNode} from 'react';\nimport useStyles from './TextField.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\n\nexport interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className'> {\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Whether the field is disabled\n */\n disabled?: boolean;\n /**\n * Icon to display at the end (right) of the input\n */\n endIcon?: ReactNode;\n /**\n * Error message to display below the input\n */\n error?: string;\n /**\n * Helper text to display below the input\n */\n helperText?: string;\n /**\n * Label text to display above the input\n */\n label?: string;\n /**\n * Click handler for the end icon\n */\n onEndIconClick?: () => void;\n /**\n * Click handler for the start icon\n */\n onStartIconClick?: () => void;\n /**\n * Whether the field is required\n */\n required?: boolean;\n /**\n * Icon to display at the start (left) of the input\n */\n startIcon?: ReactNode;\n}\n\nconst TextField: FC<TextFieldProps> = ({\n label,\n error,\n required,\n className,\n disabled,\n helperText,\n startIcon,\n endIcon,\n onStartIconClick,\n onEndIconClick,\n type = 'text',\n style = {},\n ...rest\n}: TextFieldProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const hasError = !!error;\n const hasStartIcon = !!startIcon;\n const hasEndIcon = !!endIcon;\n const styles: Record<string, string> = useStyles(theme, colorScheme, disabled, hasError, hasStartIcon, hasEndIcon);\n\n const inputClassName: string = cx(\n withVendorCSSClassPrefix(bem('text-field', 'input')),\n styles['input'],\n hasError && styles['inputError'],\n disabled && styles['inputDisabled'],\n );\n\n const containerClassName: string = cx(\n withVendorCSSClassPrefix(bem('text-field', 'container')),\n styles['inputContainer'],\n );\n\n const startIconClassName: string = cx(withVendorCSSClassPrefix(bem('text-field', 'start-icon')), styles['startIcon']);\n\n const endIconClassName: string = cx(withVendorCSSClassPrefix(bem('text-field', 'end-icon')), styles['endIcon']);\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n className={cx(withVendorCSSClassPrefix(bem('text-field')), className)}\n style={style}\n >\n {label && (\n <InputLabel required={required} error={hasError}>\n {label}\n </InputLabel>\n )}\n <div className={containerClassName}>\n {startIcon && (\n <div\n className={startIconClassName}\n onClick={onStartIconClick}\n role={onStartIconClick ? 'button' : undefined}\n tabIndex={onStartIconClick && !disabled ? 0 : undefined}\n aria-label=\"Start icon\"\n >\n {startIcon}\n </div>\n )}\n <input\n className={inputClassName}\n type={type}\n disabled={disabled}\n aria-invalid={hasError}\n aria-required={required}\n {...rest}\n />\n {endIcon && (\n <div\n className={endIconClassName}\n onClick={onEndIconClick}\n role={onEndIconClick ? 'button' : undefined}\n tabIndex={onEndIconClick && !disabled ? 0 : undefined}\n aria-label=\"End icon\"\n >\n {endIcon}\n </div>\n )}\n </div>\n </FormControl>\n );\n};\n\nexport default TextField;\n","/**\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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {ChangeEvent, FC, SVGProps, useState} from 'react';\nimport useStyles from './PasswordField.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport Eye from '../Icons/Eye';\nimport EyeOff from '../Icons/EyeOff';\nimport TextField, {TextFieldProps} from '../TextField/TextField';\n\nexport interface PasswordFieldProps extends Omit<TextFieldProps, 'type' | 'endIcon' | 'onEndIconClick' | 'onChange'> {\n /**\n * Callback function when the field value changes\n */\n onChange: (value: string) => void;\n}\n\n/**\n * Password field component with show/hide toggle functionality.\n * This component extends TextField and adds password visibility toggle functionality.\n */\nconst PasswordField: FC<PasswordFieldProps> = ({\n onChange,\n className,\n disabled,\n error,\n ...textFieldProps\n}: PasswordFieldProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const [showPassword, setShowPassword] = useState(false);\n const styles: Record<string, string> = useStyles(theme, colorScheme, showPassword, !!disabled, !!error);\n\n const togglePasswordVisibility = (): void => {\n if (!disabled) {\n setShowPassword(!showPassword);\n }\n };\n\n const IconComponent: FC<SVGProps<SVGSVGElement>> = showPassword ? EyeOff : Eye;\n\n return (\n <TextField\n {...textFieldProps}\n className={cx(withVendorCSSClassPrefix(bem('password-field')), className)}\n type={showPassword ? 'text' : 'password'}\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n autoComplete=\"current-password\"\n disabled={disabled}\n error={error}\n endIcon={\n <IconComponent\n width={16}\n height={16}\n className={cx(\n withVendorCSSClassPrefix(bem('password-field', 'toggle-icon')),\n styles['toggleIcon'],\n showPassword ? styles['visibleIcon'] : styles['hiddenIcon'],\n )}\n />\n }\n onEndIconClick={togglePasswordVisibility}\n />\n );\n};\n\nexport default PasswordField;\n","/**\n * Copyright (c) 2024, 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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the Select component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param disabled - Whether the component is disabled\n * @param hasError - Whether the component has an error\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string, disabled: boolean, hasError: boolean): Record<string, string> =>\n useMemo(() => {\n const dropdownArrowColor: string = theme.colors.text.secondary.replace('#', '');\n const dropdownArrow = `data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23${dropdownArrowColor}%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E`;\n\n const select: string = css`\n width: 100%;\n padding: ${theme.vars.spacing.unit} calc(${theme.vars.spacing.unit} * 1.5);\n border: 1px solid ${hasError ? theme.vars.colors.error.main : theme.vars.colors.border};\n border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};\n font-size: ${theme.vars.typography.fontSizes.md};\n font-family: ${theme.vars.typography.fontFamily};\n color: ${theme.vars.colors.text.primary};\n background-color: ${disabled ? theme.vars.colors.background.disabled : theme.vars.colors.background.surface};\n outline: none;\n transition:\n border-color 0.2s ease,\n box-shadow 0.2s ease;\n appearance: none;\n background-image: url('${dropdownArrow}');\n background-repeat: no-repeat;\n background-position: right 0.7em top 50%;\n background-size: 0.65em auto;\n cursor: ${disabled ? 'not-allowed' : 'pointer'};\n\n &:focus {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n box-shadow: 0 0 0 2px ${hasError ? `${theme.vars.colors.error.main}20` : `${theme.vars.colors.primary.main}20`};\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n &:hover:not(:disabled) {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n }\n `;\n\n const selectError: string = css`\n border-color: ${theme.vars.colors.error.main};\n\n &:focus {\n border-color: ${theme.vars.colors.error.main};\n box-shadow: 0 0 0 2px ${theme.vars.colors.error.main}20;\n }\n\n &:hover:not(:disabled) {\n border-color: ${theme.vars.colors.error.main};\n }\n `;\n\n const selectDisabled: string = css`\n background-color: ${theme.vars.colors.background.disabled};\n opacity: 0.6;\n cursor: not-allowed;\n `;\n\n const option: string = css`\n padding: calc(${theme.vars.spacing.unit} / 2) ${theme.vars.spacing.unit};\n color: ${theme.vars.colors.text.primary};\n background-color: ${theme.vars.colors.background.surface};\n\n &:hover {\n background-color: ${theme.vars.colors.action.hover};\n }\n\n &:checked {\n background-color: ${theme.vars.colors.primary.main};\n color: ${theme.vars.colors.primary.contrastText};\n }\n `;\n\n return {\n option,\n select,\n selectDisabled,\n selectError,\n };\n }, [theme, colorScheme, disabled, hasError]);\n\nexport default useStyles;\n","/**\n * Copyright (c) 2024, 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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC, SelectHTMLAttributes} from 'react';\nimport useStyles from './Select.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\n\nexport interface SelectOption {\n /**\n * The text that will be displayed in the select\n */\n label: string;\n /**\n * The value that will be submitted with the form\n */\n value: string;\n}\n\nexport interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'className'> {\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Whether the field is disabled\n */\n disabled?: boolean;\n /**\n * Error message to display below the select\n */\n error?: string;\n /**\n * Helper text to display below the select\n */\n helperText?: string;\n /**\n * Label text to display above the select\n */\n label?: string;\n /**\n * The options to display in the select\n */\n options: SelectOption[];\n /**\n * Placeholder text for the default/empty option\n */\n placeholder?: string;\n /**\n * Whether the field is required\n */\n required?: boolean;\n}\n\nconst Select: FC<SelectProps> = ({\n label,\n error,\n className,\n required,\n disabled,\n helperText,\n placeholder,\n options,\n style = {},\n ...rest\n}: SelectProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const hasError = !!error;\n const styles: Record<string, string> = useStyles(theme, colorScheme, disabled, hasError);\n\n const selectClassName: string = cx(\n withVendorCSSClassPrefix(bem('select', 'input')),\n styles['select'],\n hasError && styles['selectError'],\n disabled && styles['selectDisabled'],\n );\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n className={cx(withVendorCSSClassPrefix(bem('select')), className)}\n style={style}\n >\n {label && (\n <InputLabel required={required} error={hasError}>\n {label}\n </InputLabel>\n )}\n <select\n className={selectClassName}\n disabled={disabled}\n aria-invalid={hasError}\n aria-required={required}\n {...rest}\n >\n {placeholder && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {options.map((option: SelectOption) => (\n <option key={option.value} value={option.value} className={styles['option']}>\n {option.label}\n </option>\n ))}\n </select>\n </FormControl>\n );\n};\n\nexport default Select;\n","/**\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 {FieldType} from '@thunderid/browser';\nimport {ChangeEvent, FC, ReactElement} from 'react';\nimport Checkbox from '../primitives/Checkbox/Checkbox';\nimport DatePicker from '../primitives/DatePicker/DatePicker';\nimport OtpField from '../primitives/OtpField/OtpField';\nimport PasswordField from '../primitives/PasswordField/PasswordField';\nimport Select, {SelectOption} from '../primitives/Select/Select';\nimport TextField from '../primitives/TextField/TextField';\n\n/**\n * Interface for field configuration.\n */\nexport interface FieldConfig {\n /**\n * Additional CSS class name.\n */\n className?: string;\n /**\n * Whether the field is disabled.\n */\n disabled?: boolean;\n /**\n * Error message to display.\n */\n error?: string;\n /**\n * Display name for the field.\n */\n label: string;\n /**\n * The name of the field.\n */\n name: string;\n /**\n * Callback function when the field loses focus.\n */\n onBlur?: () => void;\n /**\n * Callback function when the field value changes.\n */\n onChange: (value: string) => void;\n /**\n * Additional options for multi-valued fields.\n */\n options?: SelectOption[];\n /**\n * Placeholder text for the field.\n */\n placeholder?: string;\n /**\n * Whether the field is required.\n */\n required: boolean;\n /**\n * Whether the field has been touched/interacted with by the user.\n */\n touched?: boolean;\n /**\n * The field type.\n */\n type: FieldType;\n /**\n * Current value of the field.\n */\n value: string;\n}\n\n/**\n * Utility function to validate field values based on type\n */\nexport const validateFieldValue = (\n value: string,\n type: FieldType,\n required = false,\n touched = false,\n): string | null => {\n if (required && touched && (!value || value.trim() === '')) {\n return 'This field is required';\n }\n\n if (!value || value.trim() === '') {\n return null;\n }\n\n switch (type) {\n case FieldType.Number: {\n const numValue: number = parseInt(value, 10);\n if (Number.isNaN(numValue)) {\n return 'Please enter a valid number';\n }\n break;\n }\n default:\n break;\n }\n\n return null;\n};\n\n/**\n * Factory function to create form fields based on the EmbeddedSignInFlowAuthenticatorParamType.\n *\n * @param config - The field configuration\n * @returns The appropriate React component for the field type\n *\n * @example\n * ```tsx\n * const field = createField({\n * param: 'username',\n * type: EmbeddedSignInFlowAuthenticatorParamType.String,\n * label: 'Username',\n * confidential: false,\n * required: true,\n * value: '',\n * onChange: (value) => console.log(value)\n * });\n * ```\n */\nexport const createField = (config: FieldConfig): ReactElement => {\n const {\n name,\n type,\n label,\n required,\n value,\n onChange,\n onBlur,\n disabled = false,\n error,\n className,\n options = [],\n touched = false,\n placeholder,\n } = config;\n\n const validationError: string | null = error || validateFieldValue(value, type, required, touched);\n\n const commonProps: Record<string, any> = {\n className,\n 'data-testid': `thunderid-signin-${name}`,\n disabled,\n error: validationError,\n label,\n name,\n onBlur,\n placeholder,\n required,\n value,\n };\n\n switch (type) {\n case FieldType.Password:\n return <PasswordField {...commonProps} onChange={onChange} />;\n case FieldType.Text:\n return (\n <TextField\n {...commonProps}\n type=\"text\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n autoComplete=\"off\"\n />\n );\n case FieldType.Email:\n return (\n <TextField\n {...commonProps}\n type=\"email\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n autoComplete=\"email\"\n />\n );\n case FieldType.Tel:\n return (\n <TextField\n {...commonProps}\n type=\"tel\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n autoComplete=\"tel\"\n />\n );\n case FieldType.Date:\n return (\n <DatePicker {...commonProps} onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)} />\n );\n case FieldType.Checkbox: {\n const isChecked: boolean = value === 'true' || (value as any) === true;\n return (\n <Checkbox\n {...commonProps}\n checked={isChecked}\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.checked.toString())}\n />\n );\n }\n case FieldType.Otp:\n return (\n <OtpField {...commonProps} onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)} />\n );\n case FieldType.Number:\n return (\n <TextField\n {...commonProps}\n type=\"number\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n helperText=\"Enter a numeric value\"\n />\n );\n case FieldType.Select: {\n const fieldOptions: SelectOption[] = options.length > 0 ? options : [];\n\n if (fieldOptions.length > 0) {\n return (\n <Select\n {...commonProps}\n options={fieldOptions}\n onChange={(e: ChangeEvent<HTMLSelectElement>): void => onChange(e.target.value)}\n helperText=\"Select from available options\"\n />\n );\n }\n\n return (\n <TextField\n {...commonProps}\n type=\"text\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n helperText=\"Enter multiple values separated by commas (e.g., value1, value2, value3)\"\n placeholder=\"value1, value2, value3\"\n />\n );\n }\n default:\n return (\n <TextField\n {...commonProps}\n type=\"text\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n helperText=\"Unknown field type, treating as text\"\n />\n );\n }\n};\n\n/**\n * React component wrapper for the field factory.\n */\nexport const FieldFactory: FC<FieldConfig> = (props: FieldConfig): ReactElement => createField(props);\n\nexport default FieldFactory;\n","/**\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 {EmbeddedSignInFlowAuthenticatorParamType, FieldType} from '@thunderid/browser';\nimport {FC, ReactElement, useEffect} from 'react';\n// eslint-disable-next-line import/no-cycle\nimport {BaseSignInOptionProps} from './SignInOptionFactory';\nimport useFlow from '../../../../../../contexts/Flow/useFlow';\nimport useTheme from '../../../../../../contexts/Theme/useTheme';\nimport useTranslation from '../../../../../../hooks/useTranslation';\nimport {createField} from '../../../../../factories/FieldFactory';\nimport Button from '../../../../../primitives/Button/Button';\nimport OtpField from '../../../../../primitives/OtpField/OtpField';\n\n/**\n * Email OTP Sign-In Option Component.\n * Handles email-based OTP authentication.\n */\nconst EmailOtp: FC<BaseSignInOptionProps> = ({\n authenticator,\n formValues,\n touchedFields,\n isLoading,\n onInputChange,\n inputClassName = '',\n buttonClassName = '',\n preferences,\n}: BaseSignInOptionProps): ReactElement => {\n const {theme} = useTheme();\n const {t} = useTranslation(preferences?.i18n);\n const {setTitle, setSubtitle} = useFlow();\n\n const formFields: any = authenticator.metadata?.params?.sort((a: any, b: any) => a.order - b.order) || [];\n\n useEffect(() => {\n setTitle(t('email.otp.heading'));\n setSubtitle(t('email.otp.subheading'));\n }, [setTitle, setSubtitle, t]);\n\n // Check if this is an OTP field (typically has 'otpCode' or similar parameter)\n const hasOtpField: any = formFields.some(\n (param: any) => param.param.toLowerCase().includes('otp') || param.param.toLowerCase().includes('code'),\n );\n\n return (\n <>\n {formFields.map((param: any) => {\n const isOtpParam: any = param.param.toLowerCase().includes('otp') || param.param.toLowerCase().includes('code');\n\n return (\n <div key={param.param}>\n {isOtpParam && hasOtpField ? (\n <OtpField\n length={6}\n value={formValues[param.param] || ''}\n onChange={(event: any): void => onInputChange(param.param, event.target.value)}\n disabled={isLoading}\n className={inputClassName}\n />\n ) : (\n createField({\n className: inputClassName,\n disabled: isLoading,\n label: param.displayName,\n name: param.param,\n onChange: (value: any) => onInputChange(param.param, value),\n required: authenticator.requiredParams.includes(param.param),\n touched: touchedFields[param.param] || false,\n type:\n param.type === EmbeddedSignInFlowAuthenticatorParamType.String && param.confidential\n ? FieldType.Password\n : FieldType.Text,\n value: formValues[param.param] || '',\n })\n )}\n </div>\n );\n })}\n\n <Button\n fullWidth\n type=\"submit\"\n color=\"primary\"\n variant=\"solid\"\n disabled={isLoading}\n loading={isLoading}\n className={buttonClassName}\n style={{marginBottom: `calc(${theme.vars.spacing.unit} * 2)`}}\n >\n {t('email.otp.buttons.submit.text')}\n </Button>\n </>\n );\n};\n\nexport default EmailOtp;\n","/**\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 {EmbeddedSignInFlowAuthenticatorParamType, FieldType} from '@thunderid/browser';\nimport {FC, ReactElement, useEffect} from 'react';\n// eslint-disable-next-line import/no-cycle\nimport {BaseSignInOptionProps} from './SignInOptionFactory';\nimport useFlow from '../../../../../../contexts/Flow/useFlow';\nimport useTheme from '../../../../../../contexts/Theme/useTheme';\nimport useTranslation from '../../../../../../hooks/useTranslation';\nimport {createField} from '../../../../../factories/FieldFactory';\nimport Button from '../../../../../primitives/Button/Button';\n\n/**\n * Identifier First Sign-In Option Component.\n * Handles identifier-first authentication flow (username first, then password).\n */\nconst IdentifierFirst: FC<BaseSignInOptionProps> = ({\n authenticator,\n formValues,\n touchedFields,\n isLoading,\n onInputChange,\n inputClassName = '',\n buttonClassName = '',\n preferences,\n}: BaseSignInOptionProps): ReactElement => {\n const {theme} = useTheme();\n const {t} = useTranslation(preferences?.i18n);\n const {setTitle, setSubtitle} = useFlow();\n\n const formFields: any = authenticator.metadata?.params?.sort((a: any, b: any) => a.order - b.order) || [];\n\n useEffect(() => {\n setTitle(t('identifier.first.heading'));\n setSubtitle(t('identifier.first.subheading'));\n }, [setTitle, setSubtitle, t]);\n\n return (\n <>\n {formFields.map((param: any) => (\n <div key={param.param}>\n {createField({\n className: inputClassName,\n disabled: isLoading,\n label: param.displayName,\n name: param.param,\n onChange: (value: any) => onInputChange(param.param, value),\n placeholder: t(`elements.fields.generic.placeholder`, {\n field: (param.displayName || param.param).toLowerCase(),\n }),\n required: authenticator.requiredParams.includes(param.param),\n touched: touchedFields[param.param] || false,\n type:\n param.type === EmbeddedSignInFlowAuthenticatorParamType.String && param.confidential\n ? FieldType.Password\n : FieldType.Text,\n value: formValues[param.param] || '',\n })}\n </div>\n ))}\n\n <Button\n fullWidth\n type=\"submit\"\n color=\"primary\"\n variant=\"solid\"\n disabled={isLoading}\n loading={isLoading}\n className={buttonClassName}\n style={{marginBottom: `calc(${theme.vars.spacing.unit} * 2)`}}\n >\n {t('identifier.first.buttons.submit.text')}\n </Button>\n </>\n );\n};\n\nexport default IdentifierFirst;\n","/**\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 ApplicationNativeAuthenticationConstants,\n EmbeddedSignInFlowAuthenticatorKnownIdPType,\n} from '@thunderid/browser';\nimport {FC, ReactElement} from 'react';\n// eslint-disable-next-line import/no-cycle\nimport {BaseSignInOptionProps} from './SignInOptionFactory';\nimport useTranslation from '../../../../../../hooks/useTranslation';\nimport Button from '../../../../../primitives/Button/Button';\n\n/**\n * Multi Option Button Component.\n * Renders authenticators as selectable buttons for multi-option prompts.\n * Used when authenticators don't require immediate user input but need to be selected first.\n */\nconst MultiOptionButton: FC<BaseSignInOptionProps> = ({\n authenticator,\n isLoading,\n onSubmit,\n buttonClassName = '',\n preferences,\n}: BaseSignInOptionProps): ReactElement => {\n const {t} = useTranslation(preferences?.i18n);\n\n /**\n * Get display name for the authenticator.\n */\n const getDisplayName = (): string => {\n let authenticatorName: any = authenticator.authenticator;\n\n if (authenticator.idp !== EmbeddedSignInFlowAuthenticatorKnownIdPType.Local) {\n authenticatorName = authenticator.idp;\n }\n\n switch (authenticatorName) {\n default:\n return t('elements.buttons.multi.option.text', {connection: authenticatorName});\n }\n };\n\n /**\n * Get appropriate icon for the authenticator type.\n */\n const getIcon = (): ReactElement | null => {\n const {authenticatorId} = authenticator;\n\n switch (authenticatorId) {\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.SmsOtp:\n return (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fill=\"currentColor\"\n d=\"M20 15.5c-1.25 0-2.45-.2-3.57-.57a1.02 1.02 0 0 0-1.02.24l-2.2 2.2a15.074 15.074 0 0 1-6.59-6.59l2.2-2.2c.27-.27.35-.67.24-1.02A11.36 11.36 0 0 1 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1M12 3v10l3-3h6V3z\"\n />\n </svg>\n );\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.EmailOtp:\n return (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fill=\"currentColor\"\n d=\"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 4l-8 5l-8-5V6l8 5l8-5z\"\n />\n </svg>\n );\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Totp:\n return (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill=\"currentColor\" d=\"M12 1L3 5v6c0 5.55 3.84 10.74 9 12c5.16-1.26 9-6.45 9-12V5z\" />\n </svg>\n );\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.PushNotification:\n return (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fill=\"currentColor\"\n d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8m1-13h-2v6h2zm0 8h-2v2h2z\"\n />\n </svg>\n );\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Passkey:\n return (\n <svg fill=\"currentColor\" width=\"18\" height=\"18\" viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\">\n <g id=\"SVGRepo_bgCarrier\" strokeWidth=\"0\"></g>\n <g id=\"SVGRepo_tracerCarrier\" strokeLinecap=\"round\" strokeLinejoin=\"round\"></g>\n <g id=\"SVGRepo_iconCarrier\">\n <path d=\"M7.7 4.7C9.36 3.07 12.68 2 16.17 2S23 3.06 24.6 4.7A1 1 0 0 0 26 3.3C23.6.86 19.34 0 16.16 0S8.72.87 6.3 3.3a1 1 0 0 0 1.4 1.4zM29.2 12.55C26.38 6.88 22 4 16.17 4s-10.22 2.88-13 8.55a1 1 0 0 0 .44 1.34 1 1 0 0 0 1.35-.45C7.4 8.45 11.08 6 16.15 6s8.77 2.44 11.27 7.45a1 1 0 0 0 .9.55.87.87 0 0 0 .44-.1 1 1 0 0 0 .45-1.35zM19.4 28.08c-4.13-1.77-5.8-4.5-6-6.5a2.87 2.87 0 0 1 1.13-2.75c.85-.57 2.1.24 3.87 1.52s4.13 3 6.17 1.45c1.8-1.35 2.34-3.76 1.45-6.44A10.85 10.85 0 0 0 16.16 8C7.2 8 4 15.75 4 23a1 1 0 0 0 2 0c0-3 .73-13 10.16-13 3.9 0 7 3.1 8 6 .3.87.8 3-.75 4.2-.8.6-2-.2-3.8-1.47s-4.07-2.94-6.14-1.56a4.87 4.87 0 0 0-2 4.6c.24 2.56 2.24 6 7.18 8.15A1 1 0 0 0 19 30a1 1 0 0 0 .4-1.92zM10 19.24a7.06 7.06 0 0 1 5.2-4.65c2.24-.43 4.32.6 6 3a1 1 0 1 0 1.62-1.17c-2.9-4.07-6.27-4.12-8-3.8A9.1 9.1 0 0 0 8 18.77c-1 3.94.43 8.27 4.2 12.87a1 1 0 0 0 .8.37.94.94 0 0 0 .63-.23 1 1 0 0 0 .14-1.4c-3.34-4.1-4.62-7.83-3.77-11.13zM25.3 24.3a3 3 0 0 1-3.06.63c-2.4-.57-4.78-2.7-5.3-4.25a1 1 0 1 0-1.9.64c.8 2.33 3.87 4.88 6.74 5.56a6.84 6.84 0 0 0 1.52.18 4.7 4.7 0 0 0 3.4-1.35 1 1 0 0 0-1.4-1.4z\"></path>{' '}\n </g>\n </svg>\n );\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.MagicLink:\n return (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fill=\"currentColor\"\n d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8m1-13h-2v6h2zm0 8h-2v2h2z\"\n />\n </svg>\n );\n default:\n return (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fill=\"currentColor\"\n d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2m-2 15l-5-5l1.41-1.41L10 14.17l7.59-7.59L19 8z\"\n />\n </svg>\n );\n }\n };\n\n /**\n * Handle button click.\n */\n const handleClick = (): any => {\n // For multi-option buttons, we call onSubmit without form data\n // This will trigger the authenticator selection and likely move to the next step\n onSubmit(authenticator);\n };\n\n return (\n <Button\n fullWidth\n type=\"button\"\n color=\"secondary\"\n variant=\"solid\"\n disabled={isLoading}\n onClick={handleClick}\n className={buttonClassName}\n startIcon={getIcon()}\n >\n {getDisplayName()}\n </Button>\n );\n};\n\nexport default MultiOptionButton;\n","/**\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 {EmbeddedSignInFlowAuthenticatorParamType, FieldType} from '@thunderid/browser';\nimport {FC, ReactElement, useEffect} from 'react';\n// eslint-disable-next-line import/no-cycle\nimport {BaseSignInOptionProps} from './SignInOptionFactory';\nimport useFlow from '../../../../../../contexts/Flow/useFlow';\nimport useTheme from '../../../../../../contexts/Theme/useTheme';\nimport useTranslation from '../../../../../../hooks/useTranslation';\nimport {createField} from '../../../../../factories/FieldFactory';\nimport Button from '../../../../../primitives/Button/Button';\nimport OtpField from '../../../../../primitives/OtpField/OtpField';\n\n/**\n * SMS OTP Sign-In Option Component.\n * Handles SMS-based OTP authentication.\n */\nconst SmsOtp: FC<BaseSignInOptionProps> = ({\n authenticator,\n formValues,\n touchedFields,\n isLoading,\n onInputChange,\n inputClassName = '',\n buttonClassName = '',\n preferences,\n}: BaseSignInOptionProps): ReactElement => {\n const {theme} = useTheme();\n const {t} = useTranslation(preferences?.i18n);\n const {setTitle, setSubtitle} = useFlow();\n\n const formFields: any = authenticator.metadata?.params?.sort((a: any, b: any) => a.order - b.order) || [];\n\n useEffect(() => {\n setTitle(t('sms.otp.heading'));\n setSubtitle(t('sms.otp.subheading'));\n }, [setTitle, setSubtitle, t]);\n\n const hasOtpField: any = formFields.some(\n (param: any) => param.param.toLowerCase().includes('otp') || param.param.toLowerCase().includes('code'),\n );\n\n return (\n <>\n {formFields.map((param: any) => {\n const isOtpParam: any = param.param.toLowerCase().includes('otp') || param.param.toLowerCase().includes('code');\n\n return (\n <div key={param.param}>\n {isOtpParam && hasOtpField ? (\n <OtpField\n length={6}\n value={formValues[param.param] || ''}\n onChange={(event: any): void => onInputChange(param.param, event.target.value)}\n disabled={isLoading}\n className={inputClassName}\n />\n ) : (\n createField({\n className: inputClassName,\n disabled: isLoading,\n label: param.displayName,\n name: param.param,\n onChange: (value: any) => onInputChange(param.param, value),\n required: authenticator.requiredParams.includes(param.param),\n touched: touchedFields[param.param] || false,\n type:\n param.type === EmbeddedSignInFlowAuthenticatorParamType.String && param.confidential\n ? FieldType.Password\n : FieldType.Text,\n value: formValues[param.param] || '',\n })\n )}\n </div>\n );\n })}\n\n <Button\n fullWidth\n type=\"submit\"\n color=\"primary\"\n variant=\"solid\"\n disabled={isLoading}\n loading={isLoading}\n className={buttonClassName}\n style={{marginBottom: `calc(${theme.vars.spacing.unit} * 2)`}}\n >\n {t('sms.otp.buttons.submit.text')}\n </Button>\n </>\n );\n};\n\nexport default SmsOtp;\n","/**\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 {FC, HTMLAttributes, ReactElement} from 'react';\n// eslint-disable-next-line import/no-cycle\nimport {BaseSignInOptionProps} from './SignInOptionFactory';\nimport useTranslation from '../../../../../../hooks/useTranslation';\nimport Button from '../../../../../primitives/Button/Button';\n\n/**\n * Social Login Sign-In Option Component.\n * Handles authentication with external identity providers (Google, GitHub, etc.).\n */\nconst SocialLogin: FC<BaseSignInOptionProps & HTMLAttributes<HTMLButtonElement>> = ({\n isLoading,\n preferences,\n children,\n ...rest\n}: BaseSignInOptionProps & HTMLAttributes<HTMLButtonElement>): ReactElement => {\n const {t} = useTranslation(preferences?.i18n);\n return (\n <Button\n {...rest}\n fullWidth\n type=\"button\"\n color=\"secondary\"\n variant=\"outline\"\n disabled={isLoading}\n startIcon={\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fill=\"currentColor\"\n d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\"\n />\n </svg>\n }\n >\n {t('elements.buttons.social.text', {connection: children as string})}\n </Button>\n );\n};\n\nexport default SocialLogin;\n","/**\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 {EmbeddedSignInFlowAuthenticatorParamType, FieldType} from '@thunderid/browser';\nimport {FC, ReactElement, useEffect} from 'react';\n// eslint-disable-next-line import/no-cycle\nimport {BaseSignInOptionProps} from './SignInOptionFactory';\nimport useFlow from '../../../../../../contexts/Flow/useFlow';\nimport useTheme from '../../../../../../contexts/Theme/useTheme';\nimport useTranslation from '../../../../../../hooks/useTranslation';\nimport {createField} from '../../../../../factories/FieldFactory';\nimport Button from '../../../../../primitives/Button/Button';\nimport OtpField from '../../../../../primitives/OtpField/OtpField';\n\n/**\n * TOTP Sign-In Option Component.\n * Handles Time-based One-Time Password (TOTP) authentication.\n */\nconst Totp: FC<BaseSignInOptionProps> = ({\n authenticator,\n formValues,\n touchedFields,\n isLoading,\n onInputChange,\n inputClassName = '',\n buttonClassName = '',\n preferences,\n}: BaseSignInOptionProps): ReactElement => {\n const {theme} = useTheme();\n const {t} = useTranslation(preferences?.i18n);\n const {setTitle, setSubtitle} = useFlow();\n\n const formFields: any = authenticator.metadata?.params?.sort((a: any, b: any) => a.order - b.order) || [];\n\n useEffect(() => {\n setTitle(t('totp.heading'));\n setSubtitle(t('totp.subheading'));\n }, [setTitle, setSubtitle, t]);\n\n const hasTotpField: any = formFields.some(\n (param: any) => param.param.toLowerCase().includes('totp') || param.param.toLowerCase().includes('token'),\n );\n\n return (\n <>\n {formFields.map((param: any) => {\n const isTotpParam: any =\n param.param.toLowerCase().includes('totp') || param.param.toLowerCase().includes('token');\n\n return (\n <div key={param.param}>\n {isTotpParam && hasTotpField ? (\n <OtpField\n length={6}\n value={formValues[param.param] || ''}\n onChange={(event: any): void => onInputChange(param.param, event.target.value)}\n disabled={isLoading}\n className={inputClassName}\n />\n ) : (\n createField({\n className: inputClassName,\n disabled: isLoading,\n label: param.displayName,\n name: param.param,\n onChange: (value: any) => onInputChange(param.param, value),\n required: authenticator.requiredParams.includes(param.param),\n touched: touchedFields[param.param] || false,\n type:\n param.type === EmbeddedSignInFlowAuthenticatorParamType.String && param.confidential\n ? FieldType.Password\n : FieldType.Text,\n value: formValues[param.param] || '',\n })\n )}\n </div>\n );\n })}\n\n <Button\n fullWidth\n type=\"submit\"\n color=\"primary\"\n variant=\"solid\"\n disabled={isLoading}\n loading={isLoading}\n className={buttonClassName}\n style={{marginBottom: `calc(${theme.vars.spacing.unit} * 2)`}}\n >\n {t('totp.buttons.submit.text')}\n </Button>\n </>\n );\n};\n\nexport default Totp;\n","/**\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 {EmbeddedSignInFlowAuthenticatorParamType, FieldType} from '@thunderid/browser';\nimport {FC, ReactElement, useEffect} from 'react';\n// eslint-disable-next-line import/no-cycle\nimport {BaseSignInOptionProps} from './SignInOptionFactory';\nimport useFlow from '../../../../../../contexts/Flow/useFlow';\nimport useTheme from '../../../../../../contexts/Theme/useTheme';\nimport useTranslation from '../../../../../../hooks/useTranslation';\nimport {createField} from '../../../../../factories/FieldFactory';\nimport Button from '../../../../../primitives/Button/Button';\n\n/**\n * Username Password Sign-In Option Component.\n * Handles traditional username and password authentication.\n */\nconst UsernamePassword: FC<BaseSignInOptionProps> = ({\n authenticator,\n formValues,\n touchedFields,\n isLoading,\n onInputChange,\n inputClassName = '',\n buttonClassName = '',\n preferences,\n}: BaseSignInOptionProps): ReactElement => {\n const {theme} = useTheme();\n const {t} = useTranslation(preferences?.i18n);\n const {setTitle, setSubtitle} = useFlow();\n\n const formFields: any =\n authenticator.metadata?.params\n ?.sort((a: any, b: any) => a.order - b.order)\n ?.filter((param: any) => param.param !== 'totp') || []; // Exclude TOTP fields for username/password\n\n useEffect(() => {\n setTitle(t('username.password.heading'));\n setSubtitle(t('username.password.subheading'));\n }, [setTitle, setSubtitle, t]);\n\n return (\n <>\n {formFields.map((param: any) => (\n <div key={param.param}>\n {createField({\n className: inputClassName,\n disabled: isLoading,\n label: param.displayName,\n name: param.param,\n onChange: (value: any) => onInputChange(param.param, value),\n placeholder: t(`elements.fields.generic.placeholder`, {\n field: (param.displayName || param.param).toLowerCase(),\n }),\n required: authenticator.requiredParams.includes(param.param),\n touched: touchedFields[param.param] || false,\n type:\n param.type === EmbeddedSignInFlowAuthenticatorParamType.String && param.confidential\n ? FieldType.Password\n : FieldType.Text,\n value: formValues[param.param] || '',\n })}\n </div>\n ))}\n\n <Button\n fullWidth\n type=\"submit\"\n color=\"primary\"\n variant=\"solid\"\n disabled={isLoading}\n loading={isLoading}\n className={buttonClassName}\n data-testid=\"thunderid-signin-submit\"\n style={{marginBottom: `calc(${theme.vars.spacing.unit} * 2)`}}\n >\n {t('username.password.buttons.submit.text')}\n </Button>\n </>\n );\n};\n\nexport default UsernamePassword;\n","/**\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 {WithPreferences} from '@thunderid/browser';\nimport {FC, HTMLAttributes} from 'react';\nimport useTranslation from '../../hooks/useTranslation';\nimport Button from '../primitives/Button/Button';\n\nexport interface FacebookButtonProps extends WithPreferences {\n /**\n * Whether the component is in loading state.\n */\n isLoading?: boolean;\n}\n\n/**\n * Facebook Sign-In Button Component.\n * Handles authentication with Facebook identity provider.\n */\nconst FacebookButton: FC<FacebookButtonProps & HTMLAttributes<HTMLButtonElement>> = ({\n isLoading,\n preferences,\n children,\n ...rest\n}: FacebookButtonProps & HTMLAttributes<HTMLButtonElement>) => {\n const {t} = useTranslation(preferences?.i18n);\n\n return (\n <Button\n {...rest}\n fullWidth\n type=\"button\"\n color=\"primary\"\n variant=\"solid\"\n disabled={isLoading}\n startIcon={\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 512 512\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fill=\"#1976D2\"\n d=\"M448,0H64C28.704,0,0,28.704,0,64v384c0,35.296,28.704,64,64,64h384c35.296,0,64-28.704,64-64V64C512,28.704,483.296,0,448,0z\"\n />\n <path\n fill=\"#FAFAFA\"\n d=\"M432,256h-80v-64c0-17.664,14.336-16,32-16h32V96h-64l0,0c-53.024,0-96,42.976-96,96v64h-64v80h64v176h96V336h48L432,256z\"\n />\n </svg>\n }\n >\n {children ?? t('elements.buttons.facebook.text')}\n </Button>\n );\n};\n\nexport default FacebookButton;\n","/**\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 {WithPreferences} from '@thunderid/browser';\nimport {FC, HTMLAttributes} from 'react';\nimport useTranslation from '../../hooks/useTranslation';\nimport Button from '../primitives/Button/Button';\n\nexport interface GithubButtonProps extends WithPreferences {\n /**\n * Whether the component is in loading state.\n */\n isLoading?: boolean;\n}\n\n/**\n * GitHub Sign-In Button Component.\n * Handles authentication with GitHub identity provider.\n */\nconst GitHubButton: FC<GithubButtonProps & HTMLAttributes<HTMLButtonElement>> = ({\n isLoading,\n preferences,\n children,\n ...rest\n}: GithubButtonProps & HTMLAttributes<HTMLButtonElement>) => {\n const {t} = useTranslation(preferences?.i18n);\n\n return (\n <Button\n {...rest}\n fullWidth\n type=\"button\"\n color=\"secondary\"\n variant=\"solid\"\n disabled={isLoading}\n startIcon={\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 67.91 66.233\" xmlns=\"http://www.w3.org/2000/svg\">\n <g transform=\"translate(-386.96 658.072)\">\n <path\n d=\"M420.915-658.072a33.956,33.956,0,0,0-33.955,33.955,33.963,33.963,0,0,0,23.221,32.22c1.7.314,2.32-.737,2.32-1.633,0-.81-.031-3.484-.046-6.322-9.446,2.054-11.44-4.006-11.44-4.006-1.545-3.925-3.77-4.968-3.77-4.968-3.081-2.107.232-2.064.232-2.064,3.41.239,5.205,3.5,5.205,3.5,3.028,5.19,7.943,3.69,9.881,2.822a7.23,7.23,0,0,1,2.156-4.54c-7.542-.859-15.47-3.77-15.47-16.781a13.141,13.141,0,0,1,3.5-9.114,12.2,12.2,0,0,1,.329-8.986s2.851-.913,9.34,3.48a32.545,32.545,0,0,1,8.5-1.143,32.629,32.629,0,0,1,8.506,1.143c6.481-4.393,9.328-3.48,9.328-3.48a12.185,12.185,0,0,1,.333,8.986,13.115,13.115,0,0,1,3.495,9.114c0,13.042-7.943,15.913-15.5,16.754,1.218,1.054,2.3,3.12,2.3,6.288,0,4.543-.039,8.2-.039,9.318,0,.9.611,1.962,2.332,1.629a33.959,33.959,0,0,0,23.2-32.215,33.955,33.955,0,0,0-33.955-33.955\"\n fill=\"#ffffff\"\n />\n </g>\n </svg>\n }\n >\n {children ?? t('elements.buttons.github.text')}\n </Button>\n );\n};\n\nexport default GitHubButton;\n","/**\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 {WithPreferences} from '@thunderid/browser';\nimport {FC, HTMLAttributes} from 'react';\nimport useTranslation from '../../hooks/useTranslation';\nimport Button from '../primitives/Button/Button';\n\nexport interface GoogleButtonProps extends WithPreferences {\n /**\n * Whether the component is in loading state.\n */\n isLoading?: boolean;\n}\n\n/**\n * Google Sign-In Button Component.\n * Handles authentication with Google identity provider.\n */\nconst GoogleButton: FC<GoogleButtonProps & HTMLAttributes<HTMLButtonElement>> = ({\n isLoading,\n preferences,\n children,\n ...rest\n}: GoogleButtonProps & HTMLAttributes<HTMLButtonElement>) => {\n const {t} = useTranslation(preferences?.i18n);\n\n return (\n <Button\n {...rest}\n fullWidth\n type=\"button\"\n color=\"secondary\"\n variant=\"solid\"\n disabled={isLoading}\n startIcon={\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 67.91 67.901\" xmlns=\"http://www.w3.org/2000/svg\">\n <g transform=\"translate(-0.001 -0.001)\">\n <path\n d=\"M15.049,160.965l-2.364,8.824-8.639.183a34.011,34.011,0,0,1-.25-31.7h0l7.691,1.41,3.369,7.645a20.262,20.262,0,0,0,.19,13.642Z\"\n transform=\"translate(0 -119.93)\"\n fill=\"#fbbb00\"\n />\n <path\n d=\"M294.24,208.176A33.939,33.939,0,0,1,282.137,241h0l-9.687-.494-1.371-8.559a20.235,20.235,0,0,0,8.706-10.333H261.628V208.176Z\"\n transform=\"translate(-226.93 -180.567)\"\n fill=\"#518ef8\"\n />\n <path\n d=\"M81.668,328.8h0a33.962,33.962,0,0,1-51.161-10.387l11-9.006a20.192,20.192,0,0,0,29.1,10.338Z\"\n transform=\"translate(-26.463 -268.374)\"\n fill=\"#28b446\"\n />\n <path\n d=\"M80.451,7.816l-11,9A20.19,20.19,0,0,0,39.686,27.393l-11.06-9.055h0A33.959,33.959,0,0,1,80.451,7.816Z\"\n transform=\"translate(-24.828)\"\n fill=\"#f14336\"\n />\n </g>\n </svg>\n }\n >\n {children ?? t('elements.buttons.google.text')}\n </Button>\n );\n};\n\nexport default GoogleButton;\n","/**\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 {WithPreferences} from '@thunderid/browser';\nimport {FC, HTMLAttributes} from 'react';\nimport useTranslation from '../../hooks/useTranslation';\nimport Button from '../primitives/Button/Button';\n\nexport interface LinkedInButtonProps extends WithPreferences {\n /**\n * Whether the component is in loading state.\n */\n isLoading?: boolean;\n}\n\n/**\n * LinkedIn Sign-In Button Component.\n * Handles authentication with LinkedIn identity provider.\n */\nconst LinkedInButton: FC<LinkedInButtonProps & HTMLAttributes<HTMLButtonElement>> = ({\n isLoading,\n preferences,\n children,\n ...rest\n}: LinkedInButtonProps & HTMLAttributes<HTMLButtonElement>) => {\n const {t} = useTranslation(preferences?.i18n);\n\n return (\n <Button\n {...rest}\n fullWidth\n type=\"button\"\n color=\"secondary\"\n variant=\"solid\"\n disabled={isLoading}\n startIcon={\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fill=\"#0077B5\"\n d=\"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z\"\n />\n </svg>\n }\n >\n {children ?? t('elements.buttons.linkedin.text')}\n </Button>\n );\n};\n\nexport default LinkedInButton;\n","/**\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 {WithPreferences} from '@thunderid/browser';\nimport {FC, HTMLAttributes} from 'react';\nimport useTranslation from '../../hooks/useTranslation';\nimport Button from '../primitives/Button/Button';\n\nexport interface MicrosoftButtonProps extends WithPreferences {\n /**\n * Whether the component is in loading state.\n */\n isLoading?: boolean;\n}\n\n/**\n * Microsoft Sign-In Button Component.\n * Handles authentication with Microsoft identity provider.\n */\nconst MicrosoftButton: FC<MicrosoftButtonProps & HTMLAttributes<HTMLButtonElement>> = ({\n isLoading,\n preferences,\n children,\n ...rest\n}: MicrosoftButtonProps & HTMLAttributes<HTMLButtonElement>) => {\n const {t} = useTranslation(preferences?.i18n);\n\n return (\n <Button\n {...rest}\n fullWidth\n type=\"button\"\n color=\"secondary\"\n variant=\"solid\"\n disabled={isLoading}\n startIcon={\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 23 23\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill=\"#f3f3f3\" d=\"M0 0h23v23H0z\" />\n <path fill=\"#f35325\" d=\"M1 1h10v10H1z\" />\n <path fill=\"#81bc06\" d=\"M12 1h10v10H12z\" />\n <path fill=\"#05a6f0\" d=\"M1 12h10v10H1z\" />\n <path fill=\"#ffba08\" d=\"M12 12h10v10H12z\" />\n </svg>\n }\n >\n {children ?? t('elements.buttons.microsoft.text')}\n </Button>\n );\n};\n\nexport default MicrosoftButton;\n","/**\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 {WithPreferences} from '@thunderid/browser';\nimport {FC, HTMLAttributes} from 'react';\nimport useTranslation from '../../hooks/useTranslation';\nimport Button from '../primitives/Button/Button';\n\nexport interface SignInWithEthereumButtonProps extends WithPreferences {\n /**\n * Whether the component is in loading state.\n */\n isLoading?: boolean;\n}\n\n/**\n * Sign In With Ethereum Button Component.\n * Handles authentication with Sign In With Ethereum identity provider.\n */\nconst SignInWithEthereumButton: FC<SignInWithEthereumButtonProps & HTMLAttributes<HTMLButtonElement>> = ({\n isLoading,\n preferences,\n children,\n ...rest\n}: SignInWithEthereumButtonProps & HTMLAttributes<HTMLButtonElement>) => {\n const {t} = useTranslation(preferences?.i18n);\n\n return (\n <Button\n {...rest}\n fullWidth\n type=\"button\"\n color=\"secondary\"\n variant=\"solid\"\n disabled={isLoading}\n startIcon={\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fill=\"#627EEA\"\n d=\"M11.944 17.97L4.58 13.62 11.943 24l7.37-10.38-7.372 4.35h.003zM12.056 0L4.69 12.223l7.365 4.354 7.365-4.35L12.056 0z\"\n />\n </svg>\n }\n >\n {children ?? t('elements.buttons.ethereum.text')}\n </Button>\n );\n};\n\nexport default SignInWithEthereumButton;\n","/**\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 EmbeddedSignInFlowAuthenticator,\n EmbeddedSignInFlowAuthenticatorKnownIdPType,\n ApplicationNativeAuthenticationConstants,\n WithPreferences,\n} from '@thunderid/browser';\nimport {ReactElement} from 'react';\n// eslint-disable-next-line import/no-cycle, import/no-named-as-default\nimport EmailOtp from './EmailOtp';\n// eslint-disable-next-line import/no-cycle, import/no-named-as-default\nimport IdentifierFirst from './IdentifierFirst';\n// eslint-disable-next-line import/no-cycle\nimport MultiOptionButton from './MultiOptionButton';\n// eslint-disable-next-line import/no-cycle, import/no-named-as-default\nimport SmsOtp from './SmsOtp';\n// eslint-disable-next-line import/no-cycle\nimport SocialButton from './SocialButton';\n// eslint-disable-next-line import/no-cycle, import/no-named-as-default\nimport Totp from './Totp';\n// eslint-disable-next-line import/no-cycle, import/no-named-as-default\nimport UsernamePassword from './UsernamePassword';\nimport FacebookButton from '../../../../../adapters/FacebookButton';\nimport GitHubButton from '../../../../../adapters/GitHubButton';\nimport GoogleButton from '../../../../../adapters/GoogleButton';\nimport LinkedInButton from '../../../../../adapters/LinkedInButton';\nimport MicrosoftButton from '../../../../../adapters/MicrosoftButton';\nimport SignInWithEthereumButton from '../../../../../adapters/SignInWithEthereumButton';\n\n/**\n * Base props that all sign-in option components share.\n */\nexport interface BaseSignInOptionProps extends WithPreferences {\n /**\n * The authenticator configuration.\n */\n authenticator?: EmbeddedSignInFlowAuthenticator;\n\n /**\n * Custom CSS class name for the submit button.\n */\n buttonClassName?: string;\n\n /**\n * Error message to display.\n */\n error?: string | null;\n\n /**\n * Current form values.\n */\n formValues: Record<string, string>;\n\n /**\n * Custom CSS class name for form inputs.\n */\n inputClassName?: string;\n\n /**\n * Whether the component is in loading state.\n */\n isLoading: boolean;\n\n /**\n * Callback function called when input values change.\n */\n onInputChange: (param: string, value: string) => void;\n\n /**\n * Callback function called when the option is submitted.\n */\n onSubmit?: (authenticator: EmbeddedSignInFlowAuthenticator, formData?: Record<string, string>) => void;\n\n /**\n * Text for the submit button.\n */\n submitButtonText?: string;\n\n /**\n * Touched state for form fields.\n */\n touchedFields: Record<string, boolean>;\n}\n\n/**\n * Creates the appropriate sign-in option component based on the authenticator's ID.\n */\nexport const createSignInOption = ({\n authenticator,\n onSubmit,\n buttonClassName,\n preferences,\n ...rest\n}: BaseSignInOptionProps): ReactElement => {\n // Check if this authenticator has params (indicating it needs user input)\n const hasParams: any = authenticator.metadata?.params && authenticator.metadata.params.length > 0;\n\n // Use authenticatorId to determine the component type\n switch (authenticator.authenticatorId) {\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.UsernamePassword:\n return <UsernamePassword authenticator={authenticator} preferences={preferences} onSubmit={onSubmit} {...rest} />;\n\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.IdentifierFirst:\n return <IdentifierFirst authenticator={authenticator} preferences={preferences} onSubmit={onSubmit} {...rest} />;\n\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Google:\n return (\n <GoogleButton\n className={buttonClassName}\n onClick={(): any => onSubmit(authenticator)}\n preferences={preferences}\n {...rest}\n />\n );\n\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.GitHub:\n return (\n <GitHubButton\n preferences={preferences}\n className={buttonClassName}\n onClick={(): any => onSubmit(authenticator)}\n {...rest}\n />\n );\n\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Microsoft:\n return (\n <MicrosoftButton\n preferences={preferences}\n className={buttonClassName}\n onClick={(): any => onSubmit(authenticator)}\n {...rest}\n />\n );\n\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Facebook:\n return (\n <FacebookButton\n preferences={preferences}\n className={buttonClassName}\n onClick={(): any => onSubmit(authenticator)}\n {...rest}\n />\n );\n\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.LinkedIn:\n return (\n <LinkedInButton\n preferences={preferences}\n className={buttonClassName}\n onClick={(): any => onSubmit(authenticator)}\n {...rest}\n />\n );\n\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.SignInWithEthereum:\n return (\n <SignInWithEthereumButton\n preferences={preferences}\n className={buttonClassName}\n onClick={(): any => onSubmit(authenticator)}\n {...rest}\n />\n );\n\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.EmailOtp:\n // If it has params, render as input form, otherwise as selection button\n return hasParams ? (\n <EmailOtp authenticator={authenticator} preferences={preferences} onSubmit={onSubmit} {...rest} />\n ) : (\n <MultiOptionButton authenticator={authenticator} preferences={preferences} onSubmit={onSubmit} {...rest} />\n );\n\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Totp:\n // If it has params, render as input form, otherwise as selection button\n return hasParams ? (\n <Totp authenticator={authenticator} preferences={preferences} onSubmit={onSubmit} {...rest} />\n ) : (\n <MultiOptionButton authenticator={authenticator} preferences={preferences} onSubmit={onSubmit} {...rest} />\n );\n\n case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.SmsOtp:\n // If it has params, render as input form, otherwise as selection button\n return hasParams ? (\n <SmsOtp authenticator={authenticator} preferences={preferences} onSubmit={onSubmit} {...rest} />\n ) : (\n <MultiOptionButton authenticator={authenticator} preferences={preferences} onSubmit={onSubmit} {...rest} />\n );\n\n default:\n // Check if it's a federated authenticator (non-LOCAL idp)\n if (authenticator.idp !== EmbeddedSignInFlowAuthenticatorKnownIdPType.Local) {\n // For unknown federated authenticators, use generic social login\n return (\n <SocialButton\n authenticator={authenticator}\n preferences={preferences}\n className={buttonClassName}\n onClick={(): any => onSubmit(authenticator)}\n {...rest}\n >\n {authenticator.idp}\n </SocialButton>\n );\n }\n\n // For LOCAL authenticators, decide based on whether they have params\n if (hasParams) {\n // Fallback to username/password for unknown local authenticators with params\n return (\n <UsernamePassword authenticator={authenticator} preferences={preferences} onSubmit={onSubmit} {...rest} />\n );\n }\n // Use multi-option button for LOCAL authenticators without params\n return (\n <MultiOptionButton authenticator={authenticator} preferences={preferences} onSubmit={onSubmit} {...rest} />\n );\n }\n};\n\n/**\n * Convenience function that creates the appropriate sign-in option component from an authenticator.\n */\nexport const createSignInOptionFromAuthenticator = (\n authenticator: EmbeddedSignInFlowAuthenticator,\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n isLoading: boolean,\n onInputChange: (param: string, value: string) => void,\n onSubmit: (authenticator: EmbeddedSignInFlowAuthenticator, formData?: Record<string, string>) => void,\n options?: {\n buttonClassName?: string;\n error?: string | null;\n inputClassName?: string;\n },\n): ReactElement =>\n createSignInOption({\n authenticator,\n formValues,\n isLoading,\n onInputChange,\n onSubmit,\n touchedFields,\n ...options,\n });\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nexport type AlertVariant = 'success' | 'error' | 'warning' | 'info';\n\n/**\n * Creates styles for the Alert component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param variant - The alert variant\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string, variant: AlertVariant): Record<string, string> =>\n useMemo(() => {\n const baseAlert: string = css`\n padding: calc(${theme.vars.spacing.unit} * 2);\n border-radius: ${theme.vars.borderRadius.medium};\n border: 1px solid;\n font-family: ${theme.vars.typography.fontFamily};\n display: flex;\n gap: calc(${theme.vars.spacing.unit} * 1.5);\n align-items: flex-start;\n `;\n\n const variantStyles: Record<string, string> = {\n error: css`\n background-color: color-mix(in srgb, ${theme.vars.colors.error.main} 20%, white);\n border-color: ${theme.vars.colors.error.main};\n color: ${theme.vars.colors.error.main};\n `,\n info: css`\n background-color: color-mix(in srgb, ${theme.vars.colors.info.main} 20%, white);\n border-color: ${theme.vars.colors.info.main};\n color: ${theme.vars.colors.info.main};\n `,\n success: css`\n background-color: color-mix(in srgb, ${theme.vars.colors.success.main} 20%, white);\n border-color: ${theme.vars.colors.success.main};\n color: ${theme.vars.colors.success.main};\n `,\n warning: css`\n background-color: color-mix(in srgb, ${theme.vars.colors.warning.main} 20%, white);\n border-color: ${theme.vars.colors.warning.main};\n color: ${theme.vars.colors.warning.main};\n `,\n };\n\n const iconStyles: string = css`\n flex-shrink: 0;\n margin-top: calc(${theme.vars.spacing.unit} * 0.25);\n width: calc(${theme.vars.spacing.unit} * 2.5);\n height: calc(${theme.vars.spacing.unit} * 2.5);\n color: ${theme.vars.colors[variant]?.contrastText};\n `;\n\n const contentStyles: string = css`\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: ${theme.vars.spacing.unit};\n `;\n\n const titleStyles: string = css`\n margin: 0;\n font-size: ${theme.vars.typography.fontSizes.sm};\n font-weight: 600;\n line-height: 1.4;\n color: ${theme.vars.colors[variant]?.contrastText};\n `;\n\n const descriptionStyles: string = css`\n margin: 0;\n font-size: ${theme.vars.typography.fontSizes.sm};\n line-height: 1.4;\n color: ${theme.vars.colors.text.secondary};\n `;\n\n return {\n alert: baseAlert,\n content: contentStyles,\n description: descriptionStyles,\n icon: iconStyles,\n title: titleStyles,\n variant: variantStyles[variant],\n };\n }, [theme, colorScheme, variant]);\n\nexport default useStyles;\n","/**\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 {FC, SVGProps} from 'react';\n\n/**\n * CircleAlert icon component.\n */\nconst CircleAlert: FC<SVGProps<SVGSVGElement>> = (props: SVGProps<SVGSVGElement>) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" />\n <line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />\n </svg>\n);\n\nexport default CircleAlert;\n","/**\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 {FC, SVGProps} from 'react';\n\n/**\n * CircleCheck icon component.\n */\nconst CircleCheck: FC<SVGProps<SVGSVGElement>> = (props: SVGProps<SVGSVGElement>) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m9 12 2 2 4-4\" />\n </svg>\n);\n\nexport default CircleCheck;\n","/**\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 {FC, SVGProps} from 'react';\n\n/**\n * Info icon component.\n */\nconst Info: FC<SVGProps<SVGSVGElement>> = (props: SVGProps<SVGSVGElement>) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </svg>\n);\n\nexport default Info;\n","/**\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 {FC, SVGProps} from 'react';\n\n/**\n * TriangleAlert icon component.\n */\nconst TriangleAlert: FC<SVGProps<SVGSVGElement>> = (props: SVGProps<SVGSVGElement>) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n </svg>\n);\n\nexport default TriangleAlert;\n","/**\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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {\n Context,\n forwardRef,\n HTMLAttributes,\n ReactNode,\n Ref,\n RefAttributes,\n ForwardRefExoticComponent,\n createContext,\n useContext,\n FC,\n SVGProps,\n} from 'react';\nimport useStyles from './Alert.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport CircleAlert from '../Icons/CircleAlert';\nimport CircleCheck from '../Icons/CircleCheck';\nimport Info from '../Icons/Info';\nimport TriangleAlert from '../Icons/TriangleAlert';\nimport Typography from '../Typography/Typography';\n\nexport type AlertVariant = 'success' | 'error' | 'warning' | 'info';\n\nexport interface AlertProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Alert content\n */\n children?: ReactNode;\n /**\n * Whether to show the default icon for the variant\n */\n showIcon?: boolean;\n /**\n * The visual variant of the alert that determines color scheme and icon\n */\n variant?: AlertVariant;\n}\n\nexport interface AlertTitleProps extends HTMLAttributes<HTMLHeadingElement> {\n /**\n * Title content\n */\n children?: ReactNode;\n}\n\nexport interface AlertDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {\n /**\n * Description content\n */\n children?: ReactNode;\n}\n\nconst getDefaultIcon = (variant: AlertVariant): FC<SVGProps<SVGSVGElement>> => {\n switch (variant) {\n case 'success':\n return CircleCheck;\n case 'error':\n return CircleAlert;\n case 'warning':\n return TriangleAlert;\n case 'info':\n return Info;\n default:\n return Info;\n }\n};\n\nconst AlertVariantContext: Context<AlertVariant> = createContext<AlertVariant>('info');\n\nexport const useAlertVariant = (): AlertVariant => useContext(AlertVariantContext);\n\n/**\n * Alert component that displays important information with different severity levels.\n *\n * @example\n * ```tsx\n * <Alert variant=\"success\" showIcon>\n * <Alert.Title>Success! Your changes have been saved</Alert.Title>\n * <Alert.Description>\n * This is an alert with icon, title and description.\n * </Alert.Description>\n * </Alert>\n * ```\n */\nconst Alert: ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>> = forwardRef<\n HTMLDivElement,\n AlertProps\n>(({variant = 'info', showIcon = true, children, className, style, ...rest}: AlertProps, ref: Ref<HTMLDivElement>) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: ReturnType<typeof useStyles> = useStyles(theme, colorScheme, variant);\n const IconComponent: FC<SVGProps<SVGSVGElement>> = getDefaultIcon(variant);\n\n return (\n <AlertVariantContext.Provider value={variant}>\n <div\n ref={ref}\n role=\"alert\"\n style={style}\n className={cx(\n withVendorCSSClassPrefix(bem('alert')),\n styles['alert'],\n styles['variant'],\n withVendorCSSClassPrefix(bem('alert', null, variant)),\n className,\n )}\n {...rest}\n >\n {showIcon && (\n <div className={cx(withVendorCSSClassPrefix(bem('alert', 'icon')), styles['icon'])}>\n <IconComponent />\n </div>\n )}\n <div className={cx(withVendorCSSClassPrefix(bem('alert', 'content')), styles['content'])}>{children}</div>\n </div>\n </AlertVariantContext.Provider>\n );\n});\n\n/**\n * Alert title component.\n */\nconst AlertTitle: FC<AlertTitleProps> = ({children, className, style, ...rest}: AlertTitleProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const variant: AlertVariant = useAlertVariant();\n const styles: ReturnType<typeof useStyles> = useStyles(theme, colorScheme, variant);\n\n const {color, ...filteredRest} = rest;\n\n return (\n <Typography\n component=\"h3\"\n variant=\"h6\"\n fontWeight={600}\n style={style}\n className={cx(withVendorCSSClassPrefix(bem('alert', 'title')), styles['title'], className)}\n {...filteredRest}\n >\n {children}\n </Typography>\n );\n};\n\n/**\n * Alert description component.\n */\nconst AlertDescription: FC<AlertDescriptionProps> = ({children, className, style, ...rest}: AlertDescriptionProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const variant: AlertVariant = useAlertVariant();\n const styles: ReturnType<typeof useStyles> = useStyles(theme, colorScheme, variant);\n\n const {color, ...filteredRest} = rest;\n\n return (\n <Typography\n component=\"p\"\n variant=\"body2\"\n style={style}\n className={cx(withVendorCSSClassPrefix(bem('alert', 'description')), styles['description'], className)}\n {...filteredRest}\n >\n {children}\n </Typography>\n );\n};\n\nAlert.displayName = 'Alert';\nAlertTitle.displayName = 'Alert.Title';\nAlertDescription.displayName = 'Alert.Description';\n\n(Alert as any).Title = AlertTitle;\n(Alert as any).Description = AlertDescription;\n\nexport interface AlertComponent extends ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>> {\n Description: typeof AlertDescription;\n Title: typeof AlertTitle;\n}\n\nexport default Alert as AlertComponent;\nexport {Alert, AlertTitle, AlertDescription};\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nexport type CardVariant = 'default' | 'outlined' | 'elevated';\n\n/**\n * Creates styles for the Card component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param variant - The card variant\n * @param clickable - Whether the card is clickable\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n variant: CardVariant,\n clickable: boolean,\n): Record<string, string> =>\n useMemo(() => {\n const baseCard: string = css`\n border-radius: ${theme.vars.borderRadius.medium};\n background-color: ${theme.vars.colors.background.surface};\n font-family: ${theme.vars.typography.fontFamily};\n transition: all 0.2s ease-in-out;\n position: relative;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n padding: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const variantStyles: Record<string, string> = {\n default: css`\n /* Base styles only */\n `,\n elevated: css`\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n border: none;\n `,\n outlined: css`\n border: 1px solid ${theme.vars.colors.border};\n `,\n };\n\n const clickableStyles: string = css`\n cursor: pointer;\n\n &:hover {\n transform: translateY(-2px);\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n }\n `;\n\n const headerStyles: string = css`\n padding: 0 calc(${theme.vars.spacing.unit} * 2);\n margin-top: calc(${theme.vars.spacing.unit} * 2);\n display: flex;\n flex-direction: column;\n gap: ${theme.vars.spacing.unit};\n `;\n\n const titleStyles: string = css`\n margin: 0;\n /* Typography component will handle color, fontSize, fontWeight, lineHeight */\n `;\n\n const descriptionStyles: string = css`\n margin: 0;\n color: ${theme.vars.colors.text.secondary};\n font-size: ${theme.vars.typography.fontSizes.sm};\n line-height: 1.5;\n `;\n\n const actionStyles: string = css`\n margin-top: ${theme.vars.spacing.unit};\n `;\n\n const contentStyles: string = css`\n padding: 0 calc(${theme.vars.spacing.unit} * 2);\n margin-bottom: calc(${theme.vars.spacing.unit} * 2);\n flex: 1;\n `;\n\n const footerStyles: string = css`\n padding: 0 calc(${theme.vars.spacing.unit} * 2) calc(${theme.vars.spacing.unit} * 2);\n display: flex;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n `;\n\n return {\n action: actionStyles,\n card: baseCard,\n clickable: clickable ? clickableStyles : '',\n content: contentStyles,\n description: descriptionStyles,\n footer: footerStyles,\n header: headerStyles,\n title: titleStyles,\n variant: variantStyles[variant],\n };\n }, [theme, colorScheme, variant, clickable]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {\n HTMLAttributes,\n forwardRef,\n ReactNode,\n ForwardRefExoticComponent,\n RefAttributes,\n Ref,\n ElementType,\n FC,\n} from 'react';\nimport useStyles from './Card.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport Typography from '../Typography/Typography';\nimport {TypographyVariant} from '../Typography/Typography.styles';\n\nexport type CardVariant = 'default' | 'outlined' | 'elevated';\n\nexport interface CardProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Card content\n */\n children?: ReactNode;\n /**\n * Whether the card should be clickable (shows hover effects)\n */\n clickable?: boolean;\n /**\n * The visual variant of the card\n */\n variant?: CardVariant;\n}\n\nexport interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Header content\n */\n children?: ReactNode;\n}\n\nexport interface CardTitleProps extends HTMLAttributes<HTMLHeadingElement> {\n /**\n * Title content\n */\n children?: ReactNode;\n /**\n * The heading level to use\n */\n level?: 1 | 2 | 3 | 4 | 5 | 6;\n}\n\nexport interface CardDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {\n /**\n * Description content\n */\n children?: ReactNode;\n}\n\nexport interface CardActionProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Action content\n */\n children?: ReactNode;\n}\n\nexport interface CardContentProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Content\n */\n children?: ReactNode;\n}\n\nexport interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Footer content\n */\n children?: ReactNode;\n}\n\n/**\n * Card component that provides a flexible container for content.\n *\n * @example\n * ```tsx\n * <Card variant=\"elevated\" clickable>\n * <Card.Header>\n * <Card.Title>Card Title</Card.Title>\n * <Card.Description>Card Description</Card.Description>\n * <Card.Action>\n * <Button variant=\"link\">Action</Button>\n * </Card.Action>\n * </Card.Header>\n * <Card.Content>\n * <p>Card content goes here</p>\n * </Card.Content>\n * <Card.Footer>\n * <Button>Cancel</Button>\n * <Button variant=\"outline\">Submit</Button>\n * </Card.Footer>\n * </Card>\n * ```\n */\nconst Card: ForwardRefExoticComponent<CardProps & RefAttributes<HTMLDivElement>> = forwardRef<\n HTMLDivElement,\n CardProps\n>(\n (\n {variant = 'default', clickable = false, children, className, style, ...rest}: CardProps,\n ref: Ref<HTMLDivElement>,\n ) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, variant, clickable);\n\n return (\n <div\n ref={ref}\n style={style}\n className={cx(\n withVendorCSSClassPrefix(bem('card')),\n styles['card'],\n styles['variant'],\n styles['clickable'],\n withVendorCSSClassPrefix(bem('card', null, variant)),\n {\n [withVendorCSSClassPrefix(bem('card', null, 'clickable'))]: clickable,\n },\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\n\n/**\n * Card header component that contains the title, description, and optional actions.\n */\nconst CardHeader: ForwardRefExoticComponent<CardHeaderProps & RefAttributes<HTMLDivElement>> = forwardRef<\n HTMLDivElement,\n CardHeaderProps\n>(({children, className, style, ...rest}: CardHeaderProps, ref: Ref<HTMLDivElement>) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, 'default', false);\n\n return (\n <div\n ref={ref}\n style={style}\n className={cx(withVendorCSSClassPrefix(bem('card', 'header')), styles['header'], className)}\n {...rest}\n >\n {children}\n </div>\n );\n});\n\n/**\n * Card title component.\n */\nconst CardTitle: FC<CardTitleProps> = ({children, level = 3, className, style, ...rest}: CardTitleProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, 'default', false);\n\n const getVariantFromLevel = (lvl: number): string => {\n switch (lvl) {\n case 1:\n return 'h1';\n case 2:\n return 'h2';\n case 3:\n return 'h3';\n case 4:\n return 'h4';\n case 5:\n return 'h5';\n case 6:\n return 'h6';\n default:\n return 'h3';\n }\n };\n\n const getComponentFromLevel = (lvl: number): string => {\n switch (lvl) {\n case 1:\n return 'h1';\n case 2:\n return 'h2';\n case 3:\n return 'h3';\n case 4:\n return 'h4';\n case 5:\n return 'h5';\n case 6:\n return 'h6';\n default:\n return 'h3';\n }\n };\n\n const {color, ...filteredRest} = rest;\n\n return (\n <Typography\n component={getComponentFromLevel(level) as ElementType}\n variant={getVariantFromLevel(level) as TypographyVariant}\n style={style}\n className={cx(withVendorCSSClassPrefix(bem('card', 'title')), styles['title'], className)}\n fontWeight={600}\n {...filteredRest}\n >\n {children}\n </Typography>\n );\n};\n\n/**\n * Card description component.\n */\nconst CardDescription: FC<CardDescriptionProps> = ({children, className, style, ...rest}: CardDescriptionProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, 'default', false);\n\n const {color, ...filteredRest} = rest;\n\n return (\n <Typography\n component=\"p\"\n variant=\"body2\"\n color=\"textSecondary\"\n style={style}\n className={cx(withVendorCSSClassPrefix(bem('card', 'description')), styles['description'], className)}\n {...filteredRest}\n >\n {children}\n </Typography>\n );\n};\n\n/**\n * Card action component for action elements in the header.\n */\nconst CardAction: ForwardRefExoticComponent<CardActionProps & RefAttributes<HTMLDivElement>> = forwardRef<\n HTMLDivElement,\n CardActionProps\n>(({children, className, style, ...rest}: CardActionProps, ref: Ref<HTMLDivElement>) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, 'default', false);\n\n return (\n <div\n ref={ref}\n style={style}\n className={cx(withVendorCSSClassPrefix(bem('card', 'action')), styles['action'], className)}\n {...rest}\n >\n {children}\n </div>\n );\n});\n\n/**\n * Card content component that contains the main content of the card.\n */\nconst CardContent: ForwardRefExoticComponent<CardContentProps & RefAttributes<HTMLDivElement>> = forwardRef<\n HTMLDivElement,\n CardContentProps\n>(({children, className, style, ...rest}: CardContentProps, ref: Ref<HTMLDivElement>) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, 'default', false);\n\n return (\n <div\n ref={ref}\n style={style}\n className={cx(withVendorCSSClassPrefix(bem('card', 'content')), styles['content'], className)}\n {...rest}\n >\n {children}\n </div>\n );\n});\n\n/**\n * Card footer component that contains footer actions or additional information.\n */\nconst CardFooter: ForwardRefExoticComponent<CardFooterProps & RefAttributes<HTMLDivElement>> = forwardRef<\n HTMLDivElement,\n CardFooterProps\n>(({children, className, style, ...rest}: CardFooterProps, ref: Ref<HTMLDivElement>) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, 'default', false);\n\n return (\n <div\n ref={ref}\n style={style}\n className={cx(withVendorCSSClassPrefix(bem('card', 'footer')), styles['footer'], className)}\n {...rest}\n >\n {children}\n </div>\n );\n});\n\nCard.displayName = 'Card';\nCardHeader.displayName = 'Card.Header';\nCardTitle.displayName = 'Card.Title';\nCardDescription.displayName = 'Card.Description';\nCardAction.displayName = 'Card.Action';\nCardContent.displayName = 'Card.Content';\nCardFooter.displayName = 'Card.Footer';\n\n(Card as any).Header = CardHeader;\n(Card as any).Title = CardTitle;\n(Card as any).Description = CardDescription;\n(Card as any).Action = CardAction;\n(Card as any).Content = CardContent;\n(Card as any).Footer = CardFooter;\n\nexport interface CardComponent extends ForwardRefExoticComponent<CardProps & RefAttributes<HTMLDivElement>> {\n Action: typeof CardAction;\n Content: typeof CardContent;\n Description: typeof CardDescription;\n Footer: typeof CardFooter;\n Header: typeof CardHeader;\n Title: typeof CardTitle;\n}\n\nexport default Card as CardComponent;\nexport {Card, CardHeader, CardTitle, CardDescription, CardAction, CardContent, CardFooter};\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nexport type DividerOrientation = 'horizontal' | 'vertical';\nexport type DividerVariant = 'solid' | 'dashed' | 'dotted';\n\n/**\n * Creates styles for the Divider component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param orientation - The divider orientation\n * @param variant - The divider variant\n * @param color - Custom color for the divider\n * @param hasChildren - Whether the divider has children (text)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n orientation: DividerOrientation,\n variant: DividerVariant,\n color?: string,\n hasChildren?: boolean,\n): Record<string, string> =>\n useMemo(() => {\n const baseColor: string = color || theme.colors.border;\n let borderStyle: string;\n if (variant === 'solid') {\n borderStyle = 'solid';\n } else if (variant === 'dashed') {\n borderStyle = 'dashed';\n } else {\n borderStyle = 'dotted';\n }\n\n const baseDivider: string = css`\n margin: calc(${theme.vars.spacing.unit} * 2) 0;\n `;\n\n const verticalDivider: string = css`\n display: inline-block;\n height: 100%;\n min-height: calc(${theme.vars.spacing.unit} * 2);\n width: 1px;\n border-inline-start: 1px ${borderStyle} ${baseColor};\n margin-block: 0;\n margin-inline: calc(${theme.vars.spacing.unit} * 1);\n `;\n\n const horizontalDivider: string = css`\n display: flex;\n align-items: center;\n width: 100%;\n ${!hasChildren &&\n css`\n height: 1px;\n border-top: 1px ${borderStyle} ${baseColor};\n `}\n `;\n\n const dividerLine: string = css`\n flex: 1;\n height: 1px;\n border-top: 1px ${borderStyle} ${baseColor};\n `;\n\n const dividerText: string = css`\n background-color: ${theme.vars.colors.background.surface};\n font-family: ${theme.vars.typography.fontFamily};\n padding: 0 calc(${theme.vars.spacing.unit} * 1);\n white-space: nowrap;\n `;\n\n return {\n divider: baseDivider,\n horizontal: horizontalDivider,\n line: dividerLine,\n text: dividerText,\n vertical: verticalDivider,\n };\n }, [theme, colorScheme, orientation, variant, color, hasChildren]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC, HTMLAttributes, ReactNode} from 'react';\nimport useStyles from './Divider.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport Typography from '../Typography/Typography';\n\nexport type DividerOrientation = 'horizontal' | 'vertical';\nexport type DividerVariant = 'solid' | 'dashed' | 'dotted';\n\nexport interface DividerProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Text to display in the center of the divider\n */\n children?: ReactNode;\n\n /**\n * Custom color for the divider\n */\n color?: string;\n\n /**\n * The orientation of the divider\n */\n orientation?: DividerOrientation;\n\n /**\n * The variant style of the divider\n */\n variant?: DividerVariant;\n}\n\n/**\n * Divider component for separating content sections.\n *\n * @example\n * ```tsx\n * // Basic horizontal divider\n * <Divider />\n *\n * // Divider with text\n * <Divider>OR</Divider>\n *\n * // Vertical divider\n * <Divider orientation=\"vertical\" />\n *\n * // Custom styled divider\n * <Divider variant=\"dashed\" color=\"#ccc\">Continue with</Divider>\n * ```\n */\nconst Divider: FC<DividerProps> = ({\n orientation = 'horizontal',\n variant = 'solid',\n children,\n color,\n className,\n style,\n ...rest\n}: DividerProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, orientation, variant, color, !!children);\n\n if (orientation === 'vertical') {\n return (\n <div\n className={cx(\n withVendorCSSClassPrefix(bem('divider')),\n withVendorCSSClassPrefix(bem('divider', 'vertical')),\n styles['divider'],\n styles['vertical'],\n className,\n )}\n style={style}\n role=\"separator\"\n aria-orientation=\"vertical\"\n {...rest}\n />\n );\n }\n\n if (children) {\n return (\n <div\n className={cx(\n withVendorCSSClassPrefix(bem('divider')),\n withVendorCSSClassPrefix(bem('divider', 'horizontal')),\n withVendorCSSClassPrefix(bem('divider', 'with-text')),\n styles['divider'],\n styles['horizontal'],\n className,\n )}\n style={style}\n role=\"separator\"\n aria-orientation=\"horizontal\"\n {...rest}\n >\n <div className={cx(withVendorCSSClassPrefix(bem('divider', 'line')), styles['line'])} />\n <Typography\n variant=\"body2\"\n color=\"textSecondary\"\n className={cx(withVendorCSSClassPrefix(bem('divider', 'text')), styles['text'])}\n inline\n >\n {children}\n </Typography>\n <div className={cx(withVendorCSSClassPrefix(bem('divider', 'line')), styles['line'])} />\n </div>\n );\n }\n\n return (\n <div\n className={cx(\n withVendorCSSClassPrefix(bem('divider')),\n withVendorCSSClassPrefix(bem('divider', 'horizontal')),\n styles['divider'],\n styles['horizontal'],\n className,\n )}\n style={style}\n role=\"separator\"\n aria-orientation=\"horizontal\"\n {...rest}\n />\n );\n};\n\nexport default Divider;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nexport type LogoSize = 'small' | 'medium' | 'large';\n\n/**\n * Creates styles for the Logo component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param size - The size of the logo\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string, size: LogoSize): Record<string, string> =>\n useMemo(() => {\n const baseLogo: string = css`\n width: auto;\n object-fit: contain;\n display: block;\n `;\n\n const smallLogo: string = css`\n height: 32px;\n max-width: 120px;\n `;\n\n const mediumLogo: string = css`\n height: 48px;\n max-width: 180px;\n `;\n\n const largeLogo: string = css`\n height: 64px;\n max-width: 240px;\n `;\n\n const sizeStyles: Record<string, string> = {\n large: largeLogo,\n medium: mediumLogo,\n small: smallLogo,\n };\n\n return {\n large: largeLogo,\n logo: baseLogo,\n medium: mediumLogo,\n size: sizeStyles[size],\n small: smallLogo,\n };\n }, [theme, colorScheme, size]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC} from 'react';\nimport useStyles from './Logo.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\n\nexport type LogoSize = 'small' | 'medium' | 'large';\n\n/**\n * Props for the Logo component.\n */\nexport interface LogoProps {\n /**\n * Custom alt text for the logo.\n */\n alt?: string;\n /**\n * Custom CSS class name for the logo.\n */\n className?: string;\n /**\n * Size of the logo.\n */\n size?: LogoSize;\n /**\n * Custom logo URL to override theme logo.\n */\n src?: string;\n /**\n * Custom title for the logo.\n */\n title?: string;\n}\n\n/**\n * Logo component that displays the brand logo from theme or custom source.\n *\n * @param props - The props for the Logo component.\n * @returns The rendered Logo component.\n */\nconst Logo: FC<LogoProps> = ({className, src, alt, title, size = 'medium'}: LogoProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, size);\n\n const logoConfig: Record<string, string> | undefined = theme.images?.logo as Record<string, string> | undefined;\n\n const logoSrc: string | undefined = src || logoConfig?.['url'];\n\n const logoAlt: string = alt || logoConfig?.['alt'] || 'Logo';\n\n const logoTitle: string | undefined = title || logoConfig?.['title'];\n\n if (!logoSrc) {\n return null;\n }\n\n return (\n <img\n src={logoSrc}\n alt={logoAlt}\n title={logoTitle}\n className={cx(\n withVendorCSSClassPrefix(bem('logo')),\n withVendorCSSClassPrefix(bem('logo', size)),\n styles['logo'],\n styles['size'],\n className,\n )}\n />\n );\n};\n\nexport default Logo;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the BaseSignIn component\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(() => {\n const signIn: string = css`\n min-width: 420px;\n margin: 0 auto;\n font-family: ${theme.vars.typography.fontFamily};\n `;\n\n const card: string = css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n gap: calc(${theme.vars.spacing.unit} * 2);\n min-width: 420px;\n `;\n\n const logoContainer: string = css`\n display: flex;\n flex-direction: column;\n align-items: center;\n margin-bottom: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const header: string = css`\n gap: 0;\n align-items: center;\n `;\n\n const title: string = css`\n margin: 0 0 calc(${theme.vars.spacing.unit} * 1) 0;\n color: ${theme.vars.colors.text.primary};\n `;\n\n const subtitle: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 1);\n color: ${theme.vars.colors.text.secondary};\n `;\n\n const messagesContainer: string = css`\n margin-top: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const messageItem: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 1);\n `;\n\n const errorContainer: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const contentContainer: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const loadingContainer: string = css`\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: calc(${theme.vars.spacing.unit} * 4);\n `;\n\n const loadingText: string = css`\n margin-top: calc(${theme.vars.spacing.unit} * 2);\n color: ${theme.vars.colors.text.secondary};\n `;\n\n const divider: string = css`\n margin: calc(${theme.vars.spacing.unit} * 1) 0;\n `;\n\n const centeredContainer: string = css`\n text-align: center;\n padding: calc(${theme.vars.spacing.unit} * 4);\n `;\n\n const passkeyContainer: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const passkeyText: string = css`\n margin-top: calc(${theme.vars.spacing.unit} * 1);\n color: ${theme.vars.colors.text.secondary};\n `;\n\n const form: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const formDivider: string = css`\n margin: calc(${theme.vars.spacing.unit} * 1) 0;\n `;\n\n const authenticatorSection: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} * 1);\n `;\n\n const authenticatorItem: string = css`\n width: 100%;\n `;\n\n const noAuthenticatorCard: string = css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n padding: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const errorAlert: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const messagesAlert: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 1);\n `;\n\n const flowMessagesContainer: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const flowMessageItem: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 1);\n `;\n\n return {\n authenticatorItem,\n authenticatorSection,\n card,\n centeredContainer,\n contentContainer,\n divider,\n errorAlert,\n errorContainer,\n flowMessageItem,\n flowMessagesContainer,\n form,\n formDivider,\n header,\n loadingContainer,\n loadingText,\n logoContainer,\n messageItem,\n messagesAlert,\n messagesContainer,\n noAuthenticatorCard,\n passkeyContainer,\n passkeyText,\n signIn,\n subtitle,\n title,\n };\n }, [\n theme.vars.colors.background.surface,\n theme.vars.colors.text.primary,\n theme.vars.colors.text.secondary,\n theme.vars.borderRadius.large,\n theme.vars.spacing.unit,\n theme.vars.typography.fontFamily,\n colorScheme,\n ]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {\n EmbeddedSignInFlowAuthenticator,\n EmbeddedSignInFlowInitiateResponse,\n EmbeddedSignInFlowHandleResponse,\n EmbeddedSignInFlowStepType,\n EmbeddedSignInFlowStatus,\n EmbeddedSignInFlowAuthenticatorPromptType,\n ApplicationNativeAuthenticationConstants,\n ThunderIDAPIError,\n withVendorCSSClassPrefix,\n EmbeddedSignInFlowHandleRequestPayload,\n EmbeddedFlowExecuteRequestConfig,\n handleWebAuthnAuthentication,\n createPackageComponentLogger,\n} from '@thunderid/browser';\nimport {FC, FormEvent, RefObject, useEffect, useState, useCallback, useRef, ReactElement} from 'react';\nimport {createSignInOptionFromAuthenticator} from './options/SignInOptionFactory';\nimport FlowProvider from '../../../../../contexts/Flow/FlowProvider';\nimport useFlow from '../../../../../contexts/Flow/useFlow';\nimport useTheme from '../../../../../contexts/Theme/useTheme';\nimport {useForm, FormField} from '../../../../../hooks/useForm';\nimport useTranslation from '../../../../../hooks/useTranslation';\nimport AlertPrimitive, {AlertVariant} from '../../../../primitives/Alert/Alert';\nimport CardPrimitive, {CardProps} from '../../../../primitives/Card/Card';\nimport Divider from '../../../../primitives/Divider/Divider';\nimport Logo from '../../../../primitives/Logo/Logo';\nimport Spinner from '../../../../primitives/Spinner/Spinner';\nimport Typography from '../../../../primitives/Typography/Typography';\nimport useStyles from '../BaseSignIn.styles';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'BaseSignIn',\n);\n\n/**\n * Check if the authenticator is a passkey/FIDO authenticator\n */\nconst isPasskeyAuthenticator = (authenticator: EmbeddedSignInFlowAuthenticator): boolean =>\n authenticator.authenticatorId === ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Passkey &&\n authenticator.metadata?.promptType === EmbeddedSignInFlowAuthenticatorPromptType.InternalPrompt &&\n (authenticator.metadata as any)?.additionalData?.challengeData;\n\n/**\n * Props for the BaseSignIn component.\n */\nexport interface BaseSignInProps {\n afterSignInUrl?: string;\n\n /**\n * Custom CSS class name for the submit button.\n */\n buttonClassName?: string;\n\n /**\n * Custom CSS class name for the form container.\n */\n className?: string;\n\n /**\n * Custom CSS class name for error messages.\n */\n errorClassName?: string;\n\n /**\n * Custom CSS class name for form inputs.\n */\n inputClassName?: string;\n\n /**\n * Flag to determine the component is ready to be rendered.\n */\n isLoading?: boolean;\n\n /**\n * Custom CSS class name for info messages.\n */\n messageClassName?: string;\n\n /**\n * Callback function called when authentication fails.\n * @param error - The error that occurred during authentication.\n */\n onError?: (error: Error) => void;\n\n /**\n * Callback function called when authentication flow status changes.\n * @param response - The current authentication response.\n */\n onFlowChange?: (response: EmbeddedSignInFlowInitiateResponse | EmbeddedSignInFlowHandleResponse) => void;\n\n /**\n * Function to initialize authentication flow.\n * @returns Promise resolving to the initial authentication response.\n */\n onInitialize?: () => Promise<EmbeddedSignInFlowInitiateResponse>;\n\n /**\n * Function to handle authentication steps.\n * @param payload - The authentication payload.\n * @returns Promise resolving to the authentication response.\n */\n onSubmit?: (\n payload: EmbeddedSignInFlowHandleRequestPayload,\n request: EmbeddedFlowExecuteRequestConfig,\n ) => Promise<EmbeddedSignInFlowHandleResponse>;\n\n /**\n * Callback function called when authentication is successful.\n * @param authData - The authentication data returned upon successful completion.\n */\n onSuccess?: (authData: Record<string, any>) => void;\n\n /**\n * Whether to show the logo.\n */\n showLogo?: boolean;\n /**\n * Whether to show the subtitle.\n */\n showSubtitle?: boolean;\n\n /**\n * Whether to show the title.\n */\n showTitle?: boolean;\n\n /**\n * Size variant for the component.\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Theme variant for the component.\n */\n variant?: CardProps['variant'];\n}\n\n/**\n * `T3JnYW5pemF0aW9uQXV0aGVudGljYXRvcjpTU08` - OrganizationSSO\n * Currently, `App-Native Authentication` doesn't support organization SSO.\n * Tracker: TODO: Create `product-is` issue for this.\n */\nconst HIDDEN_AUTHENTICATORS: string[] = ['T3JnYW5pemF0aW9uQXV0aGVudGljYXRvcjpTU08'];\n\n/**\n * Internal component that consumes FlowContext and renders the sign-in UI.\n */\nconst BaseSignInContent: FC<BaseSignInProps> = ({\n afterSignInUrl,\n onInitialize,\n isLoading: externalIsLoading,\n onSubmit,\n onSuccess,\n onError,\n onFlowChange,\n className = '',\n inputClassName = '',\n buttonClassName = '',\n errorClassName = '',\n messageClassName = '',\n size = 'medium',\n variant = 'outlined',\n showTitle = true,\n showSubtitle = true,\n}: BaseSignInProps): ReactElement => {\n const {theme} = useTheme();\n const {t} = useTranslation();\n const {subtitle: flowSubtitle, title: flowTitle, messages: flowMessages} = useFlow();\n const styles: ReturnType<typeof useStyles> = useStyles(theme, theme.vars.colors.text.primary);\n\n const [isSignInInitializationRequestLoading, setIsSignInInitializationRequestLoading] = useState(false);\n const [isInitialized, setIsInitialized] = useState(false);\n const [currentFlow, setCurrentFlow] = useState<EmbeddedSignInFlowInitiateResponse | null>(null);\n const [currentAuthenticator, setCurrentAuthenticator] = useState<EmbeddedSignInFlowAuthenticator | null>(null);\n const [error, setError] = useState<string | null>(null);\n const [messages, setMessages] = useState<{message: string; type: string}[]>([]);\n\n const isLoading: boolean = externalIsLoading || isSignInInitializationRequestLoading;\n\n const reRenderCheckRef: RefObject<boolean> = useRef<boolean>(false);\n\n const formFields: FormField[] =\n currentAuthenticator?.metadata?.params?.map((param: any) => ({\n initialValue: '',\n name: param.param,\n required: currentAuthenticator.requiredParams.includes(param.param),\n validator: (value: string): string | null => {\n if (currentAuthenticator.requiredParams.includes(param.param) && (!value || value.trim() === '')) {\n return t('validations.required.field.error');\n }\n return null;\n },\n })) || [];\n\n const form: any = useForm<Record<string, string>>({\n fields: formFields,\n initialValues: {},\n requiredMessage: t('validations.required.field.error'),\n validateOnBlur: true,\n validateOnChange: false,\n });\n\n const {\n values: formValues,\n touched: touchedFields,\n setValue: setFormValue,\n setTouched: setFormTouched,\n validateForm,\n touchAllFields,\n reset: resetForm,\n } = form;\n\n /**\n * Setup form fields based on the current authenticator.\n */\n const setupFormFields: any = useCallback(\n (authenticator: EmbeddedSignInFlowAuthenticator): void => {\n const initialValues: Record<string, string> = {};\n authenticator.metadata?.params?.forEach((param: any) => {\n initialValues[param.param] = '';\n });\n\n // Reset form with new values\n resetForm();\n\n // Set initial values for all fields\n Object.keys(initialValues).forEach((key: string) => {\n setFormValue(key, initialValues[key]);\n });\n },\n [resetForm, setFormValue],\n );\n\n /**\n * Check if the response contains a redirection URL and perform the redirect if necessary.\n * @param response - The authentication response\n * @returns true if a redirect was performed, false otherwise\n */\n const handleRedirectionIfNeeded = (response: EmbeddedSignInFlowHandleResponse): boolean => {\n if (\n response &&\n 'nextStep' in response &&\n response.nextStep &&\n (response.nextStep as any).stepType === EmbeddedSignInFlowStepType.AuthenticatorPrompt &&\n (response.nextStep as any).authenticators?.length === 1\n ) {\n const responseAuthenticator: any = (response.nextStep as any).authenticators[0];\n if (\n responseAuthenticator.metadata?.promptType === EmbeddedSignInFlowAuthenticatorPromptType.RedirectionPrompt &&\n responseAuthenticator.metadata?.additionalData?.redirectUrl\n ) {\n /**\n * Open a popup window to handle redirection prompts\n */\n const redirectUrl: string = responseAuthenticator.metadata?.additionalData?.redirectUrl;\n const popup: Window | null = window.open(\n redirectUrl,\n 'oauth_popup',\n 'width=500,height=600,scrollbars=yes,resizable=yes',\n );\n\n if (!popup) {\n logger.error('Failed to open popup window');\n return false;\n }\n\n /**\n * Forward declarations for mutually referencing variables.\n * `messageHandler`, `cleanup`, and `popupMonitor` reference each other,\n * so they are declared with `let` first and assigned below.\n */\n let messageHandler: any;\n let popupMonitor: any;\n\n const cleanup = (): void => {\n window.removeEventListener('message', messageHandler);\n if (popupMonitor) {\n clearInterval(popupMonitor);\n }\n };\n\n /**\n * Add an event listener to the window to capture the message from the popup\n */\n messageHandler = async function messageEventHandler(event: MessageEvent): Promise<void> {\n /**\n * Check if the message is from our popup window\n */\n if (event.source !== popup) {\n // Don't log every message rejection to reduce noise\n if (event.source !== window && event.source !== window.parent) {\n // TODO: Add logs\n }\n return;\n }\n\n /**\n * Check the origin of the message to ensure it's from a trusted source\n */\n const expectedOrigin: string = afterSignInUrl ? new URL(afterSignInUrl).origin : window.location.origin;\n if (event.origin !== expectedOrigin && event.origin !== window.location.origin) {\n return;\n }\n\n const {code, state} = event.data;\n\n if (code && state) {\n const payload: EmbeddedSignInFlowHandleRequestPayload = {\n flowId: currentFlow.flowId,\n selectedAuthenticator: {\n authenticatorId: responseAuthenticator.authenticatorId,\n params: {\n code,\n state,\n },\n },\n };\n\n await onSubmit(payload, {\n method: currentFlow?.links[0].method,\n url: currentFlow?.links[0].href,\n });\n\n popup.close();\n cleanup();\n } else {\n // TODO: Add logs\n }\n };\n\n window.addEventListener('message', messageHandler);\n\n /**\n * Monitor popup for closure and URL changes\n */\n let hasProcessedCallback = false; // Prevent multiple processing\n popupMonitor = setInterval(async (): Promise<void> => {\n try {\n if (popup.closed) {\n cleanup();\n\n return;\n }\n\n // Skip if we've already processed a callback\n if (hasProcessedCallback) {\n return;\n }\n\n // Try to access popup URL to check for callback\n try {\n const popupUrl: string = popup.location.href;\n\n // Check if we've been redirected to the callback URL\n if (popupUrl && (popupUrl.includes('code=') || popupUrl.includes('error='))) {\n hasProcessedCallback = true; // Set flag to prevent multiple processing\n\n // Parse the URL for OAuth parameters\n const url: URL = new URL(popupUrl);\n const code: string | null = url.searchParams.get('code');\n const state: string | null = url.searchParams.get('state');\n const oauthError: string | null = url.searchParams.get('error');\n\n if (oauthError) {\n logger.error('OAuth error:');\n popup.close();\n cleanup();\n return;\n }\n\n if (code && state) {\n const payload: EmbeddedSignInFlowHandleRequestPayload = {\n flowId: currentFlow.flowId,\n selectedAuthenticator: {\n authenticatorId: responseAuthenticator.authenticatorId,\n params: {\n code,\n state,\n },\n },\n };\n\n const submitResponse: any = await onSubmit(payload, {\n method: currentFlow?.links[0].method,\n url: currentFlow?.links[0].href,\n });\n\n popup.close();\n\n onFlowChange?.(submitResponse);\n\n if (submitResponse?.flowStatus === EmbeddedSignInFlowStatus.SuccessCompleted) {\n onSuccess?.(submitResponse.authData);\n }\n }\n }\n } catch (e) {\n // Cross-origin error is expected when popup navigates to OAuth provider\n // This is normal and we can ignore it\n }\n } catch (e) {\n logger.error('Error monitoring popup:');\n }\n }, 1000);\n\n return true;\n }\n }\n return false;\n };\n\n /**\n * Handle form submission.\n */\n const handleSubmit = async (submittedValues: Record<string, string>): Promise<void> => {\n if (!currentFlow || !currentAuthenticator) {\n return;\n }\n\n // Mark all fields as touched before validation\n touchAllFields();\n\n const validation: any = validateForm();\n if (!validation.isValid) {\n return;\n }\n\n setIsSignInInitializationRequestLoading(true);\n setError(null);\n setMessages([]);\n\n try {\n const payload: EmbeddedSignInFlowHandleRequestPayload = {\n flowId: currentFlow.flowId,\n selectedAuthenticator: {\n authenticatorId: currentAuthenticator.authenticatorId,\n params: submittedValues,\n },\n };\n\n const response: any = await onSubmit(payload, {\n method: currentFlow?.links[0].method,\n url: currentFlow?.links[0].href,\n });\n onFlowChange?.(response);\n\n if (response?.flowStatus === EmbeddedSignInFlowStatus.SuccessCompleted) {\n onSuccess?.(response.authData);\n return;\n }\n\n if (\n response?.flowStatus === EmbeddedSignInFlowStatus.FailCompleted ||\n response?.flowStatus === EmbeddedSignInFlowStatus.FailIncomplete\n ) {\n setError(t('errors.signin.flow.completion.failure'));\n return;\n }\n\n // Check if the response contains a redirection URL and redirect if needed\n if (handleRedirectionIfNeeded(response)) {\n return;\n }\n\n if (response && 'flowId' in response && 'nextStep' in response) {\n const nextStepResponse: any = response;\n setCurrentFlow(nextStepResponse);\n\n if (nextStepResponse.nextStep?.authenticators?.length > 0) {\n if (\n nextStepResponse.nextStep.stepType === EmbeddedSignInFlowStepType.MultiOptionsPrompt &&\n nextStepResponse.nextStep.authenticators.length > 1\n ) {\n setCurrentAuthenticator(null);\n } else {\n const nextAuthenticator: any = nextStepResponse.nextStep.authenticators[0];\n setCurrentAuthenticator(nextAuthenticator);\n setupFormFields(nextAuthenticator);\n }\n }\n\n if (nextStepResponse.nextStep?.messages) {\n setMessages(\n nextStepResponse.nextStep.messages.map((msg: any) => ({\n message: msg.message || '',\n type: msg.type || 'INFO',\n })),\n );\n }\n }\n } catch (err) {\n const errorMessage: string = err instanceof ThunderIDAPIError ? err.message : t('errors.signin.flow.failure');\n setError(errorMessage);\n onError?.(err as Error);\n } finally {\n setIsSignInInitializationRequestLoading(false);\n }\n };\n\n /**\n * Handle authenticator selection for multi-option prompts.\n */\n const handleAuthenticatorSelection = async (\n authenticator: EmbeddedSignInFlowAuthenticator,\n formData?: Record<string, string>,\n ): Promise<void> => {\n if (!currentFlow) {\n return;\n }\n\n // Mark all fields as touched if we have form data (i.e., this is a submission)\n if (formData) {\n touchAllFields();\n }\n\n setIsSignInInitializationRequestLoading(true);\n setError(null);\n setMessages([]);\n\n try {\n // Handle passkey/FIDO authentication\n if (isPasskeyAuthenticator(authenticator)) {\n try {\n const challengeData: any = (authenticator.metadata as any)?.additionalData?.challengeData;\n if (!challengeData) {\n throw new Error('Missing challenge data for passkey authentication');\n }\n\n const tokenResponse: any = await handleWebAuthnAuthentication(challengeData);\n\n const payload: EmbeddedSignInFlowHandleRequestPayload = {\n flowId: currentFlow.flowId,\n selectedAuthenticator: {\n authenticatorId: authenticator.authenticatorId,\n params: {\n tokenResponse,\n },\n },\n };\n\n const response: any = await onSubmit(payload, {\n method: currentFlow?.links[0].method,\n url: currentFlow?.links[0].href,\n });\n onFlowChange?.(response);\n\n if (response?.flowStatus === EmbeddedSignInFlowStatus.SuccessCompleted) {\n onSuccess?.(response.authData);\n return;\n }\n\n if (\n response?.flowStatus === EmbeddedSignInFlowStatus.FailCompleted ||\n response?.flowStatus === EmbeddedSignInFlowStatus.FailIncomplete\n ) {\n setError(t('errors.signin.flow.passkeys.completion.failure'));\n return;\n }\n\n // Handle next step if authentication is not complete\n if (response && 'flowId' in response && 'nextStep' in response) {\n const nextStepResponse: any = response;\n setCurrentFlow(nextStepResponse);\n\n if (nextStepResponse.nextStep?.authenticators?.length > 0) {\n if (\n nextStepResponse.nextStep.stepType === EmbeddedSignInFlowStepType.MultiOptionsPrompt &&\n nextStepResponse.nextStep.authenticators.length > 1\n ) {\n setCurrentAuthenticator(null);\n } else {\n const nextAuthenticator: any = nextStepResponse.nextStep.authenticators[0];\n\n // Check if the next authenticator is also a passkey - if so, auto-trigger it\n if (isPasskeyAuthenticator(nextAuthenticator)) {\n // Recursively handle the passkey authenticator without showing UI\n handleAuthenticatorSelection(nextAuthenticator);\n return;\n }\n setCurrentAuthenticator(nextAuthenticator);\n setupFormFields(nextAuthenticator);\n }\n }\n\n if (nextStepResponse.nextStep?.messages) {\n setMessages(\n nextStepResponse.nextStep.messages.map((msg: any) => ({\n message: msg.message || '',\n type: msg.type || 'INFO',\n })),\n );\n }\n }\n } catch (passkeyError) {\n logger.error('Passkey authentication error:');\n\n // Provide more context for common errors\n let errorMessage: string =\n passkeyError instanceof Error ? passkeyError.message : t('errors.signin.flow.passkeys.failure');\n\n // Add additional context for security errors\n if (passkeyError instanceof Error && passkeyError.message.includes('security')) {\n errorMessage +=\n ' This may be due to browser security settings, an insecure connection, or device restrictions.';\n }\n\n setError(errorMessage);\n }\n } else if (authenticator.metadata?.promptType === EmbeddedSignInFlowAuthenticatorPromptType.RedirectionPrompt) {\n const payload: EmbeddedSignInFlowHandleRequestPayload = {\n flowId: currentFlow.flowId,\n selectedAuthenticator: {\n authenticatorId: authenticator.authenticatorId,\n params: {},\n },\n };\n\n const response: any = await onSubmit(payload, {\n method: currentFlow?.links[0].method,\n url: currentFlow?.links[0].href,\n });\n onFlowChange?.(response);\n\n if (response?.flowStatus === EmbeddedSignInFlowStatus.SuccessCompleted) {\n onSuccess?.(response.authData);\n return;\n }\n\n // Check if the response contains a redirection URL and redirect if needed\n if (handleRedirectionIfNeeded(response)) {\n /* empty - redirect handled */\n }\n } else if (formData) {\n const validation: any = validateForm();\n if (!validation.isValid) {\n return;\n }\n\n const formPayload: EmbeddedSignInFlowHandleRequestPayload = {\n flowId: currentFlow.flowId,\n selectedAuthenticator: {\n authenticatorId: authenticator.authenticatorId,\n params: formData,\n },\n };\n\n const formResponse: any = await onSubmit(formPayload, {\n method: currentFlow?.links[0].method,\n url: currentFlow?.links[0].href,\n });\n onFlowChange?.(formResponse);\n\n if (formResponse?.flowStatus === EmbeddedSignInFlowStatus.SuccessCompleted) {\n onSuccess?.(formResponse.authData);\n return;\n }\n\n if (\n formResponse?.flowStatus === EmbeddedSignInFlowStatus.FailCompleted ||\n formResponse?.flowStatus === EmbeddedSignInFlowStatus.FailIncomplete\n ) {\n setError('Authentication failed. Please check your credentials and try again.');\n return;\n }\n\n // Check if the response contains a redirection URL and redirect if needed\n if (handleRedirectionIfNeeded(formResponse)) {\n return;\n }\n\n if (formResponse && 'flowId' in formResponse && 'nextStep' in formResponse) {\n const nextStepResponse: any = formResponse;\n setCurrentFlow(nextStepResponse);\n\n if (nextStepResponse.nextStep?.authenticators?.length > 0) {\n if (\n nextStepResponse.nextStep.stepType === EmbeddedSignInFlowStepType.MultiOptionsPrompt &&\n nextStepResponse.nextStep.authenticators.length > 1\n ) {\n setCurrentAuthenticator(null);\n } else {\n const nextAuthenticator: any = nextStepResponse.nextStep.authenticators[0];\n\n // Check if the next authenticator is a passkey - if so, auto-trigger it\n if (isPasskeyAuthenticator(nextAuthenticator)) {\n // Recursively handle the passkey authenticator without showing UI\n handleAuthenticatorSelection(nextAuthenticator);\n return;\n }\n setCurrentAuthenticator(nextAuthenticator);\n setupFormFields(nextAuthenticator);\n }\n }\n\n if (nextStepResponse.nextStep?.messages) {\n setMessages(\n nextStepResponse.nextStep.messages.map((msg: any) => ({\n message: msg.message || '',\n type: msg.type || 'INFO',\n })),\n );\n }\n }\n } else {\n // Check if the authenticator requires user input\n const hasParams: boolean = authenticator.metadata?.params && authenticator.metadata.params.length > 0;\n\n if (!hasParams) {\n // If no parameters are required, directly authenticate\n const payload: EmbeddedSignInFlowHandleRequestPayload = {\n flowId: currentFlow.flowId,\n selectedAuthenticator: {\n authenticatorId: authenticator.authenticatorId,\n params: {},\n },\n };\n\n const response: any = await onSubmit(payload, {\n method: currentFlow?.links[0].method,\n url: currentFlow?.links[0].href,\n });\n onFlowChange?.(response);\n\n if (response?.flowStatus === EmbeddedSignInFlowStatus.SuccessCompleted) {\n onSuccess?.(response.authData);\n return;\n }\n\n if (\n response?.flowStatus === EmbeddedSignInFlowStatus.FailCompleted ||\n response?.flowStatus === EmbeddedSignInFlowStatus.FailIncomplete\n ) {\n setError('Authentication failed. Please try again.');\n return;\n }\n\n // Check if the response contains a redirection URL and redirect if needed\n if (handleRedirectionIfNeeded(response)) {\n return;\n }\n\n if (response && 'flowId' in response && 'nextStep' in response) {\n const nextStepResponse: any = response;\n setCurrentFlow(nextStepResponse);\n\n if (nextStepResponse.nextStep?.authenticators?.length > 0) {\n if (\n nextStepResponse.nextStep.stepType === EmbeddedSignInFlowStepType.MultiOptionsPrompt &&\n nextStepResponse.nextStep.authenticators.length > 1\n ) {\n setCurrentAuthenticator(null);\n } else {\n const nextAuthenticator: any = nextStepResponse.nextStep.authenticators[0];\n\n // Check if the next authenticator is a passkey - if so, auto-trigger it\n if (isPasskeyAuthenticator(nextAuthenticator)) {\n // Recursively handle the passkey authenticator without showing UI\n handleAuthenticatorSelection(nextAuthenticator);\n return;\n }\n setCurrentAuthenticator(nextAuthenticator);\n setupFormFields(nextAuthenticator);\n }\n }\n\n if (nextStepResponse.nextStep?.messages) {\n setMessages(\n nextStepResponse.nextStep.messages.map((msg: any) => ({\n message: msg.message || '',\n type: msg.type || 'INFO',\n })),\n );\n }\n }\n } else {\n // If parameters are required, show the form\n setCurrentAuthenticator(authenticator);\n setupFormFields(authenticator);\n }\n }\n } catch (err) {\n const errorMessage: string = err instanceof ThunderIDAPIError ? err?.message : 'Authenticator selection failed';\n setError(errorMessage);\n onError?.(err as Error);\n } finally {\n setIsSignInInitializationRequestLoading(false);\n }\n };\n\n /**\n * Handle input value changes.\n */\n const handleInputChange = (param: string, value: string): void => {\n setFormValue(param, value);\n setFormTouched(param, true);\n };\n\n /**\n * Check if current flow has multiple authenticator options.\n */\n const hasMultipleOptions: any = useCallback(\n (): boolean =>\n currentFlow &&\n 'nextStep' in currentFlow &&\n currentFlow.nextStep?.stepType === EmbeddedSignInFlowStepType.MultiOptionsPrompt &&\n currentFlow.nextStep?.authenticators &&\n currentFlow.nextStep.authenticators.length > 1,\n [currentFlow],\n );\n\n /**\n * Get available authenticators for selection.\n */\n const getAvailableAuthenticators: any = useCallback((): EmbeddedSignInFlowAuthenticator[] => {\n if (!currentFlow || !('nextStep' in currentFlow) || !currentFlow.nextStep?.authenticators) {\n return [];\n }\n return currentFlow.nextStep.authenticators;\n }, [currentFlow]);\n\n // Generate CSS classes\n const containerClasses: string = cx(\n [\n withVendorCSSClassPrefix('signin'),\n withVendorCSSClassPrefix(`signin--${size}`),\n withVendorCSSClassPrefix(`signin--${variant}`),\n ],\n className,\n );\n\n const inputClasses: string = cx(\n [\n withVendorCSSClassPrefix('signin__input'),\n size === 'small' && withVendorCSSClassPrefix('signin__input--small'),\n size === 'large' && withVendorCSSClassPrefix('signin__input--large'),\n ],\n inputClassName,\n );\n\n const buttonClasses: string = cx(\n [\n withVendorCSSClassPrefix('signin__button'),\n size === 'small' && withVendorCSSClassPrefix('signin__button--small'),\n size === 'large' && withVendorCSSClassPrefix('signin__button--large'),\n ],\n buttonClassName,\n );\n\n const errorClasses: string = cx([withVendorCSSClassPrefix('signin__error')], errorClassName);\n\n const messageClasses: string = cx([withVendorCSSClassPrefix('signin__messages')], messageClassName); // Initialize the flow on component mount\n\n useEffect(() => {\n if (isLoading) {\n return;\n }\n\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, it will send two authorize requests.\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 setIsSignInInitializationRequestLoading(true);\n setError(null);\n\n try {\n const response: any = await onInitialize();\n\n setCurrentFlow(response);\n setIsInitialized(true);\n onFlowChange?.(response);\n\n if (response?.flowStatus === EmbeddedSignInFlowStatus.SuccessCompleted) {\n onSuccess?.(response.authData || {});\n return;\n }\n\n if (response?.nextStep?.authenticators?.length > 0) {\n if (\n response.nextStep.stepType === EmbeddedSignInFlowStepType.MultiOptionsPrompt &&\n response.nextStep.authenticators.length > 1\n ) {\n setCurrentAuthenticator(null);\n } else {\n const authenticator: any = response.nextStep.authenticators[0];\n setCurrentAuthenticator(authenticator);\n setupFormFields(authenticator);\n }\n }\n\n if (response && 'nextStep' in response && response.nextStep && 'messages' in response.nextStep) {\n const stepMessages: any[] = response.nextStep.messages || [];\n setMessages(\n stepMessages.map((msg: any) => ({\n message: msg.message || '',\n type: msg.type || 'INFO',\n })),\n );\n }\n } catch (err) {\n const errorMessage: string = err instanceof ThunderIDAPIError ? err.message : t('errors.signin.initialization');\n setError(errorMessage);\n onError?.(err as Error);\n } finally {\n setIsSignInInitializationRequestLoading(false);\n }\n })();\n }, [isLoading]);\n\n if (!isInitialized && isLoading) {\n return (\n <CardPrimitive className={cx(containerClasses, styles['card'])} data-testid=\"thunderid-signin\" variant={variant}>\n <CardPrimitive.Content>\n <div className={styles['loadingContainer']}>\n <Spinner size=\"medium\" />\n <Typography variant=\"body1\" className={styles['loadingText']}>\n {t('messages.loading.placeholder')}\n </Typography>\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n if (hasMultipleOptions() && !currentAuthenticator) {\n const availableAuthenticators: EmbeddedSignInFlowAuthenticator[] = getAvailableAuthenticators();\n\n const userPromptAuthenticators: any[] = availableAuthenticators.filter(\n (auth: any) =>\n auth.metadata?.promptType === EmbeddedSignInFlowAuthenticatorPromptType.UserPrompt ||\n // Fallback: LOCAL authenticators with params are typically user prompts\n (auth.idp === 'LOCAL' && auth.metadata?.params && auth.metadata.params.length > 0),\n );\n\n const optionAuthenticators: any[] = availableAuthenticators\n .filter((auth: any) => !userPromptAuthenticators.includes(auth))\n .filter((authenticator: any) => !HIDDEN_AUTHENTICATORS.includes(authenticator.authenticatorId));\n\n return (\n <CardPrimitive className={cx(containerClasses, styles['card'])} data-testid=\"thunderid-signin\" variant={variant}>\n {(showTitle || showSubtitle) && (\n <CardPrimitive.Header className={styles['header']}>\n {showTitle && (\n <CardPrimitive.Title level={2} className={styles['title']}>\n {flowTitle || t('signin.heading')}\n </CardPrimitive.Title>\n )}\n {showSubtitle && (\n <Typography variant=\"body1\" className={styles['subtitle']}>\n {flowSubtitle || t('signin.subheading')}\n </Typography>\n )}\n </CardPrimitive.Header>\n )}\n <CardPrimitive.Content>\n {flowMessages && flowMessages.length > 0 && (\n <div className={styles['flowMessagesContainer']}>\n {flowMessages.map((flowMessage: any, index: number) => (\n <AlertPrimitive\n key={flowMessage.id || index}\n variant={flowMessage.type}\n className={cx(styles['flowMessageItem'], messageClasses)}\n >\n <AlertPrimitive.Description>{flowMessage.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n ))}\n </div>\n )}\n {messages.length > 0 && (\n <div className={styles['messagesContainer']}>\n {messages.map((message: any, index: number) => {\n let messageVariant: AlertVariant;\n const lowerType: string = message.type.toLowerCase();\n if (lowerType === 'error') {\n messageVariant = 'error';\n } else if (lowerType === 'warning') {\n messageVariant = 'warning';\n } else if (lowerType === 'success') {\n messageVariant = 'success';\n } else {\n messageVariant = 'info';\n }\n\n return (\n <AlertPrimitive\n key={index}\n variant={messageVariant}\n className={cx(styles['messageItem'], messageClasses)}\n >\n <AlertPrimitive.Description>{message.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n );\n })}\n </div>\n )}\n {error && (\n <AlertPrimitive variant=\"error\" className={cx(styles['errorContainer'], errorClasses)}>\n <AlertPrimitive.Title>Error</AlertPrimitive.Title>\n <AlertPrimitive.Description>{error}</AlertPrimitive.Description>\n </AlertPrimitive>\n )}\n\n <div className={styles['contentContainer']}>\n {/* Render USER_PROMPT authenticators as form fields */}\n {userPromptAuthenticators.map((authenticator: any, index: number) => (\n <div key={authenticator.authenticatorId} className={styles['authenticatorItem']}>\n {index > 0 && <Divider className={styles['divider']}>OR</Divider>}\n <form\n className={styles['form']}\n onSubmit={(e: FormEvent): void => {\n e.preventDefault();\n const formData: Record<string, string> = {};\n authenticator.metadata?.params?.forEach((param: any) => {\n formData[param.param] = formValues[param.param] || '';\n });\n handleAuthenticatorSelection(authenticator, formData);\n }}\n >\n {createSignInOptionFromAuthenticator(\n authenticator,\n formValues,\n touchedFields,\n isLoading,\n handleInputChange,\n (auth: any, formData: any) => handleAuthenticatorSelection(auth, formData),\n {\n buttonClassName: buttonClasses,\n error,\n inputClassName: inputClasses,\n },\n )}\n </form>\n </div>\n ))}\n\n {/* Add divider between user prompts and option authenticators if both exist */}\n {userPromptAuthenticators.length > 0 && optionAuthenticators.length > 0 && (\n <Divider className={styles['divider']}>OR</Divider>\n )}\n\n {/* Render all other authenticators (REDIRECTION_PROMPT, multi-option buttons, etc.) */}\n {optionAuthenticators.map((authenticator: any) => (\n <div key={authenticator.authenticatorId} className={styles['authenticatorItem']}>\n {createSignInOptionFromAuthenticator(\n authenticator,\n formValues,\n touchedFields,\n isLoading,\n handleInputChange,\n (auth: any, formData: any) => handleAuthenticatorSelection(auth, formData),\n {\n buttonClassName: buttonClasses,\n error,\n inputClassName: inputClasses,\n },\n )}\n </div>\n ))}\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n if (!currentAuthenticator) {\n return (\n <CardPrimitive\n className={cx(containerClasses, styles['noAuthenticatorCard'])}\n data-testid=\"thunderid-signin\"\n variant={variant}\n >\n <CardPrimitive.Content>\n {error && (\n <AlertPrimitive variant=\"error\" className={styles['errorAlert']}>\n <AlertPrimitive.Title>{t('errors.heading') || 'Error'}</AlertPrimitive.Title>\n <AlertPrimitive.Description>{error}</AlertPrimitive.Description>\n </AlertPrimitive>\n )}\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n // If the current authenticator is a passkey, auto-trigger it instead of showing a form\n if (isPasskeyAuthenticator(currentAuthenticator) && !isLoading) {\n // Auto-trigger passkey authentication\n useEffect(() => {\n handleAuthenticatorSelection(currentAuthenticator);\n }, [currentAuthenticator]);\n\n // Show loading state while passkey authentication is in progress\n return (\n <CardPrimitive className={cx(containerClasses, styles['card'])} data-testid=\"thunderid-signin\" variant={variant}>\n <CardPrimitive.Content>\n <div className={styles['centeredContainer']}>\n <div className={styles['passkeyContainer']}>\n <Spinner size=\"large\" />\n </div>\n <Typography variant=\"body1\">{t('passkey.authenticating') || 'Authenticating with passkey...'}</Typography>\n <Typography variant=\"body2\" className={styles['passkeyText']}>\n {t('passkey.instruction') || 'Please use your fingerprint, face, or security key to authenticate.'}\n </Typography>\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n return (\n <CardPrimitive className={cx(containerClasses, styles['card'])} data-testid=\"thunderid-signin\" variant={variant}>\n <CardPrimitive.Header className={styles['header']}>\n <CardPrimitive.Title level={2} className={styles['title']}>\n {flowTitle || t('signin.heading')}\n </CardPrimitive.Title>\n <Typography variant=\"body1\" className={styles['subtitle']}>\n {flowSubtitle || t('signin.subheading')}\n </Typography>\n {flowMessages && flowMessages.length > 0 && (\n <div className={styles['flowMessagesContainer']}>\n {flowMessages.map((flowMessage: any, index: number) => (\n <AlertPrimitive\n key={flowMessage.id || index}\n variant={flowMessage.type}\n className={cx(styles['flowMessageItem'], messageClasses)}\n >\n <AlertPrimitive.Description>{flowMessage.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n ))}\n </div>\n )}\n {messages.length > 0 && (\n <div className={styles['messagesContainer']}>\n {messages.map((message: any, index: number) => {\n const messageTypeToVariant: Record<string, AlertVariant> = {\n error: 'error',\n success: 'success',\n warning: 'warning',\n };\n const alertVariant: AlertVariant = messageTypeToVariant[message.type.toLowerCase()] || 'info';\n\n return (\n <AlertPrimitive\n key={index}\n variant={alertVariant}\n className={cx(styles['messageItem'], messageClasses)}\n >\n <AlertPrimitive.Description>{message.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n );\n })}\n </div>\n )}\n </CardPrimitive.Header>\n\n <CardPrimitive.Content>\n {error && (\n <AlertPrimitive variant=\"error\" className={cx(styles['errorContainer'], errorClasses)}>\n <AlertPrimitive.Title>{t('errors.heading')}</AlertPrimitive.Title>\n <AlertPrimitive.Description>{error}</AlertPrimitive.Description>\n </AlertPrimitive>\n )}\n\n <form\n className={styles['form']}\n onSubmit={(e: FormEvent<HTMLFormElement>): void => {\n e.preventDefault();\n const formData: Record<string, string> = {};\n currentAuthenticator.metadata?.params?.forEach((param: any) => {\n formData[param.param] = formValues[param.param] || '';\n });\n handleSubmit(formData);\n }}\n >\n {createSignInOptionFromAuthenticator(\n currentAuthenticator,\n formValues,\n touchedFields,\n isLoading,\n handleInputChange,\n (authenticator: any, formData: any) => handleSubmit(formData || formValues),\n {\n buttonClassName: buttonClasses,\n error,\n inputClassName: inputClasses,\n },\n )}\n </form>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n};\n\n/**\n * Base SignIn component that provides native authentication flow.\n * This component handles both the presentation layer and authentication flow logic.\n * It accepts API functions as props to maintain framework independence.\n *\n * @example\n * ```tsx\n * import { BaseSignIn } from '@thunderid/react';\n *\n * const MySignIn = () => {\n * return (\n * <BaseSignIn\n * onInitialize={async () => {\n * // Your API call to initialize authentication\n * return await initializeAuth();\n * }}\n * onSubmit={async (payload) => {\n * // Your API call to handle authentication\n * return await handleAuth(payload);\n * }}\n * onSuccess={(authData) => {\n * console.log('Success:', authData);\n * }}\n * onError={(error) => {\n * console.error('Error:', error);\n * }}\n * className=\"max-w-md mx-auto\"\n * />\n * );\n * };\n * ```\n */\nconst BaseSignIn: FC<BaseSignInProps> = ({showLogo = true, ...rest}: BaseSignInProps): ReactElement => {\n const {theme} = useTheme();\n const styles: ReturnType<typeof useStyles> = useStyles(theme, theme.vars.colors.text.primary);\n\n return (\n <div>\n {showLogo && (\n <div className={styles['logoContainer']}>\n <Logo size=\"large\" />\n </div>\n )}\n <FlowProvider>\n <BaseSignInContent showLogo={showLogo} {...rest} />\n </FlowProvider>\n </div>\n );\n};\n\nexport default BaseSignIn;\n","/**\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 {FlowMetadataResponse, resolveFlowTemplateLiterals} from '@thunderid/browser';\nimport {UseTranslation} from '../../hooks/useTranslation';\n\n/**\n * Resolves all {{ t() }} and {{ meta() }} template expressions in an object's string properties.\n * @param obj - The object to process\n * @param t - The translation function from useTranslation\n * @param properties - Array of property names to resolve (optional, defaults to common properties)\n * @param meta - Optional flow metadata for resolving meta() expressions\n * @returns A new object with resolved template strings\n */\nexport const resolveTranslationsInObject = <T extends Record<string, any>>(\n obj: T,\n t: UseTranslation['t'],\n properties: string[] = ['label', 'placeholder', 'text', 'title', 'subtitle'],\n meta?: FlowMetadataResponse | null,\n): T => {\n const resolved: T = {...obj};\n\n properties.forEach((prop: string) => {\n if (resolved[prop] && typeof resolved[prop] === 'string') {\n (resolved as any)[prop] = resolveFlowTemplateLiterals(resolved[prop], {meta, t});\n }\n });\n\n return resolved;\n};\n\nexport default resolveTranslationsInObject;\n","/**\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 {FlowMetadataResponse} from '@thunderid/browser';\nimport {resolveTranslationsInObject} from './resolveTranslationsInObject';\nimport {UseTranslation} from '../../hooks/useTranslation';\n\n/**\n * Recursively resolves translation and meta template strings in an array of objects.\n * @param items - Array of objects to process\n * @param t - The translation function from useTranslation\n * @param properties - Array of property names to resolve (optional)\n * @param meta - Optional flow metadata for resolving meta() expressions\n * @returns A new array with resolved translations\n */\nconst resolveTranslationsInArray = <T extends Record<string, any>>(\n items: T[],\n t: UseTranslation['t'],\n properties?: string[],\n meta?: FlowMetadataResponse | null,\n): T[] =>\n items.map((item: T) => {\n const resolved: T = resolveTranslationsInObject(item, t, properties, meta);\n\n // If the item has nested components (like BLOCK or STACK type), resolve those too\n if (resolved['components'] && Array.isArray(resolved['components'])) {\n (resolved as any).components = resolveTranslationsInArray(resolved['components'], t, properties, meta);\n }\n\n return resolved;\n });\n\nexport default resolveTranslationsInArray;\n","/**\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\n/**\n * @fileoverview Shared flow response transformer utilities for v2 embedded flows.\n *\n * This module provides reusable transformation functions for normalizing embedded flow\n * responses from ThunderID APIs. It handles both successful responses with component\n * extraction and error responses with proper error message extraction.\n *\n * Key features:\n * - Component extraction from flow meta structure\n * - Translation string resolution in components\n * - Error response detection and message extraction\n * - Configurable error handling (throw vs return errors)\n *\n * Usage:\n * ```typescript\n * import { normalizeFlowResponse } from '../../../utils/v2/flowTransformer';\n *\n * const { executionId, components } = normalizeFlowResponse(apiResponse, t, {\n * defaultErrorKey: 'components.signIn.errors.generic'\n * });\n * ```\n *\n * This transformer is used by both SignIn and SignUp v2 components to ensure\n * consistent response handling across all embedded flows.\n */\n\nimport {EmbeddedFlowComponentV2 as EmbeddedFlowComponent, FlowMetadataResponse} from '@thunderid/browser';\nimport resolveTranslationsInArray from './resolveTranslationsInArray';\nimport {UseTranslation} from '../../hooks/useTranslation';\n\n/**\n * Generic flow error response interface that covers common error structure\n */\nexport interface FlowErrorResponse {\n executionId: string;\n failureReason?: string;\n flowStatus: 'ERROR';\n}\n\n/**\n * Configuration options for flow transformation\n */\nexport interface FlowTransformOptions {\n /**\n * Default error message key for translation fallback\n * @default 'errors.flow.generic'\n */\n defaultErrorKey?: string;\n /**\n * Whether to resolve translation strings or keep them as i18n keys\n * @default true\n */\n resolveTranslations?: boolean;\n /**\n * Whether to throw errors or return them as normalized response\n * @default true\n */\n throwOnError?: boolean;\n}\n\n/**\n * Create a mapping from ref to identifier based on data.inputs array.\n * This handles cases where meta.components use 'ref' to reference inputs,\n * and data.inputs contain the actual 'identifier' field.\n *\n * @param response - The flow response object\n * @returns Map of ref to identifier\n */\nconst createInputRefMapping = (response: any): Map<string, string> => {\n const mapping: Map<string, string> = new Map<string, string>();\n\n if (response?.data?.inputs && Array.isArray(response.data.inputs)) {\n response.data.inputs.forEach((input: any) => {\n if (input.ref && input.identifier) {\n mapping.set(input.ref, input.identifier);\n }\n });\n }\n\n return mapping;\n};\n\n/**\n * Create a mapping from action ref to nextNode based on data.actions array.\n * This handles cases where meta.components reference actions by ref,\n * and data.actions contain the actual nextNode field for routing.\n *\n * @param response - The flow response object\n * @returns Map of action ref to nextNode\n */\nconst createActionRefMapping = (response: any): Map<string, string> => {\n const mapping: Map<string, string> = new Map<string, string>();\n\n if (response?.data?.actions && Array.isArray(response.data.actions)) {\n response.data.actions.forEach((action: any) => {\n if (action.ref && action.nextNode) {\n mapping.set(action.ref, action.nextNode);\n }\n });\n }\n\n return mapping;\n};\n\n/**\n * Apply input ref mapping to components recursively.\n * This ensures that component.ref values are mapped to the correct identifier\n * from data.inputs, enabling proper form submission.\n *\n * @param components - Array of components to transform\n * @param refMapping - Map of ref to identifier\n * @param actionMapping - Map of action ref to nextNode\n * @param inputsData - Array of input data for resolving SELECT options\n * @returns Transformed components with correct identifiers and action references\n */\nconst applyInputRefMapping = (\n components: EmbeddedFlowComponent[],\n refMapping: Map<string, string>,\n actionMapping: Map<string, string>,\n inputsData: any[] = [],\n): EmbeddedFlowComponent[] =>\n components.map((component: EmbeddedFlowComponent) => {\n const transformedComponent: any = {...component} as EmbeddedFlowComponent & {\n actionRef?: string;\n options?: {label: string; value: string}[];\n };\n\n // If this component has a ref that maps to an identifier, update it\n if (transformedComponent.ref && refMapping.has(transformedComponent.ref)) {\n transformedComponent.ref = refMapping.get(transformedComponent.ref);\n }\n\n // For SELECT components, copy options from data.inputs\n // The component.id matches the input.ref in the data structure\n if (transformedComponent.type === 'SELECT' && component.id) {\n const inputData: any = inputsData.find((input: any) => input.ref === component.id);\n if (inputData?.options) {\n transformedComponent.options = inputData.options.map((opt: any) => {\n if (typeof opt === 'string') {\n return {label: opt, value: opt};\n }\n // Safely handle non-string values to prevent React key crashes\n const value: string = typeof opt.value === 'object' ? JSON.stringify(opt.value) : String(opt.value || '');\n const label: string = typeof opt.label === 'object' ? JSON.stringify(opt.label) : String(opt.label || value);\n\n return {label, value};\n });\n }\n }\n\n // If this is an action component, map its id to the nextNode\n // Store the nextNode reference as actionRef property for later use\n if (\n transformedComponent.type === 'ACTION' &&\n transformedComponent.id &&\n actionMapping.has(transformedComponent.id)\n ) {\n transformedComponent.actionRef = actionMapping.get(transformedComponent.id);\n }\n\n // Recursively apply to nested components\n if (transformedComponent.components && Array.isArray(transformedComponent.components)) {\n transformedComponent.components = applyInputRefMapping(\n transformedComponent.components,\n refMapping,\n actionMapping,\n inputsData,\n );\n }\n\n return transformedComponent;\n });\n\n/**\n * Transform and resolve translations in components from flow response.\n * This function extracts components from the response meta structure and optionally resolves\n * any translation strings within them. It also handles mapping of input refs to identifiers\n * and action refs to nextNode values.\n *\n * @param response - The flow response object containing components in meta structure\n * @param t - Translation function from useTranslation hook\n * @param resolveTranslations - Whether to resolve translation strings or keep them as i18n keys (default: true)\n * @returns Array of flow components with resolved or unresolved translations\n */\nexport const transformComponents = (\n response: any,\n t: UseTranslation['t'],\n resolveTranslations = true,\n meta?: FlowMetadataResponse | null,\n): EmbeddedFlowComponent[] => {\n if (!response?.data?.meta?.components) {\n return [];\n }\n\n let {components} = response.data.meta;\n\n // Create mapping from ref to identifier based on data.inputs\n const refMapping: Map<string, string> = createInputRefMapping(response);\n\n // Create mapping from action ref to nextNode based on data.actions\n const actionMapping: Map<string, string> = createActionRefMapping(response);\n\n // Get inputs data for SELECT option resolution\n const inputsData: any[] = response?.data?.inputs || [];\n\n // Apply ref and action mapping if there are any mappings\n if (refMapping.size > 0 || actionMapping.size > 0 || inputsData.length > 0) {\n components = applyInputRefMapping(components, refMapping, actionMapping, inputsData);\n }\n\n return resolveTranslations ? resolveTranslationsInArray(components, t, undefined, meta) : components;\n};\n\n/**\n * Extract error message from flow error response.\n * Supports any flow error response that follows the standard structure.\n * Prioritizes failureReason if present, otherwise falls back to translated generic message.\n *\n * @param error - The error response object\n * @param t - Translation function for fallback messages\n * @param defaultErrorKey - Default translation key for generic errors\n * @returns Extracted error message or fallback\n */\nexport const extractErrorMessage = (\n error: FlowErrorResponse | any,\n t: UseTranslation['t'],\n defaultErrorKey = 'errors.flow.generic',\n): string => {\n // Check for failureReason in the error object\n if (error && typeof error === 'object' && error.failureReason) {\n return error.failureReason;\n }\n\n // Check if error is a standard Error object with a message\n if (error instanceof Error && error.message) {\n return error.message;\n }\n\n // Fallback to a generic error message\n return t(defaultErrorKey);\n};\n\n/**\n * Check if a response is an error response and extract the error message.\n * This function identifies error responses by checking for ERROR status and failure reasons.\n *\n * @param response - The flow response to check\n * @param t - Translation function for error messages\n * @param defaultErrorKey - Default translation key for generic errors\n * @returns Error message string if response is an error, null otherwise\n */\nexport const checkForErrorResponse = (\n response: any,\n t: UseTranslation['t'],\n defaultErrorKey = 'errors.flow.generic',\n): string | null => {\n if (response?.flowStatus === 'ERROR') {\n return extractErrorMessage(response, t, defaultErrorKey);\n }\n\n return null;\n};\n\n/**\n * Generic flow response normalizer that handles both success and error responses.\n * This is the main transformer function that should be used by all flow components.\n *\n * @param response - The raw flow response from the API\n * @param t - Translation function from useTranslation hook\n * @param options - Configuration options for transformation behavior\n * @returns Normalized flow response with executionId and transformed components\n * @throws {any} The original response if it's an error and throwOnError is true\n */\nexport const normalizeFlowResponse = (\n response: any,\n t: UseTranslation['t'],\n options: FlowTransformOptions = {},\n meta?: FlowMetadataResponse | null,\n): {\n additionalData: Record<string, any>;\n components: EmbeddedFlowComponent[];\n executionId: string;\n} => {\n const {throwOnError = true, defaultErrorKey = 'errors.flow.generic', resolveTranslations = true} = options;\n\n // Check if this is an error response\n const errorMessage: string | null = checkForErrorResponse(response, t, defaultErrorKey);\n\n if (errorMessage && throwOnError) {\n // Throw the original response so it can be caught by error handling\n throw response;\n }\n\n const additionalData: Record<string, any> = (response?.data?.additionalData as Record<string, any>) ?? {};\n\n // The consent prompt is serialized as a JSON string (array) by the backend.\n // Parse it and wrap in the expected {purposes: [...]} structure.\n if (typeof additionalData['consentPrompt'] === 'string') {\n try {\n const parsed: any = JSON.parse(additionalData['consentPrompt']);\n additionalData['consentPrompt'] = {purposes: Array.isArray(parsed) ? parsed : []};\n } catch {\n // Leave unparseable value as-is\n }\n }\n\n return {\n additionalData,\n components: transformComponents(response, t, resolveTranslations, meta),\n executionId: response.executionId,\n };\n};\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nconst useStyles = (theme: Theme): Record<string, string> =>\n useMemo(() => {\n const container: string = css`\n display: flex;\n flex-direction: column;\n width: 100%;\n max-height: 320px;\n overflow-y: auto;\n border: 1px solid ${theme.vars.colors.border};\n border-radius: ${theme.vars.borderRadius.medium};\n font-family: ${theme.vars.typography.fontFamily};\n `;\n\n const node: string = css`\n display: flex;\n align-items: center;\n padding: calc(${theme.vars.spacing.unit} * 1) calc(${theme.vars.spacing.unit} * 1.5);\n cursor: pointer;\n user-select: none;\n transition: background-color 0.15s ease;\n\n &:hover {\n background-color: ${theme.vars.colors.action.hover};\n }\n `;\n\n const nodeSelected: string = css`\n background-color: ${theme.vars.colors.action.selected};\n\n &:hover {\n background-color: ${theme.vars.colors.action.selected};\n }\n `;\n\n const toggleButton: string = css`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border: none;\n background: none;\n cursor: pointer;\n padding: 0;\n margin-right: calc(${theme.vars.spacing.unit} * 0.5);\n color: ${theme.vars.colors.text.secondary};\n font-size: 12px;\n flex-shrink: 0;\n `;\n\n const togglePlaceholder: string = css`\n width: 20px;\n height: 20px;\n margin-right: calc(${theme.vars.spacing.unit} * 0.5);\n flex-shrink: 0;\n `;\n\n const nodeName: string = css`\n font-size: 14px;\n color: ${theme.vars.colors.text.primary};\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n `;\n\n const loadMoreButton: string = css`\n display: flex;\n align-items: center;\n padding: calc(${theme.vars.spacing.unit} * 0.75) calc(${theme.vars.spacing.unit} * 1.5);\n border: none;\n background: none;\n cursor: pointer;\n color: ${theme.vars.colors.primary.main};\n font-size: 13px;\n font-family: ${theme.vars.typography.fontFamily};\n\n &:hover {\n text-decoration: underline;\n }\n `;\n\n const loadingPlaceholder: string = css`\n display: flex;\n align-items: center;\n padding: calc(${theme.vars.spacing.unit} * 1) calc(${theme.vars.spacing.unit} * 1.5);\n gap: calc(${theme.vars.spacing.unit} * 1);\n `;\n\n const skeleton: string = css`\n height: 14px;\n border-radius: ${theme.vars.borderRadius.small};\n background-color: ${theme.vars.colors.background.disabled};\n animation: pulse 1.5s ease-in-out infinite;\n\n @keyframes pulse {\n 0%,\n 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.4;\n }\n }\n `;\n\n return {\n container,\n loadMoreButton,\n loadingPlaceholder,\n node,\n nodeName,\n nodeSelected,\n skeleton,\n toggleButton,\n togglePlaceholder,\n };\n }, [\n theme.vars.colors.action.hover,\n theme.vars.colors.action.selected,\n theme.vars.colors.background.disabled,\n theme.vars.colors.border,\n theme.vars.colors.primary.main,\n theme.vars.colors.text.primary,\n theme.vars.colors.text.secondary,\n theme.vars.borderRadius.medium,\n theme.vars.borderRadius.small,\n theme.vars.spacing.unit,\n theme.vars.typography.fontFamily,\n ]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {OrganizationUnit, OrganizationUnitListResponse} from '@thunderid/browser';\nimport React, {useCallback, useEffect, useState} from 'react';\nimport useStyles from './OrganizationUnitPicker.styles';\nimport useTheme from '../../../../../contexts/Theme/useTheme';\n\ninterface NodeState {\n children: OrganizationUnit[];\n expanded: boolean;\n hasMore: boolean;\n loading: boolean;\n offset: number;\n totalResults: number;\n}\n\nexport interface OrganizationUnitPickerProps {\n className?: string;\n fetchChildren: (parentId: string, limit: number, offset: number) => Promise<OrganizationUnitListResponse>;\n onSelect: (ouId: string) => void;\n pageSize?: number;\n rootOuId: string;\n selectedOuId?: string | null;\n}\n\nconst OrganizationUnitPicker = ({\n rootOuId,\n selectedOuId,\n onSelect,\n fetchChildren,\n pageSize = 10,\n className,\n}: OrganizationUnitPickerProps): React.ReactElement => {\n const {theme} = useTheme();\n const styles: Record<string, string> = useStyles(theme);\n\n const [nodeStates, setNodeStates] = useState<Record<string, NodeState>>({});\n\n const loadChildren: (parentId: string, offset?: number) => Promise<void> = useCallback(\n async (parentId: string, offset = 0) => {\n setNodeStates((prev: Record<string, NodeState>) => ({\n ...prev,\n [parentId]: {\n ...(prev[parentId] || {children: [], expanded: true, hasMore: false, offset: 0, totalResults: 0}),\n loading: true,\n },\n }));\n\n try {\n const response: OrganizationUnitListResponse = await fetchChildren(parentId, pageSize, offset);\n const newChildren: OrganizationUnit[] = response.organizationUnits || [];\n\n setNodeStates((prev: Record<string, NodeState>) => {\n const existing: NodeState = prev[parentId] || {\n children: [],\n expanded: true,\n hasMore: false,\n loading: false,\n offset: 0,\n totalResults: 0,\n };\n const mergedChildren: OrganizationUnit[] =\n offset === 0 ? newChildren : [...existing.children, ...newChildren];\n const newOffset: number = offset + newChildren.length;\n\n return {\n ...prev,\n [parentId]: {\n children: mergedChildren,\n expanded: true,\n hasMore: newOffset < response.totalResults,\n loading: false,\n offset: newOffset,\n totalResults: response.totalResults,\n },\n };\n });\n } catch {\n setNodeStates((prev: Record<string, NodeState>) => ({\n ...prev,\n [parentId]: {\n ...(prev[parentId] || {children: [], expanded: true, hasMore: false, offset: 0, totalResults: 0}),\n loading: false,\n },\n }));\n }\n },\n [fetchChildren, pageSize],\n );\n\n // Auto-load root children on mount\n useEffect(() => {\n if (rootOuId && !nodeStates[rootOuId]) {\n loadChildren(rootOuId);\n }\n }, [rootOuId, loadChildren, nodeStates]);\n\n const handleToggle: (ouId: string) => void = useCallback(\n (ouId: string) => {\n const state: NodeState | undefined = nodeStates[ouId];\n\n if (state?.expanded) {\n setNodeStates((prev: Record<string, NodeState>) => ({\n ...prev,\n [ouId]: {...prev[ouId], expanded: false},\n }));\n } else if (state?.children.length) {\n setNodeStates((prev: Record<string, NodeState>) => ({\n ...prev,\n [ouId]: {...prev[ouId], expanded: true},\n }));\n } else {\n loadChildren(ouId);\n }\n },\n [nodeStates, loadChildren],\n );\n\n const handleLoadMore: (parentId: string) => void = useCallback(\n (parentId: string) => {\n const state: NodeState | undefined = nodeStates[parentId];\n\n if (state) {\n loadChildren(parentId, state.offset);\n }\n },\n [nodeStates, loadChildren],\n );\n\n const renderLoadingPlaceholders = (depth: number): React.ReactElement => (\n <>\n {[0, 1, 2].map((i: number) => (\n <div\n key={`skeleton-${i}`}\n className={styles['loadingPlaceholder']}\n style={{paddingLeft: `${(depth + 1) * 20}px`}}\n >\n <div className={styles['skeleton']} style={{width: `${100 - i * 20}px`}} />\n </div>\n ))}\n </>\n );\n\n const renderNode = (ou: OrganizationUnit, depth = 0): React.ReactElement => {\n const state: NodeState | undefined = nodeStates[ou.id];\n const isSelected: boolean = selectedOuId === ou.id;\n const isExpanded: boolean = state?.expanded || false;\n const isLoading: boolean = state?.loading || false;\n const hasChildren: boolean = !state || state.totalResults > 0 || state.children.length > 0;\n\n return (\n <React.Fragment key={ou.id}>\n <div\n className={cx(styles['node'], isSelected && styles['nodeSelected'])}\n style={{paddingLeft: `${depth * 20 + 12}px`}}\n role=\"treeitem\"\n aria-selected={isSelected}\n aria-expanded={hasChildren ? isExpanded : undefined}\n onClick={() => onSelect(ou.id)}\n onKeyDown={(e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onSelect(ou.id);\n }\n }}\n tabIndex={0}\n >\n {hasChildren ? (\n <button\n className={styles['toggleButton']}\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n handleToggle(ou.id);\n }}\n aria-label={isExpanded ? 'Collapse' : 'Expand'}\n type=\"button\"\n >\n {isExpanded ? '\\u25BE' : '\\u25B8'}\n </button>\n ) : (\n <span className={styles['togglePlaceholder']} />\n )}\n <span className={styles['nodeName']}>{ou.name}</span>\n </div>\n\n {isExpanded && isLoading && !state?.children.length && renderLoadingPlaceholders(depth)}\n\n {isExpanded && state?.children.map((child: OrganizationUnit) => renderNode(child, depth + 1))}\n\n {isExpanded && state?.hasMore && (\n <button\n className={styles['loadMoreButton']}\n style={{paddingLeft: `${(depth + 1) * 20 + 12}px`}}\n onClick={() => handleLoadMore(ou.id)}\n disabled={isLoading}\n type=\"button\"\n >\n {isLoading ? 'Loading...' : 'Load more'}\n </button>\n )}\n </React.Fragment>\n );\n };\n\n const rootState: NodeState | undefined = nodeStates[rootOuId];\n const isRootLoading: boolean = rootState?.loading && !rootState?.children.length;\n\n return (\n <div className={cx(styles['container'], className)} role=\"tree\" aria-label=\"Organization unit picker\">\n {isRootLoading && renderLoadingPlaceholders(0)}\n\n {rootState?.children.map((ou: OrganizationUnit) => renderNode(ou, 0))}\n\n {rootState?.hasMore && (\n <button\n className={styles['loadMoreButton']}\n onClick={() => handleLoadMore(rootOuId)}\n disabled={rootState?.loading}\n type=\"button\"\n >\n {rootState?.loading ? 'Loading...' : 'Load more'}\n </button>\n )}\n </div>\n );\n};\n\nexport default OrganizationUnitPicker;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(\n () => ({\n bullet: css`\n width: 5px;\n height: 5px;\n border-radius: 50%;\n background-color: #9e9e9e;\n flex-shrink: 0;\n `,\n divider: css`\n opacity: 0.5;\n margin: 0.25rem 0;\n `,\n labelContainer: css`\n display: flex;\n align-items: center;\n gap: 0.4rem;\n `,\n listContainer: css`\n display: flex;\n flex-direction: column;\n `,\n listItem: css`\n padding: 0 0.25rem;\n `,\n listRow: css`\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.125rem 0;\n `,\n typography: css`\n margin: 0;\n `,\n }),\n [theme, colorScheme],\n );\n\nexport default useStyles;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nconst useStyles = (theme: Theme, colorScheme: string, hasError: boolean, required: boolean): Record<string, string> =>\n useMemo(() => {\n const containerStyles: string = css`\n display: inline-flex;\n align-items: center;\n cursor: pointer;\n `;\n\n const inputStyles: string = css`\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n width: 1px;\n white-space: nowrap;\n\n &:focus-visible + div {\n outline: 2px solid ${theme.vars.colors.primary.main};\n outline-offset: 2px;\n }\n\n &:disabled + div {\n cursor: not-allowed;\n opacity: 0.6;\n }\n `;\n\n const trackStyles: string = css`\n position: relative;\n display: inline-flex;\n align-items: center;\n width: 36px;\n height: 20px;\n background-color: ${theme.vars.colors.text.secondary};\n opacity: 0.2;\n border-radius: 9999px;\n transition: all 0.2s ease-in-out;\n\n input:checked + & {\n background-color: ${theme.vars.colors.primary.main};\n opacity: 1;\n }\n\n input:disabled + & {\n opacity: 0.4;\n }\n `;\n\n const thumbStyles: string = css`\n position: absolute;\n left: 2px;\n width: 16px;\n height: 16px;\n background-color: #fff;\n border-radius: 50%;\n transition: transform 0.2s ease-in-out;\n\n input:checked + * > & {\n transform: translateX(16px);\n }\n `;\n\n const labelStyles: string = css`\n margin-left: calc(${theme.vars.spacing.unit} * 1.5);\n color: ${theme.vars.colors.text.primary};\n font-size: ${theme.vars.typography.fontSizes.sm};\n font-family: ${theme.vars.typography.fontFamily};\n cursor: pointer;\n\n input:disabled ~ & {\n cursor: not-allowed;\n opacity: 0.6;\n }\n `;\n\n const errorLabelStyles: string = css`\n color: ${theme.vars.colors.error.main};\n `;\n\n return {\n container: containerStyles,\n errorLabel: hasError ? errorLabelStyles : '',\n input: inputStyles,\n label: labelStyles,\n thumb: thumbStyles,\n track: trackStyles,\n };\n }, [theme, colorScheme, hasError, required]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC, InputHTMLAttributes} from 'react';\nimport useStyles from './Toggle.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\n\n/**\n * Props for the Toggle component.\n */\nexport interface ToggleProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'type'> {\n className?: string;\n error?: string;\n helperText?: string;\n label?: string;\n required?: boolean;\n}\n\n/**\n * A Toggle component that represents a boolean input. It is built on top of a hidden checkbox input\n * and styled to look like a switch.\n *\n * The component is wrapped in a FormControl to display error messages and helper text.\n * The label is associated with the input for accessibility.\n *\n * @param props - Props for the Toggle component\n * @returns A JSX element representing the Toggle\n */\nconst Toggle: FC<ToggleProps> = ({label, error, className, required, helperText, style = {}, ...rest}: ToggleProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const hasError = !!error;\n const styles: Record<string, string> = useStyles(theme, colorScheme, hasError, !!required);\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n className={cx(withVendorCSSClassPrefix(bem('toggle')), className)}\n helperTextMarginLeft={`calc(${theme.vars.spacing.unit} * 5.5)`}\n >\n <label style={style} className={cx(withVendorCSSClassPrefix(bem('toggle', 'container')), styles['container'])}>\n <input\n type=\"checkbox\"\n role=\"switch\"\n className={cx(withVendorCSSClassPrefix(bem('toggle', 'input')), styles['input'])}\n aria-invalid={hasError}\n aria-required={required}\n {...rest}\n />\n <div className={cx(withVendorCSSClassPrefix(bem('toggle', 'track')), styles['track'])}>\n <span className={cx(withVendorCSSClassPrefix(bem('toggle', 'thumb')), styles['thumb'])} />\n </div>\n {label && (\n <InputLabel\n required={required}\n error={hasError}\n variant=\"inline\"\n className={cx(withVendorCSSClassPrefix(bem('toggle', 'label')), styles['label'], styles['errorLabel'], {\n [withVendorCSSClassPrefix(bem('toggle', 'label', 'error'))]: hasError,\n })}\n >\n {label}\n </InputLabel>\n )}\n </label>\n </FormControl>\n );\n};\n\nexport default Toggle;\n","/**\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 {cx} from '@emotion/css';\nimport {type ConsentPurposeDataV2 as ConsentPurposeData, withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {type ChangeEvent, FC, ReactNode} from 'react';\nimport useStyles from './ConsentCheckboxList.styles';\nimport useTheme from '../../contexts/Theme/useTheme';\nimport Divider from '../primitives/Divider/Divider';\nimport Toggle from '../primitives/Toggle/Toggle';\nimport Typography from '../primitives/Typography/Typography';\n\n/**\n * Computes the form value key for tracking an optional attribute's consent state.\n *\n * @param purposeId - The ID of the consent purpose.\n * @param attrName - The name of the attribute.\n * @returns A stable form key string.\n */\nexport const getConsentOptionalKey = (purposeId: string, attrName: string): string =>\n `__consent_opt__${purposeId}__${attrName}`;\n\n/**\n * ConsentInputVariant defines whether the ConsentCheckboxList is rendering essential (read-only) or\n * optional (toggleable) attributes.\n */\nexport type ConsentInputVariant = 'ESSENTIAL' | 'OPTIONAL';\n\n/**\n * Render props exposed by ConsentCheckboxList when using the render-prop pattern.\n */\nexport interface ConsentCheckboxListRenderProps {\n /** The list of attribute names to render. */\n attributes: string[];\n /**\n * Call this when an optional attribute checkbox is toggled.\n * No-op for ESSENTIAL attributes (they cannot be changed).\n */\n handleChange: (attrName: string, checked: boolean) => void;\n /**\n * Returns the current checked state for the given attribute name.\n * Always returns true for ESSENTIAL attributes.\n */\n isChecked: (attrName: string) => boolean;\n /** Whether the list is rendering essential or optional attributes. */\n variant: ConsentInputVariant;\n}\n\n/**\n * Props for the ConsentCheckboxList component.\n */\nexport interface ConsentCheckboxListProps {\n /**\n * Render-props callback. When provided, the default checkbox list UI is replaced\n * with whatever JSX the callback returns.\n *\n * @example\n * ```tsx\n * <ConsentCheckboxList variant=\"OPTIONAL\" purpose={purpose} formValues={formValues} onInputChange={onChange}>\n * {({ attributes, isChecked, handleChange }) => (\n * <ul>\n * {attributes.map(attr => (\n * <li key={attr}>\n * <Checkbox checked={isChecked(attr)} onChange={e => handleChange(attr, e.target.checked)} />\n * {attr}\n * </li>\n * ))}\n * </ul>\n * )}\n * </ConsentCheckboxList>\n * ```\n */\n children?: (props: ConsentCheckboxListRenderProps) => ReactNode;\n /** Current form values - used to read optional checkbox state */\n formValues: Record<string, string>;\n /** Callback invoked when an optional attribute checkbox is toggled */\n onInputChange: (name: string, value: string) => void;\n /** The consent purpose data containing attribute lists */\n purpose: ConsentPurposeData;\n /** Whether to render essential (disabled) or optional (toggleable) attributes */\n variant: ConsentInputVariant;\n}\n\n/**\n * Renders a list of consent attribute checkboxes.\n *\n * - ESSENTIAL variant: renders read-only checked checkboxes for required attributes.\n * - OPTIONAL variant: renders toggleable checkboxes for optional attributes.\n * Opt-in is the default when no prior form value exists.\n */\nconst ConsentCheckboxList: FC<ConsentCheckboxListProps> = ({\n variant,\n purpose,\n formValues,\n onInputChange,\n children,\n}: ConsentCheckboxListProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n\n const attributes: string[] = (variant === 'ESSENTIAL' ? purpose.essential : purpose.optional).map(\n (e): string => e.name,\n );\n\n if (!attributes || attributes.length === 0) {\n return null;\n }\n\n const isEssential: boolean = variant === 'ESSENTIAL';\n\n const isChecked = (attrName: string): boolean => {\n if (isEssential) {\n return true;\n }\n const key: string = getConsentOptionalKey(purpose.purposeId, attrName);\n // Default to opted-in (true) when there's no explicit form value\n return formValues[key] !== 'false';\n };\n\n const handleChange = (attrName: string, checked: boolean): void => {\n const key: string = getConsentOptionalKey(purpose.purposeId, attrName);\n onInputChange(key, checked ? 'true' : 'false');\n };\n\n if (children) {\n return <>{children({attributes, handleChange, isChecked, variant})}</>;\n }\n\n return (\n <div className={cx(withVendorCSSClassPrefix(bem('consent-checkbox-list')), styles['listContainer'])}>\n {attributes.map((attr: string) => {\n const inputId = `consent_${isEssential ? 'ess' : 'opt'}_${purpose.purposeId}_${attr}`;\n const checked: boolean = isChecked(attr);\n\n return (\n <div\n key={attr}\n className={cx(withVendorCSSClassPrefix(bem('consent-checkbox-list', 'item')), styles['listItem'])}\n >\n <div className={cx(withVendorCSSClassPrefix(bem('consent-checkbox-list', 'row')), styles['listRow'])}>\n <div\n className={cx(\n withVendorCSSClassPrefix(bem('consent-checkbox-list', 'label-container')),\n styles['labelContainer'],\n )}\n >\n <div\n className={cx(withVendorCSSClassPrefix(bem('consent-checkbox-list', 'bullet')), styles['bullet'])}\n />\n <Typography\n variant=\"body2\"\n className={cx(\n withVendorCSSClassPrefix(bem('consent-checkbox-list', 'typography')),\n styles['typography'],\n )}\n >\n {attr}\n </Typography>\n </div>\n <Toggle\n id={inputId}\n checked={checked}\n disabled={isEssential}\n onChange={\n isEssential\n ? undefined\n : (e: ChangeEvent<HTMLInputElement>): void => handleChange(attr, e.target.checked)\n }\n />\n </div>\n <Divider\n className={cx(withVendorCSSClassPrefix(bem('consent-checkbox-list', 'divider')), styles['divider'])}\n />\n </div>\n );\n })}\n </div>\n );\n};\n\nexport default ConsentCheckboxList;\n","/**\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 {type ConsentPurposeDataV2 as ConsentPurposeData} from '@thunderid/browser';\nimport {FC, ReactNode} from 'react';\nimport ConsentCheckboxList from './ConsentCheckboxList';\nimport Typography from '../primitives/Typography/Typography';\n\n/**\n * Backward-compatible consent purpose type exported by @thunderid/react.\n *\n * Some consumers import this name directly; keep it as an alias to the v2 model.\n */\nexport type ConsentPurpose = ConsentPurposeData;\n\n/**\n * Render props exposed by Consent when using the render-prop pattern.\n */\nexport interface ConsentRenderProps {\n /** Current form values - used to read optional checkbox state. */\n formValues: Record<string, string>;\n /** Callback invoked when a user toggles an optional attribute. */\n onInputChange: (name: string, value: string) => void;\n /** The resolved list of consent purposes parsed from `consentData`. */\n purposes: ConsentPurposeData[];\n}\n\n/**\n * Props for the Consent component.\n */\nexport interface ConsentProps {\n /**\n * Render-props callback. When provided, the default consent UI is replaced with\n * whatever JSX the callback returns. The parsed `purposes` list is injected so\n * consumers do not need to re-parse `consentData` themselves.\n *\n * @example\n * ```tsx\n * <Consent consentData={raw} formValues={formInputs} onInputChange={onChange} t={t}>\n * {({ purposes, formValues, onInputChange, t }) => (\n * <div>\n * {purposes.map(p => <MyConsentSection key={p.purposeId} purpose={p} />)}\n * </div>\n * )}\n * </Consent>\n * ```\n */\n children?: (props: ConsentRenderProps) => ReactNode;\n /**\n * The raw JSON string returned by the backend in `additionalData.consentPrompt`.\n */\n consentData?: string | ConsentPurposeData[] | {purposes: ConsentPurposeData[]};\n /**\n * Current form values - used to read optional checkbox state.\n */\n formValues: Record<string, string>;\n /**\n * Callback invoked when a user toggles an optional attribute.\n */\n onInputChange: (name: string, value: string) => void;\n}\n\n/**\n * Consent component renders the list of purposes and their associated attributes (essential and optional)\n * based on the data provided by the backend. It allows users to toggle optional attributes while essential\n * attributes are displayed as read-only.\n */\nconst Consent: FC<ConsentProps> = ({consentData, formValues, onInputChange, children}: ConsentProps) => {\n if (!consentData) return null;\n\n let purposes: ConsentPurposeData[] = [];\n\n try {\n const parsed: ConsentPurposeData[] | {purposes: ConsentPurposeData[]} =\n typeof consentData === 'string' ? JSON.parse(consentData) : consentData;\n\n purposes = Array.isArray(parsed) ? parsed : parsed.purposes || [];\n } catch (e) {\n // Failed to parse consent prompt data\n return null;\n }\n\n if (purposes.length === 0) return null;\n\n if (children) {\n return <>{children({formValues, onInputChange, purposes: purposes})}</>;\n }\n\n return (\n <div style={{display: 'flex', flexDirection: 'column', gap: '1rem', marginTop: '0.25rem'}}>\n {purposes.map((purpose: ConsentPurposeData, purposeIndex: number) => (\n <div key={purpose.purposeId || purposeIndex} style={{paddingBottom: '1rem'}}>\n {/* TODO: Uncomment when the backend supports multiple purposes for a application */}\n {/* <Typography variant=\"h6\" fontWeight={600} gutterBottom color=\"inherit\">\n {purpose.purposeName}\n </Typography>\n <Typography variant=\"body2\" color=\"inherit\" style={{marginBottom: '1rem', opacity: 0.85}}>\n {purpose.description}\n </Typography> */}\n\n {purpose.essential && purpose.essential.length > 0 && (\n <div style={{marginTop: '0.5rem'}}>\n <Typography variant=\"subtitle2\" fontWeight=\"bold\">\n Essential Attributes\n </Typography>\n <ConsentCheckboxList\n variant=\"ESSENTIAL\"\n purpose={purpose}\n formValues={formValues}\n onInputChange={onInputChange}\n />\n </div>\n )}\n\n {purpose.optional && purpose.optional.length > 0 && (\n <div style={{marginTop: '0.5rem'}}>\n <Typography variant=\"subtitle2\" fontWeight=\"bold\">\n {purpose.type === 'permissions' ? 'Permissions' : 'Optional Attributes'}\n </Typography>\n <ConsentCheckboxList\n variant=\"OPTIONAL\"\n purpose={purpose}\n formValues={formValues}\n onInputChange={onInputChange}\n />\n </div>\n )}\n </div>\n ))}\n </div>\n );\n};\n\nexport default Consent;\n","/**\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 {FC, ReactNode, useEffect, useState} from 'react';\nimport Typography from '../primitives/Typography/Typography';\n\n/**\n * Render props exposed by FlowTimer when using the render-prop pattern.\n */\nexport interface FlowTimerRenderProps {\n /** Human-readable formatted time string (e.g. \"2:30\" or \"Timed out\"). */\n formattedTime: string;\n /** Whether the timer has expired. */\n isExpired: boolean;\n /** Remaining time in seconds. 0 when expired. */\n remaining: number;\n}\n\n/**\n * Props for the FlowTimer component.\n */\nexport interface FlowTimerProps {\n /**\n * Render-props callback. When provided, the default countdown display is replaced\n * with whatever JSX the callback returns.\n *\n * @example\n * ```tsx\n * <FlowTimer expiresIn={300}>\n * {({ remaining, isExpired, formattedTime }) => (\n * <span style={{ color: isExpired ? 'red' : 'inherit' }}>\n * {isExpired ? 'Session expired' : `Time left: ${formattedTime}`}\n * </span>\n * )}\n * </FlowTimer>\n * ```\n */\n children?: (props: FlowTimerRenderProps) => ReactNode;\n /** Initial number of seconds for the countdown. 0 or negative means no timer. */\n expiresIn?: number;\n /** Text template for the countdown display. Use {time} as a placeholder. */\n textTemplate?: string;\n}\n\n/**\n * Flow countdown timer component.\n *\n * Displays a countdown from the given number of seconds. When the time expires,\n * shows \"Timed out\". Returns null if expiresIn <= 0.\n */\nconst FlowTimer: FC<FlowTimerProps> = ({\n expiresIn = 0,\n textTemplate = 'Time remaining: {time}',\n children,\n}: FlowTimerProps) => {\n const [remaining, setRemaining] = useState<number>(expiresIn > 0 ? expiresIn : 0);\n\n useEffect(() => {\n if (expiresIn <= 0) {\n return undefined;\n }\n\n setRemaining(expiresIn);\n\n const interval: NodeJS.Timeout = setInterval(() => {\n setRemaining((prev: number) => {\n if (prev <= 1) {\n clearInterval(interval);\n return 0;\n }\n return prev - 1;\n });\n }, 1000);\n\n return () => clearInterval(interval);\n }, [expiresIn]);\n\n if (expiresIn <= 0) {\n return null;\n }\n\n const formatTime = (seconds: number): string => {\n if (seconds <= 0) {\n return 'Timed out';\n }\n const m: number = Math.floor(seconds / 60);\n const s: number = seconds % 60;\n return `${m}:${s.toString().padStart(2, '0')}`;\n };\n\n const isExpired: boolean = remaining <= 0;\n const formattedTime: string = formatTime(remaining);\n\n if (children) {\n return <>{children({formattedTime, isExpired, remaining})}</>;\n }\n\n const displayText: string = isExpired ? 'Timed out' : textTemplate.replace('{time}', formattedTime);\n\n return <Typography variant=\"body2\">{displayText}</Typography>;\n};\n\nexport default FlowTimer;\n","/**\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 {extractEmojiFromUri, isEmojiUri} from '@thunderid/browser';\nimport {CSSProperties, FC, SyntheticEvent} from 'react';\nimport useTheme from '../../contexts/Theme/useTheme';\nimport {AdapterProps} from '../../models/adapters';\n\nconst DEFAULT_EMOJI_CONTAINER_HEIGHT = '4em';\n\n/**\n * Image component for sign-up forms.\n */\nconst ImageComponent: FC<AdapterProps> = ({component}: AdapterProps) => {\n const {theme} = useTheme();\n const config: Record<string, unknown> = component.config || {};\n const src: string = (config['src'] as string) || '';\n const alt: string = (config['alt'] as string) || (config['label'] as string) || 'Image';\n const width: string = (config['width'] as string) || '100%';\n const height: string = (config['height'] as string) || 'auto';\n const variant: string = component.variant?.toLowerCase() || 'image_block';\n\n const imageStyle: CSSProperties = {\n borderRadius: theme.vars.borderRadius.small,\n display: 'block',\n margin: variant === 'image_block' ? '1rem auto' : '0',\n };\n\n if (!src) {\n return null;\n }\n\n if (isEmojiUri(src)) {\n // Bare numbers (e.g. \"48\") are valid for <img> width/height attributes but\n // are unit-less and ignored as CSS properties — normalize them to px.\n const toCSSLength = (value: string): string => (/^\\d+(\\.\\d+)?$/.test(value) ? `${value}px` : value);\n const cssWidth: string = toCSSLength(width);\n const cssHeight: string = toCSSLength(height);\n\n // container-type: size needs a concrete block dimension — percentage and\n // 'auto' values both collapse to 0 when the parent has no defined height.\n // Priority: explicit height → explicit width (square) → fallback constant.\n const isConcrete = (v: string): boolean => v !== 'auto' && !v.endsWith('%');\n let containerHeight: string;\n if (isConcrete(cssHeight)) {\n containerHeight = cssHeight;\n } else if (isConcrete(cssWidth)) {\n containerHeight = cssWidth;\n } else {\n containerHeight = DEFAULT_EMOJI_CONTAINER_HEIGHT;\n }\n\n return (\n <div key={component.id} style={{textAlign: 'center'}}>\n {/*\n * container-type: size lets the inner span use cqmin (= min(cqw, cqh))\n * so the emoji font-size tracks the rendered container dimensions\n * rather than the parent's font-size.\n */}\n <span\n style={{\n ...imageStyle,\n containerType: 'size',\n display: 'inline-grid',\n height: containerHeight,\n placeItems: 'center',\n width: cssWidth,\n }}\n >\n <span aria-label={alt} role=\"img\" style={{fontSize: '100cqmin', lineHeight: 1}}>\n {extractEmojiFromUri(src)}\n </span>\n </span>\n </div>\n );\n }\n\n return (\n <div key={component.id} style={{textAlign: 'center'}}>\n <img\n src={src}\n alt={alt}\n height={height}\n width={width}\n style={imageStyle}\n onError={(e: SyntheticEvent<HTMLImageElement>): void => {\n // Hide broken images\n e.currentTarget.style.display = 'none';\n }}\n />\n </div>\n );\n};\n\nexport default ImageComponent;\n","/**\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 {WithPreferences} from '@thunderid/browser';\nimport {FC, HTMLAttributes} from 'react';\nimport useTranslation from '../../hooks/useTranslation';\nimport Button from '../primitives/Button/Button';\n\nexport interface SmsOtpButtonProps extends WithPreferences {\n /**\n * Whether the component is in loading state.\n */\n isLoading?: boolean;\n}\n\n/**\n * SMS OTP Sign-In Button Component.\n * Handles authentication with SMS OTP.\n */\nconst SmsOtpButton: FC<SmsOtpButtonProps & HTMLAttributes<HTMLButtonElement>> = ({\n isLoading,\n preferences,\n children,\n ...rest\n}: SmsOtpButtonProps & HTMLAttributes<HTMLButtonElement>) => {\n const {t} = useTranslation(preferences?.i18n);\n\n return (\n <Button\n {...rest}\n fullWidth\n type=\"button\"\n color=\"secondary\"\n variant=\"solid\"\n disabled={isLoading}\n startIcon={\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fill=\"currentColor\"\n d=\"M20 15.5c-1.25 0-2.45-.2-3.57-.57a1.02 1.02 0 0 0-1.02.24l-2.2 2.2a15.074 15.074 0 0 1-6.59-6.59l2.2-2.2c.27-.27.35-.67.24-1.02A11.36 11.36 0 0 1 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1M12 3v10l3-3h6V3z\"\n />\n </svg>\n }\n >\n {children ?? t('elements.buttons.smsotp.text')}\n </Button>\n );\n};\n\nexport default SmsOtpButton;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nconst useStyles = (theme: Theme): Record<string, string> =>\n useMemo(\n () => ({\n container: css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} * 0.5);\n width: 100%;\n `,\n copyButton: css`\n flex-shrink: 0;\n white-space: nowrap;\n `,\n label: css`\n color: ${theme.vars.colors.text.secondary};\n font-size: 0.875rem;\n font-weight: 500;\n `,\n valueBox: css`\n align-items: center;\n background-color: ${theme.vars.colors.background.surface};\n border: 1px solid ${theme.vars.colors.border};\n border-radius: ${theme.vars.borderRadius.small};\n display: flex;\n gap: calc(${theme.vars.spacing.unit} * 1);\n padding: calc(${theme.vars.spacing.unit} * 0.75) calc(${theme.vars.spacing.unit} * 1);\n `,\n valueText: css`\n color: ${theme.vars.colors.text.primary};\n flex: 1;\n font-family: monospace;\n font-size: 0.85rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n word-break: break-all;\n `,\n }),\n [theme],\n );\n\nexport default useStyles;\n","/**\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 {FC, ReactElement, useCallback, useState} from 'react';\nimport useStyles from './CopyableText.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport useTranslation from '../../../hooks/useTranslation';\nimport Button from '../Button/Button';\n\nexport interface CopyableTextProps {\n /**\n * Optional label displayed above the value box.\n */\n label?: string;\n /**\n * The text value to display and copy.\n */\n value: string;\n}\n\n/**\n * A React component that displays a text value with an optional label and a button to copy the value to\n * the clipboard. When the button is clicked, it attempts to copy the value using the Clipboard API, and\n * falls back to a textarea method if the API is not supported.\n * After copying, it shows a \"Copied!\" message for 3 seconds before resetting.\n */\nconst CopyableText: FC<CopyableTextProps> = ({label, value}: CopyableTextProps): ReactElement => {\n const {theme} = useTheme();\n const styles: Record<string, string> = useStyles(theme);\n const {t} = useTranslation();\n const [copied, setCopied] = useState(false);\n\n const handleCopy: ReturnType<typeof useCallback> = useCallback(async (): Promise<void> => {\n try {\n await navigator.clipboard.writeText(value);\n } catch {\n const textArea: HTMLTextAreaElement = document.createElement('textarea');\n textArea.value = value;\n document.body.appendChild(textArea);\n textArea.select();\n document.execCommand('copy');\n document.body.removeChild(textArea);\n }\n setCopied(true);\n setTimeout(() => setCopied(false), 3000);\n }, [value]);\n\n return (\n <div className={styles['container']}>\n {label && <span className={styles['label']}>{label}</span>}\n <div className={styles['valueBox']}>\n <span className={styles['valueText']}>{value}</span>\n <Button\n variant=\"outline\"\n size=\"small\"\n className={styles['copyButton']}\n onClick={() => {\n handleCopy().catch(() => undefined);\n }}\n >\n {copied ? t('elements.display.copyable_text.copied') : t('elements.display.copyable_text.copy')}\n </Button>\n </div>\n </div>\n );\n};\n\nexport default CopyableText;\n","/**\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 {FC} from 'react';\n\nexport interface ArrowLeftRightProps {\n /** Color of the icon stroke */\n color?: string;\n /** Icon size in pixels */\n size?: number;\n}\n\n/**\n * ArrowLeftRight Icon component (lucide-compatible).\n */\nconst ArrowLeftRight: FC<ArrowLeftRightProps> = ({color = 'currentColor', size = 24}: ArrowLeftRightProps) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M8 3 4 7l4 4\" />\n <path d=\"M4 7h16\" />\n <path d=\"m16 21 4-4-4-4\" />\n <path d=\"M20 17H4\" />\n </svg>\n);\n\nArrowLeftRight.displayName = 'ArrowLeftRight';\n\nexport default ArrowLeftRight;\n","/**\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 {FC} from 'react';\n\nexport interface ArrowRightLeftProps {\n /** Color of the icon stroke */\n color?: string;\n /** Icon size in pixels */\n size?: number;\n}\n\n/**\n * ArrowRightLeft Icon component (lucide-compatible).\n */\nconst ArrowRightLeft: FC<ArrowRightLeftProps> = ({color = 'currentColor', size = 24}: ArrowRightLeftProps) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m16 3 4 4-4 4\" />\n <path d=\"M20 7H4\" />\n <path d=\"m8 21-4-4 4-4\" />\n <path d=\"M4 17h16\" />\n </svg>\n);\n\nArrowRightLeft.displayName = 'ArrowRightLeft';\n\nexport default ArrowRightLeft;\n","/**\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 {FC} from 'react';\nimport ArrowLeftRight from './ArrowLeftRight';\nimport ArrowRightLeft from './ArrowRightLeft';\n\nexport interface FlowIconProps {\n color?: string;\n size?: number;\n}\n\n/**\n * Registry of icon components keyed by their lucide-compatible name.\n * Add new icons here as needed by flow definitions.\n */\nconst flowIconRegistry: Record<string, FC<FlowIconProps>> = {\n ArrowLeftRight,\n ArrowRightLeft,\n};\n\nexport default flowIconRegistry;\n","/**\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 {css} from '@emotion/css';\nimport {\n FieldType,\n FlowMetadataResponse,\n OrganizationUnitListResponse,\n EmbeddedFlowComponentV2 as EmbeddedFlowComponent,\n EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType,\n EmbeddedFlowTextVariantV2 as EmbeddedFlowTextVariant,\n EmbeddedFlowEventTypeV2 as EmbeddedFlowEventType,\n createPackageComponentLogger,\n resolveFlowTemplateLiterals,\n resolveEmojiUrisInHtml,\n ConsentPurposeDataV2 as ConsentPurposeData,\n ConsentPromptDataV2 as ConsentPromptData,\n ConsentDecisionsV2 as ConsentDecisions,\n ConsentPurposeDecisionV2 as ConsentPurposeDecision,\n ConsentAttributeElementV2 as ConsentAttributeElement,\n} from '@thunderid/browser';\nimport DOMPurify from 'dompurify';\nimport {cloneElement, CSSProperties, ReactElement} from 'react';\nimport {OrganizationUnitPicker} from './OrganizationUnitPicker';\nimport {\n ComponentRenderer,\n ComponentRenderContext,\n ComponentRendererMap,\n} from '../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport {UseTranslation} from '../../../hooks/useTranslation';\nimport Consent from '../../adapters/Consent';\nimport {getConsentOptionalKey} from '../../adapters/ConsentCheckboxList';\nimport FacebookButton from '../../adapters/FacebookButton';\nimport FlowTimer from '../../adapters/FlowTimer';\nimport GitHubButton from '../../adapters/GitHubButton';\nimport GoogleButton from '../../adapters/GoogleButton';\nimport ImageComponent from '../../adapters/ImageComponent';\nimport LinkedInButton from '../../adapters/LinkedInButton';\nimport MicrosoftButton from '../../adapters/MicrosoftButton';\nimport SignInWithEthereumButton from '../../adapters/SignInWithEthereumButton';\nimport SmsOtpButton from '../../adapters/SmsOtpButton';\nimport {createField} from '../../factories/FieldFactory';\nimport Button from '../../primitives/Button/Button';\nimport CopyableText from '../../primitives/CopyableText/CopyableText';\nimport Divider from '../../primitives/Divider/Divider';\nimport flowIconRegistry from '../../primitives/Icons/flowIconRegistry';\nimport Select from '../../primitives/Select/Select';\nimport Typography from '../../primitives/Typography/Typography';\nimport {TypographyVariant} from '../../primitives/Typography/Typography.styles';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'AuthOptionFactory',\n);\n\n/**\n * Replaces `emoji:` URIs embedded in HTML before DOMPurify sanitization.\n *\n * DOMPurify strips unknown URI schemes from attributes (e.g. `src=\"emoji:🦊\"` → `src=\"\"`).\n * This function converts:\n * - `<img src=\"emoji:X\" alt=\"Y\">` → `<span role=\"img\" aria-label=\"Y\">X</span>`\n * - Any remaining `emoji:X` text occurrences → `X`\n */\n\n/** Ensures rich-text content (including all inner elements from the server) always word-wraps. */\nconst richTextClass: string = css`\n overflow-wrap: anywhere;\n & * {\n overflow-wrap: anywhere;\n word-break: break-word;\n }\n & .rich-text-align-left {\n text-align: left;\n }\n & .rich-text-align-center {\n text-align: center;\n }\n & .rich-text-align-right {\n text-align: right;\n }\n & .rich-text-align-justify {\n text-align: justify;\n }\n & a,\n & .rich-text-link {\n text-decoration: underline;\n }\n & span[role='img'] {\n display: inline-block;\n }\n`;\n\nexport type AuthType = 'signin' | 'signup' | 'recovery';\n\n/**\n * Get the appropriate FieldType for an input component.\n */\nconst getFieldType = (variant: EmbeddedFlowComponentType): FieldType => {\n switch (variant) {\n case EmbeddedFlowComponentType.EmailInput:\n return FieldType.Email;\n case EmbeddedFlowComponentType.PhoneInput:\n return FieldType.Tel;\n case EmbeddedFlowComponentType.PasswordInput:\n return FieldType.Password;\n case EmbeddedFlowComponentType.TextInput:\n default:\n return FieldType.Text;\n }\n};\n\n/**\n * Get typography variant from component variant.\n */\nconst getTypographyVariant = (variant: string): any => {\n const variantMap: Record<EmbeddedFlowTextVariant, TypographyVariant> = {\n BODY_1: 'body1',\n BODY_2: 'body2',\n BUTTON_TEXT: 'button',\n CAPTION: 'caption',\n HEADING_1: 'h1',\n HEADING_2: 'h2',\n HEADING_3: 'h3',\n HEADING_4: 'h4',\n HEADING_5: 'h5',\n HEADING_6: 'h6',\n OVERLINE: 'overline',\n SUBTITLE_1: 'subtitle1',\n SUBTITLE_2: 'subtitle2',\n };\n\n return variantMap[variant] || 'h3';\n};\n\n/**\n * Check if a button text or action matches a social provider.\n */\nconst matchesSocialProvider = (\n actionId: string,\n eventType: string,\n buttonText: string,\n provider: string,\n authType: AuthType,\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\n _componentVariant?: string,\n): boolean => {\n const providerId: any = `${provider}_auth`;\n const providerMatches: any = actionId === providerId || eventType === providerId;\n\n // Social buttons usually have \"Sign in with X\" or \"Continue with X\" text,\n // so also check button text for the provider name to increase chances of correct detection (especially for signup flows where action IDs are less standardized)\n if (buttonText.toLowerCase().includes(provider)) {\n return true;\n }\n\n // For signup, also check button text\n if (authType === 'signup') {\n return providerMatches || buttonText.toLowerCase().includes(provider);\n }\n\n return providerMatches;\n};\n\n/**\n * Create an auth component from flow component configuration.\n */\nconst createAuthComponentFromFlow = (\n component: EmbeddedFlowComponent,\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n authType: AuthType,\n options: {\n /** @internal Passed from the host React component so hooks aren't called inside a loop. */\n _customRenderers?: ComponentRendererMap;\n /** @internal Passed from the host React component so hooks aren't called inside a loop. */\n _theme?: any;\n /** Additional data from the flow response, used for different dynamic data */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n /** Current consent purpose being rendered. Set by CONSENT_PURPOSE block iteration. */\n currentConsentPurpose?: ConsentPurposeData;\n /** Function to fetch child organization units. Used by OU_SELECT component type. */\n fetchOrganizationUnitChildren?: (\n parentId: string,\n limit: number,\n offset: number,\n ) => Promise<OrganizationUnitListResponse>;\n inStack?: boolean;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n key?: string | number;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n } = {},\n): ReactElement | null => {\n const theme: any = options._theme;\n const customRenderers: ComponentRendererMap = options._customRenderers ?? {};\n\n const key: string | number = options.key || component.id;\n\n const customRenderer: ComponentRenderer | undefined =\n customRenderers[component.id] ?? customRenderers[component.type];\n if (customRenderer) {\n const renderCtx: ComponentRenderContext = {\n additionalData: options.additionalData,\n authType,\n formErrors,\n formValues,\n isFormValid,\n isLoading,\n meta: options.meta,\n onInputBlur: options.onInputBlur,\n onInputChange,\n onSubmit: options.onSubmit,\n touchedFields,\n };\n return customRenderer(component, renderCtx);\n }\n\n /** Resolve any remaining {{t()}} or {{meta()}} template expressions in a string at render time. */\n const resolve = (text: string | undefined): string => {\n if (!text || (!options.t && !options.meta)) {\n return text || '';\n }\n return resolveFlowTemplateLiterals(text, {meta: options.meta, t: options.t || ((k: string): string => k)});\n };\n\n switch (component.type) {\n case EmbeddedFlowComponentType.TextInput:\n case EmbeddedFlowComponentType.PasswordInput:\n case EmbeddedFlowComponentType.EmailInput:\n case EmbeddedFlowComponentType.PhoneInput: {\n const identifier: string = component.ref;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined;\n const fieldType: string = getFieldType(component.type);\n\n const field: any = createField({\n className: options.inputClassName,\n error,\n label: resolve(component.label) || '',\n name: identifier,\n onBlur: () => options.onInputBlur?.(identifier),\n onChange: (newValue: string) => onInputChange(identifier, newValue),\n placeholder: resolve(component.placeholder) || '',\n required: component.required || false,\n type: fieldType as FieldType,\n value,\n });\n\n return cloneElement(field, {key});\n }\n\n case EmbeddedFlowComponentType.OtpInput: {\n const identifier: string = component.ref;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined;\n\n const field: any = createField({\n className: options.inputClassName,\n error,\n label: resolve(component.label) || '',\n name: identifier,\n onBlur: () => options.onInputBlur?.(identifier),\n onChange: (newValue: string) => onInputChange(identifier, newValue),\n placeholder: resolve(component.placeholder) || '',\n required: component.required || false,\n type: FieldType.Otp,\n value,\n });\n\n return cloneElement(field, {key});\n }\n\n case EmbeddedFlowComponentType.Action: {\n const actionId: string = component.id;\n const eventType: string = component.eventType || '';\n const buttonText: string = resolve(component.label);\n const componentVariant: string = component.variant || '';\n\n // Only validate on submit type events.\n const shouldSkipValidation: boolean = eventType.toUpperCase() === EmbeddedFlowEventType.Trigger;\n\n const handleClick = (): any => {\n if (options.onSubmit) {\n const formData: Record<string, any> = {};\n Object.keys(formValues).forEach((field: any) => {\n // Include all values, even empty strings, to ensure proper submission\n formData[field] = formValues[field];\n });\n\n // For consent actions, build the consent_decisions JSON from the form values.\n // The allow action captures per-attribute choices; the deny action sends\n // all purposes as rejected so the backend ConsentExecutor can fail the flow.\n const consentPrompt: ConsentPromptData | undefined = options.additionalData?.['consentPrompt'] as\n | ConsentPromptData\n | undefined;\n if (consentPrompt && eventType.toUpperCase() === EmbeddedFlowEventType.Submit) {\n const isDeny: boolean = componentVariant.toLowerCase() !== 'primary';\n const decisions: ConsentDecisions = {\n purposes: consentPrompt.purposes.map(\n (p: ConsentPurposeData): ConsentPurposeDecision => ({\n approved: !isDeny,\n elements: [\n ...p.essential.map((e): ConsentAttributeElement => ({approved: !isDeny, name: e.name})),\n ...p.optional.map(\n (e): ConsentAttributeElement => ({\n approved: isDeny ? false : formValues[getConsentOptionalKey(p.purposeId, e.name)] !== 'false',\n name: e.name,\n }),\n ),\n ],\n purposeName: p.purposeName,\n }),\n ),\n };\n formData['consent_decisions'] = JSON.stringify(decisions);\n }\n\n options.onSubmit(component, formData, shouldSkipValidation);\n }\n };\n\n // Render branded social login buttons for known action IDs\n\n if (matchesSocialProvider(actionId, eventType, buttonText, 'google', authType, componentVariant)) {\n return <GoogleButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'github', authType, componentVariant)) {\n return <GitHubButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'facebook', authType, componentVariant)) {\n return <FacebookButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'microsoft', authType, componentVariant)) {\n return <MicrosoftButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'linkedin', authType, componentVariant)) {\n return <LinkedInButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'ethereum', authType, componentVariant)) {\n return <SignInWithEthereumButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (actionId === 'prompt_mobile' || eventType === 'prompt_mobile') {\n return <SmsOtpButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n\n const startIconEl: ReactElement | null = component.startIcon ? (\n <img\n src={component.startIcon}\n alt=\"\"\n aria-hidden=\"true\"\n style={{height: '1.25em', objectFit: 'contain', width: '1.25em'}}\n />\n ) : null;\n\n const endIconEl: ReactElement | null = component.endIcon ? (\n <img\n src={component.endIcon}\n alt=\"\"\n aria-hidden=\"true\"\n style={{height: '1.25em', objectFit: 'contain', width: '1.25em'}}\n />\n ) : null;\n\n return (\n <Button\n fullWidth\n key={key}\n onClick={handleClick}\n disabled={\n isLoading ||\n (!isFormValid && !shouldSkipValidation) ||\n options.isTimeoutDisabled ||\n (component as any).config?.disabled\n }\n className={options.buttonClassName}\n data-testid=\"thunderid-signin-submit\"\n variant={component.variant?.toLowerCase() === 'primary' ? 'solid' : 'outline'}\n color={component.variant?.toLowerCase() === 'primary' ? 'primary' : 'secondary'}\n startIcon={startIconEl}\n endIcon={endIconEl}\n >\n {buttonText || 'Submit'}\n </Button>\n );\n }\n\n case EmbeddedFlowComponentType.Text: {\n const variant: any = getTypographyVariant(component.variant);\n return (\n <Typography\n key={key}\n variant={variant}\n style={{\n marginBottom: 2,\n textAlign:\n typeof component?.align === 'string' ? (component.align as React.CSSProperties['textAlign']) : 'left',\n }}\n >\n {resolve(component.label)}\n </Typography>\n );\n }\n\n case EmbeddedFlowComponentType.Divider: {\n return <Divider key={key}>{resolve(component.label) || ''}</Divider>;\n }\n\n case EmbeddedFlowComponentType.Select: {\n const identifier: string = component.ref;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined;\n\n // Options are pre-sanitized by flowTransformer to {value: string, label: string} format\n const selectOptions: any = (component.options || []).map((opt: any) => ({\n label: typeof opt === 'string' ? opt : String(opt.label ?? opt.value ?? ''),\n value: typeof opt === 'string' ? opt : String(opt.value ?? ''),\n }));\n\n return (\n <Select\n key={key}\n name={identifier}\n label={resolve(component.label) || ''}\n placeholder={resolve(component.placeholder)}\n required={component.required}\n options={selectOptions}\n value={value}\n error={error}\n onChange={(e: any): void => onInputChange(identifier, e.target.value)}\n onBlur={(): any => options.onInputBlur?.(identifier)}\n className={options.inputClassName}\n />\n );\n }\n\n case EmbeddedFlowComponentType.OuSelect: {\n const identifier: string = component.ref ?? component.id;\n const rootOuId: string | undefined = options.additionalData?.['rootOuId'] as string | undefined;\n\n if (!rootOuId || !options.fetchOrganizationUnitChildren) {\n logger.warn('OU_SELECT requires additionalData.rootOuId and fetchOrganizationUnitChildren. Skipping render.');\n return null;\n }\n\n return (\n <OrganizationUnitPicker\n key={key}\n rootOuId={rootOuId}\n selectedOuId={formValues[identifier] || null}\n onSelect={(ouId: string) => onInputChange(identifier, ouId)}\n fetchChildren={options.fetchOrganizationUnitChildren}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Block: {\n if (component.components && component.components.length > 0) {\n const formStyles: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n gap: `calc(${theme?.vars?.spacing?.unit ?? '4px'} * 2)`,\n };\n\n const blockComponents: any = component.components\n .map((childComponent: any, index: any) =>\n createAuthComponentFromFlow(\n childComponent,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n authType,\n {\n ...options,\n key: childComponent.id || `${component.id}_${index}`,\n },\n ),\n )\n .filter(Boolean);\n\n return (\n <form id={component.id} key={key} style={formStyles}>\n {blockComponents}\n </form>\n );\n }\n return null;\n }\n\n case EmbeddedFlowComponentType.RichText: {\n return (\n <div\n key={key}\n className={richTextClass}\n // Manually sanitizes with `DOMPurify`.\n // IMPORTANT: DO NOT REMOVE OR MODIFY THIS SANITIZATION STEP.\n dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(resolveEmojiUrisInHtml(resolve(component.label)))}}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Image: {\n const explicitHeight: string = resolve(component.height?.toString());\n const explicitWidth: string = resolve(component.width?.toString());\n return (\n <ImageComponent\n key={key}\n component={\n {\n config: {\n alt: resolve(component.alt) || resolve(component.label) || 'Image',\n height: explicitHeight || (options.inStack ? '50' : 'auto'),\n src: resolve(component.src),\n width: explicitWidth || (options.inStack ? '50' : '100%'),\n },\n } as any\n }\n formErrors={undefined}\n formValues={undefined}\n isFormValid={false}\n isLoading={false}\n onInputChange={(): void => {\n throw new Error('Function not implemented.');\n }}\n touchedFields={undefined}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Icon: {\n const iconName: string = component.name || '';\n const IconComponent: any = flowIconRegistry[iconName];\n if (!IconComponent) {\n logger.warn(`Unknown icon name: \"${iconName}\". Skipping render.`);\n return null;\n }\n return <IconComponent key={key} size={component.size || 24} color={component.color || 'currentColor'} />;\n }\n\n case EmbeddedFlowComponentType.Stack: {\n const direction: string = (component as any).direction || 'row';\n const gap: number = (component as any).gap ?? 2;\n const align: string = (component as any).align || 'center';\n const justify: string = (component as any).justify || 'flex-start';\n\n const stackStyle: CSSProperties = {\n alignItems: align,\n display: 'flex',\n flexDirection: direction as CSSProperties['flexDirection'],\n flexWrap: 'wrap',\n gap: `${gap * 0.5}rem`,\n justifyContent: justify,\n };\n\n const stackChildren: (ReactElement | null)[] = component.components\n ? component.components.map((childComponent: any, index: number) =>\n createAuthComponentFromFlow(\n childComponent,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n authType,\n {\n ...options,\n inStack: true,\n key: childComponent.id || `${component.id}_${index}`,\n },\n ),\n )\n : [];\n\n return (\n <div key={key} style={stackStyle}>\n {stackChildren}\n </div>\n );\n }\n\n case EmbeddedFlowComponentType.Consent: {\n const consentPromptRawData: ConsentPromptData | string | undefined = options.additionalData?.['consentPrompt'];\n\n return (\n <Consent\n key={key}\n consentData={consentPromptRawData as any}\n formValues={formValues}\n onInputChange={onInputChange}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Timer: {\n const textTemplate: string = resolve((component as any).label) || 'Time remaining: {time}';\n const timeoutMs: number = Number(options.additionalData?.['stepTimeout']) || 0;\n const expiresIn: number = timeoutMs > 0 ? Math.max(0, Math.floor((timeoutMs - Date.now()) / 1000)) : 0;\n\n return <FlowTimer key={key} expiresIn={expiresIn} textTemplate={textTemplate} />;\n }\n\n case EmbeddedFlowComponentType.CopyableText: {\n const sourceKey: string | undefined = (component as any).source;\n const value: string = sourceKey && options.additionalData ? String(options.additionalData[sourceKey] ?? '') : '';\n const labelText: string | undefined = resolve((component as any).label) || undefined;\n\n return <CopyableText key={key} label={labelText} value={value} />;\n }\n\n default:\n // Gracefully handle unsupported component types by returning null\n logger.warn(`Unsupported component type: ${component.type}. Skipping render.`);\n return null;\n }\n};\n\n/**\n * Processes an array of components and renders them as React elements for sign-in.\n */\nexport const renderSignInComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n 'signin',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter(Boolean);\n\n/**\n * Processes an array of components and renders them as React elements for sign-up.\n */\nexport const renderSignUpComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n 'signup',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter(Boolean);\n\n/**\n * Processes an array of components and renders them as React elements for recovery flow.\n */\nexport const renderRecoveryComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n 'recovery',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter(Boolean);\n\n/**\n * Processes an array of components and renders them as React elements for invite user.\n * This is used by both InviteUser and AcceptInvite components.\n */\nexport const renderInviteUserComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n /** Function to fetch child organization units. Used by OU_SELECT component type. */\n fetchOrganizationUnitChildren?: (\n parentId: string,\n limit: number,\n offset: number,\n ) => Promise<OrganizationUnitListResponse>;\n inputClassName?: string;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n 'signup',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter(Boolean);\n","/**\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 {cx} from '@emotion/css';\nimport {\n withVendorCSSClassPrefix,\n EmbeddedSignInFlowRequestV2 as EmbeddedSignInFlowRequest,\n EmbeddedFlowComponentV2 as EmbeddedFlowComponent,\n FlowMetadataResponse,\n Preferences,\n} from '@thunderid/browser';\nimport {FC, useState, useCallback, useContext, ReactElement, ReactNode} from 'react';\nimport ComponentRendererContext, {\n ComponentRendererMap,\n} from '../../../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport FlowProvider from '../../../../../contexts/Flow/FlowProvider';\nimport useFlow from '../../../../../contexts/Flow/useFlow';\nimport ComponentPreferencesContext from '../../../../../contexts/I18n/ComponentPreferencesContext';\nimport useTheme from '../../../../../contexts/Theme/useTheme';\nimport useThunderID from '../../../../../contexts/ThunderID/useThunderID';\nimport {FormField, useForm} from '../../../../../hooks/useForm';\nimport useTranslation from '../../../../../hooks/useTranslation';\nimport {extractErrorMessage} from '../../../../../utils/v2/flowTransformer';\nimport AlertPrimitive from '../../../../primitives/Alert/Alert';\n// eslint-disable-next-line import/no-named-as-default\nimport CardPrimitive, {CardProps} from '../../../../primitives/Card/Card';\nimport Spinner from '../../../../primitives/Spinner/Spinner';\nimport Typography from '../../../../primitives/Typography/Typography';\nimport {renderSignInComponents} from '../../AuthOptionFactory';\nimport useStyles from '../BaseSignIn.styles';\n\n/**\n * Render props for custom UI rendering\n */\nexport interface BaseSignInRenderProps {\n /**\n * Flow components\n */\n components: EmbeddedFlowComponent[];\n\n /**\n * API error (if any)\n */\n error?: Error | null;\n\n /**\n * Field validation errors\n */\n fieldErrors: Record<string, string>;\n\n /**\n * Function to handle input changes\n */\n handleInputChange: (name: string, value: string) => void;\n\n /**\n * Function to handle form submission\n */\n handleSubmit: (component: EmbeddedFlowComponent, data?: Record<string, any>) => Promise<void>;\n\n /**\n * Loading state\n */\n isLoading: boolean;\n\n /**\n * Flag indicating if the step timer has reached zero\n */\n isTimeoutDisabled?: boolean;\n\n /**\n * Whether the form is valid\n */\n isValid: boolean;\n\n /**\n * Flow messages\n */\n messages: {message: string; type: string}[];\n\n /**\n * Flow metadata returned by the platform (v2 only). `null` while loading or unavailable.\n */\n meta: FlowMetadataResponse | null;\n\n /**\n * Flow subtitle\n */\n subtitle: string;\n\n /**\n * Flow title\n */\n title: string;\n\n /**\n * Touched fields\n */\n touched: Record<string, boolean>;\n\n /**\n * Function to validate the form\n */\n validateForm: () => {fieldErrors: Record<string, string>; isValid: boolean};\n\n /**\n * Form values\n */\n values: Record<string, string>;\n}\n\n/**\n * Props for the BaseSignIn component.\n */\nexport interface BaseSignInProps {\n /**\n * Additional data from the flow response.\n */\n additionalData?: Record<string, any>;\n\n /**\n * Custom CSS class name for the submit button.\n */\n buttonClassName?: string;\n\n /**\n * Render props function for custom UI\n */\n children?: (props: BaseSignInRenderProps) => ReactNode;\n\n /**\n * Custom CSS class name for the form container.\n */\n className?: string;\n\n /**\n * Array of flow components to render.\n */\n components?: EmbeddedFlowComponent[];\n\n /**\n * Error object to display\n */\n error?: Error | null;\n\n /**\n * Custom CSS class name for error messages.\n */\n errorClassName?: string;\n\n /**\n * Custom CSS class name for form inputs.\n */\n inputClassName?: string;\n\n /**\n * Flag to determine if the component is ready to be rendered.\n */\n isLoading?: boolean;\n\n /**\n * Timer flag disabling actions\n */\n isTimeoutDisabled?: boolean;\n\n /**\n * Custom CSS class name for info messages.\n */\n messageClassName?: string;\n\n /**\n * Callback function called when authentication fails.\n * @param error - The error that occurred during authentication.\n */\n onError?: (error: Error) => void;\n\n /**\n * Function to handle form submission.\n * @param payload - The form data to submit.\n * @param component - The component that triggered the submission.\n */\n onSubmit?: (payload: EmbeddedSignInFlowRequest, component: EmbeddedFlowComponent) => Promise<void>;\n\n /**\n * Callback function called when authentication is successful.\n * @param authData - The authentication data returned upon successful completion.\n */\n onSuccess?: (authData: Record<string, any>) => void;\n\n /**\n * Component-level preferences to override global i18n and theme settings.\n * Preferences are deep-merged with global ones, with component preferences\n * taking precedence. Affects this component and all its descendants.\n */\n preferences?: Preferences;\n\n /**\n * Size variant for the component.\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Theme variant for the component.\n */\n variant?: CardProps['variant'];\n}\n\n/**\n * Internal component that consumes FlowContext and renders the sign-in UI.\n */\nconst BaseSignInContent: FC<BaseSignInProps> = ({\n components = [],\n onSubmit,\n onError,\n error: externalError,\n className = '',\n inputClassName = '',\n buttonClassName = '',\n messageClassName = '',\n size = 'medium',\n variant = 'outlined',\n isLoading: externalIsLoading,\n children,\n additionalData = {},\n isTimeoutDisabled = false,\n}: BaseSignInProps): ReactElement => {\n const {meta} = useThunderID();\n const {theme} = useTheme();\n const customRenderers: ComponentRendererMap = useContext(ComponentRendererContext);\n const {t} = useTranslation();\n const {subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages} = useFlow();\n const styles: any = useStyles(theme, theme.vars.colors.text.primary);\n\n const [isSubmitting, setIsSubmitting] = useState(false);\n const [apiError, setApiError] = useState<Error | null>(null);\n\n const isLoading: boolean = externalIsLoading || isSubmitting;\n\n /**\n * Handle error responses and extract meaningful error messages\n * Uses the transformer's extractErrorMessage function for consistency\n */\n const handleError: any = useCallback(\n (error: any) => {\n // Extract error message from response failureReason or use extractErrorMessage\n const errorMessage: string = error?.failureReason || extractErrorMessage(error, t);\n\n // Set the API error state\n setApiError(error instanceof Error ? error : new Error(errorMessage));\n\n // Clear existing messages and add the error message\n clearMessages();\n addMessage({\n message: errorMessage,\n type: 'error',\n });\n },\n [t, addMessage, clearMessages],\n );\n\n /**\n * Extract form fields from flow components\n */\n const extractFormFields: (components: EmbeddedFlowComponent[]) => FormField[] = useCallback(\n (flowComponents: EmbeddedFlowComponent[]): FormField[] => {\n const fields: FormField[] = [];\n\n const processComponents = (comps: EmbeddedFlowComponent[]): any => {\n comps.forEach((component: any) => {\n if (\n component.type === 'TEXT_INPUT' ||\n component.type === 'PASSWORD_INPUT' ||\n component.type === 'EMAIL_INPUT' ||\n component.type === 'PHONE_INPUT' ||\n component.type === 'OTP_INPUT'\n ) {\n const identifier: string = component.ref;\n fields.push({\n initialValue: '',\n name: identifier,\n required: component.required || false,\n validator: (value: string) => {\n if (component.required && (!value || value.trim() === '')) {\n return t('validations.required.field.error');\n }\n // Add email validation if it's an email field\n if (\n (component.type === 'EMAIL_INPUT' || component.variant === 'EMAIL') &&\n value &&\n !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)\n ) {\n return t('field.email.invalid');\n }\n\n return null;\n },\n });\n }\n if (component.components) {\n processComponents(component.components);\n }\n });\n };\n\n processComponents(flowComponents);\n return fields;\n },\n [t],\n );\n\n const formFields: FormField[] = components ? extractFormFields(components) : [];\n\n const form: ReturnType<typeof useForm> = useForm<Record<string, string>>({\n fields: formFields,\n initialValues: {},\n requiredMessage: t('validations.required.field.error'),\n validateOnBlur: true,\n validateOnChange: false,\n });\n\n const {\n values: formValues,\n touched: touchedFields,\n errors: formErrors,\n isValid: isFormValid,\n setValue: setFormValue,\n setTouched: setFormTouched,\n validateForm,\n touchAllFields,\n } = form;\n\n /**\n * Handle input value changes.\n * Only updates the value without marking as touched.\n * Touched state is set on blur to avoid premature validation.\n */\n const handleInputChange = (name: string, value: string): void => {\n setFormValue(name, value);\n };\n\n /**\n * Handle input blur event.\n * Marks the field as touched, which triggers validation.\n */\n const handleInputBlur = (name: string): void => {\n setFormTouched(name, true);\n };\n\n /**\n * Handle component submission (for buttons and actions).\n */\n const handleSubmit = async (\n component: EmbeddedFlowComponent,\n data?: Record<string, any>,\n skipValidation?: boolean,\n ): Promise<void> => {\n // Only validate for form submit actions, skip for social/trigger actions\n if (!skipValidation) {\n // Mark all fields as touched before validation\n touchAllFields();\n\n const validation: ReturnType<typeof validateForm> = validateForm();\n\n if (!validation.isValid) {\n return;\n }\n }\n\n setIsSubmitting(true);\n setApiError(null);\n clearMessages();\n\n try {\n // Filter out empty or undefined input values\n const filteredInputs: Record<string, any> = {};\n if (data) {\n Object.keys(data).forEach((key: any) => {\n if (data[key] !== undefined && data[key] !== null && data[key] !== '') {\n filteredInputs[key] = data[key];\n }\n });\n }\n\n let payload: EmbeddedSignInFlowRequest = {};\n\n // For V2, we always send inputs and action\n payload = {\n ...payload,\n ...(component.id && {action: component.id}),\n inputs: filteredInputs,\n };\n\n await onSubmit?.(payload, component);\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n } finally {\n setIsSubmitting(false);\n }\n };\n\n // Generate CSS classes\n const containerClasses: any = cx(\n [\n withVendorCSSClassPrefix('signin'),\n withVendorCSSClassPrefix(`signin--${size}`),\n withVendorCSSClassPrefix(`signin--${variant}`),\n ],\n className,\n );\n\n const inputClasses: any = cx(\n [\n withVendorCSSClassPrefix('signin__input'),\n size === 'small' && withVendorCSSClassPrefix('signin__input--small'),\n size === 'large' && withVendorCSSClassPrefix('signin__input--large'),\n ],\n inputClassName,\n );\n\n const buttonClasses: any = cx(\n [\n withVendorCSSClassPrefix('signin__button'),\n size === 'small' && withVendorCSSClassPrefix('signin__button--small'),\n size === 'large' && withVendorCSSClassPrefix('signin__button--large'),\n ],\n buttonClassName,\n );\n\n const messageClasses: any = cx([withVendorCSSClassPrefix('signin__messages')], messageClassName);\n\n /**\n * Render components based on flow data using the factory\n */\n const renderComponents: any = useCallback(\n (flowComponents: EmbeddedFlowComponent[]): ReactElement[] =>\n renderSignInComponents(\n flowComponents,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n handleInputChange,\n {\n _customRenderers: customRenderers,\n _theme: theme,\n additionalData,\n buttonClassName: buttonClasses,\n inputClassName: inputClasses,\n isTimeoutDisabled,\n meta,\n onInputBlur: handleInputBlur,\n onSubmit: handleSubmit,\n size,\n t,\n variant,\n },\n ),\n [\n additionalData,\n customRenderers,\n formValues,\n touchedFields,\n formErrors,\n isFormValid,\n meta,\n t,\n theme,\n isLoading,\n size,\n variant,\n inputClasses,\n buttonClasses,\n handleInputBlur,\n handleSubmit,\n isTimeoutDisabled,\n ],\n );\n\n // If render props are provided, use them\n if (children) {\n const renderProps: BaseSignInRenderProps = {\n components,\n error: apiError,\n fieldErrors: formErrors,\n handleInputChange,\n handleSubmit,\n isLoading,\n isTimeoutDisabled,\n isValid: isFormValid,\n messages: flowMessages || [],\n meta,\n subtitle: flowSubtitle,\n title: flowTitle || t('signin.heading'),\n touched: touchedFields,\n validateForm: () => {\n const result: any = validateForm();\n return {fieldErrors: result.errors, isValid: result.isValid};\n },\n values: formValues,\n };\n\n return (\n <div className={containerClasses} data-testid=\"thunderid-signin\">\n {children(renderProps)}\n </div>\n );\n }\n\n // Default UI rendering\n if (isLoading) {\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} data-testid=\"thunderid-signin\" variant={variant}>\n <CardPrimitive.Content>\n <div style={{display: 'flex', justifyContent: 'center', padding: '2rem'}}>\n <Spinner />\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n if (!components || components.length === 0) {\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} data-testid=\"thunderid-signin\" variant={variant}>\n <CardPrimitive.Content>\n <AlertPrimitive variant=\"warning\">\n <Typography variant=\"body1\">{t('errors.signin.components.not.available')}</Typography>\n </AlertPrimitive>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} data-testid=\"thunderid-signin\" variant={variant}>\n <CardPrimitive.Content>\n {externalError && (\n <div className={styles.flowMessagesContainer}>\n <AlertPrimitive variant=\"error\" className={cx(styles.flowMessageItem, messageClasses)}>\n <AlertPrimitive.Description>{externalError.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n </div>\n )}\n {flowMessages && flowMessages.length > 0 && (\n <div className={styles.flowMessagesContainer}>\n {flowMessages.map((message: any, index: any) => (\n <AlertPrimitive\n key={index}\n variant={message.type === 'error' ? 'error' : 'info'}\n className={cx(styles.flowMessageItem, messageClasses)}\n >\n <AlertPrimitive.Description>{message.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n ))}\n </div>\n )}\n <div className={styles.contentContainer}>{renderComponents(components)}</div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n};\n\n/**\n * Base SignIn component that provides generic authentication flow.\n * This component handles component-driven UI rendering and can transform input\n * structure to component-driven format automatically.\n *\n * @example\n * // Default UI\n * ```tsx\n * import { BaseSignIn } from '@thunderid/react';\n *\n * const MySignIn = () => {\n * return (\n * <BaseSignIn\n * components={components}\n * onSubmit={async (payload) => {\n * return await handleAuth(payload);\n * }}\n * onSuccess={(authData) => {\n * console.log('Success:', authData);\n * }}\n * className=\"max-w-md mx-auto\"\n * />\n * );\n * };\n * ```\n *\n * @example\n * // Custom UI with render props\n * ```tsx\n * <BaseSignIn components={components} onSubmit={handleSubmit}>\n * {({values, errors, handleInputChange, handleSubmit, isLoading, components}) => (\n * <div className=\"custom-form\">\n * <input\n * name=\"username\"\n * value={values.username || ''}\n * onChange={(e) => handleInputChange('username', e.target.value)}\n * />\n * {errors.username && <span>{errors.username}</span>}\n * <button\n * onClick={() => handleSubmit(components[0], values)}\n * disabled={isLoading}\n * >\n * Sign In\n * </button>\n * </div>\n * )}\n * </BaseSignIn>\n * ```\n */\nconst BaseSignIn: FC<BaseSignInProps> = ({preferences, ...rest}: BaseSignInProps): ReactElement => {\n const content: ReactElement = (\n <FlowProvider>\n <BaseSignInContent {...rest} />\n </FlowProvider>\n );\n\n if (!preferences) return content;\n\n return <ComponentPreferencesContext.Provider value={preferences}>{content}</ComponentPreferencesContext.Provider>;\n};\n\nexport default BaseSignIn;\n","/**\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 {Platform} from '@thunderid/browser';\nimport {FC} from 'react';\nimport BaseSignInV1, {BaseSignInProps as BaseSignInV1Props} from './v1/BaseSignIn';\nimport BaseSignInV2, {BaseSignInProps as BaseSignInV2Props} from './v2/BaseSignIn';\nimport useThunderID from '../../../../contexts/ThunderID/useThunderID';\n\n/**\n * Props for the BaseSignIn component.\n * Extends BaseSignInV1Props & BaseSignInV2Props for full compatibility with both React BaseSignIn components.\n */\nexport type BaseSignInProps = BaseSignInV1Props | BaseSignInV2Props;\n\nconst BaseSignIn: FC<BaseSignInProps> = (props: BaseSignInProps) => {\n const {platform} = useThunderID();\n\n if (platform === Platform.ThunderID) {\n return <BaseSignInV2 {...(props as BaseSignInV2Props)} />;\n }\n\n return <BaseSignInV1 {...(props as BaseSignInV1Props)} />;\n};\n\nexport default BaseSignIn;\n","/**\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","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {navigate} from '@thunderid/browser';\n\n/**\n * Initiates OAuth redirect with CSRF protection.\n * Generates random state, stores return path in sessionStorage, and redirects to OAuth provider.\n *\n * @param redirectURL - OAuth authorization URL from the server\n */\nexport function initiateOAuthRedirect(redirectURL: string): void {\n const basePath: string = document.querySelector('base')?.getAttribute('href') || '';\n let returnPath: string = window.location.pathname;\n\n if (basePath && returnPath.startsWith(basePath)) {\n returnPath = returnPath.slice(basePath.length) || '/';\n }\n\n const state: string = crypto.randomUUID();\n\n sessionStorage.setItem(\n `thunderid_oauth_${state}`,\n JSON.stringify({\n path: returnPath,\n timestamp: Date.now(),\n }),\n );\n\n const redirectUrlObj: URL = new URL(redirectURL);\n redirectUrlObj.searchParams.set('state', state);\n\n navigate(redirectUrlObj.toString());\n}\n","/**\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 {ThunderIDRuntimeError, arrayBufferToBase64url, base64urlToArrayBuffer} from '@thunderid/browser';\n\n/**\n * Handles WebAuthn/Passkey registration flow for browser environments.\n *\n * @param challengeData - JSON stringified challenge data containing WebAuthn creation options.\n * @returns Promise that resolves to a JSON string containing the WebAuthn registration response.\n */\nexport const handlePasskeyRegistration = async (challengeData: string): Promise<string> => {\n if (!window.navigator.credentials?.create) {\n throw new ThunderIDRuntimeError(\n 'WebAuthn is not supported in this browser.',\n 'browser-webauthn-not-supported',\n 'browser',\n 'WebAuthn/Passkey registration requires a browser that supports the Web Authentication API.',\n );\n }\n\n try {\n const creationOptions: any = JSON.parse(challengeData);\n\n // Decode challenge and user ID from base64url to BufferSource\n const publicKey: any = {\n ...creationOptions,\n challenge: base64urlToArrayBuffer(creationOptions.challenge),\n user: {\n ...creationOptions.user,\n id: base64urlToArrayBuffer(creationOptions.user.id),\n },\n ...(creationOptions.excludeCredentials && {\n excludeCredentials: creationOptions.excludeCredentials.map((cred: any) => ({\n ...cred,\n id: base64urlToArrayBuffer(cred.id),\n })),\n }),\n };\n\n const credential: PublicKeyCredential = (await navigator.credentials.create({\n publicKey,\n })) as PublicKeyCredential;\n\n if (!credential) {\n throw new ThunderIDRuntimeError(\n 'No credential returned from WebAuthn registration.',\n 'browser-webauthn-no-credential',\n 'browser',\n 'The WebAuthn registration ceremony completed but did not return a valid credential.',\n );\n }\n\n const response: AuthenticatorAttestationResponse = credential.response as AuthenticatorAttestationResponse;\n\n // Encode response fields back to base64url\n const registrationResponse: any = {\n id: credential.id,\n rawId: arrayBufferToBase64url(credential.rawId),\n response: {\n attestationObject: arrayBufferToBase64url(response.attestationObject),\n clientDataJSON: arrayBufferToBase64url(response.clientDataJSON),\n ...(response.getTransports && {\n transports: response.getTransports(),\n }),\n },\n type: credential.type,\n ...(credential.authenticatorAttachment && {\n authenticatorAttachment: credential.authenticatorAttachment,\n }),\n };\n\n return JSON.stringify(registrationResponse);\n } catch (error) {\n if (error instanceof ThunderIDRuntimeError) {\n throw error;\n }\n\n if (error instanceof Error) {\n // Map specific WebAuthn errors to ThunderIDRuntimeError/friendly messages as needed\n throw new ThunderIDRuntimeError(\n `Passkey registration failed: ${error.message}`,\n 'browser-webauthn-registration-error',\n 'browser',\n `WebAuthn registration failed with error: ${error.name}`,\n );\n }\n\n throw new ThunderIDRuntimeError(\n 'Passkey registration failed due to an unexpected error.',\n 'browser-webauthn-unexpected-error',\n 'browser',\n 'An unexpected error occurred during WebAuthn registration.',\n );\n }\n};\n\n/**\n * Handles WebAuthn/Passkey authentication flow for browser environments.\n *\n * @param challengeData - JSON stringified challenge data containing WebAuthn request options.\n * @returns Promise that resolves to a JSON string containing the WebAuthn authentication response.\n */\nexport const handlePasskeyAuthentication = async (challengeData: string): Promise<string> => {\n if (!window.navigator.credentials?.get) {\n throw new ThunderIDRuntimeError(\n 'WebAuthn is not supported in this browser.',\n 'browser-webauthn-not-supported',\n 'browser',\n 'WebAuthn/Passkey authentication requires a browser that supports the Web Authentication API.',\n );\n }\n\n try {\n const requestOptions: any = JSON.parse(challengeData);\n\n // Decode challenge and allowed credentials from base64url to BufferSource\n const publicKey: any = {\n ...requestOptions,\n challenge: base64urlToArrayBuffer(requestOptions.challenge),\n ...(requestOptions.allowCredentials && {\n allowCredentials: requestOptions.allowCredentials.map((cred: any) => ({\n ...cred,\n id: base64urlToArrayBuffer(cred.id),\n })),\n }),\n };\n\n const credential: PublicKeyCredential = (await navigator.credentials.get({\n publicKey,\n })) as PublicKeyCredential;\n\n if (!credential) {\n throw new ThunderIDRuntimeError(\n 'No credential returned from WebAuthn authentication.',\n 'browser-webauthn-no-credential',\n 'browser',\n 'The WebAuthn authentication ceremony completed but did not return a valid credential.',\n );\n }\n\n const response: AuthenticatorAssertionResponse = credential.response as AuthenticatorAssertionResponse;\n\n // Encode response fields back to base64url\n const authenticationResponse: any = {\n id: credential.id,\n rawId: arrayBufferToBase64url(credential.rawId),\n response: {\n authenticatorData: arrayBufferToBase64url(response.authenticatorData),\n clientDataJSON: arrayBufferToBase64url(response.clientDataJSON),\n signature: arrayBufferToBase64url(response.signature),\n ...(response.userHandle && {\n userHandle: arrayBufferToBase64url(response.userHandle),\n }),\n },\n type: credential.type,\n ...(credential.authenticatorAttachment && {\n authenticatorAttachment: credential.authenticatorAttachment,\n }),\n };\n\n return JSON.stringify(authenticationResponse);\n } catch (error) {\n if (error instanceof ThunderIDRuntimeError) {\n throw error;\n }\n\n if (error instanceof Error) {\n throw new ThunderIDRuntimeError(\n `Passkey authentication failed: ${error.message}`,\n 'browser-webauthn-authentication-error',\n 'browser',\n `WebAuthn authentication failed with error: ${error.name}`,\n );\n }\n\n throw new ThunderIDRuntimeError(\n 'Passkey authentication failed due to an unexpected error.',\n 'browser-webauthn-unexpected-error',\n 'browser',\n 'An unexpected error occurred during WebAuthn authentication.',\n );\n }\n};\n","/**\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 ThunderIDRuntimeError,\n EmbeddedFlowComponentV2 as EmbeddedFlowComponent,\n EmbeddedFlowType,\n EmbeddedSignInFlowResponseV2,\n EmbeddedSignInFlowRequestV2,\n EmbeddedSignInFlowStatusV2,\n EmbeddedSignInFlowTypeV2,\n FlowMetadataResponse,\n Preferences,\n logger,\n} from '@thunderid/browser';\nimport {FC, ReactElement, useState, useEffect, useRef, ReactNode} from 'react';\n// eslint-disable-next-line import/no-named-as-default\nimport BaseSignIn, {BaseSignInProps} from './BaseSignIn';\nimport useThunderID from '../../../../../contexts/ThunderID/useThunderID';\nimport useTranslation from '../../../../../hooks/useTranslation';\nimport {useOAuthCallback} from '../../../../../hooks/v2/useOAuthCallback';\nimport {initiateOAuthRedirect} from '../../../../../utils/oauth';\nimport {normalizeFlowResponse} from '../../../../../utils/v2/flowTransformer';\nimport {handlePasskeyAuthentication, handlePasskeyRegistration} from '../../../../../utils/v2/passkey';\n\n/**\n * Render props function parameters\n */\nexport interface SignInRenderProps {\n /**\n * Additional data from the flow response containing contextual information\n * like consent prompt details and session timeouts.\n */\n additionalData?: Record<string, any>;\n\n /**\n * Current flow components\n */\n components: EmbeddedFlowComponent[];\n\n /**\n * Current error if any\n */\n error: Error | null;\n\n /**\n * Function to manually initialize the flow\n */\n initialize: () => Promise<void>;\n\n /**\n * Whether the flow has been initialized\n */\n isInitialized: boolean;\n\n /**\n * Loading state indicator\n */\n isLoading: boolean;\n\n /**\n * Flag indicating whether the flow step timeout has expired.\n * Consuming components can use this to disable submit buttons.\n */\n isTimeoutDisabled?: boolean;\n\n /**\n * Flow metadata returned by the platform (v2 only). `null` while loading or unavailable.\n */\n meta: FlowMetadataResponse | null;\n\n /**\n * Function to submit authentication data (primary)\n */\n onSubmit: (payload: EmbeddedSignInFlowRequestV2) => Promise<void>;\n}\n\n/**\n * Props for the SignIn component.\n * Matches the interface from the main SignIn component for consistency.\n */\nexport interface SignInProps {\n /**\n * Render props function for custom UI\n */\n children?: (props: SignInRenderProps) => ReactNode;\n\n /**\n * Custom CSS class name for the form container.\n */\n className?: string;\n\n /**\n * Callback function called when authentication fails.\n * @param error - The error that occurred during authentication.\n */\n onError?: (error: Error) => void;\n\n /**\n * Callback function called when authentication is successful.\n * @param authData - The authentication data returned upon successful completion.\n */\n onSuccess?: (authData: Record<string, any>) => void;\n\n /**\n * Component-level preferences to override global i18n and theme settings.\n * Preferences are deep-merged with global ones, with component preferences\n * taking precedence. Affects this component and all its descendants.\n */\n preferences?: Preferences;\n\n /**\n * Size variant for the component.\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Theme variant for the component.\n */\n variant?: BaseSignInProps['variant'];\n}\n\n/**\n * State for tracking passkey registration\n */\ninterface PasskeyState {\n actionId: string | null;\n challenge: string | null;\n creationOptions: string | null;\n error: Error | null;\n executionId: string | null;\n isActive: boolean;\n}\n\n/**\n * A component-driven SignIn component that provides authentication flow with pre-built styling.\n * This component handles the flow API calls for authentication and delegates UI logic to BaseSignIn.\n * It automatically transforms simple input-based responses into component-driven UI format.\n *\n * @example\n * // Default UI\n * ```tsx\n * import { SignIn } from '@thunderid/react/component-driven';\n *\n * const App = () => {\n * return (\n * <SignIn\n * onSuccess={(authData) => {\n * console.log('Authentication successful:', authData);\n * }}\n * onError={(error) => {\n * console.error('Authentication failed:', error);\n * }}\n * size=\"medium\"\n * variant=\"outlined\"\n * />\n * );\n * };\n * ```\n *\n * @example\n * // Custom UI with render props\n * ```tsx\n * import { SignIn } from '@thunderid/react/component-driven';\n *\n * const App = () => {\n * return (\n * <SignIn\n * onSuccess={(authData) => console.log('Success:', authData)}\n * onError={(error) => console.error('Error:', error)}\n * >\n * {({signIn, isLoading, components, error, isInitialized}) => (\n * <div className=\"custom-signin\">\n * <h1>Custom Sign In</h1>\n * {!isInitialized ? (\n * <p>Initializing...</p>\n * ) : error ? (\n * <div className=\"error\">{error.message}</div>\n * ) : (\n * <form onSubmit={(e) => {\n * e.preventDefault();\n * signIn({inputs: {username: 'user', password: 'pass'}});\n * }}>\n * <button type=\"submit\" disabled={isLoading}>\n * {isLoading ? 'Signing in...' : 'Sign In'}\n * </button>\n * </form>\n * )}\n * </div>\n * )}\n * </SignIn>\n * );\n * };\n * ```\n */\nconst SignIn: FC<SignInProps> = ({\n className,\n preferences,\n size = 'medium',\n onSuccess,\n onError,\n variant,\n children,\n}: SignInProps): ReactElement => {\n const {applicationId, afterSignInUrl, signIn, isInitialized, isLoading, meta, getStorageManager} = useThunderID();\n const {t} = useTranslation(preferences?.i18n);\n\n // State management for the flow\n const [components, setComponents] = useState<EmbeddedFlowComponent[]>([]);\n const [additionalData, setAdditionalData] = useState<Record<string, any>>({});\n const [currentExecutionId, setCurrentExecutionId] = useState<string | null>(null);\n const challengeTokenRef: any = useRef<string | null>(null);\n const [isStorageReady, setIsStorageReady] = useState(false);\n const [isFlowInitialized, setIsFlowInitialized] = useState(false);\n const [flowError, setFlowError] = useState<Error | null>(null);\n const [isSubmitting, setIsSubmitting] = useState(false);\n const [isTimeoutDisabled, setIsTimeoutDisabled] = useState<boolean>(false);\n const [passkeyState, setPasskeyState] = useState<PasskeyState>({\n actionId: null,\n challenge: null,\n creationOptions: null,\n error: null,\n executionId: null,\n isActive: false,\n });\n const initializationAttemptedRef: any = useRef(false);\n const oauthCodeProcessedRef: any = useRef(false);\n const passkeyProcessedRef: any = useRef(false);\n /**\n * Sets executionId between sessionStorage and state.\n * This ensures both are always in sync.\n */\n const setExecutionId = (executionId: string | null): void => {\n setCurrentExecutionId(executionId);\n if (executionId) {\n sessionStorage.setItem('thunderid_execution_id', executionId);\n } else {\n sessionStorage.removeItem('thunderid_execution_id');\n }\n };\n\n /**\n * Restore any challenge token persisted before an OAuth redirect.\n * Waits for SDK initialization before reading from storage.\n */\n useEffect(() => {\n if (!isInitialized) return;\n\n (async (): Promise<void> => {\n try {\n const storageManager: any = await getStorageManager();\n const tempData: any = await storageManager?.getTemporaryData();\n if (tempData?.challengeToken) {\n challengeTokenRef.current = tempData.challengeToken as string;\n }\n } finally {\n setIsStorageReady(true);\n }\n })();\n }, [isInitialized]);\n\n /**\n * Updates challengeTokenRef immediately (stale-closure safe) and persists via\n * the provider's StorageManager so the token survives OAuth redirects.\n */\n const setChallengeToken = async (challengeToken: string | null): Promise<void> => {\n challengeTokenRef.current = challengeToken;\n try {\n const storageManager: any = await getStorageManager();\n if (storageManager) {\n if (challengeToken) {\n await storageManager.setTemporaryDataParameter('challengeToken', challengeToken);\n } else {\n await storageManager.removeTemporaryDataParameter('challengeToken');\n }\n }\n } catch {\n logger.warn('Failed to persist challenge token in storage.');\n }\n };\n\n /**\n * Clear all flow-related storage and state.\n */\n const clearFlowState = async (): Promise<void> => {\n setExecutionId(null);\n await setChallengeToken(null);\n setIsFlowInitialized(false);\n sessionStorage.removeItem('thunderid_auth_id');\n setIsTimeoutDisabled(false);\n // Reset refs to allow new flows to start properly\n oauthCodeProcessedRef.current = false;\n };\n\n /**\n * Parse URL parameters used in flows.\n */\n const getUrlParams = (): any => {\n const urlParams: any = new URL(window?.location?.href ?? '').searchParams;\n\n return {\n applicationId: urlParams.get('applicationId'),\n authId: urlParams.get('authId'),\n code: urlParams.get('code'),\n error: urlParams.get('error'),\n errorDescription: urlParams.get('error_description'),\n executionId: urlParams.get('executionId'),\n nonce: urlParams.get('nonce'),\n state: urlParams.get('state'),\n };\n };\n\n /**\n * Handle authId from URL and store it in sessionStorage.\n */\n const handleAuthId = (authId: string | null): void => {\n if (authId) {\n sessionStorage.setItem('thunderid_auth_id', authId);\n }\n };\n\n /**\n * Clean up OAuth-related URL parameters from the browser URL.\n */\n const cleanupOAuthUrlParams = (includeNonce = false): void => {\n if (!window?.location?.href) return;\n const url: any = new URL(window.location.href);\n url.searchParams.delete('error');\n url.searchParams.delete('error_description');\n url.searchParams.delete('code');\n url.searchParams.delete('state');\n if (includeNonce) {\n url.searchParams.delete('nonce');\n }\n window?.history?.replaceState({}, '', url.toString());\n };\n\n /**\n * Clean up flow-related URL parameters (executionId, authId) from the browser URL.\n * Used after executionId is set in state to prevent using invalidated executionId from URL.\n */\n const cleanupFlowUrlParams = (): void => {\n if (!window?.location?.href) return;\n const url: any = new URL(window.location.href);\n url.searchParams.delete('executionId');\n url.searchParams.delete('authId');\n url.searchParams.delete('applicationId');\n window?.history?.replaceState({}, '', url.toString());\n };\n\n /**\n * Set error state and call onError callback.\n * Ensures isFlowInitialized is true so errors can be displayed in the UI.\n */\n const setError = (error: Error): void => {\n setFlowError(error);\n setIsFlowInitialized(true);\n onError?.(error);\n };\n\n /**\n * Handle OAuth error from URL parameters.\n * Clears flow state, creates error, and cleans up URL.\n */\n const handleOAuthError = (error: string, errorDescription: string | null): void => {\n clearFlowState();\n const errorMessage: any = errorDescription || `OAuth error: ${error}`;\n const err: any = new ThunderIDRuntimeError(errorMessage, 'SIGN_IN_ERROR', 'react');\n setError(err);\n cleanupOAuthUrlParams(true);\n };\n\n /**\n * Handle REDIRECTION response by storing flow state and redirecting to OAuth provider.\n */\n const handleRedirection = async (response: EmbeddedSignInFlowResponseV2): Promise<boolean> => {\n if (response.type === EmbeddedSignInFlowTypeV2.Redirection) {\n const redirectURL: any = (response.data as any)?.redirectURL || (response as any)?.redirectURL;\n\n if (redirectURL && window?.location) {\n if (response.executionId) {\n setExecutionId(response.executionId);\n }\n await setChallengeToken(response.challengeToken ?? null);\n\n const urlParams: any = getUrlParams();\n handleAuthId(urlParams.authId);\n\n initiateOAuthRedirect(redirectURL);\n return true;\n }\n }\n return false;\n };\n\n /**\n * Initialize the authentication flow.\n * Priority: executionId > applicationId (from context) > applicationId (from URL)\n */\n const initializeFlow = async (): Promise<void> => {\n const urlParams: any = getUrlParams();\n\n // Reset OAuth code processed ref when starting a new flow\n oauthCodeProcessedRef.current = false;\n\n handleAuthId(urlParams.authId);\n\n const effectiveApplicationId: any = applicationId || urlParams.applicationId;\n\n if (!urlParams.executionId && !effectiveApplicationId) {\n const error: any = new ThunderIDRuntimeError(\n 'Either executionId or applicationId is required for authentication',\n 'SIGN_IN_ERROR',\n 'react',\n );\n setError(error);\n throw error;\n }\n\n try {\n setFlowError(null);\n\n let response: EmbeddedSignInFlowResponseV2;\n\n if (urlParams.executionId) {\n response = (await signIn({\n executionId: urlParams.executionId,\n })) as EmbeddedSignInFlowResponseV2;\n } else {\n response = (await signIn({\n applicationId: effectiveApplicationId,\n flowType: EmbeddedFlowType.Authentication,\n })) as EmbeddedSignInFlowResponseV2;\n }\n\n if (await handleRedirection(response)) {\n return;\n }\n\n const {\n executionId: normalizedExecutionId,\n components: normalizedComponents,\n additionalData: normalizedAdditionalData,\n } = normalizeFlowResponse(\n response,\n t,\n {\n resolveTranslations: false,\n },\n meta,\n );\n\n await setChallengeToken(response.challengeToken ?? null);\n\n if (normalizedExecutionId && normalizedComponents) {\n setExecutionId(normalizedExecutionId);\n setComponents(normalizedComponents);\n setAdditionalData(normalizedAdditionalData ?? {});\n setIsFlowInitialized(true);\n setIsTimeoutDisabled(false);\n // Clean up executionId from URL after setting it in state\n cleanupFlowUrlParams();\n }\n } catch (error) {\n const err: any = error;\n await clearFlowState();\n\n // Extract error message from response or error object\n const errorMessage: any = err?.failureReason || (err instanceof Error ? err.message : String(err));\n\n // Set error with the extracted message\n setError(new Error(errorMessage));\n initializationAttemptedRef.current = false;\n }\n };\n\n /**\n * Initialize the flow and handle cleanup of stale flow state.\n */\n useEffect(() => {\n const urlParams: any = getUrlParams();\n\n // Check for OAuth error in URL\n if (urlParams.error) {\n handleOAuthError(urlParams.error, urlParams.errorDescription);\n return;\n }\n\n handleAuthId(urlParams.authId);\n\n // Skip OAuth code processing - let the dedicated OAuth useEffect handle it\n // No action needed here as the dedicated useEffect will handle it\n }, []);\n\n useEffect(() => {\n // Only initialize if we're not processing an OAuth callback or submission\n const currentUrlParams: any = getUrlParams();\n if (\n isInitialized &&\n !isLoading &&\n !isFlowInitialized &&\n !initializationAttemptedRef.current &&\n !currentExecutionId &&\n !currentUrlParams.code &&\n !currentUrlParams.state &&\n !isSubmitting &&\n !oauthCodeProcessedRef.current\n ) {\n initializationAttemptedRef.current = true;\n initializeFlow();\n }\n }, [isInitialized, isLoading, isFlowInitialized, currentExecutionId]);\n\n /**\n * Handle step timeout if configured in additionalData.\n */\n useEffect(() => {\n const timeoutMs: number = Number(additionalData?.['stepTimeout']) || 0;\n if (timeoutMs <= 0 || !isFlowInitialized) {\n setIsTimeoutDisabled(false);\n return undefined;\n }\n\n const remaining: number = Math.max(0, Math.floor((timeoutMs - Date.now()) / 1000));\n\n const handleTimeout = (): void => {\n const errorMessage: string = t('errors.signin.timeout') || 'Time allowed to complete the step has expired.';\n setError(new Error(errorMessage));\n setIsTimeoutDisabled(true);\n };\n\n if (remaining <= 0) {\n handleTimeout();\n return undefined;\n }\n\n const timerId: any = setTimeout(() => {\n handleTimeout();\n }, remaining * 1000);\n\n return () => clearTimeout(timerId);\n }, [additionalData?.['stepTimeout'], isFlowInitialized, t]);\n\n /**\n * Handle form submission from BaseSignIn or render props.\n */\n const handleSubmit = async (payload: EmbeddedSignInFlowRequestV2): Promise<void> => {\n // Use executionId from payload if available, otherwise fall back to currentExecutionId\n const effectiveExecutionId: any = payload.executionId || currentExecutionId;\n\n if (!effectiveExecutionId) {\n throw new Error('No active flow ID');\n }\n\n const processedInputs: Record<string, any> = {...payload.inputs};\n\n // Auto-compile consent decisions if we are currently on a consent prompt step\n if (additionalData?.['consentPrompt']) {\n try {\n const consentPromptRawData: any = additionalData['consentPrompt'];\n const purposes: any[] =\n typeof consentPromptRawData === 'string'\n ? JSON.parse(consentPromptRawData)\n : consentPromptRawData.purposes || consentPromptRawData;\n\n // Find the action component to determine if it was a deny action\n let isDeny = false;\n if (payload.action) {\n // Flatten components to find the action\n const findAction = (comps: any[]): any => {\n if (!comps || comps.length === 0) return null;\n\n const found: any = comps.find((c: any) => c.id === payload.action);\n if (found) return found;\n\n return comps.reduce((acc: any, c: any) => {\n if (acc) return acc;\n if (c.components) return findAction(c.components);\n return null;\n }, null);\n };\n\n const submitAction: any = findAction(components);\n\n if (submitAction && submitAction.variant?.toLowerCase() !== 'primary') {\n isDeny = true;\n }\n }\n\n const decisions: any = {\n purposes: purposes.map((p: any) => ({\n approved: !isDeny,\n elements: [\n ...(p.essential || []).map((e: any) => ({\n approved: !isDeny,\n name: e.name,\n })),\n ...(p.optional || []).map((e: any) => {\n const key = `__consent_opt__${p.purposeId}__${e.name}`;\n return {\n approved: isDeny ? false : processedInputs[key] !== 'false',\n name: e.name,\n };\n }),\n ],\n purposeName: p.purposeName,\n })),\n };\n processedInputs['consent_decisions'] = JSON.stringify(decisions);\n\n // Cleanup temporary consent tracking fields from inputs\n Object.keys(processedInputs).forEach((key: string) => {\n if (key.startsWith('__consent_opt__')) {\n delete processedInputs[key];\n }\n });\n } catch (e) {\n // Failed to construct consent_decisions payload automatically\n }\n }\n\n try {\n setIsSubmitting(true);\n setFlowError(null);\n\n const response: EmbeddedSignInFlowResponseV2 = (await signIn({\n executionId: effectiveExecutionId,\n ...payload,\n inputs: processedInputs,\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n })) as EmbeddedSignInFlowResponseV2;\n\n if (await handleRedirection(response)) {\n return;\n }\n if (\n response.data?.additionalData?.['passkeyChallenge'] ||\n response.data?.additionalData?.['passkeyCreationOptions']\n ) {\n const {passkeyChallenge, passkeyCreationOptions}: any = response.data.additionalData;\n const effectiveExecutionIdForPasskey: any = response.executionId || effectiveExecutionId;\n\n // Reset passkey processed ref to allow processing\n passkeyProcessedRef.current = false;\n\n await setChallengeToken(response.challengeToken ?? null);\n\n // Set passkey state to trigger the passkey\n setPasskeyState({\n actionId: 'submit',\n challenge: passkeyChallenge,\n creationOptions: passkeyCreationOptions,\n error: null,\n executionId: effectiveExecutionIdForPasskey,\n isActive: true,\n });\n setIsSubmitting(false);\n\n return;\n }\n\n const {\n executionId: normalizedExecutionId,\n components: normalizedComponents,\n additionalData: normalizedAdditionalData,\n } = normalizeFlowResponse(\n response,\n t,\n {\n resolveTranslations: false,\n },\n meta,\n );\n\n // Handle Error flow status - flow has failed and is invalidated\n if (response.flowStatus === EmbeddedSignInFlowStatusV2.Error) {\n await clearFlowState();\n // Extract failureReason from response if available\n const failureReason: any = (response as any)?.failureReason;\n const errorMessage: any = failureReason || 'Authentication flow failed. Please try again.';\n const err: any = new Error(errorMessage);\n setError(err);\n cleanupFlowUrlParams();\n // Throw the error so it's caught by the catch block and propagated to BaseSignIn\n throw err;\n }\n\n if (response.flowStatus === EmbeddedSignInFlowStatusV2.Complete) {\n // Get redirectUrl from response (from /oauth2/auth/callback) or fall back to afterSignInUrl\n const redirectUrl: any = (response as any)?.redirectUrl || (response as any)?.redirect_uri;\n const finalRedirectUrl: any = redirectUrl || afterSignInUrl;\n\n // Clear submitting state before redirect\n setIsSubmitting(false);\n\n // Clear all OAuth-related storage on successful completion\n setExecutionId(null);\n await setChallengeToken(null);\n setIsFlowInitialized(false);\n sessionStorage.removeItem('thunderid_execution_id');\n sessionStorage.removeItem('thunderid_auth_id');\n\n // Clean up OAuth URL params before redirect\n cleanupOAuthUrlParams(true);\n\n if (onSuccess) {\n onSuccess({\n redirectUrl: finalRedirectUrl,\n ...(response.data || {}),\n });\n }\n\n if (finalRedirectUrl && window?.location) {\n window.location.href = finalRedirectUrl;\n }\n\n return;\n }\n\n // Always update challenge token on any INCOMPLETE response — token rotates every step.\n await setChallengeToken(response.challengeToken ?? null);\n\n // Update executionId if response contains a new one\n if (normalizedExecutionId && normalizedComponents) {\n setExecutionId(normalizedExecutionId);\n setComponents(normalizedComponents);\n setAdditionalData(normalizedAdditionalData ?? {});\n setIsTimeoutDisabled(false);\n // Ensure flow is marked as initialized when we have components\n setIsFlowInitialized(true);\n // Clean up executionId from URL after setting it in state\n cleanupFlowUrlParams();\n\n // Display failure reason from INCOMPLETE response\n if ((response as any)?.failureReason) {\n setFlowError(new Error((response as any).failureReason));\n }\n }\n } catch (error) {\n const err: any = error;\n await clearFlowState();\n\n // Extract error message from response or error object\n const errorMessage: any = err?.failureReason || (err instanceof Error ? err.message : String(err));\n\n setError(new Error(errorMessage));\n return;\n } finally {\n setIsSubmitting(false);\n }\n };\n\n /**\n * Handle authentication errors.\n */\n const handleError = (error: Error): void => {\n setError(error);\n };\n\n useOAuthCallback({\n currentExecutionId,\n isInitialized: isInitialized && !isLoading && isStorageReady,\n isSubmitting,\n onError: (err: any) => {\n clearFlowState();\n setError(err instanceof Error ? err : new Error(String(err)));\n },\n onSubmit: async (payload: any) => handleSubmit({executionId: payload.executionId, inputs: payload.inputs}),\n processedRef: oauthCodeProcessedRef,\n setExecutionId,\n });\n\n /**\n * Handle passkey authentication/registration when passkey state becomes active.\n * This effect auto-triggers the browser passkey popup and submits the result.\n */\n useEffect(() => {\n if (\n !passkeyState.isActive ||\n (!passkeyState.challenge && !passkeyState.creationOptions) ||\n !passkeyState.executionId\n ) {\n return;\n }\n\n // Prevent re-processing\n if (passkeyProcessedRef.current) {\n return;\n }\n passkeyProcessedRef.current = true;\n\n const performPasskeyProcess = async (): Promise<void> => {\n let inputs: Record<string, string>;\n\n if (passkeyState.challenge) {\n const passkeyResponse: any = await handlePasskeyAuthentication(passkeyState.challenge);\n const passkeyResponseObj: any = JSON.parse(passkeyResponse);\n\n inputs = {\n authenticatorData: passkeyResponseObj.response.authenticatorData,\n clientDataJSON: passkeyResponseObj.response.clientDataJSON,\n credentialId: passkeyResponseObj.id,\n signature: passkeyResponseObj.response.signature,\n userHandle: passkeyResponseObj.response.userHandle,\n };\n } else if (passkeyState.creationOptions) {\n const passkeyResponse: any = await handlePasskeyRegistration(passkeyState.creationOptions);\n const passkeyResponseObj: any = JSON.parse(passkeyResponse);\n\n inputs = {\n attestationObject: passkeyResponseObj.response.attestationObject,\n clientDataJSON: passkeyResponseObj.response.clientDataJSON,\n credentialId: passkeyResponseObj.id,\n };\n } else {\n throw new Error('No passkey challenge or creation options available');\n }\n\n await handleSubmit({\n executionId: passkeyState.executionId,\n inputs,\n });\n };\n\n performPasskeyProcess()\n .then(() => {\n setPasskeyState({\n actionId: null,\n challenge: null,\n creationOptions: null,\n error: null,\n executionId: null,\n isActive: false,\n });\n })\n .catch((error: any) => {\n setPasskeyState((prev: any) => ({...prev, error: error as Error, isActive: false}));\n setFlowError(error as Error);\n onError?.(error as Error);\n });\n }, [passkeyState.isActive, passkeyState.challenge, passkeyState.creationOptions, passkeyState.executionId]);\n\n if (children) {\n const renderProps: SignInRenderProps = {\n additionalData,\n components,\n error: flowError,\n initialize: initializeFlow,\n isInitialized: isFlowInitialized,\n isLoading: isLoading || isSubmitting || !isInitialized,\n isTimeoutDisabled,\n meta,\n onSubmit: handleSubmit,\n };\n\n return <>{children(renderProps)}</>;\n }\n // Otherwise, render the default BaseSignIn component\n return (\n <BaseSignIn\n additionalData={additionalData}\n components={components}\n isLoading={isLoading || !isInitialized || !isFlowInitialized}\n isTimeoutDisabled={isTimeoutDisabled}\n onSubmit={handleSubmit}\n onError={handleError}\n error={flowError}\n className={className}\n size={size}\n variant={variant}\n preferences={preferences}\n />\n );\n};\n\nexport default SignIn;\n","/**\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 EmbeddedSignInFlowInitiateResponse,\n EmbeddedSignInFlowHandleResponse,\n EmbeddedSignInFlowHandleRequestPayload,\n Platform,\n Preferences,\n} from '@thunderid/browser';\nimport {FC, ReactElement} from 'react';\nimport BaseSignIn, {BaseSignInProps} from './BaseSignIn';\nimport SignInV2, {SignInRenderProps} from './v2/SignIn';\nimport useThunderID from '../../../../contexts/ThunderID/useThunderID';\n\n/**\n * Props for the SignIn component.\n * Extends BaseSignInProps for full compatibility with the React BaseSignIn component\n */\nexport type SignInProps = Pick<BaseSignInProps, 'className' | 'onSuccess' | 'onError' | 'variant' | 'size'> & {\n /**\n * Render function for custom UI (render props pattern).\n */\n children?: (props: SignInRenderProps) => ReactElement;\n /**\n * Component-level preferences to override global i18n and theme settings.\n */\n preferences?: Preferences;\n};\n\n/**\n * A styled SignIn component that provides native authentication flow with pre-built styling.\n * This component handles the API calls for authentication and delegates UI logic to BaseSignIn.\n *\n * @example\n * ```tsx\n * import { SignIn } from '@thunderid/react';\n *\n * const App = () => {\n * return (\n * <SignIn\n * onSuccess={(authData) => {\n * console.log('Authentication successful:', authData);\n * // Handle successful authentication (e.g., redirect, store tokens)\n * }}\n * onError={(error) => {\n * console.error('Authentication failed:', error);\n * }}\n * size=\"medium\"\n * variant=\"outlined\"\n * />\n * );\n * };\n * ```\n */\nconst SignIn: FC<SignInProps> = ({className, size = 'medium', children, preferences, ...rest}: SignInProps) => {\n const {signIn, afterSignInUrl, isInitialized, isLoading, platform} = useThunderID();\n\n /**\n * Initialize the authentication flow.\n */\n const handleInitialize = async (): Promise<EmbeddedSignInFlowInitiateResponse> =>\n (await signIn({response_mode: 'direct'})) as EmbeddedSignInFlowInitiateResponse;\n\n /**\n * Handle authentication steps.\n */\n const handleOnSubmit = async (\n payload: EmbeddedSignInFlowHandleRequestPayload,\n request: Request,\n ): Promise<EmbeddedSignInFlowHandleResponse> => (await signIn(payload, request)) as EmbeddedSignInFlowHandleResponse;\n\n /**\n * Handle successful authentication and redirect with query params.\n */\n const handleSuccess = (authData: Record<string, any>): void => {\n if (authData && afterSignInUrl) {\n const url: URL = new URL(afterSignInUrl, window.location.origin);\n\n Object.entries(authData).forEach(([key, value]: [string, any]) => {\n if (value !== undefined && value !== null) {\n url.searchParams.append(key, String(value));\n }\n });\n\n window.location.href = url.toString();\n }\n };\n\n if (platform === Platform.ThunderID) {\n return (\n <SignInV2\n className={className}\n size={size}\n variant={rest.variant}\n onSuccess={rest.onSuccess}\n onError={rest.onError}\n preferences={preferences}\n >\n {children}\n </SignInV2>\n );\n }\n\n return (\n <BaseSignIn\n isLoading={isLoading || !isInitialized}\n afterSignInUrl={afterSignInUrl}\n onInitialize={handleInitialize}\n onSubmit={handleOnSubmit}\n onSuccess={handleSuccess}\n className={className}\n size={size}\n showLogo={true}\n showSubtitle={true}\n showTitle={true}\n preferences={preferences}\n {...rest}\n />\n );\n};\n\nexport default SignIn;\n","/**\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 {FieldType} from '@thunderid/browser';\nimport {FC} from 'react';\nimport {AdapterProps} from '../../models/adapters';\nimport {createField} from '../factories/FieldFactory';\n\n/**\n * Checkbox input component for sign-up forms.\n */\nconst CheckboxInput: FC<AdapterProps> = ({\n component,\n formValues,\n touchedFields,\n formErrors,\n onInputChange,\n inputClassName,\n}: AdapterProps) => {\n const config: Record<string, unknown> = component.config || {};\n const fieldName: string = (config['identifier'] as string) || (config['name'] as string) || component.id;\n const value: string | boolean = formValues[fieldName] || false;\n const error: string | undefined = touchedFields[fieldName] ? formErrors[fieldName] : undefined;\n\n return createField({\n className: inputClassName,\n error,\n label: (config['label'] as string) || '',\n name: fieldName,\n onChange: (newValue: string) => onInputChange(fieldName, newValue),\n placeholder: (config['placeholder'] as string) || '',\n required: (config['required'] as boolean) || false,\n type: FieldType.Checkbox,\n value: value as string,\n });\n};\n\nexport default CheckboxInput;\n","/**\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 {FieldType} from '@thunderid/browser';\nimport {FC} from 'react';\nimport {AdapterProps} from '../../models/adapters';\nimport {createField} from '../factories/FieldFactory';\n\n/**\n * Date input component for sign-up forms.\n */\nconst DateInput: FC<AdapterProps> = ({\n component,\n formValues,\n touchedFields,\n formErrors,\n onInputChange,\n inputClassName,\n}: AdapterProps) => {\n const config: Record<string, unknown> = component.config || {};\n const fieldName: string = (config['identifier'] as string) || (config['name'] as string) || component.id;\n const value: string = formValues[fieldName] || '';\n const error: string | undefined = touchedFields[fieldName] ? formErrors[fieldName] : undefined;\n\n return createField({\n className: inputClassName,\n error,\n label: (config['label'] as string) || '',\n name: fieldName,\n onChange: (newValue: string) => onInputChange(fieldName, newValue),\n placeholder: (config['placeholder'] as string) || '',\n required: (config['required'] as boolean) || false,\n type: FieldType.Date,\n value,\n });\n};\n\nexport default DateInput;\n","/**\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 {FC} from 'react';\nimport useTheme from '../../contexts/Theme/useTheme';\nimport {AdapterProps} from '../../models/adapters';\nimport Divider from '../primitives/Divider/Divider';\n\n/**\n * Divider component for sign-up forms.\n */\nconst DividerComponent: FC<AdapterProps> = ({component}: AdapterProps) => {\n const {theme} = useTheme();\n const config: Record<string, unknown> = component.config || {};\n const text: string = (config['text'] as string) || '';\n const variant: string = component.variant?.toLowerCase() || 'horizontal';\n\n return (\n <Divider\n key={component.id}\n orientation={variant === 'vertical' ? 'vertical' : 'horizontal'}\n style={{margin: `calc(${theme.vars.spacing.unit} * 2) 0`}}\n >\n {text}\n </Divider>\n );\n};\n\nexport default DividerComponent;\n","/**\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 {FieldType} from '@thunderid/browser';\nimport {FC} from 'react';\nimport {AdapterProps} from '../../models/adapters';\nimport {createField} from '../factories/FieldFactory';\n\n/**\n * Email input component for sign-up forms.\n */\nconst EmailInput: FC<AdapterProps> = ({\n component,\n formValues,\n touchedFields,\n formErrors,\n onInputChange,\n inputClassName,\n}: AdapterProps) => {\n const config: Record<string, unknown> = component.config || {};\n const fieldName: string = (config['identifier'] as string) || (config['name'] as string) || component.id;\n const value: string = formValues[fieldName] || '';\n const error: string | undefined = touchedFields[fieldName] ? formErrors[fieldName] : undefined;\n\n return createField({\n className: inputClassName,\n error,\n label: (config['label'] as string) || 'Email',\n name: fieldName,\n onChange: (newValue: string) => onInputChange(fieldName, newValue),\n placeholder: (config['placeholder'] as string) || 'Enter your email',\n required: (config['required'] as boolean) || false,\n type: FieldType.Email,\n value,\n });\n};\n\nexport default EmailInput;\n","/**\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 {FC, FormEvent} from 'react';\nimport {AdapterProps} from '../../models/adapters';\n// eslint-disable-next-line import/no-cycle\nimport {createSignUpComponent} from '../presentation/auth/SignUp/v1/SignUpOptionFactory';\n\n/**\n * Form container component that renders child components.\n */\nconst FormContainer: FC<AdapterProps> = (props: AdapterProps) => {\n const {component} = props;\n\n // If the form has child components, render them wrapped in a form element\n if (component.components && component.components.length > 0) {\n const handleFormSubmit: (e: FormEvent) => void = (e: FormEvent): void => {\n e.preventDefault();\n\n // Find submit button in child components and trigger its submission\n const submitButton: any = component.components?.find(\n (child: any) =>\n child.type === 'BUTTON' &&\n (child.variant === 'PRIMARY' || child.variant === 'SECONDARY' || child.config?.type === 'submit'),\n );\n\n if (submitButton && props.onSubmit) {\n props.onSubmit(submitButton, props.formValues);\n }\n };\n\n return (\n <form key={component.id} onSubmit={handleFormSubmit} style={{display: 'flex', flexDirection: 'column'}}>\n {component.components.map((childComponent: any) =>\n createSignUpComponent({\n ...props,\n component: childComponent,\n }),\n )}\n </form>\n );\n }\n\n // Empty form container\n return <div key={component.id} />;\n};\n\nexport default FormContainer;\n","/**\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 {FieldType} from '@thunderid/browser';\nimport {FC} from 'react';\nimport {AdapterProps} from '../../models/adapters';\nimport {createField} from '../factories/FieldFactory';\n\n/**\n * Number input component for sign-up forms.\n */\nconst NumberInput: FC<AdapterProps> = ({\n component,\n formValues,\n touchedFields,\n formErrors,\n onInputChange,\n inputClassName,\n}: AdapterProps) => {\n const config: Record<string, unknown> = component.config || {};\n const fieldName: string = (config['identifier'] as string) || (config['name'] as string) || component.id;\n const value: string = formValues[fieldName] || '';\n const error: string | undefined = touchedFields[fieldName] ? formErrors[fieldName] : undefined;\n\n return createField({\n className: inputClassName,\n error,\n label: (config['label'] as string) || '',\n name: fieldName,\n onChange: (newValue: string) => onInputChange(fieldName, newValue),\n placeholder: (config['placeholder'] as string) || '',\n required: (config['required'] as boolean) || false,\n type: FieldType.Number,\n value,\n });\n};\n\nexport default NumberInput;\n","/**\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 {FieldType} from '@thunderid/browser';\nimport {FC} from 'react';\nimport {AdapterProps} from '../../models/adapters';\nimport {createField} from '../factories/FieldFactory';\n\n/**\n * Password input component for sign-up forms.\n */\nconst PasswordInput: FC<AdapterProps> = ({\n component,\n formValues,\n touchedFields,\n formErrors,\n onInputChange,\n inputClassName,\n}: AdapterProps) => {\n const config: Record<string, unknown> = component.config || {};\n const fieldName: string = (config['identifier'] as string) || (config['name'] as string) || component.id;\n const value: string = formValues[fieldName] || '';\n const error: string | undefined = touchedFields[fieldName] ? formErrors[fieldName] : undefined;\n\n // Extract validation rules from the component config if available\n const validations: {\n conditions?: {key: string; value: string}[];\n name: string;\n }[] =\n (config['validations'] as {\n conditions?: {key: string; value: string}[];\n name: string;\n }[]) || [];\n const validationHints: string[] = [];\n\n validations.forEach((validation: any) => {\n if (validation.name === 'LengthValidator') {\n const minLength: string | undefined = validation.conditions?.find((c: any) => c.key === 'min.length')?.value;\n const maxLength: string | undefined = validation.conditions?.find((c: any) => c.key === 'max.length')?.value;\n if (minLength || maxLength) {\n validationHints.push(`Length: ${minLength || '0'}-${maxLength || '∞'} characters`);\n }\n } else if (validation.name === 'UpperCaseValidator') {\n const minLength: string | undefined = validation.conditions?.find((c: any) => c.key === 'min.length')?.value;\n if (minLength && parseInt(minLength, 10) > 0) {\n validationHints.push('Must contain uppercase letter(s)');\n }\n } else if (validation.name === 'LowerCaseValidator') {\n const minLength: string | undefined = validation.conditions?.find((c: any) => c.key === 'min.length')?.value;\n if (minLength && parseInt(minLength, 10) > 0) {\n validationHints.push('Must contain lowercase letter(s)');\n }\n } else if (validation.name === 'NumeralValidator') {\n const minLength: string | undefined = validation.conditions?.find((c: any) => c.key === 'min.length')?.value;\n if (minLength && parseInt(minLength, 10) > 0) {\n validationHints.push('Must contain number(s)');\n }\n } else if (validation.name === 'SpecialCharacterValidator') {\n const minLength: string | undefined = validation.conditions?.find((c: any) => c.key === 'min.length')?.value;\n if (minLength && parseInt(minLength, 10) > 0) {\n validationHints.push('Must contain special character(s)');\n }\n }\n });\n\n return createField({\n className: inputClassName,\n error,\n label: (config['label'] as string) || 'Password',\n name: fieldName,\n onChange: (newValue: string) => onInputChange(fieldName, newValue),\n placeholder: (config['placeholder'] as string) || 'Enter your password',\n required: (config['required'] as boolean) || false,\n type: FieldType.Password,\n value,\n });\n};\n\nexport default PasswordInput;\n","/**\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 {FieldType} from '@thunderid/browser';\nimport {FC} from 'react';\nimport {AdapterProps} from '../../models/adapters';\nimport {createField} from '../factories/FieldFactory';\nimport {SelectOption} from '../primitives/Select/Select';\n\n/**\n * Select input component for sign-up forms.\n */\nconst SelectInput: FC<AdapterProps> = ({\n component,\n formValues,\n touchedFields,\n formErrors,\n onInputChange,\n inputClassName,\n}: AdapterProps) => {\n const config: Record<string, unknown> = component.config || {};\n const fieldName: string = (config['identifier'] as string) || (config['name'] as string) || component.id;\n const value: string = formValues[fieldName] || '';\n const error: string = touchedFields[fieldName] ? formErrors[fieldName] : undefined;\n\n // Get options from config and convert to SelectOption format\n const rawOptions: string[] = (config['options'] as string[]) || [];\n const options: SelectOption[] = rawOptions.map((option: string) => ({\n label: option,\n value: option,\n }));\n\n return createField({\n className: inputClassName,\n error,\n label: (config['label'] as string) || '',\n name: fieldName,\n onChange: (newValue: string): void => onInputChange(fieldName, newValue),\n options,\n placeholder: (config['placeholder'] as string) || '',\n required: (config['required'] as boolean) || false,\n type: FieldType.Select,\n value,\n });\n};\n\nexport default SelectInput;\n","/**\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 {FC} from 'react';\nimport {AdapterProps} from '../../models/adapters';\nimport Button from '../primitives/Button/Button';\nimport Spinner from '../primitives/Spinner/Spinner';\n\n/**\n * Button component for sign-up forms that handles all button variants.\n */\nconst ButtonComponent: FC<AdapterProps> = ({\n component,\n isLoading,\n isFormValid,\n buttonClassName,\n onSubmit,\n size = 'medium',\n}: AdapterProps) => {\n const config: Record<string, unknown> = component.config || {};\n const buttonText: string = (config['text'] as string) || (config['label'] as string) || 'Continue';\n const buttonType: string = (config['type'] as string) || 'submit';\n const componentVariant: string = component.variant?.toUpperCase() || 'PRIMARY';\n\n // Map component variants to Button primitive props\n const getButtonProps = (): {color: 'primary' | 'secondary'; variant: 'solid' | 'text' | 'outline'} => {\n switch (componentVariant) {\n case 'PRIMARY':\n return {color: 'primary' as const, variant: 'solid' as const};\n case 'SECONDARY':\n return {color: 'secondary' as const, variant: 'solid' as const};\n case 'TEXT':\n return {color: 'primary' as const, variant: 'text' as const};\n case 'SOCIAL':\n case 'OUTLINED':\n return {color: 'primary' as const, variant: 'outline' as const};\n default:\n return {color: 'primary' as const, variant: 'solid' as const};\n }\n };\n\n const {variant, color} = getButtonProps();\n\n const handleClick = (): void => {\n if (onSubmit && buttonType !== 'submit') {\n onSubmit(component);\n }\n };\n\n return (\n <Button\n key={component.id}\n type={buttonType === 'submit' ? 'submit' : 'button'}\n variant={variant}\n color={color}\n size={size}\n disabled={isLoading || (buttonType === 'submit' && !isFormValid)}\n onClick={buttonType !== 'submit' ? handleClick : undefined}\n className={buttonClassName}\n style={{width: '100%'}}\n >\n {isLoading ? <Spinner size=\"small\" /> : buttonText}\n </Button>\n );\n};\n\nexport default ButtonComponent;\n","/**\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 {ChangeEvent, FC} from 'react';\nimport {AdapterProps} from '../../models/adapters';\nimport TextField from '../primitives/TextField/TextField';\n\n/**\n * Telephone input component for sign-up forms.\n */\nconst TelephoneInput: FC<AdapterProps> = ({\n component,\n formValues,\n touchedFields,\n formErrors,\n onInputChange,\n inputClassName,\n}: AdapterProps) => {\n const config: Record<string, unknown> = component.config || {};\n const fieldName: string = (config['identifier'] as string) || (config['name'] as string) || component.id;\n const value: string = formValues[fieldName] || '';\n const error: string | undefined = touchedFields[fieldName] ? formErrors[fieldName] : undefined;\n\n return (\n <TextField\n key={component.id}\n name={fieldName}\n type=\"tel\"\n label={(config['label'] as string) || ''}\n placeholder={(config['placeholder'] as string) || ''}\n required={(config['required'] as boolean) || false}\n value={value}\n error={error}\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onInputChange(fieldName, e.target.value)}\n className={inputClassName}\n helperText={(config['hint'] as string) || ''}\n />\n );\n};\n\nexport default TelephoneInput;\n","/**\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 {FieldType} from '@thunderid/browser';\nimport {FC} from 'react';\nimport {AdapterProps} from '../../models/adapters';\nimport {createField} from '../factories/FieldFactory';\n\n/**\n * Text input component for sign-up forms.\n */\nconst TextInput: FC<AdapterProps> = ({\n component,\n formValues,\n touchedFields,\n formErrors,\n onInputChange,\n inputClassName,\n}: AdapterProps) => {\n const config: Record<string, unknown> = component.config || {};\n const fieldName: string = (config['identifier'] as string) || (config['name'] as string) || component.id;\n const value: string = formValues[fieldName] || '';\n const error: string | undefined = touchedFields[fieldName] ? formErrors[fieldName] : undefined;\n\n return createField({\n className: inputClassName,\n error,\n label: (config['label'] as string) || '',\n name: fieldName,\n onChange: (newValue: string) => onInputChange(fieldName, newValue),\n placeholder: (config['placeholder'] as string) || '',\n required: (config['required'] as boolean) || false,\n type: FieldType.Text,\n value,\n });\n};\n\nexport default TextInput;\n","/**\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 {FC} from 'react';\nimport useTheme from '../../contexts/Theme/useTheme';\nimport {AdapterProps} from '../../models/adapters';\nimport Typography from '../primitives/Typography/Typography';\n\n/**\n * Typography component for sign-up forms (titles, descriptions, etc.).\n */\nconst TypographyComponent: FC<AdapterProps> = ({component}: AdapterProps) => {\n const {theme} = useTheme();\n const config: Record<string, unknown> = component.config || {};\n const text: string = (config['text'] as string) || (config['content'] as string) || '';\n const variant: string = component.variant?.toLowerCase() || 'body1';\n\n // Map component variants to Typography variants\n let typographyVariant: any = 'body1';\n\n switch (variant) {\n case 'h1':\n typographyVariant = 'h1';\n break;\n case 'h2':\n typographyVariant = 'h2';\n break;\n case 'h3':\n typographyVariant = 'h3';\n break;\n case 'h4':\n typographyVariant = 'h4';\n break;\n case 'h5':\n typographyVariant = 'h5';\n break;\n case 'h6':\n typographyVariant = 'h6';\n break;\n case 'subtitle1':\n typographyVariant = 'subtitle1';\n break;\n case 'subtitle2':\n typographyVariant = 'subtitle2';\n break;\n case 'body2':\n typographyVariant = 'body2';\n break;\n case 'caption':\n typographyVariant = 'caption';\n break;\n default:\n typographyVariant = 'body1';\n }\n\n return (\n <Typography\n key={component.id}\n variant={typographyVariant}\n style={{marginBottom: `calc(${theme.vars.spacing.unit} * 2)`}}\n >\n {text}\n </Typography>\n );\n};\n\nexport default TypographyComponent;\n","/**\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 {EmbeddedFlowComponent, EmbeddedFlowComponentType} from '@thunderid/browser';\nimport {ReactElement} from 'react';\nimport {AdapterProps} from '../../../../../models/adapters';\nimport CheckboxInput from '../../../../adapters/CheckboxInput';\nimport DateInput from '../../../../adapters/DateInput';\nimport DividerComponent from '../../../../adapters/DividerComponent';\nimport EmailInput from '../../../../adapters/EmailInput';\nimport FacebookButton from '../../../../adapters/FacebookButton';\n// eslint-disable-next-line import/no-cycle\nimport FormContainer from '../../../../adapters/FormContainer';\nimport GitHubButton from '../../../../adapters/GitHubButton';\nimport GoogleButton from '../../../../adapters/GoogleButton';\nimport ImageComponent from '../../../../adapters/ImageComponent';\nimport LinkedInButton from '../../../../adapters/LinkedInButton';\nimport MicrosoftButton from '../../../../adapters/MicrosoftButton';\nimport NumberInput from '../../../../adapters/NumberInput';\nimport PasswordInput from '../../../../adapters/PasswordInput';\nimport SelectInput from '../../../../adapters/SelectInput';\nimport SignInWithEthereumButton from '../../../../adapters/SignInWithEthereumButton';\nimport ButtonComponent from '../../../../adapters/SubmitButton';\nimport TelephoneInput from '../../../../adapters/TelephoneInput';\nimport TextInput from '../../../../adapters/TextInput';\nimport Typography from '../../../../adapters/Typography';\n\n/**\n * Creates the appropriate sign-up component based on the component type.\n */\nexport const createSignUpComponent = ({component, onSubmit, ...rest}: AdapterProps): ReactElement => {\n switch (component.type) {\n case EmbeddedFlowComponentType.Typography:\n return <Typography component={component} onSubmit={onSubmit} {...rest} />;\n\n case EmbeddedFlowComponentType.Input: {\n // Determine input type based on variant or config\n const inputVariant: string = component.variant?.toUpperCase();\n const inputType: string = (component.config['type'] as string)?.toLowerCase();\n\n if (inputVariant === 'EMAIL' || inputType === 'email') {\n return <EmailInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n if (inputVariant === 'PASSWORD' || inputType === 'password') {\n return <PasswordInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n if (inputVariant === 'TELEPHONE' || inputType === 'tel') {\n return <TelephoneInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n if (inputVariant === 'NUMBER' || inputType === 'number') {\n return <NumberInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n if (inputVariant === 'DATE' || inputType === 'date') {\n return <DateInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n if (inputVariant === 'CHECKBOX' || inputType === 'checkbox') {\n return <CheckboxInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n return <TextInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n case EmbeddedFlowComponentType.Button: {\n const buttonVariant: string | undefined = component.variant?.toUpperCase();\n const buttonText: string = (component.config['text'] as string) || (component.config['label'] as string) || '';\n\n // TODO: The connection type should come as metadata.\n if (buttonVariant === 'SOCIAL') {\n if (buttonText.toLowerCase().includes('google')) {\n return (\n <GoogleButton onClick={(): any => onSubmit(component, {})} {...rest}>\n {buttonText}\n </GoogleButton>\n );\n }\n\n if (buttonText.toLowerCase().includes('github')) {\n return (\n <GitHubButton onClick={(): any => onSubmit(component, {})} {...rest}>\n {buttonText}\n </GitHubButton>\n );\n }\n\n if (buttonText.toLowerCase().includes('microsoft')) {\n return (\n <MicrosoftButton onClick={(): any => onSubmit(component, {})} {...rest}>\n {buttonText}\n </MicrosoftButton>\n );\n }\n\n if (buttonText.toLowerCase().includes('facebook')) {\n return (\n <FacebookButton onClick={(): any => onSubmit(component, {})} {...rest}>\n {buttonText}\n </FacebookButton>\n );\n }\n\n if (buttonText.toLowerCase().includes('linkedin')) {\n return (\n <LinkedInButton onClick={(): any => onSubmit(component, {})} {...rest}>\n {buttonText}\n </LinkedInButton>\n );\n }\n\n if (buttonText.toLowerCase().includes('ethereum')) {\n return (\n <SignInWithEthereumButton onClick={(): any => onSubmit(component, {})} {...rest}>\n {buttonText}\n </SignInWithEthereumButton>\n );\n }\n }\n\n // Use the generic ButtonComponent for all other button variants\n // It will handle PRIMARY, SECONDARY, TEXT, SOCIAL mappings internally\n return <ButtonComponent component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n case EmbeddedFlowComponentType.Form:\n return <FormContainer component={component} onSubmit={onSubmit} {...rest} />;\n\n case EmbeddedFlowComponentType.Select:\n return <SelectInput component={component} onSubmit={onSubmit} {...rest} />;\n\n case EmbeddedFlowComponentType.Divider:\n return <DividerComponent component={component} onSubmit={onSubmit} {...rest} />;\n\n case EmbeddedFlowComponentType.Image:\n return <ImageComponent component={component} onSubmit={onSubmit} {...rest} />;\n\n default:\n return <div />;\n }\n};\n\n/**\n * Convenience function that creates the appropriate sign-up component from flow component data.\n */\nexport const createSignUpOptionFromComponent = (\n component: EmbeddedFlowComponent,\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n buttonClassName?: string;\n inputClassName?: string;\n key?: string | number;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>) => void;\n size?: 'small' | 'medium' | 'large';\n variant?: any;\n },\n): ReactElement =>\n createSignUpComponent({\n component,\n formErrors,\n formValues,\n isFormValid,\n isLoading,\n onInputChange,\n touchedFields,\n ...options,\n });\n\n/**\n * Processes an array of components and renders them as React elements.\n */\nexport const renderSignUpComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n buttonClassName?: string;\n inputClassName?: string;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>) => void;\n size?: 'small' | 'medium' | 'large';\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createSignUpOptionFromComponent(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n {\n ...options,\n // Use component id as key, fallback to index\n key: component.id || index,\n },\n ),\n )\n .filter(Boolean);\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the BaseSignUp component\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(() => {\n const signUp: string = css`\n min-width: 420px;\n margin: 0 auto;\n font-family: ${theme.vars.typography.fontFamily};\n `;\n\n const card: string = css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n gap: calc(${theme.vars.spacing.unit} * 2);\n min-width: 420px;\n `;\n\n const logoContainer: string = css`\n display: flex;\n flex-direction: column;\n align-items: center;\n margin-bottom: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const header: string = css`\n gap: 0;\n align-items: center;\n `;\n\n const title: string = css`\n margin: 0 0 calc(${theme.vars.spacing.unit} * 1) 0;\n color: ${theme.vars.colors.text.primary};\n `;\n\n const subtitle: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 1);\n color: ${theme.vars.colors.text.secondary};\n `;\n\n const messageItem: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 1);\n `;\n\n const errorContainer: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const contentContainer: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const loadingContainer: string = css`\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: calc(${theme.vars.spacing.unit} * 4);\n `;\n\n const loadingText: string = css`\n margin-top: calc(${theme.vars.spacing.unit} * 2);\n color: ${theme.vars.colors.text.secondary};\n `;\n\n const divider: string = css`\n margin: calc(${theme.vars.spacing.unit} * 1) 0;\n `;\n\n const centeredContainer: string = css`\n text-align: center;\n padding: calc(${theme.vars.spacing.unit} * 4);\n `;\n\n const passkeyContainer: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const passkeyText: string = css`\n margin-top: calc(${theme.vars.spacing.unit} * 1);\n color: ${theme.vars.colors.text.secondary};\n `;\n\n const form: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const formDivider: string = css`\n margin: calc(${theme.vars.spacing.unit} * 1) 0;\n `;\n\n const authenticatorSection: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} * 1);\n `;\n\n const authenticatorItem: string = css`\n width: 100%;\n `;\n\n const noAuthenticatorCard: string = css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n padding: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const errorAlert: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const messagesAlert: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 1);\n `;\n\n const flowMessagesContainer: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const flowMessageItem: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 1);\n `;\n\n return {\n authenticatorItem,\n authenticatorSection,\n card,\n centeredContainer,\n contentContainer,\n divider,\n errorAlert,\n errorContainer,\n flowMessageItem,\n flowMessagesContainer,\n form,\n formDivider,\n header,\n loadingContainer,\n loadingText,\n logoContainer,\n messageItem,\n messagesAlert,\n noAuthenticatorCard,\n passkeyContainer,\n passkeyText,\n signUp,\n subtitle,\n title,\n };\n }, [\n theme.vars.colors.background.surface,\n theme.vars.colors.text.primary,\n theme.vars.colors.text.secondary,\n theme.vars.borderRadius.large,\n theme.vars.spacing.unit,\n theme.vars.typography.fontFamily,\n colorScheme,\n ]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {\n EmbeddedFlowExecuteRequestPayload,\n EmbeddedFlowExecuteResponse,\n EmbeddedFlowStatus,\n EmbeddedFlowComponentType,\n EmbeddedFlowResponseType,\n withVendorCSSClassPrefix,\n createPackageComponentLogger,\n} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useEffect, useState, useCallback, useRef} from 'react';\nimport {renderSignUpComponents} from './SignUpOptionFactory';\nimport FlowProvider from '../../../../../contexts/Flow/FlowProvider';\nimport useFlow from '../../../../../contexts/Flow/useFlow';\nimport useTheme from '../../../../../contexts/Theme/useTheme';\nimport useThunderID from '../../../../../contexts/ThunderID/useThunderID';\nimport {useForm, FormField} from '../../../../../hooks/useForm';\nimport useTranslation from '../../../../../hooks/useTranslation';\nimport AlertPrimitive from '../../../../primitives/Alert/Alert';\n// eslint-disable-next-line import/no-named-as-default\nimport CardPrimitive, {CardProps} from '../../../../primitives/Card/Card';\nimport Logo from '../../../../primitives/Logo/Logo';\nimport Spinner from '../../../../primitives/Spinner/Spinner';\nimport Typography from '../../../../primitives/Typography/Typography';\nimport useStyles from '../BaseSignUp.styles';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'BaseSignUp',\n);\n\n/**\n * Render props for custom UI rendering\n */\nexport interface BaseSignUpRenderProps {\n /**\n * Flow components\n */\n components: any[];\n\n /**\n * Form errors\n */\n errors: Record<string, string>;\n\n /**\n * Function to handle input changes\n */\n handleInputChange: (name: string, value: string) => void;\n\n /**\n * Function to handle form submission\n */\n handleSubmit: (component: any, data?: Record<string, any>) => Promise<void>;\n\n /**\n * Loading state\n */\n isLoading: boolean;\n\n /**\n * Whether the form is valid\n */\n isValid: boolean;\n\n /**\n * Flow messages\n */\n messages: {message: string; type: string}[];\n\n /**\n * Flow subtitle\n */\n subtitle: string;\n\n /**\n * Flow title\n */\n title: string;\n\n /**\n * Touched fields\n */\n touched: Record<string, boolean>;\n\n /**\n * Function to validate the form\n */\n validateForm: () => {errors: Record<string, string>; isValid: boolean};\n\n /**\n * Form values\n */\n values: Record<string, string>;\n}\n\n/**\n * Props for the BaseSignUp component.\n */\nexport interface BaseSignUpProps {\n /**\n * URL to redirect after successful sign-up.\n */\n afterSignUpUrl?: string;\n\n /**\n * Custom CSS class name for the submit button.\n */\n buttonClassName?: string;\n\n /**\n * Render props function for custom UI\n */\n children?: (props: BaseSignUpRenderProps) => ReactNode;\n\n /**\n * Custom CSS class name for the form container.\n */\n className?: string;\n\n /**\n * Custom CSS class name for error messages.\n */\n errorClassName?: string;\n\n /**\n * Custom CSS class name for form inputs.\n */\n inputClassName?: string;\n\n isInitialized?: boolean;\n\n /**\n * Custom CSS class name for info messages.\n */\n messageClassName?: string;\n\n /**\n * Callback function called when the sign-up flow completes and requires redirection.\n * This allows platform-specific handling of redirects (e.g., Next.js router.push).\n * @param response - The response from the sign-up flow containing the redirect URL, etc.\n */\n onComplete?: (response: EmbeddedFlowExecuteResponse) => void;\n\n /**\n * Callback function called when sign-up fails.\n * @param error - The error that occurred during sign-up.\n */\n onError?: (error: Error) => void;\n\n /**\n * Callback function called when sign-up flow status changes.\n * @param response - The current sign-up response.\n */\n onFlowChange?: (response: EmbeddedFlowExecuteResponse) => void;\n\n /**\n * Function to initialize sign-up flow.\n * @returns Promise resolving to the initial sign-up response.\n */\n onInitialize?: (payload?: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse>;\n\n /**\n * Function to handle sign-up steps.\n * @param payload - The sign-up payload.\n * @returns Promise resolving to the sign-up response.\n */\n onSubmit?: (payload: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse>;\n /**\n * Whether to redirect after sign-up.\n */\n shouldRedirectAfterSignUp?: boolean;\n\n /**\n * Whether to show the logo.\n */\n showLogo?: boolean;\n\n /**\n * Whether to show the subtitle.\n */\n showSubtitle?: boolean;\n\n /**\n * Whether to show the title.\n */\n showTitle?: boolean;\n\n /**\n * Size variant for the component.\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Theme variant for the component.\n */\n variant?: CardProps['variant'];\n}\n\n/**\n * Component that consumes FlowContext and renders the sign-up UI.\n *\n * @internal\n */\nconst BaseSignUpContent: FC<BaseSignUpProps> = ({\n afterSignUpUrl,\n onInitialize,\n onSubmit,\n onError,\n onFlowChange,\n onComplete,\n className = '',\n inputClassName = '',\n buttonClassName = '',\n errorClassName = '',\n messageClassName = '',\n size = 'medium',\n variant = 'outlined',\n isInitialized,\n children,\n showTitle = true,\n showSubtitle = true,\n}: BaseSignUpProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const {t} = useTranslation();\n const {subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages} = useFlow();\n useThunderID();\n const styles: any = useStyles(theme, colorScheme);\n\n const handleError: any = useCallback(\n (error: any) => {\n let errorMessage: string = t('errors.signup.flow.failure');\n\n if (error && typeof error === 'object') {\n // Handle ThunderID error format with code and description/message\n if (error.code && (error.message || error.description)) {\n errorMessage = error.description || error.message;\n } else if (error instanceof Error && error.name === 'ThunderIDAPIError') {\n try {\n const errorResponse: any = JSON.parse(error.message);\n if (errorResponse.description) {\n errorMessage = errorResponse.description;\n } else if (errorResponse.message) {\n errorMessage = errorResponse.message;\n } else {\n errorMessage = error.message;\n }\n } catch {\n errorMessage = error.message;\n }\n } else if (error.message) {\n errorMessage = error.message;\n }\n } else if (typeof error === 'string') {\n errorMessage = error;\n }\n\n // Clear existing messages and add the error message\n clearMessages();\n addMessage({\n message: errorMessage,\n type: 'error',\n });\n },\n [t, addMessage, clearMessages],\n );\n\n const [isLoading, setIsLoading] = useState(false);\n const [isFlowInitialized, setIsFlowInitialized] = useState(false);\n const [currentFlow, setCurrentFlow] = useState<EmbeddedFlowExecuteResponse | null>(null);\n\n const initializationAttemptedRef: any = useRef(false);\n\n /**\n * Extract form fields from flow components\n */\n const extractFormFields: any = useCallback(\n (components: any[]): FormField[] => {\n const fields: FormField[] = [];\n\n const processComponents = (comps: any[]): any => {\n comps.forEach((component: any) => {\n if (component.type === EmbeddedFlowComponentType.Input) {\n const config: any = component.config || {};\n fields.push({\n initialValue: config.defaultValue || '',\n name: config.name || component.id,\n required: config.required || false,\n validator: (value: string) => {\n if (config.required && (!value || value.trim() === '')) {\n return t('validations.required.field.error');\n }\n // Add email validation if it's an email field\n if (config.type === 'email' && value && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)) {\n return t('field.email.invalid');\n }\n // Add password strength validation if it's a password field\n if (config.type === 'password' && value && value.length < 8) {\n return t('field.password.weak');\n }\n return null;\n },\n });\n }\n\n if (component.components && Array.isArray(component.components)) {\n processComponents(component.components);\n }\n });\n };\n\n processComponents(components);\n return fields;\n },\n [t],\n );\n\n const formFields: any = currentFlow?.data?.components ? extractFormFields(currentFlow.data.components) : [];\n\n const form: any = useForm<Record<string, string>>({\n fields: formFields,\n initialValues: {},\n requiredMessage: t('validations.required.field.error'),\n validateOnBlur: true,\n validateOnChange: true,\n });\n\n const {\n values: formValues,\n touched: touchedFields,\n errors: formErrors,\n isValid: isFormValid,\n setValue: setFormValue,\n setTouched: setFormTouched,\n validateForm,\n reset: resetForm,\n } = form;\n\n /**\n * Setup form fields based on the current flow.\n */\n const setupFormFields: any = useCallback(\n (flowResponse: EmbeddedFlowExecuteResponse) => {\n const fields: any = extractFormFields(flowResponse.data?.components || []);\n const initialValues: Record<string, string> = {};\n\n fields.forEach((field: any) => {\n initialValues[field.name] = field.initialValue || '';\n });\n\n resetForm();\n\n Object.keys(initialValues).forEach((key: any) => {\n setFormValue(key, initialValues[key]);\n });\n },\n [extractFormFields, resetForm, setFormValue],\n );\n\n /**\n * Handle input value changes.\n */\n const handleInputChange = (name: string, value: string): void => {\n setFormValue(name, value);\n setFormTouched(name, true);\n };\n\n /**\n * Check if the response contains a redirection URL and perform the redirect if necessary.\n * @param response - The sign-up response\n * @returns true if a redirect was performed, false otherwise\n */\n const handleRedirectionIfNeeded = (response: EmbeddedFlowExecuteResponse): boolean => {\n if (response?.type === EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL) {\n /**\n * Open a popup window to handle redirection prompts for social sign-up\n */\n const redirectUrl: any = response.data.redirectURL;\n const popup: any = window.open(redirectUrl, 'oauth_popup', 'width=500,height=600,scrollbars=yes,resizable=yes');\n\n if (!popup) {\n logger.error('Failed to open popup window');\n return false;\n }\n\n /**\n * Use `let` for messageHandler and popupMonitor to resolve circular references:\n * messageHandler <-> cleanup <-> popupMonitor.\n * All are assigned before any of them can be invoked at runtime.\n */\n let hasProcessedCallback: any = false; // Prevent multiple processing\n let popupMonitor: any;\n let messageHandler: (event: MessageEvent) => Promise<void>;\n\n const cleanup = (): void => {\n window.removeEventListener('message', messageHandler);\n if (popupMonitor) {\n clearInterval(popupMonitor);\n }\n };\n\n /**\n * Add an event listener to the window to capture the message from the popup\n */\n messageHandler = async function messageEventHandler(event: MessageEvent): Promise<void> {\n /**\n * Check if the message is from our popup window\n */\n if (event.source !== popup) {\n return;\n }\n\n /**\n * Check the origin of the message to ensure it's from a trusted source\n */\n const expectedOrigin: any = afterSignUpUrl ? new URL(afterSignUpUrl).origin : window.location.origin;\n if (event.origin !== expectedOrigin && event.origin !== window.location.origin) {\n return;\n }\n\n const {code, state} = event.data;\n\n if (code && state) {\n const payload: EmbeddedFlowExecuteRequestPayload = {\n ...(currentFlow.flowId && {flowId: currentFlow.flowId}),\n actionId: '',\n flowType: (currentFlow as any).flowType || 'REGISTRATION',\n inputs: {\n code,\n state,\n },\n } as any;\n\n try {\n const continueResponse: any = await onSubmit(payload);\n onFlowChange?.(continueResponse);\n\n if (continueResponse.flowStatus === EmbeddedFlowStatus.Complete) {\n onComplete?.(continueResponse);\n } else if (continueResponse.flowStatus === EmbeddedFlowStatus.Incomplete) {\n setCurrentFlow(continueResponse);\n setupFormFields(continueResponse);\n }\n\n popup.close();\n cleanup();\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n popup.close();\n cleanup();\n }\n }\n };\n\n window.addEventListener('message', messageHandler);\n\n /**\n * Monitor popup for closure and URL changes\n */\n popupMonitor = setInterval(async () => {\n try {\n if (popup.closed) {\n cleanup();\n return;\n }\n\n // Skip if we've already processed a callback\n if (hasProcessedCallback) {\n return;\n }\n\n // Try to access popup URL to check for callback\n try {\n const popupUrl: any = popup.location.href;\n\n // Check if we've been redirected to the callback URL\n if (popupUrl && (popupUrl.includes('code=') || popupUrl.includes('error='))) {\n hasProcessedCallback = true; // Set flag to prevent multiple processing\n\n // Parse the URL for OAuth parameters\n const url: any = new URL(popupUrl);\n const code: any = url.searchParams.get('code');\n const state: any = url.searchParams.get('state');\n const error: any = url.searchParams.get('error');\n\n if (error) {\n logger.error('OAuth error:');\n popup.close();\n cleanup();\n return;\n }\n\n if (code && state) {\n const payload: EmbeddedFlowExecuteRequestPayload = {\n ...(currentFlow.flowId && {flowId: currentFlow.flowId}),\n actionId: '',\n flowType: (currentFlow as any).flowType || 'REGISTRATION',\n inputs: {\n code,\n state,\n },\n } as any;\n\n try {\n const continueResponse: any = await onSubmit(payload);\n onFlowChange?.(continueResponse);\n\n if (continueResponse.flowStatus === EmbeddedFlowStatus.Complete) {\n onComplete?.(continueResponse);\n } else if (continueResponse.flowStatus === EmbeddedFlowStatus.Incomplete) {\n setCurrentFlow(continueResponse);\n setupFormFields(continueResponse);\n }\n\n popup.close();\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n popup.close();\n }\n }\n }\n } catch (e) {\n // Cross-origin error is expected when popup navigates to OAuth provider\n // This is normal and we can ignore it\n }\n } catch (e) {\n logger.error('Error monitoring popup:');\n }\n }, 1000);\n\n return true;\n }\n\n return false;\n };\n\n /**\n * Handle component submission (for buttons outside forms).\n */\n const handleSubmit = async (component: any, data?: Record<string, any>): Promise<void> => {\n if (!currentFlow) {\n return;\n }\n\n setIsLoading(true);\n clearMessages();\n\n try {\n // Filter out empty or undefined input values\n const filteredInputs: Record<string, any> = {};\n if (data) {\n Object.entries(data).forEach(([key, value]: [string, any]) => {\n if (value !== null && value !== undefined && value !== '') {\n filteredInputs[key] = value;\n }\n });\n }\n\n const actionId: string = component.id;\n\n const payload: EmbeddedFlowExecuteRequestPayload = {\n ...(currentFlow.flowId && {flowId: currentFlow.flowId}),\n flowType: (currentFlow as any).flowType || 'REGISTRATION',\n inputs: filteredInputs,\n ...(actionId && {actionId: actionId}),\n } as any;\n\n const response: any = await onSubmit(payload);\n onFlowChange?.(response);\n\n if (response.flowStatus === EmbeddedFlowStatus.Complete) {\n onComplete?.(response);\n return;\n }\n\n if (response.flowStatus === EmbeddedFlowStatus.Incomplete) {\n if (handleRedirectionIfNeeded(response)) {\n return;\n }\n\n setCurrentFlow(response);\n setupFormFields(response);\n }\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n } finally {\n setIsLoading(false);\n }\n };\n\n const containerClasses: any = cx(\n [\n withVendorCSSClassPrefix('signup'),\n withVendorCSSClassPrefix(`signup--${size}`),\n withVendorCSSClassPrefix(`signup--${variant}`),\n ],\n className,\n );\n\n const inputClasses: any = cx(\n [\n withVendorCSSClassPrefix('signup__input'),\n size === 'small' && withVendorCSSClassPrefix('signup__input--small'),\n size === 'large' && withVendorCSSClassPrefix('signup__input--large'),\n ],\n inputClassName,\n );\n\n const buttonClasses: any = cx(\n [\n withVendorCSSClassPrefix('signup__button'),\n size === 'small' && withVendorCSSClassPrefix('signup__button--small'),\n size === 'large' && withVendorCSSClassPrefix('signup__button--large'),\n ],\n buttonClassName,\n );\n\n const errorClasses: any = cx([withVendorCSSClassPrefix('signup__error')], errorClassName);\n\n const messageClasses: any = cx([withVendorCSSClassPrefix('signup__messages')], messageClassName);\n\n /**\n * Render form components based on flow data using the factory\n */\n const renderComponents: any = useCallback(\n (components: any[]): ReactElement[] =>\n renderSignUpComponents(\n components,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n handleInputChange,\n {\n buttonClassName: buttonClasses,\n inputClassName: inputClasses,\n onSubmit: handleSubmit,\n size,\n variant,\n },\n ),\n [\n formValues,\n touchedFields,\n formErrors,\n isFormValid,\n isLoading,\n size,\n variant,\n inputClasses,\n buttonClasses,\n handleSubmit,\n ],\n );\n\n // Initialize the flow on component mount\n useEffect(() => {\n if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {\n initializationAttemptedRef.current = true;\n\n (async (): Promise<void> => {\n setIsLoading(true);\n clearMessages();\n\n try {\n const response: any = await onInitialize();\n\n setCurrentFlow(response);\n setIsFlowInitialized(true);\n onFlowChange?.(response);\n\n if (response.flowStatus === EmbeddedFlowStatus.Complete) {\n onComplete?.(response);\n return;\n }\n\n if (response.flowStatus === EmbeddedFlowStatus.Incomplete) {\n setupFormFields(response);\n }\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n } finally {\n setIsLoading(false);\n }\n })();\n }\n }, [\n isInitialized,\n isFlowInitialized,\n onInitialize,\n onComplete,\n onError,\n onFlowChange,\n setupFormFields,\n afterSignUpUrl,\n t,\n ]);\n\n // If render props are provided, use them\n if (children) {\n const renderProps: BaseSignUpRenderProps = {\n components: currentFlow?.data?.components || [],\n errors: formErrors,\n handleInputChange,\n handleSubmit,\n isLoading,\n isValid: isFormValid,\n messages: flowMessages || [],\n subtitle: flowSubtitle || t('signup.subheading'),\n title: flowTitle || t('signup.heading'),\n touched: touchedFields,\n validateForm,\n values: formValues,\n };\n\n return <div className={containerClasses}>{children(renderProps)}</div>;\n }\n\n if (!isFlowInitialized && isLoading) {\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <div className={styles.loadingContainer}>\n <Spinner size=\"medium\" />\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n if (!currentFlow) {\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <AlertPrimitive variant=\"error\" className={errorClasses}>\n <AlertPrimitive.Title>{t('errors.heading')}</AlertPrimitive.Title>\n <AlertPrimitive.Description>{t('errors.signup.flow.initialization.failure')}</AlertPrimitive.Description>\n </AlertPrimitive>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n {(showTitle || showSubtitle) && (\n <CardPrimitive.Header className={styles.header}>\n {showTitle && (\n <CardPrimitive.Title level={2} className={styles.title}>\n {flowTitle || t('signup.heading')}\n </CardPrimitive.Title>\n )}\n {showSubtitle && (\n <Typography variant=\"body1\" className={styles.subtitle}>\n {flowSubtitle || t('signup.subheading')}\n </Typography>\n )}\n </CardPrimitive.Header>\n )}\n <CardPrimitive.Content>\n {flowMessages && flowMessages.length > 0 && (\n <div className={styles.flowMessagesContainer}>\n {flowMessages.map((message: any, index: number) => (\n <AlertPrimitive\n key={message.id || index}\n variant={message.type?.toLowerCase() === 'error' ? 'error' : 'info'}\n className={cx(styles.flowMessageItem, messageClasses)}\n >\n <AlertPrimitive.Description>{message.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n ))}\n </div>\n )}\n <div className={styles.contentContainer}>\n {currentFlow.data?.components && currentFlow.data.components.length > 0 ? (\n renderComponents(currentFlow.data.components)\n ) : (\n <AlertPrimitive variant=\"warning\">\n <Typography variant=\"body1\">{t('errors.signup.components.not.available')}</Typography>\n </AlertPrimitive>\n )}\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n};\n\n/**\n * BaseSignUp component that provides embedded sign-up flow for ThunderID.\n * This component handles both the presentation layer and sign-up flow logic.\n * It accepts API functions as props to maintain framework independence.\n *\n * @internal\n */\nconst BaseSignUp: FC<BaseSignUpProps> = ({showLogo = true, ...rest}: BaseSignUpProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const styles: any = useStyles(theme, colorScheme);\n\n return (\n <div>\n {showLogo && (\n <div className={styles.logoContainer}>\n <Logo size=\"large\" />\n </div>\n )}\n <FlowProvider>\n <BaseSignUpContent showLogo={showLogo} {...rest} />\n </FlowProvider>\n </div>\n );\n};\n\nexport default BaseSignUp;\n","/**\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 {EmbeddedFlowComponentV2 as EmbeddedFlowComponent} from '@thunderid/browser';\n\n/**\n * Result of heading extraction from flow components\n */\nexport interface HeadingExtractionResult {\n heading: EmbeddedFlowComponent | null;\n subheading: EmbeddedFlowComponent | null;\n}\n\n/**\n * Complete result of authentication component heading extraction\n */\nexport interface AuthComponentHeadingsResult {\n componentsWithoutHeadings: EmbeddedFlowComponent[];\n headingComponents: HeadingExtractionResult;\n subtitle: string;\n title: string;\n}\n\n/**\n * Extracts heading and subheading components from authentication flow components\n * and provides resolved title/subtitle text with fallback logic.\n *\n * This utility helps maintain consistent heading extraction across authentication\n * components (SignIn, SignUp, etc.) by identifying heading components within the\n * flow structure and providing clean fallback behavior.\n *\n * @param components - Array of flow components to search\n * @param flowTitle - Title from flow context (highest priority)\n * @param flowSubtitle - Subtitle from flow context (highest priority)\n * @param defaultTitle - Default title fallback (lowest priority)\n * @param defaultSubtitle - Default subtitle fallback (lowest priority)\n * @returns Object with resolved title and subtitle text, plus filtered components\n *\n * @example\n * ```typescript\n * const result = getAuthComponentHeadings(\n * components,\n * flowTitle,\n * flowSubtitle,\n * t('signin.heading'),\n * t('signin.subheading')\n * );\n *\n * // Use resolved titles\n * <Card.Title>{result.title}</Card.Title>\n * <Typography>{result.subtitle}</Typography>\n *\n * // Render filtered components (without headings)\n * renderComponents(result.componentsWithoutHeadings);\n * ```\n */\nconst getAuthComponentHeadings = (\n components: EmbeddedFlowComponent[],\n flowTitle?: string,\n flowSubtitle?: string,\n defaultTitle?: string,\n defaultSubtitle?: string,\n): AuthComponentHeadingsResult => {\n let heading: EmbeddedFlowComponent | null = null;\n let subheading: EmbeddedFlowComponent | null = null;\n\n /**\n * Recursively search for heading components\n */\n const findHeadings = (comps: EmbeddedFlowComponent[]): void => {\n for (const component of comps) {\n if (component.type === 'TEXT' && component.variant && component.variant.startsWith('HEADING_')) {\n if (!heading) {\n heading = component;\n } else if (!subheading) {\n subheading = component;\n break; // We found both, no need to continue\n }\n }\n if (component.components && component.components.length > 0) {\n findHeadings(component.components);\n if (heading && subheading) break; // Early exit if both found\n }\n }\n };\n\n /**\n * Filter out heading components from the flow\n */\n const filterComponents = (comps: EmbeddedFlowComponent[]): EmbeddedFlowComponent[] => {\n let foundHeadings = 0;\n const maxHeadings = 2;\n\n const filter = (items: EmbeddedFlowComponent[]): EmbeddedFlowComponent[] =>\n items.reduce((acc: EmbeddedFlowComponent[], component: EmbeddedFlowComponent) => {\n if (\n foundHeadings < maxHeadings &&\n component.type === 'TEXT' &&\n component.variant &&\n component.variant.startsWith('HEADING_')\n ) {\n foundHeadings += 1;\n return acc;\n }\n\n if (component.components && component.components.length > 0) {\n const filteredNestedComponents: EmbeddedFlowComponent[] = filter(component.components);\n if (filteredNestedComponents.length > 0) {\n acc.push({\n ...component,\n components: filteredNestedComponents,\n });\n }\n } else {\n acc.push(component);\n }\n\n return acc;\n }, []);\n\n return filter(comps);\n };\n\n /**\n * Extract text content from a component\n */\n const getComponentText = (component: EmbeddedFlowComponent | null): string => {\n if (!component) return '';\n return component.label || '';\n };\n\n findHeadings(components);\n\n const headingText: string = getComponentText(heading);\n const subheadingText: string = getComponentText(subheading);\n\n const result: AuthComponentHeadingsResult = {\n componentsWithoutHeadings: filterComponents(components),\n headingComponents: {heading, subheading},\n subtitle: flowSubtitle || subheadingText || defaultSubtitle || '',\n title: flowTitle || headingText || defaultTitle || '',\n };\n\n return result;\n};\n\nexport default getAuthComponentHeadings;\n","/**\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 {cx} from '@emotion/css';\nimport {\n EmbeddedFlowExecuteRequestPayload,\n EmbeddedFlowExecuteResponse,\n EmbeddedFlowStatus,\n EmbeddedFlowResponseType,\n withVendorCSSClassPrefix,\n EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType,\n createPackageComponentLogger,\n Preferences,\n} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useCallback, useContext, useEffect, useRef, useState} from 'react';\nimport ComponentRendererContext, {\n ComponentRendererMap,\n} from '../../../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport FlowProvider from '../../../../../contexts/Flow/FlowProvider';\nimport useFlow from '../../../../../contexts/Flow/useFlow';\nimport ComponentPreferencesContext from '../../../../../contexts/I18n/ComponentPreferencesContext';\nimport useTheme from '../../../../../contexts/Theme/useTheme';\nimport useThunderID from '../../../../../contexts/ThunderID/useThunderID';\nimport {useForm, FormField} from '../../../../../hooks/useForm';\nimport useTranslation from '../../../../../hooks/useTranslation';\nimport {normalizeFlowResponse, extractErrorMessage} from '../../../../../utils/v2/flowTransformer';\nimport getAuthComponentHeadings from '../../../../../utils/v2/getAuthComponentHeadings';\nimport {handlePasskeyRegistration} from '../../../../../utils/v2/passkey';\nimport AlertPrimitive from '../../../../primitives/Alert/Alert';\n// eslint-disable-next-line import/no-named-as-default\nimport CardPrimitive, {CardProps} from '../../../../primitives/Card/Card';\nimport Logo from '../../../../primitives/Logo/Logo';\nimport Spinner from '../../../../primitives/Spinner/Spinner';\nimport Typography from '../../../../primitives/Typography/Typography';\nimport {renderSignUpComponents} from '../../AuthOptionFactory';\nimport useStyles from '../BaseSignUp.styles';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'BaseSignUp',\n);\n\n/**\n * State for tracking passkey registration\n */\ninterface PasskeyState {\n actionId: string | null;\n creationOptions: string | null;\n error: Error | null;\n executionId: string | null;\n isActive: boolean;\n}\n\n/**\n * Render props for custom UI rendering\n */\nexport interface BaseSignUpRenderProps {\n /**\n * Flow components\n */\n components: any[];\n\n /**\n * API error (if any)\n */\n error?: Error | null;\n\n /**\n * Field validation errors\n */\n fieldErrors: Record<string, string>;\n\n /**\n * Function to handle input changes\n */\n handleInputChange: (name: string, value: string) => void;\n\n /**\n * Function to handle form submission\n */\n handleSubmit: (component: any, data?: Record<string, any>) => Promise<void>;\n\n /**\n * Loading state\n */\n isLoading: boolean;\n\n /**\n * Whether the form is valid\n */\n isValid: boolean;\n\n /**\n * Flow messages\n */\n messages: {message: string; type: string}[];\n\n /**\n * Flow subtitle\n */\n subtitle: string;\n\n /**\n * Flow title\n */\n title: string;\n\n /**\n * Touched fields\n */\n touched: Record<string, boolean>;\n\n /**\n * Function to validate the form\n */\n validateForm: () => {fieldErrors: Record<string, string>; isValid: boolean};\n\n /**\n * Form values\n */\n values: Record<string, string>;\n}\n\n/**\n * Props for the BaseSignUp component.\n */\nexport interface BaseSignUpProps {\n /**\n * URL to redirect after successful sign-up.\n */\n afterSignUpUrl?: string;\n\n /**\n * Custom CSS class name for the submit button.\n */\n buttonClassName?: string;\n\n /**\n * Render props function for custom UI\n */\n children?: (props: BaseSignUpRenderProps) => ReactNode;\n\n /**\n * Custom CSS class name for the form container.\n */\n className?: string;\n\n /**\n * Error object to display\n */\n error?: Error | null;\n\n /**\n * Custom CSS class name for error messages.\n */\n errorClassName?: string;\n\n /**\n * Custom CSS class name for form inputs.\n */\n inputClassName?: string;\n\n isInitialized?: boolean;\n\n /**\n * Custom CSS class name for info messages.\n */\n messageClassName?: string;\n\n /**\n * Callback function called when the sign-up flow completes and requires redirection.\n * This allows platform-specific handling of redirects (e.g., Next.js router.push).\n * @param response - The response from the sign-up flow containing the redirect URL, etc.\n */\n onComplete?: (response: EmbeddedFlowExecuteResponse) => void;\n\n /**\n * Callback function called when sign-up fails.\n * @param error - The error that occurred during sign-up.\n */\n onError?: (error: Error) => void;\n\n /**\n * Callback function called when sign-up flow status changes.\n * @param response - The current sign-up response.\n */\n onFlowChange?: (response: EmbeddedFlowExecuteResponse) => void;\n\n /**\n * Function to initialize sign-up flow.\n * @returns Promise resolving to the initial sign-up response.\n */\n onInitialize?: (payload?: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse>;\n\n /**\n * Function to handle sign-up steps.\n * @param payload - The sign-up payload.\n * @returns Promise resolving to the sign-up response.\n */\n onSubmit?: (payload: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse>;\n /**\n * Component-level preferences to override global i18n and theme settings.\n * Preferences are deep-merged with global ones, with component preferences\n * taking precedence. Affects this component and all its descendants.\n */\n preferences?: Preferences;\n\n /**\n * Whether to redirect after sign-up.\n */\n shouldRedirectAfterSignUp?: boolean;\n\n /**\n * Whether to show the logo.\n */\n showLogo?: boolean;\n\n /**\n * Whether to show the subtitle.\n */\n showSubtitle?: boolean;\n\n /**\n * Whether to show the title.\n */\n showTitle?: boolean;\n\n /**\n * Size variant for the component.\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Theme variant for the component.\n */\n variant?: CardProps['variant'];\n}\n\n/**\n * Internal component that consumes FlowContext and renders the sign-up UI.\n */\nconst BaseSignUpContent: FC<BaseSignUpProps> = ({\n afterSignUpUrl,\n onInitialize,\n onSubmit,\n onError,\n onFlowChange,\n onComplete,\n error: externalError,\n className = '',\n inputClassName = '',\n buttonClassName = '',\n errorClassName = '',\n messageClassName = '',\n size = 'medium',\n variant = 'outlined',\n isInitialized,\n children,\n showTitle = true,\n showSubtitle = true,\n}: BaseSignUpProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const customRenderers: ComponentRendererMap = useContext(ComponentRendererContext);\n const {t} = useTranslation();\n const {subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages} = useFlow();\n const {meta, isInitialized: isSdkInitialized, getStorageManager} = useThunderID();\n const styles: any = useStyles(theme, colorScheme);\n\n const [isLoading, setIsLoading] = useState(false);\n const [isFlowInitialized, setIsFlowInitialized] = useState(false);\n const [currentFlow, setCurrentFlow] = useState<EmbeddedFlowExecuteResponse | null>(null);\n const [apiError, setApiError] = useState<Error | null>(null);\n const [passkeyState, setPasskeyState] = useState<PasskeyState>({\n actionId: null,\n creationOptions: null,\n error: null,\n executionId: null,\n isActive: false,\n });\n const challengeTokenRef: any = useRef<string | null>(null);\n\n const initializationAttemptedRef: any = useRef(false);\n const passkeyProcessedRef: any = useRef(false);\n\n /**\n * Restore any challenge token persisted before an OAuth redirect.\n */\n useEffect(() => {\n if (!isSdkInitialized) return;\n\n (async (): Promise<void> => {\n try {\n const storageManager: any = await getStorageManager();\n const tempData: any = await storageManager?.getTemporaryData();\n if (tempData?.challengeToken) {\n challengeTokenRef.current = tempData.challengeToken as string;\n }\n } catch {\n // StorageManager unavailable — continue without persisted token\n }\n })();\n }, [isSdkInitialized]);\n\n /**\n * Updates challengeTokenRef immediately (stale-closure safe) and persists via\n * the provider's StorageManager so the token survives OAuth redirects.\n */\n const setChallengeToken = async (challengeToken: string | null): Promise<void> => {\n challengeTokenRef.current = challengeToken;\n try {\n const storageManager: any = await getStorageManager();\n if (storageManager) {\n if (challengeToken) {\n await storageManager.setTemporaryDataParameter('challengeToken', challengeToken);\n } else {\n await storageManager.removeTemporaryDataParameter('challengeToken');\n }\n }\n } catch {\n logger.warn('Failed to persist challenge token in storage.');\n }\n };\n\n /**\n * Handle error responses and extract meaningful error messages\n * Uses the transformer's extractErrorMessage function.\n */\n const handleError: any = useCallback(\n (error: any) => {\n // Extract error message from response failureReason or use extractErrorMessage\n const errorMessage: string = error?.failureReason || extractErrorMessage(error, t);\n\n // Set the API error state\n setApiError(error instanceof Error ? error : new Error(errorMessage));\n\n // Clear existing messages and add the error message\n clearMessages();\n addMessage({\n message: errorMessage,\n type: 'error',\n });\n },\n [t, addMessage, clearMessages],\n );\n\n /**\n * Normalize flow response to ensure component-driven format\n * Uses normalizeFlowResponse for modern API format responses\n */\n const normalizeFlowResponseLocal: any = useCallback(\n (response: EmbeddedFlowExecuteResponse): EmbeddedFlowExecuteResponse => {\n // If response already has components, return as-is\n if (response?.data?.components && Array.isArray(response.data.components)) {\n return response;\n }\n\n // Use the transformer to handle meta.components structure\n if (response?.data) {\n const {components} = normalizeFlowResponse(\n response,\n t,\n {\n defaultErrorKey: 'components.signUp.errors.generic',\n resolveTranslations: false,\n },\n meta,\n );\n\n return {\n ...response,\n data: {\n ...response.data,\n components: components as any,\n },\n };\n }\n\n // Return as-is if no transformation needed\n return response;\n },\n [t, children],\n );\n\n /**\n * Extract form fields from flow components\n */\n const extractFormFields: any = useCallback(\n (components: any[]): FormField[] => {\n const fields: FormField[] = [];\n\n const processComponents = (comps: any[]): any => {\n comps.forEach((component: any) => {\n if (\n component.type === EmbeddedFlowComponentType.TextInput ||\n component.type === EmbeddedFlowComponentType.PasswordInput ||\n component.type === EmbeddedFlowComponentType.EmailInput ||\n component.type === EmbeddedFlowComponentType.Select\n ) {\n // Use component.ref (mapped identifier) as the field name instead of component.id\n // This ensures form field names match what the input components use\n const fieldName: any = component.ref || component.id;\n\n fields.push({\n initialValue: '',\n name: fieldName,\n required: component.required || false,\n validator: (value: string) => {\n if (component.required && (!value || value.trim() === '')) {\n return t('validations.required.field.error');\n }\n // Add email validation if it's an email field\n if (\n (component.type === EmbeddedFlowComponentType.EmailInput || component.variant === 'EMAIL') &&\n value &&\n !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)\n ) {\n return t('field.email.invalid');\n }\n\n return null;\n },\n });\n }\n\n if (component.components && Array.isArray(component.components)) {\n processComponents(component.components);\n }\n });\n };\n\n processComponents(components);\n return fields;\n },\n [t],\n );\n\n const formFields: any = currentFlow?.data?.components ? extractFormFields(currentFlow.data.components) : [];\n\n const form: any = useForm<Record<string, string>>({\n fields: formFields,\n initialValues: {},\n requiredMessage: t('validations.required.field.error'),\n validateOnBlur: true,\n validateOnChange: false,\n });\n\n const {\n values: formValues,\n touched: touchedFields,\n errors: formErrors,\n isValid: isFormValid,\n setValue: setFormValue,\n setTouched: setFormTouched,\n validateForm,\n touchAllFields,\n reset: resetForm,\n } = form;\n\n /**\n * Setup form fields based on the current flow.\n */\n const setupFormFields: any = useCallback(\n (flowResponse: EmbeddedFlowExecuteResponse) => {\n const fields: any = extractFormFields(flowResponse.data?.components || []);\n const initialValues: Record<string, string> = {};\n\n fields.forEach((field: any) => {\n initialValues[field.name] = field.initialValue || '';\n });\n\n resetForm();\n\n Object.keys(initialValues).forEach((key: any) => {\n setFormValue(key, initialValues[key]);\n });\n },\n [extractFormFields, resetForm, setFormValue],\n );\n\n /**\n * Handle input value changes.\n * Only updates the value without marking as touched.\n * Touched state is set on blur to avoid premature validation.\n */\n const handleInputChange = (name: string, value: string): void => {\n setFormValue(name, value);\n };\n\n /**\n * Handle input blur event.\n * Marks the field as touched, which triggers validation.\n */\n const handleInputBlur = (name: string): void => {\n setFormTouched(name, true);\n };\n\n /**\n * Check if the response contains a redirection URL and perform the redirect if necessary.\n * @param response - The sign-up response\n * @returns true if a redirect was performed, false otherwise\n */\n const handleRedirectionIfNeeded = (response: EmbeddedFlowExecuteResponse): boolean => {\n if (response?.type === EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL) {\n /**\n * Open a popup window to handle redirection prompts for social sign-up\n */\n const redirectUrl: any = response.data.redirectURL;\n const popup: any = window.open(redirectUrl, 'oauth_popup', 'width=500,height=600,scrollbars=yes,resizable=yes');\n\n if (!popup) {\n logger.error('Failed to open popup window');\n return false;\n }\n\n let hasProcessedCallback: any = false; // Prevent multiple processing\n let popupMonitor: ReturnType<typeof setInterval> | null = null;\n let messageHandler: ((event: MessageEvent) => Promise<void>) | null = null;\n\n /**\n * Clean up event listener and popup monitor\n */\n const cleanup = (): void => {\n if (messageHandler) {\n window.removeEventListener('message', messageHandler);\n }\n if (popupMonitor) {\n clearInterval(popupMonitor);\n }\n };\n\n /**\n * Add an event listener to the window to capture the message from the popup\n */\n messageHandler = async function messageEventHandler(event: MessageEvent): Promise<void> {\n /**\n * Check if the message is from our popup window\n */\n if (event.source !== popup) {\n return;\n }\n\n /**\n * Check the origin of the message to ensure it's from a trusted source\n */\n const expectedOrigin: any = afterSignUpUrl ? new URL(afterSignUpUrl).origin : window.location.origin;\n if (event.origin !== expectedOrigin && event.origin !== window.location.origin) {\n return;\n }\n\n const {code, state} = event.data;\n\n if (code && state) {\n hasProcessedCallback = true;\n\n const payload: EmbeddedFlowExecuteRequestPayload = {\n ...((currentFlow as any).executionId && {executionId: (currentFlow as any).executionId}),\n action: '',\n flowType: (currentFlow as any).flowType || 'REGISTRATION',\n inputs: {\n code,\n state,\n },\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n } as any;\n\n try {\n const continueResponse: any = await onSubmit(payload);\n onFlowChange?.(continueResponse);\n\n if (continueResponse.flowStatus === EmbeddedFlowStatus.Complete) {\n onComplete?.(continueResponse);\n } else if (continueResponse.flowStatus === EmbeddedFlowStatus.Incomplete) {\n setCurrentFlow(continueResponse);\n setupFormFields(continueResponse);\n }\n\n popup.close();\n cleanup();\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n popup.close();\n cleanup();\n }\n }\n };\n\n window.addEventListener('message', messageHandler);\n\n /**\n * Monitor popup for closure and URL changes\n */\n popupMonitor = setInterval(async () => {\n try {\n if (popup.closed) {\n cleanup();\n return;\n }\n\n // Skip if we've already processed a callback\n if (hasProcessedCallback) {\n return;\n }\n\n // Try to access popup URL to check for callback\n try {\n const popupUrl: any = popup.location.href;\n\n // Check if we've been redirected to the callback URL\n if (popupUrl && (popupUrl.includes('code=') || popupUrl.includes('error='))) {\n hasProcessedCallback = true; // Set flag to prevent multiple processing\n\n // Parse the URL for OAuth parameters\n const url: any = new URL(popupUrl);\n const code: any = url.searchParams.get('code');\n const state: any = url.searchParams.get('state');\n const error: any = url.searchParams.get('error');\n\n if (error) {\n logger.error('OAuth error:');\n popup.close();\n cleanup();\n return;\n }\n\n if (code && state) {\n const payload: EmbeddedFlowExecuteRequestPayload = {\n ...((currentFlow as any).executionId && {executionId: (currentFlow as any).executionId}),\n action: '',\n flowType: (currentFlow as any).flowType || 'REGISTRATION',\n inputs: {\n code,\n state,\n },\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n } as any;\n\n try {\n const continueResponse: any = await onSubmit(payload);\n onFlowChange?.(continueResponse);\n\n if (continueResponse.flowStatus === EmbeddedFlowStatus.Complete) {\n onComplete?.(continueResponse);\n } else if (continueResponse.flowStatus === EmbeddedFlowStatus.Incomplete) {\n setCurrentFlow(continueResponse);\n setupFormFields(continueResponse);\n }\n\n popup.close();\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n popup.close();\n }\n }\n }\n } catch (e) {\n // Cross-origin error is expected when popup navigates to OAuth provider\n // This is normal and we can ignore it\n }\n } catch (e) {\n logger.error('Error monitoring popup:');\n }\n }, 1000);\n\n return true;\n }\n\n return false;\n };\n\n /**\n * Handle component submission (for buttons outside forms).\n */\n const handleSubmit = async (component: any, data?: Record<string, any>, skipValidation?: boolean): Promise<void> => {\n if (!currentFlow) {\n return;\n }\n\n // Only validate for form submit actions, skip for social/trigger actions\n if (!skipValidation) {\n // Mark all fields as touched before validation\n touchAllFields();\n\n const validation: ReturnType<typeof validateForm> = validateForm();\n\n if (!validation.isValid) {\n return;\n }\n }\n\n setIsLoading(true);\n setApiError(null);\n clearMessages();\n\n try {\n // Filter out empty or undefined input values\n const filteredInputs: Record<string, any> = {};\n if (data) {\n Object.entries(data).forEach(([key, value]: [string, any]) => {\n if (value !== null && value !== undefined && value !== '') {\n filteredInputs[key] = value;\n }\n });\n }\n\n const payload: EmbeddedFlowExecuteRequestPayload = {\n ...((currentFlow as any).executionId && {executionId: (currentFlow as any).executionId}),\n flowType: (currentFlow as any).flowType || 'REGISTRATION',\n ...(component.id && {action: component.id}),\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n inputs: filteredInputs,\n } as any;\n\n const rawResponse: any = await onSubmit(payload);\n const response: any = normalizeFlowResponseLocal(rawResponse);\n onFlowChange?.(response);\n\n await setChallengeToken(response.challengeToken ?? null);\n\n if (response.flowStatus === EmbeddedFlowStatus.Complete) {\n onComplete?.(response);\n return;\n }\n\n if (response.flowStatus === EmbeddedFlowStatus.Incomplete) {\n if (handleRedirectionIfNeeded(response)) {\n return;\n }\n\n if (response.data?.additionalData?.passkeyCreationOptions) {\n const {passkeyCreationOptions}: any = response.data.additionalData;\n const effectiveExecutionIdForPasskey: any = response.executionId || (currentFlow as any)?.executionId;\n\n // Reset passkey processed ref to allow processing\n passkeyProcessedRef.current = false;\n\n // Set passkey state to trigger the passkey\n setPasskeyState({\n actionId: component.id || 'submit',\n creationOptions: passkeyCreationOptions,\n error: null,\n executionId: effectiveExecutionIdForPasskey,\n isActive: true,\n });\n setIsLoading(false);\n return;\n }\n setCurrentFlow(response);\n setupFormFields(response);\n }\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n } finally {\n setIsLoading(false);\n }\n };\n\n /**\n * Handle passkey registration when passkey state becomes active.\n * This effect auto-triggers the browser passkey popup and submits the result.\n */\n useEffect(() => {\n if (!passkeyState.isActive || !passkeyState.creationOptions || !passkeyState.executionId) {\n return;\n }\n\n // Prevent re-processing\n if (passkeyProcessedRef.current) {\n return;\n }\n passkeyProcessedRef.current = true;\n\n const performPasskeyRegistration = async (): Promise<void> => {\n const passkeyResponse: any = await handlePasskeyRegistration(passkeyState.creationOptions);\n const passkeyResponseObj: any = JSON.parse(passkeyResponse);\n\n const inputs: any = {\n attestationObject: passkeyResponseObj.response.attestationObject,\n clientDataJSON: passkeyResponseObj.response.clientDataJSON,\n credentialId: passkeyResponseObj.id,\n };\n\n // After successful registration, submit the result to the server\n const payload: EmbeddedFlowExecuteRequestPayload = {\n actionId: passkeyState.actionId || 'submit',\n executionId: passkeyState.executionId,\n flowType: (currentFlow as any)?.flowType || 'REGISTRATION',\n inputs,\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n } as any;\n\n const nextResponse: any = await onSubmit(payload);\n const processedResponse: any = normalizeFlowResponseLocal(nextResponse);\n onFlowChange?.(processedResponse);\n\n if (processedResponse.flowStatus === EmbeddedFlowStatus.Complete) {\n onComplete?.(processedResponse);\n } else {\n setCurrentFlow(processedResponse);\n setupFormFields(processedResponse);\n }\n };\n\n performPasskeyRegistration()\n .then(() => {\n setPasskeyState({actionId: null, creationOptions: null, error: null, executionId: null, isActive: false});\n })\n .catch((error: any) => {\n setPasskeyState((prev: any) => ({...prev, error: error as Error, isActive: false}));\n handleError(error);\n onError?.(error as Error);\n });\n }, [passkeyState.isActive, passkeyState.creationOptions, passkeyState.executionId]);\n\n const containerClasses: any = cx(\n [\n withVendorCSSClassPrefix('signup'),\n withVendorCSSClassPrefix(`signup--${size}`),\n withVendorCSSClassPrefix(`signup--${variant}`),\n ],\n className,\n );\n\n const inputClasses: any = cx(\n [\n withVendorCSSClassPrefix('signup__input'),\n size === 'small' && withVendorCSSClassPrefix('signup__input--small'),\n size === 'large' && withVendorCSSClassPrefix('signup__input--large'),\n ],\n inputClassName,\n );\n\n const buttonClasses: any = cx(\n [\n withVendorCSSClassPrefix('signup__button'),\n size === 'small' && withVendorCSSClassPrefix('signup__button--small'),\n size === 'large' && withVendorCSSClassPrefix('signup__button--large'),\n ],\n buttonClassName,\n );\n\n const errorClasses: any = cx([withVendorCSSClassPrefix('signup__error')], errorClassName);\n\n const messageClasses: any = cx([withVendorCSSClassPrefix('signup__messages')], messageClassName);\n\n /**\n * Render form components based on flow data using the factory\n */\n const renderComponents: any = useCallback(\n (components: any[]): ReactElement[] =>\n renderSignUpComponents(\n components,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n handleInputChange,\n {\n _customRenderers: customRenderers,\n _theme: theme,\n buttonClassName: buttonClasses,\n inputClassName: inputClasses,\n onInputBlur: handleInputBlur,\n onSubmit: handleSubmit,\n size,\n variant,\n },\n ),\n [\n customRenderers,\n formValues,\n touchedFields,\n formErrors,\n isFormValid,\n isLoading,\n size,\n theme,\n variant,\n inputClasses,\n buttonClasses,\n handleSubmit,\n handleInputBlur,\n ],\n );\n\n /**\n * Parse URL parameters to check for OAuth redirect state.\n */\n const getUrlParams = (): any => {\n const urlParams: any = new URL(window?.location?.href ?? '').searchParams;\n return {\n code: urlParams.get('code'),\n error: urlParams.get('error'),\n state: urlParams.get('state'),\n };\n };\n\n // Initialize the flow on component mount\n useEffect(() => {\n // Skip initialization if we're in an OAuth redirect state.\n const urlParams: any = getUrlParams();\n if (urlParams.code || urlParams.state) {\n return;\n }\n\n if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {\n initializationAttemptedRef.current = true;\n\n (async (): Promise<void> => {\n setIsLoading(true);\n setApiError(null);\n clearMessages();\n\n try {\n const rawResponse: any = await onInitialize();\n const response: any = normalizeFlowResponseLocal(rawResponse);\n\n await setChallengeToken(response.challengeToken ?? null);\n setCurrentFlow(response);\n setIsFlowInitialized(true);\n onFlowChange?.(response);\n\n if (response.flowStatus === EmbeddedFlowStatus.Complete) {\n onComplete?.(response);\n return;\n }\n\n if (response.flowStatus === EmbeddedFlowStatus.Incomplete) {\n setupFormFields(response);\n }\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n } finally {\n setIsLoading(false);\n }\n })();\n }\n }, [\n isInitialized,\n isFlowInitialized,\n onInitialize,\n onComplete,\n onError,\n onFlowChange,\n setupFormFields,\n normalizeFlowResponseLocal,\n afterSignUpUrl,\n t,\n ]);\n\n // If render props are provided, use them\n if (children) {\n const renderProps: BaseSignUpRenderProps = {\n components: currentFlow?.data?.components || [],\n error: apiError,\n fieldErrors: formErrors,\n handleInputChange,\n handleSubmit,\n isLoading,\n isValid: isFormValid,\n messages: flowMessages || [],\n subtitle: flowSubtitle || t('signup.subheading'),\n title: flowTitle || t('signup.heading'),\n touched: touchedFields,\n validateForm: () => {\n const result: any = validateForm();\n return {fieldErrors: result.errors, isValid: result.isValid};\n },\n values: formValues,\n };\n\n return <div className={containerClasses}>{children(renderProps)}</div>;\n }\n\n if (!isFlowInitialized && isLoading) {\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <div className={styles.loadingContainer}>\n <Spinner size=\"medium\" />\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n if (!currentFlow) {\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <AlertPrimitive variant=\"error\" className={errorClasses}>\n <AlertPrimitive.Title>{t('errors.heading')}</AlertPrimitive.Title>\n <AlertPrimitive.Description>{t('errors.signup.flow.initialization.failure')}</AlertPrimitive.Description>\n </AlertPrimitive>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n // Extract heading and subheading components and filter them from the main components\n const componentsToRender: any = currentFlow.data?.components || [];\n const {title, subtitle, componentsWithoutHeadings} = getAuthComponentHeadings(\n componentsToRender,\n flowTitle,\n flowSubtitle,\n t('signup.heading'),\n t('signup.subheading'),\n );\n\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n {(showTitle || showSubtitle) && (\n <CardPrimitive.Header className={styles.header}>\n {showTitle && (\n <CardPrimitive.Title level={2} className={styles.title}>\n {title}\n </CardPrimitive.Title>\n )}\n {showSubtitle && (\n <Typography variant=\"body1\" className={styles.subtitle}>\n {subtitle}\n </Typography>\n )}\n </CardPrimitive.Header>\n )}\n <CardPrimitive.Content>\n {externalError && (\n <div className={styles.flowMessagesContainer}>\n <AlertPrimitive variant=\"error\" className={cx(styles.flowMessageItem, messageClasses)}>\n <AlertPrimitive.Description>{externalError.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n </div>\n )}\n {flowMessages && flowMessages.length > 0 && (\n <div className={styles.flowMessagesContainer}>\n {flowMessages.map((message: any, index: number) => (\n <AlertPrimitive\n key={message.id || index}\n variant={message.type?.toLowerCase() === 'error' ? 'error' : 'info'}\n className={cx(styles.flowMessageItem, messageClasses)}\n >\n <AlertPrimitive.Description>{message.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n ))}\n </div>\n )}\n <div className={styles.contentContainer}>\n {componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? (\n renderComponents(componentsWithoutHeadings)\n ) : (\n <AlertPrimitive variant=\"warning\">\n <Typography variant=\"body1\">{t('errors.signup.components.not.available')}</Typography>\n </AlertPrimitive>\n )}\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n};\n\n/**\n * BaseSignUp component that provides embedded sign-up flow for ThunderIDV2.\n * This component handles both the presentation layer and sign-up flow logic.\n * It accepts API functions as props to maintain framework independence.\n */\nconst BaseSignUp: FC<BaseSignUpProps> = ({preferences, showLogo = true, ...rest}: BaseSignUpProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const styles: any = useStyles(theme, colorScheme);\n\n const content: ReactElement = (\n <div>\n {showLogo && (\n <div className={styles.logoContainer}>\n <Logo size=\"large\" />\n </div>\n )}\n <FlowProvider>\n <BaseSignUpContent showLogo={showLogo} {...rest} />\n </FlowProvider>\n </div>\n );\n\n if (!preferences) return content;\n\n return <ComponentPreferencesContext.Provider value={preferences}>{content}</ComponentPreferencesContext.Provider>;\n};\n\nexport default BaseSignUp;\n","/**\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 {Platform} from '@thunderid/browser';\nimport {FC} from 'react';\nimport BaseSignUpV1, {BaseSignUpProps as BaseSignUpV1Props} from './v1/BaseSignUp';\nimport BaseSignUpV2, {BaseSignUpProps as BaseSignUpV2Props} from './v2/BaseSignUp';\nimport useThunderID from '../../../../contexts/ThunderID/useThunderID';\n\n/**\n * Props for the BaseSignUp component.\n * Extends BaseSignUpV1Props & BaseSignUpV2Props for full compatibility with both React BaseSignUp components.\n */\nexport type BaseSignUpProps = BaseSignUpV1Props | BaseSignUpV2Props;\n\nconst BaseSignUp: FC<BaseSignUpProps> = (props: BaseSignUpProps) => {\n const {platform} = useThunderID();\n\n if (platform === Platform.ThunderID) {\n return <BaseSignUpV2 {...(props as BaseSignUpV2Props)} />;\n }\n\n return <BaseSignUpV1 {...(props as BaseSignUpV1Props)} />;\n};\n\nexport default BaseSignUp;\n","/**\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 EmbeddedFlowExecuteRequestPayload,\n EmbeddedFlowExecuteResponse,\n EmbeddedFlowResponseType,\n EmbeddedFlowType,\n} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode} from 'react';\n// eslint-disable-next-line import/no-named-as-default\nimport BaseSignUp, {BaseSignUpProps, BaseSignUpRenderProps} from './BaseSignUp';\nimport useThunderID from '../../../../../contexts/ThunderID/useThunderID';\n\n/**\n * Render props function parameters (re-exported from BaseSignUp for convenience)\n */\nexport type SignUpRenderProps = BaseSignUpRenderProps;\n\n/**\n * Props for the SignUp component.\n */\nexport type SignUpProps = BaseSignUpProps & {\n /**\n * Render props function for custom UI\n */\n children?: (props: SignUpRenderProps) => ReactNode;\n};\n\n/**\n * A styled SignUp component for ThunderID platform that provides embedded sign-up flow with pre-built styling.\n * This component handles the API calls for sign-up and delegates UI logic to BaseSignUp.\n */\nconst SignUp: FC<SignUpProps> = ({\n className,\n size = 'medium',\n afterSignUpUrl,\n onError,\n onComplete,\n shouldRedirectAfterSignUp = true,\n children,\n ...rest\n}: SignUpProps): ReactElement => {\n const {signUp, isInitialized} = useThunderID();\n\n /**\n * Initialize the sign-up flow.\n */\n const handleInitialize = async (\n payload?: EmbeddedFlowExecuteRequestPayload,\n ): Promise<EmbeddedFlowExecuteResponse> => {\n // Uses simple initialization without applicationId\n const initialPayload: any = payload || {\n flowType: EmbeddedFlowType.Registration,\n };\n\n return (await signUp(initialPayload)) as EmbeddedFlowExecuteResponse;\n };\n\n /**\n * Handle sign-up steps.\n */\n const handleOnSubmit = async (payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse> =>\n (await signUp(payload)) as EmbeddedFlowExecuteResponse;\n\n /**\n * Handle successful sign-up and redirect.\n */\n const handleComplete = (response: EmbeddedFlowExecuteResponse): any => {\n onComplete?.(response);\n\n // For non-redirection responses (regular sign-up completion), handle redirect if configured\n if (shouldRedirectAfterSignUp && response?.type !== EmbeddedFlowResponseType.Redirection && afterSignUpUrl) {\n window.location.href = afterSignUpUrl;\n }\n\n // For redirection responses (social sign-up), handle direct redirect\n if (\n shouldRedirectAfterSignUp &&\n response?.type === EmbeddedFlowResponseType.Redirection &&\n response?.data?.redirectURL &&\n !response.data.redirectURL.includes('oauth') && // Not a social provider redirect\n !response.data.redirectURL.includes('auth') // Not an auth provider redirect\n ) {\n window.location.href = response.data.redirectURL;\n }\n };\n\n return (\n <BaseSignUp\n afterSignUpUrl={afterSignUpUrl}\n onInitialize={handleInitialize}\n onSubmit={handleOnSubmit}\n onError={onError}\n onComplete={handleComplete}\n className={className}\n size={size}\n isInitialized={isInitialized}\n children={children}\n showLogo={true}\n showTitle={false}\n showSubtitle={false}\n {...rest}\n />\n );\n};\n\nexport default SignUp;\n","/**\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 EmbeddedFlowExecuteRequestPayload,\n EmbeddedFlowExecuteResponse,\n EmbeddedFlowResponseType,\n EmbeddedFlowType,\n} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode} from 'react';\n// eslint-disable-next-line import/no-named-as-default\nimport BaseSignUp, {BaseSignUpProps, BaseSignUpRenderProps} from './BaseSignUp';\nimport useThunderID from '../../../../../contexts/ThunderID/useThunderID';\n\n/**\n * Render props function parameters (re-exported from BaseSignUp for convenience)\n */\nexport type SignUpRenderProps = BaseSignUpRenderProps;\n\n/**\n * Props for the SignUp component.\n */\nexport type SignUpProps = BaseSignUpProps & {\n /**\n * Render props function for custom UI\n */\n children?: (props: SignUpRenderProps) => ReactNode;\n};\n\n/**\n * A styled SignUp component for ThunderIDV2 (AKA Thunder) platform that provides embedded sign-up flow with pre-built styling.\n * This component handles the API calls for sign-up and delegates UI logic to BaseSignUp.\n */\nconst SignUp: FC<SignUpProps> = ({\n className,\n size = 'medium',\n afterSignUpUrl,\n onError,\n onComplete,\n shouldRedirectAfterSignUp = true,\n children,\n ...rest\n}: SignUpProps): ReactElement => {\n const {signUp, isInitialized, applicationId} = useThunderID();\n\n /**\n * Initialize the sign-up flow.\n */\n const handleInitialize = async (\n payload?: EmbeddedFlowExecuteRequestPayload,\n ): Promise<EmbeddedFlowExecuteResponse> => {\n const urlParams: URLSearchParams = new URL(window.location.href).searchParams;\n const applicationIdFromUrl: string = urlParams.get('applicationId');\n\n // Priority order: applicationId from context > applicationId from URL\n const effectiveApplicationId: any = applicationId || applicationIdFromUrl;\n\n const initialPayload: any = payload || {\n flowType: EmbeddedFlowType.Registration,\n ...(effectiveApplicationId && {applicationId: effectiveApplicationId}),\n };\n\n return (await signUp(initialPayload)) as EmbeddedFlowExecuteResponse;\n };\n\n /**\n * Handle sign-up steps.\n */\n const handleOnSubmit = async (payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse> =>\n (await signUp(payload)) as EmbeddedFlowExecuteResponse;\n\n /**\n * Handle successful sign-up and redirect.\n */\n const handleComplete = (response: EmbeddedFlowExecuteResponse): any => {\n onComplete?.(response);\n\n // Check if OAuth flow completed and we have a redirect URL with authorization code\n // This happens when registration completes with assertion and OAuth authorize succeeds\n const oauthRedirectUrl: any = (response as any)?.redirectUrl;\n if (shouldRedirectAfterSignUp && oauthRedirectUrl) {\n window.location.href = oauthRedirectUrl;\n return;\n }\n\n // For non-redirection responses (regular sign-up completion), handle redirect if configured\n if (shouldRedirectAfterSignUp && response?.type !== EmbeddedFlowResponseType.Redirection && afterSignUpUrl) {\n window.location.href = afterSignUpUrl;\n }\n\n // For redirection responses (social sign-up), they are handled by BaseSignUp's popup mechanism\n // and we only redirect after the OAuth flow is complete if shouldRedirectAfterSignUp is true\n if (\n shouldRedirectAfterSignUp &&\n response?.type === EmbeddedFlowResponseType.Redirection &&\n response?.data?.redirectURL &&\n !response.data.redirectURL.includes('oauth') && // Not a social provider redirect\n !response.data.redirectURL.includes('auth') // Not an auth provider redirect\n ) {\n window.location.href = response.data.redirectURL;\n }\n };\n\n return (\n <BaseSignUp\n afterSignUpUrl={afterSignUpUrl}\n onInitialize={handleInitialize}\n onSubmit={handleOnSubmit}\n onError={onError}\n onComplete={handleComplete}\n className={className}\n size={size}\n isInitialized={isInitialized}\n children={children}\n showTitle={true}\n showSubtitle={true}\n {...rest}\n />\n );\n};\n\nexport default SignUp;\n","/**\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 {Platform} from '@thunderid/browser';\nimport {FC} from 'react';\nimport SignUpV1, {SignUpProps as SignUpV1Props} from './v1/SignUp';\nimport SignUpV2, {SignUpProps as SignUpV2Props} from './v2/SignUp';\nimport useThunderID from '../../../../contexts/ThunderID/useThunderID';\n\n/**\n * Props for the SignUp component.\n * Extends SignUpV1Props & SignUpV2Props for full compatibility with both React SignUp components.\n */\nexport type SignUpProps = SignUpV1Props | SignUpV2Props;\n\n/**\n * A styled SignUp component that provides embedded sign-up flow with pre-built styling.\n * This component routes to the appropriate version-specific implementation based on the platform.\n *\n * @example\n * // Default UI\n * ```tsx\n * import { SignUp } from '@thunderid/react';\n *\n * const App = () => {\n * return (\n * <SignUp\n * onSuccess={(response) => {\n * console.log('Sign-up successful:', response);\n * // Handle successful sign-up (e.g., redirect, show confirmation)\n * }}\n * onError={(error) => {\n * console.error('Sign-up failed:', error);\n * }}\n * onComplete={(redirectUrl) => {\n * // Platform-specific redirect handling (e.g., Next.js router.push)\n * router.push(redirectUrl); // or window.location.href = redirectUrl\n * }}\n * size=\"medium\"\n * variant=\"outlined\"\n * afterSignUpUrl=\"/welcome\"\n * />\n * );\n * };\n * ```\n *\n * @example\n * // Custom UI with render props\n * ```tsx\n * import { SignUp } from '@thunderid/react';\n *\n * const App = () => {\n * return (\n * <SignUp\n * onError={(error) => console.error('Error:', error)}\n * onComplete={(response) => console.log('Success:', response)}\n * >\n * {({values, errors, handleInputChange, handleSubmit, isLoading, components}) => (\n * <div className=\"custom-signup\">\n * <h1>Custom Sign Up</h1>\n * {isLoading ? (\n * <p>Loading...</p>\n * ) : (\n * <form onSubmit={(e) => {\n * e.preventDefault();\n * handleSubmit(components[0], values);\n * }}>\n * <input\n * name=\"username\"\n * value={values.username || ''}\n * onChange={(e) => handleInputChange('username', e.target.value)}\n * />\n * {errors.username && <span>{errors.username}</span>}\n * <button type=\"submit\" disabled={isLoading}>\n * {isLoading ? 'Signing up...' : 'Sign Up'}\n * </button>\n * </form>\n * )}\n * </div>\n * )}\n * </SignUp>\n * );\n * };\n * ```\n */\nconst SignUp: FC<SignUpProps> = (props: SignUpProps) => {\n const {platform} = useThunderID();\n\n if (platform === Platform.ThunderID) {\n return <SignUpV2 {...(props as SignUpV2Props)} />;\n }\n\n return <SignUpV1 {...(props as SignUpV1Props)} />;\n};\n\nexport default SignUp;\n","/**\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 {EmbeddedFlowComponent, EmbeddedFlowComponentType} from '@thunderid/browser';\nimport {ReactElement} from 'react';\nimport {AdapterProps} from '../../../../../models/adapters';\nimport CheckboxInput from '../../../../adapters/CheckboxInput';\nimport DateInput from '../../../../adapters/DateInput';\nimport DividerComponent from '../../../../adapters/DividerComponent';\nimport EmailInput from '../../../../adapters/EmailInput';\nimport FacebookButton from '../../../../adapters/FacebookButton';\n// eslint-disable-next-line import/no-cycle\nimport FormContainer from '../../../../adapters/FormContainer';\nimport GitHubButton from '../../../../adapters/GitHubButton';\nimport GoogleButton from '../../../../adapters/GoogleButton';\nimport ImageComponent from '../../../../adapters/ImageComponent';\nimport LinkedInButton from '../../../../adapters/LinkedInButton';\nimport MicrosoftButton from '../../../../adapters/MicrosoftButton';\nimport NumberInput from '../../../../adapters/NumberInput';\nimport PasswordInput from '../../../../adapters/PasswordInput';\nimport SelectInput from '../../../../adapters/SelectInput';\nimport SignInWithEthereumButton from '../../../../adapters/SignInWithEthereumButton';\nimport ButtonComponent from '../../../../adapters/SubmitButton';\nimport TelephoneInput from '../../../../adapters/TelephoneInput';\nimport TextInput from '../../../../adapters/TextInput';\nimport Typography from '../../../../adapters/Typography';\n\n/**\n * Creates the appropriate recovery component based on the component type.\n */\nexport const createRecoveryComponent = ({component, onSubmit, ...rest}: AdapterProps): ReactElement => {\n switch (component.type) {\n case EmbeddedFlowComponentType.Typography:\n return <Typography component={component} onSubmit={onSubmit} {...rest} />;\n\n case EmbeddedFlowComponentType.Input: {\n // Determine input type based on variant or config\n const inputVariant: string = component.variant?.toUpperCase();\n const inputType: string = (component.config['type'] as string)?.toLowerCase();\n\n if (inputVariant === 'EMAIL' || inputType === 'email') {\n return <EmailInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n if (inputVariant === 'PASSWORD' || inputType === 'password') {\n return <PasswordInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n if (inputVariant === 'TELEPHONE' || inputType === 'tel') {\n return <TelephoneInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n if (inputVariant === 'NUMBER' || inputType === 'number') {\n return <NumberInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n if (inputVariant === 'DATE' || inputType === 'date') {\n return <DateInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n if (inputVariant === 'CHECKBOX' || inputType === 'checkbox') {\n return <CheckboxInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n return <TextInput component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n case EmbeddedFlowComponentType.Button: {\n const buttonVariant: string | undefined = component.variant?.toUpperCase();\n const buttonText: string = (component.config['text'] as string) || (component.config['label'] as string) || '';\n\n // TODO: The connection type should come as metadata.\n if (buttonVariant === 'SOCIAL') {\n if (buttonText.toLowerCase().includes('google')) {\n return (\n <GoogleButton onClick={(): any => onSubmit(component, {})} {...rest}>\n {buttonText}\n </GoogleButton>\n );\n }\n\n if (buttonText.toLowerCase().includes('github')) {\n return (\n <GitHubButton onClick={(): any => onSubmit(component, {})} {...rest}>\n {buttonText}\n </GitHubButton>\n );\n }\n\n if (buttonText.toLowerCase().includes('microsoft')) {\n return (\n <MicrosoftButton onClick={(): any => onSubmit(component, {})} {...rest}>\n {buttonText}\n </MicrosoftButton>\n );\n }\n\n if (buttonText.toLowerCase().includes('facebook')) {\n return (\n <FacebookButton onClick={(): any => onSubmit(component, {})} {...rest}>\n {buttonText}\n </FacebookButton>\n );\n }\n\n if (buttonText.toLowerCase().includes('linkedin')) {\n return (\n <LinkedInButton onClick={(): any => onSubmit(component, {})} {...rest}>\n {buttonText}\n </LinkedInButton>\n );\n }\n\n if (buttonText.toLowerCase().includes('ethereum')) {\n return (\n <SignInWithEthereumButton onClick={(): any => onSubmit(component, {})} {...rest}>\n {buttonText}\n </SignInWithEthereumButton>\n );\n }\n }\n\n // Use the generic ButtonComponent for all other button variants\n // It will handle PRIMARY, SECONDARY, TEXT, SOCIAL mappings internally\n return <ButtonComponent component={component} onSubmit={onSubmit} {...rest} />;\n }\n\n case EmbeddedFlowComponentType.Form:\n return <FormContainer component={component} onSubmit={onSubmit} {...rest} />;\n\n case EmbeddedFlowComponentType.Select:\n return <SelectInput component={component} onSubmit={onSubmit} {...rest} />;\n\n case EmbeddedFlowComponentType.Divider:\n return <DividerComponent component={component} onSubmit={onSubmit} {...rest} />;\n\n case EmbeddedFlowComponentType.Image:\n return <ImageComponent component={component} onSubmit={onSubmit} {...rest} />;\n\n default:\n return <div />;\n }\n};\n\n/**\n * Convenience function that creates the appropriate recovery component from flow component data.\n */\nexport const createRecoveryOptionFromComponent = (\n component: EmbeddedFlowComponent,\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n buttonClassName?: string;\n inputClassName?: string;\n key?: string | number;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>) => void;\n size?: 'small' | 'medium' | 'large';\n variant?: any;\n },\n): ReactElement =>\n createRecoveryComponent({\n component,\n formErrors,\n formValues,\n isFormValid,\n isLoading,\n onInputChange,\n touchedFields,\n ...options,\n });\n\n/**\n * Processes an array of components and renders them as React elements for recovery flow.\n */\nexport const renderRecoveryComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n buttonClassName?: string;\n inputClassName?: string;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>) => void;\n size?: 'small' | 'medium' | 'large';\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createRecoveryOptionFromComponent(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n {\n ...options,\n // Use component id as key, fallback to index\n key: component.id || index,\n },\n ),\n )\n .filter(Boolean);\n","/**\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 {cx} from '@emotion/css';\nimport {\n EmbeddedFlowExecuteRequestPayload,\n EmbeddedFlowExecuteResponse,\n EmbeddedFlowStatus,\n EmbeddedFlowComponentType,\n withVendorCSSClassPrefix,\n} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, useEffect, useState, useCallback, useRef} from 'react';\nimport {renderRecoveryComponents} from './RecoveryOptionFactory';\nimport FlowProvider from '../../../../../contexts/Flow/FlowProvider';\nimport useFlow from '../../../../../contexts/Flow/useFlow';\nimport useTheme from '../../../../../contexts/Theme/useTheme';\nimport useThunderID from '../../../../../contexts/ThunderID/useThunderID';\nimport {useForm, FormField} from '../../../../../hooks/useForm';\nimport useTranslation from '../../../../../hooks/useTranslation';\nimport AlertPrimitive from '../../../../primitives/Alert/Alert';\n// eslint-disable-next-line import/no-named-as-default\nimport CardPrimitive, {CardProps} from '../../../../primitives/Card/Card';\nimport Logo from '../../../../primitives/Logo/Logo';\nimport Spinner from '../../../../primitives/Spinner/Spinner';\nimport Typography from '../../../../primitives/Typography/Typography';\nimport useStyles from '../../SignUp/BaseSignUp.styles';\n\n/**\n * Render props for custom UI rendering.\n */\nexport interface BaseRecoveryRenderProps {\n components: any[];\n errors: Record<string, string>;\n handleInputChange: (name: string, value: string) => void;\n handleSubmit: (component: any, data?: Record<string, any>) => Promise<void>;\n isLoading: boolean;\n isValid: boolean;\n messages: {message: string; type: string}[];\n subtitle: string;\n title: string;\n touched: Record<string, boolean>;\n validateForm: () => {errors: Record<string, string>; isValid: boolean};\n values: Record<string, string>;\n}\n\n/**\n * Props for the BaseRecovery component.\n */\nexport interface BaseRecoveryProps {\n afterRecoveryUrl?: string;\n buttonClassName?: string;\n className?: string;\n errorClassName?: string;\n inputClassName?: string;\n isInitialized?: boolean;\n messageClassName?: string;\n onComplete?: (response: EmbeddedFlowExecuteResponse) => void;\n onError?: (error: Error) => void;\n onFlowChange?: (response: EmbeddedFlowExecuteResponse) => void;\n onInitialize?: (payload?: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse>;\n onSubmit?: (payload: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse>;\n showLogo?: boolean;\n showSubtitle?: boolean;\n showTitle?: boolean;\n size?: 'small' | 'medium' | 'large';\n variant?: CardProps['variant'];\n}\n\n/**\n * Internal component that renders the recovery UI and manages flow state.\n *\n * @internal\n */\nconst BaseRecoveryContent: FC<PropsWithChildren<BaseRecoveryProps>> = ({\n onInitialize,\n onSubmit,\n onError,\n onFlowChange,\n onComplete,\n className = '',\n inputClassName = '',\n buttonClassName = '',\n errorClassName = '',\n messageClassName = '',\n size = 'medium',\n variant = 'outlined',\n isInitialized,\n children,\n showTitle = true,\n showSubtitle = true,\n}: PropsWithChildren<BaseRecoveryProps>): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const {t} = useTranslation();\n const {subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages} = useFlow();\n useThunderID();\n const styles: any = useStyles(theme, colorScheme);\n\n const handleError: any = useCallback(\n (error: any) => {\n let errorMessage: string = t('errors.recovery.flow.failure');\n\n if (error && typeof error === 'object') {\n if (error.code && (error.message || error.description)) {\n errorMessage = error.description || error.message;\n } else if (error instanceof Error && error.name === 'ThunderIDAPIError') {\n try {\n const errorResponse: any = JSON.parse(error.message);\n errorMessage = errorResponse.description || errorResponse.message || error.message;\n } catch {\n errorMessage = error.message;\n }\n } else if (error.message) {\n errorMessage = error.message;\n }\n } else if (typeof error === 'string') {\n errorMessage = error;\n }\n\n clearMessages();\n addMessage({message: errorMessage, type: 'error'});\n },\n [t, addMessage, clearMessages],\n );\n\n const [isLoading, setIsLoading] = useState(false);\n const [isFlowInitialized, setIsFlowInitialized] = useState(false);\n const [currentFlow, setCurrentFlow] = useState<EmbeddedFlowExecuteResponse | null>(null);\n\n const initializationAttemptedRef: any = useRef(false);\n\n const extractFormFields: any = useCallback(\n (components: any[]): FormField[] => {\n const fields: FormField[] = [];\n\n const processComponents = (comps: any[]): any => {\n comps.forEach((component: any) => {\n if (component.type === EmbeddedFlowComponentType.Input) {\n const config: any = component.config || {};\n fields.push({\n initialValue: config.defaultValue || '',\n name: config.name || component.id,\n required: config.required || false,\n validator: (value: string) => {\n if (config.required && (!value || value.trim() === '')) {\n return t('validations.required.field.error');\n }\n if (config.type === 'email' && value && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)) {\n return t('field.email.invalid');\n }\n if (config.type === 'password' && value && value.length < 8) {\n return t('field.password.weak');\n }\n return null;\n },\n });\n }\n\n if (component.components && Array.isArray(component.components)) {\n processComponents(component.components);\n }\n });\n };\n\n processComponents(components);\n return fields;\n },\n [t],\n );\n\n const formFields: any = currentFlow?.data?.components ? extractFormFields(currentFlow.data.components) : [];\n\n const form: any = useForm<Record<string, string>>({\n fields: formFields,\n initialValues: {},\n requiredMessage: t('validations.required.field.error'),\n validateOnBlur: true,\n validateOnChange: true,\n });\n\n const {\n values: formValues,\n touched: touchedFields,\n errors: formErrors,\n isValid: isFormValid,\n setValue: setFormValue,\n setTouched: setFormTouched,\n validateForm,\n touchAllFields,\n reset: resetForm,\n } = form;\n\n const setupFormFields: any = useCallback(\n (flowResponse: EmbeddedFlowExecuteResponse) => {\n const fields: any = extractFormFields(flowResponse.data?.components || []);\n const initialValues: Record<string, string> = {};\n fields.forEach((field: any) => {\n initialValues[field.name] = field.initialValue || '';\n });\n resetForm();\n Object.keys(initialValues).forEach((key: any) => setFormValue(key, initialValues[key]));\n },\n [extractFormFields, resetForm, setFormValue],\n );\n\n const handleInputChange: (name: string, value: string) => void = useCallback(\n (name: string, value: string): void => {\n setFormValue(name, value);\n setFormTouched(name, true);\n },\n [setFormValue, setFormTouched],\n );\n\n const handleSubmit = async (component: any, data?: Record<string, any>, skipValidation?: boolean): Promise<void> => {\n if (!currentFlow) return;\n\n if (!skipValidation) {\n touchAllFields();\n const validation: ReturnType<typeof validateForm> = validateForm();\n if (!validation.isValid) return;\n }\n\n setIsLoading(true);\n clearMessages();\n\n try {\n const filteredInputs: Record<string, any> = {};\n if (data) {\n Object.entries(data).forEach(([key, value]: [string, any]) => {\n if (value !== null && value !== undefined && value !== '') {\n filteredInputs[key] = value;\n }\n });\n }\n\n const payload: EmbeddedFlowExecuteRequestPayload = {\n ...(currentFlow.flowId && {flowId: currentFlow.flowId}),\n flowType: (currentFlow as any).flowType || 'RECOVERY',\n inputs: filteredInputs,\n ...(component.id && {actionId: component.id as string}),\n } as any;\n\n const response: any = await onSubmit?.(payload);\n if (!response) return;\n onFlowChange?.(response);\n\n if (response.flowStatus === EmbeddedFlowStatus.Complete) {\n onComplete?.(response);\n return;\n }\n\n if (response.flowStatus === EmbeddedFlowStatus.Incomplete) {\n setCurrentFlow(response);\n setupFormFields(response);\n }\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n } finally {\n setIsLoading(false);\n }\n };\n\n const containerClasses: any = cx(\n [\n withVendorCSSClassPrefix('recovery'),\n withVendorCSSClassPrefix(`recovery--${size}`),\n withVendorCSSClassPrefix(`recovery--${variant}`),\n ],\n className,\n );\n\n const inputClasses: any = cx(\n [\n withVendorCSSClassPrefix('recovery__input'),\n size === 'small' && withVendorCSSClassPrefix('recovery__input--small'),\n size === 'large' && withVendorCSSClassPrefix('recovery__input--large'),\n ],\n inputClassName,\n );\n\n const buttonClasses: any = cx(\n [\n withVendorCSSClassPrefix('recovery__button'),\n size === 'small' && withVendorCSSClassPrefix('recovery__button--small'),\n size === 'large' && withVendorCSSClassPrefix('recovery__button--large'),\n ],\n buttonClassName,\n );\n\n const errorClasses: any = cx([withVendorCSSClassPrefix('recovery__error')], errorClassName);\n const messageClasses: any = cx([withVendorCSSClassPrefix('recovery__messages')], messageClassName);\n\n const renderComponents: any = useCallback(\n (components: any[]): ReactElement[] =>\n renderRecoveryComponents(\n components,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n handleInputChange,\n {\n buttonClassName: buttonClasses,\n inputClassName: inputClasses,\n onSubmit: handleSubmit,\n size,\n variant,\n },\n ),\n [\n buttonClasses,\n formErrors,\n formValues,\n handleInputChange,\n handleSubmit,\n inputClasses,\n isFormValid,\n isLoading,\n size,\n touchedFields,\n variant,\n ],\n );\n\n useEffect(() => {\n if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {\n initializationAttemptedRef.current = true;\n\n (async (): Promise<void> => {\n setIsLoading(true);\n clearMessages();\n\n try {\n const response: any = await onInitialize();\n setCurrentFlow(response);\n setIsFlowInitialized(true);\n onFlowChange?.(response);\n\n if (response.flowStatus === EmbeddedFlowStatus.Complete) {\n onComplete?.(response);\n return;\n }\n\n if (response.flowStatus === EmbeddedFlowStatus.Incomplete) {\n setupFormFields(response);\n }\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n } finally {\n setIsLoading(false);\n }\n })();\n }\n }, [\n clearMessages,\n handleError,\n isFlowInitialized,\n isInitialized,\n onComplete,\n onError,\n onFlowChange,\n onInitialize,\n setupFormFields,\n ]);\n\n if (children) {\n return <div className={containerClasses}>{children}</div>;\n }\n\n if (!isFlowInitialized && isLoading) {\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <div className={styles.loadingContainer}>\n <Spinner size=\"medium\" />\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n if (!currentFlow) {\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <AlertPrimitive variant=\"error\" className={errorClasses}>\n <AlertPrimitive.Title>{t('errors.heading')}</AlertPrimitive.Title>\n <AlertPrimitive.Description>{t('errors.recovery.flow.initialization.failure')}</AlertPrimitive.Description>\n </AlertPrimitive>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n {(showTitle || showSubtitle) && (\n <CardPrimitive.Header className={styles.header}>\n {showTitle && (\n <CardPrimitive.Title level={2} className={styles.title}>\n {flowTitle || t('recovery.heading')}\n </CardPrimitive.Title>\n )}\n {showSubtitle && (\n <Typography variant=\"body1\" className={styles.subtitle}>\n {flowSubtitle || t('recovery.subheading')}\n </Typography>\n )}\n </CardPrimitive.Header>\n )}\n <CardPrimitive.Content>\n {flowMessages && flowMessages.length > 0 && (\n <div className={styles.flowMessagesContainer}>\n {flowMessages.map((message: any, index: number) => (\n <AlertPrimitive\n key={message.id || index}\n variant={message.type?.toLowerCase() === 'error' ? 'error' : 'info'}\n className={cx(styles.flowMessageItem, messageClasses)}\n >\n <AlertPrimitive.Description>{message.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n ))}\n </div>\n )}\n <div className={styles.contentContainer}>\n {currentFlow.data?.components && currentFlow.data.components.length > 0 ? (\n renderComponents(currentFlow.data.components)\n ) : (\n <AlertPrimitive variant=\"warning\">\n <Typography variant=\"body1\">{t('errors.recovery.components.not.available')}</Typography>\n </AlertPrimitive>\n )}\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n};\n\n/**\n * BaseRecovery component for ThunderID V1 that provides an embedded account/password recovery flow.\n * Accepts API functions as props to maintain framework independence.\n *\n * @internal\n */\nconst BaseRecovery: FC<PropsWithChildren<BaseRecoveryProps>> = ({\n showLogo = true,\n ...rest\n}: PropsWithChildren<BaseRecoveryProps>): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const styles: any = useStyles(theme, colorScheme);\n\n return (\n <div>\n {showLogo && (\n <div className={styles.logoContainer}>\n <Logo size=\"large\" />\n </div>\n )}\n <FlowProvider>\n <BaseRecoveryContent showLogo={showLogo} {...rest} />\n </FlowProvider>\n </div>\n );\n};\n\nexport default BaseRecovery;\n","/**\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 {cx} from '@emotion/css';\nimport {\n EmbeddedFlowExecuteRequestPayload,\n EmbeddedFlowExecuteResponse,\n EmbeddedFlowStatus,\n EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType,\n withVendorCSSClassPrefix,\n Preferences,\n FlowMetadataResponse,\n} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useContext, useEffect, useState, useCallback, useRef} from 'react';\nimport ComponentRendererContext, {\n ComponentRendererMap,\n} from '../../../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport FlowProvider from '../../../../../contexts/Flow/FlowProvider';\nimport useFlow from '../../../../../contexts/Flow/useFlow';\nimport ComponentPreferencesContext from '../../../../../contexts/I18n/ComponentPreferencesContext';\nimport useTheme from '../../../../../contexts/Theme/useTheme';\nimport useThunderID from '../../../../../contexts/ThunderID/useThunderID';\nimport {useForm, FormField} from '../../../../../hooks/useForm';\nimport useTranslation from '../../../../../hooks/useTranslation';\nimport {normalizeFlowResponse, extractErrorMessage} from '../../../../../utils/v2/flowTransformer';\nimport getAuthComponentHeadings from '../../../../../utils/v2/getAuthComponentHeadings';\nimport AlertPrimitive from '../../../../primitives/Alert/Alert';\nimport CardPrimitive, {CardProps} from '../../../../primitives/Card/Card';\nimport Logo from '../../../../primitives/Logo/Logo';\nimport Spinner from '../../../../primitives/Spinner/Spinner';\nimport Typography from '../../../../primitives/Typography/Typography';\nimport {renderRecoveryComponents} from '../../AuthOptionFactory';\nimport useStyles from '../../SignUp/BaseSignUp.styles';\n\n/**\n * Render props for custom UI rendering.\n */\nexport interface BaseRecoveryRenderProps {\n components: any[];\n error?: Error | null;\n fieldErrors: Record<string, string>;\n handleInputChange: (name: string, value: string) => void;\n handleSubmit: (component: any, data?: Record<string, any>) => Promise<void>;\n isLoading: boolean;\n isValid: boolean;\n messages: {message: string; type: string}[];\n meta: FlowMetadataResponse | null;\n subtitle: string;\n title: string;\n touched: Record<string, boolean>;\n validateForm: () => {fieldErrors: Record<string, string>; isValid: boolean};\n values: Record<string, string>;\n}\n\n/**\n * Props for the BaseRecovery component.\n */\nexport interface BaseRecoveryProps {\n afterRecoveryUrl?: string;\n buttonClassName?: string;\n /**\n * Render props function for custom UI or static content\n */\n children?: ((props: BaseRecoveryRenderProps) => ReactNode) | ReactNode;\n className?: string;\n error?: Error | null;\n errorClassName?: string;\n inputClassName?: string;\n isInitialized?: boolean;\n messageClassName?: string;\n onComplete?: (response: EmbeddedFlowExecuteResponse) => void;\n onError?: (error: Error) => void;\n onFlowChange?: (response: EmbeddedFlowExecuteResponse) => void;\n onInitialize?: (payload?: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse>;\n onSubmit?: (payload: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse>;\n /**\n * Component-level preferences to override global i18n and theme settings.\n */\n preferences?: Preferences;\n showLogo?: boolean;\n showSubtitle?: boolean;\n showTitle?: boolean;\n size?: 'small' | 'medium' | 'large';\n variant?: CardProps['variant'];\n}\n\n/**\n * Internal component that renders the V2 recovery UI and manages flow state.\n *\n * @internal\n */\nconst BaseRecoveryContent: FC<BaseRecoveryProps> = ({\n onInitialize,\n onSubmit,\n onError,\n onFlowChange,\n onComplete,\n error: externalError,\n className = '',\n inputClassName = '',\n buttonClassName = '',\n errorClassName = '',\n messageClassName = '',\n size = 'medium',\n variant = 'outlined',\n isInitialized,\n children,\n showTitle = true,\n showSubtitle = true,\n}: BaseRecoveryProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const customRenderers: ComponentRendererMap = useContext(ComponentRendererContext);\n const {t} = useTranslation();\n const {subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages} = useFlow();\n const {meta} = useThunderID();\n const styles: any = useStyles(theme, colorScheme);\n\n const [isLoading, setIsLoading] = useState(false);\n const [isFlowInitialized, setIsFlowInitialized] = useState(false);\n const [currentFlow, setCurrentFlow] = useState<EmbeddedFlowExecuteResponse | null>(null);\n const [apiError, setApiError] = useState<Error | null>(null);\n\n const initializationAttemptedRef: any = useRef(false);\n const challengeTokenRef: any = useRef<string | null>(null);\n\n const handleError: any = useCallback(\n (error: any) => {\n const errorMessage: string = error?.failureReason || extractErrorMessage(error, t);\n setApiError(error instanceof Error ? error : new Error(errorMessage));\n clearMessages();\n addMessage({message: errorMessage, type: 'error'});\n },\n [t, addMessage, clearMessages],\n );\n\n const normalizeFlowResponseLocal: any = useCallback(\n (response: EmbeddedFlowExecuteResponse): EmbeddedFlowExecuteResponse => {\n if (response?.data?.components && Array.isArray(response.data.components)) {\n return response;\n }\n\n if (response?.data) {\n const {components} = normalizeFlowResponse(\n response,\n t,\n {defaultErrorKey: 'components.recovery.errors.generic', resolveTranslations: false},\n meta,\n );\n\n return {...response, data: {...response.data, components: components as any}};\n }\n\n return response;\n },\n [t, meta],\n );\n\n const extractFormFields: any = useCallback(\n (components: any[]): FormField[] => {\n const fields: FormField[] = [];\n\n const processComponents = (comps: any[]): any => {\n comps.forEach((component: any) => {\n if (\n component.type === EmbeddedFlowComponentType.TextInput ||\n component.type === EmbeddedFlowComponentType.PasswordInput ||\n component.type === EmbeddedFlowComponentType.EmailInput ||\n component.type === EmbeddedFlowComponentType.Select\n ) {\n const fieldName: any = component.ref || component.id;\n fields.push({\n initialValue: '',\n name: fieldName,\n required: component.required || false,\n validator: (value: string) => {\n if (component.required && (!value || value.trim() === '')) {\n return t('validations.required.field.error');\n }\n if (\n (component.type === EmbeddedFlowComponentType.EmailInput || component.variant === 'EMAIL') &&\n value &&\n !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)\n ) {\n return t('field.email.invalid');\n }\n return null;\n },\n });\n }\n\n if (component.components && Array.isArray(component.components)) {\n processComponents(component.components);\n }\n });\n };\n\n processComponents(components);\n return fields;\n },\n [t],\n );\n\n const formFields: any = currentFlow?.data?.components ? extractFormFields(currentFlow.data.components) : [];\n\n const form: any = useForm<Record<string, string>>({\n fields: formFields,\n initialValues: {},\n requiredMessage: t('validations.required.field.error'),\n validateOnBlur: true,\n validateOnChange: false,\n });\n\n const {\n values: formValues,\n touched: touchedFields,\n errors: formErrors,\n isValid: isFormValid,\n setValue: setFormValue,\n setTouched: setFormTouched,\n validateForm,\n touchAllFields,\n reset: resetForm,\n } = form;\n\n const setupFormFields: any = useCallback(\n (flowResponse: EmbeddedFlowExecuteResponse) => {\n const fields: any = extractFormFields(flowResponse.data?.components || []);\n const initialValues: Record<string, string> = {};\n fields.forEach((field: any) => {\n initialValues[field.name] = field.initialValue || '';\n });\n resetForm();\n Object.keys(initialValues).forEach((key: any) => setFormValue(key, initialValues[key]));\n },\n [extractFormFields, resetForm, setFormValue],\n );\n\n const handleInputChange = (name: string, value: string): void => {\n setFormValue(name, value);\n };\n\n const handleInputBlur = (name: string): void => {\n setFormTouched(name, true);\n };\n\n const handleSubmit = async (component: any, data?: Record<string, any>, skipValidation?: boolean): Promise<void> => {\n if (!currentFlow) return;\n\n if (!skipValidation) {\n touchAllFields();\n const validation: ReturnType<typeof validateForm> = validateForm();\n if (!validation.isValid) return;\n }\n\n setIsLoading(true);\n setApiError(null);\n clearMessages();\n\n try {\n const filteredInputs: Record<string, any> = {};\n if (data) {\n Object.entries(data).forEach(([key, value]: [string, any]) => {\n if (value !== null && value !== undefined && value !== '') {\n filteredInputs[key] = value;\n }\n });\n }\n\n const payload: EmbeddedFlowExecuteRequestPayload = {\n ...((currentFlow as any).executionId && {executionId: (currentFlow as any).executionId}),\n flowType: (currentFlow as any).flowType || 'RECOVERY',\n ...(component.id && {action: component.id}),\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n inputs: filteredInputs,\n } as any;\n\n const rawResponse: any = await onSubmit?.(payload);\n if (!rawResponse) return;\n const response: any = normalizeFlowResponseLocal(rawResponse);\n onFlowChange?.(response);\n\n if (response.challengeToken !== undefined) {\n challengeTokenRef.current = response.challengeToken ?? null;\n }\n\n if (response.flowStatus === EmbeddedFlowStatus.Complete) {\n onComplete?.(response);\n return;\n }\n\n if (response.flowStatus === EmbeddedFlowStatus.Incomplete) {\n setCurrentFlow(response);\n setupFormFields(response);\n }\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n } finally {\n setIsLoading(false);\n }\n };\n\n const containerClasses: any = cx(\n [\n withVendorCSSClassPrefix('recovery'),\n withVendorCSSClassPrefix(`recovery--${size}`),\n withVendorCSSClassPrefix(`recovery--${variant}`),\n ],\n className,\n );\n\n const inputClasses: any = cx(\n [\n withVendorCSSClassPrefix('recovery__input'),\n size === 'small' && withVendorCSSClassPrefix('recovery__input--small'),\n size === 'large' && withVendorCSSClassPrefix('recovery__input--large'),\n ],\n inputClassName,\n );\n\n const buttonClasses: any = cx(\n [\n withVendorCSSClassPrefix('recovery__button'),\n size === 'small' && withVendorCSSClassPrefix('recovery__button--small'),\n size === 'large' && withVendorCSSClassPrefix('recovery__button--large'),\n ],\n buttonClassName,\n );\n\n const errorClasses: any = cx([withVendorCSSClassPrefix('recovery__error')], errorClassName);\n const messageClasses: any = cx([withVendorCSSClassPrefix('recovery__messages')], messageClassName);\n\n const renderComponents: any = useCallback(\n (components: any[]): ReactElement[] =>\n renderRecoveryComponents(\n components,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n handleInputChange,\n {\n _customRenderers: customRenderers,\n _theme: theme,\n buttonClassName: buttonClasses,\n inputClassName: inputClasses,\n meta,\n onInputBlur: handleInputBlur,\n onSubmit: handleSubmit,\n size,\n variant,\n },\n ),\n [\n customRenderers,\n buttonClasses,\n formErrors,\n formValues,\n handleInputBlur,\n handleSubmit,\n inputClasses,\n isFormValid,\n meta,\n isLoading,\n size,\n theme,\n touchedFields,\n variant,\n ],\n );\n\n useEffect(() => {\n if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {\n initializationAttemptedRef.current = true;\n\n (async (): Promise<void> => {\n setIsLoading(true);\n setApiError(null);\n clearMessages();\n\n try {\n const rawResponse: any = await onInitialize?.();\n if (!rawResponse) return;\n const response: any = normalizeFlowResponseLocal(rawResponse);\n\n if (response.challengeToken !== undefined) {\n challengeTokenRef.current = response.challengeToken ?? null;\n }\n\n setCurrentFlow(response);\n setIsFlowInitialized(true);\n onFlowChange?.(response);\n\n if (response.flowStatus === EmbeddedFlowStatus.Complete) {\n onComplete?.(response);\n return;\n }\n\n if (response.flowStatus === EmbeddedFlowStatus.Incomplete) {\n setupFormFields(response);\n }\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n } finally {\n setIsLoading(false);\n }\n })();\n }\n }, [\n isFlowInitialized,\n isInitialized,\n normalizeFlowResponseLocal,\n onComplete,\n onError,\n onFlowChange,\n onInitialize,\n setupFormFields,\n t,\n ]);\n\n if (children) {\n if (typeof children === 'function') {\n const renderProps: BaseRecoveryRenderProps = {\n components: currentFlow?.data?.components || [],\n error: apiError,\n fieldErrors: formErrors,\n handleInputChange,\n handleSubmit,\n isLoading,\n isValid: isFormValid,\n messages: flowMessages || [],\n meta,\n subtitle: flowSubtitle || t('recovery.subheading'),\n title: flowTitle || t('recovery.heading'),\n touched: touchedFields,\n validateForm: (): {fieldErrors: Record<string, string>; isValid: boolean} => {\n const result: ReturnType<typeof validateForm> = validateForm();\n return {fieldErrors: result.errors, isValid: result.isValid};\n },\n values: formValues,\n };\n\n return <div className={containerClasses}>{(children as any)(renderProps)}</div>;\n }\n\n return <div className={containerClasses}>{children}</div>;\n }\n\n if (!isFlowInitialized && isLoading) {\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <div className={styles.loadingContainer}>\n <Spinner size=\"medium\" />\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n if (!currentFlow) {\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <AlertPrimitive variant=\"error\" className={errorClasses}>\n <AlertPrimitive.Title>{t('errors.heading')}</AlertPrimitive.Title>\n <AlertPrimitive.Description>{t('errors.recovery.flow.initialization.failure')}</AlertPrimitive.Description>\n </AlertPrimitive>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n const componentsToRender: any = currentFlow.data?.components || [];\n const {title, subtitle, componentsWithoutHeadings} = getAuthComponentHeadings(\n componentsToRender,\n flowTitle,\n flowSubtitle,\n t('recovery.heading'),\n t('recovery.subheading'),\n );\n\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n {(showTitle || showSubtitle) && (\n <CardPrimitive.Header className={styles.header}>\n {showTitle && (\n <CardPrimitive.Title level={2} className={styles.title}>\n {title}\n </CardPrimitive.Title>\n )}\n {showSubtitle && (\n <Typography variant=\"body1\" className={styles.subtitle}>\n {subtitle}\n </Typography>\n )}\n </CardPrimitive.Header>\n )}\n <CardPrimitive.Content>\n {externalError && (\n <div className={styles.flowMessagesContainer}>\n <AlertPrimitive variant=\"error\" className={cx(styles.flowMessageItem, messageClasses)}>\n <AlertPrimitive.Description>{externalError.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n </div>\n )}\n {flowMessages && flowMessages.length > 0 && (\n <div className={styles.flowMessagesContainer}>\n {flowMessages.map((message: any, index: number) => (\n <AlertPrimitive\n key={message.id || index}\n variant={message.type?.toLowerCase() === 'error' ? 'error' : 'info'}\n className={cx(styles.flowMessageItem, messageClasses)}\n >\n <AlertPrimitive.Description>{message.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n ))}\n </div>\n )}\n <div className={styles.contentContainer}>\n {componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? (\n renderComponents(componentsWithoutHeadings)\n ) : (\n <AlertPrimitive variant=\"warning\">\n <Typography variant=\"body1\">{t('errors.recovery.components.not.available')}</Typography>\n </AlertPrimitive>\n )}\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n};\n\n/**\n * BaseRecovery component for ThunderIDV2 that provides an embedded account/password recovery flow.\n * Accepts API functions as props to maintain framework independence.\n */\nconst BaseRecovery: FC<BaseRecoveryProps> = ({\n preferences,\n showLogo = true,\n ...rest\n}: BaseRecoveryProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const styles: any = useStyles(theme, colorScheme);\n\n const content: ReactElement = (\n <div>\n {showLogo && (\n <div className={styles.logoContainer}>\n <Logo size=\"large\" />\n </div>\n )}\n <FlowProvider>\n <BaseRecoveryContent showLogo={showLogo} {...rest} />\n </FlowProvider>\n </div>\n );\n\n if (!preferences) return content;\n\n return <ComponentPreferencesContext.Provider value={preferences}>{content}</ComponentPreferencesContext.Provider>;\n};\n\nexport default BaseRecovery;\n","/**\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 {Platform} from '@thunderid/browser';\nimport {FC} from 'react';\nimport BaseRecoveryV1, {BaseRecoveryProps as BaseRecoveryV1Props} from './v1/BaseRecovery';\nimport BaseRecoveryV2, {BaseRecoveryProps as BaseRecoveryV2Props} from './v2/BaseRecovery';\nimport useThunderID from '../../../../contexts/ThunderID/useThunderID';\n\nexport type BaseRecoveryProps = BaseRecoveryV1Props | BaseRecoveryV2Props;\n\nconst BaseRecovery: FC<BaseRecoveryProps> = (props: BaseRecoveryProps) => {\n const {platform} = useThunderID();\n\n if (platform === Platform.ThunderID) {\n return <BaseRecoveryV2 {...(props as BaseRecoveryV2Props)} />;\n }\n\n return <BaseRecoveryV1 {...(props as BaseRecoveryV1Props)} />;\n};\n\nexport default BaseRecovery;\n","/**\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 {EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse, EmbeddedFlowType} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement} from 'react';\nimport BaseRecovery, {BaseRecoveryProps} from './BaseRecovery';\nimport useThunderID from '../../../../../contexts/ThunderID/useThunderID';\n\nexport type RecoveryProps = PropsWithChildren<BaseRecoveryProps>;\n\n/**\n * Recovery component for ThunderID V1 that provides an embedded account/password recovery flow.\n */\nconst Recovery: FC<RecoveryProps> = ({\n className,\n size = 'medium',\n afterRecoveryUrl,\n onError,\n onComplete,\n children,\n ...rest\n}: RecoveryProps): ReactElement => {\n const {recover, isInitialized} = useThunderID();\n\n const handleInitialize = async (\n payload?: EmbeddedFlowExecuteRequestPayload,\n ): Promise<EmbeddedFlowExecuteResponse> => {\n const initialPayload: any = payload || {flowType: EmbeddedFlowType.Recovery};\n return (await recover(initialPayload)) as EmbeddedFlowExecuteResponse;\n };\n\n const handleOnSubmit = async (payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse> =>\n (await recover(payload)) as EmbeddedFlowExecuteResponse;\n\n const handleComplete = (response: EmbeddedFlowExecuteResponse): void => {\n onComplete?.(response);\n\n if (afterRecoveryUrl) {\n window.location.href = afterRecoveryUrl;\n }\n };\n\n return (\n <BaseRecovery\n afterRecoveryUrl={afterRecoveryUrl}\n onInitialize={handleInitialize}\n onSubmit={handleOnSubmit}\n onError={onError}\n onComplete={handleComplete}\n className={className}\n size={size}\n isInitialized={isInitialized}\n showLogo={true}\n showTitle={false}\n showSubtitle={false}\n children={children}\n {...rest}\n />\n );\n};\n\nexport default Recovery;\n","/**\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 {EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse, EmbeddedFlowType} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, useCallback} from 'react';\nimport BaseRecovery, {BaseRecoveryProps} from './BaseRecovery';\nimport useThunderID from '../../../../../contexts/ThunderID/useThunderID';\n\nexport type RecoveryProps = PropsWithChildren<\n BaseRecoveryProps & {\n /**\n * URL query parameter name that carries the recovery token when the user lands via a recovery link.\n * When set and both `executionId` and this param are present in the URL, the component resumes the\n * existing flow instead of starting a new one.\n *\n * @example\n * // For a link like /recovery?executionId=xxx&recoveryToken=yyy\n * <Recovery tokenUrlParam=\"recoveryToken\" />\n */\n tokenUrlParam?: string;\n }\n>;\n\n/**\n * Recovery component for ThunderIDV2 that provides an embedded account/password recovery flow.\n *\n * @example\n * ```tsx\n * // Default UI\n * <Recovery\n * afterRecoveryUrl=\"/sign-in\"\n * onComplete={(response) => console.log('Recovery complete', response)}\n * onError={(error) => console.error('Recovery failed', error)}\n * />\n *\n * // Custom UI with render props\n * <Recovery>\n * {({ values, fieldErrors, handleInputChange, handleSubmit, isLoading, components }) => (\n * <form onSubmit={(e) => { e.preventDefault(); handleSubmit(components[0], values); }}>\n * ...\n * </form>\n * )}\n * </Recovery>\n * ```\n */\nconst Recovery: FC<RecoveryProps> = ({\n className,\n size = 'medium',\n afterRecoveryUrl,\n onError,\n onComplete,\n tokenUrlParam,\n children,\n ...rest\n}: RecoveryProps): ReactElement => {\n const {recover, isInitialized, applicationId} = useThunderID();\n\n const handleInitialize: (payload?: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse> =\n useCallback(\n async (payload?: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse> => {\n const urlParams: URLSearchParams = new URL(window.location.href).searchParams;\n const applicationIdFromUrl: string | null = urlParams.get('applicationId');\n const effectiveApplicationId: string | null = applicationId ?? applicationIdFromUrl;\n\n if (tokenUrlParam) {\n const executionId: string | null = urlParams.get('executionId');\n const tokenValue: string | null = urlParams.get(tokenUrlParam);\n\n if (executionId && tokenValue) {\n const resumePayload: any = {\n executionId,\n inputs: {[tokenUrlParam]: tokenValue},\n verbose: true,\n };\n return (await recover(resumePayload)) as EmbeddedFlowExecuteResponse;\n }\n }\n\n const initialPayload: any = payload || {\n flowType: EmbeddedFlowType.Recovery,\n ...(effectiveApplicationId && {applicationId: effectiveApplicationId}),\n };\n\n return (await recover(initialPayload)) as EmbeddedFlowExecuteResponse;\n },\n [applicationId, tokenUrlParam, recover],\n );\n\n const handleOnSubmit: (payload: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse> =\n useCallback(\n async (payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse> =>\n (await recover(payload)) as EmbeddedFlowExecuteResponse,\n [recover],\n );\n\n const handleComplete: (response: EmbeddedFlowExecuteResponse) => void = useCallback(\n (response: EmbeddedFlowExecuteResponse): void => {\n onComplete?.(response);\n\n if (afterRecoveryUrl) {\n window.location.href = afterRecoveryUrl;\n }\n },\n [onComplete, afterRecoveryUrl],\n );\n\n return (\n <BaseRecovery\n afterRecoveryUrl={afterRecoveryUrl}\n onInitialize={handleInitialize}\n onSubmit={handleOnSubmit}\n onError={onError}\n onComplete={handleComplete}\n className={className}\n size={size}\n isInitialized={isInitialized}\n showTitle={true}\n showSubtitle={true}\n children={children}\n {...rest}\n />\n );\n};\n\nexport default Recovery;\n","/**\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 {Platform} from '@thunderid/browser';\nimport {FC} from 'react';\nimport RecoveryV1, {RecoveryProps as RecoveryV1Props} from './v1/Recovery';\nimport RecoveryV2, {RecoveryProps as RecoveryV2Props} from './v2/Recovery';\nimport useThunderID from '../../../../contexts/ThunderID/useThunderID';\n\n/**\n * Props for the Recovery component.\n * Extends RecoveryV1Props & RecoveryV2Props for full compatibility with both implementations.\n */\nexport type RecoveryProps = RecoveryV1Props | RecoveryV2Props;\n\n/**\n * Recovery component that provides an embedded account/password recovery flow.\n * Routes to the appropriate version-specific implementation based on the platform.\n *\n * @example\n * ```tsx\n * import { Recovery } from '@thunderid/react';\n *\n * const App = () => (\n * <Recovery\n * afterRecoveryUrl=\"/sign-in\"\n * onComplete={(response) => console.log('Recovery complete', response)}\n * onError={(error) => console.error('Recovery failed', error)}\n * />\n * );\n * ```\n *\n * @example\n * // Custom UI with render props\n * ```tsx\n * <Recovery>\n * {({ values, fieldErrors, handleInputChange, handleSubmit, isLoading, components }) => (\n * <form onSubmit={(e) => { e.preventDefault(); handleSubmit(components[0], values); }}>\n * ...\n * </form>\n * )}\n * </Recovery>\n * ```\n */\nconst Recovery: FC<RecoveryProps> = (props: RecoveryProps) => {\n const {platform} = useThunderID();\n\n if (platform === Platform.ThunderID) {\n return <RecoveryV2 {...(props as RecoveryV2Props)} />;\n }\n\n return <RecoveryV1 {...(props as RecoveryV1Props)} />;\n};\n\nexport default Recovery;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the BaseInviteUser component\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(() => {\n const card: string = css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n gap: calc(${theme.vars.spacing.unit} * 2);\n min-width: 420px;\n font-family: ${theme.vars.typography.fontFamily};\n `;\n\n const header: string = css`\n gap: 0;\n align-items: center;\n `;\n\n const title: string = css`\n margin: 0 0 calc(${theme.vars.spacing.unit} * 1) 0;\n color: ${theme.vars.colors.text.primary};\n `;\n\n const subtitle: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 1);\n color: ${theme.vars.colors.text.secondary};\n `;\n\n return {\n card,\n header,\n subtitle,\n title,\n };\n }, [\n theme.vars.colors.background.surface,\n theme.vars.colors.text.primary,\n theme.vars.colors.text.secondary,\n theme.vars.borderRadius.large,\n theme.vars.spacing.unit,\n theme.vars.typography.fontFamily,\n colorScheme,\n ]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {\n EmbeddedFlowType,\n FlowMetadataResponse,\n logger,\n OrganizationUnitListResponse,\n Preferences,\n} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useCallback, useContext, useEffect, useRef, useState} from 'react';\nimport useStyles from './BaseInviteUser.styles';\nimport ComponentRendererContext, {\n ComponentRendererMap,\n} from '../../../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport useTheme from '../../../../../contexts/Theme/useTheme';\nimport useThunderID from '../../../../../contexts/ThunderID/useThunderID';\nimport useTranslation from '../../../../../hooks/useTranslation';\nimport {normalizeFlowResponse, extractErrorMessage} from '../../../../../utils/v2/flowTransformer';\nimport AlertPrimitive from '../../../../primitives/Alert/Alert';\n// eslint-disable-next-line import/no-named-as-default\nimport CardPrimitive, {CardProps} from '../../../../primitives/Card/Card';\nimport Spinner from '../../../../primitives/Spinner/Spinner';\nimport Typography from '../../../../primitives/Typography/Typography';\nimport {renderInviteUserComponents} from '../../AuthOptionFactory';\n\n/**\n * Flow response structure from the backend.\n */\nexport interface InviteUserFlowResponse {\n challengeToken?: string;\n data?: {\n additionalData?: Record<string, any>;\n components?: any[];\n meta?: {\n components?: any[];\n };\n };\n executionId: string;\n failureReason?: string;\n flowStatus: 'INCOMPLETE' | 'COMPLETE' | 'ERROR';\n type?: 'VIEW' | 'REDIRECTION';\n}\n\n/**\n * Render props for custom UI rendering of InviteUser.\n */\nexport interface BaseInviteUserRenderProps {\n /**\n * Additional data from the current flow response (e.g. rootOuId, inviteLink).\n */\n additionalData?: Record<string, any>;\n\n /**\n * Flow components from the current step.\n */\n components: any[];\n\n /**\n * API error (if any).\n */\n error?: Error | null;\n\n /**\n * Current flow execution ID.\n */\n executionId?: string;\n\n /**\n * Field validation errors.\n */\n fieldErrors: Record<string, string>;\n\n /**\n * Current flow execution ID.\n */\n flowExecId?: string;\n\n /**\n * Function to handle input blur.\n */\n handleInputBlur: (name: string) => void;\n\n /**\n * Function to handle input changes.\n */\n handleInputChange: (name: string, value: string) => void;\n\n /**\n * Function to handle form submission.\n */\n handleSubmit: (component: any, data?: Record<string, any>) => Promise<void>;\n\n /**\n * Loading state.\n */\n isLoading: boolean;\n\n /**\n * Whether the form is valid.\n */\n isValid: boolean;\n\n /**\n * Flow metadata returned by the platform (v2 only). `null` while loading or unavailable.\n */\n meta: FlowMetadataResponse | null;\n\n /**\n * Reset the flow to invite another user.\n */\n resetFlow: () => void;\n\n /**\n * Subtitle for the current step.\n */\n subtitle?: string;\n\n /**\n * Title for the current step.\n */\n title?: string;\n\n /**\n * Touched fields.\n */\n touched: Record<string, boolean>;\n\n /**\n * Form values for the current step.\n */\n values: Record<string, string>;\n}\n\n/**\n * Props for the BaseInviteUser component.\n */\nexport interface BaseInviteUserProps {\n /**\n * Render props function for custom UI.\n * If not provided, default UI will be rendered.\n */\n children?: (props: BaseInviteUserRenderProps) => ReactNode;\n\n /**\n * Custom CSS class name.\n */\n className?: string;\n\n /**\n * Function to fetch child organization units.\n * When provided, enables the OU tree picker for OU_SELECT components.\n */\n fetchOrganizationUnitChildren?: (\n parentId: string,\n limit: number,\n offset: number,\n ) => Promise<OrganizationUnitListResponse>;\n\n /**\n * Whether the SDK is initialized.\n */\n isInitialized?: boolean;\n\n /**\n * Callback when an error occurs.\n */\n onError?: (error: Error) => void;\n\n /**\n * Callback when the flow state changes.\n */\n onFlowChange?: (response: InviteUserFlowResponse) => void;\n\n /**\n * Function to initialize the invite user flow.\n * This should make an authenticated request to the flow/execute endpoint.\n */\n onInitialize: (payload: Record<string, any>) => Promise<InviteUserFlowResponse>;\n\n /**\n * Function to submit flow step data.\n * This should make an authenticated request to the flow/execute endpoint.\n */\n onSubmit: (payload: Record<string, any>) => Promise<InviteUserFlowResponse>;\n\n /**\n * Component-level preferences to override global i18n and theme settings.\n * Preferences are deep-merged with global ones, with component preferences\n * taking precedence. Affects this component and all its descendants.\n */\n preferences?: Preferences;\n\n /**\n * Whether to show the subtitle.\n */\n showSubtitle?: boolean;\n\n /**\n * Whether to show the title.\n */\n showTitle?: boolean;\n\n /**\n * Size variant for the component.\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Theme variant for the component.\n */\n variant?: CardProps['variant'];\n}\n\n/**\n * Base component for invite user flow.\n * Handles the flow logic for creating a user and generating an invite link.\n *\n * When no children are provided, renders a default UI with:\n * - Loading spinner during initialization\n * - Error alerts for failures\n * - Flow components (user type selection, user details form)\n * - Invite link display with copy functionality\n *\n * Flow steps handled:\n * 1. User type selection (if multiple types available)\n * 2. User details input (username, email)\n * 3. Invite link generation\n */\nconst BaseInviteUser: FC<BaseInviteUserProps> = ({\n onInitialize,\n onSubmit,\n onError,\n onFlowChange,\n className = '',\n children,\n fetchOrganizationUnitChildren,\n isInitialized = true,\n preferences,\n size = 'medium',\n variant = 'outlined',\n showTitle = true,\n showSubtitle = true,\n}: BaseInviteUserProps): ReactElement => {\n const {meta, isInitialized: isSdkInitialized, getStorageManager} = useThunderID();\n const {t} = useTranslation(preferences?.i18n);\n const {theme} = useTheme();\n const customRenderers: ComponentRendererMap = useContext(ComponentRendererContext);\n const styles: any = useStyles(theme, theme.vars.colors.text.primary);\n const [isLoading, setIsLoading] = useState(false);\n const [isFlowInitialized, setIsFlowInitialized] = useState(false);\n const [currentFlow, setCurrentFlow] = useState<InviteUserFlowResponse | null>(null);\n const [apiError, setApiError] = useState<Error | null>(null);\n const [formValues, setFormValues] = useState<Record<string, string>>({});\n const [formErrors, setFormErrors] = useState<Record<string, string>>({});\n const [touchedFields, setTouchedFields] = useState<Record<string, boolean>>({});\n const [isFormValid, setIsFormValid] = useState(true);\n const challengeTokenRef: any = useRef<string | null>(null);\n\n const initializationAttemptedRef: any = useRef(false);\n\n /**\n * Restore any challenge token persisted before an OAuth redirect.\n */\n useEffect(() => {\n if (!isSdkInitialized) return;\n\n (async (): Promise<void> => {\n try {\n const storageManager: any = await getStorageManager();\n const tempData: any = await storageManager?.getTemporaryData();\n if (tempData?.challengeToken) {\n challengeTokenRef.current = tempData.challengeToken as string;\n }\n } catch {\n // StorageManager unavailable — continue without persisted token\n }\n })();\n }, [isSdkInitialized]);\n\n /**\n * Updates challengeTokenRef immediately (stale-closure safe) and persists via\n * the provider's StorageManager so the token survives OAuth redirects.\n */\n const setChallengeToken = async (challengeToken: string | null): Promise<void> => {\n challengeTokenRef.current = challengeToken;\n try {\n const storageManager: any = await getStorageManager();\n if (storageManager) {\n if (challengeToken) {\n await storageManager.setTemporaryDataParameter('challengeToken', challengeToken);\n } else {\n await storageManager.removeTemporaryDataParameter('challengeToken');\n }\n }\n } catch {\n logger.warn('Failed to persist challenge token in storage.');\n }\n };\n\n /**\n * Handle error responses and extract meaningful error messages.\n * Uses the transformer's extractErrorMessage function for consistency.\n */\n const handleError: any = useCallback(\n (error: any) => {\n // Extract error message from response failureReason or use extractErrorMessage\n const errorMessage: string =\n error?.failureReason || extractErrorMessage(error, t, 'components.inviteUser.errors.generic');\n\n // Set the API error state\n setApiError(error instanceof Error ? error : new Error(errorMessage));\n\n // Call the onError callback if provided\n onError?.(error instanceof Error ? error : new Error(errorMessage));\n },\n [t, onError],\n );\n\n /**\n * Normalize flow response to ensure component-driven format.\n * Transforms data.meta.components to data.components.\n */\n const normalizeFlowResponseLocal: any = useCallback(\n (response: InviteUserFlowResponse): InviteUserFlowResponse => {\n if (!response?.data?.meta?.components) {\n return response;\n }\n\n try {\n const {components} = normalizeFlowResponse(\n response,\n t,\n {\n defaultErrorKey: 'components.inviteUser.errors.generic',\n resolveTranslations: false,\n },\n meta,\n );\n\n return {\n ...response,\n data: {\n ...response.data,\n components: components as any,\n },\n };\n } catch {\n // If transformer throws (e.g., error response), return as-is\n return response;\n }\n },\n [t, children],\n );\n\n /**\n * Handle input value changes.\n */\n const handleInputChange: any = useCallback((name: string, value: string) => {\n setFormValues((prev: any) => ({...prev, [name]: value}));\n // Clear error when user starts typing\n setFormErrors((prev: any) => {\n const newErrors: any = {...prev};\n delete newErrors[name];\n return newErrors;\n });\n }, []);\n\n /**\n * Handle input blur.\n */\n const handleInputBlur: any = useCallback((name: string) => {\n setTouchedFields((prev: any) => ({...prev, [name]: true}));\n }, []);\n\n /**\n * Validate required fields based on components.\n */\n const validateForm: any = useCallback(\n (components: any[]): {errors: Record<string, string>; isValid: boolean} => {\n const errors: Record<string, string> = {};\n\n const validateComponents = (comps: any[]): any => {\n comps.forEach((comp: any) => {\n if (\n (comp.type === 'TEXT_INPUT' ||\n comp.type === 'EMAIL_INPUT' ||\n comp.type === 'SELECT' ||\n comp.type === 'PHONE_INPUT' ||\n comp.type === 'OTP_INPUT') &&\n comp.required &&\n comp.ref\n ) {\n const value: any = formValues[comp.ref];\n if (!value || value.trim() === '') {\n errors[comp.ref] = `${comp.label || comp.ref} is required`;\n }\n // Email validation\n if (comp.type === 'EMAIL_INPUT' && value && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)) {\n errors[comp.ref] = 'Please enter a valid email address';\n }\n }\n if (comp.components && Array.isArray(comp.components)) {\n validateComponents(comp.components);\n }\n });\n };\n\n validateComponents(components);\n\n return {errors, isValid: Object.keys(errors).length === 0};\n },\n [formValues],\n );\n\n /**\n * Handle form submission.\n */\n const handleSubmit: any = useCallback(\n async (component: any, data?: Record<string, any>) => {\n if (!currentFlow) {\n return;\n }\n\n // Validate form before submission\n const components: any = currentFlow.data?.components || [];\n const validation: any = validateForm(components);\n\n if (!validation.isValid) {\n setFormErrors(validation.errors);\n setIsFormValid(false);\n // Mark all fields as touched\n const touched: Record<string, boolean> = {};\n Object.keys(validation.errors).forEach((key: any) => {\n touched[key] = true;\n });\n setTouchedFields((prev: any) => ({...prev, ...touched}));\n return;\n }\n\n setIsLoading(true);\n setApiError(null);\n setIsFormValid(true);\n\n try {\n // Build payload with form values\n const inputs: any = data || formValues;\n\n const payload: Record<string, any> = {\n executionId: currentFlow.executionId,\n inputs,\n verbose: true,\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n };\n\n // Add action ID if component has one\n if (component?.id) {\n payload['action'] = component.id;\n }\n\n const rawResponse: any = await onSubmit(payload);\n const response: any = normalizeFlowResponseLocal(rawResponse);\n onFlowChange?.(response);\n\n await setChallengeToken(response.challengeToken ?? null);\n\n // Check for error status\n if (response.flowStatus === 'ERROR') {\n handleError(response);\n return;\n }\n\n // Update current flow and reset form for next step\n setCurrentFlow(response);\n setFormValues({});\n setFormErrors({});\n setTouchedFields({});\n } catch (err) {\n handleError(err);\n } finally {\n setIsLoading(false);\n }\n },\n [currentFlow, formValues, validateForm, onSubmit, onFlowChange, handleError, normalizeFlowResponseLocal],\n );\n\n /**\n * Reset the flow to invite another user.\n */\n const resetFlow: any = useCallback(() => {\n setIsFlowInitialized(false);\n setCurrentFlow(null);\n setApiError(null);\n setFormValues({});\n setFormErrors({});\n setTouchedFields({});\n initializationAttemptedRef.current = false;\n }, []);\n\n /**\n * Initialize the flow on component mount.\n */\n useEffect(() => {\n if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {\n initializationAttemptedRef.current = true;\n\n (async (): Promise<void> => {\n setIsLoading(true);\n setApiError(null);\n\n try {\n const payload: any = {\n flowType: EmbeddedFlowType.UserOnboarding,\n verbose: true,\n };\n\n const rawResponse: any = await onInitialize(payload);\n const response: any = normalizeFlowResponseLocal(rawResponse);\n await setChallengeToken(response.challengeToken ?? null);\n setCurrentFlow(response);\n setIsFlowInitialized(true);\n onFlowChange?.(response);\n\n // Check for immediate error\n if (response.flowStatus === 'ERROR') {\n handleError(response);\n }\n } catch (err) {\n handleError(err);\n } finally {\n setIsLoading(false);\n }\n })();\n }\n }, [isInitialized, isFlowInitialized, onInitialize, onFlowChange, handleError, normalizeFlowResponseLocal]);\n\n /**\n * Recalculate form validity whenever form values or components change.\n * This ensures the submit button is enabled/disabled correctly as the user types.\n */\n useEffect(() => {\n if (currentFlow && isFlowInitialized) {\n const components: any = currentFlow.data?.components || [];\n if (components.length > 0) {\n const validation: any = validateForm(components);\n setIsFormValid(validation.isValid);\n }\n }\n }, [formValues, currentFlow, isFlowInitialized, validateForm]);\n\n /**\n * Extract title and subtitle from components.\n */\n const extractHeadings: any = useCallback((components: any[]): {subtitle?: string; title?: string} => {\n let title: string | undefined;\n let subtitle: string | undefined;\n\n components.forEach((comp: any) => {\n if (comp.type === 'TEXT') {\n if (comp.variant === 'HEADING_1' && !title) {\n title = comp.label;\n } else if ((comp.variant === 'HEADING_2' || comp.variant === 'SUBTITLE_1') && !subtitle) {\n subtitle = comp.label;\n }\n }\n });\n\n return {subtitle, title};\n }, []);\n\n /**\n * Filter out heading components for default rendering.\n */\n const filterHeadings: any = useCallback(\n (components: any[]): any[] =>\n components.filter(\n (comp: any) => !(comp.type === 'TEXT' && (comp.variant === 'HEADING_1' || comp.variant === 'HEADING_2')),\n ),\n [],\n );\n\n /**\n * Render form components using the factory.\n */\n const renderComponents: any = useCallback(\n (components: any[]): ReactElement[] =>\n renderInviteUserComponents(\n components,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n handleInputChange,\n {\n _customRenderers: customRenderers,\n _theme: theme,\n additionalData: currentFlow?.data?.additionalData,\n fetchOrganizationUnitChildren,\n onInputBlur: handleInputBlur,\n onSubmit: handleSubmit,\n size,\n variant,\n },\n ),\n [\n customRenderers,\n currentFlow?.data?.additionalData,\n fetchOrganizationUnitChildren,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n handleInputChange,\n handleInputBlur,\n handleSubmit,\n size,\n theme,\n variant,\n ],\n );\n\n // Get components from normalized response, with fallback to meta.components\n const components: any = currentFlow?.data?.components || currentFlow?.data?.meta?.components || [];\n const {title, subtitle} = extractHeadings(components);\n const componentsWithoutHeadings: any = filterHeadings(components);\n\n // Render props\n const renderProps: BaseInviteUserRenderProps = {\n additionalData: currentFlow?.data?.additionalData,\n components,\n error: apiError,\n executionId: currentFlow?.executionId,\n fieldErrors: formErrors,\n handleInputBlur,\n handleInputChange,\n handleSubmit,\n isLoading,\n isValid: isFormValid,\n meta,\n resetFlow,\n subtitle,\n title,\n touched: touchedFields,\n values: formValues,\n };\n\n // If children render prop is provided, use it for custom UI\n if (children) {\n return <div className={className}>{children(renderProps)}</div>;\n }\n\n // Default rendering\n\n // Waiting for SDK initialization\n if (!isInitialized) {\n return (\n <CardPrimitive className={cx(className, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <div style={{display: 'flex', justifyContent: 'center', padding: '2rem'}}>\n <Spinner size=\"medium\" />\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n // Loading state during initialization\n if (!isFlowInitialized && isLoading) {\n return (\n <CardPrimitive className={cx(className, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <div style={{display: 'flex', justifyContent: 'center', padding: '2rem'}}>\n <Spinner size=\"medium\" />\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n // Error state during initialization\n if (!currentFlow && apiError) {\n return (\n <CardPrimitive className={cx(className, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <AlertPrimitive variant=\"error\">\n <AlertPrimitive.Title>Error</AlertPrimitive.Title>\n <AlertPrimitive.Description>{apiError.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n // Flow components\n return (\n <CardPrimitive className={cx(className, styles.card)} variant={variant}>\n {(showTitle || showSubtitle) && (title || subtitle) && (\n <CardPrimitive.Header className={styles.header}>\n {showTitle && title && (\n <CardPrimitive.Title level={2} className={styles.title}>\n {title}\n </CardPrimitive.Title>\n )}\n {showSubtitle && subtitle && (\n <Typography variant=\"body1\" className={styles.subtitle}>\n {subtitle}\n </Typography>\n )}\n </CardPrimitive.Header>\n )}\n <CardPrimitive.Content>\n {apiError && (\n <div style={{marginBottom: '1rem'}}>\n <AlertPrimitive variant=\"error\">\n <AlertPrimitive.Description>{apiError.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n </div>\n )}\n <div>\n {componentsWithoutHeadings && componentsWithoutHeadings.length > 0\n ? renderComponents(componentsWithoutHeadings)\n : !isLoading && (\n <AlertPrimitive variant=\"warning\">\n <Typography variant=\"body1\">No form components available</Typography>\n </AlertPrimitive>\n )}\n {isLoading && (\n <div style={{display: 'flex', justifyContent: 'center', padding: '1rem'}}>\n <Spinner size=\"small\" />\n </div>\n )}\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n};\n\nexport default BaseInviteUser;\n","/**\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 {EmbeddedFlowType, getOrganizationUnitChildren, OrganizationUnitListResponse} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useCallback} from 'react';\n// eslint-disable-next-line import/no-named-as-default\nimport BaseInviteUser, {BaseInviteUserRenderProps, InviteUserFlowResponse} from './BaseInviteUser';\nimport useThunderID from '../../../../../contexts/ThunderID/useThunderID';\n\n/**\n * Render props for InviteUser (re-exported for convenience).\n */\nexport type InviteUserRenderProps = BaseInviteUserRenderProps;\n\n/**\n * Props for the InviteUser component.\n */\nexport interface InviteUserProps {\n /**\n * Render props function for custom UI.\n * If not provided, default UI will be rendered by the SDK.\n */\n children?: (props: InviteUserRenderProps) => ReactNode;\n\n /**\n * Custom CSS class name.\n */\n className?: string;\n\n /**\n * Callback when an error occurs.\n */\n onError?: (error: Error) => void;\n\n /**\n * Callback when the flow state changes.\n */\n onFlowChange?: (response: InviteUserFlowResponse) => void;\n\n /**\n * Whether to show the subtitle.\n */\n showSubtitle?: boolean;\n\n /**\n * Whether to show the title.\n */\n showTitle?: boolean;\n\n /**\n * Size variant for the component.\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Theme variant for the component card.\n */\n variant?: 'outlined' | 'elevated';\n}\n\n/**\n * InviteUser component for initiating invite user flow.\n *\n * This component is designed for admin users in the thunder-develop app to:\n * 1. Select a user type (if multiple available)\n * 2. Enter user details (username, email)\n * 3. Generate an invite link for the end user\n *\n * The component uses the authenticated ThunderID SDK context to make API calls\n * with the admin's access token (requires 'system' scope).\n *\n * @example\n * ```tsx\n * import { InviteUser } from '@thunderid/react';\n *\n * const InviteUserPage = () => {\n * const [inviteLink, setInviteLink] = useState<string>();\n *\n * return (\n * <InviteUser\n * onInviteLinkGenerated={(link, executionId) => setInviteLink(link)}\n * onError={(error) => console.error(error)}\n * >\n * {({ values, components, isLoading, handleInputChange, handleSubmit, inviteLink, isInviteGenerated }) => (\n * <div>\n * {isInviteGenerated ? (\n * <div>\n * <h2>Invite Link Generated!</h2>\n * <p>{inviteLink}</p>\n * </div>\n * ) : (\n * // Render form based on components\n * )}\n * </div>\n * )}\n * </InviteUser>\n * );\n * };\n * ```\n */\nconst InviteUser: FC<InviteUserProps> = ({\n onError,\n onFlowChange,\n className,\n children,\n size = 'medium',\n variant = 'outlined',\n showTitle = true,\n showSubtitle = true,\n}: InviteUserProps): ReactElement => {\n const {http, baseUrl, getAccessToken, isInitialized} = useThunderID();\n\n /**\n * Initialize the invite user flow.\n * Makes an authenticated request to /flow/execute with flowType: USER_ONBOARDING.\n */\n const handleInitialize = async (payload: Record<string, any>): Promise<InviteUserFlowResponse> => {\n const response: any = await http.request({\n data: {\n ...payload,\n flowType: EmbeddedFlowType.UserOnboarding,\n verbose: true,\n },\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n url: `${baseUrl}/flow/execute`,\n } as any);\n\n return response.data as InviteUserFlowResponse;\n };\n\n /**\n * Submit flow step data.\n * Makes an authenticated request to /flow/execute with the step data.\n */\n const handleSubmit = async (payload: Record<string, any>): Promise<InviteUserFlowResponse> => {\n const response: any = await http.request({\n data: {\n ...payload,\n verbose: true,\n },\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n url: `${baseUrl}/flow/execute`,\n } as any);\n\n return response.data as InviteUserFlowResponse;\n };\n\n const fetchOrganizationUnitChildren: (\n parentId: string,\n limit: number,\n offset: number,\n ) => Promise<OrganizationUnitListResponse> = useCallback(\n async (parentId: string, limit: number, offset: number): Promise<OrganizationUnitListResponse> => {\n const accessToken: string = await getAccessToken();\n\n return getOrganizationUnitChildren({\n baseUrl,\n headers: {Authorization: `Bearer ${accessToken}`},\n limit,\n offset,\n organizationUnitId: parentId,\n });\n },\n [baseUrl, getAccessToken],\n );\n\n return (\n <BaseInviteUser\n onInitialize={handleInitialize}\n onSubmit={handleSubmit}\n onError={onError}\n onFlowChange={onFlowChange}\n className={className}\n fetchOrganizationUnitChildren={fetchOrganizationUnitChildren}\n isInitialized={isInitialized}\n size={size}\n variant={variant}\n showTitle={showTitle}\n showSubtitle={showSubtitle}\n >\n {children}\n </BaseInviteUser>\n );\n};\n\nexport default InviteUser;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the BaseAcceptInvite component\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(() => {\n const card: string = css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n gap: calc(${theme.vars.spacing.unit} * 2);\n min-width: 420px;\n font-family: ${theme.vars.typography.fontFamily};\n `;\n\n const header: string = css`\n gap: 0;\n align-items: center;\n `;\n\n const title: string = css`\n margin: 0 0 calc(${theme.vars.spacing.unit} * 1) 0;\n color: ${theme.vars.colors.text.primary};\n `;\n\n const subtitle: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 1);\n color: ${theme.vars.colors.text.secondary};\n `;\n\n return {\n card,\n header,\n subtitle,\n title,\n };\n }, [\n theme.vars.colors.background.surface,\n theme.vars.colors.text.primary,\n theme.vars.colors.text.secondary,\n theme.vars.borderRadius.large,\n theme.vars.spacing.unit,\n theme.vars.typography.fontFamily,\n colorScheme,\n ]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {FlowMetadataResponse, Preferences} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useCallback, useContext, useEffect, useRef, useState} from 'react';\nimport useStyles from './BaseAcceptInvite.styles';\nimport ComponentRendererContext, {\n ComponentRendererMap,\n} from '../../../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport useTheme from '../../../../../contexts/Theme/useTheme';\nimport useThunderID from '../../../../../contexts/ThunderID/useThunderID';\nimport useTranslation from '../../../../../hooks/useTranslation';\nimport {useOAuthCallback} from '../../../../../hooks/v2/useOAuthCallback';\nimport {initiateOAuthRedirect} from '../../../../../utils/oauth';\nimport {normalizeFlowResponse, extractErrorMessage} from '../../../../../utils/v2/flowTransformer';\nimport AlertPrimitive from '../../../../primitives/Alert/Alert';\nimport Button from '../../../../primitives/Button/Button';\n// eslint-disable-next-line import/no-named-as-default\nimport CardPrimitive, {CardProps} from '../../../../primitives/Card/Card';\nimport Spinner from '../../../../primitives/Spinner/Spinner';\nimport Typography from '../../../../primitives/Typography/Typography';\nimport {renderInviteUserComponents} from '../../AuthOptionFactory';\n\n/**\n * Flow response structure from the backend.\n */\nexport interface AcceptInviteFlowResponse {\n challengeToken?: string;\n data?: {\n additionalData?: Record<string, string>;\n components?: any[];\n meta?: {\n components?: any[];\n };\n redirectURL?: string;\n };\n executionId: string;\n failureReason?: string;\n flowStatus: 'INCOMPLETE' | 'COMPLETE' | 'ERROR';\n type?: 'VIEW' | 'REDIRECTION';\n}\n\n/**\n * Render props for custom UI rendering of AcceptInvite.\n */\nexport interface BaseAcceptInviteRenderProps {\n /**\n * Flow components from the current step.\n */\n components: any[];\n\n /**\n * API error (if any).\n */\n error?: Error | null;\n\n /**\n * Current flow ID from URL.\n */\n executionId?: string;\n\n /**\n * Field validation errors.\n */\n fieldErrors: Record<string, string>;\n\n /**\n * Navigate to sign in page.\n */\n goToSignIn?: () => void;\n\n /**\n * Function to handle input blur.\n */\n handleInputBlur: (name: string) => void;\n\n /**\n * Function to handle input changes.\n */\n handleInputChange: (name: string, value: string) => void;\n\n /**\n * Function to handle form submission.\n */\n handleSubmit: (component: any, data?: Record<string, any>) => Promise<void>;\n\n /**\n * Invite token from URL.\n */\n inviteToken?: string;\n\n /**\n * Whether the flow has completed successfully.\n */\n isComplete: boolean;\n\n /**\n * Loading state.\n */\n isLoading: boolean;\n\n /**\n * Whether the token validation failed.\n */\n isTokenInvalid: boolean;\n\n /**\n * Whether the form is valid.\n */\n isValid: boolean;\n\n /**\n * Whether the invite token is being validated.\n */\n isValidatingToken: boolean;\n\n /**\n * Flow metadata returned by the platform (v2 only). `null` while loading or unavailable.\n */\n meta: FlowMetadataResponse | null;\n\n /**\n * Subtitle for the current step.\n */\n subtitle?: string;\n\n /**\n * Title for the current step.\n */\n title?: string;\n\n /**\n * Touched fields.\n */\n touched: Record<string, boolean>;\n\n /**\n * Form values for the current step.\n */\n values: Record<string, string>;\n}\n\n/**\n * Props for the BaseAcceptInvite component.\n */\nexport interface BaseAcceptInviteProps {\n /**\n * Render props function for custom UI.\n * If not provided, default UI will be rendered.\n */\n children?: (props: BaseAcceptInviteRenderProps) => ReactNode;\n\n /**\n * Custom CSS class name.\n */\n className?: string;\n\n /**\n * Flow ID from the invite link URL.\n */\n executionId?: string;\n\n /**\n * Invite token from the invite link URL.\n */\n inviteToken?: string;\n\n /**\n * Callback when the flow completes successfully.\n */\n onComplete?: () => void;\n\n /**\n * Callback when an error occurs.\n */\n onError?: (error: Error) => void;\n\n /**\n * Callback when the flow state changes.\n */\n onFlowChange?: (response: AcceptInviteFlowResponse) => void;\n\n /**\n * Callback to navigate to sign in page.\n */\n onGoToSignIn?: () => void;\n\n /**\n * Function to submit flow step data.\n * This makes a request to the flow/execute endpoint.\n */\n onSubmit: (payload: Record<string, any>) => Promise<AcceptInviteFlowResponse>;\n\n /**\n * Component-level preferences to override global i18n and theme settings.\n * Preferences are deep-merged with global ones, with component preferences\n * taking precedence. Affects this component and all its descendants.\n */\n preferences?: Preferences;\n\n /**\n * Whether to show the subtitle.\n */\n showSubtitle?: boolean;\n\n /**\n * Whether to show the title.\n */\n showTitle?: boolean;\n\n /**\n * Size variant for the component.\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Theme variant for the component.\n */\n variant?: CardProps['variant'];\n}\n\n/**\n * Base component for accept invite flow (end-user).\n * Handles the flow logic for validating an invite token and setting a password.\n *\n * When no children are provided, renders a default UI with:\n * - Loading spinner during token validation\n * - Error alerts for invalid/expired tokens\n * - Password form with validation\n * - Success state with sign-in redirect\n *\n * Flow steps handled:\n * 1. Validate invite token (automatic on mount)\n * 2. Password input\n * 3. Flow completion\n */\nconst BaseAcceptInvite: FC<BaseAcceptInviteProps> = ({\n executionId,\n inviteToken,\n onSubmit,\n onComplete,\n onError,\n onFlowChange,\n onGoToSignIn,\n className = '',\n children,\n preferences,\n size = 'medium',\n variant = 'outlined',\n showTitle = true,\n showSubtitle = true,\n}: BaseAcceptInviteProps): ReactElement => {\n const {meta, isInitialized, getStorageManager} = useThunderID();\n const {t} = useTranslation(preferences?.i18n);\n const {theme} = useTheme();\n const customRenderers: ComponentRendererMap = useContext(ComponentRendererContext);\n const styles: any = useStyles(theme, theme.vars.colors.text.primary);\n const [isLoading, setIsLoading] = useState(false);\n const [isValidatingToken, setIsValidatingToken] = useState(true);\n const [isTokenInvalid, setIsTokenInvalid] = useState(false);\n const [isComplete, setIsComplete] = useState(false);\n const [currentFlow, setCurrentFlow] = useState<AcceptInviteFlowResponse | null>(null);\n const [apiError, setApiError] = useState<Error | null>(null);\n const [formValues, setFormValues] = useState<Record<string, string>>({});\n const [formErrors, setFormErrors] = useState<Record<string, string>>({});\n const [touchedFields, setTouchedFields] = useState<Record<string, boolean>>({});\n const [isFormValid, setIsFormValid] = useState(true);\n const [isStorageReady, setIsStorageReady] = useState(false);\n const challengeTokenRef: any = useRef<string | null>(null);\n\n const tokenValidationAttemptedRef: any = useRef(false);\n\n /**\n * Restore any challenge token persisted before an OAuth redirect.\n * Waits for SDK initialization before reading from storage.\n */\n useEffect(() => {\n if (!isInitialized) return;\n\n (async (): Promise<void> => {\n try {\n const storageManager: any = await getStorageManager();\n const tempData: any = await storageManager?.getTemporaryData();\n if (tempData?.challengeToken) {\n challengeTokenRef.current = tempData.challengeToken as string;\n }\n } finally {\n setIsStorageReady(true);\n }\n })();\n }, [isInitialized]);\n\n /**\n * Updates challengeTokenRef immediately (stale-closure safe) and persists via\n * the provider's StorageManager so the token survives OAuth redirects.\n */\n const setChallengeToken = async (challengeToken: string | null): Promise<void> => {\n challengeTokenRef.current = challengeToken;\n const storageManager: any = await getStorageManager();\n if (storageManager) {\n if (challengeToken) {\n await storageManager.setTemporaryDataParameter('challengeToken', challengeToken);\n } else {\n await storageManager.removeTemporaryDataParameter('challengeToken');\n }\n }\n };\n\n /**\n * Handle error responses and extract meaningful error messages.\n * Uses the transformer's extractErrorMessage function for consistency.\n */\n const handleError: any = useCallback(\n (error: any) => {\n // Extract error message from response failureReason or use extractErrorMessage\n const errorMessage: string =\n error?.failureReason || extractErrorMessage(error, t, 'components.acceptInvite.errors.generic');\n\n // Set the API error state\n setApiError(error instanceof Error ? error : new Error(errorMessage));\n\n // Call the onError callback if provided\n onError?.(error instanceof Error ? error : new Error(errorMessage));\n },\n [t, onError],\n );\n\n /**\n * Normalize flow response to ensure component-driven format.\n * Transforms data.meta.components to data.components.\n */\n const normalizeFlowResponseLocal: any = useCallback(\n (response: AcceptInviteFlowResponse): AcceptInviteFlowResponse => {\n if (!response?.data?.meta?.components) {\n return response;\n }\n\n try {\n const {components} = normalizeFlowResponse(\n response,\n t,\n {\n defaultErrorKey: 'components.acceptInvite.errors.generic',\n resolveTranslations: false,\n },\n meta,\n );\n\n return {\n ...response,\n data: {\n ...response.data,\n components: components as any,\n },\n };\n } catch {\n // If transformer throws (e.g., error response), return as-is\n return response;\n }\n },\n [t, children],\n );\n\n /**\n * Handle OAuth callback when returning from OAuth provider.\n * This hook processes the authorization code and continues the flow.\n */\n useOAuthCallback({\n currentExecutionId: executionId ?? null,\n isInitialized: isStorageReady,\n onComplete: () => {\n setIsValidatingToken(false);\n onComplete?.();\n },\n onError: (error: any) => {\n if (!error?.flowStatus) {\n setIsTokenInvalid(true);\n }\n setIsValidatingToken(false);\n handleError(error);\n },\n onFlowChange: (response: any) => {\n onFlowChange?.(response);\n if (response.flowStatus === 'COMPLETE') {\n setIsComplete(true);\n const completionComponents: any[] = response.data?.components || response.data?.meta?.components || [];\n if (completionComponents.length > 0) {\n setCurrentFlow(response);\n }\n } else {\n // Initialize currentFlow for next steps if not complete\n setCurrentFlow(response);\n setFormValues({});\n setFormErrors({});\n setTouchedFields({});\n }\n },\n onProcessingStart: () => {\n setIsValidatingToken(true);\n },\n onSubmit: async (payload: any) => {\n const rawResponse: any = await onSubmit({\n ...payload,\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n });\n const response: any = normalizeFlowResponseLocal(rawResponse);\n await setChallengeToken(response.challengeToken ?? null);\n return response;\n },\n tokenValidationAttemptedRef,\n });\n\n /**\n * Handle input value changes.\n */\n const handleInputChange: any = useCallback((name: string, value: string) => {\n setFormValues((prev: any) => ({...prev, [name]: value}));\n // Clear error when user starts typing\n setFormErrors((prev: any) => {\n const newErrors: any = {...prev};\n delete newErrors[name];\n return newErrors;\n });\n setIsFormValid(true);\n }, []);\n\n /**\n * Handle input blur.\n */\n const handleInputBlur: any = useCallback((name: string) => {\n setTouchedFields((prev: any) => ({...prev, [name]: true}));\n }, []);\n\n /**\n * Validate required fields based on components.\n */\n const validateForm: any = useCallback(\n (components: any[]): {errors: Record<string, string>; isValid: boolean} => {\n const errors: Record<string, string> = {};\n\n const validateComponents = (comps: any[]): any => {\n comps.forEach((comp: any) => {\n if (\n (comp.type === 'PASSWORD_INPUT' ||\n comp.type === 'TEXT_INPUT' ||\n comp.type === 'EMAIL_INPUT' ||\n comp.type === 'PHONE_INPUT' ||\n comp.type === 'OTP_INPUT') &&\n comp.required &&\n comp.ref\n ) {\n const value: any = formValues[comp.ref];\n if (!value || value.trim() === '') {\n errors[comp.ref] = t('validations.required.field.error');\n }\n }\n if (comp.components && Array.isArray(comp.components)) {\n validateComponents(comp.components);\n }\n });\n };\n\n validateComponents(components);\n\n return {errors, isValid: Object.keys(errors).length === 0};\n },\n [formValues, t],\n );\n\n /**\n * Handle form submission.\n */\n const handleSubmit: any = useCallback(\n async (component: any, data?: Record<string, any>) => {\n if (!currentFlow) {\n return;\n }\n\n // Validate form before submission\n const components: any = currentFlow.data?.components || [];\n const validation: any = validateForm(components);\n\n if (!validation.isValid) {\n setIsFormValid(false);\n setFormErrors(validation.errors);\n // Mark all fields as touched\n const touched: Record<string, boolean> = {};\n Object.keys(validation.errors).forEach((key: any) => {\n touched[key] = true;\n });\n setTouchedFields((prev: any) => ({...prev, ...touched}));\n return;\n }\n\n setIsLoading(true);\n setApiError(null);\n\n try {\n // Build payload with form values\n const inputs: any = data || formValues;\n\n const payload: Record<string, any> = {\n executionId: currentFlow.executionId,\n inputs,\n verbose: true,\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n };\n\n // Add action ID if component has one\n if (component?.id) {\n payload['action'] = component.id;\n }\n\n const rawResponse: any = await onSubmit(payload);\n const response: any = normalizeFlowResponseLocal(rawResponse);\n onFlowChange?.(response);\n\n await setChallengeToken(response.challengeToken ?? null);\n\n // Handle OAuth redirect response\n if (response.type === 'REDIRECTION') {\n const redirectURL: any = response.data?.redirectURL || response?.redirectURL;\n if (redirectURL && typeof window !== 'undefined') {\n // Initiate OAuth redirect with secure state management\n initiateOAuthRedirect(redirectURL);\n return;\n }\n }\n\n // Check for completion\n if (response.flowStatus === 'COMPLETE') {\n setIsComplete(true);\n const completionComponents: any[] = response.data?.components || response.data?.meta?.components || [];\n if (completionComponents.length > 0) {\n setCurrentFlow(response);\n } else {\n onComplete?.();\n }\n return;\n }\n\n // Check for error status\n if (response.flowStatus === 'ERROR') {\n handleError(response);\n return;\n }\n\n // Update current flow and reset form state for next step, preserving input values\n setCurrentFlow(response);\n setFormErrors({});\n setTouchedFields({});\n } catch (err) {\n handleError(err);\n } finally {\n setIsLoading(false);\n }\n },\n [\n currentFlow,\n formValues,\n validateForm,\n onSubmit,\n onFlowChange,\n onComplete,\n handleError,\n normalizeFlowResponseLocal,\n ],\n );\n\n /**\n * Validate invite token on component mount.\n */\n useEffect(() => {\n // Skip validation if already validated\n if (tokenValidationAttemptedRef.current) {\n return;\n }\n\n // If an OAuth code is present, this is a return from an OAuth redirect.\n // useOAuthCallback will handle the code — skip the initial invite validation.\n const urlParams: URLSearchParams = new URLSearchParams(window.location.search);\n if (urlParams.get('code')) {\n return;\n }\n\n // Validate required params for initial invite link\n if (!executionId || !inviteToken) {\n setIsValidatingToken(false);\n setIsTokenInvalid(true);\n handleError(new Error('Invalid invite link. Missing executionId or inviteToken.'));\n return;\n }\n\n tokenValidationAttemptedRef.current = true;\n\n (async (): Promise<void> => {\n setIsValidatingToken(true);\n setApiError(null);\n\n try {\n // Store executionId in sessionStorage for OAuth callback\n if (executionId) {\n sessionStorage.setItem('thunderid_execution_id', executionId);\n }\n\n // Send the invite token to validate and continue the flow\n const payload: any = {\n executionId,\n inputs: {\n inviteToken,\n },\n verbose: true,\n };\n\n const rawResponse: any = await onSubmit(payload);\n const response: any = normalizeFlowResponseLocal(rawResponse);\n onFlowChange?.(response);\n\n await setChallengeToken(response.challengeToken ?? null);\n\n // Check for error (invalid token)\n if (response.flowStatus === 'ERROR') {\n setIsTokenInvalid(true);\n handleError(response);\n return;\n }\n\n // Token is valid, show the password form\n setCurrentFlow(response);\n } catch (err) {\n setIsTokenInvalid(true);\n handleError(err);\n } finally {\n setIsValidatingToken(false);\n }\n })();\n }, [executionId, inviteToken, onSubmit, onFlowChange, handleError, normalizeFlowResponseLocal]);\n\n /**\n * Extract title and subtitle from components.\n */\n const extractHeadings: any = useCallback((components: any[]): {subtitle?: string; title?: string} => {\n let title: string | undefined;\n let subtitle: string | undefined;\n\n components.forEach((comp: any) => {\n if (comp.type === 'TEXT') {\n if (comp.variant === 'HEADING_1' && !title) {\n title = comp.label;\n } else if ((comp.variant === 'HEADING_2' || comp.variant === 'SUBTITLE_1') && !subtitle) {\n subtitle = comp.label;\n }\n }\n });\n\n return {subtitle, title};\n }, []);\n\n /**\n * Filter out heading components for default rendering.\n */\n const filterHeadings: any = useCallback(\n (components: any[]): any[] =>\n components.filter(\n (comp: any) => !(comp.type === 'TEXT' && (comp.variant === 'HEADING_1' || comp.variant === 'HEADING_2')),\n ),\n [],\n );\n\n // Get components from normalized response, with fallback to meta.components\n const components: any = currentFlow?.data?.components || currentFlow?.data?.meta?.components || [];\n const {title, subtitle} = extractHeadings(components);\n const componentsWithoutHeadings: any = filterHeadings(components);\n\n // Render props\n const renderProps: BaseAcceptInviteRenderProps = {\n components,\n error: apiError,\n executionId,\n fieldErrors: formErrors,\n goToSignIn: onGoToSignIn,\n handleInputBlur,\n handleInputChange,\n handleSubmit,\n inviteToken,\n isComplete,\n isLoading,\n isTokenInvalid,\n isValid: isFormValid,\n isValidatingToken,\n meta,\n subtitle,\n title,\n touched: touchedFields,\n values: formValues,\n };\n\n // If children render prop is provided, use it for custom UI\n if (children) {\n return <div className={className}>{children(renderProps)}</div>;\n }\n\n // Default rendering\n\n // Loading state during token validation\n if (isValidatingToken) {\n return (\n <CardPrimitive className={cx(className, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <div style={{alignItems: 'center', display: 'flex', flexDirection: 'column', gap: '1rem', padding: '2rem'}}>\n <Spinner size=\"medium\" />\n <Typography variant=\"body1\">Validating your invite link...</Typography>\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n // Invalid token state\n if (isTokenInvalid) {\n return (\n <CardPrimitive className={cx(className, styles.card)} variant={variant}>\n <CardPrimitive.Header className={styles.header}>\n <CardPrimitive.Title level={2} className={styles.title}>\n Invalid Invite Link\n </CardPrimitive.Title>\n </CardPrimitive.Header>\n <CardPrimitive.Content>\n <AlertPrimitive variant=\"error\">\n <AlertPrimitive.Title>Unable to verify invite</AlertPrimitive.Title>\n <AlertPrimitive.Description>\n {apiError?.message ||\n 'This invite link is invalid or has expired. Please contact your administrator for a new invite.'}\n </AlertPrimitive.Description>\n </AlertPrimitive>\n {onGoToSignIn && (\n <div style={{display: 'flex', justifyContent: 'center', marginTop: '1.5rem'}}>\n <Button variant=\"outline\" onClick={onGoToSignIn}>\n Go to Sign In\n </Button>\n </div>\n )}\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n // Flow components (password form)\n return (\n <CardPrimitive className={cx(className, styles.card)} variant={variant}>\n {(showTitle || showSubtitle) && (title || subtitle) && (\n <CardPrimitive.Header className={styles.header}>\n {showTitle && title && (\n <CardPrimitive.Title level={2} className={styles.title}>\n {title}\n </CardPrimitive.Title>\n )}\n {showSubtitle && subtitle && (\n <Typography variant=\"body1\" className={styles.subtitle}>\n {subtitle}\n </Typography>\n )}\n </CardPrimitive.Header>\n )}\n <CardPrimitive.Content>\n {apiError && (\n <div style={{marginBottom: '1rem'}}>\n <AlertPrimitive variant=\"error\">\n <AlertPrimitive.Description>{apiError.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n </div>\n )}\n <div>\n {componentsWithoutHeadings && componentsWithoutHeadings.length > 0\n ? renderInviteUserComponents(\n componentsWithoutHeadings,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n handleInputChange,\n {\n _customRenderers: customRenderers,\n _theme: theme,\n onInputBlur: handleInputBlur,\n onSubmit: handleSubmit,\n size,\n variant,\n },\n )\n : !isLoading && (\n <AlertPrimitive variant=\"warning\">\n <Typography variant=\"body1\">No form components available</Typography>\n </AlertPrimitive>\n )}\n {isLoading && (\n <div style={{display: 'flex', justifyContent: 'center', padding: '1rem'}}>\n <Spinner size=\"small\" />\n </div>\n )}\n </div>\n {onGoToSignIn && (\n <div style={{marginTop: '1.5rem', textAlign: 'center'}}>\n <Typography variant=\"body2\">\n Already have an account?{' '}\n <Button variant=\"text\" onClick={onGoToSignIn} style={{minWidth: 'auto', padding: 0}}>\n Sign In\n </Button>\n </Typography>\n </div>\n )}\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n};\n\nexport default BaseAcceptInvite;\n","/**\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 {FC, ReactElement, ReactNode, useMemo} from 'react';\nimport BaseAcceptInvite, {BaseAcceptInviteRenderProps, AcceptInviteFlowResponse} from './BaseAcceptInvite';\n\n/**\n * Render props for AcceptInvite (re-exported for convenience).\n */\nexport type AcceptInviteRenderProps = BaseAcceptInviteRenderProps;\n\n/**\n * Props for the AcceptInvite component.\n */\nexport interface AcceptInviteProps {\n /**\n * Base URL for the Thunder API server.\n * If not provided, will try to read from window location.\n */\n baseUrl?: string;\n\n /**\n * Render props function for custom UI.\n * If not provided, default UI will be rendered by the SDK.\n */\n children?: (props: AcceptInviteRenderProps) => ReactNode;\n\n /**\n * Custom CSS class name.\n */\n className?: string;\n\n /**\n * Flow ID from the invite link.\n * If not provided, will be extracted from URL query parameters.\n */\n executionId?: string;\n\n /**\n * Invite token from the invite link.\n * If not provided, will be extracted from URL query parameters.\n */\n inviteToken?: string;\n\n /**\n * Callback when the flow completes successfully.\n */\n onComplete?: () => void;\n\n /**\n * Callback when an error occurs.\n */\n onError?: (error: Error) => void;\n\n /**\n * Callback when the flow state changes.\n */\n onFlowChange?: (response: AcceptInviteFlowResponse) => void;\n\n /**\n * Callback to navigate to sign in page.\n */\n onGoToSignIn?: () => void;\n\n /**\n * Whether to show the subtitle.\n */\n showSubtitle?: boolean;\n\n /**\n * Whether to show the title.\n */\n showTitle?: boolean;\n\n /**\n * Size variant for the component.\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Theme variant for the component card.\n */\n variant?: 'outlined' | 'elevated';\n}\n\n/**\n * Helper to extract query parameters from URL.\n */\nconst getUrlParams = (): {executionId?: string; inviteToken?: string} => {\n if (typeof window === 'undefined') {\n return {};\n }\n\n const params: any = new URLSearchParams(window.location.search);\n return {\n executionId: params.get('executionId') || undefined,\n inviteToken: params.get('inviteToken') || undefined,\n };\n};\n\n/**\n * AcceptInvite component for end-users to accept an invite and set their password.\n *\n * This component is designed for end users accessing the thunder-gate app via an invite link.\n * It automatically:\n * 1. Extracts executionId and inviteToken from URL query parameters\n * 2. Validates the invite token with the backend\n * 3. Displays the password form if token is valid\n * 4. Completes the accept invite when password is set\n *\n * @example\n * ```tsx\n * import { AcceptInvite } from '@thunderid/react';\n *\n * // URL: /invite?executionId=xxx&inviteToken=yyy\n *\n * const AcceptInvitePage = () => {\n * return (\n * <AcceptInvite\n * baseUrl=\"https://api.thunder.io\"\n * onComplete={() => navigate('/signin')}\n * onError={(error) => console.error(error)}\n * >\n * {({ values, components, isLoading, isComplete, isValidatingToken, isTokenInvalid, error, handleInputChange, handleSubmit }) => (\n * <div>\n * {isValidatingToken && <p>Validating your invite...</p>}\n * {isTokenInvalid && <p>Invalid or expired invite link</p>}\n * {isComplete && <p>Registration complete! You can now sign in.</p>}\n * {!isComplete && !isValidatingToken && !isTokenInvalid && (\n * // Render password form based on components\n * )}\n * </div>\n * )}\n * </AcceptInvite>\n * );\n * };\n * ```\n */\nconst AcceptInvite: FC<AcceptInviteProps> = ({\n baseUrl,\n executionId: executionIdProp,\n inviteToken: inviteTokenProp,\n onComplete,\n onError,\n onFlowChange,\n onGoToSignIn,\n className,\n children,\n size = 'medium',\n variant = 'outlined',\n showTitle = true,\n showSubtitle = true,\n}: AcceptInviteProps): ReactElement => {\n // Extract from URL if not provided as props\n const {executionId: urlExecutionId, inviteToken: urlInviteToken} = useMemo(() => getUrlParams(), []);\n\n const executionId: any = executionIdProp || urlExecutionId;\n const inviteToken: any = inviteTokenProp || urlInviteToken;\n\n // Determine base URL\n const apiBaseUrl: any = useMemo(() => {\n if (baseUrl) {\n return baseUrl;\n }\n // Try to construct from current location (assuming same origin)\n if (typeof window !== 'undefined') {\n return window.location.origin;\n }\n return '';\n }, [baseUrl]);\n\n /**\n * Submit flow step data.\n * Makes an unauthenticated request to /flow/execute endpoint.\n */\n const handleSubmit = async (payload: Record<string, any>): Promise<AcceptInviteFlowResponse> => {\n const response: any = await fetch(`${apiBaseUrl}/flow/execute`, {\n body: JSON.stringify({\n ...payload,\n verbose: true,\n }),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n });\n\n if (!response.ok) {\n const errorText: any = await response.text();\n throw new Error(`Request failed: ${errorText}`);\n }\n\n return response.json();\n };\n\n return (\n <BaseAcceptInvite\n executionId={executionId}\n inviteToken={inviteToken}\n onSubmit={handleSubmit}\n onComplete={onComplete}\n onError={onError}\n onFlowChange={onFlowChange}\n onGoToSignIn={onGoToSignIn}\n className={className}\n size={size}\n variant={variant}\n showTitle={showTitle}\n showSubtitle={showSubtitle}\n >\n {children}\n </BaseAcceptInvite>\n );\n};\n\nexport default AcceptInvite;\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {navigate as browserNavigate} from '@thunderid/browser';\nimport {FC, useEffect, useRef} from 'react';\n\n/**\n * Props for Callback component\n */\nexport interface CallbackProps {\n /**\n * Callback function called when an error occurs\n */\n onError?: (error: Error) => void;\n\n /**\n * Function to navigate to a different path.\n * If not provided, falls back to the browser navigate utility (SPA navigation via History API for same-origin paths).\n * Provide this prop to enable framework-specific navigation (e.g., from React Router).\n */\n onNavigate?: (path: string) => void;\n}\n\n/**\n * BaseCallback is a headless component that handles OAuth callback parameter forwarding.\n * This component extracts OAuth parameters (code, state, error) from the URL and forwards them\n * to the original component that initiated the OAuth flow.\n *\n * Works standalone using the browser navigate utility (History API) for navigation by default.\n * Pass an onNavigate prop to enable framework-specific navigation (e.g., via React Router).\n *\n * Flow: Extract OAuth parameters from URL -> Parse state parameter -> Redirect to original path with parameters\n *\n * The original component (SignIn/AcceptInvite) is responsible for:\n * - Processing the OAuth code via the SDK\n * - Calling /flow/execute\n * - Handling the assertion and auth/callback POST\n * - Managing the authenticated session\n */\nexport const Callback: FC<CallbackProps> = ({onNavigate, onError}: CallbackProps) => {\n // Prevent double execution in React Strict Mode\n const processingRef: any = useRef(false);\n\n // Resolve navigation: use provided onNavigate (router-aware) or fall back to browser navigate utility\n const navigate = (path: string): void => {\n if (onNavigate) {\n onNavigate(path);\n } else {\n browserNavigate(path);\n }\n };\n\n useEffect(() => {\n const processOAuthCallback = (): void => {\n // Guard against double execution\n if (processingRef.current) {\n return;\n }\n processingRef.current = true;\n\n // Declare variables outside try block for use in catch\n let returnPath = '/';\n\n try {\n // 1. Extract OAuth parameters from URL\n const urlParams: URLSearchParams = new URLSearchParams(window.location.search);\n const code: string | null = urlParams.get('code');\n const state: string | null = urlParams.get('state');\n const nonce: string | null = urlParams.get('nonce');\n const oauthError: string | null = urlParams.get('error');\n const errorDescription: string | null = urlParams.get('error_description');\n\n // 1a. If running inside a popup (e.g. social signup), send OAuth params\n // back to the opener via postMessage. The parent window's handler will\n // close this popup after processing the code.\n if (window.opener) {\n window.opener.postMessage({code, error: oauthError, errorDescription, nonce, state}, window.location.origin);\n return;\n }\n\n // 2. Validate and retrieve OAuth state from sessionStorage\n if (!state) {\n throw new Error('Missing OAuth state parameter - possible security issue');\n }\n\n const storedData: string | null = sessionStorage.getItem(`thunderid_oauth_${state}`);\n if (!storedData) {\n // If state not found, might be an error callback - try to handle gracefully\n if (oauthError) {\n const errorMsg: string = errorDescription || oauthError || 'OAuth authentication failed';\n const err: Error = new Error(errorMsg);\n onError?.(err);\n\n const params: URLSearchParams = new URLSearchParams();\n params.set('error', oauthError);\n if (errorDescription) {\n params.set('error_description', errorDescription);\n }\n\n navigate(`/?${params.toString()}`);\n return;\n }\n throw new Error('Invalid OAuth state - possible CSRF attack');\n }\n\n const {path, timestamp} = JSON.parse(storedData);\n returnPath = path || '/';\n\n // 3. Validate state freshness\n const MAX_STATE_AGE = 600000; // 10 minutes\n if (Date.now() - timestamp > MAX_STATE_AGE) {\n sessionStorage.removeItem(`thunderid_oauth_${state}`);\n throw new Error('OAuth state expired - please try again');\n }\n\n // 4. Clean up state\n sessionStorage.removeItem(`thunderid_oauth_${state}`);\n\n // 5. Handle OAuth error response\n if (oauthError) {\n const errorMsg: string = errorDescription || oauthError || 'OAuth authentication failed';\n const err: Error = new Error(errorMsg);\n onError?.(err);\n\n const params: URLSearchParams = new URLSearchParams();\n params.set('error', oauthError);\n if (errorDescription) {\n params.set('error_description', errorDescription);\n }\n\n navigate(`${returnPath}?${params.toString()}`);\n return;\n }\n\n // 6. Validate required parameters\n if (!code) {\n throw new Error('Missing OAuth authorization code');\n }\n\n // 7. Forward OAuth code to original component\n // The component (SignIn/AcceptInvite) will retrieve flowId/authId from sessionStorage\n const params: URLSearchParams = new URLSearchParams();\n params.set('code', code);\n if (nonce) {\n params.set('nonce', nonce);\n }\n\n navigate(`${returnPath}?${params.toString()}`);\n } catch (err) {\n const errorMessage: string = err instanceof Error ? err.message : 'OAuth callback processing failed';\n // eslint-disable-next-line no-console\n console.error('OAuth callback error:', err);\n\n onError?.(err instanceof Error ? err : new Error(errorMessage));\n\n // Redirect back with OAuth error format\n const params: URLSearchParams = new URLSearchParams();\n params.set('error', 'callback_error');\n params.set('error_description', errorMessage);\n\n navigate(`${returnPath}?${params.toString()}`);\n }\n };\n\n processOAuthCallback();\n }, [onNavigate, onError]);\n\n // Headless component - no UI, just processing logic\n return null;\n};\n\nexport default Callback;\n","/**\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 as IUser} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode} from 'react';\n\n/**\n * Props for the BaseUser component.\n */\nexport interface BaseUserProps {\n /**\n * Render prop that takes the user object and returns a ReactNode.\n * @param user - The authenticated user object from ThunderID.\n * @returns A ReactNode to render.\n */\n children: (user: IUser | null) => ReactNode;\n\n /**\n * Optional element to render when no user is provided.\n */\n fallback?: ReactNode;\n\n /**\n * The user object to display. If not provided, the component will render the fallback.\n */\n user: IUser | null;\n}\n\n/**\n * Base User component that provides the core functionality for displaying user information.\n * This component takes a user object as a prop and uses render props to expose it.\n *\n * @remarks This is the base component that can be used in any context where you have\n * a user object available. For React applications, use the User component which\n * automatically retrieves the user from ThunderID context.\n *\n * @example\n * ```tsx\n * import { BaseUser } from '@thunderid/auth-react';\n *\n * const MyComponent = ({ user }) => {\n * return (\n * <BaseUser user={user} fallback={<p>No user data</p>}>\n * {(user) => (\n * <div>\n * <h1>Welcome, {user.displayName}!</h1>\n * <p>Email: {user.email}</p>\n * </div>\n * )}\n * </BaseUser>\n * );\n * }\n * ```\n */\nconst BaseUser: FC<BaseUserProps> = ({user, children, fallback = null}: BaseUserProps): ReactElement => {\n if (!user) {\n return <>{fallback}</>;\n }\n\n return <>{children(user)}</>;\n};\n\nBaseUser.displayName = 'BaseUser';\n\nexport default BaseUser;\n","/**\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 as IUser} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode} from 'react';\nimport BaseUser, {BaseUserProps} from './BaseUser';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\n\n/**\n * Props for the User component.\n * Extends BaseUserProps but makes the user prop optional since it will be obtained from useThunderID\n */\nexport interface UserProps extends Omit<BaseUserProps, 'user'> {\n /**\n * Render prop that takes the user object and returns a ReactNode.\n * @param user - The authenticated user object from ThunderID.\n * @returns A ReactNode to render.\n */\n children: (user: IUser | null) => ReactNode;\n\n /**\n * Optional element to render when no user is signed in.\n */\n fallback?: ReactNode;\n}\n\n/**\n * A component that uses render props to expose the authenticated user object.\n * This component automatically retrieves the user from ThunderID context.\n *\n * @remarks This component is only supported in browser based React applications (CSR).\n *\n * @example\n * ```tsx\n * import { IUser } from '@thunderid/auth-react';\n *\n * const App = () => {\n * return (\n * <User fallback={<p>Please sign in</p>}>\n * {(user) => (\n * <div>\n * <h1>Welcome, {user.displayName}!</h1>\n * <p>Email: {user.email}</p>\n * </div>\n * )}\n * </User>\n * );\n * }\n * ```\n */\nconst User: FC<UserProps> = ({children, fallback = null}: UserProps): ReactElement => {\n const {user} = useThunderID();\n\n return (\n <BaseUser user={user} fallback={fallback}>\n {children}\n </BaseUser>\n );\n};\n\nUser.displayName = 'User';\n\nexport default User;\n","/**\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 {Organization as IOrganization} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode} from 'react';\n\n/**\n * Props for the BaseOrganization component.\n */\nexport interface BaseOrganizationProps {\n /**\n * Render prop that takes the organization object and returns a ReactNode.\n * @param organization - The organization object from ThunderID.\n * @returns A ReactNode to render.\n */\n children: (organization: IOrganization | null) => ReactNode;\n\n /**\n * Optional element to render when no organization is provided.\n */\n fallback?: ReactNode;\n\n /**\n * The organization object to display. If not provided, the component will render the fallback.\n */\n organization: IOrganization | null;\n}\n\n/**\n * Base Organization component that provides the core functionality for displaying organization information.\n * This component takes an organization object as a prop and uses render props to expose it.\n *\n * @remarks This is the base component that can be used in any context where you have\n * an organization object available. For React applications, use the Organization component which\n * automatically retrieves the current organization from Organization context.\n *\n * @example\n * ```tsx\n * import { BaseOrganization } from '@thunderid/auth-react';\n *\n * const MyComponent = ({ organization }) => {\n * return (\n * <BaseOrganization organization={organization} fallback={<p>No organization data</p>}>\n * {(org) => (\n * <div>\n * <h1>Organization: {org.name}</h1>\n * <p>ID: {org.id}</p>\n * </div>\n * )}\n * </BaseOrganization>\n * );\n * }\n * ```\n */\nconst BaseOrganization: FC<BaseOrganizationProps> = ({\n children,\n fallback = null,\n organization,\n}: BaseOrganizationProps): ReactElement => {\n if (!organization) {\n return <>{fallback}</>;\n }\n\n return <>{children(organization)}</>;\n};\n\nBaseOrganization.displayName = 'BaseOrganization';\n\nexport default BaseOrganization;\n","/**\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 {Organization as IOrganization} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode} from 'react';\nimport BaseOrganization, {BaseOrganizationProps} from './BaseOrganization';\nimport useOrganization from '../../../contexts/Organization/useOrganization';\n\n/**\n * Props for the Organization component.\n * Extends BaseOrganizationProps but makes the organization prop optional since it will be obtained from useOrganization\n */\nexport interface OrganizationProps extends Omit<BaseOrganizationProps, 'organization'> {\n /**\n * Render prop that takes the organization object and returns a ReactNode.\n * @param organization - The current organization object from Organization context.\n * @returns A ReactNode to render.\n */\n children: (organization: IOrganization | null) => ReactNode;\n\n /**\n * Optional element to render when no organization is selected.\n */\n fallback?: ReactNode;\n}\n\n/**\n * A component that uses render props to expose the current organization object.\n * This component automatically retrieves the current organization from Organization context.\n *\n * @remarks This component is only supported in browser based React applications (CSR).\n *\n * @example\n * ```tsx\n * import { Organization } from '@thunderid/auth-react';\n *\n * const App = () => {\n * return (\n * <Organization fallback={<p>No organization selected</p>}>\n * {(organization) => (\n * <div>\n * <h1>Current Organization: {organization.name}!</h1>\n * <p>ID: {organization.id}</p>\n * <p>Role: {organization.role}</p>\n * {organization.memberCount && (\n * <p>Members: {organization.memberCount}</p>\n * )}\n * </div>\n * )}\n * </Organization>\n * );\n * }\n * ```\n */\nconst Organization: FC<OrganizationProps> = ({children, fallback = null}: OrganizationProps): ReactElement => {\n const {currentOrganization} = useOrganization();\n\n return (\n <BaseOrganization organization={currentOrganization} fallback={fallback}>\n {children}\n </BaseOrganization>\n );\n};\n\nOrganization.displayName = 'Organization';\n\nexport default Organization;\n","/**\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 {css} from '@emotion/css';\nimport {Theme, withVendorCSSClassPrefix} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the BaseUserProfile component\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> => {\n const valuePlaceholder: string = css`\n font-style: italic;\n opacity: 0.7;\n `;\n\n const editButton: string = css`\n font-style: italic;\n text-decoration: underline;\n opacity: 0.7;\n padding: 0;\n min-height: auto;\n\n &:hover:not(:disabled) {\n background-color: transparent;\n }\n `;\n\n const fieldInner: string = css`\n flex: 1;\n display: flex;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n `;\n\n const fieldActions: string = css`\n display: flex;\n gap: calc(${theme.vars.spacing.unit} / 2);\n align-items: center;\n margin-inline-start: calc(${theme.vars.spacing.unit} * 4);\n `;\n\n const complexTextarea: string = css`\n min-height: 60px;\n width: 100%;\n padding: 8px;\n border: 1px solid ${theme.vars.colors.border};\n border-radius: ${theme.vars.borderRadius.small};\n resize: vertical;\n `;\n\n const objectKey: string = css`\n padding: ${theme.vars.spacing.unit};\n vertical-align: top;\n `;\n\n const objectValue: string = css`\n padding: ${theme.vars.spacing.unit};\n vertical-align: top;\n `;\n\n return useMemo(() => {\n const root: string = css`\n padding: calc(${theme.vars.spacing.unit} * 4);\n min-width: 600px;\n margin: 0 auto;\n font-family: ${theme.vars.typography.fontFamily};\n `;\n\n const card: string = css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n `;\n\n const header: string = css`\n display: flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} * 1.5);\n margin-bottom: calc(${theme.vars.spacing.unit} * 1.5);\n `;\n\n const profileInfo: string = css`\n flex: 1;\n `;\n\n const name: string = css`\n font-size: 1.5rem;\n font-weight: 600;\n margin: 0;\n color: ${theme.vars.colors.text.primary};\n `;\n\n const profileSummary: string = css`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n `;\n\n const sectionRow: string = css`\n display: flex;\n align-items: center;\n padding: calc(${theme.vars.spacing.unit} * 1) 0;\n `;\n\n const sectionLabel: string = css`\n font-size: 0.875rem;\n font-weight: 600;\n color: ${theme.vars.colors.text.primary};\n width: 160px;\n flex-shrink: 0;\n `;\n\n const sectionValue: string = css`\n flex: 1;\n display: flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} * 1.5);\n font-size: 0.875rem;\n color: ${theme.vars.colors.text.primary};\n `;\n\n const infoContainer: string = css`\n display: flex;\n flex-direction: column;\n `;\n\n const info: string = css`\n padding: calc(${theme.vars.spacing.unit} * 1.5) 0;\n border-bottom: 1px solid ${theme.vars.colors.border};\n `;\n\n const field: string = css`\n display: flex;\n align-items: center;\n padding: calc(${theme.vars.spacing.unit} / 2) 0;\n min-height: 28px;\n `;\n\n const lastField: string = css`\n border-bottom: none;\n `;\n\n const label: string = css`\n font-size: 0.875rem;\n font-weight: 500;\n color: ${theme.vars.colors.text.secondary};\n width: 120px;\n flex-shrink: 0;\n line-height: 28px;\n text-align: start;\n `;\n\n const value: string = css`\n color: ${theme.vars.colors.text.primary};\n flex: 1;\n display: inline-block;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n overflow: hidden;\n min-height: 28px;\n line-height: 28px;\n word-break: break-word;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 350px;\n text-align: start;\n\n .${withVendorCSSClassPrefix('form-control')} {\n margin-bottom: 0;\n }\n\n input {\n margin: 0;\n }\n\n table {\n background-color: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.medium};\n white-space: normal;\n }\n\n td {\n border-color: ${theme.vars.colors.border};\n }\n `;\n\n const popup: string = css`\n padding: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const alert: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 3);\n `;\n\n return {\n alert,\n card,\n complexTextarea,\n editButton,\n field,\n fieldActions,\n fieldInner,\n header,\n info,\n infoContainer,\n label,\n lastField,\n name,\n objectKey,\n objectValue,\n popup,\n profileInfo,\n profileSummary,\n root,\n sectionLabel,\n sectionRow,\n sectionValue,\n value,\n valuePlaceholder,\n };\n }, [\n theme.vars.colors.background.surface,\n theme.vars.colors.text.primary,\n theme.vars.colors.text.secondary,\n theme.vars.colors.border,\n theme.vars.borderRadius.large,\n theme.vars.borderRadius.medium,\n theme.vars.spacing.unit,\n theme.vars.typography.fontFamily,\n colorScheme,\n ]);\n};\n\nexport default useStyles;\n","/**\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, get} from '@thunderid/browser';\n\n/**\n * Retrieves a user profile value based on attribute mapping configuration.\n *\n * This function allows flexible mapping of component attribute names to actual\n * user profile field paths. It supports both simple string mappings and arrays\n * of potential field paths for fallback scenarios.\n *\n * @param key - The logical attribute name to retrieve (e.g., 'firstName', 'email')\n * @param mappings - Object mapping logical names to user profile field paths\n * @param user - The user object to extract values from\n * @returns The mapped value from the user profile, or undefined if not found\n *\n * @example\n * ```typescript\n * const mappings = {\n * firstName: 'name.givenName',\n * email: 'emails[0]',\n * picture: ['profileUrl', 'profile', 'avatar'] // fallback options\n * };\n *\n * const user = {\n * name: { givenName: 'John' },\n * emails: ['john@example.com'],\n * profileUrl: 'https://example.com/avatar.jpg'\n * };\n *\n * getMappedUserProfileValue('firstName', mappings, user); // 'John'\n * getMappedUserProfileValue('email', mappings, user); // 'john@example.com'\n * getMappedUserProfileValue('picture', mappings, user); // 'https://example.com/avatar.jpg'\n * ```\n */\nconst getMappedUserProfileValue = (key: string, mappings: Record<string, string | string[]>, user: User): any => {\n if (!key || !mappings || !user) {\n return undefined;\n }\n\n const mapping: string | string[] = mappings[key];\n\n if (!mapping) {\n // If no mapping defined, try to get the value directly from the user object\n return get(user, key);\n }\n\n // If mapping is an array, try each path until we find a value\n if (Array.isArray(mapping)) {\n let foundValue: any;\n let found = false;\n mapping.some((path: string) => {\n const value: any = get(user, path);\n if (value !== undefined && value !== null && value !== '') {\n foundValue = value;\n found = true;\n return true;\n }\n return false;\n });\n return found ? foundValue : undefined;\n }\n\n // For single string mapping, get the value directly\n return get(user, mapping);\n};\n\nexport default getMappedUserProfileValue;\n","/**\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} from '@thunderid/browser';\nimport getMappedUserProfileValue from './getMappedUserProfileValue';\n\n/**\n * Get the display name of a user by mapping their profile attributes.\n *\n * @param mergedMappings - The merged attribute mappings.\n * @param user - The user object containing profile information.\n * @param displayAttributes - Optional array of attribute keys or paths to try first.\n * Each entry is resolved via `getMappedUserProfileValue`. The first non-empty\n * value found is returned. If none resolve, the default fallback chain is used.\n *\n * @example\n * ```ts\n * // Default behavior — tries firstName+lastName, then username, email, name\n * const displayName = getDisplayName(mergedMappings, user);\n *\n * // Custom attributes — try 'nickname' first, then fall back to defaults\n * const displayName = getDisplayName(mergedMappings, user, ['nickname']);\n *\n * // Multiple custom attributes\n * const displayName = getDisplayName(mergedMappings, user, ['preferred_username', 'nickname']);\n * ```\n *\n * @returns The display name of the user.\n */\nconst getDisplayName = (\n mergedMappings: Record<string, string | string[] | undefined>,\n user: User,\n displayAttributes?: string[],\n): string => {\n if (displayAttributes && displayAttributes.length > 0) {\n let foundValue: string | undefined;\n displayAttributes.some((attr: string) => {\n const value: any = getMappedUserProfileValue(attr, mergedMappings, user);\n\n if (value !== undefined && value !== null && value !== '') {\n foundValue = String(value);\n return true;\n }\n return false;\n });\n if (foundValue !== undefined) {\n return foundValue;\n }\n }\n\n const firstName: any = getMappedUserProfileValue('firstName', mergedMappings, user);\n const lastName: any = getMappedUserProfileValue('lastName', mergedMappings, user);\n\n if (firstName && lastName) {\n return `${firstName} ${lastName}`;\n }\n\n return (\n getMappedUserProfileValue('username', mergedMappings, user) ||\n getMappedUserProfileValue('email', mergedMappings, user) ||\n getMappedUserProfileValue('name', mergedMappings, user) ||\n 'User'\n );\n};\n\nexport default getDisplayName;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nexport type AvatarVariant = 'circular' | 'square';\n\n/**\n * Creates styles for the Avatar component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param size - The size of the avatar in pixels\n * @param variant - The avatar variant\n * @param backgroundColor - The background color for the avatar\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n size: number,\n variant: AvatarVariant,\n backgroundColor?: string,\n): Record<string, string> =>\n useMemo(() => {\n const baseAvatar: string = css`\n align-items: center;\n background: ${backgroundColor || theme.vars.colors.background.surface};\n border: ${backgroundColor ? 'none' : `1px solid ${theme.vars.colors.border}`};\n border-radius: ${variant === 'circular' ? '50%' : '8px'};\n color: ${backgroundColor ? '#ffffff' : theme.vars.colors.text.primary};\n display: flex;\n font-size: ${size * 0.4}px;\n font-family: ${theme.vars.typography.fontFamily};\n font-weight: 600;\n height: ${size}px;\n justify-content: center;\n overflow: hidden;\n text-shadow: ${backgroundColor ? '0 1px 2px rgba(0, 0, 0, 0.1)' : 'none'};\n width: ${size}px;\n `;\n\n const variantStyles: Record<string, string> = {\n circular: css`\n border-radius: 50%;\n `,\n square: css`\n border-radius: 8px;\n `,\n };\n\n const imageStyles: string = css`\n height: 100%;\n object-fit: cover;\n width: 100%;\n `;\n\n const skeletonStyles: string = css`\n width: 100%;\n height: 100%;\n background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);\n background-size: 200% 100%;\n animation: skeleton-loading 1.5s infinite;\n border-radius: ${variant === 'circular' ? '50%' : '8px'};\n\n @keyframes skeleton-loading {\n 0% {\n background-position: -200% 0;\n }\n 100% {\n background-position: 200% 0;\n }\n }\n `;\n\n const iconStyles: string = css`\n width: 60%;\n height: 60%;\n fill: ${backgroundColor ? '#ffffff' : theme.vars.colors.text.secondary};\n opacity: 0.8;\n `;\n\n return {\n avatar: baseAvatar,\n icon: iconStyles,\n image: imageStyles,\n skeleton: skeletonStyles,\n variant: variantStyles[variant],\n };\n }, [theme, colorScheme, size, variant, backgroundColor]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC, JSX, useMemo} from 'react';\nimport useStyles from './Avatar.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\n\nexport interface AvatarProps {\n /**\n * Alternative text for the avatar image\n */\n alt?: string;\n /**\n * Background generation strategy\n * - 'random': Generate background color based on ASCII values of the name\n * - 'none': Use default theme background\n * - string: Use custom background color\n * @default 'random'\n */\n background?: 'random' | 'none' | string;\n /**\n * Optional className for the avatar\n */\n className?: string;\n /**\n * The URL of the avatar image\n */\n imageUrl?: string;\n /**\n * Loading state of the avatar\n */\n isLoading?: boolean;\n /**\n * The name to use for generating initials when no image is provided\n */\n name?: string;\n /**\n * The size of the avatar in pixels\n */\n size?: number;\n /**\n * The variant of the avatar shape\n * @default 'circular'\n */\n variant?: 'circular' | 'square';\n}\n\nexport const Avatar: FC<AvatarProps> = ({\n alt = 'User avatar',\n background = 'random',\n className = '',\n imageUrl,\n name,\n size = 64,\n variant = 'circular',\n isLoading = false,\n}: AvatarProps): JSX.Element => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n\n const generateBackgroundColor = (inputString: string): string => {\n const hash: number = inputString.split('').reduce((acc: number, char: string) => {\n const charCode: number = char.charCodeAt(0);\n\n return ((acc << 5) - acc + charCode) & 0xffffffff;\n }, 0);\n\n const seed: number = Math.abs(hash);\n\n const generateColor = (offset: number): string => {\n const hue1: number = (seed + offset) % 360;\n const hue2: number = (hue1 + 60 + (seed % 120)) % 360;\n\n const saturation: number = 70 + (seed % 20);\n const lightness1: number = 55 + (seed % 15);\n const lightness2: number = 60 + ((seed + offset) % 15);\n\n return `hsl(${hue1}, ${saturation}%, ${lightness1}%), hsl(${hue2}, ${saturation}%, ${lightness2}%)`;\n };\n\n const angle: number = 45 + (seed % 91);\n\n const colors: string = generateColor(seed);\n return `linear-gradient(${angle}deg, ${colors})`;\n };\n\n const backgroundColor: string | undefined = useMemo(() => {\n if (!name || imageUrl) {\n return undefined;\n }\n\n if (background === 'random') {\n return generateBackgroundColor(name);\n }\n\n if (background === 'none') {\n return undefined;\n }\n\n return background;\n }, [background, name, imageUrl]);\n\n const styles: ReturnType<typeof useStyles> = useStyles(theme, colorScheme, size, variant, backgroundColor);\n\n // Determine if we're in the default state (no image, no name, not loading)\n const isDefaultState: boolean = !imageUrl && !name && !isLoading;\n\n const getInitials = (fullName: string): string =>\n fullName\n .split(' ')\n .map((part: string) => part[0])\n .slice(0, 2)\n .join('')\n .toUpperCase();\n\n const renderContent = (): JSX.Element | string => {\n if (imageUrl) {\n return (\n <img\n src={imageUrl}\n alt={alt}\n className={cx(withVendorCSSClassPrefix(bem('avatar', 'image')), styles['image'])}\n />\n );\n }\n\n if (name) {\n return getInitials(name);\n }\n\n if (isLoading) {\n return <div className={cx(withVendorCSSClassPrefix(bem('avatar', 'skeleton')), styles['skeleton'])} />;\n }\n\n // Default user icon\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 640 640\"\n className={cx(withVendorCSSClassPrefix(bem('avatar', 'icon')), styles['icon'])}\n >\n <path d=\"M240 192C240 147.8 275.8 112 320 112C364.2 112 400 147.8 400 192C400 236.2 364.2 272 320 272C275.8 272 240 236.2 240 192zM448 192C448 121.3 390.7 64 320 64C249.3 64 192 121.3 192 192C192 262.7 249.3 320 320 320C390.7 320 448 262.7 448 192zM144 544C144 473.3 201.3 416 272 416L368 416C438.7 416 496 473.3 496 544L496 552C496 565.3 506.7 576 520 576C533.3 576 544 565.3 544 552L544 544C544 446.8 465.2 368 368 368L272 368C174.8 368 96 446.8 96 544L96 552C96 565.3 106.7 576 120 576C133.3 576 144 565.3 144 552L144 544z\" />\n </svg>\n );\n };\n\n return (\n <div\n className={cx(\n withVendorCSSClassPrefix(bem('avatar')),\n styles['avatar'],\n styles['variant'],\n withVendorCSSClassPrefix(bem('avatar', null, variant)),\n isDefaultState && withVendorCSSClassPrefix(bem('avatar', 'default')),\n className,\n )}\n >\n {renderContent()}\n </div>\n );\n};\n\nexport default Avatar;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the Dialog component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(() => {\n const overlay: string = css`\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 9999;\n `;\n\n const content: string = css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n box-shadow: 0 2px 8px ${colorScheme === 'dark' ? 'rgba(0, 0, 0, 0.3)' : 'rgba(0, 0, 0, 0.15)'};\n font-family: ${theme.vars.typography.fontFamily};\n outline: none;\n overflow-y: auto;\n z-index: 10000;\n `;\n\n const dropdownContent: string = css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n box-shadow: 0 2px 8px ${colorScheme === 'dark' ? 'rgba(0, 0, 0, 0.3)' : 'rgba(0, 0, 0, 0.15)'};\n outline: none;\n max-width: 90vw;\n max-height: 90vh;\n overflow-y: auto;\n z-index: 10000;\n `;\n\n const header: string = css`\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: calc(${theme.vars.spacing.unit} * 3) calc(${theme.vars.spacing.unit} * 4.5);\n border-bottom: 1px solid ${theme.vars.colors.border};\n `;\n\n const headerTitle: string = css`\n margin: 0;\n font-size: 1.2rem;\n font-weight: 600;\n color: ${theme.vars.colors.text.primary};\n `;\n\n const contentBody: string = css`\n padding: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const description: string = css`\n margin: 0;\n color: ${theme.vars.colors.text.secondary};\n font-size: ${theme.vars.typography.fontSizes.sm};\n line-height: 1.5;\n `;\n\n return {\n content,\n contentBody,\n description,\n dropdownContent,\n header,\n headerTitle,\n overlay,\n };\n }, [theme, colorScheme]);\n\nexport default useStyles;\n","/**\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 {FC, SVGProps} from 'react';\n\n/**\n * LogOut icon component.\n */\nconst LogOut: FC<SVGProps<SVGSVGElement>> = (props: SVGProps<SVGSVGElement>) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"m16 17 5-5-5-5\" />\n <path d=\"M21 12H9\" />\n <path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\" />\n </svg>\n);\n\nexport default LogOut;\n","/**\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 {FC, SVGProps} from 'react';\n\n/**\n * Plus (add) icon component.\n */\nconst Plus: FC<SVGProps<SVGSVGElement>> = (props: SVGProps<SVGSVGElement>) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" />\n </svg>\n);\n\nexport default Plus;\n","/**\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 {FC, SVGProps} from 'react';\n\n/**\n * User icon component.\n */\nconst User: FC<SVGProps<SVGSVGElement>> = (props: SVGProps<SVGSVGElement>) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\" />\n <circle cx=\"12\" cy=\"7\" r=\"4\" />\n </svg>\n);\n\nexport default User;\n","/**\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 {FC, SVGProps} from 'react';\n\n/**\n * X (close) icon component.\n */\nconst X: FC<SVGProps<SVGSVGElement>> = (props: SVGProps<SVGSVGElement>) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n);\n\nexport default X;\n","/**\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 {cx} from '@emotion/css';\nimport {\n useFloating,\n useClick,\n useDismiss,\n useRole,\n useInteractions,\n useMergeRefs,\n FloatingFocusManager,\n FloatingOverlay,\n FloatingPortal,\n useId,\n UseFloatingReturn,\n UseInteractionsReturn,\n} from '@floating-ui/react';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {\n type ButtonHTMLAttributes,\n type Context,\n type Dispatch,\n type FC,\n type ForwardRefExoticComponent,\n type HTMLProps,\n type JSX,\n type MouseEvent,\n type ReactNode,\n type Ref,\n type RefAttributes,\n type SetStateAction,\n cloneElement,\n createContext,\n forwardRef,\n isValidElement,\n useContext,\n useLayoutEffect,\n useMemo,\n useState,\n} from 'react';\nimport useStyles from './Dialog.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport Button from '../Button/Button';\nimport {X} from '../Icons';\n\ninterface DialogOptions {\n initialOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n open?: boolean;\n}\n\ninterface DialogHookReturn extends UseFloatingReturn, UseInteractionsReturn {\n descriptionId: string | undefined;\n labelId: string | undefined;\n open: boolean;\n setDescriptionId: Dispatch<SetStateAction<string | undefined>>;\n setLabelId: Dispatch<SetStateAction<string | undefined>>;\n setOpen: (open: boolean) => void;\n}\n\nexport function useDialog({\n initialOpen = false,\n open: controlledOpen,\n onOpenChange: setControlledOpen,\n}: DialogOptions = {}): DialogHookReturn {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(initialOpen);\n const [labelId, setLabelId] = useState<string | undefined>();\n const [descriptionId, setDescriptionId] = useState<string | undefined>();\n\n const open: boolean = controlledOpen ?? uncontrolledOpen;\n const setOpen: (openVal: boolean) => void = setControlledOpen ?? setUncontrolledOpen;\n\n const data: UseFloatingReturn = useFloating({\n onOpenChange: setOpen,\n open,\n });\n\n const {context} = data;\n\n const click: ReturnType<typeof useClick> = useClick(context, {\n enabled: controlledOpen == null,\n });\n const dismiss: ReturnType<typeof useDismiss> = useDismiss(context, {outsidePressEvent: 'mousedown'});\n const role: ReturnType<typeof useRole> = useRole(context);\n\n const interactions: UseInteractionsReturn = useInteractions([click, dismiss, role]);\n\n return useMemo(\n () => ({\n open,\n setOpen,\n ...interactions,\n ...data,\n descriptionId,\n labelId,\n setDescriptionId,\n setLabelId,\n }),\n [open, setOpen, interactions, data, labelId, descriptionId],\n );\n}\n\ntype DialogContextType =\n | (DialogHookReturn & {\n setDescriptionId: Dispatch<SetStateAction<string | undefined>>;\n setLabelId: Dispatch<SetStateAction<string | undefined>>;\n })\n | null;\n\nconst DialogContext: Context<DialogContextType> = createContext<DialogContextType>(null);\n\nexport const useDialogContext = (): DialogHookReturn => {\n const context: DialogContextType = useContext(DialogContext);\n if (context == null) {\n throw new Error('Dialog components must be wrapped in <Dialog />');\n }\n return context;\n};\n\n// Dialog Components (Modal)\nexport function Dialog({children, ...options}: {children: ReactNode} & DialogOptions): JSX.Element {\n const dialog: DialogHookReturn = useDialog(options);\n return <DialogContext.Provider value={dialog}>{children}</DialogContext.Provider>;\n}\n\ninterface DialogTriggerProps {\n asChild?: boolean;\n children: ReactNode;\n}\n\nexport const DialogTrigger: ForwardRefExoticComponent<\n HTMLProps<HTMLElement> & DialogTriggerProps & RefAttributes<HTMLElement>\n> = forwardRef<HTMLElement, HTMLProps<HTMLElement> & DialogTriggerProps>(\n ({children, asChild = false, ...props}: HTMLProps<HTMLElement> & DialogTriggerProps, propRef: Ref<HTMLElement>) => {\n const context: DialogHookReturn = useDialogContext();\n const childrenRef: Ref<HTMLElement> = (children as any).ref;\n const ref: ReturnType<typeof useMergeRefs> = useMergeRefs([context.refs.setReference, propRef, childrenRef]);\n\n if (asChild && isValidElement(children)) {\n return cloneElement(\n children,\n context.getReferenceProps({\n ref,\n ...props,\n ...(children.props as any),\n 'data-state': context.open ? 'open' : 'closed',\n }),\n );\n }\n\n return (\n <button ref={ref} data-state={context.open ? 'open' : 'closed'} {...context.getReferenceProps(props)}>\n {children}\n </button>\n );\n },\n);\n\nexport const DialogContent: ForwardRefExoticComponent<HTMLProps<HTMLDivElement> & RefAttributes<HTMLDivElement>> =\n forwardRef<HTMLDivElement, HTMLProps<HTMLDivElement>>(\n (props: HTMLProps<HTMLDivElement>, propRef: Ref<HTMLDivElement>) => {\n const {context: floatingContext, ...context} = useDialogContext();\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const ref: ReturnType<typeof useMergeRefs> = useMergeRefs([context.refs.setFloating, propRef]);\n\n if (!floatingContext.open) return null;\n\n return (\n <FloatingPortal>\n <FloatingOverlay\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'overlay')), styles['overlay'])}\n lockScroll\n >\n <FloatingFocusManager context={floatingContext} initialFocus={-1}>\n <div\n ref={ref}\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'content')), styles['content'], props.className)}\n aria-labelledby={context.labelId}\n aria-describedby={context.descriptionId}\n {...context.getFloatingProps(props)}\n >\n {props.children}\n </div>\n </FloatingFocusManager>\n </FloatingOverlay>\n </FloatingPortal>\n );\n },\n );\n\nexport const DialogHeading: ForwardRefExoticComponent<\n HTMLProps<HTMLHeadingElement> & RefAttributes<HTMLHeadingElement>\n> = forwardRef<HTMLHeadingElement, HTMLProps<HTMLHeadingElement>>(\n ({children, ...props}: HTMLProps<HTMLHeadingElement>, ref: Ref<HTMLHeadingElement>) => {\n const context: DialogHookReturn = useDialogContext();\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const id: string = useId();\n\n useLayoutEffect((): (() => void) => {\n context.setLabelId(id);\n return (): void => {\n context.setLabelId(undefined);\n };\n }, [id, context.setLabelId]);\n\n return (\n <div className={cx(withVendorCSSClassPrefix(bem('dialog', 'header')), styles['header'])}>\n <h2\n {...props}\n ref={ref}\n id={id}\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'title')), styles['headerTitle'])}\n >\n {children}\n </h2>\n <Button\n color=\"tertiary\"\n variant=\"icon\"\n size=\"small\"\n shape=\"round\"\n onClick={(): void => {\n context.setOpen(false);\n }}\n aria-label=\"Close\"\n >\n <X width={16} height={16} />\n </Button>\n </div>\n );\n },\n);\n\nexport const DialogDescription: ForwardRefExoticComponent<\n HTMLProps<HTMLParagraphElement> & RefAttributes<HTMLParagraphElement>\n> = forwardRef<HTMLParagraphElement, HTMLProps<HTMLParagraphElement>>(\n ({children, ...props}: HTMLProps<HTMLParagraphElement>, ref: Ref<HTMLParagraphElement>) => {\n const context: DialogHookReturn = useDialogContext();\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const id: string = useId();\n\n useLayoutEffect((): (() => void) => {\n context.setDescriptionId(id);\n return (): void => {\n context.setDescriptionId(undefined);\n };\n }, [id, context.setDescriptionId]);\n\n return (\n <p\n {...props}\n ref={ref}\n id={id}\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'description')), styles['description'], props.className)}\n >\n {children}\n </p>\n );\n },\n);\n\ninterface DialogCloseProps {\n asChild?: boolean;\n children?: ReactNode;\n}\n\nexport const DialogClose: ForwardRefExoticComponent<\n ButtonHTMLAttributes<HTMLButtonElement> & DialogCloseProps & RefAttributes<HTMLButtonElement>\n> = forwardRef<HTMLButtonElement, ButtonHTMLAttributes<HTMLButtonElement> & DialogCloseProps>(\n (\n {children, asChild = false, ...props}: ButtonHTMLAttributes<HTMLButtonElement> & DialogCloseProps,\n propRef: Ref<HTMLButtonElement>,\n ) => {\n const context: DialogHookReturn = useDialogContext();\n const childrenRef: Ref<HTMLButtonElement> = (children as any)?.ref;\n const ref: ReturnType<typeof useMergeRefs> = useMergeRefs([propRef, childrenRef]);\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>): void => {\n context.setOpen(false);\n props.onClick?.(event);\n };\n\n if (asChild && isValidElement(children)) {\n return cloneElement(children, {\n ref,\n ...props,\n ...(children.props as any),\n onClick: handleClick,\n });\n }\n\n return (\n <Button\n {...props}\n ref={ref}\n onClick={handleClick}\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'close')), props.className)}\n variant=\"text\"\n >\n {children}\n </Button>\n );\n },\n);\n\nDialogTrigger.displayName = 'DialogTrigger';\nDialogContent.displayName = 'DialogContent';\nDialogHeading.displayName = 'DialogHeading';\nDialogDescription.displayName = 'DialogDescription';\nDialogClose.displayName = 'DialogClose';\n\n// Attach subcomponents to Dialog\n(Dialog as any).Trigger = DialogTrigger;\n(Dialog as any).Content = DialogContent;\n(Dialog as any).Heading = DialogHeading;\n(Dialog as any).Description = DialogDescription;\n(Dialog as any).Close = DialogClose;\n\nexport interface DialogComponent extends FC<{children: ReactNode} & DialogOptions> {\n Close: typeof DialogClose;\n Content: typeof DialogContent;\n Description: typeof DialogDescription;\n Heading: typeof DialogHeading;\n Trigger: typeof DialogTrigger;\n}\n\nexport default Dialog as DialogComponent;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nexport type MultiInputType = 'text' | 'email' | 'tel' | 'url' | 'password' | 'date' | 'boolean';\nexport type MultiInputFieldType = 'STRING' | 'DATE_TIME' | 'BOOLEAN';\n\n/**\n * Creates styles for the MultiInput component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param disabled - Whether the component is disabled\n * @param hasError - Whether the component has an error\n * @param canAddMore - Whether more items can be added\n * @param canRemove - Whether items can be removed\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n disabled: boolean,\n hasError: boolean,\n canAddMore: boolean,\n canRemove: boolean,\n): Record<string, string> =>\n useMemo(() => {\n const container: string = css`\n display: flex;\n flex-direction: column;\n gap: ${theme.vars.spacing.unit};\n `;\n\n const inputRow: string = css`\n display: flex;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n position: relative;\n `;\n\n const inputWrapper: string = css`\n flex: 1;\n `;\n\n const plusIcon: string = css`\n background: ${theme.vars.colors.secondary.main};\n border-radius: 50%;\n outline: 4px ${theme.vars.colors.secondary.main} auto;\n color: ${theme.vars.colors.secondary.contrastText};\n `;\n\n const listContainer: string = css`\n display: flex;\n flex-direction: column;\n gap: 0;\n `;\n\n const listItem: string = css`\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: ${theme.vars.spacing.unit} calc(${theme.vars.spacing.unit} * 1.5);\n background-color: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.medium};\n font-size: 1rem;\n font-family: ${theme.vars.typography.fontFamily};\n color: ${theme.vars.colors.text.primary};\n margin-bottom: calc(${theme.vars.spacing.unit} / 2);\n\n &:last-child {\n margin-bottom: 0;\n }\n `;\n\n const listItemText: string = css`\n flex: 1;\n word-break: break-word;\n `;\n\n const removeButton: string = css`\n padding: calc(${theme.vars.spacing.unit} / 2);\n min-width: auto;\n color: ${theme.vars.colors.error.main};\n background: transparent;\n border: none;\n border-radius: ${theme.vars.borderRadius.small};\n cursor: ${disabled ? 'not-allowed' : 'pointer'};\n display: flex;\n align-items: center;\n justify-content: center;\n\n &:hover:not(:disabled) {\n background-color: ${theme.vars.colors.action.hover};\n }\n\n &:disabled {\n opacity: 0.6;\n }\n `;\n\n const icon: string = css`\n width: 16px;\n height: 16px;\n stroke: currentColor;\n stroke-width: 2;\n stroke-linecap: round;\n stroke-linejoin: round;\n fill: none;\n `;\n\n return {\n container,\n icon,\n inputRow,\n inputWrapper,\n listContainer,\n listItem,\n listItemText,\n plusIcon,\n removeButton,\n };\n }, [theme, colorScheme, disabled, hasError, canAddMore, canRemove]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {CSSProperties, FC, KeyboardEvent, ReactElement, ReactNode, useCallback, useState} from 'react';\nimport useStyles from './MultiInput.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport Checkbox from '../Checkbox/Checkbox';\nimport DatePicker from '../DatePicker/DatePicker';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\nimport TextField from '../TextField/TextField';\n\nexport type MultiInputType = 'text' | 'email' | 'tel' | 'url' | 'password' | 'date' | 'boolean';\nexport type MultiInputFieldType = 'STRING' | 'DATE_TIME' | 'BOOLEAN';\n\nexport interface MultiInputProps {\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Whether the field is disabled\n */\n disabled?: boolean;\n /**\n * Icon to display at the end (right) of each input (in addition to add/remove buttons)\n */\n endIcon?: ReactNode;\n /**\n * Error message to display below the inputs\n */\n error?: string;\n /**\n * Field type for different input components\n */\n fieldType?: MultiInputFieldType;\n /**\n * Helper text to display below the inputs\n */\n helperText?: string;\n /**\n * Label text to display above the inputs\n */\n label?: string;\n /**\n * Maximum number of fields to allow (default: unlimited)\n */\n maxFields?: number;\n /**\n * Minimum number of fields to show (default: 1)\n */\n minFields?: number;\n /**\n * Callback when values change\n */\n onChange: (values: string[]) => void;\n /**\n * Placeholder text for input fields\n */\n placeholder?: string;\n /**\n * Whether the field is required\n */\n required?: boolean;\n /**\n * Icon to display at the start (left) of each input\n */\n startIcon?: ReactNode;\n /**\n * Custom style object\n */\n style?: CSSProperties;\n /**\n * Input type\n */\n type?: MultiInputType;\n /**\n * Array of values\n */\n values: string[];\n}\n\ninterface IconProps {\n iconClassName?: string;\n}\n\nconst MultiInput: FC<MultiInputProps> = ({\n label,\n error,\n required,\n className,\n disabled,\n helperText,\n placeholder = 'Enter value',\n values = [],\n onChange,\n type = 'text',\n fieldType = 'STRING',\n startIcon,\n endIcon,\n minFields = 1,\n maxFields,\n style = {},\n}: MultiInputProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const canAddMore: boolean = !maxFields || values.length < maxFields;\n const canRemove: boolean = values.length > minFields;\n const styles: Record<string, string> = useStyles(theme, colorScheme, !!disabled, !!error, canAddMore, canRemove);\n\n const PlusIcon: FC<IconProps> = ({iconClassName}: IconProps): ReactElement => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" className={cx(styles['icon'], iconClassName)}>\n <path d=\"M12 5v14M5 12h14\" />\n </svg>\n );\n\n const BinIcon: FC<IconProps> = ({iconClassName}: IconProps): ReactElement => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" className={cx(styles['icon'], iconClassName)}>\n <path d=\"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14ZM10 11v6M14 11v6\" />\n </svg>\n );\n\n const handleAddValue: ReturnType<typeof useCallback> = useCallback(\n (newValue: string) => {\n if (newValue.trim() !== '' && (!maxFields || values.length < maxFields)) {\n onChange([...values, newValue.trim()]);\n }\n },\n [values, onChange, maxFields],\n );\n\n const handleRemoveValue: ReturnType<typeof useCallback> = useCallback(\n (index: number) => {\n if (values.length > minFields) {\n const updatedValues: string[] = values.filter((_: string, i: number) => i !== index);\n onChange(updatedValues);\n }\n },\n [values, onChange, minFields],\n );\n\n const renderInputField: ReturnType<typeof useCallback> = useCallback(\n (\n value: string,\n onValueChange: (value: string) => void,\n attachedEndIcon?: ReactNode,\n onEndIconClick?: () => void,\n ): ReactElement => {\n const handleInputChange = (e: any): void => {\n const newValue: string = e.target ? e.target.value : e;\n onValueChange(newValue);\n };\n\n const handleKeyDown = (e: KeyboardEvent): void => {\n if (e.key === 'Enter' && onEndIconClick) {\n e.preventDefault();\n onEndIconClick();\n }\n };\n\n const finalEndIcon: ReactNode = attachedEndIcon || endIcon;\n\n const commonProps: Record<string, unknown> = {\n disabled,\n endIcon: finalEndIcon,\n error,\n onChange: handleInputChange,\n onEndIconClick,\n onKeyDown: handleKeyDown,\n placeholder,\n startIcon,\n value,\n };\n\n switch (fieldType) {\n case 'DATE_TIME':\n return <DatePicker {...commonProps} />;\n case 'BOOLEAN':\n return (\n <Checkbox\n {...commonProps}\n checked={value === 'true' || Boolean(value)}\n onChange={(e: any): void => onValueChange(e.target.checked ? 'true' : 'false')}\n />\n );\n default:\n return <TextField {...commonProps} type={type} />;\n }\n },\n [placeholder, disabled, startIcon, endIcon, error, fieldType, type],\n );\n\n // State for the current input value\n const [currentInputValue, setCurrentInputValue] = useState('');\n\n const handleInputSubmit: ReturnType<typeof useCallback> = useCallback((): void => {\n if (currentInputValue.trim() !== '') {\n handleAddValue(currentInputValue);\n setCurrentInputValue('');\n }\n }, [currentInputValue, handleAddValue]);\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n className={cx(withVendorCSSClassPrefix(bem('multi-input')), className)}\n style={style}\n >\n {label && (\n <InputLabel required={required} error={!!error}>\n {label}\n </InputLabel>\n )}\n <div className={cx(withVendorCSSClassPrefix(bem('multi-input', 'container')), styles['container'])}>\n {/* Input field at the top */}\n <div className={cx(withVendorCSSClassPrefix(bem('multi-input', 'input-row')), styles['inputRow'])}>\n <div className={cx(withVendorCSSClassPrefix(bem('multi-input', 'input-wrapper')), styles['inputWrapper'])}>\n {renderInputField(\n currentInputValue,\n setCurrentInputValue,\n canAddMore ? <PlusIcon iconClassName={styles['plusIcon']} /> : undefined,\n canAddMore ? handleInputSubmit : undefined,\n )}\n </div>\n </div>\n\n {/* List of added items */}\n {values.length > 0 && (\n <div className={cx(withVendorCSSClassPrefix(bem('multi-input', 'list-container')), styles['listContainer'])}>\n {values.map((value: string, index: number) => (\n <div\n key={index}\n className={cx(withVendorCSSClassPrefix(bem('multi-input', 'list-item')), styles['listItem'])}\n >\n <span\n className={cx(withVendorCSSClassPrefix(bem('multi-input', 'list-item-text')), styles['listItemText'])}\n >\n {value}\n </span>\n {canRemove && (\n <button\n type=\"button\"\n onClick={(): void => handleRemoveValue(index)}\n disabled={disabled}\n className={cx(\n withVendorCSSClassPrefix(bem('multi-input', 'remove-button')),\n styles['removeButton'],\n )}\n title=\"Remove value\"\n >\n <BinIcon iconClassName={styles['icon']} />\n </button>\n )}\n </div>\n ))}\n </div>\n )}\n </div>\n </FormControl>\n );\n};\n\nexport default MultiInput;\n","/**\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 {cx} from '@emotion/css';\nimport {User, withVendorCSSClassPrefix, WellKnownSchemaIds, bem, Preferences} from '@thunderid/browser';\nimport {FC, ReactElement, useState, useCallback} from 'react';\nimport useStyles from './BaseUserProfile.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport useTranslation from '../../../hooks/useTranslation';\nimport getDisplayName from '../../../utils/getDisplayName';\nimport getMappedUserProfileValue from '../../../utils/getMappedUserProfileValue';\nimport AlertPrimitive from '../../primitives/Alert/Alert';\nimport {Avatar} from '../../primitives/Avatar/Avatar';\nimport Button from '../../primitives/Button/Button';\nimport CardPrimitive from '../../primitives/Card/Card';\nimport Checkbox from '../../primitives/Checkbox/Checkbox';\nimport DatePicker from '../../primitives/DatePicker/DatePicker';\nimport DialogPrimitive from '../../primitives/Dialog/Dialog';\nimport Divider from '../../primitives/Divider/Divider';\nimport MultiInput from '../../primitives/MultiInput/MultiInput';\nimport TextField from '../../primitives/TextField/TextField';\nimport Typography from '../../primitives/Typography/Typography';\n\ninterface ExtendedFlatSchema {\n path?: string;\n schemaId?: string;\n}\n\ninterface Schema extends ExtendedFlatSchema {\n caseExact?: boolean;\n description?: string;\n displayName?: string;\n displayOrder?: string;\n multiValued?: boolean;\n mutability?: string;\n name?: string;\n required?: boolean;\n returned?: string;\n subAttributes?: Schema[];\n type?: string;\n uniqueness?: string;\n value?: any;\n}\n\nexport interface BaseUserProfileProps {\n attributeMapping?: {\n [key: string]: string | string[] | undefined;\n firstName?: string | string[];\n lastName?: string | string[];\n picture?: string | string[];\n username?: string | string[];\n };\n cardLayout?: boolean;\n className?: string;\n displayNameAttributes?: string[];\n editable?: boolean;\n error?: string | null;\n fallback?: ReactElement;\n flattenedProfile?: User;\n hideFields?: string[];\n isLoading?: boolean;\n mode?: 'inline' | 'popup';\n onOpenChange?: (open: boolean) => void;\n onUpdate?: (payload: any) => Promise<void>;\n open?: boolean;\n /**\n * Component-level preferences to override global i18n and theme settings.\n * Preferences are deep-merged with global ones, with component preferences\n * taking precedence. Affects this component and all its descendants.\n */\n preferences?: Preferences;\n profile?: User;\n schemas?: Schema[];\n showFields?: string[];\n\n title?: string;\n}\n\n// Fields to skip based on schema.name\nconst fieldsToSkip: string[] = [\n 'roles.default',\n 'active',\n 'groups',\n 'accountLocked',\n 'accountDisabled',\n 'oneTimePassword',\n 'userSourceId',\n 'idpType',\n 'localCredentialExists',\n 'active',\n 'ResourceType',\n 'ExternalID',\n 'MetaData',\n 'verifiedMobileNumbers',\n 'verifiedEmailAddresses',\n 'phoneNumbers.mobile',\n 'emailAddresses',\n 'preferredMFAOption',\n];\n\n// Fields that should be readonly\nconst readonlyFields: string[] = ['username', 'userName', 'user_name'];\n\nconst BaseUserProfile: FC<BaseUserProfileProps> = ({\n fallback = null,\n className = '',\n cardLayout = true,\n profile,\n schemas = [],\n flattenedProfile,\n mode = 'inline',\n title,\n attributeMapping = {},\n editable = true,\n onOpenChange,\n onUpdate,\n open = false,\n error = null,\n isLoading = false,\n preferences,\n showFields = [],\n hideFields = [],\n displayNameAttributes = [],\n}: BaseUserProfileProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const [editedUser, setEditedUser] = useState(flattenedProfile || profile);\n const [editingFields, setEditingFields] = useState<Record<string, boolean>>({});\n const {t} = useTranslation(preferences?.i18n);\n\n /**\n * Determines if a field should be visible based on showFields, hideFields, and fieldsToSkip arrays.\n * Priority order:\n * 1. fieldsToSkip (always hidden) - highest priority\n * 2. hideFields (explicitly hidden)\n * 3. showFields (explicitly shown, if array is not empty)\n * 4. Default behavior (show all fields not in fieldsToSkip)\n */\n const shouldShowField: any = useCallback(\n (fieldName: string): boolean => {\n // Always skip fields in the hardcoded fieldsToSkip array\n if (fieldsToSkip.includes(fieldName)) {\n return false;\n }\n\n // If hideFields is provided and contains this field, hide it\n if (hideFields.length > 0 && hideFields.includes(fieldName)) {\n return false;\n }\n\n // If showFields is provided and not empty, only show fields in that array\n if (showFields.length > 0) {\n return showFields.includes(fieldName);\n }\n\n return true;\n },\n [showFields, hideFields],\n );\n\n const PencilIcon = (): any => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z\" />\n </svg>\n );\n\n const toggleFieldEdit: any = useCallback((fieldName: string) => {\n setEditingFields((prev: any) => ({\n ...prev,\n [fieldName]: !prev[fieldName],\n }));\n }, []);\n\n const getFieldPlaceholder: any = useCallback((schema: Schema): string => {\n const {type, displayName, description, name} = schema;\n\n const fieldLabel: any = displayName || description || name || 'value';\n\n switch (type) {\n case 'DATE_TIME':\n return `Enter your ${fieldLabel.toLowerCase()}`;\n case 'BOOLEAN':\n return `Select ${fieldLabel.toLowerCase()}`;\n case 'COMPLEX':\n return `Enter ${fieldLabel.toLowerCase()} details`;\n default:\n return `Enter your ${fieldLabel.toLowerCase()}`;\n }\n }, []);\n\n const formatLabel: any = useCallback(\n (key: string): string =>\n key\n .split(/(?=[A-Z])|_/)\n .map((word: any) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(' '),\n [],\n );\n\n const styles: any = useStyles(theme, colorScheme);\n\n const ObjectDisplay: FC<{data: unknown}> = ({data}: {data: unknown}): ReactElement => {\n if (!data || typeof data !== 'object') return null;\n\n return (\n <table className={styles.value}>\n <tbody>\n {Object.entries(data).map(([key, value]: any) => (\n <tr key={key}>\n <td className={styles.objectKey}>\n <strong>{formatLabel(key)}:</strong>\n </td>\n <td className={styles.objectValue}>\n {typeof value === 'object' ? <ObjectDisplay data={value} /> : String(value)}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n };\n\n function set(obj: Record<string, any>, path: string, value: any): void {\n const keys: any = path.split('.');\n let current: any = obj;\n\n for (let i: any = 0; i < keys.length; i += 1) {\n const key: any = keys[i];\n\n if (i === keys.length - 1) {\n current[key] = value;\n } else {\n if (!current[key] || typeof current[key] !== 'object') {\n current[key] = {};\n }\n current = current[key];\n }\n }\n }\n\n const handleFieldSave: any = useCallback(\n (schema: Schema): void => {\n if (!onUpdate || !schema.name) return;\n\n const fieldName: string = schema.name;\n let fieldValue: any;\n if (editedUser && fieldName && editedUser[fieldName] !== undefined) {\n fieldValue = editedUser[fieldName];\n } else if (flattenedProfile?.[fieldName] !== undefined) {\n fieldValue = flattenedProfile[fieldName];\n } else {\n fieldValue = '';\n }\n\n if (Array.isArray(fieldValue)) {\n fieldValue = fieldValue.filter((v: any) => v !== undefined && v !== null && v !== '');\n }\n\n let payload: Record<string, any> = {};\n\n // SCIM Patch Operation Logic:\n // - Fields from core schema (urn:ietf:params:scim:schemas:core:2.0:User)\n // should be sent directly: {\"name\":{\"givenName\":\"John\"}}\n // - Fields from extension schemas (like urn:scim:wso2:schema)\n // should be nested under the schema namespace: {\"urn:scim:wso2:schema\":{\"country\":\"Sri Lanka\"}}\n if (schema.schemaId && schema.schemaId !== WellKnownSchemaIds.User) {\n // For non-core schemas, nest the field under the schema namespace\n payload = {\n [schema.schemaId]: {\n [fieldName]: fieldValue,\n },\n };\n } else {\n // For core schema or fields without schemaId, use the field path directly\n // This handles complex paths like \"name.givenName\" correctly\n set(payload, fieldName, fieldValue);\n }\n\n onUpdate(payload);\n\n toggleFieldEdit(fieldName);\n },\n [editedUser, flattenedProfile, onUpdate, toggleFieldEdit],\n );\n\n const handleFieldCancel: any = useCallback(\n (fieldName: string) => {\n const currentUser: any = flattenedProfile || profile;\n setEditedUser((prev: any) => ({\n ...prev,\n [fieldName]: currentUser[fieldName],\n }));\n toggleFieldEdit(fieldName);\n },\n [flattenedProfile, profile, toggleFieldEdit],\n );\n\n const defaultAttributeMappings: Record<string, string | string[] | undefined> = {\n email: ['emails', 'email'],\n firstName: ['name.givenName', 'given_name'],\n lastName: ['name.familyName', 'family_name'],\n picture: ['profile', 'profileUrl', 'picture', 'URL'],\n username: ['userName', 'username', 'user_name'],\n };\n\n const mergedMappings: Record<string, string | string[] | undefined> = {\n ...defaultAttributeMappings,\n ...attributeMapping,\n };\n\n const renderSchemaField = (\n schema: Schema,\n isEditing: boolean,\n onEditValue?: (value: any) => void,\n onStartEdit?: () => void,\n ): ReactElement | null => {\n if (!schema) return null;\n const {value, displayName, description, name, type, required, mutability, subAttributes, multiValued} = schema;\n const label: any = displayName || description || name || '';\n\n if (subAttributes && Array.isArray(subAttributes)) {\n return (\n <>\n {subAttributes.map((subAttr: any, index: any) => {\n let displayValue: string;\n if (Array.isArray(subAttr.value)) {\n displayValue = subAttr.value\n .map((item: any) => (typeof item === 'object' ? JSON.stringify(item) : String(item)))\n .join(', ');\n } else if (typeof subAttr.value === 'object') {\n displayValue = JSON.stringify(subAttr.value);\n } else {\n displayValue = String(subAttr.value);\n }\n\n return (\n <div key={index} className={styles.field}>\n <span className={styles.label}>{subAttr.displayName || subAttr.description || ''}</span>\n <div className={styles.value}>{displayValue}</div>\n </div>\n );\n })}\n </>\n );\n }\n\n if (Array.isArray(value) || multiValued) {\n const hasValues: any = Array.isArray(value)\n ? value.length > 0\n : value !== undefined && value !== null && value !== '';\n const isEditable: any = editable && mutability !== 'READ_ONLY' && !readonlyFields.includes(name || '');\n\n if (isEditing && onEditValue && isEditable) {\n let currentValue: any;\n if (editedUser && name && editedUser[name] !== undefined) {\n currentValue = editedUser[name];\n } else if (flattenedProfile && name && flattenedProfile[name] !== undefined) {\n currentValue = flattenedProfile[name];\n } else {\n currentValue = value;\n }\n\n let fieldValues: string[];\n if (Array.isArray(currentValue)) {\n fieldValues = currentValue.map(String);\n } else if (currentValue !== undefined && currentValue !== null && currentValue !== '') {\n fieldValues = [String(currentValue)];\n } else {\n fieldValues = [];\n }\n\n return (\n <>\n <span className={styles.label}>{label}</span>\n <div className={styles.value}>\n <MultiInput\n values={fieldValues}\n onChange={(newValues: any): void => {\n if (multiValued || Array.isArray(currentValue)) {\n onEditValue(newValues);\n } else {\n onEditValue(newValues[0] || '');\n }\n }}\n placeholder={getFieldPlaceholder(schema)}\n fieldType={type as 'STRING' | 'DATE_TIME' | 'BOOLEAN'}\n type={type === 'DATE_TIME' ? 'date' : 'text'}\n required={required}\n />\n </div>\n </>\n );\n }\n\n let displayValue: string;\n if (hasValues) {\n if (Array.isArray(value)) {\n displayValue = value\n .map((item: any) => (typeof item === 'object' ? JSON.stringify(item) : String(item)))\n .join(', ');\n } else {\n displayValue = String(value);\n }\n } else if (isEditable) {\n displayValue = getFieldPlaceholder(schema);\n } else {\n displayValue = '-';\n }\n\n return (\n <>\n <span className={styles.label}>{label}</span>\n <div className={cx(styles.value, !hasValues ? styles.valuePlaceholder : '')}>\n {!hasValues && isEditable && onStartEdit ? (\n <Button\n onClick={onStartEdit}\n variant=\"text\"\n color=\"secondary\"\n size=\"small\"\n title=\"Click to edit\"\n className={styles.editButton}\n >\n {displayValue}\n </Button>\n ) : (\n displayValue\n )}\n </div>\n </>\n );\n }\n if (type === 'COMPLEX' && typeof value === 'object') {\n return <ObjectDisplay data={value} />;\n }\n\n if (isEditing && onEditValue && mutability !== 'READ_ONLY' && !readonlyFields.includes(name || '')) {\n let fieldValue: any;\n if (editedUser && name && editedUser[name] !== undefined) {\n fieldValue = editedUser[name];\n } else if (flattenedProfile && name && flattenedProfile[name] !== undefined) {\n fieldValue = flattenedProfile[name];\n } else {\n fieldValue = value || '';\n }\n\n const commonProps: any = {\n label: undefined,\n onChange: (e: any) => onEditValue(e.target ? e.target.value : e),\n placeholder: getFieldPlaceholder(schema),\n required,\n value: fieldValue,\n // Removed inline style, use .styles.ts for marginBottom if needed\n };\n let field: ReactElement;\n switch (type) {\n case 'STRING':\n field = <TextField {...commonProps} />;\n break;\n case 'DATE_TIME':\n field = <DatePicker {...commonProps} />;\n break;\n case 'BOOLEAN':\n field = (\n <Checkbox\n {...commonProps}\n checked={!!fieldValue}\n onChange={(e: any): void => {\n onEditValue(e.target.checked);\n }}\n />\n );\n break;\n case 'COMPLEX':\n field = (\n <textarea\n value={fieldValue}\n onChange={(e: any): void => onEditValue(e.target.value)}\n placeholder={getFieldPlaceholder(schema)}\n required={required}\n className={styles.complexTextarea}\n />\n );\n break;\n default:\n field = <TextField {...commonProps} />;\n }\n return (\n <>\n <span className={styles.label}>{label}</span>\n <div className={styles.value}>{field}</div>\n </>\n );\n }\n\n const hasValue: any = value !== undefined && value !== null && value !== '';\n const isEditable: any = editable && mutability !== 'READ_ONLY' && !readonlyFields.includes(name || '');\n\n let displayValue: string;\n if (hasValue) {\n displayValue = String(value);\n } else if (isEditable) {\n displayValue = getFieldPlaceholder(schema);\n } else {\n displayValue = '-';\n }\n\n return (\n <>\n <span className={styles.label}>{label}</span>\n <div className={cx(styles.value, !hasValue ? styles.valuePlaceholder : '')}>\n {!hasValue && isEditable && onStartEdit ? (\n <Button\n onClick={onStartEdit}\n variant=\"text\"\n color=\"secondary\"\n size=\"small\"\n title=\"Click to edit\"\n className={styles.editButton}\n >\n {displayValue}\n </Button>\n ) : (\n displayValue\n )}\n </div>\n </>\n );\n };\n\n const renderUserInfo = (schema: Schema): any => {\n if (!schema?.name) return null;\n\n const hasValue: any = schema.value !== undefined && schema.value !== '' && schema.value !== null;\n const isFieldEditing: any = editingFields[schema.name];\n const isReadonlyField: any = readonlyFields.includes(schema.name);\n\n const shouldShow: any = hasValue || isFieldEditing || (editable && schema.mutability === 'READ_WRITE');\n\n if (!shouldShow) {\n return null;\n }\n\n return (\n <div className={styles.field}>\n <div className={styles.fieldInner}>\n {renderSchemaField(\n schema,\n isFieldEditing,\n (value: any) => {\n const tempEditedUser: any = {...editedUser};\n tempEditedUser[schema.name] = value;\n setEditedUser(tempEditedUser);\n },\n () => toggleFieldEdit(schema.name),\n )}\n </div>\n {editable && schema.mutability !== 'READ_ONLY' && !isReadonlyField && (\n <div className={styles.fieldActions}>\n {isFieldEditing && (\n <>\n <Button size=\"small\" color=\"primary\" variant=\"solid\" onClick={(): any => handleFieldSave(schema)}>\n Save\n </Button>\n <Button\n size=\"small\"\n color=\"secondary\"\n variant=\"solid\"\n onClick={(): any => handleFieldCancel(schema.name)}\n >\n Cancel\n </Button>\n </>\n )}\n {!isFieldEditing && hasValue && (\n <Button\n size=\"small\"\n color=\"tertiary\"\n variant=\"icon\"\n onClick={(): any => toggleFieldEdit(schema.name)}\n title=\"Edit\"\n className={styles.editButton}\n >\n <PencilIcon />\n </Button>\n )}\n </div>\n )}\n </div>\n );\n };\n\n if (!profile && !flattenedProfile) {\n return fallback;\n }\n\n const containerClasses: any = cx(\n styles.root,\n cardLayout ? styles.card : '',\n withVendorCSSClassPrefix('user-profile'),\n className,\n );\n\n const currentUser: any = flattenedProfile || profile;\n\n const renderProfileWithoutSchemas = (): any => {\n if (!currentUser) return null;\n\n const displayName: any = getDisplayName(mergedMappings, profile, displayNameAttributes);\n\n const profileEntries: any = Object.entries(currentUser)\n .filter(([key, value]: [string, any]) => {\n if (!shouldShowField(key)) return false;\n\n return value !== undefined && value !== '' && value !== null;\n })\n .sort(([a]: [string, ...any[]], [b]: [string, ...any[]]) => a.localeCompare(b));\n\n return (\n <>\n <div className={styles.profileSummary}>\n <Avatar\n imageUrl={getMappedUserProfileValue('picture', mergedMappings, currentUser)}\n name={displayName}\n size={70}\n alt={`${displayName}'s avatar`}\n isLoading={isLoading}\n />\n <Typography variant=\"h3\" fontWeight=\"medium\">\n {displayName}\n </Typography>\n {getMappedUserProfileValue('email', mergedMappings, currentUser) && (\n <Typography variant=\"body2\" color=\"textSecondary\">\n {getMappedUserProfileValue('email', mergedMappings, currentUser)}\n </Typography>\n )}\n </div>\n <Divider />\n {profileEntries.map(([key, value]: any, index: any) => (\n <div key={key}>\n <div className={styles.sectionRow}>\n <div className={styles.sectionLabel}>{formatLabel(key)}</div>\n <div className={styles.sectionValue}>\n {typeof value === 'object' ? <ObjectDisplay data={value} /> : String(value)}\n </div>\n </div>\n {index < profileEntries.length - 1 && <Divider />}\n </div>\n ))}\n </>\n );\n };\n\n const profileContent: any = (\n <CardPrimitive className={containerClasses}>\n {error && (\n <AlertPrimitive\n variant=\"error\"\n className={cx(withVendorCSSClassPrefix(bem('user-profile', 'alert')), styles.alert)}\n >\n <AlertPrimitive.Title>{t('errors.heading') || 'Error'}</AlertPrimitive.Title>\n <AlertPrimitive.Description>{error}</AlertPrimitive.Description>\n </AlertPrimitive>\n )}\n {schemas && schemas.length > 0 && (\n <div className={styles.header}>\n <Avatar\n imageUrl={getMappedUserProfileValue('picture', mergedMappings, currentUser)}\n name={getDisplayName(mergedMappings, profile)}\n size={80}\n alt={`${getDisplayName(mergedMappings, profile)}'s avatar`}\n isLoading={isLoading}\n />\n </div>\n )}\n <div className={styles.infoContainer}>\n {schemas && schemas.length > 0\n ? schemas\n .filter((schema: any) => {\n if (!schema.name || !shouldShowField(schema.name)) return false;\n\n if (!editable) {\n const value: any = flattenedProfile && schema.name ? flattenedProfile[schema.name] : undefined;\n return value !== undefined && value !== '' && value !== null;\n }\n\n return true;\n })\n .sort((a: any, b: any) => {\n const orderA: any = a.displayOrder ? parseInt(a.displayOrder, 10) : 999;\n const orderB: any = b.displayOrder ? parseInt(b.displayOrder, 10) : 999;\n return orderA - orderB;\n })\n .map((schema: any, index: any) => {\n const value: any = flattenedProfile && schema.name ? flattenedProfile[schema.name] : undefined;\n const schemaWithValue: any = {\n ...schema,\n value,\n };\n\n return (\n <div key={schema.name || index} className={styles.info}>\n {renderUserInfo(schemaWithValue)}\n </div>\n );\n })\n : renderProfileWithoutSchemas()}\n </div>\n </CardPrimitive>\n );\n\n if (mode === 'popup') {\n return (\n <DialogPrimitive open={open} onOpenChange={onOpenChange}>\n <DialogPrimitive.Content>\n <DialogPrimitive.Heading>{title ?? t('user.profile.heading')}</DialogPrimitive.Heading>\n <div className={styles.popup}>{profileContent}</div>\n </DialogPrimitive.Content>\n </DialogPrimitive>\n );\n }\n\n return profileContent;\n};\n\nexport default BaseUserProfile;\n","/**\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 User,\n HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n updateMeProfile as baseUpdateMeProfile,\n UpdateMeProfileConfig as BaseUpdateMeProfileConfig,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the updateMeProfile request (React-specific)\n */\nexport interface UpdateMeProfileConfig extends Omit<BaseUpdateMeProfileConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Updates the user profile information at the specified SCIM2 Me endpoint.\n * This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.\n *\n * @param config - Configuration object with URL, payload and optional request config.\n * @returns A promise that resolves with the updated user profile information.\n * @example\n * ```typescript\n * // Using default ThunderID SPA client httpClient\n * await updateMeProfile({\n * url: \"https://api.asgardeo.io/t/<ORG>/scim2/Me\",\n * payload: { \"urn:scim:wso2:schema\": { mobileNumbers: [\"0777933830\"] } }\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher\n * await updateMeProfile({\n * url: \"https://api.asgardeo.io/t/<ORG>/scim2/Me\",\n * payload: { \"urn:scim:wso2:schema\": { mobileNumbers: [\"0777933830\"] } },\n * fetcher: customFetchFunction\n * });\n * ```\n */\nconst updateMeProfile = async ({fetcher, instanceId = 0, ...requestConfig}: UpdateMeProfileConfig): Promise<User> => {\n const defaultFetcher = async (url: string, config: RequestInit): Promise<Response> => {\n const httpClient: FetchHttpClient = FetchHttpClient.getInstance(instanceId);\n const response: HttpResponse<any> = await httpClient.request({\n data: config.body ? JSON.parse(config.body as string) : undefined,\n headers: config.headers as Record<string, string>,\n method: config.method || 'PATCH',\n url,\n } as HttpRequestConfig);\n\n return {\n json: () => Promise.resolve(response.data),\n ok: response.status >= 200 && response.status < 300,\n status: response.status,\n statusText: response.statusText || '',\n text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data)),\n } as Response;\n };\n\n return baseUpdateMeProfile({\n ...requestConfig,\n fetcher: fetcher || defaultFetcher,\n });\n};\n\nexport default updateMeProfile;\n","/**\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 {ThunderIDError, User} from '@thunderid/browser';\nimport {FC, ReactElement, useState} from 'react';\n// eslint-disable-next-line import/no-named-as-default\nimport BaseUserProfile, {BaseUserProfileProps} from './BaseUserProfile';\nimport updateMeProfile from '../../../api/updateMeProfile';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\nimport useUser from '../../../contexts/User/useUser';\nimport useTranslation from '../../../hooks/useTranslation';\n\n/**\n * Props for the UserProfile component.\n * Extends BaseUserProfileProps but makes the user prop optional since it will be obtained from useThunderID\n */\nexport type UserProfileProps = Omit<BaseUserProfileProps, 'user' | 'profile' | 'flattenedProfile' | 'schemas'>;\n\n/**\n * UserProfile component displays the authenticated user's profile information in a\n * structured and styled format. It shows user details such as display name, email,\n * username, and other available profile information from ThunderID.\n *\n * This component is the React-specific implementation that uses the BaseUserProfile\n * and automatically retrieves the user data from ThunderID context if not provided.\n *\n * @example\n * ```tsx\n * // Basic usage - will use user from ThunderID context\n * <UserProfile />\n *\n * // With explicit user data\n * <UserProfile user={specificUser} />\n *\n * // With card layout and custom fallback\n * <UserProfile\n * cardLayout={true}\n * fallback={<div>Please sign in to view your profile</div>}\n * />\n *\n * // With field filtering - only show specific fields\n * <UserProfile\n * showFields={['name.givenName', 'name.familyName', 'emails']}\n * />\n *\n * // With field hiding - hide specific fields\n * <UserProfile\n * hideFields={['phoneNumbers', 'addresses']}\n * />\n * ```\n */\nconst UserProfile: FC<UserProfileProps> = ({preferences, ...rest}: UserProfileProps): ReactElement => {\n const {baseUrl, instanceId} = useThunderID();\n const {profile, flattenedProfile, schemas, onUpdateProfile} = useUser();\n const {t} = useTranslation(preferences?.i18n);\n\n const [error, setError] = useState<string | null>(null);\n\n const handleProfileUpdate = async (payload: any): Promise<void> => {\n setError(null);\n\n try {\n const response: User = await updateMeProfile({baseUrl, instanceId, payload});\n onUpdateProfile(response);\n } catch (caughtError: unknown) {\n let message: string = t('user.profile.update.generic.error');\n\n if (caughtError instanceof ThunderIDError) {\n message = caughtError?.message;\n }\n\n setError(message);\n }\n };\n\n return (\n <BaseUserProfile\n profile={profile}\n flattenedProfile={flattenedProfile}\n schemas={schemas}\n onUpdate={handleProfileUpdate}\n error={error}\n preferences={preferences}\n {...rest}\n />\n );\n};\n\nexport default UserProfile;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the BaseUserDropdown component\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(() => {\n const trigger: string = css`\n display: inline-flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} * 0.75);\n padding: calc(${theme.vars.spacing.unit} * 0.5);\n background: none;\n border: none;\n cursor: pointer;\n border-radius: ${theme.vars.borderRadius.medium};\n transition: none;\n box-shadow: none;\n background-color: transparent;\n\n &:hover {\n background-color: ${theme.vars.colors.action?.hover || 'rgba(0, 0, 0, 0.05)'};\n }\n\n &:focus {\n outline: 2px solid ${theme.vars.colors.primary};\n outline-offset: 2px;\n }\n\n &:hover,\n &:focus,\n &:active,\n &:focus-visible {\n transition: none;\n box-shadow: none;\n }\n `;\n\n const userName: string = css`\n color: ${theme.vars.colors.text.primary};\n font-size: 0.875rem;\n font-weight: 500;\n max-width: 150px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `;\n\n const dropdownContent: string = css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n box-shadow:\n 0 4px 6px -1px rgba(0, 0, 0, 0.1),\n 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n border: 1px solid ${theme.vars.colors.border};\n font-family: ${theme.vars.typography.fontFamily};\n min-width: 250px;\n max-width: 600px;\n z-index: 1000;\n overflow: hidden;\n `;\n\n const dropdownMenu: string = css`\n display: flex;\n flex-direction: column;\n width: 100%;\n `;\n\n const menuItem: string = css`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: ${theme.vars.spacing.unit};\n padding: calc(${theme.vars.spacing.unit} * 1.5) calc(${theme.vars.spacing.unit} * 2);\n width: 100%;\n color: ${theme.vars.colors.text.primary};\n text-decoration: none;\n border: none;\n cursor: pointer;\n font-size: 0.875rem;\n text-align: start;\n border-radius: ${theme.vars.borderRadius.medium};\n transition: none;\n box-shadow: none;\n background: transparent;\n\n &:hover {\n background-color: ${theme.vars.colors.action?.hover || 'rgba(0, 0, 0, 0.05)'};\n }\n\n &:hover,\n &:focus,\n &:active,\n &:focus-visible {\n transition: none;\n box-shadow: none;\n }\n `;\n\n const menuItemAnchor: string = css`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: ${theme.vars.spacing.unit};\n padding: calc(${theme.vars.spacing.unit} * 1.5) calc(${theme.vars.spacing.unit} * 2);\n width: 100%;\n color: ${theme.vars.colors.text.primary};\n text-decoration: none;\n border: none;\n background: none;\n cursor: pointer;\n font-size: 0.875rem;\n text-align: start;\n border-radius: ${theme.vars.borderRadius.medium};\n transition: background-color 0.15s ease-in-out;\n\n &:hover {\n background-color: ${theme.vars.colors.action?.hover || 'rgba(0, 0, 0, 0.05)'};\n }\n `;\n\n const divider: string = css`\n margin: calc(${theme.vars.spacing.unit} * 0.5) 0;\n border-bottom: 1px solid ${theme.vars.colors.border};\n `;\n\n const dropdownHeader: string = css`\n display: flex;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n padding: calc(${theme.vars.spacing.unit} * 1.5);\n border-bottom: 1px solid ${theme.vars.colors.border};\n `;\n\n const headerInfo: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} / 4);\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `;\n\n const headerName: string = css`\n color: ${theme.vars.colors.text.primary};\n font-size: 1rem;\n font-weight: 500;\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `;\n\n const headerEmail: string = css`\n color: ${theme.vars.colors.text.secondary};\n font-size: 0.875rem;\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `;\n\n const loadingContainer: string = css`\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 80px;\n gap: ${theme.vars.spacing.unit};\n `;\n\n const loadingText: string = css`\n color: ${theme.vars.colors.text.secondary};\n font-size: 0.875rem;\n `;\n\n return {\n divider,\n dropdownContent,\n dropdownHeader,\n dropdownMenu,\n headerEmail,\n headerInfo,\n headerName,\n loadingContainer,\n loadingText,\n menuItem,\n menuItemAnchor,\n trigger,\n userName,\n };\n }, [\n theme.vars.colors.background.surface,\n theme.vars.colors.text.primary,\n theme.vars.colors.text.secondary,\n theme.vars.colors.border,\n theme.vars.colors.primary,\n theme.vars.colors.action?.hover,\n theme.vars.borderRadius.medium,\n theme.vars.borderRadius.large,\n theme.vars.spacing.unit,\n theme.vars.typography.fontFamily,\n colorScheme,\n ]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n useClick,\n useDismiss,\n useRole,\n useInteractions,\n FloatingFocusManager,\n FloatingPortal,\n} from '@floating-ui/react';\nimport {withVendorCSSClassPrefix} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useState} from 'react';\nimport useStyles from './BaseUserDropdown.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport getDisplayName from '../../../utils/getDisplayName';\nimport getMappedUserProfileValue from '../../../utils/getMappedUserProfileValue';\nimport {Avatar} from '../../primitives/Avatar/Avatar';\nimport Button from '../../primitives/Button/Button';\nimport LogOut from '../../primitives/Icons/LogOut';\nimport User from '../../primitives/Icons/User';\nimport Typography from '../../primitives/Typography/Typography';\n\ninterface MenuItem {\n href?: string;\n icon?: ReactNode;\n label: ReactNode;\n onClick?: () => void;\n}\n\nexport interface BaseUserDropdownProps {\n /**\n * Mapping of component attribute names to identity provider field names.\n * Allows customizing which user profile fields should be used for each attribute.\n */\n attributeMapping?: {\n [key: string]: string | string[] | undefined;\n firstName?: string | string[];\n lastName?: string | string[];\n picture?: string | string[];\n username?: string | string[];\n };\n /**\n * Optional size for the avatar\n */\n avatarSize?: number;\n /**\n * Optional className for the dropdown container.\n */\n className?: string;\n /**\n * Optional element to render when no user is signed in.\n */\n fallback?: ReactElement;\n /**\n * Whether the user data is currently loading\n */\n isLoading?: boolean;\n /**\n * Menu items to display in the dropdown\n */\n menuItems?: MenuItem[];\n /**\n * Callback function for \"Manage Profile\" action\n */\n onManageProfile?: () => void;\n /**\n * Callback function for \"Sign Out\" action\n */\n onSignOut?: () => void;\n /**\n * The HTML element ID where the portal should be mounted\n */\n portalId?: string;\n /**\n * Show dropdown header with user information\n */\n showDropdownHeader?: boolean;\n /**\n * Show user's display name next to avatar in the trigger button\n */\n showTriggerLabel?: boolean;\n /**\n * The user object containing profile information\n */\n user: any;\n}\n\n/**\n * BaseUserDropdown component displays a user avatar with a dropdown menu.\n * When clicked, it shows a popover with customizable menu items.\n * This component serves as the base for framework-specific implementations.\n */\nexport const BaseUserDropdown: FC<BaseUserDropdownProps> = ({\n fallback = null,\n className = '',\n user,\n isLoading = false,\n portalId = 'thunderid-user-dropdown',\n menuItems = [],\n showTriggerLabel = false,\n avatarSize = 32,\n onManageProfile,\n onSignOut,\n attributeMapping = {},\n}: BaseUserDropdownProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const [isOpen, setIsOpen] = useState(false);\n const [hoveredItemIndex, setHoveredItemIndex] = useState<number | null>(null);\n\n const {refs, floatingStyles, context} = useFloating({\n middleware: [offset(5), flip({fallbackAxisSideDirection: 'end'}), shift({padding: 5})],\n onOpenChange: setIsOpen,\n open: isOpen,\n placement: 'bottom-end',\n whileElementsMounted: autoUpdate,\n });\n\n const click: any = useClick(context);\n const dismiss: any = useDismiss(context);\n const role: any = useRole(context);\n\n const {getReferenceProps, getFloatingProps} = useInteractions([click, dismiss, role]);\n\n const defaultAttributeMappings: Record<string, string | string[] | undefined> = {\n email: ['emails'],\n firstName: ['name.givenName', 'given_name'],\n lastName: ['name.familyName', 'family_name'],\n picture: ['profile', 'profileUrl', 'picture', 'URL'],\n username: ['userName', 'username', 'user_name'],\n };\n\n const mergedMappings: Record<string, string | string[] | undefined> = {\n ...defaultAttributeMappings,\n ...attributeMapping,\n };\n\n if (fallback && !user && !isLoading) {\n return fallback;\n }\n\n const handleMenuItemClick = (item: MenuItem): void => {\n if (item.onClick) {\n item.onClick();\n }\n setIsOpen(false);\n };\n\n const defaultMenuItems: MenuItem[] = [];\n\n if (onManageProfile) {\n defaultMenuItems.push({\n icon: <User width=\"16\" height=\"16\" />,\n label: 'Manage Profile',\n onClick: onManageProfile,\n });\n }\n\n if (onSignOut) {\n defaultMenuItems.push({\n icon: <LogOut width=\"16\" height=\"16\" />,\n label: 'Sign Out',\n onClick: onSignOut,\n });\n }\n\n const allMenuItems: MenuItem[] = [...menuItems];\n\n if (defaultMenuItems.length > 0) {\n if (menuItems.length > 0) {\n allMenuItems.push({label: '', onClick: undefined});\n }\n\n allMenuItems.push(...defaultMenuItems);\n }\n\n return (\n <div className={cx(withVendorCSSClassPrefix('user-dropdown'), className)}>\n <Button\n ref={refs.setReference}\n className={cx(withVendorCSSClassPrefix('user-dropdown__trigger'), styles['trigger'])}\n color=\"tertiary\"\n variant=\"text\"\n size=\"medium\"\n data-testid=\"thunderid-user-dropdown-trigger\"\n {...getReferenceProps()}\n >\n <Avatar\n imageUrl={getMappedUserProfileValue('picture', mergedMappings, user)}\n name={getDisplayName(mergedMappings, user)}\n size={avatarSize}\n alt={`${getDisplayName(mergedMappings, user)}'s avatar`}\n />\n {showTriggerLabel && (\n <Typography\n variant=\"body2\"\n className={cx(withVendorCSSClassPrefix('user-dropdown__trigger-label'), styles['userName'])}\n >\n {getDisplayName(mergedMappings, user)}\n </Typography>\n )}\n </Button>\n\n {isOpen && (\n <FloatingPortal id={portalId}>\n <FloatingFocusManager context={context} modal={false} initialFocus={-1}>\n <div\n ref={refs.setFloating}\n className={cx(withVendorCSSClassPrefix('user-dropdown__content'), styles['dropdownContent'])}\n style={{\n ...floatingStyles,\n // Floating UI doesn't set a z-index by default, so we set a high value to ensure the dropdown appears above other elements.\n // https://floating-ui.com/docs/misc#z-index-stacking\n zIndex: 9999,\n }}\n {...getFloatingProps()}\n >\n <div className={cx(withVendorCSSClassPrefix('user-dropdown__header'), styles['dropdownHeader'])}>\n <Avatar\n imageUrl={getMappedUserProfileValue('picture', mergedMappings, user)}\n name={getDisplayName(mergedMappings, user)}\n size={avatarSize * 1.25}\n alt={`${getDisplayName(mergedMappings, user)}'s avatar`}\n />\n <div className={cx(withVendorCSSClassPrefix('user-dropdown__header-info'), styles['headerInfo'])}>\n <Typography\n noWrap\n className={withVendorCSSClassPrefix('user-dropdown__header-name')}\n variant=\"body1\"\n fontWeight=\"medium\"\n >\n {getDisplayName(mergedMappings, user)}\n </Typography>\n <Typography\n noWrap\n className={withVendorCSSClassPrefix('user-dropdown__header-email')}\n variant=\"caption\"\n color=\"secondary\"\n >\n {getMappedUserProfileValue('username', mergedMappings, user) ||\n getMappedUserProfileValue('email', mergedMappings, user)}\n </Typography>\n </div>\n </div>\n <div className={cx(withVendorCSSClassPrefix('user-dropdown__menu'), styles['dropdownMenu'])}>\n {allMenuItems.map((item: any, index: number) => (\n <div key={index}>\n {((): ReactElement => {\n if (item.label === '') {\n return (\n <div\n className={cx(withVendorCSSClassPrefix('user-dropdown__menu-divider'), styles['divider'])}\n />\n );\n }\n if (item.href) {\n return (\n <a\n href={item.href}\n style={{\n backgroundColor:\n hoveredItemIndex === index ? theme.vars.colors.action?.hover : 'transparent',\n }}\n className={cx(\n withVendorCSSClassPrefix('user-dropdown__menu-item'),\n styles['menuItemAnchor'],\n )}\n onMouseEnter={(): void => setHoveredItemIndex(index)}\n onMouseLeave={(): void => setHoveredItemIndex(null)}\n onFocus={(): void => setHoveredItemIndex(index)}\n onBlur={(): void => setHoveredItemIndex(null)}\n >\n {item.icon}\n <span>{item.label}</span>\n </a>\n );\n }\n return (\n <Button\n onClick={(): void => handleMenuItemClick(item)}\n style={{\n backgroundColor:\n hoveredItemIndex === index ? theme.vars.colors.action?.hover : 'transparent',\n }}\n className={cx(withVendorCSSClassPrefix('user-dropdown__menu-item'), styles['menuItem'])}\n color=\"tertiary\"\n variant=\"text\"\n size=\"small\"\n startIcon={item.icon}\n onMouseEnter={(): void => setHoveredItemIndex(index)}\n onMouseLeave={(): void => setHoveredItemIndex(null)}\n >\n {item.label}\n </Button>\n );\n })()}\n </div>\n ))}\n </div>\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n )}\n </div>\n );\n};\n\nexport default BaseUserDropdown;\n","/**\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 {FlowMetadataResponse} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useState} from 'react';\nimport {BaseUserDropdown as BaseUserDropdownComponent, BaseUserDropdownProps} from './BaseUserDropdown';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\nimport UserProfile from '../UserProfile/UserProfile';\n\n/**\n * Render props data passed to the children function\n */\nexport interface UserDropdownRenderProps {\n /** Function to close the profile dialog */\n closeProfile: () => void;\n /** Whether user data is currently loading */\n isLoading: boolean;\n /** Whether the profile dialog is currently open */\n isProfileOpen: boolean;\n /** Flow metadata returned by the platform (v2 only). `null` while loading or unavailable. */\n meta: FlowMetadataResponse | null;\n /** Function to open the user profile dialog */\n openProfile: () => void;\n /** Function to sign out the user */\n signOut: () => void;\n /** The authenticated user object */\n user: any;\n}\n\n/**\n * Props for the UserDropdown component.\n * Extends BaseUserDropdownProps but excludes user, onManageProfile, and onSignOut since they're handled internally\n */\nexport type UserDropdownProps = Omit<BaseUserDropdownProps, 'user' | 'onManageProfile'> & {\n /**\n * Render prop function that receives user state and actions.\n * When provided, this completely replaces the default dropdown rendering.\n */\n children?: (props: UserDropdownRenderProps) => ReactNode;\n /**\n * Custom render function for the dropdown content.\n * When provided, this replaces just the dropdown content while keeping the trigger.\n */\n renderDropdown?: (props: UserDropdownRenderProps) => ReactNode;\n /**\n * Custom render function for the trigger button.\n * When provided, this replaces just the trigger button while keeping the dropdown.\n */\n renderTrigger?: (props: UserDropdownRenderProps) => ReactNode;\n};\n\n/**\n * UserDropdown component displays a user avatar with a dropdown menu.\n * When clicked, it shows a popover with customizable menu items.\n * This component is the React-specific implementation that uses the BaseUserDropdown\n * and automatically retrieves the user data from ThunderID context.\n *\n * Supports render props for complete customization of the dropdown appearance and behavior.\n *\n * @example\n * ```tsx\n * // Basic usage - will use user from ThunderID context\n * <UserDropdown menuItems={[\n * { label: 'Profile', onClick: () => {} },\n * { label: 'Settings', href: '/settings' },\n * { label: 'Sign Out', onClick: () => {} }\n * ]} />\n *\n * // With custom configuration\n * <UserDropdown\n * showTriggerLabel={true}\n * avatarSize={40}\n * fallback={<div>Please sign in</div>}\n * />\n *\n * // Using render props for complete customization\n * <UserDropdown>\n * {({ user, isLoading, openProfile, signOut }) => (\n * <div>\n * <button onClick={openProfile}>\n * {user?.name || 'Loading...'}\n * </button>\n * <button onClick={signOut}>Logout</button>\n * </div>\n * )}\n * </UserDropdown>\n *\n * // Using partial render props\n * <UserDropdown\n * renderTrigger={({ user, openProfile }) => (\n * <button onClick={openProfile} className=\"custom-trigger\">\n * Welcome, {user?.name}!\n * </button>\n * )}\n * />\n * ```\n */\nconst UserDropdown: FC<UserDropdownProps> = ({\n children,\n renderTrigger,\n renderDropdown,\n onSignOut,\n ...rest\n}: UserDropdownProps): ReactElement => {\n const {user, isLoading, signOut, meta} = useThunderID();\n const [isProfileOpen, setIsProfileOpen] = useState(false);\n\n const handleManageProfile = (): void => {\n setIsProfileOpen(true);\n };\n\n const handleSignOut = (): void => {\n signOut();\n if (onSignOut) {\n onSignOut();\n }\n };\n\n const closeProfile = (): void => {\n setIsProfileOpen(false);\n };\n\n // Prepare render props data\n const renderProps: UserDropdownRenderProps = {\n closeProfile,\n isLoading: isLoading,\n isProfileOpen,\n meta,\n openProfile: handleManageProfile,\n signOut: handleSignOut,\n user,\n };\n\n // If children render prop is provided, use it for complete customization\n if (children) {\n return (\n <>\n {children(renderProps)}\n <UserProfile mode=\"popup\" open={isProfileOpen} onOpenChange={setIsProfileOpen} />\n </>\n );\n }\n\n // If partial render props are provided, customize specific parts\n if (renderTrigger || renderDropdown) {\n // This would require significant changes to BaseUserDropdown to support partial customization\n // For now, we'll provide a simple implementation that shows how it could work\n return (\n <>\n {renderTrigger ? (\n renderTrigger(renderProps)\n ) : (\n <BaseUserDropdownComponent\n user={user}\n isLoading={isLoading}\n onManageProfile={handleManageProfile}\n onSignOut={handleSignOut}\n {...rest}\n />\n )}\n {/* Note: renderDropdown would need BaseUserDropdown modifications to implement properly */}\n <UserProfile mode=\"popup\" open={isProfileOpen} onOpenChange={setIsProfileOpen} />\n </>\n );\n }\n\n // Default behavior - use BaseUserDropdown as before\n return (\n <>\n <BaseUserDropdownComponent\n user={user}\n isLoading={isLoading}\n onManageProfile={handleManageProfile}\n onSignOut={handleSignOut}\n {...rest}\n />\n {isProfileOpen && <UserProfile mode=\"popup\" open={isProfileOpen} onOpenChange={setIsProfileOpen} />}\n </>\n );\n};\n\nexport default UserDropdown;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the BaseOrganizationSwitcher component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\n\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(() => {\n const root: string = css`\n display: inline-block;\n position: relative;\n font-family: ${theme.vars.typography.fontFamily};\n `;\n\n const trigger: string = css`\n display: inline-flex;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n padding: calc(${theme.vars.spacing.unit} * 0.75) ${theme.vars.spacing.unit};\n border: 1px solid ${theme.vars.colors.border};\n background: ${theme.vars.colors.background.surface};\n cursor: pointer;\n border-radius: ${theme.vars.borderRadius.medium};\n min-width: 160px;\n\n > span {\n width: 100%;\n gap: ${theme.vars.spacing.unit};\n }\n\n &:hover {\n background-color: ${theme.vars.colors.background.surface};\n }\n `;\n\n const triggerLabel: string = css`\n color: ${theme.vars.colors.text.primary};\n font-weight: 500;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: 1;\n `;\n\n const content: string = css`\n min-width: 280px;\n max-width: 400px;\n background-color: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.medium};\n box-shadow: ${theme.vars.shadows.medium};\n border: 1px solid ${theme.vars.colors.border};\n outline: none;\n z-index: 1000;\n `;\n\n const header: string = css`\n display: flex;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n padding: ${theme.vars.spacing.unit} calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const headerInfo: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} / 4);\n flex: 1;\n min-width: 0;\n overflow: hidden;\n `;\n\n const headerName: string = css`\n color: ${theme.vars.colors.text.primary};\n font-size: 0.875rem;\n font-weight: 500;\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `;\n\n const headerMeta: string = css`\n color: ${theme.vars.colors.text.secondary};\n font-size: 0.75rem;\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `;\n\n const headerRole: string = css`\n color: ${theme.vars.colors.text.secondary};\n font-size: 0.75rem;\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-transform: capitalize;\n `;\n\n const manageButton: string = css`\n min-width: auto;\n margin-inline-start: auto;\n `;\n\n const menu: string = css`\n display: flex;\n flex-direction: column;\n width: 100%;\n `;\n\n const menuItem: string = css`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: ${theme.vars.spacing.unit};\n padding: calc(${theme.vars.spacing.unit} * 1.5) calc(${theme.vars.spacing.unit} * 2);\n width: 100%;\n color: ${theme.vars.colors.text.primary};\n text-decoration: none;\n border: none;\n background-color: transparent;\n cursor: pointer;\n font-size: 0.875rem;\n text-align: start;\n border-radius: ${theme.vars.borderRadius.medium};\n transition: background-color 0.15s ease-in-out;\n\n > span {\n gap: ${theme.vars.spacing.unit};\n }\n\n &:hover {\n background-color: ${theme.vars.colors.action?.hover || 'rgba(0, 0, 0, 0.04)'};\n }\n `;\n\n const menuDivider: string = css`\n margin: calc(${theme.vars.spacing.unit} * 0.5) 0;\n border-bottom: 1px solid ${theme.vars.colors.border};\n `;\n\n const organizationInfo: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} / 4);\n flex: 1;\n min-width: 0;\n overflow: hidden;\n `;\n\n const organizationName: string = css`\n color: ${theme.vars.colors.text.primary};\n font-size: 0.875rem;\n font-weight: 500;\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `;\n\n const organizationMeta: string = css`\n color: ${theme.vars.colors.text.secondary};\n font-size: 0.75rem;\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `;\n\n const loadingContainer: string = css`\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 80px;\n gap: ${theme.vars.spacing.unit};\n `;\n\n const loadingText: string = css`\n color: ${theme.vars.colors.text.secondary};\n font-size: 0.875rem;\n `;\n\n const errorContainer: string = css`\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 80px;\n padding: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const errorText: string = css`\n color: ${theme.vars.colors.text.secondary};\n font-size: 0.875rem;\n text-align: center;\n `;\n\n const sectionHeader: string = css`\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: ${theme.vars.colors.text.secondary};\n `;\n\n const sectionHeaderContainer: string = css`\n border-top: none;\n border-bottom: none;\n padding-bottom: calc(${theme.vars.spacing.unit} / 2);\n `;\n\n const roleCapitalized: string = css`\n text-transform: capitalize;\n `;\n\n return {\n content,\n errorContainer,\n errorText,\n header,\n headerInfo,\n headerMeta,\n headerName,\n headerRole,\n loadingContainer,\n loadingText,\n manageButton,\n menu,\n menuDivider,\n menuItem,\n organizationInfo,\n organizationMeta,\n organizationName,\n roleCapitalized,\n root,\n sectionHeader,\n sectionHeaderContainer,\n trigger,\n triggerLabel,\n };\n }, [\n theme.vars.colors.background.surface,\n theme.vars.colors.text.primary,\n theme.vars.colors.text.secondary,\n theme.vars.colors.border,\n theme.vars.borderRadius.medium,\n theme.vars.shadows.medium,\n theme.vars.spacing.unit,\n theme.vars.colors.action?.hover,\n theme.vars.typography.fontFamily,\n colorScheme,\n ]);\n\nexport default useStyles;\n","/**\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 {FC} from 'react';\n\nexport interface BuildingProps {\n /**\n * Color of the icon.\n */\n color?: string;\n /**\n * Height of the icon.\n */\n height?: number | string;\n /**\n * Width of the icon.\n */\n width?: number | string;\n}\n\n/**\n * Building Icon component.\n *\n * @param props - Props injected to the component.\n * @returns Building Icon component.\n */\nconst Building: FC<BuildingProps> = ({color = 'currentColor', height = 24, width = 24}: BuildingProps) => (\n <svg width={width} height={height} viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path d=\"M6 12h4\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n <path d=\"M6 8h4\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n <path d=\"M14 8h4\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n <path d=\"M14 12h4\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n <path d=\"M6 18h4\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n <path d=\"M14 18h4\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\nBuilding.displayName = 'Building';\n\nexport default Building;\n","/**\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 {FC} from 'react';\n\nexport interface CheckProps {\n /**\n * Color of the icon.\n */\n color?: string;\n /**\n * Height of the icon.\n */\n height?: number | string;\n /**\n * Width of the icon.\n */\n width?: number | string;\n}\n\n/**\n * Check Icon component.\n *\n * @param props - Props injected to the component.\n * @returns Check Icon component.\n */\nconst Check: FC<CheckProps> = ({color = 'currentColor', height = 24, width = 24}: CheckProps) => (\n <svg width={width} height={height} viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M20 6 9 17l-5-5\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\nCheck.displayName = 'Check';\n\nexport default Check;\n","/**\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 {FC} from 'react';\n\nexport interface ChevronDownProps {\n /**\n * Color of the icon.\n */\n color?: string;\n /**\n * Height of the icon.\n */\n height?: number | string;\n /**\n * Width of the icon.\n */\n width?: number | string;\n}\n\n/**\n * ChevronDown Icon component.\n *\n * @param props - Props injected to the component.\n * @returns ChevronDown Icon component.\n */\nconst ChevronDown: FC<ChevronDownProps> = ({color = 'currentColor', height = 24, width = 24}: ChevronDownProps) => (\n <svg width={width} height={height} viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"m6 9 6 6 6-6\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\nChevronDown.displayName = 'ChevronDown';\n\nexport default ChevronDown;\n","/**\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\n// Removed BEM and vendor prefix utilities\nimport {cx} from '@emotion/css';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n useClick,\n useDismiss,\n useRole,\n useInteractions,\n FloatingFocusManager,\n FloatingPortal,\n} from '@floating-ui/react';\nimport {Preferences} from '@thunderid/browser';\nimport {CSSProperties, FC, ReactElement, ReactNode, useState} from 'react';\nimport useStyles from './BaseOrganizationSwitcher.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport useTranslation from '../../../hooks/useTranslation';\nimport {Avatar} from '../../primitives/Avatar/Avatar';\nimport Button from '../../primitives/Button/Button';\nimport Building from '../../primitives/Icons/Building';\nimport Check from '../../primitives/Icons/Check';\nimport ChevronDown from '../../primitives/Icons/ChevronDown';\nimport Typography from '../../primitives/Typography/Typography';\n\ninterface MenuItem {\n href?: string;\n icon?: ReactNode;\n label: ReactNode;\n onClick?: () => void;\n}\n\n/**\n * Interface for organization data.\n */\nexport interface Organization {\n /**\n * Avatar URL for the organization.\n */\n avatar?: string;\n /**\n * Unique identifier for the organization.\n */\n id: string;\n /**\n * Number of members in the organization.\n */\n memberCount?: number;\n /**\n * Additional metadata for the organization.\n */\n metadata?: Record<string, any>;\n /**\n * Display name of the organization.\n */\n name: string;\n /**\n * User's role in the organization.\n */\n role?: 'owner' | 'admin' | 'member';\n /**\n * URL slug for the organization.\n */\n slug?: string;\n}\n\n/**\n * Props interface for the BaseOrganizationSwitcher component.\n */\nexport interface BaseOrganizationSwitcherProps {\n /**\n * Optional size for the avatar\n */\n avatarSize?: number;\n /**\n * Custom class name for styling.\n */\n className?: string;\n /**\n * Currently selected organization.\n */\n currentOrganization?: Organization;\n /**\n * Error message to display.\n */\n error?: string;\n /**\n * Optional element to render when no organization is selected.\n */\n fallback?: ReactElement;\n /**\n * Whether the component is in a loading state.\n */\n loading?: boolean;\n /**\n * Additional menu items to display at the bottom of the dropdown.\n */\n menuItems?: MenuItem[];\n /**\n * Handler for when the manage profile button is clicked.\n */\n onManageProfile?: () => void;\n /**\n * Handler for when an organization is selected.\n */\n onOrganizationSwitch: (organization: Organization) => void;\n /**\n * List of available organizations.\n */\n organizations: Organization[];\n /**\n * The HTML element ID where the portal should be mounted\n */\n portalId?: string;\n /**\n * Component-level preferences to override global i18n and theme settings.\n * Preferences are deep-merged with global ones, with component preferences\n * taking precedence. Affects this component and all its descendants.\n */\n preferences?: Preferences;\n /**\n * Custom render function for the error state.\n */\n renderError?: (error: string) => ReactElement;\n /**\n * Custom render function for the loading state.\n */\n renderLoading?: () => ReactElement;\n /**\n * Custom render function for the organization item.\n */\n renderOrganization?: (organization: Organization, isSelected: boolean) => ReactElement;\n /**\n * Whether to show the member count.\n */\n showMemberCount?: boolean;\n /**\n * Whether to show the role badge.\n */\n showRole?: boolean;\n /**\n * Show organization name next to avatar in the trigger button\n */\n showTriggerLabel?: boolean;\n\n /**\n * Custom styles for the component.\n */\n style?: CSSProperties;\n}\n\n/**\n * BaseOrganizationSwitcher component displays an organization selector with a dropdown menu.\n * When clicked, it shows a popover with available organizations to switch between.\n * This component serves as the base for framework-specific implementations.\n */\nexport const BaseOrganizationSwitcher: FC<BaseOrganizationSwitcherProps> = ({\n organizations,\n currentOrganization,\n loading = false,\n error,\n onOrganizationSwitch,\n onManageProfile,\n className = '',\n style,\n renderOrganization,\n renderLoading,\n renderError,\n showRole = false,\n showMemberCount = true,\n menuItems = [],\n portalId = 'thunderid-organization-switcher',\n showTriggerLabel = true,\n avatarSize = 24,\n fallback = null,\n preferences,\n}: BaseOrganizationSwitcherProps): ReactElement => {\n const {theme, colorScheme, direction} = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const [isOpen, setIsOpen] = useState(false);\n const [hoveredItemIndex, setHoveredItemIndex] = useState<number | null>(null);\n const {t} = useTranslation(preferences?.i18n);\n const isRTL: boolean = direction === 'rtl';\n\n const {refs, floatingStyles, context} = useFloating({\n middleware: [offset(5), flip({fallbackAxisSideDirection: 'end'}), shift({padding: 5})],\n onOpenChange: setIsOpen,\n open: isOpen,\n placement: 'bottom-end',\n whileElementsMounted: autoUpdate,\n });\n\n const click: any = useClick(context);\n const dismiss: any = useDismiss(context);\n const role: any = useRole(context);\n\n const {getReferenceProps, getFloatingProps} = useInteractions([click, dismiss, role]);\n\n if (fallback && !currentOrganization && !loading && organizations.length === 0) {\n return fallback;\n }\n\n const handleOrganizationSwitch = (organization: Organization): void => {\n onOrganizationSwitch(organization);\n setIsOpen(false);\n };\n\n const handleMenuItemClick = (item: MenuItem): void => {\n if (item.onClick) {\n item.onClick();\n }\n setIsOpen(false);\n };\n\n // Filter out current organization from switchable list\n const switchableOrganizations: Organization[] = organizations.filter(\n (org: Organization): boolean => org.id !== currentOrganization?.id,\n );\n\n const defaultRenderOrganization = (organization: Organization, isSelected: boolean): ReactElement => (\n <>\n <Avatar\n variant=\"square\"\n imageUrl={organization.avatar}\n name={organization.name}\n size={avatarSize * 1.25}\n alt={`${organization.name} avatar`}\n />\n <div className={cx(styles['organizationInfo'])}>\n <Typography variant=\"body2\" fontWeight=\"medium\" className={cx(styles['organizationName'])}>\n {organization.name}\n </Typography>\n <div className={cx(styles['organizationMeta'])}>\n {showMemberCount && organization.memberCount !== undefined && (\n <span>\n {organization.memberCount}{' '}\n {organization.memberCount === 1 ? t('organization.switcher.member') : t('organization.switcher.members')}\n </span>\n )}\n {showRole && organization.role && showMemberCount && organization.memberCount !== undefined && (\n <span> • </span>\n )}\n {showRole && organization.role && <span className={cx(styles['roleCapitalized'])}>{organization.role}</span>}\n </div>\n </div>\n {isSelected && <Check width=\"16\" height=\"16\" color={theme.vars.colors.text.primary} />}\n </>\n );\n\n const defaultRenderLoading = (): ReactElement => (\n <div className={cx(styles['loadingContainer'])}>\n <Typography variant=\"caption\" className={cx(styles['loadingText'])}>\n {t('organization.switcher.loading.placeholder.organizations')}\n </Typography>\n </div>\n );\n\n const defaultRenderError = (errorMessage: string): ReactElement => (\n <div className={cx(styles['errorContainer'])}>\n <Typography variant=\"caption\" className={cx(styles['errorText'])}>\n {errorMessage}\n </Typography>\n </div>\n );\n\n return (\n <div className={cx(styles['root'], className)} style={style}>\n <Button\n ref={refs.setReference}\n className={cx(styles['trigger'])}\n color=\"tertiary\"\n variant=\"outline\"\n size=\"medium\"\n {...getReferenceProps()}\n >\n {currentOrganization ? (\n <>\n <Avatar\n variant=\"square\"\n imageUrl={currentOrganization.avatar}\n name={currentOrganization.name}\n size={avatarSize}\n alt={`${currentOrganization.name} avatar`}\n />\n {showTriggerLabel && (\n <Typography variant=\"body2\" className={cx(styles['triggerLabel'])}>\n {currentOrganization.name}\n </Typography>\n )}\n </>\n ) : (\n <>\n <Building width={avatarSize} height={avatarSize} />\n {showTriggerLabel && (\n <Typography variant=\"body2\" className={cx(styles['triggerLabel'])}>\n {t('elements.fields.organization.select.label')}\n </Typography>\n )}\n </>\n )}\n <span style={{display: 'inline-flex', transform: isRTL ? 'scaleX(-1)' : 'none'}}>\n <ChevronDown width=\"16\" height=\"16\" />\n </span>\n </Button>\n\n {isOpen && (\n <FloatingPortal id={portalId}>\n <FloatingFocusManager context={context} modal={false} initialFocus={-1}>\n <div\n ref={refs.setFloating}\n className={cx(styles['content'])}\n style={floatingStyles}\n {...getFloatingProps()}\n >\n {/* Header - Current Organization */}\n {currentOrganization && (\n <div className={cx(styles['header'])}>\n <Avatar\n variant=\"square\"\n imageUrl={currentOrganization.avatar}\n name={currentOrganization.name}\n size={avatarSize * 1.5}\n alt={`${currentOrganization.name} avatar`}\n />\n <div className={cx(styles['headerInfo'])}>\n <Typography noWrap className={cx(styles['headerName'])} variant=\"body1\" fontWeight=\"medium\">\n {currentOrganization.name}\n </Typography>\n <div className={cx(styles['headerMeta'])}>\n {showMemberCount && currentOrganization.memberCount !== undefined && (\n <Typography\n noWrap\n // ...existing code...\n variant=\"caption\"\n color=\"secondary\"\n >\n {currentOrganization.memberCount}{' '}\n {currentOrganization.memberCount === 1\n ? t('organization.switcher.member')\n : t('organization.switcher.members')}\n {showRole && currentOrganization.role && <span> • {currentOrganization.role}</span>}\n </Typography>\n )}\n {showRole &&\n currentOrganization.role &&\n (!showMemberCount || currentOrganization.memberCount === undefined) && (\n <Typography noWrap className={cx(styles['headerRole'])} variant=\"caption\" color=\"secondary\">\n {currentOrganization.role}\n </Typography>\n )}\n </div>\n </div>\n {onManageProfile && (\n <Button\n onClick={onManageProfile}\n color=\"tertiary\"\n variant=\"outline\"\n size=\"small\"\n aria-label=\"Manage Organization Profile\"\n className={cx(styles['manageButton'])}\n endIcon={\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n <path d=\"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1 1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z\" />\n </svg>\n }\n >\n {t('organization.switcher.buttons.manage.text')}\n </Button>\n )}\n </div>\n )}\n\n {/* Section Header for Other Organizations */}\n {organizations.length > 1 && (\n <div\n className={cx(styles['header'], styles['sectionHeaderContainer'])}\n style={{\n borderTop: currentOrganization ? `1px solid ${theme.vars.colors.border}` : 'none',\n }}\n >\n <Typography variant=\"caption\" fontWeight={600} className={cx(styles['sectionHeader'])}>\n {t('organization.switcher.switch.organization')}\n </Typography>\n </div>\n )}\n\n {/* Content */}\n <div className={cx(styles['menu'])}>\n {((): ReactElement => {\n if (loading) {\n return renderLoading ? renderLoading() : defaultRenderLoading();\n }\n if (error) {\n return renderError ? renderError(error) : defaultRenderError(error);\n }\n return (\n <>\n {switchableOrganizations.map((organization: Organization): ReactElement => {\n const isSelected = false; // Never selected since we exclude current org\n return (\n <Button\n key={organization.id}\n onClick={(): void => handleOrganizationSwitch(organization)}\n className={cx(styles['menuItem'])}\n color=\"tertiary\"\n variant=\"text\"\n size=\"small\"\n style={{\n backgroundColor:\n hoveredItemIndex === switchableOrganizations.indexOf(organization)\n ? theme.vars.colors.action?.hover\n : 'transparent',\n }}\n onMouseEnter={(): void =>\n setHoveredItemIndex(switchableOrganizations.indexOf(organization))\n }\n onMouseLeave={(): void => setHoveredItemIndex(null)}\n >\n {renderOrganization\n ? renderOrganization(organization, isSelected)\n : defaultRenderOrganization(organization, isSelected)}\n </Button>\n );\n })}\n\n {/* Menu Items */}\n {menuItems.length > 0 && (\n <>\n <div className={cx(styles['menuDivider'])} />\n {menuItems.map(\n (item: any, index: number): ReactElement => (\n <div key={index}>\n {item.href ? (\n <a\n href={item.href}\n style={{\n backgroundColor:\n hoveredItemIndex === switchableOrganizations.length + index\n ? theme.vars.colors.action?.hover\n : 'transparent',\n }}\n className={cx(styles['menuItem'])}\n onMouseEnter={(): void =>\n setHoveredItemIndex(switchableOrganizations.length + index)\n }\n onMouseLeave={(): void => setHoveredItemIndex(null)}\n onFocus={(): void => setHoveredItemIndex(switchableOrganizations.length + index)}\n onBlur={(): void => setHoveredItemIndex(null)}\n >\n {item.icon}\n <span>{item.label}</span>\n </a>\n ) : (\n <Button\n onClick={(): void => handleMenuItemClick(item)}\n style={{\n backgroundColor:\n hoveredItemIndex === switchableOrganizations.length + index\n ? theme.vars.colors.action?.hover\n : 'transparent',\n }}\n className={cx(styles['menuItem'])}\n color=\"tertiary\"\n variant=\"text\"\n size=\"small\"\n startIcon={item.icon}\n onMouseEnter={(): void =>\n setHoveredItemIndex(switchableOrganizations.length + index)\n }\n onMouseLeave={(): void => setHoveredItemIndex(null)}\n >\n {item.label}\n </Button>\n )}\n </div>\n ),\n )}\n </>\n )}\n </>\n );\n })()}\n </div>\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n )}\n </div>\n );\n};\n\nexport default BaseOrganizationSwitcher;\n","/**\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 {FC} from 'react';\n\nexport interface BuildingAltProps {\n /**\n * Color of the icon.\n */\n color?: string;\n /**\n * Height of the icon.\n */\n height?: number | string;\n /**\n * Width of the icon.\n */\n width?: number | string;\n}\n\n/**\n * Alternative Building Icon component.\n *\n * @param props - Props injected to the component.\n * @returns Alternative Building Icon component.\n */\nconst BuildingAlt: FC<BuildingAltProps> = ({height = 24, width = 24}: BuildingAltProps) => (\n <svg\n width={width}\n height={height}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z\" />\n <path d=\"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2\" />\n <path d=\"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2\" />\n <path d=\"M10 6h4\" />\n <path d=\"M10 10h4\" />\n <path d=\"M10 14h4\" />\n <path d=\"M10 18h4\" />\n </svg>\n);\n\nBuildingAlt.displayName = 'BuildingAlt';\n\nexport default BuildingAlt;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the BaseCreateOrganization component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(() => {\n const root: string = css`\n padding: calc(${theme.vars.spacing.unit} * 4);\n min-width: 600px;\n margin: 0 auto;\n font-family: ${theme.vars.typography.fontFamily};\n `;\n\n const card: string = css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n padding: calc(${theme.vars.spacing.unit} * 4);\n `;\n\n const content: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const form: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} * 2);\n width: 100%;\n `;\n\n const header: string = css`\n display: flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} * 1.5);\n margin-bottom: calc(${theme.vars.spacing.unit} * 1.5);\n `;\n\n const field: string = css`\n display: flex;\n align-items: center;\n padding: ${theme.vars.spacing.unit} 0;\n border-bottom: 1px solid ${theme.vars.colors.border};\n min-height: 32px;\n `;\n\n const fieldGroup: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} * 0.5);\n `;\n\n const textarea: string = css`\n width: 100%;\n padding: ${theme.vars.spacing.unit} calc(${theme.vars.spacing.unit} * 1.5);\n border: 1px solid ${theme.vars.colors.border};\n border-radius: ${theme.vars.borderRadius.medium};\n font-size: ${theme.vars.typography.fontSizes.md};\n color: ${theme.vars.colors.text.primary};\n background-color: ${theme.vars.colors.background.surface};\n font-family: ${theme.vars.typography.fontFamily};\n min-height: 80px;\n resize: vertical;\n outline: none;\n &:focus {\n border-color: ${theme.vars.colors.primary.main};\n box-shadow: 0 0 0 2px ${theme.vars.colors.primary.main}20;\n }\n &:disabled {\n background-color: ${theme.vars.colors.background.disabled};\n color: ${theme.vars.colors.text.secondary};\n cursor: not-allowed;\n }\n `;\n\n const textareaError: string = css`\n border-color: ${theme.vars.colors.error.main};\n `;\n\n const input: string = css``;\n\n const avatarContainer: string = css`\n align-items: flex-start;\n display: flex;\n gap: calc(${theme.vars.spacing.unit} * 2);\n margin-bottom: ${theme.vars.spacing.unit};\n `;\n\n const actions: string = css`\n display: flex;\n gap: ${theme.vars.spacing.unit};\n justify-content: flex-end;\n padding-top: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const infoContainer: string = css`\n display: flex;\n flex-direction: column;\n gap: ${theme.vars.spacing.unit};\n `;\n\n const value: string = css`\n color: ${theme.vars.colors.text.primary};\n flex: 1;\n display: flex;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n overflow: hidden;\n min-height: 32px;\n line-height: 32px;\n `;\n\n const popup: string = css`\n padding: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const errorAlert: string = css`\n margin-bottom: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n return {\n actions,\n avatarContainer,\n card,\n content,\n errorAlert,\n field,\n fieldGroup,\n form,\n header,\n infoContainer,\n input,\n popup,\n root,\n textarea,\n textareaError,\n value,\n };\n }, [\n theme.vars.spacing.unit,\n theme.vars.colors.background.surface,\n theme.vars.colors.border,\n theme.vars.borderRadius.large,\n theme.vars.borderRadius.medium,\n theme.vars.typography.fontSizes.md,\n theme.vars.colors.text.primary,\n theme.vars.colors.primary.main,\n theme.vars.colors.background.disabled,\n theme.vars.colors.text.secondary,\n theme.vars.colors.error.main,\n theme.vars.typography.fontFamily,\n colorScheme,\n ]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {CreateOrganizationPayload, createPackageComponentLogger, Preferences} from '@thunderid/browser';\nimport {ChangeEvent, CSSProperties, FC, FormEvent, ReactElement, ReactNode, useState} from 'react';\nimport useStyles from './BaseCreateOrganization.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport useTranslation from '../../../hooks/useTranslation';\nimport AlertPrimitive from '../../primitives/Alert/Alert';\nimport Button from '../../primitives/Button/Button';\nimport DialogPrimitive from '../../primitives/Dialog/Dialog';\nimport FormControl from '../../primitives/FormControl/FormControl';\nimport InputLabel from '../../primitives/InputLabel/InputLabel';\nimport TextField from '../../primitives/TextField/TextField';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'BaseCreateOrganization',\n);\n\n/**\n * Interface for organization form data.\n */\nexport interface OrganizationFormData {\n description: string;\n handle: string;\n name: string;\n}\n\n/**\n * Props interface for the BaseCreateOrganization component.\n */\nexport interface BaseCreateOrganizationProps {\n cardLayout?: boolean;\n className?: string;\n defaultParentId?: string;\n error?: string | null;\n initialValues?: Partial<OrganizationFormData>;\n loading?: boolean;\n mode?: 'inline' | 'popup';\n onCancel?: () => void;\n onOpenChange?: (open: boolean) => void;\n onSubmit?: (payload: CreateOrganizationPayload) => void | Promise<void>;\n onSuccess?: (organization: any) => void;\n open?: boolean;\n /**\n * Component-level preferences to override global i18n and theme settings.\n * Preferences are deep-merged with global ones, with component preferences\n * taking precedence. Affects this component and all its descendants.\n */\n preferences?: Preferences;\n renderAdditionalFields?: () => ReactNode;\n style?: CSSProperties;\n\n title?: string;\n}\n\n/**\n * Removes special characters except space and hyphen from the organization name\n * and generates a valid handle.\n * @param name\n * @returns\n */\nconst generateHandleFromName = (name: string): string =>\n name\n .toLowerCase()\n .replace(/[^a-z0-9\\s-]/g, '')\n .replace(/\\s+/g, '-')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '');\n\n/**\n * BaseCreateOrganization component provides the core functionality for creating organizations.\n * This component serves as the base for framework-specific implementations.\n */\nexport const BaseCreateOrganization: FC<BaseCreateOrganizationProps> = ({\n cardLayout = true,\n className = '',\n defaultParentId = '',\n error,\n initialValues = {},\n loading = false,\n mode = 'inline',\n onCancel,\n onOpenChange,\n onSubmit,\n onSuccess,\n open = false,\n preferences,\n renderAdditionalFields,\n style,\n title = 'Create Organization',\n}: BaseCreateOrganizationProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const styles: ReturnType<typeof useStyles> = useStyles(theme, colorScheme);\n const {t} = useTranslation(preferences?.i18n);\n const [formData, setFormData] = useState<OrganizationFormData>({\n description: '',\n handle: '',\n name: '',\n ...initialValues,\n });\n const [formErrors, setFormErrors] = useState<Partial<OrganizationFormData> & {avatar?: string}>({});\n\n const validateForm = (): boolean => {\n const errors: Partial<OrganizationFormData> = {};\n\n if (!formData.name.trim()) {\n errors.name = 'Organization name is required';\n }\n\n if (!formData.handle.trim()) {\n errors.handle = 'Organization handle is required';\n } else if (!/^[a-z0-9-]+$/.test(formData.handle)) {\n errors.handle = 'Handle can only contain lowercase letters, numbers, and hyphens';\n }\n\n if (!formData.description.trim()) {\n errors.description = 'Organization description is required';\n }\n\n setFormErrors(errors);\n return Object.keys(errors).length === 0;\n };\n\n const handleInputChange = (field: keyof OrganizationFormData, value: string): void => {\n setFormData((prev: OrganizationFormData) => ({\n ...prev,\n [field]: value,\n }));\n\n if (formErrors[field]) {\n setFormErrors((prev: Partial<OrganizationFormData> & {avatar?: string}) => ({\n ...prev,\n [field]: undefined,\n }));\n }\n };\n\n /**\n * Handles changes to the organization name input.\n * Automatically generates the organization handle based on the name if the handle is not set or matches\n *\n * @param value - The new value for the organization name.\n */\n const handleNameChange = (value: string): void => {\n handleInputChange('name', value);\n\n if (!formData.handle || formData.handle === generateHandleFromName(formData.name)) {\n const newHandle: string = generateHandleFromName(value);\n handleInputChange('handle', newHandle);\n }\n };\n\n const handleSubmit = async (e: FormEvent): Promise<void> => {\n e.preventDefault();\n\n if (!validateForm() || loading) {\n return;\n }\n\n const payload: CreateOrganizationPayload = {\n description: formData.description.trim(),\n name: formData.name.trim(),\n orgHandle: formData.handle.trim(),\n parentId: defaultParentId,\n type: 'TENANT',\n };\n\n try {\n await onSubmit?.(payload);\n if (onSuccess) {\n onSuccess(payload);\n }\n } catch (submitError) {\n // Error handling is done by parent component\n logger.error('Form submission error:');\n }\n };\n\n const createOrganizationContent: ReactElement = (\n <div className={cx(styles['root'], cardLayout && styles['card'], className)} style={style}>\n <div className={cx(styles['content'])}>\n <form id=\"create-organization-form\" className={cx(styles['form'])} onSubmit={handleSubmit}>\n {error && (\n <AlertPrimitive variant=\"error\" className={styles['errorAlert']}>\n <AlertPrimitive.Title>Error</AlertPrimitive.Title>\n <AlertPrimitive.Description>{error}</AlertPrimitive.Description>\n </AlertPrimitive>\n )}\n <div className={cx(styles['fieldGroup'])}>\n <TextField\n label={`${t('elements.fields.organization.name.label')}`}\n placeholder={t('elements.fields.organization.name.placeholder')}\n value={formData.name}\n onChange={(e: ChangeEvent<HTMLInputElement>): void => handleNameChange(e.target.value)}\n disabled={loading}\n required\n error={formErrors.name}\n className={cx(styles['input'])}\n />\n </div>\n <div className={cx(styles['fieldGroup'])}>\n <TextField\n label={`${t('elements.fields.organization.handle.label') || 'Organization Handle'}`}\n placeholder={t('elements.fields.organization.handle.placeholder') || 'my-organization'}\n value={formData.handle}\n onChange={(e: ChangeEvent<HTMLInputElement>): void => handleInputChange('handle', e.target.value)}\n disabled={loading}\n required\n error={formErrors.handle}\n helperText=\"This will be your organization's unique identifier. Only lowercase letters, numbers, and hyphens are allowed.\"\n className={cx(styles['input'])}\n />\n </div>\n <div className={cx(styles['fieldGroup'])}>\n <FormControl error={formErrors.description}>\n <InputLabel required>{t('elements.fields.organization.description.label')}</InputLabel>\n <textarea\n className={cx(styles['textarea'], formErrors.description && styles['textareaError'])}\n placeholder={t('organization.create.description.placeholder')}\n value={formData.description}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>): void =>\n handleInputChange('description', e.target.value)\n }\n disabled={loading}\n required\n />\n </FormControl>\n </div>\n {renderAdditionalFields && renderAdditionalFields()}\n </form>\n <div className={cx(styles['actions'])}>\n {onCancel && (\n <Button type=\"button\" variant=\"outline\" onClick={onCancel} disabled={loading}>\n {t('organization.create.buttons.cancel.text')}\n </Button>\n )}\n <Button type=\"submit\" variant=\"solid\" color=\"primary\" disabled={loading} form=\"create-organization-form\">\n {loading\n ? t('organization.create.buttons.create_organization.loading.text')\n : t('organization.create.buttons.create_organization.text')}\n </Button>\n </div>\n </div>\n </div>\n );\n\n if (mode === 'popup') {\n return (\n <DialogPrimitive open={open} onOpenChange={onOpenChange}>\n <DialogPrimitive.Content>\n <DialogPrimitive.Heading>{title}</DialogPrimitive.Heading>\n <div className={styles['popup']}>{createOrganizationContent}</div>\n </DialogPrimitive.Content>\n </DialogPrimitive>\n );\n }\n\n return createOrganizationContent;\n};\n\nexport default BaseCreateOrganization;\n","/**\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 Organization,\n HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n createOrganization as baseCreateOrganization,\n CreateOrganizationConfig as BaseCreateOrganizationConfig,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the createOrganization request (React-specific)\n */\nexport interface CreateOrganizationConfig extends Omit<BaseCreateOrganizationConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Creates a new organization.\n * This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.\n *\n * @param config - Configuration object containing baseUrl, payload and optional request config.\n * @returns A promise that resolves with the created organization information.\n * @example\n * ```typescript\n * // Using default ThunderID SPA client httpClient\n * try {\n * const organization = await createOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * payload: {\n * description: \"Share your screens\",\n * name: \"Team Viewer\",\n * orgHandle: \"team-viewer\",\n * parentId: \"f4825104-4948-40d9-ab65-a960eee3e3d5\",\n * type: \"TENANT\"\n * }\n * });\n * console.log(organization);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to create organization:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher\n * try {\n * const organization = await createOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * payload: {\n * description: \"Share your screens\",\n * name: \"Team Viewer\",\n * orgHandle: \"team-viewer\",\n * parentId: \"f4825104-4948-40d9-ab65-a960eee3e3d5\",\n * type: \"TENANT\"\n * },\n * fetcher: customFetchFunction\n * });\n * console.log(organization);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to create organization:', error.message);\n * }\n * }\n * ```\n */\nconst createOrganization = async ({\n fetcher,\n instanceId = 0,\n ...requestConfig\n}: CreateOrganizationConfig): Promise<Organization> => {\n const defaultFetcher = async (url: string, config: RequestInit): Promise<Response> => {\n const httpClient: FetchHttpClient = FetchHttpClient.getInstance(instanceId);\n const response: HttpResponse<any> = await httpClient.request({\n data: config.body ? JSON.parse(config.body as string) : undefined,\n headers: config.headers as Record<string, string>,\n method: config.method || 'POST',\n url,\n } as HttpRequestConfig);\n\n return {\n json: () => Promise.resolve(response.data),\n ok: response.status >= 200 && response.status < 300,\n status: response.status,\n statusText: response.statusText || '',\n text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data)),\n } as Response;\n };\n\n return baseCreateOrganization({\n ...requestConfig,\n fetcher: fetcher || defaultFetcher,\n });\n};\n\nexport default createOrganization;\n","/**\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 {CreateOrganizationPayload} from '@thunderid/browser';\nimport {FC, ReactElement, useState} from 'react';\nimport {BaseCreateOrganization, BaseCreateOrganizationProps} from './BaseCreateOrganization';\nimport createOrganization from '../../../api/createOrganization';\nimport useOrganization from '../../../contexts/Organization/useOrganization';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\n\n/**\n * Props interface for the CreateOrganization component.\n */\nexport interface CreateOrganizationProps extends Omit<BaseCreateOrganizationProps, 'onSubmit' | 'loading' | 'error'> {\n /**\n * Fallback element to render when the user is not signed in.\n */\n fallback?: ReactElement;\n /**\n * Custom organization creation handler (will use default API if not provided).\n */\n onCreateOrganization?: (payload: CreateOrganizationPayload) => Promise<any>;\n}\n\n/**\n * CreateOrganization component that provides organization creation functionality.\n * This component automatically integrates with the ThunderID and Organization contexts.\n *\n * @example\n * ```tsx\n * import { CreateOrganization } from '@thunderid/react';\n *\n * // Basic usage - uses default API and contexts\n * <CreateOrganization\n * onSuccess={(org) => console.log('Created:', org)}\n * onCancel={() => navigate('/organizations')}\n * />\n *\n * // With custom organization creation handler\n * <CreateOrganization\n * onCreateOrganization={async (payload) => {\n * const result = await myCustomAPI.createOrganization(payload);\n * return result;\n * }}\n * onSuccess={(org) => {\n * console.log('Organization created:', org.name);\n * // Custom success logic here\n * }}\n * />\n *\n * // With fallback for unauthenticated users\n * <CreateOrganization\n * fallback={<div>Please sign in to create an organization</div>}\n * />\n * ```\n */\nexport const CreateOrganization: FC<CreateOrganizationProps> = ({\n onCreateOrganization,\n fallback = null,\n onSuccess,\n defaultParentId,\n ...props\n}: CreateOrganizationProps): ReactElement => {\n const {isSignedIn, baseUrl, instanceId} = useThunderID();\n const {currentOrganization, revalidateMyOrganizations} = useOrganization();\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n if (!isSignedIn && fallback) {\n return fallback;\n }\n\n if (!isSignedIn) {\n return <></>;\n }\n\n // Use current organization as parent if no defaultParentId provided\n const parentId: string = defaultParentId || currentOrganization?.id || '';\n\n const handleSubmit = async (payload: CreateOrganizationPayload): Promise<void> => {\n setLoading(true);\n setError(null);\n\n try {\n let result: any;\n\n if (onCreateOrganization) {\n result = await onCreateOrganization(payload);\n } else {\n if (!baseUrl) {\n throw new Error('Base URL is required for organization creation');\n }\n\n result = await createOrganization({\n baseUrl,\n instanceId,\n payload: {\n ...payload,\n parentId,\n },\n });\n }\n\n await revalidateMyOrganizations();\n\n if (onSuccess) {\n onSuccess(result);\n }\n } catch (createError) {\n const errorMessage: string = createError instanceof Error ? createError.message : 'Failed to create organization';\n\n setError(errorMessage);\n\n throw createError;\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <BaseCreateOrganization\n onSubmit={handleSubmit}\n loading={loading}\n error={error}\n defaultParentId={parentId}\n onSuccess={onSuccess}\n {...props}\n />\n );\n};\n\nexport default CreateOrganization;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the BaseOrganizationList component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(() => {\n const root: string = css`\n padding: calc(${theme.vars.spacing.unit} * 4);\n min-width: 600px;\n margin: 0 auto;\n font-family: ${theme.vars.typography.fontFamily};\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n `;\n\n const header: string = css`\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: calc(${theme.vars.spacing.unit} * 3);\n padding-bottom: calc(${theme.vars.spacing.unit} * 2);\n border-bottom: 1px solid ${theme.vars.colors.border};\n `;\n\n const headerInfo: string = css`\n flex: 1;\n `;\n\n const title: string = css`\n font-size: 1.5rem;\n font-weight: 600;\n margin: 0 0 8px 0;\n color: ${theme.vars.colors.text.primary};\n `;\n\n const subtitle: string = css`\n color: ${theme.vars.colors.text.secondary};\n font-size: 0.875rem;\n margin: 0;\n `;\n\n const refreshButton: string = css`\n background-color: ${theme.vars.colors.background.surface};\n border: 1px solid ${theme.vars.colors.border};\n border-radius: ${theme.vars.borderRadius.small};\n color: ${theme.vars.colors.text.primary};\n cursor: pointer;\n font-size: 0.875rem;\n padding: ${theme.vars.spacing.unit} calc(${theme.vars.spacing.unit} * 2);\n transition: all 0.2s;\n &:hover {\n background-color: ${theme.vars.colors.background.surface};\n border-color: ${theme.vars.colors.primary.main};\n }\n `;\n\n const listContainer: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} * 1.5);\n `;\n\n const organizationItem: string = css`\n border: 1px solid ${theme.vars.colors.border};\n border-radius: ${theme.vars.borderRadius.medium};\n display: flex;\n justify-content: space-between;\n padding: calc(${theme.vars.spacing.unit} * 2);\n transition: all 0.2s;\n background-color: ${theme.vars.colors.background.surface};\n &:hover {\n border-color: ${theme.vars.colors.primary.main};\n box-shadow: 0 2px 8px ${theme.vars.colors.primary.main}20;\n }\n `;\n\n const organizationContent: string = css`\n display: flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} * 2);\n flex: 1;\n `;\n\n const organizationInfo: string = css`\n flex: 1;\n `;\n\n const organizationName: string = css`\n font-size: 1.125rem;\n font-weight: 600;\n margin: 0 0 4px 0;\n color: ${theme.vars.colors.text.primary};\n `;\n\n const organizationHandle: string = css`\n color: ${theme.vars.colors.text.secondary};\n font-size: 0.875rem;\n margin: 0 0 4px 0;\n font-family: monospace;\n `;\n\n const organizationStatus: string = css`\n color: ${theme.vars.colors.text.secondary};\n font-size: 0.875rem;\n margin: 0;\n `;\n\n const statusText: string = css`\n font-weight: 500;\n `;\n\n const statusTextActive: string = css`\n color: ${theme.vars.colors.success.main};\n `;\n\n const statusTextInactive: string = css`\n color: ${theme.vars.colors.error.main};\n `;\n\n const organizationActions: string = css`\n display: flex;\n align-items: center;\n `;\n\n const badge: string = css`\n border-radius: ${theme.vars.borderRadius.large};\n font-size: 0.75rem;\n font-weight: 500;\n padding: calc(${theme.vars.spacing.unit} / 2) calc(${theme.vars.spacing.unit} * 1.5);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n `;\n\n const badgeSuccess: string = css`\n background-color: color-mix(in srgb, ${theme.vars.colors.success.main} 20%, transparent);\n color: ${theme.vars.colors.success.main};\n `;\n\n const badgeError: string = css`\n background-color: color-mix(in srgb, ${theme.vars.colors.error.main} 20%, transparent);\n color: ${theme.vars.colors.error.main};\n `;\n\n const loadingContainer: string = css`\n padding: calc(${theme.vars.spacing.unit} * 4);\n text-align: center;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const loadingText: string = css`\n margin-top: ${theme.vars.spacing.unit};\n `;\n\n const errorContainer: string = css`\n background-color: color-mix(in srgb, ${theme.vars.colors.error.main} 20%, transparent);\n border: 1px solid ${theme.vars.colors.error.main};\n border-radius: ${theme.vars.borderRadius.medium};\n color: ${theme.vars.colors.error.main};\n padding: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const emptyContainer: string = css`\n padding: calc(${theme.vars.spacing.unit} * 4);\n text-align: center;\n `;\n\n const emptyText: string = css`\n color: ${theme.vars.colors.text.secondary};\n font-size: 1rem;\n `;\n\n const loadMoreButton: string = css`\n background-color: ${theme.vars.colors.primary.main};\n border: none;\n border-radius: ${theme.vars.borderRadius.medium};\n color: ${theme.vars.colors.primary.contrastText};\n cursor: pointer;\n font-size: 0.875rem;\n font-weight: 500;\n padding: calc(${theme.vars.spacing.unit} * 1.5) calc(${theme.vars.spacing.unit} * 3);\n width: 100%;\n transition: all 0.2s;\n &:hover:not(:disabled) {\n background-color: ${theme.vars.colors.primary.main};\n opacity: 0.9;\n }\n &:disabled {\n background-color: ${theme.vars.colors.text.secondary};\n cursor: not-allowed;\n opacity: 0.6;\n }\n `;\n\n const errorMargin: string = css`\n margin-top: calc(${theme.vars.spacing.unit} * 2);\n `;\n\n const loadMoreMargin: string = css`\n margin-top: calc(${theme.vars.spacing.unit} * 3);\n `;\n\n const popupContent: string = css`\n padding: ${theme.vars.spacing.unit};\n `;\n\n return {\n badge,\n badgeError,\n badgeSuccess,\n emptyContainer,\n emptyText,\n errorContainer,\n errorMargin,\n header,\n headerInfo,\n listContainer,\n loadMoreButton,\n loadMoreMargin,\n loadingContainer,\n loadingText,\n organizationActions,\n organizationContent,\n organizationHandle,\n organizationInfo,\n organizationItem,\n organizationName,\n organizationStatus,\n popupContent,\n refreshButton,\n root,\n statusText,\n statusTextActive,\n statusTextInactive,\n subtitle,\n title,\n };\n }, [\n theme.vars.spacing.unit,\n theme.vars.colors.background.surface,\n theme.vars.colors.border,\n theme.vars.borderRadius.large,\n theme.vars.borderRadius.medium,\n theme.vars.borderRadius.small,\n theme.vars.colors.text.primary,\n theme.vars.colors.text.secondary,\n theme.vars.colors.primary.main,\n theme.vars.colors.success.main,\n theme.vars.colors.error.main,\n theme.vars.colors.primary.contrastText,\n theme.vars.typography.fontFamily,\n colorScheme,\n ]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {AllOrganizationsApiResponse, Organization, Preferences} from '@thunderid/browser';\nimport {CSSProperties, FC, MouseEvent, ReactElement, ReactNode, useMemo} from 'react';\nimport useStyles from './BaseOrganizationList.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport useTranslation from '../../../hooks/useTranslation';\nimport {Avatar as AvatarPrimitive} from '../../primitives/Avatar/Avatar';\nimport Button from '../../primitives/Button/Button';\nimport DialogPrimitive from '../../primitives/Dialog/Dialog';\nimport Spinner from '../../primitives/Spinner/Spinner';\nimport Typography from '../../primitives/Typography/Typography';\n\nexport interface OrganizationWithSwitchAccess extends Organization {\n canSwitch: boolean;\n}\n\n/**\n * Props interface for the BaseOrganizationList component.\n */\nexport interface BaseOrganizationListProps {\n /**\n * List of organizations discoverable to the signed-in user.\n */\n allOrganizations: AllOrganizationsApiResponse;\n /**\n * Additional CSS class names to apply to the container\n */\n className?: string;\n /**\n * Error message to display\n */\n error?: string | null;\n /**\n * Function called when \"Load More\" is clicked\n */\n fetchMore?: () => Promise<void>;\n /**\n * Whether there are more organizations to load\n */\n hasMore?: boolean;\n /**\n * Whether the initial data is loading\n */\n isLoading?: boolean;\n /**\n * Whether more data is being loaded\n */\n isLoadingMore?: boolean;\n /**\n * Display mode: 'inline' for normal display, 'popup' for modal dialog\n */\n mode?: 'inline' | 'popup';\n /**\n * List of organizations associated to the signed-in user.\n */\n myOrganizations: Organization[];\n /**\n * Function called when popup open state changes (only used in popup mode)\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Function called when an organization is selected/clicked\n */\n onOrganizationSelect?: (organization: OrganizationWithSwitchAccess) => void;\n /**\n * Function called when refresh is requested\n */\n onRefresh?: () => Promise<void>;\n /**\n * Whether the popup is open (only used in popup mode)\n */\n open?: boolean;\n /**\n * Component-level preferences to override global i18n and theme settings.\n * Preferences are deep-merged with global ones, with component preferences\n * taking precedence. Affects this component and all its descendants.\n */\n preferences?: Preferences;\n /**\n * Custom renderer for when no organizations are found\n */\n renderEmpty?: () => ReactNode;\n /**\n * Custom renderer for the error state\n */\n renderError?: (error: string) => ReactNode;\n /**\n * Custom renderer for the load more button\n */\n renderLoadMore?: (onLoadMore: () => Promise<void>, isLoading: boolean) => ReactNode;\n /**\n * Custom renderer for the loading state\n */\n renderLoading?: () => ReactNode;\n /**\n * Custom renderer for each organization item\n */\n renderOrganization?: (organization: OrganizationWithSwitchAccess, index: number) => ReactNode;\n /**\n * Whether to show the organization status in the list\n */\n showStatus?: boolean;\n /**\n * Inline styles to apply to the container\n */\n style?: CSSProperties;\n\n /**\n * Title for the popup dialog (only used in popup mode)\n */\n title?: string;\n}\n\n/**\n * Default organization item renderer\n */\nconst defaultRenderOrganization = (\n organization: OrganizationWithSwitchAccess,\n styles: any,\n t: (key: string, params?: Record<string, string | number>) => string,\n onOrganizationSelect?: (organization: OrganizationWithSwitchAccess) => void,\n showStatus?: boolean,\n): ReactNode => (\n <div key={organization.id} className={cx(styles.organizationItem)}>\n <div className={cx(styles.organizationContent)}>\n <AvatarPrimitive variant=\"square\" name={organization.name} size={48} alt={`${organization.name} logo`} />\n <div className={cx(styles.organizationInfo)}>\n <Typography variant=\"h6\" className={cx(styles.organizationName)}>\n {organization.name}\n </Typography>\n <Typography variant=\"body2\" color=\"textSecondary\" className={cx(styles.organizationHandle)}>\n @{organization.orgHandle}\n </Typography>\n {showStatus && (\n <Typography variant=\"body2\" color=\"textSecondary\" className={cx(styles.organizationStatus)}>\n {t('organization.switcher.status.label')}{' '}\n <span\n className={cx(\n styles.statusText,\n organization.status === 'ACTIVE' ? styles.statusTextActive : styles.statusTextInactive,\n )}\n >\n {organization.status}\n </span>\n </Typography>\n )}\n </div>\n </div>\n {organization.canSwitch && (\n <div className={cx(styles.organizationActions)}>\n <Button\n onClick={(e: MouseEvent<HTMLButtonElement>): void => {\n e.stopPropagation();\n onOrganizationSelect(organization);\n }}\n type=\"button\"\n size=\"small\"\n >\n {t('organization.switcher.buttons.switch.text')}\n </Button>\n </div>\n )}\n </div>\n);\n\n/**\n * Default loading renderer\n */\nconst defaultRenderLoading = (\n t: (key: string, params?: Record<string, string | number>) => string,\n styles: any,\n): ReactNode => (\n <div className={cx(styles.loadingContainer)}>\n <Spinner size=\"medium\" />\n <Typography variant=\"body1\" color=\"textSecondary\" className={cx(styles.loadingText)}>\n {t('organization.switcher.loading.placeholder.organizations')}\n </Typography>\n </div>\n);\n\n/**\n * Default error renderer\n */\nconst defaultRenderError = (\n errorMessage: string,\n t: (key: string, params?: Record<string, string | number>) => string,\n styles: any,\n): ReactNode => (\n <div className={cx(styles.errorContainer)}>\n <Typography variant=\"body1\" color=\"error\">\n <strong>{t('organization.switcher.error.prefix')}</strong> {errorMessage}\n </Typography>\n </div>\n);\n\n/**\n * Default load more button renderer\n */\nconst defaultRenderLoadMore = (\n onLoadMore: () => Promise<void>,\n isLoadingMore: boolean,\n t: (key: string, params?: Record<string, string | number>) => string,\n styles: any,\n): ReactNode => (\n <Button onClick={onLoadMore} disabled={isLoadingMore} className={cx(styles.loadMoreButton)} type=\"button\" fullWidth>\n {isLoadingMore ? t('organization.switcher.loading.more') : t('organization.switcher.buttons.load_more.text')}\n </Button>\n);\n\n/**\n * Default empty state renderer\n */\nconst defaultRenderEmpty = (\n t: (key: string, params?: Record<string, string | number>) => string,\n styles: any,\n): ReactNode => (\n <div className={cx(styles.emptyContainer)}>\n <Typography variant=\"body1\" color=\"textSecondary\" className={cx(styles.emptyText)}>\n {t('organization.switcher.no.organizations')}\n </Typography>\n </div>\n);\n\n/**\n * BaseOrganizationList component displays a list of organizations with pagination support.\n * This component serves as the base for framework-specific implementations.\n *\n * @example\n * ```tsx\n * <BaseOrganizationList\n * data={organizations}\n * isLoading={isLoading}\n * hasMore={hasMore}\n * fetchMore={fetchMore}\n * error={error}\n * />\n * ```\n */\nexport const BaseOrganizationList: FC<BaseOrganizationListProps> = ({\n className = '',\n allOrganizations,\n myOrganizations,\n error,\n fetchMore,\n hasMore = false,\n isLoading = false,\n isLoadingMore = false,\n mode = 'inline',\n onOpenChange,\n onOrganizationSelect,\n onRefresh,\n open = false,\n renderEmpty,\n renderError,\n renderLoading,\n renderLoadMore,\n renderOrganization,\n style,\n title = 'Organizations',\n showStatus,\n preferences,\n}: BaseOrganizationListProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const styles: ReturnType<typeof useStyles> = useStyles(theme, colorScheme);\n const {t} = useTranslation(preferences?.i18n);\n\n const organizationsWithSwitchAccess: OrganizationWithSwitchAccess[] = useMemo(() => {\n if (!allOrganizations?.organizations) {\n return [];\n }\n\n const myOrgIds = new Set<string>(myOrganizations?.map((org: Organization) => org.id) || []);\n\n return allOrganizations.organizations.map((org: Organization) => ({\n ...org,\n canSwitch: myOrgIds.has(org.id),\n }));\n }, [allOrganizations?.organizations, myOrganizations]);\n\n const renderLoadingWithStyles: () => ReactNode = renderLoading || ((): ReactNode => defaultRenderLoading(t, styles));\n const renderErrorWithStyles: (errorMsg: string) => ReactNode =\n renderError || ((errorMsg: string): ReactNode => defaultRenderError(errorMsg, t, styles));\n const renderEmptyWithStyles: () => ReactNode = renderEmpty || ((): ReactNode => defaultRenderEmpty(t, styles));\n const renderLoadMoreWithStyles: (onLoadMore: () => Promise<void>, loadingMore: boolean) => ReactNode =\n renderLoadMore ||\n ((onLoadMore: () => Promise<void>, loadingMore: boolean): ReactNode =>\n defaultRenderLoadMore(onLoadMore, loadingMore, t, styles));\n const renderOrganizationWithStyles: (org: OrganizationWithSwitchAccess, index: number) => ReactNode =\n renderOrganization ||\n ((org: OrganizationWithSwitchAccess): ReactNode =>\n defaultRenderOrganization(org, styles, t, onOrganizationSelect, showStatus));\n\n if (isLoading && organizationsWithSwitchAccess?.length === 0) {\n const loadingContent: ReactElement = (\n <div className={cx(styles['root'], className)} style={style}>\n {renderLoadingWithStyles()}\n </div>\n );\n\n if (mode === 'popup') {\n return (\n <DialogPrimitive open={open} onOpenChange={onOpenChange}>\n <DialogPrimitive.Content>\n <DialogPrimitive.Heading>{title}</DialogPrimitive.Heading>\n <div className={cx(styles['popupContent'])}>{loadingContent}</div>\n </DialogPrimitive.Content>\n </DialogPrimitive>\n );\n }\n\n return loadingContent;\n }\n\n if (error && organizationsWithSwitchAccess?.length === 0) {\n const errorContent: ReactElement = (\n <div className={cx(styles['root'], className)} style={style}>\n {renderErrorWithStyles(error)}\n </div>\n );\n\n if (mode === 'popup') {\n return (\n <DialogPrimitive open={open} onOpenChange={onOpenChange}>\n <DialogPrimitive.Content>\n <DialogPrimitive.Heading>{title}</DialogPrimitive.Heading>\n <div className={cx(styles['popupContent'])}>{errorContent}</div>\n </DialogPrimitive.Content>\n </DialogPrimitive>\n );\n }\n\n return errorContent;\n }\n\n if (!isLoading && organizationsWithSwitchAccess?.length === 0) {\n const emptyContent: ReactElement = (\n <div className={cx(styles['root'], className)} style={style}>\n {renderEmptyWithStyles()}\n </div>\n );\n\n if (mode === 'popup') {\n return (\n <DialogPrimitive open={open} onOpenChange={onOpenChange}>\n <DialogPrimitive.Content>\n <DialogPrimitive.Heading>{title}</DialogPrimitive.Heading>\n <div className={cx(styles['popupContent'])}>{emptyContent}</div>\n </DialogPrimitive.Content>\n </DialogPrimitive>\n );\n }\n\n return emptyContent;\n }\n\n const organizationListContent: ReactElement = (\n <div className={cx(styles['root'], className)} style={style}>\n {/* Header with total count and refresh button */}\n <div className={cx(styles['header'])}>\n <div className={cx(styles['headerInfo'])}>\n <Typography variant=\"body2\" color=\"textSecondary\" className={cx(styles['subtitle'])}>\n {t('organization.switcher.showing.count', {\n showing: organizationsWithSwitchAccess?.length,\n total: allOrganizations?.organizations?.length || 0,\n })}\n </Typography>\n </div>\n {onRefresh && (\n <Button\n onClick={onRefresh}\n className={cx(styles['refreshButton'])}\n type=\"button\"\n variant=\"outline\"\n size=\"small\"\n >\n {t('organization.switcher.buttons.refresh.text')}\n </Button>\n )}\n </div>\n\n {/* Organizations list */}\n <div className={cx(styles['listContainer'])}>\n {organizationsWithSwitchAccess?.map((organization: OrganizationWithSwitchAccess, index: number) =>\n renderOrganizationWithStyles(organization, index),\n )}\n </div>\n\n {/* Error message for additional data */}\n {error && organizationsWithSwitchAccess?.length > 0 && (\n <div className={cx(styles['errorMargin'])}>{renderErrorWithStyles(error)}</div>\n )}\n\n {/* Load more button */}\n {hasMore && fetchMore && (\n <div className={cx(styles['loadMoreMargin'])}>{renderLoadMoreWithStyles(fetchMore, isLoadingMore)}</div>\n )}\n </div>\n );\n\n if (mode === 'popup') {\n return (\n <DialogPrimitive open={open} onOpenChange={onOpenChange}>\n <DialogPrimitive.Content>\n <DialogPrimitive.Heading>{title}</DialogPrimitive.Heading>\n <div className={cx(styles['popupContent'])}>{organizationListContent}</div>\n </DialogPrimitive.Content>\n </DialogPrimitive>\n );\n }\n\n return organizationListContent;\n};\n\nexport default BaseOrganizationList;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the OrganizationList component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(() => {\n const cssOrganizationListWrapper: string = css`\n /* Container wrapper styles for OrganizationList component */\n width: 100%;\n font-family: ${theme.vars.typography.fontFamily};\n\n &__container {\n position: relative;\n width: 100%;\n }\n\n &__error-state {\n padding: calc(${theme.vars.spacing.unit} * 2);\n background-color: color-mix(in srgb, ${theme.vars.colors.error.main} 10%, transparent);\n border: 1px solid ${theme.vars.colors.error.main};\n border-radius: ${theme.vars.borderRadius.medium};\n color: ${theme.vars.colors.error.main};\n text-align: center;\n }\n\n &__loading-overlay {\n position: absolute;\n inset: 0;\n background-color: color-mix(in srgb, ${theme.vars.colors.background.surface} 80%, transparent);\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: ${theme.vars.borderRadius.large};\n backdrop-filter: blur(2px);\n }\n `;\n\n return {\n container: css`\n position: relative;\n width: 100%;\n `,\n errorState: css`\n padding: calc(${theme.vars.spacing.unit} * 2);\n background-color: color-mix(in srgb, ${theme.vars.colors.error.main} 10%, transparent);\n border: 1px solid ${theme.vars.colors.error.main};\n border-radius: ${theme.vars.borderRadius.medium};\n color: ${theme.vars.colors.error.main};\n text-align: center;\n `,\n loadingOverlay: css`\n position: absolute;\n inset: 0;\n background-color: color-mix(in srgb, ${theme.vars.colors.background.surface} 80%, transparent);\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: ${theme.vars.borderRadius.large};\n backdrop-filter: blur(2px);\n `,\n root: cssOrganizationListWrapper,\n };\n }, [theme, colorScheme]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {AllOrganizationsApiResponse} from '@thunderid/browser';\nimport {FC, ReactElement, useEffect, useState} from 'react';\nimport {\n BaseOrganizationList as BaseOrganizationListComponent,\n BaseOrganizationListProps,\n OrganizationWithSwitchAccess,\n} from './BaseOrganizationList';\nimport useStyles from './OrganizationList.styles';\nimport useOrganization from '../../../contexts/Organization/useOrganization';\nimport useTheme from '../../../contexts/Theme/useTheme';\n\n/**\n * Configuration options for the OrganizationList component.\n */\nexport interface OrganizationListConfig {\n /**\n * Whether to automatically fetch organizations on mount\n */\n autoFetch?: boolean;\n /**\n * Filter string for organizations\n */\n filter?: string;\n /**\n * Number of organizations to fetch per page\n */\n limit?: number;\n /**\n * Whether to include recursive organizations\n */\n recursive?: boolean;\n}\n\n/**\n * Props interface for the OrganizationList component.\n * Uses the enhanced OrganizationContext instead of the useOrganizations hook.\n */\nexport interface OrganizationListProps\n extends Omit<\n BaseOrganizationListProps,\n 'myOrganizations' | 'allOrganizations' | 'error' | 'fetchMore' | 'hasMore' | 'isLoading' | 'isLoadingMore'\n >,\n OrganizationListConfig {\n /**\n * Function called when an organization is selected/clicked\n */\n onOrganizationSelect?: (organization: OrganizationWithSwitchAccess) => void;\n}\n\n/**\n * OrganizationList component that provides organization listing functionality with pagination.\n * This component uses the enhanced OrganizationContext, eliminating the polling issue and\n * providing better integration with the existing context system.\n *\n * @example\n * ```tsx\n * import { OrganizationList } from '@thunderid/react';\n *\n * // Basic usage\n * <OrganizationList />\n *\n * // With custom limit and filter\n * <OrganizationList\n * limit={20}\n * filter=\"active\"\n * onOrganizationSelect={(org) => {\n * console.log('Selected organization:', org.name);\n * }}\n * />\n *\n * // As a popup dialog\n * <OrganizationList\n * mode=\"popup\"\n * open={isOpen}\n * onOpenChange={setIsOpen}\n * title=\"Select Organization\"\n * />\n *\n * // With custom organization renderer\n * <OrganizationList\n * renderOrganization={(org) => (\n * <div key={org.id}>\n * <h3>{org.name}</h3>\n * <p>Can switch: {org.canSwitch ? 'Yes' : 'No'}</p>\n * </div>\n * )}\n * />\n * ```\n */\nexport const OrganizationList: FC<OrganizationListProps> = (props: OrganizationListProps): ReactElement => {\n const {onOrganizationSelect, className = '', style, ...baseProps} = props;\n const {autoFetch, filter, limit, recursive, ...filteredBaseProps} = baseProps;\n\n const {theme, colorScheme} = useTheme();\n const styles: ReturnType<typeof useStyles> = useStyles(theme, colorScheme);\n const {getAllOrganizations, error, isLoading, myOrganizations} = useOrganization();\n\n const [allOrganizations, setAllOrganizations] = useState<AllOrganizationsApiResponse>({\n organizations: [],\n });\n\n useEffect(() => {\n (async (): Promise<void> => {\n setAllOrganizations(await getAllOrganizations());\n })();\n }, []);\n\n return (\n <div className={cx(styles['root'], className)} style={style}>\n <div className={cx(styles['container'])}>\n <BaseOrganizationListComponent\n allOrganizations={allOrganizations}\n myOrganizations={myOrganizations}\n error={error}\n isLoading={isLoading}\n onOrganizationSelect={onOrganizationSelect}\n {...filteredBaseProps}\n />\n </div>\n </div>\n );\n};\n\nexport default OrganizationList;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the BaseOrganizationProfile component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(\n () => ({\n attributeItem: css`\n display: flex;\n gap: ${theme.vars.spacing.unit};\n padding: calc(${theme.vars.spacing.unit} / 4) 0;\n align-items: center;\n `,\n attributeKey: css`\n font-size: 0.75rem;\n font-weight: 500;\n color: ${theme.vars.colors.text.secondary};\n min-width: 80px;\n flex-shrink: 0;\n `,\n attributeValue: css`\n font-size: 0.75rem;\n color: ${theme.vars.colors.text.primary};\n word-break: break-word;\n flex: 1;\n `,\n attributesList: css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} / 4);\n `,\n card: css`\n background: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.large};\n `,\n editButton: css`\n min-width: auto;\n padding: calc(${theme.vars.spacing.unit} / 2);\n min-height: auto;\n `,\n field: css`\n display: flex;\n align-items: flex-start;\n padding: calc(${theme.vars.spacing.unit} / 2) 0;\n border-bottom: 1px solid ${theme.vars.colors.border};\n min-height: 28px;\n gap: ${theme.vars.spacing.unit};\n `,\n fieldActions: css`\n display: flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} / 2);\n `,\n fieldContent: css`\n flex: 1;\n display: flex;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n `,\n fieldInput: css`\n margin-bottom: 0;\n `,\n fieldLast: css`\n border-bottom: none;\n `,\n handle: css`\n font-size: 1rem;\n color: ${theme.vars.colors.text.secondary};\n margin: 0;\n font-family: monospace;\n `,\n header: css`\n display: flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} * 2);\n margin-bottom: calc(${theme.vars.spacing.unit} * 3);\n padding-bottom: calc(${theme.vars.spacing.unit} * 2);\n `,\n infoContainer: css`\n display: flex;\n flex-direction: column;\n gap: ${theme.vars.spacing.unit};\n `,\n label: css`\n font-size: 0.875rem;\n font-weight: 500;\n color: ${theme.vars.colors.text.secondary};\n width: 120px;\n flex-shrink: 0;\n line-height: 28px;\n `,\n name: css`\n font-size: 1.5rem;\n font-weight: 600;\n margin: 0 0 8px 0;\n color: ${theme.vars.colors.text.primary};\n `,\n orgInfo: css`\n flex: 1;\n `,\n permissionBadge: css`\n padding: calc(${theme.vars.spacing.unit} / 4) ${theme.vars.spacing.unit};\n border-radius: ${theme.vars.borderRadius.small};\n font-size: 0.75rem;\n background-color: ${theme.vars.colors.primary.main};\n color: ${theme.vars.colors.primary.contrastText};\n border: 1px solid ${theme.vars.colors.border};\n `,\n permissionsList: css`\n display: flex;\n flex-wrap: wrap;\n gap: calc(${theme.vars.spacing.unit} / 2);\n `,\n placeholderButton: css`\n font-style: italic;\n text-decoration: underline;\n opacity: 0.7;\n padding: 0;\n min-height: auto;\n `,\n popup: css`\n padding: calc(${theme.vars.spacing.unit} * 2);\n `,\n root: css`\n padding: calc(${theme.vars.spacing.unit} * 4);\n min-width: 600px;\n margin: 0 auto;\n font-family: ${theme.vars.typography.fontFamily};\n `,\n statusBadge: css`\n padding: calc(${theme.vars.spacing.unit} / 2) ${theme.vars.spacing.unit};\n border-radius: ${theme.vars.borderRadius.small};\n font-size: 0.75rem;\n font-weight: 500;\n color: white;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n `,\n value: css`\n color: ${theme.vars.colors.text.primary};\n flex: 1;\n display: flex;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n overflow: hidden;\n min-height: 28px;\n line-height: 28px;\n word-break: break-word;\n `,\n valueEmpty: css`\n font-style: italic;\n opacity: 0.7;\n `,\n }),\n [theme, colorScheme],\n );\n\nexport default useStyles;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\n/**\n * Creates styles for the KeyValueInput component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param disabled - Whether the component is disabled\n * @param readOnly - Whether the component is read-only\n * @param hasError - Whether the component has an error\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n disabled: boolean,\n readOnly: boolean,\n hasError: boolean,\n): Record<string, string> =>\n useMemo(() => {\n const container: string = css`\n display: flex;\n flex-direction: column;\n font-family: ${theme.vars.typography.fontFamily};\n gap: calc(${theme.vars.spacing.unit} / 2);\n `;\n\n const label: string = css`\n font-size: 0.875rem;\n font-weight: 500;\n color: ${theme.vars.colors.text.primary};\n margin-bottom: calc(${theme.vars.spacing.unit} / 2);\n `;\n\n const requiredIndicator: string = css`\n color: ${theme.vars.colors.error.main};\n `;\n\n const pairsList: string = css`\n display: flex;\n flex-direction: column;\n gap: calc(${theme.vars.spacing.unit} / 4);\n `;\n\n const pairRow: string = css`\n display: flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} / 2);\n padding: calc(${theme.vars.spacing.unit} / 2);\n border-radius: ${theme.vars.borderRadius.small};\n background-color: transparent;\n border: none;\n\n &:hover {\n background-color: ${theme.vars.colors.action.hover};\n }\n `;\n\n const pairInput: string = css`\n flex: 1;\n min-width: 0;\n `;\n\n const addRow: string = css`\n display: flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} / 2);\n padding: calc(${theme.vars.spacing.unit} / 2);\n border: none;\n border-radius: ${theme.vars.borderRadius.small};\n background-color: transparent;\n margin-top: calc(${theme.vars.spacing.unit} / 2);\n `;\n\n const removeButton: string = css`\n min-width: auto;\n width: 24px;\n height: 24px;\n padding: 0;\n background-color: transparent;\n color: ${theme.vars.colors.text.secondary};\n border: none;\n border-radius: ${theme.vars.borderRadius.small};\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: ${disabled ? 'not-allowed' : 'pointer'};\n\n &:hover:not(:disabled) {\n background-color: ${theme.vars.colors.action.hover};\n color: ${theme.vars.colors.error.main};\n }\n\n &:disabled {\n opacity: 0.6;\n }\n `;\n\n const addButton: string = css`\n min-width: auto;\n width: 24px;\n height: 24px;\n padding: 0;\n background-color: transparent;\n color: ${theme.vars.colors.primary.main};\n border: none;\n border-radius: ${theme.vars.borderRadius.small};\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: ${disabled ? 'not-allowed' : 'pointer'};\n\n &:hover:not(:disabled) {\n background-color: ${theme.vars.colors.primary.main};\n color: ${theme.vars.colors.primary.contrastText};\n }\n\n &:disabled {\n opacity: 0.6;\n }\n `;\n\n const helperText: string = css`\n font-size: 0.75rem;\n color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.text.secondary};\n margin-top: calc(${theme.vars.spacing.unit} / 2);\n `;\n\n const emptyState: string = css`\n padding: ${theme.vars.spacing.unit};\n text-align: center;\n color: ${theme.vars.colors.text.secondary};\n font-style: italic;\n font-size: 0.75rem;\n `;\n\n const readOnlyPair: string = css`\n display: flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} / 2);\n padding: calc(${theme.vars.spacing.unit} / 4) 0;\n min-height: 20px;\n `;\n\n const readOnlyKey: string = css`\n font-size: 0.75rem;\n font-weight: 500;\n color: ${theme.vars.colors.text.secondary};\n min-width: 80px;\n flex-shrink: 0;\n `;\n\n const readOnlyValue: string = css`\n font-size: 0.75rem;\n color: ${theme.vars.colors.text.primary};\n word-break: break-word;\n flex: 1;\n `;\n\n const counterText: string = css`\n font-size: 0.75rem;\n color: ${theme.vars.colors.text.secondary};\n margin-top: calc(${theme.vars.spacing.unit} / 2);\n `;\n\n return {\n addButton,\n addRow,\n container,\n counterText,\n emptyState,\n helperText,\n label,\n pairInput,\n pairRow,\n pairsList,\n readOnlyKey,\n readOnlyPair,\n readOnlyValue,\n removeButton,\n requiredIndicator,\n };\n }, [theme, colorScheme, disabled, readOnly, hasError]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {ChangeEvent, FC, KeyboardEvent, MouseEventHandler, ReactElement, useState, useCallback} from 'react';\nimport useStyles from './KeyValueInput.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport {Plus, X} from '../Icons';\nimport TextField from '../TextField/TextField';\n\nexport interface KeyValuePair {\n key: string;\n value: string;\n}\n\nexport interface KeyValueInputProps {\n /**\n * CSS class name for styling the component.\n */\n className?: string;\n\n /**\n * Whether the input is disabled.\n */\n disabled?: boolean;\n\n /**\n * Error message to display.\n */\n error?: string;\n\n /**\n * Help text to display below the input.\n */\n helperText?: string;\n\n /**\n * Label for the key input field.\n */\n keyLabel?: string;\n\n /**\n * Placeholder text for the key input field.\n */\n keyPlaceholder?: string;\n\n /**\n * Label for the component.\n */\n label?: string;\n\n /**\n * Maximum number of key-value pairs allowed.\n */\n maxPairs?: number;\n /**\n * Callback fired when a pair is added.\n */\n onAdd?: (pair: KeyValuePair) => void;\n\n /**\n * Callback fired when the key-value pairs change.\n */\n onChange?: (pairs: KeyValuePair[]) => void;\n\n /**\n * Callback fired when a pair is removed.\n */\n onRemove?: (pair: KeyValuePair, index: number) => void;\n\n /**\n * Whether the component is in read-only mode.\n */\n readOnly?: boolean;\n\n /**\n * Text for the remove button.\n */\n removeButtonText?: string;\n\n /**\n * Whether the component is required.\n */\n required?: boolean;\n\n /**\n * Current key-value pairs.\n */\n value?: Record<string, any> | KeyValuePair[];\n\n /**\n * Label for the value input field.\n */\n valueLabel?: string;\n\n /**\n * Placeholder text for the value input field.\n */\n valuePlaceholder?: string;\n}\n\n/**\n * KeyValueInput component allows users to manage key-value pairs with add/remove functionality.\n * It provides a user-friendly interface for editing organization attributes or similar data structures.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <KeyValueInput\n * label=\"Organization Attributes\"\n * onChange={(pairs) => console.log(pairs)}\n * />\n *\n * // With initial values\n * <KeyValueInput\n * label=\"Organization Attributes\"\n * value={{department: 'IT', location: 'New York'}}\n * onChange={(pairs) => console.log(pairs)}\n * />\n *\n * // With add/remove callbacks\n * <KeyValueInput\n * label=\"Custom Attributes\"\n * value={attributes}\n * onChange={(pairs) => setAttributes(pairs)}\n * onAdd={(pair) => console.log('Added:', pair)}\n * onRemove={(pair, index) => console.log('Removed:', pair, 'at index:', index)}\n * />\n * ```\n */\nconst KeyValueInput: FC<KeyValueInputProps> = ({\n className = '',\n disabled = false,\n error,\n helperText,\n keyLabel = 'Key',\n keyPlaceholder = 'Enter key',\n label,\n maxPairs,\n onChange,\n onAdd,\n onRemove,\n readOnly = false,\n removeButtonText = 'Remove',\n required = false,\n value = {},\n valueLabel = 'Value',\n valuePlaceholder = 'Enter value',\n}: KeyValueInputProps): ReactElement => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, disabled, readOnly, !!error);\n\n // Convert value to array format\n const initialPairs: KeyValuePair[] = Array.isArray(value)\n ? value\n : Object.entries(value).map(([key, val]: [string, any]) => ({key, value: String(val)}));\n\n const [pairs, setPairs] = useState<KeyValuePair[]>(initialPairs);\n const [newKey, setNewKey] = useState('');\n const [newValue, setNewValue] = useState('');\n\n const handleAddPair: ReturnType<typeof useCallback> = useCallback(() => {\n if (!newKey.trim() || !newValue.trim()) return;\n if (maxPairs && pairs.length >= maxPairs) return;\n\n const newPair: KeyValuePair = {\n key: newKey.trim(),\n value: newValue.trim(),\n };\n\n const updatedPairs: KeyValuePair[] = [...pairs, newPair];\n setPairs(updatedPairs);\n setNewKey('');\n setNewValue('');\n\n if (onChange) {\n onChange(updatedPairs);\n }\n\n if (onAdd) {\n onAdd(newPair);\n }\n }, [newKey, newValue, pairs, maxPairs, onChange, onAdd]);\n\n const handleRemovePair: ReturnType<typeof useCallback> = useCallback(\n (index: number) => {\n const pairToRemove: KeyValuePair = pairs[index];\n const updatedPairs: KeyValuePair[] = pairs.filter((_: KeyValuePair, i: number) => i !== index);\n setPairs(updatedPairs);\n\n if (onChange) {\n onChange(updatedPairs);\n }\n\n if (onRemove) {\n onRemove(pairToRemove, index);\n }\n },\n [pairs, onChange, onRemove],\n );\n\n const handleUpdatePair: ReturnType<typeof useCallback> = useCallback(\n (index: number, field: 'key' | 'value', newVal: string) => {\n const updatedPairs: KeyValuePair[] = pairs.map((pair: KeyValuePair, i: number) => {\n if (i === index) {\n return {...pair, [field]: newVal};\n }\n return pair;\n });\n setPairs(updatedPairs);\n\n if (onChange) {\n onChange(updatedPairs);\n }\n },\n [pairs, onChange],\n );\n\n const canAddMore: boolean = !maxPairs || pairs.length < maxPairs;\n const isAddDisabled: boolean = disabled || readOnly || !canAddMore || !newKey.trim() || !newValue.trim();\n\n const renderReadOnlyContent = (): ReactElement | ReactElement[] => {\n if (pairs.length === 0) {\n return (\n <div className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'empty-state')), styles['emptyState'])}>\n No attributes defined\n </div>\n );\n }\n\n return pairs.map((pair: KeyValuePair, index: number) => (\n <div\n key={`${pair.key}-${index}`}\n className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'readonly-pair')), styles['readOnlyPair'])}\n >\n <span className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'readonly-key')), styles['readOnlyKey'])}>\n {pair.key}:\n </span>\n <span\n className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'readonly-value')), styles['readOnlyValue'])}\n >\n {pair.value}\n </span>\n </div>\n ));\n };\n\n return (\n <div className={cx(withVendorCSSClassPrefix(bem('key-value-input')), styles['container'], className)}>\n {label && (\n <label className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'label')), styles['label'])}>\n {label}\n {required && (\n <span\n className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'required')), styles['requiredIndicator'])}\n >\n {' *'}\n </span>\n )}\n </label>\n )}\n\n <div className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'pairs-list')), styles['pairsList'])}>\n {readOnly\n ? renderReadOnlyContent()\n : pairs.map((pair: KeyValuePair, index: number) => (\n <div\n key={`${pair.key}-${index}`}\n className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'pair-row')), styles['pairRow'])}\n >\n <TextField\n placeholder={keyPlaceholder}\n value={pair.key}\n onChange={(e: ChangeEvent<HTMLInputElement>): void => handleUpdatePair(index, 'key', e.target.value)}\n disabled={disabled || readOnly}\n className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'pair-input')), styles['pairInput'])}\n aria-label={`${keyLabel} ${index + 1}`}\n />\n <TextField\n placeholder={valuePlaceholder}\n value={pair.value}\n onChange={(e: ChangeEvent<HTMLInputElement>): void =>\n handleUpdatePair(index, 'value', e.target.value)\n }\n disabled={disabled || readOnly}\n className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'pair-input')), styles['pairInput'])}\n aria-label={`${valueLabel} ${index + 1}`}\n />\n {!readOnly && (\n <button\n type=\"button\"\n onClick={(): void => handleRemovePair(index)}\n disabled={disabled}\n className={cx(\n withVendorCSSClassPrefix(bem('key-value-input', 'remove-button')),\n styles['removeButton'],\n )}\n aria-label={`${removeButtonText} ${pair.key}`}\n >\n <X width={16} height={16} />\n </button>\n )}\n </div>\n ))}\n\n {!readOnly && (\n <div className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'add-row')), styles['addRow'])}>\n <TextField\n placeholder={keyPlaceholder}\n value={newKey}\n onChange={(e: ChangeEvent<HTMLInputElement>): void => setNewKey(e.target.value)}\n disabled={disabled}\n className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'pair-input')), styles['pairInput'])}\n aria-label=\"New key\"\n />\n <TextField\n placeholder={valuePlaceholder}\n value={newValue}\n onChange={(e: ChangeEvent<HTMLInputElement>): void => setNewValue(e.target.value)}\n disabled={disabled}\n className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'pair-input')), styles['pairInput'])}\n aria-label=\"New value\"\n onKeyPress={(e: KeyboardEvent<HTMLInputElement>): void => {\n if (e.key === 'Enter' && !isAddDisabled) {\n handleAddPair();\n }\n }}\n />\n <button\n type=\"button\"\n onClick={handleAddPair as MouseEventHandler<HTMLButtonElement>}\n disabled={isAddDisabled}\n className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'add-button')), styles['addButton'])}\n aria-label=\"Add new key-value pair\"\n >\n <Plus width={16} height={16} />\n </button>\n </div>\n )}\n </div>\n\n {(helperText || error) && (\n <div className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'helper-text')), styles['helperText'])}>\n {error || helperText}\n </div>\n )}\n\n {maxPairs && (\n <div className={cx(withVendorCSSClassPrefix(bem('key-value-input', 'counter')), styles['counterText'])}>\n {pairs.length} of {maxPairs} pairs used\n </div>\n )}\n </div>\n );\n};\n\nexport default KeyValueInput;\n","/**\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 {cx} from '@emotion/css';\nimport {OrganizationDetails, formatDate, Preferences} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useState, useCallback} from 'react';\nimport useStyles from './BaseOrganizationProfile.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport {Avatar} from '../../primitives/Avatar/Avatar';\nimport Button from '../../primitives/Button/Button';\nimport CardPrimitive from '../../primitives/Card/Card';\nimport DialogPrimitive from '../../primitives/Dialog/Dialog';\nimport KeyValueInput from '../../primitives/KeyValueInput/KeyValueInput';\nimport TextField from '../../primitives/TextField/TextField';\n\nexport interface BaseOrganizationProfileProps {\n /**\n * Callback fired when the cancel button is clicked (only used in editable mode).\n */\n cancelButtonText?: string;\n\n /**\n * Whether to display the profile in a card layout.\n */\n cardLayout?: boolean;\n\n /**\n * CSS class name for styling the component.\n */\n className?: string;\n\n /**\n * Whether the organization profile is editable.\n */\n editable?: boolean;\n\n /**\n * Component to render when no organization data is available.\n */\n fallback?: ReactElement;\n\n /**\n * Array of field configurations to display. Each field specifies what organization data to show.\n */\n fields?: {\n editable?: boolean;\n key: keyof OrganizationDetails | 'attributes';\n label: string;\n render?: (value: any, organization: OrganizationDetails) => ReactNode;\n }[];\n\n /**\n * Display mode for the component.\n */\n mode?: 'inline' | 'popup';\n\n /**\n * Callback fired when a field value changes.\n */\n onChange?: (field: string, value: any) => void;\n\n /**\n * Callback fired when the popup should be closed (only used in popup mode).\n */\n onOpenChange?: (open: boolean) => void;\n\n /**\n * Callback fired when the form is submitted (only used in editable mode).\n */\n onSubmit?: (data: any) => void;\n\n /**\n * Callback fired when the organization should be updated.\n */\n onUpdate?: (payload: any) => Promise<void>;\n\n /**\n * Whether the popup is open (only used in popup mode).\n */\n open?: boolean;\n\n /**\n * The organization details to display.\n */\n organization?: OrganizationDetails | null;\n\n /**\n * Component-level preferences to override global i18n and theme settings.\n * Preferences are deep-merged with global ones, with component preferences\n * taking precedence. Affects this component and all its descendants.\n */\n preferences?: Preferences;\n\n /**\n * Text for the save button (only used in editable mode).\n */\n saveButtonText?: string;\n\n /**\n * Custom title for the profile.\n */\n title?: string;\n}\n\n/**\n * BaseOrganizationProfile component displays organization information in a\n * structured and styled format. It shows organization details such as name,\n * description, status, and other available information with support for inline editing.\n *\n * This is the base component that can be used in any context where you have\n * an organization object available. It provides editing capabilities similar to\n * the UserProfile component, allowing users to modify organization fields directly.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <BaseOrganizationProfile organization={organizationData} />\n *\n * // With editing enabled and update handler\n * <BaseOrganizationProfile\n * organization={organizationData}\n * editable={true}\n * onUpdate={async (payload) => {\n * await updateOrganizationAPI(orgId, payload);\n * }}\n * />\n *\n * // With card layout and custom title\n * <BaseOrganizationProfile\n * organization={organizationData}\n * cardLayout={true}\n * title=\"Organization Details\"\n * fallback={<div>No organization data available</div>}\n * />\n *\n * // With custom fields configuration\n * <BaseOrganizationProfile\n * organization={organizationData}\n * fields={[\n * { key: 'id', label: 'Organization ID', editable: false },\n * { key: 'name', label: 'Organization Name', editable: true },\n * { key: 'description', label: 'Description', editable: true, render: (value) => value || 'No description' },\n * { key: 'created', label: 'Created Date', editable: false, render: (value) => new Date(value).toLocaleDateString() },\n * { key: 'attributes', label: 'Custom Attributes', editable: true }\n * ]}\n * onUpdate={handleUpdate}\n * />\n *\n * // In popup mode\n * <BaseOrganizationProfile\n * organization={organizationData}\n * mode=\"popup\"\n * open={isOpen}\n * onOpenChange={setIsOpen}\n * title=\"Edit Organization\"\n * />\n * ```\n * <BaseOrganizationProfile\n * organization={organizationData}\n * fields={[\n * { key: 'id', label: 'Organization ID' },\n * { key: 'name', label: 'Organization Name' },\n * { key: 'description', label: 'Description', render: (value) => value || 'No description' },\n * { key: 'created', label: 'Created Date', render: (value) => new Date(value).toLocaleDateString() },\n * { key: 'attributes', label: 'Custom Attributes' }\n * ]}\n * />\n * ```\n */\nconst BaseOrganizationProfile: FC<BaseOrganizationProfileProps> = ({\n fallback = null,\n className = '',\n cardLayout = true,\n organization,\n title = 'Organization Profile',\n mode = 'inline',\n editable = true,\n onOpenChange,\n onUpdate,\n open = false,\n saveButtonText = 'Save Changes',\n cancelButtonText = 'Cancel',\n fields = [\n {\n editable: false,\n key: 'id',\n label: 'Organization ID',\n },\n {\n editable: true,\n key: 'name',\n label: 'Organization Name',\n },\n {\n editable: true,\n key: 'description',\n label: 'Organization Description',\n render: (value: any): any => value || '-',\n },\n {\n editable: false,\n key: 'created',\n label: 'Created Date',\n render: (value: any): any => formatDate(value),\n },\n {\n editable: false,\n key: 'lastModified',\n label: 'Last Modified Date',\n render: (value: any): any => formatDate(value),\n },\n ],\n}: BaseOrganizationProfileProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const [editedOrganization, setEditedOrganization] = useState(organization);\n const [editingFields, setEditingFields] = useState<Record<string, boolean>>({});\n\n const PencilIcon = (): ReactElement => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z\" />\n </svg>\n );\n\n const toggleFieldEdit: (fieldName: string) => void = useCallback((fieldName: string) => {\n setEditingFields((prev: Record<string, boolean>) => ({\n ...prev,\n [fieldName]: !prev[fieldName],\n }));\n }, []);\n\n const getFieldPlaceholder: (fieldKey: string) => string = useCallback((fieldKey: string): string => {\n const fieldLabels: Record<string, string> = {\n description: 'organization description',\n name: 'organization name',\n orgHandle: 'organization handle',\n status: 'organization status',\n type: 'organization type',\n };\n\n const fieldLabel: string = fieldLabels[fieldKey] || fieldKey.toLowerCase();\n return `Enter ${fieldLabel}`;\n }, []);\n\n const handleFieldSave: (fieldKey: string) => void = useCallback(\n (fieldKey: string): void => {\n if (!onUpdate || !fieldKey) return;\n\n let fieldValue: any;\n if (editedOrganization && fieldKey && editedOrganization[fieldKey as keyof OrganizationDetails] !== undefined) {\n fieldValue = editedOrganization[fieldKey as keyof OrganizationDetails];\n } else if (organization?.[fieldKey as keyof OrganizationDetails] !== undefined) {\n fieldValue = organization[fieldKey as keyof OrganizationDetails];\n } else {\n fieldValue = '';\n }\n\n const payload: Record<string, any> = {\n [fieldKey]: fieldValue,\n };\n\n onUpdate(payload);\n toggleFieldEdit(fieldKey);\n },\n [editedOrganization, organization, onUpdate, toggleFieldEdit],\n );\n\n const handleFieldCancel: (fieldKey: string) => void = useCallback(\n (fieldKey: string) => {\n setEditedOrganization((prev: any) => ({\n ...prev,\n [fieldKey]: organization?.[fieldKey as keyof OrganizationDetails],\n }));\n toggleFieldEdit(fieldKey);\n },\n [organization, toggleFieldEdit],\n );\n\n const getOrgInitials = (name?: string): string => {\n if (!name) return 'ORG';\n return name\n .split(' ')\n .map((word: string) => word.charAt(0))\n .join('')\n .toUpperCase()\n .slice(0, 2);\n };\n\n const renderField = (\n field: any,\n isEditing: boolean,\n onEditValue?: (value: any) => void,\n onStartEdit?: () => void,\n ): ReactElement | null => {\n if (!field) return null;\n\n const {key, label, editable: fieldEditable = true} = field;\n const value: any =\n key === 'attributes' ? organization?.attributes || {} : organization?.[key as keyof OrganizationDetails];\n\n const renderedValue: any = field.render ? field.render(value, organization) : value;\n\n if (isEditing && onEditValue && fieldEditable && editable) {\n const fieldValue: any =\n editedOrganization && key && editedOrganization[key as keyof OrganizationDetails] !== undefined\n ? editedOrganization[key as keyof OrganizationDetails]\n : value || '';\n\n const commonProps: any = {\n className: cx(styles['fieldInput']),\n label: undefined,\n onChange: (e: any): void => onEditValue(e.target ? e.target.value : e),\n placeholder: getFieldPlaceholder(key),\n value: typeof fieldValue === 'object' ? JSON.stringify(fieldValue) : String(fieldValue || ''),\n };\n\n let fieldInput: ReactElement;\n\n if (key === 'attributes') {\n const attributesValue: any = typeof fieldValue === 'object' && fieldValue !== null ? fieldValue : {};\n fieldInput = (\n <KeyValueInput\n value={attributesValue}\n onChange={(pairs: any): void => {\n const attributesObject: Record<string, any> = pairs.reduce(\n (acc: any, pair: any) => {\n acc[pair.key] = pair.value;\n return acc;\n },\n {} as Record<string, any>,\n );\n onEditValue(attributesObject);\n }}\n onAdd={(pair: any): void => {\n if (onUpdate) {\n const operation: any = {\n operation: 'ADD',\n path: `/attributes/${pair.key}`,\n value: pair.value,\n };\n onUpdate([operation]);\n }\n }}\n onRemove={(pair: any): void => {\n if (onUpdate) {\n const operation: any = {\n operation: 'REMOVE',\n path: `/attributes/${pair.key}`,\n value: '',\n };\n onUpdate([operation]);\n }\n }}\n label=\"\"\n keyPlaceholder=\"Attribute name\"\n valuePlaceholder=\"Attribute value\"\n helperText=\"Add custom attributes as key-value pairs\"\n />\n );\n } else {\n fieldInput = <TextField {...commonProps} />;\n }\n\n return (\n <>\n <span className={cx(styles['label'])}>{label}</span>\n <div className={cx(styles['value'])}>{fieldInput}</div>\n </>\n );\n }\n\n const hasValue: boolean = value !== undefined && value !== null && value !== '';\n const isFieldEditable: boolean = editable && fieldEditable;\n\n let displayValue: string | ReactElement;\n if (hasValue) {\n displayValue =\n key === 'attributes' && typeof value === 'object' && value !== null ? (\n <KeyValueInput value={value} readOnly={true} label=\"\" />\n ) : (\n String(renderedValue)\n );\n } else if (isFieldEditable) {\n displayValue = getFieldPlaceholder(key);\n } else {\n displayValue = '-';\n }\n\n return (\n <>\n <span className={cx(styles['label'])}>{label}</span>\n <div className={cx(styles['value'], !hasValue && styles['valueEmpty'])}>\n {!hasValue && isFieldEditable && onStartEdit ? (\n <Button\n onClick={onStartEdit}\n variant=\"text\"\n color=\"secondary\"\n size=\"small\"\n title=\"Click to edit\"\n className={cx(styles['placeholderButton'])}\n >\n {displayValue}\n </Button>\n ) : (\n displayValue\n )}\n </div>\n </>\n );\n };\n\n const renderOrganizationField = (field: any): ReactElement | null => {\n if (!field?.key) return null;\n\n const hasValue: boolean =\n organization?.[field.key as keyof OrganizationDetails] !== undefined &&\n organization?.[field.key as keyof OrganizationDetails] !== '' &&\n organization?.[field.key as keyof OrganizationDetails] !== null;\n const isFieldEditing: boolean = editingFields[field.key];\n const isFieldEditable: boolean = editable && field.editable !== false;\n\n const shouldShow: boolean = hasValue || isFieldEditing || isFieldEditable;\n\n if (!shouldShow) {\n return null;\n }\n\n return (\n <div className={cx(styles['field'])} key={field.key}>\n <div className={cx(styles['fieldContent'])}>\n {renderField(\n field,\n isFieldEditing,\n (value: any): void => {\n const tempEditedOrganization: any = {...editedOrganization};\n tempEditedOrganization[field.key as keyof OrganizationDetails] = value;\n setEditedOrganization(tempEditedOrganization);\n },\n (): void => toggleFieldEdit(field.key),\n )}\n </div>\n {isFieldEditable && (\n <div className={cx(styles['fieldActions'])}>\n {isFieldEditing ? (\n <>\n <Button\n onClick={(): void => handleFieldSave(field.key)}\n color=\"primary\"\n variant=\"solid\"\n size=\"small\"\n title=\"Save changes\"\n >\n {saveButtonText}\n </Button>\n <Button\n onClick={(): void => handleFieldCancel(field.key)}\n color=\"secondary\"\n variant=\"solid\"\n size=\"small\"\n title=\"Cancel editing\"\n >\n {cancelButtonText}\n </Button>\n </>\n ) : (\n hasValue && (\n <Button\n onClick={(): void => toggleFieldEdit(field.key)}\n variant=\"text\"\n color=\"secondary\"\n size=\"small\"\n title=\"Edit field\"\n className={cx(styles['editButton'])}\n >\n <PencilIcon />\n </Button>\n )\n )}\n </div>\n )}\n </div>\n );\n };\n\n if (!organization) {\n return fallback;\n }\n\n const profileContent: ReactElement = (\n <CardPrimitive className={cx(styles['root'], cardLayout && styles['card'], className)}>\n <div className={cx(styles['header'])}>\n <Avatar name={getOrgInitials(organization.name)} size={80} alt={`${organization.name} logo`} />\n <div className={cx(styles['orgInfo'])}>\n <h2 className={cx(styles['name'])}>{organization.name}</h2>\n {organization.orgHandle && <p className={cx(styles['handle'])}>@{organization.orgHandle}</p>}\n </div>\n </div>\n\n <div className={cx(styles['infoContainer'])}>{fields.map((field: any) => renderOrganizationField(field))}</div>\n </CardPrimitive>\n );\n\n if (mode === 'popup') {\n return (\n <DialogPrimitive open={open} onOpenChange={onOpenChange}>\n <DialogPrimitive.Content>\n <DialogPrimitive.Heading>{title}</DialogPrimitive.Heading>\n <div className={cx(styles['popup'])}>{profileContent}</div>\n </DialogPrimitive.Content>\n </DialogPrimitive>\n );\n }\n\n return profileContent;\n};\n\nexport default BaseOrganizationProfile;\n","/**\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 HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n getOrganization as baseGetOrganization,\n GetOrganizationConfig as BaseGetOrganizationConfig,\n OrganizationDetails,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the getOrganization request (React-specific)\n */\nexport interface GetOrganizationConfig extends Omit<BaseGetOrganizationConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Retrieves detailed information for a specific organization.\n * This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.\n *\n * @param config - Configuration object containing baseUrl, organizationId, and request config.\n * @returns A promise that resolves with the organization details.\n * @example\n * ```typescript\n * // Using default ThunderID SPA client httpClient\n * try {\n * const organization = await getOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/dxlab\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\"\n * });\n * console.log(organization);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get organization:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher\n * try {\n * const organization = await getOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/dxlab\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\",\n * fetcher: customFetchFunction\n * });\n * console.log(organization);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get organization:', error.message);\n * }\n * }\n * ```\n */\nconst getOrganization = async ({\n fetcher,\n instanceId = 0,\n ...requestConfig\n}: GetOrganizationConfig): Promise<OrganizationDetails> => {\n const defaultFetcher = async (url: string, config: RequestInit): Promise<Response> => {\n const httpClient: FetchHttpClient = FetchHttpClient.getInstance(instanceId);\n const response: HttpResponse<any> = await httpClient.request({\n headers: config.headers as Record<string, string>,\n method: config.method || 'GET',\n url,\n } as HttpRequestConfig);\n\n return {\n json: () => Promise.resolve(response.data),\n ok: response.status >= 200 && response.status < 300,\n status: response.status,\n statusText: response.statusText || '',\n text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data)),\n } as Response;\n };\n\n return baseGetOrganization({\n ...requestConfig,\n fetcher: fetcher || defaultFetcher,\n });\n};\n\nexport default getOrganization;\n","/**\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 HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n updateOrganization as baseUpdateOrganization,\n UpdateOrganizationConfig as BaseUpdateOrganizationConfig,\n OrganizationDetails,\n createPatchOperations,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the updateOrganization request (React-specific)\n */\nexport interface UpdateOrganizationConfig extends Omit<BaseUpdateOrganizationConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Updates the organization information using the Organizations Management API.\n * This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.\n *\n * @param config - Configuration object with baseUrl, organizationId, operations and optional request config.\n * @returns A promise that resolves with the updated organization information.\n * @example\n * ```typescript\n * // Using the helper function to create operations automatically\n * const operations = createPatchOperations({\n * name: \"Updated Organization Name\", // Will use REPLACE\n * description: \"\", // Will use REMOVE (empty string)\n * customField: \"Some value\" // Will use REPLACE\n * });\n *\n * await updateOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORG>\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\",\n * operations\n * });\n *\n * // Or manually specify operations\n * await updateOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORG>\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\",\n * operations: [\n * { operation: \"REPLACE\", path: \"/name\", value: \"Updated Organization Name\" },\n * { operation: \"REMOVE\", path: \"/description\" }\n * ]\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher\n * await updateOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORG>\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\",\n * operations: [\n * { operation: \"REPLACE\", path: \"/name\", value: \"Updated Organization Name\" }\n * ],\n * fetcher: customFetchFunction\n * });\n * ```\n */\nconst updateOrganization = async ({\n fetcher,\n instanceId = 0,\n ...requestConfig\n}: UpdateOrganizationConfig): Promise<OrganizationDetails> => {\n const defaultFetcher = async (url: string, config: RequestInit): Promise<Response> => {\n const httpClient: FetchHttpClient = FetchHttpClient.getInstance(instanceId);\n const response: HttpResponse<any> = await httpClient.request({\n data: config.body ? JSON.parse(config.body as string) : undefined,\n headers: config.headers as Record<string, string>,\n method: config.method || 'PATCH',\n url,\n } as HttpRequestConfig);\n\n return {\n json: () => Promise.resolve(response.data),\n ok: response.status >= 200 && response.status < 300,\n status: response.status,\n statusText: response.statusText || '',\n text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data)),\n } as Response;\n };\n\n return baseUpdateOrganization({\n ...requestConfig,\n fetcher: fetcher || defaultFetcher,\n });\n};\n\n// Re-export the helper function\nexport {createPatchOperations};\n\nexport default updateOrganization;\n","/**\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 {OrganizationDetails, createPackageComponentLogger} from '@thunderid/browser';\nimport {FC, ReactElement, useEffect, useState} from 'react';\nimport BaseOrganizationProfile, {BaseOrganizationProfileProps} from './BaseOrganizationProfile';\nimport getOrganization from '../../../api/getOrganization';\nimport updateOrganization, {createPatchOperations} from '../../../api/updateOrganization';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\nimport useTranslation from '../../../hooks/useTranslation';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'OrganizationProfile',\n);\n\n/**\n * Props for the OrganizationProfile component.\n * Extends BaseOrganizationProfileProps but makes the organization prop optional\n * since it will be fetched using the organizationId\n */\nexport type OrganizationProfileProps = Omit<BaseOrganizationProfileProps, 'organization' | 'mode'> & {\n /**\n * Component to show when there's an error loading organization data.\n */\n errorFallback?: ReactElement;\n\n /**\n * Component to show while loading organization data.\n */\n loadingFallback?: ReactElement;\n\n /**\n * Display mode for the component.\n */\n mode?: 'default' | 'popup';\n\n /**\n * Callback fired when the popup should be closed (only used in popup mode).\n */\n onOpenChange?: (open: boolean) => void;\n\n /**\n * Callback fired when the organization should be updated.\n */\n onUpdate?: (payload: any) => Promise<void>;\n\n /**\n * Whether the popup is open (only used in popup mode).\n */\n open?: boolean;\n\n /**\n * The ID of the organization to fetch and display.\n */\n organizationId: string;\n\n /**\n * Custom title for the popup dialog (only used in popup mode).\n */\n popupTitle?: string;\n};\n\n/**\n * OrganizationProfile component displays organization information in a\n * structured and styled format. It automatically fetches organization details\n * using the provided organization ID and displays them using BaseOrganizationProfile.\n *\n * The component supports editing functionality, allowing users to modify organization\n * fields inline. Updates are automatically synced with the backend via the SCIM2 API.\n *\n * This component is the React-specific implementation that automatically\n * retrieves the organization data from ThunderID API.\n *\n * @example\n * ```tsx\n * // Basic usage with editing enabled (default)\n * <OrganizationProfile organizationId=\"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\" />\n *\n * // Read-only mode\n * <OrganizationProfile\n * organizationId=\"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\"\n * editable={false}\n * />\n *\n * // With card layout and custom fallbacks\n * <OrganizationProfile\n * organizationId=\"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\"\n * cardLayout={true}\n * loadingFallback={<div>Loading organization...</div>}\n * errorFallback={<div>Failed to load organization</div>}\n * fallback={<div>No organization data available</div>}\n * />\n *\n * // With custom fields configuration and update callback\n * <OrganizationProfile\n * organizationId=\"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\"\n * fields={[\n * { key: 'id', label: 'Organization ID', editable: false },\n * { key: 'name', label: 'Organization Name', editable: true },\n * { key: 'description', label: 'Description', editable: true, render: (value) => value || 'No description' },\n * { key: 'created', label: 'Created Date', editable: false, render: (value) => new Date(value).toLocaleDateString() },\n * { key: 'lastModified', label: 'Last Modified Date', editable: false, render: (value) => new Date(value).toLocaleDateString() },\n * { key: 'attributes', label: 'Custom Attributes', editable: true }\n * ]}\n * onUpdate={async (payload) => {\n * console.log('Organization updated:', payload);\n * // payload contains the updated field values\n * // The component automatically converts these to patch operations\n * }}\n * />\n *\n * // In popup mode\n * <OrganizationProfile\n * organizationId=\"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\"\n * mode=\"popup\"\n * open={isOpen}\n * onOpenChange={setIsOpen}\n * popupTitle=\"Edit Organization Profile\"\n * />\n * ```\n */\nconst OrganizationProfile: FC<OrganizationProfileProps> = ({\n organizationId,\n mode = 'default',\n open = false,\n onOpenChange,\n onUpdate,\n popupTitle,\n loadingFallback,\n errorFallback,\n preferences,\n ...rest\n}: OrganizationProfileProps): ReactElement => {\n const {baseUrl, instanceId} = useThunderID();\n const {t} = useTranslation(preferences?.i18n);\n const [organization, setOrganization] = useState<OrganizationDetails | null>(null);\n\n const fetchOrganization = async (): Promise<void> => {\n if (!baseUrl || !organizationId) {\n return;\n }\n\n try {\n const orgData: any = await getOrganization({\n baseUrl,\n instanceId,\n organizationId,\n });\n setOrganization(orgData);\n } catch (err) {\n logger.error('Failed to fetch organization:');\n setOrganization(null);\n }\n };\n\n useEffect(() => {\n fetchOrganization();\n }, [baseUrl, organizationId]);\n\n const handleOrganizationUpdate = async (payload: any): Promise<void> => {\n if (!baseUrl || !organizationId) return;\n\n try {\n // Convert payload to patch operations format\n const operations: any = createPatchOperations(payload);\n\n await updateOrganization({\n baseUrl,\n instanceId,\n operations,\n organizationId,\n });\n // Refetch organization data after update\n await fetchOrganization();\n\n // Call the optional onUpdate callback\n if (onUpdate) {\n await onUpdate(payload);\n }\n } catch (err) {\n logger.error('Failed to update organization:');\n throw err;\n }\n };\n\n return (\n <BaseOrganizationProfile\n organization={organization}\n onUpdate={handleOrganizationUpdate}\n mode={mode === 'popup' ? 'popup' : 'inline'}\n open={open}\n onOpenChange={onOpenChange}\n title={popupTitle || t('organization.profile.heading')}\n preferences={preferences}\n {...rest}\n />\n );\n};\n\nexport default OrganizationProfile;\n","/**\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 {FC, ReactElement, useState} from 'react';\n\nimport {\n BaseOrganizationSwitcher as BaseOrganizationSwitcherComponent,\n BaseOrganizationSwitcherProps,\n Organization,\n} from './BaseOrganizationSwitcher';\nimport useOrganization from '../../../contexts/Organization/useOrganization';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\nimport useTranslation from '../../../hooks/useTranslation';\nimport BuildingAlt from '../../primitives/Icons/BuildingAlt';\nimport {CreateOrganization} from '../CreateOrganization/CreateOrganization';\nimport OrganizationListComponent from '../OrganizationList/OrganizationList';\nimport OrganizationProfile from '../OrganizationProfile/OrganizationProfile';\n\n/**\n * Props interface for the OrganizationSwitcher component.\n * Makes organizations optional since they'll be retrieved from OrganizationContext.\n */\nexport interface OrganizationSwitcherProps\n extends Omit<BaseOrganizationSwitcherProps, 'organizations' | 'currentOrganization' | 'onOrganizationSwitch'> {\n /**\n * Optional override for current organization (will use context if not provided)\n */\n currentOrganization?: Organization;\n /**\n * Fallback element to render when the user is not signed in.\n */\n fallback?: ReactElement;\n /**\n * Optional callback for organization switch (will use context if not provided)\n */\n onOrganizationSwitch?: (organization: Organization) => Promise<void> | void;\n /**\n * Optional override for organizations list (will use context if not provided)\n */\n organizations?: Organization[];\n}\n\n/**\n * OrganizationSwitcher component that provides organization switching functionality.\n * This component automatically retrieves organizations from the OrganizationContext.\n * You can also override the organizations, currentOrganization, and onOrganizationSwitch\n * by passing them as props.\n *\n * @example\n * ```tsx\n * import { OrganizationSwitcher } from '@thunderid/react';\n *\n * // Basic usage - uses OrganizationContext\n * <OrganizationSwitcher />\n *\n * // With custom organization switch handler\n * <OrganizationSwitcher\n * onOrganizationSwitch={(org) => {\n * console.log('Switching to:', org.name);\n * // Custom logic here\n * }}\n * />\n *\n * // With fallback for unauthenticated users\n * <OrganizationSwitcher\n * fallback={<div>Please sign in to view organizations</div>}\n * />\n * ```\n */\nexport const OrganizationSwitcher: FC<OrganizationSwitcherProps> = ({\n currentOrganization: propCurrentOrganization,\n fallback = null,\n onOrganizationSwitch: propOnOrganizationSwitch,\n organizations: propOrganizations,\n preferences,\n ...props\n}: OrganizationSwitcherProps): ReactElement => {\n const {isSignedIn} = useThunderID();\n const {\n currentOrganization: contextCurrentOrganization,\n myOrganizations: contextOrganizations,\n switchOrganization,\n isLoading,\n error,\n } = useOrganization();\n const [isCreateOrgOpen, setIsCreateOrgOpen] = useState(false);\n const [isProfileOpen, setIsProfileOpen] = useState(false);\n const [isOrganizationListOpen, setIsOrganizationListOpen] = useState(false);\n const {t} = useTranslation(preferences?.i18n);\n\n if (!isSignedIn && fallback) {\n return fallback;\n }\n\n if (!isSignedIn) {\n return <></>;\n }\n\n const organizations: Organization[] = propOrganizations || contextOrganizations || [];\n const currentOrganization: Organization | null = propCurrentOrganization || contextCurrentOrganization;\n const onOrganizationSwitch: (organization: Organization) => Promise<void> | void =\n propOnOrganizationSwitch || switchOrganization;\n\n const handleManageOrganizations = (): void => {\n setIsOrganizationListOpen(true);\n };\n\n const handleManageOrganization = (): void => {\n setIsProfileOpen(true);\n };\n\n const defaultMenuItems: {icon?: ReactElement; label: string; onClick: () => void}[] = [];\n\n if (currentOrganization) {\n defaultMenuItems.push({\n icon: <BuildingAlt />,\n label: t('organization.switcher.manage.organizations'),\n onClick: handleManageOrganizations,\n });\n }\n\n defaultMenuItems.push({\n icon: (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <path d=\"M12 5v14m-7-7h14\" />\n </svg>\n ),\n label: t('organization.switcher.create.organization'),\n onClick: (): void => setIsCreateOrgOpen(true),\n });\n\n const menuItems: any[] = props.menuItems ? [...defaultMenuItems, ...props.menuItems] : defaultMenuItems;\n\n return (\n <>\n <BaseOrganizationSwitcherComponent\n organizations={organizations}\n currentOrganization={currentOrganization}\n onOrganizationSwitch={onOrganizationSwitch}\n loading={isLoading}\n error={error}\n menuItems={menuItems}\n onManageProfile={handleManageOrganization}\n preferences={preferences}\n {...props}\n />\n <CreateOrganization\n mode=\"popup\"\n open={isCreateOrgOpen}\n onOpenChange={setIsCreateOrgOpen}\n onSuccess={(org: Organization): void => {\n if (org && onOrganizationSwitch) {\n onOrganizationSwitch(org);\n }\n setIsCreateOrgOpen(false);\n }}\n />\n {currentOrganization && (\n <OrganizationProfile\n organizationId={currentOrganization.id}\n mode=\"popup\"\n open={isProfileOpen}\n onOpenChange={setIsProfileOpen}\n cardLayout={true}\n loadingFallback={<div>{t('organization.profile.loading')}</div>}\n errorFallback={<div>{t('organization.profile.error')}</div>}\n />\n )}\n <OrganizationListComponent\n mode=\"popup\"\n open={isOrganizationListOpen}\n onOpenChange={setIsOrganizationListOpen}\n title={t('organization.switcher.manage.organizations')}\n onOrganizationSelect={(organization: Organization): void => {\n if (onOrganizationSwitch) {\n onOrganizationSwitch(organization);\n }\n setIsOrganizationListOpen(false);\n }}\n />\n </>\n );\n};\n\nexport default OrganizationSwitcher;\n","/**\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 {css} from '@emotion/css';\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\n\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(() => {\n const root: string = css`\n display: inline-block;\n position: relative;\n font-family: ${theme.vars.typography.fontFamily};\n `;\n\n const trigger: string = css`\n display: inline-flex;\n align-items: center;\n gap: calc(${theme.vars.spacing.unit} * 0.5);\n padding: calc(${theme.vars.spacing.unit} * 0.75) ${theme.vars.spacing.unit};\n border: 1px solid ${theme.vars.colors.border};\n background: ${theme.vars.colors.background.surface};\n cursor: pointer;\n border-radius: ${theme.vars.borderRadius.medium};\n min-width: 120px;\n font-size: 0.875rem;\n color: ${theme.vars.colors.text.primary};\n\n &:hover {\n background-color: ${theme.vars.colors.action?.hover || 'rgba(0, 0, 0, 0.04)'};\n }\n `;\n\n const triggerEmoji: string = css`\n font-size: 1rem;\n line-height: 1;\n `;\n\n const triggerLabel: string = css`\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-weight: 500;\n `;\n\n const content: string = css`\n min-width: 200px;\n max-width: 320px;\n background-color: ${theme.vars.colors.background.surface};\n border-radius: ${theme.vars.borderRadius.medium};\n box-shadow: ${theme.vars.shadows.medium};\n border: 1px solid ${theme.vars.colors.border};\n outline: none;\n z-index: 1000;\n padding: calc(${theme.vars.spacing.unit} * 0.5) 0;\n `;\n\n const option: string = css`\n display: flex;\n align-items: center;\n gap: ${theme.vars.spacing.unit};\n padding: calc(${theme.vars.spacing.unit} * 1) calc(${theme.vars.spacing.unit} * 1.5);\n width: 100%;\n border: none;\n background-color: transparent;\n cursor: pointer;\n font-size: 0.875rem;\n text-align: start;\n color: ${theme.vars.colors.text.primary};\n transition: background-color 0.15s ease-in-out;\n\n &:hover {\n background-color: ${theme.vars.colors.action?.hover || 'rgba(0, 0, 0, 0.04)'};\n }\n `;\n\n const optionActive: string = css`\n font-weight: 600;\n color: ${theme.vars.colors.primary?.main || theme.vars.colors.text.primary};\n `;\n\n const optionEmoji: string = css`\n font-size: 1rem;\n line-height: 1;\n flex-shrink: 0;\n `;\n\n const optionLabel: string = css`\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `;\n\n const checkIcon: string = css`\n color: ${theme.vars.colors.primary?.main || theme.vars.colors.text.primary};\n flex-shrink: 0;\n margin-inline-start: auto;\n `;\n\n return {\n checkIcon,\n content,\n option,\n optionActive,\n optionEmoji,\n optionLabel,\n root,\n trigger,\n triggerEmoji,\n triggerLabel,\n };\n }, [\n theme.vars.colors.background.surface,\n theme.vars.colors.text.primary,\n theme.vars.colors.border,\n theme.vars.borderRadius.medium,\n theme.vars.shadows.medium,\n theme.vars.spacing.unit,\n theme.vars.colors.action?.hover,\n theme.vars.typography.fontFamily,\n theme.vars.colors.primary?.main,\n colorScheme,\n ]);\n\nexport default useStyles;\n","/**\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 {cx} from '@emotion/css';\nimport {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingPortal,\n offset,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport {FC, ReactElement, ReactNode, useEffect, useState} from 'react';\nimport useStyles from './BaseLanguageSwitcher.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport Check from '../../primitives/Icons/Check';\nimport ChevronDown from '../../primitives/Icons/ChevronDown';\n\n/**\n * A resolved language option with display name and emoji flag.\n */\nexport interface LanguageOption {\n /** BCP 47 language tag (e.g. \"en\", \"fr\", \"en-US\") */\n code: string;\n /** Human-readable display name resolved via Intl.DisplayNames */\n displayName: string;\n /** Flag emoji or globe emoji for the language */\n emoji: string;\n}\n\n/**\n * Render props exposed to consumers when using the render-prop pattern.\n */\nexport interface LanguageSwitcherRenderProps {\n /** The currently active language code */\n currentLanguage: string;\n /** Whether a language switch is in progress */\n isLoading: boolean;\n /** Resolved language options */\n languages: LanguageOption[];\n /** Call this to switch to a different language */\n onLanguageChange: (language: string) => void;\n}\n\nexport interface BaseLanguageSwitcherProps {\n /**\n * Render-props callback. When provided, the default dropdown UI is replaced with\n * whatever JSX the callback returns.\n *\n * @example\n * ```tsx\n * <BaseLanguageSwitcher {...props}>\n * {({languages, currentLanguage, onLanguageChange}) => (\n * <select value={currentLanguage} onChange={e => onLanguageChange(e.target.value)}>\n * {languages.map(l => <option key={l.code} value={l.code}>{l.emoji} {l.displayName}</option>)}\n * </select>\n * )}\n * </BaseLanguageSwitcher>\n * ```\n */\n children?: (props: LanguageSwitcherRenderProps) => ReactNode;\n /** Additional CSS class applied to the root element (default UI only) */\n className?: string;\n /** The currently active language code */\n currentLanguage: string;\n /** Whether a language switch is in progress */\n isLoading?: boolean;\n /** Resolved language options to display */\n languages: LanguageOption[];\n /** Called when the user selects a language */\n onLanguageChange: (language: string) => void;\n}\n\n/**\n * Pure-UI language switcher dropdown.\n * Accepts resolved `LanguageOption[]` (code + displayName + emoji) and delegates\n * language switching to the `onLanguageChange` callback.\n *\n * Supports render props for full UI customisation.\n */\nconst BaseLanguageSwitcher: FC<BaseLanguageSwitcherProps> = ({\n children,\n className,\n currentLanguage,\n isLoading = false,\n languages,\n onLanguageChange,\n}: BaseLanguageSwitcherProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const [isOpen, setIsOpen] = useState(false);\n const hasMultipleLanguages: boolean = languages.length > 1;\n\n useEffect(() => {\n if (!hasMultipleLanguages && isOpen) {\n setIsOpen(false);\n }\n }, [hasMultipleLanguages, isOpen]);\n\n const {refs, floatingStyles, context} = useFloating({\n middleware: [offset(4), flip(), shift()],\n onOpenChange: setIsOpen,\n open: isOpen,\n whileElementsMounted: autoUpdate,\n });\n\n const click: ReturnType<typeof useClick> = useClick(context, {enabled: hasMultipleLanguages});\n const dismiss: ReturnType<typeof useDismiss> = useDismiss(context, {enabled: hasMultipleLanguages});\n const role: ReturnType<typeof useRole> = useRole(context, {enabled: hasMultipleLanguages, role: 'listbox'});\n const {getReferenceProps, getFloatingProps} = useInteractions([click, dismiss, role]);\n\n const currentOption: LanguageOption | undefined = languages.find((l: LanguageOption) => l.code === currentLanguage);\n\n if (children) {\n return (\n <>\n {children({\n currentLanguage,\n isLoading,\n languages,\n onLanguageChange,\n })}\n </>\n );\n }\n\n return (\n <div className={cx(styles['root'], className)}>\n <button\n ref={refs.setReference}\n type=\"button\"\n disabled={isLoading}\n aria-label=\"Switch language\"\n {...getReferenceProps()}\n className={styles['trigger']}\n >\n {currentOption && <span className={styles['triggerEmoji']}>{currentOption.emoji}</span>}\n <span className={styles['triggerLabel']}>{currentOption?.displayName ?? currentLanguage}</span>\n {hasMultipleLanguages && <ChevronDown />}\n </button>\n\n {isOpen && hasMultipleLanguages && (\n <FloatingPortal>\n <FloatingFocusManager context={context} modal={false}>\n <div\n ref={refs.setFloating}\n style={floatingStyles}\n {...getFloatingProps()}\n className={styles['content']}\n role=\"listbox\"\n aria-label=\"Select language\"\n >\n {languages.map((lang: LanguageOption) => (\n <button\n key={lang.code}\n type=\"button\"\n role=\"option\"\n aria-selected={lang.code === currentLanguage}\n className={cx(styles['option'], lang.code === currentLanguage && styles['optionActive'])}\n onClick={() => {\n onLanguageChange(lang.code);\n setIsOpen(false);\n }}\n >\n <span className={styles['optionEmoji']}>{lang.emoji}</span>\n <span className={styles['optionLabel']}>{lang.displayName}</span>\n {lang.code === currentLanguage && (\n <span className={styles['checkIcon']}>\n <Check />\n </span>\n )}\n </button>\n ))}\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n )}\n </div>\n );\n};\n\nexport default BaseLanguageSwitcher;\n","/**\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 {useContext} from 'react';\nimport FlowMetaContext, {FlowMetaContextValue} from './FlowMetaContext';\n\nconst useFlowMeta = (): FlowMetaContextValue => {\n const context: FlowMetaContextValue | null = useContext(FlowMetaContext);\n if (!context) {\n throw new Error('useFlowMeta must be used within a FlowMetaProvider');\n }\n return context;\n};\n\nexport default useFlowMeta;\n","/**\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 {resolveLocaleDisplayName, resolveLocaleEmoji} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useEffect, useMemo} from 'react';\nimport BaseLanguageSwitcher, {LanguageOption, LanguageSwitcherRenderProps} from './BaseLanguageSwitcher';\nimport useFlowMeta from '../../../contexts/FlowMeta/useFlowMeta';\nimport useTranslation from '../../../hooks/useTranslation';\n\nexport type {LanguageOption, LanguageSwitcherRenderProps};\n\nexport interface LanguageSwitcherProps {\n /**\n * Render-props callback for fully custom UI.\n *\n * @example\n * ```tsx\n * <LanguageSwitcher>\n * {({languages, currentLanguage, onLanguageChange, isLoading}) => (\n * <select\n * value={currentLanguage}\n * disabled={isLoading}\n * onChange={e => onLanguageChange(e.target.value)}\n * >\n * {languages.map(l => (\n * <option key={l.code} value={l.code}>{l.emoji} {l.displayName}</option>\n * ))}\n * </select>\n * )}\n * </LanguageSwitcher>\n * ```\n */\n children?: (props: LanguageSwitcherRenderProps) => ReactNode;\n /** Additional CSS class for the root element (default UI only) */\n className?: string;\n}\n\n/**\n * A v2 LanguageSwitcher component that reads available languages from `FlowMetaContext`\n * and switches both the UI language (via `I18nContext`) and the flow metadata translations\n * (by re-fetching `GET /flow/meta` with the new language).\n *\n * Must be rendered inside a `FlowMetaProvider`.\n *\n * @example\n * ```tsx\n * // Default dropdown UI\n * <LanguageSwitcher />\n *\n * // Custom UI with render props\n * <LanguageSwitcher>\n * {({languages, currentLanguage, onLanguageChange}) => (\n * <div>\n * {languages.map(lang => (\n * <button\n * key={lang.code}\n * onClick={() => onLanguageChange(lang.code)}\n * style={{fontWeight: lang.code === currentLanguage ? 'bold' : 'normal'}}\n * >\n * {lang.emoji} {lang.displayName}\n * </button>\n * ))}\n * </div>\n * )}\n * </LanguageSwitcher>\n * ```\n */\nconst LanguageSwitcher: FC<LanguageSwitcherProps> = ({children, className}: LanguageSwitcherProps): ReactElement => {\n const {meta, switchLanguage, isLoading} = useFlowMeta();\n const {currentLanguage} = useTranslation();\n\n const availableLanguageCodes: string[] = meta?.i18n?.languages ?? [];\n // Only fall back to the detected browser language when the server returns no configured languages.\n // Do NOT inject currentLanguage unconditionally — a browser locale like \"en-GB\" must not appear\n // in the picker when the server only supports \"en-US\".\n const effectiveLanguageCodes: string[] = useMemo(\n () => (availableLanguageCodes.length > 0 ? availableLanguageCodes : [currentLanguage]),\n [availableLanguageCodes, currentLanguage],\n );\n\n const languages: LanguageOption[] = useMemo(\n () =>\n effectiveLanguageCodes.map((code: string) => ({\n code,\n // Resolve each label in its own locale so option names stay stable across UI language switches.\n displayName: resolveLocaleDisplayName(code, code) || code,\n emoji: resolveLocaleEmoji(code),\n })),\n [effectiveLanguageCodes],\n );\n\n // If the detected language isn't supported by the server, fall back to the first available language.\n useEffect(() => {\n if (availableLanguageCodes.length > 0 && !availableLanguageCodes.includes(currentLanguage)) {\n switchLanguage(availableLanguageCodes[0]);\n }\n }, [availableLanguageCodes, currentLanguage, switchLanguage]);\n\n const handleLanguageChange = (language: string): void => {\n if (language !== currentLanguage) {\n switchLanguage(language);\n }\n };\n\n return (\n <BaseLanguageSwitcher\n currentLanguage={currentLanguage}\n isLoading={isLoading}\n languages={languages}\n onLanguageChange={handleLanguageChange}\n className={className}\n >\n {children}\n </BaseLanguageSwitcher>\n );\n};\n\nexport default LanguageSwitcher;\n","/**\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 Schema,\n HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n getSchemas as baseGetSchemas,\n GetSchemasConfig as BaseGetSchemasConfig,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the getSchemas request (React-specific)\n */\nexport interface GetSchemasConfig extends Omit<BaseGetSchemasConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Retrieves the SCIM2 schemas from the specified endpoint.\n * This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.\n *\n * @param config - Request configuration object.\n * @returns A promise that resolves with the SCIM2 schemas information.\n * @example\n * ```typescript\n * // Using default ThunderID SPA client httpClient\n * try {\n * const schemas = await getSchemas({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Schemas\",\n * });\n * console.log(schemas);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get schemas:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher\n * try {\n * const schemas = await getSchemas({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Schemas\",\n * fetcher: customFetchFunction\n * });\n * console.log(schemas);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get schemas:', error.message);\n * }\n * }\n * ```\n */\nconst getSchemas = async ({fetcher, instanceId = 0, ...requestConfig}: GetSchemasConfig): Promise<Schema[]> => {\n const defaultFetcher = async (url: string, config: RequestInit): Promise<Response> => {\n const httpClient: FetchHttpClient = FetchHttpClient.getInstance(instanceId);\n const response: HttpResponse<any> = await httpClient.request({\n headers: config.headers as Record<string, string>,\n method: config.method || 'GET',\n url,\n } as HttpRequestConfig);\n\n return {\n json: () => Promise.resolve(response.data),\n ok: response.status >= 200 && response.status < 300,\n status: response.status,\n statusText: response.statusText || '',\n text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data)),\n } as Response;\n };\n\n return baseGetSchemas({\n ...requestConfig,\n fetcher: fetcher || defaultFetcher,\n });\n};\n\nexport default getSchemas;\n","/**\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 User,\n HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n getScim2Me as baseGetScim2Me,\n GetScim2MeConfig as BaseGetScim2MeConfig,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the getScim2Me request (React-specific)\n */\nexport interface GetScim2MeConfig extends Omit<BaseGetScim2MeConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Retrieves the user profile information from the specified SCIM2 /Me endpoint.\n * This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.\n *\n * @param requestConfig - Request configuration object.\n * @returns A promise that resolves with the user profile information.\n * @example\n * ```typescript\n * // Using default ThunderID SPA client httpClient\n * try {\n * const userProfile = await getScim2Me({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Me\",\n * });\n * console.log(userProfile);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get user profile:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher\n * try {\n * const userProfile = await getScim2Me({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Me\",\n * fetcher: customFetchFunction\n * });\n * console.log(userProfile);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get user profile:', error.message);\n * }\n * }\n * ```\n */\nconst getScim2Me = async ({fetcher, instanceId = 0, ...requestConfig}: GetScim2MeConfig): Promise<User> => {\n const defaultFetcher = async (url: string, config: RequestInit): Promise<Response> => {\n const httpClient: FetchHttpClient = FetchHttpClient.getInstance(instanceId);\n const response: HttpResponse<any> = await httpClient.request({\n headers: config.headers as Record<string, string>,\n method: config.method || 'GET',\n url,\n } as HttpRequestConfig);\n\n return {\n json: () => Promise.resolve(response.data),\n ok: response.status >= 200 && response.status < 300,\n status: response.status,\n statusText: response.statusText || '',\n text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data)),\n } as Response;\n };\n\n return baseGetScim2Me({\n ...requestConfig,\n fetcher: fetcher || defaultFetcher,\n });\n};\n\nexport default getScim2Me;\n"],"mappings":";;;;;;;;;;;AAkNA,MAAMA,mBAA0D,cAA4C;CAC1G,gBAAgB;CAChB,eAAe;CACf,SAAS;CACT,oBAAoB;CACpB,UAAU;CACV,WAAW,EACT,WAAW,MACZ;CACD,eAAe;CACf,gBAAgB;CAChB,m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