@orion-studios/payload-studio 0.5.0-beta.11 → 0.5.0-beta.111

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 (77) hide show
  1. package/README.md +54 -0
  2. package/dist/admin/client.d.mts +3 -0
  3. package/dist/admin/client.d.ts +3 -0
  4. package/dist/admin/client.js +1745 -200
  5. package/dist/admin/client.mjs +1756 -214
  6. package/dist/admin/index.d.mts +2 -1
  7. package/dist/admin/index.d.ts +2 -1
  8. package/dist/admin/index.js +424 -11
  9. package/dist/admin/index.mjs +19 -1
  10. package/dist/admin-app/client.d.mts +7 -0
  11. package/dist/admin-app/client.d.ts +7 -0
  12. package/dist/admin-app/client.js +1270 -3
  13. package/dist/admin-app/client.mjs +1172 -2
  14. package/dist/admin-app/index.d.mts +1 -1
  15. package/dist/admin-app/index.d.ts +1 -1
  16. package/dist/admin-app/index.js +167 -0
  17. package/dist/admin-app/index.mjs +13 -1
  18. package/dist/admin-app/styles.css +247 -0
  19. package/dist/admin.css +8 -0
  20. package/dist/blocks/index.js +1011 -191
  21. package/dist/blocks/index.mjs +2 -2
  22. package/dist/chunk-ADIIWIYL.mjs +322 -0
  23. package/dist/{chunk-ZLLNO5FM.mjs → chunk-BET2YLAS.mjs} +104 -15
  24. package/dist/chunk-DAIZDGHL.mjs +614 -0
  25. package/dist/chunk-GKMBYYXF.mjs +776 -0
  26. package/dist/chunk-JQAHXYAM.mjs +1829 -0
  27. package/dist/chunk-OQSEJXC4.mjs +166 -0
  28. package/dist/chunk-PF3EBZXF.mjs +326 -0
  29. package/dist/chunk-ROTPP5CU.mjs +99 -0
  30. package/dist/chunk-XVH5SCBD.mjs +234 -0
  31. package/dist/chunk-ZTXJG4K5.mjs +85 -0
  32. package/dist/index-7lxTrxSG.d.mts +128 -0
  33. package/dist/index-7lxTrxSG.d.ts +128 -0
  34. package/dist/index-B7QvY3yF.d.mts +245 -0
  35. package/dist/index-BK03FiEM.d.ts +245 -0
  36. package/dist/{index-CmR6NInu.d.ts → index-BzKOThsI.d.mts} +30 -3
  37. package/dist/{index-CmR6NInu.d.mts → index-BzKOThsI.d.ts} +30 -3
  38. package/dist/{index-DbH0Ljwp.d.mts → index-D8BNfUJb.d.mts} +17 -2
  39. package/dist/{index-DbH0Ljwp.d.ts → index-DD_E2UfJ.d.ts} +17 -2
  40. package/dist/index-DUi_XND6.d.ts +193 -0
  41. package/dist/index-gLl_358v.d.mts +193 -0
  42. package/dist/index.d.mts +6 -5
  43. package/dist/index.d.ts +6 -5
  44. package/dist/index.js +2876 -460
  45. package/dist/index.mjs +12 -10
  46. package/dist/nextjs/index.d.mts +2 -1
  47. package/dist/nextjs/index.d.ts +2 -1
  48. package/dist/nextjs/index.js +497 -16
  49. package/dist/nextjs/index.mjs +8 -3
  50. package/dist/socialMedia-C05Iy-SV.d.mts +21 -0
  51. package/dist/socialMedia-C05Iy-SV.d.ts +21 -0
  52. package/dist/studio/index.d.mts +2 -1
  53. package/dist/studio/index.d.ts +2 -1
  54. package/dist/studio/index.js +171 -5
  55. package/dist/studio/index.mjs +7 -3
  56. package/dist/studio-pages/builder.css +517 -32
  57. package/dist/studio-pages/client.d.mts +75 -1
  58. package/dist/studio-pages/client.d.ts +75 -1
  59. package/dist/studio-pages/client.js +5662 -2759
  60. package/dist/studio-pages/client.mjs +5578 -2767
  61. package/dist/studio-pages/index.d.mts +4 -2
  62. package/dist/studio-pages/index.d.ts +4 -2
  63. package/dist/studio-pages/index.js +859 -71
  64. package/dist/studio-pages/index.mjs +10 -4
  65. package/package.json +35 -13
  66. package/dist/chunk-AAOHJDNS.mjs +0 -67
  67. package/dist/chunk-ETRRXURT.mjs +0 -141
  68. package/dist/chunk-J7W5EE3B.mjs +0 -278
  69. package/dist/chunk-N67KVM2S.mjs +0 -156
  70. package/dist/chunk-NESLJZFE.mjs +0 -303
  71. package/dist/chunk-U5BSPWAD.mjs +0 -1034
  72. package/dist/index-B9N5MyjF.d.mts +0 -39
  73. package/dist/index-BallJs-K.d.mts +0 -43
  74. package/dist/index-BallJs-K.d.ts +0 -43
  75. package/dist/index-DJFhANvJ.d.mts +0 -128
  76. package/dist/index-DJFhANvJ.d.ts +0 -128
  77. package/dist/index-g8tBHLKD.d.ts +0 -39
