@nextblock-cms/ecom 0.8.6 → 0.8.7

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 (277) hide show
  1. package/index.cjs.js +1 -1
  2. package/index.es.js +136 -533
  3. package/lib/CurrencyProvider.cjs.js +1 -0
  4. package/lib/CurrencyProvider.es.js +99 -0
  5. package/lib/cart-store.cjs.js +1 -0
  6. package/{cart-store.es.js → lib/cart-store.es.js} +13 -13
  7. package/lib/components/AccountNavigationMenu.cjs.js +1 -0
  8. package/lib/components/AccountNavigationMenu.es.js +44 -0
  9. package/lib/components/AddToCartButton.cjs.js +1 -0
  10. package/{AddToCartButton-ffE0DhHu.js → lib/components/AddToCartButton.es.js} +14 -13
  11. package/lib/components/Cart.cjs.js +1 -0
  12. package/lib/components/Cart.es.js +148 -0
  13. package/lib/components/CartDrawer.cjs.js +1 -0
  14. package/{components → lib/components}/CartDrawer.es.js +15 -14
  15. package/{components → lib/components}/CartIcon.cjs.js +1 -1
  16. package/{components → lib/components}/CartIcon.es.js +1 -0
  17. package/lib/components/Checkout.cjs.js +1 -0
  18. package/{components → lib/components}/Checkout.es.js +330 -363
  19. package/lib/components/CouponForm.cjs.js +1 -0
  20. package/lib/components/CouponForm.es.js +136 -0
  21. package/lib/components/CurrencySwitcher.cjs.js +1 -0
  22. package/{components → lib/components}/CurrencySwitcher.es.js +5 -4
  23. package/lib/components/CustomerProfileForm.cjs.js +1 -0
  24. package/lib/components/CustomerProfileForm.es.js +355 -0
  25. package/lib/components/FeaturedProduct.cjs.js +1 -0
  26. package/{components → lib/components}/FeaturedProduct.es.js +9 -8
  27. package/lib/components/InvoiceDocument.cjs.js +1 -0
  28. package/lib/components/InvoiceDocument.es.js +196 -0
  29. package/lib/components/InvoiceViewerShell.cjs.js +29 -0
  30. package/lib/components/InvoiceViewerShell.es.js +100 -0
  31. package/lib/components/ProductCard.cjs.js +1 -0
  32. package/lib/components/ProductCard.es.js +119 -0
  33. package/lib/components/ProductDetailsLayout.cjs.js +1 -0
  34. package/lib/components/ProductDetailsLayout.es.js +361 -0
  35. package/lib/components/ProductGallery.cjs.js +1 -0
  36. package/lib/components/ProductGallery.es.js +41 -0
  37. package/lib/components/ProductGrid.cjs.js +1 -0
  38. package/lib/components/ProductGrid.es.js +19 -0
  39. package/lib/components/ShippingEstimator.cjs.js +1 -0
  40. package/lib/components/ShippingEstimator.es.js +125 -0
  41. package/lib/components/SubscriptionSelector.cjs.js +1 -0
  42. package/lib/components/SubscriptionSelector.es.js +140 -0
  43. package/lib/countries.cjs.js +1 -0
  44. package/lib/countries.es.js +77 -0
  45. package/lib/coupon-server.cjs.js +1 -0
  46. package/{coupon-server-DUKVtyYs.js → lib/coupon-server.es.js} +68 -82
  47. package/lib/coupons.cjs.js +1 -0
  48. package/lib/coupons.es.js +17 -0
  49. package/lib/currency-store.cjs.js +1 -0
  50. package/lib/currency-store.es.js +27 -0
  51. package/lib/currency-sync.cjs.js +1 -0
  52. package/lib/currency-sync.es.js +180 -0
  53. package/lib/customer-addresses.cjs.js +1 -0
  54. package/lib/customer-addresses.es.js +116 -0
  55. package/lib/customer-orders.cjs.js +1 -0
  56. package/lib/customer-orders.es.js +45 -0
  57. package/lib/customer.cjs.js +1 -0
  58. package/{customer-C3xccjUg.js → lib/customer.es.js} +15 -14
  59. package/lib/export-helpers.cjs.js +1 -0
  60. package/lib/export-helpers.es.js +56 -0
  61. package/lib/factory.cjs.js +1 -0
  62. package/lib/factory.es.js +8 -0
  63. package/lib/freemius-coupons.cjs.js +1 -0
  64. package/lib/freemius-coupons.es.js +272 -0
  65. package/lib/freemius-order-sync.cjs.js +1 -0
  66. package/lib/freemius-order-sync.es.js +284 -0
  67. package/lib/inventory-settings.cjs.js +1 -0
  68. package/lib/inventory-settings.es.js +86 -0
  69. package/lib/invoice-server.cjs.js +33 -0
  70. package/lib/invoice-server.es.js +141 -0
  71. package/lib/invoice-ui.cjs.js +1 -0
  72. package/lib/invoice-ui.es.js +71 -0
  73. package/lib/invoice.cjs.js +1 -0
  74. package/lib/invoice.es.js +102 -0
  75. package/lib/order-inventory.cjs.js +61 -0
  76. package/lib/order-inventory.es.js +128 -0
  77. package/lib/order-tax-details.cjs.js +1 -0
  78. package/lib/order-tax-details.es.js +164 -0
  79. package/lib/pages/cms/coupons/CouponEditorForm.cjs.js +1 -0
  80. package/lib/pages/cms/coupons/CouponEditorForm.es.js +189 -0
  81. package/lib/pages/cms/coupons/CouponsPage.cjs.js +5 -0
  82. package/lib/pages/cms/coupons/CouponsPage.es.js +171 -0
  83. package/lib/pages/cms/coupons/CreateCouponDialog.cjs.js +1 -0
  84. package/lib/pages/cms/coupons/CreateCouponDialog.es.js +35 -0
  85. package/lib/pages/cms/coupons/EditCouponPage.cjs.js +1 -0
  86. package/lib/pages/cms/coupons/EditCouponPage.es.js +48 -0
  87. package/lib/pages/cms/coupons/ProductScopePicker.cjs.js +1 -0
  88. package/lib/pages/cms/coupons/ProductScopePicker.es.js +120 -0
  89. package/lib/pages/cms/coupons/actions.cjs.js +1 -0
  90. package/lib/pages/cms/coupons/actions.es.js +128 -0
  91. package/lib/pages/cms/coupons/product-options.cjs.js +1 -0
  92. package/lib/pages/cms/coupons/product-options.es.js +27 -0
  93. package/lib/pages/cms/orders/ExportReportsDialog.cjs.js +1 -0
  94. package/lib/pages/cms/orders/ExportReportsDialog.es.js +130 -0
  95. package/lib/pages/cms/orders/OrderDetailPage.cjs.js +1 -0
  96. package/lib/pages/cms/orders/OrderDetailPage.es.js +137 -0
  97. package/lib/pages/cms/orders/OrderPrintButton.cjs.js +1 -0
  98. package/lib/pages/cms/orders/OrderPrintButton.es.js +22 -0
  99. package/lib/pages/cms/orders/OrderStatusForm.cjs.js +1 -0
  100. package/lib/pages/cms/orders/OrderStatusForm.es.js +71 -0
  101. package/lib/pages/cms/orders/OrdersPage.cjs.js +1 -0
  102. package/lib/pages/cms/orders/OrdersPage.es.js +104 -0
  103. package/lib/pages/cms/orders/actions.cjs.js +7 -0
  104. package/lib/pages/cms/orders/actions.es.js +71 -0
  105. package/lib/pages/cms/orders/export-actions.cjs.js +1 -0
  106. package/lib/pages/cms/orders/export-actions.es.js +27 -0
  107. package/lib/pages/cms/orders/server-actions.cjs.js +1 -0
  108. package/lib/pages/cms/orders/server-actions.es.js +55 -0
  109. package/lib/pages/cms/payments/PaymentsClient.cjs.js +1 -0
  110. package/lib/pages/cms/payments/PaymentsClient.es.js +188 -0
  111. package/lib/pages/cms/payments/PaymentsPage.cjs.js +1 -0
  112. package/lib/pages/cms/payments/PaymentsPage.es.js +29 -0
  113. package/lib/pages/cms/payments/actions.cjs.js +1 -0
  114. package/lib/pages/cms/payments/actions.es.js +23 -0
  115. package/lib/pages/cms/payments/queries.cjs.js +1 -0
  116. package/lib/pages/cms/payments/queries.es.js +30 -0
  117. package/lib/pages/cms/products/ProductsPage.cjs.js +1 -0
  118. package/lib/pages/cms/products/ProductsPage.es.js +46 -0
  119. package/lib/pages/cms/products/_id_/edit/EditProductPage.cjs.js +1 -0
  120. package/lib/pages/cms/products/_id_/edit/EditProductPage.es.js +156 -0
  121. package/lib/pages/cms/products/actions.cjs.js +44 -0
  122. package/lib/pages/cms/products/actions.es.js +175 -0
  123. package/lib/pages/cms/products/attributes/AttributeManagementPage.cjs.js +1 -0
  124. package/lib/pages/cms/products/attributes/AttributeManagementPage.es.js +48 -0
  125. package/lib/pages/cms/products/attributes/components/AttributeManager.cjs.js +1 -0
  126. package/lib/pages/cms/products/attributes/components/AttributeManager.es.js +291 -0
  127. package/lib/pages/cms/products/categories/CategoryManagementPage.cjs.js +1 -0
  128. package/lib/pages/cms/products/categories/CategoryManagementPage.es.js +36 -0
  129. package/lib/pages/cms/products/categories/components/CategoryManager.cjs.js +1 -0
  130. package/lib/pages/cms/products/categories/components/CategoryManager.es.js +263 -0
  131. package/lib/pages/cms/products/components/CopyProductFromLanguage.cjs.js +1 -0
  132. package/lib/pages/cms/products/components/CopyProductFromLanguage.es.js +114 -0
  133. package/lib/pages/cms/products/components/CurrencyPriceFields.cjs.js +1 -0
  134. package/lib/pages/cms/products/components/CurrencyPriceFields.es.js +107 -0
  135. package/lib/pages/cms/products/components/DeleteProductButton.cjs.js +1 -0
  136. package/lib/pages/cms/products/components/DeleteProductButton.es.js +48 -0
  137. package/lib/pages/cms/products/components/FreemiusPricingDashboard.cjs.js +1 -0
  138. package/lib/pages/cms/products/components/FreemiusPricingDashboard.es.js +86 -0
  139. package/lib/pages/cms/products/components/ProductCategorySelector.cjs.js +1 -0
  140. package/lib/pages/cms/products/components/ProductCategorySelector.es.js +160 -0
  141. package/lib/pages/cms/products/components/ProductForm.cjs.js +1 -0
  142. package/lib/pages/cms/products/components/ProductForm.es.js +702 -0
  143. package/lib/pages/cms/products/components/ProductMediaManager.cjs.js +1 -0
  144. package/lib/pages/cms/products/components/ProductMediaManager.es.js +104 -0
  145. package/lib/pages/cms/products/components/ProductsBulkTable.cjs.js +1 -0
  146. package/lib/pages/cms/products/components/ProductsBulkTable.es.js +228 -0
  147. package/lib/pages/cms/products/components/SaleScheduleFields.cjs.js +1 -0
  148. package/lib/pages/cms/products/components/SaleScheduleFields.es.js +137 -0
  149. package/lib/pages/cms/products/components/SyncFreemiusButton.cjs.js +1 -0
  150. package/lib/pages/cms/products/components/SyncFreemiusButton.es.js +36 -0
  151. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.cjs.js +1 -0
  152. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.es.js +40 -0
  153. package/lib/pages/cms/products/components/VariationsEditor.cjs.js +1 -0
  154. package/lib/pages/cms/products/components/VariationsEditor.es.js +408 -0
  155. package/lib/pages/cms/products/inventory/InventoryPage.cjs.js +1 -0
  156. package/lib/pages/cms/products/inventory/InventoryPage.es.js +16 -0
  157. package/lib/pages/cms/products/inventory/InventoryTableClient.cjs.js +2 -0
  158. package/lib/pages/cms/products/inventory/InventoryTableClient.es.js +214 -0
  159. package/lib/pages/cms/products/inventory/actions.cjs.js +3 -0
  160. package/lib/pages/cms/products/inventory/actions.es.js +95 -0
  161. package/lib/pages/cms/products/new/NewProductPage.cjs.js +1 -0
  162. package/lib/pages/cms/products/new/NewProductPage.es.js +76 -0
  163. package/lib/pages/cms/products/product-price-sync.cjs.js +1 -0
  164. package/lib/pages/cms/products/product-price-sync.es.js +98 -0
  165. package/lib/pages/cms/products/server-actions.cjs.js +1 -0
  166. package/lib/pages/cms/products/server-actions.es.js +193 -0
  167. package/lib/pages/cms/shipping/ShippingPage.cjs.js +5 -0
  168. package/lib/pages/cms/shipping/ShippingPage.es.js +211 -0
  169. package/lib/pages/cms/shipping/components/RateForm.cjs.js +1 -0
  170. package/lib/pages/cms/shipping/components/RateForm.es.js +441 -0
  171. package/lib/pages/cms/shipping/components/ZoneForm.cjs.js +1 -0
  172. package/lib/pages/cms/shipping/components/ZoneForm.es.js +228 -0
  173. package/lib/pages/cms/shipping/server-actions.cjs.js +1 -0
  174. package/lib/pages/cms/shipping/server-actions.es.js +159 -0
  175. package/lib/pages/cms/taxes/TaxesPage.cjs.js +1 -0
  176. package/lib/pages/cms/taxes/TaxesPage.es.js +172 -0
  177. package/lib/pages/cms/taxes/actions.cjs.js +1 -0
  178. package/lib/pages/cms/taxes/actions.es.js +57 -0
  179. package/lib/pages/cms/taxes/components/TaxRateForm.cjs.js +1 -0
  180. package/lib/pages/cms/taxes/components/TaxRateForm.es.js +100 -0
  181. package/lib/product-actions.cjs.js +237 -0
  182. package/lib/product-actions.es.js +524 -0
  183. package/lib/product-context.cjs.js +1 -0
  184. package/lib/product-context.es.js +16 -0
  185. package/lib/product-schema.cjs.js +1 -0
  186. package/lib/product-schema.es.js +134 -0
  187. package/lib/providers/freemius.cjs.js +5 -0
  188. package/lib/providers/freemius.es.js +538 -0
  189. package/lib/providers/stripe.cjs.js +1 -0
  190. package/lib/providers/stripe.es.js +473 -0
  191. package/lib/server-actions/coupon-actions.cjs.js +1 -0
  192. package/lib/server-actions/coupon-actions.es.js +23 -0
  193. package/lib/server-actions/customer-actions.cjs.js +1 -0
  194. package/lib/server-actions/customer-actions.es.js +30 -0
  195. package/lib/server-actions/product-actions.cjs.js +1 -0
  196. package/{server-actions → lib/server-actions}/product-actions.es.js +5 -4
  197. package/lib/server-actions/shipping-actions.cjs.js +1 -0
  198. package/{shipping-actions-BnHjlo2q.js → lib/server-actions/shipping-actions.es.js} +9 -7
  199. package/lib/server-actions/tax-actions.cjs.js +1 -0
  200. package/lib/server-actions/tax-actions.es.js +40 -0
  201. package/lib/shared-inventory.cjs.js +15 -0
  202. package/lib/shared-inventory.es.js +171 -0
  203. package/lib/shipping/resolver.cjs.js +7 -0
  204. package/lib/shipping/resolver.es.js +62 -0
  205. package/lib/shipping-rate-currency.cjs.js +1 -0
  206. package/lib/shipping-rate-currency.es.js +72 -0
  207. package/lib/states.cjs.js +1 -0
  208. package/{states-DlHJezQ1.js → lib/states.es.js} +27 -100
  209. package/lib/stripe/checkout.cjs.js +1 -0
  210. package/lib/stripe/checkout.es.js +182 -0
  211. package/lib/stripe/client.cjs.js +1 -0
  212. package/lib/stripe/client.es.js +7 -0
  213. package/lib/stripe/order-sync.cjs.js +1 -0
  214. package/lib/stripe/order-sync.es.js +130 -0
  215. package/lib/stripe/webhooks.cjs.js +1 -0
  216. package/lib/stripe/webhooks.es.js +30 -0
  217. package/lib/tax-calculation.cjs.js +1 -0
  218. package/lib/tax-calculation.es.js +101 -0
  219. package/lib/trials.cjs.js +1 -0
  220. package/{trials-RDcRAZKx.js → lib/trials.es.js} +9 -9
  221. package/{use-cart.es.js → lib/use-cart.es.js} +1 -0
  222. package/lib/zod-config.cjs.js +1 -0
  223. package/lib/zod-config.es.js +6 -0
  224. package/package.json +4 -4
  225. package/server.cjs.js +1 -110
  226. package/server.es.js +178 -6052
  227. package/AddToCartButton-DsSEH9yp.cjs +0 -1
  228. package/CouponForm-BI_5SBHQ.js +0 -152
  229. package/CouponForm-D_uu2bLP.cjs +0 -1
  230. package/CurrencyProvider-Cg-Q6ucj.cjs +0 -1
  231. package/CurrencyProvider-OzlRN96V.js +0 -120
  232. package/CurrencyProvider.cjs.js +0 -1
  233. package/CurrencyProvider.es.js +0 -10
  234. package/ProductDetailsLayout-BxJH_BxR.cjs +0 -1
  235. package/ProductDetailsLayout-Dg8dRTYp.js +0 -530
  236. package/ProductGrid-BdL7iglO.cjs +0 -1
  237. package/ProductGrid-D3AWM8sr.js +0 -130
  238. package/actions-AHmBrS5e.cjs +0 -48
  239. package/actions-j5fuSZX-.js +0 -820
  240. package/cart-store.cjs.js +0 -1
  241. package/components/Cart.cjs.js +0 -1
  242. package/components/Cart.es.js +0 -259
  243. package/components/CartDrawer.cjs.js +0 -1
  244. package/components/Checkout.cjs.js +0 -1
  245. package/components/CurrencySwitcher.cjs.js +0 -1
  246. package/components/FeaturedProduct.cjs.js +0 -1
  247. package/components/ProductDetailsLayout.cjs.js +0 -1
  248. package/components/ProductDetailsLayout.es.js +0 -19
  249. package/components/ProductGrid.cjs.js +0 -1
  250. package/components/ProductGrid.es.js +0 -6
  251. package/coupon-server-C9ySm3I5.cjs +0 -1
  252. package/customer-C-UPvrYN.cjs +0 -1
  253. package/invoice-ui-CAnJPu6n.cjs +0 -29
  254. package/invoice-ui-DtpbTJE1.js +0 -2886
  255. package/product-actions-CONBF8i6.cjs +0 -251
  256. package/product-actions-DjlIWCMH.js +0 -691
  257. package/resolver-Fz_FKsfX.cjs +0 -7
  258. package/resolver-cfrCaHpE.js +0 -128
  259. package/server-actions/product-actions.cjs.js +0 -1
  260. package/shipping-actions-D6zt20gg.cjs +0 -1
  261. package/states-CWYRxV4B.cjs +0 -1
  262. package/tax-calculation-Dab89aHd.js +0 -181
  263. package/tax-calculation-MkDKOEkL.cjs +0 -1
  264. package/trials-DvZaOtNy.cjs +0 -1
  265. /package/{components → lib/components}/SimpleTiptapRenderer.cjs.js +0 -0
  266. /package/{components → lib/components}/SimpleTiptapRenderer.es.js +0 -0
  267. /package/{currency-constants.cjs.js → lib/currency-constants.cjs.js} +0 -0
  268. /package/{currency-constants.es.js → lib/currency-constants.es.js} +0 -0
  269. /package/{currency-rest-client-uolJxUkL.cjs → lib/currency-rest-client.cjs.js} +0 -0
  270. /package/{currency-rest-client-CwoqdgAP.js → lib/currency-rest-client.es.js} +0 -0
  271. /package/{currency.cjs.js → lib/currency.cjs.js} +0 -0
  272. /package/{currency.es.js → lib/currency.es.js} +0 -0
  273. /package/{types.cjs.js → lib/types.cjs.js} +0 -0
  274. /package/{types.es.js → lib/types.es.js} +0 -0
  275. /package/{use-cart.cjs.js → lib/use-cart.cjs.js} +0 -0
  276. /package/{variation-utils.cjs.js → lib/variation-utils.cjs.js} +0 -0
  277. /package/{variation-utils.es.js → lib/variation-utils.es.js} +0 -0
