@cimplify/sdk 0.6.11 → 0.6.12

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,1133 @@
1
+ declare const __money: unique symbol;
2
+ /** Decimal monetary amount as a string (e.g. "29.99"). Branded to prevent mixing with plain strings. */
3
+ type Money = string & {
4
+ readonly [__money]: true;
5
+ };
6
+ /** Create a Money value from a string decimal. */
7
+ declare function money(value: string): Money;
8
+ /** Create a Money value from a number. Converts to a 2-decimal string. */
9
+ declare function moneyFromNumber(value: number): Money;
10
+ /** Zero money constant. */
11
+ declare const ZERO: Money;
12
+ /** ISO 4217 currency codes supported by the platform */
13
+ type CurrencyCode = "USD" | "EUR" | "GBP" | "JPY" | "CNY" | "CHF" | "CAD" | "AUD" | "GHS" | "NGN" | "KES" | "ZAR" | "XOF" | "XAF" | "EGP" | "TZS" | "UGX" | "RWF" | "ETB" | "ZMW" | "BWP" | "MUR" | "NAD" | "MWK" | "AOA" | "CDF" | "GMD" | "GNF" | "LRD" | "SLL" | "MZN" | "BIF" | "INR" | "BRL" | "MXN" | "KRW" | "TRY" | "THB" | "MYR" | "PHP" | "IDR" | "VND" | "SGD" | "HKD" | "TWD" | "AED" | "SAR" | "ILS";
14
+ /** Assert a string as CurrencyCode at API boundaries. */
15
+ declare function currencyCode(value: string): CurrencyCode;
16
+ /**
17
+ * @deprecated Use `CurrencyCode` instead. Kept for backward compatibility.
18
+ */
19
+ type Currency = CurrencyCode;
20
+ /** Pagination parameters */
21
+ interface PaginationParams {
22
+ page?: number;
23
+ limit?: number;
24
+ offset?: number;
25
+ }
26
+ /** Pagination metadata in response */
27
+ interface Pagination {
28
+ total_count: number;
29
+ current_page: number;
30
+ page_size: number;
31
+ total_pages: number;
32
+ has_more: boolean;
33
+ next_cursor?: string;
34
+ }
35
+ /** Strongly-typed error codes for better DX */
36
+ declare const ErrorCode: {
37
+ readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
38
+ readonly NETWORK_ERROR: "NETWORK_ERROR";
39
+ readonly TIMEOUT: "TIMEOUT";
40
+ readonly UNAUTHORIZED: "UNAUTHORIZED";
41
+ readonly FORBIDDEN: "FORBIDDEN";
42
+ readonly NOT_FOUND: "NOT_FOUND";
43
+ readonly VALIDATION_ERROR: "VALIDATION_ERROR";
44
+ readonly CART_EMPTY: "CART_EMPTY";
45
+ readonly CART_EXPIRED: "CART_EXPIRED";
46
+ readonly CART_NOT_FOUND: "CART_NOT_FOUND";
47
+ readonly ITEM_UNAVAILABLE: "ITEM_UNAVAILABLE";
48
+ readonly VARIANT_NOT_FOUND: "VARIANT_NOT_FOUND";
49
+ readonly VARIANT_OUT_OF_STOCK: "VARIANT_OUT_OF_STOCK";
50
+ readonly ADDON_REQUIRED: "ADDON_REQUIRED";
51
+ readonly ADDON_MAX_EXCEEDED: "ADDON_MAX_EXCEEDED";
52
+ readonly CHECKOUT_VALIDATION_FAILED: "CHECKOUT_VALIDATION_FAILED";
53
+ readonly DELIVERY_ADDRESS_REQUIRED: "DELIVERY_ADDRESS_REQUIRED";
54
+ readonly CUSTOMER_INFO_REQUIRED: "CUSTOMER_INFO_REQUIRED";
55
+ readonly QUOTE_NOT_FOUND: "QUOTE_NOT_FOUND";
56
+ readonly QUOTE_EXPIRED: "QUOTE_EXPIRED";
57
+ readonly QUOTE_CONSUMED: "QUOTE_CONSUMED";
58
+ readonly QUOTE_STORAGE_UNAVAILABLE: "QUOTE_STORAGE_UNAVAILABLE";
59
+ readonly PAYMENT_FAILED: "PAYMENT_FAILED";
60
+ readonly PAYMENT_CANCELLED: "PAYMENT_CANCELLED";
61
+ readonly INSUFFICIENT_FUNDS: "INSUFFICIENT_FUNDS";
62
+ readonly CARD_DECLINED: "CARD_DECLINED";
63
+ readonly INVALID_OTP: "INVALID_OTP";
64
+ readonly OTP_EXPIRED: "OTP_EXPIRED";
65
+ readonly AUTHORIZATION_FAILED: "AUTHORIZATION_FAILED";
66
+ readonly PAYMENT_ACTION_NOT_COMPLETED: "PAYMENT_ACTION_NOT_COMPLETED";
67
+ readonly SLOT_UNAVAILABLE: "SLOT_UNAVAILABLE";
68
+ readonly BOOKING_CONFLICT: "BOOKING_CONFLICT";
69
+ readonly SERVICE_NOT_FOUND: "SERVICE_NOT_FOUND";
70
+ readonly OUT_OF_STOCK: "OUT_OF_STOCK";
71
+ readonly INSUFFICIENT_QUANTITY: "INSUFFICIENT_QUANTITY";
72
+ };
73
+ type ErrorCodeType = (typeof ErrorCode)[keyof typeof ErrorCode];
74
+ /** API error structure */
75
+ interface ApiError {
76
+ code: string;
77
+ message: string;
78
+ retryable: boolean;
79
+ }
80
+ interface ErrorHint {
81
+ docs_url: string;
82
+ suggestion: string;
83
+ }
84
+ declare const ERROR_HINTS: Record<string, ErrorHint>;
85
+ /**
86
+ * Custom error class for SDK errors with typed error codes.
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * try {
91
+ * await client.cart.addItem({ item_id: "prod_123" });
92
+ * } catch (error) {
93
+ * if (isCimplifyError(error)) {
94
+ * switch (error.code) {
95
+ * case ErrorCode.ITEM_UNAVAILABLE:
96
+ * toast.error("This item is no longer available");
97
+ * break;
98
+ * case ErrorCode.VARIANT_OUT_OF_STOCK:
99
+ * toast.error("Selected option is out of stock");
100
+ * break;
101
+ * default:
102
+ * toast.error(error.message);
103
+ * }
104
+ * }
105
+ * }
106
+ * ```
107
+ */
108
+ declare class CimplifyError extends Error {
109
+ code: string;
110
+ retryable: boolean;
111
+ docs_url?: string | undefined;
112
+ suggestion?: string | undefined;
113
+ constructor(code: string, message: string, retryable?: boolean, docs_url?: string | undefined, suggestion?: string | undefined);
114
+ /** User-friendly message safe to display */
115
+ get userMessage(): string;
116
+ }
117
+ /** Type guard for CimplifyError */
118
+ declare function isCimplifyError(error: unknown): error is CimplifyError;
119
+ declare function getErrorHint(code: string): ErrorHint | undefined;
120
+ declare function enrichError(error: CimplifyError, options?: {
121
+ isTestMode?: boolean;
122
+ }): CimplifyError;
123
+ /** Check if error is retryable */
124
+ declare function isRetryableError(error: unknown): boolean;
125
+
126
+ type ProductType = "product" | "service" | "digital" | "bundle" | "composite";
127
+ type ProductRenderHint = "food" | "physical" | "general";
128
+ type InventoryType = "one_to_one" | "composition" | "none";
129
+ type VariantStrategy = "fetch_all" | "use_axes";
130
+ type DigitalProductType = "download" | "license_key" | "ticket" | "access_grant" | "redemption_code";
131
+ type DepositType = "none" | "fixed" | "percentage";
132
+ type SalesChannel = "pos" | "online" | "marketplace" | "partners";
133
+ interface Product {
134
+ id: string;
135
+ business_id: string;
136
+ category_id?: string;
137
+ name: string;
138
+ slug: string;
139
+ description?: string;
140
+ image_url?: string;
141
+ default_price: Money;
142
+ /** Salesman tagged-union discriminant on catalogue browse responses. */
143
+ type?: ProductType;
144
+ product_type: ProductType;
145
+ /** Server-derived UI hint for conditional rendering. */
146
+ render_hint?: ProductRenderHint;
147
+ inventory_type: InventoryType;
148
+ variant_strategy: VariantStrategy;
149
+ is_active: boolean;
150
+ created_at: string;
151
+ updated_at: string;
152
+ metadata?: Record<string, unknown>;
153
+ tags?: string[];
154
+ images?: string[];
155
+ calories?: number;
156
+ allergies?: string[];
157
+ recipe?: Record<string, unknown>;
158
+ sku?: string;
159
+ barcode?: string;
160
+ ean?: string;
161
+ upc?: string;
162
+ is_trackable?: boolean;
163
+ is_tracked?: boolean;
164
+ is_tracked_in_store?: boolean;
165
+ is_tracked_in_warehouse?: boolean;
166
+ inventory_threshold?: number;
167
+ external_id?: string;
168
+ external_source?: string;
169
+ download_url?: string;
170
+ digital_type?: DigitalProductType;
171
+ max_downloads?: number;
172
+ license_key_required?: boolean;
173
+ file_size_mb?: number;
174
+ file_hash?: string;
175
+ file_type?: string;
176
+ version?: string;
177
+ download_expires_days?: number;
178
+ license_key_format?: string;
179
+ max_activations?: number;
180
+ validity_days?: number;
181
+ event_id?: string;
182
+ event_date?: string;
183
+ venue?: string;
184
+ ticket_type?: string;
185
+ seat_info?: Record<string, unknown>;
186
+ access_type?: string;
187
+ access_level?: string;
188
+ access_duration_days?: number;
189
+ code_type?: string;
190
+ code_value?: Money;
191
+ code_currency?: CurrencyCode;
192
+ duration_minutes?: number;
193
+ preparation_time_minutes?: number;
194
+ staff_required_count?: number;
195
+ buffer_before_minutes?: number;
196
+ buffer_after_minutes?: number;
197
+ general_service_capacity?: number;
198
+ deposit_type?: DepositType;
199
+ deposit_amount?: Money;
200
+ cancellation_window_minutes?: number;
201
+ no_show_fee?: Money;
202
+ requires_specific_staff?: boolean;
203
+ requires_specific_resource?: boolean;
204
+ hs_code?: string;
205
+ mid_code?: string;
206
+ material?: string;
207
+ allow_backorder?: boolean;
208
+ item_condition?: string;
209
+ vendor?: string;
210
+ length_mm?: number;
211
+ width_mm?: number;
212
+ height_mm?: number;
213
+ channels?: SalesChannel[];
214
+ meta_title?: string;
215
+ meta_description?: string;
216
+ is_discountable?: boolean;
217
+ taxonomy_id?: string;
218
+ }
219
+ interface ProductWithDetails extends Product {
220
+ category?: Category;
221
+ variants?: ProductVariant[];
222
+ add_ons?: AddOnWithOptions[];
223
+ variant_axes?: VariantAxisWithValues[];
224
+ location_prices?: LocationProductPrice[];
225
+ location_availability?: ProductAvailability[];
226
+ time_profiles?: ProductTimeProfile[];
227
+ }
228
+ interface ProductVariant {
229
+ id: string;
230
+ name: string;
231
+ business_id: string;
232
+ product_id: string;
233
+ component_multiplier: Money;
234
+ price_adjustment: Money;
235
+ is_default: boolean;
236
+ created_at: string;
237
+ updated_at: string;
238
+ is_active?: boolean;
239
+ is_archived?: boolean;
240
+ is_deleted?: boolean;
241
+ inventory_threshold?: number;
242
+ images?: string[];
243
+ external_id?: string;
244
+ external_source?: string;
245
+ ean?: string;
246
+ upc?: string;
247
+ is_trackable?: boolean;
248
+ is_tracked?: boolean;
249
+ is_tracked_in_store?: boolean;
250
+ is_tracked_in_warehouse?: boolean;
251
+ sku?: string;
252
+ barcode?: string;
253
+ download_url?: string;
254
+ metadata?: Record<string, unknown>;
255
+ duration_minutes?: number;
256
+ max_downloads?: number;
257
+ license_key?: string;
258
+ display_attributes?: VariantDisplayAttribute[];
259
+ }
260
+ interface VariantDisplayAttribute {
261
+ axis_id: string;
262
+ axis_name: string;
263
+ value_id: string;
264
+ value_name: string;
265
+ }
266
+ interface VariantAxis {
267
+ id: string;
268
+ business_id: string;
269
+ product_id: string;
270
+ name: string;
271
+ display_order: number;
272
+ affects_recipe: boolean;
273
+ created_at: string;
274
+ updated_at: string;
275
+ metadata?: Record<string, unknown>;
276
+ }
277
+ interface VariantAxisWithValues extends VariantAxis {
278
+ values: VariantAxisValue[];
279
+ }
280
+ interface VariantAxisValue {
281
+ id: string;
282
+ business_id: string;
283
+ axis_id: string;
284
+ name: string;
285
+ display_order: number;
286
+ created_at: string;
287
+ updated_at: string;
288
+ metadata?: Record<string, unknown>;
289
+ }
290
+ interface ProductVariantValue {
291
+ variant_id: string;
292
+ axis_value_id: string;
293
+ business_id: string;
294
+ created_at: string;
295
+ updated_at: string;
296
+ metadata?: Record<string, unknown>;
297
+ }
298
+ interface VariantLocationAvailability {
299
+ id: string;
300
+ variant_id: string;
301
+ location_id: string;
302
+ business_id: string;
303
+ is_available: boolean;
304
+ is_in_stock: boolean;
305
+ created_at: string;
306
+ updated_at: string;
307
+ metadata?: Record<string, unknown>;
308
+ }
309
+ /** Input for selecting a variant by axis values */
310
+ interface VariantAxisSelection {
311
+ [axisName: string]: string;
312
+ }
313
+ interface AddOn {
314
+ id: string;
315
+ business_id: string;
316
+ name: string;
317
+ is_multiple_allowed: boolean;
318
+ is_required: boolean;
319
+ is_mutually_exclusive: boolean;
320
+ min_selections?: number;
321
+ max_selections?: number;
322
+ created_at: string;
323
+ updated_at: string;
324
+ metadata?: Record<string, unknown>;
325
+ }
326
+ interface AddOnWithOptions extends AddOn {
327
+ options: AddOnOption[];
328
+ }
329
+ interface AddOnOption {
330
+ id: string;
331
+ add_on_id: string;
332
+ business_id: string;
333
+ name: string;
334
+ option_sku?: string;
335
+ default_price?: Money;
336
+ description?: string;
337
+ is_required: boolean;
338
+ is_mutually_exclusive: boolean;
339
+ created_at: string;
340
+ updated_at: string;
341
+ metadata?: Record<string, unknown>;
342
+ }
343
+ interface AddOnOptionPrice {
344
+ id: string;
345
+ add_on_option_id: string;
346
+ location_id: string;
347
+ business_id: string;
348
+ price: Money;
349
+ created_at: string;
350
+ updated_at: string;
351
+ metadata?: Record<string, unknown>;
352
+ }
353
+ interface ProductAddOn {
354
+ id: string;
355
+ business_id: string;
356
+ product_id: string;
357
+ add_on_id: string;
358
+ created_at: string;
359
+ updated_at: string;
360
+ metadata?: Record<string, unknown>;
361
+ }
362
+ interface Category {
363
+ id: string;
364
+ business_id: string;
365
+ name: string;
366
+ slug: string;
367
+ description?: string;
368
+ created_at: string;
369
+ updated_at: string;
370
+ metadata?: Record<string, unknown>;
371
+ }
372
+ interface CategorySummary extends Category {
373
+ product_count: number;
374
+ }
375
+ interface Collection {
376
+ id: string;
377
+ business_id: string;
378
+ name: string;
379
+ slug: string;
380
+ description?: string;
381
+ tags?: string[];
382
+ image_url?: string;
383
+ channels?: SalesChannel[];
384
+ created_at: string;
385
+ updated_at: string;
386
+ metadata?: Record<string, unknown>;
387
+ }
388
+ interface CollectionSummary extends Collection {
389
+ product_count: number;
390
+ }
391
+ interface CollectionProduct {
392
+ id: string;
393
+ collection_id: string;
394
+ product_id: string;
395
+ display_order?: number;
396
+ created_at: string;
397
+ updated_at: string;
398
+ metadata?: Record<string, unknown>;
399
+ }
400
+ type BundlePriceType = "fixed" | "percentage_discount" | "fixed_discount";
401
+ interface Bundle {
402
+ id: string;
403
+ business_id: string;
404
+ product_id: string;
405
+ name: string;
406
+ slug: string;
407
+ description?: string;
408
+ image_url?: string;
409
+ pricing_type: BundlePriceType;
410
+ bundle_price?: Money;
411
+ discount_value?: Money;
412
+ created_at: string;
413
+ updated_at: string;
414
+ metadata?: Record<string, unknown>;
415
+ }
416
+ interface BundleSummary extends Bundle {
417
+ product_count: number;
418
+ }
419
+ interface BundleProduct {
420
+ id: string;
421
+ bundle_id: string;
422
+ product_id: string;
423
+ variant_id?: string;
424
+ allow_variant_choice: boolean;
425
+ quantity: number;
426
+ created_at: string;
427
+ updated_at: string;
428
+ metadata?: Record<string, unknown>;
429
+ }
430
+ interface BundleWithDetails extends Bundle {
431
+ product: Product;
432
+ components: BundleComponentData[];
433
+ schedules?: ProductTimeProfile[];
434
+ availability?: Record<string, ProductAvailability>;
435
+ }
436
+ interface BundleComponentData {
437
+ component: BundleProduct;
438
+ product: Product;
439
+ variants: ProductVariant[];
440
+ variant_axes: VariantAxis[];
441
+ variant_axis_values: VariantAxisValue[];
442
+ product_variant_values: ProductVariantValue[];
443
+ }
444
+ interface BundleComponentInfo {
445
+ id: string;
446
+ product_id: string;
447
+ variant_id?: string;
448
+ quantity: number;
449
+ }
450
+ type CompositePricingMode = "additive" | "highest_per_group" | "highest_overall" | "tiered";
451
+ type GroupPricingBehavior = "additive" | "first_n_free" | "flat_fee" | "highest_only";
452
+ type ComponentSourceType = "product" | "stock" | "add_on" | "standalone";
453
+ interface Composite {
454
+ id: string;
455
+ business_id: string;
456
+ product_id: string;
457
+ base_price: Money;
458
+ pricing_mode: CompositePricingMode;
459
+ min_order_quantity?: number;
460
+ max_order_quantity?: number;
461
+ created_at: string;
462
+ updated_at: string;
463
+ metadata?: Record<string, unknown>;
464
+ }
465
+ interface CompositeWithDetails extends Composite {
466
+ product: Product;
467
+ groups: ComponentGroupWithComponents[];
468
+ }
469
+ interface ComponentGroup {
470
+ id: string;
471
+ composite_id: string;
472
+ name: string;
473
+ description?: string;
474
+ display_order: number;
475
+ min_selections: number;
476
+ max_selections?: number;
477
+ allow_quantity: boolean;
478
+ max_quantity_per_component?: number;
479
+ pricing_behavior: GroupPricingBehavior;
480
+ pricing_behavior_config?: Record<string, unknown>;
481
+ icon?: string;
482
+ color?: string;
483
+ created_at: string;
484
+ updated_at: string;
485
+ }
486
+ interface ComponentGroupWithComponents extends ComponentGroup {
487
+ components: CompositeComponent[];
488
+ }
489
+ interface CompositeComponent {
490
+ id: string;
491
+ group_id: string;
492
+ product_id?: string;
493
+ variant_id?: string;
494
+ stock_id?: string;
495
+ add_on_id?: string;
496
+ add_on_option_id?: string;
497
+ display_name?: string;
498
+ display_description?: string;
499
+ display_image_url?: string;
500
+ price: Money;
501
+ price_per_additional?: Money;
502
+ quantity_per_selection?: Money;
503
+ waste_percentage?: Money;
504
+ calories?: number;
505
+ allergens?: string[];
506
+ display_order: number;
507
+ is_popular: boolean;
508
+ is_premium: boolean;
509
+ is_available: boolean;
510
+ is_archived: boolean;
511
+ created_at: string;
512
+ updated_at: string;
513
+ }
514
+ /** Input for calculating composite price or adding to cart */
515
+ interface ComponentSelectionInput {
516
+ component_id: string;
517
+ quantity: number;
518
+ variant_id?: string;
519
+ add_on_option_id?: string;
520
+ }
521
+ /** Result of composite price calculation */
522
+ interface CompositePriceResult {
523
+ base_price: Money;
524
+ components_total: Money;
525
+ tier_applied?: string;
526
+ final_price: Money;
527
+ breakdown: ComponentPriceBreakdown[];
528
+ }
529
+ interface ComponentPriceBreakdown {
530
+ component_id: string;
531
+ component_name: string;
532
+ quantity: number;
533
+ unit_price: Money;
534
+ total_price: Money;
535
+ group_id: string;
536
+ source_type: ComponentSourceType;
537
+ source_product_id?: string;
538
+ source_stock_id?: string;
539
+ }
540
+ type PriceEntryType = "base" | "location" | "time" | "channel";
541
+ interface Price {
542
+ id: string;
543
+ product_id: string;
544
+ location_id: string;
545
+ business_id: string;
546
+ price: Money;
547
+ entry_type: PriceEntryType;
548
+ created_at: string;
549
+ updated_at: string;
550
+ metadata?: Record<string, unknown>;
551
+ }
552
+ type LocationProductPrice = Price;
553
+ interface ProductAvailability {
554
+ id: string;
555
+ business_id: string;
556
+ location_id: string;
557
+ product_id: string;
558
+ is_available: boolean;
559
+ is_in_stock: boolean;
560
+ created_at: string;
561
+ updated_at: string;
562
+ metadata?: Record<string, unknown>;
563
+ }
564
+ interface ProductTimeProfile {
565
+ id: string;
566
+ business_id: string;
567
+ product_id: string;
568
+ day_of_week: number;
569
+ start_time: string;
570
+ end_time: string;
571
+ created_at: string;
572
+ updated_at: string;
573
+ metadata?: Record<string, unknown>;
574
+ }
575
+
576
+ type CartStatus = "active" | "converting" | "converted" | "expired" | "abandoned";
577
+ type CartChannel = "qr" | "taker" | "staff" | "web" | "dashboard";
578
+ type PriceSource = {
579
+ type: "default_item";
580
+ } | {
581
+ type: "location_specific";
582
+ location_id: string;
583
+ } | {
584
+ type: "variant";
585
+ variant_id: string;
586
+ } | {
587
+ type: "composite";
588
+ composite_id: string;
589
+ } | {
590
+ type: "custom";
591
+ };
592
+ type AdjustmentType = {
593
+ type: "location_based";
594
+ location_id: string;
595
+ } | {
596
+ type: "variant_based";
597
+ variant_id: string;
598
+ } | {
599
+ type: "time_based";
600
+ } | {
601
+ type: "customer_segment";
602
+ segment_id: string;
603
+ } | {
604
+ type: "customer_loyalty";
605
+ tier: string;
606
+ } | {
607
+ type: "channel_markup";
608
+ channel: string;
609
+ } | {
610
+ type: "discount";
611
+ discount_id: string;
612
+ } | {
613
+ type: "bundle";
614
+ bundle_id: string;
615
+ } | {
616
+ type: "manual";
617
+ reason: string;
618
+ } | {
619
+ type: "time_limited_promotion";
620
+ promotion_id: string;
621
+ valid_until: string;
622
+ };
623
+ interface PriceAdjustment {
624
+ adjustment_type: AdjustmentType;
625
+ amount: Money;
626
+ percentage?: Money;
627
+ reason: string;
628
+ applied_at: string;
629
+ }
630
+ interface TaxPathComponent {
631
+ name: string;
632
+ rate: Money;
633
+ }
634
+ interface PricePathTaxInfo {
635
+ tax_rate: Money;
636
+ tax_amount: Money;
637
+ is_inclusive: boolean;
638
+ components: TaxPathComponent[];
639
+ }
640
+ interface PriceDecisionPath {
641
+ base_price_source: PriceSource;
642
+ adjustments: PriceAdjustment[];
643
+ context?: Record<string, unknown>;
644
+ }
645
+ interface ChosenPrice {
646
+ base_price: Money;
647
+ final_price: Money;
648
+ markup_percentage: Money;
649
+ markup_amount: Money;
650
+ markup_discount_percentage: Money;
651
+ markup_discount_amount: Money;
652
+ currency?: CurrencyCode;
653
+ custom_fields?: Record<string, unknown>;
654
+ decision_path?: PriceDecisionPath;
655
+ tax_info?: PricePathTaxInfo;
656
+ }
657
+ type BenefitType = "percentage" | "fixed_amount" | "free_item" | "buy_x_get_y";
658
+ interface AppliedDiscount {
659
+ discount_id: string;
660
+ discount_code?: string;
661
+ discount_type: BenefitType;
662
+ discount_value: Money;
663
+ discount_amount: Money;
664
+ applied_at: string;
665
+ }
666
+ interface DiscountBreakdown {
667
+ item_discounts: Record<string, AppliedDiscount[]>;
668
+ order_discounts: AppliedDiscount[];
669
+ }
670
+ interface DiscountDetails {
671
+ discounts: AppliedDiscount[];
672
+ total_discount_amount: Money;
673
+ breakdown: DiscountBreakdown;
674
+ }
675
+ interface SelectedAddOnOption {
676
+ option_id: string;
677
+ add_on_id: string;
678
+ name: string;
679
+ price: Money;
680
+ quantity: number;
681
+ is_required: boolean;
682
+ selected_at: string;
683
+ price_info?: ChosenPrice;
684
+ }
685
+ interface AddOnDetails {
686
+ selected_options: SelectedAddOnOption[];
687
+ total_add_on_price: Money;
688
+ add_ons: CartAddOn[];
689
+ }
690
+ interface CartAddOn {
691
+ add_on_id: string;
692
+ name: string;
693
+ min_selections: number;
694
+ max_selections: number;
695
+ selected_options: string[];
696
+ is_required: boolean;
697
+ }
698
+ interface VariantDetails {
699
+ variant_id: string;
700
+ sku?: string;
701
+ properties: Record<string, string>;
702
+ }
703
+ interface BundleSelectionInput {
704
+ component_id: string;
705
+ variant_id?: string;
706
+ quantity: number;
707
+ }
708
+ interface BundleStoredSelection {
709
+ component_id: string;
710
+ product_id: string;
711
+ product_name: string;
712
+ variant_id?: string;
713
+ variant_name?: string;
714
+ quantity: number;
715
+ unit_price: Money;
716
+ }
717
+ interface BundleSelectionData {
718
+ bundle_id: string;
719
+ selections: BundleStoredSelection[];
720
+ }
721
+ interface CompositeStoredSelection {
722
+ component_id: string;
723
+ component_name: string;
724
+ quantity: number;
725
+ group_id: string;
726
+ source_type: "product" | "stock" | "add_on" | "standalone";
727
+ source_product_id?: string;
728
+ source_stock_id?: string;
729
+ unit_price: Money;
730
+ }
731
+ interface CompositePriceBreakdown {
732
+ base_price: Money;
733
+ components_total: Money;
734
+ tier_applied?: string;
735
+ final_price: Money;
736
+ }
737
+ interface CompositeSelectionData {
738
+ composite_id: string;
739
+ selections: CompositeStoredSelection[];
740
+ breakdown: CompositePriceBreakdown;
741
+ }
742
+
743
+ type LineConfiguration = {
744
+ type: "simple";
745
+ variant?: VariantDetails;
746
+ add_ons?: AddOnDetails;
747
+ } | {
748
+ type: "service";
749
+ variant?: VariantDetails;
750
+ add_ons?: AddOnDetails;
751
+ scheduled_start?: string;
752
+ scheduled_end?: string;
753
+ confirmation_code?: string;
754
+ service_status?: string;
755
+ primary_staff_id?: string;
756
+ scheduling_metadata?: Record<string, unknown>;
757
+ } | {
758
+ type: "bundle";
759
+ variant?: VariantDetails;
760
+ input: BundleSelectionInput[];
761
+ resolved?: BundleSelectionData;
762
+ add_ons?: AddOnDetails;
763
+ } | {
764
+ type: "composite";
765
+ variant?: VariantDetails;
766
+ input: ComponentSelectionInput[];
767
+ resolved?: CompositeSelectionData;
768
+ add_ons?: AddOnDetails;
769
+ } | {
770
+ type: "digital";
771
+ variant?: VariantDetails;
772
+ add_ons?: AddOnDetails;
773
+ digital_type?: string;
774
+ fulfillment_id?: string;
775
+ };
776
+ interface Cart {
777
+ id: string;
778
+ business_id: string;
779
+ customer_id?: string;
780
+ session_id?: string;
781
+ location_id?: string;
782
+ created_at: string;
783
+ updated_at: string;
784
+ expires_at: string;
785
+ subtotal: Money;
786
+ tax_amount: Money;
787
+ service_charge: Money;
788
+ total_discounts: Money;
789
+ total_price: Money;
790
+ total_items: number;
791
+ tax_rate?: Money;
792
+ service_charge_rate?: Money;
793
+ price_info: ChosenPrice;
794
+ applied_discount_ids: string[];
795
+ applied_discount_codes: string[];
796
+ discount_details?: DiscountDetails;
797
+ currency: CurrencyCode;
798
+ customer_name?: string;
799
+ customer_email?: string;
800
+ customer_phone?: string;
801
+ customer_address?: string;
802
+ source: string;
803
+ status: CartStatus;
804
+ channel: string;
805
+ order_id?: string;
806
+ metadata?: Record<string, unknown>;
807
+ items: CartItem[];
808
+ }
809
+ interface CartItem {
810
+ id: string;
811
+ cart_id: string;
812
+ item_id: string;
813
+ quantity: number;
814
+ line_key: string;
815
+ configuration: LineConfiguration;
816
+ price: Money;
817
+ add_ons_price: Money;
818
+ price_info: ChosenPrice;
819
+ applied_discount_ids: string[];
820
+ item_discount_amount: Money;
821
+ discount_details?: DiscountDetails;
822
+ created_at: string;
823
+ updated_at: string;
824
+ metadata?: Record<string, unknown>;
825
+ }
826
+ interface CartTotals {
827
+ subtotal: Money;
828
+ tax_amount: Money;
829
+ service_charge: Money;
830
+ total_discounts: Money;
831
+ total_price: Money;
832
+ tax_rate?: Money;
833
+ service_charge_rate?: Money;
834
+ applied_discount_ids: string[];
835
+ applied_discount_codes: string[];
836
+ discount_details?: DiscountDetails;
837
+ }
838
+ interface DisplayCart {
839
+ id: string;
840
+ business_id: string;
841
+ customer_id?: string;
842
+ session_id?: string;
843
+ location_id?: string;
844
+ subtotal: Money;
845
+ tax_amount: Money;
846
+ service_charge: Money;
847
+ total_discounts: Money;
848
+ total_price: Money;
849
+ total_items: number;
850
+ tax_rate?: Money;
851
+ service_charge_rate?: Money;
852
+ currency: CurrencyCode;
853
+ channel: string;
854
+ status: string;
855
+ business_name: string;
856
+ business_logo?: string;
857
+ location_name?: string;
858
+ customer_name?: string;
859
+ customer_email?: string;
860
+ customer_phone?: string;
861
+ customer_address?: string;
862
+ items: DisplayCartItem[];
863
+ applied_discount_codes: string[];
864
+ discount_details?: DiscountDetails;
865
+ }
866
+ interface DisplayCartItem {
867
+ id: string;
868
+ cart_id: string;
869
+ item_id: string;
870
+ quantity: number;
871
+ name: string;
872
+ description?: string;
873
+ image_url?: string;
874
+ category_name?: string;
875
+ is_available: boolean;
876
+ preparation_time?: number;
877
+ unit_price: Money;
878
+ total_price: Money;
879
+ add_ons_price: Money;
880
+ price_info: ChosenPrice;
881
+ item_discount_amount: Money;
882
+ discount_details?: DiscountDetails;
883
+ add_ons: DisplayAddOn[];
884
+ special_instructions?: string;
885
+ }
886
+ interface DisplayAddOn {
887
+ id: string;
888
+ name: string;
889
+ min_selections: number;
890
+ max_selections: number;
891
+ is_required: boolean;
892
+ selected_options: DisplayAddOnOption[];
893
+ }
894
+ interface DisplayAddOnOption {
895
+ id: string;
896
+ name: string;
897
+ price: Money;
898
+ quantity: number;
899
+ image_url?: string;
900
+ description?: string;
901
+ }
902
+ interface UICartBusiness {
903
+ name: string;
904
+ logo_url?: string;
905
+ contact_email?: string;
906
+ contact_phone?: string;
907
+ }
908
+ interface UICartLocation {
909
+ id?: string;
910
+ name?: string;
911
+ }
912
+ interface UICartCustomer {
913
+ id?: string;
914
+ name?: string;
915
+ email?: string;
916
+ phone?: string;
917
+ address?: string;
918
+ }
919
+ interface UICartPricing {
920
+ subtotal: Money;
921
+ tax_amount: Money;
922
+ service_charge: Money;
923
+ total_discounts: Money;
924
+ total_price: Money;
925
+ tax_rate?: Money;
926
+ service_charge_rate?: Money;
927
+ currency: CurrencyCode;
928
+ }
929
+ interface AddOnOptionDetails {
930
+ id: string;
931
+ name: string;
932
+ price?: Money;
933
+ is_required: boolean;
934
+ description?: string;
935
+ image_url?: string;
936
+ }
937
+ interface AddOnGroupDetails {
938
+ id: string;
939
+ name: string;
940
+ is_multiple_allowed: boolean;
941
+ min_selections: number;
942
+ max_selections: number;
943
+ required: boolean;
944
+ options: AddOnOptionDetails[];
945
+ }
946
+ interface VariantDetailsDTO {
947
+ id: string;
948
+ name: string;
949
+ price: Money;
950
+ price_adjustment: Money;
951
+ is_default: boolean;
952
+ }
953
+ interface CartItemDetails {
954
+ id: string;
955
+ cart_id: string;
956
+ item_id: string;
957
+ quantity: number;
958
+ line_key: string;
959
+ line_type: "simple" | "service" | "bundle" | "composite" | "digital";
960
+ name: string;
961
+ description?: string;
962
+ image_url?: string;
963
+ category_id?: string;
964
+ category_name?: string;
965
+ is_available: boolean;
966
+ variant_id?: string;
967
+ variant_details?: VariantDetails;
968
+ variant_name?: string;
969
+ variant_info?: VariantDetailsDTO;
970
+ base_price: Money;
971
+ add_ons_price: Money;
972
+ total_price: Money;
973
+ item_discount_amount: Money;
974
+ price_info: ChosenPrice;
975
+ add_on_option_ids: string[];
976
+ add_on_ids: string[];
977
+ add_on_details: AddOnDetails;
978
+ add_on_options: AddOnOptionDetails[];
979
+ add_ons: AddOnGroupDetails[];
980
+ special_instructions?: string;
981
+ scheduled_start?: string;
982
+ scheduled_end?: string;
983
+ confirmation_code?: string;
984
+ service_status?: string;
985
+ staff_id?: string;
986
+ scheduling_metadata?: Record<string, unknown>;
987
+ bundle_selections?: BundleSelectionInput[];
988
+ bundle_resolved?: BundleSelectionData;
989
+ composite_selections?: ComponentSelectionInput[];
990
+ composite_resolved?: CompositeSelectionData;
991
+ applied_discount_ids: string[];
992
+ discount_details?: DiscountDetails;
993
+ created_at: string;
994
+ updated_at: string;
995
+ metadata?: Record<string, unknown>;
996
+ }
997
+ /** Enriched cart returned by cart#enriched - matches cart_dto.rs UICart */
998
+ interface UICart {
999
+ id: string;
1000
+ business_id: string;
1001
+ session_id?: string;
1002
+ customer_id?: string;
1003
+ location_id?: string;
1004
+ created_at: string;
1005
+ updated_at: string;
1006
+ expires_at: string;
1007
+ status: string;
1008
+ source: string;
1009
+ channel: string;
1010
+ business_details?: UICartBusiness;
1011
+ location_details?: UICartLocation;
1012
+ customer_info: UICartCustomer;
1013
+ items: CartItemDetails[];
1014
+ pricing: UICartPricing;
1015
+ metadata?: Record<string, unknown>;
1016
+ }
1017
+ /** Envelope returned by cart#enriched query */
1018
+ interface UICartResponse {
1019
+ cart: UICart;
1020
+ cart_count: number;
1021
+ message?: string | null;
1022
+ }
1023
+ interface AddToCartInput {
1024
+ item_id: string;
1025
+ quantity?: number;
1026
+ variant_id?: string;
1027
+ quote_id?: string;
1028
+ add_on_options?: string[];
1029
+ special_instructions?: string;
1030
+ bundle_selections?: BundleSelectionInput[];
1031
+ composite_selections?: ComponentSelectionInput[];
1032
+ scheduled_start?: string;
1033
+ scheduled_end?: string;
1034
+ staff_id?: string;
1035
+ }
1036
+ interface UpdateCartItemInput {
1037
+ quantity?: number;
1038
+ variant_id?: string;
1039
+ add_on_options?: string[];
1040
+ notes?: string;
1041
+ bundle_selections?: BundleSelectionInput[];
1042
+ composite_selections?: ComponentSelectionInput[];
1043
+ scheduled_start?: string;
1044
+ scheduled_end?: string;
1045
+ staff_id?: string;
1046
+ }
1047
+ interface CartSummary {
1048
+ item_count: number;
1049
+ total_items: number;
1050
+ subtotal: Money;
1051
+ discount_amount: Money;
1052
+ tax_amount: Money;
1053
+ total: Money;
1054
+ currency: CurrencyCode;
1055
+ }
1056
+
1057
+ 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";
1058
+ type PaymentProvider = "stripe" | "paystack" | "mtn" | "vodafone" | "airtel" | "cellulant" | "offline" | "cash" | "manual";
1059
+ type PaymentMethodType = "card" | "mobile_money" | "bank_transfer" | "cash" | "custom";
1060
+ /** Authorization types for payment verification (OTP, PIN, etc.) */
1061
+ type AuthorizationType = "otp" | "pin" | "phone" | "birthday" | "address";
1062
+ /** Payment processing state machine states (for UI) */
1063
+ type PaymentProcessingState = "initial" | "preparing" | "processing" | "verifying" | "awaiting_authorization" | "success" | "error" | "timeout";
1064
+ interface PaymentMethod {
1065
+ type: PaymentMethodType;
1066
+ provider?: string;
1067
+ phone_number?: string;
1068
+ card_last_four?: string;
1069
+ custom_value?: string;
1070
+ }
1071
+ interface Payment {
1072
+ id: string;
1073
+ order_id: string;
1074
+ business_id: string;
1075
+ amount: Money;
1076
+ currency: CurrencyCode;
1077
+ payment_method: PaymentMethod;
1078
+ status: PaymentStatus;
1079
+ provider: PaymentProvider;
1080
+ provider_reference?: string;
1081
+ failure_reason?: string;
1082
+ created_at: string;
1083
+ updated_at: string;
1084
+ }
1085
+ interface InitializePaymentResult {
1086
+ payment_id: string;
1087
+ status: PaymentStatus;
1088
+ redirect_url?: string;
1089
+ authorization_url?: string;
1090
+ reference: string;
1091
+ provider: PaymentProvider;
1092
+ }
1093
+ /** Normalized payment response from checkout or payment initialization */
1094
+ interface PaymentResponse {
1095
+ method: string;
1096
+ provider: string;
1097
+ requires_action: boolean;
1098
+ public_key?: string;
1099
+ client_secret?: string;
1100
+ access_code?: string;
1101
+ redirect_url?: string;
1102
+ transaction_id?: string;
1103
+ order_id?: string;
1104
+ reference?: string;
1105
+ metadata?: Record<string, unknown>;
1106
+ instructions?: string;
1107
+ display_text?: string;
1108
+ requires_authorization?: boolean;
1109
+ authorization_type?: AuthorizationType;
1110
+ provider_payment_id?: string;
1111
+ }
1112
+ /** Payment status polling response */
1113
+ interface PaymentStatusResponse {
1114
+ status: PaymentStatus;
1115
+ paid: boolean;
1116
+ amount?: Money;
1117
+ currency?: CurrencyCode;
1118
+ reference?: string;
1119
+ message?: string;
1120
+ }
1121
+ interface PaymentErrorDetails {
1122
+ code: string;
1123
+ message: string;
1124
+ recoverable: boolean;
1125
+ technical?: string;
1126
+ }
1127
+ interface SubmitAuthorizationInput {
1128
+ reference: string;
1129
+ auth_type: AuthorizationType;
1130
+ value: string;
1131
+ }
1132
+
1133
+ export { type CompositePricingMode as $, type ApiError as A, type AddOn as B, type CurrencyCode as C, type DigitalProductType as D, ErrorCode as E, type AddOnWithOptions as F, type AddOnOption as G, type AddOnOptionPrice as H, type InventoryType as I, type ProductAddOn as J, type Category as K, type CategorySummary as L, type Money as M, type Collection as N, type CollectionSummary as O, type PaginationParams as P, type CollectionProduct as Q, type BundlePriceType as R, type SalesChannel as S, type Bundle as T, type BundleSummary as U, type VariantStrategy as V, type BundleProduct as W, type BundleWithDetails as X, type BundleComponentData as Y, ZERO as Z, type BundleComponentInfo as _, moneyFromNumber as a, type PaymentProcessingState as a$, type GroupPricingBehavior as a0, type ComponentSourceType as a1, type Composite as a2, type CompositeWithDetails as a3, type ComponentGroup as a4, type ComponentGroupWithComponents as a5, type CompositeComponent as a6, type ComponentSelectionInput as a7, type CompositePriceResult as a8, type ComponentPriceBreakdown as a9, type CompositePriceBreakdown as aA, type CompositeSelectionData as aB, type LineConfiguration as aC, type Cart as aD, type CartItem as aE, type CartTotals as aF, type DisplayCart as aG, type DisplayCartItem as aH, type DisplayAddOn as aI, type DisplayAddOnOption as aJ, type UICartBusiness as aK, type UICartLocation as aL, type UICartCustomer as aM, type UICartPricing as aN, type AddOnOptionDetails as aO, type AddOnGroupDetails as aP, type VariantDetailsDTO as aQ, type CartItemDetails as aR, type UICart as aS, type UICartResponse as aT, type AddToCartInput as aU, type UpdateCartItemInput as aV, type CartSummary as aW, type PaymentStatus as aX, type PaymentProvider as aY, type PaymentMethodType as aZ, type AuthorizationType as a_, type PriceEntryType as aa, type Price as ab, type LocationProductPrice as ac, type ProductAvailability as ad, type ProductTimeProfile as ae, type CartStatus as af, type CartChannel as ag, type PriceSource as ah, type AdjustmentType as ai, type PriceAdjustment as aj, type TaxPathComponent as ak, type PricePathTaxInfo as al, type PriceDecisionPath as am, type ChosenPrice as an, type BenefitType as ao, type AppliedDiscount as ap, type DiscountBreakdown as aq, type DiscountDetails as ar, type SelectedAddOnOption as as, type AddOnDetails as at, type CartAddOn as au, type VariantDetails as av, type BundleSelectionInput as aw, type BundleStoredSelection as ax, type BundleSelectionData as ay, type CompositeStoredSelection as az, type Currency as b, type PaymentMethod as b0, type Payment as b1, type InitializePaymentResult as b2, type PaymentResponse as b3, type PaymentStatusResponse as b4, type PaymentErrorDetails as b5, type SubmitAuthorizationInput as b6, currencyCode as c, type Pagination as d, type ErrorCodeType as e, type ErrorHint as f, ERROR_HINTS as g, CimplifyError as h, isCimplifyError as i, getErrorHint as j, enrichError as k, isRetryableError as l, money as m, type ProductType as n, type ProductRenderHint as o, type DepositType as p, type Product as q, type ProductWithDetails as r, type ProductVariant as s, type VariantDisplayAttribute as t, type VariantAxis as u, type VariantAxisWithValues as v, type VariantAxisValue as w, type ProductVariantValue as x, type VariantLocationAvailability as y, type VariantAxisSelection as z };