@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
+ "use client";const e=require("../invoice-ui.cjs");let t=require("react"),n=require("@nextblock-cms/utils"),r=require("react/jsx-runtime");var i=({images:i=[],className:a})=>{let{t:o}=(0,n.useTranslations)(),[s,c]=(0,t.useState)(0);if(!i.length)return(0,r.jsx)(`div`,{className:(0,n.cn)(`relative aspect-square w-full overflow-hidden rounded-lg bg-secondary`,a),children:(0,r.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:e.translateOrFallback(o,`ecommerce.no_image`,`No image`)})});let l=s<i.length?s:0,u=i[l];return(0,r.jsxs)(`div`,{className:(0,n.cn)(`flex flex-col gap-4`,a),children:[(0,r.jsx)(`div`,{className:`relative aspect-square w-full overflow-hidden rounded-lg border bg-white`,children:(0,r.jsx)(`img`,{src:u.url,alt:u.alt??``,width:u.width??1e3,height:u.height??1e3,fetchPriority:`high`,decoding:`async`,className:`h-full w-full object-cover object-center`})}),i.length>1&&(0,r.jsx)(`div`,{className:`flex gap-4 overflow-x-auto p-1 pb-2`,children:i.map((t,a)=>(0,r.jsx)(`button`,{type:`button`,onClick:()=>c(a),"aria-current":l===a?`true`:void 0,"aria-label":e.translateOrFallback(o,`ecommerce.gallery_show_image`,`Show image {index} of {total}`).replace(`{index}`,String(a+1)).replace(`{total}`,String(i.length)),className:(0,n.cn)(`relative aspect-square w-20 flex-shrink-0 overflow-hidden rounded-md border focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring`,l===a?`ring-2 ring-primary`:`ring-1 ring-transparent hover:ring-primary/50`),children:(0,r.jsx)(`img`,{src:t.url,alt:``,width:80,height:80,loading:`lazy`,decoding:`async`,className:`h-full w-full object-cover object-center`})},a))})]})};exports.ProductGallery=i;
@@ -7,5 +7,5 @@ interface ProductGalleryProps {
7
7
  }[];
8
8
  className?: string;
9
9
  }
10
- export declare const ProductGallery: ({ images, className }: ProductGalleryProps) => import("react").JSX.Element;
10
+ export declare const ProductGallery: ({ images, className }: ProductGalleryProps) => import('react').JSX.Element;
11
11
  export {};
