@cimplify/sdk 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ads-DRfobDQ9.d.mts → ads-CXOn6J7P.d.mts} +2 -2
- package/dist/{ads-DRfobDQ9.d.ts → ads-CXOn6J7P.d.ts} +2 -2
- package/dist/index.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +182 -20
- package/dist/index.mjs +180 -21
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1775,7 +1775,7 @@ interface LocationAppointment {
|
|
|
1775
1775
|
service_status: ServiceStatus;
|
|
1776
1776
|
}
|
|
1777
1777
|
|
|
1778
|
-
type PaymentStatus = "pending" | "processing" | "success" | "failed" | "refunded" | "captured" | "cancelled";
|
|
1778
|
+
type PaymentStatus = "pending" | "processing" | "created" | "pending_confirmation" | "success" | "succeeded" | "failed" | "declined" | "authorized" | "refunded" | "partially_refunded" | "partially_paid" | "paid" | "unpaid" | "requires_action" | "requires_payment_method" | "requires_capture" | "captured" | "cancelled" | "completed" | "voided" | "error" | "unknown";
|
|
1779
1779
|
type PaymentProvider = "stripe" | "paystack" | "mtn" | "vodafone" | "airtel" | "cellulant" | "offline" | "cash" | "manual";
|
|
1780
1780
|
type PaymentMethodType = "card" | "mobile_money" | "bank_transfer" | "cash" | "custom";
|
|
1781
1781
|
/** Authorization types for payment verification (OTP, PIN, etc.) */
|
|
@@ -1832,7 +1832,7 @@ interface PaymentResponse {
|
|
|
1832
1832
|
}
|
|
1833
1833
|
/** Payment status polling response */
|
|
1834
1834
|
interface PaymentStatusResponse {
|
|
1835
|
-
status:
|
|
1835
|
+
status: PaymentStatus;
|
|
1836
1836
|
paid: boolean;
|
|
1837
1837
|
amount?: Money;
|
|
1838
1838
|
currency?: string;
|
|
@@ -1775,7 +1775,7 @@ interface LocationAppointment {
|
|
|
1775
1775
|
service_status: ServiceStatus;
|
|
1776
1776
|
}
|
|
1777
1777
|
|
|
1778
|
-
type PaymentStatus = "pending" | "processing" | "success" | "failed" | "refunded" | "captured" | "cancelled";
|
|
1778
|
+
type PaymentStatus = "pending" | "processing" | "created" | "pending_confirmation" | "success" | "succeeded" | "failed" | "declined" | "authorized" | "refunded" | "partially_refunded" | "partially_paid" | "paid" | "unpaid" | "requires_action" | "requires_payment_method" | "requires_capture" | "captured" | "cancelled" | "completed" | "voided" | "error" | "unknown";
|
|
1779
1779
|
type PaymentProvider = "stripe" | "paystack" | "mtn" | "vodafone" | "airtel" | "cellulant" | "offline" | "cash" | "manual";
|
|
1780
1780
|
type PaymentMethodType = "card" | "mobile_money" | "bank_transfer" | "cash" | "custom";
|
|
1781
1781
|
/** Authorization types for payment verification (OTP, PIN, etc.) */
|
|
@@ -1832,7 +1832,7 @@ interface PaymentResponse {
|
|
|
1832
1832
|
}
|
|
1833
1833
|
/** Payment status polling response */
|
|
1834
1834
|
interface PaymentStatusResponse {
|
|
1835
|
-
status:
|
|
1835
|
+
status: PaymentStatus;
|
|
1836
1836
|
paid: boolean;
|
|
1837
1837
|
amount?: Money;
|
|
1838
1838
|
currency?: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-
|
|
2
|
-
export { ab as AUTHORIZATION_TYPE, ag as AUTH_MUTATION, eE as AdConfig, eG as AdContextValue, eF as AdCreative, eC as AdPosition, eB as AdSlot, eD as AdTheme, b0 as AddOn, bL as AddOnDetails, c5 as AddOnGroupDetails, b2 as AddOnOption, c4 as AddOnOptionDetails, b3 as AddOnOptionPrice, b1 as AddOnWithOptions, ca as AddToCartInput, e1 as AddressData, et as AddressInfo, bA as AdjustmentType, co as AmountToPay, bH as AppliedDiscount, ec as AuthResponse, p as AuthService, q as AuthStatus, ev as AuthenticatedData, cY as AuthorizationType, dR as AvailabilityCheck, dS as AvailabilityResult, dz as AvailableSlot, bG as BenefitType, dC as Booking, dt as BookingRequirementOverride, dB as BookingStatus, dD as BookingWithDetails, cI as BufferTimes, bb as Bundle, bf as BundleComponentData, bg as BundleComponentInfo, ba as BundlePriceType, bd as BundleProduct, bQ as BundleSelectionData, bO as BundleSelectionInput, bP as BundleStoredSelection, bc as BundleSummary, be as BundleWithDetails, d4 as Business, di as BusinessHours, d3 as BusinessPreferences, B as BusinessService, dh as BusinessSettings, d2 as BusinessType, df as BusinessWithLocations, a4 as CHECKOUT_MODE, ah as CHECKOUT_MUTATION, a7 as CHECKOUT_STEP, ad as CONTACT_TYPE, dH as CancelBookingInput, cC as CancelOrderInput, cK as CancellationPolicy, bV as Cart, bM as CartAddOn, by as CartChannel, bW as CartItem, c7 as CartItemDetails, l as CartOperations, bx as CartStatus, cc as CartSummary, bX as CartTotals, e as CatalogueQueries, b5 as Category, dj as CategoryInfo, b6 as CategorySummary, s as ChangePasswordInput, dF as CheckSlotAvailabilityInput, ef as CheckoutAddressInfo, eh as CheckoutCustomerInfo, $ as CheckoutFormData, cA as CheckoutInput, X as CheckoutMode, m as CheckoutOperations, Y as CheckoutOrderType, Z as CheckoutPaymentMethod, a0 as CheckoutResult, m as CheckoutService, _ as CheckoutStep, bF as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, z as CimplifyElement, y as CimplifyElements, as as CimplifyError, b7 as Collection, b9 as CollectionProduct, b8 as CollectionSummary, bm as ComponentGroup, bn as ComponentGroupWithComponents, br as ComponentPriceBreakdown, bp as ComponentSelectionInput, bj as ComponentSourceType, bk as Composite, bo as CompositeComponent, bS as CompositePriceBreakdown, bq as CompositePriceResult, bh as CompositePricingMode, bT as CompositeSelectionData, bp as CompositeSelectionInput, bR as CompositeStoredSelection, bl as CompositeWithDetails, a3 as ContactType, dZ as CreateAddressInput, d$ as CreateMobileMoneyInput, an as Currency, dU as Customer, dV as CustomerAddress, dX as CustomerLinkPreferences, dW as CustomerMobileMoney, cH as CustomerServicePreferences, al as DEFAULT_COUNTRY, ak as DEFAULT_CURRENCY, ac as DEVICE_TYPE, dA as DayAvailability, cR as DepositResult, aQ as DepositType, a2 as DeviceType, aP as DigitalProductType, bI as DiscountBreakdown, bJ as DiscountDetails, b_ as DisplayAddOn, b$ as DisplayAddOnOption, bY as DisplayCart, bZ as DisplayCartItem, H as ELEMENT_TYPES, E as EVENT_TYPES, es as ElementAppearance, eA as ElementEventHandler, W as ElementEventType, N as ElementOptions, V as ElementType, ew as ElementsCheckoutData, ex as ElementsCheckoutResult, J as ElementsOptions, e3 as EnrollAndLinkOrderInput, e6 as EnrollAndLinkOrderResult, e0 as EnrollmentData, ax as Err, aq as ErrorCode, ar as ErrorCodeType, cn as FeeBearerType, F as FetchQuoteInput, cl as FulfillmentLink, ck as FulfillmentStatus, cj as FulfillmentType, ej as FxQuote, ei as FxQuoteRequest, ek as FxRateResponse, v as FxService, dE as GetAvailableSlotsInput, o as GetOrdersOptions, G as GetProductsOptions, bi as GroupPricingBehavior, ez as IframeToParentMessage, d0 as InitializePaymentResult, I as InventoryService, dT as InventorySummary, aN as InventoryType, K as KitchenOrderItem, x as KitchenOrderResult, af as LINK_MUTATION, ae as LINK_QUERY, bU as LineConfiguration, cp as LineItem, cg as LineType, dY as LinkData, e5 as LinkEnrollResult, L as LinkService, e7 as LinkSession, e4 as LinkStatusResult, w as LiteBootstrap, u as LiteService, d7 as Location, cU as LocationAppointment, bu as LocationProductPrice, dQ as LocationStock, d5 as LocationTaxBehavior, d6 as LocationTaxOverrides, da as LocationTimeProfile, dg as LocationWithDetails, M as MESSAGE_TYPES, aa as MOBILE_MONEY_PROVIDER, e2 as MobileMoneyData, eg as MobileMoneyDetails, a1 as MobileMoneyProvider, am as Money, aj as ORDER_MUTATION, a5 as ORDER_TYPE, er as ObservabilityHooks, aw as Ok, cq as Order, cf as OrderChannel, cz as OrderFilter, cm as OrderFulfillmentSummary, ct as OrderGroup, cx as OrderGroupDetails, cu as OrderGroupPayment, cs as OrderGroupPaymentState, cw as OrderGroupPaymentSummary, cr as OrderHistory, ch as OrderLineState, ci as OrderLineStatus, cy as OrderPaymentEvent, O as OrderQueries, cv as OrderSplitDetail, cd as OrderStatus, r as OtpResult, a6 as PAYMENT_METHOD, ai as PAYMENT_MUTATION, a8 as PAYMENT_STATE, a9 as PICKUP_TIME_TYPE, ap as Pagination, ao as PaginationParams, ey as ParentToIframeMessage, c$ as Payment, c_ as PaymentMethod, eu as PaymentMethodInfo, cX as PaymentMethodType, cZ as PaymentProcessingState, cW as PaymentProvider, ce as PaymentState, cV as PaymentStatus, ee as PickupTime, ed as PickupTimeType, bt as Price, bB as PriceAdjustment, bE as PriceDecisionPath, bs as PriceEntryType, bD as PricePathTaxInfo, j as PriceQuote, bz as PriceSource, cM as PricingOverrides, aS as Product, b4 as ProductAddOn, bv as ProductAvailability, dO as ProductStock, bw as ProductTimeProfile, aM as ProductType, aU as ProductVariant, aZ as ProductVariantValue, aT as ProductWithDetails, f as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, h as QuoteDynamicBuckets, g as QuoteStatus, i as QuoteUiMessage, R as RefreshQuoteInput, k as RefreshQuoteResult, cD as RefundOrderInput, cG as ReminderMethod, cJ as ReminderSettings, el as RequestContext, eo as RequestErrorEvent, ea as RequestOtpInput, em as RequestStartEvent, en as RequestSuccessEvent, dG as RescheduleBookingInput, cP as ResourceAssignment, dq as ResourceAvailabilityException, dp as ResourceAvailabilityRule, du as ResourceType, av as Result, ep as RetryEvent, e9 as RevokeAllSessionsResult, e8 as RevokeSessionResult, dc as Room, aR as SalesChannel, cN as SchedulingMetadata, cQ as SchedulingResult, t as SchedulingService, S as SearchOptions, bK as SelectedAddOnOption, dv as Service, dl as ServiceAvailabilityException, dI as ServiceAvailabilityParams, dJ as ServiceAvailabilityResult, dk as ServiceAvailabilityRule, dd as ServiceCharge, cL as ServiceNotes, cS as ServiceScheduleRequest, ds as ServiceStaffRequirement, cE as ServiceStatus, dw as ServiceWithStaff, eq as SessionChangeEvent, dx as Staff, cO as StaffAssignment, dn as StaffAvailabilityException, dm as StaffAvailabilityRule, dr as StaffBookingProfile, cF as StaffRole, cT as StaffScheduleItem, dM as Stock, dN as StockLevel, dK as StockOwnershipType, dL as StockStatus, de as StorefrontBootstrap, d1 as SubmitAuthorizationInput, db as Table, T as TableInfo, bC as TaxPathComponent, d8 as TimeRange, d9 as TimeRanges, dy as TimeSlot, c8 as UICart, c0 as UICartBusiness, c2 as UICartCustomer, c1 as UICartLocation, c3 as UICartPricing, c9 as UICartResponse, d_ as UpdateAddressInput, cb as UpdateCartItemInput, cB as UpdateOrderStatusInput, U as UpdateProfileInput, aW as VariantAxis, a$ as VariantAxisSelection, aY as VariantAxisValue, aX as VariantAxisWithValues, bN as VariantDetails, c6 as VariantDetailsDTO, aV as VariantDisplayAttribute, a_ as VariantLocationAvailability, dP as VariantStock, aO as VariantStrategy, eb as VerifyOtpInput, aK as combine, aL as combineObject, c as createCimplifyClient, D as createElements, az as err, aE as flatMap, aI as fromPromise, n as generateIdempotencyKey, aF as getOrElse, at as isCimplifyError, aB as isErr, aA as isOk, au as isRetryableError, aD as mapError, aC as mapResult, ay as ok, aH as toNullable, aJ as tryCatch, aG as unwrap } from './ads-
|
|
1
|
+
import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-CXOn6J7P.mjs';
|
|
2
|
+
export { ab as AUTHORIZATION_TYPE, ag as AUTH_MUTATION, eE as AdConfig, eG as AdContextValue, eF as AdCreative, eC as AdPosition, eB as AdSlot, eD as AdTheme, b0 as AddOn, bL as AddOnDetails, c5 as AddOnGroupDetails, b2 as AddOnOption, c4 as AddOnOptionDetails, b3 as AddOnOptionPrice, b1 as AddOnWithOptions, ca as AddToCartInput, e1 as AddressData, et as AddressInfo, bA as AdjustmentType, co as AmountToPay, bH as AppliedDiscount, ec as AuthResponse, p as AuthService, q as AuthStatus, ev as AuthenticatedData, cY as AuthorizationType, dR as AvailabilityCheck, dS as AvailabilityResult, dz as AvailableSlot, bG as BenefitType, dC as Booking, dt as BookingRequirementOverride, dB as BookingStatus, dD as BookingWithDetails, cI as BufferTimes, bb as Bundle, bf as BundleComponentData, bg as BundleComponentInfo, ba as BundlePriceType, bd as BundleProduct, bQ as BundleSelectionData, bO as BundleSelectionInput, bP as BundleStoredSelection, bc as BundleSummary, be as BundleWithDetails, d4 as Business, di as BusinessHours, d3 as BusinessPreferences, B as BusinessService, dh as BusinessSettings, d2 as BusinessType, df as BusinessWithLocations, a4 as CHECKOUT_MODE, ah as CHECKOUT_MUTATION, a7 as CHECKOUT_STEP, ad as CONTACT_TYPE, dH as CancelBookingInput, cC as CancelOrderInput, cK as CancellationPolicy, bV as Cart, bM as CartAddOn, by as CartChannel, bW as CartItem, c7 as CartItemDetails, l as CartOperations, bx as CartStatus, cc as CartSummary, bX as CartTotals, e as CatalogueQueries, b5 as Category, dj as CategoryInfo, b6 as CategorySummary, s as ChangePasswordInput, dF as CheckSlotAvailabilityInput, ef as CheckoutAddressInfo, eh as CheckoutCustomerInfo, $ as CheckoutFormData, cA as CheckoutInput, X as CheckoutMode, m as CheckoutOperations, Y as CheckoutOrderType, Z as CheckoutPaymentMethod, a0 as CheckoutResult, m as CheckoutService, _ as CheckoutStep, bF as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, z as CimplifyElement, y as CimplifyElements, as as CimplifyError, b7 as Collection, b9 as CollectionProduct, b8 as CollectionSummary, bm as ComponentGroup, bn as ComponentGroupWithComponents, br as ComponentPriceBreakdown, bp as ComponentSelectionInput, bj as ComponentSourceType, bk as Composite, bo as CompositeComponent, bS as CompositePriceBreakdown, bq as CompositePriceResult, bh as CompositePricingMode, bT as CompositeSelectionData, bp as CompositeSelectionInput, bR as CompositeStoredSelection, bl as CompositeWithDetails, a3 as ContactType, dZ as CreateAddressInput, d$ as CreateMobileMoneyInput, an as Currency, dU as Customer, dV as CustomerAddress, dX as CustomerLinkPreferences, dW as CustomerMobileMoney, cH as CustomerServicePreferences, al as DEFAULT_COUNTRY, ak as DEFAULT_CURRENCY, ac as DEVICE_TYPE, dA as DayAvailability, cR as DepositResult, aQ as DepositType, a2 as DeviceType, aP as DigitalProductType, bI as DiscountBreakdown, bJ as DiscountDetails, b_ as DisplayAddOn, b$ as DisplayAddOnOption, bY as DisplayCart, bZ as DisplayCartItem, H as ELEMENT_TYPES, E as EVENT_TYPES, es as ElementAppearance, eA as ElementEventHandler, W as ElementEventType, N as ElementOptions, V as ElementType, ew as ElementsCheckoutData, ex as ElementsCheckoutResult, J as ElementsOptions, e3 as EnrollAndLinkOrderInput, e6 as EnrollAndLinkOrderResult, e0 as EnrollmentData, ax as Err, aq as ErrorCode, ar as ErrorCodeType, cn as FeeBearerType, F as FetchQuoteInput, cl as FulfillmentLink, ck as FulfillmentStatus, cj as FulfillmentType, ej as FxQuote, ei as FxQuoteRequest, ek as FxRateResponse, v as FxService, dE as GetAvailableSlotsInput, o as GetOrdersOptions, G as GetProductsOptions, bi as GroupPricingBehavior, ez as IframeToParentMessage, d0 as InitializePaymentResult, I as InventoryService, dT as InventorySummary, aN as InventoryType, K as KitchenOrderItem, x as KitchenOrderResult, af as LINK_MUTATION, ae as LINK_QUERY, bU as LineConfiguration, cp as LineItem, cg as LineType, dY as LinkData, e5 as LinkEnrollResult, L as LinkService, e7 as LinkSession, e4 as LinkStatusResult, w as LiteBootstrap, u as LiteService, d7 as Location, cU as LocationAppointment, bu as LocationProductPrice, dQ as LocationStock, d5 as LocationTaxBehavior, d6 as LocationTaxOverrides, da as LocationTimeProfile, dg as LocationWithDetails, M as MESSAGE_TYPES, aa as MOBILE_MONEY_PROVIDER, e2 as MobileMoneyData, eg as MobileMoneyDetails, a1 as MobileMoneyProvider, am as Money, aj as ORDER_MUTATION, a5 as ORDER_TYPE, er as ObservabilityHooks, aw as Ok, cq as Order, cf as OrderChannel, cz as OrderFilter, cm as OrderFulfillmentSummary, ct as OrderGroup, cx as OrderGroupDetails, cu as OrderGroupPayment, cs as OrderGroupPaymentState, cw as OrderGroupPaymentSummary, cr as OrderHistory, ch as OrderLineState, ci as OrderLineStatus, cy as OrderPaymentEvent, O as OrderQueries, cv as OrderSplitDetail, cd as OrderStatus, r as OtpResult, a6 as PAYMENT_METHOD, ai as PAYMENT_MUTATION, a8 as PAYMENT_STATE, a9 as PICKUP_TIME_TYPE, ap as Pagination, ao as PaginationParams, ey as ParentToIframeMessage, c$ as Payment, c_ as PaymentMethod, eu as PaymentMethodInfo, cX as PaymentMethodType, cZ as PaymentProcessingState, cW as PaymentProvider, ce as PaymentState, cV as PaymentStatus, ee as PickupTime, ed as PickupTimeType, bt as Price, bB as PriceAdjustment, bE as PriceDecisionPath, bs as PriceEntryType, bD as PricePathTaxInfo, j as PriceQuote, bz as PriceSource, cM as PricingOverrides, aS as Product, b4 as ProductAddOn, bv as ProductAvailability, dO as ProductStock, bw as ProductTimeProfile, aM as ProductType, aU as ProductVariant, aZ as ProductVariantValue, aT as ProductWithDetails, f as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, h as QuoteDynamicBuckets, g as QuoteStatus, i as QuoteUiMessage, R as RefreshQuoteInput, k as RefreshQuoteResult, cD as RefundOrderInput, cG as ReminderMethod, cJ as ReminderSettings, el as RequestContext, eo as RequestErrorEvent, ea as RequestOtpInput, em as RequestStartEvent, en as RequestSuccessEvent, dG as RescheduleBookingInput, cP as ResourceAssignment, dq as ResourceAvailabilityException, dp as ResourceAvailabilityRule, du as ResourceType, av as Result, ep as RetryEvent, e9 as RevokeAllSessionsResult, e8 as RevokeSessionResult, dc as Room, aR as SalesChannel, cN as SchedulingMetadata, cQ as SchedulingResult, t as SchedulingService, S as SearchOptions, bK as SelectedAddOnOption, dv as Service, dl as ServiceAvailabilityException, dI as ServiceAvailabilityParams, dJ as ServiceAvailabilityResult, dk as ServiceAvailabilityRule, dd as ServiceCharge, cL as ServiceNotes, cS as ServiceScheduleRequest, ds as ServiceStaffRequirement, cE as ServiceStatus, dw as ServiceWithStaff, eq as SessionChangeEvent, dx as Staff, cO as StaffAssignment, dn as StaffAvailabilityException, dm as StaffAvailabilityRule, dr as StaffBookingProfile, cF as StaffRole, cT as StaffScheduleItem, dM as Stock, dN as StockLevel, dK as StockOwnershipType, dL as StockStatus, de as StorefrontBootstrap, d1 as SubmitAuthorizationInput, db as Table, T as TableInfo, bC as TaxPathComponent, d8 as TimeRange, d9 as TimeRanges, dy as TimeSlot, c8 as UICart, c0 as UICartBusiness, c2 as UICartCustomer, c1 as UICartLocation, c3 as UICartPricing, c9 as UICartResponse, d_ as UpdateAddressInput, cb as UpdateCartItemInput, cB as UpdateOrderStatusInput, U as UpdateProfileInput, aW as VariantAxis, a$ as VariantAxisSelection, aY as VariantAxisValue, aX as VariantAxisWithValues, bN as VariantDetails, c6 as VariantDetailsDTO, aV as VariantDisplayAttribute, a_ as VariantLocationAvailability, dP as VariantStock, aO as VariantStrategy, eb as VerifyOtpInput, aK as combine, aL as combineObject, c as createCimplifyClient, D as createElements, az as err, aE as flatMap, aI as fromPromise, n as generateIdempotencyKey, aF as getOrElse, at as isCimplifyError, aB as isErr, aA as isOk, au as isRetryableError, aD as mapError, aC as mapResult, ay as ok, aH as toNullable, aJ as tryCatch, aG as unwrap } from './ads-CXOn6J7P.mjs';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
|
5
5
|
type SortOrder = "asc" | "desc";
|
|
@@ -317,6 +317,9 @@ declare function categorizePaymentError(error: Error, errorCode?: string): Payme
|
|
|
317
317
|
* Normalize payment response from different formats into a standard PaymentResponse
|
|
318
318
|
*/
|
|
319
319
|
declare function normalizePaymentResponse(response: unknown): PaymentResponse;
|
|
320
|
+
declare function isPaymentStatusSuccess(status: string | undefined): boolean;
|
|
321
|
+
declare function isPaymentStatusFailure(status: string | undefined): boolean;
|
|
322
|
+
declare function isPaymentStatusRequiresAction(status: string | undefined): boolean;
|
|
320
323
|
/**
|
|
321
324
|
* Normalize payment status response into a standard format
|
|
322
325
|
*/
|
|
@@ -371,4 +374,4 @@ interface ApiResponse<T> {
|
|
|
371
374
|
metadata?: ResponseMetadata;
|
|
372
375
|
}
|
|
373
376
|
|
|
374
|
-
export { ApiError, type ApiResponse, CURRENCY_SYMBOLS, type FormatCompactOptions, type FormatPriceOptions, type FrontendContext, MOBILE_MONEY_PROVIDERS, type MutationRequest, PaymentErrorDetails, PaymentResponse, PaymentStatusResponse, type PriceInfo, type ProductWithPrice, QueryBuilder, type QueryRequest, type ResponseMetadata, type TaxComponent, type TaxInfo, categorizePaymentError, detectMobileMoneyProvider, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, isOnSale, normalizePaymentResponse, normalizeStatusResponse, parsePrice, query };
|
|
377
|
+
export { ApiError, type ApiResponse, CURRENCY_SYMBOLS, type FormatCompactOptions, type FormatPriceOptions, type FrontendContext, MOBILE_MONEY_PROVIDERS, type MutationRequest, PaymentErrorDetails, PaymentResponse, PaymentStatusResponse, type PriceInfo, type ProductWithPrice, QueryBuilder, type QueryRequest, type ResponseMetadata, type TaxComponent, type TaxInfo, categorizePaymentError, detectMobileMoneyProvider, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, isOnSale, isPaymentStatusFailure, isPaymentStatusRequiresAction, isPaymentStatusSuccess, normalizePaymentResponse, normalizeStatusResponse, parsePrice, query };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-
|
|
2
|
-
export { ab as AUTHORIZATION_TYPE, ag as AUTH_MUTATION, eE as AdConfig, eG as AdContextValue, eF as AdCreative, eC as AdPosition, eB as AdSlot, eD as AdTheme, b0 as AddOn, bL as AddOnDetails, c5 as AddOnGroupDetails, b2 as AddOnOption, c4 as AddOnOptionDetails, b3 as AddOnOptionPrice, b1 as AddOnWithOptions, ca as AddToCartInput, e1 as AddressData, et as AddressInfo, bA as AdjustmentType, co as AmountToPay, bH as AppliedDiscount, ec as AuthResponse, p as AuthService, q as AuthStatus, ev as AuthenticatedData, cY as AuthorizationType, dR as AvailabilityCheck, dS as AvailabilityResult, dz as AvailableSlot, bG as BenefitType, dC as Booking, dt as BookingRequirementOverride, dB as BookingStatus, dD as BookingWithDetails, cI as BufferTimes, bb as Bundle, bf as BundleComponentData, bg as BundleComponentInfo, ba as BundlePriceType, bd as BundleProduct, bQ as BundleSelectionData, bO as BundleSelectionInput, bP as BundleStoredSelection, bc as BundleSummary, be as BundleWithDetails, d4 as Business, di as BusinessHours, d3 as BusinessPreferences, B as BusinessService, dh as BusinessSettings, d2 as BusinessType, df as BusinessWithLocations, a4 as CHECKOUT_MODE, ah as CHECKOUT_MUTATION, a7 as CHECKOUT_STEP, ad as CONTACT_TYPE, dH as CancelBookingInput, cC as CancelOrderInput, cK as CancellationPolicy, bV as Cart, bM as CartAddOn, by as CartChannel, bW as CartItem, c7 as CartItemDetails, l as CartOperations, bx as CartStatus, cc as CartSummary, bX as CartTotals, e as CatalogueQueries, b5 as Category, dj as CategoryInfo, b6 as CategorySummary, s as ChangePasswordInput, dF as CheckSlotAvailabilityInput, ef as CheckoutAddressInfo, eh as CheckoutCustomerInfo, $ as CheckoutFormData, cA as CheckoutInput, X as CheckoutMode, m as CheckoutOperations, Y as CheckoutOrderType, Z as CheckoutPaymentMethod, a0 as CheckoutResult, m as CheckoutService, _ as CheckoutStep, bF as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, z as CimplifyElement, y as CimplifyElements, as as CimplifyError, b7 as Collection, b9 as CollectionProduct, b8 as CollectionSummary, bm as ComponentGroup, bn as ComponentGroupWithComponents, br as ComponentPriceBreakdown, bp as ComponentSelectionInput, bj as ComponentSourceType, bk as Composite, bo as CompositeComponent, bS as CompositePriceBreakdown, bq as CompositePriceResult, bh as CompositePricingMode, bT as CompositeSelectionData, bp as CompositeSelectionInput, bR as CompositeStoredSelection, bl as CompositeWithDetails, a3 as ContactType, dZ as CreateAddressInput, d$ as CreateMobileMoneyInput, an as Currency, dU as Customer, dV as CustomerAddress, dX as CustomerLinkPreferences, dW as CustomerMobileMoney, cH as CustomerServicePreferences, al as DEFAULT_COUNTRY, ak as DEFAULT_CURRENCY, ac as DEVICE_TYPE, dA as DayAvailability, cR as DepositResult, aQ as DepositType, a2 as DeviceType, aP as DigitalProductType, bI as DiscountBreakdown, bJ as DiscountDetails, b_ as DisplayAddOn, b$ as DisplayAddOnOption, bY as DisplayCart, bZ as DisplayCartItem, H as ELEMENT_TYPES, E as EVENT_TYPES, es as ElementAppearance, eA as ElementEventHandler, W as ElementEventType, N as ElementOptions, V as ElementType, ew as ElementsCheckoutData, ex as ElementsCheckoutResult, J as ElementsOptions, e3 as EnrollAndLinkOrderInput, e6 as EnrollAndLinkOrderResult, e0 as EnrollmentData, ax as Err, aq as ErrorCode, ar as ErrorCodeType, cn as FeeBearerType, F as FetchQuoteInput, cl as FulfillmentLink, ck as FulfillmentStatus, cj as FulfillmentType, ej as FxQuote, ei as FxQuoteRequest, ek as FxRateResponse, v as FxService, dE as GetAvailableSlotsInput, o as GetOrdersOptions, G as GetProductsOptions, bi as GroupPricingBehavior, ez as IframeToParentMessage, d0 as InitializePaymentResult, I as InventoryService, dT as InventorySummary, aN as InventoryType, K as KitchenOrderItem, x as KitchenOrderResult, af as LINK_MUTATION, ae as LINK_QUERY, bU as LineConfiguration, cp as LineItem, cg as LineType, dY as LinkData, e5 as LinkEnrollResult, L as LinkService, e7 as LinkSession, e4 as LinkStatusResult, w as LiteBootstrap, u as LiteService, d7 as Location, cU as LocationAppointment, bu as LocationProductPrice, dQ as LocationStock, d5 as LocationTaxBehavior, d6 as LocationTaxOverrides, da as LocationTimeProfile, dg as LocationWithDetails, M as MESSAGE_TYPES, aa as MOBILE_MONEY_PROVIDER, e2 as MobileMoneyData, eg as MobileMoneyDetails, a1 as MobileMoneyProvider, am as Money, aj as ORDER_MUTATION, a5 as ORDER_TYPE, er as ObservabilityHooks, aw as Ok, cq as Order, cf as OrderChannel, cz as OrderFilter, cm as OrderFulfillmentSummary, ct as OrderGroup, cx as OrderGroupDetails, cu as OrderGroupPayment, cs as OrderGroupPaymentState, cw as OrderGroupPaymentSummary, cr as OrderHistory, ch as OrderLineState, ci as OrderLineStatus, cy as OrderPaymentEvent, O as OrderQueries, cv as OrderSplitDetail, cd as OrderStatus, r as OtpResult, a6 as PAYMENT_METHOD, ai as PAYMENT_MUTATION, a8 as PAYMENT_STATE, a9 as PICKUP_TIME_TYPE, ap as Pagination, ao as PaginationParams, ey as ParentToIframeMessage, c$ as Payment, c_ as PaymentMethod, eu as PaymentMethodInfo, cX as PaymentMethodType, cZ as PaymentProcessingState, cW as PaymentProvider, ce as PaymentState, cV as PaymentStatus, ee as PickupTime, ed as PickupTimeType, bt as Price, bB as PriceAdjustment, bE as PriceDecisionPath, bs as PriceEntryType, bD as PricePathTaxInfo, j as PriceQuote, bz as PriceSource, cM as PricingOverrides, aS as Product, b4 as ProductAddOn, bv as ProductAvailability, dO as ProductStock, bw as ProductTimeProfile, aM as ProductType, aU as ProductVariant, aZ as ProductVariantValue, aT as ProductWithDetails, f as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, h as QuoteDynamicBuckets, g as QuoteStatus, i as QuoteUiMessage, R as RefreshQuoteInput, k as RefreshQuoteResult, cD as RefundOrderInput, cG as ReminderMethod, cJ as ReminderSettings, el as RequestContext, eo as RequestErrorEvent, ea as RequestOtpInput, em as RequestStartEvent, en as RequestSuccessEvent, dG as RescheduleBookingInput, cP as ResourceAssignment, dq as ResourceAvailabilityException, dp as ResourceAvailabilityRule, du as ResourceType, av as Result, ep as RetryEvent, e9 as RevokeAllSessionsResult, e8 as RevokeSessionResult, dc as Room, aR as SalesChannel, cN as SchedulingMetadata, cQ as SchedulingResult, t as SchedulingService, S as SearchOptions, bK as SelectedAddOnOption, dv as Service, dl as ServiceAvailabilityException, dI as ServiceAvailabilityParams, dJ as ServiceAvailabilityResult, dk as ServiceAvailabilityRule, dd as ServiceCharge, cL as ServiceNotes, cS as ServiceScheduleRequest, ds as ServiceStaffRequirement, cE as ServiceStatus, dw as ServiceWithStaff, eq as SessionChangeEvent, dx as Staff, cO as StaffAssignment, dn as StaffAvailabilityException, dm as StaffAvailabilityRule, dr as StaffBookingProfile, cF as StaffRole, cT as StaffScheduleItem, dM as Stock, dN as StockLevel, dK as StockOwnershipType, dL as StockStatus, de as StorefrontBootstrap, d1 as SubmitAuthorizationInput, db as Table, T as TableInfo, bC as TaxPathComponent, d8 as TimeRange, d9 as TimeRanges, dy as TimeSlot, c8 as UICart, c0 as UICartBusiness, c2 as UICartCustomer, c1 as UICartLocation, c3 as UICartPricing, c9 as UICartResponse, d_ as UpdateAddressInput, cb as UpdateCartItemInput, cB as UpdateOrderStatusInput, U as UpdateProfileInput, aW as VariantAxis, a$ as VariantAxisSelection, aY as VariantAxisValue, aX as VariantAxisWithValues, bN as VariantDetails, c6 as VariantDetailsDTO, aV as VariantDisplayAttribute, a_ as VariantLocationAvailability, dP as VariantStock, aO as VariantStrategy, eb as VerifyOtpInput, aK as combine, aL as combineObject, c as createCimplifyClient, D as createElements, az as err, aE as flatMap, aI as fromPromise, n as generateIdempotencyKey, aF as getOrElse, at as isCimplifyError, aB as isErr, aA as isOk, au as isRetryableError, aD as mapError, aC as mapResult, ay as ok, aH as toNullable, aJ as tryCatch, aG as unwrap } from './ads-
|
|
1
|
+
import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-CXOn6J7P.js';
|
|
2
|
+
export { ab as AUTHORIZATION_TYPE, ag as AUTH_MUTATION, eE as AdConfig, eG as AdContextValue, eF as AdCreative, eC as AdPosition, eB as AdSlot, eD as AdTheme, b0 as AddOn, bL as AddOnDetails, c5 as AddOnGroupDetails, b2 as AddOnOption, c4 as AddOnOptionDetails, b3 as AddOnOptionPrice, b1 as AddOnWithOptions, ca as AddToCartInput, e1 as AddressData, et as AddressInfo, bA as AdjustmentType, co as AmountToPay, bH as AppliedDiscount, ec as AuthResponse, p as AuthService, q as AuthStatus, ev as AuthenticatedData, cY as AuthorizationType, dR as AvailabilityCheck, dS as AvailabilityResult, dz as AvailableSlot, bG as BenefitType, dC as Booking, dt as BookingRequirementOverride, dB as BookingStatus, dD as BookingWithDetails, cI as BufferTimes, bb as Bundle, bf as BundleComponentData, bg as BundleComponentInfo, ba as BundlePriceType, bd as BundleProduct, bQ as BundleSelectionData, bO as BundleSelectionInput, bP as BundleStoredSelection, bc as BundleSummary, be as BundleWithDetails, d4 as Business, di as BusinessHours, d3 as BusinessPreferences, B as BusinessService, dh as BusinessSettings, d2 as BusinessType, df as BusinessWithLocations, a4 as CHECKOUT_MODE, ah as CHECKOUT_MUTATION, a7 as CHECKOUT_STEP, ad as CONTACT_TYPE, dH as CancelBookingInput, cC as CancelOrderInput, cK as CancellationPolicy, bV as Cart, bM as CartAddOn, by as CartChannel, bW as CartItem, c7 as CartItemDetails, l as CartOperations, bx as CartStatus, cc as CartSummary, bX as CartTotals, e as CatalogueQueries, b5 as Category, dj as CategoryInfo, b6 as CategorySummary, s as ChangePasswordInput, dF as CheckSlotAvailabilityInput, ef as CheckoutAddressInfo, eh as CheckoutCustomerInfo, $ as CheckoutFormData, cA as CheckoutInput, X as CheckoutMode, m as CheckoutOperations, Y as CheckoutOrderType, Z as CheckoutPaymentMethod, a0 as CheckoutResult, m as CheckoutService, _ as CheckoutStep, bF as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, z as CimplifyElement, y as CimplifyElements, as as CimplifyError, b7 as Collection, b9 as CollectionProduct, b8 as CollectionSummary, bm as ComponentGroup, bn as ComponentGroupWithComponents, br as ComponentPriceBreakdown, bp as ComponentSelectionInput, bj as ComponentSourceType, bk as Composite, bo as CompositeComponent, bS as CompositePriceBreakdown, bq as CompositePriceResult, bh as CompositePricingMode, bT as CompositeSelectionData, bp as CompositeSelectionInput, bR as CompositeStoredSelection, bl as CompositeWithDetails, a3 as ContactType, dZ as CreateAddressInput, d$ as CreateMobileMoneyInput, an as Currency, dU as Customer, dV as CustomerAddress, dX as CustomerLinkPreferences, dW as CustomerMobileMoney, cH as CustomerServicePreferences, al as DEFAULT_COUNTRY, ak as DEFAULT_CURRENCY, ac as DEVICE_TYPE, dA as DayAvailability, cR as DepositResult, aQ as DepositType, a2 as DeviceType, aP as DigitalProductType, bI as DiscountBreakdown, bJ as DiscountDetails, b_ as DisplayAddOn, b$ as DisplayAddOnOption, bY as DisplayCart, bZ as DisplayCartItem, H as ELEMENT_TYPES, E as EVENT_TYPES, es as ElementAppearance, eA as ElementEventHandler, W as ElementEventType, N as ElementOptions, V as ElementType, ew as ElementsCheckoutData, ex as ElementsCheckoutResult, J as ElementsOptions, e3 as EnrollAndLinkOrderInput, e6 as EnrollAndLinkOrderResult, e0 as EnrollmentData, ax as Err, aq as ErrorCode, ar as ErrorCodeType, cn as FeeBearerType, F as FetchQuoteInput, cl as FulfillmentLink, ck as FulfillmentStatus, cj as FulfillmentType, ej as FxQuote, ei as FxQuoteRequest, ek as FxRateResponse, v as FxService, dE as GetAvailableSlotsInput, o as GetOrdersOptions, G as GetProductsOptions, bi as GroupPricingBehavior, ez as IframeToParentMessage, d0 as InitializePaymentResult, I as InventoryService, dT as InventorySummary, aN as InventoryType, K as KitchenOrderItem, x as KitchenOrderResult, af as LINK_MUTATION, ae as LINK_QUERY, bU as LineConfiguration, cp as LineItem, cg as LineType, dY as LinkData, e5 as LinkEnrollResult, L as LinkService, e7 as LinkSession, e4 as LinkStatusResult, w as LiteBootstrap, u as LiteService, d7 as Location, cU as LocationAppointment, bu as LocationProductPrice, dQ as LocationStock, d5 as LocationTaxBehavior, d6 as LocationTaxOverrides, da as LocationTimeProfile, dg as LocationWithDetails, M as MESSAGE_TYPES, aa as MOBILE_MONEY_PROVIDER, e2 as MobileMoneyData, eg as MobileMoneyDetails, a1 as MobileMoneyProvider, am as Money, aj as ORDER_MUTATION, a5 as ORDER_TYPE, er as ObservabilityHooks, aw as Ok, cq as Order, cf as OrderChannel, cz as OrderFilter, cm as OrderFulfillmentSummary, ct as OrderGroup, cx as OrderGroupDetails, cu as OrderGroupPayment, cs as OrderGroupPaymentState, cw as OrderGroupPaymentSummary, cr as OrderHistory, ch as OrderLineState, ci as OrderLineStatus, cy as OrderPaymentEvent, O as OrderQueries, cv as OrderSplitDetail, cd as OrderStatus, r as OtpResult, a6 as PAYMENT_METHOD, ai as PAYMENT_MUTATION, a8 as PAYMENT_STATE, a9 as PICKUP_TIME_TYPE, ap as Pagination, ao as PaginationParams, ey as ParentToIframeMessage, c$ as Payment, c_ as PaymentMethod, eu as PaymentMethodInfo, cX as PaymentMethodType, cZ as PaymentProcessingState, cW as PaymentProvider, ce as PaymentState, cV as PaymentStatus, ee as PickupTime, ed as PickupTimeType, bt as Price, bB as PriceAdjustment, bE as PriceDecisionPath, bs as PriceEntryType, bD as PricePathTaxInfo, j as PriceQuote, bz as PriceSource, cM as PricingOverrides, aS as Product, b4 as ProductAddOn, bv as ProductAvailability, dO as ProductStock, bw as ProductTimeProfile, aM as ProductType, aU as ProductVariant, aZ as ProductVariantValue, aT as ProductWithDetails, f as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, h as QuoteDynamicBuckets, g as QuoteStatus, i as QuoteUiMessage, R as RefreshQuoteInput, k as RefreshQuoteResult, cD as RefundOrderInput, cG as ReminderMethod, cJ as ReminderSettings, el as RequestContext, eo as RequestErrorEvent, ea as RequestOtpInput, em as RequestStartEvent, en as RequestSuccessEvent, dG as RescheduleBookingInput, cP as ResourceAssignment, dq as ResourceAvailabilityException, dp as ResourceAvailabilityRule, du as ResourceType, av as Result, ep as RetryEvent, e9 as RevokeAllSessionsResult, e8 as RevokeSessionResult, dc as Room, aR as SalesChannel, cN as SchedulingMetadata, cQ as SchedulingResult, t as SchedulingService, S as SearchOptions, bK as SelectedAddOnOption, dv as Service, dl as ServiceAvailabilityException, dI as ServiceAvailabilityParams, dJ as ServiceAvailabilityResult, dk as ServiceAvailabilityRule, dd as ServiceCharge, cL as ServiceNotes, cS as ServiceScheduleRequest, ds as ServiceStaffRequirement, cE as ServiceStatus, dw as ServiceWithStaff, eq as SessionChangeEvent, dx as Staff, cO as StaffAssignment, dn as StaffAvailabilityException, dm as StaffAvailabilityRule, dr as StaffBookingProfile, cF as StaffRole, cT as StaffScheduleItem, dM as Stock, dN as StockLevel, dK as StockOwnershipType, dL as StockStatus, de as StorefrontBootstrap, d1 as SubmitAuthorizationInput, db as Table, T as TableInfo, bC as TaxPathComponent, d8 as TimeRange, d9 as TimeRanges, dy as TimeSlot, c8 as UICart, c0 as UICartBusiness, c2 as UICartCustomer, c1 as UICartLocation, c3 as UICartPricing, c9 as UICartResponse, d_ as UpdateAddressInput, cb as UpdateCartItemInput, cB as UpdateOrderStatusInput, U as UpdateProfileInput, aW as VariantAxis, a$ as VariantAxisSelection, aY as VariantAxisValue, aX as VariantAxisWithValues, bN as VariantDetails, c6 as VariantDetailsDTO, aV as VariantDisplayAttribute, a_ as VariantLocationAvailability, dP as VariantStock, aO as VariantStrategy, eb as VerifyOtpInput, aK as combine, aL as combineObject, c as createCimplifyClient, D as createElements, az as err, aE as flatMap, aI as fromPromise, n as generateIdempotencyKey, aF as getOrElse, at as isCimplifyError, aB as isErr, aA as isOk, au as isRetryableError, aD as mapError, aC as mapResult, ay as ok, aH as toNullable, aJ as tryCatch, aG as unwrap } from './ads-CXOn6J7P.js';
|
|
3
3
|
|
|
4
4
|
type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
|
|
5
5
|
type SortOrder = "asc" | "desc";
|
|
@@ -317,6 +317,9 @@ declare function categorizePaymentError(error: Error, errorCode?: string): Payme
|
|
|
317
317
|
* Normalize payment response from different formats into a standard PaymentResponse
|
|
318
318
|
*/
|
|
319
319
|
declare function normalizePaymentResponse(response: unknown): PaymentResponse;
|
|
320
|
+
declare function isPaymentStatusSuccess(status: string | undefined): boolean;
|
|
321
|
+
declare function isPaymentStatusFailure(status: string | undefined): boolean;
|
|
322
|
+
declare function isPaymentStatusRequiresAction(status: string | undefined): boolean;
|
|
320
323
|
/**
|
|
321
324
|
* Normalize payment status response into a standard format
|
|
322
325
|
*/
|
|
@@ -371,4 +374,4 @@ interface ApiResponse<T> {
|
|
|
371
374
|
metadata?: ResponseMetadata;
|
|
372
375
|
}
|
|
373
376
|
|
|
374
|
-
export { ApiError, type ApiResponse, CURRENCY_SYMBOLS, type FormatCompactOptions, type FormatPriceOptions, type FrontendContext, MOBILE_MONEY_PROVIDERS, type MutationRequest, PaymentErrorDetails, PaymentResponse, PaymentStatusResponse, type PriceInfo, type ProductWithPrice, QueryBuilder, type QueryRequest, type ResponseMetadata, type TaxComponent, type TaxInfo, categorizePaymentError, detectMobileMoneyProvider, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, isOnSale, normalizePaymentResponse, normalizeStatusResponse, parsePrice, query };
|
|
377
|
+
export { ApiError, type ApiResponse, CURRENCY_SYMBOLS, type FormatCompactOptions, type FormatPriceOptions, type FrontendContext, MOBILE_MONEY_PROVIDERS, type MutationRequest, PaymentErrorDetails, PaymentResponse, PaymentStatusResponse, type PriceInfo, type ProductWithPrice, QueryBuilder, type QueryRequest, type ResponseMetadata, type TaxComponent, type TaxInfo, categorizePaymentError, detectMobileMoneyProvider, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, isOnSale, isPaymentStatusFailure, isPaymentStatusRequiresAction, isPaymentStatusSuccess, normalizePaymentResponse, normalizeStatusResponse, parsePrice, query };
|
package/dist/index.js
CHANGED
|
@@ -151,6 +151,63 @@ async function safe(promise) {
|
|
|
151
151
|
return err(toCimplifyError(error));
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
+
function isRecord(value) {
|
|
155
|
+
return typeof value === "object" && value !== null;
|
|
156
|
+
}
|
|
157
|
+
function readFinalPrice(value) {
|
|
158
|
+
if (!isRecord(value)) return void 0;
|
|
159
|
+
const finalPrice = value.final_price;
|
|
160
|
+
if (typeof finalPrice === "string" || typeof finalPrice === "number") {
|
|
161
|
+
return finalPrice;
|
|
162
|
+
}
|
|
163
|
+
return void 0;
|
|
164
|
+
}
|
|
165
|
+
function normalizeCatalogueProductPayload(product) {
|
|
166
|
+
const normalized = { ...product };
|
|
167
|
+
const defaultPrice = normalized["default_price"];
|
|
168
|
+
if (defaultPrice === void 0 || defaultPrice === null || defaultPrice === "") {
|
|
169
|
+
const derivedDefaultPrice = readFinalPrice(normalized["default_price_info"]) || readFinalPrice(normalized["price_info"]) || (typeof normalized["final_price"] === "string" || typeof normalized["final_price"] === "number" ? normalized["final_price"] : void 0);
|
|
170
|
+
normalized["default_price"] = derivedDefaultPrice ?? "0";
|
|
171
|
+
}
|
|
172
|
+
const variants = normalized["variants"];
|
|
173
|
+
if (Array.isArray(variants)) {
|
|
174
|
+
normalized["variants"] = variants.map((variant) => {
|
|
175
|
+
if (!isRecord(variant)) return variant;
|
|
176
|
+
const normalizedVariant = { ...variant };
|
|
177
|
+
const variantAdjustment = normalizedVariant["price_adjustment"];
|
|
178
|
+
if (variantAdjustment === void 0 || variantAdjustment === null || variantAdjustment === "") {
|
|
179
|
+
normalizedVariant["price_adjustment"] = readFinalPrice(normalizedVariant["price_info"]) ?? "0";
|
|
180
|
+
}
|
|
181
|
+
return normalizedVariant;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
const addOns = normalized["add_ons"];
|
|
185
|
+
if (Array.isArray(addOns)) {
|
|
186
|
+
normalized["add_ons"] = addOns.map((addOn) => {
|
|
187
|
+
if (!isRecord(addOn)) return addOn;
|
|
188
|
+
const normalizedAddOn = { ...addOn };
|
|
189
|
+
const options = normalizedAddOn["options"];
|
|
190
|
+
if (!Array.isArray(options)) return normalizedAddOn;
|
|
191
|
+
normalizedAddOn["options"] = options.map((option) => {
|
|
192
|
+
if (!isRecord(option)) return option;
|
|
193
|
+
const normalizedOption = { ...option };
|
|
194
|
+
const optionPrice = normalizedOption["default_price"];
|
|
195
|
+
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
196
|
+
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
197
|
+
}
|
|
198
|
+
return normalizedOption;
|
|
199
|
+
});
|
|
200
|
+
return normalizedAddOn;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
return normalized;
|
|
204
|
+
}
|
|
205
|
+
function findProductBySlug(products, slug) {
|
|
206
|
+
return products.find((product) => {
|
|
207
|
+
const value = product["slug"];
|
|
208
|
+
return typeof value === "string" && value === slug;
|
|
209
|
+
});
|
|
210
|
+
}
|
|
154
211
|
var CatalogueQueries = class {
|
|
155
212
|
constructor(client) {
|
|
156
213
|
this.client = client;
|
|
@@ -188,20 +245,34 @@ var CatalogueQueries = class {
|
|
|
188
245
|
if (options?.offset) {
|
|
189
246
|
query2 += `#offset(${options.offset})`;
|
|
190
247
|
}
|
|
191
|
-
|
|
248
|
+
const result = await safe(this.client.query(query2));
|
|
249
|
+
if (!result.ok) return result;
|
|
250
|
+
return ok(result.value.map((product) => normalizeCatalogueProductPayload(product)));
|
|
192
251
|
}
|
|
193
252
|
async getProduct(id) {
|
|
194
|
-
|
|
253
|
+
const result = await safe(this.client.query(`products.${id}`));
|
|
254
|
+
if (!result.ok) return result;
|
|
255
|
+
return ok(normalizeCatalogueProductPayload(result.value));
|
|
195
256
|
}
|
|
196
257
|
async getProductBySlug(slug) {
|
|
197
|
-
const
|
|
258
|
+
const filteredResult = await safe(
|
|
198
259
|
this.client.query(`products[?(@.slug=='${slug}')]`)
|
|
199
260
|
);
|
|
200
|
-
if (!
|
|
201
|
-
|
|
261
|
+
if (!filteredResult.ok) return filteredResult;
|
|
262
|
+
const exactMatch = findProductBySlug(filteredResult.value, slug);
|
|
263
|
+
if (exactMatch) {
|
|
264
|
+
return ok(normalizeCatalogueProductPayload(exactMatch));
|
|
265
|
+
}
|
|
266
|
+
if (filteredResult.value.length === 1) {
|
|
267
|
+
return ok(normalizeCatalogueProductPayload(filteredResult.value[0]));
|
|
268
|
+
}
|
|
269
|
+
const unfilteredResult = await safe(this.client.query("products"));
|
|
270
|
+
if (!unfilteredResult.ok) return unfilteredResult;
|
|
271
|
+
const fallbackMatch = findProductBySlug(unfilteredResult.value, slug);
|
|
272
|
+
if (!fallbackMatch) {
|
|
202
273
|
return err(new CimplifyError("NOT_FOUND", `Product not found: ${slug}`, false));
|
|
203
274
|
}
|
|
204
|
-
return ok(
|
|
275
|
+
return ok(normalizeCatalogueProductPayload(fallbackMatch));
|
|
205
276
|
}
|
|
206
277
|
async getVariants(productId) {
|
|
207
278
|
return safe(this.client.query(`products.${productId}.variants`));
|
|
@@ -1345,7 +1416,7 @@ function toCheckoutFormData(data) {
|
|
|
1345
1416
|
} : void 0,
|
|
1346
1417
|
special_instructions: data.notes,
|
|
1347
1418
|
link_address_id: data.address?.id,
|
|
1348
|
-
link_payment_method_id: data.payment_method?.id
|
|
1419
|
+
link_payment_method_id: data.payment_method?.type === "card" && data.payment_method?.id ? data.payment_method.id : void 0
|
|
1349
1420
|
};
|
|
1350
1421
|
}
|
|
1351
1422
|
var DEFAULT_LINK_URL = "https://link.cimplify.io";
|
|
@@ -2450,6 +2521,95 @@ function normalizePaymentResponse(response) {
|
|
|
2450
2521
|
metadata: {}
|
|
2451
2522
|
};
|
|
2452
2523
|
}
|
|
2524
|
+
var PAYMENT_SUCCESS_STATUSES = /* @__PURE__ */ new Set([
|
|
2525
|
+
"success",
|
|
2526
|
+
"succeeded",
|
|
2527
|
+
"paid",
|
|
2528
|
+
"captured",
|
|
2529
|
+
"completed",
|
|
2530
|
+
"authorized"
|
|
2531
|
+
]);
|
|
2532
|
+
var PAYMENT_FAILURE_STATUSES = /* @__PURE__ */ new Set([
|
|
2533
|
+
"failed",
|
|
2534
|
+
"declined",
|
|
2535
|
+
"cancelled",
|
|
2536
|
+
"voided",
|
|
2537
|
+
"error"
|
|
2538
|
+
]);
|
|
2539
|
+
var PAYMENT_REQUIRES_ACTION_STATUSES = /* @__PURE__ */ new Set([
|
|
2540
|
+
"requires_action",
|
|
2541
|
+
"requires_payment_method",
|
|
2542
|
+
"requires_capture"
|
|
2543
|
+
]);
|
|
2544
|
+
var PAYMENT_STATUS_ALIAS_MAP = {
|
|
2545
|
+
ok: "success",
|
|
2546
|
+
done: "success",
|
|
2547
|
+
paid: "paid",
|
|
2548
|
+
paid_in_full: "paid",
|
|
2549
|
+
paid_successfully: "paid",
|
|
2550
|
+
succeeded: "success",
|
|
2551
|
+
captured: "captured",
|
|
2552
|
+
completed: "completed",
|
|
2553
|
+
pending_confirmation: "pending_confirmation",
|
|
2554
|
+
requires_authorization: "requires_action",
|
|
2555
|
+
requires_action: "requires_action",
|
|
2556
|
+
requires_payment_method: "requires_payment_method",
|
|
2557
|
+
requires_capture: "requires_capture",
|
|
2558
|
+
partially_paid: "partially_paid",
|
|
2559
|
+
partially_refunded: "partially_refunded",
|
|
2560
|
+
card_declined: "declined",
|
|
2561
|
+
canceled: "cancelled",
|
|
2562
|
+
authorized: "authorized",
|
|
2563
|
+
cancelled: "cancelled",
|
|
2564
|
+
unresolved: "pending"
|
|
2565
|
+
};
|
|
2566
|
+
var KNOWN_PAYMENT_STATUSES = /* @__PURE__ */ new Set([
|
|
2567
|
+
"pending",
|
|
2568
|
+
"processing",
|
|
2569
|
+
"created",
|
|
2570
|
+
"pending_confirmation",
|
|
2571
|
+
"success",
|
|
2572
|
+
"succeeded",
|
|
2573
|
+
"failed",
|
|
2574
|
+
"declined",
|
|
2575
|
+
"authorized",
|
|
2576
|
+
"refunded",
|
|
2577
|
+
"partially_refunded",
|
|
2578
|
+
"partially_paid",
|
|
2579
|
+
"paid",
|
|
2580
|
+
"unpaid",
|
|
2581
|
+
"requires_action",
|
|
2582
|
+
"requires_payment_method",
|
|
2583
|
+
"requires_capture",
|
|
2584
|
+
"captured",
|
|
2585
|
+
"cancelled",
|
|
2586
|
+
"completed",
|
|
2587
|
+
"voided",
|
|
2588
|
+
"error",
|
|
2589
|
+
"unknown"
|
|
2590
|
+
]);
|
|
2591
|
+
function normalizeStatusToken(status) {
|
|
2592
|
+
return status?.trim().toLowerCase().replace(/[\s-]+/g, "_") ?? "";
|
|
2593
|
+
}
|
|
2594
|
+
function normalizePaymentStatusValue(status) {
|
|
2595
|
+
const normalized = normalizeStatusToken(status);
|
|
2596
|
+
if (Object.prototype.hasOwnProperty.call(PAYMENT_STATUS_ALIAS_MAP, normalized)) {
|
|
2597
|
+
return PAYMENT_STATUS_ALIAS_MAP[normalized];
|
|
2598
|
+
}
|
|
2599
|
+
return KNOWN_PAYMENT_STATUSES.has(normalized) ? normalized : "unknown";
|
|
2600
|
+
}
|
|
2601
|
+
function isPaymentStatusSuccess(status) {
|
|
2602
|
+
const normalizedStatus = normalizePaymentStatusValue(status);
|
|
2603
|
+
return PAYMENT_SUCCESS_STATUSES.has(normalizedStatus);
|
|
2604
|
+
}
|
|
2605
|
+
function isPaymentStatusFailure(status) {
|
|
2606
|
+
const normalizedStatus = normalizePaymentStatusValue(status);
|
|
2607
|
+
return PAYMENT_FAILURE_STATUSES.has(normalizedStatus);
|
|
2608
|
+
}
|
|
2609
|
+
function isPaymentStatusRequiresAction(status) {
|
|
2610
|
+
const normalizedStatus = normalizePaymentStatusValue(status);
|
|
2611
|
+
return PAYMENT_REQUIRES_ACTION_STATUSES.has(normalizedStatus);
|
|
2612
|
+
}
|
|
2453
2613
|
function normalizeStatusResponse(response) {
|
|
2454
2614
|
if (!response || typeof response !== "object") {
|
|
2455
2615
|
return {
|
|
@@ -2459,20 +2619,19 @@ function normalizeStatusResponse(response) {
|
|
|
2459
2619
|
};
|
|
2460
2620
|
}
|
|
2461
2621
|
const res = response;
|
|
2462
|
-
const
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
}
|
|
2622
|
+
const normalizedStatus = normalizePaymentStatusValue(res.status ?? void 0);
|
|
2623
|
+
const paidValue = res.paid === true;
|
|
2624
|
+
const derivedPaid = paidValue || [
|
|
2625
|
+
"success",
|
|
2626
|
+
"succeeded",
|
|
2627
|
+
"paid",
|
|
2628
|
+
"captured",
|
|
2629
|
+
"authorized",
|
|
2630
|
+
"completed"
|
|
2631
|
+
].includes(normalizedStatus);
|
|
2473
2632
|
return {
|
|
2474
|
-
status:
|
|
2475
|
-
paid:
|
|
2633
|
+
status: normalizedStatus,
|
|
2634
|
+
paid: derivedPaid,
|
|
2476
2635
|
amount: res.amount,
|
|
2477
2636
|
currency: res.currency,
|
|
2478
2637
|
reference: res.reference,
|
|
@@ -2563,6 +2722,9 @@ exports.isCimplifyError = isCimplifyError;
|
|
|
2563
2722
|
exports.isErr = isErr;
|
|
2564
2723
|
exports.isOk = isOk;
|
|
2565
2724
|
exports.isOnSale = isOnSale;
|
|
2725
|
+
exports.isPaymentStatusFailure = isPaymentStatusFailure;
|
|
2726
|
+
exports.isPaymentStatusRequiresAction = isPaymentStatusRequiresAction;
|
|
2727
|
+
exports.isPaymentStatusSuccess = isPaymentStatusSuccess;
|
|
2566
2728
|
exports.isRetryableError = isRetryableError;
|
|
2567
2729
|
exports.mapError = mapError;
|
|
2568
2730
|
exports.mapResult = mapResult;
|
package/dist/index.mjs
CHANGED
|
@@ -149,6 +149,63 @@ async function safe(promise) {
|
|
|
149
149
|
return err(toCimplifyError(error));
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
+
function isRecord(value) {
|
|
153
|
+
return typeof value === "object" && value !== null;
|
|
154
|
+
}
|
|
155
|
+
function readFinalPrice(value) {
|
|
156
|
+
if (!isRecord(value)) return void 0;
|
|
157
|
+
const finalPrice = value.final_price;
|
|
158
|
+
if (typeof finalPrice === "string" || typeof finalPrice === "number") {
|
|
159
|
+
return finalPrice;
|
|
160
|
+
}
|
|
161
|
+
return void 0;
|
|
162
|
+
}
|
|
163
|
+
function normalizeCatalogueProductPayload(product) {
|
|
164
|
+
const normalized = { ...product };
|
|
165
|
+
const defaultPrice = normalized["default_price"];
|
|
166
|
+
if (defaultPrice === void 0 || defaultPrice === null || defaultPrice === "") {
|
|
167
|
+
const derivedDefaultPrice = readFinalPrice(normalized["default_price_info"]) || readFinalPrice(normalized["price_info"]) || (typeof normalized["final_price"] === "string" || typeof normalized["final_price"] === "number" ? normalized["final_price"] : void 0);
|
|
168
|
+
normalized["default_price"] = derivedDefaultPrice ?? "0";
|
|
169
|
+
}
|
|
170
|
+
const variants = normalized["variants"];
|
|
171
|
+
if (Array.isArray(variants)) {
|
|
172
|
+
normalized["variants"] = variants.map((variant) => {
|
|
173
|
+
if (!isRecord(variant)) return variant;
|
|
174
|
+
const normalizedVariant = { ...variant };
|
|
175
|
+
const variantAdjustment = normalizedVariant["price_adjustment"];
|
|
176
|
+
if (variantAdjustment === void 0 || variantAdjustment === null || variantAdjustment === "") {
|
|
177
|
+
normalizedVariant["price_adjustment"] = readFinalPrice(normalizedVariant["price_info"]) ?? "0";
|
|
178
|
+
}
|
|
179
|
+
return normalizedVariant;
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
const addOns = normalized["add_ons"];
|
|
183
|
+
if (Array.isArray(addOns)) {
|
|
184
|
+
normalized["add_ons"] = addOns.map((addOn) => {
|
|
185
|
+
if (!isRecord(addOn)) return addOn;
|
|
186
|
+
const normalizedAddOn = { ...addOn };
|
|
187
|
+
const options = normalizedAddOn["options"];
|
|
188
|
+
if (!Array.isArray(options)) return normalizedAddOn;
|
|
189
|
+
normalizedAddOn["options"] = options.map((option) => {
|
|
190
|
+
if (!isRecord(option)) return option;
|
|
191
|
+
const normalizedOption = { ...option };
|
|
192
|
+
const optionPrice = normalizedOption["default_price"];
|
|
193
|
+
if (optionPrice === void 0 || optionPrice === null || optionPrice === "") {
|
|
194
|
+
normalizedOption["default_price"] = readFinalPrice(normalizedOption["default_price_info"]) || readFinalPrice(normalizedOption["price_info"]) || "0";
|
|
195
|
+
}
|
|
196
|
+
return normalizedOption;
|
|
197
|
+
});
|
|
198
|
+
return normalizedAddOn;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return normalized;
|
|
202
|
+
}
|
|
203
|
+
function findProductBySlug(products, slug) {
|
|
204
|
+
return products.find((product) => {
|
|
205
|
+
const value = product["slug"];
|
|
206
|
+
return typeof value === "string" && value === slug;
|
|
207
|
+
});
|
|
208
|
+
}
|
|
152
209
|
var CatalogueQueries = class {
|
|
153
210
|
constructor(client) {
|
|
154
211
|
this.client = client;
|
|
@@ -186,20 +243,34 @@ var CatalogueQueries = class {
|
|
|
186
243
|
if (options?.offset) {
|
|
187
244
|
query2 += `#offset(${options.offset})`;
|
|
188
245
|
}
|
|
189
|
-
|
|
246
|
+
const result = await safe(this.client.query(query2));
|
|
247
|
+
if (!result.ok) return result;
|
|
248
|
+
return ok(result.value.map((product) => normalizeCatalogueProductPayload(product)));
|
|
190
249
|
}
|
|
191
250
|
async getProduct(id) {
|
|
192
|
-
|
|
251
|
+
const result = await safe(this.client.query(`products.${id}`));
|
|
252
|
+
if (!result.ok) return result;
|
|
253
|
+
return ok(normalizeCatalogueProductPayload(result.value));
|
|
193
254
|
}
|
|
194
255
|
async getProductBySlug(slug) {
|
|
195
|
-
const
|
|
256
|
+
const filteredResult = await safe(
|
|
196
257
|
this.client.query(`products[?(@.slug=='${slug}')]`)
|
|
197
258
|
);
|
|
198
|
-
if (!
|
|
199
|
-
|
|
259
|
+
if (!filteredResult.ok) return filteredResult;
|
|
260
|
+
const exactMatch = findProductBySlug(filteredResult.value, slug);
|
|
261
|
+
if (exactMatch) {
|
|
262
|
+
return ok(normalizeCatalogueProductPayload(exactMatch));
|
|
263
|
+
}
|
|
264
|
+
if (filteredResult.value.length === 1) {
|
|
265
|
+
return ok(normalizeCatalogueProductPayload(filteredResult.value[0]));
|
|
266
|
+
}
|
|
267
|
+
const unfilteredResult = await safe(this.client.query("products"));
|
|
268
|
+
if (!unfilteredResult.ok) return unfilteredResult;
|
|
269
|
+
const fallbackMatch = findProductBySlug(unfilteredResult.value, slug);
|
|
270
|
+
if (!fallbackMatch) {
|
|
200
271
|
return err(new CimplifyError("NOT_FOUND", `Product not found: ${slug}`, false));
|
|
201
272
|
}
|
|
202
|
-
return ok(
|
|
273
|
+
return ok(normalizeCatalogueProductPayload(fallbackMatch));
|
|
203
274
|
}
|
|
204
275
|
async getVariants(productId) {
|
|
205
276
|
return safe(this.client.query(`products.${productId}.variants`));
|
|
@@ -1343,7 +1414,7 @@ function toCheckoutFormData(data) {
|
|
|
1343
1414
|
} : void 0,
|
|
1344
1415
|
special_instructions: data.notes,
|
|
1345
1416
|
link_address_id: data.address?.id,
|
|
1346
|
-
link_payment_method_id: data.payment_method?.id
|
|
1417
|
+
link_payment_method_id: data.payment_method?.type === "card" && data.payment_method?.id ? data.payment_method.id : void 0
|
|
1347
1418
|
};
|
|
1348
1419
|
}
|
|
1349
1420
|
var DEFAULT_LINK_URL = "https://link.cimplify.io";
|
|
@@ -2448,6 +2519,95 @@ function normalizePaymentResponse(response) {
|
|
|
2448
2519
|
metadata: {}
|
|
2449
2520
|
};
|
|
2450
2521
|
}
|
|
2522
|
+
var PAYMENT_SUCCESS_STATUSES = /* @__PURE__ */ new Set([
|
|
2523
|
+
"success",
|
|
2524
|
+
"succeeded",
|
|
2525
|
+
"paid",
|
|
2526
|
+
"captured",
|
|
2527
|
+
"completed",
|
|
2528
|
+
"authorized"
|
|
2529
|
+
]);
|
|
2530
|
+
var PAYMENT_FAILURE_STATUSES = /* @__PURE__ */ new Set([
|
|
2531
|
+
"failed",
|
|
2532
|
+
"declined",
|
|
2533
|
+
"cancelled",
|
|
2534
|
+
"voided",
|
|
2535
|
+
"error"
|
|
2536
|
+
]);
|
|
2537
|
+
var PAYMENT_REQUIRES_ACTION_STATUSES = /* @__PURE__ */ new Set([
|
|
2538
|
+
"requires_action",
|
|
2539
|
+
"requires_payment_method",
|
|
2540
|
+
"requires_capture"
|
|
2541
|
+
]);
|
|
2542
|
+
var PAYMENT_STATUS_ALIAS_MAP = {
|
|
2543
|
+
ok: "success",
|
|
2544
|
+
done: "success",
|
|
2545
|
+
paid: "paid",
|
|
2546
|
+
paid_in_full: "paid",
|
|
2547
|
+
paid_successfully: "paid",
|
|
2548
|
+
succeeded: "success",
|
|
2549
|
+
captured: "captured",
|
|
2550
|
+
completed: "completed",
|
|
2551
|
+
pending_confirmation: "pending_confirmation",
|
|
2552
|
+
requires_authorization: "requires_action",
|
|
2553
|
+
requires_action: "requires_action",
|
|
2554
|
+
requires_payment_method: "requires_payment_method",
|
|
2555
|
+
requires_capture: "requires_capture",
|
|
2556
|
+
partially_paid: "partially_paid",
|
|
2557
|
+
partially_refunded: "partially_refunded",
|
|
2558
|
+
card_declined: "declined",
|
|
2559
|
+
canceled: "cancelled",
|
|
2560
|
+
authorized: "authorized",
|
|
2561
|
+
cancelled: "cancelled",
|
|
2562
|
+
unresolved: "pending"
|
|
2563
|
+
};
|
|
2564
|
+
var KNOWN_PAYMENT_STATUSES = /* @__PURE__ */ new Set([
|
|
2565
|
+
"pending",
|
|
2566
|
+
"processing",
|
|
2567
|
+
"created",
|
|
2568
|
+
"pending_confirmation",
|
|
2569
|
+
"success",
|
|
2570
|
+
"succeeded",
|
|
2571
|
+
"failed",
|
|
2572
|
+
"declined",
|
|
2573
|
+
"authorized",
|
|
2574
|
+
"refunded",
|
|
2575
|
+
"partially_refunded",
|
|
2576
|
+
"partially_paid",
|
|
2577
|
+
"paid",
|
|
2578
|
+
"unpaid",
|
|
2579
|
+
"requires_action",
|
|
2580
|
+
"requires_payment_method",
|
|
2581
|
+
"requires_capture",
|
|
2582
|
+
"captured",
|
|
2583
|
+
"cancelled",
|
|
2584
|
+
"completed",
|
|
2585
|
+
"voided",
|
|
2586
|
+
"error",
|
|
2587
|
+
"unknown"
|
|
2588
|
+
]);
|
|
2589
|
+
function normalizeStatusToken(status) {
|
|
2590
|
+
return status?.trim().toLowerCase().replace(/[\s-]+/g, "_") ?? "";
|
|
2591
|
+
}
|
|
2592
|
+
function normalizePaymentStatusValue(status) {
|
|
2593
|
+
const normalized = normalizeStatusToken(status);
|
|
2594
|
+
if (Object.prototype.hasOwnProperty.call(PAYMENT_STATUS_ALIAS_MAP, normalized)) {
|
|
2595
|
+
return PAYMENT_STATUS_ALIAS_MAP[normalized];
|
|
2596
|
+
}
|
|
2597
|
+
return KNOWN_PAYMENT_STATUSES.has(normalized) ? normalized : "unknown";
|
|
2598
|
+
}
|
|
2599
|
+
function isPaymentStatusSuccess(status) {
|
|
2600
|
+
const normalizedStatus = normalizePaymentStatusValue(status);
|
|
2601
|
+
return PAYMENT_SUCCESS_STATUSES.has(normalizedStatus);
|
|
2602
|
+
}
|
|
2603
|
+
function isPaymentStatusFailure(status) {
|
|
2604
|
+
const normalizedStatus = normalizePaymentStatusValue(status);
|
|
2605
|
+
return PAYMENT_FAILURE_STATUSES.has(normalizedStatus);
|
|
2606
|
+
}
|
|
2607
|
+
function isPaymentStatusRequiresAction(status) {
|
|
2608
|
+
const normalizedStatus = normalizePaymentStatusValue(status);
|
|
2609
|
+
return PAYMENT_REQUIRES_ACTION_STATUSES.has(normalizedStatus);
|
|
2610
|
+
}
|
|
2451
2611
|
function normalizeStatusResponse(response) {
|
|
2452
2612
|
if (!response || typeof response !== "object") {
|
|
2453
2613
|
return {
|
|
@@ -2457,20 +2617,19 @@ function normalizeStatusResponse(response) {
|
|
|
2457
2617
|
};
|
|
2458
2618
|
}
|
|
2459
2619
|
const res = response;
|
|
2460
|
-
const
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
}
|
|
2620
|
+
const normalizedStatus = normalizePaymentStatusValue(res.status ?? void 0);
|
|
2621
|
+
const paidValue = res.paid === true;
|
|
2622
|
+
const derivedPaid = paidValue || [
|
|
2623
|
+
"success",
|
|
2624
|
+
"succeeded",
|
|
2625
|
+
"paid",
|
|
2626
|
+
"captured",
|
|
2627
|
+
"authorized",
|
|
2628
|
+
"completed"
|
|
2629
|
+
].includes(normalizedStatus);
|
|
2471
2630
|
return {
|
|
2472
|
-
status:
|
|
2473
|
-
paid:
|
|
2631
|
+
status: normalizedStatus,
|
|
2632
|
+
paid: derivedPaid,
|
|
2474
2633
|
amount: res.amount,
|
|
2475
2634
|
currency: res.currency,
|
|
2476
2635
|
reference: res.reference,
|
|
@@ -2493,4 +2652,4 @@ function detectMobileMoneyProvider(phoneNumber) {
|
|
|
2493
2652
|
return null;
|
|
2494
2653
|
}
|
|
2495
2654
|
|
|
2496
|
-
export { AUTHORIZATION_TYPE, AUTH_MUTATION, AuthService, BusinessService, CHECKOUT_MODE, CHECKOUT_MUTATION, CHECKOUT_STEP, CONTACT_TYPE, CURRENCY_SYMBOLS, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyClient, CimplifyElement, CimplifyElements, CimplifyError, DEFAULT_COUNTRY, DEFAULT_CURRENCY, DEVICE_TYPE, ELEMENT_TYPES, EVENT_TYPES, ErrorCode, FxService, InventoryService, LINK_MUTATION, LINK_QUERY, LinkService, LiteService, MESSAGE_TYPES, MOBILE_MONEY_PROVIDER, MOBILE_MONEY_PROVIDERS, ORDER_MUTATION, ORDER_TYPE, OrderQueries, PAYMENT_METHOD, PAYMENT_MUTATION, PAYMENT_STATE, PICKUP_TIME_TYPE, QueryBuilder, SchedulingService, categorizePaymentError, combine, combineObject, createCimplifyClient, createElements, detectMobileMoneyProvider, err, flatMap, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, fromPromise, generateIdempotencyKey, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getOrElse, getProductCurrency, isCimplifyError, isErr, isOk, isOnSale, isRetryableError, mapError, mapResult, normalizePaymentResponse, normalizeStatusResponse, ok, parsePrice, query, toNullable, tryCatch, unwrap };
|
|
2655
|
+
export { AUTHORIZATION_TYPE, AUTH_MUTATION, AuthService, BusinessService, CHECKOUT_MODE, CHECKOUT_MUTATION, CHECKOUT_STEP, CONTACT_TYPE, CURRENCY_SYMBOLS, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyClient, CimplifyElement, CimplifyElements, CimplifyError, DEFAULT_COUNTRY, DEFAULT_CURRENCY, DEVICE_TYPE, ELEMENT_TYPES, EVENT_TYPES, ErrorCode, FxService, InventoryService, LINK_MUTATION, LINK_QUERY, LinkService, LiteService, MESSAGE_TYPES, MOBILE_MONEY_PROVIDER, MOBILE_MONEY_PROVIDERS, ORDER_MUTATION, ORDER_TYPE, OrderQueries, PAYMENT_METHOD, PAYMENT_MUTATION, PAYMENT_STATE, PICKUP_TIME_TYPE, QueryBuilder, SchedulingService, categorizePaymentError, combine, combineObject, createCimplifyClient, createElements, detectMobileMoneyProvider, err, flatMap, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, fromPromise, generateIdempotencyKey, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getOrElse, getProductCurrency, isCimplifyError, isErr, isOk, isOnSale, isPaymentStatusFailure, isPaymentStatusRequiresAction, isPaymentStatusSuccess, isRetryableError, mapError, mapResult, normalizePaymentResponse, normalizeStatusResponse, ok, parsePrice, query, toNullable, tryCatch, unwrap };
|
package/dist/react.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { eB as AdSlot, eC as AdPosition, eG as AdContextValue, y as CimplifyElements, C as CimplifyClient, J as ElementsOptions, ev as AuthenticatedData, et as AddressInfo, eu as PaymentMethodInfo, ex as ElementsCheckoutResult } from './ads-
|
|
2
|
-
export { eE as AdConfig } from './ads-
|
|
1
|
+
import { eB as AdSlot, eC as AdPosition, eG as AdContextValue, y as CimplifyElements, C as CimplifyClient, J as ElementsOptions, ev as AuthenticatedData, et as AddressInfo, eu as PaymentMethodInfo, ex as ElementsCheckoutResult } from './ads-CXOn6J7P.mjs';
|
|
2
|
+
export { eE as AdConfig } from './ads-CXOn6J7P.mjs';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
interface UserIdentity {
|
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { eB as AdSlot, eC as AdPosition, eG as AdContextValue, y as CimplifyElements, C as CimplifyClient, J as ElementsOptions, ev as AuthenticatedData, et as AddressInfo, eu as PaymentMethodInfo, ex as ElementsCheckoutResult } from './ads-
|
|
2
|
-
export { eE as AdConfig } from './ads-
|
|
1
|
+
import { eB as AdSlot, eC as AdPosition, eG as AdContextValue, y as CimplifyElements, C as CimplifyClient, J as ElementsOptions, ev as AuthenticatedData, et as AddressInfo, eu as PaymentMethodInfo, ex as ElementsCheckoutResult } from './ads-CXOn6J7P.js';
|
|
2
|
+
export { eE as AdConfig } from './ads-CXOn6J7P.js';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
interface UserIdentity {
|