@cimplify/sdk 0.22.5 → 0.23.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.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkKLRTWBDF_js = require('./chunk-KLRTWBDF.js');
5
- var chunkYMXFVI3N_js = require('./chunk-YMXFVI3N.js');
6
- var chunk5FK7MDHS_js = require('./chunk-5FK7MDHS.js');
4
+ var chunkRAKLT6J2_js = require('./chunk-RAKLT6J2.js');
5
+ var chunkTXQHTHY5_js = require('./chunk-TXQHTHY5.js');
6
+ var chunkKRNWMUBN_js = require('./chunk-KRNWMUBN.js');
7
7
  var React3 = require('react');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
  var numberField = require('@base-ui/react/number-field');
@@ -475,13 +475,13 @@ function buildLineKey(productId, options) {
475
475
  return parts.join("|");
476
476
  }
477
477
  function calculateLineSubtotal(item) {
478
- let unitPrice = chunk5FK7MDHS_js.parsePrice(item.product.default_price);
478
+ let unitPrice = chunkKRNWMUBN_js.parsePrice(item.product.default_price);
479
479
  if (item.variant?.price_adjustment) {
480
- unitPrice += chunk5FK7MDHS_js.parsePrice(item.variant.price_adjustment);
480
+ unitPrice += chunkKRNWMUBN_js.parsePrice(item.variant.price_adjustment);
481
481
  }
482
482
  for (const option of item.addOnOptions || []) {
483
483
  if (option.default_price) {
484
- unitPrice += chunk5FK7MDHS_js.parsePrice(option.default_price);
484
+ unitPrice += chunkKRNWMUBN_js.parsePrice(option.default_price);
485
485
  }
486
486
  }
487
487
  return roundMoney(unitPrice * item.quantity);
@@ -1061,7 +1061,7 @@ var DEFAULT_COUNTRY = "US";
1061
1061
  function createDefaultClient() {
1062
1062
  const processRef = globalThis.process;
1063
1063
  const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
1064
- return chunkKLRTWBDF_js.createCimplifyClient({ publicKey: envPublicKey });
1064
+ return chunkRAKLT6J2_js.createCimplifyClient({ publicKey: envPublicKey });
1065
1065
  }
1066
1066
  function getStoredLocationId() {
1067
1067
  if (typeof window === "undefined" || !window.localStorage) {
@@ -1144,7 +1144,7 @@ function CimplifyProvider({
1144
1144
  const setDisplayCurrency = React3.useCallback(
1145
1145
  (currency) => {
1146
1146
  const normalized = currency?.trim().toUpperCase() || null;
1147
- if (normalized && !chunk5FK7MDHS_js.isSupportedCurrency(normalized)) {
1147
+ if (normalized && !chunkKRNWMUBN_js.isSupportedCurrency(normalized)) {
1148
1148
  return;
1149
1149
  }
1150
1150
  setDisplayCurrencyOverride(normalized);
@@ -1706,7 +1706,7 @@ function Price({ amount, className, prefix }) {
1706
1706
  const { displayCurrency, convertPrice } = useCimplify();
1707
1707
  return /* @__PURE__ */ jsxRuntime.jsxs("span", { className, children: [
1708
1708
  prefix,
1709
- chunk5FK7MDHS_js.formatPrice(convertPrice(amount), displayCurrency)
1709
+ chunkKRNWMUBN_js.formatPrice(convertPrice(amount), displayCurrency)
1710
1710
  ] });
1711
1711
  }
1712
1712
  function createCachedQuery(config) {
@@ -2713,16 +2713,16 @@ function useProductPrice(input) {
2713
2713
  if (bundleTotalPrice != null) {
2714
2714
  unitPrice = bundleTotalPrice;
2715
2715
  } else if (compositePrice) {
2716
- unitPrice = chunk5FK7MDHS_js.parsePrice(compositePrice.final_price);
2716
+ unitPrice = chunkKRNWMUBN_js.parsePrice(compositePrice.final_price);
2717
2717
  } else {
2718
- unitPrice = chunk5FK7MDHS_js.parsePrice(product.default_price);
2718
+ unitPrice = chunkKRNWMUBN_js.parsePrice(product.default_price);
2719
2719
  if (variant?.price_adjustment) {
2720
- unitPrice += chunk5FK7MDHS_js.parsePrice(variant.price_adjustment);
2720
+ unitPrice += chunkKRNWMUBN_js.parsePrice(variant.price_adjustment);
2721
2721
  }
2722
2722
  if (addOnOptions) {
2723
2723
  for (const option of addOnOptions) {
2724
2724
  if (option.default_price) {
2725
- unitPrice += chunk5FK7MDHS_js.parsePrice(option.default_price);
2725
+ unitPrice += chunkKRNWMUBN_js.parsePrice(option.default_price);
2726
2726
  }
2727
2727
  }
2728
2728
  }
@@ -3212,19 +3212,19 @@ function AuthElement({
3212
3212
  }, [onReady, onAuthenticated, onRequiresOtp, onError]);
3213
3213
  React3.useEffect(() => {
3214
3214
  if (!elements || !containerRef.current) return;
3215
- const element = elements.create(chunkYMXFVI3N_js.ELEMENT_TYPES.AUTH, { prefillEmail });
3215
+ const element = elements.create(chunkTXQHTHY5_js.ELEMENT_TYPES.AUTH, { prefillEmail });
3216
3216
  elementRef.current = element;
3217
- element.on(chunkYMXFVI3N_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
3217
+ element.on(chunkTXQHTHY5_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
3218
3218
  element.on(
3219
- chunkYMXFVI3N_js.EVENT_TYPES.AUTHENTICATED,
3219
+ chunkTXQHTHY5_js.EVENT_TYPES.AUTHENTICATED,
3220
3220
  (data) => onAuthenticatedRef.current?.(data)
3221
3221
  );
3222
3222
  element.on(
3223
- chunkYMXFVI3N_js.EVENT_TYPES.REQUIRES_OTP,
3223
+ chunkTXQHTHY5_js.EVENT_TYPES.REQUIRES_OTP,
3224
3224
  (data) => onRequiresOtpRef.current?.(data)
3225
3225
  );
3226
3226
  element.on(
3227
- chunkYMXFVI3N_js.EVENT_TYPES.ERROR,
3227
+ chunkTXQHTHY5_js.EVENT_TYPES.ERROR,
3228
3228
  (data) => onErrorRef.current?.(data)
3229
3229
  );
3230
3230
  element.mount(containerRef.current);
@@ -3253,15 +3253,15 @@ function AddressElement({
3253
3253
  }, [onReady, onChange, onError]);
3254
3254
  React3.useEffect(() => {
3255
3255
  if (!elements || !containerRef.current) return;
3256
- const element = elements.create(chunkYMXFVI3N_js.ELEMENT_TYPES.ADDRESS, { mode });
3256
+ const element = elements.create(chunkTXQHTHY5_js.ELEMENT_TYPES.ADDRESS, { mode });
3257
3257
  elementRef.current = element;
3258
- element.on(chunkYMXFVI3N_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
3258
+ element.on(chunkTXQHTHY5_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
3259
3259
  element.on(
3260
- chunkYMXFVI3N_js.EVENT_TYPES.CHANGE,
3260
+ chunkTXQHTHY5_js.EVENT_TYPES.CHANGE,
3261
3261
  (data) => onChangeRef.current?.(data)
3262
3262
  );
3263
3263
  element.on(
3264
- chunkYMXFVI3N_js.EVENT_TYPES.ERROR,
3264
+ chunkTXQHTHY5_js.EVENT_TYPES.ERROR,
3265
3265
  (data) => onErrorRef.current?.(data)
3266
3266
  );
3267
3267
  element.mount(containerRef.current);
@@ -3291,15 +3291,15 @@ function PaymentElement({
3291
3291
  }, [onReady, onChange, onError]);
3292
3292
  React3.useEffect(() => {
3293
3293
  if (!elements || !containerRef.current) return;
3294
- const element = elements.create(chunkYMXFVI3N_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
3294
+ const element = elements.create(chunkTXQHTHY5_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
3295
3295
  elementRef.current = element;
3296
- element.on(chunkYMXFVI3N_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
3296
+ element.on(chunkTXQHTHY5_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
3297
3297
  element.on(
3298
- chunkYMXFVI3N_js.EVENT_TYPES.CHANGE,
3298
+ chunkTXQHTHY5_js.EVENT_TYPES.CHANGE,
3299
3299
  (data) => onChangeRef.current?.(data)
3300
3300
  );
3301
3301
  element.on(
3302
- chunkYMXFVI3N_js.EVENT_TYPES.ERROR,
3302
+ chunkTXQHTHY5_js.EVENT_TYPES.ERROR,
3303
3303
  (data) => onErrorRef.current?.(data)
3304
3304
  );
3305
3305
  element.mount(containerRef.current);
@@ -3458,7 +3458,7 @@ function VariantSelector({
3458
3458
  if (!variants || variants.length <= 1) {
3459
3459
  return null;
3460
3460
  }
3461
- basePrice != null ? chunk5FK7MDHS_js.parsePrice(basePrice) : 0;
3461
+ basePrice != null ? chunkKRNWMUBN_js.parsePrice(basePrice) : 0;
3462
3462
  if (variantAxes && variantAxes.length > 0) {
3463
3463
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-variant-selector": true, className: cn("space-y-5", className, classNames?.root), children: variantAxes.map((axis) => {
3464
3464
  const labelId = `${idPrefix}-axis-${axis.id}`;
@@ -3534,7 +3534,7 @@ function VariantSelector({
3534
3534
  className: cn("divide-y divide-border", classNames?.list),
3535
3535
  children: variants.map((variant) => {
3536
3536
  const isSelected = selectedVariantId === variant.id;
3537
- const adjustment = chunk5FK7MDHS_js.parsePrice(variant.price_adjustment);
3537
+ const adjustment = chunkKRNWMUBN_js.parsePrice(variant.price_adjustment);
3538
3538
  return /* @__PURE__ */ jsxRuntime.jsxs(
3539
3539
  radio.Radio.Root,
3540
3540
  {
@@ -3562,7 +3562,7 @@ function VariantSelector({
3562
3562
  {
3563
3563
  "data-cimplify-variant-name": true,
3564
3564
  className: cn("flex-1 min-w-0 text-sm", classNames?.name),
3565
- children: chunkKLRTWBDF_js.getVariantDisplayName(variant, productName)
3565
+ children: chunkRAKLT6J2_js.getVariantDisplayName(variant, productName)
3566
3566
  }
3567
3567
  ),
3568
3568
  /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-variant-pricing": true, className: cn("text-sm text-muted-foreground", classNames?.pricing), children: [
@@ -3800,16 +3800,16 @@ function BundleSelector({
3800
3800
  }, [components, selections, onReady]);
3801
3801
  const totalPrice = React3.useMemo(() => {
3802
3802
  if (pricingType === "fixed" && bundlePrice) {
3803
- return chunk5FK7MDHS_js.parsePrice(bundlePrice);
3803
+ return chunkKRNWMUBN_js.parsePrice(bundlePrice);
3804
3804
  }
3805
3805
  const componentsTotal = components.reduce((sum, comp) => {
3806
3806
  return sum + getComponentPrice(comp, variantChoices[comp.id]) * comp.quantity;
3807
3807
  }, 0);
3808
3808
  if (pricingType === "percentage_discount" && discountValue) {
3809
- return componentsTotal * (1 - chunk5FK7MDHS_js.parsePrice(discountValue) / 100);
3809
+ return componentsTotal * (1 - chunkKRNWMUBN_js.parsePrice(discountValue) / 100);
3810
3810
  }
3811
3811
  if (pricingType === "fixed_discount" && discountValue) {
3812
- return componentsTotal - chunk5FK7MDHS_js.parsePrice(discountValue);
3812
+ return componentsTotal - chunkKRNWMUBN_js.parsePrice(discountValue);
3813
3813
  }
3814
3814
  return componentsTotal;
3815
3815
  }, [components, variantChoices, pricingType, bundlePrice, discountValue]);
@@ -3870,15 +3870,15 @@ function BundleSelector({
3870
3870
  }
3871
3871
  function getComponentPrice(component, selectedVariantId) {
3872
3872
  if (!selectedVariantId || component.available_variants.length === 0) {
3873
- return chunk5FK7MDHS_js.parsePrice(component.effective_price);
3873
+ return chunkKRNWMUBN_js.parsePrice(component.effective_price);
3874
3874
  }
3875
3875
  if (selectedVariantId === component.variant_id) {
3876
- return chunk5FK7MDHS_js.parsePrice(component.effective_price);
3876
+ return chunkKRNWMUBN_js.parsePrice(component.effective_price);
3877
3877
  }
3878
3878
  const bakedAdj = component.variant_id ? component.available_variants.find((v) => v.id === component.variant_id) : void 0;
3879
3879
  const selectedAdj = component.available_variants.find((v) => v.id === selectedVariantId);
3880
- if (!selectedAdj) return chunk5FK7MDHS_js.parsePrice(component.effective_price);
3881
- return chunk5FK7MDHS_js.parsePrice(component.effective_price) - chunk5FK7MDHS_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunk5FK7MDHS_js.parsePrice(selectedAdj.price_adjustment);
3880
+ if (!selectedAdj) return chunkKRNWMUBN_js.parsePrice(component.effective_price);
3881
+ return chunkKRNWMUBN_js.parsePrice(component.effective_price) - chunkKRNWMUBN_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunkKRNWMUBN_js.parsePrice(selectedAdj.price_adjustment);
3882
3882
  }
3883
3883
  function formatDuration(minutes, unit) {
3884
3884
  if (unit === "hours" || !unit && minutes >= 60 && minutes % 60 === 0) {
@@ -3991,7 +3991,7 @@ function BundleComponentCard({
3991
3991
  className: cn("mt-3 divide-y divide-border", classNames?.variantPicker),
3992
3992
  children: component.available_variants.map((variant) => {
3993
3993
  const isSelected = selectedVariantId === variant.id;
3994
- const adjustment = chunk5FK7MDHS_js.parsePrice(variant.price_adjustment);
3994
+ const adjustment = chunkKRNWMUBN_js.parsePrice(variant.price_adjustment);
3995
3995
  return /* @__PURE__ */ jsxRuntime.jsxs(
3996
3996
  radio.Radio.Root,
3997
3997
  {
@@ -4437,7 +4437,7 @@ function CompositeSelector({
4437
4437
  "data-cimplify-composite-summary": true,
4438
4438
  className: cn("border-t border-border pt-4 space-y-1 text-sm", classNames?.summary),
4439
4439
  children: [
4440
- chunk5FK7MDHS_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
4440
+ chunkKRNWMUBN_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
4441
4441
  "div",
4442
4442
  {
4443
4443
  "data-cimplify-composite-summary-line": true,
@@ -4448,7 +4448,7 @@ function CompositeSelector({
4448
4448
  ]
4449
4449
  }
4450
4450
  ),
4451
- chunk5FK7MDHS_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
4451
+ chunkKRNWMUBN_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
4452
4452
  "div",
4453
4453
  {
4454
4454
  "data-cimplify-composite-summary-line": true,
@@ -4491,6 +4491,195 @@ function CompositeSelector({
4491
4491
  )
4492
4492
  ] });
4493
4493
  }
4494
+ var FREQUENCY_LABELS = {
4495
+ weekly: "Weekly",
4496
+ monthly: "Monthly",
4497
+ quarterly: "Quarterly",
4498
+ annually: "Annually"
4499
+ };
4500
+ function formatMarkup(plan) {
4501
+ if (!plan.markup_type || plan.markup_amount == null) return null;
4502
+ if (plan.markup_type === "percentage") return `+${plan.markup_amount}%`;
4503
+ return null;
4504
+ }
4505
+ function BillingPlanSelector({
4506
+ productId,
4507
+ plans: plansProp,
4508
+ onPlanSelect,
4509
+ selectedPlanId,
4510
+ showOneTimePurchase = false,
4511
+ oneTimePurchaseLabel = "One-time purchase",
4512
+ renderPlan,
4513
+ className,
4514
+ classNames
4515
+ }) {
4516
+ const { plans: fetched, isLoading } = useBillingPlans(productId, {
4517
+ enabled: plansProp === void 0
4518
+ });
4519
+ const plans = plansProp ?? fetched;
4520
+ if (isLoading && plans.length === 0) {
4521
+ return /* @__PURE__ */ jsxRuntime.jsx(
4522
+ "div",
4523
+ {
4524
+ "data-cimplify-billing-plan-selector": true,
4525
+ "aria-busy": "true",
4526
+ className: cn(className, classNames?.root, classNames?.loading)
4527
+ }
4528
+ );
4529
+ }
4530
+ if (plans.length === 0 && !showOneTimePurchase) {
4531
+ return null;
4532
+ }
4533
+ const isOneTimePurchaseSelected = selectedPlanId === null;
4534
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-billing-plan-selector": true, className: cn(className, classNames?.root), children: [
4535
+ showOneTimePurchase && /* @__PURE__ */ jsxRuntime.jsx(
4536
+ "button",
4537
+ {
4538
+ type: "button",
4539
+ onClick: () => onPlanSelect?.(null),
4540
+ "data-cimplify-billing-plan": true,
4541
+ "data-plan-type": "one-time",
4542
+ "data-active": isOneTimePurchaseSelected || void 0,
4543
+ "aria-pressed": isOneTimePurchaseSelected,
4544
+ className: cn(
4545
+ classNames?.plan,
4546
+ isOneTimePurchaseSelected && classNames?.activePlan
4547
+ ),
4548
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-billing-frequency": true, className: classNames?.frequency, children: oneTimePurchaseLabel })
4549
+ }
4550
+ ),
4551
+ plans.map((plan) => {
4552
+ const isActive = selectedPlanId === plan.id;
4553
+ const markup = formatMarkup(plan);
4554
+ return /* @__PURE__ */ jsxRuntime.jsx(
4555
+ "button",
4556
+ {
4557
+ type: "button",
4558
+ onClick: () => onPlanSelect?.(plan),
4559
+ "data-cimplify-billing-plan": true,
4560
+ "data-plan-type": plan.plan_type,
4561
+ "data-active": isActive || void 0,
4562
+ "aria-pressed": isActive,
4563
+ className: cn(classNames?.plan, isActive && classNames?.activePlan),
4564
+ children: renderPlan ? renderPlan(plan, isActive) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4565
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-billing-frequency": true, className: classNames?.frequency, children: FREQUENCY_LABELS[plan.frequency] }),
4566
+ markup && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-billing-markup": true, className: classNames?.price, children: markup }),
4567
+ plan.markup_type === "fixed" && plan.markup_amount != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-billing-markup": true, className: classNames?.price, children: [
4568
+ "+",
4569
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: plan.markup_amount })
4570
+ ] }),
4571
+ plan.trial_days > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-billing-trial": true, className: classNames?.trialBadge, children: [
4572
+ plan.trial_days,
4573
+ "-day trial"
4574
+ ] }),
4575
+ plan.setup_fee > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-billing-setup-fee": true, className: classNames?.setupFee, children: [
4576
+ "Setup fee: ",
4577
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: plan.setup_fee })
4578
+ ] }),
4579
+ plan.plan_type === "installment" && plan.installment_periods != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-billing-periods": true, children: [
4580
+ plan.installment_periods,
4581
+ " payments"
4582
+ ] })
4583
+ ] })
4584
+ },
4585
+ plan.id
4586
+ );
4587
+ })
4588
+ ] });
4589
+ }
4590
+ function formatRange(tier) {
4591
+ if (tier.max_quantity != null) {
4592
+ return `${tier.min_quantity}\u2013${tier.max_quantity} units`;
4593
+ }
4594
+ return `${tier.min_quantity}+ units`;
4595
+ }
4596
+ function isActiveTier(tier, quantity) {
4597
+ if (quantity < tier.min_quantity) return false;
4598
+ if (tier.max_quantity != null && quantity > tier.max_quantity) return false;
4599
+ return true;
4600
+ }
4601
+ function VolumePricing({
4602
+ tiers,
4603
+ currentQuantity,
4604
+ defaultOpen = false,
4605
+ className,
4606
+ classNames
4607
+ }) {
4608
+ if (tiers.length < 2) return null;
4609
+ const sorted = [...tiers].sort((a, b) => a.min_quantity - b.min_quantity);
4610
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4611
+ "details",
4612
+ {
4613
+ open: defaultOpen || void 0,
4614
+ "data-cimplify-volume-pricing": true,
4615
+ className: cn("border border-border", className, classNames?.root),
4616
+ children: [
4617
+ /* @__PURE__ */ jsxRuntime.jsxs(
4618
+ "summary",
4619
+ {
4620
+ "data-cimplify-volume-pricing-trigger": true,
4621
+ className: cn(
4622
+ "flex items-center justify-between px-4 py-3 cursor-pointer select-none text-sm font-medium list-none [&::-webkit-details-marker]:hidden",
4623
+ classNames?.trigger
4624
+ ),
4625
+ children: [
4626
+ "Volume pricing",
4627
+ /* @__PURE__ */ jsxRuntime.jsx(
4628
+ "svg",
4629
+ {
4630
+ viewBox: "0 0 12 12",
4631
+ fill: "none",
4632
+ "aria-hidden": "true",
4633
+ className: cn(
4634
+ "w-3.5 h-3.5 text-muted-foreground transition-transform [[open]>&]:rotate-180",
4635
+ classNames?.triggerIcon
4636
+ ),
4637
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 4.5l4 4 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
4638
+ }
4639
+ )
4640
+ ]
4641
+ }
4642
+ ),
4643
+ /* @__PURE__ */ jsxRuntime.jsx(
4644
+ "div",
4645
+ {
4646
+ "data-cimplify-volume-pricing-panel": true,
4647
+ className: cn("border-t border-border divide-y divide-border", classNames?.panel),
4648
+ children: sorted.map((tier, i) => {
4649
+ const active = currentQuantity != null && isActiveTier(tier, currentQuantity);
4650
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4651
+ "div",
4652
+ {
4653
+ "data-cimplify-volume-pricing-tier": true,
4654
+ "data-active": active || void 0,
4655
+ className: cn(
4656
+ "flex items-center justify-between px-4 py-2.5 text-sm",
4657
+ active ? cn("bg-primary/5 font-medium", classNames?.tierActive) : classNames?.tier
4658
+ ),
4659
+ children: [
4660
+ /* @__PURE__ */ jsxRuntime.jsx(
4661
+ "span",
4662
+ {
4663
+ "data-cimplify-volume-pricing-range": true,
4664
+ className: cn("text-muted-foreground", classNames?.tierRange),
4665
+ children: formatRange(tier)
4666
+ }
4667
+ ),
4668
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-volume-pricing-price": true, className: classNames?.tierPrice, children: [
4669
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: tier.unit_price, prefix: "" }),
4670
+ " /ea"
4671
+ ] })
4672
+ ]
4673
+ },
4674
+ i
4675
+ );
4676
+ })
4677
+ }
4678
+ )
4679
+ ]
4680
+ }
4681
+ );
4682
+ }
4494
4683
  function ProductCustomizer({
4495
4684
  product,
4496
4685
  onAddToCart,
@@ -4498,7 +4687,7 @@ function ProductCustomizer({
4498
4687
  className,
4499
4688
  classNames
4500
4689
  }) {
4501
- const [quantity, setQuantity] = React3.useState(1);
4690
+ const [quantity, setQuantity] = React3.useState(product.min_order_quantity ?? 1);
4502
4691
  const [isAdded, setIsAdded] = React3.useState(false);
4503
4692
  const [isSubmitting, setIsSubmitting] = React3.useState(false);
4504
4693
  const [selectedVariantId, setSelectedVariantId] = React3.useState();
@@ -4510,6 +4699,7 @@ function ProductCustomizer({
4510
4699
  const [bundleSelections, setBundleSelections] = React3.useState([]);
4511
4700
  const [bundleTotalPrice, setBundleTotalPrice] = React3.useState(null);
4512
4701
  const [bundleReady, setBundleReady] = React3.useState(false);
4702
+ const [selectedBillingPlan, setSelectedBillingPlan] = React3.useState(null);
4513
4703
  const [specialInstructions, setSpecialInstructions] = React3.useState("");
4514
4704
  const cart = useCart();
4515
4705
  const productType = product.type || "product";
@@ -4521,7 +4711,7 @@ function ProductCustomizer({
4521
4711
  const hasVariants = isStandard && product.variants && product.variants.length > 0;
4522
4712
  const hasAddOns = isStandard && product.add_ons && product.add_ons.length > 0;
4523
4713
  React3.useEffect(() => {
4524
- setQuantity(1);
4714
+ setQuantity(product.min_order_quantity ?? 1);
4525
4715
  setIsAdded(false);
4526
4716
  setIsSubmitting(false);
4527
4717
  setSelectedVariantId(void 0);
@@ -4533,8 +4723,9 @@ function ProductCustomizer({
4533
4723
  setBundleSelections([]);
4534
4724
  setBundleTotalPrice(null);
4535
4725
  setBundleReady(false);
4726
+ setSelectedBillingPlan(null);
4536
4727
  setSpecialInstructions("");
4537
- }, [product.id]);
4728
+ }, [product.id, product.min_order_quantity]);
4538
4729
  const selectedAddOnOptions = React3.useMemo(() => {
4539
4730
  if (!product.add_ons) return [];
4540
4731
  const options = [];
@@ -4553,18 +4744,18 @@ function ProductCustomizer({
4553
4744
  }, [selectedAddOnOptionIds]);
4554
4745
  const localTotalPrice = React3.useMemo(() => {
4555
4746
  if (isComposite && compositePrice) {
4556
- return chunk5FK7MDHS_js.parsePrice(compositePrice.final_price) * quantity;
4747
+ return chunkKRNWMUBN_js.parsePrice(compositePrice.final_price) * quantity;
4557
4748
  }
4558
4749
  if (isBundle && bundleTotalPrice != null) {
4559
4750
  return bundleTotalPrice * quantity;
4560
4751
  }
4561
- let price = chunk5FK7MDHS_js.parsePrice(product.default_price);
4752
+ let price = chunkKRNWMUBN_js.parsePrice(product.default_price);
4562
4753
  if (selectedVariant?.price_adjustment) {
4563
- price += chunk5FK7MDHS_js.parsePrice(selectedVariant.price_adjustment);
4754
+ price += chunkKRNWMUBN_js.parsePrice(selectedVariant.price_adjustment);
4564
4755
  }
4565
4756
  for (const option of selectedAddOnOptions) {
4566
4757
  if (option.default_price) {
4567
- price += chunk5FK7MDHS_js.parsePrice(option.default_price);
4758
+ price += chunkKRNWMUBN_js.parsePrice(option.default_price);
4568
4759
  }
4569
4760
  }
4570
4761
  return price * quantity;
@@ -4605,7 +4796,7 @@ function ProductCustomizer({
4605
4796
  const priceInfo = quote.quoted_total_price_info ?? quote.final_price_info;
4606
4797
  const perUnit = priceInfo.pre_tax_price;
4607
4798
  if (perUnit === void 0 || perUnit === null) return void 0;
4608
- return chunk5FK7MDHS_js.parsePrice(perUnit) * quantity;
4799
+ return chunkKRNWMUBN_js.parsePrice(perUnit) * quantity;
4609
4800
  }, [quote, quantity]);
4610
4801
  const displayTotalPrice = quotedTotalPrice ?? localTotalPrice;
4611
4802
  const handleVariantChange = React3.useCallback(
@@ -4631,6 +4822,7 @@ function ProductCustomizer({
4631
4822
  })) : void 0,
4632
4823
  compositeSelections: isComposite && compositeSelections.length > 0 ? compositeSelections : void 0,
4633
4824
  bundleSelections: isBundle && bundleSelections.length > 0 ? bundleSelections : void 0,
4825
+ billingPlanId: selectedBillingPlan?.id,
4634
4826
  specialInstructions: specialInstructions.trim() || void 0
4635
4827
  };
4636
4828
  try {
@@ -4692,12 +4884,29 @@ function ProductCustomizer({
4692
4884
  onOptionsChange: setSelectedAddOnOptionIds
4693
4885
  }
4694
4886
  ),
4887
+ product.billing_plans && product.billing_plans.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
4888
+ BillingPlanSelector,
4889
+ {
4890
+ productId: product.id,
4891
+ plans: product.billing_plans,
4892
+ onPlanSelect: setSelectedBillingPlan,
4893
+ selectedPlanId: selectedBillingPlan?.id ?? null,
4894
+ showOneTimePurchase: true
4895
+ }
4896
+ ),
4897
+ product.quantity_pricing && product.quantity_pricing.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
4898
+ VolumePricing,
4899
+ {
4900
+ tiers: product.quantity_pricing,
4901
+ currentQuantity: quantity
4902
+ }
4903
+ ),
4695
4904
  product.deposit_type && product.deposit_type !== "none" && product.deposit_amount && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-customizer-deposit": true, className: cn("text-sm text-muted-foreground", classNames?.depositInfo), children: product.deposit_type === "fixed" ? /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4696
4905
  "Deposit required: ",
4697
4906
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.deposit_amount })
4698
4907
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4699
4908
  "Deposit required: ",
4700
- chunk5FK7MDHS_js.parsePrice(product.deposit_amount),
4909
+ chunkKRNWMUBN_js.parsePrice(product.deposit_amount),
4701
4910
  "%"
4702
4911
  ] }) }),
4703
4912
  product.allergies && product.allergies.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-customizer-allergens": true, className: cn("flex flex-wrap gap-1.5", classNames?.allergens), children: product.allergies.map((allergen) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -4745,14 +4954,24 @@ function ProductCustomizer({
4745
4954
  }
4746
4955
  ),
4747
4956
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
4748
- /* @__PURE__ */ jsxRuntime.jsx(
4749
- QuantitySelector,
4750
- {
4751
- value: quantity,
4752
- onChange: setQuantity,
4753
- min: 1
4754
- }
4755
- ),
4957
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
4958
+ /* @__PURE__ */ jsxRuntime.jsx(
4959
+ QuantitySelector,
4960
+ {
4961
+ value: quantity,
4962
+ onChange: setQuantity,
4963
+ min: product.min_order_quantity ?? 1
4964
+ }
4965
+ ),
4966
+ product.min_order_quantity && product.min_order_quantity > 1 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-customizer-min-hint": true, className: "text-xs text-muted-foreground text-center", children: [
4967
+ "Min. ",
4968
+ product.min_order_quantity
4969
+ ] })
4970
+ ] }),
4971
+ product.quantity_pricing && product.quantity_pricing.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-customizer-unit-price": true, className: "text-sm text-muted-foreground text-right shrink-0", children: [
4972
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkKRNWMUBN_js.getUnitPriceAtQuantity(product.quantity_pricing, quantity, chunkKRNWMUBN_js.parsePrice(product.default_price)), className: "font-medium text-foreground" }),
4973
+ " ea."
4974
+ ] }),
4756
4975
  /* @__PURE__ */ jsxRuntime.jsx(
4757
4976
  button.Button,
4758
4977
  {
@@ -4876,7 +5095,7 @@ function CartLineItemRow({
4876
5095
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item": true, className: classNames?.item, children: [
4877
5096
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item-info": true, children: [
4878
5097
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-name": true, className: classNames?.itemName, children: item.product.name }),
4879
- item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children: chunkKLRTWBDF_js.getVariantDisplayName(item.variant, item.product.name) }),
5098
+ item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children: chunkRAKLT6J2_js.getVariantDisplayName(item.variant, item.product.name) }),
4880
5099
  item.addOnOptions && item.addOnOptions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-cart-item-addons": true, children: [
4881
5100
  "+ ",
4882
5101
  item.addOnOptions.map((opt) => opt.name).join(", ")
@@ -4998,15 +5217,15 @@ function CartSummary({
4998
5217
  ] }),
4999
5218
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: subtotal })
5000
5219
  ] }),
