riverbankcms 0.31.0 → 0.31.1

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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { $t as buttonStyleSelectionSchema, At as resolveMediaIdentifier, Bt as MAX_MANAGEMENT_MEDIA_UPLOAD_BYTES, C as entryIdentifierForCommand, Cn as ICON_PICKER_PRESETS, Ct as PUBLIC_FILE_FIELD_KINDS, Dn as asFooterLookId, Dt as buildMediaIdentifierFromFilename, En as SUPPORTED_LOADER_ENDPOINTS, Er as createContentEntryRef, Ft as getMimeType, Ir as slugPart, K as themeSchema, Kn as asAppearancePresetId, Ln as SYSTEM_BLOCK_KINDS, Lt as normalizeAmbiguousStoragePathForSite, Mn as headerLayoutIdValues, N as footerPreferencesSchema, Nn as headerStyleIdValues, Nr as createSiteCommandSiteRef, On as asHeaderLayoutId, P as headerPreferencesSchema, Pt as getExtensionForMimeType, Tr as createCommandRef, Tt as mediaTypeDiscriminants, V as footerModeSchema, Xn as asDesignBlockId, Zn as asDesignBoundaryId, _ as evaluateSiteCommandBatchExposure, br as require_dist, f as stableStringify, jn as footerLookIdValues, jt as slugifyMediaIdentifier, k as eventBookingOfferIntentSchema, kn as asHeaderStyleId, l as resolvePageUpsertSeo, lr as RESOLVED_INTERNAL_LINK_ENTITY_TYPES, m as parseAndPlanCommandBatchForTypes, n as sdkCourseBookingSettingsSchema, nr as asSiteStyleId, p as createDryRunReport, pt as getDirectImageUrlForSiteScopedPath, r as sdkEventOccurrenceInputSchema, rr as makeBoundaryId, s as eventVisibilitySchema, tr as asPageFlowPresetId, ut as parseAspectRatioValue, v as evaluateSiteCommandExposure, wt as isDisplayMediaKind, xr as bookingQuestionAttachmentSchema, y as getSiteCommandMetadata, zt as FILE_SIZE_LIMITS } from "./sdk-event-upsert-BC_MyWOx.mjs";
3
- import { $n as parseSiteId, An as unsafeAsPassId, At as resolveBookingTimeZoneId, Bt as addIntervalPreservingMonthAnchor, D as parseManagementKey, Dt as parseBookingLocalDate, E as exposeSecret, En as parseCustomerId, Gt as omitZeroAmountFutureRows, Ht as getBookingInstalmentDepositRefundability, It as validateBookingPaymentOptionKinds, J as assertAllowedPublicUrl, Jn as unsafeAsCheckoutLineId, Jt as scheduleBookingReasonCodes, Kt as splitAmountWithRemainderInFirst, Lt as isLiveOrderInstalmentPlanStatus, Mn as parseDatedOfferingCapacityHoldId, On as parseMembershipId, Qn as parseApiKeyId, R as parseMailingListProviderScope, Rt as isSettleableFlexibleBalanceContractStatus, T as createSecret, Tn as unsafeAsStaffMemberId, Vt as clampConfiguredAmount, Wt as getBookingInstalmentProtectedDepositAmountCents, Xn as parsePageId, Xt as resolveFlexibleBalanceInitialPaymentCents, Yn as parseEditorSessionGeneration, Yt as resolveFlexibleBalanceDueAt, _n as unsafeAsPositiveCents, a as resolveEventCatalogue, ar as unsafeAsEventInstanceId, bn as assertNever, c as areConfiguredBookingVerticalConfigsEqual, cn as fromArray, cr as unsafeAsOccurrenceId, d as parseVerticalPresetId, dn as isNonNegativeWholeCents$1, dr as ok, er as parseUserId, et as locationValueSchema, f as resolveSiteVerticalBookingConfig, fn as parseNonNegativeCents, g as SURFACE_EVENT_PRESET_VALUES, gn as unsafeAsNonNegativeCents, hn as toNonNegativeCents, ir as parseRetiredCourseId, it as publicLocationSchema, jn as parseDatedOfferingCapacityHoldAuditRef, l as canonicalizeConfiguredBookingVerticalConfig, lr as unsafeAsPricingOptionId, m as EVENT_PRESET_VALUES, mn as toCents, n as committedWriteProofSchema, or as unsafeAsEventOfferingId, p as DEFAULT_EVENT_TYPE_PRESETS, pn as parsePositiveCents, qt as businessCancellationRefusalCodes, rr as parseEventSeriesId, sr as unsafeAsEventSeriesId, st as trimmedStringOrNull, t as OFFLINE_PAYMENT_METHODS, u as parseVerticalId, ur as err, ut as formatDate, v as getPublicReadCachePolicy, wn as unsafeAsAppointmentResourceId, y as publicReadFreshnessSeconds, yn as parseCurrencyCode, z as parseFooterCompositionV1, zt as isSettleableOrderInstalmentPlanStatus } from "./src-CevC_tvx.mjs";
4
- import { n as CliSdkPeerError, t as loadConfigFile } from "./load-config-D32BDh2g.mjs";
2
+ import { $t as buttonStyleSelectionSchema, At as resolveMediaIdentifier, Bt as MAX_MANAGEMENT_MEDIA_UPLOAD_BYTES, C as entryIdentifierForCommand, Cn as ICON_PICKER_PRESETS, Ct as PUBLIC_FILE_FIELD_KINDS, Dn as asFooterLookId, Dt as buildMediaIdentifierFromFilename, En as SUPPORTED_LOADER_ENDPOINTS, Er as createContentEntryRef, Ft as getMimeType, Ir as slugPart, K as themeSchema, Kn as asAppearancePresetId, Ln as SYSTEM_BLOCK_KINDS, Lt as normalizeAmbiguousStoragePathForSite, Mn as headerLayoutIdValues, N as footerPreferencesSchema, Nn as headerStyleIdValues, Nr as createSiteCommandSiteRef, On as asHeaderLayoutId, P as headerPreferencesSchema, Pt as getExtensionForMimeType, Tr as createCommandRef, Tt as mediaTypeDiscriminants, V as footerModeSchema, Xn as asDesignBlockId, Zn as asDesignBoundaryId, _ as evaluateSiteCommandBatchExposure, br as require_dist, f as stableStringify, jn as footerLookIdValues, jt as slugifyMediaIdentifier, k as eventBookingOfferIntentSchema, kn as asHeaderStyleId, l as resolvePageUpsertSeo, lr as RESOLVED_INTERNAL_LINK_ENTITY_TYPES, m as parseAndPlanCommandBatchForTypes, n as sdkCourseBookingSettingsSchema, nr as asSiteStyleId, p as createDryRunReport, pt as getDirectImageUrlForSiteScopedPath, r as sdkEventOccurrenceInputSchema, rr as makeBoundaryId, s as eventVisibilitySchema, tr as asPageFlowPresetId, ut as parseAspectRatioValue, v as evaluateSiteCommandExposure, wt as isDisplayMediaKind, xr as bookingQuestionAttachmentSchema, y as getSiteCommandMetadata, zt as FILE_SIZE_LIMITS } from "./sdk-event-upsert-0U4hsDpo.mjs";
3
+ import { $t as businessCancellationRefusalCodes, An as unsafeAsAppointmentResourceId, C as isPublicReadEndpoint, Cn as unsafeAsPositiveCents, En as assertNever, G as parseFooterCompositionV1, Gt as isSettleableOrderInstalmentPlanStatus, Ht as validateBookingPaymentOptionKinds, In as unsafeAsPassId, It as resolveBookingTimeZoneId, Jt as getBookingInstalmentDepositRefundability, Kt as addIntervalPreservingMonthAnchor, Ln as parseDatedOfferingCapacityHoldAuditRef, M as exposeSecret, Mn as parseCustomerId, N as parseManagementKey, Nt as parseBookingLocalDate, Pn as parseMembershipId, Qt as splitAmountWithRemainderInFirst, Rn as parseDatedOfferingCapacityHoldId, S as getPublicReadCachePolicy, Sn as unsafeAsNonNegativeCents, Tn as parseCurrencyCode, Ut as isLiveOrderInstalmentPlanStatus, W as parseMailingListProviderScope, Wt as isSettleableFlexibleBalanceContractStatus, Xt as getBookingInstalmentProtectedDepositAmountCents, Zt as omitZeroAmountFutureRows, _n as isNonNegativeWholeCents$1, _r as err, ar as parseSiteId, b as PUBLIC_AVAILABILITY_FRESHNESS_SECONDS, bn as toCents, d as canonicalizeConfiguredBookingVerticalConfig, en as scheduleBookingReasonCodes, er as unsafeAsCheckoutLineId, et as assertAllowedPublicUrl, f as parseVerticalId, fr as unsafeAsEventInstanceId, g as EVENT_PRESET_VALUES, gr as unsafeAsPricingOptionId, gt as formatDate, h as DEFAULT_EVENT_TYPE_PRESETS, hr as unsafeAsOccurrenceId, ir as parseApiKeyId, j as createSecret, jn as unsafeAsStaffMemberId, lr as parseEventSeriesId, m as resolveSiteVerticalBookingConfig, mn as fromArray, mr as unsafeAsEventSeriesId, n as committedWriteProofSchema, nn as resolveFlexibleBalanceInitialPaymentCents, nr as parsePageId, or as parseUserId, ot as locationValueSchema, p as parseVerticalPresetId, pr as unsafeAsEventOfferingId, pt as trimmedStringOrNull, qt as clampConfiguredAmount, s as resolveEventCatalogue, t as OFFLINE_PAYMENT_METHODS, tn as resolveFlexibleBalanceDueAt, tr as parseEditorSessionGeneration, u as areConfiguredBookingVerticalConfigsEqual, ur as parseRetiredCourseId, ut as publicLocationSchema, v as SURFACE_EVENT_PRESET_VALUES, vn as parseNonNegativeCents, vr as ok, w as publicReadFreshnessSeconds, x as PUBLIC_CONTENT_FRESHNESS_SECONDS, xn as toNonNegativeCents, yn as parsePositiveCents } from "./src-exrglXYU.mjs";
4
+ import { n as CliSdkPeerError, t as loadConfigFile } from "./load-config-DIyqYeRP.mjs";
5
5
  import { Command } from "commander";
6
6
  import { safeParse, z } from "zod";
7
7
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -814,6 +814,12 @@ const PREVIEW_BLOCKED_REASONS = [
814
814
  "policy_disallows",
815
815
  "no_refundable_payment_link",
816
816
  "nothing_remaining_to_refund",
817
+ "nothing_owed",
818
+ "no_card_payments",
819
+ "no_email",
820
+ "payment_link_unavailable",
821
+ "waive_needs_whole_order",
822
+ "payment_amount_too_high",
817
823
  "invalid_refund_amount",
818
824
  "invalid_refund_context",
819
825
  "site_credit_unavailable",
@@ -952,6 +958,64 @@ function pageCommitReasonFromTag(tag) {
952
958
  return result.success ? result.data : null;
953
959
  }
954
960
 
961
+ //#endregion
962
+ //#region ../api/src/defineEndpointDefinitions.ts
963
+ /**
964
+ * Validates extracted endpoint descriptors while preserving each literal path,
965
+ * method, and parameter contract for the typed URL builders.
966
+ */
967
+ function defineEndpointDefinitions(definitions) {
968
+ return definitions;
969
+ }
970
+
971
+ //#endregion
972
+ //#region ../api/src/apiEndpointTypes.ts
973
+ function allowedDemoMutationPolicy() {
974
+ return {
975
+ classification: "allowed",
976
+ publicMessage: ""
977
+ };
978
+ }
979
+ function blockedDemoMutationPolicy(classification, publicMessage) {
980
+ if (publicMessage.trim() === "") {
981
+ throw new Error(`Demo mutation policy ${classification} requires publicMessage.`);
982
+ }
983
+ return {
984
+ classification,
985
+ publicMessage
986
+ };
987
+ }
988
+
989
+ //#endregion
990
+ //#region ../api/src/pageSectionLooks.ts
991
+ const PAGE_SECTION_LOOK_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
992
+ setPageSectionLook: {
993
+ path: "/sites/{siteId}/page-sections/look",
994
+ method: "POST",
995
+ auth: "user",
996
+ responseKind: "json",
997
+ demoMutation: allowedDemoMutationPolicy(),
998
+ errors: [
999
+ "validation:invalid_input",
1000
+ "resource:not_found",
1001
+ "resource:conflict",
1002
+ "server:internal_error"
1003
+ ]
1004
+ },
1005
+ getPageSectionOnPage: {
1006
+ path: "/sites/{siteId}/page-sections/{sectionId}/pages/{pageSurfaceId}",
1007
+ method: "GET",
1008
+ auth: "user",
1009
+ responseKind: "json",
1010
+ errors: [
1011
+ "validation:invalid_input",
1012
+ "auth:forbidden",
1013
+ "resource:not_found",
1014
+ "server:internal_error"
1015
+ ]
1016
+ }
1017
+ });
1018
+
955
1019
  //#endregion
956
1020
  //#region ../api/src/pageJournalEndpoints.ts
957
1021
  const PAGE_JOURNAL_ENDPOINT_DEFINITIONS = {
@@ -1039,24 +1103,6 @@ const PAGE_JOURNAL_ENDPOINT_DEFINITIONS = {
1039
1103
  }
1040
1104
  };
1041
1105
 
1042
- //#endregion
1043
- //#region ../api/src/apiEndpointTypes.ts
1044
- function allowedDemoMutationPolicy() {
1045
- return {
1046
- classification: "allowed",
1047
- publicMessage: ""
1048
- };
1049
- }
1050
- function blockedDemoMutationPolicy(classification, publicMessage) {
1051
- if (publicMessage.trim() === "") {
1052
- throw new Error(`Demo mutation policy ${classification} requires publicMessage.`);
1053
- }
1054
- return {
1055
- classification,
1056
- publicMessage
1057
- };
1058
- }
1059
-
1060
1106
  //#endregion
1061
1107
  //#region ../api/src/demoMutationPolicies.ts