@@ -1,55 +1,52 @@
1
- 'use client';
2
- import { jsx as e, jsxs as u } from "react/jsx-runtime";
3
- import { useTranslations as g, cn as o } from "@nextblock-cms/utils";
4
- import { useState as f } from "react";
5
- import { translateOrFallback as s } from "../invoice-ui.es.js";
6
- const w = ({ images: r = [], className: n }) => {
7
- const { t: a } = g(), [c, d] = f(0);
8
- if (!r.length)
9
- return /* @__PURE__ */ e("div", { className: o("relative aspect-square w-full overflow-hidden rounded-lg bg-secondary", n), children: /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center text-muted-foreground", children: s(a, "ecommerce.no_image", "No image") }) });
10
- const i = c < r.length ? c : 0, l = r[i];
11
- return /* @__PURE__ */ u("div", { className: o("flex flex-col gap-4", n), children: [
12
- /* @__PURE__ */ e("div", { className: "relative aspect-square w-full overflow-hidden rounded-lg border bg-white", children: /* @__PURE__ */ e(
13
- "img",
14
- {
15
- src: l.url,
16
- alt: l.alt ?? "",
17
- width: l.width ?? 1e3,
18
- height: l.height ?? 1e3,
19
- fetchPriority: "high",
20
- decoding: "async",
21
- className: "h-full w-full object-cover object-center"
22
- }
23
- ) }),
24
- r.length > 1 && // p-1: `overflow-x-auto` also clips vertically, which cut off the selection ring.
25
- /* @__PURE__ */ e("div", { className: "flex gap-4 overflow-x-auto p-1 pb-2", children: r.map((h, t) => /* @__PURE__ */ e(
26
- "button",
27
- {
28
- type: "button",
29
- onClick: () => d(t),
30
- "aria-current": i === t ? "true" : void 0,
31
- "aria-label": s(a, "ecommerce.gallery_show_image", "Show image {index} of {total}").replace("{index}", String(t + 1)).replace("{total}", String(r.length)),
32
- className: o(
33
- "relative aspect-square w-20 flex-shrink-0 overflow-hidden rounded-md border focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
34
- i === t ? "ring-2 ring-primary" : "ring-1 ring-transparent hover:ring-primary/50"
35
- ),
36
- children: /* @__PURE__ */ e(
37
- "img",
38
- {
39
- src: h.url,
40
- alt: "",
41
- width: 80,
42
- height: 80,
43
- loading: "lazy",
44
- decoding: "async",
45
- className: "h-full w-full object-cover object-center"
46
- }
47
- )
48
- },
49
- t
50
- )) })
51
- ] });
52
- };
53
- export {
54
- w as ProductGallery
1
+ "use client";
2
+ import { translateOrFallback as e } from "../invoice-ui.es.js";
3
+ import { useState as t } from "react";
4
+ import { cn as n, useTranslations as r } from "@nextblock-cms/utils";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ //#region src/lib/components/ProductGallery.tsx
7
+ var o = ({ images: o = [], className: s }) => {
8
+ let { t: c } = r(), [l, u] = t(0);
9
+ if (!o.length) return /* @__PURE__ */ i("div", {
10
+ className: n("relative aspect-square w-full overflow-hidden rounded-lg bg-secondary", s),
11
+ children: /* @__PURE__ */ i("div", {
12
+ className: "flex h-full items-center justify-center text-muted-foreground",
13
+ children: e(c, "ecommerce.no_image", "No image")
14
+ })
15
+ });
16
+ let d = l < o.length ? l : 0, f = o[d];
17
+ return /* @__PURE__ */ a("div", {
18
+ className: n("flex flex-col gap-4", s),
19
+ children: [/* @__PURE__ */ i("div", {
20
+ className: "relative aspect-square w-full overflow-hidden rounded-lg border bg-white",
21
+ children: /* @__PURE__ */ i("img", {
22
+ src: f.url,
23
+ alt: f.alt ?? "",
24
+ width: f.width ?? 1e3,
25
+ height: f.height ?? 1e3,
26
+ fetchPriority: "high",
27
+ decoding: "async",
28
+ className: "h-full w-full object-cover object-center"
29
+ })
30
+ }), o.length > 1 && /* @__PURE__ */ i("div", {
31
+ className: "flex gap-4 overflow-x-auto p-1 pb-2",
32
+ children: o.map((t, r) => /* @__PURE__ */ i("button", {
33
+ type: "button",
34
+ onClick: () => u(r),
35
+ "aria-current": d === r ? "true" : void 0,
36
+ "aria-label": e(c, "ecommerce.gallery_show_image", "Show image {index} of {total}").replace("{index}", String(r + 1)).replace("{total}", String(o.length)),
37
+ className: n("relative aspect-square w-20 flex-shrink-0 overflow-hidden rounded-md border focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring", d === r ? "ring-2 ring-primary" : "ring-1 ring-transparent hover:ring-primary/50"),
38
+ children: /* @__PURE__ */ i("img", {
39
+ src: t.url,
40
+ alt: "",
41
+ width: 80,
42
+ height: 80,
43
+ loading: "lazy",
44
+ decoding: "async",
45
+ className: "h-full w-full object-cover object-center"
46
+ })
47
+ }, r))
48
+ })]
49
+ });
55
50
  };
51
+ //#endregion
52
+ export { o as ProductGallery };
@@ -0,0 +1 @@
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./ProductCard.cjs");let t=require("@nextblock-cms/utils"),n=require("react/jsx-runtime");var r=({products:r,columns:i=3,className:a})=>{let{t:o}=(0,t.useTranslations)();if(!r.length){let e=o(`ecommerce.no_products_found`);return(0,n.jsx)(`div`,{className:`py-12 text-center text-muted-foreground`,children:e===`ecommerce.no_products_found`?`No products found.`:e})}return(0,n.jsx)(`div`,{className:(0,t.cn)(`grid gap-6 sm:grid-cols-2`,i===3&&`lg:grid-cols-3`,i===4&&`lg:grid-cols-4`,a),children:r.map((t,r)=>(0,n.jsx)(e.ProductCard,{product:t,priority:r<i},t.id))})};exports.ProductGrid=r;
@@ -4,5 +4,5 @@ interface ProductGridProps {
4
4
  columns?: 2 | 3 | 4;
5
5
  className?: string;
6
6
  }
7
- export declare const ProductGrid: ({ products, columns, className }: ProductGridProps) => import("react").JSX.Element;
7
+ export declare const ProductGrid: ({ products, columns, className }: ProductGridProps) => import('react').JSX.Element;
8
8
  export {};
@@ -1,26 +1,24 @@
1
- 'use client';
2
- import { jsx as e } from "react/jsx-runtime";
3
- import { ProductCard as n } from "./ProductCard.es.js";
4
- import { useTranslations as s, cn as m } from "@nextblock-cms/utils";
5
- const g = ({ products: t, columns: o = 3, className: d }) => {
6
- const { t: c } = s();
7
- if (!t.length) {
8
- const r = c("ecommerce.no_products_found");
9
- return /* @__PURE__ */ e("div", { className: "py-12 text-center text-muted-foreground", children: r === "ecommerce.no_products_found" ? "No products found." : r });
10
- }
11
- return /* @__PURE__ */ e(
12
- "div",
13
- {
14
- className: m(
15
- "grid gap-6 sm:grid-cols-2",
16
- o === 3 && "lg:grid-cols-3",
17
- o === 4 && "lg:grid-cols-4",
18
- d
19
- ),
20
- children: t.map((r, i) => /* @__PURE__ */ e(n, { product: r, priority: i < o }, r.id))
21
- }
22
- );
23
- };
24
- export {
25
- g as ProductGrid
1
+ "use client";
2
+ import { ProductCard as e } from "./ProductCard.es.js";
3
+ import { cn as t, useTranslations as n } from "@nextblock-cms/utils";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ //#region src/lib/components/ProductGrid.tsx
6
+ var i = ({ products: i, columns: a = 3, className: o }) => {
7
+ let { t: s } = n();
8
+ if (!i.length) {
9
+ let e = s("ecommerce.no_products_found");
10
+ return /* @__PURE__ */ r("div", {
11
+ className: "py-12 text-center text-muted-foreground",
12
+ children: e === "ecommerce.no_products_found" ? "No products found." : e
13
+ });
14
+ }
15
+ return /* @__PURE__ */ r("div", {
16
+ className: t("grid gap-6 sm:grid-cols-2", a === 3 && "lg:grid-cols-3", a === 4 && "lg:grid-cols-4", o),
17
+ children: i.map((t, n) => /* @__PURE__ */ r(e, {
18
+ product: t,
19
+ priority: n < a
20
+ }, t.id))
21
+ });
26
22
  };
23
+ //#endregion
24
+ export { i as ProductGrid };
@@ -0,0 +1 @@
1
+ "use client";const e=require("../CurrencyProvider.cjs"),t=require("../use-price-formatter.cjs"),n=require("../countries.cjs"),r=require("../states.cjs"),i=require("../server-actions/shipping-actions.cjs");let a=require("@nextblock-cms/ui/button"),o=require("react"),s=require("lucide-react"),c=require("@nextblock-cms/utils"),l=require("react/jsx-runtime"),u=require("@nextblock-cms/ui/input"),d=require("@nextblock-cms/ui/label");var f=({physicalSubtotal:f})=>{let p=t.usePriceFormatter(),[m,h]=(0,o.useState)(`CA`),[g,_]=(0,o.useState)(``),[v,y]=(0,o.useState)(``),[b,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),[w,T]=(0,o.useState)(null),{t:E,lang:D}=(0,c.useTranslations)(),{activeCurrencyCode:O}=e.useCurrency(),k=(e,t)=>{let n=E(e);return n===e?t:n},A=r.getStatesForCountry(m),j=r.countryUsesStructuredStates(m),M=(0,o.useMemo)(()=>{try{return new Intl.DisplayNames([D],{type:`region`})}catch{return null}},[D]),N=k(`select_an_option`,`Select an option`),P=k(`state_province`,`State / Province`),F=async()=>{x(!0),T(null),C(null);try{let e=await i.getShippingEstimates(f,{country:m,state:g||void 0,postal_code:v},D,O);e.success&&e.methods?C(e.methods):T(e.errorKey?k(e.errorKey,e.error||E(`ecommerce.no_rates_found`)):e.error||E(`ecommerce.no_rates_found`))}catch(e){console.error(`[ShippingEstimator] Failed to load rates:`,e),T(k(`ecommerce.shipping_calculation_failed`,`We couldn't calculate shipping right now. Please try again.`))}finally{x(!1)}};return(0,l.jsxs)(`div`,{className:`space-y-4 rounded-lg border bg-muted/30 p-4 mt-6`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2 font-semibold text-sm`,children:[(0,l.jsx)(s.Truck,{className:`h-4 w-4`}),(0,l.jsx)(`span`,{children:E(`ecommerce.estimate_shipping`)})]}),(0,l.jsxs)(`div`,{className:`grid gap-3`,children:[(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,l.jsx)(d.Label,{htmlFor:`estimate-country`,className:`text-xs uppercase tracking-wider text-muted-foreground`,children:E(`ecommerce.country`)}),(0,l.jsx)(`select`,{id:`estimate-country`,name:`estimate-country`,autoComplete:`shipping country`,value:m,onChange:e=>{let t=e.target.value,n=r.getStatesForCountry(t);h(t),_(n.some(e=>e.code===g)?g:``)},className:`flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,children:n.countries.map(e=>(0,l.jsx)(`option`,{value:e.code,children:M?.of(e.code)??e.name},e.code))})]}),j&&(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,l.jsx)(d.Label,{htmlFor:`estimate-state`,className:`text-xs uppercase tracking-wider text-muted-foreground`,children:E(`state_province`)}),(0,l.jsxs)(`select`,{id:`estimate-state`,name:`estimate-state`,autoComplete:`shipping address-level1`,value:g,onChange:e=>_(e.target.value),className:`flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,children:[(0,l.jsx)(`option`,{value:``,children:`${N}: ${P}`}),A.map(e=>(0,l.jsx)(`option`,{value:e.code,children:r.getSubdivisionLabel(m,e,D)},e.code))]})]}),(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,l.jsx)(d.Label,{htmlFor:`estimate-postal`,className:`text-xs uppercase tracking-wider text-muted-foreground`,children:E(`ecommerce.postal_code`)}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsx)(u.Input,{id:`estimate-postal`,name:`estimate-postal`,autoComplete:`shipping postal-code`,placeholder:m===`CA`?`A1A 1A1`:void 0,value:v,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!b&&(e.preventDefault(),F())},className:`h-9 text-sm bg-background`}),(0,l.jsxs)(a.Button,{size:`sm`,variant:`secondary`,onClick:F,disabled:b,className:`shrink-0`,children:[b?(0,l.jsx)(s.Loader2,{className:`h-4 w-4 mr-1.5 animate-spin`}):(0,l.jsx)(s.Calculator,{className:`h-4 w-4 mr-1.5`}),E(`ecommerce.calculate`)]})]})]})]}),w&&(0,l.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive mt-2`,children:w}),(0,l.jsxs)(`div`,{"aria-live":`polite`,children:[S&&S.length>0&&(0,l.jsxs)(`div`,{className:`mt-4 space-y-2 border-t pt-3`,children:[(0,l.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground uppercase`,children:[E(`ecommerce.available_rates`),`:`]}),S.map(e=>(0,l.jsxs)(`div`,{className:`flex justify-between items-center p-3 border rounded-lg bg-muted/30`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(s.Truck,{className:`h-4 w-4 text-muted-foreground`}),(0,l.jsx)(`span`,{className:`text-sm font-medium`,children:e.name})]}),(0,l.jsx)(`span`,{className:`text-sm font-bold tabular-nums`,children:e.amount===0?E(`ecommerce.free`):p(e.amount,O)})]},e.id))]}),S&&S.length===0&&!w&&(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground mt-2 italic`,children:E(`ecommerce.no_rates_found`)})]})]})};exports.ShippingEstimator=f;
@@ -1,5 +1,5 @@
1
1
  interface ShippingEstimatorProps {
2
2
  physicalSubtotal: number;
3
3
  }
