@cimplify/sdk 0.6.5 → 0.6.7

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.
@@ -0,0 +1,325 @@
1
+ import { s as PaymentErrorDetails, q as PaymentResponse, r as PaymentStatusResponse } from './payment-pjpfIKX8.js';
2
+
3
+ /**
4
+ * Price Types
5
+ *
6
+ * Types for price parsing, formatting, and display utilities.
7
+ */
8
+ /**
9
+ * Individual tax component (e.g., VAT, NHIL, GETFund)
10
+ */
11
+ interface TaxComponent {
12
+ /** Tax component name */
13
+ name: string;
14
+ /** Tax rate as percentage (e.g., 15.0 for 15%) */
15
+ rate: number;
16
+ }
17
+ /**
18
+ * Complete tax information from a pricing response
19
+ */
20
+ interface TaxInfo {
21
+ /** Total tax rate as percentage */
22
+ taxRate: number;
23
+ /** Calculated tax amount */
24
+ taxAmount: number;
25
+ /** Whether tax is included in the displayed price */
26
+ isInclusive: boolean;
27
+ /** Individual tax components that make up the total */
28
+ components: TaxComponent[];
29
+ }
30
+ /**
31
+ * Price information in snake_case format (as returned from backend)
32
+ * Used by components that work with raw API responses
33
+ */
34
+ interface PriceInfo {
35
+ /** Original price before markup/discount */
36
+ base_price: number;
37
+ /** Final price after all adjustments */
38
+ final_price: number;
39
+ /** Markup percentage if applicable */
40
+ markup_percentage?: number;
41
+ /** Markup amount if applicable */
42
+ markup_amount?: number;
43
+ /** Currency code (e.g., "GHS", "USD") */
44
+ currency?: string;
45
+ /** Tax information */
46
+ tax_info?: TaxInfo;
47
+ /** Decision path showing pricing adjustments */
48
+ decision_path?: string;
49
+ }
50
+ /**
51
+ * Minimal product shape for price utilities.
52
+ * Uses quote-aware `price_info` and plain numeric fallback fields.
53
+ */
54
+ interface ProductWithPrice {
55
+ /** Pre-parsed price info from backend */
56
+ price_info?: PriceInfo;
57
+ /** Final computed price in plain field form (if provided by API) */
58
+ final_price?: number | string | null;
59
+ /** Base/original price in plain field form */
60
+ base_price?: number | string | null;
61
+ /** Default/indicative price in plain field form */
62
+ default_price?: number | string | null;
63
+ /** Currency in plain field form */
64
+ currency?: string | null;
65
+ }
66
+ /**
67
+ * Options for price formatting functions
68
+ */
69
+ interface FormatPriceOptions {
70
+ /** Currency code (default: "GHS") */
71
+ currency?: string;
72
+ /** Locale for Intl.NumberFormat (default: "en-US") */
73
+ locale?: string;
74
+ /** Minimum fraction digits (default: 2) */
75
+ minimumFractionDigits?: number;
76
+ /** Maximum fraction digits (default: 2) */
77
+ maximumFractionDigits?: number;
78
+ }
79
+ /**
80
+ * Options for compact price formatting
81
+ */
82
+ interface FormatCompactOptions {
83
+ /** Currency code (default: "GHS") */
84
+ currency?: string;
85
+ /** Number of decimal places for compact notation (default: 1) */
86
+ decimals?: number;
87
+ }
88
+
89
+ /**
90
+ * Price Utilities
91
+ *
92
+ * Comprehensive utilities for parsing, formatting, and displaying prices.
93
+ * Handles quote-aware pricing fields, currency formatting, and product price helpers.
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * import {
98
+ * formatPrice,
99
+ * formatPriceCompact,
100
+ * isOnSale,
101
+ * getDiscountPercentage
102
+ * } from '@cimplify/sdk';
103
+ *
104
+ * // Format prices
105
+ * formatPrice(29.99, 'USD'); // "$29.99"
106
+ * formatPrice(29.99, 'GHS'); // "GH₵29.99"
107
+ * formatPriceCompact(1500000, 'USD'); // "$1.5M"
108
+ *
109
+ * // Check for discounts
110
+ * if (isOnSale(product)) {
111
+ * console.log(`${getDiscountPercentage(product)}% off!`);
112
+ * }
113
+ * ```
114
+ */
115
+
116
+ /**
117
+ * Currency code to symbol mapping
118
+ * Includes major world currencies and African currencies
119
+ */
120
+ declare const CURRENCY_SYMBOLS: Record<string, string>;
121
+ /**
122
+ * Get currency symbol for a currency code
123
+ * @param currencyCode - ISO 4217 currency code (e.g., "USD", "GHS")
124
+ * @returns Currency symbol or the code itself if not found
125
+ *
126
+ * @example
127
+ * getCurrencySymbol('USD') // "$"
128
+ * getCurrencySymbol('GHS') // "GH₵"
129
+ * getCurrencySymbol('XYZ') // "XYZ"
130
+ */
131
+ declare function getCurrencySymbol(currencyCode: string): string;
132
+ /**
133
+ * Format a number compactly with K/M/B suffixes
134
+ * @param value - Number to format
135
+ * @param decimals - Decimal places (default: 1)
136
+ * @returns Compact string representation
137
+ *
138
+ * @example
139
+ * formatNumberCompact(1234) // "1.2K"
140
+ * formatNumberCompact(1500000) // "1.5M"
141
+ * formatNumberCompact(2500000000) // "2.5B"
142
+ */
143
+ declare function formatNumberCompact(value: number, decimals?: number): string;
144
+ /**
145
+ * Format a price with locale-aware currency formatting
146
+ * Uses Intl.NumberFormat for proper localization
147
+ *
148
+ * @param amount - Price amount (number or string)
149
+ * @param currency - ISO 4217 currency code (default: "GHS")
150
+ * @param locale - BCP 47 locale string (default: "en-US")
151
+ * @returns Formatted price string
152
+ *
153
+ * @example
154
+ * formatPrice(29.99, 'USD') // "$29.99"
155
+ * formatPrice(29.99, 'GHS') // "GH₵29.99"
156
+ * formatPrice('29.99', 'EUR') // "€29.99"
157
+ * formatPrice(1234.56, 'USD', 'de-DE') // "1.234,56 $"
158
+ */
159
+ declare function formatPrice(amount: number | string, currency?: string, locale?: string): string;
160
+ /**
161
+ * Format a price with +/- sign for adjustments
162
+ * Useful for showing price changes, modifiers, or discounts
163
+ *
164
+ * @param amount - Adjustment amount (positive or negative)
165
+ * @param currency - ISO 4217 currency code (default: "GHS")
166
+ * @param locale - BCP 47 locale string (default: "en-US")
167
+ * @returns Formatted adjustment string with sign
168
+ *
169
+ * @example
170
+ * formatPriceAdjustment(5.00, 'USD') // "+$5.00"
171
+ * formatPriceAdjustment(-3.50, 'GHS') // "-GH₵3.50"
172
+ * formatPriceAdjustment(0, 'EUR') // "€0.00"
173
+ */
174
+ declare function formatPriceAdjustment(amount: number, currency?: string, locale?: string): string;
175
+ /**
176
+ * Format a price compactly for large numbers
177
+ * Uses K/M/B suffixes for thousands, millions, billions
178
+ *
179
+ * @param amount - Price amount (number or string)
180
+ * @param currency - ISO 4217 currency code (default: "GHS")
181
+ * @param decimals - Decimal places for compact notation (default: 1)
182
+ * @returns Compact formatted price
183
+ *
184
+ * @example
185
+ * formatPriceCompact(999, 'USD') // "$999.00"
186
+ * formatPriceCompact(1500, 'GHS') // "GH₵1.5K"
187
+ * formatPriceCompact(2500000, 'USD') // "$2.5M"
188
+ * formatPriceCompact(1200000000, 'EUR') // "€1.2B"
189
+ */
190
+ declare function formatPriceCompact(amount: number | string, currency?: string, decimals?: number): string;
191
+ /**
192
+ * Simple currency symbol + amount format
193
+ * Lighter alternative to formatPrice without Intl
194
+ *
195
+ * @param amount - Price amount (number or string)
196
+ * @param currency - ISO 4217 currency code (default: "GHS")
197
+ * @returns Simple formatted price
198
+ *
199
+ * @example
200
+ * formatMoney(29.99, 'USD') // "$29.99"
201
+ * formatMoney('15.00', 'GHS') // "GH₵15.00"
202
+ */
203
+ declare function formatMoney(amount: string | number, currency?: string): string;
204
+ /**
205
+ * Parse a price string or number to a numeric value
206
+ * Handles various input formats gracefully
207
+ *
208
+ * @param value - Value to parse (string, number, or undefined)
209
+ * @returns Parsed numeric value, or 0 if invalid
210
+ *
211
+ * @example
212
+ * parsePrice('29.99') // 29.99
213
+ * parsePrice(29.99) // 29.99
214
+ * parsePrice('$29.99') // 29.99 (strips non-numeric prefix)
215
+ * parsePrice(undefined) // 0
216
+ * parsePrice('invalid') // 0
217
+ */
218
+ declare function parsePrice(value: string | number | undefined | null): number;
219
+ /**
220
+ * Get the display price from a product.
221
+ * Prefers quote-aware price_info, then plain price fields.
222
+ *
223
+ * @param product - Product with price data
224
+ * @returns The final price to display
225
+ *
226
+ * @example
227
+ * const price = getDisplayPrice(product);
228
+ * console.log(formatPrice(price, 'GHS')); // "GH₵29.99"
229
+ */
230
+ declare function getDisplayPrice(product: ProductWithPrice): number;
231
+ /**
232
+ * Get the base price from a product (before markup/discount)
233
+ *
234
+ * @param product - Product with price data
235
+ * @returns The base price before adjustments
236
+ */
237
+ declare function getBasePrice(product: ProductWithPrice): number;
238
+ /**
239
+ * Check if a product is on sale (discounted)
240
+ *
241
+ * @param product - Product with price data
242
+ * @returns True if the final price is less than the base price
243
+ *
244
+ * @example
245
+ * if (isOnSale(product)) {
246
+ * return <Badge>Sale!</Badge>;
247
+ * }
248
+ */
249
+ declare function isOnSale(product: ProductWithPrice): boolean;
250
+ /**
251
+ * Get the discount percentage for a product on sale
252
+ *
253
+ * @param product - Product with price data
254
+ * @returns Discount percentage (0-100), or 0 if not on sale
255
+ *
256
+ * @example
257
+ * const discount = getDiscountPercentage(product);
258
+ * if (discount > 0) {
259
+ * return <Badge>{discount}% OFF</Badge>;
260
+ * }
261
+ */
262
+ declare function getDiscountPercentage(product: ProductWithPrice): number;
263
+ /**
264
+ * Get the markup percentage for a product
265
+ *
266
+ * @param product - Product with price data
267
+ * @returns Markup percentage, or 0 if no markup
268
+ */
269
+ declare function getMarkupPercentage(product: ProductWithPrice): number;
270
+ /**
271
+ * Get the currency for a product
272
+ *
273
+ * @param product - Product with price data
274
+ * @returns Currency code (default: "GHS")
275
+ */
276
+ declare function getProductCurrency(product: ProductWithPrice): string;
277
+ /**
278
+ * Format a product's display price
279
+ * Convenience function combining getDisplayPrice and formatPrice
280
+ *
281
+ * @param product - Product with price data
282
+ * @param locale - BCP 47 locale string (default: "en-US")
283
+ * @returns Formatted price string
284
+ *
285
+ * @example
286
+ * <span>{formatProductPrice(product)}</span> // "GH₵29.99"
287
+ */
288
+ declare function formatProductPrice(product: ProductWithPrice, locale?: string): string;
289
+
290
+ /**
291
+ * Categorize payment errors into user-friendly messages
292
+ */
293
+ declare function categorizePaymentError(error: Error, errorCode?: string): PaymentErrorDetails;
294
+ /**
295
+ * Normalize payment response from different formats into a standard PaymentResponse
296
+ */
297
+ declare function normalizePaymentResponse(response: unknown): PaymentResponse;
298
+ declare function isPaymentStatusSuccess(status: string | undefined): boolean;
299
+ declare function isPaymentStatusFailure(status: string | undefined): boolean;
300
+ declare function isPaymentStatusRequiresAction(status: string | undefined): boolean;
301
+ /**
302
+ * Normalize payment status response into a standard format
303
+ */
304
+ declare function normalizeStatusResponse(response: unknown): PaymentStatusResponse;
305
+ /** Mobile money provider display names */
306
+ declare const MOBILE_MONEY_PROVIDERS: {
307
+ readonly mtn: {
308
+ readonly name: "MTN Mobile Money";
309
+ readonly prefix: readonly ["024", "054", "055", "059"];
310
+ };
311
+ readonly vodafone: {
312
+ readonly name: "Vodafone Cash";
313
+ readonly prefix: readonly ["020", "050"];
314
+ };
315
+ readonly airtel: {
316
+ readonly name: "AirtelTigo Money";
317
+ readonly prefix: readonly ["027", "057", "026", "056"];
318
+ };
319
+ };
320
+ /**
321
+ * Detect mobile money provider from phone number
322
+ */
323
+ declare function detectMobileMoneyProvider(phoneNumber: string): "mtn" | "vodafone" | "airtel" | null;
324
+
325
+ export { CURRENCY_SYMBOLS as C, type FormatPriceOptions as F, MOBILE_MONEY_PROVIDERS as M, type PriceInfo as P, type TaxComponent as T, formatPriceAdjustment as a, formatPriceCompact as b, formatMoney as c, formatNumberCompact as d, formatProductPrice as e, formatPrice as f, getCurrencySymbol as g, getDisplayPrice as h, getBasePrice as i, isOnSale as j, getDiscountPercentage as k, getMarkupPercentage as l, getProductCurrency as m, categorizePaymentError as n, normalizePaymentResponse as o, parsePrice as p, normalizeStatusResponse as q, isPaymentStatusFailure as r, isPaymentStatusRequiresAction as s, isPaymentStatusSuccess as t, detectMobileMoneyProvider as u, type TaxInfo as v, type ProductWithPrice as w, type FormatCompactOptions as x };
@@ -0,0 +1,325 @@
1
+ import { s as PaymentErrorDetails, q as PaymentResponse, r as PaymentStatusResponse } from './payment-pjpfIKX8.mjs';
2
+
3
+ /**
4
+ * Price Types
5
+ *
6
+ * Types for price parsing, formatting, and display utilities.
7
+ */
8
+ /**
9
+ * Individual tax component (e.g., VAT, NHIL, GETFund)
10
+ */
11
+ interface TaxComponent {
12
+ /** Tax component name */
13
+ name: string;
14
+ /** Tax rate as percentage (e.g., 15.0 for 15%) */
15
+ rate: number;
16
+ }
17
+ /**
18
+ * Complete tax information from a pricing response
19
+ */
20
+ interface TaxInfo {
21
+ /** Total tax rate as percentage */
22
+ taxRate: number;
23
+ /** Calculated tax amount */
24
+ taxAmount: number;
25
+ /** Whether tax is included in the displayed price */
26
+ isInclusive: boolean;
27
+ /** Individual tax components that make up the total */
28
+ components: TaxComponent[];
29
+ }
30
+ /**
31
+ * Price information in snake_case format (as returned from backend)
32
+ * Used by components that work with raw API responses
33
+ */
34
+ interface PriceInfo {
35
+ /** Original price before markup/discount */
36
+ base_price: number;
37
+ /** Final price after all adjustments */
38
+ final_price: number;
39
+ /** Markup percentage if applicable */
40
+ markup_percentage?: number;
41
+ /** Markup amount if applicable */
42
+ markup_amount?: number;
43
+ /** Currency code (e.g., "GHS", "USD") */
44
+ currency?: string;
45
+ /** Tax information */
46
+ tax_info?: TaxInfo;
47
+ /** Decision path showing pricing adjustments */
48
+ decision_path?: string;
49
+ }
50
+ /**
51
+ * Minimal product shape for price utilities.
52
+ * Uses quote-aware `price_info` and plain numeric fallback fields.
53
+ */
54
+ interface ProductWithPrice {
55
+ /** Pre-parsed price info from backend */
56
+ price_info?: PriceInfo;
57
+ /** Final computed price in plain field form (if provided by API) */
58
+ final_price?: number | string | null;
59
+ /** Base/original price in plain field form */
60
+ base_price?: number | string | null;
61
+ /** Default/indicative price in plain field form */
62
+ default_price?: number | string | null;
63
+ /** Currency in plain field form */
64
+ currency?: string | null;
65
+ }
66
+ /**
67
+ * Options for price formatting functions
68
+ */
69
+ interface FormatPriceOptions {
70
+ /** Currency code (default: "GHS") */
71
+ currency?: string;
72
+ /** Locale for Intl.NumberFormat (default: "en-US") */
73
+ locale?: string;
74
+ /** Minimum fraction digits (default: 2) */
75
+ minimumFractionDigits?: number;
76
+ /** Maximum fraction digits (default: 2) */
77
+ maximumFractionDigits?: number;
78
+ }
79
+ /**
80
+ * Options for compact price formatting
81
+ */
82
+ interface FormatCompactOptions {
83
+ /** Currency code (default: "GHS") */
84
+ currency?: string;
85
+ /** Number of decimal places for compact notation (default: 1) */
86
+ decimals?: number;
87
+ }
88
+
89
+ /**
90
+ * Price Utilities
91
+ *
92
+ * Comprehensive utilities for parsing, formatting, and displaying prices.
93
+ * Handles quote-aware pricing fields, currency formatting, and product price helpers.
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * import {
98
+ * formatPrice,
99
+ * formatPriceCompact,
100
+ * isOnSale,
101
+ * getDiscountPercentage
102
+ * } from '@cimplify/sdk';
103
+ *
104
+ * // Format prices
105
+ * formatPrice(29.99, 'USD'); // "$29.99"
106
+ * formatPrice(29.99, 'GHS'); // "GH₵29.99"
107
+ * formatPriceCompact(1500000, 'USD'); // "$1.5M"
108
+ *
109
+ * // Check for discounts
110
+ * if (isOnSale(product)) {
111
+ * console.log(`${getDiscountPercentage(product)}% off!`);
112
+ * }
113
+ * ```
114
+ */
115
+
116
+ /**
117
+ * Currency code to symbol mapping
118
+ * Includes major world currencies and African currencies
119
+ */
120
+ declare const CURRENCY_SYMBOLS: Record<string, string>;
121
+ /**
122
+ * Get currency symbol for a currency code
123
+ * @param currencyCode - ISO 4217 currency code (e.g., "USD", "GHS")
124
+ * @returns Currency symbol or the code itself if not found
125
+ *
126
+ * @example
127
+ * getCurrencySymbol('USD') // "$"
128
+ * getCurrencySymbol('GHS') // "GH₵"
129
+ * getCurrencySymbol('XYZ') // "XYZ"
130
+ */
131
+ declare function getCurrencySymbol(currencyCode: string): string;
132
+ /**
133
+ * Format a number compactly with K/M/B suffixes
134
+ * @param value - Number to format
135
+ * @param decimals - Decimal places (default: 1)
136
+ * @returns Compact string representation
137
+ *
138
+ * @example
139
+ * formatNumberCompact(1234) // "1.2K"
140
+ * formatNumberCompact(1500000) // "1.5M"
141
+ * formatNumberCompact(2500000000) // "2.5B"
142
+ */
143
+ declare function formatNumberCompact(value: number, decimals?: number): string;
144
+ /**
145
+ * Format a price with locale-aware currency formatting
146
+ * Uses Intl.NumberFormat for proper localization
147
+ *
148
+ * @param amount - Price amount (number or string)
149
+ * @param currency - ISO 4217 currency code (default: "GHS")
150
+ * @param locale - BCP 47 locale string (default: "en-US")
151
+ * @returns Formatted price string
152
+ *
153
+ * @example
154
+ * formatPrice(29.99, 'USD') // "$29.99"
155
+ * formatPrice(29.99, 'GHS') // "GH₵29.99"
156
+ * formatPrice('29.99', 'EUR') // "€29.99"
157
+ * formatPrice(1234.56, 'USD', 'de-DE') // "1.234,56 $"
158
+ */
159
+ declare function formatPrice(amount: number | string, currency?: string, locale?: string): string;
160
+ /**
161
+ * Format a price with +/- sign for adjustments
162
+ * Useful for showing price changes, modifiers, or discounts
163
+ *
164
+ * @param amount - Adjustment amount (positive or negative)
165
+ * @param currency - ISO 4217 currency code (default: "GHS")
166
+ * @param locale - BCP 47 locale string (default: "en-US")
167
+ * @returns Formatted adjustment string with sign
168
+ *
169
+ * @example
170
+ * formatPriceAdjustment(5.00, 'USD') // "+$5.00"
171
+ * formatPriceAdjustment(-3.50, 'GHS') // "-GH₵3.50"
172
+ * formatPriceAdjustment(0, 'EUR') // "€0.00"
173
+ */
174
+ declare function formatPriceAdjustment(amount: number, currency?: string, locale?: string): string;
175
+ /**
176
+ * Format a price compactly for large numbers
177
+ * Uses K/M/B suffixes for thousands, millions, billions
178
+ *
179
+ * @param amount - Price amount (number or string)
180
+ * @param currency - ISO 4217 currency code (default: "GHS")
181
+ * @param decimals - Decimal places for compact notation (default: 1)
182
+ * @returns Compact formatted price
183
+ *
184
+ * @example
185
+ * formatPriceCompact(999, 'USD') // "$999.00"
186
+ * formatPriceCompact(1500, 'GHS') // "GH₵1.5K"
187
+ * formatPriceCompact(2500000, 'USD') // "$2.5M"
188
+ * formatPriceCompact(1200000000, 'EUR') // "€1.2B"
189
+ */
190
+ declare function formatPriceCompact(amount: number | string, currency?: string, decimals?: number): string;
191
+ /**
192
+ * Simple currency symbol + amount format
193
+ * Lighter alternative to formatPrice without Intl
194
+ *
195
+ * @param amount - Price amount (number or string)
196
+ * @param currency - ISO 4217 currency code (default: "GHS")
197
+ * @returns Simple formatted price
198
+ *
199
+ * @example
200
+ * formatMoney(29.99, 'USD') // "$29.99"
201
+ * formatMoney('15.00', 'GHS') // "GH₵15.00"
202
+ */
203
+ declare function formatMoney(amount: string | number, currency?: string): string;
204
+ /**
205
+ * Parse a price string or number to a numeric value
206
+ * Handles various input formats gracefully
207
+ *
208
+ * @param value - Value to parse (string, number, or undefined)
209
+ * @returns Parsed numeric value, or 0 if invalid
210
+ *
211
+ * @example
212
+ * parsePrice('29.99') // 29.99
213
+ * parsePrice(29.99) // 29.99
214
+ * parsePrice('$29.99') // 29.99 (strips non-numeric prefix)
215
+ * parsePrice(undefined) // 0
216
+ * parsePrice('invalid') // 0
217
+ */
218
+ declare function parsePrice(value: string | number | undefined | null): number;
219
+ /**
220
+ * Get the display price from a product.
221
+ * Prefers quote-aware price_info, then plain price fields.
222
+ *
223
+ * @param product - Product with price data
224
+ * @returns The final price to display
225
+ *
226
+ * @example
227
+ * const price = getDisplayPrice(product);
228
+ * console.log(formatPrice(price, 'GHS')); // "GH₵29.99"
229
+ */
230
+ declare function getDisplayPrice(product: ProductWithPrice): number;
231
+ /**
232
+ * Get the base price from a product (before markup/discount)
233
+ *
234
+ * @param product - Product with price data
235
+ * @returns The base price before adjustments
236
+ */
237
+ declare function getBasePrice(product: ProductWithPrice): number;
238
+ /**
239
+ * Check if a product is on sale (discounted)
240
+ *
241
+ * @param product - Product with price data
242
+ * @returns True if the final price is less than the base price
243
+ *
244
+ * @example
245
+ * if (isOnSale(product)) {
246
+ * return <Badge>Sale!</Badge>;
247
+ * }
248
+ */
249
+ declare function isOnSale(product: ProductWithPrice): boolean;
250
+ /**
251
+ * Get the discount percentage for a product on sale
252
+ *
253
+ * @param product - Product with price data
254
+ * @returns Discount percentage (0-100), or 0 if not on sale
255
+ *
256
+ * @example
257
+ * const discount = getDiscountPercentage(product);
258
+ * if (discount > 0) {
259
+ * return <Badge>{discount}% OFF</Badge>;
260
+ * }
261
+ */
262
+ declare function getDiscountPercentage(product: ProductWithPrice): number;
263
+ /**
264
+ * Get the markup percentage for a product
265
+ *
266
+ * @param product - Product with price data
267
+ * @returns Markup percentage, or 0 if no markup
268
+ */
269
+ declare function getMarkupPercentage(product: ProductWithPrice): number;
270
+ /**
271
+ * Get the currency for a product
272
+ *
273
+ * @param product - Product with price data
274
+ * @returns Currency code (default: "GHS")
275
+ */
276
+ declare function getProductCurrency(product: ProductWithPrice): string;
277
+ /**
278
+ * Format a product's display price
279
+ * Convenience function combining getDisplayPrice and formatPrice
280
+ *
281
+ * @param product - Product with price data
282
+ * @param locale - BCP 47 locale string (default: "en-US")
283
+ * @returns Formatted price string
284
+ *
285
+ * @example
286
+ * <span>{formatProductPrice(product)}</span> // "GH₵29.99"
287
+ */
288
+ declare function formatProductPrice(product: ProductWithPrice, locale?: string): string;
289
+
290
+ /**
291
+ * Categorize payment errors into user-friendly messages
292
+ */
293
+ declare function categorizePaymentError(error: Error, errorCode?: string): PaymentErrorDetails;
294
+ /**
295
+ * Normalize payment response from different formats into a standard PaymentResponse
296
+ */
297
+ declare function normalizePaymentResponse(response: unknown): PaymentResponse;
298
+ declare function isPaymentStatusSuccess(status: string | undefined): boolean;
299
+ declare function isPaymentStatusFailure(status: string | undefined): boolean;
300
+ declare function isPaymentStatusRequiresAction(status: string | undefined): boolean;
301
+ /**
302
+ * Normalize payment status response into a standard format
303
+ */
304
+ declare function normalizeStatusResponse(response: unknown): PaymentStatusResponse;
305
+ /** Mobile money provider display names */
306
+ declare const MOBILE_MONEY_PROVIDERS: {
307
+ readonly mtn: {
308
+ readonly name: "MTN Mobile Money";
309
+ readonly prefix: readonly ["024", "054", "055", "059"];
310
+ };
311
+ readonly vodafone: {
312
+ readonly name: "Vodafone Cash";
313
+ readonly prefix: readonly ["020", "050"];
314
+ };
315
+ readonly airtel: {
316
+ readonly name: "AirtelTigo Money";
317
+ readonly prefix: readonly ["027", "057", "026", "056"];
318
+ };
319
+ };
320
+ /**
321
+ * Detect mobile money provider from phone number
322
+ */
323
+ declare function detectMobileMoneyProvider(phoneNumber: string): "mtn" | "vodafone" | "airtel" | null;
324
+
325
+ export { CURRENCY_SYMBOLS as C, type FormatPriceOptions as F, MOBILE_MONEY_PROVIDERS as M, type PriceInfo as P, type TaxComponent as T, formatPriceAdjustment as a, formatPriceCompact as b, formatMoney as c, formatNumberCompact as d, formatProductPrice as e, formatPrice as f, getCurrencySymbol as g, getDisplayPrice as h, getBasePrice as i, isOnSale as j, getDiscountPercentage as k, getMarkupPercentage as l, getProductCurrency as m, categorizePaymentError as n, normalizePaymentResponse as o, parsePrice as p, normalizeStatusResponse as q, isPaymentStatusFailure as r, isPaymentStatusRequiresAction as s, isPaymentStatusSuccess as t, detectMobileMoneyProvider as u, type TaxInfo as v, type ProductWithPrice as w, type FormatCompactOptions as x };