@cimplify/sdk 0.20.1 → 0.21.0

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,7 +1,7 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-BxbWrwqp.js';
3
3
  export { c as AdConfig, g as getVariantDisplayName } from './ads-BxbWrwqp.js';
4
- import { C as CimplifyClient, a7 as ProcessCheckoutResult, a9 as CheckoutStatus, aa as CheckoutStatusContext, bJ as Location, bG as Business, b1 as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, aQ as OrderStatus, bW as Service, bZ as AvailableSlot, b_ as DayAvailability, c3 as CustomerBooking, c9 as CancelBookingResult, v as ActivityStateResponse, t as SessionMessage, w as ActivityRecommendation, z as DeliveryFeeResponse, cL as FxRateResponse, bQ as StorefrontBootstrap, X as ElementsOptions, cZ as AuthenticatedData, cV as AddressInfo, cW as PaymentMethodInfo, J as CimplifyElements, c$ as ElementsCheckoutResult, a6 as ProcessCheckoutOptions, b0 as LineItem, bX as Staff } from './client-VyO6Bqz2.js';
4
+ import { C as CimplifyClient, a8 as ProcessCheckoutResult, aa as CheckoutStatus, ab as CheckoutStatusContext, bK as Location, bH as Business, k as ReorderResult, aR as OrderStatus, b2 as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, bX as Service, b_ as AvailableSlot, b$ as DayAvailability, c4 as CustomerBooking, ca as CancelBookingResult, w as ActivityStateResponse, u as SessionMessage, x as ActivityRecommendation, E as DeliveryFeeResponse, cM as FxRateResponse, bR as StorefrontBootstrap, Y as ElementsOptions, c_ as AuthenticatedData, cW as AddressInfo, cX as PaymentMethodInfo, K as CimplifyElements, d0 as ElementsCheckoutResult, a7 as ProcessCheckoutOptions, b1 as LineItem, bY as Staff } from './client-DjrlvxW7.js';
5
5
  import { J as Product, d as Pagination, h as CimplifyError, L as ProductWithDetails, a5 as Category, M as Money, b0 as BundleSelectionInput, av as ComponentSelectionInput, b3 as BundleSelectionData, b6 as CompositeSelectionData, a7 as Collection, aD as ProductTaxonomy, aE as TaxonomyWithChildren, aC as ProductTimeProfile, aH as Deal, aI as ProductDealInfo, aJ as DiscountValidation, ac as BundleSummary, aw as CompositePriceResult, y as CustomAttributeDefinition, G as PropertyFacet, bI as ProductBillingPlan, N as VariantView, W as VariantAxisWithValues, a as CurrencyCode, a1 as AddOnWithOptions, ah as BundleComponentView, aa as BundlePriceType, as as CompositeGroupView, bb as DisplayCart } from './payment-CKqMU4xT.js';
6
6
  import { P as ProductWithPrice } from './price-e4beObLZ.js';
7
7
  import { ClassValue } from 'clsx';
@@ -251,6 +251,7 @@ interface UseCartResult {
251
251
  updateQuantity: (itemId: string, quantity: number) => Promise<void>;
252
252
  clearCart: () => Promise<void>;
253
253
  sync: () => Promise<void>;
254
+ reorder: (orderId: string) => Promise<ReorderResult>;
254
255
  }
255
256
  declare function useCart(options?: UseCartOptions): UseCartResult;
256
257
 
@@ -259,12 +260,14 @@ interface UseOrderOptions {
259
260
  pollInterval?: number;
260
261
  enabled?: boolean;
261
262
  client?: CimplifyClient;
263
+ onStatusChange?: (previousStatus: OrderStatus, newStatus: OrderStatus, order: Order) => void;
262
264
  }
263
265
  interface UseOrderResult {
264
266
  order: Order | null;
265
267
  isLoading: boolean;
266
268
  error: CimplifyError | null;
267
269
  refetch: () => Promise<void>;
270
+ isTerminal: boolean;
268
271
  }
269
272
  declare function useOrder(orderId: string | null | undefined, options?: UseOrderOptions): UseOrderResult;
270
273
 
@@ -1349,6 +1352,7 @@ interface OrderSummaryClassNames {
1349
1352
  bundleBreakdown?: string;
1350
1353
  compositeBreakdown?: string;
1351
1354
  trackingLink?: string;
1355
+ reorderButton?: string;
1352
1356
  }
