@cimplify/sdk 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { ad as AUTHORIZATION_TYPE, ai as AUTH_MUTATION, a2 as AbortablePromise, ck as AddressData, cM as AddressInfo, aR as AmountToPay, cv as AuthResponse, A as AuthService, m as AuthStatus, cO as AuthenticatedCustomer, cQ as AuthenticatedData, c8 as AvailabilityCheck, c9 as AvailabilityResult, bS as AvailableSlot, bV as Booking, bM as BookingRequirementOverride, bU as BookingStatus, bW as BookingWithDetails, b9 as BufferTimes, bo as Business, bC as BusinessHours, bn as BusinessPreferences, B as BusinessService, bB as BusinessSettings, bm as BusinessType, bz as BusinessWithLocations, a6 as CHECKOUT_MODE, aj as CHECKOUT_MUTATION, a9 as CHECKOUT_STEP, af as CONTACT_TYPE, b_ as CancelBookingInput, b3 as CancelOrderInput, bb as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aF as CatalogueResult, bD as CategoryInfo, o as ChangePasswordInput, bY as CheckSlotAvailabilityInput, cy as CheckoutAddressInfo, cA as CheckoutCustomerInfo, X as CheckoutFormData, b1 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, cg as CreateAddressInput, ci as CreateMobileMoneyInput, cb as Customer, cc as CustomerAddress, ce as CustomerLinkPreferences, cd as CustomerMobileMoney, b8 as CustomerServicePreferences, an as DEFAULT_COUNTRY, am as DEFAULT_CURRENCY, ae as DEVICE_TYPE, bT as DayAvailability, bi as DepositResult, a4 as DeviceType, x as ELEMENT_TYPES, E as EVENT_TYPES, cL as ElementAppearance, cV as ElementEventHandler, H as ElementEventType, z as ElementOptions, D as ElementType, cR as ElementsCheckoutData, cS as ElementsCheckoutResult, cP as ElementsCustomerInfo, y as ElementsOptions, cm as EnrollAndLinkOrderInput, cp as EnrollAndLinkOrderResult, cj as EnrollmentData, aq as Err, aQ as FeeBearerType, F as FetchQuoteInput, aO as FulfillmentLink, aN as FulfillmentStatus, aM as FulfillmentType, cC as FxQuote, cB as FxQuoteRequest, cD as FxRateResponse, r as FxService, bX as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cU as IframeToParentMessage, I as InventoryService, ca as InventorySummary, K as KitchenOrderItem, t as KitchenOrderResult, ah as LINK_MUTATION, ag as LINK_QUERY, aS as LineItem, aJ as LineType, cf as LinkData, co as LinkEnrollResult, L as LinkService, cq as LinkSession, cn as LinkStatusResult, s as LiteBootstrap, q as LiteService, br as Location, bl as LocationAppointment, c7 as LocationStock, bp as LocationTaxBehavior, bq as LocationTaxOverrides, bu as LocationTimeProfile, bA as LocationWithDetails, M as MESSAGE_TYPES, ac as MOBILE_MONEY_PROVIDER, cl as MobileMoneyData, cz as MobileMoneyDetails, a3 as MobileMoneyProvider, al as ORDER_MUTATION, a7 as ORDER_TYPE, cK as ObservabilityHooks, ap as Ok, aT as Order, aI as OrderChannel, b0 as OrderFilter, aP as OrderFulfillmentSummary, aW as OrderGroup, a_ as OrderGroupDetails, aX as OrderGroupPayment, aV as OrderGroupPaymentState, aZ as OrderGroupPaymentSummary, aU as OrderHistory, aK as OrderLineState, aL as OrderLineStatus, a$ as OrderPaymentEvent, O as OrderQueries, aY as OrderSplitDetail, aG as OrderStatus, n as OtpResult, a8 as PAYMENT_METHOD, ak as PAYMENT_MUTATION, aa as PAYMENT_STATE, ab as PICKUP_TIME_TYPE, cT as ParentToIframeMessage, cN as PaymentMethodInfo, aH as PaymentState, cx as PickupTime, cw as PickupTimeType, P as PriceQuote, bd as PricingOverrides, $ as ProcessAndResolveOptions, Z as ProcessCheckoutOptions, _ as ProcessCheckoutResult, c5 as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b4 as RefundOrderInput, b7 as ReminderMethod, ba as ReminderSettings, cE as RequestContext, cH as RequestErrorEvent, ct as RequestOtpInput, cF as RequestStartEvent, cG as RequestSuccessEvent, bZ as RescheduleBookingInput, bg as ResourceAssignment, bJ as ResourceAvailabilityException, bI as ResourceAvailabilityRule, bN as ResourceType, ao as Result, cI as RetryEvent, cs as RevokeAllSessionsResult, cr as RevokeSessionResult, bw as Room, be as SchedulingMetadata, bh as SchedulingResult, p as SchedulingService, S as SearchOptions, bO as Service, bF as ServiceAvailabilityException, b$ as ServiceAvailabilityParams, c0 as ServiceAvailabilityResult, bE as ServiceAvailabilityRule, bx as ServiceCharge, bc as ServiceNotes, bj as ServiceScheduleRequest, bL as ServiceStaffRequirement, b5 as ServiceStatus, bP as ServiceWithStaff, cJ as SessionChangeEvent, bQ as Staff, bf as StaffAssignment, bH as StaffAvailabilityException, bG as StaffAvailabilityRule, bK as StaffBookingProfile, b6 as StaffRole, bk as StaffScheduleItem, c3 as Stock, c4 as StockLevel, c1 as StockOwnershipType, c2 as StockStatus, by as StorefrontBootstrap, bv as Table, T as TableInfo, bs as TimeRange, bt as TimeRanges, bR as TimeSlot, ch as UpdateAddressInput, b2 as UpdateOrderStatusInput, U as UpdateProfileInput, c6 as VariantStock, cu 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-hccS_JMl.mjs';
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-4qOxssTq.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, ck as AddressData, cM as AddressInfo, aR as AmountToPay, cv as AuthResponse, A as AuthService, m as AuthStatus, cO as AuthenticatedCustomer, cQ as AuthenticatedData, c8 as AvailabilityCheck, c9 as AvailabilityResult, bS as AvailableSlot, bV as Booking, bM as BookingRequirementOverride, bU as BookingStatus, bW as BookingWithDetails, b9 as BufferTimes, bo as Business, bC as BusinessHours, bn as BusinessPreferences, B as BusinessService, bB as BusinessSettings, bm as BusinessType, bz as BusinessWithLocations, a6 as CHECKOUT_MODE, aj as CHECKOUT_MUTATION, a9 as CHECKOUT_STEP, af as CONTACT_TYPE, b_ as CancelBookingInput, b3 as CancelOrderInput, bb as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aF as CatalogueResult, bD as CategoryInfo, o as ChangePasswordInput, bY as CheckSlotAvailabilityInput, cy as CheckoutAddressInfo, cA as CheckoutCustomerInfo, X as CheckoutFormData, b1 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, cg as CreateAddressInput, ci as CreateMobileMoneyInput, cb as Customer, cc as CustomerAddress, ce as CustomerLinkPreferences, cd as CustomerMobileMoney, b8 as CustomerServicePreferences, an as DEFAULT_COUNTRY, am as DEFAULT_CURRENCY, ae as DEVICE_TYPE, bT as DayAvailability, bi as DepositResult, a4 as DeviceType, x as ELEMENT_TYPES, E as EVENT_TYPES, cL as ElementAppearance, cV as ElementEventHandler, H as ElementEventType, z as ElementOptions, D as ElementType, cR as ElementsCheckoutData, cS as ElementsCheckoutResult, cP as ElementsCustomerInfo, y as ElementsOptions, cm as EnrollAndLinkOrderInput, cp as EnrollAndLinkOrderResult, cj as EnrollmentData, aq as Err, aQ as FeeBearerType, F as FetchQuoteInput, aO as FulfillmentLink, aN as FulfillmentStatus, aM as FulfillmentType, cC as FxQuote, cB as FxQuoteRequest, cD as FxRateResponse, r as FxService, bX as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cU as IframeToParentMessage, I as InventoryService, ca as InventorySummary, K as KitchenOrderItem, t as KitchenOrderResult, ah as LINK_MUTATION, ag as LINK_QUERY, aS as LineItem, aJ as LineType, cf as LinkData, co as LinkEnrollResult, L as LinkService, cq as LinkSession, cn as LinkStatusResult, s as LiteBootstrap, q as LiteService, br as Location, bl as LocationAppointment, c7 as LocationStock, bp as LocationTaxBehavior, bq as LocationTaxOverrides, bu as LocationTimeProfile, bA as LocationWithDetails, M as MESSAGE_TYPES, ac as MOBILE_MONEY_PROVIDER, cl as MobileMoneyData, cz as MobileMoneyDetails, a3 as MobileMoneyProvider, al as ORDER_MUTATION, a7 as ORDER_TYPE, cK as ObservabilityHooks, ap as Ok, aT as Order, aI as OrderChannel, b0 as OrderFilter, aP as OrderFulfillmentSummary, aW as OrderGroup, a_ as OrderGroupDetails, aX as OrderGroupPayment, aV as OrderGroupPaymentState, aZ as OrderGroupPaymentSummary, aU as OrderHistory, aK as OrderLineState, aL as OrderLineStatus, a$ as OrderPaymentEvent, O as OrderQueries, aY as OrderSplitDetail, aG as OrderStatus, n as OtpResult, a8 as PAYMENT_METHOD, ak as PAYMENT_MUTATION, aa as PAYMENT_STATE, ab as PICKUP_TIME_TYPE, cT as ParentToIframeMessage, cN as PaymentMethodInfo, aH as PaymentState, cx as PickupTime, cw as PickupTimeType, P as PriceQuote, bd as PricingOverrides, $ as ProcessAndResolveOptions, Z as ProcessCheckoutOptions, _ as ProcessCheckoutResult, c5 as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b4 as RefundOrderInput, b7 as ReminderMethod, ba as ReminderSettings, cE as RequestContext, cH as RequestErrorEvent, ct as RequestOtpInput, cF as RequestStartEvent, cG as RequestSuccessEvent, bZ as RescheduleBookingInput, bg as ResourceAssignment, bJ as ResourceAvailabilityException, bI as ResourceAvailabilityRule, bN as ResourceType, ao as Result, cI as RetryEvent, cs as RevokeAllSessionsResult, cr as RevokeSessionResult, bw as Room, be as SchedulingMetadata, bh as SchedulingResult, p as SchedulingService, S as SearchOptions, bO as Service, bF as ServiceAvailabilityException, b$ as ServiceAvailabilityParams, c0 as ServiceAvailabilityResult, bE as ServiceAvailabilityRule, bx as ServiceCharge, bc as ServiceNotes, bj as ServiceScheduleRequest, bL as ServiceStaffRequirement, b5 as ServiceStatus, bP as ServiceWithStaff, cJ as SessionChangeEvent, bQ as Staff, bf as StaffAssignment, bH as StaffAvailabilityException, bG as StaffAvailabilityRule, bK as StaffBookingProfile, b6 as StaffRole, bk as StaffScheduleItem, c3 as Stock, c4 as StockLevel, c1 as StockOwnershipType, c2 as StockStatus, by as StorefrontBootstrap, bv as Table, T as TableInfo, bs as TimeRange, bt as TimeRanges, bR as TimeSlot, ch as UpdateAddressInput, b2 as UpdateOrderStatusInput, U as UpdateProfileInput, c6 as VariantStock, cu 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-CyBNao15.js';
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-Djde3IXh.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 = [];
@@ -2214,12 +2252,16 @@ var CheckoutService = class {
2214
2252
  constructor(client) {
2215
2253
  this.client = client;
2216
2254
  }
2255
+ orderTokenParam(orderId) {
2256
+ const token = this.client.getOrderToken(orderId);
2257
+ return token ? `?token=${encodeURIComponent(token)}` : "";
2258
+ }
2217
2259
  async process(data) {
2218
2260
  const checkoutData = {
2219
2261
  ...data,
2220
2262
  idempotency_key: data.idempotency_key || generateIdempotencyKey()
2221
2263
  };
2222
- return safeWithFallback3(
2264
+ const result = await safeWithFallback3(
2223
2265
  () => this.client.post("/api/v1/checkout", {
2224
2266
  checkout_data: checkoutData
2225
2267
  }),
@@ -2227,6 +2269,10 @@ var CheckoutService = class {
2227
2269
  checkout_data: checkoutData
2228
2270
  })
2229
2271
  );
2272
+ if (result.ok && result.value.bill_token) {
2273
+ this.client.setOrderToken(result.value.order_id, result.value.bill_token);
2274
+ }
2275
+ return result;
2230
2276
  }
2231
2277
  async initializePayment(orderId, method) {
2232
2278
  return safe3(
@@ -2244,15 +2290,17 @@ var CheckoutService = class {
2244
2290
  }
2245
2291
  async pollPaymentStatus(orderId) {
2246
2292
  const encodedId = encodeURIComponent(orderId);
2293
+ const tokenParam = this.orderTokenParam(orderId);
2247
2294
  return safeWithFallback3(
2248
- () => this.client.get(`/api/v1/orders/${encodedId}/payment-status`),
2295
+ () => this.client.get(`/api/v1/orders/${encodedId}/payment-status${tokenParam}`),
2249
2296
  () => this.client.call(PAYMENT_MUTATION.CHECK_STATUS, orderId)
2250
2297
  );
2251
2298
  }
2252
2299
  async updateOrderCustomer(orderId, customer) {
2253
2300
  const encodedId = encodeURIComponent(orderId);
2301
+ const tokenParam = this.orderTokenParam(orderId);
2254
2302
  return safeWithFallback3(
2255
- () => this.client.post(`/api/v1/orders/${encodedId}/customer`, customer),
2303
+ () => this.client.post(`/api/v1/orders/${encodedId}/customer${tokenParam}`, customer),
2256
2304
  () => this.client.call(ORDER_MUTATION.UPDATE_CUSTOMER, {
2257
2305
  order_id: orderId,
2258
2306
  ...customer
@@ -2395,6 +2443,10 @@ var OrderQueries = class {
2395
2443
  constructor(client) {
2396
2444
  this.client = client;
2397
2445
  }
2446
+ orderTokenParam(orderId) {
2447
+ const token = this.client.getOrderToken(orderId);
2448
+ return token ? `?token=${encodeURIComponent(token)}` : "";
2449
+ }
2398
2450
  async list(options) {
2399
2451
  let query2 = "orders";
2400
2452
  if (options?.status) {
@@ -2419,8 +2471,9 @@ var OrderQueries = class {
2419
2471
  }
2420
2472
  async get(orderId) {
2421
2473
  const encodedId = encodeURIComponent(orderId);
2474
+ const tokenParam = this.orderTokenParam(orderId);
2422
2475
  return safeWithFallback4(
2423
- () => this.client.get(`/api/v1/orders/${encodedId}`),
2476
+ () => this.client.get(`/api/v1/orders/${encodedId}${tokenParam}`),
2424
2477
  () => this.client.query(`orders.${orderId}`)
2425
2478
  );
2426
2479
  }
@@ -2432,8 +2485,9 @@ var OrderQueries = class {
2432
2485
  }
2433
2486
  async cancel(orderId, reason) {
2434
2487
  const encodedId = encodeURIComponent(orderId);
2488
+ const tokenParam = this.orderTokenParam(orderId);
2435
2489
  return safeWithFallback4(
2436
- () => this.client.post(`/api/v1/orders/${encodedId}/cancel`, {
2490
+ () => this.client.post(`/api/v1/orders/${encodedId}/cancel${tokenParam}`, {
2437
2491
  reason
2438
2492
  }),
2439
2493
  () => this.client.call("order.cancelOrder", {
@@ -3688,6 +3742,7 @@ function createElements(client, businessId, options) {
3688
3742
 
3689
3743
  // src/client.ts
3690
3744
  var ACCESS_TOKEN_STORAGE_KEY = "cimplify_access_token";
3745
+ var ORDER_TOKEN_PREFIX = "cimplify_ot_";
3691
3746
  var DEFAULT_TIMEOUT_MS = 3e4;
3692
3747
  var DEFAULT_MAX_RETRIES = 3;
3693
3748
  var DEFAULT_RETRY_DELAY_MS = 1e3;
@@ -3829,7 +3884,29 @@ var CimplifyClient = class {
3829
3884
  source: "clear"
3830
3885
  });
3831
3886
  }
3832
- /** Set the active location/branch for all subsequent requests */
3887
+ setOrderToken(orderId, token) {
3888
+ if (typeof window !== "undefined" && window.localStorage) {
3889
+ localStorage.setItem(`${ORDER_TOKEN_PREFIX}${orderId}`, token);
3890
+ }
3891
+ }
3892
+ getOrderToken(orderId) {
3893
+ if (typeof window !== "undefined" && window.localStorage) {
3894
+ return localStorage.getItem(`${ORDER_TOKEN_PREFIX}${orderId}`);
3895
+ }
3896
+ return null;
3897
+ }
3898
+ clearOrderTokens() {
3899
+ if (typeof window !== "undefined" && window.localStorage) {
3900
+ const keysToRemove = [];
3901
+ for (let i = 0; i < localStorage.length; i++) {
3902
+ const key = localStorage.key(i);
3903
+ if (key?.startsWith(ORDER_TOKEN_PREFIX)) {
3904
+ keysToRemove.push(key);
3905
+ }
3906
+ }
3907
+ keysToRemove.forEach((k) => localStorage.removeItem(k));
3908
+ }
3909
+ }
3833
3910
  setLocationId(locationId) {
3834
3911
  if (locationId) {
3835
3912
  this.context.location_id = locationId;
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 = [];
@@ -2212,12 +2250,16 @@ var CheckoutService = class {
2212
2250
  constructor(client) {
2213
2251
  this.client = client;
2214
2252
  }
2253
+ orderTokenParam(orderId) {
2254
+ const token = this.client.getOrderToken(orderId);
2255
+ return token ? `?token=${encodeURIComponent(token)}` : "";
2256
+ }
2215
2257
  async process(data) {
2216
2258
  const checkoutData = {
2217
2259
  ...data,
2218
2260
  idempotency_key: data.idempotency_key || generateIdempotencyKey()
2219
2261
  };
2220
- return safeWithFallback3(
2262
+ const result = await safeWithFallback3(
2221
2263
  () => this.client.post("/api/v1/checkout", {
2222
2264
  checkout_data: checkoutData
2223
2265
  }),
@@ -2225,6 +2267,10 @@ var CheckoutService = class {
2225
2267
  checkout_data: checkoutData
2226
2268
  })
2227
2269
  );
2270
+ if (result.ok && result.value.bill_token) {
2271
+ this.client.setOrderToken(result.value.order_id, result.value.bill_token);
2272
+ }
2273
+ return result;
2228
2274
  }
2229
2275
  async initializePayment(orderId, method) {
2230
2276
  return safe3(
@@ -2242,15 +2288,17 @@ var CheckoutService = class {
2242
2288
  }
2243
2289
  async pollPaymentStatus(orderId) {
2244
2290
  const encodedId = encodeURIComponent(orderId);
2291
+ const tokenParam = this.orderTokenParam(orderId);
2245
2292
  return safeWithFallback3(
2246
- () => this.client.get(`/api/v1/orders/${encodedId}/payment-status`),
2293
+ () => this.client.get(`/api/v1/orders/${encodedId}/payment-status${tokenParam}`),
2247
2294
  () => this.client.call(PAYMENT_MUTATION.CHECK_STATUS, orderId)
2248
2295
  );
2249
2296
  }
2250
2297
  async updateOrderCustomer(orderId, customer) {
2251
2298
  const encodedId = encodeURIComponent(orderId);
2299
+ const tokenParam = this.orderTokenParam(orderId);
2252
2300
  return safeWithFallback3(
2253
- () => this.client.post(`/api/v1/orders/${encodedId}/customer`, customer),
2301
+ () => this.client.post(`/api/v1/orders/${encodedId}/customer${tokenParam}`, customer),
2254
2302
  () => this.client.call(ORDER_MUTATION.UPDATE_CUSTOMER, {
2255
2303
  order_id: orderId,
2256
2304
  ...customer
@@ -2393,6 +2441,10 @@ var OrderQueries = class {
2393
2441
  constructor(client) {
2394
2442
  this.client = client;
2395
2443
  }
2444
+ orderTokenParam(orderId) {
2445
+ const token = this.client.getOrderToken(orderId);
2446
+ return token ? `?token=${encodeURIComponent(token)}` : "";
2447
+ }
2396
2448
  async list(options) {
2397
2449
  let query2 = "orders";
2398
2450
  if (options?.status) {
@@ -2417,8 +2469,9 @@ var OrderQueries = class {
2417
2469
  }
2418
2470
  async get(orderId) {
2419
2471
  const encodedId = encodeURIComponent(orderId);
2472
+ const tokenParam = this.orderTokenParam(orderId);
2420
2473
  return safeWithFallback4(
2421
- () => this.client.get(`/api/v1/orders/${encodedId}`),
2474
+ () => this.client.get(`/api/v1/orders/${encodedId}${tokenParam}`),
2422
2475
  () => this.client.query(`orders.${orderId}`)
2423
2476
  );
2424
2477
  }
@@ -2430,8 +2483,9 @@ var OrderQueries = class {
2430
2483
  }
2431
2484
  async cancel(orderId, reason) {
2432
2485
  const encodedId = encodeURIComponent(orderId);
2486
+ const tokenParam = this.orderTokenParam(orderId);
2433
2487
  return safeWithFallback4(
2434
- () => this.client.post(`/api/v1/orders/${encodedId}/cancel`, {
2488
+ () => this.client.post(`/api/v1/orders/${encodedId}/cancel${tokenParam}`, {
2435
2489
  reason
2436
2490
  }),
2437
2491
  () => this.client.call("order.cancelOrder", {
@@ -3686,6 +3740,7 @@ function createElements(client, businessId, options) {
3686
3740
 
3687
3741
  // src/client.ts
3688
3742
  var ACCESS_TOKEN_STORAGE_KEY = "cimplify_access_token";
3743
+ var ORDER_TOKEN_PREFIX = "cimplify_ot_";
3689
3744
  var DEFAULT_TIMEOUT_MS = 3e4;
3690
3745
  var DEFAULT_MAX_RETRIES = 3;
3691
3746
  var DEFAULT_RETRY_DELAY_MS = 1e3;
@@ -3827,7 +3882,29 @@ var CimplifyClient = class {
3827
3882
  source: "clear"
3828
3883
  });
3829
3884
  }
3830
- /** Set the active location/branch for all subsequent requests */
3885
+ setOrderToken(orderId, token) {
3886
+ if (typeof window !== "undefined" && window.localStorage) {
3887
+ localStorage.setItem(`${ORDER_TOKEN_PREFIX}${orderId}`, token);
3888
+ }
3889
+ }
3890
+ getOrderToken(orderId) {
3891
+ if (typeof window !== "undefined" && window.localStorage) {
3892
+ return localStorage.getItem(`${ORDER_TOKEN_PREFIX}${orderId}`);
3893
+ }
3894
+ return null;
3895
+ }
3896
+ clearOrderTokens() {
3897
+ if (typeof window !== "undefined" && window.localStorage) {
3898
+ const keysToRemove = [];
3899
+ for (let i = 0; i < localStorage.length; i++) {
3900
+ const key = localStorage.key(i);
3901
+ if (key?.startsWith(ORDER_TOKEN_PREFIX)) {
3902
+ keysToRemove.push(key);
3903
+ }
3904
+ }
3905
+ keysToRemove.forEach((k) => localStorage.removeItem(k));
3906
+ }
3907
+ }
3831
3908
  setLocationId(locationId) {
3832
3909
  if (locationId) {
3833
3910
  this.context.location_id = locationId;
package/dist/react.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as CimplifyClient, _ as ProcessCheckoutResult, a0 as CheckoutStatus, a1 as CheckoutStatusContext, br as Location, bo as Business, aT as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, u as CimplifyElements, y as ElementsOptions, cQ as AuthenticatedData, cM as AddressInfo, cN as PaymentMethodInfo, cS as ElementsCheckoutResult, Z as ProcessCheckoutOptions } from './client-hccS_JMl.mjs';
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-4qOxssTq.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, br as Location, bo as Business, aT as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, u as CimplifyElements, y as ElementsOptions, cQ as AuthenticatedData, cM as AddressInfo, cN as PaymentMethodInfo, cS as ElementsCheckoutResult, Z as ProcessCheckoutOptions } from './client-CyBNao15.js';
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-Djde3IXh.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';