4
- export declare const ShippingEstimator: ({ physicalSubtotal }: ShippingEstimatorProps) => import("react").JSX.Element;
4
+ export declare const ShippingEstimator: ({ physicalSubtotal }: ShippingEstimatorProps) => import('react').JSX.Element;
5
5
  export {};
@@ -1,154 +1,159 @@
1
- 'use client';
2
- import { jsxs as a, jsx as t } from "react/jsx-runtime";
3
- import { useState as o, useMemo as I } from "react";
4
- import { Button as K } from "@nextblock-cms/ui/button";
5
- import { Input as O } from "@nextblock-cms/ui/input";
6
- import { Label as g } from "@nextblock-cms/ui/label";
7
- import { Truck as C, Loader2 as T, Calculator as $ } from "lucide-react";
8
- import { countries as z } from "../countries.es.js";
9
- import { getShippingEstimates as B } from "../server-actions/shipping-actions.es.js";
10
- import { useTranslations as M } from "@nextblock-cms/utils";
11
- import { usePriceFormatter as R } from "../use-price-formatter.es.js";
12
- import { getStatesForCountry as _, countryUsesStructuredStates as U, getSubdivisionLabel as W } from "../states.es.js";
13
- import { useCurrency as q } from "../CurrencyProvider.es.js";
14
- const se = ({ physicalSubtotal: S }) => {
15
- const w = R(), [s, k] = o("CA"), [c, f] = o(""), [x, F] = o(""), [u, v] = o(!1), [n, y] = o(null), [p, h] = o(null), { t: r, lang: l } = M(), { activeCurrencyCode: N } = q(), i = (e, m) => {
16
- const d = r(e);
17
- return d === e ? m : d;
18
- }, E = _(s), P = U(s), A = I(() => {
19
- try {
20
- return new Intl.DisplayNames([l], { type: "region" });
21
- } catch {
22
- return null;
23
- }
24
- }, [l]), L = i("select_an_option", "Select an option"), j = i("state_province", "State / Province"), b = async () => {
25
- v(!0), h(null), y(null);
26
- try {
27
- const e = await B(
28
- S,
29
- {
30
- country: s,
31
- state: c || void 0,
32
- postal_code: x
33
- },
34
- l,
35
- N
36
- );
37
- e.success && e.methods ? y(e.methods) : h(
38
- e.errorKey ? i(
39
- e.errorKey,
40
- e.error || r("ecommerce.no_rates_found")
41
- ) : e.error || r("ecommerce.no_rates_found")
42
- );
43
- } catch (e) {
44
- console.error("[ShippingEstimator] Failed to load rates:", e), h(
45
- i(
46
- "ecommerce.shipping_calculation_failed",
47
- "We couldn't calculate shipping right now. Please try again."
48
- )
49
- );
50
- } finally {
51
- v(!1);
52
- }
53
- };
54
- return /* @__PURE__ */ a("div", { className: "space-y-4 rounded-lg border bg-muted/30 p-4 mt-6", children: [
55
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2 font-semibold text-sm", children: [
56
- /* @__PURE__ */ t(C, { className: "h-4 w-4" }),
57
- /* @__PURE__ */ t("span", { children: r("ecommerce.estimate_shipping") })
58
- ] }),
59
- /* @__PURE__ */ a("div", { className: "grid gap-3", children: [
60
- /* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
61
- /* @__PURE__ */ t(g, { htmlFor: "estimate-country", className: "text-xs uppercase tracking-wider text-muted-foreground", children: r("ecommerce.country") }),
62
- /* @__PURE__ */ t(
63
- "select",
64
- {
65
- id: "estimate-country",
66
- name: "estimate-country",
67
- autoComplete: "shipping country",
68
- value: s,
69
- onChange: (e) => {
70
- const m = e.target.value, d = _(m);
71
- k(m), f(
72
- d.some((D) => D.code === c) ? c : ""
73
- );
74
- },
75
- className: "flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
76
- children: z.map((e) => /* @__PURE__ */ t("option", { value: e.code, children: A?.of(e.code) ?? e.name }, e.code))
77
- }
78
- )
79
- ] }),
80
- P && /* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
81
- /* @__PURE__ */ t(g, { htmlFor: "estimate-state", className: "text-xs uppercase tracking-wider text-muted-foreground", children: r("state_province") }),
82
- /* @__PURE__ */ a(
83
- "select",
84
- {
85
- id: "estimate-state",
86
- name: "estimate-state",
87
- autoComplete: "shipping address-level1",
88
- value: c,
89
- onChange: (e) => f(e.target.value),
90
- className: "flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
91
- children: [
92
- /* @__PURE__ */ t("option", { value: "", children: `${L}: ${j}` }),
93
- E.map((e) => /* @__PURE__ */ t("option", { value: e.code, children: W(s, e, l) }, e.code))
94
- ]
95
- }
96
- )
97
- ] }),
98
- /* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
99
- /* @__PURE__ */ t(g, { htmlFor: "estimate-postal", className: "text-xs uppercase tracking-wider text-muted-foreground", children: r("ecommerce.postal_code") }),
100
- /* @__PURE__ */ a("div", { className: "flex gap-2", children: [
101
- /* @__PURE__ */ t(
102
- O,
103
- {
104
- id: "estimate-postal",
105
- name: "estimate-postal",
106
- autoComplete: "shipping postal-code",
107
- placeholder: s === "CA" ? "A1A 1A1" : void 0,
108
- value: x,
109
- onChange: (e) => F(e.target.value),
110
- onKeyDown: (e) => {
111
- e.key === "Enter" && !u && (e.preventDefault(), b());
112
- },
113
- className: "h-9 text-sm bg-background"
114
- }
115
- ),
116
- /* @__PURE__ */ a(
117
- K,
118
- {
119
- size: "sm",
120
- variant: "secondary",
121
- onClick: b,
122
- disabled: u,
123
- className: "shrink-0",
124
- children: [
125
- u ? /* @__PURE__ */ t(T, { className: "h-4 w-4 mr-1.5 animate-spin" }) : /* @__PURE__ */ t($, { className: "h-4 w-4 mr-1.5" }),
126
- r("ecommerce.calculate")
127
- ]
128
- }
129
- )
130
- ] })
131
- ] })
132
- ] }),
133
- p && /* @__PURE__ */ t("p", { role: "alert", className: "text-xs text-destructive mt-2", children: p }),
134
- /* @__PURE__ */ a("div", { "aria-live": "polite", children: [
135
- n && n.length > 0 && /* @__PURE__ */ a("div", { className: "mt-4 space-y-2 border-t pt-3", children: [
136
- /* @__PURE__ */ a("p", { className: "text-xs font-medium text-muted-foreground uppercase", children: [
137
- r("ecommerce.available_rates"),
138
- ":"
139
- ] }),
140
- n.map((e) => /* @__PURE__ */ a("div", { className: "flex justify-between items-center p-3 border rounded-lg bg-muted/30", children: [
141
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
142
- /* @__PURE__ */ t(C, { className: "h-4 w-4 text-muted-foreground" }),
143
- /* @__PURE__ */ t("span", { className: "text-sm font-medium", children: e.name })
144
- ] }),
145
- /* @__PURE__ */ t("span", { className: "text-sm font-bold tabular-nums", children: e.amount === 0 ? r("ecommerce.free") : w(e.amount, N) })
146
- ] }, e.id))
147
- ] }),
148
- n && n.length === 0 && !p && /* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground mt-2 italic", children: r("ecommerce.no_rates_found") })
149
- ] })
150
- ] });
151
- };
152
- export {
153
- se as ShippingEstimator
1
+ "use client";
2
+ import { useCurrency as e } from "../CurrencyProvider.es.js";
3
+ import { usePriceFormatter as t } from "../use-price-formatter.es.js";
4
+ import { countries as n } from "../countries.es.js";
5
+ import { countryUsesStructuredStates as r, getStatesForCountry as i, getSubdivisionLabel as a } from "../states.es.js";
6
+ import { getShippingEstimates as o } from "../server-actions/shipping-actions.es.js";
7
+ import { Button as s } from "@nextblock-cms/ui/button";
8
+ import { useMemo as c, useState as l } from "react";
9
+ import { Calculator as u, Loader2 as d, Truck as f } from "lucide-react";
10
+ import { useTranslations as p } from "@nextblock-cms/utils";
11
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
12
+ import { Input as g } from "@nextblock-cms/ui/input";
13
+ import { Label as _ } from "@nextblock-cms/ui/label";
14
+ //#region src/lib/components/ShippingEstimator.tsx
15
+ var v = ({ physicalSubtotal: v }) => {
16
+ let y = t(), [b, x] = l("CA"), [S, C] = l(""), [w, T] = l(""), [E, D] = l(!1), [O, k] = l(null), [A, j] = l(null), { t: M, lang: N } = p(), { activeCurrencyCode: P } = e(), F = (e, t) => {
17
+ let n = M(e);
18
+ return n === e ? t : n;
19
+ }, I = i(b), L = r(b), R = c(() => {
20
+ try {
21
+ return new Intl.DisplayNames([N], { type: "region" });
22
+ } catch {
23
+ return null;
24
+ }
25
+ }, [N]), z = F("select_an_option", "Select an option"), B = F("state_province", "State / Province"), V = async () => {
26
+ D(!0), j(null), k(null);
27
+ try {
28
+ let e = await o(v, {
29
+ country: b,
30
+ state: S || void 0,
31
+ postal_code: w
32
+ }, N, P);
33
+ e.success && e.methods ? k(e.methods) : j(e.errorKey ? F(e.errorKey, e.error || M("ecommerce.no_rates_found")) : e.error || M("ecommerce.no_rates_found"));
34
+ } catch (e) {
35
+ console.error("[ShippingEstimator] Failed to load rates:", e), j(F("ecommerce.shipping_calculation_failed", "We couldn't calculate shipping right now. Please try again."));
36
+ } finally {
37
+ D(!1);
38
+ }
39
+ };
40
+ return /* @__PURE__ */ h("div", {
41
+ className: "space-y-4 rounded-lg border bg-muted/30 p-4 mt-6",
42
+ children: [
43
+ /* @__PURE__ */ h("div", {
44
+ className: "flex items-center gap-2 font-semibold text-sm",
45
+ children: [/* @__PURE__ */ m(f, { className: "h-4 w-4" }), /* @__PURE__ */ m("span", { children: M("ecommerce.estimate_shipping") })]
46
+ }),
47
+ /* @__PURE__ */ h("div", {
48
+ className: "grid gap-3",
49
+ children: [
50
+ /* @__PURE__ */ h("div", {
51
+ className: "space-y-1.5",
52
+ children: [/* @__PURE__ */ m(_, {
53
+ htmlFor: "estimate-country",
54
+ className: "text-xs uppercase tracking-wider text-muted-foreground",
55
+ children: M("ecommerce.country")
56
+ }), /* @__PURE__ */ m("select", {
57
+ id: "estimate-country",
58
+ name: "estimate-country",
59
+ autoComplete: "shipping country",
60
+ value: b,
61
+ onChange: (e) => {
62
+ let t = e.target.value, n = i(t);
63
+ x(t), C(n.some((e) => e.code === S) ? S : "");
64
+ },
65
+ className: "flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
66
+ children: n.map((e) => /* @__PURE__ */ m("option", {
67
+ value: e.code,
68
+ children: R?.of(e.code) ?? e.name
69
+ }, e.code))
70
+ })]
71
+ }),
72
+ L && /* @__PURE__ */ h("div", {
73
+ className: "space-y-1.5",
74
+ children: [/* @__PURE__ */ m(_, {
75
+ htmlFor: "estimate-state",
76
+ className: "text-xs uppercase tracking-wider text-muted-foreground",
77
+ children: M("state_province")
78
+ }), /* @__PURE__ */ h("select", {
79
+ id: "estimate-state",
80
+ name: "estimate-state",
81
+ autoComplete: "shipping address-level1",
82
+ value: S,
83
+ onChange: (e) => C(e.target.value),
84
+ className: "flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
85
+ children: [/* @__PURE__ */ m("option", {
86
+ value: "",
87
+ children: `${z}: ${B}`
88
+ }), I.map((e) => /* @__PURE__ */ m("option", {
89
+ value: e.code,
90
+ children: a(b, e, N)
91
+ }, e.code))]
92
+ })]
93
+ }),
94
+ /* @__PURE__ */ h("div", {
95
+ className: "space-y-1.5",
96
+ children: [/* @__PURE__ */ m(_, {
97
+ htmlFor: "estimate-postal",
98
+ className: "text-xs uppercase tracking-wider text-muted-foreground",
99
+ children: M("ecommerce.postal_code")
100
+ }), /* @__PURE__ */ h("div", {
101
+ className: "flex gap-2",
102
+ children: [/* @__PURE__ */ m(g, {
103
+ id: "estimate-postal",
104
+ name: "estimate-postal",
105
+ autoComplete: "shipping postal-code",
106
+ placeholder: b === "CA" ? "A1A 1A1" : void 0,
107
+ value: w,
108
+ onChange: (e) => T(e.target.value),
109
+ onKeyDown: (e) => {
110
+ e.key === "Enter" && !E && (e.preventDefault(), V());
111
+ },
112
+ className: "h-9 text-sm bg-background"
113
+ }), /* @__PURE__ */ h(s, {
114
+ size: "sm",
115
+ variant: "secondary",
116
+ onClick: V,
117
+ disabled: E,
118
+ className: "shrink-0",
119
+ children: [E ? /* @__PURE__ */ m(d, { className: "h-4 w-4 mr-1.5 animate-spin" }) : /* @__PURE__ */ m(u, { className: "h-4 w-4 mr-1.5" }), M("ecommerce.calculate")]
120
+ })]
121
+ })]
122
+ })
123
+ ]
124
+ }),
125
+ A && /* @__PURE__ */ m("p", {
126
+ role: "alert",
127
+ className: "text-xs text-destructive mt-2",
128
+ children: A
129
+ }),
130
+ /* @__PURE__ */ h("div", {
131
+ "aria-live": "polite",
132
+ children: [O && O.length > 0 && /* @__PURE__ */ h("div", {
133
+ className: "mt-4 space-y-2 border-t pt-3",
134
+ children: [/* @__PURE__ */ h("p", {
135
+ className: "text-xs font-medium text-muted-foreground uppercase",
136
+ children: [M("ecommerce.available_rates"), ":"]
137
+ }), O.map((e) => /* @__PURE__ */ h("div", {
138
+ className: "flex justify-between items-center p-3 border rounded-lg bg-muted/30",
139
+ children: [/* @__PURE__ */ h("div", {
140
+ className: "flex items-center gap-2",
141
+ children: [/* @__PURE__ */ m(f, { className: "h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ m("span", {
142
+ className: "text-sm font-medium",
143
+ children: e.name
144
+ })]
145
+ }), /* @__PURE__ */ m("span", {
146
+ className: "text-sm font-bold tabular-nums",
147
+ children: e.amount === 0 ? M("ecommerce.free") : y(e.amount, P)
148
+ })]
149
+ }, e.id))]
150
+ }), O && O.length === 0 && !A && /* @__PURE__ */ m("p", {
151
+ className: "text-xs text-muted-foreground mt-2 italic",
152
+ children: M("ecommerce.no_rates_found")
153
+ })]
154
+ })
155
+ ]
156
+ });
154
157
  };
