@contember/create 2.2.0-alpha.2 → 2.2.0-alpha.21

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 (167) hide show
  1. package/CLAUDE.md +22 -0
  2. package/dist/development/run.cjs +7 -7
  3. package/dist/development/run.cjs.map +1 -1
  4. package/dist/development/run.js +8 -8
  5. package/dist/development/run.js.map +1 -1
  6. package/dist/development/src/commands/WorkspaceCreateCommand.cjs +36 -23
  7. package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  8. package/dist/development/src/commands/WorkspaceCreateCommand.js +37 -24
  9. package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
  10. package/dist/development/src/lib/FileSystem.cjs +10 -4
  11. package/dist/development/src/lib/FileSystem.cjs.map +1 -1
  12. package/dist/development/src/lib/FileSystem.js +8 -2
  13. package/dist/development/src/lib/FileSystem.js.map +1 -1
  14. package/dist/development/src/lib/TemplateInstaller.cjs +71 -60
  15. package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
  16. package/dist/development/src/lib/TemplateInstaller.js +71 -60
  17. package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
  18. package/dist/development/src/lib/fsErrors.cjs +7 -0
  19. package/dist/development/src/lib/fsErrors.cjs.map +1 -0
  20. package/dist/development/src/lib/fsErrors.js +7 -0
  21. package/dist/development/src/lib/fsErrors.js.map +1 -0
  22. package/dist/development/src/lib/projectPath.cjs +66 -0
  23. package/dist/development/src/lib/projectPath.cjs.map +1 -0
  24. package/dist/development/src/lib/projectPath.js +66 -0
  25. package/dist/development/src/lib/projectPath.js.map +1 -0
  26. package/dist/development/src/lib/remoteTemplate.cjs +108 -0
  27. package/dist/development/src/lib/remoteTemplate.cjs.map +1 -0
  28. package/dist/development/src/lib/remoteTemplate.js +108 -0
  29. package/dist/development/src/lib/remoteTemplate.js.map +1 -0
  30. package/dist/development/src/lib/tar.cjs +243 -0
  31. package/dist/development/src/lib/tar.cjs.map +1 -0
  32. package/dist/development/src/lib/tar.js +243 -0
  33. package/dist/development/src/lib/tar.js.map +1 -0
  34. package/dist/production/run.cjs +7 -7
  35. package/dist/production/run.cjs.map +1 -1
  36. package/dist/production/run.js +8 -8
  37. package/dist/production/run.js.map +1 -1
  38. package/dist/production/src/commands/WorkspaceCreateCommand.cjs +36 -23
  39. package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  40. package/dist/production/src/commands/WorkspaceCreateCommand.js +37 -24
  41. package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
  42. package/dist/production/src/lib/FileSystem.cjs +10 -4
  43. package/dist/production/src/lib/FileSystem.cjs.map +1 -1
  44. package/dist/production/src/lib/FileSystem.js +8 -2
  45. package/dist/production/src/lib/FileSystem.js.map +1 -1
  46. package/dist/production/src/lib/TemplateInstaller.cjs +71 -60
  47. package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
  48. package/dist/production/src/lib/TemplateInstaller.js +71 -60
  49. package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
  50. package/dist/production/src/lib/fsErrors.cjs +7 -0
  51. package/dist/production/src/lib/fsErrors.cjs.map +1 -0
  52. package/dist/production/src/lib/fsErrors.js +7 -0
  53. package/dist/production/src/lib/fsErrors.js.map +1 -0
  54. package/dist/production/src/lib/projectPath.cjs +66 -0
  55. package/dist/production/src/lib/projectPath.cjs.map +1 -0
  56. package/dist/production/src/lib/projectPath.js +66 -0
  57. package/dist/production/src/lib/projectPath.js.map +1 -0
  58. package/dist/production/src/lib/remoteTemplate.cjs +108 -0
  59. package/dist/production/src/lib/remoteTemplate.cjs.map +1 -0
  60. package/dist/production/src/lib/remoteTemplate.js +108 -0
  61. package/dist/production/src/lib/remoteTemplate.js.map +1 -0
  62. package/dist/production/src/lib/tar.cjs +243 -0
  63. package/dist/production/src/lib/tar.cjs.map +1 -0
  64. package/dist/production/src/lib/tar.js +243 -0
  65. package/dist/production/src/lib/tar.js.map +1 -0
  66. package/dist/types/commands/WorkspaceCreateCommand.d.ts +15 -3
  67. package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
  68. package/dist/types/lib/FileSystem.d.ts +2 -0
  69. package/dist/types/lib/FileSystem.d.ts.map +1 -1
  70. package/dist/types/lib/TemplateInstaller.d.ts +9 -1
  71. package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
  72. package/dist/types/lib/fsErrors.d.ts +3 -0
  73. package/dist/types/lib/fsErrors.d.ts.map +1 -0
  74. package/dist/types/lib/projectPath.d.ts +12 -0
  75. package/dist/types/lib/projectPath.d.ts.map +1 -0
  76. package/dist/types/lib/remoteTemplate.d.ts +15 -0
  77. package/dist/types/lib/remoteTemplate.d.ts.map +1 -0
  78. package/dist/types/lib/tar.d.ts +28 -0
  79. package/dist/types/lib/tar.d.ts.map +1 -0
  80. package/dist/types/tsconfig.tsbuildinfo +1 -1
  81. package/package.json +5 -7
  82. package/resources/templates/default/README.md +3 -1
  83. package/resources/templates/default/admin/app/components/navigation.tsx +95 -8
  84. package/resources/templates/default/admin/app/pages/tenant.tsx +328 -77
  85. package/resources/templates/default/admin/entrypoint/components/login.tsx +1 -1
  86. package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +1 -1
  87. package/resources/templates/default/admin/entrypoint/pages/magicLinkSent.tsx +1 -1
  88. package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +1 -1
  89. package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +1 -1
  90. package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +1 -1
  91. package/resources/templates/default/admin/lib/editor/common/editor-inline-toolbar.tsx +3 -0
  92. package/resources/templates/default/admin/lib/editor/sortable-block.tsx +5 -4
  93. package/resources/templates/default/admin/lib/tenant/config/auth-policy-list.tsx +86 -0
  94. package/resources/templates/default/admin/lib/tenant/config/common.tsx +71 -0
  95. package/resources/templates/default/admin/lib/tenant/config/identity-provider-list.tsx +131 -0
  96. package/resources/templates/default/admin/lib/tenant/config/index.ts +5 -0
  97. package/resources/templates/default/admin/lib/tenant/config/mail-template-list.tsx +108 -0
  98. package/resources/templates/default/admin/lib/tenant/config/tenant-config-view.tsx +195 -0
  99. package/resources/templates/default/admin/lib/tenant/dict.ts +456 -4
  100. package/resources/templates/default/admin/lib/tenant/errors.ts +10 -0
  101. package/resources/templates/default/admin/lib/tenant/forms/add-project-member.tsx +57 -0
  102. package/resources/templates/default/admin/lib/tenant/forms/change-my-profile.tsx +40 -0
  103. package/resources/templates/default/admin/lib/tenant/forms/change-profile.tsx +55 -0
  104. package/resources/templates/default/admin/lib/tenant/forms/common.tsx +9 -2
  105. package/resources/templates/default/admin/lib/tenant/forms/create-global-api-key.tsx +69 -0
  106. package/resources/templates/default/admin/lib/tenant/forms/global-roles-control.tsx +113 -0
  107. package/resources/templates/default/admin/lib/tenant/forms/index.ts +11 -0
  108. package/resources/templates/default/admin/lib/tenant/forms/invite.tsx +42 -4
  109. package/resources/templates/default/admin/lib/tenant/forms/login.tsx +4 -10
  110. package/resources/templates/default/admin/lib/tenant/forms/memberships-control.tsx +3 -1
  111. package/resources/templates/default/admin/lib/tenant/forms/mfa-code-fields.tsx +81 -0
  112. package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin.tsx +4 -10
  113. package/resources/templates/default/admin/lib/tenant/forms/set-person-password.tsx +58 -0
  114. package/resources/templates/default/admin/lib/tenant/forms/set-project-secret.tsx +59 -0
  115. package/resources/templates/default/admin/lib/tenant/forms/sign-up.tsx +73 -0
  116. package/resources/templates/default/admin/lib/tenant/hooks/index.ts +2 -0
  117. package/resources/templates/default/admin/lib/tenant/idp/identity-provider-connections.tsx +124 -0
  118. package/resources/templates/default/admin/lib/tenant/idp/index.ts +1 -0
  119. package/resources/templates/default/admin/lib/tenant/index.ts +7 -0
  120. package/resources/templates/default/admin/lib/tenant/listing/api-key-list.tsx +160 -22
  121. package/resources/templates/default/admin/lib/tenant/listing/auth-log-list.tsx +179 -0
  122. package/resources/templates/default/admin/lib/tenant/listing/global-api-key-list.tsx +149 -0
  123. package/resources/templates/default/admin/lib/tenant/listing/index.ts +7 -0
  124. package/resources/templates/default/admin/lib/tenant/listing/member-delete-dialog.tsx +1 -1
  125. package/resources/templates/default/admin/lib/tenant/listing/member-list.tsx +20 -11
  126. package/resources/templates/default/admin/lib/tenant/listing/mfa.tsx +29 -0
  127. package/resources/templates/default/admin/lib/tenant/listing/person-actions.tsx +179 -0
  128. package/resources/templates/default/admin/lib/tenant/listing/person-detail.tsx +141 -0
  129. package/resources/templates/default/admin/lib/tenant/listing/person-list.tsx +13 -2
  130. package/resources/templates/default/admin/lib/tenant/listing/persons-list.tsx +128 -0
  131. package/resources/templates/default/admin/lib/tenant/listing/project-secret-list.tsx +82 -0
  132. package/resources/templates/default/admin/lib/tenant/otp/backup-codes.tsx +81 -0
  133. package/resources/templates/default/admin/lib/tenant/otp/email-otp-setup.tsx +133 -0
  134. package/resources/templates/default/admin/lib/tenant/otp/index.ts +2 -0
  135. package/resources/templates/default/admin/lib/tenant/security/index.ts +2 -0
  136. package/resources/templates/default/admin/lib/tenant/security/passwordless-toggle.tsx +63 -0
  137. package/resources/templates/default/admin/lib/tenant/security/session-list.tsx +143 -0
  138. package/resources/templates/default/admin/lib/ui/label.tsx +25 -2
  139. package/resources/templates/default/admin/lib/ui/menu.tsx +1 -1
  140. package/resources/templates/default/admin/lib/ui/progress.tsx +75 -11
  141. package/resources/templates/default/admin/lib/ui/separator.tsx +27 -3
  142. package/resources/templates/default/admin/lib/ui/sidebar.tsx +1 -1
  143. package/resources/templates/default/admin/lib/ui/toggle.tsx +41 -2
  144. package/resources/templates/default/admin/lib/utils/classNames.ts +107 -0
  145. package/resources/templates/default/admin/lib/utils/cn.ts +3 -3
  146. package/resources/templates/default/admin/lib/utils/index.ts +1 -0
  147. package/resources/templates/default/admin/lib/utils/uic.tsx +2 -3
  148. package/resources/templates/default/admin/package.json +1 -7
  149. package/resources/templates/default/docker/object-storage/README.md +13 -0
  150. package/resources/templates/default/docker/object-storage/identities.json +13 -0
  151. package/resources/templates/default/docker-compose.yaml +29 -7
  152. package/src/commands/WorkspaceCreateCommand.ts +51 -24
  153. package/src/lib/FileSystem.ts +7 -2
  154. package/src/lib/TemplateInstaller.ts +87 -69
  155. package/src/lib/fsErrors.ts +2 -0
  156. package/src/lib/projectPath.ts +79 -0
  157. package/src/lib/remoteTemplate.ts +130 -0
  158. package/src/lib/tar.ts +283 -0
  159. package/src/run.ts +8 -7
  160. package/tests/cases/unit/create-process.test.ts +66 -0
  161. package/tests/cases/unit/fileSystem.test.ts +14 -0
  162. package/tests/cases/unit/fixtures/template.tar.gz +0 -0
  163. package/tests/cases/unit/remoteTemplate.test.ts +277 -0
  164. package/tests/cases/unit/template-installer-cleanup.test.ts +150 -0
  165. package/tests/cases/unit/template-installer-containment.test.ts +133 -0
  166. package/tests/cases/unit/template-installer-symlinks.test.ts +37 -0
  167. package/tests/cases/unit/workspace-create.test.ts +81 -0
