@cimplify/sdk 0.5.1 → 0.5.3
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/{ads-CsufxnHH.d.mts → ads-BZbkhijm.d.mts} +10 -0
- package/dist/{ads-CsufxnHH.d.ts → ads-BZbkhijm.d.ts} +10 -0
- package/dist/index.d.mts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +19 -0
- package/dist/index.mjs +19 -0
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/package.json +1 -1
|
@@ -2078,6 +2078,7 @@ interface CheckoutCustomerInfo {
|
|
|
2078
2078
|
}
|
|
2079
2079
|
interface CheckoutFormData {
|
|
2080
2080
|
cart_id: string;
|
|
2081
|
+
location_id?: string;
|
|
2081
2082
|
customer: CheckoutCustomerInfo;
|
|
2082
2083
|
order_type: CheckoutOrderType;
|
|
2083
2084
|
address_info: CheckoutAddressInfo;
|
|
@@ -2087,6 +2088,8 @@ interface CheckoutFormData {
|
|
|
2087
2088
|
link_address_id?: string;
|
|
2088
2089
|
link_payment_method_id?: string;
|
|
2089
2090
|
idempotency_key?: string;
|
|
2091
|
+
/** Optional metadata passed through to the payment provider (e.g. success_url, cancel_url) */
|
|
2092
|
+
metadata?: Record<string, unknown>;
|
|
2090
2093
|
}
|
|
2091
2094
|
interface CheckoutResult {
|
|
2092
2095
|
order_id: string;
|
|
@@ -2252,6 +2255,8 @@ interface Business {
|
|
|
2252
2255
|
is_online_only: boolean;
|
|
2253
2256
|
enabled_payment_types: string[];
|
|
2254
2257
|
default_location_settings: Record<string, unknown>;
|
|
2258
|
+
country_code?: string;
|
|
2259
|
+
timezone?: string;
|
|
2255
2260
|
metadata?: Record<string, unknown>;
|
|
2256
2261
|
}
|
|
2257
2262
|
interface LocationTaxBehavior {
|
|
@@ -3105,6 +3110,7 @@ declare class CimplifyClient {
|
|
|
3105
3110
|
private maxRetries;
|
|
3106
3111
|
private retryDelay;
|
|
3107
3112
|
private hooks;
|
|
3113
|
+
private context;
|
|
3108
3114
|
private inflightRequests;
|
|
3109
3115
|
private _catalogue?;
|
|
3110
3116
|
private _cart?;
|
|
@@ -3124,6 +3130,10 @@ declare class CimplifyClient {
|
|
|
3124
3130
|
getAccessToken(): string | null;
|
|
3125
3131
|
setAccessToken(token: string | null): void;
|
|
3126
3132
|
clearSession(): void;
|
|
3133
|
+
/** Set the active location/branch for all subsequent requests */
|
|
3134
|
+
setLocationId(locationId: string | null): void;
|
|
3135
|
+
/** Get the currently active location ID */
|
|
3136
|
+
getLocationId(): string | null;
|
|
3127
3137
|
private loadAccessToken;
|
|
3128
3138
|
private saveAccessToken;
|
|
3129
3139
|
private getHeaders;
|
|
@@ -2078,6 +2078,7 @@ interface CheckoutCustomerInfo {
|
|
|
2078
2078
|
}
|
|
2079
2079
|
interface CheckoutFormData {
|
|
2080
2080
|
cart_id: string;
|
|
2081
|
+
location_id?: string;
|
|
2081
2082
|
customer: CheckoutCustomerInfo;
|
|
2082
2083
|
order_type: CheckoutOrderType;
|
|
2083
2084
|
address_info: CheckoutAddressInfo;
|
|
@@ -2087,6 +2088,8 @@ interface CheckoutFormData {
|
|
|
2087
2088
|
link_address_id?: string;
|
|
2088
2089
|
link_payment_method_id?: string;
|
|
2089
2090
|
idempotency_key?: string;
|
|
2091
|
+
/** Optional metadata passed through to the payment provider (e.g. success_url, cancel_url) */
|
|
2092
|
+
metadata?: Record<string, unknown>;
|
|
2090
2093
|
}
|
|
2091
2094
|
interface CheckoutResult {
|
|
2092
2095
|
order_id: string;
|
|
@@ -2252,6 +2255,8 @@ interface Business {
|
|
|
2252
2255
|
is_online_only: boolean;
|
|
2253
2256
|
enabled_payment_types: string[];
|
|
2254
2257
|
default_location_settings: Record<string, unknown>;
|
|
2258
|
+
country_code?: string;
|
|
2259
|
+
timezone?: string;
|
|
2255
2260
|
metadata?: Record<string, unknown>;
|
|
2256
2261
|
}
|
|
2257
2262
|
interface LocationTaxBehavior {
|
|
@@ -3105,6 +3110,7 @@ declare class CimplifyClient {
|
|
|
3105
3110
|
private maxRetries;
|
|
3106
3111
|
private retryDelay;
|
|
3107
3112
|
private hooks;
|
|
3113
|
+
private context;
|
|
3108
3114
|
private inflightRequests;
|
|
3109
3115
|
private _catalogue?;
|
|
3110
3116
|
private _cart?;
|
|
@@ -3124,6 +3130,10 @@ declare class CimplifyClient {
|
|
|
3124
3130
|
getAccessToken(): string | null;
|
|
3125
3131
|
setAccessToken(token: string | null): void;
|
|
3126
3132
|
clearSession(): void;
|
|
3133
|
+
/** Set the active location/branch for all subsequent requests */
|
|
3134
|
+
setLocationId(locationId: string | null): void;
|
|
3135
|
+
/** Get the currently active location ID */
|
|
3136
|
+
getLocationId(): string | null;
|
|
3127
3137
|
private loadAccessToken;
|
|
3128
3138
|
private saveAccessToken;
|
|
3129
3139
|
private getHeaders;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-
|
|
2
|
-
export { a1 as AUTHORIZATION_TYPE, a6 as AUTH_MUTATION, eq as AdConfig, es as AdContextValue, er as AdCreative, eo as AdPosition, en as AdSlot, ep as AdTheme, aS as AddOn, bB as AddOnDetails, bX as AddOnGroupDetails, aU as AddOnOption, bW as AddOnOptionDetails, aV as AddOnOptionPrice, aT as AddOnWithOptions, b$ as AddToCartInput, dS as AddressData, ef as AddressInfo, bq as AdjustmentType, cd as AmountToPay, bx as AppliedDiscount, e1 as AuthResponse, j as AuthService, k as AuthStatus, eh as AuthenticatedData, cN as AuthorizationType, dG as AvailabilityCheck, dH as AvailabilityResult, dn as AvailableSlot, bw as BenefitType, dr as Booking, dh as BookingRequirementOverride, dq as BookingStatus, ds as BookingWithDetails, cx as BufferTimes, b1 as Bundle, b5 as BundleComponentData, b6 as BundleComponentInfo, b0 as BundlePriceType, b3 as BundleProduct, bG as BundleSelectionData, bE as BundleSelectionInput, bF as BundleStoredSelection, b2 as BundleSummary, b4 as BundleWithDetails, cV as Business, d7 as BusinessHours, cU as BusinessPreferences, B as BusinessService, d6 as BusinessSettings, cT as BusinessType, d4 as BusinessWithLocations, W as CHECKOUT_MODE, a7 as CHECKOUT_MUTATION, Z as CHECKOUT_STEP, a3 as CONTACT_TYPE, dw as CancelBookingInput, cr as CancelOrderInput, cz as CancellationPolicy, bL as Cart, bC as CartAddOn, bo as CartChannel, bM as CartItem, bZ as CartItemDetails, f as CartOperations, bn as CartStatus, c1 as CartSummary, bN as CartTotals, e as CatalogueQueries, aX as Category, d8 as CategoryInfo, aY as CategorySummary, m as ChangePasswordInput, du as CheckSlotAvailabilityInput, e4 as CheckoutAddressInfo, e6 as CheckoutCustomerInfo, J as CheckoutFormData, cp as CheckoutInput, z as CheckoutMode, g as CheckoutOperations, D as CheckoutOrderType, F as CheckoutPaymentMethod, N as CheckoutResult, g as CheckoutService, H as CheckoutStep, bv as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, s as CimplifyElement, r as CimplifyElements, ai as CimplifyError, aZ as Collection, a$ as CollectionProduct, a_ as CollectionSummary, bc as ComponentGroup, bd as ComponentGroupWithComponents, bh as ComponentPriceBreakdown, bf as ComponentSelectionInput, b9 as ComponentSourceType, ba as Composite, be as CompositeComponent, bI as CompositePriceBreakdown, bg as CompositePriceResult, b7 as CompositePricingMode, bJ as CompositeSelectionData, bf as CompositeSelectionInput, bH as CompositeStoredSelection, bb as CompositeWithDetails, V as ContactType, dO as CreateAddressInput, dQ as CreateMobileMoneyInput, ad as Currency, dJ as Customer, dK as CustomerAddress, dM as CustomerLinkPreferences, dL as CustomerMobileMoney, cw as CustomerServicePreferences, ab as DEFAULT_COUNTRY, aa as DEFAULT_CURRENCY, a2 as DEVICE_TYPE, dp as DayAvailability, cG as DepositResult, aG as DepositType, R as DeviceType, aF as DigitalProductType, by as DiscountBreakdown, bz as DiscountDetails, bQ as DisplayAddOn, bR as DisplayAddOnOption, bO as DisplayCart, bP as DisplayCartItem, u as ELEMENT_TYPES, E as EVENT_TYPES, ee as ElementAppearance, em as ElementEventHandler, y as ElementEventType, w as ElementOptions, x as ElementType, ei as ElementsCheckoutData, ej as ElementsCheckoutResult, v as ElementsOptions, dU as EnrollAndLinkOrderInput, dX as EnrollAndLinkOrderResult, dR as EnrollmentData, an as Err, ag as ErrorCode, ah as ErrorCodeType, cc as FeeBearerType, ca as FulfillmentLink, c9 as FulfillmentStatus, c8 as FulfillmentType, dt as GetAvailableSlotsInput, i as GetOrdersOptions, G as GetProductsOptions, b8 as GroupPricingBehavior, el as IframeToParentMessage, cR as InitializePaymentResult, I as InventoryService, dI as InventorySummary, aD as InventoryType, K as KitchenOrderItem, q as KitchenOrderResult, a5 as LINK_MUTATION, a4 as LINK_QUERY, bK as LineConfiguration, ce as LineItem, c5 as LineType, dN as LinkData, dW as LinkEnrollResult, L as LinkService, dY as LinkSession, dV as LinkStatusResult, p as LiteBootstrap, o as LiteService, cY as Location, cJ as LocationAppointment, bk as LocationProductPrice, dF as LocationStock, cW as LocationTaxBehavior, cX as LocationTaxOverrides, c$ as LocationTimeProfile, d5 as LocationWithDetails, M as MESSAGE_TYPES, a0 as MOBILE_MONEY_PROVIDER, dT as MobileMoneyData, e5 as MobileMoneyDetails, Q as MobileMoneyProvider, ac as Money, a9 as ORDER_MUTATION, X as ORDER_TYPE, ed as ObservabilityHooks, am as Ok, cf as Order, c4 as OrderChannel, co as OrderFilter, cb as OrderFulfillmentSummary, ci as OrderGroup, cm as OrderGroupDetails, cj as OrderGroupPayment, ch as OrderGroupPaymentState, cl as OrderGroupPaymentSummary, cg as OrderHistory, c6 as OrderLineState, c7 as OrderLineStatus, cn as OrderPaymentEvent, O as OrderQueries, ck as OrderSplitDetail, c2 as OrderStatus, l as OtpResult, Y as PAYMENT_METHOD, a8 as PAYMENT_MUTATION, _ as PAYMENT_STATE, $ as PICKUP_TIME_TYPE, af as Pagination, ae as PaginationParams, ek as ParentToIframeMessage, cQ as Payment, cP as PaymentMethod, eg as PaymentMethodInfo, cM as PaymentMethodType, cO as PaymentProcessingState, cL as PaymentProvider, c3 as PaymentState, cK as PaymentStatus, e3 as PickupTime, e2 as PickupTimeType, bj as Price, br as PriceAdjustment, bu as PriceDecisionPath, bi as PriceEntryType, bt as PricePathTaxInfo, bp as PriceSource, cB as PricingOverrides, aI as Product, aW as ProductAddOn, bl as ProductAvailability, dD as ProductStock, bm as ProductTimeProfile, aC as ProductType, aK as ProductVariant, aP as ProductVariantValue, aJ as ProductWithDetails, cs as RefundOrderInput, cv as ReminderMethod, cy as ReminderSettings, e7 as RequestContext, ea as RequestErrorEvent, d$ as RequestOtpInput, e8 as RequestStartEvent, e9 as RequestSuccessEvent, dv as RescheduleBookingInput, cE as ResourceAssignment, de as ResourceAvailabilityException, dd as ResourceAvailabilityRule, di as ResourceType, al as Result, eb as RetryEvent, d_ as RevokeAllSessionsResult, dZ as RevokeSessionResult, d1 as Room, aH as SalesChannel, cC as SchedulingMetadata, cF as SchedulingResult, n as SchedulingService, S as SearchOptions, bA as SelectedAddOnOption, dj as Service, da as ServiceAvailabilityException, dx as ServiceAvailabilityParams, dy as ServiceAvailabilityResult, d9 as ServiceAvailabilityRule, d2 as ServiceCharge, cA as ServiceNotes, cH as ServiceScheduleRequest, dg as ServiceStaffRequirement, ct as ServiceStatus, dk as ServiceWithStaff, ec as SessionChangeEvent, dl as Staff, cD as StaffAssignment, dc as StaffAvailabilityException, db as StaffAvailabilityRule, df as StaffBookingProfile, cu as StaffRole, cI as StaffScheduleItem, dB as Stock, dC as StockLevel, dz as StockOwnershipType, dA as StockStatus, d3 as StorefrontBootstrap, cS as SubmitAuthorizationInput, d0 as Table, T as TableInfo, bs as TaxPathComponent, cZ as TimeRange, c_ as TimeRanges, dm as TimeSlot, b_ as UICart, bS as UICartBusiness, bU as UICartCustomer, bT as UICartLocation, bV as UICartPricing, dP as UpdateAddressInput, c0 as UpdateCartItemInput, cq as UpdateOrderStatusInput, U as UpdateProfileInput, aM as VariantAxis, aR as VariantAxisSelection, aO as VariantAxisValue, aN as VariantAxisWithValues, bD as VariantDetails, bY as VariantDetailsDTO, aL as VariantDisplayAttribute, aQ as VariantLocationAvailability, dE as VariantStock, aE as VariantStrategy, e0 as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, t as createElements, ap as err, au as flatMap, ay as fromPromise, h as generateIdempotencyKey, av as getOrElse, aj as isCimplifyError, ar as isErr, aq as isOk, ak as isRetryableError, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './ads-
|
|
1
|
+
import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-BZbkhijm.mjs';
|
|
2
|
+
export { a1 as AUTHORIZATION_TYPE, a6 as AUTH_MUTATION, eq as AdConfig, es as AdContextValue, er as AdCreative, eo as AdPosition, en as AdSlot, ep as AdTheme, aS as AddOn, bB as AddOnDetails, bX as AddOnGroupDetails, aU as AddOnOption, bW as AddOnOptionDetails, aV as AddOnOptionPrice, aT as AddOnWithOptions, b$ as AddToCartInput, dS as AddressData, ef as AddressInfo, bq as AdjustmentType, cd as AmountToPay, bx as AppliedDiscount, e1 as AuthResponse, j as AuthService, k as AuthStatus, eh as AuthenticatedData, cN as AuthorizationType, dG as AvailabilityCheck, dH as AvailabilityResult, dn as AvailableSlot, bw as BenefitType, dr as Booking, dh as BookingRequirementOverride, dq as BookingStatus, ds as BookingWithDetails, cx as BufferTimes, b1 as Bundle, b5 as BundleComponentData, b6 as BundleComponentInfo, b0 as BundlePriceType, b3 as BundleProduct, bG as BundleSelectionData, bE as BundleSelectionInput, bF as BundleStoredSelection, b2 as BundleSummary, b4 as BundleWithDetails, cV as Business, d7 as BusinessHours, cU as BusinessPreferences, B as BusinessService, d6 as BusinessSettings, cT as BusinessType, d4 as BusinessWithLocations, W as CHECKOUT_MODE, a7 as CHECKOUT_MUTATION, Z as CHECKOUT_STEP, a3 as CONTACT_TYPE, dw as CancelBookingInput, cr as CancelOrderInput, cz as CancellationPolicy, bL as Cart, bC as CartAddOn, bo as CartChannel, bM as CartItem, bZ as CartItemDetails, f as CartOperations, bn as CartStatus, c1 as CartSummary, bN as CartTotals, e as CatalogueQueries, aX as Category, d8 as CategoryInfo, aY as CategorySummary, m as ChangePasswordInput, du as CheckSlotAvailabilityInput, e4 as CheckoutAddressInfo, e6 as CheckoutCustomerInfo, J as CheckoutFormData, cp as CheckoutInput, z as CheckoutMode, g as CheckoutOperations, D as CheckoutOrderType, F as CheckoutPaymentMethod, N as CheckoutResult, g as CheckoutService, H as CheckoutStep, bv as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, s as CimplifyElement, r as CimplifyElements, ai as CimplifyError, aZ as Collection, a$ as CollectionProduct, a_ as CollectionSummary, bc as ComponentGroup, bd as ComponentGroupWithComponents, bh as ComponentPriceBreakdown, bf as ComponentSelectionInput, b9 as ComponentSourceType, ba as Composite, be as CompositeComponent, bI as CompositePriceBreakdown, bg as CompositePriceResult, b7 as CompositePricingMode, bJ as CompositeSelectionData, bf as CompositeSelectionInput, bH as CompositeStoredSelection, bb as CompositeWithDetails, V as ContactType, dO as CreateAddressInput, dQ as CreateMobileMoneyInput, ad as Currency, dJ as Customer, dK as CustomerAddress, dM as CustomerLinkPreferences, dL as CustomerMobileMoney, cw as CustomerServicePreferences, ab as DEFAULT_COUNTRY, aa as DEFAULT_CURRENCY, a2 as DEVICE_TYPE, dp as DayAvailability, cG as DepositResult, aG as DepositType, R as DeviceType, aF as DigitalProductType, by as DiscountBreakdown, bz as DiscountDetails, bQ as DisplayAddOn, bR as DisplayAddOnOption, bO as DisplayCart, bP as DisplayCartItem, u as ELEMENT_TYPES, E as EVENT_TYPES, ee as ElementAppearance, em as ElementEventHandler, y as ElementEventType, w as ElementOptions, x as ElementType, ei as ElementsCheckoutData, ej as ElementsCheckoutResult, v as ElementsOptions, dU as EnrollAndLinkOrderInput, dX as EnrollAndLinkOrderResult, dR as EnrollmentData, an as Err, ag as ErrorCode, ah as ErrorCodeType, cc as FeeBearerType, ca as FulfillmentLink, c9 as FulfillmentStatus, c8 as FulfillmentType, dt as GetAvailableSlotsInput, i as GetOrdersOptions, G as GetProductsOptions, b8 as GroupPricingBehavior, el as IframeToParentMessage, cR as InitializePaymentResult, I as InventoryService, dI as InventorySummary, aD as InventoryType, K as KitchenOrderItem, q as KitchenOrderResult, a5 as LINK_MUTATION, a4 as LINK_QUERY, bK as LineConfiguration, ce as LineItem, c5 as LineType, dN as LinkData, dW as LinkEnrollResult, L as LinkService, dY as LinkSession, dV as LinkStatusResult, p as LiteBootstrap, o as LiteService, cY as Location, cJ as LocationAppointment, bk as LocationProductPrice, dF as LocationStock, cW as LocationTaxBehavior, cX as LocationTaxOverrides, c$ as LocationTimeProfile, d5 as LocationWithDetails, M as MESSAGE_TYPES, a0 as MOBILE_MONEY_PROVIDER, dT as MobileMoneyData, e5 as MobileMoneyDetails, Q as MobileMoneyProvider, ac as Money, a9 as ORDER_MUTATION, X as ORDER_TYPE, ed as ObservabilityHooks, am as Ok, cf as Order, c4 as OrderChannel, co as OrderFilter, cb as OrderFulfillmentSummary, ci as OrderGroup, cm as OrderGroupDetails, cj as OrderGroupPayment, ch as OrderGroupPaymentState, cl as OrderGroupPaymentSummary, cg as OrderHistory, c6 as OrderLineState, c7 as OrderLineStatus, cn as OrderPaymentEvent, O as OrderQueries, ck as OrderSplitDetail, c2 as OrderStatus, l as OtpResult, Y as PAYMENT_METHOD, a8 as PAYMENT_MUTATION, _ as PAYMENT_STATE, $ as PICKUP_TIME_TYPE, af as Pagination, ae as PaginationParams, ek as ParentToIframeMessage, cQ as Payment, cP as PaymentMethod, eg as PaymentMethodInfo, cM as PaymentMethodType, cO as PaymentProcessingState, cL as PaymentProvider, c3 as PaymentState, cK as PaymentStatus, e3 as PickupTime, e2 as PickupTimeType, bj as Price, br as PriceAdjustment, bu as PriceDecisionPath, bi as PriceEntryType, bt as PricePathTaxInfo, bp as PriceSource, cB as PricingOverrides, aI as Product, aW as ProductAddOn, bl as ProductAvailability, dD as ProductStock, bm as ProductTimeProfile, aC as ProductType, aK as ProductVariant, aP as ProductVariantValue, aJ as ProductWithDetails, cs as RefundOrderInput, cv as ReminderMethod, cy as ReminderSettings, e7 as RequestContext, ea as RequestErrorEvent, d$ as RequestOtpInput, e8 as RequestStartEvent, e9 as RequestSuccessEvent, dv as RescheduleBookingInput, cE as ResourceAssignment, de as ResourceAvailabilityException, dd as ResourceAvailabilityRule, di as ResourceType, al as Result, eb as RetryEvent, d_ as RevokeAllSessionsResult, dZ as RevokeSessionResult, d1 as Room, aH as SalesChannel, cC as SchedulingMetadata, cF as SchedulingResult, n as SchedulingService, S as SearchOptions, bA as SelectedAddOnOption, dj as Service, da as ServiceAvailabilityException, dx as ServiceAvailabilityParams, dy as ServiceAvailabilityResult, d9 as ServiceAvailabilityRule, d2 as ServiceCharge, cA as ServiceNotes, cH as ServiceScheduleRequest, dg as ServiceStaffRequirement, ct as ServiceStatus, dk as ServiceWithStaff, ec as SessionChangeEvent, dl as Staff, cD as StaffAssignment, dc as StaffAvailabilityException, db as StaffAvailabilityRule, df as StaffBookingProfile, cu as StaffRole, cI as StaffScheduleItem, dB as Stock, dC as StockLevel, dz as StockOwnershipType, dA as StockStatus, d3 as StorefrontBootstrap, cS as SubmitAuthorizationInput, d0 as Table, T as TableInfo, bs as TaxPathComponent, cZ as TimeRange, c_ as TimeRanges, dm as TimeSlot, b_ as UICart, bS as UICartBusiness, bU as UICartCustomer, bT as UICartLocation, bV as UICartPricing, dP as UpdateAddressInput, c0 as UpdateCartItemInput, cq as UpdateOrderStatusInput, U as UpdateProfileInput, aM as VariantAxis, aR as VariantAxisSelection, aO as VariantAxisValue, aN as VariantAxisWithValues, bD as VariantDetails, bY as VariantDetailsDTO, aL as VariantDisplayAttribute, aQ as VariantLocationAvailability, dE as VariantStock, aE as VariantStrategy, e0 as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, t as createElements, ap as err, au as flatMap, ay as fromPromise, h as generateIdempotencyKey, av as getOrElse, aj as isCimplifyError, ar as isErr, aq as isOk, ak as isRetryableError, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './ads-BZbkhijm.mjs';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
|
5
5
|
type SortOrder = "asc" | "desc";
|
|
@@ -408,16 +408,22 @@ declare const MOBILE_MONEY_PROVIDERS: {
|
|
|
408
408
|
*/
|
|
409
409
|
declare function detectMobileMoneyProvider(phoneNumber: string): "mtn" | "vodafone" | "airtel" | null;
|
|
410
410
|
|
|
411
|
+
/** Context sent with every request to scope operations to a specific location/branch */
|
|
412
|
+
interface FrontendContext {
|
|
413
|
+
location_id?: string;
|
|
414
|
+
}
|
|
411
415
|
/** Request body for POST /api/q */
|
|
412
416
|
interface QueryRequest {
|
|
413
417
|
query: string;
|
|
414
418
|
variables?: Record<string, unknown>;
|
|
415
419
|
cache_hint?: string;
|
|
420
|
+
context?: FrontendContext;
|
|
416
421
|
}
|
|
417
422
|
/** Request body for POST /api/m */
|
|
418
423
|
interface MutationRequest {
|
|
419
424
|
method: string;
|
|
420
425
|
args: unknown[];
|
|
426
|
+
context?: FrontendContext;
|
|
421
427
|
}
|
|
422
428
|
/** Response metadata */
|
|
423
429
|
interface ResponseMetadata {
|
|
@@ -432,4 +438,4 @@ interface ApiResponse<T> {
|
|
|
432
438
|
metadata?: ResponseMetadata;
|
|
433
439
|
}
|
|
434
440
|
|
|
435
|
-
export { ApiError, type ApiResponse, CURRENCY_SYMBOLS, type FormatCompactOptions, type FormatPriceOptions, MOBILE_MONEY_PROVIDERS, type MutationRequest, type ParsedPrice, PaymentErrorDetails, PaymentResponse, PaymentStatusResponse, type PriceInfo, type ProductWithPrice, QueryBuilder, type QueryRequest, type ResponseMetadata, type TaxComponent, type TaxInfo, categorizePaymentError, detectMobileMoneyProvider, extractPriceInfo, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, isOnSale, normalizePaymentResponse, normalizeStatusResponse, parsePrice, parsePricePath, parsedPriceToPriceInfo, query };
|
|
441
|
+
export { ApiError, type ApiResponse, CURRENCY_SYMBOLS, type FormatCompactOptions, type FormatPriceOptions, type FrontendContext, MOBILE_MONEY_PROVIDERS, type MutationRequest, type ParsedPrice, PaymentErrorDetails, PaymentResponse, PaymentStatusResponse, type PriceInfo, type ProductWithPrice, QueryBuilder, type QueryRequest, type ResponseMetadata, type TaxComponent, type TaxInfo, categorizePaymentError, detectMobileMoneyProvider, extractPriceInfo, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, isOnSale, normalizePaymentResponse, normalizeStatusResponse, parsePrice, parsePricePath, parsedPriceToPriceInfo, query };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-
|
|
2
|
-
export { a1 as AUTHORIZATION_TYPE, a6 as AUTH_MUTATION, eq as AdConfig, es as AdContextValue, er as AdCreative, eo as AdPosition, en as AdSlot, ep as AdTheme, aS as AddOn, bB as AddOnDetails, bX as AddOnGroupDetails, aU as AddOnOption, bW as AddOnOptionDetails, aV as AddOnOptionPrice, aT as AddOnWithOptions, b$ as AddToCartInput, dS as AddressData, ef as AddressInfo, bq as AdjustmentType, cd as AmountToPay, bx as AppliedDiscount, e1 as AuthResponse, j as AuthService, k as AuthStatus, eh as AuthenticatedData, cN as AuthorizationType, dG as AvailabilityCheck, dH as AvailabilityResult, dn as AvailableSlot, bw as BenefitType, dr as Booking, dh as BookingRequirementOverride, dq as BookingStatus, ds as BookingWithDetails, cx as BufferTimes, b1 as Bundle, b5 as BundleComponentData, b6 as BundleComponentInfo, b0 as BundlePriceType, b3 as BundleProduct, bG as BundleSelectionData, bE as BundleSelectionInput, bF as BundleStoredSelection, b2 as BundleSummary, b4 as BundleWithDetails, cV as Business, d7 as BusinessHours, cU as BusinessPreferences, B as BusinessService, d6 as BusinessSettings, cT as BusinessType, d4 as BusinessWithLocations, W as CHECKOUT_MODE, a7 as CHECKOUT_MUTATION, Z as CHECKOUT_STEP, a3 as CONTACT_TYPE, dw as CancelBookingInput, cr as CancelOrderInput, cz as CancellationPolicy, bL as Cart, bC as CartAddOn, bo as CartChannel, bM as CartItem, bZ as CartItemDetails, f as CartOperations, bn as CartStatus, c1 as CartSummary, bN as CartTotals, e as CatalogueQueries, aX as Category, d8 as CategoryInfo, aY as CategorySummary, m as ChangePasswordInput, du as CheckSlotAvailabilityInput, e4 as CheckoutAddressInfo, e6 as CheckoutCustomerInfo, J as CheckoutFormData, cp as CheckoutInput, z as CheckoutMode, g as CheckoutOperations, D as CheckoutOrderType, F as CheckoutPaymentMethod, N as CheckoutResult, g as CheckoutService, H as CheckoutStep, bv as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, s as CimplifyElement, r as CimplifyElements, ai as CimplifyError, aZ as Collection, a$ as CollectionProduct, a_ as CollectionSummary, bc as ComponentGroup, bd as ComponentGroupWithComponents, bh as ComponentPriceBreakdown, bf as ComponentSelectionInput, b9 as ComponentSourceType, ba as Composite, be as CompositeComponent, bI as CompositePriceBreakdown, bg as CompositePriceResult, b7 as CompositePricingMode, bJ as CompositeSelectionData, bf as CompositeSelectionInput, bH as CompositeStoredSelection, bb as CompositeWithDetails, V as ContactType, dO as CreateAddressInput, dQ as CreateMobileMoneyInput, ad as Currency, dJ as Customer, dK as CustomerAddress, dM as CustomerLinkPreferences, dL as CustomerMobileMoney, cw as CustomerServicePreferences, ab as DEFAULT_COUNTRY, aa as DEFAULT_CURRENCY, a2 as DEVICE_TYPE, dp as DayAvailability, cG as DepositResult, aG as DepositType, R as DeviceType, aF as DigitalProductType, by as DiscountBreakdown, bz as DiscountDetails, bQ as DisplayAddOn, bR as DisplayAddOnOption, bO as DisplayCart, bP as DisplayCartItem, u as ELEMENT_TYPES, E as EVENT_TYPES, ee as ElementAppearance, em as ElementEventHandler, y as ElementEventType, w as ElementOptions, x as ElementType, ei as ElementsCheckoutData, ej as ElementsCheckoutResult, v as ElementsOptions, dU as EnrollAndLinkOrderInput, dX as EnrollAndLinkOrderResult, dR as EnrollmentData, an as Err, ag as ErrorCode, ah as ErrorCodeType, cc as FeeBearerType, ca as FulfillmentLink, c9 as FulfillmentStatus, c8 as FulfillmentType, dt as GetAvailableSlotsInput, i as GetOrdersOptions, G as GetProductsOptions, b8 as GroupPricingBehavior, el as IframeToParentMessage, cR as InitializePaymentResult, I as InventoryService, dI as InventorySummary, aD as InventoryType, K as KitchenOrderItem, q as KitchenOrderResult, a5 as LINK_MUTATION, a4 as LINK_QUERY, bK as LineConfiguration, ce as LineItem, c5 as LineType, dN as LinkData, dW as LinkEnrollResult, L as LinkService, dY as LinkSession, dV as LinkStatusResult, p as LiteBootstrap, o as LiteService, cY as Location, cJ as LocationAppointment, bk as LocationProductPrice, dF as LocationStock, cW as LocationTaxBehavior, cX as LocationTaxOverrides, c$ as LocationTimeProfile, d5 as LocationWithDetails, M as MESSAGE_TYPES, a0 as MOBILE_MONEY_PROVIDER, dT as MobileMoneyData, e5 as MobileMoneyDetails, Q as MobileMoneyProvider, ac as Money, a9 as ORDER_MUTATION, X as ORDER_TYPE, ed as ObservabilityHooks, am as Ok, cf as Order, c4 as OrderChannel, co as OrderFilter, cb as OrderFulfillmentSummary, ci as OrderGroup, cm as OrderGroupDetails, cj as OrderGroupPayment, ch as OrderGroupPaymentState, cl as OrderGroupPaymentSummary, cg as OrderHistory, c6 as OrderLineState, c7 as OrderLineStatus, cn as OrderPaymentEvent, O as OrderQueries, ck as OrderSplitDetail, c2 as OrderStatus, l as OtpResult, Y as PAYMENT_METHOD, a8 as PAYMENT_MUTATION, _ as PAYMENT_STATE, $ as PICKUP_TIME_TYPE, af as Pagination, ae as PaginationParams, ek as ParentToIframeMessage, cQ as Payment, cP as PaymentMethod, eg as PaymentMethodInfo, cM as PaymentMethodType, cO as PaymentProcessingState, cL as PaymentProvider, c3 as PaymentState, cK as PaymentStatus, e3 as PickupTime, e2 as PickupTimeType, bj as Price, br as PriceAdjustment, bu as PriceDecisionPath, bi as PriceEntryType, bt as PricePathTaxInfo, bp as PriceSource, cB as PricingOverrides, aI as Product, aW as ProductAddOn, bl as ProductAvailability, dD as ProductStock, bm as ProductTimeProfile, aC as ProductType, aK as ProductVariant, aP as ProductVariantValue, aJ as ProductWithDetails, cs as RefundOrderInput, cv as ReminderMethod, cy as ReminderSettings, e7 as RequestContext, ea as RequestErrorEvent, d$ as RequestOtpInput, e8 as RequestStartEvent, e9 as RequestSuccessEvent, dv as RescheduleBookingInput, cE as ResourceAssignment, de as ResourceAvailabilityException, dd as ResourceAvailabilityRule, di as ResourceType, al as Result, eb as RetryEvent, d_ as RevokeAllSessionsResult, dZ as RevokeSessionResult, d1 as Room, aH as SalesChannel, cC as SchedulingMetadata, cF as SchedulingResult, n as SchedulingService, S as SearchOptions, bA as SelectedAddOnOption, dj as Service, da as ServiceAvailabilityException, dx as ServiceAvailabilityParams, dy as ServiceAvailabilityResult, d9 as ServiceAvailabilityRule, d2 as ServiceCharge, cA as ServiceNotes, cH as ServiceScheduleRequest, dg as ServiceStaffRequirement, ct as ServiceStatus, dk as ServiceWithStaff, ec as SessionChangeEvent, dl as Staff, cD as StaffAssignment, dc as StaffAvailabilityException, db as StaffAvailabilityRule, df as StaffBookingProfile, cu as StaffRole, cI as StaffScheduleItem, dB as Stock, dC as StockLevel, dz as StockOwnershipType, dA as StockStatus, d3 as StorefrontBootstrap, cS as SubmitAuthorizationInput, d0 as Table, T as TableInfo, bs as TaxPathComponent, cZ as TimeRange, c_ as TimeRanges, dm as TimeSlot, b_ as UICart, bS as UICartBusiness, bU as UICartCustomer, bT as UICartLocation, bV as UICartPricing, dP as UpdateAddressInput, c0 as UpdateCartItemInput, cq as UpdateOrderStatusInput, U as UpdateProfileInput, aM as VariantAxis, aR as VariantAxisSelection, aO as VariantAxisValue, aN as VariantAxisWithValues, bD as VariantDetails, bY as VariantDetailsDTO, aL as VariantDisplayAttribute, aQ as VariantLocationAvailability, dE as VariantStock, aE as VariantStrategy, e0 as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, t as createElements, ap as err, au as flatMap, ay as fromPromise, h as generateIdempotencyKey, av as getOrElse, aj as isCimplifyError, ar as isErr, aq as isOk, ak as isRetryableError, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './ads-
|
|
1
|
+
import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-BZbkhijm.js';
|
|
2
|
+
export { a1 as AUTHORIZATION_TYPE, a6 as AUTH_MUTATION, eq as AdConfig, es as AdContextValue, er as AdCreative, eo as AdPosition, en as AdSlot, ep as AdTheme, aS as AddOn, bB as AddOnDetails, bX as AddOnGroupDetails, aU as AddOnOption, bW as AddOnOptionDetails, aV as AddOnOptionPrice, aT as AddOnWithOptions, b$ as AddToCartInput, dS as AddressData, ef as AddressInfo, bq as AdjustmentType, cd as AmountToPay, bx as AppliedDiscount, e1 as AuthResponse, j as AuthService, k as AuthStatus, eh as AuthenticatedData, cN as AuthorizationType, dG as AvailabilityCheck, dH as AvailabilityResult, dn as AvailableSlot, bw as BenefitType, dr as Booking, dh as BookingRequirementOverride, dq as BookingStatus, ds as BookingWithDetails, cx as BufferTimes, b1 as Bundle, b5 as BundleComponentData, b6 as BundleComponentInfo, b0 as BundlePriceType, b3 as BundleProduct, bG as BundleSelectionData, bE as BundleSelectionInput, bF as BundleStoredSelection, b2 as BundleSummary, b4 as BundleWithDetails, cV as Business, d7 as BusinessHours, cU as BusinessPreferences, B as BusinessService, d6 as BusinessSettings, cT as BusinessType, d4 as BusinessWithLocations, W as CHECKOUT_MODE, a7 as CHECKOUT_MUTATION, Z as CHECKOUT_STEP, a3 as CONTACT_TYPE, dw as CancelBookingInput, cr as CancelOrderInput, cz as CancellationPolicy, bL as Cart, bC as CartAddOn, bo as CartChannel, bM as CartItem, bZ as CartItemDetails, f as CartOperations, bn as CartStatus, c1 as CartSummary, bN as CartTotals, e as CatalogueQueries, aX as Category, d8 as CategoryInfo, aY as CategorySummary, m as ChangePasswordInput, du as CheckSlotAvailabilityInput, e4 as CheckoutAddressInfo, e6 as CheckoutCustomerInfo, J as CheckoutFormData, cp as CheckoutInput, z as CheckoutMode, g as CheckoutOperations, D as CheckoutOrderType, F as CheckoutPaymentMethod, N as CheckoutResult, g as CheckoutService, H as CheckoutStep, bv as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, s as CimplifyElement, r as CimplifyElements, ai as CimplifyError, aZ as Collection, a$ as CollectionProduct, a_ as CollectionSummary, bc as ComponentGroup, bd as ComponentGroupWithComponents, bh as ComponentPriceBreakdown, bf as ComponentSelectionInput, b9 as ComponentSourceType, ba as Composite, be as CompositeComponent, bI as CompositePriceBreakdown, bg as CompositePriceResult, b7 as CompositePricingMode, bJ as CompositeSelectionData, bf as CompositeSelectionInput, bH as CompositeStoredSelection, bb as CompositeWithDetails, V as ContactType, dO as CreateAddressInput, dQ as CreateMobileMoneyInput, ad as Currency, dJ as Customer, dK as CustomerAddress, dM as CustomerLinkPreferences, dL as CustomerMobileMoney, cw as CustomerServicePreferences, ab as DEFAULT_COUNTRY, aa as DEFAULT_CURRENCY, a2 as DEVICE_TYPE, dp as DayAvailability, cG as DepositResult, aG as DepositType, R as DeviceType, aF as DigitalProductType, by as DiscountBreakdown, bz as DiscountDetails, bQ as DisplayAddOn, bR as DisplayAddOnOption, bO as DisplayCart, bP as DisplayCartItem, u as ELEMENT_TYPES, E as EVENT_TYPES, ee as ElementAppearance, em as ElementEventHandler, y as ElementEventType, w as ElementOptions, x as ElementType, ei as ElementsCheckoutData, ej as ElementsCheckoutResult, v as ElementsOptions, dU as EnrollAndLinkOrderInput, dX as EnrollAndLinkOrderResult, dR as EnrollmentData, an as Err, ag as ErrorCode, ah as ErrorCodeType, cc as FeeBearerType, ca as FulfillmentLink, c9 as FulfillmentStatus, c8 as FulfillmentType, dt as GetAvailableSlotsInput, i as GetOrdersOptions, G as GetProductsOptions, b8 as GroupPricingBehavior, el as IframeToParentMessage, cR as InitializePaymentResult, I as InventoryService, dI as InventorySummary, aD as InventoryType, K as KitchenOrderItem, q as KitchenOrderResult, a5 as LINK_MUTATION, a4 as LINK_QUERY, bK as LineConfiguration, ce as LineItem, c5 as LineType, dN as LinkData, dW as LinkEnrollResult, L as LinkService, dY as LinkSession, dV as LinkStatusResult, p as LiteBootstrap, o as LiteService, cY as Location, cJ as LocationAppointment, bk as LocationProductPrice, dF as LocationStock, cW as LocationTaxBehavior, cX as LocationTaxOverrides, c$ as LocationTimeProfile, d5 as LocationWithDetails, M as MESSAGE_TYPES, a0 as MOBILE_MONEY_PROVIDER, dT as MobileMoneyData, e5 as MobileMoneyDetails, Q as MobileMoneyProvider, ac as Money, a9 as ORDER_MUTATION, X as ORDER_TYPE, ed as ObservabilityHooks, am as Ok, cf as Order, c4 as OrderChannel, co as OrderFilter, cb as OrderFulfillmentSummary, ci as OrderGroup, cm as OrderGroupDetails, cj as OrderGroupPayment, ch as OrderGroupPaymentState, cl as OrderGroupPaymentSummary, cg as OrderHistory, c6 as OrderLineState, c7 as OrderLineStatus, cn as OrderPaymentEvent, O as OrderQueries, ck as OrderSplitDetail, c2 as OrderStatus, l as OtpResult, Y as PAYMENT_METHOD, a8 as PAYMENT_MUTATION, _ as PAYMENT_STATE, $ as PICKUP_TIME_TYPE, af as Pagination, ae as PaginationParams, ek as ParentToIframeMessage, cQ as Payment, cP as PaymentMethod, eg as PaymentMethodInfo, cM as PaymentMethodType, cO as PaymentProcessingState, cL as PaymentProvider, c3 as PaymentState, cK as PaymentStatus, e3 as PickupTime, e2 as PickupTimeType, bj as Price, br as PriceAdjustment, bu as PriceDecisionPath, bi as PriceEntryType, bt as PricePathTaxInfo, bp as PriceSource, cB as PricingOverrides, aI as Product, aW as ProductAddOn, bl as ProductAvailability, dD as ProductStock, bm as ProductTimeProfile, aC as ProductType, aK as ProductVariant, aP as ProductVariantValue, aJ as ProductWithDetails, cs as RefundOrderInput, cv as ReminderMethod, cy as ReminderSettings, e7 as RequestContext, ea as RequestErrorEvent, d$ as RequestOtpInput, e8 as RequestStartEvent, e9 as RequestSuccessEvent, dv as RescheduleBookingInput, cE as ResourceAssignment, de as ResourceAvailabilityException, dd as ResourceAvailabilityRule, di as ResourceType, al as Result, eb as RetryEvent, d_ as RevokeAllSessionsResult, dZ as RevokeSessionResult, d1 as Room, aH as SalesChannel, cC as SchedulingMetadata, cF as SchedulingResult, n as SchedulingService, S as SearchOptions, bA as SelectedAddOnOption, dj as Service, da as ServiceAvailabilityException, dx as ServiceAvailabilityParams, dy as ServiceAvailabilityResult, d9 as ServiceAvailabilityRule, d2 as ServiceCharge, cA as ServiceNotes, cH as ServiceScheduleRequest, dg as ServiceStaffRequirement, ct as ServiceStatus, dk as ServiceWithStaff, ec as SessionChangeEvent, dl as Staff, cD as StaffAssignment, dc as StaffAvailabilityException, db as StaffAvailabilityRule, df as StaffBookingProfile, cu as StaffRole, cI as StaffScheduleItem, dB as Stock, dC as StockLevel, dz as StockOwnershipType, dA as StockStatus, d3 as StorefrontBootstrap, cS as SubmitAuthorizationInput, d0 as Table, T as TableInfo, bs as TaxPathComponent, cZ as TimeRange, c_ as TimeRanges, dm as TimeSlot, b_ as UICart, bS as UICartBusiness, bU as UICartCustomer, bT as UICartLocation, bV as UICartPricing, dP as UpdateAddressInput, c0 as UpdateCartItemInput, cq as UpdateOrderStatusInput, U as UpdateProfileInput, aM as VariantAxis, aR as VariantAxisSelection, aO as VariantAxisValue, aN as VariantAxisWithValues, bD as VariantDetails, bY as VariantDetailsDTO, aL as VariantDisplayAttribute, aQ as VariantLocationAvailability, dE as VariantStock, aE as VariantStrategy, e0 as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, t as createElements, ap as err, au as flatMap, ay as fromPromise, h as generateIdempotencyKey, av as getOrElse, aj as isCimplifyError, ar as isErr, aq as isOk, ak as isRetryableError, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './ads-BZbkhijm.js';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
|
5
5
|
type SortOrder = "asc" | "desc";
|
|
@@ -408,16 +408,22 @@ declare const MOBILE_MONEY_PROVIDERS: {
|
|
|
408
408
|
*/
|
|
409
409
|
declare function detectMobileMoneyProvider(phoneNumber: string): "mtn" | "vodafone" | "airtel" | null;
|
|
410
410
|
|
|
411
|
+
/** Context sent with every request to scope operations to a specific location/branch */
|
|
412
|
+
interface FrontendContext {
|
|
413
|
+
location_id?: string;
|
|
414
|
+
}
|
|
411
415
|
/** Request body for POST /api/q */
|
|
412
416
|
interface QueryRequest {
|
|
413
417
|
query: string;
|
|
414
418
|
variables?: Record<string, unknown>;
|
|
415
419
|
cache_hint?: string;
|
|
420
|
+
context?: FrontendContext;
|
|
416
421
|
}
|
|
417
422
|
/** Request body for POST /api/m */
|
|
418
423
|
interface MutationRequest {
|
|
419
424
|
method: string;
|
|
420
425
|
args: unknown[];
|
|
426
|
+
context?: FrontendContext;
|
|
421
427
|
}
|
|
422
428
|
/** Response metadata */
|
|
423
429
|
interface ResponseMetadata {
|
|
@@ -432,4 +438,4 @@ interface ApiResponse<T> {
|
|
|
432
438
|
metadata?: ResponseMetadata;
|
|
433
439
|
}
|
|
434
440
|
|
|
435
|
-
export { ApiError, type ApiResponse, CURRENCY_SYMBOLS, type FormatCompactOptions, type FormatPriceOptions, MOBILE_MONEY_PROVIDERS, type MutationRequest, type ParsedPrice, PaymentErrorDetails, PaymentResponse, PaymentStatusResponse, type PriceInfo, type ProductWithPrice, QueryBuilder, type QueryRequest, type ResponseMetadata, type TaxComponent, type TaxInfo, categorizePaymentError, detectMobileMoneyProvider, extractPriceInfo, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, isOnSale, normalizePaymentResponse, normalizeStatusResponse, parsePrice, parsePricePath, parsedPriceToPriceInfo, query };
|
|
441
|
+
export { ApiError, type ApiResponse, CURRENCY_SYMBOLS, type FormatCompactOptions, type FormatPriceOptions, type FrontendContext, MOBILE_MONEY_PROVIDERS, type MutationRequest, type ParsedPrice, PaymentErrorDetails, PaymentResponse, PaymentStatusResponse, type PriceInfo, type ProductWithPrice, QueryBuilder, type QueryRequest, type ResponseMetadata, type TaxComponent, type TaxInfo, categorizePaymentError, detectMobileMoneyProvider, extractPriceInfo, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, isOnSale, normalizePaymentResponse, normalizeStatusResponse, parsePrice, parsePricePath, parsedPriceToPriceInfo, query };
|
package/dist/index.js
CHANGED
|
@@ -1653,6 +1653,7 @@ function getEnvPublicKey() {
|
|
|
1653
1653
|
var CimplifyClient = class {
|
|
1654
1654
|
constructor(config = {}) {
|
|
1655
1655
|
this.accessToken = null;
|
|
1656
|
+
this.context = {};
|
|
1656
1657
|
this.inflightRequests = /* @__PURE__ */ new Map();
|
|
1657
1658
|
this.publicKey = config.publicKey || getEnvPublicKey() || "";
|
|
1658
1659
|
const urls = deriveUrls();
|
|
@@ -1701,6 +1702,18 @@ var CimplifyClient = class {
|
|
|
1701
1702
|
source: "clear"
|
|
1702
1703
|
});
|
|
1703
1704
|
}
|
|
1705
|
+
/** Set the active location/branch for all subsequent requests */
|
|
1706
|
+
setLocationId(locationId) {
|
|
1707
|
+
if (locationId) {
|
|
1708
|
+
this.context.location_id = locationId;
|
|
1709
|
+
} else {
|
|
1710
|
+
delete this.context.location_id;
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
/** Get the currently active location ID */
|
|
1714
|
+
getLocationId() {
|
|
1715
|
+
return this.context.location_id ?? null;
|
|
1716
|
+
}
|
|
1704
1717
|
loadAccessToken() {
|
|
1705
1718
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
1706
1719
|
return localStorage.getItem(ACCESS_TOKEN_STORAGE_KEY);
|
|
@@ -1829,6 +1842,9 @@ var CimplifyClient = class {
|
|
|
1829
1842
|
if (variables) {
|
|
1830
1843
|
body.variables = variables;
|
|
1831
1844
|
}
|
|
1845
|
+
if (Object.keys(this.context).length > 0) {
|
|
1846
|
+
body.context = this.context;
|
|
1847
|
+
}
|
|
1832
1848
|
const key = this.getDedupeKey("query", body);
|
|
1833
1849
|
return this.deduplicatedRequest(key, async () => {
|
|
1834
1850
|
const response = await this.resilientFetch(`${this.baseUrl}/api/q`, {
|
|
@@ -1845,6 +1861,9 @@ var CimplifyClient = class {
|
|
|
1845
1861
|
method,
|
|
1846
1862
|
args: args !== void 0 ? [args] : []
|
|
1847
1863
|
};
|
|
1864
|
+
if (Object.keys(this.context).length > 0) {
|
|
1865
|
+
body.context = this.context;
|
|
1866
|
+
}
|
|
1848
1867
|
const response = await this.resilientFetch(`${this.baseUrl}/api/m`, {
|
|
1849
1868
|
method: "POST",
|
|
1850
1869
|
credentials: this.credentials,
|
package/dist/index.mjs
CHANGED
|
@@ -1651,6 +1651,7 @@ function getEnvPublicKey() {
|
|
|
1651
1651
|
var CimplifyClient = class {
|
|
1652
1652
|
constructor(config = {}) {
|
|
1653
1653
|
this.accessToken = null;
|
|
1654
|
+
this.context = {};
|
|
1654
1655
|
this.inflightRequests = /* @__PURE__ */ new Map();
|
|
1655
1656
|
this.publicKey = config.publicKey || getEnvPublicKey() || "";
|
|
1656
1657
|
const urls = deriveUrls();
|
|
@@ -1699,6 +1700,18 @@ var CimplifyClient = class {
|
|
|
1699
1700
|
source: "clear"
|
|
1700
1701
|
});
|
|
1701
1702
|
}
|
|
1703
|
+
/** Set the active location/branch for all subsequent requests */
|
|
1704
|
+
setLocationId(locationId) {
|
|
1705
|
+
if (locationId) {
|
|
1706
|
+
this.context.location_id = locationId;
|
|
1707
|
+
} else {
|
|
1708
|
+
delete this.context.location_id;
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
/** Get the currently active location ID */
|
|
1712
|
+
getLocationId() {
|
|
1713
|
+
return this.context.location_id ?? null;
|
|
1714
|
+
}
|
|
1702
1715
|
loadAccessToken() {
|
|
1703
1716
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
1704
1717
|
return localStorage.getItem(ACCESS_TOKEN_STORAGE_KEY);
|
|
@@ -1827,6 +1840,9 @@ var CimplifyClient = class {
|
|
|
1827
1840
|
if (variables) {
|
|
1828
1841
|
body.variables = variables;
|
|
1829
1842
|
}
|
|
1843
|
+
if (Object.keys(this.context).length > 0) {
|
|
1844
|
+
body.context = this.context;
|
|
1845
|
+
}
|
|
1830
1846
|
const key = this.getDedupeKey("query", body);
|
|
1831
1847
|
return this.deduplicatedRequest(key, async () => {
|
|
1832
1848
|
const response = await this.resilientFetch(`${this.baseUrl}/api/q`, {
|
|
@@ -1843,6 +1859,9 @@ var CimplifyClient = class {
|
|
|
1843
1859
|
method,
|
|
1844
1860
|
args: args !== void 0 ? [args] : []
|
|
1845
1861
|
};
|
|
1862
|
+
if (Object.keys(this.context).length > 0) {
|
|
1863
|
+
body.context = this.context;
|
|
1864
|
+
}
|
|
1846
1865
|
const response = await this.resilientFetch(`${this.baseUrl}/api/m`, {
|
|
1847
1866
|
method: "POST",
|
|
1848
1867
|
credentials: this.credentials,
|
package/dist/react.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { en as AdSlot, eo as AdPosition, es as AdContextValue, r as CimplifyElements, C as CimplifyClient, v as ElementsOptions, eh as AuthenticatedData, ef as AddressInfo, eg as PaymentMethodInfo, ej as ElementsCheckoutResult } from './ads-
|
|
2
|
-
export { eq as AdConfig } from './ads-
|
|
1
|
+
import { en as AdSlot, eo as AdPosition, es as AdContextValue, r as CimplifyElements, C as CimplifyClient, v as ElementsOptions, eh as AuthenticatedData, ef as AddressInfo, eg as PaymentMethodInfo, ej as ElementsCheckoutResult } from './ads-BZbkhijm.mjs';
|
|
2
|
+
export { eq as AdConfig } from './ads-BZbkhijm.mjs';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
interface UserIdentity {
|
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { en as AdSlot, eo as AdPosition, es as AdContextValue, r as CimplifyElements, C as CimplifyClient, v as ElementsOptions, eh as AuthenticatedData, ef as AddressInfo, eg as PaymentMethodInfo, ej as ElementsCheckoutResult } from './ads-
|
|
2
|
-
export { eq as AdConfig } from './ads-
|
|
1
|
+
import { en as AdSlot, eo as AdPosition, es as AdContextValue, r as CimplifyElements, C as CimplifyClient, v as ElementsOptions, eh as AuthenticatedData, ef as AddressInfo, eg as PaymentMethodInfo, ej as ElementsCheckoutResult } from './ads-BZbkhijm.js';
|
|
2
|
+
export { eq as AdConfig } from './ads-BZbkhijm.js';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
interface UserIdentity {
|