@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.
@@ -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.mjs';
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 };
@@ -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-CXaTwojP.mjs';
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 };
@@ -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-CXaTwojP.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 };
package/dist/index.d.mts CHANGED
@@ -1,9 +1,10 @@
1
- export { i as admin } from './index-cDYkEj29.mjs';
1
+ export { i as admin } from './index-CodQ-io_.mjs';
2
2
  export { i as adminApp } from './index-ZbOx4OCF.mjs';
3
3
  export { i as blocks } from './index-CluwY0ZQ.mjs';
4
- export { i as nextjs } from './index-CpG3UHcS.mjs';
4
+ export { i as nextjs } from './index-CW02UDzl.mjs';
5
5
  export { i as studio } from './index-BIwu3qIH.mjs';
6
6
  export { i as studioPages } from './index-R7hA134j.mjs';
7
7
  import 'payload';
8
+ import './socialMedia-CXaTwojP.mjs';
8
9
  import 'react/jsx-runtime';
9
10
  import 'react';
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- export { i as admin } from './index-cDYkEj29.js';
1
+ export { i as admin } from './index-D8RxRIh3.js';
2
2
  export { i as adminApp } from './index-ZbOx4OCF.js';
3
3
  export { i as blocks } from './index-CluwY0ZQ.js';
4
- export { i as nextjs } from './index-CpG3UHcS.js';
4
+ export { i as nextjs } from './index-BBUjXVqQ.js';
5
5
  export { i as studio } from './index-BIwu3qIH.js';
6
6
  export { i as studioPages } from './index-vjrjy0P4.js';
7
7
  import 'payload';
8
+ import './socialMedia-CXaTwojP.js';
8
9
  import 'react/jsx-runtime';
9
10
  import 'react';
package/dist/index.js CHANGED
@@ -42,9 +42,16 @@ module.exports = __toCommonJS(index_exports);
42
42
  // src/admin/index.ts
43
43
  var admin_exports = {};
44
44
  __export(admin_exports, {
45
+ SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM: () => SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
46
+ SOCIAL_MEDIA_ICON_OPTIONS: () => SOCIAL_MEDIA_ICON_OPTIONS,
47
+ SOCIAL_MEDIA_PLATFORMS: () => SOCIAL_MEDIA_PLATFORMS,
48
+ SOCIAL_MEDIA_PLATFORM_LABELS: () => SOCIAL_MEDIA_PLATFORM_LABELS,
45
49
  configureAdmin: () => configureAdmin,
46
50
  createHeaderNavItemsField: () => createHeaderNavItemsField,
51
+ createSocialMediaConnectionsField: () => createSocialMediaConnectionsField,
52
+ createSocialMediaGlobal: () => createSocialMediaGlobal,
47
53
  createThemePreferenceField: () => createThemePreferenceField,
54
+ socialMediaConnectionsField: () => socialMediaConnectionsField,
48
55
  themePreferenceField: () => themePreferenceField,
49
56
  withTooltips: () => withTooltips
50
57
  });
@@ -254,6 +261,7 @@ function configureAdmin(config) {
254
261
  header: { group: "Site Design", label: "Header & Navigation" },
255
262
  footer: { group: "Site Design", label: "Footer" },
256
263
  "site-settings": { group: "Site Design", label: "Website Settings" },
264
+ "social-media": { group: "Site Design", label: "Social Media" },
257
265
  "contact-form": { group: "Lead Forms", label: "Contact Form" }
258
266
  };
