@riverbankcms/sdk 0.67.0 → 0.68.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/README.md +21 -11
- package/dist/_dts/api/src/aiPlayground.d.ts +62 -14
- package/dist/_dts/api/src/billing.d.ts +7 -40
- package/dist/_dts/api/src/bookingManagementEndpoints.d.ts +4 -1
- package/dist/_dts/api/src/bookingOperations.d.ts +32 -1
- package/dist/_dts/api/src/endpoints.d.ts +7 -0
- package/dist/_dts/api/src/public/types.d.ts +1 -1
- package/dist/_dts/billing/src/components/index.d.ts +426 -0
- package/dist/_dts/blocks/src/PageRenderer.d.ts +4 -0
- package/dist/_dts/blocks/src/client.d.ts +6 -0
- package/dist/_dts/blocks/src/system/runtime/hooks/useAvailableDates.d.ts +1 -0
- package/dist/_dts/blocks/src/system/runtime/hooks/useAvailableSlots.d.ts +3 -1
- package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessBookingFlow.d.ts +140 -0
- package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessBookingFlow.state.d.ts +2 -0
- package/dist/_dts/blocks/src/system/runtime/hooks/useVisibleTabPolling.d.ts +10 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.default-ui.d.ts +8 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.headless.state.d.ts +484 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.state.d.ts +5 -2
- package/dist/_dts/sdk/src/bookings/index.d.ts +5 -2
- package/dist/_dts/sdk/src/bookings/types.d.ts +2 -0
- package/dist/_dts/sdk/src/cli/commands/push/scopes/commandBackedDatedOfferingScope.d.ts +32 -0
- package/dist/_dts/sdk/src/cli/commands/push/scopes/types.d.ts +5 -1
- package/dist/_dts/sdk/src/cli/site-commands/commandRuntime.d.ts +41 -11
- package/dist/_dts/sdk/src/cli/site-commands/commandRuntimeCompat.d.ts +21 -0
- package/dist/_dts/sdk/src/cli/site-commands/commandSurfaceDispatch.d.ts +27 -0
- package/dist/_dts/sdk/src/cli/site-commands/datedOfferingCommands.d.ts +56 -0
- package/dist/_dts/sdk/src/cli/site-commands/entryCommands.d.ts +3 -1
- package/dist/_dts/sdk/src/cli/site-commands/footerCommands.d.ts +7 -1
- package/dist/_dts/sdk/src/cli/site-commands/formCommands.d.ts +4 -8
- package/dist/_dts/sdk/src/cli/site-commands/index.d.ts +1 -0
- package/dist/_dts/sdk/src/cli/site-commands/navigationCommands.d.ts +4 -8
- package/dist/_dts/sdk/src/cli/site-commands/pageCommands.d.ts +4 -8
- package/dist/_dts/sdk/src/cli/site-commands/pushExecution.d.ts +14 -68
- package/dist/_dts/sdk/src/cli/site-commands/pushExecutionPlan.d.ts +8 -0
- package/dist/_dts/sdk/src/cli/site-commands/pushExecutionTypes.d.ts +97 -0
- package/dist/_dts/sdk/src/cli/site-commands/residualSettingsTrimming.d.ts +15 -0
- package/dist/_dts/sdk/src/cli/sync/index.d.ts +1 -0
- package/dist/_dts/sdk/src/cli/sync/syncResultAggregation.d.ts +4 -0
- package/dist/_dts/sdk/src/rendering/overrides.d.ts +2 -0
- package/dist/_dts/sdk/src/theme-bridge/ThemeBridgeProvider.d.ts +4 -4
- package/dist/_dts/sdk/src/theme-bridge/generateCssVars.d.ts +4 -12
- package/dist/_dts/sdk/src/theme-bridge/index.d.ts +1 -1
- package/dist/_dts/sdk/src/theme-bridge/types.d.ts +17 -9
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/_dts/site-commands/src/commands.d.ts +228 -1
- package/dist/_dts/site-commands/src/domain.d.ts +1 -1
- package/dist/_dts/site-commands/src/index.d.ts +1 -0
- package/dist/_dts/site-commands/src/metadata.d.ts +66 -1
- package/dist/_dts/site-commands/src/refContributions.d.ts +1 -0
- package/dist/_dts/site-commands/src/refs.d.ts +7 -1
- package/dist/_dts/{sdk/src/cli/merge-remote → site-commands/src}/stableJson.d.ts +2 -0
- package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
- package/dist/_dts/theme-core/src/index.d.ts +1 -1
- package/dist/_dts/theme-core/src/runtime/buildThemeRuntimeFromBridge.d.ts +30 -23
- package/dist/cli/index.mjs +1699 -766
- package/dist/client/bookings.mjs +5107 -3348
- package/dist/client/client.mjs +4004 -3522
- package/dist/client/hooks.mjs +14 -0
- package/dist/client/rendering/client.mjs +4185 -3721
- package/dist/client/rendering/islands.mjs +4317 -3853
- package/dist/client/rendering.mjs +4076 -3592
- package/dist/preview-next/before-render.mjs +14 -0
- package/dist/preview-next/client/runtime.mjs +2770 -2268
- package/dist/preview-next/middleware.mjs +14 -0
- package/dist/server/components.mjs +172 -58
- package/dist/server/config-validation.mjs +14 -0
- package/dist/server/config.mjs +14 -0
- package/dist/server/data.mjs +14 -0
- package/dist/server/index.mjs +15 -1
- package/dist/server/next.mjs +166 -52
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +174 -58
- package/dist/server/rendering.mjs +174 -58
- package/dist/server/routing.mjs +14 -0
- package/dist/server/server.mjs +15 -1
- package/dist/server/theme-bridge.mjs +1247 -4825
- package/dist/styles/index.css +38 -38
- package/package.json +1 -1
- package/dist/_dts/blocks/src/system/runtime/components/booking/DateTimeSelectionStep.d.ts +0 -18
- package/dist/_dts/blocks/src/system/runtime/components/booking/PaymentOptionSelectionStep.d.ts +0 -9
- package/dist/_dts/blocks/src/system/runtime/components/booking/ServiceResourceSelector.d.ts +0 -44
- package/dist/_dts/blocks/src/system/runtime/components/booking/ServiceResourceSelector.state.d.ts +0 -23
- package/dist/_dts/blocks/src/system/runtime/components/booking/ServiceSelectionStep.d.ts +0 -18
- package/dist/_dts/blocks/src/system/runtime/components/booking/slotDisplay.d.ts +0 -2
- package/dist/_dts/blocks/src/system/runtime/components/multi-step/MultiStepForm.d.ts +0 -21
- package/dist/_dts/blocks/src/system/runtime/components/multi-step/useMultiStep.d.ts +0 -15
- package/dist/_dts/blocks/src/system/runtime/components/multi-step/useMultiStep.state.d.ts +0 -51
- package/dist/_dts/blocks/src/system/runtime/hooks/useBookingSteps.d.ts +0 -22
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import { type BillingPlanId } from '../plans/types';
|
|
2
|
+
export type BillingComponentInterval = 'month' | 'year';
|
|
3
|
+
export type BillingComponentCurrencyCode = string;
|
|
4
|
+
export type BillingComponentId = string;
|
|
5
|
+
export type BillingComponentSiteId = string;
|
|
6
|
+
export type BillingComponentSiteDomainId = string;
|
|
7
|
+
export type BillingComponentKind = 'plan_base' | 'custom_site_price' | 'extra_site' | 'managed_domain_overage';
|
|
8
|
+
export type BillingComponentProposalPlan = Readonly<{
|
|
9
|
+
idempotencyKey: string;
|
|
10
|
+
pendingSourceKey: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
siteId: string | null;
|
|
13
|
+
kind: 'extra_site' | 'managed_domain_overage';
|
|
14
|
+
amountCents: number;
|
|
15
|
+
currency: string;
|
|
16
|
+
interval: BillingComponentInterval;
|
|
17
|
+
sourceEntity: BillingComponentSourceEntityPlan;
|
|
18
|
+
snapshotHash: string;
|
|
19
|
+
pricingSnapshot: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
export type BillingComponentSourceEntityPlan = Readonly<{
|
|
22
|
+
type: 'site';
|
|
23
|
+
id: string;
|
|
24
|
+
}> | Readonly<{
|
|
25
|
+
type: 'site_domain';
|
|
26
|
+
id: string | null;
|
|
27
|
+
}>;
|
|
28
|
+
export type BillingComponentOrigin = 'computed' | 'planned' | 'persisted';
|
|
29
|
+
export type BillingComponentPlanSource = Readonly<{
|
|
30
|
+
kind: 'plan';
|
|
31
|
+
planId: string;
|
|
32
|
+
}>;
|
|
33
|
+
export type BillingComponentSiteSource = Readonly<{
|
|
34
|
+
kind: 'site';
|
|
35
|
+
siteId: BillingComponentSiteId;
|
|
36
|
+
}>;
|
|
37
|
+
export type BillingComponentSiteDomainSource = Readonly<{
|
|
38
|
+
kind: 'site_domain';
|
|
39
|
+
siteId: BillingComponentSiteId;
|
|
40
|
+
siteDomainId: BillingComponentSiteDomainId;
|
|
41
|
+
}>;
|
|
42
|
+
export type BillingComponentSource = BillingComponentPlanSource | BillingComponentSiteSource | BillingComponentSiteDomainSource;
|
|
43
|
+
export type BillingComponentSourceForKind<TKind extends BillingComponentKind> = TKind extends 'plan_base' ? BillingComponentPlanSource : TKind extends 'custom_site_price' | 'extra_site' ? BillingComponentSiteSource : TKind extends 'managed_domain_overage' ? BillingComponentSiteDomainSource : never;
|
|
44
|
+
export type BillingComponentBase<TKind extends BillingComponentKind, TOrigin extends BillingComponentOrigin> = Readonly<{
|
|
45
|
+
origin: TOrigin;
|
|
46
|
+
kind: TKind;
|
|
47
|
+
source: BillingComponentSourceForKind<TKind>;
|
|
48
|
+
amountCents: number;
|
|
49
|
+
currency: BillingComponentCurrencyCode;
|
|
50
|
+
interval: BillingComponentInterval;
|
|
51
|
+
}>;
|
|
52
|
+
export type MacadamiaExtraSiteBillingComponentProposalPlan = BillingComponentProposalPlan & Readonly<{
|
|
53
|
+
kind: 'extra_site';
|
|
54
|
+
siteId: string;
|
|
55
|
+
sourceEntity: Readonly<{
|
|
56
|
+
type: 'site';
|
|
57
|
+
id: string;
|
|
58
|
+
}>;
|
|
59
|
+
pricingSnapshot: MacadamiaExtraSitePricingSnapshot;
|
|
60
|
+
}>;
|
|
61
|
+
export type ManagedDomainOverageBillingComponentProposalPlan<TPricingSnapshot = unknown> = BillingComponentProposalPlan & Readonly<{
|
|
62
|
+
kind: 'managed_domain_overage';
|
|
63
|
+
siteId: string;
|
|
64
|
+
sourceEntity: Readonly<{
|
|
65
|
+
type: 'site_domain';
|
|
66
|
+
id: string | null;
|
|
67
|
+
}>;
|
|
68
|
+
pricingSnapshot: TPricingSnapshot;
|
|
69
|
+
}>;
|
|
70
|
+
export type ComputedBillingComponent = (BillingComponentBase<'plan_base', 'computed'> & Readonly<{
|
|
71
|
+
label: string;
|
|
72
|
+
}>) | (BillingComponentBase<'custom_site_price', 'computed'> & Readonly<{
|
|
73
|
+
label: string;
|
|
74
|
+
}>);
|
|
75
|
+
export type PlannedPersistedBillingComponent = (BillingComponentBase<'extra_site', 'planned'> & Readonly<{
|
|
76
|
+
label: string;
|
|
77
|
+
}>) | (BillingComponentBase<'managed_domain_overage', 'planned'> & Readonly<{
|
|
78
|
+
label: string;
|
|
79
|
+
}>);
|
|
80
|
+
export type PersistedBillingComponent = BillingComponentBase<'extra_site', 'persisted'> | BillingComponentBase<'managed_domain_overage', 'persisted'>;
|
|
81
|
+
export type BillingComponent = ComputedBillingComponent | PlannedPersistedBillingComponent | PersistedBillingComponent;
|
|
82
|
+
export type BillingModelDecision = Readonly<{
|
|
83
|
+
kind: 'macadamia_user_plan';
|
|
84
|
+
reason: 'no_custom_site_prices';
|
|
85
|
+
}> | Readonly<{
|
|
86
|
+
kind: 'custom_site_billing';
|
|
87
|
+
reason: 'active_custom_site_prices';
|
|
88
|
+
}>;
|
|
89
|
+
export type BillingComponentResolution = Readonly<{
|
|
90
|
+
model: BillingModelDecision;
|
|
91
|
+
components: readonly BillingComponent[];
|
|
92
|
+
basePlanCents: number;
|
|
93
|
+
customSitePricesCents: number;
|
|
94
|
+
extraSiteCents: number;
|
|
95
|
+
recurringAddOnsCents: number;
|
|
96
|
+
totalCents: number;
|
|
97
|
+
}>;
|
|
98
|
+
export type BillingSiteCostBreakdown = Readonly<{
|
|
99
|
+
siteId: BillingComponentSiteId;
|
|
100
|
+
siteName: string;
|
|
101
|
+
costCents: number;
|
|
102
|
+
billingStartsAt: string | null;
|
|
103
|
+
}>;
|
|
104
|
+
export type BillingBasePricePlan = Readonly<{
|
|
105
|
+
amountCents: number;
|
|
106
|
+
currency: BillingComponentCurrencyCode;
|
|
107
|
+
isCustomPrice: boolean;
|
|
108
|
+
source: 'override' | 'base';
|
|
109
|
+
}>;
|
|
110
|
+
export type BillingTotalPricePlan = BillingBasePricePlan & Readonly<{
|
|
111
|
+
billingModel: BillingModelDecision;
|
|
112
|
+
basePlanCents: number;
|
|
113
|
+
customSitePricesCents: number;
|
|
114
|
+
extraSiteCents: number;
|
|
115
|
+
recurringAddOnsCents: number;
|
|
116
|
+
totalCents: number;
|
|
117
|
+
siteBreakdown: readonly BillingSiteCostBreakdown[];
|
|
118
|
+
componentBreakdown: readonly BillingComponent[];
|
|
119
|
+
}>;
|
|
120
|
+
export type BillingComponentCompatibilityMismatch = Readonly<{
|
|
121
|
+
tag: 'component_interval_currency_mismatch';
|
|
122
|
+
componentInterval: BillingComponentInterval;
|
|
123
|
+
requestedInterval: BillingComponentInterval;
|
|
124
|
+
componentCurrency: BillingComponentCurrencyCode;
|
|
125
|
+
requestedCurrency: BillingComponentCurrencyCode;
|
|
126
|
+
}>;
|
|
127
|
+
export type BillingTotalPricePlanError = Readonly<{
|
|
128
|
+
tag: 'base_price_required';
|
|
129
|
+
}> | Readonly<{
|
|
130
|
+
tag: 'hybrid_billing_forbidden';
|
|
131
|
+
customSiteIds: readonly string[];
|
|
132
|
+
extraSiteIds: readonly string[];
|
|
133
|
+
}>;
|
|
134
|
+
export type BillingTotalPricePlanResult = Readonly<{
|
|
135
|
+
success: true;
|
|
136
|
+
data: BillingTotalPricePlan;
|
|
137
|
+
}> | Readonly<{
|
|
138
|
+
success: false;
|
|
139
|
+
error: BillingTotalPricePlanError;
|
|
140
|
+
}>;
|
|
141
|
+
export type BillingComponentSummaryBase<TKind extends BillingComponentKind> = Readonly<{
|
|
142
|
+
kind: TKind;
|
|
143
|
+
label: string;
|
|
144
|
+
amountCents: number;
|
|
145
|
+
formatted: string;
|
|
146
|
+
interval: BillingComponentInterval;
|
|
147
|
+
}>;
|
|
148
|
+
export type BillingComponentSummaryBasePlanComponent = BillingComponentSummaryBase<'plan_base'> & Readonly<{
|
|
149
|
+
source: BillingComponentPlanSource;
|
|
150
|
+
}>;
|
|
151
|
+
export type BillingComponentSummarySiteComponent = BillingComponentSummaryBase<'custom_site_price'> & Readonly<{
|
|
152
|
+
source: BillingComponentSiteSource;
|
|
153
|
+
}>;
|
|
154
|
+
export type BillingComponentSummaryAddOnComponent = (BillingComponentSummaryBase<'extra_site'> & Readonly<{
|
|
155
|
+
source: BillingComponentSiteSource;
|
|
156
|
+
}>) | (BillingComponentSummaryBase<'managed_domain_overage'> & Readonly<{
|
|
157
|
+
source: BillingComponentSiteDomainSource;
|
|
158
|
+
}>);
|
|
159
|
+
export type BillingComponentSummaryComponent = BillingComponentSummaryBasePlanComponent | BillingComponentSummarySiteComponent | BillingComponentSummaryAddOnComponent;
|
|
160
|
+
export type BillingComponentSummary = Readonly<{
|
|
161
|
+
basePlan: BillingComponentSummaryBasePlanComponent | null;
|
|
162
|
+
sites: BillingComponentSummarySiteComponent[];
|
|
163
|
+
addOns: BillingComponentSummaryAddOnComponent[];
|
|
164
|
+
total: Readonly<{
|
|
165
|
+
amountCents: number;
|
|
166
|
+
formatted: string;
|
|
167
|
+
}>;
|
|
168
|
+
isCustomPrice: boolean;
|
|
169
|
+
}>;
|
|
170
|
+
export type BillingComponentSummaryError = Readonly<{
|
|
171
|
+
tag: 'missing_component_label';
|
|
172
|
+
componentKind: PersistedBillingComponent['kind'];
|
|
173
|
+
sourceId: string;
|
|
174
|
+
}>;
|
|
175
|
+
export type BillingComponentSummaryResult = Readonly<{
|
|
176
|
+
success: true;
|
|
177
|
+
data: BillingComponentSummary;
|
|
178
|
+
}> | Readonly<{
|
|
179
|
+
success: false;
|
|
180
|
+
error: BillingComponentSummaryError;
|
|
181
|
+
}>;
|
|
182
|
+
export type BillingComponentSummaryFormatter = (amountCents: number, currency: BillingComponentCurrencyCode) => string;
|
|
183
|
+
export type BillingComponentSummaryLabelRequirements = Readonly<{
|
|
184
|
+
extraSiteIds: readonly BillingComponentSiteId[];
|
|
185
|
+
siteDomainIds: readonly BillingComponentSiteDomainId[];
|
|
186
|
+
}>;
|
|
187
|
+
export type BillableSiteState = Readonly<{
|
|
188
|
+
tag: 'draft';
|
|
189
|
+
}> | Readonly<{
|
|
190
|
+
tag: 'billable_live';
|
|
191
|
+
launchedAt: string;
|
|
192
|
+
}> | Readonly<{
|
|
193
|
+
tag: 'not_billable';
|
|
194
|
+
reason: 'archived' | 'deleted';
|
|
195
|
+
}>;
|
|
196
|
+
export type BillableMacadamiaSite = Readonly<{
|
|
197
|
+
siteId: BillingComponentSiteId;
|
|
198
|
+
siteName: string;
|
|
199
|
+
state: BillableSiteState;
|
|
200
|
+
grandfathered?: boolean;
|
|
201
|
+
}>;
|
|
202
|
+
export type MacadamiaExtraSitePricingSnapshot = Readonly<{
|
|
203
|
+
formulaVersion: 'macadamia-extra-site-v1';
|
|
204
|
+
planId: BillingPlanId;
|
|
205
|
+
amountCents: number;
|
|
206
|
+
currency: BillingComponentCurrencyCode;
|
|
207
|
+
interval: BillingComponentInterval;
|
|
208
|
+
}>;
|
|
209
|
+
export type ExtraSitePricingPolicy = Readonly<{
|
|
210
|
+
includedSiteCount: number;
|
|
211
|
+
currency: BillingComponentCurrencyCode;
|
|
212
|
+
extraSite: Readonly<{
|
|
213
|
+
tag: 'not_supported';
|
|
214
|
+
}> | Readonly<{
|
|
215
|
+
tag: 'priced';
|
|
216
|
+
monthlyAmountCents: number;
|
|
217
|
+
}>;
|
|
218
|
+
}>;
|
|
219
|
+
export type ConfiguredExtraSitePricingPolicy = ExtraSitePricingPolicy & Readonly<{
|
|
220
|
+
extraSite: Readonly<{
|
|
221
|
+
tag: 'priced';
|
|
222
|
+
monthlyAmountCents: number;
|
|
223
|
+
}>;
|
|
224
|
+
}>;
|
|
225
|
+
export type ActiveExtraSiteComponentForReconciliation = Readonly<{
|
|
226
|
+
componentId: BillingComponentId;
|
|
227
|
+
siteId: BillingComponentSiteId;
|
|
228
|
+
amountCents: number;
|
|
229
|
+
currency: BillingComponentCurrencyCode;
|
|
230
|
+
interval: BillingComponentInterval;
|
|
231
|
+
}>;
|
|
232
|
+
export type MacadamiaExtraSiteReconciliationAction = Readonly<{
|
|
233
|
+
tag: 'requires_acceptance';
|
|
234
|
+
site: BillableMacadamiaSite;
|
|
235
|
+
amountCents: number;
|
|
236
|
+
currency: BillingComponentCurrencyCode;
|
|
237
|
+
interval: BillingComponentInterval;
|
|
238
|
+
}> | Readonly<{
|
|
239
|
+
tag: 'create_missing';
|
|
240
|
+
site: BillableMacadamiaSite;
|
|
241
|
+
amountCents: number;
|
|
242
|
+
currency: BillingComponentCurrencyCode;
|
|
243
|
+
interval: BillingComponentInterval;
|
|
244
|
+
}> | Readonly<{
|
|
245
|
+
tag: 'end_at_period_end';
|
|
246
|
+
component: ActiveExtraSiteComponentForReconciliation;
|
|
247
|
+
reason: 'site_no_longer_billable' | 'site_within_allowance' | 'site_grandfathered';
|
|
248
|
+
}> | Readonly<{
|
|
249
|
+
tag: 'invalid_state';
|
|
250
|
+
reason: 'duplicate_active_component';
|
|
251
|
+
siteId?: BillingComponentSiteId;
|
|
252
|
+
}> | Readonly<{
|
|
253
|
+
tag: 'requires_plan_upgrade';
|
|
254
|
+
site: BillableMacadamiaSite;
|
|
255
|
+
minimumPlanId: 'solo';
|
|
256
|
+
}>;
|
|
257
|
+
export type MacadamiaExtraSiteReconciliationPlan = Readonly<{
|
|
258
|
+
tag: 'no_change';
|
|
259
|
+
}> | Readonly<{
|
|
260
|
+
tag: 'changes_required';
|
|
261
|
+
actions: readonly MacadamiaExtraSiteReconciliationAction[];
|
|
262
|
+
}>;
|
|
263
|
+
export type MacadamiaExtraSiteLaunchDecision = Readonly<{
|
|
264
|
+
tag: 'allowed';
|
|
265
|
+
reason: 'within_included_allowance';
|
|
266
|
+
}> | Readonly<{
|
|
267
|
+
tag: 'allowed';
|
|
268
|
+
reason: 'accepted_extra_site_component';
|
|
269
|
+
componentId?: BillingComponentId;
|
|
270
|
+
}> | Readonly<{
|
|
271
|
+
tag: 'requires_plan_upgrade';
|
|
272
|
+
currentPlanId: BillingPlanId;
|
|
273
|
+
minimumPlanId: 'solo';
|
|
274
|
+
}> | Readonly<{
|
|
275
|
+
tag: 'requires_acceptance';
|
|
276
|
+
currentPlanId: BillingPlanId;
|
|
277
|
+
amountCents: number;
|
|
278
|
+
currency: BillingComponentCurrencyCode;
|
|
279
|
+
interval: BillingComponentInterval;
|
|
280
|
+
}>;
|
|
281
|
+
export type MacadamiaSiteCreationBillingNotice = Readonly<{
|
|
282
|
+
tag: 'none';
|
|
283
|
+
reason: 'within_included_allowance' | 'accepted_extra_site_component';
|
|
284
|
+
}> | Readonly<{
|
|
285
|
+
tag: 'unknown';
|
|
286
|
+
reason: 'billing_lookup_failed';
|
|
287
|
+
}> | Readonly<{
|
|
288
|
+
tag: 'upgrade_required_on_launch';
|
|
289
|
+
currentPlanId: BillingPlanId;
|
|
290
|
+
minimumPlanId: 'solo';
|
|
291
|
+
}> | Readonly<{
|
|
292
|
+
tag: 'extra_site_charge_on_launch';
|
|
293
|
+
currentPlanId: BillingPlanId;
|
|
294
|
+
amountCents: number;
|
|
295
|
+
currency: BillingComponentCurrencyCode;
|
|
296
|
+
interval: BillingComponentInterval;
|
|
297
|
+
}>;
|
|
298
|
+
export type MacadamiaExtraSiteProposalDecisionPlan = Extract<MacadamiaExtraSiteLaunchDecision, {
|
|
299
|
+
tag: 'requires_acceptance';
|
|
300
|
+
}>;
|
|
301
|
+
export declare function resolveBillableSiteState(input: Readonly<{
|
|
302
|
+
launchedAt: string | null;
|
|
303
|
+
archivedAt?: string | null;
|
|
304
|
+
deletedAt?: string | null;
|
|
305
|
+
}>): BillableSiteState;
|
|
306
|
+
export declare function classifyBillingModel(input: Readonly<{
|
|
307
|
+
customSitePrices: readonly BillingComponent[];
|
|
308
|
+
}>): BillingModelDecision;
|
|
309
|
+
export declare function planExtraSiteComponents(input: Readonly<{
|
|
310
|
+
sites: readonly BillableMacadamiaSite[];
|
|
311
|
+
policy: ConfiguredExtraSitePricingPolicy;
|
|
312
|
+
interval?: BillingComponentInterval;
|
|
313
|
+
}>): readonly BillingComponent[];
|
|
314
|
+
export declare function planMacadamiaExtraSiteReconciliation(input: Readonly<{
|
|
315
|
+
sites: readonly BillableMacadamiaSite[];
|
|
316
|
+
activeExtraSiteComponents: readonly ActiveExtraSiteComponentForReconciliation[];
|
|
317
|
+
acceptedSiteIds?: readonly BillingComponentSiteId[];
|
|
318
|
+
policy: ExtraSitePricingPolicy;
|
|
319
|
+
interval?: BillingComponentInterval;
|
|
320
|
+
}>): MacadamiaExtraSiteReconciliationPlan;
|
|
321
|
+
export declare function evaluateMacadamiaExtraSiteLaunchDecision(input: Readonly<{
|
|
322
|
+
siteId: BillingComponentSiteId;
|
|
323
|
+
currentPlanId: BillingPlanId;
|
|
324
|
+
currentLiveSiteCount: number;
|
|
325
|
+
acceptedExtraSiteComponents?: readonly Readonly<{
|
|
326
|
+
siteId: BillingComponentSiteId;
|
|
327
|
+
componentId?: BillingComponentId;
|
|
328
|
+
}>[];
|
|
329
|
+
policy: ExtraSitePricingPolicy;
|
|
330
|
+
interval?: BillingComponentInterval;
|
|
331
|
+
}>): MacadamiaExtraSiteLaunchDecision;
|
|
332
|
+
export declare function macadamiaExtraSiteLaunchDecisionToCreationBillingNotice(decision: MacadamiaExtraSiteLaunchDecision): MacadamiaSiteCreationBillingNotice;
|
|
333
|
+
export declare function evaluateMacadamiaSiteCreationBillingNotice(input: Readonly<{
|
|
334
|
+
currentPlanId: BillingPlanId;
|
|
335
|
+
currentLiveSiteCount: number;
|
|
336
|
+
policy: ExtraSitePricingPolicy;
|
|
337
|
+
interval?: BillingComponentInterval;
|
|
338
|
+
}>): MacadamiaSiteCreationBillingNotice;
|
|
339
|
+
export declare function resolveBillingComponents(input: Readonly<{
|
|
340
|
+
basePlan: BillingComponent;
|
|
341
|
+
customSitePrices: readonly BillingComponent[];
|
|
342
|
+
extraSites?: readonly BillingComponent[];
|
|
343
|
+
recurringAddOns?: readonly BillingComponent[];
|
|
344
|
+
}>): BillingComponentResolution;
|
|
345
|
+
export declare function partitionPersistedBillingComponents(components: readonly PersistedBillingComponent[]): Readonly<{
|
|
346
|
+
extraSites: readonly PersistedBillingComponent[];
|
|
347
|
+
recurringAddOns: readonly PersistedBillingComponent[];
|
|
348
|
+
}>;
|
|
349
|
+
export declare function toBillingSiteCostBreakdown(input: Readonly<{
|
|
350
|
+
siteId: string;
|
|
351
|
+
siteName: string;
|
|
352
|
+
monthlyCostCents: number;
|
|
353
|
+
billingStartsAt: string | null;
|
|
354
|
+
}>): BillingSiteCostBreakdown;
|
|
355
|
+
export declare function planCustomSitePriceComponents(input: Readonly<{
|
|
356
|
+
siteBreakdown: readonly BillingSiteCostBreakdown[];
|
|
357
|
+
currency: BillingComponentCurrencyCode;
|
|
358
|
+
interval: BillingComponentInterval;
|
|
359
|
+
}>): readonly BillingComponent[];
|
|
360
|
+
export declare function validateBillingComponentCompatibility(input: Readonly<{
|
|
361
|
+
component: BillingComponent;
|
|
362
|
+
requestedInterval: BillingComponentInterval;
|
|
363
|
+
requestedCurrency: BillingComponentCurrencyCode;
|
|
364
|
+
}>): BillingComponentCompatibilityMismatch | null;
|
|
365
|
+
export declare function planBillingTotalPrice(input: Readonly<{
|
|
366
|
+
planId: string;
|
|
367
|
+
interval: BillingComponentInterval;
|
|
368
|
+
currency: BillingComponentCurrencyCode;
|
|
369
|
+
siteBreakdown: readonly BillingSiteCostBreakdown[];
|
|
370
|
+
persistedComponents: readonly PersistedBillingComponent[];
|
|
371
|
+
basePrice?: BillingBasePricePlan;
|
|
372
|
+
}>): BillingTotalPricePlanResult;
|
|
373
|
+
export declare function getBillingComponentSummaryLabelRequirements(components: readonly BillingComponent[]): BillingComponentSummaryLabelRequirements;
|
|
374
|
+
export declare function buildBillingComponentSummary(input: Readonly<{
|
|
375
|
+
components: readonly BillingComponent[];
|
|
376
|
+
totalCents: number;
|
|
377
|
+
totalCurrency: BillingComponentCurrencyCode;
|
|
378
|
+
isCustomPrice: boolean;
|
|
379
|
+
persistedLabels: ReadonlyMap<string, string>;
|
|
380
|
+
formatAmount: BillingComponentSummaryFormatter;
|
|
381
|
+
}>): BillingComponentSummaryResult;
|
|
382
|
+
export declare function toBillingComponentSummaryComponent(component: BillingComponent, persistedLabels: ReadonlyMap<string, string>, formatAmount: BillingComponentSummaryFormatter): Readonly<{
|
|
383
|
+
success: true;
|
|
384
|
+
data: BillingComponentSummaryComponent;
|
|
385
|
+
} | {
|
|
386
|
+
success: false;
|
|
387
|
+
error: BillingComponentSummaryError;
|
|
388
|
+
}>;
|
|
389
|
+
export declare function isBillingComponentSummaryBasePlanComponent(component: BillingComponentSummaryComponent): component is BillingComponentSummaryBasePlanComponent;
|
|
390
|
+
export declare function isBillingComponentSummarySiteComponent(component: BillingComponentSummaryComponent): component is BillingComponentSummarySiteComponent;
|
|
391
|
+
export declare function isBillingComponentSummaryAddOnComponent(component: BillingComponentSummaryComponent): component is BillingComponentSummaryAddOnComponent;
|
|
392
|
+
export declare function persistedBillingComponentLabelKey(component: PersistedBillingComponent): string;
|
|
393
|
+
export declare function persistedBillingComponentLabelKey(kind: PersistedBillingComponent['kind'], sourceId: string): string;
|
|
394
|
+
export declare function parseMacadamiaExtraSitePricingSnapshot(value: unknown): MacadamiaExtraSitePricingSnapshot | null;
|
|
395
|
+
export declare function buildMacadamiaExtraSitePricingSnapshot(decision: MacadamiaExtraSiteProposalDecisionPlan): MacadamiaExtraSitePricingSnapshot;
|
|
396
|
+
export declare function buildMacadamiaExtraSiteProposalPlan(input: Readonly<{
|
|
397
|
+
billingUserId: string;
|
|
398
|
+
siteId: string;
|
|
399
|
+
decision: MacadamiaExtraSiteProposalDecisionPlan;
|
|
400
|
+
}>): MacadamiaExtraSiteBillingComponentProposalPlan;
|
|
401
|
+
export type BillingComponentProposalPlanBranding<TIdempotencyKey, TPendingSourceKey, TUserId, TSiteId, TSnapshotHash, TPricingSnapshot> = Readonly<{
|
|
402
|
+
idempotencyKey: (value: string) => TIdempotencyKey;
|
|
403
|
+
pendingSourceKey: (value: string) => TPendingSourceKey;
|
|
404
|
+
userId: (value: string) => TUserId;
|
|
405
|
+
siteId: (value: string) => TSiteId;
|
|
406
|
+
snapshotHash: (value: string) => TSnapshotHash;
|
|
407
|
+
pricingSnapshot: (value: unknown) => TPricingSnapshot;
|
|
408
|
+
}>;
|
|
409
|
+
export type BillingComponentProposalPricingSnapshotParser<TPricingSnapshot> = (value: unknown) => TPricingSnapshot | null;
|
|
410
|
+
export type BrandedBillingComponentProposalPlan<TIdempotencyKey, TPendingSourceKey, TUserId, TSiteId, TSnapshotHash, TPricingSnapshot> = Omit<BillingComponentProposalPlan, 'idempotencyKey' | 'pendingSourceKey' | 'userId' | 'siteId' | 'snapshotHash' | 'pricingSnapshot'> & Readonly<{
|
|
411
|
+
idempotencyKey: TIdempotencyKey;
|
|
412
|
+
pendingSourceKey: TPendingSourceKey;
|
|
413
|
+
userId: TUserId;
|
|
414
|
+
siteId: TSiteId | null;
|
|
415
|
+
snapshotHash: TSnapshotHash;
|
|
416
|
+
pricingSnapshot: TPricingSnapshot;
|
|
417
|
+
}>;
|
|
418
|
+
export declare function asBillingComponentProposalPlan<TIdempotencyKey, TPendingSourceKey, TUserId, TSiteId, TSnapshotHash, TPricingSnapshot>(plan: BillingComponentProposalPlan, brand: BillingComponentProposalPlanBranding<TIdempotencyKey, TPendingSourceKey, TUserId, TSiteId, TSnapshotHash, TPricingSnapshot>): BrandedBillingComponentProposalPlan<TIdempotencyKey, TPendingSourceKey, TUserId, TSiteId, TSnapshotHash, TPricingSnapshot>;
|
|
419
|
+
/**
|
|
420
|
+
* Fail-fast guard for static proposal brand adapters. The parser boundary should
|
|
421
|
+
* be wired during service construction, so returning a Result would only move a
|
|
422
|
+
* programming/configuration error into every runtime caller.
|
|
423
|
+
*/
|
|
424
|
+
export declare function asBillingComponentProposalPricingSnapshot<TPricingSnapshot>(value: unknown, parse: BillingComponentProposalPricingSnapshotParser<TPricingSnapshot>, description?: string): TPricingSnapshot;
|
|
425
|
+
export declare function hashBillingComponentSnapshot(snapshot: unknown): string;
|
|
426
|
+
export declare function stableJson(value: unknown): string;
|
|
@@ -86,6 +86,10 @@ export type BlockOverrideProps<TContent = Record<string, unknown>> = {
|
|
|
86
86
|
data?: Record<string, unknown>;
|
|
87
87
|
/** Site UUID (useful for media URL resolution in override components) */
|
|
88
88
|
siteId?: string;
|
|
89
|
+
/** Dashboard API URL for client-side block runtime calls. */
|
|
90
|
+
apiBaseUrl?: string;
|
|
91
|
+
/** Customer portal token for Bearer-authenticated block runtime calls. */
|
|
92
|
+
portalToken?: string | null;
|
|
89
93
|
/** Supabase project URL (useful for media URL resolution in override components) */
|
|
90
94
|
supabaseUrl?: string;
|
|
91
95
|
/** Full image-resolution context including canonical media sidecars. */
|
|
@@ -10,11 +10,14 @@
|
|
|
10
10
|
export { BlockApiProvider, useBlockApi, type BlockApiConfig } from './system/runtime/api';
|
|
11
11
|
export { clientComponentRegistry } from './system/runtime/components/registry.client';
|
|
12
12
|
export type { ComponentRegistry } from './system/runtime/resolver';
|
|
13
|
+
export type { BookingPaymentOptionViewModel, BookingPaymentSelectionViewModel, } from './system/runtime/shared/bookingPaymentOptions';
|
|
13
14
|
export { enhanceHeaderSection } from './system/runtime/header/enhanceHeaderSection';
|
|
14
15
|
export { ClientThemeScope } from '@riverbankcms/theme-core/ClientThemeScope';
|
|
15
16
|
export { ImageResolveContextProvider, useImageResolveContextOptional, } from './system/runtime/nodes/ImageResolveContext';
|
|
16
17
|
export { FormNodeClient } from './system/runtime/nodes/form.client';
|
|
17
18
|
export { BookingFormClient } from './system/runtime/nodes/booking-form.client';
|
|
19
|
+
export { HeadlessBookingProvider, createBookingBlockApiConfig, useHeadlessBookingFlow, } from './system/runtime/hooks/useHeadlessBookingFlow';
|
|
20
|
+
export { AltchaWidget as HeadlessBookingAltchaWidget } from '@riverbankcms/altcha/client';
|
|
18
21
|
export { EventRegistrationClient, EventRegistrationIslandClient } from './system/runtime/nodes/event-registration.client';
|
|
19
22
|
export { EventDetailsClient, EventDetailsIslandClient } from './system/runtime/nodes/event-details.client';
|
|
20
23
|
export { LocationMapClient, LocationMapIslandClient } from './system/runtime/nodes/location-map.client';
|
|
@@ -25,6 +28,9 @@ export { normalizeCarouselProps } from './system/runtime/nodes/carousel.client';
|
|
|
25
28
|
export type { CarouselNodeClientProps, NormalizedCarouselProps, ResponsiveSlidesToShow, } from './system/runtime/nodes/carousel.client';
|
|
26
29
|
export { MediaNode, type MediaNodeProps } from './system/runtime/nodes/media.client';
|
|
27
30
|
export type { BookingFormClientProps, FormConfig as BookingFormConfig, Service as BookingService, } from './system/runtime/nodes/booking-form.client';
|
|
31
|
+
export type { BookingAvailabilityModel, BookingAppointmentPackagesModel, BookingDiscountModel, BookingFieldsModel, BookingFlowActions, BookingPaymentModel, BookingResourcesModel, BookingServicesModel, BookingSpamProtectionModel, HeadlessBookingFlow, HeadlessBookingFlowOptions, HeadlessBookingProviderProps, } from './system/runtime/hooks/useHeadlessBookingFlow';
|
|
32
|
+
export type { AppointmentBookingOverrideData, AppointmentBookingOverrideInput, AppointmentBookingOverrideInputResult, AppointmentBookingOverridePropsLike, BookingAvailabilityQuery, BookingAppointmentPackagesUnavailableReason, BookingFieldValue, BookingFieldView, BookingFlowActionResult, BookingFlowFeedback, BookingFlowStatus, BookingFlowView, BookingResourceView, BookingFlowStep, BookingFlowStepId, BookingSlotView, BookingSubmitActionResult, BookingSubmitOptions, BookingValidationErrors, DerivedBookingFlowSteps, DeriveBookingFlowStepsInput, LoadState, } from './system/runtime/hooks/useHeadlessBookingFlow.state';
|
|
33
|
+
export { buildBookingAvailabilityQuery, buildBookingStepPlan, buildBookingSubmitPlan, createEmptyBookingValidationErrors, createFieldBookingValidationErrors, createFormBookingValidationError, describeUnknownError, deriveBookingFlowSteps, deriveBookingFieldViews, getAppointmentBookingOverrideInput, hasBookingValidationErrors, resolveAppointmentPackagesModel, resolveHeadlessBookingStatus, resolveHeadlessBookingView, toBookingFormData, toBookingSlotView, toBookingSlotViews, validateBookingField, validateBookingFields, validateBookingStep, } from './system/runtime/hooks/useHeadlessBookingFlow.state';
|
|
28
34
|
export type { EventDetailsClientProps, EventDetailsIslandClientProps } from './system/runtime/nodes/event-details.client';
|
|
29
35
|
export type { LocationMapClientProps, LocationMapIslandClientProps } from './system/runtime/nodes/location-map.client';
|
|
30
36
|
export type { EventRegistrationClientProps, EventRegistrationIslandClientProps, } from './system/runtime/nodes/event-registration.client';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Uses the Block API Client for type-safe API calls.
|
|
5
5
|
* Must be used within a BlockApiProvider.
|
|
6
6
|
*/
|
|
7
|
-
import { type TimeSlot } from
|
|
7
|
+
import { type TimeSlot } from "../api";
|
|
8
8
|
export type { TimeSlot };
|
|
9
9
|
type UseAvailableSlotsOptions = {
|
|
10
10
|
siteId: string;
|
|
@@ -16,6 +16,8 @@ type UseAvailableSlotsOptions = {
|
|
|
16
16
|
type UseAvailableSlotsResult = {
|
|
17
17
|
slots: TimeSlot[];
|
|
18
18
|
isLoading: boolean;
|
|
19
|
+
isRefreshing: boolean;
|
|
20
|
+
hasLoaded: boolean;
|
|
19
21
|
error: string | null;
|
|
20
22
|
};
|
|
21
23
|
/**
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type BlockApiConfig } from "../api";
|
|
3
|
+
import type { AutoAppliedDiscountPreview } from "../api/types";
|
|
4
|
+
import type { BookingFormConfig, BookingFormData, BookingFormService, BookingSelectedCollectionOptionKind } from "../nodes/booking-form.state";
|
|
5
|
+
import { type BookingPaymentSelectionViewModel } from "../shared/bookingPaymentOptions";
|
|
6
|
+
import { createBookingBlockApiConfig, type BookingAppointmentPackagesModel, type BookingFieldValue, type BookingFieldView, type BookingFlowActionResult, type BookingFlowFeedback, type BookingFlowStatus, type BookingFlowView, type BookingResourceView, type BookingFlowStep, type BookingFlowStepId, type BookingSlotView, type BookingSubmitActionResult, type BookingSubmitOptions, type LoadState } from "./useHeadlessBookingFlow.state";
|
|
7
|
+
export type { BlockApiConfig };
|
|
8
|
+
export type { BookingAppointmentPackagesModel };
|
|
9
|
+
export { createBookingBlockApiConfig };
|
|
10
|
+
export type HeadlessBookingFlowOptions = Readonly<{
|
|
11
|
+
siteId: string;
|
|
12
|
+
formId: string;
|
|
13
|
+
form: BookingFormConfig | null;
|
|
14
|
+
services: readonly BookingFormService[];
|
|
15
|
+
initialServiceId?: string;
|
|
16
|
+
initialResourceId?: string;
|
|
17
|
+
initialData?: Partial<BookingFormData>;
|
|
18
|
+
requiresServiceSelection?: boolean;
|
|
19
|
+
requiresResourceSelection?: boolean;
|
|
20
|
+
shouldAutoSelectSingleResource?: boolean;
|
|
21
|
+
enableAppointmentPackages?: boolean;
|
|
22
|
+
spamProtectionEnabled?: boolean;
|
|
23
|
+
successMessage?: string;
|
|
24
|
+
anchorId?: string;
|
|
25
|
+
viewerTimeZone?: string;
|
|
26
|
+
navigateToCheckout?: (checkoutUrl: string) => void;
|
|
27
|
+
}>;
|
|
28
|
+
export type BookingServicesModel = Readonly<{
|
|
29
|
+
items: readonly BookingFormService[];
|
|
30
|
+
selected: BookingFormService | null;
|
|
31
|
+
defaultServiceId?: string;
|
|
32
|
+
requiresSelection: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
export type BookingResourcesModel = Readonly<{
|
|
35
|
+
items: readonly BookingResourceView[];
|
|
36
|
+
selected: BookingResourceView | null;
|
|
37
|
+
selectedResourceId?: string;
|
|
38
|
+
state: LoadState<readonly BookingResourceView[]>;
|
|
39
|
+
requiresSelection: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
export type BookingAvailabilityModel = Readonly<{
|
|
42
|
+
selectedDate?: string;
|
|
43
|
+
availableDates: readonly string[];
|
|
44
|
+
selectedSlot: BookingSlotView | null;
|
|
45
|
+
slots: readonly BookingSlotView[];
|
|
46
|
+
datesState: LoadState<readonly string[]>;
|
|
47
|
+
slotsState: LoadState<readonly BookingSlotView[]>;
|
|
48
|
+
timezone: string;
|
|
49
|
+
hasMoreDates: boolean;
|
|
50
|
+
loadMoreDates: () => void;
|
|
51
|
+
}>;
|
|
52
|
+
export type BookingFieldsModel = Readonly<{
|
|
53
|
+
items: readonly BookingFieldView[];
|
|
54
|
+
values: Readonly<Record<string, BookingFieldValue>>;
|
|
55
|
+
errors: Readonly<Record<string, string>>;
|
|
56
|
+
touched: Readonly<Record<string, boolean>>;
|
|
57
|
+
}>;
|
|
58
|
+
export type BookingPaymentModel = Readonly<{
|
|
59
|
+
kind: "unsupported";
|
|
60
|
+
mode: "unsupported";
|
|
61
|
+
selection: null;
|
|
62
|
+
selectedCollectionOptionKind?: BookingSelectedCollectionOptionKind;
|
|
63
|
+
selectedAppointmentPackageId?: string;
|
|
64
|
+
appointmentPackages: BookingAppointmentPackagesModel;
|
|
65
|
+
errorMessage: string;
|
|
66
|
+
}> | Readonly<{
|
|
67
|
+
kind: "ok";
|
|
68
|
+
mode: "hidden" | "disclosure_only" | "choice_required";
|
|
69
|
+
selection: BookingPaymentSelectionViewModel | null;
|
|
70
|
+
selectedCollectionOptionKind?: BookingSelectedCollectionOptionKind;
|
|
71
|
+
selectedAppointmentPackageId?: string;
|
|
72
|
+
appointmentPackages: BookingAppointmentPackagesModel;
|
|
73
|
+
}>;
|
|
74
|
+
export type BookingDiscountModel = Readonly<{
|
|
75
|
+
code: string;
|
|
76
|
+
isOpen: boolean;
|
|
77
|
+
manualCodeEntryAllowed: boolean;
|
|
78
|
+
loading: boolean;
|
|
79
|
+
autoAppliedDiscount: AutoAppliedDiscountPreview | null;
|
|
80
|
+
setCode: (code: string) => void;
|
|
81
|
+
setOpen: (isOpen: boolean) => void;
|
|
82
|
+
clear: () => void;
|
|
83
|
+
}>;
|
|
84
|
+
export type BookingSpamProtectionModel = Readonly<{
|
|
85
|
+
enabled: false;
|
|
86
|
+
}> | Readonly<{
|
|
87
|
+
enabled: true;
|
|
88
|
+
provider: "altcha";
|
|
89
|
+
challenge: {
|
|
90
|
+
url: string;
|
|
91
|
+
auto: "onfocus";
|
|
92
|
+
};
|
|
93
|
+
solution: string | null;
|
|
94
|
+
}>;
|
|
95
|
+
export type BookingFlowActions = Readonly<{
|
|
96
|
+
selectService: (serviceId: string) => void;
|
|
97
|
+
selectResource: (resourceId: string | null) => void;
|
|
98
|
+
selectDate: (date: string | null) => void;
|
|
99
|
+
selectSlot: (slot: BookingSlotView | null) => void;
|
|
100
|
+
updateField: (fieldId: string, value: BookingFieldValue) => void;
|
|
101
|
+
markFieldTouched: (fieldId: string) => void;
|
|
102
|
+
selectPaymentOption: (kind: BookingSelectedCollectionOptionKind | null) => void;
|
|
103
|
+
selectAppointmentPackage: (packageId: string | null) => void;
|
|
104
|
+
setDiscountCode: (code: string) => void;
|
|
105
|
+
clearDiscountCode: () => void;
|
|
106
|
+
setAltchaSolution: (solution: string | null) => void;
|
|
107
|
+
invalidateSpamProtection: () => void;
|
|
108
|
+
next: () => Promise<BookingFlowActionResult>;
|
|
109
|
+
back: () => void;
|
|
110
|
+
/**
|
|
111
|
+
* Moves to a visible step without validating previous steps. Consumers that
|
|
112
|
+
* want linear progression should consult `steps[].canEnter` or call `next()`.
|
|
113
|
+
*/
|
|
114
|
+
goToStep: (stepId: BookingFlowStepId) => Promise<BookingFlowActionResult>;
|
|
115
|
+
submit: (options?: BookingSubmitOptions) => Promise<BookingSubmitActionResult>;
|
|
116
|
+
reset: () => void;
|
|
117
|
+
clearFeedback: () => void;
|
|
118
|
+
}>;
|
|
119
|
+
export type HeadlessBookingFlow = Readonly<{
|
|
120
|
+
status: BookingFlowStatus;
|
|
121
|
+
view: BookingFlowView;
|
|
122
|
+
steps: readonly BookingFlowStep[];
|
|
123
|
+
currentStep: BookingFlowStep | null;
|
|
124
|
+
data: Partial<BookingFormData>;
|
|
125
|
+
services: BookingServicesModel;
|
|
126
|
+
resources: BookingResourcesModel;
|
|
127
|
+
availability: BookingAvailabilityModel;
|
|
128
|
+
fields: BookingFieldsModel;
|
|
129
|
+
payment: BookingPaymentModel;
|
|
130
|
+
discount: BookingDiscountModel;
|
|
131
|
+
spamProtection: BookingSpamProtectionModel;
|
|
132
|
+
feedback: BookingFlowFeedback;
|
|
133
|
+
actions: BookingFlowActions;
|
|
134
|
+
}>;
|
|
135
|
+
export type HeadlessBookingProviderProps = Readonly<{
|
|
136
|
+
config: BlockApiConfig;
|
|
137
|
+
children?: React.ReactNode;
|
|
138
|
+
}>;
|
|
139
|
+
export declare function HeadlessBookingProvider({ config, children, }: HeadlessBookingProviderProps): React.ReactElement;
|
|
140
|
+
export declare function useHeadlessBookingFlow(options: HeadlessBookingFlowOptions): HeadlessBookingFlow;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { bookingFlowReducer, buildBookingAvailabilityQuery, buildBookingStepPlan, buildBookingSubmitPlan, createBookingBlockApiConfig, createEmptyBookingValidationErrors, createFieldBookingValidationErrors, createFormBookingValidationError, createInitialBookingFlowReducerState, describeUnknownError, deriveBookingFieldViews, deriveBookingFlowSteps, getAppointmentBookingOverrideInput, hasBookingValidationErrors, resolveAppointmentPackagesModel, resolveAvailabilitySelectionInvalidation, resolveHeadlessBookingStatus, resolveHeadlessBookingView, toBookingFormData, toBookingSlotView, toBookingSlotViews, validateBookingField, validateBookingFields, validateBookingStep, } from "../nodes/booking-form.headless.state";
|
|
2
|
+
export type { AppointmentBookingOverrideData, AppointmentBookingOverrideInput, AppointmentBookingOverrideInputResult, AppointmentBookingOverridePropsLike, BookingAvailabilityQuery, BookingAppointmentPackagesModel, BookingAppointmentPackagesUnavailableReason, BookingFieldValue, BookingFieldView, BookingFlowActionResult, BookingFlowFeedback, BookingFlowStatus, BookingFlowStep, BookingFlowStepId, BookingFlowView, BookingResourceView, BookingSlotView, BookingSubmitActionResult, BookingSubmitOptions, BookingValidationErrors, DerivedBookingFlowSteps, DeriveBookingFlowStepsInput, LoadState, } from "../nodes/booking-form.headless.state";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const MIN_AVAILABILITY_REFRESH_INTERVAL_MS = 15000;
|
|
2
|
+
type UseVisibleTabPollingOptions = {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
intervalMs: number;
|
|
5
|
+
jitterMs: number;
|
|
6
|
+
minVisibleRefreshIntervalMs?: number;
|
|
7
|
+
onPoll: () => Promise<void> | void;
|
|
8
|
+
};
|
|
9
|
+
export declare function useVisibleTabPolling({ enabled, intervalMs, jitterMs, minVisibleRefreshIntervalMs, onPoll, }: UseVisibleTabPollingOptions): void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { HeadlessBookingFlow } from "../hooks/useHeadlessBookingFlow";
|
|
3
|
+
type HeadlessBookingDefaultFormProps = Readonly<{
|
|
4
|
+
booking: HeadlessBookingFlow;
|
|
5
|
+
onSubmit: () => Promise<void>;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function HeadlessBookingDefaultForm({ booking, onSubmit, }: HeadlessBookingDefaultFormProps): React.ReactElement;
|
|
8
|
+
export {};
|