nucleus-core-ts 0.9.913 → 0.9.915

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 (28) hide show
  1. package/dist/.build-ok +1 -1
  2. package/dist/fe/components/ChatPanel/components/ChatPanel.js +4 -4
  3. package/dist/fe/components/ChatPanel/components/ConversationList.js +3 -3
  4. package/dist/fe/components/ChatPanel/components/MessageComposer.js +1 -1
  5. package/dist/fe/components/ChatPanel/components/MessageThread.js +18 -17
  6. package/dist/fe/components/ChatPanel/helpers.d.ts +23 -3
  7. package/dist/fe/components/ChatPanel/helpers.js +31 -13
  8. package/dist/fe/components/ChatPanel/hooks/useChat.js +16 -11
  9. package/dist/fe/components/ChatPanel/labels.d.ts +69 -0
  10. package/dist/fe/components/ChatPanel/labels.js +33 -1
  11. package/dist/fe/components/NucleusTextInput/components/NucleusTextInput.d.ts +1 -1
  12. package/dist/fe/components/NucleusTextInput/components/NucleusTextInput.js +3 -2
  13. package/dist/fe/components/NucleusTextInput/components/PasswordStrengthIndicator.d.ts +19 -2
  14. package/dist/fe/components/NucleusTextInput/components/PasswordStrengthIndicator.js +16 -7
  15. package/dist/fe/components/NucleusTextInput/types/index.d.ts +8 -0
  16. package/dist/fe/components/ResetPasswordPage/components/ResetPasswordForm.js +5 -5
  17. package/dist/fe/components/ResetPasswordPage/components/ResetPasswordPage.js +3 -3
  18. package/dist/fe/components/ResetPasswordPage/labels.d.ts +10 -0
  19. package/dist/fe/components/ResetPasswordPage/labels.js +6 -0
  20. package/dist/fe/components/SetPasswordPage/components/PasswordStrengthIndicator.d.ts +4 -1
  21. package/dist/fe/components/SetPasswordPage/components/PasswordStrengthIndicator.js +13 -8
  22. package/dist/fe/components/SetPasswordPage/components/SetPasswordForm.js +10 -10
  23. package/dist/fe/components/SetPasswordPage/components/SetPasswordPage.js +4 -4
  24. package/dist/fe/components/SetPasswordPage/labels.d.ts +35 -0
  25. package/dist/fe/components/SetPasswordPage/labels.js +19 -1
  26. package/dist/index.js +1 -1
  27. package/dist/src/Services/Backup/BackupService.d.ts +10 -0
  28. package/package.json +1 -1
