@orion-studios/payload-studio 0.5.0-beta.95 → 0.5.0-beta.97
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 +26 -0
- package/dist/admin/index.d.mts +2 -1
- package/dist/admin/index.d.ts +2 -1
- package/dist/admin/index.js +159 -0
- package/dist/admin/index.mjs +17 -1
- package/dist/{chunk-SHC2KLT3.mjs → chunk-C4J35SPJ.mjs} +2 -1
- package/dist/{chunk-H3UCUO3C.mjs → chunk-CKEUQCDC.mjs} +61 -3
- package/dist/{chunk-HCEPGEAI.mjs → chunk-YJPNN3O3.mjs} +98 -0
- package/dist/chunk-ZFJJQ4YK.mjs +69 -0
- package/dist/{index-CpG3UHcS.d.ts → index-BBUjXVqQ.d.ts} +16 -2
- package/dist/{index-CpG3UHcS.d.mts → index-CW02UDzl.d.mts} +16 -2
- package/dist/{index-cDYkEj29.d.ts → index-CodQ-io_.d.mts} +34 -2
- package/dist/{index-cDYkEj29.d.mts → index-D8RxRIh3.d.ts} +34 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +208 -3
- package/dist/index.mjs +4 -3
- package/dist/nextjs/index.d.mts +2 -1
- package/dist/nextjs/index.d.ts +2 -1
- package/dist/nextjs/index.js +121 -4
- package/dist/nextjs/index.mjs +7 -4
- package/dist/socialMedia-CXaTwojP.d.mts +21 -0
- package/dist/socialMedia-CXaTwojP.d.ts +21 -0
- package/dist/studio-pages/client.js +80 -66
- package/dist/studio-pages/client.mjs +67 -53
- package/dist/studio-pages/index.js +2 -1
- package/dist/studio-pages/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,6 +55,32 @@ import { AdminShellClient } from '@orion-studios/payload-studio/admin-app/client
|
|
|
55
55
|
import '@orion-studios/payload-studio/admin-app/styles.css'
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
## Social Media Global
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { createSocialMediaGlobal } from '@orion-studios/payload-studio/admin'
|
|
62
|
+
|
|
63
|
+
export const globals = [
|
|
64
|
+
createSocialMediaGlobal(),
|
|
65
|
+
]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`createSocialMediaGlobal` creates a `social-media` global with:
|
|
69
|
+
|
|
70
|
+
- Major platforms (Facebook, Instagram, X, LinkedIn, YouTube, TikTok, Pinterest, Snapchat)
|
|
71
|
+
- URL field for each platform
|
|
72
|
+
- Two icon choices per platform (`Simple Icons` and `Font Awesome Brands`)
|
|
73
|
+
|
|
74
|
+
You can fetch and normalize these links in Next.js:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { createSiteQueries, resolveSocialMediaLinks } from '@orion-studios/payload-studio/nextjs'
|
|
78
|
+
|
|
79
|
+
const { getSocialMedia } = createSiteQueries(getPayloadClient)
|
|
80
|
+
const social = await getSocialMedia()
|
|
81
|
+
const links = resolveSocialMediaLinks(social)
|
|
82
|
+
```
|
|
83
|
+
|
|
58
84
|
## Build
|
|
59
85
|
|
|
60
86
|
```bash
|
package/dist/admin/index.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { A as AdminConfig, c as configureAdmin,
|
|
1
|
+
export { A as AdminConfig, C as CreateSocialMediaConnectionsFieldOptions, a as CreateSocialMediaGlobalOptions, c as configureAdmin, b as createHeaderNavItemsField, d as createSocialMediaConnectionsField, e as createSocialMediaGlobal, f as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-CodQ-io_.mjs';
|
|
2
|
+
export { b as SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM, c as SOCIAL_MEDIA_ICON_OPTIONS, d as SOCIAL_MEDIA_PLATFORMS, e as SOCIAL_MEDIA_PLATFORM_LABELS, S as SocialMediaGlobalData, f as SocialMediaIconLibrary, g as SocialMediaIconOption, a as SocialMediaPlatform, h as SocialMediaProfileData, i as SocialMediaProfilesData } from '../socialMedia-CXaTwojP.mjs';
|
|
2
3
|
import 'payload';
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { A as AdminConfig, c as configureAdmin,
|
|
1
|
+
export { A as AdminConfig, C as CreateSocialMediaConnectionsFieldOptions, a as CreateSocialMediaGlobalOptions, c as configureAdmin, b as createHeaderNavItemsField, d as createSocialMediaConnectionsField, e as createSocialMediaGlobal, f as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-D8RxRIh3.js';
|
|
2
|
+
export { b as SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM, c as SOCIAL_MEDIA_ICON_OPTIONS, d as SOCIAL_MEDIA_PLATFORMS, e as SOCIAL_MEDIA_PLATFORM_LABELS, S as SocialMediaGlobalData, f as SocialMediaIconLibrary, g as SocialMediaIconOption, a as SocialMediaPlatform, h as SocialMediaProfileData, i as SocialMediaProfilesData } from '../socialMedia-CXaTwojP.js';
|
|
2
3
|
import 'payload';
|
package/dist/admin/index.js
CHANGED
|
@@ -30,9 +30,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/admin/index.ts
|
|
31
31
|
var admin_exports = {};
|
|
32
32
|
__export(admin_exports, {
|
|
33
|
+
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM: () => SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
34
|
+
SOCIAL_MEDIA_ICON_OPTIONS: () => SOCIAL_MEDIA_ICON_OPTIONS,
|
|
35
|
+
SOCIAL_MEDIA_PLATFORMS: () => SOCIAL_MEDIA_PLATFORMS,
|
|
36
|
+
SOCIAL_MEDIA_PLATFORM_LABELS: () => SOCIAL_MEDIA_PLATFORM_LABELS,
|
|
33
37
|
configureAdmin: () => configureAdmin,
|
|
34
38
|
createHeaderNavItemsField: () => createHeaderNavItemsField,
|
|
39
|
+
createSocialMediaConnectionsField: () => createSocialMediaConnectionsField,
|
|
40
|
+
createSocialMediaGlobal: () => createSocialMediaGlobal,
|
|
35
41
|
createThemePreferenceField: () => createThemePreferenceField,
|
|
42
|
+
socialMediaConnectionsField: () => socialMediaConnectionsField,
|
|
36
43
|
themePreferenceField: () => themePreferenceField,
|
|
37
44
|
withTooltips: () => withTooltips
|
|
38
45
|
});
|
|
@@ -243,6 +250,7 @@ function configureAdmin(config) {
|
|
|
243
250
|
header: { group: "Site Design", label: "Header & Navigation" },
|
|
244
251
|
footer: { group: "Site Design", label: "Footer" },
|
|
245
252
|
"site-settings": { group: "Site Design", label: "Website Settings" },
|
|
253
|
+
"social-media": { group: "Site Design", label: "Social Media" },
|
|
246
254
|
"contact-form": { group: "Lead Forms", label: "Contact Form" }
|
|
247
255
|
};
|
|
248
256
|
return globals2.map((global) => {
|
|
@@ -385,11 +393,162 @@ var createHeaderNavItemsField = () => ({
|
|
|
385
393
|
}
|
|
386
394
|
]
|
|
387
395
|
});
|
|
396
|
+
|
|
397
|
+
// src/shared/socialMedia.ts
|
|
398
|
+
var SOCIAL_MEDIA_PLATFORM_LABELS = {
|
|
399
|
+
facebook: "Facebook",
|
|
400
|
+
instagram: "Instagram",
|
|
401
|
+
x: "X (Twitter)",
|
|
402
|
+
linkedin: "LinkedIn",
|
|
403
|
+
youtube: "YouTube",
|
|
404
|
+
tiktok: "TikTok",
|
|
405
|
+
pinterest: "Pinterest",
|
|
406
|
+
snapchat: "Snapchat"
|
|
407
|
+
};
|
|
408
|
+
var SOCIAL_MEDIA_PLATFORMS = [
|
|
409
|
+
"facebook",
|
|
410
|
+
"instagram",
|
|
411
|
+
"x",
|
|
412
|
+
"linkedin",
|
|
413
|
+
"youtube",
|
|
414
|
+
"tiktok",
|
|
415
|
+
"pinterest",
|
|
416
|
+
"snapchat"
|
|
417
|
+
];
|
|
418
|
+
var SOCIAL_MEDIA_ICON_OPTIONS = {
|
|
419
|
+
facebook: [
|
|
420
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:facebook" },
|
|
421
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:facebook-f" }
|
|
422
|
+
],
|
|
423
|
+
instagram: [
|
|
424
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:instagram" },
|
|
425
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" }
|
|
426
|
+
],
|
|
427
|
+
x: [
|
|
428
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:x" },
|
|
429
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" }
|
|
430
|
+
],
|
|
431
|
+
linkedin: [
|
|
432
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:linkedin" },
|
|
433
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" }
|
|
434
|
+
],
|
|
435
|
+
youtube: [
|
|
436
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:youtube" },
|
|
437
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" }
|
|
438
|
+
],
|
|
439
|
+
tiktok: [
|
|
440
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:tiktok" },
|
|
441
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" }
|
|
442
|
+
],
|
|
443
|
+
pinterest: [
|
|
444
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:pinterest" },
|
|
445
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" }
|
|
446
|
+
],
|
|
447
|
+
snapchat: [
|
|
448
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:snapchat" },
|
|
449
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" }
|
|
450
|
+
]
|
|
451
|
+
};
|
|
452
|
+
var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
|
|
453
|
+
(acc, platform) => {
|
|
454
|
+
acc[platform] = SOCIAL_MEDIA_ICON_OPTIONS[platform][0].value;
|
|
455
|
+
return acc;
|
|
456
|
+
},
|
|
457
|
+
{}
|
|
458
|
+
);
|
|
459
|
+
|
|
460
|
+
// src/admin/fields/socialMedia.ts
|
|
461
|
+
var DEFAULT_DESCRIPTION = "Add profile URLs and choose one of two icon styles for each platform. Leave a URL blank to hide that profile on your site.";
|
|
462
|
+
function validateOptionalHttpsUrl(value) {
|
|
463
|
+
if (value === null || value === void 0 || value === "") {
|
|
464
|
+
return true;
|
|
465
|
+
}
|
|
466
|
+
if (typeof value !== "string") {
|
|
467
|
+
return "Enter a valid URL.";
|
|
468
|
+
}
|
|
469
|
+
try {
|
|
470
|
+
const url = new URL(value);
|
|
471
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
472
|
+
return "Use an http:// or https:// URL.";
|
|
473
|
+
}
|
|
474
|
+
return true;
|
|
475
|
+
} catch {
|
|
476
|
+
return "Enter a valid URL (for example: https://instagram.com/yourbrand).";
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function createPlatformField(platform) {
|
|
480
|
+
const platformLabel = SOCIAL_MEDIA_PLATFORM_LABELS[platform];
|
|
481
|
+
const iconOptions = SOCIAL_MEDIA_ICON_OPTIONS[platform].map((option) => ({
|
|
482
|
+
label: option.label,
|
|
483
|
+
value: option.value
|
|
484
|
+
}));
|
|
485
|
+
return {
|
|
486
|
+
name: platform,
|
|
487
|
+
type: "group",
|
|
488
|
+
label: platformLabel,
|
|
489
|
+
fields: [
|
|
490
|
+
{
|
|
491
|
+
name: "url",
|
|
492
|
+
type: "text",
|
|
493
|
+
admin: {
|
|
494
|
+
description: `Full ${platformLabel} profile URL. Leave blank to hide ${platformLabel}.`
|
|
495
|
+
},
|
|
496
|
+
validate: validateOptionalHttpsUrl
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
name: "icon",
|
|
500
|
+
type: "select",
|
|
501
|
+
defaultValue: SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform],
|
|
502
|
+
options: iconOptions,
|
|
503
|
+
admin: {
|
|
504
|
+
description: "Pick which icon style to display for this platform."
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
]
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
var createSocialMediaConnectionsField = (options = {}) => {
|
|
511
|
+
const selectedPlatforms = Array.isArray(options.platforms) && options.platforms.length > 0 ? options.platforms : SOCIAL_MEDIA_PLATFORMS;
|
|
512
|
+
return {
|
|
513
|
+
name: options.name || "profiles",
|
|
514
|
+
type: "group",
|
|
515
|
+
label: options.label || "Social Media Profiles",
|
|
516
|
+
admin: {
|
|
517
|
+
description: options.description || DEFAULT_DESCRIPTION
|
|
518
|
+
},
|
|
519
|
+
fields: selectedPlatforms.map((platform) => createPlatformField(platform))
|
|
520
|
+
};
|
|
521
|
+
};
|
|
522
|
+
var socialMediaConnectionsField = createSocialMediaConnectionsField();
|
|
523
|
+
|
|
524
|
+
// src/admin/globals/socialMedia.ts
|
|
525
|
+
var createSocialMediaGlobal = (options = {}) => ({
|
|
526
|
+
slug: options.slug || "social-media",
|
|
527
|
+
label: "Social Media",
|
|
528
|
+
admin: {
|
|
529
|
+
description: options.description || "Manage social profile links and icon variants used across your website.",
|
|
530
|
+
group: "Site Design"
|
|
531
|
+
},
|
|
532
|
+
fields: [
|
|
533
|
+
createSocialMediaConnectionsField({
|
|
534
|
+
...options.fieldOptions,
|
|
535
|
+
label: "Profiles",
|
|
536
|
+
name: "profiles"
|
|
537
|
+
})
|
|
538
|
+
]
|
|
539
|
+
});
|
|
388
540
|
// Annotate the CommonJS export names for ESM import in node:
|
|
389
541
|
0 && (module.exports = {
|
|
542
|
+
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
543
|
+
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
544
|
+
SOCIAL_MEDIA_PLATFORMS,
|
|
545
|
+
SOCIAL_MEDIA_PLATFORM_LABELS,
|
|
390
546
|
configureAdmin,
|
|
391
547
|
createHeaderNavItemsField,
|
|
548
|
+
createSocialMediaConnectionsField,
|
|
549
|
+
createSocialMediaGlobal,
|
|
392
550
|
createThemePreferenceField,
|
|
551
|
+
socialMediaConnectionsField,
|
|
393
552
|
themePreferenceField,
|
|
394
553
|
withTooltips
|
|
395
554
|
});
|
package/dist/admin/index.mjs
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
configureAdmin,
|
|
3
3
|
createHeaderNavItemsField,
|
|
4
|
+
createSocialMediaConnectionsField,
|
|
5
|
+
createSocialMediaGlobal,
|
|
4
6
|
createThemePreferenceField,
|
|
7
|
+
socialMediaConnectionsField,
|
|
5
8
|
themePreferenceField,
|
|
6
9
|
withTooltips
|
|
7
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-YJPNN3O3.mjs";
|
|
11
|
+
import {
|
|
12
|
+
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
13
|
+
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
14
|
+
SOCIAL_MEDIA_PLATFORMS,
|
|
15
|
+
SOCIAL_MEDIA_PLATFORM_LABELS
|
|
16
|
+
} from "../chunk-ZFJJQ4YK.mjs";
|
|
8
17
|
import "../chunk-6BWS3CLP.mjs";
|
|
9
18
|
export {
|
|
19
|
+
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
20
|
+
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
21
|
+
SOCIAL_MEDIA_PLATFORMS,
|
|
22
|
+
SOCIAL_MEDIA_PLATFORM_LABELS,
|
|
10
23
|
configureAdmin,
|
|
11
24
|
createHeaderNavItemsField,
|
|
25
|
+
createSocialMediaConnectionsField,
|
|
26
|
+
createSocialMediaGlobal,
|
|
12
27
|
createThemePreferenceField,
|
|
28
|
+
socialMediaConnectionsField,
|
|
13
29
|
themePreferenceField,
|
|
14
30
|
withTooltips
|
|
15
31
|
};
|
|
@@ -322,9 +322,10 @@ var resolveBuilderThemeTokens = (layers) => {
|
|
|
322
322
|
};
|
|
323
323
|
|
|
324
324
|
// src/studio-pages/builder/settings-v2/BlockInspectorRenderer.tsx
|
|
325
|
-
import { useMemo, useState } from "react";
|
|
325
|
+
import { useMemo, useState as useState2 } from "react";
|
|
326
326
|
|
|
327
327
|
// src/studio-pages/builder/ui/Accordion.tsx
|
|
328
|
+
import { useEffect, useState } from "react";
|
|
328
329
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
329
330
|
|
|
330
331
|
// src/studio-pages/builder/ui/ImageControls.tsx
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
3
|
+
SOCIAL_MEDIA_PLATFORMS,
|
|
4
|
+
SOCIAL_MEDIA_PLATFORM_LABELS
|
|
5
|
+
} from "./chunk-ZFJJQ4YK.mjs";
|
|
1
6
|
import {
|
|
2
7
|
assertStudioDocumentV1
|
|
3
8
|
} from "./chunk-ADIIWIYL.mjs";
|
|
4
9
|
import {
|
|
5
10
|
studioDocumentToLayout
|
|
6
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-C4J35SPJ.mjs";
|
|
7
12
|
import {
|
|
8
13
|
__export
|
|
9
14
|
} from "./chunk-6BWS3CLP.mjs";
|
|
@@ -15,7 +20,8 @@ __export(nextjs_exports, {
|
|
|
15
20
|
createPageQueries: () => createPageQueries,
|
|
16
21
|
createPayloadClient: () => createPayloadClient,
|
|
17
22
|
createSiteQueries: () => createSiteQueries,
|
|
18
|
-
resolveMedia: () => resolveMedia
|
|
23
|
+
resolveMedia: () => resolveMedia,
|
|
24
|
+
resolveSocialMediaLinks: () => resolveSocialMediaLinks
|
|
19
25
|
});
|
|
20
26
|
|
|
21
27
|
// src/nextjs/client/payload.ts
|
|
@@ -184,6 +190,18 @@ function createSiteQueries(getPayloadClient, contentTag = "website-content") {
|
|
|
184
190
|
["footer-global"],
|
|
185
191
|
{ tags: [contentTag] }
|
|
186
192
|
);
|
|
193
|
+
const getSocialMediaCached = unstable_cache2(
|
|
194
|
+
async () => {
|
|
195
|
+
const payload = await getPayloadClient();
|
|
196
|
+
const socialMedia = await payload.findGlobal({
|
|
197
|
+
slug: "social-media",
|
|
198
|
+
depth: 1
|
|
199
|
+
});
|
|
200
|
+
return socialMedia;
|
|
201
|
+
},
|
|
202
|
+
["social-media-global"],
|
|
203
|
+
{ tags: [contentTag] }
|
|
204
|
+
);
|
|
187
205
|
async function getSiteSettings(draft = false) {
|
|
188
206
|
if (draft) {
|
|
189
207
|
const payload = await getPayloadClient();
|
|
@@ -220,10 +238,23 @@ function createSiteQueries(getPayloadClient, contentTag = "website-content") {
|
|
|
220
238
|
}
|
|
221
239
|
return getFooterCached();
|
|
222
240
|
}
|
|
241
|
+
async function getSocialMedia(draft = false) {
|
|
242
|
+
if (draft) {
|
|
243
|
+
const payload = await getPayloadClient();
|
|
244
|
+
const socialMedia = await payload.findGlobal({
|
|
245
|
+
slug: "social-media",
|
|
246
|
+
depth: 1,
|
|
247
|
+
draft: true
|
|
248
|
+
});
|
|
249
|
+
return socialMedia;
|
|
250
|
+
}
|
|
251
|
+
return getSocialMediaCached();
|
|
252
|
+
}
|
|
223
253
|
return {
|
|
224
254
|
getSiteSettings,
|
|
225
255
|
getHeader,
|
|
226
|
-
getFooter
|
|
256
|
+
getFooter,
|
|
257
|
+
getSocialMedia
|
|
227
258
|
};
|
|
228
259
|
}
|
|
229
260
|
|
|
@@ -250,11 +281,38 @@ function resolveMedia(media) {
|
|
|
250
281
|
return null;
|
|
251
282
|
}
|
|
252
283
|
|
|
284
|
+
// src/nextjs/utilities/socialMedia.ts
|
|
285
|
+
function resolveSocialMediaLinks(data) {
|
|
286
|
+
const profiles = data?.profiles;
|
|
287
|
+
if (!profiles || typeof profiles !== "object") {
|
|
288
|
+
return [];
|
|
289
|
+
}
|
|
290
|
+
return SOCIAL_MEDIA_PLATFORMS.reduce((acc, platform) => {
|
|
291
|
+
const profile = profiles[platform];
|
|
292
|
+
if (!profile || typeof profile !== "object") {
|
|
293
|
+
return acc;
|
|
294
|
+
}
|
|
295
|
+
const url = typeof profile.url === "string" ? profile.url.trim() : "";
|
|
296
|
+
if (!url) {
|
|
297
|
+
return acc;
|
|
298
|
+
}
|
|
299
|
+
const icon = typeof profile.icon === "string" && profile.icon.trim().length > 0 ? profile.icon.trim() : SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform];
|
|
300
|
+
acc.push({
|
|
301
|
+
icon,
|
|
302
|
+
label: SOCIAL_MEDIA_PLATFORM_LABELS[platform],
|
|
303
|
+
platform,
|
|
304
|
+
url
|
|
305
|
+
});
|
|
306
|
+
return acc;
|
|
307
|
+
}, []);
|
|
308
|
+
}
|
|
309
|
+
|
|
253
310
|
export {
|
|
254
311
|
WEBSITE_CONTENT_TAG,
|
|
255
312
|
createPayloadClient,
|
|
256
313
|
createPageQueries,
|
|
257
314
|
createSiteQueries,
|
|
258
315
|
resolveMedia,
|
|
316
|
+
resolveSocialMediaLinks,
|
|
259
317
|
nextjs_exports
|
|
260
318
|
};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
3
|
+
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
4
|
+
SOCIAL_MEDIA_PLATFORMS,
|
|
5
|
+
SOCIAL_MEDIA_PLATFORM_LABELS
|
|
6
|
+
} from "./chunk-ZFJJQ4YK.mjs";
|
|
1
7
|
import {
|
|
2
8
|
__export,
|
|
3
9
|
__require
|
|
@@ -6,9 +12,16 @@ import {
|
|
|
6
12
|
// src/admin/index.ts
|
|
7
13
|
var admin_exports = {};
|
|
8
14
|
__export(admin_exports, {
|
|
15
|
+
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM: () => SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
16
|
+
SOCIAL_MEDIA_ICON_OPTIONS: () => SOCIAL_MEDIA_ICON_OPTIONS,
|
|
17
|
+
SOCIAL_MEDIA_PLATFORMS: () => SOCIAL_MEDIA_PLATFORMS,
|
|
18
|
+
SOCIAL_MEDIA_PLATFORM_LABELS: () => SOCIAL_MEDIA_PLATFORM_LABELS,
|
|
9
19
|
configureAdmin: () => configureAdmin,
|
|
10
20
|
createHeaderNavItemsField: () => createHeaderNavItemsField,
|
|
21
|
+
createSocialMediaConnectionsField: () => createSocialMediaConnectionsField,
|
|
22
|
+
createSocialMediaGlobal: () => createSocialMediaGlobal,
|
|
11
23
|
createThemePreferenceField: () => createThemePreferenceField,
|
|
24
|
+
socialMediaConnectionsField: () => socialMediaConnectionsField,
|
|
12
25
|
themePreferenceField: () => themePreferenceField,
|
|
13
26
|
withTooltips: () => withTooltips
|
|
14
27
|
});
|
|
@@ -217,6 +230,7 @@ function configureAdmin(config) {
|
|
|
217
230
|
header: { group: "Site Design", label: "Header & Navigation" },
|
|
218
231
|
footer: { group: "Site Design", label: "Footer" },
|
|
219
232
|
"site-settings": { group: "Site Design", label: "Website Settings" },
|
|
233
|
+
"social-media": { group: "Site Design", label: "Social Media" },
|
|
220
234
|
"contact-form": { group: "Lead Forms", label: "Contact Form" }
|
|
221
235
|
};
|
|
222
236
|
return globals2.map((global) => {
|
|
@@ -360,11 +374,95 @@ var createHeaderNavItemsField = () => ({
|
|
|
360
374
|
]
|
|
361
375
|
});
|
|
362
376
|
|
|
377
|
+
// src/admin/fields/socialMedia.ts
|
|
378
|
+
var DEFAULT_DESCRIPTION = "Add profile URLs and choose one of two icon styles for each platform. Leave a URL blank to hide that profile on your site.";
|
|
379
|
+
function validateOptionalHttpsUrl(value) {
|
|
380
|
+
if (value === null || value === void 0 || value === "") {
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
383
|
+
if (typeof value !== "string") {
|
|
384
|
+
return "Enter a valid URL.";
|
|
385
|
+
}
|
|
386
|
+
try {
|
|
387
|
+
const url = new URL(value);
|
|
388
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
389
|
+
return "Use an http:// or https:// URL.";
|
|
390
|
+
}
|
|
391
|
+
return true;
|
|
392
|
+
} catch {
|
|
393
|
+
return "Enter a valid URL (for example: https://instagram.com/yourbrand).";
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
function createPlatformField(platform) {
|
|
397
|
+
const platformLabel = SOCIAL_MEDIA_PLATFORM_LABELS[platform];
|
|
398
|
+
const iconOptions = SOCIAL_MEDIA_ICON_OPTIONS[platform].map((option) => ({
|
|
399
|
+
label: option.label,
|
|
400
|
+
value: option.value
|
|
401
|
+
}));
|
|
402
|
+
return {
|
|
403
|
+
name: platform,
|
|
404
|
+
type: "group",
|
|
405
|
+
label: platformLabel,
|
|
406
|
+
fields: [
|
|
407
|
+
{
|
|
408
|
+
name: "url",
|
|
409
|
+
type: "text",
|
|
410
|
+
admin: {
|
|
411
|
+
description: `Full ${platformLabel} profile URL. Leave blank to hide ${platformLabel}.`
|
|
412
|
+
},
|
|
413
|
+
validate: validateOptionalHttpsUrl
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
name: "icon",
|
|
417
|
+
type: "select",
|
|
418
|
+
defaultValue: SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform],
|
|
419
|
+
options: iconOptions,
|
|
420
|
+
admin: {
|
|
421
|
+
description: "Pick which icon style to display for this platform."
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
]
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
var createSocialMediaConnectionsField = (options = {}) => {
|
|
428
|
+
const selectedPlatforms = Array.isArray(options.platforms) && options.platforms.length > 0 ? options.platforms : SOCIAL_MEDIA_PLATFORMS;
|
|
429
|
+
return {
|
|
430
|
+
name: options.name || "profiles",
|
|
431
|
+
type: "group",
|
|
432
|
+
label: options.label || "Social Media Profiles",
|
|
433
|
+
admin: {
|
|
434
|
+
description: options.description || DEFAULT_DESCRIPTION
|
|
435
|
+
},
|
|
436
|
+
fields: selectedPlatforms.map((platform) => createPlatformField(platform))
|
|
437
|
+
};
|
|
438
|
+
};
|
|
439
|
+
var socialMediaConnectionsField = createSocialMediaConnectionsField();
|
|
440
|
+
|
|
441
|
+
// src/admin/globals/socialMedia.ts
|
|
442
|
+
var createSocialMediaGlobal = (options = {}) => ({
|
|
443
|
+
slug: options.slug || "social-media",
|
|
444
|
+
label: "Social Media",
|
|
445
|
+
admin: {
|
|
446
|
+
description: options.description || "Manage social profile links and icon variants used across your website.",
|
|
447
|
+
group: "Site Design"
|
|
448
|
+
},
|
|
449
|
+
fields: [
|
|
450
|
+
createSocialMediaConnectionsField({
|
|
451
|
+
...options.fieldOptions,
|
|
452
|
+
label: "Profiles",
|
|
453
|
+
name: "profiles"
|
|
454
|
+
})
|
|
455
|
+
]
|
|
456
|
+
});
|
|
457
|
+
|
|
363
458
|
export {
|
|
364
459
|
createThemePreferenceField,
|
|
365
460
|
themePreferenceField,
|
|
366
461
|
configureAdmin,
|
|
367
462
|
withTooltips,
|
|
368
463
|
createHeaderNavItemsField,
|
|
464
|
+
createSocialMediaConnectionsField,
|
|
465
|
+
socialMediaConnectionsField,
|
|
466
|
+
createSocialMediaGlobal,
|
|
369
467
|
admin_exports
|
|
370
468
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// src/shared/socialMedia.ts
|
|
2
|
+
var SOCIAL_MEDIA_PLATFORM_LABELS = {
|
|
3
|
+
facebook: "Facebook",
|
|
4
|
+
instagram: "Instagram",
|
|
5
|
+
x: "X (Twitter)",
|
|
6
|
+
linkedin: "LinkedIn",
|
|
7
|
+
youtube: "YouTube",
|
|
8
|
+
tiktok: "TikTok",
|
|
9
|
+
pinterest: "Pinterest",
|
|
10
|
+
snapchat: "Snapchat"
|
|
11
|
+
};
|
|
12
|
+
var SOCIAL_MEDIA_PLATFORMS = [
|
|
13
|
+
"facebook",
|
|
14
|
+
"instagram",
|
|
15
|
+
"x",
|
|
16
|
+
"linkedin",
|
|
17
|
+
"youtube",
|
|
18
|
+
"tiktok",
|
|
19
|
+
"pinterest",
|
|
20
|
+
"snapchat"
|
|
21
|
+
];
|
|
22
|
+
var SOCIAL_MEDIA_ICON_OPTIONS = {
|
|
23
|
+
facebook: [
|
|
24
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:facebook" },
|
|
25
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:facebook-f" }
|
|
26
|
+
],
|
|
27
|
+
instagram: [
|
|
28
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:instagram" },
|
|
29
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" }
|
|
30
|
+
],
|
|
31
|
+
x: [
|
|
32
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:x" },
|
|
33
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" }
|
|
34
|
+
],
|
|
35
|
+
linkedin: [
|
|
36
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:linkedin" },
|
|
37
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" }
|
|
38
|
+
],
|
|
39
|
+
youtube: [
|
|
40
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:youtube" },
|
|
41
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" }
|
|
42
|
+
],
|
|
43
|
+
tiktok: [
|
|
44
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:tiktok" },
|
|
45
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" }
|
|
46
|
+
],
|
|
47
|
+
pinterest: [
|
|
48
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:pinterest" },
|
|
49
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" }
|
|
50
|
+
],
|
|
51
|
+
snapchat: [
|
|
52
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:snapchat" },
|
|
53
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" }
|
|
54
|
+
]
|
|
55
|
+
};
|
|
56
|
+
var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
|
|
57
|
+
(acc, platform) => {
|
|
58
|
+
acc[platform] = SOCIAL_MEDIA_ICON_OPTIONS[platform][0].value;
|
|
59
|
+
return acc;
|
|
60
|
+
},
|
|
61
|
+
{}
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
SOCIAL_MEDIA_PLATFORM_LABELS,
|
|
66
|
+
SOCIAL_MEDIA_PLATFORMS,
|
|
67
|
+
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
68
|
+
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM
|
|
69
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as payload from 'payload';
|
|
2
2
|
import { Payload } from 'payload';
|
|
3
|
+
import { S as SocialMediaGlobalData, a as SocialMediaPlatform } from './socialMedia-CXaTwojP.js';
|
|
3
4
|
|
|
4
5
|
declare const WEBSITE_CONTENT_TAG = "website-content";
|
|
5
6
|
declare function createPayloadClient(config: any): () => Promise<payload.BasePayload>;
|
|
@@ -50,10 +51,12 @@ type FooterData = {
|
|
|
50
51
|
contactEmail?: string;
|
|
51
52
|
contactPhone?: string;
|
|
52
53
|
};
|
|
54
|
+
|
|
53
55
|
declare function createSiteQueries(getPayloadClient: () => Promise<Payload>, contentTag?: string): {
|
|
54
56
|
getSiteSettings: (draft?: boolean) => Promise<SiteSettingsData>;
|
|
55
57
|
getHeader: (draft?: boolean) => Promise<HeaderData>;
|
|
56
58
|
getFooter: (draft?: boolean) => Promise<FooterData>;
|
|
59
|
+
getSocialMedia: (draft?: boolean) => Promise<SocialMediaGlobalData>;
|
|
57
60
|
};
|
|
58
61
|
|
|
59
62
|
type MediaValue = number | string | {
|
|
@@ -67,17 +70,28 @@ declare function resolveMedia(media: MediaValue): {
|
|
|
67
70
|
alt: string;
|
|
68
71
|
} | null;
|
|
69
72
|
|
|
73
|
+
type ResolvedSocialMediaLink = {
|
|
74
|
+
icon: string;
|
|
75
|
+
label: string;
|
|
76
|
+
platform: SocialMediaPlatform;
|
|
77
|
+
url: string;
|
|
78
|
+
};
|
|
79
|
+
declare function resolveSocialMediaLinks(data: SocialMediaGlobalData | null | undefined): ResolvedSocialMediaLink[];
|
|
80
|
+
|
|
70
81
|
type index_FooterData = FooterData;
|
|
71
82
|
type index_HeaderData = HeaderData;
|
|
83
|
+
type index_ResolvedSocialMediaLink = ResolvedSocialMediaLink;
|
|
72
84
|
type index_SiteNavItem = SiteNavItem;
|
|
73
85
|
type index_SiteSettingsData = SiteSettingsData;
|
|
86
|
+
declare const index_SocialMediaGlobalData: typeof SocialMediaGlobalData;
|
|
74
87
|
declare const index_WEBSITE_CONTENT_TAG: typeof WEBSITE_CONTENT_TAG;
|
|
75
88
|
declare const index_createPageQueries: typeof createPageQueries;
|
|
76
89
|
declare const index_createPayloadClient: typeof createPayloadClient;
|
|
77
90
|
declare const index_createSiteQueries: typeof createSiteQueries;
|
|
78
91
|
declare const index_resolveMedia: typeof resolveMedia;
|
|
92
|
+
declare const index_resolveSocialMediaLinks: typeof resolveSocialMediaLinks;
|
|
79
93
|
declare namespace index {
|
|
80
|
-
export { type index_FooterData as FooterData, type index_HeaderData as HeaderData, type index_SiteNavItem as SiteNavItem, type index_SiteSettingsData as SiteSettingsData, index_WEBSITE_CONTENT_TAG as WEBSITE_CONTENT_TAG, index_createPageQueries as createPageQueries, index_createPayloadClient as createPayloadClient, index_createSiteQueries as createSiteQueries, index_resolveMedia as resolveMedia };
|
|
94
|
+
export { type index_FooterData as FooterData, type index_HeaderData as HeaderData, type index_ResolvedSocialMediaLink as ResolvedSocialMediaLink, type index_SiteNavItem as SiteNavItem, type index_SiteSettingsData as SiteSettingsData, index_SocialMediaGlobalData as SocialMediaGlobalData, index_WEBSITE_CONTENT_TAG as WEBSITE_CONTENT_TAG, index_createPageQueries as createPageQueries, index_createPayloadClient as createPayloadClient, index_createSiteQueries as createSiteQueries, index_resolveMedia as resolveMedia, index_resolveSocialMediaLinks as resolveSocialMediaLinks };
|
|
81
95
|
}
|
|
82
96
|
|
|
83
|
-
export { type FooterData as F, type HeaderData as H, type SiteNavItem as S, WEBSITE_CONTENT_TAG as W, type SiteSettingsData as a, createPayloadClient as b, createPageQueries as c, createSiteQueries as d, index as i, resolveMedia as r };
|
|
97
|
+
export { type FooterData as F, type HeaderData as H, type ResolvedSocialMediaLink as R, type SiteNavItem as S, WEBSITE_CONTENT_TAG as W, type SiteSettingsData as a, createPayloadClient as b, createPageQueries as c, createSiteQueries as d, resolveSocialMediaLinks as e, index as i, resolveMedia as r };
|