1062
1108
  const DEMO_MUTATION_BLOCKED_HIDDEN = blockedDemoMutationPolicy("blocked-hidden", "This action is not available in demo sites.");
@@ -1064,16 +1110,6 @@ const DEMO_MUTATION_BLOCKED_DISABLED = blockedDemoMutationPolicy("blocked-disabl
1064
1110
  const DEMO_MUTATION_INTERNAL_ONLY = blockedDemoMutationPolicy("internal-only", "This internal operation is not available in demo sites.");
1065
1111
  const DEMO_MUTATION_ALLOWED = allowedDemoMutationPolicy();
1066
1112
 
1067
- //#endregion
1068
- //#region ../api/src/defineEndpointDefinitions.ts
1069
- /**
1070
- * Validates extracted endpoint descriptors while preserving each literal path,
1071
- * method, and parameter contract for the typed URL builders.
1072
- */
1073
- function defineEndpointDefinitions(definitions) {
1074
- return definitions;
1075
- }
1076
-
1077
1113
  //#endregion
1078
1114
  //#region ../api/src/bookingAttentionEndpointDefinitions.ts
1079
1115
  const BOOKING_ATTENTION_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
@@ -1538,18 +1574,22 @@ function normalizeSiteCacheId(id) {
1538
1574
  const parsed = parseSiteId(id);
1539
1575
  return parsed.ok ? parsed.value : id;
1540
1576
  }
1541
- /** Memory caches follow the same public-read policy as HTTP and batch readers. */
1542
- function buildPublicReadMemoryCacheTags(endpoint, params) {
1543
- const policy = getPublicReadCachePolicy(endpoint);
1544
- if (policy.kind === "live") return [];
1545
- const templates = {
1546
- published_content: TAG_TEMPLATES.siteRoutableContent,
1547
- public_team_members: TAG_TEMPLATES.publicTeamMembers,
1548
- public_products: TAG_TEMPLATES.publicShop,
1549
- site_forms: TAG_TEMPLATES.siteForms
1550
- };
1577
+ const PUBLIC_READ_TAG_TEMPLATES = {
1578
+ published_content: TAG_TEMPLATES.siteRoutableContent,
1579
+ public_team_members: TAG_TEMPLATES.publicTeamMembers,
1580
+ public_products: TAG_TEMPLATES.publicProducts,
1581
+ public_events: TAG_TEMPLATES.publicEvents,
1582
+ public_event_filters: TAG_TEMPLATES.publicEventFilters,
1583
+ public_passes: TAG_TEMPLATES.publicPasses,
1584
+ public_memberships: TAG_TEMPLATES.publicMemberships,
1585
+ public_booking_services: TAG_TEMPLATES.publicBookingServices,
1586
+ public_booking_availability: TAG_TEMPLATES.publicBookingAvailability,
1587
+ site_forms: TAG_TEMPLATES.siteForms
1588
+ };
1589
+ /** Fetch dependencies apply even to reads forbidden from memory/fallback reuse. */
1590
+ function buildPublicReadFetchTags(endpoint, params) {
1551
1591
  return buildCacheReadTags([
1552
- ...policy.tags.map((kind) => templates[kind]),
1592
+ ...getPublicReadCachePolicy(endpoint).fetchTags.map((kind) => PUBLIC_READ_TAG_TEMPLATES[kind]),
1553
1593
  ...endpoint === "checkRedirect" ? [
1554
1594
  TAG_TEMPLATES.siteRedirects,
1555
1595
  TAG_TEMPLATES.siteBySlug,
@@ -1558,6 +1598,20 @@ function buildPublicReadMemoryCacheTags(endpoint, params) {
1558
1598
  ...endpoint === "getPublicFormById" ? [TAG_TEMPLATES.formById] : []
1559
1599
  ], params);
1560
1600
  }
1601
+ /** Memory/fallback eligibility remains independent of fetch dependencies. */
1602
+ function buildPublicReadMemoryCacheTags(endpoint, params) {
1603
+ return getPublicReadCachePolicy(endpoint).kind === "live" ? [] : buildPublicReadFetchTags(endpoint, params);
1604
+ }
1605
+ /** A transport batch inherits every dependency and its shortest freshness budget. */
1606
+ function buildPublicReadFetchPolicy(siteId, reads) {
1607
+ return {
1608
+ tags: normalizeRevalidateTags(reads.flatMap(({ endpoint, params }) => isPublicReadEndpoint(endpoint) ? buildPublicReadFetchTags(endpoint, {
1609
+ ...params,
1610
+ siteId
1611
+ }) : buildCacheReadTags([], { siteId }))),
1612
+ revalidate: Math.min(PUBLIC_CONTENT_FRESHNESS_SECONDS, ...reads.map(({ endpoint }) => isPublicReadEndpoint(endpoint) ? publicReadFreshnessSeconds(endpoint) : PUBLIC_AVAILABILITY_FRESHNESS_SECONDS))
1613
+ };
1614
+ }
1561
1615
 
1562
1616
  //#endregion
1563
1617
  //#region ../api/src/sdkEntryReadEndpoints.ts
@@ -1629,6 +1683,362 @@ const GUARDED_CONTENT_REPLAY_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
1629
1683
  }
1630
1684
  });
1631
1685
 
1686
+ //#endregion
1687
+ //#region ../api/src/clientArrangementEndpoints.ts
1688
+ const localDate = z.iso.date();
1689
+ const weekday = z.union([
1690
+ z.literal(0),
1691
+ z.literal(1),
1692
+ z.literal(2),
1693
+ z.literal(3),
1694
+ z.literal(4),
1695
+ z.literal(5),
1696
+ z.literal(6)
1697
+ ]);
1698
+ const arrangementCadenceSchema = z.discriminatedUnion("kind", [z.object({
1699
+ kind: z.literal("weekly"),
1700
+ everyWeeks: z.union([z.literal(1), z.literal(2)]),
1701
+ weekday
1702
+ }).strict(), z.object({
1703
+ kind: z.literal("monthly"),
1704
+ weekday,
1705
+ nth: z.union([
1706
+ z.literal(1),
1707
+ z.literal(2),
1708
+ z.literal(3),
1709
+ z.literal(4),
1710
+ z.literal("last")
1711
+ ])
1712
+ }).strict()]);
1713
+ const arrangementEndSchema = z.discriminatedUnion("kind", [
1714
+ z.object({ kind: z.literal("open") }).strict(),
1715
+ z.object({
1716
+ kind: z.literal("on_date"),
1717
+ lastDate: localDate
1718
+ }).strict(),
1719
+ z.object({
1720
+ kind: z.literal("after_sessions"),
1721
+ sessions: z.number().int().min(1).max(1e4)
1722
+ }).strict()
1723
+ ]);
1724
+ const arrangementPaymentSchema = z.discriminatedUnion("kind", [
1725
+ z.object({
1726
+ kind: z.literal("package"),
1727
+ customerPassId: z.string().uuid()
1728
+ }).strict(),
1729
+ z.object({ kind: z.literal("owed") }).strict(),
1730
+ z.object({
1731
+ kind: z.literal("payment_link"),
1732
+ sendOffsetMinutes: z.number().int().min(1).max(525600)
1733
+ }).strict()
1734
+ ]);
1735
+ const arrangementScheduleSchema = z.object({
1736
+ effectiveFrom: localDate,
1737
+ cadence: arrangementCadenceSchema,
1738
+ localStart: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/)
1739
+ }).strict();
1740
+ const recordedReturn = { recordedReturn: z.literal("staff_confirmed").optional() };
1741
+ const operation = {
1742
+ operationId: z.string().uuid(),
1743
+ emailClient: z.boolean().default(true)
1744
+ };
1745
+ const createClientArrangementSchema = z.object({
1746
+ ...operation,
1747
+ customerId: z.string().uuid(),
1748
+ resourceId: z.string().uuid(),
1749
+ serviceId: z.string().uuid(),
1750
+ timezone: z.string().min(1),
1751
+ holdsTime: z.boolean(),
1752
+ end: arrangementEndSchema,
1753
+ payment: arrangementPaymentSchema,
1754
+ schedule: arrangementScheduleSchema,
1755
+ bookAhead: z.number().int().min(0).max(52),
1756
+ bookShortfallAsOwed: z.boolean().default(false)
1757
+ }).strict();
1758
+ /** The UI selects the next N dates from get.dates, then retains this body for retry. */
1759
+ const bookNextArrangementSchema = z.object({
1760
+ ...operation,
1761
+ occurrenceDates: z.array(localDate).min(1).max(52).refine((values) => new Set(values).size === values.length, "Choose each date once."),
1762
+ bookShortfallAsOwed: z.boolean().default(false)
1763
+ }).strict();
1764
+ const arrangementAwaySchema = z.object({
1765
+ ...operation,
1766
+ ...recordedReturn,
1767
+ from: localDate,
1768
+ backOn: localDate
1769
+ }).strict().refine((value) => value.backOn > value.from, "Choose a return date after the first day away.");
1770
+ const arrangementChangeFromSchema = z.object({
1771
+ ...operation,
1772
+ schedule: arrangementScheduleSchema
1773
+ }).strict();
1774
+ const arrangementOneWeekSchema = z.object({
1775
+ ...operation,
1776
+ occurrenceDate: localDate,
1777
+ startAt: z.iso.datetime({ offset: true }),
1778
+ endAt: z.iso.datetime({ offset: true }),
1779
+ bookShortfallAsOwed: z.boolean().default(false)
1780
+ }).strict().refine((value) => Date.parse(value.endAt) > Date.parse(value.startAt), "Choose an end after the start.");
1781
+ const arrangementEndRequestSchema = z.object({
1782
+ ...operation,
1783
+ ...recordedReturn,
1784
+ lastDate: localDate
1785
+ }).strict();
1786
+ const arrangementEditSchema = z.object({
1787
+ ...operation,
1788
+ serviceId: z.string().uuid(),
1789
+ holdsTime: z.boolean(),
1790
+ payment: arrangementPaymentSchema
1791
+ }).strict();
1792
+ const previewClientArrangementSchema = z.discriminatedUnion("kind", [
1793
+ z.object({
1794
+ kind: z.literal("create"),
1795
+ request: createClientArrangementSchema
1796
+ }).strict(),
1797
+ z.object({
1798
+ kind: z.literal("book_next"),
1799
+ arrangementId: z.string().uuid(),
1800
+ request: bookNextArrangementSchema
1801
+ }).strict(),
1802
+ z.object({
1803
+ kind: z.literal("away"),
1804
+ arrangementId: z.string().uuid(),
1805
+ request: arrangementAwaySchema
1806
+ }).strict(),
1807
+ z.object({
1808
+ kind: z.literal("change_from"),
1809
+ arrangementId: z.string().uuid(),
1810
+ request: arrangementChangeFromSchema
1811
+ }).strict(),
1812
+ z.object({
1813
+ kind: z.literal("one_week"),
1814
+ arrangementId: z.string().uuid(),
1815
+ request: arrangementOneWeekSchema
1816
+ }).strict(),
1817
+ z.object({
1818
+ kind: z.literal("end"),
1819
+ arrangementId: z.string().uuid(),
1820
+ request: arrangementEndRequestSchema
1821
+ }).strict()
1822
+ ]);
1823
+ const arrangementTimeOffChoiceSchema = z.discriminatedUnion("kind", [
1824
+ z.object({ kind: z.literal("later") }).strict(),
1825
+ z.object({
1826
+ kind: z.literal("cancel"),
1827
+ recordedReturn: z.enum(["staff_confirmed", "not_confirmed"])
1828
+ }).strict(),
1829
+ z.object({
1830
+ kind: z.literal("move"),
1831
+ startAt: z.iso.datetime({ offset: true }),
1832
+ endAt: z.iso.datetime({ offset: true })
1833
+ }).strict(),
1834
+ z.object({
1835
+ kind: z.literal("hand_over"),
1836
+ resourceId: z.string().uuid(),
1837
+ startAt: z.iso.datetime({ offset: true }),
1838
+ endAt: z.iso.datetime({ offset: true })
1839
+ }).strict()
1840
+ ]);
1841
+ const arrangementTimeOffSchema = z.object({
1842
+ ...operation,
1843
+ confirmation: z.string().optional(),
1844
+ resourceId: z.string().uuid(),
1845
+ startsAt: z.iso.datetime({ offset: true }),
1846
+ endsAt: z.iso.datetime({ offset: true }),
1847
+ reason: z.string().nullable(),
1848
+ selections: z.array(z.object({
1849
+ arrangementId: z.string().uuid(),
1850
+ appointmentId: z.string().uuid(),
1851
+ choice: arrangementTimeOffChoiceSchema
1852
+ }).strict()).max(200)
1853
+ }).strict().refine((value) => Date.parse(value.endsAt) > Date.parse(value.startsAt), "Choose an end after the start.").refine((value) => new Set(value.selections.map((row) => row.appointmentId)).size === value.selections.length, "Choose each session once.");
1854
+ /** A single local date, for the arrangement move/handover picker. */
1855
+ const arrangementAvailableSlotsSchema = z.object({
1856
+ appointmentId: z.string().uuid(),
1857
+ resourceId: z.string().uuid().optional(),
1858
+ date: localDate
1859
+ }).strict();
1860
+ /** Validate retained operation outcomes when they cross the JSON storage boundary. */
1861
+ const arrangementDateResultSchema = z.intersection(z.object({ occurrenceDate: localDate }), z.union([
1862
+ z.object({
1863
+ outcome: z.enum(["booked", "already_booked"]),
1864
+ appointmentId: z.string(),
1865
+ startAt: z.string(),
1866
+ endAt: z.string(),
1867
+ payment: z.discriminatedUnion("kind", [
1868
+ z.object({
1869
+ kind: z.literal("package"),
1870
+ customerPassId: z.string()
1871
+ }),
1872
+ z.object({ kind: z.literal("owed") }),
1873
+ z.object({
1874
+ kind: z.literal("payment_link"),
1875
+ scheduledSendAt: z.string()
1876
+ })
1877
+ ])
1878
+ }),
1879
+ z.object({
1880
+ outcome: z.literal("moved"),
1881
+ previousStartAt: z.string(),
1882
+ previousEndAt: z.string(),
1883
+ appointmentId: z.string(),
1884
+ startAt: z.string(),
1885
+ endAt: z.string(),
1886
+ trainer: z.object({
1887
+ resourceId: z.string(),
1888
+ name: z.string().nullable()
1889
+ }),
1890
+ payment: z.discriminatedUnion("kind", [
1891
+ z.object({
1892
+ kind: z.literal("package"),
1893
+ customerPassId: z.string()
1894
+ }),
1895
+ z.object({ kind: z.literal("owed") }),
1896
+ z.object({
1897
+ kind: z.literal("payment_link"),
1898
+ scheduledSendAt: z.string()
1899
+ })
1900
+ ])
1901
+ }),
1902
+ z.object({
1903
+ outcome: z.literal("cancelled"),
1904
+ appointmentId: z.string(),
1905
+ startAt: z.string(),
1906
+ endAt: z.string(),
1907
+ settlement: z.enum([
1908
+ "package_returned",
1909
+ "refunded",
1910
+ "refunded_in_person",
1911
+ "nothing_owed"
1912
+ ]),
1913
+ refundAmountCents: z.number().nullable(),
1914
+ refundCurrency: z.string().nullable(),
1915
+ refundDestinations: z.object({
1916
+ cardCents: z.number().nonnegative(),
1917
+ directCents: z.number().nonnegative(),
1918
+ creditCents: z.number().nonnegative()
1919
+ })
1920
+ }),
1921
+ z.intersection(z.object({
1922
+ outcome: z.literal("refused"),
1923
+ appointmentId: z.string().optional()
1924
+ }), z.discriminatedUnion("code", [
1925
+ z.object({ code: z.enum([
1926
+ "package_shortfall",
1927
+ "not_available",
1928
+ "needs_recorded_return",
1929
+ "client_not_found"
1930
+ ]) }),
1931
+ z.object({
1932
+ code: z.literal("clash"),
1933
+ customerFirstName: z.string().nullable()
1934
+ }),
1935
+ z.object({
1936
+ code: z.literal("command_failed"),
1937
+ detail: z.string().nullable()
1938
+ })
1939
+ ]))
1940
+ ]));
1941
+ const errors = [
1942
+ "validation:invalid_input",
1943
+ "auth:forbidden",
1944
+ "resource:not_found",
1945
+ "resource:conflict",
1946
+ "server:internal_error"
1947
+ ];
1948
+ const CLIENT_ARRANGEMENT_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
1949
+ getArrangementAvailableSlots: {
1950
+ path: "/sites/{siteId}/bookings/client-arrangements/{arrangementId}/available-slots",
1951
+ method: "POST",
1952
+ auth: "user",
1953
+ responseKind: "json",
1954
+ errors
1955
+ },
1956
+ previewArrangementTimeOff: {
1957
+ path: "/sites/{siteId}/bookings/client-arrangements/time-off/preview",
1958
+ method: "POST",
1959
+ auth: "user",
1960
+ responseKind: "json",
1961
+ errors
1962
+ },
1963
+ applyArrangementTimeOff: {
1964
+ path: "/sites/{siteId}/bookings/client-arrangements/time-off",
1965
+ method: "POST",
1966
+ auth: "user",
1967
+ responseKind: "json",
1968
+ errors
1969
+ },
1970
+ previewClientArrangement: {
1971
+ path: "/sites/{siteId}/bookings/client-arrangements/preview",
1972
+ method: "POST",
1973
+ auth: "user",
1974
+ responseKind: "json",
1975
+ errors
1976
+ },
1977
+ listClientArrangements: {
1978
+ path: "/sites/{siteId}/bookings/client-arrangements",
1979
+ method: "GET",
1980
+ auth: "user",
1981
+ responseKind: "json",
1982
+ errors
1983
+ },
1984
+ getClientArrangement: {
1985
+ path: "/sites/{siteId}/bookings/client-arrangements/{arrangementId}",
1986
+ method: "GET",
1987
+ auth: "user",
1988
+ responseKind: "json",
1989
+ errors
1990
+ },
1991
+ createClientArrangement: {
1992
+ path: "/sites/{siteId}/bookings/client-arrangements",
1993
+ method: "POST",
1994
+ auth: "user",
1995
+ responseKind: "json",
1996
+ errors
1997
+ },
1998
+ bookNextArrangement: {
1999
+ path: "/sites/{siteId}/bookings/client-arrangements/{arrangementId}/book-next",
2000
+ method: "POST",
2001
+ auth: "user",
2002
+ responseKind: "json",
2003
+ errors
2004
+ },
2005
+ markArrangementAway: {
2006
+ path: "/sites/{siteId}/bookings/client-arrangements/{arrangementId}/away",
2007
+ method: "POST",
2008
+ auth: "user",
2009
+ responseKind: "json",
2010
+ errors
2011
+ },
2012
+ changeArrangementFrom: {
2013
+ path: "/sites/{siteId}/bookings/client-arrangements/{arrangementId}/change-from",
2014
+ method: "POST",
2015
+ auth: "user",
2016
+ responseKind: "json",
2017
+ errors
2018
+ },
2019
+ changeArrangementOneWeek: {
2020
+ path: "/sites/{siteId}/bookings/client-arrangements/{arrangementId}/one-week",
2021
+ method: "POST",
2022
+ auth: "user",
2023
+ responseKind: "json",
2024
+ errors
2025
+ },
2026
+ endClientArrangement: {
2027
+ path: "/sites/{siteId}/bookings/client-arrangements/{arrangementId}/end",
2028
+ method: "POST",
2029
+ auth: "user",
2030
+ responseKind: "json",
2031
+ errors
2032
+ },
2033
+ editClientArrangement: {
2034
+ path: "/sites/{siteId}/bookings/client-arrangements/{arrangementId}",
2035
+ method: "PUT",
2036
+ auth: "user",
2037
+ responseKind: "json",
2038
+ errors
2039
+ }
2040
+ });
2041
+
1632
2042
  //#endregion