@@ -88,7 +88,7 @@ export function ResetPasswordForm({ labels, token, resetPasswordAction, onBackTo
88
88
  const reqs = [
89
89
  {
90
90
  key: 'length',
91
- label: `At least ${policy.minLength} characters`,
91
+ label: say.ruleMinLength(policy.minLength),
92
92
  test: (p)=>p.length >= policy.minLength
93
93
  }
94
94
  ];
@@ -227,7 +227,7 @@ export function ResetPasswordForm({ labels, token, resetPasswordAction, onBackTo
227
227
  }),
228
228
  /*#__PURE__*/ _jsx("p", {
229
229
  className: theme.success.message,
230
- children: "Your password has been successfully reset. You can now log in with your new password."
230
+ children: say.successMessage
231
231
  }),
232
232
  /*#__PURE__*/ _jsx("div", {
233
233
  className: theme.links.container,
@@ -266,7 +266,7 @@ export function ResetPasswordForm({ labels, token, resetPasswordAction, onBackTo
266
266
  children: /*#__PURE__*/ _jsx(NucleusTextInput, {
267
267
  type: "password",
268
268
  label: say.newPassword,
269
- placeholder: "••••••••",
269
+ placeholder: say.passwordPlaceholder,
270
270
  value: store.newPassword,
271
271
  onChange: store.setNewPassword,
272
272
  disabled: isLoading,
@@ -285,7 +285,7 @@ export function ResetPasswordForm({ labels, token, resetPasswordAction, onBackTo
285
285
  children: /*#__PURE__*/ _jsx(NucleusTextInput, {
286
286
  type: "password",
287
287
  label: say.confirmPassword,
288
- placeholder: "••••••••",
288
+ placeholder: say.passwordPlaceholder,
289
289
  value: store.confirmPassword,
290
290
  onChange: store.setConfirmPassword,
291
291
  disabled: isLoading,
@@ -329,7 +329,7 @@ export function ResetPasswordForm({ labels, token, resetPasswordAction, onBackTo
329
329
  fullWidth: true,
330
330
  loading: isLoading,
331
331
  disabled: isLoading,
332
- children: "Reset Password"
332
+ children: say.submitButton
333
333
  })
334
334
  }),
335
335
  /*#__PURE__*/ _jsx("div", {
@@ -10,7 +10,7 @@ import { resetPasswordPageTheme } from '../theme';
10
10
  import { ResetPasswordForm } from './ResetPasswordForm';
11
11
  import { ResetPasswordHeader } from './ResetPasswordHeader';
12
12
  gsap.registerPlugin(useGSAP);
13
- export function ResetPasswordPage({ labels, logo, title = 'Reset Password', subtitle = 'Enter your new password below.', token, resetPasswordAction, onBackToLogin, backToLoginHref, showBackground = true, className, passwordPolicy }) {
13
+ export function ResetPasswordPage({ labels, logo, title, subtitle, token, resetPasswordAction, onBackToLogin, backToLoginHref, showBackground = true, className, passwordPolicy }) {
14
14
  const say = {
15
15
  ...DEFAULT_RESET_PASSWORD_LABELS,
16
16
  ...labels
@@ -48,8 +48,8 @@ export function ResetPasswordPage({ labels, logo, title = 'Reset Password', subt
48
48
  children: [
49
49
  /*#__PURE__*/ _jsx(ResetPasswordHeader, {
50
50
  logo: logo,
51
- title: title,
52
- subtitle: subtitle
51
+ title: title ?? say.title,
52
+ subtitle: subtitle ?? say.subtitle
53
53
  }),
54
54
  /*#__PURE__*/ _jsx(ResetPasswordForm, {
55
55
  labels: labels,
@@ -4,13 +4,23 @@
4
4
  * Defaults stay English, so nothing that does not pass labels changes.
5
5
  */
6
6
  export type ResetPasswordLabels = {
7
+ /** The heading and the line under it, used when the page is given no title/subtitle. */
8
+ title: string;
9
+ subtitle: string;
7
10
  newPassword: string;
8
11
  confirmPassword: string;
12
+ /** Shown inside both password boxes while they are empty. */
13
+ passwordPlaceholder: string;
9
14
  passwordRequirements: string;
15
+ /** What the button that submits the form says. */
16
+ submitButton: string;
10
17
  success: string;
18
+ /** The paragraph under the success heading. */
19
+ successMessage: string;
11
20
  backToLogin: string;
12
21
  pageLabel: string;
13
22
  /** The rules listed under the box, one line each. */
23
+ ruleMinLength: (count: number) => string;
14
24
  ruleUppercase: string;
15
25
  ruleLowercase: string;
16
26
  ruleNumber: string;
@@ -3,12 +3,18 @@
3
3
  *
4
4
  * Defaults stay English, so nothing that does not pass labels changes.
5
5
  */ export const DEFAULT_RESET_PASSWORD_LABELS = {
6
+ title: 'Reset Password',
7
+ subtitle: 'Enter your new password below.',
6
8
  newPassword: 'New Password',
7
9
  confirmPassword: 'Confirm Password',
10
+ passwordPlaceholder: '••••••••',
8
11
  passwordRequirements: 'Password requirements:',
12
+ submitButton: 'Reset Password',
9
13
  success: 'Password Reset Successful',
14
+ successMessage: 'Your password has been successfully reset. You can now log in with your new password.',
10
15
  backToLogin: 'Back to login',
11
16
  pageLabel: 'Reset password page',
17
+ ruleMinLength: (count)=>`At least ${count} characters`,
12
18
  ruleUppercase: 'One uppercase letter',
13
19
  ruleLowercase: 'One lowercase letter',
14
20
  ruleNumber: 'One number',
@@ -1,7 +1,10 @@
1
1
  import type { ReactElement } from 'react';
2
+ import { type SetPasswordLabels } from '../labels';
2
3
  import type { PasswordStrength } from '../types';
3
4
  type PasswordStrengthIndicatorProps = {
4
5
  strength: PasswordStrength;
6
+ /** Every word this indicator says, so a portal can say them in its own language. */
7
+ labels?: Partial<SetPasswordLabels>;
5
8
  showRequirements?: boolean;
6
9
  passwordMinLength?: number;
7
10
  requireUppercase?: boolean;
@@ -9,5 +12,5 @@ type PasswordStrengthIndicatorProps = {
9
12
  requireNumber?: boolean;
10
13
  requireSpecialChar?: boolean;
11
14
  };
12
- export declare function PasswordStrengthIndicator({ strength, showRequirements, passwordMinLength, requireUppercase, requireLowercase, requireNumber, requireSpecialChar, }: PasswordStrengthIndicatorProps): ReactElement;
15
+ export declare function PasswordStrengthIndicator({ strength, labels, showRequirements, passwordMinLength, requireUppercase, requireLowercase, requireNumber, requireSpecialChar, }: PasswordStrengthIndicatorProps): ReactElement;
13
16
  export {};
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { cn } from '../../../utils/cn';
4
+ import { DEFAULT_SET_PASSWORD_LABELS } from '../labels';
4
5
  import { setPasswordPageTheme } from '../theme';
5
6
  const CheckIcon = ()=>/*#__PURE__*/ _jsx("svg", {
6
7
  className: "w-3 h-3",
@@ -24,7 +25,11 @@ const CrossIcon = ()=>/*#__PURE__*/ _jsx("svg", {
24
25
  clipRule: "evenodd"
25
26
  })
26
27
  });
27
- export function PasswordStrengthIndicator({ strength, showRequirements = true, passwordMinLength = 8, requireUppercase = true, requireLowercase = true, requireNumber = true, requireSpecialChar = false }) {
28
+ export function PasswordStrengthIndicator({ strength, labels, showRequirements = true, passwordMinLength = 8, requireUppercase = true, requireLowercase = true, requireNumber = true, requireSpecialChar = false }) {
29
+ const say = {
30
+ ...DEFAULT_SET_PASSWORD_LABELS,
31
+ ...labels
32
+ };
28
33
  const theme = setPasswordPageTheme.passwordStrength;
29
34
  const getStrengthColor = (index)=>{
30
35
  if (index >= strength.score) return theme.bar.inactive;
@@ -37,31 +42,31 @@ export function PasswordStrengthIndicator({ strength, showRequirements = true, p
37
42
  const requirements = [
38
43
  {
39
44
  key: 'minLength',
40
- label: `At least ${passwordMinLength} characters`,
45
+ label: say.requirementMinLength(passwordMinLength),
41
46
  met: strength.hasMinLength,
42
47
  show: true
43
48
  },
44
49
  {
45
50
  key: 'uppercase',
46
- label: 'One uppercase letter',
51
+ label: say.requirementUppercase,
47
52
  met: strength.hasUppercase,
48
53
  show: requireUppercase
49
54
  },
50
55
  {
51
56
  key: 'lowercase',
52
- label: 'One lowercase letter',
57
+ label: say.requirementLowercase,
53
58
  met: strength.hasLowercase,
54
59
  show: requireLowercase
55
60
  },
56
61
  {
57
62
  key: 'number',
58
- label: 'One number',
63
+ label: say.requirementNumber,
59
64
  met: strength.hasNumber,
60
65
  show: requireNumber
61
66
  },
62
67
  {
63
68
  key: 'special',
64
- label: 'One special character',
69
+ label: say.requirementSpecialChar,
65
70
  met: strength.hasSpecialChar,
66
71
  show: requireSpecialChar
67
72
  }
@@ -75,7 +80,7 @@ export function PasswordStrengthIndicator({ strength, showRequirements = true, p
75
80
  "aria-valuenow": strength.score,
76
81
  "aria-valuemin": 0,
77
82
  "aria-valuemax": 5,
78
- "aria-label": "Password strength",
83
+ "aria-label": say.passwordStrength,
79
84
  children: [
80
85
  0,
81
86
  1,
@@ -88,7 +93,7 @@ export function PasswordStrengthIndicator({ strength, showRequirements = true, p
88
93
  }),
89
94
  showRequirements && /*#__PURE__*/ _jsx("ul", {
90
95
  className: theme.requirements.container,
91
- "aria-label": "Password requirements",
96
+ "aria-label": say.passwordRequirements,
92
97
  children: requirements.map((req)=>/*#__PURE__*/ _jsxs("li", {
93
98
  className: cn(theme.requirements.item, req.met ? theme.requirements.met : theme.requirements.unmet),
94
99
  children: [
@@ -22,16 +22,16 @@ export function SetPasswordForm({ labels, passwordChangeAction, passwordSetActio
22
22
  return say.passwordRequired;
23
23
  }
24
24
  if (store.newPassword.length < policy.minLength) {
25
- return `Password must be at least ${policy.minLength} characters`;
25
+ return say.passwordTooShort(policy.minLength);
26
26
  }
27
27
  if (policy.maxLength && store.newPassword.length > policy.maxLength) {
28
- return `Password must be at most ${policy.maxLength} characters`;
28
+ return say.passwordTooLong(policy.maxLength);
29
29
  }
30
30
  if (policy.requireUppercase && !/[A-Z]/.test(store.newPassword)) {
31
- return 'Password must contain at least one uppercase letter';
31
+ return say.passwordNeedsUppercase;
32
32
  }
33
33
  if (policy.requireLowercase && !/[a-z]/.test(store.newPassword)) {
34
- return 'Password must contain at least one lowercase letter';
34
+ return say.passwordNeedsLowercase;
35
35
  }
36
36
  if (policy.requireNumber && !/[0-9]/.test(store.newPassword)) {
37
37
  return say.passwordNeedsNumber;
@@ -39,7 +39,7 @@ export function SetPasswordForm({ labels, passwordChangeAction, passwordSetActio
39
39
  if (policy.requireSpecialChar) {
40
40
  const specialCharsRegex = new RegExp(`[${policy.specialChars.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')}]`);
41
41
  if (!specialCharsRegex.test(store.newPassword)) {
42
- return 'Password must contain at least one special character';
42
+ return say.passwordNeedsSpecialChar;
43
43
  }
44
44
  }
45
45
  if (!store.confirmPassword) {
@@ -105,7 +105,7 @@ export function SetPasswordForm({ labels, passwordChangeAction, passwordSetActio
105
105
  }),
106
106
  /*#__PURE__*/ _jsx(NucleusTextInput, {
107
107
  type: "password",
108
- label: "New Password",
108
+ label: say.newPasswordLabel,
109
109
  value: store.newPassword,
110
110
  onChange: (val)=>store.setNewPassword(val, policy.minLength),
111
111
  placeholder: say.newPasswordPlaceholder,
@@ -116,7 +116,7 @@ export function SetPasswordForm({ labels, passwordChangeAction, passwordSetActio
116
116
  }),
117
117
  /*#__PURE__*/ _jsx(NucleusTextInput, {
118
118
  type: "password",
119
- label: "Confirm Password",
119
+ label: say.confirmPasswordLabel,
120
120
  value: store.confirmPassword,
121
121
  onChange: store.setConfirmPassword,
122
122
  placeholder: say.confirmPasswordPlaceholder,
@@ -128,19 +128,19 @@ export function SetPasswordForm({ labels, passwordChangeAction, passwordSetActio
128
128
  type: "submit",
129
129
  disabled: activeAction?.state.isPending,
130
130
  className: theme.form.submitButton,
131
- children: activeAction?.state.isPending ? 'Setting Password...' : 'Set Password'
131
+ children: activeAction?.state.isPending ? say.submitting : say.submit
132
132
  }),
133
133
  /*#__PURE__*/ _jsx("div", {
134
134
  className: theme.form.backLink,
135
135
  children: backToLoginHref ? /*#__PURE__*/ _jsx("a", {
136
136
  href: backToLoginHref,
137
137
  className: theme.form.backLinkText,
138
- children: "Back to login"
138
+ children: say.backToLogin
139
139
  }) : onBackToLogin ? /*#__PURE__*/ _jsx("button", {
140
140
  type: "button",
141
141
  onClick: onBackToLogin,
142
142
  className: theme.form.backLinkText,
143
- children: "Back to login"
143
+ children: say.backToLogin
144
144
  }) : null
145
145
  })
146
146
  ]
@@ -40,7 +40,7 @@ export function SetPasswordPage({ logo, title = 'Set Password', subtitle = 'Ente
40
40
  },
41
41
  onErrorHandle: (error)=>{
42
42
  store.setStep('error');
43
- store.setError(error?.message || 'Token verification failed');
43
+ store.setError(error?.message || say.tokenVerificationFailed);
44
44
  }
45
45
  });
46
46
  });
@@ -96,7 +96,7 @@ export function SetPasswordPage({ logo, title = 'Set Password', subtitle = 'Ente
96
96
  }),
97
97
  /*#__PURE__*/ _jsx("p", {
98
98
  className: theme.states.verifying.subtitle,
99
- children: "Please wait while we verify your invitation link..."
99
+ children: say.verifyingSubtitle
100
100
  })
101
101
  ]
102
102
  })
@@ -144,7 +144,7 @@ export function SetPasswordPage({ logo, title = 'Set Password', subtitle = 'Ente
144
144
  className: theme.states.error.subtitle,
145
145
  children: isInvite ? say.invalidInviteBody : say.invalidLinkBody
146
146
  }),
147
- store.error && store.error !== 'Token verification failed' && /*#__PURE__*/ _jsx("p", {
147
+ store.error && store.error !== say.tokenVerificationFailed && /*#__PURE__*/ _jsx("p", {
148
148
  className: theme.states.error.errorMessage,
149
149
  children: store.error
150
150
  }),
@@ -213,7 +213,7 @@ export function SetPasswordPage({ logo, title = 'Set Password', subtitle = 'Ente
213
213
  }),
214
214
  /*#__PURE__*/ _jsx("p", {
215
215
  className: theme.states.success.subtitle,
216
- children: "Your account is now ready. Redirecting you to login..."
216
+ children: say.successSubtitle
217
217
  }),
218
218
  /*#__PURE__*/ _jsxs("div", {
219
219
  className: theme.layout.redirectWrapper,
@@ -16,10 +16,23 @@ export type SetPasswordLabels = {
16
16
  needHelp: string;
17
17
  success: string;
18
18
  redirecting: string;
19
+ /**
20
+ * The two sentences an employee waits in front of. The headings above them
21
+ * were translatable and these were not, so the wait read half in one
22
+ * language and half in another.
23
+ */
24
+ verifyingSubtitle: string;
25
+ successSubtitle: string;
26
+ newPasswordLabel: string;
27
+ confirmPasswordLabel: string;
19
28
  newPasswordPlaceholder: string;
20
29
  confirmPasswordPlaceholder: string;
21
30
  passwordStrength: string;
22
31
  passwordRequirements: string;
32
+ /** The one button on the form, and the word it wears while it works. */
33
+ submit: string;
34
+ submitting: string;
35
+ backToLogin: string;
23
36
  pageLabel: string;
24
37
  /**
25
38
  * The invalid-link screen. Its heading was translatable and the three
@@ -33,12 +46,34 @@ export type SetPasswordLabels = {
33
46
  invalidLinkHelp: string;
34
47
  goToLogin: string;
35
48
  invalidToken: string;
49
+ /**
50
+ * Never shown — it is the fallback the page compares against to decide the
51
+ * raw failure is not worth repeating under the heading. It reads from labels
52
+ * so no English literal is left in the component.
53
+ */
54
+ tokenVerificationFailed: string;
36
55
  /** Said when something is wrong, at the moment it is wrong. */
37
56
  passwordRequired: string;
57
+ /**
58
+ * The length rules carry a number, so they are functions: Turkish puts the
59
+ * count and the noun in an order English does not, and a sentence glued from
60
+ * a translated half and a number is a sentence in neither language.
61
+ */
62
+ passwordTooShort: (minLength: number) => string;
63
+ passwordTooLong: (maxLength: number) => string;
64
+ passwordNeedsUppercase: string;
65
+ passwordNeedsLowercase: string;
38
66
  passwordNeedsNumber: string;
67
+ passwordNeedsSpecialChar: string;
39
68
  confirmRequired: string;
40
69
  passwordsDoNotMatch: string;
41
70
  noActionConfigured: string;
42
71
  failed: string;
72
+ /** The checklist under the strength bar. */
73
+ requirementMinLength: (minLength: number) => string;
74
+ requirementUppercase: string;
75
+ requirementLowercase: string;
76
+ requirementNumber: string;
77
+ requirementSpecialChar: string;
43
78
  };
44
79
  export declare const DEFAULT_SET_PASSWORD_LABELS: SetPasswordLabels;
@@ -11,14 +11,21 @@
11
11
  * Defaults stay English, so nothing that does not pass labels changes.
12
12
  */ export const DEFAULT_SET_PASSWORD_LABELS = {
13
13
  verifying: 'Verifying Invitation',
14
+ verifyingSubtitle: 'Please wait while we verify your invitation link...',
14
15
  invalidLink: 'Invalid Link',
15
16
  needHelp: 'Need help? Contact your system administrator.',
16
17
  success: 'Password Set Successfully!',
18
+ successSubtitle: 'Your account is now ready. Redirecting you to login...',
17
19
  redirecting: 'Redirecting...',
20
+ newPasswordLabel: 'New Password',
21
+ confirmPasswordLabel: 'Confirm Password',
18
22
  newPasswordPlaceholder: 'Enter your new password',
19
23
  confirmPasswordPlaceholder: 'Confirm your new password',
20
24
  passwordStrength: 'Password strength',
21
25
  passwordRequirements: 'Password requirements',
26
+ submit: 'Set Password',
27
+ submitting: 'Setting Password...',
28
+ backToLogin: 'Back to login',
22
29
  pageLabel: 'Set password page',
23
30
  invalidInviteBody: 'This invitation link is invalid or has expired.',
24
31
  invalidLinkBody: 'This link is invalid or has expired.',
@@ -26,10 +33,21 @@
26
33
  invalidLinkHelp: 'Please request a new link or contact support.',
27
34
  goToLogin: 'Go to Login',
28
35
  invalidToken: 'Invalid or missing token',
36
+ tokenVerificationFailed: 'Token verification failed',
29
37
  passwordRequired: 'Password is required',
38
+ passwordTooShort: (minLength)=>`Password must be at least ${minLength} characters`,
39
+ passwordTooLong: (maxLength)=>`Password must be at most ${maxLength} characters`,
40
+ passwordNeedsUppercase: 'Password must contain at least one uppercase letter',
41
+ passwordNeedsLowercase: 'Password must contain at least one lowercase letter',
30
42
  passwordNeedsNumber: 'Password must contain at least one number',
43
+ passwordNeedsSpecialChar: 'Password must contain at least one special character',
31
44
  confirmRequired: 'Please confirm your password',
32
45
  passwordsDoNotMatch: 'Passwords do not match',
33
46
  noActionConfigured: 'No action configured',
34
- failed: 'Failed to set password'
47
+ failed: 'Failed to set password',
48
+ requirementMinLength: (minLength)=>`At least ${minLength} characters`,
49
+ requirementUppercase: 'One uppercase letter',
50
+ requirementLowercase: 'One lowercase letter',
51
+ requirementNumber: 'One number',
52
+ requirementSpecialChar: 'One special character'
35
53
  };