@cimplify/sdk 0.90.0 → 0.92.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/advanced.d.mts +3 -3
- package/dist/advanced.d.ts +3 -3
- package/dist/advanced.js +20 -20
- package/dist/advanced.mjs +1 -1
- package/dist/{chunk-JVWFIFQ7.js → chunk-3MBMIEWT.js} +4 -4
- package/dist/{chunk-2UDEWILL.mjs → chunk-3XD2FVP4.mjs} +117 -35
- package/dist/{chunk-NGE37REW.mjs → chunk-54H2YYIW.mjs} +2 -2
- package/dist/{chunk-BN4V4ONE.js → chunk-DCRN67NO.js} +158 -73
- package/dist/{chunk-T7Z25EY4.js → chunk-HKN3YG76.js} +84 -0
- package/dist/{chunk-GHFDYM5K.js → chunk-IVJEUGWF.js} +10 -1
- package/dist/{chunk-KJP4U6L3.js → chunk-OAHSF542.js} +12 -0
- package/dist/{chunk-NNGKC3MM.mjs → chunk-PYBFTMHI.mjs} +12 -0
- package/dist/{chunk-OZDDHSIB.mjs → chunk-RRBY35TJ.mjs} +80 -1
- package/dist/{chunk-ZU4ZRYUR.mjs → chunk-T7LDBZZZ.mjs} +10 -1
- package/dist/{client-YiSelM7x.d.mts → client-BQbSKlHS.d.mts} +90 -11
- package/dist/{client-DMttx1xk.d.mts → client-Bw4HtLP1.d.mts} +2 -2
- package/dist/{client-CR1f94wY.d.ts → client-CeW3acve.d.ts} +90 -11
- package/dist/{client-CqpOcbin.d.ts → client-Otzv_rgP.d.ts} +2 -2
- package/dist/{index-DD9z396M.d.mts → index-CmIboQjl.d.mts} +3 -3
- package/dist/{index-CxTVu0HZ.d.ts → index-DgoRwz8l.d.ts} +3 -3
- package/dist/index.d.mts +49 -7
- package/dist/index.d.ts +49 -7
- package/dist/index.js +103 -83
- package/dist/index.mjs +5 -5
- package/dist/mock/cli.mjs +12 -0
- package/dist/mock/library.js +12 -0
- package/dist/mock/library.mjs +12 -0
- package/dist/mock/msw.js +12 -0
- package/dist/mock/msw.mjs +12 -0
- package/dist/{payment-5d8FTA1q.d.mts → payment-BFtLqiG2.d.mts} +1 -1
- package/dist/{payment-BX7ccIKY.d.ts → payment-Cq8FT1B6.d.ts} +1 -1
- package/dist/{price-DtfP_Xfq.d.ts → price-DaFXT-Lr.d.ts} +1 -1
- package/dist/{price-arl_4Rzn.d.mts → price-DleDWk_s.d.mts} +1 -1
- package/dist/{product-DZX4QuKS.d.ts → product-bZ8G5Z8D.d.mts} +38 -0
- package/dist/{product-DZX4QuKS.d.mts → product-bZ8G5Z8D.d.ts} +38 -0
- package/dist/react.d.mts +71 -6
- package/dist/react.d.ts +71 -6
- package/dist/react.js +466 -337
- package/dist/react.mjs +398 -272
- package/dist/{server-BceZMxcK.d.mts → server-D-iK-bNt.d.mts} +1 -1
- package/dist/{server-DoJGSC7L.d.ts → server-DwsY9hlX.d.ts} +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +7 -7
- package/dist/server.mjs +2 -2
- package/dist/styles.css +1 -1
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +2 -2
- package/dist/testing/msw.mjs +1 -1
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +23 -23
- package/dist/testing/suite.mjs +4 -4
- package/dist/testing.d.mts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +79 -79
- package/dist/testing.mjs +5 -5
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/package.json +1 -1
- package/registry/booking-page.json +1 -1
- package/registry/chat-widget.json +1 -1
- package/registry/customer-input-fields.json +1 -1
- package/registry/date-slot-picker.json +1 -1
- package/registry/product-customizer.json +1 -1
- package/registry/rental-service-card.json +1 -1
|
@@ -72,6 +72,85 @@ function getVariantDisplayName(variant, productName) {
|
|
|
72
72
|
return productName || (variant.is_default ? "Default" : "Option");
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
// src/utils/price-basis.ts
|
|
76
|
+
var MULTI_DAY_UNITS = /* @__PURE__ */ new Set([
|
|
77
|
+
"days",
|
|
78
|
+
"nights",
|
|
79
|
+
"weeks",
|
|
80
|
+
"months",
|
|
81
|
+
"years"
|
|
82
|
+
]);
|
|
83
|
+
var PERIOD_LABELS = {
|
|
84
|
+
minutes: "session",
|
|
85
|
+
hours: "session",
|
|
86
|
+
days: "day",
|
|
87
|
+
nights: "night",
|
|
88
|
+
weeks: "week",
|
|
89
|
+
months: "month",
|
|
90
|
+
years: "year"
|
|
91
|
+
};
|
|
92
|
+
function isMultiDayService(product) {
|
|
93
|
+
if ((product.type || "product") !== "service") return false;
|
|
94
|
+
if (product.scheduling_mode) return product.scheduling_mode === "multi_day";
|
|
95
|
+
return product.duration_unit != null && MULTI_DAY_UNITS.has(product.duration_unit);
|
|
96
|
+
}
|
|
97
|
+
function priceBasisLabel(product) {
|
|
98
|
+
if ((product.type || "product") !== "service") return null;
|
|
99
|
+
const basis = product.price_basis ?? (isMultiDayService(product) ? "per_duration_unit" : null);
|
|
100
|
+
if (basis === null || basis === "flat") return null;
|
|
101
|
+
if (basis === "per_person") return "person";
|
|
102
|
+
return PERIOD_LABELS[product.duration_unit ?? "nights"];
|
|
103
|
+
}
|
|
104
|
+
var DAY_MS = 864e5;
|
|
105
|
+
function utcDateParts(iso) {
|
|
106
|
+
const date = new Date(iso);
|
|
107
|
+
if (Number.isNaN(date.getTime())) return null;
|
|
108
|
+
return { year: date.getUTCFullYear(), month: date.getUTCMonth() + 1, day: date.getUTCDate() };
|
|
109
|
+
}
|
|
110
|
+
function stayPeriods(scheduledStart, scheduledEnd, durationUnit) {
|
|
111
|
+
const start = utcDateParts(scheduledStart);
|
|
112
|
+
const end = utcDateParts(scheduledEnd);
|
|
113
|
+
if (!start || !end) return 1;
|
|
114
|
+
const days = Math.max(
|
|
115
|
+
1,
|
|
116
|
+
Math.round(
|
|
117
|
+
(Date.UTC(end.year, end.month - 1, end.day) - Date.UTC(start.year, start.month - 1, start.day)) / DAY_MS
|
|
118
|
+
)
|
|
119
|
+
);
|
|
120
|
+
switch (durationUnit) {
|
|
121
|
+
case "weeks":
|
|
122
|
+
return Math.max(1, Math.ceil(days / 7));
|
|
123
|
+
case "months": {
|
|
124
|
+
let months = (end.year - start.year) * 12 + (end.month - start.month);
|
|
125
|
+
if (end.day > start.day) months += 1;
|
|
126
|
+
return Math.max(1, months);
|
|
127
|
+
}
|
|
128
|
+
case "years": {
|
|
129
|
+
let years = end.year - start.year;
|
|
130
|
+
if (end.month > start.month || end.month === start.month && end.day > start.day) {
|
|
131
|
+
years += 1;
|
|
132
|
+
}
|
|
133
|
+
return Math.max(1, years);
|
|
134
|
+
}
|
|
135
|
+
default:
|
|
136
|
+
return days;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function stayLength(scheduledStart, scheduledEnd, durationUnit) {
|
|
140
|
+
const periods = stayPeriods(scheduledStart, scheduledEnd, durationUnit);
|
|
141
|
+
const label = PERIOD_LABELS[durationUnit ?? "nights"];
|
|
142
|
+
return `${periods} ${label}${periods === 1 ? "" : "s"}`;
|
|
143
|
+
}
|
|
144
|
+
function serviceBillingMultiplier(product, selection) {
|
|
145
|
+
if ((product.type || "product") !== "service") return null;
|
|
146
|
+
const basis = product.price_basis ?? (isMultiDayService(product) ? "per_duration_unit" : "per_person");
|
|
147
|
+
const units = Math.max(1, selection.units ?? 1);
|
|
148
|
+
if (basis === "flat") return units;
|
|
149
|
+
if (basis === "per_person") return Math.max(1, selection.quantity) * units;
|
|
150
|
+
const periods = selection.scheduledStart && selection.scheduledEnd ? stayPeriods(selection.scheduledStart, selection.scheduledEnd, product.duration_unit) : 1;
|
|
151
|
+
return periods * units;
|
|
152
|
+
}
|
|
153
|
+
|
|
75
154
|
// src/types/product.ts
|
|
76
155
|
var PRODUCT_TYPE = {
|
|
77
156
|
Product: "product",
|
|
@@ -161,4 +240,4 @@ function appendTransform(url, t) {
|
|
|
161
240
|
return `${url}${url.includes("?") ? "&" : "?"}${query}`;
|
|
162
241
|
}
|
|
163
242
|
|
|
164
|
-
export { BOUNDARY_KIND, CIMPLIFY_CDN_HOSTS, DEFAULT_CDN_BASE_URL, DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, allGalleryImages, assetUrl, getVariantDisplayName, isCimplifyAsset, resolveGallery };
|
|
243
|
+
export { BOUNDARY_KIND, CIMPLIFY_CDN_HOSTS, DEFAULT_CDN_BASE_URL, DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, allGalleryImages, assetUrl, getVariantDisplayName, isCimplifyAsset, isMultiDayService, priceBasisLabel, resolveGallery, serviceBillingMultiplier, stayLength, stayPeriods };
|
|
@@ -1671,7 +1671,10 @@ var CheckoutService = class {
|
|
|
1671
1671
|
idempotency_key: data.idempotency_key || generateIdempotencyKey(),
|
|
1672
1672
|
metadata: data.metadata,
|
|
1673
1673
|
pay_currency: data.pay_currency,
|
|
1674
|
-
fx_quote_id: data.fx_quote_id
|
|
1674
|
+
fx_quote_id: data.fx_quote_id,
|
|
1675
|
+
use_store_credit: data.use_store_credit,
|
|
1676
|
+
voucher_code: data.voucher_code,
|
|
1677
|
+
pay_deposit: data.pay_deposit
|
|
1675
1678
|
};
|
|
1676
1679
|
const baseCurrency = currencyCode(
|
|
1677
1680
|
(cart.pricing.currency || checkoutData.pay_currency || "GHS").toUpperCase()
|
|
@@ -1802,6 +1805,7 @@ var LinkService = class {
|
|
|
1802
1805
|
);
|
|
1803
1806
|
if (result.ok && result.value.session_token) {
|
|
1804
1807
|
this.client.setAccessToken(result.value.session_token);
|
|
1808
|
+
this.client.autoClaimChatIdentity();
|
|
1805
1809
|
}
|
|
1806
1810
|
return result;
|
|
1807
1811
|
}
|
|
@@ -1813,6 +1817,7 @@ var LinkService = class {
|
|
|
1813
1817
|
);
|
|
1814
1818
|
if (result.ok && result.value.session_token) {
|
|
1815
1819
|
this.client.setAccessToken(result.value.session_token);
|
|
1820
|
+
this.client.autoClaimChatIdentity();
|
|
1816
1821
|
}
|
|
1817
1822
|
return result;
|
|
1818
1823
|
}
|
|
@@ -1998,6 +2003,7 @@ var AuthService = class {
|
|
|
1998
2003
|
);
|
|
1999
2004
|
if (result.ok && result.value.session_token) {
|
|
2000
2005
|
this.client.setAccessToken(result.value.session_token);
|
|
2006
|
+
this.client.autoClaimChatIdentity();
|
|
2001
2007
|
}
|
|
2002
2008
|
return result;
|
|
2003
2009
|
}
|
|
@@ -2151,6 +2157,7 @@ var SchedulingService = class {
|
|
|
2151
2157
|
service_id: input.service_id,
|
|
2152
2158
|
date: input.date,
|
|
2153
2159
|
participant_count: input.participant_count,
|
|
2160
|
+
units: input.units,
|
|
2154
2161
|
variant_id: input.variant_id
|
|
2155
2162
|
});
|
|
2156
2163
|
return safe(this.client.get(path));
|
|
@@ -2171,6 +2178,7 @@ var SchedulingService = class {
|
|
|
2171
2178
|
end_date: params.end_date,
|
|
2172
2179
|
location_id: params.location_id,
|
|
2173
2180
|
participant_count: params.participant_count,
|
|
2181
|
+
units: params.units,
|
|
2174
2182
|
variant_id: params.variant_id
|
|
2175
2183
|
});
|
|
2176
2184
|
return safe(this.client.get(path));
|
|
@@ -3143,6 +3151,7 @@ var CimplifyElements = class {
|
|
|
3143
3151
|
this.accessToken = token;
|
|
3144
3152
|
this.accountId = decodeJwtSub(token);
|
|
3145
3153
|
this.client.setAccessToken(token);
|
|
3154
|
+
this.client.autoClaimChatIdentity();
|
|
3146
3155
|
await this.hydrateCustomerData();
|
|
3147
3156
|
return {
|
|
3148
3157
|
accountId: this.accountId ?? "",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as CimplifyError, S as Category, aZ as Product, f as AddOnWithOptions, aQ as Pagination, bb as ProductWithDetails, b9 as ProductVariant, bF as VariantAxis, bG as VariantAxisSelection, A as AddOn, W as Collection, G as BundleSummary, u as Bundle, a3 as Composite, a1 as ComponentSelectionInput, a8 as CompositePriceResult, U as ChosenPrice, b6 as ProductTaxonomy, bx as TaxonomyWithChildren, ax as EligiblePlansQuery, b1 as ProductBillingPlan, b7 as ProductTimeProfile, b0 as ProductAvailabilityNow, aj as Deal, b2 as ProductDealInfo, ap as DiscountValidation, bu as TagsResponse, ae as CustomAttributeDefinition, af as CustomAttributeValue, bc as PropertyFacet, bw as TaxonomyAttributeTemplate, aJ as KnowledgeArticle, by as UICart, L as CartItem, Q as CartSummary, g as AddToCartInput, N as CartMutationResult, bE as UpdateCartItemInput, ao as DiscountDetails, aO as Money, ad as CurrencyCode, aK as LineConfiguration, bL as VariantDetails, bM as VariantDetailsDTO, a as AddOnDetails, d as AddOnOptionDetails, b as AddOnGroupDetails, D as BundleSelectionData, aa as CompositeSelectionData, ag as CustomerInputValue, bS as components, bk as SchedulingMode, av as DurationUnit, bo as Subscription, bs as SubscriptionWithDetails } from './product-
|
|
2
|
-
import { a as AuthorizationType, c as PaymentMethod, I as InitializePaymentResult, S as SubmitAuthorizationInput, i as PaymentStatusResponse } from './payment-
|
|
1
|
+
import { V as CimplifyError, S as Category, aZ as Product, f as AddOnWithOptions, aQ as Pagination, bb as ProductWithDetails, b9 as ProductVariant, bF as VariantAxis, bG as VariantAxisSelection, A as AddOn, W as Collection, G as BundleSummary, u as Bundle, a3 as Composite, a1 as ComponentSelectionInput, a8 as CompositePriceResult, U as ChosenPrice, b6 as ProductTaxonomy, bx as TaxonomyWithChildren, ax as EligiblePlansQuery, b1 as ProductBillingPlan, b7 as ProductTimeProfile, b0 as ProductAvailabilityNow, aj as Deal, b2 as ProductDealInfo, ap as DiscountValidation, bu as TagsResponse, ae as CustomAttributeDefinition, af as CustomAttributeValue, bc as PropertyFacet, bw as TaxonomyAttributeTemplate, aJ as KnowledgeArticle, by as UICart, L as CartItem, Q as CartSummary, g as AddToCartInput, N as CartMutationResult, bE as UpdateCartItemInput, ao as DiscountDetails, aO as Money, ad as CurrencyCode, aK as LineConfiguration, bL as VariantDetails, bM as VariantDetailsDTO, a as AddOnDetails, d as AddOnOptionDetails, b as AddOnGroupDetails, D as BundleSelectionData, aa as CompositeSelectionData, ag as CustomerInputValue, bS as components, bk as SchedulingMode, av as DurationUnit, bo as Subscription, bs as SubscriptionWithDetails } from './product-bZ8G5Z8D.mjs';
|
|
2
|
+
import { a as AuthorizationType, c as PaymentMethod, I as InitializePaymentResult, S as SubmitAuthorizationInput, i as PaymentStatusResponse } from './payment-BFtLqiG2.mjs';
|
|
3
3
|
|
|
4
4
|
interface RequestContext {
|
|
5
5
|
method: "GET" | "POST" | "PATCH" | "DELETE";
|
|
@@ -65,12 +65,43 @@ interface OutboxFullEvent {
|
|
|
65
65
|
operation: string;
|
|
66
66
|
idempotencyKey: string;
|
|
67
67
|
}
|
|
68
|
+
interface TokenChangedEvent {
|
|
69
|
+
token: string | null;
|
|
70
|
+
}
|
|
71
|
+
interface SessionClaimedEvent {
|
|
72
|
+
sessionToken: string;
|
|
73
|
+
threadId: string | null;
|
|
74
|
+
customerName: string;
|
|
75
|
+
}
|
|
76
|
+
declare const MUTATION_ERROR: "mutation:error";
|
|
77
|
+
declare const OUTBOX_REPLAY_SUCCESS: "outbox:replay-success";
|
|
78
|
+
declare const OUTBOX_REPLAY_ERROR: "outbox:replay-error";
|
|
79
|
+
declare const OUTBOX_DEAD_LETTER: "outbox:dead-letter";
|
|
80
|
+
declare const OUTBOX_FULL: "outbox:full";
|
|
81
|
+
declare const AUTH_TOKEN_CHANGED: "auth:token-changed";
|
|
82
|
+
declare const SESSION_CLAIMED: "session:claimed";
|
|
83
|
+
declare const SESSION_CLEARED: "session:cleared";
|
|
68
84
|
interface ClientEventMap {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
[MUTATION_ERROR]: MutationErrorEvent;
|
|
86
|
+
[OUTBOX_REPLAY_SUCCESS]: OutboxReplayEvent;
|
|
87
|
+
[OUTBOX_REPLAY_ERROR]: OutboxReplayErrorEvent;
|
|
88
|
+
[OUTBOX_DEAD_LETTER]: OutboxReplayEvent;
|
|
89
|
+
[OUTBOX_FULL]: OutboxFullEvent;
|
|
90
|
+
[AUTH_TOKEN_CHANGED]: TokenChangedEvent;
|
|
91
|
+
/**
|
|
92
|
+
* The anonymous session was claimed for a verified Link identity: the
|
|
93
|
+
* session token rotated (already adopted by the client) and server-side
|
|
94
|
+
* state — conversation, cart, orders — now resolves customer-first.
|
|
95
|
+
* Consumers should refetch anything session-derived.
|
|
96
|
+
*/
|
|
97
|
+
[SESSION_CLAIMED]: SessionClaimedEvent;
|
|
98
|
+
/**
|
|
99
|
+
* The session was cleared (sign-out): the access token is gone and a
|
|
100
|
+
* fresh anonymous session token was minted. Everything keyed to the old
|
|
101
|
+
* session — conversation, cart, identity — must reset, not linger for
|
|
102
|
+
* the next person at this browser.
|
|
103
|
+
*/
|
|
104
|
+
[SESSION_CLEARED]: Record<string, never>;
|
|
74
105
|
}
|
|
75
106
|
type ClientEventName = keyof ClientEventMap;
|
|
76
107
|
type ClientEventListener<K extends ClientEventName> = (payload: ClientEventMap[K]) => void;
|
|
@@ -1381,6 +1412,10 @@ interface CheckoutFormData {
|
|
|
1381
1412
|
/** Store-credit voucher / gift code to claim into the wallet and apply to this
|
|
1382
1413
|
* order. Presenting a code implies applying store credit. */
|
|
1383
1414
|
voucher_code?: string;
|
|
1415
|
+
/** Pay only the required deposit now (balance collected later) instead of the
|
|
1416
|
+
* full total. Only honored when the order is deposit-eligible and paying in
|
|
1417
|
+
* the order's native currency. */
|
|
1418
|
+
pay_deposit?: boolean;
|
|
1384
1419
|
}
|
|
1385
1420
|
type NextAction = {
|
|
1386
1421
|
type: "none";
|
|
@@ -1560,6 +1595,7 @@ interface EnrichedOrderItem {
|
|
|
1560
1595
|
scheduled_end?: string;
|
|
1561
1596
|
confirmation_code?: string;
|
|
1562
1597
|
primary_staff_id?: string;
|
|
1598
|
+
units?: number;
|
|
1563
1599
|
base_price: Money;
|
|
1564
1600
|
add_ons_price: Money;
|
|
1565
1601
|
total_price: Money;
|
|
@@ -2005,6 +2041,7 @@ interface Service {
|
|
|
2005
2041
|
duration_value?: number;
|
|
2006
2042
|
duration_minutes: number;
|
|
2007
2043
|
duration_unit?: DurationUnit;
|
|
2044
|
+
price_basis?: "flat" | "per_person" | "per_duration_unit";
|
|
2008
2045
|
image_url?: string | null;
|
|
2009
2046
|
category_id?: string | null;
|
|
2010
2047
|
is_available: boolean;
|
|
@@ -2108,6 +2145,8 @@ interface GetAvailableSlotsInput {
|
|
|
2108
2145
|
service_id: string;
|
|
2109
2146
|
date: string;
|
|
2110
2147
|
participant_count?: number;
|
|
2148
|
+
/** Whole units needed; slots that can't seat them drop out. Default 1. */
|
|
2149
|
+
units?: number;
|
|
2111
2150
|
variant_id?: string;
|
|
2112
2151
|
}
|
|
2113
2152
|
interface CheckSlotAvailabilityInput {
|
|
@@ -2163,6 +2202,8 @@ interface ServiceAvailabilityParams {
|
|
|
2163
2202
|
end_date: string;
|
|
2164
2203
|
location_id?: string;
|
|
2165
2204
|
participant_count?: number;
|
|
2205
|
+
/** Whole units needed; short check-in days report unavailable. Default 1. */
|
|
2206
|
+
units?: number;
|
|
2166
2207
|
variant_id?: string;
|
|
2167
2208
|
}
|
|
2168
2209
|
interface ServiceAvailabilityResult {
|
|
@@ -2254,7 +2295,11 @@ interface LiteBootstrapLocation {
|
|
|
2254
2295
|
interface LiteBootstrap {
|
|
2255
2296
|
business: LiteBootstrapBusiness;
|
|
2256
2297
|
categories: LiteBootstrapCategory[];
|
|
2298
|
+
/** The resolved ordering location: the QR / query choice, else the first
|
|
2299
|
+
* active branch. Null only for a business with no locations at all. */
|
|
2257
2300
|
location?: LiteBootstrapLocation | null;
|
|
2301
|
+
/** Every active branch — more than one means the customer can switch. */
|
|
2302
|
+
locations?: LiteBootstrapLocation[];
|
|
2258
2303
|
}
|
|
2259
2304
|
interface LiteResource {
|
|
2260
2305
|
id: string;
|
|
@@ -2560,13 +2605,17 @@ type ChatReplyCard = {
|
|
|
2560
2605
|
order_number?: string;
|
|
2561
2606
|
status?: string;
|
|
2562
2607
|
};
|
|
2563
|
-
declare function chatMessageCards(message: {
|
|
2564
|
-
metadata: Record<string, unknown>;
|
|
2565
|
-
}): ChatReplyCard[];
|
|
2566
2608
|
interface ChatConversationResponse {
|
|
2567
2609
|
conversation: ChatConversation;
|
|
2568
2610
|
messages: ChatMessage[];
|
|
2569
2611
|
}
|
|
2612
|
+
interface ClaimConversationResult {
|
|
2613
|
+
/** The rotated, customer-bound session token; the SDK adopts it automatically. */
|
|
2614
|
+
session_token: string;
|
|
2615
|
+
/** The adopted (or merged-into) conversation; null when there was nothing to adopt. */
|
|
2616
|
+
thread_id?: string | null;
|
|
2617
|
+
customer_name: string;
|
|
2618
|
+
}
|
|
2570
2619
|
interface ChatWidgetStarter {
|
|
2571
2620
|
icon?: string;
|
|
2572
2621
|
text: string;
|
|
@@ -2577,7 +2626,23 @@ interface IdempotencyOption {
|
|
|
2577
2626
|
}
|
|
2578
2627
|
declare class SupportService {
|
|
2579
2628
|
private client;
|
|
2629
|
+
private claimInFlight;
|
|
2630
|
+
private lastClaimedAccessToken;
|
|
2631
|
+
private claimedName;
|
|
2580
2632
|
constructor(client: CimplifyClient);
|
|
2633
|
+
/** The verified customer this session's conversation was claimed for, null while anonymous. */
|
|
2634
|
+
get claimedCustomerName(): string | null;
|
|
2635
|
+
/**
|
|
2636
|
+
* Claim the anonymous session for the verified Link identity: the server
|
|
2637
|
+
* verifies the access token, rotates the session token (adopted here, so
|
|
2638
|
+
* every subsequent request rides the bound session), folds the guest cart
|
|
2639
|
+
* in, and adopts or merges the widget conversation.
|
|
2640
|
+
*
|
|
2641
|
+
* Idempotent and single-flight: concurrent calls share one request, and a
|
|
2642
|
+
* token already claimed by this instance short-circuits without a network
|
|
2643
|
+
* round trip. Emits `session:claimed` on the client's event channel.
|
|
2644
|
+
*/
|
|
2645
|
+
claimConversation(): Promise<Result<ClaimConversationResult, CimplifyError>>;
|
|
2581
2646
|
/** Open (or resume) the customer's widget conversation. */
|
|
2582
2647
|
openConversation(opts?: IdempotencyOption): Promise<Result<ChatConversationResponse, CimplifyError>>;
|
|
2583
2648
|
/**
|
|
@@ -2794,6 +2859,20 @@ declare class CimplifyClient {
|
|
|
2794
2859
|
getCredentialsMode(): RequestCredentials;
|
|
2795
2860
|
isTestMode(): boolean;
|
|
2796
2861
|
setAccessToken(token: string | null): void;
|
|
2862
|
+
/**
|
|
2863
|
+
* Zero-UI claim: a freshly verified customer identity (OTP verify, silent
|
|
2864
|
+
* refresh restore) binds the anonymous session so the conversation, cart
|
|
2865
|
+
* and orders survive a cleared browser. Best-effort by design — a failed
|
|
2866
|
+
* claim leaves the session anonymous, exactly as it was. Called by the
|
|
2867
|
+
* auth flows, never by the raw token setter.
|
|
2868
|
+
*/
|
|
2869
|
+
autoClaimChatIdentity(): void;
|
|
2870
|
+
/**
|
|
2871
|
+
* Adopt a server-rotated session token (claim flow). The old token stays
|
|
2872
|
+
* in flight-safe use until the next request; the storage swap makes the
|
|
2873
|
+
* rotation durable across reloads.
|
|
2874
|
+
*/
|
|
2875
|
+
adoptSessionToken(token: string): void;
|
|
2797
2876
|
clearSession(): void;
|
|
2798
2877
|
setOrderToken(orderId: string, token: string): void;
|
|
2799
2878
|
getOrderToken(orderId: string): string | null;
|
|
@@ -2853,4 +2932,4 @@ declare class CimplifyClient {
|
|
|
2853
2932
|
}
|
|
2854
2933
|
declare function createCimplifyClient(config?: CimplifyConfig): CimplifyClient;
|
|
2855
2934
|
|
|
2856
|
-
export { type CheckSlotAvailabilityInput as $, AUTHORIZATION_TYPE as A, type Booking as B, BusinessService as C, type BusinessSettings as D, type BusinessWithLocations as E, CHECKOUT_MODE as F, CHECKOUT_MUTATION as G, CHECKOUT_STEP as H, CONTACT_TYPE as I, type CacheOptions as J, type CancelBookingInput as K, type CancelBookingResult as L, type CancelOrderInput as M, type CancellationPolicy as N, CartOperations as O, CatalogueQueries as P, type CatalogueResult as Q, type CatalogueSnapshot as R, type CategoryInfo as S, type ChatAttachment as T, type ChatConversation as U, type ChatConversationResponse as V, type ChatMessage as W, type ChatReplyCard as X, type ChatReplyContext as Y, type ChatUploadAttachment as Z, type ChatWidgetStarter as _, AUTH_MUTATION as a, type
|
|
2935
|
+
export { type CheckSlotAvailabilityInput as $, AUTHORIZATION_TYPE as A, type Booking as B, BusinessService as C, type BusinessSettings as D, type BusinessWithLocations as E, CHECKOUT_MODE as F, CHECKOUT_MUTATION as G, CHECKOUT_STEP as H, CONTACT_TYPE as I, type CacheOptions as J, type CancelBookingInput as K, type CancelBookingResult as L, type CancelOrderInput as M, type CancellationPolicy as N, CartOperations as O, CatalogueQueries as P, type CatalogueResult as Q, type CatalogueSnapshot as R, type CategoryInfo as S, type ChatAttachment as T, type ChatConversation as U, type ChatConversationResponse as V, type ChatMessage as W, type ChatReplyCard as X, type ChatReplyContext as Y, type ChatUploadAttachment as Z, type ChatWidgetStarter as _, AUTH_MUTATION as a, type EnrollAndLinkOrderInput as a$, type CheckSlotAvailabilityResult as a0, type CheckoutAddressInfo as a1, type CheckoutCartData as a2, type CheckoutCartItem as a3, type CheckoutCustomerInfo as a4, type CheckoutFormData as a5, type CheckoutInput as a6, type CheckoutMode as a7, type CheckoutOrderType as a8, type CheckoutPaymentMethod as a9, type DeliveryFeeResponse as aA, type DeliveryOption as aB, type DeliveryOptionsResponse as aC, DeliveryService as aD, type DepositResult as aE, type DeviceType as aF, type DismissMessageResponse as aG, ELEMENTS_AUTH_CONTACT_TYPES as aH, ELEMENTS_AUTH_MODES as aI, ELEMENTS_AUTH_PROMPTS as aJ, ELEMENT_TYPES as aK, EVENT_TYPES as aL, type ElementAppearance as aM, type ElementEventHandler as aN, type ElementEventType as aO, type ElementOptions as aP, type ElementType as aQ, type ElementsAuthContactType as aR, type ElementsAuthMode as aS, type ElementsAuthOptions as aT, type ElementsAuthPrompt as aU, type ElementsCheckoutData as aV, type ElementsCheckoutResult as aW, type ElementsCustomerInfo as aX, type ElementsOptions as aY, type EnrichedOrder as aZ, type EnrichedOrderItem as a_, type CheckoutResult as aa, CheckoutService as ab, type CheckoutStatus as ac, type CheckoutStatusContext as ad, type CheckoutStep as ae, CimplifyClient as af, type CimplifyConfig as ag, CimplifyElement as ah, CimplifyElements as ai, type ClaimConversationResult as aj, type ContactType as ak, type ContentType as al, type CreateAddressInput as am, type CreateMobileMoneyInput as an, type Customer as ao, type CustomerAddress as ap, type CustomerBooking as aq, type CustomerBookingServiceItem as ar, type CustomerLinkPreferences as as, type CustomerMobileMoney as at, type CustomerServicePreferences as au, DEFAULT_COUNTRY as av, DEFAULT_CURRENCY as aw, DEVICE_TYPE as ax, type DayAvailability as ay, type DeliveryFeeDetails as az, type AbortablePromise as b, type OrderHistory as b$, type EnrollAndLinkOrderResult as b0, type EnrollmentData as b1, type Err as b2, type FeeBearerType as b3, type FetchQuoteInput as b4, type FulfillmentLink as b5, type FulfillmentStatus as b6, type FulfillmentSummaryDTO as b7, type FulfillmentType as b8, type FxQuote as b9, type LocationBooking as bA, type LocationTaxBehavior as bB, type LocationTaxOverrides as bC, type LocationTimeProfile as bD, type LocationWithDetails as bE, MESSAGE_TYPES as bF, MOBILE_MONEY_PROVIDER as bG, type MobileMoneyData as bH, type MobileMoneyDetails as bI, type MobileMoneyProvider as bJ, type NextAction as bK, ORDER_MUTATION as bL, ORDER_TYPE as bM, type ObservabilityHooks as bN, type Ok as bO, type Order as bP, type OrderCustomerInfo as bQ, type OrderDiscountInfo as bR, type OrderFilter as bS, type OrderFulfillmentSummary as bT, type OrderGroup as bU, type OrderGroupDetails as bV, type OrderGroupPayment as bW, type OrderGroupPaymentState as bX, type OrderGroupPaymentStatus as bY, type OrderGroupPaymentSummary as bZ, type OrderGroupStatus as b_, type FxQuoteRequest as ba, type FxQuoteStatus as bb, type FxRateResponse as bc, FxService as bd, type GetAvailableSlotsInput as be, type GetDeliveryOptionsParams as bf, type GetOrdersOptions as bg, type GetProductsOptions as bh, type GroupOrderInfo as bi, type IframeToParentMessage as bj, InventoryService as bk, LINK_MUTATION as bl, LINK_QUERY as bm, type LifecyclePhase as bn, type LineItem as bo, type LineType as bp, type LinkData as bq, type LinkEnrollResult as br, LinkService as bs, type LinkSession as bt, type LinkStatusResult as bu, type LiteBootstrap as bv, type LiteDayHours as bw, type LiteHoursRange as bx, LiteService as by, type Location as bz, type ActivityRecommendation as c, type RevokeAllSessionsResult as c$, type OrderLineState as c0, type OrderLineStatus as c1, type OrderLocationInfo as c2, type OrderPaymentEvent as c3, type OrderPricingView as c4, OrderQueries as c5, type OrderSplitDetail as c6, type OrderStaffInfo as c7, type OrderStatus as c8, type OrderTimestampsDTO as c9, type QuoteStatus as cA, type QuoteUiMessage as cB, type ReadRequestOptions as cC, type RefreshQuoteInput as cD, type RefreshQuoteResult as cE, type RefundOrderInput as cF, type RelatedCandidate as cG, type RelatedProduct as cH, type RelatedProductsEnrichment as cI, type RelationType as cJ, type ReminderMethod as cK, type ReminderSettings as cL, type ReorderResult as cM, type RequestContext as cN, type RequestErrorEvent as cO, type RequestOptions as cP, type RequestOtpInput as cQ, type RequestSource as cR, type RequestStartEvent as cS, type RequestSuccessEvent as cT, type RescheduleBookingInput as cU, type RescheduleBookingResult as cV, type RescheduleHistoryRecord as cW, type ResourceAssignment as cX, type ResourceInfo as cY, type Result as cZ, type RetryEvent as c_, type OrderType as ca, type Origin as cb, type OriginActor as cc, type OriginChannel as cd, type OtpResult as ce, PAYMENT_METHOD as cf, PAYMENT_MUTATION as cg, PAYMENT_STATE as ch, PICKUP_TIME_TYPE as ci, type ParentToIframeMessage as cj, type PaymentInfoDTO as ck, type PaymentMethodInfo as cl, type PaymentState as cm, type PickupTime as cn, type PickupTimeType as co, type PlaceDetailsResponse as cp, PlacesService as cq, type PriceQuote as cr, type PricingOverrides as cs, type ProcessAndResolveOptions as ct, type ProcessCheckoutOptions as cu, type ProcessCheckoutResult as cv, type ProviderResolutionSource as cw, type QuoteBundleSelectionInput as cx, type QuoteCompositeSelectionInput as cy, type QuoteDynamicBuckets as cz, type ActivityRecommendationsResponse as d, type RevokeSessionResult as d0, type Room as d1, type SchedulingMetadata as d2, type SchedulingResult as d3, SchedulingService as d4, type SenderType as d5, type Service as d6, type ServiceAvailabilityParams as d7, type ServiceAvailabilityResult as d8, type ServiceCharge as d9, type UpdateAddressInput as dA, type UpdateOrderStatusInput as dB, type UpdateProfileInput as dC, type UploadInitResponse as dD, type UploadResult as dE, UploadService as dF, type VerifyOtpInput as dG, combine as dH, combineObject as dI, createCimplifyClient as dJ, createElements as dK, err as dL, flatMap as dM, fromPromise as dN, getOrElse as dO, isErr as dP, isOk as dQ, mapError as dR, mapResult as dS, ok as dT, toNullable as dU, tryCatch as dV, unwrap as dW, type ServiceNotes as da, type ServiceScheduleRequest as db, type ServiceStatus as dc, type SessionActivityData as dd, type SessionChangeEvent as de, type SessionMessage as df, type SlotResourceInfo as dg, type SlotStaffInfo as dh, type Staff as di, type StaffAssignment as dj, type StaffRole as dk, type StaffScheduleItem as dl, type StockLevel as dm, type StockStatus as dn, type StoreCreditBalance as dp, StoreCreditQueries as dq, type StorefrontBootstrap as dr, SubscriptionService as ds, SupportService as dt, type Table as du, type TimeRange as dv, type TimeRanges as dw, type TimeSlot as dx, type TrackCategoryViewOptions as dy, type TrackProductViewOptions as dz, ActivityService as e, type ActivityStateResponse as f, type AddressData as g, type AddressInfo as h, type AmountToPay as i, type AuthResponse as j, AuthService as k, type AuthStatus as l, type AuthenticatedCustomer as m, type AuthenticatedData as n, type AutocompletePrediction as o, type AutocompleteResponse as p, type AvailabilityResult as q, type AvailableSlot as r, type BookingModificationType as s, type BookingStatus as t, type BookingWithDetails as u, type BufferTimes as v, type Business as w, type BusinessDetailsDTO as x, type BusinessHours as y, type BusinessPreferences as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { af as CimplifyClient } from './client-
|
|
2
|
-
import { A as AppHandle, C as CreateAppOptions } from './server-
|
|
1
|
+
import { af as CimplifyClient } from './client-BQbSKlHS.mjs';
|
|
2
|
+
import { A as AppHandle, C as CreateAppOptions } from './server-D-iK-bNt.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Test client + fixtures.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as CimplifyError, S as Category, aZ as Product, f as AddOnWithOptions, aQ as Pagination, bb as ProductWithDetails, b9 as ProductVariant, bF as VariantAxis, bG as VariantAxisSelection, A as AddOn, W as Collection, G as BundleSummary, u as Bundle, a3 as Composite, a1 as ComponentSelectionInput, a8 as CompositePriceResult, U as ChosenPrice, b6 as ProductTaxonomy, bx as TaxonomyWithChildren, ax as EligiblePlansQuery, b1 as ProductBillingPlan, b7 as ProductTimeProfile, b0 as ProductAvailabilityNow, aj as Deal, b2 as ProductDealInfo, ap as DiscountValidation, bu as TagsResponse, ae as CustomAttributeDefinition, af as CustomAttributeValue, bc as PropertyFacet, bw as TaxonomyAttributeTemplate, aJ as KnowledgeArticle, by as UICart, L as CartItem, Q as CartSummary, g as AddToCartInput, N as CartMutationResult, bE as UpdateCartItemInput, ao as DiscountDetails, aO as Money, ad as CurrencyCode, aK as LineConfiguration, bL as VariantDetails, bM as VariantDetailsDTO, a as AddOnDetails, d as AddOnOptionDetails, b as AddOnGroupDetails, D as BundleSelectionData, aa as CompositeSelectionData, ag as CustomerInputValue, bS as components, bk as SchedulingMode, av as DurationUnit, bo as Subscription, bs as SubscriptionWithDetails } from './product-
|
|
2
|
-
import { a as AuthorizationType, c as PaymentMethod, I as InitializePaymentResult, S as SubmitAuthorizationInput, i as PaymentStatusResponse } from './payment-
|
|
1
|
+
import { V as CimplifyError, S as Category, aZ as Product, f as AddOnWithOptions, aQ as Pagination, bb as ProductWithDetails, b9 as ProductVariant, bF as VariantAxis, bG as VariantAxisSelection, A as AddOn, W as Collection, G as BundleSummary, u as Bundle, a3 as Composite, a1 as ComponentSelectionInput, a8 as CompositePriceResult, U as ChosenPrice, b6 as ProductTaxonomy, bx as TaxonomyWithChildren, ax as EligiblePlansQuery, b1 as ProductBillingPlan, b7 as ProductTimeProfile, b0 as ProductAvailabilityNow, aj as Deal, b2 as ProductDealInfo, ap as DiscountValidation, bu as TagsResponse, ae as CustomAttributeDefinition, af as CustomAttributeValue, bc as PropertyFacet, bw as TaxonomyAttributeTemplate, aJ as KnowledgeArticle, by as UICart, L as CartItem, Q as CartSummary, g as AddToCartInput, N as CartMutationResult, bE as UpdateCartItemInput, ao as DiscountDetails, aO as Money, ad as CurrencyCode, aK as LineConfiguration, bL as VariantDetails, bM as VariantDetailsDTO, a as AddOnDetails, d as AddOnOptionDetails, b as AddOnGroupDetails, D as BundleSelectionData, aa as CompositeSelectionData, ag as CustomerInputValue, bS as components, bk as SchedulingMode, av as DurationUnit, bo as Subscription, bs as SubscriptionWithDetails } from './product-bZ8G5Z8D.js';
|
|
2
|
+
import { a as AuthorizationType, c as PaymentMethod, I as InitializePaymentResult, S as SubmitAuthorizationInput, i as PaymentStatusResponse } from './payment-Cq8FT1B6.js';
|
|
3
3
|
|
|
4
4
|
interface RequestContext {
|
|
5
5
|
method: "GET" | "POST" | "PATCH" | "DELETE";
|
|
@@ -65,12 +65,43 @@ interface OutboxFullEvent {
|
|
|
65
65
|
operation: string;
|
|
66
66
|
idempotencyKey: string;
|
|
67
67
|
}
|
|
68
|
+
interface TokenChangedEvent {
|
|
69
|
+
token: string | null;
|
|
70
|
+
}
|
|
71
|
+
interface SessionClaimedEvent {
|
|
72
|
+
sessionToken: string;
|
|
73
|
+
threadId: string | null;
|
|
74
|
+
customerName: string;
|
|
75
|
+
}
|
|
76
|
+
declare const MUTATION_ERROR: "mutation:error";
|
|
77
|
+
declare const OUTBOX_REPLAY_SUCCESS: "outbox:replay-success";
|
|
78
|
+
declare const OUTBOX_REPLAY_ERROR: "outbox:replay-error";
|
|
79
|
+
declare const OUTBOX_DEAD_LETTER: "outbox:dead-letter";
|
|
80
|
+
declare const OUTBOX_FULL: "outbox:full";
|
|
81
|
+
declare const AUTH_TOKEN_CHANGED: "auth:token-changed";
|
|
82
|
+
declare const SESSION_CLAIMED: "session:claimed";
|
|
83
|
+
declare const SESSION_CLEARED: "session:cleared";
|
|
68
84
|
interface ClientEventMap {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
[MUTATION_ERROR]: MutationErrorEvent;
|
|
86
|
+
[OUTBOX_REPLAY_SUCCESS]: OutboxReplayEvent;
|
|
87
|
+
[OUTBOX_REPLAY_ERROR]: OutboxReplayErrorEvent;
|
|
88
|
+
[OUTBOX_DEAD_LETTER]: OutboxReplayEvent;
|
|
89
|
+
[OUTBOX_FULL]: OutboxFullEvent;
|
|
90
|
+
[AUTH_TOKEN_CHANGED]: TokenChangedEvent;
|
|
91
|
+
/**
|
|
92
|
+
* The anonymous session was claimed for a verified Link identity: the
|
|
93
|
+
* session token rotated (already adopted by the client) and server-side
|
|
94
|
+
* state — conversation, cart, orders — now resolves customer-first.
|
|
95
|
+
* Consumers should refetch anything session-derived.
|
|
96
|
+
*/
|
|
97
|
+
[SESSION_CLAIMED]: SessionClaimedEvent;
|
|
98
|
+
/**
|
|
99
|
+
* The session was cleared (sign-out): the access token is gone and a
|
|
100
|
+
* fresh anonymous session token was minted. Everything keyed to the old
|
|
101
|
+
* session — conversation, cart, identity — must reset, not linger for
|
|
102
|
+
* the next person at this browser.
|
|
103
|
+
*/
|
|
104
|
+
[SESSION_CLEARED]: Record<string, never>;
|
|
74
105
|
}
|
|
75
106
|
type ClientEventName = keyof ClientEventMap;
|
|
76
107
|
type ClientEventListener<K extends ClientEventName> = (payload: ClientEventMap[K]) => void;
|
|
@@ -1381,6 +1412,10 @@ interface CheckoutFormData {
|
|
|
1381
1412
|
/** Store-credit voucher / gift code to claim into the wallet and apply to this
|
|
1382
1413
|
* order. Presenting a code implies applying store credit. */
|
|
1383
1414
|
voucher_code?: string;
|
|
1415
|
+
/** Pay only the required deposit now (balance collected later) instead of the
|
|
1416
|
+
* full total. Only honored when the order is deposit-eligible and paying in
|
|
1417
|
+
* the order's native currency. */
|
|
1418
|
+
pay_deposit?: boolean;
|
|
1384
1419
|
}
|
|
1385
1420
|
type NextAction = {
|
|
1386
1421
|
type: "none";
|
|
@@ -1560,6 +1595,7 @@ interface EnrichedOrderItem {
|
|
|
1560
1595
|
scheduled_end?: string;
|
|
1561
1596
|
confirmation_code?: string;
|
|
1562
1597
|
primary_staff_id?: string;
|
|
1598
|
+
units?: number;
|
|
1563
1599
|
base_price: Money;
|
|
1564
1600
|
add_ons_price: Money;
|
|
1565
1601
|
total_price: Money;
|
|
@@ -2005,6 +2041,7 @@ interface Service {
|
|
|
2005
2041
|
duration_value?: number;
|
|
2006
2042
|
duration_minutes: number;
|
|
2007
2043
|
duration_unit?: DurationUnit;
|
|
2044
|
+
price_basis?: "flat" | "per_person" | "per_duration_unit";
|
|
2008
2045
|
image_url?: string | null;
|
|
2009
2046
|
category_id?: string | null;
|
|
2010
2047
|
is_available: boolean;
|
|
@@ -2108,6 +2145,8 @@ interface GetAvailableSlotsInput {
|
|
|
2108
2145
|
service_id: string;
|
|
2109
2146
|
date: string;
|
|
2110
2147
|
participant_count?: number;
|
|
2148
|
+
/** Whole units needed; slots that can't seat them drop out. Default 1. */
|
|
2149
|
+
units?: number;
|
|
2111
2150
|
variant_id?: string;
|
|
2112
2151
|
}
|
|
2113
2152
|
interface CheckSlotAvailabilityInput {
|
|
@@ -2163,6 +2202,8 @@ interface ServiceAvailabilityParams {
|
|
|
2163
2202
|
end_date: string;
|
|
2164
2203
|
location_id?: string;
|
|
2165
2204
|
participant_count?: number;
|
|
2205
|
+
/** Whole units needed; short check-in days report unavailable. Default 1. */
|
|
2206
|
+
units?: number;
|
|
2166
2207
|
variant_id?: string;
|
|
2167
2208
|
}
|
|
2168
2209
|
interface ServiceAvailabilityResult {
|
|
@@ -2254,7 +2295,11 @@ interface LiteBootstrapLocation {
|
|
|
2254
2295
|
interface LiteBootstrap {
|
|
2255
2296
|
business: LiteBootstrapBusiness;
|
|
2256
2297
|
categories: LiteBootstrapCategory[];
|
|
2298
|
+
/** The resolved ordering location: the QR / query choice, else the first
|
|
2299
|
+
* active branch. Null only for a business with no locations at all. */
|
|
2257
2300
|
location?: LiteBootstrapLocation | null;
|
|
2301
|
+
/** Every active branch — more than one means the customer can switch. */
|
|
2302
|
+
locations?: LiteBootstrapLocation[];
|
|
2258
2303
|
}
|
|
2259
2304
|
interface LiteResource {
|
|
2260
2305
|
id: string;
|
|
@@ -2560,13 +2605,17 @@ type ChatReplyCard = {
|
|
|
2560
2605
|
order_number?: string;
|
|
2561
2606
|
status?: string;
|
|
2562
2607
|
};
|
|
2563
|
-
declare function chatMessageCards(message: {
|
|
2564
|
-
metadata: Record<string, unknown>;
|
|
2565
|
-
}): ChatReplyCard[];
|
|
2566
2608
|
interface ChatConversationResponse {
|
|
2567
2609
|
conversation: ChatConversation;
|
|
2568
2610
|
messages: ChatMessage[];
|
|
2569
2611
|
}
|
|
2612
|
+
interface ClaimConversationResult {
|
|
2613
|
+
/** The rotated, customer-bound session token; the SDK adopts it automatically. */
|
|
2614
|
+
session_token: string;
|
|
2615
|
+
/** The adopted (or merged-into) conversation; null when there was nothing to adopt. */
|
|
2616
|
+
thread_id?: string | null;
|
|
2617
|
+
customer_name: string;
|
|
2618
|
+
}
|
|
2570
2619
|
interface ChatWidgetStarter {
|
|
2571
2620
|
icon?: string;
|
|
2572
2621
|
text: string;
|
|
@@ -2577,7 +2626,23 @@ interface IdempotencyOption {
|
|
|
2577
2626
|
}
|
|
2578
2627
|
declare class SupportService {
|
|
2579
2628
|
private client;
|
|
2629
|
+
private claimInFlight;
|
|
2630
|
+
private lastClaimedAccessToken;
|
|
2631
|
+
private claimedName;
|
|
2580
2632
|
constructor(client: CimplifyClient);
|
|
2633
|
+
/** The verified customer this session's conversation was claimed for, null while anonymous. */
|
|
2634
|
+
get claimedCustomerName(): string | null;
|
|
2635
|
+
/**
|
|
2636
|
+
* Claim the anonymous session for the verified Link identity: the server
|
|
2637
|
+
* verifies the access token, rotates the session token (adopted here, so
|
|
2638
|
+
* every subsequent request rides the bound session), folds the guest cart
|
|
2639
|
+
* in, and adopts or merges the widget conversation.
|
|
2640
|
+
*
|
|
2641
|
+
* Idempotent and single-flight: concurrent calls share one request, and a
|
|
2642
|
+
* token already claimed by this instance short-circuits without a network
|
|
2643
|
+
* round trip. Emits `session:claimed` on the client's event channel.
|
|
2644
|
+
*/
|
|
2645
|
+
claimConversation(): Promise<Result<ClaimConversationResult, CimplifyError>>;
|
|
2581
2646
|
/** Open (or resume) the customer's widget conversation. */
|
|
2582
2647
|
openConversation(opts?: IdempotencyOption): Promise<Result<ChatConversationResponse, CimplifyError>>;
|
|
2583
2648
|
/**
|
|
@@ -2794,6 +2859,20 @@ declare class CimplifyClient {
|
|
|
2794
2859
|
getCredentialsMode(): RequestCredentials;
|
|
2795
2860
|
isTestMode(): boolean;
|
|
2796
2861
|
setAccessToken(token: string | null): void;
|
|
2862
|
+
/**
|
|
2863
|
+
* Zero-UI claim: a freshly verified customer identity (OTP verify, silent
|
|
2864
|
+
* refresh restore) binds the anonymous session so the conversation, cart
|
|
2865
|
+
* and orders survive a cleared browser. Best-effort by design — a failed
|
|
2866
|
+
* claim leaves the session anonymous, exactly as it was. Called by the
|
|
2867
|
+
* auth flows, never by the raw token setter.
|
|
2868
|
+
*/
|
|
2869
|
+
autoClaimChatIdentity(): void;
|
|
2870
|
+
/**
|
|
2871
|
+
* Adopt a server-rotated session token (claim flow). The old token stays
|
|
2872
|
+
* in flight-safe use until the next request; the storage swap makes the
|
|
2873
|
+
* rotation durable across reloads.
|
|
2874
|
+
*/
|
|
2875
|
+
adoptSessionToken(token: string): void;
|
|
2797
2876
|
clearSession(): void;
|
|
2798
2877
|
setOrderToken(orderId: string, token: string): void;
|
|
2799
2878
|
getOrderToken(orderId: string): string | null;
|
|
@@ -2853,4 +2932,4 @@ declare class CimplifyClient {
|
|
|
2853
2932
|
}
|
|
2854
2933
|
declare function createCimplifyClient(config?: CimplifyConfig): CimplifyClient;
|
|
2855
2934
|
|
|
2856
|
-
export { type CheckSlotAvailabilityInput as $, AUTHORIZATION_TYPE as A, type Booking as B, BusinessService as C, type BusinessSettings as D, type BusinessWithLocations as E, CHECKOUT_MODE as F, CHECKOUT_MUTATION as G, CHECKOUT_STEP as H, CONTACT_TYPE as I, type CacheOptions as J, type CancelBookingInput as K, type CancelBookingResult as L, type CancelOrderInput as M, type CancellationPolicy as N, CartOperations as O, CatalogueQueries as P, type CatalogueResult as Q, type CatalogueSnapshot as R, type CategoryInfo as S, type ChatAttachment as T, type ChatConversation as U, type ChatConversationResponse as V, type ChatMessage as W, type ChatReplyCard as X, type ChatReplyContext as Y, type ChatUploadAttachment as Z, type ChatWidgetStarter as _, AUTH_MUTATION as a, type
|
|
2935
|
+
export { type CheckSlotAvailabilityInput as $, AUTHORIZATION_TYPE as A, type Booking as B, BusinessService as C, type BusinessSettings as D, type BusinessWithLocations as E, CHECKOUT_MODE as F, CHECKOUT_MUTATION as G, CHECKOUT_STEP as H, CONTACT_TYPE as I, type CacheOptions as J, type CancelBookingInput as K, type CancelBookingResult as L, type CancelOrderInput as M, type CancellationPolicy as N, CartOperations as O, CatalogueQueries as P, type CatalogueResult as Q, type CatalogueSnapshot as R, type CategoryInfo as S, type ChatAttachment as T, type ChatConversation as U, type ChatConversationResponse as V, type ChatMessage as W, type ChatReplyCard as X, type ChatReplyContext as Y, type ChatUploadAttachment as Z, type ChatWidgetStarter as _, AUTH_MUTATION as a, type EnrollAndLinkOrderInput as a$, type CheckSlotAvailabilityResult as a0, type CheckoutAddressInfo as a1, type CheckoutCartData as a2, type CheckoutCartItem as a3, type CheckoutCustomerInfo as a4, type CheckoutFormData as a5, type CheckoutInput as a6, type CheckoutMode as a7, type CheckoutOrderType as a8, type CheckoutPaymentMethod as a9, type DeliveryFeeResponse as aA, type DeliveryOption as aB, type DeliveryOptionsResponse as aC, DeliveryService as aD, type DepositResult as aE, type DeviceType as aF, type DismissMessageResponse as aG, ELEMENTS_AUTH_CONTACT_TYPES as aH, ELEMENTS_AUTH_MODES as aI, ELEMENTS_AUTH_PROMPTS as aJ, ELEMENT_TYPES as aK, EVENT_TYPES as aL, type ElementAppearance as aM, type ElementEventHandler as aN, type ElementEventType as aO, type ElementOptions as aP, type ElementType as aQ, type ElementsAuthContactType as aR, type ElementsAuthMode as aS, type ElementsAuthOptions as aT, type ElementsAuthPrompt as aU, type ElementsCheckoutData as aV, type ElementsCheckoutResult as aW, type ElementsCustomerInfo as aX, type ElementsOptions as aY, type EnrichedOrder as aZ, type EnrichedOrderItem as a_, type CheckoutResult as aa, CheckoutService as ab, type CheckoutStatus as ac, type CheckoutStatusContext as ad, type CheckoutStep as ae, CimplifyClient as af, type CimplifyConfig as ag, CimplifyElement as ah, CimplifyElements as ai, type ClaimConversationResult as aj, type ContactType as ak, type ContentType as al, type CreateAddressInput as am, type CreateMobileMoneyInput as an, type Customer as ao, type CustomerAddress as ap, type CustomerBooking as aq, type CustomerBookingServiceItem as ar, type CustomerLinkPreferences as as, type CustomerMobileMoney as at, type CustomerServicePreferences as au, DEFAULT_COUNTRY as av, DEFAULT_CURRENCY as aw, DEVICE_TYPE as ax, type DayAvailability as ay, type DeliveryFeeDetails as az, type AbortablePromise as b, type OrderHistory as b$, type EnrollAndLinkOrderResult as b0, type EnrollmentData as b1, type Err as b2, type FeeBearerType as b3, type FetchQuoteInput as b4, type FulfillmentLink as b5, type FulfillmentStatus as b6, type FulfillmentSummaryDTO as b7, type FulfillmentType as b8, type FxQuote as b9, type LocationBooking as bA, type LocationTaxBehavior as bB, type LocationTaxOverrides as bC, type LocationTimeProfile as bD, type LocationWithDetails as bE, MESSAGE_TYPES as bF, MOBILE_MONEY_PROVIDER as bG, type MobileMoneyData as bH, type MobileMoneyDetails as bI, type MobileMoneyProvider as bJ, type NextAction as bK, ORDER_MUTATION as bL, ORDER_TYPE as bM, type ObservabilityHooks as bN, type Ok as bO, type Order as bP, type OrderCustomerInfo as bQ, type OrderDiscountInfo as bR, type OrderFilter as bS, type OrderFulfillmentSummary as bT, type OrderGroup as bU, type OrderGroupDetails as bV, type OrderGroupPayment as bW, type OrderGroupPaymentState as bX, type OrderGroupPaymentStatus as bY, type OrderGroupPaymentSummary as bZ, type OrderGroupStatus as b_, type FxQuoteRequest as ba, type FxQuoteStatus as bb, type FxRateResponse as bc, FxService as bd, type GetAvailableSlotsInput as be, type GetDeliveryOptionsParams as bf, type GetOrdersOptions as bg, type GetProductsOptions as bh, type GroupOrderInfo as bi, type IframeToParentMessage as bj, InventoryService as bk, LINK_MUTATION as bl, LINK_QUERY as bm, type LifecyclePhase as bn, type LineItem as bo, type LineType as bp, type LinkData as bq, type LinkEnrollResult as br, LinkService as bs, type LinkSession as bt, type LinkStatusResult as bu, type LiteBootstrap as bv, type LiteDayHours as bw, type LiteHoursRange as bx, LiteService as by, type Location as bz, type ActivityRecommendation as c, type RevokeAllSessionsResult as c$, type OrderLineState as c0, type OrderLineStatus as c1, type OrderLocationInfo as c2, type OrderPaymentEvent as c3, type OrderPricingView as c4, OrderQueries as c5, type OrderSplitDetail as c6, type OrderStaffInfo as c7, type OrderStatus as c8, type OrderTimestampsDTO as c9, type QuoteStatus as cA, type QuoteUiMessage as cB, type ReadRequestOptions as cC, type RefreshQuoteInput as cD, type RefreshQuoteResult as cE, type RefundOrderInput as cF, type RelatedCandidate as cG, type RelatedProduct as cH, type RelatedProductsEnrichment as cI, type RelationType as cJ, type ReminderMethod as cK, type ReminderSettings as cL, type ReorderResult as cM, type RequestContext as cN, type RequestErrorEvent as cO, type RequestOptions as cP, type RequestOtpInput as cQ, type RequestSource as cR, type RequestStartEvent as cS, type RequestSuccessEvent as cT, type RescheduleBookingInput as cU, type RescheduleBookingResult as cV, type RescheduleHistoryRecord as cW, type ResourceAssignment as cX, type ResourceInfo as cY, type Result as cZ, type RetryEvent as c_, type OrderType as ca, type Origin as cb, type OriginActor as cc, type OriginChannel as cd, type OtpResult as ce, PAYMENT_METHOD as cf, PAYMENT_MUTATION as cg, PAYMENT_STATE as ch, PICKUP_TIME_TYPE as ci, type ParentToIframeMessage as cj, type PaymentInfoDTO as ck, type PaymentMethodInfo as cl, type PaymentState as cm, type PickupTime as cn, type PickupTimeType as co, type PlaceDetailsResponse as cp, PlacesService as cq, type PriceQuote as cr, type PricingOverrides as cs, type ProcessAndResolveOptions as ct, type ProcessCheckoutOptions as cu, type ProcessCheckoutResult as cv, type ProviderResolutionSource as cw, type QuoteBundleSelectionInput as cx, type QuoteCompositeSelectionInput as cy, type QuoteDynamicBuckets as cz, type ActivityRecommendationsResponse as d, type RevokeSessionResult as d0, type Room as d1, type SchedulingMetadata as d2, type SchedulingResult as d3, SchedulingService as d4, type SenderType as d5, type Service as d6, type ServiceAvailabilityParams as d7, type ServiceAvailabilityResult as d8, type ServiceCharge as d9, type UpdateAddressInput as dA, type UpdateOrderStatusInput as dB, type UpdateProfileInput as dC, type UploadInitResponse as dD, type UploadResult as dE, UploadService as dF, type VerifyOtpInput as dG, combine as dH, combineObject as dI, createCimplifyClient as dJ, createElements as dK, err as dL, flatMap as dM, fromPromise as dN, getOrElse as dO, isErr as dP, isOk as dQ, mapError as dR, mapResult as dS, ok as dT, toNullable as dU, tryCatch as dV, unwrap as dW, type ServiceNotes as da, type ServiceScheduleRequest as db, type ServiceStatus as dc, type SessionActivityData as dd, type SessionChangeEvent as de, type SessionMessage as df, type SlotResourceInfo as dg, type SlotStaffInfo as dh, type Staff as di, type StaffAssignment as dj, type StaffRole as dk, type StaffScheduleItem as dl, type StockLevel as dm, type StockStatus as dn, type StoreCreditBalance as dp, StoreCreditQueries as dq, type StorefrontBootstrap as dr, SubscriptionService as ds, SupportService as dt, type Table as du, type TimeRange as dv, type TimeRanges as dw, type TimeSlot as dx, type TrackCategoryViewOptions as dy, type TrackProductViewOptions as dz, ActivityService as e, type ActivityStateResponse as f, type AddressData as g, type AddressInfo as h, type AmountToPay as i, type AuthResponse as j, AuthService as k, type AuthStatus as l, type AuthenticatedCustomer as m, type AuthenticatedData as n, type AutocompletePrediction as o, type AutocompleteResponse as p, type AvailabilityResult as q, type AvailableSlot as r, type BookingModificationType as s, type BookingStatus as t, type BookingWithDetails as u, type BufferTimes as v, type Business as w, type BusinessDetailsDTO as x, type BusinessHours as y, type BusinessPreferences as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { af as CimplifyClient } from './client-
|
|
2
|
-
import { A as AppHandle, C as CreateAppOptions } from './server-
|
|
1
|
+
import { af as CimplifyClient } from './client-CeW3acve.js';
|
|
2
|
+
import { A as AppHandle, C as CreateAppOptions } from './server-DwsY9hlX.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Test client + fixtures.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { aO as Money, ad as CurrencyCode, aX as PricePathTaxInfo, aZ as Product, bb as ProductWithDetails, be as QuantityPricingTier } from './product-
|
|
2
|
-
import { P as ProductWithPrice } from './price-
|
|
3
|
-
import { b as PaymentErrorDetails, g as PaymentResponse, i as PaymentStatusResponse } from './payment-
|
|
1
|
+
import { aO as Money, ad as CurrencyCode, aX as PricePathTaxInfo, aZ as Product, bb as ProductWithDetails, be as QuantityPricingTier } from './product-bZ8G5Z8D.mjs';
|
|
2
|
+
import { P as ProductWithPrice } from './price-DleDWk_s.mjs';
|
|
3
|
+
import { b as PaymentErrorDetails, g as PaymentResponse, i as PaymentStatusResponse } from './payment-BFtLqiG2.mjs';
|
|
4
4
|
import { CountryCode } from 'libphonenumber-js';
|
|
5
5
|
|
|
6
6
|
declare const CURRENCY_SYMBOLS: Record<string, string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { aO as Money, ad as CurrencyCode, aX as PricePathTaxInfo, aZ as Product, bb as ProductWithDetails, be as QuantityPricingTier } from './product-
|
|
2
|
-
import { P as ProductWithPrice } from './price-
|
|
3
|
-
import { b as PaymentErrorDetails, g as PaymentResponse, i as PaymentStatusResponse } from './payment-
|
|
1
|
+
import { aO as Money, ad as CurrencyCode, aX as PricePathTaxInfo, aZ as Product, bb as ProductWithDetails, be as QuantityPricingTier } from './product-bZ8G5Z8D.js';
|
|
2
|
+
import { P as ProductWithPrice } from './price-DaFXT-Lr.js';
|
|
3
|
+
import { b as PaymentErrorDetails, g as PaymentResponse, i as PaymentStatusResponse } from './payment-Cq8FT1B6.js';
|
|
4
4
|
import { CountryCode } from 'libphonenumber-js';
|
|
5
5
|
|
|
6
6
|
declare const CURRENCY_SYMBOLS: Record<string, string>;
|