1353
1357
  interface OrderSummaryProps {
1354
1358
  /** Pass an Order object directly (skips fetch). */
@@ -1359,6 +1363,10 @@ interface OrderSummaryProps {
1359
1363
  poll?: boolean;
1360
1364
  /** Custom line item renderer. */
1361
1365
  renderLineItem?: (item: LineItem) => React.ReactNode;
1366
+ /** Called when the reorder button is clicked. */
1367
+ onReorder?: (order: Order) => void;
1368
+ /** Called when the order status changes during polling. */
1369
+ onStatusChange?: (previousStatus: OrderStatus, newStatus: OrderStatus, order: Order) => void;
1362
1370
  className?: string;
1363
1371
  classNames?: OrderSummaryClassNames;
1364
1372
  }
@@ -1368,7 +1376,7 @@ interface OrderSummaryProps {
1368
1376
  * Accepts either a pre-loaded `order` object or an `orderId` to fetch.
1369
1377
  * Supports polling for live status updates.
1370
1378
  */
1371
- declare function OrderSummary({ order: orderProp, orderId, poll, renderLineItem, className, classNames, }: OrderSummaryProps): React.ReactElement;
1379
+ declare function OrderSummary({ order: orderProp, orderId, poll, renderLineItem, onReorder, onStatusChange, className, classNames, }: OrderSummaryProps): React.ReactElement;
1372
1380
 
1373
1381
  interface OrderHistoryClassNames {
1374
1382
  root?: string;
@@ -1379,6 +1387,7 @@ interface OrderHistoryClassNames {
1379
1387
  total?: string;
1380
1388
  empty?: string;
1381
1389
  loading?: string;
1390
+ reorderButton?: string;
1382
1391
  }
1383
1392
  interface OrderHistoryProps {
1384
1393
  /** Override orders (skips fetch). For SSR, pass pre-fetched orders. */
@@ -1391,6 +1400,8 @@ interface OrderHistoryProps {
1391
1400
  onOrderClick?: (order: Order) => void;
1392
1401
  /** Custom order row renderer. */
1393
1402
  renderOrder?: (order: Order) => React.ReactNode;
1403
+ /** Called when the reorder button is clicked. If provided, a reorder button is rendered. */
1404
+ onReorder?: (order: Order) => void;
1394
1405
  /** Text shown when empty. */
1395
1406
  emptyMessage?: string;
1396
1407
  className?: string;
@@ -1401,7 +1412,7 @@ interface OrderHistoryProps {
1401
1412
  *
1402
1413
  * Fetches via `useOrders` unless pre-loaded orders are passed.
1403
1414
  */
1404
- declare function OrderHistory({ orders: ordersProp, status, limit, onOrderClick, renderOrder, emptyMessage, className, classNames, }: OrderHistoryProps): React.ReactElement;
1415
+ declare function OrderHistory({ orders: ordersProp, status, limit, onOrderClick, renderOrder, onReorder, emptyMessage, className, classNames, }: OrderHistoryProps): React.ReactElement;
1405
1416
 
1406
1417
  interface StoreNavClassNames {
1407
1418
  root?: string;
@@ -1894,6 +1905,10 @@ interface OrderDetailPageProps {
1894
1905
  onBack?: () => void;
1895
1906
  /** Custom line item renderer. */
1896
1907
  renderLineItem?: (item: LineItem) => React.ReactNode;
1908
+ /** Called when the reorder button is clicked. */
1909
+ onReorder?: (order: Order) => void;
1910
+ /** Called when the order status changes during polling. */
1911
+ onStatusChange?: (previousStatus: OrderStatus, newStatus: OrderStatus, order: Order) => void;
1897
1912
  /** Back button label. */
1898
1913
  backLabel?: string;
1899
1914
  className?: string;
@@ -1904,7 +1919,7 @@ interface OrderDetailPageProps {
1904
1919
  *
1905
1920
  * SSR-friendly: pass `order` prop for server rendering.
1906
1921
  */
1907
- declare function OrderDetailPage({ orderId, order, poll, onBack, renderLineItem, backLabel, className, classNames, }: OrderDetailPageProps): React.ReactElement;
1922
+ declare function OrderDetailPage({ orderId, order, poll, onBack, renderLineItem, onReorder, onStatusChange, backLabel, className, classNames, }: OrderDetailPageProps): React.ReactElement;
1908
1923
 
1909
1924
  interface OrderHistoryPageClassNames {
1910
1925
  root?: string;
@@ -1925,6 +1940,8 @@ interface OrderHistoryPageProps {
1925
1940
  limit?: number;
1926
1941
  /** Called when navigating to an order detail (e.g. for routing). */
1927
1942
  onOrderNavigate?: (order: Order) => void;
1943
+ /** Called when the reorder button is clicked. */
1944
+ onReorder?: (order: Order) => void;
1928
1945
  /** Show status filter tabs. Default: true. */
1929
1946
  showFilters?: boolean;
1930
1947
  /** Custom order row renderer. */
@@ -1938,7 +1955,7 @@ interface OrderHistoryPageProps {
1938
1955
  * SSR-friendly: pass `orders` prop for server rendering.
1939
1956
  * Supports both inline detail view and external navigation via `onOrderNavigate`.
1940
1957
  */
1941
- declare function OrderHistoryPage({ title, orders: ordersProp, limit, onOrderNavigate, showFilters, renderOrder, className, classNames, }: OrderHistoryPageProps): React.ReactElement;
1958
+ declare function OrderHistoryPage({ title, orders: ordersProp, limit, onOrderNavigate, onReorder, showFilters, renderOrder, className, classNames, }: OrderHistoryPageProps): React.ReactElement;
1942
1959
 
1943
1960
  interface SearchPageClassNames {
1944
1961
  root?: string;