nucleus-core-ts 0.9.879 → 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.
Files changed (25) hide show
  1. package/dist/.build-ok +1 -1
  2. package/dist/fe/components/ChatPanel/components/ChatPanel.js +9 -1
  3. package/dist/fe/components/ChatPanel/components/ConversationList.d.ts +3 -1
  4. package/dist/fe/components/ChatPanel/components/ConversationList.js +9 -4
  5. package/dist/fe/components/ChatPanel/components/MessageComposer.d.ts +3 -1
  6. package/dist/fe/components/ChatPanel/components/MessageComposer.js +11 -6
  7. package/dist/fe/components/ChatPanel/components/MessageThread.d.ts +3 -1
  8. package/dist/fe/components/ChatPanel/components/MessageThread.js +10 -5
  9. package/dist/fe/components/ChatPanel/index.d.ts +1 -0
  10. package/dist/fe/components/ChatPanel/index.js +1 -0
  11. package/dist/fe/components/ChatPanel/labels.d.ts +32 -0
  12. package/dist/fe/components/ChatPanel/labels.js +24 -0
  13. package/dist/fe/components/ChatPanel/types/index.d.ts +3 -0
  14. package/dist/fe/components/SetPasswordPage/components/SetPasswordForm.d.ts +2 -2
  15. package/dist/fe/components/SetPasswordPage/components/SetPasswordPage.d.ts +1 -1
  16. package/dist/fe/components/SetPasswordPage/components/SetPasswordPage.js +14 -8
  17. package/dist/fe/components/SetPasswordPage/index.d.ts +1 -0
  18. package/dist/fe/components/SetPasswordPage/index.js +1 -0
  19. package/dist/fe/components/SetPasswordPage/labels.d.ts +25 -0
  20. package/dist/fe/components/SetPasswordPage/labels.js +23 -0
  21. package/dist/fe/components/SetPasswordPage/types/index.d.ts +4 -0
  22. package/dist/fe/index.d.ts +4 -4
  23. package/dist/fe/index.js +2 -2
  24. package/package.json +1 -1
  25. package/dist/fe/components/SetPasswordPage/components/SetPasswordForm.js +0 -143
package/dist/.build-ok CHANGED
@@ -1 +1 @@
1
- 0.9.879
1
+ 0.9.881
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from 'react';
4
4
  import { cn } from '../../../utils/cn';
5
5
  import { useChat } from '../hooks/useChat';
6
+ import { DEFAULT_CHAT_LABELS } from '../labels';
6
7
  import { chatPanelTheme } from '../theme';
7
8
  import { ConversationList } from './ConversationList';
8
9
  import { MessageComposer } from './MessageComposer';
@@ -10,6 +11,10 @@ import { MessageThread } from './MessageThread';
10
11
  import { NewConversationModal } from './NewConversationModal';