1633
2043
  //#region ../api/src/appointmentRequestEndpointDefinitions.ts
1634
2044
  const APPOINTMENT_REQUEST_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
@@ -1750,6 +2160,7 @@ const APPOINTMENT_SERVICE_CATEGORY_ENDPOINT_DEFINITIONS = defineEndpointDefiniti
1750
2160
  const APPOINTMENT_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
1751
2161
  ...APPOINTMENT_SERVICE_CATEGORY_ENDPOINT_DEFINITIONS,
1752
2162
  ...APPOINTMENT_REQUEST_ENDPOINT_DEFINITIONS,
2163
+ ...CLIENT_ARRANGEMENT_ENDPOINT_DEFINITIONS,
1753
2164
  listAppointmentResources: {
1754
2165
  path: "/sites/{siteId}/bookings/resources",
1755
2166
  method: "GET",
@@ -1787,119 +2198,23 @@ const APPOINTMENT_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
1787
2198
  auth: "user",
1788
2199
  responseKind: "json"
1789
2200
  },
1790
- updateAppointmentResource: {
1791
- path: "/sites/{siteId}/bookings/resources/{resourceId}",
1792
- method: "PUT",
1793
- auth: "user",
1794
- responseKind: "json",
1795
- errors: [
1796
- "validation:invalid_input",
1797
- "resource:not_found",
1798
- "server:internal_error"
1799
- ]
1800
- },
1801
- removeAppointmentResource: {
1802
- path: "/sites/{siteId}/bookings/resources/{resourceId}",
1803
- method: "DELETE",
1804
- auth: "user",
1805
- responseKind: "json",
1806
- errors: ["resource:not_found", "server:internal_error"]
1807
- },
1808
- listAppointmentReservations: {
1809
- path: "/sites/{siteId}/bookings/appointment-reservations",
1810
- method: "GET",
1811
- auth: "user",
1812
- responseKind: "json",
1813
- errors: []
1814
- },
1815
- createAppointmentReservation: {
1816
- path: "/sites/{siteId}/bookings/appointment-reservations",
1817
- method: "POST",
1818
- auth: "user",
1819
- responseKind: "json",
1820
- errors: [
1821
- "validation:invalid_input",
1822
- "resource:not_found",
1823
- "resource:conflict",
1824
- "server:internal_error"
1825
- ]
1826
- },
1827
- getAppointmentReservation: {
1828
- path: "/sites/{siteId}/bookings/appointment-reservations/{reservationId}",
1829
- method: "GET",
1830
- auth: "user",
1831
- responseKind: "json",
1832
- errors: ["resource:not_found", "server:internal_error"]
1833
- },
1834
- updateAppointmentReservation: {
1835
- path: "/sites/{siteId}/bookings/appointment-reservations/{reservationId}",
1836
- method: "PUT",
1837
- auth: "user",
1838
- responseKind: "json",
1839
- errors: [
1840
- "validation:invalid_input",
1841
- "resource:not_found",
1842
- "resource:conflict",
1843
- "server:internal_error"
1844
- ]
1845
- },
1846
- pauseAppointmentReservation: {
1847
- path: "/sites/{siteId}/bookings/appointment-reservations/{reservationId}/pause",
1848
- method: "POST",
1849
- auth: "user",
1850
- responseKind: "json",
1851
- errors: [
1852
- "resource:not_found",
1853
- "resource:conflict",
1854
- "server:internal_error"
1855
- ]
1856
- },
1857
- resumeAppointmentReservation: {
1858
- path: "/sites/{siteId}/bookings/appointment-reservations/{reservationId}/resume",
1859
- method: "POST",
1860
- auth: "user",
1861
- responseKind: "json",
1862
- errors: [
1863
- "resource:not_found",
1864
- "resource:conflict",
1865
- "server:internal_error"
1866
- ]
1867
- },
1868
- endAppointmentReservation: {
1869
- path: "/sites/{siteId}/bookings/appointment-reservations/{reservationId}/end",
1870
- method: "POST",
1871
- auth: "user",
1872
- responseKind: "json",
1873
- errors: [
1874
- "validation:invalid_input",
1875
- "resource:not_found",
1876
- "resource:conflict",
1877
- "server:internal_error"
1878
- ]
1879
- },
1880
- previewAppointmentReservationRun: {
1881
- path: "/sites/{siteId}/bookings/appointment-reservations/{reservationId}/run-preview",
1882
- method: "POST",
2201
+ updateAppointmentResource: {
2202
+ path: "/sites/{siteId}/bookings/resources/{resourceId}",
2203
+ method: "PUT",
1883
2204
  auth: "user",
1884
2205
  responseKind: "json",
1885
2206
  errors: [
1886
2207
  "validation:invalid_input",
1887
2208
  "resource:not_found",
1888
- "resource:conflict",
1889
2209
  "server:internal_error"
1890
2210
  ]
1891
2211
  },
1892
- createAppointmentReservationRun: {
1893
- path: "/sites/{siteId}/bookings/appointment-reservations/{reservationId}/runs",
1894
- method: "POST",
2212
+ removeAppointmentResource: {
2213
+ path: "/sites/{siteId}/bookings/resources/{resourceId}",
2214
+ method: "DELETE",
1895
2215
  auth: "user",
1896
2216
  responseKind: "json",
1897
- errors: [
1898
- "validation:invalid_input",
1899
- "resource:not_found",
1900
- "resource:conflict",
1901
- "server:internal_error"
1902
- ]
2217
+ errors: ["resource:not_found", "server:internal_error"]
1903
2218
  },
1904
2219
  createTeamMemberProfile: {
1905
2220
  path: "/sites/{siteId}/bookings/resources/{resourceId}/profile",
@@ -2997,8 +3312,8 @@ const NEWSLETTER_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
2997
3312
  tags: [TAG_TEMPLATES.site, TAG_TEMPLATES.siteNewsletter],
2998
3313
  errors: []
2999
3314
  },
3000
- renderNewsletterCampaignDraft: {
3001
- path: "/sites/{siteId}/newsletter/campaigns/{campaignId}/render-draft",
3315
+ resolveNewsletterCampaignDraft: {
3316
+ path: "/sites/{siteId}/newsletter/campaigns/{campaignId}/resolve-draft",
3002
3317
  method: "POST",
3003
3318
  auth: "user",
3004
3319
  responseKind: "json",
@@ -3215,6 +3530,54 @@ const SDK_APPOINTMENT_SERVICE_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
3215
3530
  }
3216
3531
  });
3217
3532
 
3533
+ //#endregion
3534
+ //#region ../api/src/sdkPageSectionEndpointDefinitions.ts
3535
+ const SDK_PAGE_SECTION_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
3536
+ sdkListPageSections: {
3537
+ path: "/sdk/{siteId}/page-sections",
3538
+ method: "GET",
3539
+ auth: "service",
3540
+ responseKind: "json",
3541
+ errors: ["server:internal_error"]
3542
+ },
3543
+ sdkPreparePageSectionChange: {
3544
+ path: "/sdk/{siteId}/page-sections/prepare",
3545
+ method: "POST",
3546
+ auth: "service",
3547
+ responseKind: "json",
3548
+ errors: [
3549
+ "validation:invalid_input",
3550
+ "resource:not_found",
3551
+ "resource:conflict",
3552
+ "server:internal_error"
3553
+ ]
3554
+ },
3555
+ sdkApplyPageSectionChange: {
3556
+ path: "/sdk/{siteId}/page-sections/apply",
3557
+ method: "POST",
3558
+ auth: "service",
3559
+ responseKind: "json",
3560
+ errors: [
3561
+ "validation:invalid_input",
3562
+ "resource:not_found",
3563
+ "resource:conflict",
3564
+ "server:internal_error"
3565
+ ]
3566
+ },
3567
+ changePageSections: {
3568
+ path: "/sites/{siteId}/page-sections/changes",
3569
+ method: "POST",
3570
+ auth: "user",
3571
+ responseKind: "json",
3572
+ demoMutation: allowedDemoMutationPolicy(),
3573
+ errors: [
3574
+ "validation:invalid_input",
3575
+ "auth:forbidden",
3576
+ "server:internal_error"
3577
+ ]
3578
+ }
3579
+ });
3580
+
3218
3581
  //#endregion