259
267
  return globals2.map((global) => {
@@ -397,6 +405,150 @@ var createHeaderNavItemsField = () => ({
397
405
  ]
398
406
  });
399
407
 
408
+ // src/shared/socialMedia.ts
409
+ var SOCIAL_MEDIA_PLATFORM_LABELS = {
410
+ facebook: "Facebook",
411
+ instagram: "Instagram",
412
+ x: "X (Twitter)",
413
+ linkedin: "LinkedIn",
414
+ youtube: "YouTube",
415
+ tiktok: "TikTok",
416
+ pinterest: "Pinterest",
417
+ snapchat: "Snapchat"
418
+ };
419
+ var SOCIAL_MEDIA_PLATFORMS = [
420
+ "facebook",
421
+ "instagram",
422
+ "x",
423
+ "linkedin",
424
+ "youtube",
425
+ "tiktok",
426
+ "pinterest",
427
+ "snapchat"
428
+ ];
429
+ var SOCIAL_MEDIA_ICON_OPTIONS = {
430
+ facebook: [
431
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:facebook" },
432
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:facebook-f" }
433
+ ],
434
+ instagram: [
435
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:instagram" },
436
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" }
437
+ ],
438
+ x: [
439
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:x" },
440
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" }
441
+ ],
442
+ linkedin: [
443
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:linkedin" },
444
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" }
445
+ ],
446
+ youtube: [
447
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:youtube" },
448
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" }
449
+ ],
450
+ tiktok: [
451
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:tiktok" },
452
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" }
453
+ ],
454
+ pinterest: [
455
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:pinterest" },
456
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" }
457
+ ],
458
+ snapchat: [
459
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:snapchat" },
460
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" }
461
+ ]
462
+ };
463
+ var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
464
+ (acc, platform) => {
465
+ acc[platform] = SOCIAL_MEDIA_ICON_OPTIONS[platform][0].value;
466
+ return acc;
467
+ },
468
+ {}
469
+ );
470
+
471
+ // src/admin/fields/socialMedia.ts
472
+ 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.";
473
+ function validateOptionalHttpsUrl(value) {
474
+ if (value === null || value === void 0 || value === "") {
475
+ return true;
476
+ }
477
+ if (typeof value !== "string") {
478
+ return "Enter a valid URL.";
479
+ }
480
+ try {
481
+ const url = new URL(value);
482
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
483
+ return "Use an http:// or https:// URL.";
484
+ }
485
+ return true;
486
+ } catch {
487
+ return "Enter a valid URL (for example: https://instagram.com/yourbrand).";
488
+ }
489
+ }
490
+ function createPlatformField(platform) {
491
+ const platformLabel = SOCIAL_MEDIA_PLATFORM_LABELS[platform];
492
+ const iconOptions = SOCIAL_MEDIA_ICON_OPTIONS[platform].map((option) => ({
493
+ label: option.label,
494
+ value: option.value
495
+ }));
496
+ return {
497
+ name: platform,
498
+ type: "group",
499
+ label: platformLabel,
500
+ fields: [
501
+ {
502
+ name: "url",
503
+ type: "text",
504
+ admin: {
505
+ description: `Full ${platformLabel} profile URL. Leave blank to hide ${platformLabel}.`
506
+ },
507
+ validate: validateOptionalHttpsUrl
508
+ },
509
+ {
510
+ name: "icon",
511
+ type: "select",
512
+ defaultValue: SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform],
513
+ options: iconOptions,
514
+ admin: {
515
+ description: "Pick which icon style to display for this platform."
516
+ }
517
+ }
518
+ ]
519
+ };
520
+ }
521
+ var createSocialMediaConnectionsField = (options = {}) => {
522
+ const selectedPlatforms = Array.isArray(options.platforms) && options.platforms.length > 0 ? options.platforms : SOCIAL_MEDIA_PLATFORMS;
523
+ return {
524
+ name: options.name || "profiles",
525
+ type: "group",
526
+ label: options.label || "Social Media Profiles",
527
+ admin: {
528
+ description: options.description || DEFAULT_DESCRIPTION
529
+ },
530
+ fields: selectedPlatforms.map((platform) => createPlatformField(platform))
531
+ };
532
+ };
533
+ var socialMediaConnectionsField = createSocialMediaConnectionsField();
534
+
535
+ // src/admin/globals/socialMedia.ts
536
+ var createSocialMediaGlobal = (options = {}) => ({
537
+ slug: options.slug || "social-media",
538
+ label: "Social Media",
539
+ admin: {
540
+ description: options.description || "Manage social profile links and icon variants used across your website.",
541
+ group: "Site Design"
542
+ },
543
+ fields: [
544
+ createSocialMediaConnectionsField({
545
+ ...options.fieldOptions,
546
+ label: "Profiles",
547
+ name: "profiles"
548
+ })
549
+ ]
550
+ });
551
+
400
552
  // src/admin-app/index.ts
