@orion-studios/payload-studio 0.5.0-beta.96 → 0.5.0-beta.98

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 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
+ - Four icon choices per platform (`Simple Icons`, `Font Awesome Brands`, `Tabler Brands`, `Remix Icons`)
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
@@ -1,2 +1,3 @@
1
- export { A as AdminConfig, c as configureAdmin, a as createHeaderNavItemsField, b as createThemePreferenceField, t as themePreferenceField, w as withTooltips } from '../index-cDYkEj29.mjs';
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-CoYRBbf6.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-C05Iy-SV.mjs';
2
3
  import 'payload';
@@ -1,2 +1,3 @@
1
- export { A as AdminConfig, c as configureAdmin, a as createHeaderNavItemsField, b as createThemePreferenceField, t as themePreferenceField, w as withTooltips } from '../index-cDYkEj29.js';
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-BFXZue5i.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-C05Iy-SV.js';
2
3
  import 'payload';
@@ -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,178 @@ 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
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-facebook" },
423
+ { label: "Remix Icons", library: "remix-icons", value: "ri:facebook-fill" }
424
+ ],
425
+ instagram: [
426
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:instagram" },
427
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" },
428
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-instagram" },
429
+ { label: "Remix Icons", library: "remix-icons", value: "ri:instagram-fill" }
430
+ ],
431
+ x: [
432
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:x" },
433
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" },
434
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-x" },
435
+ { label: "Remix Icons", library: "remix-icons", value: "ri:twitter-x-fill" }
436
+ ],
437
+ linkedin: [
438
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:linkedin" },
439
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" },
440
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-linkedin" },
441
+ { label: "Remix Icons", library: "remix-icons", value: "ri:linkedin-fill" }
442
+ ],
443
+ youtube: [
444
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:youtube" },
445
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" },
446
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-youtube" },
447
+ { label: "Remix Icons", library: "remix-icons", value: "ri:youtube-fill" }
448
+ ],
449
+ tiktok: [
450
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:tiktok" },
451
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" },
452
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-tiktok" },
453
+ { label: "Remix Icons", library: "remix-icons", value: "ri:tiktok-fill" }
454
+ ],
455
+ pinterest: [
456
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:pinterest" },
457
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" },
458
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-pinterest" },
459
+ { label: "Remix Icons", library: "remix-icons", value: "ri:pinterest-fill" }
460
+ ],
461
+ snapchat: [
462
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:snapchat" },
463
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" },
464
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-snapchat" },
465
+ { label: "Remix Icons", library: "remix-icons", value: "ri:snapchat-fill" }
466
+ ]
467
+ };
468
+ var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
469
+ (acc, platform) => {
470
+ acc[platform] = SOCIAL_MEDIA_ICON_OPTIONS[platform][0].value;
471
+ return acc;
472
+ },
473
+ {}
474
+ );
475
+
476
+ // src/admin/fields/socialMedia.ts
477
+ 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.";
478
+ function validateOptionalHttpsUrl(value) {
479
+ if (value === null || value === void 0 || value === "") {
480
+ return true;
481
+ }
482
+ if (typeof value !== "string") {
483
+ return "Enter a valid URL.";
484
+ }
485
+ try {
486
+ const url = new URL(value);
487
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
488
+ return "Use an http:// or https:// URL.";
489
+ }
490
+ return true;
491
+ } catch {
492
+ return "Enter a valid URL (for example: https://instagram.com/yourbrand).";
493
+ }
494
+ }
495
+ function createPlatformField(platform) {
496
+ const platformLabel = SOCIAL_MEDIA_PLATFORM_LABELS[platform];
497
+ const iconOptions = SOCIAL_MEDIA_ICON_OPTIONS[platform].map((option) => ({
498
+ label: option.label,
499
+ value: option.value
500
+ }));
501
+ return {
502
+ name: platform,
503
+ type: "group",
504
+ label: platformLabel,
505
+ fields: [
506
+ {
507
+ name: "url",
508
+ type: "text",
509
+ admin: {
510
+ description: `Full ${platformLabel} profile URL. Leave blank to hide ${platformLabel}.`
511
+ },
512
+ validate: validateOptionalHttpsUrl
513
+ },
514
+ {
515
+ name: "icon",
516
+ type: "select",
517
+ defaultValue: SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform],
518
+ options: iconOptions,
519
+ admin: {
520
+ description: "Pick which icon style to display for this platform."
521
+ }
522
+ }
523
+ ]
524
+ };
525
+ }
526
+ var createSocialMediaConnectionsField = (options = {}) => {
527
+ const selectedPlatforms = Array.isArray(options.platforms) && options.platforms.length > 0 ? options.platforms : SOCIAL_MEDIA_PLATFORMS;
528
+ return {
529
+ name: options.name || "profiles",
530
+ type: "group",
531
+ label: options.label || "Social Media Profiles",
532
+ admin: {
533
+ description: options.description || DEFAULT_DESCRIPTION
534
+ },
535
+ fields: selectedPlatforms.map((platform) => createPlatformField(platform))
536
+ };
537
+ };
538
+ var socialMediaConnectionsField = createSocialMediaConnectionsField();
539
+
540
+ // src/admin/globals/socialMedia.ts
541
+ var createSocialMediaGlobal = (options = {}) => ({
542
+ slug: options.slug || "social-media",
543
+ label: "Social Media",
544
+ admin: {
545
+ description: options.description || "Manage social profile links and icon variants used across your website.",
546
+ group: "Site Design"
547
+ },
548
+ fields: [
549
+ createSocialMediaConnectionsField({
550
+ ...options.fieldOptions,
551
+ label: "Profiles",
552
+ name: "profiles"
553
+ })
554
+ ]
555
+ });
388
556
  // Annotate the CommonJS export names for ESM import in node:
