@cimplify/sdk 0.8.4 → 0.8.5

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.
@@ -1,4 +1,4 @@
1
- export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, t as CimplifyElement, s as CimplifyElements, v as ELEMENT_TYPES, E as EVENT_TYPES, z as ElementEventType, x as ElementOptions, y as ElementType, w as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, o as SchedulingService, S as SearchOptions, u as createElements, k as generateIdempotencyKey } from './client-DnAfLDhV.mjs';
1
+ export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, t as CimplifyElement, s as CimplifyElements, v as ELEMENT_TYPES, E as EVENT_TYPES, z as ElementEventType, x as ElementOptions, y as ElementType, w as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, o as SchedulingService, S as SearchOptions, u as createElements, k as generateIdempotencyKey } from './client-iRG2DBq0.mjs';
2
2
  import './payment-CLIWNMaP.mjs';
3
3
 
4
4
  type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
@@ -1,4 +1,4 @@
1
- export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, t as CimplifyElement, s as CimplifyElements, v as ELEMENT_TYPES, E as EVENT_TYPES, z as ElementEventType, x as ElementOptions, y as ElementType, w as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, o as SchedulingService, S as SearchOptions, u as createElements, k as generateIdempotencyKey } from './client-hKTJv1I1.js';
1
+ export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, t as CimplifyElement, s as CimplifyElements, v as ELEMENT_TYPES, E as EVENT_TYPES, z as ElementEventType, x as ElementOptions, y as ElementType, w as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, o as SchedulingService, S as SearchOptions, u as createElements, k as generateIdempotencyKey } from './client-8SahVQEy.js';
2
2
  import './payment-CLIWNMaP.js';
3
3
 
4
4
  type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
