@cimplify/sdk 0.4.0 → 0.5.0
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/{client-Ug3b8v1t.d.mts → ads-BOUIrN73.d.mts} +29 -5
- package/dist/{client-Ug3b8v1t.d.ts → ads-BOUIrN73.d.ts} +29 -5
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +100 -54
- package/dist/index.mjs +100 -54
- package/dist/react.d.mts +48 -2
- package/dist/react.d.ts +48 -2
- package/dist/react.js +303 -0
- package/dist/react.mjs +302 -2
- package/package.json +10 -3
|
@@ -3045,6 +3045,7 @@ declare class CimplifyElements {
|
|
|
3045
3045
|
private customerId;
|
|
3046
3046
|
private addressData;
|
|
3047
3047
|
private paymentData;
|
|
3048
|
+
private boundHandleMessage;
|
|
3048
3049
|
constructor(client: CimplifyClient, businessId: string, options?: ElementsOptions);
|
|
3049
3050
|
create(type: ElementType, options?: ElementOptions): CimplifyElement;
|
|
3050
3051
|
getElement(type: ElementType): CimplifyElement | undefined;
|
|
@@ -3067,6 +3068,7 @@ declare class CimplifyElement {
|
|
|
3067
3068
|
private mounted;
|
|
3068
3069
|
private eventHandlers;
|
|
3069
3070
|
private resolvers;
|
|
3071
|
+
private boundHandleMessage;
|
|
3070
3072
|
constructor(type: ElementType, businessId: string, linkUrl: string, options: ElementOptions, parent: CimplifyElements);
|
|
3071
3073
|
mount(container: string | HTMLElement): void;
|
|
3072
3074
|
destroy(): void;
|
|
@@ -3098,7 +3100,7 @@ declare class CimplifyClient {
|
|
|
3098
3100
|
private linkApiUrl;
|
|
3099
3101
|
private publicKey;
|
|
3100
3102
|
private credentials;
|
|
3101
|
-
private
|
|
3103
|
+
private accessToken;
|
|
3102
3104
|
private timeout;
|
|
3103
3105
|
private maxRetries;
|
|
3104
3106
|
private retryDelay;
|
|
@@ -3115,13 +3117,16 @@ declare class CimplifyClient {
|
|
|
3115
3117
|
private _scheduling?;
|
|
3116
3118
|
private _lite?;
|
|
3117
3119
|
constructor(config?: CimplifyConfig);
|
|
3120
|
+
/** @deprecated Use getAccessToken() instead */
|
|
3118
3121
|
getSessionToken(): string | null;
|
|
3122
|
+
/** @deprecated Use setAccessToken() instead */
|
|
3119
3123
|
setSessionToken(token: string | null): void;
|
|
3124
|
+
getAccessToken(): string | null;
|
|
3125
|
+
setAccessToken(token: string | null): void;
|
|
3120
3126
|
clearSession(): void;
|
|
3121
|
-
private
|
|
3122
|
-
private
|
|
3127
|
+
private loadAccessToken;
|
|
3128
|
+
private saveAccessToken;
|
|
3123
3129
|
private getHeaders;
|
|
3124
|
-
private updateSessionFromResponse;
|
|
3125
3130
|
private resilientFetch;
|
|
3126
3131
|
private getDedupeKey;
|
|
3127
3132
|
private deduplicatedRequest;
|
|
@@ -3163,4 +3168,23 @@ declare class CimplifyClient {
|
|
|
3163
3168
|
}
|
|
3164
3169
|
declare function createCimplifyClient(config: CimplifyConfig): CimplifyClient;
|
|
3165
3170
|
|
|
3166
|
-
|
|
3171
|
+
type AdSlot = "banner" | "sidebar" | "in-content" | "native" | "footer";
|
|
3172
|
+
type AdPosition = "static" | "sticky" | "fixed";
|
|
3173
|
+
type AdTheme = "light" | "dark" | "auto";
|
|
3174
|
+
interface AdConfig {
|
|
3175
|
+
enabled: boolean;
|
|
3176
|
+
theme: AdTheme;
|
|
3177
|
+
excludePaths?: string[];
|
|
3178
|
+
}
|
|
3179
|
+
interface AdCreative {
|
|
3180
|
+
id: string;
|
|
3181
|
+
html: string;
|
|
3182
|
+
clickUrl: string;
|
|
3183
|
+
}
|
|
3184
|
+
interface AdContextValue {
|
|
3185
|
+
siteId: string | null;
|
|
3186
|
+
config: AdConfig | null;
|
|
3187
|
+
isLoading: boolean;
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3190
|
+
export { PICKUP_TIME_TYPE as $, type ApiError as A, BusinessService as B, CimplifyClient as C, type CheckoutOrderType as D, EVENT_TYPES as E, type CheckoutPaymentMethod as F, type GetProductsOptions as G, type CheckoutStep as H, InventoryService as I, type CheckoutFormData as J, type KitchenOrderItem as K, LinkService as L, MESSAGE_TYPES as M, type CheckoutResult as N, OrderQueries as O, type PaymentErrorDetails as P, type MobileMoneyProvider as Q, type DeviceType as R, type SearchOptions as S, type TableInfo as T, type UpdateProfileInput as U, type ContactType as V, CHECKOUT_MODE as W, ORDER_TYPE as X, PAYMENT_METHOD as Y, CHECKOUT_STEP as Z, PAYMENT_STATE as _, type PaymentResponse as a, type CollectionProduct as a$, MOBILE_MONEY_PROVIDER as a0, AUTHORIZATION_TYPE as a1, DEVICE_TYPE as a2, CONTACT_TYPE as a3, LINK_QUERY as a4, LINK_MUTATION as a5, AUTH_MUTATION as a6, CHECKOUT_MUTATION as a7, PAYMENT_MUTATION as a8, ORDER_MUTATION as a9, combine as aA, combineObject as aB, type ProductType as aC, type InventoryType as aD, type VariantStrategy as aE, type DigitalProductType as aF, type DepositType as aG, type SalesChannel as aH, type Product as aI, type ProductWithDetails as aJ, type ProductVariant as aK, type VariantDisplayAttribute as aL, type VariantAxis as aM, type VariantAxisWithValues as aN, type VariantAxisValue as aO, type ProductVariantValue as aP, type VariantLocationAvailability as aQ, type VariantAxisSelection as aR, type AddOn as aS, type AddOnWithOptions as aT, type AddOnOption as aU, type AddOnOptionPrice as aV, type ProductAddOn as aW, type Category as aX, type CategorySummary as aY, type Collection as aZ, type CollectionSummary as a_, DEFAULT_CURRENCY as aa, DEFAULT_COUNTRY as ab, type Money as ac, type Currency as ad, type PaginationParams as ae, type Pagination as af, ErrorCode as ag, type ErrorCodeType as ah, CimplifyError as ai, isCimplifyError as aj, isRetryableError as ak, type Result as al, type Ok as am, type Err as an, ok as ao, err as ap, isOk as aq, isErr as ar, mapResult as as, mapError as at, flatMap as au, getOrElse as av, unwrap as aw, toNullable as ax, fromPromise as ay, tryCatch as az, type PaymentStatusResponse as b, type AddToCartInput as b$, type BundlePriceType as b0, type Bundle as b1, type BundleSummary as b2, type BundleProduct as b3, type BundleWithDetails as b4, type BundleComponentData as b5, type BundleComponentInfo as b6, type CompositePricingMode as b7, type GroupPricingBehavior as b8, type ComponentSourceType as b9, type SelectedAddOnOption as bA, type AddOnDetails as bB, type CartAddOn as bC, type VariantDetails as bD, type BundleSelectionInput as bE, type BundleStoredSelection as bF, type BundleSelectionData as bG, type CompositeStoredSelection as bH, type CompositePriceBreakdown as bI, type CompositeSelectionData as bJ, type LineConfiguration as bK, type Cart as bL, type CartItem as bM, type CartTotals as bN, type DisplayCart as bO, type DisplayCartItem as bP, type DisplayAddOn as bQ, type DisplayAddOnOption as bR, type UICartBusiness as bS, type UICartLocation as bT, type UICartCustomer as bU, type UICartPricing as bV, type AddOnOptionDetails as bW, type AddOnGroupDetails as bX, type VariantDetailsDTO as bY, type CartItemDetails as bZ, type UICart as b_, type Composite as ba, type CompositeWithDetails as bb, type ComponentGroup as bc, type ComponentGroupWithComponents as bd, type CompositeComponent as be, type ComponentSelectionInput as bf, type CompositePriceResult as bg, type ComponentPriceBreakdown as bh, type PriceEntryType as bi, type Price as bj, type LocationProductPrice as bk, type ProductAvailability as bl, type ProductTimeProfile as bm, type CartStatus as bn, type CartChannel as bo, type PriceSource as bp, type AdjustmentType as bq, type PriceAdjustment as br, type TaxPathComponent as bs, type PricePathTaxInfo as bt, type PriceDecisionPath as bu, type ChosenPrice as bv, type BenefitType as bw, type AppliedDiscount as bx, type DiscountBreakdown as by, type DiscountDetails as bz, createCimplifyClient as c, type LocationTimeProfile as c$, type UpdateCartItemInput as c0, type CartSummary as c1, type OrderStatus as c2, type PaymentState as c3, type OrderChannel as c4, type LineType as c5, type OrderLineState as c6, type OrderLineStatus as c7, type FulfillmentType as c8, type FulfillmentStatus as c9, type ServiceNotes as cA, type PricingOverrides as cB, type SchedulingMetadata as cC, type StaffAssignment as cD, type ResourceAssignment as cE, type SchedulingResult as cF, type DepositResult as cG, type ServiceScheduleRequest as cH, type StaffScheduleItem as cI, type LocationAppointment as cJ, type PaymentStatus as cK, type PaymentProvider as cL, type PaymentMethodType as cM, type AuthorizationType as cN, type PaymentProcessingState as cO, type PaymentMethod as cP, type Payment as cQ, type InitializePaymentResult as cR, type SubmitAuthorizationInput as cS, type BusinessType as cT, type BusinessPreferences as cU, type Business as cV, type LocationTaxBehavior as cW, type LocationTaxOverrides as cX, type Location as cY, type TimeRange as cZ, type TimeRanges as c_, type FulfillmentLink as ca, type OrderFulfillmentSummary as cb, type FeeBearerType as cc, type AmountToPay as cd, type LineItem as ce, type Order as cf, type OrderHistory as cg, type OrderGroupPaymentState as ch, type OrderGroup as ci, type OrderGroupPayment as cj, type OrderSplitDetail as ck, type OrderGroupPaymentSummary as cl, type OrderGroupDetails as cm, type OrderPaymentEvent as cn, type OrderFilter as co, type CheckoutInput as cp, type UpdateOrderStatusInput as cq, type CancelOrderInput as cr, type RefundOrderInput as cs, type ServiceStatus as ct, type StaffRole as cu, type ReminderMethod as cv, type CustomerServicePreferences as cw, type BufferTimes as cx, type ReminderSettings as cy, type CancellationPolicy as cz, type CimplifyConfig as d, type RequestOtpInput as d$, type Table as d0, type Room as d1, type ServiceCharge as d2, type StorefrontBootstrap as d3, type BusinessWithLocations as d4, type LocationWithDetails as d5, type BusinessSettings as d6, type BusinessHours as d7, type CategoryInfo as d8, type ServiceAvailabilityRule as d9, type StockStatus as dA, type Stock as dB, type StockLevel as dC, type ProductStock as dD, type VariantStock as dE, type LocationStock as dF, type AvailabilityCheck as dG, type AvailabilityResult as dH, type InventorySummary as dI, type Customer as dJ, type CustomerAddress as dK, type CustomerMobileMoney as dL, type CustomerLinkPreferences as dM, type LinkData as dN, type CreateAddressInput as dO, type UpdateAddressInput as dP, type CreateMobileMoneyInput as dQ, type EnrollmentData as dR, type AddressData as dS, type MobileMoneyData as dT, type EnrollAndLinkOrderInput as dU, type LinkStatusResult as dV, type LinkEnrollResult as dW, type EnrollAndLinkOrderResult as dX, type LinkSession as dY, type RevokeSessionResult as dZ, type RevokeAllSessionsResult as d_, type ServiceAvailabilityException as da, type StaffAvailabilityRule as db, type StaffAvailabilityException as dc, type ResourceAvailabilityRule as dd, type ResourceAvailabilityException as de, type StaffBookingProfile as df, type ServiceStaffRequirement as dg, type BookingRequirementOverride as dh, type ResourceType as di, type Service as dj, type ServiceWithStaff as dk, type Staff as dl, type TimeSlot as dm, type AvailableSlot as dn, type DayAvailability as dp, type BookingStatus as dq, type Booking as dr, type BookingWithDetails as ds, type GetAvailableSlotsInput as dt, type CheckSlotAvailabilityInput as du, type RescheduleBookingInput as dv, type CancelBookingInput as dw, type ServiceAvailabilityParams as dx, type ServiceAvailabilityResult as dy, type StockOwnershipType as dz, CatalogueQueries as e, type VerifyOtpInput as e0, type AuthResponse as e1, type PickupTimeType as e2, type PickupTime as e3, type CheckoutAddressInfo as e4, type MobileMoneyDetails as e5, type CheckoutCustomerInfo as e6, type RequestContext as e7, type RequestStartEvent as e8, type RequestSuccessEvent as e9, type RequestErrorEvent as ea, type RetryEvent as eb, type SessionChangeEvent as ec, type ObservabilityHooks as ed, type ElementAppearance as ee, type AddressInfo as ef, type PaymentMethodInfo as eg, type AuthenticatedData as eh, type ElementsCheckoutData as ei, type ElementsCheckoutResult as ej, type ParentToIframeMessage as ek, type IframeToParentMessage as el, type ElementEventHandler as em, type AdSlot as en, type AdPosition as eo, type AdTheme as ep, type AdConfig as eq, type AdCreative as er, type AdContextValue as es, CartOperations as f, CheckoutService as g, generateIdempotencyKey as h, type GetOrdersOptions as i, AuthService as j, type AuthStatus as k, type OtpResult as l, type ChangePasswordInput as m, SchedulingService as n, LiteService as o, type LiteBootstrap as p, type KitchenOrderResult as q, CimplifyElements as r, CimplifyElement as s, createElements as t, ELEMENT_TYPES as u, type ElementsOptions as v, type ElementOptions as w, type ElementType as x, type ElementEventType as y, type CheckoutMode as z };
|
|
@@ -3045,6 +3045,7 @@ declare class CimplifyElements {
|
|
|
3045
3045
|
private customerId;
|
|
3046
3046
|
private addressData;
|
|
3047
3047
|
private paymentData;
|
|
3048
|
+
private boundHandleMessage;
|
|
3048
3049
|
constructor(client: CimplifyClient, businessId: string, options?: ElementsOptions);
|
|
3049
3050
|
create(type: ElementType, options?: ElementOptions): CimplifyElement;
|
|
3050
3051
|
getElement(type: ElementType): CimplifyElement | undefined;
|
|
@@ -3067,6 +3068,7 @@ declare class CimplifyElement {
|
|
|
3067
3068
|
private mounted;
|
|
3068
3069
|
private eventHandlers;
|
|
3069
3070
|
private resolvers;
|
|
3071
|
+
private boundHandleMessage;
|
|
3070
3072
|
constructor(type: ElementType, businessId: string, linkUrl: string, options: ElementOptions, parent: CimplifyElements);
|
|
3071
3073
|
mount(container: string | HTMLElement): void;
|
|
3072
3074
|
destroy(): void;
|
|
@@ -3098,7 +3100,7 @@ declare class CimplifyClient {
|
|
|
3098
3100
|
private linkApiUrl;
|
|
3099
3101
|
private publicKey;
|
|
3100
3102
|
private credentials;
|
|
3101
|
-
private
|
|
3103
|
+
private accessToken;
|
|
3102
3104
|
private timeout;
|
|
3103
3105
|
private maxRetries;
|
|
3104
3106
|
private retryDelay;
|
|
@@ -3115,13 +3117,16 @@ declare class CimplifyClient {
|
|
|
3115
3117
|
private _scheduling?;
|
|
3116
3118
|
private _lite?;
|
|
3117
3119
|
constructor(config?: CimplifyConfig);
|
|
3120
|
+
/** @deprecated Use getAccessToken() instead */
|
|
3118
3121
|
getSessionToken(): string | null;
|
|
3122
|
+
/** @deprecated Use setAccessToken() instead */
|
|
3119
3123
|
setSessionToken(token: string | null): void;
|
|
3124
|
+
getAccessToken(): string | null;
|
|
3125
|
+
setAccessToken(token: string | null): void;
|
|
3120
3126
|
clearSession(): void;
|
|
3121
|
-
private
|
|
3122
|
-
private
|
|
3127
|
+
private loadAccessToken;
|
|
3128
|
+
private saveAccessToken;
|
|
3123
3129
|
private getHeaders;
|
|
3124
|
-
private updateSessionFromResponse;
|
|
3125
3130
|
private resilientFetch;
|
|
3126
3131
|
private getDedupeKey;
|
|
3127
3132
|
private deduplicatedRequest;
|
|
@@ -3163,4 +3168,23 @@ declare class CimplifyClient {
|
|
|
3163
3168
|
}
|
|
3164
3169
|
declare function createCimplifyClient(config: CimplifyConfig): CimplifyClient;
|
|
3165
3170
|
|
|
3166
|
-
|
|
3171
|
+
type AdSlot = "banner" | "sidebar" | "in-content" | "native" | "footer";
|
|
3172
|
+
type AdPosition = "static" | "sticky" | "fixed";
|
|
3173
|
+
type AdTheme = "light" | "dark" | "auto";
|
|
3174
|
+
interface AdConfig {
|
|
3175
|
+
enabled: boolean;
|
|
3176
|
+
theme: AdTheme;
|
|
3177
|
+
excludePaths?: string[];
|
|
3178
|
+
}
|
|
3179
|
+
interface AdCreative {
|
|
3180
|
+
id: string;
|
|
3181
|
+
html: string;
|
|
3182
|
+
clickUrl: string;
|
|
3183
|
+
}
|
|
3184
|
+
interface AdContextValue {
|
|
3185
|
+
siteId: string | null;
|
|
3186
|
+
config: AdConfig | null;
|
|
3187
|
+
isLoading: boolean;
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3190
|
+
export { PICKUP_TIME_TYPE as $, type ApiError as A, BusinessService as B, CimplifyClient as C, type CheckoutOrderType as D, EVENT_TYPES as E, type CheckoutPaymentMethod as F, type GetProductsOptions as G, type CheckoutStep as H, InventoryService as I, type CheckoutFormData as J, type KitchenOrderItem as K, LinkService as L, MESSAGE_TYPES as M, type CheckoutResult as N, OrderQueries as O, type PaymentErrorDetails as P, type MobileMoneyProvider as Q, type DeviceType as R, type SearchOptions as S, type TableInfo as T, type UpdateProfileInput as U, type ContactType as V, CHECKOUT_MODE as W, ORDER_TYPE as X, PAYMENT_METHOD as Y, CHECKOUT_STEP as Z, PAYMENT_STATE as _, type PaymentResponse as a, type CollectionProduct as a$, MOBILE_MONEY_PROVIDER as a0, AUTHORIZATION_TYPE as a1, DEVICE_TYPE as a2, CONTACT_TYPE as a3, LINK_QUERY as a4, LINK_MUTATION as a5, AUTH_MUTATION as a6, CHECKOUT_MUTATION as a7, PAYMENT_MUTATION as a8, ORDER_MUTATION as a9, combine as aA, combineObject as aB, type ProductType as aC, type InventoryType as aD, type VariantStrategy as aE, type DigitalProductType as aF, type DepositType as aG, type SalesChannel as aH, type Product as aI, type ProductWithDetails as aJ, type ProductVariant as aK, type VariantDisplayAttribute as aL, type VariantAxis as aM, type VariantAxisWithValues as aN, type VariantAxisValue as aO, type ProductVariantValue as aP, type VariantLocationAvailability as aQ, type VariantAxisSelection as aR, type AddOn as aS, type AddOnWithOptions as aT, type AddOnOption as aU, type AddOnOptionPrice as aV, type ProductAddOn as aW, type Category as aX, type CategorySummary as aY, type Collection as aZ, type CollectionSummary as a_, DEFAULT_CURRENCY as aa, DEFAULT_COUNTRY as ab, type Money as ac, type Currency as ad, type PaginationParams as ae, type Pagination as af, ErrorCode as ag, type ErrorCodeType as ah, CimplifyError as ai, isCimplifyError as aj, isRetryableError as ak, type Result as al, type Ok as am, type Err as an, ok as ao, err as ap, isOk as aq, isErr as ar, mapResult as as, mapError as at, flatMap as au, getOrElse as av, unwrap as aw, toNullable as ax, fromPromise as ay, tryCatch as az, type PaymentStatusResponse as b, type AddToCartInput as b$, type BundlePriceType as b0, type Bundle as b1, type BundleSummary as b2, type BundleProduct as b3, type BundleWithDetails as b4, type BundleComponentData as b5, type BundleComponentInfo as b6, type CompositePricingMode as b7, type GroupPricingBehavior as b8, type ComponentSourceType as b9, type SelectedAddOnOption as bA, type AddOnDetails as bB, type CartAddOn as bC, type VariantDetails as bD, type BundleSelectionInput as bE, type BundleStoredSelection as bF, type BundleSelectionData as bG, type CompositeStoredSelection as bH, type CompositePriceBreakdown as bI, type CompositeSelectionData as bJ, type LineConfiguration as bK, type Cart as bL, type CartItem as bM, type CartTotals as bN, type DisplayCart as bO, type DisplayCartItem as bP, type DisplayAddOn as bQ, type DisplayAddOnOption as bR, type UICartBusiness as bS, type UICartLocation as bT, type UICartCustomer as bU, type UICartPricing as bV, type AddOnOptionDetails as bW, type AddOnGroupDetails as bX, type VariantDetailsDTO as bY, type CartItemDetails as bZ, type UICart as b_, type Composite as ba, type CompositeWithDetails as bb, type ComponentGroup as bc, type ComponentGroupWithComponents as bd, type CompositeComponent as be, type ComponentSelectionInput as bf, type CompositePriceResult as bg, type ComponentPriceBreakdown as bh, type PriceEntryType as bi, type Price as bj, type LocationProductPrice as bk, type ProductAvailability as bl, type ProductTimeProfile as bm, type CartStatus as bn, type CartChannel as bo, type PriceSource as bp, type AdjustmentType as bq, type PriceAdjustment as br, type TaxPathComponent as bs, type PricePathTaxInfo as bt, type PriceDecisionPath as bu, type ChosenPrice as bv, type BenefitType as bw, type AppliedDiscount as bx, type DiscountBreakdown as by, type DiscountDetails as bz, createCimplifyClient as c, type LocationTimeProfile as c$, type UpdateCartItemInput as c0, type CartSummary as c1, type OrderStatus as c2, type PaymentState as c3, type OrderChannel as c4, type LineType as c5, type OrderLineState as c6, type OrderLineStatus as c7, type FulfillmentType as c8, type FulfillmentStatus as c9, type ServiceNotes as cA, type PricingOverrides as cB, type SchedulingMetadata as cC, type StaffAssignment as cD, type ResourceAssignment as cE, type SchedulingResult as cF, type DepositResult as cG, type ServiceScheduleRequest as cH, type StaffScheduleItem as cI, type LocationAppointment as cJ, type PaymentStatus as cK, type PaymentProvider as cL, type PaymentMethodType as cM, type AuthorizationType as cN, type PaymentProcessingState as cO, type PaymentMethod as cP, type Payment as cQ, type InitializePaymentResult as cR, type SubmitAuthorizationInput as cS, type BusinessType as cT, type BusinessPreferences as cU, type Business as cV, type LocationTaxBehavior as cW, type LocationTaxOverrides as cX, type Location as cY, type TimeRange as cZ, type TimeRanges as c_, type FulfillmentLink as ca, type OrderFulfillmentSummary as cb, type FeeBearerType as cc, type AmountToPay as cd, type LineItem as ce, type Order as cf, type OrderHistory as cg, type OrderGroupPaymentState as ch, type OrderGroup as ci, type OrderGroupPayment as cj, type OrderSplitDetail as ck, type OrderGroupPaymentSummary as cl, type OrderGroupDetails as cm, type OrderPaymentEvent as cn, type OrderFilter as co, type CheckoutInput as cp, type UpdateOrderStatusInput as cq, type CancelOrderInput as cr, type RefundOrderInput as cs, type ServiceStatus as ct, type StaffRole as cu, type ReminderMethod as cv, type CustomerServicePreferences as cw, type BufferTimes as cx, type ReminderSettings as cy, type CancellationPolicy as cz, type CimplifyConfig as d, type RequestOtpInput as d$, type Table as d0, type Room as d1, type ServiceCharge as d2, type StorefrontBootstrap as d3, type BusinessWithLocations as d4, type LocationWithDetails as d5, type BusinessSettings as d6, type BusinessHours as d7, type CategoryInfo as d8, type ServiceAvailabilityRule as d9, type StockStatus as dA, type Stock as dB, type StockLevel as dC, type ProductStock as dD, type VariantStock as dE, type LocationStock as dF, type AvailabilityCheck as dG, type AvailabilityResult as dH, type InventorySummary as dI, type Customer as dJ, type CustomerAddress as dK, type CustomerMobileMoney as dL, type CustomerLinkPreferences as dM, type LinkData as dN, type CreateAddressInput as dO, type UpdateAddressInput as dP, type CreateMobileMoneyInput as dQ, type EnrollmentData as dR, type AddressData as dS, type MobileMoneyData as dT, type EnrollAndLinkOrderInput as dU, type LinkStatusResult as dV, type LinkEnrollResult as dW, type EnrollAndLinkOrderResult as dX, type LinkSession as dY, type RevokeSessionResult as dZ, type RevokeAllSessionsResult as d_, type ServiceAvailabilityException as da, type StaffAvailabilityRule as db, type StaffAvailabilityException as dc, type ResourceAvailabilityRule as dd, type ResourceAvailabilityException as de, type StaffBookingProfile as df, type ServiceStaffRequirement as dg, type BookingRequirementOverride as dh, type ResourceType as di, type Service as dj, type ServiceWithStaff as dk, type Staff as dl, type TimeSlot as dm, type AvailableSlot as dn, type DayAvailability as dp, type BookingStatus as dq, type Booking as dr, type BookingWithDetails as ds, type GetAvailableSlotsInput as dt, type CheckSlotAvailabilityInput as du, type RescheduleBookingInput as dv, type CancelBookingInput as dw, type ServiceAvailabilityParams as dx, type ServiceAvailabilityResult as dy, type StockOwnershipType as dz, CatalogueQueries as e, type VerifyOtpInput as e0, type AuthResponse as e1, type PickupTimeType as e2, type PickupTime as e3, type CheckoutAddressInfo as e4, type MobileMoneyDetails as e5, type CheckoutCustomerInfo as e6, type RequestContext as e7, type RequestStartEvent as e8, type RequestSuccessEvent as e9, type RequestErrorEvent as ea, type RetryEvent as eb, type SessionChangeEvent as ec, type ObservabilityHooks as ed, type ElementAppearance as ee, type AddressInfo as ef, type PaymentMethodInfo as eg, type AuthenticatedData as eh, type ElementsCheckoutData as ei, type ElementsCheckoutResult as ej, type ParentToIframeMessage as ek, type IframeToParentMessage as el, type ElementEventHandler as em, type AdSlot as en, type AdPosition as eo, type AdTheme as ep, type AdConfig as eq, type AdCreative as er, type AdContextValue as es, CartOperations as f, CheckoutService as g, generateIdempotencyKey as h, type GetOrdersOptions as i, AuthService as j, type AuthStatus as k, type OtpResult as l, type ChangePasswordInput as m, SchedulingService as n, LiteService as o, type LiteBootstrap as p, type KitchenOrderResult as q, CimplifyElements as r, CimplifyElement as s, createElements as t, ELEMENT_TYPES as u, type ElementsOptions as v, type ElementOptions as w, type ElementType as x, type ElementEventType as y, type CheckoutMode as z };
|
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 './
|
|
2
|
-
export { a1 as AUTHORIZATION_TYPE, a6 as AUTH_MUTATION, 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 './
|
|
1
|
+
import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-BOUIrN73.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-BOUIrN73.mjs';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
|
5
5
|
type SortOrder = "asc" | "desc";
|
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 './
|
|
2
|
-
export { a1 as AUTHORIZATION_TYPE, a6 as AUTH_MUTATION, 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 './
|
|
1
|
+
import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-BOUIrN73.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-BOUIrN73.js';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
|
5
5
|
type SortOrder = "asc" | "desc";
|
package/dist/index.js
CHANGED
|
@@ -1067,6 +1067,9 @@ var InventoryService = class {
|
|
|
1067
1067
|
};
|
|
1068
1068
|
|
|
1069
1069
|
// src/scheduling.ts
|
|
1070
|
+
function toVariables(input) {
|
|
1071
|
+
return Object.fromEntries(Object.entries(input));
|
|
1072
|
+
}
|
|
1070
1073
|
function toCimplifyError9(error) {
|
|
1071
1074
|
if (error instanceof CimplifyError) return error;
|
|
1072
1075
|
if (error instanceof Error) {
|
|
@@ -1099,17 +1102,14 @@ var SchedulingService = class {
|
|
|
1099
1102
|
}
|
|
1100
1103
|
async getAvailableSlots(input) {
|
|
1101
1104
|
return safe9(
|
|
1102
|
-
this.client.query(
|
|
1103
|
-
"scheduling.slots",
|
|
1104
|
-
input
|
|
1105
|
-
)
|
|
1105
|
+
this.client.query("scheduling.slots", toVariables(input))
|
|
1106
1106
|
);
|
|
1107
1107
|
}
|
|
1108
1108
|
async checkSlotAvailability(input) {
|
|
1109
1109
|
return safe9(
|
|
1110
1110
|
this.client.query(
|
|
1111
1111
|
"scheduling.check_availability",
|
|
1112
|
-
input
|
|
1112
|
+
toVariables(input)
|
|
1113
1113
|
)
|
|
1114
1114
|
);
|
|
1115
1115
|
}
|
|
@@ -1117,7 +1117,7 @@ var SchedulingService = class {
|
|
|
1117
1117
|
return safe9(
|
|
1118
1118
|
this.client.query(
|
|
1119
1119
|
"scheduling.availability",
|
|
1120
|
-
params
|
|
1120
|
+
toVariables(params)
|
|
1121
1121
|
)
|
|
1122
1122
|
);
|
|
1123
1123
|
}
|
|
@@ -1266,7 +1266,56 @@ var EVENT_TYPES = {
|
|
|
1266
1266
|
};
|
|
1267
1267
|
|
|
1268
1268
|
// src/elements.ts
|
|
1269
|
+
function mapOrderType(orderType) {
|
|
1270
|
+
if (orderType === "dine_in") return "dine-in";
|
|
1271
|
+
return orderType ?? "delivery";
|
|
1272
|
+
}
|
|
1273
|
+
function toCheckoutFormData(data) {
|
|
1274
|
+
return {
|
|
1275
|
+
cart_id: data.cart_id,
|
|
1276
|
+
customer: {
|
|
1277
|
+
name: "",
|
|
1278
|
+
email: "",
|
|
1279
|
+
phone: "",
|
|
1280
|
+
save_details: false
|
|
1281
|
+
},
|
|
1282
|
+
order_type: mapOrderType(data.order_type),
|
|
1283
|
+
address_info: data.address ? {
|
|
1284
|
+
street_address: data.address.street_address,
|
|
1285
|
+
apartment: data.address.apartment,
|
|
1286
|
+
city: data.address.city,
|
|
1287
|
+
region: data.address.region,
|
|
1288
|
+
postal_code: data.address.postal_code,
|
|
1289
|
+
country: data.address.country,
|
|
1290
|
+
delivery_instructions: data.address.delivery_instructions,
|
|
1291
|
+
phone_for_delivery: data.address.phone_for_delivery
|
|
1292
|
+
} : {},
|
|
1293
|
+
payment_method: data.payment_method?.type ?? "mobile_money",
|
|
1294
|
+
mobile_money_details: data.payment_method?.type === "mobile_money" && data.payment_method.phone_number ? {
|
|
1295
|
+
phone_number: data.payment_method.phone_number,
|
|
1296
|
+
provider: data.payment_method.provider ?? "mtn"
|
|
1297
|
+
} : void 0,
|
|
1298
|
+
special_instructions: data.notes,
|
|
1299
|
+
link_address_id: data.address?.id,
|
|
1300
|
+
link_payment_method_id: data.payment_method?.id
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1269
1303
|
var DEFAULT_LINK_URL = "https://link.cimplify.io";
|
|
1304
|
+
function isAllowedOrigin(origin) {
|
|
1305
|
+
try {
|
|
1306
|
+
const url = new URL(origin);
|
|
1307
|
+
const hostname = url.hostname;
|
|
1308
|
+
if (hostname === "localhost" || hostname === "127.0.0.1") {
|
|
1309
|
+
return true;
|
|
1310
|
+
}
|
|
1311
|
+
if (url.protocol !== "https:") {
|
|
1312
|
+
return false;
|
|
1313
|
+
}
|
|
1314
|
+
return hostname === "cimplify.io" || hostname.endsWith(".cimplify.io");
|
|
1315
|
+
} catch {
|
|
1316
|
+
return false;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1270
1319
|
var CimplifyElements = class {
|
|
1271
1320
|
constructor(client, businessId, options = {}) {
|
|
1272
1321
|
this.elements = /* @__PURE__ */ new Map();
|
|
@@ -1279,8 +1328,9 @@ var CimplifyElements = class {
|
|
|
1279
1328
|
this.businessId = businessId;
|
|
1280
1329
|
this.linkUrl = options.linkUrl || DEFAULT_LINK_URL;
|
|
1281
1330
|
this.options = options;
|
|
1331
|
+
this.boundHandleMessage = this.handleMessage.bind(this);
|
|
1282
1332
|
if (typeof window !== "undefined") {
|
|
1283
|
-
window.addEventListener("message", this.
|
|
1333
|
+
window.addEventListener("message", this.boundHandleMessage);
|
|
1284
1334
|
}
|
|
1285
1335
|
}
|
|
1286
1336
|
create(type, options = {}) {
|
|
@@ -1297,7 +1347,7 @@ var CimplifyElements = class {
|
|
|
1297
1347
|
this.elements.forEach((element) => element.destroy());
|
|
1298
1348
|
this.elements.clear();
|
|
1299
1349
|
if (typeof window !== "undefined") {
|
|
1300
|
-
window.removeEventListener("message", this.
|
|
1350
|
+
window.removeEventListener("message", this.boundHandleMessage);
|
|
1301
1351
|
}
|
|
1302
1352
|
}
|
|
1303
1353
|
async submitCheckout(data) {
|
|
@@ -1305,15 +1355,24 @@ var CimplifyElements = class {
|
|
|
1305
1355
|
if (addressElement) await addressElement.getData();
|
|
1306
1356
|
const paymentElement = this.elements.get(ELEMENT_TYPES.PAYMENT);
|
|
1307
1357
|
if (paymentElement) await paymentElement.getData();
|
|
1308
|
-
const
|
|
1358
|
+
const internalData = {
|
|
1309
1359
|
...data,
|
|
1310
1360
|
customer: this.accountId ? { account_id: this.accountId, customer_id: this.customerId } : void 0,
|
|
1311
1361
|
address: this.addressData,
|
|
1312
1362
|
payment_method: this.paymentData
|
|
1313
1363
|
};
|
|
1314
|
-
const
|
|
1364
|
+
const checkoutFormData = toCheckoutFormData(internalData);
|
|
1365
|
+
const result = await this.client.checkout.process(checkoutFormData);
|
|
1315
1366
|
if (result.ok) {
|
|
1316
|
-
return {
|
|
1367
|
+
return {
|
|
1368
|
+
success: true,
|
|
1369
|
+
order: {
|
|
1370
|
+
id: result.value.order_id,
|
|
1371
|
+
status: result.value.payment_status,
|
|
1372
|
+
total: ""
|
|
1373
|
+
// Total is not returned by checkout result
|
|
1374
|
+
}
|
|
1375
|
+
};
|
|
1317
1376
|
}
|
|
1318
1377
|
return {
|
|
1319
1378
|
success: false,
|
|
@@ -1330,7 +1389,7 @@ var CimplifyElements = class {
|
|
|
1330
1389
|
return this.accessToken;
|
|
1331
1390
|
}
|
|
1332
1391
|
handleMessage(event) {
|
|
1333
|
-
if (!
|
|
1392
|
+
if (!isAllowedOrigin(event.origin)) {
|
|
1334
1393
|
return;
|
|
1335
1394
|
}
|
|
1336
1395
|
const message = event.data;
|
|
@@ -1384,8 +1443,9 @@ var CimplifyElement = class {
|
|
|
1384
1443
|
this.linkUrl = linkUrl;
|
|
1385
1444
|
this.options = options;
|
|
1386
1445
|
this.parent = parent;
|
|
1446
|
+
this.boundHandleMessage = this.handleMessage.bind(this);
|
|
1387
1447
|
if (typeof window !== "undefined") {
|
|
1388
|
-
window.addEventListener("message", this.
|
|
1448
|
+
window.addEventListener("message", this.boundHandleMessage);
|
|
1389
1449
|
}
|
|
1390
1450
|
}
|
|
1391
1451
|
mount(container) {
|
|
@@ -1411,7 +1471,7 @@ var CimplifyElement = class {
|
|
|
1411
1471
|
this.mounted = false;
|
|
1412
1472
|
this.eventHandlers.clear();
|
|
1413
1473
|
if (typeof window !== "undefined") {
|
|
1414
|
-
window.removeEventListener("message", this.
|
|
1474
|
+
window.removeEventListener("message", this.boundHandleMessage);
|
|
1415
1475
|
}
|
|
1416
1476
|
}
|
|
1417
1477
|
on(event, handler) {
|
|
@@ -1471,7 +1531,7 @@ var CimplifyElement = class {
|
|
|
1471
1531
|
};
|
|
1472
1532
|
}
|
|
1473
1533
|
handleMessage(event) {
|
|
1474
|
-
if (!
|
|
1534
|
+
if (!isAllowedOrigin(event.origin)) {
|
|
1475
1535
|
return;
|
|
1476
1536
|
}
|
|
1477
1537
|
const message = event.data;
|
|
@@ -1522,8 +1582,7 @@ function createElements(client, businessId, options) {
|
|
|
1522
1582
|
}
|
|
1523
1583
|
|
|
1524
1584
|
// src/client.ts
|
|
1525
|
-
var
|
|
1526
|
-
var SESSION_STORAGE_KEY = "cimplify_session_token";
|
|
1585
|
+
var ACCESS_TOKEN_STORAGE_KEY = "cimplify_access_token";
|
|
1527
1586
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
1528
1587
|
var DEFAULT_MAX_RETRIES = 3;
|
|
1529
1588
|
var DEFAULT_RETRY_DELAY_MS = 1e3;
|
|
@@ -1585,7 +1644,7 @@ function deriveUrls() {
|
|
|
1585
1644
|
}
|
|
1586
1645
|
var CimplifyClient = class {
|
|
1587
1646
|
constructor(config = {}) {
|
|
1588
|
-
this.
|
|
1647
|
+
this.accessToken = null;
|
|
1589
1648
|
this.inflightRequests = /* @__PURE__ */ new Map();
|
|
1590
1649
|
this.publicKey = config.publicKey || "";
|
|
1591
1650
|
const urls = deriveUrls();
|
|
@@ -1596,15 +1655,23 @@ var CimplifyClient = class {
|
|
|
1596
1655
|
this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
1597
1656
|
this.retryDelay = config.retryDelay ?? DEFAULT_RETRY_DELAY_MS;
|
|
1598
1657
|
this.hooks = config.hooks ?? {};
|
|
1599
|
-
this.
|
|
1658
|
+
this.accessToken = this.loadAccessToken();
|
|
1600
1659
|
}
|
|
1660
|
+
/** @deprecated Use getAccessToken() instead */
|
|
1601
1661
|
getSessionToken() {
|
|
1602
|
-
return this.
|
|
1662
|
+
return this.accessToken;
|
|
1603
1663
|
}
|
|
1664
|
+
/** @deprecated Use setAccessToken() instead */
|
|
1604
1665
|
setSessionToken(token) {
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1666
|
+
this.setAccessToken(token);
|
|
1667
|
+
}
|
|
1668
|
+
getAccessToken() {
|
|
1669
|
+
return this.accessToken;
|
|
1670
|
+
}
|
|
1671
|
+
setAccessToken(token) {
|
|
1672
|
+
const previous = this.accessToken;
|
|
1673
|
+
this.accessToken = token;
|
|
1674
|
+
this.saveAccessToken(token);
|
|
1608
1675
|
this.hooks.onSessionChange?.({
|
|
1609
1676
|
previousToken: previous,
|
|
1610
1677
|
newToken: token,
|
|
@@ -1612,27 +1679,27 @@ var CimplifyClient = class {
|
|
|
1612
1679
|
});
|
|
1613
1680
|
}
|
|
1614
1681
|
clearSession() {
|
|
1615
|
-
const previous = this.
|
|
1616
|
-
this.
|
|
1617
|
-
this.
|
|
1682
|
+
const previous = this.accessToken;
|
|
1683
|
+
this.accessToken = null;
|
|
1684
|
+
this.saveAccessToken(null);
|
|
1618
1685
|
this.hooks.onSessionChange?.({
|
|
1619
1686
|
previousToken: previous,
|
|
1620
1687
|
newToken: null,
|
|
1621
1688
|
source: "clear"
|
|
1622
1689
|
});
|
|
1623
1690
|
}
|
|
1624
|
-
|
|
1691
|
+
loadAccessToken() {
|
|
1625
1692
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
1626
|
-
return localStorage.getItem(
|
|
1693
|
+
return localStorage.getItem(ACCESS_TOKEN_STORAGE_KEY);
|
|
1627
1694
|
}
|
|
1628
1695
|
return null;
|
|
1629
1696
|
}
|
|
1630
|
-
|
|
1697
|
+
saveAccessToken(token) {
|
|
1631
1698
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
1632
1699
|
if (token) {
|
|
1633
|
-
localStorage.setItem(
|
|
1700
|
+
localStorage.setItem(ACCESS_TOKEN_STORAGE_KEY, token);
|
|
1634
1701
|
} else {
|
|
1635
|
-
localStorage.removeItem(
|
|
1702
|
+
localStorage.removeItem(ACCESS_TOKEN_STORAGE_KEY);
|
|
1636
1703
|
}
|
|
1637
1704
|
}
|
|
1638
1705
|
}
|
|
@@ -1641,24 +1708,11 @@ var CimplifyClient = class {
|
|
|
1641
1708
|
"Content-Type": "application/json",
|
|
1642
1709
|
"X-API-Key": this.publicKey
|
|
1643
1710
|
};
|
|
1644
|
-
if (this.
|
|
1645
|
-
headers[
|
|
1711
|
+
if (this.accessToken) {
|
|
1712
|
+
headers["Authorization"] = `Bearer ${this.accessToken}`;
|
|
1646
1713
|
}
|
|
1647
1714
|
return headers;
|
|
1648
1715
|
}
|
|
1649
|
-
updateSessionFromResponse(response) {
|
|
1650
|
-
const newToken = response.headers.get(SESSION_TOKEN_HEADER);
|
|
1651
|
-
if (newToken && newToken !== this.sessionToken) {
|
|
1652
|
-
const previous = this.sessionToken;
|
|
1653
|
-
this.sessionToken = newToken;
|
|
1654
|
-
this.saveSessionToken(newToken);
|
|
1655
|
-
this.hooks.onSessionChange?.({
|
|
1656
|
-
previousToken: previous,
|
|
1657
|
-
newToken,
|
|
1658
|
-
source: "response"
|
|
1659
|
-
});
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
1716
|
async resilientFetch(url, options) {
|
|
1663
1717
|
const method = options.method || "GET";
|
|
1664
1718
|
const path = url.replace(this.baseUrl, "").replace(this.linkApiUrl, "");
|
|
@@ -1770,7 +1824,6 @@ var CimplifyClient = class {
|
|
|
1770
1824
|
headers: this.getHeaders(),
|
|
1771
1825
|
body: JSON.stringify(body)
|
|
1772
1826
|
});
|
|
1773
|
-
this.updateSessionFromResponse(response);
|
|
1774
1827
|
return this.handleResponse(response);
|
|
1775
1828
|
});
|
|
1776
1829
|
}
|
|
@@ -1785,7 +1838,6 @@ var CimplifyClient = class {
|
|
|
1785
1838
|
headers: this.getHeaders(),
|
|
1786
1839
|
body: JSON.stringify(body)
|
|
1787
1840
|
});
|
|
1788
|
-
this.updateSessionFromResponse(response);
|
|
1789
1841
|
return this.handleResponse(response);
|
|
1790
1842
|
}
|
|
1791
1843
|
async get(path) {
|
|
@@ -1796,7 +1848,6 @@ var CimplifyClient = class {
|
|
|
1796
1848
|
credentials: this.credentials,
|
|
1797
1849
|
headers: this.getHeaders()
|
|
1798
1850
|
});
|
|
1799
|
-
this.updateSessionFromResponse(response);
|
|
1800
1851
|
return this.handleRestResponse(response);
|
|
1801
1852
|
});
|
|
1802
1853
|
}
|
|
@@ -1807,7 +1858,6 @@ var CimplifyClient = class {
|
|
|
1807
1858
|
headers: this.getHeaders(),
|
|
1808
1859
|
body: body ? JSON.stringify(body) : void 0
|
|
1809
1860
|
});
|
|
1810
|
-
this.updateSessionFromResponse(response);
|
|
1811
1861
|
return this.handleRestResponse(response);
|
|
1812
1862
|
}
|
|
1813
1863
|
async delete(path) {
|
|
@@ -1816,7 +1866,6 @@ var CimplifyClient = class {
|
|
|
1816
1866
|
credentials: this.credentials,
|
|
1817
1867
|
headers: this.getHeaders()
|
|
1818
1868
|
});
|
|
1819
|
-
this.updateSessionFromResponse(response);
|
|
1820
1869
|
return this.handleRestResponse(response);
|
|
1821
1870
|
}
|
|
1822
1871
|
async linkGet(path) {
|
|
@@ -1827,7 +1876,6 @@ var CimplifyClient = class {
|
|
|
1827
1876
|
credentials: this.credentials,
|
|
1828
1877
|
headers: this.getHeaders()
|
|
1829
1878
|
});
|
|
1830
|
-
this.updateSessionFromResponse(response);
|
|
1831
1879
|
return this.handleRestResponse(response);
|
|
1832
1880
|
});
|
|
1833
1881
|
}
|
|
@@ -1838,7 +1886,6 @@ var CimplifyClient = class {
|
|
|
1838
1886
|
headers: this.getHeaders(),
|
|
1839
1887
|
body: body ? JSON.stringify(body) : void 0
|
|
1840
1888
|
});
|
|
1841
|
-
this.updateSessionFromResponse(response);
|
|
1842
1889
|
return this.handleRestResponse(response);
|
|
1843
1890
|
}
|
|
1844
1891
|
async linkDelete(path) {
|
|
@@ -1847,7 +1894,6 @@ var CimplifyClient = class {
|
|
|
1847
1894
|
credentials: this.credentials,
|
|
1848
1895
|
headers: this.getHeaders()
|
|
1849
1896
|
});
|
|
1850
|
-
this.updateSessionFromResponse(response);
|
|
1851
1897
|
return this.handleRestResponse(response);
|
|
1852
1898
|
}
|
|
1853
1899
|
async handleRestResponse(response) {
|