5001
- totalDiscounts != null && chunk5FK7MDHS_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-discount": true, className: classNames?.discount, children: [
5220
+ totalDiscounts != null && chunkKRNWMUBN_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-discount": true, className: classNames?.discount, children: [
5002
5221
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
5003
5222
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: totalDiscounts, prefix: "-" })
5004
5223
  ] }),
5005
5224
  deliveryFee != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-delivery-fee": true, className: classNames?.deliveryFee, children: [
5006
5225
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
5007
- chunk5FK7MDHS_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: deliveryFee }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Free delivery" })
5226
+ chunkKRNWMUBN_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: deliveryFee }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Free delivery" })
5008
5227
  ] }),
5009
- serviceCharge != null && chunk5FK7MDHS_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-charge": true, className: classNames?.serviceCharge, children: [
5228
+ serviceCharge != null && chunkKRNWMUBN_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-charge": true, className: classNames?.serviceCharge, children: [
5010
5229
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
5011
5230
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: serviceCharge })
5012
5231
  ] }),
@@ -5089,16 +5308,16 @@ function SaleBadge({
5089
5308
  className,
5090
5309
  classNames
5091
5310
  }) {
5092
- const onSale = chunk5FK7MDHS_js.isOnSale(product);
5311
+ const onSale = chunkKRNWMUBN_js.isOnSale(product);
5093
5312
  const hasDeal = dealInfo !== void 0;
5094
5313
  if (!hasDeal && !onSale && !label) {
5095
5314
  return null;
5096
5315
  }
5097
5316
  let percentage = null;
5098
5317
  if (hasDeal && dealInfo.benefit_type === "percentage") {
5099
- percentage = chunk5FK7MDHS_js.parsePrice(dealInfo.value);
5318
+ percentage = chunkKRNWMUBN_js.parsePrice(dealInfo.value);
5100
5319
  } else if (onSale) {
5101
- percentage = chunk5FK7MDHS_js.getDiscountPercentage(product);
5320
+ percentage = chunkKRNWMUBN_js.getDiscountPercentage(product);
5102
5321
  }
5103
5322
  const badgeText = label ?? dealInfo?.label ?? (percentage != null && percentage > 0 ? `${percentage}% off` : null);
5104
5323
  if (!badgeText) {
@@ -5117,7 +5336,7 @@ function SaleBadge({
5117
5336
  "%"
5118
5337
  ] }),
5119
5338
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-label": true, className: classNames?.label, children: badgeText }),
5120
- showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk5FK7MDHS_js.getBasePrice(product) }) })
5339
+ showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkKRNWMUBN_js.getBasePrice(product) }) })
5121
5340
  ]