389
557
  0 && (module.exports = {
558
+ SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
559
+ SOCIAL_MEDIA_ICON_OPTIONS,
560
+ SOCIAL_MEDIA_PLATFORMS,
561
+ SOCIAL_MEDIA_PLATFORM_LABELS,
390
562
  configureAdmin,
391
563
  createHeaderNavItemsField,
564
+ createSocialMediaConnectionsField,
565
+ createSocialMediaGlobal,
392
566
  createThemePreferenceField,
567
+ socialMediaConnectionsField,
393
568
  themePreferenceField,
394
569
  withTooltips
395
570
  });
@@ -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-HCEPGEAI.mjs";
10
+ } from "../chunk-2FO2ROW4.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-ZTXJG4K5.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
  };
@@ -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-ZTXJG4K5.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
  };
@@ -1,3 +1,8 @@
1
+ import {
2
+ SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
3
+ SOCIAL_MEDIA_PLATFORMS,
4
+ SOCIAL_MEDIA_PLATFORM_LABELS
5
+ } from "./chunk-ZTXJG4K5.mjs";
1
6
  import {
2
7
  assertStudioDocumentV1
3
8
  } from "./chunk-ADIIWIYL.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
  };
@@ -0,0 +1,85 @@
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
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-facebook" },
27
+ { label: "Remix Icons", library: "remix-icons", value: "ri:facebook-fill" }
28
+ ],
29
+ instagram: [
30
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:instagram" },
31
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" },
32
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-instagram" },
33
+ { label: "Remix Icons", library: "remix-icons", value: "ri:instagram-fill" }
34
+ ],
35
+ x: [
36
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:x" },
37
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" },
38
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-x" },
39
+ { label: "Remix Icons", library: "remix-icons", value: "ri:twitter-x-fill" }
40
+ ],
41
+ linkedin: [
42
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:linkedin" },
43
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" },
44
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-linkedin" },
45
+ { label: "Remix Icons", library: "remix-icons", value: "ri:linkedin-fill" }
46
+ ],
47
+ youtube: [
48
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:youtube" },
49
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" },
50
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-youtube" },
51
+ { label: "Remix Icons", library: "remix-icons", value: "ri:youtube-fill" }
52
+ ],
53
+ tiktok: [
54
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:tiktok" },
55
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" },
56
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-tiktok" },
57
+ { label: "Remix Icons", library: "remix-icons", value: "ri:tiktok-fill" }
58
+ ],
59
+ pinterest: [
60
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:pinterest" },
61
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" },
62
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-pinterest" },
63
+ { label: "Remix Icons", library: "remix-icons", value: "ri:pinterest-fill" }
64
+ ],
65
+ snapchat: [
66
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:snapchat" },
67
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" },
68
+ { label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-snapchat" },
69
+ { label: "Remix Icons", library: "remix-icons", value: "ri:snapchat-fill" }
70
+ ]
71
+ };
72
+ var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
73
+ (acc, platform) => {
74
+ acc[platform] = SOCIAL_MEDIA_ICON_OPTIONS[platform][0].value;
75
+ return acc;
76
+ },
77
+ {}
78
+ );
79
+
80
+ export {
81
+ SOCIAL_MEDIA_PLATFORM_LABELS,
82
+ SOCIAL_MEDIA_PLATFORMS,
83
+ SOCIAL_MEDIA_ICON_OPTIONS,
84
+ SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM
85
+ };
@@ -1,4 +1,5 @@
1
1
  import { Field, CollectionConfig, GlobalConfig } from 'payload';
2
+ import { a as SocialMediaPlatform, 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, h as SocialMediaProfileData, i as SocialMediaProfilesData } from './socialMedia-C05Iy-SV.js';
2
3
 
3
4
  type ThemeOption = 'light' | 'dark' | 'brand-light' | 'brand-dark';
4
5
  declare const createThemePreferenceField: (defaultTheme?: ThemeOption) => Field;