401
553
  var admin_app_exports = {};
402
554
  __export(admin_app_exports, {
@@ -2369,7 +2521,8 @@ __export(nextjs_exports, {
2369
2521
  createPageQueries: () => createPageQueries,
2370
2522
  createPayloadClient: () => createPayloadClient,
2371
2523
  createSiteQueries: () => createSiteQueries,
2372
- resolveMedia: () => resolveMedia
2524
+ resolveMedia: () => resolveMedia,
2525
+ resolveSocialMediaLinks: () => resolveSocialMediaLinks
2373
2526
  });
2374
2527
 
2375
2528
  // src/nextjs/client/payload.ts
@@ -3012,9 +3165,10 @@ var resolveBuilderThemeTokens = (layers) => {
3012
3165
  };
3013
3166
 
3014
3167
  // src/studio-pages/builder/settings-v2/BlockInspectorRenderer.tsx
3015
- var import_react = require("react");
3168
+ var import_react2 = require("react");
3016
3169
 
3017
3170
  // src/studio-pages/builder/ui/Accordion.tsx
3171
+ var import_react = require("react");
3018
3172
  var import_jsx_runtime4 = require("react/jsx-runtime");
3019
3173
 
3020
3174
  // src/studio-pages/builder/ui/ImageControls.tsx
@@ -3994,6 +4148,18 @@ function createSiteQueries(getPayloadClient, contentTag = "website-content") {
3994
4148
  ["footer-global"],
3995
4149
  { tags: [contentTag] }
3996
4150
  );
4151
+ const getSocialMediaCached = (0, import_cache2.unstable_cache)(
4152
+ async () => {
4153
+ const payload = await getPayloadClient();
4154
+ const socialMedia = await payload.findGlobal({
4155
+ slug: "social-media",
4156
+ depth: 1
4157
+ });
4158
+ return socialMedia;
4159
+ },
4160
+ ["social-media-global"],
4161
+ { tags: [contentTag] }
4162
+ );
3997
4163
  async function getSiteSettings(draft = false) {
3998
4164
  if (draft) {
3999
4165
  const payload = await getPayloadClient();
@@ -4030,10 +4196,23 @@ function createSiteQueries(getPayloadClient, contentTag = "website-content") {
4030
4196
  }
4031
4197
  return getFooterCached();
4032
4198
  }
4199
+ async function getSocialMedia(draft = false) {
4200
+ if (draft) {
4201
+ const payload = await getPayloadClient();
4202
+ const socialMedia = await payload.findGlobal({
4203
+ slug: "social-media",
4204
+ depth: 1,
4205
+ draft: true
4206
+ });
4207
+ return socialMedia;
4208
+ }
4209
+ return getSocialMediaCached();
4210
+ }
4033
4211
  return {
4034
4212
  getSiteSettings,
4035
4213
  getHeader,
4036
- getFooter
4214
+ getFooter,
4215
+ getSocialMedia
4037
4216
  };
4038
4217
  }
4039
4218
 
@@ -4059,6 +4238,32 @@ function resolveMedia(media) {
4059
4238
  }
4060
4239
  return null;
4061
4240
  }
4241
+
4242
+ // src/nextjs/utilities/socialMedia.ts
4243
+ function resolveSocialMediaLinks(data) {
4244
+ const profiles = data?.profiles;
4245
+ if (!profiles || typeof profiles !== "object") {
4246
+ return [];
4247
+ }
4248
+ return SOCIAL_MEDIA_PLATFORMS.reduce((acc, platform) => {
4249
+ const profile = profiles[platform];
4250
+ if (!profile || typeof profile !== "object") {
4251
+ return acc;
4252
+ }
4253
+ const url = typeof profile.url === "string" ? profile.url.trim() : "";
4254
+ if (!url) {
4255
+ return acc;
4256
+ }
4257
+ const icon = typeof profile.icon === "string" && profile.icon.trim().length > 0 ? profile.icon.trim() : SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform];
4258
+ acc.push({
4259
+ icon,
4260
+ label: SOCIAL_MEDIA_PLATFORM_LABELS[platform],
4261
+ platform,
4262
+ url
4263
+ });
4264
+ return acc;
4265
+ }, []);
4266
+ }
4062
4267
  // Annotate the CommonJS export names for ESM import in node:
