@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
@@ -0,0 +1,211 @@
1
+ import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
+ import { getServiceRoleSupabaseClient as w } from "@nextblock-cms/db/server";
3
+ import { TooltipProvider as C, Card as c, CardContent as o, CardTitle as x, CardDescription as f, Button as m, CardHeader as S, Badge as n, Tooltip as T, TooltipTrigger as j, TooltipContent as I } from "@nextblock-cms/ui";
4
+ import { Boxes as q, Truck as N, Globe as v, Trash2 as b, Info as F } from "lucide-react";
5
+ import { ZoneForm as _ } from "./components/ZoneForm.es.js";
6
+ import { RateForm as y } from "./components/RateForm.es.js";
7
+ import { updateInventoryTrackingAction as R, deleteShippingZone as z, deleteShippingRate as P } from "./server-actions.es.js";
8
+ import { normalizeCurrencyRecord as A } from "../../../currency.es.js";
9
+ import { getEcommerceInventorySettings as D } from "../../../inventory-settings.es.js";
10
+ import { resolveSubdivisionName as E } from "../../../states.es.js";
11
+ import { formatPrice as p } from "@nextblock-cms/utils";
12
+ async function O({
13
+ searchParams: h
14
+ }) {
15
+ const i = w(), [{ data: l }, k, { data: g }, { data: d }] = await Promise.all([
16
+ i.from("shipping_zones").select(`
17
+ *,
18
+ shipping_zone_locations (*),
19
+ shipping_zone_methods (*)
20
+ `).order("priority_order", { ascending: !0 }),
21
+ D(i),
22
+ i.from("languages").select("code, name, is_default").eq("is_active", !0).order("name", { ascending: !0 }),
23
+ i.from("currencies").select(
24
+ "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"
25
+ ).eq("is_active", !0).order("is_default", { ascending: !1 }).order("code", { ascending: !0 })
26
+ ]), s = d?.find((r) => r.is_default)?.code || d?.[0]?.code || "USD", u = (d || []).map(
27
+ (r) => A(r)
28
+ );
29
+ return /* @__PURE__ */ e(C, { children: /* @__PURE__ */ a("div", { className: "space-y-6", children: [
30
+ h?.success ? /* @__PURE__ */ e("div", { className: "rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700", children: h.success }) : null,
31
+ /* @__PURE__ */ e(c, { className: "overflow-hidden border-slate-200 dark:border-slate-800 shadow-sm", children: /* @__PURE__ */ e(o, { className: "p-4 sm:p-5", children: /* @__PURE__ */ a("form", { action: R, className: "space-y-3", children: [
32
+ /* @__PURE__ */ a("div", { className: "flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between", children: [
33
+ /* @__PURE__ */ a("div", { className: "flex items-start gap-3 min-w-0", children: [
34
+ /* @__PURE__ */ e("div", { className: "p-2 bg-primary/10 rounded-lg text-primary shadow-inner shrink-0", children: /* @__PURE__ */ e(q, { className: "h-4 w-4" }) }),
35
+ /* @__PURE__ */ a("div", { className: "min-w-0", children: [
36
+ /* @__PURE__ */ e(x, { className: "text-base font-semibold leading-none", children: "Inventory Tracking" }),
37
+ /* @__PURE__ */ e(f, { className: "mt-1 text-sm", children: "Control whether checkout enforces stock counts and paid orders deduct inventory." })
38
+ ] })
39
+ ] }),
40
+ /* @__PURE__ */ e("div", { className: "flex justify-end lg:justify-start shrink-0", children: /* @__PURE__ */ e(m, { type: "submit", size: "sm", className: "w-full sm:w-auto", children: "Save Inventory Settings" }) })
41
+ ] }),
42
+ /* @__PURE__ */ a("div", { className: "rounded-lg border bg-muted/20 px-4 py-3", children: [
43
+ /* @__PURE__ */ e("input", { type: "hidden", name: "trackQuantities", value: "false" }),
44
+ /* @__PURE__ */ a("label", { htmlFor: "track-quantities", className: "flex cursor-pointer items-start gap-3", children: [
45
+ /* @__PURE__ */ e(
46
+ "input",
47
+ {
48
+ id: "track-quantities",
49
+ name: "trackQuantities",
50
+ type: "checkbox",
51
+ value: "true",
52
+ defaultChecked: k.trackQuantities,
53
+ className: "mt-0.5 h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary"
54
+ }
55
+ ),
56
+ /* @__PURE__ */ a("span", { className: "space-y-0.5", children: [
57
+ /* @__PURE__ */ e("span", { className: "block text-sm font-medium text-slate-900 dark:text-slate-100", children: "Track product quantities" }),
58
+ /* @__PURE__ */ e("span", { className: "block text-sm text-muted-foreground", children: "Prevent overselling by checking stock during checkout and decrementing quantities after payment is confirmed." })
59
+ ] })
60
+ ] })
61
+ ] })
62
+ ] }) }) }),
63
+ /* @__PURE__ */ a("div", { className: "flex justify-between items-center", children: [
64
+ /* @__PURE__ */ a("div", { children: [
65
+ /* @__PURE__ */ e("h2", { className: "text-2xl font-bold tracking-tight text-slate-900 dark:text-slate-100", children: "Shipping Zones" }),
66
+ /* @__PURE__ */ e("p", { className: "text-slate-500 dark:text-slate-400 text-sm", children: "Manage geographical delivery areas and their associated shipping rates." })
67
+ ] }),
68
+ /* @__PURE__ */ e(_, {})
69
+ ] }),
70
+ /* @__PURE__ */ e("div", { className: "grid gap-6", children: !l || l.length === 0 ? /* @__PURE__ */ e(c, { className: "bg-slate-50/50 dark:bg-slate-900/10 border-dashed", children: /* @__PURE__ */ a(o, { className: "flex flex-col items-center justify-center py-12", children: [
71
+ /* @__PURE__ */ e(N, { className: "h-12 w-12 text-slate-300 dark:text-slate-700 mb-4" }),
72
+ /* @__PURE__ */ e("p", { className: "text-slate-600 dark:text-slate-400 font-medium", children: "No shipping zones defined yet." }),
73
+ /* @__PURE__ */ e("p", { className: "text-xs text-slate-500 mb-6 text-center max-w-xs", children: "Create a zone to start defining shipping rates for specific regions (e.g., North America, Europe)." })
74
+ ] }) }) : l.map((r) => /* @__PURE__ */ a(c, { className: "overflow-hidden border-slate-200 dark:border-slate-800 shadow-sm hover:shadow-md transition-shadow", children: [
75
+ /* @__PURE__ */ e(S, { className: "bg-slate-50/50 dark:bg-slate-900/50 border-b dark:border-slate-800 py-4", children: /* @__PURE__ */ a("div", { className: "flex justify-between items-start md:items-center", children: [
76
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-3", children: [
77
+ /* @__PURE__ */ e("div", { className: "p-2 bg-primary/10 rounded-lg text-primary shadow-inner", children: /* @__PURE__ */ e(v, { className: "h-5 w-5" }) }),
78
+ /* @__PURE__ */ a("div", { children: [
79
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
80
+ /* @__PURE__ */ e(x, { className: "text-lg font-bold", children: r.name }),
81
+ /* @__PURE__ */ a(n, { variant: "outline", className: "text-[10px] uppercase font-bold py-0 h-4 border-slate-200 bg-white/50 dark:bg-black/20", children: [
82
+ "Prio: ",
83
+ r.priority_order
84
+ ] })
85
+ ] }),
86
+ /* @__PURE__ */ a(f, { className: "text-xs", children: [
87
+ r.shipping_zone_locations?.length || 0,
88
+ " regions covered"
89
+ ] })
90
+ ] })
91
+ ] }),
92
+ /* @__PURE__ */ a("div", { className: "flex gap-1", children: [
93
+ /* @__PURE__ */ e(
94
+ _,
95
+ {
96
+ mode: "edit",
97
+ initialData: {
98
+ id: r.id,
99
+ name: r.name,
100
+ priority_order: r.priority_order,
101
+ locations: r.shipping_zone_locations?.map((t) => ({
102
+ country_code: t.country_code,
103
+ state_code: t.state_code
104
+ })) || []
105
+ }
106
+ }
107
+ ),
108
+ /* @__PURE__ */ e("form", { action: async () => {
109
+ "use server";
110
+ await z(r.id);
111
+ }, children: /* @__PURE__ */ e(m, { type: "submit", variant: "ghost", size: "icon", className: "h-8 w-8 text-slate-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20", children: /* @__PURE__ */ e(b, { className: "h-4 w-4" }) }) })
112
+ ] })
113
+ ] }) }),
114
+ /* @__PURE__ */ e(o, { className: "p-0", children: /* @__PURE__ */ a("div", { className: "grid md:grid-cols-2 divide-y md:divide-y-0 md:divide-x divide-slate-100 dark:divide-slate-800", children: [
115
+ /* @__PURE__ */ a("div", { className: "p-6", children: [
116
+ /* @__PURE__ */ a("h4", { className: "text-[10px] font-bold uppercase tracking-widest text-slate-500 mb-4 flex items-center gap-1.5", children: [
117
+ /* @__PURE__ */ e(v, { className: "h-3 w-3" }),
118
+ " Target Regions"
119
+ ] }),
120
+ /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: r.shipping_zone_locations?.length > 0 ? r.shipping_zone_locations.map((t) => /* @__PURE__ */ a(n, { variant: "secondary", className: "bg-slate-100 dark:bg-slate-800/80 text-slate-700 dark:text-slate-300 hover:bg-slate-200 border-none px-2 py-0.5 text-[11px] font-medium", children: [
121
+ t.country_code,
122
+ t.state_code ? /* @__PURE__ */ a("span", { className: "text-slate-400 ml-1", children: [
123
+ "(",
124
+ E(t.country_code, t.state_code),
125
+ ")"
126
+ ] }) : ""
127
+ ] }, t.id)) : /* @__PURE__ */ e("p", { className: "text-sm text-slate-400 italic", children: "No specific locations assigned." }) })
128
+ ] }),
129
+ /* @__PURE__ */ a("div", { className: "p-6", children: [
130
+ /* @__PURE__ */ a("div", { className: "flex justify-between items-center mb-4", children: [
131
+ /* @__PURE__ */ a("h4", { className: "text-[10px] font-bold uppercase tracking-widest text-slate-500 flex items-center gap-1.5", children: [
132
+ /* @__PURE__ */ e(N, { className: "h-3 w-3" }),
133
+ " Shipping Methods"
134
+ ] }),
135
+ /* @__PURE__ */ e(
136
+ y,
137
+ {
138
+ zoneId: r.id,
139
+ zoneName: r.name,
140
+ languages: g || [],
141
+ currencies: u,
142
+ defaultCurrencyCode: s
143
+ }
144
+ )
145
+ ] }),
146
+ /* @__PURE__ */ e("div", { className: "space-y-2", children: r.shipping_zone_methods?.length > 0 ? r.shipping_zone_methods.map((t) => /* @__PURE__ */ a("div", { className: "flex justify-between items-center group p-2 hover:bg-slate-50/80 dark:hover:bg-slate-800/30 rounded-lg transition-all border border-transparent hover:border-slate-100 dark:hover:border-slate-800", children: [
147
+ /* @__PURE__ */ a("div", { className: "flex-1 min-w-0", children: [
148
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
149
+ /* @__PURE__ */ e("p", { className: "text-sm font-semibold text-slate-900 dark:text-slate-100 truncate", children: t.name }),
150
+ /* @__PURE__ */ e(n, { variant: "outline", className: "h-4 px-1 text-[9px]", children: t.currency_pricing_mode === "manual" ? "Manual FX" : "Auto FX" }),
151
+ (t.min_order_amount || 0) > 0 && /* @__PURE__ */ a(T, { children: [
152
+ /* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ a(n, { variant: "outline", className: "h-4 px-1 text-[9px] bg-emerald-50 text-emerald-700 dark:bg-emerald-900/20 dark:text-emerald-400 border-emerald-100 dark:border-emerald-900/50", children: [
153
+ /* @__PURE__ */ e(F, { className: "h-2 w-2 mr-0.5" }),
154
+ p(
155
+ t.min_order_amount,
156
+ t.cost_currency?.toUpperCase() || s
157
+ )
158
+ ] }) }),
159
+ /* @__PURE__ */ a(I, { children: [
160
+ "Available for orders over ",
161
+ p(
162
+ t.min_order_amount,
163
+ t.cost_currency?.toUpperCase() || s
164
+ )
165
+ ] })
166
+ ] })
167
+ ] }),
168
+ /* @__PURE__ */ e("p", { className: "text-[10px] text-slate-500 uppercase tracking-tighter mix-blend-multiply dark:mix-blend-normal", children: t.method_type.replace("_", " ") })
169
+ ] }),
170
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-1", children: [
171
+ /* @__PURE__ */ e("p", { className: "text-sm font-black text-primary px-2", children: t.method_type === "free_shipping" ? "FREE" : p(
172
+ t.cost_amount,
173
+ t.cost_currency?.toUpperCase() || s
174
+ ) }),
175
+ /* @__PURE__ */ a("div", { className: "flex opacity-0 group-hover:opacity-100 transition-opacity", children: [
176
+ /* @__PURE__ */ e(
177
+ y,
178
+ {
179
+ zoneId: r.id,
180
+ zoneName: r.name,
181
+ languages: g || [],
182
+ currencies: u,
183
+ defaultCurrencyCode: s,
184
+ mode: "edit",
185
+ initialData: t
186
+ }
187
+ ),
188
+ /* @__PURE__ */ e("form", { action: async () => {
189
+ "use server";
190
+ await P(t.id);
191
+ }, children: /* @__PURE__ */ e(
192
+ m,
193
+ {
194
+ type: "submit",
195
+ variant: "ghost",
196
+ size: "icon",
197
+ className: "h-7 w-7 text-slate-400 hover:text-red-500",
198
+ children: /* @__PURE__ */ e(b, { className: "h-3 w-3" })
199
+ }
200
+ ) })
201
+ ] })
202
+ ] })
203
+ ] }, t.id)) : /* @__PURE__ */ e("p", { className: "text-xs text-slate-400 italic", children: "No methods defined for this zone." }) })
204
+ ] })
205
+ ] }) })
206
+ ] }, r.id)) })
207
+ ] }) });
208
+ }
209
+ export {
210
+ O as ShippingPage
211
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),r=require("@nextblock-cms/ui"),C=require("lucide-react"),Z=require("../server-actions.cjs.js"),p=require("@nextblock-cms/utils"),T=require("../../../../currency.cjs.js"),$=require("../../../../shipping-rate-currency.cjs.js");function A(h,m){if(typeof h!="number")return"";const d=p.minorUnitAmountToMajor(h,m);return p.getCurrencyMinorUnitFactor(m)===1?d.toFixed(0):d.toFixed(2)}function te(h){return h.reduce((m,d)=>(m[d.code]=p.getCurrencyMinorUnitFactor(d.code)===1?"0":"0.00",m),{})}function N(h,m){const d=String(h||"").trim();if(!d)return null;const g=Number(d);return!Number.isFinite(g)||g<0?null:p.majorUnitAmountToMinor(g,m)}function J(h){return h.currencies.reduce((m,d)=>(m[d.code]=A(h.amounts[d.code],d.code),m),{})}function re({zoneId:h,zoneName:m,languages:d,currencies:g=[],defaultCurrencyCode:K="USD",mode:Q="create",initialData:l}){const[z,I]=i.useState(!1),S=Q==="edit",U=i.useMemo(()=>d.find(s=>s.is_default)||d[0]||null,[d]),B=i.useMemo(()=>d.filter(s=>!s.is_default),[d]),M=p.normalizeCurrencyCode(K),a=i.useMemo(()=>{const s=T.normalizeCurrencyRecord({code:M,symbol:M,exchange_rate:1,is_default:!0,is_active:!0}),n=(g.length>0?g:[s]).map(t=>T.normalizeCurrencyRecord(t)).filter(t=>t.is_active!==!1).sort((t,c)=>t.is_default!==c.is_default?t.is_default?-1:1:t.code.localeCompare(c.code));return n.length>0?n:[s]},[g,M]),f=i.useMemo(()=>a.find(s=>s.is_default)||a[0],[a]),[F,P]=i.useState(l?.name||""),[V,D]=i.useState(l?.name_translations||{}),[j,G]=i.useState(l?.method_type||"flat_rate"),[u,H]=i.useState($.normalizeShippingRateCurrencyMode(l?.currency_pricing_mode)),[o,O]=i.useState(p.normalizeCurrencyCode(l?.cost_currency||f?.code||M)),[b,_]=i.useState({}),[v,w]=i.useState({}),[E,k]=i.useState(!1),L=i.useMemo(()=>{if(u==="manual")return a.reduce((t,c)=>(t[c.code]=b[c.code]??"",t),{});const s=a.reduce((t,c)=>(t[c.code]=b[c.code]??(c.code===o,""),t),{}),n=N(b[o],o);if(n===null)return s;for(const t of a){if(t.code===o){s[t.code]=b[t.code]??A(n,t.code);continue}s[t.code]=A(T.convertMinorUnitAmount({amount:n,fromCurrencyCode:o,toCurrencyCode:t.code,currencies:a}),t.code)}return s},[a,b,u,o]),q=i.useMemo(()=>{if(u==="manual")return a.reduce((t,c)=>(t[c.code]=v[c.code]??"",t),{});const s=a.reduce((t,c)=>(t[c.code]=v[c.code]??"",t),{}),n=N(v[o],o);if(n===null)return s;for(const t of a){if(t.code===o){s[t.code]=v[t.code]??A(n,t.code);continue}s[t.code]=A(T.convertMinorUnitAmount({amount:n,fromCurrencyCode:o,toCurrencyCode:t.code,currencies:a}),t.code)}return s},[a,v,u,o]);i.useEffect(()=>{f&&(a.some(s=>s.code===o)||O(f.code))},[a,f,o]),i.useEffect(()=>{if(!z||!f)return;const s=$.normalizeShippingRateCurrencyMode(l?.currency_pricing_mode),n=$.sanitizeShippingRateAmountMaps({currencies:a,mode:s,sourceCurrencyCode:l?.cost_currency||f.code,costAmounts:l?.cost_amounts||void 0,minOrderAmounts:l?.min_order_amounts||void 0,fallbackCostAmount:l?.cost_amount,fallbackMinOrderAmount:l?.min_order_amount});P(l?.name||""),D(l?.name_translations||{}),G(l?.method_type||"flat_rate"),H(s),O(n.sourceCurrencyCode),_(J({amounts:n.costAmounts,currencies:a})),w(J({amounts:n.minOrderAmounts,currencies:a}))},[a,f,l,z]);const W=s=>{s!==u&&(s==="manual"&&(_(L),w(q)),H(s))},Y=s=>{const n=p.normalizeCurrencyCode(s);_(t=>({...t,[n]:L[n]??t[n]??""})),w(t=>({...t,[n]:q[n]??t[n]??""})),O(n)},ee=s=>{G(s),s==="free_shipping"&&_(te(a))},se=async s=>{s.preventDefault(),k(!0);const n={},t={};if(u==="manual")for(const R of a){const x=R.code;if(j==="free_shipping")n[x]=0;else{const X=N(b[x],x);if(X===null){k(!1),alert(`Enter a valid shipping cost for ${x}.`);return}n[x]=X}t[x]=N(v[x],x)??0}else{const R=j==="free_shipping"?0:N(b[o],o);if(R===null){k(!1),alert(`Enter a valid shipping cost for ${o}.`);return}n[o]=R,t[o]=N(v[o],o)??0}const c={name:F,nameTranslations:V,type:j,currencyPricingMode:u,sourceCurrencyCode:o,costAmounts:n,minOrderAmounts:t},y=S&&l?.id?await Z.updateShippingRate(l.id,c):await Z.createShippingRate(h,c);k(!1),y.success?I(!1):y.error&&alert(y.error)};return e.jsxs(r.Dialog,{open:z,onOpenChange:I,children:[e.jsx(r.DialogTrigger,{asChild:!0,children:S?e.jsx(r.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-primary",children:e.jsx(C.Edit2,{className:"h-3 w-3"})}):e.jsxs(r.Button,{variant:"outline",size:"sm",className:"h-8 gap-1.5 border-dashed hover:border-solid shadow-sm",children:[e.jsx(C.Plus,{className:"h-3.5 w-3.5"}),"Add Rate"]})}),e.jsx(r.DialogContent,{className:"max-h-[85vh] max-w-4xl overflow-y-auto",children:e.jsxs("form",{onSubmit:se,children:[e.jsxs(r.DialogHeader,{children:[e.jsx(r.DialogTitle,{children:S?"Edit Shipping Rate":"Add Shipping Rate"}),e.jsxs(r.DialogDescription,{children:["Configure shipping costs and localized labels for matching orders in ",e.jsx("strong",{children:m}),"."]})]}),e.jsxs("div",{className:"grid gap-5 py-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(r.Label,{htmlFor:"rate-name",children:["Rate Name",U?` (${U.name})`:""]}),e.jsx(r.Input,{id:"rate-name",value:F,onChange:s=>P(s.target.value),placeholder:"e.g. Standard, Express, Free Shipping",required:!0})]}),B.length>0&&e.jsxs("div",{className:"space-y-4 rounded-xl border bg-slate-50/70 p-4 dark:bg-slate-900/40",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C.Languages,{className:"h-4 w-4 text-slate-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Translations"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Add translated shipping rate labels for the active storefront languages."})]})]}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:B.map(s=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(r.Label,{htmlFor:`rate-name-${s.code}`,children:s.name}),e.jsx(r.Input,{id:`rate-name-${s.code}`,value:V[s.code]||"",onChange:n=>D(t=>({...t,[s.code]:n.target.value})),placeholder:F||"Translated label"})]},s.code))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r.Label,{htmlFor:"type",children:"Method Type"}),e.jsxs(r.Select,{value:j,onValueChange:ee,children:[e.jsx(r.SelectTrigger,{id:"type",className:"bg-slate-50/50 dark:bg-slate-900/50",children:e.jsx(r.SelectValue,{placeholder:"Select type"})}),e.jsxs(r.SelectContent,{children:[e.jsx(r.SelectItem,{value:"flat_rate",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1 min-w-5 h-5 rounded bg-emerald-100 dark:bg-emerald-900/30 text-emerald-600",children:e.jsx(C.DollarSign,{className:"h-3 w-3"})}),e.jsx("span",{children:"Flat Rate"})]})}),e.jsx(r.SelectItem,{value:"free_shipping",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1 min-w-5 h-5 rounded bg-amber-100 dark:bg-amber-900/30 text-amber-600",children:e.jsx(C.Gift,{className:"h-3 w-3"})}),e.jsx("span",{children:"Free Shipping"})]})})]})]})]}),e.jsxs("div",{className:"space-y-3 rounded-xl border bg-slate-50/70 p-4 dark:bg-slate-900/40",children:[e.jsxs("label",{className:"flex items-start gap-3",children:[e.jsx("input",{type:"checkbox",checked:u==="auto",onChange:s=>W(s.target.checked?"auto":"manual"),className:"mt-1 h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary"}),e.jsxs("span",{className:"space-y-1",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-900 dark:text-slate-100",children:"Auto-sync all currency rates from one source amount"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Turn this off to set exact shipping costs and free-shipping thresholds for every active currency manually."})]})]}),u==="auto"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(r.Label,{htmlFor:"rate-currency",children:"Sync From Currency"}),e.jsxs(r.Select,{value:o,onValueChange:Y,children:[e.jsx(r.SelectTrigger,{id:"rate-currency",className:"bg-background",children:e.jsx(r.SelectValue,{placeholder:"Select currency"})}),e.jsx(r.SelectContent,{children:a.map(s=>e.jsxs(r.SelectItem,{value:s.code,children:[s.code,s.is_default?" (Default)":""]},s.code))})]}),e.jsx("p",{className:"text-[10px] text-slate-500",children:"Enter the source amount once and the other currencies will be derived automatically using the current FX rates."})]}):e.jsx("p",{className:"text-[10px] text-slate-500",children:"Manual mode stores exact values per currency. This is the best choice when shipping should not follow exchange-rate math directly."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Currency Rates"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j==="free_shipping"?"Free-shipping methods keep cost at zero, but you can still control the threshold per currency.":u==="auto"?`Only ${o} is editable. The rest are derived automatically.`:"Set the exact shopper-facing shipping price for each active currency."})]}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:a.map(s=>{const n=u==="auto"&&s.code!==o,t=p.getCurrencyMinorUnitFactor(s.code)===1?"1":"0.01";return e.jsxs("div",{className:"space-y-4 rounded-xl border bg-card/70 p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s.code}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Rate ",s.exchange_rate]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.is_default?e.jsx(r.Badge,{variant:"outline",children:"Default"}):null,u==="auto"&&s.code===o?e.jsx(r.Badge,{children:"Source"}):null,n?e.jsx(r.Badge,{variant:"outline",children:"Derived"}):null]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(r.Label,{htmlFor:`rate-cost-${s.code}`,children:["Cost (",s.code,")"]}),e.jsxs("div",{className:"relative",children:[e.jsx(C.DollarSign,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-slate-400"}),e.jsx(r.Input,{id:`rate-cost-${s.code}`,type:"number",step:t,min:"0",value:L[s.code]??"",onChange:c=>_(y=>({...y,[s.code]:c.target.value})),className:"pl-9 bg-slate-50/50 dark:bg-slate-900/50 disabled:opacity-70",disabled:j==="free_shipping"||n,required:j!=="free_shipping"&&u==="manual"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(r.Label,{htmlFor:`rate-threshold-${s.code}`,children:["Free-Shipping Threshold (",s.code,")"]}),e.jsxs("div",{className:"relative",children:[e.jsx(C.DollarSign,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-slate-400"}),e.jsx(r.Input,{id:`rate-threshold-${s.code}`,type:"number",step:t,min:"0",value:q[s.code]??"",onChange:c=>w(y=>({...y,[s.code]:c.target.value})),className:"pl-9 bg-slate-50/50 dark:bg-slate-900/50 disabled:opacity-70",disabled:n,placeholder:p.getCurrencyMinorUnitFactor(s.code)===1?"0":"0.00"})]})]}),n?e.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["This currency is synced automatically from ",o,"."]}):u==="manual"?e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Enter the exact amount shoppers should see in this currency."}):null]},s.code)})})]})]}),e.jsxs(r.DialogFooter,{className:"bg-slate-50 dark:bg-slate-900/50 -mx-6 -mb-6 p-4 border-t dark:border-slate-800",children:[e.jsx(r.Button,{type:"button",variant:"ghost",onClick:()=>I(!1),disabled:E,children:"Cancel"}),e.jsx(r.Button,{type:"submit",disabled:E||!F.trim(),children:E?S?"Saving...":"Adding...":S?"Save Changes":"Add Rate"})]})]})})]})}exports.RateForm=re;