@nextblock-cms/ecom 0.8.6 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/index.cjs.js +1 -1
  2. package/index.es.js +136 -533
  3. package/lib/CurrencyProvider.cjs.js +1 -0
  4. package/lib/CurrencyProvider.es.js +99 -0
  5. package/lib/cart-store.cjs.js +1 -0
  6. package/{cart-store.es.js → lib/cart-store.es.js} +13 -13
  7. package/lib/components/AccountNavigationMenu.cjs.js +1 -0
  8. package/lib/components/AccountNavigationMenu.es.js +44 -0
  9. package/lib/components/AddToCartButton.cjs.js +1 -0
  10. package/{AddToCartButton-ffE0DhHu.js → lib/components/AddToCartButton.es.js} +14 -13
  11. package/lib/components/Cart.cjs.js +1 -0
  12. package/lib/components/Cart.es.js +148 -0
  13. package/lib/components/CartDrawer.cjs.js +1 -0
  14. package/{components → lib/components}/CartDrawer.es.js +15 -14
  15. package/{components → lib/components}/CartIcon.cjs.js +1 -1
  16. package/{components → lib/components}/CartIcon.es.js +1 -0
  17. package/lib/components/Checkout.cjs.js +1 -0
  18. package/{components → lib/components}/Checkout.es.js +330 -363
  19. package/lib/components/CouponForm.cjs.js +1 -0
  20. package/lib/components/CouponForm.es.js +136 -0
  21. package/lib/components/CurrencySwitcher.cjs.js +1 -0
  22. package/{components → lib/components}/CurrencySwitcher.es.js +5 -4
  23. package/lib/components/CustomerProfileForm.cjs.js +1 -0
  24. package/lib/components/CustomerProfileForm.es.js +355 -0
  25. package/lib/components/FeaturedProduct.cjs.js +1 -0
  26. package/{components → lib/components}/FeaturedProduct.es.js +9 -8
  27. package/lib/components/InvoiceDocument.cjs.js +1 -0
  28. package/lib/components/InvoiceDocument.es.js +196 -0
  29. package/lib/components/InvoiceViewerShell.cjs.js +29 -0
  30. package/lib/components/InvoiceViewerShell.es.js +100 -0
  31. package/lib/components/ProductCard.cjs.js +1 -0
  32. package/lib/components/ProductCard.es.js +119 -0
  33. package/lib/components/ProductDetailsLayout.cjs.js +1 -0
  34. package/lib/components/ProductDetailsLayout.es.js +361 -0
  35. package/lib/components/ProductGallery.cjs.js +1 -0
  36. package/lib/components/ProductGallery.es.js +41 -0
  37. package/lib/components/ProductGrid.cjs.js +1 -0
  38. package/lib/components/ProductGrid.es.js +19 -0
  39. package/lib/components/ShippingEstimator.cjs.js +1 -0
  40. package/lib/components/ShippingEstimator.es.js +125 -0
  41. package/lib/components/SubscriptionSelector.cjs.js +1 -0
  42. package/lib/components/SubscriptionSelector.es.js +140 -0
  43. package/lib/countries.cjs.js +1 -0
  44. package/lib/countries.es.js +77 -0
  45. package/lib/coupon-server.cjs.js +1 -0
  46. package/{coupon-server-DUKVtyYs.js → lib/coupon-server.es.js} +68 -82
  47. package/lib/coupons.cjs.js +1 -0
  48. package/lib/coupons.es.js +17 -0
  49. package/lib/currency-store.cjs.js +1 -0
  50. package/lib/currency-store.es.js +27 -0
  51. package/lib/currency-sync.cjs.js +1 -0
  52. package/lib/currency-sync.es.js +180 -0
  53. package/lib/customer-addresses.cjs.js +1 -0
  54. package/lib/customer-addresses.es.js +116 -0
  55. package/lib/customer-orders.cjs.js +1 -0
  56. package/lib/customer-orders.es.js +45 -0
  57. package/lib/customer.cjs.js +1 -0
  58. package/{customer-C3xccjUg.js → lib/customer.es.js} +15 -14
  59. package/lib/export-helpers.cjs.js +1 -0
  60. package/lib/export-helpers.es.js +56 -0
  61. package/lib/factory.cjs.js +1 -0
  62. package/lib/factory.es.js +8 -0
  63. package/lib/freemius-coupons.cjs.js +1 -0
  64. package/lib/freemius-coupons.es.js +272 -0
  65. package/lib/freemius-order-sync.cjs.js +1 -0
  66. package/lib/freemius-order-sync.es.js +284 -0
  67. package/lib/inventory-settings.cjs.js +1 -0
  68. package/lib/inventory-settings.es.js +86 -0
  69. package/lib/invoice-server.cjs.js +33 -0
  70. package/lib/invoice-server.es.js +141 -0
  71. package/lib/invoice-ui.cjs.js +1 -0
  72. package/lib/invoice-ui.es.js +71 -0
  73. package/lib/invoice.cjs.js +1 -0
  74. package/lib/invoice.es.js +102 -0
  75. package/lib/order-inventory.cjs.js +61 -0
  76. package/lib/order-inventory.es.js +128 -0
  77. package/lib/order-tax-details.cjs.js +1 -0
  78. package/lib/order-tax-details.es.js +164 -0
  79. package/lib/pages/cms/coupons/CouponEditorForm.cjs.js +1 -0
  80. package/lib/pages/cms/coupons/CouponEditorForm.es.js +189 -0
  81. package/lib/pages/cms/coupons/CouponsPage.cjs.js +5 -0
  82. package/lib/pages/cms/coupons/CouponsPage.es.js +171 -0
  83. package/lib/pages/cms/coupons/CreateCouponDialog.cjs.js +1 -0
  84. package/lib/pages/cms/coupons/CreateCouponDialog.es.js +35 -0
  85. package/lib/pages/cms/coupons/EditCouponPage.cjs.js +1 -0
  86. package/lib/pages/cms/coupons/EditCouponPage.es.js +48 -0
  87. package/lib/pages/cms/coupons/ProductScopePicker.cjs.js +1 -0
  88. package/lib/pages/cms/coupons/ProductScopePicker.es.js +120 -0
  89. package/lib/pages/cms/coupons/actions.cjs.js +1 -0
  90. package/lib/pages/cms/coupons/actions.es.js +128 -0
  91. package/lib/pages/cms/coupons/product-options.cjs.js +1 -0
  92. package/lib/pages/cms/coupons/product-options.es.js +27 -0
  93. package/lib/pages/cms/orders/ExportReportsDialog.cjs.js +1 -0
  94. package/lib/pages/cms/orders/ExportReportsDialog.es.js +130 -0
  95. package/lib/pages/cms/orders/OrderDetailPage.cjs.js +1 -0
  96. package/lib/pages/cms/orders/OrderDetailPage.es.js +137 -0
  97. package/lib/pages/cms/orders/OrderPrintButton.cjs.js +1 -0
  98. package/lib/pages/cms/orders/OrderPrintButton.es.js +22 -0
  99. package/lib/pages/cms/orders/OrderStatusForm.cjs.js +1 -0
  100. package/lib/pages/cms/orders/OrderStatusForm.es.js +71 -0
  101. package/lib/pages/cms/orders/OrdersPage.cjs.js +1 -0
  102. package/lib/pages/cms/orders/OrdersPage.es.js +104 -0
  103. package/lib/pages/cms/orders/actions.cjs.js +7 -0
  104. package/lib/pages/cms/orders/actions.es.js +71 -0
  105. package/lib/pages/cms/orders/export-actions.cjs.js +1 -0
  106. package/lib/pages/cms/orders/export-actions.es.js +27 -0
  107. package/lib/pages/cms/orders/server-actions.cjs.js +1 -0
  108. package/lib/pages/cms/orders/server-actions.es.js +55 -0
  109. package/lib/pages/cms/payments/PaymentsClient.cjs.js +1 -0
  110. package/lib/pages/cms/payments/PaymentsClient.es.js +188 -0
  111. package/lib/pages/cms/payments/PaymentsPage.cjs.js +1 -0
  112. package/lib/pages/cms/payments/PaymentsPage.es.js +29 -0
  113. package/lib/pages/cms/payments/actions.cjs.js +1 -0
  114. package/lib/pages/cms/payments/actions.es.js +23 -0
  115. package/lib/pages/cms/payments/queries.cjs.js +1 -0
  116. package/lib/pages/cms/payments/queries.es.js +30 -0
  117. package/lib/pages/cms/products/ProductsPage.cjs.js +1 -0
  118. package/lib/pages/cms/products/ProductsPage.es.js +46 -0
  119. package/lib/pages/cms/products/_id_/edit/EditProductPage.cjs.js +1 -0
  120. package/lib/pages/cms/products/_id_/edit/EditProductPage.es.js +156 -0
  121. package/lib/pages/cms/products/actions.cjs.js +44 -0
  122. package/lib/pages/cms/products/actions.es.js +175 -0
  123. package/lib/pages/cms/products/attributes/AttributeManagementPage.cjs.js +1 -0
  124. package/lib/pages/cms/products/attributes/AttributeManagementPage.es.js +48 -0
  125. package/lib/pages/cms/products/attributes/components/AttributeManager.cjs.js +1 -0
  126. package/lib/pages/cms/products/attributes/components/AttributeManager.es.js +291 -0
  127. package/lib/pages/cms/products/categories/CategoryManagementPage.cjs.js +1 -0
  128. package/lib/pages/cms/products/categories/CategoryManagementPage.es.js +36 -0
  129. package/lib/pages/cms/products/categories/components/CategoryManager.cjs.js +1 -0
  130. package/lib/pages/cms/products/categories/components/CategoryManager.es.js +263 -0
  131. package/lib/pages/cms/products/components/CopyProductFromLanguage.cjs.js +1 -0
  132. package/lib/pages/cms/products/components/CopyProductFromLanguage.es.js +114 -0
  133. package/lib/pages/cms/products/components/CurrencyPriceFields.cjs.js +1 -0
  134. package/lib/pages/cms/products/components/CurrencyPriceFields.es.js +107 -0
  135. package/lib/pages/cms/products/components/DeleteProductButton.cjs.js +1 -0
  136. package/lib/pages/cms/products/components/DeleteProductButton.es.js +48 -0
  137. package/lib/pages/cms/products/components/FreemiusPricingDashboard.cjs.js +1 -0
  138. package/lib/pages/cms/products/components/FreemiusPricingDashboard.es.js +86 -0
  139. package/lib/pages/cms/products/components/ProductCategorySelector.cjs.js +1 -0
  140. package/lib/pages/cms/products/components/ProductCategorySelector.es.js +160 -0
  141. package/lib/pages/cms/products/components/ProductForm.cjs.js +1 -0
  142. package/lib/pages/cms/products/components/ProductForm.es.js +702 -0
  143. package/lib/pages/cms/products/components/ProductMediaManager.cjs.js +1 -0
  144. package/lib/pages/cms/products/components/ProductMediaManager.es.js +104 -0
  145. package/lib/pages/cms/products/components/ProductsBulkTable.cjs.js +1 -0
  146. package/lib/pages/cms/products/components/ProductsBulkTable.es.js +228 -0
  147. package/lib/pages/cms/products/components/SaleScheduleFields.cjs.js +1 -0
  148. package/lib/pages/cms/products/components/SaleScheduleFields.es.js +137 -0
  149. package/lib/pages/cms/products/components/SyncFreemiusButton.cjs.js +1 -0
  150. package/lib/pages/cms/products/components/SyncFreemiusButton.es.js +36 -0
  151. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.cjs.js +1 -0
  152. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.es.js +40 -0
  153. package/lib/pages/cms/products/components/VariationsEditor.cjs.js +1 -0
  154. package/lib/pages/cms/products/components/VariationsEditor.es.js +408 -0
  155. package/lib/pages/cms/products/inventory/InventoryPage.cjs.js +1 -0
  156. package/lib/pages/cms/products/inventory/InventoryPage.es.js +16 -0
  157. package/lib/pages/cms/products/inventory/InventoryTableClient.cjs.js +2 -0
  158. package/lib/pages/cms/products/inventory/InventoryTableClient.es.js +214 -0
  159. package/lib/pages/cms/products/inventory/actions.cjs.js +3 -0
  160. package/lib/pages/cms/products/inventory/actions.es.js +95 -0
  161. package/lib/pages/cms/products/new/NewProductPage.cjs.js +1 -0
  162. package/lib/pages/cms/products/new/NewProductPage.es.js +76 -0
  163. package/lib/pages/cms/products/product-price-sync.cjs.js +1 -0
  164. package/lib/pages/cms/products/product-price-sync.es.js +98 -0
  165. package/lib/pages/cms/products/server-actions.cjs.js +1 -0
  166. package/lib/pages/cms/products/server-actions.es.js +193 -0
  167. package/lib/pages/cms/shipping/ShippingPage.cjs.js +5 -0
  168. package/lib/pages/cms/shipping/ShippingPage.es.js +211 -0
  169. package/lib/pages/cms/shipping/components/RateForm.cjs.js +1 -0
  170. package/lib/pages/cms/shipping/components/RateForm.es.js +441 -0
  171. package/lib/pages/cms/shipping/components/ZoneForm.cjs.js +1 -0
  172. package/lib/pages/cms/shipping/components/ZoneForm.es.js +228 -0
  173. package/lib/pages/cms/shipping/server-actions.cjs.js +1 -0
  174. package/lib/pages/cms/shipping/server-actions.es.js +159 -0
  175. package/lib/pages/cms/taxes/TaxesPage.cjs.js +1 -0
  176. package/lib/pages/cms/taxes/TaxesPage.es.js +172 -0
  177. package/lib/pages/cms/taxes/actions.cjs.js +1 -0
  178. package/lib/pages/cms/taxes/actions.es.js +57 -0
  179. package/lib/pages/cms/taxes/components/TaxRateForm.cjs.js +1 -0
  180. package/lib/pages/cms/taxes/components/TaxRateForm.es.js +100 -0
  181. package/lib/product-actions.cjs.js +237 -0
  182. package/lib/product-actions.es.js +524 -0
  183. package/lib/product-context.cjs.js +1 -0
  184. package/lib/product-context.es.js +16 -0
  185. package/lib/product-schema.cjs.js +1 -0
  186. package/lib/product-schema.es.js +134 -0
  187. package/lib/providers/freemius.cjs.js +5 -0
  188. package/lib/providers/freemius.es.js +538 -0
  189. package/lib/providers/stripe.cjs.js +1 -0
  190. package/lib/providers/stripe.es.js +473 -0
  191. package/lib/server-actions/coupon-actions.cjs.js +1 -0
  192. package/lib/server-actions/coupon-actions.es.js +23 -0
  193. package/lib/server-actions/customer-actions.cjs.js +1 -0
  194. package/lib/server-actions/customer-actions.es.js +30 -0
  195. package/lib/server-actions/product-actions.cjs.js +1 -0
  196. package/{server-actions → lib/server-actions}/product-actions.es.js +5 -4
  197. package/lib/server-actions/shipping-actions.cjs.js +1 -0
  198. package/{shipping-actions-BnHjlo2q.js → lib/server-actions/shipping-actions.es.js} +9 -7
  199. package/lib/server-actions/tax-actions.cjs.js +1 -0
  200. package/lib/server-actions/tax-actions.es.js +40 -0
  201. package/lib/shared-inventory.cjs.js +15 -0
  202. package/lib/shared-inventory.es.js +171 -0
  203. package/lib/shipping/resolver.cjs.js +7 -0
  204. package/lib/shipping/resolver.es.js +62 -0
  205. package/lib/shipping-rate-currency.cjs.js +1 -0
  206. package/lib/shipping-rate-currency.es.js +72 -0
  207. package/lib/states.cjs.js +1 -0
  208. package/{states-DlHJezQ1.js → lib/states.es.js} +27 -100
  209. package/lib/stripe/checkout.cjs.js +1 -0
  210. package/lib/stripe/checkout.es.js +182 -0
  211. package/lib/stripe/client.cjs.js +1 -0
  212. package/lib/stripe/client.es.js +7 -0
  213. package/lib/stripe/order-sync.cjs.js +1 -0
  214. package/lib/stripe/order-sync.es.js +130 -0
  215. package/lib/stripe/webhooks.cjs.js +1 -0
  216. package/lib/stripe/webhooks.es.js +30 -0
  217. package/lib/tax-calculation.cjs.js +1 -0
  218. package/lib/tax-calculation.es.js +101 -0
  219. package/lib/trials.cjs.js +1 -0
  220. package/{trials-RDcRAZKx.js → lib/trials.es.js} +9 -9
  221. package/{use-cart.es.js → lib/use-cart.es.js} +1 -0
  222. package/lib/zod-config.cjs.js +1 -0
  223. package/lib/zod-config.es.js +6 -0
  224. package/package.json +4 -4
  225. package/server.cjs.js +1 -110
  226. package/server.es.js +178 -6052
  227. package/AddToCartButton-DsSEH9yp.cjs +0 -1
  228. package/CouponForm-BI_5SBHQ.js +0 -152
  229. package/CouponForm-D_uu2bLP.cjs +0 -1
  230. package/CurrencyProvider-Cg-Q6ucj.cjs +0 -1
  231. package/CurrencyProvider-OzlRN96V.js +0 -120
  232. package/CurrencyProvider.cjs.js +0 -1
  233. package/CurrencyProvider.es.js +0 -10
  234. package/ProductDetailsLayout-BxJH_BxR.cjs +0 -1
  235. package/ProductDetailsLayout-Dg8dRTYp.js +0 -530
  236. package/ProductGrid-BdL7iglO.cjs +0 -1
  237. package/ProductGrid-D3AWM8sr.js +0 -130
  238. package/actions-AHmBrS5e.cjs +0 -48
  239. package/actions-j5fuSZX-.js +0 -820
  240. package/cart-store.cjs.js +0 -1
  241. package/components/Cart.cjs.js +0 -1
  242. package/components/Cart.es.js +0 -259
  243. package/components/CartDrawer.cjs.js +0 -1
  244. package/components/Checkout.cjs.js +0 -1
  245. package/components/CurrencySwitcher.cjs.js +0 -1
  246. package/components/FeaturedProduct.cjs.js +0 -1
  247. package/components/ProductDetailsLayout.cjs.js +0 -1
  248. package/components/ProductDetailsLayout.es.js +0 -19
  249. package/components/ProductGrid.cjs.js +0 -1
  250. package/components/ProductGrid.es.js +0 -6
  251. package/coupon-server-C9ySm3I5.cjs +0 -1
  252. package/customer-C-UPvrYN.cjs +0 -1
  253. package/invoice-ui-CAnJPu6n.cjs +0 -29
  254. package/invoice-ui-DtpbTJE1.js +0 -2886
  255. package/product-actions-CONBF8i6.cjs +0 -251
  256. package/product-actions-DjlIWCMH.js +0 -691
  257. package/resolver-Fz_FKsfX.cjs +0 -7
  258. package/resolver-cfrCaHpE.js +0 -128
  259. package/server-actions/product-actions.cjs.js +0 -1
  260. package/shipping-actions-D6zt20gg.cjs +0 -1
  261. package/states-CWYRxV4B.cjs +0 -1
  262. package/tax-calculation-Dab89aHd.js +0 -181
  263. package/tax-calculation-MkDKOEkL.cjs +0 -1
  264. package/trials-DvZaOtNy.cjs +0 -1
  265. /package/{components → lib/components}/SimpleTiptapRenderer.cjs.js +0 -0
  266. /package/{components → lib/components}/SimpleTiptapRenderer.es.js +0 -0
  267. /package/{currency-constants.cjs.js → lib/currency-constants.cjs.js} +0 -0
  268. /package/{currency-constants.es.js → lib/currency-constants.es.js} +0 -0
  269. /package/{currency-rest-client-uolJxUkL.cjs → lib/currency-rest-client.cjs.js} +0 -0
  270. /package/{currency-rest-client-CwoqdgAP.js → lib/currency-rest-client.es.js} +0 -0
  271. /package/{currency.cjs.js → lib/currency.cjs.js} +0 -0
  272. /package/{currency.es.js → lib/currency.es.js} +0 -0
  273. /package/{types.cjs.js → lib/types.cjs.js} +0 -0
  274. /package/{types.es.js → lib/types.es.js} +0 -0
  275. /package/{use-cart.cjs.js → lib/use-cart.cjs.js} +0 -0
  276. /package/{variation-utils.cjs.js → lib/variation-utils.cjs.js} +0 -0
  277. /package/{variation-utils.es.js → lib/variation-utils.es.js} +0 -0
