camox 0.48.0 → 0.51.0

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 (57) hide show
  1. package/dist/core/layoutContext.d.ts +1 -0
  2. package/dist/features/canvas/sidebar/CanvasInspector.js +1 -1
  3. package/dist/features/content/ContentAssets.js +84 -88
  4. package/dist/features/preview/CamoxPreview.js +1 -1
  5. package/dist/features/preview/EditablePageExperience.js +17 -9
  6. package/dist/features/preview/components/BlockActionsPopover.js +11 -35
  7. package/dist/features/preview/components/FieldToolbar.js +1 -1
  8. package/dist/features/preview/components/MobilePreviewDrawer.js +6 -9
  9. package/dist/features/preview/components/PreviewPanel.js +10 -64
  10. package/dist/features/preview/components/PreviewToolbar.js +1 -1
  11. package/dist/features/preview/previewConstants.js +2 -8
  12. package/dist/features/preview/usePreviewViewportActions.js +1 -1
  13. package/dist/features/provider/AuthenticatedCamoxProvider.js +1 -1
  14. package/dist/features/provider/components/CommandPalette.js +2 -5
  15. package/dist/features/provider/signInShortcut.js +1 -2
  16. package/dist/features/provider/useAdminShortcuts.js +47 -53
  17. package/dist/features/routes/pageRuntime.d.ts +2 -1
  18. package/dist/features/routes/pageRuntime.js +27 -20
  19. package/dist/features/runtime/publicCache.js +83 -0
  20. package/dist/features/runtime/runtime.d.ts +13 -3
  21. package/dist/features/runtime/runtime.js +173 -79
  22. package/dist/features/runtime/worker.d.ts +5 -1
  23. package/dist/features/runtime/worker.js +20 -3
  24. package/dist/features/settings/AnalyticsSettings.js +622 -0
  25. package/dist/features/settings/CamoxSettings.js +95 -0
  26. package/dist/features/settings/FaviconSettings.js +254 -0
  27. package/dist/features/settings/ProjectNameSettings.js +145 -0
  28. package/dist/features/settings/SettingsPart.js +73 -0
  29. package/dist/features/settings/SocialProfilesSettings.js +245 -0
  30. package/dist/features/settings/useProjectMutation.js +61 -0
  31. package/dist/features/studio/components/DraftsControl.js +136 -131
  32. package/dist/features/studio/components/LocalePicker.js +178 -174
  33. package/dist/features/studio/components/Navbar.js +107 -66
  34. package/dist/features/studio/components/ProjectMenu.js +118 -170
  35. package/dist/features/studio/components/ReviewDraftSheet.js +1046 -990
  36. package/dist/features/studio/components/UserButton.js +1 -1
  37. package/dist/features/studio/routes.js +3 -1
  38. package/dist/features/studio/showInCanvas.js +129 -0
  39. package/dist/features/vite/definitionsSync.js +4 -5
  40. package/dist/features/vite/runtimeDev.js +32 -17
  41. package/dist/features/vite/staticAssetHeaders.js +52 -0
  42. package/dist/features/vite/vite.d.ts +1 -1
  43. package/dist/features/vite/vite.js +16 -4
  44. package/dist/lib/api-client-server.d.ts +1 -1
  45. package/dist/lib/api-client.d.ts +2 -1
  46. package/dist/lib/draft-scope.d.ts +1 -0
  47. package/dist/lib/locale-path.d.ts +3 -11
  48. package/dist/lib/locale-path.js +3 -27
  49. package/dist/lib/queries.js +7 -1
  50. package/dist/lib/shortcuts.js +29 -0
  51. package/dist/lib/studio-reads.d.ts +1 -0
  52. package/dist/lib/utils.js +1 -104
  53. package/dist/package.js +1 -1
  54. package/dist/studio.css +1 -1
  55. package/package.json +5 -4
  56. package/dist/features/studio/components/FaviconDialog.js +0 -318
  57. package/dist/features/studio/components/SocialProfilesDialog.js +0 -342