package/dist/index.mjs CHANGED
@@ -1,22 +1,24 @@
1
- import {
2
- admin_app_exports
3
- } from "./chunk-AAOHJDNS.mjs";
4
1
  import {
5
2
  admin_exports
6
- } from "./chunk-J7W5EE3B.mjs";
3
+ } from "./chunk-DAIZDGHL.mjs";
7
4
  import {
8
- studio_exports
9
- } from "./chunk-N67KVM2S.mjs";
5
+ admin_app_exports
6
+ } from "./chunk-XVH5SCBD.mjs";
10
7
  import {
11
8
  blocks_exports
12
- } from "./chunk-U5BSPWAD.mjs";
9
+ } from "./chunk-JQAHXYAM.mjs";
13
10
  import {
14
11
  nextjs_exports
15
- } from "./chunk-ZLLNO5FM.mjs";
12
+ } from "./chunk-BET2YLAS.mjs";
13
+ import "./chunk-ZTXJG4K5.mjs";
14
+ import {
15
+ studio_exports
16
+ } from "./chunk-ADIIWIYL.mjs";
16
17
  import {
17
18
  studio_pages_exports
18
- } from "./chunk-NESLJZFE.mjs";
19
- import "./chunk-ETRRXURT.mjs";
19
+ } from "./chunk-GKMBYYXF.mjs";
20
+ import "./chunk-OQSEJXC4.mjs";
21
+ import "./chunk-PF3EBZXF.mjs";
20
22
  import "./chunk-6BWS3CLP.mjs";
