@arbidocs/blocks 0.4.5 → 0.4.7
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/README.md +46 -6
- package/dist/agents/index.cjs +163 -162
- package/dist/agents/index.js +6 -5
- package/dist/chat/ChatMessageContent.d.ts +16 -0
- package/dist/chat/ChatPage.d.ts +11 -8
- package/dist/chat/ChatThreads.d.ts +3 -1
- package/dist/chat/CitationMark.d.ts +18 -0
- package/dist/chat/chat-page-types.d.ts +75 -1
- package/dist/chat/index.cjs +126 -117
- package/dist/chat/index.d.ts +3 -1
- package/dist/chat/index.js +5 -4
- package/dist/{chunk-3MIQASHO.cjs → chunk-23XL6SVZ.cjs} +39 -19
- package/dist/chunk-23XL6SVZ.cjs.map +1 -0
- package/dist/{chunk-ULWRNGGE.cjs → chunk-2ZTONLT5.cjs} +4 -25
- package/dist/chunk-2ZTONLT5.cjs.map +1 -0
- package/dist/{chunk-O637DUKS.cjs → chunk-56BUD74K.cjs} +28 -28
- package/dist/{chunk-O637DUKS.cjs.map → chunk-56BUD74K.cjs.map} +1 -1
- package/dist/{chunk-YLOKCIQJ.cjs → chunk-5SLLMK5K.cjs} +421 -115
- package/dist/chunk-5SLLMK5K.cjs.map +1 -0
- package/dist/{chunk-SS23F63U.cjs → chunk-5ZBP7TCD.cjs} +55 -3
- package/dist/chunk-5ZBP7TCD.cjs.map +1 -0
- package/dist/{chunk-3PZPRAAR.cjs → chunk-67HGXV4I.cjs} +14 -14
- package/dist/{chunk-3PZPRAAR.cjs.map → chunk-67HGXV4I.cjs.map} +1 -1
- package/dist/{chunk-RCP6THBS.js → chunk-7OCFHEE6.js} +3 -3
- package/dist/{chunk-RCP6THBS.js.map → chunk-7OCFHEE6.js.map} +1 -1
- package/dist/{chunk-TX2ZICS7.js → chunk-CPMNAJLF.js} +4 -24
- package/dist/chunk-CPMNAJLF.js.map +1 -0
- package/dist/{chunk-5XTZFH65.js → chunk-CVFBSUXL.js} +5 -5
- package/dist/{chunk-5XTZFH65.js.map → chunk-CVFBSUXL.js.map} +1 -1
- package/dist/chunk-DCDVWPMB.cjs +29 -0
- package/dist/chunk-DCDVWPMB.cjs.map +1 -0
- package/dist/{chunk-TI4UTYRL.js → chunk-EY2RJW27.js} +258 -10
- package/dist/chunk-EY2RJW27.js.map +1 -0
- package/dist/{chunk-7YADKWZT.js → chunk-G2E3O3HI.js} +3 -3
- package/dist/{chunk-7YADKWZT.js.map → chunk-G2E3O3HI.js.map} +1 -1
- package/dist/{chunk-6YHWXMPQ.js → chunk-G2T3KTZ3.js} +419 -115
- package/dist/chunk-G2T3KTZ3.js.map +1 -0
- package/dist/{chunk-2NNTQLBY.js → chunk-IAKUTBPX.js} +4 -4
- package/dist/{chunk-2NNTQLBY.js.map → chunk-IAKUTBPX.js.map} +1 -1
- package/dist/{chunk-IZHWP6WQ.cjs → chunk-JG4TFS3Z.cjs} +6 -6
- package/dist/{chunk-IZHWP6WQ.cjs.map → chunk-JG4TFS3Z.cjs.map} +1 -1
- package/dist/chunk-JLOYWXRB.js +1156 -0
- package/dist/chunk-JLOYWXRB.js.map +1 -0
- package/dist/{chunk-WJZBJUPX.js → chunk-KXMDOTGW.js} +56 -4
- package/dist/chunk-KXMDOTGW.js.map +1 -0
- package/dist/{chunk-2VBJ763Y.js → chunk-KZJAG7T3.js} +37 -7
- package/dist/chunk-KZJAG7T3.js.map +1 -0
- package/dist/{chunk-RIL7G7AS.cjs → chunk-MGUHR3JI.cjs} +4 -4
- package/dist/{chunk-RIL7G7AS.cjs.map → chunk-MGUHR3JI.cjs.map} +1 -1
- package/dist/{chunk-NPKGUQU5.js → chunk-NJL4LIXX.js} +4 -4
- package/dist/{chunk-NPKGUQU5.js.map → chunk-NJL4LIXX.js.map} +1 -1
- package/dist/{chunk-DN3NFNIA.cjs → chunk-QMDLPO3M.cjs} +266 -10
- package/dist/chunk-QMDLPO3M.cjs.map +1 -0
- package/dist/chunk-TJMKFY5P.js +27 -0
- package/dist/chunk-TJMKFY5P.js.map +1 -0
- package/dist/{chunk-3PJCET7H.js → chunk-UHVNYKV2.js} +38 -18
- package/dist/chunk-UHVNYKV2.js.map +1 -0
- package/dist/{chunk-6CHMNKXC.cjs → chunk-UTYQPVIW.cjs} +11 -11
- package/dist/chunk-UTYQPVIW.cjs.map +1 -0
- package/dist/{chunk-KHX2BX3S.cjs → chunk-VGOFFCMT.cjs} +37 -5
- package/dist/chunk-VGOFFCMT.cjs.map +1 -0
- package/dist/{chunk-67MKU5U7.js → chunk-YMHGF6R5.js} +8 -8
- package/dist/chunk-YMHGF6R5.js.map +1 -0
- package/dist/chunk-YVIOCITQ.cjs +1186 -0
- package/dist/chunk-YVIOCITQ.cjs.map +1 -0
- package/dist/{chunk-MVNCQDDE.cjs → chunk-ZVPTFTGV.cjs} +4 -4
- package/dist/{chunk-MVNCQDDE.cjs.map → chunk-ZVPTFTGV.cjs.map} +1 -1
- package/dist/collaboration/index.cjs +38 -37
- package/dist/collaboration/index.js +3 -2
- package/dist/connect/index.cjs +358 -19
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +1 -0
- package/dist/connect/index.js +341 -9
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedSettings.d.ts +64 -0
- package/dist/facts/index.cjs +2 -2
- package/dist/facts/index.js +2 -2
- package/dist/files/index.cjs +15 -14
- package/dist/files/index.cjs.map +1 -1
- package/dist/files/index.js +5 -4
- package/dist/files/index.js.map +1 -1
- package/dist/home/index.cjs +19 -19
- package/dist/home/index.js +4 -4
- package/dist/index.cjs +526 -477
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/dist/lib/bottom-inset.d.ts +16 -0
- package/dist/lib/useElementSize.d.ts +13 -0
- package/dist/lib/useFillHeight.d.ts +10 -0
- package/dist/settings/account-views.d.ts +55 -0
- package/dist/settings/index.cjs +179 -1148
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.d.ts +1 -0
- package/dist/settings/index.js +10 -1073
- package/dist/settings/index.js.map +1 -1
- package/dist/shell/InstallPrompt.d.ts +28 -0
- package/dist/shell/MobileBars.d.ts +1 -1
- package/dist/shell/index.cjs +85 -45
- package/dist/shell/index.d.ts +4 -0
- package/dist/shell/index.js +3 -3
- package/dist/shell/install-instructions.d.ts +19 -0
- package/dist/shell/types.d.ts +6 -0
- package/dist/shell/use-install-prompt.d.ts +49 -0
- package/dist/site/index.cjs +62 -62
- package/dist/site/index.js +2 -2
- package/dist/studio/index.cjs +78 -77
- package/dist/studio/index.cjs.map +1 -1
- package/dist/studio/index.js +8 -7
- package/dist/studio/index.js.map +1 -1
- package/dist/theme/ThemeEditor.d.ts +4 -2
- package/dist/workspaces/index.cjs +4 -3
- package/dist/workspaces/index.cjs.map +1 -1
- package/dist/workspaces/index.js +3 -2
- package/dist/workspaces/index.js.map +1 -1
- package/package.json +8 -4
- package/src/blocks.css +30 -0
- package/dist/chunk-2VBJ763Y.js.map +0 -1
- package/dist/chunk-3MIQASHO.cjs.map +0 -1
- package/dist/chunk-3PJCET7H.js.map +0 -1
- package/dist/chunk-67MKU5U7.js.map +0 -1
- package/dist/chunk-6CHMNKXC.cjs.map +0 -1
- package/dist/chunk-6YHWXMPQ.js.map +0 -1
- package/dist/chunk-DN3NFNIA.cjs.map +0 -1
- package/dist/chunk-KHX2BX3S.cjs.map +0 -1
- package/dist/chunk-SS23F63U.cjs.map +0 -1
- package/dist/chunk-TI4UTYRL.js.map +0 -1
- package/dist/chunk-TX2ZICS7.js.map +0 -1
- package/dist/chunk-ULWRNGGE.cjs.map +0 -1
- package/dist/chunk-WJZBJUPX.js.map +0 -1
- package/dist/chunk-YLOKCIQJ.cjs.map +0 -1
|
@@ -0,0 +1,1186 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunkADOKTJHV_cjs = require('./chunk-ADOKTJHV.cjs');
|
|
5
|
+
var chunkKDG6FER6_cjs = require('./chunk-KDG6FER6.cjs');
|
|
6
|
+
var chunkDCDVWPMB_cjs = require('./chunk-DCDVWPMB.cjs');
|
|
7
|
+
var chunkMHVNT4J3_cjs = require('./chunk-MHVNT4J3.cjs');
|
|
8
|
+
var react = require('react');
|
|
9
|
+
var lucideReact = require('lucide-react');
|
|
10
|
+
var ui = require('@arbidocs/react/ui');
|
|
11
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
12
|
+
|
|
13
|
+
var DEFAULT_AVATAR_PICKER_LABELS = {
|
|
14
|
+
uploadingPicture: "Uploading picture",
|
|
15
|
+
changeProfilePicture: "Change profile picture",
|
|
16
|
+
change: "Change"
|
|
17
|
+
};
|
|
18
|
+
function AvatarPicker({
|
|
19
|
+
pictureUrl,
|
|
20
|
+
initials,
|
|
21
|
+
fallbackClassName,
|
|
22
|
+
isUploading,
|
|
23
|
+
disabled,
|
|
24
|
+
onFileChosen,
|
|
25
|
+
testId = "avatar-uploader-input",
|
|
26
|
+
labels
|
|
27
|
+
}) {
|
|
28
|
+
const l = react.useMemo(() => ({ ...DEFAULT_AVATAR_PICKER_LABELS, ...labels }), [labels]);
|
|
29
|
+
const fileInputRef = react.useRef(null);
|
|
30
|
+
const handleChange = (e) => {
|
|
31
|
+
const file = e.target.files?.[0];
|
|
32
|
+
e.target.value = "";
|
|
33
|
+
if (file) onFileChosen(file);
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "avatar-picker", className: "group/avatar relative shrink-0", children: [
|
|
36
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Avatar, { className: "h-20 w-20 ring-1 ring-border", children: [
|
|
37
|
+
pictureUrl && /* @__PURE__ */ jsxRuntime.jsx(ui.AvatarImage, { src: pictureUrl, alt: initials }),
|
|
38
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
39
|
+
ui.AvatarFallback,
|
|
40
|
+
{
|
|
41
|
+
className: ui.cn("text-2xl font-semibold leading-none text-white", fallbackClassName),
|
|
42
|
+
children: initials
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
+
"button",
|
|
48
|
+
{
|
|
49
|
+
type: "button",
|
|
50
|
+
onClick: () => fileInputRef.current?.click(),
|
|
51
|
+
disabled: disabled || isUploading,
|
|
52
|
+
className: ui.cn(
|
|
53
|
+
"absolute inset-0 flex items-center justify-center rounded-full",
|
|
54
|
+
"bg-foreground/70 text-background",
|
|
55
|
+
"opacity-0 focus-visible:opacity-100 group-hover/avatar:opacity-100",
|
|
56
|
+
// Touch has no hover: keep the change affordance visible (lighter scrim over the photo).
|
|
57
|
+
"pointer-coarse:opacity-100",
|
|
58
|
+
"transition-opacity duration-200",
|
|
59
|
+
"disabled:cursor-not-allowed disabled:opacity-100"
|
|
60
|
+
),
|
|
61
|
+
"aria-label": isUploading ? l.uploadingPicture : l.changeProfilePicture,
|
|
62
|
+
children: isUploading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-6 w-6 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-0.5", children: [
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Camera, { className: "h-5 w-5" }),
|
|
64
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium", children: l.change })
|
|
65
|
+
] })
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
+
"span",
|
|
70
|
+
{
|
|
71
|
+
"aria-hidden": "true",
|
|
72
|
+
className: "pointer-events-none absolute -bottom-1 -right-1 flex h-7 w-7 items-center justify-center rounded-full bg-background text-muted-foreground ring-1 ring-border",
|
|
73
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Camera, { className: "h-3.5 w-3.5" })
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
+
"input",
|
|
78
|
+
{
|
|
79
|
+
ref: fileInputRef,
|
|
80
|
+
type: "file",
|
|
81
|
+
accept: "image/png,image/jpeg,image/webp,image/gif",
|
|
82
|
+
onChange: handleChange,
|
|
83
|
+
hidden: true,
|
|
84
|
+
className: "hidden",
|
|
85
|
+
"data-testid": testId
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
] });
|
|
89
|
+
}
|
|
90
|
+
var DEFAULT_SETTINGS_DANGER_ZONE_LABELS = {
|
|
91
|
+
dangerZone: "Danger Zone"
|
|
92
|
+
};
|
|
93
|
+
function SettingsPanel({ className, testId, ...props }) {
|
|
94
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
"data-slot": "settings-panel",
|
|
98
|
+
"data-testid": testId,
|
|
99
|
+
className: ui.cn("mx-auto w-full max-w-xl space-y-6", className),
|
|
100
|
+
...props
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
function SettingsSection({
|
|
105
|
+
icon,
|
|
106
|
+
title,
|
|
107
|
+
description,
|
|
108
|
+
action,
|
|
109
|
+
testId,
|
|
110
|
+
className,
|
|
111
|
+
children,
|
|
112
|
+
...props
|
|
113
|
+
}) {
|
|
114
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
115
|
+
"section",
|
|
116
|
+
{
|
|
117
|
+
"data-slot": "settings-section",
|
|
118
|
+
"data-testid": testId,
|
|
119
|
+
className: ui.cn("space-y-3", className),
|
|
120
|
+
...props,
|
|
121
|
+
children: [
|
|
122
|
+
(title || action) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
123
|
+
title && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
124
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground [&_svg]:h-4 [&_svg]:w-4", children: icon }),
|
|
125
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-base font-semibold text-foreground", children: title })
|
|
126
|
+
] }),
|
|
127
|
+
action
|
|
128
|
+
] }),
|
|
129
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: description }),
|
|
130
|
+
children
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
function SettingsRow({
|
|
136
|
+
label,
|
|
137
|
+
labelFor,
|
|
138
|
+
description,
|
|
139
|
+
children,
|
|
140
|
+
testId,
|
|
141
|
+
className,
|
|
142
|
+
...props
|
|
143
|
+
}) {
|
|
144
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
145
|
+
"div",
|
|
146
|
+
{
|
|
147
|
+
"data-slot": "settings-row",
|
|
148
|
+
"data-testid": testId,
|
|
149
|
+
className: ui.cn(
|
|
150
|
+
"flex flex-col gap-2 py-2 @xl:flex-row @xl:items-center @xl:justify-between @xl:gap-6",
|
|
151
|
+
className
|
|
152
|
+
),
|
|
153
|
+
...props,
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
156
|
+
labelFor ? /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: labelFor, className: "text-sm font-medium text-foreground", children: label }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-foreground", children: label }),
|
|
157
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground", children: description })
|
|
158
|
+
] }),
|
|
159
|
+
children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 items-center gap-2", children })
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
function SettingsCard({ padding = "md", className, ...props }) {
|
|
165
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
166
|
+
"div",
|
|
167
|
+
{
|
|
168
|
+
"data-slot": "settings-card",
|
|
169
|
+
className: ui.cn(
|
|
170
|
+
"rounded-lg bg-muted",
|
|
171
|
+
padding === "md" ? "space-y-5 p-5" : "divide-y divide-border p-2",
|
|
172
|
+
className
|
|
173
|
+
),
|
|
174
|
+
...props
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
function SettingsActionRow({ title, description, onClick, testId }) {
|
|
179
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
180
|
+
"button",
|
|
181
|
+
{
|
|
182
|
+
type: "button",
|
|
183
|
+
onClick,
|
|
184
|
+
"data-slot": "settings-action-row",
|
|
185
|
+
"data-testid": testId,
|
|
186
|
+
className: "flex w-full items-center gap-3 rounded-md px-3 py-3 text-left transition-colors hover:bg-background/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11",
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-semibold text-foreground", children: title }),
|
|
190
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-0.5 text-xs leading-relaxed text-muted-foreground", children: description })
|
|
191
|
+
] }),
|
|
192
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4 shrink-0 text-muted-foreground" })
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
function SettingsDangerZone({
|
|
198
|
+
isOpen,
|
|
199
|
+
onToggle,
|
|
200
|
+
label,
|
|
201
|
+
title,
|
|
202
|
+
description,
|
|
203
|
+
action,
|
|
204
|
+
labels
|
|
205
|
+
}) {
|
|
206
|
+
const l = react.useMemo(() => ({ ...DEFAULT_SETTINGS_DANGER_ZONE_LABELS, ...labels }), [labels]);
|
|
207
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "settings-danger-zone", className: "mt-8 pt-2", children: [
|
|
208
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
209
|
+
"button",
|
|
210
|
+
{
|
|
211
|
+
type: "button",
|
|
212
|
+
onClick: onToggle,
|
|
213
|
+
"aria-expanded": isOpen,
|
|
214
|
+
className: "flex w-full items-center gap-1.5 text-left pointer-coarse:min-h-11",
|
|
215
|
+
children: [
|
|
216
|
+
isOpen ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
217
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-muted-foreground", children: label ?? l.dangerZone })
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
),
|
|
221
|
+
isOpen && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 flex items-center justify-between gap-4 rounded-lg bg-destructive/5 p-4", children: [
|
|
222
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
223
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium", children: title }),
|
|
224
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: description })
|
|
225
|
+
] }),
|
|
226
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: action })
|
|
227
|
+
] })
|
|
228
|
+
] });
|
|
229
|
+
}
|
|
230
|
+
var DEFAULT_PROFILE_CARD_LABELS = {
|
|
231
|
+
firstName: "First name",
|
|
232
|
+
lastName: "Last name",
|
|
233
|
+
save: "Save",
|
|
234
|
+
cancel: "Cancel",
|
|
235
|
+
sso: "SSO",
|
|
236
|
+
ssoTooltip: "Your email is managed by your sign-in provider. Change it there and it will sync here automatically on your next sign-in.",
|
|
237
|
+
change: "Change",
|
|
238
|
+
newEmailAddress: "New email address",
|
|
239
|
+
emailPlaceholder: "you@example.com",
|
|
240
|
+
codeWillBeSent: "We\u2019ll send a 3-word verification code to this address.",
|
|
241
|
+
sendCode: "Send code",
|
|
242
|
+
verify: (email) => `Verify ${email}`,
|
|
243
|
+
codePlaceholder: "WORD-WORD-WORD",
|
|
244
|
+
enterCodeHint: "Enter the 3-word code from the email we just sent.",
|
|
245
|
+
confirm: "Confirm",
|
|
246
|
+
resendIn: (seconds) => `Resend in ${seconds}s`,
|
|
247
|
+
resendCode: "Resend code"
|
|
248
|
+
};
|
|
249
|
+
function ProfileCard({
|
|
250
|
+
avatar,
|
|
251
|
+
name,
|
|
252
|
+
email,
|
|
253
|
+
isSso,
|
|
254
|
+
onStartEmailChange,
|
|
255
|
+
emailChange,
|
|
256
|
+
ssoTooltip,
|
|
257
|
+
labels
|
|
258
|
+
}) {
|
|
259
|
+
const l = react.useMemo(() => ({ ...DEFAULT_PROFILE_CARD_LABELS, ...labels }), [labels]);
|
|
260
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(SettingsCard, { children: [
|
|
261
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-5", children: [
|
|
262
|
+
avatar,
|
|
263
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 space-y-3", children: [
|
|
264
|
+
name.isEditing ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
265
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 @xl:flex-row", children: [
|
|
266
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
267
|
+
ui.Input,
|
|
268
|
+
{
|
|
269
|
+
value: name.givenName,
|
|
270
|
+
onChange: (e) => name.onGivenNameChange(e.target.value),
|
|
271
|
+
placeholder: l.firstName,
|
|
272
|
+
className: "flex-1",
|
|
273
|
+
autoFocus: true
|
|
274
|
+
}
|
|
275
|
+
),
|
|
276
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
277
|
+
ui.Input,
|
|
278
|
+
{
|
|
279
|
+
value: name.familyName,
|
|
280
|
+
onChange: (e) => name.onFamilyNameChange(e.target.value),
|
|
281
|
+
placeholder: l.lastName,
|
|
282
|
+
className: "flex-1"
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
] }),
|
|
286
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
287
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
288
|
+
ui.Button,
|
|
289
|
+
{
|
|
290
|
+
onClick: name.onSave,
|
|
291
|
+
size: "sm",
|
|
292
|
+
disabled: !name.givenName.trim() || name.isSaving,
|
|
293
|
+
children: [
|
|
294
|
+
name.isSaving ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-1 h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "mr-1 h-4 w-4" }),
|
|
295
|
+
l.save
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
),
|
|
299
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: name.onCancel, size: "sm", variant: "ghost", disabled: name.isSaving, children: l.cancel })
|
|
300
|
+
] })
|
|
301
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
302
|
+
"button",
|
|
303
|
+
{
|
|
304
|
+
type: "button",
|
|
305
|
+
onClick: name.onStartEdit,
|
|
306
|
+
className: "-mx-2 w-full rounded-md px-2 py-1 text-left transition-colors hover:bg-background/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11",
|
|
307
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
308
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate font-heading text-xl font-semibold text-foreground", children: name.display }),
|
|
309
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })
|
|
310
|
+
] })
|
|
311
|
+
}
|
|
312
|
+
),
|
|
313
|
+
!emailChange && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "-mx-2 flex min-w-0 items-center gap-2 px-2 py-1", children: [
|
|
314
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mail, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
315
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate text-sm text-muted-foreground", children: email }),
|
|
316
|
+
isSso ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Tooltip, { children: [
|
|
317
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
318
|
+
"span",
|
|
319
|
+
{
|
|
320
|
+
className: "ml-1 shrink-0 cursor-help rounded bg-background px-1.5 py-0.5 text-xs font-medium text-muted-foreground",
|
|
321
|
+
tabIndex: 0,
|
|
322
|
+
children: l.sso
|
|
323
|
+
}
|
|
324
|
+
) }),
|
|
325
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.TooltipContent, { className: "max-w-xs", children: ssoTooltip ?? l.ssoTooltip })
|
|
326
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
327
|
+
"button",
|
|
328
|
+
{
|
|
329
|
+
type: "button",
|
|
330
|
+
onClick: onStartEmailChange,
|
|
331
|
+
className: "ml-auto shrink-0 text-xs font-medium text-primary hover:underline pointer-coarse:min-h-11",
|
|
332
|
+
children: l.change
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
] })
|
|
336
|
+
] })
|
|
337
|
+
] }),
|
|
338
|
+
emailChange && !isSso && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-accordion-down overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3 rounded-lg bg-background p-4", children: emailChange.step === "enter" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
339
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs font-medium text-muted-foreground", children: [
|
|
340
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mail, { className: "h-3.5 w-3.5" }),
|
|
341
|
+
l.newEmailAddress
|
|
342
|
+
] }),
|
|
343
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
344
|
+
ui.Input,
|
|
345
|
+
{
|
|
346
|
+
type: "email",
|
|
347
|
+
value: emailChange.newEmail,
|
|
348
|
+
onChange: (e) => emailChange.onNewEmailChange(e.target.value),
|
|
349
|
+
placeholder: l.emailPlaceholder,
|
|
350
|
+
autoFocus: true
|
|
351
|
+
}
|
|
352
|
+
),
|
|
353
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: l.codeWillBeSent }),
|
|
354
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 pt-1", children: [
|
|
355
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
356
|
+
ui.Button,
|
|
357
|
+
{
|
|
358
|
+
onClick: emailChange.onSendCode,
|
|
359
|
+
size: "sm",
|
|
360
|
+
disabled: !emailChange.newEmail.trim() || emailChange.isSending,
|
|
361
|
+
children: [
|
|
362
|
+
emailChange.isSending ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-1 h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mail, { className: "mr-1 h-4 w-4" }),
|
|
363
|
+
l.sendCode
|
|
364
|
+
]
|
|
365
|
+
}
|
|
366
|
+
),
|
|
367
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
368
|
+
ui.Button,
|
|
369
|
+
{
|
|
370
|
+
onClick: emailChange.onCancel,
|
|
371
|
+
size: "sm",
|
|
372
|
+
variant: "ghost",
|
|
373
|
+
disabled: emailChange.isSending,
|
|
374
|
+
children: l.cancel
|
|
375
|
+
}
|
|
376
|
+
)
|
|
377
|
+
] })
|
|
378
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
379
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs font-medium text-muted-foreground", children: [
|
|
380
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mail, { className: "h-3.5 w-3.5" }),
|
|
381
|
+
l.verify(emailChange.newEmail)
|
|
382
|
+
] }),
|
|
383
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
384
|
+
ui.Input,
|
|
385
|
+
{
|
|
386
|
+
value: emailChange.code,
|
|
387
|
+
onChange: (e) => emailChange.onCodeChange(e.target.value.toUpperCase().replace(/\s+/g, "-")),
|
|
388
|
+
className: ui.cn("text-center font-mono tracking-wider"),
|
|
389
|
+
placeholder: l.codePlaceholder,
|
|
390
|
+
autoFocus: true
|
|
391
|
+
}
|
|
392
|
+
),
|
|
393
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: l.enterCodeHint }),
|
|
394
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2 pt-1", children: [
|
|
395
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
396
|
+
ui.Button,
|
|
397
|
+
{
|
|
398
|
+
onClick: emailChange.onConfirm,
|
|
399
|
+
size: "sm",
|
|
400
|
+
disabled: !emailChange.code.trim() || emailChange.isConfirming,
|
|
401
|
+
children: [
|
|
402
|
+
emailChange.isConfirming ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-1 h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "mr-1 h-4 w-4" }),
|
|
403
|
+
l.confirm
|
|
404
|
+
]
|
|
405
|
+
}
|
|
406
|
+
),
|
|
407
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
408
|
+
ui.Button,
|
|
409
|
+
{
|
|
410
|
+
onClick: () => {
|
|
411
|
+
if (emailChange.cooldownSeconds > 0) return;
|
|
412
|
+
emailChange.onSendCode();
|
|
413
|
+
},
|
|
414
|
+
size: "sm",
|
|
415
|
+
variant: "ghost",
|
|
416
|
+
disabled: emailChange.cooldownSeconds > 0 || emailChange.isSending,
|
|
417
|
+
children: emailChange.cooldownSeconds > 0 ? l.resendIn(emailChange.cooldownSeconds) : l.resendCode
|
|
418
|
+
}
|
|
419
|
+
),
|
|
420
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
421
|
+
ui.Button,
|
|
422
|
+
{
|
|
423
|
+
onClick: emailChange.onCancel,
|
|
424
|
+
size: "sm",
|
|
425
|
+
variant: "ghost",
|
|
426
|
+
disabled: emailChange.isConfirming,
|
|
427
|
+
children: l.cancel
|
|
428
|
+
}
|
|
429
|
+
)
|
|
430
|
+
] })
|
|
431
|
+
] }) }) })
|
|
432
|
+
] });
|
|
433
|
+
}
|
|
434
|
+
var DEFAULT_PASSWORD_CHANGE_DIALOG_LABELS = {
|
|
435
|
+
setNewPasswordTitle: "Set New Password",
|
|
436
|
+
changeMasterPasswordTitle: "Change Master Password",
|
|
437
|
+
recoveryDescription: "Set a new password for your recovered account",
|
|
438
|
+
changeDescription: "Change your master password dialog",
|
|
439
|
+
passwordChanged: "Password changed",
|
|
440
|
+
done: "Done",
|
|
441
|
+
recoverySuccessful: "Recovery successful. Set a new master password to continue.",
|
|
442
|
+
currentPassword: "Current Password",
|
|
443
|
+
currentPasswordPlaceholder: "Enter current password",
|
|
444
|
+
masterPassword: "Master Password",
|
|
445
|
+
newPassword: "New Password",
|
|
446
|
+
confirmPassword: "Confirm Password",
|
|
447
|
+
confirmNewPassword: "Confirm New Password",
|
|
448
|
+
workspacesRekeyed: (count) => `${chunkKDG6FER6_cjs.formatCount(count, { one: "workspace", other: "workspaces" })} will be re-keyed with your new password.`,
|
|
449
|
+
cancel: "Cancel",
|
|
450
|
+
settingPassword: "Setting Password...",
|
|
451
|
+
changingPassword: "Changing Password...",
|
|
452
|
+
continue: "Continue",
|
|
453
|
+
changePassword: "Change Password"
|
|
454
|
+
};
|
|
455
|
+
function PasswordChangeDialog({
|
|
456
|
+
open,
|
|
457
|
+
onClose,
|
|
458
|
+
recoveryMode,
|
|
459
|
+
currentPassword,
|
|
460
|
+
onCurrentPasswordChange,
|
|
461
|
+
newPassword,
|
|
462
|
+
onNewPasswordChange,
|
|
463
|
+
confirmPassword,
|
|
464
|
+
onConfirmPasswordChange,
|
|
465
|
+
getUnmetRequirement,
|
|
466
|
+
workspaceCount,
|
|
467
|
+
error,
|
|
468
|
+
isProcessing,
|
|
469
|
+
isSubmitDisabled,
|
|
470
|
+
onSubmit,
|
|
471
|
+
success,
|
|
472
|
+
onDone,
|
|
473
|
+
labels,
|
|
474
|
+
passwordInputLabels,
|
|
475
|
+
testId,
|
|
476
|
+
testIds,
|
|
477
|
+
passwordInputTestIds
|
|
478
|
+
}) {
|
|
479
|
+
const currentPasswordId = react.useId();
|
|
480
|
+
const l = react.useMemo(() => ({ ...DEFAULT_PASSWORD_CHANGE_DIALOG_LABELS, ...labels }), [labels]);
|
|
481
|
+
const handleSubmit = (e) => {
|
|
482
|
+
e.preventDefault();
|
|
483
|
+
onSubmit();
|
|
484
|
+
};
|
|
485
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open, onOpenChange: (next) => !next && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
486
|
+
ui.DialogContent,
|
|
487
|
+
{
|
|
488
|
+
presentation: "sheet",
|
|
489
|
+
className: "sm:max-w-md",
|
|
490
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "change-password-dialog" }),
|
|
491
|
+
children: [
|
|
492
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.DialogHeader, { children: [
|
|
493
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.DialogTitle, { children: recoveryMode ? l.setNewPasswordTitle : l.changeMasterPasswordTitle }),
|
|
494
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.DialogDescription, { className: "sr-only", children: recoveryMode ? l.recoveryDescription : l.changeDescription })
|
|
495
|
+
] }),
|
|
496
|
+
success ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
497
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-green-text", children: [
|
|
498
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5" }),
|
|
499
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: l.passwordChanged })
|
|
500
|
+
] }),
|
|
501
|
+
success,
|
|
502
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
503
|
+
ui.Button,
|
|
504
|
+
{
|
|
505
|
+
onClick: onDone,
|
|
506
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.done, { testId: "change-password-done-button" }),
|
|
507
|
+
children: l.done
|
|
508
|
+
}
|
|
509
|
+
) })
|
|
510
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className: "space-y-3", children: [
|
|
511
|
+
recoveryMode && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-green-text", children: l.recoverySuccessful }),
|
|
512
|
+
!recoveryMode && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
513
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: currentPasswordId, className: "text-sm font-medium text-foreground", children: [
|
|
514
|
+
l.currentPassword,
|
|
515
|
+
" ",
|
|
516
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-text", children: "*" })
|
|
517
|
+
] }),
|
|
518
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
519
|
+
ui.Input,
|
|
520
|
+
{
|
|
521
|
+
id: currentPasswordId,
|
|
522
|
+
type: "password",
|
|
523
|
+
value: currentPassword,
|
|
524
|
+
onChange: (e) => onCurrentPasswordChange(e.target.value),
|
|
525
|
+
disabled: isProcessing,
|
|
526
|
+
placeholder: l.currentPasswordPlaceholder,
|
|
527
|
+
autoComplete: "current-password",
|
|
528
|
+
className: "placeholder:text-muted-foreground",
|
|
529
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.currentInput, {
|
|
530
|
+
testId: "change-password-current-input"
|
|
531
|
+
})
|
|
532
|
+
}
|
|
533
|
+
)
|
|
534
|
+
] }),
|
|
535
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
536
|
+
chunkADOKTJHV_cjs.PasswordStrengthInput,
|
|
537
|
+
{
|
|
538
|
+
password: newPassword,
|
|
539
|
+
confirmPassword,
|
|
540
|
+
onPasswordChange: onNewPasswordChange,
|
|
541
|
+
onConfirmPasswordChange,
|
|
542
|
+
showConfirmation: true,
|
|
543
|
+
disabled: isProcessing,
|
|
544
|
+
passwordLabel: recoveryMode ? l.masterPassword : l.newPassword,
|
|
545
|
+
confirmLabel: recoveryMode ? l.confirmPassword : l.confirmNewPassword,
|
|
546
|
+
labels: passwordInputLabels,
|
|
547
|
+
testIds: passwordInputTestIds,
|
|
548
|
+
layout: recoveryMode ? "side-by-side" : "stacked",
|
|
549
|
+
showStrengthIndicator: true,
|
|
550
|
+
getUnmetRequirement
|
|
551
|
+
}
|
|
552
|
+
),
|
|
553
|
+
workspaceCount > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
554
|
+
"div",
|
|
555
|
+
{
|
|
556
|
+
className: "rounded-md bg-green-bg p-3",
|
|
557
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.workspaceCount, {
|
|
558
|
+
testId: "change-password-workspace-count"
|
|
559
|
+
}),
|
|
560
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
561
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5 flex-shrink-0 text-green-text" }),
|
|
562
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-green-text", children: l.workspacesRekeyed(workspaceCount) })
|
|
563
|
+
] })
|
|
564
|
+
}
|
|
565
|
+
),
|
|
566
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(
|
|
567
|
+
"div",
|
|
568
|
+
{
|
|
569
|
+
className: "rounded-md bg-red-bg p-3",
|
|
570
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.error, { testId: "change-password-error" }),
|
|
571
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
572
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-5 w-5 flex-shrink-0 text-red-text" }),
|
|
573
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-red-text", children: error })
|
|
574
|
+
] })
|
|
575
|
+
}
|
|
576
|
+
),
|
|
577
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col-reverse sm:flex-row sm:justify-end gap-3 pt-4", children: [
|
|
578
|
+
!recoveryMode && /* @__PURE__ */ jsxRuntime.jsx(
|
|
579
|
+
ui.Button,
|
|
580
|
+
{
|
|
581
|
+
type: "button",
|
|
582
|
+
variant: "outline",
|
|
583
|
+
onClick: onClose,
|
|
584
|
+
disabled: isProcessing,
|
|
585
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.cancel, {
|
|
586
|
+
testId: "change-password-cancel-button"
|
|
587
|
+
}),
|
|
588
|
+
children: l.cancel
|
|
589
|
+
}
|
|
590
|
+
),
|
|
591
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
592
|
+
ui.Button,
|
|
593
|
+
{
|
|
594
|
+
type: "submit",
|
|
595
|
+
disabled: isSubmitDisabled,
|
|
596
|
+
className: recoveryMode ? "w-full" : "",
|
|
597
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.submit, { testId: "change-password-submit-button" }),
|
|
598
|
+
children: isProcessing ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
599
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
600
|
+
recoveryMode ? l.settingPassword : l.changingPassword
|
|
601
|
+
] }) : recoveryMode ? l.continue : l.changePassword
|
|
602
|
+
}
|
|
603
|
+
)
|
|
604
|
+
] })
|
|
605
|
+
] })
|
|
606
|
+
]
|
|
607
|
+
}
|
|
608
|
+
) });
|
|
609
|
+
}
|
|
610
|
+
var DEFAULT_ACTIVE_SESSIONS_DIALOG_LABELS = {
|
|
611
|
+
title: "Active sessions",
|
|
612
|
+
description: "Devices and agents currently signed in to your account. Ending a session signs it out immediately.",
|
|
613
|
+
noSessions: "No active sessions.",
|
|
614
|
+
thisDevice: "This device",
|
|
615
|
+
agent: "Agent",
|
|
616
|
+
endSession: "End this session"
|
|
617
|
+
};
|
|
618
|
+
var DEFAULT_DELETE_ACCOUNT_DIALOG_LABELS = {
|
|
619
|
+
warningTitle: "Delete your account?",
|
|
620
|
+
warningBefore: "Once deleted, your account will be ",
|
|
621
|
+
warningEmphasis: "immediately closed and you will be logged out",
|
|
622
|
+
warningAfter: ". This action cannot be undone.",
|
|
623
|
+
blockersHeading: "You must resolve these first:",
|
|
624
|
+
cancel: "Cancel",
|
|
625
|
+
continue: "Continue",
|
|
626
|
+
confirmTitle: "Confirm account deletion",
|
|
627
|
+
confirmDescription: "Type your email address to confirm. Your account will be closed immediately and you will be logged out.",
|
|
628
|
+
yourEmail: "Your email",
|
|
629
|
+
back: "Back",
|
|
630
|
+
deleting: "Deleting...",
|
|
631
|
+
deleteAccount: "Delete Account"
|
|
632
|
+
};
|
|
633
|
+
function SessionListRow({
|
|
634
|
+
session,
|
|
635
|
+
onTerminate,
|
|
636
|
+
labels,
|
|
637
|
+
testIds
|
|
638
|
+
}) {
|
|
639
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
640
|
+
"div",
|
|
641
|
+
{
|
|
642
|
+
className: "flex w-full items-center gap-3 border-b border-border/60 px-4 py-3 last:border-b-0",
|
|
643
|
+
"data-testid": chunkMHVNT4J3_cjs.prefixedTestId(testIds?.sessionItem, session.id, {
|
|
644
|
+
testId: `session-item-${session.id}`
|
|
645
|
+
}),
|
|
646
|
+
children: [
|
|
647
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-muted", children: session.icon }),
|
|
648
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
649
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
650
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: session.name }),
|
|
651
|
+
session.isCurrent && /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { className: "border-transparent bg-accent px-1.5 py-0 text-xs text-accent-foreground shadow-none hover:bg-accent", children: labels.thisDevice }),
|
|
652
|
+
session.isAgent && /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { variant: "default", className: "px-1 py-0 text-xs", children: labels.agent })
|
|
653
|
+
] }),
|
|
654
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-0.5 truncate text-xs text-muted-foreground", children: session.detail })
|
|
655
|
+
] }),
|
|
656
|
+
!session.isCurrent && /* @__PURE__ */ jsxRuntime.jsxs(ui.Tooltip, { children: [
|
|
657
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
658
|
+
ui.Button,
|
|
659
|
+
{
|
|
660
|
+
type: "button",
|
|
661
|
+
variant: "ghost",
|
|
662
|
+
size: "icon",
|
|
663
|
+
className: "h-8 w-8 shrink-0 text-muted-foreground hover:text-destructive",
|
|
664
|
+
"aria-label": labels.endSession,
|
|
665
|
+
onClick: () => onTerminate(session.id),
|
|
666
|
+
disabled: session.isTerminating,
|
|
667
|
+
"data-testid": chunkMHVNT4J3_cjs.prefixedTestId(
|
|
668
|
+
testIds?.terminateSession,
|
|
669
|
+
session.id,
|
|
670
|
+
{ testId: `terminate-session-${session.id}-button` },
|
|
671
|
+
"-button"
|
|
672
|
+
),
|
|
673
|
+
children: session.isTerminating ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { className: "h-4 w-4" })
|
|
674
|
+
}
|
|
675
|
+
) }),
|
|
676
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.TooltipContent, { children: labels.endSession })
|
|
677
|
+
] })
|
|
678
|
+
]
|
|
679
|
+
}
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
function ActiveSessionsDialog({
|
|
683
|
+
open,
|
|
684
|
+
onOpenChange,
|
|
685
|
+
isLoading,
|
|
686
|
+
sessions,
|
|
687
|
+
onTerminate,
|
|
688
|
+
labels,
|
|
689
|
+
testId,
|
|
690
|
+
testIds
|
|
691
|
+
}) {
|
|
692
|
+
const l = react.useMemo(() => ({ ...DEFAULT_ACTIVE_SESSIONS_DIALOG_LABELS, ...labels }), [labels]);
|
|
693
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
694
|
+
ui.DialogContent,
|
|
695
|
+
{
|
|
696
|
+
presentation: "sheet",
|
|
697
|
+
className: "sm:max-w-lg",
|
|
698
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "active-sessions-dialog" }),
|
|
699
|
+
children: [
|
|
700
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.DialogHeader, { children: [
|
|
701
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
702
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Radio, { className: "h-6 w-6" }),
|
|
703
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.DialogTitle, { children: l.title })
|
|
704
|
+
] }),
|
|
705
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.DialogDescription, { children: l.description })
|
|
706
|
+
] }),
|
|
707
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-8", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-5 w-5 animate-spin text-muted-foreground" }) }) : sessions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: l.noSessions }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
708
|
+
"div",
|
|
709
|
+
{
|
|
710
|
+
className: "-mx-2 max-h-96 overflow-auto rounded-lg bg-muted",
|
|
711
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.list, { testId: "session-list" }),
|
|
712
|
+
children: sessions.map((session) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
713
|
+
SessionListRow,
|
|
714
|
+
{
|
|
715
|
+
session,
|
|
716
|
+
onTerminate,
|
|
717
|
+
labels: l,
|
|
718
|
+
testIds
|
|
719
|
+
},
|
|
720
|
+
session.id
|
|
721
|
+
))
|
|
722
|
+
}
|
|
723
|
+
)
|
|
724
|
+
]
|
|
725
|
+
}
|
|
726
|
+
) });
|
|
727
|
+
}
|
|
728
|
+
function DeleteAccountDialog({
|
|
729
|
+
open,
|
|
730
|
+
onClose,
|
|
731
|
+
step,
|
|
732
|
+
blockers,
|
|
733
|
+
onContinue,
|
|
734
|
+
onBack,
|
|
735
|
+
userEmail,
|
|
736
|
+
confirmEmail,
|
|
737
|
+
onConfirmEmailChange,
|
|
738
|
+
isDeleting,
|
|
739
|
+
onSubmit,
|
|
740
|
+
labels,
|
|
741
|
+
testId,
|
|
742
|
+
testIds
|
|
743
|
+
}) {
|
|
744
|
+
const confirmEmailId = react.useId();
|
|
745
|
+
const l = react.useMemo(() => ({ ...DEFAULT_DELETE_ACCOUNT_DIALOG_LABELS, ...labels }), [labels]);
|
|
746
|
+
const emailMatches = confirmEmail.toLowerCase() === userEmail.toLowerCase();
|
|
747
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open, onOpenChange: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
748
|
+
ui.DialogContent,
|
|
749
|
+
{
|
|
750
|
+
presentation: "sheet",
|
|
751
|
+
className: "sm:max-w-md",
|
|
752
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "delete-account-dialog" }),
|
|
753
|
+
children: step === "warning" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
754
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.DialogHeader, { children: [
|
|
755
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.DialogTitle, { className: "flex items-center gap-2", children: [
|
|
756
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "h-5 w-5 text-destructive" }),
|
|
757
|
+
l.warningTitle
|
|
758
|
+
] }),
|
|
759
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.DialogDescription, { children: [
|
|
760
|
+
l.warningBefore,
|
|
761
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: l.warningEmphasis }),
|
|
762
|
+
l.warningAfter
|
|
763
|
+
] })
|
|
764
|
+
] }),
|
|
765
|
+
blockers.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-md bg-yellow-bg p-3 text-sm text-yellow-text", children: [
|
|
766
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 font-semibold", children: l.blockersHeading }),
|
|
767
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "list-inside list-disc space-y-1", children: blockers.map((blocker) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: blocker.content }, blocker.key)) })
|
|
768
|
+
] }),
|
|
769
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col-reverse sm:flex-row sm:justify-end gap-2 pt-2", children: [
|
|
770
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
771
|
+
ui.Button,
|
|
772
|
+
{
|
|
773
|
+
variant: "outline",
|
|
774
|
+
onClick: onClose,
|
|
775
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.cancel, { testId: "delete-account-cancel-button" }),
|
|
776
|
+
children: l.cancel
|
|
777
|
+
}
|
|
778
|
+
),
|
|
779
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
780
|
+
ui.Button,
|
|
781
|
+
{
|
|
782
|
+
variant: "destructive",
|
|
783
|
+
disabled: blockers.length > 0,
|
|
784
|
+
onClick: onContinue,
|
|
785
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.continue, {
|
|
786
|
+
testId: "delete-account-continue-button"
|
|
787
|
+
}),
|
|
788
|
+
children: l.continue
|
|
789
|
+
}
|
|
790
|
+
)
|
|
791
|
+
] })
|
|
792
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
793
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.DialogHeader, { children: [
|
|
794
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.DialogTitle, { children: l.confirmTitle }),
|
|
795
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.DialogDescription, { children: l.confirmDescription })
|
|
796
|
+
] }),
|
|
797
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
798
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: confirmEmailId, className: "mb-1 block text-sm font-medium", children: l.yourEmail }),
|
|
799
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
800
|
+
ui.Input,
|
|
801
|
+
{
|
|
802
|
+
id: confirmEmailId,
|
|
803
|
+
type: "email",
|
|
804
|
+
placeholder: userEmail,
|
|
805
|
+
value: confirmEmail,
|
|
806
|
+
onChange: (e) => onConfirmEmailChange(e.target.value),
|
|
807
|
+
autoFocus: true,
|
|
808
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.emailInput, {
|
|
809
|
+
testId: "delete-account-email-input"
|
|
810
|
+
})
|
|
811
|
+
}
|
|
812
|
+
)
|
|
813
|
+
] }),
|
|
814
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col-reverse sm:flex-row sm:justify-end gap-2 pt-2", children: [
|
|
815
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
816
|
+
ui.Button,
|
|
817
|
+
{
|
|
818
|
+
variant: "outline",
|
|
819
|
+
onClick: onBack,
|
|
820
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.back, { testId: "delete-account-back-button" }),
|
|
821
|
+
children: l.back
|
|
822
|
+
}
|
|
823
|
+
),
|
|
824
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
825
|
+
ui.Button,
|
|
826
|
+
{
|
|
827
|
+
variant: "destructive",
|
|
828
|
+
disabled: !emailMatches || isDeleting,
|
|
829
|
+
onClick: onSubmit,
|
|
830
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.submit, { testId: "delete-account-submit-button" }),
|
|
831
|
+
children: isDeleting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
832
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
833
|
+
l.deleting
|
|
834
|
+
] }) : l.deleteAccount
|
|
835
|
+
}
|
|
836
|
+
)
|
|
837
|
+
] })
|
|
838
|
+
] })
|
|
839
|
+
}
|
|
840
|
+
) });
|
|
841
|
+
}
|
|
842
|
+
var DEFAULT_LOGOUT_DIALOG_LABELS = {
|
|
843
|
+
title: "Logout",
|
|
844
|
+
descriptionAll: "End this session or all active sessions?",
|
|
845
|
+
descriptionThis: "End this session and return to the login page.",
|
|
846
|
+
cancel: "Cancel",
|
|
847
|
+
allSessions: "All sessions",
|
|
848
|
+
offlineTooltip: "Ending all sessions needs a connection \u2014 you can still log out of this device.",
|
|
849
|
+
thisSession: "This session",
|
|
850
|
+
offlineNote: "You\u2019re offline \u2014 ending all sessions needs a connection. You can still log out of this device.",
|
|
851
|
+
activeSessions: (count) => chunkKDG6FER6_cjs.formatCount(count, { one: "active session", other: "active sessions" }),
|
|
852
|
+
workspaces: (count) => chunkKDG6FER6_cjs.formatCount(count, { one: "workspace", other: "workspaces" }),
|
|
853
|
+
ttl: (ttlLabel) => `TTL ${ttlLabel}`
|
|
854
|
+
};
|
|
855
|
+
function SessionRow({
|
|
856
|
+
session,
|
|
857
|
+
icon,
|
|
858
|
+
labels
|
|
859
|
+
}) {
|
|
860
|
+
const { status } = session;
|
|
861
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 rounded-md bg-muted/50 px-3 py-2", children: [
|
|
862
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0", children: icon }),
|
|
863
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
864
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
865
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { className: "truncate font-mono text-sm", children: session.id.slice(0, 12) }),
|
|
866
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
867
|
+
ui.Badge,
|
|
868
|
+
{
|
|
869
|
+
variant: status === "agent" ? "default" : "secondary",
|
|
870
|
+
className: "px-1 py-0 text-sm",
|
|
871
|
+
children: status
|
|
872
|
+
}
|
|
873
|
+
)
|
|
874
|
+
] }),
|
|
875
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
876
|
+
session.ipAddress && /* @__PURE__ */ jsxRuntime.jsx("span", { children: session.ipAddress }),
|
|
877
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: labels.ttl(session.ttlLabel) }),
|
|
878
|
+
session.workspaceCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { children: labels.workspaces(session.workspaceCount) })
|
|
879
|
+
] })
|
|
880
|
+
] })
|
|
881
|
+
] });
|
|
882
|
+
}
|
|
883
|
+
function LogoutDialog({
|
|
884
|
+
open,
|
|
885
|
+
onClose,
|
|
886
|
+
onLogoutThis,
|
|
887
|
+
onLogoutAll,
|
|
888
|
+
canLogoutAll,
|
|
889
|
+
isOnline,
|
|
890
|
+
sessions,
|
|
891
|
+
renderSessionIcon,
|
|
892
|
+
labels,
|
|
893
|
+
testId,
|
|
894
|
+
testIds
|
|
895
|
+
}) {
|
|
896
|
+
const l = react.useMemo(() => ({ ...DEFAULT_LOGOUT_DIALOG_LABELS, ...labels }), [labels]);
|
|
897
|
+
const [sessionsOpen, setSessionsOpen] = react.useState(false);
|
|
898
|
+
const restoreFocus = chunkDCDVWPMB_cjs.useRestoreFocus();
|
|
899
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open, onOpenChange: (next) => !next && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
900
|
+
ui.DialogContent,
|
|
901
|
+
{
|
|
902
|
+
...restoreFocus,
|
|
903
|
+
className: "sm:max-w-md",
|
|
904
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "logout-modal" }),
|
|
905
|
+
children: [
|
|
906
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.DialogHeader, { children: [
|
|
907
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
908
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { className: "h-6 w-6" }),
|
|
909
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.DialogTitle, { children: l.title })
|
|
910
|
+
] }),
|
|
911
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.DialogDescription, { className: "text-base", children: canLogoutAll ? l.descriptionAll : l.descriptionThis })
|
|
912
|
+
] }),
|
|
913
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.DialogFooter, { className: "gap-2", children: [
|
|
914
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
915
|
+
ui.Button,
|
|
916
|
+
{
|
|
917
|
+
variant: "outline",
|
|
918
|
+
onClick: onClose,
|
|
919
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.cancel, { testId: "logout-modal-cancel-button" }),
|
|
920
|
+
children: l.cancel
|
|
921
|
+
}
|
|
922
|
+
),
|
|
923
|
+
canLogoutAll && /* @__PURE__ */ jsxRuntime.jsx(
|
|
924
|
+
ui.Button,
|
|
925
|
+
{
|
|
926
|
+
variant: "secondary",
|
|
927
|
+
onClick: onLogoutAll,
|
|
928
|
+
disabled: !isOnline,
|
|
929
|
+
title: isOnline ? void 0 : l.offlineTooltip,
|
|
930
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.all, { testId: "logout-modal-all-button" }),
|
|
931
|
+
children: l.allSessions
|
|
932
|
+
}
|
|
933
|
+
),
|
|
934
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
935
|
+
ui.Button,
|
|
936
|
+
{
|
|
937
|
+
variant: "default",
|
|
938
|
+
onClick: onLogoutThis,
|
|
939
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.this, { testId: "logout-modal-this-button" }),
|
|
940
|
+
children: l.thisSession
|
|
941
|
+
}
|
|
942
|
+
)
|
|
943
|
+
] }),
|
|
944
|
+
canLogoutAll && !isOnline && /* @__PURE__ */ jsxRuntime.jsx(
|
|
945
|
+
"p",
|
|
946
|
+
{
|
|
947
|
+
className: "text-sm text-muted-foreground",
|
|
948
|
+
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.offlineNote, { testId: "logout-offline-note" }),
|
|
949
|
+
children: l.offlineNote
|
|
950
|
+
}
|
|
951
|
+
),
|
|
952
|
+
sessions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(ui.Collapsible, { open: sessionsOpen, onOpenChange: setSessionsOpen, children: [
|
|
953
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.CollapsibleTrigger, { className: "flex w-full items-center gap-2 py-1 text-left transition-opacity hover:opacity-80 pointer-coarse:py-3", children: [
|
|
954
|
+
sessionsOpen ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 flex-shrink-0" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4 flex-shrink-0" }),
|
|
955
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 text-sm font-medium text-muted-foreground", children: [
|
|
956
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Radio, { className: "h-3 w-3" }),
|
|
957
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: l.activeSessions(sessions.length) })
|
|
958
|
+
] })
|
|
959
|
+
] }),
|
|
960
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.CollapsibleContent, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-48 space-y-1.5 overflow-auto pt-2", children: sessions.map((session) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
961
|
+
SessionRow,
|
|
962
|
+
{
|
|
963
|
+
session,
|
|
964
|
+
icon: renderSessionIcon?.(session.status),
|
|
965
|
+
labels: l
|
|
966
|
+
},
|
|
967
|
+
session.id
|
|
968
|
+
)) }) })
|
|
969
|
+
] })
|
|
970
|
+
]
|
|
971
|
+
}
|
|
972
|
+
) });
|
|
973
|
+
}
|
|
974
|
+
function SettingsSwitchRow({
|
|
975
|
+
id,
|
|
976
|
+
title,
|
|
977
|
+
icon,
|
|
978
|
+
description,
|
|
979
|
+
checked,
|
|
980
|
+
onCheckedChange,
|
|
981
|
+
testId,
|
|
982
|
+
disabled,
|
|
983
|
+
className
|
|
984
|
+
}) {
|
|
985
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
986
|
+
"div",
|
|
987
|
+
{
|
|
988
|
+
"data-slot": "settings-switch-row",
|
|
989
|
+
className: ui.cn("flex items-center justify-between gap-4", className),
|
|
990
|
+
children: [
|
|
991
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
992
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: id, className: "flex items-center gap-2 text-sm font-medium text-foreground", children: [
|
|
993
|
+
icon,
|
|
994
|
+
title
|
|
995
|
+
] }),
|
|
996
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: description })
|
|
997
|
+
] }),
|
|
998
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
999
|
+
ui.Switch,
|
|
1000
|
+
{
|
|
1001
|
+
id,
|
|
1002
|
+
checked,
|
|
1003
|
+
onCheckedChange,
|
|
1004
|
+
disabled,
|
|
1005
|
+
"data-testid": testId
|
|
1006
|
+
}
|
|
1007
|
+
)
|
|
1008
|
+
]
|
|
1009
|
+
}
|
|
1010
|
+
);
|
|
1011
|
+
}
|
|
1012
|
+
function SettingsSwitchGroup({
|
|
1013
|
+
className,
|
|
1014
|
+
children
|
|
1015
|
+
}) {
|
|
1016
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1017
|
+
"div",
|
|
1018
|
+
{
|
|
1019
|
+
"data-slot": "settings-switch-group",
|
|
1020
|
+
className: ui.cn("ml-6 space-y-4 border-l border-border pl-4", className),
|
|
1021
|
+
children
|
|
1022
|
+
}
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
1025
|
+
function NotificationCategoryList({
|
|
1026
|
+
masterId,
|
|
1027
|
+
masterTitle,
|
|
1028
|
+
masterDescription,
|
|
1029
|
+
masterChecked,
|
|
1030
|
+
onMasterChange,
|
|
1031
|
+
masterTestId,
|
|
1032
|
+
categories,
|
|
1033
|
+
onCategoryChange,
|
|
1034
|
+
idPrefix = masterId,
|
|
1035
|
+
testIdPrefix
|
|
1036
|
+
}) {
|
|
1037
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "notification-category-list", children: [
|
|
1038
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1039
|
+
SettingsSwitchRow,
|
|
1040
|
+
{
|
|
1041
|
+
id: masterId,
|
|
1042
|
+
title: masterTitle,
|
|
1043
|
+
description: masterDescription,
|
|
1044
|
+
checked: masterChecked,
|
|
1045
|
+
onCheckedChange: onMasterChange,
|
|
1046
|
+
testId: chunkMHVNT4J3_cjs.testIdOr(masterTestId, { testId: "toggle-email-notifications" })
|
|
1047
|
+
}
|
|
1048
|
+
),
|
|
1049
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-1 mt-3 space-y-3 border-l border-border pl-4 pointer-coarse:mt-5 pointer-coarse:space-y-5", children: categories.map((c) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1050
|
+
"label",
|
|
1051
|
+
{
|
|
1052
|
+
htmlFor: `${idPrefix}-${c.key}`,
|
|
1053
|
+
className: ui.cn(
|
|
1054
|
+
"flex items-start gap-3 pointer-coarse:min-h-11",
|
|
1055
|
+
masterChecked ? "cursor-pointer" : "cursor-not-allowed opacity-50"
|
|
1056
|
+
),
|
|
1057
|
+
children: [
|
|
1058
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1059
|
+
ui.Checkbox,
|
|
1060
|
+
{
|
|
1061
|
+
id: `${idPrefix}-${c.key}`,
|
|
1062
|
+
checked: c.checked,
|
|
1063
|
+
disabled: !masterChecked,
|
|
1064
|
+
onCheckedChange: (value) => onCategoryChange(c.key, value === true),
|
|
1065
|
+
"data-testid": chunkMHVNT4J3_cjs.prefixedTestId(testIdPrefix, c.key, { testId: `toggle-email-${c.key}` }),
|
|
1066
|
+
className: "mt-0.5 size-5 shrink-0"
|
|
1067
|
+
}
|
|
1068
|
+
),
|
|
1069
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
1070
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: c.label }),
|
|
1071
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs text-muted-foreground", children: c.description })
|
|
1072
|
+
] })
|
|
1073
|
+
]
|
|
1074
|
+
},
|
|
1075
|
+
c.key
|
|
1076
|
+
)) })
|
|
1077
|
+
] });
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
// src/settings/account-views.ts
|
|
1081
|
+
function formatSessionTtl(totalSeconds) {
|
|
1082
|
+
if (totalSeconds <= 0) return "expired";
|
|
1083
|
+
const days = Math.floor(totalSeconds / 86400);
|
|
1084
|
+
const hours = Math.floor(totalSeconds % 86400 / 3600);
|
|
1085
|
+
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
1086
|
+
const parts = [];
|
|
1087
|
+
if (days > 0) parts.push(`${days}d`);
|
|
1088
|
+
if (hours > 0) parts.push(`${hours}h`);
|
|
1089
|
+
if (minutes > 0) parts.push(`${minutes}m`);
|
|
1090
|
+
return parts.length > 0 ? parts.join(" ") : "<1m";
|
|
1091
|
+
}
|
|
1092
|
+
function toActiveSessionViews(sessions, {
|
|
1093
|
+
currentSessionId,
|
|
1094
|
+
terminatingId,
|
|
1095
|
+
renderIcon,
|
|
1096
|
+
formatTtl = formatSessionTtl
|
|
1097
|
+
}) {
|
|
1098
|
+
return sessions.map((session) => {
|
|
1099
|
+
const status = session.status || "user";
|
|
1100
|
+
const count = session.workspaces.length;
|
|
1101
|
+
return {
|
|
1102
|
+
id: session.session_id,
|
|
1103
|
+
name: session.name || (status === "agent" ? "Agent session" : "Browser session"),
|
|
1104
|
+
isCurrent: session.session_id === currentSessionId,
|
|
1105
|
+
isAgent: status === "agent",
|
|
1106
|
+
detail: `${session.ip_address ?? "Unknown IP"} \xB7 expires in ${formatTtl(session.ttl)}${count > 0 ? ` \xB7 ${count} workspace${count > 1 ? "s" : ""}` : ""}`,
|
|
1107
|
+
isTerminating: terminatingId === session.session_id,
|
|
1108
|
+
icon: renderIcon?.(status)
|
|
1109
|
+
};
|
|
1110
|
+
}).sort((a, b) => Number(b.isCurrent) - Number(a.isCurrent));
|
|
1111
|
+
}
|
|
1112
|
+
function toLogoutSessionViews(sessions, formatTtl = formatSessionTtl) {
|
|
1113
|
+
return sessions.map((session) => ({
|
|
1114
|
+
id: session.session_id,
|
|
1115
|
+
status: session.status || "user",
|
|
1116
|
+
ipAddress: session.ip_address,
|
|
1117
|
+
ttlLabel: formatTtl(session.ttl),
|
|
1118
|
+
workspaceCount: session.workspaces.length
|
|
1119
|
+
}));
|
|
1120
|
+
}
|
|
1121
|
+
function toDeleteBlockerViews(blockers, renderSubscriptionLink) {
|
|
1122
|
+
return blockers.flatMap(
|
|
1123
|
+
(blocker) => blocker.type === "active_subscription" ? [
|
|
1124
|
+
{
|
|
1125
|
+
key: "active_subscription",
|
|
1126
|
+
content: renderSubscriptionLink ? renderSubscriptionLink() : "Active subscription: cancel it in your subscription settings first"
|
|
1127
|
+
}
|
|
1128
|
+
] : blocker.workspaces.map((ws) => ({
|
|
1129
|
+
key: `workspace-${ws}`,
|
|
1130
|
+
content: `You are the sole admin of workspace "${ws}" \u2014 transfer admin rights or remove all other members first`
|
|
1131
|
+
}))
|
|
1132
|
+
);
|
|
1133
|
+
}
|
|
1134
|
+
var EMAIL_NOTIFICATION_CATEGORIES = [
|
|
1135
|
+
{ key: "messages", label: "New messages", description: "A direct message while you\u2019re offline" },
|
|
1136
|
+
{ key: "workspace_added", label: "Workspace access", description: "You\u2019re added to a workspace" },
|
|
1137
|
+
{
|
|
1138
|
+
key: "contact_accepted",
|
|
1139
|
+
label: "Invitation accepted",
|
|
1140
|
+
description: "Someone accepts your invitation"
|
|
1141
|
+
},
|
|
1142
|
+
{ key: "referral_reward", label: "Rewards", description: "You earn a reward" },
|
|
1143
|
+
{
|
|
1144
|
+
key: "product_updates",
|
|
1145
|
+
label: "ARBI update",
|
|
1146
|
+
description: "Weekly digest of new features and highlights"
|
|
1147
|
+
}
|
|
1148
|
+
];
|
|
1149
|
+
var EMAIL_NOTIFICATION_KEYS = EMAIL_NOTIFICATION_CATEGORIES.map(
|
|
1150
|
+
(c) => c.key
|
|
1151
|
+
);
|
|
1152
|
+
function toNotificationCategories(checked, defs = EMAIL_NOTIFICATION_CATEGORIES) {
|
|
1153
|
+
return defs.map((def) => ({ ...def, checked: checked[def.key] ?? true }));
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
exports.ActiveSessionsDialog = ActiveSessionsDialog;
|
|
1157
|
+
exports.AvatarPicker = AvatarPicker;
|
|
1158
|
+
exports.DEFAULT_ACTIVE_SESSIONS_DIALOG_LABELS = DEFAULT_ACTIVE_SESSIONS_DIALOG_LABELS;
|
|
1159
|
+
exports.DEFAULT_AVATAR_PICKER_LABELS = DEFAULT_AVATAR_PICKER_LABELS;
|
|
1160
|
+
exports.DEFAULT_DELETE_ACCOUNT_DIALOG_LABELS = DEFAULT_DELETE_ACCOUNT_DIALOG_LABELS;
|
|
1161
|
+
exports.DEFAULT_LOGOUT_DIALOG_LABELS = DEFAULT_LOGOUT_DIALOG_LABELS;
|
|
1162
|
+
exports.DEFAULT_PASSWORD_CHANGE_DIALOG_LABELS = DEFAULT_PASSWORD_CHANGE_DIALOG_LABELS;
|
|
1163
|
+
exports.DEFAULT_PROFILE_CARD_LABELS = DEFAULT_PROFILE_CARD_LABELS;
|
|
1164
|
+
exports.DEFAULT_SETTINGS_DANGER_ZONE_LABELS = DEFAULT_SETTINGS_DANGER_ZONE_LABELS;
|
|
1165
|
+
exports.DeleteAccountDialog = DeleteAccountDialog;
|
|
1166
|
+
exports.EMAIL_NOTIFICATION_CATEGORIES = EMAIL_NOTIFICATION_CATEGORIES;
|
|
1167
|
+
exports.EMAIL_NOTIFICATION_KEYS = EMAIL_NOTIFICATION_KEYS;
|
|
1168
|
+
exports.LogoutDialog = LogoutDialog;
|
|
1169
|
+
exports.NotificationCategoryList = NotificationCategoryList;
|
|
1170
|
+
exports.PasswordChangeDialog = PasswordChangeDialog;
|
|
1171
|
+
exports.ProfileCard = ProfileCard;
|
|
1172
|
+
exports.SettingsActionRow = SettingsActionRow;
|
|
1173
|
+
exports.SettingsCard = SettingsCard;
|
|
1174
|
+
exports.SettingsDangerZone = SettingsDangerZone;
|
|
1175
|
+
exports.SettingsPanel = SettingsPanel;
|
|
1176
|
+
exports.SettingsRow = SettingsRow;
|
|
1177
|
+
exports.SettingsSection = SettingsSection;
|
|
1178
|
+
exports.SettingsSwitchGroup = SettingsSwitchGroup;
|
|
1179
|
+
exports.SettingsSwitchRow = SettingsSwitchRow;
|
|
1180
|
+
exports.formatSessionTtl = formatSessionTtl;
|
|
1181
|
+
exports.toActiveSessionViews = toActiveSessionViews;
|
|
1182
|
+
exports.toDeleteBlockerViews = toDeleteBlockerViews;
|
|
1183
|
+
exports.toLogoutSessionViews = toLogoutSessionViews;
|
|
1184
|
+
exports.toNotificationCategories = toNotificationCategories;
|
|
1185
|
+
//# sourceMappingURL=chunk-YVIOCITQ.cjs.map
|
|
1186
|
+
//# sourceMappingURL=chunk-YVIOCITQ.cjs.map
|