@cimplify/sdk 0.83.0 → 0.85.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 (51) hide show
  1. package/dist/advanced.d.mts +3 -3
  2. package/dist/advanced.d.ts +3 -3
  3. package/dist/{chunk-ODEPW244.js → chunk-A6J7W6DH.js} +2 -2
  4. package/dist/{chunk-I6RE4BKH.mjs → chunk-DU4IX2I2.mjs} +1 -1
  5. package/dist/{chunk-PLTP6HWW.mjs → chunk-GIFVSWYJ.mjs} +18 -18
  6. package/dist/{chunk-FKBXZ2A6.js → chunk-NWTCBGJ2.js} +18 -18
  7. package/dist/{client-Cogz7C1t.d.mts → client-BEhIE0Dm.d.mts} +2 -2
  8. package/dist/{client-Cq3B-WXv.d.ts → client-BT5gaiGR.d.ts} +2 -2
  9. package/dist/{client-DnHP_2Jw.d.mts → client-DLtwQ-jI.d.mts} +2 -2
  10. package/dist/{client-xc2aQSB4.d.ts → client-WKKxIiF1.d.ts} +2 -2
  11. package/dist/{index-C4xE31-D.d.ts → index-BrC1x2kK.d.ts} +3 -3
  12. package/dist/{index-Dy8D3r9b.d.mts → index-DZz6hdrT.d.mts} +3 -3
  13. package/dist/index.d.mts +6 -6
  14. package/dist/index.d.ts +6 -6
  15. package/dist/mock/cli.mjs +657 -353
  16. package/dist/mock/library.js +18 -18
  17. package/dist/mock/library.mjs +18 -18
  18. package/dist/mock/msw.js +18 -18
  19. package/dist/mock/msw.mjs +18 -18
  20. package/dist/{payment-nH9OCUg2.d.ts → payment-D1f3ZQPC.d.ts} +1 -1
  21. package/dist/{payment-T_0MUE9o.d.mts → payment-Dh-6cRcV.d.mts} +1 -1
  22. package/dist/{price-Bg7hujK_.d.mts → price-4T7dlhxM.d.mts} +5 -1
  23. package/dist/{price-B8WMoldA.d.ts → price-CQdOJoX-.d.ts} +5 -1
  24. package/dist/{product-DXhjLQ_w.d.mts → product-RJMIdCAf.d.mts} +39 -2
  25. package/dist/{product-DXhjLQ_w.d.ts → product-RJMIdCAf.d.ts} +39 -2
  26. package/dist/react.d.mts +51 -5
  27. package/dist/react.d.ts +51 -5
  28. package/dist/react.js +137 -27
  29. package/dist/react.mjs +136 -28
  30. package/dist/{server-DaovvB9J.d.mts → server-DjK98UW-.d.mts} +1 -1
  31. package/dist/{server-ZGCyuz4V.d.ts → server-DvThXldo.d.ts} +1 -1
  32. package/dist/server.d.mts +4 -4
  33. package/dist/server.d.ts +4 -4
  34. package/dist/styles.css +1 -1
  35. package/dist/testing/msw.d.mts +2 -2
  36. package/dist/testing/msw.d.ts +2 -2
  37. package/dist/testing/msw.js +2 -2
  38. package/dist/testing/msw.mjs +1 -1
  39. package/dist/testing/suite.d.mts +6 -6
  40. package/dist/testing/suite.d.ts +6 -6
  41. package/dist/testing/suite.js +21 -21
  42. package/dist/testing/suite.mjs +2 -2
  43. package/dist/testing.d.mts +20 -20
  44. package/dist/testing.d.ts +20 -20
  45. package/dist/testing.js +77 -77
  46. package/dist/testing.mjs +3 -3
  47. package/dist/utils.d.mts +4 -4
  48. package/dist/utils.d.ts +4 -4
  49. package/package.json +21 -21
  50. package/registry/default-product-layout.json +1 -1
  51. package/registry/retail-product-card.json +1 -1