11
12
  export function ChatPanel(props) {
12
13
  const theme = chatPanelTheme;
14
+ const say = {
15
+ ...DEFAULT_CHAT_LABELS,
16
+ ...props.labels
17
+ };
13
18
  const chat = useChat(props);
14
19
  const { store } = chat;
15
20
  const [pickerOpen, setPickerOpen] = useState(false);
@@ -66,7 +71,7 @@ export function ChatPanel(props) {
66
71
  type: "button",
67
72
  className: theme.sidebar.newButton,
68
73
  onClick: handleNewConversation,
69
- "aria-label": "New conversation",
74
+ "aria-label": say.newConversation,
70
75
  children: /*#__PURE__*/ _jsxs("svg", {
71
76
  className: "h-4 w-4",
72
77
  fill: "none",
@@ -88,6 +93,7 @@ export function ChatPanel(props) {
88
93
  ]
89
94
  }),
90
95
  /*#__PURE__*/ _jsx(ConversationList, {
96
+ labels: props.labels,
91
97
  conversations: store.conversations,
92
98
  activeId: store.activeConversationId,
93
99
  currentUserId: props.currentUserId,
@@ -103,6 +109,7 @@ export function ChatPanel(props) {
103
109
  className: "flex min-h-0 flex-1 flex-col",
104
110
  children: [
105
111
  /*#__PURE__*/ _jsx(MessageThread, {
112
+ labels: props.labels,
106
113
  conversation: active,
107
114
  messages: store.messages,
108
115
  currentUserId: props.currentUserId,
@@ -127,6 +134,7 @@ export function ChatPanel(props) {
127
134
  onStartDirect: handleStartDirect
128
135
  }),
129
136
  active && /*#__PURE__*/ _jsx(MessageComposer, {
137
+ labels: props.labels,
130
138
  theme: theme,
131
139
  value: store.composerText,
132
140
  disabled: store.isSending,
@@ -1,7 +1,9 @@
1
+ import { type ChatPanelLabels } from '../labels';
1
2
  import type { ReactElement } from 'react';
2
3
  import type { ChatPanelTheme } from '../theme';
3
4
  import type { ChatConversationDTO } from '../types';
4
5
  type ConversationListProps = {
6
+ labels?: Partial<ChatPanelLabels>;
5
7
  conversations: ChatConversationDTO[];
6
8
  activeId: string | null;
7
9
  currentUserId: string;
@@ -11,5 +13,5 @@ type ConversationListProps = {
11
13
  resolveUserName?: (userId: string) => string | undefined;
12
14
  resolveUserAvatar?: (userId: string) => string | undefined;
13
15
  };
14
- export declare function ConversationList({ conversations, activeId, currentUserId, isLoading, theme, onSelect, resolveUserName, resolveUserAvatar, }: ConversationListProps): ReactElement;
16
+ export declare function ConversationList({ conversations, activeId, currentUserId, isLoading, theme, onSelect, resolveUserName, resolveUserAvatar, labels, }: ConversationListProps): ReactElement;
15
17
  export {};
@@ -1,18 +1,23 @@
1
- 'use client';
2
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DEFAULT_CHAT_LABELS } from '../labels';
3
+ 'use client';
3
4
  import { cn } from '../../../utils/cn';
4
5
  import { conversationTitle, formatRelativeTime, initialsOf, otherParticipantId } from '../helpers';
5
- export function ConversationList({ conversations, activeId, currentUserId, isLoading, theme, onSelect, resolveUserName, resolveUserAvatar }) {
6
+ export function ConversationList({ conversations, activeId, currentUserId, isLoading, theme, onSelect, resolveUserName, resolveUserAvatar, labels }) {
7
+ const say = {
8
+ ...DEFAULT_CHAT_LABELS,
9
+ ...labels
10
+ };
6
11
  if (isLoading && conversations.length === 0) {
7
12
  return /*#__PURE__*/ _jsx("div", {
8
13
  className: theme.sidebar.empty,
9
- children: "Loading conversations..."
14
+ children: say.loadingConversations
10
15
  });
11
16
  }
12
17
  if (conversations.length === 0) {
13
18
  return /*#__PURE__*/ _jsx("div", {
14
19
  className: theme.sidebar.empty,
15
- children: "No conversations yet"
20
+ children: say.noConversations
16
21
  });
17
22
  }
18
23
  return /*#__PURE__*/ _jsx("div", {
@@ -1,6 +1,8 @@
1
+ import { type ChatPanelLabels } from '../labels';
1
2
  import type { ReactElement } from 'react';
2
3
  import type { ChatPanelTheme } from '../theme';
3
4
  type MessageComposerProps = {
5
+ labels?: Partial<ChatPanelLabels>;
4
6
  theme: ChatPanelTheme;
5
7
  value: string;
6
8
  disabled: boolean;
@@ -9,5 +11,5 @@ type MessageComposerProps = {
9
11
  onSendText: () => void;
10
12
  onSendFiles: (files: File[], text: string) => void;
11
13
  };
12
- export declare function MessageComposer({ theme, value, disabled, uploadEnabled, onChange, onSendText, onSendFiles, }: MessageComposerProps): ReactElement;
14
+ export declare function MessageComposer({ theme, value, disabled, uploadEnabled, onChange, onSendText, onSendFiles, labels, }: MessageComposerProps): ReactElement;
13
15
  export {};
@@ -1,7 +1,12 @@
1
- 'use client';
2
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { DEFAULT_CHAT_LABELS } from '../labels';
3
+ 'use client';
3
4
  import { useRef, useState } from 'react';
4
- export function MessageComposer({ theme, value, disabled, uploadEnabled, onChange, onSendText, onSendFiles }) {
5
+ export function MessageComposer({ theme, value, disabled, uploadEnabled, onChange, onSendText, onSendFiles, labels }) {
6
+ const say = {
7
+ ...DEFAULT_CHAT_LABELS,
8
+ ...labels
9
+ };
5
10
  const fileInputRef = useRef(null);
6
11
  const [pendingFiles, setPendingFiles] = useState([]);
7
12
  const submit = ()=>{
@@ -41,7 +46,7 @@ export function MessageComposer({ theme, value, disabled, uploadEnabled, onChang
41
46
  /*#__PURE__*/ _jsx("button", {
42
47
  type: "button",
43
48
  onClick: ()=>removeFile(index),
44
- "aria-label": "Remove file",
49
+ "aria-label": say.removeFile,
45
50
  children: "×"
46
51
  })
47
52
  ]
@@ -56,7 +61,7 @@ export function MessageComposer({ theme, value, disabled, uploadEnabled, onChang
56
61
  type: "button",
57
62
  className: theme.composer.attachButton,
58
63
  onClick: ()=>fileInputRef.current?.click(),
59
- "aria-label": "Attach files",
64
+ "aria-label": say.attachFiles,
60
65
  children: /*#__PURE__*/ _jsxs("svg", {
61
66
  className: "h-5 w-5",
62
67
  fill: "none",
@@ -64,7 +69,7 @@ export function MessageComposer({ theme, value, disabled, uploadEnabled, onChang
64
69
  stroke: "currentColor",
65
70
  children: [
66
71
  /*#__PURE__*/ _jsx("title", {
67
- children: "Attach"
72
+ children: say.attach
68
73
  }),
69
74
  /*#__PURE__*/ _jsx("path", {
70
75
  strokeLinecap: "round",
@@ -86,7 +91,7 @@ export function MessageComposer({ theme, value, disabled, uploadEnabled, onChang
86
91
  }),
87
92
  /*#__PURE__*/ _jsx("textarea", {
88
93
  className: theme.composer.input,
89
- placeholder: "Write a message...",
94
+ placeholder: say.writeMessage,
90
95
  rows: 1,
91
96
  value: value,
92
97
  disabled: disabled,
@@ -1,7 +1,9 @@
1
+ import { type ChatPanelLabels } from '../labels';
1
2
  import type { ReactElement } from 'react';
2
3
  import type { ChatPanelTheme } from '../theme';
3
4
  import type { ChatConversationDTO, ChatMessageDTO, TypingIndicator } from '../types';
4
5
  type MessageThreadProps = {
6
+ labels?: Partial<ChatPanelLabels>;
5
7
  conversation: ChatConversationDTO | null;
6
8
  messages: ChatMessageDTO[];
7
9
  currentUserId: string;
@@ -12,5 +14,5 @@ type MessageThreadProps = {
12
14
  onLoadOlder: () => void;
13
15
  resolveUserName?: (userId: string) => string | undefined;
14
16
  };
15
- export declare function MessageThread({ conversation, messages, currentUserId, typing, hasMore, isLoading, theme, onLoadOlder, resolveUserName, }: MessageThreadProps): ReactElement;
17
+ export declare function MessageThread({ conversation, messages, currentUserId, typing, hasMore, isLoading, theme, onLoadOlder, resolveUserName, labels, }: MessageThreadProps): ReactElement;
16
18
  export {};
@@ -1,5 +1,6 @@
1
- 'use client';
2
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { DEFAULT_CHAT_LABELS } from '../labels';
3
+ 'use client';
3
4
  import { useEffect, useRef } from 'react';
4
5
  import { cn } from '../../../utils/cn';
5
6
  import { conversationTitle, formatClockTime } from '../helpers';
@@ -20,7 +21,11 @@ function Attachments({ message, theme }) {
20
21
  }, attachment.id))
21
22
  });
22
23
  }
23
- export function MessageThread({ conversation, messages, currentUserId, typing, hasMore, isLoading, theme, onLoadOlder, resolveUserName }) {
24
+ export function MessageThread({ conversation, messages, currentUserId, typing, hasMore, isLoading, theme, onLoadOlder, resolveUserName, labels }) {
25
+ const say = {
26
+ ...DEFAULT_CHAT_LABELS,
27
+ ...labels
28
+ };
24
29
  const scrollRef = useRef(null);
25
30
  useEffect(()=>{
26
31
  const el = scrollRef.current;
@@ -32,7 +37,7 @@ export function MessageThread({ conversation, messages, currentUserId, typing, h
32
37
  if (!conversation) {
33
38
  return /*#__PURE__*/ _jsx("div", {
34
39
  className: theme.thread.placeholder,
35
- children: "Select a conversation to start chatting"
40
+ children: say.selectConversation
36
41
  });
37
42
  }
38
43
  const title = conversationTitle(conversation, currentUserId, resolveUserName);
@@ -75,7 +80,7 @@ export function MessageThread({ conversation, messages, currentUserId, typing, h
75
80
  }),
76
81
  messages.length === 0 && !isLoading ? /*#__PURE__*/ _jsx("div", {
77
82
  className: theme.thread.empty,
78
- children: "No messages yet — say hello"
83
+ children: say.noMessages
79
84
  }) : messages.map((message)=>{
80
85
  const own = message.senderId === currentUserId;
81
86
  return /*#__PURE__*/ _jsx("div", {
@@ -89,7 +94,7 @@ export function MessageThread({ conversation, messages, currentUserId, typing, h
89
94
  }),
90
95
  message.deletedAt ? /*#__PURE__*/ _jsx("span", {
91
96
  className: theme.message.deleted,
92
- children: "This message was deleted"
97
+ children: say.deletedMessage
93
98
  }) : /*#__PURE__*/ _jsxs(_Fragment, {
94
99
  children: [
95
100
  message.content && /*#__PURE__*/ _jsx("span", {
@@ -4,6 +4,7 @@ export { MessageComposer } from './components/MessageComposer';
4
4
  export { MessageThread } from './components/MessageThread';
5
5
  export { NewConversationModal } from './components/NewConversationModal';
6
6
  export { type UseChatReturn, useChat } from './hooks/useChat';
7
+ export { type ChatPanelLabels, DEFAULT_CHAT_LABELS } from './labels';
7
8
  export { useChatStore } from './store';
8
9
  export { type ChatPanelTheme, chatPanelTheme, extendChatPanelTheme } from './theme';
9
10
  export type { ChatAttachmentDTO, ChatConversationDTO, ChatDirectoryUser, ChatMessageDTO, ChatPanelActions, ChatPanelProps, ChatPanelState, ChatParticipantDTO, TypingIndicator, } from './types';
@@ -4,5 +4,6 @@ export { MessageComposer } from './components/MessageComposer';
4
4
  export { MessageThread } from './components/MessageThread';
5
5
  export { NewConversationModal } from './components/NewConversationModal';
6
6
  export { useChat } from './hooks/useChat';
7
+ export { DEFAULT_CHAT_LABELS } from './labels';
7
8
  export { useChatStore } from './store';
8
9
  export { chatPanelTheme, extendChatPanelTheme } from './theme';
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Every word the chat says, so a portal can say them in its own language.
3
+ *
4
+ * The panel wrote them in English inside the components, and the one label the
5
+ * consumer COULD pass — `title` — was the tell: an intranet in Turkish set the
6
+ * heading to "Sohbetler" and the panel underneath it still said "No
7
+ * conversations yet" and "Select a conversation to start chatting". Two
8
+ * sentences of English on the one screen in the product where people talk to
9
+ * each other.
10
+ *
11
+ * Defaults stay English, so nothing that does not pass labels changes.
12
+ */
13
+ export type ChatPanelLabels = {
14
+ /** While the conversation list is still arriving. */
15
+ loadingConversations: string;
16
+ /** The list, with nothing in it. */
17
+ noConversations: string;
18
+ /** No conversation chosen yet. */
19
+ selectConversation: string;
20
+ /** A conversation with no messages in it. */
21
+ noMessages: string;
22
+ /** A message somebody removed. */
23
+ deletedMessage: string;
24
+ /** The composer's own placeholder. */
25
+ writeMessage: string;
26
+ attach: string;
27
+ attachFiles: string;
28
+ removeFile: string;
29
+ newConversation: string;
30
+ close: string;
31
+ };
32
+ export declare const DEFAULT_CHAT_LABELS: ChatPanelLabels;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Every word the chat says, so a portal can say them in its own language.
3
+ *
4
+ * The panel wrote them in English inside the components, and the one label the
5
+ * consumer COULD pass — `title` — was the tell: an intranet in Turkish set the
6
+ * heading to "Sohbetler" and the panel underneath it still said "No
7
+ * conversations yet" and "Select a conversation to start chatting". Two
8
+ * sentences of English on the one screen in the product where people talk to
9
+ * each other.
10
+ *
11
+ * Defaults stay English, so nothing that does not pass labels changes.
12
+ */ export const DEFAULT_CHAT_LABELS = {
13
+ loadingConversations: 'Loading conversations...',
14
+ noConversations: 'No conversations yet',
15
+ selectConversation: 'Select a conversation to start chatting',
16
+ noMessages: 'No messages yet — say hello',
17
+ deletedMessage: 'This message was deleted',
18
+ writeMessage: 'Write a message...',
19
+ attach: 'Attach',
20
+ attachFiles: 'Attach files',
21
+ removeFile: 'Remove file',
22
+ newConversation: 'New conversation',
23
+ close: 'Close'
24
+ };
@@ -1,4 +1,5 @@
1
1
  import type { ChatActionResponse, ChatConversationDTO, ChatConversationListResponse, ChatConversationResponse, ChatCreateConversationPayload, ChatMessageDTO, ChatMessageListResponse, ChatMessageResponse, ChatReadResponse, ChatSendMessagePayload } from '../../../../src/Client/ApiCaller/types';
2
+ import type { ChatPanelLabels } from '../labels';
2
3
  export type { ChatAttachmentDTO, ChatConversationDTO, ChatMessageDTO, ChatParticipantDTO, } from '../../../../src/Client/ApiCaller/types';
3
4
  /** Mirrors the useServerAction shape exposed by the generated API hook. */
4
5
  export type GenericAction<TPayload = unknown, TData = unknown, TError = unknown> = {
@@ -75,6 +76,8 @@ export type ChatPanelProps = {
75
76
  /** Enable the file-attachment composer button (requires backend CDN). */
76
77
  uploadEnabled?: boolean;
77
78
  title?: string;
79
+ /** Every word the panel says, so a portal can say them in its own language. */
80
+ labels?: Partial<ChatPanelLabels>;
78
81
  className?: string;
79
82
  /** Resolve a display name for a user id (sender labels, conversation titles). */
80
83
  resolveUserName?: (userId: string) => string | undefined;
@@ -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;
@@ -8,8 +8,8 @@ export type { CaptchaAction, CaptchaChallenge, CaptchaConfig, CaptchaDifficulty,
8
8
  export { Captcha, captchaTheme } from './components/Captcha';
9
9
  export type { ChangePasswordAction, ChangePasswordFormProps, ChangePasswordHeaderProps, ChangePasswordPageConfig, ChangePasswordStep, } from './components/ChangePasswordPage';
10
10
  export { ChangePasswordPage, useChangePasswordStore, } from './components/ChangePasswordPage';
11
- export type { ChatDirectoryUser, ChatPanelActions, ChatPanelProps, ChatPanelState, ChatPanelTheme, TypingIndicator as ChatTypingIndicator, UseChatReturn, } from './components/ChatPanel';
12
- export { ChatPanel, chatPanelTheme, extendChatPanelTheme, NewConversationModal, useChat, useChatStore, } from './components/ChatPanel';
11
+ export type { ChatDirectoryUser, ChatPanelActions, ChatPanelLabels, ChatPanelProps, ChatPanelState, ChatPanelTheme, TypingIndicator as ChatTypingIndicator, UseChatReturn, } from './components/ChatPanel';
12
+ export { ChatPanel, chatPanelTheme, DEFAULT_CHAT_LABELS, extendChatPanelTheme, NewConversationModal, useChat, useChatStore, } from './components/ChatPanel';
13
13
  export { Checkbox } from './components/Checkbox';
14
14
  export { DataTable } from './components/DataTable';
15
15
  export { DatePicker } from './components/DatePicker';
@@ -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
@@ -7,7 +7,7 @@ export { Button } from './components/Button';
7
7
  export { Captcha, captchaTheme } from './components/Captcha';
8
8
  export { ChangePasswordPage, useChangePasswordStore } from './components/ChangePasswordPage';
9
9
  // Chat
10
- export { ChatPanel, chatPanelTheme, extendChatPanelTheme, NewConversationModal, useChat, useChatStore } from './components/ChatPanel';
10
+ export { ChatPanel, chatPanelTheme, DEFAULT_CHAT_LABELS, extendChatPanelTheme, NewConversationModal, useChat, useChatStore } from './components/ChatPanel';
11
11
  export { Checkbox } from './components/Checkbox';
12
12
  export { DataTable } from './components/DataTable';
13
13
  export { DatePicker } from './components/DatePicker';
@@ -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.879",
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
- }