21
23
  export {
22
24
  admin_exports as admin,
@@ -1,2 +1,3 @@
1
- export { F as FooterData, H as HeaderData, S as SiteNavItem, a as SiteSettingsData, W as WEBSITE_CONTENT_TAG, c as createPageQueries, b as createPayloadClient, d as createSiteQueries, r as resolveMedia } from '../index-DbH0Ljwp.mjs';
1
+ export { F as FooterData, H as HeaderData, R as ResolvedSocialMediaLink, S as SiteNavItem, a as SiteSettingsData, W as WEBSITE_CONTENT_TAG, c as createPageQueries, b as createPayloadClient, d as createSiteQueries, r as resolveMedia, e as resolveSocialMediaLinks } from '../index-D8BNfUJb.mjs';
2
+ export { S as SocialMediaGlobalData } from '../socialMedia-C05Iy-SV.mjs';
2
3
  import 'payload';
@@ -1,2 +1,3 @@
1
- export { F as FooterData, H as HeaderData, S as SiteNavItem, a as SiteSettingsData, W as WEBSITE_CONTENT_TAG, c as createPageQueries, b as createPayloadClient, d as createSiteQueries, r as resolveMedia } from '../index-DbH0Ljwp.js';
1
+ export { F as FooterData, H as HeaderData, R as ResolvedSocialMediaLink, S as SiteNavItem, a as SiteSettingsData, W as WEBSITE_CONTENT_TAG, c as createPageQueries, b as createPayloadClient, d as createSiteQueries, r as resolveMedia, e as resolveSocialMediaLinks } from '../index-DD_E2UfJ.js';
2
+ export { S as SocialMediaGlobalData } from '../socialMedia-C05Iy-SV.js';
2
3
  import 'payload';
@@ -24,7 +24,8 @@ __export(nextjs_exports, {
24
24
  createPageQueries: () => createPageQueries,
25
25
  createPayloadClient: () => createPayloadClient,
26
26
  createSiteQueries: () => createSiteQueries,
27
- resolveMedia: () => resolveMedia
27
+ resolveMedia: () => resolveMedia,
28
+ resolveSocialMediaLinks: () => resolveSocialMediaLinks
28
29
  });
29
30
  module.exports = __toCommonJS(nextjs_exports);
30
31
 
@@ -43,6 +44,348 @@ function createPayloadClient(config) {
43
44
 
44
45
  // src/nextjs/queries/pages.ts
45
46
  var import_cache = require("next/cache");
47
+
48
+ // src/studio/imageUploadOptimization.ts
49
+ var import_promises = require("fs/promises");
50
+ var DEFAULT_OPTIONS = {
51
+ avifQuality: 50,
52
+ enforceSmallerForLossy: true,
53
+ jpegQuality: 78,
54
+ minBytes: 48 * 1024,
55
+ minQualityFloor: 42,
56
+ onlyIfSmaller: true,
57
+ pngCompressionLevel: 9,
58
+ skipAnimated: true,
59
+ tiffQuality: 75,
60
+ webpQuality: 78
61
+ };
62
+
63
+ // src/studio/index.ts
64
+ var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
65
+ function assertStudioDocumentV1(input) {
66
+ if (!isRecord(input)) {
67
+ throw new Error("Studio document must be an object");
68
+ }
69
+ if (input.schemaVersion !== 1) {
70
+ throw new Error("Unsupported studio schemaVersion");
71
+ }
72
+ if (!Array.isArray(input.nodes)) {
73
+ throw new Error("Studio document nodes must be an array");
74
+ }
75
+ const nodes = input.nodes.map((node, index) => {
76
+ if (!isRecord(node)) {
77
+ throw new Error(`Node at index ${index} must be an object`);
78
+ }
79
+ if (typeof node.id !== "string" || node.id.length === 0) {
80
+ throw new Error(`Node at index ${index} has invalid id`);
81
+ }
82
+ if (typeof node.type !== "string" || node.type.length === 0) {
83
+ throw new Error(`Node at index ${index} has invalid type`);
84
+ }
85
+ if (!isRecord(node.data)) {
86
+ throw new Error(`Node at index ${index} has invalid data`);
87
+ }
88
+ return {
89
+ id: node.id,
90
+ type: node.type,
91
+ data: node.data
92
+ };
93
+ });
94
+ return {
95
+ metadata: isRecord(input.metadata) ? input.metadata : void 0,
96
+ schemaVersion: 1,
97
+ title: typeof input.title === "string" ? input.title : void 0,
98
+ nodes,
99
+ updatedAt: typeof input.updatedAt === "string" ? input.updatedAt : void 0
100
+ };
101
+ }
102
+
103
+ // src/studio-pages/builder/settings-v2/types.ts
104
+ var defaultBuilderBlockSettingsV2 = {
105
+ advanced: {
106
+ customClassName: "",
107
+ editCopyInPanel: false,
108
+ hideOnMobile: false
109
+ },
110
+ appearance: {
111
+ contentBackgroundColor: "#ffffff",
112
+ contentBackgroundMode: "none",
113
+ contentGradientAngle: "135",
114
+ contentGradientFrom: "#ffffff",
115
+ contentGradientPreset: "none",
116
+ contentGradientTo: "#f4f6f8",
117
+ sectionBackgroundColor: "#ffffff",
118
+ sectionBackgroundMode: "none",
119
+ sectionGradientAngle: "135",
120
+ sectionGradientFrom: "#334b63",
121
+ sectionGradientPreset: "slate",
122
+ sectionGradientTo: "#496582"
123
+ },
124
+ layout: {
125
+ contentWidth: "inherit",
126
+ linkHorizontalPadding: true,
127
+ linkVerticalPadding: true,
128
+ paddingBottomPt: null,
129
+ paddingLeftPt: null,
130
+ paddingRightPt: null,
131
+ paddingTopPt: null,
132
+ sectionPaddingX: "inherit",
133
+ sectionPaddingY: "md"
134
+ },
135
+ media: {
136
+ cornerStyle: "rounded",
137
+ fit: "cover",
138
+ height: null,
139
+ position: "center",
140
+ positionX: null,
141
+ positionY: null
142
+ },
143
+ typography: {
144
+ bodyAlign: "left",
145
+ headingAlign: "left",
146
+ letterSpacingPreset: "normal",
147
+ lineHeightPreset: "normal",
148
+ maxTextWidth: "auto"
149
+ },
150
+ version: 2
151
+ };
152
+ var defaultBuilderItemSettingsV2 = {
153
+ layout: {
154
+ contentWidth: "inherit",
155
+ linkHorizontalPadding: true,
156
+ linkVerticalPadding: true,
157
+ paddingBottomPt: null,
158
+ paddingLeftPt: null,
159
+ paddingRightPt: null,
160
+ paddingTopPt: null,
161
+ sectionPaddingX: "inherit",
162
+ sectionPaddingY: "md"
163
+ },
164
+ media: {
165
+ cornerStyle: "rounded",
166
+ fit: "cover",
167
+ height: null,
168
+ position: "center",
169
+ positionX: null,
170
+ positionY: null
171
+ },
172
+ typography: {
173
+ bodyAlign: "left",
174
+ headingAlign: "left",
175
+ letterSpacingPreset: "normal",
176
+ lineHeightPreset: "normal",
177
+ maxTextWidth: "auto"
178
+ },
179
+ version: 2
180
+ };
181
+
182
+ // src/studio-pages/builder/adapters/settingsV2.ts
183
+ var isRecord2 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
184
+ var parsePercent = (value) => {
185
+ if (typeof value === "number" && Number.isFinite(value)) {
186
+ return Math.max(0, Math.min(100, value));
187
+ }
188
+ if (typeof value === "string" && value.trim().length > 0) {
189
+ const parsed = Number(value);
190
+ if (Number.isFinite(parsed)) {
191
+ return Math.max(0, Math.min(100, parsed));
192
+ }
193
+ }
194
+ return null;
195
+ };
196
+ var parsePixel = (value) => {
197
+ if (typeof value === "number" && Number.isFinite(value)) {
198
+ return value;
199
+ }
200
+ if (typeof value === "string" && value.trim().length > 0) {
201
+ const parsed = Number(value);
202
+ if (Number.isFinite(parsed)) {
203
+ return parsed;
204
+ }
205
+ }
206
+ return null;
207
+ };
208
+ var mergeSettings = (defaults, input) => {
209
+ if (!isRecord2(input)) {
210
+ return structuredClone(defaults);
211
+ }
212
+ const next = structuredClone(defaults);
213
+ for (const [key, value] of Object.entries(input)) {
214
+ if (isRecord2(value) && isRecord2(next[key])) {
215
+ next[key] = mergeSettings(next[key], value);
216
+ continue;
217
+ }
218
+ if (typeof value !== "undefined") {
219
+ next[key] = value;
220
+ }
221
+ }
222
+ return next;
223
+ };
224
+ var legacyBlockToV2Settings = (block) => {
225
+ const current = structuredClone(defaultBuilderBlockSettingsV2);
226
+ current.layout.contentWidth = block.contentWidth === "narrow" || block.contentWidth === "content" || block.contentWidth === "wide" || block.contentWidth === "full" || block.contentWidth === "inherit" ? block.contentWidth : current.layout.contentWidth;
227
+ current.layout.sectionPaddingX = block.sectionPaddingX === "none" || block.sectionPaddingX === "sm" || block.sectionPaddingX === "md" || block.sectionPaddingX === "lg" || block.sectionPaddingX === "inherit" ? block.sectionPaddingX : current.layout.sectionPaddingX;
228
+ current.layout.sectionPaddingY = block.sectionPaddingY === "none" || block.sectionPaddingY === "sm" || block.sectionPaddingY === "lg" ? block.sectionPaddingY : current.layout.sectionPaddingY;
229
+ current.appearance.sectionBackgroundMode = block.sectionBackgroundMode === "none" || block.sectionBackgroundMode === "color" || block.sectionBackgroundMode === "gradient" ? block.sectionBackgroundMode : current.appearance.sectionBackgroundMode;
230
+ current.appearance.sectionBackgroundColor = typeof block.sectionBackgroundColor === "string" ? block.sectionBackgroundColor : current.appearance.sectionBackgroundColor;
231
+ current.appearance.sectionGradientPreset = typeof block.sectionGradientPreset === "string" ? block.sectionGradientPreset : current.appearance.sectionGradientPreset;
232
+ current.appearance.sectionGradientFrom = typeof block.sectionGradientFrom === "string" ? block.sectionGradientFrom : current.appearance.sectionGradientFrom;
233
+ current.appearance.sectionGradientTo = typeof block.sectionGradientTo === "string" ? block.sectionGradientTo : current.appearance.sectionGradientTo;
234
+ current.appearance.sectionGradientAngle = typeof block.sectionGradientAngle === "string" ? block.sectionGradientAngle : current.appearance.sectionGradientAngle;
235
+ current.appearance.contentBackgroundMode = block.contentBackgroundMode === "none" || block.contentBackgroundMode === "color" || block.contentBackgroundMode === "gradient" ? block.contentBackgroundMode : current.appearance.contentBackgroundMode;
236
+ current.appearance.contentBackgroundColor = typeof block.contentBackgroundColor === "string" ? block.contentBackgroundColor : current.appearance.contentBackgroundColor;
237
+ current.appearance.contentGradientPreset = typeof block.contentGradientPreset === "string" ? block.contentGradientPreset : current.appearance.contentGradientPreset;
238
+ current.appearance.contentGradientFrom = typeof block.contentGradientFrom === "string" ? block.contentGradientFrom : current.appearance.contentGradientFrom;
239
+ current.appearance.contentGradientTo = typeof block.contentGradientTo === "string" ? block.contentGradientTo : current.appearance.contentGradientTo;
240
+ current.appearance.contentGradientAngle = typeof block.contentGradientAngle === "string" ? block.contentGradientAngle : current.appearance.contentGradientAngle;
241
+ if (block.backgroundImageFit === "cover" || block.backgroundImageFit === "contain") {
242
+ current.media.fit = block.backgroundImageFit;
243
+ }
244
+ if (block.imageFit === "cover" || block.imageFit === "contain") {
245
+ current.media.fit = block.imageFit;
246
+ }
247
+ if (block.backgroundImageCornerStyle === "rounded" || block.backgroundImageCornerStyle === "square") {
248
+ current.media.cornerStyle = block.backgroundImageCornerStyle;
249
+ }
250
+ if (block.imageCornerStyle === "rounded" || block.imageCornerStyle === "square") {
251
+ current.media.cornerStyle = block.imageCornerStyle;
252
+ }
253
+ if (block.backgroundImagePosition === "top" || block.backgroundImagePosition === "bottom" || block.backgroundImagePosition === "left" || block.backgroundImagePosition === "right" || block.backgroundImagePosition === "center") {
254
+ current.media.position = block.backgroundImagePosition;
255
+ }
256
+ if (block.imagePosition === "top" || block.imagePosition === "bottom" || block.imagePosition === "left" || block.imagePosition === "right" || block.imagePosition === "center") {
257
+ current.media.position = block.imagePosition;
258
+ }
259
+ current.media.positionX = parsePercent(block.imagePositionX ?? block.backgroundImagePositionX);
260
+ current.media.positionY = parsePercent(block.imagePositionY ?? block.backgroundImagePositionY);
261
+ current.media.height = parsePixel(block.imageHeight);
262
+ current.typography.headingAlign = block.textHeadingAlign === "left" || block.textHeadingAlign === "center" || block.textHeadingAlign === "right" || block.textHeadingAlign === "justify" ? block.textHeadingAlign : current.typography.headingAlign;
263
+ current.typography.bodyAlign = block.textBodyAlign === "left" || block.textBodyAlign === "center" || block.textBodyAlign === "right" || block.textBodyAlign === "justify" ? block.textBodyAlign : current.typography.bodyAlign;
264
+ current.typography.maxTextWidth = block.textMaxWidth === "auto" || block.textMaxWidth === "sm" || block.textMaxWidth === "md" || block.textMaxWidth === "lg" || block.textMaxWidth === "full" ? block.textMaxWidth : current.typography.maxTextWidth;
265
+ current.typography.lineHeightPreset = block.textLineHeightPreset === "tight" || block.textLineHeightPreset === "normal" || block.textLineHeightPreset === "relaxed" ? block.textLineHeightPreset : current.typography.lineHeightPreset;
266
+ current.typography.letterSpacingPreset = block.textLetterSpacingPreset === "tight" || block.textLetterSpacingPreset === "normal" || block.textLetterSpacingPreset === "relaxed" ? block.textLetterSpacingPreset : current.typography.letterSpacingPreset;
267
+ current.advanced.editCopyInPanel = Boolean(block.editCopyInPanel ?? current.advanced.editCopyInPanel);
268
+ current.advanced.customClassName = typeof block.customClassName === "string" ? block.customClassName : current.advanced.customClassName;
269
+ current.advanced.hideOnMobile = Boolean(block.hideOnMobile ?? current.advanced.hideOnMobile);
270
+ return mergeSettings(current, block.settings);
271
+ };
272
+ var v2SettingsToLegacyBlock = (blockWithSettings) => {
273
+ const settings = legacyBlockToV2Settings(blockWithSettings);
274
+ const next = {
275
+ ...blockWithSettings,
276
+ settings
277
+ };
278
+ const blockType = typeof next.blockType === "string" ? next.blockType : "";
279
+ next.contentWidth = settings.layout.contentWidth;
280
+ next.sectionPaddingX = settings.layout.sectionPaddingX;
281
+ next.sectionPaddingY = settings.layout.sectionPaddingY;
282
+ next.sectionBackgroundMode = settings.appearance.sectionBackgroundMode;
283
+ next.sectionBackgroundColor = settings.appearance.sectionBackgroundColor;
284
+ next.sectionGradientPreset = settings.appearance.sectionGradientPreset;
285
+ next.sectionGradientFrom = settings.appearance.sectionGradientFrom;
286
+ next.sectionGradientTo = settings.appearance.sectionGradientTo;
287
+ next.sectionGradientAngle = settings.appearance.sectionGradientAngle;
288
+ next.contentBackgroundMode = settings.appearance.contentBackgroundMode;
289
+ next.contentBackgroundColor = settings.appearance.contentBackgroundColor;
290
+ next.contentGradientPreset = settings.appearance.contentGradientPreset;
291
+ next.contentGradientFrom = settings.appearance.contentGradientFrom;
292
+ next.contentGradientTo = settings.appearance.contentGradientTo;
293
+ next.contentGradientAngle = settings.appearance.contentGradientAngle;
294
+ next.textHeadingAlign = settings.typography.headingAlign;
295
+ next.textBodyAlign = settings.typography.bodyAlign;
296
+ next.textMaxWidth = settings.typography.maxTextWidth;
297
+ next.textLineHeightPreset = settings.typography.lineHeightPreset;
298
+ next.textLetterSpacingPreset = settings.typography.letterSpacingPreset;
299
+ next.editCopyInPanel = settings.advanced.editCopyInPanel;
300
+ next.customClassName = settings.advanced.customClassName;
301
+ next.hideOnMobile = settings.advanced.hideOnMobile;
302
+ delete next.backgroundImagePositionX;
303
+ delete next.backgroundImagePositionY;
304
+ delete next.imageHeight;
305
+ delete next.imagePositionX;
306
+ delete next.imagePositionY;
307
+ if (blockType === "hero") {
308
+ next.backgroundImageFit = settings.media.fit;
309
+ next.backgroundImageCornerStyle = settings.media.cornerStyle;
310
+ next.backgroundImagePosition = settings.media.position;
311
+ } else if (blockType === "media") {
312
+ next.imageFit = settings.media.fit;
313
+ next.imageCornerStyle = settings.media.cornerStyle;
314
+ next.imagePosition = settings.media.position;
315
+ }
316
+ if (Array.isArray(next.items)) {
317
+ next.items = next.items.map((rawItem) => isRecord2(rawItem) ? v2SettingsToLegacyItem(rawItem) : rawItem);
318
+ }
319
+ return next;
320
+ };
321
+ var legacyItemToV2Settings = (item) => {
322
+ const current = structuredClone(defaultBuilderItemSettingsV2);
323
+ if (item.imageFit === "cover" || item.imageFit === "contain") {
324
+ current.media.fit = item.imageFit;
325
+ }
326
+ if (item.imageCornerStyle === "rounded" || item.imageCornerStyle === "square") {
327
+ current.media.cornerStyle = item.imageCornerStyle;
328
+ }
329
+ if (item.imagePosition === "top" || item.imagePosition === "bottom" || item.imagePosition === "left" || item.imagePosition === "right" || item.imagePosition === "center") {
330
+ current.media.position = item.imagePosition;
331
+ }
332
+ current.media.positionX = parsePercent(item.imagePositionX);
333
+ current.media.positionY = parsePercent(item.imagePositionY);
334
+ current.media.height = parsePixel(item.imageHeight);
335
+ return mergeSettings(current, item.settings);
336
+ };
337
+ var v2SettingsToLegacyItem = (itemWithSettings) => {
338
+ const settings = legacyItemToV2Settings(itemWithSettings);
339
+ return {
340
+ ...itemWithSettings,
341
+ imageCornerStyle: settings.media.cornerStyle,
342
+ imageFit: settings.media.fit,
343
+ imageHeight: settings.media.height,
344
+ imagePosition: settings.media.position,
345
+ imagePositionX: settings.media.positionX,
346
+ imagePositionY: settings.media.positionY,
347
+ settings
348
+ };
349
+ };
350
+ var migrateBlockToSettingsV2 = (block) => {
351
+ const withLegacyMirrors = v2SettingsToLegacyBlock(block);
352
+ if (!Array.isArray(withLegacyMirrors.items)) {
353
+ return withLegacyMirrors;
354
+ }
355
+ return {
356
+ ...withLegacyMirrors,
357
+ items: withLegacyMirrors.items.map((rawItem) => isRecord2(rawItem) ? v2SettingsToLegacyItem(rawItem) : rawItem)
358
+ };
359
+ };
360
+
361
+ // src/studio-pages/document.ts
362
+ var studioDocumentToLayout = (document) => document.nodes.map(
363
+ (node) => migrateBlockToSettingsV2({
364
+ id: node.id,
365
+ blockType: node.type,
366
+ ...node.data
367
+ })
368
+ );
369
+
370
+ // src/nextjs/queries/pages.ts
371
+ var PAGE_QUERY_CACHE_VERSION = "v4-published-only-public";
372
+ function withStudioDocumentLayout(page) {
373
+ if (!page) {
374
+ return null;
375
+ }
376
+ try {
377
+ const studioDocument = assertStudioDocumentV1(page.studioDocument);
378
+ const compiledLayout = studioDocumentToLayout(studioDocument);
379
+ if (Array.isArray(compiledLayout) && compiledLayout.length > 0) {
380
+ return {
381
+ ...page,
382
+ layout: compiledLayout
383
+ };
384
+ }
385
+ } catch {
386
+ }
387
+ return page;
388
+ }
46
389
  function normalizePath(segments) {
47
390
  if (!segments || segments.length === 0) {
48
391
  return "/";
@@ -51,35 +394,42 @@ function normalizePath(segments) {
51
394
  return cleaned.length > 0 ? `/${cleaned}` : "/";
52
395
  }
53
396
  async function queryPageByPath(payload, path, draft) {
397
+ const pathWhere = {
398
+ path: {
399
+ equals: path
400
+ }
401
+ };
402
+ const publishedWhere = {
403
+ _status: {
404
+ equals: "published"
405
+ }
406
+ };
54
407
  const result = await payload.find({
55
408
  collection: "pages",
56
409
  depth: 2,
57
410
  draft,
58
411
  limit: 1,
59
412
  overrideAccess: false,
60
- where: {
61
- path: {
62
- equals: path
63
- }
64
- }
413
+ where: draft ? pathWhere : { and: [pathWhere, publishedWhere] }
65
414
  });
66
415
  if (result.docs.length > 0) {
67
- return result.docs[0] || null;
416
+ return withStudioDocumentLayout(result.docs[0] || null);
68
417
  }
69
418
  if (path === "/") {
419
+ const homeWhere = {
420
+ slug: {
421
+ equals: "home"
422
+ }
423
+ };
70
424
  const homeResult = await payload.find({
71
425
  collection: "pages",
72
426
  depth: 2,
73
427
  draft,
74
428
  limit: 1,
75
429
  overrideAccess: false,
76
- where: {
77
- slug: {
78
- equals: "home"
79
- }
80
- }
430
+ where: draft ? homeWhere : { and: [homeWhere, publishedWhere] }
81
431
  });
82
- return homeResult.docs[0] || null;
432
+ return withStudioDocumentLayout(homeResult.docs[0] || null);
83
433
  }
84
434
  return null;
85
435
  }
@@ -89,7 +439,7 @@ function createPageQueries(getPayloadClient, contentTag = "website-content") {
89
439
  const payload = await getPayloadClient();
90
440
  return queryPageByPath(payload, path, false);
91
441
  },
92
- ["page-by-path"],
442
+ ["page-by-path", PAGE_QUERY_CACHE_VERSION],
93
443
  { tags: [contentTag] }
94
444
  );
95
445
  async function getPageBySegments(segments, draft = false) {
@@ -169,6 +519,18 @@ function createSiteQueries(getPayloadClient, contentTag = "website-content") {
169
519
  ["footer-global"],
170
520
  { tags: [contentTag] }
171
521
  );
522
+ const getSocialMediaCached = (0, import_cache2.unstable_cache)(
523
+ async () => {
524
+ const payload = await getPayloadClient();
525
+ const socialMedia = await payload.findGlobal({
526
+ slug: "social-media",
527
+ depth: 1
528
+ });
529
+ return socialMedia;
530
+ },
531
+ ["social-media-global"],
532
+ { tags: [contentTag] }
533
+ );
172
534
  async function getSiteSettings(draft = false) {
173
535
  if (draft) {
174
536
  const payload = await getPayloadClient();
@@ -205,10 +567,23 @@ function createSiteQueries(getPayloadClient, contentTag = "website-content") {
205
567
  }
206
568
  return getFooterCached();
207
569
  }
570
+ async function getSocialMedia(draft = false) {
571
+ if (draft) {
572
+ const payload = await getPayloadClient();
573
+ const socialMedia = await payload.findGlobal({
574
+ slug: "social-media",
575
+ depth: 1,
576
+ draft: true
577
+ });
578
+ return socialMedia;
579
+ }
580
+ return getSocialMediaCached();
581
+ }
208
582
  return {
209
583
  getSiteSettings,
210
584
  getHeader,
211
- getFooter
585
+ getFooter,
586
+ getSocialMedia
212
587
  };
213
588
  }
214
589
 
@@ -234,11 +609,117 @@ function resolveMedia(media) {
234
609
  }
235
610
  return null;
236
611
  }
612
+
613
+ // src/shared/socialMedia.ts
614
+ var SOCIAL_MEDIA_PLATFORM_LABELS = {
615
+ facebook: "Facebook",
616
+ instagram: "Instagram",
617
+ x: "X (Twitter)",
618
+ linkedin: "LinkedIn",
619
+ youtube: "YouTube",
620
+ tiktok: "TikTok",
621
+ pinterest: "Pinterest",
622
+ snapchat: "Snapchat"
623
+ };
624
+ var SOCIAL_MEDIA_PLATFORMS = [
625
+ "facebook",
626
+ "instagram",
627
+ "x",
628
+ "linkedin",
629
+ "youtube",
630
+ "tiktok",
631
+ "pinterest",
632
+ "snapchat"
633
+ ];
634
+ var SOCIAL_MEDIA_ICON_OPTIONS = {
635
+ facebook: [
636
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:facebook" },
637
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:facebook-f" },
638
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-facebook" },
639
+ { label: "Remix Icons", library: "remix-icons", value: "ri:facebook-fill" }
640
+ ],
641
+ instagram: [
642
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:instagram" },
643
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" },
644
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-instagram" },
645
+ { label: "Remix Icons", library: "remix-icons", value: "ri:instagram-fill" }
646
+ ],
647
+ x: [
648
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:x" },
649
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" },
650
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-x" },
651
+ { label: "Remix Icons", library: "remix-icons", value: "ri:twitter-x-fill" }
652
+ ],
653
+ linkedin: [
654
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:linkedin" },
655
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" },
656
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-linkedin" },
657
+ { label: "Remix Icons", library: "remix-icons", value: "ri:linkedin-fill" }
658
+ ],
659
+ youtube: [
660
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:youtube" },
661
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" },
662
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-youtube" },
663
+ { label: "Remix Icons", library: "remix-icons", value: "ri:youtube-fill" }
664
+ ],
665
+ tiktok: [
666
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:tiktok" },
667
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" },
668
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-tiktok" },
669
+ { label: "Remix Icons", library: "remix-icons", value: "ri:tiktok-fill" }
670
+ ],
671
+ pinterest: [
672
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:pinterest" },
673
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" },
674
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-pinterest" },
675
+ { label: "Remix Icons", library: "remix-icons", value: "ri:pinterest-fill" }
676
+ ],
677
+ snapchat: [
678
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:snapchat" },
679
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" },
680
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-snapchat" },
681
+ { label: "Remix Icons", library: "remix-icons", value: "ri:snapchat-fill" }
682
+ ]
683
+ };
684
+ var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
685
+ (acc, platform) => {
686
+ acc[platform] = SOCIAL_MEDIA_ICON_OPTIONS[platform][0].value;
687
+ return acc;
688
+ },
689
+ {}
690
+ );
691
+
692
+ // src/nextjs/utilities/socialMedia.ts
693
+ function resolveSocialMediaLinks(data) {
694
+ const profiles = data?.profiles;
695
+ if (!profiles || typeof profiles !== "object") {
696
+ return [];
697
+ }
698
+ return SOCIAL_MEDIA_PLATFORMS.reduce((acc, platform) => {
699
+ const profile = profiles[platform];
700
+ if (!profile || typeof profile !== "object") {
701
+ return acc;
702
+ }
703
+ const url = typeof profile.url === "string" ? profile.url.trim() : "";
704
+ if (!url) {
705
+ return acc;
706
+ }
707
+ const icon = typeof profile.icon === "string" && profile.icon.trim().length > 0 ? profile.icon.trim() : SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform];
708
+ acc.push({
709
+ icon,
710
+ label: SOCIAL_MEDIA_PLATFORM_LABELS[platform],
711
+ platform,
712
+ url
713
+ });
714
+ return acc;
715
+ }, []);
716
+ }
237
717
  // Annotate the CommonJS export names for ESM import in node:
238
718
  0 && (module.exports = {
239
719
  WEBSITE_CONTENT_TAG,
240
720
  createPageQueries,
241
721
  createPayloadClient,
242
722
  createSiteQueries,
243
- resolveMedia
723
+ resolveMedia,
724
+ resolveSocialMediaLinks
244
725
  });
@@ -3,13 +3,18 @@ import {
3
3
  createPageQueries,
4
4
  createPayloadClient,
5
5
  createSiteQueries,
6
- resolveMedia
7
- } from "../chunk-ZLLNO5FM.mjs";
6
+ resolveMedia,
7
+ resolveSocialMediaLinks
8
+ } from "../chunk-BET2YLAS.mjs";
9
+ import "../chunk-ZTXJG4K5.mjs";
10
+ import "../chunk-ADIIWIYL.mjs";
11
+ import "../chunk-PF3EBZXF.mjs";
8
12
  import "../chunk-6BWS3CLP.mjs";
