@cimplify/sdk 0.6.6 → 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.
package/dist/react.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { C as CimplifyClient, _ as ProcessCheckoutResult, a0 as CheckoutStatus, a1 as CheckoutStatusContext, cT as Location, cQ as Business, u as CimplifyElements, y as ElementsOptions, eh as AuthenticatedData, ed as AddressInfo, ee as PaymentMethodInfo, ej as ElementsCheckoutResult, Z as ProcessCheckoutOptions } from './client-CjqNbEM6.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';
2
2
  import React, { ReactNode } from 'react';
3
3
  import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-t3FBTU8p.js';
4
4
  export { c as AdConfig } from './ads-t3FBTU8p.js';
5
- import './payment-D-u3asA8.js';
5
+ import { e as CimplifyError } from './payment-pjpfIKX8.js';
6
6
 
7
7
  interface UserIdentity {
8
8
  uid: string;
@@ -94,6 +94,132 @@ interface CimplifyProviderProps {
94
94
  }
95
95
  declare function CimplifyProvider({ client, children, onLocationChange, }: CimplifyProviderProps): React.ReactElement;
96
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;
97
223
 
98
224
  declare function useElements(): CimplifyElements | null;
99
225
  declare function useElementsReady(): boolean;
@@ -151,4 +277,4 @@ declare function useCheckout(): {
151
277
  isLoading: boolean;
152
278
  };
153
279
 
154
- export { Ad, AdPosition, type AdProps, AdProvider, AdSlot, AddressElement, AuthElement, CimplifyCheckout, type CimplifyCheckoutProps, type CimplifyContextValue, CimplifyProvider, type CimplifyProviderProps, ElementsProvider, PaymentElement, useAds, useCheckout, useCimplify, 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 };