@cimplify/sdk 0.6.3 → 0.6.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.
- package/dist/{ads-Cz14AMnc.d.mts → ads-CmO7VVPP.d.mts} +2 -0
- package/dist/{ads-Cz14AMnc.d.ts → ads-CmO7VVPP.d.ts} +2 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +64 -24
- package/dist/index.mjs +64 -24
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/package.json +1 -1
|
@@ -2235,6 +2235,8 @@ interface ProcessCheckoutResult {
|
|
|
2235
2235
|
}
|
|
2236
2236
|
interface ProcessAndResolveOptions {
|
|
2237
2237
|
enroll_in_link?: boolean;
|
|
2238
|
+
/** Disable card payment popups (e.g. server-side execution). Defaults to true in browsers. */
|
|
2239
|
+
allow_popups?: boolean;
|
|
2238
2240
|
poll_interval_ms?: number;
|
|
2239
2241
|
max_poll_attempts?: number;
|
|
2240
2242
|
on_status_change?: (status: CheckoutStatus, context: CheckoutStatusContext) => void;
|
|
@@ -2235,6 +2235,8 @@ interface ProcessCheckoutResult {
|
|
|
2235
2235
|
}
|
|
2236
2236
|
interface ProcessAndResolveOptions {
|
|
2237
2237
|
enroll_in_link?: boolean;
|
|
2238
|
+
/** Disable card payment popups (e.g. server-side execution). Defaults to true in browsers. */
|
|
2239
|
+
allow_popups?: boolean;
|
|
2238
2240
|
poll_interval_ms?: number;
|
|
2239
2241
|
max_poll_attempts?: number;
|
|
2240
2242
|
on_status_change?: (status: CheckoutStatus, context: CheckoutStatusContext) => void;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-
|
|
2
|
-
export { ah as AUTHORIZATION_TYPE, am as AUTH_MUTATION, a6 as AbortablePromise, eM as AdConfig, eO as AdContextValue, eN as AdCreative, eK as AdPosition, eJ as AdSlot, eL as AdTheme, b6 as AddOn, bR as AddOnDetails, cb as AddOnGroupDetails, b8 as AddOnOption, ca as AddOnOptionDetails, b9 as AddOnOptionPrice, b7 as AddOnWithOptions, cg as AddToCartInput, e7 as AddressData, ez as AddressInfo, bG as AdjustmentType, cu as AmountToPay, bN as AppliedDiscount, ei as AuthResponse, p as AuthService, q as AuthStatus, eB as AuthenticatedCustomer, eD as AuthenticatedData, d2 as AuthorizationType, dX as AvailabilityCheck, dY as AvailabilityResult, dF as AvailableSlot, bM as BenefitType, dI as Booking, dz as BookingRequirementOverride, dH as BookingStatus, dJ as BookingWithDetails, cO as BufferTimes, bh as Bundle, bl as BundleComponentData, bm as BundleComponentInfo, bg as BundlePriceType, bj as BundleProduct, bW as BundleSelectionData, bU as BundleSelectionInput, bV as BundleStoredSelection, bi as BundleSummary, bk as BundleWithDetails, da as Business, dp as BusinessHours, d9 as BusinessPreferences, B as BusinessService, dn as BusinessSettings, d8 as BusinessType, dl as BusinessWithLocations, aa as CHECKOUT_MODE, an as CHECKOUT_MUTATION, ad as CHECKOUT_STEP, aj as CONTACT_TYPE, dN as CancelBookingInput, cI as CancelOrderInput, cQ as CancellationPolicy, b$ as Cart, bS as CartAddOn, bE as CartChannel, c0 as CartItem, cd as CartItemDetails, l as CartOperations, bD as CartStatus, ci as CartSummary, c1 as CartTotals, e as CatalogueQueries, bb as Category, dq as CategoryInfo, bc as CategorySummary, s as ChangePasswordInput, dL as CheckSlotAvailabilityInput, el as CheckoutAddressInfo, en as CheckoutCustomerInfo, $ as CheckoutFormData, cG as CheckoutInput, X as CheckoutMode, m as CheckoutOperations, Y as CheckoutOrderType, Z as CheckoutPaymentMethod, a0 as CheckoutResult, m as CheckoutService, a4 as CheckoutStatus, a5 as CheckoutStatusContext, _ as CheckoutStep, bL as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, z as CimplifyElement, y as CimplifyElements, ay as CimplifyError, bd as Collection, bf as CollectionProduct, be as CollectionSummary, bs as ComponentGroup, bt as ComponentGroupWithComponents, bx as ComponentPriceBreakdown, bv as ComponentSelectionInput, bp as ComponentSourceType, bq as Composite, bu as CompositeComponent, bY as CompositePriceBreakdown, bw as CompositePriceResult, bn as CompositePricingMode, bZ as CompositeSelectionData, bv as CompositeSelectionInput, bX as CompositeStoredSelection, br as CompositeWithDetails, a9 as ContactType, e3 as CreateAddressInput, e5 as CreateMobileMoneyInput, at as Currency, d_ as Customer, d$ as CustomerAddress, e1 as CustomerLinkPreferences, e0 as CustomerMobileMoney, cN as CustomerServicePreferences, ar as DEFAULT_COUNTRY, aq as DEFAULT_CURRENCY, ai as DEVICE_TYPE, dG as DayAvailability, cX as DepositResult, aW as DepositType, a8 as DeviceType, aV as DigitalProductType, bO as DiscountBreakdown, bP as DiscountDetails, c4 as DisplayAddOn, c5 as DisplayAddOnOption, c2 as DisplayCart, c3 as DisplayCartItem, H as ELEMENT_TYPES, E as EVENT_TYPES, ey as ElementAppearance, eI as ElementEventHandler, W as ElementEventType, N as ElementOptions, V as ElementType, eE as ElementsCheckoutData, eF as ElementsCheckoutResult, eC as ElementsCustomerInfo, J as ElementsOptions, e9 as EnrollAndLinkOrderInput, ec as EnrollAndLinkOrderResult, e6 as EnrollmentData, aD as Err, aw as ErrorCode, ax as ErrorCodeType, ct as FeeBearerType, F as FetchQuoteInput, cr as FulfillmentLink, cq as FulfillmentStatus, cp as FulfillmentType, ep as FxQuote, eo as FxQuoteRequest, eq as FxRateResponse, v as FxService, dK as GetAvailableSlotsInput, o as GetOrdersOptions, G as GetProductsOptions, bo as GroupPricingBehavior, eH as IframeToParentMessage, d6 as InitializePaymentResult, I as InventoryService, dZ as InventorySummary, aT as InventoryType, K as KitchenOrderItem, x as KitchenOrderResult, al as LINK_MUTATION, ak as LINK_QUERY, b_ as LineConfiguration, cv as LineItem, cm as LineType, e2 as LinkData, eb as LinkEnrollResult, L as LinkService, ed as LinkSession, ea as LinkStatusResult, w as LiteBootstrap, u as LiteService, dd as Location, c_ as LocationAppointment, bA as LocationProductPrice, dW as LocationStock, db as LocationTaxBehavior, dc as LocationTaxOverrides, dg as LocationTimeProfile, dm as LocationWithDetails, M as MESSAGE_TYPES, ag as MOBILE_MONEY_PROVIDER, e8 as MobileMoneyData, em as MobileMoneyDetails, a7 as MobileMoneyProvider, as as Money, ap as ORDER_MUTATION, ab as ORDER_TYPE, ex as ObservabilityHooks, aC as Ok, cw as Order, cl as OrderChannel, cF as OrderFilter, cs as OrderFulfillmentSummary, cz as OrderGroup, cD as OrderGroupDetails, cA as OrderGroupPayment, cy as OrderGroupPaymentState, cC as OrderGroupPaymentSummary, cx as OrderHistory, cn as OrderLineState, co as OrderLineStatus, cE as OrderPaymentEvent, O as OrderQueries, cB as OrderSplitDetail, cj as OrderStatus, r as OtpResult, ac as PAYMENT_METHOD, ao as PAYMENT_MUTATION, ae as PAYMENT_STATE, af as PICKUP_TIME_TYPE, av as Pagination, au as PaginationParams, eG as ParentToIframeMessage, d5 as Payment, d4 as PaymentMethod, eA as PaymentMethodInfo, d1 as PaymentMethodType, d3 as PaymentProcessingState, d0 as PaymentProvider, ck as PaymentState, c$ as PaymentStatus, ek as PickupTime, ej as PickupTimeType, bz as Price, bH as PriceAdjustment, bK as PriceDecisionPath, by as PriceEntryType, bJ as PricePathTaxInfo, j as PriceQuote, bF as PriceSource, cS as PricingOverrides, a3 as ProcessAndResolveOptions, a1 as ProcessCheckoutOptions, a2 as ProcessCheckoutResult, aY as Product, ba as ProductAddOn, bB as ProductAvailability, dU as ProductStock, bC as ProductTimeProfile, aS as ProductType, a_ as ProductVariant, b3 as ProductVariantValue, aZ as ProductWithDetails, f as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, h as QuoteDynamicBuckets, g as QuoteStatus, i as QuoteUiMessage, R as RefreshQuoteInput, k as RefreshQuoteResult, cJ as RefundOrderInput, cM as ReminderMethod, cP as ReminderSettings, er as RequestContext, eu as RequestErrorEvent, eg as RequestOtpInput, es as RequestStartEvent, et as RequestSuccessEvent, dM as RescheduleBookingInput, cV as ResourceAssignment, dw as ResourceAvailabilityException, dv as ResourceAvailabilityRule, dA as ResourceType, aB as Result, ev as RetryEvent, ef as RevokeAllSessionsResult, ee as RevokeSessionResult, di as Room, aX as SalesChannel, cT as SchedulingMetadata, cW as SchedulingResult, t as SchedulingService, S as SearchOptions, bQ as SelectedAddOnOption, dB as Service, ds as ServiceAvailabilityException, dO as ServiceAvailabilityParams, dP as ServiceAvailabilityResult, dr as ServiceAvailabilityRule, dj as ServiceCharge, cR as ServiceNotes, cY as ServiceScheduleRequest, dy as ServiceStaffRequirement, cK as ServiceStatus, dC as ServiceWithStaff, ew as SessionChangeEvent, dD as Staff, cU as StaffAssignment, du as StaffAvailabilityException, dt as StaffAvailabilityRule, dx as StaffBookingProfile, cL as StaffRole, cZ as StaffScheduleItem, dS as Stock, dT as StockLevel, dQ as StockOwnershipType, dR as StockStatus, dk as StorefrontBootstrap, d7 as SubmitAuthorizationInput, dh as Table, T as TableInfo, bI as TaxPathComponent, de as TimeRange, df as TimeRanges, dE as TimeSlot, ce as UICart, c6 as UICartBusiness, c8 as UICartCustomer, c7 as UICartLocation, c9 as UICartPricing, cf as UICartResponse, e4 as UpdateAddressInput, ch as UpdateCartItemInput, cH as UpdateOrderStatusInput, U as UpdateProfileInput, b0 as VariantAxis, b5 as VariantAxisSelection, b2 as VariantAxisValue, b1 as VariantAxisWithValues, bT as VariantDetails, cc as VariantDetailsDTO, a$ as VariantDisplayAttribute, b4 as VariantLocationAvailability, dV as VariantStock, aU as VariantStrategy, eh as VerifyOtpInput, aQ as combine, aR as combineObject, c as createCimplifyClient, D as createElements, aF as err, aK as flatMap, aO as fromPromise, n as generateIdempotencyKey, aL as getOrElse, az as isCimplifyError, aH as isErr, aG as isOk, aA as isRetryableError, aJ as mapError, aI as mapResult, aE as ok, aN as toNullable, aP as tryCatch, aM as unwrap } from './ads-
|
|
1
|
+
import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-CmO7VVPP.mjs';
|
|
2
|
+
export { ah as AUTHORIZATION_TYPE, am as AUTH_MUTATION, a6 as AbortablePromise, eM as AdConfig, eO as AdContextValue, eN as AdCreative, eK as AdPosition, eJ as AdSlot, eL as AdTheme, b6 as AddOn, bR as AddOnDetails, cb as AddOnGroupDetails, b8 as AddOnOption, ca as AddOnOptionDetails, b9 as AddOnOptionPrice, b7 as AddOnWithOptions, cg as AddToCartInput, e7 as AddressData, ez as AddressInfo, bG as AdjustmentType, cu as AmountToPay, bN as AppliedDiscount, ei as AuthResponse, p as AuthService, q as AuthStatus, eB as AuthenticatedCustomer, eD as AuthenticatedData, d2 as AuthorizationType, dX as AvailabilityCheck, dY as AvailabilityResult, dF as AvailableSlot, bM as BenefitType, dI as Booking, dz as BookingRequirementOverride, dH as BookingStatus, dJ as BookingWithDetails, cO as BufferTimes, bh as Bundle, bl as BundleComponentData, bm as BundleComponentInfo, bg as BundlePriceType, bj as BundleProduct, bW as BundleSelectionData, bU as BundleSelectionInput, bV as BundleStoredSelection, bi as BundleSummary, bk as BundleWithDetails, da as Business, dp as BusinessHours, d9 as BusinessPreferences, B as BusinessService, dn as BusinessSettings, d8 as BusinessType, dl as BusinessWithLocations, aa as CHECKOUT_MODE, an as CHECKOUT_MUTATION, ad as CHECKOUT_STEP, aj as CONTACT_TYPE, dN as CancelBookingInput, cI as CancelOrderInput, cQ as CancellationPolicy, b$ as Cart, bS as CartAddOn, bE as CartChannel, c0 as CartItem, cd as CartItemDetails, l as CartOperations, bD as CartStatus, ci as CartSummary, c1 as CartTotals, e as CatalogueQueries, bb as Category, dq as CategoryInfo, bc as CategorySummary, s as ChangePasswordInput, dL as CheckSlotAvailabilityInput, el as CheckoutAddressInfo, en as CheckoutCustomerInfo, $ as CheckoutFormData, cG as CheckoutInput, X as CheckoutMode, m as CheckoutOperations, Y as CheckoutOrderType, Z as CheckoutPaymentMethod, a0 as CheckoutResult, m as CheckoutService, a4 as CheckoutStatus, a5 as CheckoutStatusContext, _ as CheckoutStep, bL as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, z as CimplifyElement, y as CimplifyElements, ay as CimplifyError, bd as Collection, bf as CollectionProduct, be as CollectionSummary, bs as ComponentGroup, bt as ComponentGroupWithComponents, bx as ComponentPriceBreakdown, bv as ComponentSelectionInput, bp as ComponentSourceType, bq as Composite, bu as CompositeComponent, bY as CompositePriceBreakdown, bw as CompositePriceResult, bn as CompositePricingMode, bZ as CompositeSelectionData, bv as CompositeSelectionInput, bX as CompositeStoredSelection, br as CompositeWithDetails, a9 as ContactType, e3 as CreateAddressInput, e5 as CreateMobileMoneyInput, at as Currency, d_ as Customer, d$ as CustomerAddress, e1 as CustomerLinkPreferences, e0 as CustomerMobileMoney, cN as CustomerServicePreferences, ar as DEFAULT_COUNTRY, aq as DEFAULT_CURRENCY, ai as DEVICE_TYPE, dG as DayAvailability, cX as DepositResult, aW as DepositType, a8 as DeviceType, aV as DigitalProductType, bO as DiscountBreakdown, bP as DiscountDetails, c4 as DisplayAddOn, c5 as DisplayAddOnOption, c2 as DisplayCart, c3 as DisplayCartItem, H as ELEMENT_TYPES, E as EVENT_TYPES, ey as ElementAppearance, eI as ElementEventHandler, W as ElementEventType, N as ElementOptions, V as ElementType, eE as ElementsCheckoutData, eF as ElementsCheckoutResult, eC as ElementsCustomerInfo, J as ElementsOptions, e9 as EnrollAndLinkOrderInput, ec as EnrollAndLinkOrderResult, e6 as EnrollmentData, aD as Err, aw as ErrorCode, ax as ErrorCodeType, ct as FeeBearerType, F as FetchQuoteInput, cr as FulfillmentLink, cq as FulfillmentStatus, cp as FulfillmentType, ep as FxQuote, eo as FxQuoteRequest, eq as FxRateResponse, v as FxService, dK as GetAvailableSlotsInput, o as GetOrdersOptions, G as GetProductsOptions, bo as GroupPricingBehavior, eH as IframeToParentMessage, d6 as InitializePaymentResult, I as InventoryService, dZ as InventorySummary, aT as InventoryType, K as KitchenOrderItem, x as KitchenOrderResult, al as LINK_MUTATION, ak as LINK_QUERY, b_ as LineConfiguration, cv as LineItem, cm as LineType, e2 as LinkData, eb as LinkEnrollResult, L as LinkService, ed as LinkSession, ea as LinkStatusResult, w as LiteBootstrap, u as LiteService, dd as Location, c_ as LocationAppointment, bA as LocationProductPrice, dW as LocationStock, db as LocationTaxBehavior, dc as LocationTaxOverrides, dg as LocationTimeProfile, dm as LocationWithDetails, M as MESSAGE_TYPES, ag as MOBILE_MONEY_PROVIDER, e8 as MobileMoneyData, em as MobileMoneyDetails, a7 as MobileMoneyProvider, as as Money, ap as ORDER_MUTATION, ab as ORDER_TYPE, ex as ObservabilityHooks, aC as Ok, cw as Order, cl as OrderChannel, cF as OrderFilter, cs as OrderFulfillmentSummary, cz as OrderGroup, cD as OrderGroupDetails, cA as OrderGroupPayment, cy as OrderGroupPaymentState, cC as OrderGroupPaymentSummary, cx as OrderHistory, cn as OrderLineState, co as OrderLineStatus, cE as OrderPaymentEvent, O as OrderQueries, cB as OrderSplitDetail, cj as OrderStatus, r as OtpResult, ac as PAYMENT_METHOD, ao as PAYMENT_MUTATION, ae as PAYMENT_STATE, af as PICKUP_TIME_TYPE, av as Pagination, au as PaginationParams, eG as ParentToIframeMessage, d5 as Payment, d4 as PaymentMethod, eA as PaymentMethodInfo, d1 as PaymentMethodType, d3 as PaymentProcessingState, d0 as PaymentProvider, ck as PaymentState, c$ as PaymentStatus, ek as PickupTime, ej as PickupTimeType, bz as Price, bH as PriceAdjustment, bK as PriceDecisionPath, by as PriceEntryType, bJ as PricePathTaxInfo, j as PriceQuote, bF as PriceSource, cS as PricingOverrides, a3 as ProcessAndResolveOptions, a1 as ProcessCheckoutOptions, a2 as ProcessCheckoutResult, aY as Product, ba as ProductAddOn, bB as ProductAvailability, dU as ProductStock, bC as ProductTimeProfile, aS as ProductType, a_ as ProductVariant, b3 as ProductVariantValue, aZ as ProductWithDetails, f as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, h as QuoteDynamicBuckets, g as QuoteStatus, i as QuoteUiMessage, R as RefreshQuoteInput, k as RefreshQuoteResult, cJ as RefundOrderInput, cM as ReminderMethod, cP as ReminderSettings, er as RequestContext, eu as RequestErrorEvent, eg as RequestOtpInput, es as RequestStartEvent, et as RequestSuccessEvent, dM as RescheduleBookingInput, cV as ResourceAssignment, dw as ResourceAvailabilityException, dv as ResourceAvailabilityRule, dA as ResourceType, aB as Result, ev as RetryEvent, ef as RevokeAllSessionsResult, ee as RevokeSessionResult, di as Room, aX as SalesChannel, cT as SchedulingMetadata, cW as SchedulingResult, t as SchedulingService, S as SearchOptions, bQ as SelectedAddOnOption, dB as Service, ds as ServiceAvailabilityException, dO as ServiceAvailabilityParams, dP as ServiceAvailabilityResult, dr as ServiceAvailabilityRule, dj as ServiceCharge, cR as ServiceNotes, cY as ServiceScheduleRequest, dy as ServiceStaffRequirement, cK as ServiceStatus, dC as ServiceWithStaff, ew as SessionChangeEvent, dD as Staff, cU as StaffAssignment, du as StaffAvailabilityException, dt as StaffAvailabilityRule, dx as StaffBookingProfile, cL as StaffRole, cZ as StaffScheduleItem, dS as Stock, dT as StockLevel, dQ as StockOwnershipType, dR as StockStatus, dk as StorefrontBootstrap, d7 as SubmitAuthorizationInput, dh as Table, T as TableInfo, bI as TaxPathComponent, de as TimeRange, df as TimeRanges, dE as TimeSlot, ce as UICart, c6 as UICartBusiness, c8 as UICartCustomer, c7 as UICartLocation, c9 as UICartPricing, cf as UICartResponse, e4 as UpdateAddressInput, ch as UpdateCartItemInput, cH as UpdateOrderStatusInput, U as UpdateProfileInput, b0 as VariantAxis, b5 as VariantAxisSelection, b2 as VariantAxisValue, b1 as VariantAxisWithValues, bT as VariantDetails, cc as VariantDetailsDTO, a$ as VariantDisplayAttribute, b4 as VariantLocationAvailability, dV as VariantStock, aU as VariantStrategy, eh as VerifyOtpInput, aQ as combine, aR as combineObject, c as createCimplifyClient, D as createElements, aF as err, aK as flatMap, aO as fromPromise, n as generateIdempotencyKey, aL as getOrElse, az as isCimplifyError, aH as isErr, aG as isOk, aA as isRetryableError, aJ as mapError, aI as mapResult, aE as ok, aN as toNullable, aP as tryCatch, aM as unwrap } from './ads-CmO7VVPP.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 './ads-
|
|
2
|
-
export { ah as AUTHORIZATION_TYPE, am as AUTH_MUTATION, a6 as AbortablePromise, eM as AdConfig, eO as AdContextValue, eN as AdCreative, eK as AdPosition, eJ as AdSlot, eL as AdTheme, b6 as AddOn, bR as AddOnDetails, cb as AddOnGroupDetails, b8 as AddOnOption, ca as AddOnOptionDetails, b9 as AddOnOptionPrice, b7 as AddOnWithOptions, cg as AddToCartInput, e7 as AddressData, ez as AddressInfo, bG as AdjustmentType, cu as AmountToPay, bN as AppliedDiscount, ei as AuthResponse, p as AuthService, q as AuthStatus, eB as AuthenticatedCustomer, eD as AuthenticatedData, d2 as AuthorizationType, dX as AvailabilityCheck, dY as AvailabilityResult, dF as AvailableSlot, bM as BenefitType, dI as Booking, dz as BookingRequirementOverride, dH as BookingStatus, dJ as BookingWithDetails, cO as BufferTimes, bh as Bundle, bl as BundleComponentData, bm as BundleComponentInfo, bg as BundlePriceType, bj as BundleProduct, bW as BundleSelectionData, bU as BundleSelectionInput, bV as BundleStoredSelection, bi as BundleSummary, bk as BundleWithDetails, da as Business, dp as BusinessHours, d9 as BusinessPreferences, B as BusinessService, dn as BusinessSettings, d8 as BusinessType, dl as BusinessWithLocations, aa as CHECKOUT_MODE, an as CHECKOUT_MUTATION, ad as CHECKOUT_STEP, aj as CONTACT_TYPE, dN as CancelBookingInput, cI as CancelOrderInput, cQ as CancellationPolicy, b$ as Cart, bS as CartAddOn, bE as CartChannel, c0 as CartItem, cd as CartItemDetails, l as CartOperations, bD as CartStatus, ci as CartSummary, c1 as CartTotals, e as CatalogueQueries, bb as Category, dq as CategoryInfo, bc as CategorySummary, s as ChangePasswordInput, dL as CheckSlotAvailabilityInput, el as CheckoutAddressInfo, en as CheckoutCustomerInfo, $ as CheckoutFormData, cG as CheckoutInput, X as CheckoutMode, m as CheckoutOperations, Y as CheckoutOrderType, Z as CheckoutPaymentMethod, a0 as CheckoutResult, m as CheckoutService, a4 as CheckoutStatus, a5 as CheckoutStatusContext, _ as CheckoutStep, bL as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, z as CimplifyElement, y as CimplifyElements, ay as CimplifyError, bd as Collection, bf as CollectionProduct, be as CollectionSummary, bs as ComponentGroup, bt as ComponentGroupWithComponents, bx as ComponentPriceBreakdown, bv as ComponentSelectionInput, bp as ComponentSourceType, bq as Composite, bu as CompositeComponent, bY as CompositePriceBreakdown, bw as CompositePriceResult, bn as CompositePricingMode, bZ as CompositeSelectionData, bv as CompositeSelectionInput, bX as CompositeStoredSelection, br as CompositeWithDetails, a9 as ContactType, e3 as CreateAddressInput, e5 as CreateMobileMoneyInput, at as Currency, d_ as Customer, d$ as CustomerAddress, e1 as CustomerLinkPreferences, e0 as CustomerMobileMoney, cN as CustomerServicePreferences, ar as DEFAULT_COUNTRY, aq as DEFAULT_CURRENCY, ai as DEVICE_TYPE, dG as DayAvailability, cX as DepositResult, aW as DepositType, a8 as DeviceType, aV as DigitalProductType, bO as DiscountBreakdown, bP as DiscountDetails, c4 as DisplayAddOn, c5 as DisplayAddOnOption, c2 as DisplayCart, c3 as DisplayCartItem, H as ELEMENT_TYPES, E as EVENT_TYPES, ey as ElementAppearance, eI as ElementEventHandler, W as ElementEventType, N as ElementOptions, V as ElementType, eE as ElementsCheckoutData, eF as ElementsCheckoutResult, eC as ElementsCustomerInfo, J as ElementsOptions, e9 as EnrollAndLinkOrderInput, ec as EnrollAndLinkOrderResult, e6 as EnrollmentData, aD as Err, aw as ErrorCode, ax as ErrorCodeType, ct as FeeBearerType, F as FetchQuoteInput, cr as FulfillmentLink, cq as FulfillmentStatus, cp as FulfillmentType, ep as FxQuote, eo as FxQuoteRequest, eq as FxRateResponse, v as FxService, dK as GetAvailableSlotsInput, o as GetOrdersOptions, G as GetProductsOptions, bo as GroupPricingBehavior, eH as IframeToParentMessage, d6 as InitializePaymentResult, I as InventoryService, dZ as InventorySummary, aT as InventoryType, K as KitchenOrderItem, x as KitchenOrderResult, al as LINK_MUTATION, ak as LINK_QUERY, b_ as LineConfiguration, cv as LineItem, cm as LineType, e2 as LinkData, eb as LinkEnrollResult, L as LinkService, ed as LinkSession, ea as LinkStatusResult, w as LiteBootstrap, u as LiteService, dd as Location, c_ as LocationAppointment, bA as LocationProductPrice, dW as LocationStock, db as LocationTaxBehavior, dc as LocationTaxOverrides, dg as LocationTimeProfile, dm as LocationWithDetails, M as MESSAGE_TYPES, ag as MOBILE_MONEY_PROVIDER, e8 as MobileMoneyData, em as MobileMoneyDetails, a7 as MobileMoneyProvider, as as Money, ap as ORDER_MUTATION, ab as ORDER_TYPE, ex as ObservabilityHooks, aC as Ok, cw as Order, cl as OrderChannel, cF as OrderFilter, cs as OrderFulfillmentSummary, cz as OrderGroup, cD as OrderGroupDetails, cA as OrderGroupPayment, cy as OrderGroupPaymentState, cC as OrderGroupPaymentSummary, cx as OrderHistory, cn as OrderLineState, co as OrderLineStatus, cE as OrderPaymentEvent, O as OrderQueries, cB as OrderSplitDetail, cj as OrderStatus, r as OtpResult, ac as PAYMENT_METHOD, ao as PAYMENT_MUTATION, ae as PAYMENT_STATE, af as PICKUP_TIME_TYPE, av as Pagination, au as PaginationParams, eG as ParentToIframeMessage, d5 as Payment, d4 as PaymentMethod, eA as PaymentMethodInfo, d1 as PaymentMethodType, d3 as PaymentProcessingState, d0 as PaymentProvider, ck as PaymentState, c$ as PaymentStatus, ek as PickupTime, ej as PickupTimeType, bz as Price, bH as PriceAdjustment, bK as PriceDecisionPath, by as PriceEntryType, bJ as PricePathTaxInfo, j as PriceQuote, bF as PriceSource, cS as PricingOverrides, a3 as ProcessAndResolveOptions, a1 as ProcessCheckoutOptions, a2 as ProcessCheckoutResult, aY as Product, ba as ProductAddOn, bB as ProductAvailability, dU as ProductStock, bC as ProductTimeProfile, aS as ProductType, a_ as ProductVariant, b3 as ProductVariantValue, aZ as ProductWithDetails, f as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, h as QuoteDynamicBuckets, g as QuoteStatus, i as QuoteUiMessage, R as RefreshQuoteInput, k as RefreshQuoteResult, cJ as RefundOrderInput, cM as ReminderMethod, cP as ReminderSettings, er as RequestContext, eu as RequestErrorEvent, eg as RequestOtpInput, es as RequestStartEvent, et as RequestSuccessEvent, dM as RescheduleBookingInput, cV as ResourceAssignment, dw as ResourceAvailabilityException, dv as ResourceAvailabilityRule, dA as ResourceType, aB as Result, ev as RetryEvent, ef as RevokeAllSessionsResult, ee as RevokeSessionResult, di as Room, aX as SalesChannel, cT as SchedulingMetadata, cW as SchedulingResult, t as SchedulingService, S as SearchOptions, bQ as SelectedAddOnOption, dB as Service, ds as ServiceAvailabilityException, dO as ServiceAvailabilityParams, dP as ServiceAvailabilityResult, dr as ServiceAvailabilityRule, dj as ServiceCharge, cR as ServiceNotes, cY as ServiceScheduleRequest, dy as ServiceStaffRequirement, cK as ServiceStatus, dC as ServiceWithStaff, ew as SessionChangeEvent, dD as Staff, cU as StaffAssignment, du as StaffAvailabilityException, dt as StaffAvailabilityRule, dx as StaffBookingProfile, cL as StaffRole, cZ as StaffScheduleItem, dS as Stock, dT as StockLevel, dQ as StockOwnershipType, dR as StockStatus, dk as StorefrontBootstrap, d7 as SubmitAuthorizationInput, dh as Table, T as TableInfo, bI as TaxPathComponent, de as TimeRange, df as TimeRanges, dE as TimeSlot, ce as UICart, c6 as UICartBusiness, c8 as UICartCustomer, c7 as UICartLocation, c9 as UICartPricing, cf as UICartResponse, e4 as UpdateAddressInput, ch as UpdateCartItemInput, cH as UpdateOrderStatusInput, U as UpdateProfileInput, b0 as VariantAxis, b5 as VariantAxisSelection, b2 as VariantAxisValue, b1 as VariantAxisWithValues, bT as VariantDetails, cc as VariantDetailsDTO, a$ as VariantDisplayAttribute, b4 as VariantLocationAvailability, dV as VariantStock, aU as VariantStrategy, eh as VerifyOtpInput, aQ as combine, aR as combineObject, c as createCimplifyClient, D as createElements, aF as err, aK as flatMap, aO as fromPromise, n as generateIdempotencyKey, aL as getOrElse, az as isCimplifyError, aH as isErr, aG as isOk, aA as isRetryableError, aJ as mapError, aI as mapResult, aE as ok, aN as toNullable, aP as tryCatch, aM as unwrap } from './ads-
|
|
1
|
+
import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-CmO7VVPP.js';
|
|
2
|
+
export { ah as AUTHORIZATION_TYPE, am as AUTH_MUTATION, a6 as AbortablePromise, eM as AdConfig, eO as AdContextValue, eN as AdCreative, eK as AdPosition, eJ as AdSlot, eL as AdTheme, b6 as AddOn, bR as AddOnDetails, cb as AddOnGroupDetails, b8 as AddOnOption, ca as AddOnOptionDetails, b9 as AddOnOptionPrice, b7 as AddOnWithOptions, cg as AddToCartInput, e7 as AddressData, ez as AddressInfo, bG as AdjustmentType, cu as AmountToPay, bN as AppliedDiscount, ei as AuthResponse, p as AuthService, q as AuthStatus, eB as AuthenticatedCustomer, eD as AuthenticatedData, d2 as AuthorizationType, dX as AvailabilityCheck, dY as AvailabilityResult, dF as AvailableSlot, bM as BenefitType, dI as Booking, dz as BookingRequirementOverride, dH as BookingStatus, dJ as BookingWithDetails, cO as BufferTimes, bh as Bundle, bl as BundleComponentData, bm as BundleComponentInfo, bg as BundlePriceType, bj as BundleProduct, bW as BundleSelectionData, bU as BundleSelectionInput, bV as BundleStoredSelection, bi as BundleSummary, bk as BundleWithDetails, da as Business, dp as BusinessHours, d9 as BusinessPreferences, B as BusinessService, dn as BusinessSettings, d8 as BusinessType, dl as BusinessWithLocations, aa as CHECKOUT_MODE, an as CHECKOUT_MUTATION, ad as CHECKOUT_STEP, aj as CONTACT_TYPE, dN as CancelBookingInput, cI as CancelOrderInput, cQ as CancellationPolicy, b$ as Cart, bS as CartAddOn, bE as CartChannel, c0 as CartItem, cd as CartItemDetails, l as CartOperations, bD as CartStatus, ci as CartSummary, c1 as CartTotals, e as CatalogueQueries, bb as Category, dq as CategoryInfo, bc as CategorySummary, s as ChangePasswordInput, dL as CheckSlotAvailabilityInput, el as CheckoutAddressInfo, en as CheckoutCustomerInfo, $ as CheckoutFormData, cG as CheckoutInput, X as CheckoutMode, m as CheckoutOperations, Y as CheckoutOrderType, Z as CheckoutPaymentMethod, a0 as CheckoutResult, m as CheckoutService, a4 as CheckoutStatus, a5 as CheckoutStatusContext, _ as CheckoutStep, bL as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, z as CimplifyElement, y as CimplifyElements, ay as CimplifyError, bd as Collection, bf as CollectionProduct, be as CollectionSummary, bs as ComponentGroup, bt as ComponentGroupWithComponents, bx as ComponentPriceBreakdown, bv as ComponentSelectionInput, bp as ComponentSourceType, bq as Composite, bu as CompositeComponent, bY as CompositePriceBreakdown, bw as CompositePriceResult, bn as CompositePricingMode, bZ as CompositeSelectionData, bv as CompositeSelectionInput, bX as CompositeStoredSelection, br as CompositeWithDetails, a9 as ContactType, e3 as CreateAddressInput, e5 as CreateMobileMoneyInput, at as Currency, d_ as Customer, d$ as CustomerAddress, e1 as CustomerLinkPreferences, e0 as CustomerMobileMoney, cN as CustomerServicePreferences, ar as DEFAULT_COUNTRY, aq as DEFAULT_CURRENCY, ai as DEVICE_TYPE, dG as DayAvailability, cX as DepositResult, aW as DepositType, a8 as DeviceType, aV as DigitalProductType, bO as DiscountBreakdown, bP as DiscountDetails, c4 as DisplayAddOn, c5 as DisplayAddOnOption, c2 as DisplayCart, c3 as DisplayCartItem, H as ELEMENT_TYPES, E as EVENT_TYPES, ey as ElementAppearance, eI as ElementEventHandler, W as ElementEventType, N as ElementOptions, V as ElementType, eE as ElementsCheckoutData, eF as ElementsCheckoutResult, eC as ElementsCustomerInfo, J as ElementsOptions, e9 as EnrollAndLinkOrderInput, ec as EnrollAndLinkOrderResult, e6 as EnrollmentData, aD as Err, aw as ErrorCode, ax as ErrorCodeType, ct as FeeBearerType, F as FetchQuoteInput, cr as FulfillmentLink, cq as FulfillmentStatus, cp as FulfillmentType, ep as FxQuote, eo as FxQuoteRequest, eq as FxRateResponse, v as FxService, dK as GetAvailableSlotsInput, o as GetOrdersOptions, G as GetProductsOptions, bo as GroupPricingBehavior, eH as IframeToParentMessage, d6 as InitializePaymentResult, I as InventoryService, dZ as InventorySummary, aT as InventoryType, K as KitchenOrderItem, x as KitchenOrderResult, al as LINK_MUTATION, ak as LINK_QUERY, b_ as LineConfiguration, cv as LineItem, cm as LineType, e2 as LinkData, eb as LinkEnrollResult, L as LinkService, ed as LinkSession, ea as LinkStatusResult, w as LiteBootstrap, u as LiteService, dd as Location, c_ as LocationAppointment, bA as LocationProductPrice, dW as LocationStock, db as LocationTaxBehavior, dc as LocationTaxOverrides, dg as LocationTimeProfile, dm as LocationWithDetails, M as MESSAGE_TYPES, ag as MOBILE_MONEY_PROVIDER, e8 as MobileMoneyData, em as MobileMoneyDetails, a7 as MobileMoneyProvider, as as Money, ap as ORDER_MUTATION, ab as ORDER_TYPE, ex as ObservabilityHooks, aC as Ok, cw as Order, cl as OrderChannel, cF as OrderFilter, cs as OrderFulfillmentSummary, cz as OrderGroup, cD as OrderGroupDetails, cA as OrderGroupPayment, cy as OrderGroupPaymentState, cC as OrderGroupPaymentSummary, cx as OrderHistory, cn as OrderLineState, co as OrderLineStatus, cE as OrderPaymentEvent, O as OrderQueries, cB as OrderSplitDetail, cj as OrderStatus, r as OtpResult, ac as PAYMENT_METHOD, ao as PAYMENT_MUTATION, ae as PAYMENT_STATE, af as PICKUP_TIME_TYPE, av as Pagination, au as PaginationParams, eG as ParentToIframeMessage, d5 as Payment, d4 as PaymentMethod, eA as PaymentMethodInfo, d1 as PaymentMethodType, d3 as PaymentProcessingState, d0 as PaymentProvider, ck as PaymentState, c$ as PaymentStatus, ek as PickupTime, ej as PickupTimeType, bz as Price, bH as PriceAdjustment, bK as PriceDecisionPath, by as PriceEntryType, bJ as PricePathTaxInfo, j as PriceQuote, bF as PriceSource, cS as PricingOverrides, a3 as ProcessAndResolveOptions, a1 as ProcessCheckoutOptions, a2 as ProcessCheckoutResult, aY as Product, ba as ProductAddOn, bB as ProductAvailability, dU as ProductStock, bC as ProductTimeProfile, aS as ProductType, a_ as ProductVariant, b3 as ProductVariantValue, aZ as ProductWithDetails, f as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, h as QuoteDynamicBuckets, g as QuoteStatus, i as QuoteUiMessage, R as RefreshQuoteInput, k as RefreshQuoteResult, cJ as RefundOrderInput, cM as ReminderMethod, cP as ReminderSettings, er as RequestContext, eu as RequestErrorEvent, eg as RequestOtpInput, es as RequestStartEvent, et as RequestSuccessEvent, dM as RescheduleBookingInput, cV as ResourceAssignment, dw as ResourceAvailabilityException, dv as ResourceAvailabilityRule, dA as ResourceType, aB as Result, ev as RetryEvent, ef as RevokeAllSessionsResult, ee as RevokeSessionResult, di as Room, aX as SalesChannel, cT as SchedulingMetadata, cW as SchedulingResult, t as SchedulingService, S as SearchOptions, bQ as SelectedAddOnOption, dB as Service, ds as ServiceAvailabilityException, dO as ServiceAvailabilityParams, dP as ServiceAvailabilityResult, dr as ServiceAvailabilityRule, dj as ServiceCharge, cR as ServiceNotes, cY as ServiceScheduleRequest, dy as ServiceStaffRequirement, cK as ServiceStatus, dC as ServiceWithStaff, ew as SessionChangeEvent, dD as Staff, cU as StaffAssignment, du as StaffAvailabilityException, dt as StaffAvailabilityRule, dx as StaffBookingProfile, cL as StaffRole, cZ as StaffScheduleItem, dS as Stock, dT as StockLevel, dQ as StockOwnershipType, dR as StockStatus, dk as StorefrontBootstrap, d7 as SubmitAuthorizationInput, dh as Table, T as TableInfo, bI as TaxPathComponent, de as TimeRange, df as TimeRanges, dE as TimeSlot, ce as UICart, c6 as UICartBusiness, c8 as UICartCustomer, c7 as UICartLocation, c9 as UICartPricing, cf as UICartResponse, e4 as UpdateAddressInput, ch as UpdateCartItemInput, cH as UpdateOrderStatusInput, U as UpdateProfileInput, b0 as VariantAxis, b5 as VariantAxisSelection, b2 as VariantAxisValue, b1 as VariantAxisWithValues, bT as VariantDetails, cc as VariantDetailsDTO, a$ as VariantDisplayAttribute, b4 as VariantLocationAvailability, dV as VariantStock, aU as VariantStrategy, eh as VerifyOtpInput, aQ as combine, aR as combineObject, c as createCimplifyClient, D as createElements, aF as err, aK as flatMap, aO as fromPromise, n as generateIdempotencyKey, aL as getOrElse, az as isCimplifyError, aH as isErr, aG as isOk, aA as isRetryableError, aJ as mapError, aI as mapResult, aE as ok, aN as toNullable, aP as tryCatch, aM as unwrap } from './ads-CmO7VVPP.js';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
|
5
5
|
type SortOrder = "asc" | "desc";
|
package/dist/index.js
CHANGED
|
@@ -1099,14 +1099,14 @@ function detectMobileMoneyProvider(phoneNumber) {
|
|
|
1099
1099
|
// src/utils/paystack.ts
|
|
1100
1100
|
async function openPaystackPopup(options, signal) {
|
|
1101
1101
|
if (typeof window === "undefined") {
|
|
1102
|
-
return { success: false, error: "
|
|
1102
|
+
return { success: false, error: "PROVIDER_UNAVAILABLE" };
|
|
1103
1103
|
}
|
|
1104
1104
|
let PaystackPop;
|
|
1105
1105
|
try {
|
|
1106
1106
|
const imported = await import('@paystack/inline-js');
|
|
1107
1107
|
PaystackPop = imported.default;
|
|
1108
1108
|
} catch {
|
|
1109
|
-
return { success: false, error: "
|
|
1109
|
+
return { success: false, error: "PROVIDER_UNAVAILABLE" };
|
|
1110
1110
|
}
|
|
1111
1111
|
return new Promise((resolve) => {
|
|
1112
1112
|
let settled = false;
|
|
@@ -1165,6 +1165,41 @@ async function openPaystackPopup(options, signal) {
|
|
|
1165
1165
|
var DEFAULT_POLL_INTERVAL_MS = 3e3;
|
|
1166
1166
|
var DEFAULT_MAX_POLL_ATTEMPTS = 60;
|
|
1167
1167
|
var MAX_CONSECUTIVE_NETWORK_ERRORS = 5;
|
|
1168
|
+
var CARD_PROVIDER_PAYSTACK = "paystack";
|
|
1169
|
+
function normalizeCardPopupError(error) {
|
|
1170
|
+
if (!error || error === "PAYMENT_CANCELLED" || error === "CANCELLED") {
|
|
1171
|
+
return "PAYMENT_CANCELLED";
|
|
1172
|
+
}
|
|
1173
|
+
if (error === "PROVIDER_UNAVAILABLE") {
|
|
1174
|
+
return "PROVIDER_UNAVAILABLE";
|
|
1175
|
+
}
|
|
1176
|
+
if (error === "POPUP_BLOCKED") {
|
|
1177
|
+
return "POPUP_BLOCKED";
|
|
1178
|
+
}
|
|
1179
|
+
return "PAYMENT_FAILED";
|
|
1180
|
+
}
|
|
1181
|
+
function normalizeCardProvider(value) {
|
|
1182
|
+
const normalized = value?.trim().toLowerCase();
|
|
1183
|
+
return normalized && normalized.length > 0 ? normalized : CARD_PROVIDER_PAYSTACK;
|
|
1184
|
+
}
|
|
1185
|
+
async function openCardPopup(provider, checkoutResult, email, currency, signal) {
|
|
1186
|
+
if (typeof window === "undefined") {
|
|
1187
|
+
return { success: false, error: "PROVIDER_UNAVAILABLE" };
|
|
1188
|
+
}
|
|
1189
|
+
if (provider === CARD_PROVIDER_PAYSTACK) {
|
|
1190
|
+
return openPaystackPopup(
|
|
1191
|
+
{
|
|
1192
|
+
key: checkoutResult.public_key || "",
|
|
1193
|
+
email,
|
|
1194
|
+
accessCode: checkoutResult.client_secret,
|
|
1195
|
+
reference: checkoutResult.payment_reference || checkoutResult.client_secret,
|
|
1196
|
+
currency
|
|
1197
|
+
},
|
|
1198
|
+
signal
|
|
1199
|
+
);
|
|
1200
|
+
}
|
|
1201
|
+
return { success: false, error: "PROVIDER_UNAVAILABLE" };
|
|
1202
|
+
}
|
|
1168
1203
|
function normalizeAuthorizationType(value) {
|
|
1169
1204
|
return value === "otp" || value === "pin" ? value : void 0;
|
|
1170
1205
|
}
|
|
@@ -1205,7 +1240,7 @@ var CheckoutResolver = class {
|
|
|
1205
1240
|
this.orderType = options.orderType;
|
|
1206
1241
|
this.cartTotal = options.cartTotal;
|
|
1207
1242
|
this.cartCurrency = options.cartCurrency;
|
|
1208
|
-
this.
|
|
1243
|
+
this.allowPopups = options.allowPopups ?? typeof window !== "undefined";
|
|
1209
1244
|
}
|
|
1210
1245
|
async resolve(checkoutResult) {
|
|
1211
1246
|
try {
|
|
@@ -1220,44 +1255,49 @@ var CheckoutResolver = class {
|
|
|
1220
1255
|
return this.finalizeSuccess(checkoutResult);
|
|
1221
1256
|
}
|
|
1222
1257
|
if (checkoutResult.client_secret && checkoutResult.public_key) {
|
|
1223
|
-
|
|
1224
|
-
return this.fail(
|
|
1225
|
-
"PAYSTACK_HANDOFF_REQUIRED",
|
|
1226
|
-
"Card authorization requires Elements. Use elements.processCheckout() for card flows.",
|
|
1227
|
-
true
|
|
1228
|
-
);
|
|
1229
|
-
}
|
|
1258
|
+
const provider = normalizeCardProvider(checkoutResult.provider);
|
|
1230
1259
|
this.emit("awaiting_authorization", {
|
|
1231
|
-
authorization_type: authorizationType,
|
|
1232
1260
|
display_text: "Complete payment in the card authorization popup.",
|
|
1233
1261
|
order_id: checkoutResult.order_id,
|
|
1234
|
-
order_number: checkoutResult.order_number
|
|
1235
|
-
provider: checkoutResult.provider ?? "paystack"
|
|
1262
|
+
order_number: checkoutResult.order_number
|
|
1236
1263
|
});
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1264
|
+
if (!this.allowPopups) {
|
|
1265
|
+
return this.fail(
|
|
1266
|
+
"PROVIDER_UNAVAILABLE",
|
|
1267
|
+
"Card payment popup is unavailable in this environment.",
|
|
1268
|
+
false
|
|
1269
|
+
);
|
|
1270
|
+
}
|
|
1271
|
+
const popupResult = await openCardPopup(
|
|
1272
|
+
provider,
|
|
1273
|
+
checkoutResult,
|
|
1274
|
+
this.checkoutData.customer.email || "customer@cimplify.io",
|
|
1275
|
+
this.getOrderCurrency(checkoutResult),
|
|
1245
1276
|
this.signal
|
|
1246
1277
|
);
|
|
1247
1278
|
if (!popupResult.success) {
|
|
1248
|
-
|
|
1279
|
+
const popupError = normalizeCardPopupError(popupResult.error);
|
|
1280
|
+
if (popupError === "POPUP_BLOCKED") {
|
|
1249
1281
|
return this.fail(
|
|
1250
1282
|
"POPUP_BLOCKED",
|
|
1251
1283
|
"Unable to open card payment popup. Please allow popups and try again.",
|
|
1252
1284
|
true
|
|
1253
1285
|
);
|
|
1254
1286
|
}
|
|
1287
|
+
if (popupError === "PROVIDER_UNAVAILABLE") {
|
|
1288
|
+
return this.fail(
|
|
1289
|
+
"PROVIDER_UNAVAILABLE",
|
|
1290
|
+
"Card payment provider is unavailable.",
|
|
1291
|
+
false
|
|
1292
|
+
);
|
|
1293
|
+
}
|
|
1255
1294
|
return this.fail(
|
|
1256
|
-
|
|
1295
|
+
"PAYMENT_CANCELLED",
|
|
1257
1296
|
"Card payment was cancelled before completion.",
|
|
1258
1297
|
true
|
|
1259
1298
|
);
|
|
1260
1299
|
}
|
|
1300
|
+
paymentReference = popupResult.reference || paymentReference;
|
|
1261
1301
|
}
|
|
1262
1302
|
if (checkoutResult.authorization_url) {
|
|
1263
1303
|
if (typeof window !== "undefined" && this.returnUrl) {
|
|
@@ -1787,7 +1827,7 @@ var CheckoutService = class {
|
|
|
1787
1827
|
cartTotal: cart.pricing.total_price,
|
|
1788
1828
|
cartCurrency: checkoutData.pay_currency || cart.pricing.currency || "GHS",
|
|
1789
1829
|
orderType: checkoutData.order_type,
|
|
1790
|
-
|
|
1830
|
+
allowPopups: data.allow_popups
|
|
1791
1831
|
});
|
|
1792
1832
|
const resolved = await resolver.resolve(processResult.value);
|
|
1793
1833
|
return ok(resolved);
|
package/dist/index.mjs
CHANGED
|
@@ -1097,14 +1097,14 @@ function detectMobileMoneyProvider(phoneNumber) {
|
|
|
1097
1097
|
// src/utils/paystack.ts
|
|
1098
1098
|
async function openPaystackPopup(options, signal) {
|
|
1099
1099
|
if (typeof window === "undefined") {
|
|
1100
|
-
return { success: false, error: "
|
|
1100
|
+
return { success: false, error: "PROVIDER_UNAVAILABLE" };
|
|
1101
1101
|
}
|
|
1102
1102
|
let PaystackPop;
|
|
1103
1103
|
try {
|
|
1104
1104
|
const imported = await import('@paystack/inline-js');
|
|
1105
1105
|
PaystackPop = imported.default;
|
|
1106
1106
|
} catch {
|
|
1107
|
-
return { success: false, error: "
|
|
1107
|
+
return { success: false, error: "PROVIDER_UNAVAILABLE" };
|
|
1108
1108
|
}
|
|
1109
1109
|
return new Promise((resolve) => {
|
|
1110
1110
|
let settled = false;
|
|
@@ -1163,6 +1163,41 @@ async function openPaystackPopup(options, signal) {
|
|
|
1163
1163
|
var DEFAULT_POLL_INTERVAL_MS = 3e3;
|
|
1164
1164
|
var DEFAULT_MAX_POLL_ATTEMPTS = 60;
|
|
1165
1165
|
var MAX_CONSECUTIVE_NETWORK_ERRORS = 5;
|
|
1166
|
+
var CARD_PROVIDER_PAYSTACK = "paystack";
|
|
1167
|
+
function normalizeCardPopupError(error) {
|
|
1168
|
+
if (!error || error === "PAYMENT_CANCELLED" || error === "CANCELLED") {
|
|
1169
|
+
return "PAYMENT_CANCELLED";
|
|
1170
|
+
}
|
|
1171
|
+
if (error === "PROVIDER_UNAVAILABLE") {
|
|
1172
|
+
return "PROVIDER_UNAVAILABLE";
|
|
1173
|
+
}
|
|
1174
|
+
if (error === "POPUP_BLOCKED") {
|
|
1175
|
+
return "POPUP_BLOCKED";
|
|
1176
|
+
}
|
|
1177
|
+
return "PAYMENT_FAILED";
|
|
1178
|
+
}
|
|
1179
|
+
function normalizeCardProvider(value) {
|
|
1180
|
+
const normalized = value?.trim().toLowerCase();
|
|
1181
|
+
return normalized && normalized.length > 0 ? normalized : CARD_PROVIDER_PAYSTACK;
|
|
1182
|
+
}
|
|
1183
|
+
async function openCardPopup(provider, checkoutResult, email, currency, signal) {
|
|
1184
|
+
if (typeof window === "undefined") {
|
|
1185
|
+
return { success: false, error: "PROVIDER_UNAVAILABLE" };
|
|
1186
|
+
}
|
|
1187
|
+
if (provider === CARD_PROVIDER_PAYSTACK) {
|
|
1188
|
+
return openPaystackPopup(
|
|
1189
|
+
{
|
|
1190
|
+
key: checkoutResult.public_key || "",
|
|
1191
|
+
email,
|
|
1192
|
+
accessCode: checkoutResult.client_secret,
|
|
1193
|
+
reference: checkoutResult.payment_reference || checkoutResult.client_secret,
|
|
1194
|
+
currency
|
|
1195
|
+
},
|
|
1196
|
+
signal
|
|
1197
|
+
);
|
|
1198
|
+
}
|
|
1199
|
+
return { success: false, error: "PROVIDER_UNAVAILABLE" };
|
|
1200
|
+
}
|
|
1166
1201
|
function normalizeAuthorizationType(value) {
|
|
1167
1202
|
return value === "otp" || value === "pin" ? value : void 0;
|
|
1168
1203
|
}
|
|
@@ -1203,7 +1238,7 @@ var CheckoutResolver = class {
|
|
|
1203
1238
|
this.orderType = options.orderType;
|
|
1204
1239
|
this.cartTotal = options.cartTotal;
|
|
1205
1240
|
this.cartCurrency = options.cartCurrency;
|
|
1206
|
-
this.
|
|
1241
|
+
this.allowPopups = options.allowPopups ?? typeof window !== "undefined";
|
|
1207
1242
|
}
|
|
1208
1243
|
async resolve(checkoutResult) {
|
|
1209
1244
|
try {
|
|
@@ -1218,44 +1253,49 @@ var CheckoutResolver = class {
|
|
|
1218
1253
|
return this.finalizeSuccess(checkoutResult);
|
|
1219
1254
|
}
|
|
1220
1255
|
if (checkoutResult.client_secret && checkoutResult.public_key) {
|
|
1221
|
-
|
|
1222
|
-
return this.fail(
|
|
1223
|
-
"PAYSTACK_HANDOFF_REQUIRED",
|
|
1224
|
-
"Card authorization requires Elements. Use elements.processCheckout() for card flows.",
|
|
1225
|
-
true
|
|
1226
|
-
);
|
|
1227
|
-
}
|
|
1256
|
+
const provider = normalizeCardProvider(checkoutResult.provider);
|
|
1228
1257
|
this.emit("awaiting_authorization", {
|
|
1229
|
-
authorization_type: authorizationType,
|
|
1230
1258
|
display_text: "Complete payment in the card authorization popup.",
|
|
1231
1259
|
order_id: checkoutResult.order_id,
|
|
1232
|
-
order_number: checkoutResult.order_number
|
|
1233
|
-
provider: checkoutResult.provider ?? "paystack"
|
|
1260
|
+
order_number: checkoutResult.order_number
|
|
1234
1261
|
});
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1262
|
+
if (!this.allowPopups) {
|
|
1263
|
+
return this.fail(
|
|
1264
|
+
"PROVIDER_UNAVAILABLE",
|
|
1265
|
+
"Card payment popup is unavailable in this environment.",
|
|
1266
|
+
false
|
|
1267
|
+
);
|
|
1268
|
+
}
|
|
1269
|
+
const popupResult = await openCardPopup(
|
|
1270
|
+
provider,
|
|
1271
|
+
checkoutResult,
|
|
1272
|
+
this.checkoutData.customer.email || "customer@cimplify.io",
|
|
1273
|
+
this.getOrderCurrency(checkoutResult),
|
|
1243
1274
|
this.signal
|
|
1244
1275
|
);
|
|
1245
1276
|
if (!popupResult.success) {
|
|
1246
|
-
|
|
1277
|
+
const popupError = normalizeCardPopupError(popupResult.error);
|
|
1278
|
+
if (popupError === "POPUP_BLOCKED") {
|
|
1247
1279
|
return this.fail(
|
|
1248
1280
|
"POPUP_BLOCKED",
|
|
1249
1281
|
"Unable to open card payment popup. Please allow popups and try again.",
|
|
1250
1282
|
true
|
|
1251
1283
|
);
|
|
1252
1284
|
}
|
|
1285
|
+
if (popupError === "PROVIDER_UNAVAILABLE") {
|
|
1286
|
+
return this.fail(
|
|
1287
|
+
"PROVIDER_UNAVAILABLE",
|
|
1288
|
+
"Card payment provider is unavailable.",
|
|
1289
|
+
false
|
|
1290
|
+
);
|
|
1291
|
+
}
|
|
1253
1292
|
return this.fail(
|
|
1254
|
-
|
|
1293
|
+
"PAYMENT_CANCELLED",
|
|
1255
1294
|
"Card payment was cancelled before completion.",
|
|
1256
1295
|
true
|
|
1257
1296
|
);
|
|
1258
1297
|
}
|
|
1298
|
+
paymentReference = popupResult.reference || paymentReference;
|
|
1259
1299
|
}
|
|
1260
1300
|
if (checkoutResult.authorization_url) {
|
|
1261
1301
|
if (typeof window !== "undefined" && this.returnUrl) {
|
|
@@ -1785,7 +1825,7 @@ var CheckoutService = class {
|
|
|
1785
1825
|
cartTotal: cart.pricing.total_price,
|
|
1786
1826
|
cartCurrency: checkoutData.pay_currency || cart.pricing.currency || "GHS",
|
|
1787
1827
|
orderType: checkoutData.order_type,
|
|
1788
|
-
|
|
1828
|
+
allowPopups: data.allow_popups
|
|
1789
1829
|
});
|
|
1790
1830
|
const resolved = await resolver.resolve(processResult.value);
|
|
1791
1831
|
return ok(resolved);
|
package/dist/react.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { eJ as AdSlot, eK as AdPosition, eO as AdContextValue, C as CimplifyClient, a2 as ProcessCheckoutResult, a4 as CheckoutStatus, a5 as CheckoutStatusContext, y as CimplifyElements, J as ElementsOptions, eD as AuthenticatedData, ez as AddressInfo, eA as PaymentMethodInfo, eF as ElementsCheckoutResult, a1 as ProcessCheckoutOptions } from './ads-
|
|
2
|
-
export { eM as AdConfig } from './ads-
|
|
1
|
+
import { eJ as AdSlot, eK as AdPosition, eO as AdContextValue, C as CimplifyClient, a2 as ProcessCheckoutResult, a4 as CheckoutStatus, a5 as CheckoutStatusContext, y as CimplifyElements, J as ElementsOptions, eD as AuthenticatedData, ez as AddressInfo, eA as PaymentMethodInfo, eF as ElementsCheckoutResult, a1 as ProcessCheckoutOptions } from './ads-CmO7VVPP.mjs';
|
|
2
|
+
export { eM as AdConfig } from './ads-CmO7VVPP.mjs';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
interface UserIdentity {
|
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { eJ as AdSlot, eK as AdPosition, eO as AdContextValue, C as CimplifyClient, a2 as ProcessCheckoutResult, a4 as CheckoutStatus, a5 as CheckoutStatusContext, y as CimplifyElements, J as ElementsOptions, eD as AuthenticatedData, ez as AddressInfo, eA as PaymentMethodInfo, eF as ElementsCheckoutResult, a1 as ProcessCheckoutOptions } from './ads-
|
|
2
|
-
export { eM as AdConfig } from './ads-
|
|
1
|
+
import { eJ as AdSlot, eK as AdPosition, eO as AdContextValue, C as CimplifyClient, a2 as ProcessCheckoutResult, a4 as CheckoutStatus, a5 as CheckoutStatusContext, y as CimplifyElements, J as ElementsOptions, eD as AuthenticatedData, ez as AddressInfo, eA as PaymentMethodInfo, eF as ElementsCheckoutResult, a1 as ProcessCheckoutOptions } from './ads-CmO7VVPP.js';
|
|
2
|
+
export { eM as AdConfig } from './ads-CmO7VVPP.js';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
interface UserIdentity {
|