3219
3582
  //#region ../api/src/sdkPageDesignEndpointDefinitions.ts
3220
3583
  /**
@@ -4698,21 +5061,6 @@ function mapLineSettlementError(error) {
4698
5061
  }
4699
5062
  }
4700
5063
 
4701
- //#endregion
4702
- //#region ../commerce/src/purchase/checkoutStripeFinalizationPlanning.ts
4703
- function planCheckoutStripeSessionRecordUpdates(options) {
4704
- const record = (target) => ({
4705
- target,
4706
- orderId: options.orderId,
4707
- sessionId: options.sessionId
4708
- });
4709
- switch (options.paymentPlanKind) {
4710
- case "stripe": return [];
4711
- case "instalment_plan": return [record("order_payment_plan")];
4712
- case "flexible_balance": return [record("flexible_balance_contract")];
4713
- }
4714
- }
4715
-
4716
5064
  //#endregion
4717
5065
  //#region ../commerce/src/purchase/checkoutStripeSessionPlanning.ts
4718
5066
  function planCheckoutStripeSessionRequest(options) {
@@ -4901,6 +5249,13 @@ function planFirstPaymentLineItem(options) {
4901
5249
  quantity: 1
4902
5250
  }]);
4903
5251
  }
5252
+ /** Client-set prices always include VAT, independently of connected-account defaults. */
5253
+ function inclusivePriceData(price) {
5254
+ return {
5255
+ ...price,
5256
+ tax_behavior: "inclusive"
5257
+ };
5258
+ }
4904
5259
 
4905
5260
  //#endregion
4906
5261
  //#region ../commerce/src/purchase/checkoutSessionMetadata.ts
@@ -4980,18 +5335,13 @@ function failedDecision(options) {
4980
5335
  remainingRefundableCents: options.input.remainingRefundableCents
4981
5336
  };
4982
5337
  }
