@cimplify/sdk 0.87.0 → 0.89.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.
Files changed (50) hide show
  1. package/dist/advanced.d.mts +3 -3
  2. package/dist/advanced.d.ts +3 -3
  3. package/dist/advanced.js +20 -20
  4. package/dist/advanced.mjs +1 -1
  5. package/dist/{chunk-RCGSHS2Q.mjs → chunk-DENWOZEA.mjs} +51 -12
  6. package/dist/{chunk-FWEF2DHR.js → chunk-GHFDYM5K.js} +66 -10
  7. package/dist/{chunk-PWDX5N2M.js → chunk-JHJTXAPS.js} +2 -2
  8. package/dist/{chunk-J7JDCPNW.mjs → chunk-M4ALCELT.mjs} +1 -1
  9. package/dist/{chunk-P3352VXA.js → chunk-T2CJ67QV.js} +87 -48
  10. package/dist/{chunk-U57TYZLD.mjs → chunk-ZU4ZRYUR.mjs} +66 -10
  11. package/dist/{client-BMOdyC1F.d.mts → client-CAY2NbRG.d.mts} +2 -2
  12. package/dist/{client-BvWtk822.d.ts → client-CUbwb6Om.d.ts} +2 -2
  13. package/dist/{client-BIt37FjS.d.mts → client-CqZgdUtw.d.ts} +33 -7
  14. package/dist/{client-Dfl6WY2F.d.ts → client-D8ZFs-sq.d.mts} +33 -7
  15. package/dist/{index-DW6JifS1.d.ts → index-Bc5qUxAt.d.ts} +3 -3
  16. package/dist/{index-BxOJ3BLn.d.mts → index-CmWOz9bi.d.mts} +3 -3
  17. package/dist/index.d.mts +6 -6
  18. package/dist/index.d.ts +6 -6
  19. package/dist/index.js +69 -69
  20. package/dist/index.mjs +3 -3
  21. package/dist/{payment-CLp__KpE.d.mts → payment-Dcgb9n1n.d.mts} +1 -1
  22. package/dist/{payment-DJrvivO_.d.ts → payment-Xq0WDZXh.d.ts} +1 -1
  23. package/dist/{price-Ddk8Vr8z.d.mts → price--Ma_WO5_.d.mts} +1 -1
  24. package/dist/{price-B7_UzClY.d.ts → price-DAAjKgAp.d.ts} +1 -1
  25. package/dist/{product-C0Lr81ze.d.mts → product-BakHcsP2.d.mts} +33 -2
  26. package/dist/{product-C0Lr81ze.d.ts → product-BakHcsP2.d.ts} +33 -2
  27. package/dist/react.d.mts +4 -4
  28. package/dist/react.d.ts +4 -4
  29. package/dist/react.js +36 -21
  30. package/dist/react.mjs +22 -7
  31. package/dist/{server-P2G43ENi.d.ts → server-Bei5lBrc.d.ts} +1 -1
  32. package/dist/{server-0TnEJt8U.d.mts → server-Bk_hlefX.d.mts} +1 -1
  33. package/dist/server.d.mts +4 -4
  34. package/dist/server.d.ts +4 -4
  35. package/dist/server.js +7 -7
  36. package/dist/server.mjs +2 -2
  37. package/dist/styles.css +1 -1
  38. package/dist/testing/msw.d.mts +2 -2
  39. package/dist/testing/msw.d.ts +2 -2
  40. package/dist/testing/suite.d.mts +6 -6
  41. package/dist/testing/suite.d.ts +6 -6
  42. package/dist/testing/suite.js +22 -22
  43. package/dist/testing/suite.mjs +3 -3
  44. package/dist/testing.d.mts +5 -5
  45. package/dist/testing.d.ts +5 -5
  46. package/dist/testing.js +78 -78
  47. package/dist/testing.mjs +4 -4
  48. package/dist/utils.d.mts +4 -4
  49. package/dist/utils.d.ts +4 -4
  50. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { aO as Money, ad as CurrencyCode } from './product-C0Lr81ze.js';
1
+ import { aO as Money, ad as CurrencyCode } from './product-BakHcsP2.js';
2
2
 
3
3
  type PaymentStatus = "initialized" | "pending" | "processing" | "authorized" | "captured" | "failed" | "cancelled" | "refunded" | "unknown" | "voided" | "requires_action" | "abandoned" | "reversed" | "disputed" | "refund_pending";
4
4
  type PaymentProvider = "stripe" | "paystack" | "cellulant" | "mtn_momo" | "offline" | "mtn" | "vodafone" | "airtel" | "cash" | "manual";
@@ -1,4 +1,4 @@
1
- import { ad as CurrencyCode, U as ChosenPrice, bi as SaleInfo, bD as UpcomingSale } from './product-C0Lr81ze.mjs';
1
+ import { ad as CurrencyCode, U as ChosenPrice, bi as SaleInfo, bD as UpcomingSale } from './product-BakHcsP2.mjs';
2
2
 
