@cimplify/sdk 0.6.4 → 0.6.5

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.
@@ -0,0 +1,377 @@
1
+ import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-CmO7VVPP.js';
2
+ export { ah as AUTHORIZATION_TYPE, am as AUTH_MUTATION, a6 as AbortablePromise, eM as AdConfig, eO as AdContextValue, eN as AdCreative, eK as AdPosition, eJ as AdSlot, eL as AdTheme, b6 as AddOn, bR as AddOnDetails, cb as AddOnGroupDetails, b8 as AddOnOption, ca as AddOnOptionDetails, b9 as AddOnOptionPrice, b7 as AddOnWithOptions, cg as AddToCartInput, e7 as AddressData, ez as AddressInfo, bG as AdjustmentType, cu as AmountToPay, bN as AppliedDiscount, ei as AuthResponse, p as AuthService, q as AuthStatus, eB as AuthenticatedCustomer, eD as AuthenticatedData, d2 as AuthorizationType, dX as AvailabilityCheck, dY as AvailabilityResult, dF as AvailableSlot, bM as BenefitType, dI as Booking, dz as BookingRequirementOverride, dH as BookingStatus, dJ as BookingWithDetails, cO as BufferTimes, bh as Bundle, bl as BundleComponentData, bm as BundleComponentInfo, bg as BundlePriceType, bj as BundleProduct, bW as BundleSelectionData, bU as BundleSelectionInput, bV as BundleStoredSelection, bi as BundleSummary, bk as BundleWithDetails, da as Business, dp as BusinessHours, d9 as BusinessPreferences, B as BusinessService, dn as BusinessSettings, d8 as BusinessType, dl as BusinessWithLocations, aa as CHECKOUT_MODE, an as CHECKOUT_MUTATION, ad as CHECKOUT_STEP, aj as CONTACT_TYPE, dN as CancelBookingInput, cI as CancelOrderInput, cQ as CancellationPolicy, b$ as Cart, bS as CartAddOn, bE as CartChannel, c0 as CartItem, cd as CartItemDetails, l as CartOperations, bD as CartStatus, ci as CartSummary, c1 as CartTotals, e as CatalogueQueries, bb as Category, dq as CategoryInfo, bc as CategorySummary, s as ChangePasswordInput, dL as CheckSlotAvailabilityInput, el as CheckoutAddressInfo, en as CheckoutCustomerInfo, $ as CheckoutFormData, cG as CheckoutInput, X as CheckoutMode, m as CheckoutOperations, Y as CheckoutOrderType, Z as CheckoutPaymentMethod, a0 as CheckoutResult, m as CheckoutService, a4 as CheckoutStatus, a5 as CheckoutStatusContext, _ as CheckoutStep, bL as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, z as CimplifyElement, y as CimplifyElements, ay as CimplifyError, bd as Collection, bf as CollectionProduct, be as CollectionSummary, bs as ComponentGroup, bt as ComponentGroupWithComponents, bx as ComponentPriceBreakdown, bv as ComponentSelectionInput, bp as ComponentSourceType, bq as Composite, bu as CompositeComponent, bY as CompositePriceBreakdown, bw as CompositePriceResult, bn as CompositePricingMode, bZ as CompositeSelectionData, bv as CompositeSelectionInput, bX as CompositeStoredSelection, br as CompositeWithDetails, a9 as ContactType, e3 as CreateAddressInput, e5 as CreateMobileMoneyInput, at as Currency, d_ as Customer, d$ as CustomerAddress, e1 as CustomerLinkPreferences, e0 as CustomerMobileMoney, cN as CustomerServicePreferences, ar as DEFAULT_COUNTRY, aq as DEFAULT_CURRENCY, ai as DEVICE_TYPE, dG as DayAvailability, cX as DepositResult, aW as DepositType, a8 as DeviceType, aV as DigitalProductType, bO as DiscountBreakdown, bP as DiscountDetails, c4 as DisplayAddOn, c5 as DisplayAddOnOption, c2 as DisplayCart, c3 as DisplayCartItem, H as ELEMENT_TYPES, E as EVENT_TYPES, ey as ElementAppearance, eI as ElementEventHandler, W as ElementEventType, N as ElementOptions, V as ElementType, eE as ElementsCheckoutData, eF as ElementsCheckoutResult, eC as ElementsCustomerInfo, J as ElementsOptions, e9 as EnrollAndLinkOrderInput, ec as EnrollAndLinkOrderResult, e6 as EnrollmentData, aD as Err, aw as ErrorCode, ax as ErrorCodeType, ct as FeeBearerType, F as FetchQuoteInput, cr as FulfillmentLink, cq as FulfillmentStatus, cp as FulfillmentType, ep as FxQuote, eo as FxQuoteRequest, eq as FxRateResponse, v as FxService, dK as GetAvailableSlotsInput, o as GetOrdersOptions, G as GetProductsOptions, bo as GroupPricingBehavior, eH as IframeToParentMessage, d6 as InitializePaymentResult, I as InventoryService, dZ as InventorySummary, aT as InventoryType, K as KitchenOrderItem, x as KitchenOrderResult, al as LINK_MUTATION, ak as LINK_QUERY, b_ as LineConfiguration, cv as LineItem, cm as LineType, e2 as LinkData, eb as LinkEnrollResult, L as LinkService, ed as LinkSession, ea as LinkStatusResult, w as LiteBootstrap, u as LiteService, dd as Location, c_ as LocationAppointment, bA as LocationProductPrice, dW as LocationStock, db as LocationTaxBehavior, dc as LocationTaxOverrides, dg as LocationTimeProfile, dm as LocationWithDetails, M as MESSAGE_TYPES, ag as MOBILE_MONEY_PROVIDER, e8 as MobileMoneyData, em as MobileMoneyDetails, a7 as MobileMoneyProvider, as as Money, ap as ORDER_MUTATION, ab as ORDER_TYPE, ex as ObservabilityHooks, aC as Ok, cw as Order, cl as OrderChannel, cF as OrderFilter, cs as OrderFulfillmentSummary, cz as OrderGroup, cD as OrderGroupDetails, cA as OrderGroupPayment, cy as OrderGroupPaymentState, cC as OrderGroupPaymentSummary, cx as OrderHistory, cn as OrderLineState, co as OrderLineStatus, cE as OrderPaymentEvent, O as OrderQueries, cB as OrderSplitDetail, cj as OrderStatus, r as OtpResult, ac as PAYMENT_METHOD, ao as PAYMENT_MUTATION, ae as PAYMENT_STATE, af as PICKUP_TIME_TYPE, av as Pagination, au as PaginationParams, eG as ParentToIframeMessage, d5 as Payment, d4 as PaymentMethod, eA as PaymentMethodInfo, d1 as PaymentMethodType, d3 as PaymentProcessingState, d0 as PaymentProvider, ck as PaymentState, c$ as PaymentStatus, ek as PickupTime, ej as PickupTimeType, bz as Price, bH as PriceAdjustment, bK as PriceDecisionPath, by as PriceEntryType, bJ as PricePathTaxInfo, j as PriceQuote, bF as PriceSource, cS as PricingOverrides, a3 as ProcessAndResolveOptions, a1 as ProcessCheckoutOptions, a2 as ProcessCheckoutResult, aY as Product, ba as ProductAddOn, bB as ProductAvailability, dU as ProductStock, bC as ProductTimeProfile, aS as ProductType, a_ as ProductVariant, b3 as ProductVariantValue, aZ as ProductWithDetails, f as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, h as QuoteDynamicBuckets, g as QuoteStatus, i as QuoteUiMessage, R as RefreshQuoteInput, k as RefreshQuoteResult, cJ as RefundOrderInput, cM as ReminderMethod, cP as ReminderSettings, er as RequestContext, eu as RequestErrorEvent, eg as RequestOtpInput, es as RequestStartEvent, et as RequestSuccessEvent, dM as RescheduleBookingInput, cV as ResourceAssignment, dw as ResourceAvailabilityException, dv as ResourceAvailabilityRule, dA as ResourceType, aB as Result, ev as RetryEvent, ef as RevokeAllSessionsResult, ee as RevokeSessionResult, di as Room, aX as SalesChannel, cT as SchedulingMetadata, cW as SchedulingResult, t as SchedulingService, S as SearchOptions, bQ as SelectedAddOnOption, dB as Service, ds as ServiceAvailabilityException, dO as ServiceAvailabilityParams, dP as ServiceAvailabilityResult, dr as ServiceAvailabilityRule, dj as ServiceCharge, cR as ServiceNotes, cY as ServiceScheduleRequest, dy as ServiceStaffRequirement, cK as ServiceStatus, dC as ServiceWithStaff, ew as SessionChangeEvent, dD as Staff, cU as StaffAssignment, du as StaffAvailabilityException, dt as StaffAvailabilityRule, dx as StaffBookingProfile, cL as StaffRole, cZ as StaffScheduleItem, dS as Stock, dT as StockLevel, dQ as StockOwnershipType, dR as StockStatus, dk as StorefrontBootstrap, d7 as SubmitAuthorizationInput, dh as Table, T as TableInfo, bI as TaxPathComponent, de as TimeRange, df as TimeRanges, dE as TimeSlot, ce as UICart, c6 as UICartBusiness, c8 as UICartCustomer, c7 as UICartLocation, c9 as UICartPricing, cf as UICartResponse, e4 as UpdateAddressInput, ch as UpdateCartItemInput, cH as UpdateOrderStatusInput, U as UpdateProfileInput, b0 as VariantAxis, b5 as VariantAxisSelection, b2 as VariantAxisValue, b1 as VariantAxisWithValues, bT as VariantDetails, cc as VariantDetailsDTO, a$ as VariantDisplayAttribute, b4 as VariantLocationAvailability, dV as VariantStock, aU as VariantStrategy, eh as VerifyOtpInput, aQ as combine, aR as combineObject, c as createCimplifyClient, D as createElements, aF as err, aK as flatMap, aO as fromPromise, n as generateIdempotencyKey, aL as getOrElse, az as isCimplifyError, aH as isErr, aG as isOk, aA as isRetryableError, aJ as mapError, aI as mapResult, aE as ok, aN as toNullable, aP as tryCatch, aM as unwrap } from './ads-CmO7VVPP.js';
3
+
4
+ type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
5
+ type SortOrder = "asc" | "desc";
6
+ declare class QueryBuilder {
7
+ private entity;
8
+ private filters;
9
+ private modifiers;
10
+ private pathSegments;
11
+ constructor(entity: string);
12
+ path(segment: string): this;
13
+ where(field: string, op: Operator, value: unknown): this;
14
+ and(field: string, op: Operator, value: unknown): this;
15
+ sort(field: string, order?: SortOrder): this;
16
+ limit(n: number): this;
17
+ offset(n: number): this;
18
+ count(): this;
19
+ enriched(): this;
20
+ build(): string;
21
+ toString(): string;
22
+ }
23
+ declare function query(entity: string): QueryBuilder;
24
+
25
+ /**
26
+ * Price Types
27
+ *
28
+ * Types for price parsing, formatting, and display utilities.
29
+ */
30
+ /**
31
+ * Individual tax component (e.g., VAT, NHIL, GETFund)
32
+ */
33
+ interface TaxComponent {
34
+ /** Tax component name */
35
+ name: string;
36
+ /** Tax rate as percentage (e.g., 15.0 for 15%) */
37
+ rate: number;
38
+ }
39
+ /**
40
+ * Complete tax information from a pricing response
41
+ */
42
+ interface TaxInfo {
43
+ /** Total tax rate as percentage */
44
+ taxRate: number;
45
+ /** Calculated tax amount */
46
+ taxAmount: number;
47
+ /** Whether tax is included in the displayed price */
48
+ isInclusive: boolean;
49
+ /** Individual tax components that make up the total */
50
+ components: TaxComponent[];
51
+ }
52
+ /**
53
+ * Price information in snake_case format (as returned from backend)
54
+ * Used by components that work with raw API responses
55
+ */
56
+ interface PriceInfo {
57
+ /** Original price before markup/discount */
58
+ base_price: number;
59
+ /** Final price after all adjustments */
60
+ final_price: number;
61
+ /** Markup percentage if applicable */
62
+ markup_percentage?: number;
63
+ /** Markup amount if applicable */
64
+ markup_amount?: number;
65
+ /** Currency code (e.g., "GHS", "USD") */
66
+ currency?: string;
67
+ /** Tax information */
68
+ tax_info?: TaxInfo;
69
+ /** Decision path showing pricing adjustments */
70
+ decision_path?: string;
71
+ }
72
+ /**
73
+ * Minimal product shape for price utilities.
74
+ * Uses quote-aware `price_info` and plain numeric fallback fields.
75
+ */
76
+ interface ProductWithPrice {
77
+ /** Pre-parsed price info from backend */
78
+ price_info?: PriceInfo;
79
+ /** Final computed price in plain field form (if provided by API) */
80
+ final_price?: number | string | null;
81
+ /** Base/original price in plain field form */
82
+ base_price?: number | string | null;
83
+ /** Default/indicative price in plain field form */
84
+ default_price?: number | string | null;
85
+ /** Currency in plain field form */
86
+ currency?: string | null;
87
+ }
88
+ /**
89
+ * Options for price formatting functions
90
+ */
91
+ interface FormatPriceOptions {
92
+ /** Currency code (default: "GHS") */
93
+ currency?: string;
94
+ /** Locale for Intl.NumberFormat (default: "en-US") */
95
+ locale?: string;
96
+ /** Minimum fraction digits (default: 2) */
97
+ minimumFractionDigits?: number;
98
+ /** Maximum fraction digits (default: 2) */
99
+ maximumFractionDigits?: number;
100
+ }
101
+ /**
102
+ * Options for compact price formatting
103
+ */
104
+ interface FormatCompactOptions {
105
+ /** Currency code (default: "GHS") */
106
+ currency?: string;
107
+ /** Number of decimal places for compact notation (default: 1) */
108
+ decimals?: number;
109
+ }
110
+
111
+ /**
112
+ * Price Utilities
113
+ *
114
+ * Comprehensive utilities for parsing, formatting, and displaying prices.
115
+ * Handles quote-aware pricing fields, currency formatting, and product price helpers.
116
+ *
117
+ * @example
118
+ * ```typescript
119
+ * import {
120
+ * formatPrice,
121
+ * formatPriceCompact,
122
+ * isOnSale,
123
+ * getDiscountPercentage
124
+ * } from '@cimplify/sdk';
125
+ *
126
+ * // Format prices
127
+ * formatPrice(29.99, 'USD'); // "$29.99"
128
+ * formatPrice(29.99, 'GHS'); // "GH₵29.99"
129
+ * formatPriceCompact(1500000, 'USD'); // "$1.5M"
130
+ *
131
+ * // Check for discounts
132
+ * if (isOnSale(product)) {
133
+ * console.log(`${getDiscountPercentage(product)}% off!`);
134
+ * }
135
+ * ```
136
+ */
137
+
138
+ /**
139
+ * Currency code to symbol mapping
140
+ * Includes major world currencies and African currencies
141
+ */
142
+ declare const CURRENCY_SYMBOLS: Record<string, string>;
143
+ /**
144
+ * Get currency symbol for a currency code
145
+ * @param currencyCode - ISO 4217 currency code (e.g., "USD", "GHS")
146
+ * @returns Currency symbol or the code itself if not found
147
+ *
148
+ * @example
149
+ * getCurrencySymbol('USD') // "$"
150
+ * getCurrencySymbol('GHS') // "GH₵"
151
+ * getCurrencySymbol('XYZ') // "XYZ"
152
+ */
153
+ declare function getCurrencySymbol(currencyCode: string): string;
154
+ /**
155
+ * Format a number compactly with K/M/B suffixes
156
+ * @param value - Number to format
157
+ * @param decimals - Decimal places (default: 1)
158
+ * @returns Compact string representation
159
+ *
160
+ * @example
161
+ * formatNumberCompact(1234) // "1.2K"
162
+ * formatNumberCompact(1500000) // "1.5M"
163
+ * formatNumberCompact(2500000000) // "2.5B"
164
+ */
165
+ declare function formatNumberCompact(value: number, decimals?: number): string;
166
+ /**
167
+ * Format a price with locale-aware currency formatting
168
+ * Uses Intl.NumberFormat for proper localization
169
+ *
170
+ * @param amount - Price amount (number or string)
171
+ * @param currency - ISO 4217 currency code (default: "GHS")
172
+ * @param locale - BCP 47 locale string (default: "en-US")
173
+ * @returns Formatted price string
174
+ *
175
+ * @example
176
+ * formatPrice(29.99, 'USD') // "$29.99"
177
+ * formatPrice(29.99, 'GHS') // "GH₵29.99"
178
+ * formatPrice('29.99', 'EUR') // "€29.99"
179
+ * formatPrice(1234.56, 'USD', 'de-DE') // "1.234,56 $"
180
+ */
181
+ declare function formatPrice(amount: number | string, currency?: string, locale?: string): string;
182
+ /**
183
+ * Format a price with +/- sign for adjustments
184
+ * Useful for showing price changes, modifiers, or discounts
185
+ *
186
+ * @param amount - Adjustment amount (positive or negative)
187
+ * @param currency - ISO 4217 currency code (default: "GHS")
188
+ * @param locale - BCP 47 locale string (default: "en-US")
189
+ * @returns Formatted adjustment string with sign
190
+ *
191
+ * @example
192
+ * formatPriceAdjustment(5.00, 'USD') // "+$5.00"
193
+ * formatPriceAdjustment(-3.50, 'GHS') // "-GH₵3.50"
194
+ * formatPriceAdjustment(0, 'EUR') // "€0.00"
195
+ */
196
+ declare function formatPriceAdjustment(amount: number, currency?: string, locale?: string): string;
197
+ /**
198
+ * Format a price compactly for large numbers
199
+ * Uses K/M/B suffixes for thousands, millions, billions
200
+ *
201
+ * @param amount - Price amount (number or string)
202
+ * @param currency - ISO 4217 currency code (default: "GHS")
203
+ * @param decimals - Decimal places for compact notation (default: 1)
204
+ * @returns Compact formatted price
205
+ *
206
+ * @example
207
+ * formatPriceCompact(999, 'USD') // "$999.00"
208
+ * formatPriceCompact(1500, 'GHS') // "GH₵1.5K"
209
+ * formatPriceCompact(2500000, 'USD') // "$2.5M"
210
+ * formatPriceCompact(1200000000, 'EUR') // "€1.2B"
211
+ */
212
+ declare function formatPriceCompact(amount: number | string, currency?: string, decimals?: number): string;
213
+ /**
214
+ * Simple currency symbol + amount format
215
+ * Lighter alternative to formatPrice without Intl
216
+ *
217
+ * @param amount - Price amount (number or string)
218
+ * @param currency - ISO 4217 currency code (default: "GHS")
219
+ * @returns Simple formatted price
220
+ *
221
+ * @example
222
+ * formatMoney(29.99, 'USD') // "$29.99"
223
+ * formatMoney('15.00', 'GHS') // "GH₵15.00"
224
+ */
225
+ declare function formatMoney(amount: string | number, currency?: string): string;
226
+ /**
227
+ * Parse a price string or number to a numeric value
228
+ * Handles various input formats gracefully
229
+ *
230
+ * @param value - Value to parse (string, number, or undefined)
231
+ * @returns Parsed numeric value, or 0 if invalid
232
+ *
233
+ * @example
234
+ * parsePrice('29.99') // 29.99
235
+ * parsePrice(29.99) // 29.99
236
+ * parsePrice('$29.99') // 29.99 (strips non-numeric prefix)
237
+ * parsePrice(undefined) // 0
238
+ * parsePrice('invalid') // 0
239
+ */
240
+ declare function parsePrice(value: string | number | undefined | null): number;
241
+ /**
242
+ * Get the display price from a product.
243
+ * Prefers quote-aware price_info, then plain price fields.
244
+ *
245
+ * @param product - Product with price data
246
+ * @returns The final price to display
247
+ *
248
+ * @example
249
+ * const price = getDisplayPrice(product);
250
+ * console.log(formatPrice(price, 'GHS')); // "GH₵29.99"
251
+ */
252
+ declare function getDisplayPrice(product: ProductWithPrice): number;
253
+ /**
254
+ * Get the base price from a product (before markup/discount)
255
+ *
256
+ * @param product - Product with price data
257
+ * @returns The base price before adjustments
258
+ */
259
+ declare function getBasePrice(product: ProductWithPrice): number;
260
+ /**
261
+ * Check if a product is on sale (discounted)
262
+ *
263
+ * @param product - Product with price data
264
+ * @returns True if the final price is less than the base price
265
+ *
266
+ * @example
267
+ * if (isOnSale(product)) {
268
+ * return <Badge>Sale!</Badge>;
269
+ * }
270
+ */
271
+ declare function isOnSale(product: ProductWithPrice): boolean;
272
+ /**
273
+ * Get the discount percentage for a product on sale
274
+ *
275
+ * @param product - Product with price data
276
+ * @returns Discount percentage (0-100), or 0 if not on sale
277
+ *
278
+ * @example
279
+ * const discount = getDiscountPercentage(product);
280
+ * if (discount > 0) {
281
+ * return <Badge>{discount}% OFF</Badge>;
282
+ * }
283
+ */
284
+ declare function getDiscountPercentage(product: ProductWithPrice): number;
285
+ /**
286
+ * Get the markup percentage for a product
287
+ *
288
+ * @param product - Product with price data
289
+ * @returns Markup percentage, or 0 if no markup
290
+ */
291
+ declare function getMarkupPercentage(product: ProductWithPrice): number;
292
+ /**
293
+ * Get the currency for a product
294
+ *
295
+ * @param product - Product with price data
296
+ * @returns Currency code (default: "GHS")
297
+ */
298
+ declare function getProductCurrency(product: ProductWithPrice): string;
299
+ /**
300
+ * Format a product's display price
301
+ * Convenience function combining getDisplayPrice and formatPrice
302
+ *
303
+ * @param product - Product with price data
304
+ * @param locale - BCP 47 locale string (default: "en-US")
305
+ * @returns Formatted price string
306
+ *
307
+ * @example
308
+ * <span>{formatProductPrice(product)}</span> // "GH₵29.99"
309
+ */
310
+ declare function formatProductPrice(product: ProductWithPrice, locale?: string): string;
311
+
312
+ /**
313
+ * Categorize payment errors into user-friendly messages
314
+ */
315
+ declare function categorizePaymentError(error: Error, errorCode?: string): PaymentErrorDetails;
316
+ /**
317
+ * Normalize payment response from different formats into a standard PaymentResponse
318
+ */
319
+ declare function normalizePaymentResponse(response: unknown): PaymentResponse;
320
+ declare function isPaymentStatusSuccess(status: string | undefined): boolean;
321
+ declare function isPaymentStatusFailure(status: string | undefined): boolean;
322
+ declare function isPaymentStatusRequiresAction(status: string | undefined): boolean;
323
+ /**
324
+ * Normalize payment status response into a standard format
325
+ */
326
+ declare function normalizeStatusResponse(response: unknown): PaymentStatusResponse;
327
+ /** Mobile money provider display names */
328
+ declare const MOBILE_MONEY_PROVIDERS: {
329
+ readonly mtn: {
330
+ readonly name: "MTN Mobile Money";
331
+ readonly prefix: readonly ["024", "054", "055", "059"];
332
+ };
333
+ readonly vodafone: {
334
+ readonly name: "Vodafone Cash";
335
+ readonly prefix: readonly ["020", "050"];
336
+ };
337
+ readonly airtel: {
338
+ readonly name: "AirtelTigo Money";
339
+ readonly prefix: readonly ["027", "057", "026", "056"];
340
+ };
341
+ };
342
+ /**
343
+ * Detect mobile money provider from phone number
344
+ */
345
+ declare function detectMobileMoneyProvider(phoneNumber: string): "mtn" | "vodafone" | "airtel" | null;
346
+
347
+ /** Context sent with every request to scope operations to a specific location/branch */
348
+ interface FrontendContext {
349
+ location_id?: string;
350
+ }
351
+ /** Request body for POST /api/q */
352
+ interface QueryRequest {
353
+ query: string;
354
+ variables?: Record<string, unknown>;
355
+ cache_hint?: string;
356
+ context?: FrontendContext;
357
+ }
358
+ /** Request body for POST /api/m */
359
+ interface MutationRequest {
360
+ method: string;
361
+ args: unknown[];
362
+ context?: FrontendContext;
363
+ }
364
+ /** Response metadata */
365
+ interface ResponseMetadata {
366
+ execution_time_ms: number;
367
+ cache_hit: boolean;
368
+ }
369
+ /** Standard API response wrapper */
370
+ interface ApiResponse<T> {
371
+ success: boolean;
372
+ data?: T;
373
+ error?: ApiError;
374
+ metadata?: ResponseMetadata;
375
+ }
376
+
377
+ export { ApiError, type ApiResponse, CURRENCY_SYMBOLS, type FormatCompactOptions, type FormatPriceOptions, type FrontendContext, MOBILE_MONEY_PROVIDERS, type MutationRequest, PaymentErrorDetails, PaymentResponse, PaymentStatusResponse, type PriceInfo, type ProductWithPrice, QueryBuilder, type QueryRequest, type ResponseMetadata, type TaxComponent, type TaxInfo, categorizePaymentError, detectMobileMoneyProvider, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, isOnSale, isPaymentStatusFailure, isPaymentStatusRequiresAction, isPaymentStatusSuccess, normalizePaymentResponse, normalizeStatusResponse, parsePrice, query };
@@ -0,0 +1,132 @@
1
+ import { eJ as AdSlot, eK as AdPosition, eO as AdContextValue, C as CimplifyClient, a2 as ProcessCheckoutResult, a4 as CheckoutStatus, a5 as CheckoutStatusContext, y as CimplifyElements, J as ElementsOptions, eD as AuthenticatedData, ez as AddressInfo, eA as PaymentMethodInfo, eF as ElementsCheckoutResult, a1 as ProcessCheckoutOptions } from './ads-CmO7VVPP.mjs';
2
+ export { eM as AdConfig } from './ads-CmO7VVPP.mjs';
3
+ import React, { ReactNode } from 'react';
4
+
5
+ interface UserIdentity {
6
+ uid: string;
7
+ isAuthenticated: boolean;
8
+ fingerprint: string;
9
+ signals: DeviceSignals;
10
+ }
11
+ interface DeviceSignals {
12
+ userAgent: string;
13
+ language: string;
14
+ languages: string[];
15
+ platform: string;
16
+ screenWidth: number;
17
+ screenHeight: number;
18
+ colorDepth: number;
19
+ pixelRatio: number;
20
+ timezone: string;
21
+ timezoneOffset: number;
22
+ touchSupport: boolean;
23
+ cookiesEnabled: boolean;
24
+ doNotTrack: boolean;
25
+ }
26
+
27
+ interface AdContextValueExtended extends AdContextValue {
28
+ identity: UserIdentity | null;
29
+ apiBase: string;
30
+ }
31
+ declare function useAds(): AdContextValueExtended;
32
+ interface AdProviderProps {
33
+ siteId: string;
34
+ apiBase?: string;
35
+ authenticatedAccountId?: string;
36
+ children: ReactNode;
37
+ }
38
+ declare function AdProvider({ siteId, apiBase, authenticatedAccountId, children, }: AdProviderProps): React.ReactElement;
39
+ interface AdProps {
40
+ slot: AdSlot;
41
+ position?: AdPosition;
42
+ className?: string;
43
+ style?: React.CSSProperties;
44
+ fallback?: ReactNode;
45
+ onImpression?: (adId: string) => void;
46
+ onClick?: (adId: string) => void;
47
+ }
48
+ declare function Ad({ slot, position, className, style, fallback, onImpression, onClick, }: AdProps): React.ReactElement | null;
49
+
50
+ type CheckoutOrderType = "pickup" | "delivery" | "dine_in";
51
+ interface CimplifyCheckoutProps {
52
+ client: CimplifyClient;
53
+ businessId: string;
54
+ cartId: string;
55
+ locationId?: string;
56
+ orderTypes?: CheckoutOrderType[];
57
+ enrollInLink?: boolean;
58
+ onComplete: (result: ProcessCheckoutResult) => void;
59
+ onError?: (error: {
60
+ code: string;
61
+ message: string;
62
+ }) => void;
63
+ onStatusChange?: (status: CheckoutStatus, context: CheckoutStatusContext) => void;
64
+ appearance?: {
65
+ theme?: "light" | "dark";
66
+ variables?: {
67
+ primaryColor?: string;
68
+ fontFamily?: string;
69
+ borderRadius?: string;
70
+ };
71
+ };
72
+ className?: string;
73
+ }
74
+ declare function CimplifyCheckout({ client, businessId, cartId, locationId, orderTypes, enrollInLink, onComplete, onError, onStatusChange, appearance, className, }: CimplifyCheckoutProps): React.ReactElement;
75
+
76
+ declare function useElements(): CimplifyElements | null;
77
+ declare function useElementsReady(): boolean;
78
+ interface ElementsProviderProps {
79
+ client: CimplifyClient;
80
+ businessId: string;
81
+ options?: ElementsOptions;
82
+ children: ReactNode;
83
+ }
84
+ declare function ElementsProvider({ client, businessId, options, children, }: ElementsProviderProps): React.ReactElement;
85
+ interface BaseElementProps {
86
+ className?: string;
87
+ style?: React.CSSProperties;
88
+ onReady?: () => void;
89
+ onError?: (error: {
90
+ code: string;
91
+ message: string;
92
+ }) => void;
93
+ }
94
+ interface AuthElementProps extends BaseElementProps {
95
+ prefillEmail?: string;
96
+ onAuthenticated?: (data: AuthenticatedData) => void;
97
+ onRequiresOtp?: (data: {
98
+ contactMasked: string;
99
+ }) => void;
100
+ }
101
+ declare function AuthElement({ className, style, prefillEmail, onReady, onAuthenticated, onRequiresOtp, onError, }: AuthElementProps): React.ReactElement | null;
102
+ interface AddressElementProps extends BaseElementProps {
103
+ mode?: "shipping" | "billing";
104
+ onChange?: (data: {
105
+ address: AddressInfo;
106
+ saveToLink: boolean;
107
+ }) => void;
108
+ }
109
+ declare function AddressElement({ className, style, mode, onReady, onChange, onError, }: AddressElementProps): React.ReactElement | null;
110
+ interface PaymentElementProps extends BaseElementProps {
111
+ amount?: number;
112
+ currency?: string;
113
+ onChange?: (data: {
114
+ paymentMethod: PaymentMethodInfo;
115
+ saveToLink: boolean;
116
+ }) => void;
117
+ }
118
+ declare function PaymentElement({ className, style, amount, currency, onReady, onChange, onError, }: PaymentElementProps): React.ReactElement | null;
119
+ declare function useCheckout(): {
120
+ submit: (data: {
121
+ cart_id: string;
122
+ order_type?: "delivery" | "pickup" | "dine_in";
123
+ location_id?: string;
124
+ scheduled_time?: string;
125
+ tip_amount?: number;
126
+ notes?: string;
127
+ }) => Promise<ElementsCheckoutResult>;
128
+ process: (options: ProcessCheckoutOptions) => Promise<ProcessCheckoutResult>;
129
+ isLoading: boolean;
130
+ };
131
+
132
+ export { Ad, AdPosition, type AdProps, AdProvider, AdSlot, AddressElement, AuthElement, CimplifyCheckout, type CimplifyCheckoutProps, ElementsProvider, PaymentElement, useAds, useCheckout, useElements, useElementsReady };
@@ -0,0 +1,132 @@
1
+ import { eJ as AdSlot, eK as AdPosition, eO as AdContextValue, C as CimplifyClient, a2 as ProcessCheckoutResult, a4 as CheckoutStatus, a5 as CheckoutStatusContext, y as CimplifyElements, J as ElementsOptions, eD as AuthenticatedData, ez as AddressInfo, eA as PaymentMethodInfo, eF as ElementsCheckoutResult, a1 as ProcessCheckoutOptions } from './ads-CmO7VVPP.js';
2
+ export { eM as AdConfig } from './ads-CmO7VVPP.js';
3
+ import React, { ReactNode } from 'react';
4
+
5
+ interface UserIdentity {
6
+ uid: string;
7
+ isAuthenticated: boolean;
8
+ fingerprint: string;
9
+ signals: DeviceSignals;
10
+ }
11
+ interface DeviceSignals {
12
+ userAgent: string;
13
+ language: string;
14
+ languages: string[];
15
+ platform: string;
16
+ screenWidth: number;
17
+ screenHeight: number;
18
+ colorDepth: number;
19
+ pixelRatio: number;
20
+ timezone: string;
21
+ timezoneOffset: number;
22
+ touchSupport: boolean;
23
+ cookiesEnabled: boolean;
24
+ doNotTrack: boolean;
25
+ }
26
+
27
+ interface AdContextValueExtended extends AdContextValue {
28
+ identity: UserIdentity | null;
29
+ apiBase: string;
30
+ }
31
+ declare function useAds(): AdContextValueExtended;
32
+ interface AdProviderProps {
33
+ siteId: string;
34
+ apiBase?: string;
35
+ authenticatedAccountId?: string;
36
+ children: ReactNode;
37
+ }
38
+ declare function AdProvider({ siteId, apiBase, authenticatedAccountId, children, }: AdProviderProps): React.ReactElement;
39
+ interface AdProps {
40
+ slot: AdSlot;
41
+ position?: AdPosition;
42
+ className?: string;
43
+ style?: React.CSSProperties;
44
+ fallback?: ReactNode;
45
+ onImpression?: (adId: string) => void;
46
+ onClick?: (adId: string) => void;
47
+ }
48
+ declare function Ad({ slot, position, className, style, fallback, onImpression, onClick, }: AdProps): React.ReactElement | null;
49
+
50
+ type CheckoutOrderType = "pickup" | "delivery" | "dine_in";
51
+ interface CimplifyCheckoutProps {
52
+ client: CimplifyClient;
53
+ businessId: string;
54
+ cartId: string;
55
+ locationId?: string;
56
+ orderTypes?: CheckoutOrderType[];
57
+ enrollInLink?: boolean;
58
+ onComplete: (result: ProcessCheckoutResult) => void;
59
+ onError?: (error: {
60
+ code: string;
61
+ message: string;
62
+ }) => void;
63
+ onStatusChange?: (status: CheckoutStatus, context: CheckoutStatusContext) => void;
64
+ appearance?: {
65
+ theme?: "light" | "dark";
66
+ variables?: {
67
+ primaryColor?: string;
68
+ fontFamily?: string;
69
+ borderRadius?: string;
70
+ };
71
+ };
72
+ className?: string;
73
+ }
74
+ declare function CimplifyCheckout({ client, businessId, cartId, locationId, orderTypes, enrollInLink, onComplete, onError, onStatusChange, appearance, className, }: CimplifyCheckoutProps): React.ReactElement;
75
+
76
+ declare function useElements(): CimplifyElements | null;
77
+ declare function useElementsReady(): boolean;
78
+ interface ElementsProviderProps {
79
+ client: CimplifyClient;
80
+ businessId: string;
81
+ options?: ElementsOptions;
82
+ children: ReactNode;
83
+ }
84
+ declare function ElementsProvider({ client, businessId, options, children, }: ElementsProviderProps): React.ReactElement;
85
+ interface BaseElementProps {
86
+ className?: string;
87
+ style?: React.CSSProperties;
88
+ onReady?: () => void;
89
+ onError?: (error: {
90
+ code: string;
91
+ message: string;
92
+ }) => void;
93
+ }
94
+ interface AuthElementProps extends BaseElementProps {
95
+ prefillEmail?: string;
96
+ onAuthenticated?: (data: AuthenticatedData) => void;
97
+ onRequiresOtp?: (data: {
98
+ contactMasked: string;
99
+ }) => void;
100
+ }
101
+ declare function AuthElement({ className, style, prefillEmail, onReady, onAuthenticated, onRequiresOtp, onError, }: AuthElementProps): React.ReactElement | null;
102
+ interface AddressElementProps extends BaseElementProps {
103
+ mode?: "shipping" | "billing";
104
+ onChange?: (data: {
105
+ address: AddressInfo;
106
+ saveToLink: boolean;
107
+ }) => void;
108
+ }
109
+ declare function AddressElement({ className, style, mode, onReady, onChange, onError, }: AddressElementProps): React.ReactElement | null;
110
+ interface PaymentElementProps extends BaseElementProps {
111
+ amount?: number;
112
+ currency?: string;
113
+ onChange?: (data: {
114
+ paymentMethod: PaymentMethodInfo;
115
+ saveToLink: boolean;
116
+ }) => void;
117
+ }
118
+ declare function PaymentElement({ className, style, amount, currency, onReady, onChange, onError, }: PaymentElementProps): React.ReactElement | null;
119
+ declare function useCheckout(): {
120
+ submit: (data: {
121
+ cart_id: string;
122
+ order_type?: "delivery" | "pickup" | "dine_in";
123
+ location_id?: string;
124
+ scheduled_time?: string;
125
+ tip_amount?: number;
126
+ notes?: string;
127
+ }) => Promise<ElementsCheckoutResult>;
128
+ process: (options: ProcessCheckoutOptions) => Promise<ProcessCheckoutResult>;
129
+ isLoading: boolean;
130
+ };
131
+
132
+ export { Ad, AdPosition, type AdProps, AdProvider, AdSlot, AddressElement, AuthElement, CimplifyCheckout, type CimplifyCheckoutProps, ElementsProvider, PaymentElement, useAds, useCheckout, useElements, useElementsReady };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/sdk",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "Cimplify Commerce SDK for storefronts",
5
5
  "keywords": [
6
6
  "cimplify",