@cimplify/sdk 0.6.0 → 0.6.1

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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-B5jcLFpD.mjs';
2
- export { a2 as AUTHORIZATION_TYPE, a7 as AUTH_MUTATION, eu as AdConfig, ew as AdContextValue, ev as AdCreative, es as AdPosition, er as AdSlot, et as AdTheme, aT as AddOn, bC as AddOnDetails, bY as AddOnGroupDetails, aV as AddOnOption, bX as AddOnOptionDetails, aW as AddOnOptionPrice, aU as AddOnWithOptions, c0 as AddToCartInput, dT as AddressData, ej as AddressInfo, br as AdjustmentType, ce as AmountToPay, by as AppliedDiscount, e2 as AuthResponse, j as AuthService, k as AuthStatus, el as AuthenticatedData, cO as AuthorizationType, dH as AvailabilityCheck, dI as AvailabilityResult, dp as AvailableSlot, bx as BenefitType, ds as Booking, di as BookingRequirementOverride, dr as BookingStatus, dt as BookingWithDetails, cy as BufferTimes, b2 as Bundle, b6 as BundleComponentData, b7 as BundleComponentInfo, b1 as BundlePriceType, b4 as BundleProduct, bH as BundleSelectionData, bF as BundleSelectionInput, bG as BundleStoredSelection, b3 as BundleSummary, b5 as BundleWithDetails, cW as Business, d8 as BusinessHours, cV as BusinessPreferences, B as BusinessService, d7 as BusinessSettings, cU as BusinessType, d5 as BusinessWithLocations, X as CHECKOUT_MODE, a8 as CHECKOUT_MUTATION, _ as CHECKOUT_STEP, a4 as CONTACT_TYPE, dx as CancelBookingInput, cs as CancelOrderInput, cA as CancellationPolicy, bM as Cart, bD as CartAddOn, bp as CartChannel, bN as CartItem, b_ as CartItemDetails, f as CartOperations, bo as CartStatus, c2 as CartSummary, bO as CartTotals, e as CatalogueQueries, aY as Category, d9 as CategoryInfo, aZ as CategorySummary, m as ChangePasswordInput, dv as CheckSlotAvailabilityInput, e5 as CheckoutAddressInfo, e7 as CheckoutCustomerInfo, N as CheckoutFormData, cq as CheckoutInput, z as CheckoutMode, g as CheckoutOperations, D as CheckoutOrderType, H as CheckoutPaymentMethod, Q as CheckoutResult, g as CheckoutService, J as CheckoutStep, bw as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, s as CimplifyElement, r as CimplifyElements, aj as CimplifyError, a_ as Collection, b0 as CollectionProduct, a$ as CollectionSummary, bd as ComponentGroup, be as ComponentGroupWithComponents, bi as ComponentPriceBreakdown, bg as ComponentSelectionInput, ba as ComponentSourceType, bb as Composite, bf as CompositeComponent, bJ as CompositePriceBreakdown, bh as CompositePriceResult, b8 as CompositePricingMode, bK as CompositeSelectionData, bg as CompositeSelectionInput, bI as CompositeStoredSelection, bc as CompositeWithDetails, W as ContactType, dP as CreateAddressInput, dR as CreateMobileMoneyInput, ae as Currency, dK as Customer, dL as CustomerAddress, dN as CustomerLinkPreferences, dM as CustomerMobileMoney, cx as CustomerServicePreferences, ac as DEFAULT_COUNTRY, ab as DEFAULT_CURRENCY, a3 as DEVICE_TYPE, dq as DayAvailability, cH as DepositResult, aH as DepositType, V as DeviceType, aG as DigitalProductType, bz as DiscountBreakdown, bA as DiscountDetails, bR as DisplayAddOn, bS as DisplayAddOnOption, bP as DisplayCart, bQ as DisplayCartItem, u as ELEMENT_TYPES, E as EVENT_TYPES, ei as ElementAppearance, eq as ElementEventHandler, y as ElementEventType, w as ElementOptions, x as ElementType, em as ElementsCheckoutData, en as ElementsCheckoutResult, v as ElementsOptions, dV as EnrollAndLinkOrderInput, dY as EnrollAndLinkOrderResult, dS as EnrollmentData, ao as Err, ah as ErrorCode, ai as ErrorCodeType, cd as FeeBearerType, cb as FulfillmentLink, ca as FulfillmentStatus, c9 as FulfillmentType, e9 as FxQuote, e8 as FxQuoteRequest, ea as FxRateResponse, F as FxService, du as GetAvailableSlotsInput, i as GetOrdersOptions, G as GetProductsOptions, b9 as GroupPricingBehavior, ep as IframeToParentMessage, cS as InitializePaymentResult, I as InventoryService, dJ as InventorySummary, aE as InventoryType, K as KitchenOrderItem, q as KitchenOrderResult, a6 as LINK_MUTATION, a5 as LINK_QUERY, bL as LineConfiguration, cf as LineItem, c6 as LineType, dO as LinkData, dX as LinkEnrollResult, L as LinkService, dZ as LinkSession, dW as LinkStatusResult, p as LiteBootstrap, o as LiteService, cZ as Location, cK as LocationAppointment, bl as LocationProductPrice, dG as LocationStock, cX as LocationTaxBehavior, cY as LocationTaxOverrides, d0 as LocationTimeProfile, d6 as LocationWithDetails, M as MESSAGE_TYPES, a1 as MOBILE_MONEY_PROVIDER, dU as MobileMoneyData, e6 as MobileMoneyDetails, R as MobileMoneyProvider, ad as Money, aa as ORDER_MUTATION, Y as ORDER_TYPE, eh as ObservabilityHooks, an as Ok, cg as Order, c5 as OrderChannel, cp as OrderFilter, cc as OrderFulfillmentSummary, cj as OrderGroup, cn as OrderGroupDetails, ck as OrderGroupPayment, ci as OrderGroupPaymentState, cm as OrderGroupPaymentSummary, ch as OrderHistory, c7 as OrderLineState, c8 as OrderLineStatus, co as OrderPaymentEvent, O as OrderQueries, cl as OrderSplitDetail, c3 as OrderStatus, l as OtpResult, Z as PAYMENT_METHOD, a9 as PAYMENT_MUTATION, $ as PAYMENT_STATE, a0 as PICKUP_TIME_TYPE, ag as Pagination, af as PaginationParams, eo as ParentToIframeMessage, cR as Payment, cQ as PaymentMethod, ek as PaymentMethodInfo, cN as PaymentMethodType, cP as PaymentProcessingState, cM as PaymentProvider, c4 as PaymentState, cL as PaymentStatus, e4 as PickupTime, e3 as PickupTimeType, bk as Price, bs as PriceAdjustment, bv as PriceDecisionPath, bj as PriceEntryType, bu as PricePathTaxInfo, bq as PriceSource, cC as PricingOverrides, aJ as Product, aX as ProductAddOn, bm as ProductAvailability, dE as ProductStock, bn as ProductTimeProfile, aD as ProductType, aL as ProductVariant, aQ as ProductVariantValue, aK as ProductWithDetails, ct as RefundOrderInput, cw as ReminderMethod, cz as ReminderSettings, eb as RequestContext, ee as RequestErrorEvent, e0 as RequestOtpInput, ec as RequestStartEvent, ed as RequestSuccessEvent, dw as RescheduleBookingInput, cF as ResourceAssignment, df as ResourceAvailabilityException, de as ResourceAvailabilityRule, dj as ResourceType, am as Result, ef as RetryEvent, d$ as RevokeAllSessionsResult, d_ as RevokeSessionResult, d2 as Room, aI as SalesChannel, cD as SchedulingMetadata, cG as SchedulingResult, n as SchedulingService, S as SearchOptions, bB as SelectedAddOnOption, dk as Service, db as ServiceAvailabilityException, dy as ServiceAvailabilityParams, dz as ServiceAvailabilityResult, da as ServiceAvailabilityRule, d3 as ServiceCharge, cB as ServiceNotes, cI as ServiceScheduleRequest, dh as ServiceStaffRequirement, cu as ServiceStatus, dl as ServiceWithStaff, eg as SessionChangeEvent, dm as Staff, cE as StaffAssignment, dd as StaffAvailabilityException, dc as StaffAvailabilityRule, dg as StaffBookingProfile, cv as StaffRole, cJ as StaffScheduleItem, dC as Stock, dD as StockLevel, dA as StockOwnershipType, dB as StockStatus, d4 as StorefrontBootstrap, cT as SubmitAuthorizationInput, d1 as Table, T as TableInfo, bt as TaxPathComponent, c_ as TimeRange, c$ as TimeRanges, dn as TimeSlot, b$ as UICart, bT as UICartBusiness, bV as UICartCustomer, bU as UICartLocation, bW as UICartPricing, dQ as UpdateAddressInput, c1 as UpdateCartItemInput, cr as UpdateOrderStatusInput, U as UpdateProfileInput, aN as VariantAxis, aS as VariantAxisSelection, aP as VariantAxisValue, aO as VariantAxisWithValues, bE as VariantDetails, bZ as VariantDetailsDTO, aM as VariantDisplayAttribute, aR as VariantLocationAvailability, dF as VariantStock, aF as VariantStrategy, e1 as VerifyOtpInput, aB as combine, aC as combineObject, c as createCimplifyClient, t as createElements, aq as err, av as flatMap, az as fromPromise, h as generateIdempotencyKey, aw as getOrElse, ak as isCimplifyError, as as isErr, ar as isOk, al as isRetryableError, au as mapError, at as mapResult, ap as ok, ay as toNullable, aA as tryCatch, ax as unwrap } from './ads-B5jcLFpD.mjs';
1
+ import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-DRfobDQ9.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-DRfobDQ9.mjs';
3
3
 
