@cimplify/sdk 0.6.9 → 0.6.10

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/react.d.mts DELETED
@@ -1,375 +0,0 @@
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, b0 as Collection, b7 as BundleWithDetails, be as CompositeWithDetails, bj as CompositePriceResult, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, u as CimplifyElements, y as ElementsOptions, eh as AuthenticatedData, ed as AddressInfo, ee as PaymentMethodInfo, ej as ElementsCheckoutResult, Z as ProcessCheckoutOptions } from './client-vmXPt1j0.mjs';
2
- import React, { ReactNode } from 'react';
3
- import { h as CimplifyError, C as CurrencyCode } from './payment-Cu75tmUc.mjs';
4
- import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-t3FBTU8p.mjs';
5
- export { c as AdConfig } from './ads-t3FBTU8p.mjs';
6
-
7
- interface UserIdentity {
8
- uid: string;
9
- isAuthenticated: boolean;
10
- fingerprint: string;
11
- signals: DeviceSignals;
12
- }
13
- interface DeviceSignals {
14
- userAgent: string;
15
- language: string;
16
- languages: string[];
17
- platform: string;
18
- screenWidth: number;
19
- screenHeight: number;
20
- colorDepth: number;
21
- pixelRatio: number;
22
- timezone: string;
23
- timezoneOffset: number;
24
- touchSupport: boolean;
25
- cookiesEnabled: boolean;
26
- doNotTrack: boolean;
27
- }
28
-
29
- interface AdContextValueExtended extends AdContextValue {
30
- identity: UserIdentity | null;
31
- apiBase: string;
32
- }
33
- declare function useAds(): AdContextValueExtended;
34
- interface AdProviderProps {
35
- siteId: string;
36
- apiBase?: string;
37
- authenticatedAccountId?: string;
38
- children: ReactNode;
39
- }
40
- declare function AdProvider({ siteId, apiBase, authenticatedAccountId, children, }: AdProviderProps): React.ReactElement;
41
- interface AdProps {
42
- slot: AdSlot;
43
- position?: AdPosition;
44
- className?: string;
45
- style?: React.CSSProperties;
46
- fallback?: ReactNode;
47
- onImpression?: (adId: string) => void;
48
- onClick?: (adId: string) => void;
49
- }
50
- declare function Ad({ slot, position, className, style, fallback, onImpression, onClick, }: AdProps): React.ReactElement | null;
51
-
52
- type CheckoutOrderType = "pickup" | "delivery" | "dine_in";
53
- interface CimplifyCheckoutProps {
54
- client: CimplifyClient;
55
- businessId?: string;
56
- cartId?: string;
57
- locationId?: string;
58
- orderTypes?: CheckoutOrderType[];
59
- enrollInLink?: boolean;
60
- onComplete: (result: ProcessCheckoutResult) => void;
61
- onError?: (error: {
62
- code: string;
63
- message: string;
64
- }) => void;
65
- onStatusChange?: (status: CheckoutStatus, context: CheckoutStatusContext) => void;
66
- appearance?: {
67
- theme?: "light" | "dark";
68
- variables?: {
69
- primaryColor?: string;
70
- fontFamily?: string;
71
- borderRadius?: string;
72
- };
73
- };
74
- demoMode?: boolean;
75
- className?: string;
76
- }
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;
223
-
224
- interface UseCollectionsOptions {
225
- client?: CimplifyClient;
226
- enabled?: boolean;
227
- }
228
- interface UseCollectionsResult {
229
- collections: Collection[];
230
- isLoading: boolean;
231
- error: CimplifyError | null;
232
- refetch: () => Promise<void>;
233
- }
234
- declare function useCollections(options?: UseCollectionsOptions): UseCollectionsResult;
235
-
236
- interface UseCollectionOptions {
237
- client?: CimplifyClient;
238
- enabled?: boolean;
239
- }
240
- interface UseCollectionResult {
241
- collection: Collection | null;
242
- products: Product[];
243
- isLoading: boolean;
244
- error: CimplifyError | null;
245
- refetch: () => Promise<void>;
246
- }
247
- declare function useCollection(idOrSlug: string | null | undefined, options?: UseCollectionOptions): UseCollectionResult;
248
-
249
- interface UseBundleOptions {
250
- client?: CimplifyClient;
251
- enabled?: boolean;
252
- }
253
- interface UseBundleResult {
254
- bundle: BundleWithDetails | null;
255
- isLoading: boolean;
256
- error: CimplifyError | null;
257
- refetch: () => Promise<void>;
258
- }
259
- declare function useBundle(idOrSlug: string | null | undefined, options?: UseBundleOptions): UseBundleResult;
260
-
261
- interface UseCompositeOptions {
262
- client?: CimplifyClient;
263
- enabled?: boolean;
264
- byProductId?: boolean;
265
- }
266
- interface UseCompositeResult {
267
- composite: CompositeWithDetails | null;
268
- isLoading: boolean;
269
- error: CimplifyError | null;
270
- refetch: () => Promise<void>;
271
- calculatePrice: (selections: ComponentSelectionInput[], locationId?: string) => Promise<CompositePriceResult | null>;
272
- priceResult: CompositePriceResult | null;
273
- isPriceLoading: boolean;
274
- }
275
- declare function useComposite(idOrProductId: string | null | undefined, options?: UseCompositeOptions): UseCompositeResult;
276
-
277
- interface UseSearchOptions {
278
- client?: CimplifyClient;
279
- minLength?: number;
280
- debounceMs?: number;
281
- limit?: number;
282
- category?: string;
283
- }
284
- interface UseSearchResult {
285
- results: Product[];
286
- isLoading: boolean;
287
- error: CimplifyError | null;
288
- query: string;
289
- setQuery: (query: string) => void;
290
- clear: () => void;
291
- }
292
- declare function useSearch(options?: UseSearchOptions): UseSearchResult;
293
-
294
- interface UseQuoteOptions {
295
- client?: CimplifyClient;
296
- enabled?: boolean;
297
- autoRefresh?: boolean;
298
- refreshBeforeExpiryMs?: number;
299
- }
300
- interface UseQuoteInput {
301
- productId: string;
302
- variantId?: string;
303
- locationId?: string;
304
- quantity?: number;
305
- addOnOptionIds?: string[];
306
- bundleSelections?: QuoteBundleSelectionInput[];
307
- compositeSelections?: QuoteCompositeSelectionInput[];
308
- }
309
- interface UseQuoteResult {
310
- quote: PriceQuote | null;
311
- isLoading: boolean;
312
- error: CimplifyError | null;
313
- refresh: () => Promise<void>;
314
- isExpired: boolean;
315
- messages: QuoteUiMessage[];
316
- }
317
- declare function useQuote(input: UseQuoteInput | null | undefined, options?: UseQuoteOptions): UseQuoteResult;
318
-
319
- declare function useElements(): CimplifyElements | null;
320
- declare function useElementsReady(): boolean;
321
- interface ElementsProviderProps {
322
- client: CimplifyClient;
323
- businessId?: string;
324
- options?: ElementsOptions;
325
- children: ReactNode;
326
- }
327
- declare function ElementsProvider({ client, businessId, options, children, }: ElementsProviderProps): React.ReactElement;
328
- interface BaseElementProps {
329
- className?: string;
330
- style?: React.CSSProperties;
331
- onReady?: () => void;
332
- onError?: (error: {
333
- code: string;
334
- message: string;
335
- }) => void;
336
- }
337
- interface AuthElementProps extends BaseElementProps {
338
- prefillEmail?: string;
339
- onAuthenticated?: (data: AuthenticatedData) => void;
340
- onRequiresOtp?: (data: {
341
- contactMasked: string;
342
- }) => void;
343
- }
344
- declare function AuthElement({ className, style, prefillEmail, onReady, onAuthenticated, onRequiresOtp, onError, }: AuthElementProps): React.ReactElement | null;
345
- interface AddressElementProps extends BaseElementProps {
346
- mode?: "shipping" | "billing";
347
- onChange?: (data: {
348
- address: AddressInfo;
349
- saveToLink: boolean;
350
- }) => void;
351
- }
352
- declare function AddressElement({ className, style, mode, onReady, onChange, onError, }: AddressElementProps): React.ReactElement | null;
353
- interface PaymentElementProps extends BaseElementProps {
354
- amount?: number;
355
- currency?: CurrencyCode;
356
- onChange?: (data: {
357
- paymentMethod: PaymentMethodInfo;
358
- saveToLink: boolean;
359
- }) => void;
360
- }
361
- declare function PaymentElement({ className, style, amount, currency, onReady, onChange, onError, }: PaymentElementProps): React.ReactElement | null;
362
- declare function useCheckout(): {
363
- submit: (data: {
364
- cart_id: string;
365
- order_type?: "delivery" | "pickup" | "dine_in";
366
- location_id?: string;
367
- scheduled_time?: string;
368
- tip_amount?: number;
369
- notes?: string;
370
- }) => Promise<ElementsCheckoutResult>;
371
- process: (options: ProcessCheckoutOptions) => Promise<ProcessCheckoutResult>;
372
- isLoading: boolean;
373
- };
374
-
375
- export { Ad, AdPosition, type AdProps, AdProvider, AdSlot, type AddToCartOptions, AddressElement, AuthElement, CimplifyCheckout, type CimplifyCheckoutProps, type CimplifyContextValue, CimplifyProvider, type CimplifyProviderProps, ElementsProvider, PaymentElement, type UseBundleOptions, type UseBundleResult, type UseCartItem, type UseCartOptions, type UseCartResult, type UseCategoriesOptions, type UseCategoriesResult, type UseCollectionOptions, type UseCollectionResult, type UseCollectionsOptions, type UseCollectionsResult, type UseCompositeOptions, type UseCompositeResult, type UseLocationsOptions, type UseLocationsResult, type UseOrderOptions, type UseOrderResult, type UseProductOptions, type UseProductResult, type UseProductsOptions, type UseProductsResult, type UseQuoteInput, type UseQuoteOptions, type UseQuoteResult, type UseSearchOptions, type UseSearchResult, useAds, useBundle, useCart, useCategories, useCheckout, useCimplify, useCollection, useCollections, useComposite, useElements, useElementsReady, useLocations, useOptionalCimplify, useOrder, useProduct, useProducts, useQuote, useSearch };