@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
@@ -0,0 +1 @@
1
+ const e=require("../../../payment-config.cjs"),t=require("./queries.cjs"),n=require("./actions.cjs"),r=require("./PaymentsClient.cjs");let i=require("react/jsx-runtime");async function a(){let[a,o,s]=await Promise.all([t.getEnabledPaymentProviders(),t.getStoreConfigStatus(),e.getPaymentCredentialsView()]);async function c(e){"use server";let t={stripe:e.get(`stripe_enabled`)===`true`&&o.stripe.hasKeys,freemius:e.get(`freemius_enabled`)===`true`&&o.freemius.hasKeys};await n.updatePaymentSettings(t)}return(0,i.jsx)(r.PaymentsClient,{initialEnabledProviders:a,configStatus:o,credentials:s,saveAction:c,saveCredentialsAction:n.savePaymentProviderCredentials})}exports.PaymentsPage=a;
@@ -1 +1 @@
1
- export declare function PaymentsPage(): Promise<import("react").JSX.Element>;
1
+ export declare function PaymentsPage(): Promise<import('react').JSX.Element>;
@@ -1,33 +1,30 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { savePaymentProviderCredentials as o, updatePaymentSettings as m } from "./actions.es.js";
3
- import { getEnabledPaymentProviders as d, getStoreConfigStatus as l } from "./queries.es.js";
4
- import { getPaymentCredentialsView as u } from "../../../payment-config.es.js";
5
- import { PaymentsClient as P } from "./PaymentsClient.es.js";
6
- async function v() {
7
- const [i, e, s] = await Promise.all([
8
- d(),
9
- l(),
10
- u()
11
- ]);
12
- async function n(t) {
13
- "use server";
14
- const r = {
15
- stripe: t.get("stripe_enabled") === "true" && e.stripe.hasKeys,
16
- freemius: t.get("freemius_enabled") === "true" && e.freemius.hasKeys
17
- };
18
- await m(r);
19
- }
20
- return /* @__PURE__ */ a(
21
- P,
22
- {
23
- initialEnabledProviders: i,
24
- configStatus: e,
25
- credentials: s,
26
- saveAction: n,
27
- saveCredentialsAction: o
28
- }
29
- );
1
+ import { getPaymentCredentialsView as e } from "../../../payment-config.es.js";
2
+ import { getEnabledPaymentProviders as t, getStoreConfigStatus as n } from "./queries.es.js";
3
+ import { savePaymentProviderCredentials as r, updatePaymentSettings as i } from "./actions.es.js";
4
+ import { PaymentsClient as a } from "./PaymentsClient.es.js";
5
+ import { jsx as o } from "react/jsx-runtime";
6
+ //#region src/lib/pages/cms/payments/PaymentsPage.tsx
7
+ async function s() {
8
+ let [s, c, l] = await Promise.all([
9
+ t(),
10
+ n(),
11
+ e()
12
+ ]);
13
+ async function u(e) {
14
+ "use server";
15
+ let t = {
16
+ stripe: e.get("stripe_enabled") === "true" && c.stripe.hasKeys,
17
+ freemius: e.get("freemius_enabled") === "true" && c.freemius.hasKeys
18
+ };
19
+ await i(t);
20
+ }
21
+ return /* @__PURE__ */ o(a, {
22
+ initialEnabledProviders: s,
23
+ configStatus: c,
24
+ credentials: l,
25
+ saveAction: u,
26
+ saveCredentialsAction: r
27
+ });
30
28
  }
31
- export {
32
- v as PaymentsPage
33
- };
29
+ //#endregion
30
+ export { s as PaymentsPage };
@@ -0,0 +1 @@
1
+ "use server";const e=require("../../../payment-config.cjs");let t=require("@nextblock-cms/db/server"),n=require("next/cache");async function r(){let e=await(0,t.createClient)(),{data:{user:n}}=await e.auth.getUser();if(!n)throw Error(`Unauthorized`);let{data:r}=await e.from(`profiles`).select(`role`).eq(`id`,n.id).single();if(!r||r.role!==`ADMIN`)throw Error(`Forbidden`)}async function i(t){await r(),await e.savePaymentCredentials({stripe:{publishableKey:String(t.get(`stripe_publishableKey`)??``),secretKey:String(t.get(`stripe_secretKey`)??``),webhookSecret:String(t.get(`stripe_webhookSecret`)??``)},freemius:{developerId:String(t.get(`freemius_developerId`)??``),publicKey:String(t.get(`freemius_publicKey`)??``),productId:String(t.get(`freemius_productId`)??``),secretKey:String(t.get(`freemius_secretKey`)??``),apiKey:String(t.get(`freemius_apiKey`)??``)}}),(0,n.revalidatePath)(`/cms/payments`),(0,n.revalidatePath)(`/cms/dashboard`),(0,n.revalidatePath)(`/`,`layout`)}async function a(e){let r=await(0,t.createClient)(),{data:{user:i}}=await r.auth.getUser();if(!i)throw Error(`Unauthorized`);let{data:a}=await r.from(`profiles`).select(`role`).eq(`id`,i.id).single();if(!a||a.role!==`ADMIN`)throw Error(`Forbidden`);let{error:o}=await r.from(`site_settings`).upsert({key:`enabled_payment_providers`,value:e});if(o)throw console.error(`Error updating payment providers:`,o),Error(`Failed to update settings`);return(0,n.revalidatePath)(`/cms/payments`),(0,n.revalidatePath)(`/cms/taxes`),(0,n.revalidatePath)(`/`,`layout`),{success:!0}}exports.savePaymentProviderCredentials=i,exports.updatePaymentSettings=a;
@@ -1,51 +1,41 @@
1
- 'use server';
2
- import { createClient as a } from "@nextblock-cms/db/server";
3
- import { revalidatePath as t } from "next/cache";
4
- import { savePaymentCredentials as n } from "../../../payment-config.es.js";
5
- async function d() {
6
- const e = await a(), {
7
- data: { user: r }
8
- } = await e.auth.getUser();
9
- if (!r)
10
- throw new Error("Unauthorized");
11
- const { data: i } = await e.from("profiles").select("role").eq("id", r.id).single();
12
- if (!i || i.role !== "ADMIN")
13
- throw new Error("Forbidden");
1
+ "use server";
2
+ import { savePaymentCredentials as e } from "../../../payment-config.es.js";
3
+ import { createClient as t } from "@nextblock-cms/db/server";
4
+ import { revalidatePath as n } from "next/cache";
5
+ //#region src/lib/pages/cms/payments/actions.ts
6
+ async function r() {
7
+ let e = await t(), { data: { user: n } } = await e.auth.getUser();
8
+ if (!n) throw Error("Unauthorized");
9
+ let { data: r } = await e.from("profiles").select("role").eq("id", n.id).single();
10
+ if (!r || r.role !== "ADMIN") throw Error("Forbidden");
14
11
  }
15
- async function l(e) {
16
- await d(), await n({
17
- stripe: {
18
- publishableKey: String(e.get("stripe_publishableKey") ?? ""),
19
- secretKey: String(e.get("stripe_secretKey") ?? ""),
20
- webhookSecret: String(e.get("stripe_webhookSecret") ?? "")
21
- },
22
- freemius: {
23
- developerId: String(e.get("freemius_developerId") ?? ""),
24
- publicKey: String(e.get("freemius_publicKey") ?? ""),
25
- productId: String(e.get("freemius_productId") ?? ""),
26
- secretKey: String(e.get("freemius_secretKey") ?? ""),
27
- apiKey: String(e.get("freemius_apiKey") ?? "")
28
- }
29
- }), t("/cms/payments"), t("/cms/dashboard"), t("/", "layout");
12
+ async function i(t) {
13
+ await r(), await e({
14
+ stripe: {
15
+ publishableKey: String(t.get("stripe_publishableKey") ?? ""),
16
+ secretKey: String(t.get("stripe_secretKey") ?? ""),
17
+ webhookSecret: String(t.get("stripe_webhookSecret") ?? "")
18
+ },
19
+ freemius: {
20
+ developerId: String(t.get("freemius_developerId") ?? ""),
21
+ publicKey: String(t.get("freemius_publicKey") ?? ""),
22
+ productId: String(t.get("freemius_productId") ?? ""),
23
+ secretKey: String(t.get("freemius_secretKey") ?? ""),
24
+ apiKey: String(t.get("freemius_apiKey") ?? "")
25
+ }
26
+ }), n("/cms/payments"), n("/cms/dashboard"), n("/", "layout");
30
27
  }
31
- async function g(e) {
32
- const r = await a(), {
33
- data: { user: i }
34
- } = await r.auth.getUser();
35
- if (!i)
36
- throw new Error("Unauthorized");
37
- const { data: s } = await r.from("profiles").select("role").eq("id", i.id).single();
38
- if (!s || s.role !== "ADMIN")
39
- throw new Error("Forbidden");
40
- const { error: o } = await r.from("site_settings").upsert({
41
- key: "enabled_payment_providers",
42
- value: e
43
- });
44
- if (o)
45
- throw console.error("Error updating payment providers:", o), new Error("Failed to update settings");
46
- return t("/cms/payments"), t("/cms/taxes"), t("/", "layout"), { success: !0 };
28
+ async function a(e) {
29
+ let r = await t(), { data: { user: i } } = await r.auth.getUser();
30
+ if (!i) throw Error("Unauthorized");
31
+ let { data: a } = await r.from("profiles").select("role").eq("id", i.id).single();
32
+ if (!a || a.role !== "ADMIN") throw Error("Forbidden");
33
+ let { error: o } = await r.from("site_settings").upsert({
34
+ key: "enabled_payment_providers",
35
+ value: e
36
+ });
37
+ if (o) throw console.error("Error updating payment providers:", o), Error("Failed to update settings");
38
+ return n("/cms/payments"), n("/cms/taxes"), n("/", "layout"), { success: !0 };
47
39
  }
48
- export {
49
- l as savePaymentProviderCredentials,
50
- g as updatePaymentSettings
51
- };
40
+ //#endregion
41
+ export { i as savePaymentProviderCredentials, a as updatePaymentSettings };
@@ -0,0 +1 @@
1
+ const e=require("./actions.cjs"),t=require("./PaymentsPage.cjs");exports.PaymentsPage=t.PaymentsPage,exports.savePaymentProviderCredentials=e.savePaymentProviderCredentials,exports.updatePaymentSettings=e.updatePaymentSettings;
@@ -0,0 +1,3 @@
1
+ import { savePaymentProviderCredentials as e, updatePaymentSettings as t } from "./actions.es.js";
2
+ import { PaymentsPage as n } from "./PaymentsPage.es.js";
3
+ export { n as PaymentsPage, e as savePaymentProviderCredentials, t as updatePaymentSettings };
@@ -0,0 +1 @@
1
+ const e=require("../../../types.cjs"),t=require("../../../payment-config.cjs");let n=require("react"),r=require("@nextblock-cms/db/server");async function i(){return t.getPaymentConfigStatus()}async function a(){let{data:t,error:n}=await(0,r.createClient)().from(`site_settings`).select(`value`).eq(`key`,`enabled_payment_providers`).maybeSingle();return n||!t?{...e.DEFAULT_ENABLED_PAYMENT_PROVIDERS}:e.normalizeEnabledPaymentProviders(t.value)}async function o(){let e=await a();return e.stripe?`stripe`:e.freemius?`freemius`:`stripe`}var s={stripe:`Stripe`,freemius:`Freemius`};function c(e,t,n){let r=t[e],{hasKeys:i,missing:a}=n[e];return{provider:e,label:s[e],enabled:r,hasKeys:i,ready:r&&i,missing:i&&!r?[`Not enabled in CMS → Payments`]:a}}var l=(0,n.cache)(async()=>{let[e,t]=await Promise.all([a(),i()]);return{stripe:c(`stripe`,e,t),freemius:c(`freemius`,e,t)}});async function u(e){return(await l())[e]}async function d(t){return u(e.derivePaymentProviderFromProductType(t))}exports.getEnabledPaymentProviders=a,exports.getPaymentSettings=o,exports.getProviderReadiness=u,exports.getReadinessForProductType=d,exports.getStoreConfigStatus=i,exports.getStoreReadiness=l;
@@ -1,56 +1,46 @@
1
- import { cache as u } from "react";
2
- import { createClient as c } from "@nextblock-cms/db/server";
3
- import { DEFAULT_ENABLED_PAYMENT_PROVIDERS as m, normalizeEnabledPaymentProviders as d, derivePaymentProviderFromProductType as f } from "../../../types.es.js";
4
- import { getPaymentConfigStatus as y } from "../../../payment-config.es.js";
5
- async function l() {
6
- return y();
1
+ import { DEFAULT_ENABLED_PAYMENT_PROVIDERS as e, derivePaymentProviderFromProductType as t, normalizeEnabledPaymentProviders as n } from "../../../types.es.js";
2
+ import { getPaymentConfigStatus as r } from "../../../payment-config.es.js";
3
+ import { cache as i } from "react";
4
+ import { createClient as a } from "@nextblock-cms/db/server";
5
+ //#region src/lib/pages/cms/payments/queries.ts
6
+ async function o() {
7
+ return r();
7
8
  }
8
- async function a() {
9
- const e = c(), { data: t, error: n } = await e.from("site_settings").select("value").eq("key", "enabled_payment_providers").maybeSingle();
10
- return n || !t ? { ...m } : d(t.value);
9
+ async function s() {
10
+ let { data: t, error: r } = await a().from("site_settings").select("value").eq("key", "enabled_payment_providers").maybeSingle();
11
+ return r || !t ? { ...e } : n(t.value);
11
12
  }
12
- async function v() {
13
- const e = await a();
14
- return e.stripe ? "stripe" : e.freemius ? "freemius" : "stripe";
13
+ async function c() {
14
+ let e = await s();
15
+ return e.stripe ? "stripe" : e.freemius ? "freemius" : "stripe";
15
16
  }
16
- const P = {
17
- stripe: "Stripe",
18
- freemius: "Freemius"
17
+ var l = {
18
+ stripe: "Stripe",
19
+ freemius: "Freemius"
19
20
  };
20
- function i(e, t, n) {
21
- const r = t[e], { hasKeys: s, missing: o } = n[e];
22
- return {
23
- provider: e,
24
- label: P[e],
25
- enabled: r,
26
- hasKeys: s,
27
- ready: r && s,
28
- // A provider with keys that was simply never switched on needs different copy
29
- // from one with no credentials at all, so surface that as its own "missing" item.
30
- missing: s && !r ? ["Not enabled in CMS → Payments"] : o
31
- };
21
+ function u(e, t, n) {
22
+ let r = t[e], { hasKeys: i, missing: a } = n[e];
23
+ return {
24
+ provider: e,
25
+ label: l[e],
26
+ enabled: r,
27
+ hasKeys: i,
28
+ ready: r && i,
29
+ missing: i && !r ? ["Not enabled in CMS → Payments"] : a
30
+ };
32
31
  }
33
- const g = u(async () => {
34
- const [e, t] = await Promise.all([
35
- a(),
36
- l()
37
- ]);
38
- return {
39
- stripe: i("stripe", e, t),
40
- freemius: i("freemius", e, t)
41
- };
32
+ var d = i(async () => {
33
+ let [e, t] = await Promise.all([s(), o()]);
34
+ return {
35
+ stripe: u("stripe", e, t),
36
+ freemius: u("freemius", e, t)
37
+ };
42
38
  });
43
- async function p(e) {
44
- return (await g())[e];
39
+ async function f(e) {
40
+ return (await d())[e];
45
41
  }
46
- async function _(e) {
47
- return p(f(e));
42
+ async function p(e) {
43
+ return f(t(e));
48
44
  }
49
- export {
50
- a as getEnabledPaymentProviders,
51
- v as getPaymentSettings,
52
- p as getProviderReadiness,
53
- _ as getReadinessForProductType,
54
- l as getStoreConfigStatus,
55
- g as getStoreReadiness
56
- };
45
+ //#endregion
46
+ export { s as getEnabledPaymentProviders, c as getPaymentSettings, f as getProviderReadiness, p as getReadinessForProductType, o as getStoreConfigStatus, d as getStoreReadiness };
@@ -0,0 +1 @@
1
+ const e=require("../../../../_virtual/_rolldown/runtime.cjs"),t=require("./actions.cjs"),n=require("./server-actions.cjs"),r=require("./components/ProductsBulkTable.cjs"),i=require("./components/SyncFreemiusButton.cjs");let a=require("next/link");a=e.__toESM(a,1);let o=require("react/jsx-runtime"),s=require("@nextblock-cms/db/server"),c=require("@nextblock-cms/ui"),l=require("@nextblock-cms/utils/seo");async function u({searchParams:e,languageFilterNode:u,transferControlsNode:d}){let f=(0,s.getServiceRoleSupabaseClient)(),[p,{data:m}]=await Promise.all([(0,s.getActiveLanguagesServerSide)(),f.from(`currencies`).select(`code, is_default`).eq(`is_active`,!0).order(`is_default`,{ascending:!1}).order(`code`,{ascending:!0})]),h=e?.lang?parseInt(e.lang,10):void 0,{data:g}=await t.getProducts({languageId:h}),_=g||[],v=_.map(e=>e.id),{data:y}=v.length>0?await f.from(`blocks`).select(`id, product_id, block_type, content, order`).in(`product_id`,v).order(`order`,{ascending:!0}):{data:[]},b=new Map;for(let e of y||[]){if(!e.product_id)continue;let t=b.get(e.product_id)||[];t.push(e),b.set(e.product_id,t)}let x=_.map(e=>{let t=b.get(e.id)||[],n=(0,l.buildPageSeoDocument)(t,{documentTitle:e.title,documentType:`product`}),r=(0,l.auditSeo)({document:n,metaTitle:e.meta_title??void 0,metaDescription:e.meta_description??void 0,scope:`page`});return{...e,seo_score:r.score}}),S=Object.fromEntries(p.map(e=>[String(e.id),e.code.toUpperCase()])),C=m?.find(e=>e.is_default)?.code||m?.[0]?.code||`USD`;return(0,o.jsxs)(`div`,{className:`p-8 space-y-6`,children:[(0,o.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,o.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Products`}),(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,o.jsx)(`div`,{className:`h-10 w-[1px] bg-slate-200 dark:bg-slate-800 mx-2 hidden sm:block`}),d,u,(0,o.jsx)(i.SyncFreemiusButton,{title:`Sync Full Store`}),(0,o.jsx)(a.default,{href:`/cms/products/new`,children:(0,o.jsx)(c.Button,{children:`New Product`})})]})]}),(0,o.jsx)(r.ProductsBulkTable,{products:x,languageLabels:S,defaultCurrencyCode:C,deleteProductAction:n.deleteProductAction,bulkDeleteProductsAction:n.bulkDeleteProductsAction,bulkDraftProductsAction:n.bulkDraftProductsAction})]})}exports.ProductsPage=u;
@@ -4,4 +4,4 @@ export declare function ProductsPage({ searchParams, languageFilterNode, transfe
4
4
  };
5
5
  languageFilterNode?: React.ReactNode;
6
6
  transferControlsNode?: React.ReactNode;
7
- }): Promise<import("react").JSX.Element>;
7
+ }): Promise<import('react').JSX.Element>;
@@ -1,67 +1,64 @@
1
- import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
- import { Button as S } from "@nextblock-cms/ui";
3
- import v from "next/link";
4
- import { getProducts as w } from "./actions.es.js";
5
- import { ProductsBulkTable as x } from "./components/ProductsBulkTable.es.js";
6
- import { SyncFreemiusButton as y } from "./components/SyncFreemiusButton.es.js";
7
- import { bulkDraftProductsAction as D, bulkDeleteProductsAction as N, deleteProductAction as I } from "./server-actions.es.js";
8
- import { getServiceRoleSupabaseClient as L, getActiveLanguagesServerSide as j } from "@nextblock-cms/db/server";
9
- import { buildPageSeoDocument as A, auditSeo as B } from "@nextblock-cms/utils/seo";
10
- async function W({
11
- searchParams: s,
12
- languageFilterNode: l,
13
- transferControlsNode: u
14
- }) {
15
- const d = L(), [m, { data: i }] = await Promise.all([
16
- j(),
17
- d.from("currencies").select("code, is_default").eq("is_active", !0).order("is_default", { ascending: !1 }).order("code", { ascending: !0 })
18
- ]), p = s?.lang ? parseInt(s.lang, 10) : void 0, { data: f } = await w({ languageId: p }), n = f || [], a = n.map((e) => e.id), { data: g } = a.length > 0 ? await d.from("blocks").select("id, product_id, block_type, content, order").in("product_id", a).order("order", { ascending: !0 }) : { data: [] }, c = /* @__PURE__ */ new Map();
19
- for (const e of g || []) {
20
- if (!e.product_id) continue;
21
- const o = c.get(e.product_id) || [];
22
- o.push(e), c.set(e.product_id, o);
23
- }
24
- const b = n.map((e) => {
25
- const o = c.get(e.id) || [], k = A(o, {
26
- documentTitle: e.title,
27
- documentType: "product"
28
- }), P = B({
29
- document: k,
30
- metaTitle: e.meta_title ?? void 0,
31
- metaDescription: e.meta_description ?? void 0,
32
- scope: "page"
33
- });
34
- return {
35
- ...e,
36
- seo_score: P.score
37
- };
38
- }), _ = Object.fromEntries(
39
- m.map((e) => [String(e.id), e.code.toUpperCase()])
40
- ), h = i?.find((e) => e.is_default)?.code || i?.[0]?.code || "USD";
41
- return /* @__PURE__ */ r("div", { className: "p-8 space-y-6", children: [
42
- /* @__PURE__ */ r("div", { className: "flex justify-between items-center", children: [
43
- /* @__PURE__ */ t("h1", { className: "text-3xl font-bold", children: "Products" }),
44
- /* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-4", children: [
45
- /* @__PURE__ */ t("div", { className: "h-10 w-[1px] bg-slate-200 dark:bg-slate-800 mx-2 hidden sm:block" }),
46
- u,
47
- l,
48
- /* @__PURE__ */ t(y, { title: "Sync Full Store" }),
49
- /* @__PURE__ */ t(v, { href: "/cms/products/new", children: /* @__PURE__ */ t(S, { children: "New Product" }) })
50
- ] })
51
- ] }),
52
- /* @__PURE__ */ t(
53
- x,
54
- {
55
- products: b,
56
- languageLabels: _,
57
- defaultCurrencyCode: h,
58
- deleteProductAction: I,
59
- bulkDeleteProductsAction: N,
60
- bulkDraftProductsAction: D
61
- }
62
- )
63
- ] });
1
+ import { getProducts as e } from "./actions.es.js";
2
+ import { bulkDeleteProductsAction as t, bulkDraftProductsAction as n, deleteProductAction as r } from "./server-actions.es.js";
3
+ import { ProductsBulkTable as i } from "./components/ProductsBulkTable.es.js";
4
+ import { SyncFreemiusButton as a } from "./components/SyncFreemiusButton.es.js";
5
+ import o from "next/link";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ import { getActiveLanguagesServerSide as l, getServiceRoleSupabaseClient as u } from "@nextblock-cms/db/server";
8
+ import { Button as d } from "@nextblock-cms/ui";
9
+ import { auditSeo as f, buildPageSeoDocument as p } from "@nextblock-cms/utils/seo";
10
+ //#region src/lib/pages/cms/products/ProductsPage.tsx
11
+ async function m({ searchParams: m, languageFilterNode: h, transferControlsNode: g }) {
12
+ let _ = u(), [v, { data: y }] = await Promise.all([l(), _.from("currencies").select("code, is_default").eq("is_active", !0).order("is_default", { ascending: !1 }).order("code", { ascending: !0 })]), b = m?.lang ? parseInt(m.lang, 10) : void 0, { data: x } = await e({ languageId: b }), S = x || [], C = S.map((e) => e.id), { data: w } = C.length > 0 ? await _.from("blocks").select("id, product_id, block_type, content, order").in("product_id", C).order("order", { ascending: !0 }) : { data: [] }, T = /* @__PURE__ */ new Map();
13
+ for (let e of w || []) {
14
+ if (!e.product_id) continue;
15
+ let t = T.get(e.product_id) || [];
16
+ t.push(e), T.set(e.product_id, t);
17
+ }
18
+ let E = S.map((e) => {
19
+ let t = T.get(e.id) || [], n = p(t, {
20
+ documentTitle: e.title,
21
+ documentType: "product"
22
+ }), r = f({
23
+ document: n,
24
+ metaTitle: e.meta_title ?? void 0,
25
+ metaDescription: e.meta_description ?? void 0,
26
+ scope: "page"
27
+ });
28
+ return {
29
+ ...e,
30
+ seo_score: r.score
31
+ };
32
+ }), D = Object.fromEntries(v.map((e) => [String(e.id), e.code.toUpperCase()])), O = y?.find((e) => e.is_default)?.code || y?.[0]?.code || "USD";
33
+ return /* @__PURE__ */ c("div", {
34
+ className: "p-8 space-y-6",
35
+ children: [/* @__PURE__ */ c("div", {
36
+ className: "flex justify-between items-center",
37
+ children: [/* @__PURE__ */ s("h1", {
38
+ className: "text-3xl font-bold",
39
+ children: "Products"
40
+ }), /* @__PURE__ */ c("div", {
41
+ className: "flex flex-wrap items-center gap-4",
42
+ children: [
43
+ /* @__PURE__ */ s("div", { className: "h-10 w-[1px] bg-slate-200 dark:bg-slate-800 mx-2 hidden sm:block" }),
44
+ g,
45
+ h,
46
+ /* @__PURE__ */ s(a, { title: "Sync Full Store" }),
47
+ /* @__PURE__ */ s(o, {
48
+ href: "/cms/products/new",
49
+ children: /* @__PURE__ */ s(d, { children: "New Product" })
50
+ })
51
+ ]
52
+ })]
53
+ }), /* @__PURE__ */ s(i, {
54
+ products: E,
55
+ languageLabels: D,
56
+ defaultCurrencyCode: O,
57
+ deleteProductAction: r,
58
+ bulkDeleteProductsAction: t,
59
+ bulkDraftProductsAction: n
60
+ })]
61
+ });
64
62
  }
65
- export {
66
- W as ProductsPage
67
- };
63
+ //#endregion
64
+ export { m as ProductsPage };
@@ -0,0 +1 @@
1
+ const e=require("../../../../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../../../currency.cjs"),n=require("../../../../../variation-utils.cjs"),r=require("../../actions.cjs"),i=require("../../server-actions.cjs"),a=require("../../components/ProductForm.cjs"),o=require("../../../payments/queries.cjs"),s=require("../../components/DeleteProductButton.cjs"),c=require("../../components/FreemiusPricingDashboard.cjs");let l=require("next/link");l=e.__toESM(l,1);let u=require("lucide-react"),d=require("@nextblock-cms/utils"),f=require("react/jsx-runtime"),p=require("@nextblock-cms/db/server"),m=require("next/navigation"),h=require("@nextblock-cms/ui");async function g({params:e,mediaPickerNode:g,availableLanguagesProp:_,languageSwitcherNode:v,copyContentNode:y,translationCtaNode:b}){let{id:x}=await e,S=await r.getProduct(x);S||(0,m.notFound)();let C=S.product_type===`digital`||S.payment_provider===`freemius`,[w,T,E,D,O]=await Promise.all([o.getEnabledPaymentProviders(),o.getStoreConfigStatus(),C&&S.freemius_product_id?r.getFreemiusPricingByProductId(S.id):Promise.resolve(null),r.getGlobalProductAttributes(),(0,p.getServiceRoleSupabaseClient)().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(`code`,{ascending:!0}).then(e=>e.data||[])]),k=(O||[]).map(e=>t.normalizeCurrencyRecord(e)),A=_.find(e=>e.id===S.language_id)?.code,{attributes:j,variants:M}=n.mapRawVariantRelations(S.product_variants||[],A),N=(D||[]).map(e=>({id:e.id,name:e.name,name_translations:e.name_translations||{},slug:e.slug,terms:(e.product_attribute_terms||[]).map(e=>({...e,value_translations:e.value_translations||{}}))})),P=s.DeleteProductButton,F=c.FreemiusPricingDashboard;return(0,f.jsxs)(`div`,{className:`space-y-8 w-full max-w-[1400px] mx-auto px-6 py-8`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between items-center flex-wrap gap-4 w-full`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(h.Button,{variant:`outline`,size:`icon`,"aria-label":`Back to products`,asChild:!0,children:(0,f.jsx)(l.default,{href:`/cms/products`,children:(0,f.jsx)(u.ArrowLeft,{className:`h-4 w-4`})})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Edit Product`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground truncate max-w-md`,title:S.title,children:S.title})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[v,y,b,P?(0,f.jsx)(P,{productName:S.title,redirectTo:`/cms/products`,className:`border-red-200 hover:bg-red-50 hover:text-red-700`,deleteAction:i.deleteProductAction.bind(null,S.id)}):null,S.slug&&S.status===`active`&&(0,f.jsx)(h.Button,{variant:`outline`,asChild:!0,children:(0,f.jsxs)(l.default,{href:`/product/${S.slug}`,target:`_blank`,children:[(0,f.jsx)(u.ExternalLink,{className:`w-4 h-4 mr-2`}),`View`]})})]})]}),(0,f.jsx)(a.ProductForm,{initialData:{id:S.id,title:S.title,slug:S.slug,sku:S.sku,upc:S.upc??void 0,stock:S.stock||0,price:S.price||0,prices:Object.entries(S.prices||{}).reduce((e,[t,n])=>(e[t]=(0,d.minorUnitAmountToMajor)(n,t),e),{}),is_taxable:typeof S.is_taxable!=`boolean`||S.is_taxable,product_type:S.product_type,payment_provider:S.payment_provider,status:S.status,short_description:S.short_description??void 0,description_json:S.description_json,sale_price:typeof S.sale_price==`number`?S.sale_price:void 0,sale_prices:Object.entries(S.sale_prices||{}).reduce((e,[t,n])=>(e[t]=typeof n==`number`?(0,d.minorUnitAmountToMajor)(n,t):null,e),{}),freemius_plan_id:S.freemius_plan_id??void 0,freemius_product_id:S.freemius_product_id??void 0,trial_period_days:S.trial_period_days??0,trial_requires_payment_method:S.trial_requires_payment_method??!1,language_id:S.language_id,translation_group_id:S.translation_group_id,product_media:S.product_media,variation_attributes:j.map(e=>({attribute_id:e.id,term_ids:e.terms.map(e=>e.id)})),variants:M.map(e=>({...e,upc:e.upc??null,price:e.price/100,prices:Object.entries(e.prices||{}).reduce((e,[t,n])=>(e[t]=(0,d.minorUnitAmountToMajor)(n,t),e),{}),sale_price:typeof e.sale_price==`number`?e.sale_price/100:null,sale_prices:Object.entries(e.sale_prices||{}).reduce((e,[t,n])=>(e[t]=typeof n==`number`?(0,d.minorUnitAmountToMajor)(n,t):null,e),{}),main_media_id:e.main_media_id??null,main_image_url:e.image_url??null}))},isEdit:!0,mediaPickerNode:g,availableLanguagesProp:_,globalAttributesProp:N,currenciesProp:k,enabledProviders:w,configStatus:T,updateAction:i.updateProductAction.bind(null,S.id),freemiusDashboardNode:C&&S.freemius_product_id&&E&&F?(0,f.jsx)(F,{productId:S.id,freemiusProductId:S.freemius_product_id,plans:E}):void 0})]})}exports.EditProductPage=g;
@@ -8,5 +8,5 @@ interface EditProductPageProps {
8
8
  copyContentNode?: React.ReactNode;
9
9
  translationCtaNode?: React.ReactNode;
10
10
  }
11
- export declare function EditProductPage({ params, mediaPickerNode, availableLanguagesProp, languageSwitcherNode, copyContentNode, translationCtaNode }: EditProductPageProps): Promise<import("react").JSX.Element>;
11
+ export declare function EditProductPage({ params, mediaPickerNode, availableLanguagesProp, languageSwitcherNode, copyContentNode, translationCtaNode }: EditProductPageProps): Promise<import('react').JSX.Element>;
12
12
  export {};
@@ -0,0 +1,139 @@
1
+ import { normalizeCurrencyRecord as e } from "../../../../../currency.es.js";
2
+ import { mapRawVariantRelations as t } from "../../../../../variation-utils.es.js";
3
+ import { getFreemiusPricingByProductId as n, getGlobalProductAttributes as r, getProduct as i } from "../../actions.es.js";
4
+ import { deleteProductAction as a, updateProductAction as o } from "../../server-actions.es.js";
5
+ import { ProductForm as s } from "../../components/ProductForm.es.js";
6
+ import { getEnabledPaymentProviders as c, getStoreConfigStatus as l } from "../../../payments/queries.es.js";
7
+ import { DeleteProductButton as u } from "../../components/DeleteProductButton.es.js";
8
+ import { FreemiusPricingDashboard as d } from "../../components/FreemiusPricingDashboard.es.js";
9
+ import f from "next/link";
10
+ import { ArrowLeft as p, ExternalLink as m } from "lucide-react";
11
+ import { minorUnitAmountToMajor as h } from "@nextblock-cms/utils";
12
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
13
+ import { getServiceRoleSupabaseClient as v } from "@nextblock-cms/db/server";
14
+ import { notFound as y } from "next/navigation";
15
+ import { Button as b } from "@nextblock-cms/ui";
16
+ //#region src/lib/pages/cms/products/[id]/edit/EditProductPage.tsx
17
+ async function x({ params: x, mediaPickerNode: S, availableLanguagesProp: C, languageSwitcherNode: w, copyContentNode: T, translationCtaNode: E }) {
18
+ let { id: D } = await x, O = await i(D);
19
+ O || y();
20
+ let k = O.product_type === "digital" || O.payment_provider === "freemius", [A, j, M, N, P] = await Promise.all([
21
+ c(),
22
+ l(),
23
+ k && O.freemius_product_id ? n(O.id) : Promise.resolve(null),
24
+ r(),
25
+ v().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("code", { ascending: !0 }).then((e) => e.data || [])
26
+ ]), F = (P || []).map((t) => e(t)), I = C.find((e) => e.id === O.language_id)?.code, { attributes: L, variants: R } = t(O.product_variants || [], I), z = (N || []).map((e) => ({
27
+ id: e.id,
28
+ name: e.name,
29
+ name_translations: e.name_translations || {},
30
+ slug: e.slug,
31
+ terms: (e.product_attribute_terms || []).map((e) => ({
32
+ ...e,
33
+ value_translations: e.value_translations || {}
34
+ }))
35
+ })), B = u, V = d;
36
+ return /* @__PURE__ */ _("div", {
37
+ className: "space-y-8 w-full max-w-[1400px] mx-auto px-6 py-8",
38
+ children: [/* @__PURE__ */ _("div", {
39
+ className: "flex justify-between items-center flex-wrap gap-4 w-full",
40
+ children: [/* @__PURE__ */ _("div", {
41
+ className: "flex items-center gap-3",
42
+ children: [/* @__PURE__ */ g(b, {
43
+ variant: "outline",
44
+ size: "icon",
45
+ "aria-label": "Back to products",
46
+ asChild: !0,
47
+ children: /* @__PURE__ */ g(f, {
48
+ href: "/cms/products",
49
+ children: /* @__PURE__ */ g(p, { className: "h-4 w-4" })
50
+ })
51
+ }), /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("h1", {
52
+ className: "text-2xl font-bold",
53
+ children: "Edit Product"
54
+ }), /* @__PURE__ */ g("p", {
55
+ className: "text-sm text-muted-foreground truncate max-w-md",
56
+ title: O.title,
57
+ children: O.title
58
+ })] })]
59
+ }), /* @__PURE__ */ _("div", {
60
+ className: "flex items-center gap-3 flex-wrap",
61
+ children: [
62
+ w,
63
+ T,
64
+ E,
65
+ B ? /* @__PURE__ */ g(B, {
66
+ productName: O.title,
67
+ redirectTo: "/cms/products",
68
+ className: "border-red-200 hover:bg-red-50 hover:text-red-700",
69
+ deleteAction: a.bind(null, O.id)
70
+ }) : null,
71
+ O.slug && O.status === "active" && /* @__PURE__ */ g(b, {
72
+ variant: "outline",
73
+ asChild: !0,
74
+ children: /* @__PURE__ */ _(f, {
75
+ href: `/product/${O.slug}`,
76
+ target: "_blank",
77
+ children: [/* @__PURE__ */ g(m, { className: "w-4 h-4 mr-2" }), "View"]
78
+ })
79
+ })
80
+ ]
81
+ })]
82
+ }), /* @__PURE__ */ g(s, {
83
+ initialData: {
84
+ id: O.id,
85
+ title: O.title,
86
+ slug: O.slug,
87
+ sku: O.sku,
88
+ upc: O.upc ?? void 0,
89
+ stock: O.stock || 0,
90
+ price: O.price || 0,
91
+ prices: Object.entries(O.prices || {}).reduce((e, [t, n]) => (e[t] = h(n, t), e), {}),
92
+ is_taxable: typeof O.is_taxable != "boolean" || O.is_taxable,
93
+ product_type: O.product_type,
94
+ payment_provider: O.payment_provider,
95
+ status: O.status,
96
+ short_description: O.short_description ?? void 0,
97
+ description_json: O.description_json,
98
+ sale_price: typeof O.sale_price == "number" ? O.sale_price : void 0,
99
+ sale_prices: Object.entries(O.sale_prices || {}).reduce((e, [t, n]) => (e[t] = typeof n == "number" ? h(n, t) : null, e), {}),
100
+ freemius_plan_id: O.freemius_plan_id ?? void 0,
101
+ freemius_product_id: O.freemius_product_id ?? void 0,
102
+ trial_period_days: O.trial_period_days ?? 0,
103
+ trial_requires_payment_method: O.trial_requires_payment_method ?? !1,
104
+ language_id: O.language_id,
105
+ translation_group_id: O.translation_group_id,
106
+ product_media: O.product_media,
107
+ variation_attributes: L.map((e) => ({
108
+ attribute_id: e.id,
109
+ term_ids: e.terms.map((e) => e.id)
110
+ })),
111
+ variants: R.map((e) => ({
112
+ ...e,
113
+ upc: e.upc ?? null,
114
+ price: e.price / 100,
115
+ prices: Object.entries(e.prices || {}).reduce((e, [t, n]) => (e[t] = h(n, t), e), {}),
116
+ sale_price: typeof e.sale_price == "number" ? e.sale_price / 100 : null,
117
+ sale_prices: Object.entries(e.sale_prices || {}).reduce((e, [t, n]) => (e[t] = typeof n == "number" ? h(n, t) : null, e), {}),
118
+ main_media_id: e.main_media_id ?? null,
119
+ main_image_url: e.image_url ?? null
120
+ }))
121
+ },
122
+ isEdit: !0,
123
+ mediaPickerNode: S,
124
+ availableLanguagesProp: C,
125
+ globalAttributesProp: z,
126
+ currenciesProp: F,
127
+ enabledProviders: A,
128
+ configStatus: j,
129
+ updateAction: o.bind(null, O.id),
130
+ freemiusDashboardNode: k && O.freemius_product_id && M && V ? /* @__PURE__ */ g(V, {
131
+ productId: O.id,
132
+ freemiusProductId: O.freemius_product_id,
133
+ plans: M
134
+ }) : void 0
135
+ })]
136
+ });
137
+ }
138
+ //#endregion
139
+ export { x as EditProductPage };