@@ -133,14 +134,45 @@ declare function withTooltips(fields: Field[], customTooltips?: Record<string, s
133
134
 
134
135
  declare const createHeaderNavItemsField: () => Field;
135
136
 
137
+ type CreateSocialMediaConnectionsFieldOptions = {
138
+ description?: string;
139
+ label?: string;
140
+ name?: string;
141
+ platforms?: SocialMediaPlatform[];
142
+ };
143
+ declare const createSocialMediaConnectionsField: (options?: CreateSocialMediaConnectionsFieldOptions) => Field;
144
+ declare const socialMediaConnectionsField: Field;
145
+
146
+ type CreateSocialMediaGlobalOptions = {
147
+ description?: string;
148
+ fieldOptions?: Omit<CreateSocialMediaConnectionsFieldOptions, 'label' | 'name'>;
149
+ slug?: string;
150
+ };
151
+ declare const createSocialMediaGlobal: (options?: CreateSocialMediaGlobalOptions) => GlobalConfig;
152
+
136
153
  type index_AdminConfig = AdminConfig;
154
+ type index_CreateSocialMediaConnectionsFieldOptions = CreateSocialMediaConnectionsFieldOptions;
155
+ type index_CreateSocialMediaGlobalOptions = CreateSocialMediaGlobalOptions;
156
+ declare const index_SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM: typeof SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM;
157
+ declare const index_SOCIAL_MEDIA_ICON_OPTIONS: typeof SOCIAL_MEDIA_ICON_OPTIONS;
158
+ declare const index_SOCIAL_MEDIA_PLATFORMS: typeof SOCIAL_MEDIA_PLATFORMS;
159
+ declare const index_SOCIAL_MEDIA_PLATFORM_LABELS: typeof SOCIAL_MEDIA_PLATFORM_LABELS;
160
+ declare const index_SocialMediaGlobalData: typeof SocialMediaGlobalData;
161
+ declare const index_SocialMediaIconLibrary: typeof SocialMediaIconLibrary;
162
+ declare const index_SocialMediaIconOption: typeof SocialMediaIconOption;
163
+ declare const index_SocialMediaPlatform: typeof SocialMediaPlatform;
164
+ declare const index_SocialMediaProfileData: typeof SocialMediaProfileData;
165
+ declare const index_SocialMediaProfilesData: typeof SocialMediaProfilesData;
137
166
  declare const index_configureAdmin: typeof configureAdmin;
138
167
  declare const index_createHeaderNavItemsField: typeof createHeaderNavItemsField;
168
+ declare const index_createSocialMediaConnectionsField: typeof createSocialMediaConnectionsField;
169
+ declare const index_createSocialMediaGlobal: typeof createSocialMediaGlobal;
139
170
  declare const index_createThemePreferenceField: typeof createThemePreferenceField;
171
+ declare const index_socialMediaConnectionsField: typeof socialMediaConnectionsField;
140
172
  declare const index_themePreferenceField: typeof themePreferenceField;
141
173
  declare const index_withTooltips: typeof withTooltips;
142
174
  declare namespace index {
143
- export { type index_AdminConfig as AdminConfig, index_configureAdmin as configureAdmin, index_createHeaderNavItemsField as createHeaderNavItemsField, index_createThemePreferenceField as createThemePreferenceField, index_themePreferenceField as themePreferenceField, index_withTooltips as withTooltips };
175
+ export { type index_AdminConfig as AdminConfig, type index_CreateSocialMediaConnectionsFieldOptions as CreateSocialMediaConnectionsFieldOptions, type index_CreateSocialMediaGlobalOptions as CreateSocialMediaGlobalOptions, index_SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM as SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM, index_SOCIAL_MEDIA_ICON_OPTIONS as SOCIAL_MEDIA_ICON_OPTIONS, index_SOCIAL_MEDIA_PLATFORMS as SOCIAL_MEDIA_PLATFORMS, index_SOCIAL_MEDIA_PLATFORM_LABELS as SOCIAL_MEDIA_PLATFORM_LABELS, index_SocialMediaGlobalData as SocialMediaGlobalData, index_SocialMediaIconLibrary as SocialMediaIconLibrary, index_SocialMediaIconOption as SocialMediaIconOption, index_SocialMediaPlatform as SocialMediaPlatform, index_SocialMediaProfileData as SocialMediaProfileData, index_SocialMediaProfilesData as SocialMediaProfilesData, index_configureAdmin as configureAdmin, index_createHeaderNavItemsField as createHeaderNavItemsField, index_createSocialMediaConnectionsField as createSocialMediaConnectionsField, index_createSocialMediaGlobal as createSocialMediaGlobal, index_createThemePreferenceField as createThemePreferenceField, index_socialMediaConnectionsField as socialMediaConnectionsField, index_themePreferenceField as themePreferenceField, index_withTooltips as withTooltips };
144
176
  }
145
177
 
146
- export { type AdminConfig as A, createHeaderNavItemsField as a, createThemePreferenceField as b, configureAdmin as c, index as i, themePreferenceField as t, withTooltips as w };
178
+ export { type AdminConfig as A, type CreateSocialMediaConnectionsFieldOptions as C, type CreateSocialMediaGlobalOptions as a, createHeaderNavItemsField as b, configureAdmin as c, createSocialMediaConnectionsField as d, createSocialMediaGlobal as e, createThemePreferenceField as f, index as i, socialMediaConnectionsField as s, themePreferenceField as t, withTooltips as w };