riverbankcms 0.31.1 → 0.32.0
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 +10625 -5194
- package/dist/cli/init-docs/content/cli-reference.md +24 -1
- package/dist/{entryCommands-CYEpLRXI.mjs → entryCommands-BJFkJn_e.mjs} +2665 -1409
- package/dist/eventUpsertInputSchema-BD_RuhcK.mjs +108 -0
- package/dist/load-config-CODn5_ki.mjs +4 -0
- package/dist/{load-config-DIyqYeRP.mjs → load-config-CfL4ZWC8.mjs} +3 -2
- package/dist/{plan-D5NfiRLe.mjs → plan-CbzdsZp3.mjs} +1 -1
- package/dist/scaffold/index.mjs +2 -2
- package/dist/sdk-event-upsert-SodZay6g.mjs +46258 -0
- package/dist/{src-exrglXYU.mjs → src-CVyy-M-N.mjs} +544 -368
- package/dist/testing.mjs +4 -4
- package/package.json +2 -1
- package/dist/eventUpsertInputSchema-CGmm5o_I.mjs +0 -5519
- package/dist/load-config-B_kPvIxz.mjs +0 -4
- package/dist/sdk-event-upsert-0U4hsDpo.mjs +0 -15688
|
@@ -161,7 +161,6 @@ const unsafeAsDatedOfferingCapacityHoldAuditRef = (value) => value;
|
|
|
161
161
|
const unsafeAsDatedOfferingRevocationAuditEventId = (value) => value;
|
|
162
162
|
const unsafeAsDatedOfferingWaitlistCapacityEffectId = (value) => value;
|
|
163
163
|
const unsafeAsDatedOfferingWaitlistCapacityEffectClaimToken = (value) => value;
|
|
164
|
-
const unsafeAsDatedOfferingRunCancellationOperationId = (value) => value;
|
|
165
164
|
const unsafeAsWaitlistEntryId = (id) => id;
|
|
166
165
|
const unsafeAsWaitlistHoldId = (id) => id;
|
|
167
166
|
const parseDatedOfferingCapacityHoldId = (value) => parseUuidBrand(value, unsafeAsDatedOfferingCapacityHoldId);
|
|
@@ -169,7 +168,6 @@ const parseDatedOfferingCapacityHoldAuditRef = (value) => parseUuidBrand(value,
|
|
|
169
168
|
const parseDatedOfferingRevocationAuditEventId = (value) => parseUuidBrand(value, unsafeAsDatedOfferingRevocationAuditEventId);
|
|
170
169
|
const parseDatedOfferingWaitlistCapacityEffectId = (value) => parseUuidBrand(value, unsafeAsDatedOfferingWaitlistCapacityEffectId);
|
|
171
170
|
const parseDatedOfferingWaitlistCapacityEffectClaimToken = (value) => parseUuidBrand(value, unsafeAsDatedOfferingWaitlistCapacityEffectClaimToken);
|
|
172
|
-
const parseDatedOfferingRunCancellationOperationId = (value) => parseUuidBrand(value, unsafeAsDatedOfferingRunCancellationOperationId);
|
|
173
171
|
|
|
174
172
|
//#endregion
|
|
175
173
|
//#region ../core/src/branded/entitlements.ts
|
|
@@ -631,6 +629,13 @@ function eventPricingRequiresPayment(pricing) {
|
|
|
631
629
|
default: return assertNever(pricing);
|
|
632
630
|
}
|
|
633
631
|
}
|
|
632
|
+
/** Entitlements that can pay for the current scope and number of participants. */
|
|
633
|
+
function eventRegistrationEntitlementPolicy(input) {
|
|
634
|
+
return {
|
|
635
|
+
passes: input.participantCount === 1 && input.scope === "occurrence",
|
|
636
|
+
memberships: input.participantCount === 1
|
|
637
|
+
};
|
|
638
|
+
}
|
|
634
639
|
|
|
635
640
|
//#endregion
|
|
636
641
|
//#region ../core/src/currency-format.ts
|
|
@@ -870,6 +875,17 @@ function mapReadonlyNonEmptyArray(items, map) {
|
|
|
870
875
|
const [first, ...rest] = items;
|
|
871
876
|
return [map(first, 0), ...rest.map((item, index) => map(item, index + 1))];
|
|
872
877
|
}
|
|
878
|
+
/** Promise.all with the input's non-empty cardinality preserved. */
|
|
879
|
+
async function allReadonlyNonEmpty(promises) {
|
|
880
|
+
const [first, ...rest] = await Promise.all(promises);
|
|
881
|
+
return [first, ...rest];
|
|
882
|
+
}
|
|
883
|
+
/** Keep ordered successes only when every member succeeded. */
|
|
884
|
+
function collectReadonlyNonEmptyResults(results) {
|
|
885
|
+
const [first, ...rest] = results;
|
|
886
|
+
if (!first.ok) return first;
|
|
887
|
+
return rest.reduce((collected, result) => !collected.ok ? collected : !result.ok ? result : ok([...collected.value, result.value]), ok([first.value]));
|
|
888
|
+
}
|
|
873
889
|
|
|
874
890
|
//#endregion
|
|
875
891
|
//#region ../core/src/event-booking-offer-parser.ts
|
|
@@ -1387,8 +1403,8 @@ function formatBookingPriceDisplay(display, options = {}) {
|
|
|
1387
1403
|
case "free": return "Free";
|
|
1388
1404
|
case "exact": return formatCurrencyAmount(display.amount, display.currency, options);
|
|
1389
1405
|
case "from": return `From ${formatCurrencyAmount(display.amount, display.currency, options)}`;
|
|
1390
|
-
case "range": return `${formatCurrencyAmount(display.minAmount, display.currency, options)}
|
|
1391
|
-
case "mixed": return display.paidToAmount > display.paidFromAmount ? `Free / ${formatCurrencyAmount(display.paidFromAmount, display.currency, options)}
|
|
1406
|
+
case "range": return `${formatCurrencyAmount(display.minAmount, display.currency, options)}–${formatCurrencyAmount(display.maxAmount, display.currency, options)}`;
|
|
1407
|
+
case "mixed": return display.paidToAmount > display.paidFromAmount ? `Free / ${formatCurrencyAmount(display.paidFromAmount, display.currency, options)}–${formatCurrencyAmount(display.paidToAmount, display.currency, options)}` : `Free / ${formatCurrencyAmount(display.paidFromAmount, display.currency, options)}`;
|
|
1392
1408
|
case "unavailable": return "Pricing unavailable";
|
|
1393
1409
|
case "external": return display.label;
|
|
1394
1410
|
default: return assertNever(display);
|
|
@@ -1399,6 +1415,46 @@ function formatEventPricing(pricing, options = {}) {
|
|
|
1399
1415
|
return formatBookingPriceDisplay(publicEventPricingDisplay(pricing), options);
|
|
1400
1416
|
}
|
|
1401
1417
|
|
|
1418
|
+
//#endregion
|
|
1419
|
+
//#region ../core/src/event-preset-vocabulary.ts
|
|
1420
|
+
const EVENT_PRESET_VOCABULARY = {
|
|
1421
|
+
event: {
|
|
1422
|
+
label: "Event",
|
|
1423
|
+
pluralLabel: "Events",
|
|
1424
|
+
description: "Any event, repeating or manually dated, that does not fit the other categories."
|
|
1425
|
+
},
|
|
1426
|
+
class: {
|
|
1427
|
+
label: "Class",
|
|
1428
|
+
pluralLabel: "Classes",
|
|
1429
|
+
description: "Regular scheduled classes and group sessions."
|
|
1430
|
+
},
|
|
1431
|
+
course: {
|
|
1432
|
+
label: "Course",
|
|
1433
|
+
pluralLabel: "Courses",
|
|
1434
|
+
description: "A fixed set of dates that people book together."
|
|
1435
|
+
},
|
|
1436
|
+
term: {
|
|
1437
|
+
label: "Term",
|
|
1438
|
+
pluralLabel: "Terms",
|
|
1439
|
+
description: "A fixed term of sessions that people book together."
|
|
1440
|
+
},
|
|
1441
|
+
workshop: {
|
|
1442
|
+
label: "Workshop",
|
|
1443
|
+
pluralLabel: "Workshops",
|
|
1444
|
+
description: "One-off workshops, day sessions, or special events."
|
|
1445
|
+
},
|
|
1446
|
+
retreat: {
|
|
1447
|
+
label: "Retreat",
|
|
1448
|
+
pluralLabel: "Retreats",
|
|
1449
|
+
description: "Multi-day or residential immersive experiences."
|
|
1450
|
+
},
|
|
1451
|
+
performance: {
|
|
1452
|
+
label: "Performance",
|
|
1453
|
+
pluralLabel: "Performances",
|
|
1454
|
+
description: "Audience-facing shows, concerts, recitals, or showcases."
|
|
1455
|
+
}
|
|
1456
|
+
};
|
|
1457
|
+
|
|
1402
1458
|
//#endregion
|
|
1403
1459
|
//#region ../core/src/event-page-surface-subject.ts
|
|
1404
1460
|
function createEventSeriesPageSurfaceSubject(eventSeriesId, bookingScope, eventDestinationMode) {
|
|
@@ -1525,6 +1581,17 @@ function parseEventSeriesIdList(values) {
|
|
|
1525
1581
|
function isRecord$10(value) {
|
|
1526
1582
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1527
1583
|
}
|
|
1584
|
+
/**
|
|
1585
|
+
* The offering-kind label a page surface's subject settles on its own, such as
|
|
1586
|
+
* "Course" for a whole-series run's page. Uses the platform vocabulary that
|
|
1587
|
+
* lists and the booking flow use. An ordinary series or an offering page
|
|
1588
|
+
* doesn't say which preset it belongs to, so it has no label here and the
|
|
1589
|
+
* template's own default stands.
|
|
1590
|
+
*/
|
|
1591
|
+
function offeringLabelForPageSurfaceSubject(subject) {
|
|
1592
|
+
if (subject?.kind !== "eventSeries") return null;
|
|
1593
|
+
return subject.bookingScope === "whole_series" ? EVENT_PRESET_VOCABULARY.course.label : null;
|
|
1594
|
+
}
|
|
1528
1595
|
|
|
1529
1596
|
//#endregion
|
|
1530
1597
|
//#region ../core/src/page-surface-subject.ts
|
|
@@ -1613,7 +1680,6 @@ function deriveTotalTicketQuantity(lines) {
|
|
|
1613
1680
|
|
|
1614
1681
|
//#endregion
|
|
1615
1682
|
//#region ../core/src/booking-flexible-balance.ts
|
|
1616
|
-
const DEFAULT_FLEXIBLE_BALANCE_STRIPE_MINIMUM_CHARGE_CENTS = 50;
|
|
1617
1683
|
function clampFlexibleBalanceConfiguredAmount(amountCents, totalAmountCents) {
|
|
1618
1684
|
return Math.max(0, Math.min(amountCents, totalAmountCents));
|
|
1619
1685
|
}
|
|
@@ -1638,86 +1704,6 @@ function calculateFlexibleBalanceMinimumPaymentCents(input) {
|
|
|
1638
1704
|
const percentageFloor = Math.ceil(input.remainingBalanceCents * minimumPercentageBps / 1e4);
|
|
1639
1705
|
return Math.min(input.remainingBalanceCents, Math.max(input.stripeMinimumChargeCents, percentageFloor));
|
|
1640
1706
|
}
|
|
1641
|
-
function resolveFlexibleBalancePaymentEligibility(input) {
|
|
1642
|
-
if (input.remainingBalanceCents <= 0 || input.status === "completed") {
|
|
1643
|
-
return {
|
|
1644
|
-
kind: "unavailable",
|
|
1645
|
-
reason: "already_settled"
|
|
1646
|
-
};
|
|
1647
|
-
}
|
|
1648
|
-
switch (input.status) {
|
|
1649
|
-
case "payment_pending":
|
|
1650
|
-
case "cancelled_due_to_non_payment":
|
|
1651
|
-
case "refunded":
|
|
1652
|
-
case "waived": return {
|
|
1653
|
-
kind: "unavailable",
|
|
1654
|
-
reason: input.status
|
|
1655
|
-
};
|
|
1656
|
-
case "closed_order_failed": return {
|
|
1657
|
-
kind: "unavailable",
|
|
1658
|
-
reason: "order_failed"
|
|
1659
|
-
};
|
|
1660
|
-
case "overdue": return {
|
|
1661
|
-
kind: "full_balance_only",
|
|
1662
|
-
remainingBalanceCents: input.remainingBalanceCents,
|
|
1663
|
-
reason: "overdue"
|
|
1664
|
-
};
|
|
1665
|
-
case "active": {
|
|
1666
|
-
const minimumAmountCents = calculateFlexibleBalanceMinimumPaymentCents({
|
|
1667
|
-
remainingBalanceCents: input.remainingBalanceCents,
|
|
1668
|
-
stripeMinimumChargeCents: input.stripeMinimumChargeCents,
|
|
1669
|
-
minimumPercentageBps: input.minimumPercentageBps
|
|
1670
|
-
});
|
|
1671
|
-
if (minimumAmountCents >= input.remainingBalanceCents) {
|
|
1672
|
-
return {
|
|
1673
|
-
kind: "full_balance_only",
|
|
1674
|
-
remainingBalanceCents: input.remainingBalanceCents,
|
|
1675
|
-
reason: "dust_balance"
|
|
1676
|
-
};
|
|
1677
|
-
}
|
|
1678
|
-
return {
|
|
1679
|
-
kind: "eligible",
|
|
1680
|
-
minimumAmountCents,
|
|
1681
|
-
maximumCustomAmountCents: input.remainingBalanceCents,
|
|
1682
|
-
suggestedPayFullAmountCents: input.remainingBalanceCents
|
|
1683
|
-
};
|
|
1684
|
-
}
|
|
1685
|
-
default: return assertNever$5(input.status);
|
|
1686
|
-
}
|
|
1687
|
-
}
|
|
1688
|
-
function isFlexibleBalanceReminderSuppressed(input) {
|
|
1689
|
-
const suppressionWindowHours = input.suppressionWindowHours ?? 24;
|
|
1690
|
-
const bookedAtMs = Date.parse(input.bookedAt);
|
|
1691
|
-
const reminderDueAtMs = Date.parse(input.reminderDueAt);
|
|
1692
|
-
if (!Number.isFinite(bookedAtMs) || !Number.isFinite(reminderDueAtMs)) {
|
|
1693
|
-
return false;
|
|
1694
|
-
}
|
|
1695
|
-
return reminderDueAtMs - bookedAtMs < suppressionWindowHours * 60 * 60 * 1e3;
|
|
1696
|
-
}
|
|
1697
|
-
function buildFlexibleBalanceReminderSchedule(input) {
|
|
1698
|
-
const schedule = [
|
|
1699
|
-
{
|
|
1700
|
-
kind: "due_7_days",
|
|
1701
|
-
scheduledFor: subtractDaysFromIso(input.dueAt, 7)
|
|
1702
|
-
},
|
|
1703
|
-
{
|
|
1704
|
-
kind: "due_1_day",
|
|
1705
|
-
scheduledFor: subtractDaysFromIso(input.dueAt, 1)
|
|
1706
|
-
},
|
|
1707
|
-
{
|
|
1708
|
-
kind: "overdue_1_day",
|
|
1709
|
-
scheduledFor: addDaysToIso(input.dueAt, 1)
|
|
1710
|
-
}
|
|
1711
|
-
];
|
|
1712
|
-
return schedule.map((entry) => ({
|
|
1713
|
-
kind: entry.kind,
|
|
1714
|
-
scheduledFor: entry.scheduledFor,
|
|
1715
|
-
suppressed: isFlexibleBalanceReminderSuppressed({
|
|
1716
|
-
bookedAt: input.bookedAt,
|
|
1717
|
-
reminderDueAt: entry.scheduledFor
|
|
1718
|
-
})
|
|
1719
|
-
}));
|
|
1720
|
-
}
|
|
1721
1707
|
function assertNever$5(value) {
|
|
1722
1708
|
throw new Error(`Unexpected value: ${String(value)}`);
|
|
1723
1709
|
}
|
|
@@ -1771,6 +1757,11 @@ function addRefundDestinationAmounts(a, b) {
|
|
|
1771
1757
|
function hasDirectRefundFunding(funding) {
|
|
1772
1758
|
return funding?.some((line$1) => line$1.destination === "direct" && line$1.remainingCents > 0) ?? false;
|
|
1773
1759
|
}
|
|
1760
|
+
/** A refund cut-off as a span of time: "24 hours", "2 days", "1 hour". */
|
|
1761
|
+
function formatCancellationCutoffSpan(cutoffHours) {
|
|
1762
|
+
if (cutoffHours > 24 && cutoffHours % 24 === 0) return `${cutoffHours / 24} days`;
|
|
1763
|
+
return cutoffHours === 1 ? "1 hour" : `${cutoffHours} hours`;
|
|
1764
|
+
}
|
|
1774
1765
|
/** Closed refusal and reconciliation reasons shared by stored reviews and receipts. */
|
|
1775
1766
|
const scheduleBookingReasonCodes = [
|
|
1776
1767
|
"closed",
|
|
@@ -1809,14 +1800,16 @@ const businessCancellationRefusalCodes = [
|
|
|
1809
1800
|
"not_found",
|
|
1810
1801
|
"payment_in_progress",
|
|
1811
1802
|
"payment_check_unavailable",
|
|
1812
|
-
"partial_payment_terms"
|
|
1803
|
+
"partial_payment_terms",
|
|
1804
|
+
"settlement_not_allowed"
|
|
1813
1805
|
];
|
|
1814
1806
|
const businessCancellationRefusalCopy = {
|
|
1815
1807
|
review_changed: "Bookings have changed since you reviewed this schedule. Review the changes again before saving.",
|
|
1816
1808
|
not_found: "One of these dates could not be found. Refresh the dates and review your changes again.",
|
|
1817
1809
|
payment_in_progress: "A payment is still being processed for one of these bookings. Wait for it to finish, then review the cancellation again.",
|
|
1818
1810
|
payment_check_unavailable: "We could not check a payment for one of these bookings. Review the cancellation again later, or contact us for help.",
|
|
1819
|
-
partial_payment_terms: "One of these bookings shares a payment arrangement with another booking. Cancel the bookings together or contact us for help."
|
|
1811
|
+
partial_payment_terms: "One of these bookings shares a payment arrangement with another booking. Cancel the bookings together or contact us for help.",
|
|
1812
|
+
settlement_not_allowed: "A refund choice can't be used any more: account credit may have been turned off, or how a booking was paid has changed. Review the cancellation again and choose again."
|
|
1820
1813
|
};
|
|
1821
1814
|
|
|
1822
1815
|
//#endregion
|
|
@@ -1954,11 +1947,9 @@ function describeInstalmentDepositBelowMinimum(failure, currency) {
|
|
|
1954
1947
|
//#endregion
|
|
1955
1948
|
//#region ../core/src/booking-live-payment-terms.ts
|
|
1956
1949
|
/**
|
|
1957
|
-
*
|
|
1958
|
-
*
|
|
1959
|
-
*
|
|
1960
|
-
* Both tables are total over their status unions, so a new status is a compile
|
|
1961
|
-
* error here until someone decides whether it counts as live.
|
|
1950
|
+
* Stored instalment-provider outcomes used by schedule coordination.
|
|
1951
|
+
* Order money admissions and flexible-balance liveness come from the position.
|
|
1952
|
+
* The table is total over the plan status union.
|
|
1962
1953
|
*/
|
|
1963
1954
|
const LIVE_PLAN_STATUSES = {
|
|
1964
1955
|
pending_initial_payment: true,
|
|
@@ -1970,79 +1961,13 @@ const LIVE_PLAN_STATUSES = {
|
|
|
1970
1961
|
cancelled_as_paid_early: false,
|
|
1971
1962
|
refunded: false
|
|
1972
1963
|
};
|
|
1973
|
-
const LIVE_CONTRACT_STATUSES = {
|
|
1974
|
-
active: true,
|
|
1975
|
-
payment_pending: true,
|
|
1976
|
-
overdue: true,
|
|
1977
|
-
completed: false,
|
|
1978
|
-
waived: false,
|
|
1979
|
-
refunded: false,
|
|
1980
|
-
cancelled_due_to_non_payment: false,
|
|
1981
|
-
closed_order_failed: false
|
|
1982
|
-
};
|
|
1983
1964
|
function isLiveOrderInstalmentPlanStatus(status) {
|
|
1984
1965
|
return LIVE_PLAN_STATUSES[status];
|
|
1985
1966
|
}
|
|
1986
1967
|
/** The live plan statuses as a list, for queries that select plans to collect. */
|
|
1987
1968
|
const LIVE_ORDER_INSTALMENT_PLAN_STATUSES = Object.keys(LIVE_PLAN_STATUSES).filter(isLiveOrderInstalmentPlanStatus);
|
|
1988
|
-
function isLiveFlexibleBalanceContractStatus(status) {
|
|
1989
|
-
return LIVE_CONTRACT_STATUSES[status];
|
|
1990
|
-
}
|
|
1991
|
-
function hasLivePaymentTerms(input) {
|
|
1992
|
-
return input.plan !== null && isLiveOrderInstalmentPlanStatus(input.plan.status) || input.contract !== null && isLiveFlexibleBalanceContractStatus(input.contract.status);
|
|
1993
|
-
}
|
|
1994
|
-
/** Partial refunds must also protect a cancelled contract that staff can reopen. */
|
|
1995
|
-
function paymentTermsBlockPartialRefund(input) {
|
|
1996
|
-
return hasLivePaymentTerms(input) || input.contract?.status === "cancelled_due_to_non_payment";
|
|
1997
|
-
}
|
|
1998
|
-
/**
|
|
1999
|
-
* Live statuses where a collection is already in flight: the first payment,
|
|
2000
|
-
* a card charge, or a Stripe reconciliation hasn't resolved yet. Nobody may
|
|
2001
|
-
* settle the balance by hand while one of these is running. Both tables are
|
|
2002
|
-
* total over the live statuses, so a new live status must be classified here.
|
|
2003
|
-
*/
|
|
2004
|
-
const PLAN_COLLECTION_IN_FLIGHT = {
|
|
2005
|
-
pending_initial_payment: true,
|
|
2006
|
-
reconciliation_required: true,
|
|
2007
|
-
active: false,
|
|
2008
|
-
payment_failed: false
|
|
2009
|
-
};
|
|
2010
|
-
const CONTRACT_COLLECTION_IN_FLIGHT = {
|
|
2011
|
-
payment_pending: true,
|
|
2012
|
-
active: false,
|
|
2013
|
-
overdue: false
|
|
2014
|
-
};
|
|
2015
|
-
/**
|
|
2016
|
-
* Whether an instalment plan's remaining balance can take a payment now, by
|
|
2017
|
-
* hand or online: it's live and no collection is in flight.
|
|
2018
|
-
*/
|
|
2019
|
-
function isSettleableOrderInstalmentPlanStatus(status) {
|
|
2020
|
-
return isLiveOrderInstalmentPlanStatus(status) && !PLAN_COLLECTION_IN_FLIGHT[status];
|
|
2021
|
-
}
|
|
2022
|
-
/**
|
|
2023
|
-
* Whether a flexible-balance contract's remaining balance can take a payment
|
|
2024
|
-
* now, by hand or online: it's live and no collection is in flight.
|
|
2025
|
-
*/
|
|
2026
|
-
function isSettleableFlexibleBalanceContractStatus(status) {
|
|
2027
|
-
return isLiveFlexibleBalanceContractStatus(status) && !CONTRACT_COLLECTION_IN_FLIGHT[status];
|
|
2028
|
-
}
|
|
2029
1969
|
/** Shared reason for closing either form of booking payment terms. */
|
|
2030
1970
|
const PAYMENT_TERMS_CLOSURE_REASONS = ["cancelled", "refunded"];
|
|
2031
|
-
/** Refund closure records its outcome even when collection has already ended. */
|
|
2032
|
-
function decideContractClosure(status, reason) {
|
|
2033
|
-
if (reason === "refunded") {
|
|
2034
|
-
return status === "refunded" ? { kind: "keep" } : {
|
|
2035
|
-
kind: "close",
|
|
2036
|
-
from: status,
|
|
2037
|
-
to: "refunded"
|
|
2038
|
-
};
|
|
2039
|
-
}
|
|
2040
|
-
return isLiveFlexibleBalanceContractStatus(status) ? {
|
|
2041
|
-
kind: "close",
|
|
2042
|
-
from: status,
|
|
2043
|
-
to: "closed_order_failed"
|
|
2044
|
-
} : { kind: "keep" };
|
|
2045
|
-
}
|
|
2046
1971
|
|
|
2047
1972
|
//#endregion
|
|
2048
1973
|
//#region ../core/src/booking-payment-options.ts
|
|
@@ -3773,25 +3698,20 @@ function resolvePermittedLocation(permission, location, siteCountry) {
|
|
|
3773
3698
|
|
|
3774
3699
|
//#endregion
|
|
3775
3700
|
//#region ../core/src/venue-location.ts
|
|
3776
|
-
const venueLocationAudience = Symbol("venue-location-audience");
|
|
3777
3701
|
/** Eligibility to read the venue is decided by the resource owner before disclosure. */
|
|
3778
3702
|
function decidePublicVenueLocation(venue, siteCountry) {
|
|
3779
|
-
const audience = { [venueLocationAudience]: "public" };
|
|
3780
3703
|
if (venue.location === null) return {
|
|
3781
|
-
...audience,
|
|
3782
3704
|
kind: "none",
|
|
3783
3705
|
name: venue.name
|
|
3784
3706
|
};
|
|
3785
3707
|
if (venue.addressVisibility === "booked") {
|
|
3786
3708
|
return {
|
|
3787
|
-
...audience,
|
|
3788
3709
|
kind: "area",
|
|
3789
3710
|
name: venue.name,
|
|
3790
3711
|
area: deriveLocationArea(venue.location.address)
|
|
3791
3712
|
};
|
|
3792
3713
|
}
|
|
3793
3714
|
return {
|
|
3794
|
-
...audience,
|
|
3795
3715
|
kind: "full",
|
|
3796
3716
|
name: venue.name,
|
|
3797
3717
|
...projectPublicLocation(venue.location, siteCountry)
|
|
@@ -3799,19 +3719,39 @@ function decidePublicVenueLocation(venue, siteCountry) {
|
|
|
3799
3719
|
}
|
|
3800
3720
|
/** Caller must already hold confirmed-booking or staff authorisation. */
|
|
3801
3721
|
function decideArrivalVenueLocation(venue, siteCountry) {
|
|
3802
|
-
const audience = { [venueLocationAudience]: "arrival" };
|
|
3803
3722
|
return venue.location === null ? {
|
|
3804
|
-
...audience,
|
|
3805
3723
|
kind: "none",
|
|
3806
3724
|
name: venue.name
|
|
3807
3725
|
} : {
|
|
3808
|
-
...audience,
|
|
3809
3726
|
kind: "full",
|
|
3810
3727
|
name: venue.name,
|
|
3811
3728
|
...projectPublicLocation(venue.location, siteCountry)
|
|
3812
3729
|
};
|
|
3813
3730
|
}
|
|
3814
3731
|
|
|
3732
|
+
//#endregion
|
|
3733
|
+
//#region ../core/src/first-name.ts
|
|
3734
|
+
const NAME_TITLES = new Set([
|
|
3735
|
+
"dr",
|
|
3736
|
+
"mr",
|
|
3737
|
+
"mrs",
|
|
3738
|
+
"ms",
|
|
3739
|
+
"mx",
|
|
3740
|
+
"miss",
|
|
3741
|
+
"prof",
|
|
3742
|
+
"professor",
|
|
3743
|
+
"sir",
|
|
3744
|
+
"rev"
|
|
3745
|
+
]);
|
|
3746
|
+
/**
|
|
3747
|
+
* The name to use for someone in a sentence: "Jane" from "Dr. Jane Smith". A
|
|
3748
|
+
* title on its own is kept, since it's all we have. Empty when there's no name.
|
|
3749
|
+
*/
|
|
3750
|
+
function firstNameFrom(name) {
|
|
3751
|
+
const words = name.trim().split(/\s+/);
|
|
3752
|
+
return words.find((word) => !NAME_TITLES.has(word.toLowerCase().replace(/\.$/, ""))) ?? words[0] ?? "";
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3815
3755
|
//#endregion
|
|
3816
3756
|
//#region ../core/src/locationLinks.ts
|
|
3817
3757
|
/** Both outbound actions use the arrival pin, never match evidence. */
|
|
@@ -5468,6 +5408,16 @@ function publishedContactDetails(profile) {
|
|
|
5468
5408
|
};
|
|
5469
5409
|
return null;
|
|
5470
5410
|
}
|
|
5411
|
+
/** Public payloads and authoring previews publish the same permitted facts. */
|
|
5412
|
+
function publishedProfileFacts(profile, businessAddress) {
|
|
5413
|
+
return {
|
|
5414
|
+
publicProfile: {
|
|
5415
|
+
...profile,
|
|
5416
|
+
contact: publishedContactDetails(profile)
|
|
5417
|
+
},
|
|
5418
|
+
businessAddress: profile.addressVisibility === "shown" ? businessAddress : null
|
|
5419
|
+
};
|
|
5420
|
+
}
|
|
5471
5421
|
function parseAddressVisibility(value) {
|
|
5472
5422
|
if (value === undefined || value === null) return ok("shown");
|
|
5473
5423
|
if (value === "shown" || value === "hidden") return ok(value);
|
|
@@ -5534,6 +5484,15 @@ const openingHoursWeekdayLabels = {
|
|
|
5534
5484
|
saturday: "Saturday",
|
|
5535
5485
|
sunday: "Sunday"
|
|
5536
5486
|
};
|
|
5487
|
+
const shortWeekdayLabels = {
|
|
5488
|
+
monday: "Mon",
|
|
5489
|
+
tuesday: "Tue",
|
|
5490
|
+
wednesday: "Wed",
|
|
5491
|
+
thursday: "Thu",
|
|
5492
|
+
friday: "Fri",
|
|
5493
|
+
saturday: "Sat",
|
|
5494
|
+
sunday: "Sun"
|
|
5495
|
+
};
|
|
5537
5496
|
function formatOpeningHoursTime(value) {
|
|
5538
5497
|
const time = parseLocalScheduleTime(value);
|
|
5539
5498
|
return formatBookingCompactEnglishTime(toScheduledBookingDateTime({
|
|
@@ -5545,14 +5504,15 @@ function formatOpeningHoursTime(value) {
|
|
|
5545
5504
|
function formatDayHours(day) {
|
|
5546
5505
|
return day.kind === "closed" ? "Closed" : day.intervals.map((interval) => `${formatOpeningHoursTime(interval.opensAt)} to ${formatOpeningHoursTime(interval.closesAt)}`).join(", ");
|
|
5547
5506
|
}
|
|
5548
|
-
function weekdayRangeLabel(weekdays) {
|
|
5507
|
+
function weekdayRangeLabel(weekdays, style) {
|
|
5549
5508
|
const first = weekdays[0];
|
|
5550
5509
|
const last = weekdays[weekdays.length - 1];
|
|
5551
5510
|
if (!first || !last) return "";
|
|
5552
|
-
|
|
5511
|
+
const labels = style === "short" ? shortWeekdayLabels : openingHoursWeekdayLabels;
|
|
5512
|
+
return first === last ? labels[first] : `${labels[first]}${style === "short" ? "–" : " to "}${labels[last]}`;
|
|
5553
5513
|
}
|
|
5554
5514
|
/** Monday-first table rows; only adjacent days with identical ranges are grouped. */
|
|
5555
|
-
function formatOpeningHoursRows(hours) {
|
|
5515
|
+
function formatOpeningHoursRows(hours, options = {}) {
|
|
5556
5516
|
return (hours?.days ?? []).reduce((rows, day) => {
|
|
5557
5517
|
const text = formatDayHours(day);
|
|
5558
5518
|
const previous = rows[rows.length - 1];
|
|
@@ -5560,7 +5520,7 @@ function formatOpeningHoursRows(hours) {
|
|
|
5560
5520
|
const row = {
|
|
5561
5521
|
kind: day.kind,
|
|
5562
5522
|
weekdays,
|
|
5563
|
-
label: weekdayRangeLabel(weekdays),
|
|
5523
|
+
label: weekdayRangeLabel(weekdays, options.labels ?? "full"),
|
|
5564
5524
|
hours: text
|
|
5565
5525
|
};
|
|
5566
5526
|
return weekdays.length > 1 ? [...rows.slice(0, -1), row] : [...rows, row];
|
|
@@ -5615,6 +5575,13 @@ function isTipTapNode(value) {
|
|
|
5615
5575
|
function isCanonicalRichTextDoc(value) {
|
|
5616
5576
|
return isRecord$8(value) && hasOnlyKeys(value, rootKeys) && value.type === "doc" && Array.isArray(value.content) && isDenseArrayOf(value.content, isTipTapNode);
|
|
5617
5577
|
}
|
|
5578
|
+
/** Whether a document contains non-whitespace text, including in nested nodes. */
|
|
5579
|
+
function richTextHasText(document) {
|
|
5580
|
+
return document.content.some(nodeHasText);
|
|
5581
|
+
}
|
|
5582
|
+
function nodeHasText(node) {
|
|
5583
|
+
return Boolean(node.text?.trim()) || (node.content ?? []).some(nodeHasText);
|
|
5584
|
+
}
|
|
5618
5585
|
|
|
5619
5586
|
//#endregion
|
|
5620
5587
|
//#region ../core/src/mailing-list-identifiers.ts
|
|
@@ -6037,17 +6004,12 @@ function parseBoundedText(value, path, options) {
|
|
|
6037
6004
|
}
|
|
6038
6005
|
return text.length <= options.maxLength ? ok(text) : err(invalid(path, `Footer engagement copy must be ${options.maxLength} characters or fewer.`));
|
|
6039
6006
|
}
|
|
6040
|
-
function parseTreatment(value, path) {
|
|
6041
|
-
return value === "integrated" || value === "separate-row" ? ok(value) : err(invalid(path, "Footer engagement treatment is invalid."));
|
|
6042
|
-
}
|
|
6043
6007
|
function parseEngagementBase(value, base, path) {
|
|
6044
6008
|
const heading = parseBoundedText(value.heading, `${path}.heading`, { maxLength: 80 });
|
|
6045
6009
|
if (!heading.ok) return heading;
|
|
6046
6010
|
if (heading.value === null) {
|
|
6047
6011
|
return err(invalid(`${path}.heading`, "Footer engagement heading cannot be empty."));
|
|
6048
6012
|
}
|
|
6049
|
-
const treatment = parseTreatment(value.treatment, `${path}.treatment`);
|
|
6050
|
-
if (!treatment.ok) return treatment;
|
|
6051
6013
|
if (!isRecord$6(value.source)) {
|
|
6052
6014
|
return err(invalid(`${path}.source`, "Footer engagement source is invalid."));
|
|
6053
6015
|
}
|
|
@@ -6058,7 +6020,6 @@ function parseEngagementBase(value, base, path) {
|
|
|
6058
6020
|
return intro.ok ? ok({
|
|
6059
6021
|
...base,
|
|
6060
6022
|
heading: heading.value,
|
|
6061
|
-
treatment: treatment.value,
|
|
6062
6023
|
intro: intro.value
|
|
6063
6024
|
}) : intro;
|
|
6064
6025
|
}
|
|
@@ -6106,156 +6067,121 @@ function parseFooterEngagementSectionValue(value, sectionBase, path) {
|
|
|
6106
6067
|
}
|
|
6107
6068
|
|
|
6108
6069
|
//#endregion
|
|
6109
|
-
//#region ../core/src/footer-
|
|
6110
|
-
|
|
6111
|
-
const
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
/** The arrangement chooses presentation; the stored preference remains intact. */
|
|
6116
|
-
function effectiveFooterNavigationLayout(arrangement, stored) {
|
|
6117
|
-
return arrangement === "centred" ? "inline-wrap" : stored;
|
|
6118
|
-
}
|
|
6119
|
-
|
|
6120
|
-
//#endregion
|
|
6121
|
-
//#region ../core/src/footer-arrangement.ts
|
|
6122
|
-
const sectionKinds = [
|
|
6123
|
-
"brand",
|
|
6124
|
-
"supporting-text",
|
|
6125
|
-
"social-links",
|
|
6126
|
-
"navigation",
|
|
6127
|
-
"business-address",
|
|
6128
|
-
"contact",
|
|
6129
|
-
"opening-hours",
|
|
6130
|
-
"engagement",
|
|
6131
|
-
"legal-navigation",
|
|
6132
|
-
"legal"
|
|
6133
|
-
];
|
|
6134
|
-
const centredSectionKinds = [
|
|
6135
|
-
"brand",
|
|
6136
|
-
"supporting-text",
|
|
6137
|
-
"navigation",
|
|
6138
|
-
"contact",
|
|
6139
|
-
"business-address",
|
|
6140
|
-
"opening-hours",
|
|
6141
|
-
"social-links",
|
|
6142
|
-
"engagement",
|
|
6143
|
-
"legal-navigation",
|
|
6144
|
-
"legal"
|
|
6145
|
-
];
|
|
6146
|
-
/** Section ownership is exhaustive for both arrangements; content never changes placement. */
|
|
6147
|
-
const rowSectionGroups = {
|
|
6148
|
-
brand: "identity",
|
|
6149
|
-
"supporting-text": "identity",
|
|
6150
|
-
"social-links": "contact",
|
|
6151
|
-
navigation: "main-navigation",
|
|
6152
|
-
"business-address": "visit",
|
|
6153
|
-
contact: "contact",
|
|
6154
|
-
"opening-hours": "hours",
|
|
6155
|
-
engagement: "engagement",
|
|
6156
|
-
"legal-navigation": "legal-ending",
|
|
6157
|
-
legal: "legal-ending"
|
|
6158
|
-
};
|
|
6159
|
-
const centredSectionGroups = {
|
|
6160
|
-
...rowSectionGroups,
|
|
6161
|
-
contact: "visit",
|
|
6162
|
-
"opening-hours": "visit",
|
|
6163
|
-
"social-links": "social"
|
|
6164
|
-
};
|
|
6165
|
-
const rowGroupOrder = [
|
|
6166
|
-
"identity",
|
|
6167
|
-
"main-navigation",
|
|
6168
|
-
"visit",
|
|
6169
|
-
"hours",
|
|
6170
|
-
"contact",
|
|
6171
|
-
"engagement",
|
|
6172
|
-
"legal-ending"
|
|
6173
|
-
];
|
|
6174
|
-
const centredGroupOrder = [
|
|
6175
|
-
"identity",
|
|
6176
|
-
"main-navigation",
|
|
6177
|
-
"visit",
|
|
6178
|
-
"social",
|
|
6179
|
-
"engagement",
|
|
6180
|
-
"legal-ending"
|
|
6181
|
-
];
|
|
6182
|
-
const groupSlots = {
|
|
6183
|
-
identity: "head",
|
|
6184
|
-
"main-navigation": "navigation",
|
|
6185
|
-
visit: "contact",
|
|
6186
|
-
hours: "contact",
|
|
6187
|
-
contact: "contact",
|
|
6188
|
-
social: "social",
|
|
6189
|
-
engagement: "panel",
|
|
6190
|
-
"legal-ending": "base"
|
|
6191
|
-
};
|
|
6192
|
-
const regionSlots = {
|
|
6193
|
-
"engagement-row": "panel",
|
|
6194
|
-
main: "stack",
|
|
6195
|
-
bottom: "base"
|
|
6070
|
+
//#region ../core/src/footer-layout.ts
|
|
6071
|
+
/** The catalogue id and the rendered layout meet at this one total map. */
|
|
6072
|
+
const layouts = {
|
|
6073
|
+
"footer-beside-links": "beside-links",
|
|
6074
|
+
"footer-centred": "centred",
|
|
6075
|
+
"footer-compact": "compact"
|
|
6196
6076
|
};
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6077
|
+
function footerLayoutForLookId(id) {
|
|
6078
|
+
return layouts[id];
|
|
6079
|
+
}
|
|
6080
|
+
function footerLookIdForLayout(layout) {
|
|
6081
|
+
return `footer-${layout}`;
|
|
6082
|
+
}
|
|
6083
|
+
function decideFooterPresentation(facts, selection) {
|
|
6084
|
+
const small = facts.navigationGroupCount <= 1 && !facts.hasNavigationLabels && !facts.hasAddress && !facts.hasHours && !facts.hasEngagement;
|
|
6085
|
+
const offered = withoutCompactForLabelledGroups(facts, selection.offered);
|
|
6086
|
+
const stored = offeredStoredLayout(selection.stored, offered);
|
|
6087
|
+
const effective = small && stored === "beside-links" ? "compact" : stored;
|
|
6088
|
+
const cycle = offered.filter((layout) => !(small && layout === "beside-links" && offered.includes("compact")));
|
|
6089
|
+
const restriction = cycle.length === selection.offered.length ? null : small ? "small-footer" : "labelled-link-groups";
|
|
6200
6090
|
return {
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
return
|
|
6210
|
-
}
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
const
|
|
6216
|
-
return
|
|
6217
|
-
const groupSections = sections.filter((section) => owners[section.kind] === kind).sort((left, right) => sectionOrder.indexOf(left.kind) - sectionOrder.indexOf(right.kind));
|
|
6218
|
-
return groupSections.length === 0 ? [] : [{
|
|
6219
|
-
kind,
|
|
6220
|
-
placement: placementFor(kind, sections, policy),
|
|
6221
|
-
sections: groupSections,
|
|
6222
|
-
...centred ? { slot: groupSlots[kind] } : {}
|
|
6223
|
-
}];
|
|
6224
|
-
});
|
|
6091
|
+
effective,
|
|
6092
|
+
cycle,
|
|
6093
|
+
current: cycle.includes(effective) ? effective : stored,
|
|
6094
|
+
restriction
|
|
6095
|
+
};
|
|
6096
|
+
}
|
|
6097
|
+
/** A stored layout that's no longer offered draws the first offered one instead. */
|
|
6098
|
+
function offeredStoredLayout(stored, offered) {
|
|
6099
|
+
return stored === "compact" && !offered.includes("compact") ? offered[0] ?? stored : stored;
|
|
6100
|
+
}
|
|
6101
|
+
/** Compact strip flattens labelled link groups into one unlabelled row, so it
|
|
6102
|
+
* isn't offered for them unless it's the style's only layout. */
|
|
6103
|
+
function withoutCompactForLabelledGroups(facts, offered) {
|
|
6104
|
+
if (facts.navigationGroupCount < 2 || !facts.hasNavigationLabels) return offered;
|
|
6105
|
+
const rest = offered.filter((layout) => layout !== "compact");
|
|
6106
|
+
return rest.length > 0 ? rest : offered;
|
|
6225
6107
|
}
|
|
6226
6108
|
function footerMembershipKey(sections) {
|
|
6227
|
-
|
|
6228
|
-
rank: sectionKinds.indexOf(section.kind),
|
|
6229
|
-
value: section.kind === "engagement" ? `engagement:${section.treatment}` : section.kind
|
|
6230
|
-
})).sort((left, right) => left.rank - right.rank);
|
|
6231
|
-
return tokens.map(({ value }) => value).join("+") || "empty";
|
|
6232
|
-
}
|
|
6233
|
-
function renderRegion(kind, groups, policy) {
|
|
6234
|
-
if (groups.length === 0) return [];
|
|
6235
|
-
const columns = kind !== "main" || policy.arrangement === "centred" ? 1 : Math.max(1, Math.min(groups.filter((group) => group.placement !== "full-row").length, 5));
|
|
6236
|
-
return [{
|
|
6237
|
-
kind,
|
|
6238
|
-
columns,
|
|
6239
|
-
groups,
|
|
6240
|
-
...policy.arrangement === "centred" ? { slot: regionSlots[kind] } : {}
|
|
6241
|
-
}];
|
|
6109
|
+
return sections.map(({ kind }) => kind).sort().join("+") || "empty";
|
|
6242
6110
|
}
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6111
|
+
/**
|
|
6112
|
+
* Areas own content; the layout's CSS owns geometry. Each layout lists its areas
|
|
6113
|
+
* top to bottom, as the agreed mockups draw them:
|
|
6114
|
+
* - beside-links: the signup band on top, then the name beside the links, the
|
|
6115
|
+
* details strip and the base.
|
|
6116
|
+
* - centred: everything stacked down the middle, the signup as a tier under it,
|
|
6117
|
+
* then the details strip and the base.
|
|
6118
|
+
* - compact: one main area (its CSS puts the details and signup on a second
|
|
6119
|
+
* row), then the base. There's no band or strip.
|
|
6120
|
+
* Details go in a strip only when there's an address or opening hours to show;
|
|
6121
|
+
* a lone phone or email stays with the name (beside-links) or on the inline line.
|
|
6122
|
+
*/
|
|
6123
|
+
function planFooterLayout(renderable, input) {
|
|
6124
|
+
const sections = renderable.map(({ section }) => section).filter((section) => !(input.suppressSignup === true && section.kind === "engagement"));
|
|
6125
|
+
const pick = (kinds) => kinds.flatMap((kind) => sections.filter((section) => section.kind === kind));
|
|
6126
|
+
const group = (kind, slot, kinds) => {
|
|
6127
|
+
const members = pick(kinds);
|
|
6128
|
+
return members.length === 0 ? [] : [{
|
|
6129
|
+
kind,
|
|
6130
|
+
...slot ? { slot } : {},
|
|
6131
|
+
sections: members
|
|
6132
|
+
}];
|
|
6133
|
+
};
|
|
6134
|
+
const region = (slot, groups) => groups.length === 0 ? [] : [{
|
|
6135
|
+
slot,
|
|
6136
|
+
groups
|
|
6137
|
+
}];
|
|
6138
|
+
const hasStrip = input.layout !== "compact" && pick(["business-address", "opening-hours"]).length > 0;
|
|
6139
|
+
const details = group("visit", "details", [
|
|
6140
|
+
"business-address",
|
|
6141
|
+
"opening-hours",
|
|
6142
|
+
"contact"
|
|
6143
|
+
]);
|
|
6144
|
+
const links = group("main-navigation", "links", ["navigation"]);
|
|
6145
|
+
const signup = group("engagement", "signup", ["engagement"]);
|
|
6146
|
+
const social = group("social", "social", ["social-links"]);
|
|
6147
|
+
const base = region("base", group("legal-ending", undefined, ["legal-navigation", "legal"]));
|
|
6148
|
+
const strip = hasStrip ? region("strip", details) : [];
|
|
6149
|
+
const regions = (() => {
|
|
6150
|
+
switch (input.layout) {
|
|
6151
|
+
case "beside-links": return [
|
|
6152
|
+
...region("band", signup),
|
|
6153
|
+
...region("main", [...group("identity", "brand", [
|
|
6154
|
+
"brand",
|
|
6155
|
+
"supporting-text",
|
|
6156
|
+
...hasStrip ? [] : ["contact"],
|
|
6157
|
+
"social-links"
|
|
6158
|
+
]), ...links]),
|
|
6159
|
+
...strip,
|
|
6160
|
+
...base
|
|
6161
|
+
];
|
|
6162
|
+
case "centred": return [
|
|
6163
|
+
...region("main", [
|
|
6164
|
+
...group("identity", "brand", ["brand", "supporting-text"]),
|
|
6165
|
+
...links,
|
|
6166
|
+
...hasStrip ? [] : details,
|
|
6167
|
+
...social
|
|
6168
|
+
]),
|
|
6169
|
+
...region("band", signup),
|
|
6170
|
+
...strip,
|
|
6171
|
+
...base
|
|
6172
|
+
];
|
|
6173
|
+
case "compact": return [...region("main", [
|
|
6174
|
+
...group("identity", "brand", ["brand", "supporting-text"]),
|
|
6175
|
+
...links,
|
|
6176
|
+
...social,
|
|
6177
|
+
...details,
|
|
6178
|
+
...signup
|
|
6179
|
+
]), ...base];
|
|
6180
|
+
}
|
|
6181
|
+
})();
|
|
6251
6182
|
return {
|
|
6252
|
-
membershipKey: footerMembershipKey(
|
|
6253
|
-
regions
|
|
6254
|
-
...renderRegion("engagement-row", separateEngagement, policy),
|
|
6255
|
-
...renderRegion("main", mainGroups, policy),
|
|
6256
|
-
...renderRegion("bottom", legalGroups, policy)
|
|
6257
|
-
],
|
|
6258
|
-
mobileGroups: separateEngagement.length === 0 ? groups : [...separateEngagement, ...layoutGroups]
|
|
6183
|
+
membershipKey: footerMembershipKey(sections),
|
|
6184
|
+
regions
|
|
6259
6185
|
};
|
|
6260
6186
|
}
|
|
6261
6187
|
|
|
@@ -6598,10 +6524,21 @@ function repairTargetFor(section) {
|
|
|
6598
6524
|
};
|
|
6599
6525
|
}
|
|
6600
6526
|
}
|
|
6527
|
+
/**
|
|
6528
|
+
* The brand as the footer draws it. The owner picks the name, the logo, or
|
|
6529
|
+
* both; with no logo uploaded (or a stored brand that hid both, which is no
|
|
6530
|
+
* longer offered) the name shows.
|
|
6531
|
+
*/
|
|
6532
|
+
function brandAsShown(section, hasLogo) {
|
|
6533
|
+
return {
|
|
6534
|
+
...section,
|
|
6535
|
+
showTitle: section.showTitle || !(section.showLogo && hasLogo)
|
|
6536
|
+
};
|
|
6537
|
+
}
|
|
6601
6538
|
function resolveFooterSections(composition, availability$1) {
|
|
6602
6539
|
return composition.sections.filter((section) => section.selected).map((section) => isSectionRenderable(section, availability$1) ? {
|
|
6603
6540
|
kind: "renderable",
|
|
6604
|
-
section
|
|
6541
|
+
section: section.kind === "brand" ? brandAsShown(section, availability$1.hasLogo) : section
|
|
6605
6542
|
} : {
|
|
6606
6543
|
kind: "missing-source",
|
|
6607
6544
|
section,
|
|
@@ -6610,7 +6547,7 @@ function resolveFooterSections(composition, availability$1) {
|
|
|
6610
6547
|
}
|
|
6611
6548
|
function isSectionRenderable(section, availability$1) {
|
|
6612
6549
|
switch (section.kind) {
|
|
6613
|
-
case "brand": return
|
|
6550
|
+
case "brand": return true;
|
|
6614
6551
|
case "navigation": return availability$1.hasMainNavigation;
|
|
6615
6552
|
case "legal-navigation": return availability$1.hasLegalPolicyNavigation;
|
|
6616
6553
|
case "business-address": return availability$1.hasBusinessAddress;
|
|
@@ -8759,6 +8696,11 @@ const VERTICAL_DEFINITIONS = [
|
|
|
8759
8696
|
label: "Theatre or performing arts school",
|
|
8760
8697
|
description: "Classes, terms, workshops, performances, and lessons."
|
|
8761
8698
|
},
|
|
8699
|
+
{
|
|
8700
|
+
id: "arts_crafts",
|
|
8701
|
+
label: "Arts and crafts",
|
|
8702
|
+
description: "Pottery, painting, printmaking and making classes, courses and workshops."
|
|
8703
|
+
},
|
|
8762
8704
|
{
|
|
8763
8705
|
id: "community_wellbeing",
|
|
8764
8706
|
label: "Community or wellbeing centre",
|
|
@@ -8768,6 +8710,12 @@ const VERTICAL_DEFINITIONS = [
|
|
|
8768
8710
|
id: "venue_event_space",
|
|
8769
8711
|
label: "Venue or event space",
|
|
8770
8712
|
description: "Room, resource, or access bookings. Depends on the future capacity-booking domain."
|
|
8713
|
+
},
|
|
8714
|
+
{
|
|
8715
|
+
id: "something_else",
|
|
8716
|
+
label: "Something else",
|
|
8717
|
+
description: "Anything people book with you that doesn't fit the other choices.",
|
|
8718
|
+
describesBusiness: false
|
|
8771
8719
|
}
|
|
8772
8720
|
];
|
|
8773
8721
|
const VERTICAL_IDS = VERTICAL_DEFINITIONS.map(({ id }) => id);
|
|
@@ -8843,12 +8791,21 @@ const VERTICAL_BOOKING_PRESETS = [
|
|
|
8843
8791
|
verticalBookingPreset("performing_arts_school.workshops", "performing_arts_school", "workshop", "Workshop", "Workshops", "One-off workshops, masterclasses, or intensives."),
|
|
8844
8792
|
verticalBookingPreset("performing_arts_school.performances", "performing_arts_school", "performance", "Performance", "Performances", "Shows, showcases, productions, or ticketed performances."),
|
|
8845
8793
|
verticalBookingPreset("performing_arts_school.lessons", "performing_arts_school", "appointment", "Lesson", "Lessons", "One-to-one lessons, coaching, or audition prep."),
|
|
8794
|
+
verticalBookingPreset("arts_crafts.classes", "arts_crafts", "class", "Class", "Classes", "Regular weekly classes and open studio sessions."),
|
|
8795
|
+
verticalBookingPreset("arts_crafts.courses", "arts_crafts", "course", "Course", "Courses", "Multi-week courses that build a skill from the start."),
|
|
8796
|
+
verticalBookingPreset("arts_crafts.workshops", "arts_crafts", "workshop", "Workshop", "Workshops", "One-off workshops, taster sessions and make-and-take days."),
|
|
8797
|
+
verticalBookingPreset("arts_crafts.private_sessions", "arts_crafts", "appointment", "Private session", "Private sessions", "One-to-one tuition or small private group sessions."),
|
|
8846
8798
|
verticalBookingPreset("community_wellbeing.classes", "community_wellbeing", "class", "Class", "Classes", "Regular groups, sessions, practices, or weekly activities."),
|
|
8847
8799
|
verticalBookingPreset("community_wellbeing.workshops", "community_wellbeing", "workshop", "Workshop", "Workshops", "One-off workshops, talks, events, or gatherings."),
|
|
8848
8800
|
verticalBookingPreset("community_wellbeing.courses", "community_wellbeing", "course", "Course", "Courses", "Fixed-schedule courses, study groups, or multi-session programmes."),
|
|
8849
8801
|
verticalBookingPreset("community_wellbeing.appointments", "community_wellbeing", "appointment", "Appointment", "Appointments", "One-to-one appointments, consultations, or support sessions."),
|
|
8850
8802
|
verticalBookingPreset("community_wellbeing.retreats", "community_wellbeing", "retreat", "Retreat", "Retreats", "Multi-day or residential retreats."),
|
|
8851
|
-
verticalBookingPreset("venue_event_space.resource_hire", "venue_event_space", "appointment", "Hire slot", "Hire slots", "Future room, venue, and resource hire bookings.", "future")
|
|
8803
|
+
verticalBookingPreset("venue_event_space.resource_hire", "venue_event_space", "appointment", "Hire slot", "Hire slots", "Future room, venue, and resource hire bookings.", "future"),
|
|
8804
|
+
verticalBookingPreset("something_else.classes", "something_else", "class", "Class", "Classes", "Regular sessions that run every week, like an evening group or a Saturday morning drop-in."),
|
|
8805
|
+
verticalBookingPreset("something_else.courses", "something_else", "course", "Course", "Courses", "A set of sessions that people book together, like a six-week beginners' course."),
|
|
8806
|
+
verticalBookingPreset("something_else.workshops", "something_else", "workshop", "Workshop", "Workshops", "One-off sessions, like a taster evening or a hands-on day."),
|
|
8807
|
+
verticalBookingPreset("something_else.retreats", "something_else", "retreat", "Retreat", "Retreats", "A few days away together, like a weekend course with meals and somewhere to stay."),
|
|
8808
|
+
verticalBookingPreset("something_else.appointments", "something_else", "appointment", "Appointment", "Appointments", "One-to-one time that people book from your availability, like a private lesson.")
|
|
8852
8809
|
];
|
|
8853
8810
|
|
|
8854
8811
|
//#endregion
|
|
@@ -8857,6 +8814,7 @@ const DEFAULT_ONBOARDING_PRESET_ID_BY_VERTICAL = {
|
|
|
8857
8814
|
yoga_wellness: null,
|
|
8858
8815
|
fitness_pt: null,
|
|
8859
8816
|
dance_school: null,
|
|
8817
|
+
arts_crafts: null,
|
|
8860
8818
|
physiotherapy_physical_health: "physiotherapy_physical_health.appointments",
|
|
8861
8819
|
massage_bodywork: "massage_bodywork.treatments",
|
|
8862
8820
|
therapist_practitioner: null,
|
|
@@ -8868,7 +8826,8 @@ const DEFAULT_ONBOARDING_PRESET_ID_BY_VERTICAL = {
|
|
|
8868
8826
|
voice_singing: null,
|
|
8869
8827
|
performing_arts_school: null,
|
|
8870
8828
|
community_wellbeing: null,
|
|
8871
|
-
venue_event_space: null
|
|
8829
|
+
venue_event_space: null,
|
|
8830
|
+
something_else: null
|
|
8872
8831
|
};
|
|
8873
8832
|
const VERTICAL_ID_SET = new Set(VERTICAL_DEFINITIONS.map(({ id }) => id));
|
|
8874
8833
|
const VERTICAL_PRESET_ID_SET = new Set(VERTICAL_BOOKING_PRESETS.map((presetDefinition) => presetDefinition.id));
|
|
@@ -8885,6 +8844,16 @@ function getVerticalDefinition(verticalId) {
|
|
|
8885
8844
|
}
|
|
8886
8845
|
return definition;
|
|
8887
8846
|
}
|
|
8847
|
+
/**
|
|
8848
|
+
* How to name the business in prompts and sentences ("a dance school"). Null
|
|
8849
|
+
* when there's no business type, or when the owner picked a catch-all such as
|
|
8850
|
+
* "Something else", whose label describes the choice rather than the business.
|
|
8851
|
+
*/
|
|
8852
|
+
function getVerticalBusinessKindLabel(verticalId) {
|
|
8853
|
+
if (!verticalId) return null;
|
|
8854
|
+
const definition = getVerticalDefinition(verticalId);
|
|
8855
|
+
return definition.describesBusiness === false ? null : definition.label;
|
|
8856
|
+
}
|
|
8888
8857
|
function getVerticalPresetDefinition(presetId) {
|
|
8889
8858
|
const definition = VERTICAL_BOOKING_PRESETS.find((presetDefinition) => presetDefinition.id === presetId);
|
|
8890
8859
|
if (definition === undefined) {
|
|
@@ -9336,46 +9305,6 @@ const PORTAL_NAV_DEFAULT_LABELS = {
|
|
|
9336
9305
|
loggedIn: "My account"
|
|
9337
9306
|
};
|
|
9338
9307
|
|
|
9339
|
-
//#endregion
|
|
9340
|
-
//#region ../core/src/event-preset-vocabulary.ts
|
|
9341
|
-
const EVENT_PRESET_VOCABULARY = {
|
|
9342
|
-
event: {
|
|
9343
|
-
label: "Event",
|
|
9344
|
-
pluralLabel: "Events",
|
|
9345
|
-
description: "Any event, repeating or manually dated, that does not fit the other categories."
|
|
9346
|
-
},
|
|
9347
|
-
class: {
|
|
9348
|
-
label: "Class",
|
|
9349
|
-
pluralLabel: "Classes",
|
|
9350
|
-
description: "Regular scheduled classes and group sessions."
|
|
9351
|
-
},
|
|
9352
|
-
course: {
|
|
9353
|
-
label: "Course",
|
|
9354
|
-
pluralLabel: "Courses",
|
|
9355
|
-
description: "A fixed set of dates that people book together."
|
|
9356
|
-
},
|
|
9357
|
-
term: {
|
|
9358
|
-
label: "Term",
|
|
9359
|
-
pluralLabel: "Terms",
|
|
9360
|
-
description: "A fixed term of sessions that people book together."
|
|
9361
|
-
},
|
|
9362
|
-
workshop: {
|
|
9363
|
-
label: "Workshop",
|
|
9364
|
-
pluralLabel: "Workshops",
|
|
9365
|
-
description: "One-off workshops, day sessions, or special events."
|
|
9366
|
-
},
|
|
9367
|
-
retreat: {
|
|
9368
|
-
label: "Retreat",
|
|
9369
|
-
pluralLabel: "Retreats",
|
|
9370
|
-
description: "Multi-day or residential immersive experiences."
|
|
9371
|
-
},
|
|
9372
|
-
performance: {
|
|
9373
|
-
label: "Performance",
|
|
9374
|
-
pluralLabel: "Performances",
|
|
9375
|
-
description: "Audience-facing shows, concerts, recitals, or showcases."
|
|
9376
|
-
}
|
|
9377
|
-
};
|
|
9378
|
-
|
|
9379
9308
|
//#endregion
|
|
9380
9309
|
//#region ../core/src/event-catalogue.ts
|
|
9381
9310
|
/** Accepts validated settings; defaults and raw configuration parsing belong to the caller. */
|
|
@@ -9410,6 +9339,45 @@ function eventCatalogueChoices(catalogue) {
|
|
|
9410
9339
|
...EVENT_PRESET_VOCABULARY.event
|
|
9411
9340
|
}];
|
|
9412
9341
|
}
|
|
9342
|
+
/**
|
|
9343
|
+
* Whether a site can have courses but hasn't them on, and what ticking them in
|
|
9344
|
+
* Booking settings would change. A site with a business type chooses from that
|
|
9345
|
+
* type's list; a site without one chooses from the plain list of event types.
|
|
9346
|
+
*
|
|
9347
|
+
* A business type offering only appointments reads the plain list but shows no
|
|
9348
|
+
* tick-boxes for it, and its own Courses tick would replace that whole list. So
|
|
9349
|
+
* courses aren't offered there: turning on one type shouldn't take away others.
|
|
9350
|
+
*/
|
|
9351
|
+
function planTurningOnCourses(settings) {
|
|
9352
|
+
const catalogue = resolveEventCatalogue(settings);
|
|
9353
|
+
if (catalogue.entries.some(({ preset }) => preset === "course")) return { kind: "already_on" };
|
|
9354
|
+
const vertical = resolveSiteVerticalBookingConfig(settings.verticalConfig);
|
|
9355
|
+
if (!vertical.config.verticalId) return {
|
|
9356
|
+
kind: "turn_on",
|
|
9357
|
+
choice: {
|
|
9358
|
+
preset: "course",
|
|
9359
|
+
verticalPresetId: null,
|
|
9360
|
+
...EVENT_PRESET_VOCABULARY.course
|
|
9361
|
+
},
|
|
9362
|
+
settings: { eventTypePresets: [...settings.eventTypePresets, "course"] }
|
|
9363
|
+
};
|
|
9364
|
+
if (catalogue.source !== "business_profile") return { kind: "not_offered" };
|
|
9365
|
+
const course = getVerticalPresetSelectionOptions(settings.verticalConfig).filter(({ checked }) => !checked).map(({ preset }) => preset).filter(isEventSeriesVerticalPresetDefinition).find((preset) => eventPresetForVerticalPreset(preset) === "course");
|
|
9366
|
+
if (course === undefined) return { kind: "not_offered" };
|
|
9367
|
+
const selection = setVerticalPresetsSelected(settings.verticalConfig, [...vertical.config.selectedPresetIds, course.id]);
|
|
9368
|
+
if (!selection.ok) return { kind: "not_offered" };
|
|
9369
|
+
return {
|
|
9370
|
+
kind: "turn_on",
|
|
9371
|
+
choice: {
|
|
9372
|
+
preset: "course",
|
|
9373
|
+
verticalPresetId: course.id,
|
|
9374
|
+
label: course.label,
|
|
9375
|
+
pluralLabel: course.pluralLabel,
|
|
9376
|
+
description: course.description
|
|
9377
|
+
},
|
|
9378
|
+
settings: { verticalConfig: selection.config }
|
|
9379
|
+
};
|
|
9380
|
+
}
|
|
9413
9381
|
|
|
9414
9382
|
//#endregion
|
|
9415
9383
|
//#region ../core/src/business-vocabulary.ts
|
|
@@ -9417,8 +9385,9 @@ const person = (singular, plural) => ({
|
|
|
9417
9385
|
singular,
|
|
9418
9386
|
plural
|
|
9419
9387
|
});
|
|
9388
|
+
/** A site with no business type set doesn't say who leads its sessions. */
|
|
9420
9389
|
const GENERIC_BUSINESS_VOCABULARY = {
|
|
9421
|
-
person:
|
|
9390
|
+
person: null,
|
|
9422
9391
|
offeringsExample: "weekly classes, one-to-one sessions and the occasional workshop"
|
|
9423
9392
|
};
|
|
9424
9393
|
const BUSINESS_VOCABULARY_BY_VERTICAL = {
|
|
@@ -9474,6 +9443,10 @@ const BUSINESS_VOCABULARY_BY_VERTICAL = {
|
|
|
9474
9443
|
person: person("teacher", "teachers"),
|
|
9475
9444
|
offeringsExample: "weekly drama classes, holiday workshops and an end-of-term show"
|
|
9476
9445
|
},
|
|
9446
|
+
arts_crafts: {
|
|
9447
|
+
person: person("tutor", "tutors"),
|
|
9448
|
+
offeringsExample: "a weekly wheel-throwing class, a six-week printmaking course and Saturday taster workshops"
|
|
9449
|
+
},
|
|
9477
9450
|
community_wellbeing: {
|
|
9478
9451
|
person: person("facilitator", "facilitators"),
|
|
9479
9452
|
offeringsExample: "a weekly walking group, wellbeing workshops and drop-in support sessions"
|
|
@@ -9481,12 +9454,61 @@ const BUSINESS_VOCABULARY_BY_VERTICAL = {
|
|
|
9481
9454
|
venue_event_space: {
|
|
9482
9455
|
person: null,
|
|
9483
9456
|
offeringsExample: "room hire, community events and regular classes run by local teachers"
|
|
9457
|
+
},
|
|
9458
|
+
something_else: {
|
|
9459
|
+
person: person("teacher", "teachers"),
|
|
9460
|
+
offeringsExample: "weekly evening classes, a six-week beginners' course and the odd one-to-one session"
|
|
9484
9461
|
}
|
|
9485
9462
|
};
|
|
9486
|
-
/** A site with no business type set gets the generic vocabulary. */
|
|
9463
|
+
/** A site with no business type set gets the generic vocabulary, which names nobody. */
|
|
9487
9464
|
function resolveBusinessVocabulary(verticalId) {
|
|
9488
9465
|
return verticalId ? BUSINESS_VOCABULARY_BY_VERTICAL[verticalId] : GENERIC_BUSINESS_VOCABULARY;
|
|
9489
9466
|
}
|
|
9467
|
+
/** What the dashboard calls the person where the business type names nobody. */
|
|
9468
|
+
const TEAM_MEMBER_NOUN = person("team member", "team members");
|
|
9469
|
+
const indefiniteArticle = (word) => /^[aeiou]/i.test(word) ? "an" : "a";
|
|
9470
|
+
function businessPersonPhrases(noun) {
|
|
9471
|
+
const withArticle = `${indefiniteArticle(noun.singular)} ${noun.singular}`;
|
|
9472
|
+
return {
|
|
9473
|
+
singular: noun.singular,
|
|
9474
|
+
plural: noun.plural,
|
|
9475
|
+
singularLabel: capitalize(noun.singular),
|
|
9476
|
+
pluralLabel: capitalize(noun.plural),
|
|
9477
|
+
withArticle,
|
|
9478
|
+
chooseOne: `Choose ${withArticle}`,
|
|
9479
|
+
chooseAnother: `Choose another ${noun.singular}`,
|
|
9480
|
+
anyOne: `Any ${noun.singular}`,
|
|
9481
|
+
all: `All ${noun.plural}`
|
|
9482
|
+
};
|
|
9483
|
+
}
|
|
9484
|
+
/**
|
|
9485
|
+
* Dashboard copy always names someone: the business's word, or "team member"
|
|
9486
|
+
* where the business type names nobody (a venue, or no type set).
|
|
9487
|
+
*/
|
|
9488
|
+
function dashboardPersonPhrases(noun) {
|
|
9489
|
+
return businessPersonPhrases(noun ?? TEAM_MEMBER_NOUN);
|
|
9490
|
+
}
|
|
9491
|
+
function clientPersonPhrases(noun) {
|
|
9492
|
+
if (noun == null) {
|
|
9493
|
+
return {
|
|
9494
|
+
label: "Who with",
|
|
9495
|
+
chooseAnother: "Choose someone else",
|
|
9496
|
+
anyone: "Anyone who's free",
|
|
9497
|
+
chooseYours: "Choose who you'd like to see",
|
|
9498
|
+
withName: (name) => `With ${name}`,
|
|
9499
|
+
listLabel: () => "With"
|
|
9500
|
+
};
|
|
9501
|
+
}
|
|
9502
|
+
const singularLabel = capitalize(noun.singular);
|
|
9503
|
+
return {
|
|
9504
|
+
label: singularLabel,
|
|
9505
|
+
chooseAnother: `Choose another ${noun.singular}`,
|
|
9506
|
+
anyone: `Any ${noun.singular}`,
|
|
9507
|
+
chooseYours: `Choose your ${noun.singular}`,
|
|
9508
|
+
withName: (name) => `${singularLabel}: ${name}`,
|
|
9509
|
+
listLabel: (count) => count === 1 ? singularLabel : capitalize(noun.plural)
|
|
9510
|
+
};
|
|
9511
|
+
}
|
|
9490
9512
|
/** "Our trainers", or "The team" where nobody leads sessions or the type is unknown. */
|
|
9491
9513
|
function businessTeamPageTitle(verticalId) {
|
|
9492
9514
|
const people = verticalId ? BUSINESS_VOCABULARY_BY_VERTICAL[verticalId].person : null;
|
|
@@ -9509,6 +9531,10 @@ const TITLE_EXAMPLE_BY_PRESET = {
|
|
|
9509
9531
|
"dance_school.workshops": "e.g., Contemporary Intensive, Tap Masterclass",
|
|
9510
9532
|
"dance_school.private_lessons": "e.g., Private Ballet Lesson, Audition Coaching",
|
|
9511
9533
|
"dance_school.shows": "e.g., Winter Showcase, Summer Recital",
|
|
9534
|
+
"arts_crafts.classes": "e.g., Tuesday Evening Wheel Throwing, Open Studio",
|
|
9535
|
+
"arts_crafts.courses": "e.g., Six-Week Beginners Pottery, Lino Printing Course",
|
|
9536
|
+
"arts_crafts.workshops": "e.g., Make a Mug in a Day, Watercolour Taster",
|
|
9537
|
+
"arts_crafts.private_sessions": "e.g., One-to-One Wheel Lesson, Private Group Session",
|
|
9512
9538
|
"physiotherapy_physical_health.appointments": "e.g., Initial Assessment, Follow-Up Appointment",
|
|
9513
9539
|
"physiotherapy_physical_health.rehab_classes": "e.g., Weekly Back Care, Mobility and Strength Class",
|
|
9514
9540
|
"physiotherapy_physical_health.workshops": "e.g., Running Injury Prevention, Everyday Back Care",
|
|
@@ -9551,7 +9577,12 @@ const TITLE_EXAMPLE_BY_PRESET = {
|
|
|
9551
9577
|
"community_wellbeing.workshops": "e.g., Community Wellbeing Workshop, Grief Support Day",
|
|
9552
9578
|
"community_wellbeing.courses": "e.g., Mindfulness Course, Peer Support Programme",
|
|
9553
9579
|
"community_wellbeing.appointments": "e.g., Support Session, Initial Consultation",
|
|
9554
|
-
"community_wellbeing.retreats": "e.g., Community Retreat Weekend, Rest and Reflect Retreat"
|
|
9580
|
+
"community_wellbeing.retreats": "e.g., Community Retreat Weekend, Rest and Reflect Retreat",
|
|
9581
|
+
"something_else.classes": "e.g., Tuesday Evening Beginners, Saturday Morning Group",
|
|
9582
|
+
"something_else.courses": "e.g., Six-Week Beginners' Course, Next Steps Course",
|
|
9583
|
+
"something_else.workshops": "e.g., Saturday Taster Session, Hands-On Day",
|
|
9584
|
+
"something_else.retreats": "e.g., Weekend Away, Summer Residential",
|
|
9585
|
+
"something_else.appointments": "e.g., Private Lesson, One-to-One Session"
|
|
9555
9586
|
};
|
|
9556
9587
|
function verticalPresetTitleExample(presetId) {
|
|
9557
9588
|
return TITLE_EXAMPLE_BY_PRESET[presetId] ?? null;
|
|
@@ -10512,6 +10543,16 @@ const EMAIL_DEFINITIONS = {
|
|
|
10512
10543
|
perEvent: false,
|
|
10513
10544
|
templateStorage: true
|
|
10514
10545
|
},
|
|
10546
|
+
membership_ended: {
|
|
10547
|
+
wording: "editable",
|
|
10548
|
+
perEvent: false,
|
|
10549
|
+
templateStorage: true
|
|
10550
|
+
},
|
|
10551
|
+
membership_dates_changed: {
|
|
10552
|
+
wording: "editable",
|
|
10553
|
+
perEvent: false,
|
|
10554
|
+
templateStorage: true
|
|
10555
|
+
},
|
|
10515
10556
|
membership_payment_refund: {
|
|
10516
10557
|
wording: "editable",
|
|
10517
10558
|
perEvent: false,
|
|
@@ -10778,6 +10819,11 @@ const EMAIL_DEFINITIONS = {
|
|
|
10778
10819
|
perEvent: false,
|
|
10779
10820
|
templateStorage: false
|
|
10780
10821
|
},
|
|
10822
|
+
mailing_list_signup_failure: {
|
|
10823
|
+
wording: "fixed",
|
|
10824
|
+
perEvent: false,
|
|
10825
|
+
templateStorage: false
|
|
10826
|
+
},
|
|
10781
10827
|
form_owner_notification: {
|
|
10782
10828
|
wording: "fixed",
|
|
10783
10829
|
perEvent: false,
|
|
@@ -10818,6 +10864,11 @@ const EMAIL_DEFINITIONS = {
|
|
|
10818
10864
|
perEvent: false,
|
|
10819
10865
|
templateStorage: false
|
|
10820
10866
|
},
|
|
10867
|
+
auth_new_device: {
|
|
10868
|
+
wording: "fixed",
|
|
10869
|
+
perEvent: false,
|
|
10870
|
+
templateStorage: false
|
|
10871
|
+
},
|
|
10821
10872
|
auth_confirmation: {
|
|
10822
10873
|
wording: "fixed",
|
|
10823
10874
|
perEvent: false,
|
|
@@ -11072,4 +11123,129 @@ function decideBookingEmbedChange(current, change) {
|
|
|
11072
11123
|
}
|
|
11073
11124
|
|
|
11074
11125
|
//#endregion
|
|
11075
|
-
|
|
11126
|
+
//#region ../core/src/ownerAppointmentTime.ts
|
|
11127
|
+
/** Owners may waive public rules, but cannot waive real clashes or book into the past. */
|
|
11128
|
+
function decideOwnerAppointmentTime(proposed, rules, nowMs) {
|
|
11129
|
+
const start = Date.parse(proposed.startAt);
|
|
11130
|
+
const end = Date.parse(proposed.endAt);
|
|
11131
|
+
if (end <= start || !Number.isFinite(start) || !Number.isFinite(end) || end - start !== rules.service.durationMinutes * 6e4) {
|
|
11132
|
+
return {
|
|
11133
|
+
kind: "refused",
|
|
11134
|
+
reason: "invalid_time"
|
|
11135
|
+
};
|
|
11136
|
+
}
|
|
11137
|
+
if (start < nowMs - 3 * 6e4) return {
|
|
11138
|
+
kind: "refused",
|
|
11139
|
+
reason: "past"
|
|
11140
|
+
};
|
|
11141
|
+
const overlaps$1 = (window, from = start, to = end) => from < Date.parse(window.endAt) && to > Date.parse(window.startAt);
|
|
11142
|
+
if (rules.reservations.some((window) => overlaps$1(window))) return {
|
|
11143
|
+
kind: "refused",
|
|
11144
|
+
reason: "reservation_overlap"
|
|
11145
|
+
};
|
|
11146
|
+
if (rules.appointments.some((window) => overlaps$1(window))) return {
|
|
11147
|
+
kind: "refused",
|
|
11148
|
+
reason: "appointment_overlap"
|
|
11149
|
+
};
|
|
11150
|
+
const occupiedStart = start - rules.service.prepMinutes * 6e4;
|
|
11151
|
+
const occupiedEnd = end + rules.service.cleanupMinutes * 6e4;
|
|
11152
|
+
const breaks = {
|
|
11153
|
+
working_hours: !fitsWorkingTimes(proposed, rules),
|
|
11154
|
+
minimum_notice: start < nowMs + rules.bookingNotice.minLeadMinutes * 6e4,
|
|
11155
|
+
booking_window: rules.bookingNotice.maxBookingNoticeMinutes !== null && start > nowMs + rules.bookingNotice.maxBookingNoticeMinutes * 6e4,
|
|
11156
|
+
buffer: rules.occupiedWindows.some((window) => overlaps$1(window, occupiedStart, occupiedEnd)),
|
|
11157
|
+
closure: rules.closures.some((window) => overlaps$1(window, occupiedStart, occupiedEnd)),
|
|
11158
|
+
google_busy: rules.googleBusy.some((window) => overlaps$1(window, occupiedStart, occupiedEnd))
|
|
11159
|
+
};
|
|
11160
|
+
return {
|
|
11161
|
+
kind: "allowed",
|
|
11162
|
+
ruleBreaks: Object.keys(breaks).filter((key) => breaks[key])
|
|
11163
|
+
};
|
|
11164
|
+
}
|
|
11165
|
+
function regularRefusalFromBreaks(breaks) {
|
|
11166
|
+
if (breaks.includes("closure")) return "closure";
|
|
11167
|
+
if (breaks.includes("working_hours")) return "outside_hours";
|
|
11168
|
+
return breaks.includes("buffer") ? "too_close" : null;
|
|
11169
|
+
}
|
|
11170
|
+
/**
|
|
11171
|
+
* A regular time follows the owner's rule for a typed time, without the grid of
|
|
11172
|
+
* advertised starts. Nobody ticks "Book this time anyway" for each date, so what
|
|
11173
|
+
* the owner could confirm on a one-off refuses here instead. Booking notice is
|
|
11174
|
+
* waived because the owner has agreed these dates with the client.
|
|
11175
|
+
*/
|
|
11176
|
+
function decideRegularAppointmentTime(proposed, rules, nowMs) {
|
|
11177
|
+
const decision = decideOwnerAppointmentTime(proposed, rules, nowMs);
|
|
11178
|
+
if (decision.kind === "allowed") return regularRefusalFromBreaks(decision.ruleBreaks);
|
|
11179
|
+
switch (decision.reason) {
|
|
11180
|
+
case "reservation_overlap": return "held";
|
|
11181
|
+
case "appointment_overlap": return "booked";
|
|
11182
|
+
case "invalid_time":
|
|
11183
|
+
case "nonexistent_time":
|
|
11184
|
+
case "past": return "other";
|
|
11185
|
+
}
|
|
11186
|
+
}
|
|
11187
|
+
/** Whether a time starts on a fixed start, or sits wholly inside a working window. */
|
|
11188
|
+
function fitsWorkingTimes(proposed, times) {
|
|
11189
|
+
const start = Date.parse(proposed.startAt);
|
|
11190
|
+
const end = Date.parse(proposed.endAt);
|
|
11191
|
+
return Boolean(times.workingStarts?.some((value) => Date.parse(value) === start)) || times.workingWindows.some((window) => start >= Date.parse(window.startAt) && end <= Date.parse(window.endAt));
|
|
11192
|
+
}
|
|
11193
|
+
const OWNER_APPOINTMENT_RULE_COPY = {
|
|
11194
|
+
working_hours: "Outside working hours",
|
|
11195
|
+
minimum_notice: "Sooner than your minimum notice",
|
|
11196
|
+
booking_window: "Further ahead than you take bookings",
|
|
11197
|
+
buffer: "Too close to another appointment",
|
|
11198
|
+
closure: "During a closure or time off",
|
|
11199
|
+
google_busy: "Busy in Google Calendar"
|
|
11200
|
+
};
|
|
11201
|
+
const OWNER_APPOINTMENT_GOOGLE_UNAVAILABLE_COPY = "We couldn’t check Google Calendar, so this time might clash with something there.";
|
|
11202
|
+
const OWNER_APPOINTMENT_REFUSAL_COPY = {
|
|
11203
|
+
nonexistent_time: "The clocks go forward on this date, so that time is skipped. Choose another time.",
|
|
11204
|
+
invalid_time: "Choose a valid time for this service.",
|
|
11205
|
+
past: "That time has already passed.",
|
|
11206
|
+
appointment_overlap: "That time’s already booked.",
|
|
11207
|
+
reservation_overlap: "This time is held for another client’s regular session."
|
|
11208
|
+
};
|
|
11209
|
+
|
|
11210
|
+
//#endregion
|
|
11211
|
+
//#region ../core/src/ownerLocalStartAt.ts
|
|
11212
|
+
/** Owner-entered clock times must survive conversion without silently moving forward. */
|
|
11213
|
+
function ownerLocalStartAt(date, time, timezone) {
|
|
11214
|
+
try {
|
|
11215
|
+
const localDate = parseBookingLocalDate(date);
|
|
11216
|
+
const localTime = parseLocalScheduleTime(time);
|
|
11217
|
+
const zone = requireBookingTimeZone(timezone);
|
|
11218
|
+
const target = Date.UTC(localDate.year, localDate.month - 1, localDate.day, localTime.hour, localTime.minute, localTime.second);
|
|
11219
|
+
const converted = localScheduleDateTimeToUtcDate(localDate, localTime, zone);
|
|
11220
|
+
if (localClockMs(converted, zone) !== target) return { kind: "nonexistent" };
|
|
11221
|
+
const candidates = [
|
|
11222
|
+
-1,
|
|
11223
|
+
0,
|
|
11224
|
+
1
|
|
11225
|
+
].map((days) => {
|
|
11226
|
+
const probe = new Date(converted.getTime() + days * 864e5);
|
|
11227
|
+
return new Date(probe.getTime() + target - localClockMs(probe, zone));
|
|
11228
|
+
}).filter((candidate$1) => localClockMs(candidate$1, zone) === target);
|
|
11229
|
+
return {
|
|
11230
|
+
kind: "ok",
|
|
11231
|
+
startAt: new Date(Math.min(...candidates.map((candidate$1) => candidate$1.getTime()))).toISOString()
|
|
11232
|
+
};
|
|
11233
|
+
} catch {
|
|
11234
|
+
return { kind: "invalid" };
|
|
11235
|
+
}
|
|
11236
|
+
}
|
|
11237
|
+
function localClockMs(instant, timezone) {
|
|
11238
|
+
const date = getLocalScheduleDate(instant, timezone);
|
|
11239
|
+
const time = getLocalScheduleTime(instant, timezone);
|
|
11240
|
+
return Date.UTC(date.year, date.month - 1, date.day, time.hour, time.minute, time.second);
|
|
11241
|
+
}
|
|
11242
|
+
|
|
11243
|
+
//#endregion
|
|
11244
|
+
//#region ../core/src/event-occurrence-route-segment.ts
|
|
11245
|
+
/** Date and UUID segments are reserved by the event-occurrence route. */
|
|
11246
|
+
function isEventOccurrenceRouteSegment(segment) {
|
|
11247
|
+
return /^(?:\d{4}-\d{2}-\d{2}|[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})$/i.test(segment);
|
|
11248
|
+
}
|
|
11249
|
+
|
|
11250
|
+
//#endregion
|
|
11251
|
+
export { formatOpeningHoursRows as $, unsafeAsStoragePath as $n, businessCancellationRefusalCodes as $t, resolveWholeSeriesBookingPhase as A, unsafeAsBookingRequirementId as An, formatLocalScheduleDate as At, assessMailingListTargeting as B, parseDatedOfferingCapacityHoldId as Bn, toBookingTimeZone as Bt, getPublicReadCachePolicy as C, toNonNegativeCents as Cn, blockInteractionContextSchema as Cr, formatTimeRange as Ct, firstLiveRunSessionStartMs as D, parseCurrencyCode as Dn, buildBookingUtcDateWindow as Dt, CANCELLED_SESSION_STATUS as E, formatCurrencyAmount as En, toScheduledBookingDateTime as Et, slugify as F, parseSiteTermsVersionId as Fn, localScheduleTimePattern as Ft, parseMailingListProviderScope as G, unsafeAsFileChecksumSha256 as Gn, validateBookingPaymentOptionKinds as Gt, parseMailingListGlobalForm as H, parseMediaAssetId as Hn, parseUtcIsoDateTimeString as Ht, parseMailingListBlockId as I, parseMembershipId as In, parseBookingLocalDate as It, parseMailingListPlacementTargeting as J, unsafeAsPositiveByteCount as Jn, clampConfiguredAmount as Jt, parseFooterCompositionV1 as K, unsafeAsMediaAssetId as Kn, isLiveOrderInstalmentPlanStatus as Kt, parseMailingListContentVersionId as L, unsafeAsEntitlementId as Ln, parseLocalScheduleTime as Lt, createSecret as M, unsafeAsAppointmentResourceId as Mn, getBookingLocalDateKey as Mt, exposeSecret as N, unsafeAsStaffMemberId as Nn, getLocalScheduleDate as Nt, nextLiveRunSessionStartMs as O, assertNever as On, addLocalScheduleDays as Ot, parseManagementKey as P, parseCustomerId as Pn, getLocalScheduleTime as Pt, richTextHasText as Q, unsafeAsStorageBucketName as Qn, splitAmountWithRemainderInFirst as Qt, parseMailingListSignedSourceToken as R, unsafeAsPassId as Rn, resolveBookingBusinessTimeZone as Rt, PUBLIC_CONTENT_FRESHNESS_SECONDS as S, toCents as Sn, ok as Sr, formatTime as St, publicReadFreshnessSeconds as T, unsafeAsPositiveCents as Tn, resolveBookingDisplayContext as Tt, DEFAULT_MAILING_LIST_PRIVACY_NOTE as U, unsafeAsDeclaredMimeType as Un, toUtcIsoDateTimeString as Ut, parseConfiguredMailingListProvider as V, unsafeAsBookingSessionId as Vn, parseBookingTimeZone as Vt, DEFAULT_MAILING_LIST_SUCCESS_MESSAGE as W, unsafeAsDetectedMimeType as Wn, BOOKING_COURSE_INSTALMENT_DEADLINES as Wt, planMailingListChoicePresentation as X, unsafeAsSafeDownloadFilename as Xn, getBookingInstalmentPlanIntervalCount as Xt, DEFAULT_MAILING_LIST_TARGETING as Y, unsafeAsPositiveSeconds as Yn, getBookingInstalmentDepositRefundability as Yt, isCanonicalRichTextDoc as Z, unsafeAsSiteScopedStoragePath as Zn, omitZeroAmountFutureRows as Zt, EVENT_PRESET_VALUES as _, mapNonEmptyArray as _n, unsafeAsEventOfferingId as _r, selectCategoryView as _t, authoredValuesEqual as a, EVENT_PRESET_VOCABULARY as an, parseEditorSessionGeneration as ar, decideLocationSave as at, WHOLE_SERIES_EVENT_PRESET_VALUES as b, parseNonNegativeCents as bn, unsafeAsPricingOptionId as br, formatDateTime as bt, planTurningOnCourses as c, isPublicEventPricingOptionDisplayable as cn, parseApiKeyId as cr, locationValueSchema as ct, areConfiguredBookingVerticalConfigsEqual as d, publicEventPricingOptions as dn, unsafeAsSiteId as dr, projectPublicLocation as dt, scheduleBookingReasonCodes as en, unsafeAsUploadSessionId as er, parsePublicContactDetails as et, canonicalizeConfiguredBookingVerticalConfig as f, publicEventPricingStrategy as fn, unsafeAsUserId as fr, publicLocationSchema as ft, DEFAULT_EVENT_TYPE_PRESETS as g, fromArray as gn, unsafeAsEventInstanceId as gr, mapDrawingSchema as gt, resolveSiteVerticalBookingConfig as h, resolvePricingOptionsPriceDisplay as hn, unsafeAsEventCategoryId as hr, trimmedStringOrNull as ht, isRecord as i, parsePageSurfaceSubject as in, unsafeAsOrderPaymentPlanId as ir, SENSITIVE_COLLECTION_MODES as it, resolveWholeSeriesRunLifecycle as j, unsafeAsDemoCapability as jn, formatLocalScheduleTime as jt, orderedLiveRunSessions as k, formatDurationUnitLabel as kn, compareLocalScheduleDates as kt, resolveEventCatalogue as l, publicEventPricingCurrency as ln, parseSiteId as lr, normalizeLocationAddressText as lt, parseVerticalPresetId as m, resolveExactOrFreePriceDisplay as mn, parseRetiredCourseId as mr, isPresent as mt, OFFLINE_PAYMENT_METHODS as n, resolveFlexibleBalanceInitialPaymentCents as nn, unsafeAsCheckoutLineId as nr, assertAllowedPublicUrl as nt, creditProductUnitNoun as o, formatBookingPriceDisplay as on, parsePageId as or, stableJsonStringify as ot, parseVerticalId as p, publicEventPricingType as pn, parseEventSeriesId as pr, toLocationCoordinates as pt, footerLayoutForLookId as q, unsafeAsOriginalFilename as qn, addIntervalPreservingMonthAnchor as qt, committedWriteProofSchema as r, deriveTotalTicketQuantity as rn, unsafeAsOrderFlexibleBalanceContractId as rr, SENSITIVE_COLLECTION_CONFIRMATION_VERSION as rt, formatCreditProductUnits as s, formatEventPricing as sn, unsafeAsSiteFontId as sr, locationMapLinks as st, isEventOccurrenceRouteSegment as t, resolveFlexibleBalanceDueAt as tn, unsafeAsProductId as tr, parseWeeklyOpeningHours as tt, NAVIGATION_LOCATIONS as u, publicEventPricingDisplay as un, parseUserId as ur, parseLocationValue as ut, ORDINARY_EVENT_PRESET_VALUES as v, mapReadonlyNonEmptyArray as vn, unsafeAsEventSeriesId as vr, formatDate as vt, isPublicReadEndpoint as w, unsafeAsNonNegativeCents as wn, inferSiteDateLocale as wt, PUBLIC_AVAILABILITY_FRESHNESS_SECONDS as x, parsePositiveCents as xn, err as xr, formatDateTimeRange as xt, SURFACE_EVENT_PRESET_VALUES as y, isNonNegativeWholeCents as yn, unsafeAsOccurrenceId as yr, formatDateRange as yt, parseMailingListRuntimeContext as z, parseDatedOfferingCapacityHoldAuditRef as zn, resolveBookingTimeZoneId as zt };
|