nucleus-core-ts 0.9.883 → 0.9.884

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.
package/dist/.build-ok CHANGED
@@ -1 +1 @@
1
- 0.9.883
1
+ 0.9.884
@@ -56,7 +56,7 @@ export function ForgotPasswordForm({ labels, forgotPasswordAction, onBackToLogin
56
56
  const handleSubmit = contextSafe((e)=>{
57
57
  e.preventDefault();
58
58
  if (!store.email) {
59
- store.setError('Please enter your email address');
59
+ store.setError(say.emailRequired);
60
60
  shakeForm();
61
61
  return;
62
62
  }
@@ -197,7 +197,7 @@ export function ForgotPasswordForm({ labels, forgotPasswordAction, onBackToLogin
197
197
  fullWidth: true,
198
198
  loading: isLoading,
199
199
  disabled: isLoading,
200
- children: "Send Reset Link"
200
+ children: say.submit
201
201
  })
202
202
  }),
203
203
  /*#__PURE__*/ _jsx("div", {
@@ -15,5 +15,9 @@ export type ForgotPasswordLabels = {
15
15
  sentTo: string;
16
16
  backToLogin: string;
17
17
  pageLabel: string;
18
+ /** The button that sends the link. */
19
+ submit: string;
20
+ /** Said when the box is empty. */
21
+ emailRequired: string;
18
22
  };
19
23
  export declare const DEFAULT_FORGOT_PASSWORD_LABELS: ForgotPasswordLabels;
@@ -12,5 +12,7 @@
12
12
  checkYourEmail: 'Check your email',
13
13
  sentTo: "We've sent a password reset link to {email}. Please check your inbox and follow the instructions.",
14
14
  backToLogin: 'Back to login',
15
- pageLabel: 'Forgot password page'
15
+ pageLabel: 'Forgot password page',
16
+ submit: 'Send Reset Link',
17
+ emailRequired: 'Please enter your email address'
16
18
  };
@@ -95,28 +95,28 @@ export function ResetPasswordForm({ labels, token, resetPasswordAction, onBackTo
95
95
  if (policy.requireUppercase) {
96
96
  reqs.push({
97
97
  key: 'uppercase',
98
- label: 'One uppercase letter',
98
+ label: say.ruleUppercase,
99
99
  test: (p)=>/[A-Z]/.test(p)
100
100
  });
101
101
  }
102
102
  if (policy.requireLowercase) {
103
103
  reqs.push({
104
104
  key: 'lowercase',
105
- label: 'One lowercase letter',
105
+ label: say.ruleLowercase,
106
106
  test: (p)=>/[a-z]/.test(p)
107
107
  });
108
108
  }
109
109
  if (policy.requireNumber) {
110
110
  reqs.push({
111
111
  key: 'number',
112
- label: 'One number',
112
+ label: say.ruleNumber,
113
113
  test: (p)=>/\d/.test(p)
114
114
  });
115
115
  }
116
116
  if (policy.requireSpecialChar) {
117
117
  reqs.push({
118
118
  key: 'special',
119
- label: 'One special character',
119
+ label: say.ruleSpecial,
120
120
  test: (p)=>{
121
121
  const escapedChars = policy.specialChars.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
122
122
  return new RegExp(`[${escapedChars}]`).test(p);
@@ -139,18 +139,18 @@ export function ResetPasswordForm({ labels, token, resetPasswordAction, onBackTo
139
139
  const handleSubmit = contextSafe((e)=>{
140
140
  e.preventDefault();
141
141
  if (!store.newPassword || !store.confirmPassword) {
142
- store.setError('Please fill in all fields');
142
+ store.setError(say.fillAllFields);
143
143
  shakeForm();
144
144
  return;
145
145
  }
146
146
  if (store.newPassword !== store.confirmPassword) {
147
- store.setError('Passwords do not match');
147
+ store.setError(say.passwordsDoNotMatch);
148
148
  shakeForm();
149
149
  return;
150
150
  }
151
151
  const allRequirementsMet = passwordRequirements.every((req)=>req.test(store.newPassword));
152
152
  if (!allRequirementsMet) {
153
- store.setError('Password does not meet all requirements');
153
+ store.setError(say.requirementsNotMet);
154
154
  shakeForm();
155
155
  return;
156
156
  }
@@ -10,5 +10,14 @@ export type ResetPasswordLabels = {
10
10
  success: string;
11
11
  backToLogin: string;
12
12
  pageLabel: string;
13
+ /** The rules listed under the box, one line each. */
14
+ ruleUppercase: string;
15
+ ruleLowercase: string;
16
+ ruleNumber: string;
17
+ ruleSpecial: string;
18
+ /** Said when something is wrong, at the moment it is wrong. */
19
+ fillAllFields: string;
20
+ passwordsDoNotMatch: string;
21
+ requirementsNotMet: string;
13
22
  };
14
23
  export declare const DEFAULT_RESET_PASSWORD_LABELS: ResetPasswordLabels;
@@ -8,5 +8,12 @@
8
8
  passwordRequirements: 'Password requirements:',
9
9
  success: 'Password Reset Successful',
10
10
  backToLogin: 'Back to login',
11
- pageLabel: 'Reset password page'
11
+ pageLabel: 'Reset password page',
12
+ ruleUppercase: 'One uppercase letter',
13
+ ruleLowercase: 'One lowercase letter',
14
+ ruleNumber: 'One number',
15
+ ruleSpecial: 'One special character',
16
+ fillAllFields: 'Please fill in all fields',
17
+ passwordsDoNotMatch: 'Passwords do not match',
18
+ requirementsNotMet: 'Password does not meet all requirements'
12
19
  };
@@ -19,7 +19,7 @@ export function SetPasswordForm({ labels, passwordChangeAction, passwordSetActio
19
19
  const activeAction = isInvite && passwordSetAction ? passwordSetAction : passwordChangeAction;
20
20
  const validateForm = ()=>{
21
21
  if (!store.newPassword) {
22
- return 'Password is required';
22
+ return say.passwordRequired;
23
23
  }
24
24
  if (store.newPassword.length < policy.minLength) {
25
25
  return `Password must be at least ${policy.minLength} characters`;
@@ -34,7 +34,7 @@ export function SetPasswordForm({ labels, passwordChangeAction, passwordSetActio
34
34
  return 'Password must contain at least one lowercase letter';
35
35
  }
36
36
  if (policy.requireNumber && !/[0-9]/.test(store.newPassword)) {
37
- return 'Password must contain at least one number';
37
+ return say.passwordNeedsNumber;
38
38
  }
39
39
  if (policy.requireSpecialChar) {
40
40
  const specialCharsRegex = new RegExp(`[${policy.specialChars.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')}]`);
@@ -43,10 +43,10 @@ export function SetPasswordForm({ labels, passwordChangeAction, passwordSetActio
43
43
  }
44
44
  }
45
45
  if (!store.confirmPassword) {
46
- return 'Please confirm your password';
46
+ return say.confirmRequired;
47
47
  }
48
48
  if (store.newPassword !== store.confirmPassword) {
49
- return 'Passwords do not match';
49
+ return say.passwordsDoNotMatch;
50
50
  }
51
51
  return null;
52
52
  };
@@ -59,7 +59,7 @@ export function SetPasswordForm({ labels, passwordChangeAction, passwordSetActio
59
59
  }
60
60
  store.setError(null);
61
61
  if (!activeAction) {
62
- store.setError('No action configured');
62
+ store.setError(say.noActionConfigured);
63
63
  return;
64
64
  }
65
65
  const onAfterHandle = ()=>{
@@ -71,7 +71,7 @@ export function SetPasswordForm({ labels, passwordChangeAction, passwordSetActio
71
71
  }
72
72
  };
73
73
  const onErrorHandle = (error)=>{
74
- store.setError(error?.message || 'Failed to set password');
74
+ store.setError(error?.message || say.failed);
75
75
  };
76
76
  if (isInvite && passwordSetAction && store.userId) {
77
77
  passwordSetAction.start({
@@ -21,5 +21,12 @@ export type SetPasswordLabels = {
21
21
  passwordStrength: string;
22
22
  passwordRequirements: string;
23
23
  pageLabel: string;
24
+ /** Said when something is wrong, at the moment it is wrong. */
25
+ passwordRequired: string;
26
+ passwordNeedsNumber: string;
27
+ confirmRequired: string;
28
+ passwordsDoNotMatch: string;
29
+ noActionConfigured: string;
30
+ failed: string;
24
31
  };
25
32
  export declare const DEFAULT_SET_PASSWORD_LABELS: SetPasswordLabels;
@@ -19,5 +19,11 @@
19
19
  confirmPasswordPlaceholder: 'Confirm your new password',
20
20
  passwordStrength: 'Password strength',
21
21
  passwordRequirements: 'Password requirements',
22
- pageLabel: 'Set password page'
22
+ pageLabel: 'Set password page',
23
+ passwordRequired: 'Password is required',
24
+ passwordNeedsNumber: 'Password must contain at least one number',
25
+ confirmRequired: 'Please confirm your password',
26
+ passwordsDoNotMatch: 'Passwords do not match',
27
+ noActionConfigured: 'No action configured',
28
+ failed: 'Failed to set password'
23
29
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nucleus-core-ts",
3
- "version": "0.9.883",
3
+ "version": "0.9.884",
4
4
  "description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
5
5
  "author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
6
6
  "license": "SEE LICENSE IN LICENSE",