4063
4268
  0 && (module.exports = {
4064
4269
  admin,
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  admin_exports
3
- } from "./chunk-HCEPGEAI.mjs";
3
+ } from "./chunk-YJPNN3O3.mjs";
4
4
  import {
5
5
  admin_app_exports
6
6
  } from "./chunk-XVH5SCBD.mjs";
@@ -9,13 +9,14 @@ import {
9
9
  } from "./chunk-XK3K5GRP.mjs";
10
10
  import {
11
11
  nextjs_exports
12
- } from "./chunk-H3UCUO3C.mjs";
12
+ } from "./chunk-CKEUQCDC.mjs";
13
+ import "./chunk-ZFJJQ4YK.mjs";
13
14
  import {
14
15
  studio_exports
15
16
  } from "./chunk-ADIIWIYL.mjs";
16
17
  import {
17
18
  studio_pages_exports
18
- } from "./chunk-SHC2KLT3.mjs";
19
+ } from "./chunk-C4J35SPJ.mjs";
19
20
  import "./chunk-SIL2J5MF.mjs";
20
21
  import "./chunk-6BWS3CLP.mjs";
21
22
  export {
@@ -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-CpG3UHcS.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-CW02UDzl.mjs';
2
+ export { S as SocialMediaGlobalData } from '../socialMedia-CXaTwojP.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-CpG3UHcS.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-BBUjXVqQ.js';
2
+ export { S as SocialMediaGlobalData } from '../socialMedia-CXaTwojP.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
 
@@ -378,9 +379,10 @@ var migrateBlockToSettingsV2 = (block) => {
378
379
  };
379
380
 
380
381
  // src/studio-pages/builder/settings-v2/BlockInspectorRenderer.tsx
381
- var import_react = require("react");
382
+ var import_react2 = require("react");
382
383
 
383
384
  // src/studio-pages/builder/ui/Accordion.tsx
385
+ var import_react = require("react");
384
386
  var import_jsx_runtime = require("react/jsx-runtime");
385
387
 
386
388
  // src/studio-pages/builder/ui/ImageControls.tsx
@@ -1181,6 +1183,18 @@ function createSiteQueries(getPayloadClient, contentTag = "website-content") {
1181
1183
  ["footer-global"],
1182
1184
  { tags: [contentTag] }
1183
1185
  );
1186
+ const getSocialMediaCached = (0, import_cache2.unstable_cache)(
1187
+ async () => {
1188
+ const payload = await getPayloadClient();
1189
+ const socialMedia = await payload.findGlobal({
1190
+ slug: "social-media",
1191
+ depth: 1
1192
+ });
1193
+ return socialMedia;
1194
+ },
1195
+ ["social-media-global"],
1196
+ { tags: [contentTag] }
1197
+ );
1184
1198
  async function getSiteSettings(draft = false) {
1185
1199
  if (draft) {
1186
1200
  const payload = await getPayloadClient();
@@ -1217,10 +1231,23 @@ function createSiteQueries(getPayloadClient, contentTag = "website-content") {
1217
1231
  }
1218
1232
  return getFooterCached();
1219
1233
  }
1234
+ async function getSocialMedia(draft = false) {
1235
+ if (draft) {
1236
+ const payload = await getPayloadClient();
1237
+ const socialMedia = await payload.findGlobal({
1238
+ slug: "social-media",
1239
+ depth: 1,
1240
+ draft: true
1241
+ });
1242
+ return socialMedia;
1243
+ }
1244
+ return getSocialMediaCached();
1245
+ }
1220
1246
  return {
1221
1247
  getSiteSettings,
1222
1248
  getHeader,
1223
- getFooter
1249
+ getFooter,
1250
+ getSocialMedia
1224
1251
  };
1225
1252
  }
1226
1253
 
@@ -1246,11 +1273,101 @@ function resolveMedia(media) {
1246
1273
  }
1247
1274
  return null;
1248
1275
  }
