@contember/react-client-tenant 2.2.0-alpha.3 → 2.2.0-alpha.6

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 (735) hide show
  1. package/CLAUDE.md +40 -0
  2. package/dist/development/index.cjs +123 -0
  3. package/dist/development/index.cjs.map +1 -1
  4. package/dist/development/index.js +123 -0
  5. package/dist/development/index.js.map +1 -1
  6. package/dist/development/src/components/forms/AddProjectMemberForm.cjs +59 -0
  7. package/dist/development/src/components/forms/AddProjectMemberForm.cjs.map +1 -0
  8. package/dist/development/src/components/forms/AddProjectMemberForm.js +59 -0
  9. package/dist/development/src/components/forms/AddProjectMemberForm.js.map +1 -0
  10. package/dist/development/src/components/forms/ChangeMyProfileForm.cjs +58 -0
  11. package/dist/development/src/components/forms/ChangeMyProfileForm.cjs.map +1 -0
  12. package/dist/development/src/components/forms/ChangeMyProfileForm.js +58 -0
  13. package/dist/development/src/components/forms/ChangeMyProfileForm.js.map +1 -0
  14. package/dist/development/src/components/forms/ChangePasswordForm.cjs +57 -0
  15. package/dist/development/src/components/forms/ChangePasswordForm.cjs.map +1 -0
  16. package/dist/development/src/components/forms/ChangePasswordForm.js +57 -0
  17. package/dist/development/src/components/forms/ChangePasswordForm.js.map +1 -0
  18. package/dist/development/src/components/forms/ChangeProfileForm.cjs +54 -0
  19. package/dist/development/src/components/forms/ChangeProfileForm.cjs.map +1 -0
  20. package/dist/development/src/components/forms/ChangeProfileForm.js +54 -0
  21. package/dist/development/src/components/forms/ChangeProfileForm.js.map +1 -0
  22. package/dist/development/src/components/forms/CreateGlobalApiKeyForm.cjs +53 -0
  23. package/dist/development/src/components/forms/CreateGlobalApiKeyForm.cjs.map +1 -0
  24. package/dist/development/src/components/forms/CreateGlobalApiKeyForm.js +53 -0
  25. package/dist/development/src/components/forms/CreateGlobalApiKeyForm.js.map +1 -0
  26. package/dist/development/src/components/forms/EmailOtpConfirmForm.cjs +51 -0
  27. package/dist/development/src/components/forms/EmailOtpConfirmForm.cjs.map +1 -0
  28. package/dist/development/src/components/forms/EmailOtpConfirmForm.js +51 -0
  29. package/dist/development/src/components/forms/EmailOtpConfirmForm.js.map +1 -0
  30. package/dist/development/src/components/forms/InviteForm.cjs +23 -3
  31. package/dist/development/src/components/forms/InviteForm.cjs.map +1 -1
  32. package/dist/development/src/components/forms/InviteForm.js +23 -3
  33. package/dist/development/src/components/forms/InviteForm.js.map +1 -1
  34. package/dist/development/src/components/forms/LoginForm.cjs +7 -3
  35. package/dist/development/src/components/forms/LoginForm.cjs.map +1 -1
  36. package/dist/development/src/components/forms/LoginForm.js +7 -3
  37. package/dist/development/src/components/forms/LoginForm.js.map +1 -1
  38. package/dist/development/src/components/forms/PasswordlessSignInForm.cjs +7 -4
  39. package/dist/development/src/components/forms/PasswordlessSignInForm.cjs.map +1 -1
  40. package/dist/development/src/components/forms/PasswordlessSignInForm.js +7 -4
  41. package/dist/development/src/components/forms/PasswordlessSignInForm.js.map +1 -1
  42. package/dist/development/src/components/forms/PasswordlessSignInInitForm.cjs +2 -1
  43. package/dist/development/src/components/forms/PasswordlessSignInInitForm.cjs.map +1 -1
  44. package/dist/development/src/components/forms/PasswordlessSignInInitForm.js +2 -1
  45. package/dist/development/src/components/forms/PasswordlessSignInInitForm.js.map +1 -1
  46. package/dist/development/src/components/forms/SetProjectSecretForm.cjs +53 -0
  47. package/dist/development/src/components/forms/SetProjectSecretForm.cjs.map +1 -0
  48. package/dist/development/src/components/forms/SetProjectSecretForm.js +53 -0
  49. package/dist/development/src/components/forms/SetProjectSecretForm.js.map +1 -0
  50. package/dist/development/src/components/forms/SignUpForm.cjs +66 -0
  51. package/dist/development/src/components/forms/SignUpForm.cjs.map +1 -0
  52. package/dist/development/src/components/forms/SignUpForm.js +66 -0
  53. package/dist/development/src/components/forms/SignUpForm.js.map +1 -0
  54. package/dist/development/src/components/forms/TenantForm.cjs +8 -4
  55. package/dist/development/src/components/forms/TenantForm.cjs.map +1 -1
  56. package/dist/development/src/components/forms/TenantForm.js +8 -4
  57. package/dist/development/src/components/forms/TenantForm.js.map +1 -1
  58. package/dist/development/src/components/triggers/DisableEmailOtpTrigger.cjs +32 -0
  59. package/dist/development/src/components/triggers/DisableEmailOtpTrigger.cjs.map +1 -0
  60. package/dist/development/src/components/triggers/DisableEmailOtpTrigger.js +32 -0
  61. package/dist/development/src/components/triggers/DisableEmailOtpTrigger.js.map +1 -0
  62. package/dist/development/src/components/triggers/DisableMyPasswordlessTrigger.cjs +32 -0
  63. package/dist/development/src/components/triggers/DisableMyPasswordlessTrigger.cjs.map +1 -0
  64. package/dist/development/src/components/triggers/DisableMyPasswordlessTrigger.js +32 -0
  65. package/dist/development/src/components/triggers/DisableMyPasswordlessTrigger.js.map +1 -0
  66. package/dist/development/src/components/triggers/DisableOtpTrigger.cjs +1 -1
  67. package/dist/development/src/components/triggers/DisableOtpTrigger.cjs.map +1 -1
  68. package/dist/development/src/components/triggers/DisableOtpTrigger.js +1 -1
  69. package/dist/development/src/components/triggers/DisableOtpTrigger.js.map +1 -1
  70. package/dist/development/src/components/triggers/DisablePersonTrigger.cjs +17 -0
  71. package/dist/development/src/components/triggers/DisablePersonTrigger.cjs.map +1 -0
  72. package/dist/development/src/components/triggers/DisablePersonTrigger.js +17 -0
  73. package/dist/development/src/components/triggers/DisablePersonTrigger.js.map +1 -0
  74. package/dist/development/src/components/triggers/EnableMyPasswordlessTrigger.cjs +32 -0
  75. package/dist/development/src/components/triggers/EnableMyPasswordlessTrigger.cjs.map +1 -0
  76. package/dist/development/src/components/triggers/EnableMyPasswordlessTrigger.js +32 -0
  77. package/dist/development/src/components/triggers/EnableMyPasswordlessTrigger.js.map +1 -0
  78. package/dist/development/src/components/triggers/EnablePersonTrigger.cjs +17 -0
  79. package/dist/development/src/components/triggers/EnablePersonTrigger.cjs.map +1 -0
  80. package/dist/development/src/components/triggers/EnablePersonTrigger.js +17 -0
  81. package/dist/development/src/components/triggers/EnablePersonTrigger.js.map +1 -0
  82. package/dist/development/src/components/triggers/ForceSignOutPersonTrigger.cjs +17 -0
  83. package/dist/development/src/components/triggers/ForceSignOutPersonTrigger.cjs.map +1 -0
  84. package/dist/development/src/components/triggers/ForceSignOutPersonTrigger.js +17 -0
  85. package/dist/development/src/components/triggers/ForceSignOutPersonTrigger.js.map +1 -0
  86. package/dist/development/src/components/triggers/InitEmailOtpTrigger.cjs +16 -0
  87. package/dist/development/src/components/triggers/InitEmailOtpTrigger.cjs.map +1 -0
  88. package/dist/development/src/components/triggers/InitEmailOtpTrigger.js +16 -0
  89. package/dist/development/src/components/triggers/InitEmailOtpTrigger.js.map +1 -0
  90. package/dist/development/src/components/triggers/RegenerateBackupCodesTrigger.cjs +26 -0
  91. package/dist/development/src/components/triggers/RegenerateBackupCodesTrigger.cjs.map +1 -0
  92. package/dist/development/src/components/triggers/RegenerateBackupCodesTrigger.js +26 -0
  93. package/dist/development/src/components/triggers/RegenerateBackupCodesTrigger.js.map +1 -0
  94. package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.cjs +1 -1
  95. package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.cjs.map +1 -1
  96. package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.js +1 -1
  97. package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.js.map +1 -1
  98. package/dist/development/src/components/triggers/ResetPersonMfaTrigger.cjs +17 -0
  99. package/dist/development/src/components/triggers/ResetPersonMfaTrigger.cjs.map +1 -0
  100. package/dist/development/src/components/triggers/ResetPersonMfaTrigger.js +17 -0
  101. package/dist/development/src/components/triggers/ResetPersonMfaTrigger.js.map +1 -0
  102. package/dist/development/src/components/triggers/RevokeSessionTrigger.cjs +17 -0
  103. package/dist/development/src/components/triggers/RevokeSessionTrigger.cjs.map +1 -0
  104. package/dist/development/src/components/triggers/RevokeSessionTrigger.js +17 -0
  105. package/dist/development/src/components/triggers/RevokeSessionTrigger.js.map +1 -0
  106. package/dist/development/src/components/triggers/TenantActionTrigger.cjs +7 -3
  107. package/dist/development/src/components/triggers/TenantActionTrigger.cjs.map +1 -1
  108. package/dist/development/src/components/triggers/TenantActionTrigger.js +7 -3
  109. package/dist/development/src/components/triggers/TenantActionTrigger.js.map +1 -1
  110. package/dist/development/src/hooks/mutations/auth/useSignUpMutation.cjs +30 -0
  111. package/dist/development/src/hooks/mutations/auth/useSignUpMutation.cjs.map +1 -0
  112. package/dist/development/src/hooks/mutations/auth/useSignUpMutation.js +13 -0
  113. package/dist/development/src/hooks/mutations/auth/useSignUpMutation.js.map +1 -0
  114. package/dist/development/src/hooks/mutations/emailOtp/useConfirmEmailOtpMutation.cjs +30 -0
  115. package/dist/development/src/hooks/mutations/emailOtp/useConfirmEmailOtpMutation.cjs.map +1 -0
  116. package/dist/development/src/hooks/mutations/emailOtp/useConfirmEmailOtpMutation.js +13 -0
  117. package/dist/development/src/hooks/mutations/emailOtp/useConfirmEmailOtpMutation.js.map +1 -0
  118. package/dist/development/src/hooks/mutations/emailOtp/useDisableEmailOtpMutation.cjs +29 -0
  119. package/dist/development/src/hooks/mutations/emailOtp/useDisableEmailOtpMutation.cjs.map +1 -0
  120. package/dist/development/src/hooks/mutations/emailOtp/useDisableEmailOtpMutation.js +12 -0
  121. package/dist/development/src/hooks/mutations/emailOtp/useDisableEmailOtpMutation.js.map +1 -0
  122. package/dist/development/src/hooks/mutations/emailOtp/useInitEmailOtpMutation.cjs +29 -0
  123. package/dist/development/src/hooks/mutations/emailOtp/useInitEmailOtpMutation.cjs.map +1 -0
  124. package/dist/development/src/hooks/mutations/emailOtp/useInitEmailOtpMutation.js +12 -0
  125. package/dist/development/src/hooks/mutations/emailOtp/useInitEmailOtpMutation.js.map +1 -0
  126. package/dist/development/src/hooks/mutations/identity/useAddGlobalIdentityRolesMutation.cjs +30 -0
  127. package/dist/development/src/hooks/mutations/identity/useAddGlobalIdentityRolesMutation.cjs.map +1 -0
  128. package/dist/development/src/hooks/mutations/identity/useAddGlobalIdentityRolesMutation.js +13 -0
  129. package/dist/development/src/hooks/mutations/identity/useAddGlobalIdentityRolesMutation.js.map +1 -0
  130. package/dist/development/src/hooks/mutations/identity/useRemoveGlobalIdentityRolesMutation.cjs +30 -0
  131. package/dist/development/src/hooks/mutations/identity/useRemoveGlobalIdentityRolesMutation.cjs.map +1 -0
  132. package/dist/development/src/hooks/mutations/identity/useRemoveGlobalIdentityRolesMutation.js +13 -0
  133. package/dist/development/src/hooks/mutations/identity/useRemoveGlobalIdentityRolesMutation.js.map +1 -0
  134. package/dist/development/src/hooks/mutations/idp/useDisconnectMyIdentityProviderMutation.cjs +29 -0
  135. package/dist/development/src/hooks/mutations/idp/useDisconnectMyIdentityProviderMutation.cjs.map +1 -0
  136. package/dist/development/src/hooks/mutations/idp/useDisconnectMyIdentityProviderMutation.js +12 -0
  137. package/dist/development/src/hooks/mutations/idp/useDisconnectMyIdentityProviderMutation.js.map +1 -0
  138. package/dist/development/src/hooks/mutations/invite/useUnmanagedInviteMutation.cjs +30 -0
  139. package/dist/development/src/hooks/mutations/invite/useUnmanagedInviteMutation.cjs.map +1 -0
  140. package/dist/development/src/hooks/mutations/invite/useUnmanagedInviteMutation.js +13 -0
  141. package/dist/development/src/hooks/mutations/invite/useUnmanagedInviteMutation.js.map +1 -0
  142. package/dist/development/src/hooks/mutations/otp/useRegenerateBackupCodesMutation.cjs +30 -0
  143. package/dist/development/src/hooks/mutations/otp/useRegenerateBackupCodesMutation.cjs.map +1 -0
  144. package/dist/development/src/hooks/mutations/otp/useRegenerateBackupCodesMutation.js +13 -0
  145. package/dist/development/src/hooks/mutations/otp/useRegenerateBackupCodesMutation.js.map +1 -0
  146. package/dist/development/src/hooks/mutations/person/useChangePasswordMutation.cjs +29 -0
  147. package/dist/development/src/hooks/mutations/person/useChangePasswordMutation.cjs.map +1 -0
  148. package/dist/development/src/hooks/mutations/person/useChangePasswordMutation.js +12 -0
  149. package/dist/development/src/hooks/mutations/person/useChangePasswordMutation.js.map +1 -0
  150. package/dist/development/src/hooks/mutations/person/useDisablePersonMutation.cjs +29 -0
  151. package/dist/development/src/hooks/mutations/person/useDisablePersonMutation.cjs.map +1 -0
  152. package/dist/development/src/hooks/mutations/person/useDisablePersonMutation.js +12 -0
  153. package/dist/development/src/hooks/mutations/person/useDisablePersonMutation.js.map +1 -0
  154. package/dist/development/src/hooks/mutations/person/useEnablePersonMutation.cjs +29 -0
  155. package/dist/development/src/hooks/mutations/person/useEnablePersonMutation.cjs.map +1 -0
  156. package/dist/development/src/hooks/mutations/person/useEnablePersonMutation.js +12 -0
  157. package/dist/development/src/hooks/mutations/person/useEnablePersonMutation.js.map +1 -0
  158. package/dist/development/src/hooks/mutations/person/useForceSignOutPersonMutation.cjs +29 -0
  159. package/dist/development/src/hooks/mutations/person/useForceSignOutPersonMutation.cjs.map +1 -0
  160. package/dist/development/src/hooks/mutations/person/useForceSignOutPersonMutation.js +12 -0
  161. package/dist/development/src/hooks/mutations/person/useForceSignOutPersonMutation.js.map +1 -0
  162. package/dist/development/src/hooks/mutations/person/useResetPersonMfaMutation.cjs +29 -0
  163. package/dist/development/src/hooks/mutations/person/useResetPersonMfaMutation.cjs.map +1 -0
  164. package/dist/development/src/hooks/mutations/person/useResetPersonMfaMutation.js +12 -0
  165. package/dist/development/src/hooks/mutations/person/useResetPersonMfaMutation.js.map +1 -0
  166. package/dist/development/src/hooks/mutations/project/useSetProjectSecretMutation.cjs +29 -0
  167. package/dist/development/src/hooks/mutations/project/useSetProjectSecretMutation.cjs.map +1 -0
  168. package/dist/development/src/hooks/mutations/project/useSetProjectSecretMutation.js +12 -0
  169. package/dist/development/src/hooks/mutations/project/useSetProjectSecretMutation.js.map +1 -0
  170. package/dist/development/src/hooks/mutations/session/useRevokeSessionMutation.cjs +29 -0
  171. package/dist/development/src/hooks/mutations/session/useRevokeSessionMutation.cjs.map +1 -0
  172. package/dist/development/src/hooks/mutations/session/useRevokeSessionMutation.js +12 -0
  173. package/dist/development/src/hooks/mutations/session/useRevokeSessionMutation.js.map +1 -0
  174. package/dist/development/src/hooks/queries/useAuthLogQuery.cjs +39 -0
  175. package/dist/development/src/hooks/queries/useAuthLogQuery.cjs.map +1 -0
  176. package/dist/development/src/hooks/queries/useAuthLogQuery.js +22 -0
  177. package/dist/development/src/hooks/queries/useAuthLogQuery.js.map +1 -0
  178. package/dist/development/src/hooks/queries/useAuthPoliciesQuery.cjs +32 -0
  179. package/dist/development/src/hooks/queries/useAuthPoliciesQuery.cjs.map +1 -0
  180. package/dist/development/src/hooks/queries/useAuthPoliciesQuery.js +15 -0
  181. package/dist/development/src/hooks/queries/useAuthPoliciesQuery.js.map +1 -0
  182. package/dist/development/src/hooks/queries/useConfigurationQuery.cjs +33 -0
  183. package/dist/development/src/hooks/queries/useConfigurationQuery.cjs.map +1 -0
  184. package/dist/development/src/hooks/queries/useConfigurationQuery.js +16 -0
  185. package/dist/development/src/hooks/queries/useConfigurationQuery.js.map +1 -0
  186. package/dist/development/src/hooks/queries/useGlobalApiKeysQuery.cjs +32 -0
  187. package/dist/development/src/hooks/queries/useGlobalApiKeysQuery.cjs.map +1 -0
  188. package/dist/development/src/hooks/queries/useGlobalApiKeysQuery.js +15 -0
  189. package/dist/development/src/hooks/queries/useGlobalApiKeysQuery.js.map +1 -0
  190. package/dist/development/src/hooks/queries/useIdentityProvidersQuery.cjs +32 -0
  191. package/dist/development/src/hooks/queries/useIdentityProvidersQuery.cjs.map +1 -0
  192. package/dist/development/src/hooks/queries/useIdentityProvidersQuery.js +15 -0
  193. package/dist/development/src/hooks/queries/useIdentityProvidersQuery.js.map +1 -0
  194. package/dist/development/src/hooks/queries/useMailTemplatesQuery.cjs +32 -0
  195. package/dist/development/src/hooks/queries/useMailTemplatesQuery.cjs.map +1 -0
  196. package/dist/development/src/hooks/queries/useMailTemplatesQuery.js +15 -0
  197. package/dist/development/src/hooks/queries/useMailTemplatesQuery.js.map +1 -0
  198. package/dist/development/src/hooks/queries/useMeQuery.cjs +4 -2
  199. package/dist/development/src/hooks/queries/useMeQuery.cjs.map +1 -1
  200. package/dist/development/src/hooks/queries/useMeQuery.js +4 -2
  201. package/dist/development/src/hooks/queries/useMeQuery.js.map +1 -1
  202. package/dist/development/src/hooks/queries/useMyIdentityProvidersQuery.cjs +38 -0
  203. package/dist/development/src/hooks/queries/useMyIdentityProvidersQuery.cjs.map +1 -0
  204. package/dist/development/src/hooks/queries/useMyIdentityProvidersQuery.js +21 -0
  205. package/dist/development/src/hooks/queries/useMyIdentityProvidersQuery.js.map +1 -0
  206. package/dist/development/src/hooks/queries/useMySessionsQuery.cjs +34 -0
  207. package/dist/development/src/hooks/queries/useMySessionsQuery.cjs.map +1 -0
  208. package/dist/development/src/hooks/queries/useMySessionsQuery.js +17 -0
  209. package/dist/development/src/hooks/queries/useMySessionsQuery.js.map +1 -0
  210. package/dist/development/src/hooks/queries/usePersonQuery.cjs +40 -0
  211. package/dist/development/src/hooks/queries/usePersonQuery.cjs.map +1 -0
  212. package/dist/development/src/hooks/queries/usePersonQuery.js +23 -0
  213. package/dist/development/src/hooks/queries/usePersonQuery.js.map +1 -0
  214. package/dist/development/src/hooks/queries/usePersonSessionsQuery.cjs +39 -0
  215. package/dist/development/src/hooks/queries/usePersonSessionsQuery.cjs.map +1 -0
  216. package/dist/development/src/hooks/queries/usePersonSessionsQuery.js +22 -0
  217. package/dist/development/src/hooks/queries/usePersonSessionsQuery.js.map +1 -0
  218. package/dist/development/src/hooks/queries/usePersonsQuery.cjs +45 -0
  219. package/dist/development/src/hooks/queries/usePersonsQuery.cjs.map +1 -0
  220. package/dist/development/src/hooks/queries/usePersonsQuery.js +28 -0
  221. package/dist/development/src/hooks/queries/usePersonsQuery.js.map +1 -0
  222. package/dist/development/src/hooks/queries/useProjectApiKeysQuery.cjs +49 -0
  223. package/dist/development/src/hooks/queries/useProjectApiKeysQuery.cjs.map +1 -0
  224. package/dist/development/src/hooks/queries/useProjectApiKeysQuery.js +32 -0
  225. package/dist/development/src/hooks/queries/useProjectApiKeysQuery.js.map +1 -0
  226. package/dist/development/src/hooks/queries/useProjectMembersQuery.cjs +1 -1
  227. package/dist/development/src/hooks/queries/useProjectMembersQuery.cjs.map +1 -1
  228. package/dist/development/src/hooks/queries/useProjectMembersQuery.js +1 -1
  229. package/dist/development/src/hooks/queries/useProjectMembersQuery.js.map +1 -1
  230. package/dist/development/src/hooks/queries/useProjectSecretsQuery.cjs +45 -0
  231. package/dist/development/src/hooks/queries/useProjectSecretsQuery.cjs.map +1 -0
  232. package/dist/development/src/hooks/queries/useProjectSecretsQuery.js +28 -0
  233. package/dist/development/src/hooks/queries/useProjectSecretsQuery.js.map +1 -0
  234. package/dist/development/src/hooks/useFetchIdentity.cjs +17 -3
  235. package/dist/development/src/hooks/useFetchIdentity.cjs.map +1 -1
  236. package/dist/development/src/hooks/useFetchIdentity.js +17 -3
  237. package/dist/development/src/hooks/useFetchIdentity.js.map +1 -1
  238. package/dist/development/src/types/forbidden.cjs +16 -0
  239. package/dist/development/src/types/forbidden.cjs.map +1 -0
  240. package/dist/development/src/types/forbidden.js +16 -0
  241. package/dist/development/src/types/forbidden.js.map +1 -0
  242. package/dist/production/index.cjs +123 -0
  243. package/dist/production/index.cjs.map +1 -1
  244. package/dist/production/index.js +123 -0
  245. package/dist/production/index.js.map +1 -1
  246. package/dist/production/src/components/forms/AddProjectMemberForm.cjs +51 -0
  247. package/dist/production/src/components/forms/AddProjectMemberForm.cjs.map +1 -0
  248. package/dist/production/src/components/forms/AddProjectMemberForm.js +51 -0
  249. package/dist/production/src/components/forms/AddProjectMemberForm.js.map +1 -0
  250. package/dist/production/src/components/forms/ChangeMyProfileForm.cjs +50 -0
  251. package/dist/production/src/components/forms/ChangeMyProfileForm.cjs.map +1 -0
  252. package/dist/production/src/components/forms/ChangeMyProfileForm.js +50 -0
  253. package/dist/production/src/components/forms/ChangeMyProfileForm.js.map +1 -0
  254. package/dist/production/src/components/forms/ChangePasswordForm.cjs +49 -0
  255. package/dist/production/src/components/forms/ChangePasswordForm.cjs.map +1 -0
  256. package/dist/production/src/components/forms/ChangePasswordForm.js +49 -0
  257. package/dist/production/src/components/forms/ChangePasswordForm.js.map +1 -0
  258. package/dist/production/src/components/forms/ChangeProfileForm.cjs +46 -0
  259. package/dist/production/src/components/forms/ChangeProfileForm.cjs.map +1 -0
  260. package/dist/production/src/components/forms/ChangeProfileForm.js +46 -0
  261. package/dist/production/src/components/forms/ChangeProfileForm.js.map +1 -0
  262. package/dist/production/src/components/forms/CreateGlobalApiKeyForm.cjs +45 -0
  263. package/dist/production/src/components/forms/CreateGlobalApiKeyForm.cjs.map +1 -0
  264. package/dist/production/src/components/forms/CreateGlobalApiKeyForm.js +45 -0
  265. package/dist/production/src/components/forms/CreateGlobalApiKeyForm.js.map +1 -0
  266. package/dist/production/src/components/forms/EmailOtpConfirmForm.cjs +43 -0
  267. package/dist/production/src/components/forms/EmailOtpConfirmForm.cjs.map +1 -0
  268. package/dist/production/src/components/forms/EmailOtpConfirmForm.js +43 -0
  269. package/dist/production/src/components/forms/EmailOtpConfirmForm.js.map +1 -0
  270. package/dist/production/src/components/forms/InviteForm.cjs +22 -2
  271. package/dist/production/src/components/forms/InviteForm.cjs.map +1 -1
  272. package/dist/production/src/components/forms/InviteForm.js +22 -2
  273. package/dist/production/src/components/forms/InviteForm.js.map +1 -1
  274. package/dist/production/src/components/forms/LoginForm.cjs +6 -2
  275. package/dist/production/src/components/forms/LoginForm.cjs.map +1 -1
  276. package/dist/production/src/components/forms/LoginForm.js +6 -2
  277. package/dist/production/src/components/forms/LoginForm.js.map +1 -1
  278. package/dist/production/src/components/forms/PasswordlessSignInForm.cjs +6 -3
  279. package/dist/production/src/components/forms/PasswordlessSignInForm.cjs.map +1 -1
  280. package/dist/production/src/components/forms/PasswordlessSignInForm.js +6 -3
  281. package/dist/production/src/components/forms/PasswordlessSignInForm.js.map +1 -1
  282. package/dist/production/src/components/forms/PasswordlessSignInInitForm.cjs +2 -1
  283. package/dist/production/src/components/forms/PasswordlessSignInInitForm.cjs.map +1 -1
  284. package/dist/production/src/components/forms/PasswordlessSignInInitForm.js +2 -1
  285. package/dist/production/src/components/forms/PasswordlessSignInInitForm.js.map +1 -1
  286. package/dist/production/src/components/forms/SetProjectSecretForm.cjs +45 -0
  287. package/dist/production/src/components/forms/SetProjectSecretForm.cjs.map +1 -0
  288. package/dist/production/src/components/forms/SetProjectSecretForm.js +45 -0
  289. package/dist/production/src/components/forms/SetProjectSecretForm.js.map +1 -0
  290. package/dist/production/src/components/forms/SignUpForm.cjs +58 -0
  291. package/dist/production/src/components/forms/SignUpForm.cjs.map +1 -0
  292. package/dist/production/src/components/forms/SignUpForm.js +58 -0
  293. package/dist/production/src/components/forms/SignUpForm.js.map +1 -0
  294. package/dist/production/src/components/forms/TenantForm.cjs +6 -2
  295. package/dist/production/src/components/forms/TenantForm.cjs.map +1 -1
  296. package/dist/production/src/components/forms/TenantForm.js +6 -2
  297. package/dist/production/src/components/forms/TenantForm.js.map +1 -1
  298. package/dist/production/src/components/triggers/DisableEmailOtpTrigger.cjs +24 -0
  299. package/dist/production/src/components/triggers/DisableEmailOtpTrigger.cjs.map +1 -0
  300. package/dist/production/src/components/triggers/DisableEmailOtpTrigger.js +24 -0
  301. package/dist/production/src/components/triggers/DisableEmailOtpTrigger.js.map +1 -0
  302. package/dist/production/src/components/triggers/DisableMyPasswordlessTrigger.cjs +24 -0
  303. package/dist/production/src/components/triggers/DisableMyPasswordlessTrigger.cjs.map +1 -0
  304. package/dist/production/src/components/triggers/DisableMyPasswordlessTrigger.js +24 -0
  305. package/dist/production/src/components/triggers/DisableMyPasswordlessTrigger.js.map +1 -0
  306. package/dist/production/src/components/triggers/DisableOtpTrigger.cjs.map +1 -1
  307. package/dist/production/src/components/triggers/DisableOtpTrigger.js.map +1 -1
  308. package/dist/production/src/components/triggers/DisablePersonTrigger.cjs +13 -0
  309. package/dist/production/src/components/triggers/DisablePersonTrigger.cjs.map +1 -0
  310. package/dist/production/src/components/triggers/DisablePersonTrigger.js +13 -0
  311. package/dist/production/src/components/triggers/DisablePersonTrigger.js.map +1 -0
  312. package/dist/production/src/components/triggers/EnableMyPasswordlessTrigger.cjs +24 -0
  313. package/dist/production/src/components/triggers/EnableMyPasswordlessTrigger.cjs.map +1 -0
  314. package/dist/production/src/components/triggers/EnableMyPasswordlessTrigger.js +24 -0
  315. package/dist/production/src/components/triggers/EnableMyPasswordlessTrigger.js.map +1 -0
  316. package/dist/production/src/components/triggers/EnablePersonTrigger.cjs +13 -0
  317. package/dist/production/src/components/triggers/EnablePersonTrigger.cjs.map +1 -0
  318. package/dist/production/src/components/triggers/EnablePersonTrigger.js +13 -0
  319. package/dist/production/src/components/triggers/EnablePersonTrigger.js.map +1 -0
  320. package/dist/production/src/components/triggers/ForceSignOutPersonTrigger.cjs +13 -0
  321. package/dist/production/src/components/triggers/ForceSignOutPersonTrigger.cjs.map +1 -0
  322. package/dist/production/src/components/triggers/ForceSignOutPersonTrigger.js +13 -0
  323. package/dist/production/src/components/triggers/ForceSignOutPersonTrigger.js.map +1 -0
  324. package/dist/production/src/components/triggers/InitEmailOtpTrigger.cjs +12 -0
  325. package/dist/production/src/components/triggers/InitEmailOtpTrigger.cjs.map +1 -0
  326. package/dist/production/src/components/triggers/InitEmailOtpTrigger.js +12 -0
  327. package/dist/production/src/components/triggers/InitEmailOtpTrigger.js.map +1 -0
  328. package/dist/production/src/components/triggers/RegenerateBackupCodesTrigger.cjs +18 -0
  329. package/dist/production/src/components/triggers/RegenerateBackupCodesTrigger.cjs.map +1 -0
  330. package/dist/production/src/components/triggers/RegenerateBackupCodesTrigger.js +18 -0
  331. package/dist/production/src/components/triggers/RegenerateBackupCodesTrigger.js.map +1 -0
  332. package/dist/production/src/components/triggers/RemoveProjectMemberTrigger.cjs.map +1 -1
  333. package/dist/production/src/components/triggers/RemoveProjectMemberTrigger.js.map +1 -1
  334. package/dist/production/src/components/triggers/ResetPersonMfaTrigger.cjs +13 -0
  335. package/dist/production/src/components/triggers/ResetPersonMfaTrigger.cjs.map +1 -0
  336. package/dist/production/src/components/triggers/ResetPersonMfaTrigger.js +13 -0
  337. package/dist/production/src/components/triggers/ResetPersonMfaTrigger.js.map +1 -0
  338. package/dist/production/src/components/triggers/RevokeSessionTrigger.cjs +13 -0
  339. package/dist/production/src/components/triggers/RevokeSessionTrigger.cjs.map +1 -0
  340. package/dist/production/src/components/triggers/RevokeSessionTrigger.js +13 -0
  341. package/dist/production/src/components/triggers/RevokeSessionTrigger.js.map +1 -0
  342. package/dist/production/src/components/triggers/TenantActionTrigger.cjs +6 -2
  343. package/dist/production/src/components/triggers/TenantActionTrigger.cjs.map +1 -1
  344. package/dist/production/src/components/triggers/TenantActionTrigger.js +6 -2
  345. package/dist/production/src/components/triggers/TenantActionTrigger.js.map +1 -1
  346. package/dist/production/src/hooks/mutations/auth/useSignUpMutation.cjs +30 -0
  347. package/dist/production/src/hooks/mutations/auth/useSignUpMutation.cjs.map +1 -0
  348. package/dist/production/src/hooks/mutations/auth/useSignUpMutation.js +13 -0
  349. package/dist/production/src/hooks/mutations/auth/useSignUpMutation.js.map +1 -0
  350. package/dist/production/src/hooks/mutations/emailOtp/useConfirmEmailOtpMutation.cjs +30 -0
  351. package/dist/production/src/hooks/mutations/emailOtp/useConfirmEmailOtpMutation.cjs.map +1 -0
  352. package/dist/production/src/hooks/mutations/emailOtp/useConfirmEmailOtpMutation.js +13 -0
  353. package/dist/production/src/hooks/mutations/emailOtp/useConfirmEmailOtpMutation.js.map +1 -0
  354. package/dist/production/src/hooks/mutations/emailOtp/useDisableEmailOtpMutation.cjs +29 -0
  355. package/dist/production/src/hooks/mutations/emailOtp/useDisableEmailOtpMutation.cjs.map +1 -0
  356. package/dist/production/src/hooks/mutations/emailOtp/useDisableEmailOtpMutation.js +12 -0
  357. package/dist/production/src/hooks/mutations/emailOtp/useDisableEmailOtpMutation.js.map +1 -0
  358. package/dist/production/src/hooks/mutations/emailOtp/useInitEmailOtpMutation.cjs +29 -0
  359. package/dist/production/src/hooks/mutations/emailOtp/useInitEmailOtpMutation.cjs.map +1 -0
  360. package/dist/production/src/hooks/mutations/emailOtp/useInitEmailOtpMutation.js +12 -0
  361. package/dist/production/src/hooks/mutations/emailOtp/useInitEmailOtpMutation.js.map +1 -0
  362. package/dist/production/src/hooks/mutations/identity/useAddGlobalIdentityRolesMutation.cjs +30 -0
  363. package/dist/production/src/hooks/mutations/identity/useAddGlobalIdentityRolesMutation.cjs.map +1 -0
  364. package/dist/production/src/hooks/mutations/identity/useAddGlobalIdentityRolesMutation.js +13 -0
  365. package/dist/production/src/hooks/mutations/identity/useAddGlobalIdentityRolesMutation.js.map +1 -0
  366. package/dist/production/src/hooks/mutations/identity/useRemoveGlobalIdentityRolesMutation.cjs +30 -0
  367. package/dist/production/src/hooks/mutations/identity/useRemoveGlobalIdentityRolesMutation.cjs.map +1 -0
  368. package/dist/production/src/hooks/mutations/identity/useRemoveGlobalIdentityRolesMutation.js +13 -0
  369. package/dist/production/src/hooks/mutations/identity/useRemoveGlobalIdentityRolesMutation.js.map +1 -0
  370. package/dist/production/src/hooks/mutations/idp/useDisconnectMyIdentityProviderMutation.cjs +29 -0
  371. package/dist/production/src/hooks/mutations/idp/useDisconnectMyIdentityProviderMutation.cjs.map +1 -0
  372. package/dist/production/src/hooks/mutations/idp/useDisconnectMyIdentityProviderMutation.js +12 -0
  373. package/dist/production/src/hooks/mutations/idp/useDisconnectMyIdentityProviderMutation.js.map +1 -0
  374. package/dist/production/src/hooks/mutations/invite/useUnmanagedInviteMutation.cjs +30 -0
  375. package/dist/production/src/hooks/mutations/invite/useUnmanagedInviteMutation.cjs.map +1 -0
  376. package/dist/production/src/hooks/mutations/invite/useUnmanagedInviteMutation.js +13 -0
  377. package/dist/production/src/hooks/mutations/invite/useUnmanagedInviteMutation.js.map +1 -0
  378. package/dist/production/src/hooks/mutations/otp/useRegenerateBackupCodesMutation.cjs +30 -0
  379. package/dist/production/src/hooks/mutations/otp/useRegenerateBackupCodesMutation.cjs.map +1 -0
  380. package/dist/production/src/hooks/mutations/otp/useRegenerateBackupCodesMutation.js +13 -0
  381. package/dist/production/src/hooks/mutations/otp/useRegenerateBackupCodesMutation.js.map +1 -0
  382. package/dist/production/src/hooks/mutations/person/useChangePasswordMutation.cjs +29 -0
  383. package/dist/production/src/hooks/mutations/person/useChangePasswordMutation.cjs.map +1 -0
  384. package/dist/production/src/hooks/mutations/person/useChangePasswordMutation.js +12 -0
  385. package/dist/production/src/hooks/mutations/person/useChangePasswordMutation.js.map +1 -0
  386. package/dist/production/src/hooks/mutations/person/useDisablePersonMutation.cjs +29 -0
  387. package/dist/production/src/hooks/mutations/person/useDisablePersonMutation.cjs.map +1 -0
  388. package/dist/production/src/hooks/mutations/person/useDisablePersonMutation.js +12 -0
  389. package/dist/production/src/hooks/mutations/person/useDisablePersonMutation.js.map +1 -0
  390. package/dist/production/src/hooks/mutations/person/useEnablePersonMutation.cjs +29 -0
  391. package/dist/production/src/hooks/mutations/person/useEnablePersonMutation.cjs.map +1 -0
  392. package/dist/production/src/hooks/mutations/person/useEnablePersonMutation.js +12 -0
  393. package/dist/production/src/hooks/mutations/person/useEnablePersonMutation.js.map +1 -0
  394. package/dist/production/src/hooks/mutations/person/useForceSignOutPersonMutation.cjs +29 -0
  395. package/dist/production/src/hooks/mutations/person/useForceSignOutPersonMutation.cjs.map +1 -0
  396. package/dist/production/src/hooks/mutations/person/useForceSignOutPersonMutation.js +12 -0
  397. package/dist/production/src/hooks/mutations/person/useForceSignOutPersonMutation.js.map +1 -0
  398. package/dist/production/src/hooks/mutations/person/useResetPersonMfaMutation.cjs +29 -0
  399. package/dist/production/src/hooks/mutations/person/useResetPersonMfaMutation.cjs.map +1 -0
  400. package/dist/production/src/hooks/mutations/person/useResetPersonMfaMutation.js +12 -0
  401. package/dist/production/src/hooks/mutations/person/useResetPersonMfaMutation.js.map +1 -0
  402. package/dist/production/src/hooks/mutations/project/useSetProjectSecretMutation.cjs +29 -0
  403. package/dist/production/src/hooks/mutations/project/useSetProjectSecretMutation.cjs.map +1 -0
  404. package/dist/production/src/hooks/mutations/project/useSetProjectSecretMutation.js +12 -0
  405. package/dist/production/src/hooks/mutations/project/useSetProjectSecretMutation.js.map +1 -0
  406. package/dist/production/src/hooks/mutations/session/useRevokeSessionMutation.cjs +29 -0
  407. package/dist/production/src/hooks/mutations/session/useRevokeSessionMutation.cjs.map +1 -0
  408. package/dist/production/src/hooks/mutations/session/useRevokeSessionMutation.js +12 -0
  409. package/dist/production/src/hooks/mutations/session/useRevokeSessionMutation.js.map +1 -0
  410. package/dist/production/src/hooks/queries/useAuthLogQuery.cjs +39 -0
  411. package/dist/production/src/hooks/queries/useAuthLogQuery.cjs.map +1 -0
  412. package/dist/production/src/hooks/queries/useAuthLogQuery.js +22 -0
  413. package/dist/production/src/hooks/queries/useAuthLogQuery.js.map +1 -0
  414. package/dist/production/src/hooks/queries/useAuthPoliciesQuery.cjs +32 -0
  415. package/dist/production/src/hooks/queries/useAuthPoliciesQuery.cjs.map +1 -0
  416. package/dist/production/src/hooks/queries/useAuthPoliciesQuery.js +15 -0
  417. package/dist/production/src/hooks/queries/useAuthPoliciesQuery.js.map +1 -0
  418. package/dist/production/src/hooks/queries/useConfigurationQuery.cjs +33 -0
  419. package/dist/production/src/hooks/queries/useConfigurationQuery.cjs.map +1 -0
  420. package/dist/production/src/hooks/queries/useConfigurationQuery.js +16 -0
  421. package/dist/production/src/hooks/queries/useConfigurationQuery.js.map +1 -0
  422. package/dist/production/src/hooks/queries/useGlobalApiKeysQuery.cjs +32 -0
  423. package/dist/production/src/hooks/queries/useGlobalApiKeysQuery.cjs.map +1 -0
  424. package/dist/production/src/hooks/queries/useGlobalApiKeysQuery.js +15 -0
  425. package/dist/production/src/hooks/queries/useGlobalApiKeysQuery.js.map +1 -0
  426. package/dist/production/src/hooks/queries/useIdentityProvidersQuery.cjs +32 -0
  427. package/dist/production/src/hooks/queries/useIdentityProvidersQuery.cjs.map +1 -0
  428. package/dist/production/src/hooks/queries/useIdentityProvidersQuery.js +15 -0
  429. package/dist/production/src/hooks/queries/useIdentityProvidersQuery.js.map +1 -0
  430. package/dist/production/src/hooks/queries/useMailTemplatesQuery.cjs +32 -0
  431. package/dist/production/src/hooks/queries/useMailTemplatesQuery.cjs.map +1 -0
  432. package/dist/production/src/hooks/queries/useMailTemplatesQuery.js +15 -0
  433. package/dist/production/src/hooks/queries/useMailTemplatesQuery.js.map +1 -0
  434. package/dist/production/src/hooks/queries/useMeQuery.cjs +4 -2
  435. package/dist/production/src/hooks/queries/useMeQuery.cjs.map +1 -1
  436. package/dist/production/src/hooks/queries/useMeQuery.js +4 -2
  437. package/dist/production/src/hooks/queries/useMeQuery.js.map +1 -1
  438. package/dist/production/src/hooks/queries/useMyIdentityProvidersQuery.cjs +38 -0
  439. package/dist/production/src/hooks/queries/useMyIdentityProvidersQuery.cjs.map +1 -0
  440. package/dist/production/src/hooks/queries/useMyIdentityProvidersQuery.js +21 -0
  441. package/dist/production/src/hooks/queries/useMyIdentityProvidersQuery.js.map +1 -0
  442. package/dist/production/src/hooks/queries/useMySessionsQuery.cjs +34 -0
  443. package/dist/production/src/hooks/queries/useMySessionsQuery.cjs.map +1 -0
  444. package/dist/production/src/hooks/queries/useMySessionsQuery.js +17 -0
  445. package/dist/production/src/hooks/queries/useMySessionsQuery.js.map +1 -0
  446. package/dist/production/src/hooks/queries/usePersonQuery.cjs +40 -0
  447. package/dist/production/src/hooks/queries/usePersonQuery.cjs.map +1 -0
  448. package/dist/production/src/hooks/queries/usePersonQuery.js +23 -0
  449. package/dist/production/src/hooks/queries/usePersonQuery.js.map +1 -0
  450. package/dist/production/src/hooks/queries/usePersonSessionsQuery.cjs +39 -0
  451. package/dist/production/src/hooks/queries/usePersonSessionsQuery.cjs.map +1 -0
  452. package/dist/production/src/hooks/queries/usePersonSessionsQuery.js +22 -0
  453. package/dist/production/src/hooks/queries/usePersonSessionsQuery.js.map +1 -0
  454. package/dist/production/src/hooks/queries/usePersonsQuery.cjs +45 -0
  455. package/dist/production/src/hooks/queries/usePersonsQuery.cjs.map +1 -0
  456. package/dist/production/src/hooks/queries/usePersonsQuery.js +28 -0
  457. package/dist/production/src/hooks/queries/usePersonsQuery.js.map +1 -0
  458. package/dist/production/src/hooks/queries/useProjectApiKeysQuery.cjs +49 -0
  459. package/dist/production/src/hooks/queries/useProjectApiKeysQuery.cjs.map +1 -0
  460. package/dist/production/src/hooks/queries/useProjectApiKeysQuery.js +32 -0
  461. package/dist/production/src/hooks/queries/useProjectApiKeysQuery.js.map +1 -0
  462. package/dist/production/src/hooks/queries/useProjectMembersQuery.cjs +1 -1
  463. package/dist/production/src/hooks/queries/useProjectMembersQuery.cjs.map +1 -1
  464. package/dist/production/src/hooks/queries/useProjectMembersQuery.js +1 -1
  465. package/dist/production/src/hooks/queries/useProjectMembersQuery.js.map +1 -1
  466. package/dist/production/src/hooks/queries/useProjectSecretsQuery.cjs +45 -0
  467. package/dist/production/src/hooks/queries/useProjectSecretsQuery.cjs.map +1 -0
  468. package/dist/production/src/hooks/queries/useProjectSecretsQuery.js +28 -0
  469. package/dist/production/src/hooks/queries/useProjectSecretsQuery.js.map +1 -0
  470. package/dist/production/src/hooks/useFetchIdentity.cjs +17 -3
  471. package/dist/production/src/hooks/useFetchIdentity.cjs.map +1 -1
  472. package/dist/production/src/hooks/useFetchIdentity.js +17 -3
  473. package/dist/production/src/hooks/useFetchIdentity.js.map +1 -1
  474. package/dist/production/src/types/forbidden.cjs +16 -0
  475. package/dist/production/src/types/forbidden.cjs.map +1 -0
  476. package/dist/production/src/types/forbidden.js +16 -0
  477. package/dist/production/src/types/forbidden.js.map +1 -0
  478. package/dist/types/components/IdentityState.d.ts.map +1 -1
  479. package/dist/types/components/forms/AddProjectMemberForm.d.ts +20 -0
  480. package/dist/types/components/forms/AddProjectMemberForm.d.ts.map +1 -0
  481. package/dist/types/components/forms/ChangeMyPasswordForm.d.ts.map +1 -1
  482. package/dist/types/components/forms/ChangeMyProfileForm.d.ts +20 -0
  483. package/dist/types/components/forms/ChangeMyProfileForm.d.ts.map +1 -0
  484. package/dist/types/components/forms/ChangePasswordForm.d.ts +19 -0
  485. package/dist/types/components/forms/ChangePasswordForm.d.ts.map +1 -0
  486. package/dist/types/components/forms/ChangeProfileForm.d.ts +21 -0
  487. package/dist/types/components/forms/ChangeProfileForm.d.ts.map +1 -0
  488. package/dist/types/components/forms/ConfirmEmailChangeForm.d.ts.map +1 -1
  489. package/dist/types/components/forms/CreateApiKeyForm.d.ts.map +1 -1
  490. package/dist/types/components/forms/CreateGlobalApiKeyForm.d.ts +22 -0
  491. package/dist/types/components/forms/CreateGlobalApiKeyForm.d.ts.map +1 -0
  492. package/dist/types/components/forms/CreateSessionTokenForm.d.ts.map +1 -1
  493. package/dist/types/components/forms/EmailOtpConfirmForm.d.ts +21 -0
  494. package/dist/types/components/forms/EmailOtpConfirmForm.d.ts.map +1 -0
  495. package/dist/types/components/forms/InviteForm.d.ts +12 -1
  496. package/dist/types/components/forms/InviteForm.d.ts.map +1 -1
  497. package/dist/types/components/forms/LoginForm.d.ts +2 -0
  498. package/dist/types/components/forms/LoginForm.d.ts.map +1 -1
  499. package/dist/types/components/forms/OtpConfirmForm.d.ts.map +1 -1
  500. package/dist/types/components/forms/OtpPrepareForm.d.ts.map +1 -1
  501. package/dist/types/components/forms/PasswordResetForm.d.ts.map +1 -1
  502. package/dist/types/components/forms/PasswordResetRequestForm.d.ts.map +1 -1
  503. package/dist/types/components/forms/PasswordlessSignInForm.d.ts +2 -0
  504. package/dist/types/components/forms/PasswordlessSignInForm.d.ts.map +1 -1
  505. package/dist/types/components/forms/PasswordlessSignInInitForm.d.ts.map +1 -1
  506. package/dist/types/components/forms/RequestEmailVerificationForm.d.ts.map +1 -1
  507. package/dist/types/components/forms/SetProjectSecretForm.d.ts +19 -0
  508. package/dist/types/components/forms/SetProjectSecretForm.d.ts.map +1 -0
  509. package/dist/types/components/forms/SignUpForm.d.ts +31 -0
  510. package/dist/types/components/forms/SignUpForm.d.ts.map +1 -0
  511. package/dist/types/components/forms/TenantForm.d.ts.map +1 -1
  512. package/dist/types/components/forms/UpdateProjectMemberForm.d.ts.map +1 -1
  513. package/dist/types/components/forms/VerifyEmailForm.d.ts.map +1 -1
  514. package/dist/types/components/forms/index.d.ts +8 -0
  515. package/dist/types/components/forms/index.d.ts.map +1 -1
  516. package/dist/types/components/idp/IDP.d.ts.map +1 -1
  517. package/dist/types/components/idp/IDPInitTrigger.d.ts.map +1 -1
  518. package/dist/types/components/idp/IDPState.d.ts.map +1 -1
  519. package/dist/types/components/triggers/DisableEmailOtpTrigger.d.ts +10 -0
  520. package/dist/types/components/triggers/DisableEmailOtpTrigger.d.ts.map +1 -0
  521. package/dist/types/components/triggers/DisableMyPasswordlessTrigger.d.ts +10 -0
  522. package/dist/types/components/triggers/DisableMyPasswordlessTrigger.d.ts.map +1 -0
  523. package/dist/types/components/triggers/DisableOtpTrigger.d.ts +3 -1
  524. package/dist/types/components/triggers/DisableOtpTrigger.d.ts.map +1 -1
  525. package/dist/types/components/triggers/DisablePersonTrigger.d.ts +11 -0
  526. package/dist/types/components/triggers/DisablePersonTrigger.d.ts.map +1 -0
  527. package/dist/types/components/triggers/EnableMyPasswordlessTrigger.d.ts +10 -0
  528. package/dist/types/components/triggers/EnableMyPasswordlessTrigger.d.ts.map +1 -0
  529. package/dist/types/components/triggers/EnablePersonTrigger.d.ts +11 -0
  530. package/dist/types/components/triggers/EnablePersonTrigger.d.ts.map +1 -0
  531. package/dist/types/components/triggers/ForceSignOutPersonTrigger.d.ts +11 -0
  532. package/dist/types/components/triggers/ForceSignOutPersonTrigger.d.ts.map +1 -0
  533. package/dist/types/components/triggers/InitEmailOtpTrigger.d.ts +10 -0
  534. package/dist/types/components/triggers/InitEmailOtpTrigger.d.ts.map +1 -0
  535. package/dist/types/components/triggers/LogoutTrigger.d.ts.map +1 -1
  536. package/dist/types/components/triggers/RegenerateBackupCodesTrigger.d.ts +14 -0
  537. package/dist/types/components/triggers/RegenerateBackupCodesTrigger.d.ts.map +1 -0
  538. package/dist/types/components/triggers/RemoveProjectMemberTrigger.d.ts +3 -1
  539. package/dist/types/components/triggers/RemoveProjectMemberTrigger.d.ts.map +1 -1
  540. package/dist/types/components/triggers/ResetPersonMfaTrigger.d.ts +11 -0
  541. package/dist/types/components/triggers/ResetPersonMfaTrigger.d.ts.map +1 -0
  542. package/dist/types/components/triggers/RevokeSessionTrigger.d.ts +11 -0
  543. package/dist/types/components/triggers/RevokeSessionTrigger.d.ts.map +1 -0
  544. package/dist/types/components/triggers/TenantActionTrigger.d.ts +7 -4
  545. package/dist/types/components/triggers/TenantActionTrigger.d.ts.map +1 -1
  546. package/dist/types/components/triggers/index.d.ts +11 -0
  547. package/dist/types/components/triggers/index.d.ts.map +1 -1
  548. package/dist/types/hooks/mutations/auth/index.d.ts +1 -0
  549. package/dist/types/hooks/mutations/auth/index.d.ts.map +1 -1
  550. package/dist/types/hooks/mutations/auth/useSignUpMutation.d.ts +95 -0
  551. package/dist/types/hooks/mutations/auth/useSignUpMutation.d.ts.map +1 -0
  552. package/dist/types/hooks/mutations/emailOtp/index.d.ts +4 -0
  553. package/dist/types/hooks/mutations/emailOtp/index.d.ts.map +1 -0
  554. package/dist/types/hooks/mutations/emailOtp/useConfirmEmailOtpMutation.d.ts +31 -0
  555. package/dist/types/hooks/mutations/emailOtp/useConfirmEmailOtpMutation.d.ts.map +1 -0
  556. package/dist/types/hooks/mutations/emailOtp/useDisableEmailOtpMutation.d.ts +15 -0
  557. package/dist/types/hooks/mutations/emailOtp/useDisableEmailOtpMutation.d.ts.map +1 -0
  558. package/dist/types/hooks/mutations/emailOtp/useInitEmailOtpMutation.d.ts +15 -0
  559. package/dist/types/hooks/mutations/emailOtp/useInitEmailOtpMutation.d.ts.map +1 -0
  560. package/dist/types/hooks/mutations/identity/index.d.ts +3 -0
  561. package/dist/types/hooks/mutations/identity/index.d.ts.map +1 -0
  562. package/dist/types/hooks/mutations/identity/useAddGlobalIdentityRolesMutation.d.ts +51 -0
  563. package/dist/types/hooks/mutations/identity/useAddGlobalIdentityRolesMutation.d.ts.map +1 -0
  564. package/dist/types/hooks/mutations/identity/useRemoveGlobalIdentityRolesMutation.d.ts +51 -0
  565. package/dist/types/hooks/mutations/identity/useRemoveGlobalIdentityRolesMutation.d.ts.map +1 -0
  566. package/dist/types/hooks/mutations/idp/index.d.ts +1 -0
  567. package/dist/types/hooks/mutations/idp/index.d.ts.map +1 -1
  568. package/dist/types/hooks/mutations/idp/useDisconnectMyIdentityProviderMutation.d.ts +19 -0
  569. package/dist/types/hooks/mutations/idp/useDisconnectMyIdentityProviderMutation.d.ts.map +1 -0
  570. package/dist/types/hooks/mutations/index.d.ts +5 -0
  571. package/dist/types/hooks/mutations/index.d.ts.map +1 -1
  572. package/dist/types/hooks/mutations/invite/index.d.ts +1 -0
  573. package/dist/types/hooks/mutations/invite/index.d.ts.map +1 -1
  574. package/dist/types/hooks/mutations/invite/useUnmanagedInviteMutation.d.ts +104 -0
  575. package/dist/types/hooks/mutations/invite/useUnmanagedInviteMutation.d.ts.map +1 -0
  576. package/dist/types/hooks/mutations/otp/index.d.ts +1 -0
  577. package/dist/types/hooks/mutations/otp/index.d.ts.map +1 -1
  578. package/dist/types/hooks/mutations/otp/useRegenerateBackupCodesMutation.d.ts +27 -0
  579. package/dist/types/hooks/mutations/otp/useRegenerateBackupCodesMutation.d.ts.map +1 -0
  580. package/dist/types/hooks/mutations/person/index.d.ts +6 -0
  581. package/dist/types/hooks/mutations/person/index.d.ts.map +1 -0
  582. package/dist/types/hooks/mutations/person/useChangePasswordMutation.d.ts +25 -0
  583. package/dist/types/hooks/mutations/person/useChangePasswordMutation.d.ts.map +1 -0
  584. package/dist/types/hooks/mutations/person/useDisablePersonMutation.d.ts +19 -0
  585. package/dist/types/hooks/mutations/person/useDisablePersonMutation.d.ts.map +1 -0
  586. package/dist/types/hooks/mutations/person/useEnablePersonMutation.d.ts +19 -0
  587. package/dist/types/hooks/mutations/person/useEnablePersonMutation.d.ts.map +1 -0
  588. package/dist/types/hooks/mutations/person/useForceSignOutPersonMutation.d.ts +21 -0
  589. package/dist/types/hooks/mutations/person/useForceSignOutPersonMutation.d.ts.map +1 -0
  590. package/dist/types/hooks/mutations/person/useResetPersonMfaMutation.d.ts +19 -0
  591. package/dist/types/hooks/mutations/person/useResetPersonMfaMutation.d.ts.map +1 -0
  592. package/dist/types/hooks/mutations/project/index.d.ts +2 -0
  593. package/dist/types/hooks/mutations/project/index.d.ts.map +1 -0
  594. package/dist/types/hooks/mutations/project/useSetProjectSecretMutation.d.ts +23 -0
  595. package/dist/types/hooks/mutations/project/useSetProjectSecretMutation.d.ts.map +1 -0
  596. package/dist/types/hooks/mutations/session/index.d.ts +2 -0
  597. package/dist/types/hooks/mutations/session/index.d.ts.map +1 -0
  598. package/dist/types/hooks/mutations/session/useRevokeSessionMutation.d.ts +19 -0
  599. package/dist/types/hooks/mutations/session/useRevokeSessionMutation.d.ts.map +1 -0
  600. package/dist/types/hooks/queries/index.d.ts +13 -0
  601. package/dist/types/hooks/queries/index.d.ts.map +1 -1
  602. package/dist/types/hooks/queries/useAuthLogQuery.d.ts +48 -0
  603. package/dist/types/hooks/queries/useAuthLogQuery.d.ts.map +1 -0
  604. package/dist/types/hooks/queries/useAuthPoliciesQuery.d.ts +35 -0
  605. package/dist/types/hooks/queries/useAuthPoliciesQuery.d.ts.map +1 -0
  606. package/dist/types/hooks/queries/useConfigurationQuery.d.ts +139 -0
  607. package/dist/types/hooks/queries/useConfigurationQuery.d.ts.map +1 -0
  608. package/dist/types/hooks/queries/useGlobalApiKeysQuery.d.ts +30 -0
  609. package/dist/types/hooks/queries/useGlobalApiKeysQuery.d.ts.map +1 -0
  610. package/dist/types/hooks/queries/useIdentityProvidersQuery.d.ts +43 -0
  611. package/dist/types/hooks/queries/useIdentityProvidersQuery.d.ts.map +1 -0
  612. package/dist/types/hooks/queries/useMailTemplatesQuery.d.ts +30 -0
  613. package/dist/types/hooks/queries/useMailTemplatesQuery.d.ts.map +1 -0
  614. package/dist/types/hooks/queries/useMeQuery.d.ts +42 -0
  615. package/dist/types/hooks/queries/useMeQuery.d.ts.map +1 -1
  616. package/dist/types/hooks/queries/useMyIdentityProvidersQuery.d.ts +22 -0
  617. package/dist/types/hooks/queries/useMyIdentityProvidersQuery.d.ts.map +1 -0
  618. package/dist/types/hooks/queries/useMySessionsQuery.d.ts +28 -0
  619. package/dist/types/hooks/queries/useMySessionsQuery.d.ts.map +1 -0
  620. package/dist/types/hooks/queries/usePersonQuery.d.ts +99 -0
  621. package/dist/types/hooks/queries/usePersonQuery.d.ts.map +1 -0
  622. package/dist/types/hooks/queries/usePersonSessionsQuery.d.ts +31 -0
  623. package/dist/types/hooks/queries/usePersonSessionsQuery.d.ts.map +1 -0
  624. package/dist/types/hooks/queries/usePersonsQuery.d.ts +41 -0
  625. package/dist/types/hooks/queries/usePersonsQuery.d.ts.map +1 -0
  626. package/dist/types/hooks/queries/useProjectApiKeysQuery.d.ts +55 -0
  627. package/dist/types/hooks/queries/useProjectApiKeysQuery.d.ts.map +1 -0
  628. package/dist/types/hooks/queries/useProjectMembersQuery.d.ts +4 -0
  629. package/dist/types/hooks/queries/useProjectMembersQuery.d.ts.map +1 -1
  630. package/dist/types/hooks/queries/useProjectMembershipsQuery.d.ts.map +1 -1
  631. package/dist/types/hooks/queries/useProjectRolesDefinitionQuery.d.ts +19 -19
  632. package/dist/types/hooks/queries/useProjectRolesDefinitionQuery.d.ts.map +1 -1
  633. package/dist/types/hooks/queries/useProjectSecretsQuery.d.ts +17 -0
  634. package/dist/types/hooks/queries/useProjectSecretsQuery.d.ts.map +1 -0
  635. package/dist/types/hooks/useFetchIdentity.d.ts.map +1 -1
  636. package/dist/types/hooks/useLogout.d.ts.map +1 -1
  637. package/dist/types/hooks/usePasswordlessOtpActivator.d.ts.map +1 -1
  638. package/dist/types/hooks/useTenantApi.d.ts +1 -1
  639. package/dist/types/hooks/useTenantApi.d.ts.map +1 -1
  640. package/dist/types/hooks/useTenantMutation.d.ts.map +1 -1
  641. package/dist/types/hooks/useTenantQueryLoader.d.ts.map +1 -1
  642. package/dist/types/internal/hooks/useHandleIDPResponse.d.ts.map +1 -1
  643. package/dist/types/internal/hooks/useInitIDPRedirect.d.ts.map +1 -1
  644. package/dist/types/internal/hooks/useLogoutInternal.d.ts.map +1 -1
  645. package/dist/types/internal/hooks/useRedirectToBacklink.d.ts +1 -1
  646. package/dist/types/internal/hooks/useRedirectToBacklink.d.ts.map +1 -1
  647. package/dist/types/internal/utils/hashing.d.ts.map +1 -1
  648. package/dist/types/internal/utils/randomInt.d.ts.map +1 -1
  649. package/dist/types/tsconfig.tsbuildinfo +1 -1
  650. package/dist/types/types/Identity.d.ts +42 -3
  651. package/dist/types/types/Identity.d.ts.map +1 -1
  652. package/dist/types/types/forbidden.d.ts +21 -0
  653. package/dist/types/types/forbidden.d.ts.map +1 -0
  654. package/dist/types/types/forms.d.ts +6 -1
  655. package/dist/types/types/forms.d.ts.map +1 -1
  656. package/dist/types/types/index.d.ts +1 -0
  657. package/dist/types/types/index.d.ts.map +1 -1
  658. package/package.json +5 -4
  659. package/src/components/forms/AddProjectMemberForm.tsx +74 -0
  660. package/src/components/forms/ChangeMyProfileForm.tsx +73 -0
  661. package/src/components/forms/ChangePasswordForm.tsx +73 -0
  662. package/src/components/forms/ChangeProfileForm.tsx +70 -0
  663. package/src/components/forms/CreateGlobalApiKeyForm.tsx +67 -0
  664. package/src/components/forms/EmailOtpConfirmForm.tsx +64 -0
  665. package/src/components/forms/InviteForm.tsx +36 -2
  666. package/src/components/forms/LoginForm.tsx +8 -1
  667. package/src/components/forms/PasswordlessSignInForm.tsx +7 -1
  668. package/src/components/forms/PasswordlessSignInInitForm.tsx +1 -0
  669. package/src/components/forms/SetProjectSecretForm.tsx +67 -0
  670. package/src/components/forms/SignUpForm.tsx +91 -0
  671. package/src/components/forms/TenantForm.tsx +6 -2
  672. package/src/components/forms/index.ts +8 -0
  673. package/src/components/triggers/DisableEmailOtpTrigger.tsx +27 -0
  674. package/src/components/triggers/DisableMyPasswordlessTrigger.tsx +27 -0
  675. package/src/components/triggers/DisableOtpTrigger.tsx +3 -2
  676. package/src/components/triggers/DisablePersonTrigger.tsx +18 -0
  677. package/src/components/triggers/EnableMyPasswordlessTrigger.tsx +27 -0
  678. package/src/components/triggers/EnablePersonTrigger.tsx +18 -0
  679. package/src/components/triggers/ForceSignOutPersonTrigger.tsx +18 -0
  680. package/src/components/triggers/InitEmailOtpTrigger.tsx +17 -0
  681. package/src/components/triggers/RegenerateBackupCodesTrigger.tsx +22 -0
  682. package/src/components/triggers/RemoveProjectMemberTrigger.tsx +3 -2
  683. package/src/components/triggers/ResetPersonMfaTrigger.tsx +18 -0
  684. package/src/components/triggers/RevokeSessionTrigger.tsx +18 -0
  685. package/src/components/triggers/TenantActionTrigger.tsx +11 -3
  686. package/src/components/triggers/index.ts +11 -0
  687. package/src/hooks/mutations/auth/index.ts +1 -0
  688. package/src/hooks/mutations/auth/useSignUpMutation.ts +28 -0
  689. package/src/hooks/mutations/emailOtp/index.ts +3 -0
  690. package/src/hooks/mutations/emailOtp/useConfirmEmailOtpMutation.ts +19 -0
  691. package/src/hooks/mutations/emailOtp/useDisableEmailOtpMutation.ts +13 -0
  692. package/src/hooks/mutations/emailOtp/useInitEmailOtpMutation.ts +13 -0
  693. package/src/hooks/mutations/identity/index.ts +2 -0
  694. package/src/hooks/mutations/identity/useAddGlobalIdentityRolesMutation.ts +19 -0
  695. package/src/hooks/mutations/identity/useRemoveGlobalIdentityRolesMutation.ts +19 -0
  696. package/src/hooks/mutations/idp/index.ts +1 -0
  697. package/src/hooks/mutations/idp/useDisconnectMyIdentityProviderMutation.tsx +13 -0
  698. package/src/hooks/mutations/index.ts +5 -0
  699. package/src/hooks/mutations/invite/index.ts +1 -0
  700. package/src/hooks/mutations/invite/useUnmanagedInviteMutation.tsx +25 -0
  701. package/src/hooks/mutations/otp/index.ts +1 -0
  702. package/src/hooks/mutations/otp/useRegenerateBackupCodesMutation.ts +19 -0
  703. package/src/hooks/mutations/person/index.ts +5 -0
  704. package/src/hooks/mutations/person/useChangePasswordMutation.ts +14 -0
  705. package/src/hooks/mutations/person/useDisablePersonMutation.ts +13 -0
  706. package/src/hooks/mutations/person/useEnablePersonMutation.ts +13 -0
  707. package/src/hooks/mutations/person/useForceSignOutPersonMutation.ts +13 -0
  708. package/src/hooks/mutations/person/useResetPersonMfaMutation.ts +13 -0
  709. package/src/hooks/mutations/project/index.ts +1 -0
  710. package/src/hooks/mutations/project/useSetProjectSecretMutation.ts +13 -0
  711. package/src/hooks/mutations/session/index.ts +1 -0
  712. package/src/hooks/mutations/session/useRevokeSessionMutation.ts +13 -0
  713. package/src/hooks/queries/index.ts +13 -0
  714. package/src/hooks/queries/useAuthLogQuery.ts +28 -0
  715. package/src/hooks/queries/useAuthPoliciesQuery.ts +26 -0
  716. package/src/hooks/queries/useConfigurationQuery.ts +42 -0
  717. package/src/hooks/queries/useGlobalApiKeysQuery.ts +19 -0
  718. package/src/hooks/queries/useIdentityProvidersQuery.ts +31 -0
  719. package/src/hooks/queries/useMailTemplatesQuery.ts +25 -0
  720. package/src/hooks/queries/useMeQuery.ts +6 -2
  721. package/src/hooks/queries/useMyIdentityProvidersQuery.ts +25 -0
  722. package/src/hooks/queries/useMySessionsQuery.ts +19 -0
  723. package/src/hooks/queries/usePersonQuery.ts +35 -0
  724. package/src/hooks/queries/usePersonSessionsQuery.ts +27 -0
  725. package/src/hooks/queries/usePersonsQuery.ts +37 -0
  726. package/src/hooks/queries/useProjectApiKeysQuery.ts +43 -0
  727. package/src/hooks/queries/useProjectMembersQuery.ts +1 -1
  728. package/src/hooks/queries/useProjectSecretsQuery.ts +33 -0
  729. package/src/hooks/useFetchIdentity.ts +18 -3
  730. package/src/tsconfig.json +1 -0
  731. package/src/types/Identity.ts +44 -3
  732. package/src/types/forbidden.ts +31 -0
  733. package/src/types/forms.ts +6 -1
  734. package/src/types/index.ts +1 -0
  735. package/tests/TenantForm.test.tsx +54 -0
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordlessSignInForm.js","sources":["../../../../../../packages/react-client-tenant/src/components/forms/PasswordlessSignInForm.tsx"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { useSetSessionToken } from '@contember/react-client'\nimport { ReactElement, useCallback, useMemo } from 'react'\nimport { useForm } from '../../contexts.js'\nimport { SignInPasswordlessMutationResult, useSignInPasswordlessMutation } from '../../hooks/index.js'\nimport { useRedirectToBacklinkCallback } from '../../internal/hooks/useRedirectToBacklink.js'\nimport { FormContextValue, FormError, FormState } from '../../types/forms.js'\nimport { TenantForm } from './TenantForm.js'\n\nexport type PasswordlessSignInFormValues = {\n\ttoken: string\n\totpToken: string\n}\n\nexport type PasswordlessSignInFormErrorCode =\n\t| TenantApi.SignInPasswordlessErrorCode\n\t| 'FIELD_REQUIRED'\n\t| 'INVALID_VALUE'\n\t| 'UNKNOWN_ERROR'\n\nexport type PasswordlessSignInFormState =\n\t| FormState\n\t| 'otp-required'\n\nexport type PasswordlessSignInFormError = FormError<PasswordlessSignInFormValues, PasswordlessSignInFormErrorCode>\n\nexport type PasswordlessSignInFormContextValue = FormContextValue<\n\tPasswordlessSignInFormValues,\n\tPasswordlessSignInFormErrorCode,\n\tPasswordlessSignInFormState\n>\n\nexport interface PasswordlessSignInFormProps {\n\trequestId: string\n\tvalidationType: TenantApi.PasswordlessValidationType\n\ttoken?: string\n\texpiration?: number\n\tchildren: ReactElement\n\tonSuccess?: () => void\n}\n\nexport const usePasswordlessSignInForm = useForm as () => PasswordlessSignInFormContextValue\n\nconst headers = {\n\t'X-Contember-Token-Path': 'data.mutation.result.token',\n}\nconst DEFAULT_LOGIN_EXPIRATION = 14 * 24 * 60 // 14 days\n\nexport const PasswordlessSignInForm = (\n\t{ children, onSuccess, requestId, validationType, token, expiration = DEFAULT_LOGIN_EXPIRATION }: PasswordlessSignInFormProps,\n) => {\n\tconst signIn = useSignInPasswordlessMutation({ headers })\n\tconst redirectToBacklink = useRedirectToBacklinkCallback()\n\tconst setSessionToken = useSetSessionToken()\n\treturn (\n\t\t<TenantForm<PasswordlessSignInFormContextValue, SignInPasswordlessMutationResult>\n\t\t\tonSuccess={args => {\n\t\t\t\tonSuccess?.()\n\t\t\t\tsetSessionToken(args.result.token)\n\t\t\t\tredirectToBacklink()\n\t\t\t}}\n\t\t\terrorMapping={errorToField}\n\t\t\tinitialValues={useMemo(() => ({\n\t\t\t\ttoken: token ?? '',\n\t\t\t\totpToken: '',\n\t\t\t}), [token])}\n\t\t\tvalidate={({ values, state }) => {\n\t\t\t\tif (!values.token) {\n\t\t\t\t\treturn [{ code: 'FIELD_REQUIRED', field: 'token' }]\n\t\t\t\t}\n\t\t\t\tif (!values.otpToken && state === 'otp-required') {\n\t\t\t\t\treturn [{ code: 'FIELD_REQUIRED', field: 'otpToken' }]\n\t\t\t\t} else if (values.otpToken && !values.otpToken.match(/^\\d{6}$/)) {\n\t\t\t\t\treturn [{ code: 'INVALID_VALUE', field: 'otpToken' }]\n\t\t\t\t}\n\t\t\t\treturn []\n\t\t\t}}\n\t\t\texecute={useCallback(async ({ values }) => {\n\t\t\t\tconst result = await signIn({\n\t\t\t\t\trequestId,\n\t\t\t\t\texpiration,\n\t\t\t\t\ttoken: values.token,\n\t\t\t\t\tmfaOtp: values.otpToken || undefined,\n\t\t\t\t\tvalidationType,\n\t\t\t\t})\n\t\t\t\tif (!result.ok && result.error === 'OTP_REQUIRED') {\n\t\t\t\t\treturn { ...result, state: 'otp-required' }\n\t\t\t\t}\n\n\t\t\t\treturn result\n\t\t\t}, [expiration, requestId, signIn, validationType])}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\nconst errorToField: Record<TenantApi.SignInPasswordlessErrorCode, keyof PasswordlessSignInFormValues | undefined> = {\n\tPERSON_DISABLED: undefined,\n\tTOKEN_EXPIRED: 'token',\n\tTOKEN_NOT_FOUND: 'token',\n\tTOKEN_USED: 'token',\n\tTOKEN_INVALID: 'token',\n\tINVALID_OTP_TOKEN: 'otpToken',\n\tOTP_REQUIRED: undefined,\n\tMFA_ENROLLMENT_REQUIRED: undefined,\n}\n"],"names":["this"],"mappings":";;;;;;;AAyCO,MAAM,4BAA4B;AAEzC,MAAM,UAAU;AAAA,EACf,0BAA0B;AAC3B;AACA,MAAM,2BAA2B,KAAK,KAAK;AAEpC,MAAM,yBAAyB,CACrC,EAAE,UAAU,WAAW,WAAW,gBAAgB,OAAO,aAAa,+BAClE;AACJ,QAAM,SAAS,8BAA8B,EAAE,SAAS;AACxD,QAAM,qBAAqB,8BAAA;AAC3B,QAAM,kBAAkB,mBAAA;AACxB,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,WAAW,CAAA,SAAQ;AAClB,oBAAA;AACA,wBAAgB,KAAK,OAAO,KAAK;AACjC,2BAAA;AAAA,MACD;AAAA,MACA,cAAc;AAAA,MACd,eAAe,QAAQ,OAAO;AAAA,QAC7B,OAAO,SAAS;AAAA,QAChB,UAAU;AAAA,MAAA,IACP,CAAC,KAAK,CAAC;AAAA,MACX,UAAU,CAAC,EAAE,QAAQ,YAAY;AAChC,YAAI,CAAC,OAAO,OAAO;AAClB,iBAAO,CAAC,EAAE,MAAM,kBAAkB,OAAO,SAAS;AAAA,QACnD;AACA,YAAI,CAAC,OAAO,YAAY,UAAU,gBAAgB;AACjD,iBAAO,CAAC,EAAE,MAAM,kBAAkB,OAAO,YAAY;AAAA,QACtD,WAAW,OAAO,YAAY,CAAC,OAAO,SAAS,MAAM,SAAS,GAAG;AAChE,iBAAO,CAAC,EAAE,MAAM,iBAAiB,OAAO,YAAY;AAAA,QACrD;AACA,eAAO,CAAA;AAAA,MACR;AAAA,MACA,SAAS,YAAY,OAAO,EAAE,aAAa;AAC1C,cAAM,SAAS,MAAM,OAAO;AAAA,UAC3B;AAAA,UACA;AAAA,UACA,OAAO,OAAO;AAAA,UACd,QAAQ,OAAO,YAAY;AAAA,UAC3B;AAAA,QAAA,CACA;AACD,YAAI,CAAC,OAAO,MAAM,OAAO,UAAU,gBAAgB;AAClD,iBAAO,EAAE,GAAG,QAAQ,OAAO,eAAA;AAAA,QAC5B;AAEA,eAAO;AAAA,MACR,GAAG,CAAC,YAAY,WAAW,QAAQ,cAAc,CAAC;AAAA,MAEjD;AAAA,IAAA;AAAA,IArCF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AAwCF;AACA,MAAM,eAA8G;AAAA,EACnH,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,yBAAyB;AAC1B;"}
1
+ {"version":3,"file":"PasswordlessSignInForm.js","sources":["../../../../../../packages/react-client-tenant/src/components/forms/PasswordlessSignInForm.tsx"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { useSetSessionToken } from '@contember/react-client'\nimport { ReactElement, useCallback, useMemo } from 'react'\nimport { useForm } from '../../contexts.js'\nimport { SignInPasswordlessMutationResult, useSignInPasswordlessMutation } from '../../hooks/index.js'\nimport { useRedirectToBacklinkCallback } from '../../internal/hooks/useRedirectToBacklink.js'\nimport { FormContextValue, FormError, FormState } from '../../types/forms.js'\nimport { TenantForm } from './TenantForm.js'\n\nexport type PasswordlessSignInFormValues = {\n\ttoken: string\n\totpToken: string\n\t/** Alternative to `otpToken` for a user who lost their authenticator. */\n\tbackupCode: string\n}\n\nexport type PasswordlessSignInFormErrorCode =\n\t| TenantApi.SignInPasswordlessErrorCode\n\t| 'FIELD_REQUIRED'\n\t| 'INVALID_VALUE'\n\t| 'UNKNOWN_ERROR'\n\nexport type PasswordlessSignInFormState =\n\t| FormState\n\t| 'otp-required'\n\nexport type PasswordlessSignInFormError = FormError<PasswordlessSignInFormValues, PasswordlessSignInFormErrorCode>\n\nexport type PasswordlessSignInFormContextValue = FormContextValue<\n\tPasswordlessSignInFormValues,\n\tPasswordlessSignInFormErrorCode,\n\tPasswordlessSignInFormState\n>\n\nexport interface PasswordlessSignInFormProps {\n\trequestId: string\n\tvalidationType: TenantApi.PasswordlessValidationType\n\ttoken?: string\n\texpiration?: number\n\tchildren: ReactElement\n\tonSuccess?: () => void\n}\n\nexport const usePasswordlessSignInForm = useForm as () => PasswordlessSignInFormContextValue\n\nconst headers = {\n\t'X-Contember-Token-Path': 'data.mutation.result.token',\n}\nconst DEFAULT_LOGIN_EXPIRATION = 14 * 24 * 60 // 14 days\n\nexport const PasswordlessSignInForm = (\n\t{ children, onSuccess, requestId, validationType, token, expiration = DEFAULT_LOGIN_EXPIRATION }: PasswordlessSignInFormProps,\n) => {\n\tconst signIn = useSignInPasswordlessMutation({ headers })\n\tconst redirectToBacklink = useRedirectToBacklinkCallback()\n\tconst setSessionToken = useSetSessionToken()\n\treturn (\n\t\t<TenantForm<PasswordlessSignInFormContextValue, SignInPasswordlessMutationResult>\n\t\t\tonSuccess={args => {\n\t\t\t\tonSuccess?.()\n\t\t\t\tsetSessionToken(args.result.token)\n\t\t\t\tredirectToBacklink()\n\t\t\t}}\n\t\t\terrorMapping={errorToField}\n\t\t\tinitialValues={useMemo(() => ({\n\t\t\t\ttoken: token ?? '',\n\t\t\t\totpToken: '',\n\t\t\t\tbackupCode: '',\n\t\t\t}), [token])}\n\t\t\tvalidate={({ values, state }) => {\n\t\t\t\tif (!values.token) {\n\t\t\t\t\treturn [{ code: 'FIELD_REQUIRED', field: 'token' }]\n\t\t\t\t}\n\t\t\t\t// In the otp-required step either an otpToken or a backup code will do.\n\t\t\t\tif (!values.otpToken && !values.backupCode && state === 'otp-required') {\n\t\t\t\t\treturn [{ code: 'FIELD_REQUIRED', field: 'otpToken' }]\n\t\t\t\t} else if (values.otpToken && !values.otpToken.match(/^\\d{6}$/)) {\n\t\t\t\t\treturn [{ code: 'INVALID_VALUE', field: 'otpToken' }]\n\t\t\t\t}\n\t\t\t\treturn []\n\t\t\t}}\n\t\t\texecute={useCallback(async ({ values }) => {\n\t\t\t\tconst result = await signIn({\n\t\t\t\t\trequestId,\n\t\t\t\t\texpiration,\n\t\t\t\t\ttoken: values.token,\n\t\t\t\t\tmfaOtp: values.otpToken || undefined,\n\t\t\t\t\tbackupCode: values.backupCode || undefined,\n\t\t\t\t\tvalidationType,\n\t\t\t\t})\n\t\t\t\tif (!result.ok && result.error === 'OTP_REQUIRED') {\n\t\t\t\t\treturn { ...result, state: 'otp-required' }\n\t\t\t\t}\n\n\t\t\t\treturn result\n\t\t\t}, [expiration, requestId, signIn, validationType])}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\nconst errorToField: Record<TenantApi.SignInPasswordlessErrorCode, keyof PasswordlessSignInFormValues | undefined> = {\n\tPERSON_DISABLED: undefined,\n\tTOKEN_EXPIRED: 'token',\n\tTOKEN_NOT_FOUND: 'token',\n\tTOKEN_USED: 'token',\n\tTOKEN_INVALID: 'token',\n\tINVALID_OTP_TOKEN: 'otpToken',\n\tOTP_REQUIRED: undefined,\n\tMFA_ENROLLMENT_REQUIRED: undefined,\n\tIDP_REQUIRED: undefined,\n}\n"],"names":["this"],"mappings":";;;;;;;AA2CO,MAAM,4BAA4B;AAEzC,MAAM,UAAU;AAAA,EACf,0BAA0B;AAC3B;AACA,MAAM,2BAA2B,KAAK,KAAK;AAEpC,MAAM,yBAAyB,CACrC,EAAE,UAAU,WAAW,WAAW,gBAAgB,OAAO,aAAa,+BAClE;AACJ,QAAM,SAAS,8BAA8B,EAAE,SAAS;AACxD,QAAM,qBAAqB,8BAAA;AAC3B,QAAM,kBAAkB,mBAAA;AACxB,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,WAAW,CAAA,SAAQ;AAClB,oBAAA;AACA,wBAAgB,KAAK,OAAO,KAAK;AACjC,2BAAA;AAAA,MACD;AAAA,MACA,cAAc;AAAA,MACd,eAAe,QAAQ,OAAO;AAAA,QAC7B,OAAO,SAAS;AAAA,QAChB,UAAU;AAAA,QACV,YAAY;AAAA,MAAA,IACT,CAAC,KAAK,CAAC;AAAA,MACX,UAAU,CAAC,EAAE,QAAQ,YAAY;AAChC,YAAI,CAAC,OAAO,OAAO;AAClB,iBAAO,CAAC,EAAE,MAAM,kBAAkB,OAAO,SAAS;AAAA,QACnD;AAEA,YAAI,CAAC,OAAO,YAAY,CAAC,OAAO,cAAc,UAAU,gBAAgB;AACvE,iBAAO,CAAC,EAAE,MAAM,kBAAkB,OAAO,YAAY;AAAA,QACtD,WAAW,OAAO,YAAY,CAAC,OAAO,SAAS,MAAM,SAAS,GAAG;AAChE,iBAAO,CAAC,EAAE,MAAM,iBAAiB,OAAO,YAAY;AAAA,QACrD;AACA,eAAO,CAAA;AAAA,MACR;AAAA,MACA,SAAS,YAAY,OAAO,EAAE,aAAa;AAC1C,cAAM,SAAS,MAAM,OAAO;AAAA,UAC3B;AAAA,UACA;AAAA,UACA,OAAO,OAAO;AAAA,UACd,QAAQ,OAAO,YAAY;AAAA,UAC3B,YAAY,OAAO,cAAc;AAAA,UACjC;AAAA,QAAA,CACA;AACD,YAAI,CAAC,OAAO,MAAM,OAAO,UAAU,gBAAgB;AAClD,iBAAO,EAAE,GAAG,QAAQ,OAAO,eAAA;AAAA,QAC5B;AAEA,eAAO;AAAA,MACR,GAAG,CAAC,YAAY,WAAW,QAAQ,cAAc,CAAC;AAAA,MAEjD;AAAA,IAAA;AAAA,IAxCF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AA2CF;AACA,MAAM,eAA8G;AAAA,EACnH,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,yBAAyB;AAAA,EACzB,cAAc;AACf;"}
@@ -54,7 +54,8 @@ const errorToField = {
54
54
  PERSON_NOT_FOUND: "email",
55
55
  PASSWORDLESS_DISABLED: void 0,
56
56
  RATE_LIMIT_EXCEEDED: void 0,
57
- INVALID_CAPTCHA: void 0
57
+ INVALID_CAPTCHA: void 0,
58
+ IDP_REQUIRED: void 0
58
59
  };
59
60
  exports.PasswordlessSignInInitForm = PasswordlessSignInInitForm;
60
61
  exports.usePasswordlessSignInInitForm = usePasswordlessSignInInitForm;
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordlessSignInInitForm.cjs","sources":["../../../../../../packages/react-client-tenant/src/components/forms/PasswordlessSignInInitForm.tsx"],"sourcesContent":["import { ReactElement, useCallback, useMemo } from 'react'\nimport * as TenantApi from '@contember/graphql-client-tenant'\nimport { TenantForm } from './TenantForm.js'\nimport { FormContextValue, FormError, FormState } from '../../types/forms.js'\nimport { useForm } from '../../contexts.js'\nimport { InitSignInPasswordlessMutationResult, useInitSignInPasswordlessMutation } from '../../hooks/index.js'\nimport { PASSWORDLESS_REQUEST_STORAGE_KEY } from '../../consts.js'\nimport { useSaveBacklink } from '../../internal/hooks/useRedirectToBacklink.js'\n\nexport type PasswordlessSignInInitFormValues = {\n\temail: string\n}\n\nexport type PasswordlessSignInInitFormErrorCode =\n\t| TenantApi.InitSignInPasswordlessErrorCode\n\t| 'FIELD_REQUIRED'\n\t| 'INVALID_VALUE'\n\t| 'UNKNOWN_ERROR'\n\nexport type PasswordlessSignInInitFormState = FormState\n\nexport type PasswordlessSignInInitFormError = FormError<PasswordlessSignInInitFormValues, PasswordlessSignInInitFormErrorCode>\n\nexport type PasswordlessSignInInitFormContextValue = FormContextValue<PasswordlessSignInInitFormValues, PasswordlessSignInInitFormErrorCode>\n\nexport interface PasswordlessSignInInitFormProps {\n\tchildren: ReactElement\n\tonSuccess?: (args: { result: InitSignInPasswordlessMutationResult }) => void\n}\n\nexport const usePasswordlessSignInInitForm = useForm as () => PasswordlessSignInInitFormContextValue\n\nexport const PasswordlessSignInInitForm = ({ children, onSuccess }: PasswordlessSignInInitFormProps) => {\n\tconst initSignIn = useInitSignInPasswordlessMutation()\n\tconst saveBacklink = useSaveBacklink({\n\t\tstorage: 'local',\n\t})\n\n\treturn (\n\t\t<TenantForm<PasswordlessSignInInitFormContextValue, InitSignInPasswordlessMutationResult>\n\t\t\tonSuccess={res => {\n\t\t\t\tlocalStorage.setItem(PASSWORDLESS_REQUEST_STORAGE_KEY, res.result.requestId)\n\t\t\t\tsaveBacklink()\n\t\t\t\tonSuccess?.(res)\n\t\t\t}}\n\t\t\terrorMapping={errorToField}\n\t\t\tinitialValues={useMemo(() => ({\n\t\t\t\temail: '',\n\t\t\t}), [])}\n\t\t\tvalidate={({ values }) => {\n\t\t\t\tif (!values.email) {\n\t\t\t\t\treturn [{ code: 'FIELD_REQUIRED', field: 'email' }]\n\t\t\t\t} else if (!values.email.match(/^.+@.+$/)) {\n\t\t\t\t\treturn [{ code: 'INVALID_VALUE', field: 'email' }]\n\t\t\t\t}\n\t\t\t\treturn []\n\t\t\t}}\n\t\t\texecute={useCallback(async ({ values }) => {\n\t\t\t\treturn await initSignIn({\n\t\t\t\t\temail: values.email,\n\t\t\t\t})\n\t\t\t}, [initSignIn])}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\nconst errorToField: Record<TenantApi.InitSignInPasswordlessErrorCode, keyof PasswordlessSignInInitFormValues | undefined> = {\n\tPERSON_NOT_FOUND: 'email',\n\tPASSWORDLESS_DISABLED: undefined,\n\tRATE_LIMIT_EXCEEDED: undefined,\n\tINVALID_CAPTCHA: undefined,\n}\n"],"names":["useForm","useInitSignInPasswordlessMutation","useSaveBacklink","jsxDEV","TenantForm","PASSWORDLESS_REQUEST_STORAGE_KEY","useMemo","useCallback","this"],"mappings":";;;;;;;;;AA8BO,MAAM,gCAAgCA,SAAAA;AAEtC,MAAM,6BAA6B,CAAC,EAAE,UAAU,gBAAiD;AACvG,QAAM,aAAaC,kCAAAA,kCAAA;AACnB,QAAM,eAAeC,sBAAAA,gBAAgB;AAAA,IACpC,SAAS;AAAA,EAAA,CACT;AAED,SACCC,8BAAAA;AAAAA,IAACC,WAAAA;AAAAA,IAAA;AAAA,MACA,WAAW,CAAA,QAAO;AACjB,qBAAa,QAAQC,OAAAA,kCAAkC,IAAI,OAAO,SAAS;AAC3E,qBAAA;AACA,oBAAY,GAAG;AAAA,MAChB;AAAA,MACA,cAAc;AAAA,MACd,eAAeC,MAAAA,QAAQ,OAAO;AAAA,QAC7B,OAAO;AAAA,MAAA,IACJ,CAAA,CAAE;AAAA,MACN,UAAU,CAAC,EAAE,aAAa;AACzB,YAAI,CAAC,OAAO,OAAO;AAClB,iBAAO,CAAC,EAAE,MAAM,kBAAkB,OAAO,SAAS;AAAA,QACnD,WAAW,CAAC,OAAO,MAAM,MAAM,SAAS,GAAG;AAC1C,iBAAO,CAAC,EAAE,MAAM,iBAAiB,OAAO,SAAS;AAAA,QAClD;AACA,eAAO,CAAA;AAAA,MACR;AAAA,MACA,SAASC,MAAAA,YAAY,OAAO,EAAE,aAAa;AAC1C,eAAO,MAAM,WAAW;AAAA,UACvB,OAAO,OAAO;AAAA,QAAA,CACd;AAAA,MACF,GAAG,CAAC,UAAU,CAAC;AAAA,MAEd;AAAA,IAAA;AAAA,IAxBF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAAA;AA2BF;AACA,MAAM,eAAsH;AAAA,EAC3H,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,qBAAqB;AAAA,EACrB,iBAAiB;AAClB;;;"}
1
+ {"version":3,"file":"PasswordlessSignInInitForm.cjs","sources":["../../../../../../packages/react-client-tenant/src/components/forms/PasswordlessSignInInitForm.tsx"],"sourcesContent":["import { ReactElement, useCallback, useMemo } from 'react'\nimport * as TenantApi from '@contember/graphql-client-tenant'\nimport { TenantForm } from './TenantForm.js'\nimport { FormContextValue, FormError, FormState } from '../../types/forms.js'\nimport { useForm } from '../../contexts.js'\nimport { InitSignInPasswordlessMutationResult, useInitSignInPasswordlessMutation } from '../../hooks/index.js'\nimport { PASSWORDLESS_REQUEST_STORAGE_KEY } from '../../consts.js'\nimport { useSaveBacklink } from '../../internal/hooks/useRedirectToBacklink.js'\n\nexport type PasswordlessSignInInitFormValues = {\n\temail: string\n}\n\nexport type PasswordlessSignInInitFormErrorCode =\n\t| TenantApi.InitSignInPasswordlessErrorCode\n\t| 'FIELD_REQUIRED'\n\t| 'INVALID_VALUE'\n\t| 'UNKNOWN_ERROR'\n\nexport type PasswordlessSignInInitFormState = FormState\n\nexport type PasswordlessSignInInitFormError = FormError<PasswordlessSignInInitFormValues, PasswordlessSignInInitFormErrorCode>\n\nexport type PasswordlessSignInInitFormContextValue = FormContextValue<PasswordlessSignInInitFormValues, PasswordlessSignInInitFormErrorCode>\n\nexport interface PasswordlessSignInInitFormProps {\n\tchildren: ReactElement\n\tonSuccess?: (args: { result: InitSignInPasswordlessMutationResult }) => void\n}\n\nexport const usePasswordlessSignInInitForm = useForm as () => PasswordlessSignInInitFormContextValue\n\nexport const PasswordlessSignInInitForm = ({ children, onSuccess }: PasswordlessSignInInitFormProps) => {\n\tconst initSignIn = useInitSignInPasswordlessMutation()\n\tconst saveBacklink = useSaveBacklink({\n\t\tstorage: 'local',\n\t})\n\n\treturn (\n\t\t<TenantForm<PasswordlessSignInInitFormContextValue, InitSignInPasswordlessMutationResult>\n\t\t\tonSuccess={res => {\n\t\t\t\tlocalStorage.setItem(PASSWORDLESS_REQUEST_STORAGE_KEY, res.result.requestId)\n\t\t\t\tsaveBacklink()\n\t\t\t\tonSuccess?.(res)\n\t\t\t}}\n\t\t\terrorMapping={errorToField}\n\t\t\tinitialValues={useMemo(() => ({\n\t\t\t\temail: '',\n\t\t\t}), [])}\n\t\t\tvalidate={({ values }) => {\n\t\t\t\tif (!values.email) {\n\t\t\t\t\treturn [{ code: 'FIELD_REQUIRED', field: 'email' }]\n\t\t\t\t} else if (!values.email.match(/^.+@.+$/)) {\n\t\t\t\t\treturn [{ code: 'INVALID_VALUE', field: 'email' }]\n\t\t\t\t}\n\t\t\t\treturn []\n\t\t\t}}\n\t\t\texecute={useCallback(async ({ values }) => {\n\t\t\t\treturn await initSignIn({\n\t\t\t\t\temail: values.email,\n\t\t\t\t})\n\t\t\t}, [initSignIn])}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\nconst errorToField: Record<TenantApi.InitSignInPasswordlessErrorCode, keyof PasswordlessSignInInitFormValues | undefined> = {\n\tPERSON_NOT_FOUND: 'email',\n\tPASSWORDLESS_DISABLED: undefined,\n\tRATE_LIMIT_EXCEEDED: undefined,\n\tINVALID_CAPTCHA: undefined,\n\tIDP_REQUIRED: undefined,\n}\n"],"names":["useForm","useInitSignInPasswordlessMutation","useSaveBacklink","jsxDEV","TenantForm","PASSWORDLESS_REQUEST_STORAGE_KEY","useMemo","useCallback","this"],"mappings":";;;;;;;;;AA8BO,MAAM,gCAAgCA,SAAAA;AAEtC,MAAM,6BAA6B,CAAC,EAAE,UAAU,gBAAiD;AACvG,QAAM,aAAaC,kCAAAA,kCAAA;AACnB,QAAM,eAAeC,sBAAAA,gBAAgB;AAAA,IACpC,SAAS;AAAA,EAAA,CACT;AAED,SACCC,8BAAAA;AAAAA,IAACC,WAAAA;AAAAA,IAAA;AAAA,MACA,WAAW,CAAA,QAAO;AACjB,qBAAa,QAAQC,OAAAA,kCAAkC,IAAI,OAAO,SAAS;AAC3E,qBAAA;AACA,oBAAY,GAAG;AAAA,MAChB;AAAA,MACA,cAAc;AAAA,MACd,eAAeC,MAAAA,QAAQ,OAAO;AAAA,QAC7B,OAAO;AAAA,MAAA,IACJ,CAAA,CAAE;AAAA,MACN,UAAU,CAAC,EAAE,aAAa;AACzB,YAAI,CAAC,OAAO,OAAO;AAClB,iBAAO,CAAC,EAAE,MAAM,kBAAkB,OAAO,SAAS;AAAA,QACnD,WAAW,CAAC,OAAO,MAAM,MAAM,SAAS,GAAG;AAC1C,iBAAO,CAAC,EAAE,MAAM,iBAAiB,OAAO,SAAS;AAAA,QAClD;AACA,eAAO,CAAA;AAAA,MACR;AAAA,MACA,SAASC,MAAAA,YAAY,OAAO,EAAE,aAAa;AAC1C,eAAO,MAAM,WAAW;AAAA,UACvB,OAAO,OAAO;AAAA,QAAA,CACd;AAAA,MACF,GAAG,CAAC,UAAU,CAAC;AAAA,MAEd;AAAA,IAAA;AAAA,IAxBF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAAA;AA2BF;AACA,MAAM,eAAsH;AAAA,EAC3H,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,cAAc;AACf;;;"}
@@ -52,7 +52,8 @@ const errorToField = {
52
52
  PERSON_NOT_FOUND: "email",
53
53
  PASSWORDLESS_DISABLED: void 0,
54
54
  RATE_LIMIT_EXCEEDED: void 0,
55
- INVALID_CAPTCHA: void 0
55
+ INVALID_CAPTCHA: void 0,
56
+ IDP_REQUIRED: void 0
56
57
  };
57
58
  export {
58
59
  PasswordlessSignInInitForm,
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordlessSignInInitForm.js","sources":["../../../../../../packages/react-client-tenant/src/components/forms/PasswordlessSignInInitForm.tsx"],"sourcesContent":["import { ReactElement, useCallback, useMemo } from 'react'\nimport * as TenantApi from '@contember/graphql-client-tenant'\nimport { TenantForm } from './TenantForm.js'\nimport { FormContextValue, FormError, FormState } from '../../types/forms.js'\nimport { useForm } from '../../contexts.js'\nimport { InitSignInPasswordlessMutationResult, useInitSignInPasswordlessMutation } from '../../hooks/index.js'\nimport { PASSWORDLESS_REQUEST_STORAGE_KEY } from '../../consts.js'\nimport { useSaveBacklink } from '../../internal/hooks/useRedirectToBacklink.js'\n\nexport type PasswordlessSignInInitFormValues = {\n\temail: string\n}\n\nexport type PasswordlessSignInInitFormErrorCode =\n\t| TenantApi.InitSignInPasswordlessErrorCode\n\t| 'FIELD_REQUIRED'\n\t| 'INVALID_VALUE'\n\t| 'UNKNOWN_ERROR'\n\nexport type PasswordlessSignInInitFormState = FormState\n\nexport type PasswordlessSignInInitFormError = FormError<PasswordlessSignInInitFormValues, PasswordlessSignInInitFormErrorCode>\n\nexport type PasswordlessSignInInitFormContextValue = FormContextValue<PasswordlessSignInInitFormValues, PasswordlessSignInInitFormErrorCode>\n\nexport interface PasswordlessSignInInitFormProps {\n\tchildren: ReactElement\n\tonSuccess?: (args: { result: InitSignInPasswordlessMutationResult }) => void\n}\n\nexport const usePasswordlessSignInInitForm = useForm as () => PasswordlessSignInInitFormContextValue\n\nexport const PasswordlessSignInInitForm = ({ children, onSuccess }: PasswordlessSignInInitFormProps) => {\n\tconst initSignIn = useInitSignInPasswordlessMutation()\n\tconst saveBacklink = useSaveBacklink({\n\t\tstorage: 'local',\n\t})\n\n\treturn (\n\t\t<TenantForm<PasswordlessSignInInitFormContextValue, InitSignInPasswordlessMutationResult>\n\t\t\tonSuccess={res => {\n\t\t\t\tlocalStorage.setItem(PASSWORDLESS_REQUEST_STORAGE_KEY, res.result.requestId)\n\t\t\t\tsaveBacklink()\n\t\t\t\tonSuccess?.(res)\n\t\t\t}}\n\t\t\terrorMapping={errorToField}\n\t\t\tinitialValues={useMemo(() => ({\n\t\t\t\temail: '',\n\t\t\t}), [])}\n\t\t\tvalidate={({ values }) => {\n\t\t\t\tif (!values.email) {\n\t\t\t\t\treturn [{ code: 'FIELD_REQUIRED', field: 'email' }]\n\t\t\t\t} else if (!values.email.match(/^.+@.+$/)) {\n\t\t\t\t\treturn [{ code: 'INVALID_VALUE', field: 'email' }]\n\t\t\t\t}\n\t\t\t\treturn []\n\t\t\t}}\n\t\t\texecute={useCallback(async ({ values }) => {\n\t\t\t\treturn await initSignIn({\n\t\t\t\t\temail: values.email,\n\t\t\t\t})\n\t\t\t}, [initSignIn])}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\nconst errorToField: Record<TenantApi.InitSignInPasswordlessErrorCode, keyof PasswordlessSignInInitFormValues | undefined> = {\n\tPERSON_NOT_FOUND: 'email',\n\tPASSWORDLESS_DISABLED: undefined,\n\tRATE_LIMIT_EXCEEDED: undefined,\n\tINVALID_CAPTCHA: undefined,\n}\n"],"names":["this"],"mappings":";;;;;;;AA8BO,MAAM,gCAAgC;AAEtC,MAAM,6BAA6B,CAAC,EAAE,UAAU,gBAAiD;AACvG,QAAM,aAAa,kCAAA;AACnB,QAAM,eAAe,gBAAgB;AAAA,IACpC,SAAS;AAAA,EAAA,CACT;AAED,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,WAAW,CAAA,QAAO;AACjB,qBAAa,QAAQ,kCAAkC,IAAI,OAAO,SAAS;AAC3E,qBAAA;AACA,oBAAY,GAAG;AAAA,MAChB;AAAA,MACA,cAAc;AAAA,MACd,eAAe,QAAQ,OAAO;AAAA,QAC7B,OAAO;AAAA,MAAA,IACJ,CAAA,CAAE;AAAA,MACN,UAAU,CAAC,EAAE,aAAa;AACzB,YAAI,CAAC,OAAO,OAAO;AAClB,iBAAO,CAAC,EAAE,MAAM,kBAAkB,OAAO,SAAS;AAAA,QACnD,WAAW,CAAC,OAAO,MAAM,MAAM,SAAS,GAAG;AAC1C,iBAAO,CAAC,EAAE,MAAM,iBAAiB,OAAO,SAAS;AAAA,QAClD;AACA,eAAO,CAAA;AAAA,MACR;AAAA,MACA,SAAS,YAAY,OAAO,EAAE,aAAa;AAC1C,eAAO,MAAM,WAAW;AAAA,UACvB,OAAO,OAAO;AAAA,QAAA,CACd;AAAA,MACF,GAAG,CAAC,UAAU,CAAC;AAAA,MAEd;AAAA,IAAA;AAAA,IAxBF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AA2BF;AACA,MAAM,eAAsH;AAAA,EAC3H,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,qBAAqB;AAAA,EACrB,iBAAiB;AAClB;"}
1
+ {"version":3,"file":"PasswordlessSignInInitForm.js","sources":["../../../../../../packages/react-client-tenant/src/components/forms/PasswordlessSignInInitForm.tsx"],"sourcesContent":["import { ReactElement, useCallback, useMemo } from 'react'\nimport * as TenantApi from '@contember/graphql-client-tenant'\nimport { TenantForm } from './TenantForm.js'\nimport { FormContextValue, FormError, FormState } from '../../types/forms.js'\nimport { useForm } from '../../contexts.js'\nimport { InitSignInPasswordlessMutationResult, useInitSignInPasswordlessMutation } from '../../hooks/index.js'\nimport { PASSWORDLESS_REQUEST_STORAGE_KEY } from '../../consts.js'\nimport { useSaveBacklink } from '../../internal/hooks/useRedirectToBacklink.js'\n\nexport type PasswordlessSignInInitFormValues = {\n\temail: string\n}\n\nexport type PasswordlessSignInInitFormErrorCode =\n\t| TenantApi.InitSignInPasswordlessErrorCode\n\t| 'FIELD_REQUIRED'\n\t| 'INVALID_VALUE'\n\t| 'UNKNOWN_ERROR'\n\nexport type PasswordlessSignInInitFormState = FormState\n\nexport type PasswordlessSignInInitFormError = FormError<PasswordlessSignInInitFormValues, PasswordlessSignInInitFormErrorCode>\n\nexport type PasswordlessSignInInitFormContextValue = FormContextValue<PasswordlessSignInInitFormValues, PasswordlessSignInInitFormErrorCode>\n\nexport interface PasswordlessSignInInitFormProps {\n\tchildren: ReactElement\n\tonSuccess?: (args: { result: InitSignInPasswordlessMutationResult }) => void\n}\n\nexport const usePasswordlessSignInInitForm = useForm as () => PasswordlessSignInInitFormContextValue\n\nexport const PasswordlessSignInInitForm = ({ children, onSuccess }: PasswordlessSignInInitFormProps) => {\n\tconst initSignIn = useInitSignInPasswordlessMutation()\n\tconst saveBacklink = useSaveBacklink({\n\t\tstorage: 'local',\n\t})\n\n\treturn (\n\t\t<TenantForm<PasswordlessSignInInitFormContextValue, InitSignInPasswordlessMutationResult>\n\t\t\tonSuccess={res => {\n\t\t\t\tlocalStorage.setItem(PASSWORDLESS_REQUEST_STORAGE_KEY, res.result.requestId)\n\t\t\t\tsaveBacklink()\n\t\t\t\tonSuccess?.(res)\n\t\t\t}}\n\t\t\terrorMapping={errorToField}\n\t\t\tinitialValues={useMemo(() => ({\n\t\t\t\temail: '',\n\t\t\t}), [])}\n\t\t\tvalidate={({ values }) => {\n\t\t\t\tif (!values.email) {\n\t\t\t\t\treturn [{ code: 'FIELD_REQUIRED', field: 'email' }]\n\t\t\t\t} else if (!values.email.match(/^.+@.+$/)) {\n\t\t\t\t\treturn [{ code: 'INVALID_VALUE', field: 'email' }]\n\t\t\t\t}\n\t\t\t\treturn []\n\t\t\t}}\n\t\t\texecute={useCallback(async ({ values }) => {\n\t\t\t\treturn await initSignIn({\n\t\t\t\t\temail: values.email,\n\t\t\t\t})\n\t\t\t}, [initSignIn])}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\nconst errorToField: Record<TenantApi.InitSignInPasswordlessErrorCode, keyof PasswordlessSignInInitFormValues | undefined> = {\n\tPERSON_NOT_FOUND: 'email',\n\tPASSWORDLESS_DISABLED: undefined,\n\tRATE_LIMIT_EXCEEDED: undefined,\n\tINVALID_CAPTCHA: undefined,\n\tIDP_REQUIRED: undefined,\n}\n"],"names":["this"],"mappings":";;;;;;;AA8BO,MAAM,gCAAgC;AAEtC,MAAM,6BAA6B,CAAC,EAAE,UAAU,gBAAiD;AACvG,QAAM,aAAa,kCAAA;AACnB,QAAM,eAAe,gBAAgB;AAAA,IACpC,SAAS;AAAA,EAAA,CACT;AAED,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,WAAW,CAAA,QAAO;AACjB,qBAAa,QAAQ,kCAAkC,IAAI,OAAO,SAAS;AAC3E,qBAAA;AACA,oBAAY,GAAG;AAAA,MAChB;AAAA,MACA,cAAc;AAAA,MACd,eAAe,QAAQ,OAAO;AAAA,QAC7B,OAAO;AAAA,MAAA,IACJ,CAAA,CAAE;AAAA,MACN,UAAU,CAAC,EAAE,aAAa;AACzB,YAAI,CAAC,OAAO,OAAO;AAClB,iBAAO,CAAC,EAAE,MAAM,kBAAkB,OAAO,SAAS;AAAA,QACnD,WAAW,CAAC,OAAO,MAAM,MAAM,SAAS,GAAG;AAC1C,iBAAO,CAAC,EAAE,MAAM,iBAAiB,OAAO,SAAS;AAAA,QAClD;AACA,eAAO,CAAA;AAAA,MACR;AAAA,MACA,SAAS,YAAY,OAAO,EAAE,aAAa;AAC1C,eAAO,MAAM,WAAW;AAAA,UACvB,OAAO,OAAO;AAAA,QAAA,CACd;AAAA,MACF,GAAG,CAAC,UAAU,CAAC;AAAA,MAEd;AAAA,IAAA;AAAA,IAxBF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AA2BF;AACA,MAAM,eAAsH;AAAA,EAC3H,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,cAAc;AACf;"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxDevRuntime = require("react/jsx-dev-runtime");
4
+ const TenantForm = require("./TenantForm.cjs");
5
+ const contexts = require("../../contexts.cjs");
6
+ const useSetProjectSecretMutation = require("../../hooks/mutations/project/useSetProjectSecretMutation.cjs");
7
+ const useSetProjectSecretForm = contexts.useForm;
8
+ const SetProjectSecretForm = ({ children, onSuccess, projectSlug }) => {
9
+ const setProjectSecret = useSetProjectSecretMutation.useSetProjectSecretMutation();
10
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
11
+ TenantForm.TenantForm,
12
+ {
13
+ onSuccess,
14
+ errorMapping: errorToField,
15
+ initialValues: {
16
+ key: "",
17
+ value: ""
18
+ },
19
+ validate: ({ values }) => {
20
+ const errors = [];
21
+ if (!values.key) {
22
+ errors.push({ code: "FIELD_REQUIRED", field: "key" });
23
+ }
24
+ if (!values.value) {
25
+ errors.push({ code: "FIELD_REQUIRED", field: "value" });
26
+ }
27
+ return errors;
28
+ },
29
+ execute: async ({ values }) => {
30
+ return await setProjectSecret({
31
+ projectSlug,
32
+ key: values.key,
33
+ value: values.value
34
+ });
35
+ },
36
+ children
37
+ },
38
+ void 0,
39
+ false,
40
+ {
41
+ fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/SetProjectSecretForm.tsx",
42
+ lineNumber: 35,
43
+ columnNumber: 3
44
+ },
45
+ void 0
46
+ );
47
+ };
48
+ const errorToField = {
49
+ PROJECT_NOT_FOUND: void 0
50
+ };
51
+ exports.SetProjectSecretForm = SetProjectSecretForm;
52
+ exports.useSetProjectSecretForm = useSetProjectSecretForm;
53
+ //# sourceMappingURL=SetProjectSecretForm.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SetProjectSecretForm.cjs","sources":["../../../../../../packages/react-client-tenant/src/components/forms/SetProjectSecretForm.tsx"],"sourcesContent":["import { ReactElement } from 'react'\nimport { SetProjectSecretErrorCode } from '@contember/graphql-client-tenant'\nimport { TenantForm } from './TenantForm.js'\nimport { FormContextValue, FormError, FormState } from '../../types/index.js'\nimport { useForm } from '../../contexts.js'\nimport { useSetProjectSecretMutation } from '../../hooks/index.js'\n\nexport type SetProjectSecretFormValues = {\n\tkey: string\n\tvalue: string\n}\n\nexport type SetProjectSecretFormErrorCode =\n\t| SetProjectSecretErrorCode\n\t| 'FIELD_REQUIRED'\n\t| 'UNKNOWN_ERROR'\n\nexport type SetProjectSecretFormState = FormState\n\nexport type SetProjectSecretFormError = FormError<SetProjectSecretFormValues, SetProjectSecretFormErrorCode>\n\nexport type SetProjectSecretFormContextValue = FormContextValue<SetProjectSecretFormValues, SetProjectSecretFormErrorCode>\n\nexport interface SetProjectSecretFormProps {\n\tchildren: ReactElement\n\tprojectSlug: string\n\tonSuccess?: () => void\n}\n\nexport const useSetProjectSecretForm = useForm as () => SetProjectSecretFormContextValue\n\nexport const SetProjectSecretForm = ({ children, onSuccess, projectSlug }: SetProjectSecretFormProps) => {\n\tconst setProjectSecret = useSetProjectSecretMutation()\n\treturn (\n\t\t<TenantForm<SetProjectSecretFormContextValue>\n\t\t\tonSuccess={onSuccess}\n\t\t\terrorMapping={errorToField}\n\t\t\tinitialValues={{\n\t\t\t\tkey: '',\n\t\t\t\tvalue: '',\n\t\t\t}}\n\t\t\tvalidate={({ values }) => {\n\t\t\t\tconst errors: SetProjectSecretFormError[] = []\n\t\t\t\tif (!values.key) {\n\t\t\t\t\terrors.push({ code: 'FIELD_REQUIRED', field: 'key' })\n\t\t\t\t}\n\t\t\t\tif (!values.value) {\n\t\t\t\t\terrors.push({ code: 'FIELD_REQUIRED', field: 'value' })\n\t\t\t\t}\n\t\t\t\treturn errors\n\t\t\t}}\n\t\t\texecute={async ({ values }) => {\n\t\t\t\treturn await setProjectSecret({\n\t\t\t\t\tprojectSlug,\n\t\t\t\t\tkey: values.key,\n\t\t\t\t\tvalue: values.value,\n\t\t\t\t})\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\n\nconst errorToField: Record<SetProjectSecretErrorCode, keyof SetProjectSecretFormValues | undefined> = {\n\tPROJECT_NOT_FOUND: undefined,\n}\n"],"names":["useForm","useSetProjectSecretMutation","jsxDEV","TenantForm","this"],"mappings":";;;;;;AA6BO,MAAM,0BAA0BA,SAAAA;AAEhC,MAAM,uBAAuB,CAAC,EAAE,UAAU,WAAW,kBAA6C;AACxG,QAAM,mBAAmBC,4BAAAA,4BAAA;AACzB,SACCC,8BAAAA;AAAAA,IAACC,WAAAA;AAAAA,IAAA;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,eAAe;AAAA,QACd,KAAK;AAAA,QACL,OAAO;AAAA,MAAA;AAAA,MAER,UAAU,CAAC,EAAE,aAAa;AACzB,cAAM,SAAsC,CAAA;AAC5C,YAAI,CAAC,OAAO,KAAK;AAChB,iBAAO,KAAK,EAAE,MAAM,kBAAkB,OAAO,OAAO;AAAA,QACrD;AACA,YAAI,CAAC,OAAO,OAAO;AAClB,iBAAO,KAAK,EAAE,MAAM,kBAAkB,OAAO,SAAS;AAAA,QACvD;AACA,eAAO;AAAA,MACR;AAAA,MACA,SAAS,OAAO,EAAE,aAAa;AAC9B,eAAO,MAAM,iBAAiB;AAAA,UAC7B;AAAA,UACA,KAAK,OAAO;AAAA,UACZ,OAAO,OAAO;AAAA,QAAA,CACd;AAAA,MACF;AAAA,MAEC;AAAA,IAAA;AAAA,IAzBF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAAA;AA4BF;AAEA,MAAM,eAAgG;AAAA,EACrG,mBAAmB;AACpB;;;"}
@@ -0,0 +1,53 @@
1
+ import { jsxDEV } from "react/jsx-dev-runtime";
2
+ import { TenantForm } from "./TenantForm.js";
3
+ import { useForm } from "../../contexts.js";
4
+ import { useSetProjectSecretMutation } from "../../hooks/mutations/project/useSetProjectSecretMutation.js";
5
+ const useSetProjectSecretForm = useForm;
6
+ const SetProjectSecretForm = ({ children, onSuccess, projectSlug }) => {
7
+ const setProjectSecret = useSetProjectSecretMutation();
8
+ return /* @__PURE__ */ jsxDEV(
9
+ TenantForm,
10
+ {
11
+ onSuccess,
12
+ errorMapping: errorToField,
13
+ initialValues: {
14
+ key: "",
15
+ value: ""
16
+ },
17
+ validate: ({ values }) => {
18
+ const errors = [];
19
+ if (!values.key) {
20
+ errors.push({ code: "FIELD_REQUIRED", field: "key" });
21
+ }
22
+ if (!values.value) {
23
+ errors.push({ code: "FIELD_REQUIRED", field: "value" });
24
+ }
25
+ return errors;
26
+ },
27
+ execute: async ({ values }) => {
28
+ return await setProjectSecret({
29
+ projectSlug,
30
+ key: values.key,
31
+ value: values.value
32
+ });
33
+ },
34
+ children
35
+ },
36
+ void 0,
37
+ false,
38
+ {
39
+ fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/SetProjectSecretForm.tsx",
40
+ lineNumber: 35,
41
+ columnNumber: 3
42
+ },
43
+ void 0
44
+ );
45
+ };
46
+ const errorToField = {
47
+ PROJECT_NOT_FOUND: void 0
48
+ };
49
+ export {
50
+ SetProjectSecretForm,
51
+ useSetProjectSecretForm
52
+ };
53
+ //# sourceMappingURL=SetProjectSecretForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SetProjectSecretForm.js","sources":["../../../../../../packages/react-client-tenant/src/components/forms/SetProjectSecretForm.tsx"],"sourcesContent":["import { ReactElement } from 'react'\nimport { SetProjectSecretErrorCode } from '@contember/graphql-client-tenant'\nimport { TenantForm } from './TenantForm.js'\nimport { FormContextValue, FormError, FormState } from '../../types/index.js'\nimport { useForm } from '../../contexts.js'\nimport { useSetProjectSecretMutation } from '../../hooks/index.js'\n\nexport type SetProjectSecretFormValues = {\n\tkey: string\n\tvalue: string\n}\n\nexport type SetProjectSecretFormErrorCode =\n\t| SetProjectSecretErrorCode\n\t| 'FIELD_REQUIRED'\n\t| 'UNKNOWN_ERROR'\n\nexport type SetProjectSecretFormState = FormState\n\nexport type SetProjectSecretFormError = FormError<SetProjectSecretFormValues, SetProjectSecretFormErrorCode>\n\nexport type SetProjectSecretFormContextValue = FormContextValue<SetProjectSecretFormValues, SetProjectSecretFormErrorCode>\n\nexport interface SetProjectSecretFormProps {\n\tchildren: ReactElement\n\tprojectSlug: string\n\tonSuccess?: () => void\n}\n\nexport const useSetProjectSecretForm = useForm as () => SetProjectSecretFormContextValue\n\nexport const SetProjectSecretForm = ({ children, onSuccess, projectSlug }: SetProjectSecretFormProps) => {\n\tconst setProjectSecret = useSetProjectSecretMutation()\n\treturn (\n\t\t<TenantForm<SetProjectSecretFormContextValue>\n\t\t\tonSuccess={onSuccess}\n\t\t\terrorMapping={errorToField}\n\t\t\tinitialValues={{\n\t\t\t\tkey: '',\n\t\t\t\tvalue: '',\n\t\t\t}}\n\t\t\tvalidate={({ values }) => {\n\t\t\t\tconst errors: SetProjectSecretFormError[] = []\n\t\t\t\tif (!values.key) {\n\t\t\t\t\terrors.push({ code: 'FIELD_REQUIRED', field: 'key' })\n\t\t\t\t}\n\t\t\t\tif (!values.value) {\n\t\t\t\t\terrors.push({ code: 'FIELD_REQUIRED', field: 'value' })\n\t\t\t\t}\n\t\t\t\treturn errors\n\t\t\t}}\n\t\t\texecute={async ({ values }) => {\n\t\t\t\treturn await setProjectSecret({\n\t\t\t\t\tprojectSlug,\n\t\t\t\t\tkey: values.key,\n\t\t\t\t\tvalue: values.value,\n\t\t\t\t})\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\n\nconst errorToField: Record<SetProjectSecretErrorCode, keyof SetProjectSecretFormValues | undefined> = {\n\tPROJECT_NOT_FOUND: undefined,\n}\n"],"names":["this"],"mappings":";;;;AA6BO,MAAM,0BAA0B;AAEhC,MAAM,uBAAuB,CAAC,EAAE,UAAU,WAAW,kBAA6C;AACxG,QAAM,mBAAmB,4BAAA;AACzB,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,eAAe;AAAA,QACd,KAAK;AAAA,QACL,OAAO;AAAA,MAAA;AAAA,MAER,UAAU,CAAC,EAAE,aAAa;AACzB,cAAM,SAAsC,CAAA;AAC5C,YAAI,CAAC,OAAO,KAAK;AAChB,iBAAO,KAAK,EAAE,MAAM,kBAAkB,OAAO,OAAO;AAAA,QACrD;AACA,YAAI,CAAC,OAAO,OAAO;AAClB,iBAAO,KAAK,EAAE,MAAM,kBAAkB,OAAO,SAAS;AAAA,QACvD;AACA,eAAO;AAAA,MACR;AAAA,MACA,SAAS,OAAO,EAAE,aAAa;AAC9B,eAAO,MAAM,iBAAiB;AAAA,UAC7B;AAAA,UACA,KAAK,OAAO;AAAA,UACZ,OAAO,OAAO;AAAA,QAAA,CACd;AAAA,MACF;AAAA,MAEC;AAAA,IAAA;AAAA,IAzBF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AA4BF;AAEA,MAAM,eAAgG;AAAA,EACrG,mBAAmB;AACpB;"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxDevRuntime = require("react/jsx-dev-runtime");
4
+ const React = require("react");
5
+ const TenantForm = require("./TenantForm.cjs");
6
+ const contexts = require("../../contexts.cjs");
7
+ const useSignUpMutation = require("../../hooks/mutations/auth/useSignUpMutation.cjs");
8
+ const useSignUpForm = contexts.useForm;
9
+ const SignUpForm = ({ children, onSuccess, roles, captchaToken }) => {
10
+ const signUp = useSignUpMutation.useSignUpMutation();
11
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
12
+ TenantForm.TenantForm,
13
+ {
14
+ onSuccess,
15
+ errorMapping: errorToField,
16
+ initialValues: React.useMemo(() => ({
17
+ email: "",
18
+ password: "",
19
+ passwordConfirmation: "",
20
+ name: ""
21
+ }), []),
22
+ validate: ({ values }) => {
23
+ const errors = [];
24
+ if (!values.email) {
25
+ errors.push({ code: "FIELD_REQUIRED", field: "email" });
26
+ } else if (!values.email.match(/^.+@.+$/)) {
27
+ errors.push({ code: "INVALID_VALUE", field: "email" });
28
+ }
29
+ if (!values.password) {
30
+ errors.push({ code: "FIELD_REQUIRED", field: "password" });
31
+ } else if (values.password !== values.passwordConfirmation) {
32
+ errors.push({ code: "PASSWORD_MISMATCH", field: "passwordConfirmation" });
33
+ }
34
+ return errors;
35
+ },
36
+ execute: React.useCallback(async ({ values }) => {
37
+ return await signUp({
38
+ email: values.email,
39
+ password: values.password,
40
+ name: values.name || void 0,
41
+ roles,
42
+ captchaToken
43
+ });
44
+ }, [signUp, roles, captchaToken]),
45
+ children
46
+ },
47
+ void 0,
48
+ false,
49
+ {
50
+ fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/SignUpForm.tsx",
51
+ lineNumber: 46,
52
+ columnNumber: 3
53
+ },
54
+ void 0
55
+ );
56
+ };
57
+ const errorToField = {
58
+ EMAIL_ALREADY_EXISTS: "email",
59
+ INVALID_EMAIL_FORMAT: "email",
60
+ TOO_WEAK: "password",
61
+ INVALID_CAPTCHA: void 0,
62
+ RATE_LIMIT_EXCEEDED: void 0
63
+ };
64
+ exports.SignUpForm = SignUpForm;
65
+ exports.useSignUpForm = useSignUpForm;
66
+ //# sourceMappingURL=SignUpForm.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignUpForm.cjs","sources":["../../../../../../packages/react-client-tenant/src/components/forms/SignUpForm.tsx"],"sourcesContent":["import { ReactElement, useCallback, useMemo } from 'react'\nimport { SignUpErrorCode } from '@contember/graphql-client-tenant'\nimport { TenantForm } from './TenantForm.js'\nimport { FormContextValue, FormError, FormState } from '../../types/forms.js'\nimport { useForm } from '../../contexts.js'\nimport { SignUpMutationResult, useSignUpMutation } from '../../hooks/index.js'\n\nexport type SignUpFormValues = {\n\temail: string\n\tpassword: string\n\tpasswordConfirmation: string\n\tname: string\n}\n\nexport type SignUpFormErrorCode =\n\t| SignUpErrorCode\n\t| 'FIELD_REQUIRED'\n\t| 'INVALID_VALUE'\n\t| 'PASSWORD_MISMATCH'\n\t| 'UNKNOWN_ERROR'\n\nexport type SignUpFormState = FormState\n\nexport type SignUpFormError = FormError<SignUpFormValues, SignUpFormErrorCode>\n\nexport type SignUpFormContextValue = FormContextValue<SignUpFormValues, SignUpFormErrorCode>\n\nexport interface SignUpFormProps {\n\tchildren: ReactElement\n\t/** Tenant roles for the new identity. Only a caller allowed to grant them may pass this. */\n\troles?: readonly string[]\n\tcaptchaToken?: string\n\tonSuccess?: (args: { result: SignUpMutationResult }) => void\n}\n\nexport const useSignUpForm = useForm as () => SignUpFormContextValue\n\n/**\n * Open registration. Note that `signUp` only creates the account — it does not\n * sign anyone in, so a host app usually follows a success with `LoginForm` or,\n * when e-mail verification is required, with a \"check your inbox\" screen.\n */\nexport const SignUpForm = ({ children, onSuccess, roles, captchaToken }: SignUpFormProps) => {\n\tconst signUp = useSignUpMutation()\n\treturn (\n\t\t<TenantForm<SignUpFormContextValue, SignUpMutationResult>\n\t\t\tonSuccess={onSuccess}\n\t\t\terrorMapping={errorToField}\n\t\t\tinitialValues={useMemo(() => ({\n\t\t\t\temail: '',\n\t\t\t\tpassword: '',\n\t\t\t\tpasswordConfirmation: '',\n\t\t\t\tname: '',\n\t\t\t}), [])}\n\t\t\tvalidate={({ values }) => {\n\t\t\t\tconst errors: SignUpFormError[] = []\n\t\t\t\tif (!values.email) {\n\t\t\t\t\terrors.push({ code: 'FIELD_REQUIRED', field: 'email' })\n\t\t\t\t} else if (!values.email.match(/^.+@.+$/)) {\n\t\t\t\t\terrors.push({ code: 'INVALID_VALUE', field: 'email' })\n\t\t\t\t}\n\t\t\t\tif (!values.password) {\n\t\t\t\t\terrors.push({ code: 'FIELD_REQUIRED', field: 'password' })\n\t\t\t\t} else if (values.password !== values.passwordConfirmation) {\n\t\t\t\t\t// Strength is the server's call (config.password) — only the typo check is ours.\n\t\t\t\t\terrors.push({ code: 'PASSWORD_MISMATCH', field: 'passwordConfirmation' })\n\t\t\t\t}\n\t\t\t\treturn errors\n\t\t\t}}\n\t\t\texecute={useCallback(async ({ values }) => {\n\t\t\t\treturn await signUp({\n\t\t\t\t\temail: values.email,\n\t\t\t\t\tpassword: values.password,\n\t\t\t\t\tname: values.name || undefined,\n\t\t\t\t\troles,\n\t\t\t\t\tcaptchaToken,\n\t\t\t\t})\n\t\t\t}, [signUp, roles, captchaToken])}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\n\nconst errorToField: Record<SignUpErrorCode, keyof SignUpFormValues | undefined> = {\n\tEMAIL_ALREADY_EXISTS: 'email',\n\tINVALID_EMAIL_FORMAT: 'email',\n\tTOO_WEAK: 'password',\n\tINVALID_CAPTCHA: undefined,\n\tRATE_LIMIT_EXCEEDED: undefined,\n}\n"],"names":["useForm","useSignUpMutation","jsxDEV","TenantForm","useMemo","useCallback","this"],"mappings":";;;;;;;AAmCO,MAAM,gBAAgBA,SAAAA;AAOtB,MAAM,aAAa,CAAC,EAAE,UAAU,WAAW,OAAO,mBAAoC;AAC5F,QAAM,SAASC,kBAAAA,kBAAA;AACf,SACCC,8BAAAA;AAAAA,IAACC,WAAAA;AAAAA,IAAA;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,eAAeC,MAAAA,QAAQ,OAAO;AAAA,QAC7B,OAAO;AAAA,QACP,UAAU;AAAA,QACV,sBAAsB;AAAA,QACtB,MAAM;AAAA,MAAA,IACH,CAAA,CAAE;AAAA,MACN,UAAU,CAAC,EAAE,aAAa;AACzB,cAAM,SAA4B,CAAA;AAClC,YAAI,CAAC,OAAO,OAAO;AAClB,iBAAO,KAAK,EAAE,MAAM,kBAAkB,OAAO,SAAS;AAAA,QACvD,WAAW,CAAC,OAAO,MAAM,MAAM,SAAS,GAAG;AAC1C,iBAAO,KAAK,EAAE,MAAM,iBAAiB,OAAO,SAAS;AAAA,QACtD;AACA,YAAI,CAAC,OAAO,UAAU;AACrB,iBAAO,KAAK,EAAE,MAAM,kBAAkB,OAAO,YAAY;AAAA,QAC1D,WAAW,OAAO,aAAa,OAAO,sBAAsB;AAE3D,iBAAO,KAAK,EAAE,MAAM,qBAAqB,OAAO,wBAAwB;AAAA,QACzE;AACA,eAAO;AAAA,MACR;AAAA,MACA,SAASC,MAAAA,YAAY,OAAO,EAAE,aAAa;AAC1C,eAAO,MAAM,OAAO;AAAA,UACnB,OAAO,OAAO;AAAA,UACd,UAAU,OAAO;AAAA,UACjB,MAAM,OAAO,QAAQ;AAAA,UACrB;AAAA,UACA;AAAA,QAAA,CACA;AAAA,MACF,GAAG,CAAC,QAAQ,OAAO,YAAY,CAAC;AAAA,MAE/B;AAAA,IAAA;AAAA,IAlCF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAAA;AAqCF;AAEA,MAAM,eAA4E;AAAA,EACjF,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,qBAAqB;AACtB;;;"}
@@ -0,0 +1,66 @@
1
+ import { jsxDEV } from "react/jsx-dev-runtime";
2
+ import { useCallback, useMemo } from "react";
3
+ import { TenantForm } from "./TenantForm.js";
4
+ import { useForm } from "../../contexts.js";
5
+ import { useSignUpMutation } from "../../hooks/mutations/auth/useSignUpMutation.js";
6
+ const useSignUpForm = useForm;
7
+ const SignUpForm = ({ children, onSuccess, roles, captchaToken }) => {
8
+ const signUp = useSignUpMutation();
9
+ return /* @__PURE__ */ jsxDEV(
10
+ TenantForm,
11
+ {
12
+ onSuccess,
13
+ errorMapping: errorToField,
14
+ initialValues: useMemo(() => ({
15
+ email: "",
16
+ password: "",
17
+ passwordConfirmation: "",
18
+ name: ""
19
+ }), []),
20
+ validate: ({ values }) => {
21
+ const errors = [];
22
+ if (!values.email) {
23
+ errors.push({ code: "FIELD_REQUIRED", field: "email" });
24
+ } else if (!values.email.match(/^.+@.+$/)) {
25
+ errors.push({ code: "INVALID_VALUE", field: "email" });
26
+ }
27
+ if (!values.password) {
28
+ errors.push({ code: "FIELD_REQUIRED", field: "password" });
29
+ } else if (values.password !== values.passwordConfirmation) {
30
+ errors.push({ code: "PASSWORD_MISMATCH", field: "passwordConfirmation" });
31
+ }
32
+ return errors;
33
+ },
34
+ execute: useCallback(async ({ values }) => {
35
+ return await signUp({
36
+ email: values.email,
37
+ password: values.password,
38
+ name: values.name || void 0,
39
+ roles,
40
+ captchaToken
41
+ });
42
+ }, [signUp, roles, captchaToken]),
43
+ children
44
+ },
45
+ void 0,
46
+ false,
47
+ {
48
+ fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/SignUpForm.tsx",
49
+ lineNumber: 46,
50
+ columnNumber: 3
51
+ },
52
+ void 0
53
+ );
54
+ };
55
+ const errorToField = {
56
+ EMAIL_ALREADY_EXISTS: "email",
57
+ INVALID_EMAIL_FORMAT: "email",
58
+ TOO_WEAK: "password",
59
+ INVALID_CAPTCHA: void 0,
60
+ RATE_LIMIT_EXCEEDED: void 0
61
+ };
62
+ export {
63
+ SignUpForm,
64
+ useSignUpForm
65
+ };
66
+ //# sourceMappingURL=SignUpForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignUpForm.js","sources":["../../../../../../packages/react-client-tenant/src/components/forms/SignUpForm.tsx"],"sourcesContent":["import { ReactElement, useCallback, useMemo } from 'react'\nimport { SignUpErrorCode } from '@contember/graphql-client-tenant'\nimport { TenantForm } from './TenantForm.js'\nimport { FormContextValue, FormError, FormState } from '../../types/forms.js'\nimport { useForm } from '../../contexts.js'\nimport { SignUpMutationResult, useSignUpMutation } from '../../hooks/index.js'\n\nexport type SignUpFormValues = {\n\temail: string\n\tpassword: string\n\tpasswordConfirmation: string\n\tname: string\n}\n\nexport type SignUpFormErrorCode =\n\t| SignUpErrorCode\n\t| 'FIELD_REQUIRED'\n\t| 'INVALID_VALUE'\n\t| 'PASSWORD_MISMATCH'\n\t| 'UNKNOWN_ERROR'\n\nexport type SignUpFormState = FormState\n\nexport type SignUpFormError = FormError<SignUpFormValues, SignUpFormErrorCode>\n\nexport type SignUpFormContextValue = FormContextValue<SignUpFormValues, SignUpFormErrorCode>\n\nexport interface SignUpFormProps {\n\tchildren: ReactElement\n\t/** Tenant roles for the new identity. Only a caller allowed to grant them may pass this. */\n\troles?: readonly string[]\n\tcaptchaToken?: string\n\tonSuccess?: (args: { result: SignUpMutationResult }) => void\n}\n\nexport const useSignUpForm = useForm as () => SignUpFormContextValue\n\n/**\n * Open registration. Note that `signUp` only creates the account — it does not\n * sign anyone in, so a host app usually follows a success with `LoginForm` or,\n * when e-mail verification is required, with a \"check your inbox\" screen.\n */\nexport const SignUpForm = ({ children, onSuccess, roles, captchaToken }: SignUpFormProps) => {\n\tconst signUp = useSignUpMutation()\n\treturn (\n\t\t<TenantForm<SignUpFormContextValue, SignUpMutationResult>\n\t\t\tonSuccess={onSuccess}\n\t\t\terrorMapping={errorToField}\n\t\t\tinitialValues={useMemo(() => ({\n\t\t\t\temail: '',\n\t\t\t\tpassword: '',\n\t\t\t\tpasswordConfirmation: '',\n\t\t\t\tname: '',\n\t\t\t}), [])}\n\t\t\tvalidate={({ values }) => {\n\t\t\t\tconst errors: SignUpFormError[] = []\n\t\t\t\tif (!values.email) {\n\t\t\t\t\terrors.push({ code: 'FIELD_REQUIRED', field: 'email' })\n\t\t\t\t} else if (!values.email.match(/^.+@.+$/)) {\n\t\t\t\t\terrors.push({ code: 'INVALID_VALUE', field: 'email' })\n\t\t\t\t}\n\t\t\t\tif (!values.password) {\n\t\t\t\t\terrors.push({ code: 'FIELD_REQUIRED', field: 'password' })\n\t\t\t\t} else if (values.password !== values.passwordConfirmation) {\n\t\t\t\t\t// Strength is the server's call (config.password) — only the typo check is ours.\n\t\t\t\t\terrors.push({ code: 'PASSWORD_MISMATCH', field: 'passwordConfirmation' })\n\t\t\t\t}\n\t\t\t\treturn errors\n\t\t\t}}\n\t\t\texecute={useCallback(async ({ values }) => {\n\t\t\t\treturn await signUp({\n\t\t\t\t\temail: values.email,\n\t\t\t\t\tpassword: values.password,\n\t\t\t\t\tname: values.name || undefined,\n\t\t\t\t\troles,\n\t\t\t\t\tcaptchaToken,\n\t\t\t\t})\n\t\t\t}, [signUp, roles, captchaToken])}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\n\nconst errorToField: Record<SignUpErrorCode, keyof SignUpFormValues | undefined> = {\n\tEMAIL_ALREADY_EXISTS: 'email',\n\tINVALID_EMAIL_FORMAT: 'email',\n\tTOO_WEAK: 'password',\n\tINVALID_CAPTCHA: undefined,\n\tRATE_LIMIT_EXCEEDED: undefined,\n}\n"],"names":["this"],"mappings":";;;;;AAmCO,MAAM,gBAAgB;AAOtB,MAAM,aAAa,CAAC,EAAE,UAAU,WAAW,OAAO,mBAAoC;AAC5F,QAAM,SAAS,kBAAA;AACf,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,eAAe,QAAQ,OAAO;AAAA,QAC7B,OAAO;AAAA,QACP,UAAU;AAAA,QACV,sBAAsB;AAAA,QACtB,MAAM;AAAA,MAAA,IACH,CAAA,CAAE;AAAA,MACN,UAAU,CAAC,EAAE,aAAa;AACzB,cAAM,SAA4B,CAAA;AAClC,YAAI,CAAC,OAAO,OAAO;AAClB,iBAAO,KAAK,EAAE,MAAM,kBAAkB,OAAO,SAAS;AAAA,QACvD,WAAW,CAAC,OAAO,MAAM,MAAM,SAAS,GAAG;AAC1C,iBAAO,KAAK,EAAE,MAAM,iBAAiB,OAAO,SAAS;AAAA,QACtD;AACA,YAAI,CAAC,OAAO,UAAU;AACrB,iBAAO,KAAK,EAAE,MAAM,kBAAkB,OAAO,YAAY;AAAA,QAC1D,WAAW,OAAO,aAAa,OAAO,sBAAsB;AAE3D,iBAAO,KAAK,EAAE,MAAM,qBAAqB,OAAO,wBAAwB;AAAA,QACzE;AACA,eAAO;AAAA,MACR;AAAA,MACA,SAAS,YAAY,OAAO,EAAE,aAAa;AAC1C,eAAO,MAAM,OAAO;AAAA,UACnB,OAAO,OAAO;AAAA,UACd,UAAU,OAAO;AAAA,UACjB,MAAM,OAAO,QAAQ;AAAA,UACrB;AAAA,UACA;AAAA,QAAA,CACA;AAAA,MACF,GAAG,CAAC,QAAQ,OAAO,YAAY,CAAC;AAAA,MAE/B;AAAA,IAAA;AAAA,IAlCF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AAqCF;AAEA,MAAM,eAA4E;AAAA,EACjF,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,qBAAqB;AACtB;"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxDevRuntime = require("react/jsx-dev-runtime");
4
4
  const React = require("react");
5
5
  const reactSlot = require("@radix-ui/react-slot");
6
+ const forbidden = require("../../types/forbidden.cjs");
6
7
  const contexts = require("../../contexts.cjs");
7
8
  const reactUtils = require("@contember/react-utils");
8
9
  const SlotForm = reactSlot.Slot;
@@ -58,10 +59,13 @@ const TenantForm = ({
58
59
  onSuccess?.({ result: "result" in response ? response.result : void 0 });
59
60
  }
60
61
  } catch (e) {
61
- console.error(e);
62
+ const code = forbidden.toFormErrorCode(e);
63
+ if (code !== "FORBIDDEN") {
64
+ console.error(e);
65
+ }
62
66
  setState("error");
63
67
  setErrors([{
64
- code: "UNKNOWN_ERROR",
68
+ code,
65
69
  developerMessage: typeof e === "string" ? e : e && typeof e === "object" && "message" in e && typeof e.message === "string" ? e.message : void 0
66
70
  }]);
67
71
  }
@@ -83,7 +87,7 @@ const TenantForm = ({
83
87
  },
84
88
  children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(SlotForm, { onSubmit: submit, children }, void 0, false, {
85
89
  fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/TenantForm.tsx",
86
- lineNumber: 115,
90
+ lineNumber: 119,
87
91
  columnNumber: 4
88
92
  }, void 0)
89
93
  },
@@ -91,7 +95,7 @@ const TenantForm = ({
91
95
  false,
92
96
  {
93
97
  fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/TenantForm.tsx",
94
- lineNumber: 106,
98
+ lineNumber: 110,
95
99
  columnNumber: 3
96
100
  },
97
101
  void 0
@@ -1 +1 @@
1
- {"version":3,"file":"TenantForm.cjs","sources":["../../../../../../packages/react-client-tenant/src/components/forms/TenantForm.tsx"],"sourcesContent":["import { ComponentType, ReactElement, useCallback, useEffect, useState } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { FormContextValue } from '../../types/forms.js'\nimport { FormContext } from '../../contexts.js'\nimport { useReferentiallyStableCallback } from '@contember/react-utils'\n\nconst SlotForm = Slot as ComponentType<React.FormHTMLAttributes<HTMLFormElement>>\n\ntype ExecuteResult<T extends FormContextValue<any, any, any>, OkResult = undefined> =\n\t| ({ ok: true } & (OkResult extends undefined ? {} : { result: OkResult }))\n\t| { ok: false; error?: T['errors'][number]['code']; developerMessage?: string; state?: T['state'] }\n\nexport interface TenantFormProps<T extends FormContextValue<any, any, any>, OkResult = undefined> {\n\tchildren: ReactElement\n\tloading?: boolean\n\tinitialValues: T['values']\n\terrorMapping?: Partial<Record<T['errors'][number]['code'], keyof T['values']>>\n\tvalidate?: (args: { values: T['values']; state: T['state'] }) => T['errors'] | undefined\n\texecute: (args: { values: T['values']; state: T['state'] }) => Promise<ExecuteResult<T, OkResult>>\n\tonSuccess?: (args: { result: OkResult }) => void\n\tonChange?: (args: { values: T['values']; state: T['state']; submit: () => Promise<void> }) => void\n}\n\nexport const TenantForm = <T extends FormContextValue<any, any, any>, OkResult = undefined>({\n\tchildren,\n\tinitialValues,\n\tloading,\n\terrorMapping,\n\tvalidate: validateIn,\n\texecute: executeIn,\n\tonSuccess: onSuccessIn,\n\tonChange: onChangeIn,\n}: TenantFormProps<T, OkResult>) => {\n\tconst [values, setValues] = useState<T['values']>(initialValues)\n\n\tconst [errors, setErrors] = useState<T['errors']>([])\n\tconst [state, setState] = useState<T['state']>(loading ? 'loading' : 'initial')\n\n\tuseEffect(() => {\n\t\tif (loading) {\n\t\t\tsetState('loading')\n\t\t}\n\t}, [loading])\n\n\tuseEffect(() => {\n\t\tif (state === 'loading' && !loading) {\n\t\t\tsetValues(initialValues)\n\t\t\tsetState('initial')\n\t\t}\n\t}, [initialValues, loading, state])\n\n\tconst validate = useReferentiallyStableCallback(validateIn || (() => undefined))\n\tconst onSuccess = useReferentiallyStableCallback(onSuccessIn || (() => undefined))\n\tconst execute = useReferentiallyStableCallback(executeIn)\n\n\tconst submit = useReferentiallyStableCallback(async (event?: React.FormEvent) => {\n\t\tevent?.preventDefault()\n\t\tconst errors = validate?.({ values, state }) ?? []\n\t\tsetErrors(errors)\n\n\t\tif (errors.length > 0) {\n\t\t\tsetState('error')\n\t\t\treturn\n\t\t}\n\n\t\tsetState('submitting')\n\n\t\ttry {\n\t\t\tconst response = await execute({ values, state })\n\n\t\t\tif (!response.ok) {\n\t\t\t\tconst error = response.error\n\t\t\t\tsetState(response.state ?? 'error')\n\t\t\t\tsetErrors([{\n\t\t\t\t\tcode: error || 'UNKNOWN_ERROR',\n\t\t\t\t\tdeveloperMessage: response.developerMessage,\n\t\t\t\t\tfield: errorMapping && error && error in errorMapping ? errorMapping[error] : undefined,\n\t\t\t\t}])\n\t\t\t} else {\n\t\t\t\tsetState('success')\n\t\t\t\tsetValues(initialValues)\n\t\t\t\tonSuccess?.({ result: 'result' in response ? response.result : undefined as OkResult })\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tsetState('error')\n\t\t\tsetErrors([{\n\t\t\t\tcode: 'UNKNOWN_ERROR',\n\t\t\t\tdeveloperMessage: typeof e === 'string'\n\t\t\t\t\t? e\n\t\t\t\t\t: (e && typeof e === 'object' && 'message' in e && typeof e.message === 'string')\n\t\t\t\t\t? e.message\n\t\t\t\t\t: undefined,\n\t\t\t}])\n\t\t}\n\t})\n\n\tconst onChange = useReferentiallyStableCallback(onChangeIn || (() => undefined))\n\tuseEffect(() => {\n\t\tonChange?.({ values, state, submit })\n\t}, [onChange, state, submit, values])\n\n\tconst setValue = useCallback((field: string, value: string) => setValues(values => ({ ...values, [field]: value })), [])\n\n\treturn (\n\t\t<FormContext.Provider\n\t\t\tvalue={{\n\t\t\t\tvalues,\n\t\t\t\tsetValues,\n\t\t\t\tstate,\n\t\t\t\terrors,\n\t\t\t\tsetValue: setValue,\n\t\t\t} as unknown as T}\n\t\t>\n\t\t\t<SlotForm onSubmit={submit}>\n\t\t\t\t{children}\n\t\t\t</SlotForm>\n\t\t</FormContext.Provider>\n\t)\n}\n"],"names":["Slot","useState","useEffect","useReferentiallyStableCallback","errors","useCallback","values","jsxDEV","FormContext","this"],"mappings":"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"}
1
+ {"version":3,"file":"TenantForm.cjs","sources":["../../../../../../packages/react-client-tenant/src/components/forms/TenantForm.tsx"],"sourcesContent":["import { ComponentType, ReactElement, useCallback, useEffect, useState } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { FormContextValue } from '../../types/forms.js'\nimport { toFormErrorCode } from '../../types/forbidden.js'\nimport { FormContext } from '../../contexts.js'\nimport { useReferentiallyStableCallback } from '@contember/react-utils'\n\nconst SlotForm = Slot as ComponentType<React.FormHTMLAttributes<HTMLFormElement>>\n\ntype ExecuteResult<T extends FormContextValue<any, any, any>, OkResult = undefined> =\n\t| ({ ok: true } & (OkResult extends undefined ? {} : { result: OkResult }))\n\t| { ok: false; error?: T['errors'][number]['code']; developerMessage?: string; state?: T['state'] }\n\nexport interface TenantFormProps<T extends FormContextValue<any, any, any>, OkResult = undefined> {\n\tchildren: ReactElement\n\tloading?: boolean\n\tinitialValues: T['values']\n\terrorMapping?: Partial<Record<T['errors'][number]['code'], keyof T['values']>>\n\tvalidate?: (args: { values: T['values']; state: T['state'] }) => T['errors'] | undefined\n\texecute: (args: { values: T['values']; state: T['state'] }) => Promise<ExecuteResult<T, OkResult>>\n\tonSuccess?: (args: { result: OkResult }) => void\n\tonChange?: (args: { values: T['values']; state: T['state']; submit: () => Promise<void> }) => void\n}\n\nexport const TenantForm = <T extends FormContextValue<any, any, any>, OkResult = undefined>({\n\tchildren,\n\tinitialValues,\n\tloading,\n\terrorMapping,\n\tvalidate: validateIn,\n\texecute: executeIn,\n\tonSuccess: onSuccessIn,\n\tonChange: onChangeIn,\n}: TenantFormProps<T, OkResult>) => {\n\tconst [values, setValues] = useState<T['values']>(initialValues)\n\n\tconst [errors, setErrors] = useState<T['errors']>([])\n\tconst [state, setState] = useState<T['state']>(loading ? 'loading' : 'initial')\n\n\tuseEffect(() => {\n\t\tif (loading) {\n\t\t\tsetState('loading')\n\t\t}\n\t}, [loading])\n\n\tuseEffect(() => {\n\t\tif (state === 'loading' && !loading) {\n\t\t\tsetValues(initialValues)\n\t\t\tsetState('initial')\n\t\t}\n\t}, [initialValues, loading, state])\n\n\tconst validate = useReferentiallyStableCallback(validateIn || (() => undefined))\n\tconst onSuccess = useReferentiallyStableCallback(onSuccessIn || (() => undefined))\n\tconst execute = useReferentiallyStableCallback(executeIn)\n\n\tconst submit = useReferentiallyStableCallback(async (event?: React.FormEvent) => {\n\t\tevent?.preventDefault()\n\t\tconst errors = validate?.({ values, state }) ?? []\n\t\tsetErrors(errors)\n\n\t\tif (errors.length > 0) {\n\t\t\tsetState('error')\n\t\t\treturn\n\t\t}\n\n\t\tsetState('submitting')\n\n\t\ttry {\n\t\t\tconst response = await execute({ values, state })\n\n\t\t\tif (!response.ok) {\n\t\t\t\tconst error = response.error\n\t\t\t\tsetState(response.state ?? 'error')\n\t\t\t\tsetErrors([{\n\t\t\t\t\tcode: error || 'UNKNOWN_ERROR',\n\t\t\t\t\tdeveloperMessage: response.developerMessage,\n\t\t\t\t\tfield: errorMapping && error && error in errorMapping ? errorMapping[error] : undefined,\n\t\t\t\t}])\n\t\t\t} else {\n\t\t\t\tsetState('success')\n\t\t\t\tsetValues(initialValues)\n\t\t\t\tonSuccess?.({ result: 'result' in response ? response.result : undefined as OkResult })\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconst code = toFormErrorCode(e)\n\t\t\tif (code !== 'FORBIDDEN') {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t\tsetState('error')\n\t\t\tsetErrors([{\n\t\t\t\tcode,\n\t\t\t\tdeveloperMessage: typeof e === 'string'\n\t\t\t\t\t? e\n\t\t\t\t\t: (e && typeof e === 'object' && 'message' in e && typeof e.message === 'string')\n\t\t\t\t\t? e.message\n\t\t\t\t\t: undefined,\n\t\t\t}])\n\t\t}\n\t})\n\n\tconst onChange = useReferentiallyStableCallback(onChangeIn || (() => undefined))\n\tuseEffect(() => {\n\t\tonChange?.({ values, state, submit })\n\t}, [onChange, state, submit, values])\n\n\tconst setValue = useCallback((field: string, value: string) => setValues(values => ({ ...values, [field]: value })), [])\n\n\treturn (\n\t\t<FormContext.Provider\n\t\t\tvalue={{\n\t\t\t\tvalues,\n\t\t\t\tsetValues,\n\t\t\t\tstate,\n\t\t\t\terrors,\n\t\t\t\tsetValue: setValue,\n\t\t\t} as unknown as T}\n\t\t>\n\t\t\t<SlotForm onSubmit={submit}>\n\t\t\t\t{children}\n\t\t\t</SlotForm>\n\t\t</FormContext.Provider>\n\t)\n}\n"],"names":["Slot","useState","useEffect","useReferentiallyStableCallback","errors","toFormErrorCode","useCallback","values","jsxDEV","FormContext","this"],"mappings":"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"}
@@ -1,6 +1,7 @@
1
1
  import { jsxDEV } from "react/jsx-dev-runtime";
2
2
  import { useState, useEffect, useCallback } from "react";
3
3
  import { Slot } from "@radix-ui/react-slot";
4
+ import { toFormErrorCode } from "../../types/forbidden.js";
4
5
  import { FormContext } from "../../contexts.js";
5
6
  import { useReferentiallyStableCallback } from "@contember/react-utils";
6
7
  const SlotForm = Slot;
@@ -56,10 +57,13 @@ const TenantForm = ({
56
57
  onSuccess?.({ result: "result" in response ? response.result : void 0 });
57
58
  }
58
59
  } catch (e) {
59
- console.error(e);
60
+ const code = toFormErrorCode(e);
61
+ if (code !== "FORBIDDEN") {
62
+ console.error(e);
63
+ }
60
64
  setState("error");
61
65
  setErrors([{
62
- code: "UNKNOWN_ERROR",
66
+ code,
63
67
  developerMessage: typeof e === "string" ? e : e && typeof e === "object" && "message" in e && typeof e.message === "string" ? e.message : void 0
64
68
  }]);
65
69
  }
@@ -81,7 +85,7 @@ const TenantForm = ({
81
85
  },
82
86
  children: /* @__PURE__ */ jsxDEV(SlotForm, { onSubmit: submit, children }, void 0, false, {
83
87
  fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/TenantForm.tsx",
84
- lineNumber: 115,
88
+ lineNumber: 119,
85
89
  columnNumber: 4
86
90
  }, void 0)
87
91
  },
@@ -89,7 +93,7 @@ const TenantForm = ({
89
93
  false,
90
94
  {
91
95
  fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/TenantForm.tsx",
92
- lineNumber: 106,
96
+ lineNumber: 110,
93
97
  columnNumber: 3
94
98
  },
95
99
  void 0
@@ -1 +1 @@
1
- {"version":3,"file":"TenantForm.js","sources":["../../../../../../packages/react-client-tenant/src/components/forms/TenantForm.tsx"],"sourcesContent":["import { ComponentType, ReactElement, useCallback, useEffect, useState } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { FormContextValue } from '../../types/forms.js'\nimport { FormContext } from '../../contexts.js'\nimport { useReferentiallyStableCallback } from '@contember/react-utils'\n\nconst SlotForm = Slot as ComponentType<React.FormHTMLAttributes<HTMLFormElement>>\n\ntype ExecuteResult<T extends FormContextValue<any, any, any>, OkResult = undefined> =\n\t| ({ ok: true } & (OkResult extends undefined ? {} : { result: OkResult }))\n\t| { ok: false; error?: T['errors'][number]['code']; developerMessage?: string; state?: T['state'] }\n\nexport interface TenantFormProps<T extends FormContextValue<any, any, any>, OkResult = undefined> {\n\tchildren: ReactElement\n\tloading?: boolean\n\tinitialValues: T['values']\n\terrorMapping?: Partial<Record<T['errors'][number]['code'], keyof T['values']>>\n\tvalidate?: (args: { values: T['values']; state: T['state'] }) => T['errors'] | undefined\n\texecute: (args: { values: T['values']; state: T['state'] }) => Promise<ExecuteResult<T, OkResult>>\n\tonSuccess?: (args: { result: OkResult }) => void\n\tonChange?: (args: { values: T['values']; state: T['state']; submit: () => Promise<void> }) => void\n}\n\nexport const TenantForm = <T extends FormContextValue<any, any, any>, OkResult = undefined>({\n\tchildren,\n\tinitialValues,\n\tloading,\n\terrorMapping,\n\tvalidate: validateIn,\n\texecute: executeIn,\n\tonSuccess: onSuccessIn,\n\tonChange: onChangeIn,\n}: TenantFormProps<T, OkResult>) => {\n\tconst [values, setValues] = useState<T['values']>(initialValues)\n\n\tconst [errors, setErrors] = useState<T['errors']>([])\n\tconst [state, setState] = useState<T['state']>(loading ? 'loading' : 'initial')\n\n\tuseEffect(() => {\n\t\tif (loading) {\n\t\t\tsetState('loading')\n\t\t}\n\t}, [loading])\n\n\tuseEffect(() => {\n\t\tif (state === 'loading' && !loading) {\n\t\t\tsetValues(initialValues)\n\t\t\tsetState('initial')\n\t\t}\n\t}, [initialValues, loading, state])\n\n\tconst validate = useReferentiallyStableCallback(validateIn || (() => undefined))\n\tconst onSuccess = useReferentiallyStableCallback(onSuccessIn || (() => undefined))\n\tconst execute = useReferentiallyStableCallback(executeIn)\n\n\tconst submit = useReferentiallyStableCallback(async (event?: React.FormEvent) => {\n\t\tevent?.preventDefault()\n\t\tconst errors = validate?.({ values, state }) ?? []\n\t\tsetErrors(errors)\n\n\t\tif (errors.length > 0) {\n\t\t\tsetState('error')\n\t\t\treturn\n\t\t}\n\n\t\tsetState('submitting')\n\n\t\ttry {\n\t\t\tconst response = await execute({ values, state })\n\n\t\t\tif (!response.ok) {\n\t\t\t\tconst error = response.error\n\t\t\t\tsetState(response.state ?? 'error')\n\t\t\t\tsetErrors([{\n\t\t\t\t\tcode: error || 'UNKNOWN_ERROR',\n\t\t\t\t\tdeveloperMessage: response.developerMessage,\n\t\t\t\t\tfield: errorMapping && error && error in errorMapping ? errorMapping[error] : undefined,\n\t\t\t\t}])\n\t\t\t} else {\n\t\t\t\tsetState('success')\n\t\t\t\tsetValues(initialValues)\n\t\t\t\tonSuccess?.({ result: 'result' in response ? response.result : undefined as OkResult })\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tsetState('error')\n\t\t\tsetErrors([{\n\t\t\t\tcode: 'UNKNOWN_ERROR',\n\t\t\t\tdeveloperMessage: typeof e === 'string'\n\t\t\t\t\t? e\n\t\t\t\t\t: (e && typeof e === 'object' && 'message' in e && typeof e.message === 'string')\n\t\t\t\t\t? e.message\n\t\t\t\t\t: undefined,\n\t\t\t}])\n\t\t}\n\t})\n\n\tconst onChange = useReferentiallyStableCallback(onChangeIn || (() => undefined))\n\tuseEffect(() => {\n\t\tonChange?.({ values, state, submit })\n\t}, [onChange, state, submit, values])\n\n\tconst setValue = useCallback((field: string, value: string) => setValues(values => ({ ...values, [field]: value })), [])\n\n\treturn (\n\t\t<FormContext.Provider\n\t\t\tvalue={{\n\t\t\t\tvalues,\n\t\t\t\tsetValues,\n\t\t\t\tstate,\n\t\t\t\terrors,\n\t\t\t\tsetValue: setValue,\n\t\t\t} as unknown as T}\n\t\t>\n\t\t\t<SlotForm onSubmit={submit}>\n\t\t\t\t{children}\n\t\t\t</SlotForm>\n\t\t</FormContext.Provider>\n\t)\n}\n"],"names":["errors","values","this"],"mappings":"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"}
1
+ {"version":3,"file":"TenantForm.js","sources":["../../../../../../packages/react-client-tenant/src/components/forms/TenantForm.tsx"],"sourcesContent":["import { ComponentType, ReactElement, useCallback, useEffect, useState } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { FormContextValue } from '../../types/forms.js'\nimport { toFormErrorCode } from '../../types/forbidden.js'\nimport { FormContext } from '../../contexts.js'\nimport { useReferentiallyStableCallback } from '@contember/react-utils'\n\nconst SlotForm = Slot as ComponentType<React.FormHTMLAttributes<HTMLFormElement>>\n\ntype ExecuteResult<T extends FormContextValue<any, any, any>, OkResult = undefined> =\n\t| ({ ok: true } & (OkResult extends undefined ? {} : { result: OkResult }))\n\t| { ok: false; error?: T['errors'][number]['code']; developerMessage?: string; state?: T['state'] }\n\nexport interface TenantFormProps<T extends FormContextValue<any, any, any>, OkResult = undefined> {\n\tchildren: ReactElement\n\tloading?: boolean\n\tinitialValues: T['values']\n\terrorMapping?: Partial<Record<T['errors'][number]['code'], keyof T['values']>>\n\tvalidate?: (args: { values: T['values']; state: T['state'] }) => T['errors'] | undefined\n\texecute: (args: { values: T['values']; state: T['state'] }) => Promise<ExecuteResult<T, OkResult>>\n\tonSuccess?: (args: { result: OkResult }) => void\n\tonChange?: (args: { values: T['values']; state: T['state']; submit: () => Promise<void> }) => void\n}\n\nexport const TenantForm = <T extends FormContextValue<any, any, any>, OkResult = undefined>({\n\tchildren,\n\tinitialValues,\n\tloading,\n\terrorMapping,\n\tvalidate: validateIn,\n\texecute: executeIn,\n\tonSuccess: onSuccessIn,\n\tonChange: onChangeIn,\n}: TenantFormProps<T, OkResult>) => {\n\tconst [values, setValues] = useState<T['values']>(initialValues)\n\n\tconst [errors, setErrors] = useState<T['errors']>([])\n\tconst [state, setState] = useState<T['state']>(loading ? 'loading' : 'initial')\n\n\tuseEffect(() => {\n\t\tif (loading) {\n\t\t\tsetState('loading')\n\t\t}\n\t}, [loading])\n\n\tuseEffect(() => {\n\t\tif (state === 'loading' && !loading) {\n\t\t\tsetValues(initialValues)\n\t\t\tsetState('initial')\n\t\t}\n\t}, [initialValues, loading, state])\n\n\tconst validate = useReferentiallyStableCallback(validateIn || (() => undefined))\n\tconst onSuccess = useReferentiallyStableCallback(onSuccessIn || (() => undefined))\n\tconst execute = useReferentiallyStableCallback(executeIn)\n\n\tconst submit = useReferentiallyStableCallback(async (event?: React.FormEvent) => {\n\t\tevent?.preventDefault()\n\t\tconst errors = validate?.({ values, state }) ?? []\n\t\tsetErrors(errors)\n\n\t\tif (errors.length > 0) {\n\t\t\tsetState('error')\n\t\t\treturn\n\t\t}\n\n\t\tsetState('submitting')\n\n\t\ttry {\n\t\t\tconst response = await execute({ values, state })\n\n\t\t\tif (!response.ok) {\n\t\t\t\tconst error = response.error\n\t\t\t\tsetState(response.state ?? 'error')\n\t\t\t\tsetErrors([{\n\t\t\t\t\tcode: error || 'UNKNOWN_ERROR',\n\t\t\t\t\tdeveloperMessage: response.developerMessage,\n\t\t\t\t\tfield: errorMapping && error && error in errorMapping ? errorMapping[error] : undefined,\n\t\t\t\t}])\n\t\t\t} else {\n\t\t\t\tsetState('success')\n\t\t\t\tsetValues(initialValues)\n\t\t\t\tonSuccess?.({ result: 'result' in response ? response.result : undefined as OkResult })\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconst code = toFormErrorCode(e)\n\t\t\tif (code !== 'FORBIDDEN') {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t\tsetState('error')\n\t\t\tsetErrors([{\n\t\t\t\tcode,\n\t\t\t\tdeveloperMessage: typeof e === 'string'\n\t\t\t\t\t? e\n\t\t\t\t\t: (e && typeof e === 'object' && 'message' in e && typeof e.message === 'string')\n\t\t\t\t\t? e.message\n\t\t\t\t\t: undefined,\n\t\t\t}])\n\t\t}\n\t})\n\n\tconst onChange = useReferentiallyStableCallback(onChangeIn || (() => undefined))\n\tuseEffect(() => {\n\t\tonChange?.({ values, state, submit })\n\t}, [onChange, state, submit, values])\n\n\tconst setValue = useCallback((field: string, value: string) => setValues(values => ({ ...values, [field]: value })), [])\n\n\treturn (\n\t\t<FormContext.Provider\n\t\t\tvalue={{\n\t\t\t\tvalues,\n\t\t\t\tsetValues,\n\t\t\t\tstate,\n\t\t\t\terrors,\n\t\t\t\tsetValue: setValue,\n\t\t\t} as unknown as T}\n\t\t>\n\t\t\t<SlotForm onSubmit={submit}>\n\t\t\t\t{children}\n\t\t\t</SlotForm>\n\t\t</FormContext.Provider>\n\t)\n}\n"],"names":["errors","values","this"],"mappings":"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"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxDevRuntime = require("react/jsx-dev-runtime");
4
+ const React = require("react");
5
+ const TenantActionTrigger = require("./TenantActionTrigger.cjs");
6
+ const contexts = require("../../contexts.cjs");
7
+ const useDisableEmailOtpMutation = require("../../hooks/mutations/emailOtp/useDisableEmailOtpMutation.cjs");
8
+ const DisableEmailOtpTrigger = ({ onSuccess, ...props }) => {
9
+ const disableEmailOtp = useDisableEmailOtpMutation.useDisableEmailOtpMutation();
10
+ const { refreshIdentity } = contexts.useIdentityMethods();
11
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
12
+ TenantActionTrigger.TenantActionTrigger,
13
+ {
14
+ execute: React.useCallback(() => disableEmailOtp({}), [disableEmailOtp]),
15
+ onSuccess: () => {
16
+ refreshIdentity();
17
+ onSuccess?.();
18
+ },
19
+ ...props
20
+ },
21
+ void 0,
22
+ false,
23
+ {
24
+ fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/triggers/DisableEmailOtpTrigger.tsx",
25
+ lineNumber: 18,
26
+ columnNumber: 3
27
+ },
28
+ void 0
29
+ );
30
+ };
31
+ exports.DisableEmailOtpTrigger = DisableEmailOtpTrigger;
32
+ //# sourceMappingURL=DisableEmailOtpTrigger.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DisableEmailOtpTrigger.cjs","sources":["../../../../../../packages/react-client-tenant/src/components/triggers/DisableEmailOtpTrigger.tsx"],"sourcesContent":["import { ReactElement, useCallback } from 'react'\nimport { DisableEmailOtpErrorCode } from '@contember/graphql-client-tenant'\nimport { useDisableEmailOtpMutation } from '../../hooks/index.js'\nimport { TenantActionErrorArgs, TenantActionTrigger } from './TenantActionTrigger.js'\nimport { useIdentityMethods } from '../../contexts.js'\n\nexport interface DisableEmailOtpTriggerProps {\n\tchildren: ReactElement\n\tonSuccess?: () => void\n\tonError?: (args: TenantActionErrorArgs<DisableEmailOtpErrorCode>) => void\n}\n\nexport const DisableEmailOtpTrigger = ({ onSuccess, ...props }: DisableEmailOtpTriggerProps) => {\n\tconst disableEmailOtp = useDisableEmailOtpMutation()\n\tconst { refreshIdentity } = useIdentityMethods()\n\n\treturn (\n\t\t<TenantActionTrigger\n\t\t\texecute={useCallback(() => disableEmailOtp({}), [disableEmailOtp])}\n\t\t\tonSuccess={() => {\n\t\t\t\trefreshIdentity()\n\t\t\t\tonSuccess?.()\n\t\t\t}}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n"],"names":["useDisableEmailOtpMutation","useIdentityMethods","jsxDEV","TenantActionTrigger","useCallback","this"],"mappings":";;;;;;;AAYO,MAAM,yBAAyB,CAAC,EAAE,WAAW,GAAG,YAAyC;AAC/F,QAAM,kBAAkBA,2BAAAA,2BAAA;AACxB,QAAM,EAAE,gBAAA,IAAoBC,4BAAA;AAE5B,SACCC,8BAAAA;AAAAA,IAACC,oBAAAA;AAAAA,IAAA;AAAA,MACA,SAASC,MAAAA,YAAY,MAAM,gBAAgB,CAAA,CAAE,GAAG,CAAC,eAAe,CAAC;AAAA,MACjE,WAAW,MAAM;AAChB,wBAAA;AACA,oBAAA;AAAA,MACD;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,IANL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAAA;AASF;;"}
@@ -0,0 +1,32 @@
1
+ import { jsxDEV } from "react/jsx-dev-runtime";
2
+ import { useCallback } from "react";
3
+ import { TenantActionTrigger } from "./TenantActionTrigger.js";
4
+ import { useIdentityMethods } from "../../contexts.js";
5
+ import { useDisableEmailOtpMutation } from "../../hooks/mutations/emailOtp/useDisableEmailOtpMutation.js";
6
+ const DisableEmailOtpTrigger = ({ onSuccess, ...props }) => {
7
+ const disableEmailOtp = useDisableEmailOtpMutation();
8
+ const { refreshIdentity } = useIdentityMethods();
9
+ return /* @__PURE__ */ jsxDEV(
10
+ TenantActionTrigger,
11
+ {
12
+ execute: useCallback(() => disableEmailOtp({}), [disableEmailOtp]),
13
+ onSuccess: () => {
14
+ refreshIdentity();
15
+ onSuccess?.();
16
+ },
17
+ ...props
18
+ },
19
+ void 0,
20
+ false,
21
+ {
22
+ fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/triggers/DisableEmailOtpTrigger.tsx",
23
+ lineNumber: 18,
24
+ columnNumber: 3
25
+ },
26
+ void 0
27
+ );
28
+ };
29
+ export {
30
+ DisableEmailOtpTrigger
31
+ };
32
+ //# sourceMappingURL=DisableEmailOtpTrigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DisableEmailOtpTrigger.js","sources":["../../../../../../packages/react-client-tenant/src/components/triggers/DisableEmailOtpTrigger.tsx"],"sourcesContent":["import { ReactElement, useCallback } from 'react'\nimport { DisableEmailOtpErrorCode } from '@contember/graphql-client-tenant'\nimport { useDisableEmailOtpMutation } from '../../hooks/index.js'\nimport { TenantActionErrorArgs, TenantActionTrigger } from './TenantActionTrigger.js'\nimport { useIdentityMethods } from '../../contexts.js'\n\nexport interface DisableEmailOtpTriggerProps {\n\tchildren: ReactElement\n\tonSuccess?: () => void\n\tonError?: (args: TenantActionErrorArgs<DisableEmailOtpErrorCode>) => void\n}\n\nexport const DisableEmailOtpTrigger = ({ onSuccess, ...props }: DisableEmailOtpTriggerProps) => {\n\tconst disableEmailOtp = useDisableEmailOtpMutation()\n\tconst { refreshIdentity } = useIdentityMethods()\n\n\treturn (\n\t\t<TenantActionTrigger\n\t\t\texecute={useCallback(() => disableEmailOtp({}), [disableEmailOtp])}\n\t\t\tonSuccess={() => {\n\t\t\t\trefreshIdentity()\n\t\t\t\tonSuccess?.()\n\t\t\t}}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n"],"names":["this"],"mappings":";;;;;AAYO,MAAM,yBAAyB,CAAC,EAAE,WAAW,GAAG,YAAyC;AAC/F,QAAM,kBAAkB,2BAAA;AACxB,QAAM,EAAE,gBAAA,IAAoB,mBAAA;AAE5B,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,SAAS,YAAY,MAAM,gBAAgB,CAAA,CAAE,GAAG,CAAC,eAAe,CAAC;AAAA,MACjE,WAAW,MAAM;AAChB,wBAAA;AACA,oBAAA;AAAA,MACD;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,IANL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AASF;"}