package/dist/react.js CHANGED
@@ -3442,7 +3442,7 @@ function CimplifySignInButton({
3442
3442
  }) {
3443
3443
  const [busy, setBusy] = React14.useState(false);
3444
3444
  const onClick = async () => {
3445
- if (busy || disabled) return;
3445
+ if (busy || disabled || !signInOpts.clientId) return;
3446
3446
  setBusy(true);
3447
3447
  await chunkHPN5R3K2_js.startSignIn({
3448
3448
  ...signInOpts,
@@ -4155,14 +4155,13 @@ function CimplifyUserButton({
4155
4155
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("inline-flex items-center", className), "data-cimplify-user-button": "loading", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-8 rounded-full bg-muted/60 animate-pulse" }) });
4156
4156
  }
4157
4157
  if (!session) {
4158
- if (!clientId || !redirectUri) return null;
4159
4158
  return /* @__PURE__ */ jsxRuntime.jsx(
4160
4159
  CimplifySignInButton,
4161
4160
  {
4162
4161
  variant: "outline",
4163
4162
  label: signInLabel ?? "Sign in",
4164
- clientId,
4165
- redirectUri,
4163
+ clientId: clientId ?? "",
4164
+ redirectUri: redirectUri ?? "",
4166
4165
  onSuccess: onSignIn,
4167
4166
  className
4168
4167
  }
@@ -7870,29 +7869,30 @@ function DatePicker({
7870
7869
  classNames: {
7871
7870
  months: "flex flex-col gap-3",
7872
7871
  month: "flex flex-col gap-3",
7873
- caption: "flex items-center justify-between px-1",
7872
+ month_caption: "flex items-center justify-between px-1",
7874
7873
  caption_label: "text-sm font-semibold",
7875
7874
  nav: "flex items-center gap-1",
7876
- nav_button: "inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted transition-colors",
7877
- table: "w-full border-collapse",
7878
- head_row: "flex",
7879
- head_cell: "w-9 text-center text-[10px] font-medium uppercase tracking-wider text-muted-foreground",
7880
- row: "flex w-full mt-1",
7881
- cell: "w-9 h-9 text-center text-sm p-0 relative",
7882
- day: cn(
7875
+ button_previous: "inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted transition-colors",
7876
+ button_next: "inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted transition-colors",
7877
+ month_grid: "w-full border-collapse",
7878
+ weekdays: "flex",
7879
+ weekday: "w-9 text-center text-[10px] font-medium uppercase tracking-wider text-muted-foreground",
7880
+ week: "flex w-full mt-1",
7881
+ day: "w-9 h-9 text-center text-sm p-0 relative",
7882
+ day_button: cn(
7883
7883
  "inline-flex h-9 w-9 items-center justify-center rounded-md text-sm font-normal text-foreground hover:bg-muted transition-colors",
7884
7884
  "aria-selected:bg-foreground aria-selected:text-background aria-selected:hover:bg-foreground/90"
7885
7885
  ),
7886
- day_selected: cn(
7886
+ selected: cn(
7887
7887
  "bg-foreground text-background hover:bg-foreground/90 focus:bg-foreground",
7888
7888
  classNames?.daySelected
7889
7889
  ),
7890
- day_today: cn(
7890
+ today: cn(
7891
7891
  "ring-1 ring-inset ring-primary/40",
7892
7892
  classNames?.dayToday
7893
7893
  ),
7894
- day_outside: "text-muted-foreground/50",
7895
- day_disabled: cn(
7894
+ outside: "text-muted-foreground/50",
7895
+ disabled: cn(
7896
7896
  "text-muted-foreground/40 cursor-not-allowed line-through",
7897
7897
  classNames?.dayDisabled
7898
7898
  )
@@ -10538,6 +10538,105 @@ function SaleBadge({
10538
10538
  }
10539
10539
  );
10540
10540
  }
10541
+ function SalePrice({
10542
+ sale,
10543
+ amount,
10544
+ currency,
10545
+ showBadge = true,
10546
+ showCountdown = false,
10547
+ showClaim = false,
10548
+ className,
10549
+ classNames
10550
+ }) {
10551
+ if (!sale) {
10552
+ return /* @__PURE__ */ jsxRuntime.jsx(Price, { amount, currency, className });
10553
+ }
10554
+ const off = Math.round(chunk7Y2O3E4D_js.parsePrice(sale.percent_off));
10555
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10556
+ "span",
10557
+ {
10558
+ "data-cimplify-sale": sale.sale_id,
10559
+ className: cn(className, classNames?.root),
10560
+ style: { display: "inline-flex", alignItems: "baseline", gap: "0.5rem", flexWrap: "wrap" },
10561
+ children: [
10562
+ /* @__PURE__ */ jsxRuntime.jsx(
10563
+ Price,
10564
+ {
10565
+ amount: sale.price,
10566
+ currency,
10567
+ className: cn("cmp-sale-price", classNames?.price)
10568
+ }
10569
+ ),
10570
+ /* @__PURE__ */ jsxRuntime.jsx(
10571
+ "span",
10572
+ {
10573
+ "data-cimplify-sale-original": true,
10574
+ className: classNames?.original,
10575
+ style: { textDecoration: "line-through", opacity: 0.6 },
10576
+ children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: sale.original, currency })
10577
+ }
10578
+ ),
10579
+ showBadge && (sale.badge_text || off > 0) && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-badge": true, className: classNames?.badge, children: sale.badge_text ?? `${off}% OFF` }),
10580
+ showCountdown && /* @__PURE__ */ jsxRuntime.jsx(SaleCountdown, { endsAt: sale.ends_at, className: classNames?.countdown }),
10581
+ showClaim && sale.cap && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-sale-claim": true, className: classNames?.claim, children: [
10582
+ sale.cap.claimed,
10583
+ " of ",
10584
+ sale.cap.of,
10585
+ " claimed"
10586
+ ] })
10587
+ ]
10588
+ }
10589
+ );
10590
+ }
10591
+ function SaleCountdown({
10592
+ endsAt,
10593
+ className
10594
+ }) {
10595
+ const [now, setNow] = React14.useState(null);
10596
+ React14.useEffect(() => {
10597
+ setNow(Date.now());
10598
+ const id = setInterval(() => setNow(Date.now()), 1e3);
10599
+ return () => clearInterval(id);
10600
+ }, []);
10601
+ if (now == null) {
10602
+ return null;
10603
+ }
10604
+ const remaining = Date.parse(endsAt) - now;
10605
+ if (!Number.isFinite(remaining) || remaining <= 0) {
10606
+ return null;
10607
+ }
10608
+ const totalSeconds = Math.floor(remaining / 1e3);
10609
+ const days = Math.floor(totalSeconds / 86400);
10610
+ const hours = Math.floor(totalSeconds % 86400 / 3600);
10611
+ const minutes = Math.floor(totalSeconds % 3600 / 60);
10612
+ const seconds = totalSeconds % 60;
10613
+ const label = days > 0 ? `${days}d ${hours}h ${minutes}m` : hours > 0 ? `${hours}h ${minutes}m ${seconds}s` : `${minutes}m ${seconds}s`;
10614
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-sale-countdown": true, className, children: [
10615
+ "Ends in ",
10616
+ label
10617
+ ] });
10618
+ }
10619
+ function SaleTeaser({
10620
+ upcoming,
10621
+ children,
10622
+ className
10623
+ }) {
10624
+ const [mounted, setMounted] = React14.useState(false);
10625
+ React14.useEffect(() => setMounted(true), []);
10626
+ if (!upcoming || !mounted) {
10627
+ return null;
10628
+ }
10629
+ const at = Date.parse(upcoming.starts_at);
10630
+ if (!Number.isFinite(at)) {
10631
+ return null;
10632
+ }
10633
+ const when = new Date(at).toLocaleDateString(void 0, {
10634
+ weekday: "short",
10635
+ month: "short",
10636
+ day: "numeric"
10637
+ });
10638
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-teaser": true, className, children: children ? children({ when }) : upcoming.badge_text ?? `Back ${when}` });
10639
+ }
10541
10640
  var ALLOWED_EMBED_HOSTS = /* @__PURE__ */ new Set([
10542
10641
  "www.youtube.com",
10543
10642
  "youtube.com",
@@ -11012,14 +11111,16 @@ function SoldOutOverlay() {
11012
11111
  );
11013
11112
  }
11014
11113
  function SaleBadge2({ product }) {
11015
- if (!chunk7Y2O3E4D_js.isOnSale(product)) return null;
11016
- const pct = chunk7Y2O3E4D_js.getDiscountPercentage(product);
11017
- if (!pct || pct <= 0) return null;
11018
- return /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-card-sale-badge": true, className: "inline-flex items-center text-[11px] font-semibold tracking-wide bg-destructive text-destructive-foreground px-2 py-0.5 rounded-md", children: [
11019
- "-",
11020
- pct,
11021
- "%"
11022
- ] });
11114
+ let label = null;
11115
+ if (product.sale) {
11116
+ const off = Math.round(chunk7Y2O3E4D_js.parsePrice(product.sale.percent_off));
11117
+ label = product.sale.badge_text ?? (off > 0 ? `-${off}%` : null);
11118
+ } else if (chunk7Y2O3E4D_js.isOnSale(product)) {
11119
+ const pct = chunk7Y2O3E4D_js.getDiscountPercentage(product);
11120
+ label = pct && pct > 0 ? `-${pct}%` : null;
11121
+ }
11122
+ if (!label) return null;
11123
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-card-sale-badge": true, className: "inline-flex items-center text-[11px] font-semibold tracking-wide bg-destructive text-destructive-foreground px-2 py-0.5 rounded-md", children: label });
11023
11124
  }
11024
11125
  function CardShell({
11025
11126
  product,
@@ -11130,10 +11231,13 @@ function RetailProductCard({
11130
11231
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3.5", children: [
11131
11232
  product.vendor && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[10px] font-semibold text-muted-foreground uppercase tracking-widest", children: product.vendor }),
11132
11233
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-[14.5px] font-semibold text-foreground leading-snug tracking-tight mt-1 truncate", children: product.name }),
11133
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-2", children: [
11234
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 mt-2", children: product.sale ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11235
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.price, currency, className: "text-sm font-bold" }),
11236
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.original, currency, className: "text-xs text-muted-foreground line-through" })
11237
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11134
11238
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-sm font-bold" }),
11135
11239
  onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk7Y2O3E4D_js.getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" })
11136
- ] }),
11240
+ ] }) }),
11137
11241
  swatches.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1.5 mt-2.5", children: swatches.map((name) => /* @__PURE__ */ jsxRuntime.jsx(
