nucleus-core-ts 0.9.880 → 0.9.882
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 +1 -1
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordForm.d.ts +1 -1
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordForm.js +21 -15
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordPage.d.ts +1 -1
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordPage.js +9 -3
- package/dist/fe/components/ForgotPasswordPage/index.d.ts +1 -0
- package/dist/fe/components/ForgotPasswordPage/index.js +1 -0
- package/dist/fe/components/ForgotPasswordPage/labels.d.ts +19 -0
- package/dist/fe/components/ForgotPasswordPage/labels.js +16 -0
- package/dist/fe/components/ForgotPasswordPage/types/index.d.ts +4 -0
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordForm.d.ts +1 -1
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordForm.js +13 -8
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordPage.d.ts +1 -1
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordPage.js +9 -3
- package/dist/fe/components/ResetPasswordPage/index.d.ts +1 -0
- package/dist/fe/components/ResetPasswordPage/index.js +1 -0
- package/dist/fe/components/ResetPasswordPage/labels.d.ts +14 -0
- package/dist/fe/components/ResetPasswordPage/labels.js +12 -0
- package/dist/fe/components/ResetPasswordPage/types/index.d.ts +4 -0
- package/dist/fe/components/SetPasswordPage/components/SetPasswordForm.d.ts +2 -2
- package/dist/fe/components/SetPasswordPage/components/SetPasswordPage.d.ts +1 -1
- package/dist/fe/components/SetPasswordPage/components/SetPasswordPage.js +14 -8
- package/dist/fe/components/SetPasswordPage/index.d.ts +1 -0
- package/dist/fe/components/SetPasswordPage/index.js +1 -0
- package/dist/fe/components/SetPasswordPage/labels.d.ts +25 -0
- package/dist/fe/components/SetPasswordPage/labels.js +23 -0
- package/dist/fe/components/SetPasswordPage/types/index.d.ts +4 -0
- package/dist/fe/index.d.ts +4 -4
- package/dist/fe/index.js +3 -3
- package/package.json +1 -1
- package/dist/fe/components/SetPasswordPage/components/SetPasswordForm.js +0 -143
package/dist/.build-ok
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.9.
|
|
1
|
+
0.9.882
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { ForgotPasswordFormProps } from '../types';
|
|
3
|
-
export declare function ForgotPasswordForm({ forgotPasswordAction, onBackToLogin, backToLoginHref, }: ForgotPasswordFormProps): ReactElement;
|
|
3
|
+
export declare function ForgotPasswordForm({ labels, forgotPasswordAction, onBackToLogin, backToLoginHref, }: ForgotPasswordFormProps): ReactElement;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DEFAULT_FORGOT_PASSWORD_LABELS } from '../labels';
|
|
3
|
+
'use client';
|
|
3
4
|
import { useGSAP } from '@gsap/react';
|
|
4
5
|
import gsap from 'gsap';
|
|
5
6
|
import { useRef } from 'react';
|
|
@@ -39,7 +40,11 @@ function CheckCircleIcon({ className }) {
|
|
|
39
40
|
})
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
export function ForgotPasswordForm({ forgotPasswordAction, onBackToLogin, backToLoginHref }) {
|
|
43
|
+
export function ForgotPasswordForm({ labels, forgotPasswordAction, onBackToLogin, backToLoginHref }) {
|
|
44
|
+
const say = {
|
|
45
|
+
...DEFAULT_FORGOT_PASSWORD_LABELS,
|
|
46
|
+
...labels
|
|
47
|
+
};
|
|
43
48
|
const theme = forgotPasswordPageTheme;
|
|
44
49
|
const formRef = useRef(null);
|
|
45
50
|
const successRef = useRef(null);
|
|
@@ -122,17 +127,18 @@ export function ForgotPasswordForm({ forgotPasswordAction, onBackToLogin, backTo
|
|
|
122
127
|
}),
|
|
123
128
|
/*#__PURE__*/ _jsx("h2", {
|
|
124
129
|
className: theme.success.title,
|
|
125
|
-
children:
|
|
130
|
+
children: say.checkYourEmail
|
|
126
131
|
}),
|
|
127
|
-
/*#__PURE__*/
|
|
132
|
+
/*#__PURE__*/ _jsx("p", {
|
|
128
133
|
className: theme.success.message,
|
|
129
|
-
children: [
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
children: say.sentTo.split('{email}').flatMap((part, i)=>i === 0 ? [
|
|
135
|
+
part
|
|
136
|
+
] : [
|
|
137
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
138
|
+
children: store.email
|
|
139
|
+
}, "e"),
|
|
140
|
+
part
|
|
141
|
+
])
|
|
136
142
|
}),
|
|
137
143
|
/*#__PURE__*/ _jsx("div", {
|
|
138
144
|
className: theme.links.container,
|
|
@@ -142,7 +148,7 @@ export function ForgotPasswordForm({ forgotPasswordAction, onBackToLogin, backTo
|
|
|
142
148
|
className: theme.links.backToLogin,
|
|
143
149
|
children: [
|
|
144
150
|
/*#__PURE__*/ _jsx(ArrowLeftIcon, {}),
|
|
145
|
-
|
|
151
|
+
say.backToLogin
|
|
146
152
|
]
|
|
147
153
|
})
|
|
148
154
|
})
|
|
@@ -170,8 +176,8 @@ export function ForgotPasswordForm({ forgotPasswordAction, onBackToLogin, backTo
|
|
|
170
176
|
className: theme.input.wrapper,
|
|
171
177
|
children: /*#__PURE__*/ _jsx(NucleusTextInput, {
|
|
172
178
|
type: "email",
|
|
173
|
-
label:
|
|
174
|
-
placeholder:
|
|
179
|
+
label: say.emailLabel,
|
|
180
|
+
placeholder: say.emailPlaceholder,
|
|
175
181
|
value: store.email,
|
|
176
182
|
onChange: store.setEmail,
|
|
177
183
|
disabled: isLoading,
|
|
@@ -203,7 +209,7 @@ export function ForgotPasswordForm({ forgotPasswordAction, onBackToLogin, backTo
|
|
|
203
209
|
disabled: isLoading,
|
|
204
210
|
children: [
|
|
205
211
|
/*#__PURE__*/ _jsx(ArrowLeftIcon, {}),
|
|
206
|
-
|
|
212
|
+
say.backToLogin
|
|
207
213
|
]
|
|
208
214
|
})
|
|
209
215
|
})
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { ForgotPasswordPageConfig } from '../types';
|
|
3
|
-
export declare function ForgotPasswordPage({ logo, title, subtitle, forgotPasswordAction, onBackToLogin, backToLoginHref, showBackground, className, }: ForgotPasswordPageConfig): ReactElement;
|
|
3
|
+
export declare function ForgotPasswordPage({ labels, logo, title, subtitle, forgotPasswordAction, onBackToLogin, backToLoginHref, showBackground, className, }: ForgotPasswordPageConfig): ReactElement;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DEFAULT_FORGOT_PASSWORD_LABELS } from '../labels';
|
|
3
|
+
'use client';
|
|
3
4
|
import { useGSAP } from '@gsap/react';
|
|
4
5
|
import gsap from 'gsap';
|
|
5
6
|
import { useRef } from 'react';
|
|
@@ -9,7 +10,11 @@ import { forgotPasswordPageTheme } from '../theme';
|
|
|
9
10
|
import { ForgotPasswordForm } from './ForgotPasswordForm';
|
|
10
11
|
import { ForgotPasswordHeader } from './ForgotPasswordHeader';
|
|
11
12
|
gsap.registerPlugin(useGSAP);
|
|
12
|
-
export function ForgotPasswordPage({ logo, title = 'Forgot Password?', subtitle = "No worries, we'll send you reset instructions.", forgotPasswordAction, onBackToLogin, backToLoginHref, showBackground = true, className }) {
|
|
13
|
+
export function ForgotPasswordPage({ labels, logo, title = 'Forgot Password?', subtitle = "No worries, we'll send you reset instructions.", forgotPasswordAction, onBackToLogin, backToLoginHref, showBackground = true, className }) {
|
|
14
|
+
const say = {
|
|
15
|
+
...DEFAULT_FORGOT_PASSWORD_LABELS,
|
|
16
|
+
...labels
|
|
17
|
+
};
|
|
13
18
|
const theme = forgotPasswordPageTheme;
|
|
14
19
|
const containerRef = useRef(null);
|
|
15
20
|
const cardRef = useRef(null);
|
|
@@ -32,7 +37,7 @@ export function ForgotPasswordPage({ logo, title = 'Forgot Password?', subtitle
|
|
|
32
37
|
return /*#__PURE__*/ _jsxs("main", {
|
|
33
38
|
ref: containerRef,
|
|
34
39
|
className: cn(theme.container.base, className),
|
|
35
|
-
"aria-label":
|
|
40
|
+
"aria-label": say.pageLabel,
|
|
36
41
|
children: [
|
|
37
42
|
showBackground && /*#__PURE__*/ _jsx(AbstractAnimatedBackground, {}),
|
|
38
43
|
/*#__PURE__*/ _jsx("div", {
|
|
@@ -47,6 +52,7 @@ export function ForgotPasswordPage({ logo, title = 'Forgot Password?', subtitle
|
|
|
47
52
|
subtitle: subtitle
|
|
48
53
|
}),
|
|
49
54
|
/*#__PURE__*/ _jsx(ForgotPasswordForm, {
|
|
55
|
+
labels: labels,
|
|
50
56
|
forgotPasswordAction: forgotPasswordAction,
|
|
51
57
|
onBackToLogin: onBackToLogin,
|
|
52
58
|
backToLoginHref: backToLoginHref
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ForgotPasswordForm } from './components/ForgotPasswordForm';
|
|
2
2
|
export { ForgotPasswordHeader } from './components/ForgotPasswordHeader';
|
|
3
3
|
export { ForgotPasswordPage } from './components/ForgotPasswordPage';
|
|
4
|
+
export { DEFAULT_FORGOT_PASSWORD_LABELS, type ForgotPasswordLabels } from './labels';
|
|
4
5
|
export { useForgotPasswordStore } from './store';
|
|
5
6
|
export { extendForgotPasswordPageTheme, type ForgotPasswordPageTheme, forgotPasswordPageTheme, } from './theme';
|
|
6
7
|
export type { ForgotPasswordAction, ForgotPasswordFormProps, ForgotPasswordHeaderProps, ForgotPasswordPageConfig, ForgotPasswordStep, } from './types';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { ForgotPasswordForm } from './components/ForgotPasswordForm';
|
|
2
2
|
export { ForgotPasswordHeader } from './components/ForgotPasswordHeader';
|
|
3
3
|
export { ForgotPasswordPage } from './components/ForgotPasswordPage';
|
|
4
|
+
export { DEFAULT_FORGOT_PASSWORD_LABELS } from './labels';
|
|
4
5
|
export { useForgotPasswordStore } from './store';
|
|
5
6
|
export { extendForgotPasswordPageTheme, forgotPasswordPageTheme } from './theme';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every word this page says, so a portal can say them in its own language.
|
|
3
|
+
*
|
|
4
|
+
* `title` and `subtitle` were already props; everything under them was English
|
|
5
|
+
* — including the whole success state, which is the only screen somebody who
|
|
6
|
+
* has lost their password actually reads.
|
|
7
|
+
*
|
|
8
|
+
* Defaults stay English, so nothing that does not pass labels changes.
|
|
9
|
+
*/
|
|
10
|
+
export type ForgotPasswordLabels = {
|
|
11
|
+
emailLabel: string;
|
|
12
|
+
emailPlaceholder: string;
|
|
13
|
+
checkYourEmail: string;
|
|
14
|
+
/** `{email}` is replaced with the address the link went to. */
|
|
15
|
+
sentTo: string;
|
|
16
|
+
backToLogin: string;
|
|
17
|
+
pageLabel: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const DEFAULT_FORGOT_PASSWORD_LABELS: ForgotPasswordLabels;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every word this page says, so a portal can say them in its own language.
|
|
3
|
+
*
|
|
4
|
+
* `title` and `subtitle` were already props; everything under them was English
|
|
5
|
+
* — including the whole success state, which is the only screen somebody who
|
|
6
|
+
* has lost their password actually reads.
|
|
7
|
+
*
|
|
8
|
+
* Defaults stay English, so nothing that does not pass labels changes.
|
|
9
|
+
*/ export const DEFAULT_FORGOT_PASSWORD_LABELS = {
|
|
10
|
+
emailLabel: 'Email',
|
|
11
|
+
emailPlaceholder: 'you@example.com',
|
|
12
|
+
checkYourEmail: 'Check your email',
|
|
13
|
+
sentTo: "We've sent a password reset link to {email}. Please check your inbox and follow the instructions.",
|
|
14
|
+
backToLogin: 'Back to login',
|
|
15
|
+
pageLabel: 'Forgot password page'
|
|
16
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ForgotPasswordLabels } from '../labels';
|
|
2
3
|
export type ForgotPasswordStep = 'request' | 'success';
|
|
3
4
|
export type ForgotPasswordAction<TData = unknown, TError = unknown> = {
|
|
4
5
|
start: (config: {
|
|
@@ -17,6 +18,8 @@ export type ForgotPasswordAction<TData = unknown, TError = unknown> = {
|
|
|
17
18
|
export interface ForgotPasswordPageConfig {
|
|
18
19
|
title?: string;
|
|
19
20
|
subtitle?: string;
|
|
21
|
+
/** Every word the page says, so a portal can say them in its own language. */
|
|
22
|
+
labels?: Partial<ForgotPasswordLabels>;
|
|
20
23
|
logo?: ReactNode;
|
|
21
24
|
forgotPasswordAction: ForgotPasswordAction;
|
|
22
25
|
onBackToLogin?: () => void;
|
|
@@ -25,6 +28,7 @@ export interface ForgotPasswordPageConfig {
|
|
|
25
28
|
className?: string;
|
|
26
29
|
}
|
|
27
30
|
export interface ForgotPasswordFormProps {
|
|
31
|
+
labels?: Partial<ForgotPasswordLabels>;
|
|
28
32
|
forgotPasswordAction: ForgotPasswordAction;
|
|
29
33
|
onBackToLogin?: () => void;
|
|
30
34
|
backToLoginHref?: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { ResetPasswordFormProps } from '../types';
|
|
3
|
-
export declare function ResetPasswordForm({ token, resetPasswordAction, onBackToLogin, backToLoginHref, passwordPolicy, }: ResetPasswordFormProps): ReactElement;
|
|
3
|
+
export declare function ResetPasswordForm({ labels, token, resetPasswordAction, onBackToLogin, backToLoginHref, passwordPolicy, }: ResetPasswordFormProps): ReactElement;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DEFAULT_RESET_PASSWORD_LABELS } from '../labels';
|
|
3
|
+
'use client';
|
|
3
4
|
import { useGSAP } from '@gsap/react';
|
|
4
5
|
import gsap from 'gsap';
|
|
5
6
|
import { useMemo, useRef } from 'react';
|
|
@@ -70,7 +71,11 @@ function XIcon({ className }) {
|
|
|
70
71
|
})
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
|
-
export function ResetPasswordForm({ token, resetPasswordAction, onBackToLogin, backToLoginHref, passwordPolicy = {} }) {
|
|
74
|
+
export function ResetPasswordForm({ labels, token, resetPasswordAction, onBackToLogin, backToLoginHref, passwordPolicy = {} }) {
|
|
75
|
+
const say = {
|
|
76
|
+
...DEFAULT_RESET_PASSWORD_LABELS,
|
|
77
|
+
...labels
|
|
78
|
+
};
|
|
74
79
|
const theme = resetPasswordPageTheme;
|
|
75
80
|
const formRef = useRef(null);
|
|
76
81
|
const successRef = useRef(null);
|
|
@@ -218,7 +223,7 @@ export function ResetPasswordForm({ token, resetPasswordAction, onBackToLogin, b
|
|
|
218
223
|
}),
|
|
219
224
|
/*#__PURE__*/ _jsx("h2", {
|
|
220
225
|
className: theme.success.title,
|
|
221
|
-
children:
|
|
226
|
+
children: say.success
|
|
222
227
|
}),
|
|
223
228
|
/*#__PURE__*/ _jsx("p", {
|
|
224
229
|
className: theme.success.message,
|
|
@@ -232,7 +237,7 @@ export function ResetPasswordForm({ token, resetPasswordAction, onBackToLogin, b
|
|
|
232
237
|
className: theme.links.backToLogin,
|
|
233
238
|
children: [
|
|
234
239
|
/*#__PURE__*/ _jsx(ArrowLeftIcon, {}),
|
|
235
|
-
|
|
240
|
+
say.backToLogin
|
|
236
241
|
]
|
|
237
242
|
})
|
|
238
243
|
})
|
|
@@ -260,7 +265,7 @@ export function ResetPasswordForm({ token, resetPasswordAction, onBackToLogin, b
|
|
|
260
265
|
className: theme.input.wrapper,
|
|
261
266
|
children: /*#__PURE__*/ _jsx(NucleusTextInput, {
|
|
262
267
|
type: "password",
|
|
263
|
-
label:
|
|
268
|
+
label: say.newPassword,
|
|
264
269
|
placeholder: "••••••••",
|
|
265
270
|
value: store.newPassword,
|
|
266
271
|
onChange: store.setNewPassword,
|
|
@@ -279,7 +284,7 @@ export function ResetPasswordForm({ token, resetPasswordAction, onBackToLogin, b
|
|
|
279
284
|
className: theme.input.wrapper,
|
|
280
285
|
children: /*#__PURE__*/ _jsx(NucleusTextInput, {
|
|
281
286
|
type: "password",
|
|
282
|
-
label:
|
|
287
|
+
label: say.confirmPassword,
|
|
283
288
|
placeholder: "••••••••",
|
|
284
289
|
value: store.confirmPassword,
|
|
285
290
|
onChange: store.setConfirmPassword,
|
|
@@ -298,7 +303,7 @@ export function ResetPasswordForm({ token, resetPasswordAction, onBackToLogin, b
|
|
|
298
303
|
children: [
|
|
299
304
|
/*#__PURE__*/ _jsx("p", {
|
|
300
305
|
className: theme.requirements.title,
|
|
301
|
-
children:
|
|
306
|
+
children: say.passwordRequirements
|
|
302
307
|
}),
|
|
303
308
|
/*#__PURE__*/ _jsx("ul", {
|
|
304
309
|
className: theme.requirements.list,
|
|
@@ -336,7 +341,7 @@ export function ResetPasswordForm({ token, resetPasswordAction, onBackToLogin, b
|
|
|
336
341
|
disabled: isLoading,
|
|
337
342
|
children: [
|
|
338
343
|
/*#__PURE__*/ _jsx(ArrowLeftIcon, {}),
|
|
339
|
-
|
|
344
|
+
say.backToLogin
|
|
340
345
|
]
|
|
341
346
|
})
|
|
342
347
|
})
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { ResetPasswordPageConfig } from '../types';
|
|
3
|
-
export declare function ResetPasswordPage({ logo, title, subtitle, token, resetPasswordAction, onBackToLogin, backToLoginHref, showBackground, className, passwordPolicy, }: ResetPasswordPageConfig): ReactElement;
|
|
3
|
+
export declare function ResetPasswordPage({ labels, logo, title, subtitle, token, resetPasswordAction, onBackToLogin, backToLoginHref, showBackground, className, passwordPolicy, }: ResetPasswordPageConfig): ReactElement;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DEFAULT_RESET_PASSWORD_LABELS } from '../labels';
|
|
3
|
+
'use client';
|
|
3
4
|
import { useGSAP } from '@gsap/react';
|
|
4
5
|
import gsap from 'gsap';
|
|
5
6
|
import { useRef } from 'react';
|
|
@@ -9,7 +10,11 @@ import { resetPasswordPageTheme } from '../theme';
|
|
|
9
10
|
import { ResetPasswordForm } from './ResetPasswordForm';
|
|
10
11
|
import { ResetPasswordHeader } from './ResetPasswordHeader';
|
|
11
12
|
gsap.registerPlugin(useGSAP);
|
|
12
|
-
export function ResetPasswordPage({ 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 = 'Reset Password', subtitle = 'Enter your new password below.', token, resetPasswordAction, onBackToLogin, backToLoginHref, showBackground = true, className, passwordPolicy }) {
|
|
14
|
+
const say = {
|
|
15
|
+
...DEFAULT_RESET_PASSWORD_LABELS,
|
|
16
|
+
...labels
|
|
17
|
+
};
|
|
13
18
|
const theme = resetPasswordPageTheme;
|
|
14
19
|
const containerRef = useRef(null);
|
|
15
20
|
const cardRef = useRef(null);
|
|
@@ -32,7 +37,7 @@ export function ResetPasswordPage({ logo, title = 'Reset Password', subtitle = '
|
|
|
32
37
|
return /*#__PURE__*/ _jsxs("main", {
|
|
33
38
|
ref: containerRef,
|
|
34
39
|
className: cn(theme.container.base, className),
|
|
35
|
-
"aria-label":
|
|
40
|
+
"aria-label": say.pageLabel,
|
|
36
41
|
children: [
|
|
37
42
|
showBackground && /*#__PURE__*/ _jsx(AbstractAnimatedBackground, {}),
|
|
38
43
|
/*#__PURE__*/ _jsx("div", {
|
|
@@ -47,6 +52,7 @@ export function ResetPasswordPage({ logo, title = 'Reset Password', subtitle = '
|
|
|
47
52
|
subtitle: subtitle
|
|
48
53
|
}),
|
|
49
54
|
/*#__PURE__*/ _jsx(ResetPasswordForm, {
|
|
55
|
+
labels: labels,
|
|
50
56
|
token: token,
|
|
51
57
|
resetPasswordAction: resetPasswordAction,
|
|
52
58
|
onBackToLogin: onBackToLogin,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ResetPasswordForm } from './components/ResetPasswordForm';
|
|
2
2
|
export { ResetPasswordHeader } from './components/ResetPasswordHeader';
|
|
3
3
|
export { ResetPasswordPage } from './components/ResetPasswordPage';
|
|
4
|
+
export { DEFAULT_RESET_PASSWORD_LABELS, type ResetPasswordLabels } from './labels';
|
|
4
5
|
export { useResetPasswordStore } from './store';
|
|
5
6
|
export { extendResetPasswordPageTheme, type ResetPasswordPageTheme, resetPasswordPageTheme, } from './theme';
|
|
6
7
|
export type { ResetPasswordAction, ResetPasswordFormProps, ResetPasswordHeaderProps, ResetPasswordPageConfig, ResetPasswordStep, } from './types';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { ResetPasswordForm } from './components/ResetPasswordForm';
|
|
2
2
|
export { ResetPasswordHeader } from './components/ResetPasswordHeader';
|
|
3
3
|
export { ResetPasswordPage } from './components/ResetPasswordPage';
|
|
4
|
+
export { DEFAULT_RESET_PASSWORD_LABELS } from './labels';
|
|
4
5
|
export { useResetPasswordStore } from './store';
|
|
5
6
|
export { extendResetPasswordPageTheme, resetPasswordPageTheme } from './theme';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every word this page says, so a portal can say them in its own language.
|
|
3
|
+
*
|
|
4
|
+
* Defaults stay English, so nothing that does not pass labels changes.
|
|
5
|
+
*/
|
|
6
|
+
export type ResetPasswordLabels = {
|
|
7
|
+
newPassword: string;
|
|
8
|
+
confirmPassword: string;
|
|
9
|
+
passwordRequirements: string;
|
|
10
|
+
success: string;
|
|
11
|
+
backToLogin: string;
|
|
12
|
+
pageLabel: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const DEFAULT_RESET_PASSWORD_LABELS: ResetPasswordLabels;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every word this page says, so a portal can say them in its own language.
|
|
3
|
+
*
|
|
4
|
+
* Defaults stay English, so nothing that does not pass labels changes.
|
|
5
|
+
*/ export const DEFAULT_RESET_PASSWORD_LABELS = {
|
|
6
|
+
newPassword: 'New Password',
|
|
7
|
+
confirmPassword: 'Confirm Password',
|
|
8
|
+
passwordRequirements: 'Password requirements:',
|
|
9
|
+
success: 'Password Reset Successful',
|
|
10
|
+
backToLogin: 'Back to login',
|
|
11
|
+
pageLabel: 'Reset password page'
|
|
12
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { PasswordPolicy } from '../../SetPasswordPage/types';
|
|
3
|
+
import type { ResetPasswordLabels } from '../labels';
|
|
3
4
|
export type ResetPasswordStep = 'form' | 'success';
|
|
4
5
|
export type ResetPasswordAction<TData = unknown, TError = unknown> = {
|
|
5
6
|
start: (config: {
|
|
@@ -20,6 +21,8 @@ export type ResetPasswordAction<TData = unknown, TError = unknown> = {
|
|
|
20
21
|
export interface ResetPasswordPageConfig {
|
|
21
22
|
title?: string;
|
|
22
23
|
subtitle?: string;
|
|
24
|
+
/** Every word the page says, so a portal can say them in its own language. */
|
|
25
|
+
labels?: Partial<ResetPasswordLabels>;
|
|
23
26
|
logo?: ReactNode;
|
|
24
27
|
token: string;
|
|
25
28
|
resetPasswordAction: ResetPasswordAction;
|
|
@@ -30,6 +33,7 @@ export interface ResetPasswordPageConfig {
|
|
|
30
33
|
passwordPolicy?: PasswordPolicy;
|
|
31
34
|
}
|
|
32
35
|
export interface ResetPasswordFormProps {
|
|
36
|
+
labels?: Partial<ResetPasswordLabels>;
|
|
33
37
|
token: string;
|
|
34
38
|
resetPasswordAction: ResetPasswordAction;
|
|
35
39
|
onBackToLogin?: () => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import { type SetPasswordLabels } from '../labels';
|
|
1
2
|
import type { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
export declare function SetPasswordForm({ passwordChangeAction, passwordSetAction, isInvite, onSuccess, onBackToLogin, backToLoginHref, passwordPolicy, }: SetPasswordFormProps): ReactElement;
|
|
3
|
+
export declare function SetPasswordForm({ labels }?: Partial<SetPasswordLabels>, labels: any, passwordChangeAction: any, passwordSetAction: any, isInvite: boolean | undefined, onSuccess: any, onBackToLogin: any, backToLoginHref: any, passwordPolicy: {} | undefined, SetPasswordFormProps: any): ReactElement;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { SetPasswordPageConfig } from '../types';
|
|
3
|
-
export declare function SetPasswordPage({ logo, title, subtitle, inviteTitle, inviteSubtitle, token, isInvite, magicLinkVerifyAction, passwordChangeAction, passwordSetAction, onBackToLogin, onSuccess, backToLoginHref, showBackground, className, passwordPolicy, }: SetPasswordPageConfig): ReactElement;
|
|
3
|
+
export declare function SetPasswordPage({ logo, title, subtitle, labels, inviteTitle, inviteSubtitle, token, isInvite, magicLinkVerifyAction, passwordChangeAction, passwordSetAction, onBackToLogin, onSuccess, backToLoginHref, showBackground, className, passwordPolicy, }: SetPasswordPageConfig): ReactElement;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DEFAULT_SET_PASSWORD_LABELS } from '../labels';
|
|
3
|
+
'use client';
|
|
3
4
|
import { useGSAP } from '@gsap/react';
|
|
4
5
|
import gsap from 'gsap';
|
|
5
6
|
import { useEffect, useEffectEvent, useRef } from 'react';
|
|
@@ -10,7 +11,11 @@ import { setPasswordPageTheme } from '../theme';
|
|
|
10
11
|
import { SetPasswordForm } from './SetPasswordForm';
|
|
11
12
|
import { SetPasswordHeader } from './SetPasswordHeader';
|
|
12
13
|
gsap.registerPlugin(useGSAP);
|
|
13
|
-
export function SetPasswordPage({ logo, title = 'Set Password', subtitle = 'Enter your new password below.', inviteTitle = 'Set Your Password', inviteSubtitle = 'Welcome! Please set your password to complete your account setup.', token, isInvite = false, magicLinkVerifyAction, passwordChangeAction, passwordSetAction, onBackToLogin, onSuccess, backToLoginHref, showBackground = true, className, passwordPolicy }) {
|
|
14
|
+
export function SetPasswordPage({ logo, title = 'Set Password', subtitle = 'Enter your new password below.', labels, inviteTitle = 'Set Your Password', inviteSubtitle = 'Welcome! Please set your password to complete your account setup.', token, isInvite = false, magicLinkVerifyAction, passwordChangeAction, passwordSetAction, onBackToLogin, onSuccess, backToLoginHref, showBackground = true, className, passwordPolicy }) {
|
|
15
|
+
const say = {
|
|
16
|
+
...DEFAULT_SET_PASSWORD_LABELS,
|
|
17
|
+
...labels
|
|
18
|
+
};
|
|
14
19
|
const theme = setPasswordPageTheme;
|
|
15
20
|
const containerRef = useRef(null);
|
|
16
21
|
const cardRef = useRef(null);
|
|
@@ -87,7 +92,7 @@ export function SetPasswordPage({ logo, title = 'Set Password', subtitle = 'Ente
|
|
|
87
92
|
}),
|
|
88
93
|
/*#__PURE__*/ _jsx("h1", {
|
|
89
94
|
className: theme.states.verifying.title,
|
|
90
|
-
children:
|
|
95
|
+
children: say.verifying
|
|
91
96
|
}),
|
|
92
97
|
/*#__PURE__*/ _jsx("p", {
|
|
93
98
|
className: theme.states.verifying.subtitle,
|
|
@@ -133,7 +138,7 @@ export function SetPasswordPage({ logo, title = 'Set Password', subtitle = 'Ente
|
|
|
133
138
|
}),
|
|
134
139
|
/*#__PURE__*/ _jsx("h1", {
|
|
135
140
|
className: theme.states.error.title,
|
|
136
|
-
children:
|
|
141
|
+
children: say.invalidLink
|
|
137
142
|
}),
|
|
138
143
|
/*#__PURE__*/ _jsx("p", {
|
|
139
144
|
className: theme.states.error.subtitle,
|
|
@@ -164,7 +169,7 @@ export function SetPasswordPage({ logo, title = 'Set Password', subtitle = 'Ente
|
|
|
164
169
|
}),
|
|
165
170
|
/*#__PURE__*/ _jsx("p", {
|
|
166
171
|
className: theme.footer,
|
|
167
|
-
children:
|
|
172
|
+
children: say.needHelp
|
|
168
173
|
})
|
|
169
174
|
]
|
|
170
175
|
})
|
|
@@ -204,7 +209,7 @@ export function SetPasswordPage({ logo, title = 'Set Password', subtitle = 'Ente
|
|
|
204
209
|
}),
|
|
205
210
|
/*#__PURE__*/ _jsx("h1", {
|
|
206
211
|
className: theme.states.success.title,
|
|
207
|
-
children:
|
|
212
|
+
children: say.success
|
|
208
213
|
}),
|
|
209
214
|
/*#__PURE__*/ _jsx("p", {
|
|
210
215
|
className: theme.states.success.subtitle,
|
|
@@ -218,7 +223,7 @@ export function SetPasswordPage({ logo, title = 'Set Password', subtitle = 'Ente
|
|
|
218
223
|
}),
|
|
219
224
|
/*#__PURE__*/ _jsx("span", {
|
|
220
225
|
className: theme.states.success.redirectText,
|
|
221
|
-
children:
|
|
226
|
+
children: say.redirecting
|
|
222
227
|
})
|
|
223
228
|
]
|
|
224
229
|
})
|
|
@@ -232,7 +237,7 @@ export function SetPasswordPage({ logo, title = 'Set Password', subtitle = 'Ente
|
|
|
232
237
|
return /*#__PURE__*/ _jsxs("main", {
|
|
233
238
|
ref: containerRef,
|
|
234
239
|
className: cn(theme.container.base, className),
|
|
235
|
-
"aria-label":
|
|
240
|
+
"aria-label": say.pageLabel,
|
|
236
241
|
children: [
|
|
237
242
|
showBackground && /*#__PURE__*/ _jsx(AbstractAnimatedBackground, {}),
|
|
238
243
|
/*#__PURE__*/ _jsx("div", {
|
|
@@ -247,6 +252,7 @@ export function SetPasswordPage({ logo, title = 'Set Password', subtitle = 'Ente
|
|
|
247
252
|
subtitle: displaySubtitle
|
|
248
253
|
}),
|
|
249
254
|
/*#__PURE__*/ _jsx(SetPasswordForm, {
|
|
255
|
+
labels: labels,
|
|
250
256
|
passwordChangeAction: passwordChangeAction,
|
|
251
257
|
passwordSetAction: passwordSetAction,
|
|
252
258
|
isInvite: isInvite,
|
|
@@ -2,6 +2,7 @@ export { PasswordStrengthIndicator } from './components/PasswordStrengthIndicato
|
|
|
2
2
|
export { SetPasswordForm } from './components/SetPasswordForm';
|
|
3
3
|
export { SetPasswordHeader } from './components/SetPasswordHeader';
|
|
4
4
|
export { SetPasswordPage } from './components/SetPasswordPage';
|
|
5
|
+
export { DEFAULT_SET_PASSWORD_LABELS, type SetPasswordLabels } from './labels';
|
|
5
6
|
export { useSetPasswordStore } from './store';
|
|
6
7
|
export { extendSetPasswordPageTheme, type SetPasswordPageTheme, setPasswordPageTheme, } from './theme';
|
|
7
8
|
export type { MagicLinkVerifyAction, MagicLinkVerifyError, MagicLinkVerifyResponse, PasswordChangeAction, PasswordChangeError, PasswordChangeResponse, PasswordPolicy, PasswordSetAction, PasswordStrength, SetPasswordFormProps, SetPasswordHeaderProps, SetPasswordPageConfig, SetPasswordStep, } from './types';
|
|
@@ -2,6 +2,7 @@ export { PasswordStrengthIndicator } from './components/PasswordStrengthIndicato
|
|
|
2
2
|
export { SetPasswordForm } from './components/SetPasswordForm';
|
|
3
3
|
export { SetPasswordHeader } from './components/SetPasswordHeader';
|
|
4
4
|
export { SetPasswordPage } from './components/SetPasswordPage';
|
|
5
|
+
export { DEFAULT_SET_PASSWORD_LABELS } from './labels';
|
|
5
6
|
export { useSetPasswordStore } from './store';
|
|
6
7
|
export { extendSetPasswordPageTheme, setPasswordPageTheme } from './theme';
|
|
7
8
|
export { DEFAULT_PASSWORD_POLICY } from './types';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every word this page says, so a portal can say them in its own language.
|
|
3
|
+
*
|
|
4
|
+
* Two of them were already props — `inviteTitle` and `inviteSubtitle` — which
|
|
5
|
+
* is the tell: a Turkish intranet passed those, and the page underneath still
|
|
6
|
+
* said "Verifying Invitation", "Enter your new password" and "Need help?
|
|
7
|
+
* Contact your system administrator." This is the screen every employee meets
|
|
8
|
+
* once, when they activate the account somebody made for them, and it is the
|
|
9
|
+
* first thing the product says to them.
|
|
10
|
+
*
|
|
11
|
+
* Defaults stay English, so nothing that does not pass labels changes.
|
|
12
|
+
*/
|
|
13
|
+
export type SetPasswordLabels = {
|
|
14
|
+
verifying: string;
|
|
15
|
+
invalidLink: string;
|
|
16
|
+
needHelp: string;
|
|
17
|
+
success: string;
|
|
18
|
+
redirecting: string;
|
|
19
|
+
newPasswordPlaceholder: string;
|
|
20
|
+
confirmPasswordPlaceholder: string;
|
|
21
|
+
passwordStrength: string;
|
|
22
|
+
passwordRequirements: string;
|
|
23
|
+
pageLabel: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const DEFAULT_SET_PASSWORD_LABELS: SetPasswordLabels;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every word this page says, so a portal can say them in its own language.
|
|
3
|
+
*
|
|
4
|
+
* Two of them were already props — `inviteTitle` and `inviteSubtitle` — which
|
|
5
|
+
* is the tell: a Turkish intranet passed those, and the page underneath still
|
|
6
|
+
* said "Verifying Invitation", "Enter your new password" and "Need help?
|
|
7
|
+
* Contact your system administrator." This is the screen every employee meets
|
|
8
|
+
* once, when they activate the account somebody made for them, and it is the
|
|
9
|
+
* first thing the product says to them.
|
|
10
|
+
*
|
|
11
|
+
* Defaults stay English, so nothing that does not pass labels changes.
|
|
12
|
+
*/ export const DEFAULT_SET_PASSWORD_LABELS = {
|
|
13
|
+
verifying: 'Verifying Invitation',
|
|
14
|
+
invalidLink: 'Invalid Link',
|
|
15
|
+
needHelp: 'Need help? Contact your system administrator.',
|
|
16
|
+
success: 'Password Set Successfully!',
|
|
17
|
+
redirecting: 'Redirecting...',
|
|
18
|
+
newPasswordPlaceholder: 'Enter your new password',
|
|
19
|
+
confirmPasswordPlaceholder: 'Confirm your new password',
|
|
20
|
+
passwordStrength: 'Password strength',
|
|
21
|
+
passwordRequirements: 'Password requirements',
|
|
22
|
+
pageLabel: 'Set password page'
|
|
23
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import type { SetPasswordLabels } from '../labels';
|
|
2
3
|
export interface PasswordPolicy {
|
|
3
4
|
minLength?: number;
|
|
4
5
|
maxLength?: number;
|
|
@@ -100,6 +101,8 @@ export interface SetPasswordPageConfig {
|
|
|
100
101
|
subtitle?: string;
|
|
101
102
|
inviteTitle?: string;
|
|
102
103
|
inviteSubtitle?: string;
|
|
104
|
+
/** Every word the page says, so a portal can say them in its own language. */
|
|
105
|
+
labels?: Partial<SetPasswordLabels>;
|
|
103
106
|
logo?: ReactNode;
|
|
104
107
|
token: string;
|
|
105
108
|
isInvite?: boolean;
|
|
@@ -114,6 +117,7 @@ export interface SetPasswordPageConfig {
|
|
|
114
117
|
passwordPolicy?: PasswordPolicy;
|
|
115
118
|
}
|
|
116
119
|
export interface SetPasswordFormProps {
|
|
120
|
+
labels?: Partial<SetPasswordLabels>;
|
|
117
121
|
passwordChangeAction?: PasswordChangeAction;
|
|
118
122
|
passwordSetAction?: PasswordSetAction;
|
|
119
123
|
isInvite?: boolean;
|
package/dist/fe/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export { ComponentCanvas, ComponentSidebar, createDefaultRegistry, DesignSystemP
|
|
|
18
18
|
export type { DeviceCardProps, DeviceInfo, DevicesHeaderProps, DevicesPageConfig, DevicesPageProps, DevicesPageVariant, DevicesState, DevicesStatsProps, SessionRevokeAction, SessionRevokeAllAction, SessionsAction, } from './components/DevicesPage';
|
|
19
19
|
export { DeviceCard, DevicesHeader, DevicesPage, useDevicesStore, } from './components/DevicesPage';
|
|
20
20
|
export type { ForgotPasswordAction, ForgotPasswordFormProps, ForgotPasswordHeaderProps, ForgotPasswordPageConfig, ForgotPasswordStep, } from './components/ForgotPasswordPage';
|
|
21
|
-
export { ForgotPasswordPage, useForgotPasswordStore, } from './components/ForgotPasswordPage';
|
|
21
|
+
export { DEFAULT_FORGOT_PASSWORD_LABELS, ForgotPasswordPage, useForgotPasswordStore, } from './components/ForgotPasswordPage';
|
|
22
22
|
export type { FormBuilderProps, FormFieldConfig, FormFieldProps, FormFieldRenderProps, FormFooterRenderProps, FormLayout, FormMode, FormSize, FormState, UseFormBuilderOptions, UseFormBuilderReturn, } from './components/FormBuilder';
|
|
23
23
|
export { FormBuilder, FormField, formBuilderTheme, useFormBuilder, } from './components/FormBuilder';
|
|
24
24
|
export { defaultIntegrationsLabels, extendIntegrationsTheme, IntegrationsPage, integrationsPageTheme, resolveIntegrationsLabels, useIntegrationsStore, } from './components/IntegrationsPage';
|
|
@@ -40,11 +40,11 @@ export { RangePicker } from './components/RangePicker';
|
|
|
40
40
|
export type { PasswordStrength, RegisterAction, RegisterFormData, RegisterFormProps, RegisterHeaderProps, RegisterPageConfig, RegisterPageProps, RegisterPageVariant, RegisterState, } from './components/RegisterPage';
|
|
41
41
|
export { PasswordStrengthIndicator, RegisterPage, useRegisterStore, } from './components/RegisterPage';
|
|
42
42
|
export type { ResetPasswordAction, ResetPasswordFormProps, ResetPasswordHeaderProps, ResetPasswordPageConfig, ResetPasswordStep, } from './components/ResetPasswordPage';
|
|
43
|
-
export { ResetPasswordPage, useResetPasswordStore, } from './components/ResetPasswordPage';
|
|
43
|
+
export { DEFAULT_RESET_PASSWORD_LABELS, ResetPasswordPage, useResetPasswordStore, } from './components/ResetPasswordPage';
|
|
44
44
|
export { SearchBox } from './components/SearchBox';
|
|
45
45
|
export { SelectBox } from './components/SelectBox';
|
|
46
|
-
export type { MagicLinkVerifyAction, PasswordChangeAction, PasswordPolicy, PasswordSetAction, SetPasswordFormProps, SetPasswordHeaderProps, SetPasswordPageConfig, SetPasswordStep, } from './components/SetPasswordPage';
|
|
47
|
-
export { DEFAULT_PASSWORD_POLICY, SetPasswordPage, useSetPasswordStore, } from './components/SetPasswordPage';
|
|
46
|
+
export type { MagicLinkVerifyAction, PasswordChangeAction, PasswordPolicy, PasswordSetAction, SetPasswordFormProps, SetPasswordHeaderProps, SetPasswordLabels, SetPasswordPageConfig, SetPasswordStep, } from './components/SetPasswordPage';
|
|
47
|
+
export { DEFAULT_PASSWORD_POLICY, DEFAULT_SET_PASSWORD_LABELS, SetPasswordPage, useSetPasswordStore, } from './components/SetPasswordPage';
|
|
48
48
|
export type { TooltipPlacement, TooltipProps, TooltipSize, TooltipTheme, TooltipTrigger, TooltipVariant, } from './components/Tooltip';
|
|
49
49
|
export { Tooltip, tooltipTheme } from './components/Tooltip';
|
|
50
50
|
export type { UserDetailPanelProps, UserListItemProps, UsersPageProps, UserWithDetails, } from './components/UsersPage';
|
package/dist/fe/index.js
CHANGED
|
@@ -13,7 +13,7 @@ export { DataTable } from './components/DataTable';
|
|
|
13
13
|
export { DatePicker } from './components/DatePicker';
|
|
14
14
|
export { ComponentCanvas, ComponentSidebar, createDefaultRegistry, DesignSystemPage, designSystemTheme, extendDesignSystemTheme, PropsPanel, useDesignSystemStore } from './components/DesignSystem';
|
|
15
15
|
export { DeviceCard, DevicesHeader, DevicesPage, useDevicesStore } from './components/DevicesPage';
|
|
16
|
-
export { ForgotPasswordPage, useForgotPasswordStore } from './components/ForgotPasswordPage';
|
|
16
|
+
export { DEFAULT_FORGOT_PASSWORD_LABELS, ForgotPasswordPage, useForgotPasswordStore } from './components/ForgotPasswordPage';
|
|
17
17
|
export { FormBuilder, FormField, formBuilderTheme, useFormBuilder } from './components/FormBuilder';
|
|
18
18
|
export { defaultIntegrationsLabels, extendIntegrationsTheme, IntegrationsPage, integrationsPageTheme, resolveIntegrationsLabels, useIntegrationsStore } from './components/IntegrationsPage';
|
|
19
19
|
export { LoginPage, useLoginStore } from './components/LoginPage';
|
|
@@ -24,10 +24,10 @@ export { NucleusTextInput } from './components/NucleusTextInput';
|
|
|
24
24
|
export { AddressCard, PhoneCard, ProfileHeader, ProfilePage, useProfileStore } from './components/ProfilePage';
|
|
25
25
|
export { RangePicker } from './components/RangePicker';
|
|
26
26
|
export { PasswordStrengthIndicator, RegisterPage, useRegisterStore } from './components/RegisterPage';
|
|
27
|
-
export { ResetPasswordPage, useResetPasswordStore } from './components/ResetPasswordPage';
|
|
27
|
+
export { DEFAULT_RESET_PASSWORD_LABELS, ResetPasswordPage, useResetPasswordStore } from './components/ResetPasswordPage';
|
|
28
28
|
export { SearchBox } from './components/SearchBox';
|
|
29
29
|
export { SelectBox } from './components/SelectBox';
|
|
30
|
-
export { DEFAULT_PASSWORD_POLICY, SetPasswordPage, useSetPasswordStore } from './components/SetPasswordPage';
|
|
30
|
+
export { DEFAULT_PASSWORD_POLICY, DEFAULT_SET_PASSWORD_LABELS, SetPasswordPage, useSetPasswordStore } from './components/SetPasswordPage';
|
|
31
31
|
export { Tooltip, tooltipTheme } from './components/Tooltip';
|
|
32
32
|
export { UsersPage, useUsersStore } from './components/UsersPage';
|
|
33
33
|
export { extendVerificationFlowPageTheme, NodePalette, NotificationFlowNode, PendingTab, PropertiesPanel, StepFlowNode, useVerificationFlowStore, VerificationFlowPage, VerifierFlowNode, verificationFlowPageTheme } from './components/VerificationFlowPage';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nucleus-core-ts",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.882",
|
|
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",
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { NucleusTextInput } from '../../NucleusTextInput';
|
|
4
|
-
import { useSetPasswordStore } from '../store';
|
|
5
|
-
import { setPasswordPageTheme } from '../theme';
|
|
6
|
-
import { DEFAULT_PASSWORD_POLICY } from '../types';
|
|
7
|
-
export function SetPasswordForm({ passwordChangeAction, passwordSetAction, isInvite = false, onSuccess, onBackToLogin, backToLoginHref, passwordPolicy = {} }) {
|
|
8
|
-
const theme = setPasswordPageTheme;
|
|
9
|
-
const store = useSetPasswordStore();
|
|
10
|
-
const policy = {
|
|
11
|
-
...DEFAULT_PASSWORD_POLICY,
|
|
12
|
-
...passwordPolicy
|
|
13
|
-
};
|
|
14
|
-
const activeAction = isInvite && passwordSetAction ? passwordSetAction : passwordChangeAction;
|
|
15
|
-
const validateForm = ()=>{
|
|
16
|
-
if (!store.newPassword) {
|
|
17
|
-
return 'Password is required';
|
|
18
|
-
}
|
|
19
|
-
if (store.newPassword.length < policy.minLength) {
|
|
20
|
-
return `Password must be at least ${policy.minLength} characters`;
|
|
21
|
-
}
|
|
22
|
-
if (policy.maxLength && store.newPassword.length > policy.maxLength) {
|
|
23
|
-
return `Password must be at most ${policy.maxLength} characters`;
|
|
24
|
-
}
|
|
25
|
-
if (policy.requireUppercase && !/[A-Z]/.test(store.newPassword)) {
|
|
26
|
-
return 'Password must contain at least one uppercase letter';
|
|
27
|
-
}
|
|
28
|
-
if (policy.requireLowercase && !/[a-z]/.test(store.newPassword)) {
|
|
29
|
-
return 'Password must contain at least one lowercase letter';
|
|
30
|
-
}
|
|
31
|
-
if (policy.requireNumber && !/[0-9]/.test(store.newPassword)) {
|
|
32
|
-
return 'Password must contain at least one number';
|
|
33
|
-
}
|
|
34
|
-
if (policy.requireSpecialChar) {
|
|
35
|
-
const specialCharsRegex = new RegExp(`[${policy.specialChars.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')}]`);
|
|
36
|
-
if (!specialCharsRegex.test(store.newPassword)) {
|
|
37
|
-
return 'Password must contain at least one special character';
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (!store.confirmPassword) {
|
|
41
|
-
return 'Please confirm your password';
|
|
42
|
-
}
|
|
43
|
-
if (store.newPassword !== store.confirmPassword) {
|
|
44
|
-
return 'Passwords do not match';
|
|
45
|
-
}
|
|
46
|
-
return null;
|
|
47
|
-
};
|
|
48
|
-
const handleSubmit = (e)=>{
|
|
49
|
-
e.preventDefault();
|
|
50
|
-
const validationError = validateForm();
|
|
51
|
-
if (validationError) {
|
|
52
|
-
store.setError(validationError);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
store.setError(null);
|
|
56
|
-
if (!activeAction) {
|
|
57
|
-
store.setError('No action configured');
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const onAfterHandle = ()=>{
|
|
61
|
-
store.setStep('success');
|
|
62
|
-
if (onSuccess) {
|
|
63
|
-
setTimeout(onSuccess, 2000);
|
|
64
|
-
} else if (onBackToLogin) {
|
|
65
|
-
setTimeout(onBackToLogin, 2000);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
const onErrorHandle = (error)=>{
|
|
69
|
-
store.setError(error?.message || 'Failed to set password');
|
|
70
|
-
};
|
|
71
|
-
if (isInvite && passwordSetAction && store.userId) {
|
|
72
|
-
passwordSetAction.start({
|
|
73
|
-
payload: {
|
|
74
|
-
newPassword: store.newPassword,
|
|
75
|
-
userId: store.userId
|
|
76
|
-
},
|
|
77
|
-
onAfterHandle,
|
|
78
|
-
onErrorHandle
|
|
79
|
-
});
|
|
80
|
-
} else if (passwordChangeAction) {
|
|
81
|
-
passwordChangeAction.start({
|
|
82
|
-
payload: {
|
|
83
|
-
currentPassword: '',
|
|
84
|
-
newPassword: store.newPassword,
|
|
85
|
-
confirmPassword: store.confirmPassword
|
|
86
|
-
},
|
|
87
|
-
onAfterHandle,
|
|
88
|
-
onErrorHandle
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
return /*#__PURE__*/ _jsxs("form", {
|
|
93
|
-
onSubmit: handleSubmit,
|
|
94
|
-
className: theme.form.wrapper,
|
|
95
|
-
children: [
|
|
96
|
-
store.error && /*#__PURE__*/ _jsx("div", {
|
|
97
|
-
className: theme.alert.error,
|
|
98
|
-
role: "alert",
|
|
99
|
-
children: store.error
|
|
100
|
-
}),
|
|
101
|
-
/*#__PURE__*/ _jsx(NucleusTextInput, {
|
|
102
|
-
type: "password",
|
|
103
|
-
label: "New Password",
|
|
104
|
-
value: store.newPassword,
|
|
105
|
-
onChange: (val)=>store.setNewPassword(val, policy.minLength),
|
|
106
|
-
placeholder: "Enter your new password",
|
|
107
|
-
isNewPassword: true,
|
|
108
|
-
showPasswordStrength: policy.showStrengthIndicator,
|
|
109
|
-
maxInputLength: policy.maxLength,
|
|
110
|
-
enableValidation: false
|
|
111
|
-
}),
|
|
112
|
-
/*#__PURE__*/ _jsx(NucleusTextInput, {
|
|
113
|
-
type: "password",
|
|
114
|
-
label: "Confirm Password",
|
|
115
|
-
value: store.confirmPassword,
|
|
116
|
-
onChange: store.setConfirmPassword,
|
|
117
|
-
placeholder: "Confirm your new password",
|
|
118
|
-
isNewPassword: true,
|
|
119
|
-
confirmValue: store.newPassword,
|
|
120
|
-
enableValidation: false
|
|
121
|
-
}),
|
|
122
|
-
/*#__PURE__*/ _jsx("button", {
|
|
123
|
-
type: "submit",
|
|
124
|
-
disabled: activeAction?.state.isPending,
|
|
125
|
-
className: theme.form.submitButton,
|
|
126
|
-
children: activeAction?.state.isPending ? 'Setting Password...' : 'Set Password'
|
|
127
|
-
}),
|
|
128
|
-
/*#__PURE__*/ _jsx("div", {
|
|
129
|
-
className: theme.form.backLink,
|
|
130
|
-
children: backToLoginHref ? /*#__PURE__*/ _jsx("a", {
|
|
131
|
-
href: backToLoginHref,
|
|
132
|
-
className: theme.form.backLinkText,
|
|
133
|
-
children: "Back to login"
|
|
134
|
-
}) : onBackToLogin ? /*#__PURE__*/ _jsx("button", {
|
|
135
|
-
type: "button",
|
|
136
|
-
onClick: onBackToLogin,
|
|
137
|
-
className: theme.form.backLinkText,
|
|
138
|
-
children: "Back to login"
|
|
139
|
-
}) : null
|
|
140
|
-
})
|
|
141
|
-
]
|
|
142
|
-
});
|
|
143
|
-
}
|