@cimplify/sdk 0.9.9 → 0.10.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/{ads-MkGm5l1T.d.mts → ads-BxbWrwqp.d.mts} +0 -8
- package/dist/{ads-MkGm5l1T.d.ts → ads-BxbWrwqp.d.ts} +0 -8
- package/dist/advanced.d.mts +2 -2
- package/dist/advanced.d.ts +2 -2
- package/dist/advanced.js +93 -80
- package/dist/advanced.mjs +93 -80
- package/dist/cli.js +184 -0
- package/dist/{client-CYRL8s1S.d.ts → client-BSrq89H1.d.mts} +42 -374
- package/dist/{client-D4EiM667.d.mts → client-xBhdHLq4.d.ts} +42 -374
- package/dist/index.d.mts +6 -10
- package/dist/index.d.ts +6 -10
- package/dist/index.js +98 -126
- package/dist/index.mjs +98 -126
- package/dist/{payment-D58dS_E9.d.mts → payment-CrNyrc-D.d.mts} +145 -94
- package/dist/{payment-D58dS_E9.d.ts → payment-CrNyrc-D.d.ts} +145 -94
- package/dist/price-C9Z-hr49.d.mts +21 -0
- package/dist/price-RKKoTz-9.d.ts +21 -0
- package/dist/react.d.mts +1285 -35
- package/dist/react.d.ts +1285 -35
- package/dist/react.js +6782 -2781
- package/dist/react.mjs +6736 -2783
- package/dist/utils.d.mts +55 -2
- package/dist/utils.d.ts +55 -2
- package/dist/utils.js +23 -20
- package/dist/utils.mjs +23 -20
- package/package.json +13 -3
- package/registry/add-on-selector.json +15 -0
- package/registry/availability-badge.json +15 -0
- package/registry/booking-card.json +16 -0
- package/registry/booking-list.json +16 -0
- package/registry/booking-page.json +18 -0
- package/registry/bookings-page.json +17 -0
- package/registry/bundle-selector.json +15 -0
- package/registry/cart-page.json +17 -0
- package/registry/cart-summary.json +16 -0
- package/registry/catalogue-page.json +18 -0
- package/registry/category-filter.json +15 -0
- package/registry/category-grid.json +15 -0
- package/registry/checkout-page.json +15 -0
- package/registry/cn.json +13 -0
- package/registry/collection-page.json +16 -0
- package/registry/composite-selector.json +15 -0
- package/registry/date-slot-picker.json +16 -0
- package/registry/deal-banner.json +16 -0
- package/registry/deals-page.json +19 -0
- package/registry/discount-input.json +16 -0
- package/registry/index.json +411 -0
- package/registry/order-detail-page.json +16 -0
- package/registry/order-history-page.json +17 -0
- package/registry/order-history.json +16 -0
- package/registry/order-summary.json +16 -0
- package/registry/price.json +13 -0
- package/registry/product-card.json +17 -0
- package/registry/product-customizer.json +20 -0
- package/registry/product-grid.json +16 -0
- package/registry/product-image-gallery.json +13 -0
- package/registry/product-page.json +19 -0
- package/registry/product-sheet.json +18 -0
- package/registry/quantity-selector.json +13 -0
- package/registry/sale-badge.json +16 -0
- package/registry/search-input.json +15 -0
- package/registry/search-page.json +16 -0
- package/registry/service-card.json +16 -0
- package/registry/service-grid.json +16 -0
- package/registry/slot-picker.json +16 -0
- package/registry/staff-picker.json +15 -0
- package/registry/store-nav.json +15 -0
- package/registry/variant-selector.json +15 -0
- package/dist/index-DN_qtwG0.d.mts +0 -320
- package/dist/index-jUGW3oGR.d.ts +0 -320
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Derive a human-readable display name for a variant.
|
|
3
|
-
*
|
|
4
|
-
* Priority: display_attributes → name (stripped of product prefix) → fallback.
|
|
5
|
-
*
|
|
6
|
-
* Pass `productName` to strip redundant product-name prefixes from variant names
|
|
7
|
-
* (e.g. "Fried rice-Small" → "Small" when productName is "Fried rice").
|
|
8
|
-
*/
|
|
9
1
|
declare function getVariantDisplayName(variant: {
|
|
10
2
|
name?: string;
|
|
11
3
|
display_attributes?: Array<{
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Derive a human-readable display name for a variant.
|
|
3
|
-
*
|
|
4
|
-
* Priority: display_attributes → name (stripped of product prefix) → fallback.
|
|
5
|
-
*
|
|
6
|
-
* Pass `productName` to strip redundant product-name prefixes from variant names
|
|
7
|
-
* (e.g. "Fried rice-Small" → "Small" when productName is "Fried rice").
|
|
8
|
-
*/
|
|
9
1
|
declare function getVariantDisplayName(variant: {
|
|
10
2
|
name?: string;
|
|
11
3
|
display_attributes?: Array<{
|
package/dist/advanced.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as AuthService, B as BusinessService,
|
|
2
|
-
import './payment-
|
|
1
|
+
export { A as AuthService, B as BusinessService, j as CartOperations, b as CatalogueQueries, k as CheckoutOperations, k as CheckoutService, u as CimplifyElement, t as CimplifyElements, w as ELEMENT_TYPES, E as EVENT_TYPES, D as ElementEventType, y as ElementOptions, z as ElementType, x as ElementsOptions, F as FetchQuoteInput, r as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, q as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, i as RefreshQuoteResult, p as SchedulingService, S as SearchOptions, v as createElements, l as generateIdempotencyKey } from './client-BSrq89H1.mjs';
|
|
2
|
+
import './payment-CrNyrc-D.mjs';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
|
5
5
|
type SortOrder = "asc" | "desc";
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as AuthService, B as BusinessService,
|
|
2
|
-
import './payment-
|
|
1
|
+
export { A as AuthService, B as BusinessService, j as CartOperations, b as CatalogueQueries, k as CheckoutOperations, k as CheckoutService, u as CimplifyElement, t as CimplifyElements, w as ELEMENT_TYPES, E as EVENT_TYPES, D as ElementEventType, y as ElementOptions, z as ElementType, x as ElementsOptions, F as FetchQuoteInput, r as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, q as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, i as RefreshQuoteResult, p as SchedulingService, S as SearchOptions, v as createElements, l as generateIdempotencyKey } from './client-xBhdHLq4.js';
|
|
2
|
+
import './payment-CrNyrc-D.js';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
|
5
5
|
type SortOrder = "asc" | "desc";
|
package/dist/advanced.js
CHANGED
|
@@ -10,16 +10,15 @@ function err(error) {
|
|
|
10
10
|
|
|
11
11
|
// src/types/common.ts
|
|
12
12
|
function money(value) {
|
|
13
|
-
return value;
|
|
13
|
+
return typeof value === "string" ? parseFloat(value) || 0 : value;
|
|
14
14
|
}
|
|
15
15
|
function moneyFromNumber(value) {
|
|
16
|
-
return value
|
|
16
|
+
return value;
|
|
17
17
|
}
|
|
18
18
|
function currencyCode(value) {
|
|
19
19
|
return value;
|
|
20
20
|
}
|
|
21
21
|
var ErrorCode = {
|
|
22
|
-
// General
|
|
23
22
|
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
|
24
23
|
NOT_FOUND: "NOT_FOUND"};
|
|
25
24
|
var DOCS_ERROR_BASE_URL = "https://docs.cimplify.io/reference/error-codes";
|
|
@@ -94,7 +93,6 @@ var CimplifyError = class extends Error {
|
|
|
94
93
|
this.suggestion = suggestion;
|
|
95
94
|
this.name = "CimplifyError";
|
|
96
95
|
}
|
|
97
|
-
/** User-friendly message safe to display */
|
|
98
96
|
get userMessage() {
|
|
99
97
|
return this.message;
|
|
100
98
|
}
|
|
@@ -280,6 +278,7 @@ var CatalogueQueries = class {
|
|
|
280
278
|
async getProducts(options) {
|
|
281
279
|
const path = withQuery("/api/v1/catalogue/products", {
|
|
282
280
|
category_id: options?.category,
|
|
281
|
+
taxonomy_id: options?.taxonomy,
|
|
283
282
|
search: options?.search,
|
|
284
283
|
page: options?.page,
|
|
285
284
|
tags: options?.tags?.join(","),
|
|
@@ -412,6 +411,59 @@ var CatalogueQueries = class {
|
|
|
412
411
|
)
|
|
413
412
|
);
|
|
414
413
|
}
|
|
414
|
+
async getTaxonomies(parentId) {
|
|
415
|
+
const path = withQuery("/api/v1/catalogue/taxonomies", { parent_id: parentId });
|
|
416
|
+
return safe(this.client.get(path));
|
|
417
|
+
}
|
|
418
|
+
async getTaxonomy(id) {
|
|
419
|
+
const encodedId = encodeURIComponent(id);
|
|
420
|
+
return safe(this.client.get(`/api/v1/catalogue/taxonomies/${encodedId}`));
|
|
421
|
+
}
|
|
422
|
+
async getTaxonomyPath(id) {
|
|
423
|
+
const encodedId = encodeURIComponent(id);
|
|
424
|
+
return safe(this.client.get(`/api/v1/catalogue/taxonomies/${encodedId}/path`));
|
|
425
|
+
}
|
|
426
|
+
async searchTaxonomies(query2, limit) {
|
|
427
|
+
const path = withQuery("/api/v1/catalogue/taxonomies/search", { q: query2, limit });
|
|
428
|
+
return safe(this.client.get(path));
|
|
429
|
+
}
|
|
430
|
+
async getProductSchedules(productId) {
|
|
431
|
+
const encodedId = encodeURIComponent(productId);
|
|
432
|
+
return safe(this.client.get(`/api/v1/catalogue/products/${encodedId}/schedules`));
|
|
433
|
+
}
|
|
434
|
+
async checkProductAvailableNow(productId, locationId) {
|
|
435
|
+
const encodedId = encodeURIComponent(productId);
|
|
436
|
+
const path = withQuery(`/api/v1/catalogue/products/${encodedId}/available-now`, { location_id: locationId });
|
|
437
|
+
return safe(this.client.get(path));
|
|
438
|
+
}
|
|
439
|
+
async getDeals(locationId) {
|
|
440
|
+
const path = withQuery("/api/v1/catalogue/deals", { location_id: locationId });
|
|
441
|
+
return safe(this.client.get(path));
|
|
442
|
+
}
|
|
443
|
+
async getProductsOnSale() {
|
|
444
|
+
return safe(this.client.get("/api/v1/catalogue/deals/on-sale"));
|
|
445
|
+
}
|
|
446
|
+
async getProductDeals(productId) {
|
|
447
|
+
const encodedId = encodeURIComponent(productId);
|
|
448
|
+
return safe(this.client.get(`/api/v1/catalogue/products/${encodedId}/deals`));
|
|
449
|
+
}
|
|
450
|
+
async getCategoryDeals(categoryId) {
|
|
451
|
+
const encodedId = encodeURIComponent(categoryId);
|
|
452
|
+
return safe(this.client.get(`/api/v1/catalogue/categories/${encodedId}/deals`));
|
|
453
|
+
}
|
|
454
|
+
async getCollectionDeals(collectionId) {
|
|
455
|
+
const encodedId = encodeURIComponent(collectionId);
|
|
456
|
+
return safe(this.client.get(`/api/v1/catalogue/collections/${encodedId}/deals`));
|
|
457
|
+
}
|
|
458
|
+
async validateDiscountCode(code, orderSubtotal, locationId) {
|
|
459
|
+
return safe(
|
|
460
|
+
this.client.post("/api/v1/catalogue/deals/validate", {
|
|
461
|
+
discount_code: code,
|
|
462
|
+
order_subtotal: orderSubtotal,
|
|
463
|
+
location_id: locationId
|
|
464
|
+
})
|
|
465
|
+
);
|
|
466
|
+
}
|
|
415
467
|
async search(query2, options) {
|
|
416
468
|
const result = await this.getProducts({
|
|
417
469
|
search: query2,
|
|
@@ -439,6 +491,16 @@ var CatalogueQueries = class {
|
|
|
439
491
|
const encodedId = encodeURIComponent(itemId);
|
|
440
492
|
return safe(this.client.get(`/api/v1/catalogue/menu/items/${encodedId}`));
|
|
441
493
|
}
|
|
494
|
+
async getTags(options) {
|
|
495
|
+
const path = withQuery("/api/v1/catalogue/tags", {
|
|
496
|
+
tag_group: options?.tag_group,
|
|
497
|
+
search: options?.search,
|
|
498
|
+
min_usage: options?.min_usage,
|
|
499
|
+
limit: options?.limit,
|
|
500
|
+
offset: options?.offset
|
|
501
|
+
});
|
|
502
|
+
return safe(this.client.get(path));
|
|
503
|
+
}
|
|
442
504
|
};
|
|
443
505
|
|
|
444
506
|
// src/cart.ts
|
|
@@ -588,7 +650,8 @@ var PAYMENT_FAILURE_STATUSES = /* @__PURE__ */ new Set([
|
|
|
588
650
|
"declined",
|
|
589
651
|
"cancelled",
|
|
590
652
|
"voided",
|
|
591
|
-
"error"
|
|
653
|
+
"error",
|
|
654
|
+
"abandoned"
|
|
592
655
|
]);
|
|
593
656
|
var PAYMENT_REQUIRES_ACTION_STATUSES = /* @__PURE__ */ new Set([
|
|
594
657
|
"requires_action",
|
|
@@ -618,29 +681,34 @@ var PAYMENT_STATUS_ALIAS_MAP = {
|
|
|
618
681
|
unresolved: "pending"
|
|
619
682
|
};
|
|
620
683
|
var KNOWN_PAYMENT_STATUSES = /* @__PURE__ */ new Set([
|
|
684
|
+
"initialized",
|
|
621
685
|
"pending",
|
|
622
686
|
"processing",
|
|
687
|
+
"authorized",
|
|
688
|
+
"captured",
|
|
689
|
+
"failed",
|
|
690
|
+
"cancelled",
|
|
691
|
+
"refunded",
|
|
692
|
+
"unknown",
|
|
693
|
+
"voided",
|
|
694
|
+
"requires_action",
|
|
695
|
+
"abandoned",
|
|
696
|
+
"reversed",
|
|
697
|
+
"disputed",
|
|
698
|
+
"refund_pending",
|
|
623
699
|
"created",
|
|
624
700
|
"pending_confirmation",
|
|
625
701
|
"success",
|
|
626
702
|
"succeeded",
|
|
627
|
-
"failed",
|
|
628
703
|
"declined",
|
|
629
|
-
"authorized",
|
|
630
|
-
"refunded",
|
|
631
704
|
"partially_refunded",
|
|
632
705
|
"partially_paid",
|
|
633
706
|
"paid",
|
|
634
707
|
"unpaid",
|
|
635
|
-
"requires_action",
|
|
636
708
|
"requires_payment_method",
|
|
637
709
|
"requires_capture",
|
|
638
|
-
"captured",
|
|
639
|
-
"cancelled",
|
|
640
710
|
"completed",
|
|
641
|
-
"
|
|
642
|
-
"error",
|
|
643
|
-
"unknown"
|
|
711
|
+
"error"
|
|
644
712
|
]);
|
|
645
713
|
function normalizeStatusToken(status) {
|
|
646
714
|
return status?.trim().toLowerCase().replace(/[\s-]+/g, "_") ?? "";
|
|
@@ -669,13 +737,15 @@ function normalizeStatusResponse(response) {
|
|
|
669
737
|
return {
|
|
670
738
|
status: "pending",
|
|
671
739
|
paid: false,
|
|
740
|
+
amount: moneyFromNumber(0),
|
|
741
|
+
currency: "",
|
|
672
742
|
message: "No status available"
|
|
673
743
|
};
|
|
674
744
|
}
|
|
675
745
|
const res = response;
|
|
676
746
|
const normalizedStatus = normalizePaymentStatusValue(res.status ?? void 0);
|
|
677
|
-
const normalizedAmount = typeof res.amount === "string" ? money(res.amount) : typeof res.amount === "number" && Number.isFinite(res.amount) ? moneyFromNumber(res.amount) :
|
|
678
|
-
const normalizedCurrency = typeof res.currency === "string" && res.currency.trim().length > 0 ?
|
|
747
|
+
const normalizedAmount = typeof res.amount === "string" ? money(res.amount) : typeof res.amount === "number" && Number.isFinite(res.amount) ? moneyFromNumber(res.amount) : moneyFromNumber(0);
|
|
748
|
+
const normalizedCurrency = typeof res.currency === "string" && res.currency.trim().length > 0 ? res.currency : "";
|
|
679
749
|
const paidValue = res.paid === true;
|
|
680
750
|
const derivedPaid = paidValue || [
|
|
681
751
|
"success",
|
|
@@ -808,7 +878,8 @@ function isValidMobileMoneyProvider(value) {
|
|
|
808
878
|
return VALID_MOBILE_MONEY_PROVIDERS.has(value);
|
|
809
879
|
}
|
|
810
880
|
function normalizeAuthorizationType(value) {
|
|
811
|
-
|
|
881
|
+
if (typeof value !== "string") return void 0;
|
|
882
|
+
const lower = value.toLowerCase();
|
|
812
883
|
return lower === "otp" || lower === "pin" ? lower : void 0;
|
|
813
884
|
}
|
|
814
885
|
function formatMoney2(value) {
|
|
@@ -1514,7 +1585,7 @@ var CheckoutService = class {
|
|
|
1514
1585
|
);
|
|
1515
1586
|
const payCurrency = data.pay_currency?.trim().toUpperCase();
|
|
1516
1587
|
const payCurrencyCode = payCurrency ? currencyCode(payCurrency) : void 0;
|
|
1517
|
-
const cartTotalAmount = Number.parseFloat(cart.pricing.total_price || "0");
|
|
1588
|
+
const cartTotalAmount = typeof cart.pricing.total_price === "number" ? cart.pricing.total_price : Number.parseFloat(cart.pricing.total_price || "0");
|
|
1518
1589
|
if (payCurrencyCode && payCurrencyCode !== baseCurrency && !checkoutData.fx_quote_id && Number.isFinite(cartTotalAmount) && cartTotalAmount > 0) {
|
|
1519
1590
|
const fxQuoteResult = await this.client.fx.lockQuote({
|
|
1520
1591
|
from: baseCurrency,
|
|
@@ -1679,7 +1750,7 @@ var LinkService = class {
|
|
|
1679
1750
|
this.client.linkPost("/v1/link/auth/verify-otp", input)
|
|
1680
1751
|
);
|
|
1681
1752
|
if (result.ok && result.value.session_token) {
|
|
1682
|
-
this.client.
|
|
1753
|
+
this.client.setAccessToken(result.value.session_token);
|
|
1683
1754
|
}
|
|
1684
1755
|
return result;
|
|
1685
1756
|
}
|
|
@@ -1793,30 +1864,6 @@ var LinkService = class {
|
|
|
1793
1864
|
async revokeAllSessions() {
|
|
1794
1865
|
return safe5(this.client.linkDelete("/v1/link/sessions"));
|
|
1795
1866
|
}
|
|
1796
|
-
async getAddressesRest() {
|
|
1797
|
-
return this.getAddresses();
|
|
1798
|
-
}
|
|
1799
|
-
async createAddressRest(input) {
|
|
1800
|
-
return this.createAddress(input);
|
|
1801
|
-
}
|
|
1802
|
-
async deleteAddressRest(addressId) {
|
|
1803
|
-
return this.deleteAddress(addressId);
|
|
1804
|
-
}
|
|
1805
|
-
async setDefaultAddressRest(addressId) {
|
|
1806
|
-
return this.setDefaultAddress(addressId);
|
|
1807
|
-
}
|
|
1808
|
-
async getMobileMoneyRest() {
|
|
1809
|
-
return this.getMobileMoney();
|
|
1810
|
-
}
|
|
1811
|
-
async createMobileMoneyRest(input) {
|
|
1812
|
-
return this.createMobileMoney(input);
|
|
1813
|
-
}
|
|
1814
|
-
async deleteMobileMoneyRest(mobileMoneyId) {
|
|
1815
|
-
return this.deleteMobileMoney(mobileMoneyId);
|
|
1816
|
-
}
|
|
1817
|
-
async setDefaultMobileMoneyRest(mobileMoneyId) {
|
|
1818
|
-
return this.setDefaultMobileMoney(mobileMoneyId);
|
|
1819
|
-
}
|
|
1820
1867
|
};
|
|
1821
1868
|
|
|
1822
1869
|
// src/auth.ts
|
|
@@ -1908,9 +1955,6 @@ var BusinessService = class {
|
|
|
1908
1955
|
async getSettings() {
|
|
1909
1956
|
return safe7(this.client.get("/api/v1/business/settings"));
|
|
1910
1957
|
}
|
|
1911
|
-
async getTheme() {
|
|
1912
|
-
return safe7(this.client.get("/api/v1/business/theme"));
|
|
1913
|
-
}
|
|
1914
1958
|
async getLocations() {
|
|
1915
1959
|
return safe7(this.client.get("/api/v1/business/locations"));
|
|
1916
1960
|
}
|
|
@@ -1964,9 +2008,6 @@ var InventoryService = class {
|
|
|
1964
2008
|
const query2 = searchParams.toString();
|
|
1965
2009
|
return query2 ? `${path}?${query2}` : path;
|
|
1966
2010
|
}
|
|
1967
|
-
async getStockLevels() {
|
|
1968
|
-
return safe8(this.client.get("/api/v1/inventory/stock-levels"));
|
|
1969
|
-
}
|
|
1970
2011
|
async getProductStock(productId, locationId) {
|
|
1971
2012
|
const encodedId = encodeURIComponent(productId);
|
|
1972
2013
|
const path = this.withQuery(`/api/v1/inventory/products/${encodedId}/stock`, {
|
|
@@ -2008,9 +2049,6 @@ var InventoryService = class {
|
|
|
2008
2049
|
}
|
|
2009
2050
|
return ok(results.map((r) => r.value));
|
|
2010
2051
|
}
|
|
2011
|
-
async getSummary() {
|
|
2012
|
-
return safe8(this.client.get("/api/v1/inventory/summary"));
|
|
2013
|
-
}
|
|
2014
2052
|
async isInStock(productId, locationId) {
|
|
2015
2053
|
const result = await this.checkProductAvailability(productId, 1, locationId);
|
|
2016
2054
|
if (!result.ok) return result;
|
|
@@ -2047,16 +2085,6 @@ function withQuery2(path, params) {
|
|
|
2047
2085
|
const query2 = searchParams.toString();
|
|
2048
2086
|
return query2 ? `${path}?${query2}` : path;
|
|
2049
2087
|
}
|
|
2050
|
-
function normalizeServiceAvailability(result) {
|
|
2051
|
-
if (Array.isArray(result.days) && result.days.length > 0) {
|
|
2052
|
-
return result;
|
|
2053
|
-
}
|
|
2054
|
-
const days = Array.isArray(result.availability) ? result.availability.map((day) => ({
|
|
2055
|
-
...day,
|
|
2056
|
-
is_fully_booked: day.is_fully_booked ?? (typeof day.has_availability === "boolean" ? !day.has_availability : void 0)
|
|
2057
|
-
})) : [];
|
|
2058
|
-
return { ...result, days };
|
|
2059
|
-
}
|
|
2060
2088
|
function firstScheduledTime(booking) {
|
|
2061
2089
|
return booking.service_items.find((item) => typeof item.scheduled_start === "string")?.scheduled_start || booking.created_at;
|
|
2062
2090
|
}
|
|
@@ -2067,13 +2095,9 @@ var SchedulingService = class {
|
|
|
2067
2095
|
async getServices() {
|
|
2068
2096
|
return safe9(this.client.get("/api/v1/scheduling/services"));
|
|
2069
2097
|
}
|
|
2070
|
-
/**
|
|
2071
|
-
* Get a specific service by ID.
|
|
2072
|
-
*/
|
|
2073
2098
|
async getService(serviceId) {
|
|
2074
|
-
const
|
|
2075
|
-
|
|
2076
|
-
return ok(result.value.find((service) => service.id === serviceId) || null);
|
|
2099
|
+
const encodedId = encodeURIComponent(serviceId);
|
|
2100
|
+
return safe9(this.client.get(`/api/v1/scheduling/services/${encodedId}`));
|
|
2077
2101
|
}
|
|
2078
2102
|
async getAvailableSlots(input) {
|
|
2079
2103
|
const path = withQuery2("/api/v1/scheduling/slots", {
|
|
@@ -2101,9 +2125,7 @@ var SchedulingService = class {
|
|
|
2101
2125
|
location_id: params.location_id,
|
|
2102
2126
|
participant_count: params.participant_count
|
|
2103
2127
|
});
|
|
2104
|
-
return safe9(
|
|
2105
|
-
this.client.get(path).then((result) => normalizeServiceAvailability(result))
|
|
2106
|
-
);
|
|
2128
|
+
return safe9(this.client.get(path));
|
|
2107
2129
|
}
|
|
2108
2130
|
async getBooking(bookingId) {
|
|
2109
2131
|
const encodedId = encodeURIComponent(bookingId);
|
|
@@ -2160,12 +2182,6 @@ var SchedulingService = class {
|
|
|
2160
2182
|
if (!result.ok) return result;
|
|
2161
2183
|
return ok(result.value.some((slot) => slot.is_available));
|
|
2162
2184
|
}
|
|
2163
|
-
// Compatibility alias for callers typed against the older Booking shape.
|
|
2164
|
-
async getBookingLegacy(bookingId) {
|
|
2165
|
-
const result = await this.getBooking(bookingId);
|
|
2166
|
-
if (!result.ok) return result;
|
|
2167
|
-
return ok(result.value);
|
|
2168
|
-
}
|
|
2169
2185
|
};
|
|
2170
2186
|
|
|
2171
2187
|
// src/lite.ts
|
|
@@ -2239,7 +2255,6 @@ var ELEMENT_TYPES = {
|
|
|
2239
2255
|
CHECKOUT: "checkout"
|
|
2240
2256
|
};
|
|
2241
2257
|
var MESSAGE_TYPES = {
|
|
2242
|
-
// Parent → Iframe
|
|
2243
2258
|
INIT: "init",
|
|
2244
2259
|
SET_TOKEN: "set_token",
|
|
2245
2260
|
SET_CART: "set_cart",
|
|
@@ -2248,7 +2263,6 @@ var MESSAGE_TYPES = {
|
|
|
2248
2263
|
LOGOUT: "logout",
|
|
2249
2264
|
PROCESS_CHECKOUT: "process_checkout",
|
|
2250
2265
|
ABORT_CHECKOUT: "abort_checkout",
|
|
2251
|
-
// Iframe → Parent
|
|
2252
2266
|
READY: "ready",
|
|
2253
2267
|
HEIGHT_CHANGE: "height_change",
|
|
2254
2268
|
AUTHENTICATED: "authenticated",
|
|
@@ -2476,7 +2490,6 @@ var CimplifyElements = class {
|
|
|
2476
2490
|
tip_amount: options.tip_amount,
|
|
2477
2491
|
pay_currency: options.pay_currency,
|
|
2478
2492
|
enroll_in_link: options.enroll_in_link ?? true,
|
|
2479
|
-
// Unified checkout has its own address/customer state; only pass if available externally
|
|
2480
2493
|
address: isUnifiedCheckout ? void 0 : this.addressData ?? void 0,
|
|
2481
2494
|
customer: isUnifiedCheckout ? void 0 : this.customerData ? {
|
|
2482
2495
|
name: this.customerData.name,
|