package/dist/advanced.js CHANGED
@@ -2628,6 +2628,7 @@ var CimplifyElement = class {
2628
2628
  this.iframe = null;
2629
2629
  this.container = null;
2630
2630
  this.mounted = false;
2631
+ this.pendingInit = null;
2631
2632
  this.eventHandlers = /* @__PURE__ */ new Map();
2632
2633
  this.resolvers = /* @__PURE__ */ new Map();
2633
2634
  this.listening = false;
@@ -2753,23 +2754,9 @@ var CimplifyElement = class {
2753
2754
  );
2754
2755
  this.iframe = iframe;
2755
2756
  this.container.appendChild(iframe);
2756
- iframe.onload = () => {
2757
- const publicKey = this.parent.getPublicKey();
2758
- this.sendMessage({
2759
- type: MESSAGE_TYPES.INIT,
2760
- businessId: resolvedBusinessId,
2761
- publicKey,
2762
- demoMode: publicKey.length === 0,
2763
- prefillEmail: this.options.prefillEmail,
2764
- appearance: this.parent.getAppearance(),
2765
- orderTypes: this.options.orderTypes,
2766
- defaultOrderType: this.options.defaultOrderType,
2767
- renderSubmitButton: true
2768
- });
2769
- const token = this.parent.getAccessToken();
2770
- if (token && this.type !== ELEMENT_TYPES.AUTH) {
2771
- this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
2772
- }
2757
+ this.pendingInit = {
2758
+ businessId: resolvedBusinessId,
2759
+ publicKey: this.parent.getPublicKey()
2773
2760
  };
2774
2761
  }
2775
2762
  handleMessage(event) {
@@ -2790,6 +2777,25 @@ var CimplifyElement = class {
2790
2777
  switch (message.type) {
2791
2778
  case MESSAGE_TYPES.READY:
2792
2779
  if (this.iframe && message.height) this.iframe.style.height = `${message.height}px`;
2780
+ if (this.pendingInit) {
2781
+ const { publicKey } = this.pendingInit;
2782
+ this.sendMessage({
2783
+ type: MESSAGE_TYPES.INIT,
2784
+ businessId: this.pendingInit.businessId,
2785
+ publicKey,
2786
+ demoMode: publicKey.length === 0,
2787
+ prefillEmail: this.options.prefillEmail,
2788
+ appearance: this.parent.getAppearance(),
2789
+ orderTypes: this.options.orderTypes,
2790
+ defaultOrderType: this.options.defaultOrderType,
2791
+ renderSubmitButton: true
2792
+ });
2793
+ const token = this.parent.getAccessToken();
2794
+ if (token && this.type !== ELEMENT_TYPES.AUTH) {
2795
+ this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
2796
+ }
2797
+ this.pendingInit = null;
2798
+ }
2793
2799
  this.emit(EVENT_TYPES.READY, { height: message.height });
2794
2800
  break;
2795
2801
  case MESSAGE_TYPES.HEIGHT_CHANGE:
package/dist/advanced.mjs CHANGED
@@ -2626,6 +2626,7 @@ var CimplifyElement = class {
2626
2626
  this.iframe = null;
2627
2627
  this.container = null;
2628
2628
  this.mounted = false;
2629
+ this.pendingInit = null;
2629
2630
  this.eventHandlers = /* @__PURE__ */ new Map();
2630
2631
  this.resolvers = /* @__PURE__ */ new Map();
2631
2632
  this.listening = false;
@@ -2751,23 +2752,9 @@ var CimplifyElement = class {
2751
2752
  );
2752
2753
  this.iframe = iframe;
2753
2754
  this.container.appendChild(iframe);
2754
- iframe.onload = () => {
2755
- const publicKey = this.parent.getPublicKey();
2756
- this.sendMessage({
2757
- type: MESSAGE_TYPES.INIT,
2758
- businessId: resolvedBusinessId,
2759
- publicKey,
2760
- demoMode: publicKey.length === 0,
2761
- prefillEmail: this.options.prefillEmail,
2762
- appearance: this.parent.getAppearance(),
2763
- orderTypes: this.options.orderTypes,
2764
- defaultOrderType: this.options.defaultOrderType,
2765
- renderSubmitButton: true
2766
- });
2767
- const token = this.parent.getAccessToken();
2768
- if (token && this.type !== ELEMENT_TYPES.AUTH) {
2769
- this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
2770
- }
2755
+ this.pendingInit = {
2756
+ businessId: resolvedBusinessId,
2757
+ publicKey: this.parent.getPublicKey()
2771
2758
  };
2772
2759
  }
2773
2760
  handleMessage(event) {
@@ -2788,6 +2775,25 @@ var CimplifyElement = class {
2788
2775
  switch (message.type) {
2789
2776
  case MESSAGE_TYPES.READY:
2790
2777
  if (this.iframe && message.height) this.iframe.style.height = `${message.height}px`;
2778
+ if (this.pendingInit) {
2779
+ const { publicKey } = this.pendingInit;
2780
+ this.sendMessage({
2781
+ type: MESSAGE_TYPES.INIT,
2782
+ businessId: this.pendingInit.businessId,
2783
+ publicKey,
2784
+ demoMode: publicKey.length === 0,
2785
+ prefillEmail: this.options.prefillEmail,
2786
+ appearance: this.parent.getAppearance(),
2787
+ orderTypes: this.options.orderTypes,
2788
+ defaultOrderType: this.options.defaultOrderType,
2789
+ renderSubmitButton: true
2790
+ });
2791
+ const token = this.parent.getAccessToken();
2792
+ if (token && this.type !== ELEMENT_TYPES.AUTH) {
2793
+ this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
2794
+ }
2795
+ this.pendingInit = null;
2796
+ }
2791
2797
  this.emit(EVENT_TYPES.READY, { height: message.height });
2792
2798
  break;
2793
2799
  case MESSAGE_TYPES.HEIGHT_CHANGE:
@@ -2184,6 +2184,7 @@ declare class CimplifyElement {
2184
2184
  private iframe;
2185
2185
  private container;
2186
2186
  private mounted;
2187
+ private pendingInit;
2187
2188
  private eventHandlers;
2188
2189
  private resolvers;
2189
2190
  private boundHandleMessage;
@@ -2184,6 +2184,7 @@ declare class CimplifyElement {
2184
2184
  private iframe;
2185
2185
  private container;
2186
2186
  private mounted;
2187
+ private pendingInit;
2187
2188
  private eventHandlers;
2188
2189
  private resolvers;
2189
2190
  private boundHandleMessage;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { aa as AUTHORIZATION_TYPE, af as AUTH_MUTATION, $ as AbortablePromise, cc as AddressData, cF as AddressInfo, aP as AmountToPay, cn as AuthResponse, A as AuthService, m as AuthStatus, cH as AuthenticatedCustomer, cJ as AuthenticatedData, c0 as AvailabilityCheck, c1 as AvailabilityResult, bF as AvailableSlot, bI as Booking, bH as BookingStatus, bJ as BookingWithDetails, b7 as BufferTimes, bm as Business, bA as BusinessHours, bl as BusinessPreferences, B as BusinessService, bz as BusinessSettings, bk as BusinessType, bx as BusinessWithLocations, a3 as CHECKOUT_MODE, ag as CHECKOUT_MUTATION, a6 as CHECKOUT_STEP, ac as CONTACT_TYPE, bQ as CancelBookingInput, bR as CancelBookingResult, b1 as CancelOrderInput, b9 as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aC as CatalogueResult, aD as CatalogueSnapshot, bB as CategoryInfo, bN as CheckSlotAvailabilityInput, bO as CheckSlotAvailabilityResult, cq as CheckoutAddressInfo, cN as CheckoutCartData, cM as CheckoutCartItem, cs as CheckoutCustomerInfo, N as CheckoutFormData, a$ as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, Z as CheckoutStatus, _ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a2 as ContactType, c8 as CreateAddressInput, ca as CreateMobileMoneyInput, c3 as Customer, c4 as CustomerAddress, bL as CustomerBooking, bK as CustomerBookingServiceItem, c6 as CustomerLinkPreferences, c5 as CustomerMobileMoney, b6 as CustomerServicePreferences, ak as DEFAULT_COUNTRY, aj as DEFAULT_CURRENCY, ab as DEVICE_TYPE, bG as DayAvailability, bg as DepositResult, a1 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cE as ElementAppearance, cQ as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cK as ElementsCheckoutData, cL as ElementsCheckoutResult, cI as ElementsCustomerInfo, w as ElementsOptions, ce as EnrollAndLinkOrderInput, ch as EnrollAndLinkOrderResult, cb as EnrollmentData, an as Err, aO as FeeBearerType, F as FetchQuoteInput, aM as FulfillmentLink, aL as FulfillmentStatus, aK as FulfillmentType, cu as FxQuote, ct as FxQuoteRequest, cv as FxRateResponse, q as FxService, bM as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cP as IframeToParentMessage, I as InventoryService, c2 as InventorySummary, ae as LINK_MUTATION, ad as LINK_QUERY, aQ as LineItem, aH as LineType, c7 as LinkData, cg as LinkEnrollResult, L as LinkService, ci as LinkSession, cf as LinkStatusResult, r as LiteBootstrap, p as LiteService, bp as Location, bj as LocationAppointment, b$ as LocationStock, bn as LocationTaxBehavior, bo as LocationTaxOverrides, bs as LocationTimeProfile, by as LocationWithDetails, M as MESSAGE_TYPES, a9 as MOBILE_MONEY_PROVIDER, cd as MobileMoneyData, cr as MobileMoneyDetails, a0 as MobileMoneyProvider, ai as ORDER_MUTATION, a4 as ORDER_TYPE, cC as ObservabilityHooks, am as Ok, aR as Order, aG as OrderChannel, a_ as OrderFilter, aN as OrderFulfillmentSummary, aU as OrderGroup, aY as OrderGroupDetails, aV as OrderGroupPayment, aT as OrderGroupPaymentState, aX as OrderGroupPaymentSummary, aS as OrderHistory, aI as OrderLineState, aJ as OrderLineStatus, aZ as OrderPaymentEvent, O as OrderQueries, aW as OrderSplitDetail, aE as OrderStatus, cD as OrderType, n as OtpResult, a5 as PAYMENT_METHOD, ah as PAYMENT_MUTATION, a7 as PAYMENT_STATE, a8 as PICKUP_TIME_TYPE, cO as ParentToIframeMessage, cG as PaymentMethodInfo, aF as PaymentState, cp as PickupTime, co as PickupTimeType, P as PriceQuote, bb as PricingOverrides, Y as ProcessAndResolveOptions, W as ProcessCheckoutOptions, X as ProcessCheckoutResult, bZ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b2 as RefundOrderInput, b5 as ReminderMethod, b8 as ReminderSettings, cw as RequestContext, cz as RequestErrorEvent, cl as RequestOtpInput, cx as RequestStartEvent, cy as RequestSuccessEvent, bP as RescheduleBookingInput, bS as RescheduleBookingResult, be as ResourceAssignment, al as Result, cA as RetryEvent, ck as RevokeAllSessionsResult, cj as RevokeSessionResult, bu as Room, bc as SchedulingMetadata, bf as SchedulingResult, o as SchedulingService, S as SearchOptions, bC as Service, bT as ServiceAvailabilityParams, bU as ServiceAvailabilityResult, bv as ServiceCharge, ba as ServiceNotes, bh as ServiceScheduleRequest, b3 as ServiceStatus, cB as SessionChangeEvent, bD as Staff, bd as StaffAssignment, b4 as StaffRole, bi as StaffScheduleItem, bX as Stock, bY as StockLevel, bV as StockOwnershipType, bW as StockStatus, bw as StorefrontBootstrap, bt as Table, T as TableInfo, bq as TimeRange, br as TimeRanges, bE as TimeSlot, c9 as UpdateAddressInput, b0 as UpdateOrderStatusInput, U as UpdateProfileInput, b_ as VariantStock, cm as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, u as createElements, ap as err, au as flatMap, ay as fromPromise, k as generateIdempotencyKey, av as getOrElse, ar as isErr, aq as isOk, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './client-DnAfLDhV.mjs';
1
+ export { aa as AUTHORIZATION_TYPE, af as AUTH_MUTATION, $ as AbortablePromise, cc as AddressData, cF as AddressInfo, aP as AmountToPay, cn as AuthResponse, A as AuthService, m as AuthStatus, cH as AuthenticatedCustomer, cJ as AuthenticatedData, c0 as AvailabilityCheck, c1 as AvailabilityResult, bF as AvailableSlot, bI as Booking, bH as BookingStatus, bJ as BookingWithDetails, b7 as BufferTimes, bm as Business, bA as BusinessHours, bl as BusinessPreferences, B as BusinessService, bz as BusinessSettings, bk as BusinessType, bx as BusinessWithLocations, a3 as CHECKOUT_MODE, ag as CHECKOUT_MUTATION, a6 as CHECKOUT_STEP, ac as CONTACT_TYPE, bQ as CancelBookingInput, bR as CancelBookingResult, b1 as CancelOrderInput, b9 as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aC as CatalogueResult, aD as CatalogueSnapshot, bB as CategoryInfo, bN as CheckSlotAvailabilityInput, bO as CheckSlotAvailabilityResult, cq as CheckoutAddressInfo, cN as CheckoutCartData, cM as CheckoutCartItem, cs as CheckoutCustomerInfo, N as CheckoutFormData, a$ as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, Z as CheckoutStatus, _ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a2 as ContactType, c8 as CreateAddressInput, ca as CreateMobileMoneyInput, c3 as Customer, c4 as CustomerAddress, bL as CustomerBooking, bK as CustomerBookingServiceItem, c6 as CustomerLinkPreferences, c5 as CustomerMobileMoney, b6 as CustomerServicePreferences, ak as DEFAULT_COUNTRY, aj as DEFAULT_CURRENCY, ab as DEVICE_TYPE, bG as DayAvailability, bg as DepositResult, a1 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cE as ElementAppearance, cQ as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cK as ElementsCheckoutData, cL as ElementsCheckoutResult, cI as ElementsCustomerInfo, w as ElementsOptions, ce as EnrollAndLinkOrderInput, ch as EnrollAndLinkOrderResult, cb as EnrollmentData, an as Err, aO as FeeBearerType, F as FetchQuoteInput, aM as FulfillmentLink, aL as FulfillmentStatus, aK as FulfillmentType, cu as FxQuote, ct as FxQuoteRequest, cv as FxRateResponse, q as FxService, bM as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cP as IframeToParentMessage, I as InventoryService, c2 as InventorySummary, ae as LINK_MUTATION, ad as LINK_QUERY, aQ as LineItem, aH as LineType, c7 as LinkData, cg as LinkEnrollResult, L as LinkService, ci as LinkSession, cf as LinkStatusResult, r as LiteBootstrap, p as LiteService, bp as Location, bj as LocationAppointment, b$ as LocationStock, bn as LocationTaxBehavior, bo as LocationTaxOverrides, bs as LocationTimeProfile, by as LocationWithDetails, M as MESSAGE_TYPES, a9 as MOBILE_MONEY_PROVIDER, cd as MobileMoneyData, cr as MobileMoneyDetails, a0 as MobileMoneyProvider, ai as ORDER_MUTATION, a4 as ORDER_TYPE, cC as ObservabilityHooks, am as Ok, aR as Order, aG as OrderChannel, a_ as OrderFilter, aN as OrderFulfillmentSummary, aU as OrderGroup, aY as OrderGroupDetails, aV as OrderGroupPayment, aT as OrderGroupPaymentState, aX as OrderGroupPaymentSummary, aS as OrderHistory, aI as OrderLineState, aJ as OrderLineStatus, aZ as OrderPaymentEvent, O as OrderQueries, aW as OrderSplitDetail, aE as OrderStatus, cD as OrderType, n as OtpResult, a5 as PAYMENT_METHOD, ah as PAYMENT_MUTATION, a7 as PAYMENT_STATE, a8 as PICKUP_TIME_TYPE, cO as ParentToIframeMessage, cG as PaymentMethodInfo, aF as PaymentState, cp as PickupTime, co as PickupTimeType, P as PriceQuote, bb as PricingOverrides, Y as ProcessAndResolveOptions, W as ProcessCheckoutOptions, X as ProcessCheckoutResult, bZ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b2 as RefundOrderInput, b5 as ReminderMethod, b8 as ReminderSettings, cw as RequestContext, cz as RequestErrorEvent, cl as RequestOtpInput, cx as RequestStartEvent, cy as RequestSuccessEvent, bP as RescheduleBookingInput, bS as RescheduleBookingResult, be as ResourceAssignment, al as Result, cA as RetryEvent, ck as RevokeAllSessionsResult, cj as RevokeSessionResult, bu as Room, bc as SchedulingMetadata, bf as SchedulingResult, o as SchedulingService, S as SearchOptions, bC as Service, bT as ServiceAvailabilityParams, bU as ServiceAvailabilityResult, bv as ServiceCharge, ba as ServiceNotes, bh as ServiceScheduleRequest, b3 as ServiceStatus, cB as SessionChangeEvent, bD as Staff, bd as StaffAssignment, b4 as StaffRole, bi as StaffScheduleItem, bX as Stock, bY as StockLevel, bV as StockOwnershipType, bW as StockStatus, bw as StorefrontBootstrap, bt as Table, T as TableInfo, bq as TimeRange, br as TimeRanges, bE as TimeSlot, c9 as UpdateAddressInput, b0 as UpdateOrderStatusInput, U as UpdateProfileInput, b_ as VariantStock, cm as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, u as createElements, ap as err, au as flatMap, ay as fromPromise, k as generateIdempotencyKey, av as getOrElse, ar as isErr, aq as isOk, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './client-iRG2DBq0.mjs';
2
2
  export { QueryBuilder, query } from './advanced.mjs';
3
3
  import { A as ApiError } from './payment-CLIWNMaP.mjs';
4
4
  export { B as AddOn, at as AddOnDetails, aP as AddOnGroupDetails, G as AddOnOption, aO as AddOnOptionDetails, H as AddOnOptionPrice, F as AddOnWithOptions, aU as AddToCartInput, ai as AdjustmentType, ap as AppliedDiscount, a_ as AuthorizationType, ao as BenefitType, T as Bundle, Y as BundleComponentData, _ as BundleComponentInfo, R as BundlePriceType, W as BundleProduct, ay as BundleSelectionData, aw as BundleSelectionInput, ax as BundleStoredSelection, U as BundleSummary, X as BundleWithDetails, aD as Cart, au as CartAddOn, ag as CartChannel, aE as CartItem, aR as CartItemDetails, af as CartStatus, aW as CartSummary, aF as CartTotals, K as Category, L as CategorySummary, an as ChosenPrice, h as CimplifyError, N as Collection, Q as CollectionProduct, O as CollectionSummary, a4 as ComponentGroup, a5 as ComponentGroupWithComponents, a9 as ComponentPriceBreakdown, a7 as ComponentSelectionInput, a1 as ComponentSourceType, a2 as Composite, a6 as CompositeComponent, aA as CompositePriceBreakdown, a8 as CompositePriceResult, $ as CompositePricingMode, aB as CompositeSelectionData, a7 as CompositeSelectionInput, az as CompositeStoredSelection, a3 as CompositeWithDetails, b as Currency, C as CurrencyCode, p as DepositType, D as DigitalProductType, aq as DiscountBreakdown, ar as DiscountDetails, aI as DisplayAddOn, aJ as DisplayAddOnOption, aG as DisplayCart, aH as DisplayCartItem, g as ERROR_HINTS, E as ErrorCode, e as ErrorCodeType, f as ErrorHint, a0 as GroupPricingBehavior, b2 as InitializePaymentResult, I as InventoryType, aC as LineConfiguration, ac as LocationProductPrice, M as Money, d as Pagination, P as PaginationParams, b1 as Payment, b5 as PaymentErrorDetails, b0 as PaymentMethod, aZ as PaymentMethodType, a$ as PaymentProcessingState, aY as PaymentProvider, b3 as PaymentResponse, aX as PaymentStatus, b4 as PaymentStatusResponse, ab as Price, aj as PriceAdjustment, am as PriceDecisionPath, aa as PriceEntryType, al as PricePathTaxInfo, ah as PriceSource, q as Product, J as ProductAddOn, ad as ProductAvailability, o as ProductRenderHint, ae as ProductTimeProfile, n as ProductType, s as ProductVariant, x as ProductVariantValue, r as ProductWithDetails, S as SalesChannel, as as SelectedAddOnOption, b6 as SubmitAuthorizationInput, ak as TaxPathComponent, aS as UICart, aK as UICartBusiness, aM as UICartCustomer, aL as UICartLocation, aN as UICartPricing, aT as UICartResponse, aV as UpdateCartItemInput, u as VariantAxis, z as VariantAxisSelection, w as VariantAxisValue, v as VariantAxisWithValues, av as VariantDetails, aQ as VariantDetailsDTO, t as VariantDisplayAttribute, y as VariantLocationAvailability, V as VariantStrategy, Z as ZERO, c as currencyCode, k as enrichError, j as getErrorHint, i as isCimplifyError, l as isRetryableError, m as money, a as moneyFromNumber } from './payment-CLIWNMaP.mjs';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { aa as AUTHORIZATION_TYPE, af as AUTH_MUTATION, $ as AbortablePromise, cc as AddressData, cF as AddressInfo, aP as AmountToPay, cn as AuthResponse, A as AuthService, m as AuthStatus, cH as AuthenticatedCustomer, cJ as AuthenticatedData, c0 as AvailabilityCheck, c1 as AvailabilityResult, bF as AvailableSlot, bI as Booking, bH as BookingStatus, bJ as BookingWithDetails, b7 as BufferTimes, bm as Business, bA as BusinessHours, bl as BusinessPreferences, B as BusinessService, bz as BusinessSettings, bk as BusinessType, bx as BusinessWithLocations, a3 as CHECKOUT_MODE, ag as CHECKOUT_MUTATION, a6 as CHECKOUT_STEP, ac as CONTACT_TYPE, bQ as CancelBookingInput, bR as CancelBookingResult, b1 as CancelOrderInput, b9 as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aC as CatalogueResult, aD as CatalogueSnapshot, bB as CategoryInfo, bN as CheckSlotAvailabilityInput, bO as CheckSlotAvailabilityResult, cq as CheckoutAddressInfo, cN as CheckoutCartData, cM as CheckoutCartItem, cs as CheckoutCustomerInfo, N as CheckoutFormData, a$ as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, Z as CheckoutStatus, _ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a2 as ContactType, c8 as CreateAddressInput, ca as CreateMobileMoneyInput, c3 as Customer, c4 as CustomerAddress, bL as CustomerBooking, bK as CustomerBookingServiceItem, c6 as CustomerLinkPreferences, c5 as CustomerMobileMoney, b6 as CustomerServicePreferences, ak as DEFAULT_COUNTRY, aj as DEFAULT_CURRENCY, ab as DEVICE_TYPE, bG as DayAvailability, bg as DepositResult, a1 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cE as ElementAppearance, cQ as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cK as ElementsCheckoutData, cL as ElementsCheckoutResult, cI as ElementsCustomerInfo, w as ElementsOptions, ce as EnrollAndLinkOrderInput, ch as EnrollAndLinkOrderResult, cb as EnrollmentData, an as Err, aO as FeeBearerType, F as FetchQuoteInput, aM as FulfillmentLink, aL as FulfillmentStatus, aK as FulfillmentType, cu as FxQuote, ct as FxQuoteRequest, cv as FxRateResponse, q as FxService, bM as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cP as IframeToParentMessage, I as InventoryService, c2 as InventorySummary, ae as LINK_MUTATION, ad as LINK_QUERY, aQ as LineItem, aH as LineType, c7 as LinkData, cg as LinkEnrollResult, L as LinkService, ci as LinkSession, cf as LinkStatusResult, r as LiteBootstrap, p as LiteService, bp as Location, bj as LocationAppointment, b$ as LocationStock, bn as LocationTaxBehavior, bo as LocationTaxOverrides, bs as LocationTimeProfile, by as LocationWithDetails, M as MESSAGE_TYPES, a9 as MOBILE_MONEY_PROVIDER, cd as MobileMoneyData, cr as MobileMoneyDetails, a0 as MobileMoneyProvider, ai as ORDER_MUTATION, a4 as ORDER_TYPE, cC as ObservabilityHooks, am as Ok, aR as Order, aG as OrderChannel, a_ as OrderFilter, aN as OrderFulfillmentSummary, aU as OrderGroup, aY as OrderGroupDetails, aV as OrderGroupPayment, aT as OrderGroupPaymentState, aX as OrderGroupPaymentSummary, aS as OrderHistory, aI as OrderLineState, aJ as OrderLineStatus, aZ as OrderPaymentEvent, O as OrderQueries, aW as OrderSplitDetail, aE as OrderStatus, cD as OrderType, n as OtpResult, a5 as PAYMENT_METHOD, ah as PAYMENT_MUTATION, a7 as PAYMENT_STATE, a8 as PICKUP_TIME_TYPE, cO as ParentToIframeMessage, cG as PaymentMethodInfo, aF as PaymentState, cp as PickupTime, co as PickupTimeType, P as PriceQuote, bb as PricingOverrides, Y as ProcessAndResolveOptions, W as ProcessCheckoutOptions, X as ProcessCheckoutResult, bZ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b2 as RefundOrderInput, b5 as ReminderMethod, b8 as ReminderSettings, cw as RequestContext, cz as RequestErrorEvent, cl as RequestOtpInput, cx as RequestStartEvent, cy as RequestSuccessEvent, bP as RescheduleBookingInput, bS as RescheduleBookingResult, be as ResourceAssignment, al as Result, cA as RetryEvent, ck as RevokeAllSessionsResult, cj as RevokeSessionResult, bu as Room, bc as SchedulingMetadata, bf as SchedulingResult, o as SchedulingService, S as SearchOptions, bC as Service, bT as ServiceAvailabilityParams, bU as ServiceAvailabilityResult, bv as ServiceCharge, ba as ServiceNotes, bh as ServiceScheduleRequest, b3 as ServiceStatus, cB as SessionChangeEvent, bD as Staff, bd as StaffAssignment, b4 as StaffRole, bi as StaffScheduleItem, bX as Stock, bY as StockLevel, bV as StockOwnershipType, bW as StockStatus, bw as StorefrontBootstrap, bt as Table, T as TableInfo, bq as TimeRange, br as TimeRanges, bE as TimeSlot, c9 as UpdateAddressInput, b0 as UpdateOrderStatusInput, U as UpdateProfileInput, b_ as VariantStock, cm as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, u as createElements, ap as err, au as flatMap, ay as fromPromise, k as generateIdempotencyKey, av as getOrElse, ar as isErr, aq as isOk, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './client-hKTJv1I1.js';
1
+ export { aa as AUTHORIZATION_TYPE, af as AUTH_MUTATION, $ as AbortablePromise, cc as AddressData, cF as AddressInfo, aP as AmountToPay, cn as AuthResponse, A as AuthService, m as AuthStatus, cH as AuthenticatedCustomer, cJ as AuthenticatedData, c0 as AvailabilityCheck, c1 as AvailabilityResult, bF as AvailableSlot, bI as Booking, bH as BookingStatus, bJ as BookingWithDetails, b7 as BufferTimes, bm as Business, bA as BusinessHours, bl as BusinessPreferences, B as BusinessService, bz as BusinessSettings, bk as BusinessType, bx as BusinessWithLocations, a3 as CHECKOUT_MODE, ag as CHECKOUT_MUTATION, a6 as CHECKOUT_STEP, ac as CONTACT_TYPE, bQ as CancelBookingInput, bR as CancelBookingResult, b1 as CancelOrderInput, b9 as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aC as CatalogueResult, aD as CatalogueSnapshot, bB as CategoryInfo, bN as CheckSlotAvailabilityInput, bO as CheckSlotAvailabilityResult, cq as CheckoutAddressInfo, cN as CheckoutCartData, cM as CheckoutCartItem, cs as CheckoutCustomerInfo, N as CheckoutFormData, a$ as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, Z as CheckoutStatus, _ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a2 as ContactType, c8 as CreateAddressInput, ca as CreateMobileMoneyInput, c3 as Customer, c4 as CustomerAddress, bL as CustomerBooking, bK as CustomerBookingServiceItem, c6 as CustomerLinkPreferences, c5 as CustomerMobileMoney, b6 as CustomerServicePreferences, ak as DEFAULT_COUNTRY, aj as DEFAULT_CURRENCY, ab as DEVICE_TYPE, bG as DayAvailability, bg as DepositResult, a1 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cE as ElementAppearance, cQ as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cK as ElementsCheckoutData, cL as ElementsCheckoutResult, cI as ElementsCustomerInfo, w as ElementsOptions, ce as EnrollAndLinkOrderInput, ch as EnrollAndLinkOrderResult, cb as EnrollmentData, an as Err, aO as FeeBearerType, F as FetchQuoteInput, aM as FulfillmentLink, aL as FulfillmentStatus, aK as FulfillmentType, cu as FxQuote, ct as FxQuoteRequest, cv as FxRateResponse, q as FxService, bM as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cP as IframeToParentMessage, I as InventoryService, c2 as InventorySummary, ae as LINK_MUTATION, ad as LINK_QUERY, aQ as LineItem, aH as LineType, c7 as LinkData, cg as LinkEnrollResult, L as LinkService, ci as LinkSession, cf as LinkStatusResult, r as LiteBootstrap, p as LiteService, bp as Location, bj as LocationAppointment, b$ as LocationStock, bn as LocationTaxBehavior, bo as LocationTaxOverrides, bs as LocationTimeProfile, by as LocationWithDetails, M as MESSAGE_TYPES, a9 as MOBILE_MONEY_PROVIDER, cd as MobileMoneyData, cr as MobileMoneyDetails, a0 as MobileMoneyProvider, ai as ORDER_MUTATION, a4 as ORDER_TYPE, cC as ObservabilityHooks, am as Ok, aR as Order, aG as OrderChannel, a_ as OrderFilter, aN as OrderFulfillmentSummary, aU as OrderGroup, aY as OrderGroupDetails, aV as OrderGroupPayment, aT as OrderGroupPaymentState, aX as OrderGroupPaymentSummary, aS as OrderHistory, aI as OrderLineState, aJ as OrderLineStatus, aZ as OrderPaymentEvent, O as OrderQueries, aW as OrderSplitDetail, aE as OrderStatus, cD as OrderType, n as OtpResult, a5 as PAYMENT_METHOD, ah as PAYMENT_MUTATION, a7 as PAYMENT_STATE, a8 as PICKUP_TIME_TYPE, cO as ParentToIframeMessage, cG as PaymentMethodInfo, aF as PaymentState, cp as PickupTime, co as PickupTimeType, P as PriceQuote, bb as PricingOverrides, Y as ProcessAndResolveOptions, W as ProcessCheckoutOptions, X as ProcessCheckoutResult, bZ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b2 as RefundOrderInput, b5 as ReminderMethod, b8 as ReminderSettings, cw as RequestContext, cz as RequestErrorEvent, cl as RequestOtpInput, cx as RequestStartEvent, cy as RequestSuccessEvent, bP as RescheduleBookingInput, bS as RescheduleBookingResult, be as ResourceAssignment, al as Result, cA as RetryEvent, ck as RevokeAllSessionsResult, cj as RevokeSessionResult, bu as Room, bc as SchedulingMetadata, bf as SchedulingResult, o as SchedulingService, S as SearchOptions, bC as Service, bT as ServiceAvailabilityParams, bU as ServiceAvailabilityResult, bv as ServiceCharge, ba as ServiceNotes, bh as ServiceScheduleRequest, b3 as ServiceStatus, cB as SessionChangeEvent, bD as Staff, bd as StaffAssignment, b4 as StaffRole, bi as StaffScheduleItem, bX as Stock, bY as StockLevel, bV as StockOwnershipType, bW as StockStatus, bw as StorefrontBootstrap, bt as Table, T as TableInfo, bq as TimeRange, br as TimeRanges, bE as TimeSlot, c9 as UpdateAddressInput, b0 as UpdateOrderStatusInput, U as UpdateProfileInput, b_ as VariantStock, cm as VerifyOtpInput, aA as combine, aB as combineObject, c as createCimplifyClient, u as createElements, ap as err, au as flatMap, ay as fromPromise, k as generateIdempotencyKey, av as getOrElse, ar as isErr, aq as isOk, at as mapError, as as mapResult, ao as ok, ax as toNullable, az as tryCatch, aw as unwrap } from './client-8SahVQEy.js';
2
2
  export { QueryBuilder, query } from './advanced.js';
3
3
  import { A as ApiError } from './payment-CLIWNMaP.js';
4
4
  export { B as AddOn, at as AddOnDetails, aP as AddOnGroupDetails, G as AddOnOption, aO as AddOnOptionDetails, H as AddOnOptionPrice, F as AddOnWithOptions, aU as AddToCartInput, ai as AdjustmentType, ap as AppliedDiscount, a_ as AuthorizationType, ao as BenefitType, T as Bundle, Y as BundleComponentData, _ as BundleComponentInfo, R as BundlePriceType, W as BundleProduct, ay as BundleSelectionData, aw as BundleSelectionInput, ax as BundleStoredSelection, U as BundleSummary, X as BundleWithDetails, aD as Cart, au as CartAddOn, ag as CartChannel, aE as CartItem, aR as CartItemDetails, af as CartStatus, aW as CartSummary, aF as CartTotals, K as Category, L as CategorySummary, an as ChosenPrice, h as CimplifyError, N as Collection, Q as CollectionProduct, O as CollectionSummary, a4 as ComponentGroup, a5 as ComponentGroupWithComponents, a9 as ComponentPriceBreakdown, a7 as ComponentSelectionInput, a1 as ComponentSourceType, a2 as Composite, a6 as CompositeComponent, aA as CompositePriceBreakdown, a8 as CompositePriceResult, $ as CompositePricingMode, aB as CompositeSelectionData, a7 as CompositeSelectionInput, az as CompositeStoredSelection, a3 as CompositeWithDetails, b as Currency, C as CurrencyCode, p as DepositType, D as DigitalProductType, aq as DiscountBreakdown, ar as DiscountDetails, aI as DisplayAddOn, aJ as DisplayAddOnOption, aG as DisplayCart, aH as DisplayCartItem, g as ERROR_HINTS, E as ErrorCode, e as ErrorCodeType, f as ErrorHint, a0 as GroupPricingBehavior, b2 as InitializePaymentResult, I as InventoryType, aC as LineConfiguration, ac as LocationProductPrice, M as Money, d as Pagination, P as PaginationParams, b1 as Payment, b5 as PaymentErrorDetails, b0 as PaymentMethod, aZ as PaymentMethodType, a$ as PaymentProcessingState, aY as PaymentProvider, b3 as PaymentResponse, aX as PaymentStatus, b4 as PaymentStatusResponse, ab as Price, aj as PriceAdjustment, am as PriceDecisionPath, aa as PriceEntryType, al as PricePathTaxInfo, ah as PriceSource, q as Product, J as ProductAddOn, ad as ProductAvailability, o as ProductRenderHint, ae as ProductTimeProfile, n as ProductType, s as ProductVariant, x as ProductVariantValue, r as ProductWithDetails, S as SalesChannel, as as SelectedAddOnOption, b6 as SubmitAuthorizationInput, ak as TaxPathComponent, aS as UICart, aK as UICartBusiness, aM as UICartCustomer, aL as UICartLocation, aN as UICartPricing, aT as UICartResponse, aV as UpdateCartItemInput, u as VariantAxis, z as VariantAxisSelection, w as VariantAxisValue, v as VariantAxisWithValues, av as VariantDetails, aQ as VariantDetailsDTO, t as VariantDisplayAttribute, y as VariantLocationAvailability, V as VariantStrategy, Z as ZERO, c as currencyCode, k as enrichError, j as getErrorHint, i as isCimplifyError, l as isRetryableError, m as money, a as moneyFromNumber } from './payment-CLIWNMaP.js';
package/dist/index.js CHANGED
@@ -3168,6 +3168,7 @@ var CimplifyElement = class {
3168
3168
  this.iframe = null;
3169
3169
  this.container = null;
3170
3170
  this.mounted = false;
3171
+ this.pendingInit = null;
3171
3172
  this.eventHandlers = /* @__PURE__ */ new Map();
3172
3173
  this.resolvers = /* @__PURE__ */ new Map();
3173
3174
  this.listening = false;
@@ -3293,23 +3294,9 @@ var CimplifyElement = class {
3293
3294
  );
3294
3295
  this.iframe = iframe;
3295
3296
  this.container.appendChild(iframe);
3296
- iframe.onload = () => {
3297
- const publicKey = this.parent.getPublicKey();
3298
- this.sendMessage({
3299
- type: MESSAGE_TYPES.INIT,
3300
- businessId: resolvedBusinessId,
3301
- publicKey,
3302
- demoMode: publicKey.length === 0,
3303
- prefillEmail: this.options.prefillEmail,
3304
- appearance: this.parent.getAppearance(),
3305
- orderTypes: this.options.orderTypes,
3306
- defaultOrderType: this.options.defaultOrderType,
3307
- renderSubmitButton: true
3308
- });
3309
- const token = this.parent.getAccessToken();
3310
- if (token && this.type !== ELEMENT_TYPES.AUTH) {
3311
- this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
3312
- }
3297
+ this.pendingInit = {
3298
+ businessId: resolvedBusinessId,
3299
+ publicKey: this.parent.getPublicKey()
3313
3300
  };
3314
3301
  }
3315
3302
  handleMessage(event) {
@@ -3330,6 +3317,25 @@ var CimplifyElement = class {
3330
3317
  switch (message.type) {
3331
3318
  case MESSAGE_TYPES.READY:
3332
3319
  if (this.iframe && message.height) this.iframe.style.height = `${message.height}px`;
3320
+ if (this.pendingInit) {
3321
+ const { publicKey } = this.pendingInit;
3322
+ this.sendMessage({
3323
+ type: MESSAGE_TYPES.INIT,
3324
+ businessId: this.pendingInit.businessId,
3325
+ publicKey,
3326
+ demoMode: publicKey.length === 0,
3327
+ prefillEmail: this.options.prefillEmail,
3328
+ appearance: this.parent.getAppearance(),
3329
+ orderTypes: this.options.orderTypes,
3330
+ defaultOrderType: this.options.defaultOrderType,
3331
+ renderSubmitButton: true
3332
+ });
3333
+ const token = this.parent.getAccessToken();
3334
+ if (token && this.type !== ELEMENT_TYPES.AUTH) {
3335
+ this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
3336
+ }
3337
+ this.pendingInit = null;
3338
+ }
3333
3339
  this.emit(EVENT_TYPES.READY, { height: message.height });
3334
3340
  break;
3335
3341
  case MESSAGE_TYPES.HEIGHT_CHANGE:
package/dist/index.mjs CHANGED
@@ -3166,6 +3166,7 @@ var CimplifyElement = class {
3166
3166
  this.iframe = null;
3167
3167
  this.container = null;
3168
3168
  this.mounted = false;
3169
+ this.pendingInit = null;
3169
3170
  this.eventHandlers = /* @__PURE__ */ new Map();
3170
3171
  this.resolvers = /* @__PURE__ */ new Map();
3171
3172
  this.listening = false;
@@ -3291,23 +3292,9 @@ var CimplifyElement = class {
3291
3292
  );
3292
3293
  this.iframe = iframe;
3293
3294
  this.container.appendChild(iframe);
3294
- iframe.onload = () => {
3295
- const publicKey = this.parent.getPublicKey();
3296
- this.sendMessage({
3297
- type: MESSAGE_TYPES.INIT,
3298
- businessId: resolvedBusinessId,
3299
- publicKey,
3300
- demoMode: publicKey.length === 0,
3301
- prefillEmail: this.options.prefillEmail,
3302
- appearance: this.parent.getAppearance(),
3303
- orderTypes: this.options.orderTypes,
3304
- defaultOrderType: this.options.defaultOrderType,
3305
- renderSubmitButton: true
3306
- });
3307
- const token = this.parent.getAccessToken();
3308
- if (token && this.type !== ELEMENT_TYPES.AUTH) {
3309
- this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
3310
- }
3295
+ this.pendingInit = {
3296
+ businessId: resolvedBusinessId,
3297
+ publicKey: this.parent.getPublicKey()
3311
3298
  };
3312
3299
  }
3313
3300
  handleMessage(event) {
@@ -3328,6 +3315,25 @@ var CimplifyElement = class {
3328
3315
  switch (message.type) {
3329
3316
  case MESSAGE_TYPES.READY:
3330
3317
  if (this.iframe && message.height) this.iframe.style.height = `${message.height}px`;
3318
+ if (this.pendingInit) {
3319
+ const { publicKey } = this.pendingInit;
3320
+ this.sendMessage({
3321
+ type: MESSAGE_TYPES.INIT,
3322
+ businessId: this.pendingInit.businessId,
3323
+ publicKey,
3324
+ demoMode: publicKey.length === 0,
3325
+ prefillEmail: this.options.prefillEmail,
3326
+ appearance: this.parent.getAppearance(),
3327
+ orderTypes: this.options.orderTypes,
3328
+ defaultOrderType: this.options.defaultOrderType,
3329
+ renderSubmitButton: true
3330
+ });
3331
+ const token = this.parent.getAccessToken();
3332
+ if (token && this.type !== ELEMENT_TYPES.AUTH) {
3333
+ this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
3334
+ }
3335
+ this.pendingInit = null;
3336
+ }
3331
3337
  this.emit(EVENT_TYPES.READY, { height: message.height });
3332
3338
  break;
3333
3339
  case MESSAGE_TYPES.HEIGHT_CHANGE:
package/dist/react.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as CimplifyClient, X as ProcessCheckoutResult, Z as CheckoutStatus, _ as CheckoutStatusContext, bp as Location, bm as Business, aR as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cJ as AuthenticatedData, cF as AddressInfo, cG as PaymentMethodInfo, cL as ElementsCheckoutResult, W as ProcessCheckoutOptions } from './client-DnAfLDhV.mjs';
1
+ import { C as CimplifyClient, X as ProcessCheckoutResult, Z as CheckoutStatus, _ as CheckoutStatusContext, bp as Location, bm as Business, aR as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cJ as AuthenticatedData, cF as AddressInfo, cG as PaymentMethodInfo, cL as ElementsCheckoutResult, W as ProcessCheckoutOptions } from './client-iRG2DBq0.mjs';
2
2
  import React, { ReactNode } from 'react';
3
3
  import { q as Product, d as Pagination, h as CimplifyError, r as ProductWithDetails, K as Category, aw as BundleSelectionInput, a7 as ComponentSelectionInput, N as Collection, X as BundleWithDetails, a3 as CompositeWithDetails, a8 as CompositePriceResult, C as CurrencyCode } from './payment-CLIWNMaP.mjs';
4
4
  import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-t3FBTU8p.mjs';
package/dist/react.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as CimplifyClient, X as ProcessCheckoutResult, Z as CheckoutStatus, _ as CheckoutStatusContext, bp as Location, bm as Business, aR as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cJ as AuthenticatedData, cF as AddressInfo, cG as PaymentMethodInfo, cL as ElementsCheckoutResult, W as ProcessCheckoutOptions } from './client-hKTJv1I1.js';
1
+ import { C as CimplifyClient, X as ProcessCheckoutResult, Z as CheckoutStatus, _ as CheckoutStatusContext, bp as Location, bm as Business, aR as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cJ as AuthenticatedData, cF as AddressInfo, cG as PaymentMethodInfo, cL as ElementsCheckoutResult, W as ProcessCheckoutOptions } from './client-8SahVQEy.js';
2
2
  import React, { ReactNode } from 'react';
3
3
  import { q as Product, d as Pagination, h as CimplifyError, r as ProductWithDetails, K as Category, aw as BundleSelectionInput, a7 as ComponentSelectionInput, N as Collection, X as BundleWithDetails, a3 as CompositeWithDetails, a8 as CompositePriceResult, C as CurrencyCode } from './payment-CLIWNMaP.js';
4
4
  import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-t3FBTU8p.js';
package/dist/react.js CHANGED
@@ -3346,6 +3346,7 @@ var CimplifyElement = class {
3346
3346
  this.iframe = null;
3347
3347
  this.container = null;
3348
3348
  this.mounted = false;
3349
+ this.pendingInit = null;
3349
3350
  this.eventHandlers = /* @__PURE__ */ new Map();
3350
3351
  this.resolvers = /* @__PURE__ */ new Map();
3351
3352
  this.listening = false;
@@ -3471,23 +3472,9 @@ var CimplifyElement = class {
3471
3472
  );
3472
3473
  this.iframe = iframe;
3473
3474
  this.container.appendChild(iframe);
3474
- iframe.onload = () => {
3475
- const publicKey = this.parent.getPublicKey();
3476
- this.sendMessage({
3477
- type: MESSAGE_TYPES.INIT,
3478
- businessId: resolvedBusinessId,
3479
- publicKey,
3480
- demoMode: publicKey.length === 0,
3481
- prefillEmail: this.options.prefillEmail,
3482
- appearance: this.parent.getAppearance(),
3483
- orderTypes: this.options.orderTypes,
3484
- defaultOrderType: this.options.defaultOrderType,
3485
- renderSubmitButton: true
3486
- });
3487
- const token = this.parent.getAccessToken();
3488
- if (token && this.type !== ELEMENT_TYPES.AUTH) {
3489
- this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
3490
- }
3475
+ this.pendingInit = {
3476
+ businessId: resolvedBusinessId,
3477
+ publicKey: this.parent.getPublicKey()
3491
3478
  };
3492
3479
  }
3493
3480
  handleMessage(event) {
@@ -3508,6 +3495,25 @@ var CimplifyElement = class {
3508
3495
  switch (message.type) {
3509
3496
  case MESSAGE_TYPES.READY:
3510
3497
  if (this.iframe && message.height) this.iframe.style.height = `${message.height}px`;
3498
+ if (this.pendingInit) {
3499
+ const { publicKey } = this.pendingInit;
3500
+ this.sendMessage({
3501
+ type: MESSAGE_TYPES.INIT,
3502
+ businessId: this.pendingInit.businessId,
3503
+ publicKey,
3504
+ demoMode: publicKey.length === 0,
3505
+ prefillEmail: this.options.prefillEmail,
3506
+ appearance: this.parent.getAppearance(),
3507
+ orderTypes: this.options.orderTypes,
3508
+ defaultOrderType: this.options.defaultOrderType,
3509
+ renderSubmitButton: true
3510
+ });
3511
+ const token = this.parent.getAccessToken();
3512
+ if (token && this.type !== ELEMENT_TYPES.AUTH) {
3513
+ this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
3514
+ }
3515
+ this.pendingInit = null;
3516
+ }
3511
3517
  this.emit(EVENT_TYPES.READY, { height: message.height });
3512
3518
  break;
3513
3519
  case MESSAGE_TYPES.HEIGHT_CHANGE:
package/dist/react.mjs CHANGED
@@ -3340,6 +3340,7 @@ var CimplifyElement = class {
3340
3340
  this.iframe = null;
3341
3341
  this.container = null;
3342
3342
  this.mounted = false;
3343
+ this.pendingInit = null;
3343
3344
  this.eventHandlers = /* @__PURE__ */ new Map();
3344
3345
  this.resolvers = /* @__PURE__ */ new Map();
3345
3346
  this.listening = false;
@@ -3465,23 +3466,9 @@ var CimplifyElement = class {
3465
3466
  );
3466
3467
  this.iframe = iframe;
3467
3468
  this.container.appendChild(iframe);
3468
- iframe.onload = () => {
3469
- const publicKey = this.parent.getPublicKey();
3470
- this.sendMessage({
3471
- type: MESSAGE_TYPES.INIT,
3472
- businessId: resolvedBusinessId,
3473
- publicKey,
3474
- demoMode: publicKey.length === 0,
3475
- prefillEmail: this.options.prefillEmail,
3476
- appearance: this.parent.getAppearance(),
3477
- orderTypes: this.options.orderTypes,
3478
- defaultOrderType: this.options.defaultOrderType,
3479
- renderSubmitButton: true
3480
- });
3481
- const token = this.parent.getAccessToken();
3482
- if (token && this.type !== ELEMENT_TYPES.AUTH) {
3483
- this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
3484
- }
3469
+ this.pendingInit = {
3470
+ businessId: resolvedBusinessId,
3471
+ publicKey: this.parent.getPublicKey()
3485
3472
  };
3486
3473
  }
3487
3474
  handleMessage(event) {
@@ -3502,6 +3489,25 @@ var CimplifyElement = class {
3502
3489
  switch (message.type) {
3503
3490
  case MESSAGE_TYPES.READY:
3504
3491
  if (this.iframe && message.height) this.iframe.style.height = `${message.height}px`;
3492
+ if (this.pendingInit) {
3493
+ const { publicKey } = this.pendingInit;
3494
+ this.sendMessage({
3495
+ type: MESSAGE_TYPES.INIT,
3496
+ businessId: this.pendingInit.businessId,
3497
+ publicKey,
3498
+ demoMode: publicKey.length === 0,
3499
+ prefillEmail: this.options.prefillEmail,
3500
+ appearance: this.parent.getAppearance(),
3501
+ orderTypes: this.options.orderTypes,
3502
+ defaultOrderType: this.options.defaultOrderType,
3503
+ renderSubmitButton: true
3504
+ });
3505
+ const token = this.parent.getAccessToken();
3506
+ if (token && this.type !== ELEMENT_TYPES.AUTH) {
3507
+ this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
3508
+ }
3509
+ this.pendingInit = null;
3510
+ }
3505
3511
  this.emit(EVENT_TYPES.READY, { height: message.height });
3506
3512
  break;
3507
3513
  case MESSAGE_TYPES.HEIGHT_CHANGE:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/sdk",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "Cimplify Commerce SDK for storefronts",
5
5
  "keywords": [
6
6
  "cimplify",