@@ -1,67 +1,34 @@
1
+ 'use client';
1
2
  import { jsx as e, jsxs as r, Fragment as st } from "react/jsx-runtime";
2
- import { Badge as Be } from "@nextblock-cms/ui/badge";
3
+ import { Badge as Oe } from "@nextblock-cms/ui/badge";
3
4
  import { Button as _e } from "@nextblock-cms/ui/button";
4
- import { Card as X, CardHeader as Y, CardTitle as V, CardContent as W } from "@nextblock-cms/ui/card";
5
- import { Checkbox as it } from "@nextblock-cms/ui/checkbox";
6
- import { Input as I } from "@nextblock-cms/ui/input";
5
+ import { Card as Q, CardHeader as X, CardTitle as Y, CardContent as V } from "@nextblock-cms/ui/card";
6
+ import { Checkbox as lt } from "@nextblock-cms/ui/checkbox";
7
+ import { Input as j } from "@nextblock-cms/ui/input";
7
8
  import { Label as v } from "@nextblock-cms/ui/label";
8
- import { Separator as lt } from "@nextblock-cms/ui/separator";
9
- import { RadioGroup as at, RadioGroupItem as De } from "@nextblock-cms/ui/radio-group";
10
- import { Checkout as ot } from "@freemius/checkout";
9
+ import { Separator as it } from "@nextblock-cms/ui/separator";
10
+ import { RadioGroup as ot, RadioGroupItem as De } from "@nextblock-cms/ui/radio-group";
11
+ import { Checkout as at } from "@freemius/checkout";
11
12
  import { getCartItemActivePrice as Ne } from "../cart-store.es.js";