4
4
  type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
5
5
  type SortOrder = "asc" | "desc";
@@ -37,7 +37,7 @@ interface TaxComponent {
37
37
  rate: number;
38
38
  }
39
39
  /**
40
- * Complete tax information from a price path
40
+ * Complete tax information from a pricing response
41
41
  */
42
42
  interface TaxInfo {
43
43
  /** Total tax rate as percentage */
@@ -70,42 +70,20 @@ interface PriceInfo {
70
70
  decision_path?: string;
71
71
  }
72
72
  /**
73
- * Parsed price from a signed price path
74
- * Contains all extracted pricing information with validation status
75
- */
76
- interface ParsedPrice {
77
- /** Original price before markup/discount */
78
- basePrice: number;
79
- /** Final price after all adjustments */
80
- finalPrice: number;
81
- /** Currency code (e.g., "GHS", "USD") */
82
- currency: string;
83
- /** Decision path showing how price was calculated */
84
- decisionPath: string;
85
- /** Discount percentage if final < base */
86
- discountPercentage?: number;
87
- /** Markup percentage if final > base */
88
- markupPercentage?: number;
89
- /** Markup amount if final > base */
90
- markupAmount?: number;
91
- /** Tax information extracted from the path */
92
- taxInfo?: TaxInfo;
93
- /** Whether the price path is valid and not expired */
94
- isValid: boolean;
95
- /** Whether the price path has expired */
96
- isExpired: boolean;
97
- /** Unix timestamp when the price expires */
98
- expiryTimestamp?: number;
99
- }
100
- /**
101
- * Minimal product shape for price utilities
102
- * Allows extracting price from either price_path or price_info
73
+ * Minimal product shape for price utilities.
74
+ * Uses quote-aware `price_info` and plain numeric fallback fields.
103
75
  */
104
76
  interface ProductWithPrice {
105
- /** Signed price path from backend */
106
- price_path?: string | null;
107
- /** Pre-parsed price info */
77
+ /** Pre-parsed price info from backend */
108
78
  price_info?: PriceInfo;
79
+ /** Final computed price in plain field form (if provided by API) */
80
+ final_price?: number | string | null;
81
+ /** Base/original price in plain field form */
82
+ base_price?: number | string | null;
83
+ /** Default/indicative price in plain field form */
84
+ default_price?: number | string | null;
85
+ /** Currency in plain field form */
86
+ currency?: string | null;
109
87
  }
110
88
  /**
111
89
  * Options for price formatting functions
@@ -134,15 +112,13 @@ interface FormatCompactOptions {
134
112
  * Price Utilities
135
113
  *
136
114
  * Comprehensive utilities for parsing, formatting, and displaying prices.
137
- * Handles signed price paths from the backend, currency formatting,
138
- * and product price helpers.
115
+ * Handles quote-aware pricing fields, currency formatting, and product price helpers.
139
116
  *
140
117
  * @example
141
118
  * ```typescript
142
119
  * import {
143
120
  * formatPrice,
144
121
  * formatPriceCompact,
145
- * parsePricePath,
146
122
  * isOnSale,
147
123
  * getDiscountPercentage
148
124
  * } from '@cimplify/sdk';
@@ -263,53 +239,10 @@ declare function formatMoney(amount: string | number, currency?: string): string
263
239
  */
264
240
  declare function parsePrice(value: string | number | undefined | null): number;
265
241
  /**
266
- * Parse a signed price path from the backend
267
- *
268
- * Price paths are HMAC-SHA256 signed and contain:
269
- * - Base price (original price before markup)
270
- * - Final price (what customer pays)
271
- * - Currency
272
- * - Tax information
273
- * - Decision path (pricing adjustments trail)
274
- *
275
- * Format: "base_price|final_price|currency|tax_info|decision_path§expiry§signature"
276
- *
277
- * @param signedPricePath - The signed price path from backend
278
- * @returns ParsedPrice object with extracted pricing information
279
- *
280
- * @example
281
- * const parsed = parsePricePath(product.price_path);
282
- * console.log(parsed.finalPrice); // 29.99
283
- * console.log(parsed.currency); // "GHS"
284
- * console.log(parsed.isValid); // true
285
- * console.log(parsed.taxInfo); // { taxRate: 15, ... }
286
- */
287
- declare function parsePricePath(signedPricePath: string | undefined | null): ParsedPrice;
288
- /**
289
- * Convert a ParsedPrice to PriceInfo format
290
- * Useful for compatibility with components expecting snake_case format
291
- *
292
- * @param parsedPrice - The parsed price object
293
- * @returns PriceInfo object in snake_case format
294
- */
295
- declare function parsedPriceToPriceInfo(parsedPrice: ParsedPrice): PriceInfo;
296
- /**
297
- * Extract PriceInfo directly from a signed price path
298
- * Convenience function that parses and converts in one step
299
- *
300
- * @param signedPricePath - The signed price path from backend
301
- * @returns PriceInfo object ready for use in components
302
- *
303
- * @example
304
- * const priceInfo = extractPriceInfo(product.price_path);
305
- * console.log(priceInfo.final_price); // 29.99
306
- */
307
- declare function extractPriceInfo(signedPricePath: string | undefined | null): PriceInfo;
308
- /**
309
- * Get the display price from a product
310
- * Handles both price_path and pre-parsed price_info
242
+ * Get the display price from a product.
243
+ * Prefers quote-aware price_info, then plain price fields.
311
244
  *
312
- * @param product - Product with price_path or price_info
245
+ * @param product - Product with price data
313
246
  * @returns The final price to display
314
247
  *
315
248
  * @example
@@ -320,14 +253,14 @@ declare function getDisplayPrice(product: ProductWithPrice): number;
320
253
  /**
321
254
  * Get the base price from a product (before markup/discount)
322
255
  *
323
- * @param product - Product with price_path or price_info
256
+ * @param product - Product with price data
324
257
  * @returns The base price before adjustments
325
258
  */
326
259
  declare function getBasePrice(product: ProductWithPrice): number;
327
260
  /**
328
261
  * Check if a product is on sale (discounted)
329
262
  *
330
- * @param product - Product with price_path or price_info
263
+ * @param product - Product with price data
331
264
  * @returns True if the final price is less than the base price
332
265
  *
333
266
  * @example
@@ -339,7 +272,7 @@ declare function isOnSale(product: ProductWithPrice): boolean;
339
272
  /**
340
273
  * Get the discount percentage for a product on sale
341
274
  *
342
- * @param product - Product with price_path or price_info
275
+ * @param product - Product with price data
343
276
  * @returns Discount percentage (0-100), or 0 if not on sale
344
277
  *
345
278
  * @example
@@ -352,14 +285,14 @@ declare function getDiscountPercentage(product: ProductWithPrice): number;
352
285
  /**
353
286
  * Get the markup percentage for a product
354
287
  *
355
- * @param product - Product with price_path or price_info
288
+ * @param product - Product with price data
356
289
  * @returns Markup percentage, or 0 if no markup
357
290
  */
358
291
  declare function getMarkupPercentage(product: ProductWithPrice): number;
359
292
  /**
360
293
  * Get the currency for a product
361
294
  *
362
- * @param product - Product with price_path or price_info
295
+ * @param product - Product with price data
363
296
  * @returns Currency code (default: "GHS")
364
297
  */
365
298
  declare function getProductCurrency(product: ProductWithPrice): string;
@@ -367,7 +300,7 @@ declare function getProductCurrency(product: ProductWithPrice): string;
367
300
  * Format a product's display price
368
301
  * Convenience function combining getDisplayPrice and formatPrice
369
302
  *
370
- * @param product - Product with price_path or price_info
303
+ * @param product - Product with price data
371
304
  * @param locale - BCP 47 locale string (default: "en-US")
372
305
  * @returns Formatted price string
373
306
  *
@@ -438,4 +371,4 @@ interface ApiResponse<T> {
438
371
  metadata?: ResponseMetadata;
439
372
  }
440
373
 
441
- export { ApiError, type ApiResponse, CURRENCY_SYMBOLS, type FormatCompactOptions, type FormatPriceOptions, type FrontendContext, MOBILE_MONEY_PROVIDERS, type MutationRequest, type ParsedPrice, PaymentErrorDetails, PaymentResponse, PaymentStatusResponse, type PriceInfo, type ProductWithPrice, QueryBuilder, type QueryRequest, type ResponseMetadata, type TaxComponent, type TaxInfo, categorizePaymentError, detectMobileMoneyProvider, extractPriceInfo, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, isOnSale, normalizePaymentResponse, normalizeStatusResponse, parsePrice, parsePricePath, parsedPriceToPriceInfo, query };
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 };
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-B5jcLFpD.js';
2
- export { a2 as AUTHORIZATION_TYPE, a7 as AUTH_MUTATION, eu as AdConfig, ew as AdContextValue, ev as AdCreative, es as AdPosition, er as AdSlot, et as AdTheme, aT as AddOn, bC as AddOnDetails, bY as AddOnGroupDetails, aV as AddOnOption, bX as AddOnOptionDetails, aW as AddOnOptionPrice, aU as AddOnWithOptions, c0 as AddToCartInput, dT as AddressData, ej as AddressInfo, br as AdjustmentType, ce as AmountToPay, by as AppliedDiscount, e2 as AuthResponse, j as AuthService, k as AuthStatus, el as AuthenticatedData, cO as AuthorizationType, dH as AvailabilityCheck, dI as AvailabilityResult, dp as AvailableSlot, bx as BenefitType, ds as Booking, di as BookingRequirementOverride, dr as BookingStatus, dt as BookingWithDetails, cy as BufferTimes, b2 as Bundle, b6 as BundleComponentData, b7 as BundleComponentInfo, b1 as BundlePriceType, b4 as BundleProduct, bH as BundleSelectionData, bF as BundleSelectionInput, bG as BundleStoredSelection, b3 as BundleSummary, b5 as BundleWithDetails, cW as Business, d8 as BusinessHours, cV as BusinessPreferences, B as BusinessService, d7 as BusinessSettings, cU as BusinessType, d5 as BusinessWithLocations, X as CHECKOUT_MODE, a8 as CHECKOUT_MUTATION, _ as CHECKOUT_STEP, a4 as CONTACT_TYPE, dx as CancelBookingInput, cs as CancelOrderInput, cA as CancellationPolicy, bM as Cart, bD as CartAddOn, bp as CartChannel, bN as CartItem, b_ as CartItemDetails, f as CartOperations, bo as CartStatus, c2 as CartSummary, bO as CartTotals, e as CatalogueQueries, aY as Category, d9 as CategoryInfo, aZ as CategorySummary, m as ChangePasswordInput, dv as CheckSlotAvailabilityInput, e5 as CheckoutAddressInfo, e7 as CheckoutCustomerInfo, N as CheckoutFormData, cq as CheckoutInput, z as CheckoutMode, g as CheckoutOperations, D as CheckoutOrderType, H as CheckoutPaymentMethod, Q as CheckoutResult, g as CheckoutService, J as CheckoutStep, bw as ChosenPrice, C as CimplifyClient, d as CimplifyConfig, s as CimplifyElement, r as CimplifyElements, aj as CimplifyError, a_ as Collection, b0 as CollectionProduct, a$ as CollectionSummary, bd as ComponentGroup, be as ComponentGroupWithComponents, bi as ComponentPriceBreakdown, bg as ComponentSelectionInput, ba as ComponentSourceType, bb as Composite, bf as CompositeComponent, bJ as CompositePriceBreakdown, bh as CompositePriceResult, b8 as CompositePricingMode, bK as CompositeSelectionData, bg as CompositeSelectionInput, bI as CompositeStoredSelection, bc as CompositeWithDetails, W as ContactType, dP as CreateAddressInput, dR as CreateMobileMoneyInput, ae as Currency, dK as Customer, dL as CustomerAddress, dN as CustomerLinkPreferences, dM as CustomerMobileMoney, cx as CustomerServicePreferences, ac as DEFAULT_COUNTRY, ab as DEFAULT_CURRENCY, a3 as DEVICE_TYPE, dq as DayAvailability, cH as DepositResult, aH as DepositType, V as DeviceType, aG as DigitalProductType, bz as DiscountBreakdown, bA as DiscountDetails, bR as DisplayAddOn, bS as DisplayAddOnOption, bP as DisplayCart, bQ as DisplayCartItem, u as ELEMENT_TYPES, E as EVENT_TYPES, ei as ElementAppearance, eq as ElementEventHandler, y as ElementEventType, w as ElementOptions, x as ElementType, em as ElementsCheckoutData, en as ElementsCheckoutResult, v as ElementsOptions, dV as EnrollAndLinkOrderInput, dY as EnrollAndLinkOrderResult, dS as EnrollmentData, ao as Err, ah as ErrorCode, ai as ErrorCodeType, cd as FeeBearerType, cb as FulfillmentLink, ca as FulfillmentStatus, c9 as FulfillmentType, e9 as FxQuote, e8 as FxQuoteRequest, ea as FxRateResponse, F as FxService, du as GetAvailableSlotsInput, i as GetOrdersOptions, G as GetProductsOptions, b9 as GroupPricingBehavior, ep as IframeToParentMessage, cS as InitializePaymentResult, I as InventoryService, dJ as InventorySummary, aE as InventoryType, K as KitchenOrderItem, q as KitchenOrderResult, a6 as LINK_MUTATION, a5 as LINK_QUERY, bL as LineConfiguration, cf as LineItem, c6 as LineType, dO as LinkData, dX as LinkEnrollResult, L as LinkService, dZ as LinkSession, dW as LinkStatusResult, p as LiteBootstrap, o as LiteService, cZ as Location, cK as LocationAppointment, bl as LocationProductPrice, dG as LocationStock, cX as LocationTaxBehavior, cY as LocationTaxOverrides, d0 as LocationTimeProfile, d6 as LocationWithDetails, M as MESSAGE_TYPES, a1 as MOBILE_MONEY_PROVIDER, dU as MobileMoneyData, e6 as MobileMoneyDetails, R as MobileMoneyProvider, ad as Money, aa as ORDER_MUTATION, Y as ORDER_TYPE, eh as ObservabilityHooks, an as Ok, cg as Order, c5 as OrderChannel, cp as OrderFilter, cc as OrderFulfillmentSummary, cj as OrderGroup, cn as OrderGroupDetails, ck as OrderGroupPayment, ci as OrderGroupPaymentState, cm as OrderGroupPaymentSummary, ch as OrderHistory, c7 as OrderLineState, c8 as OrderLineStatus, co as OrderPaymentEvent, O as OrderQueries, cl as OrderSplitDetail, c3 as OrderStatus, l as OtpResult, Z as PAYMENT_METHOD, a9 as PAYMENT_MUTATION, $ as PAYMENT_STATE, a0 as PICKUP_TIME_TYPE, ag as Pagination, af as PaginationParams, eo as ParentToIframeMessage, cR as Payment, cQ as PaymentMethod, ek as PaymentMethodInfo, cN as PaymentMethodType, cP as PaymentProcessingState, cM as PaymentProvider, c4 as PaymentState, cL as PaymentStatus, e4 as PickupTime, e3 as PickupTimeType, bk as Price, bs as PriceAdjustment, bv as PriceDecisionPath, bj as PriceEntryType, bu as PricePathTaxInfo, bq as PriceSource, cC as PricingOverrides, aJ as Product, aX as ProductAddOn, bm as ProductAvailability, dE as ProductStock, bn as ProductTimeProfile, aD as ProductType, aL as ProductVariant, aQ as ProductVariantValue, aK as ProductWithDetails, ct as RefundOrderInput, cw as ReminderMethod, cz as ReminderSettings, eb as RequestContext, ee as RequestErrorEvent, e0 as RequestOtpInput, ec as RequestStartEvent, ed as RequestSuccessEvent, dw as RescheduleBookingInput, cF as ResourceAssignment, df as ResourceAvailabilityException, de as ResourceAvailabilityRule, dj as ResourceType, am as Result, ef as RetryEvent, d$ as RevokeAllSessionsResult, d_ as RevokeSessionResult, d2 as Room, aI as SalesChannel, cD as SchedulingMetadata, cG as SchedulingResult, n as SchedulingService, S as SearchOptions, bB as SelectedAddOnOption, dk as Service, db as ServiceAvailabilityException, dy as ServiceAvailabilityParams, dz as ServiceAvailabilityResult, da as ServiceAvailabilityRule, d3 as ServiceCharge, cB as ServiceNotes, cI as ServiceScheduleRequest, dh as ServiceStaffRequirement, cu as ServiceStatus, dl as ServiceWithStaff, eg as SessionChangeEvent, dm as Staff, cE as StaffAssignment, dd as StaffAvailabilityException, dc as StaffAvailabilityRule, dg as StaffBookingProfile, cv as StaffRole, cJ as StaffScheduleItem, dC as Stock, dD as StockLevel, dA as StockOwnershipType, dB as StockStatus, d4 as StorefrontBootstrap, cT as SubmitAuthorizationInput, d1 as Table, T as TableInfo, bt as TaxPathComponent, c_ as TimeRange, c$ as TimeRanges, dn as TimeSlot, b$ as UICart, bT as UICartBusiness, bV as UICartCustomer, bU as UICartLocation, bW as UICartPricing, dQ as UpdateAddressInput, c1 as UpdateCartItemInput, cr as UpdateOrderStatusInput, U as UpdateProfileInput, aN as VariantAxis, aS as VariantAxisSelection, aP as VariantAxisValue, aO as VariantAxisWithValues, bE as VariantDetails, bZ as VariantDetailsDTO, aM as VariantDisplayAttribute, aR as VariantLocationAvailability, dF as VariantStock, aF as VariantStrategy, e1 as VerifyOtpInput, aB as combine, aC as combineObject, c as createCimplifyClient, t as createElements, aq as err, av as flatMap, az as fromPromise, h as generateIdempotencyKey, aw as getOrElse, ak as isCimplifyError, as as isErr, ar as isOk, al as isRetryableError, au as mapError, at as mapResult, ap as ok, ay as toNullable, aA as tryCatch, ax as unwrap } from './ads-B5jcLFpD.js';
1
+ import { P as PaymentErrorDetails, a as PaymentResponse, b as PaymentStatusResponse, A as ApiError } from './ads-DRfobDQ9.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-DRfobDQ9.js';
3
3
 
