@nextblock-cms/ecom 0.20.3 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (317) hide show
  1. package/_virtual/_rolldown/runtime.cjs.js +1 -0
  2. package/index.cjs.js +1 -1
  3. package/index.es.js +38 -146
  4. package/lib/CurrencyProvider.cjs.js +1 -1
  5. package/lib/CurrencyProvider.d.ts +1 -1
  6. package/lib/CurrencyProvider.es.js +85 -95
  7. package/lib/PaymentReadinessProvider.cjs.js +1 -1
  8. package/lib/PaymentReadinessProvider.d.ts +1 -1
  9. package/lib/PaymentReadinessProvider.es.js +24 -27
  10. package/lib/cart-store.cjs.js +1 -1
  11. package/lib/cart-store.es.js +109 -121
  12. package/lib/components/AccountNavigationMenu.cjs.js +1 -1
  13. package/lib/components/AccountNavigationMenu.d.ts +1 -1
  14. package/lib/components/AccountNavigationMenu.es.js +36 -50
  15. package/lib/components/AddToCartButton.cjs.js +1 -1
  16. package/lib/components/AddToCartButton.d.ts +1 -1
  17. package/lib/components/AddToCartButton.es.js +94 -89
  18. package/lib/components/Cart.cjs.js +1 -1
  19. package/lib/components/Cart.d.ts +1 -1
  20. package/lib/components/Cart.es.js +261 -180
  21. package/lib/components/CartDrawer.cjs.js +1 -1
  22. package/lib/components/CartDrawer.d.ts +1 -1
  23. package/lib/components/CartDrawer.es.js +218 -148
  24. package/lib/components/CartIcon.cjs.js +1 -1
  25. package/lib/components/CartIcon.d.ts +1 -1
  26. package/lib/components/CartIcon.es.js +33 -35
  27. package/lib/components/Checkout.cjs.js +1 -1
  28. package/lib/components/Checkout.d.ts +1 -1
  29. package/lib/components/Checkout.es.js +1092 -1108
  30. package/lib/components/CouponForm.cjs.js +1 -1
  31. package/lib/components/CouponForm.d.ts +1 -1
  32. package/lib/components/CouponForm.es.js +136 -148
  33. package/lib/components/CurrencySwitcher.cjs.js +1 -1
  34. package/lib/components/CurrencySwitcher.d.ts +1 -1
  35. package/lib/components/CurrencySwitcher.es.js +22 -18
  36. package/lib/components/CustomerProfileForm.cjs.js +1 -1
  37. package/lib/components/CustomerProfileForm.es.js +454 -313
  38. package/lib/components/FeaturedProduct.cjs.js +1 -1
  39. package/lib/components/FeaturedProduct.d.ts +1 -1
  40. package/lib/components/FeaturedProduct.es.js +98 -83
  41. package/lib/components/FreemiusLicensePanel.cjs.js +1 -1
  42. package/lib/components/FreemiusLicensePanel.d.ts +1 -1
  43. package/lib/components/FreemiusLicensePanel.es.js +70 -65
  44. package/lib/components/InvoiceDocument.cjs.js +1 -1
  45. package/lib/components/InvoiceDocument.es.js +256 -192
  46. package/lib/components/InvoiceViewerShell.cjs.js +2 -2
  47. package/lib/components/InvoiceViewerShell.d.ts +1 -1
  48. package/lib/components/InvoiceViewerShell.es.js +75 -106
  49. package/lib/components/ProductCard.cjs.js +1 -1
  50. package/lib/components/ProductCard.d.ts +1 -1
  51. package/lib/components/ProductCard.es.js +186 -171
  52. package/lib/components/ProductDetailsLayout.cjs.js +1 -1
  53. package/lib/components/ProductDetailsLayout.es.js +405 -404
  54. package/lib/components/ProductGallery.cjs.js +1 -1
  55. package/lib/components/ProductGallery.d.ts +1 -1
  56. package/lib/components/ProductGallery.es.js +51 -54
  57. package/lib/components/ProductGrid.cjs.js +1 -1
  58. package/lib/components/ProductGrid.d.ts +1 -1
  59. package/lib/components/ProductGrid.es.js +23 -25
  60. package/lib/components/ShippingEstimator.cjs.js +1 -1
  61. package/lib/components/ShippingEstimator.d.ts +1 -1
  62. package/lib/components/ShippingEstimator.es.js +158 -153
  63. package/lib/components/ShortDescription.cjs.js +1 -1
  64. package/lib/components/ShortDescription.es.js +17 -17
  65. package/lib/components/SimpleTiptapRenderer.cjs.js +1 -1
  66. package/lib/components/SimpleTiptapRenderer.es.js +238 -211
  67. package/lib/components/SubscriptionSelector.cjs.js +1 -1
  68. package/lib/components/SubscriptionSelector.es.js +159 -154
  69. package/lib/countries.cjs.js +1 -1
  70. package/lib/countries.es.js +232 -75
  71. package/lib/coupon-server.cjs.js +1 -1
  72. package/lib/coupon-server.es.js +180 -224
  73. package/lib/coupons.cjs.js +1 -1
  74. package/lib/coupons.es.js +12 -14
  75. package/lib/currency-constants.cjs.js +1 -1
  76. package/lib/currency-constants.es.js +4 -4
  77. package/lib/currency-rest-client.cjs.js +1 -1
  78. package/lib/currency-rest-client.es.js +15 -22
  79. package/lib/currency-store.cjs.js +1 -1
  80. package/lib/currency-store.es.js +20 -27
  81. package/lib/currency-sync.cjs.js +1 -1
  82. package/lib/currency-sync.es.js +124 -170
  83. package/lib/currency.cjs.js +1 -1
  84. package/lib/currency.es.js +242 -310
  85. package/lib/customer-addresses.cjs.js +1 -1
  86. package/lib/customer-addresses.es.js +80 -109
  87. package/lib/customer-orders.cjs.js +1 -1
  88. package/lib/customer-orders.es.js +31 -43
  89. package/lib/customer.cjs.js +1 -1
  90. package/lib/customer.es.js +43 -52
  91. package/lib/export-helpers.cjs.js +1 -1
  92. package/lib/export-helpers.es.js +53 -52
  93. package/lib/factory.cjs.js +1 -1
  94. package/lib/factory.es.js +10 -7
  95. package/lib/freemius-coupons.cjs.js +1 -1
  96. package/lib/freemius-coupons.es.js +245 -262
  97. package/lib/freemius-license-claim.cjs.js +1 -1
  98. package/lib/freemius-license-claim.es.js +87 -71
  99. package/lib/freemius-license.cjs.js +1 -1
  100. package/lib/freemius-license.es.js +32 -39
  101. package/lib/freemius-order-sync.cjs.js +1 -1
  102. package/lib/freemius-order-sync.es.js +226 -290
  103. package/lib/freemius-trial-provision.cjs.js +1 -1
  104. package/lib/freemius-trial-provision.es.js +136 -130
  105. package/lib/inventory-settings.cjs.js +1 -1
  106. package/lib/inventory-settings.es.js +69 -77
  107. package/lib/invoice-server.cjs.js +3 -3
  108. package/lib/invoice-server.es.js +94 -141
  109. package/lib/invoice-ui.cjs.js +1 -1
  110. package/lib/invoice-ui.es.js +50 -66
  111. package/lib/invoice.cjs.js +1 -1
  112. package/lib/invoice.es.js +85 -94
  113. package/lib/order-inventory.cjs.js +25 -25
  114. package/lib/order-inventory.es.js +67 -79
  115. package/lib/order-tax-details.cjs.js +1 -1
  116. package/lib/order-tax-details.es.js +142 -153
  117. package/lib/pages/cms/coupons/CouponEditorForm.cjs.js +1 -1
  118. package/lib/pages/cms/coupons/CouponEditorForm.d.ts +1 -1
  119. package/lib/pages/cms/coupons/CouponEditorForm.es.js +227 -185
  120. package/lib/pages/cms/coupons/CouponsPage.cjs.js +2 -2
  121. package/lib/pages/cms/coupons/CouponsPage.d.ts +1 -1
  122. package/lib/pages/cms/coupons/CouponsPage.es.js +235 -166
  123. package/lib/pages/cms/coupons/CreateCouponDialog.cjs.js +1 -1
  124. package/lib/pages/cms/coupons/CreateCouponDialog.d.ts +1 -1
  125. package/lib/pages/cms/coupons/CreateCouponDialog.es.js +35 -34
  126. package/lib/pages/cms/coupons/EditCouponPage.cjs.js +1 -1
  127. package/lib/pages/cms/coupons/EditCouponPage.d.ts +1 -1
  128. package/lib/pages/cms/coupons/EditCouponPage.es.js +47 -47
  129. package/lib/pages/cms/coupons/ProductScopePicker.cjs.js +1 -1
  130. package/lib/pages/cms/coupons/ProductScopePicker.d.ts +1 -1
  131. package/lib/pages/cms/coupons/ProductScopePicker.es.js +128 -117
  132. package/lib/pages/cms/coupons/actions.cjs.js +1 -1
  133. package/lib/pages/cms/coupons/actions.es.js +112 -115
  134. package/lib/pages/cms/coupons/index.cjs.js +1 -0
  135. package/lib/pages/cms/coupons/index.es.js +3 -0
  136. package/lib/pages/cms/coupons/product-options.cjs.js +1 -1
  137. package/lib/pages/cms/coupons/product-options.es.js +21 -23
  138. package/lib/pages/cms/orders/ExportReportsDialog.cjs.js +1 -1
  139. package/lib/pages/cms/orders/ExportReportsDialog.es.js +135 -129
  140. package/lib/pages/cms/orders/MarkPaidButton.d.ts +1 -1
  141. package/lib/pages/cms/orders/OrderDetailPage.cjs.js +1 -1
  142. package/lib/pages/cms/orders/OrderDetailPage.d.ts +1 -1
  143. package/lib/pages/cms/orders/OrderDetailPage.es.js +186 -134
  144. package/lib/pages/cms/orders/OrderPrintButton.cjs.js +1 -1
  145. package/lib/pages/cms/orders/OrderPrintButton.d.ts +1 -1
  146. package/lib/pages/cms/orders/OrderPrintButton.es.js +15 -21
  147. package/lib/pages/cms/orders/OrderStatusForm.cjs.js +1 -1
  148. package/lib/pages/cms/orders/OrderStatusForm.d.ts +1 -1
  149. package/lib/pages/cms/orders/OrderStatusForm.es.js +85 -69
  150. package/lib/pages/cms/orders/OrdersPage.cjs.js +1 -1
  151. package/lib/pages/cms/orders/OrdersPage.d.ts +1 -1
  152. package/lib/pages/cms/orders/OrdersPage.es.js +170 -102
  153. package/lib/pages/cms/orders/actions.cjs.js +3 -3
  154. package/lib/pages/cms/orders/actions.es.js +53 -69
  155. package/lib/pages/cms/orders/export-actions.cjs.js +1 -1
  156. package/lib/pages/cms/orders/export-actions.es.js +23 -26
  157. package/lib/pages/cms/orders/index.cjs.js +1 -0
  158. package/lib/pages/cms/orders/index.es.js +6 -0
  159. package/lib/pages/cms/orders/server-actions.cjs.js +1 -1
  160. package/lib/pages/cms/orders/server-actions.es.js +60 -51
  161. package/lib/pages/cms/payments/PaymentsClient.cjs.js +1 -1
  162. package/lib/pages/cms/payments/PaymentsClient.d.ts +1 -1
  163. package/lib/pages/cms/payments/PaymentsClient.es.js +316 -346
  164. package/lib/pages/cms/payments/PaymentsPage.cjs.js +1 -1
  165. package/lib/pages/cms/payments/PaymentsPage.d.ts +1 -1
  166. package/lib/pages/cms/payments/PaymentsPage.es.js +29 -32
  167. package/lib/pages/cms/payments/actions.cjs.js +1 -1
  168. package/lib/pages/cms/payments/actions.es.js +38 -48
  169. package/lib/pages/cms/payments/index.cjs.js +1 -0
  170. package/lib/pages/cms/payments/index.es.js +3 -0
  171. package/lib/pages/cms/payments/queries.cjs.js +1 -1
  172. package/lib/pages/cms/payments/queries.es.js +38 -48
  173. package/lib/pages/cms/products/ProductsPage.cjs.js +1 -1
  174. package/lib/pages/cms/products/ProductsPage.d.ts +1 -1
  175. package/lib/pages/cms/products/ProductsPage.es.js +63 -66
  176. package/lib/pages/cms/products/[id]/edit/EditProductPage.d.ts +1 -1
  177. package/lib/pages/cms/products/_id_/edit/EditProductPage.cjs.js +1 -1
  178. package/lib/pages/cms/products/_id_/edit/EditProductPage.es.js +138 -155
  179. package/lib/pages/cms/products/actions.cjs.js +4 -4
  180. package/lib/pages/cms/products/actions.es.js +121 -162
  181. package/lib/pages/cms/products/attributes/AttributeManagementPage.cjs.js +1 -1
  182. package/lib/pages/cms/products/attributes/AttributeManagementPage.d.ts +1 -1
  183. package/lib/pages/cms/products/attributes/AttributeManagementPage.es.js +55 -47
  184. package/lib/pages/cms/products/attributes/components/AttributeManager.cjs.js +1 -1
  185. package/lib/pages/cms/products/attributes/components/AttributeManager.d.ts +1 -1
  186. package/lib/pages/cms/products/attributes/components/AttributeManager.es.js +285 -290
  187. package/lib/pages/cms/products/categories/CategoryManagementPage.cjs.js +1 -1
  188. package/lib/pages/cms/products/categories/CategoryManagementPage.d.ts +1 -1
  189. package/lib/pages/cms/products/categories/CategoryManagementPage.es.js +43 -35
  190. package/lib/pages/cms/products/categories/components/CategoryManager.cjs.js +1 -1
  191. package/lib/pages/cms/products/categories/components/CategoryManager.es.js +315 -262
  192. package/lib/pages/cms/products/components/CopyProductFromLanguage.cjs.js +1 -1
  193. package/lib/pages/cms/products/components/CopyProductFromLanguage.es.js +115 -113
  194. package/lib/pages/cms/products/components/CurrencyPriceFields.cjs.js +1 -1
  195. package/lib/pages/cms/products/components/CurrencyPriceFields.d.ts +1 -1
  196. package/lib/pages/cms/products/components/CurrencyPriceFields.es.js +136 -145
  197. package/lib/pages/cms/products/components/DeleteProductButton.cjs.js +1 -1
  198. package/lib/pages/cms/products/components/DeleteProductButton.d.ts +1 -1
  199. package/lib/pages/cms/products/components/DeleteProductButton.es.js +35 -47
  200. package/lib/pages/cms/products/components/FreemiusPricingDashboard.cjs.js +1 -1
  201. package/lib/pages/cms/products/components/FreemiusPricingDashboard.d.ts +1 -1
  202. package/lib/pages/cms/products/components/FreemiusPricingDashboard.es.js +106 -84
  203. package/lib/pages/cms/products/components/ProductCategorySelector.cjs.js +1 -1
  204. package/lib/pages/cms/products/components/ProductCategorySelector.es.js +156 -159
  205. package/lib/pages/cms/products/components/ProductForm.cjs.js +1 -1
  206. package/lib/pages/cms/products/components/ProductForm.es.js +872 -693
  207. package/lib/pages/cms/products/components/ProductMediaManager.cjs.js +1 -1
  208. package/lib/pages/cms/products/components/ProductMediaManager.es.js +106 -103
  209. package/lib/pages/cms/products/components/ProductsBulkTable.cjs.js +1 -1
  210. package/lib/pages/cms/products/components/ProductsBulkTable.d.ts +1 -1
  211. package/lib/pages/cms/products/components/ProductsBulkTable.es.js +303 -294
  212. package/lib/pages/cms/products/components/SaleScheduleFields.cjs.js +1 -1
  213. package/lib/pages/cms/products/components/SaleScheduleFields.d.ts +1 -1
  214. package/lib/pages/cms/products/components/SaleScheduleFields.es.js +111 -134
  215. package/lib/pages/cms/products/components/SyncFreemiusButton.cjs.js +1 -1
  216. package/lib/pages/cms/products/components/SyncFreemiusButton.d.ts +1 -1
  217. package/lib/pages/cms/products/components/SyncFreemiusButton.es.js +29 -35
  218. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.cjs.js +2 -2
  219. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.d.ts +1 -1
  220. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.es.js +36 -48
  221. package/lib/pages/cms/products/components/SyncProductForm.d.ts +1 -1
  222. package/lib/pages/cms/products/components/VariationsEditor.cjs.js +1 -1
  223. package/lib/pages/cms/products/components/VariationsEditor.d.ts +1 -1
  224. package/lib/pages/cms/products/components/VariationsEditor.es.js +396 -405
  225. package/lib/pages/cms/products/index.cjs.js +1 -0
  226. package/lib/pages/cms/products/index.es.js +8 -0
  227. package/lib/pages/cms/products/inventory/InventoryPage.cjs.js +1 -1
  228. package/lib/pages/cms/products/inventory/InventoryPage.d.ts +1 -1
  229. package/lib/pages/cms/products/inventory/InventoryPage.es.js +21 -15
  230. package/lib/pages/cms/products/inventory/InventoryTableClient.cjs.js +2 -2
  231. package/lib/pages/cms/products/inventory/InventoryTableClient.d.ts +1 -1
  232. package/lib/pages/cms/products/inventory/InventoryTableClient.es.js +230 -209
  233. package/lib/pages/cms/products/inventory/actions.cjs.js +3 -3
  234. package/lib/pages/cms/products/inventory/actions.es.js +83 -91
  235. package/lib/pages/cms/products/new/NewProductPage.cjs.js +1 -1
  236. package/lib/pages/cms/products/new/NewProductPage.d.ts +1 -1
  237. package/lib/pages/cms/products/new/NewProductPage.es.js +58 -74
  238. package/lib/pages/cms/products/product-price-sync.cjs.js +1 -1
  239. package/lib/pages/cms/products/product-price-sync.es.js +74 -89
  240. package/lib/pages/cms/products/server-actions.cjs.js +1 -1
  241. package/lib/pages/cms/products/server-actions.es.js +250 -233
  242. package/lib/pages/cms/shipping/ShippingPage.cjs.js +2 -2
  243. package/lib/pages/cms/shipping/ShippingPage.es.js +287 -209
  244. package/lib/pages/cms/shipping/components/RateForm.cjs.js +1 -1
  245. package/lib/pages/cms/shipping/components/RateForm.d.ts +1 -1
  246. package/lib/pages/cms/shipping/components/RateForm.es.js +439 -436
  247. package/lib/pages/cms/shipping/components/ZoneForm.cjs.js +1 -1
  248. package/lib/pages/cms/shipping/components/ZoneForm.es.js +245 -224
  249. package/lib/pages/cms/shipping/index.cjs.js +1 -0
  250. package/lib/pages/cms/shipping/index.es.js +3 -0
  251. package/lib/pages/cms/shipping/server-actions.cjs.js +1 -1
  252. package/lib/pages/cms/shipping/server-actions.es.js +131 -149
  253. package/lib/pages/cms/taxes/TaxesPage.cjs.js +1 -1
  254. package/lib/pages/cms/taxes/TaxesPage.d.ts +1 -1
  255. package/lib/pages/cms/taxes/TaxesPage.es.js +211 -169
  256. package/lib/pages/cms/taxes/actions.cjs.js +1 -1
  257. package/lib/pages/cms/taxes/actions.es.js +41 -53
  258. package/lib/pages/cms/taxes/components/TaxRateForm.cjs.js +1 -1
  259. package/lib/pages/cms/taxes/components/TaxRateForm.d.ts +1 -1
  260. package/lib/pages/cms/taxes/components/TaxRateForm.es.js +112 -99
  261. package/lib/pages/cms/taxes/index.cjs.js +1 -0
  262. package/lib/pages/cms/taxes/index.es.js +3 -0
  263. package/lib/payment-config.cjs.js +1 -1
  264. package/lib/payment-config.es.js +110 -126
  265. package/lib/product-actions.cjs.js +4 -4
  266. package/lib/product-actions.es.js +289 -544
  267. package/lib/product-context.cjs.js +1 -1
  268. package/lib/product-context.es.js +13 -15
  269. package/lib/product-schema.cjs.js +1 -1
  270. package/lib/product-schema.es.js +99 -134
  271. package/lib/providers/freemius.cjs.js +1 -5
  272. package/lib/providers/freemius.es.js +446 -530
  273. package/lib/providers/stripe.cjs.js +1 -1
  274. package/lib/providers/stripe.es.js +417 -477
  275. package/lib/server-actions/coupon-actions.cjs.js +1 -1
  276. package/lib/server-actions/coupon-actions.es.js +22 -22
  277. package/lib/server-actions/customer-actions.cjs.js +1 -1
  278. package/lib/server-actions/customer-actions.es.js +26 -28
  279. package/lib/server-actions/product-actions.cjs.js +1 -1
  280. package/lib/server-actions/product-actions.es.js +9 -15
  281. package/lib/server-actions/shipping-actions.cjs.js +1 -1
  282. package/lib/server-actions/shipping-actions.es.js +27 -24
  283. package/lib/server-actions/tax-actions.cjs.js +1 -1
  284. package/lib/server-actions/tax-actions.es.js +33 -39
  285. package/lib/shared-inventory.cjs.js +2 -2
  286. package/lib/shared-inventory.es.js +111 -160
  287. package/lib/shipping/resolver.cjs.js +2 -2
  288. package/lib/shipping/resolver.es.js +44 -61
  289. package/lib/shipping-rate-currency.cjs.js +1 -1
  290. package/lib/shipping-rate-currency.es.js +52 -67
  291. package/lib/states.cjs.js +1 -1
  292. package/lib/states.es.js +333 -154
  293. package/lib/stripe/checkout.cjs.js +1 -1
  294. package/lib/stripe/checkout.es.js +125 -181
  295. package/lib/stripe/client.cjs.js +1 -1
  296. package/lib/stripe/client.es.js +14 -19
  297. package/lib/stripe/order-sync.cjs.js +1 -1
  298. package/lib/stripe/order-sync.es.js +106 -126
  299. package/lib/stripe/webhooks.cjs.js +1 -1
  300. package/lib/stripe/webhooks.es.js +37 -31
  301. package/lib/tax-calculation.cjs.js +1 -1
  302. package/lib/tax-calculation.es.js +84 -98
  303. package/lib/trials.cjs.js +1 -1
  304. package/lib/trials.es.js +24 -30
  305. package/lib/types.cjs.js +1 -1
  306. package/lib/types.es.js +21 -27
  307. package/lib/use-cart.cjs.js +1 -1
  308. package/lib/use-cart.es.js +38 -40
  309. package/lib/use-price-formatter.cjs.js +1 -1
  310. package/lib/use-price-formatter.es.js +10 -11
  311. package/lib/variation-utils.cjs.js +1 -1
  312. package/lib/variation-utils.es.js +199 -261
  313. package/lib/zod-config.cjs.js +1 -1
  314. package/lib/zod-config.es.js +5 -6
  315. package/package.json +16 -16
  316. package/server.cjs.js +1 -1
  317. package/server.es.js +56 -211
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("@nextblock-cms/db/server"),a=require("@nextblock-cms/ui"),r=require("lucide-react"),h=require("./components/ZoneForm.cjs.js"),u=require("./components/RateForm.cjs.js"),l=require("./server-actions.cjs.js"),f=require("../../../currency.cjs.js"),v=require("../../../inventory-settings.cjs.js"),b=require("../../../states.cjs.js"),o=require("@nextblock-cms/utils");async function N({searchParams:m}){const n=j.getServiceRoleSupabaseClient(),[{data:c},g,{data:x},{data:d}]=await Promise.all([n.from("shipping_zones").select(`
1
+ const e=require("../../../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../../currency.cjs.js"),n=require("../../../states.cjs.js"),r=require("../../../inventory-settings.cjs.js"),i=require("./server-actions.cjs.js"),a=require("./components/ZoneForm.cjs.js"),o=require("./components/RateForm.cjs.js");let s=require("react");s=e.__toESM(s,1);let c=require("lucide-react"),l=require("@nextblock-cms/utils"),u=require("react/jsx-runtime"),d=require("@nextblock-cms/db/server"),f=require("@nextblock-cms/ui");async function p({searchParams:e}){let s=(0,d.getServiceRoleSupabaseClient)(),[{data:p},m,{data:h},{data:g}]=await Promise.all([s.from(`shipping_zones`).select(`
2
2
  *,
3
3
  shipping_zone_locations (*),
4
4
  shipping_zone_methods (*)
5
- `).order("priority_order",{ascending:!0}),v.getEcommerceInventorySettings(n),n.from("languages").select("code, name, is_default").eq("is_active",!0).order("name",{ascending:!0}),n.from("currencies").select("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").eq("is_active",!0).order("is_default",{ascending:!1}).order("code",{ascending:!0})]),i=d?.find(t=>t.is_default)?.code||d?.[0]?.code||"USD",p=(d||[]).map(t=>f.normalizeCurrencyRecord(t));return e.jsx(a.TooltipProvider,{children:e.jsxs("div",{className:"space-y-6",children:[m?.success?e.jsx("div",{className:"rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700",children:m.success}):null,e.jsx(a.Card,{className:"overflow-hidden border-slate-200 dark:border-slate-800 shadow-sm",children:e.jsx(a.CardContent,{className:"p-4 sm:p-5",children:e.jsxs("form",{action:l.updateInventoryTrackingAction,className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg text-primary shadow-inner shrink-0",children:e.jsx(r.Boxes,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(a.CardTitle,{className:"text-base font-semibold leading-none",children:"Inventory Tracking"}),e.jsx(a.CardDescription,{className:"mt-1 text-sm",children:"Control whether checkout enforces stock counts and paid orders deduct inventory."})]})]}),e.jsx("div",{className:"flex justify-end lg:justify-start shrink-0",children:e.jsx(a.Button,{type:"submit",size:"sm",className:"w-full sm:w-auto",children:"Save Inventory Settings"})})]}),e.jsxs("div",{className:"rounded-lg border bg-muted/20 px-4 py-3",children:[e.jsx("input",{type:"hidden",name:"trackQuantities",value:"false"}),e.jsxs("label",{htmlFor:"track-quantities",className:"flex cursor-pointer items-start gap-3",children:[e.jsx("input",{id:"track-quantities",name:"trackQuantities",type:"checkbox",value:"true",defaultChecked:g.trackQuantities,className:"mt-0.5 h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary"}),e.jsxs("span",{className:"space-y-0.5",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-900 dark:text-slate-100",children:"Track product quantities"}),e.jsx("span",{className:"block text-sm text-muted-foreground",children:"Prevent overselling by checking stock during checkout and decrementing quantities after payment is confirmed."})]})]})]})]})})}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight text-slate-900 dark:text-slate-100",children:"Shipping Zones"}),e.jsx("p",{className:"text-slate-500 dark:text-slate-400 text-sm",children:"Manage geographical delivery areas and their associated shipping rates."})]}),e.jsx(h.ZoneForm,{})]}),e.jsx("div",{className:"grid gap-6",children:!c||c.length===0?e.jsx(a.Card,{className:"bg-slate-50/50 dark:bg-slate-900/10 border-dashed",children:e.jsxs(a.CardContent,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(r.Truck,{className:"h-12 w-12 text-slate-300 dark:text-slate-700 mb-4"}),e.jsx("p",{className:"text-slate-600 dark:text-slate-400 font-medium",children:"No shipping zones defined yet."}),e.jsx("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)."})]})}):c.map(t=>e.jsxs(a.Card,{className:"overflow-hidden border-slate-200 dark:border-slate-800 shadow-sm hover:shadow-md transition-shadow",children:[e.jsx(a.CardHeader,{className:"bg-slate-50/50 dark:bg-slate-900/50 border-b dark:border-slate-800 py-4",children:e.jsxs("div",{className:"flex justify-between items-start md:items-center",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg text-primary shadow-inner",children:e.jsx(r.Globe,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(a.CardTitle,{className:"text-lg font-bold",children:t.name}),e.jsxs(a.Badge,{variant:"outline",className:"text-[10px] uppercase font-bold py-0 h-4 border-slate-200 bg-white/50 dark:bg-black/20",children:["Prio: ",t.priority_order]})]}),e.jsxs(a.CardDescription,{className:"text-xs",children:[t.shipping_zone_locations?.length||0," regions covered"]})]})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(h.ZoneForm,{mode:"edit",initialData:{id:t.id,name:t.name,priority_order:t.priority_order,locations:t.shipping_zone_locations?.map(s=>({country_code:s.country_code,state_code:s.state_code}))||[]}}),e.jsx("form",{action:async()=>{"use server";await l.deleteShippingZone(t.id)},children:e.jsx(a.Button,{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:e.jsx(r.Trash2,{className:"h-4 w-4"})})})]})]})}),e.jsx(a.CardContent,{className:"p-0",children:e.jsxs("div",{className:"grid md:grid-cols-2 divide-y md:divide-y-0 md:divide-x divide-slate-100 dark:divide-slate-800",children:[e.jsxs("div",{className:"p-6",children:[e.jsxs("h4",{className:"text-[10px] font-bold uppercase tracking-widest text-slate-500 mb-4 flex items-center gap-1.5",children:[e.jsx(r.Globe,{className:"h-3 w-3"})," Target Regions"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.shipping_zone_locations?.length>0?t.shipping_zone_locations.map(s=>e.jsxs(a.Badge,{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:[s.country_code,s.state_code?e.jsxs("span",{className:"text-slate-400 ml-1",children:["(",b.resolveSubdivisionName(s.country_code,s.state_code),")"]}):""]},s.id)):e.jsx("p",{className:"text-sm text-slate-400 italic",children:"No specific locations assigned."})})]}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h4",{className:"text-[10px] font-bold uppercase tracking-widest text-slate-500 flex items-center gap-1.5",children:[e.jsx(r.Truck,{className:"h-3 w-3"})," Shipping Methods"]}),e.jsx(u.RateForm,{zoneId:t.id,zoneName:t.name,languages:x||[],currencies:p,defaultCurrencyCode:i})]}),e.jsx("div",{className:"space-y-2",children:t.shipping_zone_methods?.length>0?t.shipping_zone_methods.map(s=>e.jsxs("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:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-900 dark:text-slate-100 truncate",children:s.name}),e.jsx(a.Badge,{variant:"outline",className:"h-4 px-1 text-[9px]",children:s.currency_pricing_mode==="manual"?"Manual FX":"Auto FX"}),(s.min_order_amount||0)>0&&e.jsxs(a.Tooltip,{children:[e.jsx(a.TooltipTrigger,{asChild:!0,children:e.jsxs(a.Badge,{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:[e.jsx(r.Info,{className:"h-2 w-2 mr-0.5"}),o.formatPrice(s.min_order_amount,s.cost_currency?.toUpperCase()||i)]})}),e.jsxs(a.TooltipContent,{children:["Available for orders over ",o.formatPrice(s.min_order_amount,s.cost_currency?.toUpperCase()||i)]})]})]}),e.jsx("p",{className:"text-[10px] text-slate-500 uppercase tracking-tighter mix-blend-multiply dark:mix-blend-normal",children:s.method_type.replace("_"," ")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("p",{className:"text-sm font-black text-primary px-2",children:s.method_type==="free_shipping"?"FREE":o.formatPrice(s.cost_amount,s.cost_currency?.toUpperCase()||i)}),e.jsxs("div",{className:"flex opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx(u.RateForm,{zoneId:t.id,zoneName:t.name,languages:x||[],currencies:p,defaultCurrencyCode:i,mode:"edit",initialData:s}),e.jsx("form",{action:async()=>{"use server";await l.deleteShippingRate(s.id)},children:e.jsx(a.Button,{type:"submit",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-red-500",children:e.jsx(r.Trash2,{className:"h-3 w-3"})})})]})]})]},s.id)):e.jsx("p",{className:"text-xs text-slate-400 italic",children:"No methods defined for this zone."})})]})]})})]},t.id))})]})})}exports.ShippingPage=N;
5
+ `).order(`priority_order`,{ascending:!0}),r.getEcommerceInventorySettings(s),s.from(`languages`).select(`code, name, is_default`).eq(`is_active`,!0).order(`name`,{ascending:!0}),s.from(`currencies`).select(`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`).eq(`is_active`,!0).order(`is_default`,{ascending:!1}).order(`code`,{ascending:!0})]),_=g?.find(e=>e.is_default)?.code||g?.[0]?.code||`USD`,v=(g||[]).map(e=>t.normalizeCurrencyRecord(e));return(0,u.jsx)(f.TooltipProvider,{children:(0,u.jsxs)(`div`,{className:`space-y-6`,children:[e?.success?(0,u.jsx)(`div`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700`,children:e.success}):null,(0,u.jsx)(f.Card,{className:`overflow-hidden border-slate-200 dark:border-slate-800 shadow-sm`,children:(0,u.jsx)(f.CardContent,{className:`p-4 sm:p-5`,children:(0,u.jsxs)(`form`,{action:i.updateInventoryTrackingAction,className:`space-y-3`,children:[(0,u.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,u.jsxs)(`div`,{className:`flex items-start gap-3 min-w-0`,children:[(0,u.jsx)(`div`,{className:`p-2 bg-primary/10 rounded-lg text-primary shadow-inner shrink-0`,children:(0,u.jsx)(c.Boxes,{className:`h-4 w-4`})}),(0,u.jsxs)(`div`,{className:`min-w-0`,children:[(0,u.jsx)(f.CardTitle,{className:`text-base font-semibold leading-none`,children:`Inventory Tracking`}),(0,u.jsx)(f.CardDescription,{className:`mt-1 text-sm`,children:`Control whether checkout enforces stock counts and paid orders deduct inventory.`})]})]}),(0,u.jsx)(`div`,{className:`flex justify-end lg:justify-start shrink-0`,children:(0,u.jsx)(f.Button,{type:`submit`,size:`sm`,className:`w-full sm:w-auto`,children:`Save Inventory Settings`})})]}),(0,u.jsxs)(`div`,{className:`rounded-lg border bg-muted/20 px-4 py-3`,children:[(0,u.jsx)(`input`,{type:`hidden`,name:`trackQuantities`,value:`false`}),(0,u.jsxs)(`label`,{htmlFor:`track-quantities`,className:`flex cursor-pointer items-start gap-3`,children:[(0,u.jsx)(`input`,{id:`track-quantities`,name:`trackQuantities`,type:`checkbox`,value:`true`,defaultChecked:m.trackQuantities,className:`mt-0.5 h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary`}),(0,u.jsxs)(`span`,{className:`space-y-0.5`,children:[(0,u.jsx)(`span`,{className:`block text-sm font-medium text-slate-900 dark:text-slate-100`,children:`Track product quantities`}),(0,u.jsx)(`span`,{className:`block text-sm text-muted-foreground`,children:`Prevent overselling by checking stock during checkout and decrementing quantities after payment is confirmed.`})]})]})]})]})})}),(0,u.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight text-slate-900 dark:text-slate-100`,children:`Shipping Zones`}),(0,u.jsx)(`p`,{className:`text-slate-500 dark:text-slate-400 text-sm`,children:`Manage geographical delivery areas and their associated shipping rates.`})]}),(0,u.jsx)(a.ZoneForm,{})]}),(0,u.jsx)(`div`,{className:`grid gap-6`,children:!p||p.length===0?(0,u.jsx)(f.Card,{className:`bg-slate-50/50 dark:bg-slate-900/10 border-dashed`,children:(0,u.jsxs)(f.CardContent,{className:`flex flex-col items-center justify-center py-12`,children:[(0,u.jsx)(c.Truck,{className:`h-12 w-12 text-slate-300 dark:text-slate-700 mb-4`}),(0,u.jsx)(`p`,{className:`text-slate-600 dark:text-slate-400 font-medium`,children:`No shipping zones defined yet.`}),(0,u.jsx)(`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).`})]})}):p.map(e=>(0,u.jsxs)(f.Card,{className:`overflow-hidden border-slate-200 dark:border-slate-800 shadow-sm hover:shadow-md transition-shadow`,children:[(0,u.jsx)(f.CardHeader,{className:`bg-slate-50/50 dark:bg-slate-900/50 border-b dark:border-slate-800 py-4`,children:(0,u.jsxs)(`div`,{className:`flex justify-between items-start md:items-center`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,u.jsx)(`div`,{className:`p-2 bg-primary/10 rounded-lg text-primary shadow-inner`,children:(0,u.jsx)(c.Globe,{className:`h-5 w-5`})}),(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(f.CardTitle,{className:`text-lg font-bold`,children:e.name}),(0,u.jsxs)(f.Badge,{variant:`outline`,className:`text-[10px] uppercase font-bold py-0 h-4 border-slate-200 bg-white/50 dark:bg-black/20`,children:[`Prio: `,e.priority_order]})]}),(0,u.jsxs)(f.CardDescription,{className:`text-xs`,children:[e.shipping_zone_locations?.length||0,` regions covered`]})]})]}),(0,u.jsxs)(`div`,{className:`flex gap-1`,children:[(0,u.jsx)(a.ZoneForm,{mode:`edit`,initialData:{id:e.id,name:e.name,priority_order:e.priority_order,locations:e.shipping_zone_locations?.map(e=>({country_code:e.country_code,state_code:e.state_code}))||[]}}),(0,u.jsx)(`form`,{action:async()=>{"use server";await i.deleteShippingZone(e.id)},children:(0,u.jsx)(f.Button,{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:(0,u.jsx)(c.Trash2,{className:`h-4 w-4`})})})]})]})}),(0,u.jsx)(f.CardContent,{className:`p-0`,children:(0,u.jsxs)(`div`,{className:`grid md:grid-cols-2 divide-y md:divide-y-0 md:divide-x divide-slate-100 dark:divide-slate-800`,children:[(0,u.jsxs)(`div`,{className:`p-6`,children:[(0,u.jsxs)(`h4`,{className:`text-[10px] font-bold uppercase tracking-widest text-slate-500 mb-4 flex items-center gap-1.5`,children:[(0,u.jsx)(c.Globe,{className:`h-3 w-3`}),` Target Regions`]}),(0,u.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.shipping_zone_locations?.length>0?e.shipping_zone_locations.map(e=>(0,u.jsxs)(f.Badge,{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:[e.country_code,e.state_code?(0,u.jsxs)(`span`,{className:`text-slate-400 ml-1`,children:[`(`,n.resolveSubdivisionName(e.country_code,e.state_code),`)`]}):``]},e.id)):(0,u.jsx)(`p`,{className:`text-sm text-slate-400 italic`,children:`No specific locations assigned.`})})]}),(0,u.jsxs)(`div`,{className:`p-6`,children:[(0,u.jsxs)(`div`,{className:`flex justify-between items-center mb-4`,children:[(0,u.jsxs)(`h4`,{className:`text-[10px] font-bold uppercase tracking-widest text-slate-500 flex items-center gap-1.5`,children:[(0,u.jsx)(c.Truck,{className:`h-3 w-3`}),` Shipping Methods`]}),(0,u.jsx)(o.RateForm,{zoneId:e.id,zoneName:e.name,languages:h||[],currencies:v,defaultCurrencyCode:_})]}),(0,u.jsx)(`div`,{className:`space-y-2`,children:e.shipping_zone_methods?.length>0?e.shipping_zone_methods.map(t=>(0,u.jsxs)(`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:[(0,u.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(`p`,{className:`text-sm font-semibold text-slate-900 dark:text-slate-100 truncate`,children:t.name}),(0,u.jsx)(f.Badge,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:t.currency_pricing_mode===`manual`?`Manual FX`:`Auto FX`}),(t.min_order_amount||0)>0&&(0,u.jsxs)(f.Tooltip,{children:[(0,u.jsx)(f.TooltipTrigger,{asChild:!0,children:(0,u.jsxs)(f.Badge,{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:[(0,u.jsx)(c.Info,{className:`h-2 w-2 mr-0.5`}),(0,l.formatPrice)(t.min_order_amount,t.cost_currency?.toUpperCase()||_)]})}),(0,u.jsxs)(f.TooltipContent,{children:[`Available for orders over `,(0,l.formatPrice)(t.min_order_amount,t.cost_currency?.toUpperCase()||_)]})]})]}),(0,u.jsx)(`p`,{className:`text-[10px] text-slate-500 uppercase tracking-tighter mix-blend-multiply dark:mix-blend-normal`,children:t.method_type.replace(`_`,` `)})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,u.jsx)(`p`,{className:`text-sm font-black text-primary px-2`,children:t.method_type===`free_shipping`?`FREE`:(0,l.formatPrice)(t.cost_amount,t.cost_currency?.toUpperCase()||_)}),(0,u.jsxs)(`div`,{className:`flex opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,u.jsx)(o.RateForm,{zoneId:e.id,zoneName:e.name,languages:h||[],currencies:v,defaultCurrencyCode:_,mode:`edit`,initialData:t}),(0,u.jsx)(`form`,{action:async()=>{"use server";await i.deleteShippingRate(t.id)},children:(0,u.jsx)(f.Button,{type:`submit`,variant:`ghost`,size:`icon`,className:`h-7 w-7 text-slate-400 hover:text-red-500`,children:(0,u.jsx)(c.Trash2,{className:`h-3 w-3`})})})]})]})]},t.id)):(0,u.jsx)(`p`,{className:`text-xs text-slate-400 italic`,children:`No methods defined for this zone.`})})]})]})})]},e.id))})]})})}exports.ShippingPage=p;
@@ -1,211 +1,289 @@
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";
1
+ import { normalizeCurrencyRecord as e } from "../../../currency.es.js";
2
+ import { resolveSubdivisionName as t } from "../../../states.es.js";
3
+ import { getEcommerceInventorySettings as n } from "../../../inventory-settings.es.js";
4
+ import { deleteShippingRate as r, deleteShippingZone as i, updateInventoryTrackingAction as a } from "./server-actions.es.js";
5
+ import { ZoneForm as o } from "./components/ZoneForm.es.js";
6
+ import { RateForm as s } from "./components/RateForm.es.js";
7
+ import "react";
8
+ import { Boxes as c, Globe as l, Info as u, Trash2 as d, Truck as f } from "lucide-react";
11
9
  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
