riverbankcms 0.30.1 → 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.
- package/dist/acceptance/matrix.mjs +3 -3
- package/dist/cli/index.mjs +5952 -4855
- package/dist/cli/init-docs/content/cli-reference.md +14 -0
- package/dist/{entryCommands-BdWO_ZfG.mjs → entryCommands-CYEpLRXI.mjs} +1079 -477
- package/dist/{eventUpsertInputSchema-u-IyFUEF.mjs → eventUpsertInputSchema-CGmm5o_I.mjs} +3015 -2103
- package/dist/load-config-B_kPvIxz.mjs +4 -0
- package/dist/{load-config-C4powIPE.mjs → load-config-DIyqYeRP.mjs} +4 -4
- package/dist/{plan-AJDYca86.mjs → plan-D5NfiRLe.mjs} +1 -1
- package/dist/scaffold/index.mjs +2 -2
- package/dist/{sdk-event-upsert-RMUvPiD5.mjs → sdk-event-upsert-0U4hsDpo.mjs} +33 -17
- package/dist/{src-BntuEwG8.mjs → src-exrglXYU.mjs} +450 -47
- package/dist/testing.mjs +4 -4
- package/package.json +3 -3
- package/dist/load-config-BqyywgbJ.mjs +0 -4
|
@@ -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-
|
|
3
|
-
import {
|
|
4
|
-
import { n as CliSdkPeerError, t as loadConfigFile } from "./load-config-
|
|
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
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
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
|
-
...
|
|
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",
|
|
@@ -1805,102 +2216,6 @@ const APPOINTMENT_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
|
|
|
1805
2216
|
responseKind: "json",
|
|
1806
2217
|
errors: ["resource:not_found", "server:internal_error"]
|
|
1807
2218
|
},
|
|
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",
|
|
1883
|
-
auth: "user",
|
|
1884
|
-
responseKind: "json",
|
|
1885
|
-
errors: [
|
|
1886
|
-
"validation:invalid_input",
|
|
1887
|
-
"resource:not_found",
|
|
1888
|
-
"resource:conflict",
|
|
1889
|
-
"server:internal_error"
|
|
1890
|
-
]
|
|
1891
|
-
},
|
|
1892
|
-
createAppointmentReservationRun: {
|
|
1893
|
-
path: "/sites/{siteId}/bookings/appointment-reservations/{reservationId}/runs",
|
|
1894
|
-
method: "POST",
|
|
1895
|
-
auth: "user",
|
|
1896
|
-
responseKind: "json",
|
|
1897
|
-
errors: [
|
|
1898
|
-
"validation:invalid_input",
|
|
1899
|
-
"resource:not_found",
|
|
1900
|
-
"resource:conflict",
|
|
1901
|
-
"server:internal_error"
|
|
1902
|
-
]
|
|
1903
|
-
},
|
|
1904
2219
|
createTeamMemberProfile: {
|
|
1905
2220
|
path: "/sites/{siteId}/bookings/resources/{resourceId}/profile",
|
|
1906
2221
|
method: "POST",
|
|
@@ -2367,6 +2682,30 @@ const APPOINTMENT_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
|
|
|
2367
2682
|
"server:internal_error"
|
|
2368
2683
|
]
|
|
2369
2684
|
},
|
|
2685
|
+
refundAppointment: {
|
|
2686
|
+
path: "/sites/{siteId}/bookings/appointments/{appointmentId}/refund",
|
|
2687
|
+
method: "POST",
|
|
2688
|
+
auth: "user",
|
|
2689
|
+
responseKind: "json",
|
|
2690
|
+
errors: [
|
|
2691
|
+
"validation:invalid_input",
|
|
2692
|
+
"resource:not_found",
|
|
2693
|
+
"auth:forbidden",
|
|
2694
|
+
"resource:conflict",
|
|
2695
|
+
"server:internal_error"
|
|
2696
|
+
]
|
|
2697
|
+
},
|
|
2698
|
+
listAppointmentRefunds: {
|
|
2699
|
+
path: "/sites/{siteId}/bookings/appointments/{appointmentId}/refunds",
|
|
2700
|
+
method: "GET",
|
|
2701
|
+
auth: "user",
|
|
2702
|
+
responseKind: "json",
|
|
2703
|
+
errors: [
|
|
2704
|
+
"resource:not_found",
|
|
2705
|
+
"auth:forbidden",
|
|
2706
|
+
"server:internal_error"
|
|
2707
|
+
]
|
|
2708
|
+
},
|
|
2370
2709
|
setAppointmentNoShow: {
|
|
2371
2710
|
path: "/sites/{siteId}/bookings/appointments/{appointmentId}/no-show",
|
|
2372
2711
|
method: "POST",
|
|
@@ -2973,8 +3312,8 @@ const NEWSLETTER_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
|
|
|
2973
3312
|
tags: [TAG_TEMPLATES.site, TAG_TEMPLATES.siteNewsletter],
|
|
2974
3313
|
errors: []
|
|
2975
3314
|
},
|
|
2976
|
-
|
|
2977
|
-
path: "/sites/{siteId}/newsletter/campaigns/{campaignId}/
|
|
3315
|
+
resolveNewsletterCampaignDraft: {
|
|
3316
|
+
path: "/sites/{siteId}/newsletter/campaigns/{campaignId}/resolve-draft",
|
|
2978
3317
|
method: "POST",
|
|
2979
3318
|
auth: "user",
|
|
2980
3319
|
responseKind: "json",
|
|
@@ -3191,6 +3530,54 @@ const SDK_APPOINTMENT_SERVICE_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
|
|
|
3191
3530
|
}
|
|
3192
3531
|
});
|
|
3193
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
|
+
|
|
3194
3581
|
//#endregion
|
|
3195
3582
|
//#region ../api/src/sdkPageDesignEndpointDefinitions.ts
|
|
3196
3583
|
/**
|
|
@@ -4054,50 +4441,52 @@ function rankCheckoutAutoDiscountCandidates(candidates) {
|
|
|
4054
4441
|
});
|
|
4055
4442
|
}
|
|
4056
4443
|
function toCheckoutDiscountContextCandidate(source) {
|
|
4444
|
+
const context = checkoutDiscountContext(source);
|
|
4445
|
+
return {
|
|
4446
|
+
identityKey: checkoutDiscountContextIdentity(context),
|
|
4447
|
+
context
|
|
4448
|
+
};
|
|
4449
|
+
}
|
|
4450
|
+
function checkoutDiscountContextIdentity(context) {
|
|
4451
|
+
switch (context.type) {
|
|
4452
|
+
case "event": return `event:${context.eventSeriesId}`;
|
|
4453
|
+
case "whole_series": return `whole-series:${context.eventSeriesId}`;
|
|
4454
|
+
case "product": return `product:${context.productId}`;
|
|
4455
|
+
case "pass": return `pass:${context.passId}`;
|
|
4456
|
+
case "appointment": return `appointment:${context.serviceId}`;
|
|
4457
|
+
}
|
|
4458
|
+
}
|
|
4459
|
+
function checkoutDiscountContext(source) {
|
|
4057
4460
|
switch (source.type) {
|
|
4058
4461
|
case "event_ticket": return {
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4462
|
+
type: "event",
|
|
4463
|
+
eventSeriesId: source.eventSeries.id,
|
|
4464
|
+
eventCategoryId: source.eventSeries.eventCategoryId,
|
|
4465
|
+
ticketsCount: source.ticketCount
|
|
4466
|
+
};
|
|
4467
|
+
case "whole_series_enrollment": return {
|
|
4468
|
+
type: "whole_series",
|
|
4469
|
+
eventSeriesId: source.eventSeries.id,
|
|
4470
|
+
eventCategoryId: source.eventSeries.eventCategoryId,
|
|
4471
|
+
ticketsCount: source.participantCount
|
|
4066
4472
|
};
|
|
4067
4473
|
case "product": return {
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
productId: source.productId,
|
|
4072
|
-
productCategoryId: source.product.productCategoryId ?? null
|
|
4073
|
-
}
|
|
4474
|
+
type: "product",
|
|
4475
|
+
productId: source.productId,
|
|
4476
|
+
productCategoryId: source.product.productCategoryId
|
|
4074
4477
|
};
|
|
4075
4478
|
case "pass": return {
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
type: "pass",
|
|
4079
|
-
passId: source.passId
|
|
4080
|
-
}
|
|
4081
|
-
};
|
|
4082
|
-
case "whole_series_enrollment": return {
|
|
4083
|
-
identityKey: `whole-series:${source.eventSeries.id}`,
|
|
4084
|
-
context: {
|
|
4085
|
-
type: "whole_series",
|
|
4086
|
-
eventSeriesId: source.eventSeries.id,
|
|
4087
|
-
eventCategoryId: source.eventSeries.eventCategoryId
|
|
4088
|
-
}
|
|
4479
|
+
type: "pass",
|
|
4480
|
+
passId: source.passId
|
|
4089
4481
|
};
|
|
4090
4482
|
case "appointment": return {
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
type: "appointment",
|
|
4094
|
-
serviceId: source.serviceId
|
|
4095
|
-
}
|
|
4483
|
+
type: "appointment",
|
|
4484
|
+
serviceId: source.serviceId
|
|
4096
4485
|
};
|
|
4097
4486
|
}
|
|
4098
4487
|
}
|
|
4099
4488
|
function mergeCheckoutDiscountContexts(existing, next) {
|
|
4100
|
-
if (existing.type === "event" && next.type === "event") {
|
|
4489
|
+
if (existing.type === "event" && next.type === "event" || existing.type === "whole_series" && next.type === "whole_series") {
|
|
4101
4490
|
return {
|
|
4102
4491
|
...existing,
|
|
4103
4492
|
ticketsCount: (existing.ticketsCount ?? 0) + (next.ticketsCount ?? 0)
|
|
@@ -4672,21 +5061,6 @@ function mapLineSettlementError(error) {
|
|
|
4672
5061
|
}
|
|
4673
5062
|
}
|
|
4674
5063
|
|
|
4675
|
-
//#endregion
|
|
4676
|
-
//#region ../commerce/src/purchase/checkoutStripeFinalizationPlanning.ts
|
|
4677
|
-
function planCheckoutStripeSessionRecordUpdates(options) {
|
|
4678
|
-
const record = (target) => ({
|
|
4679
|
-
target,
|
|
4680
|
-
orderId: options.orderId,
|
|
4681
|
-
sessionId: options.sessionId
|
|
4682
|
-
});
|
|
4683
|
-
switch (options.paymentPlanKind) {
|
|
4684
|
-
case "stripe": return [];
|
|
4685
|
-
case "instalment_plan": return [record("order_payment_plan")];
|
|
4686
|
-
case "flexible_balance": return [record("flexible_balance_contract")];
|
|
4687
|
-
}
|
|
4688
|
-
}
|
|
4689
|
-
|
|
4690
5064
|
//#endregion
|
|
4691
5065
|
//#region ../commerce/src/purchase/checkoutStripeSessionPlanning.ts
|
|
4692
5066
|
function planCheckoutStripeSessionRequest(options) {
|
|
@@ -4875,6 +5249,13 @@ function planFirstPaymentLineItem(options) {
|
|
|
4875
5249
|
quantity: 1
|
|
4876
5250
|
}]);
|
|
4877
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
|
+
}
|
|
4878
5259
|
|
|
4879
5260
|
//#endregion
|
|
4880
5261
|
//#region ../commerce/src/purchase/checkoutSessionMetadata.ts
|
|
@@ -4887,6 +5268,17 @@ const datedOfferingSharedEngineMetadataShape = {
|
|
|
4887
5268
|
eventSeriesId: z.string().uuid()
|
|
4888
5269
|
};
|
|
4889
5270
|
const DatedOfferingSharedEngineMetadataSchema = z.object(datedOfferingSharedEngineMetadataShape);
|
|
5271
|
+
const ORDER_PAYMENT_REASONS = [
|
|
5272
|
+
"order_balance",
|
|
5273
|
+
"instalment_payoff",
|
|
5274
|
+
"flexible_balance_initial",
|
|
5275
|
+
"flexible_balance_paydown"
|
|
5276
|
+
];
|
|
5277
|
+
/** Admit a session's payment reason; anything unrecognised is a new purchase. */
|
|
5278
|
+
function parseOrderPaymentReason(value) {
|
|
5279
|
+
const parsed = z.enum(ORDER_PAYMENT_REASONS).safeParse(value);
|
|
5280
|
+
return parsed.success ? parsed.data : undefined;
|
|
5281
|
+
}
|
|
4890
5282
|
const orderCheckoutSessionMetadataBaseShape = {
|
|
4891
5283
|
type: z.literal("order"),
|
|
4892
5284
|
site_id: z.string().uuid(),
|
|
@@ -4905,11 +5297,7 @@ const orderCheckoutSessionMetadataBaseShape = {
|
|
|
4905
5297
|
credit_reservation_id: z.string().uuid().optional(),
|
|
4906
5298
|
credit_reserved_cents: z.string().optional(),
|
|
4907
5299
|
discount_code_amount_cents: z.string().optional(),
|
|
4908
|
-
order_payment_reason: z.enum(
|
|
4909
|
-
"instalment_payoff",
|
|
4910
|
-
"flexible_balance_initial",
|
|
4911
|
-
"flexible_balance_paydown"
|
|
4912
|
-
]).optional(),
|
|
5300
|
+
order_payment_reason: z.enum(ORDER_PAYMENT_REASONS).optional(),
|
|
4913
5301
|
order_payment_plan_id: z.string().uuid().optional(),
|
|
4914
5302
|
order_flexible_balance_contract_id: z.string().uuid().optional()
|
|
4915
5303
|
};
|
|
@@ -4947,18 +5335,13 @@ function failedDecision(options) {
|
|
|
4947
5335
|
remainingRefundableCents: options.input.remainingRefundableCents
|
|
4948
5336
|
};
|
|
4949
5337
|
}
|
|
5338
|
+
/** Check order matters: identity, saved result, pending/held capacity, then amount. */
|
|
4950
5339
|
function planCanonicalRefundRequest(input) {
|
|
4951
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) {
|
|
4952
5344
|
const existingByIdempotency = input.existingByIdempotency;
|
|
4953
|
-
if (requestedAmountCents <= 0) {
|
|
4954
|
-
return failedDecision({
|
|
4955
|
-
input,
|
|
4956
|
-
errorCode: "already_refunded",
|
|
4957
|
-
errorMessage: "No refundable amount remaining for this purchase.",
|
|
4958
|
-
refund: existingByIdempotency,
|
|
4959
|
-
amountCents: requestedAmountCents
|
|
4960
|
-
});
|
|
4961
|
-
}
|
|
4962
5345
|
if (existingByIdempotency && input.requestedAmountCents != null && existingByIdempotency.amountCents !== input.requestedAmountCents) {
|
|
4963
5346
|
return failedDecision({
|
|
4964
5347
|
input,
|
|
@@ -4977,15 +5360,10 @@ function planCanonicalRefundRequest(input) {
|
|
|
4977
5360
|
amountCents: existingByIdempotency.amountCents
|
|
4978
5361
|
});
|
|
4979
5362
|
}
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
errorMessage: "Pass revocation is only allowed when refunding the full remaining amount",
|
|
4985
|
-
amountCents: requestedAmountCents
|
|
4986
|
-
});
|
|
4987
|
-
}
|
|
4988
|
-
if (existingByIdempotency?.status === "succeeded") {
|
|
5363
|
+
return null;
|
|
5364
|
+
}
|
|
5365
|
+
function existingRefundOutcome(input, existingByIdempotency) {
|
|
5366
|
+
if (existingByIdempotency.status === "succeeded") {
|
|
4989
5367
|
return {
|
|
4990
5368
|
kind: "existing_succeeded",
|
|
4991
5369
|
refund: existingByIdempotency,
|
|
@@ -4993,30 +5371,15 @@ function planCanonicalRefundRequest(input) {
|
|
|
4993
5371
|
remainingRefundableCents: input.remainingRefundableCents
|
|
4994
5372
|
};
|
|
4995
5373
|
}
|
|
4996
|
-
if (existingByIdempotency
|
|
4997
|
-
|
|
4998
|
-
return failedDecision({
|
|
4999
|
-
input,
|
|
5000
|
-
errorCode: "refund_in_progress",
|
|
5001
|
-
errorMessage: "A refund is already being processed for this idempotency key",
|
|
5002
|
-
refund: existingByIdempotency,
|
|
5003
|
-
amountCents: existingByIdempotency.amountCents
|
|
5004
|
-
});
|
|
5005
|
-
}
|
|
5006
|
-
return {
|
|
5007
|
-
kind: "resume_pending",
|
|
5008
|
-
refund: existingByIdempotency,
|
|
5009
|
-
requestedAmountCents: existingByIdempotency.amountCents
|
|
5010
|
-
};
|
|
5011
|
-
}
|
|
5012
|
-
if (existingByIdempotency?.status === "reconciliation_needed") {
|
|
5374
|
+
if (existingByIdempotency.status === "pending") return pendingIdempotentRefundOutcome(input, existingByIdempotency);
|
|
5375
|
+
if (existingByIdempotency.status === "reconciliation_needed") {
|
|
5013
5376
|
return {
|
|
5014
5377
|
kind: "resume_pending",
|
|
5015
5378
|
refund: existingByIdempotency,
|
|
5016
5379
|
requestedAmountCents: existingByIdempotency.amountCents
|
|
5017
5380
|
};
|
|
5018
5381
|
}
|
|
5019
|
-
if (existingByIdempotency
|
|
5382
|
+
if (existingByIdempotency.status === "failed") {
|
|
5020
5383
|
return failedDecision({
|
|
5021
5384
|
input,
|
|
5022
5385
|
errorCode: "refund_failed",
|
|
@@ -5025,6 +5388,23 @@ function planCanonicalRefundRequest(input) {
|
|
|
5025
5388
|
amountCents: existingByIdempotency.amountCents
|
|
5026
5389
|
});
|
|
5027
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) {
|
|
5028
5408
|
if (input.latestPending) {
|
|
5029
5409
|
if (!input.latestPending.isStale) {
|
|
5030
5410
|
return failedDecision({
|
|
@@ -5041,6 +5421,37 @@ function planCanonicalRefundRequest(input) {
|
|
|
5041
5421
|
requestedAmountCents: input.latestPending.amountCents
|
|
5042
5422
|
};
|
|
5043
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
|
+
}
|
|
5044
5455
|
if (requestedAmountCents > input.remainingRefundableCents) {
|
|
5045
5456
|
return failedDecision({
|
|
5046
5457
|
input,
|
|
@@ -5412,12 +5823,31 @@ function hasOnlineOrderPaymentPath(input) {
|
|
|
5412
5823
|
if (input.position.outstandingCents === 0) return false;
|
|
5413
5824
|
switch (input.position.terms.kind) {
|
|
5414
5825
|
case "immediate": return input.paymentMethod === "stripe";
|
|
5415
|
-
case "manual": return
|
|
5416
|
-
case "flexible_balance": return
|
|
5417
|
-
|
|
5826
|
+
case "manual": return ["manual", "mixed"].includes(input.paymentMethod);
|
|
5827
|
+
case "flexible_balance": return [
|
|
5828
|
+
"manual",
|
|
5829
|
+
"stripe",
|
|
5830
|
+
"mixed"
|
|
5831
|
+
].includes(input.paymentMethod) && isSettleableFlexibleBalanceContractStatus(input.position.terms.status);
|
|
5832
|
+
case "instalment_plan": return ["stripe", "mixed"].includes(input.paymentMethod) && isSettleableOrderInstalmentPlanStatus(input.position.terms.status);
|
|
5418
5833
|
default: return assertNever$3(input.position.terms);
|
|
5419
5834
|
}
|
|
5420
5835
|
}
|
|
5836
|
+
/** Executable outstanding card-payment path. Connection readiness is checked by the effect shell. */
|
|
5837
|
+
function resolveOnlineOrderCheckoutMode(order) {
|
|
5838
|
+
if (order.status !== "pending" || order.commitState !== "committed" || order.balanceDueCents <= 0) return null;
|
|
5839
|
+
if (!hasOnlineOrderPaymentPath({
|
|
5840
|
+
position: order.paymentState,
|
|
5841
|
+
paymentMethod: order.paymentMethod
|
|
5842
|
+
})) return null;
|
|
5843
|
+
if (!("terms" in order.paymentState)) return null;
|
|
5844
|
+
switch (order.paymentState.terms.kind) {
|
|
5845
|
+
case "manual":
|
|
5846
|
+
case "immediate": return { kind: "immediate" };
|
|
5847
|
+
case "flexible_balance": return { kind: "flexible_balance" };
|
|
5848
|
+
case "instalment_plan": return { kind: "instalment_payoff" };
|
|
5849
|
+
}
|
|
5850
|
+
}
|
|
5421
5851
|
|
|
5422
5852
|
//#endregion
|
|
5423
5853
|
//#region ../commerce/src/purchase/confirmationPayment.ts
|
|
@@ -6233,6 +6663,7 @@ function planItem(item, input) {
|
|
|
6233
6663
|
warnings: [],
|
|
6234
6664
|
actions: [{
|
|
6235
6665
|
kind: "send_appointment_confirmation",
|
|
6666
|
+
orderId: item.orderId,
|
|
6236
6667
|
appointmentId: item.appointmentId
|
|
6237
6668
|
}]
|
|
6238
6669
|
} : {
|
|
@@ -6905,10 +7336,10 @@ function parseDatedOfferingOrderItemEngineMetadata(raw) {
|
|
|
6905
7336
|
eventSeriesId: eventSeriesId.value
|
|
6906
7337
|
});
|
|
6907
7338
|
}
|
|
6908
|
-
function
|
|
7339
|
+
function parseDatedOfferingDirectOrderItemEngineMetadata(raw) {
|
|
6909
7340
|
const customerId = parseCustomerId(raw.customerId);
|
|
6910
7341
|
const eventSeriesId = parseEventSeriesId(raw.eventSeriesId);
|
|
6911
|
-
if (raw.datedOfferingEngineContractVersion !== "shared_v1" || raw.datedOfferingEngineRouteKind !== "shared_whole_series_registration" || raw.datedOfferingEngineSettlementKind !== "non_cash_registration" || raw.datedOfferingCapacityHoldId != null || raw.datedOfferingCapacityHoldAuditRef != null) {
|
|
7342
|
+
if (raw.datedOfferingEngineContractVersion !== "shared_v1" || raw.datedOfferingEngineRouteKind !== "shared_whole_series_registration" || raw.datedOfferingEngineSettlementKind !== "non_cash_registration" && raw.datedOfferingEngineSettlementKind !== "staff_registration" || raw.datedOfferingCapacityHoldId != null || raw.datedOfferingCapacityHoldAuditRef != null) {
|
|
6912
7343
|
return err({ kind: "invalid_engine_contract" });
|
|
6913
7344
|
}
|
|
6914
7345
|
if (!customerId.ok) return err({
|
|
@@ -6924,7 +7355,7 @@ function parseDatedOfferingNonCashOrderItemEngineMetadata(raw) {
|
|
|
6924
7355
|
return ok({
|
|
6925
7356
|
datedOfferingEngineContractVersion: "shared_v1",
|
|
6926
7357
|
datedOfferingEngineRouteKind: "shared_whole_series_registration",
|
|
6927
|
-
datedOfferingEngineSettlementKind:
|
|
7358
|
+
datedOfferingEngineSettlementKind: raw.datedOfferingEngineSettlementKind,
|
|
6928
7359
|
customerId: customerId.value,
|
|
6929
7360
|
eventSeriesId: eventSeriesId.value
|
|
6930
7361
|
});
|
|
@@ -6936,8 +7367,8 @@ function parseOptionalDatedOfferingOrderItemEngineMetadata(raw) {
|
|
|
6936
7367
|
return retiredCourseId.ok ? ok({ courseId: retiredCourseId.value }) : err("Invalid historical whole-series order item metadata");
|
|
6937
7368
|
}
|
|
6938
7369
|
if (raw.datedOfferingEngineSettlementKind != null) {
|
|
6939
|
-
const nonCash =
|
|
6940
|
-
return nonCash.ok ? nonCash : err("Invalid
|
|
7370
|
+
const nonCash = parseDatedOfferingDirectOrderItemEngineMetadata(raw);
|
|
7371
|
+
return nonCash.ok ? nonCash : err("Invalid direct whole-series order item metadata");
|
|
6941
7372
|
}
|
|
6942
7373
|
const checkout = parseDatedOfferingOrderItemEngineMetadata(raw);
|
|
6943
7374
|
return checkout.ok ? checkout : err("Invalid dated offering order item metadata");
|
|
@@ -7257,13 +7688,6 @@ function planUnappliedOrderPaymentReceiptAllocations(input) {
|
|
|
7257
7688
|
return attributedCents === input.amountCents ? ok(allocations) : err({ kind: "allocation_invariant_failed" });
|
|
7258
7689
|
}
|
|
7259
7690
|
|
|
7260
|
-
//#endregion
|
|
7261
|
-
//#region ../commerce/src/purchase/pendingCheckoutSessionClaim.ts
|
|
7262
|
-
const PENDING_CHECKOUT_SESSION_PREFIX = "pending_checkout:";
|
|
7263
|
-
function isPendingOrderCheckoutSessionClaim(stripeCheckoutSessionId) {
|
|
7264
|
-
return typeof stripeCheckoutSessionId === "string" && stripeCheckoutSessionId.startsWith(PENDING_CHECKOUT_SESSION_PREFIX);
|
|
7265
|
-
}
|
|
7266
|
-
|
|
7267
7691
|
//#endregion
|
|
7268
7692
|
//#region ../commerce/src/purchase/orderPaymentLinkPlanning.ts
|
|
7269
7693
|
function buildOrderPaymentAdminProjection(facts) {
|
|
@@ -7327,13 +7751,13 @@ function resolvePaymentLinkAvailabilityFromFacts(input) {
|
|
|
7327
7751
|
if (input.balanceDueCents <= 0) {
|
|
7328
7752
|
return unavailable("no_balance_due", "This order does not have a payable balance.", 422);
|
|
7329
7753
|
}
|
|
7330
|
-
if (!
|
|
7754
|
+
if (!resolveOnlineOrderCheckoutMode(input)) {
|
|
7331
7755
|
return unavailable("payment_path_unavailable", "This order cannot generate a customer payment link right now.", 422);
|
|
7332
7756
|
}
|
|
7333
7757
|
if (!input.stripeConnected) {
|
|
7334
7758
|
return unavailable("stripe_not_connected", "Online payment is not available for this site.", 409);
|
|
7335
7759
|
}
|
|
7336
|
-
if (
|
|
7760
|
+
if (input.hasLiveCheckoutAttempt) {
|
|
7337
7761
|
return unavailable("checkout_in_progress", "An online payment checkout is already in progress for this order.", 409);
|
|
7338
7762
|
}
|
|
7339
7763
|
return { kind: "available" };
|
|
@@ -7356,12 +7780,6 @@ function resolvePaymentReminderAvailabilityFromFacts(input) {
|
|
|
7356
7780
|
recipientEmail
|
|
7357
7781
|
};
|
|
7358
7782
|
}
|
|
7359
|
-
function hasOutstandingPortalPaymentPath(input) {
|
|
7360
|
-
return hasOnlineOrderPaymentPath({
|
|
7361
|
-
position: input.paymentState,
|
|
7362
|
-
paymentMethod: input.paymentMethod
|
|
7363
|
-
});
|
|
7364
|
-
}
|
|
7365
7783
|
function unavailable(reason, publicMessage, httpStatus) {
|
|
7366
7784
|
return {
|
|
7367
7785
|
kind: "unavailable",
|
|
@@ -7743,6 +8161,18 @@ function summarizePriorRefundsByRail(refunds, orderItemIds) {
|
|
|
7743
8161
|
creditCents: unsafeAsNonNegativeCents(totalForRail("credit"))
|
|
7744
8162
|
});
|
|
7745
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
|
+
}
|
|
7746
8176
|
/** One receipt allocation owns rounding for both the confirmation and execution. */
|
|
7747
8177
|
function planRefundDestinationAllocation(funding, amountCents, method) {
|
|
7748
8178
|
const eligible = funding.filter((line) => line.remainingCents > 0);
|
|
@@ -8009,6 +8439,13 @@ function transitionOrderRefundStatusTo(from, to) {
|
|
|
8009
8439
|
}
|
|
8010
8440
|
return err(`Illegal order refund transition: ${from} -> ${to}`);
|
|
8011
8441
|
}
|
|
8442
|
+
/** Money confirmation and completion of the issued command are independent. */
|
|
8443
|
+
function orderRefundEffectsComplete(status) {
|
|
8444
|
+
return status === "not_requested" || status === "succeeded";
|
|
8445
|
+
}
|
|
8446
|
+
function orderRefundNeedsReconciliation(refund) {
|
|
8447
|
+
return !orderRefundEffectsComplete(refund.entitlementActionStatus) || refund.status === "reconciliation_needed" || refund.status === "failed";
|
|
8448
|
+
}
|
|
8012
8449
|
|
|
8013
8450
|
//#endregion
|
|
8014
8451
|
//#region ../commerce/src/purchase/event-registration-errors.ts
|
|
@@ -8508,14 +8945,6 @@ const PUBLIC_BOOKING_AVAILABILITY_ENDPOINT_DEFINITIONS = defineEndpointDefinitio
|
|
|
8508
8945
|
auth: "public",
|
|
8509
8946
|
responseKind: "json"
|
|
8510
8947
|
},
|
|
8511
|
-
getPublicBookingServiceBySlug: {
|
|
8512
|
-
path: "/public/bookings/services/by-slug/{slug}",
|
|
8513
|
-
method: "GET",
|
|
8514
|
-
revalidate: publicReadFreshnessSeconds("getPublicBookingService"),
|
|
8515
|
-
tags: [TAG_TEMPLATES.publicBookingServices],
|
|
8516
|
-
auth: "public",
|
|
8517
|
-
responseKind: "json"
|
|
8518
|
-
},
|
|
8519
8948
|
getPublicBookingResourcesReference: {
|
|
8520
8949
|
path: "/public/bookings/resources/reference",
|
|
8521
8950
|
method: "GET",
|
|
@@ -9111,7 +9540,7 @@ const PUBLIC_READ_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
|
|
|
9111
9540
|
path: "/sites",
|
|
9112
9541
|
method: "GET",
|
|
9113
9542
|
errors: [],
|
|
9114
|
-
revalidate:
|
|
9543
|
+
revalidate: PUBLIC_CONTENT_FRESHNESS_SECONDS,
|
|
9115
9544
|
tags: [
|
|
9116
9545
|
TAG_TEMPLATES.siteById,
|
|
9117
9546
|
TAG_TEMPLATES.siteBySlug,
|
|
@@ -9714,6 +10143,18 @@ const PAGE_SURFACE_EDITOR_ENDPOINT_DEFINITIONS = {
|
|
|
9714
10143
|
* person when nothing is attached to them.
|
|
9715
10144
|
*/
|
|
9716
10145
|
const BOOKING_PEOPLE_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
|
|
10146
|
+
getPersonBookingsPage: {
|
|
10147
|
+
path: "/sites/{siteId}/bookings/people/{personId}/bookings",
|
|
10148
|
+
method: "GET",
|
|
10149
|
+
tags: ["site-{siteId}", "customers-{siteId}"],
|
|
10150
|
+
auth: "user",
|
|
10151
|
+
responseKind: "json",
|
|
10152
|
+
errors: [
|
|
10153
|
+
"auth:forbidden",
|
|
10154
|
+
"resource:not_found",
|
|
10155
|
+
"server:internal_error"
|
|
10156
|
+
]
|
|
10157
|
+
},
|
|
9717
10158
|
previewPersonRemoval: {
|
|
9718
10159
|
path: "/sites/{siteId}/bookings/people/{personId}/removal-preview",
|
|
9719
10160
|
method: "GET",
|
|
@@ -9874,6 +10315,7 @@ const clientErrorReportSchema = z.object({
|
|
|
9874
10315
|
//#endregion
|
|
9875
10316
|
//#region ../api/src/endpoints.ts
|
|
9876
10317
|
const ENDPOINT_DEFINITIONS = {
|
|
10318
|
+
...PAGE_SECTION_LOOK_ENDPOINT_DEFINITIONS,
|
|
9877
10319
|
...PAGE_JOURNAL_ENDPOINT_DEFINITIONS,
|
|
9878
10320
|
...PREVIEW_AUTH_ENDPOINT_DEFINITIONS,
|
|
9879
10321
|
...SITE_LIFECYCLE_ENDPOINT_DEFINITIONS,
|
|
@@ -10529,14 +10971,6 @@ const ENDPOINT_DEFINITIONS = {
|
|
|
10529
10971
|
auth: "user",
|
|
10530
10972
|
responseKind: "json"
|
|
10531
10973
|
},
|
|
10532
|
-
applyContentTemplateAddon: {
|
|
10533
|
-
editLease: "unleased-editor",
|
|
10534
|
-
path: "/sites/{siteId}/content/types/{type}/template/addons",
|
|
10535
|
-
method: "POST",
|
|
10536
|
-
tags: ["site-{siteId}", "content-template-{siteId}-{type}"],
|
|
10537
|
-
auth: "user",
|
|
10538
|
-
responseKind: "json"
|
|
10539
|
-
},
|
|
10540
10974
|
updateContentTemplateBlockBindings: {
|
|
10541
10975
|
editLease: "unleased-editor",
|
|
10542
10976
|
path: "/sites/{siteId}/content/types/{type}/template/blocks/{blockId}/bindings",
|
|
@@ -11301,6 +11735,20 @@ const ENDPOINT_DEFINITIONS = {
|
|
|
11301
11735
|
auth: "user",
|
|
11302
11736
|
responseKind: "json"
|
|
11303
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
|
+
},
|
|
11304
11752
|
removeDomain: {
|
|
11305
11753
|
path: "/domains/{domainId}",
|
|
11306
11754
|
method: "DELETE",
|
|
@@ -12460,6 +12908,7 @@ const ENDPOINT_DEFINITIONS = {
|
|
|
12460
12908
|
]
|
|
12461
12909
|
},
|
|
12462
12910
|
getContentByPath: {
|
|
12911
|
+
revalidate: PUBLIC_CONTENT_FRESHNESS_SECONDS,
|
|
12463
12912
|
path: "/sites/{siteId}/pages",
|
|
12464
12913
|
method: "GET",
|
|
12465
12914
|
tags: [TAG_TEMPLATES.siteRoutableContent],
|
|
@@ -12915,7 +13364,6 @@ const ENDPOINT_DEFINITIONS = {
|
|
|
12915
13364
|
getGeneratedIconRenderAssets: {
|
|
12916
13365
|
path: "/public/sites/{siteId}/generated-icon-assets",
|
|
12917
13366
|
method: "POST",
|
|
12918
|
-
tags: [TAG_TEMPLATES.siteRoutableContent],
|
|
12919
13367
|
auth: "public",
|
|
12920
13368
|
responseKind: "json",
|
|
12921
13369
|
errors: []
|
|
@@ -13265,14 +13713,6 @@ const ENDPOINT_DEFINITIONS = {
|
|
|
13265
13713
|
"server:internal_error"
|
|
13266
13714
|
]
|
|
13267
13715
|
},
|
|
13268
|
-
checkEventAdminEligibility: {
|
|
13269
|
-
path: "/sites/{siteId}/bookings/event-series/{seriesId}/check-admin-eligibility",
|
|
13270
|
-
method: "POST",
|
|
13271
|
-
tags: ["site-{siteId}", "event-series-{seriesId}"],
|
|
13272
|
-
auth: "user",
|
|
13273
|
-
responseKind: "json",
|
|
13274
|
-
errors: ["validation:invalid_input", "server:internal_error"]
|
|
13275
|
-
},
|
|
13276
13716
|
...BOOKING_ATTENTION_ENDPOINT_DEFINITIONS,
|
|
13277
13717
|
cancelWaitlistEntry: {
|
|
13278
13718
|
path: "/sites/{siteId}/bookings/waitlist-entries/{entryId}/cancel",
|
|
@@ -14215,6 +14655,30 @@ const ENDPOINT_DEFINITIONS = {
|
|
|
14215
14655
|
auth: "user",
|
|
14216
14656
|
responseKind: "blob"
|
|
14217
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
|
+
},
|
|
14218
14682
|
listBookingActivity: {
|
|
14219
14683
|
path: "/sites/{siteId}/bookings/activity",
|
|
14220
14684
|
method: "GET",
|
|
@@ -14803,6 +15267,7 @@ const ENDPOINT_DEFINITIONS = {
|
|
|
14803
15267
|
responseKind: "json"
|
|
14804
15268
|
},
|
|
14805
15269
|
...SDK_APPOINTMENT_SERVICE_ENDPOINT_DEFINITIONS,
|
|
15270
|
+
...SDK_PAGE_SECTION_ENDPOINT_DEFINITIONS,
|
|
14806
15271
|
sdkUpsertEventCategory: {
|
|
14807
15272
|
path: "/sdk/{siteId}/event-categories",
|
|
14808
15273
|
method: "POST",
|
|
@@ -14935,6 +15400,13 @@ const ENDPOINT_DEFINITIONS = {
|
|
|
14935
15400
|
auth: "public",
|
|
14936
15401
|
responseKind: "json"
|
|
14937
15402
|
},
|
|
15403
|
+
portalGetRegularSessions: {
|
|
15404
|
+
path: "/portal/appointments/regular-sessions",
|
|
15405
|
+
method: "GET",
|
|
15406
|
+
auth: "public",
|
|
15407
|
+
responseKind: "json",
|
|
15408
|
+
errors: ["server:internal_error"]
|
|
15409
|
+
},
|
|
14938
15410
|
portalGetAppointments: {
|
|
14939
15411
|
path: "/portal/appointments",
|
|
14940
15412
|
method: "GET",
|
|
@@ -15332,7 +15804,8 @@ const operationIdSchema = z.uuid();
|
|
|
15332
15804
|
function commandHeaders(endpoint, headers, operationId) {
|
|
15333
15805
|
const result = new Headers(headers);
|
|
15334
15806
|
const method = API_ENDPOINTS[endpoint].method;
|
|
15335
|
-
|
|
15807
|
+
const readPost = endpoint === "batchBlockLoaders" || endpoint === "getGeneratedIconRenderAssets";
|
|
15808
|
+
if (method !== "GET" && !readPost && !result.has(OPERATION_ID_HEADER)) result.set(OPERATION_ID_HEADER, operationId);
|
|
15336
15809
|
return result;
|
|
15337
15810
|
}
|
|
15338
15811
|
|
|
@@ -15549,7 +16022,50 @@ const sdkListEventOccurrencesResponseSchema = z.object({
|
|
|
15549
16022
|
occurrences: z.array(sdkManagementEventOccurrenceSchema),
|
|
15550
16023
|
nextCursor: z.string().nullable()
|
|
15551
16024
|
});
|
|
16025
|
+
const scheduleBookingReasonSchema = z.enum(scheduleBookingReasonCodes);
|
|
16026
|
+
const scheduleBookingRow = {
|
|
16027
|
+
attendeeId: identifierSchema$1,
|
|
16028
|
+
customerName: z.string(),
|
|
16029
|
+
fromStartsAt: z.string(),
|
|
16030
|
+
timeZone: z.string()
|
|
16031
|
+
};
|
|
16032
|
+
const scheduleBookingOutcomeSchema = z.union([
|
|
16033
|
+
z.object({
|
|
16034
|
+
...scheduleBookingRow,
|
|
16035
|
+
kind: z.literal("move"),
|
|
16036
|
+
toStartsAt: z.string()
|
|
16037
|
+
}),
|
|
16038
|
+
z.object({
|
|
16039
|
+
...scheduleBookingRow,
|
|
16040
|
+
kind: z.literal("cancel_as_reviewed"),
|
|
16041
|
+
reason: scheduleBookingReasonSchema
|
|
16042
|
+
}),
|
|
16043
|
+
z.object({
|
|
16044
|
+
...scheduleBookingRow,
|
|
16045
|
+
kind: z.literal("left_alone"),
|
|
16046
|
+
reason: z.enum(scheduleBookingReasonCodes.filter((reason) => reason !== "move_refused"))
|
|
16047
|
+
}),
|
|
16048
|
+
z.object({
|
|
16049
|
+
...scheduleBookingRow,
|
|
16050
|
+
kind: z.literal("left_alone"),
|
|
16051
|
+
reason: z.literal("move_refused"),
|
|
16052
|
+
moveRefusalReason: scheduleBookingReasonSchema
|
|
16053
|
+
}),
|
|
16054
|
+
z.object({
|
|
16055
|
+
...scheduleBookingRow,
|
|
16056
|
+
kind: z.literal("unknown"),
|
|
16057
|
+
pendingStep: z.discriminatedUnion("kind", [z.object({
|
|
16058
|
+
kind: z.literal("move"),
|
|
16059
|
+
toStartsAt: z.string()
|
|
16060
|
+
}), z.object({
|
|
16061
|
+
kind: z.literal("cancel"),
|
|
16062
|
+
reason: scheduleBookingReasonSchema
|
|
16063
|
+
})])
|
|
16064
|
+
})
|
|
16065
|
+
]);
|
|
15552
16066
|
const businessCancellationResultSchema = z.object({
|
|
16067
|
+
cancellationRefusal: z.enum(businessCancellationRefusalCodes).optional(),
|
|
16068
|
+
scheduleBookings: z.array(scheduleBookingOutcomeSchema).optional(),
|
|
15553
16069
|
kind: z.enum([
|
|
15554
16070
|
"finished",
|
|
15555
16071
|
"unfinished",
|
|
@@ -15577,11 +16093,13 @@ const businessCancellationResultSchema = z.object({
|
|
|
15577
16093
|
cancelledBookings: z.number().int().nonnegative(),
|
|
15578
16094
|
refundedBookings: z.number().int().nonnegative(),
|
|
15579
16095
|
restoredPassCredits: z.number().int().nonnegative(),
|
|
16096
|
+
restoredPassCreditsOnExpiredPasses: z.number().int().nonnegative().optional(),
|
|
15580
16097
|
pending: z.object({
|
|
15581
16098
|
refundAttendeeIds: z.array(identifierSchema$1),
|
|
15582
16099
|
creditAttendeeIds: z.array(identifierSchema$1),
|
|
15583
16100
|
emailAttendeeIds: z.array(identifierSchema$1)
|
|
15584
16101
|
}),
|
|
16102
|
+
moveFollowUpAttendeeIds: z.array(identifierSchema$1).optional(),
|
|
15585
16103
|
structural: z.object({
|
|
15586
16104
|
created: z.number().int().nonnegative(),
|
|
15587
16105
|
deleted: z.number().int().nonnegative(),
|
|
@@ -15590,6 +16108,7 @@ const businessCancellationResultSchema = z.object({
|
|
|
15590
16108
|
unfinishedCreateCount: z.number().int().nonnegative().optional(),
|
|
15591
16109
|
reason: z.enum([
|
|
15592
16110
|
"superseded",
|
|
16111
|
+
"session_started",
|
|
15593
16112
|
"not_found",
|
|
15594
16113
|
"restore_blocked",
|
|
15595
16114
|
"failed",
|
|
@@ -15605,13 +16124,6 @@ const sdkEventOccurrenceResponseSchema = z.object({
|
|
|
15605
16124
|
const addedDateReceiptSchema = z.object({
|
|
15606
16125
|
kind: z.literal("committed"),
|
|
15607
16126
|
occurrenceId: identifierSchema$1,
|
|
15608
|
-
undo: z.object({
|
|
15609
|
-
operation: z.literal("undo_added_event_date"),
|
|
15610
|
-
siteId: identifierSchema$1,
|
|
15611
|
-
seriesId: identifierSchema$1,
|
|
15612
|
-
occurrenceId: identifierSchema$1,
|
|
15613
|
-
handle: z.string().min(1)
|
|
15614
|
-
}).optional(),
|
|
15615
16127
|
details: z.enum(["completed", "failed"]),
|
|
15616
16128
|
cache: z.enum(["completed", "failed"]),
|
|
15617
16129
|
projection: z.enum(["available", "unavailable"]),
|
|
@@ -15930,6 +16442,13 @@ const mediaUsageLocationSchema = z.discriminatedUnion("kind", [
|
|
|
15930
16442
|
surfaceSlotId: identifierSchema,
|
|
15931
16443
|
slotKey: identifierSchema
|
|
15932
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
|
+
}),
|
|
15933
16452
|
z.object({
|
|
15934
16453
|
kind: z.literal("contentEntry"),
|
|
15935
16454
|
siteId: identifierSchema,
|
|
@@ -16081,7 +16600,7 @@ const sdkNavigationLinkInputSchema = navigationLinkInputSchema;
|
|
|
16081
16600
|
*/
|
|
16082
16601
|
function losslessValidatedSchema(schema) {
|
|
16083
16602
|
return z.unknown().superRefine((value, ctx) => {
|
|
16084
|
-
const parsed =
|
|
16603
|
+
const parsed = z.safeParse(schema, value);
|
|
16085
16604
|
if (parsed.success) return;
|
|
16086
16605
|
for (const issue of parsed.error.issues) {
|
|
16087
16606
|
ctx.addIssue({
|
|
@@ -16096,7 +16615,7 @@ function losslessValidatedSchema(schema) {
|
|
|
16096
16615
|
const sdkThemeWireSchema = losslessValidatedSchema(themeSchema);
|
|
16097
16616
|
/** Explicitly cross from the lossless wire model into Riverbank's canonical theme. */
|
|
16098
16617
|
function normalizeSdkThemeWire(theme) {
|
|
16099
|
-
return
|
|
16618
|
+
return z.parse(themeSchema, theme);
|
|
16100
16619
|
}
|
|
16101
16620
|
|
|
16102
16621
|
//#endregion
|
|
@@ -16355,7 +16874,7 @@ const sdkPullFormsResponseSchema = z.object({
|
|
|
16355
16874
|
meta: sdkPullMetaSchema
|
|
16356
16875
|
});
|
|
16357
16876
|
const sdkPullThemeResponseSchema = z.object({
|
|
16358
|
-
theme:
|
|
16877
|
+
theme: z.nullable(sdkThemeWireSchema),
|
|
16359
16878
|
themeId: sdkIdentifierSchema$1.nullable(),
|
|
16360
16879
|
selectionId: sdkIdentifierSchema$1.nullable(),
|
|
16361
16880
|
selectionVersion: z.number().int().nonnegative(),
|
|
@@ -16484,6 +17003,7 @@ const BOOKING_SETTINGS_SECTION_KEYS = {
|
|
|
16484
17003
|
"eventDestinationPolicy"
|
|
16485
17004
|
],
|
|
16486
17005
|
appointments: [
|
|
17006
|
+
"serviceDestinationPolicy",
|
|
16487
17007
|
"appointmentReminderOverrides",
|
|
16488
17008
|
"appointmentDefaultMinLeadMinutes",
|
|
16489
17009
|
"appointmentDefaultMaxBookingNoticeMinutes",
|
|
@@ -16637,14 +17157,17 @@ const DEFAULT_EVENT_DESTINATION_POLICY = {
|
|
|
16637
17157
|
function isEventDestinationMode(value) {
|
|
16638
17158
|
return eventDestinationModeValues.some((mode) => mode === value);
|
|
16639
17159
|
}
|
|
16640
|
-
|
|
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";
|
|
16641
17168
|
const policy = input.policy ?? DEFAULT_EVENT_DESTINATION_POLICY;
|
|
16642
|
-
|
|
16643
|
-
|
|
16644
|
-
if (presetOverride) return presetOverride;
|
|
16645
|
-
}
|
|
16646
|
-
if (input.publicExperience === "hosted_booking") return "system-managed";
|
|
16647
|
-
return policy.defaultMode;
|
|
17169
|
+
const override = input.preset ? policy.presetOverrides[input.preset] : undefined;
|
|
17170
|
+
return override ?? (input.publicExperience === "hosted_booking" ? "system-managed" : policy.defaultMode);
|
|
16648
17171
|
}
|
|
16649
17172
|
function macadamiaDefaultEventDestinationPolicy(selectedPresets) {
|
|
16650
17173
|
const presetOverrides = {};
|
|
@@ -16955,6 +17478,7 @@ function completeBookingSettingsForSectionUpdate(settings) {
|
|
|
16955
17478
|
defaultMode: "cms-managed",
|
|
16956
17479
|
presetOverrides: {}
|
|
16957
17480
|
},
|
|
17481
|
+
serviceDestinationPolicy: settings.serviceDestinationPolicy ?? DEFAULT_SERVICE_DESTINATION_POLICY,
|
|
16958
17482
|
eventTypeBookingDefaults: settings.eventTypeBookingDefaults ?? {}
|
|
16959
17483
|
};
|
|
16960
17484
|
}
|
|
@@ -17991,7 +18515,7 @@ const uiSchema = z.object({
|
|
|
17991
18515
|
allowDirectInput: z.boolean().optional(),
|
|
17992
18516
|
pattern: z.string().optional(),
|
|
17993
18517
|
placeholder: z.string().optional(),
|
|
17994
|
-
visibleWhen:
|
|
18518
|
+
visibleWhen: z.optional(visibleWhenSchema),
|
|
17995
18519
|
modalConfig: z.object({
|
|
17996
18520
|
buttonLabel: z.string().optional(),
|
|
17997
18521
|
description: z.string().optional(),
|
|
@@ -18602,13 +19126,13 @@ const nodeSchema = z.object({
|
|
|
18602
19126
|
type: z.string().min(1, "Node type is required"),
|
|
18603
19127
|
key: z.string().optional(),
|
|
18604
19128
|
props: nodePropsSchema.optional(),
|
|
18605
|
-
children: z.lazy(() =>
|
|
19129
|
+
children: z.lazy(() => z.array(nodeSchema).default([])).optional(),
|
|
18606
19130
|
$bind: bindingSchema.optional(),
|
|
18607
19131
|
$repeat: repeatSchema.optional(),
|
|
18608
19132
|
$when: conditionSchema.optional(),
|
|
18609
19133
|
$scopes: dataScopeSchema.array().optional()
|
|
18610
19134
|
});
|
|
18611
|
-
const nodeTreeSchema =
|
|
19135
|
+
const nodeTreeSchema = z.union([z.array(nodeSchema), nodeSchema]);
|
|
18612
19136
|
const NodeSchema = nodeSchema;
|
|
18613
19137
|
const NodeTreeSchema = nodeTreeSchema;
|
|
18614
19138
|
|
|
@@ -18863,14 +19387,14 @@ const sdkCustomBlockInputSchema = z.object({
|
|
|
18863
19387
|
category: blockCategoryEnum,
|
|
18864
19388
|
icon: z.string().optional(),
|
|
18865
19389
|
tags: z.array(z.string()).optional(),
|
|
18866
|
-
fields:
|
|
19390
|
+
fields: z.array(fieldDefinitionInputSchema).min(1),
|
|
18867
19391
|
dataLoaders: sdkDataLoadersSchema,
|
|
18868
|
-
layout:
|
|
19392
|
+
layout: z.optional(NodeSchema),
|
|
18869
19393
|
...sdkBlockPresentationShape,
|
|
18870
19394
|
...blockSectionDeclarationShape
|
|
18871
19395
|
}).superRefine(validateManifestLookField).superRefine(validateSdkBlockDeclaration);
|
|
18872
19396
|
const sdkBlockFieldExtensionInputSchema = z.object({
|
|
18873
|
-
fields:
|
|
19397
|
+
fields: z.array(fieldDefinitionInputSchema).min(1),
|
|
18874
19398
|
...blockSectionDeclarationShape
|
|
18875
19399
|
}).superRefine(validateManifestLookField);
|
|
18876
19400
|
const sdkBlockFieldExtensionsInputSchema = z.record(z.string().min(1), sdkBlockFieldExtensionInputSchema);
|
|
@@ -19955,13 +20479,13 @@ var InvocationEnvelope = class {
|
|
|
19955
20479
|
errors: []
|
|
19956
20480
|
};
|
|
19957
20481
|
}
|
|
19958
|
-
const errors = this.errors.length > 0 ? this.errors : [{ message: "Command failed." }];
|
|
20482
|
+
const errors$1 = this.errors.length > 0 ? this.errors : [{ message: "Command failed." }];
|
|
19959
20483
|
return {
|
|
19960
20484
|
ok: false,
|
|
19961
20485
|
command,
|
|
19962
20486
|
result: this.resultValue,
|
|
19963
20487
|
warnings: this.warnings,
|
|
19964
|
-
errors
|
|
20488
|
+
errors: errors$1
|
|
19965
20489
|
};
|
|
19966
20490
|
}
|
|
19967
20491
|
/** Emit the single envelope. Idempotent: subsequent calls are no-ops. */
|
|
@@ -20372,8 +20896,8 @@ function formatError(error, ctx) {
|
|
|
20372
20896
|
/**
|
|
20373
20897
|
* Format validation errors for display
|
|
20374
20898
|
*/
|
|
20375
|
-
function formatValidationErrors(errors) {
|
|
20376
|
-
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");
|
|
20377
20901
|
}
|
|
20378
20902
|
function formatDiff(items) {
|
|
20379
20903
|
const lines = [];
|
|
@@ -21553,10 +22077,7 @@ function parseSurfaceId(value) {
|
|
|
21553
22077
|
return isSurfaceId(value) ? value : null;
|
|
21554
22078
|
}
|
|
21555
22079
|
function resolveSurfaceDocumentAttributes(surfaceId) {
|
|
21556
|
-
return {
|
|
21557
|
-
htmlClassName: surfaceId === DEFAULT_SURFACE_ID ? undefined : `surface-${surfaceId}`,
|
|
21558
|
-
dataSurface: surfaceId
|
|
21559
|
-
};
|
|
22080
|
+
return { dataSurface: surfaceId };
|
|
21560
22081
|
}
|
|
21561
22082
|
/**
|
|
21562
22083
|
* Deployment tier of a surface root host: `local` = the dev-host entry
|
|
@@ -21629,10 +22150,6 @@ function deriveSurfaceOwnedSiteSlugs() {
|
|
|
21629
22150
|
* also occupies its label beneath every managed site root.
|
|
21630
22151
|
*/
|
|
21631
22152
|
const SURFACE_OWNED_SITE_SLUGS = deriveSurfaceOwnedSiteSlugs();
|
|
21632
|
-
const SURFACE_FONT_HREFS = { macadamia: "https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap" };
|
|
21633
|
-
function resolveSurfaceFontHref(surfaceId) {
|
|
21634
|
-
return SURFACE_FONT_HREFS[surfaceId] ?? null;
|
|
21635
|
-
}
|
|
21636
22153
|
/**
|
|
21637
22154
|
* Normalizes a host-like input for surface matching.
|
|
21638
22155
|
*
|
|
@@ -22268,79 +22785,109 @@ function createApiResponseTransport(getHeaders = () => ({}), baseUrl, { sdkVersi
|
|
|
22268
22785
|
return fetchPromise;
|
|
22269
22786
|
};
|
|
22270
22787
|
}
|
|
22271
|
-
|
|
22272
|
-
|
|
22273
|
-
|
|
22274
|
-
|
|
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;
|
|
22275
22834
|
const originalPath = API_ENDPOINTS[endpoint].path;
|
|
22276
|
-
const
|
|
22277
|
-
|
|
22278
|
-
|
|
22279
|
-
|
|
22280
|
-
|
|
22281
|
-
|
|
22282
|
-
|
|
22283
|
-
|
|
22284
|
-
|
|
22285
|
-
|
|
22286
|
-
|
|
22287
|
-
}
|
|
22288
|
-
});
|
|
22289
|
-
}
|
|
22290
|
-
const unresolvedPathParams = [...url.match(/\{[^}]+\}/g) ?? [], ...url.match(/(^|\/):([A-Za-z][A-Za-z0-9_]*)\b/g) ?? []];
|
|
22291
|
-
if (unresolvedPathParams.length > 0) {
|
|
22292
|
-
const missingParams = Array.from(new Set(unresolvedPathParams.map((token) => {
|
|
22293
|
-
if (token.startsWith("{") && token.endsWith("}")) {
|
|
22294
|
-
return token.slice(1, -1);
|
|
22295
|
-
}
|
|
22296
|
-
return token.replace(/^\//, "").slice(1);
|
|
22297
|
-
})));
|
|
22298
|
-
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));
|
|
22299
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 ?? {});
|
|
22300
22865
|
const endpointConfig = API_ENDPOINTS[endpoint];
|
|
22301
22866
|
const method = endpointConfig.method;
|
|
22302
22867
|
const isGetOrHead = method === "GET" || method === "HEAD";
|
|
22303
|
-
const queryParams = new URLSearchParams();
|
|
22304
|
-
Object.entries(unusedParams).forEach(([key, value]) => {
|
|
22305
|
-
appendQueryParam(queryParams, key, value);
|
|
22306
|
-
});
|
|
22307
|
-
if (isGetOrHead && typeof body === "object" && body !== null && !isFormDataBody(body)) {
|
|
22308
|
-
Object.entries(body).forEach(([key, value]) => {
|
|
22309
|
-
appendQueryParam(queryParams, key, value);
|
|
22310
|
-
});
|
|
22311
|
-
}
|
|
22312
|
-
const queryString = queryParams.toString();
|
|
22313
|
-
if (queryString) {
|
|
22314
|
-
url += (url.includes("?") ? "&" : "?") + queryString;
|
|
22315
|
-
}
|
|
22316
22868
|
const formDataBody = isFormDataBody(body) ? body : undefined;
|
|
22317
|
-
const
|
|
22318
|
-
const nextOptions = { ...optionsNext ?? {} };
|
|
22319
|
-
const cacheIsNoStore = options?.cache === "no-store";
|
|
22320
|
-
if (cacheIsNoStore) {
|
|
22321
|
-
delete nextOptions.revalidate;
|
|
22322
|
-
} else if (isGetOrHead && nextOptions.revalidate === undefined && "revalidate" in endpointConfig && typeof endpointConfig.revalidate === "number") {
|
|
22323
|
-
nextOptions.revalidate = endpointConfig.revalidate;
|
|
22324
|
-
}
|
|
22325
|
-
if ("tags" in endpointConfig && Array.isArray(endpointConfig.tags)) {
|
|
22326
|
-
nextOptions.tags = buildCacheReadTags([...nextOptions.tags ?? [], ...endpointConfig.tags], params);
|
|
22327
|
-
}
|
|
22328
|
-
const init = {
|
|
22329
|
-
method,
|
|
22330
|
-
...options,
|
|
22331
|
-
credentials: "same-origin",
|
|
22332
|
-
body: isGetOrHead || body == null ? undefined : formDataBody ?? JSON.stringify(body),
|
|
22333
|
-
headers: buildRequestHeaders({
|
|
22334
|
-
optionsHeaders: options.headers,
|
|
22335
|
-
authHeaders: headers,
|
|
22336
|
-
sdkVersion: input.sdkVersion,
|
|
22337
|
-
includeJsonContentType: !isGetOrHead && !formDataBody
|
|
22338
|
-
}),
|
|
22339
|
-
...Object.keys(nextOptions).length > 0 ? { next: nextOptions } : {}
|
|
22340
|
-
};
|
|
22869
|
+
const next = resolveRequestNextOptions(endpoint, params, options, isGetOrHead);
|
|
22341
22870
|
return {
|
|
22342
|
-
url
|
|
22343
|
-
|
|
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
|
+
},
|
|
22344
22891
|
...!isGetOrHead && "tags" in endpointConfig && Array.isArray(endpointConfig.tags) ? { cacheInvalidationTags: endpointConfig.tags.map((tag) => tag) } : {}
|
|
22345
22892
|
};
|
|
22346
22893
|
}
|
|
@@ -22406,14 +22953,6 @@ function isAppointmentServiceLocationType(value) {
|
|
|
22406
22953
|
return value === "virtual" || value === "in_person" || value === "hybrid";
|
|
22407
22954
|
}
|
|
22408
22955
|
|
|
22409
|
-
//#endregion
|
|
22410
|
-
//#region ../api/src/bookingOperations.ts
|
|
22411
|
-
const APPOINTMENT_RESERVATION_STATUS_VALUES = [
|
|
22412
|
-
"active",
|
|
22413
|
-
"paused",
|
|
22414
|
-
"ended"
|
|
22415
|
-
];
|
|
22416
|
-
|
|
22417
22956
|
//#endregion
|
|
22418
22957
|
//#region ../api/src/wholeSeriesRuns.ts
|
|
22419
22958
|
const DELETE_EVENT_OFFERING_CONFLICT_REASONS = [
|
|
@@ -22480,6 +23019,7 @@ const BOOKING_ACTIVITY_TYPE_VALUES = [
|
|
|
22480
23019
|
"membership_started",
|
|
22481
23020
|
"membership_paused",
|
|
22482
23021
|
"membership_cancelled",
|
|
23022
|
+
"appointment_refund",
|
|
22483
23023
|
"event_refund",
|
|
22484
23024
|
"pass_refund",
|
|
22485
23025
|
"membership_refund",
|
|
@@ -22613,6 +23153,17 @@ function getEventDeliveryModeLabel(mode) {
|
|
|
22613
23153
|
const PARTICIPANT_MESSAGE_SUBJECT_MAX_LENGTH = 140;
|
|
22614
23154
|
const PARTICIPANT_MESSAGE_BODY_MAX_LENGTH = 2e4;
|
|
22615
23155
|
|
|
23156
|
+
//#endregion
|
|
23157
|
+
//#region ../api/src/personBookingHistory.ts
|
|
23158
|
+
/** Stable identity across the server's page order and the client's appended pages. */
|
|
23159
|
+
function getPersonBookingHistoryKey(item) {
|
|
23160
|
+
switch (item.kind) {
|
|
23161
|
+
case "appointment": return `appointment:${item.appointment.id}`;
|
|
23162
|
+
case "event_attendance": return `event:${item.attendance.id}`;
|
|
23163
|
+
case "event_series_registration": return `course:${item.enrollment.id}`;
|
|
23164
|
+
}
|
|
23165
|
+
}
|
|
23166
|
+
|
|
22616
23167
|
//#endregion
|
|
22617
23168
|
//#region ../api/src/bookings.ts
|
|
22618
23169
|
const BOOKING_QUESTION_REQUIREMENT_SCOPES = ["before_booking_booking_level", "after_booking_due_by_participant"];
|
|
@@ -22920,7 +23471,7 @@ function pushConfigFailure(error, timeoutMs, requestInfo) {
|
|
|
22920
23471
|
return managementTransportError(error, timeoutMs, requestInfo);
|
|
22921
23472
|
}
|
|
22922
23473
|
function validatePushConfig(rawConfig) {
|
|
22923
|
-
const parsed =
|
|
23474
|
+
const parsed = z.safeParse(riverbankSiteConfigSchema, rawConfig);
|
|
22924
23475
|
if (!parsed.success) {
|
|
22925
23476
|
const issues = parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ");
|
|
22926
23477
|
throw new Error(`Invalid config: ${issues}`);
|
|
@@ -22950,12 +23501,12 @@ function analyzePushConfigResponse(response, dryRun) {
|
|
|
22950
23501
|
sync: null,
|
|
22951
23502
|
warnings: []
|
|
22952
23503
|
};
|
|
22953
|
-
const errors = collectPushConfigSyncErrors(sync);
|
|
22954
|
-
if (errors.length > 0 || sync.success === false) return {
|
|
23504
|
+
const errors$1 = collectPushConfigSyncErrors(sync);
|
|
23505
|
+
if (errors$1.length > 0 || sync.success === false) return {
|
|
22955
23506
|
success: false,
|
|
22956
23507
|
kind: "sync-errors",
|
|
22957
23508
|
sync,
|
|
22958
|
-
errors
|
|
23509
|
+
errors: errors$1
|
|
22959
23510
|
};
|
|
22960
23511
|
return {
|
|
22961
23512
|
success: true,
|
|
@@ -23979,7 +24530,7 @@ function getDefaultStaffCapabilities(surfaces) {
|
|
|
23979
24530
|
return ["appointments"];
|
|
23980
24531
|
}
|
|
23981
24532
|
const managedDomainAddOnPricingSnapshotSchema = z.object({
|
|
23982
|
-
formulaVersion: z.literal("managed-domain-overage-
|
|
24533
|
+
formulaVersion: z.literal("managed-domain-overage-v2"),
|
|
23983
24534
|
conversionRule: z.literal("usd-to-gbp-1-to-1-v1"),
|
|
23984
24535
|
registrarAnnualCost: z.number().nonnegative(),
|
|
23985
24536
|
registrarCurrency: z.literal("USD"),
|
|
@@ -24545,8 +25096,25 @@ const websiteSurfaceIds = [
|
|
|
24545
25096
|
"site.performance"
|
|
24546
25097
|
];
|
|
24547
25098
|
const websiteSurfaceIdSet = new Set(websiteSurfaceIds);
|
|
24548
|
-
/**
|
|
24549
|
-
|
|
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
|
+
};
|
|
24550
25118
|
function isFeatureEnabled$1(ctx, flag) {
|
|
24551
25119
|
if (flag === "websiteEditingVisible") {
|
|
24552
25120
|
return ctx.websiteEditingVisible !== false;
|
|
@@ -24557,41 +25125,57 @@ function isDemoSiteNavSurfaceVisible(mode, surfaceId) {
|
|
|
24557
25125
|
return !isDemoDashboardUiRestricted(mode) || !hiddenDemoSiteNavIds.has(surfaceId);
|
|
24558
25126
|
}
|
|
24559
25127
|
function shouldGroupWebsiteLinks(input) {
|
|
24560
|
-
return input.bookingsVisible
|
|
25128
|
+
return input.bookingsVisible && (input.websiteLinks.length >= 2 || input.websiteLinks.length >= 1 && input.otherLinks.length >= 1);
|
|
24561
25129
|
}
|
|
24562
25130
|
function buildDashboardSiteNavPlan(ctx) {
|
|
24563
25131
|
const visibility = extractSdkDashboardNavVisibilityConfigForRole(ctx.sdkConfig, "siteNav", ctx.role);
|
|
24564
|
-
const
|
|
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({
|
|
24565
25133
|
id: entry.id,
|
|
24566
25134
|
role: ctx.role ?? null,
|
|
24567
25135
|
stage: entry.stage,
|
|
24568
25136
|
minRole: entry.minRole ?? null,
|
|
24569
25137
|
config: visibility
|
|
24570
|
-
}))
|
|
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) => ({
|
|
24571
25154
|
kind: "link",
|
|
24572
25155
|
id: entry.id,
|
|
24573
|
-
label: entry.
|
|
25156
|
+
label: entry.label
|
|
24574
25157
|
}));
|
|
24575
25158
|
const websiteLinks = links.filter((link$1) => websiteSurfaceIdSet.has(link$1.id));
|
|
24576
25159
|
const otherLinks = links.filter((link$1) => !websiteSurfaceIdSet.has(link$1.id));
|
|
24577
25160
|
if (!shouldGroupWebsiteLinks({
|
|
24578
|
-
bookingsVisible
|
|
25161
|
+
bookingsVisible,
|
|
24579
25162
|
websiteLinks,
|
|
24580
25163
|
otherLinks
|
|
24581
25164
|
})) {
|
|
24582
25165
|
return links;
|
|
24583
25166
|
}
|
|
24584
|
-
const
|
|
24585
|
-
const
|
|
25167
|
+
const [overview, ...rest] = otherLinks;
|
|
25168
|
+
const leading = overview?.id === "site.overview" ? [overview] : [];
|
|
25169
|
+
const trailing = overview?.id === "site.overview" ? rest : otherLinks;
|
|
24586
25170
|
return [
|
|
24587
25171
|
...leading,
|
|
24588
|
-
|
|
25172
|
+
{
|
|
24589
25173
|
kind: "group",
|
|
24590
25174
|
id: "site.website",
|
|
24591
25175
|
label: "Website",
|
|
24592
25176
|
items: websiteLinks
|
|
24593
|
-
}
|
|
24594
|
-
...
|
|
25177
|
+
},
|
|
25178
|
+
...trailing
|
|
24595
25179
|
];
|
|
24596
25180
|
}
|
|
24597
25181
|
|
|
@@ -25615,6 +26199,7 @@ function buildDashboardBookingsNavPlan(modules, ctx, catalogue) {
|
|
|
25615
26199
|
label: "Events",
|
|
25616
26200
|
items: modules.events ? [
|
|
25617
26201
|
...buildEventNavItems(catalogue),
|
|
26202
|
+
...buildPageSectionsNavItems(ctx),
|
|
25618
26203
|
{
|
|
25619
26204
|
label: "Venues",
|
|
25620
26205
|
destination: { kind: "venues" },
|
|
@@ -25966,6 +26551,23 @@ function buildEventNavItems(catalogue) {
|
|
|
25966
26551
|
}] : []
|
|
25967
26552
|
];
|
|
25968
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
|
+
}
|
|
25969
26571
|
function buildEventSeriesPresetNavItem(entry) {
|
|
25970
26572
|
return {
|
|
25971
26573
|
label: entry.pluralLabel,
|
|
@@ -27578,24 +28180,24 @@ const collectLocalMediaReferences = (content) => {
|
|
|
27578
28180
|
const mediaReferences = [];
|
|
27579
28181
|
const richTextReferences = [];
|
|
27580
28182
|
const warnings = [];
|
|
27581
|
-
const errors = [];
|
|
28183
|
+
const errors$1 = [];
|
|
27582
28184
|
const locationsByIdentifier = new Map();
|
|
27583
28185
|
walkLocalContentMedia(content, (value, location) => {
|
|
27584
28186
|
const rawIdentifier = typeof value.identifier === "string" ? value.identifier : "";
|
|
27585
28187
|
const hasLegacyRef = Boolean(value.assetId || value.storagePath || value.src);
|
|
27586
28188
|
if (!rawIdentifier) {
|
|
27587
28189
|
if (hasLegacyRef) {
|
|
27588
|
-
errors.push(`Media reference at ${location} is missing identifier.`);
|
|
28190
|
+
errors$1.push(`Media reference at ${location} is missing identifier.`);
|
|
27589
28191
|
}
|
|
27590
28192
|
return;
|
|
27591
28193
|
}
|
|
27592
28194
|
if (/[./\\]/.test(rawIdentifier)) {
|
|
27593
|
-
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.`);
|
|
27594
28196
|
return;
|
|
27595
28197
|
}
|
|
27596
28198
|
const normalized = normalizeMediaIdentifierInput(rawIdentifier);
|
|
27597
28199
|
if (!normalized) {
|
|
27598
|
-
errors.push(`Media identifier "${rawIdentifier}" at ${location} is invalid.`);
|
|
28200
|
+
errors$1.push(`Media identifier "${rawIdentifier}" at ${location} is invalid.`);
|
|
27599
28201
|
return;
|
|
27600
28202
|
}
|
|
27601
28203
|
if (normalized !== rawIdentifier) {
|
|
@@ -27618,17 +28220,17 @@ const collectLocalMediaReferences = (content) => {
|
|
|
27618
28220
|
const rawSrc = typeof attrs.src === "string" ? attrs.src : "";
|
|
27619
28221
|
if (!rawIdentifier) {
|
|
27620
28222
|
if (rawSrc) {
|
|
27621
|
-
errors.push(`Rich text image at ${node.location} is missing identifier.`);
|
|
28223
|
+
errors$1.push(`Rich text image at ${node.location} is missing identifier.`);
|
|
27622
28224
|
}
|
|
27623
28225
|
continue;
|
|
27624
28226
|
}
|
|
27625
28227
|
if (/[./\\]/.test(rawIdentifier)) {
|
|
27626
|
-
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.`);
|
|
27627
28229
|
continue;
|
|
27628
28230
|
}
|
|
27629
28231
|
const normalized = normalizeMediaIdentifierInput(rawIdentifier);
|
|
27630
28232
|
if (!normalized) {
|
|
27631
|
-
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.`);
|
|
27632
28234
|
continue;
|
|
27633
28235
|
}
|
|
27634
28236
|
if (normalized !== rawIdentifier) {
|
|
@@ -27650,7 +28252,7 @@ const collectLocalMediaReferences = (content) => {
|
|
|
27650
28252
|
mediaReferences,
|
|
27651
28253
|
richTextReferences,
|
|
27652
28254
|
warnings,
|
|
27653
|
-
errors,
|
|
28255
|
+
errors: errors$1,
|
|
27654
28256
|
locationsByIdentifier
|
|
27655
28257
|
};
|
|
27656
28258
|
};
|
|
@@ -27659,8 +28261,8 @@ const buildLocationNote = (locationsByIdentifier, identifier) => {
|
|
|
27659
28261
|
return locations?.length ? ` Referenced at: ${locations.join(", ")}.` : "";
|
|
27660
28262
|
};
|
|
27661
28263
|
const locationsForIdentifier = (locationsByIdentifier, identifier) => locationsByIdentifier.get(identifier) ?? [];
|
|
27662
|
-
const operationPriority = (operation) => {
|
|
27663
|
-
switch (operation.kind) {
|
|
28264
|
+
const operationPriority = (operation$1) => {
|
|
28265
|
+
switch (operation$1.kind) {
|
|
27664
28266
|
case "upload": return 0;
|
|
27665
28267
|
case "conflict":
|
|
27666
28268
|
case "missing_local_file":
|
|
@@ -28193,7 +28795,7 @@ const chooseRichTextIdentifierBase = (location, src) => {
|
|
|
28193
28795
|
//#region src/media/push-preparation-reads.ts
|
|
28194
28796
|
const readMediaManifestAndLocalFiles = async (options) => {
|
|
28195
28797
|
const manifest = options.manifest ?? await readMediaManifest(options.contentDir);
|
|
28196
|
-
const errors = [];
|
|
28798
|
+
const errors$1 = [];
|
|
28197
28799
|
const localFiles = new Map();
|
|
28198
28800
|
for (const identifier of options.identifiers) {
|
|
28199
28801
|
try {
|
|
@@ -28201,14 +28803,14 @@ const readMediaManifestAndLocalFiles = async (options) => {
|
|
|
28201
28803
|
localFiles.set(identifier, localFile);
|
|
28202
28804
|
} catch (error) {
|
|
28203
28805
|
const message = error instanceof Error ? error.message : String(error);
|
|
28204
|
-
errors.push(`Failed to load media file for "${identifier}": ${message}`);
|
|
28806
|
+
errors$1.push(`Failed to load media file for "${identifier}": ${message}`);
|
|
28205
28807
|
localFiles.set(identifier, null);
|
|
28206
28808
|
}
|
|
28207
28809
|
}
|
|
28208
28810
|
return {
|
|
28209
28811
|
manifest,
|
|
28210
28812
|
localFiles,
|
|
28211
|
-
errors
|
|
28813
|
+
errors: errors$1
|
|
28212
28814
|
};
|
|
28213
28815
|
};
|
|
28214
28816
|
const resolveMediaAssets = async (client, identifiers) => {
|
|
@@ -28342,7 +28944,7 @@ const normalizeRichTextIdentifiers = (options) => {
|
|
|
28342
28944
|
const planRichTextImageImports = (options) => {
|
|
28343
28945
|
const operations = [];
|
|
28344
28946
|
const warnings = [];
|
|
28345
|
-
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}`);
|
|
28346
28948
|
const preparedIdentifiers = new Set();
|
|
28347
28949
|
const locationsByIdentifier = new Map();
|
|
28348
28950
|
const checksumAssetsByChecksum = new Map();
|
|
@@ -28350,7 +28952,7 @@ const planRichTextImageImports = (options) => {
|
|
|
28350
28952
|
content: options.content,
|
|
28351
28953
|
existingIdentifiers: options.existingIdentifiers,
|
|
28352
28954
|
warnings,
|
|
28353
|
-
errors,
|
|
28955
|
+
errors: errors$1,
|
|
28354
28956
|
locationsByIdentifier
|
|
28355
28957
|
});
|
|
28356
28958
|
for (const imported of options.imports.successful) {
|
|
@@ -28392,7 +28994,7 @@ const planRichTextImageImports = (options) => {
|
|
|
28392
28994
|
}
|
|
28393
28995
|
return {
|
|
28394
28996
|
operations,
|
|
28395
|
-
errors,
|
|
28997
|
+
errors: errors$1,
|
|
28396
28998
|
warnings,
|
|
28397
28999
|
preparedIdentifiers,
|
|
28398
29000
|
locationsByIdentifier,
|
|
@@ -28499,9 +29101,9 @@ const assetsForPushMediaPlan = (options) => {
|
|
|
28499
29101
|
observationsByAssetId.set(asset.id, asset);
|
|
28500
29102
|
}
|
|
28501
29103
|
}
|
|
28502
|
-
for (const operation of options.operations) {
|
|
28503
|
-
if (operation.kind === "unchanged" || operation.kind === "reused") {
|
|
28504
|
-
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);
|
|
28505
29107
|
continue;
|
|
28506
29108
|
}
|
|
28507
29109
|
}
|
|
@@ -28543,7 +29145,7 @@ const appendClassification = (options) => {
|
|
|
28543
29145
|
const selectPushReferences = (options) => {
|
|
28544
29146
|
const collected = collectLocalMediaReferences(options.content);
|
|
28545
29147
|
const warnings = [...options.richTextPlan.warnings, ...collected.warnings];
|
|
28546
|
-
const errors = [...options.richTextPlan.errors, ...collected.errors];
|
|
29148
|
+
const errors$1 = [...options.richTextPlan.errors, ...collected.errors];
|
|
28547
29149
|
const locationsByIdentifier = new Map();
|
|
28548
29150
|
mergeRichTextLocations(locationsByIdentifier, options.richTextPlan.locationsByIdentifier);
|
|
28549
29151
|
mergeRichTextLocations(locationsByIdentifier, collected.locationsByIdentifier);
|
|
@@ -28565,7 +29167,7 @@ const selectPushReferences = (options) => {
|
|
|
28565
29167
|
identifiers,
|
|
28566
29168
|
locationsByIdentifier,
|
|
28567
29169
|
warnings,
|
|
28568
|
-
errors,
|
|
29170
|
+
errors: errors$1,
|
|
28569
29171
|
summary: emptyPushSummary(references.length, identifiers.length)
|
|
28570
29172
|
};
|
|
28571
29173
|
};
|
|
@@ -28575,7 +29177,7 @@ const prepareLocalReferenceOperations = async (options) => {
|
|
|
28575
29177
|
identifiers: options.selection.identifiers,
|
|
28576
29178
|
manifest: options.manifest
|
|
28577
29179
|
});
|
|
28578
|
-
const errors = [...loaded.errors];
|
|
29180
|
+
const errors$1 = [...loaded.errors];
|
|
28579
29181
|
const warnings = [];
|
|
28580
29182
|
const resolved = await resolveMediaAssets(options.prepare.client, options.selection.identifiers);
|
|
28581
29183
|
const initialAssets = initialAssetMap(resolved.assetsByIdentifier);
|
|
@@ -28606,15 +29208,15 @@ const prepareLocalReferenceOperations = async (options) => {
|
|
|
28606
29208
|
classification,
|
|
28607
29209
|
manifest: options.manifest,
|
|
28608
29210
|
operations,
|
|
28609
|
-
errors,
|
|
29211
|
+
errors: errors$1,
|
|
28610
29212
|
warnings
|
|
28611
29213
|
});
|
|
28612
29214
|
}
|
|
28613
29215
|
const sortedOperations = sortOperations(operations);
|
|
28614
29216
|
const localChecksums = localFileChecksums(options.selection.identifiers, loaded.localFiles);
|
|
28615
|
-
for (const operation of sortedOperations) {
|
|
28616
|
-
if ("file" in operation && operation.file) {
|
|
28617
|
-
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);
|
|
28618
29220
|
}
|
|
28619
29221
|
}
|
|
28620
29222
|
const checksumAssetsByChecksum = new Map(options.richTextPlan.checksumAssetsByChecksum);
|
|
@@ -28623,7 +29225,7 @@ const prepareLocalReferenceOperations = async (options) => {
|
|
|
28623
29225
|
}
|
|
28624
29226
|
return {
|
|
28625
29227
|
operations: sortedOperations,
|
|
28626
|
-
errors,
|
|
29228
|
+
errors: errors$1,
|
|
28627
29229
|
warnings,
|
|
28628
29230
|
mediaReadSet: buildMediaReadSet({
|
|
28629
29231
|
identifiers: options.selection.identifiers,
|
|
@@ -28794,10 +29396,10 @@ const makeReport = (params) => {
|
|
|
28794
29396
|
missingIdentifiers
|
|
28795
29397
|
};
|
|
28796
29398
|
};
|
|
28797
|
-
const reportForOperation = (operation, status, targetEnv, message, failureKind, rawError) => {
|
|
28798
|
-
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;
|
|
28799
29401
|
return {
|
|
28800
|
-
identifier: operation.identifier,
|
|
29402
|
+
identifier: operation$1.identifier,
|
|
28801
29403
|
status,
|
|
28802
29404
|
targetEnv,
|
|
28803
29405
|
...file ? {
|
|
@@ -28805,40 +29407,40 @@ const reportForOperation = (operation, status, targetEnv, message, failureKind,
|
|
|
28805
29407
|
sizeBytes: file.dataLength,
|
|
28806
29408
|
mimeType: file.mimeType
|
|
28807
29409
|
} : {},
|
|
28808
|
-
locations: operation.locations,
|
|
29410
|
+
locations: operation$1.locations,
|
|
28809
29411
|
message,
|
|
28810
29412
|
failureKind,
|
|
28811
29413
|
rawError
|
|
28812
29414
|
};
|
|
28813
29415
|
};
|
|
28814
|
-
const applySimpleMediaOperation = (operation, state, targetEnv) => {
|
|
28815
|
-
switch (operation.kind) {
|
|
29416
|
+
const applySimpleMediaOperation = (operation$1, state, targetEnv) => {
|
|
29417
|
+
switch (operation$1.kind) {
|
|
28816
29418
|
case "unchanged":
|
|
28817
|
-
state.assetsByIdentifier.set(operation.identifier, operation.asset);
|
|
29419
|
+
state.assetsByIdentifier.set(operation$1.identifier, operation$1.asset);
|
|
28818
29420
|
state.summary.resolved += 1;
|
|
28819
|
-
state.reportItems.push(reportForOperation(operation, "resolved", targetEnv));
|
|
29421
|
+
state.reportItems.push(reportForOperation(operation$1, "resolved", targetEnv));
|
|
28820
29422
|
return;
|
|
28821
29423
|
case "reused":
|
|
28822
|
-
state.assetsByIdentifier.set(operation.identifier, operation.asset);
|
|
29424
|
+
state.assetsByIdentifier.set(operation$1.identifier, operation$1.asset);
|
|
28823
29425
|
state.summary.resolved += 1;
|
|
28824
29426
|
state.summary.reused += 1;
|
|
28825
|
-
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."));
|
|
28826
29428
|
return;
|
|
28827
29429
|
case "skipped":
|
|
28828
29430
|
state.summary.skipped += 1;
|
|
28829
|
-
state.reportItems.push(reportForOperation(operation, "skipped", targetEnv, operation.message));
|
|
29431
|
+
state.reportItems.push(reportForOperation(operation$1, "skipped", targetEnv, operation$1.message));
|
|
28830
29432
|
return;
|
|
28831
29433
|
case "missing_local_file":
|
|
28832
|
-
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));
|
|
28833
29435
|
return;
|
|
28834
29436
|
case "conflict":
|
|
28835
|
-
state.reportItems.push(reportForOperation(operation, "failed", targetEnv, operation.message, "unknown"));
|
|
29437
|
+
state.reportItems.push(reportForOperation(operation$1, "failed", targetEnv, operation$1.message, "unknown"));
|
|
28836
29438
|
return;
|
|
28837
|
-
default: return assertNever(operation);
|
|
29439
|
+
default: return assertNever(operation$1);
|
|
28838
29440
|
}
|
|
28839
29441
|
};
|
|
28840
|
-
const applyUpload = async (operation, context, state) => {
|
|
28841
|
-
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);
|
|
28842
29444
|
if (context.dryRun) {
|
|
28843
29445
|
state.summary.pendingUploads += 1;
|
|
28844
29446
|
state.reportItems.push(pendingItem);
|
|
@@ -28850,15 +29452,15 @@ const applyUpload = async (operation, context, state) => {
|
|
|
28850
29452
|
});
|
|
28851
29453
|
try {
|
|
28852
29454
|
const result = await context.client.media.upload({
|
|
28853
|
-
data: Buffer.from(operation.file.dataBase64, "base64"),
|
|
28854
|
-
filename: operation.file.filename,
|
|
28855
|
-
contentType: operation.file.mimeType,
|
|
28856
|
-
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
|
|
28857
29459
|
});
|
|
28858
|
-
state.uploadedIdentifiers.push(operation.identifier);
|
|
29460
|
+
state.uploadedIdentifiers.push(operation$1.identifier);
|
|
28859
29461
|
if (result.status === "created") state.summary.uploaded += 1;
|
|
28860
29462
|
state.summary.resolved += 1;
|
|
28861
|
-
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.");
|
|
28862
29464
|
state.reportItems.push(uploadedItem);
|
|
28863
29465
|
context.onEvent?.({
|
|
28864
29466
|
type: "upload_succeeded",
|
|
@@ -28866,28 +29468,28 @@ const applyUpload = async (operation, context, state) => {
|
|
|
28866
29468
|
});
|
|
28867
29469
|
} catch (error) {
|
|
28868
29470
|
const message = rawErrorMessage$1(error);
|
|
28869
|
-
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);
|
|
28870
29472
|
state.reportItems.push(failedItem);
|
|
28871
|
-
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}`);
|
|
28872
29474
|
context.onEvent?.({
|
|
28873
29475
|
type: "upload_failed",
|
|
28874
29476
|
item: failedItem
|
|
28875
29477
|
});
|
|
28876
29478
|
}
|
|
28877
29479
|
};
|
|
28878
|
-
const applyMediaOperation = async (operation, context, state) => {
|
|
28879
|
-
switch (operation.kind) {
|
|
29480
|
+
const applyMediaOperation = async (operation$1, context, state) => {
|
|
29481
|
+
switch (operation$1.kind) {
|
|
28880
29482
|
case "unchanged":
|
|
28881
29483
|
case "reused":
|
|
28882
29484
|
case "skipped":
|
|
28883
29485
|
case "missing_local_file":
|
|
28884
29486
|
case "conflict":
|
|
28885
|
-
applySimpleMediaOperation(operation, state, context.targetEnv);
|
|
29487
|
+
applySimpleMediaOperation(operation$1, state, context.targetEnv);
|
|
28886
29488
|
return;
|
|
28887
29489
|
case "upload":
|
|
28888
|
-
await applyUpload(operation, context, state);
|
|
29490
|
+
await applyUpload(operation$1, context, state);
|
|
28889
29491
|
return;
|
|
28890
|
-
default: return assertNever(operation);
|
|
29492
|
+
default: return assertNever(operation$1);
|
|
28891
29493
|
}
|
|
28892
29494
|
};
|
|
28893
29495
|
const createApplyState = (plan) => ({
|
|
@@ -28898,8 +29500,8 @@ const createApplyState = (plan) => ({
|
|
|
28898
29500
|
uploadedIdentifiers: []
|
|
28899
29501
|
});
|
|
28900
29502
|
const applyMediaOperations = async (operations, context, state) => {
|
|
28901
|
-
for (const operation of operations) {
|
|
28902
|
-
await applyMediaOperation(operation, context, state);
|
|
29503
|
+
for (const operation$1 of operations) {
|
|
29504
|
+
await applyMediaOperation(operation$1, context, state);
|
|
28903
29505
|
}
|
|
28904
29506
|
};
|
|
28905
29507
|
const resolveUploadedAssets = async (state, client, dryRun) => {
|
|
@@ -28916,9 +29518,9 @@ const resolveUploadedAssets = async (state, client, dryRun) => {
|
|
|
28916
29518
|
};
|
|
28917
29519
|
const fileByIdentifier = (operations) => {
|
|
28918
29520
|
const files = new Map();
|
|
28919
|
-
for (const operation of operations) {
|
|
28920
|
-
if ("file" in operation && !files.has(operation.identifier)) {
|
|
28921
|
-
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);
|
|
28922
29524
|
}
|
|
28923
29525
|
}
|
|
28924
29526
|
return files;
|
|
@@ -30851,12 +31453,12 @@ const CREATE_UPDATE_OPERATIONS = [{
|
|
|
30851
31453
|
marker: "~"
|
|
30852
31454
|
}];
|
|
30853
31455
|
function appendOperationSections$1(lines, category, diffs, operations, formatItem, formatDetails) {
|
|
30854
|
-
for (const operation of operations) {
|
|
30855
|
-
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);
|
|
30856
31458
|
if (matchingDiffs.length === 0) continue;
|
|
30857
|
-
lines.push(`\n${category} (${operation.label}):`);
|
|
31459
|
+
lines.push(`\n${category} (${operation$1.label}):`);
|
|
30858
31460
|
for (const diff of matchingDiffs) {
|
|
30859
|
-
lines.push(` ${operation.marker} ${formatItem(diff)}`);
|
|
31461
|
+
lines.push(` ${operation$1.marker} ${formatItem(diff)}`);
|
|
30860
31462
|
if (formatDetails) lines.push(...formatDetails(diff));
|
|
30861
31463
|
}
|
|
30862
31464
|
}
|
|
@@ -31129,11 +31731,11 @@ const CREATE_UPDATE_DELETE_DETAIL_OPERATIONS = [...CREATE_UPDATE_DETAIL_OPERATIO
|
|
|
31129
31731
|
marker: "-"
|
|
31130
31732
|
}];
|
|
31131
31733
|
function appendOperationSections(lines, category, diffs, operations, formatItem) {
|
|
31132
|
-
for (const operation of operations) {
|
|
31133
|
-
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);
|
|
31134
31736
|
if (matchingDiffs.length === 0) continue;
|
|
31135
|
-
lines.push(`\n${category} (${operation.label}):`);
|
|
31136
|
-
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)}`);
|
|
31137
31739
|
}
|
|
31138
31740
|
}
|
|
31139
31741
|
function formatIdentifierDetail(identifier, changes) {
|
|
@@ -31768,8 +32370,8 @@ function createCliCommandBatchRef(input) {
|
|
|
31768
32370
|
slugPart(input.siteId) || "unnamed"
|
|
31769
32371
|
].join(":");
|
|
31770
32372
|
}
|
|
31771
|
-
function formatSiteCommandValidationErrors(errors) {
|
|
31772
|
-
return errors.map((error) => error.message).join("\n");
|
|
32373
|
+
function formatSiteCommandValidationErrors(errors$1) {
|
|
32374
|
+
return errors$1.map((error) => error.message).join("\n");
|
|
31773
32375
|
}
|
|
31774
32376
|
function isRecord(value) {
|
|
31775
32377
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
@@ -31839,7 +32441,7 @@ function planCliCommandBatchForTypes(input) {
|
|
|
31839
32441
|
const exposure = batch.commands.length === 0 ? null : evaluateCliBatchExposure(batch, input.exposure ?? "sdk_cli", input.targetEnv);
|
|
31840
32442
|
if (exposure !== null && exposure.kind !== "allowed") {
|
|
31841
32443
|
const commandIndex = exposure.commandType === null ? 0 : batch.commands.findIndex((command) => command.type === exposure.commandType && (exposure.commandRef === null || command.ref === exposure.commandRef));
|
|
31842
|
-
const errors = [{
|
|
32444
|
+
const errors$1 = [{
|
|
31843
32445
|
code: "invalid_command_payload",
|
|
31844
32446
|
commandIndex: Math.max(commandIndex, 0),
|
|
31845
32447
|
commandType: exposure.commandType,
|
|
@@ -31848,7 +32450,7 @@ function planCliCommandBatchForTypes(input) {
|
|
|
31848
32450
|
}];
|
|
31849
32451
|
return err({
|
|
31850
32452
|
code: "command_validation_failed",
|
|
31851
|
-
errors,
|
|
32453
|
+
errors: errors$1,
|
|
31852
32454
|
message: exposure.message
|
|
31853
32455
|
});
|
|
31854
32456
|
}
|