@cimplify/sdk 0.7.3 → 0.7.4
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/advanced.d.mts +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/{client-C9aOFBo_.d.ts → client-CIvQ1ZLZ.d.ts} +4 -0
- package/dist/{client-B0f__K5x.d.mts → client-DvoI0EIX.d.mts} +4 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +33 -0
- package/dist/index.mjs +33 -0
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +33 -0
- package/dist/react.mjs +33 -0
- package/package.json +1 -1
package/dist/advanced.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, t as CimplifyElement, s as CimplifyElements, v as ELEMENT_TYPES, E as EVENT_TYPES, z as ElementEventType, x as ElementOptions, y as ElementType, w as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, o as SchedulingService, S as SearchOptions, u as createElements, k as generateIdempotencyKey } from './client-
|
|
1
|
+
export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, t as CimplifyElement, s as CimplifyElements, v as ELEMENT_TYPES, E as EVENT_TYPES, z as ElementEventType, x as ElementOptions, y as ElementType, w as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, o as SchedulingService, S as SearchOptions, u as createElements, k as generateIdempotencyKey } from './client-DvoI0EIX.mjs';
|
|
2
2
|
import './payment-CLIWNMaP.mjs';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, t as CimplifyElement, s as CimplifyElements, v as ELEMENT_TYPES, E as EVENT_TYPES, z as ElementEventType, x as ElementOptions, y as ElementType, w as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, o as SchedulingService, S as SearchOptions, u as createElements, k as generateIdempotencyKey } from './client-
|
|
1
|
+
export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, t as CimplifyElement, s as CimplifyElements, v as ELEMENT_TYPES, E as EVENT_TYPES, z as ElementEventType, x as ElementOptions, y as ElementType, w as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, o as SchedulingService, S as SearchOptions, u as createElements, k as generateIdempotencyKey } from './client-CIvQ1ZLZ.js';
|
|
2
2
|
import './payment-CLIWNMaP.js';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
|
@@ -2170,6 +2170,7 @@ declare class CimplifyClient {
|
|
|
2170
2170
|
private publicKey;
|
|
2171
2171
|
private credentials;
|
|
2172
2172
|
private accessToken;
|
|
2173
|
+
private sessionToken;
|
|
2173
2174
|
private timeout;
|
|
2174
2175
|
private maxRetries;
|
|
2175
2176
|
private retryDelay;
|
|
@@ -2216,6 +2217,9 @@ declare class CimplifyClient {
|
|
|
2216
2217
|
resolveBusinessId(): Promise<string>;
|
|
2217
2218
|
private loadAccessToken;
|
|
2218
2219
|
private saveAccessToken;
|
|
2220
|
+
private loadSessionToken;
|
|
2221
|
+
private saveSessionToken;
|
|
2222
|
+
private captureSessionToken;
|
|
2219
2223
|
private getHeaders;
|
|
2220
2224
|
private resilientFetch;
|
|
2221
2225
|
private getDedupeKey;
|
|
@@ -2170,6 +2170,7 @@ declare class CimplifyClient {
|
|
|
2170
2170
|
private publicKey;
|
|
2171
2171
|
private credentials;
|
|
2172
2172
|
private accessToken;
|
|
2173
|
+
private sessionToken;
|
|
2173
2174
|
private timeout;
|
|
2174
2175
|
private maxRetries;
|
|
2175
2176
|
private retryDelay;
|
|
@@ -2216,6 +2217,9 @@ declare class CimplifyClient {
|
|
|
2216
2217
|
resolveBusinessId(): Promise<string>;
|
|
2217
2218
|
private loadAccessToken;
|
|
2218
2219
|
private saveAccessToken;
|
|
2220
|
+
private loadSessionToken;
|
|
2221
|
+
private saveSessionToken;
|
|
2222
|
+
private captureSessionToken;
|
|
2219
2223
|
private getHeaders;
|
|
2220
2224
|
private resilientFetch;
|
|
2221
2225
|
private getDedupeKey;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { aa as AUTHORIZATION_TYPE, af as AUTH_MUTATION, $ as AbortablePromise, cc as AddressData, cE as AddressInfo, aP as AmountToPay, cn as AuthResponse, A as AuthService, m as AuthStatus, cG as AuthenticatedCustomer, cI as AuthenticatedData, c0 as AvailabilityCheck, c1 as AvailabilityResult, bF as AvailableSlot, bI as Booking, bH as BookingStatus, bJ as BookingWithDetails, b7 as BufferTimes, bm as Business, bA as BusinessHours, bl as BusinessPreferences, B as BusinessService, bz as BusinessSettings, bk as BusinessType, bx as BusinessWithLocations, a3 as CHECKOUT_MODE, ag as CHECKOUT_MUTATION, a6 as CHECKOUT_STEP, ac as CONTACT_TYPE, bQ as CancelBookingInput, bR as CancelBookingResult, b1 as CancelOrderInput, b9 as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aC as CatalogueResult, aD as CatalogueSnapshot, bB as CategoryInfo, bN as CheckSlotAvailabilityInput, bO as CheckSlotAvailabilityResult, cq as CheckoutAddressInfo, cs as CheckoutCustomerInfo, N as CheckoutFormData, a$ as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, Z as CheckoutStatus, _ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a2 as ContactType, c8 as CreateAddressInput, ca as CreateMobileMoneyInput, c3 as Customer, c4 as CustomerAddress, bL as CustomerBooking, bK as CustomerBookingServiceItem, c6 as CustomerLinkPreferences, c5 as CustomerMobileMoney, b6 as CustomerServicePreferences, ak as DEFAULT_COUNTRY, aj as DEFAULT_CURRENCY, ab as DEVICE_TYPE, bG as DayAvailability, bg as DepositResult, a1 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cD as ElementAppearance, cN as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cJ as ElementsCheckoutData, cK as ElementsCheckoutResult, cH as ElementsCustomerInfo, w as ElementsOptions, ce as EnrollAndLinkOrderInput, ch as EnrollAndLinkOrderResult, cb as EnrollmentData, an as Err, aO as FeeBearerType, F as FetchQuoteInput, aM as FulfillmentLink, aL as FulfillmentStatus, aK as FulfillmentType, cu as FxQuote, ct as FxQuoteRequest, cv as FxRateResponse, q as FxService, bM as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cM as IframeToParentMessage, I as InventoryService, c2 as InventorySummary, ae as LINK_MUTATION, ad as LINK_QUERY, aQ as LineItem, aH as LineType, c7 as LinkData, cg as LinkEnrollResult, L as LinkService, ci as LinkSession, cf as LinkStatusResult, r as LiteBootstrap, p as LiteService, bp as Location, bj as LocationAppointment, b$ as LocationStock, bn as LocationTaxBehavior, bo as LocationTaxOverrides, bs as LocationTimeProfile, by as LocationWithDetails, M as MESSAGE_TYPES, a9 as MOBILE_MONEY_PROVIDER, cd as MobileMoneyData, cr as MobileMoneyDetails, a0 as MobileMoneyProvider, ai as ORDER_MUTATION, a4 as ORDER_TYPE, cC as ObservabilityHooks, am as Ok, aR as Order, aG as OrderChannel, a_ as OrderFilter, aN as OrderFulfillmentSummary, aU as OrderGroup, aY as OrderGroupDetails, aV as OrderGroupPayment, aT as OrderGroupPaymentState, aX as OrderGroupPaymentSummary, aS as OrderHistory, aI as OrderLineState, aJ as OrderLineStatus, aZ as OrderPaymentEvent, O as OrderQueries, aW as OrderSplitDetail, aE as OrderStatus, n as OtpResult, a5 as PAYMENT_METHOD, ah as PAYMENT_MUTATION, a7 as PAYMENT_STATE, a8 as PICKUP_TIME_TYPE, cL as ParentToIframeMessage, cF as PaymentMethodInfo, aF as PaymentState, cp as PickupTime, co as PickupTimeType, P as PriceQuote, bb as PricingOverrides, Y as ProcessAndResolveOptions, W as ProcessCheckoutOptions, X as ProcessCheckoutResult, bZ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b2 as RefundOrderInput, b5 as ReminderMethod, b8 as ReminderSettings, cw as RequestContext, cz as RequestErrorEvent, cl as RequestOtpInput, cx as RequestStartEvent, cy as RequestSuccessEvent, bP as RescheduleBookingInput, bS as RescheduleBookingResult, be as ResourceAssignment, al as Result, cA as RetryEvent, ck as RevokeAllSessionsResult, cj as RevokeSessionResult, bu as Room, bc as SchedulingMetadata, bf as SchedulingResult, o as SchedulingService, S as SearchOptions, bC as Service, bT as ServiceAvailabilityParams, bU as ServiceAvailabilityResult, bv as ServiceCharge, ba as ServiceNotes, bh as ServiceScheduleRequest, b3 as ServiceStatus, cB as SessionChangeEvent, bD as Staff, bd as StaffAssignment, b4 as StaffRole, bi as StaffScheduleItem, bX as Stock, bY as StockLevel, bV as StockOwnershipType, bW as StockStatus, bw as StorefrontBootstrap, bt as Table, T as TableInfo, bq as TimeRange, br as TimeRanges, bE as TimeSlot, c9 as UpdateAddressInput, b0 as UpdateOrderStatusInput, U as UpdateProfileInput, b_ as VariantStock, cm as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, u as createElements, ap as err, au as flatMap, ay as fromPromise, k as generateIdempotencyKey, av as getOrElse, ar as isErr, aq as isOk, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './client-
|
|
1
|
+
export { aa as AUTHORIZATION_TYPE, af as AUTH_MUTATION, $ as AbortablePromise, cc as AddressData, cE as AddressInfo, aP as AmountToPay, cn as AuthResponse, A as AuthService, m as AuthStatus, cG as AuthenticatedCustomer, cI as AuthenticatedData, c0 as AvailabilityCheck, c1 as AvailabilityResult, bF as AvailableSlot, bI as Booking, bH as BookingStatus, bJ as BookingWithDetails, b7 as BufferTimes, bm as Business, bA as BusinessHours, bl as BusinessPreferences, B as BusinessService, bz as BusinessSettings, bk as BusinessType, bx as BusinessWithLocations, a3 as CHECKOUT_MODE, ag as CHECKOUT_MUTATION, a6 as CHECKOUT_STEP, ac as CONTACT_TYPE, bQ as CancelBookingInput, bR as CancelBookingResult, b1 as CancelOrderInput, b9 as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aC as CatalogueResult, aD as CatalogueSnapshot, bB as CategoryInfo, bN as CheckSlotAvailabilityInput, bO as CheckSlotAvailabilityResult, cq as CheckoutAddressInfo, cs as CheckoutCustomerInfo, N as CheckoutFormData, a$ as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, Z as CheckoutStatus, _ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a2 as ContactType, c8 as CreateAddressInput, ca as CreateMobileMoneyInput, c3 as Customer, c4 as CustomerAddress, bL as CustomerBooking, bK as CustomerBookingServiceItem, c6 as CustomerLinkPreferences, c5 as CustomerMobileMoney, b6 as CustomerServicePreferences, ak as DEFAULT_COUNTRY, aj as DEFAULT_CURRENCY, ab as DEVICE_TYPE, bG as DayAvailability, bg as DepositResult, a1 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cD as ElementAppearance, cN as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cJ as ElementsCheckoutData, cK as ElementsCheckoutResult, cH as ElementsCustomerInfo, w as ElementsOptions, ce as EnrollAndLinkOrderInput, ch as EnrollAndLinkOrderResult, cb as EnrollmentData, an as Err, aO as FeeBearerType, F as FetchQuoteInput, aM as FulfillmentLink, aL as FulfillmentStatus, aK as FulfillmentType, cu as FxQuote, ct as FxQuoteRequest, cv as FxRateResponse, q as FxService, bM as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cM as IframeToParentMessage, I as InventoryService, c2 as InventorySummary, ae as LINK_MUTATION, ad as LINK_QUERY, aQ as LineItem, aH as LineType, c7 as LinkData, cg as LinkEnrollResult, L as LinkService, ci as LinkSession, cf as LinkStatusResult, r as LiteBootstrap, p as LiteService, bp as Location, bj as LocationAppointment, b$ as LocationStock, bn as LocationTaxBehavior, bo as LocationTaxOverrides, bs as LocationTimeProfile, by as LocationWithDetails, M as MESSAGE_TYPES, a9 as MOBILE_MONEY_PROVIDER, cd as MobileMoneyData, cr as MobileMoneyDetails, a0 as MobileMoneyProvider, ai as ORDER_MUTATION, a4 as ORDER_TYPE, cC as ObservabilityHooks, am as Ok, aR as Order, aG as OrderChannel, a_ as OrderFilter, aN as OrderFulfillmentSummary, aU as OrderGroup, aY as OrderGroupDetails, aV as OrderGroupPayment, aT as OrderGroupPaymentState, aX as OrderGroupPaymentSummary, aS as OrderHistory, aI as OrderLineState, aJ as OrderLineStatus, aZ as OrderPaymentEvent, O as OrderQueries, aW as OrderSplitDetail, aE as OrderStatus, n as OtpResult, a5 as PAYMENT_METHOD, ah as PAYMENT_MUTATION, a7 as PAYMENT_STATE, a8 as PICKUP_TIME_TYPE, cL as ParentToIframeMessage, cF as PaymentMethodInfo, aF as PaymentState, cp as PickupTime, co as PickupTimeType, P as PriceQuote, bb as PricingOverrides, Y as ProcessAndResolveOptions, W as ProcessCheckoutOptions, X as ProcessCheckoutResult, bZ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b2 as RefundOrderInput, b5 as ReminderMethod, b8 as ReminderSettings, cw as RequestContext, cz as RequestErrorEvent, cl as RequestOtpInput, cx as RequestStartEvent, cy as RequestSuccessEvent, bP as RescheduleBookingInput, bS as RescheduleBookingResult, be as ResourceAssignment, al as Result, cA as RetryEvent, ck as RevokeAllSessionsResult, cj as RevokeSessionResult, bu as Room, bc as SchedulingMetadata, bf as SchedulingResult, o as SchedulingService, S as SearchOptions, bC as Service, bT as ServiceAvailabilityParams, bU as ServiceAvailabilityResult, bv as ServiceCharge, ba as ServiceNotes, bh as ServiceScheduleRequest, b3 as ServiceStatus, cB as SessionChangeEvent, bD as Staff, bd as StaffAssignment, b4 as StaffRole, bi as StaffScheduleItem, bX as Stock, bY as StockLevel, bV as StockOwnershipType, bW as StockStatus, bw as StorefrontBootstrap, bt as Table, T as TableInfo, bq as TimeRange, br as TimeRanges, bE as TimeSlot, c9 as UpdateAddressInput, b0 as UpdateOrderStatusInput, U as UpdateProfileInput, b_ as VariantStock, cm as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, u as createElements, ap as err, au as flatMap, ay as fromPromise, k as generateIdempotencyKey, av as getOrElse, ar as isErr, aq as isOk, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './client-DvoI0EIX.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 { aa as AUTHORIZATION_TYPE, af as AUTH_MUTATION, $ as AbortablePromise, cc as AddressData, cE as AddressInfo, aP as AmountToPay, cn as AuthResponse, A as AuthService, m as AuthStatus, cG as AuthenticatedCustomer, cI as AuthenticatedData, c0 as AvailabilityCheck, c1 as AvailabilityResult, bF as AvailableSlot, bI as Booking, bH as BookingStatus, bJ as BookingWithDetails, b7 as BufferTimes, bm as Business, bA as BusinessHours, bl as BusinessPreferences, B as BusinessService, bz as BusinessSettings, bk as BusinessType, bx as BusinessWithLocations, a3 as CHECKOUT_MODE, ag as CHECKOUT_MUTATION, a6 as CHECKOUT_STEP, ac as CONTACT_TYPE, bQ as CancelBookingInput, bR as CancelBookingResult, b1 as CancelOrderInput, b9 as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aC as CatalogueResult, aD as CatalogueSnapshot, bB as CategoryInfo, bN as CheckSlotAvailabilityInput, bO as CheckSlotAvailabilityResult, cq as CheckoutAddressInfo, cs as CheckoutCustomerInfo, N as CheckoutFormData, a$ as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, Z as CheckoutStatus, _ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a2 as ContactType, c8 as CreateAddressInput, ca as CreateMobileMoneyInput, c3 as Customer, c4 as CustomerAddress, bL as CustomerBooking, bK as CustomerBookingServiceItem, c6 as CustomerLinkPreferences, c5 as CustomerMobileMoney, b6 as CustomerServicePreferences, ak as DEFAULT_COUNTRY, aj as DEFAULT_CURRENCY, ab as DEVICE_TYPE, bG as DayAvailability, bg as DepositResult, a1 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cD as ElementAppearance, cN as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cJ as ElementsCheckoutData, cK as ElementsCheckoutResult, cH as ElementsCustomerInfo, w as ElementsOptions, ce as EnrollAndLinkOrderInput, ch as EnrollAndLinkOrderResult, cb as EnrollmentData, an as Err, aO as FeeBearerType, F as FetchQuoteInput, aM as FulfillmentLink, aL as FulfillmentStatus, aK as FulfillmentType, cu as FxQuote, ct as FxQuoteRequest, cv as FxRateResponse, q as FxService, bM as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cM as IframeToParentMessage, I as InventoryService, c2 as InventorySummary, ae as LINK_MUTATION, ad as LINK_QUERY, aQ as LineItem, aH as LineType, c7 as LinkData, cg as LinkEnrollResult, L as LinkService, ci as LinkSession, cf as LinkStatusResult, r as LiteBootstrap, p as LiteService, bp as Location, bj as LocationAppointment, b$ as LocationStock, bn as LocationTaxBehavior, bo as LocationTaxOverrides, bs as LocationTimeProfile, by as LocationWithDetails, M as MESSAGE_TYPES, a9 as MOBILE_MONEY_PROVIDER, cd as MobileMoneyData, cr as MobileMoneyDetails, a0 as MobileMoneyProvider, ai as ORDER_MUTATION, a4 as ORDER_TYPE, cC as ObservabilityHooks, am as Ok, aR as Order, aG as OrderChannel, a_ as OrderFilter, aN as OrderFulfillmentSummary, aU as OrderGroup, aY as OrderGroupDetails, aV as OrderGroupPayment, aT as OrderGroupPaymentState, aX as OrderGroupPaymentSummary, aS as OrderHistory, aI as OrderLineState, aJ as OrderLineStatus, aZ as OrderPaymentEvent, O as OrderQueries, aW as OrderSplitDetail, aE as OrderStatus, n as OtpResult, a5 as PAYMENT_METHOD, ah as PAYMENT_MUTATION, a7 as PAYMENT_STATE, a8 as PICKUP_TIME_TYPE, cL as ParentToIframeMessage, cF as PaymentMethodInfo, aF as PaymentState, cp as PickupTime, co as PickupTimeType, P as PriceQuote, bb as PricingOverrides, Y as ProcessAndResolveOptions, W as ProcessCheckoutOptions, X as ProcessCheckoutResult, bZ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b2 as RefundOrderInput, b5 as ReminderMethod, b8 as ReminderSettings, cw as RequestContext, cz as RequestErrorEvent, cl as RequestOtpInput, cx as RequestStartEvent, cy as RequestSuccessEvent, bP as RescheduleBookingInput, bS as RescheduleBookingResult, be as ResourceAssignment, al as Result, cA as RetryEvent, ck as RevokeAllSessionsResult, cj as RevokeSessionResult, bu as Room, bc as SchedulingMetadata, bf as SchedulingResult, o as SchedulingService, S as SearchOptions, bC as Service, bT as ServiceAvailabilityParams, bU as ServiceAvailabilityResult, bv as ServiceCharge, ba as ServiceNotes, bh as ServiceScheduleRequest, b3 as ServiceStatus, cB as SessionChangeEvent, bD as Staff, bd as StaffAssignment, b4 as StaffRole, bi as StaffScheduleItem, bX as Stock, bY as StockLevel, bV as StockOwnershipType, bW as StockStatus, bw as StorefrontBootstrap, bt as Table, T as TableInfo, bq as TimeRange, br as TimeRanges, bE as TimeSlot, c9 as UpdateAddressInput, b0 as UpdateOrderStatusInput, U as UpdateProfileInput, b_ as VariantStock, cm as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, u as createElements, ap as err, au as flatMap, ay as fromPromise, k as generateIdempotencyKey, av as getOrElse, ar as isErr, aq as isOk, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './client-
|
|
1
|
+
export { aa as AUTHORIZATION_TYPE, af as AUTH_MUTATION, $ as AbortablePromise, cc as AddressData, cE as AddressInfo, aP as AmountToPay, cn as AuthResponse, A as AuthService, m as AuthStatus, cG as AuthenticatedCustomer, cI as AuthenticatedData, c0 as AvailabilityCheck, c1 as AvailabilityResult, bF as AvailableSlot, bI as Booking, bH as BookingStatus, bJ as BookingWithDetails, b7 as BufferTimes, bm as Business, bA as BusinessHours, bl as BusinessPreferences, B as BusinessService, bz as BusinessSettings, bk as BusinessType, bx as BusinessWithLocations, a3 as CHECKOUT_MODE, ag as CHECKOUT_MUTATION, a6 as CHECKOUT_STEP, ac as CONTACT_TYPE, bQ as CancelBookingInput, bR as CancelBookingResult, b1 as CancelOrderInput, b9 as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aC as CatalogueResult, aD as CatalogueSnapshot, bB as CategoryInfo, bN as CheckSlotAvailabilityInput, bO as CheckSlotAvailabilityResult, cq as CheckoutAddressInfo, cs as CheckoutCustomerInfo, N as CheckoutFormData, a$ as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, Z as CheckoutStatus, _ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a2 as ContactType, c8 as CreateAddressInput, ca as CreateMobileMoneyInput, c3 as Customer, c4 as CustomerAddress, bL as CustomerBooking, bK as CustomerBookingServiceItem, c6 as CustomerLinkPreferences, c5 as CustomerMobileMoney, b6 as CustomerServicePreferences, ak as DEFAULT_COUNTRY, aj as DEFAULT_CURRENCY, ab as DEVICE_TYPE, bG as DayAvailability, bg as DepositResult, a1 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cD as ElementAppearance, cN as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cJ as ElementsCheckoutData, cK as ElementsCheckoutResult, cH as ElementsCustomerInfo, w as ElementsOptions, ce as EnrollAndLinkOrderInput, ch as EnrollAndLinkOrderResult, cb as EnrollmentData, an as Err, aO as FeeBearerType, F as FetchQuoteInput, aM as FulfillmentLink, aL as FulfillmentStatus, aK as FulfillmentType, cu as FxQuote, ct as FxQuoteRequest, cv as FxRateResponse, q as FxService, bM as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cM as IframeToParentMessage, I as InventoryService, c2 as InventorySummary, ae as LINK_MUTATION, ad as LINK_QUERY, aQ as LineItem, aH as LineType, c7 as LinkData, cg as LinkEnrollResult, L as LinkService, ci as LinkSession, cf as LinkStatusResult, r as LiteBootstrap, p as LiteService, bp as Location, bj as LocationAppointment, b$ as LocationStock, bn as LocationTaxBehavior, bo as LocationTaxOverrides, bs as LocationTimeProfile, by as LocationWithDetails, M as MESSAGE_TYPES, a9 as MOBILE_MONEY_PROVIDER, cd as MobileMoneyData, cr as MobileMoneyDetails, a0 as MobileMoneyProvider, ai as ORDER_MUTATION, a4 as ORDER_TYPE, cC as ObservabilityHooks, am as Ok, aR as Order, aG as OrderChannel, a_ as OrderFilter, aN as OrderFulfillmentSummary, aU as OrderGroup, aY as OrderGroupDetails, aV as OrderGroupPayment, aT as OrderGroupPaymentState, aX as OrderGroupPaymentSummary, aS as OrderHistory, aI as OrderLineState, aJ as OrderLineStatus, aZ as OrderPaymentEvent, O as OrderQueries, aW as OrderSplitDetail, aE as OrderStatus, n as OtpResult, a5 as PAYMENT_METHOD, ah as PAYMENT_MUTATION, a7 as PAYMENT_STATE, a8 as PICKUP_TIME_TYPE, cL as ParentToIframeMessage, cF as PaymentMethodInfo, aF as PaymentState, cp as PickupTime, co as PickupTimeType, P as PriceQuote, bb as PricingOverrides, Y as ProcessAndResolveOptions, W as ProcessCheckoutOptions, X as ProcessCheckoutResult, bZ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b2 as RefundOrderInput, b5 as ReminderMethod, b8 as ReminderSettings, cw as RequestContext, cz as RequestErrorEvent, cl as RequestOtpInput, cx as RequestStartEvent, cy as RequestSuccessEvent, bP as RescheduleBookingInput, bS as RescheduleBookingResult, be as ResourceAssignment, al as Result, cA as RetryEvent, ck as RevokeAllSessionsResult, cj as RevokeSessionResult, bu as Room, bc as SchedulingMetadata, bf as SchedulingResult, o as SchedulingService, S as SearchOptions, bC as Service, bT as ServiceAvailabilityParams, bU as ServiceAvailabilityResult, bv as ServiceCharge, ba as ServiceNotes, bh as ServiceScheduleRequest, b3 as ServiceStatus, cB as SessionChangeEvent, bD as Staff, bd as StaffAssignment, b4 as StaffRole, bi as StaffScheduleItem, bX as Stock, bY as StockLevel, bV as StockOwnershipType, bW as StockStatus, bw as StorefrontBootstrap, bt as Table, T as TableInfo, bq as TimeRange, br as TimeRanges, bE as TimeSlot, c9 as UpdateAddressInput, b0 as UpdateOrderStatusInput, U as UpdateProfileInput, b_ as VariantStock, cm as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, u as createElements, ap as err, au as flatMap, ay as fromPromise, k as generateIdempotencyKey, av as getOrElse, ar as isErr, aq as isOk, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './client-CIvQ1ZLZ.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
|
@@ -3187,7 +3187,9 @@ function createElements(client, businessId, options) {
|
|
|
3187
3187
|
|
|
3188
3188
|
// src/client.ts
|
|
3189
3189
|
var ACCESS_TOKEN_STORAGE_KEY = "cimplify_access_token";
|
|
3190
|
+
var SESSION_TOKEN_STORAGE_KEY = "cimplify_session_token";
|
|
3190
3191
|
var ORDER_TOKEN_PREFIX = "cimplify_ot_";
|
|
3192
|
+
var SESSION_TOKEN_HEADER = "x-session-token";
|
|
3191
3193
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
3192
3194
|
var DEFAULT_MAX_RETRIES = 3;
|
|
3193
3195
|
var DEFAULT_RETRY_DELAY_MS = 1e3;
|
|
@@ -3272,6 +3274,7 @@ function getEnvPublicKey() {
|
|
|
3272
3274
|
var CimplifyClient = class {
|
|
3273
3275
|
constructor(config = {}) {
|
|
3274
3276
|
this.accessToken = null;
|
|
3277
|
+
this.sessionToken = null;
|
|
3275
3278
|
this.context = {};
|
|
3276
3279
|
this.businessId = null;
|
|
3277
3280
|
this.businessIdResolvePromise = null;
|
|
@@ -3286,6 +3289,7 @@ var CimplifyClient = class {
|
|
|
3286
3289
|
this.retryDelay = config.retryDelay ?? DEFAULT_RETRY_DELAY_MS;
|
|
3287
3290
|
this.hooks = config.hooks ?? {};
|
|
3288
3291
|
this.accessToken = this.loadAccessToken();
|
|
3292
|
+
this.sessionToken = this.loadSessionToken();
|
|
3289
3293
|
if (!this.publicKey && !config.suppressPublicKeyWarning) {
|
|
3290
3294
|
console.warn(
|
|
3291
3295
|
'[Cimplify] No public key found. Set NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY in your environment, or pass { publicKey: "pk_..." } to createCimplifyClient().'
|
|
@@ -3322,7 +3326,11 @@ var CimplifyClient = class {
|
|
|
3322
3326
|
clearSession() {
|
|
3323
3327
|
const previous = this.accessToken;
|
|
3324
3328
|
this.accessToken = null;
|
|
3329
|
+
this.sessionToken = null;
|
|
3325
3330
|
this.saveAccessToken(null);
|
|
3331
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
3332
|
+
localStorage.removeItem(SESSION_TOKEN_STORAGE_KEY);
|
|
3333
|
+
}
|
|
3326
3334
|
this.hooks.onSessionChange?.({
|
|
3327
3335
|
previousToken: previous,
|
|
3328
3336
|
newToken: null,
|
|
@@ -3419,6 +3427,27 @@ var CimplifyClient = class {
|
|
|
3419
3427
|
}
|
|
3420
3428
|
}
|
|
3421
3429
|
}
|
|
3430
|
+
loadSessionToken() {
|
|
3431
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
3432
|
+
return localStorage.getItem(SESSION_TOKEN_STORAGE_KEY);
|
|
3433
|
+
}
|
|
3434
|
+
return null;
|
|
3435
|
+
}
|
|
3436
|
+
saveSessionToken(token) {
|
|
3437
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
3438
|
+
try {
|
|
3439
|
+
localStorage.setItem(SESSION_TOKEN_STORAGE_KEY, token);
|
|
3440
|
+
} catch {
|
|
3441
|
+
}
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
captureSessionToken(response) {
|
|
3445
|
+
const token = response.headers.get(SESSION_TOKEN_HEADER);
|
|
3446
|
+
if (token && token !== this.sessionToken) {
|
|
3447
|
+
this.sessionToken = token;
|
|
3448
|
+
this.saveSessionToken(token);
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3422
3451
|
getHeaders() {
|
|
3423
3452
|
const headers = {
|
|
3424
3453
|
"Content-Type": "application/json"
|
|
@@ -3430,6 +3459,9 @@ var CimplifyClient = class {
|
|
|
3430
3459
|
if (this.accessToken) {
|
|
3431
3460
|
headers["Authorization"] = `Bearer ${this.accessToken}`;
|
|
3432
3461
|
}
|
|
3462
|
+
if (this.sessionToken) {
|
|
3463
|
+
headers[SESSION_TOKEN_HEADER] = this.sessionToken;
|
|
3464
|
+
}
|
|
3433
3465
|
return headers;
|
|
3434
3466
|
}
|
|
3435
3467
|
async resilientFetch(url, options) {
|
|
@@ -3455,6 +3487,7 @@ var CimplifyClient = class {
|
|
|
3455
3487
|
signal: controller.signal
|
|
3456
3488
|
});
|
|
3457
3489
|
clearTimeout(timeoutId);
|
|
3490
|
+
this.captureSessionToken(response);
|
|
3458
3491
|
if (response.ok) {
|
|
3459
3492
|
this.hooks.onRequestSuccess?.({
|
|
3460
3493
|
...context,
|
package/dist/index.mjs
CHANGED
|
@@ -3185,7 +3185,9 @@ function createElements(client, businessId, options) {
|
|
|
3185
3185
|
|
|
3186
3186
|
// src/client.ts
|
|
3187
3187
|
var ACCESS_TOKEN_STORAGE_KEY = "cimplify_access_token";
|
|
3188
|
+
var SESSION_TOKEN_STORAGE_KEY = "cimplify_session_token";
|
|
3188
3189
|
var ORDER_TOKEN_PREFIX = "cimplify_ot_";
|
|
3190
|
+
var SESSION_TOKEN_HEADER = "x-session-token";
|
|
3189
3191
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
3190
3192
|
var DEFAULT_MAX_RETRIES = 3;
|
|
3191
3193
|
var DEFAULT_RETRY_DELAY_MS = 1e3;
|
|
@@ -3270,6 +3272,7 @@ function getEnvPublicKey() {
|
|
|
3270
3272
|
var CimplifyClient = class {
|
|
3271
3273
|
constructor(config = {}) {
|
|
3272
3274
|
this.accessToken = null;
|
|
3275
|
+
this.sessionToken = null;
|
|
3273
3276
|
this.context = {};
|
|
3274
3277
|
this.businessId = null;
|
|
3275
3278
|
this.businessIdResolvePromise = null;
|
|
@@ -3284,6 +3287,7 @@ var CimplifyClient = class {
|
|
|
3284
3287
|
this.retryDelay = config.retryDelay ?? DEFAULT_RETRY_DELAY_MS;
|
|
3285
3288
|
this.hooks = config.hooks ?? {};
|
|
3286
3289
|
this.accessToken = this.loadAccessToken();
|
|
3290
|
+
this.sessionToken = this.loadSessionToken();
|
|
3287
3291
|
if (!this.publicKey && !config.suppressPublicKeyWarning) {
|
|
3288
3292
|
console.warn(
|
|
3289
3293
|
'[Cimplify] No public key found. Set NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY in your environment, or pass { publicKey: "pk_..." } to createCimplifyClient().'
|
|
@@ -3320,7 +3324,11 @@ var CimplifyClient = class {
|
|
|
3320
3324
|
clearSession() {
|
|
3321
3325
|
const previous = this.accessToken;
|
|
3322
3326
|
this.accessToken = null;
|
|
3327
|
+
this.sessionToken = null;
|
|
3323
3328
|
this.saveAccessToken(null);
|
|
3329
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
3330
|
+
localStorage.removeItem(SESSION_TOKEN_STORAGE_KEY);
|
|
3331
|
+
}
|
|
3324
3332
|
this.hooks.onSessionChange?.({
|
|
3325
3333
|
previousToken: previous,
|
|
3326
3334
|
newToken: null,
|
|
@@ -3417,6 +3425,27 @@ var CimplifyClient = class {
|
|
|
3417
3425
|
}
|
|
3418
3426
|
}
|
|
3419
3427
|
}
|
|
3428
|
+
loadSessionToken() {
|
|
3429
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
3430
|
+
return localStorage.getItem(SESSION_TOKEN_STORAGE_KEY);
|
|
3431
|
+
}
|
|
3432
|
+
return null;
|
|
3433
|
+
}
|
|
3434
|
+
saveSessionToken(token) {
|
|
3435
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
3436
|
+
try {
|
|
3437
|
+
localStorage.setItem(SESSION_TOKEN_STORAGE_KEY, token);
|
|
3438
|
+
} catch {
|
|
3439
|
+
}
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
captureSessionToken(response) {
|
|
3443
|
+
const token = response.headers.get(SESSION_TOKEN_HEADER);
|
|
3444
|
+
if (token && token !== this.sessionToken) {
|
|
3445
|
+
this.sessionToken = token;
|
|
3446
|
+
this.saveSessionToken(token);
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3420
3449
|
getHeaders() {
|
|
3421
3450
|
const headers = {
|
|
3422
3451
|
"Content-Type": "application/json"
|
|
@@ -3428,6 +3457,9 @@ var CimplifyClient = class {
|
|
|
3428
3457
|
if (this.accessToken) {
|
|
3429
3458
|
headers["Authorization"] = `Bearer ${this.accessToken}`;
|
|
3430
3459
|
}
|
|
3460
|
+
if (this.sessionToken) {
|
|
3461
|
+
headers[SESSION_TOKEN_HEADER] = this.sessionToken;
|
|
3462
|
+
}
|
|
3431
3463
|
return headers;
|
|
3432
3464
|
}
|
|
3433
3465
|
async resilientFetch(url, options) {
|
|
@@ -3453,6 +3485,7 @@ var CimplifyClient = class {
|
|
|
3453
3485
|
signal: controller.signal
|
|
3454
3486
|
});
|
|
3455
3487
|
clearTimeout(timeoutId);
|
|
3488
|
+
this.captureSessionToken(response);
|
|
3456
3489
|
if (response.ok) {
|
|
3457
3490
|
this.hooks.onRequestSuccess?.({
|
|
3458
3491
|
...context,
|
package/dist/react.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CimplifyClient, X as ProcessCheckoutResult, Z as CheckoutStatus, _ as CheckoutStatusContext, bp as Location, bm as Business, aR as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cI as AuthenticatedData, cE as AddressInfo, cF as PaymentMethodInfo, cK as ElementsCheckoutResult, W as ProcessCheckoutOptions } from './client-
|
|
1
|
+
import { C as CimplifyClient, X as ProcessCheckoutResult, Z as CheckoutStatus, _ as CheckoutStatusContext, bp as Location, bm as Business, aR as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cI as AuthenticatedData, cE as AddressInfo, cF as PaymentMethodInfo, cK as ElementsCheckoutResult, W as ProcessCheckoutOptions } from './client-DvoI0EIX.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, X as ProcessCheckoutResult, Z as CheckoutStatus, _ as CheckoutStatusContext, bp as Location, bm as Business, aR as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cI as AuthenticatedData, cE as AddressInfo, cF as PaymentMethodInfo, cK as ElementsCheckoutResult, W as ProcessCheckoutOptions } from './client-
|
|
1
|
+
import { C as CimplifyClient, X as ProcessCheckoutResult, Z as CheckoutStatus, _ as CheckoutStatusContext, bp as Location, bm as Business, aR as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cI as AuthenticatedData, cE as AddressInfo, cF as PaymentMethodInfo, cK as ElementsCheckoutResult, W as ProcessCheckoutOptions } from './client-CIvQ1ZLZ.js';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
3
|
import { q as Product, d as Pagination, h as CimplifyError, r as ProductWithDetails, K as Category, aw as BundleSelectionInput, a7 as ComponentSelectionInput, N as Collection, X as BundleWithDetails, a3 as CompositeWithDetails, a8 as CompositePriceResult, C as CurrencyCode } from './payment-CLIWNMaP.js';
|
|
4
4
|
import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-t3FBTU8p.js';
|
package/dist/react.js
CHANGED
|
@@ -3428,7 +3428,9 @@ function createElements(client, businessId, options) {
|
|
|
3428
3428
|
|
|
3429
3429
|
// src/client.ts
|
|
3430
3430
|
var ACCESS_TOKEN_STORAGE_KEY = "cimplify_access_token";
|
|
3431
|
+
var SESSION_TOKEN_STORAGE_KEY = "cimplify_session_token";
|
|
3431
3432
|
var ORDER_TOKEN_PREFIX = "cimplify_ot_";
|
|
3433
|
+
var SESSION_TOKEN_HEADER = "x-session-token";
|
|
3432
3434
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
3433
3435
|
var DEFAULT_MAX_RETRIES = 3;
|
|
3434
3436
|
var DEFAULT_RETRY_DELAY_MS = 1e3;
|
|
@@ -3513,6 +3515,7 @@ function getEnvPublicKey() {
|
|
|
3513
3515
|
var CimplifyClient = class {
|
|
3514
3516
|
constructor(config = {}) {
|
|
3515
3517
|
this.accessToken = null;
|
|
3518
|
+
this.sessionToken = null;
|
|
3516
3519
|
this.context = {};
|
|
3517
3520
|
this.businessId = null;
|
|
3518
3521
|
this.businessIdResolvePromise = null;
|
|
@@ -3527,6 +3530,7 @@ var CimplifyClient = class {
|
|
|
3527
3530
|
this.retryDelay = config.retryDelay ?? DEFAULT_RETRY_DELAY_MS;
|
|
3528
3531
|
this.hooks = config.hooks ?? {};
|
|
3529
3532
|
this.accessToken = this.loadAccessToken();
|
|
3533
|
+
this.sessionToken = this.loadSessionToken();
|
|
3530
3534
|
if (!this.publicKey && !config.suppressPublicKeyWarning) {
|
|
3531
3535
|
console.warn(
|
|
3532
3536
|
'[Cimplify] No public key found. Set NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY in your environment, or pass { publicKey: "pk_..." } to createCimplifyClient().'
|
|
@@ -3563,7 +3567,11 @@ var CimplifyClient = class {
|
|
|
3563
3567
|
clearSession() {
|
|
3564
3568
|
const previous = this.accessToken;
|
|
3565
3569
|
this.accessToken = null;
|
|
3570
|
+
this.sessionToken = null;
|
|
3566
3571
|
this.saveAccessToken(null);
|
|
3572
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
3573
|
+
localStorage.removeItem(SESSION_TOKEN_STORAGE_KEY);
|
|
3574
|
+
}
|
|
3567
3575
|
this.hooks.onSessionChange?.({
|
|
3568
3576
|
previousToken: previous,
|
|
3569
3577
|
newToken: null,
|
|
@@ -3660,6 +3668,27 @@ var CimplifyClient = class {
|
|
|
3660
3668
|
}
|
|
3661
3669
|
}
|
|
3662
3670
|
}
|
|
3671
|
+
loadSessionToken() {
|
|
3672
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
3673
|
+
return localStorage.getItem(SESSION_TOKEN_STORAGE_KEY);
|
|
3674
|
+
}
|
|
3675
|
+
return null;
|
|
3676
|
+
}
|
|
3677
|
+
saveSessionToken(token) {
|
|
3678
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
3679
|
+
try {
|
|
3680
|
+
localStorage.setItem(SESSION_TOKEN_STORAGE_KEY, token);
|
|
3681
|
+
} catch {
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
}
|
|
3685
|
+
captureSessionToken(response) {
|
|
3686
|
+
const token = response.headers.get(SESSION_TOKEN_HEADER);
|
|
3687
|
+
if (token && token !== this.sessionToken) {
|
|
3688
|
+
this.sessionToken = token;
|
|
3689
|
+
this.saveSessionToken(token);
|
|
3690
|
+
}
|
|
3691
|
+
}
|
|
3663
3692
|
getHeaders() {
|
|
3664
3693
|
const headers = {
|
|
3665
3694
|
"Content-Type": "application/json"
|
|
@@ -3671,6 +3700,9 @@ var CimplifyClient = class {
|
|
|
3671
3700
|
if (this.accessToken) {
|
|
3672
3701
|
headers["Authorization"] = `Bearer ${this.accessToken}`;
|
|
3673
3702
|
}
|
|
3703
|
+
if (this.sessionToken) {
|
|
3704
|
+
headers[SESSION_TOKEN_HEADER] = this.sessionToken;
|
|
3705
|
+
}
|
|
3674
3706
|
return headers;
|
|
3675
3707
|
}
|
|
3676
3708
|
async resilientFetch(url, options) {
|
|
@@ -3696,6 +3728,7 @@ var CimplifyClient = class {
|
|
|
3696
3728
|
signal: controller.signal
|
|
3697
3729
|
});
|
|
3698
3730
|
clearTimeout(timeoutId);
|
|
3731
|
+
this.captureSessionToken(response);
|
|
3699
3732
|
if (response.ok) {
|
|
3700
3733
|
this.hooks.onRequestSuccess?.({
|
|
3701
3734
|
...context,
|
package/dist/react.mjs
CHANGED
|
@@ -3426,7 +3426,9 @@ function createElements(client, businessId, options) {
|
|
|
3426
3426
|
|
|
3427
3427
|
// src/client.ts
|
|
3428
3428
|
var ACCESS_TOKEN_STORAGE_KEY = "cimplify_access_token";
|
|
3429
|
+
var SESSION_TOKEN_STORAGE_KEY = "cimplify_session_token";
|
|
3429
3430
|
var ORDER_TOKEN_PREFIX = "cimplify_ot_";
|
|
3431
|
+
var SESSION_TOKEN_HEADER = "x-session-token";
|
|
3430
3432
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
3431
3433
|
var DEFAULT_MAX_RETRIES = 3;
|
|
3432
3434
|
var DEFAULT_RETRY_DELAY_MS = 1e3;
|
|
@@ -3511,6 +3513,7 @@ function getEnvPublicKey() {
|
|
|
3511
3513
|
var CimplifyClient = class {
|
|
3512
3514
|
constructor(config = {}) {
|
|
3513
3515
|
this.accessToken = null;
|
|
3516
|
+
this.sessionToken = null;
|
|
3514
3517
|
this.context = {};
|
|
3515
3518
|
this.businessId = null;
|
|
3516
3519
|
this.businessIdResolvePromise = null;
|
|
@@ -3525,6 +3528,7 @@ var CimplifyClient = class {
|
|
|
3525
3528
|
this.retryDelay = config.retryDelay ?? DEFAULT_RETRY_DELAY_MS;
|
|
3526
3529
|
this.hooks = config.hooks ?? {};
|
|
3527
3530
|
this.accessToken = this.loadAccessToken();
|
|
3531
|
+
this.sessionToken = this.loadSessionToken();
|
|
3528
3532
|
if (!this.publicKey && !config.suppressPublicKeyWarning) {
|
|
3529
3533
|
console.warn(
|
|
3530
3534
|
'[Cimplify] No public key found. Set NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY in your environment, or pass { publicKey: "pk_..." } to createCimplifyClient().'
|
|
@@ -3561,7 +3565,11 @@ var CimplifyClient = class {
|
|
|
3561
3565
|
clearSession() {
|
|
3562
3566
|
const previous = this.accessToken;
|
|
3563
3567
|
this.accessToken = null;
|
|
3568
|
+
this.sessionToken = null;
|
|
3564
3569
|
this.saveAccessToken(null);
|
|
3570
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
3571
|
+
localStorage.removeItem(SESSION_TOKEN_STORAGE_KEY);
|
|
3572
|
+
}
|
|
3565
3573
|
this.hooks.onSessionChange?.({
|
|
3566
3574
|
previousToken: previous,
|
|
3567
3575
|
newToken: null,
|
|
@@ -3658,6 +3666,27 @@ var CimplifyClient = class {
|
|
|
3658
3666
|
}
|
|
3659
3667
|
}
|
|
3660
3668
|
}
|
|
3669
|
+
loadSessionToken() {
|
|
3670
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
3671
|
+
return localStorage.getItem(SESSION_TOKEN_STORAGE_KEY);
|
|
3672
|
+
}
|
|
3673
|
+
return null;
|
|
3674
|
+
}
|
|
3675
|
+
saveSessionToken(token) {
|
|
3676
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
3677
|
+
try {
|
|
3678
|
+
localStorage.setItem(SESSION_TOKEN_STORAGE_KEY, token);
|
|
3679
|
+
} catch {
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
}
|
|
3683
|
+
captureSessionToken(response) {
|
|
3684
|
+
const token = response.headers.get(SESSION_TOKEN_HEADER);
|
|
3685
|
+
if (token && token !== this.sessionToken) {
|
|
3686
|
+
this.sessionToken = token;
|
|
3687
|
+
this.saveSessionToken(token);
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3661
3690
|
getHeaders() {
|
|
3662
3691
|
const headers = {
|
|
3663
3692
|
"Content-Type": "application/json"
|
|
@@ -3669,6 +3698,9 @@ var CimplifyClient = class {
|
|
|
3669
3698
|
if (this.accessToken) {
|
|
3670
3699
|
headers["Authorization"] = `Bearer ${this.accessToken}`;
|
|
3671
3700
|
}
|
|
3701
|
+
if (this.sessionToken) {
|
|
3702
|
+
headers[SESSION_TOKEN_HEADER] = this.sessionToken;
|
|
3703
|
+
}
|
|
3672
3704
|
return headers;
|
|
3673
3705
|
}
|
|
3674
3706
|
async resilientFetch(url, options) {
|
|
@@ -3694,6 +3726,7 @@ var CimplifyClient = class {
|
|
|
3694
3726
|
signal: controller.signal
|
|
3695
3727
|
});
|
|
3696
3728
|
clearTimeout(timeoutId);
|
|
3729
|
+
this.captureSessionToken(response);
|
|
3697
3730
|
if (response.ok) {
|
|
3698
3731
|
this.hooks.onRequestSuccess?.({
|
|
3699
3732
|
...context,
|