nucleus-core-ts 0.9.880 → 0.9.881

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.880
1
+ 0.9.881
@@ -1,3 +1,3 @@
1
+ import { type SetPasswordLabels } from '../labels';
1
2
  import type { ReactElement } from 'react';
2
- import { type SetPasswordFormProps } from '../types';
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: "Verifying Invitation"
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: "Invalid Link"
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: "Need help? Contact your system administrator."
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: "Password Set Successfully!"
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: "Redirecting..."
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": "Set password page",
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;
@@ -43,8 +43,8 @@ export type { ResetPasswordAction, ResetPasswordFormProps, ResetPasswordHeaderPr
43
43
  export { 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
@@ -27,7 +27,7 @@ export { PasswordStrengthIndicator, RegisterPage, useRegisterStore } from './com
27
27
  export { 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.880",
3
+ "version": "0.9.881",
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
- }