4
4
  type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
5
5
  type SortOrder = "asc" | "desc";
@@ -37,7 +37,7 @@ interface TaxComponent {
37
37
  rate: number;
38
38
  }
39
39
  /**
40
- * Complete tax information from a price path
40
+ * Complete tax information from a pricing response
41
41
  */
42
42
  interface TaxInfo {
43
43
  /** Total tax rate as percentage */
@@ -70,42 +70,20 @@ interface PriceInfo {
70
70
  decision_path?: string;
71
71
  }
72
72
  /**
73
- * Parsed price from a signed price path
74
- * Contains all extracted pricing information with validation status
75
- */
76
- interface ParsedPrice {
77
- /** Original price before markup/discount */
78
- basePrice: number;
79
- /** Final price after all adjustments */
80
- finalPrice: number;
81
- /** Currency code (e.g., "GHS", "USD") */
82
- currency: string;
83
- /** Decision path showing how price was calculated */
84
- decisionPath: string;
85
- /** Discount percentage if final < base */
86
- discountPercentage?: number;
87
- /** Markup percentage if final > base */
88
- markupPercentage?: number;
89
- /** Markup amount if final > base */
90
- markupAmount?: number;
91
- /** Tax information extracted from the path */
92
- taxInfo?: TaxInfo;
93
- /** Whether the price path is valid and not expired */
94
- isValid: boolean;
95
- /** Whether the price path has expired */
96
- isExpired: boolean;
97
- /** Unix timestamp when the price expires */
98
- expiryTimestamp?: number;
99
- }
100
- /**
101
- * Minimal product shape for price utilities
102
- * Allows extracting price from either price_path or price_info
73
+ * Minimal product shape for price utilities.
74
+ * Uses quote-aware `price_info` and plain numeric fallback fields.
103
75
  */
104
76
  interface ProductWithPrice {
105
- /** Signed price path from backend */
106
- price_path?: string | null;
107
- /** Pre-parsed price info */
77
+ /** Pre-parsed price info from backend */
108
78
  price_info?: PriceInfo;
79
+ /** Final computed price in plain field form (if provided by API) */
80
+ final_price?: number | string | null;
81
+ /** Base/original price in plain field form */
82
+ base_price?: number | string | null;
83
+ /** Default/indicative price in plain field form */
84
+ default_price?: number | string | null;
85
+ /** Currency in plain field form */
86
+ currency?: string | null;
109
87
  }
110
88
  /**
111
89
  * Options for price formatting functions
@@ -134,15 +112,13 @@ interface FormatCompactOptions {
134
112
  * Price Utilities
135
113
  *
136
114
  * Comprehensive utilities for parsing, formatting, and displaying prices.
137
- * Handles signed price paths from the backend, currency formatting,
138
- * and product price helpers.
115
+ * Handles quote-aware pricing fields, currency formatting, and product price helpers.
139
116
  *
140
117
  * @example
141
118
  * ```typescript
142
119
  * import {
143
120
  * formatPrice,
144
121
  * formatPriceCompact,
145
- * parsePricePath,
146
122
  * isOnSale,
147
123
  * getDiscountPercentage
148
124
  * } from '@cimplify/sdk';
@@ -263,53 +239,10 @@ declare function formatMoney(amount: string | number, currency?: string): string
263
239
  */
264
240
  declare function parsePrice(value: string | number | undefined | null): number;
265
241
  /**
266
- * Parse a signed price path from the backend
267
- *
268
- * Price paths are HMAC-SHA256 signed and contain:
269
- * - Base price (original price before markup)
270
- * - Final price (what customer pays)
271
- * - Currency
272
- * - Tax information
273
- * - Decision path (pricing adjustments trail)
274
- *
275
- * Format: "base_price|final_price|currency|tax_info|decision_path§expiry§signature"
276
- *
277
- * @param signedPricePath - The signed price path from backend
278
- * @returns ParsedPrice object with extracted pricing information
279
- *
280
- * @example
281
- * const parsed = parsePricePath(product.price_path);
282
- * console.log(parsed.finalPrice); // 29.99
283
- * console.log(parsed.currency); // "GHS"
284
- * console.log(parsed.isValid); // true
285
- * console.log(parsed.taxInfo); // { taxRate: 15, ... }
286
- */
287
- declare function parsePricePath(signedPricePath: string | undefined | null): ParsedPrice;
288
- /**
289
- * Convert a ParsedPrice to PriceInfo format
290
- * Useful for compatibility with components expecting snake_case format
291
- *
292
- * @param parsedPrice - The parsed price object
293
- * @returns PriceInfo object in snake_case format
294
- */
295
- declare function parsedPriceToPriceInfo(parsedPrice: ParsedPrice): PriceInfo;
296
- /**
297
- * Extract PriceInfo directly from a signed price path
298
- * Convenience function that parses and converts in one step
299
- *
300
- * @param signedPricePath - The signed price path from backend
301
- * @returns PriceInfo object ready for use in components
302
- *
303
- * @example
304
- * const priceInfo = extractPriceInfo(product.price_path);
305
- * console.log(priceInfo.final_price); // 29.99
306
- */
307
- declare function extractPriceInfo(signedPricePath: string | undefined | null): PriceInfo;
308
- /**
309
- * Get the display price from a product
310
- * Handles both price_path and pre-parsed price_info
242
+ * Get the display price from a product.
243
+ * Prefers quote-aware price_info, then plain price fields.
311
244
  *
312
- * @param product - Product with price_path or price_info
245
+ * @param product - Product with price data
313
246
  * @returns The final price to display
314
247
  *
315
248
  * @example
@@ -320,14 +253,14 @@ declare function getDisplayPrice(product: ProductWithPrice): number;
320
253
  /**
321
254
  * Get the base price from a product (before markup/discount)
322
255
  *
323
- * @param product - Product with price_path or price_info
256
+ * @param product - Product with price data
324
257
  * @returns The base price before adjustments
325
258
  */
326
259
  declare function getBasePrice(product: ProductWithPrice): number;
327
260
  /**
328
261
  * Check if a product is on sale (discounted)
329
262
  *
330
- * @param product - Product with price_path or price_info
263
+ * @param product - Product with price data
331
264
  * @returns True if the final price is less than the base price
332
265
  *
333
266
  * @example
@@ -339,7 +272,7 @@ declare function isOnSale(product: ProductWithPrice): boolean;
339
272
  /**
340
273
  * Get the discount percentage for a product on sale
341
274
  *
342
- * @param product - Product with price_path or price_info
275
+ * @param product - Product with price data
343
276
  * @returns Discount percentage (0-100), or 0 if not on sale
344
277
  *
345
278
  * @example
@@ -352,14 +285,14 @@ declare function getDiscountPercentage(product: ProductWithPrice): number;
352
285
  /**
353
286
  * Get the markup percentage for a product
354
287
  *
355
- * @param product - Product with price_path or price_info
288
+ * @param product - Product with price data
356
289
  * @returns Markup percentage, or 0 if no markup
357
290
  */
358
291
  declare function getMarkupPercentage(product: ProductWithPrice): number;
359
292
  /**
360
293
  * Get the currency for a product
361
294
  *
362
- * @param product - Product with price_path or price_info
295
+ * @param product - Product with price data
363
296
  * @returns Currency code (default: "GHS")
364
297
  */
365
298
  declare function getProductCurrency(product: ProductWithPrice): string;
@@ -367,7 +300,7 @@ declare function getProductCurrency(product: ProductWithPrice): string;
367
300
  * Format a product's display price
368
301
  * Convenience function combining getDisplayPrice and formatPrice
369
302
  *
370
- * @param product - Product with price_path or price_info
303
+ * @param product - Product with price data
371
304
  * @param locale - BCP 47 locale string (default: "en-US")
372
305
  * @returns Formatted price string
373
306
  *
@@ -438,4 +371,4 @@ interface ApiResponse<T> {
438
371
  metadata?: ResponseMetadata;
439
372
  }
440
373
 
441
- export { ApiError, type ApiResponse, CURRENCY_SYMBOLS, type FormatCompactOptions, type FormatPriceOptions, type FrontendContext, MOBILE_MONEY_PROVIDERS, type MutationRequest, type ParsedPrice, PaymentErrorDetails, PaymentResponse, PaymentStatusResponse, type PriceInfo, type ProductWithPrice, QueryBuilder, type QueryRequest, type ResponseMetadata, type TaxComponent, type TaxInfo, categorizePaymentError, detectMobileMoneyProvider, extractPriceInfo, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, isOnSale, normalizePaymentResponse, normalizeStatusResponse, parsePrice, parsePricePath, parsedPriceToPriceInfo, query };
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 };