12
13
  import { useCart as dt } from "../use-cart.es.js";
13
- import { useState as y, useMemo as E, useEffect as le } from "react";
14
+ import { useState as _, useMemo as $, useEffect as ie } from "react";
14
15
  import { X as mt, FlaskConical as ut, CreditCard as pt, ChevronRight as ht, Loader2 as ye, Package as ft, Download as gt, MapPin as _t } from "lucide-react";
15
- import { useTranslations as Oe, formatPrice as x } from "@nextblock-cms/utils";
16
- import { n as yt, a as we, g as Me, c as xt } from "../states-DlHJezQ1.js";
17
- import { g as bt } from "../shipping-actions-BnHjlo2q.js";
18
- import { createClient as Nt, getServiceRoleSupabaseClient as vt } from "@nextblock-cms/db/server";
19
- import { b as wt, c as kt } from "../tax-calculation-Dab89aHd.js";
20
- import { a as St, b as Ct } from "../coupon-server-DUKVtyYs.js";
16
+ import { useTranslations as qe, formatPrice as y } from "@nextblock-cms/utils";
17
+ import { normalizeCountryCode as yt, countries as xt } from "../countries.es.js";
18
+ import { getShippingEstimates as bt } from "../server-actions/shipping-actions.es.js";
19
+ import { getTaxEstimate as Nt } from "../server-actions/tax-actions.es.js";
21
20
  import { isDigitalItem as xe } from "../types.es.js";
