@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,137 +1,189 @@
1
- import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
- import m from "next/link";
3
- import { notFound as p } from "next/navigation";
4
- import { InvoiceViewerShell as u } from "../../../components/InvoiceViewerShell.es.js";
5
- import { getInvoicePresentationData as x } from "../../../invoice-server.es.js";
6
- import { buildInvoiceDocumentLabels as g } from "../../../invoice-ui.es.js";
7
- import { getOrderDetails as b } from "./actions.es.js";
8
- import { OrderPrintButton as f } from "./OrderPrintButton.es.js";
9
- import { OrderStatusForm as h } from "./OrderStatusForm.es.js";
10
- const s = (a, l = "usd") => new Intl.NumberFormat("en-US", {
11
- style: "currency",
12
- currency: l
13
- }).format(a / 100);
14
- async function O({ params: a }) {
15
- const { id: l } = await a, [e, n] = await Promise.all([
16
- b(l),
17
- x(l).catch(() => null)
18
- ]);
19
- e || p();
20
- const i = n?.order.customer_details ?? e.customer_details, o = g((c) => c);
21
- return /* @__PURE__ */ r("div", { className: "mx-auto w-full max-w-6xl px-4 py-10 md:px-6", children: [
22
- /* @__PURE__ */ r("div", { className: "flex flex-col gap-4 border-b pb-6 md:flex-row md:items-start md:justify-between", children: [
23
- /* @__PURE__ */ r("div", { children: [
24
- /* @__PURE__ */ r("div", { className: "mb-2 flex items-center gap-2 text-sm text-gray-500", children: [
25
- /* @__PURE__ */ t(m, { href: "/cms/orders", className: "hover:underline", children: "Orders" }),
26
- /* @__PURE__ */ t("span", { children: "/" }),
27
- /* @__PURE__ */ t("span", { className: "font-mono", children: e.id })
28
- ] }),
29
- /* @__PURE__ */ r("h1", { className: "flex flex-wrap items-center gap-3 text-3xl font-bold tracking-tight", children: [
30
- "Order",
31
- /* @__PURE__ */ t(y, { status: e.status, size: "lg" })
32
- ] }),
33
- /* @__PURE__ */ t("p", { className: "mt-2 text-sm text-muted-foreground", children: "Review the finalized invoice, customer details, and payment metadata in one place." })
34
- ] }),
35
- /* @__PURE__ */ t("div", { className: "w-full max-w-md", children: /* @__PURE__ */ t(h, { orderId: l, currentStatus: e.status }) })
36
- ] }),
37
- /* @__PURE__ */ r("div", { className: "mt-6 grid gap-4 md:grid-cols-2", children: [
38
- /* @__PURE__ */ r("div", { className: "rounded-lg border bg-white p-4 dark:border-slate-800 dark:bg-slate-900", children: [
39
- /* @__PURE__ */ t("h3", { className: "mb-3 text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-500", children: "Customer" }),
40
- /* @__PURE__ */ r("div", { className: "space-y-2 text-sm", children: [
41
- i?.name ? /* @__PURE__ */ t("p", { className: "font-semibold text-gray-900 dark:text-white", children: i.name }) : null,
42
- i?.email ? /* @__PURE__ */ t("p", { className: "text-gray-600 dark:text-gray-400", children: i.email }) : null,
43
- i?.phone ? /* @__PURE__ */ t("p", { className: "text-gray-600 dark:text-gray-400", children: i.phone }) : null,
44
- !i?.name && !i?.email && !i?.phone ? /* @__PURE__ */ t("p", { className: "italic text-gray-400", children: "No contact info captured." }) : null,
45
- e.user_id ? /* @__PURE__ */ r("p", { className: "pt-1 font-mono text-[10px] uppercase tracking-wider text-gray-400", children: [
46
- "User ID: ",
47
- e.user_id.slice(0, 13),
48
- "..."
49
- ] }) : null
50
- ] })
51
- ] }),
52
- /* @__PURE__ */ r("div", { className: "rounded-lg border bg-white p-4 dark:border-slate-800 dark:bg-slate-900", children: [
53
- /* @__PURE__ */ t("h3", { className: "mb-3 text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-500", children: "Payment Details" }),
54
- /* @__PURE__ */ r("div", { className: "space-y-2 text-sm", children: [
55
- /* @__PURE__ */ t(d, { label: "Provider", value: e.provider || "stripe", capitalize: !0 }),
56
- /* @__PURE__ */ t(d, { label: "Currency", value: (e.currency || "usd").toUpperCase() }),
57
- /* @__PURE__ */ t(
58
- d,
59
- {
60
- label: "Created",
61
- value: new Date(e.created_at || "").toLocaleDateString()
62
- }
63
- ),
64
- /* @__PURE__ */ t(
65
- d,
66
- {
67
- label: "Invoice #",
68
- value: n?.order.invoice_number || "Pending assignment"
69
- }
70
- ),
71
- /* @__PURE__ */ t(
72
- d,
73
- {
74
- label: "Paid on",
75
- value: n?.order.paid_at ? new Date(n.order.paid_at).toLocaleString() : "Pending payment"
76
- }
77
- ),
78
- /* @__PURE__ */ t(
79
- d,
80
- {
81
- label: "Total",
82
- value: typeof e.total == "number" ? s(e.total, e.currency || "usd") : "--"
83
- }
84
- ),
85
- e.discount_total ? /* @__PURE__ */ t(
86
- d,
87
- {
88
- label: "Discount",
89
- value: `${e.coupon_code ? `${e.coupon_code} ` : ""}-${s(e.discount_total, e.currency || "usd")}`
90
- }
91
- ) : null,
92
- e.stripe_session_id ? /* @__PURE__ */ r("div", { className: "mt-3 border-t pt-3 dark:border-slate-800", children: [
93
- /* @__PURE__ */ t("p", { className: "mb-1 text-xs text-gray-500", children: "Session ID" }),
94
- /* @__PURE__ */ t("p", { className: "break-all rounded bg-gray-50 p-1 font-mono text-xs dark:bg-slate-800", children: e.stripe_session_id })
95
- ] }) : null
96
- ] })
97
- ] })
98
- ] }),
99
- /* @__PURE__ */ t("div", { className: "mt-6 flex justify-end print:hidden", children: /* @__PURE__ */ t(f, { disabled: !n }) }),
100
- /* @__PURE__ */ t(
101
- u,
102
- {
103
- invoice: n,
104
- labels: o,
105
- locale: "en-US",
106
- title: n?.order.invoice_number || "Order invoice",
107
- description: "Open the printable invoice below and update the order status whenever you need to.",
108
- printLabel: "Print / Save as PDF",
109
- action: {
110
- href: "/cms/orders",
111
- label: "Back to orders",
112
- variant: "outline"
113
- },
114
- emptyMessage: "The printable invoice will appear here after the order payment metadata is synced.",
115
- className: "max-w-none px-0 py-6 md:px-0",
116
- showHeader: !1
117
- }
118
- )
119
- ] });
1
+ import { buildInvoiceDocumentLabels as e } from "../../../invoice-ui.es.js";
2
+ import { InvoiceViewerShell as t } from "../../../components/InvoiceViewerShell.es.js";
3
+ import { getInvoicePresentationData as n } from "../../../invoice-server.es.js";
4
+ import { getOrderDetails as r } from "./actions.es.js";
5
+ import { OrderPrintButton as i } from "./OrderPrintButton.es.js";
6
+ import { OrderStatusForm as a } from "./OrderStatusForm.es.js";
7
+ import o from "next/link";
8
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
+ import { notFound as l } from "next/navigation";
10
+ //#region src/lib/pages/cms/orders/OrderDetailPage.tsx
11
+ var u = (e, t = "usd") => new Intl.NumberFormat("en-US", {
12
+ style: "currency",
13
+ currency: t
14
+ }).format(e / 100);
15
+ async function d({ params: d }) {
16
+ let { id: m } = await d, [h, g] = await Promise.all([r(m), n(m).catch(() => null)]);
17
+ h || l();
18
+ let _ = g?.order.customer_details ?? h.customer_details, v = e((e) => e);
19
+ return /* @__PURE__ */ c("div", {
20
+ className: "mx-auto w-full max-w-6xl px-4 py-10 md:px-6",
21
+ children: [
22
+ /* @__PURE__ */ c("div", {
23
+ className: "flex flex-col gap-4 border-b pb-6 md:flex-row md:items-start md:justify-between",
24
+ children: [/* @__PURE__ */ c("div", { children: [
25
+ /* @__PURE__ */ c("div", {
26
+ className: "mb-2 flex items-center gap-2 text-sm text-gray-500",
27
+ children: [
28
+ /* @__PURE__ */ s(o, {
29
+ href: "/cms/orders",
30
+ className: "hover:underline",
31
+ children: "Orders"
32
+ }),
33
+ /* @__PURE__ */ s("span", { children: "/" }),
34
+ /* @__PURE__ */ s("span", {
35
+ className: "font-mono",
36
+ children: h.id
37
+ })
38
+ ]
39
+ }),
40
+ /* @__PURE__ */ c("h1", {
41
+ className: "flex flex-wrap items-center gap-3 text-3xl font-bold tracking-tight",
42
+ children: ["Order", /* @__PURE__ */ s(p, {
43
+ status: h.status,
44
+ size: "lg"
45
+ })]
46
+ }),
47
+ /* @__PURE__ */ s("p", {
48
+ className: "mt-2 text-sm text-muted-foreground",
49
+ children: "Review the finalized invoice, customer details, and payment metadata in one place."
50
+ })
51
+ ] }), /* @__PURE__ */ s("div", {
52
+ className: "w-full max-w-md",
53
+ children: /* @__PURE__ */ s(a, {
54
+ orderId: m,
55
+ currentStatus: h.status
56
+ })
57
+ })]
58
+ }),
59
+ /* @__PURE__ */ c("div", {
60
+ className: "mt-6 grid gap-4 md:grid-cols-2",
61
+ children: [/* @__PURE__ */ c("div", {
62
+ className: "rounded-lg border bg-white p-4 dark:border-slate-800 dark:bg-slate-900",
63
+ children: [/* @__PURE__ */ s("h3", {
64
+ className: "mb-3 text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-500",
65
+ children: "Customer"
66
+ }), /* @__PURE__ */ c("div", {
67
+ className: "space-y-2 text-sm",
68
+ children: [
69
+ _?.name ? /* @__PURE__ */ s("p", {
70
+ className: "font-semibold text-gray-900 dark:text-white",
71
+ children: _.name
72
+ }) : null,
73
+ _?.email ? /* @__PURE__ */ s("p", {
74
+ className: "text-gray-600 dark:text-gray-400",
75
+ children: _.email
76
+ }) : null,
77
+ _?.phone ? /* @__PURE__ */ s("p", {
78
+ className: "text-gray-600 dark:text-gray-400",
79
+ children: _.phone
80
+ }) : null,
81
+ !_?.name && !_?.email && !_?.phone ? /* @__PURE__ */ s("p", {
82
+ className: "italic text-gray-400",
83
+ children: "No contact info captured."
84
+ }) : null,
85
+ h.user_id ? /* @__PURE__ */ c("p", {
86
+ className: "pt-1 font-mono text-[10px] uppercase tracking-wider text-gray-400",
87
+ children: [
88
+ "User ID: ",
89
+ h.user_id.slice(0, 13),
90
+ "..."
91
+ ]
92
+ }) : null
93
+ ]
94
+ })]
95
+ }), /* @__PURE__ */ c("div", {
96
+ className: "rounded-lg border bg-white p-4 dark:border-slate-800 dark:bg-slate-900",
97
+ children: [/* @__PURE__ */ s("h3", {
98
+ className: "mb-3 text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-500",
99
+ children: "Payment Details"
100
+ }), /* @__PURE__ */ c("div", {
101
+ className: "space-y-2 text-sm",
102
+ children: [
103
+ /* @__PURE__ */ s(f, {
104
+ label: "Provider",
105
+ value: h.provider || "stripe",
106
+ capitalize: !0
107
+ }),
108
+ /* @__PURE__ */ s(f, {
109
+ label: "Currency",
110
+ value: (h.currency || "usd").toUpperCase()
111
+ }),
112
+ /* @__PURE__ */ s(f, {
113
+ label: "Created",
114
+ value: new Date(h.created_at || "").toLocaleDateString()
115
+ }),
116
+ /* @__PURE__ */ s(f, {
117
+ label: "Invoice #",
118
+ value: g?.order.invoice_number || "Pending assignment"
119
+ }),
120
+ /* @__PURE__ */ s(f, {
121
+ label: "Paid on",
122
+ value: g?.order.paid_at ? new Date(g.order.paid_at).toLocaleString() : "Pending payment"
123
+ }),
124
+ /* @__PURE__ */ s(f, {
125
+ label: "Total",
126
+ value: typeof h.total == "number" ? u(h.total, h.currency || "usd") : "--"
127
+ }),
128
+ h.discount_total ? /* @__PURE__ */ s(f, {
129
+ label: "Discount",
130
+ value: `${h.coupon_code ? `${h.coupon_code} ` : ""}-${u(h.discount_total, h.currency || "usd")}`
131
+ }) : null,
132
+ h.stripe_session_id ? /* @__PURE__ */ c("div", {
133
+ className: "mt-3 border-t pt-3 dark:border-slate-800",
134
+ children: [/* @__PURE__ */ s("p", {
135
+ className: "mb-1 text-xs text-gray-500",
136
+ children: "Session ID"
137
+ }), /* @__PURE__ */ s("p", {
138
+ className: "break-all rounded bg-gray-50 p-1 font-mono text-xs dark:bg-slate-800",
139
+ children: h.stripe_session_id
140
+ })]
141
+ }) : null
142
+ ]
143
+ })]
144
+ })]
145
+ }),
146
+ /* @__PURE__ */ s("div", {
147
+ className: "mt-6 flex justify-end print:hidden",
148
+ children: /* @__PURE__ */ s(i, { disabled: !g })
149
+ }),
150
+ /* @__PURE__ */ s(t, {
151
+ invoice: g,
152
+ labels: v,
153
+ locale: "en-US",
154
+ title: g?.order.invoice_number || "Order invoice",
155
+ description: "Open the printable invoice below and update the order status whenever you need to.",
156
+ printLabel: "Print / Save as PDF",
157
+ action: {
158
+ href: "/cms/orders",
159
+ label: "Back to orders",
160
+ variant: "outline"
161
+ },
162
+ emptyMessage: "The printable invoice will appear here after the order payment metadata is synced.",
163
+ className: "max-w-none px-0 py-6 md:px-0",
164
+ showHeader: !1
165
+ })
166
+ ]
167
+ });
120
168
  }
121
- function d({
122
- label: a,
123
- value: l,
124
- capitalize: e = !1
125
- }) {
126
- return /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-3", children: [
127
- /* @__PURE__ */ t("span", { className: "text-gray-500", children: a }),
128
- /* @__PURE__ */ t("span", { className: e ? "capitalize font-medium" : "font-medium", children: l })
129
- ] });
169
+ function f({ label: e, value: t, capitalize: n = !1 }) {
170
+ return /* @__PURE__ */ c("div", {
171
+ className: "flex items-center justify-between gap-3",
172
+ children: [/* @__PURE__ */ s("span", {
173
+ className: "text-gray-500",
174
+ children: e
175
+ }), /* @__PURE__ */ s("span", {
176
+ className: n ? "capitalize font-medium" : "font-medium",
177
+ children: t
178
+ })]
179
+ });
130
180
  }
