@nextblock-cms/ecom 0.20.3 → 0.21.1

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 (446) hide show
  1. package/README.md +43 -0
  2. package/_virtual/_rolldown/runtime.cjs +1 -0
  3. package/index.cjs +1 -0
  4. package/index.es.js +38 -146
  5. package/lib/CurrencyProvider.cjs +1 -0
  6. package/lib/CurrencyProvider.d.ts +1 -1
  7. package/lib/CurrencyProvider.es.js +85 -95
  8. package/lib/PaymentReadinessProvider.cjs +1 -0
  9. package/lib/PaymentReadinessProvider.d.ts +1 -1
  10. package/lib/PaymentReadinessProvider.es.js +24 -27
  11. package/lib/cart-store.cjs +1 -0
  12. package/lib/cart-store.es.js +109 -121
  13. package/lib/components/AccountNavigationMenu.cjs +1 -0
  14. package/lib/components/AccountNavigationMenu.d.ts +1 -1
  15. package/lib/components/AccountNavigationMenu.es.js +36 -50
  16. package/lib/components/AddToCartButton.cjs +1 -0
  17. package/lib/components/AddToCartButton.d.ts +1 -1
  18. package/lib/components/AddToCartButton.es.js +94 -89
  19. package/lib/components/Cart.cjs +1 -0
  20. package/lib/components/Cart.d.ts +1 -1
  21. package/lib/components/Cart.es.js +261 -180
  22. package/lib/components/CartDrawer.cjs +1 -0
  23. package/lib/components/CartDrawer.d.ts +1 -1
  24. package/lib/components/CartDrawer.es.js +218 -148
  25. package/lib/components/CartIcon.cjs +1 -0
  26. package/lib/components/CartIcon.d.ts +1 -1
  27. package/lib/components/CartIcon.es.js +33 -35
  28. package/lib/components/Checkout.cjs +1 -0
  29. package/lib/components/Checkout.d.ts +1 -1
  30. package/lib/components/Checkout.es.js +1092 -1108
  31. package/lib/components/CouponForm.cjs +1 -0
  32. package/lib/components/CouponForm.d.ts +1 -1
  33. package/lib/components/CouponForm.es.js +136 -148
  34. package/lib/components/CurrencySwitcher.cjs +1 -0
  35. package/lib/components/CurrencySwitcher.d.ts +1 -1
  36. package/lib/components/CurrencySwitcher.es.js +22 -18
  37. package/lib/components/CustomerProfileForm.cjs +1 -0
  38. package/lib/components/CustomerProfileForm.es.js +454 -313
  39. package/lib/components/FeaturedProduct.cjs +1 -0
  40. package/lib/components/FeaturedProduct.d.ts +1 -1
  41. package/lib/components/FeaturedProduct.es.js +98 -83
  42. package/lib/components/FreemiusLicensePanel.cjs +1 -0
  43. package/lib/components/FreemiusLicensePanel.d.ts +1 -1
  44. package/lib/components/FreemiusLicensePanel.es.js +70 -65
  45. package/lib/components/InvoiceDocument.cjs +1 -0
  46. package/lib/components/InvoiceDocument.es.js +256 -192
  47. package/lib/components/InvoiceViewerShell.cjs +29 -0
  48. package/lib/components/InvoiceViewerShell.d.ts +1 -1
  49. package/lib/components/InvoiceViewerShell.es.js +75 -106
  50. package/lib/components/ProductCard.cjs +1 -0
  51. package/lib/components/ProductCard.d.ts +1 -1
  52. package/lib/components/ProductCard.es.js +186 -171
  53. package/lib/components/ProductDetailsLayout.cjs +1 -0
  54. package/lib/components/ProductDetailsLayout.es.js +405 -404
  55. package/lib/components/ProductGallery.cjs +1 -0
  56. package/lib/components/ProductGallery.d.ts +1 -1
  57. package/lib/components/ProductGallery.es.js +51 -54
  58. package/lib/components/ProductGrid.cjs +1 -0
  59. package/lib/components/ProductGrid.d.ts +1 -1
  60. package/lib/components/ProductGrid.es.js +23 -25
  61. package/lib/components/ShippingEstimator.cjs +1 -0
  62. package/lib/components/ShippingEstimator.d.ts +1 -1
  63. package/lib/components/ShippingEstimator.es.js +158 -153
  64. package/lib/components/ShortDescription.cjs +1 -0
  65. package/lib/components/ShortDescription.es.js +17 -17
  66. package/lib/components/SimpleTiptapRenderer.cjs +1 -0
  67. package/lib/components/SimpleTiptapRenderer.es.js +238 -211
  68. package/lib/components/SubscriptionSelector.cjs +1 -0
  69. package/lib/components/SubscriptionSelector.es.js +159 -154
  70. package/lib/countries.cjs +1 -0
  71. package/lib/countries.es.js +232 -75
  72. package/lib/coupon-server.cjs +1 -0
  73. package/lib/coupon-server.es.js +180 -224
  74. package/lib/coupons.cjs +1 -0
  75. package/lib/coupons.es.js +12 -14
  76. package/lib/currency-constants.cjs +1 -0
  77. package/lib/currency-constants.es.js +4 -4
  78. package/lib/currency-rest-client.cjs +1 -0
  79. package/lib/currency-rest-client.es.js +15 -22
  80. package/lib/currency-store.cjs +1 -0
  81. package/lib/currency-store.es.js +20 -27
  82. package/lib/currency-sync.cjs +1 -0
  83. package/lib/currency-sync.es.js +124 -170
  84. package/lib/currency.cjs +1 -0
  85. package/lib/currency.es.js +242 -310
  86. package/lib/customer-addresses.cjs +1 -0
  87. package/lib/customer-addresses.es.js +80 -109
  88. package/lib/customer-orders.cjs +1 -0
  89. package/lib/customer-orders.es.js +31 -43
  90. package/lib/customer.cjs +1 -0
  91. package/lib/customer.es.js +43 -52
  92. package/lib/export-helpers.cjs +1 -0
  93. package/lib/export-helpers.es.js +53 -52
  94. package/lib/factory.cjs +1 -0
  95. package/lib/factory.es.js +10 -7
  96. package/lib/freemius-coupons.cjs +1 -0
  97. package/lib/freemius-coupons.es.js +245 -262
  98. package/lib/freemius-license-claim.cjs +1 -0
  99. package/lib/freemius-license-claim.es.js +87 -71
  100. package/lib/freemius-license.cjs +1 -0
  101. package/lib/freemius-license.es.js +32 -39
  102. package/lib/freemius-order-sync.cjs +1 -0
  103. package/lib/freemius-order-sync.es.js +226 -290
  104. package/lib/freemius-trial-provision.cjs +1 -0
  105. package/lib/freemius-trial-provision.es.js +136 -130
  106. package/lib/inventory-settings.cjs +1 -0
  107. package/lib/inventory-settings.es.js +69 -77
  108. package/lib/invoice-server.cjs +33 -0
  109. package/lib/invoice-server.es.js +94 -141
  110. package/lib/invoice-ui.cjs +1 -0
  111. package/lib/invoice-ui.es.js +50 -66
  112. package/lib/invoice.cjs +1 -0
  113. package/lib/invoice.es.js +85 -94
  114. package/lib/order-inventory.cjs +61 -0
  115. package/lib/order-inventory.es.js +67 -79
  116. package/lib/order-tax-details.cjs +1 -0
  117. package/lib/order-tax-details.es.js +142 -153
  118. package/lib/pages/cms/coupons/CouponEditorForm.cjs +1 -0
  119. package/lib/pages/cms/coupons/CouponEditorForm.d.ts +1 -1
  120. package/lib/pages/cms/coupons/CouponEditorForm.es.js +227 -185
  121. package/lib/pages/cms/coupons/CouponsPage.cjs +5 -0
  122. package/lib/pages/cms/coupons/CouponsPage.d.ts +1 -1
  123. package/lib/pages/cms/coupons/CouponsPage.es.js +235 -166
  124. package/lib/pages/cms/coupons/CreateCouponDialog.cjs +1 -0
  125. package/lib/pages/cms/coupons/CreateCouponDialog.d.ts +1 -1
  126. package/lib/pages/cms/coupons/CreateCouponDialog.es.js +35 -34
  127. package/lib/pages/cms/coupons/EditCouponPage.cjs +1 -0
  128. package/lib/pages/cms/coupons/EditCouponPage.d.ts +1 -1
  129. package/lib/pages/cms/coupons/EditCouponPage.es.js +47 -47
  130. package/lib/pages/cms/coupons/ProductScopePicker.cjs +1 -0
  131. package/lib/pages/cms/coupons/ProductScopePicker.d.ts +1 -1
  132. package/lib/pages/cms/coupons/ProductScopePicker.es.js +128 -117
  133. package/lib/pages/cms/coupons/actions.cjs +1 -0
  134. package/lib/pages/cms/coupons/actions.es.js +112 -115
  135. package/lib/pages/cms/coupons/index.cjs +1 -0
  136. package/lib/pages/cms/coupons/index.es.js +3 -0
  137. package/lib/pages/cms/coupons/product-options.cjs +1 -0
  138. package/lib/pages/cms/coupons/product-options.es.js +21 -23
  139. package/lib/pages/cms/orders/ExportReportsDialog.cjs +1 -0
  140. package/lib/pages/cms/orders/ExportReportsDialog.es.js +135 -129
  141. package/lib/pages/cms/orders/MarkPaidButton.d.ts +1 -1
  142. package/lib/pages/cms/orders/OrderDetailPage.cjs +1 -0
  143. package/lib/pages/cms/orders/OrderDetailPage.d.ts +1 -1
  144. package/lib/pages/cms/orders/OrderDetailPage.es.js +186 -134
  145. package/lib/pages/cms/orders/OrderPrintButton.cjs +1 -0
  146. package/lib/pages/cms/orders/OrderPrintButton.d.ts +1 -1
  147. package/lib/pages/cms/orders/OrderPrintButton.es.js +15 -21
  148. package/lib/pages/cms/orders/OrderStatusForm.cjs +1 -0
  149. package/lib/pages/cms/orders/OrderStatusForm.d.ts +1 -1
  150. package/lib/pages/cms/orders/OrderStatusForm.es.js +85 -69
  151. package/lib/pages/cms/orders/OrdersPage.cjs +1 -0
  152. package/lib/pages/cms/orders/OrdersPage.d.ts +1 -1
  153. package/lib/pages/cms/orders/OrdersPage.es.js +170 -102
  154. package/lib/pages/cms/orders/actions.cjs +7 -0
  155. package/lib/pages/cms/orders/actions.es.js +53 -69
  156. package/lib/pages/cms/orders/export-actions.cjs +1 -0
  157. package/lib/pages/cms/orders/export-actions.es.js +23 -26
  158. package/lib/pages/cms/orders/index.cjs +1 -0
  159. package/lib/pages/cms/orders/index.es.js +6 -0
  160. package/lib/pages/cms/orders/server-actions.cjs +1 -0
  161. package/lib/pages/cms/orders/server-actions.es.js +60 -51
  162. package/lib/pages/cms/payments/PaymentsClient.cjs +1 -0
  163. package/lib/pages/cms/payments/PaymentsClient.d.ts +1 -1
  164. package/lib/pages/cms/payments/PaymentsClient.es.js +316 -346
  165. package/lib/pages/cms/payments/PaymentsPage.cjs +1 -0
  166. package/lib/pages/cms/payments/PaymentsPage.d.ts +1 -1
  167. package/lib/pages/cms/payments/PaymentsPage.es.js +29 -32
  168. package/lib/pages/cms/payments/actions.cjs +1 -0
  169. package/lib/pages/cms/payments/actions.es.js +38 -48
  170. package/lib/pages/cms/payments/index.cjs +1 -0
  171. package/lib/pages/cms/payments/index.es.js +3 -0
  172. package/lib/pages/cms/payments/queries.cjs +1 -0
  173. package/lib/pages/cms/payments/queries.es.js +38 -48
  174. package/lib/pages/cms/products/ProductsPage.cjs +1 -0
  175. package/lib/pages/cms/products/ProductsPage.d.ts +1 -1
  176. package/lib/pages/cms/products/ProductsPage.es.js +63 -66
  177. package/lib/pages/cms/products/[id]/edit/EditProductPage.cjs +1 -0
  178. package/lib/pages/cms/products/[id]/edit/EditProductPage.d.ts +1 -1
  179. package/lib/pages/cms/products/[id]/edit/EditProductPage.es.js +139 -0
  180. package/lib/pages/cms/products/actions.cjs +44 -0
  181. package/lib/pages/cms/products/actions.es.js +121 -162
  182. package/lib/pages/cms/products/attributes/AttributeManagementPage.cjs +1 -0
  183. package/lib/pages/cms/products/attributes/AttributeManagementPage.d.ts +1 -1
  184. package/lib/pages/cms/products/attributes/AttributeManagementPage.es.js +55 -47
  185. package/lib/pages/cms/products/attributes/components/AttributeManager.cjs +1 -0
  186. package/lib/pages/cms/products/attributes/components/AttributeManager.d.ts +1 -1
  187. package/lib/pages/cms/products/attributes/components/AttributeManager.es.js +285 -290
  188. package/lib/pages/cms/products/categories/CategoryManagementPage.cjs +1 -0
  189. package/lib/pages/cms/products/categories/CategoryManagementPage.d.ts +1 -1
  190. package/lib/pages/cms/products/categories/CategoryManagementPage.es.js +43 -35
  191. package/lib/pages/cms/products/categories/components/CategoryManager.cjs +1 -0
  192. package/lib/pages/cms/products/categories/components/CategoryManager.es.js +315 -262
  193. package/lib/pages/cms/products/components/CopyProductFromLanguage.cjs +1 -0
  194. package/lib/pages/cms/products/components/CopyProductFromLanguage.es.js +115 -113
  195. package/lib/pages/cms/products/components/CurrencyPriceFields.cjs +1 -0
  196. package/lib/pages/cms/products/components/CurrencyPriceFields.d.ts +1 -1
  197. package/lib/pages/cms/products/components/CurrencyPriceFields.es.js +136 -145
  198. package/lib/pages/cms/products/components/DeleteProductButton.cjs +1 -0
  199. package/lib/pages/cms/products/components/DeleteProductButton.d.ts +1 -1
  200. package/lib/pages/cms/products/components/DeleteProductButton.es.js +35 -47
  201. package/lib/pages/cms/products/components/FreemiusPricingDashboard.cjs +1 -0
  202. package/lib/pages/cms/products/components/FreemiusPricingDashboard.d.ts +1 -1
  203. package/lib/pages/cms/products/components/FreemiusPricingDashboard.es.js +106 -84
  204. package/lib/pages/cms/products/components/ProductCategorySelector.cjs +1 -0
  205. package/lib/pages/cms/products/components/ProductCategorySelector.es.js +156 -159
  206. package/lib/pages/cms/products/components/ProductForm.cjs +1 -0
  207. package/lib/pages/cms/products/components/ProductForm.es.js +872 -693
  208. package/lib/pages/cms/products/components/ProductMediaManager.cjs +1 -0
  209. package/lib/pages/cms/products/components/ProductMediaManager.es.js +106 -103
  210. package/lib/pages/cms/products/components/ProductsBulkTable.cjs +1 -0
  211. package/lib/pages/cms/products/components/ProductsBulkTable.d.ts +1 -1
  212. package/lib/pages/cms/products/components/ProductsBulkTable.es.js +303 -294
  213. package/lib/pages/cms/products/components/SaleScheduleFields.cjs +1 -0
  214. package/lib/pages/cms/products/components/SaleScheduleFields.d.ts +1 -1
  215. package/lib/pages/cms/products/components/SaleScheduleFields.es.js +111 -134
  216. package/lib/pages/cms/products/components/SyncFreemiusButton.cjs +1 -0
  217. package/lib/pages/cms/products/components/SyncFreemiusButton.d.ts +1 -1
  218. package/lib/pages/cms/products/components/SyncFreemiusButton.es.js +29 -35
  219. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.cjs +5 -0
  220. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.d.ts +1 -1
  221. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.es.js +36 -48
  222. package/lib/pages/cms/products/components/SyncProductForm.d.ts +1 -1
  223. package/lib/pages/cms/products/components/VariationsEditor.cjs +1 -0
  224. package/lib/pages/cms/products/components/VariationsEditor.d.ts +1 -1
  225. package/lib/pages/cms/products/components/VariationsEditor.es.js +396 -405
  226. package/lib/pages/cms/products/index.cjs +1 -0
  227. package/lib/pages/cms/products/index.es.js +8 -0
  228. package/lib/pages/cms/products/inventory/InventoryPage.cjs +1 -0
  229. package/lib/pages/cms/products/inventory/InventoryPage.d.ts +1 -1
  230. package/lib/pages/cms/products/inventory/InventoryPage.es.js +21 -15
  231. package/lib/pages/cms/products/inventory/InventoryTableClient.cjs +2 -0
  232. package/lib/pages/cms/products/inventory/InventoryTableClient.d.ts +1 -1
  233. package/lib/pages/cms/products/inventory/InventoryTableClient.es.js +230 -209
  234. package/lib/pages/cms/products/inventory/actions.cjs +3 -0
  235. package/lib/pages/cms/products/inventory/actions.es.js +83 -91
  236. package/lib/pages/cms/products/new/NewProductPage.cjs +1 -0
  237. package/lib/pages/cms/products/new/NewProductPage.d.ts +1 -1
  238. package/lib/pages/cms/products/new/NewProductPage.es.js +58 -74
  239. package/lib/pages/cms/products/product-price-sync.cjs +1 -0
  240. package/lib/pages/cms/products/product-price-sync.es.js +74 -89
  241. package/lib/pages/cms/products/server-actions.cjs +1 -0
  242. package/lib/pages/cms/products/server-actions.es.js +250 -233
  243. package/lib/pages/cms/shipping/ShippingPage.cjs +5 -0
  244. package/lib/pages/cms/shipping/ShippingPage.es.js +287 -209
  245. package/lib/pages/cms/shipping/components/RateForm.cjs +1 -0
  246. package/lib/pages/cms/shipping/components/RateForm.d.ts +1 -1
  247. package/lib/pages/cms/shipping/components/RateForm.es.js +439 -436
  248. package/lib/pages/cms/shipping/components/ZoneForm.cjs +1 -0
  249. package/lib/pages/cms/shipping/components/ZoneForm.es.js +245 -224
  250. package/lib/pages/cms/shipping/index.cjs +1 -0
  251. package/lib/pages/cms/shipping/index.es.js +3 -0
  252. package/lib/pages/cms/shipping/server-actions.cjs +1 -0
  253. package/lib/pages/cms/shipping/server-actions.es.js +131 -149
  254. package/lib/pages/cms/taxes/TaxesPage.cjs +1 -0
  255. package/lib/pages/cms/taxes/TaxesPage.d.ts +1 -1
  256. package/lib/pages/cms/taxes/TaxesPage.es.js +211 -169
  257. package/lib/pages/cms/taxes/actions.cjs +1 -0
  258. package/lib/pages/cms/taxes/actions.es.js +41 -53
  259. package/lib/pages/cms/taxes/components/TaxRateForm.cjs +1 -0
  260. package/lib/pages/cms/taxes/components/TaxRateForm.d.ts +1 -1
  261. package/lib/pages/cms/taxes/components/TaxRateForm.es.js +112 -99
  262. package/lib/pages/cms/taxes/index.cjs +1 -0
  263. package/lib/pages/cms/taxes/index.es.js +3 -0
  264. package/lib/payment-config.cjs +1 -0
  265. package/lib/payment-config.es.js +110 -126
  266. package/lib/product-actions.cjs +238 -0
  267. package/lib/product-actions.es.js +289 -544
  268. package/lib/product-context.cjs +1 -0
  269. package/lib/product-context.es.js +13 -15
  270. package/lib/product-schema.cjs +1 -0
  271. package/lib/product-schema.es.js +99 -134
  272. package/lib/providers/freemius.cjs +1 -0
  273. package/lib/providers/freemius.es.js +446 -530
  274. package/lib/providers/stripe.cjs +1 -0
  275. package/lib/providers/stripe.es.js +417 -477
  276. package/lib/server-actions/coupon-actions.cjs +1 -0
  277. package/lib/server-actions/coupon-actions.es.js +22 -22
  278. package/lib/server-actions/customer-actions.cjs +1 -0
  279. package/lib/server-actions/customer-actions.es.js +26 -28
  280. package/lib/server-actions/product-actions.cjs +1 -0
  281. package/lib/server-actions/product-actions.es.js +9 -15
  282. package/lib/server-actions/shipping-actions.cjs +1 -0
  283. package/lib/server-actions/shipping-actions.es.js +27 -24
  284. package/lib/server-actions/tax-actions.cjs +1 -0
  285. package/lib/server-actions/tax-actions.es.js +33 -39
  286. package/lib/shared-inventory.cjs +15 -0
  287. package/lib/shared-inventory.es.js +111 -160
  288. package/lib/shipping/resolver.cjs +7 -0
  289. package/lib/shipping/resolver.es.js +44 -61
  290. package/lib/shipping-rate-currency.cjs +1 -0
  291. package/lib/shipping-rate-currency.es.js +52 -67
  292. package/lib/states.cjs +1 -0
  293. package/lib/states.es.js +333 -154
  294. package/lib/stripe/checkout.cjs +1 -0
  295. package/lib/stripe/checkout.es.js +125 -181
  296. package/lib/stripe/client.cjs +1 -0
  297. package/lib/stripe/client.es.js +14 -19
  298. package/lib/stripe/order-sync.cjs +1 -0
  299. package/lib/stripe/order-sync.es.js +106 -126
  300. package/lib/stripe/webhooks.cjs +1 -0
  301. package/lib/stripe/webhooks.es.js +37 -31
  302. package/lib/tax-calculation.cjs +1 -0
  303. package/lib/tax-calculation.es.js +84 -98
  304. package/lib/trials.cjs +1 -0
  305. package/lib/trials.es.js +24 -30
  306. package/lib/types.cjs +1 -0
  307. package/lib/types.es.js +21 -27
  308. package/lib/use-cart.cjs +1 -0
  309. package/lib/use-cart.es.js +38 -40
  310. package/lib/use-price-formatter.cjs +1 -0
  311. package/lib/use-price-formatter.es.js +10 -11
  312. package/lib/variation-utils.cjs +1 -0
  313. package/lib/variation-utils.es.js +199 -261
  314. package/lib/zod-config.cjs +1 -0
  315. package/lib/zod-config.es.js +5 -6
  316. package/package.json +22 -21
  317. package/server.cjs +1 -0
  318. package/server.es.js +56 -211
  319. package/index.cjs.js +0 -1
  320. package/lib/CurrencyProvider.cjs.js +0 -1
  321. package/lib/PaymentReadinessProvider.cjs.js +0 -1
  322. package/lib/cart-store.cjs.js +0 -1
  323. package/lib/components/AccountNavigationMenu.cjs.js +0 -1
  324. package/lib/components/AddToCartButton.cjs.js +0 -1
  325. package/lib/components/Cart.cjs.js +0 -1
  326. package/lib/components/CartDrawer.cjs.js +0 -1
  327. package/lib/components/CartIcon.cjs.js +0 -1
  328. package/lib/components/Checkout.cjs.js +0 -1
  329. package/lib/components/CouponForm.cjs.js +0 -1
  330. package/lib/components/CurrencySwitcher.cjs.js +0 -1
  331. package/lib/components/CustomerProfileForm.cjs.js +0 -1
  332. package/lib/components/FeaturedProduct.cjs.js +0 -1
  333. package/lib/components/FreemiusLicensePanel.cjs.js +0 -1
  334. package/lib/components/InvoiceDocument.cjs.js +0 -1
  335. package/lib/components/InvoiceViewerShell.cjs.js +0 -29
  336. package/lib/components/ProductCard.cjs.js +0 -1
  337. package/lib/components/ProductDetailsLayout.cjs.js +0 -1
  338. package/lib/components/ProductGallery.cjs.js +0 -1
  339. package/lib/components/ProductGrid.cjs.js +0 -1
  340. package/lib/components/ShippingEstimator.cjs.js +0 -1
  341. package/lib/components/ShortDescription.cjs.js +0 -1
  342. package/lib/components/SimpleTiptapRenderer.cjs.js +0 -1
  343. package/lib/components/SubscriptionSelector.cjs.js +0 -1
  344. package/lib/countries.cjs.js +0 -1
  345. package/lib/coupon-server.cjs.js +0 -1
  346. package/lib/coupons.cjs.js +0 -1
  347. package/lib/currency-constants.cjs.js +0 -1
  348. package/lib/currency-rest-client.cjs.js +0 -1
  349. package/lib/currency-store.cjs.js +0 -1
  350. package/lib/currency-sync.cjs.js +0 -1
  351. package/lib/currency.cjs.js +0 -1
  352. package/lib/customer-addresses.cjs.js +0 -1
  353. package/lib/customer-orders.cjs.js +0 -1
  354. package/lib/customer.cjs.js +0 -1
  355. package/lib/export-helpers.cjs.js +0 -1
  356. package/lib/factory.cjs.js +0 -1
  357. package/lib/freemius-coupons.cjs.js +0 -1
  358. package/lib/freemius-license-claim.cjs.js +0 -1
  359. package/lib/freemius-license.cjs.js +0 -1
  360. package/lib/freemius-order-sync.cjs.js +0 -1
  361. package/lib/freemius-trial-provision.cjs.js +0 -1
  362. package/lib/inventory-settings.cjs.js +0 -1
  363. package/lib/invoice-server.cjs.js +0 -33
  364. package/lib/invoice-ui.cjs.js +0 -1
  365. package/lib/invoice.cjs.js +0 -1
  366. package/lib/order-inventory.cjs.js +0 -61
  367. package/lib/order-tax-details.cjs.js +0 -1
  368. package/lib/pages/cms/coupons/CouponEditorForm.cjs.js +0 -1
  369. package/lib/pages/cms/coupons/CouponsPage.cjs.js +0 -5
  370. package/lib/pages/cms/coupons/CreateCouponDialog.cjs.js +0 -1
  371. package/lib/pages/cms/coupons/EditCouponPage.cjs.js +0 -1
  372. package/lib/pages/cms/coupons/ProductScopePicker.cjs.js +0 -1
  373. package/lib/pages/cms/coupons/actions.cjs.js +0 -1
  374. package/lib/pages/cms/coupons/product-options.cjs.js +0 -1
  375. package/lib/pages/cms/orders/ExportReportsDialog.cjs.js +0 -1
  376. package/lib/pages/cms/orders/OrderDetailPage.cjs.js +0 -1
  377. package/lib/pages/cms/orders/OrderPrintButton.cjs.js +0 -1
  378. package/lib/pages/cms/orders/OrderStatusForm.cjs.js +0 -1
  379. package/lib/pages/cms/orders/OrdersPage.cjs.js +0 -1
  380. package/lib/pages/cms/orders/actions.cjs.js +0 -7
  381. package/lib/pages/cms/orders/export-actions.cjs.js +0 -1
  382. package/lib/pages/cms/orders/server-actions.cjs.js +0 -1
  383. package/lib/pages/cms/payments/PaymentsClient.cjs.js +0 -1
  384. package/lib/pages/cms/payments/PaymentsPage.cjs.js +0 -1
  385. package/lib/pages/cms/payments/actions.cjs.js +0 -1
  386. package/lib/pages/cms/payments/queries.cjs.js +0 -1
  387. package/lib/pages/cms/products/ProductsPage.cjs.js +0 -1
  388. package/lib/pages/cms/products/_id_/edit/EditProductPage.cjs.js +0 -1
  389. package/lib/pages/cms/products/_id_/edit/EditProductPage.es.js +0 -156
  390. package/lib/pages/cms/products/actions.cjs.js +0 -44
  391. package/lib/pages/cms/products/attributes/AttributeManagementPage.cjs.js +0 -1
  392. package/lib/pages/cms/products/attributes/components/AttributeManager.cjs.js +0 -1
  393. package/lib/pages/cms/products/categories/CategoryManagementPage.cjs.js +0 -1
  394. package/lib/pages/cms/products/categories/components/CategoryManager.cjs.js +0 -1
  395. package/lib/pages/cms/products/components/CopyProductFromLanguage.cjs.js +0 -1
  396. package/lib/pages/cms/products/components/CurrencyPriceFields.cjs.js +0 -1
  397. package/lib/pages/cms/products/components/DeleteProductButton.cjs.js +0 -1
  398. package/lib/pages/cms/products/components/FreemiusPricingDashboard.cjs.js +0 -1
  399. package/lib/pages/cms/products/components/ProductCategorySelector.cjs.js +0 -1
  400. package/lib/pages/cms/products/components/ProductForm.cjs.js +0 -1
  401. package/lib/pages/cms/products/components/ProductMediaManager.cjs.js +0 -1
  402. package/lib/pages/cms/products/components/ProductsBulkTable.cjs.js +0 -1
  403. package/lib/pages/cms/products/components/SaleScheduleFields.cjs.js +0 -1
  404. package/lib/pages/cms/products/components/SyncFreemiusButton.cjs.js +0 -1
  405. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.cjs.js +0 -5
  406. package/lib/pages/cms/products/components/VariationsEditor.cjs.js +0 -1
  407. package/lib/pages/cms/products/inventory/InventoryPage.cjs.js +0 -1
  408. package/lib/pages/cms/products/inventory/InventoryTableClient.cjs.js +0 -2
  409. package/lib/pages/cms/products/inventory/actions.cjs.js +0 -3
  410. package/lib/pages/cms/products/new/NewProductPage.cjs.js +0 -1
  411. package/lib/pages/cms/products/product-price-sync.cjs.js +0 -1
  412. package/lib/pages/cms/products/server-actions.cjs.js +0 -1
  413. package/lib/pages/cms/shipping/ShippingPage.cjs.js +0 -5
  414. package/lib/pages/cms/shipping/components/RateForm.cjs.js +0 -1
  415. package/lib/pages/cms/shipping/components/ZoneForm.cjs.js +0 -1
  416. package/lib/pages/cms/shipping/server-actions.cjs.js +0 -1
  417. package/lib/pages/cms/taxes/TaxesPage.cjs.js +0 -1
  418. package/lib/pages/cms/taxes/actions.cjs.js +0 -1
  419. package/lib/pages/cms/taxes/components/TaxRateForm.cjs.js +0 -1
  420. package/lib/payment-config.cjs.js +0 -1
  421. package/lib/product-actions.cjs.js +0 -238
  422. package/lib/product-context.cjs.js +0 -1
  423. package/lib/product-schema.cjs.js +0 -1
  424. package/lib/providers/freemius.cjs.js +0 -5
  425. package/lib/providers/stripe.cjs.js +0 -1
  426. package/lib/server-actions/coupon-actions.cjs.js +0 -1
  427. package/lib/server-actions/customer-actions.cjs.js +0 -1
  428. package/lib/server-actions/product-actions.cjs.js +0 -1
  429. package/lib/server-actions/shipping-actions.cjs.js +0 -1
  430. package/lib/server-actions/tax-actions.cjs.js +0 -1
  431. package/lib/shared-inventory.cjs.js +0 -15
  432. package/lib/shipping/resolver.cjs.js +0 -7
  433. package/lib/shipping-rate-currency.cjs.js +0 -1
  434. package/lib/states.cjs.js +0 -1
  435. package/lib/stripe/checkout.cjs.js +0 -1
  436. package/lib/stripe/client.cjs.js +0 -1
  437. package/lib/stripe/order-sync.cjs.js +0 -1
  438. package/lib/stripe/webhooks.cjs.js +0 -1
  439. package/lib/tax-calculation.cjs.js +0 -1
  440. package/lib/trials.cjs.js +0 -1
  441. package/lib/types.cjs.js +0 -1
  442. package/lib/use-cart.cjs.js +0 -1
  443. package/lib/use-price-formatter.cjs.js +0 -1
  444. package/lib/variation-utils.cjs.js +0 -1
  445. package/lib/zod-config.cjs.js +0 -1
  446. package/server.cjs.js +0 -1