22
- import { a as Ft, e as Tt, n as ve, i as Le } from "../customer-C3xccjUg.js";
23
- import { u as At } from "../CurrencyProvider-OzlRN96V.js";
24
- import { d as Re } from "../trials-RDcRAZKx.js";
25
- import { C as $t } from "../CouponForm-BI_5SBHQ.js";
26
- async function jt(c, g, C = "USD", i, f) {
27
- try {
28
- const m = Nt(), T = vt(), { data: A } = await m.from("currencies").select(
29
- "code, symbol, exchange_rate, is_default, is_active, auto_sync_product_prices, auto_update_exchange_rate, exchange_rate_source, exchange_rate_updated_at, rounding_mode, rounding_increment, rounding_charm_amount"
30
- ).eq("is_active", !0).order("code", { ascending: !0 }), K = A ?? [];
31
- let D;
32
- if (i) {
33
- const M = await St({
34
- client: T,
35
- code: i,
36
- items: f && f.length > 0 ? f : c,
37
- currencyCode: C
38
- });
39
- M.success && (D = Ct(M.quote));
40
- }
41
- const q = await wt(
42
- m,
43
- c,
44
- C,
45
- K,
46
- D
47
- );
48
- return { success: !0, tax: await kt(m, {
49
- items: q,
50
- destination: g
51
- }) };
52
- } catch (m) {
53
- return console.error("Failed to estimate taxes:", m), {
54
- success: !1,
55
- error: m.message || "Failed to calculate taxes"
56
- };
57
- }
58
- }
59
- const Pt = process.env.NEXT_PUBLIC_IS_SANDBOX === "true", ae = "nextblock-checkout-draft-v1";
60
- function oe(c, g) {
21
+ import { countryUsesStructuredStates as ke, getStatesForCountry as Me } from "../states.es.js";
22
+ import { addressesMatch as vt, emptyCustomerAddress as kt, normalizeCustomerAddress as ve, isCustomerAddressComplete as Le } from "../customer.es.js";
23
+ import { useCurrency as wt } from "../CurrencyProvider.es.js";
24
+ import { getTrialSummary as Re } from "../trials.es.js";
25
+ import { CouponForm as St } from "./CouponForm.es.js";
26
+ const Ct = process.env.NEXT_PUBLIC_IS_SANDBOX === "true", oe = "nextblock-checkout-draft-v1";
27
+ function ae(c, x) {
61
28
  return {
62
- ...Tt(),
29
+ ...kt(),
63
30
  company_name: c?.company_name || "",
64
- recipient_name: c?.recipient_name || g || "",
31
+ recipient_name: c?.recipient_name || x || "",
65
32
  line1: c?.line1 || "",
66
33
  line2: c?.line2 || "",
67
34
  city: c?.city || "",
@@ -70,73 +37,73 @@ function oe(c, g) {
70
37
  country_code: yt(c?.country_code) || "CA"
71
38
  };
72
39
  }
73
- function Et(c) {
74
- const g = ve(c);
75
- return !(!g?.country_code || !g.postal_code || we(g.country_code) && !g.state);
40
+ function Ft(c) {
41
+ const x = ve(c);
42
+ return !(!x?.country_code || !x.postal_code || ke(x.country_code) && !x.state);
76
43
  }
77
- function be(c, g, C) {
78
- return c.reduce((i, f) => {
79
- const { price: m, sale_price: T } = Ne(f, {
80
- currencyCode: g,
81
- currencies: C
44
+ function be(c, x, P) {
45
+ return c.reduce((l, f) => {
46
+ const { price: h, sale_price: I } = Ne(f, {
47
+ currencyCode: x,
48
+ currencies: P
82
49
  });
83
- return i + (T ?? m) * f.quantity;
50
+ return l + (I ?? h) * f.quantity;
84
51
  }, 0);
85
52
  }
86
- function qe({
53
+ function ze({
87
54
  idPrefix: c,
88
- title: g,
89
- description: C,
90
- value: i,
55
+ title: x,
56
+ description: P,
57
+ value: l,
91
58
  onChange: f
92
59
  }) {
93
- const { t: m } = Oe(), T = m("company_name") === "company_name" ? "Company name" : m("company_name"), A = m("select_an_option") === "select_an_option" ? "Select an option" : m("select_an_option"), K = m("state_province") === "state_province" ? "State / Province" : m("state_province"), D = Me(i.country_code), q = we(i.country_code);
94
- return /* @__PURE__ */ r(X, { children: [
95
- /* @__PURE__ */ r(Y, { children: [
96
- /* @__PURE__ */ r(V, { className: "flex items-center gap-2", children: [
60
+ const { t: h } = qe(), I = h("company_name") === "company_name" ? "Company name" : h("company_name"), E = h("select_an_option") === "select_an_option" ? "Select an option" : h("select_an_option"), W = h("state_province") === "state_province" ? "State / Province" : h("state_province"), q = Me(l.country_code), K = ke(l.country_code);
61
+ return /* @__PURE__ */ r(Q, { children: [
62
+ /* @__PURE__ */ r(X, { children: [
63
+ /* @__PURE__ */ r(Y, { className: "flex items-center gap-2", children: [
97
64
  /* @__PURE__ */ e(_t, { className: "w-5 h-5" }),
98
- g
65
+ x
99
66
  ] }),
100
- /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: C })
67
+ /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: P })
101
68
  ] }),
102
- /* @__PURE__ */ r(W, { className: "space-y-4", children: [
69
+ /* @__PURE__ */ r(V, { className: "space-y-4", children: [
103
70
  /* @__PURE__ */ r("div", { className: "grid gap-4 sm:grid-cols-3", children: [
104
71
  /* @__PURE__ */ r("div", { className: "space-y-2", children: [
105
- /* @__PURE__ */ e(v, { htmlFor: `${c}-company`, children: T }),
72
+ /* @__PURE__ */ e(v, { htmlFor: `${c}-company`, children: I }),
106
73
  /* @__PURE__ */ e(
107
- I,
74
+ j,
108
75
  {
109
76
  id: `${c}-company`,
110
- value: i.company_name,
111
- onChange: (a) => f({ ...i, company_name: a.target.value })
77
+ value: l.company_name,
78
+ onChange: (a) => f({ ...l, company_name: a.target.value })
112
79
  }
113
80
  )
114
81
  ] }),
115
82
  /* @__PURE__ */ r("div", { className: "space-y-2", children: [
116
- /* @__PURE__ */ e(v, { htmlFor: `${c}-name`, children: m("full_name") }),
83
+ /* @__PURE__ */ e(v, { htmlFor: `${c}-name`, children: h("full_name") }),
117
84
  /* @__PURE__ */ e(
118
- I,
85
+ j,
119
86
  {
120
87
  id: `${c}-name`,
121
- value: i.recipient_name,
122
- onChange: (a) => f({ ...i, recipient_name: a.target.value })
88
+ value: l.recipient_name,
89
+ onChange: (a) => f({ ...l, recipient_name: a.target.value })
123
90
  }
124
91
  )
125
92
  ] }),
126
93
  /* @__PURE__ */ r("div", { className: "space-y-2", children: [
127
- /* @__PURE__ */ e(v, { htmlFor: `${c}-country`, children: m("country") }),
94
+ /* @__PURE__ */ e(v, { htmlFor: `${c}-country`, children: h("country") }),
128
95
  /* @__PURE__ */ e(
129
96
  "select",
130
97
  {
131
98
  id: `${c}-country`,
132
99
  className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
133
- value: i.country_code,
100
+ value: l.country_code,
134
101
  onChange: (a) => {
135
- const M = a.target.value, de = Me(M);
102
+ const U = a.target.value, de = Me(U);
136
103
  f({
137
- ...i,
138
- country_code: M,
139
- state: de.some((Z) => Z.code === i.state) ? i.state : ""
104
+ ...l,
105
+ country_code: U,
106
+ state: de.some((Z) => Z.code === l.state) ? l.state : ""
140
107
  });
141
108
  },
142
109
  children: xt.map((a) => /* @__PURE__ */ e("option", { value: a.code, children: a.name }, a.code))
@@ -145,70 +112,70 @@ function qe({
145
112
  ] })
146
113
  ] }),
147
114
  /* @__PURE__ */ r("div", { className: "space-y-2", children: [
148
- /* @__PURE__ */ e(v, { htmlFor: `${c}-line1`, children: m("address_line_1") }),
115
+ /* @__PURE__ */ e(v, { htmlFor: `${c}-line1`, children: h("address_line_1") }),
149
116
  /* @__PURE__ */ e(
150
- I,
117
+ j,
151
118
  {
152
119
  id: `${c}-line1`,
153
- value: i.line1,
154
- onChange: (a) => f({ ...i, line1: a.target.value })
120
+ value: l.line1,
121
+ onChange: (a) => f({ ...l, line1: a.target.value })
155
122
  }
156
123
  )
157
124
  ] }),
158
125
  /* @__PURE__ */ r("div", { className: "space-y-2", children: [
159
- /* @__PURE__ */ e(v, { htmlFor: `${c}-line2`, children: m("address_line_2") }),
126
+ /* @__PURE__ */ e(v, { htmlFor: `${c}-line2`, children: h("address_line_2") }),
160
127
  /* @__PURE__ */ e(
161
- I,
128
+ j,
162
129
  {
163
130
  id: `${c}-line2`,
164
- value: i.line2,
165
- onChange: (a) => f({ ...i, line2: a.target.value })
131
+ value: l.line2,
132
+ onChange: (a) => f({ ...l, line2: a.target.value })
166
133
  }
167
134
  )
168
135
  ] }),
169
136
  /* @__PURE__ */ r("div", { className: "grid gap-4 sm:grid-cols-3", children: [
170
137
  /* @__PURE__ */ r("div", { className: "space-y-2", children: [
171
- /* @__PURE__ */ e(v, { htmlFor: `${c}-city`, children: m("city") }),
138
+ /* @__PURE__ */ e(v, { htmlFor: `${c}-city`, children: h("city") }),
172
139
  /* @__PURE__ */ e(
173
- I,
140
+ j,
174
141
  {
175
142
  id: `${c}-city`,
176
- value: i.city,
177
- onChange: (a) => f({ ...i, city: a.target.value })
143
+ value: l.city,
144
+ onChange: (a) => f({ ...l, city: a.target.value })
178
145
  }
179
146
  )
180
147
  ] }),
181
148
  /* @__PURE__ */ r("div", { className: "space-y-2", children: [
182
- /* @__PURE__ */ e(v, { htmlFor: `${c}-state`, children: m("state_province") }),
183
- q ? /* @__PURE__ */ r(
149
+ /* @__PURE__ */ e(v, { htmlFor: `${c}-state`, children: h("state_province") }),
150
+ K ? /* @__PURE__ */ r(
184
151
  "select",
185
152
  {
186
153
  id: `${c}-state`,
187
154
  className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
188
- value: i.state,
189
- onChange: (a) => f({ ...i, state: a.target.value }),
155
+ value: l.state,
156
+ onChange: (a) => f({ ...l, state: a.target.value }),
190
157
  children: [
191
- /* @__PURE__ */ e("option", { value: "", children: `${A}: ${K}` }),
192
- D.map((a) => /* @__PURE__ */ e("option", { value: a.code, children: a.name }, a.code))
158
+ /* @__PURE__ */ e("option", { value: "", children: `${E}: ${W}` }),
159
+ q.map((a) => /* @__PURE__ */ e("option", { value: a.code, children: a.name }, a.code))
193
160
  ]
194
161
  }
195
162
  ) : /* @__PURE__ */ e(
196
- I,
163
+ j,
197
164
  {
198
165
  id: `${c}-state`,
199
- value: i.state,
200
- onChange: (a) => f({ ...i, state: a.target.value })
166
+ value: l.state,
167
+ onChange: (a) => f({ ...l, state: a.target.value })
201
168
  }
202
169
  )
203
170
  ] }),
204
171
  /* @__PURE__ */ r("div", { className: "space-y-2", children: [
205
- /* @__PURE__ */ e(v, { htmlFor: `${c}-postal`, children: m("postal_zip_code") }),
172
+ /* @__PURE__ */ e(v, { htmlFor: `${c}-postal`, children: h("postal_zip_code") }),
206
173
  /* @__PURE__ */ e(
207
- I,
174
+ j,
208
175
  {
209
176
  id: `${c}-postal`,
210
- value: i.postal_code,
211
- onChange: (a) => f({ ...i, postal_code: a.target.value })
177
+ value: l.postal_code,
178
+ onChange: (a) => f({ ...l, postal_code: a.target.value })
212
179
  }
213
180
  )
214
181
  ] })
@@ -216,139 +183,139 @@ function qe({
216
183
  ] })
217
184
  ] });
218
185
  }
219
- function ze({
186
+ function Be({
220
187
  title: c,
221
- description: g,
222
- badgeLabel: C,
223
- children: i
188
+ description: x,
189
+ badgeLabel: P,
190
+ children: l
224
191
  }) {
225
- return /* @__PURE__ */ r(X, { children: [
226
- /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-3 flex-wrap", children: [
192
+ return /* @__PURE__ */ r(Q, { children: [
193
+ /* @__PURE__ */ e(X, { children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-3 flex-wrap", children: [
227
194
  /* @__PURE__ */ r("div", { children: [
228
- /* @__PURE__ */ e(V, { children: c }),
229
- /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-muted-foreground", children: g })
195
+ /* @__PURE__ */ e(Y, { children: c }),
196
+ /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-muted-foreground", children: x })
230
197
  ] }),
231
- C ? /* @__PURE__ */ e(Be, { variant: "secondary", children: C }) : null
198
+ P ? /* @__PURE__ */ e(Oe, { variant: "secondary", children: P }) : null
232
199
  ] }) }),
233
- /* @__PURE__ */ e(W, { className: "space-y-4", children: i })
200
+ /* @__PURE__ */ e(V, { className: "space-y-4", children: l })
234
201
  ] });
235
202
  }
236
- const sr = ({ initialCustomer: c }) => {
237
- const [g, C] = y({}), [i, f] = y(null), [m, T] = y({}), [A, K] = y(c?.email || ""), [D, q] = y(""), [a, M] = y(c?.phone || ""), [de, Z] = y(!1), [Ke, ke] = y(null), [Se, ee] = y(!1), [Ue, te] = y(!1), [J, re] = y([]), [b, U] = y(null), [F, ce] = y(null), [L, Qe] = y(null), [j, Ce] = y(
238
- () => oe(c?.billingAddress, c?.fullName)
239
- ), [Q, Fe] = y(
240
- () => oe(
203
+ const Wt = ({ initialCustomer: c }) => {
204
+ const [x, P] = _({}), [l, f] = _(null), [h, I] = _({}), [E, W] = _(c?.email || ""), [q, K] = _(""), [a, U] = _(c?.phone || ""), [de, Z] = _(!1), [Ke, we] = _(null), [Se, ee] = _(!1), [Ue, te] = _(!1), [J, re] = _([]), [b, B] = _(null), [C, ce] = _(null), [D, Je] = _(null), [A, Ce] = _(
205
+ () => ae(c?.billingAddress, c?.fullName)
206
+ ), [O, Fe] = _(
207
+ () => ae(
241
208
  c?.shippingAddress ?? c?.billingAddress,
242
209
  c?.fullName
243
210
  )
244
- ), [z, Te] = y(
245
- !c?.shippingAddress || Ft(c?.billingAddress, c?.shippingAddress)
246
- ), G = dt((t) => t), { t: s, lang: me } = Oe(), { activeCurrencyCode: o, currencies: R } = At(), N = G?.items ?? [], w = E(
211
+ ), [L, Ae] = _(
212
+ !c?.shippingAddress || vt(c?.billingAddress, c?.shippingAddress)
213
+ ), G = dt((t) => t), { t: s, lang: me } = qe(), { activeCurrencyCode: o, currencies: M } = wt(), N = G?.items ?? [], k = $(
247
214
  () => N.filter((t) => !xe(t)),
248
215
  [N]
249
- ), k = E(
216
+ ), w = $(
250
217
  () => N.filter((t) => xe(t)),
251
218
  [N]
252
- ), B = c?.isAuthenticated ?? !1, n = (t, l, p) => {
253
- const u = s(t, p);
254
- if (u !== t)
255
- return u;
256
- if (!p)
257
- return l;
258
- let _ = l;
259
- return Object.entries(p).forEach(([h, d]) => {
260
- _ = _.replace(
261
- new RegExp(`\\{${h}\\}`, "g"),
219
+ ), R = c?.isAuthenticated ?? !1, n = (t, i, u) => {
220
+ const m = s(t, u);
221
+ if (m !== t)
222
+ return m;
223
+ if (!u)
224
+ return i;
225
+ let g = i;
226
+ return Object.entries(u).forEach(([p, d]) => {
227
+ g = g.replace(
228
+ new RegExp(`\\{${p}\\}`, "g"),
262
229
  String(d)
263
230
  );
264
- }), _;
265
- }, S = w.length > 0, Je = E(
266
- () => be(N, o, R),
267
- [o, R, N]
268
- ), ue = E(
269
- () => be(w, o, R),
270
- [o, R, w]
271
- ), pe = E(
272
- () => be(k, o, R),
273
- [o, R, k]
274
- ), he = L?.providerDiscounts.stripe ?? 0, fe = L?.providerDiscounts.freemius ?? 0, ne = Math.max(0, ue - he), Ge = Math.max(0, pe - fe), $ = E(
275
- () => z ? j : Q,
276
- [j, Q, z]
277
- ), O = E(
278
- () => S ? $ : j,
279
- [j, S, $]
280
- ), se = !S || Et($), ie = E(
231
+ }), g;
232
+ }, S = k.length > 0, Ge = $(
233
+ () => be(N, o, M),
234
+ [o, M, N]
235
+ ), ue = $(
236
+ () => be(k, o, M),
237
+ [o, M, k]
238
+ ), pe = $(
239
+ () => be(w, o, M),
240
+ [o, M, w]
241
+ ), he = D?.providerDiscounts.stripe ?? 0, fe = D?.providerDiscounts.freemius ?? 0, ne = Math.max(0, ue - he), He = Math.max(0, pe - fe), F = $(
242
+ () => L ? A : O,
243
+ [A, O, L]
244
+ ), z = $(
245
+ () => S ? F : A,
246
+ [A, S, F]
247
+ ), se = !S || Ft(F), le = $(
281
248
  () => J.find((t) => t.id === b),
282
249
  [J, b]
283
- ), Ae = E(
284
- () => ne + (ie?.amount ?? 0) + (F && !F.isPendingExternalCalculation ? F.amount : 0),
285
- [ne, ie, F]
286
- ), He = Ae + Ge;
287
- if (le(() => {
288
- if (!(B || typeof window > "u"))
250
+ ), Te = $(
251
+ () => ne + (le?.amount ?? 0) + (C && !C.isPendingExternalCalculation ? C.amount : 0),
252
+ [ne, le, C]
253
+ ), Qe = Te + He;
254
+ if (ie(() => {
255
+ if (!(R || typeof window > "u"))
289
256
  try {
290
- const t = window.localStorage.getItem(ae);
257
+ const t = window.localStorage.getItem(oe);
291
258
  if (!t)
292
259
  return;
293
- const l = JSON.parse(t);
294
- l.email && K(l.email), l.phone && M(l.phone), l.billingAddress && Ce(oe(l.billingAddress)), l.shippingAddress && Fe(oe(l.shippingAddress)), typeof l.useBillingForShipping == "boolean" && Te(l.useBillingForShipping), (typeof l.selectedMethodId == "string" || l.selectedMethodId === null) && U(l.selectedMethodId);
260
+ const i = JSON.parse(t);
261
+ i.email && W(i.email), i.phone && U(i.phone), i.billingAddress && Ce(ae(i.billingAddress)), i.shippingAddress && Fe(ae(i.shippingAddress)), typeof i.useBillingForShipping == "boolean" && Ae(i.useBillingForShipping), (typeof i.selectedMethodId == "string" || i.selectedMethodId === null) && B(i.selectedMethodId);
295
262
  } catch (t) {
296
263
  console.error("[Checkout] Failed to restore checkout draft:", t);
297
264
  }
298
- }, [B]), le(() => {
265
+ }, [R]), ie(() => {
299
266
  if (!(typeof window > "u")) {
300
- if (B) {
301
- window.localStorage.removeItem(ae);
267
+ if (R) {
268
+ window.localStorage.removeItem(oe);
302
269
  return;
303
270
  }
304
271
  window.localStorage.setItem(
305
- ae,
272
+ oe,
306
273
  JSON.stringify({
307
- email: A,
274
+ email: E,
308
275
  phone: a,
309
- billingAddress: j,
310
- shippingAddress: Q,
311
- useBillingForShipping: z,
276
+ billingAddress: A,
277
+ shippingAddress: O,
278
+ useBillingForShipping: L,
312
279
  selectedMethodId: b
313
280
  })
314
281
  );
315
282
  }
316
283
  }, [
317
- j,
318
284
  A,
319
- B,
285
+ E,
286
+ R,
320
287
  a,
321
288
  b,
322
- Q,
323
- z
324
- ]), le(() => {
289
+ O,
290
+ L
291
+ ]), ie(() => {
325
292
  if (!S) {
326
- re([]), U(null), ee(!1);
293
+ re([]), B(null), ee(!1);
327
294
  return;
328
295
  }
329
296
  if (!se) {
330
- re([]), U(null), ee(!1);
297
+ re([]), B(null), ee(!1);
331
298
  return;
332
299
  }
333
300
  let t = !1;
334
- const p = setTimeout(async () => {
335
- if (!$.country_code)
301
+ const u = setTimeout(async () => {
302
+ if (!F.country_code)
336
303
  return;
337
304
  ee(!0);
338
- const u = await bt(
305
+ const m = await bt(
339
306
  ne,
340
307
  {
341
- country: $.country_code,
342
- state: $.state,
343
- postal_code: $.postal_code
308
+ country: F.country_code,
309
+ state: F.state,
310
+ postal_code: F.postal_code
344
311
  },
345
312
  me,
346
313
  o
347
314
  );
348
- t || (u.success && u.methods ? (re(u.methods), u.methods.length > 0 && (!b || !u.methods.find((_) => _.id === b)) && U(u.methods[0].id)) : (re([]), U(null)), ee(!1));
315
+ t || (m.success && m.methods ? (re(m.methods), m.methods.length > 0 && (!b || !m.methods.find((g) => g.id === b)) && B(m.methods[0].id)) : (re([]), B(null)), ee(!1));
349
316
  }, 400);
350
317
  return () => {
351
- t = !0, clearTimeout(p);
318
+ t = !0, clearTimeout(u);
352
319
  };
353
320
  }, [
354
321
  o,
@@ -356,46 +323,46 @@ const sr = ({ initialCustomer: c }) => {
356
323
  se,
357
324
  me,
358
325
  b,
359
- $.country_code,
360
- $.postal_code,
361
- $.state,
326
+ F.country_code,
327
+ F.postal_code,
328
+ F.state,
362
329
  ne
363
- ]), le(() => {
364
- const l = setTimeout(async () => {
365
- if (!S || !O.country_code) {
330
+ ]), ie(() => {
331
+ const i = setTimeout(async () => {
332
+ if (!S || !z.country_code) {
366
333
  te(!1), ce(null);
367
334
  return;
368
335
  }
369
- if (we(O.country_code) && !O.state) {
336
+ if (ke(z.country_code) && !z.state) {
370
337
  te(!1), ce(null);
371
338
  return;
372
339
  }
373
340
  te(!0);
374
- const p = await jt(
375
- w,
341
+ const u = await Nt(
342
+ k,
376
343
  {
377
- country_code: O.country_code,
378
- state: O.state
344
+ country_code: z.country_code,
345
+ state: z.state
379
346
  },
380
347
  o,
381
- L?.code ?? null,
348
+ D?.code ?? null,
382
349
  N
383
350
  );
384
- p.success && p.tax ? ce(p.tax) : ce(null), te(!1);
351
+ u.success && u.tax ? ce(u.tax) : ce(null), te(!1);
385
352
  }, 300);
386
- return () => clearTimeout(l);
353
+ return () => clearTimeout(i);
387
354
  }, [
388
355
  o,
389
356
  S,
390
- w,
391
- O.country_code,
392
- O.state,
393
- L?.code,
357
+ k,
358
+ z.country_code,
359
+ z.state,
360
+ D?.code,
394
361
  N
395
362
  ]), !G)
396
363
  return null;
397
364
  const $e = () => {
398
- Z(!1), ke(null);
365
+ Z(!1), we(null);
399
366
  }, je = de ? /* @__PURE__ */ e(
400
367
  "div",
401
368
  {
@@ -443,14 +410,14 @@ const sr = ({ initialCustomer: c }) => {
443
410
  )
444
411
  }
445
412
  ) : null, Xe = (t) => {
446
- if (!B && (!A || !/^\S+@\S+\.\S+$/.test(A)))
447
- return q(s("ecommerce.invalid_email")), null;
448
- const l = ve(j);
449
- if (!Le(l))
413
+ if (!R && (!E || !/^\S+@\S+\.\S+$/.test(E)))
414
+ return K(s("ecommerce.invalid_email")), null;
415
+ const i = ve(A);
416
+ if (!Le(i))
450
417
  return alert(s("checkout_complete_billing_address")), null;
451
- const p = S ? ve(z ? j : Q) : null;
418
+ const u = S ? ve(L ? A : O) : null;
452
419
  if (t === "stripe") {
453
- if (!Le(p))
420
+ if (!Le(u))
454
421
  return alert(s("checkout_complete_shipping_address")), null;
455
422
  if (!b)
456
423
  return alert(
@@ -460,67 +427,67 @@ const sr = ({ initialCustomer: c }) => {
460
427
  )
461
428
  ), null;
462
429
  }
463
- return q(""), {
464
- normalizedBillingAddress: l,
465
- normalizedShippingAddress: p
430
+ return K(""), {
431
+ normalizedBillingAddress: i,
432
+ normalizedShippingAddress: u
466
433
  };
467
- }, Pe = async (t, l, p) => {
468
- T((_) => ({
469
- ..._,
434
+ }, Pe = async (t, i, u) => {
435
+ I((g) => ({
436
+ ...g,
470
437
  [t]: ""
471
438
  }));
472
- const u = Xe(t);
473
- if (u) {
474
- if (Pt) {
475
- const _ = new Set(l.map((d) => d.id)), h = N.filter((d) => !_.has(d.id));
476
- G.setItems(h), h.length === 0 && G.removeCoupon(), ke(t), Z(!0), typeof window < "u" && h.length === 0 && window.localStorage.removeItem(ae);
439
+ const m = Xe(t);
440
+ if (m) {
441
+ if (Ct) {
442
+ const g = new Set(i.map((d) => d.id)), p = N.filter((d) => !g.has(d.id));
443
+ G.setItems(p), p.length === 0 && G.removeCoupon(), we(t), Z(!0), typeof window < "u" && p.length === 0 && window.localStorage.removeItem(oe);
477
444
  return;
478
445
  }
479
- f(p);
446
+ f(u);
480
447
  try {
481
- const _ = await fetch("/api/checkout", {
448
+ const g = await fetch("/api/checkout", {
482
449
  method: "POST",
483
450
  headers: { "Content-Type": "application/json" },
484
451
  body: JSON.stringify({
485
- items: l,
486
- customerEmail: B ? void 0 : A,
452
+ items: i,
453
+ customerEmail: R ? void 0 : E,
487
454
  customerPhone: a || null,
488
- billingAddress: u.normalizedBillingAddress,
489
- shippingAddress: t === "stripe" ? u.normalizedShippingAddress : null,
455
+ billingAddress: m.normalizedBillingAddress,
456
+ shippingAddress: t === "stripe" ? m.normalizedShippingAddress : null,
490
457
  shippingMethodId: t === "stripe" ? b : null,
491
458
  locale: me,
492
459
  currencyCode: o,
493
- couponCode: L?.code ?? G.appliedCoupon?.code ?? null,
460
+ couponCode: D?.code ?? G.appliedCoupon?.code ?? null,
494
461
  couponContextItems: N
495
462
  })
496
- }), h = await _.json();
497
- if (!_.ok) {
498
- const d = h?.errorKey && typeof h.errorKey == "string" ? n(
499
- h.errorKey,
500
- h?.error || n("ecommerce.generic_error", "Something went wrong."),
501
- h.errorParams
502
- ) : h?.error || s("ecommerce.generic_error");
503
- T((H) => ({
463
+ }), p = await g.json();
464
+ if (!g.ok) {
465
+ const d = p?.errorKey && typeof p.errorKey == "string" ? n(
466
+ p.errorKey,
467
+ p?.error || n("ecommerce.generic_error", "Something went wrong."),
468
+ p.errorParams
469
+ ) : p?.error || s("ecommerce.generic_error");
470
+ I((H) => ({
504
471
  ...H,
505
472
  [t]: d
506
473
  })), f(null);
507
474
  return;
508
475
  }
509
- if (h.customProps && h.customProps.provider === "freemius") {
510
- const d = h.customProps;
476
+ if (p.customProps && p.customProps.provider === "freemius") {
477
+ const d = p.customProps;
511
478
  let H = null;
512
479
  const tt = () => {
513
480
  window.location.href = `/checkout/success?session_id=${d.order_id}`;
514
- }, Ee = (P) => (H || (H = fetch("/api/checkout/freemius/sync", {
481
+ }, Ie = (T) => (H || (H = fetch("/api/checkout/freemius/sync", {
515
482
  method: "POST",
516
483
  headers: { "Content-Type": "application/json" },
517
484
  body: JSON.stringify({
518
485
  orderId: d.order_id,
519
- checkoutResponse: P
486
+ checkoutResponse: T
520
487
  })
521
- }).then(async (Ie) => {
522
- if (!Ie.ok) {
523
- const nt = await Ie.json().catch(() => null);
488
+ }).then(async (Ee) => {
489
+ if (!Ee.ok) {
490
+ const nt = await Ee.json().catch(() => null);
524
491
  console.error("Freemius checkout sync failed:", nt);
525
492
  }
526
493
  })), H), rt = {
@@ -537,13 +504,13 @@ const sr = ({ initialCustomer: c }) => {
537
504
  user_firstname: d.user_firstname,
538
505
  user_lastname: d.user_lastname,
539
506
  sandbox: d.sandbox,
540
- purchaseCompleted: function(P) {
541
- Ee(P);
507
+ purchaseCompleted: function(T) {
508
+ Ie(T);
542
509
  },
543
- success: function(P) {
510
+ success: function(T) {
544
511
  (async () => {
545
512
  try {
546
- await Ee(P);
513
+ await Ie(T);
547
514
  } finally {
548
515
  tt();
549
516
  }
@@ -551,19 +518,19 @@ const sr = ({ initialCustomer: c }) => {
551
518
  }
552
519
  };
553
520
  try {
554
- new ot(rt).open(ct), f(null);
555
- } catch (P) {
521
+ new at(rt).open(ct), f(null);
522
+ } catch (T) {
556
523
  alert(
557
- s("ecommerce.checkout_popup_blocked") + " " + (P.message || String(P))
558
- ), h.url && (window.location.href = h.url), f(null);
524
+ s("ecommerce.checkout_popup_blocked") + " " + (T.message || String(T))
525
+ ), p.url && (window.location.href = p.url), f(null);
559
526
  }
560
- } else h.url ? window.location.href = h.url : (T((d) => ({
527
+ } else p.url ? window.location.href = p.url : (I((d) => ({
561
528
  ...d,
562
- [t]: s("ecommerce.checkout_failed") + (h.error || n("ecommerce.unknown_error", "Unknown error"))
529
+ [t]: s("ecommerce.checkout_failed") + (p.error || n("ecommerce.unknown_error", "Unknown error"))
563
530
  })), f(null));
564
- } catch (_) {
565
- console.error(_), T((h) => ({
566
- ...h,
531
+ } catch (g) {
532
+ console.error(g), I((p) => ({
533
+ ...p,
567
534
  [t]: s("ecommerce.generic_error")
568
535
  })), f(null);
569
536
  }
@@ -584,14 +551,14 @@ const sr = ({ initialCustomer: c }) => {
584
551
  ) : b ? null : J.length > 0 ? s("ecommerce.select_rate") : s("ecommerce.no_rates_for_region") : n(
585
552
  "ecommerce.waiting_on_address_info",
586
553
  "Complete your shipping address to view available shipping options."
587
- ) : null, Ye = i !== null || ge !== null, Ve = w.length === 1 ? n("ecommerce.item_count_one", "{count} item", {
588
- count: w.length
554
+ ) : null, Ye = l !== null || ge !== null, Ve = k.length === 1 ? n("ecommerce.item_count_one", "{count} item", {
555
+ count: k.length
589
556
  }) : n("ecommerce.item_count_other", "{count} items", {
590
- count: w.length
591
- }), We = k.length === 1 ? n("ecommerce.license_count_one", "{count} license", {
592
557
  count: k.length
558
+ }), We = w.length === 1 ? n("ecommerce.license_count_one", "{count} license", {
559
+ count: w.length
593
560
  }) : n("ecommerce.license_count_other", "{count} licenses", {
594
- count: k.length
561
+ count: w.length
595
562
  }), Ze = (t) => xe(t) ? n("ecommerce.digital_label", "Digital") : n("ecommerce.physical_label", "Physical"), et = (t) => t === "monthly" ? n(
596
563
  "ecommerce.checkout_billing_cycle_monthly",
597
564
  "Monthly subscription"
@@ -608,64 +575,64 @@ const sr = ({ initialCustomer: c }) => {
608
575
  /* @__PURE__ */ e("h1", { className: "mb-8 text-3xl font-bold", children: s("ecommerce.checkout") }),
609
576
  /* @__PURE__ */ r("div", { className: "grid gap-8 lg:grid-cols-12 lg:items-start", children: [
610
577
  /* @__PURE__ */ r("div", { className: "lg:col-span-8 space-y-6", children: [
611
- /* @__PURE__ */ r(X, { children: [
612
- /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ r(V, { className: "flex items-center gap-2", children: [
578
+ /* @__PURE__ */ r(Q, { children: [
579
+ /* @__PURE__ */ e(X, { children: /* @__PURE__ */ r(Y, { className: "flex items-center gap-2", children: [
613
580
  /* @__PURE__ */ e(pt, { className: "w-5 h-5" }),
614
581
  s("ecommerce.contact_information")
615
582
  ] }) }),
616
- /* @__PURE__ */ r(W, { className: "space-y-4", children: [
617
- B ? /* @__PURE__ */ e("div", { className: "rounded-xl border bg-muted/20 p-4 text-sm text-muted-foreground", children: s("checkout_prefill_notice", { email: c?.email || "" }) }) : /* @__PURE__ */ r("div", { className: "space-y-2", children: [
583
+ /* @__PURE__ */ r(V, { className: "space-y-4", children: [
584
+ R ? /* @__PURE__ */ e("div", { className: "rounded-xl border bg-muted/20 p-4 text-sm text-muted-foreground", children: s("checkout_prefill_notice", { email: c?.email || "" }) }) : /* @__PURE__ */ r("div", { className: "space-y-2", children: [
618
585
  /* @__PURE__ */ r(v, { htmlFor: "checkout-email", children: [
619
586
  s("ecommerce.email_address"),
620
587
  " ",
621
588
  /* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
622
589
  ] }),
623
590
  /* @__PURE__ */ e(
624
- I,
591
+ j,
625
592
  {
626
593
  id: "checkout-email",
627
594
  type: "email",
628
595
  placeholder: s("ecommerce.email_placeholder"),
629
- value: A,
596
+ value: E,
630
597
  onChange: (t) => {
631
- K(t.target.value), D && q("");
598
+ W(t.target.value), q && K("");
632
599
  },
633
600
  required: !0
634
601
  }
635
602
  ),
636
- D ? /* @__PURE__ */ e("p", { className: "text-xs text-destructive mt-1", children: D }) : null
603
+ q ? /* @__PURE__ */ e("p", { className: "text-xs text-destructive mt-1", children: q }) : null
637
604
  ] }),
638
605
  /* @__PURE__ */ r("div", { className: "space-y-2", children: [
639
606
  /* @__PURE__ */ e(v, { htmlFor: "checkout-phone", children: s("phone_number") }),
640
607
  /* @__PURE__ */ e(
641
- I,
608
+ j,
642
609
  {
643
610
  id: "checkout-phone",
644
611
  placeholder: s("optional"),
645
612
  value: a,
646
- onChange: (t) => M(t.target.value)
613
+ onChange: (t) => U(t.target.value)
647
614
  }
648
615
  )
649
616
  ] })
650
617
  ] })
651
618
  ] }),
652
619
  /* @__PURE__ */ e(
653
- qe,
620
+ ze,
654
621
  {
655
622
  idPrefix: "billing",
656
623
  title: s("billing_address"),
657
624
  description: s("checkout_billing_address_help"),
658
- value: j,
625
+ value: A,
659
626
  onChange: Ce
660
627
  }
661
628
  ),
662
629
  S ? /* @__PURE__ */ r("div", { className: "flex items-center space-x-3 rounded-xl border bg-muted/20 p-4", children: [
663
630
  /* @__PURE__ */ e(
664
- it,
631
+ lt,
665
632
  {
666
633
  id: "use-billing-for-shipping",
667
- checked: z,
668
- onCheckedChange: (t) => Te(!!t)
634
+ checked: L,
635
+ onCheckedChange: (t) => Ae(!!t)
669
636
  }
670
637
  ),
671
638
  /* @__PURE__ */ r("div", { className: "space-y-1", children: [
@@ -673,25 +640,25 @@ const sr = ({ initialCustomer: c }) => {
673
640
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: s("checkout_use_billing_for_shipping_help") })
674
641
  ] })
675
642
  ] }) : null,
676
- S && !z ? /* @__PURE__ */ e(
677
- qe,
643
+ S && !L ? /* @__PURE__ */ e(
644
+ ze,
678
645
  {
679
646
  idPrefix: "shipping",
680
647
  title: s("shipping_address"),
681
648
  description: s("checkout_shipping_address_help"),
682
- value: Q,
649
+ value: O,
683
650
  onChange: Fe
684
651
  }
685
652
  ) : null,
686
- S ? /* @__PURE__ */ r(X, { children: [
687
- /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ r(V, { className: "flex items-center gap-2", children: [
653
+ S ? /* @__PURE__ */ r(Q, { children: [
654
+ /* @__PURE__ */ e(X, { children: /* @__PURE__ */ r(Y, { className: "flex items-center gap-2", children: [
688
655
  /* @__PURE__ */ e(ht, { className: "w-5 h-5 text-primary" }),
689
656
  s("ecommerce.shipping_method")
690
657
  ] }) }),
691
- /* @__PURE__ */ e(W, { children: Se ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-6", children: /* @__PURE__ */ e(ye, { className: "w-6 h-6 animate-spin text-muted-foreground" }) }) : J.length > 0 ? /* @__PURE__ */ e("div", { className: "space-y-3", children: J.map((t) => /* @__PURE__ */ r(
658
+ /* @__PURE__ */ e(V, { children: Se ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-6", children: /* @__PURE__ */ e(ye, { className: "w-6 h-6 animate-spin text-muted-foreground" }) }) : J.length > 0 ? /* @__PURE__ */ e("div", { className: "space-y-3", children: J.map((t) => /* @__PURE__ */ r(
692
659
  "div",
693
660
  {
694
- onClick: () => U(t.id),
661
+ onClick: () => B(t.id),
695
662
  className: `flex items-center justify-between p-4 rounded-lg border-2 cursor-pointer transition-all ${b === t.id ? "border-primary bg-primary/5" : "border-neutral-100 hover:border-neutral-200"}`,
696
663
  children: [
697
664
  /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
@@ -704,7 +671,7 @@ const sr = ({ initialCustomer: c }) => {
704
671
  ),
705
672
  /* @__PURE__ */ e("span", { className: "font-medium", children: t.name })
706
673
  ] }),
707
- /* @__PURE__ */ e("span", { className: "font-bold", children: x(t.amount, o) })
674
+ /* @__PURE__ */ e("span", { className: "font-bold", children: y(t.amount, o) })
708
675
  ]
709
676
  },
710
677
  t.id
@@ -715,21 +682,21 @@ const sr = ({ initialCustomer: c }) => {
715
682
  ] }) : null
716
683
  ] }),
717
684
  /* @__PURE__ */ r("div", { className: "lg:col-span-4 space-y-6", children: [
718
- /* @__PURE__ */ r(X, { className: "top-6", children: [
719
- /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(V, { children: s("ecommerce.order_summary") }) }),
720
- /* @__PURE__ */ r(W, { className: "space-y-4", children: [
685
+ /* @__PURE__ */ r(Q, { className: "top-6", children: [
686
+ /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(Y, { children: s("ecommerce.order_summary") }) }),
687
+ /* @__PURE__ */ r(V, { className: "space-y-4", children: [
721
688
  /* @__PURE__ */ e("div", { className: "space-y-3 max-h-[260px] overflow-y-auto pr-2", children: N.map((t) => {
722
- const l = Ne(t, {
689
+ const i = Ne(t, {
723
690
  currencyCode: o,
724
- currencies: R
725
- }), p = Re(t);
691
+ currencies: M
692
+ }), u = Re(t);
726
693
  return /* @__PURE__ */ r("div", { className: "flex items-start justify-between gap-4", children: [
727
694
  /* @__PURE__ */ r("div", { className: "flex gap-3", children: [
728
695
  t.image_url ? /* @__PURE__ */ e("div", { className: "h-10 w-10 shrink-0 overflow-hidden rounded border bg-neutral-100", children: /* @__PURE__ */ e("img", { src: t.image_url, alt: t.title, className: "h-full w-full object-cover" }) }) : null,
729
696
  /* @__PURE__ */ r("div", { className: "grid gap-0.5", children: [
730
697
  /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
731
698
  /* @__PURE__ */ e("span", { className: "font-medium text-xs line-clamp-1", children: t.title }),
732
- /* @__PURE__ */ e(Be, { variant: "outline", className: "text-[9px] uppercase", children: Ze(t) })
699
+ /* @__PURE__ */ e(Oe, { variant: "outline", className: "text-[9px] uppercase", children: Ze(t) })
733
700
  ] }),
734
701
  t.variant_label ? /* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground line-clamp-1", children: t.variant_label }) : null,
735
702
  /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground", children: [
@@ -737,74 +704,74 @@ const sr = ({ initialCustomer: c }) => {
737
704
  ": ",
738
705
  t.quantity
739
706
  ] }),
740
- p ? /* @__PURE__ */ r("span", { className: "text-[10px] font-medium text-emerald-700", children: [
741
- p.label,
707
+ u ? /* @__PURE__ */ r("span", { className: "text-[10px] font-medium text-emerald-700", children: [
708
+ u.label,
742
709
  " - ",
743
- p.paymentRequirementLabel
710
+ u.paymentRequirementLabel
744
711
  ] }) : null
745
712
  ] })
746
713
  ] }),
747
714
  /* @__PURE__ */ r("div", { className: "flex flex-col items-end gap-0.5 shrink-0", children: [
748
- /* @__PURE__ */ e("span", { className: "font-medium text-xs", children: x(
749
- (l.sale_price ?? l.price) * t.quantity,
715
+ /* @__PURE__ */ e("span", { className: "font-medium text-xs", children: y(
716
+ (i.sale_price ?? i.price) * t.quantity,
750
717
  o
751
718
  ) }),
752
- l.sale_price ? /* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground line-through", children: x(l.price * t.quantity, o) }) : null
719
+ i.sale_price ? /* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground line-through", children: y(i.price * t.quantity, o) }) : null
753
720
  ] })
754
721
  ] }, `${t.id}-${t.variant_id || "base"}`);
755
722
  }) }),
756
- /* @__PURE__ */ e(lt, {}),
723
+ /* @__PURE__ */ e(it, {}),
757
724
  /* @__PURE__ */ e(
758
- $t,
725
+ St,
759
726
  {
760
727
  items: N,
761
728
  currencyCode: o,
762
- onQuoteChange: Qe
729
+ onQuoteChange: Je
763
730
  }
764
731
  ),
765
732
  /* @__PURE__ */ r("div", { className: "space-y-2 text-sm", children: [
766
733
  /* @__PURE__ */ r("div", { className: "flex justify-between", children: [
767
734
  /* @__PURE__ */ e("span", { children: s("ecommerce.subtotal") }),
768
- /* @__PURE__ */ e("span", { children: x(Je, o) })
735
+ /* @__PURE__ */ e("span", { children: y(Ge, o) })
769
736
  ] }),
770
- w.length > 0 ? /* @__PURE__ */ r("div", { className: "flex justify-between text-muted-foreground", children: [
737
+ k.length > 0 ? /* @__PURE__ */ r("div", { className: "flex justify-between text-muted-foreground", children: [
771
738
  /* @__PURE__ */ e("span", { children: n(
772
739
  "ecommerce.physical_products",
773
740
  "Physical products"
774
741
  ) }),
775
- /* @__PURE__ */ e("span", { children: x(ue, o) })
742
+ /* @__PURE__ */ e("span", { children: y(ue, o) })
776
743
  ] }) : null,
777
- k.length > 0 ? /* @__PURE__ */ r("div", { className: "flex justify-between text-muted-foreground", children: [
744
+ w.length > 0 ? /* @__PURE__ */ r("div", { className: "flex justify-between text-muted-foreground", children: [
778
745
  /* @__PURE__ */ e("span", { children: n(
779
746
  "ecommerce.digital_products",
780
747
  "Digital products"
781
748
  ) }),
782
- /* @__PURE__ */ e("span", { children: x(pe, o) })
749
+ /* @__PURE__ */ e("span", { children: y(pe, o) })
783
750
  ] }) : null,
784
- L ? /* @__PURE__ */ r("div", { className: "flex justify-between text-emerald-600", children: [
751
+ D ? /* @__PURE__ */ r("div", { className: "flex justify-between text-emerald-600", children: [
785
752
  /* @__PURE__ */ r("span", { children: [
786
753
  n("ecommerce.discount", "Discount"),
787
754
  " (",
788
- L.code,
755
+ D.code,
789
756
  ")"
790
757
  ] }),
791
758
  /* @__PURE__ */ r("span", { children: [
792
759
  "-",
793
- x(L.discountTotal, o)
760
+ y(D.discountTotal, o)
794
761
  ] })
795
762
  ] }) : null,
796
- (w.length > 0 || k.length > 0) && /* @__PURE__ */ r("div", { className: "flex justify-between font-bold text-lg pt-2 border-t mt-2", children: [
763
+ (k.length > 0 || w.length > 0) && /* @__PURE__ */ r("div", { className: "flex justify-between font-bold text-lg pt-2 border-t mt-2", children: [
797
764
  /* @__PURE__ */ e("span", { children: n(
798
765
  "ecommerce.estimated_total",
799
766
  "Estimated total"
800
767
  ) }),
801
- /* @__PURE__ */ e("span", { className: "text-primary", children: x(He, o) })
768
+ /* @__PURE__ */ e("span", { className: "text-primary", children: y(Qe, o) })
802
769
  ] })
803
770
  ] })
804
771
  ] })
805
772
  ] }),
806
- w.length > 0 ? /* @__PURE__ */ r(
807
- ze,
773
+ k.length > 0 ? /* @__PURE__ */ r(
774
+ Be,
808
775
  {
809
776
  title: n(
810
777
  "ecommerce.stripe_checkout_title",
@@ -822,41 +789,41 @@ const sr = ({ initialCustomer: c }) => {
822
789
  "ecommerce.physical_subtotal",
823
790
  "Physical subtotal"
824
791
  ) }),
825
- /* @__PURE__ */ e("span", { children: x(ue, o) })
792
+ /* @__PURE__ */ e("span", { children: y(ue, o) })
826
793
  ] }),
827
794
  he > 0 ? /* @__PURE__ */ r("div", { className: "flex justify-between text-emerald-600", children: [
828
795
  /* @__PURE__ */ e("span", { children: n("ecommerce.discount", "Discount") }),
829
796
  /* @__PURE__ */ r("span", { children: [
830
797
  "-",
831
- x(he, o)
798
+ y(he, o)
832
799
  ] })
833
800
  ] }) : null,
834
801
  /* @__PURE__ */ r("div", { className: "flex justify-between", children: [
835
802
  /* @__PURE__ */ e("span", { children: s("ecommerce.shipping") }),
836
- /* @__PURE__ */ e("span", { children: ie ? x(ie.amount, o) : "-" })
803
+ /* @__PURE__ */ e("span", { children: le ? y(le.amount, o) : "-" })
837
804
  ] }),
838
805
  /* @__PURE__ */ r("div", { className: "flex justify-between", children: [
839
806
  /* @__PURE__ */ e("span", { children: n("ecommerce.tax", "Tax") }),
840
- /* @__PURE__ */ e("span", { children: Ue ? "..." : F?.isPendingExternalCalculation ? n(
807
+ /* @__PURE__ */ e("span", { children: Ue ? "..." : C?.isPendingExternalCalculation ? n(
841
808
  "ecommerce.tax_calculated_on_stripe",
842
809
  "Calculated on Stripe"
843
- ) : F ? x(F.amount, o) : "-" })
810
+ ) : C ? y(C.amount, o) : "-" })
844
811
  ] }),
845
- F && F.lines.length > 0 ? /* @__PURE__ */ e("div", { className: "rounded-lg bg-muted/20 px-3 py-2 text-xs text-muted-foreground", children: F.lines.map((t) => /* @__PURE__ */ r("div", { className: "flex justify-between gap-3", children: [
812
+ C && C.lines.length > 0 ? /* @__PURE__ */ e("div", { className: "rounded-lg bg-muted/20 px-3 py-2 text-xs text-muted-foreground", children: C.lines.map((t) => /* @__PURE__ */ r("div", { className: "flex justify-between gap-3", children: [
846
813
  /* @__PURE__ */ r("span", { children: [
847
814
  t.name,
848
815
  " (",
849
816
  t.rate.toFixed(4),
850
817
  "%)"
851
818
  ] }),
852
- /* @__PURE__ */ e("span", { children: x(t.amount, o) })
819
+ /* @__PURE__ */ e("span", { children: y(t.amount, o) })
853
820
  ] }, t.id || `${t.name}-${t.rate}`)) }) : null,
854
821
  /* @__PURE__ */ r("div", { className: "flex justify-between font-semibold pt-2 border-t", children: [
855
822
  /* @__PURE__ */ e("span", { children: n(
856
823
  "ecommerce.total_on_stripe",
857
824
  "Total on Stripe"
858
825
  ) }),
859
- /* @__PURE__ */ e("span", { children: x(Ae, o) })
826
+ /* @__PURE__ */ e("span", { children: y(Te, o) })
860
827
  ] })
861
828
  ] }),
862
829
  /* @__PURE__ */ r(
@@ -864,20 +831,20 @@ const sr = ({ initialCustomer: c }) => {
864
831
  {
865
832
  className: "w-full",
866
833
  size: "lg",
867
- onClick: () => Pe("stripe", w, "stripe"),
834
+ onClick: () => Pe("stripe", k, "stripe"),
868
835
  disabled: Ye,
869
836
  children: [
870
- i === "stripe" ? /* @__PURE__ */ e(ye, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ e(ft, { className: "mr-2 h-4 w-4" }),
871
- i === "stripe" ? s("ecommerce.processing") : n(
837
+ l === "stripe" ? /* @__PURE__ */ e(ye, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ e(ft, { className: "mr-2 h-4 w-4" }),
838
+ l === "stripe" ? s("ecommerce.processing") : n(
872
839
  "ecommerce.checkout_physical_products",
873
840
  "Checkout Physical Products"
874
841
  )
875
842
  ]
876
843
  }
877
844
  ),
878
- ge && i === null ? /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: ge }) : null,
879
- m.stripe ? /* @__PURE__ */ e("div", { className: "rounded-lg border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: m.stripe }) : null,
880
- /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: F?.isPendingExternalCalculation ? n(
845
+ ge && l === null ? /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: ge }) : null,
846
+ h.stripe ? /* @__PURE__ */ e("div", { className: "rounded-lg border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: h.stripe }) : null,
847
+ /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: C?.isPendingExternalCalculation ? n(
881
848
  "checkout_stripe_tax_finalized_notice",
882
849
  "Tax will be finalized by Stripe Tax on the payment step."
883
850
  ) : n(
@@ -887,8 +854,8 @@ const sr = ({ initialCustomer: c }) => {
887
854
  ]
888
855
  }
889
856
  ) : null,
890
- k.length > 0 ? /* @__PURE__ */ r(
891
- ze,
857
+ w.length > 0 ? /* @__PURE__ */ r(
858
+ Be,
892
859
  {
893
860
  title: n(
894
861
  "ecommerce.freemius_checkout_title",
@@ -900,40 +867,40 @@ const sr = ({ initialCustomer: c }) => {
900
867
  ),
901
868
  badgeLabel: We,
902
869
  children: [
903
- /* @__PURE__ */ e("div", { className: "space-y-3", children: k.map((t) => {
904
- const l = Ne(t, {
870
+ /* @__PURE__ */ e("div", { className: "space-y-3", children: w.map((t) => {
871
+ const i = Ne(t, {
905
872
  currencyCode: o,
906
- currencies: R
907
- }), p = Re(t), u = `freemius:${t.id}`, _ = p ? g[u] || "paid" : void 0;
873
+ currencies: M
874
+ }), u = Re(t), m = `freemius:${t.id}`, g = u ? x[m] || "paid" : void 0;
908
875
  return /* @__PURE__ */ r("div", { className: "rounded-lg border p-3 space-y-3", children: [
909
876
  /* @__PURE__ */ r("div", { className: "flex items-start justify-between gap-3", children: [
910
877
  /* @__PURE__ */ r("div", { children: [
911
878
  /* @__PURE__ */ e("p", { className: "font-medium", children: t.title }),
912
879
  t.billing_cycle ? /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground capitalize", children: et(t.billing_cycle) }) : null,
913
- p ? /* @__PURE__ */ r("p", { className: "text-xs font-medium text-emerald-700", children: [
914
- p.label,
880
+ u ? /* @__PURE__ */ r("p", { className: "text-xs font-medium text-emerald-700", children: [
881
+ u.label,
915
882
  " - ",
916
- p.paymentRequirementLabel
883
+ u.paymentRequirementLabel
917
884
  ] }) : null
918
885
  ] }),
919
- /* @__PURE__ */ e("span", { className: "font-medium", children: x(l.sale_price ?? l.price, o) })
886
+ /* @__PURE__ */ e("span", { className: "font-medium", children: y(i.sale_price ?? i.price, o) })
920
887
  ] }),
921
- p && !t.trial_requires_payment_method && /* @__PURE__ */ r("div", { className: "bg-muted/30 p-3 rounded-md border text-sm mt-2 mb-3", children: [
888
+ u && !t.trial_requires_payment_method && /* @__PURE__ */ r("div", { className: "bg-muted/30 p-3 rounded-md border text-sm mt-2 mb-3", children: [
922
889
  /* @__PURE__ */ e("p", { className: "font-medium mb-3", children: n(
923
890
  "ecommerce.freemius_trial_preference_title",
924
891
  "How would you like to start your trial?"
925
892
  ) }),
926
893
  /* @__PURE__ */ r(
927
- at,
894
+ ot,
928
895
  {
929
- value: g[u] || "paid",
930
- onValueChange: (h) => C((d) => ({ ...d, [u]: h })),
896
+ value: x[m] || "paid",
897
+ onValueChange: (p) => P((d) => ({ ...d, [m]: p })),
931
898
  className: "gap-3",
932
899
  children: [
933
900
  /* @__PURE__ */ r("div", { className: "flex items-start space-x-3", children: [
934
- /* @__PURE__ */ e(De, { value: "paid", id: `${u}-paid`, className: "mt-1" }),
901
+ /* @__PURE__ */ e(De, { value: "paid", id: `${m}-paid`, className: "mt-1" }),
935
902
  /* @__PURE__ */ r("div", { className: "grid gap-1.5", children: [
936
- /* @__PURE__ */ e(v, { htmlFor: `${u}-paid`, className: "font-medium leading-none cursor-pointer", children: n(
903
+ /* @__PURE__ */ e(v, { htmlFor: `${m}-paid`, className: "font-medium leading-none cursor-pointer", children: n(
937
904
  "ecommerce.freemius_trial_with_card",
938
905
  "Enter Payment Details Now (Still get full trial length free)"
939
906
  ) }),
@@ -944,8 +911,8 @@ const sr = ({ initialCustomer: c }) => {
944
911
  ] })
945
912
  ] }),
946
913
  /* @__PURE__ */ r("div", { className: "flex items-start space-x-3", children: [
947
- /* @__PURE__ */ e(De, { value: "free", id: `${u}-free`, className: "mt-1" }),
948
- /* @__PURE__ */ e("div", { className: "grid gap-1.5", children: /* @__PURE__ */ e(v, { htmlFor: `${u}-free`, className: "font-medium leading-none cursor-pointer", children: n(
914
+ /* @__PURE__ */ e(De, { value: "free", id: `${m}-free`, className: "mt-1" }),
915
+ /* @__PURE__ */ e("div", { className: "grid gap-1.5", children: /* @__PURE__ */ e(v, { htmlFor: `${m}-free`, className: "font-medium leading-none cursor-pointer", children: n(
949
916
  "ecommerce.freemius_trial_no_card",
950
917
  "Start Free Trial (No card required)"
951
918
  ) }) })
@@ -958,21 +925,21 @@ const sr = ({ initialCustomer: c }) => {
958
925
  _e,
959
926
  {
960
927
  className: "w-full h-auto min-h-[2.75rem] py-2",
961
- variant: k.length > 1 ? "outline" : "default",
928
+ variant: w.length > 1 ? "outline" : "default",
962
929
  onClick: () => Pe(
963
930
  "freemius",
964
931
  [
965
932
  {
966
933
  ...t,
967
- ..._ ? { trial_preference: _ } : {}
934
+ ...g ? { trial_preference: g } : {}
968
935
  }
969
936
  ],
970
- u
937
+ m
971
938
  ),
972
- disabled: i !== null,
939
+ disabled: l !== null,
973
940
  children: [
974
- i === u ? /* @__PURE__ */ e(ye, { className: "mr-2 h-4 w-4 shrink-0 animate-spin" }) : /* @__PURE__ */ e(gt, { className: "mr-2 h-4 w-4 shrink-0" }),
975
- /* @__PURE__ */ e("span", { className: "whitespace-normal text-left", children: i === u ? s("ecommerce.processing") : k.length > 1 ? n(
941
+ l === m ? /* @__PURE__ */ e(ye, { className: "mr-2 h-4 w-4 shrink-0 animate-spin" }) : /* @__PURE__ */ e(gt, { className: "mr-2 h-4 w-4 shrink-0" }),
942
+ /* @__PURE__ */ e("span", { className: "whitespace-normal text-left", children: l === m ? s("ecommerce.processing") : w.length > 1 ? n(
976
943
  "ecommerce.checkout_product",
977
944
  "Checkout {title}",
978
945
  { title: t.title }
@@ -983,24 +950,24 @@ const sr = ({ initialCustomer: c }) => {
983
950
  ]
984
951
  }
985
952
  )
986
- ] }, u);
953
+ ] }, m);
987
954
  }) }),
988
955
  /* @__PURE__ */ r("div", { className: "flex justify-between text-sm font-semibold border-t pt-3", children: [
989
956
  /* @__PURE__ */ e("span", { children: n(
990
957
  "ecommerce.digital_subtotal",
991
958
  "Digital subtotal"
992
959
  ) }),
993
- /* @__PURE__ */ e("span", { children: x(pe, o) })
960
+ /* @__PURE__ */ e("span", { children: y(pe, o) })
994
961
  ] }),
995
962
  fe > 0 ? /* @__PURE__ */ r("div", { className: "flex justify-between text-sm font-semibold text-emerald-600", children: [
996
963
  /* @__PURE__ */ e("span", { children: n("ecommerce.discount", "Discount") }),
997
964
  /* @__PURE__ */ r("span", { children: [
998
965
  "-",
999
- x(fe, o)
966
+ y(fe, o)
1000
967
  ] })
1001
968
  ] }) : null,
1002
- m.freemius ? /* @__PURE__ */ e("div", { className: "rounded-lg border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: m.freemius }) : null,
1003
- /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: k.length > 1 ? n(
969
+ h.freemius ? /* @__PURE__ */ e("div", { className: "rounded-lg border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: h.freemius }) : null,
970
+ /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: w.length > 1 ? n(
1004
971
  "ecommerce.freemius_multi_checkout_notice",
1005
972
  "Freemius licenses are completed one at a time, so each digital product gets its own checkout action."
1006
973
  ) : n(
@@ -1016,5 +983,5 @@ const sr = ({ initialCustomer: c }) => {
1016
983
  ] });
1017
984
  };
1018
985
  export {
1019
- sr as Checkout
986
+ Wt as Checkout
1020
987
  };