5122
5341
  }
5123
5342
  );
@@ -5623,7 +5842,7 @@ function SearchInput({
5623
5842
  }
5624
5843
  ),
5625
5844
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-name": true, className: classNames?.resultName, style: { flex: 1, textAlign: "left" }, children: product.name }),
5626
- product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunk5FK7MDHS_js.formatPrice(product.default_price) })
5845
+ product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunkKRNWMUBN_js.formatPrice(product.default_price) })
5627
5846
  ] })
5628
5847
  },
5629
5848
  product.id
@@ -6117,19 +6336,19 @@ function OrderSummary({
6117
6336
  order.customer_notes.map((note, index) => /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-order-note": true, children: note }, index))
6118
6337
  ] }),
6119
6338
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-totals": true, className: classNames?.totals, children: [
6120
- order.total_discount != null && chunk5FK7MDHS_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
6339
+ order.total_discount != null && chunkKRNWMUBN_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
6121
6340
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
6122
6341
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.total_discount, prefix: "-" })
6123
6342
  ] }),
6124
- order.delivery_fee != null && chunk5FK7MDHS_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
6343
+ order.delivery_fee != null && chunkKRNWMUBN_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
6125
6344
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
6126
6345
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.delivery_fee })
6127
6346
  ] }),
6128
- order.service_charge != null && chunk5FK7MDHS_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
6347
+ order.service_charge != null && chunkKRNWMUBN_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
6129
6348
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
6130
6349
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.service_charge })
6131
6350
  ] }),