@@ -1,263 +1,316 @@
1
- 'use client';
2
- import { jsxs as t, jsx as r, Fragment as R } from "react/jsx-runtime";
3
- import { useState as i, useEffect as G } from "react";
4
- import { FolderPlus as J, Loader2 as Q, FolderKanban as V, HelpCircle as W, Edit2 as X, Trash2 as Y } from "lucide-react";
5
- import { toast as l } from "sonner";
6
- import { useRouter as Z } from "next/navigation";
7
- import { Card as j, Label as c, Input as w, Textarea as I, Button as g } from "@nextblock-cms/ui";
8
- function oe({
9
- initialCategories: h = [],
10
- languages: L = [],
11
- createCategory: M,
12
- updateCategory: P,
13
- deleteCategory: _
14
- }) {
15
- const C = Z(), [k, q] = i(h), [d, m] = i(!1), [o, F] = i(null), [u, b] = i(""), [S, p] = i(""), [T, x] = i(""), [z, f] = i({}), [D, N] = i({}), [A, y] = i(!1), E = (L || []).filter((e) => !e.is_default);
16
- G(() => {
17
- q(h);
18
- }, [h]);
19
- const $ = (e) => e.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, ""), U = (e) => {
20
- const a = e.target.value;
21
- b(a), !A && !o && p($(a));
22
- }, B = (e) => {
23
- p($(e.target.value)), y(!0);
24
- }, H = (e) => {
25
- F(e), b(e.name), p(e.slug), x(e.description || ""), f(e.name_translations || {}), N(e.description_translations || {}), y(!0);
26
- }, v = () => {
27
- F(null), b(""), p(""), x(""), f({}), N({}), y(!1);
28
- }, K = async (e) => {
29
- if (e.preventDefault(), !u.trim()) {
30
- l.error("Category name is required.");
31
- return;
32
- }
33
- m(!0);
34
- const a = l.loading(
35
- o ? "Updating category..." : "Creating category..."
36
- );
37
- try {
38
- const s = {
39
- name: u.trim(),
40
- slug: S.trim() || void 0,
41
- description: T.trim() || void 0,
42
- nameTranslations: z,
43
- descriptionTranslations: D
44
- };
45
- let n;
46
- o ? n = await P(o.id, s) : n = await M(s), n.success ? (l.success(
47
- o ? "Category updated successfully!" : "Category created successfully!",
48
- { id: a }
49
- ), v(), C.refresh()) : l.error(n.error || "Failed to save category.", { id: a });
50
- } catch (s) {
51
- l.error(s.message || "An unexpected error occurred.", { id: a });
52
- } finally {
53
- m(!1);
54
- }
55
- }, O = async (e) => {
56
- const a = `Are you sure you want to delete the category "${e.name}"? This will detach it from any assigned products.`;
57
- if (!window.confirm(a))
58
- return;
59
- m(!0);
60
- const s = l.loading("Deleting category...");
61
- try {
62
- const n = await _(e.id);
63
- n.success ? (l.success("Category deleted successfully!", { id: s }), o?.id === e.id && v(), C.refresh()) : l.error(n.error || "Failed to delete category.", { id: s });
64
- } catch (n) {
65
- l.error(n.message || "An unexpected error occurred.", { id: s });
66
- } finally {
67
- m(!1);
68
- }
69
- };
70
- return /* @__PURE__ */ t("div", { className: "grid gap-6 md:grid-cols-12 items-start", children: [
71
- /* @__PURE__ */ r("div", { className: "md:col-span-4 space-y-4", children: /* @__PURE__ */ t(j, { className: "p-5 shadow-lg border-t-4 border-t-amber-500 bg-card/65 backdrop-blur-md transition-all duration-300", children: [
72
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2 mb-4", children: [
73
- /* @__PURE__ */ r(J, { className: "h-5 w-5 text-amber-500" }),
74
- /* @__PURE__ */ r("h2", { className: "text-base font-bold tracking-tight", children: o ? "Edit Category" : "Add New Category" })
75
- ] }),
76
- /* @__PURE__ */ t("form", { onSubmit: K, className: "space-y-4", children: [
77
- /* @__PURE__ */ t("div", { className: "space-y-1", children: [
78
- /* @__PURE__ */ r(c, { htmlFor: "name", className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none", children: "Name" }),
79
- /* @__PURE__ */ r(
80
- w,
81
- {
82
- id: "name",
83
- placeholder: "e.g. T-Shirts",
84
- value: u,
85
- onChange: U,
86
- disabled: d,
87
- className: "h-8 text-sm",
88
- required: !0
89
- }
90
- )
91
- ] }),
92
- /* @__PURE__ */ t("div", { className: "space-y-1", children: [
93
- /* @__PURE__ */ t(c, { htmlFor: "slug", className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none flex items-center justify-between w-full", children: [
94
- /* @__PURE__ */ r("span", { children: "Slug" }),
95
- !A && !o && /* @__PURE__ */ r("span", { className: "text-[10px] text-amber-600 dark:text-amber-400 capitalize", children: "Auto-generating" })
96
- ] }),
97
- /* @__PURE__ */ r(
98
- w,
99
- {
100
- id: "slug",
101
- placeholder: "e.g. t-shirts",
102
- value: S,
103
- onChange: B,
104
- disabled: d,
105
- className: "h-8 text-sm font-mono"
106
- }
107
- )
108
- ] }),
109
- /* @__PURE__ */ t("div", { className: "space-y-1", children: [
110
- /* @__PURE__ */ r(c, { htmlFor: "description", className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none", children: "Description" }),
111
- /* @__PURE__ */ r(
112
- I,
113
- {
114
- id: "description",
115
- placeholder: "Optional description of the category...",
116
- value: T,
117
- onChange: (e) => x(e.target.value),
118
- disabled: d,
119
- className: "text-sm min-h-[90px] resize-none"
120
- }
121
- )
122
- ] }),
123
- E.length > 0 && /* @__PURE__ */ t("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
124
- /* @__PURE__ */ r("h3", { className: "text-xs uppercase font-bold text-muted-foreground tracking-wider", children: "Translations" }),
125
- E.map((e) => /* @__PURE__ */ t("div", { className: "space-y-3 p-3 rounded-md bg-muted/30 border border-border/30", children: [
126
- /* @__PURE__ */ r("span", { className: "text-[11px] font-bold text-amber-600 dark:text-amber-400 uppercase tracking-wider", children: e.name }),
127
- /* @__PURE__ */ t("div", { className: "space-y-1", children: [
128
- /* @__PURE__ */ t(c, { htmlFor: `name-${e.code}`, className: "text-[10px] uppercase font-bold text-muted-foreground tracking-wider leading-none", children: [
129
- "Name (",
130
- e.code,
131
- ")"
132
- ] }),
133
- /* @__PURE__ */ r(
134
- w,
135
- {
136
- id: `name-${e.code}`,
137
- placeholder: `Translation for ${u || "Name"}`,
138
- value: z[e.code] || "",
139
- onChange: (a) => f((s) => ({ ...s, [e.code]: a.target.value })),
140
- disabled: d,
141
- className: "h-8 text-sm"
142
- }
143
- )
144
- ] }),
145
- /* @__PURE__ */ t("div", { className: "space-y-1", children: [
146
- /* @__PURE__ */ t(c, { htmlFor: `desc-${e.code}`, className: "text-[10px] uppercase font-bold text-muted-foreground tracking-wider leading-none", children: [
147
- "Description (",
148
- e.code,
149
- ")"
150
- ] }),
151
- /* @__PURE__ */ r(
152
- I,
153
- {
154
- id: `desc-${e.code}`,
155
- placeholder: "Translation for Description",
156
- value: D[e.code] || "",
157
- onChange: (a) => N((s) => ({ ...s, [e.code]: a.target.value })),
158
- disabled: d,
159
- className: "text-sm min-h-[60px] resize-none"
160
- }
161
- )
162
- ] })
163
- ] }, e.code))
164
- ] }),
165
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2 pt-2", children: [
166
- /* @__PURE__ */ r(
167
- g,
168
- {
169
- type: "submit",
170
- disabled: d,
171
- size: "sm",
172
- className: "flex-1 bg-amber-600 hover:bg-amber-500 text-white font-medium shadow-md shadow-amber-600/10 h-8 text-xs cursor-pointer",
173
- children: d ? /* @__PURE__ */ t(R, { children: [
174
- /* @__PURE__ */ r(Q, { className: "mr-1.5 h-3.5 w-3.5 animate-spin" }),
175
- "Saving..."
176
- ] }) : o ? "Update Category" : "Create Category"
177
- }
178
- ),
179
- o && /* @__PURE__ */ r(
180
- g,
181
- {
182
- type: "button",
183
- onClick: v,
184
- disabled: d,
185
- variant: "outline",
186
- size: "sm",
187
- className: "h-8 text-xs border-dashed cursor-pointer",
188
- children: "Cancel"
189
- }
190
- )
191
- ] })
192
- ] })
193
- ] }) }),
194
- /* @__PURE__ */ r("div", { className: "md:col-span-8", children: /* @__PURE__ */ t(j, { className: "p-4 shadow-lg bg-card/65 backdrop-blur-md border border-border/40", children: [
195
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2 mb-4 pb-2 border-b border-border/50", children: [
196
- /* @__PURE__ */ r(V, { className: "h-5 w-5 text-muted-foreground" }),
197
- /* @__PURE__ */ t("div", { children: [
198
- /* @__PURE__ */ r("h2", { className: "text-base font-bold tracking-tight", children: "Active Categories" }),
199
- /* @__PURE__ */ r("p", { className: "text-[11px] text-muted-foreground leading-none mt-0.5", children: "Categories are shared globally across languages." })
200
- ] })
201
- ] }),
202
- k.length === 0 ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center py-12 px-4 text-center border-2 border-dashed border-border/60 rounded-lg bg-muted/20 animate-in fade-in duration-300", children: [
203
- /* @__PURE__ */ r(W, { className: "h-10 w-10 text-muted-foreground/50 mb-3" }),
204
- /* @__PURE__ */ r("h3", { className: "text-sm font-bold text-muted-foreground", children: "No Categories Found" }),
205
- /* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground/80 max-w-sm mt-1", children: "Add your first category using the form on the left to start organizing your catalog products." })
206
- ] }) : /* @__PURE__ */ r("div", { className: "overflow-x-auto border rounded-lg bg-background/50", children: /* @__PURE__ */ t("table", { className: "w-full text-left border-collapse text-xs", children: [
207
- /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b bg-muted/40 font-bold uppercase tracking-wider text-muted-foreground/85 select-none", children: [
208
- /* @__PURE__ */ r("th", { className: "p-3 pl-4", children: "Name" }),
209
- /* @__PURE__ */ r("th", { className: "p-3", children: "Slug" }),
210
- /* @__PURE__ */ r("th", { className: "p-3 text-center", children: "Products" }),
211
- /* @__PURE__ */ r("th", { className: "p-3 pr-4 text-right", children: "Actions" })
212
- ] }) }),
213
- /* @__PURE__ */ r("tbody", { className: "divide-y divide-border/60", children: k.map((e) => /* @__PURE__ */ t(
214
- "tr",
215
- {
216
- className: "hover:bg-muted/10 transition-colors group",
217
- children: [
218
- /* @__PURE__ */ t("td", { className: "p-3 pl-4", children: [
219
- /* @__PURE__ */ r("div", { className: "font-semibold text-slate-800 dark:text-slate-100", children: e.name }),
220
- e.description && /* @__PURE__ */ r("div", { className: "text-[10px] text-muted-foreground mt-0.5 max-w-xs truncate leading-normal", title: e.description, children: e.description })
221
- ] }),
222
- /* @__PURE__ */ r("td", { className: "p-3", children: /* @__PURE__ */ t("code", { className: "px-1.5 py-0.5 rounded bg-muted/65 font-mono text-[10px]", children: [
223
- "/",
224
- e.slug
225
- ] }) }),
226
- /* @__PURE__ */ r("td", { className: "p-3 text-center", children: /* @__PURE__ */ r("span", { className: "inline-flex items-center justify-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-500/10 text-amber-800 dark:text-amber-300 border border-amber-500/15", children: e.productCount }) }),
227
- /* @__PURE__ */ r("td", { className: "p-3 pr-4 text-right", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-end gap-1.5", children: [
228
- /* @__PURE__ */ r(
229
- g,
230
- {
231
- variant: "outline",
232
- size: "icon",
233
- disabled: d,
234
- onClick: () => H(e),
235
- className: "h-7 w-7 opacity-85 hover:opacity-100 group-hover:border-amber-500/30 cursor-pointer",
236
- title: "Edit Category",
237
- children: /* @__PURE__ */ r(X, { className: "h-3.5 w-3.5 text-muted-foreground group-hover:text-amber-600 dark:group-hover:text-amber-400" })
238
- }
239
- ),
240
- /* @__PURE__ */ r(
241
- g,
242
- {
243
- variant: "outline",
244
- size: "icon",
245
- disabled: d,
246
- onClick: () => O(e),
247
- className: "h-7 w-7 opacity-85 hover:opacity-100 group-hover:border-red-500/30 cursor-pointer",
248
- title: "Delete Category",
249
- children: /* @__PURE__ */ r(Y, { className: "h-3.5 w-3.5 text-muted-foreground group-hover:text-red-500" })
250
- }
251
- )
252
- ] }) })
253
- ]
254
- },
255
- e.id
256
- )) })
257
- ] }) })
258
- ] }) })
259
- ] });
1
+ "use client";
2
+ import { useEffect as e, useState as t } from "react";
3
+ import { Edit2 as n, FolderKanban as r, FolderPlus as i, HelpCircle as a, Loader2 as o, Trash2 as s } from "lucide-react";
4
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
5
+ import { toast as d } from "sonner";
6
+ import { useRouter as f } from "next/navigation";
7
+ import { Button as p, Card as m, Input as h, Label as g, Textarea as _ } from "@nextblock-cms/ui";
8
+ //#region src/lib/pages/cms/products/categories/components/CategoryManager.tsx
9
+ function v({ initialCategories: v = [], languages: y = [], createCategory: b, updateCategory: x, deleteCategory: S }) {
10
+ let C = f(), [w, T] = t(v), [E, D] = t(!1), [O, k] = t(null), [A, j] = t(""), [M, N] = t(""), [P, F] = t(""), [I, L] = t({}), [R, z] = t({}), [B, V] = t(!1), H = (y || []).filter((e) => !e.is_default);
11
+ e(() => {
12
+ T(v);
13
+ }, [v]);
14
+ let U = (e) => e.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, ""), W = (e) => {
15
+ let t = e.target.value;
16
+ j(t), !B && !O && N(U(t));
17
+ }, G = (e) => {
18
+ N(U(e.target.value)), V(!0);
19
+ }, K = (e) => {
20
+ k(e), j(e.name), N(e.slug), F(e.description || ""), L(e.name_translations || {}), z(e.description_translations || {}), V(!0);
21
+ }, q = () => {
22
+ k(null), j(""), N(""), F(""), L({}), z({}), V(!1);
23
+ }, J = async (e) => {
24
+ if (e.preventDefault(), !A.trim()) {
25
+ d.error("Category name is required.");
26
+ return;
27
+ }
28
+ D(!0);
29
+ let t = d.loading(O ? "Updating category..." : "Creating category...");
30
+ try {
31
+ let e = {
32
+ name: A.trim(),
33
+ slug: M.trim() || void 0,
34
+ description: P.trim() || void 0,
35
+ nameTranslations: I,
36
+ descriptionTranslations: R
37
+ }, n;
38
+ n = O ? await x(O.id, e) : await b(e), n.success ? (d.success(O ? "Category updated successfully!" : "Category created successfully!", { id: t }), q(), C.refresh()) : d.error(n.error || "Failed to save category.", { id: t });
39
+ } catch (e) {
40
+ d.error(e.message || "An unexpected error occurred.", { id: t });
41
+ } finally {
42
+ D(!1);
43
+ }
44
+ }, Y = async (e) => {
45
+ let t = `Are you sure you want to delete the category "${e.name}"? This will detach it from any assigned products.`;
46
+ if (!window.confirm(t)) return;
47
+ D(!0);
48
+ let n = d.loading("Deleting category...");
49
+ try {
50
+ let t = await S(e.id);
51
+ t.success ? (d.success("Category deleted successfully!", { id: n }), O?.id === e.id && q(), C.refresh()) : d.error(t.error || "Failed to delete category.", { id: n });
52
+ } catch (e) {
53
+ d.error(e.message || "An unexpected error occurred.", { id: n });
54
+ } finally {
55
+ D(!1);
56
+ }
57
+ };
58
+ return /* @__PURE__ */ u("div", {
59
+ className: "grid gap-6 md:grid-cols-12 items-start",
60
+ children: [/* @__PURE__ */ l("div", {
61
+ className: "md:col-span-4 space-y-4",
62
+ children: /* @__PURE__ */ u(m, {
63
+ className: "p-5 shadow-lg border-t-4 border-t-amber-500 bg-card/65 backdrop-blur-md transition-all duration-300",
64
+ children: [/* @__PURE__ */ u("div", {
65
+ className: "flex items-center gap-2 mb-4",
66
+ children: [/* @__PURE__ */ l(i, { className: "h-5 w-5 text-amber-500" }), /* @__PURE__ */ l("h2", {
67
+ className: "text-base font-bold tracking-tight",
68
+ children: O ? "Edit Category" : "Add New Category"
69
+ })]
70
+ }), /* @__PURE__ */ u("form", {
71
+ onSubmit: J,
72
+ className: "space-y-4",
73
+ children: [
74
+ /* @__PURE__ */ u("div", {
75
+ className: "space-y-1",
76
+ children: [/* @__PURE__ */ l(g, {
77
+ htmlFor: "name",
78
+ className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none",
79
+ children: "Name"
80
+ }), /* @__PURE__ */ l(h, {
81
+ id: "name",
82
+ placeholder: "e.g. T-Shirts",
83
+ value: A,
84
+ onChange: W,
85
+ disabled: E,
86
+ className: "h-8 text-sm",
87
+ required: !0
88
+ })]
89
+ }),
90
+ /* @__PURE__ */ u("div", {
91
+ className: "space-y-1",
92
+ children: [/* @__PURE__ */ u(g, {
93
+ htmlFor: "slug",
94
+ className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none flex items-center justify-between w-full",
95
+ children: [/* @__PURE__ */ l("span", { children: "Slug" }), !B && !O && /* @__PURE__ */ l("span", {
96
+ className: "text-[10px] text-amber-600 dark:text-amber-400 capitalize",
97
+ children: "Auto-generating"
98
+ })]
99
+ }), /* @__PURE__ */ l(h, {
100
+ id: "slug",
101
+ placeholder: "e.g. t-shirts",
102
+ value: M,
103
+ onChange: G,
104
+ disabled: E,
105
+ className: "h-8 text-sm font-mono"
106
+ })]
107
+ }),
108
+ /* @__PURE__ */ u("div", {
109
+ className: "space-y-1",
110
+ children: [/* @__PURE__ */ l(g, {
111
+ htmlFor: "description",
112
+ className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none",
113
+ children: "Description"
114
+ }), /* @__PURE__ */ l(_, {
115
+ id: "description",
116
+ placeholder: "Optional description of the category...",
117
+ value: P,
118
+ onChange: (e) => F(e.target.value),
119
+ disabled: E,
120
+ className: "text-sm min-h-[90px] resize-none"
121
+ })]
122
+ }),
123
+ H.length > 0 && /* @__PURE__ */ u("div", {
124
+ className: "border-t border-border/50 pt-4 mt-4 space-y-4",
125
+ children: [/* @__PURE__ */ l("h3", {
126
+ className: "text-xs uppercase font-bold text-muted-foreground tracking-wider",
127
+ children: "Translations"
128
+ }), H.map((e) => /* @__PURE__ */ u("div", {
129
+ className: "space-y-3 p-3 rounded-md bg-muted/30 border border-border/30",
130
+ children: [
131
+ /* @__PURE__ */ l("span", {
132
+ className: "text-[11px] font-bold text-amber-600 dark:text-amber-400 uppercase tracking-wider",
133
+ children: e.name
134
+ }),
135
+ /* @__PURE__ */ u("div", {
136
+ className: "space-y-1",
137
+ children: [/* @__PURE__ */ u(g, {
138
+ htmlFor: `name-${e.code}`,
139
+ className: "text-[10px] uppercase font-bold text-muted-foreground tracking-wider leading-none",
140
+ children: [
141
+ "Name (",
142
+ e.code,
143
+ ")"
144
+ ]
145
+ }), /* @__PURE__ */ l(h, {
146
+ id: `name-${e.code}`,
147
+ placeholder: `Translation for ${A || "Name"}`,
148
+ value: I[e.code] || "",
149
+ onChange: (t) => L((n) => ({
150
+ ...n,
151
+ [e.code]: t.target.value
152
+ })),
153
+ disabled: E,
154
+ className: "h-8 text-sm"
155
+ })]
156
+ }),
157
+ /* @__PURE__ */ u("div", {
158
+ className: "space-y-1",
159
+ children: [/* @__PURE__ */ u(g, {
160
+ htmlFor: `desc-${e.code}`,
161
+ className: "text-[10px] uppercase font-bold text-muted-foreground tracking-wider leading-none",
162
+ children: [
163
+ "Description (",
164
+ e.code,
165
+ ")"
166
+ ]
167
+ }), /* @__PURE__ */ l(_, {
168
+ id: `desc-${e.code}`,
169
+ placeholder: "Translation for Description",
170
+ value: R[e.code] || "",
171
+ onChange: (t) => z((n) => ({
172
+ ...n,
173
+ [e.code]: t.target.value
174
+ })),
175
+ disabled: E,
176
+ className: "text-sm min-h-[60px] resize-none"
177
+ })]
178
+ })
179
+ ]
180
+ }, e.code))]
181
+ }),
182
+ /* @__PURE__ */ u("div", {
183
+ className: "flex items-center gap-2 pt-2",
184
+ children: [/* @__PURE__ */ l(p, {
185
+ type: "submit",
186
+ disabled: E,
187
+ size: "sm",
188
+ className: "flex-1 bg-amber-600 hover:bg-amber-500 text-white font-medium shadow-md shadow-amber-600/10 h-8 text-xs cursor-pointer",
189
+ children: E ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(o, { className: "mr-1.5 h-3.5 w-3.5 animate-spin" }), "Saving..."] }) : O ? "Update Category" : "Create Category"
190
+ }), O && /* @__PURE__ */ l(p, {
191
+ type: "button",
192
+ onClick: q,
193
+ disabled: E,
194
+ variant: "outline",
195
+ size: "sm",
196
+ className: "h-8 text-xs border-dashed cursor-pointer",
197
+ children: "Cancel"
198
+ })]
199
+ })
200
+ ]
201
+ })]
202
+ })
203
+ }), /* @__PURE__ */ l("div", {
204
+ className: "md:col-span-8",
205
+ children: /* @__PURE__ */ u(m, {
206
+ className: "p-4 shadow-lg bg-card/65 backdrop-blur-md border border-border/40",
207
+ children: [/* @__PURE__ */ u("div", {
208
+ className: "flex items-center gap-2 mb-4 pb-2 border-b border-border/50",
209
+ children: [/* @__PURE__ */ l(r, { className: "h-5 w-5 text-muted-foreground" }), /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("h2", {
210
+ className: "text-base font-bold tracking-tight",
211
+ children: "Active Categories"
212
+ }), /* @__PURE__ */ l("p", {
213
+ className: "text-[11px] text-muted-foreground leading-none mt-0.5",
214
+ children: "Categories are shared globally across languages."
215
+ })] })]
216
+ }), w.length === 0 ? /* @__PURE__ */ u("div", {
217
+ className: "flex flex-col items-center justify-center py-12 px-4 text-center border-2 border-dashed border-border/60 rounded-lg bg-muted/20 animate-in fade-in duration-300",
218
+ children: [
219
+ /* @__PURE__ */ l(a, { className: "h-10 w-10 text-muted-foreground/50 mb-3" }),
220
+ /* @__PURE__ */ l("h3", {
221
+ className: "text-sm font-bold text-muted-foreground",
222
+ children: "No Categories Found"
223
+ }),
224
+ /* @__PURE__ */ l("p", {
225
+ className: "text-xs text-muted-foreground/80 max-w-sm mt-1",
226
+ children: "Add your first category using the form on the left to start organizing your catalog products."
227
+ })
228
+ ]
229
+ }) : /* @__PURE__ */ l("div", {
230
+ className: "overflow-x-auto border rounded-lg bg-background/50",
231
+ children: /* @__PURE__ */ u("table", {
232
+ className: "w-full text-left border-collapse text-xs",
233
+ children: [/* @__PURE__ */ l("thead", { children: /* @__PURE__ */ u("tr", {
234
+ className: "border-b bg-muted/40 font-bold uppercase tracking-wider text-muted-foreground/85 select-none",
235
+ children: [
236
+ /* @__PURE__ */ l("th", {
237
+ className: "p-3 pl-4",
238
+ children: "Name"
239
+ }),
240
+ /* @__PURE__ */ l("th", {
241
+ className: "p-3",
242
+ children: "Slug"
243
+ }),
244
+ /* @__PURE__ */ l("th", {
245
+ className: "p-3 text-center",
246
+ children: "Products"
247
+ }),
248
+ /* @__PURE__ */ l("th", {
249
+ className: "p-3 pr-4 text-right",
250
+ children: "Actions"
251
+ })
252
+ ]
253
+ }) }), /* @__PURE__ */ l("tbody", {
254
+ className: "divide-y divide-border/60",
255
+ children: w.map((e) => /* @__PURE__ */ u("tr", {
256
+ className: "hover:bg-muted/10 transition-colors group",
257
+ children: [
258
+ /* @__PURE__ */ u("td", {
259
+ className: "p-3 pl-4",
260
+ children: [/* @__PURE__ */ l("div", {
261
+ className: "font-semibold text-slate-800 dark:text-slate-100",
262
+ children: e.name
263
+ }), e.description && /* @__PURE__ */ l("div", {
264
+ className: "text-[10px] text-muted-foreground mt-0.5 max-w-xs truncate leading-normal",
265
+ title: e.description,
266
+ children: e.description
267
+ })]
268
+ }),
269
+ /* @__PURE__ */ l("td", {
270
+ className: "p-3",
271
+ children: /* @__PURE__ */ u("code", {
272
+ className: "px-1.5 py-0.5 rounded bg-muted/65 font-mono text-[10px]",
273
+ children: ["/", e.slug]
274
+ })
275
+ }),
276
+ /* @__PURE__ */ l("td", {
277
+ className: "p-3 text-center",
278
+ children: /* @__PURE__ */ l("span", {
279
+ className: "inline-flex items-center justify-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-500/10 text-amber-800 dark:text-amber-300 border border-amber-500/15",
280
+ children: e.productCount
281
+ })
282
+ }),
283
+ /* @__PURE__ */ l("td", {
284
+ className: "p-3 pr-4 text-right",
285
+ children: /* @__PURE__ */ u("div", {
286
+ className: "flex items-center justify-end gap-1.5",
287
+ children: [/* @__PURE__ */ l(p, {
288
+ variant: "outline",
289
+ size: "icon",
290
+ disabled: E,
291
+ onClick: () => K(e),
292
+ className: "h-7 w-7 opacity-85 hover:opacity-100 group-hover:border-amber-500/30 cursor-pointer",
293
+ title: "Edit Category",
294
+ children: /* @__PURE__ */ l(n, { className: "h-3.5 w-3.5 text-muted-foreground group-hover:text-amber-600 dark:group-hover:text-amber-400" })
295
+ }), /* @__PURE__ */ l(p, {
296
+ variant: "outline",
297
+ size: "icon",
298
+ disabled: E,
299
+ onClick: () => Y(e),
300
+ className: "h-7 w-7 opacity-85 hover:opacity-100 group-hover:border-red-500/30 cursor-pointer",
301
+ title: "Delete Category",
302
+ children: /* @__PURE__ */ l(s, { className: "h-3.5 w-3.5 text-muted-foreground group-hover:text-red-500" })
303
+ })]
304
+ })
305
+ })
306
+ ]
307
+ }, e.id))
308
+ })]
309
+ })
310
+ })]
311
+ })
312
+ })]
313
+ });
260
314
  }
