@cimplify/sdk 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/advanced.d.mts +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/advanced.js +54 -16
- package/dist/advanced.mjs +54 -16
- package/dist/{client-CyBNao15.d.ts → client-C082Zp8J.d.ts} +15 -2
- package/dist/{client-hccS_JMl.d.mts → client-CSH0xyto.d.mts} +15 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +54 -16
- package/dist/index.mjs +54 -16
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +54 -16
- package/dist/react.mjs +54 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,6 +24,11 @@ const productsResult = await cimplify.catalogue.getProducts();
|
|
|
24
24
|
if (!productsResult.ok) throw productsResult.error;
|
|
25
25
|
const products = productsResult.value.items;
|
|
26
26
|
|
|
27
|
+
// Fetch full catalogue envelope (products + categories + add-ons)
|
|
28
|
+
const catalogueResult = await cimplify.catalogue.getCatalogue();
|
|
29
|
+
if (!catalogueResult.ok) throw catalogueResult.error;
|
|
30
|
+
const { categories, add_ons } = catalogueResult.value;
|
|
31
|
+
|
|
27
32
|
// Add to cart
|
|
28
33
|
await cimplify.cart.addItem({ item_id: "product-id", quantity: 1 });
|
|
29
34
|
|
|
@@ -42,11 +47,18 @@ const cart = await cimplify.cart.get();
|
|
|
42
47
|
|
|
43
48
|
```typescript
|
|
44
49
|
// Products
|
|
50
|
+
// getProducts() is list-focused (items + pagination/truncation metadata)
|
|
45
51
|
const productsResult = await cimplify.catalogue.getProducts();
|
|
46
52
|
const featuredResult = await cimplify.catalogue.getProducts({ featured: true, limit: 10 });
|
|
47
53
|
if (!productsResult.ok || !featuredResult.ok) throw new Error("Failed to fetch products");
|
|
48
54
|
const products = productsResult.value.items;
|
|
49
55
|
const featured = featuredResult.value.items;
|
|
56
|
+
|
|
57
|
+
// Full catalogue envelope when you need categories/add-ons alongside products
|
|
58
|
+
const catalogueResult = await cimplify.catalogue.getCatalogue();
|
|
59
|
+
if (!catalogueResult.ok) throw catalogueResult.error;
|
|
60
|
+
const { categories, add_ons } = catalogueResult.value;
|
|
61
|
+
|
|
50
62
|
const product = await cimplify.catalogue.getProduct("product-id");
|
|
51
63
|
const product = await cimplify.catalogue.getProductBySlug("my-product");
|
|
52
64
|
|
package/dist/advanced.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, v as CimplifyElement, u as CimplifyElements, x as ELEMENT_TYPES, E as EVENT_TYPES, H as ElementEventType, z as ElementOptions, D as ElementType, y 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, h as RefreshQuoteResult, p as SchedulingService, S as SearchOptions, w as createElements, k as generateIdempotencyKey } from './client-
|
|
1
|
+
export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, v as CimplifyElement, u as CimplifyElements, x as ELEMENT_TYPES, E as EVENT_TYPES, H as ElementEventType, z as ElementOptions, D as ElementType, y 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, h as RefreshQuoteResult, p as SchedulingService, S as SearchOptions, w as createElements, k as generateIdempotencyKey } from './client-CSH0xyto.mjs';
|
|
2
2
|
import './payment-CLIWNMaP.mjs';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, v as CimplifyElement, u as CimplifyElements, x as ELEMENT_TYPES, E as EVENT_TYPES, H as ElementEventType, z as ElementOptions, D as ElementType, y 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, h as RefreshQuoteResult, p as SchedulingService, S as SearchOptions, w as createElements, k as generateIdempotencyKey } from './client-
|
|
1
|
+
export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, v as CimplifyElement, u as CimplifyElements, x as ELEMENT_TYPES, E as EVENT_TYPES, H as ElementEventType, z as ElementOptions, D as ElementType, y 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, h as RefreshQuoteResult, p as SchedulingService, S as SearchOptions, w as createElements, k as generateIdempotencyKey } from './client-C082Zp8J.js';
|
|
2
2
|
import './payment-CLIWNMaP.js';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
package/dist/advanced.js
CHANGED
|
@@ -233,6 +233,22 @@ function readFinalPrice(value) {
|
|
|
233
233
|
}
|
|
234
234
|
return void 0;
|
|
235
235
|
}
|
|
236
|
+
function normalizeAddOnPayload(addOn) {
|
|
237
|
+
if (!isRecord(addOn)) return addOn;
|
|
238
|
+
const normalizedAddOn = { ...addOn };
|
|
239
|
+
const options = normalizedAddOn["options"];
|
|
240
|
+
if (!Array.isArray(options)) return normalizedAddOn;
|
|
241
|
+
normalizedAddOn["options"] = options.map((option) => {
|
|
242
|
+
if (!isRecord(option)) return option;
|
|
243
|
+
const normalizedOption = { ...option };
|
|
244
|
+
const optionPrice = normalizedOption["default_price"];
|
|
245
|
+
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
246
|
+
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
247
|
+
}
|
|
248
|
+
return normalizedOption;
|
|
249
|
+
});
|
|
250
|
+
return normalizedAddOn;
|
|
251
|
+
}
|
|
236
252
|
function normalizeCatalogueProductPayload(product) {
|
|
237
253
|
const normalized = { ...product };
|
|
238
254
|
const defaultPrice = normalized["default_price"];
|
|
@@ -254,22 +270,7 @@ function normalizeCatalogueProductPayload(product) {
|
|
|
254
270
|
}
|
|
255
271
|
const addOns = normalized["add_ons"];
|
|
256
272
|
if (Array.isArray(addOns)) {
|
|
257
|
-
normalized["add_ons"] = addOns.map((addOn) =>
|
|
258
|
-
if (!isRecord(addOn)) return addOn;
|
|
259
|
-
const normalizedAddOn = { ...addOn };
|
|
260
|
-
const options = normalizedAddOn["options"];
|
|
261
|
-
if (!Array.isArray(options)) return normalizedAddOn;
|
|
262
|
-
normalizedAddOn["options"] = options.map((option) => {
|
|
263
|
-
if (!isRecord(option)) return option;
|
|
264
|
-
const normalizedOption = { ...option };
|
|
265
|
-
const optionPrice = normalizedOption["default_price"];
|
|
266
|
-
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
267
|
-
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
268
|
-
}
|
|
269
|
-
return normalizedOption;
|
|
270
|
-
});
|
|
271
|
-
return normalizedAddOn;
|
|
272
|
-
});
|
|
273
|
+
normalized["add_ons"] = addOns.map((addOn) => normalizeAddOnPayload(addOn));
|
|
273
274
|
}
|
|
274
275
|
return normalized;
|
|
275
276
|
}
|
|
@@ -342,10 +343,47 @@ function normalizeCatalogueResult(payload) {
|
|
|
342
343
|
pagination: normalizePagination(payload.pagination)
|
|
343
344
|
};
|
|
344
345
|
}
|
|
346
|
+
function normalizeCatalogueSnapshot(payload) {
|
|
347
|
+
if (Array.isArray(payload)) {
|
|
348
|
+
return {
|
|
349
|
+
categories: [],
|
|
350
|
+
products: payload.map((product) => normalizeCatalogueProductPayload(product)),
|
|
351
|
+
add_ons: [],
|
|
352
|
+
is_complete: true
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
if (!isRecord(payload)) {
|
|
356
|
+
return {
|
|
357
|
+
categories: [],
|
|
358
|
+
products: [],
|
|
359
|
+
add_ons: [],
|
|
360
|
+
is_complete: true
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
const rawProducts = Array.isArray(payload.products) ? payload.products : Array.isArray(payload.items) ? payload.items : [];
|
|
364
|
+
const rawCategories = Array.isArray(payload.categories) ? payload.categories : [];
|
|
365
|
+
const rawAddOns = Array.isArray(payload.add_ons) ? payload.add_ons : [];
|
|
366
|
+
return {
|
|
367
|
+
categories: rawCategories,
|
|
368
|
+
products: rawProducts.map((product) => normalizeCatalogueProductPayload(product)),
|
|
369
|
+
add_ons: rawAddOns.map((addOn) => normalizeAddOnPayload(addOn)),
|
|
370
|
+
is_complete: typeof payload.is_complete === "boolean" ? payload.is_complete : true,
|
|
371
|
+
total_available: toFiniteNumber(payload.total_available),
|
|
372
|
+
pagination: normalizePagination(payload.pagination)
|
|
373
|
+
};
|
|
374
|
+
}
|
|
345
375
|
var CatalogueQueries = class {
|
|
346
376
|
constructor(client) {
|
|
347
377
|
this.client = client;
|
|
348
378
|
}
|
|
379
|
+
async getCatalogue() {
|
|
380
|
+
const result = await safeWithFallback(
|
|
381
|
+
() => this.client.get("/api/v1/catalogue"),
|
|
382
|
+
() => this.client.query("catalogue")
|
|
383
|
+
);
|
|
384
|
+
if (!result.ok) return result;
|
|
385
|
+
return ok(normalizeCatalogueSnapshot(result.value));
|
|
386
|
+
}
|
|
349
387
|
async getProducts(options) {
|
|
350
388
|
let query2 = "products";
|
|
351
389
|
const filters = [];
|
package/dist/advanced.mjs
CHANGED
|
@@ -231,6 +231,22 @@ function readFinalPrice(value) {
|
|
|
231
231
|
}
|
|
232
232
|
return void 0;
|
|
233
233
|
}
|
|
234
|
+
function normalizeAddOnPayload(addOn) {
|
|
235
|
+
if (!isRecord(addOn)) return addOn;
|
|
236
|
+
const normalizedAddOn = { ...addOn };
|
|
237
|
+
const options = normalizedAddOn["options"];
|
|
238
|
+
if (!Array.isArray(options)) return normalizedAddOn;
|
|
239
|
+
normalizedAddOn["options"] = options.map((option) => {
|
|
240
|
+
if (!isRecord(option)) return option;
|
|
241
|
+
const normalizedOption = { ...option };
|
|
242
|
+
const optionPrice = normalizedOption["default_price"];
|
|
243
|
+
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
244
|
+
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
245
|
+
}
|
|
246
|
+
return normalizedOption;
|
|
247
|
+
});
|
|
248
|
+
return normalizedAddOn;
|
|
249
|
+
}
|
|
234
250
|
function normalizeCatalogueProductPayload(product) {
|
|
235
251
|
const normalized = { ...product };
|
|
236
252
|
const defaultPrice = normalized["default_price"];
|
|
@@ -252,22 +268,7 @@ function normalizeCatalogueProductPayload(product) {
|
|
|
252
268
|
}
|
|
253
269
|
const addOns = normalized["add_ons"];
|
|
254
270
|
if (Array.isArray(addOns)) {
|
|
255
|
-
normalized["add_ons"] = addOns.map((addOn) =>
|
|
256
|
-
if (!isRecord(addOn)) return addOn;
|
|
257
|
-
const normalizedAddOn = { ...addOn };
|
|
258
|
-
const options = normalizedAddOn["options"];
|
|
259
|
-
if (!Array.isArray(options)) return normalizedAddOn;
|
|
260
|
-
normalizedAddOn["options"] = options.map((option) => {
|
|
261
|
-
if (!isRecord(option)) return option;
|
|
262
|
-
const normalizedOption = { ...option };
|
|
263
|
-
const optionPrice = normalizedOption["default_price"];
|
|
264
|
-
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
265
|
-
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
266
|
-
}
|
|
267
|
-
return normalizedOption;
|
|
268
|
-
});
|
|
269
|
-
return normalizedAddOn;
|
|
270
|
-
});
|
|
271
|
+
normalized["add_ons"] = addOns.map((addOn) => normalizeAddOnPayload(addOn));
|
|
271
272
|
}
|
|
272
273
|
return normalized;
|
|
273
274
|
}
|
|
@@ -340,10 +341,47 @@ function normalizeCatalogueResult(payload) {
|
|
|
340
341
|
pagination: normalizePagination(payload.pagination)
|
|
341
342
|
};
|
|
342
343
|
}
|
|
344
|
+
function normalizeCatalogueSnapshot(payload) {
|
|
345
|
+
if (Array.isArray(payload)) {
|
|
346
|
+
return {
|
|
347
|
+
categories: [],
|
|
348
|
+
products: payload.map((product) => normalizeCatalogueProductPayload(product)),
|
|
349
|
+
add_ons: [],
|
|
350
|
+
is_complete: true
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
if (!isRecord(payload)) {
|
|
354
|
+
return {
|
|
355
|
+
categories: [],
|
|
356
|
+
products: [],
|
|
357
|
+
add_ons: [],
|
|
358
|
+
is_complete: true
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
const rawProducts = Array.isArray(payload.products) ? payload.products : Array.isArray(payload.items) ? payload.items : [];
|
|
362
|
+
const rawCategories = Array.isArray(payload.categories) ? payload.categories : [];
|
|
363
|
+
const rawAddOns = Array.isArray(payload.add_ons) ? payload.add_ons : [];
|
|
364
|
+
return {
|
|
365
|
+
categories: rawCategories,
|
|
366
|
+
products: rawProducts.map((product) => normalizeCatalogueProductPayload(product)),
|
|
367
|
+
add_ons: rawAddOns.map((addOn) => normalizeAddOnPayload(addOn)),
|
|
368
|
+
is_complete: typeof payload.is_complete === "boolean" ? payload.is_complete : true,
|
|
369
|
+
total_available: toFiniteNumber(payload.total_available),
|
|
370
|
+
pagination: normalizePagination(payload.pagination)
|
|
371
|
+
};
|
|
372
|
+
}
|
|
343
373
|
var CatalogueQueries = class {
|
|
344
374
|
constructor(client) {
|
|
345
375
|
this.client = client;
|
|
346
376
|
}
|
|
377
|
+
async getCatalogue() {
|
|
378
|
+
const result = await safeWithFallback(
|
|
379
|
+
() => this.client.get("/api/v1/catalogue"),
|
|
380
|
+
() => this.client.query("catalogue")
|
|
381
|
+
);
|
|
382
|
+
if (!result.ok) return result;
|
|
383
|
+
return ok(normalizeCatalogueSnapshot(result.value));
|
|
384
|
+
}
|
|
347
385
|
async getProducts(options) {
|
|
348
386
|
let query2 = "products";
|
|
349
387
|
const filters = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as Category, q as Product, F as AddOnWithOptions, d as Pagination, h as CimplifyError, r as ProductWithDetails, s as ProductVariant, u as VariantAxis, z as VariantAxisSelection, B as AddOn, N as Collection, T as Bundle, X as BundleWithDetails, a2 as Composite, a3 as CompositeWithDetails, a7 as ComponentSelectionInput, a8 as CompositePriceResult, an as ChosenPrice, aS as UICart, aD as Cart, aE as CartItem, aW as CartSummary, aU as AddToCartInput, aV as UpdateCartItemInput, ar as DiscountDetails, M as Money, C as CurrencyCode, aC as LineConfiguration, a_ as AuthorizationType, b0 as PaymentMethod, b2 as InitializePaymentResult, b6 as SubmitAuthorizationInput, b4 as PaymentStatusResponse } from './payment-CLIWNMaP.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Observability hooks for monitoring SDK behavior.
|
|
@@ -104,6 +104,18 @@ interface CatalogueResult<T> {
|
|
|
104
104
|
/** Pagination metadata when listing is paginated. */
|
|
105
105
|
pagination?: Pagination;
|
|
106
106
|
}
|
|
107
|
+
/** Full catalogue envelope (products + categories + add-ons + metadata). */
|
|
108
|
+
interface CatalogueSnapshot {
|
|
109
|
+
categories: Category[];
|
|
110
|
+
products: Product[];
|
|
111
|
+
add_ons: AddOnWithOptions[];
|
|
112
|
+
/** true when the full catalogue is returned; false when truncated by server cap. */
|
|
113
|
+
is_complete: boolean;
|
|
114
|
+
/** Total available products before truncation (present when truncated). */
|
|
115
|
+
total_available?: number;
|
|
116
|
+
/** Pagination metadata when listing is paginated. */
|
|
117
|
+
pagination?: Pagination;
|
|
118
|
+
}
|
|
107
119
|
|
|
108
120
|
/**
|
|
109
121
|
* A Result type that makes errors explicit in the type system.
|
|
@@ -349,6 +361,7 @@ interface RefreshQuoteResult {
|
|
|
349
361
|
declare class CatalogueQueries {
|
|
350
362
|
private client;
|
|
351
363
|
constructor(client: CimplifyClient);
|
|
364
|
+
getCatalogue(): Promise<Result<CatalogueSnapshot, CimplifyError>>;
|
|
352
365
|
getProducts(options?: GetProductsOptions): Promise<Result<CatalogueResult<Product>, CimplifyError>>;
|
|
353
366
|
getProduct(id: string): Promise<Result<ProductWithDetails, CimplifyError>>;
|
|
354
367
|
getProductBySlug(slug: string): Promise<Result<ProductWithDetails, CimplifyError>>;
|
|
@@ -2369,4 +2382,4 @@ declare class CimplifyClient {
|
|
|
2369
2382
|
}
|
|
2370
2383
|
declare function createCimplifyClient(config?: CimplifyConfig): CimplifyClient;
|
|
2371
2384
|
|
|
2372
|
-
export { type ProcessAndResolveOptions as $, AuthService as A, BusinessService as B, CimplifyClient as C, type ElementType as D, EVENT_TYPES as E, type FetchQuoteInput as F, type GetProductsOptions as G, type ElementEventType as H, InventoryService as I, type CheckoutMode as J, type KitchenOrderItem as K, LinkService as L, MESSAGE_TYPES as M, type CheckoutOrderType as N, OrderQueries as O, type PriceQuote as P, type QuoteCompositeSelectionInput as Q, type RefreshQuoteInput as R, type SearchOptions as S, type TableInfo as T, type UpdateProfileInput as U, type CheckoutPaymentMethod as V, type CheckoutStep as W, type CheckoutFormData as X, type CheckoutResult as Y, type ProcessCheckoutOptions as Z, type ProcessCheckoutResult as _, type CimplifyConfig as a, type
|
|
2385
|
+
export { type ProcessAndResolveOptions as $, AuthService as A, BusinessService as B, CimplifyClient as C, type ElementType as D, EVENT_TYPES as E, type FetchQuoteInput as F, type GetProductsOptions as G, type ElementEventType as H, InventoryService as I, type CheckoutMode as J, type KitchenOrderItem as K, LinkService as L, MESSAGE_TYPES as M, type CheckoutOrderType as N, OrderQueries as O, type PriceQuote as P, type QuoteCompositeSelectionInput as Q, type RefreshQuoteInput as R, type SearchOptions as S, type TableInfo as T, type UpdateProfileInput as U, type CheckoutPaymentMethod as V, type CheckoutStep as W, type CheckoutFormData as X, type CheckoutResult as Y, type ProcessCheckoutOptions as Z, type ProcessCheckoutResult as _, type CimplifyConfig as a, type OrderGroupDetails as a$, type CheckoutStatus as a0, type CheckoutStatusContext as a1, type AbortablePromise as a2, type MobileMoneyProvider as a3, type DeviceType as a4, type ContactType as a5, CHECKOUT_MODE as a6, ORDER_TYPE as a7, PAYMENT_METHOD as a8, CHECKOUT_STEP as a9, toNullable as aA, fromPromise as aB, tryCatch as aC, combine as aD, combineObject as aE, type CatalogueResult as aF, type CatalogueSnapshot as aG, type OrderStatus as aH, type PaymentState as aI, type OrderChannel as aJ, type LineType as aK, type OrderLineState as aL, type OrderLineStatus as aM, type FulfillmentType as aN, type FulfillmentStatus as aO, type FulfillmentLink as aP, type OrderFulfillmentSummary as aQ, type FeeBearerType as aR, type AmountToPay as aS, type LineItem as aT, type Order as aU, type OrderHistory as aV, type OrderGroupPaymentState as aW, type OrderGroup as aX, type OrderGroupPayment as aY, type OrderSplitDetail as aZ, type OrderGroupPaymentSummary as a_, PAYMENT_STATE as aa, PICKUP_TIME_TYPE as ab, MOBILE_MONEY_PROVIDER as ac, AUTHORIZATION_TYPE as ad, DEVICE_TYPE as ae, CONTACT_TYPE as af, LINK_QUERY as ag, LINK_MUTATION as ah, AUTH_MUTATION as ai, CHECKOUT_MUTATION as aj, PAYMENT_MUTATION as ak, ORDER_MUTATION as al, DEFAULT_CURRENCY as am, DEFAULT_COUNTRY as an, type Result as ao, type Ok as ap, type Err as aq, ok as ar, err as as, isOk as at, isErr as au, mapResult as av, mapError as aw, flatMap as ax, getOrElse as ay, unwrap as az, CatalogueQueries as b, type CancelBookingInput as b$, type OrderPaymentEvent as b0, type OrderFilter as b1, type CheckoutInput as b2, type UpdateOrderStatusInput as b3, type CancelOrderInput as b4, type RefundOrderInput as b5, type ServiceStatus as b6, type StaffRole as b7, type ReminderMethod as b8, type CustomerServicePreferences as b9, type BusinessWithLocations as bA, type LocationWithDetails as bB, type BusinessSettings as bC, type BusinessHours as bD, type CategoryInfo as bE, type ServiceAvailabilityRule as bF, type ServiceAvailabilityException as bG, type StaffAvailabilityRule as bH, type StaffAvailabilityException as bI, type ResourceAvailabilityRule as bJ, type ResourceAvailabilityException as bK, type StaffBookingProfile as bL, type ServiceStaffRequirement as bM, type BookingRequirementOverride as bN, type ResourceType as bO, type Service as bP, type ServiceWithStaff as bQ, type Staff as bR, type TimeSlot as bS, type AvailableSlot as bT, type DayAvailability as bU, type BookingStatus as bV, type Booking as bW, type BookingWithDetails as bX, type GetAvailableSlotsInput as bY, type CheckSlotAvailabilityInput as bZ, type RescheduleBookingInput as b_, type BufferTimes as ba, type ReminderSettings as bb, type CancellationPolicy as bc, type ServiceNotes as bd, type PricingOverrides as be, type SchedulingMetadata as bf, type StaffAssignment as bg, type ResourceAssignment as bh, type SchedulingResult as bi, type DepositResult as bj, type ServiceScheduleRequest as bk, type StaffScheduleItem as bl, type LocationAppointment as bm, type BusinessType as bn, type BusinessPreferences as bo, type Business as bp, type LocationTaxBehavior as bq, type LocationTaxOverrides as br, type Location as bs, type TimeRange as bt, type TimeRanges as bu, type LocationTimeProfile as bv, type Table as bw, type Room as bx, type ServiceCharge as by, type StorefrontBootstrap as bz, createCimplifyClient as c, type ServiceAvailabilityParams as c0, type ServiceAvailabilityResult as c1, type StockOwnershipType as c2, type StockStatus as c3, type Stock as c4, type StockLevel as c5, type ProductStock as c6, type VariantStock as c7, type LocationStock as c8, type AvailabilityCheck as c9, type MobileMoneyDetails as cA, type CheckoutCustomerInfo as cB, type FxQuoteRequest as cC, type FxQuote as cD, type FxRateResponse as cE, type RequestContext as cF, type RequestStartEvent as cG, type RequestSuccessEvent as cH, type RequestErrorEvent as cI, type RetryEvent as cJ, type SessionChangeEvent as cK, type ObservabilityHooks as cL, type ElementAppearance as cM, type AddressInfo as cN, type PaymentMethodInfo as cO, type AuthenticatedCustomer as cP, type ElementsCustomerInfo as cQ, type AuthenticatedData as cR, type ElementsCheckoutData as cS, type ElementsCheckoutResult as cT, type ParentToIframeMessage as cU, type IframeToParentMessage as cV, type ElementEventHandler as cW, type AvailabilityResult as ca, type InventorySummary as cb, type Customer as cc, type CustomerAddress as cd, type CustomerMobileMoney as ce, type CustomerLinkPreferences as cf, type LinkData as cg, type CreateAddressInput as ch, type UpdateAddressInput as ci, type CreateMobileMoneyInput as cj, type EnrollmentData as ck, type AddressData as cl, type MobileMoneyData as cm, type EnrollAndLinkOrderInput as cn, type LinkStatusResult as co, type LinkEnrollResult as cp, type EnrollAndLinkOrderResult as cq, type LinkSession as cr, type RevokeSessionResult as cs, type RevokeAllSessionsResult as ct, type RequestOtpInput as cu, type VerifyOtpInput as cv, type AuthResponse as cw, type PickupTimeType as cx, type PickupTime as cy, type CheckoutAddressInfo as cz, type QuoteBundleSelectionInput as d, type QuoteStatus as e, type QuoteDynamicBuckets as f, type QuoteUiMessage as g, type RefreshQuoteResult as h, CartOperations as i, CheckoutService as j, generateIdempotencyKey as k, type GetOrdersOptions as l, type AuthStatus as m, type OtpResult as n, type ChangePasswordInput as o, SchedulingService as p, LiteService as q, FxService as r, type LiteBootstrap as s, type KitchenOrderResult as t, CimplifyElements as u, CimplifyElement as v, createElements as w, ELEMENT_TYPES as x, type ElementsOptions as y, type ElementOptions as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as Category, q as Product, F as AddOnWithOptions, d as Pagination, h as CimplifyError, r as ProductWithDetails, s as ProductVariant, u as VariantAxis, z as VariantAxisSelection, B as AddOn, N as Collection, T as Bundle, X as BundleWithDetails, a2 as Composite, a3 as CompositeWithDetails, a7 as ComponentSelectionInput, a8 as CompositePriceResult, an as ChosenPrice, aS as UICart, aD as Cart, aE as CartItem, aW as CartSummary, aU as AddToCartInput, aV as UpdateCartItemInput, ar as DiscountDetails, M as Money, C as CurrencyCode, aC as LineConfiguration, a_ as AuthorizationType, b0 as PaymentMethod, b2 as InitializePaymentResult, b6 as SubmitAuthorizationInput, b4 as PaymentStatusResponse } from './payment-CLIWNMaP.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Observability hooks for monitoring SDK behavior.
|
|
@@ -104,6 +104,18 @@ interface CatalogueResult<T> {
|
|
|
104
104
|
/** Pagination metadata when listing is paginated. */
|
|
105
105
|
pagination?: Pagination;
|
|
106
106
|
}
|
|
107
|
+
/** Full catalogue envelope (products + categories + add-ons + metadata). */
|
|
108
|
+
interface CatalogueSnapshot {
|
|
109
|
+
categories: Category[];
|
|
110
|
+
products: Product[];
|
|
111
|
+
add_ons: AddOnWithOptions[];
|
|
112
|
+
/** true when the full catalogue is returned; false when truncated by server cap. */
|
|
113
|
+
is_complete: boolean;
|
|
114
|
+
/** Total available products before truncation (present when truncated). */
|
|
115
|
+
total_available?: number;
|
|
116
|
+
/** Pagination metadata when listing is paginated. */
|
|
117
|
+
pagination?: Pagination;
|
|
118
|
+
}
|
|
107
119
|
|
|
108
120
|
/**
|
|
109
121
|
* A Result type that makes errors explicit in the type system.
|
|
@@ -349,6 +361,7 @@ interface RefreshQuoteResult {
|
|
|
349
361
|
declare class CatalogueQueries {
|
|
350
362
|
private client;
|
|
351
363
|
constructor(client: CimplifyClient);
|
|
364
|
+
getCatalogue(): Promise<Result<CatalogueSnapshot, CimplifyError>>;
|
|
352
365
|
getProducts(options?: GetProductsOptions): Promise<Result<CatalogueResult<Product>, CimplifyError>>;
|
|
353
366
|
getProduct(id: string): Promise<Result<ProductWithDetails, CimplifyError>>;
|
|
354
367
|
getProductBySlug(slug: string): Promise<Result<ProductWithDetails, CimplifyError>>;
|
|
@@ -2369,4 +2382,4 @@ declare class CimplifyClient {
|
|
|
2369
2382
|
}
|
|
2370
2383
|
declare function createCimplifyClient(config?: CimplifyConfig): CimplifyClient;
|
|
2371
2384
|
|
|
2372
|
-
export { type ProcessAndResolveOptions as $, AuthService as A, BusinessService as B, CimplifyClient as C, type ElementType as D, EVENT_TYPES as E, type FetchQuoteInput as F, type GetProductsOptions as G, type ElementEventType as H, InventoryService as I, type CheckoutMode as J, type KitchenOrderItem as K, LinkService as L, MESSAGE_TYPES as M, type CheckoutOrderType as N, OrderQueries as O, type PriceQuote as P, type QuoteCompositeSelectionInput as Q, type RefreshQuoteInput as R, type SearchOptions as S, type TableInfo as T, type UpdateProfileInput as U, type CheckoutPaymentMethod as V, type CheckoutStep as W, type CheckoutFormData as X, type CheckoutResult as Y, type ProcessCheckoutOptions as Z, type ProcessCheckoutResult as _, type CimplifyConfig as a, type
|
|
2385
|
+
export { type ProcessAndResolveOptions as $, AuthService as A, BusinessService as B, CimplifyClient as C, type ElementType as D, EVENT_TYPES as E, type FetchQuoteInput as F, type GetProductsOptions as G, type ElementEventType as H, InventoryService as I, type CheckoutMode as J, type KitchenOrderItem as K, LinkService as L, MESSAGE_TYPES as M, type CheckoutOrderType as N, OrderQueries as O, type PriceQuote as P, type QuoteCompositeSelectionInput as Q, type RefreshQuoteInput as R, type SearchOptions as S, type TableInfo as T, type UpdateProfileInput as U, type CheckoutPaymentMethod as V, type CheckoutStep as W, type CheckoutFormData as X, type CheckoutResult as Y, type ProcessCheckoutOptions as Z, type ProcessCheckoutResult as _, type CimplifyConfig as a, type OrderGroupDetails as a$, type CheckoutStatus as a0, type CheckoutStatusContext as a1, type AbortablePromise as a2, type MobileMoneyProvider as a3, type DeviceType as a4, type ContactType as a5, CHECKOUT_MODE as a6, ORDER_TYPE as a7, PAYMENT_METHOD as a8, CHECKOUT_STEP as a9, toNullable as aA, fromPromise as aB, tryCatch as aC, combine as aD, combineObject as aE, type CatalogueResult as aF, type CatalogueSnapshot as aG, type OrderStatus as aH, type PaymentState as aI, type OrderChannel as aJ, type LineType as aK, type OrderLineState as aL, type OrderLineStatus as aM, type FulfillmentType as aN, type FulfillmentStatus as aO, type FulfillmentLink as aP, type OrderFulfillmentSummary as aQ, type FeeBearerType as aR, type AmountToPay as aS, type LineItem as aT, type Order as aU, type OrderHistory as aV, type OrderGroupPaymentState as aW, type OrderGroup as aX, type OrderGroupPayment as aY, type OrderSplitDetail as aZ, type OrderGroupPaymentSummary as a_, PAYMENT_STATE as aa, PICKUP_TIME_TYPE as ab, MOBILE_MONEY_PROVIDER as ac, AUTHORIZATION_TYPE as ad, DEVICE_TYPE as ae, CONTACT_TYPE as af, LINK_QUERY as ag, LINK_MUTATION as ah, AUTH_MUTATION as ai, CHECKOUT_MUTATION as aj, PAYMENT_MUTATION as ak, ORDER_MUTATION as al, DEFAULT_CURRENCY as am, DEFAULT_COUNTRY as an, type Result as ao, type Ok as ap, type Err as aq, ok as ar, err as as, isOk as at, isErr as au, mapResult as av, mapError as aw, flatMap as ax, getOrElse as ay, unwrap as az, CatalogueQueries as b, type CancelBookingInput as b$, type OrderPaymentEvent as b0, type OrderFilter as b1, type CheckoutInput as b2, type UpdateOrderStatusInput as b3, type CancelOrderInput as b4, type RefundOrderInput as b5, type ServiceStatus as b6, type StaffRole as b7, type ReminderMethod as b8, type CustomerServicePreferences as b9, type BusinessWithLocations as bA, type LocationWithDetails as bB, type BusinessSettings as bC, type BusinessHours as bD, type CategoryInfo as bE, type ServiceAvailabilityRule as bF, type ServiceAvailabilityException as bG, type StaffAvailabilityRule as bH, type StaffAvailabilityException as bI, type ResourceAvailabilityRule as bJ, type ResourceAvailabilityException as bK, type StaffBookingProfile as bL, type ServiceStaffRequirement as bM, type BookingRequirementOverride as bN, type ResourceType as bO, type Service as bP, type ServiceWithStaff as bQ, type Staff as bR, type TimeSlot as bS, type AvailableSlot as bT, type DayAvailability as bU, type BookingStatus as bV, type Booking as bW, type BookingWithDetails as bX, type GetAvailableSlotsInput as bY, type CheckSlotAvailabilityInput as bZ, type RescheduleBookingInput as b_, type BufferTimes as ba, type ReminderSettings as bb, type CancellationPolicy as bc, type ServiceNotes as bd, type PricingOverrides as be, type SchedulingMetadata as bf, type StaffAssignment as bg, type ResourceAssignment as bh, type SchedulingResult as bi, type DepositResult as bj, type ServiceScheduleRequest as bk, type StaffScheduleItem as bl, type LocationAppointment as bm, type BusinessType as bn, type BusinessPreferences as bo, type Business as bp, type LocationTaxBehavior as bq, type LocationTaxOverrides as br, type Location as bs, type TimeRange as bt, type TimeRanges as bu, type LocationTimeProfile as bv, type Table as bw, type Room as bx, type ServiceCharge as by, type StorefrontBootstrap as bz, createCimplifyClient as c, type ServiceAvailabilityParams as c0, type ServiceAvailabilityResult as c1, type StockOwnershipType as c2, type StockStatus as c3, type Stock as c4, type StockLevel as c5, type ProductStock as c6, type VariantStock as c7, type LocationStock as c8, type AvailabilityCheck as c9, type MobileMoneyDetails as cA, type CheckoutCustomerInfo as cB, type FxQuoteRequest as cC, type FxQuote as cD, type FxRateResponse as cE, type RequestContext as cF, type RequestStartEvent as cG, type RequestSuccessEvent as cH, type RequestErrorEvent as cI, type RetryEvent as cJ, type SessionChangeEvent as cK, type ObservabilityHooks as cL, type ElementAppearance as cM, type AddressInfo as cN, type PaymentMethodInfo as cO, type AuthenticatedCustomer as cP, type ElementsCustomerInfo as cQ, type AuthenticatedData as cR, type ElementsCheckoutData as cS, type ElementsCheckoutResult as cT, type ParentToIframeMessage as cU, type IframeToParentMessage as cV, type ElementEventHandler as cW, type AvailabilityResult as ca, type InventorySummary as cb, type Customer as cc, type CustomerAddress as cd, type CustomerMobileMoney as ce, type CustomerLinkPreferences as cf, type LinkData as cg, type CreateAddressInput as ch, type UpdateAddressInput as ci, type CreateMobileMoneyInput as cj, type EnrollmentData as ck, type AddressData as cl, type MobileMoneyData as cm, type EnrollAndLinkOrderInput as cn, type LinkStatusResult as co, type LinkEnrollResult as cp, type EnrollAndLinkOrderResult as cq, type LinkSession as cr, type RevokeSessionResult as cs, type RevokeAllSessionsResult as ct, type RequestOtpInput as cu, type VerifyOtpInput as cv, type AuthResponse as cw, type PickupTimeType as cx, type PickupTime as cy, type CheckoutAddressInfo as cz, type QuoteBundleSelectionInput as d, type QuoteStatus as e, type QuoteDynamicBuckets as f, type QuoteUiMessage as g, type RefreshQuoteResult as h, CartOperations as i, CheckoutService as j, generateIdempotencyKey as k, type GetOrdersOptions as l, type AuthStatus as m, type OtpResult as n, type ChangePasswordInput as o, SchedulingService as p, LiteService as q, FxService as r, type LiteBootstrap as s, type KitchenOrderResult as t, CimplifyElements as u, CimplifyElement as v, createElements as w, ELEMENT_TYPES as x, type ElementsOptions as y, type ElementOptions as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ad as AUTHORIZATION_TYPE, ai as AUTH_MUTATION, a2 as AbortablePromise,
|
|
1
|
+
export { ad as AUTHORIZATION_TYPE, ai as AUTH_MUTATION, a2 as AbortablePromise, cl as AddressData, cN as AddressInfo, aS as AmountToPay, cw as AuthResponse, A as AuthService, m as AuthStatus, cP as AuthenticatedCustomer, cR as AuthenticatedData, c9 as AvailabilityCheck, ca as AvailabilityResult, bT as AvailableSlot, bW as Booking, bN as BookingRequirementOverride, bV as BookingStatus, bX as BookingWithDetails, ba as BufferTimes, bp as Business, bD as BusinessHours, bo as BusinessPreferences, B as BusinessService, bC as BusinessSettings, bn as BusinessType, bA as BusinessWithLocations, a6 as CHECKOUT_MODE, aj as CHECKOUT_MUTATION, a9 as CHECKOUT_STEP, af as CONTACT_TYPE, b$ as CancelBookingInput, b4 as CancelOrderInput, bc as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aF as CatalogueResult, aG as CatalogueSnapshot, bE as CategoryInfo, o as ChangePasswordInput, bZ as CheckSlotAvailabilityInput, cz as CheckoutAddressInfo, cB as CheckoutCustomerInfo, X as CheckoutFormData, b2 as CheckoutInput, J as CheckoutMode, j as CheckoutOperations, N as CheckoutOrderType, V as CheckoutPaymentMethod, Y as CheckoutResult, j as CheckoutService, a0 as CheckoutStatus, a1 as CheckoutStatusContext, W as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, v as CimplifyElement, u as CimplifyElements, a5 as ContactType, ch as CreateAddressInput, cj as CreateMobileMoneyInput, cc as Customer, cd as CustomerAddress, cf as CustomerLinkPreferences, ce as CustomerMobileMoney, b9 as CustomerServicePreferences, an as DEFAULT_COUNTRY, am as DEFAULT_CURRENCY, ae as DEVICE_TYPE, bU as DayAvailability, bj as DepositResult, a4 as DeviceType, x as ELEMENT_TYPES, E as EVENT_TYPES, cM as ElementAppearance, cW as ElementEventHandler, H as ElementEventType, z as ElementOptions, D as ElementType, cS as ElementsCheckoutData, cT as ElementsCheckoutResult, cQ as ElementsCustomerInfo, y as ElementsOptions, cn as EnrollAndLinkOrderInput, cq as EnrollAndLinkOrderResult, ck as EnrollmentData, aq as Err, aR as FeeBearerType, F as FetchQuoteInput, aP as FulfillmentLink, aO as FulfillmentStatus, aN as FulfillmentType, cD as FxQuote, cC as FxQuoteRequest, cE as FxRateResponse, r as FxService, bY as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cV as IframeToParentMessage, I as InventoryService, cb as InventorySummary, K as KitchenOrderItem, t as KitchenOrderResult, ah as LINK_MUTATION, ag as LINK_QUERY, aT as LineItem, aK as LineType, cg as LinkData, cp as LinkEnrollResult, L as LinkService, cr as LinkSession, co as LinkStatusResult, s as LiteBootstrap, q as LiteService, bs as Location, bm as LocationAppointment, c8 as LocationStock, bq as LocationTaxBehavior, br as LocationTaxOverrides, bv as LocationTimeProfile, bB as LocationWithDetails, M as MESSAGE_TYPES, ac as MOBILE_MONEY_PROVIDER, cm as MobileMoneyData, cA as MobileMoneyDetails, a3 as MobileMoneyProvider, al as ORDER_MUTATION, a7 as ORDER_TYPE, cL as ObservabilityHooks, ap as Ok, aU as Order, aJ as OrderChannel, b1 as OrderFilter, aQ as OrderFulfillmentSummary, aX as OrderGroup, a$ as OrderGroupDetails, aY as OrderGroupPayment, aW as OrderGroupPaymentState, a_ as OrderGroupPaymentSummary, aV as OrderHistory, aL as OrderLineState, aM as OrderLineStatus, b0 as OrderPaymentEvent, O as OrderQueries, aZ as OrderSplitDetail, aH as OrderStatus, n as OtpResult, a8 as PAYMENT_METHOD, ak as PAYMENT_MUTATION, aa as PAYMENT_STATE, ab as PICKUP_TIME_TYPE, cU as ParentToIframeMessage, cO as PaymentMethodInfo, aI as PaymentState, cy as PickupTime, cx as PickupTimeType, P as PriceQuote, be as PricingOverrides, $ as ProcessAndResolveOptions, Z as ProcessCheckoutOptions, _ as ProcessCheckoutResult, c6 as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b5 as RefundOrderInput, b8 as ReminderMethod, bb as ReminderSettings, cF as RequestContext, cI as RequestErrorEvent, cu as RequestOtpInput, cG as RequestStartEvent, cH as RequestSuccessEvent, b_ as RescheduleBookingInput, bh as ResourceAssignment, bK as ResourceAvailabilityException, bJ as ResourceAvailabilityRule, bO as ResourceType, ao as Result, cJ as RetryEvent, ct as RevokeAllSessionsResult, cs as RevokeSessionResult, bx as Room, bf as SchedulingMetadata, bi as SchedulingResult, p as SchedulingService, S as SearchOptions, bP as Service, bG as ServiceAvailabilityException, c0 as ServiceAvailabilityParams, c1 as ServiceAvailabilityResult, bF as ServiceAvailabilityRule, by as ServiceCharge, bd as ServiceNotes, bk as ServiceScheduleRequest, bM as ServiceStaffRequirement, b6 as ServiceStatus, bQ as ServiceWithStaff, cK as SessionChangeEvent, bR as Staff, bg as StaffAssignment, bI as StaffAvailabilityException, bH as StaffAvailabilityRule, bL as StaffBookingProfile, b7 as StaffRole, bl as StaffScheduleItem, c4 as Stock, c5 as StockLevel, c2 as StockOwnershipType, c3 as StockStatus, bz as StorefrontBootstrap, bw as Table, T as TableInfo, bt as TimeRange, bu as TimeRanges, bS as TimeSlot, ci as UpdateAddressInput, b3 as UpdateOrderStatusInput, U as UpdateProfileInput, c7 as VariantStock, cv as VerifyOtpInput, aD as combine, aE as combineObject, c as createCimplifyClient, w as createElements, as as err, ax as flatMap, aB as fromPromise, k as generateIdempotencyKey, ay as getOrElse, au as isErr, at as isOk, aw as mapError, av as mapResult, ar as ok, aA as toNullable, aC as tryCatch, az as unwrap } from './client-CSH0xyto.mjs';
|
|
2
2
|
export { QueryBuilder, query } from './advanced.mjs';
|
|
3
3
|
import { A as ApiError } from './payment-CLIWNMaP.mjs';
|
|
4
4
|
export { B as AddOn, at as AddOnDetails, aP as AddOnGroupDetails, G as AddOnOption, aO as AddOnOptionDetails, H as AddOnOptionPrice, F as AddOnWithOptions, aU as AddToCartInput, ai as AdjustmentType, ap as AppliedDiscount, a_ as AuthorizationType, ao as BenefitType, T as Bundle, Y as BundleComponentData, _ as BundleComponentInfo, R as BundlePriceType, W as BundleProduct, ay as BundleSelectionData, aw as BundleSelectionInput, ax as BundleStoredSelection, U as BundleSummary, X as BundleWithDetails, aD as Cart, au as CartAddOn, ag as CartChannel, aE as CartItem, aR as CartItemDetails, af as CartStatus, aW as CartSummary, aF as CartTotals, K as Category, L as CategorySummary, an as ChosenPrice, h as CimplifyError, N as Collection, Q as CollectionProduct, O as CollectionSummary, a4 as ComponentGroup, a5 as ComponentGroupWithComponents, a9 as ComponentPriceBreakdown, a7 as ComponentSelectionInput, a1 as ComponentSourceType, a2 as Composite, a6 as CompositeComponent, aA as CompositePriceBreakdown, a8 as CompositePriceResult, $ as CompositePricingMode, aB as CompositeSelectionData, a7 as CompositeSelectionInput, az as CompositeStoredSelection, a3 as CompositeWithDetails, b as Currency, C as CurrencyCode, p as DepositType, D as DigitalProductType, aq as DiscountBreakdown, ar as DiscountDetails, aI as DisplayAddOn, aJ as DisplayAddOnOption, aG as DisplayCart, aH as DisplayCartItem, g as ERROR_HINTS, E as ErrorCode, e as ErrorCodeType, f as ErrorHint, a0 as GroupPricingBehavior, b2 as InitializePaymentResult, I as InventoryType, aC as LineConfiguration, ac as LocationProductPrice, M as Money, d as Pagination, P as PaginationParams, b1 as Payment, b5 as PaymentErrorDetails, b0 as PaymentMethod, aZ as PaymentMethodType, a$ as PaymentProcessingState, aY as PaymentProvider, b3 as PaymentResponse, aX as PaymentStatus, b4 as PaymentStatusResponse, ab as Price, aj as PriceAdjustment, am as PriceDecisionPath, aa as PriceEntryType, al as PricePathTaxInfo, ah as PriceSource, q as Product, J as ProductAddOn, ad as ProductAvailability, o as ProductRenderHint, ae as ProductTimeProfile, n as ProductType, s as ProductVariant, x as ProductVariantValue, r as ProductWithDetails, S as SalesChannel, as as SelectedAddOnOption, b6 as SubmitAuthorizationInput, ak as TaxPathComponent, aS as UICart, aK as UICartBusiness, aM as UICartCustomer, aL as UICartLocation, aN as UICartPricing, aT as UICartResponse, aV as UpdateCartItemInput, u as VariantAxis, z as VariantAxisSelection, w as VariantAxisValue, v as VariantAxisWithValues, av as VariantDetails, aQ as VariantDetailsDTO, t as VariantDisplayAttribute, y as VariantLocationAvailability, V as VariantStrategy, Z as ZERO, c as currencyCode, k as enrichError, j as getErrorHint, i as isCimplifyError, l as isRetryableError, m as money, a as moneyFromNumber } from './payment-CLIWNMaP.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ad as AUTHORIZATION_TYPE, ai as AUTH_MUTATION, a2 as AbortablePromise,
|
|
1
|
+
export { ad as AUTHORIZATION_TYPE, ai as AUTH_MUTATION, a2 as AbortablePromise, cl as AddressData, cN as AddressInfo, aS as AmountToPay, cw as AuthResponse, A as AuthService, m as AuthStatus, cP as AuthenticatedCustomer, cR as AuthenticatedData, c9 as AvailabilityCheck, ca as AvailabilityResult, bT as AvailableSlot, bW as Booking, bN as BookingRequirementOverride, bV as BookingStatus, bX as BookingWithDetails, ba as BufferTimes, bp as Business, bD as BusinessHours, bo as BusinessPreferences, B as BusinessService, bC as BusinessSettings, bn as BusinessType, bA as BusinessWithLocations, a6 as CHECKOUT_MODE, aj as CHECKOUT_MUTATION, a9 as CHECKOUT_STEP, af as CONTACT_TYPE, b$ as CancelBookingInput, b4 as CancelOrderInput, bc as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aF as CatalogueResult, aG as CatalogueSnapshot, bE as CategoryInfo, o as ChangePasswordInput, bZ as CheckSlotAvailabilityInput, cz as CheckoutAddressInfo, cB as CheckoutCustomerInfo, X as CheckoutFormData, b2 as CheckoutInput, J as CheckoutMode, j as CheckoutOperations, N as CheckoutOrderType, V as CheckoutPaymentMethod, Y as CheckoutResult, j as CheckoutService, a0 as CheckoutStatus, a1 as CheckoutStatusContext, W as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, v as CimplifyElement, u as CimplifyElements, a5 as ContactType, ch as CreateAddressInput, cj as CreateMobileMoneyInput, cc as Customer, cd as CustomerAddress, cf as CustomerLinkPreferences, ce as CustomerMobileMoney, b9 as CustomerServicePreferences, an as DEFAULT_COUNTRY, am as DEFAULT_CURRENCY, ae as DEVICE_TYPE, bU as DayAvailability, bj as DepositResult, a4 as DeviceType, x as ELEMENT_TYPES, E as EVENT_TYPES, cM as ElementAppearance, cW as ElementEventHandler, H as ElementEventType, z as ElementOptions, D as ElementType, cS as ElementsCheckoutData, cT as ElementsCheckoutResult, cQ as ElementsCustomerInfo, y as ElementsOptions, cn as EnrollAndLinkOrderInput, cq as EnrollAndLinkOrderResult, ck as EnrollmentData, aq as Err, aR as FeeBearerType, F as FetchQuoteInput, aP as FulfillmentLink, aO as FulfillmentStatus, aN as FulfillmentType, cD as FxQuote, cC as FxQuoteRequest, cE as FxRateResponse, r as FxService, bY as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cV as IframeToParentMessage, I as InventoryService, cb as InventorySummary, K as KitchenOrderItem, t as KitchenOrderResult, ah as LINK_MUTATION, ag as LINK_QUERY, aT as LineItem, aK as LineType, cg as LinkData, cp as LinkEnrollResult, L as LinkService, cr as LinkSession, co as LinkStatusResult, s as LiteBootstrap, q as LiteService, bs as Location, bm as LocationAppointment, c8 as LocationStock, bq as LocationTaxBehavior, br as LocationTaxOverrides, bv as LocationTimeProfile, bB as LocationWithDetails, M as MESSAGE_TYPES, ac as MOBILE_MONEY_PROVIDER, cm as MobileMoneyData, cA as MobileMoneyDetails, a3 as MobileMoneyProvider, al as ORDER_MUTATION, a7 as ORDER_TYPE, cL as ObservabilityHooks, ap as Ok, aU as Order, aJ as OrderChannel, b1 as OrderFilter, aQ as OrderFulfillmentSummary, aX as OrderGroup, a$ as OrderGroupDetails, aY as OrderGroupPayment, aW as OrderGroupPaymentState, a_ as OrderGroupPaymentSummary, aV as OrderHistory, aL as OrderLineState, aM as OrderLineStatus, b0 as OrderPaymentEvent, O as OrderQueries, aZ as OrderSplitDetail, aH as OrderStatus, n as OtpResult, a8 as PAYMENT_METHOD, ak as PAYMENT_MUTATION, aa as PAYMENT_STATE, ab as PICKUP_TIME_TYPE, cU as ParentToIframeMessage, cO as PaymentMethodInfo, aI as PaymentState, cy as PickupTime, cx as PickupTimeType, P as PriceQuote, be as PricingOverrides, $ as ProcessAndResolveOptions, Z as ProcessCheckoutOptions, _ as ProcessCheckoutResult, c6 as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b5 as RefundOrderInput, b8 as ReminderMethod, bb as ReminderSettings, cF as RequestContext, cI as RequestErrorEvent, cu as RequestOtpInput, cG as RequestStartEvent, cH as RequestSuccessEvent, b_ as RescheduleBookingInput, bh as ResourceAssignment, bK as ResourceAvailabilityException, bJ as ResourceAvailabilityRule, bO as ResourceType, ao as Result, cJ as RetryEvent, ct as RevokeAllSessionsResult, cs as RevokeSessionResult, bx as Room, bf as SchedulingMetadata, bi as SchedulingResult, p as SchedulingService, S as SearchOptions, bP as Service, bG as ServiceAvailabilityException, c0 as ServiceAvailabilityParams, c1 as ServiceAvailabilityResult, bF as ServiceAvailabilityRule, by as ServiceCharge, bd as ServiceNotes, bk as ServiceScheduleRequest, bM as ServiceStaffRequirement, b6 as ServiceStatus, bQ as ServiceWithStaff, cK as SessionChangeEvent, bR as Staff, bg as StaffAssignment, bI as StaffAvailabilityException, bH as StaffAvailabilityRule, bL as StaffBookingProfile, b7 as StaffRole, bl as StaffScheduleItem, c4 as Stock, c5 as StockLevel, c2 as StockOwnershipType, c3 as StockStatus, bz as StorefrontBootstrap, bw as Table, T as TableInfo, bt as TimeRange, bu as TimeRanges, bS as TimeSlot, ci as UpdateAddressInput, b3 as UpdateOrderStatusInput, U as UpdateProfileInput, c7 as VariantStock, cv as VerifyOtpInput, aD as combine, aE as combineObject, c as createCimplifyClient, w as createElements, as as err, ax as flatMap, aB as fromPromise, k as generateIdempotencyKey, ay as getOrElse, au as isErr, at as isOk, aw as mapError, av as mapResult, ar as ok, aA as toNullable, aC as tryCatch, az as unwrap } from './client-C082Zp8J.js';
|
|
2
2
|
export { QueryBuilder, query } from './advanced.js';
|
|
3
3
|
import { A as ApiError } from './payment-CLIWNMaP.js';
|
|
4
4
|
export { B as AddOn, at as AddOnDetails, aP as AddOnGroupDetails, G as AddOnOption, aO as AddOnOptionDetails, H as AddOnOptionPrice, F as AddOnWithOptions, aU as AddToCartInput, ai as AdjustmentType, ap as AppliedDiscount, a_ as AuthorizationType, ao as BenefitType, T as Bundle, Y as BundleComponentData, _ as BundleComponentInfo, R as BundlePriceType, W as BundleProduct, ay as BundleSelectionData, aw as BundleSelectionInput, ax as BundleStoredSelection, U as BundleSummary, X as BundleWithDetails, aD as Cart, au as CartAddOn, ag as CartChannel, aE as CartItem, aR as CartItemDetails, af as CartStatus, aW as CartSummary, aF as CartTotals, K as Category, L as CategorySummary, an as ChosenPrice, h as CimplifyError, N as Collection, Q as CollectionProduct, O as CollectionSummary, a4 as ComponentGroup, a5 as ComponentGroupWithComponents, a9 as ComponentPriceBreakdown, a7 as ComponentSelectionInput, a1 as ComponentSourceType, a2 as Composite, a6 as CompositeComponent, aA as CompositePriceBreakdown, a8 as CompositePriceResult, $ as CompositePricingMode, aB as CompositeSelectionData, a7 as CompositeSelectionInput, az as CompositeStoredSelection, a3 as CompositeWithDetails, b as Currency, C as CurrencyCode, p as DepositType, D as DigitalProductType, aq as DiscountBreakdown, ar as DiscountDetails, aI as DisplayAddOn, aJ as DisplayAddOnOption, aG as DisplayCart, aH as DisplayCartItem, g as ERROR_HINTS, E as ErrorCode, e as ErrorCodeType, f as ErrorHint, a0 as GroupPricingBehavior, b2 as InitializePaymentResult, I as InventoryType, aC as LineConfiguration, ac as LocationProductPrice, M as Money, d as Pagination, P as PaginationParams, b1 as Payment, b5 as PaymentErrorDetails, b0 as PaymentMethod, aZ as PaymentMethodType, a$ as PaymentProcessingState, aY as PaymentProvider, b3 as PaymentResponse, aX as PaymentStatus, b4 as PaymentStatusResponse, ab as Price, aj as PriceAdjustment, am as PriceDecisionPath, aa as PriceEntryType, al as PricePathTaxInfo, ah as PriceSource, q as Product, J as ProductAddOn, ad as ProductAvailability, o as ProductRenderHint, ae as ProductTimeProfile, n as ProductType, s as ProductVariant, x as ProductVariantValue, r as ProductWithDetails, S as SalesChannel, as as SelectedAddOnOption, b6 as SubmitAuthorizationInput, ak as TaxPathComponent, aS as UICart, aK as UICartBusiness, aM as UICartCustomer, aL as UICartLocation, aN as UICartPricing, aT as UICartResponse, aV as UpdateCartItemInput, u as VariantAxis, z as VariantAxisSelection, w as VariantAxisValue, v as VariantAxisWithValues, av as VariantDetails, aQ as VariantDetailsDTO, t as VariantDisplayAttribute, y as VariantLocationAvailability, V as VariantStrategy, Z as ZERO, c as currencyCode, k as enrichError, j as getErrorHint, i as isCimplifyError, l as isRetryableError, m as money, a as moneyFromNumber } from './payment-CLIWNMaP.js';
|
package/dist/index.js
CHANGED
|
@@ -349,6 +349,22 @@ function readFinalPrice(value) {
|
|
|
349
349
|
}
|
|
350
350
|
return void 0;
|
|
351
351
|
}
|
|
352
|
+
function normalizeAddOnPayload(addOn) {
|
|
353
|
+
if (!isRecord(addOn)) return addOn;
|
|
354
|
+
const normalizedAddOn = { ...addOn };
|
|
355
|
+
const options = normalizedAddOn["options"];
|
|
356
|
+
if (!Array.isArray(options)) return normalizedAddOn;
|
|
357
|
+
normalizedAddOn["options"] = options.map((option) => {
|
|
358
|
+
if (!isRecord(option)) return option;
|
|
359
|
+
const normalizedOption = { ...option };
|
|
360
|
+
const optionPrice = normalizedOption["default_price"];
|
|
361
|
+
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
362
|
+
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
363
|
+
}
|
|
364
|
+
return normalizedOption;
|
|
365
|
+
});
|
|
366
|
+
return normalizedAddOn;
|
|
367
|
+
}
|
|
352
368
|
function normalizeCatalogueProductPayload(product) {
|
|
353
369
|
const normalized = { ...product };
|
|
354
370
|
const defaultPrice = normalized["default_price"];
|
|
@@ -370,22 +386,7 @@ function normalizeCatalogueProductPayload(product) {
|
|
|
370
386
|
}
|
|
371
387
|
const addOns = normalized["add_ons"];
|
|
372
388
|
if (Array.isArray(addOns)) {
|
|
373
|
-
normalized["add_ons"] = addOns.map((addOn) =>
|
|
374
|
-
if (!isRecord(addOn)) return addOn;
|
|
375
|
-
const normalizedAddOn = { ...addOn };
|
|
376
|
-
const options = normalizedAddOn["options"];
|
|
377
|
-
if (!Array.isArray(options)) return normalizedAddOn;
|
|
378
|
-
normalizedAddOn["options"] = options.map((option) => {
|
|
379
|
-
if (!isRecord(option)) return option;
|
|
380
|
-
const normalizedOption = { ...option };
|
|
381
|
-
const optionPrice = normalizedOption["default_price"];
|
|
382
|
-
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
383
|
-
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
384
|
-
}
|
|
385
|
-
return normalizedOption;
|
|
386
|
-
});
|
|
387
|
-
return normalizedAddOn;
|
|
388
|
-
});
|
|
389
|
+
normalized["add_ons"] = addOns.map((addOn) => normalizeAddOnPayload(addOn));
|
|
389
390
|
}
|
|
390
391
|
return normalized;
|
|
391
392
|
}
|
|
@@ -458,10 +459,47 @@ function normalizeCatalogueResult(payload) {
|
|
|
458
459
|
pagination: normalizePagination(payload.pagination)
|
|
459
460
|
};
|
|
460
461
|
}
|
|
462
|
+
function normalizeCatalogueSnapshot(payload) {
|
|
463
|
+
if (Array.isArray(payload)) {
|
|
464
|
+
return {
|
|
465
|
+
categories: [],
|
|
466
|
+
products: payload.map((product) => normalizeCatalogueProductPayload(product)),
|
|
467
|
+
add_ons: [],
|
|
468
|
+
is_complete: true
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
if (!isRecord(payload)) {
|
|
472
|
+
return {
|
|
473
|
+
categories: [],
|
|
474
|
+
products: [],
|
|
475
|
+
add_ons: [],
|
|
476
|
+
is_complete: true
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
const rawProducts = Array.isArray(payload.products) ? payload.products : Array.isArray(payload.items) ? payload.items : [];
|
|
480
|
+
const rawCategories = Array.isArray(payload.categories) ? payload.categories : [];
|
|
481
|
+
const rawAddOns = Array.isArray(payload.add_ons) ? payload.add_ons : [];
|
|
482
|
+
return {
|
|
483
|
+
categories: rawCategories,
|
|
484
|
+
products: rawProducts.map((product) => normalizeCatalogueProductPayload(product)),
|
|
485
|
+
add_ons: rawAddOns.map((addOn) => normalizeAddOnPayload(addOn)),
|
|
486
|
+
is_complete: typeof payload.is_complete === "boolean" ? payload.is_complete : true,
|
|
487
|
+
total_available: toFiniteNumber(payload.total_available),
|
|
488
|
+
pagination: normalizePagination(payload.pagination)
|
|
489
|
+
};
|
|
490
|
+
}
|
|
461
491
|
var CatalogueQueries = class {
|
|
462
492
|
constructor(client) {
|
|
463
493
|
this.client = client;
|
|
464
494
|
}
|
|
495
|
+
async getCatalogue() {
|
|
496
|
+
const result = await safeWithFallback(
|
|
497
|
+
() => this.client.get("/api/v1/catalogue"),
|
|
498
|
+
() => this.client.query("catalogue")
|
|
499
|
+
);
|
|
500
|
+
if (!result.ok) return result;
|
|
501
|
+
return ok(normalizeCatalogueSnapshot(result.value));
|
|
502
|
+
}
|
|
465
503
|
async getProducts(options) {
|
|
466
504
|
let query2 = "products";
|
|
467
505
|
const filters = [];
|
package/dist/index.mjs
CHANGED
|
@@ -347,6 +347,22 @@ function readFinalPrice(value) {
|
|
|
347
347
|
}
|
|
348
348
|
return void 0;
|
|
349
349
|
}
|
|
350
|
+
function normalizeAddOnPayload(addOn) {
|
|
351
|
+
if (!isRecord(addOn)) return addOn;
|
|
352
|
+
const normalizedAddOn = { ...addOn };
|
|
353
|
+
const options = normalizedAddOn["options"];
|
|
354
|
+
if (!Array.isArray(options)) return normalizedAddOn;
|
|
355
|
+
normalizedAddOn["options"] = options.map((option) => {
|
|
356
|
+
if (!isRecord(option)) return option;
|
|
357
|
+
const normalizedOption = { ...option };
|
|
358
|
+
const optionPrice = normalizedOption["default_price"];
|
|
359
|
+
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
360
|
+
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
361
|
+
}
|
|
362
|
+
return normalizedOption;
|
|
363
|
+
});
|
|
364
|
+
return normalizedAddOn;
|
|
365
|
+
}
|
|
350
366
|
function normalizeCatalogueProductPayload(product) {
|
|
351
367
|
const normalized = { ...product };
|
|
352
368
|
const defaultPrice = normalized["default_price"];
|
|
@@ -368,22 +384,7 @@ function normalizeCatalogueProductPayload(product) {
|
|
|
368
384
|
}
|
|
369
385
|
const addOns = normalized["add_ons"];
|
|
370
386
|
if (Array.isArray(addOns)) {
|
|
371
|
-
normalized["add_ons"] = addOns.map((addOn) =>
|
|
372
|
-
if (!isRecord(addOn)) return addOn;
|
|
373
|
-
const normalizedAddOn = { ...addOn };
|
|
374
|
-
const options = normalizedAddOn["options"];
|
|
375
|
-
if (!Array.isArray(options)) return normalizedAddOn;
|
|
376
|
-
normalizedAddOn["options"] = options.map((option) => {
|
|
377
|
-
if (!isRecord(option)) return option;
|
|
378
|
-
const normalizedOption = { ...option };
|
|
379
|
-
const optionPrice = normalizedOption["default_price"];
|
|
380
|
-
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
381
|
-
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
382
|
-
}
|
|
383
|
-
return normalizedOption;
|
|
384
|
-
});
|
|
385
|
-
return normalizedAddOn;
|
|
386
|
-
});
|
|
387
|
+
normalized["add_ons"] = addOns.map((addOn) => normalizeAddOnPayload(addOn));
|
|
387
388
|
}
|
|
388
389
|
return normalized;
|
|
389
390
|
}
|
|
@@ -456,10 +457,47 @@ function normalizeCatalogueResult(payload) {
|
|
|
456
457
|
pagination: normalizePagination(payload.pagination)
|
|
457
458
|
};
|
|
458
459
|
}
|
|
460
|
+
function normalizeCatalogueSnapshot(payload) {
|
|
461
|
+
if (Array.isArray(payload)) {
|
|
462
|
+
return {
|
|
463
|
+
categories: [],
|
|
464
|
+
products: payload.map((product) => normalizeCatalogueProductPayload(product)),
|
|
465
|
+
add_ons: [],
|
|
466
|
+
is_complete: true
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
if (!isRecord(payload)) {
|
|
470
|
+
return {
|
|
471
|
+
categories: [],
|
|
472
|
+
products: [],
|
|
473
|
+
add_ons: [],
|
|
474
|
+
is_complete: true
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
const rawProducts = Array.isArray(payload.products) ? payload.products : Array.isArray(payload.items) ? payload.items : [];
|
|
478
|
+
const rawCategories = Array.isArray(payload.categories) ? payload.categories : [];
|
|
479
|
+
const rawAddOns = Array.isArray(payload.add_ons) ? payload.add_ons : [];
|
|
480
|
+
return {
|
|
481
|
+
categories: rawCategories,
|
|
482
|
+
products: rawProducts.map((product) => normalizeCatalogueProductPayload(product)),
|
|
483
|
+
add_ons: rawAddOns.map((addOn) => normalizeAddOnPayload(addOn)),
|
|
484
|
+
is_complete: typeof payload.is_complete === "boolean" ? payload.is_complete : true,
|
|
485
|
+
total_available: toFiniteNumber(payload.total_available),
|
|
486
|
+
pagination: normalizePagination(payload.pagination)
|
|
487
|
+
};
|
|
488
|
+
}
|
|
459
489
|
var CatalogueQueries = class {
|
|
460
490
|
constructor(client) {
|
|
461
491
|
this.client = client;
|
|
462
492
|
}
|
|
493
|
+
async getCatalogue() {
|
|
494
|
+
const result = await safeWithFallback(
|
|
495
|
+
() => this.client.get("/api/v1/catalogue"),
|
|
496
|
+
() => this.client.query("catalogue")
|
|
497
|
+
);
|
|
498
|
+
if (!result.ok) return result;
|
|
499
|
+
return ok(normalizeCatalogueSnapshot(result.value));
|
|
500
|
+
}
|
|
463
501
|
async getProducts(options) {
|
|
464
502
|
let query2 = "products";
|
|
465
503
|
const filters = [];
|
package/dist/react.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CimplifyClient, _ as ProcessCheckoutResult, a0 as CheckoutStatus, a1 as CheckoutStatusContext,
|
|
1
|
+
import { C as CimplifyClient, _ as ProcessCheckoutResult, a0 as CheckoutStatus, a1 as CheckoutStatusContext, bs as Location, bp as Business, aU as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, u as CimplifyElements, y as ElementsOptions, cR as AuthenticatedData, cN as AddressInfo, cO as PaymentMethodInfo, cT as ElementsCheckoutResult, Z as ProcessCheckoutOptions } from './client-CSH0xyto.mjs';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
3
|
import { q as Product, d as Pagination, h as CimplifyError, r as ProductWithDetails, K as Category, aw as BundleSelectionInput, a7 as ComponentSelectionInput, N as Collection, X as BundleWithDetails, a3 as CompositeWithDetails, a8 as CompositePriceResult, C as CurrencyCode } from './payment-CLIWNMaP.mjs';
|
|
4
4
|
import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-t3FBTU8p.mjs';
|
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CimplifyClient, _ as ProcessCheckoutResult, a0 as CheckoutStatus, a1 as CheckoutStatusContext,
|
|
1
|
+
import { C as CimplifyClient, _ as ProcessCheckoutResult, a0 as CheckoutStatus, a1 as CheckoutStatusContext, bs as Location, bp as Business, aU as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, u as CimplifyElements, y as ElementsOptions, cR as AuthenticatedData, cN as AddressInfo, cO as PaymentMethodInfo, cT as ElementsCheckoutResult, Z as ProcessCheckoutOptions } from './client-C082Zp8J.js';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
3
|
import { q as Product, d as Pagination, h as CimplifyError, r as ProductWithDetails, K as Category, aw as BundleSelectionInput, a7 as ComponentSelectionInput, N as Collection, X as BundleWithDetails, a3 as CompositeWithDetails, a8 as CompositePriceResult, C as CurrencyCode } from './payment-CLIWNMaP.js';
|
|
4
4
|
import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-t3FBTU8p.js';
|
package/dist/react.js
CHANGED
|
@@ -885,6 +885,22 @@ function readFinalPrice(value) {
|
|
|
885
885
|
}
|
|
886
886
|
return void 0;
|
|
887
887
|
}
|
|
888
|
+
function normalizeAddOnPayload(addOn) {
|
|
889
|
+
if (!isRecord(addOn)) return addOn;
|
|
890
|
+
const normalizedAddOn = { ...addOn };
|
|
891
|
+
const options = normalizedAddOn["options"];
|
|
892
|
+
if (!Array.isArray(options)) return normalizedAddOn;
|
|
893
|
+
normalizedAddOn["options"] = options.map((option) => {
|
|
894
|
+
if (!isRecord(option)) return option;
|
|
895
|
+
const normalizedOption = { ...option };
|
|
896
|
+
const optionPrice = normalizedOption["default_price"];
|
|
897
|
+
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
898
|
+
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
899
|
+
}
|
|
900
|
+
return normalizedOption;
|
|
901
|
+
});
|
|
902
|
+
return normalizedAddOn;
|
|
903
|
+
}
|
|
888
904
|
function normalizeCatalogueProductPayload(product) {
|
|
889
905
|
const normalized = { ...product };
|
|
890
906
|
const defaultPrice = normalized["default_price"];
|
|
@@ -906,22 +922,7 @@ function normalizeCatalogueProductPayload(product) {
|
|
|
906
922
|
}
|
|
907
923
|
const addOns = normalized["add_ons"];
|
|
908
924
|
if (Array.isArray(addOns)) {
|
|
909
|
-
normalized["add_ons"] = addOns.map((addOn) =>
|
|
910
|
-
if (!isRecord(addOn)) return addOn;
|
|
911
|
-
const normalizedAddOn = { ...addOn };
|
|
912
|
-
const options = normalizedAddOn["options"];
|
|
913
|
-
if (!Array.isArray(options)) return normalizedAddOn;
|
|
914
|
-
normalizedAddOn["options"] = options.map((option) => {
|
|
915
|
-
if (!isRecord(option)) return option;
|
|
916
|
-
const normalizedOption = { ...option };
|
|
917
|
-
const optionPrice = normalizedOption["default_price"];
|
|
918
|
-
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
919
|
-
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
920
|
-
}
|
|
921
|
-
return normalizedOption;
|
|
922
|
-
});
|
|
923
|
-
return normalizedAddOn;
|
|
924
|
-
});
|
|
925
|
+
normalized["add_ons"] = addOns.map((addOn) => normalizeAddOnPayload(addOn));
|
|
925
926
|
}
|
|
926
927
|
return normalized;
|
|
927
928
|
}
|
|
@@ -994,10 +995,47 @@ function normalizeCatalogueResult(payload) {
|
|
|
994
995
|
pagination: normalizePagination(payload.pagination)
|
|
995
996
|
};
|
|
996
997
|
}
|
|
998
|
+
function normalizeCatalogueSnapshot(payload) {
|
|
999
|
+
if (Array.isArray(payload)) {
|
|
1000
|
+
return {
|
|
1001
|
+
categories: [],
|
|
1002
|
+
products: payload.map((product) => normalizeCatalogueProductPayload(product)),
|
|
1003
|
+
add_ons: [],
|
|
1004
|
+
is_complete: true
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
if (!isRecord(payload)) {
|
|
1008
|
+
return {
|
|
1009
|
+
categories: [],
|
|
1010
|
+
products: [],
|
|
1011
|
+
add_ons: [],
|
|
1012
|
+
is_complete: true
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
const rawProducts = Array.isArray(payload.products) ? payload.products : Array.isArray(payload.items) ? payload.items : [];
|
|
1016
|
+
const rawCategories = Array.isArray(payload.categories) ? payload.categories : [];
|
|
1017
|
+
const rawAddOns = Array.isArray(payload.add_ons) ? payload.add_ons : [];
|
|
1018
|
+
return {
|
|
1019
|
+
categories: rawCategories,
|
|
1020
|
+
products: rawProducts.map((product) => normalizeCatalogueProductPayload(product)),
|
|
1021
|
+
add_ons: rawAddOns.map((addOn) => normalizeAddOnPayload(addOn)),
|
|
1022
|
+
is_complete: typeof payload.is_complete === "boolean" ? payload.is_complete : true,
|
|
1023
|
+
total_available: toFiniteNumber(payload.total_available),
|
|
1024
|
+
pagination: normalizePagination(payload.pagination)
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
997
1027
|
var CatalogueQueries = class {
|
|
998
1028
|
constructor(client) {
|
|
999
1029
|
this.client = client;
|
|
1000
1030
|
}
|
|
1031
|
+
async getCatalogue() {
|
|
1032
|
+
const result = await safeWithFallback(
|
|
1033
|
+
() => this.client.get("/api/v1/catalogue"),
|
|
1034
|
+
() => this.client.query("catalogue")
|
|
1035
|
+
);
|
|
1036
|
+
if (!result.ok) return result;
|
|
1037
|
+
return ok(normalizeCatalogueSnapshot(result.value));
|
|
1038
|
+
}
|
|
1001
1039
|
async getProducts(options) {
|
|
1002
1040
|
let query = "products";
|
|
1003
1041
|
const filters = [];
|
package/dist/react.mjs
CHANGED
|
@@ -883,6 +883,22 @@ function readFinalPrice(value) {
|
|
|
883
883
|
}
|
|
884
884
|
return void 0;
|
|
885
885
|
}
|
|
886
|
+
function normalizeAddOnPayload(addOn) {
|
|
887
|
+
if (!isRecord(addOn)) return addOn;
|
|
888
|
+
const normalizedAddOn = { ...addOn };
|
|
889
|
+
const options = normalizedAddOn["options"];
|
|
890
|
+
if (!Array.isArray(options)) return normalizedAddOn;
|
|
891
|
+
normalizedAddOn["options"] = options.map((option) => {
|
|
892
|
+
if (!isRecord(option)) return option;
|
|
893
|
+
const normalizedOption = { ...option };
|
|
894
|
+
const optionPrice = normalizedOption["default_price"];
|
|
895
|
+
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
896
|
+
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
897
|
+
}
|
|
898
|
+
return normalizedOption;
|
|
899
|
+
});
|
|
900
|
+
return normalizedAddOn;
|
|
901
|
+
}
|
|
886
902
|
function normalizeCatalogueProductPayload(product) {
|
|
887
903
|
const normalized = { ...product };
|
|
888
904
|
const defaultPrice = normalized["default_price"];
|
|
@@ -904,22 +920,7 @@ function normalizeCatalogueProductPayload(product) {
|
|
|
904
920
|
}
|
|
905
921
|
const addOns = normalized["add_ons"];
|
|
906
922
|
if (Array.isArray(addOns)) {
|
|
907
|
-
normalized["add_ons"] = addOns.map((addOn) =>
|
|
908
|
-
if (!isRecord(addOn)) return addOn;
|
|
909
|
-
const normalizedAddOn = { ...addOn };
|
|
910
|
-
const options = normalizedAddOn["options"];
|
|
911
|
-
if (!Array.isArray(options)) return normalizedAddOn;
|
|
912
|
-
normalizedAddOn["options"] = options.map((option) => {
|
|
913
|
-
if (!isRecord(option)) return option;
|
|
914
|
-
const normalizedOption = { ...option };
|
|
915
|
-
const optionPrice = normalizedOption["default_price"];
|
|
916
|
-
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
917
|
-
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
918
|
-
}
|
|
919
|
-
return normalizedOption;
|
|
920
|
-
});
|
|
921
|
-
return normalizedAddOn;
|
|
922
|
-
});
|
|
923
|
+
normalized["add_ons"] = addOns.map((addOn) => normalizeAddOnPayload(addOn));
|
|
923
924
|
}
|
|
924
925
|
return normalized;
|
|
925
926
|
}
|
|
@@ -992,10 +993,47 @@ function normalizeCatalogueResult(payload) {
|
|
|
992
993
|
pagination: normalizePagination(payload.pagination)
|
|
993
994
|
};
|
|
994
995
|
}
|
|
996
|
+
function normalizeCatalogueSnapshot(payload) {
|
|
997
|
+
if (Array.isArray(payload)) {
|
|
998
|
+
return {
|
|
999
|
+
categories: [],
|
|
1000
|
+
products: payload.map((product) => normalizeCatalogueProductPayload(product)),
|
|
1001
|
+
add_ons: [],
|
|
1002
|
+
is_complete: true
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
if (!isRecord(payload)) {
|
|
1006
|
+
return {
|
|
1007
|
+
categories: [],
|
|
1008
|
+
products: [],
|
|
1009
|
+
add_ons: [],
|
|
1010
|
+
is_complete: true
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
const rawProducts = Array.isArray(payload.products) ? payload.products : Array.isArray(payload.items) ? payload.items : [];
|
|
1014
|
+
const rawCategories = Array.isArray(payload.categories) ? payload.categories : [];
|
|
1015
|
+
const rawAddOns = Array.isArray(payload.add_ons) ? payload.add_ons : [];
|
|
1016
|
+
return {
|
|
1017
|
+
categories: rawCategories,
|
|
1018
|
+
products: rawProducts.map((product) => normalizeCatalogueProductPayload(product)),
|
|
1019
|
+
add_ons: rawAddOns.map((addOn) => normalizeAddOnPayload(addOn)),
|
|
1020
|
+
is_complete: typeof payload.is_complete === "boolean" ? payload.is_complete : true,
|
|
1021
|
+
total_available: toFiniteNumber(payload.total_available),
|
|
1022
|
+
pagination: normalizePagination(payload.pagination)
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
995
1025
|
var CatalogueQueries = class {
|
|
996
1026
|
constructor(client) {
|
|
997
1027
|
this.client = client;
|
|
998
1028
|
}
|
|
1029
|
+
async getCatalogue() {
|
|
1030
|
+
const result = await safeWithFallback(
|
|
1031
|
+
() => this.client.get("/api/v1/catalogue"),
|
|
1032
|
+
() => this.client.query("catalogue")
|
|
1033
|
+
);
|
|
1034
|
+
if (!result.ok) return result;
|
|
1035
|
+
return ok(normalizeCatalogueSnapshot(result.value));
|
|
1036
|
+
}
|
|
999
1037
|
async getProducts(options) {
|
|
1000
1038
|
let query = "products";
|
|
1001
1039
|
const filters = [];
|