@nextblock-cms/ecom 0.20.1 → 0.21.0
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.
- package/_virtual/_rolldown/runtime.cjs.js +1 -0
- package/index.cjs.js +1 -1
- package/index.es.js +38 -146
- package/lib/CurrencyProvider.cjs.js +1 -1
- package/lib/CurrencyProvider.d.ts +1 -1
- package/lib/CurrencyProvider.es.js +85 -95
- package/lib/PaymentReadinessProvider.cjs.js +1 -1
- package/lib/PaymentReadinessProvider.d.ts +1 -1
- package/lib/PaymentReadinessProvider.es.js +24 -27
- package/lib/cart-store.cjs.js +1 -1
- package/lib/cart-store.es.js +109 -121
- package/lib/components/AccountNavigationMenu.cjs.js +1 -1
- package/lib/components/AccountNavigationMenu.d.ts +1 -1
- package/lib/components/AccountNavigationMenu.es.js +36 -50
- package/lib/components/AddToCartButton.cjs.js +1 -1
- package/lib/components/AddToCartButton.d.ts +1 -1
- package/lib/components/AddToCartButton.es.js +94 -89
- package/lib/components/Cart.cjs.js +1 -1
- package/lib/components/Cart.d.ts +1 -1
- package/lib/components/Cart.es.js +261 -180
- package/lib/components/CartDrawer.cjs.js +1 -1
- package/lib/components/CartDrawer.d.ts +1 -1
- package/lib/components/CartDrawer.es.js +218 -148
- package/lib/components/CartIcon.cjs.js +1 -1
- package/lib/components/CartIcon.d.ts +1 -1
- package/lib/components/CartIcon.es.js +33 -35
- package/lib/components/Checkout.cjs.js +1 -1
- package/lib/components/Checkout.d.ts +1 -1
- package/lib/components/Checkout.es.js +1092 -1108
- package/lib/components/CouponForm.cjs.js +1 -1
- package/lib/components/CouponForm.d.ts +1 -1
- package/lib/components/CouponForm.es.js +136 -148
- package/lib/components/CurrencySwitcher.cjs.js +1 -1
- package/lib/components/CurrencySwitcher.d.ts +1 -1
- package/lib/components/CurrencySwitcher.es.js +22 -18
- package/lib/components/CustomerProfileForm.cjs.js +1 -1
- package/lib/components/CustomerProfileForm.es.js +454 -313
- package/lib/components/FeaturedProduct.cjs.js +1 -1
- package/lib/components/FeaturedProduct.d.ts +1 -1
- package/lib/components/FeaturedProduct.es.js +98 -83
- package/lib/components/FreemiusLicensePanel.cjs.js +1 -1
- package/lib/components/FreemiusLicensePanel.d.ts +1 -1
- package/lib/components/FreemiusLicensePanel.es.js +70 -65
- package/lib/components/InvoiceDocument.cjs.js +1 -1
- package/lib/components/InvoiceDocument.es.js +256 -192
- package/lib/components/InvoiceViewerShell.cjs.js +2 -2
- package/lib/components/InvoiceViewerShell.d.ts +1 -1
- package/lib/components/InvoiceViewerShell.es.js +75 -106
- package/lib/components/ProductCard.cjs.js +1 -1
- package/lib/components/ProductCard.d.ts +1 -1
- package/lib/components/ProductCard.es.js +186 -171
- package/lib/components/ProductDetailsLayout.cjs.js +1 -1
- package/lib/components/ProductDetailsLayout.es.js +405 -404
- package/lib/components/ProductGallery.cjs.js +1 -1
- package/lib/components/ProductGallery.d.ts +1 -1
- package/lib/components/ProductGallery.es.js +51 -54
- package/lib/components/ProductGrid.cjs.js +1 -1
- package/lib/components/ProductGrid.d.ts +1 -1
- package/lib/components/ProductGrid.es.js +23 -25
- package/lib/components/ShippingEstimator.cjs.js +1 -1
- package/lib/components/ShippingEstimator.d.ts +1 -1
- package/lib/components/ShippingEstimator.es.js +158 -153
- package/lib/components/ShortDescription.cjs.js +1 -1
- package/lib/components/ShortDescription.es.js +17 -17
- package/lib/components/SimpleTiptapRenderer.cjs.js +1 -1
- package/lib/components/SimpleTiptapRenderer.es.js +238 -211
- package/lib/components/SubscriptionSelector.cjs.js +1 -1
- package/lib/components/SubscriptionSelector.es.js +159 -154
- package/lib/countries.cjs.js +1 -1
- package/lib/countries.es.js +232 -75
- package/lib/coupon-server.cjs.js +1 -1
- package/lib/coupon-server.es.js +180 -224
- package/lib/coupons.cjs.js +1 -1
- package/lib/coupons.es.js +12 -14
- package/lib/currency-constants.cjs.js +1 -1
- package/lib/currency-constants.es.js +4 -4
- package/lib/currency-rest-client.cjs.js +1 -1
- package/lib/currency-rest-client.es.js +15 -22
- package/lib/currency-store.cjs.js +1 -1
- package/lib/currency-store.es.js +20 -27
- package/lib/currency-sync.cjs.js +1 -1
- package/lib/currency-sync.es.js +124 -170
- package/lib/currency.cjs.js +1 -1
- package/lib/currency.es.js +242 -310
- package/lib/customer-addresses.cjs.js +1 -1
- package/lib/customer-addresses.es.js +80 -109
- package/lib/customer-orders.cjs.js +1 -1
- package/lib/customer-orders.es.js +31 -43
- package/lib/customer.cjs.js +1 -1
- package/lib/customer.es.js +43 -52
- package/lib/export-helpers.cjs.js +1 -1
- package/lib/export-helpers.es.js +53 -52
- package/lib/factory.cjs.js +1 -1
- package/lib/factory.es.js +10 -7
- package/lib/freemius-coupons.cjs.js +1 -1
- package/lib/freemius-coupons.es.js +245 -262
- package/lib/freemius-license-claim.cjs.js +1 -1
- package/lib/freemius-license-claim.es.js +87 -71
- package/lib/freemius-license.cjs.js +1 -1
- package/lib/freemius-license.es.js +32 -39
- package/lib/freemius-order-sync.cjs.js +1 -1
- package/lib/freemius-order-sync.es.js +226 -290
- package/lib/freemius-trial-provision.cjs.js +1 -1
- package/lib/freemius-trial-provision.es.js +136 -130
- package/lib/inventory-settings.cjs.js +1 -1
- package/lib/inventory-settings.es.js +69 -77
- package/lib/invoice-server.cjs.js +3 -3
- package/lib/invoice-server.es.js +94 -141
- package/lib/invoice-ui.cjs.js +1 -1
- package/lib/invoice-ui.es.js +50 -66
- package/lib/invoice.cjs.js +1 -1
- package/lib/invoice.es.js +85 -94
- package/lib/order-inventory.cjs.js +25 -25
- package/lib/order-inventory.es.js +67 -79
- package/lib/order-tax-details.cjs.js +1 -1
- package/lib/order-tax-details.es.js +142 -153
- package/lib/pages/cms/coupons/CouponEditorForm.cjs.js +1 -1
- package/lib/pages/cms/coupons/CouponEditorForm.d.ts +1 -1
- package/lib/pages/cms/coupons/CouponEditorForm.es.js +227 -185
- package/lib/pages/cms/coupons/CouponsPage.cjs.js +2 -2
- package/lib/pages/cms/coupons/CouponsPage.d.ts +1 -1
- package/lib/pages/cms/coupons/CouponsPage.es.js +235 -166
- package/lib/pages/cms/coupons/CreateCouponDialog.cjs.js +1 -1
- package/lib/pages/cms/coupons/CreateCouponDialog.d.ts +1 -1
- package/lib/pages/cms/coupons/CreateCouponDialog.es.js +35 -34
- package/lib/pages/cms/coupons/EditCouponPage.cjs.js +1 -1
- package/lib/pages/cms/coupons/EditCouponPage.d.ts +1 -1
- package/lib/pages/cms/coupons/EditCouponPage.es.js +47 -47
- package/lib/pages/cms/coupons/ProductScopePicker.cjs.js +1 -1
- package/lib/pages/cms/coupons/ProductScopePicker.d.ts +1 -1
- package/lib/pages/cms/coupons/ProductScopePicker.es.js +128 -117
- package/lib/pages/cms/coupons/actions.cjs.js +1 -1
- package/lib/pages/cms/coupons/actions.es.js +112 -115
- package/lib/pages/cms/coupons/index.cjs.js +1 -0
- package/lib/pages/cms/coupons/index.es.js +3 -0
- package/lib/pages/cms/coupons/product-options.cjs.js +1 -1
- package/lib/pages/cms/coupons/product-options.es.js +21 -23
- package/lib/pages/cms/orders/ExportReportsDialog.cjs.js +1 -1
- package/lib/pages/cms/orders/ExportReportsDialog.es.js +135 -129
- package/lib/pages/cms/orders/MarkPaidButton.d.ts +1 -1
- package/lib/pages/cms/orders/OrderDetailPage.cjs.js +1 -1
- package/lib/pages/cms/orders/OrderDetailPage.d.ts +1 -1
- package/lib/pages/cms/orders/OrderDetailPage.es.js +186 -134
- package/lib/pages/cms/orders/OrderPrintButton.cjs.js +1 -1
- package/lib/pages/cms/orders/OrderPrintButton.d.ts +1 -1
- package/lib/pages/cms/orders/OrderPrintButton.es.js +15 -21
- package/lib/pages/cms/orders/OrderStatusForm.cjs.js +1 -1
- package/lib/pages/cms/orders/OrderStatusForm.d.ts +1 -1
- package/lib/pages/cms/orders/OrderStatusForm.es.js +85 -69
- package/lib/pages/cms/orders/OrdersPage.cjs.js +1 -1
- package/lib/pages/cms/orders/OrdersPage.d.ts +1 -1
- package/lib/pages/cms/orders/OrdersPage.es.js +170 -102
- package/lib/pages/cms/orders/actions.cjs.js +3 -3
- package/lib/pages/cms/orders/actions.es.js +53 -69
- package/lib/pages/cms/orders/export-actions.cjs.js +1 -1
- package/lib/pages/cms/orders/export-actions.es.js +23 -26
- package/lib/pages/cms/orders/index.cjs.js +1 -0
- package/lib/pages/cms/orders/index.es.js +6 -0
- package/lib/pages/cms/orders/server-actions.cjs.js +1 -1
- package/lib/pages/cms/orders/server-actions.es.js +60 -51
- package/lib/pages/cms/payments/PaymentsClient.cjs.js +1 -1
- package/lib/pages/cms/payments/PaymentsClient.d.ts +1 -1
- package/lib/pages/cms/payments/PaymentsClient.es.js +316 -346
- package/lib/pages/cms/payments/PaymentsPage.cjs.js +1 -1
- package/lib/pages/cms/payments/PaymentsPage.d.ts +1 -1
- package/lib/pages/cms/payments/PaymentsPage.es.js +29 -32
- package/lib/pages/cms/payments/actions.cjs.js +1 -1
- package/lib/pages/cms/payments/actions.es.js +38 -48
- package/lib/pages/cms/payments/index.cjs.js +1 -0
- package/lib/pages/cms/payments/index.es.js +3 -0
- package/lib/pages/cms/payments/queries.cjs.js +1 -1
- package/lib/pages/cms/payments/queries.es.js +38 -48
- package/lib/pages/cms/products/ProductsPage.cjs.js +1 -1
- package/lib/pages/cms/products/ProductsPage.d.ts +1 -1
- package/lib/pages/cms/products/ProductsPage.es.js +63 -66
- package/lib/pages/cms/products/[id]/edit/EditProductPage.d.ts +1 -1
- package/lib/pages/cms/products/_id_/edit/EditProductPage.cjs.js +1 -1
- package/lib/pages/cms/products/_id_/edit/EditProductPage.es.js +138 -155
- package/lib/pages/cms/products/actions.cjs.js +4 -4
- package/lib/pages/cms/products/actions.es.js +121 -162
- package/lib/pages/cms/products/attributes/AttributeManagementPage.cjs.js +1 -1
- package/lib/pages/cms/products/attributes/AttributeManagementPage.d.ts +1 -1
- package/lib/pages/cms/products/attributes/AttributeManagementPage.es.js +55 -47
- package/lib/pages/cms/products/attributes/components/AttributeManager.cjs.js +1 -1
- package/lib/pages/cms/products/attributes/components/AttributeManager.d.ts +1 -1
- package/lib/pages/cms/products/attributes/components/AttributeManager.es.js +285 -290
- package/lib/pages/cms/products/categories/CategoryManagementPage.cjs.js +1 -1
- package/lib/pages/cms/products/categories/CategoryManagementPage.d.ts +1 -1
- package/lib/pages/cms/products/categories/CategoryManagementPage.es.js +43 -35
- package/lib/pages/cms/products/categories/components/CategoryManager.cjs.js +1 -1
- package/lib/pages/cms/products/categories/components/CategoryManager.es.js +315 -262
- package/lib/pages/cms/products/components/CopyProductFromLanguage.cjs.js +1 -1
- package/lib/pages/cms/products/components/CopyProductFromLanguage.es.js +115 -113
- package/lib/pages/cms/products/components/CurrencyPriceFields.cjs.js +1 -1
- package/lib/pages/cms/products/components/CurrencyPriceFields.d.ts +1 -1
- package/lib/pages/cms/products/components/CurrencyPriceFields.es.js +136 -145
- package/lib/pages/cms/products/components/DeleteProductButton.cjs.js +1 -1
- package/lib/pages/cms/products/components/DeleteProductButton.d.ts +1 -1
- package/lib/pages/cms/products/components/DeleteProductButton.es.js +35 -47
- package/lib/pages/cms/products/components/FreemiusPricingDashboard.cjs.js +1 -1
- package/lib/pages/cms/products/components/FreemiusPricingDashboard.d.ts +1 -1
- package/lib/pages/cms/products/components/FreemiusPricingDashboard.es.js +106 -84
- package/lib/pages/cms/products/components/ProductCategorySelector.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductCategorySelector.es.js +156 -159
- package/lib/pages/cms/products/components/ProductForm.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductForm.es.js +872 -693
- package/lib/pages/cms/products/components/ProductMediaManager.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductMediaManager.es.js +106 -103
- package/lib/pages/cms/products/components/ProductsBulkTable.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductsBulkTable.d.ts +1 -1
- package/lib/pages/cms/products/components/ProductsBulkTable.es.js +303 -294
- package/lib/pages/cms/products/components/SaleScheduleFields.cjs.js +1 -1
- package/lib/pages/cms/products/components/SaleScheduleFields.d.ts +1 -1
- package/lib/pages/cms/products/components/SaleScheduleFields.es.js +111 -134
- package/lib/pages/cms/products/components/SyncFreemiusButton.cjs.js +1 -1
- package/lib/pages/cms/products/components/SyncFreemiusButton.d.ts +1 -1
- package/lib/pages/cms/products/components/SyncFreemiusButton.es.js +29 -35
- package/lib/pages/cms/products/components/SyncFreemiusPricingButton.cjs.js +2 -2
- package/lib/pages/cms/products/components/SyncFreemiusPricingButton.d.ts +1 -1
- package/lib/pages/cms/products/components/SyncFreemiusPricingButton.es.js +36 -48
- package/lib/pages/cms/products/components/SyncProductForm.d.ts +1 -1
- package/lib/pages/cms/products/components/VariationsEditor.cjs.js +1 -1
- package/lib/pages/cms/products/components/VariationsEditor.d.ts +1 -1
- package/lib/pages/cms/products/components/VariationsEditor.es.js +396 -405
- package/lib/pages/cms/products/index.cjs.js +1 -0
- package/lib/pages/cms/products/index.es.js +8 -0
- package/lib/pages/cms/products/inventory/InventoryPage.cjs.js +1 -1
- package/lib/pages/cms/products/inventory/InventoryPage.d.ts +1 -1
- package/lib/pages/cms/products/inventory/InventoryPage.es.js +21 -15
- package/lib/pages/cms/products/inventory/InventoryTableClient.cjs.js +2 -2
- package/lib/pages/cms/products/inventory/InventoryTableClient.d.ts +1 -1
- package/lib/pages/cms/products/inventory/InventoryTableClient.es.js +230 -209
- package/lib/pages/cms/products/inventory/actions.cjs.js +3 -3
- package/lib/pages/cms/products/inventory/actions.es.js +83 -91
- package/lib/pages/cms/products/new/NewProductPage.cjs.js +1 -1
- package/lib/pages/cms/products/new/NewProductPage.d.ts +1 -1
- package/lib/pages/cms/products/new/NewProductPage.es.js +58 -74
- package/lib/pages/cms/products/product-price-sync.cjs.js +1 -1
- package/lib/pages/cms/products/product-price-sync.es.js +74 -89
- package/lib/pages/cms/products/server-actions.cjs.js +1 -1
- package/lib/pages/cms/products/server-actions.es.js +250 -233
- package/lib/pages/cms/shipping/ShippingPage.cjs.js +2 -2
- package/lib/pages/cms/shipping/ShippingPage.es.js +287 -209
- package/lib/pages/cms/shipping/components/RateForm.cjs.js +1 -1
- package/lib/pages/cms/shipping/components/RateForm.d.ts +1 -1
- package/lib/pages/cms/shipping/components/RateForm.es.js +439 -436
- package/lib/pages/cms/shipping/components/ZoneForm.cjs.js +1 -1
- package/lib/pages/cms/shipping/components/ZoneForm.es.js +245 -224
- package/lib/pages/cms/shipping/index.cjs.js +1 -0
- package/lib/pages/cms/shipping/index.es.js +3 -0
- package/lib/pages/cms/shipping/server-actions.cjs.js +1 -1
- package/lib/pages/cms/shipping/server-actions.es.js +131 -149
- package/lib/pages/cms/taxes/TaxesPage.cjs.js +1 -1
- package/lib/pages/cms/taxes/TaxesPage.d.ts +1 -1
- package/lib/pages/cms/taxes/TaxesPage.es.js +211 -169
- package/lib/pages/cms/taxes/actions.cjs.js +1 -1
- package/lib/pages/cms/taxes/actions.es.js +41 -53
- package/lib/pages/cms/taxes/components/TaxRateForm.cjs.js +1 -1
- package/lib/pages/cms/taxes/components/TaxRateForm.d.ts +1 -1
- package/lib/pages/cms/taxes/components/TaxRateForm.es.js +112 -99
- package/lib/pages/cms/taxes/index.cjs.js +1 -0
- package/lib/pages/cms/taxes/index.es.js +3 -0
- package/lib/payment-config.cjs.js +1 -1
- package/lib/payment-config.es.js +110 -126
- package/lib/product-actions.cjs.js +4 -4
- package/lib/product-actions.es.js +289 -544
- package/lib/product-context.cjs.js +1 -1
- package/lib/product-context.es.js +13 -15
- package/lib/product-schema.cjs.js +1 -1
- package/lib/product-schema.es.js +99 -134
- package/lib/providers/freemius.cjs.js +1 -5
- package/lib/providers/freemius.es.js +446 -530
- package/lib/providers/stripe.cjs.js +1 -1
- package/lib/providers/stripe.es.js +417 -477
- package/lib/server-actions/coupon-actions.cjs.js +1 -1
- package/lib/server-actions/coupon-actions.es.js +22 -22
- package/lib/server-actions/customer-actions.cjs.js +1 -1
- package/lib/server-actions/customer-actions.es.js +26 -28
- package/lib/server-actions/product-actions.cjs.js +1 -1
- package/lib/server-actions/product-actions.es.js +9 -15
- package/lib/server-actions/shipping-actions.cjs.js +1 -1
- package/lib/server-actions/shipping-actions.es.js +27 -24
- package/lib/server-actions/tax-actions.cjs.js +1 -1
- package/lib/server-actions/tax-actions.es.js +33 -39
- package/lib/shared-inventory.cjs.js +2 -2
- package/lib/shared-inventory.es.js +111 -160
- package/lib/shipping/resolver.cjs.js +2 -2
- package/lib/shipping/resolver.es.js +44 -61
- package/lib/shipping-rate-currency.cjs.js +1 -1
- package/lib/shipping-rate-currency.es.js +52 -67
- package/lib/states.cjs.js +1 -1
- package/lib/states.es.js +333 -154
- package/lib/stripe/checkout.cjs.js +1 -1
- package/lib/stripe/checkout.es.js +125 -181
- package/lib/stripe/client.cjs.js +1 -1
- package/lib/stripe/client.es.js +14 -19
- package/lib/stripe/order-sync.cjs.js +1 -1
- package/lib/stripe/order-sync.es.js +106 -126
- package/lib/stripe/webhooks.cjs.js +1 -1
- package/lib/stripe/webhooks.es.js +37 -31
- package/lib/tax-calculation.cjs.js +1 -1
- package/lib/tax-calculation.es.js +84 -98
- package/lib/trials.cjs.js +1 -1
- package/lib/trials.es.js +24 -30
- package/lib/types.cjs.js +1 -1
- package/lib/types.es.js +21 -27
- package/lib/use-cart.cjs.js +1 -1
- package/lib/use-cart.es.js +38 -40
- package/lib/use-price-formatter.cjs.js +1 -1
- package/lib/use-price-formatter.es.js +10 -11
- package/lib/variation-utils.cjs.js +1 -1
- package/lib/variation-utils.es.js +199 -261
- package/lib/zod-config.cjs.js +1 -1
- package/lib/zod-config.es.js +5 -6
- package/package.json +16 -16
- package/server.cjs.js +1 -1
- package/server.es.js +56 -211
package/lib/cart-store.es.js
CHANGED
|
@@ -1,124 +1,112 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { isDigitalItem as e } from "./types.es.js";
|
|
2
|
+
import { resolveEffectivePriceForCurrency as t } from "./currency.es.js";
|
|
3
|
+
import { useCurrency as n } from "./CurrencyProvider.es.js";
|
|
4
|
+
import { create as r } from "zustand";
|
|
5
|
+
import { createJSONStorage as i, persist as a } from "zustand/middleware";
|
|
6
|
+
//#region libs/ecommerce/src/lib/cart-store.ts
|
|
7
|
+
function o(t, n, r) {
|
|
8
|
+
return t.reduce((t, i) => e(i) || i.sku !== n || r && i.id === r ? t : t + i.quantity, 0);
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
fallbackSalePrice: e.sale_price,
|
|
100
|
-
saleStartAt: e.sale_start_at,
|
|
101
|
-
saleEndAt: e.sale_end_at,
|
|
102
|
-
scheduledPrice: e.scheduled_price,
|
|
103
|
-
scheduledPrices: e.scheduled_prices,
|
|
104
|
-
scheduledPriceAt: e.scheduled_price_at,
|
|
105
|
-
currencyCode: o.currencyCode,
|
|
106
|
-
currencies: o.currencies
|
|
107
|
-
});
|
|
10
|
+
var s = r()(a((t, n) => ({
|
|
11
|
+
items: [],
|
|
12
|
+
appliedCoupon: null,
|
|
13
|
+
isOpen: !1,
|
|
14
|
+
addItem: (r) => {
|
|
15
|
+
let { items: i } = n(), a = r.quantity ?? 1, s = typeof r.stock == "number" ? r.stock : null, c = s === null ? 0 : o(i, r.sku);
|
|
16
|
+
if (e(r)) return i.find((t) => t.product_id === r.product_id && e(t)) ? {
|
|
17
|
+
success: !1,
|
|
18
|
+
error: "This software license is already in your cart.",
|
|
19
|
+
errorKey: "ecommerce.cart_error_license_in_cart"
|
|
20
|
+
} : (t({
|
|
21
|
+
items: [...i, {
|
|
22
|
+
...r,
|
|
23
|
+
quantity: 1
|
|
24
|
+
}],
|
|
25
|
+
isOpen: !0
|
|
26
|
+
}), { success: !0 });
|
|
27
|
+
let l = i.find((e) => e.id === r.id);
|
|
28
|
+
return s !== null && s <= 0 ? {
|
|
29
|
+
success: !1,
|
|
30
|
+
error: "This item is out of stock.",
|
|
31
|
+
errorKey: "ecommerce.cart_error_out_of_stock"
|
|
32
|
+
} : s !== null && c + a > s ? {
|
|
33
|
+
success: !1,
|
|
34
|
+
error: `Only ${s} available for this SKU.`,
|
|
35
|
+
errorKey: "ecommerce.cart_error_stock_limit",
|
|
36
|
+
errorParams: { count: s }
|
|
37
|
+
} : (t(l ? {
|
|
38
|
+
items: i.map((e) => e.id === r.id ? {
|
|
39
|
+
...e,
|
|
40
|
+
...r,
|
|
41
|
+
quantity: e.quantity + a
|
|
42
|
+
} : e),
|
|
43
|
+
isOpen: !0
|
|
44
|
+
} : {
|
|
45
|
+
items: [...i, {
|
|
46
|
+
...r,
|
|
47
|
+
quantity: a
|
|
48
|
+
}],
|
|
49
|
+
isOpen: !0
|
|
50
|
+
}), { success: !0 });
|
|
51
|
+
},
|
|
52
|
+
removeItem: (e) => {
|
|
53
|
+
let { items: r } = n();
|
|
54
|
+
t({ items: r.filter((t) => t.id !== e) });
|
|
55
|
+
},
|
|
56
|
+
updateQuantity: (r, i) => {
|
|
57
|
+
let { items: a } = n(), s = a.find((e) => e.id === r);
|
|
58
|
+
s && e(s) || (s && typeof s.stock == "number" && i + o(a, s.sku, r) > s.stock && (i = Math.max(s.stock - o(a, s.sku, r), 0)), t(i <= 0 ? { items: a.filter((e) => e.id !== r) } : { items: a.map((e) => e.id === r ? {
|
|
59
|
+
...e,
|
|
60
|
+
quantity: i
|
|
61
|
+
} : e) }));
|
|
62
|
+
},
|
|
63
|
+
setAppliedCoupon: (e) => {
|
|
64
|
+
let r = n().appliedCoupon;
|
|
65
|
+
(r?.code !== e?.code || r?.couponId !== e?.couponId) && t({ appliedCoupon: e });
|
|
66
|
+
},
|
|
67
|
+
removeCoupon: () => {
|
|
68
|
+
n().appliedCoupon && t({ appliedCoupon: null });
|
|
69
|
+
},
|
|
70
|
+
clearCart: () => t({
|
|
71
|
+
items: [],
|
|
72
|
+
appliedCoupon: null
|
|
73
|
+
}),
|
|
74
|
+
toggleCart: () => t((e) => ({ isOpen: !e.isOpen })),
|
|
75
|
+
setIsOpen: (e) => t({ isOpen: e }),
|
|
76
|
+
setItems: (e) => t({ items: e })
|
|
77
|
+
}), {
|
|
78
|
+
name: "cart-storage",
|
|
79
|
+
storage: i(() => localStorage),
|
|
80
|
+
skipHydration: !0,
|
|
81
|
+
partialize: (e) => ({
|
|
82
|
+
items: e.items,
|
|
83
|
+
appliedCoupon: e.appliedCoupon
|
|
84
|
+
})
|
|
85
|
+
})), c = () => s((e) => e.items).reduce((e, t) => e + t.quantity, 0);
|
|
86
|
+
function l(e, n) {
|
|
87
|
+
return t({
|
|
88
|
+
prices: e.prices,
|
|
89
|
+
salePrices: e.sale_prices,
|
|
90
|
+
fallbackPrice: e.price,
|
|
91
|
+
fallbackSalePrice: e.sale_price,
|
|
92
|
+
saleStartAt: e.sale_start_at,
|
|
93
|
+
saleEndAt: e.sale_end_at,
|
|
94
|
+
scheduledPrice: e.scheduled_price,
|
|
95
|
+
scheduledPrices: e.scheduled_prices,
|
|
96
|
+
scheduledPriceAt: e.scheduled_price_at,
|
|
97
|
+
currencyCode: n.currencyCode,
|
|
98
|
+
currencies: n.currencies
|
|
99
|
+
});
|
|
108
100
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
};
|
|
119
|
-
export {
|
|
120
|
-
m as getCartItemActivePrice,
|
|
121
|
-
p as useCartStore,
|
|
122
|
-
g as useCartSubtotal,
|
|
123
|
-
b as useCartTotalItems
|
|
101
|
+
var u = () => {
|
|
102
|
+
let e = s((e) => e.items), { activeCurrencyCode: t, currencies: r } = n();
|
|
103
|
+
return e.reduce((e, n) => {
|
|
104
|
+
let { price: i, sale_price: a } = l(n, {
|
|
105
|
+
currencyCode: t,
|
|
106
|
+
currencies: r
|
|
107
|
+
});
|
|
108
|
+
return e + (a ?? i) * n.quantity;
|
|
109
|
+
}, 0);
|
|
124
110
|
};
|
|
111
|
+
//#endregion
|
|
112
|
+
export { l as getCartItemActivePrice, s as useCartStore, u as useCartSubtotal, c as useCartTotalItems };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js");let t=require("next/link");t=e.__toESM(t,1);let n=require("lucide-react"),r=require("@nextblock-cms/utils"),i=require("react/jsx-runtime"),a=require("next/navigation");function o(e,t,n){let r=e(t);return r===t?n:r}function s(e){return e===`password`?n.KeyRound:n.Package2}function c({links:e,title:n,className:c}){let l=(0,a.usePathname)(),{t:u}=(0,r.useTranslations)();return e.length?(0,i.jsxs)(`nav`,{"aria-label":n||o(u,`account_navigation`,`Account`),className:(0,r.cn)(`w-full space-y-3`,c),children:[(0,i.jsx)(`div`,{"aria-hidden":`true`,className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:n||o(u,`account_navigation`,`Account`)}),(0,i.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let n=s(e.icon),a=l===e.href||l.startsWith(`${e.href}/`);return(0,i.jsxs)(t.default,{href:e.href,"aria-current":a?`page`:void 0,className:(0,r.cn)(`flex items-center gap-3 rounded-xl border px-3 py-2.5 text-sm font-medium transition-colors`,a?`border-primary bg-primary text-primary-foreground`:`border-border bg-background hover:bg-muted/40`),children:[(0,i.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,i.jsx)(`span`,{children:o(u,e.labelKey,e.fallbackLabel)})]},e.href)})})]}):null}exports.AccountNavigationMenu=c;
|
|
@@ -10,5 +10,5 @@ interface AccountNavigationMenuProps {
|
|
|
10
10
|
title?: string;
|
|
11
11
|
className?: string;
|
|
12
12
|
}
|
|
13
|
-
export declare function AccountNavigationMenu({ links, title, className, }: AccountNavigationMenuProps): import(
|
|
13
|
+
export declare function AccountNavigationMenu({ links, title, className, }: AccountNavigationMenuProps): import('react').JSX.Element | null;
|
|
14
14
|
export {};
|
|
@@ -1,53 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "next/link";
|
|
3
|
+
import { KeyRound as t, Package2 as n } from "lucide-react";
|
|
4
|
+
import { cn as r, useTranslations as i } from "@nextblock-cms/utils";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { usePathname as s } from "next/navigation";
|
|
7
|
+
//#region libs/ecommerce/src/lib/components/AccountNavigationMenu.tsx
|
|
8
|
+
function c(e, t, n) {
|
|
9
|
+
let r = e(t);
|
|
10
|
+
return r === t ? n : r;
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
12
|
+
function l(e) {
|
|
13
|
+
return e === "password" ? t : n;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// Theme tokens: slate-900 on a dark theme was a dark pill on a dark card.
|
|
37
|
-
i ? "border-primary bg-primary text-primary-foreground" : "border-border bg-background hover:bg-muted/40"
|
|
38
|
-
),
|
|
39
|
-
children: [
|
|
40
|
-
/* @__PURE__ */ n(d, { className: "h-4 w-4 shrink-0" }),
|
|
41
|
-
/* @__PURE__ */ n("span", { children: s(c, r.labelKey, r.fallbackLabel) })
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
|
-
r.href
|
|
45
|
-
);
|
|
46
|
-
}) })
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
) : null;
|
|
15
|
+
function u({ links: t, title: n, className: u }) {
|
|
16
|
+
let d = s(), { t: f } = i();
|
|
17
|
+
return t.length ? /* @__PURE__ */ o("nav", {
|
|
18
|
+
"aria-label": n || c(f, "account_navigation", "Account"),
|
|
19
|
+
className: r("w-full space-y-3", u),
|
|
20
|
+
children: [/* @__PURE__ */ a("div", {
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
className: "text-sm font-medium text-muted-foreground uppercase tracking-wider",
|
|
23
|
+
children: n || c(f, "account_navigation", "Account")
|
|
24
|
+
}), /* @__PURE__ */ a("div", {
|
|
25
|
+
className: "space-y-2",
|
|
26
|
+
children: t.map((t) => {
|
|
27
|
+
let n = l(t.icon), i = d === t.href || d.startsWith(`${t.href}/`);
|
|
28
|
+
return /* @__PURE__ */ o(e, {
|
|
29
|
+
href: t.href,
|
|
30
|
+
"aria-current": i ? "page" : void 0,
|
|
31
|
+
className: r("flex items-center gap-3 rounded-xl border px-3 py-2.5 text-sm font-medium transition-colors", i ? "border-primary bg-primary text-primary-foreground" : "border-border bg-background hover:bg-muted/40"),
|
|
32
|
+
children: [/* @__PURE__ */ a(n, { className: "h-4 w-4 shrink-0" }), /* @__PURE__ */ a("span", { children: c(f, t.labelKey, t.fallbackLabel) })]
|
|
33
|
+
}, t.href);
|
|
34
|
+
})
|
|
35
|
+
})]
|
|
36
|
+
}) : null;
|
|
50
37
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { u as AccountNavigationMenu };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../types.cjs.js"),n=require("../CurrencyProvider.cjs.js"),r=require("../use-cart.cjs.js"),i=require("../PaymentReadinessProvider.cjs.js");let a=require("@nextblock-cms/ui/button"),o=require("next/link");o=e.__toESM(o,1);let s=require("lucide-react"),c=require("@nextblock-cms/utils"),l=require("react/jsx-runtime"),u=require("sonner");var d=({product:e,className:d,quantity:f})=>{let p=r.useCart(e=>e),{t:m}=(0,c.useTranslations)(),{activeCurrencyCode:h}=n.useCurrency(),g=i.useCanPurchase(e),_=t.isDigitalProduct(e),v=!!e.has_variants&&!e.variant_id&&!_,y=!_&&typeof e.stock==`number`&&e.stock<=0;if(!g){let t=m(`ecommerce.contact_seller`);return(0,l.jsx)(a.Button,{asChild:!0,variant:`outline`,className:d,children:(0,l.jsxs)(o.default,{href:`/product/${e.slug}#contact-seller`,children:[(0,l.jsx)(s.Mail,{className:`mr-2 h-4 w-4`}),t===`ecommerce.contact_seller`?`Contact the seller`:t]})})}if(v)return(0,l.jsx)(a.Button,{asChild:!0,className:d,children:(0,l.jsx)(o.default,{href:`/product/${e.slug}`,children:m(`ecommerce.select_options`)===`ecommerce.select_options`?`Select options`:m(`ecommerce.select_options`)})});if(y){let e=m(`ecommerce.out_of_stock`);return(0,l.jsxs)(a.Button,{disabled:!0,className:d,children:[(0,l.jsx)(s.ShoppingCart,{className:`mr-2 h-4 w-4`}),e===`ecommerce.out_of_stock`?`Out of stock`:e]})}if(!p)return(0,l.jsxs)(a.Button,{disabled:!0,className:d,children:[(0,l.jsx)(s.ShoppingCart,{className:`mr-2 h-4 w-4`}),m(`ecommerce.add_to_cart`)]});let{addItem:b}=p;return(0,l.jsxs)(a.Button,{onClick:()=>{let n=t.getProductPaymentProvider(e)??`stripe`,{success:r,error:i,errorKey:a,errorParams:o}=b({id:e.variant_id||e.id,product_id:e.id,title:e.title,price:e.price,prices:e.prices,sale_price:e.sale_price,sale_prices:e.sale_prices,sale_start_at:e.sale_start_at,sale_end_at:e.sale_end_at,scheduled_price:e.scheduled_price,scheduled_prices:e.scheduled_prices,scheduled_price_at:e.scheduled_price_at,is_taxable:e.is_taxable,image_url:e.image_url,slug:e.slug,sku:e.sku,stock:e.stock,language_id:e.language_id,translation_group_id:e.translation_group_id,product_type:e.product_type,payment_provider:e.payment_provider??n,provider:n,freemius_product_id:e.freemius_product_id,freemius_plan_id:e.freemius_plan_id,trial_period_days:e.trial_period_days??0,trial_requires_payment_method:e.trial_requires_payment_method??!1,has_variants:e.has_variants,variant_id:e.variant_id,variant_label:e.variant_label,selected_options:e.selected_options,currency_code:h,quantity:f});if(r)u.toast.success(m(`ecommerce.added_to_cart_success`,{item:e.title}));else{let e=a?m(a,o):null;u.toast.error(e&&e!==a?e:i||m(`ecommerce.added_to_cart_error`))}},className:d,children:[(0,l.jsx)(s.ShoppingCart,{className:`mr-2 h-4 w-4`}),m(`ecommerce.add_to_cart`)]})};exports.AddToCartButton=d;
|
|
@@ -4,5 +4,5 @@ interface AddToCartButtonProps {
|
|
|
4
4
|
className?: string;
|
|
5
5
|
quantity?: number;
|
|
6
6
|
}
|
|
7
|
-
export declare const AddToCartButton: ({ product, className, quantity }: AddToCartButtonProps) => import(
|
|
7
|
+
export declare const AddToCartButton: ({ product, className, quantity }: AddToCartButtonProps) => import('react').JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -1,91 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { getProductPaymentProvider as e, isDigitalProduct as t } from "../types.es.js";
|
|
3
|
+
import { useCurrency as n } from "../CurrencyProvider.es.js";
|
|
4
|
+
import { useCart as r } from "../use-cart.es.js";
|
|
5
|
+
import { useCanPurchase as i } from "../PaymentReadinessProvider.es.js";
|
|
3
6
|
import { Button as a } from "@nextblock-cms/ui/button";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
7
|
+
import o from "next/link";
|
|
8
|
+
import { Mail as s, ShoppingCart as c } from "lucide-react";
|
|
9
|
+
import { useTranslations as l } from "@nextblock-cms/utils";
|
|
10
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
11
|
+
import { toast as f } from "sonner";
|
|
12
|
+
//#region libs/ecommerce/src/lib/components/AddToCartButton.tsx
|
|
13
|
+
var p = ({ product: p, className: m, quantity: h }) => {
|
|
14
|
+
let g = r((e) => e), { t: _ } = l(), { activeCurrencyCode: v } = n(), y = i(p), b = t(p), x = !!p.has_variants && !p.variant_id && !b, S = !b && typeof p.stock == "number" && p.stock <= 0;
|
|
15
|
+
if (!y) {
|
|
16
|
+
let e = _("ecommerce.contact_seller");
|
|
17
|
+
return /* @__PURE__ */ u(a, {
|
|
18
|
+
asChild: !0,
|
|
19
|
+
variant: "outline",
|
|
20
|
+
className: m,
|
|
21
|
+
children: /* @__PURE__ */ d(o, {
|
|
22
|
+
href: `/product/${p.slug}#contact-seller`,
|
|
23
|
+
children: [/* @__PURE__ */ u(s, { className: "mr-2 h-4 w-4" }), e === "ecommerce.contact_seller" ? "Contact the seller" : e]
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (x) return /* @__PURE__ */ u(a, {
|
|
28
|
+
asChild: !0,
|
|
29
|
+
className: m,
|
|
30
|
+
children: /* @__PURE__ */ u(o, {
|
|
31
|
+
href: `/product/${p.slug}`,
|
|
32
|
+
children: _("ecommerce.select_options") === "ecommerce.select_options" ? "Select options" : _("ecommerce.select_options")
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
if (S) {
|
|
36
|
+
let e = _("ecommerce.out_of_stock");
|
|
37
|
+
return /* @__PURE__ */ d(a, {
|
|
38
|
+
disabled: !0,
|
|
39
|
+
className: m,
|
|
40
|
+
children: [/* @__PURE__ */ u(c, { className: "mr-2 h-4 w-4" }), e === "ecommerce.out_of_stock" ? "Out of stock" : e]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (!g) return /* @__PURE__ */ d(a, {
|
|
44
|
+
disabled: !0,
|
|
45
|
+
className: m,
|
|
46
|
+
children: [/* @__PURE__ */ u(c, { className: "mr-2 h-4 w-4" }), _("ecommerce.add_to_cart")]
|
|
47
|
+
});
|
|
48
|
+
let { addItem: C } = g;
|
|
49
|
+
return /* @__PURE__ */ d(a, {
|
|
50
|
+
onClick: () => {
|
|
51
|
+
let t = e(p) ?? "stripe", { success: n, error: r, errorKey: i, errorParams: a } = C({
|
|
52
|
+
id: p.variant_id || p.id,
|
|
53
|
+
product_id: p.id,
|
|
54
|
+
title: p.title,
|
|
55
|
+
price: p.price,
|
|
56
|
+
prices: p.prices,
|
|
57
|
+
sale_price: p.sale_price,
|
|
58
|
+
sale_prices: p.sale_prices,
|
|
59
|
+
sale_start_at: p.sale_start_at,
|
|
60
|
+
sale_end_at: p.sale_end_at,
|
|
61
|
+
scheduled_price: p.scheduled_price,
|
|
62
|
+
scheduled_prices: p.scheduled_prices,
|
|
63
|
+
scheduled_price_at: p.scheduled_price_at,
|
|
64
|
+
is_taxable: p.is_taxable,
|
|
65
|
+
image_url: p.image_url,
|
|
66
|
+
slug: p.slug,
|
|
67
|
+
sku: p.sku,
|
|
68
|
+
stock: p.stock,
|
|
69
|
+
language_id: p.language_id,
|
|
70
|
+
translation_group_id: p.translation_group_id,
|
|
71
|
+
product_type: p.product_type,
|
|
72
|
+
payment_provider: p.payment_provider ?? t,
|
|
73
|
+
provider: t,
|
|
74
|
+
freemius_product_id: p.freemius_product_id,
|
|
75
|
+
freemius_plan_id: p.freemius_plan_id,
|
|
76
|
+
trial_period_days: p.trial_period_days ?? 0,
|
|
77
|
+
trial_requires_payment_method: p.trial_requires_payment_method ?? !1,
|
|
78
|
+
has_variants: p.has_variants,
|
|
79
|
+
variant_id: p.variant_id,
|
|
80
|
+
variant_label: p.variant_label,
|
|
81
|
+
selected_options: p.selected_options,
|
|
82
|
+
currency_code: v,
|
|
83
|
+
quantity: h
|
|
84
|
+
});
|
|
85
|
+
if (n) f.success(_("ecommerce.added_to_cart_success", { item: p.title }));
|
|
86
|
+
else {
|
|
87
|
+
let e = i ? _(i, a) : null;
|
|
88
|
+
f.error(e && e !== i ? e : r || _("ecommerce.added_to_cart_error"));
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
className: m,
|
|
92
|
+
children: [/* @__PURE__ */ u(c, { className: "mr-2 h-4 w-4" }), _("ecommerce.add_to_cart")]
|
|
93
|
+
});
|
|
91
94
|
};
|
|
95
|
+
//#endregion
|
|
96
|
+
export { p as AddToCartButton };
|