@@ -1,7 +1,17 @@
1
1
  import { InviteErrorCodes } from './hooks/useInvite.js'
2
- import { ChangeMyPasswordFormErrorCode, CreateApiKeyFormErrorCode } from '@contember/interface'
2
+ import {
3
+ AddProjectMemberFormErrorCode,
4
+ ChangeMyPasswordFormErrorCode,
5
+ ChangeMyProfileFormErrorCode,
6
+ ChangePasswordFormErrorCode,
7
+ ChangeProfileFormErrorCode,
8
+ CreateApiKeyFormErrorCode,
9
+ CreateGlobalApiKeyFormErrorCode,
10
+ SetProjectSecretFormErrorCode,
11
+ } from '@contember/interface'
3
12
  import {
4
13
  ConfirmEmailChangeFormErrorCode,
14
+ EmailOtpConfirmFormErrorCode,
5
15
  InviteFormErrorCode,
6
16
  LoginFormErrorCode,
7
17
  OtpConfirmFormErrorCode,
@@ -11,10 +21,17 @@ import {
11
21
  PasswordResetFormErrorCode,
12
22
  PasswordResetRequestFormErrorCode,
13
23
  RequestEmailVerificationFormErrorCode,
24
+ SignUpFormErrorCode,
14
25
  UpdateProjectMemberFormErrorCode,
15
26
  VerifyEmailFormErrorCode,
16
27
  } from '@contember/react-identity'
17
- import { ActivatePasswordlessOtpErrorCode } from '@contember/graphql-client-tenant'
28
+ import {
29
+ ActivatePasswordlessOtpErrorCode,
30
+ AddGlobalIdentityRolesErrorCode,
31
+ DisconnectIDPErrorCode,
32
+ RemoveGlobalIdentityRolesErrorCode,
33
+ } from '@contember/graphql-client-tenant'
34
+ import { FormErrorCode } from '@contember/react-client-tenant'
18
35
 
19
36
  export const dict = {
20
37
  inviteErrors: {
@@ -28,6 +45,11 @@ export const dict = {
28
45
  fallback: 'Failed to invite user',
29
46
  } satisfies Record<InviteErrorCodes | 'fallback', string>,
30
47
  tenant: {
48
+ /** Fallback for the codes any form or action can raise; a per-form `errorMessages` entry still wins. */
49
+ commonErrorMessages: {
50
+ UNKNOWN_ERROR: 'Something went wrong. Please try again later',
51
+ FORBIDDEN: 'You do not have permission to do this',
52
+ } satisfies Record<FormErrorCode, string>,
31
53
  memberList: {
32
54
  failedToLoadData: 'Failed to load data',
33
55
  noResults: 'No results',
@@ -47,6 +69,23 @@ export const dict = {
47
69
  deleteConfirmation: 'Are you sure you want to delete this API key?',
48
70
  deleteCancelAction: 'Cancel',
49
71
  deleteConfirmAction: 'Delete',
72
+ type: 'Type',
73
+ roles: 'Roles',
74
+ status: 'Status',
75
+ created: 'Created',
76
+ lastUsed: 'Last used',
77
+ expires: 'Expires',
78
+ enabled: 'Enabled',
79
+ disabled: 'Disabled',
80
+ noRoles: 'None',
81
+ never: 'Never',
82
+ unknownType: 'Unknown',
83
+ failedToLoadData: 'Failed to load data',
84
+ disableConfirmation: 'Are you sure you want to disable this API key?',
85
+ disableSuccess: 'API key disabled',
86
+ disableFailed: 'Failed to disable API key',
87
+ cancel: 'Cancel',
88
+ disable: 'Disable',
50
89
  },
51
90
  createApiKey: {
52
91
  description: 'Description',
@@ -55,6 +94,7 @@ export const dict = {
55
94
  errorMessages: {
56
95
  'FIELD_REQUIRED': 'This field is required',
57
96
  'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
97
+ 'INVALID_ROLE': 'Invalid role',
58
98
  'INVALID_MEMBERSHIP': 'Invalid membership',
59
99
  'PROJECT_NOT_FOUND': 'Project not found',
60
100
  'ROLE_NOT_FOUND': 'Role not found',
@@ -67,7 +107,11 @@ export const dict = {
67
107
  name: 'Name',
68
108
  roles: 'Roles',
69
109
  submit: 'Invite',
110
+ submitUnmanaged: 'Create member',
70
111
  addRole: 'Add new role',
112
+ unmanaged: 'Do not send an invitation e-mail',
113
+ unmanagedDescription: 'Creates the member directly. Leave the password empty to make them use a password reset.',
114
+ password: 'Password',
71
115
  errorMessages: {
72
116
  'FIELD_REQUIRED': 'This field is required',
73
117
  'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
@@ -99,7 +143,12 @@ export const dict = {
99
143
  login: {
100
144
  email: 'Email',
101
145
  password: 'Password',
102
- otpToken: '2FA OTP token',
146
+ mfa: {
147
+ otpToken: '2FA OTP token',
148
+ backupCode: 'Backup code',
149
+ useBackupCode: 'Lost your authenticator? Use a backup code.',
150
+ useOtpToken: 'Use your authenticator app instead.',
151
+ },
103
152
  forgotPassword: 'Forgot password?',
104
153
  login: 'Login',
105
154
  errorMessages: {
@@ -116,6 +165,7 @@ export const dict = {
116
165
  'OTP_REQUIRED': undefined,
117
166
  'MFA_ENROLLMENT_REQUIRED': 'Multi-factor authentication enrollment is required',
118
167
  'EMAIL_NOT_VERIFIED': 'Your e-mail address has not been verified',
168
+ 'IDP_REQUIRED': 'Please sign in with your identity provider',
119
169
  } satisfies Record<LoginFormErrorCode, string | undefined>,
120
170
  idpInitError: 'Failed to initialize IdP login:',
121
171
  idpResponseError: 'Failed to process IdP response:',
@@ -141,6 +191,225 @@ export const dict = {
141
191
  cancel: 'Cancel',
142
192
  confirm: 'Confirm',
143
193
  },
194
+ mfa: {
195
+ totp: 'TOTP',
196
+ email: 'Email OTP',
197
+ none: 'None',
198
+ },
199
+ personsList: {
200
+ email: 'Email',
201
+ name: 'Name',
202
+ roles: 'Roles',
203
+ mfa: '2FA',
204
+ noEmail: 'No email',
205
+ noName: 'No name',
206
+ noRoles: 'None',
207
+ noResults: 'No users',
208
+ failedToLoadData: 'Failed to load data',
209
+ filterEmailPlaceholder: 'Filter by email',
210
+ previous: 'Previous',
211
+ next: 'Next',
212
+ status: 'Status',
213
+ active: 'Active',
214
+ disabled: 'Disabled',
215
+ actions: 'Actions',
216
+ },
217
+ globalApiKeyList: {
218
+ description: 'Description',
219
+ type: 'Type',
220
+ status: 'Status',
221
+ roles: 'Roles',
222
+ created: 'Created',
223
+ lastUsed: 'Last used',
224
+ expires: 'Expires',
225
+ action: 'Action',
226
+ enabled: 'Enabled',
227
+ disabled: 'Disabled',
228
+ unnamed: 'Unnamed API key',
229
+ noRoles: 'None',
230
+ never: 'Never',
231
+ noResults: 'No API keys',
232
+ failedToLoadData: 'Failed to load data',
233
+ previous: 'Previous',
234
+ next: 'Next',
235
+ disableConfirmation: 'Are you sure you want to disable this API key?',
236
+ disableSuccess: 'API key disabled',
237
+ disableFailed: 'Failed to disable API key',
238
+ cancel: 'Cancel',
239
+ disable: 'Disable',
240
+ },
241
+ createGlobalApiKey: {
242
+ description: 'Description',
243
+ roles: 'Roles',
244
+ addRole: 'Add role',
245
+ removeRole: 'Remove role',
246
+ rolePlaceholder: 'Role name',
247
+ submit: 'Create API key',
248
+ errorMessages: {
249
+ 'FIELD_REQUIRED': 'This field is required',
250
+ 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
251
+ 'INVALID_ROLE': 'Invalid role',
252
+ 'INVALID_MEMBERSHIP': 'Invalid membership',
253
+ 'PROJECT_NOT_FOUND': 'Project not found',
254
+ 'ROLE_NOT_FOUND': 'Role not found',
255
+ 'VARIABLE_EMPTY': 'Variable empty',
256
+ 'VARIABLE_NOT_FOUND': 'Variable not found',
257
+ } satisfies Record<CreateGlobalApiKeyFormErrorCode, string>,
258
+ },
259
+ projectSecretList: {
260
+ key: 'Key',
261
+ created: 'Created',
262
+ updated: 'Updated',
263
+ noResults: 'No secrets',
264
+ failedToLoadData: 'Failed to load data',
265
+ },
266
+ configView: {
267
+ failedToLoadData: 'Failed to load data',
268
+ forbidden: 'You do not have permission to view this.',
269
+ managedByCli: 'Read-only. Change this with',
270
+ managedByCliCommand: 'contember tenant:apply',
271
+ setting: 'Setting',
272
+ value: 'Value',
273
+ enabled: 'Enabled',
274
+ disabled: 'Disabled',
275
+ notSet: 'Not set',
276
+ /** An explicitly empty list — distinct from `notSet`, which is a value that was never configured. */
277
+ emptyList: 'None',
278
+ signup: 'Sign-up',
279
+ emailChange: 'E-mail change',
280
+ passwordless: 'Passwordless sign-in',
281
+ password: 'Password policy',
282
+ login: 'Login',
283
+ anomalyDetection: 'Anomaly detection',
284
+ captcha: 'Captcha',
285
+ rateLimits: 'Rate limits',
286
+ limit: 'Limit',
287
+ window: 'Window',
288
+ panelAccess: 'Management panel access',
289
+ },
290
+ authPolicyList: {
291
+ scope: 'Scope',
292
+ project: 'Project',
293
+ roles: 'Roles',
294
+ mfaRequired: 'MFA required',
295
+ tokenExpiration: 'Token expiration',
296
+ idleTimeout: 'Idle timeout',
297
+ mfaGraceDuration: 'MFA grace',
298
+ rememberMeAllowed: 'Remember me',
299
+ noResults: 'No auth policies configured — MFA enforcement is inert.',
300
+ failedToLoadData: 'Failed to load data',
301
+ forbidden: 'You do not have permission to view auth policies.',
302
+ aggregationNote: 'An identity is subject to every policy matching any of its roles; the strictest value wins.',
303
+ },
304
+ identityProviderList: {
305
+ slug: 'Slug',
306
+ type: 'Type',
307
+ status: 'Status',
308
+ configuration: 'Configuration',
309
+ showConfiguration: 'Show configuration',
310
+ hideConfiguration: 'Hide configuration',
311
+ autoSignUp: 'Auto sign-up',
312
+ exclusive: 'Exclusive',
313
+ strictResponseType: 'Strict response type',
314
+ /** A setting the provider's handler type does not have. */
315
+ notApplicable: '—',
316
+ noResults: 'No identity providers configured',
317
+ failedToLoadData: 'Failed to load data',
318
+ forbidden: 'You do not have permission to view identity providers.',
319
+ secretsNote: 'Secrets are stripped server-side for the built-in oidc, apple and facebook handlers.',
320
+ },
321
+ mailTemplateList: {
322
+ type: 'Type',
323
+ variant: 'Variant',
324
+ project: 'Project',
325
+ subject: 'Subject',
326
+ replyTo: 'Reply to',
327
+ useLayout: 'Layout',
328
+ showContent: 'Show content',
329
+ hideContent: 'Hide content',
330
+ noResults: 'No custom mail templates — the built-in defaults are in use.',
331
+ failedToLoadData: 'Failed to load data',
332
+ forbidden: 'You do not have permission to view mail templates.',
333
+ },
334
+ changeMyProfile: {
335
+ email: 'Email',
336
+ name: 'Name',
337
+ submit: 'Save changes',
338
+ errorMessages: {
339
+ 'FIELD_REQUIRED': 'This field is required',
340
+ 'INVALID_VALUE': 'Invalid value',
341
+ 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
342
+ 'NOT_A_PERSON': 'Invalid user',
343
+ 'INVALID_EMAIL_FORMAT': 'Invalid email format',
344
+ 'EMAIL_ALREADY_EXISTS': 'This e-mail address is already in use',
345
+ 'RATE_LIMIT_EXCEEDED': 'Too many requests, please try again later',
346
+ 'REAUTHENTICATION_REQUIRED': 'Changing the e-mail address requires your current password',
347
+ 'INVALID_PASSWORD': 'Invalid password',
348
+ 'INVALID_OTP_TOKEN': 'Invalid OTP token',
349
+ } satisfies Record<ChangeMyProfileFormErrorCode | 'UNKNOWN_ERROR', string>,
350
+ },
351
+ emailOtpSetup: {
352
+ description: 'Get a one-time code by e-mail every time you sign in — a lightweight alternative to an authenticator app.',
353
+ sendCode: 'Send code by e-mail',
354
+ codeSent: 'A code has been sent to your e-mail address.',
355
+ otpToken: 'E-mail code',
356
+ confirm: 'Confirm',
357
+ emailOtpConfirmFormErrorMessages: {
358
+ INVALID_OTP_TOKEN: 'Invalid code',
359
+ FIELD_REQUIRED: 'This field is required',
360
+ INVALID_VALUE: 'Invalid value',
361
+ UNKNOWN_ERROR: 'Something went wrong. Please try again later',
362
+ } satisfies Record<EmailOtpConfirmFormErrorCode, string>,
363
+ enabledSuccess: 'E-mail two-factor authentication was enabled.',
364
+ emailOtpEnabled: 'E-mail two-factor authentication is ENABLED.',
365
+ disableEmailOtp: 'Disable e-mail two-factor authentication',
366
+ disableEmailOtpConfirm: 'Are you sure you want to disable e-mail two-factor authentication?',
367
+ disable: 'Disable',
368
+ disabledSuccess: 'E-mail two-factor authentication was disabled.',
369
+ setupAgain: 'Send new code',
370
+ cancel: 'Cancel',
371
+ initFailed: 'Failed to send the code. Please try again later.',
372
+ disableFailed: 'Failed to disable e-mail two-factor authentication.',
373
+ },
374
+ backupCodes: {
375
+ description: 'Backup codes let you sign in if you lose access to your authenticator or e-mail codes.',
376
+ regenerate: 'Regenerate backup codes',
377
+ regenerateConfirm: 'Regenerating invalidates your existing backup codes. Are you sure you want to continue?',
378
+ regenerateSuccess: 'New backup codes were generated.',
379
+ regenerateFailed: 'Failed to generate new backup codes.',
380
+ cancel: 'Cancel',
381
+ noMfaActive: 'Backup codes are available once you enable two-factor authentication.',
382
+ writeDownNote: 'Write these down and keep them somewhere safe. Each code works once.',
383
+ },
384
+ passwordlessToggle: {
385
+ descriptionEnabled: 'Passwordless sign-in is ENABLED. You can sign in with a magic link sent to your e-mail, without a password.',
386
+ descriptionDisabled: 'Enable passwordless sign-in to sign in with a magic link sent to your e-mail, without a password.',
387
+ enable: 'Enable passwordless sign-in',
388
+ disable: 'Disable passwordless sign-in',
389
+ enabledSuccess: 'Passwordless sign-in was enabled.',
390
+ disabledSuccess: 'Passwordless sign-in was disabled.',
391
+ enforcedEnabled: 'Passwordless sign-in is ENABLED for everyone by a tenant-wide policy, so it cannot be turned off here.',
392
+ enforcedDisabled: 'Passwordless sign-in is turned off by a tenant-wide policy, so it cannot be enabled here.',
393
+ toggleFailed:
394
+ 'Could not change passwordless sign-in. If this is your only sign-in method, set a password or enable two-factor authentication first.',
395
+ },
396
+ sessionList: {
397
+ failedToLoadData: 'Failed to load data',
398
+ noResults: 'No active sessions',
399
+ created: 'Created',
400
+ lastUsed: 'Last used',
401
+ ip: 'IP address',
402
+ userAgent: 'Device',
403
+ expires: 'Expires',
404
+ action: 'Action',
405
+ never: 'Never',
406
+ thisDevice: 'This device',
407
+ revoke: 'Revoke',
408
+ revokeConfirmation: 'Are you sure you want to revoke this session? The device will be signed out.',
409
+ revokeSuccess: 'Session revoked',
410
+ revokeFailed: 'Failed to revoke session',
411
+ cancel: 'Cancel',
412
+ },
144
413
  otpSetup: {
145
414
  prepareContinue: 'Continue',
146
415
  otpConfirmFormErrorMessages: {
@@ -171,6 +440,27 @@ export const dict = {
171
440
  confirm: 'Confirm',
172
441
  },
173
442
 
443
+ signUp: {
444
+ email: 'E-mail',
445
+ name: 'Name',
446
+ password: 'Password',
447
+ passwordConfirmation: 'Confirm password',
448
+ submit: 'Create account',
449
+ errorMessages: {
450
+ 'FIELD_REQUIRED': 'This field is required',
451
+ 'INVALID_VALUE': 'Invalid value',
452
+ 'PASSWORD_MISMATCH': 'Passwords do not match',
453
+ 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
454
+ 'EMAIL_ALREADY_EXISTS': 'An account with this e-mail already exists',
455
+ 'INVALID_EMAIL_FORMAT': 'Invalid e-mail format',
456
+ 'TOO_WEAK': 'Password is too weak',
457
+ 'INVALID_CAPTCHA': 'Captcha verification failed',
458
+ 'RATE_LIMIT_EXCEEDED': 'Too many attempts. Please try again later',
459
+ 'INVALID_ROLE': 'Invalid role',
460
+ } satisfies Record<SignUpFormErrorCode, string>,
461
+ title: 'Create an account',
462
+ },
463
+
174
464
  passwordReset: {
175
465
  token: 'Reset code',
176
466
  password: 'Password',
@@ -269,6 +559,7 @@ export const dict = {
269
559
  'PASSWORDLESS_DISABLED': 'Passwordless sign-in is not available',
270
560
  'RATE_LIMIT_EXCEEDED': 'Too many requests, please try again later',
271
561
  'INVALID_CAPTCHA': 'Captcha verification failed',
562
+ 'IDP_REQUIRED': 'Please sign in with your identity provider',
272
563
  } satisfies Record<PasswordlessSignInInitFormErrorCode, string>,
273
564
  title: 'Sign in',
274
565
  description: 'Enter your email below to sign in to your account',
@@ -278,7 +569,12 @@ export const dict = {
278
569
  },
279
570
  passwordlessSignIn: {
280
571
  token: 'Verification code',
281
- otpToken: '2FA OTP token',
572
+ mfa: {
573
+ otpToken: '2FA OTP token',
574
+ backupCode: 'Backup code',
575
+ useBackupCode: 'Lost your authenticator? Use a backup code.',
576
+ useOtpToken: 'Use your authenticator app instead.',
577
+ },
282
578
  submit: 'Sign in',
283
579
  errorMessages: {
284
580
  'FIELD_REQUIRED': 'This field is required',
@@ -292,6 +588,7 @@ export const dict = {
292
588
  'TOKEN_USED': 'Token already used',
293
589
  'TOKEN_INVALID': 'Invalid token',
294
590
  'MFA_ENROLLMENT_REQUIRED': 'Multi-factor authentication enrollment is required',
591
+ 'IDP_REQUIRED': 'Please sign in with your identity provider',
295
592
  } satisfies Record<PasswordlessSignInFormErrorCode, string | undefined>,
296
593
  title: 'Sign in',
297
594
  },
@@ -320,5 +617,160 @@ export const dict = {
320
617
  'NOT_MEMBER': 'Not a member',
321
618
  } satisfies Record<UpdateProjectMemberFormErrorCode, string>,
322
619
  },
620
+ personActions: {
621
+ cancel: 'Cancel',
622
+ disable: 'Disable',
623
+ disableTitle: 'Disable person',
624
+ disableConfirmation: 'Are you sure you want to disable this person? They will not be able to sign in.',
625
+ disableSuccess: 'Person disabled',
626
+ disableFailed: 'Failed to disable the person',
627
+ enable: 'Enable',
628
+ enableTitle: 'Enable person',
629
+ enableConfirmation: 'Are you sure you want to enable this person? They will be able to sign in again.',
630
+ enableSuccess: 'Person enabled',
631
+ enableFailed: 'Failed to enable the person',
632
+ forceSignOut: 'Sign out',
633
+ forceSignOutTitle: 'Force sign out',
634
+ forceSignOutConfirmation: 'Are you sure you want to sign this person out of all their sessions?',
635
+ forceSignOutReason: 'Reason (optional)',
636
+ forceSignOutReasonPlaceholder: 'Recorded in the audit log',
637
+ forceSignOutSuccess: 'Person signed out of all sessions',
638
+ forceSignOutFailed: 'Failed to sign the person out',
639
+ resetMfa: 'Reset 2FA',
640
+ resetMfaTitle: 'Reset two-factor authentication',
641
+ resetMfaConfirmation:
642
+ 'Are you sure you want to reset two-factor authentication? This clears the TOTP authenticator, e-mail OTP and all backup codes.',
643
+ resetMfaSuccess: 'Two-factor authentication was reset',
644
+ resetMfaFailed: 'Failed to reset two-factor authentication',
645
+ },
646
+ personDetail: {
647
+ identityId: 'Identity ID',
648
+ failedToLoadData: 'Failed to load data',
649
+ notFound: 'Person not found',
650
+ profile: 'Profile',
651
+ profileUpdated: 'Profile updated',
652
+ password: 'Password',
653
+ passwordUpdated: 'Password updated',
654
+ mfa: 'Two-factor authentication',
655
+ globalRoles: 'Global roles',
656
+ sessions: 'Sessions',
657
+ identityProviders: 'Identity providers',
658
+ identityProvider: 'Provider',
659
+ identityProviderAccount: 'External account',
660
+ identityProviderConnectedAt: 'Connected',
661
+ identityProviderStatus: 'Status',
662
+ identityProviderDisabled: 'Disabled',
663
+ noIdentityProviders: 'No connected identity providers',
664
+ },
665
+ globalRoles: {
666
+ noRoles: 'No global roles',
667
+ rolePlaceholder: 'Role name',
668
+ addRole: 'Add role',
669
+ removeRole: 'Remove role',
670
+ addSuccess: 'Global role added',
671
+ removeSuccess: 'Global role removed',
672
+ errorMessages: {
673
+ 'IDENTITY_NOT_FOUND': 'This identity no longer exists',
674
+ 'INVALID_ROLE': 'This role is not defined in the tenant configuration',
675
+ 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
676
+ } satisfies Record<AddGlobalIdentityRolesErrorCode | RemoveGlobalIdentityRolesErrorCode | 'UNKNOWN_ERROR', string>,
677
+ },
678
+ changeProfile: {
679
+ email: 'E-mail',
680
+ name: 'Name',
681
+ submit: 'Save profile',
682
+ errorMessages: {
683
+ 'FIELD_REQUIRED': 'This field is required',
684
+ 'INVALID_VALUE': 'Invalid value',
685
+ 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
686
+ 'PERSON_NOT_FOUND': 'This person no longer exists',
687
+ 'INVALID_EMAIL_FORMAT': 'Invalid email format',
688
+ 'EMAIL_ALREADY_EXISTS': 'This e-mail address is already in use',
689
+ } satisfies Record<ChangeProfileFormErrorCode, string>,
690
+ },
691
+ setPersonPassword: {
692
+ password: 'New password',
693
+ passwordConfirmation: 'Confirm password',
694
+ submit: 'Set password',
695
+ errorMessages: {
696
+ 'FIELD_REQUIRED': 'This field is required',
697
+ 'INVALID_VALUE': 'Invalid value',
698
+ 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
699
+ 'PASSWORD_MISMATCH': 'Passwords do not match',
700
+ 'TOO_WEAK': 'Password is too weak',
701
+ 'PERSON_NOT_FOUND': 'This person no longer exists',
702
+ } satisfies Record<ChangePasswordFormErrorCode, string>,
703
+ },
704
+ setProjectSecret: {
705
+ key: 'Key',
706
+ value: 'Value',
707
+ submit: 'Set secret',
708
+ errorMessages: {
709
+ 'FIELD_REQUIRED': 'This field is required',
710
+ 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
711
+ 'PROJECT_NOT_FOUND': 'Project not found',
712
+ } satisfies Record<SetProjectSecretFormErrorCode, string>,
713
+ },
714
+ addProjectMember: {
715
+ identityId: 'Identity ID',
716
+ roles: 'Roles',
717
+ submit: 'Add member',
718
+ errorMessages: {
719
+ 'FIELD_REQUIRED': 'This field is required',
720
+ 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
721
+ 'ALREADY_MEMBER': 'This identity is already a member of the project',
722
+ 'IDENTITY_NOT_FOUND': 'Identity not found',
723
+ 'INVALID_MEMBERSHIP': 'Invalid membership',
724
+ 'PROJECT_NOT_FOUND': 'Project not found',
725
+ 'ROLE_NOT_FOUND': 'Role not found',
726
+ 'VARIABLE_EMPTY': 'Variable empty',
727
+ 'VARIABLE_NOT_FOUND': 'Variable not found',
728
+ } satisfies Record<AddProjectMemberFormErrorCode, string>,
729
+ },
730
+ authLog: {
731
+ createdAt: 'Created',
732
+ type: 'Type',
733
+ success: 'Result',
734
+ person: 'Person',
735
+ ipAddress: 'IP address',
736
+ errorCode: 'Error',
737
+ action: 'Action',
738
+ ok: 'OK',
739
+ failed: 'Failed',
740
+ filterTypes: 'Event types',
741
+ filterTypesPlaceholder: 'e.g. sign_in, sign_in_error (comma separated)',
742
+ filterSuccess: 'Result',
743
+ filterSuccessAll: 'All',
744
+ filterSuccessOk: 'Successful only',
745
+ filterSuccessFailed: 'Failed only',
746
+ filterPerson: 'Person identifier',
747
+ filterPersonPlaceholder: 'E-mail or identifier used to sign in',
748
+ noResults: 'No entries',
749
+ forbidden: 'You do not have permission to view the auth log.',
750
+ failedToLoadData: 'Failed to load data',
751
+ previous: 'Previous',
752
+ next: 'Next',
753
+ },
754
+ identityProviderConnections: {
755
+ provider: 'Provider',
756
+ account: 'External account',
757
+ connectedAt: 'Connected',
758
+ status: 'Status',
759
+ disabled: 'Disabled',
760
+ action: 'Action',
761
+ disconnect: 'Disconnect',
762
+ disconnectConfirmation: 'Are you sure you want to disconnect this identity provider?',
763
+ disconnected: 'Identity provider disconnected',
764
+ cancel: 'Cancel',
765
+ noResults: 'No connected identity providers',
766
+ failedToLoadData: 'Failed to load data',
767
+ errorMessages: {
768
+ 'NOT_FOUND': 'This identity provider connection no longer exists',
769
+ 'NOT_A_PERSON': 'Only a signed-in person can disconnect identity providers',
770
+ 'LAST_AUTH_METHOD': 'You cannot disconnect your last remaining sign-in method',
771
+ 'IDP_REQUIRED': 'This identity provider is the only way you can sign in, so it cannot be disconnected',
772
+ 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
773
+ } satisfies Record<DisconnectIDPErrorCode | 'UNKNOWN_ERROR', string>,
774
+ },
323
775
  },
324
776
  }
@@ -0,0 +1,10 @@
1
+ import { FormErrorCode } from '@contember/react-client-tenant'
2
+ import { dict } from './dict.js'
3
+
4
+ const forbidden: FormErrorCode = 'FORBIDDEN'
5
+
6
+ /**
7
+ * Message for a one-shot action that failed. A denial gets its own line, because "failed, try again"
8
+ * is wrong advice when the answer is simply no.
9
+ */
10
+ export const actionErrorMessage = (code: string, failed: string): string => code === forbidden ? dict.tenant.commonErrorMessages.FORBIDDEN : failed
@@ -0,0 +1,57 @@
1
+ import { useAddProjectMemberForm } from '@contember/react-identity'
2
+ import { Button } from '~/lib'
3
+ import { Loader } from '~/lib'
4
+ import { TenantFormError, TenantFormField, TenantFormLabel } from './common.js'
5
+ import { MembershipsControl, RolesConfig, useIntrospectionRolesConfig } from './memberships-control.js'
6
+ import { dict } from '../dict.js'
7
+
8
+ /**
9
+ * `AddProjectMemberFormFields` renders the fields of the `AddProjectMemberForm` provider — it adds an existing
10
+ * identity (as opposed to inviting a new person) to a project.
11
+ *
12
+ * ## Example
13
+ * ```tsx
14
+ * <AddProjectMemberFormFields projectSlug="my-project" />
15
+ * ```
16
+ */
17
+ export const AddProjectMemberFormFields = ({ projectSlug, roles }: { projectSlug: string; roles?: RolesConfig }) => {
18
+ const form = useAddProjectMemberForm()
19
+ // Unconditionally, then pick: behind `??` the hook would run only on renders where `roles` is
20
+ // nullish, and a caller whose roles arrive from a query flips that mid-life.
21
+ const introspectedRoles = useIntrospectionRolesConfig(projectSlug)
22
+ const rolesResolved = roles ?? introspectedRoles
23
+ return (
24
+ <div className="relative flex flex-col gap-2">
25
+ {form.state === 'submitting' ? <Loader position="absolute" /> : null}
26
+
27
+ <TenantFormError
28
+ form={form}
29
+ messages={dict.tenant.addProjectMember.errorMessages}
30
+ />
31
+
32
+ <TenantFormField
33
+ form={form}
34
+ messages={dict.tenant.addProjectMember.errorMessages}
35
+ field="identityId"
36
+ type="text"
37
+ required
38
+ autoFocus
39
+ autoComplete="off"
40
+ >
41
+ {dict.tenant.addProjectMember.identityId}
42
+ </TenantFormField>
43
+
44
+ <TenantFormLabel form={form} field="memberships">{dict.tenant.addProjectMember.roles}</TenantFormLabel>
45
+ <TenantFormError form={form} messages={dict.tenant.addProjectMember.errorMessages} field="memberships" />
46
+ <MembershipsControl
47
+ memberships={form.values.memberships}
48
+ setMemberships={it => form.setValue('memberships', it)}
49
+ roles={rolesResolved}
50
+ />
51
+
52
+ <Button type="submit" className="w-full" disabled={form.state === 'submitting'}>
53
+ {dict.tenant.addProjectMember.submit}
54
+ </Button>
55
+ </div>
56
+ )
57
+ }
@@ -0,0 +1,40 @@
1
+ import { useChangeMyProfileForm } from '@contember/react-identity'
2
+ import { Button } from '~/lib'
3
+ import { Loader } from '~/lib'
4
+ import { TenantFormError, TenantFormField } from './common.js'
5
+ import { dict } from '../dict.js'
6
+
7
+ export const ChangeMyProfileFormFields = () => {
8
+ const form = useChangeMyProfileForm()
9
+ return (
10
+ <div className="relative flex flex-col gap-2">
11
+ {form.state === 'submitting' ? <Loader position="absolute" /> : null}
12
+ <TenantFormError
13
+ form={form}
14
+ messages={dict.tenant.changeMyProfile.errorMessages}
15
+ />
16
+ <TenantFormField
17
+ form={form}
18
+ messages={dict.tenant.changeMyProfile.errorMessages}
19
+ field="email"
20
+ type="email"
21
+ autoComplete="email"
22
+ >
23
+ {dict.tenant.changeMyProfile.email}
24
+ </TenantFormField>
25
+ <TenantFormField
26
+ form={form}
27
+ messages={dict.tenant.changeMyProfile.errorMessages}
28
+ field="name"
29
+ type="text"
30
+ autoComplete="name"
31
+ >
32
+ {dict.tenant.changeMyProfile.name}
33
+ </TenantFormField>
34
+
35
+ <Button type="submit" className="w-full" disabled={form.state === 'submitting'}>
36
+ {dict.tenant.changeMyProfile.submit}
37
+ </Button>
38
+ </div>
39
+ )
40
+ }