camox 0.22.0 → 0.24.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.
- package/dist/core/createApp.d.ts +96 -60
- package/dist/core/createBlock.d.ts +58 -232
- package/dist/core/createBlock.js +47 -38
- package/dist/core/lib/contentType.d.ts +44 -24
- package/dist/core/lib/contentType.js +55 -29
- package/dist/core/lib/fieldTypes.js +28 -16
- package/dist/core/lib/imageTransform.js +76 -0
- package/dist/features/content/CamoxContent.js +3 -3
- package/dist/features/content/components/AssetCard.js +124 -77
- package/dist/features/preview/CamoxPreview.d.ts +2 -0
- package/dist/features/preview/components/AssetFieldEditor.js +10 -5
- package/dist/features/preview/components/AssetLightbox.js +197 -13
- package/dist/features/preview/components/EditPageModal.js +244 -74
- package/dist/features/preview/components/ItemFieldsEditor.js +8 -9
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +49 -42
- package/dist/features/preview/components/PageContentSheet.js +2 -3
- package/dist/features/preview/components/PageTree.js +66 -68
- package/dist/features/preview/components/useRepeatableItemActions.js +5 -5
- package/dist/features/routes/pageRoute.d.ts +2 -0
- package/dist/features/routes/pageRoute.js +5 -4
- package/dist/lib/normalized-data.js +6 -4
- package/dist/lib/queries.js +33 -2
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/skills/camox-block/SKILL.md +38 -30
- package/skills/camox-cli/SKILL.md +40 -4
|
@@ -24,9 +24,9 @@ import { Accordion } from "@base-ui/react/accordion";
|
|
|
24
24
|
//#region src/features/preview/components/PageTree.tsx
|
|
25
25
|
function useEmbedTitle(url) {
|
|
26
26
|
const $ = c(4);
|
|
27
|
-
if ($[0] !== "
|
|
27
|
+
if ($[0] !== "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87") {
|
|
28
28
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
29
|
-
$[0] = "
|
|
29
|
+
$[0] = "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87";
|
|
30
30
|
}
|
|
31
31
|
const [title, setTitle] = React.useState(null);
|
|
32
32
|
let t0;
|
|
@@ -58,12 +58,12 @@ function _temp(res) {
|
|
|
58
58
|
return res.text();
|
|
59
59
|
}
|
|
60
60
|
const FieldItem = (t0) => {
|
|
61
|
-
const $ = c(
|
|
62
|
-
if ($[0] !== "
|
|
63
|
-
for (let $i = 0; $i <
|
|
64
|
-
$[0] = "
|
|
61
|
+
const $ = c(29);
|
|
62
|
+
if ($[0] !== "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87") {
|
|
63
|
+
for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
64
|
+
$[0] = "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87";
|
|
65
65
|
}
|
|
66
|
-
const { fieldName, value, fieldType, schemaTitle,
|
|
66
|
+
const { fieldName, value, fieldType, schemaTitle, isSelected, onFieldClick, onFieldDoubleClick, onMouseEnter, onMouseLeave } = t0;
|
|
67
67
|
const fetchedEmbedTitle = useEmbedTitle(fieldType === "Embed" ? value : null);
|
|
68
68
|
const fieldDef = fieldType != null ? fieldTypesDictionary[fieldType] : null;
|
|
69
69
|
let t1;
|
|
@@ -82,51 +82,50 @@ const FieldItem = (t0) => {
|
|
|
82
82
|
} else t1 = $[6];
|
|
83
83
|
const displayValue = t1;
|
|
84
84
|
let t2;
|
|
85
|
-
if ($[7] !==
|
|
86
|
-
t2 = fieldDef?.getIcon(
|
|
87
|
-
$[7] =
|
|
88
|
-
$[8] =
|
|
89
|
-
|
|
90
|
-
} else t2 = $[9];
|
|
85
|
+
if ($[7] !== fieldDef) {
|
|
86
|
+
t2 = fieldDef?.getIcon() ?? Type;
|
|
87
|
+
$[7] = fieldDef;
|
|
88
|
+
$[8] = t2;
|
|
89
|
+
} else t2 = $[8];
|
|
91
90
|
const FieldIcon = t2;
|
|
92
91
|
const t3 = isSelected ? "bg-accent" : "hover:bg-accent/75";
|
|
93
92
|
let t4;
|
|
94
|
-
if ($[
|
|
93
|
+
if ($[9] !== t3) {
|
|
95
94
|
t4 = cn("flex items-center gap-1.5 rounded-lg pl-2 pr-1 py-2 cursor-default group/field", t3);
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
} else t4 = $[
|
|
95
|
+
$[9] = t3;
|
|
96
|
+
$[10] = t4;
|
|
97
|
+
} else t4 = $[10];
|
|
99
98
|
let t5;
|
|
100
|
-
if ($[
|
|
99
|
+
if ($[11] !== fieldType || $[12] !== onFieldClick) {
|
|
101
100
|
t5 = () => fieldType && onFieldClick();
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
} else t5 = $[
|
|
101
|
+
$[11] = fieldType;
|
|
102
|
+
$[12] = onFieldClick;
|
|
103
|
+
$[13] = t5;
|
|
104
|
+
} else t5 = $[13];
|
|
106
105
|
let t6;
|
|
107
|
-
if ($[
|
|
106
|
+
if ($[14] !== fieldType || $[15] !== onFieldDoubleClick) {
|
|
108
107
|
t6 = () => fieldType && onFieldDoubleClick();
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
} else t6 = $[
|
|
108
|
+
$[14] = fieldType;
|
|
109
|
+
$[15] = onFieldDoubleClick;
|
|
110
|
+
$[16] = t6;
|
|
111
|
+
} else t6 = $[16];
|
|
113
112
|
let t7;
|
|
114
|
-
if ($[
|
|
113
|
+
if ($[17] !== FieldIcon) {
|
|
115
114
|
t7 = /* @__PURE__ */ jsx(FieldIcon, { className: "size-4 shrink-0" });
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
} else t7 = $[
|
|
115
|
+
$[17] = FieldIcon;
|
|
116
|
+
$[18] = t7;
|
|
117
|
+
} else t7 = $[18];
|
|
119
118
|
let t8;
|
|
120
|
-
if ($[
|
|
119
|
+
if ($[19] !== displayValue) {
|
|
121
120
|
t8 = /* @__PURE__ */ jsx("span", {
|
|
122
121
|
className: "text-accent-foreground truncate select-none",
|
|
123
122
|
children: displayValue
|
|
124
123
|
});
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
} else t8 = $[
|
|
124
|
+
$[19] = displayValue;
|
|
125
|
+
$[20] = t8;
|
|
126
|
+
} else t8 = $[20];
|
|
128
127
|
let t9;
|
|
129
|
-
if ($[
|
|
128
|
+
if ($[21] !== onMouseEnter || $[22] !== onMouseLeave || $[23] !== t4 || $[24] !== t5 || $[25] !== t6 || $[26] !== t7 || $[27] !== t8) {
|
|
130
129
|
t9 = /* @__PURE__ */ jsxs("li", {
|
|
131
130
|
className: t4,
|
|
132
131
|
onClick: t5,
|
|
@@ -135,22 +134,22 @@ const FieldItem = (t0) => {
|
|
|
135
134
|
onMouseLeave,
|
|
136
135
|
children: [t7, t8]
|
|
137
136
|
});
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
} else t9 = $[
|
|
137
|
+
$[21] = onMouseEnter;
|
|
138
|
+
$[22] = onMouseLeave;
|
|
139
|
+
$[23] = t4;
|
|
140
|
+
$[24] = t5;
|
|
141
|
+
$[25] = t6;
|
|
142
|
+
$[26] = t7;
|
|
143
|
+
$[27] = t8;
|
|
144
|
+
$[28] = t9;
|
|
145
|
+
} else t9 = $[28];
|
|
147
146
|
return t9;
|
|
148
147
|
};
|
|
149
148
|
const BlockFields = (t0) => {
|
|
150
149
|
const $ = c(5);
|
|
151
|
-
if ($[0] !== "
|
|
150
|
+
if ($[0] !== "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87") {
|
|
152
151
|
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
153
|
-
$[0] = "
|
|
152
|
+
$[0] = "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87";
|
|
154
153
|
}
|
|
155
154
|
const { block } = t0;
|
|
156
155
|
const schemaProperties = useCamoxApp().getBlockById(block.type)?._internal.contentSchema.properties;
|
|
@@ -179,11 +178,11 @@ const BlockFields = (t0) => {
|
|
|
179
178
|
fieldType
|
|
180
179
|
});
|
|
181
180
|
};
|
|
182
|
-
const handleFieldDoubleClick = (fieldName_0, fieldType_0
|
|
181
|
+
const handleFieldDoubleClick = (fieldName_0, fieldType_0) => {
|
|
183
182
|
fieldTypesDictionary[fieldType_0].onTreeDoubleClick({
|
|
184
183
|
blockId: block.id,
|
|
185
184
|
fieldName: fieldName_0
|
|
186
|
-
}
|
|
185
|
+
});
|
|
187
186
|
};
|
|
188
187
|
const handleFieldMouseEnter = (fieldName_1, isRepeatable) => {
|
|
189
188
|
if (!iframeElement?.contentWindow) return;
|
|
@@ -225,16 +224,15 @@ const BlockFields = (t0) => {
|
|
|
225
224
|
const fieldSchema = schemaProperties?.[fieldName_3];
|
|
226
225
|
if (!fieldSchema) return null;
|
|
227
226
|
const fieldType_1 = fieldSchema.fieldType;
|
|
228
|
-
const isRepeatable_1 = fieldType_1 === "
|
|
227
|
+
const isRepeatable_1 = fieldType_1 === "Repeater";
|
|
229
228
|
return /* @__PURE__ */ jsx(FieldItem, {
|
|
230
229
|
fieldName: fieldName_3,
|
|
231
230
|
value,
|
|
232
231
|
fieldType: fieldType_1,
|
|
233
232
|
schemaTitle: fieldSchema?.title,
|
|
234
|
-
arrayItemType: fieldSchema?.arrayItemType,
|
|
235
233
|
isSelected: selectedFieldName === fieldName_3,
|
|
236
234
|
onFieldClick: () => handleFieldClick(fieldName_3, fieldType_1),
|
|
237
|
-
onFieldDoubleClick: () => handleFieldDoubleClick(fieldName_3, fieldType_1
|
|
235
|
+
onFieldDoubleClick: () => handleFieldDoubleClick(fieldName_3, fieldType_1),
|
|
238
236
|
onMouseEnter: () => handleFieldMouseEnter(fieldName_3, isRepeatable_1),
|
|
239
237
|
onMouseLeave: () => handleFieldMouseLeave(fieldName_3, isRepeatable_1)
|
|
240
238
|
}, fieldName_3);
|
|
@@ -252,9 +250,9 @@ const BlockFields = (t0) => {
|
|
|
252
250
|
};
|
|
253
251
|
function useBlockTreeItem(block, t0) {
|
|
254
252
|
const $ = c(17);
|
|
255
|
-
if ($[0] !== "
|
|
253
|
+
if ($[0] !== "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87") {
|
|
256
254
|
for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
257
|
-
$[0] = "
|
|
255
|
+
$[0] = "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87";
|
|
258
256
|
}
|
|
259
257
|
const isDragging = t0 === void 0 ? false : t0;
|
|
260
258
|
const [ellipsisPopoverOpen, setEllipsisPopoverOpen] = React.useState(false);
|
|
@@ -336,9 +334,9 @@ function _temp6(state) {
|
|
|
336
334
|
}
|
|
337
335
|
const BlockTreeItemHeader = (t0) => {
|
|
338
336
|
const $ = c(17);
|
|
339
|
-
if ($[0] !== "
|
|
337
|
+
if ($[0] !== "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87") {
|
|
340
338
|
for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
341
|
-
$[0] = "
|
|
339
|
+
$[0] = "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87";
|
|
342
340
|
}
|
|
343
341
|
let children;
|
|
344
342
|
let className;
|
|
@@ -391,9 +389,9 @@ const BlockTreeItemHeader = (t0) => {
|
|
|
391
389
|
};
|
|
392
390
|
const BlockTreeItemTrigger = (t0) => {
|
|
393
391
|
const $ = c(5);
|
|
394
|
-
if ($[0] !== "
|
|
392
|
+
if ($[0] !== "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87") {
|
|
395
393
|
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
396
|
-
$[0] = "
|
|
394
|
+
$[0] = "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87";
|
|
397
395
|
}
|
|
398
396
|
const { displayText, onClick } = t0;
|
|
399
397
|
let t1;
|
|
@@ -420,9 +418,9 @@ const BlockTreeItemTrigger = (t0) => {
|
|
|
420
418
|
};
|
|
421
419
|
const BlockTreeItemEllipsis = (t0) => {
|
|
422
420
|
const $ = c(12);
|
|
423
|
-
if ($[0] !== "
|
|
421
|
+
if ($[0] !== "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87") {
|
|
424
422
|
for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
425
|
-
$[0] = "
|
|
423
|
+
$[0] = "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87";
|
|
426
424
|
}
|
|
427
425
|
let className;
|
|
428
426
|
let open;
|
|
@@ -468,9 +466,9 @@ const BlockTreeItemEllipsis = (t0) => {
|
|
|
468
466
|
};
|
|
469
467
|
const BlockTreeItemContent = (t0) => {
|
|
470
468
|
const $ = c(3);
|
|
471
|
-
if ($[0] !== "
|
|
469
|
+
if ($[0] !== "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87") {
|
|
472
470
|
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
473
|
-
$[0] = "
|
|
471
|
+
$[0] = "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87";
|
|
474
472
|
}
|
|
475
473
|
const { block } = t0;
|
|
476
474
|
let t1;
|
|
@@ -491,9 +489,9 @@ const animateLayoutChanges = (args) => {
|
|
|
491
489
|
};
|
|
492
490
|
const SortableBlock = (t0) => {
|
|
493
491
|
const $ = c(53);
|
|
494
|
-
if ($[0] !== "
|
|
492
|
+
if ($[0] !== "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87") {
|
|
495
493
|
for (let $i = 0; $i < 53; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
496
|
-
$[0] = "
|
|
494
|
+
$[0] = "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87";
|
|
497
495
|
}
|
|
498
496
|
const { block } = t0;
|
|
499
497
|
const [gripPopoverOpen, setGripPopoverOpen] = React.useState(false);
|
|
@@ -682,9 +680,9 @@ const SortableBlock = (t0) => {
|
|
|
682
680
|
};
|
|
683
681
|
const LayoutBlockItem = (t0) => {
|
|
684
682
|
const $ = c(44);
|
|
685
|
-
if ($[0] !== "
|
|
683
|
+
if ($[0] !== "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87") {
|
|
686
684
|
for (let $i = 0; $i < 44; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
687
|
-
$[0] = "
|
|
685
|
+
$[0] = "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87";
|
|
688
686
|
}
|
|
689
687
|
const { block, layoutName } = t0;
|
|
690
688
|
const camoxApp = useCamoxApp();
|
|
@@ -843,9 +841,9 @@ const LayoutBlockItem = (t0) => {
|
|
|
843
841
|
};
|
|
844
842
|
const PageTree = () => {
|
|
845
843
|
const $ = c(47);
|
|
846
|
-
if ($[0] !== "
|
|
844
|
+
if ($[0] !== "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87") {
|
|
847
845
|
for (let $i = 0; $i < 47; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
848
|
-
$[0] = "
|
|
846
|
+
$[0] = "93644338051da8a2fc7d6bcaeba79afa786571ac097e7be02bb6bea0e96d3c87";
|
|
849
847
|
}
|
|
850
848
|
const page = usePreviewedPage();
|
|
851
849
|
const { pageBlocks, beforeBlocks: layoutBeforeBlocks, afterBlocks: layoutAfterBlocks } = usePageBlocks(page);
|
|
@@ -23,7 +23,7 @@ const buildNestedItemSeeds = (itemProperties) => {
|
|
|
23
23
|
const recurse = (properties, parentTempId) => {
|
|
24
24
|
for (const [fieldName, fieldSchema] of Object.entries(properties)) {
|
|
25
25
|
if (fieldSchema.type !== "array" || !fieldSchema.items?.properties) continue;
|
|
26
|
-
if (fieldSchema.fieldType === "
|
|
26
|
+
if (fieldSchema.fieldType === "ImageList" || fieldSchema.fieldType === "FileList") continue;
|
|
27
27
|
const defaultCount = fieldSchema.defaultItems ?? fieldSchema.minItems ?? 0;
|
|
28
28
|
if (defaultCount <= 0) continue;
|
|
29
29
|
const nestedItemProps = fieldSchema.items.properties;
|
|
@@ -51,9 +51,9 @@ const buildNestedItemSeeds = (itemProperties) => {
|
|
|
51
51
|
};
|
|
52
52
|
const useRepeatableItemActions = (t0) => {
|
|
53
53
|
const $ = c(16);
|
|
54
|
-
if ($[0] !== "
|
|
54
|
+
if ($[0] !== "d693f3f98b78f44d12370cd285b6b90b102d5a7113c502e626ffcfe13f24976a") {
|
|
55
55
|
for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
56
|
-
$[0] = "
|
|
56
|
+
$[0] = "d693f3f98b78f44d12370cd285b6b90b102d5a7113c502e626ffcfe13f24976a";
|
|
57
57
|
}
|
|
58
58
|
const { blockId, fieldName, parentItemId, arraySchema, siblingCount } = t0;
|
|
59
59
|
let t1;
|
|
@@ -151,9 +151,9 @@ const getArraySchemaForItem = (contentSchema, itemId, itemsMap) => {
|
|
|
151
151
|
*/
|
|
152
152
|
const useCurrentItemActions = (blockId, itemId) => {
|
|
153
153
|
const $ = c(27);
|
|
154
|
-
if ($[0] !== "
|
|
154
|
+
if ($[0] !== "d693f3f98b78f44d12370cd285b6b90b102d5a7113c502e626ffcfe13f24976a") {
|
|
155
155
|
for (let $i = 0; $i < 27; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
156
|
-
$[0] = "
|
|
156
|
+
$[0] = "d693f3f98b78f44d12370cd285b6b90b102d5a7113c502e626ffcfe13f24976a";
|
|
157
157
|
}
|
|
158
158
|
const camoxApp = useCamoxApp();
|
|
159
159
|
let t0;
|
|
@@ -33,6 +33,8 @@ declare function createPageLoader(apiUrl: string, projectSlug: string, environme
|
|
|
33
33
|
metaTitle: string | null;
|
|
34
34
|
metaDescription: string | null;
|
|
35
35
|
aiSeoEnabled: boolean | null;
|
|
36
|
+
customOgImageBlobId: string | null;
|
|
37
|
+
customOgImageUrl: string | null;
|
|
36
38
|
createdAt: number;
|
|
37
39
|
updatedAt: number;
|
|
38
40
|
};
|
|
@@ -117,12 +117,13 @@ function createPageHead(camoxApp) {
|
|
|
117
117
|
name: "description",
|
|
118
118
|
content: page.page.metaDescription
|
|
119
119
|
});
|
|
120
|
-
const
|
|
120
|
+
const ogImageParams = new URLSearchParams({
|
|
121
121
|
...page.layout && { layoutId: page.layout.layoutId },
|
|
122
122
|
title: pageMetaTitle,
|
|
123
123
|
...page.page.metaDescription && { description: page.page.metaDescription },
|
|
124
124
|
...page.projectName && { projectName: page.projectName }
|
|
125
|
-
})
|
|
125
|
+
});
|
|
126
|
+
const ogImageUrl = page.page.customOgImageUrl ?? `${origin}/og?${ogImageParams.toString()}`;
|
|
126
127
|
meta.push({
|
|
127
128
|
property: "og:title",
|
|
128
129
|
content: title
|
|
@@ -151,9 +152,9 @@ function createPageHead(camoxApp) {
|
|
|
151
152
|
}
|
|
152
153
|
const PageRouteComponent = () => {
|
|
153
154
|
const $ = c(2);
|
|
154
|
-
if ($[0] !== "
|
|
155
|
+
if ($[0] !== "858ec55c5e5a82d2aa9c37c6b5b7f1c0a2d1cff69ec415b2b53199f5bf1faa69") {
|
|
155
156
|
for (let $i = 0; $i < 2; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
156
|
-
$[0] = "
|
|
157
|
+
$[0] = "858ec55c5e5a82d2aa9c37c6b5b7f1c0a2d1cff69ec415b2b53199f5bf1faa69";
|
|
157
158
|
}
|
|
158
159
|
let t0;
|
|
159
160
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -11,9 +11,9 @@ const NormalizedDataContext = React.createContext({
|
|
|
11
11
|
});
|
|
12
12
|
const NormalizedDataProvider = (t0) => {
|
|
13
13
|
const $ = c(13);
|
|
14
|
-
if ($[0] !== "
|
|
14
|
+
if ($[0] !== "c508cbfbcda1ea1312463b6cbebcd66332f3346f51c02c09c35687c430a19469") {
|
|
15
15
|
for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
16
|
-
$[0] = "
|
|
16
|
+
$[0] = "c508cbfbcda1ea1312463b6cbebcd66332f3346f51c02c09c35687c430a19469";
|
|
17
17
|
}
|
|
18
18
|
const { files, repeatableItems, children } = t0;
|
|
19
19
|
let t1;
|
|
@@ -74,9 +74,9 @@ function useStableArray(next) {
|
|
|
74
74
|
}
|
|
75
75
|
function usePageBlocks(pageStructure) {
|
|
76
76
|
const $ = c(36);
|
|
77
|
-
if ($[0] !== "
|
|
77
|
+
if ($[0] !== "c508cbfbcda1ea1312463b6cbebcd66332f3346f51c02c09c35687c430a19469") {
|
|
78
78
|
for (let $i = 0; $i < 36; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
79
|
-
$[0] = "
|
|
79
|
+
$[0] = "c508cbfbcda1ea1312463b6cbebcd66332f3346f51c02c09c35687c430a19469";
|
|
80
80
|
}
|
|
81
81
|
const blockIds = pageStructure.page.blockIds;
|
|
82
82
|
const beforeIds = pageStructure.layout?.beforeBlockIds ?? EMPTY_IDS;
|
|
@@ -239,6 +239,7 @@ function resolveFileMarker(marker, filesMap) {
|
|
|
239
239
|
alt: file.alt,
|
|
240
240
|
filename: file.filename,
|
|
241
241
|
mimeType: file.mimeType,
|
|
242
|
+
size: file.size,
|
|
242
243
|
_fileId: marker._fileId
|
|
243
244
|
};
|
|
244
245
|
return {
|
|
@@ -246,6 +247,7 @@ function resolveFileMarker(marker, filesMap) {
|
|
|
246
247
|
alt: "",
|
|
247
248
|
filename: "",
|
|
248
249
|
mimeType: "",
|
|
250
|
+
size: 0,
|
|
249
251
|
_fileId: marker._fileId
|
|
250
252
|
};
|
|
251
253
|
}
|
package/dist/lib/queries.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getAuthCookieHeader } from "./auth.js";
|
|
2
|
+
import { getApiUrl, getEnvironmentName, getOrpc } from "./api-client.js";
|
|
2
3
|
import { queryKeys } from "@camox/api-contract/query-keys";
|
|
3
4
|
|
|
4
5
|
//#region src/lib/queries.ts
|
|
@@ -124,6 +125,12 @@ const repeatableItemMutations = {
|
|
|
124
125
|
updateSettings: () => getOrpc().repeatableItems.updateSettings.mutationOptions(),
|
|
125
126
|
updatePosition: () => getOrpc().repeatableItems.updatePosition.mutationOptions()
|
|
126
127
|
};
|
|
128
|
+
function ogImageHeaders() {
|
|
129
|
+
const headers = { "Better-Auth-Cookie": getAuthCookieHeader() };
|
|
130
|
+
const envName = getEnvironmentName();
|
|
131
|
+
if (envName) headers["x-environment-name"] = envName;
|
|
132
|
+
return headers;
|
|
133
|
+
}
|
|
127
134
|
const pageMutations = {
|
|
128
135
|
create: () => getOrpc().pages.create.mutationOptions(),
|
|
129
136
|
delete: () => getOrpc().pages.delete.mutationOptions(),
|
|
@@ -131,7 +138,31 @@ const pageMutations = {
|
|
|
131
138
|
setLayout: () => getOrpc().pages.setLayout.mutationOptions(),
|
|
132
139
|
setAiSeo: () => getOrpc().pages.setAiSeo.mutationOptions(),
|
|
133
140
|
setMetaTitle: () => getOrpc().pages.setMetaTitle.mutationOptions(),
|
|
134
|
-
setMetaDescription: () => getOrpc().pages.setMetaDescription.mutationOptions()
|
|
141
|
+
setMetaDescription: () => getOrpc().pages.setMetaDescription.mutationOptions(),
|
|
142
|
+
uploadCustomOgImage: () => ({ mutationFn: async ({ pageId, file }) => {
|
|
143
|
+
const formData = new FormData();
|
|
144
|
+
formData.append("file", file);
|
|
145
|
+
const res = await fetch(`${getApiUrl()}/pages/${pageId}/og-image`, {
|
|
146
|
+
method: "POST",
|
|
147
|
+
body: formData,
|
|
148
|
+
headers: ogImageHeaders(),
|
|
149
|
+
credentials: "omit"
|
|
150
|
+
});
|
|
151
|
+
if (!res.ok) {
|
|
152
|
+
const body = await res.json().catch(() => null);
|
|
153
|
+
throw new Error(body?.error ?? `Upload failed: ${res.status}`);
|
|
154
|
+
}
|
|
155
|
+
return res.json();
|
|
156
|
+
} }),
|
|
157
|
+
deleteCustomOgImage: () => ({ mutationFn: async ({ pageId }) => {
|
|
158
|
+
const res = await fetch(`${getApiUrl()}/pages/${pageId}/og-image`, {
|
|
159
|
+
method: "DELETE",
|
|
160
|
+
headers: ogImageHeaders(),
|
|
161
|
+
credentials: "omit"
|
|
162
|
+
});
|
|
163
|
+
if (!res.ok) throw new Error(`Delete failed: ${res.status}`);
|
|
164
|
+
return res.json();
|
|
165
|
+
} })
|
|
135
166
|
};
|
|
136
167
|
const fileMutations = {
|
|
137
168
|
delete: () => getOrpc().files.delete.mutationOptions(),
|