6132
- order.tax != null && chunk5FK7MDHS_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
6351
+ order.tax != null && chunkKRNWMUBN_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
6133
6352
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Tax" }),
6134
6353
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.tax })
6135
6354
  ] }),
@@ -7825,7 +8044,7 @@ function BookingPage({
7825
8044
  const hasStaffStep = staff && staff.length > 0;
7826
8045
  const depositType = product?.deposit_type;
7827
8046
  const depositAmount = product?.deposit_amount;
7828
- const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunk5FK7MDHS_js.parsePrice(depositAmount) !== 0;
8047
+ const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunkKRNWMUBN_js.parsePrice(depositAmount) !== 0;
7829
8048
  const cancellationMinutes = product?.cancellation_window_minutes;
7830
8049
  const noShowFee = product?.no_show_fee;
7831
8050
  const handleSlotSelect = React3.useCallback(
@@ -7957,14 +8176,14 @@ function BookingPage({
7957
8176
  service.price && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-booking-service-price": true, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: service.price }) }),
7958
8177
  hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-deposit-info": true, className: classNames?.depositInfo, children: [
7959
8178
  "Deposit: ",
7960
- depositType === "percentage" ? `${chunk5FK7MDHS_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount })
8179
+ depositType === "percentage" ? `${chunkKRNWMUBN_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount })
7961
8180
  ] }),
7962
8181
  cancellationMinutes !== void 0 && cancellationMinutes > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-cancellation-policy": true, className: classNames?.cancellationPolicy, children: [
7963
8182
  "Free cancellation up to ",
7964
8183
  cancellationMinutes >= 60 ? `${Math.floor(cancellationMinutes / 60)} hour${Math.floor(cancellationMinutes / 60) !== 1 ? "s" : ""}` : `${cancellationMinutes} minute${cancellationMinutes !== 1 ? "s" : ""}`,
7965
8184
  " before"
7966
8185
  ] }),
