@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,181 @@
1
+ /** Decimal value represented as string for precision */
2
+ type Money = string;
3
+ /** Supported currencies */
4
+ type Currency = "GHS" | "USD" | "NGN" | "KES" | "ZAR" | string;
5
+ /** Pagination parameters */
6
+ interface PaginationParams {
7
+ page?: number;
8
+ limit?: number;
9
+ offset?: number;
10
+ }
11
+ /** Pagination metadata in response */
12
+ interface Pagination {
13
+ total_count: number;
14
+ current_page: number;
15
+ page_size: number;
16
+ total_pages: number;
17
+ }
18
+ /** Strongly-typed error codes for better DX */
19
+ declare const ErrorCode: {
20
+ readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
21
+ readonly NETWORK_ERROR: "NETWORK_ERROR";
22
+ readonly TIMEOUT: "TIMEOUT";
23
+ readonly UNAUTHORIZED: "UNAUTHORIZED";
24
+ readonly FORBIDDEN: "FORBIDDEN";
25
+ readonly NOT_FOUND: "NOT_FOUND";
26
+ readonly VALIDATION_ERROR: "VALIDATION_ERROR";
27
+ readonly CART_EMPTY: "CART_EMPTY";
28
+ readonly CART_EXPIRED: "CART_EXPIRED";
29
+ readonly CART_NOT_FOUND: "CART_NOT_FOUND";
30
+ readonly ITEM_UNAVAILABLE: "ITEM_UNAVAILABLE";
31
+ readonly VARIANT_NOT_FOUND: "VARIANT_NOT_FOUND";
32
+ readonly VARIANT_OUT_OF_STOCK: "VARIANT_OUT_OF_STOCK";
33
+ readonly ADDON_REQUIRED: "ADDON_REQUIRED";
34
+ readonly ADDON_MAX_EXCEEDED: "ADDON_MAX_EXCEEDED";
35
+ readonly CHECKOUT_VALIDATION_FAILED: "CHECKOUT_VALIDATION_FAILED";
36
+ readonly DELIVERY_ADDRESS_REQUIRED: "DELIVERY_ADDRESS_REQUIRED";
37
+ readonly CUSTOMER_INFO_REQUIRED: "CUSTOMER_INFO_REQUIRED";
38
+ readonly PAYMENT_FAILED: "PAYMENT_FAILED";
39
+ readonly PAYMENT_CANCELLED: "PAYMENT_CANCELLED";
40
+ readonly INSUFFICIENT_FUNDS: "INSUFFICIENT_FUNDS";
41
+ readonly CARD_DECLINED: "CARD_DECLINED";
42
+ readonly INVALID_OTP: "INVALID_OTP";
43
+ readonly OTP_EXPIRED: "OTP_EXPIRED";
44
+ readonly AUTHORIZATION_FAILED: "AUTHORIZATION_FAILED";
45
+ readonly PAYMENT_ACTION_NOT_COMPLETED: "PAYMENT_ACTION_NOT_COMPLETED";
46
+ readonly SLOT_UNAVAILABLE: "SLOT_UNAVAILABLE";
47
+ readonly BOOKING_CONFLICT: "BOOKING_CONFLICT";
48
+ readonly SERVICE_NOT_FOUND: "SERVICE_NOT_FOUND";
49
+ readonly OUT_OF_STOCK: "OUT_OF_STOCK";
50
+ readonly INSUFFICIENT_QUANTITY: "INSUFFICIENT_QUANTITY";
51
+ };
52
+ type ErrorCodeType = (typeof ErrorCode)[keyof typeof ErrorCode];
53
+ /** API error structure */
54
+ interface ApiError {
55
+ code: string;
56
+ message: string;
57
+ retryable: boolean;
58
+ }
59
+ interface ErrorHint {
60
+ docs_url: string;
61
+ suggestion: string;
62
+ }
63
+ declare const ERROR_HINTS: Record<string, ErrorHint>;
64
+ /**
65
+ * Custom error class for SDK errors with typed error codes.
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * try {
70
+ * await client.cart.addItem({ item_id: "prod_123" });
71
+ * } catch (error) {
72
+ * if (isCimplifyError(error)) {
73
+ * switch (error.code) {
74
+ * case ErrorCode.ITEM_UNAVAILABLE:
75
+ * toast.error("This item is no longer available");
76
+ * break;
77
+ * case ErrorCode.VARIANT_OUT_OF_STOCK:
78
+ * toast.error("Selected option is out of stock");
79
+ * break;
80
+ * default:
81
+ * toast.error(error.message);
82
+ * }
83
+ * }
84
+ * }
85
+ * ```
86
+ */
87
+ declare class CimplifyError extends Error {
88
+ code: string;
89
+ retryable: boolean;
90
+ docs_url?: string | undefined;
91
+ suggestion?: string | undefined;
92
+ constructor(code: string, message: string, retryable?: boolean, docs_url?: string | undefined, suggestion?: string | undefined);
93
+ /** User-friendly message safe to display */
94
+ get userMessage(): string;
95
+ }
96
+ /** Type guard for CimplifyError */
97
+ declare function isCimplifyError(error: unknown): error is CimplifyError;
98
+ declare function getErrorHint(code: string): ErrorHint | undefined;
99
+ declare function enrichError(error: CimplifyError, options?: {
100
+ isTestMode?: boolean;
101
+ }): CimplifyError;
102
+ /** Check if error is retryable */
103
+ declare function isRetryableError(error: unknown): boolean;
104
+
105
+ 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";
106
+ type PaymentProvider = "stripe" | "paystack" | "mtn" | "vodafone" | "airtel" | "cellulant" | "offline" | "cash" | "manual";
107
+ type PaymentMethodType = "card" | "mobile_money" | "bank_transfer" | "cash" | "custom";
108
+ /** Authorization types for payment verification (OTP, PIN, etc.) */
109
+ type AuthorizationType = "otp" | "pin" | "phone" | "birthday" | "address";
110
+ /** Payment processing state machine states (for UI) */
111
+ type PaymentProcessingState = "initial" | "preparing" | "processing" | "verifying" | "awaiting_authorization" | "success" | "error" | "timeout";
112
+ interface PaymentMethod {
113
+ type: PaymentMethodType;
114
+ provider?: string;
115
+ phone_number?: string;
116
+ card_last_four?: string;
117
+ custom_value?: string;
118
+ }
119
+ interface Payment {
120
+ id: string;
121
+ order_id: string;
122
+ business_id: string;
123
+ amount: Money;
124
+ currency: Currency;
125
+ payment_method: PaymentMethod;
126
+ status: PaymentStatus;
127
+ provider: PaymentProvider;
128
+ provider_reference?: string;
129
+ failure_reason?: string;
130
+ created_at: string;
131
+ updated_at: string;
132
+ }
133
+ interface InitializePaymentResult {
134
+ payment_id: string;
135
+ status: PaymentStatus;
136
+ redirect_url?: string;
137
+ authorization_url?: string;
138
+ reference: string;
139
+ provider: PaymentProvider;
140
+ }
141
+ /** Normalized payment response from checkout or payment initialization */
142
+ interface PaymentResponse {
143
+ method: string;
144
+ provider: string;
145
+ requires_action: boolean;
146
+ public_key?: string;
147
+ client_secret?: string;
148
+ access_code?: string;
149
+ redirect_url?: string;
150
+ transaction_id?: string;
151
+ order_id?: string;
152
+ reference?: string;
153
+ metadata?: Record<string, unknown>;
154
+ instructions?: string;
155
+ display_text?: string;
156
+ requires_authorization?: boolean;
157
+ authorization_type?: AuthorizationType;
158
+ provider_payment_id?: string;
159
+ }
160
+ /** Payment status polling response */
161
+ interface PaymentStatusResponse {
162
+ status: PaymentStatus;
163
+ paid: boolean;
164
+ amount?: Money;
165
+ currency?: string;
166
+ reference?: string;
167
+ message?: string;
168
+ }
169
+ interface PaymentErrorDetails {
170
+ code: string;
171
+ message: string;
172
+ recoverable: boolean;
173
+ technical?: string;
174
+ }
175
+ interface SubmitAuthorizationInput {
176
+ reference: string;
177
+ auth_type: AuthorizationType;
178
+ value: string;
179
+ }
180
+
181
+ export { type ApiError as A, type Currency as C, ErrorCode as E, type InitializePaymentResult as I, type Money as M, type PaginationParams as P, type SubmitAuthorizationInput as S, type Pagination as a, type ErrorCodeType as b, type ErrorHint as c, ERROR_HINTS as d, CimplifyError as e, enrichError as f, getErrorHint as g, isRetryableError as h, isCimplifyError as i, type PaymentStatus as j, type PaymentProvider as k, type PaymentMethodType as l, type AuthorizationType as m, type PaymentProcessingState as n, type PaymentMethod as o, type Payment as p, type PaymentResponse as q, type PaymentStatusResponse as r, type PaymentErrorDetails as s };
package/dist/react.d.mts CHANGED
@@ -1,6 +1,8 @@
1
- import { eJ as AdSlot, eK as AdPosition, eO as AdContextValue, C as CimplifyClient, a2 as ProcessCheckoutResult, a4 as CheckoutStatus, a5 as CheckoutStatusContext, y as CimplifyElements, J as ElementsOptions, eD as AuthenticatedData, ez as AddressInfo, eA as PaymentMethodInfo, eF as ElementsCheckoutResult, a1 as ProcessCheckoutOptions } from './ads-CmO7VVPP.mjs';
2
- export { eM as AdConfig } from './ads-CmO7VVPP.mjs';
1
+ import { C as CimplifyClient, _ as ProcessCheckoutResult, a0 as CheckoutStatus, a1 as CheckoutStatusContext, cT as Location, cQ as Business, aL as Product, aM as ProductWithDetails, a_ as Category, bH as BundleSelectionInput, bi as ComponentSelectionInput, cj as Order, u as CimplifyElements, y as ElementsOptions, eh as AuthenticatedData, ed as AddressInfo, ee as PaymentMethodInfo, ej as ElementsCheckoutResult, Z as ProcessCheckoutOptions } from './client-B4etj3AD.mjs';
3
2
  import React, { ReactNode } from 'react';