@@ -0,0 +1,196 @@
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
+ import b from "next/image";
3
+ import { getInvoiceAddressLines as a, formatInvoiceDate as N, formatInvoiceCurrency as s } from "../invoice.es.js";
4
+ import { getOrderTaxRatePercentage as f, getOrderTaxRateLabel as v, getOrderTaxRateJurisdiction as x } from "../order-tax-details.es.js";
5
+ function k({
6
+ data: t,
7
+ labels: r,
8
+ locale: p = "en-US",
9
+ className: c = ""
10
+ }) {
11
+ const u = a(t.settings.address), g = a(t.order.customer_details?.billing), y = a(t.order.customer_details?.shipping);
12
+ return /* @__PURE__ */ n(
13
+ "section",
14
+ {
15
+ className: `rounded-2xl border bg-white text-slate-900 shadow-sm print:rounded-none print:border-0 print:text-[10px] print:shadow-none ${c}`,
16
+ children: [
17
+ /* @__PURE__ */ e("div", { className: "border-b px-6 py-6 print:px-0", children: /* @__PURE__ */ n("div", { className: "grid gap-6 md:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] md:items-start print:grid-cols-[minmax(0,1fr)_72px_280px] print:items-start print:gap-4", children: [
18
+ /* @__PURE__ */ n("div", { className: "order-2 max-w-md space-y-4 print:order-none print:max-w-none print:space-y-2 md:order-none", children: [
19
+ /* @__PURE__ */ n("div", { className: "space-y-1 text-sm print:text-[10px]", children: [
20
+ /* @__PURE__ */ e("p", { className: "text-xs font-semibold uppercase tracking-[0.2em] text-slate-500", children: r.from }),
21
+ t.settings.businessName ? /* @__PURE__ */ e("p", { className: "text-base font-semibold", children: t.settings.businessName }) : null,
22
+ u.map((i, l) => /* @__PURE__ */ e("p", { children: i }, `seller-${l}-${i}`)),
23
+ t.settings.email ? /* @__PURE__ */ e("p", { children: t.settings.email }) : null,
24
+ t.settings.phone ? /* @__PURE__ */ e("p", { children: t.settings.phone }) : null
25
+ ] }),
26
+ t.settings.taxRegistrations.length > 0 ? /* @__PURE__ */ n("div", { className: "rounded-xl border bg-slate-50 px-4 py-3 text-sm print:px-3 print:py-2 print:text-[10px]", children: [
27
+ /* @__PURE__ */ e("p", { className: "mb-2 font-semibold", children: r.taxRegistrations }),
28
+ /* @__PURE__ */ e("div", { className: "space-y-1", children: t.settings.taxRegistrations.map((i, l) => /* @__PURE__ */ n("p", { children: [
29
+ /* @__PURE__ */ e("span", { className: "font-medium", children: i.label }),
30
+ i.label && i.value ? ": " : "",
31
+ i.value
32
+ ] }, `${i.label}-${i.value}-${l}`)) })
33
+ ] }) : null
34
+ ] }),
35
+ /* @__PURE__ */ e("div", { className: "order-1 flex justify-center md:order-none md:pt-2 print:order-none print:pt-1", children: t.logo?.url ? /* @__PURE__ */ e(
36
+ b,
37
+ {
38
+ src: t.logo.url,
39
+ alt: t.logo.name || t.settings.businessName || "Logo",
40
+ className: "mx-auto h-24 w-auto object-contain print:h-14",
41
+ width: t.logo.width || 320,
42
+ height: t.logo.height || 120
43
+ }
44
+ ) : null }),
45
+ /* @__PURE__ */ e("div", { className: "order-3 flex justify-start md:order-none md:justify-end print:order-none", children: /* @__PURE__ */ n("div", { className: "w-full max-w-[380px] rounded-2xl bg-slate-950 px-5 py-5 text-white print:max-w-none print:border print:border-slate-300 print:bg-white print:px-3 print:py-3 print:text-[10px] print:text-slate-950", children: [
46
+ /* @__PURE__ */ e("p", { className: "text-xs uppercase tracking-[0.2em] text-white/70 print:text-slate-500", children: r.invoice }),
47
+ /* @__PURE__ */ n("div", { className: "mt-4 space-y-3 text-sm print:mt-3 print:space-y-2 print:text-[10px]", children: [
48
+ /* @__PURE__ */ e(
49
+ o,
50
+ {
51
+ label: r.invoiceNumber,
52
+ value: t.order.invoice_number || "--"
53
+ }
54
+ ),
55
+ /* @__PURE__ */ e(o, { label: r.orderNumber, value: t.order.id }),
56
+ /* @__PURE__ */ e(
57
+ o,
58
+ {
59
+ label: r.paidOn,
60
+ value: N(t.order.paid_at || t.order.created_at, p) || "--"
61
+ }
62
+ ),
63
+ /* @__PURE__ */ e(o, { label: r.status, value: t.order.status })
64
+ ] })
65
+ ] }) })
66
+ ] }) }),
67
+ /* @__PURE__ */ n("div", { className: "grid gap-4 border-b px-6 py-6 md:grid-cols-2 print:grid-cols-2 print:gap-3 print:px-0 print:py-3", children: [
68
+ /* @__PURE__ */ e(h, { title: r.billTo, lines: g }),
69
+ /* @__PURE__ */ e(h, { title: r.shipTo, lines: y })
70
+ ] }),
71
+ /* @__PURE__ */ n("div", { className: "px-6 py-6 print:px-0 print:py-3", children: [
72
+ /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-2xl border", children: /* @__PURE__ */ n("table", { className: "w-full border-collapse text-sm print:table-fixed print:text-[9px]", children: [
73
+ /* @__PURE__ */ e("thead", { className: "bg-slate-50", children: /* @__PURE__ */ n("tr", { children: [
74
+ /* @__PURE__ */ e("th", { className: "px-4 py-3 text-left font-semibold print:w-[22%] print:px-2 print:py-1.5", children: r.item }),
75
+ /* @__PURE__ */ e("th", { className: "px-4 py-3 text-left font-semibold print:w-[38%] print:px-2 print:py-1.5", children: r.details }),
76
+ /* @__PURE__ */ e("th", { className: "px-4 py-3 text-right font-semibold print:w-[10%] print:px-2 print:py-1.5", children: r.quantity }),
77
+ /* @__PURE__ */ e("th", { className: "px-4 py-3 text-right font-semibold print:w-[15%] print:px-2 print:py-1.5", children: r.price }),
78
+ /* @__PURE__ */ e("th", { className: "px-4 py-3 text-right font-semibold print:w-[15%] print:px-2 print:py-1.5", children: r.amount })
79
+ ] }) }),
80
+ /* @__PURE__ */ e("tbody", { children: t.order.items.map((i) => /* @__PURE__ */ n("tr", { className: "border-t", children: [
81
+ /* @__PURE__ */ e("td", { className: "px-4 py-4 font-medium print:px-2 print:py-1.5", children: i.title }),
82
+ /* @__PURE__ */ e("td", { className: "px-4 py-4 text-slate-600 print:px-2 print:py-1.5", children: i.description || "--" }),
83
+ /* @__PURE__ */ e("td", { className: "px-4 py-4 text-right print:px-2 print:py-1.5", children: i.quantity }),
84
+ /* @__PURE__ */ e("td", { className: "px-4 py-4 text-right print:px-2 print:py-1.5", children: s(i.unit_amount, t.order.currency, p) }),
85
+ /* @__PURE__ */ e("td", { className: "px-4 py-4 text-right font-medium print:px-2 print:py-1.5", children: s(i.total_amount, t.order.currency, p) })
86
+ ] }, i.id)) })
87
+ ] }) }),
88
+ /* @__PURE__ */ n("div", { className: "mt-6 grid gap-6 md:grid-cols-[minmax(0,1fr)_320px] print:mt-4 print:grid-cols-[minmax(0,1fr)_220px] print:items-start print:gap-4", children: [
89
+ /* @__PURE__ */ e("div", { children: t.order.tax_details?.lines?.length ? /* @__PURE__ */ n("div", { className: "rounded-xl border bg-slate-50 px-5 py-4 print:break-inside-avoid print:px-3 print:py-2.5 print:text-[10px]", children: [
90
+ /* @__PURE__ */ e("p", { className: "mb-3 font-semibold", children: r.taxBreakdown }),
91
+ /* @__PURE__ */ e("div", { className: "space-y-3 text-sm print:space-y-2 print:text-[10px]", children: t.order.tax_details.lines.map((i, l) => {
92
+ const m = f(i.rate);
93
+ return /* @__PURE__ */ n(
94
+ "div",
95
+ {
96
+ className: "flex items-start justify-between gap-4",
97
+ children: [
98
+ /* @__PURE__ */ n("div", { children: [
99
+ /* @__PURE__ */ n("p", { className: "font-medium", children: [
100
+ v(i.rate),
101
+ typeof m == "number" ? ` - ${m.toFixed(4)}%` : ""
102
+ ] }),
103
+ x(i.rate) ? /* @__PURE__ */ e("p", { className: "text-xs text-slate-500 print:text-[9px]", children: x(i.rate) }) : null
104
+ ] }),
105
+ /* @__PURE__ */ e("span", { children: s(i.amount, t.order.currency, p) })
106
+ ]
107
+ },
108
+ `${i.rate.display_name}-${i.description || "tax"}-${l}`
109
+ );
110
+ }) })
111
+ ] }) : null }),
112
+ /* @__PURE__ */ n("div", { className: "rounded-xl border bg-slate-950 px-5 py-5 text-sm text-white print:break-inside-avoid print:border-slate-300 print:bg-white print:px-3 print:py-3 print:text-[10px] print:text-slate-950", children: [
113
+ /* @__PURE__ */ n("div", { className: "space-y-3 print:space-y-2", children: [
114
+ /* @__PURE__ */ e(
115
+ d,
116
+ {
117
+ label: r.subtotal,
118
+ value: s(t.order.subtotal, t.order.currency, p)
119
+ }
120
+ ),
121
+ t.order.discount_total > 0 ? /* @__PURE__ */ e(
122
+ d,
123
+ {
124
+ label: t.order.coupon_code ? `${r.discount} (${t.order.coupon_code})` : r.discount,
125
+ value: `-${s(
126
+ t.order.discount_total,
127
+ t.order.currency,
128
+ p
129
+ )}`
130
+ }
131
+ ) : null,
132
+ /* @__PURE__ */ e(
133
+ d,
134
+ {
135
+ label: r.shipping,
136
+ value: s(
137
+ t.order.shipping_total,
138
+ t.order.currency,
139
+ p
140
+ )
141
+ }
142
+ ),
143
+ /* @__PURE__ */ e(
144
+ d,
145
+ {
146
+ label: r.tax,
147
+ value: s(t.order.tax_total, t.order.currency, p)
148
+ }
149
+ )
150
+ ] }),
151
+ /* @__PURE__ */ e("div", { className: "mt-4 border-t border-white/15 pt-4 print:mt-3 print:border-slate-300 print:pt-3", children: /* @__PURE__ */ e(
152
+ d,
153
+ {
154
+ label: r.total,
155
+ value: s(t.order.total, t.order.currency, p),
156
+ strong: !0
157
+ }
158
+ ) })
159
+ ] })
160
+ ] })
161
+ ] })
162
+ ]
163
+ }
164
+ );
165
+ }
166
+ function h({ title: t, lines: r }) {
167
+ return /* @__PURE__ */ n("div", { className: "rounded-xl border bg-slate-50 px-5 py-4 print:break-inside-avoid print:px-3 print:py-2.5 print:text-[10px]", children: [
168
+ /* @__PURE__ */ e("p", { className: "mb-3 text-xs font-semibold uppercase tracking-[0.2em] text-slate-500", children: t }),
169
+ r.length ? /* @__PURE__ */ e("div", { className: "space-y-1 text-sm print:text-[10px]", children: r.map((p, c) => /* @__PURE__ */ e("p", { children: p }, `${t}-${c}-${p}`)) }) : /* @__PURE__ */ e("p", { className: "text-sm text-slate-500", children: "--" })
170
+ ] });
171
+ }
172
+ function o({ label: t, value: r }) {
173
+ return /* @__PURE__ */ n("div", { className: "flex items-center justify-between gap-4", children: [
174
+ /* @__PURE__ */ e("span", { className: "text-white/70 print:text-[9px] print:text-slate-500", children: t }),
175
+ /* @__PURE__ */ e("span", { className: "text-right font-medium", children: r })
176
+ ] });
177
+ }
178
+ function d({
179
+ label: t,
180
+ value: r,
181
+ strong: p = !1
182
+ }) {
183
+ return /* @__PURE__ */ n("div", { className: "flex items-center justify-between gap-4", children: [
184
+ /* @__PURE__ */ e(
185
+ "span",
186
+ {
187
+ className: p ? "text-base font-semibold print:text-sm" : "text-white/75 print:text-[9px] print:text-slate-500",
188
+ children: t
189
+ }
190
+ ),
191
+ /* @__PURE__ */ e("span", { className: p ? "text-lg font-semibold print:text-base" : "font-medium", children: r })
192
+ ] });
193
+ }
194
+ export {
195
+ k as InvoiceDocument
196
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("next/link"),j=require("lucide-react"),s=require("@nextblock-cms/ui/button"),v=require("./InvoiceDocument.cjs.js");function f({invoice:i,labels:a,locale:o,title:c,description:r,printLabel:x,headerVisual:d,action:t,loading:l=!1,loadingMessage:m,error:n,emptyMessage:u,className:p="",showHeader:h=!0}){return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
2
+ @media print {
3
+ @page {
4
+ size: portrait;
5
+ margin: 12mm;
6
+ }
7
+
8
+ body {
9
+ background: white !important;
10
+ }
11
+
12
+ body * {
13
+ visibility: hidden;
14
+ }
15
+
16
+ [data-print-invoice-root],
17
+ [data-print-invoice-root] * {
18
+ visibility: visible;
19
+ }
20
+
21
+ [data-print-invoice-root] {
22
+ position: absolute;
23
+ inset: 0;
24
+ width: 100%;
25
+ margin: 0;
26
+ padding: 0;
27
+ }
28
+ }
29
+ `}),e.jsxs("div",{className:`mx-auto max-w-6xl px-4 py-10 md:px-6 print:max-w-none print:px-0 print:py-0 ${p}`,children:[h?e.jsxs("div",{className:"mb-6 flex flex-col gap-4 md:flex-row md:items-center md:justify-between print:hidden",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[d?e.jsx("div",{className:"shrink-0",children:d}):null,e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:c}),r?e.jsx("p",{className:"text-sm text-muted-foreground",children:r}):null]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(s.Button,{type:"button",variant:"outline",onClick:()=>window.print(),disabled:!i,children:[e.jsx(j.Printer,{className:"mr-2 h-4 w-4"}),x]}),t?e.jsx(s.Button,{asChild:!0,variant:t.variant||"default",children:e.jsx(b,{href:t.href,children:t.label})}):null]})]}):null,l?e.jsx("div",{className:"mb-6 flex items-center justify-center gap-3 rounded-2xl border bg-background px-5 py-4 text-sm text-muted-foreground print:hidden",children:m}):null,n?e.jsx("div",{className:"mb-6 rounded-2xl border border-amber-200 bg-amber-50 px-5 py-4 text-sm text-amber-700 print:hidden",children:n}):null,i?e.jsx("div",{"data-print-invoice-root":!0,children:e.jsx(v.InvoiceDocument,{data:i,labels:a,locale:o})}):!l&&!n?e.jsx("div",{className:"rounded-2xl border bg-background px-6 py-12 text-center text-muted-foreground print:hidden",children:u}):null]})]})}exports.InvoiceViewerShell=f;
@@ -0,0 +1,100 @@
1
+ 'use client';
2
+ import { jsxs as i, Fragment as f, jsx as e } from "react/jsx-runtime";
3
+ import v from "next/link";
4
+ import { Printer as g } from "lucide-react";
5
+ import { Button as m } from "@nextblock-cms/ui/button";
6
+ import { InvoiceDocument as y } from "./InvoiceDocument.es.js";
7
+ function I({
8
+ invoice: r,
9
+ labels: o,
10
+ locale: s,
11
+ title: c,
12
+ description: d,
13
+ printLabel: p,
14
+ headerVisual: l,
15
+ action: t,
16
+ loading: a = !1,
17
+ loadingMessage: x,
18
+ error: n,
19
+ emptyMessage: u,
20
+ className: h = "",
21
+ showHeader: b = !0
22
+ }) {
23
+ return /* @__PURE__ */ i(f, { children: [
24
+ /* @__PURE__ */ e("style", { children: `
25
+ @media print {
26
+ @page {
27
+ size: portrait;
28
+ margin: 12mm;
29
+ }
30
+
31
+ body {
32
+ background: white !important;
33
+ }
34
+
35
+ body * {
36
+ visibility: hidden;
37
+ }
38
+
39
+ [data-print-invoice-root],
40
+ [data-print-invoice-root] * {
41
+ visibility: visible;
42
+ }
43
+
44
+ [data-print-invoice-root] {
45
+ position: absolute;
46
+ inset: 0;
47
+ width: 100%;
48
+ margin: 0;
49
+ padding: 0;
50
+ }
51
+ }
52
+ ` }),
53
+ /* @__PURE__ */ i(
54
+ "div",
55
+ {
56
+ className: `mx-auto max-w-6xl px-4 py-10 md:px-6 print:max-w-none print:px-0 print:py-0 ${h}`,
57
+ children: [
58
+ b ? /* @__PURE__ */ i("div", { className: "mb-6 flex flex-col gap-4 md:flex-row md:items-center md:justify-between print:hidden", children: [
59
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-4", children: [
60
+ l ? /* @__PURE__ */ e("div", { className: "shrink-0", children: l }) : null,
61
+ /* @__PURE__ */ i("div", { children: [
62
+ /* @__PURE__ */ e("h1", { className: "text-3xl font-bold", children: c }),
63
+ d ? /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: d }) : null
64
+ ] })
65
+ ] }),
66
+ /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-3", children: [
67
+ /* @__PURE__ */ i(
68
+ m,
69
+ {
70
+ type: "button",
71
+ variant: "outline",
72
+ onClick: () => window.print(),
73
+ disabled: !r,
74
+ children: [
75
+ /* @__PURE__ */ e(g, { className: "mr-2 h-4 w-4" }),
76
+ p
77
+ ]
78
+ }
79
+ ),
80
+ t ? /* @__PURE__ */ e(m, { asChild: !0, variant: t.variant || "default", children: /* @__PURE__ */ e(v, { href: t.href, children: t.label }) }) : null
81
+ ] })
82
+ ] }) : null,
83
+ a ? /* @__PURE__ */ e("div", { className: "mb-6 flex items-center justify-center gap-3 rounded-2xl border bg-background px-5 py-4 text-sm text-muted-foreground print:hidden", children: x }) : null,
84
+ n ? /* @__PURE__ */ e("div", { className: "mb-6 rounded-2xl border border-amber-200 bg-amber-50 px-5 py-4 text-sm text-amber-700 print:hidden", children: n }) : null,
85
+ r ? /* @__PURE__ */ e("div", { "data-print-invoice-root": !0, children: /* @__PURE__ */ e(
86
+ y,
87
+ {
88
+ data: r,
89
+ labels: o,
90
+ locale: s
91
+ }
92
+ ) }) : !a && !n ? /* @__PURE__ */ e("div", { className: "rounded-2xl border bg-background px-6 py-12 text-center text-muted-foreground print:hidden", children: u }) : null
93
+ ]
94
+ }
95
+ )
96
+ ] });
97
+ }
98
+ export {
99
+ I as InvoiceViewerShell
100
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),S=require("./AddToCartButton.cjs.js"),l=require("@nextblock-cms/utils"),v=require("next/link"),w=require("../CurrencyProvider.cjs.js"),n=require("../currency.cjs.js"),q=require("../trials.cjs.js"),A=require("../variation-utils.cjs.js"),T=({product:e,className:b})=>{const{activeCurrencyCode:a,currencies:c}=w.useCurrency(),i=n.resolvePriceRangeForCurrency({entries:e.variants?.length?e.variants:e.product_variants?.length?e.product_variants:[],currencyCode:a,currencies:c}),u=!!(e.has_variants&&i),t=n.resolveEffectivePriceForCurrency({prices:e.prices,salePrices:e.sale_prices,fallbackPrice:e.price,fallbackSalePrice:e.sale_price,saleStartAt:e.sale_start_at,saleEndAt:e.sale_end_at,scheduledPrice:e.scheduled_price,scheduledPrices:e.scheduled_prices,scheduledPriceAt:e.scheduled_price_at,currencyCode:a,currencies:c}),P=u&&i?i.min===i.max?l.formatPrice(i.min,a):`${l.formatPrice(i.min,a)} - ${l.formatPrice(i.max,a)}`:l.formatPrice(t.sale_price??t.price,a),j=e.variants?.length?e.variants:e.product_variants?.length?e.product_variants:[],y=u?j.some(s=>n.resolveEffectivePriceForCurrency({prices:s.prices,salePrices:s.sale_prices,fallbackPrice:s.price,fallbackSalePrice:s.sale_price,saleStartAt:s.sale_start_at,saleEndAt:s.sale_end_at,scheduledPrice:s.scheduled_price,scheduledPrices:s.scheduled_prices,scheduledPriceAt:s.scheduled_price_at,currencyCode:a,currencies:c}).sale_price!=null):t.sale_price!=null,{t:x,lang:N}=l.useTranslations(),p=x("ecommerce.on_sale"),C=p==="ecommerce.on_sale"?"On Sale":p,f=q.getTrialSummary(e),o=e.freemius_plans?.[0]?.freemius_pricing?.[0],d=c.find(s=>s.is_default)?.code||"USD",_=o?.override_monthly_price??o?.api_monthly_price,g=o?.override_annual_price??o?.api_annual_price,m=typeof _=="number"?n.resolvePriceForCurrency({prices:{[d]:l.majorUnitAmountToMinor(_,d)},currencyCode:a,currencies:c}):null,h=typeof g=="number"?n.resolvePriceForCurrency({prices:{[d]:l.majorUnitAmountToMinor(g,d)},currencyCode:a,currencies:c}):null;return r.jsxs("div",{className:l.cn("group relative flex flex-col overflow-hidden rounded-lg border bg-card text-card-foreground shadow-sm transition-all hover:shadow-md",b),children:[r.jsxs(v,{href:`/product/${e.slug}`,className:"relative aspect-square overflow-hidden bg-muted",children:[y&&r.jsx("span",{className:"absolute left-3 top-3 z-10 rounded-full bg-destructive px-2.5 py-1 text-[10px] font-bold uppercase tracking-wider text-destructive-foreground shadow-sm",children:C}),e.image_url?r.jsx("img",{src:e.image_url,alt:e.title,className:"h-full w-full object-cover object-center transition-transform duration-300 group-hover:scale-105"}):r.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"No Image"})]}),r.jsxs("div",{className:"flex flex-1 flex-col p-4",children:[e.categories&&e.categories.length>0&&r.jsx("div",{className:"text-[10px] font-bold uppercase tracking-widest text-amber-600 dark:text-amber-400 mb-1",children:e.categories.map(s=>A.resolveTranslatedText(s.name,s.name_translations,N)).join(" • ")}),r.jsx(v,{href:`/product/${e.slug}`,className:"mb-2",children:r.jsx("h3",{className:"line-clamp-1 text-lg font-medium text-foreground group-hover:underline",children:e.title})}),r.jsx("div",{className:"mb-4",children:e.product_type==="digital"&&(m||h)?r.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[m&&r.jsxs("div",{className:"flex items-baseline gap-0.5",children:[r.jsx("span",{className:"text-xl font-bold text-primary",children:l.formatPrice(m.price,a)}),r.jsxs("span",{className:"text-xs font-medium text-muted-foreground lowercase",children:["/ ",x("ecommerce.month")]})]}),h&&r.jsxs("div",{className:"flex items-baseline gap-0.5",children:[r.jsx("span",{className:l.cn("font-bold text-primary",m?"text-lg":"text-xl"),children:l.formatPrice(h.price,a)}),r.jsxs("span",{className:"text-xs font-medium text-muted-foreground lowercase",children:["/ ",x("ecommerce.year")]})]})]}):r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsx("span",{className:"text-xl font-bold text-primary",children:P}),!u&&t.sale_price&&r.jsx("span",{className:"text-sm text-muted-foreground line-through",children:l.formatPrice(t.price,a)})]})}),f&&r.jsxs("div",{className:"mb-4 rounded-md border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900",children:[r.jsx("div",{className:"font-semibold",children:f.label}),r.jsx("div",{className:"text-emerald-700",children:f.paymentRequirementLabel})]}),r.jsx("div",{className:"mt-auto",children:r.jsx(S.AddToCartButton,{product:{...e,price:e.price,prices:e.prices,sale_price:e.sale_price,sale_prices:e.sale_prices},className:"w-full"})})]})]})};exports.ProductCard=T;
@@ -0,0 +1,119 @@
1
+ 'use client';
2
+ import { jsxs as s, jsx as r } from "react/jsx-runtime";
3
+ import { AddToCartButton as R } from "./AddToCartButton.es.js";
4
+ import { formatPrice as c, useTranslations as T, majorUnitAmountToMinor as b, cn as v } from "@nextblock-cms/utils";
5
+ import y from "next/link";
6
+ import { useCurrency as L } from "../CurrencyProvider.es.js";
7
+ import { resolvePriceRangeForCurrency as E, resolveEffectivePriceForCurrency as N, resolvePriceForCurrency as P } from "../currency.es.js";
8
+ import { getTrialSummary as $ } from "../trials.es.js";
9
+ import { resolveTranslatedText as F } from "../variation-utils.es.js";
10
+ const G = ({ product: e, className: C }) => {
11
+ const { activeCurrencyCode: l, currencies: n } = L(), i = E({
12
+ entries: e.variants?.length ? e.variants : e.product_variants?.length ? e.product_variants : [],
13
+ currencyCode: l,
14
+ currencies: n
15
+ }), f = !!(e.has_variants && i), t = N({
16
+ prices: e.prices,
17
+ salePrices: e.sale_prices,
18
+ fallbackPrice: e.price,
19
+ fallbackSalePrice: e.sale_price,
20
+ saleStartAt: e.sale_start_at,
21
+ saleEndAt: e.sale_end_at,
22
+ scheduledPrice: e.scheduled_price,
23
+ scheduledPrices: e.scheduled_prices,
24
+ scheduledPriceAt: e.scheduled_price_at,
25
+ currencyCode: l,
26
+ currencies: n
27
+ }), w = f && i ? i.min === i.max ? c(i.min, l) : `${c(i.min, l)} - ${c(
28
+ i.max,
29
+ l
30
+ )}` : c(t.sale_price ?? t.price, l), S = e.variants?.length ? e.variants : e.product_variants?.length ? e.product_variants : [], j = f ? S.some(
31
+ (a) => N({
32
+ prices: a.prices,
33
+ salePrices: a.sale_prices,
34
+ fallbackPrice: a.price,
35
+ fallbackSalePrice: a.sale_price,
36
+ saleStartAt: a.sale_start_at,
37
+ saleEndAt: a.sale_end_at,
38
+ scheduledPrice: a.scheduled_price,
39
+ scheduledPrices: a.scheduled_prices,
40
+ scheduledPriceAt: a.scheduled_price_at,
41
+ currencyCode: l,
42
+ currencies: n
43
+ }).sale_price != null
44
+ ) : t.sale_price != null, { t: p, lang: k } = T(), x = p("ecommerce.on_sale"), A = x === "ecommerce.on_sale" ? "On Sale" : x, h = $(e), o = e.freemius_plans?.[0]?.freemius_pricing?.[0], m = n.find((a) => a.is_default)?.code || "USD", _ = o?.override_monthly_price ?? o?.api_monthly_price, g = o?.override_annual_price ?? o?.api_annual_price, d = typeof _ == "number" ? P({
45
+ prices: {
46
+ [m]: b(
47
+ _,
48
+ m
49
+ )
50
+ },
51
+ currencyCode: l,
52
+ currencies: n
53
+ }) : null, u = typeof g == "number" ? P({
54
+ prices: {
55
+ [m]: b(
56
+ g,
57
+ m
58
+ )
59
+ },
60
+ currencyCode: l,
61
+ currencies: n
62
+ }) : null;
63
+ return /* @__PURE__ */ s("div", { className: v("group relative flex flex-col overflow-hidden rounded-lg border bg-card text-card-foreground shadow-sm transition-all hover:shadow-md", C), children: [
64
+ /* @__PURE__ */ s(y, { href: `/product/${e.slug}`, className: "relative aspect-square overflow-hidden bg-muted", children: [
65
+ j && /* @__PURE__ */ r("span", { className: "absolute left-3 top-3 z-10 rounded-full bg-destructive px-2.5 py-1 text-[10px] font-bold uppercase tracking-wider text-destructive-foreground shadow-sm", children: A }),
66
+ e.image_url ? /* @__PURE__ */ r(
67
+ "img",
68
+ {
69
+ src: e.image_url,
70
+ alt: e.title,
71
+ className: "h-full w-full object-cover object-center transition-transform duration-300 group-hover:scale-105"
72
+ }
73
+ ) : /* @__PURE__ */ r("div", { className: "flex h-full items-center justify-center text-muted-foreground", children: "No Image" })
74
+ ] }),
75
+ /* @__PURE__ */ s("div", { className: "flex flex-1 flex-col p-4", children: [
76
+ e.categories && e.categories.length > 0 && /* @__PURE__ */ r("div", { className: "text-[10px] font-bold uppercase tracking-widest text-amber-600 dark:text-amber-400 mb-1", children: e.categories.map((a) => F(a.name, a.name_translations, k)).join(" • ") }),
77
+ /* @__PURE__ */ r(y, { href: `/product/${e.slug}`, className: "mb-2", children: /* @__PURE__ */ r("h3", { className: "line-clamp-1 text-lg font-medium text-foreground group-hover:underline", children: e.title }) }),
78
+ /* @__PURE__ */ r("div", { className: "mb-4", children: e.product_type === "digital" && (d || u) ? /* @__PURE__ */ s("div", { className: "flex flex-wrap items-baseline gap-x-3 gap-y-1", children: [
79
+ d && /* @__PURE__ */ s("div", { className: "flex items-baseline gap-0.5", children: [
80
+ /* @__PURE__ */ r("span", { className: "text-xl font-bold text-primary", children: c(d.price, l) }),
81
+ /* @__PURE__ */ s("span", { className: "text-xs font-medium text-muted-foreground lowercase", children: [
82
+ "/ ",
83
+ p("ecommerce.month")
84
+ ] })
85
+ ] }),
86
+ u && /* @__PURE__ */ s("div", { className: "flex items-baseline gap-0.5", children: [
87
+ /* @__PURE__ */ r("span", { className: v("font-bold text-primary", d ? "text-lg" : "text-xl"), children: c(u.price, l) }),
88
+ /* @__PURE__ */ s("span", { className: "text-xs font-medium text-muted-foreground lowercase", children: [
89
+ "/ ",
90
+ p("ecommerce.year")
91
+ ] })
92
+ ] })
93
+ ] }) : /* @__PURE__ */ s("div", { className: "flex items-baseline gap-2", children: [
94
+ /* @__PURE__ */ r("span", { className: "text-xl font-bold text-primary", children: w }),
95
+ !f && t.sale_price && /* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground line-through", children: c(t.price, l) })
96
+ ] }) }),
97
+ h && /* @__PURE__ */ s("div", { className: "mb-4 rounded-md border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900", children: [
98
+ /* @__PURE__ */ r("div", { className: "font-semibold", children: h.label }),
99
+ /* @__PURE__ */ r("div", { className: "text-emerald-700", children: h.paymentRequirementLabel })
100
+ ] }),
101
+ /* @__PURE__ */ r("div", { className: "mt-auto", children: /* @__PURE__ */ r(
102
+ R,
103
+ {
104
+ product: {
105
+ ...e,
106
+ price: e.price,
107
+ prices: e.prices,
108
+ sale_price: e.sale_price,
109
+ sale_prices: e.sale_prices
110
+ },
111
+ className: "w-full"
112
+ }
113
+ ) })
114
+ ] })
115
+ ] });
116
+ };
117
+ export {
118
+ G as ProductCard
119
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),R=require("lucide-react"),T=require("@nextblock-cms/ui/badge"),z=require("@nextblock-cms/ui/button"),W=require("@nextblock-cms/ui/label"),H=require("@nextblock-cms/ui/separator"),q=require("@nextblock-cms/utils"),Q=require("../product-context.cjs.js"),Y=require("./ProductGallery.cjs.js"),Z=require("./AddToCartButton.cjs.js"),ee=require("./SubscriptionSelector.cjs.js"),te=require("./SimpleTiptapRenderer.cjs.js"),h=require("../variation-utils.cjs.js"),se=require("../CurrencyProvider.cjs.js"),$=require("../currency.cjs.js"),re=require("../types.cjs.js"),ae=require("../trials.cjs.js");function I(l,v,t,o){const y={kind:"product-field",field:v,input:t,label:o},p=typeof window<"u"?window.location.origin:process.env.NEXT_PUBLIC_URL||process.env.TARGET_URL||(process.env.VERCEL_URL?`https://${process.env.VERCEL_URL}`:"")||"http://localhost:3000";let x=(typeof window<"u"?window.location.origin:process.env.NEXT_PUBLIC_URL||process.env.TARGET_URL||(process.env.VERCEL_URL?`https://${process.env.VERCEL_URL}`:"")||"http://localhost:3000").replace(/\/+$/,"");try{(x.startsWith("http://")||x.startsWith("https://"))&&(x=new URL(x).hostname)}catch{}const k=process.env.NEXTBLOCK_VERCEL_PROJECT_ID||process.env.VERCEL_PROJECT_ID,w=process.env.NEXTBLOCK_VERCEL_WORKSPACE_ID||process.env.VERCEL_ORG_ID,n={origin:x,editUrl:`${p}/cms/products/${l.id}/edit`,data:{parentType:"product",parentId:l.id,slug:l.slug,languageId:l.language_id,draftId:null,target:y}};return k&&(n.projectId=k),w&&(n.workspaceId=w),{"data-vercel-edit-info":JSON.stringify(n),"data-vercel-edit-target":JSON.stringify(y),"data-nextblock-visual-edit":`product:${v}`}}const ie=({visualEditingEnabled:l=!1,descriptionNode:v})=>{const t=Q.useProduct(),{t:o,lang:y}=q.useTranslations(),{activeCurrencyCode:p,currencies:P}=se.useCurrency(),x=l?I(t,"title","plain-text","Product title"):void 0,k=l?I(t,"short_description","plain-text","Short description"):void 0,w=l?I(t,"description_json","tiptap","Product description"):void 0,n=(r,u,i)=>{const B=o(r,i);return B===r?u:B},C=t.images&&t.images.length>0?t.images:t.image_url?[{url:t.image_url,alt:t.title}]:[],b=t.custom_props?.provider==="freemius"||re.isDigitalProduct(t),A=ae.getTrialSummary(t),a=!b&&!!(t.has_variants&&t.attributes?.length&&t.variants?.length),g=t.attributes||[],d=t.variants||[],[_,E]=m.useState(()=>h.chooseInitialVariantSelections(g,d)),[S,L]=m.useState(1);m.useEffect(()=>{L(1)},[t.id]),m.useEffect(()=>{a&&E(h.chooseInitialVariantSelections(g,d))},[g,a,t.id,d]);const f=m.useMemo(()=>a?h.normalizeSelectionsToAvailableVariants(g,d,_):_,[g,a,_,d]);m.useEffect(()=>{JSON.stringify(f)!==JSON.stringify(_)&&E(f)},[f,_]);const s=m.useMemo(()=>a?h.findMatchingVariant(d,f):null,[a,f,d]),V=$.resolveEffectivePriceForCurrency({prices:t.prices,salePrices:t.sale_prices,fallbackPrice:t.price,fallbackSalePrice:t.sale_price,saleStartAt:t.sale_start_at,saleEndAt:t.sale_end_at,scheduledPrice:t.scheduled_price,scheduledPrices:t.scheduled_prices,scheduledPriceAt:t.scheduled_price_at,currencyCode:p,currencies:P}),O=a&&s?$.resolveEffectivePriceForCurrency({prices:s.prices,salePrices:s.sale_prices,fallbackPrice:s.price,fallbackSalePrice:s.sale_price,saleStartAt:s.sale_start_at,saleEndAt:s.sale_end_at,scheduledPrice:s.scheduled_price,scheduledPrices:s.scheduled_prices,scheduledPriceAt:s.scheduled_price_at,currencyCode:p,currencies:P}):null,j=O?.price??V.price,N=O?.sale_price??V.sale_price,c=a?s?.stock_quantity??0:t.stock??0,D=m.useMemo(()=>{if(!s?.image_url)return C;const r={url:s.image_url,alt:`${t.title} ${s.label}`},u=C.filter(i=>i.url!==s.image_url);return[r,...u]},[C,t.title,s]),M=typeof N=="number"&&j>0?Math.round((j-N)/j*100):0,F=a&&s?{...t,sku:s.sku,price:s.price,prices:s.prices,sale_price:typeof s.sale_price=="number"?s.sale_price:null,sale_prices:s.sale_prices,image_url:s.image_url||t.image_url,stock:s.stock_quantity,variant_id:s.id,variant_label:s.label,selected_options:s.selected_options,currency_code:p}:{...t,currency_code:p},J=(r,u)=>{E(i=>h.normalizeSelectionsToAvailableVariants(g,d,{...i,[r]:u}))},G=n("ecommerce.in_stock",`${c} in stock`,{count:String(c)}),U=n("ecommerce.out_of_stock","Out of stock"),K=n("ecommerce.select_options","Select Options"),X=n("ecommerce.variant_selection_required","Select one term from every dropdown to resolve a variation.");return e.jsxs("div",{className:"w-full animate-in fade-in slide-in-from-bottom-4 duration-700 ease-out",children:[e.jsx("div",{className:"container mx-auto px-4 md:px-6 py-12",children:e.jsxs("div",{className:"grid gap-12 lg:grid-cols-[2fr_3fr] items-start",children:[e.jsx("div",{className:"w-full max-w-2xl mx-auto lg:max-w-none",children:e.jsx(Y.ProductGallery,{images:D,className:"w-full"})}),e.jsxs("div",{className:"flex flex-col gap-4 pb-2 max-w-xl mx-auto lg:mx-0 lg:max-w-none",children:[e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl lg:text-5xl font-extrabold tracking-tight text-foreground leading-[1.1] lg:mt-0",...x,children:t.title}),t.categories&&t.categories.length>0&&e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 text-xs font-bold uppercase tracking-widest text-amber-600 dark:text-amber-400",children:t.categories.map((r,u)=>{const i=h.resolveTranslatedText(r.name,r.name_translations,y);return e.jsxs(m.Fragment,{children:[u>0&&e.jsx("span",{className:"text-muted-foreground/30",children:"•"}),e.jsx("span",{children:i})]},r.id)})}),e.jsx("div",{className:"prose prose-neutral dark:prose-invert max-w-none text-muted-foreground leading-relaxed text-left",...k,children:t.short_description?e.jsx("div",{className:"text-lg mb-4 leading-relaxed",dangerouslySetInnerHTML:{__html:t.short_description}}):l?e.jsx("p",{className:"text-lg mb-4 italic text-muted-foreground",children:"Add a short product description."}):null}),e.jsxs("div",{className:"flex items-center gap-3",children:[typeof N=="number"&&e.jsx(T.Badge,{variant:"destructive",className:"px-2.5 py-1 text-xs font-bold uppercase tracking-wide animate-pulse shadow-sm",children:o("ecommerce.sale_badge",{percent:String(M)})}),!b&&c>0&&c<10&&e.jsx(T.Badge,{variant:"outline",className:"text-amber-600 border-amber-200 bg-amber-50",children:o("ecommerce.low_stock",{count:String(c)})}),A&&e.jsx(T.Badge,{variant:"secondary",className:"border border-emerald-200 bg-emerald-50 text-emerald-800",children:A.label})]})]})}),e.jsxs("div",{className:"p-5 rounded-2xl bg-card/60 border border-border/80 shadow-md backdrop-blur-md space-y-4",children:[b?e.jsx(ee.SubscriptionSelector,{product:t}):e.jsxs("div",{className:"space-y-3.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:n("ecommerce.price","Price")}),e.jsxs("div",{className:"flex items-baseline gap-2.5",children:[e.jsx("span",{className:"text-3xl font-extrabold text-foreground",children:q.formatPrice(N??j,p)}),typeof N=="number"&&e.jsx("span",{className:"text-lg text-muted-foreground line-through decoration-destructive/20 decoration-1",children:q.formatPrice(j,p)})]})]}),!b&&(s||!a)&&e.jsxs("div",{className:"text-right space-y-1",children:[e.jsxs("span",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest block",children:[!a&&t.sku&&e.jsxs("span",{className:"mr-2 font-normal lowercase normal-case text-muted-foreground/70",children:["SKU: ",t.sku]}),n("ecommerce.status","Status")]}),e.jsx("div",{className:(c??0)>0?"text-emerald-600 dark:text-emerald-400 font-semibold text-sm":"text-destructive font-semibold text-sm",children:(c??0)>0?G:U})]})]}),a&&e.jsx("div",{className:"space-y-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:g.map(r=>{const u=h.getAvailableTermIdsForAttribute(d,r.id,f);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(W.Label,{htmlFor:`attribute-${r.id}`,className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:r.name}),s?.sku&&e.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:s.sku})]}),e.jsx("select",{id:`attribute-${r.id}`,className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",value:f[r.id]||"",onChange:i=>J(r.id,i.target.value),children:r.terms.map(i=>e.jsx("option",{value:i.id,disabled:!u.has(i.id),children:i.value},i.id))})]},r.id)})})}),a&&!s&&e.jsx("p",{className:"text-xs text-muted-foreground italic pt-1",children:X}),e.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[!b&&(c??0)>0&&e.jsxs("div",{className:"flex items-center border rounded-lg h-12 bg-background border-input select-none",children:[e.jsx("button",{type:"button",onClick:()=>L(r=>Math.max(1,r-1)),className:"px-3 h-full flex items-center justify-center text-muted-foreground hover:text-foreground active:scale-95 transition-all text-lg font-medium",disabled:S<=1,children:"-"}),e.jsx("span",{className:"w-8 text-center text-sm font-semibold",children:S}),e.jsx("button",{type:"button",onClick:()=>L(r=>c!==null&&r>=c?r:r+1),className:"px-3 h-full flex items-center justify-center text-muted-foreground hover:text-foreground active:scale-95 transition-all text-lg font-medium",disabled:c!==null&&S>=c,children:"+"})]}),a&&(!s||(c??0)<=0)?e.jsx(z.Button,{disabled:!0,className:"flex-1 h-12 text-md font-bold shadow-md",children:s?U:K}):e.jsx(Z.AddToCartButton,{product:F,quantity:S,className:"flex-1 h-12 text-md font-bold shadow-md transition-all hover:shadow-lg active:scale-[0.98]"})]})]}),e.jsx(H.Separator,{className:"opacity-60 my-0.5"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-center text-[11px] font-medium text-muted-foreground pt-1",children:[e.jsx("div",{className:"flex items-center justify-center gap-2",children:b?e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(R.Download,{className:"h-3.5 w-3.5"}),o("ecommerce.instant_digital_delivery")]}):e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(R.Package,{className:"h-3.5 w-3.5"}),o("ecommerce.free_shipping")]})}),e.jsx("div",{className:"flex items-center justify-center gap-2",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(R.ShieldCheck,{className:"h-3.5 w-3.5"}),o("ecommerce.secure_checkout")]})})]})]})]})]})}),e.jsx("div",{className:"min-w-0 w-full",...v?void 0:w,children:v||(t.description_json?e.jsx("div",{className:"container mx-auto px-4 md:px-6 pb-12 prose prose-neutral dark:prose-invert max-w-none leading-relaxed",children:e.jsx(te.SimpleTiptapRenderer,{content:t.description_json})}):e.jsx("div",{className:"container mx-auto px-4 md:px-6 pb-12",children:e.jsx("p",{className:"italic text-sm text-muted-foreground",children:o("ecommerce.no_description")})}))})]})};exports.ProductDetailsLayout=ie;