@nextblock-cms/ecom 0.8.6 → 0.8.11

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 +6 -6
  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
@@ -1,128 +0,0 @@
1
- import { getSsgSupabaseClient as v } from "@nextblock-cms/db/server";
2
- import { normalizePriceMap as l, convertMinorUnitAmount as O, getDefaultCurrency as M } from "./currency.es.js";
3
- import { normalizeCurrencyCode as y } from "@nextblock-cms/utils";
4
- import { resolveTranslatedText as S } from "./variation-utils.es.js";
5
- const k = ["auto", "manual"];
6
- function h(e) {
7
- if (typeof e == "string") {
8
- const r = e.trim().toLowerCase();
9
- if (k.includes(
10
- r
11
- ))
12
- return r;
13
- }
14
- return "auto";
15
- }
16
- function C(e, r = 0) {
17
- return typeof e == "number" && Number.isFinite(e) && e >= 0 ? Math.round(e) : r;
18
- }
19
- function A(e) {
20
- const r = y(
21
- e.sourceCurrencyCode
22
- ), t = l(e.amountMap);
23
- if (t[r] !== void 0)
24
- return r;
25
- const c = Object.keys(t)[0];
26
- return c ? y(c) : M(e.currencies).code;
27
- }
28
- function q(e) {
29
- const r = h(e.mode), t = l(e.costAmounts), c = l(e.minOrderAmounts), o = A({
30
- amountMap: Object.keys(t).length > 0 ? t : c,
31
- sourceCurrencyCode: e.sourceCurrencyCode,
32
- currencies: e.currencies
33
- }), u = t[o] ?? C(e.fallbackCostAmount), i = c[o] ?? C(e.fallbackMinOrderAmount);
34
- if (r === "auto")
35
- return {
36
- mode: r,
37
- sourceCurrencyCode: o,
38
- costAmounts: {
39
- [o]: u
40
- },
41
- minOrderAmounts: {
42
- [o]: i
43
- }
44
- };
45
- const d = Object.keys(t).length > 0 ? { ...t } : { [o]: u }, a = Object.keys(c).length > 0 ? { ...c } : { [o]: i };
46
- return d[o] === void 0 && (d[o] = u), a[o] === void 0 && (a[o] = i), {
47
- mode: r,
48
- sourceCurrencyCode: o,
49
- costAmounts: d,
50
- minOrderAmounts: a
51
- };
52
- }
53
- function g(e) {
54
- const r = h(e.mode), t = l(e.amountMap), c = y(e.currencyCode);
55
- if (r === "manual" && t[c] !== void 0)
56
- return t[c];
57
- const o = A({
58
- amountMap: t,
59
- sourceCurrencyCode: e.sourceCurrencyCode,
60
- currencies: e.currencies
61
- }), u = t[o] ?? C(e.fallbackAmount);
62
- return c === o ? u : O({
63
- amount: u,
64
- fromCurrencyCode: o,
65
- toCurrencyCode: c,
66
- currencies: e.currencies
67
- });
68
- }
69
- async function I(e, r, t, c) {
70
- const o = v(), { data: u } = await o.from("currencies").select(
71
- "code, symbol, exchange_rate, is_default, is_active, auto_sync_product_prices, auto_update_exchange_rate, exchange_rate_source, exchange_rate_updated_at, rounding_mode, rounding_increment, rounding_charm_amount"
72
- ).eq("is_active", !0).order("code", { ascending: !0 }), i = u ?? [], d = M(i), a = c || d.code, { data: _, error: z } = await o.from("shipping_zone_locations").select(`
73
- zone_id,
74
- country_code,
75
- state_code,
76
- postal_code,
77
- shipping_zones!inner(priority_order)
78
- `).eq("country_code", r.country).order("shipping_zones(priority_order)", { ascending: !0 });
79
- if (z || !_ || _.length === 0)
80
- return [];
81
- let m = null;
82
- if (r.state) {
83
- const n = _.find((s) => s.state_code === r.state);
84
- n && (m = n.zone_id);
85
- }
86
- if (!m) {
87
- const n = _.find((s) => !s.state_code && !s.postal_code);
88
- n && (m = n.zone_id);
89
- }
90
- m || (m = _[0].zone_id);
91
- const { data: f, error: b } = await o.from("shipping_zone_methods").select("id, zone_id, method_type, cost_amount, cost_amounts, cost_currency, currency_pricing_mode, min_order_amount, min_order_amounts, name, name_translations").eq("zone_id", m);
92
- if (b || !f)
93
- return [];
94
- const p = f.filter((n) => {
95
- const s = g({
96
- amountMap: n.min_order_amounts || {},
97
- fallbackAmount: n.min_order_amount || 0,
98
- sourceCurrencyCode: n.cost_currency || d.code,
99
- mode: n.currency_pricing_mode,
100
- currencyCode: a,
101
- currencies: i
102
- });
103
- return e >= s;
104
- }).map((n) => ({
105
- id: n.id,
106
- name: S(
107
- n.name,
108
- n.name_translations || null,
109
- t
110
- ),
111
- amount: g({
112
- amountMap: n.cost_amounts || {},
113
- fallbackAmount: n.cost_amount || 0,
114
- sourceCurrencyCode: n.cost_currency || d.code,
115
- mode: n.currency_pricing_mode,
116
- currencyCode: a,
117
- currencies: i
118
- }),
119
- currency: a,
120
- type: n.method_type
121
- })).sort((n, s) => n.amount - s.amount)[0];
122
- return p ? [p] : [];
123
- }
124
- export {
125
- h as n,
126
- I as r,
127
- q as s
128
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@nextblock-cms/db/server"),u=require("../product-actions-CONBF8i6.cjs");async function d(t,e,o=[],a=[]){const n=c.createClient(),{data:s,error:r}=await u.fetchTranslatedProductsForCartInternal(n,t,e,o,a);return r?(console.error("[getTranslatedProductsForCart] Error:",r),[]):s||[]}exports.getTranslatedProductsForCart=d;
@@ -1 +0,0 @@
1
- "use strict";const c=require("./resolver-Fz_FKsfX.cjs"),s=require("./states-CWYRxV4B.cjs");async function n(o,r,i,t){try{const e=s.normalizeCountryCode(r.country);return e?{success:!0,methods:await c.resolveShippingOptions(o,{...r,country:e,state:s.normalizeSubdivisionCode(e,r.state)||void 0},i,t)}:{success:!1,error:"Country is required for shipping calculation",errorKey:"ecommerce.shipping_country_required"}}catch(e){return console.error("Failed to resolve shipping options:",e),{success:!1,error:e.message||"Failed to calculate shipping",errorKey:"ecommerce.shipping_calculation_failed"}}}exports.getShippingEstimates=n;
@@ -1 +0,0 @@
1
- "use strict";const r=[{code:"US",name:"United States"},{code:"CA",name:"Canada"},{code:"GB",name:"United Kingdom"},{code:"AU",name:"Australia"},{code:"NZ",name:"New Zealand"},{code:"IE",name:"Ireland"},{code:"FR",name:"France"},{code:"DE",name:"Germany"},{code:"IT",name:"Italy"},{code:"ES",name:"Spain"},{code:"MX",name:"Mexico"},{code:"BR",name:"Brazil"},{code:"AR",name:"Argentina"},{code:"CL",name:"Chile"},{code:"CO",name:"Colombia"},{code:"PE",name:"Peru"},{code:"ZA",name:"South Africa"},{code:"NG",name:"Nigeria"},{code:"KE",name:"Kenya"},{code:"IN",name:"India"},{code:"JP",name:"Japan"},{code:"KR",name:"South Korea"},{code:"CN",name:"China"},{code:"SG",name:"Singapore"},{code:"MY",name:"Malaysia"},{code:"PH",name:"Philippines"},{code:"TH",name:"Thailand"},{code:"VN",name:"Vietnam"},{code:"ID",name:"Indonesia"},{code:"AE",name:"United Arab Emirates"},{code:"SA",name:"Saudi Arabia"},{code:"EG",name:"Egypt"},{code:"MA",name:"Morocco"},{code:"DZ",name:"Algeria"},{code:"TN",name:"Tunisia"},{code:"PT",name:"Portugal"},{code:"NL",name:"Netherlands"},{code:"BE",name:"Belgium"},{code:"CH",name:"Switzerland"},{code:"AT",name:"Austria"},{code:"SE",name:"Sweden"},{code:"NO",name:"Norway"},{code:"DK",name:"Denmark"},{code:"FI",name:"Finland"},{code:"PL",name:"Poland"},{code:"CZ",name:"Czech Republic"},{code:"HU",name:"Hungary"},{code:"RO",name:"Romania"},{code:"BG",name:"Bulgaria"},{code:"GR",name:"Greece"},{code:"TR",name:"Turkey"},{code:"IL",name:"Israel"},{code:"CY",name:"Cyprus"},{code:"MT",name:"Malta"}],S={USA:"US","UNITED STATES OF AMERICA":"US",UK:"GB","GREAT BRITAIN":"GB"};function i(n){const o=n?.trim();if(!o)return null;const e=o.toUpperCase(),a=S[e];if(a)return a;const d=r.find(m=>m.code===e);return d?d.code:r.find(m=>m.name.toUpperCase()===e)?.code??null}const I=[{code:"AL",name:"Alabama"},{code:"AK",name:"Alaska"},{code:"AZ",name:"Arizona"},{code:"AR",name:"Arkansas"},{code:"CA",name:"California"},{code:"CO",name:"Colorado"},{code:"CT",name:"Connecticut"},{code:"DE",name:"Delaware"},{code:"DC",name:"District of Columbia"},{code:"FL",name:"Florida"},{code:"GA",name:"Georgia"},{code:"HI",name:"Hawaii"},{code:"ID",name:"Idaho"},{code:"IL",name:"Illinois"},{code:"IN",name:"Indiana"},{code:"IA",name:"Iowa"},{code:"KS",name:"Kansas"},{code:"KY",name:"Kentucky"},{code:"LA",name:"Louisiana"},{code:"ME",name:"Maine"},{code:"MD",name:"Maryland"},{code:"MA",name:"Massachusetts"},{code:"MI",name:"Michigan"},{code:"MN",name:"Minnesota"},{code:"MS",name:"Mississippi"},{code:"MO",name:"Missouri"},{code:"MT",name:"Montana"},{code:"NE",name:"Nebraska"},{code:"NV",name:"Nevada"},{code:"NH",name:"New Hampshire"},{code:"NJ",name:"New Jersey"},{code:"NM",name:"New Mexico"},{code:"NY",name:"New York"},{code:"NC",name:"North Carolina"},{code:"ND",name:"North Dakota"},{code:"OH",name:"Ohio"},{code:"OK",name:"Oklahoma"},{code:"OR",name:"Oregon"},{code:"PA",name:"Pennsylvania"},{code:"RI",name:"Rhode Island"},{code:"SC",name:"South Carolina"},{code:"SD",name:"South Dakota"},{code:"TN",name:"Tennessee"},{code:"TX",name:"Texas"},{code:"UT",name:"Utah"},{code:"VT",name:"Vermont"},{code:"VA",name:"Virginia"},{code:"WA",name:"Washington"},{code:"WV",name:"West Virginia"},{code:"WI",name:"Wisconsin"},{code:"WY",name:"Wyoming"}],T=[{code:"AB",name:"Alberta"},{code:"BC",name:"British Columbia"},{code:"MB",name:"Manitoba"},{code:"NB",name:"New Brunswick"},{code:"NL",name:"Newfoundland and Labrador"},{code:"NS",name:"Nova Scotia"},{code:"NT",name:"Northwest Territories"},{code:"NU",name:"Nunavut"},{code:"ON",name:"Ontario"},{code:"PE",name:"Prince Edward Island"},{code:"QC",name:"Quebec"},{code:"SK",name:"Saskatchewan"},{code:"YT",name:"Yukon"}],s={US:I,CA:T},N={US:{CALIFORNIA:"CA",NEWYORK:"NY","NEW YORK":"NY",DISTRICTOFCOLUMBIA:"DC","DISTRICT OF COLUMBIA":"DC"},CA:{QUEBEC:"QC",ONTARIO:"ON","BRITISH COLUMBIA":"BC",BRITISHCOLUMBIA:"BC","NEWFOUNDLAND AND LABRADOR":"NL",NEWFOUNDLANDANDLABRADOR:"NL","NORTHWEST TERRITORIES":"NT",NORTHWESTTERRITORIES:"NT","PRINCE EDWARD ISLAND":"PE",PRINCEEDWARDISLAND:"PE"}};function l(n){const o=i(n);return o?s[o]??[]:[]}function R(n){return l(n).length>0}function A(n,o){const e=i(n),a=o?.trim();if(!e||!a)return a||null;const d=s[e];if(!d?.length)return a.toUpperCase();const c=a.toUpperCase(),m=d.find(t=>t.code===c);if(m)return m.code;const u=d.find(t=>t.name.toUpperCase()===c);if(u)return u.code;const C=c.replace(/\s+/g,"");return N[e]?.[c]??N[e]?.[C]??c}function E(n,o){const e=i(n),a=A(n,o);return!e||!a?o??null:s[e]?.find(c=>c.code===a)?.name??a}exports.countries=r;exports.countryUsesStructuredStates=R;exports.getStatesForCountry=l;exports.normalizeCountryCode=i;exports.normalizeSubdivisionCode=A;exports.resolveSubdivisionName=E;
@@ -1,181 +0,0 @@
1
- import { n as y, b } from "./states-DlHJezQ1.js";
2
- import { resolveEffectivePriceForCurrency as p } from "./currency.es.js";
3
- import { g as C } from "./coupon-server-DUKVtyYs.js";
4
- const x = "ecommerce_inventory_settings", c = {
5
- trackQuantities: !0,
6
- enableTaxes: !1,
7
- taxCalculationMode: "manual"
8
- };
9
- function m(e, t = !0) {
10
- if (typeof e == "boolean")
11
- return e;
12
- if (typeof e == "string") {
13
- const r = e.trim().toLowerCase();
14
- if (["true", "1", "yes", "on"].includes(r))
15
- return !0;
16
- if (["false", "0", "no", "off"].includes(r))
17
- return !1;
18
- }
19
- return t;
20
- }
21
- function E(e, t = c.taxCalculationMode) {
22
- return e === "automatic" ? "automatic" : e === "manual" ? "manual" : t;
23
- }
24
- function T(e) {
25
- if (e && typeof e == "object" && !Array.isArray(e)) {
26
- const t = e;
27
- return {
28
- trackQuantities: m(
29
- t.trackQuantities ?? t.track_quantities,
30
- c.trackQuantities
31
- ),
32
- enableTaxes: m(
33
- t.enableTaxes ?? t.enable_taxes,
34
- c.enableTaxes
35
- ),
36
- taxCalculationMode: E(
37
- t.taxCalculationMode ?? t.tax_calculation_mode,
38
- c.taxCalculationMode
39
- )
40
- };
41
- }
42
- return {
43
- trackQuantities: m(
44
- e,
45
- c.trackQuantities
46
- ),
47
- enableTaxes: c.enableTaxes,
48
- taxCalculationMode: c.taxCalculationMode
49
- };
50
- }
51
- async function S(e) {
52
- const { data: t, error: r } = await e.from("site_settings").select("value").eq("key", x).maybeSingle();
53
- return r || !t ? c : T(t.value);
54
- }
55
- async function A(e, t) {
56
- return e.from("site_settings").upsert({
57
- key: x,
58
- value: {
59
- track_quantities: t.trackQuantities,
60
- enable_taxes: t.enableTaxes,
61
- tax_calculation_mode: t.taxCalculationMode
62
- }
63
- });
64
- }
65
- function w(e) {
66
- return {
67
- error: `${e} is no longer available.`,
68
- errorKey: "ecommerce.inventory_item_unavailable",
69
- errorParams: { item: e },
70
- errorStatus: 409
71
- };
72
- }
73
- function N(e, t) {
74
- return {
75
- error: `Only ${t} units remain for ${e}.`,
76
- errorKey: "ecommerce.inventory_insufficient",
77
- errorParams: { item: e, count: t },
78
- errorStatus: 409
79
- };
80
- }
81
- const g = "txcd_99999999", M = "txcd_00000000", O = "txcd_92010001";
82
- function v(e) {
83
- return e ? g : M;
84
- }
85
- async function q(e, t, r, s, l) {
86
- if (!t.length)
87
- return [];
88
- const d = [...new Set(t.map((o) => o.product_id))], { data: u, error: _ } = await e.from("products").select("id, is_taxable").in("id", d);
89
- if (_)
90
- throw new Error(_.message);
91
- const f = new Map(
92
- (u || []).map((o) => [o.id, o])
93
- );
94
- return t.reduce((o, a) => {
95
- const n = f.get(a.product_id);
96
- if (!n)
97
- return o;
98
- const i = p({
99
- prices: a.prices,
100
- salePrices: a.sale_prices,
101
- fallbackPrice: a.price,
102
- fallbackSalePrice: a.sale_price,
103
- saleStartAt: a.sale_start_at,
104
- saleEndAt: a.sale_end_at,
105
- scheduledPrice: a.scheduled_price,
106
- scheduledPrices: a.scheduled_prices,
107
- scheduledPriceAt: a.scheduled_price_at,
108
- currencyCode: r,
109
- currencies: s
110
- });
111
- return o.push({
112
- product_id: n.id,
113
- quantity: a.quantity,
114
- unit_amount: i.sale_price ?? i.price,
115
- discount_amount: l?.get(C(a)) ?? 0,
116
- is_taxable: n.is_taxable ?? !0
117
- }), o;
118
- }, []);
119
- }
120
- async function R(e, t) {
121
- const r = await S(e), s = t.items.reduce((n, i) => i.is_taxable ? n + Math.max(0, i.unit_amount * i.quantity - (i.discount_amount ?? 0)) : n, 0);
122
- if (!r.enableTaxes || s <= 0)
123
- return {
124
- enabled: !1,
125
- mode: r.taxCalculationMode,
126
- amount: 0,
127
- taxableSubtotal: s,
128
- lines: []
129
- };
130
- if (r.taxCalculationMode === "automatic")
131
- return {
132
- enabled: !0,
133
- mode: "automatic",
134
- amount: 0,
135
- taxableSubtotal: s,
136
- lines: [],
137
- isPendingExternalCalculation: !0
138
- };
139
- const l = y(t.destination?.country_code), d = b(l, t.destination?.state) || null;
140
- if (!l)
141
- return {
142
- enabled: !0,
143
- mode: "manual",
144
- amount: 0,
145
- taxableSubtotal: s,
146
- lines: []
147
- };
148
- let u = e.from("tax_rates").select("id, country_code, state_code, tax_name, tax_rate, created_at, updated_at").eq("country_code", l);
149
- u = d ? u.or(`state_code.is.null,state_code.eq.${d}`) : u.is("state_code", null);
150
- const { data: _, error: f } = await u;
151
- if (f)
152
- throw new Error(f.message);
153
- const a = (_ || []).map((n) => ({
154
- id: n.id,
155
- name: n.tax_name,
156
- rate: Number(n.tax_rate),
157
- amount: Math.round(s * Number(n.tax_rate) / 100),
158
- country_code: n.country_code,
159
- state_code: n.state_code ?? null
160
- }));
161
- return {
162
- enabled: !0,
163
- mode: "manual",
164
- amount: a.reduce((n, i) => n + i.amount, 0),
165
- taxableSubtotal: s,
166
- lines: a
167
- };
168
- }
169
- export {
170
- x as E,
171
- O as S,
172
- w as a,
173
- q as b,
174
- R as c,
175
- N as d,
176
- M as e,
177
- v as f,
178
- S as g,
179
- T as n,
180
- A as u
181
- };
@@ -1 +0,0 @@
1
- "use strict";const x=require("./states-CWYRxV4B.cjs"),b=require("./currency.cjs.js"),p=require("./coupon-server-C9ySm3I5.cjs"),E="ecommerce_inventory_settings",s={trackQuantities:!0,enableTaxes:!1,taxCalculationMode:"manual"};function f(e,t=!0){if(typeof e=="boolean")return e;if(typeof e=="string"){const n=e.trim().toLowerCase();if(["true","1","yes","on"].includes(n))return!0;if(["false","0","no","off"].includes(n))return!1}return t}function S(e,t=s.taxCalculationMode){return e==="automatic"?"automatic":e==="manual"?"manual":t}function y(e){if(e&&typeof e=="object"&&!Array.isArray(e)){const t=e;return{trackQuantities:f(t.trackQuantities??t.track_quantities,s.trackQuantities),enableTaxes:f(t.enableTaxes??t.enable_taxes,s.enableTaxes),taxCalculationMode:S(t.taxCalculationMode??t.tax_calculation_mode,s.taxCalculationMode)}}return{trackQuantities:f(e,s.trackQuantities),enableTaxes:s.enableTaxes,taxCalculationMode:s.taxCalculationMode}}async function C(e){const{data:t,error:n}=await e.from("site_settings").select("value").eq("key",E).maybeSingle();return n||!t?s:y(t.value)}async function g(e,t){return e.from("site_settings").upsert({key:E,value:{track_quantities:t.trackQuantities,enable_taxes:t.enableTaxes,tax_calculation_mode:t.taxCalculationMode}})}function P(e){return{error:`${e} is no longer available.`,errorKey:"ecommerce.inventory_item_unavailable",errorParams:{item:e},errorStatus:409}}function M(e,t){return{error:`Only ${t} units remain for ${e}.`,errorKey:"ecommerce.inventory_insufficient",errorParams:{item:e,count:t},errorStatus:409}}const k="txcd_99999999",T="txcd_00000000",v="txcd_92010001";function A(e){return e?k:T}async function I(e,t,n,c,l){if(!t.length)return[];const d=[...new Set(t.map(o=>o.product_id))],{data:u,error:_}=await e.from("products").select("id, is_taxable").in("id",d);if(_)throw new Error(_.message);const m=new Map((u||[]).map(o=>[o.id,o]));return t.reduce((o,r)=>{const a=m.get(r.product_id);if(!a)return o;const i=b.resolveEffectivePriceForCurrency({prices:r.prices,salePrices:r.sale_prices,fallbackPrice:r.price,fallbackSalePrice:r.sale_price,saleStartAt:r.sale_start_at,saleEndAt:r.sale_end_at,scheduledPrice:r.scheduled_price,scheduledPrices:r.scheduled_prices,scheduledPriceAt:r.scheduled_price_at,currencyCode:n,currencies:c});return o.push({product_id:a.id,quantity:r.quantity,unit_amount:i.sale_price??i.price,discount_amount:l?.get(p.getCartLineCouponKey(r))??0,is_taxable:a.is_taxable??!0}),o},[])}async function N(e,t){const n=await C(e),c=t.items.reduce((a,i)=>i.is_taxable?a+Math.max(0,i.unit_amount*i.quantity-(i.discount_amount??0)):a,0);if(!n.enableTaxes||c<=0)return{enabled:!1,mode:n.taxCalculationMode,amount:0,taxableSubtotal:c,lines:[]};if(n.taxCalculationMode==="automatic")return{enabled:!0,mode:"automatic",amount:0,taxableSubtotal:c,lines:[],isPendingExternalCalculation:!0};const l=x.normalizeCountryCode(t.destination?.country_code),d=x.normalizeSubdivisionCode(l,t.destination?.state)||null;if(!l)return{enabled:!0,mode:"manual",amount:0,taxableSubtotal:c,lines:[]};let u=e.from("tax_rates").select("id, country_code, state_code, tax_name, tax_rate, created_at, updated_at").eq("country_code",l);u=d?u.or(`state_code.is.null,state_code.eq.${d}`):u.is("state_code",null);const{data:_,error:m}=await u;if(m)throw new Error(m.message);const r=(_||[]).map(a=>({id:a.id,name:a.tax_name,rate:Number(a.tax_rate),amount:Math.round(c*Number(a.tax_rate)/100),country_code:a.country_code,state_code:a.state_code??null}));return{enabled:!0,mode:"manual",amount:r.reduce((a,i)=>a+i.amount,0),taxableSubtotal:c,lines:r}}exports.ECOMMERCE_INVENTORY_SETTINGS_KEY=E;exports.STRIPE_TAX_CODE_NONTAXABLE=T;exports.STRIPE_TAX_CODE_SHIPPING=v;exports.buildCheckoutTaxableItemsFromCart=I;exports.calculateCheckoutTaxes=N;exports.createInventoryInsufficientError=M;exports.createInventoryUnavailableError=P;exports.getEcommerceInventorySettings=C;exports.getStripeTaxCodeForProduct=A;exports.normalizeEcommerceInventorySettings=y;exports.upsertEcommerceInventorySettings=g;
@@ -1 +0,0 @@
1
- "use strict";function t(e){const r=Number(e?.trial_period_days??0);return!Number.isFinite(r)||r<=0?0:Math.round(r)}function i(e){return t(e)===0?null:e?.trial_requires_payment_method?"paid":"free"}function a(e){const r=t(typeof e=="number"?{trial_period_days:e}:e);return r>0?`${r}-day free trial`:null}function n(e){return e?.trial_requires_payment_method?"Payment method required":"No credit card required"}function l(e){const r=a(e);return r?{label:r,paymentRequirementLabel:n(e),checkoutMode:i(e)}:null}exports.getTrialCheckoutMode=i;exports.getTrialLabel=a;exports.getTrialPaymentRequirementLabel=n;exports.getTrialPeriodDays=t;exports.getTrialSummary=l;
File without changes
File without changes
File without changes
File without changes
File without changes