131
- function y({ status: a, size: l = "md" }) {
132
- let e = "bg-gray-100 text-gray-700 dark:bg-slate-800 dark:text-gray-300";
133
- return a === "paid" && (e = "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"), a === "trial" && (e = "bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300"), a === "pending" && (e = "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400"), a === "shipped" && (e = "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"), a === "cancelled" && (e = "bg-slate-200 text-slate-700 dark:bg-slate-800 dark:text-slate-300"), a === "refunded" && (e = "bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-300"), a === "failed" && (e = "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"), /* @__PURE__ */ t("span", { className: `${l === "lg" ? "px-3 py-1 text-sm" : "px-2 py-0.5 text-xs"} rounded-full font-medium capitalize ${e}`, children: a });
181
+ function p({ status: e, size: t = "md" }) {
182
+ let n = "bg-gray-100 text-gray-700 dark:bg-slate-800 dark:text-gray-300";
183
+ return e === "paid" && (n = "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"), e === "trial" && (n = "bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300"), e === "pending" && (n = "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400"), e === "shipped" && (n = "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"), e === "cancelled" && (n = "bg-slate-200 text-slate-700 dark:bg-slate-800 dark:text-slate-300"), e === "refunded" && (n = "bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-300"), e === "failed" && (n = "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"), /* @__PURE__ */ s("span", {
184
+ className: `${t === "lg" ? "px-3 py-1 text-sm" : "px-2 py-0.5 text-xs"} rounded-full font-medium capitalize ${n}`,
185
+ children: e
186
+ });
134
187
  }
135
- export {
136
- O as OrderDetailPage
137
- };
188
+ //#endregion
189
+ export { d as OrderDetailPage };
@@ -0,0 +1 @@
1
+ "use client";let e=require("lucide-react"),t=require("react/jsx-runtime"),n=require("@nextblock-cms/ui");function r({disabled:r=!1}){return(0,t.jsxs)(n.Button,{type:`button`,variant:`outline`,onClick:()=>window.print(),disabled:r,children:[(0,t.jsx)(e.Printer,{className:`mr-2 h-4 w-4`}),`Print / Save as PDF`]})}exports.OrderPrintButton=r;
@@ -1,3 +1,3 @@
1
1
  export declare function OrderPrintButton({ disabled }: {
2
2
  disabled?: boolean;
3
- }): import("react").JSX.Element;
3
+ }): import('react').JSX.Element;
@@ -1,22 +1,16 @@
1
- 'use client';
2
- import { jsxs as t, jsx as n } from "react/jsx-runtime";
3
- import { Printer as o } from "lucide-react";
4
- import { Button as i } from "@nextblock-cms/ui";
5
- function s({ disabled: r = !1 }) {
6
- return /* @__PURE__ */ t(
7
- i,
8
- {
9
- type: "button",
10
- variant: "outline",
11
- onClick: () => window.print(),
12
- disabled: r,
13
- children: [
14
- /* @__PURE__ */ n(o, { className: "mr-2 h-4 w-4" }),
15
- "Print / Save as PDF"
16
- ]
17
- }
18
- );
1
+ "use client";
2
+ import { Printer as e } from "lucide-react";
3
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
+ import { Button as r } from "@nextblock-cms/ui";
5
+ //#region src/lib/pages/cms/orders/OrderPrintButton.tsx
6
+ function i({ disabled: i = !1 }) {
7
+ return /* @__PURE__ */ n(r, {
8
+ type: "button",
9
+ variant: "outline",
10
+ onClick: () => window.print(),
11
+ disabled: i,
12
+ children: [/* @__PURE__ */ t(e, { className: "mr-2 h-4 w-4" }), "Print / Save as PDF"]
13
+ });
19
14
  }
20
- export {
21
- s as OrderPrintButton
22
- };
15
+ //#endregion
16
+ export { i as OrderPrintButton };
@@ -0,0 +1 @@
1
+ "use client";const e=require("./server-actions.cjs");let t=require("react"),n=require("react/jsx-runtime"),r=require("next/navigation"),i=require("@nextblock-cms/ui");var a=[{value:`pending`,label:`Pending`},{value:`trial`,label:`Trial`},{value:`paid`,label:`Paid`},{value:`shipped`,label:`Shipped`},{value:`cancelled`,label:`Cancelled`},{value:`refunded`,label:`Refunded`}];function o({orderId:o,currentStatus:s}){let c=(0,r.useRouter)(),[l,u]=(0,t.useState)(a.some(e=>e.value===s)?s:`pending`),[d,f]=(0,t.useState)(null),[p,m]=(0,t.useTransition)(),h=(0,t.useMemo)(()=>l!==s,[s,l]);return(0,n.jsxs)(`div`,{className:`rounded-lg border bg-white p-4 dark:border-slate-800 dark:bg-slate-900`,children:[(0,n.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end`,children:[(0,n.jsxs)(`div`,{className:`min-w-[220px] flex-1 space-y-2`,children:[(0,n.jsx)(`p`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-500`,children:`Order Status`}),(0,n.jsxs)(i.Select,{value:l,onValueChange:e=>{u(e),f(null)},children:[(0,n.jsx)(i.SelectTrigger,{children:(0,n.jsx)(i.SelectValue,{placeholder:`Select status`})}),(0,n.jsx)(i.SelectContent,{children:a.map(e=>(0,n.jsx)(i.SelectItem,{value:e.value,children:e.label},e.value))})]})]}),(0,n.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,n.jsx)(i.Button,{type:`button`,onClick:()=>{h&&(f(null),m(async()=>{try{let t=await e.updateOrderStatus(o,l);if(!t.success){f(t.error||`Failed to update order status.`);return}c.refresh()}catch(e){console.error(e),f(`Unexpected error while saving the order status.`)}}))},disabled:p||!h,children:p?`Saving...`:`Save`})})]}),d?(0,n.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:d}):h?null:(0,n.jsx)(`p`,{className:`mt-2 text-xs text-slate-500`,children:`Status is already up to date.`})]})}exports.OrderStatusForm=o;
@@ -1,4 +1,4 @@
1
1
  export declare function OrderStatusForm({ orderId, currentStatus, }: {
2
2
  orderId: string;
3
3
  currentStatus: string;
4
- }): import("react").JSX.Element;
4
+ }): import('react').JSX.Element;
@@ -1,71 +1,87 @@
1
- 'use client';
2
- import { jsxs as s, jsx as l } from "react/jsx-runtime";
3
- import { useState as c, useTransition as v, useMemo as g } from "react";
4
- import { useRouter as S } from "next/navigation";
5
- import { Select as f, SelectTrigger as b, SelectValue as N, SelectContent as T, SelectItem as O, Button as k } from "@nextblock-cms/ui";
6
- import { updateOrderStatus as w } from "./server-actions.es.js";
7
- const o = [
8
- { value: "pending", label: "Pending" },
9
- { value: "trial", label: "Trial" },
10
- { value: "paid", label: "Paid" },
11
- { value: "shipped", label: "Shipped" },
12
- { value: "cancelled", label: "Cancelled" },
13
- { value: "refunded", label: "Refunded" }
1
+ "use client";
2
+ import { updateOrderStatus as e } from "./server-actions.es.js";
3
+ import { useMemo as t, useState as n, useTransition as r } from "react";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ import { useRouter as o } from "next/navigation";
6
+ import { Button as s, Select as c, SelectContent as l, SelectItem as u, SelectTrigger as d, SelectValue as f } from "@nextblock-cms/ui";
7
+ //#region src/lib/pages/cms/orders/OrderStatusForm.tsx
8
+ var p = [
9
+ {
10
+ value: "pending",
11
+ label: "Pending"
12
+ },
13
+ {
14
+ value: "trial",
15
+ label: "Trial"
16
+ },
17
+ {
18
+ value: "paid",
19
+ label: "Paid"
20
+ },
21
+ {
22
+ value: "shipped",
23
+ label: "Shipped"
24
+ },
25
+ {
26
+ value: "cancelled",
27
+ label: "Cancelled"
28
+ },
29
+ {
30
+ value: "refunded",
31
+ label: "Refunded"
32
+ }
14
33
  ];
15
- function F({
16
- orderId: u,
17
- currentStatus: t
18
- }) {
19
- const m = S(), [a, p] = c(
20
- o.some((e) => e.value === t) ? t : "pending"
21
- ), [d, r] = c(null), [i, h] = v(), n = g(
22
- () => a !== t,
23
- [t, a]
24
- ), x = () => {
25
- n && (r(null), h(async () => {
26
- try {
27
- const e = await w(u, a);
28
- if (!e.success) {
29
- r(e.error || "Failed to update order status.");
30
- return;
31
- }
32
- m.refresh();
33
- } catch (e) {
34
- console.error(e), r("Unexpected error while saving the order status.");
35
- }
36
- }));
37
- };
38
- return /* @__PURE__ */ s("div", { className: "rounded-lg border bg-white p-4 dark:border-slate-800 dark:bg-slate-900", children: [
39
- /* @__PURE__ */ s("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-end", children: [
40
- /* @__PURE__ */ s("div", { className: "min-w-[220px] flex-1 space-y-2", children: [
41
- /* @__PURE__ */ l("p", { className: "text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-500", children: "Order Status" }),
42
- /* @__PURE__ */ s(
43
- f,
44
- {
45
- value: a,
46
- onValueChange: (e) => {
47
- p(e), r(null);
48
- },
49
- children: [
50
- /* @__PURE__ */ l(b, { children: /* @__PURE__ */ l(N, { placeholder: "Select status" }) }),
51
- /* @__PURE__ */ l(T, { children: o.map((e) => /* @__PURE__ */ l(O, { value: e.value, children: e.label }, e.value)) })
52
- ]
53
- }
54
- )
55
- ] }),
56
- /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ l(
57
- k,
58
- {
59
- type: "button",
60
- onClick: x,
61
- disabled: i || !n,
62
- children: i ? "Saving..." : "Save"
63
- }
64
- ) })
65
- ] }),
66
- d ? /* @__PURE__ */ l("p", { className: "mt-2 text-xs text-red-600 dark:text-red-400", children: d }) : n ? null : /* @__PURE__ */ l("p", { className: "mt-2 text-xs text-slate-500", children: "Status is already up to date." })
67
- ] });
34
+ function m({ orderId: m, currentStatus: h }) {
35
+ let g = o(), [_, v] = n(p.some((e) => e.value === h) ? h : "pending"), [y, b] = n(null), [x, S] = r(), C = t(() => _ !== h, [h, _]);
36
+ return /* @__PURE__ */ a("div", {
37
+ className: "rounded-lg border bg-white p-4 dark:border-slate-800 dark:bg-slate-900",
38
+ children: [/* @__PURE__ */ a("div", {
39
+ className: "flex flex-col gap-3 sm:flex-row sm:items-end",
40
+ children: [/* @__PURE__ */ a("div", {
41
+ className: "min-w-[220px] flex-1 space-y-2",
42
+ children: [/* @__PURE__ */ i("p", {
43
+ className: "text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-500",
44
+ children: "Order Status"
45
+ }), /* @__PURE__ */ a(c, {
46
+ value: _,
47
+ onValueChange: (e) => {
48
+ v(e), b(null);
49
+ },
50
+ children: [/* @__PURE__ */ i(d, { children: /* @__PURE__ */ i(f, { placeholder: "Select status" }) }), /* @__PURE__ */ i(l, { children: p.map((e) => /* @__PURE__ */ i(u, {
51
+ value: e.value,
52
+ children: e.label
53
+ }, e.value)) })]
54
+ })]
55
+ }), /* @__PURE__ */ i("div", {
56
+ className: "flex items-center gap-2",
57
+ children: /* @__PURE__ */ i(s, {
58
+ type: "button",
59
+ onClick: () => {
60
+ C && (b(null), S(async () => {
61
+ try {
62
+ let t = await e(m, _);
63
+ if (!t.success) {
64
+ b(t.error || "Failed to update order status.");
65
+ return;
66
+ }
67
+ g.refresh();
68
+ } catch (e) {
69
+ console.error(e), b("Unexpected error while saving the order status.");
70
+ }
71
+ }));
72
+ },
73
+ disabled: x || !C,
74
+ children: x ? "Saving..." : "Save"
75
+ })
76
+ })]
77
+ }), y ? /* @__PURE__ */ i("p", {
78
+ className: "mt-2 text-xs text-red-600 dark:text-red-400",
79
+ children: y
80
+ }) : C ? null : /* @__PURE__ */ i("p", {
81
+ className: "mt-2 text-xs text-slate-500",
82
+ children: "Status is already up to date."
83
+ })]
84
+ });
68
85
  }