1276
+
1277
+ // src/shared/socialMedia.ts
1278
+ var SOCIAL_MEDIA_PLATFORM_LABELS = {
1279
+ facebook: "Facebook",
1280
+ instagram: "Instagram",
1281
+ x: "X (Twitter)",
1282
+ linkedin: "LinkedIn",
1283
+ youtube: "YouTube",
1284
+ tiktok: "TikTok",
1285
+ pinterest: "Pinterest",
1286
+ snapchat: "Snapchat"
1287
+ };
1288
+ var SOCIAL_MEDIA_PLATFORMS = [
1289
+ "facebook",
1290
+ "instagram",
1291
+ "x",
1292
+ "linkedin",
1293
+ "youtube",
1294
+ "tiktok",
1295
+ "pinterest",
1296
+ "snapchat"
1297
+ ];
1298
+ var SOCIAL_MEDIA_ICON_OPTIONS = {
1299
+ facebook: [
1300
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:facebook" },
1301
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:facebook-f" }
1302
+ ],
1303
+ instagram: [
1304
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:instagram" },
1305
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" }
1306
+ ],
1307
+ x: [
1308
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:x" },
1309
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" }
1310
+ ],
1311
+ linkedin: [
1312
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:linkedin" },
1313
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" }
1314
+ ],
1315
+ youtube: [
1316
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:youtube" },
1317
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" }
1318
+ ],
1319
+ tiktok: [
1320
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:tiktok" },
1321
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" }
1322
+ ],
1323
+ pinterest: [
1324
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:pinterest" },
1325
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" }
1326
+ ],
1327
+ snapchat: [
1328
+ { label: "Simple Icons", library: "simple-icons", value: "simple-icons:snapchat" },
1329
+ { label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" }
1330
+ ]
1331
+ };
1332
+ var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
1333
+ (acc, platform) => {
1334
+ acc[platform] = SOCIAL_MEDIA_ICON_OPTIONS[platform][0].value;
1335
+ return acc;
1336
+ },
1337
+ {}
1338
+ );
1339
+
1340
+ // src/nextjs/utilities/socialMedia.ts
1341
+ function resolveSocialMediaLinks(data) {
1342
+ const profiles = data?.profiles;
1343
+ if (!profiles || typeof profiles !== "object") {
1344
+ return [];
1345
+ }
1346
+ return SOCIAL_MEDIA_PLATFORMS.reduce((acc, platform) => {
1347
+ const profile = profiles[platform];
1348
+ if (!profile || typeof profile !== "object") {
1349
+ return acc;
1350
+ }
1351
+ const url = typeof profile.url === "string" ? profile.url.trim() : "";
1352
+ if (!url) {
1353
+ return acc;
1354
+ }
1355
+ const icon = typeof profile.icon === "string" && profile.icon.trim().length > 0 ? profile.icon.trim() : SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform];
1356
+ acc.push({
1357
+ icon,
1358
+ label: SOCIAL_MEDIA_PLATFORM_LABELS[platform],
1359
+ platform,
1360
+ url
1361
+ });
1362
+ return acc;
1363
+ }, []);
1364
+ }
1249
1365
  // Annotate the CommonJS export names for ESM import in node:
1250
1366
  0 && (module.exports = {
1251
1367
  WEBSITE_CONTENT_TAG,
1252
1368
  createPageQueries,
1253
1369
  createPayloadClient,
1254
1370
  createSiteQueries,
1255
- resolveMedia
1371
+ resolveMedia,
1372
+ resolveSocialMediaLinks
1256
1373
  });