- ] }) });
10
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
11
+ import { getServiceRoleSupabaseClient as g } from "@nextblock-cms/db/server";
12
+ import { Badge as _, Button as v, Card as y, CardContent as b, CardDescription as x, CardHeader as S, CardTitle as C, Tooltip as w, TooltipContent as T, TooltipProvider as E, TooltipTrigger as D } from "@nextblock-cms/ui";
13
+ //#region libs/ecommerce/src/lib/pages/cms/shipping/ShippingPage.tsx
14
+ async function O({ searchParams: O }) {
15
+ let k = g(), [{ data: A }, j, { data: M }, { data: N }] = await Promise.all([
16
+ k.from("shipping_zones").select("\n *,\n shipping_zone_locations (*),\n shipping_zone_methods (*)\n ").order("priority_order", { ascending: !0 }),
17
+ n(k),
18
+ k.from("languages").select("code, name, is_default").eq("is_active", !0).order("name", { ascending: !0 }),
19
+ k.from("currencies").select("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").eq("is_active", !0).order("is_default", { ascending: !1 }).order("code", { ascending: !0 })
20
+ ]), P = N?.find((e) => e.is_default)?.code || N?.[0]?.code || "USD", F = (N || []).map((t) => e(t));
21
+ return /* @__PURE__ */ m(E, { children: /* @__PURE__ */ h("div", {
22
+ className: "space-y-6",
23
+ children: [
24
+ O?.success ? /* @__PURE__ */ m("div", {
25
+ className: "rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700",
26
+ children: O.success
27
+ }) : null,
28
+ /* @__PURE__ */ m(y, {
29
+ className: "overflow-hidden border-slate-200 dark:border-slate-800 shadow-sm",
30
+ children: /* @__PURE__ */ m(b, {
31
+ className: "p-4 sm:p-5",
32
+ children: /* @__PURE__ */ h("form", {
33
+ action: a,
34
+ className: "space-y-3",
35
+ children: [/* @__PURE__ */ h("div", {
36
+ className: "flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",
37
+ children: [/* @__PURE__ */ h("div", {
38
+ className: "flex items-start gap-3 min-w-0",
39
+ children: [/* @__PURE__ */ m("div", {
40
+ className: "p-2 bg-primary/10 rounded-lg text-primary shadow-inner shrink-0",
41
+ children: /* @__PURE__ */ m(c, { className: "h-4 w-4" })
42
+ }), /* @__PURE__ */ h("div", {
43
+ className: "min-w-0",
44
+ children: [/* @__PURE__ */ m(C, {
45
+ className: "text-base font-semibold leading-none",
46
+ children: "Inventory Tracking"
47
+ }), /* @__PURE__ */ m(x, {
48
+ className: "mt-1 text-sm",
49
+ children: "Control whether checkout enforces stock counts and paid orders deduct inventory."
50
+ })]
51
+ })]
52
+ }), /* @__PURE__ */ m("div", {
53
+ className: "flex justify-end lg:justify-start shrink-0",
54
+ children: /* @__PURE__ */ m(v, {
55
+ type: "submit",
56
+ size: "sm",
57
+ className: "w-full sm:w-auto",
58
+ children: "Save Inventory Settings"
59
+ })
60
+ })]
61
+ }), /* @__PURE__ */ h("div", {
62
+ className: "rounded-lg border bg-muted/20 px-4 py-3",
63
+ children: [/* @__PURE__ */ m("input", {
64
+ type: "hidden",
65
+ name: "trackQuantities",
66
+ value: "false"
67
+ }), /* @__PURE__ */ h("label", {
68
+ htmlFor: "track-quantities",
69
+ className: "flex cursor-pointer items-start gap-3",
70
+ children: [/* @__PURE__ */ m("input", {
71
+ id: "track-quantities",
72
+ name: "trackQuantities",
73
+ type: "checkbox",
74
+ value: "true",
75
+ defaultChecked: j.trackQuantities,
76
+ className: "mt-0.5 h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary"
77
+ }), /* @__PURE__ */ h("span", {
78
+ className: "space-y-0.5",
79
+ children: [/* @__PURE__ */ m("span", {
80
+ className: "block text-sm font-medium text-slate-900 dark:text-slate-100",
81
+ children: "Track product quantities"
82
+ }), /* @__PURE__ */ m("span", {
83
+ className: "block text-sm text-muted-foreground",
84
+ children: "Prevent overselling by checking stock during checkout and decrementing quantities after payment is confirmed."
85
+ })]
86
+ })]
87
+ })]
88
+ })]
89
+ })
90
+ })
91
+ }),
92
+ /* @__PURE__ */ h("div", {
93
+ className: "flex justify-between items-center",
94
+ children: [/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h2", {
95
+ className: "text-2xl font-bold tracking-tight text-slate-900 dark:text-slate-100",
96
+ children: "Shipping Zones"
97
+ }), /* @__PURE__ */ m("p", {
98
+ className: "text-slate-500 dark:text-slate-400 text-sm",
99
+ children: "Manage geographical delivery areas and their associated shipping rates."
100
+ })] }), /* @__PURE__ */ m(o, {})]
101
+ }),
102
+ /* @__PURE__ */ m("div", {
103
+ className: "grid gap-6",
104
+ children: !A || A.length === 0 ? /* @__PURE__ */ m(y, {
105
+ className: "bg-slate-50/50 dark:bg-slate-900/10 border-dashed",
106
+ children: /* @__PURE__ */ h(b, {
107
+ className: "flex flex-col items-center justify-center py-12",
108
+ children: [
109
+ /* @__PURE__ */ m(f, { className: "h-12 w-12 text-slate-300 dark:text-slate-700 mb-4" }),
110
+ /* @__PURE__ */ m("p", {
111
+ className: "text-slate-600 dark:text-slate-400 font-medium",
112
+ children: "No shipping zones defined yet."
113
+ }),
114
+ /* @__PURE__ */ m("p", {
115
+ className: "text-xs text-slate-500 mb-6 text-center max-w-xs",
116
+ children: "Create a zone to start defining shipping rates for specific regions (e.g., North America, Europe)."
117
+ })
118
+ ]
119
+ })
120
+ }) : A.map((e) => /* @__PURE__ */ h(y, {
121
+ className: "overflow-hidden border-slate-200 dark:border-slate-800 shadow-sm hover:shadow-md transition-shadow",
122
+ children: [/* @__PURE__ */ m(S, {
123
+ className: "bg-slate-50/50 dark:bg-slate-900/50 border-b dark:border-slate-800 py-4",
124
+ children: /* @__PURE__ */ h("div", {
125
+ className: "flex justify-between items-start md:items-center",
126
+ children: [/* @__PURE__ */ h("div", {
127
+ className: "flex items-center gap-3",
128
+ children: [/* @__PURE__ */ m("div", {
129
+ className: "p-2 bg-primary/10 rounded-lg text-primary shadow-inner",
130
+ children: /* @__PURE__ */ m(l, { className: "h-5 w-5" })
131
+ }), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ h("div", {
132
+ className: "flex items-center gap-2",
133
+ children: [/* @__PURE__ */ m(C, {
134
+ className: "text-lg font-bold",
135
+ children: e.name
136
+ }), /* @__PURE__ */ h(_, {
137
+ variant: "outline",
138
+ className: "text-[10px] uppercase font-bold py-0 h-4 border-slate-200 bg-white/50 dark:bg-black/20",
139
+ children: ["Prio: ", e.priority_order]
140
+ })]
141
+ }), /* @__PURE__ */ h(x, {
142
+ className: "text-xs",
143
+ children: [e.shipping_zone_locations?.length || 0, " regions covered"]
144
+ })] })]
145
+ }), /* @__PURE__ */ h("div", {
146
+ className: "flex gap-1",
147
+ children: [/* @__PURE__ */ m(o, {
148
+ mode: "edit",
149
+ initialData: {
150
+ id: e.id,
151
+ name: e.name,
152
+ priority_order: e.priority_order,
153
+ locations: e.shipping_zone_locations?.map((e) => ({
154
+ country_code: e.country_code,
155
+ state_code: e.state_code
156
+ })) || []
157
+ }
158
+ }), /* @__PURE__ */ m("form", {
159
+ action: async () => {
160
+ "use server";
161
+ await i(e.id);
162
+ },
163
+ children: /* @__PURE__ */ m(v, {
164
+ type: "submit",
165
+ variant: "ghost",
166
+ size: "icon",
167
+ className: "h-8 w-8 text-slate-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20",
168
+ children: /* @__PURE__ */ m(d, { className: "h-4 w-4" })
169
+ })
170
+ })]
171
+ })]
172
+ })
173
+ }), /* @__PURE__ */ m(b, {
174
+ className: "p-0",
175
+ children: /* @__PURE__ */ h("div", {
176
+ className: "grid md:grid-cols-2 divide-y md:divide-y-0 md:divide-x divide-slate-100 dark:divide-slate-800",
177
+ children: [/* @__PURE__ */ h("div", {
178
+ className: "p-6",
179
+ children: [/* @__PURE__ */ h("h4", {
180
+ className: "text-[10px] font-bold uppercase tracking-widest text-slate-500 mb-4 flex items-center gap-1.5",
181
+ children: [/* @__PURE__ */ m(l, { className: "h-3 w-3" }), " Target Regions"]
182
+ }), /* @__PURE__ */ m("div", {
183
+ className: "flex flex-wrap gap-1.5",
184
+ children: e.shipping_zone_locations?.length > 0 ? e.shipping_zone_locations.map((e) => /* @__PURE__ */ h(_, {
185
+ variant: "secondary",
186
+ 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",
187
+ children: [e.country_code, e.state_code ? /* @__PURE__ */ h("span", {
188
+ className: "text-slate-400 ml-1",
189
+ children: [
190
+ "(",
191
+ t(e.country_code, e.state_code),
192
+ ")"
193
+ ]
194
+ }) : ""]
195
+ }, e.id)) : /* @__PURE__ */ m("p", {
196
+ className: "text-sm text-slate-400 italic",
197
+ children: "No specific locations assigned."
198
+ })
199
+ })]
200
+ }), /* @__PURE__ */ h("div", {
201
+ className: "p-6",
202
+ children: [/* @__PURE__ */ h("div", {
203
+ className: "flex justify-between items-center mb-4",
204
+ children: [/* @__PURE__ */ h("h4", {
205
+ className: "text-[10px] font-bold uppercase tracking-widest text-slate-500 flex items-center gap-1.5",
206
+ children: [/* @__PURE__ */ m(f, { className: "h-3 w-3" }), " Shipping Methods"]
207
+ }), /* @__PURE__ */ m(s, {
208
+ zoneId: e.id,
209
+ zoneName: e.name,
210
+ languages: M || [],
211
+ currencies: F,
212
+ defaultCurrencyCode: P
213
+ })]
214
+ }), /* @__PURE__ */ m("div", {
215
+ className: "space-y-2",
216
+ children: e.shipping_zone_methods?.length > 0 ? e.shipping_zone_methods.map((t) => /* @__PURE__ */ h("div", {
217
+ 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",
218
+ children: [/* @__PURE__ */ h("div", {
219
+ className: "flex-1 min-w-0",
220
+ children: [/* @__PURE__ */ h("div", {
221
+ className: "flex items-center gap-2",
222
+ children: [
223
+ /* @__PURE__ */ m("p", {
224
+ className: "text-sm font-semibold text-slate-900 dark:text-slate-100 truncate",
225
+ children: t.name
226
+ }),
227
+ /* @__PURE__ */ m(_, {
228
+ variant: "outline",
229
+ className: "h-4 px-1 text-[9px]",
230
+ children: t.currency_pricing_mode === "manual" ? "Manual FX" : "Auto FX"
231
+ }),
232
+ (t.min_order_amount || 0) > 0 && /* @__PURE__ */ h(w, { children: [/* @__PURE__ */ m(D, {
233
+ asChild: !0,
234
+ children: /* @__PURE__ */ h(_, {
235
+ variant: "outline",
236
+ 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",
237
+ children: [/* @__PURE__ */ m(u, { className: "h-2 w-2 mr-0.5" }), p(t.min_order_amount, t.cost_currency?.toUpperCase() || P)]
238
+ })
239
+ }), /* @__PURE__ */ h(T, { children: ["Available for orders over ", p(t.min_order_amount, t.cost_currency?.toUpperCase() || P)] })] })
240
+ ]
241
+ }), /* @__PURE__ */ m("p", {
242
+ className: "text-[10px] text-slate-500 uppercase tracking-tighter mix-blend-multiply dark:mix-blend-normal",
243
+ children: t.method_type.replace("_", " ")
244
+ })]
245
+ }), /* @__PURE__ */ h("div", {
246
+ className: "flex items-center gap-1",
247
+ children: [/* @__PURE__ */ m("p", {
248
+ className: "text-sm font-black text-primary px-2",
249
+ children: t.method_type === "free_shipping" ? "FREE" : p(t.cost_amount, t.cost_currency?.toUpperCase() || P)
250
+ }), /* @__PURE__ */ h("div", {
251
+ className: "flex opacity-0 group-hover:opacity-100 transition-opacity",
252
+ children: [/* @__PURE__ */ m(s, {
253
+ zoneId: e.id,
254
+ zoneName: e.name,
255
+ languages: M || [],
256
+ currencies: F,
257
+ defaultCurrencyCode: P,
258
+ mode: "edit",
259
+ initialData: t
260
+ }), /* @__PURE__ */ m("form", {
261
+ action: async () => {
262
+ "use server";
263
+ await r(t.id);
264
+ },
265
+ children: /* @__PURE__ */ m(v, {
266
+ type: "submit",
267
+ variant: "ghost",
268
+ size: "icon",
269
+ className: "h-7 w-7 text-slate-400 hover:text-red-500",
270
+ children: /* @__PURE__ */ m(d, { className: "h-3 w-3" })
271
+ })
272
+ })]
273
+ })]
274
+ })]
275
+ }, t.id)) : /* @__PURE__ */ m("p", {
276
+ className: "text-xs text-slate-400 italic",
277
+ children: "No methods defined for this zone."
278
+ })
279
+ })]
280
+ })]
281
+ })
282
+ })]
283
+ }, e.id))
284
+ })
285
+ ]
286
+ }) });
208
287
  }
209
- export {
210
- O as ShippingPage
211
- };
288
+ //#endregion
289
+ export { O as ShippingPage };