@@ -1,318 +0,0 @@
1
- import { getApiUrl } from "../../../lib/api-client.js";
2
- import { reads, useStudioCache } from "../../../lib/studio-reads.js";
3
- import { projectMutations } from "../../../lib/queries.js";
4
- import { buildDefaultFaviconUrl, buildFaviconUrl } from "../../routes/pageRuntime.js";
5
- import { c } from "react/compiler-runtime";
6
- import * as React from "react";
7
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
- import { useMutation } from "@tanstack/react-query";
9
- import { Button } from "@camox/ui/button";
10
- import { Trash2, TriangleAlert } from "lucide-react";
11
- import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@camox/ui/dialog";
12
- import { toast } from "@camox/ui/toaster";
13
- import { Spinner } from "@camox/ui/spinner";
14
- import { Alert, AlertDescription } from "@camox/ui/alert";
15
- import { FaviconDropZone, validateFaviconFile } from "@camox/ui/favicon-drop-zone";
16
-
17
- //#region src/features/studio/components/FaviconDialog.tsx
18
- /** Points the studio tab's own icon at the saved favicon, so the change shows without a reload. */
19
- function refreshDocumentFavicon(href) {
20
- for (const link of document.querySelectorAll("link[rel~=\"icon\"]")) link.href = href;
21
- }
22
- function FaviconDialog(t0) {
23
- const $ = c(9);
24
- const { project, open, onOpenChange } = t0;
25
- let t1;
26
- if ($[0] !== onOpenChange) {
27
- t1 = () => onOpenChange(false);
28
- $[0] = onOpenChange;
29
- $[1] = t1;
30
- } else t1 = $[1];
31
- let t2;
32
- if ($[2] !== project || $[3] !== t1) {
33
- t2 = /* @__PURE__ */ jsx(DialogContent, {
34
- className: "gap-5 sm:max-w-md",
35
- children: /* @__PURE__ */ jsx(FaviconForm, {
36
- project,
37
- onSaved: t1
38
- })
39
- });
40
- $[2] = project;
41
- $[3] = t1;
42
- $[4] = t2;
43
- } else t2 = $[4];
44
- let t3;
45
- if ($[5] !== onOpenChange || $[6] !== open || $[7] !== t2) {
46
- t3 = /* @__PURE__ */ jsx(Dialog, {
47
- open,
48
- onOpenChange,
49
- children: t2
50
- });
51
- $[5] = onOpenChange;
52
- $[6] = open;
53
- $[7] = t2;
54
- $[8] = t3;
55
- } else t3 = $[8];
56
- return t3;
57
- }
58
- function FaviconForm(t0) {
59
- const $ = c(56);
60
- const { project, onSaved } = t0;
61
- const studioCache = useStudioCache();
62
- const [pending, setPending] = React.useState(null);
63
- const [hasCurrent, setHasCurrent] = React.useState(false);
64
- let t1;
65
- if ($[0] !== project) {
66
- t1 = buildFaviconUrl(getApiUrl(), project, { withDefault: false });
67
- $[0] = project;
68
- $[1] = t1;
69
- } else t1 = $[1];
70
- const currentUrl = t1;
71
- let t2;
72
- let t3;
73
- if ($[2] !== currentUrl) {
74
- t2 = () => {
75
- const probe = new Image();
76
- probe.onload = () => setHasCurrent(true);
77
- probe.onerror = () => setHasCurrent(false);
78
- probe.src = currentUrl;
79
- return () => {
80
- probe.onload = null;
81
- probe.onerror = null;
82
- };
83
- };
84
- t3 = [currentUrl];
85
- $[2] = currentUrl;
86
- $[3] = t2;
87
- $[4] = t3;
88
- } else {
89
- t2 = $[3];
90
- t3 = $[4];
91
- }
92
- React.useEffect(t2, t3);
93
- const pendingFile = pending?.type === "upload" ? pending.file : null;
94
- let t4;
95
- if ($[5] !== pendingFile) {
96
- t4 = pendingFile ? URL.createObjectURL(pendingFile) : null;
97
- $[5] = pendingFile;
98
- $[6] = t4;
99
- } else t4 = $[6];
100
- const pendingUrl = t4;
101
- let t5;
102
- let t6;
103
- if ($[7] !== pendingUrl) {
104
- t5 = () => {
105
- if (!pendingUrl) return;
106
- return () => URL.revokeObjectURL(pendingUrl);
107
- };
108
- t6 = [pendingUrl];
109
- $[7] = pendingUrl;
110
- $[8] = t5;
111
- $[9] = t6;
112
- } else {
113
- t5 = $[8];
114
- t6 = $[9];
115
- }
116
- React.useEffect(t5, t6);
117
- let t7;
118
- if ($[10] !== onSaved || $[11] !== pending?.type || $[12] !== project || $[13] !== studioCache) {
119
- t7 = async () => {
120
- await studioCache.invalidate(reads.project({ projectUuid: project.uuid }));
121
- const updated = studioCache.get(reads.project({ projectUuid: project.uuid }));
122
- refreshDocumentFavicon(buildFaviconUrl(getApiUrl(), updated ?? project));
123
- toast.success(pending?.type === "remove" ? "Favicon removed" : "Favicon updated");
124
- onSaved();
125
- };
126
- $[10] = onSaved;
127
- $[11] = pending?.type;
128
- $[12] = project;
129
- $[13] = studioCache;
130
- $[14] = t7;
131
- } else t7 = $[14];
132
- const onSuccess = t7;
133
- const onError = _temp;
134
- let t8;
135
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
136
- t8 = projectMutations.uploadFavicon();
137
- $[15] = t8;
138
- } else t8 = $[15];
139
- let t9;
140
- if ($[16] !== onSuccess) {
141
- t9 = {
142
- ...t8,
143
- onSuccess,
144
- onError
145
- };
146
- $[16] = onSuccess;
147
- $[17] = t9;
148
- } else t9 = $[17];
149
- const upload = useMutation(t9);
150
- let t10;
151
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
152
- t10 = projectMutations.deleteFavicon();
153
- $[18] = t10;
154
- } else t10 = $[18];
155
- let t11;
156
- if ($[19] !== onSuccess) {
157
- t11 = {
158
- ...t10,
159
- onSuccess,
160
- onError
161
- };
162
- $[19] = onSuccess;
163
- $[20] = t11;
164
- } else t11 = $[20];
165
- const remove = useMutation(t11);
166
- const isSaving = upload.isPending || remove.isPending;
167
- let t12;
168
- if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
169
- t12 = (file) => {
170
- const error_0 = validateFaviconFile(file);
171
- if (error_0) {
172
- toast.error(error_0);
173
- return;
174
- }
175
- setPending({
176
- type: "upload",
177
- file
178
- });
179
- };
180
- $[21] = t12;
181
- } else t12 = $[21];
182
- const choose = t12;
183
- let t13;
184
- if ($[22] !== pending || $[23] !== project || $[24] !== remove || $[25] !== upload) {
185
- t13 = () => {
186
- if (pending?.type === "upload") {
187
- upload.mutate({
188
- projectId: project.id,
189
- file: pending.file
190
- });
191
- return;
192
- }
193
- if (pending?.type === "remove") remove.mutate({ projectId: project.id });
194
- };
195
- $[22] = pending;
196
- $[23] = project;
197
- $[24] = remove;
198
- $[25] = upload;
199
- $[26] = t13;
200
- } else t13 = $[26];
201
- const save = t13;
202
- const showsFavicon = pending ? pending.type === "upload" : hasCurrent;
203
- let t14;
204
- if ($[27] !== currentUrl || $[28] !== pendingUrl || $[29] !== showsFavicon) {
205
- t14 = pendingUrl ?? (showsFavicon ? currentUrl : buildDefaultFaviconUrl(getApiUrl()));
206
- $[27] = currentUrl;
207
- $[28] = pendingUrl;
208
- $[29] = showsFavicon;
209
- $[30] = t14;
210
- } else t14 = $[30];
211
- const previewUrl = t14;
212
- const prompt = pendingFile ? pendingFile.name : showsFavicon ? "Drop a new favicon, or click to browse" : "Drop your favicon here, or click to browse";
213
- let t15;
214
- if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
215
- t15 = /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Favicon" }), /* @__PURE__ */ jsx(DialogDescription, { children: "The icon shown in browser tabs and bookmarks." })] });
216
- $[31] = t15;
217
- } else t15 = $[31];
218
- let t16;
219
- if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
220
- t16 = /* @__PURE__ */ jsxs(Alert, {
221
- variant: "warning",
222
- children: [/* @__PURE__ */ jsx(TriangleAlert, {}), /* @__PURE__ */ jsx(AlertDescription, { children: "Applies to the whole site, including Live and every draft." })]
223
- });
224
- $[32] = t16;
225
- } else t16 = $[32];
226
- let t17;
227
- if ($[33] !== isSaving || $[34] !== previewUrl || $[35] !== prompt) {
228
- t17 = /* @__PURE__ */ jsx(FaviconDropZone, {
229
- previewUrl,
230
- prompt,
231
- disabled: isSaving,
232
- onFileSelected: choose
233
- });
234
- $[33] = isSaving;
235
- $[34] = previewUrl;
236
- $[35] = prompt;
237
- $[36] = t17;
238
- } else t17 = $[36];
239
- let t18;
240
- if ($[37] !== hasCurrent || $[38] !== isSaving || $[39] !== showsFavicon) {
241
- t18 = showsFavicon && /* @__PURE__ */ jsxs(Button, {
242
- type: "button",
243
- variant: "ghost",
244
- className: "sm:mr-auto",
245
- disabled: isSaving,
246
- onClick: () => setPending(hasCurrent ? { type: "remove" } : null),
247
- children: [/* @__PURE__ */ jsx(Trash2, {}), "Remove favicon"]
248
- });
249
- $[37] = hasCurrent;
250
- $[38] = isSaving;
251
- $[39] = showsFavicon;
252
- $[40] = t18;
253
- } else t18 = $[40];
254
- let t19;
255
- if ($[41] !== isSaving) {
256
- t19 = /* @__PURE__ */ jsx(DialogClose, {
257
- render: /* @__PURE__ */ jsx(Button, {
258
- type: "button",
259
- variant: "outline",
260
- disabled: isSaving
261
- }),
262
- children: "Cancel"
263
- });
264
- $[41] = isSaving;
265
- $[42] = t19;
266
- } else t19 = $[42];
267
- const t20 = !pending || isSaving;
268
- let t21;
269
- if ($[43] !== isSaving) {
270
- t21 = isSaving && /* @__PURE__ */ jsx(Spinner, {});
271
- $[43] = isSaving;
272
- $[44] = t21;
273
- } else t21 = $[44];
274
- let t22;
275
- if ($[45] !== save || $[46] !== t20 || $[47] !== t21) {
276
- t22 = /* @__PURE__ */ jsxs(Button, {
277
- type: "button",
278
- onClick: save,
279
- disabled: t20,
280
- children: [t21, "Save"]
281
- });
282
- $[45] = save;
283
- $[46] = t20;
284
- $[47] = t21;
285
- $[48] = t22;
286
- } else t22 = $[48];
287
- let t23;
288
- if ($[49] !== t18 || $[50] !== t19 || $[51] !== t22) {
289
- t23 = /* @__PURE__ */ jsxs(DialogFooter, { children: [
290
- t18,
291
- t19,
292
- t22
293
- ] });
294
- $[49] = t18;
295
- $[50] = t19;
296
- $[51] = t22;
297
- $[52] = t23;
298
- } else t23 = $[52];
299
- let t24;
300
- if ($[53] !== t17 || $[54] !== t23) {
301
- t24 = /* @__PURE__ */ jsxs(Fragment, { children: [
302
- t15,
303
- t16,
304
- t17,
305
- t23
306
- ] });
307
- $[53] = t17;
308
- $[54] = t23;
309
- $[55] = t24;
310
- } else t24 = $[55];
311
- return t24;
312
- }
313
- function _temp(error) {
314
- toast.error(error.message || "Could not save the favicon");
315
- }
316
-
317
- //#endregion
318
- export { FaviconDialog };
@@ -1,342 +0,0 @@
1
- import { reads, useStudioCache } from "../../../lib/studio-reads.js";
2
- import { projectMutations } from "../../../lib/queries.js";
3
- import { c } from "react/compiler-runtime";
4
- import * as React from "react";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
- import { useMutation } from "@tanstack/react-query";
7
- import { Button } from "@camox/ui/button";
8
- import { Input } from "@camox/ui/input";
9
- import { ArrowDown, ArrowUp, Plus, Trash2, TriangleAlert } from "lucide-react";
10
- import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@camox/ui/dialog";
11
- import { toast } from "@camox/ui/toaster";
12
- import { Spinner } from "@camox/ui/spinner";
13
- import { Alert, AlertDescription } from "@camox/ui/alert";
14
- import { socialProfileUrlSchema } from "@camox/api-contract/projects";
15
-
16
- //#region src/features/studio/components/SocialProfilesDialog.tsx
17
- let nextRowKey = 0;
18
- const row = (url) => ({
19
- key: nextRowKey++,
20
- url
21
- });
22
- function SocialProfilesDialog(t0) {
23
- const $ = c(10);
24
- const { project, open, onOpenChange } = t0;
25
- let t1;
26
- if ($[0] !== onOpenChange || $[1] !== open || $[2] !== project) {
27
- t1 = open && /* @__PURE__ */ jsx(SocialProfilesForm, {
28
- project,
29
- onSaved: () => onOpenChange(false)
30
- });
31
- $[0] = onOpenChange;
32
- $[1] = open;
33
- $[2] = project;
34
- $[3] = t1;
35
- } else t1 = $[3];
36
- let t2;
37
- if ($[4] !== t1) {
38
- t2 = /* @__PURE__ */ jsx(DialogContent, {
39
- className: "gap-5 sm:max-w-lg",
40
- children: t1
41
- });
42
- $[4] = t1;
43
- $[5] = t2;
44
- } else t2 = $[5];
45
- let t3;
46
- if ($[6] !== onOpenChange || $[7] !== open || $[8] !== t2) {
47
- t3 = /* @__PURE__ */ jsx(Dialog, {
48
- open,
49
- onOpenChange,
50
- children: t2
51
- });
52
- $[6] = onOpenChange;
53
- $[7] = open;
54
- $[8] = t2;
55
- $[9] = t3;
56
- } else t3 = $[9];
57
- return t3;
58
- }
59
- function SocialProfilesForm(t0) {
60
- const $ = c(47);
61
- const { project, onSaved } = t0;
62
- const studioCache = useStudioCache();
63
- let t1;
64
- if ($[0] !== project) {
65
- t1 = () => project.socialProfiles.map(row);
66
- $[0] = project;
67
- $[1] = t1;
68
- } else t1 = $[1];
69
- const [rows, setRows] = React.useState(t1);
70
- const [showErrors, setShowErrors] = React.useState(false);
71
- let t2;
72
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
73
- t2 = projectMutations.updateSocialProfiles();
74
- $[2] = t2;
75
- } else t2 = $[2];
76
- let t3;
77
- if ($[3] !== onSaved || $[4] !== project || $[5] !== studioCache) {
78
- t3 = {
79
- ...t2,
80
- onSuccess: async () => {
81
- await studioCache.invalidate(reads.project({ projectUuid: project.uuid }));
82
- toast.success("Social profiles updated");
83
- onSaved();
84
- },
85
- onError: _temp
86
- };
87
- $[3] = onSaved;
88
- $[4] = project;
89
- $[5] = studioCache;
90
- $[6] = t3;
91
- } else t3 = $[6];
92
- const save = useMutation(t3);
93
- let t4;
94
- if ($[7] !== rows) {
95
- t4 = rows.map(_temp2).filter(_temp3);
96
- $[7] = rows;
97
- $[8] = t4;
98
- } else t4 = $[8];
99
- const filled = t4;
100
- const errorOf = _temp4;
101
- let t5;
102
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
103
- t5 = (key, url_0) => setRows((current) => current.map((entry_0) => entry_0.key === key ? {
104
- ...entry_0,
105
- url: url_0
106
- } : entry_0));
107
- $[9] = t5;
108
- } else t5 = $[9];
109
- const update = t5;
110
- let t6;
111
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
112
- t6 = (key_0) => setRows((current_0) => current_0.filter((entry_1) => entry_1.key !== key_0));
113
- $[10] = t6;
114
- } else t6 = $[10];
115
- const remove = t6;
116
- let t7;
117
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
118
- t7 = (index, by) => setRows((current_1) => {
119
- const next = [...current_1];
120
- const [moved] = next.splice(index, 1);
121
- next.splice(index + by, 0, moved);
122
- return next;
123
- });
124
- $[11] = t7;
125
- } else t7 = $[11];
126
- const move = t7;
127
- let t8;
128
- if ($[12] !== filled || $[13] !== project || $[14] !== save) {
129
- t8 = (event) => {
130
- event.preventDefault();
131
- if (filled.some((entry_2) => errorOf(entry_2.url))) {
132
- setShowErrors(true);
133
- return;
134
- }
135
- save.mutate({
136
- id: project.id,
137
- socialProfiles: filled.map(_temp5)
138
- });
139
- };
140
- $[12] = filled;
141
- $[13] = project;
142
- $[14] = save;
143
- $[15] = t8;
144
- } else t8 = $[15];
145
- const submit = t8;
146
- let t9;
147
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
148
- t9 = /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Social profiles" }), /* @__PURE__ */ jsx(DialogDescription, { children: "The project's accounts elsewhere, such as on LinkedIn, X or GitHub. Search engines and AI answer engines use them to tie the website to your organization." })] });
149
- $[16] = t9;
150
- } else t9 = $[16];
151
- let t10;
152
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
153
- t10 = /* @__PURE__ */ jsxs(Alert, {
154
- variant: "warning",
155
- children: [/* @__PURE__ */ jsx(TriangleAlert, {}), /* @__PURE__ */ jsx(AlertDescription, { children: "Applies to the whole site, including Live and every draft." })]
156
- });
157
- $[17] = t10;
158
- } else t10 = $[17];
159
- let t11;
160
- if ($[18] !== rows || $[19] !== save.isPending || $[20] !== showErrors) {
161
- let t12;
162
- if ($[22] !== rows.length || $[23] !== save.isPending || $[24] !== showErrors) {
163
- t12 = (entry_4, index_0) => {
164
- const error_0 = showErrors && entry_4.url.trim() ? errorOf(entry_4.url) : void 0;
165
- return /* @__PURE__ */ jsxs("li", {
166
- className: "flex flex-col gap-1",
167
- children: [/* @__PURE__ */ jsxs("div", {
168
- className: "flex items-center gap-1",
169
- children: [
170
- /* @__PURE__ */ jsx(Input, {
171
- type: "url",
172
- value: entry_4.url,
173
- placeholder: "https://www.linkedin.com/company/…",
174
- "aria-label": `Profile ${index_0 + 1}`,
175
- "aria-invalid": error_0 ? true : void 0,
176
- disabled: save.isPending,
177
- onChange: (event_0) => update(entry_4.key, event_0.target.value)
178
- }),
179
- /* @__PURE__ */ jsx(Button, {
180
- type: "button",
181
- variant: "ghost",
182
- size: "icon",
183
- "aria-label": "Move up",
184
- disabled: index_0 === 0 || save.isPending,
185
- onClick: () => move(index_0, -1),
186
- children: /* @__PURE__ */ jsx(ArrowUp, {})
187
- }),
188
- /* @__PURE__ */ jsx(Button, {
189
- type: "button",
190
- variant: "ghost",
191
- size: "icon",
192
- "aria-label": "Move down",
193
- disabled: index_0 === rows.length - 1 || save.isPending,
194
- onClick: () => move(index_0, 1),
195
- children: /* @__PURE__ */ jsx(ArrowDown, {})
196
- }),
197
- /* @__PURE__ */ jsx(Button, {
198
- type: "button",
199
- variant: "ghost",
200
- size: "icon",
201
- "aria-label": "Remove",
202
- disabled: save.isPending,
203
- onClick: () => remove(entry_4.key),
204
- children: /* @__PURE__ */ jsx(Trash2, {})
205
- })
206
- ]
207
- }), error_0 && /* @__PURE__ */ jsx("p", {
208
- className: "text-destructive text-xs",
209
- children: error_0
210
- })]
211
- }, entry_4.key);
212
- };
213
- $[22] = rows.length;
214
- $[23] = save.isPending;
215
- $[24] = showErrors;
216
- $[25] = t12;
217
- } else t12 = $[25];
218
- t11 = rows.map(t12);
219
- $[18] = rows;
220
- $[19] = save.isPending;
221
- $[20] = showErrors;
222
- $[21] = t11;
223
- } else t11 = $[21];
224
- let t12;
225
- if ($[26] !== t11) {
226
- t12 = /* @__PURE__ */ jsx("ol", {
227
- className: "flex flex-col gap-2",
228
- children: t11
229
- });
230
- $[26] = t11;
231
- $[27] = t12;
232
- } else t12 = $[27];
233
- let t13;
234
- let t14;
235
- if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
236
- t13 = () => setRows(_temp6);
237
- t14 = /* @__PURE__ */ jsx(Plus, {});
238
- $[28] = t13;
239
- $[29] = t14;
240
- } else {
241
- t13 = $[28];
242
- t14 = $[29];
243
- }
244
- let t15;
245
- if ($[30] !== save.isPending) {
246
- t15 = /* @__PURE__ */ jsxs(Button, {
247
- type: "button",
248
- variant: "ghost",
249
- className: "sm:mr-auto",
250
- disabled: save.isPending,
251
- onClick: t13,
252
- children: [t14, "Add profile"]
253
- });
254
- $[30] = save.isPending;
255
- $[31] = t15;
256
- } else t15 = $[31];
257
- let t16;
258
- if ($[32] !== save.isPending) {
259
- t16 = /* @__PURE__ */ jsx(DialogClose, {
260
- render: /* @__PURE__ */ jsx(Button, {
261
- type: "button",
262
- variant: "outline",
263
- disabled: save.isPending
264
- }),
265
- children: "Cancel"
266
- });
267
- $[32] = save.isPending;
268
- $[33] = t16;
269
- } else t16 = $[33];
270
- let t17;
271
- if ($[34] !== save.isPending) {
272
- t17 = save.isPending && /* @__PURE__ */ jsx(Spinner, {});
273
- $[34] = save.isPending;
274
- $[35] = t17;
275
- } else t17 = $[35];
276
- let t18;
277
- if ($[36] !== save.isPending || $[37] !== t17) {
278
- t18 = /* @__PURE__ */ jsxs(Button, {
279
- type: "submit",
280
- disabled: save.isPending,
281
- children: [t17, "Save"]
282
- });
283
- $[36] = save.isPending;
284
- $[37] = t17;
285
- $[38] = t18;
286
- } else t18 = $[38];
287
- let t19;
288
- if ($[39] !== t15 || $[40] !== t16 || $[41] !== t18) {
289
- t19 = /* @__PURE__ */ jsxs(DialogFooter, { children: [
290
- t15,
291
- t16,
292
- t18
293
- ] });
294
- $[39] = t15;
295
- $[40] = t16;
296
- $[41] = t18;
297
- $[42] = t19;
298
- } else t19 = $[42];
299
- let t20;
300
- if ($[43] !== submit || $[44] !== t12 || $[45] !== t19) {
301
- t20 = /* @__PURE__ */ jsxs("form", {
302
- onSubmit: submit,
303
- className: "contents",
304
- children: [
305
- t9,
306
- t10,
307
- t12,
308
- t19
309
- ]
310
- });
311
- $[43] = submit;
312
- $[44] = t12;
313
- $[45] = t19;
314
- $[46] = t20;
315
- } else t20 = $[46];
316
- return t20;
317
- }
318
- function _temp6(current_2) {
319
- return [...current_2, row("")];
320
- }
321
- function _temp5(entry_3) {
322
- return entry_3.url;
323
- }
324
- function _temp4(url) {
325
- const result = socialProfileUrlSchema.safeParse(url.trim());
326
- return result.success ? void 0 : result.error.issues[0]?.message;
327
- }
328
- function _temp3(e) {
329
- return e.url;
330
- }
331
- function _temp2(entry) {
332
- return {
333
- ...entry,
334
- url: entry.url.trim()
335
- };
336
- }
337
- function _temp(error) {
338
- toast.error(error.message || "Could not save the social profiles");
339
- }
340
-
341
- //#endregion
342
- export { SocialProfilesDialog };