158
+ //#endregion
159
+ export { v as ShippingEstimator };
@@ -0,0 +1 @@
1
+ const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("./SimpleTiptapRenderer.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("@nextblock-cms/utils"),i=require("react/jsx-runtime");var a=/<\/?[a-z][^>]*>/i,o=e=>a.test(e);function s({value:e,className:n}){let a=e?.trim();return a?o(a)?(0,i.jsx)(`div`,{className:n,dangerouslySetInnerHTML:{__html:t.toNoCookieEmbedSrc(a)??a}}):(0,i.jsx)(`p`,{className:(0,r.cn)(`whitespace-pre-line`,n),children:a}):null}exports.ShortDescription=s,exports.isHtmlShortDescription=o;
@@ -1,18 +1,18 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { cn as i } from "@nextblock-cms/utils";
3
- import { toNoCookieEmbedSrc as n } from "./SimpleTiptapRenderer.es.js";
4
- const c = /<\/?[a-z][^>]*>/i, m = (r) => c.test(r);
5
- function f({ value: r, className: o }) {
6
- const t = r?.trim();
7
- return t ? m(t) ? /* @__PURE__ */ e(
8
- "div",
9
- {
10
- className: o,
11
- dangerouslySetInnerHTML: { __html: n(t) ?? t }
12
- }
13
- ) : /* @__PURE__ */ e("p", { className: i("whitespace-pre-line", o), children: t }) : null;
1
+ import { toNoCookieEmbedSrc as e } from "./SimpleTiptapRenderer.es.js";
2
+ import "react";
3
+ import { cn as t } from "@nextblock-cms/utils";
4
+ import { jsx as n } from "react/jsx-runtime";
5
+ //#region src/lib/components/ShortDescription.tsx
6
+ var r = /<\/?[a-z][^>]*>/i, i = (e) => r.test(e);
7
+ function a({ value: r, className: a }) {
8
+ let o = r?.trim();
9
+ return o ? i(o) ? /* @__PURE__ */ n("div", {
10
+ className: a,
11
+ dangerouslySetInnerHTML: { __html: e(o) ?? o }
12
+ }) : /* @__PURE__ */ n("p", {
13
+ className: t("whitespace-pre-line", a),
14
+ children: o
15
+ }) : null;
14
16
  }
15
- export {
16
- f as ShortDescription,
17
- m as isHtmlShortDescription
18
- };
17
+ //#endregion
18
+ export { a as ShortDescription, i as isHtmlShortDescription };
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs");let t=require("react");t=e.__toESM(t,1);let n=require("react/jsx-runtime");var r=(e,t)=>t.reduce((e,t)=>{switch(t.type){case`bold`:return(0,n.jsx)(`strong`,{children:e});case`italic`:return(0,n.jsx)(`em`,{children:e});case`underline`:case`u`:return(0,n.jsx)(`u`,{children:e});case`strike`:return(0,n.jsx)(`s`,{children:e});case`code`:return(0,n.jsx)(`code`,{className:`bg-muted px-1.5 py-0.5 rounded text-[0.875em] font-mono`,children:e});case`link`:{let r=t.attrs?.href||`#`,i=t.attrs?.target||`_blank`;return(0,n.jsx)(`a`,{href:r,target:i,rel:`noopener noreferrer`,className:`underline text-primary hover:text-primary/80`,children:e})}case`highlight`:{let r=t.attrs?.color;return(0,n.jsx)(`mark`,{style:r?{backgroundColor:r}:{},className:r?void 0:`bg-yellow-200 dark:bg-yellow-800/50`,children:e})}case`subscript`:return(0,n.jsx)(`sub`,{children:e});case`superscript`:return(0,n.jsx)(`sup`,{children:e});case`textStyle`:{let r={};return t.attrs?.color&&(r.color=t.attrs.color),t.attrs?.fontSize&&(r.fontSize=t.attrs.fontSize),t.attrs?.fontFamily&&(r.fontFamily=t.attrs.fontFamily),Object.keys(r).length>0?(0,n.jsx)(`span`,{style:r,children:e}):(0,n.jsx)(n.Fragment,{children:e})}default:return e}},e),i=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],a=(e,n,r,a)=>{let o=i[Math.max(1,Math.min(6,e))-1],s=a?.id;return t.default.createElement(o,{key:r,className:`font-bold my-4`,id:s},n)},o=e=>{let t={},n={},r=e?.colspan,i=e?.rowspan,a=e?.colwidth;return r&&r>1&&(t.colSpan=r),i&&i>1&&(t.rowSpan=i),a&&Array.isArray(a)&&a[0]&&(n.minWidth=a[0]),Object.keys(n).length>0&&(t.style=n),t},s=(e,i)=>{if(e.type===`text`){let a=e.text??``;return(0,n.jsx)(t.default.Fragment,{children:e.marks?.length?r(a,e.marks):a},i)}let l=e.content?.map((e,t)=>s(e,t))??null;switch(e.type){case`doc`:return(0,n.jsx)(`div`,{children:l},i);case`paragraph`:{if(!e.content?.length||e.content.every(e=>e.type===`text`&&(!e.text||!e.text.trim())))return null;let t=e.attrs?.textAlign,r=t?{textAlign:t}:{};return(0,n.jsx)(`p`,{className:`mb-4`,style:Object.keys(r).length?r:void 0,children:l},i)}case`heading`:return a(e.attrs?.level||1,l,i,e.attrs??void 0);case`bulletList`:return(0,n.jsx)(`ul`,{className:`list-disc pl-5 mb-4`,children:l},i);case`orderedList`:{let t=e.attrs?.start??1;return(0,n.jsx)(`ol`,{className:`list-decimal pl-5 mb-4`,start:t===1?void 0:t,children:l},i)}case`listItem`:return(0,n.jsx)(`li`,{children:l},i);case`taskList`:return(0,n.jsx)(`ul`,{className:`list-none pl-0 mb-4 space-y-1`,children:l},i);case`taskItem`:{let t=!!e.attrs?.checked;return(0,n.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,n.jsx)(`input`,{type:`checkbox`,checked:t,readOnly:!0,className:`mt-1.5 rounded`}),(0,n.jsx)(`div`,{className:t?`line-through text-muted-foreground`:``,children:l})]},i)}case`blockquote`:return(0,n.jsx)(`blockquote`,{className:`border-l-4 border-border pl-4 italic my-4`,children:l},i);case`codeBlock`:{let t=e.attrs?.language;return(0,n.jsx)(`pre`,{className:`bg-muted rounded-lg p-4 mb-4 overflow-x-auto`,"data-language":t||void 0,children:(0,n.jsx)(`code`,{className:`text-sm font-mono`,children:l})},i)}case`horizontalRule`:return(0,n.jsx)(`hr`,{className:`my-6 border-border`},i);case`hardBreak`:return(0,n.jsx)(`br`,{},i);case`image`:{let t=e.attrs?.src,r=e.attrs?.alt||``,a=e.attrs?.title,o=e.attrs?.width,s=e.attrs?.height,c={};return o&&(c.width=typeof o==`number`?`${o}px`:o),s&&(c.height=typeof s==`number`?`${s}px`:s),(0,n.jsx)(`img`,{src:t,alt:r??``,title:a,width:typeof o==`number`?o:void 0,height:typeof s==`number`?s:void 0,loading:`lazy`,decoding:`async`,style:Object.keys(c).length?c:void 0,className:`max-w-full h-auto rounded my-4`},i)}case`table`:return(0,n.jsx)(`div`,{className:`overflow-x-auto my-4`,children:(0,n.jsx)(`table`,{className:`w-full border-collapse border border-gray-300 dark:border-gray-700`,style:{minWidth:500},children:(0,n.jsx)(`tbody`,{children:l})})},i);case`tableRow`:return(0,n.jsx)(`tr`,{className:`border-b border-gray-300 dark:border-gray-700`,children:l},i);case`tableHeader`:return(0,n.jsx)(`th`,{...o(e.attrs??void 0),className:`bg-gray-100 dark:bg-gray-800 font-bold p-3 text-left border border-gray-300 dark:border-gray-700`,children:l},i);case`tableCell`:return(0,n.jsx)(`td`,{...o(e.attrs??void 0),className:`p-3 border border-gray-300 dark:border-gray-700`,children:l},i);case`details`:return(0,n.jsx)(`details`,{className:`my-4 border rounded-lg overflow-hidden`,children:l},i);case`detailsSummary`:return(0,n.jsx)(`summary`,{className:`cursor-pointer p-3 font-semibold bg-muted/30 hover:bg-muted/50`,children:l},i);case`detailsContent`:return(0,n.jsx)(`div`,{className:`p-3 border-t`,children:l},i);case`youtube`:{let t=c(e.attrs?.src),r=e.attrs?.width||640,a=e.attrs?.height||480;return(0,n.jsx)(`div`,{className:`relative my-4 overflow-hidden rounded-lg`,style:{aspectRatio:`${r}/${a}`,maxWidth:r},children:(0,n.jsx)(`iframe`,{src:t,title:e.attrs?.title||`Embedded video`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0,loading:`lazy`,className:`absolute inset-0 w-full h-full`})},i)}case`iframe`:{let t=c(e.attrs?.src);return(0,n.jsx)(`div`,{className:`my-4 overflow-hidden rounded-lg`,style:{aspectRatio:`16/9`},children:(0,n.jsx)(`iframe`,{src:t,title:e.attrs?.title||`Embedded content`,allowFullScreen:!0,loading:`lazy`,className:`w-full h-full border-0`})},i)}case`mention`:{let t=e.attrs?.label||e.attrs?.id||``;return(0,n.jsxs)(`span`,{className:`text-primary font-medium`,children:[`@`,t]},i)}default:return(0,n.jsx)(`div`,{children:l},i)}},c=e=>e?.replace(/(?:https?:)?\/\/(?:www\.|m\.|music\.)?youtube\.com\/embed\//gi,`https://www.youtube-nocookie.com/embed/`),l=({content:e,className:t})=>{if(!e)return null;if(typeof e==`string`){if(e.trim().startsWith(`{`)||e.trim().startsWith(`[`))try{let r=JSON.parse(e);return(0,n.jsx)(l,{content:r,className:t})}catch{}return(0,n.jsx)(`div`,{className:t,dangerouslySetInnerHTML:{__html:c(e)??e}})}let r=e;return!r.content||!Array.isArray(r.content)?null:(0,n.jsx)(`div`,{className:t,children:r.content.map((e,t)=>s(e,t))})};exports.SimpleTiptapRenderer=l,exports.toNoCookieEmbedSrc=c;