9
13
  export {
10
14
  WEBSITE_CONTENT_TAG,
11
15
  createPageQueries,
12
16
  createPayloadClient,
13
17
  createSiteQueries,
14
- resolveMedia
18
+ resolveMedia,
19
+ resolveSocialMediaLinks
15
20
  };
@@ -0,0 +1,21 @@
1
+ type SocialMediaPlatform = 'facebook' | 'instagram' | 'x' | 'linkedin' | 'youtube' | 'tiktok' | 'pinterest' | 'snapchat';
2
+ type SocialMediaIconLibrary = 'simple-icons' | 'font-awesome-brands' | 'tabler-brands' | 'remix-icons';
3
+ type SocialMediaIconOption = {
4
+ label: string;
5
+ library: SocialMediaIconLibrary;
6
+ value: string;
7
+ };
8
+ type SocialMediaProfileData = {
9
+ icon?: string | null;
10
+ url?: string | null;
11
+ };
12
+ type SocialMediaProfilesData = Partial<Record<SocialMediaPlatform, SocialMediaProfileData>>;
13
+ type SocialMediaGlobalData = {
14
+ profiles?: SocialMediaProfilesData | null;
15
+ };
16
+ declare const SOCIAL_MEDIA_PLATFORM_LABELS: Record<SocialMediaPlatform, string>;
17
+ declare const SOCIAL_MEDIA_PLATFORMS: SocialMediaPlatform[];
18
+ declare const SOCIAL_MEDIA_ICON_OPTIONS: Record<SocialMediaPlatform, SocialMediaIconOption[]>;
19
+ declare const SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM: Record<SocialMediaPlatform, string>;
20
+
21
+ export { type SocialMediaGlobalData as S, type SocialMediaPlatform as a, SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM as b, SOCIAL_MEDIA_ICON_OPTIONS as c, SOCIAL_MEDIA_PLATFORMS as d, SOCIAL_MEDIA_PLATFORM_LABELS as e, type SocialMediaIconLibrary as f, type SocialMediaIconOption as g, type SocialMediaProfileData as h, type SocialMediaProfilesData as i };