riverbankcms 0.2.2 → 0.4.2

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.
@@ -609,6 +609,7 @@ function formatCoursePriceDisplayLabel(display, options) {
609
609
  case "exact": return `Course (${formatCurrencyAmount(display.amount, display.currency, options)})`;
610
610
  case "from": return `Course (From ${formatCurrencyAmount(display.amount, display.currency, options)})`;
611
611
  case "range": return `Course (${formatCurrencyAmount(display.minAmount, display.currency, options)} - ${formatCurrencyAmount(display.maxAmount, display.currency, options)})`;
612
+ case "mixed": return display.paidToAmount > display.paidFromAmount ? `Course (Free / ${formatCurrencyAmount(display.paidFromAmount, display.currency, options)} - ${formatCurrencyAmount(display.paidToAmount, display.currency, options)})` : `Course (Free / ${formatCurrencyAmount(display.paidFromAmount, display.currency, options)})`;
612
613
  default: return assertNever(display);
613
614
  }
614
615
  }
@@ -4694,4 +4695,675 @@ function disabledSelection() {
4694
4695
  }
4695
4696
 
4696
4697
  //#endregion
4697
- export { unsafeAsDetectedMimeType as $, parseUtcIsoDateTimeString as A, formatCurrencyAmount as B, formatBookingDateParts as C, getBookingLocalDateKey as D, formatLocalScheduleTime as E, parseEventPageSurfaceSubject as F, parsePageId as G, parseApiKeyId as H, formatBookingPriceDisplay as I, unsafeAsAppointmentResourceId as J, parseSiteId as K, formatEventPricing as L, toScheduledBookingDateRange as M, toScheduledBookingDateTime as N, getLocalScheduleDate as O, parseBookingTimeZone as P, unsafeAsDemoCapability as Q, publicEventPricingCurrency as R, formatBookingDate as S, formatLocalScheduleDate as T, parseEventSeriesId as U, assertNever as V, parseMediaAssetId as W, unsafeAsBookingSessionId as X, unsafeAsBookingRequirementId as Y, unsafeAsDeclaredMimeType as Z, mapNonEmptyArray as _, unsafeAsUploadSessionId as _t, stableJsonStringify as a, unsafeAsOccurrenceId as at, normalizeLocationAddressText as b, ok as bt, parseFooterModuleId as c, unsafeAsPositiveSeconds as ct, parseNewsletterListId as d, unsafeAsSiteFontId as dt, unsafeAsEntitlementId as et, parseNewsletterSignupAuthoringDestinationValue as f, unsafeAsSiteId as ft, fromArray as g, unsafeAsStoragePath as gt, assertAllowedPublicUrl as h, unsafeAsStorageBucketName as ht, parseManagementKey as i, unsafeAsMediaAssetId as it, toBookingTimeZone as j, getLocalScheduleTime as k, parseMailchimpAudienceId as l, unsafeAsProductId as lt, isCanonicalRichTextDoc as m, unsafeAsStaffMemberId as mt, createSecret as n, unsafeAsEventSeriesId as nt, footerNavigationLayouts as o, unsafeAsOriginalFilename as ot, parseNewsletterSignupDestinationProvider as p, unsafeAsSiteScopedStoragePath as pt, parseUserId as q, exposeSecret as r, unsafeAsFileChecksumSha256 as rt, parseFooterCompositionV1 as s, unsafeAsPositiveByteCount as st, resolvePlanningDateInput as t, unsafeAsEventOfferingId as tt, parseMailchimpTagName as u, unsafeAsSafeDownloadFilename as ut, hasText as v, unsafeAsUserId as vt, formatBookingTime as w, toLocationCoordinates as x, isPresent as y, err as yt, publicEventPricingType as z };
4698
+ //#region ../core/src/event-series-behaviour.ts
4699
+ const EVENT_PRESET_VALUES = [
4700
+ "event",
4701
+ "class",
4702
+ "course",
4703
+ "term",
4704
+ "workshop",
4705
+ "retreat",
4706
+ "performance"
4707
+ ];
4708
+ const ORDINARY_EVENT_PRESET_VALUES = [
4709
+ "event",
4710
+ "class",
4711
+ "workshop",
4712
+ "retreat",
4713
+ "performance"
4714
+ ];
4715
+ const WHOLE_SERIES_EVENT_PRESET_VALUES = ["course", "term"];
4716
+ const SURFACE_EVENT_PRESET_VALUES = [
4717
+ "class",
4718
+ "course",
4719
+ "term",
4720
+ "workshop",
4721
+ "retreat",
4722
+ "performance"
4723
+ ];
4724
+ const DEFAULT_EVENT_TYPE_PRESETS = [
4725
+ "event",
4726
+ "class",
4727
+ "course",
4728
+ "term",
4729
+ "workshop",
4730
+ "retreat"
4731
+ ];
4732
+ const EVENT_SERIES_BEHAVIOURS = [
4733
+ "class",
4734
+ "course",
4735
+ "workshop",
4736
+ "retreat",
4737
+ "performance"
4738
+ ];
4739
+ /** Keeps Term as Event vocabulary without introducing a second booking engine. */
4740
+ function eventPresetForVerticalPreset(preset) {
4741
+ return preset.eventPresetOverride ?? preset.canonicalBehaviour;
4742
+ }
4743
+
4744
+ //#endregion
4745
+ //#region ../core/src/booking-vertical-preset.ts
4746
+ const BOOKING_ENGINE_BY_BEHAVIOUR = {
4747
+ class: "event_series",
4748
+ workshop: "event_series",
4749
+ course: "event_series",
4750
+ retreat: "event_series",
4751
+ performance: "event_series",
4752
+ appointment: "appointment_service"
4753
+ };
4754
+ const BOOKING_DEFAULTS_BY_BEHAVIOUR = {
4755
+ class: {
4756
+ passes: "on",
4757
+ memberships: "on"
4758
+ },
4759
+ workshop: {
4760
+ passes: "off",
4761
+ memberships: "off"
4762
+ },
4763
+ course: {
4764
+ passes: "off",
4765
+ memberships: "strict"
4766
+ },
4767
+ retreat: {
4768
+ passes: "off",
4769
+ memberships: "off"
4770
+ },
4771
+ performance: {
4772
+ passes: "off",
4773
+ memberships: "off"
4774
+ },
4775
+ appointment: {
4776
+ passes: "off",
4777
+ memberships: "off"
4778
+ }
4779
+ };
4780
+ function verticalBookingPreset(id, verticalId, canonicalBehaviour, label, pluralLabel, description, availability = "onboarding") {
4781
+ return {
4782
+ id,
4783
+ verticalId,
4784
+ canonicalBehaviour,
4785
+ engine: BOOKING_ENGINE_BY_BEHAVIOUR[canonicalBehaviour],
4786
+ availability,
4787
+ label,
4788
+ pluralLabel,
4789
+ description
4790
+ };
4791
+ }
4792
+
4793
+ //#endregion
4794
+ //#region ../core/src/booking-vertical-definitions.ts
4795
+ const VERTICAL_DEFINITIONS = [
4796
+ {
4797
+ id: "yoga_wellness",
4798
+ label: "Yoga, meditation or mindfulness",
4799
+ description: "Yoga studios, wellness teachers, and movement practitioners."
4800
+ },
4801
+ {
4802
+ id: "fitness_pt",
4803
+ label: "Fitness and personal training",
4804
+ description: "Personal trainers, group training, and fitness programmes."
4805
+ },
4806
+ {
4807
+ id: "dance_school",
4808
+ label: "Dance school",
4809
+ description: "Dance classes, courses or terms, workshops, private lessons, and shows."
4810
+ },
4811
+ {
4812
+ id: "physiotherapy_physical_health",
4813
+ label: "Physiotherapy & physical health",
4814
+ description: "Physiotherapists, chiropractors, osteopaths, sports therapists, and rehabilitation practitioners."
4815
+ },
4816
+ {
4817
+ id: "massage_bodywork",
4818
+ label: "Massage & bodywork",
4819
+ description: "Massage therapists, bodyworkers, and somatic practitioners."
4820
+ },
4821
+ {
4822
+ id: "therapist_practitioner",
4823
+ label: "Therapist or practitioner",
4824
+ description: "Appointments, sessions, consultations, and occasional group work."
4825
+ },
4826
+ {
4827
+ id: "beauty_spa",
4828
+ label: "Beauty or spa",
4829
+ description: "Treatment-led businesses with optional workshops."
4830
+ },
4831
+ {
4832
+ id: "consultant_coach",
4833
+ label: "Consultant or coach",
4834
+ description: "One-to-one calls, workshops, courses, and retreats."
4835
+ },
4836
+ {
4837
+ id: "training_provider",
4838
+ label: "Training provider",
4839
+ description: "Courses, workshops, classes, appointments, and residential training."
4840
+ },
4841
+ {
4842
+ id: "retreat_centre",
4843
+ label: "Retreat centre",
4844
+ description: "Residential retreats, workshops, classes, courses, and private sessions."
4845
+ },
4846
+ {
4847
+ id: "music_school",
4848
+ label: "Music teacher or school",
4849
+ description: "Lessons, classes, terms, workshops, and performances."
4850
+ },
4851
+ {
4852
+ id: "voice_singing",
4853
+ label: "Voice & Singing",
4854
+ description: "Singing lessons, choirs, voice circles, workshops, and performances."
4855
+ },
4856
+ {
4857
+ id: "performing_arts_school",
4858
+ label: "Theatre or performing arts school",
4859
+ description: "Classes, terms, workshops, performances, and lessons."
4860
+ },
4861
+ {
4862
+ id: "community_wellbeing",
4863
+ label: "Community or wellbeing centre",
4864
+ description: "Groups, workshops, courses, appointments, and retreats."
4865
+ },
4866
+ {
4867
+ id: "venue_event_space",
4868
+ label: "Venue or event space",
4869
+ description: "Room, resource, or access bookings. Depends on the future capacity-booking domain."
4870
+ }
4871
+ ];
4872
+ const VERTICAL_IDS = VERTICAL_DEFINITIONS.map(({ id }) => id);
4873
+
4874
+ //#endregion
4875
+ //#region ../core/src/booking-vertical-catalog.ts
4876
+ const VERTICAL_BOOKING_PRESETS = [
4877
+ verticalBookingPreset("yoga_wellness.classes", "yoga_wellness", "class", "Class", "Classes", "Regular scheduled classes and group sessions."),
4878
+ verticalBookingPreset("yoga_wellness.workshops", "yoga_wellness", "workshop", "Workshop", "Workshops", "One-off workshops, day retreats, or special sessions."),
4879
+ verticalBookingPreset("yoga_wellness.courses", "yoga_wellness", "course", "Course", "Courses", "Fixed-schedule courses or multi-session groups."),
4880
+ verticalBookingPreset("yoga_wellness.retreats", "yoga_wellness", "retreat", "Retreat", "Retreats", "Multi-day or residential retreats and immersive experiences."),
4881
+ verticalBookingPreset("yoga_wellness.appointments", "yoga_wellness", "appointment", "Appointment", "Appointments", "Private sessions, consultations, or one-to-one support."),
4882
+ verticalBookingPreset("fitness_pt.group_training", "fitness_pt", "class", "Group training", "Group training", "Regular scheduled classes and group sessions."),
4883
+ verticalBookingPreset("fitness_pt.personal_training", "fitness_pt", "appointment", "Personal training", "Personal training", "One-to-one sessions booked from your availability."),
4884
+ verticalBookingPreset("fitness_pt.programmes", "fitness_pt", "course", "Programme", "Programmes", "Multi-session programmes like bootcamps or courses."),
4885
+ verticalBookingPreset("fitness_pt.workshops", "fitness_pt", "workshop", "Workshop", "Workshops", "One-off workshops, events, or special sessions."),
4886
+ verticalBookingPreset("fitness_pt.retreats", "fitness_pt", "retreat", "Retreat", "Retreats", "Multi-day or residential fitness experiences."),
4887
+ verticalBookingPreset("dance_school.classes", "dance_school", "class", "Class", "Classes", "Regular group classes and weekly sessions."),
4888
+ {
4889
+ ...verticalBookingPreset("dance_school.terms", "dance_school", "course", "Term", "Terms", "Multi-week term blocks or fixed-date course groups."),
4890
+ eventPresetOverride: "term"
4891
+ },
4892
+ verticalBookingPreset("dance_school.courses", "dance_school", "course", "Course", "Courses", "Fixed-schedule courses or multi-session groups.", "settings"),
4893
+ verticalBookingPreset("dance_school.workshops", "dance_school", "workshop", "Workshop", "Workshops", "One-off workshops, masterclasses, or intensives."),
4894
+ verticalBookingPreset("dance_school.private_lessons", "dance_school", "appointment", "Private lesson", "Private lessons", "One-to-one lessons or coaching sessions."),
4895
+ verticalBookingPreset("dance_school.shows", "dance_school", "performance", "Show", "Shows", "Ticketed performances, showcases, and recitals."),
4896
+ verticalBookingPreset("physiotherapy_physical_health.appointments", "physiotherapy_physical_health", "appointment", "Appointment", "Appointments", "Assessments, treatments, follow-ups, and rehabilitation sessions."),
4897
+ verticalBookingPreset("physiotherapy_physical_health.rehab_classes", "physiotherapy_physical_health", "class", "Rehab class", "Rehab classes", "Regular rehabilitation, mobility, strength, or recovery classes."),
4898
+ verticalBookingPreset("physiotherapy_physical_health.workshops", "physiotherapy_physical_health", "workshop", "Workshop", "Workshops", "One-off workshops, talks, or practical group sessions."),
4899
+ verticalBookingPreset("massage_bodywork.treatments", "massage_bodywork", "appointment", "Treatment", "Treatments", "Massage treatments, bodywork sessions, and one-to-one appointments."),
4900
+ verticalBookingPreset("massage_bodywork.group_sessions", "massage_bodywork", "class", "Group session", "Group sessions", "Regular bodywork, somatic movement, or self-massage sessions."),
4901
+ verticalBookingPreset("massage_bodywork.workshops", "massage_bodywork", "workshop", "Workshop", "Workshops", "One-off bodywork, self-massage, or somatic practice workshops."),
4902
+ verticalBookingPreset("therapist_practitioner.appointments", "therapist_practitioner", "appointment", "Appointment", "Appointments", "Sessions, consultations, treatments, or assessments."),
4903
+ verticalBookingPreset("therapist_practitioner.workshops", "therapist_practitioner", "workshop", "Workshop", "Workshops", "One-off group workshops, talks, or wellbeing sessions."),
4904
+ verticalBookingPreset("therapist_practitioner.retreats", "therapist_practitioner", "retreat", "Retreat", "Retreats", "Multi-day retreats or immersive group experiences."),
4905
+ verticalBookingPreset("beauty_spa.appointments", "beauty_spa", "appointment", "Appointment", "Appointments", "Treatments, consultations, services, and sessions."),
4906
+ verticalBookingPreset("beauty_spa.workshops", "beauty_spa", "workshop", "Workshop", "Workshops", "Skincare workshops, makeup lessons, demos, or group events."),
4907
+ verticalBookingPreset("consultant_coach.appointments", "consultant_coach", "appointment", "Appointment", "Appointments", "One-to-one calls, consultations, reviews, or coaching sessions."),
4908
+ verticalBookingPreset("consultant_coach.workshops", "consultant_coach", "workshop", "Workshop", "Workshops", "One-off group sessions, webinars, or strategy days."),
4909
+ verticalBookingPreset("consultant_coach.courses", "consultant_coach", "course", "Course", "Courses", "Fixed-schedule cohorts or multi-session group programmes."),
4910
+ verticalBookingPreset("consultant_coach.retreats", "consultant_coach", "retreat", "Retreat", "Retreats", "Multi-day coaching retreats or immersive experiences."),
4911
+ verticalBookingPreset("training_provider.courses", "training_provider", "course", "Course", "Courses", "Fixed-schedule courses, cohorts, and multi-session training."),
4912
+ verticalBookingPreset("training_provider.workshops", "training_provider", "workshop", "Workshop", "Workshops", "One-off workshops, masterclasses, and short training sessions."),
4913
+ verticalBookingPreset("training_provider.appointments", "training_provider", "appointment", "Appointment", "Appointments", "Consultations, assessments, mentoring, or office hours."),
4914
+ verticalBookingPreset("training_provider.classes", "training_provider", "class", "Class", "Classes", "Regular classes, sessions, or groups.", "settings"),
4915
+ verticalBookingPreset("training_provider.residentials", "training_provider", "retreat", "Residential", "Residentials", "Residential courses or multi-day training experiences.", "settings"),
4916
+ verticalBookingPreset("retreat_centre.retreats", "retreat_centre", "retreat", "Retreat", "Retreats", "Multi-day or residential retreats with richer booking needs."),
4917
+ verticalBookingPreset("retreat_centre.workshops", "retreat_centre", "workshop", "Workshop", "Workshops", "One-day retreats, ceremonies, workshops, or special events."),
4918
+ verticalBookingPreset("retreat_centre.classes", "retreat_centre", "class", "Class", "Classes", "Regular sessions like guided meditations or group practices."),
4919
+ verticalBookingPreset("retreat_centre.courses", "retreat_centre", "course", "Course", "Courses", "Fixed-schedule programmes or multi-session experiences."),
4920
+ verticalBookingPreset("retreat_centre.appointments", "retreat_centre", "appointment", "Appointment", "Appointments", "Private sessions, therapies, consultations, or add-ons."),
4921
+ verticalBookingPreset("music_school.lessons", "music_school", "appointment", "Lesson", "Lessons", "One-to-one lessons, consultations, or coaching sessions."),
4922
+ verticalBookingPreset("music_school.classes", "music_school", "class", "Class", "Classes", "Regular group classes, ensembles, or recurring sessions."),
4923
+ {
4924
+ ...verticalBookingPreset("music_school.terms", "music_school", "course", "Term", "Terms", "Multi-week term blocks or fixed-date group courses."),
4925
+ eventPresetOverride: "term"
4926
+ },
4927
+ verticalBookingPreset("music_school.workshops", "music_school", "workshop", "Workshop", "Workshops", "One-off workshops, masterclasses, or intensives."),
4928
+ verticalBookingPreset("music_school.performances", "music_school", "performance", "Performance", "Performances", "Concerts, recitals, showcases, or ticketed performances."),
4929
+ verticalBookingPreset("voice_singing.lessons", "voice_singing", "appointment", "Voice session", "Voice sessions", "One-to-one singing lessons, voice coaching, or private practice sessions."),
4930
+ verticalBookingPreset("voice_singing.classes", "voice_singing", "class", "Ongoing weekly session", "Ongoing weekly sessions", "Regular choirs, voice circles, community singing, or group practice."),
4931
+ {
4932
+ ...verticalBookingPreset("voice_singing.terms", "voice_singing", "course", "Singing term", "Singing terms", "Multi-week choir terms, voice courses, or fixed-date group programmes."),
4933
+ eventPresetOverride: "term"
4934
+ },
4935
+ verticalBookingPreset("voice_singing.workshops", "voice_singing", "workshop", "Workshop", "Workshops", "One-off singing workshops, voice journeys, or devotional singing sessions."),
4936
+ verticalBookingPreset("voice_singing.performances", "voice_singing", "performance", "Performance", "Performances", "Choir concerts, sharing events, recitals, or community performances."),
4937
+ verticalBookingPreset("performing_arts_school.classes", "performing_arts_school", "class", "Class", "Classes", "Regular group classes, rehearsals, or weekly sessions."),
4938
+ {
4939
+ ...verticalBookingPreset("performing_arts_school.terms", "performing_arts_school", "course", "Term", "Terms", "Multi-week term blocks or fixed-date course groups."),
4940
+ eventPresetOverride: "term"
4941
+ },
4942
+ verticalBookingPreset("performing_arts_school.workshops", "performing_arts_school", "workshop", "Workshop", "Workshops", "One-off workshops, masterclasses, or intensives."),
4943
+ verticalBookingPreset("performing_arts_school.performances", "performing_arts_school", "performance", "Performance", "Performances", "Shows, showcases, productions, or ticketed performances."),
4944
+ verticalBookingPreset("performing_arts_school.lessons", "performing_arts_school", "appointment", "Lesson", "Lessons", "One-to-one lessons, coaching, or audition prep."),
4945
+ verticalBookingPreset("community_wellbeing.classes", "community_wellbeing", "class", "Class", "Classes", "Regular groups, sessions, practices, or weekly activities."),
4946
+ verticalBookingPreset("community_wellbeing.workshops", "community_wellbeing", "workshop", "Workshop", "Workshops", "One-off workshops, talks, events, or gatherings."),
4947
+ verticalBookingPreset("community_wellbeing.courses", "community_wellbeing", "course", "Course", "Courses", "Fixed-schedule courses, study groups, or multi-session programmes."),
4948
+ verticalBookingPreset("community_wellbeing.appointments", "community_wellbeing", "appointment", "Appointment", "Appointments", "One-to-one appointments, consultations, or support sessions."),
4949
+ verticalBookingPreset("community_wellbeing.retreats", "community_wellbeing", "retreat", "Retreat", "Retreats", "Multi-day or residential retreats."),
4950
+ verticalBookingPreset("venue_event_space.resource_hire", "venue_event_space", "appointment", "Hire slot", "Hire slots", "Future room, venue, and resource hire bookings.", "future")
4951
+ ];
4952
+
4953
+ //#endregion
4954
+ //#region ../core/src/booking-vertical-config.ts
4955
+ const DEFAULT_ONBOARDING_PRESET_ID_BY_VERTICAL = {
4956
+ yoga_wellness: null,
4957
+ fitness_pt: null,
4958
+ dance_school: null,
4959
+ physiotherapy_physical_health: "physiotherapy_physical_health.appointments",
4960
+ massage_bodywork: "massage_bodywork.treatments",
4961
+ therapist_practitioner: null,
4962
+ beauty_spa: null,
4963
+ consultant_coach: null,
4964
+ training_provider: null,
4965
+ retreat_centre: null,
4966
+ music_school: null,
4967
+ voice_singing: null,
4968
+ performing_arts_school: null,
4969
+ community_wellbeing: null,
4970
+ venue_event_space: null
4971
+ };
4972
+ const VERTICAL_ID_SET = new Set(VERTICAL_DEFINITIONS.map(({ id }) => id));
4973
+ const VERTICAL_PRESET_ID_SET = new Set(VERTICAL_BOOKING_PRESETS.map((presetDefinition) => presetDefinition.id));
4974
+ function parseVerticalId(value) {
4975
+ return typeof value === "string" && VERTICAL_ID_SET.has(value) ? value : null;
4976
+ }
4977
+ function parseVerticalPresetId(value) {
4978
+ return typeof value === "string" && VERTICAL_PRESET_ID_SET.has(value) ? value : null;
4979
+ }
4980
+ function getVerticalDefinition(verticalId) {
4981
+ const definition = VERTICAL_DEFINITIONS.find((vertical) => vertical.id === verticalId);
4982
+ if (definition === undefined) {
4983
+ throw new Error(`Unhandled vertical id: ${verticalId}`);
4984
+ }
4985
+ return definition;
4986
+ }
4987
+ function getVerticalPresetDefinition(presetId) {
4988
+ const definition = VERTICAL_BOOKING_PRESETS.find((presetDefinition) => presetDefinition.id === presetId);
4989
+ if (definition === undefined) {
4990
+ throw new Error(`Unhandled vertical preset id: ${presetId}`);
4991
+ }
4992
+ return definition;
4993
+ }
4994
+ function getDefaultOnboardingPresetForVertical(verticalId) {
4995
+ const presetId = DEFAULT_ONBOARDING_PRESET_ID_BY_VERTICAL[verticalId];
4996
+ return presetId ? getVerticalPresetDefinition(presetId) : null;
4997
+ }
4998
+ function createConfiguredSiteVerticalBookingConfig(verticalId, selectedPresetIds) {
4999
+ return {
5000
+ verticalId,
5001
+ selectedPresetIds
5002
+ };
5003
+ }
5004
+ function toNonEmptyVerticalPresetIds(presetIds) {
5005
+ const firstPresetId = presetIds[0];
5006
+ return firstPresetId ? [firstPresetId, ...presetIds.slice(1)] : null;
5007
+ }
5008
+ /**
5009
+ * Construct a configured booking selection only when the supplied preset IDs
5010
+ * form a valid selection for the vertical. Invalid, cross-vertical, future,
5011
+ * duplicate, or empty selections return null.
5012
+ */
5013
+ function createSiteVerticalBookingConfig(verticalId, selectedPresetIds) {
5014
+ const resolved = resolveSiteVerticalBookingConfig({
5015
+ verticalId,
5016
+ selectedPresetIds
5017
+ });
5018
+ return resolved.kind === "configured" ? resolved.config : null;
5019
+ }
5020
+ const DEFAULT_SITE_VERTICAL_BOOKING_CONFIG = {
5021
+ verticalId: null,
5022
+ selectedPresetIds: []
5023
+ };
5024
+ function appendUniqueIssue(issues, issue) {
5025
+ return issues.some((existing) => existing.code === issue.code) ? issues : [...issues, issue];
5026
+ }
5027
+ function collectRawConfigIssues(rawConfig, config) {
5028
+ const rawPresetValue = rawConfig.selectedPresetIds;
5029
+ const rawPresetIds = Array.isArray(rawPresetValue) ? rawPresetValue : [];
5030
+ let issues = [];
5031
+ if (rawConfig.verticalId != null && config.verticalId === null) {
5032
+ issues = appendUniqueIssue(issues, {
5033
+ code: "unknown_vertical",
5034
+ rawValue: rawConfig.verticalId
5035
+ });
5036
+ }
5037
+ if (config.verticalId === null && config.selectedPresetIds.length > 0) {
5038
+ issues = appendUniqueIssue(issues, { code: "missing_vertical" });
5039
+ }
5040
+ if (rawPresetValue !== undefined && !Array.isArray(rawPresetValue) || rawPresetIds.some((presetId) => parseVerticalPresetId(presetId) === null)) {
5041
+ issues = appendUniqueIssue(issues, {
5042
+ code: "unknown_preset",
5043
+ rawValue: rawPresetValue
5044
+ });
5045
+ }
5046
+ if (rawConfig.verticalId != null && config.selectedPresetIds.length === 0) {
5047
+ issues = appendUniqueIssue(issues, { code: "empty_selected_presets" });
5048
+ }
5049
+ return issues;
5050
+ }
5051
+ function collectPresetConfigIssues(config) {
5052
+ const seenPresetIds = new Set();
5053
+ const seenBehaviours = new Set();
5054
+ let issues = [];
5055
+ for (const presetId of config.selectedPresetIds) {
5056
+ const presetDefinition = getVerticalPresetDefinition(presetId);
5057
+ if (seenPresetIds.has(presetId)) {
5058
+ issues = appendUniqueIssue(issues, { code: "duplicate_preset_id" });
5059
+ }
5060
+ seenPresetIds.add(presetId);
5061
+ if (config.verticalId !== null && presetDefinition.verticalId !== config.verticalId) {
5062
+ issues = appendUniqueIssue(issues, { code: "preset_vertical_mismatch" });
5063
+ }
5064
+ if (presetDefinition.availability === "future") {
5065
+ issues = appendUniqueIssue(issues, { code: "future_preset_selected" });
5066
+ }
5067
+ if (seenBehaviours.has(presetDefinition.canonicalBehaviour)) {
5068
+ issues = appendUniqueIssue(issues, { code: "duplicate_canonical_behaviour" });
5069
+ }
5070
+ seenBehaviours.add(presetDefinition.canonicalBehaviour);
5071
+ }
5072
+ return issues;
5073
+ }
5074
+ function getSiteVerticalConfigIssues(rawConfig, config) {
5075
+ let issues = collectRawConfigIssues(rawConfig, config);
5076
+ for (const issue of collectPresetConfigIssues(config)) {
5077
+ issues = appendUniqueIssue(issues, issue);
5078
+ }
5079
+ return issues;
5080
+ }
5081
+ function resolveSiteVerticalBookingConfig(rawConfig) {
5082
+ if (rawConfig == null) {
5083
+ return {
5084
+ kind: "unconfigured",
5085
+ config: DEFAULT_SITE_VERTICAL_BOOKING_CONFIG
5086
+ };
5087
+ }
5088
+ const verticalId = parseVerticalId(rawConfig.verticalId);
5089
+ const rawPresetIds = Array.isArray(rawConfig.selectedPresetIds) ? rawConfig.selectedPresetIds : [];
5090
+ const selectedPresetIds = rawPresetIds.map(parseVerticalPresetId).filter((presetId) => Boolean(presetId));
5091
+ const config = {
5092
+ verticalId,
5093
+ selectedPresetIds
5094
+ };
5095
+ if (rawConfig.verticalId == null && selectedPresetIds.length === 0) {
5096
+ return {
5097
+ kind: "unconfigured",
5098
+ config: DEFAULT_SITE_VERTICAL_BOOKING_CONFIG
5099
+ };
5100
+ }
5101
+ const issues = getSiteVerticalConfigIssues(rawConfig, config);
5102
+ if (issues.length > 0) return {
5103
+ kind: "invalid",
5104
+ config,
5105
+ issues
5106
+ };
5107
+ const nonEmptyPresetIds = toNonEmptyVerticalPresetIds(selectedPresetIds);
5108
+ const configuredConfig = verticalId !== null && nonEmptyPresetIds !== null ? createConfiguredSiteVerticalBookingConfig(verticalId, nonEmptyPresetIds) : null;
5109
+ if (configuredConfig === null) {
5110
+ return {
5111
+ kind: "invalid",
5112
+ config,
5113
+ issues: [{ code: "empty_selected_presets" }]
5114
+ };
5115
+ }
5116
+ return {
5117
+ kind: "configured",
5118
+ config: configuredConfig,
5119
+ selectedPresets: configuredConfig.selectedPresetIds.map(getVerticalPresetDefinition)
5120
+ };
5121
+ }
5122
+
5123
+ //#endregion
5124
+ //#region ../core/src/booking-verticals.ts
5125
+ const CANONICAL_BOOKING_BEHAVIOURS = [
5126
+ "class",
5127
+ "workshop",
5128
+ "course",
5129
+ "retreat",
5130
+ "performance",
5131
+ "appointment"
5132
+ ];
5133
+ const BOOKING_ENGINES = ["event_series", "appointment_service"];
5134
+ const VERTICAL_PRESET_AVAILABILITIES = [
5135
+ "onboarding",
5136
+ "settings",
5137
+ "future"
5138
+ ];
5139
+ function getVerticalPresetsForVertical(verticalId, options) {
5140
+ const availability = options?.availability;
5141
+ return VERTICAL_BOOKING_PRESETS.filter((presetDefinition) => {
5142
+ if (presetDefinition.verticalId !== verticalId) return false;
5143
+ if (!availability) return true;
5144
+ if (availability === "selectable") return presetDefinition.availability !== "future";
5145
+ return presetDefinition.availability === availability;
5146
+ });
5147
+ }
5148
+ function getOnboardingPresetsForVertical(verticalId) {
5149
+ return getVerticalPresetsForVertical(verticalId, { availability: "onboarding" });
5150
+ }
5151
+ function isEventSeriesCanonicalBehaviour(behaviour) {
5152
+ return EVENT_SERIES_BEHAVIOURS.includes(behaviour);
5153
+ }
5154
+ function isEventSeriesVerticalPresetDefinition(presetDefinition) {
5155
+ return isEventSeriesCanonicalBehaviour(presetDefinition.canonicalBehaviour);
5156
+ }
5157
+ function validateEventSeriesVerticalPreset(input) {
5158
+ const presetId = parseVerticalPresetId(input.verticalPresetId);
5159
+ if (!presetId) {
5160
+ return {
5161
+ ok: false,
5162
+ error: "unknown_vertical_preset"
5163
+ };
5164
+ }
5165
+ const presetDefinition = getVerticalPresetDefinition(presetId);
5166
+ if (!isEventSeriesVerticalPresetDefinition(presetDefinition)) {
5167
+ return {
5168
+ ok: false,
5169
+ error: "non_event_series_preset"
5170
+ };
5171
+ }
5172
+ if (eventPresetForVerticalPreset(presetDefinition) !== input.canonicalPreset) {
5173
+ return {
5174
+ ok: false,
5175
+ error: "canonical_behaviour_mismatch"
5176
+ };
5177
+ }
5178
+ return {
5179
+ ok: true,
5180
+ preset: presetDefinition
5181
+ };
5182
+ }
5183
+ function getSelectedCanonicalBehaviours(presetIds) {
5184
+ return presetIds.map((presetId) => getVerticalPresetDefinition(presetId).canonicalBehaviour);
5185
+ }
5186
+ function getSelectedPresetForBehaviour(input) {
5187
+ return input.presetIds.map(getVerticalPresetDefinition).find((presetDefinition) => presetDefinition.canonicalBehaviour === input.canonicalBehaviour) ?? null;
5188
+ }
5189
+ function getVerticalPresetSelectionOptions(config) {
5190
+ const resolved = resolveSiteVerticalBookingConfig(config);
5191
+ if (resolved.kind !== "configured") return [];
5192
+ const selectedIds = new Set(resolved.config.selectedPresetIds);
5193
+ const selectedBehaviours = new Set(resolved.selectedPresets.map((presetDefinition) => presetDefinition.canonicalBehaviour));
5194
+ return getVerticalPresetsForVertical(resolved.config.verticalId, { availability: "selectable" }).flatMap((presetDefinition) => {
5195
+ const checked = selectedIds.has(presetDefinition.id);
5196
+ if (!checked && selectedBehaviours.has(presetDefinition.canonicalBehaviour)) return [];
5197
+ return [{
5198
+ preset: presetDefinition,
5199
+ checked,
5200
+ disabledReason: checked && selectedIds.size === 1 ? "last_selected_preset" : null
5201
+ }];
5202
+ });
5203
+ }
5204
+ function setVerticalPresetSelected(config, presetId, selected) {
5205
+ const resolved = resolveSiteVerticalBookingConfig(config);
5206
+ const presetDefinition = getVerticalPresetDefinition(presetId);
5207
+ const verticalId = resolved.config.verticalId;
5208
+ if (!verticalId) {
5209
+ return {
5210
+ ok: false,
5211
+ error: "unconfigured",
5212
+ config: DEFAULT_SITE_VERTICAL_BOOKING_CONFIG
5213
+ };
5214
+ }
5215
+ const fallbackConfig = resolved.kind === "configured" ? resolved.config : DEFAULT_SITE_VERTICAL_BOOKING_CONFIG;
5216
+ if (presetDefinition.verticalId !== verticalId) {
5217
+ return {
5218
+ ok: false,
5219
+ error: "cross_vertical_preset",
5220
+ config: fallbackConfig
5221
+ };
5222
+ }
5223
+ if (presetDefinition.availability === "future") {
5224
+ return {
5225
+ ok: false,
5226
+ error: "future_preset",
5227
+ config: fallbackConfig
5228
+ };
5229
+ }
5230
+ if (resolved.kind !== "configured") {
5231
+ return {
5232
+ ok: false,
5233
+ error: "unconfigured",
5234
+ config: DEFAULT_SITE_VERTICAL_BOOKING_CONFIG
5235
+ };
5236
+ }
5237
+ const selectedIds = new Set(resolved.config.selectedPresetIds);
5238
+ if (!selected) {
5239
+ if (selectedIds.size <= 1) {
5240
+ return {
5241
+ ok: false,
5242
+ error: "last_selected_preset",
5243
+ config: resolved.config
5244
+ };
5245
+ }
5246
+ selectedIds.delete(presetId);
5247
+ const nextConfig = createSiteVerticalBookingConfig(verticalId, orderPresetIdsForVertical(verticalId, selectedIds));
5248
+ return {
5249
+ ok: true,
5250
+ config: nextConfig ?? DEFAULT_SITE_VERTICAL_BOOKING_CONFIG
5251
+ };
5252
+ }
5253
+ for (const existingPresetId of selectedIds) {
5254
+ const existingPreset = getVerticalPresetDefinition(existingPresetId);
5255
+ if (existingPreset.canonicalBehaviour === presetDefinition.canonicalBehaviour) {
5256
+ selectedIds.delete(existingPresetId);
5257
+ }
5258
+ }
5259
+ selectedIds.add(presetId);
5260
+ return {
5261
+ ok: true,
5262
+ config: createSiteVerticalBookingConfig(verticalId, orderPresetIdsForVertical(verticalId, selectedIds)) ?? resolved.config
5263
+ };
5264
+ }
5265
+ function setVerticalPresetsSelected(config, presetIds) {
5266
+ const resolved = resolveSiteVerticalBookingConfig(config);
5267
+ const verticalId = resolved.config.verticalId;
5268
+ if (!verticalId) {
5269
+ return {
5270
+ ok: false,
5271
+ error: "unconfigured",
5272
+ config: DEFAULT_SITE_VERTICAL_BOOKING_CONFIG
5273
+ };
5274
+ }
5275
+ const fallbackConfig = resolved.kind === "configured" ? resolved.config : DEFAULT_SITE_VERTICAL_BOOKING_CONFIG;
5276
+ if (presetIds.length === 0) {
5277
+ return {
5278
+ ok: false,
5279
+ error: "last_selected_preset",
5280
+ config: fallbackConfig
5281
+ };
5282
+ }
5283
+ const presetByBehaviour = new Map();
5284
+ for (const presetId of presetIds) {
5285
+ const presetDefinition = getVerticalPresetDefinition(presetId);
5286
+ if (presetDefinition.verticalId !== verticalId) {
5287
+ return {
5288
+ ok: false,
5289
+ error: "cross_vertical_preset",
5290
+ config: fallbackConfig
5291
+ };
5292
+ }
5293
+ if (presetDefinition.availability === "future") {
5294
+ return {
5295
+ ok: false,
5296
+ error: "future_preset",
5297
+ config: fallbackConfig
5298
+ };
5299
+ }
5300
+ presetByBehaviour.set(presetDefinition.canonicalBehaviour, presetId);
5301
+ }
5302
+ if (resolved.kind !== "configured") {
5303
+ return {
5304
+ ok: false,
5305
+ error: "unconfigured",
5306
+ config: DEFAULT_SITE_VERTICAL_BOOKING_CONFIG
5307
+ };
5308
+ }
5309
+ const nextConfig = createSiteVerticalBookingConfig(verticalId, orderPresetIdsForVertical(verticalId, new Set(presetByBehaviour.values())));
5310
+ return {
5311
+ ok: true,
5312
+ config: nextConfig ?? resolved.config
5313
+ };
5314
+ }
5315
+ /**
5316
+ * Return a configured selection in the catalog's canonical order.
5317
+ *
5318
+ * This deliberately delegates ordering and selection semantics to the core
5319
+ * authority instead of making dashboard planners maintain a second catalog
5320
+ * ordering implementation. Runtime-invalid values are reported as a closed
5321
+ * result so this pure helper never throws while planning.
5322
+ */
5323
+ function canonicalizeConfiguredBookingVerticalConfig(config) {
5324
+ const resolved = resolveSiteVerticalBookingConfig(config);
5325
+ if (resolved.kind === "invalid") {
5326
+ return {
5327
+ ok: false,
5328
+ issues: resolved.issues
5329
+ };
5330
+ }
5331
+ if (resolved.kind === "unconfigured") {
5332
+ return {
5333
+ ok: false,
5334
+ issues: [{ code: "missing_vertical" }]
5335
+ };
5336
+ }
5337
+ const selection = setVerticalPresetsSelected(resolved.config, resolved.config.selectedPresetIds);
5338
+ if (!selection.ok) {
5339
+ const issue = selection.error === "cross_vertical_preset" ? { code: "preset_vertical_mismatch" } : selection.error === "future_preset" ? { code: "future_preset_selected" } : selection.error === "last_selected_preset" ? { code: "empty_selected_presets" } : { code: "missing_vertical" };
5340
+ return {
5341
+ ok: false,
5342
+ issues: [issue]
5343
+ };
5344
+ }
5345
+ const canonical = resolveSiteVerticalBookingConfig(selection.config);
5346
+ return canonical.kind === "configured" ? {
5347
+ ok: true,
5348
+ config: canonical.config
5349
+ } : canonical.kind === "invalid" ? {
5350
+ ok: false,
5351
+ issues: canonical.issues
5352
+ } : {
5353
+ ok: false,
5354
+ issues: [{ code: "missing_vertical" }]
5355
+ };
5356
+ }
5357
+ /** Compare configured booking selections by catalog order, not authored array order. */
5358
+ function areConfiguredBookingVerticalConfigsEqual(left, right) {
5359
+ const canonicalLeft = canonicalizeConfiguredBookingVerticalConfig(left);
5360
+ const canonicalRight = canonicalizeConfiguredBookingVerticalConfig(right);
5361
+ if (!canonicalLeft.ok || !canonicalRight.ok) return false;
5362
+ return canonicalLeft.config.verticalId === canonicalRight.config.verticalId && canonicalLeft.config.selectedPresetIds.length === canonicalRight.config.selectedPresetIds.length && canonicalLeft.config.selectedPresetIds.every((presetId, index) => presetId === canonicalRight.config.selectedPresetIds[index]);
5363
+ }
5364
+ function orderPresetIdsForVertical(verticalId, presetIds) {
5365
+ return getVerticalPresetsForVertical(verticalId, { availability: "selectable" }).map((presetDefinition) => presetDefinition.id).filter((id) => presetIds.has(id));
5366
+ }
5367
+
5368
+ //#endregion
5369
+ export { parseEventSeriesId as $, normalizeLocationAddressText as A, ok as At, parseUtcIsoDateTimeString as B, parseNewsletterSignupDestinationProvider as C, unsafeAsSiteScopedStoragePath as Ct, mapNonEmptyArray as D, unsafeAsUploadSessionId as Dt, fromArray as E, unsafeAsStoragePath as Et, formatLocalScheduleDate as F, parseEventPageSurfaceSubject as G, toScheduledBookingDateRange as H, formatLocalScheduleTime as I, publicEventPricingCurrency as J, formatBookingPriceDisplay as K, getBookingLocalDateKey as L, formatBookingDate as M, formatBookingDateParts as N, hasText as O, unsafeAsUserId as Ot, formatBookingTime as P, parseApiKeyId as Q, getLocalScheduleDate as R, parseNewsletterSignupAuthoringDestinationValue as S, unsafeAsSiteId as St, assertAllowedPublicUrl as T, unsafeAsStorageBucketName as Tt, toScheduledBookingDateTime as U, toBookingTimeZone as V, parseBookingTimeZone as W, formatCurrencyAmount as X, publicEventPricingType as Y, assertNever as Z, parseFooterCompositionV1 as _, unsafeAsPositiveByteCount as _t, parseVerticalPresetId as a, unsafeAsBookingRequirementId as at, parseMailchimpTagName as b, unsafeAsSafeDownloadFilename as bt, EVENT_PRESET_VALUES as c, unsafeAsDemoCapability as ct, resolvePlanningDateInput as d, unsafeAsEventOfferingId as dt, parseMediaAssetId as et, createSecret as f, unsafeAsEventSeriesId as ft, footerNavigationLayouts as g, unsafeAsOriginalFilename as gt, stableJsonStringify as h, unsafeAsOccurrenceId as ht, parseVerticalId as i, unsafeAsAppointmentResourceId as it, toLocationCoordinates as j, isPresent as k, err as kt, ORDINARY_EVENT_PRESET_VALUES as l, unsafeAsDetectedMimeType as lt, parseManagementKey as m, unsafeAsMediaAssetId as mt, canonicalizeConfiguredBookingVerticalConfig as n, parseSiteId as nt, resolveSiteVerticalBookingConfig as o, unsafeAsBookingSessionId as ot, exposeSecret as p, unsafeAsFileChecksumSha256 as pt, formatEventPricing as q, isEventSeriesVerticalPresetDefinition as r, parseUserId as rt, DEFAULT_EVENT_TYPE_PRESETS as s, unsafeAsDeclaredMimeType as st, areConfiguredBookingVerticalConfigsEqual as t, parsePageId as tt, SURFACE_EVENT_PRESET_VALUES as u, unsafeAsEntitlementId as ut, parseFooterModuleId as v, unsafeAsPositiveSeconds as vt, isCanonicalRichTextDoc as w, unsafeAsStaffMemberId as wt, parseNewsletterListId as x, unsafeAsSiteFontId as xt, parseMailchimpAudienceId as y, unsafeAsProductId as yt, getLocalScheduleTime as z };