261
- export {
262
- oe as CategoryManager
263
- };
315
+ //#endregion
316
+ export { v as CategoryManager };
@@ -0,0 +1 @@
1
+ "use client";const e=require("../../../../../_virtual/_rolldown/runtime.cjs"),t=require("../actions.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("lucide-react"),i=require("react/jsx-runtime"),a=require("next/navigation"),o=require("@nextblock-cms/ui");function s({productId:e,currentLanguageId:s,translationGroupId:c,allSiteLanguages:l}){let[u,d]=(0,n.useState)(!1),[f,p]=(0,n.useState)(null),[m,h]=(0,n.useState)([]),[g,_]=(0,n.useState)(!1),[v,y]=(0,n.useState)(null),[b,x]=(0,n.useTransition)(),S=(0,a.useRouter)();(0,n.useEffect)(()=>{u&&c&&(async()=>{_(!0);try{let n=(await t.getProductTranslations(c)).filter(t=>t.id!==e);h(n)}catch(e){console.error(`Error fetching translations:`,e)}finally{_(!1)}})()},[u,c,e]);let C=async()=>{if(!f){y({type:`error`,text:`Please select a source version to copy from.`});return}y(null),x(async()=>{let n=await t.copyProductFromLanguageAction(e,f);n.success?(y({type:`success`,text:`Content copied successfully. The page will now refresh.`}),setTimeout(()=>{d(!1),S.refresh()},1500)):y({type:`error`,text:n.error||`Failed to copy content.`})})},w=l.find(e=>e.id===s);return(0,i.jsxs)(o.Dialog,{open:u,onOpenChange:d,children:[(0,i.jsx)(o.DialogTrigger,{asChild:!0,children:(0,i.jsxs)(o.Button,{variant:`outline`,title:`Copy content from another language`,children:[(0,i.jsx)(r.Copy,{className:`h-4 w-4 mr-2`}),`Copy Content...`]})}),(0,i.jsxs)(o.DialogContent,{children:[(0,i.jsxs)(o.DialogHeader,{children:[(0,i.jsx)(o.DialogTitle,{children:`Copy Content from Another Language`}),(0,i.jsxs)(o.DialogDescription,{children:[`Select a source version to copy from. This will replace the title, description, and media of the current product (`,w?.name,`). This action cannot be undone.`]})]}),(0,i.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(o.Label,{htmlFor:`sourceProduct`,children:`Select Source Version`}),(0,i.jsxs)(o.Select,{onValueChange:e=>p(e),disabled:b||g,value:f||void 0,children:[(0,i.jsx)(o.SelectTrigger,{id:`sourceProduct`,children:(0,i.jsx)(o.SelectValue,{placeholder:g?`Loading versions...`:`Select a version...`})}),(0,i.jsx)(o.SelectContent,{children:m.length>0?m.map(e=>{let t=l.find(t=>t.id===e.language_id);return(0,i.jsxs)(o.SelectItem,{value:e.id,children:[e.title,` (`,t?.name||`Unknown Language`,`)`]},e.id)}):(0,i.jsx)(o.SelectItem,{value:`none`,disabled:!0,children:`No other versions available`})})]})]}),v&&(0,i.jsxs)(`div`,{className:`p-3 rounded-md text-sm flex items-center gap-2 ${v.type===`success`?`bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400`:`bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400`}`,children:[v.type===`success`?(0,i.jsx)(r.CheckCircle2,{className:`h-5 w-5`}):(0,i.jsx)(r.AlertCircle,{className:`h-5 w-5`}),v.text]})]}),(0,i.jsxs)(o.DialogFooter,{children:[(0,i.jsx)(o.DialogClose,{asChild:!0,children:(0,i.jsx)(o.Button,{variant:`outline`,children:`Cancel`})}),(0,i.jsx)(o.Button,{onClick:C,disabled:b||!f||f===`none`,children:b?`Copying...`:`Copy Content & Replace`})]})]})]})}exports.CopyProductFromLanguage=s;