69
- export {
70
- F as OrderStatusForm
71
- };
86
+ //#endregion
87
+ export { m as OrderStatusForm };
@@ -0,0 +1 @@
1
+ const e=require("../../../../_virtual/_rolldown/runtime.cjs"),t=require("./actions.cjs"),n=require("./ExportReportsDialog.cjs");let r=require("next/link");r=e.__toESM(r,1);let i=require("react/jsx-runtime");var a=(e,t=`usd`)=>new Intl.NumberFormat(`en-US`,{style:`currency`,currency:t}).format(e/100);async function o({searchParams:e}){let o=await e,c=Number(o.page)||1,l=o.status||`all`,{data:u,totalPages:d}=await t.getOrders(c,l);return(0,i.jsxs)(`div`,{className:`p-6 space-y-6`,children:[(0,i.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,i.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:`Orders`}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(n.ExportReportsDialog,{}),(0,i.jsx)(r.default,{href:`/cms/orders?page=${c}&status=${l}`,className:`px-3 py-2 text-sm font-medium border rounded hover:bg-gray-50 dark:hover:bg-slate-800`,children:`Refresh`})]})]}),(0,i.jsx)(`div`,{className:`flex gap-2 border-b pb-4`,children:[`all`,`paid`,`trial`,`pending`,`failed`].map(e=>(0,i.jsx)(r.default,{href:`/cms/orders?page=1&status=${e}`,className:`px-3 py-1 rounded-full text-sm font-medium capitalize ${l===e?`bg-black text-white dark:bg-white dark:text-black`:`bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-slate-800 dark:text-gray-300 dark:hover:bg-slate-700`}`,children:e},e))}),(0,i.jsx)(`div`,{className:`border rounded-lg overflow-hidden dark:border-slate-800`,children:(0,i.jsxs)(`table`,{className:`w-full text-sm text-left align-middle`,children:[(0,i.jsx)(`thead`,{className:`bg-gray-50 text-gray-500 font-medium border-b dark:bg-slate-900 dark:text-slate-400 dark:border-slate-800`,children:(0,i.jsxs)(`tr`,{children:[(0,i.jsx)(`th`,{className:`px-4 py-3`,children:`ID`}),(0,i.jsx)(`th`,{className:`px-4 py-3`,children:`Customer`}),(0,i.jsx)(`th`,{className:`px-4 py-3`,children:`Status`}),(0,i.jsx)(`th`,{className:`px-4 py-3`,children:`Provider`}),(0,i.jsx)(`th`,{className:`px-4 py-3 text-right`,children:`Amount`}),(0,i.jsx)(`th`,{className:`px-4 py-3 text-right`,children:`Date`}),(0,i.jsx)(`th`,{className:`px-4 py-3 text-right`,children:`Actions`})]})}),(0,i.jsx)(`tbody`,{className:`divide-y dark:divide-slate-800`,children:u.length===0?(0,i.jsx)(`tr`,{children:(0,i.jsx)(`td`,{colSpan:7,className:`px-4 py-8 text-center text-gray-500`,children:`No orders found.`})}):u.map(e=>{let t=e.customer_details,n=t?.name||t?.email||e.customer?.full_name||`Guest Customer`;return(0,i.jsxs)(`tr`,{className:`hover:bg-gray-50 dark:hover:bg-slate-800/50`,children:[(0,i.jsxs)(`td`,{className:`px-4 py-3 font-mono text-gray-500`,children:[e.id.slice(0,8),`...`]}),(0,i.jsx)(`td`,{className:`px-4 py-3 font-medium`,children:n}),(0,i.jsx)(`td`,{className:`px-4 py-3`,children:(0,i.jsx)(s,{status:e.status})}),(0,i.jsx)(`td`,{className:`px-4 py-3 capitalize text-gray-600 dark:text-gray-400`,children:e.provider===`freemius`?`Freemius`:`Stripe`}),(0,i.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,i.jsxs)(`div`,{className:`flex flex-col items-end`,children:[(0,i.jsx)(`span`,{children:a(e.total,e.currency||`usd`)}),e.discount_total?(0,i.jsxs)(`span`,{className:`text-[10px] text-emerald-600`,children:[e.coupon_code,` -`,a(e.discount_total,e.currency||`usd`)]}):null]})}),(0,i.jsx)(`td`,{className:`px-4 py-3 text-right text-gray-500 whitespace-nowrap`,children:new Date(e.created_at||``).toLocaleDateString()}),(0,i.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,i.jsx)(r.default,{href:`/cms/orders/${e.id}`,className:`text-blue-600 hover:underline dark:text-blue-400`,children:`View`})})]},e.id)})})]})}),(0,i.jsxs)(`div`,{className:`flex justify-between items-center pt-4`,children:[(0,i.jsxs)(`div`,{className:`text-sm text-gray-500`,children:[`Page `,c,` of `,d]}),(0,i.jsxs)(`div`,{className:`flex gap-2`,children:[(0,i.jsx)(r.default,{href:`/cms/orders?page=${Math.max(1,c-1)}&status=${l}`,className:`px-3 py-1 border rounded text-sm ${c<=1?`pointer-events-none opacity-50`:`hover:bg-gray-50 dark:hover:bg-slate-800`}`,children:`Previous`}),(0,i.jsx)(r.default,{href:`/cms/orders?page=${Math.min(d,c+1)}&status=${l}`,className:`px-3 py-1 border rounded text-sm ${c>=d?`pointer-events-none opacity-50`:`hover:bg-gray-50 dark:hover:bg-slate-800`}`,children:`Next`})]})]})]})}function s({status:e}){let t=`bg-gray-100 text-gray-700 dark:bg-slate-800 dark:text-gray-300`;return e===`paid`&&(t=`bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400`),e===`trial`&&(t=`bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300`),e===`pending`&&(t=`bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400`),e===`failed`&&(t=`bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400`),(0,i.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium capitalize ${t}`,children:e})}exports.OrdersPage=o;
@@ -3,4 +3,4 @@ export declare function OrdersPage({ searchParams, }: {
3
3
  page?: string;
4
4
  status?: string;
5
5
  }>;
6
- }): Promise<import("react").JSX.Element>;
6
+ }): Promise<import('react').JSX.Element>;