5338
+ /** Check order matters: identity, saved result, pending/held capacity, then amount. */
4983
5339
  function planCanonicalRefundRequest(input) {
4984
5340
  const requestedAmountCents = requestedAmountForPlan(input);
5341
+ return idempotencyConflict(input) ?? (input.existingByIdempotency ? existingRefundOutcome(input, input.existingByIdempotency) : null) ?? pendingRefundOutcome(input) ?? heldRefundConflict(input, requestedAmountCents) ?? refundAmountOutcome(input, requestedAmountCents);
5342
+ }
5343
+ function idempotencyConflict(input) {
4985
5344
  const existingByIdempotency = input.existingByIdempotency;
4986
- if (requestedAmountCents <= 0) {
4987
- return failedDecision({
4988
- input,
4989
- errorCode: "already_refunded",
4990
- errorMessage: "No refundable amount remaining for this purchase.",
4991
- refund: existingByIdempotency,
4992
- amountCents: requestedAmountCents
4993
- });
4994
- }
4995
5345
  if (existingByIdempotency && input.requestedAmountCents != null && existingByIdempotency.amountCents !== input.requestedAmountCents) {
4996
5346
  return failedDecision({
4997
5347
  input,
@@ -5010,15 +5360,10 @@ function planCanonicalRefundRequest(input) {
5010
5360
  amountCents: existingByIdempotency.amountCents
5011
5361
  });
5012
5362
  }
5013
- if (input.requireFullRemainingRefund && requestedAmountCents !== input.remainingRefundableCents) {
5014
- return failedDecision({
5015
- input,
5016
- errorCode: "pass_revoke_requires_full_refund",
5017
- errorMessage: "Pass revocation is only allowed when refunding the full remaining amount",
5018
- amountCents: requestedAmountCents
5019
- });
5020
- }
5021
- if (existingByIdempotency?.status === "succeeded") {
5363
+ return null;
5364
+ }
5365
+ function existingRefundOutcome(input, existingByIdempotency) {
5366
+ if (existingByIdempotency.status === "succeeded") {
5022
5367
  return {
5023
5368
  kind: "existing_succeeded",
5024
5369
  refund: existingByIdempotency,
@@ -5026,30 +5371,15 @@ function planCanonicalRefundRequest(input) {
5026
5371
  remainingRefundableCents: input.remainingRefundableCents
5027
5372
  };
5028
5373
  }
5029
- if (existingByIdempotency?.status === "pending") {
5030
- if (!existingByIdempotency.isStale) {
5031
- return failedDecision({
5032
- input,
5033
- errorCode: "refund_in_progress",
5034
- errorMessage: "A refund is already being processed for this idempotency key",
5035
- refund: existingByIdempotency,
5036
- amountCents: existingByIdempotency.amountCents
5037
- });
5038
- }
5039
- return {
5040
- kind: "resume_pending",
5041
- refund: existingByIdempotency,
5042
- requestedAmountCents: existingByIdempotency.amountCents
5043
- };
5044
- }
5045
- if (existingByIdempotency?.status === "reconciliation_needed") {
5374
+ if (existingByIdempotency.status === "pending") return pendingIdempotentRefundOutcome(input, existingByIdempotency);
5375
+ if (existingByIdempotency.status === "reconciliation_needed") {
5046
5376
  return {
5047
5377
  kind: "resume_pending",
5048
5378
  refund: existingByIdempotency,
5049
5379
  requestedAmountCents: existingByIdempotency.amountCents
5050
5380
  };
5051
5381
  }
5052
- if (existingByIdempotency?.status === "failed") {
5382
+ if (existingByIdempotency.status === "failed") {
5053
5383
  return failedDecision({
5054
5384
  input,
5055
5385
  errorCode: "refund_failed",
@@ -5058,6 +5388,23 @@ function planCanonicalRefundRequest(input) {
5058
5388
  amountCents: existingByIdempotency.amountCents
5059
5389
  });
5060
5390
  }
5391
+ return null;
5392
+ }
5393
+ function pendingIdempotentRefundOutcome(input, refund) {
5394
+ if (!refund.isStale) return failedDecision({
5395
+ input,
5396
+ errorCode: "refund_in_progress",
5397
+ errorMessage: "A refund is already being processed for this idempotency key",
5398
+ refund,
5399
+ amountCents: refund.amountCents
5400
+ });
5401
+ return {
5402
+ kind: "resume_pending",
5403
+ refund,
5404
+ requestedAmountCents: refund.amountCents
5405
+ };
5406
+ }
5407
+ function pendingRefundOutcome(input) {
5061
5408
  if (input.latestPending) {
5062
5409
  if (!input.latestPending.isStale) {
5063
5410
  return failedDecision({
@@ -5074,6 +5421,37 @@ function planCanonicalRefundRequest(input) {
5074
5421
  requestedAmountCents: input.latestPending.amountCents
5075
5422
  };
5076
5423
  }
5424
+ return null;
5425
+ }
5426
+ function heldRefundConflict(input, requestedAmountCents) {
5427
+ if (input.heldCents > 0 && (input.requestedAmountCents === undefined || requestedAmountCents > input.remainingRefundableCents || input.requireFullRemainingRefund)) {
5428
+ return failedDecision({
5429
+ input,
5430
+ errorCode: "refund_in_progress",
5431
+ errorMessage: "A refund is already being processed for this purchase",
5432
+ amountCents: requestedAmountCents
5433
+ });
5434
+ }
5435
+ return null;
5436
+ }
5437
+ function refundAmountOutcome(input, requestedAmountCents) {
5438
+ if (requestedAmountCents <= 0) {
5439
+ return failedDecision({
5440
+ input,
5441
+ errorCode: "already_refunded",
5442
+ errorMessage: "No refundable amount remaining for this purchase.",
5443
+ refund: input.existingByIdempotency,
5444
+ amountCents: requestedAmountCents
5445
+ });
5446
+ }
5447
+ if (input.requireFullRemainingRefund && requestedAmountCents !== input.remainingRefundableCents) {
5448
+ return failedDecision({
5449
+ input,
5450
+ errorCode: "pass_revoke_requires_full_refund",
5451
+ errorMessage: "Pass revocation is only allowed when refunding the full remaining amount",
5452
+ amountCents: requestedAmountCents
5453
+ });
5454
+ }
5077
5455
  if (requestedAmountCents > input.remainingRefundableCents) {
5078
5456
  return failedDecision({
5079
5457
  input,
@@ -6285,6 +6663,7 @@ function planItem(item, input) {
6285
6663
  warnings: [],
6286
6664
  actions: [{
6287
6665
  kind: "send_appointment_confirmation",
6666
+ orderId: item.orderId,
6288
6667
  appointmentId: item.appointmentId
6289
6668
  }]
6290
6669
  } : {
@@ -7309,13 +7688,6 @@ function planUnappliedOrderPaymentReceiptAllocations(input) {
7309
7688
  return attributedCents === input.amountCents ? ok(allocations) : err({ kind: "allocation_invariant_failed" });
7310
7689
  }
7311
7690
 
7312
- //#endregion
7313
- //#region ../commerce/src/purchase/pendingCheckoutSessionClaim.ts
7314
- const PENDING_CHECKOUT_SESSION_PREFIX = "pending_checkout:";
7315
- function isPendingOrderCheckoutSessionClaim(stripeCheckoutSessionId) {
7316
- return typeof stripeCheckoutSessionId === "string" && stripeCheckoutSessionId.startsWith(PENDING_CHECKOUT_SESSION_PREFIX);
7317
- }
7318
-
7319
7691
  //#endregion
7320
7692
  //#region ../commerce/src/purchase/orderPaymentLinkPlanning.ts
7321
7693
  function buildOrderPaymentAdminProjection(facts) {
@@ -7385,7 +7757,7 @@ function resolvePaymentLinkAvailabilityFromFacts(input) {
7385
7757
  if (!input.stripeConnected) {
7386
7758
  return unavailable("stripe_not_connected", "Online payment is not available for this site.", 409);
7387
7759
  }
7388
- if (isPendingOrderCheckoutSessionClaim(input.stripeCheckoutSessionId)) {
7760
+ if (input.hasLiveCheckoutAttempt) {
7389
7761
  return unavailable("checkout_in_progress", "An online payment checkout is already in progress for this order.", 409);
7390
7762
  }
7391
7763
  return { kind: "available" };
@@ -7789,6 +8161,18 @@ function summarizePriorRefundsByRail(refunds, orderItemIds) {
7789
8161
  creditCents: unsafeAsNonNegativeCents(totalForRail("credit"))
7790
8162
  });
7791
8163
  }
8164
+ /** Select policy funding once, retaining the recorded source even for site-credit returns. */
8165
+ function planBookingRefundFunding(input) {
8166
+ const funding = input.allowProtectedDepositOverride ? input.funding : input.policyFunding ?? input.funding;
8167
+ const sourceAllocation = planRefundDestinationAllocation(funding, input.amountCents, "original_payment");
8168
+ return {
8169
+ allocation: sourceAllocation.map((line) => ({
8170
+ ...line,
8171
+ destination: input.method === "site_credit" ? "credit" : line.destination
8172
+ })),
8173
+ recordedAmountCents: sourceAllocation.filter((line) => line.destination === "direct").reduce((sum, line) => sum + line.amountCents, 0)
8174
+ };
8175
+ }
7792
8176
  /** One receipt allocation owns rounding for both the confirmation and execution. */
7793
8177
  function planRefundDestinationAllocation(funding, amountCents, method) {
7794
8178
  const eligible = funding.filter((line) => line.remainingCents > 0);
@@ -8561,14 +8945,6 @@ const PUBLIC_BOOKING_AVAILABILITY_ENDPOINT_DEFINITIONS = defineEndpointDefinitio
8561
8945
  auth: "public",
8562
8946
  responseKind: "json"
8563
8947
  },
8564
- getPublicBookingServiceBySlug: {
8565
- path: "/public/bookings/services/by-slug/{slug}",
8566
- method: "GET",
8567
- revalidate: publicReadFreshnessSeconds("getPublicBookingService"),
8568
- tags: [TAG_TEMPLATES.publicBookingServices],
8569
- auth: "public",
8570
- responseKind: "json"
8571
- },
8572
8948
  getPublicBookingResourcesReference: {
8573
8949
  path: "/public/bookings/resources/reference",
8574
8950
  method: "GET",
@@ -9164,7 +9540,7 @@ const PUBLIC_READ_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
9164
9540
  path: "/sites",
9165
9541
  method: "GET",
9166
9542
  errors: [],
9167
- revalidate: 900,
9543
+ revalidate: PUBLIC_CONTENT_FRESHNESS_SECONDS,
9168
9544
  tags: [
9169
9545
  TAG_TEMPLATES.siteById,
9170
9546
  TAG_TEMPLATES.siteBySlug,
@@ -9939,6 +10315,7 @@ const clientErrorReportSchema = z.object({
9939
10315
  //#endregion
9940
10316
  //#region ../api/src/endpoints.ts
9941
10317
  const ENDPOINT_DEFINITIONS = {
10318
+ ...PAGE_SECTION_LOOK_ENDPOINT_DEFINITIONS,
9942
10319
  ...PAGE_JOURNAL_ENDPOINT_DEFINITIONS,
9943
10320
  ...PREVIEW_AUTH_ENDPOINT_DEFINITIONS,
9944
10321
  ...SITE_LIFECYCLE_ENDPOINT_DEFINITIONS,
@@ -10594,14 +10971,6 @@ const ENDPOINT_DEFINITIONS = {
10594
10971
  auth: "user",
10595
10972
  responseKind: "json"
10596
10973
  },
10597
- applyContentTemplateAddon: {
10598
- editLease: "unleased-editor",
10599
- path: "/sites/{siteId}/content/types/{type}/template/addons",
10600
- method: "POST",
10601
- tags: ["site-{siteId}", "content-template-{siteId}-{type}"],
10602
- auth: "user",
10603
- responseKind: "json"
10604
- },
10605
10974
  updateContentTemplateBlockBindings: {
10606
10975
  editLease: "unleased-editor",
10607
10976
  path: "/sites/{siteId}/content/types/{type}/template/blocks/{blockId}/bindings",
@@ -11366,6 +11735,20 @@ const ENDPOINT_DEFINITIONS = {
11366
11735
  auth: "user",
11367
11736
  responseKind: "json"
11368
11737
  },
11738
+ reconnectDomain: {
11739
+ path: "/domains/{domainId}/reconnect",
11740
+ method: "POST",
11741
+ errors: [
11742
+ "resource:not_found",
11743
+ "auth:forbidden",
11744
+ "resource:conflict",
11745
+ "billing:payment_required",
11746
+ "external:service_error"
11747
+ ],
11748
+ tags: ["domains", "domain-{domainId}"],
11749
+ auth: "user",
11750
+ responseKind: "json"
11751
+ },
11369
11752
  removeDomain: {
11370
11753
  path: "/domains/{domainId}",
11371
11754
  method: "DELETE",
@@ -12525,6 +12908,7 @@ const ENDPOINT_DEFINITIONS = {
12525
12908
  ]
12526
12909
  },
12527
12910
  getContentByPath: {
12911
+ revalidate: PUBLIC_CONTENT_FRESHNESS_SECONDS,
12528
12912
  path: "/sites/{siteId}/pages",
12529
12913
  method: "GET",
12530
12914
  tags: [TAG_TEMPLATES.siteRoutableContent],
@@ -12980,7 +13364,6 @@ const ENDPOINT_DEFINITIONS = {
12980
13364
  getGeneratedIconRenderAssets: {
12981
13365
  path: "/public/sites/{siteId}/generated-icon-assets",
12982
13366
  method: "POST",
12983
- tags: [TAG_TEMPLATES.siteRoutableContent],
12984
13367
  auth: "public",
12985
13368
  responseKind: "json",
12986
13369
  errors: []
@@ -14272,6 +14655,30 @@ const ENDPOINT_DEFINITIONS = {
14272
14655
  auth: "user",
14273
14656
  responseKind: "blob"
14274
14657
  },
14658
+ exportMoneyRefundsCsv: {
14659
+ path: "/sites/{siteId}/bookings/money/refunds/export.csv",
14660
+ method: "GET",
14661
+ tags: [
14662
+ "site-{siteId}",
14663
+ "bookings",
14664
+ "money-report-{siteId}"
14665
+ ],
14666
+ errors: [],
14667
+ auth: "user",
14668
+ responseKind: "blob"
14669
+ },
14670
+ exportMoneyHeldForCustomersCsv: {
14671
+ path: "/sites/{siteId}/bookings/money/held-for-customers/export.csv",
14672
+ method: "GET",
14673
+ tags: [
14674
+ "site-{siteId}",
14675
+ "bookings",
14676
+ "money-report-{siteId}"
14677
+ ],
14678
+ errors: [],
14679
+ auth: "user",
14680
+ responseKind: "blob"
14681
+ },
14275
14682
  listBookingActivity: {
14276
14683
  path: "/sites/{siteId}/bookings/activity",
14277
14684
  method: "GET",
@@ -14860,6 +15267,7 @@ const ENDPOINT_DEFINITIONS = {
14860
15267
  responseKind: "json"
14861
15268
  },
14862
15269
  ...SDK_APPOINTMENT_SERVICE_ENDPOINT_DEFINITIONS,
15270
+ ...SDK_PAGE_SECTION_ENDPOINT_DEFINITIONS,
14863
15271
  sdkUpsertEventCategory: {
14864
15272
  path: "/sdk/{siteId}/event-categories",
14865
15273
  method: "POST",
@@ -14992,6 +15400,13 @@ const ENDPOINT_DEFINITIONS = {
14992
15400
  auth: "public",
14993
15401
  responseKind: "json"
14994
15402
  },
15403
+ portalGetRegularSessions: {
15404
+ path: "/portal/appointments/regular-sessions",
15405
+ method: "GET",
15406
+ auth: "public",
15407
+ responseKind: "json",
15408
+ errors: ["server:internal_error"]
15409
+ },
14995
15410
  portalGetAppointments: {
14996
15411
  path: "/portal/appointments",
14997
15412
  method: "GET",
@@ -15389,7 +15804,8 @@ const operationIdSchema = z.uuid();
15389
15804
  function commandHeaders(endpoint, headers, operationId) {
15390
15805
  const result = new Headers(headers);
15391
15806
  const method = API_ENDPOINTS[endpoint].method;
15392
- if (method !== "GET" && !result.has(OPERATION_ID_HEADER)) result.set(OPERATION_ID_HEADER, operationId);
15807
+ const readPost = endpoint === "batchBlockLoaders" || endpoint === "getGeneratedIconRenderAssets";
15808
+ if (method !== "GET" && !readPost && !result.has(OPERATION_ID_HEADER)) result.set(OPERATION_ID_HEADER, operationId);
15393
15809
  return result;
15394
15810
  }
15395
15811
 
@@ -16026,6 +16442,13 @@ const mediaUsageLocationSchema = z.discriminatedUnion("kind", [
16026
16442
  surfaceSlotId: identifierSchema,
16027
16443
  slotKey: identifierSchema
16028
16444
  }),
16445
+ z.object({
16446
+ kind: z.literal("pageSurfaceContent"),
16447
+ siteId: identifierSchema,
16448
+ pageSurfaceId: identifierSchema,
16449
+ pageTitle: z.string().nullable(),
16450
+ stage: z.enum(["draft", "published"])
16451
+ }),
16029
16452
  z.object({
16030
16453
  kind: z.literal("contentEntry"),
16031
16454
  siteId: identifierSchema,
@@ -16177,7 +16600,7 @@ const sdkNavigationLinkInputSchema = navigationLinkInputSchema;
16177
16600
  */
16178
16601
  function losslessValidatedSchema(schema) {
16179
16602
  return z.unknown().superRefine((value, ctx) => {
16180
- const parsed = schema.safeParse(value);
16603
+ const parsed = z.safeParse(schema, value);
16181
16604
  if (parsed.success) return;
16182
16605
  for (const issue of parsed.error.issues) {
16183
16606
  ctx.addIssue({
@@ -16192,7 +16615,7 @@ function losslessValidatedSchema(schema) {
16192
16615
  const sdkThemeWireSchema = losslessValidatedSchema(themeSchema);
16193
16616
  /** Explicitly cross from the lossless wire model into Riverbank's canonical theme. */
16194
16617
  function normalizeSdkThemeWire(theme) {
16195
- return themeSchema.parse(theme);
16618
+ return z.parse(themeSchema, theme);
16196
16619
  }
16197
16620
 
16198
16621
  //#endregion
@@ -16451,7 +16874,7 @@ const sdkPullFormsResponseSchema = z.object({
16451
16874
  meta: sdkPullMetaSchema
16452
16875
  });
16453
16876
  const sdkPullThemeResponseSchema = z.object({
16454
- theme: sdkThemeWireSchema.nullable(),
16877
+ theme: z.nullable(sdkThemeWireSchema),
16455
16878
  themeId: sdkIdentifierSchema$1.nullable(),
16456
16879
  selectionId: sdkIdentifierSchema$1.nullable(),
16457
16880
  selectionVersion: z.number().int().nonnegative(),
@@ -16580,6 +17003,7 @@ const BOOKING_SETTINGS_SECTION_KEYS = {
16580
17003
  "eventDestinationPolicy"
16581
17004
  ],
16582
17005
  appointments: [
17006
+ "serviceDestinationPolicy",
16583
17007
  "appointmentReminderOverrides",
16584
17008
  "appointmentDefaultMinLeadMinutes",
16585
17009
  "appointmentDefaultMaxBookingNoticeMinutes",
@@ -16733,14 +17157,17 @@ const DEFAULT_EVENT_DESTINATION_POLICY = {
16733
17157
  function isEventDestinationMode(value) {
16734
17158
  return eventDestinationModeValues.some((mode) => mode === value);
16735
17159
  }
16736
- function resolveEventDestinationMode(input) {
17160
+ const DEFAULT_SERVICE_DESTINATION_POLICY = { defaultMode: "system-managed" };
17161
+ /** Full service pages are configurable only on a managed website. */
17162
+ function canConfigureServicePages(environment) {
17163
+ return environment.publicExperience !== "hosted_booking" && !environment.isSdkSite;
17164
+ }
17165
+ /** The single page-mode decision for events and services. */
17166
+ function resolveSubjectDestinationMode(input) {
17167
+ if (input.subject === "service") return canConfigureServicePages(input) ? (input.policy ?? DEFAULT_SERVICE_DESTINATION_POLICY).defaultMode : "system-managed";
16737
17168
  const policy = input.policy ?? DEFAULT_EVENT_DESTINATION_POLICY;
16738
- if (input.preset) {
16739
- const presetOverride = policy.presetOverrides[input.preset];
16740
- if (presetOverride) return presetOverride;
16741
- }
16742
- if (input.publicExperience === "hosted_booking") return "system-managed";
16743
- return policy.defaultMode;
17169
+ const override = input.preset ? policy.presetOverrides[input.preset] : undefined;
17170
+ return override ?? (input.publicExperience === "hosted_booking" ? "system-managed" : policy.defaultMode);
16744
17171
  }
16745
17172
  function macadamiaDefaultEventDestinationPolicy(selectedPresets) {
16746
17173
  const presetOverrides = {};
@@ -17051,6 +17478,7 @@ function completeBookingSettingsForSectionUpdate(settings) {
17051
17478
  defaultMode: "cms-managed",
17052
17479
  presetOverrides: {}
17053
17480
  },
17481
+ serviceDestinationPolicy: settings.serviceDestinationPolicy ?? DEFAULT_SERVICE_DESTINATION_POLICY,
17054
17482
  eventTypeBookingDefaults: settings.eventTypeBookingDefaults ?? {}
17055
17483
  };
17056
17484
  }
@@ -18087,7 +18515,7 @@ const uiSchema = z.object({
18087
18515
  allowDirectInput: z.boolean().optional(),
18088
18516
  pattern: z.string().optional(),
18089
18517
  placeholder: z.string().optional(),
18090
- visibleWhen: visibleWhenSchema.optional(),
18518
+ visibleWhen: z.optional(visibleWhenSchema),
18091
18519
  modalConfig: z.object({
18092
18520
  buttonLabel: z.string().optional(),
18093
18521
  description: z.string().optional(),
@@ -18698,13 +19126,13 @@ const nodeSchema = z.object({
18698
19126
  type: z.string().min(1, "Node type is required"),
18699
19127
  key: z.string().optional(),
18700
19128
  props: nodePropsSchema.optional(),
18701
- children: z.lazy(() => nodeSchema.array().default([])).optional(),
19129
+ children: z.lazy(() => z.array(nodeSchema).default([])).optional(),
18702
19130
  $bind: bindingSchema.optional(),
18703
19131
  $repeat: repeatSchema.optional(),
18704
19132
  $when: conditionSchema.optional(),
18705
19133
  $scopes: dataScopeSchema.array().optional()
18706
19134
  });
18707
- const nodeTreeSchema = nodeSchema.array().or(nodeSchema);
19135
+ const nodeTreeSchema = z.union([z.array(nodeSchema), nodeSchema]);
18708
19136
  const NodeSchema = nodeSchema;
18709
19137
  const NodeTreeSchema = nodeTreeSchema;
18710
19138
 
@@ -18959,14 +19387,14 @@ const sdkCustomBlockInputSchema = z.object({
18959
19387
  category: blockCategoryEnum,
18960
19388
  icon: z.string().optional(),
18961
19389
  tags: z.array(z.string()).optional(),
18962
- fields: fieldDefinitionInputSchema.array().min(1),
19390
+ fields: z.array(fieldDefinitionInputSchema).min(1),
18963
19391
  dataLoaders: sdkDataLoadersSchema,
18964
- layout: NodeSchema.optional(),
19392
+ layout: z.optional(NodeSchema),
18965
19393
  ...sdkBlockPresentationShape,
18966
19394
  ...blockSectionDeclarationShape
18967
19395
  }).superRefine(validateManifestLookField).superRefine(validateSdkBlockDeclaration);
18968
19396
  const sdkBlockFieldExtensionInputSchema = z.object({
18969
- fields: fieldDefinitionInputSchema.array().min(1),
19397
+ fields: z.array(fieldDefinitionInputSchema).min(1),
18970
19398
  ...blockSectionDeclarationShape
18971
19399
  }).superRefine(validateManifestLookField);
18972
19400
  const sdkBlockFieldExtensionsInputSchema = z.record(z.string().min(1), sdkBlockFieldExtensionInputSchema);
@@ -20051,13 +20479,13 @@ var InvocationEnvelope = class {
20051
20479
  errors: []
20052
20480
  };
20053
20481
  }
20054
- const errors = this.errors.length > 0 ? this.errors : [{ message: "Command failed." }];
20482
+ const errors$1 = this.errors.length > 0 ? this.errors : [{ message: "Command failed." }];
20055
20483
  return {
20056
20484
  ok: false,
20057
20485
  command,
20058
20486
  result: this.resultValue,
20059
20487
  warnings: this.warnings,
20060
- errors
20488
+ errors: errors$1
20061
20489
  };
20062
20490
  }
20063
20491
  /** Emit the single envelope. Idempotent: subsequent calls are no-ops. */
@@ -20468,8 +20896,8 @@ function formatError(error, ctx) {
20468
20896
  /**
20469
20897
  * Format validation errors for display
20470
20898
  */
20471
- function formatValidationErrors(errors) {
20472
- return errors.map((e) => ` - ${e.path}: ${e.message}`).join("\n");
20899
+ function formatValidationErrors(errors$1) {
20900
+ return errors$1.map((e) => ` - ${e.path}: ${e.message}`).join("\n");
20473
20901
  }
20474
20902
  function formatDiff(items) {
20475
20903
  const lines = [];
@@ -22357,79 +22785,109 @@ function createApiResponseTransport(getHeaders = () => ({}), baseUrl, { sdkVersi
22357
22785
  return fetchPromise;
22358
22786
  };
22359
22787
  }
22360
- function buildApiRequestPlan(input) {
22361
- const { endpoint, body, params, headers = {}, baseUrl } = input;
22362
- const options = input.options ?? {};
22363
- let url = buildEndpointURL(baseUrl, endpoint);
22788
+ const batchReadPolicyBodySchema = z.object({ requests: z.array(z.object({
22789
+ endpoint: z.string(),
22790
+ params: z.record(z.string(), z.unknown()).optional()
22791
+ })) });
22792
+ /** Unclassified items fall back to the short budget and site tags inside the policy. */
22793
+ function resolveBatchReadFetchPolicy(params, body) {
22794
+ if (params?.stage === "preview" || typeof params?.siteId !== "string") return null;
22795
+ const parsed = batchReadPolicyBodySchema.safeParse(body);
22796
+ if (!parsed.success) return null;
22797
+ return buildPublicReadFetchPolicy(params.siteId, parsed.data.requests);
22798
+ }
22799
+ function batchReadRequestOptions(params, body, options) {
22800
+ if (options.cache === "no-store") return options;
22801
+ const policy = resolveBatchReadFetchPolicy(params, body);
22802
+ if (!policy) return {
22803
+ ...options,
22804
+ cache: "no-store"
22805
+ };
22806
+ const next = options.next ?? {};
22807
+ const revalidate = typeof next.revalidate === "number" ? Math.min(next.revalidate, policy.revalidate) : policy.revalidate;
22808
+ return {
22809
+ ...options,
22810
+ next: {
22811
+ ...next,
22812
+ tags: normalizeRevalidateTags([...next.tags ?? [], ...policy.tags]),
22813
+ revalidate
22814
+ }
22815
+ };
22816
+ }
22817
+ /** Shared public request policy applies to every transport caller, including the SDK. */
22818
+ function publicReadRequestOptions(endpoint, params, body, options) {
22819
+ if (endpoint === "batchBlockLoaders") return batchReadRequestOptions(params, body, options);
22820
+ const preview = params?.preview === true || params?.preview === "true";
22821
+ return endpoint === "getContentByPath" && preview ? {
22822
+ ...options,
22823
+ cache: "no-store"
22824
+ } : options;
22825
+ }
22826
+ function assertResolvedEndpointPath(endpoint, url) {
22827
+ const tokens = [...url.match(/\{[^}]+\}/g) ?? [], ...url.match(/(^|\/):([A-Za-z][A-Za-z0-9_]*)\b/g) ?? []];
22828
+ const missing = [...new Set(tokens.map((token) => token.startsWith("{") ? token.slice(1, -1) : token.replace(/^\//, "").slice(1)))];
22829
+ if (missing.length) throw new Error(`Missing required path params for endpoint ${String(endpoint)}: ${missing.join(", ")}`);
22830
+ }
22831
+ /** Path/query decisions are shared by all request plans, without retaining mutable URL state. */
22832
+ function resolveRequestUrl(input) {
22833
+ const { endpoint, baseUrl, params, body, isGetOrHead } = input;
22364
22834
  const originalPath = API_ENDPOINTS[endpoint].path;
22365
- const unusedParams = {};
22366
- if (params) {
22367
- Object.entries(params).forEach(([key, value]) => {
22368
- const bracePlaceholder = `{${key}}`;
22369
- const colonPlaceholder = `:${key}`;
22370
- if (originalPath.includes(bracePlaceholder) || originalPath.includes(colonPlaceholder)) {
22371
- const stringValue = serializePathParam(endpoint, key, value);
22372
- url = url.replace(bracePlaceholder, stringValue);
22373
- url = url.replace(colonPlaceholder, stringValue);
22374
- } else {
22375
- unusedParams[key] = value;
22376
- }
22377
- });
22378
- }
22379
- const unresolvedPathParams = [...url.match(/\{[^}]+\}/g) ?? [], ...url.match(/(^|\/):([A-Za-z][A-Za-z0-9_]*)\b/g) ?? []];
22380
- if (unresolvedPathParams.length > 0) {
22381
- const missingParams = Array.from(new Set(unresolvedPathParams.map((token) => {
22382
- if (token.startsWith("{") && token.endsWith("}")) {
22383
- return token.slice(1, -1);
22384
- }
22385
- return token.replace(/^\//, "").slice(1);
22386
- })));
22387
- throw new Error(`Missing required path params for endpoint ${String(endpoint)}: ${missingParams.join(", ")}`);
22835
+ const isPathParam = (key) => originalPath.includes(`{${key}}`) || originalPath.includes(`:${key}`);
22836
+ const entries = Object.entries(params ?? {});
22837
+ const path$3 = entries.filter(([key]) => isPathParam(key)).reduce((url, [key, value]) => {
22838
+ const encoded = serializePathParam(endpoint, key, value);
22839
+ return url.replace(`{${key}}`, encoded).replace(`:${key}`, encoded);
22840
+ }, buildEndpointURL(baseUrl, endpoint));
22841
+ assertResolvedEndpointPath(endpoint, path$3);
22842
+ const query = new URLSearchParams();
22843
+ entries.filter(([key]) => !isPathParam(key)).forEach(([key, value]) => appendQueryParam(query, key, value));
22844
+ if (isGetOrHead && typeof body === "object" && body !== null && !isFormDataBody(body)) {
22845
+ Object.entries(body).forEach(([key, value]) => appendQueryParam(query, key, value));
22388
22846
  }
22847
+ const suffix = query.toString();
22848
+ return suffix ? `${path$3}${path$3.includes("?") ? "&" : "?"}${suffix}` : path$3;
22849
+ }
22850
+ /** Explicit no-store wins; a request may add read tags without declaring mutation effects. */
22851
+ function resolveRequestNextOptions(endpoint, params, options, isGetOrHead) {
22852
+ const config = API_ENDPOINTS[endpoint];
22853
+ const { revalidate: requested, ...next } = options.next ?? {};
22854
+ const defaultRevalidate = isGetOrHead && "revalidate" in config ? config.revalidate : undefined;
22855
+ const revalidate = options.cache === "no-store" ? undefined : requested ?? defaultRevalidate;
22856
+ return {
22857
+ ...next,
22858
+ ...revalidate === undefined ? {} : { revalidate },
22859
+ ..."tags" in config && Array.isArray(config.tags) ? { tags: buildCacheReadTags([...next.tags ?? [], ...config.tags], params) } : {}
22860
+ };
22861
+ }
22862
+ function buildApiRequestPlan(input) {
22863
+ const { endpoint, body, params, headers = {}, baseUrl } = input;
22864
+ const options = publicReadRequestOptions(endpoint, params, body, input.options ?? {});
22389
22865
  const endpointConfig = API_ENDPOINTS[endpoint];
22390
22866
  const method = endpointConfig.method;
22391
22867
  const isGetOrHead = method === "GET" || method === "HEAD";
22392
- const queryParams = new URLSearchParams();
22393
- Object.entries(unusedParams).forEach(([key, value]) => {
22394
- appendQueryParam(queryParams, key, value);
22395
- });
22396
- if (isGetOrHead && typeof body === "object" && body !== null && !isFormDataBody(body)) {
22397
- Object.entries(body).forEach(([key, value]) => {
22398
- appendQueryParam(queryParams, key, value);
22399
- });
22400
- }
22401
- const queryString = queryParams.toString();
22402
- if (queryString) {
22403
- url += (url.includes("?") ? "&" : "?") + queryString;
22404
- }
22405
22868
  const formDataBody = isFormDataBody(body) ? body : undefined;
22406
- const optionsNext = options?.next;
22407
- const nextOptions = { ...optionsNext ?? {} };
22408
- const cacheIsNoStore = options?.cache === "no-store";
22409
- if (cacheIsNoStore) {
22410
- delete nextOptions.revalidate;
22411
- } else if (isGetOrHead && nextOptions.revalidate === undefined && "revalidate" in endpointConfig && typeof endpointConfig.revalidate === "number") {
22412
- nextOptions.revalidate = endpointConfig.revalidate;
22413
- }
22414
- if ("tags" in endpointConfig && Array.isArray(endpointConfig.tags)) {
22415
- nextOptions.tags = buildCacheReadTags([...nextOptions.tags ?? [], ...endpointConfig.tags], params);
22416
- }
22417
- const init = {
22418
- method,
22419
- ...options,
22420
- credentials: "same-origin",
22421
- body: isGetOrHead || body == null ? undefined : formDataBody ?? JSON.stringify(body),
22422
- headers: buildRequestHeaders({
22423
- optionsHeaders: options.headers,
22424
- authHeaders: headers,
22425
- sdkVersion: input.sdkVersion,
22426
- includeJsonContentType: !isGetOrHead && !formDataBody
22427
- }),
22428
- ...Object.keys(nextOptions).length > 0 ? { next: nextOptions } : {}
22429
- };
22869
+ const next = resolveRequestNextOptions(endpoint, params, options, isGetOrHead);
22430
22870
  return {
22431
- url,
22432
- init,
22871
+ url: resolveRequestUrl({
22872
+ endpoint,
22873
+ baseUrl,
22874
+ params,
22875
+ body,
22876
+ isGetOrHead
22877
+ }),
22878
+ init: {
22879
+ method,
22880
+ ...options,
22881
+ credentials: "same-origin",
22882
+ next,
22883
+ body: isGetOrHead || body == null ? undefined : formDataBody ?? JSON.stringify(body),
22884
+ headers: buildRequestHeaders({
22885
+ optionsHeaders: options.headers,
22886
+ authHeaders: headers,
22887
+ sdkVersion: input.sdkVersion,
22888
+ includeJsonContentType: !isGetOrHead && !formDataBody
22889
+ })
22890
+ },
22433
22891
  ...!isGetOrHead && "tags" in endpointConfig && Array.isArray(endpointConfig.tags) ? { cacheInvalidationTags: endpointConfig.tags.map((tag) => tag) } : {}
22434
22892
  };
22435
22893
  }
@@ -22495,14 +22953,6 @@ function isAppointmentServiceLocationType(value) {
22495
22953
  return value === "virtual" || value === "in_person" || value === "hybrid";
22496
22954
  }
22497
22955
 
22498
- //#endregion
22499
- //#region ../api/src/bookingOperations.ts
22500
- const APPOINTMENT_RESERVATION_STATUS_VALUES = [
22501
- "active",
22502
- "paused",
22503
- "ended"
22504
- ];
22505
-
22506
22956
  //#endregion
22507
22957
  //#region ../api/src/wholeSeriesRuns.ts
22508
22958
  const DELETE_EVENT_OFFERING_CONFLICT_REASONS = [
@@ -22569,6 +23019,7 @@ const BOOKING_ACTIVITY_TYPE_VALUES = [
22569
23019
  "membership_started",
22570
23020
  "membership_paused",
22571
23021
  "membership_cancelled",
23022
+ "appointment_refund",
22572
23023
  "event_refund",
22573
23024
  "pass_refund",
22574
23025
  "membership_refund",
@@ -23020,7 +23471,7 @@ function pushConfigFailure(error, timeoutMs, requestInfo) {
23020
23471
  return managementTransportError(error, timeoutMs, requestInfo);
23021
23472
  }
23022
23473
  function validatePushConfig(rawConfig) {
23023
- const parsed = riverbankSiteConfigSchema.safeParse(rawConfig);
23474
+ const parsed = z.safeParse(riverbankSiteConfigSchema, rawConfig);
23024
23475
  if (!parsed.success) {
23025
23476
  const issues = parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ");
23026
23477
  throw new Error(`Invalid config: ${issues}`);
@@ -23050,12 +23501,12 @@ function analyzePushConfigResponse(response, dryRun) {
23050
23501
  sync: null,
23051
23502
  warnings: []
23052
23503
  };
23053
- const errors = collectPushConfigSyncErrors(sync);
23054
- if (errors.length > 0 || sync.success === false) return {
23504
+ const errors$1 = collectPushConfigSyncErrors(sync);
23505
+ if (errors$1.length > 0 || sync.success === false) return {
23055
23506
  success: false,
23056
23507
  kind: "sync-errors",
23057
23508
  sync,
23058
- errors
23509
+ errors: errors$1
23059
23510
  };
23060
23511
  return {
23061
23512
  success: true,
@@ -24079,7 +24530,7 @@ function getDefaultStaffCapabilities(surfaces) {
24079
24530
  return ["appointments"];
24080
24531
  }
24081
24532
  const managedDomainAddOnPricingSnapshotSchema = z.object({
24082
- formulaVersion: z.literal("managed-domain-overage-v1"),
24533
+ formulaVersion: z.literal("managed-domain-overage-v2"),
24083
24534
  conversionRule: z.literal("usd-to-gbp-1-to-1-v1"),
24084
24535
  registrarAnnualCost: z.number().nonnegative(),
24085
24536
  registrarCurrency: z.literal("USD"),
@@ -24645,8 +25096,25 @@ const websiteSurfaceIds = [
24645
25096
  "site.performance"
24646
25097
  ];
24647
25098
  const websiteSurfaceIdSet = new Set(websiteSurfaceIds);
24648
- /** Home, and a booking page's Appearance, stay ahead of the Website group. */
24649
- const leadingSurfaceIdSet = new Set(["site.overview", "site.appearance"]);
25099
+ /**
25100
+ * A booking page has no website to manage, so it gets its own order: the
25101
+ * screens people use most days first, then the page itself. Its photos are
25102
+ * reached from Your page rather than the nav.
25103
+ */
25104
+ const bookingPageSurfaceOrder = [
25105
+ "site.overview",
25106
+ "site.bookings",
25107
+ "site.shop",
25108
+ "site.money",
25109
+ "site.appearance",
25110
+ "site.newsletter",
25111
+ "site.performance",
25112
+ "site.settings"
25113
+ ];
25114
+ const bookingPageLabels = {
25115
+ "site.overview": "Home",
25116
+ "site.appearance": "Your page"
25117
+ };
24650
25118
  function isFeatureEnabled$1(ctx, flag) {
24651
25119
  if (flag === "websiteEditingVisible") {
24652
25120
  return ctx.websiteEditingVisible !== false;
@@ -24657,41 +25125,57 @@ function isDemoSiteNavSurfaceVisible(mode, surfaceId) {
24657
25125
  return !isDemoDashboardUiRestricted(mode) || !hiddenDemoSiteNavIds.has(surfaceId);
24658
25126
  }
24659
25127
  function shouldGroupWebsiteLinks(input) {
24660
- return input.bookingsVisible === true && (input.websiteLinks.length >= 2 || input.websiteLinks.length >= 1 && input.otherLinks.length >= 1);
25128
+ return input.bookingsVisible && (input.websiteLinks.length >= 2 || input.websiteLinks.length >= 1 && input.otherLinks.length >= 1);
24661
25129
  }
24662
25130
  function buildDashboardSiteNavPlan(ctx) {
24663
25131
  const visibility = extractSdkDashboardNavVisibilityConfigForRole(ctx.sdkConfig, "siteNav", ctx.role);
24664
- const links = DASHBOARD_SITE_NAV_DESCRIPTORS.filter((entry) => isFeatureEnabled$1(ctx, entry.featureFlag)).filter((entry) => isDemoSiteNavSurfaceVisible(ctx.demoUiMode ?? "standard", entry.id)).filter((entry) => isNavItemVisible({
25132
+ const visible = DASHBOARD_SITE_NAV_DESCRIPTORS.filter((entry) => isFeatureEnabled$1(ctx, entry.featureFlag)).filter((entry) => isDemoSiteNavSurfaceVisible(ctx.demoUiMode ?? "standard", entry.id)).filter((entry) => isNavItemVisible({
24665
25133
  id: entry.id,
24666
25134
  role: ctx.role ?? null,
24667
25135
  stage: entry.stage,
24668
25136
  minRole: entry.minRole ?? null,
24669
25137
  config: visibility
24670
- })).map((entry) => ({
25138
+ }));
25139
+ return ctx.publicExperience === "hosted_booking" ? arrangeBookingPageNav(visible) : arrangeWebsiteNav(visible, ctx.bookingsVisible === true);
25140
+ }
25141
+ function arrangeBookingPageNav(visible) {
25142
+ return bookingPageSurfaceOrder.flatMap((id) => {
25143
+ const entry = visible.find((candidate) => candidate.id === id);
25144
+ return entry ? [{
25145
+ kind: "link",
25146
+ id,
25147
+ label: bookingPageLabels[id] ?? entry.label
25148
+ }] : [];
25149
+ });
25150
+ }
25151
+ /** Website tools sit in one group beside bookings, so neither crowds the other. */
25152
+ function arrangeWebsiteNav(visible, bookingsVisible) {
25153
+ const links = visible.map((entry) => ({
24671
25154
  kind: "link",
24672
25155
  id: entry.id,
24673
- label: entry.id === "site.overview" && ctx.publicExperience === "hosted_booking" ? "Home" : entry.label
25156
+ label: entry.label
24674
25157
  }));
24675
25158
  const websiteLinks = links.filter((link$1) => websiteSurfaceIdSet.has(link$1.id));
24676
25159
  const otherLinks = links.filter((link$1) => !websiteSurfaceIdSet.has(link$1.id));
24677
25160
  if (!shouldGroupWebsiteLinks({
24678
- bookingsVisible: ctx.bookingsVisible,
25161
+ bookingsVisible,
24679
25162
  websiteLinks,
24680
25163
  otherLinks
24681
25164
  })) {
24682
25165
  return links;
24683
25166
  }
24684
- const leading = links.filter((link$1) => leadingSurfaceIdSet.has(link$1.id));
24685
- const rest = otherLinks.filter((link$1) => !leadingSurfaceIdSet.has(link$1.id));
25167
+ const [overview, ...rest] = otherLinks;
25168
+ const leading = overview?.id === "site.overview" ? [overview] : [];
25169
+ const trailing = overview?.id === "site.overview" ? rest : otherLinks;
24686
25170
  return [
24687
25171
  ...leading,
24688
- ...websiteLinks.length > 0 ? [{
25172
+ {
24689
25173
  kind: "group",
24690
25174
  id: "site.website",
24691
25175
  label: "Website",
24692
25176
  items: websiteLinks
24693
- }] : [],
24694
- ...rest
25177
+ },
25178
+ ...trailing
24695
25179
  ];
24696
25180
  }
24697
25181
 
@@ -25715,6 +26199,7 @@ function buildDashboardBookingsNavPlan(modules, ctx, catalogue) {
25715
26199
  label: "Events",
25716
26200
  items: modules.events ? [
25717
26201
  ...buildEventNavItems(catalogue),
26202
+ ...buildPageSectionsNavItems(ctx),
25718
26203
  {
25719
26204
  label: "Venues",
25720
26205
  destination: { kind: "venues" },
@@ -26066,6 +26551,23 @@ function buildEventNavItems(catalogue) {
26066
26551
  }] : []
26067
26552
  ];
26068
26553
  }
26554
+ /** Owners, admins and editors set up the sections every event page has. */
26555
+ function buildPageSectionsNavItems(ctx) {
26556
+ if (!ctx.pageSectionsAvailable || ctx.role === null) return [];
26557
+ if (SITE_ROLE_PERMISSION_LEVEL[ctx.role] < SITE_ROLE_PERMISSION_LEVEL.editor) return [];
26558
+ return [{
26559
+ label: "Page sections",
26560
+ destination: { kind: "events_page_sections" },
26561
+ keywords: [
26562
+ "page sections",
26563
+ "event page",
26564
+ "what to bring",
26565
+ "sections",
26566
+ "event template",
26567
+ "faq"
26568
+ ]
26569
+ }];
26570
+ }
26069
26571
  function buildEventSeriesPresetNavItem(entry) {
26070
26572
  return {
26071
26573
  label: entry.pluralLabel,
@@ -27678,24 +28180,24 @@ const collectLocalMediaReferences = (content) => {
27678
28180
  const mediaReferences = [];
27679
28181
  const richTextReferences = [];
27680
28182
  const warnings = [];
27681
- const errors = [];
28183
+ const errors$1 = [];
27682
28184
  const locationsByIdentifier = new Map();
27683
28185
  walkLocalContentMedia(content, (value, location) => {
27684
28186
  const rawIdentifier = typeof value.identifier === "string" ? value.identifier : "";
27685
28187
  const hasLegacyRef = Boolean(value.assetId || value.storagePath || value.src);
27686
28188
  if (!rawIdentifier) {
27687
28189
  if (hasLegacyRef) {
27688
- errors.push(`Media reference at ${location} is missing identifier.`);
28190
+ errors$1.push(`Media reference at ${location} is missing identifier.`);
27689
28191
  }
27690
28192
  return;
27691
28193
  }
27692
28194
  if (/[./\\]/.test(rawIdentifier)) {
27693
- errors.push(`Media identifier "${rawIdentifier}" at ${location} must not include an extension.`);
28195
+ errors$1.push(`Media identifier "${rawIdentifier}" at ${location} must not include an extension.`);
27694
28196
  return;
27695
28197
  }
27696
28198
  const normalized = normalizeMediaIdentifierInput(rawIdentifier);
27697
28199
  if (!normalized) {
27698
- errors.push(`Media identifier "${rawIdentifier}" at ${location} is invalid.`);
28200
+ errors$1.push(`Media identifier "${rawIdentifier}" at ${location} is invalid.`);
27699
28201
  return;
27700
28202
  }
27701
28203
  if (normalized !== rawIdentifier) {
@@ -27718,17 +28220,17 @@ const collectLocalMediaReferences = (content) => {
27718
28220
  const rawSrc = typeof attrs.src === "string" ? attrs.src : "";
27719
28221
  if (!rawIdentifier) {
27720
28222
  if (rawSrc) {
27721
- errors.push(`Rich text image at ${node.location} is missing identifier.`);
28223
+ errors$1.push(`Rich text image at ${node.location} is missing identifier.`);
27722
28224
  }
27723
28225
  continue;
27724
28226
  }
27725
28227
  if (/[./\\]/.test(rawIdentifier)) {
27726
- errors.push(`Rich text image identifier "${rawIdentifier}" at ${node.location} must not include an extension.`);
28228
+ errors$1.push(`Rich text image identifier "${rawIdentifier}" at ${node.location} must not include an extension.`);
27727
28229
  continue;
27728
28230
  }
27729
28231
  const normalized = normalizeMediaIdentifierInput(rawIdentifier);
27730
28232
  if (!normalized) {
27731
- errors.push(`Rich text image identifier "${rawIdentifier}" at ${node.location} is invalid.`);
28233
+ errors$1.push(`Rich text image identifier "${rawIdentifier}" at ${node.location} is invalid.`);
27732
28234
  continue;
27733
28235
  }
27734
28236
  if (normalized !== rawIdentifier) {
@@ -27750,7 +28252,7 @@ const collectLocalMediaReferences = (content) => {
27750
28252
  mediaReferences,
27751
28253
  richTextReferences,
27752
28254
  warnings,
27753
- errors,
28255
+ errors: errors$1,
27754
28256
  locationsByIdentifier
27755
28257
  };
27756
28258
  };
@@ -27759,8 +28261,8 @@ const buildLocationNote = (locationsByIdentifier, identifier) => {
27759
28261
  return locations?.length ? ` Referenced at: ${locations.join(", ")}.` : "";
27760
28262
  };
27761
28263
  const locationsForIdentifier = (locationsByIdentifier, identifier) => locationsByIdentifier.get(identifier) ?? [];
27762
- const operationPriority = (operation) => {
27763
- switch (operation.kind) {
28264
+ const operationPriority = (operation$1) => {
28265
+ switch (operation$1.kind) {
27764
28266
  case "upload": return 0;
27765
28267
  case "conflict":
27766
28268
  case "missing_local_file":
@@ -28293,7 +28795,7 @@ const chooseRichTextIdentifierBase = (location, src) => {
28293
28795
  //#region src/media/push-preparation-reads.ts
28294
28796
  const readMediaManifestAndLocalFiles = async (options) => {
28295
28797
  const manifest = options.manifest ?? await readMediaManifest(options.contentDir);
28296
- const errors = [];
28798
+ const errors$1 = [];
28297
28799
  const localFiles = new Map();
28298
28800
  for (const identifier of options.identifiers) {
28299
28801
  try {
@@ -28301,14 +28803,14 @@ const readMediaManifestAndLocalFiles = async (options) => {
28301
28803
  localFiles.set(identifier, localFile);
28302
28804
  } catch (error) {
28303
28805
  const message = error instanceof Error ? error.message : String(error);
28304
- errors.push(`Failed to load media file for "${identifier}": ${message}`);
28806
+ errors$1.push(`Failed to load media file for "${identifier}": ${message}`);
28305
28807
  localFiles.set(identifier, null);
28306
28808
  }
28307
28809
  }
28308
28810
  return {
28309
28811
  manifest,
28310
28812
  localFiles,
28311
- errors
28813
+ errors: errors$1
28312
28814
  };
28313
28815
  };
28314
28816
  const resolveMediaAssets = async (client, identifiers) => {
@@ -28442,7 +28944,7 @@ const normalizeRichTextIdentifiers = (options) => {
28442
28944
  const planRichTextImageImports = (options) => {
28443
28945
  const operations = [];
28444
28946
  const warnings = [];
28445
- const errors = options.imports.failures.map((failure) => `Failed to import rich text image @ ${failure.location}: ${failure.error}`);
28947
+ const errors$1 = options.imports.failures.map((failure) => `Failed to import rich text image @ ${failure.location}: ${failure.error}`);
28446
28948
  const preparedIdentifiers = new Set();
28447
28949
  const locationsByIdentifier = new Map();
28448
28950
  const checksumAssetsByChecksum = new Map();
@@ -28450,7 +28952,7 @@ const planRichTextImageImports = (options) => {
28450
28952
  content: options.content,
28451
28953
  existingIdentifiers: options.existingIdentifiers,
28452
28954
  warnings,
28453
- errors,
28955
+ errors: errors$1,
28454
28956
  locationsByIdentifier
28455
28957
  });
28456
28958
  for (const imported of options.imports.successful) {
@@ -28492,7 +28994,7 @@ const planRichTextImageImports = (options) => {
28492
28994
  }
28493
28995
  return {
28494
28996
  operations,
28495
- errors,
28997
+ errors: errors$1,
28496
28998
  warnings,
28497
28999
  preparedIdentifiers,
28498
29000
  locationsByIdentifier,
@@ -28599,9 +29101,9 @@ const assetsForPushMediaPlan = (options) => {
28599
29101
  observationsByAssetId.set(asset.id, asset);
28600
29102
  }
28601
29103
  }
28602
- for (const operation of options.operations) {
28603
- if (operation.kind === "unchanged" || operation.kind === "reused") {
28604
- addAsset(assetsByIdentifier, operation.identifier, operation.asset);
29104
+ for (const operation$1 of options.operations) {
29105
+ if (operation$1.kind === "unchanged" || operation$1.kind === "reused") {
29106
+ addAsset(assetsByIdentifier, operation$1.identifier, operation$1.asset);
28605
29107
  continue;
28606
29108
  }
28607
29109
  }
@@ -28643,7 +29145,7 @@ const appendClassification = (options) => {
28643
29145
  const selectPushReferences = (options) => {
28644
29146
  const collected = collectLocalMediaReferences(options.content);
28645
29147
  const warnings = [...options.richTextPlan.warnings, ...collected.warnings];
28646
- const errors = [...options.richTextPlan.errors, ...collected.errors];
29148
+ const errors$1 = [...options.richTextPlan.errors, ...collected.errors];
28647
29149
  const locationsByIdentifier = new Map();
28648
29150
  mergeRichTextLocations(locationsByIdentifier, options.richTextPlan.locationsByIdentifier);
28649
29151
  mergeRichTextLocations(locationsByIdentifier, collected.locationsByIdentifier);
@@ -28665,7 +29167,7 @@ const selectPushReferences = (options) => {
28665
29167
  identifiers,
28666
29168
  locationsByIdentifier,
28667
29169
  warnings,
28668
- errors,
29170
+ errors: errors$1,
28669
29171
  summary: emptyPushSummary(references.length, identifiers.length)
28670
29172
  };
28671
29173
  };
@@ -28675,7 +29177,7 @@ const prepareLocalReferenceOperations = async (options) => {
28675
29177
  identifiers: options.selection.identifiers,
28676
29178
  manifest: options.manifest
28677
29179
  });
28678
- const errors = [...loaded.errors];
29180
+ const errors$1 = [...loaded.errors];
28679
29181
  const warnings = [];
28680
29182
  const resolved = await resolveMediaAssets(options.prepare.client, options.selection.identifiers);
28681
29183
  const initialAssets = initialAssetMap(resolved.assetsByIdentifier);
@@ -28706,15 +29208,15 @@ const prepareLocalReferenceOperations = async (options) => {
28706
29208
  classification,
28707
29209
  manifest: options.manifest,
28708
29210
  operations,
28709
- errors,
29211
+ errors: errors$1,
28710
29212
  warnings
28711
29213
  });
28712
29214
  }
28713
29215
  const sortedOperations = sortOperations(operations);
28714
29216
  const localChecksums = localFileChecksums(options.selection.identifiers, loaded.localFiles);
28715
- for (const operation of sortedOperations) {
28716
- if ("file" in operation && operation.file) {
28717
- localChecksums.set(operation.identifier, operation.file.checksum);
29217
+ for (const operation$1 of sortedOperations) {
29218
+ if ("file" in operation$1 && operation$1.file) {
29219
+ localChecksums.set(operation$1.identifier, operation$1.file.checksum);
28718
29220
  }
28719
29221
  }
28720
29222
  const checksumAssetsByChecksum = new Map(options.richTextPlan.checksumAssetsByChecksum);
@@ -28723,7 +29225,7 @@ const prepareLocalReferenceOperations = async (options) => {
28723
29225
  }
28724
29226
  return {
28725
29227
  operations: sortedOperations,
28726
- errors,
29228
+ errors: errors$1,
28727
29229
  warnings,
28728
29230
  mediaReadSet: buildMediaReadSet({
28729
29231
  identifiers: options.selection.identifiers,
@@ -28894,10 +29396,10 @@ const makeReport = (params) => {
28894
29396
  missingIdentifiers
28895
29397
  };
28896
29398
  };
28897
- const reportForOperation = (operation, status, targetEnv, message, failureKind, rawError) => {
28898
- const file = "file" in operation ? operation.file : undefined;
29399
+ const reportForOperation = (operation$1, status, targetEnv, message, failureKind, rawError) => {
29400
+ const file = "file" in operation$1 ? operation$1.file : undefined;
28899
29401
  return {
28900
- identifier: operation.identifier,
29402
+ identifier: operation$1.identifier,
28901
29403
  status,
28902
29404
  targetEnv,
28903
29405
  ...file ? {
@@ -28905,40 +29407,40 @@ const reportForOperation = (operation, status, targetEnv, message, failureKind,
28905
29407
  sizeBytes: file.dataLength,
28906
29408
  mimeType: file.mimeType
28907
29409
  } : {},
28908
- locations: operation.locations,
29410
+ locations: operation$1.locations,
28909
29411
  message,
28910
29412
  failureKind,
28911
29413
  rawError
28912
29414
  };
28913
29415
  };
28914
- const applySimpleMediaOperation = (operation, state, targetEnv) => {
28915
- switch (operation.kind) {
29416
+ const applySimpleMediaOperation = (operation$1, state, targetEnv) => {
29417
+ switch (operation$1.kind) {
28916
29418
  case "unchanged":
28917
- state.assetsByIdentifier.set(operation.identifier, operation.asset);
29419
+ state.assetsByIdentifier.set(operation$1.identifier, operation$1.asset);
28918
29420
  state.summary.resolved += 1;
28919
- state.reportItems.push(reportForOperation(operation, "resolved", targetEnv));
29421
+ state.reportItems.push(reportForOperation(operation$1, "resolved", targetEnv));
28920
29422
  return;
28921
29423
  case "reused":
28922
- state.assetsByIdentifier.set(operation.identifier, operation.asset);
29424
+ state.assetsByIdentifier.set(operation$1.identifier, operation$1.asset);
28923
29425
  state.summary.resolved += 1;
28924
29426
  state.summary.reused += 1;
28925
- state.reportItems.push(reportForOperation(operation, "reused", targetEnv, "Reused existing CMS asset with matching identifier and checksum."));
29427
+ state.reportItems.push(reportForOperation(operation$1, "reused", targetEnv, "Reused existing CMS asset with matching identifier and checksum."));
28926
29428
  return;
28927
29429
  case "skipped":
28928
29430
  state.summary.skipped += 1;
28929
- state.reportItems.push(reportForOperation(operation, "skipped", targetEnv, operation.message));
29431
+ state.reportItems.push(reportForOperation(operation$1, "skipped", targetEnv, operation$1.message));
28930
29432
  return;
28931
29433
  case "missing_local_file":
28932
- state.reportItems.push(reportForOperation(operation, "missing_local_file", targetEnv, operation.message));
29434
+ state.reportItems.push(reportForOperation(operation$1, "missing_local_file", targetEnv, operation$1.message));
28933
29435
  return;
28934
29436
  case "conflict":
28935
- state.reportItems.push(reportForOperation(operation, "failed", targetEnv, operation.message, "unknown"));
29437
+ state.reportItems.push(reportForOperation(operation$1, "failed", targetEnv, operation$1.message, "unknown"));
28936
29438
  return;
28937
- default: return assertNever(operation);
29439
+ default: return assertNever(operation$1);
28938
29440
  }
28939
29441
  };
28940
- const applyUpload = async (operation, context, state) => {
28941
- const pendingItem = reportForOperation(operation, "pending_upload", context.targetEnv);
29442
+ const applyUpload = async (operation$1, context, state) => {
29443
+ const pendingItem = reportForOperation(operation$1, "pending_upload", context.targetEnv);
28942
29444
  if (context.dryRun) {
28943
29445
  state.summary.pendingUploads += 1;
28944
29446
  state.reportItems.push(pendingItem);
@@ -28950,15 +29452,15 @@ const applyUpload = async (operation, context, state) => {
28950
29452
  });
28951
29453
  try {
28952
29454
  const result = await context.client.media.upload({
28953
- data: Buffer.from(operation.file.dataBase64, "base64"),
28954
- filename: operation.file.filename,
28955
- contentType: operation.file.mimeType,
28956
- identifier: operation.identifier
29455
+ data: Buffer.from(operation$1.file.dataBase64, "base64"),
29456
+ filename: operation$1.file.filename,
29457
+ contentType: operation$1.file.mimeType,
29458
+ identifier: operation$1.identifier
28957
29459
  });
28958
- state.uploadedIdentifiers.push(operation.identifier);
29460
+ state.uploadedIdentifiers.push(operation$1.identifier);
28959
29461
  if (result.status === "created") state.summary.uploaded += 1;
28960
29462
  state.summary.resolved += 1;
28961
- const uploadedItem = reportForOperation(operation, "uploaded", context.targetEnv, result.status === "created" ? "Uploaded local media file." : "CMS reported media already exists.");
29463
+ const uploadedItem = reportForOperation(operation$1, "uploaded", context.targetEnv, result.status === "created" ? "Uploaded local media file." : "CMS reported media already exists.");
28962
29464
  state.reportItems.push(uploadedItem);
28963
29465
  context.onEvent?.({
28964
29466
  type: "upload_succeeded",
@@ -28966,28 +29468,28 @@ const applyUpload = async (operation, context, state) => {
28966
29468
  });
28967
29469
  } catch (error) {
28968
29470
  const message = rawErrorMessage$1(error);
28969
- const failedItem = reportForOperation(operation, "failed", context.targetEnv, `Failed to upload "${operation.identifier}": ${message}`, classifyLocalMediaUploadFailure(error), message);
29471
+ const failedItem = reportForOperation(operation$1, "failed", context.targetEnv, `Failed to upload "${operation$1.identifier}": ${message}`, classifyLocalMediaUploadFailure(error), message);
28970
29472
  state.reportItems.push(failedItem);
28971
- state.errors.push(`Failed to upload "${operation.identifier}" (${operation.file.filename}, ${operation.file.mimeType}): ${message}`);
29473
+ state.errors.push(`Failed to upload "${operation$1.identifier}" (${operation$1.file.filename}, ${operation$1.file.mimeType}): ${message}`);
28972
29474
  context.onEvent?.({
28973
29475
  type: "upload_failed",
28974
29476
  item: failedItem
28975
29477
  });
28976
29478
  }
28977
29479
  };
28978
- const applyMediaOperation = async (operation, context, state) => {
28979
- switch (operation.kind) {
29480
+ const applyMediaOperation = async (operation$1, context, state) => {
29481
+ switch (operation$1.kind) {
28980
29482
  case "unchanged":
28981
29483
  case "reused":
28982
29484
  case "skipped":
28983
29485
  case "missing_local_file":
28984
29486
  case "conflict":
28985
- applySimpleMediaOperation(operation, state, context.targetEnv);
29487
+ applySimpleMediaOperation(operation$1, state, context.targetEnv);
28986
29488
  return;
28987
29489
  case "upload":
28988
- await applyUpload(operation, context, state);
29490
+ await applyUpload(operation$1, context, state);
28989
29491
  return;
28990
- default: return assertNever(operation);
29492
+ default: return assertNever(operation$1);
28991
29493
  }
28992
29494
  };
28993
29495
  const createApplyState = (plan) => ({
@@ -28998,8 +29500,8 @@ const createApplyState = (plan) => ({
28998
29500
  uploadedIdentifiers: []
28999
29501
  });
29000
29502
  const applyMediaOperations = async (operations, context, state) => {
29001
- for (const operation of operations) {
29002
- await applyMediaOperation(operation, context, state);
29503
+ for (const operation$1 of operations) {
29504
+ await applyMediaOperation(operation$1, context, state);
29003
29505
  }
29004
29506
  };
29005
29507
  const resolveUploadedAssets = async (state, client, dryRun) => {
@@ -29016,9 +29518,9 @@ const resolveUploadedAssets = async (state, client, dryRun) => {
29016
29518
  };
29017
29519
  const fileByIdentifier = (operations) => {
29018
29520
  const files = new Map();
29019
- for (const operation of operations) {
29020
- if ("file" in operation && !files.has(operation.identifier)) {
29021
- files.set(operation.identifier, operation.file);
29521
+ for (const operation$1 of operations) {
29522
+ if ("file" in operation$1 && !files.has(operation$1.identifier)) {
29523
+ files.set(operation$1.identifier, operation$1.file);
29022
29524
  }
29023
29525
  }
29024
29526
  return files;
@@ -30951,12 +31453,12 @@ const CREATE_UPDATE_OPERATIONS = [{
30951
31453
  marker: "~"
30952
31454
  }];
30953
31455
  function appendOperationSections$1(lines, category, diffs, operations, formatItem, formatDetails) {
30954
- for (const operation of operations) {
30955
- const matchingDiffs = diffs.filter((diff) => diff.type === operation.type);
31456
+ for (const operation$1 of operations) {
31457
+ const matchingDiffs = diffs.filter((diff) => diff.type === operation$1.type);
30956
31458
  if (matchingDiffs.length === 0) continue;
30957
- lines.push(`\n${category} (${operation.label}):`);
31459
+ lines.push(`\n${category} (${operation$1.label}):`);
30958
31460
  for (const diff of matchingDiffs) {
30959
- lines.push(` ${operation.marker} ${formatItem(diff)}`);
31461
+ lines.push(` ${operation$1.marker} ${formatItem(diff)}`);
30960
31462
  if (formatDetails) lines.push(...formatDetails(diff));
30961
31463
  }
30962
31464
  }
@@ -31229,11 +31731,11 @@ const CREATE_UPDATE_DELETE_DETAIL_OPERATIONS = [...CREATE_UPDATE_DETAIL_OPERATIO
31229
31731
  marker: "-"
31230
31732
  }];
31231
31733
  function appendOperationSections(lines, category, diffs, operations, formatItem) {
31232
- for (const operation of operations) {
31233
- const matchingDiffs = diffs.filter((diff) => diff.type === operation.type);
31734
+ for (const operation$1 of operations) {
31735
+ const matchingDiffs = diffs.filter((diff) => diff.type === operation$1.type);
31234
31736
  if (matchingDiffs.length === 0) continue;
31235
- lines.push(`\n${category} (${operation.label}):`);
31236
- for (const diff of matchingDiffs) lines.push(` ${operation.marker} ${formatItem(diff)}`);
31737
+ lines.push(`\n${category} (${operation$1.label}):`);
31738
+ for (const diff of matchingDiffs) lines.push(` ${operation$1.marker} ${formatItem(diff)}`);
31237
31739
  }
31238
31740
  }
31239
31741
  function formatIdentifierDetail(identifier, changes) {
@@ -31868,8 +32370,8 @@ function createCliCommandBatchRef(input) {
31868
32370
  slugPart(input.siteId) || "unnamed"
31869
32371
  ].join(":");
31870
32372
  }
31871
- function formatSiteCommandValidationErrors(errors) {
31872
- return errors.map((error) => error.message).join("\n");
32373
+ function formatSiteCommandValidationErrors(errors$1) {
32374
+ return errors$1.map((error) => error.message).join("\n");
31873
32375
  }
31874
32376
  function isRecord(value) {
31875
32377
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
@@ -31939,7 +32441,7 @@ function planCliCommandBatchForTypes(input) {
31939
32441
  const exposure = batch.commands.length === 0 ? null : evaluateCliBatchExposure(batch, input.exposure ?? "sdk_cli", input.targetEnv);
31940
32442
  if (exposure !== null && exposure.kind !== "allowed") {
31941
32443
  const commandIndex = exposure.commandType === null ? 0 : batch.commands.findIndex((command) => command.type === exposure.commandType && (exposure.commandRef === null || command.ref === exposure.commandRef));
31942
- const errors = [{
32444
+ const errors$1 = [{
31943
32445
  code: "invalid_command_payload",
31944
32446
  commandIndex: Math.max(commandIndex, 0),
31945
32447
  commandType: exposure.commandType,
@@ -31948,7 +32450,7 @@ function planCliCommandBatchForTypes(input) {
31948
32450
  }];
31949
32451
  return err({
31950
32452
  code: "command_validation_failed",
31951
- errors,
32453
+ errors: errors$1,
31952
32454
  message: exposure.message
31953
32455
  });
31954
32456
  }