11138
11242
  "span",
11139
11243
  {
@@ -14191,7 +14295,11 @@ function DefaultProductLayout({
14191
14295
  /* @__PURE__ */ jsxRuntime.jsx(TagPills, { tags: product.tags || [] })
14192
14296
  ] }),
14193
14297
  /* @__PURE__ */ jsxRuntime.jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-extrabold tracking-tight", children: product.name }),
14194
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-baseline gap-3", children: hasRange ? /* @__PURE__ */ jsxRuntime.jsx(PriceRange, { product, currency, className: "text-2xl font-extrabold" }) : onSale ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14298
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-baseline gap-3", children: hasRange ? /* @__PURE__ */ jsxRuntime.jsx(PriceRange, { product, currency, className: "text-2xl font-extrabold" }) : product.sale ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14299
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.price, currency, className: "text-2xl font-extrabold" }),
14300
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.original, currency, className: "text-lg text-muted-foreground line-through" }),
14301
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: product.sale.badge_text ?? `${Math.round(chunk7Y2O3E4D_js.parsePrice(product.sale.percent_off))}% OFF` })
14302
+ ] }) : onSale ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14195
14303
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-2xl font-extrabold" }),
14196
14304
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk7Y2O3E4D_js.getBasePrice(product), currency, className: "text-lg text-muted-foreground line-through" }),
14197
14305
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: [
@@ -17227,6 +17335,8 @@ exports.ResourcePicker = ResourcePicker;
17227
17335
  exports.RetailProductCard = RetailProductCard;
17228
17336
  exports.RichText = RichText;
17229
17337
  exports.SaleBadge = SaleBadge;
17338
+ exports.SalePrice = SalePrice;
17339
+ exports.SaleTeaser = SaleTeaser;
17230
17340
  exports.ScheduleServiceCard = ScheduleServiceCard;
17231
17341
  exports.SearchInput = SearchInput;
17232
17342
  exports.SearchPage = SearchPage;
package/dist/react.mjs CHANGED
@@ -3418,7 +3418,7 @@ function CimplifySignInButton({
3418
3418
  }) {
3419
3419
  const [busy, setBusy] = useState(false);
3420
3420
  const onClick = async () => {
3421
- if (busy || disabled) return;
3421
+ if (busy || disabled || !signInOpts.clientId) return;
3422
3422
  setBusy(true);
3423
3423
  await startSignIn({
3424
3424
  ...signInOpts,
@@ -4131,14 +4131,13 @@ function CimplifyUserButton({
4131
4131
  return /* @__PURE__ */ jsx("div", { className: cn("inline-flex items-center", className), "data-cimplify-user-button": "loading", children: /* @__PURE__ */ jsx("span", { className: "size-8 rounded-full bg-muted/60 animate-pulse" }) });
4132
4132
  }
4133
4133
  if (!session) {
4134
- if (!clientId || !redirectUri) return null;
4135
4134
  return /* @__PURE__ */ jsx(
4136
4135
  CimplifySignInButton,
4137
4136
  {
4138
4137
  variant: "outline",
4139
4138
  label: signInLabel ?? "Sign in",
4140
- clientId,
4141
- redirectUri,
4139
+ clientId: clientId ?? "",
4140
+ redirectUri: redirectUri ?? "",
4142
4141
  onSuccess: onSignIn,
4143
4142
  className
4144
4143
  }
@@ -7846,29 +7845,30 @@ function DatePicker({
7846
7845
  classNames: {
7847
7846
  months: "flex flex-col gap-3",
7848
7847
  month: "flex flex-col gap-3",
7849
- caption: "flex items-center justify-between px-1",
7848
+ month_caption: "flex items-center justify-between px-1",
7850
7849
  caption_label: "text-sm font-semibold",
7851
7850
  nav: "flex items-center gap-1",
7852
- nav_button: "inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted transition-colors",
7853
- table: "w-full border-collapse",
7854
- head_row: "flex",
7855
- head_cell: "w-9 text-center text-[10px] font-medium uppercase tracking-wider text-muted-foreground",
7856
- row: "flex w-full mt-1",
7857
- cell: "w-9 h-9 text-center text-sm p-0 relative",
7858
- day: cn(
7851
+ button_previous: "inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted transition-colors",
7852
+ button_next: "inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted transition-colors",
7853
+ month_grid: "w-full border-collapse",
7854
+ weekdays: "flex",
7855
+ weekday: "w-9 text-center text-[10px] font-medium uppercase tracking-wider text-muted-foreground",
7856
+ week: "flex w-full mt-1",
7857
+ day: "w-9 h-9 text-center text-sm p-0 relative",
7858
+ day_button: cn(
7859
7859
  "inline-flex h-9 w-9 items-center justify-center rounded-md text-sm font-normal text-foreground hover:bg-muted transition-colors",
7860
7860
  "aria-selected:bg-foreground aria-selected:text-background aria-selected:hover:bg-foreground/90"
7861
7861
  ),
7862
- day_selected: cn(
7862
+ selected: cn(
7863
7863
  "bg-foreground text-background hover:bg-foreground/90 focus:bg-foreground",
7864
7864
  classNames?.daySelected
7865
7865
  ),
7866
- day_today: cn(
7866
+ today: cn(
7867
7867
  "ring-1 ring-inset ring-primary/40",
7868
7868
  classNames?.dayToday
7869
7869
  ),
7870
- day_outside: "text-muted-foreground/50",
7871
- day_disabled: cn(
7870
+ outside: "text-muted-foreground/50",
7871
+ disabled: cn(
7872
7872
  "text-muted-foreground/40 cursor-not-allowed line-through",
7873
7873
  classNames?.dayDisabled
7874
7874
  )
@@ -10514,6 +10514,105 @@ function SaleBadge({
10514
10514
  }
10515
10515
  );
10516
10516
  }
10517
+ function SalePrice({
10518
+ sale,
10519
+ amount,
10520
+ currency,
10521
+ showBadge = true,
10522
+ showCountdown = false,
10523
+ showClaim = false,
10524
+ className,
10525
+ classNames
10526
+ }) {
10527
+ if (!sale) {
10528
+ return /* @__PURE__ */ jsx(Price, { amount, currency, className });
10529
+ }
10530
+ const off = Math.round(parsePrice(sale.percent_off));
10531
+ return /* @__PURE__ */ jsxs(
10532
+ "span",
10533
+ {
10534
+ "data-cimplify-sale": sale.sale_id,
10535
+ className: cn(className, classNames?.root),
10536
+ style: { display: "inline-flex", alignItems: "baseline", gap: "0.5rem", flexWrap: "wrap" },
10537
+ children: [
10538
+ /* @__PURE__ */ jsx(
10539
+ Price,
10540
+ {
10541
+ amount: sale.price,
10542
+ currency,
10543
+ className: cn("cmp-sale-price", classNames?.price)
10544
+ }
10545
+ ),
10546
+ /* @__PURE__ */ jsx(
10547
+ "span",
10548
+ {
10549
+ "data-cimplify-sale-original": true,
10550
+ className: classNames?.original,
10551
+ style: { textDecoration: "line-through", opacity: 0.6 },
10552
+ children: /* @__PURE__ */ jsx(Price, { amount: sale.original, currency })
10553
+ }
10554
+ ),
10555
+ showBadge && (sale.badge_text || off > 0) && /* @__PURE__ */ jsx("span", { "data-cimplify-sale-badge": true, className: classNames?.badge, children: sale.badge_text ?? `${off}% OFF` }),
10556
+ showCountdown && /* @__PURE__ */ jsx(SaleCountdown, { endsAt: sale.ends_at, className: classNames?.countdown }),
10557
+ showClaim && sale.cap && /* @__PURE__ */ jsxs("span", { "data-cimplify-sale-claim": true, className: classNames?.claim, children: [
10558
+ sale.cap.claimed,
10559
+ " of ",
10560
+ sale.cap.of,
10561
+ " claimed"
10562
+ ] })
10563
+ ]
10564
+ }
10565
+ );
10566
+ }
10567
+ function SaleCountdown({
10568
+ endsAt,
10569
+ className
10570
+ }) {
10571
+ const [now, setNow] = useState(null);
10572
+ useEffect(() => {
10573
+ setNow(Date.now());
10574
+ const id = setInterval(() => setNow(Date.now()), 1e3);
10575
+ return () => clearInterval(id);
10576
+ }, []);
10577
+ if (now == null) {
10578
+ return null;
10579
+ }
10580
+ const remaining = Date.parse(endsAt) - now;
10581
+ if (!Number.isFinite(remaining) || remaining <= 0) {
10582
+ return null;
10583
+ }
10584
+ const totalSeconds = Math.floor(remaining / 1e3);
10585
+ const days = Math.floor(totalSeconds / 86400);
10586
+ const hours = Math.floor(totalSeconds % 86400 / 3600);
10587
+ const minutes = Math.floor(totalSeconds % 3600 / 60);
10588
+ const seconds = totalSeconds % 60;
10589
+ const label = days > 0 ? `${days}d ${hours}h ${minutes}m` : hours > 0 ? `${hours}h ${minutes}m ${seconds}s` : `${minutes}m ${seconds}s`;
10590
+ return /* @__PURE__ */ jsxs("span", { "data-cimplify-sale-countdown": true, className, children: [
10591
+ "Ends in ",
10592
+ label
10593
+ ] });
10594
+ }
10595
+ function SaleTeaser({
10596
+ upcoming,
10597
+ children,
10598
+ className
10599
+ }) {
10600
+ const [mounted, setMounted] = useState(false);
10601
+ useEffect(() => setMounted(true), []);
10602
+ if (!upcoming || !mounted) {
10603
+ return null;
10604
+ }
10605
+ const at = Date.parse(upcoming.starts_at);
10606
+ if (!Number.isFinite(at)) {
10607
+ return null;
10608
+ }
10609
+ const when = new Date(at).toLocaleDateString(void 0, {
10610
+ weekday: "short",
10611
+ month: "short",
10612
+ day: "numeric"
10613
+ });
10614
+ return /* @__PURE__ */ jsx("span", { "data-cimplify-sale-teaser": true, className, children: children ? children({ when }) : upcoming.badge_text ?? `Back ${when}` });
10615
+ }
10517
10616
  var ALLOWED_EMBED_HOSTS = /* @__PURE__ */ new Set([
10518
10617
  "www.youtube.com",
10519
10618
  "youtube.com",
@@ -10988,14 +11087,16 @@ function SoldOutOverlay() {
10988
11087
  );
10989
11088
  }
10990
11089
  function SaleBadge2({ product }) {
10991
- if (!isOnSale(product)) return null;
10992
- const pct = getDiscountPercentage(product);
10993
- if (!pct || pct <= 0) return null;
10994
- return /* @__PURE__ */ jsxs("span", { "data-cimplify-card-sale-badge": true, className: "inline-flex items-center text-[11px] font-semibold tracking-wide bg-destructive text-destructive-foreground px-2 py-0.5 rounded-md", children: [
10995
- "-",
10996
- pct,
10997
- "%"
10998
- ] });
11090
+ let label = null;
11091
+ if (product.sale) {
11092
+ const off = Math.round(parsePrice(product.sale.percent_off));
11093
+ label = product.sale.badge_text ?? (off > 0 ? `-${off}%` : null);
11094
+ } else if (isOnSale(product)) {
11095
+ const pct = getDiscountPercentage(product);
11096
+ label = pct && pct > 0 ? `-${pct}%` : null;
11097
+ }
11098
+ if (!label) return null;
11099
+ return /* @__PURE__ */ jsx("span", { "data-cimplify-card-sale-badge": true, className: "inline-flex items-center text-[11px] font-semibold tracking-wide bg-destructive text-destructive-foreground px-2 py-0.5 rounded-md", children: label });
10999
11100
  }
11000
11101
  function CardShell({
11001
11102
  product,
@@ -11106,10 +11207,13 @@ function RetailProductCard({
11106
11207
  /* @__PURE__ */ jsxs("div", { className: "p-3.5", children: [
11107
11208
  product.vendor && /* @__PURE__ */ jsx("p", { className: "text-[10px] font-semibold text-muted-foreground uppercase tracking-widest", children: product.vendor }),
11108
11209
  /* @__PURE__ */ jsx("h3", { className: "text-[14.5px] font-semibold text-foreground leading-snug tracking-tight mt-1 truncate", children: product.name }),
11109
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mt-2", children: [
11210
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 mt-2", children: product.sale ? /* @__PURE__ */ jsxs(Fragment, { children: [
11211
+ /* @__PURE__ */ jsx(Price, { amount: product.sale.price, currency, className: "text-sm font-bold" }),
11212
+ /* @__PURE__ */ jsx(Price, { amount: product.sale.original, currency, className: "text-xs text-muted-foreground line-through" })
11213
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
11110
11214
  /* @__PURE__ */ jsx(Price, { amount: product.default_price, currency, className: "text-sm font-bold" }),
11111
11215
  onSale && /* @__PURE__ */ jsx(Price, { amount: getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" })
11112
- ] }),
11216
+ ] }) }),
11113
11217
  swatches.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex gap-1.5 mt-2.5", children: swatches.map((name) => /* @__PURE__ */ jsx(
11114
11218
  "span",
11115
11219
  {
@@ -14167,7 +14271,11 @@ function DefaultProductLayout({
14167
14271
  /* @__PURE__ */ jsx(TagPills, { tags: product.tags || [] })
14168
14272
  ] }),
14169
14273
  /* @__PURE__ */ jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-extrabold tracking-tight", children: product.name }),
14170
- /* @__PURE__ */ jsx("div", { className: "flex items-baseline gap-3", children: hasRange ? /* @__PURE__ */ jsx(PriceRange, { product, currency, className: "text-2xl font-extrabold" }) : onSale ? /* @__PURE__ */ jsxs(Fragment, { children: [
14274
+ /* @__PURE__ */ jsx("div", { className: "flex items-baseline gap-3", children: hasRange ? /* @__PURE__ */ jsx(PriceRange, { product, currency, className: "text-2xl font-extrabold" }) : product.sale ? /* @__PURE__ */ jsxs(Fragment, { children: [
14275
+ /* @__PURE__ */ jsx(Price, { amount: product.sale.price, currency, className: "text-2xl font-extrabold" }),
14276
+ /* @__PURE__ */ jsx(Price, { amount: product.sale.original, currency, className: "text-lg text-muted-foreground line-through" }),
14277
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: product.sale.badge_text ?? `${Math.round(parsePrice(product.sale.percent_off))}% OFF` })
14278
+ ] }) : onSale ? /* @__PURE__ */ jsxs(Fragment, { children: [
14171
14279
  /* @__PURE__ */ jsx(Price, { amount: product.default_price, currency, className: "text-2xl font-extrabold" }),
14172
14280
  /* @__PURE__ */ jsx(Price, { amount: getBasePrice(product), currency, className: "text-lg text-muted-foreground line-through" }),
14173
14281
  /* @__PURE__ */ jsxs("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: [
@@ -17056,4 +17164,4 @@ function SparkleIcon({ className }) {
17056
17164
  );
17057
17165
  }
17058
17166
 
17059
- export { AccommodationCard, AccountContent, AccountDashboardPage, AccountHero, AccountIdentityStrip, AccountLineItem, AccountLineItems, AccountNav, AccountOrderDetailPage, AccountOrderView, AccountOrdersPage, AccountShell, AccountSidebar, AccountSignedOutPrompt, AccountSubscriptionDetailPage, AccountSubscriptionsPage, Ad, AdProvider, AddOnSelector, AddressElement, AuthElement, AvailabilityBadge, BackLink, BillingPlanSelector, BookingCard, BookingList, BookingPage, BookingSummary, BookingsPage, BoxIcon24, BundleProductCard, BundleProductLayout, BundleSelector, Button, CardImage, CardShell, CardVariant, CartDrawer, CartDrawerProvider, CartPage, CartSummary, CartTemplate, CatalogueCollectionLayout, CataloguePage, CatalogueTemplate, CategoryFilter, CategoryGrid, ChatWidget, CheckIcon, CheckoutPage, CimplifyCheckout, CimplifyProvider, CimplifySignInButton, CimplifyUserButton, CollectionPage, CollectionTemplate, CompactCartLayout, CompactCatalogueLayout, CompactSearchLayout, CompactServiceCard, CompositeProductCard, CompositeProductLayout, CompositeSelector, ContextCard, ContinuityCard, CurrencySelector, CustomAttributesTable, CustomerInputFields, DashboardIcon, DashboardIcon20, DatePicker, DateSlotPicker, DealBanner, DealsPage, DefaultCartLayout, DefaultCatalogueLayout, DefaultCollectionLayout, DefaultProductLayout, DefaultSearchLayout, DeliveryEstimate, DeliveryTracker, DeliveryTruckIcon, DigitalProductCard, DigitalProductLayout, DiscountInput, ElementsProvider, EmptyState, ErrorState, FeaturedCollectionLayout, FilterTabs, FoodProductCard, FoodProductLayout, HappeningCard, IdentityIcon, IdentityOfframp, InventoryBadge, ItemsCard, LeaseServiceCard, LineItemDetails, LocationPicker, MediaGallery, MetadataStringList, MobileAccountShell, MobileBackButton, MobileMoreButton, MobileTabBar, NextDeliveryCard, OrderDetailHeader, OrderDetailMetaPipe, OrderDetailPage, OrderHistory, OrderHistoryPage, OrderList, OrderRow, OrderSummary, OrderTimeline, OrderTotals, OrdersIcon, OrdersIcon20, OvenIcon, PackageIcon, PaymentElement, Price, PriceRange, ProductCard, ProductCustomizer, ProductGrid, ProductImageGallery, ProductModel3D, ProductPage, ProductSheet, ProductTemplate, PropertiesTable, QuantitySelector, QuickAddButton, RecentlyViewed, RecommendationCarousel, RelatedProductsSection, RentalServiceCard, ResourcePicker, RetailProductCard, RichText, SaleBadge, ScheduleServiceCard, SearchInput, SearchPage, SearchTemplate, Section, SectionMore, ServiceProductLayout, SessionMessageBanner, SignOutIcon, Skeleton, SlotPicker, SoldOutOverlay, StaffPicker, StandardServiceCard, Status, StoreNav, StoreVideo, SubscriptionCard, SubscriptionList, SubscriptionRow, SubscriptionsIcon, SubscriptionsIcon20, TagPills, TimePicker, Toast, TwoColumnGrid, VariantSelector, VolumePricing, WelcomeCard, WholesaleProductCard, WholesaleProductLayout, WishlistButton, cn, prefetchProduct, prefetchProducts, roomToResource, sanitizeRichTextHtml, stripHtmlToText, toAccountLineItem, toAccountLineItems, toAccountOrderView, useActivityState, useAds, useAttributeDefinitions, useAvailableSlots, useBillingPlans, useBookings, useBootstrap, useBundles, useCart, useCartDrawer, useCategories, useChat, useCheckout, useCimplify, useCimplifyClient, useCimplifySession, useCollection, useCollections, useDeals, useDeliveryFee, useDeliveryOptions, useElements, useElementsReady, useFxRate, useLocations, useOptionalCimplify, useOrder, useOrders, useProduct, useProductAvailability, useProductDeals, useProductPrice, useProductSchedules, useProducts, useProductsOnSale, usePropertyFacets, useQuote, useRecommendations, useSearch, useServiceAvailability, useServices, useStoreCredit, useSubscription, useSubscriptions, useTaxonomies, useTaxonomy, useTaxonomyPath, useValidateDiscount, useVariantSelector };
17167
+ export { AccommodationCard, AccountContent, AccountDashboardPage, AccountHero, AccountIdentityStrip, AccountLineItem, AccountLineItems, AccountNav, AccountOrderDetailPage, AccountOrderView, AccountOrdersPage, AccountShell, AccountSidebar, AccountSignedOutPrompt, AccountSubscriptionDetailPage, AccountSubscriptionsPage, Ad, AdProvider, AddOnSelector, AddressElement, AuthElement, AvailabilityBadge, BackLink, BillingPlanSelector, BookingCard, BookingList, BookingPage, BookingSummary, BookingsPage, BoxIcon24, BundleProductCard, BundleProductLayout, BundleSelector, Button, CardImage, CardShell, CardVariant, CartDrawer, CartDrawerProvider, CartPage, CartSummary, CartTemplate, CatalogueCollectionLayout, CataloguePage, CatalogueTemplate, CategoryFilter, CategoryGrid, ChatWidget, CheckIcon, CheckoutPage, CimplifyCheckout, CimplifyProvider, CimplifySignInButton, CimplifyUserButton, CollectionPage, CollectionTemplate, CompactCartLayout, CompactCatalogueLayout, CompactSearchLayout, CompactServiceCard, CompositeProductCard, CompositeProductLayout, CompositeSelector, ContextCard, ContinuityCard, CurrencySelector, CustomAttributesTable, CustomerInputFields, DashboardIcon, DashboardIcon20, DatePicker, DateSlotPicker, DealBanner, DealsPage, DefaultCartLayout, DefaultCatalogueLayout, DefaultCollectionLayout, DefaultProductLayout, DefaultSearchLayout, DeliveryEstimate, DeliveryTracker, DeliveryTruckIcon, DigitalProductCard, DigitalProductLayout, DiscountInput, ElementsProvider, EmptyState, ErrorState, FeaturedCollectionLayout, FilterTabs, FoodProductCard, FoodProductLayout, HappeningCard, IdentityIcon, IdentityOfframp, InventoryBadge, ItemsCard, LeaseServiceCard, LineItemDetails, LocationPicker, MediaGallery, MetadataStringList, MobileAccountShell, MobileBackButton, MobileMoreButton, MobileTabBar, NextDeliveryCard, OrderDetailHeader, OrderDetailMetaPipe, OrderDetailPage, OrderHistory, OrderHistoryPage, OrderList, OrderRow, OrderSummary, OrderTimeline, OrderTotals, OrdersIcon, OrdersIcon20, OvenIcon, PackageIcon, PaymentElement, Price, PriceRange, ProductCard, ProductCustomizer, ProductGrid, ProductImageGallery, ProductModel3D, ProductPage, ProductSheet, ProductTemplate, PropertiesTable, QuantitySelector, QuickAddButton, RecentlyViewed, RecommendationCarousel, RelatedProductsSection, RentalServiceCard, ResourcePicker, RetailProductCard, RichText, SaleBadge, SalePrice, SaleTeaser, ScheduleServiceCard, SearchInput, SearchPage, SearchTemplate, Section, SectionMore, ServiceProductLayout, SessionMessageBanner, SignOutIcon, Skeleton, SlotPicker, SoldOutOverlay, StaffPicker, StandardServiceCard, Status, StoreNav, StoreVideo, SubscriptionCard, SubscriptionList, SubscriptionRow, SubscriptionsIcon, SubscriptionsIcon20, TagPills, TimePicker, Toast, TwoColumnGrid, VariantSelector, VolumePricing, WelcomeCard, WholesaleProductCard, WholesaleProductLayout, WishlistButton, cn, prefetchProduct, prefetchProducts, roomToResource, sanitizeRichTextHtml, stripHtmlToText, toAccountLineItem, toAccountLineItems, toAccountOrderView, useActivityState, useAds, useAttributeDefinitions, useAvailableSlots, useBillingPlans, useBookings, useBootstrap, useBundles, useCart, useCartDrawer, useCategories, useChat, useCheckout, useCimplify, useCimplifyClient, useCimplifySession, useCollection, useCollections, useDeals, useDeliveryFee, useDeliveryOptions, useElements, useElementsReady, useFxRate, useLocations, useOptionalCimplify, useOrder, useOrders, useProduct, useProductAvailability, useProductDeals, useProductPrice, useProductSchedules, useProducts, useProductsOnSale, usePropertyFacets, useQuote, useRecommendations, useSearch, useServiceAvailability, useServices, useStoreCredit, useSubscription, useSubscriptions, useTaxonomies, useTaxonomy, useTaxonomyPath, useValidateDiscount, useVariantSelector };
@@ -1,5 +1,5 @@
1
1
  import { Hono } from 'hono';
2
- import { b1 as ProductInputField } from './product-DXhjLQ_w.mjs';
2
+ import { b1 as ProductInputField } from './product-RJMIdCAf.mjs';
3
3
 
4
4
  interface Clock {
5
5
  now(): Date;
@@ -1,5 +1,5 @@
1
1
  import { Hono } from 'hono';
2
- import { b1 as ProductInputField } from './product-DXhjLQ_w.js';
2
+ import { b1 as ProductInputField } from './product-RJMIdCAf.js';
3
3
 
4
4
  interface Clock {
5
5
  now(): Date;
package/dist/server.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { ad as CimplifyClient } from './client-DnHP_2Jw.mjs';
2
- export { K as CacheOptions, ct as ReadRequestOptions, cP as Result } from './client-DnHP_2Jw.mjs';
3
- export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-DXhjLQ_w.mjs';
1
+ import { ad as CimplifyClient } from './client-DLtwQ-jI.mjs';
2
+ export { K as CacheOptions, ct as ReadRequestOptions, cP as Result } from './client-DLtwQ-jI.mjs';
3
+ export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-RJMIdCAf.mjs';
4
4
  import { JWTVerifyResult } from 'jose';
5
- import './payment-T_0MUE9o.mjs';
5
+ import './payment-Dh-6cRcV.mjs';
6
6
 
7
7
  interface ServerClientOptions {
8
8
  /**
package/dist/server.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { ad as CimplifyClient } from './client-xc2aQSB4.js';
2
- export { K as CacheOptions, ct as ReadRequestOptions, cP as Result } from './client-xc2aQSB4.js';
3
- export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-DXhjLQ_w.js';
1
+ import { ad as CimplifyClient } from './client-WKKxIiF1.js';
2
+ export { K as CacheOptions, ct as ReadRequestOptions, cP as Result } from './client-WKKxIiF1.js';
3
+ export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-RJMIdCAf.js';
4
4
  import { JWTVerifyResult } from 'jose';
5
- import './payment-nH9OCUg2.js';
5
+ import './payment-D1f3ZQPC.js';
6
6
 
7
7
  interface ServerClientOptions {
8
8
  /**