7967
- noShowFee !== void 0 && chunk5FK7MDHS_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
8186
+ noShowFee !== void 0 && chunkKRNWMUBN_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
7968
8187
  "No-show fee: ",
7969
8188
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: noShowFee })
7970
8189
  ] })
@@ -8041,7 +8260,7 @@ function BookingPage({
8041
8260
  ] }),
8042
8261
  hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-booking-summary-row": true, className: cn(classNames?.summaryRow, classNames?.depositInfo), children: [
8043
8262
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Deposit" }),
8044
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunk5FK7MDHS_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount }) })
8263
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunkKRNWMUBN_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount }) })
8045
8264
  ] })
8046
8265
  ] }),
8047
8266
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -8356,101 +8575,11 @@ function RecentlyViewed({
8356
8575
  product.product_id
8357
8576
  )) });
8358
8577
  }
8359
- var FREQUENCY_LABELS = {
8360
- weekly: "Weekly",
8361
- monthly: "Monthly",
8362
- quarterly: "Quarterly",
8363
- annually: "Annually"
8364
- };
8365
- function formatMarkup(plan) {
8366
- if (!plan.markup_type || plan.markup_amount == null) return null;
8367
- if (plan.markup_type === "percentage") return `+${plan.markup_amount}%`;
8368
- return null;
8369
- }
8370
- function BillingPlanSelector({
8371
- productId,
8372
- plans: plansProp,
8373
- onPlanSelect,
8374
- selectedPlanId,
8375
- showOneTimePurchase = false,
8376
- oneTimePurchaseLabel = "One-time purchase",
8377
- renderPlan,
8378
- className,
8379
- classNames
8380
- }) {
8381
- const { plans: fetched, isLoading } = useBillingPlans(productId, {
8382
- enabled: plansProp === void 0
8383
- });
8384
- const plans = plansProp ?? fetched;
8385
- if (isLoading && plans.length === 0) {
8386
- return /* @__PURE__ */ jsxRuntime.jsx(
8387
- "div",
8388
- {
8389
- "data-cimplify-billing-plan-selector": true,
8390
- "aria-busy": "true",
8391
- className: cn(className, classNames?.root, classNames?.loading)
8392
- }
8393
- );
8394
- }
8395
- if (plans.length === 0 && !showOneTimePurchase) {
8396
- return null;
8397
- }
8398
- const isOneTimePurchaseSelected = selectedPlanId === null;
8399
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-billing-plan-selector": true, className: cn(className, classNames?.root), children: [
8400
- showOneTimePurchase && /* @__PURE__ */ jsxRuntime.jsx(
8401
- "button",
8402
- {
8403
- type: "button",
8404
- onClick: () => onPlanSelect?.(null),
8405
- "data-cimplify-billing-plan": true,
8406
- "data-plan-type": "one-time",
8407
- "data-active": isOneTimePurchaseSelected || void 0,
8408
- "aria-pressed": isOneTimePurchaseSelected,
8409
- className: cn(
8410
- classNames?.plan,
8411
- isOneTimePurchaseSelected && classNames?.activePlan
8412
- ),
8413
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-billing-frequency": true, className: classNames?.frequency, children: oneTimePurchaseLabel })
8414
- }
8415
- ),
8416
- plans.map((plan) => {
8417
- const isActive = selectedPlanId === plan.id;
8418
- const markup = formatMarkup(plan);
8419
- return /* @__PURE__ */ jsxRuntime.jsx(
8420
- "button",
8421
- {
8422
- type: "button",
8423
- onClick: () => onPlanSelect?.(plan),
8424
- "data-cimplify-billing-plan": true,
8425
- "data-plan-type": plan.plan_type,
8426
- "data-active": isActive || void 0,
8427
- "aria-pressed": isActive,
8428
- className: cn(classNames?.plan, isActive && classNames?.activePlan),
8429
- children: renderPlan ? renderPlan(plan, isActive) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8430
- /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-billing-frequency": true, className: classNames?.frequency, children: FREQUENCY_LABELS[plan.frequency] }),
8431
- markup && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-billing-markup": true, className: classNames?.price, children: markup }),
8432
- plan.markup_type === "fixed" && plan.markup_amount != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-billing-markup": true, className: classNames?.price, children: [
8433
- "+",
8434
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: plan.markup_amount })
8435
- ] }),
8436
- plan.trial_days > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-billing-trial": true, className: classNames?.trialBadge, children: [
8437
- plan.trial_days,
8438
- "-day trial"
8439
- ] }),
8440
- plan.setup_fee > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-billing-setup-fee": true, className: classNames?.setupFee, children: [
8441
- "Setup fee: ",
8442
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: plan.setup_fee })
8443
- ] }),
8444
- plan.plan_type === "installment" && plan.installment_periods != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-billing-periods": true, children: [
8445
- plan.installment_periods,
8446
- " payments"
8447
- ] })
8448
- ] })
8449
- },
8450
- plan.id
8451
- );
8452
- })
8453
- ] });
8578
+ function PriceRange({ product, className }) {
8579
+ const { displayCurrency } = useCimplify();
8580
+ const range = chunkKRNWMUBN_js.getPriceRange(product);
8581
+ if (!range) return null;
8582
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children: chunkKRNWMUBN_js.formatPriceRange(range.min, range.max, displayCurrency) });
8454
8583
  }