3
3
  interface ProductWithPrice {
4
4
  price_info?: ChosenPrice;
@@ -1,4 +1,4 @@
1
- import { ad as CurrencyCode, U as ChosenPrice, bi as SaleInfo, bD as UpcomingSale } from './product-C0Lr81ze.js';
1
+ import { ad as CurrencyCode, U as ChosenPrice, bi as SaleInfo, bD as UpcomingSale } from './product-BakHcsP2.js';
2
2
 
3
3
  interface ProductWithPrice {
4
4
  price_info?: ChosenPrice;
@@ -1005,6 +1005,24 @@ interface components {
1005
1005
  zip_code: string;
1006
1006
  };
1007
1007
  };
1008
+ /**
1009
+ * @description Business-wide defaults for the auto-pricing engine. Products and variants
1010
+ * override `default_markup_pct`; everything else is the fallback for a business
1011
+ * that hasn't tuned per-item.
1012
+ */
1013
+ AutoPricingPreferences: {
1014
+ /**
1015
+ * @description Fallback markup percent applied over cost when a product sets none.
1016
+ * `None` means no business-wide default — suggestions rely on per-product markup.
1017
+ */
1018
+ default_markup_pct?: string | null;
1019
+ /** @description Suggested prices round to the nearest multiple of this amount. */
1020
+ rounding_increment?: string;
1021
+ /** @description When a delivery lowers cost, also suggest lowering the price. Off keeps the margin. */
1022
+ suggest_on_cost_drop?: boolean;
1023
+ /** @description Apply suggestions on receipt without a review step. */
1024
+ apply_automatically?: boolean;
1025
+ };
1008
1026
  AutocompletePrediction: {
1009
1027
  description: string;
1010
1028
  place_id: string;
@@ -2246,7 +2264,7 @@ interface components {
2246
2264
  };
2247
2265
  CustomerInputEntry: {
2248
2266
  field_id: string;
2249
- value: Record<string, never>;
2267
+ value: unknown;
2250
2268
  };
2251
2269
  CustomerInputValue: {
2252
2270
  field_id: string;
@@ -2659,6 +2677,8 @@ interface components {
2659
2677
  InventoryPreferences: {
2660
2678
  /** @description Basic inventory tracking settings */
2661
2679
  tracking: components["schemas"]["InventoryTrackingPreferences"];
2680
+ /** @description Markup-driven selling-price suggestions when a delivery changes cost */
2681
+ auto_pricing?: components["schemas"]["AutoPricingPreferences"];
2662
2682
  };
2663
2683
  /** @description Information about inventory status */
2664
2684
  InventoryStatus: {
@@ -2987,6 +3007,8 @@ interface components {
2987
3007
  * enable POS without enabling `tap`, and vice versa.
2988
3008
  */
2989
3009
  pos?: boolean;
3010
+ /** @description Daily takings view + cash-drawer reconciliation (till sessions). */
3011
+ takings?: boolean;
2990
3012
  customers: boolean;
2991
3013
  locations: boolean;
2992
3014
  tables: boolean;
@@ -3236,6 +3258,12 @@ interface components {
3236
3258
  balance_due: string;
3237
3259
  deposit_required: boolean;
3238
3260
  deposit_amount: string;
3261
+ /**
3262
+ * @description True when the order has a settled payment whose provider can no longer
3263
+ * refund it (direct-to-bank T+1), so a refund must be recorded out of band.
3264
+ * Computed on the single-order detail view only (false elsewhere).
3265
+ */
3266
+ manual_refund_required?: boolean;
3239
3267
  };
3240
3268
  PaymentMethodPreferences: {
3241
3269
  /** @description Cash payment settings */
@@ -3418,6 +3446,7 @@ interface components {
3418
3446
  allergies?: string[] | null;
3419
3447
  recipe: Record<string, never>;
3420
3448
  is_active: boolean;
3449
+ is_archived?: boolean | null;
3421
3450
  /** Format: date-time */
3422
3451
  created_at: string;
3423
3452
  /** Format: date-time */
@@ -3534,6 +3563,8 @@ interface components {
3534
3563
  display_mode?: null | components["schemas"]["DisplayMode"];
3535
3564
  /** Format: int32 */
3536
3565
  min_order_quantity?: number | null;
3566
+ default_markup_pct?: string | null;
3567
+ auto_apply_markup: boolean;
3537
3568
  };
3538
3569
  ProductAvailabilityNowView: {
3539
3570
  is_available: boolean;
@@ -4031,7 +4062,7 @@ interface components {
4031
4062
  * is in Autopilot mode.
4032
4063
  * `client_id` is a widget-supplied idempotency key; passed through to
4033
4064
  * `CreateMessage.external_id`, so a retried POST with the same id
4034
- * returns 409 instead of inserting twice.
4065
+ * returns the originally created message instead of inserting twice.
4035
4066
  */
4036
4067
  SendMessageBody: {
4037
4068
  content: string;
@@ -1005,6 +1005,24 @@ interface components {
1005
1005
  zip_code: string;
1006
1006
  };
1007
1007
  };
1008
+ /**
1009
+ * @description Business-wide defaults for the auto-pricing engine. Products and variants
1010
+ * override `default_markup_pct`; everything else is the fallback for a business
1011
+ * that hasn't tuned per-item.
1012
+ */
1013
+ AutoPricingPreferences: {
1014
+ /**
1015
+ * @description Fallback markup percent applied over cost when a product sets none.
1016
+ * `None` means no business-wide default — suggestions rely on per-product markup.
1017
+ */
1018
+ default_markup_pct?: string | null;
1019
+ /** @description Suggested prices round to the nearest multiple of this amount. */
1020
+ rounding_increment?: string;
1021
+ /** @description When a delivery lowers cost, also suggest lowering the price. Off keeps the margin. */
1022
+ suggest_on_cost_drop?: boolean;
1023
+ /** @description Apply suggestions on receipt without a review step. */
1024
+ apply_automatically?: boolean;
1025
+ };
1008
1026
  AutocompletePrediction: {
1009
1027
  description: string;
1010
1028
  place_id: string;
@@ -2246,7 +2264,7 @@ interface components {
2246
2264
  };
2247
2265
  CustomerInputEntry: {
2248
2266
  field_id: string;
2249
- value: Record<string, never>;
2267
+ value: unknown;
2250
2268
  };
2251
2269
  CustomerInputValue: {
2252
2270
  field_id: string;
@@ -2659,6 +2677,8 @@ interface components {
2659
2677
  InventoryPreferences: {
2660
2678
  /** @description Basic inventory tracking settings */
2661
2679
  tracking: components["schemas"]["InventoryTrackingPreferences"];
2680
+ /** @description Markup-driven selling-price suggestions when a delivery changes cost */
2681
+ auto_pricing?: components["schemas"]["AutoPricingPreferences"];
2662
2682
  };
2663
2683
  /** @description Information about inventory status */
2664
2684
  InventoryStatus: {
@@ -2987,6 +3007,8 @@ interface components {
2987
3007
  * enable POS without enabling `tap`, and vice versa.
2988
3008
  */
2989
3009
  pos?: boolean;
3010
+ /** @description Daily takings view + cash-drawer reconciliation (till sessions). */
3011
+ takings?: boolean;
2990
3012
  customers: boolean;
2991
3013
  locations: boolean;
2992
3014
  tables: boolean;
@@ -3236,6 +3258,12 @@ interface components {
3236
3258
  balance_due: string;
3237
3259
  deposit_required: boolean;
3238
3260
  deposit_amount: string;
3261
+ /**
3262
+ * @description True when the order has a settled payment whose provider can no longer
3263
+ * refund it (direct-to-bank T+1), so a refund must be recorded out of band.
3264
+ * Computed on the single-order detail view only (false elsewhere).
3265
+ */
3266
+ manual_refund_required?: boolean;
3239
3267
  };
3240
3268
  PaymentMethodPreferences: {
3241
3269
  /** @description Cash payment settings */
@@ -3418,6 +3446,7 @@ interface components {
3418
3446
  allergies?: string[] | null;
3419
3447
  recipe: Record<string, never>;
3420
3448
  is_active: boolean;
3449
+ is_archived?: boolean | null;
3421
3450
  /** Format: date-time */
3422
3451
  created_at: string;
3423
3452
  /** Format: date-time */
@@ -3534,6 +3563,8 @@ interface components {
3534
3563
  display_mode?: null | components["schemas"]["DisplayMode"];
3535
3564
  /** Format: int32 */
3536
3565
  min_order_quantity?: number | null;
3566
+ default_markup_pct?: string | null;
3567
+ auto_apply_markup: boolean;
3537
3568
  };
3538
3569
  ProductAvailabilityNowView: {
3539
3570
  is_available: boolean;
@@ -4031,7 +4062,7 @@ interface components {
4031
4062
  * is in Autopilot mode.
4032
4063
  * `client_id` is a widget-supplied idempotency key; passed through to
4033
4064
  * `CreateMessage.external_id`, so a retried POST with the same id
4034
- * returns 409 instead of inserting twice.
4065
+ * returns the originally created message instead of inserting twice.
4035
4066
  */
4036
4067
  SendMessageBody: {
4037
4068
  content: string;
package/dist/react.d.mts CHANGED
@@ -1,13 +1,13 @@
1
1
  import React$1, { ReactNode } from 'react';
2
2
  import { d as AdSlot, c as AdPosition, a as AdContextValue, S as SignInOptions } from './sign-in-DQlIdqsi.mjs';
3
3
  export { A as AdConfig, g as getVariantDisplayName } from './sign-in-DQlIdqsi.mjs';
4
- import { ac as CimplifyClient, c4 as OrderType, cp as ProcessCheckoutResult, a9 as CheckoutStatus, aa as CheckoutStatusContext, aW as EnrichedOrderItem, aV as EnrichedOrder, w as Business, bt as Location, cG as ReorderResult, c2 as OrderStatus, bJ as Order, cr as QuoteBundleSelectionInput, cs as QuoteCompositeSelectionInput, cl as PriceQuote, cv as QuoteUiMessage, d0 as Service, r as AvailableSlot, au as DayAvailability, am as CustomerBooking, L as CancelBookingResult, f as ActivityStateResponse, d9 as SessionMessage, c as ActivityRecommendation, aw as DeliveryFeeResponse, ay as DeliveryOptionsResponse, b8 as FxRateResponse, di as StoreCreditBalance, dk as StorefrontBootstrap, X as ChatWidgetStarter, W as ChatMessage, h as AddressInfo, n as AuthenticatedData, aU as ElementsOptions, cf as PaymentMethodInfo, aS as ElementsCheckoutResult, co as ProcessCheckoutOptions, af as CimplifyElements, bk as LineItem, dc as Staff, cX as Room } from './client-BIt37FjS.mjs';
4
+ import { ac as CimplifyClient, c4 as OrderType, cp as ProcessCheckoutResult, a9 as CheckoutStatus, aa as CheckoutStatusContext, aW as EnrichedOrderItem, aV as EnrichedOrder, w as Business, bt as Location, cG as ReorderResult, c2 as OrderStatus, bJ as Order, cr as QuoteBundleSelectionInput, cs as QuoteCompositeSelectionInput, cl as PriceQuote, cv as QuoteUiMessage, d0 as Service, r as AvailableSlot, au as DayAvailability, am as CustomerBooking, L as CancelBookingResult, f as ActivityStateResponse, d9 as SessionMessage, c as ActivityRecommendation, aw as DeliveryFeeResponse, ay as DeliveryOptionsResponse, b8 as FxRateResponse, di as StoreCreditBalance, dk as StorefrontBootstrap, X as ChatWidgetStarter, W as ChatMessage, h as AddressInfo, n as AuthenticatedData, aU as ElementsOptions, cf as PaymentMethodInfo, aS as ElementsCheckoutResult, co as ProcessCheckoutOptions, af as CimplifyElements, bk as LineItem, dc as Staff, cX as Room } from './client-D8ZFs-sq.mjs';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
- import { ad as CurrencyCode, aZ as Product, aQ as Pagination, V as CimplifyError, bb as ProductWithDetails, S as Category, aO as Money, E as BundleSelectionInput, a1 as ComponentSelectionInput, D as BundleSelectionData, aa as CompositeSelectionData, W as Collection, b6 as ProductTaxonomy, bx as TaxonomyWithChildren, b7 as ProductTimeProfile, aj as Deal, b2 as ProductDealInfo, ap as DiscountValidation, G as BundleSummary, a8 as CompositePriceResult, bs as SubscriptionWithDetails, br as SubscriptionStatus, bo as Subscription, ae as CustomAttributeDefinition, bc as PropertyFacet, b1 as ProductBillingPlan, bQ as VariantView, bK as VariantAxisWithValues, f as AddOnWithOptions, y as BundleComponentView, z as BundlePriceType, a6 as CompositeGroupView, as as DisplayCart, b3 as ProductInputField, bi as SaleInfo, bD as UpcomingSale, av as DurationUnit, t as BoundaryKind, bk as SchedulingMode, al as DepositType, af as CustomAttributeValue, b4 as ProductProperty, be as QuantityPricingTier } from './product-C0Lr81ze.mjs';
7
- import { P as ProductWithPrice } from './price-Ddk8Vr8z.mjs';
6
+ import { ad as CurrencyCode, aZ as Product, aQ as Pagination, V as CimplifyError, bb as ProductWithDetails, S as Category, aO as Money, E as BundleSelectionInput, a1 as ComponentSelectionInput, D as BundleSelectionData, aa as CompositeSelectionData, W as Collection, b6 as ProductTaxonomy, bx as TaxonomyWithChildren, b7 as ProductTimeProfile, aj as Deal, b2 as ProductDealInfo, ap as DiscountValidation, G as BundleSummary, a8 as CompositePriceResult, bs as SubscriptionWithDetails, br as SubscriptionStatus, bo as Subscription, ae as CustomAttributeDefinition, bc as PropertyFacet, b1 as ProductBillingPlan, bQ as VariantView, bK as VariantAxisWithValues, f as AddOnWithOptions, y as BundleComponentView, z as BundlePriceType, a6 as CompositeGroupView, as as DisplayCart, b3 as ProductInputField, bi as SaleInfo, bD as UpcomingSale, av as DurationUnit, t as BoundaryKind, bk as SchedulingMode, al as DepositType, af as CustomAttributeValue, b4 as ProductProperty, be as QuantityPricingTier } from './product-BakHcsP2.mjs';
7
+ import { P as ProductWithPrice } from './price--Ma_WO5_.mjs';
8
8
  import { ClassValue } from 'clsx';
9
9
  import { Matcher } from 'react-day-picker';
10
- import './payment-CLp__KpE.mjs';
10
+ import './payment-Dcgb9n1n.mjs';
11
11
 
12
12
  interface UserIdentity {
13
13
  uid: string;
package/dist/react.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import React$1, { ReactNode } from 'react';
2
2
  import { d as AdSlot, c as AdPosition, a as AdContextValue, S as SignInOptions } from './sign-in-DQlIdqsi.js';
3
3
  export { A as AdConfig, g as getVariantDisplayName } from './sign-in-DQlIdqsi.js';
4
- import { ac as CimplifyClient, c4 as OrderType, cp as ProcessCheckoutResult, a9 as CheckoutStatus, aa as CheckoutStatusContext, aW as EnrichedOrderItem, aV as EnrichedOrder, w as Business, bt as Location, cG as ReorderResult, c2 as OrderStatus, bJ as Order, cr as QuoteBundleSelectionInput, cs as QuoteCompositeSelectionInput, cl as PriceQuote, cv as QuoteUiMessage, d0 as Service, r as AvailableSlot, au as DayAvailability, am as CustomerBooking, L as CancelBookingResult, f as ActivityStateResponse, d9 as SessionMessage, c as ActivityRecommendation, aw as DeliveryFeeResponse, ay as DeliveryOptionsResponse, b8 as FxRateResponse, di as StoreCreditBalance, dk as StorefrontBootstrap, X as ChatWidgetStarter, W as ChatMessage, h as AddressInfo, n as AuthenticatedData, aU as ElementsOptions, cf as PaymentMethodInfo, aS as ElementsCheckoutResult, co as ProcessCheckoutOptions, af as CimplifyElements, bk as LineItem, dc as Staff, cX as Room } from './client-Dfl6WY2F.js';
4
+ import { ac as CimplifyClient, c4 as OrderType, cp as ProcessCheckoutResult, a9 as CheckoutStatus, aa as CheckoutStatusContext, aW as EnrichedOrderItem, aV as EnrichedOrder, w as Business, bt as Location, cG as ReorderResult, c2 as OrderStatus, bJ as Order, cr as QuoteBundleSelectionInput, cs as QuoteCompositeSelectionInput, cl as PriceQuote, cv as QuoteUiMessage, d0 as Service, r as AvailableSlot, au as DayAvailability, am as CustomerBooking, L as CancelBookingResult, f as ActivityStateResponse, d9 as SessionMessage, c as ActivityRecommendation, aw as DeliveryFeeResponse, ay as DeliveryOptionsResponse, b8 as FxRateResponse, di as StoreCreditBalance, dk as StorefrontBootstrap, X as ChatWidgetStarter, W as ChatMessage, h as AddressInfo, n as AuthenticatedData, aU as ElementsOptions, cf as PaymentMethodInfo, aS as ElementsCheckoutResult, co as ProcessCheckoutOptions, af as CimplifyElements, bk as LineItem, dc as Staff, cX as Room } from './client-CqZgdUtw.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
- import { ad as CurrencyCode, aZ as Product, aQ as Pagination, V as CimplifyError, bb as ProductWithDetails, S as Category, aO as Money, E as BundleSelectionInput, a1 as ComponentSelectionInput, D as BundleSelectionData, aa as CompositeSelectionData, W as Collection, b6 as ProductTaxonomy, bx as TaxonomyWithChildren, b7 as ProductTimeProfile, aj as Deal, b2 as ProductDealInfo, ap as DiscountValidation, G as BundleSummary, a8 as CompositePriceResult, bs as SubscriptionWithDetails, br as SubscriptionStatus, bo as Subscription, ae as CustomAttributeDefinition, bc as PropertyFacet, b1 as ProductBillingPlan, bQ as VariantView, bK as VariantAxisWithValues, f as AddOnWithOptions, y as BundleComponentView, z as BundlePriceType, a6 as CompositeGroupView, as as DisplayCart, b3 as ProductInputField, bi as SaleInfo, bD as UpcomingSale, av as DurationUnit, t as BoundaryKind, bk as SchedulingMode, al as DepositType, af as CustomAttributeValue, b4 as ProductProperty, be as QuantityPricingTier } from './product-C0Lr81ze.js';
7
- import { P as ProductWithPrice } from './price-B7_UzClY.js';
6
+ import { ad as CurrencyCode, aZ as Product, aQ as Pagination, V as CimplifyError, bb as ProductWithDetails, S as Category, aO as Money, E as BundleSelectionInput, a1 as ComponentSelectionInput, D as BundleSelectionData, aa as CompositeSelectionData, W as Collection, b6 as ProductTaxonomy, bx as TaxonomyWithChildren, b7 as ProductTimeProfile, aj as Deal, b2 as ProductDealInfo, ap as DiscountValidation, G as BundleSummary, a8 as CompositePriceResult, bs as SubscriptionWithDetails, br as SubscriptionStatus, bo as Subscription, ae as CustomAttributeDefinition, bc as PropertyFacet, b1 as ProductBillingPlan, bQ as VariantView, bK as VariantAxisWithValues, f as AddOnWithOptions, y as BundleComponentView, z as BundlePriceType, a6 as CompositeGroupView, as as DisplayCart, b3 as ProductInputField, bi as SaleInfo, bD as UpcomingSale, av as DurationUnit, t as BoundaryKind, bk as SchedulingMode, al as DepositType, af as CustomAttributeValue, b4 as ProductProperty, be as QuantityPricingTier } from './product-BakHcsP2.js';
7
+ import { P as ProductWithPrice } from './price-DAAjKgAp.js';
8
8
  import { ClassValue } from 'clsx';
9
9
  import { Matcher } from 'react-day-picker';
10
- import './payment-DJrvivO_.js';
10
+ import './payment-Xq0WDZXh.js';
11
11
 
12
12
  interface UserIdentity {
13
13
  uid: string;
package/dist/react.js CHANGED
@@ -2,8 +2,8 @@
2
2
  'use strict';
3
3
 
4
4
  var chunkT7Z25EY4_js = require('./chunk-T7Z25EY4.js');
5
- var chunkP3352VXA_js = require('./chunk-P3352VXA.js');
6
- var chunkFWEF2DHR_js = require('./chunk-FWEF2DHR.js');
5
+ var chunkT2CJ67QV_js = require('./chunk-T2CJ67QV.js');
6
+ var chunkGHFDYM5K_js = require('./chunk-GHFDYM5K.js');
7
7
  var chunkPTPOQVXS_js = require('./chunk-PTPOQVXS.js');
8
8
  var chunkAETVRBKI_js = require('./chunk-AETVRBKI.js');
9
9
  require('./chunk-OWW5GUSB.js');
@@ -1132,7 +1132,7 @@ var DEFAULT_COUNTRY = "US";
1132
1132
  function createDefaultClient() {
1133
1133
  const processRef = globalThis.process;
1134
1134
  const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
1135
- return chunkP3352VXA_js.createCimplifyClient({ publicKey: envPublicKey });
1135
+ return chunkT2CJ67QV_js.createCimplifyClient({ publicKey: envPublicKey });
1136
1136
  }
1137
1137
  function getStoredLocationId() {
1138
1138
  if (typeof window === "undefined" || !window.localStorage) {
@@ -3444,7 +3444,7 @@ function CimplifySignInButton({
3444
3444
  const onClick = async () => {
3445
3445
  if (busy || disabled || !signInOpts.clientId) return;
3446
3446
  setBusy(true);
3447
- await chunkFWEF2DHR_js.startSignIn({
3447
+ await chunkGHFDYM5K_js.startSignIn({
3448
3448
  ...signInOpts,
3449
3449
  onSuccess: () => {
3450
3450
  setBusy(false);
@@ -5905,10 +5905,9 @@ function useChat(options = {}) {
5905
5905
  return fresh.length > 0 ? [...prev, ...fresh] : prev;
5906
5906
  });
5907
5907
  }, []);
5908
- const pollMessages = React14.useCallback(async () => {
5908
+ const fetchNewMessages = React14.useCallback(async () => {
5909
5909
  const c = clientRef.current;
5910
5910
  if (!c) return;
5911
- if (Date.now() - lastActivityRef.current > IDLE_TIMEOUT_MS) return;
5912
5911
  const last = messagesRef.current[messagesRef.current.length - 1];
5913
5912
  const result = await c.support.getMessages({
5914
5913
  after: last?.created_at,
@@ -5918,6 +5917,10 @@ function useChat(options = {}) {
5918
5917
  appendMessages(result.value);
5919
5918
  }
5920
5919
  }, [appendMessages]);
5920
+ const pollMessages = React14.useCallback(async () => {
5921
+ if (Date.now() - lastActivityRef.current > IDLE_TIMEOUT_MS) return;
5922
+ await fetchNewMessages();
5923
+ }, [fetchNewMessages]);
5921
5924
  const startPolling = React14.useCallback(() => {
5922
5925
  if (pollRef.current) clearInterval(pollRef.current);
5923
5926
  const interval = Date.now() - lastActivityRef.current > IDLE_TIMEOUT_MS ? pollIdleInterval : pollInterval;
@@ -5950,6 +5953,12 @@ function useChat(options = {}) {
5950
5953
  const envelope = JSON.parse(event.data);
5951
5954
  if (envelope.type === "message.created" && envelope.data) {
5952
5955
  appendMessages([envelope.data]);
5956
+ } else if (envelope.type === "resync") {
5957
+ const latest = envelope.latest_message_at;
5958
+ const last = messagesRef.current[messagesRef.current.length - 1];
5959
+ if (latest && (!last || new Date(last.created_at).getTime() < new Date(latest).getTime())) {
5960
+ fetchNewMessages();
5961
+ }
5953
5962
  }
5954
5963
  } catch {
5955
5964
  }
@@ -5957,7 +5966,7 @@ function useChat(options = {}) {
5957
5966
  ws.onclose = () => {
5958
5967
  wsRef.current = null;
5959
5968
  if (!openedRef.current) return;
5960
- pollMessages();
5969
+ fetchNewMessages();
5961
5970
  if (wsReconnectAttemptRef.current < WS_MAX_RECONNECT_ATTEMPTS) {
5962
5971
  const attempt = wsReconnectAttemptRef.current++;
5963
5972
  const delay = Math.min(1e3 * Math.pow(2, attempt) + Math.random() * 500, 3e4);
@@ -5969,7 +5978,7 @@ function useChat(options = {}) {
5969
5978
  ws.onerror = () => {
5970
5979
  };
5971
5980
  wsRef.current = ws;
5972
- }, [appendMessages, startPolling, stopPolling, pollMessages]);
5981
+ }, [appendMessages, startPolling, stopPolling, fetchNewMessages]);
5973
5982
  React14.useEffect(() => {
5974
5983
  return () => {
5975
5984
  if (pollRef.current) clearInterval(pollRef.current);
@@ -6019,8 +6028,14 @@ function useChat(options = {}) {
6019
6028
  setIsSending(true);
6020
6029
  const result = await client.support.sendMessage(content.trim());
6021
6030
  if (result.ok) {
6031
+ const confirmed = result.value;
6022
6032
  setMessages(
6023
- (prev) => prev.map((m) => m.id === optimisticId ? result.value : m)
6033
+ (prev) => (
6034
+ // The websocket may have already streamed the confirmed message
6035
+ // in while the POST was in flight; drop the optimistic bubble
6036
+ // instead of inserting a duplicate.
6037
+ prev.some((m) => m.id === confirmed.id) ? prev.filter((m) => m.id !== optimisticId) : prev.map((m) => m.id === optimisticId ? confirmed : m)
6038
+ )
6024
6039
  );
6025
6040
  } else {
6026
6041
  setMessages((prev) => prev.filter((m) => m.id !== optimisticId));
@@ -6121,15 +6136,15 @@ function AuthElement({
6121
6136
  }, [onReady, onAuthenticated, onError]);
6122
6137
  React14.useEffect(() => {
6123
6138
  if (!elements || !containerRef.current) return;
6124
- const element = elements.create(chunkFWEF2DHR_js.ELEMENT_TYPES.AUTH, { prefillEmail });
6139
+ const element = elements.create(chunkGHFDYM5K_js.ELEMENT_TYPES.AUTH, { prefillEmail });
6125
6140
  elementRef.current = element;
6126
- element.on(chunkFWEF2DHR_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
6141
+ element.on(chunkGHFDYM5K_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
6127
6142
  element.on(
6128
- chunkFWEF2DHR_js.EVENT_TYPES.AUTHENTICATED,
6143
+ chunkGHFDYM5K_js.EVENT_TYPES.AUTHENTICATED,
6129
6144
  (data) => onAuthenticatedRef.current?.(data)
6130
6145
  );
6131
6146
  element.on(
6132
- chunkFWEF2DHR_js.EVENT_TYPES.ERROR,
6147
+ chunkGHFDYM5K_js.EVENT_TYPES.ERROR,
6133
6148
  (data) => onErrorRef.current?.(data)
6134
6149
  );
6135
6150
  element.mount(containerRef.current);
@@ -6158,15 +6173,15 @@ function AddressElement({
6158
6173
  }, [onReady, onChange, onError]);
6159
6174
  React14.useEffect(() => {
6160
6175
  if (!elements || !containerRef.current) return;
6161
- const element = elements.create(chunkFWEF2DHR_js.ELEMENT_TYPES.ADDRESS, { mode });
6176
+ const element = elements.create(chunkGHFDYM5K_js.ELEMENT_TYPES.ADDRESS, { mode });
6162
6177
  elementRef.current = element;
6163
- element.on(chunkFWEF2DHR_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
6178
+ element.on(chunkGHFDYM5K_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
6164
6179
  element.on(
6165
- chunkFWEF2DHR_js.EVENT_TYPES.CHANGE,
6180
+ chunkGHFDYM5K_js.EVENT_TYPES.CHANGE,
6166
6181
  (data) => onChangeRef.current?.(data)
6167
6182
  );
6168
6183
  element.on(
6169
- chunkFWEF2DHR_js.EVENT_TYPES.ERROR,
6184
+ chunkGHFDYM5K_js.EVENT_TYPES.ERROR,
6170
6185
  (data) => onErrorRef.current?.(data)
6171
6186
  );
6172
6187
  element.mount(containerRef.current);
@@ -6196,15 +6211,15 @@ function PaymentElement({
6196
6211
  }, [onReady, onChange, onError]);
6197
6212
  React14.useEffect(() => {
6198
6213
  if (!elements || !containerRef.current) return;
6199
- const element = elements.create(chunkFWEF2DHR_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
6214
+ const element = elements.create(chunkGHFDYM5K_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
6200
6215
  elementRef.current = element;
6201
- element.on(chunkFWEF2DHR_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
6216
+ element.on(chunkGHFDYM5K_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
6202
6217
  element.on(
6203
- chunkFWEF2DHR_js.EVENT_TYPES.CHANGE,
6218
+ chunkGHFDYM5K_js.EVENT_TYPES.CHANGE,
6204
6219
  (data) => onChangeRef.current?.(data)
6205
6220
  );
6206
6221
  element.on(
6207
- chunkFWEF2DHR_js.EVENT_TYPES.ERROR,
6222
+ chunkGHFDYM5K_js.EVENT_TYPES.ERROR,
6208
6223
  (data) => onErrorRef.current?.(data)
6209
6224
  );
6210
6225
  element.mount(containerRef.current);
package/dist/react.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { DURATION_UNIT, getVariantDisplayName, INPUT_FIELD_TYPE, PRODUCT_TYPE, BOUNDARY_KIND, resolveGallery, RENDER_HINT, DEFAULT_CDN_BASE_URL } from './chunk-OZDDHSIB.mjs';
3
3
  export { getVariantDisplayName } from './chunk-OZDDHSIB.mjs';
4
- import { createCimplifyClient } from './chunk-RCGSHS2Q.mjs';
5
- import { ELEMENT_TYPES, EVENT_TYPES, startSignIn } from './chunk-U57TYZLD.mjs';
4
+ import { createCimplifyClient } from './chunk-DENWOZEA.mjs';
5
+ import { ELEMENT_TYPES, EVENT_TYPES, startSignIn } from './chunk-ZU4ZRYUR.mjs';
6
6
  import { parsePrice, formatMoney, formatPrice, getProductCurrency, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-KFLGQGMC.mjs';
7
7
  import { isSupportedCurrency } from './chunk-K5EN2W2Q.mjs';
8
8
  import './chunk-3G6RQLXK.mjs';
@@ -5881,10 +5881,9 @@ function useChat(options = {}) {
5881
5881
  return fresh.length > 0 ? [...prev, ...fresh] : prev;
5882
5882
  });
5883
5883
  }, []);
5884
- const pollMessages = useCallback(async () => {
5884
+ const fetchNewMessages = useCallback(async () => {
5885
5885
  const c = clientRef.current;
5886
5886
  if (!c) return;
5887
- if (Date.now() - lastActivityRef.current > IDLE_TIMEOUT_MS) return;
5888
5887
  const last = messagesRef.current[messagesRef.current.length - 1];
5889
5888
  const result = await c.support.getMessages({
5890
5889
  after: last?.created_at,
@@ -5894,6 +5893,10 @@ function useChat(options = {}) {
5894
5893
  appendMessages(result.value);
5895
5894
  }
5896
5895
  }, [appendMessages]);
5896
+ const pollMessages = useCallback(async () => {
5897
+ if (Date.now() - lastActivityRef.current > IDLE_TIMEOUT_MS) return;
5898
+ await fetchNewMessages();
5899
+ }, [fetchNewMessages]);
5897
5900
  const startPolling = useCallback(() => {
5898
5901
  if (pollRef.current) clearInterval(pollRef.current);
5899
5902
  const interval = Date.now() - lastActivityRef.current > IDLE_TIMEOUT_MS ? pollIdleInterval : pollInterval;
@@ -5926,6 +5929,12 @@ function useChat(options = {}) {
5926
5929
  const envelope = JSON.parse(event.data);
5927
5930
  if (envelope.type === "message.created" && envelope.data) {
5928
5931
  appendMessages([envelope.data]);
5932
+ } else if (envelope.type === "resync") {
5933
+ const latest = envelope.latest_message_at;
5934
+ const last = messagesRef.current[messagesRef.current.length - 1];
5935
+ if (latest && (!last || new Date(last.created_at).getTime() < new Date(latest).getTime())) {
5936
+ fetchNewMessages();
5937
+ }
5929
5938
  }
5930
5939
  } catch {
5931
5940
  }
@@ -5933,7 +5942,7 @@ function useChat(options = {}) {
5933
5942
  ws.onclose = () => {
5934
5943
  wsRef.current = null;
5935
5944
  if (!openedRef.current) return;
5936
- pollMessages();
5945
+ fetchNewMessages();
5937
5946
  if (wsReconnectAttemptRef.current < WS_MAX_RECONNECT_ATTEMPTS) {
5938
5947
  const attempt = wsReconnectAttemptRef.current++;
5939
5948
  const delay = Math.min(1e3 * Math.pow(2, attempt) + Math.random() * 500, 3e4);
@@ -5945,7 +5954,7 @@ function useChat(options = {}) {
5945
5954
  ws.onerror = () => {
5946
5955
  };
5947
5956
  wsRef.current = ws;
5948
- }, [appendMessages, startPolling, stopPolling, pollMessages]);
5957
+ }, [appendMessages, startPolling, stopPolling, fetchNewMessages]);
5949
5958
  useEffect(() => {
5950
5959
  return () => {
5951
5960
  if (pollRef.current) clearInterval(pollRef.current);
@@ -5995,8 +6004,14 @@ function useChat(options = {}) {
5995
6004
  setIsSending(true);
5996
6005
  const result = await client.support.sendMessage(content.trim());
5997
6006
  if (result.ok) {
6007
+ const confirmed = result.value;
5998
6008
  setMessages(
5999
- (prev) => prev.map((m) => m.id === optimisticId ? result.value : m)
6009
+ (prev) => (
6010
+ // The websocket may have already streamed the confirmed message
6011
+ // in while the POST was in flight; drop the optimistic bubble
6012
+ // instead of inserting a duplicate.
6013
+ prev.some((m) => m.id === confirmed.id) ? prev.filter((m) => m.id !== optimisticId) : prev.map((m) => m.id === optimisticId ? confirmed : m)
6014
+ )
6000
6015
  );
6001
6016
  } else {
6002
6017
  setMessages((prev) => prev.filter((m) => m.id !== optimisticId));
@@ -1,5 +1,5 @@
1
1
  import { Hono } from 'hono';
2
- import { b3 as ProductInputField } from './product-C0Lr81ze.js';
2
+ import { b3 as ProductInputField } from './product-BakHcsP2.js';
3
3
 
4
4
  interface Clock {
5
5
  now(): Date;
@@ -1,5 +1,5 @@
1
1
  import { Hono } from 'hono';
2
- import { b3 as ProductInputField } from './product-C0Lr81ze.mjs';
2
+ import { b3 as ProductInputField } from './product-BakHcsP2.mjs';
3
3
 
4
4
  interface Clock {
5
5
  now(): Date;
package/dist/server.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { ac as CimplifyClient } from './client-BIt37FjS.mjs';
2
- export { J as CacheOptions, cw as ReadRequestOptions, cT as Result } from './client-BIt37FjS.mjs';
3
- export { S as Category, V as CimplifyError, W as Collection, aZ as Product, bb as ProductWithDetails } from './product-C0Lr81ze.mjs';
1
+ import { ac as CimplifyClient } from './client-D8ZFs-sq.mjs';
2
+ export { J as CacheOptions, cw as ReadRequestOptions, cT as Result } from './client-D8ZFs-sq.mjs';
3
+ export { S as Category, V as CimplifyError, W as Collection, aZ as Product, bb as ProductWithDetails } from './product-BakHcsP2.mjs';
4
4
  import { JWTVerifyResult } from 'jose';
5
- import './payment-CLp__KpE.mjs';
5
+ import './payment-Dcgb9n1n.mjs';
6
6
 
7
7
  interface ServerClientOptions {
8
8
  /**
package/dist/server.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { ac as CimplifyClient } from './client-Dfl6WY2F.js';
2
- export { J as CacheOptions, cw as ReadRequestOptions, cT as Result } from './client-Dfl6WY2F.js';
3
- export { S as Category, V as CimplifyError, W as Collection, aZ as Product, bb as ProductWithDetails } from './product-C0Lr81ze.js';
1
+ import { ac as CimplifyClient } from './client-CqZgdUtw.js';
2
+ export { J as CacheOptions, cw as ReadRequestOptions, cT as Result } from './client-CqZgdUtw.js';
3
+ export { S as Category, V as CimplifyError, W as Collection, aZ as Product, bb as ProductWithDetails } from './product-BakHcsP2.js';
4
4
  import { JWTVerifyResult } from 'jose';
5
- import './payment-DJrvivO_.js';
5
+ import './payment-Xq0WDZXh.js';
6
6
 
7
7
  interface ServerClientOptions {
8
8
  /**
package/dist/server.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkP3352VXA_js = require('./chunk-P3352VXA.js');
4
- var chunkFWEF2DHR_js = require('./chunk-FWEF2DHR.js');
3
+ var chunkT2CJ67QV_js = require('./chunk-T2CJ67QV.js');
4
+ var chunkGHFDYM5K_js = require('./chunk-GHFDYM5K.js');
5
5
  require('./chunk-PTPOQVXS.js');
6
6
  var chunkAETVRBKI_js = require('./chunk-AETVRBKI.js');
7
7
  require('./chunk-OWW5GUSB.js');
@@ -26,7 +26,7 @@ function readEnv(...keys) {
26
26
  var getServerClient = react.cache((opts = {}) => {
27
27
  const baseUrl = opts.apiUrl ?? readEnv("CIMPLIFY_API_URL", "NEXT_PUBLIC_CIMPLIFY_API_URL") ?? defaultBaseUrl();
28
28
  const publicKey = opts.secretKey ?? readEnv("CIMPLIFY_SECRET_KEY", "NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY") ?? "mock-dev";
29
- const client = chunkP3352VXA_js.createCimplifyClient({
29
+ const client = chunkT2CJ67QV_js.createCimplifyClient({
30
30
  baseUrl,
31
31
  publicKey,
32
32
  suppressPublicKeyWarning: true
@@ -250,7 +250,7 @@ var QUERY_AUTH_ERROR = "cimplify_auth_error";
250
250
  var discoveryCache = /* @__PURE__ */ new Map();
251
251
  var jwksCache = /* @__PURE__ */ new Map();
252
252
  function issuerBase(cfg) {
253
- return (cfg.issuer ?? cfg.authUrl ?? chunkFWEF2DHR_js.DEFAULT_ISSUER).replace(/\/$/, "");
253
+ return (cfg.issuer ?? cfg.authUrl ?? chunkGHFDYM5K_js.DEFAULT_ISSUER).replace(/\/$/, "");
254
254
  }
255
255
  function cookieName(cfg) {
256
256
  return cfg.cookieName ?? SESSION_COOKIE;
@@ -465,12 +465,12 @@ async function handleOidcCallback(req, opts) {
465
465
  }
466
466
  function readPkceCookie(cookieHeader) {
467
467
  if (!cookieHeader) return null;
468
- const match = cookieHeader.split(/;\s*/).find((p) => p.startsWith(`${chunkFWEF2DHR_js.PKCE_COOKIE}=`));
468
+ const match = cookieHeader.split(/;\s*/).find((p) => p.startsWith(`${chunkGHFDYM5K_js.PKCE_COOKIE}=`));
469
469
  if (!match) return null;
470
- return chunkFWEF2DHR_js.decodePkceState(match.slice(chunkFWEF2DHR_js.PKCE_COOKIE.length + 1));
470
+ return chunkGHFDYM5K_js.decodePkceState(match.slice(chunkGHFDYM5K_js.PKCE_COOKIE.length + 1));
471
471
  }
472
472
  function buildPkceClearCookie() {
473
- return `${chunkFWEF2DHR_js.PKCE_COOKIE}=; Path=${chunkFWEF2DHR_js.PKCE_COOKIE_PATH}; Max-Age=0; Secure; SameSite=Lax`;
473
+ return `${chunkGHFDYM5K_js.PKCE_COOKIE}=; Path=${chunkGHFDYM5K_js.PKCE_COOKIE_PATH}; Max-Age=0; Secure; SameSite=Lax`;
474
474
  }
475
475
  function safeReturnPath(returnTo, fallback) {
476
476
  if (returnTo && returnTo.startsWith("/") && !returnTo.startsWith("//")) return returnTo;
package/dist/server.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { createCimplifyClient } from './chunk-RCGSHS2Q.mjs';
2
- import { PKCE_COOKIE, decodePkceState, PKCE_COOKIE_PATH, DEFAULT_ISSUER } from './chunk-U57TYZLD.mjs';
1
+ import { createCimplifyClient } from './chunk-DENWOZEA.mjs';
2
+ import { PKCE_COOKIE, decodePkceState, PKCE_COOKIE_PATH, DEFAULT_ISSUER } from './chunk-ZU4ZRYUR.mjs';
3
3
  import './chunk-KFLGQGMC.mjs';
4
4
  export { CimplifyError } from './chunk-K5EN2W2Q.mjs';
5
5
  import './chunk-3G6RQLXK.mjs';