@cimplify/sdk 0.8.5 → 0.8.6

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-iRG2DBq0.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-6MsOWo8f.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-8SahVQEy.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-CVJ0S99a.js';
2
2
  import './payment-CLIWNMaP.js';
3
3
 
4
4
  type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
package/dist/advanced.js CHANGED
@@ -799,6 +799,10 @@ var DEFAULT_POLL_INTERVAL_MS = 3e3;
799
799
  var DEFAULT_MAX_POLL_ATTEMPTS = 60;
800
800
  var MAX_CONSECUTIVE_NETWORK_ERRORS = 5;
801
801
  var CARD_PROVIDER_PAYSTACK = "paystack";
802
+ var NEXT_ACTION_NONE = "none";
803
+ var NEXT_ACTION_CARD_POPUP = "card_popup";
804
+ var NEXT_ACTION_REDIRECT = "redirect";
805
+ var NEXT_ACTION_AUTHORIZATION = "authorization";
802
806
  function normalizeCardPopupError(error) {
803
807
  if (!error || error === "PAYMENT_CANCELLED" || error === "CANCELLED") {
804
808
  return "PAYMENT_CANCELLED";
@@ -838,7 +842,8 @@ function isValidMobileMoneyProvider(value) {
838
842
  return VALID_MOBILE_MONEY_PROVIDERS.has(value);
839
843
  }
840
844
  function normalizeAuthorizationType(value) {
841
- return value === "otp" || value === "pin" ? value : void 0;
845
+ const lower = value?.toLowerCase();
846
+ return lower === "otp" || lower === "pin" ? lower : void 0;
842
847
  }
843
848
  function formatMoney2(value) {
844
849
  if (typeof value === "number" && Number.isFinite(value)) {
@@ -885,6 +890,9 @@ var CheckoutResolver = class {
885
890
  if (!checkoutResult.order_id) {
886
891
  return this.fail("CHECKOUT_FAILED", "Checkout did not return an order ID.", false);
887
892
  }
893
+ if (checkoutResult.next_action) {
894
+ return this.resolveNextAction(checkoutResult);
895
+ }
888
896
  let latestCheckoutResult = checkoutResult;
889
897
  let authorizationType = normalizeAuthorizationType(checkoutResult.authorization_type);
890
898
  let paymentReference = checkoutResult.payment_reference;
@@ -1000,6 +1008,110 @@ var CheckoutResolver = class {
1000
1008
  return this.fail("CHECKOUT_FAILED", message, true);
1001
1009
  }
1002
1010
  }
1011
+ async resolveNextAction(checkoutResult) {
1012
+ const action = checkoutResult.next_action;
1013
+ if (this.isSuccessfulStatus(checkoutResult.payment_status)) {
1014
+ return this.finalizeSuccess(checkoutResult);
1015
+ }
1016
+ let latestCheckoutResult = checkoutResult;
1017
+ let paymentReference = checkoutResult.payment_reference;
1018
+ switch (action.type) {
1019
+ case NEXT_ACTION_NONE:
1020
+ return this.finalizeSuccess(checkoutResult);
1021
+ case NEXT_ACTION_CARD_POPUP: {
1022
+ const provider = normalizeCardProvider(action.provider);
1023
+ this.emit("awaiting_authorization", {
1024
+ display_text: "Complete payment in the card authorization popup.",
1025
+ order_id: checkoutResult.order_id,
1026
+ order_number: checkoutResult.order_number
1027
+ });
1028
+ if (!this.allowPopups) {
1029
+ return this.fail(
1030
+ "PROVIDER_UNAVAILABLE",
1031
+ "Card payment popup is unavailable in this environment.",
1032
+ false
1033
+ );
1034
+ }
1035
+ const popupResult = await openCardPopup(
1036
+ provider,
1037
+ checkoutResult,
1038
+ this.checkoutData.customer.email || "customer@cimplify.io",
1039
+ this.getOrderCurrency(checkoutResult),
1040
+ this.signal
1041
+ );
1042
+ if (!popupResult.success) {
1043
+ const popupError = normalizeCardPopupError(popupResult.error);
1044
+ if (popupError === "POPUP_BLOCKED") {
1045
+ return this.fail(
1046
+ "POPUP_BLOCKED",
1047
+ "Unable to open card payment popup. Please allow popups and try again.",
1048
+ true
1049
+ );
1050
+ }
1051
+ if (popupError === "PROVIDER_UNAVAILABLE") {
1052
+ return this.fail("PROVIDER_UNAVAILABLE", "Card payment provider is unavailable.", false);
1053
+ }
1054
+ return this.fail("PAYMENT_CANCELLED", "Card payment was cancelled before completion.", true);
1055
+ }
1056
+ paymentReference = popupResult.reference || paymentReference;
1057
+ break;
1058
+ }
1059
+ case NEXT_ACTION_REDIRECT: {
1060
+ if (typeof window !== "undefined" && this.returnUrl) {
1061
+ window.location.assign(action.authorization_url);
1062
+ return this.fail("REDIRECT_REQUIRED", "Redirecting to complete payment authorization.", true);
1063
+ }
1064
+ if (typeof window !== "undefined") {
1065
+ const popup = window.open(
1066
+ action.authorization_url,
1067
+ "cimplify-auth",
1068
+ "width=520,height=760,noopener,noreferrer"
1069
+ );
1070
+ if (!popup) {
1071
+ return this.fail(
1072
+ "POPUP_BLOCKED",
1073
+ "Authorization popup was blocked. Please allow popups and retry.",
1074
+ true
1075
+ );
1076
+ }
1077
+ }
1078
+ break;
1079
+ }
1080
+ case NEXT_ACTION_AUTHORIZATION: {
1081
+ const authType = normalizeAuthorizationType(action.authorization_type);
1082
+ const authorization = await this.handleAuthorization({
1083
+ authorizationType: authType,
1084
+ paymentReference,
1085
+ displayText: action.display_text,
1086
+ provider: checkoutResult.provider
1087
+ });
1088
+ if (!authorization.ok) {
1089
+ return authorization.result;
1090
+ }
1091
+ if (authorization.value) {
1092
+ latestCheckoutResult = authorization.value;
1093
+ paymentReference = authorization.value.payment_reference || paymentReference;
1094
+ if (this.isSuccessfulStatus(authorization.value.payment_status)) {
1095
+ return this.finalizeSuccess(authorization.value);
1096
+ }
1097
+ if (this.isFailureStatus(authorization.value.payment_status)) {
1098
+ return this.fail(
1099
+ "AUTHORIZATION_FAILED",
1100
+ authorization.value.display_text || "Payment authorization failed.",
1101
+ false
1102
+ );
1103
+ }
1104
+ }
1105
+ break;
1106
+ }
1107
+ }
1108
+ return this.pollUntilTerminal({
1109
+ orderId: checkoutResult.order_id,
1110
+ latestCheckoutResult,
1111
+ paymentReference,
1112
+ authorizationType: normalizeAuthorizationType(checkoutResult.authorization_type)
1113
+ });
1114
+ }
1003
1115
  async pollUntilTerminal(input) {
1004
1116
  let consecutiveErrors = 0;
1005
1117
  let latestCheckoutResult = input.latestCheckoutResult;
package/dist/advanced.mjs CHANGED
@@ -797,6 +797,10 @@ var DEFAULT_POLL_INTERVAL_MS = 3e3;
797
797
  var DEFAULT_MAX_POLL_ATTEMPTS = 60;
798
798
  var MAX_CONSECUTIVE_NETWORK_ERRORS = 5;
799
799
  var CARD_PROVIDER_PAYSTACK = "paystack";
800
+ var NEXT_ACTION_NONE = "none";
801
+ var NEXT_ACTION_CARD_POPUP = "card_popup";
802
+ var NEXT_ACTION_REDIRECT = "redirect";
803
+ var NEXT_ACTION_AUTHORIZATION = "authorization";
800
804
  function normalizeCardPopupError(error) {
801
805
  if (!error || error === "PAYMENT_CANCELLED" || error === "CANCELLED") {
802
806
  return "PAYMENT_CANCELLED";
@@ -836,7 +840,8 @@ function isValidMobileMoneyProvider(value) {
836
840
  return VALID_MOBILE_MONEY_PROVIDERS.has(value);
837
841
  }
838
842
  function normalizeAuthorizationType(value) {
839
- return value === "otp" || value === "pin" ? value : void 0;
843
+ const lower = value?.toLowerCase();
844
+ return lower === "otp" || lower === "pin" ? lower : void 0;
840
845
  }
841
846
  function formatMoney2(value) {
842
847
  if (typeof value === "number" && Number.isFinite(value)) {
@@ -883,6 +888,9 @@ var CheckoutResolver = class {
883
888
  if (!checkoutResult.order_id) {
884
889
  return this.fail("CHECKOUT_FAILED", "Checkout did not return an order ID.", false);
885
890
  }
891
+ if (checkoutResult.next_action) {
892
+ return this.resolveNextAction(checkoutResult);
893
+ }
886
894
  let latestCheckoutResult = checkoutResult;
887
895
  let authorizationType = normalizeAuthorizationType(checkoutResult.authorization_type);
888
896
  let paymentReference = checkoutResult.payment_reference;
@@ -998,6 +1006,110 @@ var CheckoutResolver = class {
998
1006
  return this.fail("CHECKOUT_FAILED", message, true);
999
1007
  }
1000
1008
  }
1009
+ async resolveNextAction(checkoutResult) {
1010
+ const action = checkoutResult.next_action;
1011
+ if (this.isSuccessfulStatus(checkoutResult.payment_status)) {
1012
+ return this.finalizeSuccess(checkoutResult);
1013
+ }
1014
+ let latestCheckoutResult = checkoutResult;
1015
+ let paymentReference = checkoutResult.payment_reference;
1016
+ switch (action.type) {
1017
+ case NEXT_ACTION_NONE:
1018
+ return this.finalizeSuccess(checkoutResult);
1019
+ case NEXT_ACTION_CARD_POPUP: {
1020
+ const provider = normalizeCardProvider(action.provider);
1021
+ this.emit("awaiting_authorization", {
1022
+ display_text: "Complete payment in the card authorization popup.",
1023
+ order_id: checkoutResult.order_id,
1024
+ order_number: checkoutResult.order_number
1025
+ });
1026
+ if (!this.allowPopups) {
1027
+ return this.fail(
1028
+ "PROVIDER_UNAVAILABLE",
1029
+ "Card payment popup is unavailable in this environment.",
1030
+ false
1031
+ );
1032
+ }
1033
+ const popupResult = await openCardPopup(
1034
+ provider,
1035
+ checkoutResult,
1036
+ this.checkoutData.customer.email || "customer@cimplify.io",
1037
+ this.getOrderCurrency(checkoutResult),
1038
+ this.signal
1039
+ );
1040
+ if (!popupResult.success) {
1041
+ const popupError = normalizeCardPopupError(popupResult.error);
1042
+ if (popupError === "POPUP_BLOCKED") {
1043
+ return this.fail(
1044
+ "POPUP_BLOCKED",
1045
+ "Unable to open card payment popup. Please allow popups and try again.",
1046
+ true
1047
+ );
1048
+ }
1049
+ if (popupError === "PROVIDER_UNAVAILABLE") {
1050
+ return this.fail("PROVIDER_UNAVAILABLE", "Card payment provider is unavailable.", false);
1051
+ }
1052
+ return this.fail("PAYMENT_CANCELLED", "Card payment was cancelled before completion.", true);
1053
+ }
1054
+ paymentReference = popupResult.reference || paymentReference;
1055
+ break;
1056
+ }
1057
+ case NEXT_ACTION_REDIRECT: {
1058
+ if (typeof window !== "undefined" && this.returnUrl) {
1059
+ window.location.assign(action.authorization_url);
1060
+ return this.fail("REDIRECT_REQUIRED", "Redirecting to complete payment authorization.", true);
1061
+ }
1062
+ if (typeof window !== "undefined") {
1063
+ const popup = window.open(
1064
+ action.authorization_url,
1065
+ "cimplify-auth",
1066
+ "width=520,height=760,noopener,noreferrer"
1067
+ );
1068
+ if (!popup) {
1069
+ return this.fail(
1070
+ "POPUP_BLOCKED",
1071
+ "Authorization popup was blocked. Please allow popups and retry.",
1072
+ true
1073
+ );
1074
+ }
1075
+ }
1076
+ break;
1077
+ }
1078
+ case NEXT_ACTION_AUTHORIZATION: {
1079
+ const authType = normalizeAuthorizationType(action.authorization_type);
1080
+ const authorization = await this.handleAuthorization({
1081
+ authorizationType: authType,
1082
+ paymentReference,
1083
+ displayText: action.display_text,
1084
+ provider: checkoutResult.provider
1085
+ });
1086
+ if (!authorization.ok) {
1087
+ return authorization.result;
1088
+ }
1089
+ if (authorization.value) {
1090
+ latestCheckoutResult = authorization.value;
1091
+ paymentReference = authorization.value.payment_reference || paymentReference;
1092
+ if (this.isSuccessfulStatus(authorization.value.payment_status)) {
1093
+ return this.finalizeSuccess(authorization.value);
1094
+ }
1095
+ if (this.isFailureStatus(authorization.value.payment_status)) {
1096
+ return this.fail(
1097
+ "AUTHORIZATION_FAILED",
1098
+ authorization.value.display_text || "Payment authorization failed.",
1099
+ false
1100
+ );
1101
+ }
1102
+ }
1103
+ break;
1104
+ }
1105
+ }
1106
+ return this.pollUntilTerminal({
1107
+ orderId: checkoutResult.order_id,
1108
+ latestCheckoutResult,
1109
+ paymentReference,
1110
+ authorizationType: normalizeAuthorizationType(checkoutResult.authorization_type)
1111
+ });
1112
+ }
1001
1113
  async pollUntilTerminal(input) {
1002
1114
  let consecutiveErrors = 0;
1003
1115
  let latestCheckoutResult = input.latestCheckoutResult;
@@ -1102,6 +1102,23 @@ interface CheckoutFormData {
1102
1102
  pay_currency?: CurrencyCode;
1103
1103
  fx_quote_id?: string;
1104
1104
  }
1105
+ type NextAction = {
1106
+ type: "none";
1107
+ } | {
1108
+ type: "card_popup";
1109
+ provider: string;
1110
+ client_secret: string;
1111
+ public_key: string;
1112
+ } | {
1113
+ type: "redirect";
1114
+ authorization_url: string;
1115
+ } | {
1116
+ type: "authorization";
1117
+ authorization_type: AuthorizationType;
1118
+ display_text?: string;
1119
+ } | {
1120
+ type: "poll";
1121
+ };
1105
1122
  interface CheckoutResult {
1106
1123
  order_id: string;
1107
1124
  order_number: string;
@@ -1116,6 +1133,7 @@ interface CheckoutResult {
1116
1133
  provider?: string;
1117
1134
  client_secret?: string;
1118
1135
  public_key?: string;
1136
+ next_action?: NextAction;
1119
1137
  fx?: {
1120
1138
  base_currency: CurrencyCode;
1121
1139
  base_amount: Money;
@@ -2323,4 +2341,4 @@ declare class CimplifyClient {
2323
2341
  }
2324
2342
  declare function createCimplifyClient(config?: CimplifyConfig): CimplifyClient;
2325
2343
 
2326
- export { type AbortablePromise as $, AuthService as A, BusinessService as B, CimplifyClient as C, type CheckoutMode as D, EVENT_TYPES as E, type FetchQuoteInput as F, type GetProductsOptions as G, type CheckoutOrderType as H, InventoryService as I, type CheckoutPaymentMethod as J, type CheckoutStep as K, LinkService as L, MESSAGE_TYPES as M, type CheckoutFormData as N, OrderQueries as O, type PriceQuote as P, type QuoteCompositeSelectionInput as Q, type RefreshQuoteInput as R, type SearchOptions as S, type TableInfo as T, type UpdateProfileInput as U, type CheckoutResult as V, type ProcessCheckoutOptions as W, type ProcessCheckoutResult as X, type ProcessAndResolveOptions as Y, type CheckoutStatus as Z, type CheckoutStatusContext as _, type CimplifyConfig as a, type CheckoutInput as a$, type MobileMoneyProvider as a0, type DeviceType as a1, type ContactType as a2, CHECKOUT_MODE as a3, ORDER_TYPE as a4, PAYMENT_METHOD as a5, CHECKOUT_STEP as a6, PAYMENT_STATE as a7, PICKUP_TIME_TYPE as a8, MOBILE_MONEY_PROVIDER as a9, combine as aA, combineObject as aB, type CatalogueResult as aC, type CatalogueSnapshot as aD, type OrderStatus as aE, type PaymentState as aF, type OrderChannel as aG, type LineType as aH, type OrderLineState as aI, type OrderLineStatus as aJ, type FulfillmentType as aK, type FulfillmentStatus as aL, type FulfillmentLink as aM, type OrderFulfillmentSummary as aN, type FeeBearerType as aO, type AmountToPay as aP, type LineItem as aQ, type Order as aR, type OrderHistory as aS, type OrderGroupPaymentState as aT, type OrderGroup as aU, type OrderGroupPayment as aV, type OrderSplitDetail as aW, type OrderGroupPaymentSummary as aX, type OrderGroupDetails as aY, type OrderPaymentEvent as aZ, type OrderFilter as a_, AUTHORIZATION_TYPE as aa, DEVICE_TYPE as ab, CONTACT_TYPE as ac, LINK_QUERY as ad, LINK_MUTATION as ae, AUTH_MUTATION as af, CHECKOUT_MUTATION as ag, PAYMENT_MUTATION as ah, ORDER_MUTATION as ai, DEFAULT_CURRENCY as aj, DEFAULT_COUNTRY as ak, type Result as al, type Ok as am, type Err as an, ok as ao, err as ap, isOk as aq, isErr as ar, mapResult as as, mapError as at, flatMap as au, getOrElse as av, unwrap as aw, toNullable as ax, fromPromise as ay, tryCatch as az, CatalogueQueries as b, type LocationStock as b$, type UpdateOrderStatusInput as b0, type CancelOrderInput as b1, type RefundOrderInput as b2, type ServiceStatus as b3, type StaffRole as b4, type ReminderMethod as b5, type CustomerServicePreferences as b6, type BufferTimes as b7, type ReminderSettings as b8, type CancellationPolicy as b9, type BusinessHours as bA, type CategoryInfo as bB, type Service as bC, type Staff as bD, type TimeSlot as bE, type AvailableSlot as bF, type DayAvailability as bG, type BookingStatus as bH, type Booking as bI, type BookingWithDetails as bJ, type CustomerBookingServiceItem as bK, type CustomerBooking as bL, type GetAvailableSlotsInput as bM, type CheckSlotAvailabilityInput as bN, type CheckSlotAvailabilityResult as bO, type RescheduleBookingInput as bP, type CancelBookingInput as bQ, type CancelBookingResult as bR, type RescheduleBookingResult as bS, type ServiceAvailabilityParams as bT, type ServiceAvailabilityResult as bU, type StockOwnershipType as bV, type StockStatus as bW, type Stock as bX, type StockLevel as bY, type ProductStock as bZ, type VariantStock as b_, type ServiceNotes as ba, type PricingOverrides as bb, type SchedulingMetadata as bc, type StaffAssignment as bd, type ResourceAssignment as be, type SchedulingResult as bf, type DepositResult as bg, type ServiceScheduleRequest as bh, type StaffScheduleItem as bi, type LocationAppointment as bj, type BusinessType as bk, type BusinessPreferences as bl, type Business as bm, type LocationTaxBehavior as bn, type LocationTaxOverrides as bo, type Location as bp, type TimeRange as bq, type TimeRanges as br, type LocationTimeProfile as bs, type Table as bt, type Room as bu, type ServiceCharge as bv, type StorefrontBootstrap as bw, type BusinessWithLocations as bx, type LocationWithDetails as by, type BusinessSettings as bz, createCimplifyClient as c, type AvailabilityCheck as c0, type AvailabilityResult as c1, type InventorySummary as c2, type Customer as c3, type CustomerAddress as c4, type CustomerMobileMoney as c5, type CustomerLinkPreferences as c6, type LinkData as c7, type CreateAddressInput as c8, type UpdateAddressInput as c9, type RetryEvent as cA, type SessionChangeEvent as cB, type ObservabilityHooks as cC, type OrderType as cD, type ElementAppearance as cE, type AddressInfo as cF, type PaymentMethodInfo as cG, type AuthenticatedCustomer as cH, type ElementsCustomerInfo as cI, type AuthenticatedData as cJ, type ElementsCheckoutData as cK, type ElementsCheckoutResult as cL, type CheckoutCartItem as cM, type CheckoutCartData as cN, type ParentToIframeMessage as cO, type IframeToParentMessage as cP, type ElementEventHandler as cQ, type CreateMobileMoneyInput as ca, type EnrollmentData as cb, type AddressData as cc, type MobileMoneyData as cd, type EnrollAndLinkOrderInput as ce, type LinkStatusResult as cf, type LinkEnrollResult as cg, type EnrollAndLinkOrderResult as ch, type LinkSession as ci, type RevokeSessionResult as cj, type RevokeAllSessionsResult as ck, type RequestOtpInput as cl, type VerifyOtpInput as cm, type AuthResponse as cn, type PickupTimeType as co, type PickupTime as cp, type CheckoutAddressInfo as cq, type MobileMoneyDetails as cr, type CheckoutCustomerInfo as cs, type FxQuoteRequest as ct, type FxQuote as cu, type FxRateResponse as cv, type RequestContext as cw, type RequestStartEvent as cx, type RequestSuccessEvent as cy, type RequestErrorEvent as cz, type QuoteBundleSelectionInput as d, type QuoteStatus as e, type QuoteDynamicBuckets as f, type QuoteUiMessage as g, type RefreshQuoteResult as h, CartOperations as i, CheckoutService as j, generateIdempotencyKey as k, type GetOrdersOptions as l, type AuthStatus as m, type OtpResult as n, SchedulingService as o, LiteService as p, FxService as q, type LiteBootstrap as r, CimplifyElements as s, CimplifyElement as t, createElements as u, ELEMENT_TYPES as v, type ElementsOptions as w, type ElementOptions as x, type ElementType as y, type ElementEventType as z };
2344
+ export { type CheckoutStatusContext as $, AuthService as A, BusinessService as B, CimplifyClient as C, type CheckoutMode as D, EVENT_TYPES as E, type FetchQuoteInput as F, type GetProductsOptions as G, type CheckoutOrderType as H, InventoryService as I, type CheckoutPaymentMethod as J, type CheckoutStep as K, LinkService as L, MESSAGE_TYPES as M, type CheckoutFormData as N, OrderQueries as O, type PriceQuote as P, type QuoteCompositeSelectionInput as Q, type RefreshQuoteInput as R, type SearchOptions as S, type TableInfo as T, type UpdateProfileInput as U, type CheckoutResult as V, type NextAction as W, type ProcessCheckoutOptions as X, type ProcessCheckoutResult as Y, type ProcessAndResolveOptions as Z, type CheckoutStatus as _, type CimplifyConfig as a, type OrderFilter as a$, type AbortablePromise as a0, type MobileMoneyProvider as a1, type DeviceType as a2, type ContactType as a3, CHECKOUT_MODE as a4, ORDER_TYPE as a5, PAYMENT_METHOD as a6, CHECKOUT_STEP as a7, PAYMENT_STATE as a8, PICKUP_TIME_TYPE as a9, tryCatch as aA, combine as aB, combineObject as aC, type CatalogueResult as aD, type CatalogueSnapshot as aE, type OrderStatus as aF, type PaymentState as aG, type OrderChannel as aH, type LineType as aI, type OrderLineState as aJ, type OrderLineStatus as aK, type FulfillmentType as aL, type FulfillmentStatus as aM, type FulfillmentLink as aN, type OrderFulfillmentSummary as aO, type FeeBearerType as aP, type AmountToPay as aQ, type LineItem as aR, type Order as aS, type OrderHistory as aT, type OrderGroupPaymentState as aU, type OrderGroup as aV, type OrderGroupPayment as aW, type OrderSplitDetail as aX, type OrderGroupPaymentSummary as aY, type OrderGroupDetails as aZ, type OrderPaymentEvent as a_, MOBILE_MONEY_PROVIDER as aa, AUTHORIZATION_TYPE as ab, DEVICE_TYPE as ac, CONTACT_TYPE as ad, LINK_QUERY as ae, LINK_MUTATION as af, AUTH_MUTATION as ag, CHECKOUT_MUTATION as ah, PAYMENT_MUTATION as ai, ORDER_MUTATION as aj, DEFAULT_CURRENCY as ak, DEFAULT_COUNTRY as al, type Result as am, type Ok as an, type Err as ao, ok as ap, err as aq, isOk as ar, isErr as as, mapResult as at, mapError as au, flatMap as av, getOrElse as aw, unwrap as ax, toNullable as ay, fromPromise as az, CatalogueQueries as b, type VariantStock as b$, type CheckoutInput as b0, type UpdateOrderStatusInput as b1, type CancelOrderInput as b2, type RefundOrderInput as b3, type ServiceStatus as b4, type StaffRole as b5, type ReminderMethod as b6, type CustomerServicePreferences as b7, type BufferTimes as b8, type ReminderSettings as b9, type BusinessSettings as bA, type BusinessHours as bB, type CategoryInfo as bC, type Service as bD, type Staff as bE, type TimeSlot as bF, type AvailableSlot as bG, type DayAvailability as bH, type BookingStatus as bI, type Booking as bJ, type BookingWithDetails as bK, type CustomerBookingServiceItem as bL, type CustomerBooking as bM, type GetAvailableSlotsInput as bN, type CheckSlotAvailabilityInput as bO, type CheckSlotAvailabilityResult as bP, type RescheduleBookingInput as bQ, type CancelBookingInput as bR, type CancelBookingResult as bS, type RescheduleBookingResult as bT, type ServiceAvailabilityParams as bU, type ServiceAvailabilityResult as bV, type StockOwnershipType as bW, type StockStatus as bX, type Stock as bY, type StockLevel as bZ, type ProductStock as b_, type CancellationPolicy as ba, type ServiceNotes as bb, type PricingOverrides as bc, type SchedulingMetadata as bd, type StaffAssignment as be, type ResourceAssignment as bf, type SchedulingResult as bg, type DepositResult as bh, type ServiceScheduleRequest as bi, type StaffScheduleItem as bj, type LocationAppointment as bk, type BusinessType as bl, type BusinessPreferences as bm, type Business as bn, type LocationTaxBehavior as bo, type LocationTaxOverrides as bp, type Location as bq, type TimeRange as br, type TimeRanges as bs, type LocationTimeProfile as bt, type Table as bu, type Room as bv, type ServiceCharge as bw, type StorefrontBootstrap as bx, type BusinessWithLocations as by, type LocationWithDetails as bz, createCimplifyClient as c, type LocationStock as c0, type AvailabilityCheck as c1, type AvailabilityResult as c2, type InventorySummary as c3, type Customer as c4, type CustomerAddress as c5, type CustomerMobileMoney as c6, type CustomerLinkPreferences as c7, type LinkData as c8, type CreateAddressInput as c9, type RequestErrorEvent as cA, type RetryEvent as cB, type SessionChangeEvent as cC, type ObservabilityHooks as cD, type OrderType as cE, type ElementAppearance as cF, type AddressInfo as cG, type PaymentMethodInfo as cH, type AuthenticatedCustomer as cI, type ElementsCustomerInfo as cJ, type AuthenticatedData as cK, type ElementsCheckoutData as cL, type ElementsCheckoutResult as cM, type CheckoutCartItem as cN, type CheckoutCartData as cO, type ParentToIframeMessage as cP, type IframeToParentMessage as cQ, type ElementEventHandler as cR, type UpdateAddressInput as ca, type CreateMobileMoneyInput as cb, type EnrollmentData as cc, type AddressData as cd, type MobileMoneyData as ce, type EnrollAndLinkOrderInput as cf, type LinkStatusResult as cg, type LinkEnrollResult as ch, type EnrollAndLinkOrderResult as ci, type LinkSession as cj, type RevokeSessionResult as ck, type RevokeAllSessionsResult as cl, type RequestOtpInput as cm, type VerifyOtpInput as cn, type AuthResponse as co, type PickupTimeType as cp, type PickupTime as cq, type CheckoutAddressInfo as cr, type MobileMoneyDetails as cs, type CheckoutCustomerInfo as ct, type FxQuoteRequest as cu, type FxQuote as cv, type FxRateResponse as cw, type RequestContext as cx, type RequestStartEvent as cy, type RequestSuccessEvent as cz, type QuoteBundleSelectionInput as d, type QuoteStatus as e, type QuoteDynamicBuckets as f, type QuoteUiMessage as g, type RefreshQuoteResult as h, CartOperations as i, CheckoutService as j, generateIdempotencyKey as k, type GetOrdersOptions as l, type AuthStatus as m, type OtpResult as n, SchedulingService as o, LiteService as p, FxService as q, type LiteBootstrap as r, CimplifyElements as s, CimplifyElement as t, createElements as u, ELEMENT_TYPES as v, type ElementsOptions as w, type ElementOptions as x, type ElementType as y, type ElementEventType as z };
@@ -1102,6 +1102,23 @@ interface CheckoutFormData {
1102
1102
  pay_currency?: CurrencyCode;
1103
1103
  fx_quote_id?: string;
1104
1104
  }
1105
+ type NextAction = {
1106
+ type: "none";
1107
+ } | {
1108
+ type: "card_popup";
1109
+ provider: string;
1110
+ client_secret: string;
1111
+ public_key: string;
1112
+ } | {
1113
+ type: "redirect";
1114
+ authorization_url: string;
1115
+ } | {
1116
+ type: "authorization";
1117
+ authorization_type: AuthorizationType;
1118
+ display_text?: string;
1119
+ } | {
1120
+ type: "poll";
1121
+ };
1105
1122
  interface CheckoutResult {
1106
1123
  order_id: string;
1107
1124
  order_number: string;
@@ -1116,6 +1133,7 @@ interface CheckoutResult {
1116
1133
  provider?: string;
1117
1134
  client_secret?: string;
1118
1135
  public_key?: string;
1136
+ next_action?: NextAction;
1119
1137
  fx?: {
1120
1138
  base_currency: CurrencyCode;
1121
1139
  base_amount: Money;
@@ -2323,4 +2341,4 @@ declare class CimplifyClient {
2323
2341
  }
2324
2342
  declare function createCimplifyClient(config?: CimplifyConfig): CimplifyClient;
2325
2343
 
2326
- export { type AbortablePromise as $, AuthService as A, BusinessService as B, CimplifyClient as C, type CheckoutMode as D, EVENT_TYPES as E, type FetchQuoteInput as F, type GetProductsOptions as G, type CheckoutOrderType as H, InventoryService as I, type CheckoutPaymentMethod as J, type CheckoutStep as K, LinkService as L, MESSAGE_TYPES as M, type CheckoutFormData as N, OrderQueries as O, type PriceQuote as P, type QuoteCompositeSelectionInput as Q, type RefreshQuoteInput as R, type SearchOptions as S, type TableInfo as T, type UpdateProfileInput as U, type CheckoutResult as V, type ProcessCheckoutOptions as W, type ProcessCheckoutResult as X, type ProcessAndResolveOptions as Y, type CheckoutStatus as Z, type CheckoutStatusContext as _, type CimplifyConfig as a, type CheckoutInput as a$, type MobileMoneyProvider as a0, type DeviceType as a1, type ContactType as a2, CHECKOUT_MODE as a3, ORDER_TYPE as a4, PAYMENT_METHOD as a5, CHECKOUT_STEP as a6, PAYMENT_STATE as a7, PICKUP_TIME_TYPE as a8, MOBILE_MONEY_PROVIDER as a9, combine as aA, combineObject as aB, type CatalogueResult as aC, type CatalogueSnapshot as aD, type OrderStatus as aE, type PaymentState as aF, type OrderChannel as aG, type LineType as aH, type OrderLineState as aI, type OrderLineStatus as aJ, type FulfillmentType as aK, type FulfillmentStatus as aL, type FulfillmentLink as aM, type OrderFulfillmentSummary as aN, type FeeBearerType as aO, type AmountToPay as aP, type LineItem as aQ, type Order as aR, type OrderHistory as aS, type OrderGroupPaymentState as aT, type OrderGroup as aU, type OrderGroupPayment as aV, type OrderSplitDetail as aW, type OrderGroupPaymentSummary as aX, type OrderGroupDetails as aY, type OrderPaymentEvent as aZ, type OrderFilter as a_, AUTHORIZATION_TYPE as aa, DEVICE_TYPE as ab, CONTACT_TYPE as ac, LINK_QUERY as ad, LINK_MUTATION as ae, AUTH_MUTATION as af, CHECKOUT_MUTATION as ag, PAYMENT_MUTATION as ah, ORDER_MUTATION as ai, DEFAULT_CURRENCY as aj, DEFAULT_COUNTRY as ak, type Result as al, type Ok as am, type Err as an, ok as ao, err as ap, isOk as aq, isErr as ar, mapResult as as, mapError as at, flatMap as au, getOrElse as av, unwrap as aw, toNullable as ax, fromPromise as ay, tryCatch as az, CatalogueQueries as b, type LocationStock as b$, type UpdateOrderStatusInput as b0, type CancelOrderInput as b1, type RefundOrderInput as b2, type ServiceStatus as b3, type StaffRole as b4, type ReminderMethod as b5, type CustomerServicePreferences as b6, type BufferTimes as b7, type ReminderSettings as b8, type CancellationPolicy as b9, type BusinessHours as bA, type CategoryInfo as bB, type Service as bC, type Staff as bD, type TimeSlot as bE, type AvailableSlot as bF, type DayAvailability as bG, type BookingStatus as bH, type Booking as bI, type BookingWithDetails as bJ, type CustomerBookingServiceItem as bK, type CustomerBooking as bL, type GetAvailableSlotsInput as bM, type CheckSlotAvailabilityInput as bN, type CheckSlotAvailabilityResult as bO, type RescheduleBookingInput as bP, type CancelBookingInput as bQ, type CancelBookingResult as bR, type RescheduleBookingResult as bS, type ServiceAvailabilityParams as bT, type ServiceAvailabilityResult as bU, type StockOwnershipType as bV, type StockStatus as bW, type Stock as bX, type StockLevel as bY, type ProductStock as bZ, type VariantStock as b_, type ServiceNotes as ba, type PricingOverrides as bb, type SchedulingMetadata as bc, type StaffAssignment as bd, type ResourceAssignment as be, type SchedulingResult as bf, type DepositResult as bg, type ServiceScheduleRequest as bh, type StaffScheduleItem as bi, type LocationAppointment as bj, type BusinessType as bk, type BusinessPreferences as bl, type Business as bm, type LocationTaxBehavior as bn, type LocationTaxOverrides as bo, type Location as bp, type TimeRange as bq, type TimeRanges as br, type LocationTimeProfile as bs, type Table as bt, type Room as bu, type ServiceCharge as bv, type StorefrontBootstrap as bw, type BusinessWithLocations as bx, type LocationWithDetails as by, type BusinessSettings as bz, createCimplifyClient as c, type AvailabilityCheck as c0, type AvailabilityResult as c1, type InventorySummary as c2, type Customer as c3, type CustomerAddress as c4, type CustomerMobileMoney as c5, type CustomerLinkPreferences as c6, type LinkData as c7, type CreateAddressInput as c8, type UpdateAddressInput as c9, type RetryEvent as cA, type SessionChangeEvent as cB, type ObservabilityHooks as cC, type OrderType as cD, type ElementAppearance as cE, type AddressInfo as cF, type PaymentMethodInfo as cG, type AuthenticatedCustomer as cH, type ElementsCustomerInfo as cI, type AuthenticatedData as cJ, type ElementsCheckoutData as cK, type ElementsCheckoutResult as cL, type CheckoutCartItem as cM, type CheckoutCartData as cN, type ParentToIframeMessage as cO, type IframeToParentMessage as cP, type ElementEventHandler as cQ, type CreateMobileMoneyInput as ca, type EnrollmentData as cb, type AddressData as cc, type MobileMoneyData as cd, type EnrollAndLinkOrderInput as ce, type LinkStatusResult as cf, type LinkEnrollResult as cg, type EnrollAndLinkOrderResult as ch, type LinkSession as ci, type RevokeSessionResult as cj, type RevokeAllSessionsResult as ck, type RequestOtpInput as cl, type VerifyOtpInput as cm, type AuthResponse as cn, type PickupTimeType as co, type PickupTime as cp, type CheckoutAddressInfo as cq, type MobileMoneyDetails as cr, type CheckoutCustomerInfo as cs, type FxQuoteRequest as ct, type FxQuote as cu, type FxRateResponse as cv, type RequestContext as cw, type RequestStartEvent as cx, type RequestSuccessEvent as cy, type RequestErrorEvent as cz, type QuoteBundleSelectionInput as d, type QuoteStatus as e, type QuoteDynamicBuckets as f, type QuoteUiMessage as g, type RefreshQuoteResult as h, CartOperations as i, CheckoutService as j, generateIdempotencyKey as k, type GetOrdersOptions as l, type AuthStatus as m, type OtpResult as n, SchedulingService as o, LiteService as p, FxService as q, type LiteBootstrap as r, CimplifyElements as s, CimplifyElement as t, createElements as u, ELEMENT_TYPES as v, type ElementsOptions as w, type ElementOptions as x, type ElementType as y, type ElementEventType as z };
2344
+ export { type CheckoutStatusContext as $, AuthService as A, BusinessService as B, CimplifyClient as C, type CheckoutMode as D, EVENT_TYPES as E, type FetchQuoteInput as F, type GetProductsOptions as G, type CheckoutOrderType as H, InventoryService as I, type CheckoutPaymentMethod as J, type CheckoutStep as K, LinkService as L, MESSAGE_TYPES as M, type CheckoutFormData as N, OrderQueries as O, type PriceQuote as P, type QuoteCompositeSelectionInput as Q, type RefreshQuoteInput as R, type SearchOptions as S, type TableInfo as T, type UpdateProfileInput as U, type CheckoutResult as V, type NextAction as W, type ProcessCheckoutOptions as X, type ProcessCheckoutResult as Y, type ProcessAndResolveOptions as Z, type CheckoutStatus as _, type CimplifyConfig as a, type OrderFilter as a$, type AbortablePromise as a0, type MobileMoneyProvider as a1, type DeviceType as a2, type ContactType as a3, CHECKOUT_MODE as a4, ORDER_TYPE as a5, PAYMENT_METHOD as a6, CHECKOUT_STEP as a7, PAYMENT_STATE as a8, PICKUP_TIME_TYPE as a9, tryCatch as aA, combine as aB, combineObject as aC, type CatalogueResult as aD, type CatalogueSnapshot as aE, type OrderStatus as aF, type PaymentState as aG, type OrderChannel as aH, type LineType as aI, type OrderLineState as aJ, type OrderLineStatus as aK, type FulfillmentType as aL, type FulfillmentStatus as aM, type FulfillmentLink as aN, type OrderFulfillmentSummary as aO, type FeeBearerType as aP, type AmountToPay as aQ, type LineItem as aR, type Order as aS, type OrderHistory as aT, type OrderGroupPaymentState as aU, type OrderGroup as aV, type OrderGroupPayment as aW, type OrderSplitDetail as aX, type OrderGroupPaymentSummary as aY, type OrderGroupDetails as aZ, type OrderPaymentEvent as a_, MOBILE_MONEY_PROVIDER as aa, AUTHORIZATION_TYPE as ab, DEVICE_TYPE as ac, CONTACT_TYPE as ad, LINK_QUERY as ae, LINK_MUTATION as af, AUTH_MUTATION as ag, CHECKOUT_MUTATION as ah, PAYMENT_MUTATION as ai, ORDER_MUTATION as aj, DEFAULT_CURRENCY as ak, DEFAULT_COUNTRY as al, type Result as am, type Ok as an, type Err as ao, ok as ap, err as aq, isOk as ar, isErr as as, mapResult as at, mapError as au, flatMap as av, getOrElse as aw, unwrap as ax, toNullable as ay, fromPromise as az, CatalogueQueries as b, type VariantStock as b$, type CheckoutInput as b0, type UpdateOrderStatusInput as b1, type CancelOrderInput as b2, type RefundOrderInput as b3, type ServiceStatus as b4, type StaffRole as b5, type ReminderMethod as b6, type CustomerServicePreferences as b7, type BufferTimes as b8, type ReminderSettings as b9, type BusinessSettings as bA, type BusinessHours as bB, type CategoryInfo as bC, type Service as bD, type Staff as bE, type TimeSlot as bF, type AvailableSlot as bG, type DayAvailability as bH, type BookingStatus as bI, type Booking as bJ, type BookingWithDetails as bK, type CustomerBookingServiceItem as bL, type CustomerBooking as bM, type GetAvailableSlotsInput as bN, type CheckSlotAvailabilityInput as bO, type CheckSlotAvailabilityResult as bP, type RescheduleBookingInput as bQ, type CancelBookingInput as bR, type CancelBookingResult as bS, type RescheduleBookingResult as bT, type ServiceAvailabilityParams as bU, type ServiceAvailabilityResult as bV, type StockOwnershipType as bW, type StockStatus as bX, type Stock as bY, type StockLevel as bZ, type ProductStock as b_, type CancellationPolicy as ba, type ServiceNotes as bb, type PricingOverrides as bc, type SchedulingMetadata as bd, type StaffAssignment as be, type ResourceAssignment as bf, type SchedulingResult as bg, type DepositResult as bh, type ServiceScheduleRequest as bi, type StaffScheduleItem as bj, type LocationAppointment as bk, type BusinessType as bl, type BusinessPreferences as bm, type Business as bn, type LocationTaxBehavior as bo, type LocationTaxOverrides as bp, type Location as bq, type TimeRange as br, type TimeRanges as bs, type LocationTimeProfile as bt, type Table as bu, type Room as bv, type ServiceCharge as bw, type StorefrontBootstrap as bx, type BusinessWithLocations as by, type LocationWithDetails as bz, createCimplifyClient as c, type LocationStock as c0, type AvailabilityCheck as c1, type AvailabilityResult as c2, type InventorySummary as c3, type Customer as c4, type CustomerAddress as c5, type CustomerMobileMoney as c6, type CustomerLinkPreferences as c7, type LinkData as c8, type CreateAddressInput as c9, type RequestErrorEvent as cA, type RetryEvent as cB, type SessionChangeEvent as cC, type ObservabilityHooks as cD, type OrderType as cE, type ElementAppearance as cF, type AddressInfo as cG, type PaymentMethodInfo as cH, type AuthenticatedCustomer as cI, type ElementsCustomerInfo as cJ, type AuthenticatedData as cK, type ElementsCheckoutData as cL, type ElementsCheckoutResult as cM, type CheckoutCartItem as cN, type CheckoutCartData as cO, type ParentToIframeMessage as cP, type IframeToParentMessage as cQ, type ElementEventHandler as cR, type UpdateAddressInput as ca, type CreateMobileMoneyInput as cb, type EnrollmentData as cc, type AddressData as cd, type MobileMoneyData as ce, type EnrollAndLinkOrderInput as cf, type LinkStatusResult as cg, type LinkEnrollResult as ch, type EnrollAndLinkOrderResult as ci, type LinkSession as cj, type RevokeSessionResult as ck, type RevokeAllSessionsResult as cl, type RequestOtpInput as cm, type VerifyOtpInput as cn, type AuthResponse as co, type PickupTimeType as cp, type PickupTime as cq, type CheckoutAddressInfo as cr, type MobileMoneyDetails as cs, type CheckoutCustomerInfo as ct, type FxQuoteRequest as cu, type FxQuote as cv, type FxRateResponse as cw, type RequestContext as cx, type RequestStartEvent as cy, type RequestSuccessEvent as cz, type QuoteBundleSelectionInput as d, type QuoteStatus as e, type QuoteDynamicBuckets as f, type QuoteUiMessage as g, type RefreshQuoteResult as h, CartOperations as i, CheckoutService as j, generateIdempotencyKey as k, type GetOrdersOptions as l, type AuthStatus as m, type OtpResult as n, SchedulingService as o, LiteService as p, FxService as q, type LiteBootstrap as r, CimplifyElements as s, CimplifyElement as t, createElements as u, ELEMENT_TYPES as v, type ElementsOptions as w, type ElementOptions as x, type ElementType as y, type ElementEventType as z };
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-iRG2DBq0.mjs';
1
+ export { ab as AUTHORIZATION_TYPE, ag as AUTH_MUTATION, a0 as AbortablePromise, cd as AddressData, cG as AddressInfo, aQ as AmountToPay, co as AuthResponse, A as AuthService, m as AuthStatus, cI as AuthenticatedCustomer, cK as AuthenticatedData, c1 as AvailabilityCheck, c2 as AvailabilityResult, bG as AvailableSlot, bJ as Booking, bI as BookingStatus, bK as BookingWithDetails, b8 as BufferTimes, bn as Business, bB as BusinessHours, bm as BusinessPreferences, B as BusinessService, bA as BusinessSettings, bl as BusinessType, by as BusinessWithLocations, a4 as CHECKOUT_MODE, ah as CHECKOUT_MUTATION, a7 as CHECKOUT_STEP, ad as CONTACT_TYPE, bR as CancelBookingInput, bS as CancelBookingResult, b2 as CancelOrderInput, ba as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aD as CatalogueResult, aE as CatalogueSnapshot, bC as CategoryInfo, bO as CheckSlotAvailabilityInput, bP as CheckSlotAvailabilityResult, cr as CheckoutAddressInfo, cO as CheckoutCartData, cN as CheckoutCartItem, ct as CheckoutCustomerInfo, N as CheckoutFormData, b0 as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, _ as CheckoutStatus, $ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a3 as ContactType, c9 as CreateAddressInput, cb as CreateMobileMoneyInput, c4 as Customer, c5 as CustomerAddress, bM as CustomerBooking, bL as CustomerBookingServiceItem, c7 as CustomerLinkPreferences, c6 as CustomerMobileMoney, b7 as CustomerServicePreferences, al as DEFAULT_COUNTRY, ak as DEFAULT_CURRENCY, ac as DEVICE_TYPE, bH as DayAvailability, bh as DepositResult, a2 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cF as ElementAppearance, cR as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cL as ElementsCheckoutData, cM as ElementsCheckoutResult, cJ as ElementsCustomerInfo, w as ElementsOptions, cf as EnrollAndLinkOrderInput, ci as EnrollAndLinkOrderResult, cc as EnrollmentData, ao as Err, aP as FeeBearerType, F as FetchQuoteInput, aN as FulfillmentLink, aM as FulfillmentStatus, aL as FulfillmentType, cv as FxQuote, cu as FxQuoteRequest, cw as FxRateResponse, q as FxService, bN as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cQ as IframeToParentMessage, I as InventoryService, c3 as InventorySummary, af as LINK_MUTATION, ae as LINK_QUERY, aR as LineItem, aI as LineType, c8 as LinkData, ch as LinkEnrollResult, L as LinkService, cj as LinkSession, cg as LinkStatusResult, r as LiteBootstrap, p as LiteService, bq as Location, bk as LocationAppointment, c0 as LocationStock, bo as LocationTaxBehavior, bp as LocationTaxOverrides, bt as LocationTimeProfile, bz as LocationWithDetails, M as MESSAGE_TYPES, aa as MOBILE_MONEY_PROVIDER, ce as MobileMoneyData, cs as MobileMoneyDetails, a1 as MobileMoneyProvider, W as NextAction, aj as ORDER_MUTATION, a5 as ORDER_TYPE, cD as ObservabilityHooks, an as Ok, aS as Order, aH as OrderChannel, a$ as OrderFilter, aO as OrderFulfillmentSummary, aV as OrderGroup, aZ as OrderGroupDetails, aW as OrderGroupPayment, aU as OrderGroupPaymentState, aY as OrderGroupPaymentSummary, aT as OrderHistory, aJ as OrderLineState, aK as OrderLineStatus, a_ as OrderPaymentEvent, O as OrderQueries, aX as OrderSplitDetail, aF as OrderStatus, cE as OrderType, n as OtpResult, a6 as PAYMENT_METHOD, ai as PAYMENT_MUTATION, a8 as PAYMENT_STATE, a9 as PICKUP_TIME_TYPE, cP as ParentToIframeMessage, cH as PaymentMethodInfo, aG as PaymentState, cq as PickupTime, cp as PickupTimeType, P as PriceQuote, bc as PricingOverrides, Z as ProcessAndResolveOptions, X as ProcessCheckoutOptions, Y as ProcessCheckoutResult, b_ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b3 as RefundOrderInput, b6 as ReminderMethod, b9 as ReminderSettings, cx as RequestContext, cA as RequestErrorEvent, cm as RequestOtpInput, cy as RequestStartEvent, cz as RequestSuccessEvent, bQ as RescheduleBookingInput, bT as RescheduleBookingResult, bf as ResourceAssignment, am as Result, cB as RetryEvent, cl as RevokeAllSessionsResult, ck as RevokeSessionResult, bv as Room, bd as SchedulingMetadata, bg as SchedulingResult, o as SchedulingService, S as SearchOptions, bD as Service, bU as ServiceAvailabilityParams, bV as ServiceAvailabilityResult, bw as ServiceCharge, bb as ServiceNotes, bi as ServiceScheduleRequest, b4 as ServiceStatus, cC as SessionChangeEvent, bE as Staff, be as StaffAssignment, b5 as StaffRole, bj as StaffScheduleItem, bY as Stock, bZ as StockLevel, bW as StockOwnershipType, bX as StockStatus, bx as StorefrontBootstrap, bu as Table, T as TableInfo, br as TimeRange, bs as TimeRanges, bF as TimeSlot, ca as UpdateAddressInput, b1 as UpdateOrderStatusInput, U as UpdateProfileInput, b$ as VariantStock, cn as VerifyOtpInput, aB as combine, aC as combineObject, c as createCimplifyClient, u as createElements, aq as err, av as flatMap, az as fromPromise, k as generateIdempotencyKey, aw as getOrElse, as as isErr, ar as isOk, au as mapError, at as mapResult, ap as ok, ay as toNullable, aA as tryCatch, ax as unwrap } from './client-6MsOWo8f.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-8SahVQEy.js';
1
+ export { ab as AUTHORIZATION_TYPE, ag as AUTH_MUTATION, a0 as AbortablePromise, cd as AddressData, cG as AddressInfo, aQ as AmountToPay, co as AuthResponse, A as AuthService, m as AuthStatus, cI as AuthenticatedCustomer, cK as AuthenticatedData, c1 as AvailabilityCheck, c2 as AvailabilityResult, bG as AvailableSlot, bJ as Booking, bI as BookingStatus, bK as BookingWithDetails, b8 as BufferTimes, bn as Business, bB as BusinessHours, bm as BusinessPreferences, B as BusinessService, bA as BusinessSettings, bl as BusinessType, by as BusinessWithLocations, a4 as CHECKOUT_MODE, ah as CHECKOUT_MUTATION, a7 as CHECKOUT_STEP, ad as CONTACT_TYPE, bR as CancelBookingInput, bS as CancelBookingResult, b2 as CancelOrderInput, ba as CancellationPolicy, i as CartOperations, b as CatalogueQueries, aD as CatalogueResult, aE as CatalogueSnapshot, bC as CategoryInfo, bO as CheckSlotAvailabilityInput, bP as CheckSlotAvailabilityResult, cr as CheckoutAddressInfo, cO as CheckoutCartData, cN as CheckoutCartItem, ct as CheckoutCustomerInfo, N as CheckoutFormData, b0 as CheckoutInput, D as CheckoutMode, j as CheckoutOperations, H as CheckoutOrderType, J as CheckoutPaymentMethod, V as CheckoutResult, j as CheckoutService, _ as CheckoutStatus, $ as CheckoutStatusContext, K as CheckoutStep, C as CimplifyClient, a as CimplifyConfig, t as CimplifyElement, s as CimplifyElements, a3 as ContactType, c9 as CreateAddressInput, cb as CreateMobileMoneyInput, c4 as Customer, c5 as CustomerAddress, bM as CustomerBooking, bL as CustomerBookingServiceItem, c7 as CustomerLinkPreferences, c6 as CustomerMobileMoney, b7 as CustomerServicePreferences, al as DEFAULT_COUNTRY, ak as DEFAULT_CURRENCY, ac as DEVICE_TYPE, bH as DayAvailability, bh as DepositResult, a2 as DeviceType, v as ELEMENT_TYPES, E as EVENT_TYPES, cF as ElementAppearance, cR as ElementEventHandler, z as ElementEventType, x as ElementOptions, y as ElementType, cL as ElementsCheckoutData, cM as ElementsCheckoutResult, cJ as ElementsCustomerInfo, w as ElementsOptions, cf as EnrollAndLinkOrderInput, ci as EnrollAndLinkOrderResult, cc as EnrollmentData, ao as Err, aP as FeeBearerType, F as FetchQuoteInput, aN as FulfillmentLink, aM as FulfillmentStatus, aL as FulfillmentType, cv as FxQuote, cu as FxQuoteRequest, cw as FxRateResponse, q as FxService, bN as GetAvailableSlotsInput, l as GetOrdersOptions, G as GetProductsOptions, cQ as IframeToParentMessage, I as InventoryService, c3 as InventorySummary, af as LINK_MUTATION, ae as LINK_QUERY, aR as LineItem, aI as LineType, c8 as LinkData, ch as LinkEnrollResult, L as LinkService, cj as LinkSession, cg as LinkStatusResult, r as LiteBootstrap, p as LiteService, bq as Location, bk as LocationAppointment, c0 as LocationStock, bo as LocationTaxBehavior, bp as LocationTaxOverrides, bt as LocationTimeProfile, bz as LocationWithDetails, M as MESSAGE_TYPES, aa as MOBILE_MONEY_PROVIDER, ce as MobileMoneyData, cs as MobileMoneyDetails, a1 as MobileMoneyProvider, W as NextAction, aj as ORDER_MUTATION, a5 as ORDER_TYPE, cD as ObservabilityHooks, an as Ok, aS as Order, aH as OrderChannel, a$ as OrderFilter, aO as OrderFulfillmentSummary, aV as OrderGroup, aZ as OrderGroupDetails, aW as OrderGroupPayment, aU as OrderGroupPaymentState, aY as OrderGroupPaymentSummary, aT as OrderHistory, aJ as OrderLineState, aK as OrderLineStatus, a_ as OrderPaymentEvent, O as OrderQueries, aX as OrderSplitDetail, aF as OrderStatus, cE as OrderType, n as OtpResult, a6 as PAYMENT_METHOD, ai as PAYMENT_MUTATION, a8 as PAYMENT_STATE, a9 as PICKUP_TIME_TYPE, cP as ParentToIframeMessage, cH as PaymentMethodInfo, aG as PaymentState, cq as PickupTime, cp as PickupTimeType, P as PriceQuote, bc as PricingOverrides, Z as ProcessAndResolveOptions, X as ProcessCheckoutOptions, Y as ProcessCheckoutResult, b_ as ProductStock, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, b3 as RefundOrderInput, b6 as ReminderMethod, b9 as ReminderSettings, cx as RequestContext, cA as RequestErrorEvent, cm as RequestOtpInput, cy as RequestStartEvent, cz as RequestSuccessEvent, bQ as RescheduleBookingInput, bT as RescheduleBookingResult, bf as ResourceAssignment, am as Result, cB as RetryEvent, cl as RevokeAllSessionsResult, ck as RevokeSessionResult, bv as Room, bd as SchedulingMetadata, bg as SchedulingResult, o as SchedulingService, S as SearchOptions, bD as Service, bU as ServiceAvailabilityParams, bV as ServiceAvailabilityResult, bw as ServiceCharge, bb as ServiceNotes, bi as ServiceScheduleRequest, b4 as ServiceStatus, cC as SessionChangeEvent, bE as Staff, be as StaffAssignment, b5 as StaffRole, bj as StaffScheduleItem, bY as Stock, bZ as StockLevel, bW as StockOwnershipType, bX as StockStatus, bx as StorefrontBootstrap, bu as Table, T as TableInfo, br as TimeRange, bs as TimeRanges, bF as TimeSlot, ca as UpdateAddressInput, b1 as UpdateOrderStatusInput, U as UpdateProfileInput, b$ as VariantStock, cn as VerifyOtpInput, aB as combine, aC as combineObject, c as createCimplifyClient, u as createElements, aq as err, av as flatMap, az as fromPromise, k as generateIdempotencyKey, aw as getOrElse, as as isErr, ar as isOk, au as mapError, at as mapResult, ap as ok, ay as toNullable, aA as tryCatch, ax as unwrap } from './client-CVJ0S99a.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
@@ -1339,6 +1339,10 @@ var DEFAULT_POLL_INTERVAL_MS = 3e3;
1339
1339
  var DEFAULT_MAX_POLL_ATTEMPTS = 60;
1340
1340
  var MAX_CONSECUTIVE_NETWORK_ERRORS = 5;
1341
1341
  var CARD_PROVIDER_PAYSTACK = "paystack";
1342
+ var NEXT_ACTION_NONE = "none";
1343
+ var NEXT_ACTION_CARD_POPUP = "card_popup";
1344
+ var NEXT_ACTION_REDIRECT = "redirect";
1345
+ var NEXT_ACTION_AUTHORIZATION = "authorization";
1342
1346
  function normalizeCardPopupError(error) {
1343
1347
  if (!error || error === "PAYMENT_CANCELLED" || error === "CANCELLED") {
1344
1348
  return "PAYMENT_CANCELLED";
@@ -1378,7 +1382,8 @@ function isValidMobileMoneyProvider(value) {
1378
1382
  return VALID_MOBILE_MONEY_PROVIDERS.has(value);
1379
1383
  }
1380
1384
  function normalizeAuthorizationType(value) {
1381
- return value === "otp" || value === "pin" ? value : void 0;
1385
+ const lower = value?.toLowerCase();
1386
+ return lower === "otp" || lower === "pin" ? lower : void 0;
1382
1387
  }
1383
1388
  function formatMoney2(value) {
1384
1389
  if (typeof value === "number" && Number.isFinite(value)) {
@@ -1425,6 +1430,9 @@ var CheckoutResolver = class {
1425
1430
  if (!checkoutResult.order_id) {
1426
1431
  return this.fail("CHECKOUT_FAILED", "Checkout did not return an order ID.", false);
1427
1432
  }
1433
+ if (checkoutResult.next_action) {
1434
+ return this.resolveNextAction(checkoutResult);
1435
+ }
1428
1436
  let latestCheckoutResult = checkoutResult;
1429
1437
  let authorizationType = normalizeAuthorizationType(checkoutResult.authorization_type);
1430
1438
  let paymentReference = checkoutResult.payment_reference;
@@ -1540,6 +1548,110 @@ var CheckoutResolver = class {
1540
1548
  return this.fail("CHECKOUT_FAILED", message, true);
1541
1549
  }
1542
1550
  }
1551
+ async resolveNextAction(checkoutResult) {
1552
+ const action = checkoutResult.next_action;
1553
+ if (this.isSuccessfulStatus(checkoutResult.payment_status)) {
1554
+ return this.finalizeSuccess(checkoutResult);
1555
+ }
1556
+ let latestCheckoutResult = checkoutResult;
1557
+ let paymentReference = checkoutResult.payment_reference;
1558
+ switch (action.type) {
1559
+ case NEXT_ACTION_NONE:
1560
+ return this.finalizeSuccess(checkoutResult);
1561
+ case NEXT_ACTION_CARD_POPUP: {
1562
+ const provider = normalizeCardProvider(action.provider);
1563
+ this.emit("awaiting_authorization", {
1564
+ display_text: "Complete payment in the card authorization popup.",
1565
+ order_id: checkoutResult.order_id,
1566
+ order_number: checkoutResult.order_number
1567
+ });
1568
+ if (!this.allowPopups) {
1569
+ return this.fail(
1570
+ "PROVIDER_UNAVAILABLE",
1571
+ "Card payment popup is unavailable in this environment.",
1572
+ false
1573
+ );
1574
+ }
1575
+ const popupResult = await openCardPopup(
1576
+ provider,
1577
+ checkoutResult,
1578
+ this.checkoutData.customer.email || "customer@cimplify.io",
1579
+ this.getOrderCurrency(checkoutResult),
1580
+ this.signal
1581
+ );
1582
+ if (!popupResult.success) {
1583
+ const popupError = normalizeCardPopupError(popupResult.error);
1584
+ if (popupError === "POPUP_BLOCKED") {
1585
+ return this.fail(
1586
+ "POPUP_BLOCKED",
1587
+ "Unable to open card payment popup. Please allow popups and try again.",
1588
+ true
1589
+ );
1590
+ }
1591
+ if (popupError === "PROVIDER_UNAVAILABLE") {
1592
+ return this.fail("PROVIDER_UNAVAILABLE", "Card payment provider is unavailable.", false);
1593
+ }
1594
+ return this.fail("PAYMENT_CANCELLED", "Card payment was cancelled before completion.", true);
1595
+ }
1596
+ paymentReference = popupResult.reference || paymentReference;
1597
+ break;
1598
+ }
1599
+ case NEXT_ACTION_REDIRECT: {
1600
+ if (typeof window !== "undefined" && this.returnUrl) {
1601
+ window.location.assign(action.authorization_url);
1602
+ return this.fail("REDIRECT_REQUIRED", "Redirecting to complete payment authorization.", true);
1603
+ }
1604
+ if (typeof window !== "undefined") {
1605
+ const popup = window.open(
1606
+ action.authorization_url,
1607
+ "cimplify-auth",
1608
+ "width=520,height=760,noopener,noreferrer"
1609
+ );
1610
+ if (!popup) {
1611
+ return this.fail(
1612
+ "POPUP_BLOCKED",
1613
+ "Authorization popup was blocked. Please allow popups and retry.",
1614
+ true
1615
+ );
1616
+ }
1617
+ }
1618
+ break;
1619
+ }
1620
+ case NEXT_ACTION_AUTHORIZATION: {
1621
+ const authType = normalizeAuthorizationType(action.authorization_type);
1622
+ const authorization = await this.handleAuthorization({
1623
+ authorizationType: authType,
1624
+ paymentReference,
1625
+ displayText: action.display_text,
1626
+ provider: checkoutResult.provider
1627
+ });
1628
+ if (!authorization.ok) {
1629
+ return authorization.result;
1630
+ }
1631
+ if (authorization.value) {
1632
+ latestCheckoutResult = authorization.value;
1633
+ paymentReference = authorization.value.payment_reference || paymentReference;
1634
+ if (this.isSuccessfulStatus(authorization.value.payment_status)) {
1635
+ return this.finalizeSuccess(authorization.value);
1636
+ }
1637
+ if (this.isFailureStatus(authorization.value.payment_status)) {
1638
+ return this.fail(
1639
+ "AUTHORIZATION_FAILED",
1640
+ authorization.value.display_text || "Payment authorization failed.",
1641
+ false
1642
+ );
1643
+ }
1644
+ }
1645
+ break;
1646
+ }
1647
+ }
1648
+ return this.pollUntilTerminal({
1649
+ orderId: checkoutResult.order_id,
1650
+ latestCheckoutResult,
1651
+ paymentReference,
1652
+ authorizationType: normalizeAuthorizationType(checkoutResult.authorization_type)
1653
+ });
1654
+ }
1543
1655
  async pollUntilTerminal(input) {
1544
1656
  let consecutiveErrors = 0;
1545
1657
  let latestCheckoutResult = input.latestCheckoutResult;
package/dist/index.mjs CHANGED
@@ -1337,6 +1337,10 @@ var DEFAULT_POLL_INTERVAL_MS = 3e3;
1337
1337
  var DEFAULT_MAX_POLL_ATTEMPTS = 60;
1338
1338
  var MAX_CONSECUTIVE_NETWORK_ERRORS = 5;
1339
1339
  var CARD_PROVIDER_PAYSTACK = "paystack";
1340
+ var NEXT_ACTION_NONE = "none";
1341
+ var NEXT_ACTION_CARD_POPUP = "card_popup";
1342
+ var NEXT_ACTION_REDIRECT = "redirect";
1343
+ var NEXT_ACTION_AUTHORIZATION = "authorization";
1340
1344
  function normalizeCardPopupError(error) {
1341
1345
  if (!error || error === "PAYMENT_CANCELLED" || error === "CANCELLED") {
1342
1346
  return "PAYMENT_CANCELLED";
@@ -1376,7 +1380,8 @@ function isValidMobileMoneyProvider(value) {
1376
1380
  return VALID_MOBILE_MONEY_PROVIDERS.has(value);
1377
1381
  }
1378
1382
  function normalizeAuthorizationType(value) {
1379
- return value === "otp" || value === "pin" ? value : void 0;
1383
+ const lower = value?.toLowerCase();
1384
+ return lower === "otp" || lower === "pin" ? lower : void 0;
1380
1385
  }
1381
1386
  function formatMoney2(value) {
1382
1387
  if (typeof value === "number" && Number.isFinite(value)) {
@@ -1423,6 +1428,9 @@ var CheckoutResolver = class {
1423
1428
  if (!checkoutResult.order_id) {
1424
1429
  return this.fail("CHECKOUT_FAILED", "Checkout did not return an order ID.", false);
1425
1430
  }
1431
+ if (checkoutResult.next_action) {
1432
+ return this.resolveNextAction(checkoutResult);
1433
+ }
1426
1434
  let latestCheckoutResult = checkoutResult;
1427
1435
  let authorizationType = normalizeAuthorizationType(checkoutResult.authorization_type);
1428
1436
  let paymentReference = checkoutResult.payment_reference;
@@ -1538,6 +1546,110 @@ var CheckoutResolver = class {
1538
1546
  return this.fail("CHECKOUT_FAILED", message, true);
1539
1547
  }
1540
1548
  }
1549
+ async resolveNextAction(checkoutResult) {
1550
+ const action = checkoutResult.next_action;
1551
+ if (this.isSuccessfulStatus(checkoutResult.payment_status)) {
1552
+ return this.finalizeSuccess(checkoutResult);
1553
+ }
1554
+ let latestCheckoutResult = checkoutResult;
1555
+ let paymentReference = checkoutResult.payment_reference;
1556
+ switch (action.type) {
1557
+ case NEXT_ACTION_NONE:
1558
+ return this.finalizeSuccess(checkoutResult);
1559
+ case NEXT_ACTION_CARD_POPUP: {
1560
+ const provider = normalizeCardProvider(action.provider);
1561
+ this.emit("awaiting_authorization", {
1562
+ display_text: "Complete payment in the card authorization popup.",
1563
+ order_id: checkoutResult.order_id,
1564
+ order_number: checkoutResult.order_number
1565
+ });
1566
+ if (!this.allowPopups) {
1567
+ return this.fail(
1568
+ "PROVIDER_UNAVAILABLE",
1569
+ "Card payment popup is unavailable in this environment.",
1570
+ false
1571
+ );
1572
+ }
1573
+ const popupResult = await openCardPopup(
1574
+ provider,
1575
+ checkoutResult,
1576
+ this.checkoutData.customer.email || "customer@cimplify.io",
1577
+ this.getOrderCurrency(checkoutResult),
1578
+ this.signal
1579
+ );
1580
+ if (!popupResult.success) {
1581
+ const popupError = normalizeCardPopupError(popupResult.error);
1582
+ if (popupError === "POPUP_BLOCKED") {
1583
+ return this.fail(
1584
+ "POPUP_BLOCKED",
1585
+ "Unable to open card payment popup. Please allow popups and try again.",
1586
+ true
1587
+ );
1588
+ }
1589
+ if (popupError === "PROVIDER_UNAVAILABLE") {
1590
+ return this.fail("PROVIDER_UNAVAILABLE", "Card payment provider is unavailable.", false);
1591
+ }
1592
+ return this.fail("PAYMENT_CANCELLED", "Card payment was cancelled before completion.", true);
1593
+ }
1594
+ paymentReference = popupResult.reference || paymentReference;
1595
+ break;
1596
+ }
1597
+ case NEXT_ACTION_REDIRECT: {
1598
+ if (typeof window !== "undefined" && this.returnUrl) {
1599
+ window.location.assign(action.authorization_url);
1600
+ return this.fail("REDIRECT_REQUIRED", "Redirecting to complete payment authorization.", true);
1601
+ }
1602
+ if (typeof window !== "undefined") {
1603
+ const popup = window.open(
1604
+ action.authorization_url,
1605
+ "cimplify-auth",
1606
+ "width=520,height=760,noopener,noreferrer"
1607
+ );
1608
+ if (!popup) {
1609
+ return this.fail(
1610
+ "POPUP_BLOCKED",
1611
+ "Authorization popup was blocked. Please allow popups and retry.",
1612
+ true
1613
+ );
1614
+ }
1615
+ }
1616
+ break;
1617
+ }
1618
+ case NEXT_ACTION_AUTHORIZATION: {
1619
+ const authType = normalizeAuthorizationType(action.authorization_type);
1620
+ const authorization = await this.handleAuthorization({
1621
+ authorizationType: authType,
1622
+ paymentReference,
1623
+ displayText: action.display_text,
1624
+ provider: checkoutResult.provider
1625
+ });
1626
+ if (!authorization.ok) {
1627
+ return authorization.result;
1628
+ }
1629
+ if (authorization.value) {
1630
+ latestCheckoutResult = authorization.value;
1631
+ paymentReference = authorization.value.payment_reference || paymentReference;
1632
+ if (this.isSuccessfulStatus(authorization.value.payment_status)) {
1633
+ return this.finalizeSuccess(authorization.value);
1634
+ }
1635
+ if (this.isFailureStatus(authorization.value.payment_status)) {
1636
+ return this.fail(
1637
+ "AUTHORIZATION_FAILED",
1638
+ authorization.value.display_text || "Payment authorization failed.",
1639
+ false
1640
+ );
1641
+ }
1642
+ }
1643
+ break;
1644
+ }
1645
+ }
1646
+ return this.pollUntilTerminal({
1647
+ orderId: checkoutResult.order_id,
1648
+ latestCheckoutResult,
1649
+ paymentReference,
1650
+ authorizationType: normalizeAuthorizationType(checkoutResult.authorization_type)
1651
+ });
1652
+ }
1541
1653
  async pollUntilTerminal(input) {
1542
1654
  let consecutiveErrors = 0;
1543
1655
  let latestCheckoutResult = input.latestCheckoutResult;
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-iRG2DBq0.mjs';
1
+ import { C as CimplifyClient, Y as ProcessCheckoutResult, _ as CheckoutStatus, $ as CheckoutStatusContext, bq as Location, bn as Business, aS as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cK as AuthenticatedData, cG as AddressInfo, cH as PaymentMethodInfo, cM as ElementsCheckoutResult, X as ProcessCheckoutOptions } from './client-6MsOWo8f.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-8SahVQEy.js';
1
+ import { C as CimplifyClient, Y as ProcessCheckoutResult, _ as CheckoutStatus, $ as CheckoutStatusContext, bq as Location, bn as Business, aS as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, s as CimplifyElements, w as ElementsOptions, cK as AuthenticatedData, cG as AddressInfo, cH as PaymentMethodInfo, cM as ElementsCheckoutResult, X as ProcessCheckoutOptions } from './client-CVJ0S99a.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
@@ -1563,6 +1563,10 @@ var DEFAULT_POLL_INTERVAL_MS = 3e3;
1563
1563
  var DEFAULT_MAX_POLL_ATTEMPTS = 60;
1564
1564
  var MAX_CONSECUTIVE_NETWORK_ERRORS = 5;
1565
1565
  var CARD_PROVIDER_PAYSTACK = "paystack";
1566
+ var NEXT_ACTION_NONE = "none";
1567
+ var NEXT_ACTION_CARD_POPUP = "card_popup";
1568
+ var NEXT_ACTION_REDIRECT = "redirect";
1569
+ var NEXT_ACTION_AUTHORIZATION = "authorization";
1566
1570
  function normalizeCardPopupError(error) {
1567
1571
  if (!error || error === "PAYMENT_CANCELLED" || error === "CANCELLED") {
1568
1572
  return "PAYMENT_CANCELLED";
@@ -1602,7 +1606,8 @@ function isValidMobileMoneyProvider(value) {
1602
1606
  return VALID_MOBILE_MONEY_PROVIDERS.has(value);
1603
1607
  }
1604
1608
  function normalizeAuthorizationType(value) {
1605
- return value === "otp" || value === "pin" ? value : void 0;
1609
+ const lower = value?.toLowerCase();
1610
+ return lower === "otp" || lower === "pin" ? lower : void 0;
1606
1611
  }
1607
1612
  function formatMoney2(value) {
1608
1613
  if (typeof value === "number" && Number.isFinite(value)) {
@@ -1649,6 +1654,9 @@ var CheckoutResolver = class {
1649
1654
  if (!checkoutResult.order_id) {
1650
1655
  return this.fail("CHECKOUT_FAILED", "Checkout did not return an order ID.", false);
1651
1656
  }
1657
+ if (checkoutResult.next_action) {
1658
+ return this.resolveNextAction(checkoutResult);
1659
+ }
1652
1660
  let latestCheckoutResult = checkoutResult;
1653
1661
  let authorizationType = normalizeAuthorizationType(checkoutResult.authorization_type);
1654
1662
  let paymentReference = checkoutResult.payment_reference;
@@ -1764,6 +1772,110 @@ var CheckoutResolver = class {
1764
1772
  return this.fail("CHECKOUT_FAILED", message, true);
1765
1773
  }
1766
1774
  }
1775
+ async resolveNextAction(checkoutResult) {
1776
+ const action = checkoutResult.next_action;
1777
+ if (this.isSuccessfulStatus(checkoutResult.payment_status)) {
1778
+ return this.finalizeSuccess(checkoutResult);
1779
+ }
1780
+ let latestCheckoutResult = checkoutResult;
1781
+ let paymentReference = checkoutResult.payment_reference;
1782
+ switch (action.type) {
1783
+ case NEXT_ACTION_NONE:
1784
+ return this.finalizeSuccess(checkoutResult);
1785
+ case NEXT_ACTION_CARD_POPUP: {
1786
+ const provider = normalizeCardProvider(action.provider);
1787
+ this.emit("awaiting_authorization", {
1788
+ display_text: "Complete payment in the card authorization popup.",
1789
+ order_id: checkoutResult.order_id,
1790
+ order_number: checkoutResult.order_number
1791
+ });
1792
+ if (!this.allowPopups) {
1793
+ return this.fail(
1794
+ "PROVIDER_UNAVAILABLE",
1795
+ "Card payment popup is unavailable in this environment.",
1796
+ false
1797
+ );
1798
+ }
1799
+ const popupResult = await openCardPopup(
1800
+ provider,
1801
+ checkoutResult,
1802
+ this.checkoutData.customer.email || "customer@cimplify.io",
1803
+ this.getOrderCurrency(checkoutResult),
1804
+ this.signal
1805
+ );
1806
+ if (!popupResult.success) {
1807
+ const popupError = normalizeCardPopupError(popupResult.error);
1808
+ if (popupError === "POPUP_BLOCKED") {
1809
+ return this.fail(
1810
+ "POPUP_BLOCKED",
1811
+ "Unable to open card payment popup. Please allow popups and try again.",
1812
+ true
1813
+ );
1814
+ }
1815
+ if (popupError === "PROVIDER_UNAVAILABLE") {
1816
+ return this.fail("PROVIDER_UNAVAILABLE", "Card payment provider is unavailable.", false);
1817
+ }
1818
+ return this.fail("PAYMENT_CANCELLED", "Card payment was cancelled before completion.", true);
1819
+ }
1820
+ paymentReference = popupResult.reference || paymentReference;
1821
+ break;
1822
+ }
1823
+ case NEXT_ACTION_REDIRECT: {
1824
+ if (typeof window !== "undefined" && this.returnUrl) {
1825
+ window.location.assign(action.authorization_url);
1826
+ return this.fail("REDIRECT_REQUIRED", "Redirecting to complete payment authorization.", true);
1827
+ }
1828
+ if (typeof window !== "undefined") {
1829
+ const popup = window.open(
1830
+ action.authorization_url,
1831
+ "cimplify-auth",
1832
+ "width=520,height=760,noopener,noreferrer"
1833
+ );
1834
+ if (!popup) {
1835
+ return this.fail(
1836
+ "POPUP_BLOCKED",
1837
+ "Authorization popup was blocked. Please allow popups and retry.",
1838
+ true
1839
+ );
1840
+ }
1841
+ }
1842
+ break;
1843
+ }
1844
+ case NEXT_ACTION_AUTHORIZATION: {
1845
+ const authType = normalizeAuthorizationType(action.authorization_type);
1846
+ const authorization = await this.handleAuthorization({
1847
+ authorizationType: authType,
1848
+ paymentReference,
1849
+ displayText: action.display_text,
1850
+ provider: checkoutResult.provider
1851
+ });
1852
+ if (!authorization.ok) {
1853
+ return authorization.result;
1854
+ }
1855
+ if (authorization.value) {
1856
+ latestCheckoutResult = authorization.value;
1857
+ paymentReference = authorization.value.payment_reference || paymentReference;
1858
+ if (this.isSuccessfulStatus(authorization.value.payment_status)) {
1859
+ return this.finalizeSuccess(authorization.value);
1860
+ }
1861
+ if (this.isFailureStatus(authorization.value.payment_status)) {
1862
+ return this.fail(
1863
+ "AUTHORIZATION_FAILED",
1864
+ authorization.value.display_text || "Payment authorization failed.",
1865
+ false
1866
+ );
1867
+ }
1868
+ }
1869
+ break;
1870
+ }
1871
+ }
1872
+ return this.pollUntilTerminal({
1873
+ orderId: checkoutResult.order_id,
1874
+ latestCheckoutResult,
1875
+ paymentReference,
1876
+ authorizationType: normalizeAuthorizationType(checkoutResult.authorization_type)
1877
+ });
1878
+ }
1767
1879
  async pollUntilTerminal(input) {
1768
1880
  let consecutiveErrors = 0;
1769
1881
  let latestCheckoutResult = input.latestCheckoutResult;
package/dist/react.mjs CHANGED
@@ -1557,6 +1557,10 @@ var DEFAULT_POLL_INTERVAL_MS = 3e3;
1557
1557
  var DEFAULT_MAX_POLL_ATTEMPTS = 60;
1558
1558
  var MAX_CONSECUTIVE_NETWORK_ERRORS = 5;
1559
1559
  var CARD_PROVIDER_PAYSTACK = "paystack";
1560
+ var NEXT_ACTION_NONE = "none";
1561
+ var NEXT_ACTION_CARD_POPUP = "card_popup";
1562
+ var NEXT_ACTION_REDIRECT = "redirect";
1563
+ var NEXT_ACTION_AUTHORIZATION = "authorization";
1560
1564
  function normalizeCardPopupError(error) {
1561
1565
  if (!error || error === "PAYMENT_CANCELLED" || error === "CANCELLED") {
1562
1566
  return "PAYMENT_CANCELLED";
@@ -1596,7 +1600,8 @@ function isValidMobileMoneyProvider(value) {
1596
1600
  return VALID_MOBILE_MONEY_PROVIDERS.has(value);
1597
1601
  }
1598
1602
  function normalizeAuthorizationType(value) {
1599
- return value === "otp" || value === "pin" ? value : void 0;
1603
+ const lower = value?.toLowerCase();
1604
+ return lower === "otp" || lower === "pin" ? lower : void 0;
1600
1605
  }
1601
1606
  function formatMoney2(value) {
1602
1607
  if (typeof value === "number" && Number.isFinite(value)) {
@@ -1643,6 +1648,9 @@ var CheckoutResolver = class {
1643
1648
  if (!checkoutResult.order_id) {
1644
1649
  return this.fail("CHECKOUT_FAILED", "Checkout did not return an order ID.", false);
1645
1650
  }
1651
+ if (checkoutResult.next_action) {
1652
+ return this.resolveNextAction(checkoutResult);
1653
+ }
1646
1654
  let latestCheckoutResult = checkoutResult;
1647
1655
  let authorizationType = normalizeAuthorizationType(checkoutResult.authorization_type);
1648
1656
  let paymentReference = checkoutResult.payment_reference;
@@ -1758,6 +1766,110 @@ var CheckoutResolver = class {
1758
1766
  return this.fail("CHECKOUT_FAILED", message, true);
1759
1767
  }
1760
1768
  }
1769
+ async resolveNextAction(checkoutResult) {
1770
+ const action = checkoutResult.next_action;
1771
+ if (this.isSuccessfulStatus(checkoutResult.payment_status)) {
1772
+ return this.finalizeSuccess(checkoutResult);
1773
+ }
1774
+ let latestCheckoutResult = checkoutResult;
1775
+ let paymentReference = checkoutResult.payment_reference;
1776
+ switch (action.type) {
1777
+ case NEXT_ACTION_NONE:
1778
+ return this.finalizeSuccess(checkoutResult);
1779
+ case NEXT_ACTION_CARD_POPUP: {
1780
+ const provider = normalizeCardProvider(action.provider);
1781
+ this.emit("awaiting_authorization", {
1782
+ display_text: "Complete payment in the card authorization popup.",
1783
+ order_id: checkoutResult.order_id,
1784
+ order_number: checkoutResult.order_number
1785
+ });
1786
+ if (!this.allowPopups) {
1787
+ return this.fail(
1788
+ "PROVIDER_UNAVAILABLE",
1789
+ "Card payment popup is unavailable in this environment.",
1790
+ false
1791
+ );
1792
+ }
1793
+ const popupResult = await openCardPopup(
1794
+ provider,
1795
+ checkoutResult,
1796
+ this.checkoutData.customer.email || "customer@cimplify.io",
1797
+ this.getOrderCurrency(checkoutResult),
1798
+ this.signal
1799
+ );
1800
+ if (!popupResult.success) {
1801
+ const popupError = normalizeCardPopupError(popupResult.error);
1802
+ if (popupError === "POPUP_BLOCKED") {
1803
+ return this.fail(
1804
+ "POPUP_BLOCKED",
1805
+ "Unable to open card payment popup. Please allow popups and try again.",
1806
+ true
1807
+ );
1808
+ }
1809
+ if (popupError === "PROVIDER_UNAVAILABLE") {
1810
+ return this.fail("PROVIDER_UNAVAILABLE", "Card payment provider is unavailable.", false);
1811
+ }
1812
+ return this.fail("PAYMENT_CANCELLED", "Card payment was cancelled before completion.", true);
1813
+ }
1814
+ paymentReference = popupResult.reference || paymentReference;
1815
+ break;
1816
+ }
1817
+ case NEXT_ACTION_REDIRECT: {
1818
+ if (typeof window !== "undefined" && this.returnUrl) {
1819
+ window.location.assign(action.authorization_url);
1820
+ return this.fail("REDIRECT_REQUIRED", "Redirecting to complete payment authorization.", true);
1821
+ }
1822
+ if (typeof window !== "undefined") {
1823
+ const popup = window.open(
1824
+ action.authorization_url,
1825
+ "cimplify-auth",
1826
+ "width=520,height=760,noopener,noreferrer"
1827
+ );
1828
+ if (!popup) {
1829
+ return this.fail(
1830
+ "POPUP_BLOCKED",
1831
+ "Authorization popup was blocked. Please allow popups and retry.",
1832
+ true
1833
+ );
1834
+ }
1835
+ }
1836
+ break;
1837
+ }
1838
+ case NEXT_ACTION_AUTHORIZATION: {
1839
+ const authType = normalizeAuthorizationType(action.authorization_type);
1840
+ const authorization = await this.handleAuthorization({
1841
+ authorizationType: authType,
1842
+ paymentReference,
1843
+ displayText: action.display_text,
1844
+ provider: checkoutResult.provider
1845
+ });
1846
+ if (!authorization.ok) {
1847
+ return authorization.result;
1848
+ }
1849
+ if (authorization.value) {
1850
+ latestCheckoutResult = authorization.value;
1851
+ paymentReference = authorization.value.payment_reference || paymentReference;
1852
+ if (this.isSuccessfulStatus(authorization.value.payment_status)) {
1853
+ return this.finalizeSuccess(authorization.value);
1854
+ }
1855
+ if (this.isFailureStatus(authorization.value.payment_status)) {
1856
+ return this.fail(
1857
+ "AUTHORIZATION_FAILED",
1858
+ authorization.value.display_text || "Payment authorization failed.",
1859
+ false
1860
+ );
1861
+ }
1862
+ }
1863
+ break;
1864
+ }
1865
+ }
1866
+ return this.pollUntilTerminal({
1867
+ orderId: checkoutResult.order_id,
1868
+ latestCheckoutResult,
1869
+ paymentReference,
1870
+ authorizationType: normalizeAuthorizationType(checkoutResult.authorization_type)
1871
+ });
1872
+ }
1761
1873
  async pollUntilTerminal(input) {
1762
1874
  let consecutiveErrors = 0;
1763
1875
  let latestCheckoutResult = input.latestCheckoutResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/sdk",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "description": "Cimplify Commerce SDK for storefronts",
5
5
  "keywords": [
6
6
  "cimplify",