8455
8584
  function DeliveryEstimate({
8456
8585
  latitude,
@@ -8601,7 +8730,7 @@ function CurrencySelector({
8601
8730
 
8602
8731
  Object.defineProperty(exports, "getVariantDisplayName", {
8603
8732
  enumerable: true,
8604
- get: function () { return chunkKLRTWBDF_js.getVariantDisplayName; }
8733
+ get: function () { return chunkRAKLT6J2_js.getVariantDisplayName; }
8605
8734
  });
8606
8735
  exports.Ad = Ad;
8607
8736
  exports.AdProvider = AdProvider;
@@ -8639,6 +8768,7 @@ exports.OrderHistoryPage = OrderHistoryPage;
8639
8768
  exports.OrderSummary = OrderSummary;
8640
8769
  exports.PaymentElement = PaymentElement;
8641
8770
  exports.Price = Price;
8771
+ exports.PriceRange = PriceRange;
8642
8772
  exports.ProductCard = ProductCard;
8643
8773
  exports.ProductCustomizer = ProductCustomizer;
8644
8774
  exports.ProductGrid = ProductGrid;
@@ -8659,6 +8789,7 @@ exports.SlotPicker = SlotPicker;
8659
8789
  exports.StaffPicker = StaffPicker;
8660
8790
  exports.StoreNav = StoreNav;
8661
8791
  exports.VariantSelector = VariantSelector;
8792
+ exports.VolumePricing = VolumePricing;
8662
8793
  exports.cn = cn;
8663
8794
  exports.roomToResource = roomToResource;
8664
8795
  exports.useActivityState = useActivityState;