@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
|
@@ -1,263 +1,316 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useRouter as
|
|
7
|
-
import {
|
|
8
|
-
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect as e, useState as t } from "react";
|
|
3
|
+
import { Edit2 as n, FolderKanban as r, FolderPlus as i, HelpCircle as a, Loader2 as o, Trash2 as s } from "lucide-react";
|
|
4
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
5
|
+
import { toast as d } from "sonner";
|
|
6
|
+
import { useRouter as f } from "next/navigation";
|
|
7
|
+
import { Button as p, Card as m, Input as h, Label as g, Textarea as _ } from "@nextblock-cms/ui";
|
|
8
|
+
//#region libs/ecommerce/src/lib/pages/cms/products/categories/components/CategoryManager.tsx
|
|
9
|
+
function v({ initialCategories: v = [], languages: y = [], createCategory: b, updateCategory: x, deleteCategory: S }) {
|
|
10
|
+
let C = f(), [w, T] = t(v), [E, D] = t(!1), [O, k] = t(null), [A, j] = t(""), [M, N] = t(""), [P, F] = t(""), [I, L] = t({}), [R, z] = t({}), [B, V] = t(!1), H = (y || []).filter((e) => !e.is_default);
|
|
11
|
+
e(() => {
|
|
12
|
+
T(v);
|
|
13
|
+
}, [v]);
|
|
14
|
+
let U = (e) => e.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, ""), W = (e) => {
|
|
15
|
+
let t = e.target.value;
|
|
16
|
+
j(t), !B && !O && N(U(t));
|
|
17
|
+
}, G = (e) => {
|
|
18
|
+
N(U(e.target.value)), V(!0);
|
|
19
|
+
}, K = (e) => {
|
|
20
|
+
k(e), j(e.name), N(e.slug), F(e.description || ""), L(e.name_translations || {}), z(e.description_translations || {}), V(!0);
|
|
21
|
+
}, q = () => {
|
|
22
|
+
k(null), j(""), N(""), F(""), L({}), z({}), V(!1);
|
|
23
|
+
}, J = async (e) => {
|
|
24
|
+
if (e.preventDefault(), !A.trim()) {
|
|
25
|
+
d.error("Category name is required.");
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
D(!0);
|
|
29
|
+
let t = d.loading(O ? "Updating category..." : "Creating category...");
|
|
30
|
+
try {
|
|
31
|
+
let e = {
|
|
32
|
+
name: A.trim(),
|
|
33
|
+
slug: M.trim() || void 0,
|
|
34
|
+
description: P.trim() || void 0,
|
|
35
|
+
nameTranslations: I,
|
|
36
|
+
descriptionTranslations: R
|
|
37
|
+
}, n;
|
|
38
|
+
n = O ? await x(O.id, e) : await b(e), n.success ? (d.success(O ? "Category updated successfully!" : "Category created successfully!", { id: t }), q(), C.refresh()) : d.error(n.error || "Failed to save category.", { id: t });
|
|
39
|
+
} catch (e) {
|
|
40
|
+
d.error(e.message || "An unexpected error occurred.", { id: t });
|
|
41
|
+
} finally {
|
|
42
|
+
D(!1);
|
|
43
|
+
}
|
|
44
|
+
}, Y = async (e) => {
|
|
45
|
+
let t = `Are you sure you want to delete the category "${e.name}"? This will detach it from any assigned products.`;
|
|
46
|
+
if (!window.confirm(t)) return;
|
|
47
|
+
D(!0);
|
|
48
|
+
let n = d.loading("Deleting category...");
|
|
49
|
+
try {
|
|
50
|
+
let t = await S(e.id);
|
|
51
|
+
t.success ? (d.success("Category deleted successfully!", { id: n }), O?.id === e.id && q(), C.refresh()) : d.error(t.error || "Failed to delete category.", { id: n });
|
|
52
|
+
} catch (e) {
|
|
53
|
+
d.error(e.message || "An unexpected error occurred.", { id: n });
|
|
54
|
+
} finally {
|
|
55
|
+
D(!1);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return /* @__PURE__ */ u("div", {
|
|
59
|
+
className: "grid gap-6 md:grid-cols-12 items-start",
|
|
60
|
+
children: [/* @__PURE__ */ l("div", {
|
|
61
|
+
className: "md:col-span-4 space-y-4",
|
|
62
|
+
children: /* @__PURE__ */ u(m, {
|
|
63
|
+
className: "p-5 shadow-lg border-t-4 border-t-amber-500 bg-card/65 backdrop-blur-md transition-all duration-300",
|
|
64
|
+
children: [/* @__PURE__ */ u("div", {
|
|
65
|
+
className: "flex items-center gap-2 mb-4",
|
|
66
|
+
children: [/* @__PURE__ */ l(i, { className: "h-5 w-5 text-amber-500" }), /* @__PURE__ */ l("h2", {
|
|
67
|
+
className: "text-base font-bold tracking-tight",
|
|
68
|
+
children: O ? "Edit Category" : "Add New Category"
|
|
69
|
+
})]
|
|
70
|
+
}), /* @__PURE__ */ u("form", {
|
|
71
|
+
onSubmit: J,
|
|
72
|
+
className: "space-y-4",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ u("div", {
|
|
75
|
+
className: "space-y-1",
|
|
76
|
+
children: [/* @__PURE__ */ l(g, {
|
|
77
|
+
htmlFor: "name",
|
|
78
|
+
className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none",
|
|
79
|
+
children: "Name"
|
|
80
|
+
}), /* @__PURE__ */ l(h, {
|
|
81
|
+
id: "name",
|
|
82
|
+
placeholder: "e.g. T-Shirts",
|
|
83
|
+
value: A,
|
|
84
|
+
onChange: W,
|
|
85
|
+
disabled: E,
|
|
86
|
+
className: "h-8 text-sm",
|
|
87
|
+
required: !0
|
|
88
|
+
})]
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ u("div", {
|
|
91
|
+
className: "space-y-1",
|
|
92
|
+
children: [/* @__PURE__ */ u(g, {
|
|
93
|
+
htmlFor: "slug",
|
|
94
|
+
className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none flex items-center justify-between w-full",
|
|
95
|
+
children: [/* @__PURE__ */ l("span", { children: "Slug" }), !B && !O && /* @__PURE__ */ l("span", {
|
|
96
|
+
className: "text-[10px] text-amber-600 dark:text-amber-400 capitalize",
|
|
97
|
+
children: "Auto-generating"
|
|
98
|
+
})]
|
|
99
|
+
}), /* @__PURE__ */ l(h, {
|
|
100
|
+
id: "slug",
|
|
101
|
+
placeholder: "e.g. t-shirts",
|
|
102
|
+
value: M,
|
|
103
|
+
onChange: G,
|
|
104
|
+
disabled: E,
|
|
105
|
+
className: "h-8 text-sm font-mono"
|
|
106
|
+
})]
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ u("div", {
|
|
109
|
+
className: "space-y-1",
|
|
110
|
+
children: [/* @__PURE__ */ l(g, {
|
|
111
|
+
htmlFor: "description",
|
|
112
|
+
className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none",
|
|
113
|
+
children: "Description"
|
|
114
|
+
}), /* @__PURE__ */ l(_, {
|
|
115
|
+
id: "description",
|
|
116
|
+
placeholder: "Optional description of the category...",
|
|
117
|
+
value: P,
|
|
118
|
+
onChange: (e) => F(e.target.value),
|
|
119
|
+
disabled: E,
|
|
120
|
+
className: "text-sm min-h-[90px] resize-none"
|
|
121
|
+
})]
|
|
122
|
+
}),
|
|
123
|
+
H.length > 0 && /* @__PURE__ */ u("div", {
|
|
124
|
+
className: "border-t border-border/50 pt-4 mt-4 space-y-4",
|
|
125
|
+
children: [/* @__PURE__ */ l("h3", {
|
|
126
|
+
className: "text-xs uppercase font-bold text-muted-foreground tracking-wider",
|
|
127
|
+
children: "Translations"
|
|
128
|
+
}), H.map((e) => /* @__PURE__ */ u("div", {
|
|
129
|
+
className: "space-y-3 p-3 rounded-md bg-muted/30 border border-border/30",
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ l("span", {
|
|
132
|
+
className: "text-[11px] font-bold text-amber-600 dark:text-amber-400 uppercase tracking-wider",
|
|
133
|
+
children: e.name
|
|
134
|
+
}),
|
|
135
|
+
/* @__PURE__ */ u("div", {
|
|
136
|
+
className: "space-y-1",
|
|
137
|
+
children: [/* @__PURE__ */ u(g, {
|
|
138
|
+
htmlFor: `name-${e.code}`,
|
|
139
|
+
className: "text-[10px] uppercase font-bold text-muted-foreground tracking-wider leading-none",
|
|
140
|
+
children: [
|
|
141
|
+
"Name (",
|
|
142
|
+
e.code,
|
|
143
|
+
")"
|
|
144
|
+
]
|
|
145
|
+
}), /* @__PURE__ */ l(h, {
|
|
146
|
+
id: `name-${e.code}`,
|
|
147
|
+
placeholder: `Translation for ${A || "Name"}`,
|
|
148
|
+
value: I[e.code] || "",
|
|
149
|
+
onChange: (t) => L((n) => ({
|
|
150
|
+
...n,
|
|
151
|
+
[e.code]: t.target.value
|
|
152
|
+
})),
|
|
153
|
+
disabled: E,
|
|
154
|
+
className: "h-8 text-sm"
|
|
155
|
+
})]
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ u("div", {
|
|
158
|
+
className: "space-y-1",
|
|
159
|
+
children: [/* @__PURE__ */ u(g, {
|
|
160
|
+
htmlFor: `desc-${e.code}`,
|
|
161
|
+
className: "text-[10px] uppercase font-bold text-muted-foreground tracking-wider leading-none",
|
|
162
|
+
children: [
|
|
163
|
+
"Description (",
|
|
164
|
+
e.code,
|
|
165
|
+
")"
|
|
166
|
+
]
|
|
167
|
+
}), /* @__PURE__ */ l(_, {
|
|
168
|
+
id: `desc-${e.code}`,
|
|
169
|
+
placeholder: "Translation for Description",
|
|
170
|
+
value: R[e.code] || "",
|
|
171
|
+
onChange: (t) => z((n) => ({
|
|
172
|
+
...n,
|
|
173
|
+
[e.code]: t.target.value
|
|
174
|
+
})),
|
|
175
|
+
disabled: E,
|
|
176
|
+
className: "text-sm min-h-[60px] resize-none"
|
|
177
|
+
})]
|
|
178
|
+
})
|
|
179
|
+
]
|
|
180
|
+
}, e.code))]
|
|
181
|
+
}),
|
|
182
|
+
/* @__PURE__ */ u("div", {
|
|
183
|
+
className: "flex items-center gap-2 pt-2",
|
|
184
|
+
children: [/* @__PURE__ */ l(p, {
|
|
185
|
+
type: "submit",
|
|
186
|
+
disabled: E,
|
|
187
|
+
size: "sm",
|
|
188
|
+
className: "flex-1 bg-amber-600 hover:bg-amber-500 text-white font-medium shadow-md shadow-amber-600/10 h-8 text-xs cursor-pointer",
|
|
189
|
+
children: E ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(o, { className: "mr-1.5 h-3.5 w-3.5 animate-spin" }), "Saving..."] }) : O ? "Update Category" : "Create Category"
|
|
190
|
+
}), O && /* @__PURE__ */ l(p, {
|
|
191
|
+
type: "button",
|
|
192
|
+
onClick: q,
|
|
193
|
+
disabled: E,
|
|
194
|
+
variant: "outline",
|
|
195
|
+
size: "sm",
|
|
196
|
+
className: "h-8 text-xs border-dashed cursor-pointer",
|
|
197
|
+
children: "Cancel"
|
|
198
|
+
})]
|
|
199
|
+
})
|
|
200
|
+
]
|
|
201
|
+
})]
|
|
202
|
+
})
|
|
203
|
+
}), /* @__PURE__ */ l("div", {
|
|
204
|
+
className: "md:col-span-8",
|
|
205
|
+
children: /* @__PURE__ */ u(m, {
|
|
206
|
+
className: "p-4 shadow-lg bg-card/65 backdrop-blur-md border border-border/40",
|
|
207
|
+
children: [/* @__PURE__ */ u("div", {
|
|
208
|
+
className: "flex items-center gap-2 mb-4 pb-2 border-b border-border/50",
|
|
209
|
+
children: [/* @__PURE__ */ l(r, { className: "h-5 w-5 text-muted-foreground" }), /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("h2", {
|
|
210
|
+
className: "text-base font-bold tracking-tight",
|
|
211
|
+
children: "Active Categories"
|
|
212
|
+
}), /* @__PURE__ */ l("p", {
|
|
213
|
+
className: "text-[11px] text-muted-foreground leading-none mt-0.5",
|
|
214
|
+
children: "Categories are shared globally across languages."
|
|
215
|
+
})] })]
|
|
216
|
+
}), w.length === 0 ? /* @__PURE__ */ u("div", {
|
|
217
|
+
className: "flex flex-col items-center justify-center py-12 px-4 text-center border-2 border-dashed border-border/60 rounded-lg bg-muted/20 animate-in fade-in duration-300",
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ l(a, { className: "h-10 w-10 text-muted-foreground/50 mb-3" }),
|
|
220
|
+
/* @__PURE__ */ l("h3", {
|
|
221
|
+
className: "text-sm font-bold text-muted-foreground",
|
|
222
|
+
children: "No Categories Found"
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ l("p", {
|
|
225
|
+
className: "text-xs text-muted-foreground/80 max-w-sm mt-1",
|
|
226
|
+
children: "Add your first category using the form on the left to start organizing your catalog products."
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
}) : /* @__PURE__ */ l("div", {
|
|
230
|
+
className: "overflow-x-auto border rounded-lg bg-background/50",
|
|
231
|
+
children: /* @__PURE__ */ u("table", {
|
|
232
|
+
className: "w-full text-left border-collapse text-xs",
|
|
233
|
+
children: [/* @__PURE__ */ l("thead", { children: /* @__PURE__ */ u("tr", {
|
|
234
|
+
className: "border-b bg-muted/40 font-bold uppercase tracking-wider text-muted-foreground/85 select-none",
|
|
235
|
+
children: [
|
|
236
|
+
/* @__PURE__ */ l("th", {
|
|
237
|
+
className: "p-3 pl-4",
|
|
238
|
+
children: "Name"
|
|
239
|
+
}),
|
|
240
|
+
/* @__PURE__ */ l("th", {
|
|
241
|
+
className: "p-3",
|
|
242
|
+
children: "Slug"
|
|
243
|
+
}),
|
|
244
|
+
/* @__PURE__ */ l("th", {
|
|
245
|
+
className: "p-3 text-center",
|
|
246
|
+
children: "Products"
|
|
247
|
+
}),
|
|
248
|
+
/* @__PURE__ */ l("th", {
|
|
249
|
+
className: "p-3 pr-4 text-right",
|
|
250
|
+
children: "Actions"
|
|
251
|
+
})
|
|
252
|
+
]
|
|
253
|
+
}) }), /* @__PURE__ */ l("tbody", {
|
|
254
|
+
className: "divide-y divide-border/60",
|
|
255
|
+
children: w.map((e) => /* @__PURE__ */ u("tr", {
|
|
256
|
+
className: "hover:bg-muted/10 transition-colors group",
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ u("td", {
|
|
259
|
+
className: "p-3 pl-4",
|
|
260
|
+
children: [/* @__PURE__ */ l("div", {
|
|
261
|
+
className: "font-semibold text-slate-800 dark:text-slate-100",
|
|
262
|
+
children: e.name
|
|
263
|
+
}), e.description && /* @__PURE__ */ l("div", {
|
|
264
|
+
className: "text-[10px] text-muted-foreground mt-0.5 max-w-xs truncate leading-normal",
|
|
265
|
+
title: e.description,
|
|
266
|
+
children: e.description
|
|
267
|
+
})]
|
|
268
|
+
}),
|
|
269
|
+
/* @__PURE__ */ l("td", {
|
|
270
|
+
className: "p-3",
|
|
271
|
+
children: /* @__PURE__ */ u("code", {
|
|
272
|
+
className: "px-1.5 py-0.5 rounded bg-muted/65 font-mono text-[10px]",
|
|
273
|
+
children: ["/", e.slug]
|
|
274
|
+
})
|
|
275
|
+
}),
|
|
276
|
+
/* @__PURE__ */ l("td", {
|
|
277
|
+
className: "p-3 text-center",
|
|
278
|
+
children: /* @__PURE__ */ l("span", {
|
|
279
|
+
className: "inline-flex items-center justify-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-500/10 text-amber-800 dark:text-amber-300 border border-amber-500/15",
|
|
280
|
+
children: e.productCount
|
|
281
|
+
})
|
|
282
|
+
}),
|
|
283
|
+
/* @__PURE__ */ l("td", {
|
|
284
|
+
className: "p-3 pr-4 text-right",
|
|
285
|
+
children: /* @__PURE__ */ u("div", {
|
|
286
|
+
className: "flex items-center justify-end gap-1.5",
|
|
287
|
+
children: [/* @__PURE__ */ l(p, {
|
|
288
|
+
variant: "outline",
|
|
289
|
+
size: "icon",
|
|
290
|
+
disabled: E,
|
|
291
|
+
onClick: () => K(e),
|
|
292
|
+
className: "h-7 w-7 opacity-85 hover:opacity-100 group-hover:border-amber-500/30 cursor-pointer",
|
|
293
|
+
title: "Edit Category",
|
|
294
|
+
children: /* @__PURE__ */ l(n, { className: "h-3.5 w-3.5 text-muted-foreground group-hover:text-amber-600 dark:group-hover:text-amber-400" })
|
|
295
|
+
}), /* @__PURE__ */ l(p, {
|
|
296
|
+
variant: "outline",
|
|
297
|
+
size: "icon",
|
|
298
|
+
disabled: E,
|
|
299
|
+
onClick: () => Y(e),
|
|
300
|
+
className: "h-7 w-7 opacity-85 hover:opacity-100 group-hover:border-red-500/30 cursor-pointer",
|
|
301
|
+
title: "Delete Category",
|
|
302
|
+
children: /* @__PURE__ */ l(s, { className: "h-3.5 w-3.5 text-muted-foreground group-hover:text-red-500" })
|
|
303
|
+
})]
|
|
304
|
+
})
|
|
305
|
+
})
|
|
306
|
+
]
|
|
307
|
+
}, e.id))
|
|
308
|
+
})]
|
|
309
|
+
})
|
|
310
|
+
})]
|
|
311
|
+
})
|
|
312
|
+
})]
|
|
313
|
+
});
|
|
260
314
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
};
|
|
315
|
+
//#endregion
|
|
316
|
+
export { v as CategoryManager };
|