3
+ import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-t3FBTU8p.mjs';
4
+ export { c as AdConfig } from './ads-t3FBTU8p.mjs';
5
+ import { e as CimplifyError } from './payment-pjpfIKX8.mjs';
4
6
 
5
7
  interface UserIdentity {
6
8
  uid: string;
@@ -50,8 +52,8 @@ declare function Ad({ slot, position, className, style, fallback, onImpression,
50
52
  type CheckoutOrderType = "pickup" | "delivery" | "dine_in";
51
53
  interface CimplifyCheckoutProps {
52
54
  client: CimplifyClient;
53
- businessId: string;
54
- cartId: string;
55
+ businessId?: string;
56
+ cartId?: string;
55
57
  locationId?: string;
56
58
  orderTypes?: CheckoutOrderType[];
57
59
  enrollInLink?: boolean;
@@ -69,15 +71,161 @@ interface CimplifyCheckoutProps {
69
71
  borderRadius?: string;
70
72
  };
71
73
  };
74
+ demoMode?: boolean;
72
75
  className?: string;
73
76
  }
74
- declare function CimplifyCheckout({ client, businessId, cartId, locationId, orderTypes, enrollInLink, onComplete, onError, onStatusChange, appearance, className, }: CimplifyCheckoutProps): React.ReactElement;
77
+ declare function CimplifyCheckout({ client, businessId, cartId, locationId, orderTypes, enrollInLink, onComplete, onError, onStatusChange, appearance, demoMode, className, }: CimplifyCheckoutProps): React.ReactElement;
78
+
79
+ interface CimplifyContextValue {
80
+ client: CimplifyClient;
81
+ business: Business | null;
82
+ currency: string;
83
+ country: string;
84
+ locations: Location[];
85
+ currentLocation: Location | null;
86
+ setCurrentLocation: (location: Location) => void;
87
+ isReady: boolean;
88
+ isDemoMode: boolean;
89
+ }
90
+ interface CimplifyProviderProps {
91
+ client?: CimplifyClient;
92
+ children: ReactNode;
93
+ onLocationChange?: (location: Location) => void;
94
+ }
95
+ declare function CimplifyProvider({ client, children, onLocationChange, }: CimplifyProviderProps): React.ReactElement;
96
+ declare function useCimplify(): CimplifyContextValue;
97
+ declare function useOptionalCimplify(): CimplifyContextValue | null;
98
+
99
+ interface UseProductsOptions {
100
+ category?: string;
101
+ collection?: string;
102
+ search?: string;
103
+ featured?: boolean;
104
+ limit?: number;
105
+ enabled?: boolean;
106
+ client?: CimplifyClient;
107
+ }
108
+ interface UseProductsResult {
109
+ products: Product[];
110
+ isLoading: boolean;
111
+ error: CimplifyError | null;
112
+ refetch: () => Promise<void>;
113
+ }
114
+ declare function useProducts(options?: UseProductsOptions): UseProductsResult;
115
+
116
+ interface UseProductOptions {
117
+ enabled?: boolean;
118
+ client?: CimplifyClient;
119
+ }
120
+ interface UseProductResult {
121
+ product: ProductWithDetails | null;
122
+ isLoading: boolean;
123
+ error: CimplifyError | null;
124
+ refetch: () => Promise<void>;
125
+ }
126
+ declare function useProduct(slugOrId: string | null | undefined, options?: UseProductOptions): UseProductResult;
127
+
128
+ interface UseCategoriesOptions {
129
+ enabled?: boolean;
130
+ client?: CimplifyClient;
131
+ }
132
+ interface UseCategoriesResult {
133
+ categories: Category[];
134
+ isLoading: boolean;
135
+ error: CimplifyError | null;
136
+ refetch: () => Promise<void>;
137
+ }
138
+ declare function useCategories(options?: UseCategoriesOptions): UseCategoriesResult;
139
+
140
+ interface CartVariantSelection {
141
+ id: string;
142
+ name: string;
143
+ price_adjustment?: string;
144
+ }
145
+ interface CartAddOnOptionSelection {
146
+ id: string;
147
+ name: string;
148
+ add_on_id?: string;
149
+ default_price?: string;
150
+ }
151
+ interface UseCartItem {
152
+ id: string;
153
+ product: Product;
154
+ quantity: number;
155
+ locationId?: string;
156
+ variantId?: string;
157
+ variant?: CartVariantSelection;
158
+ quoteId?: string;
159
+ addOnOptionIds?: string[];
160
+ addOnOptions?: CartAddOnOptionSelection[];
161
+ bundleSelections?: BundleSelectionInput[];
162
+ compositeSelections?: ComponentSelectionInput[];
163
+ specialInstructions?: string;
164
+ }
165
+ interface AddToCartOptions {
166
+ locationId?: string;
167
+ variantId?: string;
168
+ variant?: CartVariantSelection;
169
+ quoteId?: string;
170
+ addOnOptionIds?: string[];
171
+ addOnOptions?: CartAddOnOptionSelection[];
172
+ bundleSelections?: BundleSelectionInput[];
173
+ compositeSelections?: ComponentSelectionInput[];
174
+ specialInstructions?: string;
175
+ }
176
+ interface UseCartOptions {
177
+ client?: CimplifyClient;
178
+ demoMode?: boolean;
179
+ locationId?: string;
180
+ currency?: string;
181
+ }
182
+ interface UseCartResult {
183
+ items: UseCartItem[];
184
+ itemCount: number;
185
+ subtotal: number;
186
+ tax: number;
187
+ total: number;
188
+ currency: string;
189
+ isEmpty: boolean;
190
+ isLoading: boolean;
191
+ addItem: (product: Product, quantity?: number, options?: AddToCartOptions) => Promise<void>;
192
+ removeItem: (itemId: string) => Promise<void>;
193
+ updateQuantity: (itemId: string, quantity: number) => Promise<void>;
194
+ clearCart: () => Promise<void>;
195
+ sync: () => Promise<void>;
196
+ }
197
+ declare function useCart(options?: UseCartOptions): UseCartResult;
198
+
199
+ interface UseOrderOptions {
200
+ poll?: boolean;
201
+ pollInterval?: number;
202
+ enabled?: boolean;
203
+ client?: CimplifyClient;
204
+ }
205
+ interface UseOrderResult {
206
+ order: Order | null;
207
+ isLoading: boolean;
208
+ error: CimplifyError | null;
209
+ refetch: () => Promise<void>;
210
+ }
211
+ declare function useOrder(orderId: string | null | undefined, options?: UseOrderOptions): UseOrderResult;
212
+
213
+ interface UseLocationsOptions {
214
+ client?: CimplifyClient;
215
+ }
216
+ interface UseLocationsResult {
217
+ locations: Location[];
218
+ currentLocation: Location | null;
219
+ setCurrentLocation: (location: Location) => void;
220
+ isLoading: boolean;
221
+ }
222
+ declare function useLocations(options?: UseLocationsOptions): UseLocationsResult;
75
223
 
76
224
  declare function useElements(): CimplifyElements | null;
77
225
  declare function useElementsReady(): boolean;
78
226
  interface ElementsProviderProps {
79
227
  client: CimplifyClient;
80
- businessId: string;
228
+ businessId?: string;
81
229
  options?: ElementsOptions;
82
230
  children: ReactNode;
83
231
  }
@@ -129,4 +277,4 @@ declare function useCheckout(): {
129
277
  isLoading: boolean;
130
278
  };
131
279
 
132
- export { Ad, AdPosition, type AdProps, AdProvider, AdSlot, AddressElement, AuthElement, CimplifyCheckout, type CimplifyCheckoutProps, ElementsProvider, PaymentElement, useAds, useCheckout, useElements, useElementsReady };
280
+ export { Ad, AdPosition, type AdProps, AdProvider, AdSlot, type AddToCartOptions, AddressElement, AuthElement, CimplifyCheckout, type CimplifyCheckoutProps, type CimplifyContextValue, CimplifyProvider, type CimplifyProviderProps, ElementsProvider, PaymentElement, type UseCartItem, type UseCartOptions, type UseCartResult, type UseCategoriesOptions, type UseCategoriesResult, type UseLocationsOptions, type UseLocationsResult, type UseOrderOptions, type UseOrderResult, type UseProductOptions, type UseProductResult, type UseProductsOptions, type UseProductsResult, useAds, useCart, useCategories, useCheckout, useCimplify, useElements, useElementsReady, useLocations, useOptionalCimplify, useOrder, useProduct, useProducts };
package/dist/react.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { eJ as AdSlot, eK as AdPosition, eO as AdContextValue, C as CimplifyClient, a2 as ProcessCheckoutResult, a4 as CheckoutStatus, a5 as CheckoutStatusContext, y as CimplifyElements, J as ElementsOptions, eD as AuthenticatedData, ez as AddressInfo, eA as PaymentMethodInfo, eF as ElementsCheckoutResult, a1 as ProcessCheckoutOptions } from './ads-CmO7VVPP.js';
2
- export { eM as AdConfig } from './ads-CmO7VVPP.js';
1
+ import { C as CimplifyClient, _ as ProcessCheckoutResult, a0 as CheckoutStatus, a1 as CheckoutStatusContext, cT as Location, cQ as Business, aL as Product, aM as ProductWithDetails, a_ as Category, bH as BundleSelectionInput, bi as ComponentSelectionInput, cj as Order, u as CimplifyElements, y as ElementsOptions, eh as AuthenticatedData, ed as AddressInfo, ee as PaymentMethodInfo, ej as ElementsCheckoutResult, Z as ProcessCheckoutOptions } from './client-CYVVuP5J.js';
3
2
  import React, { ReactNode } from 'react';
3
+ import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-t3FBTU8p.js';
4
+ export { c as AdConfig } from './ads-t3FBTU8p.js';
5
+ import { e as CimplifyError } from './payment-pjpfIKX8.js';
4
6
 
5
7
  interface UserIdentity {
6
8
  uid: string;
@@ -50,8 +52,8 @@ declare function Ad({ slot, position, className, style, fallback, onImpression,
50
52
  type CheckoutOrderType = "pickup" | "delivery" | "dine_in";
51
53
  interface CimplifyCheckoutProps {
52
54
  client: CimplifyClient;
53
- businessId: string;
54
- cartId: string;
55
+ businessId?: string;
56
+ cartId?: string;
55
57
  locationId?: string;
56
58
  orderTypes?: CheckoutOrderType[];
57
59
  enrollInLink?: boolean;
@@ -69,15 +71,161 @@ interface CimplifyCheckoutProps {
69
71
  borderRadius?: string;
70
72
  };
71
73
  };
74
+ demoMode?: boolean;
72
75
  className?: string;
73
76
  }
74
- declare function CimplifyCheckout({ client, businessId, cartId, locationId, orderTypes, enrollInLink, onComplete, onError, onStatusChange, appearance, className, }: CimplifyCheckoutProps): React.ReactElement;
77
+ declare function CimplifyCheckout({ client, businessId, cartId, locationId, orderTypes, enrollInLink, onComplete, onError, onStatusChange, appearance, demoMode, className, }: CimplifyCheckoutProps): React.ReactElement;
78
+
79
+ interface CimplifyContextValue {
80
+ client: CimplifyClient;
81
+ business: Business | null;
82
+ currency: string;
83
+ country: string;
84
+ locations: Location[];
85
+ currentLocation: Location | null;
86
+ setCurrentLocation: (location: Location) => void;
87
+ isReady: boolean;
88
+ isDemoMode: boolean;
89
+ }
90
+ interface CimplifyProviderProps {
91
+ client?: CimplifyClient;
92
+ children: ReactNode;
93
+ onLocationChange?: (location: Location) => void;
94
+ }
95
+ declare function CimplifyProvider({ client, children, onLocationChange, }: CimplifyProviderProps): React.ReactElement;
96
+ declare function useCimplify(): CimplifyContextValue;
97
+ declare function useOptionalCimplify(): CimplifyContextValue | null;
98
+
99
+ interface UseProductsOptions {
100
+ category?: string;
101
+ collection?: string;
102
+ search?: string;
103
+ featured?: boolean;
104
+ limit?: number;
105
+ enabled?: boolean;
106
+ client?: CimplifyClient;
107
+ }
108
+ interface UseProductsResult {
109
+ products: Product[];
110
+ isLoading: boolean;
111
+ error: CimplifyError | null;
112
+ refetch: () => Promise<void>;
113
+ }
114
+ declare function useProducts(options?: UseProductsOptions): UseProductsResult;
115
+
116
+ interface UseProductOptions {
117
+ enabled?: boolean;
118
+ client?: CimplifyClient;
119
+ }
120
+ interface UseProductResult {
121
+ product: ProductWithDetails | null;
122
+ isLoading: boolean;
123
+ error: CimplifyError | null;
124
+ refetch: () => Promise<void>;
125
+ }
126
+ declare function useProduct(slugOrId: string | null | undefined, options?: UseProductOptions): UseProductResult;
127
+
128
+ interface UseCategoriesOptions {
129
+ enabled?: boolean;
130
+ client?: CimplifyClient;
131
+ }
132
+ interface UseCategoriesResult {
133
+ categories: Category[];
134
+ isLoading: boolean;
135
+ error: CimplifyError | null;
136
+ refetch: () => Promise<void>;
137
+ }
138
+ declare function useCategories(options?: UseCategoriesOptions): UseCategoriesResult;
139
+
140
+ interface CartVariantSelection {
141
+ id: string;
142
+ name: string;
143
+ price_adjustment?: string;
144
+ }
145
+ interface CartAddOnOptionSelection {
146
+ id: string;
147
+ name: string;
148
+ add_on_id?: string;
149
+ default_price?: string;
150
+ }
151
+ interface UseCartItem {
152
+ id: string;
153
+ product: Product;
154
+ quantity: number;
155
+ locationId?: string;
156
+ variantId?: string;
157
+ variant?: CartVariantSelection;
158
+ quoteId?: string;
159
+ addOnOptionIds?: string[];
160
+ addOnOptions?: CartAddOnOptionSelection[];
161
+ bundleSelections?: BundleSelectionInput[];
162
+ compositeSelections?: ComponentSelectionInput[];
163
+ specialInstructions?: string;
164
+ }
165
+ interface AddToCartOptions {
166
+ locationId?: string;
167
+ variantId?: string;
168
+ variant?: CartVariantSelection;
169
+ quoteId?: string;
170
+ addOnOptionIds?: string[];
171
+ addOnOptions?: CartAddOnOptionSelection[];
172
+ bundleSelections?: BundleSelectionInput[];
173
+ compositeSelections?: ComponentSelectionInput[];
174
+ specialInstructions?: string;
175
+ }
176
+ interface UseCartOptions {
177
+ client?: CimplifyClient;
178
+ demoMode?: boolean;
179
+ locationId?: string;
180
+ currency?: string;
181
+ }
182
+ interface UseCartResult {
183
+ items: UseCartItem[];
184
+ itemCount: number;
185
+ subtotal: number;
186
+ tax: number;
187
+ total: number;
188
+ currency: string;
189
+ isEmpty: boolean;
190
+ isLoading: boolean;
191
+ addItem: (product: Product, quantity?: number, options?: AddToCartOptions) => Promise<void>;
192
+ removeItem: (itemId: string) => Promise<void>;
193
+ updateQuantity: (itemId: string, quantity: number) => Promise<void>;
194
+ clearCart: () => Promise<void>;
195
+ sync: () => Promise<void>;
196
+ }
197
+ declare function useCart(options?: UseCartOptions): UseCartResult;
198
+
199
+ interface UseOrderOptions {
200
+ poll?: boolean;
201
+ pollInterval?: number;
202
+ enabled?: boolean;
203
+ client?: CimplifyClient;
204
+ }
205
+ interface UseOrderResult {
206
+ order: Order | null;
207
+ isLoading: boolean;
208
+ error: CimplifyError | null;
209
+ refetch: () => Promise<void>;
210
+ }
211
+ declare function useOrder(orderId: string | null | undefined, options?: UseOrderOptions): UseOrderResult;
212
+
213
+ interface UseLocationsOptions {
214
+ client?: CimplifyClient;
215
+ }
216
+ interface UseLocationsResult {
217
+ locations: Location[];
218
+ currentLocation: Location | null;
219
+ setCurrentLocation: (location: Location) => void;
220
+ isLoading: boolean;
221
+ }
222
+ declare function useLocations(options?: UseLocationsOptions): UseLocationsResult;
75
223
 
76
224
  declare function useElements(): CimplifyElements | null;
77
225
  declare function useElementsReady(): boolean;
78
226
  interface ElementsProviderProps {
79
227
  client: CimplifyClient;
80
- businessId: string;
228
+ businessId?: string;
81
229
  options?: ElementsOptions;
82
230
  children: ReactNode;
83
231
  }
@@ -129,4 +277,4 @@ declare function useCheckout(): {
129
277
  isLoading: boolean;
130
278
  };
131
279
 
132
- export { Ad, AdPosition, type AdProps, AdProvider, AdSlot, AddressElement, AuthElement, CimplifyCheckout, type CimplifyCheckoutProps, ElementsProvider, PaymentElement, useAds, useCheckout, useElements, useElementsReady };
280
+ export { Ad, AdPosition, type AdProps, AdProvider, AdSlot, type AddToCartOptions, AddressElement, AuthElement, CimplifyCheckout, type CimplifyCheckoutProps, type CimplifyContextValue, CimplifyProvider, type CimplifyProviderProps, ElementsProvider, PaymentElement, type UseCartItem, type UseCartOptions, type UseCartResult, type UseCategoriesOptions, type UseCategoriesResult, type UseLocationsOptions, type UseLocationsResult, type UseOrderOptions, type UseOrderResult, type UseProductOptions, type UseProductResult, type UseProductsOptions, type UseProductsResult, useAds, useCart, useCategories, useCheckout, useCimplify, useElements, useElementsReady, useLocations, useOptionalCimplify, useOrder, useProduct, useProducts };