@cimplify/sdk 0.6.7 → 0.6.8
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 +19 -0
- package/dist/advanced.d.mts +2 -2
- package/dist/advanced.d.ts +2 -2
- package/dist/advanced.js +115 -84
- package/dist/advanced.mjs +115 -84
- package/dist/{client-B4etj3AD.d.mts → client-D4vA6FY_.d.ts} +36 -34
- package/dist/{client-CYVVuP5J.d.ts → client-FQUyv41r.d.mts} +36 -34
- package/dist/{index-DzNb32O3.d.mts → index-DaKJxoEh.d.mts} +13 -12
- package/dist/{index-BOYF-efj.d.ts → index-pztT_bcJ.d.ts} +13 -12
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +147 -89
- package/dist/index.mjs +144 -90
- package/dist/{payment-pjpfIKX8.d.mts → payment-Cu75tmUc.d.mts} +22 -7
- package/dist/{payment-pjpfIKX8.d.ts → payment-Cu75tmUc.d.ts} +22 -7
- package/dist/react.d.mts +99 -4
- package/dist/react.d.ts +99 -4
- package/dist/react.js +827 -22
- package/dist/react.mjs +822 -23
- package/dist/utils.d.mts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +76 -4
- package/dist/utils.mjs +76 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { ad as AUTHORIZATION_TYPE, ai as AUTH_MUTATION, a2 as AbortablePromise, aV as AddOn, bE as AddOnDetails, b_ as AddOnGroupDetails, aX as AddOnOption, bZ as AddOnOptionDetails, aY as AddOnOptionPrice, aW as AddOnWithOptions, c3 as AddToCartInput, dN as AddressData, ed as AddressInfo, bt as AdjustmentType, ch as AmountToPay, bA as AppliedDiscount, dY as AuthResponse, A as AuthService, m as AuthStatus, ef as AuthenticatedCustomer, eh as AuthenticatedData, dB as AvailabilityCheck, dC as AvailabilityResult, di as AvailableSlot, bz as BenefitType, dl as Booking, dc as BookingRequirementOverride, dk as BookingStatus, dm as BookingWithDetails, cB as BufferTimes, b4 as Bundle, b8 as BundleComponentData, b9 as BundleComponentInfo, b3 as BundlePriceType, b6 as BundleProduct, bJ as BundleSelectionData, bH as BundleSelectionInput, bI as BundleStoredSelection, b5 as BundleSummary, b7 as BundleWithDetails, cQ as Business, d2 as BusinessHours, cP as BusinessPreferences, B as BusinessService, d1 as BusinessSettings, cO as BusinessType, c$ as BusinessWithLocations, a6 as CHECKOUT_MODE, aj as CHECKOUT_MUTATION, a9 as CHECKOUT_STEP, af as CONTACT_TYPE, dr as CancelBookingInput, cv as CancelOrderInput, cD as CancellationPolicy, bO as Cart, bF as CartAddOn, br as CartChannel, bP as CartItem, c0 as CartItemDetails, i as CartOperations, bq as CartStatus, c5 as CartSummary, bQ as CartTotals, b as CatalogueQueries, a_ as Category, d3 as CategoryInfo, a$ as CategorySummary, o as ChangePasswordInput, dp as CheckSlotAvailabilityInput, d$ as CheckoutAddressInfo, e1 as CheckoutCustomerInfo, X as CheckoutFormData, ct 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, by as ChosenPrice, C as CimplifyClient, a as CimplifyConfig, v as CimplifyElement, u as CimplifyElements, b0 as Collection, b2 as CollectionProduct, b1 as CollectionSummary, bf as ComponentGroup, bg as ComponentGroupWithComponents, bk as ComponentPriceBreakdown, bi as ComponentSelectionInput, bc as ComponentSourceType, bd as Composite, bh as CompositeComponent, bL as CompositePriceBreakdown, bj as CompositePriceResult, ba as CompositePricingMode, bM as CompositeSelectionData, bi as CompositeSelectionInput, bK as CompositeStoredSelection, be as CompositeWithDetails, a5 as ContactType, dJ as CreateAddressInput, dL as CreateMobileMoneyInput, dE as Customer, dF as CustomerAddress, dH as CustomerLinkPreferences, dG as CustomerMobileMoney, cA as CustomerServicePreferences, an as DEFAULT_COUNTRY, am as DEFAULT_CURRENCY, ae as DEVICE_TYPE, dj as DayAvailability, cK as DepositResult, aJ as DepositType, a4 as DeviceType, aI as DigitalProductType, bB as DiscountBreakdown, bC as DiscountDetails, bT as DisplayAddOn, bU as DisplayAddOnOption, bR as DisplayCart, bS as DisplayCartItem, x as ELEMENT_TYPES, E as EVENT_TYPES, ec as ElementAppearance, em as ElementEventHandler, H as ElementEventType, z as ElementOptions, D as ElementType, ei as ElementsCheckoutData, ej as ElementsCheckoutResult, eg as ElementsCustomerInfo, y as ElementsOptions, dP as EnrollAndLinkOrderInput, dS as EnrollAndLinkOrderResult, dM as EnrollmentData, aq as Err, cg as FeeBearerType, F as FetchQuoteInput, ce as FulfillmentLink, cd as FulfillmentStatus, cc as FulfillmentType, e3 as FxQuote, e2 as FxQuoteRequest, e4 as FxRateResponse, r as FxService, dn as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, bb as GroupPricingBehavior, el as IframeToParentMessage, I as InventoryService, dD as InventorySummary, aG as InventoryType, K as KitchenOrderItem, t as KitchenOrderResult, ah as LINK_MUTATION, ag as LINK_QUERY, bN as LineConfiguration, ci as LineItem, c9 as LineType, dI as LinkData, dR as LinkEnrollResult, L as LinkService, dT as LinkSession, dQ as LinkStatusResult, s as LiteBootstrap, q as LiteService, cT as Location, cN as LocationAppointment, bn as LocationProductPrice, dA as LocationStock, cR as LocationTaxBehavior, cS as LocationTaxOverrides, cW as LocationTimeProfile, d0 as LocationWithDetails, M as MESSAGE_TYPES, ac as MOBILE_MONEY_PROVIDER, dO as MobileMoneyData, e0 as MobileMoneyDetails, a3 as MobileMoneyProvider, al as ORDER_MUTATION, a7 as ORDER_TYPE, eb as ObservabilityHooks, ap as Ok, cj as Order, c8 as OrderChannel, cs as OrderFilter, cf as OrderFulfillmentSummary, cm as OrderGroup, cq as OrderGroupDetails, cn as OrderGroupPayment, cl as OrderGroupPaymentState, cp as OrderGroupPaymentSummary, ck as OrderHistory, ca as OrderLineState, cb as OrderLineStatus, cr as OrderPaymentEvent, O as OrderQueries, co as OrderSplitDetail, c6 as OrderStatus, n as OtpResult, a8 as PAYMENT_METHOD, ak as PAYMENT_MUTATION, aa as PAYMENT_STATE, ab as PICKUP_TIME_TYPE, ek as ParentToIframeMessage, ee as PaymentMethodInfo, c7 as PaymentState, d_ as PickupTime, dZ as PickupTimeType, bm as Price, bu as PriceAdjustment, bx as PriceDecisionPath, bl as PriceEntryType, bw as PricePathTaxInfo, P as PriceQuote, bs as PriceSource, cF as PricingOverrides, $ as ProcessAndResolveOptions, Z as ProcessCheckoutOptions, _ as ProcessCheckoutResult, aL as Product, aZ as ProductAddOn, bo as ProductAvailability, dy as ProductStock, bp as ProductTimeProfile, aF as ProductType, aN as ProductVariant, aS as ProductVariantValue, aM as ProductWithDetails, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, cw as RefundOrderInput, cz as ReminderMethod, cC as ReminderSettings, e5 as RequestContext, e8 as RequestErrorEvent, dW as RequestOtpInput, e6 as RequestStartEvent, e7 as RequestSuccessEvent, dq as RescheduleBookingInput, cI as ResourceAssignment, d9 as ResourceAvailabilityException, d8 as ResourceAvailabilityRule, dd as ResourceType, ao as Result, e9 as RetryEvent, dV as RevokeAllSessionsResult, dU as RevokeSessionResult, cY as Room, aK as SalesChannel, cG as SchedulingMetadata, cJ as SchedulingResult, p as SchedulingService, S as SearchOptions, bD as SelectedAddOnOption, de as Service, d5 as ServiceAvailabilityException, ds as ServiceAvailabilityParams, dt as ServiceAvailabilityResult, d4 as ServiceAvailabilityRule, cZ as ServiceCharge, cE as ServiceNotes, cL as ServiceScheduleRequest, db as ServiceStaffRequirement, cx as ServiceStatus, df as ServiceWithStaff, ea as SessionChangeEvent, dg as Staff, cH as StaffAssignment, d7 as StaffAvailabilityException, d6 as StaffAvailabilityRule, da as StaffBookingProfile, cy as StaffRole, cM as StaffScheduleItem, dw as Stock, dx as StockLevel, du as StockOwnershipType, dv as StockStatus, c_ as StorefrontBootstrap, cX as Table, T as TableInfo, bv as TaxPathComponent, cU as TimeRange, cV as TimeRanges, dh as TimeSlot, c1 as UICart, bV as UICartBusiness, bX as UICartCustomer, bW as UICartLocation, bY as UICartPricing, c2 as UICartResponse, dK as UpdateAddressInput, c4 as UpdateCartItemInput, cu as UpdateOrderStatusInput, U as UpdateProfileInput, aP as VariantAxis, aU as VariantAxisSelection, aR as VariantAxisValue, aQ as VariantAxisWithValues, bG as VariantDetails, b$ as VariantDetailsDTO, aO as VariantDisplayAttribute, aT as VariantLocationAvailability, dz as VariantStock, aH as VariantStrategy, dX 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-
|
|
1
|
+
export { ad as AUTHORIZATION_TYPE, ai as AUTH_MUTATION, a2 as AbortablePromise, aV as AddOn, bE as AddOnDetails, b_ as AddOnGroupDetails, aX as AddOnOption, bZ as AddOnOptionDetails, aY as AddOnOptionPrice, aW as AddOnWithOptions, c3 as AddToCartInput, dN as AddressData, ed as AddressInfo, bt as AdjustmentType, ch as AmountToPay, bA as AppliedDiscount, dY as AuthResponse, A as AuthService, m as AuthStatus, ef as AuthenticatedCustomer, eh as AuthenticatedData, dB as AvailabilityCheck, dC as AvailabilityResult, di as AvailableSlot, bz as BenefitType, dl as Booking, dc as BookingRequirementOverride, dk as BookingStatus, dm as BookingWithDetails, cB as BufferTimes, b4 as Bundle, b8 as BundleComponentData, b9 as BundleComponentInfo, b3 as BundlePriceType, b6 as BundleProduct, bJ as BundleSelectionData, bH as BundleSelectionInput, bI as BundleStoredSelection, b5 as BundleSummary, b7 as BundleWithDetails, cQ as Business, d2 as BusinessHours, cP as BusinessPreferences, B as BusinessService, d1 as BusinessSettings, cO as BusinessType, c$ as BusinessWithLocations, a6 as CHECKOUT_MODE, aj as CHECKOUT_MUTATION, a9 as CHECKOUT_STEP, af as CONTACT_TYPE, dr as CancelBookingInput, cv as CancelOrderInput, cD as CancellationPolicy, bO as Cart, bF as CartAddOn, br as CartChannel, bP as CartItem, c0 as CartItemDetails, i as CartOperations, bq as CartStatus, c5 as CartSummary, bQ as CartTotals, b as CatalogueQueries, a_ as Category, d3 as CategoryInfo, a$ as CategorySummary, o as ChangePasswordInput, dp as CheckSlotAvailabilityInput, d$ as CheckoutAddressInfo, e1 as CheckoutCustomerInfo, X as CheckoutFormData, ct 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, by as ChosenPrice, C as CimplifyClient, a as CimplifyConfig, v as CimplifyElement, u as CimplifyElements, b0 as Collection, b2 as CollectionProduct, b1 as CollectionSummary, bf as ComponentGroup, bg as ComponentGroupWithComponents, bk as ComponentPriceBreakdown, bi as ComponentSelectionInput, bc as ComponentSourceType, bd as Composite, bh as CompositeComponent, bL as CompositePriceBreakdown, bj as CompositePriceResult, ba as CompositePricingMode, bM as CompositeSelectionData, bi as CompositeSelectionInput, bK as CompositeStoredSelection, be as CompositeWithDetails, a5 as ContactType, dJ as CreateAddressInput, dL as CreateMobileMoneyInput, dE as Customer, dF as CustomerAddress, dH as CustomerLinkPreferences, dG as CustomerMobileMoney, cA as CustomerServicePreferences, an as DEFAULT_COUNTRY, am as DEFAULT_CURRENCY, ae as DEVICE_TYPE, dj as DayAvailability, cK as DepositResult, aJ as DepositType, a4 as DeviceType, aI as DigitalProductType, bB as DiscountBreakdown, bC as DiscountDetails, bT as DisplayAddOn, bU as DisplayAddOnOption, bR as DisplayCart, bS as DisplayCartItem, x as ELEMENT_TYPES, E as EVENT_TYPES, ec as ElementAppearance, em as ElementEventHandler, H as ElementEventType, z as ElementOptions, D as ElementType, ei as ElementsCheckoutData, ej as ElementsCheckoutResult, eg as ElementsCustomerInfo, y as ElementsOptions, dP as EnrollAndLinkOrderInput, dS as EnrollAndLinkOrderResult, dM as EnrollmentData, aq as Err, cg as FeeBearerType, F as FetchQuoteInput, ce as FulfillmentLink, cd as FulfillmentStatus, cc as FulfillmentType, e3 as FxQuote, e2 as FxQuoteRequest, e4 as FxRateResponse, r as FxService, dn as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, bb as GroupPricingBehavior, el as IframeToParentMessage, I as InventoryService, dD as InventorySummary, aG as InventoryType, K as KitchenOrderItem, t as KitchenOrderResult, ah as LINK_MUTATION, ag as LINK_QUERY, bN as LineConfiguration, ci as LineItem, c9 as LineType, dI as LinkData, dR as LinkEnrollResult, L as LinkService, dT as LinkSession, dQ as LinkStatusResult, s as LiteBootstrap, q as LiteService, cT as Location, cN as LocationAppointment, bn as LocationProductPrice, dA as LocationStock, cR as LocationTaxBehavior, cS as LocationTaxOverrides, cW as LocationTimeProfile, d0 as LocationWithDetails, M as MESSAGE_TYPES, ac as MOBILE_MONEY_PROVIDER, dO as MobileMoneyData, e0 as MobileMoneyDetails, a3 as MobileMoneyProvider, al as ORDER_MUTATION, a7 as ORDER_TYPE, eb as ObservabilityHooks, ap as Ok, cj as Order, c8 as OrderChannel, cs as OrderFilter, cf as OrderFulfillmentSummary, cm as OrderGroup, cq as OrderGroupDetails, cn as OrderGroupPayment, cl as OrderGroupPaymentState, cp as OrderGroupPaymentSummary, ck as OrderHistory, ca as OrderLineState, cb as OrderLineStatus, cr as OrderPaymentEvent, O as OrderQueries, co as OrderSplitDetail, c6 as OrderStatus, n as OtpResult, a8 as PAYMENT_METHOD, ak as PAYMENT_MUTATION, aa as PAYMENT_STATE, ab as PICKUP_TIME_TYPE, ek as ParentToIframeMessage, ee as PaymentMethodInfo, c7 as PaymentState, d_ as PickupTime, dZ as PickupTimeType, bm as Price, bu as PriceAdjustment, bx as PriceDecisionPath, bl as PriceEntryType, bw as PricePathTaxInfo, P as PriceQuote, bs as PriceSource, cF as PricingOverrides, $ as ProcessAndResolveOptions, Z as ProcessCheckoutOptions, _ as ProcessCheckoutResult, aL as Product, aZ as ProductAddOn, bo as ProductAvailability, dy as ProductStock, bp as ProductTimeProfile, aF as ProductType, aN as ProductVariant, aS as ProductVariantValue, aM as ProductWithDetails, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, cw as RefundOrderInput, cz as ReminderMethod, cC as ReminderSettings, e5 as RequestContext, e8 as RequestErrorEvent, dW as RequestOtpInput, e6 as RequestStartEvent, e7 as RequestSuccessEvent, dq as RescheduleBookingInput, cI as ResourceAssignment, d9 as ResourceAvailabilityException, d8 as ResourceAvailabilityRule, dd as ResourceType, ao as Result, e9 as RetryEvent, dV as RevokeAllSessionsResult, dU as RevokeSessionResult, cY as Room, aK as SalesChannel, cG as SchedulingMetadata, cJ as SchedulingResult, p as SchedulingService, S as SearchOptions, bD as SelectedAddOnOption, de as Service, d5 as ServiceAvailabilityException, ds as ServiceAvailabilityParams, dt as ServiceAvailabilityResult, d4 as ServiceAvailabilityRule, cZ as ServiceCharge, cE as ServiceNotes, cL as ServiceScheduleRequest, db as ServiceStaffRequirement, cx as ServiceStatus, df as ServiceWithStaff, ea as SessionChangeEvent, dg as Staff, cH as StaffAssignment, d7 as StaffAvailabilityException, d6 as StaffAvailabilityRule, da as StaffBookingProfile, cy as StaffRole, cM as StaffScheduleItem, dw as Stock, dx as StockLevel, du as StockOwnershipType, dv as StockStatus, c_ as StorefrontBootstrap, cX as Table, T as TableInfo, bv as TaxPathComponent, cU as TimeRange, cV as TimeRanges, dh as TimeSlot, c1 as UICart, bV as UICartBusiness, bX as UICartCustomer, bW as UICartLocation, bY as UICartPricing, c2 as UICartResponse, dK as UpdateAddressInput, c4 as UpdateCartItemInput, cu as UpdateOrderStatusInput, U as UpdateProfileInput, aP as VariantAxis, aU as VariantAxisSelection, aR as VariantAxisValue, aQ as VariantAxisWithValues, bG as VariantDetails, b$ as VariantDetailsDTO, aO as VariantDisplayAttribute, aT as VariantLocationAvailability, dz as VariantStock, aH as VariantStrategy, dX 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-FQUyv41r.mjs';
|
|
2
2
|
export { QueryBuilder, query } from './advanced.mjs';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
3
|
+
import { A as ApiError } from './payment-Cu75tmUc.mjs';
|
|
4
|
+
export { q as AuthorizationType, h as CimplifyError, b as Currency, C as CurrencyCode, g as ERROR_HINTS, E as ErrorCode, e as ErrorCodeType, f as ErrorHint, I as InitializePaymentResult, M as Money, d as Pagination, P as PaginationParams, t as Payment, w as PaymentErrorDetails, s as PaymentMethod, p as PaymentMethodType, r as PaymentProcessingState, o as PaymentProvider, u as PaymentResponse, n as PaymentStatus, v as PaymentStatusResponse, S as SubmitAuthorizationInput, 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-Cu75tmUc.mjs';
|
|
5
|
+
export { C as CURRENCY_SYMBOLS, x as FormatCompactOptions, F as FormatPriceOptions, M as MOBILE_MONEY_PROVIDERS, P as PriceInfo, w as ProductWithPrice, T as TaxComponent, v as TaxInfo, n as categorizePaymentError, u as detectMobileMoneyProvider, c as formatMoney, d as formatNumberCompact, f as formatPrice, a as formatPriceAdjustment, b as formatPriceCompact, e as formatProductPrice, i as getBasePrice, g as getCurrencySymbol, k as getDiscountPercentage, h as getDisplayPrice, l as getMarkupPercentage, m as getProductCurrency, j as isOnSale, r as isPaymentStatusFailure, s as isPaymentStatusRequiresAction, t as isPaymentStatusSuccess, o as normalizePaymentResponse, q as normalizeStatusResponse, p as parsePrice } from './index-DaKJxoEh.mjs';
|
|
6
6
|
export { c as AdConfig, e as AdContextValue, d as AdCreative, a as AdPosition, A as AdSlot, b as AdTheme } from './ads-t3FBTU8p.mjs';
|
|
7
7
|
|
|
8
8
|
/** Context sent with every request to scope operations to a specific location/branch */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { ad as AUTHORIZATION_TYPE, ai as AUTH_MUTATION, a2 as AbortablePromise, aV as AddOn, bE as AddOnDetails, b_ as AddOnGroupDetails, aX as AddOnOption, bZ as AddOnOptionDetails, aY as AddOnOptionPrice, aW as AddOnWithOptions, c3 as AddToCartInput, dN as AddressData, ed as AddressInfo, bt as AdjustmentType, ch as AmountToPay, bA as AppliedDiscount, dY as AuthResponse, A as AuthService, m as AuthStatus, ef as AuthenticatedCustomer, eh as AuthenticatedData, dB as AvailabilityCheck, dC as AvailabilityResult, di as AvailableSlot, bz as BenefitType, dl as Booking, dc as BookingRequirementOverride, dk as BookingStatus, dm as BookingWithDetails, cB as BufferTimes, b4 as Bundle, b8 as BundleComponentData, b9 as BundleComponentInfo, b3 as BundlePriceType, b6 as BundleProduct, bJ as BundleSelectionData, bH as BundleSelectionInput, bI as BundleStoredSelection, b5 as BundleSummary, b7 as BundleWithDetails, cQ as Business, d2 as BusinessHours, cP as BusinessPreferences, B as BusinessService, d1 as BusinessSettings, cO as BusinessType, c$ as BusinessWithLocations, a6 as CHECKOUT_MODE, aj as CHECKOUT_MUTATION, a9 as CHECKOUT_STEP, af as CONTACT_TYPE, dr as CancelBookingInput, cv as CancelOrderInput, cD as CancellationPolicy, bO as Cart, bF as CartAddOn, br as CartChannel, bP as CartItem, c0 as CartItemDetails, i as CartOperations, bq as CartStatus, c5 as CartSummary, bQ as CartTotals, b as CatalogueQueries, a_ as Category, d3 as CategoryInfo, a$ as CategorySummary, o as ChangePasswordInput, dp as CheckSlotAvailabilityInput, d$ as CheckoutAddressInfo, e1 as CheckoutCustomerInfo, X as CheckoutFormData, ct 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, by as ChosenPrice, C as CimplifyClient, a as CimplifyConfig, v as CimplifyElement, u as CimplifyElements, b0 as Collection, b2 as CollectionProduct, b1 as CollectionSummary, bf as ComponentGroup, bg as ComponentGroupWithComponents, bk as ComponentPriceBreakdown, bi as ComponentSelectionInput, bc as ComponentSourceType, bd as Composite, bh as CompositeComponent, bL as CompositePriceBreakdown, bj as CompositePriceResult, ba as CompositePricingMode, bM as CompositeSelectionData, bi as CompositeSelectionInput, bK as CompositeStoredSelection, be as CompositeWithDetails, a5 as ContactType, dJ as CreateAddressInput, dL as CreateMobileMoneyInput, dE as Customer, dF as CustomerAddress, dH as CustomerLinkPreferences, dG as CustomerMobileMoney, cA as CustomerServicePreferences, an as DEFAULT_COUNTRY, am as DEFAULT_CURRENCY, ae as DEVICE_TYPE, dj as DayAvailability, cK as DepositResult, aJ as DepositType, a4 as DeviceType, aI as DigitalProductType, bB as DiscountBreakdown, bC as DiscountDetails, bT as DisplayAddOn, bU as DisplayAddOnOption, bR as DisplayCart, bS as DisplayCartItem, x as ELEMENT_TYPES, E as EVENT_TYPES, ec as ElementAppearance, em as ElementEventHandler, H as ElementEventType, z as ElementOptions, D as ElementType, ei as ElementsCheckoutData, ej as ElementsCheckoutResult, eg as ElementsCustomerInfo, y as ElementsOptions, dP as EnrollAndLinkOrderInput, dS as EnrollAndLinkOrderResult, dM as EnrollmentData, aq as Err, cg as FeeBearerType, F as FetchQuoteInput, ce as FulfillmentLink, cd as FulfillmentStatus, cc as FulfillmentType, e3 as FxQuote, e2 as FxQuoteRequest, e4 as FxRateResponse, r as FxService, dn as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, bb as GroupPricingBehavior, el as IframeToParentMessage, I as InventoryService, dD as InventorySummary, aG as InventoryType, K as KitchenOrderItem, t as KitchenOrderResult, ah as LINK_MUTATION, ag as LINK_QUERY, bN as LineConfiguration, ci as LineItem, c9 as LineType, dI as LinkData, dR as LinkEnrollResult, L as LinkService, dT as LinkSession, dQ as LinkStatusResult, s as LiteBootstrap, q as LiteService, cT as Location, cN as LocationAppointment, bn as LocationProductPrice, dA as LocationStock, cR as LocationTaxBehavior, cS as LocationTaxOverrides, cW as LocationTimeProfile, d0 as LocationWithDetails, M as MESSAGE_TYPES, ac as MOBILE_MONEY_PROVIDER, dO as MobileMoneyData, e0 as MobileMoneyDetails, a3 as MobileMoneyProvider, al as ORDER_MUTATION, a7 as ORDER_TYPE, eb as ObservabilityHooks, ap as Ok, cj as Order, c8 as OrderChannel, cs as OrderFilter, cf as OrderFulfillmentSummary, cm as OrderGroup, cq as OrderGroupDetails, cn as OrderGroupPayment, cl as OrderGroupPaymentState, cp as OrderGroupPaymentSummary, ck as OrderHistory, ca as OrderLineState, cb as OrderLineStatus, cr as OrderPaymentEvent, O as OrderQueries, co as OrderSplitDetail, c6 as OrderStatus, n as OtpResult, a8 as PAYMENT_METHOD, ak as PAYMENT_MUTATION, aa as PAYMENT_STATE, ab as PICKUP_TIME_TYPE, ek as ParentToIframeMessage, ee as PaymentMethodInfo, c7 as PaymentState, d_ as PickupTime, dZ as PickupTimeType, bm as Price, bu as PriceAdjustment, bx as PriceDecisionPath, bl as PriceEntryType, bw as PricePathTaxInfo, P as PriceQuote, bs as PriceSource, cF as PricingOverrides, $ as ProcessAndResolveOptions, Z as ProcessCheckoutOptions, _ as ProcessCheckoutResult, aL as Product, aZ as ProductAddOn, bo as ProductAvailability, dy as ProductStock, bp as ProductTimeProfile, aF as ProductType, aN as ProductVariant, aS as ProductVariantValue, aM as ProductWithDetails, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, cw as RefundOrderInput, cz as ReminderMethod, cC as ReminderSettings, e5 as RequestContext, e8 as RequestErrorEvent, dW as RequestOtpInput, e6 as RequestStartEvent, e7 as RequestSuccessEvent, dq as RescheduleBookingInput, cI as ResourceAssignment, d9 as ResourceAvailabilityException, d8 as ResourceAvailabilityRule, dd as ResourceType, ao as Result, e9 as RetryEvent, dV as RevokeAllSessionsResult, dU as RevokeSessionResult, cY as Room, aK as SalesChannel, cG as SchedulingMetadata, cJ as SchedulingResult, p as SchedulingService, S as SearchOptions, bD as SelectedAddOnOption, de as Service, d5 as ServiceAvailabilityException, ds as ServiceAvailabilityParams, dt as ServiceAvailabilityResult, d4 as ServiceAvailabilityRule, cZ as ServiceCharge, cE as ServiceNotes, cL as ServiceScheduleRequest, db as ServiceStaffRequirement, cx as ServiceStatus, df as ServiceWithStaff, ea as SessionChangeEvent, dg as Staff, cH as StaffAssignment, d7 as StaffAvailabilityException, d6 as StaffAvailabilityRule, da as StaffBookingProfile, cy as StaffRole, cM as StaffScheduleItem, dw as Stock, dx as StockLevel, du as StockOwnershipType, dv as StockStatus, c_ as StorefrontBootstrap, cX as Table, T as TableInfo, bv as TaxPathComponent, cU as TimeRange, cV as TimeRanges, dh as TimeSlot, c1 as UICart, bV as UICartBusiness, bX as UICartCustomer, bW as UICartLocation, bY as UICartPricing, c2 as UICartResponse, dK as UpdateAddressInput, c4 as UpdateCartItemInput, cu as UpdateOrderStatusInput, U as UpdateProfileInput, aP as VariantAxis, aU as VariantAxisSelection, aR as VariantAxisValue, aQ as VariantAxisWithValues, bG as VariantDetails, b$ as VariantDetailsDTO, aO as VariantDisplayAttribute, aT as VariantLocationAvailability, dz as VariantStock, aH as VariantStrategy, dX 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-
|
|
1
|
+
export { ad as AUTHORIZATION_TYPE, ai as AUTH_MUTATION, a2 as AbortablePromise, aV as AddOn, bE as AddOnDetails, b_ as AddOnGroupDetails, aX as AddOnOption, bZ as AddOnOptionDetails, aY as AddOnOptionPrice, aW as AddOnWithOptions, c3 as AddToCartInput, dN as AddressData, ed as AddressInfo, bt as AdjustmentType, ch as AmountToPay, bA as AppliedDiscount, dY as AuthResponse, A as AuthService, m as AuthStatus, ef as AuthenticatedCustomer, eh as AuthenticatedData, dB as AvailabilityCheck, dC as AvailabilityResult, di as AvailableSlot, bz as BenefitType, dl as Booking, dc as BookingRequirementOverride, dk as BookingStatus, dm as BookingWithDetails, cB as BufferTimes, b4 as Bundle, b8 as BundleComponentData, b9 as BundleComponentInfo, b3 as BundlePriceType, b6 as BundleProduct, bJ as BundleSelectionData, bH as BundleSelectionInput, bI as BundleStoredSelection, b5 as BundleSummary, b7 as BundleWithDetails, cQ as Business, d2 as BusinessHours, cP as BusinessPreferences, B as BusinessService, d1 as BusinessSettings, cO as BusinessType, c$ as BusinessWithLocations, a6 as CHECKOUT_MODE, aj as CHECKOUT_MUTATION, a9 as CHECKOUT_STEP, af as CONTACT_TYPE, dr as CancelBookingInput, cv as CancelOrderInput, cD as CancellationPolicy, bO as Cart, bF as CartAddOn, br as CartChannel, bP as CartItem, c0 as CartItemDetails, i as CartOperations, bq as CartStatus, c5 as CartSummary, bQ as CartTotals, b as CatalogueQueries, a_ as Category, d3 as CategoryInfo, a$ as CategorySummary, o as ChangePasswordInput, dp as CheckSlotAvailabilityInput, d$ as CheckoutAddressInfo, e1 as CheckoutCustomerInfo, X as CheckoutFormData, ct 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, by as ChosenPrice, C as CimplifyClient, a as CimplifyConfig, v as CimplifyElement, u as CimplifyElements, b0 as Collection, b2 as CollectionProduct, b1 as CollectionSummary, bf as ComponentGroup, bg as ComponentGroupWithComponents, bk as ComponentPriceBreakdown, bi as ComponentSelectionInput, bc as ComponentSourceType, bd as Composite, bh as CompositeComponent, bL as CompositePriceBreakdown, bj as CompositePriceResult, ba as CompositePricingMode, bM as CompositeSelectionData, bi as CompositeSelectionInput, bK as CompositeStoredSelection, be as CompositeWithDetails, a5 as ContactType, dJ as CreateAddressInput, dL as CreateMobileMoneyInput, dE as Customer, dF as CustomerAddress, dH as CustomerLinkPreferences, dG as CustomerMobileMoney, cA as CustomerServicePreferences, an as DEFAULT_COUNTRY, am as DEFAULT_CURRENCY, ae as DEVICE_TYPE, dj as DayAvailability, cK as DepositResult, aJ as DepositType, a4 as DeviceType, aI as DigitalProductType, bB as DiscountBreakdown, bC as DiscountDetails, bT as DisplayAddOn, bU as DisplayAddOnOption, bR as DisplayCart, bS as DisplayCartItem, x as ELEMENT_TYPES, E as EVENT_TYPES, ec as ElementAppearance, em as ElementEventHandler, H as ElementEventType, z as ElementOptions, D as ElementType, ei as ElementsCheckoutData, ej as ElementsCheckoutResult, eg as ElementsCustomerInfo, y as ElementsOptions, dP as EnrollAndLinkOrderInput, dS as EnrollAndLinkOrderResult, dM as EnrollmentData, aq as Err, cg as FeeBearerType, F as FetchQuoteInput, ce as FulfillmentLink, cd as FulfillmentStatus, cc as FulfillmentType, e3 as FxQuote, e2 as FxQuoteRequest, e4 as FxRateResponse, r as FxService, dn as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, bb as GroupPricingBehavior, el as IframeToParentMessage, I as InventoryService, dD as InventorySummary, aG as InventoryType, K as KitchenOrderItem, t as KitchenOrderResult, ah as LINK_MUTATION, ag as LINK_QUERY, bN as LineConfiguration, ci as LineItem, c9 as LineType, dI as LinkData, dR as LinkEnrollResult, L as LinkService, dT as LinkSession, dQ as LinkStatusResult, s as LiteBootstrap, q as LiteService, cT as Location, cN as LocationAppointment, bn as LocationProductPrice, dA as LocationStock, cR as LocationTaxBehavior, cS as LocationTaxOverrides, cW as LocationTimeProfile, d0 as LocationWithDetails, M as MESSAGE_TYPES, ac as MOBILE_MONEY_PROVIDER, dO as MobileMoneyData, e0 as MobileMoneyDetails, a3 as MobileMoneyProvider, al as ORDER_MUTATION, a7 as ORDER_TYPE, eb as ObservabilityHooks, ap as Ok, cj as Order, c8 as OrderChannel, cs as OrderFilter, cf as OrderFulfillmentSummary, cm as OrderGroup, cq as OrderGroupDetails, cn as OrderGroupPayment, cl as OrderGroupPaymentState, cp as OrderGroupPaymentSummary, ck as OrderHistory, ca as OrderLineState, cb as OrderLineStatus, cr as OrderPaymentEvent, O as OrderQueries, co as OrderSplitDetail, c6 as OrderStatus, n as OtpResult, a8 as PAYMENT_METHOD, ak as PAYMENT_MUTATION, aa as PAYMENT_STATE, ab as PICKUP_TIME_TYPE, ek as ParentToIframeMessage, ee as PaymentMethodInfo, c7 as PaymentState, d_ as PickupTime, dZ as PickupTimeType, bm as Price, bu as PriceAdjustment, bx as PriceDecisionPath, bl as PriceEntryType, bw as PricePathTaxInfo, P as PriceQuote, bs as PriceSource, cF as PricingOverrides, $ as ProcessAndResolveOptions, Z as ProcessCheckoutOptions, _ as ProcessCheckoutResult, aL as Product, aZ as ProductAddOn, bo as ProductAvailability, dy as ProductStock, bp as ProductTimeProfile, aF as ProductType, aN as ProductVariant, aS as ProductVariantValue, aM as ProductWithDetails, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, cw as RefundOrderInput, cz as ReminderMethod, cC as ReminderSettings, e5 as RequestContext, e8 as RequestErrorEvent, dW as RequestOtpInput, e6 as RequestStartEvent, e7 as RequestSuccessEvent, dq as RescheduleBookingInput, cI as ResourceAssignment, d9 as ResourceAvailabilityException, d8 as ResourceAvailabilityRule, dd as ResourceType, ao as Result, e9 as RetryEvent, dV as RevokeAllSessionsResult, dU as RevokeSessionResult, cY as Room, aK as SalesChannel, cG as SchedulingMetadata, cJ as SchedulingResult, p as SchedulingService, S as SearchOptions, bD as SelectedAddOnOption, de as Service, d5 as ServiceAvailabilityException, ds as ServiceAvailabilityParams, dt as ServiceAvailabilityResult, d4 as ServiceAvailabilityRule, cZ as ServiceCharge, cE as ServiceNotes, cL as ServiceScheduleRequest, db as ServiceStaffRequirement, cx as ServiceStatus, df as ServiceWithStaff, ea as SessionChangeEvent, dg as Staff, cH as StaffAssignment, d7 as StaffAvailabilityException, d6 as StaffAvailabilityRule, da as StaffBookingProfile, cy as StaffRole, cM as StaffScheduleItem, dw as Stock, dx as StockLevel, du as StockOwnershipType, dv as StockStatus, c_ as StorefrontBootstrap, cX as Table, T as TableInfo, bv as TaxPathComponent, cU as TimeRange, cV as TimeRanges, dh as TimeSlot, c1 as UICart, bV as UICartBusiness, bX as UICartCustomer, bW as UICartLocation, bY as UICartPricing, c2 as UICartResponse, dK as UpdateAddressInput, c4 as UpdateCartItemInput, cu as UpdateOrderStatusInput, U as UpdateProfileInput, aP as VariantAxis, aU as VariantAxisSelection, aR as VariantAxisValue, aQ as VariantAxisWithValues, bG as VariantDetails, b$ as VariantDetailsDTO, aO as VariantDisplayAttribute, aT as VariantLocationAvailability, dz as VariantStock, aH as VariantStrategy, dX 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-D4vA6FY_.js';
|
|
2
2
|
export { QueryBuilder, query } from './advanced.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
3
|
+
import { A as ApiError } from './payment-Cu75tmUc.js';
|
|
4
|
+
export { q as AuthorizationType, h as CimplifyError, b as Currency, C as CurrencyCode, g as ERROR_HINTS, E as ErrorCode, e as ErrorCodeType, f as ErrorHint, I as InitializePaymentResult, M as Money, d as Pagination, P as PaginationParams, t as Payment, w as PaymentErrorDetails, s as PaymentMethod, p as PaymentMethodType, r as PaymentProcessingState, o as PaymentProvider, u as PaymentResponse, n as PaymentStatus, v as PaymentStatusResponse, S as SubmitAuthorizationInput, 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-Cu75tmUc.js';
|
|
5
|
+
export { C as CURRENCY_SYMBOLS, x as FormatCompactOptions, F as FormatPriceOptions, M as MOBILE_MONEY_PROVIDERS, P as PriceInfo, w as ProductWithPrice, T as TaxComponent, v as TaxInfo, n as categorizePaymentError, u as detectMobileMoneyProvider, c as formatMoney, d as formatNumberCompact, f as formatPrice, a as formatPriceAdjustment, b as formatPriceCompact, e as formatProductPrice, i as getBasePrice, g as getCurrencySymbol, k as getDiscountPercentage, h as getDisplayPrice, l as getMarkupPercentage, m as getProductCurrency, j as isOnSale, r as isPaymentStatusFailure, s as isPaymentStatusRequiresAction, t as isPaymentStatusSuccess, o as normalizePaymentResponse, q as normalizeStatusResponse, p as parsePrice } from './index-pztT_bcJ.js';
|
|
6
6
|
export { c as AdConfig, e as AdContextValue, d as AdCreative, a as AdPosition, A as AdSlot, b as AdTheme } from './ads-t3FBTU8p.js';
|
|
7
7
|
|
|
8
8
|
/** Context sent with every request to scope operations to a specific location/branch */
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/types/common.ts
|
|
4
|
+
function money(value) {
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
function moneyFromNumber(value) {
|
|
8
|
+
return value.toFixed(2);
|
|
9
|
+
}
|
|
10
|
+
var ZERO = "0.00";
|
|
11
|
+
function currencyCode(value) {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
4
14
|
var ErrorCode = {
|
|
5
15
|
// General
|
|
6
16
|
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
|
@@ -219,6 +229,74 @@ function combineObject(results) {
|
|
|
219
229
|
return ok(values);
|
|
220
230
|
}
|
|
221
231
|
|
|
232
|
+
// src/query/builder.ts
|
|
233
|
+
function escapeQueryValue(value) {
|
|
234
|
+
return value.replace(/'/g, "\\'");
|
|
235
|
+
}
|
|
236
|
+
var QueryBuilder = class {
|
|
237
|
+
constructor(entity) {
|
|
238
|
+
this.filters = [];
|
|
239
|
+
this.modifiers = [];
|
|
240
|
+
this.pathSegments = [];
|
|
241
|
+
this.entity = entity;
|
|
242
|
+
}
|
|
243
|
+
path(segment) {
|
|
244
|
+
this.pathSegments.push(segment);
|
|
245
|
+
return this;
|
|
246
|
+
}
|
|
247
|
+
where(field, op, value) {
|
|
248
|
+
const v = typeof value === "string" ? `'${escapeQueryValue(value)}'` : value;
|
|
249
|
+
if (op === "contains" || op === "startsWith") {
|
|
250
|
+
this.filters.push(`@.${field} ${op} ${v}`);
|
|
251
|
+
} else {
|
|
252
|
+
this.filters.push(`@.${field}${op}${v}`);
|
|
253
|
+
}
|
|
254
|
+
return this;
|
|
255
|
+
}
|
|
256
|
+
and(field, op, value) {
|
|
257
|
+
return this.where(field, op, value);
|
|
258
|
+
}
|
|
259
|
+
sort(field, order = "asc") {
|
|
260
|
+
this.modifiers.push(`sort(${field},${order})`);
|
|
261
|
+
return this;
|
|
262
|
+
}
|
|
263
|
+
limit(n) {
|
|
264
|
+
this.modifiers.push(`limit(${n})`);
|
|
265
|
+
return this;
|
|
266
|
+
}
|
|
267
|
+
offset(n) {
|
|
268
|
+
this.modifiers.push(`offset(${n})`);
|
|
269
|
+
return this;
|
|
270
|
+
}
|
|
271
|
+
count() {
|
|
272
|
+
this.modifiers.push("count");
|
|
273
|
+
return this;
|
|
274
|
+
}
|
|
275
|
+
enriched() {
|
|
276
|
+
this.modifiers.push("enriched");
|
|
277
|
+
return this;
|
|
278
|
+
}
|
|
279
|
+
build() {
|
|
280
|
+
let query2 = this.entity;
|
|
281
|
+
if (this.pathSegments.length > 0) {
|
|
282
|
+
query2 += "." + this.pathSegments.join(".");
|
|
283
|
+
}
|
|
284
|
+
if (this.filters.length > 0) {
|
|
285
|
+
query2 += `[?(${this.filters.join(" && ")})]`;
|
|
286
|
+
}
|
|
287
|
+
for (const mod of this.modifiers) {
|
|
288
|
+
query2 += `#${mod}`;
|
|
289
|
+
}
|
|
290
|
+
return query2;
|
|
291
|
+
}
|
|
292
|
+
toString() {
|
|
293
|
+
return this.build();
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
function query(entity) {
|
|
297
|
+
return new QueryBuilder(entity);
|
|
298
|
+
}
|
|
299
|
+
|
|
222
300
|
// src/catalogue.ts
|
|
223
301
|
function toCimplifyError(error) {
|
|
224
302
|
if (error instanceof CimplifyError) return enrichError(error);
|
|
@@ -299,7 +377,7 @@ var CatalogueQueries = class {
|
|
|
299
377
|
let query2 = "products";
|
|
300
378
|
const filters = [];
|
|
301
379
|
if (options?.category) {
|
|
302
|
-
filters.push(`@.category_id=='${options.category}'`);
|
|
380
|
+
filters.push(`@.category_id=='${escapeQueryValue(options.category)}'`);
|
|
303
381
|
}
|
|
304
382
|
if (options?.featured !== void 0) {
|
|
305
383
|
filters.push(`@.featured==${options.featured}`);
|
|
@@ -308,7 +386,7 @@ var CatalogueQueries = class {
|
|
|
308
386
|
filters.push(`@.in_stock==${options.in_stock}`);
|
|
309
387
|
}
|
|
310
388
|
if (options?.search) {
|
|
311
|
-
filters.push(`@.name contains '${options.search}'`);
|
|
389
|
+
filters.push(`@.name contains '${escapeQueryValue(options.search)}'`);
|
|
312
390
|
}
|
|
313
391
|
if (options?.min_price !== void 0) {
|
|
314
392
|
filters.push(`@.price>=${options.min_price}`);
|
|
@@ -339,7 +417,9 @@ var CatalogueQueries = class {
|
|
|
339
417
|
}
|
|
340
418
|
async getProductBySlug(slug) {
|
|
341
419
|
const filteredResult = await safe(
|
|
342
|
-
this.client.query(
|
|
420
|
+
this.client.query(
|
|
421
|
+
`products[?(@.slug=='${escapeQueryValue(slug)}')]`
|
|
422
|
+
)
|
|
343
423
|
);
|
|
344
424
|
if (!filteredResult.ok) return filteredResult;
|
|
345
425
|
const exactMatch = findProductBySlug(filteredResult.value, slug);
|
|
@@ -391,7 +471,7 @@ var CatalogueQueries = class {
|
|
|
391
471
|
}
|
|
392
472
|
async getCategoryBySlug(slug) {
|
|
393
473
|
const result = await safe(
|
|
394
|
-
this.client.query(`categories[?(@.slug=='${slug}')]`)
|
|
474
|
+
this.client.query(`categories[?(@.slug=='${escapeQueryValue(slug)}')]`)
|
|
395
475
|
);
|
|
396
476
|
if (!result.ok) return result;
|
|
397
477
|
if (!result.value.length) {
|
|
@@ -400,7 +480,11 @@ var CatalogueQueries = class {
|
|
|
400
480
|
return ok(result.value[0]);
|
|
401
481
|
}
|
|
402
482
|
async getCategoryProducts(categoryId) {
|
|
403
|
-
return safe(
|
|
483
|
+
return safe(
|
|
484
|
+
this.client.query(
|
|
485
|
+
`products[?(@.category_id=='${escapeQueryValue(categoryId)}')]`
|
|
486
|
+
)
|
|
487
|
+
);
|
|
404
488
|
}
|
|
405
489
|
async getCollections() {
|
|
406
490
|
return safe(this.client.query("collections"));
|
|
@@ -410,7 +494,9 @@ var CatalogueQueries = class {
|
|
|
410
494
|
}
|
|
411
495
|
async getCollectionBySlug(slug) {
|
|
412
496
|
const result = await safe(
|
|
413
|
-
this.client.query(
|
|
497
|
+
this.client.query(
|
|
498
|
+
`collections[?(@.slug=='${escapeQueryValue(slug)}')]`
|
|
499
|
+
)
|
|
414
500
|
);
|
|
415
501
|
if (!result.ok) return result;
|
|
416
502
|
if (!result.value.length) {
|
|
@@ -423,7 +509,9 @@ var CatalogueQueries = class {
|
|
|
423
509
|
}
|
|
424
510
|
async searchCollections(query2, limit = 20) {
|
|
425
511
|
return safe(
|
|
426
|
-
this.client.query(
|
|
512
|
+
this.client.query(
|
|
513
|
+
`collections[?(@.name contains '${escapeQueryValue(query2)}')]#limit(${limit})`
|
|
514
|
+
)
|
|
427
515
|
);
|
|
428
516
|
}
|
|
429
517
|
async getBundles() {
|
|
@@ -434,7 +522,9 @@ var CatalogueQueries = class {
|
|
|
434
522
|
}
|
|
435
523
|
async getBundleBySlug(slug) {
|
|
436
524
|
const result = await safe(
|
|
437
|
-
this.client.query(
|
|
525
|
+
this.client.query(
|
|
526
|
+
`bundles[?(@.slug=='${escapeQueryValue(slug)}')]`
|
|
527
|
+
)
|
|
438
528
|
);
|
|
439
529
|
if (!result.ok) return result;
|
|
440
530
|
if (!result.value.length) {
|
|
@@ -444,7 +534,9 @@ var CatalogueQueries = class {
|
|
|
444
534
|
}
|
|
445
535
|
async searchBundles(query2, limit = 20) {
|
|
446
536
|
return safe(
|
|
447
|
-
this.client.query(
|
|
537
|
+
this.client.query(
|
|
538
|
+
`bundles[?(@.name contains '${escapeQueryValue(query2)}')]#limit(${limit})`
|
|
539
|
+
)
|
|
448
540
|
);
|
|
449
541
|
}
|
|
450
542
|
async getComposites(options) {
|
|
@@ -484,9 +576,9 @@ var CatalogueQueries = class {
|
|
|
484
576
|
}
|
|
485
577
|
async search(query2, options) {
|
|
486
578
|
const limit = options?.limit ?? 20;
|
|
487
|
-
let searchQuery = `products[?(@.name contains '${query2}')]`;
|
|
579
|
+
let searchQuery = `products[?(@.name contains '${escapeQueryValue(query2)}')]`;
|
|
488
580
|
if (options?.category) {
|
|
489
|
-
searchQuery = `products[?(@.name contains '${query2}' && @.category_id=='${options.category}')]`;
|
|
581
|
+
searchQuery = `products[?(@.name contains '${escapeQueryValue(query2)}' && @.category_id=='${escapeQueryValue(options.category)}')]`;
|
|
490
582
|
}
|
|
491
583
|
searchQuery += `#limit(${limit})`;
|
|
492
584
|
return safe(this.client.query(searchQuery));
|
|
@@ -503,7 +595,7 @@ var CatalogueQueries = class {
|
|
|
503
595
|
async getMenu(options) {
|
|
504
596
|
let query2 = "menu";
|
|
505
597
|
if (options?.category) {
|
|
506
|
-
query2 = `menu[?(@.category=='${options.category}')]`;
|
|
598
|
+
query2 = `menu[?(@.category=='${escapeQueryValue(options.category)}')]`;
|
|
507
599
|
}
|
|
508
600
|
if (options?.limit) {
|
|
509
601
|
query2 += `#limit(${options.limit})`;
|
|
@@ -820,8 +912,8 @@ var CURRENCY_SYMBOLS = {
|
|
|
820
912
|
KMF: "CF",
|
|
821
913
|
BIF: "FBu"
|
|
822
914
|
};
|
|
823
|
-
function getCurrencySymbol(
|
|
824
|
-
return CURRENCY_SYMBOLS[
|
|
915
|
+
function getCurrencySymbol(currencyCode2) {
|
|
916
|
+
return CURRENCY_SYMBOLS[currencyCode2.toUpperCase()] || currencyCode2;
|
|
825
917
|
}
|
|
826
918
|
function formatNumberCompact(value, decimals = 1) {
|
|
827
919
|
const absValue = Math.abs(value);
|
|
@@ -1145,6 +1237,8 @@ function normalizeStatusResponse(response) {
|
|
|
1145
1237
|
}
|
|
1146
1238
|
const res = response;
|
|
1147
1239
|
const normalizedStatus = normalizePaymentStatusValue(res.status ?? void 0);
|
|
1240
|
+
const normalizedAmount = typeof res.amount === "string" ? money(res.amount) : typeof res.amount === "number" && Number.isFinite(res.amount) ? moneyFromNumber(res.amount) : void 0;
|
|
1241
|
+
const normalizedCurrency = typeof res.currency === "string" && res.currency.trim().length > 0 ? currencyCode(res.currency) : void 0;
|
|
1148
1242
|
const paidValue = res.paid === true;
|
|
1149
1243
|
const derivedPaid = paidValue || [
|
|
1150
1244
|
"success",
|
|
@@ -1157,8 +1251,8 @@ function normalizeStatusResponse(response) {
|
|
|
1157
1251
|
return {
|
|
1158
1252
|
status: normalizedStatus,
|
|
1159
1253
|
paid: derivedPaid,
|
|
1160
|
-
amount:
|
|
1161
|
-
currency:
|
|
1254
|
+
amount: normalizedAmount,
|
|
1255
|
+
currency: normalizedCurrency,
|
|
1162
1256
|
reference: res.reference,
|
|
1163
1257
|
message: res.message || ""
|
|
1164
1258
|
};
|
|
@@ -1865,14 +1959,17 @@ var CheckoutService = class {
|
|
|
1865
1959
|
pay_currency: data.pay_currency,
|
|
1866
1960
|
fx_quote_id: data.fx_quote_id
|
|
1867
1961
|
};
|
|
1868
|
-
const baseCurrency = (
|
|
1962
|
+
const baseCurrency = currencyCode(
|
|
1963
|
+
(cart.pricing.currency || checkoutData.pay_currency || "GHS").toUpperCase()
|
|
1964
|
+
);
|
|
1869
1965
|
const payCurrency = data.pay_currency?.trim().toUpperCase();
|
|
1966
|
+
const payCurrencyCode = payCurrency ? currencyCode(payCurrency) : void 0;
|
|
1870
1967
|
const cartTotalAmount = Number.parseFloat(cart.pricing.total_price || "0");
|
|
1871
|
-
if (
|
|
1968
|
+
if (payCurrencyCode && payCurrencyCode !== baseCurrency && !checkoutData.fx_quote_id && Number.isFinite(cartTotalAmount) && cartTotalAmount > 0) {
|
|
1872
1969
|
const fxQuoteResult = await this.client.fx.lockQuote({
|
|
1873
1970
|
from: baseCurrency,
|
|
1874
|
-
to:
|
|
1875
|
-
amount:
|
|
1971
|
+
to: payCurrencyCode,
|
|
1972
|
+
amount: cart.pricing.total_price
|
|
1876
1973
|
});
|
|
1877
1974
|
if (!fxQuoteResult.ok) {
|
|
1878
1975
|
return ok(
|
|
@@ -1883,7 +1980,7 @@ var CheckoutService = class {
|
|
|
1883
1980
|
)
|
|
1884
1981
|
);
|
|
1885
1982
|
}
|
|
1886
|
-
checkoutData.pay_currency =
|
|
1983
|
+
checkoutData.pay_currency = payCurrencyCode;
|
|
1887
1984
|
checkoutData.fx_quote_id = fxQuoteResult.value.id;
|
|
1888
1985
|
}
|
|
1889
1986
|
data.on_status_change?.("processing", {});
|
|
@@ -3373,7 +3470,7 @@ var CimplifyClient = class {
|
|
|
3373
3470
|
signal: controller.signal
|
|
3374
3471
|
});
|
|
3375
3472
|
clearTimeout(timeoutId);
|
|
3376
|
-
if (response.ok
|
|
3473
|
+
if (response.ok) {
|
|
3377
3474
|
this.hooks.onRequestSuccess?.({
|
|
3378
3475
|
...context,
|
|
3379
3476
|
status: response.status,
|
|
@@ -3381,6 +3478,21 @@ var CimplifyClient = class {
|
|
|
3381
3478
|
});
|
|
3382
3479
|
return response;
|
|
3383
3480
|
}
|
|
3481
|
+
if (response.status >= 400 && response.status < 500) {
|
|
3482
|
+
this.hooks.onRequestError?.({
|
|
3483
|
+
...context,
|
|
3484
|
+
error: new CimplifyError(
|
|
3485
|
+
`HTTP_${response.status}`,
|
|
3486
|
+
`Request failed with status ${response.status}`,
|
|
3487
|
+
false
|
|
3488
|
+
),
|
|
3489
|
+
status: response.status,
|
|
3490
|
+
durationMs: Date.now() - startTime,
|
|
3491
|
+
retryCount,
|
|
3492
|
+
retryable: false
|
|
3493
|
+
});
|
|
3494
|
+
return response;
|
|
3495
|
+
}
|
|
3384
3496
|
if (response.status >= 500 && attempt < this.maxRetries) {
|
|
3385
3497
|
retryCount++;
|
|
3386
3498
|
const delay = this.retryDelay * Math.pow(2, attempt);
|
|
@@ -3393,10 +3505,17 @@ var CimplifyClient = class {
|
|
|
3393
3505
|
await sleep(delay);
|
|
3394
3506
|
continue;
|
|
3395
3507
|
}
|
|
3396
|
-
this.hooks.
|
|
3508
|
+
this.hooks.onRequestError?.({
|
|
3397
3509
|
...context,
|
|
3510
|
+
error: new CimplifyError(
|
|
3511
|
+
"SERVER_ERROR",
|
|
3512
|
+
`Server error ${response.status} after ${retryCount} retries`,
|
|
3513
|
+
false
|
|
3514
|
+
),
|
|
3398
3515
|
status: response.status,
|
|
3399
|
-
durationMs: Date.now() - startTime
|
|
3516
|
+
durationMs: Date.now() - startTime,
|
|
3517
|
+
retryCount,
|
|
3518
|
+
retryable: false
|
|
3400
3519
|
});
|
|
3401
3520
|
return response;
|
|
3402
3521
|
} catch (error) {
|
|
@@ -3670,71 +3789,6 @@ function createCimplifyClient(config = {}) {
|
|
|
3670
3789
|
return new CimplifyClient(config);
|
|
3671
3790
|
}
|
|
3672
3791
|
|
|
3673
|
-
// src/query/builder.ts
|
|
3674
|
-
var QueryBuilder = class {
|
|
3675
|
-
constructor(entity) {
|
|
3676
|
-
this.filters = [];
|
|
3677
|
-
this.modifiers = [];
|
|
3678
|
-
this.pathSegments = [];
|
|
3679
|
-
this.entity = entity;
|
|
3680
|
-
}
|
|
3681
|
-
path(segment) {
|
|
3682
|
-
this.pathSegments.push(segment);
|
|
3683
|
-
return this;
|
|
3684
|
-
}
|
|
3685
|
-
where(field, op, value) {
|
|
3686
|
-
const v = typeof value === "string" ? `'${value}'` : value;
|
|
3687
|
-
if (op === "contains" || op === "startsWith") {
|
|
3688
|
-
this.filters.push(`@.${field} ${op} ${v}`);
|
|
3689
|
-
} else {
|
|
3690
|
-
this.filters.push(`@.${field}${op}${v}`);
|
|
3691
|
-
}
|
|
3692
|
-
return this;
|
|
3693
|
-
}
|
|
3694
|
-
and(field, op, value) {
|
|
3695
|
-
return this.where(field, op, value);
|
|
3696
|
-
}
|
|
3697
|
-
sort(field, order = "asc") {
|
|
3698
|
-
this.modifiers.push(`sort(${field},${order})`);
|
|
3699
|
-
return this;
|
|
3700
|
-
}
|
|
3701
|
-
limit(n) {
|
|
3702
|
-
this.modifiers.push(`limit(${n})`);
|
|
3703
|
-
return this;
|
|
3704
|
-
}
|
|
3705
|
-
offset(n) {
|
|
3706
|
-
this.modifiers.push(`offset(${n})`);
|
|
3707
|
-
return this;
|
|
3708
|
-
}
|
|
3709
|
-
count() {
|
|
3710
|
-
this.modifiers.push("count");
|
|
3711
|
-
return this;
|
|
3712
|
-
}
|
|
3713
|
-
enriched() {
|
|
3714
|
-
this.modifiers.push("enriched");
|
|
3715
|
-
return this;
|
|
3716
|
-
}
|
|
3717
|
-
build() {
|
|
3718
|
-
let query2 = this.entity;
|
|
3719
|
-
if (this.pathSegments.length > 0) {
|
|
3720
|
-
query2 += "." + this.pathSegments.join(".");
|
|
3721
|
-
}
|
|
3722
|
-
if (this.filters.length > 0) {
|
|
3723
|
-
query2 += `[?(${this.filters.join(" && ")})]`;
|
|
3724
|
-
}
|
|
3725
|
-
for (const mod of this.modifiers) {
|
|
3726
|
-
query2 += `#${mod}`;
|
|
3727
|
-
}
|
|
3728
|
-
return query2;
|
|
3729
|
-
}
|
|
3730
|
-
toString() {
|
|
3731
|
-
return this.build();
|
|
3732
|
-
}
|
|
3733
|
-
};
|
|
3734
|
-
function query(entity) {
|
|
3735
|
-
return new QueryBuilder(entity);
|
|
3736
|
-
}
|
|
3737
|
-
|
|
3738
3792
|
exports.AUTHORIZATION_TYPE = AUTHORIZATION_TYPE;
|
|
3739
3793
|
exports.AUTH_MUTATION = AUTH_MUTATION;
|
|
3740
3794
|
exports.AuthService = AuthService;
|
|
@@ -3777,11 +3831,13 @@ exports.PAYMENT_STATE = PAYMENT_STATE;
|
|
|
3777
3831
|
exports.PICKUP_TIME_TYPE = PICKUP_TIME_TYPE;
|
|
3778
3832
|
exports.QueryBuilder = QueryBuilder;
|
|
3779
3833
|
exports.SchedulingService = SchedulingService;
|
|
3834
|
+
exports.ZERO = ZERO;
|
|
3780
3835
|
exports.categorizePaymentError = categorizePaymentError;
|
|
3781
3836
|
exports.combine = combine;
|
|
3782
3837
|
exports.combineObject = combineObject;
|
|
3783
3838
|
exports.createCimplifyClient = createCimplifyClient;
|
|
3784
3839
|
exports.createElements = createElements;
|
|
3840
|
+
exports.currencyCode = currencyCode;
|
|
3785
3841
|
exports.detectMobileMoneyProvider = detectMobileMoneyProvider;
|
|
3786
3842
|
exports.enrichError = enrichError;
|
|
3787
3843
|
exports.err = err;
|
|
@@ -3812,6 +3868,8 @@ exports.isPaymentStatusSuccess = isPaymentStatusSuccess;
|
|
|
3812
3868
|
exports.isRetryableError = isRetryableError;
|
|
3813
3869
|
exports.mapError = mapError;
|
|
3814
3870
|
exports.mapResult = mapResult;
|
|
3871
|
+
exports.money = money;
|
|
3872
|
+
exports.moneyFromNumber = moneyFromNumber;
|
|
3815
3873
|
exports.normalizePaymentResponse = normalizePaymentResponse;
|
|
3816
3874
|
exports.normalizeStatusResponse = normalizeStatusResponse;
|
|
3817
3875
|
exports.ok = ok;
|