@nextblock-cms/ecom 0.20.3 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/_virtual/_rolldown/runtime.cjs +1 -0
- package/index.cjs +1 -0
- package/index.es.js +38 -146
- package/lib/CurrencyProvider.cjs +1 -0
- package/lib/CurrencyProvider.d.ts +1 -1
- package/lib/CurrencyProvider.es.js +85 -95
- package/lib/PaymentReadinessProvider.cjs +1 -0
- package/lib/PaymentReadinessProvider.d.ts +1 -1
- package/lib/PaymentReadinessProvider.es.js +24 -27
- package/lib/cart-store.cjs +1 -0
- package/lib/cart-store.es.js +109 -121
- package/lib/components/AccountNavigationMenu.cjs +1 -0
- package/lib/components/AccountNavigationMenu.d.ts +1 -1
- package/lib/components/AccountNavigationMenu.es.js +36 -50
- package/lib/components/AddToCartButton.cjs +1 -0
- package/lib/components/AddToCartButton.d.ts +1 -1
- package/lib/components/AddToCartButton.es.js +94 -89
- package/lib/components/Cart.cjs +1 -0
- package/lib/components/Cart.d.ts +1 -1
- package/lib/components/Cart.es.js +261 -180
- package/lib/components/CartDrawer.cjs +1 -0
- package/lib/components/CartDrawer.d.ts +1 -1
- package/lib/components/CartDrawer.es.js +218 -148
- package/lib/components/CartIcon.cjs +1 -0
- package/lib/components/CartIcon.d.ts +1 -1
- package/lib/components/CartIcon.es.js +33 -35
- package/lib/components/Checkout.cjs +1 -0
- package/lib/components/Checkout.d.ts +1 -1
- package/lib/components/Checkout.es.js +1092 -1108
- package/lib/components/CouponForm.cjs +1 -0
- package/lib/components/CouponForm.d.ts +1 -1
- package/lib/components/CouponForm.es.js +136 -148
- package/lib/components/CurrencySwitcher.cjs +1 -0
- package/lib/components/CurrencySwitcher.d.ts +1 -1
- package/lib/components/CurrencySwitcher.es.js +22 -18
- package/lib/components/CustomerProfileForm.cjs +1 -0
- package/lib/components/CustomerProfileForm.es.js +454 -313
- package/lib/components/FeaturedProduct.cjs +1 -0
- package/lib/components/FeaturedProduct.d.ts +1 -1
- package/lib/components/FeaturedProduct.es.js +98 -83
- package/lib/components/FreemiusLicensePanel.cjs +1 -0
- package/lib/components/FreemiusLicensePanel.d.ts +1 -1
- package/lib/components/FreemiusLicensePanel.es.js +70 -65
- package/lib/components/InvoiceDocument.cjs +1 -0
- package/lib/components/InvoiceDocument.es.js +256 -192
- package/lib/components/InvoiceViewerShell.cjs +29 -0
- package/lib/components/InvoiceViewerShell.d.ts +1 -1
- package/lib/components/InvoiceViewerShell.es.js +75 -106
- package/lib/components/ProductCard.cjs +1 -0
- package/lib/components/ProductCard.d.ts +1 -1
- package/lib/components/ProductCard.es.js +186 -171
- package/lib/components/ProductDetailsLayout.cjs +1 -0
- package/lib/components/ProductDetailsLayout.es.js +405 -404
- package/lib/components/ProductGallery.cjs +1 -0
- package/lib/components/ProductGallery.d.ts +1 -1
- package/lib/components/ProductGallery.es.js +51 -54
- package/lib/components/ProductGrid.cjs +1 -0
- package/lib/components/ProductGrid.d.ts +1 -1
- package/lib/components/ProductGrid.es.js +23 -25
- package/lib/components/ShippingEstimator.cjs +1 -0
- package/lib/components/ShippingEstimator.d.ts +1 -1
- package/lib/components/ShippingEstimator.es.js +158 -153
- package/lib/components/ShortDescription.cjs +1 -0
- package/lib/components/ShortDescription.es.js +17 -17
- package/lib/components/SimpleTiptapRenderer.cjs +1 -0
- package/lib/components/SimpleTiptapRenderer.es.js +238 -211
- package/lib/components/SubscriptionSelector.cjs +1 -0
- package/lib/components/SubscriptionSelector.es.js +159 -154
- package/lib/countries.cjs +1 -0
- package/lib/countries.es.js +232 -75
- package/lib/coupon-server.cjs +1 -0
- package/lib/coupon-server.es.js +180 -224
- package/lib/coupons.cjs +1 -0
- package/lib/coupons.es.js +12 -14
- package/lib/currency-constants.cjs +1 -0
- package/lib/currency-constants.es.js +4 -4
- package/lib/currency-rest-client.cjs +1 -0
- package/lib/currency-rest-client.es.js +15 -22
- package/lib/currency-store.cjs +1 -0
- package/lib/currency-store.es.js +20 -27
- package/lib/currency-sync.cjs +1 -0
- package/lib/currency-sync.es.js +124 -170
- package/lib/currency.cjs +1 -0
- package/lib/currency.es.js +242 -310
- package/lib/customer-addresses.cjs +1 -0
- package/lib/customer-addresses.es.js +80 -109
- package/lib/customer-orders.cjs +1 -0
- package/lib/customer-orders.es.js +31 -43
- package/lib/customer.cjs +1 -0
- package/lib/customer.es.js +43 -52
- package/lib/export-helpers.cjs +1 -0
- package/lib/export-helpers.es.js +53 -52
- package/lib/factory.cjs +1 -0
- package/lib/factory.es.js +10 -7
- package/lib/freemius-coupons.cjs +1 -0
- package/lib/freemius-coupons.es.js +245 -262
- package/lib/freemius-license-claim.cjs +1 -0
- package/lib/freemius-license-claim.es.js +87 -71
- package/lib/freemius-license.cjs +1 -0
- package/lib/freemius-license.es.js +32 -39
- package/lib/freemius-order-sync.cjs +1 -0
- package/lib/freemius-order-sync.es.js +226 -290
- package/lib/freemius-trial-provision.cjs +1 -0
- package/lib/freemius-trial-provision.es.js +136 -130
- package/lib/inventory-settings.cjs +1 -0
- package/lib/inventory-settings.es.js +69 -77
- package/lib/invoice-server.cjs +33 -0
- package/lib/invoice-server.es.js +94 -141
- package/lib/invoice-ui.cjs +1 -0
- package/lib/invoice-ui.es.js +50 -66
- package/lib/invoice.cjs +1 -0
- package/lib/invoice.es.js +85 -94
- package/lib/order-inventory.cjs +61 -0
- package/lib/order-inventory.es.js +67 -79
- package/lib/order-tax-details.cjs +1 -0
- package/lib/order-tax-details.es.js +142 -153
- package/lib/pages/cms/coupons/CouponEditorForm.cjs +1 -0
- 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 +5 -0
- 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 +1 -0
- 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 +1 -0
- 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 +1 -0
- 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 +1 -0
- package/lib/pages/cms/coupons/actions.es.js +112 -115
- package/lib/pages/cms/coupons/index.cjs +1 -0
- package/lib/pages/cms/coupons/index.es.js +3 -0
- package/lib/pages/cms/coupons/product-options.cjs +1 -0
- package/lib/pages/cms/coupons/product-options.es.js +21 -23
- package/lib/pages/cms/orders/ExportReportsDialog.cjs +1 -0
- 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 +1 -0
- 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 +1 -0
- 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 +1 -0
- 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 +1 -0
- 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 +7 -0
- package/lib/pages/cms/orders/actions.es.js +53 -69
- package/lib/pages/cms/orders/export-actions.cjs +1 -0
- package/lib/pages/cms/orders/export-actions.es.js +23 -26
- package/lib/pages/cms/orders/index.cjs +1 -0
- package/lib/pages/cms/orders/index.es.js +6 -0
- package/lib/pages/cms/orders/server-actions.cjs +1 -0
- package/lib/pages/cms/orders/server-actions.es.js +60 -51
- package/lib/pages/cms/payments/PaymentsClient.cjs +1 -0
- 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 +1 -0
- 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 +1 -0
- package/lib/pages/cms/payments/actions.es.js +38 -48
- package/lib/pages/cms/payments/index.cjs +1 -0
- package/lib/pages/cms/payments/index.es.js +3 -0
- package/lib/pages/cms/payments/queries.cjs +1 -0
- package/lib/pages/cms/payments/queries.es.js +38 -48
- package/lib/pages/cms/products/ProductsPage.cjs +1 -0
- 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.cjs +1 -0
- package/lib/pages/cms/products/[id]/edit/EditProductPage.d.ts +1 -1
- package/lib/pages/cms/products/[id]/edit/EditProductPage.es.js +139 -0
- package/lib/pages/cms/products/actions.cjs +44 -0
- package/lib/pages/cms/products/actions.es.js +121 -162
- package/lib/pages/cms/products/attributes/AttributeManagementPage.cjs +1 -0
- 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 +1 -0
- 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 +1 -0
- 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 +1 -0
- package/lib/pages/cms/products/categories/components/CategoryManager.es.js +315 -262
- package/lib/pages/cms/products/components/CopyProductFromLanguage.cjs +1 -0
- package/lib/pages/cms/products/components/CopyProductFromLanguage.es.js +115 -113
- package/lib/pages/cms/products/components/CurrencyPriceFields.cjs +1 -0
- 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 +1 -0
- 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 +1 -0
- 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 +1 -0
- package/lib/pages/cms/products/components/ProductCategorySelector.es.js +156 -159
- package/lib/pages/cms/products/components/ProductForm.cjs +1 -0
- package/lib/pages/cms/products/components/ProductForm.es.js +872 -693
- package/lib/pages/cms/products/components/ProductMediaManager.cjs +1 -0
- package/lib/pages/cms/products/components/ProductMediaManager.es.js +106 -103
- package/lib/pages/cms/products/components/ProductsBulkTable.cjs +1 -0
- 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 +1 -0
- 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 +1 -0
- 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 +5 -0
- 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 +1 -0
- 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 +1 -0
- package/lib/pages/cms/products/index.es.js +8 -0
- package/lib/pages/cms/products/inventory/InventoryPage.cjs +1 -0
- 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 +2 -0
- 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 +3 -0
- package/lib/pages/cms/products/inventory/actions.es.js +83 -91
- package/lib/pages/cms/products/new/NewProductPage.cjs +1 -0
- 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 +1 -0
- package/lib/pages/cms/products/product-price-sync.es.js +74 -89
- package/lib/pages/cms/products/server-actions.cjs +1 -0
- package/lib/pages/cms/products/server-actions.es.js +250 -233
- package/lib/pages/cms/shipping/ShippingPage.cjs +5 -0
- package/lib/pages/cms/shipping/ShippingPage.es.js +287 -209
- package/lib/pages/cms/shipping/components/RateForm.cjs +1 -0
- 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 +1 -0
- package/lib/pages/cms/shipping/components/ZoneForm.es.js +245 -224
- package/lib/pages/cms/shipping/index.cjs +1 -0
- package/lib/pages/cms/shipping/index.es.js +3 -0
- package/lib/pages/cms/shipping/server-actions.cjs +1 -0
- package/lib/pages/cms/shipping/server-actions.es.js +131 -149
- package/lib/pages/cms/taxes/TaxesPage.cjs +1 -0
- 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 +1 -0
- package/lib/pages/cms/taxes/actions.es.js +41 -53
- package/lib/pages/cms/taxes/components/TaxRateForm.cjs +1 -0
- 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 +1 -0
- package/lib/pages/cms/taxes/index.es.js +3 -0
- package/lib/payment-config.cjs +1 -0
- package/lib/payment-config.es.js +110 -126
- package/lib/product-actions.cjs +238 -0
- package/lib/product-actions.es.js +289 -544
- package/lib/product-context.cjs +1 -0
- package/lib/product-context.es.js +13 -15
- package/lib/product-schema.cjs +1 -0
- package/lib/product-schema.es.js +99 -134
- package/lib/providers/freemius.cjs +1 -0
- package/lib/providers/freemius.es.js +446 -530
- package/lib/providers/stripe.cjs +1 -0
- package/lib/providers/stripe.es.js +417 -477
- package/lib/server-actions/coupon-actions.cjs +1 -0
- package/lib/server-actions/coupon-actions.es.js +22 -22
- package/lib/server-actions/customer-actions.cjs +1 -0
- package/lib/server-actions/customer-actions.es.js +26 -28
- package/lib/server-actions/product-actions.cjs +1 -0
- package/lib/server-actions/product-actions.es.js +9 -15
- package/lib/server-actions/shipping-actions.cjs +1 -0
- package/lib/server-actions/shipping-actions.es.js +27 -24
- package/lib/server-actions/tax-actions.cjs +1 -0
- package/lib/server-actions/tax-actions.es.js +33 -39
- package/lib/shared-inventory.cjs +15 -0
- package/lib/shared-inventory.es.js +111 -160
- package/lib/shipping/resolver.cjs +7 -0
- package/lib/shipping/resolver.es.js +44 -61
- package/lib/shipping-rate-currency.cjs +1 -0
- package/lib/shipping-rate-currency.es.js +52 -67
- package/lib/states.cjs +1 -0
- package/lib/states.es.js +333 -154
- package/lib/stripe/checkout.cjs +1 -0
- package/lib/stripe/checkout.es.js +125 -181
- package/lib/stripe/client.cjs +1 -0
- package/lib/stripe/client.es.js +14 -19
- package/lib/stripe/order-sync.cjs +1 -0
- package/lib/stripe/order-sync.es.js +106 -126
- package/lib/stripe/webhooks.cjs +1 -0
- package/lib/stripe/webhooks.es.js +37 -31
- package/lib/tax-calculation.cjs +1 -0
- package/lib/tax-calculation.es.js +84 -98
- package/lib/trials.cjs +1 -0
- package/lib/trials.es.js +24 -30
- package/lib/types.cjs +1 -0
- package/lib/types.es.js +21 -27
- package/lib/use-cart.cjs +1 -0
- package/lib/use-cart.es.js +38 -40
- package/lib/use-price-formatter.cjs +1 -0
- package/lib/use-price-formatter.es.js +10 -11
- package/lib/variation-utils.cjs +1 -0
- package/lib/variation-utils.es.js +199 -261
- package/lib/zod-config.cjs +1 -0
- package/lib/zod-config.es.js +5 -6
- package/package.json +22 -21
- package/server.cjs +1 -0
- package/server.es.js +56 -211
- package/index.cjs.js +0 -1
- package/lib/CurrencyProvider.cjs.js +0 -1
- package/lib/PaymentReadinessProvider.cjs.js +0 -1
- package/lib/cart-store.cjs.js +0 -1
- package/lib/components/AccountNavigationMenu.cjs.js +0 -1
- package/lib/components/AddToCartButton.cjs.js +0 -1
- package/lib/components/Cart.cjs.js +0 -1
- package/lib/components/CartDrawer.cjs.js +0 -1
- package/lib/components/CartIcon.cjs.js +0 -1
- package/lib/components/Checkout.cjs.js +0 -1
- package/lib/components/CouponForm.cjs.js +0 -1
- package/lib/components/CurrencySwitcher.cjs.js +0 -1
- package/lib/components/CustomerProfileForm.cjs.js +0 -1
- package/lib/components/FeaturedProduct.cjs.js +0 -1
- package/lib/components/FreemiusLicensePanel.cjs.js +0 -1
- package/lib/components/InvoiceDocument.cjs.js +0 -1
- package/lib/components/InvoiceViewerShell.cjs.js +0 -29
- package/lib/components/ProductCard.cjs.js +0 -1
- package/lib/components/ProductDetailsLayout.cjs.js +0 -1
- package/lib/components/ProductGallery.cjs.js +0 -1
- package/lib/components/ProductGrid.cjs.js +0 -1
- package/lib/components/ShippingEstimator.cjs.js +0 -1
- package/lib/components/ShortDescription.cjs.js +0 -1
- package/lib/components/SimpleTiptapRenderer.cjs.js +0 -1
- package/lib/components/SubscriptionSelector.cjs.js +0 -1
- package/lib/countries.cjs.js +0 -1
- package/lib/coupon-server.cjs.js +0 -1
- package/lib/coupons.cjs.js +0 -1
- package/lib/currency-constants.cjs.js +0 -1
- package/lib/currency-rest-client.cjs.js +0 -1
- package/lib/currency-store.cjs.js +0 -1
- package/lib/currency-sync.cjs.js +0 -1
- package/lib/currency.cjs.js +0 -1
- package/lib/customer-addresses.cjs.js +0 -1
- package/lib/customer-orders.cjs.js +0 -1
- package/lib/customer.cjs.js +0 -1
- package/lib/export-helpers.cjs.js +0 -1
- package/lib/factory.cjs.js +0 -1
- package/lib/freemius-coupons.cjs.js +0 -1
- package/lib/freemius-license-claim.cjs.js +0 -1
- package/lib/freemius-license.cjs.js +0 -1
- package/lib/freemius-order-sync.cjs.js +0 -1
- package/lib/freemius-trial-provision.cjs.js +0 -1
- package/lib/inventory-settings.cjs.js +0 -1
- package/lib/invoice-server.cjs.js +0 -33
- package/lib/invoice-ui.cjs.js +0 -1
- package/lib/invoice.cjs.js +0 -1
- package/lib/order-inventory.cjs.js +0 -61
- package/lib/order-tax-details.cjs.js +0 -1
- package/lib/pages/cms/coupons/CouponEditorForm.cjs.js +0 -1
- package/lib/pages/cms/coupons/CouponsPage.cjs.js +0 -5
- package/lib/pages/cms/coupons/CreateCouponDialog.cjs.js +0 -1
- package/lib/pages/cms/coupons/EditCouponPage.cjs.js +0 -1
- package/lib/pages/cms/coupons/ProductScopePicker.cjs.js +0 -1
- package/lib/pages/cms/coupons/actions.cjs.js +0 -1
- package/lib/pages/cms/coupons/product-options.cjs.js +0 -1
- package/lib/pages/cms/orders/ExportReportsDialog.cjs.js +0 -1
- package/lib/pages/cms/orders/OrderDetailPage.cjs.js +0 -1
- package/lib/pages/cms/orders/OrderPrintButton.cjs.js +0 -1
- package/lib/pages/cms/orders/OrderStatusForm.cjs.js +0 -1
- package/lib/pages/cms/orders/OrdersPage.cjs.js +0 -1
- package/lib/pages/cms/orders/actions.cjs.js +0 -7
- package/lib/pages/cms/orders/export-actions.cjs.js +0 -1
- package/lib/pages/cms/orders/server-actions.cjs.js +0 -1
- package/lib/pages/cms/payments/PaymentsClient.cjs.js +0 -1
- package/lib/pages/cms/payments/PaymentsPage.cjs.js +0 -1
- package/lib/pages/cms/payments/actions.cjs.js +0 -1
- package/lib/pages/cms/payments/queries.cjs.js +0 -1
- package/lib/pages/cms/products/ProductsPage.cjs.js +0 -1
- package/lib/pages/cms/products/_id_/edit/EditProductPage.cjs.js +0 -1
- package/lib/pages/cms/products/_id_/edit/EditProductPage.es.js +0 -156
- package/lib/pages/cms/products/actions.cjs.js +0 -44
- package/lib/pages/cms/products/attributes/AttributeManagementPage.cjs.js +0 -1
- package/lib/pages/cms/products/attributes/components/AttributeManager.cjs.js +0 -1
- package/lib/pages/cms/products/categories/CategoryManagementPage.cjs.js +0 -1
- package/lib/pages/cms/products/categories/components/CategoryManager.cjs.js +0 -1
- package/lib/pages/cms/products/components/CopyProductFromLanguage.cjs.js +0 -1
- package/lib/pages/cms/products/components/CurrencyPriceFields.cjs.js +0 -1
- package/lib/pages/cms/products/components/DeleteProductButton.cjs.js +0 -1
- package/lib/pages/cms/products/components/FreemiusPricingDashboard.cjs.js +0 -1
- package/lib/pages/cms/products/components/ProductCategorySelector.cjs.js +0 -1
- package/lib/pages/cms/products/components/ProductForm.cjs.js +0 -1
- package/lib/pages/cms/products/components/ProductMediaManager.cjs.js +0 -1
- package/lib/pages/cms/products/components/ProductsBulkTable.cjs.js +0 -1
- package/lib/pages/cms/products/components/SaleScheduleFields.cjs.js +0 -1
- package/lib/pages/cms/products/components/SyncFreemiusButton.cjs.js +0 -1
- package/lib/pages/cms/products/components/SyncFreemiusPricingButton.cjs.js +0 -5
- package/lib/pages/cms/products/components/VariationsEditor.cjs.js +0 -1
- package/lib/pages/cms/products/inventory/InventoryPage.cjs.js +0 -1
- package/lib/pages/cms/products/inventory/InventoryTableClient.cjs.js +0 -2
- package/lib/pages/cms/products/inventory/actions.cjs.js +0 -3
- package/lib/pages/cms/products/new/NewProductPage.cjs.js +0 -1
- package/lib/pages/cms/products/product-price-sync.cjs.js +0 -1
- package/lib/pages/cms/products/server-actions.cjs.js +0 -1
- package/lib/pages/cms/shipping/ShippingPage.cjs.js +0 -5
- package/lib/pages/cms/shipping/components/RateForm.cjs.js +0 -1
- package/lib/pages/cms/shipping/components/ZoneForm.cjs.js +0 -1
- package/lib/pages/cms/shipping/server-actions.cjs.js +0 -1
- package/lib/pages/cms/taxes/TaxesPage.cjs.js +0 -1
- package/lib/pages/cms/taxes/actions.cjs.js +0 -1
- package/lib/pages/cms/taxes/components/TaxRateForm.cjs.js +0 -1
- package/lib/payment-config.cjs.js +0 -1
- package/lib/product-actions.cjs.js +0 -238
- package/lib/product-context.cjs.js +0 -1
- package/lib/product-schema.cjs.js +0 -1
- package/lib/providers/freemius.cjs.js +0 -5
- package/lib/providers/stripe.cjs.js +0 -1
- package/lib/server-actions/coupon-actions.cjs.js +0 -1
- package/lib/server-actions/customer-actions.cjs.js +0 -1
- package/lib/server-actions/product-actions.cjs.js +0 -1
- package/lib/server-actions/shipping-actions.cjs.js +0 -1
- package/lib/server-actions/tax-actions.cjs.js +0 -1
- package/lib/shared-inventory.cjs.js +0 -15
- package/lib/shipping/resolver.cjs.js +0 -7
- package/lib/shipping-rate-currency.cjs.js +0 -1
- package/lib/states.cjs.js +0 -1
- package/lib/stripe/checkout.cjs.js +0 -1
- package/lib/stripe/client.cjs.js +0 -1
- package/lib/stripe/order-sync.cjs.js +0 -1
- package/lib/stripe/webhooks.cjs.js +0 -1
- package/lib/tax-calculation.cjs.js +0 -1
- package/lib/trials.cjs.js +0 -1
- package/lib/types.cjs.js +0 -1
- package/lib/use-cart.cjs.js +0 -1
- package/lib/use-price-formatter.cjs.js +0 -1
- package/lib/variation-utils.cjs.js +0 -1
- package/lib/zod-config.cjs.js +0 -1
- package/server.cjs.js +0 -1
|
@@ -1,233 +1,250 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { createProduct as
|
|
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
|
-
|
|
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
|
-
async function
|
|
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
|
-
|
|
1
|
+
"use server";
|
|
2
|
+
import { normalizeCurrencyRecord as e } from "../../../currency.es.js";
|
|
3
|
+
import { createProduct as t, deleteProduct as n, syncCategoriesForTranslationGroup as r } from "../../../product-actions.es.js";
|
|
4
|
+
import { sanitizeProductFormValuesForStoreManagedCurrencies as i } from "./product-price-sync.es.js";
|
|
5
|
+
import { syncProductSaleCouponToFreemius as a } from "../../../freemius-coupons.es.js";
|
|
6
|
+
import { createClient as o, getServiceRoleSupabaseClient as s } from "@nextblock-cms/db/server";
|
|
7
|
+
import { redirect as c } from "next/navigation";
|
|
8
|
+
import { revalidatePath as l } from "next/cache";
|
|
9
|
+
//#region src/lib/pages/cms/products/server-actions.ts
|
|
10
|
+
function u(e) {
|
|
11
|
+
return e.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
12
|
+
}
|
|
13
|
+
async function d(n) {
|
|
14
|
+
let r = o(), { data: u } = await r.from("currencies").select("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").eq("is_active", !0).order("code", { ascending: !0 }), d = i(n, (u || []).map((t) => e(t))), f = await t(r, d);
|
|
15
|
+
if (d.payment_provider === "freemius" && f?.id) try {
|
|
16
|
+
await a({
|
|
17
|
+
productId: f.id,
|
|
18
|
+
client: s()
|
|
19
|
+
});
|
|
20
|
+
} catch (e) {
|
|
21
|
+
console.error("Failed to sync Freemius sale coupon on create:", e);
|
|
22
|
+
}
|
|
23
|
+
l("/cms/products"), c("/cms/products");
|
|
24
|
+
}
|
|
25
|
+
async function f(e, t, n, r) {
|
|
26
|
+
let i = {
|
|
27
|
+
author_id: n,
|
|
28
|
+
meta: r,
|
|
29
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
30
|
+
}, a = async () => {
|
|
31
|
+
let { error: n } = await e.from("product_drafts").update(i).eq("product_id", t);
|
|
32
|
+
if (n) throw Error(`Failed to save product draft: ${n.message}`);
|
|
33
|
+
}, { data: o, error: s } = await e.from("product_drafts").select("id").eq("product_id", t).maybeSingle();
|
|
34
|
+
if (s) throw Error(`Failed to read product draft: ${s.message}`);
|
|
35
|
+
if (o) {
|
|
36
|
+
await a();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
let { data: c, error: l } = await e.from("blocks").select("id, page_id, post_id, product_id, language_id, block_type, content, order, created_at, updated_at").eq("product_id", t).order("order", { ascending: !0 });
|
|
40
|
+
if (l) throw Error(`Failed to read product blocks: ${l.message}`);
|
|
41
|
+
let { error: u } = await e.from("product_drafts").insert({
|
|
42
|
+
...i,
|
|
43
|
+
blocks: c ?? [],
|
|
44
|
+
product_id: t
|
|
45
|
+
});
|
|
46
|
+
if (u) {
|
|
47
|
+
if (u.code === "23505") {
|
|
48
|
+
await a();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
throw Error(`Failed to save product draft: ${u.message}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async function p(t, n) {
|
|
55
|
+
let r = o(), { data: { user: a } } = await r.auth.getUser();
|
|
56
|
+
if (!a) throw Error("User not authenticated.");
|
|
57
|
+
let { data: s } = await r.from("currencies").select("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").eq("is_active", !0).order("code", { ascending: !0 }), c = i(n, (s || []).map((t) => e(t)));
|
|
58
|
+
return await f(r, t, a.id, c), { success: !0 };
|
|
59
|
+
}
|
|
60
|
+
async function m(e) {
|
|
61
|
+
let t = o();
|
|
62
|
+
await n(t, e), l("/cms/products");
|
|
63
|
+
}
|
|
64
|
+
function h(e) {
|
|
65
|
+
return Array.from(new Set(e.map((e) => e.trim()).filter(Boolean)));
|
|
66
|
+
}
|
|
67
|
+
async function g(e) {
|
|
68
|
+
let t = h(e);
|
|
69
|
+
if (t.length === 0) return {
|
|
70
|
+
success: !1,
|
|
71
|
+
error: "Select at least one product."
|
|
72
|
+
};
|
|
73
|
+
let { error: n } = await o().from("products").delete().in("id", t);
|
|
74
|
+
return n ? {
|
|
75
|
+
success: !1,
|
|
76
|
+
error: n.message
|
|
77
|
+
} : (l("/cms/products"), {
|
|
78
|
+
success: !0,
|
|
79
|
+
count: t.length
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
async function _(e) {
|
|
83
|
+
let t = h(e);
|
|
84
|
+
if (t.length === 0) return {
|
|
85
|
+
success: !1,
|
|
86
|
+
error: "Select at least one product."
|
|
87
|
+
};
|
|
88
|
+
let { error: n } = await o().from("products").update({
|
|
89
|
+
status: "draft",
|
|
90
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
91
|
+
}).in("id", t);
|
|
92
|
+
return n ? {
|
|
93
|
+
success: !1,
|
|
94
|
+
error: n.message
|
|
95
|
+
} : (l("/cms/products"), {
|
|
96
|
+
success: !0,
|
|
97
|
+
count: t.length
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
async function v(e) {
|
|
101
|
+
let t = String(e || "").trim();
|
|
102
|
+
if (!t) return { error: "Missing product id." };
|
|
103
|
+
let n = o(), { data: { user: r } } = await n.auth.getUser();
|
|
104
|
+
if (!r) return { error: "You must be signed in to publish a product." };
|
|
105
|
+
let { data: i, error: a } = await n.from("products").update({
|
|
106
|
+
status: "active",
|
|
107
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
108
|
+
}).eq("id", t).select("slug").single();
|
|
109
|
+
return a || !i ? { error: a?.message || "Could not publish the product." } : (l("/cms/products"), l(`/cms/products/${t}/edit`), i.slug && l(`/product/${i.slug}`), {});
|
|
110
|
+
}
|
|
111
|
+
async function y(e) {
|
|
112
|
+
let t = s(), n = e.name.trim(), r = u(e.slug?.trim() || e.name);
|
|
113
|
+
if (!n || !r) return {
|
|
114
|
+
success: !1,
|
|
115
|
+
error: "Attribute name is required."
|
|
116
|
+
};
|
|
117
|
+
let { error: i } = await t.from("product_attributes").insert({
|
|
118
|
+
name: n,
|
|
119
|
+
slug: r
|
|
120
|
+
});
|
|
121
|
+
return i ? {
|
|
122
|
+
success: !1,
|
|
123
|
+
error: i.message
|
|
124
|
+
} : (l("/cms/products/attributes"), l("/cms/products/new"), l("/cms/products"), { success: !0 });
|
|
125
|
+
}
|
|
126
|
+
async function b(e) {
|
|
127
|
+
let { error: t } = await s().from("product_attributes").delete().eq("id", e);
|
|
128
|
+
return t ? {
|
|
129
|
+
success: !1,
|
|
130
|
+
error: t.message
|
|
131
|
+
} : (l("/cms/products/attributes"), l("/cms/products/new"), l("/cms/products"), { success: !0 });
|
|
132
|
+
}
|
|
133
|
+
async function x(e) {
|
|
134
|
+
let t = s(), n = e.value.trim(), r = u(e.slug?.trim() || e.value);
|
|
135
|
+
if (!n || !r) return {
|
|
136
|
+
success: !1,
|
|
137
|
+
error: "Term value is required."
|
|
138
|
+
};
|
|
139
|
+
let { data: i } = await t.from("product_attribute_terms").select("sort_order").eq("attribute_id", e.attributeId).order("sort_order", { ascending: !1 }).limit(1), a = typeof i?.[0]?.sort_order == "number" ? i[0].sort_order + 1 : 0, { error: o } = await t.from("product_attribute_terms").insert({
|
|
140
|
+
attribute_id: e.attributeId,
|
|
141
|
+
value: n,
|
|
142
|
+
slug: r,
|
|
143
|
+
sort_order: a
|
|
144
|
+
});
|
|
145
|
+
return o ? {
|
|
146
|
+
success: !1,
|
|
147
|
+
error: o.message
|
|
148
|
+
} : (l("/cms/products/attributes"), l("/cms/products/new"), l("/cms/products"), { success: !0 });
|
|
149
|
+
}
|
|
150
|
+
async function S(e) {
|
|
151
|
+
let t = s();
|
|
152
|
+
for (let [n, r] of e.orderedTermIds.entries()) {
|
|
153
|
+
let { error: i } = await t.from("product_attribute_terms").update({
|
|
154
|
+
sort_order: n,
|
|
155
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
156
|
+
}).eq("id", r).eq("attribute_id", e.attributeId);
|
|
157
|
+
if (i) return {
|
|
158
|
+
success: !1,
|
|
159
|
+
error: i.message
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
return l("/cms/products/attributes"), l("/cms/products/new"), l("/cms/products"), { success: !0 };
|
|
163
|
+
}
|
|
164
|
+
async function C(e) {
|
|
165
|
+
let t = s(), { error: n } = await t.from("product_attributes").update({
|
|
166
|
+
name_translations: e.nameTranslations,
|
|
167
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
168
|
+
}).eq("id", e.attributeId);
|
|
169
|
+
if (n) return {
|
|
170
|
+
success: !1,
|
|
171
|
+
error: n.message
|
|
172
|
+
};
|
|
173
|
+
for (let n of e.termTranslations) {
|
|
174
|
+
let { error: r } = await t.from("product_attribute_terms").update({
|
|
175
|
+
value_translations: n.valueTranslations,
|
|
176
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
177
|
+
}).eq("id", n.termId).eq("attribute_id", e.attributeId);
|
|
178
|
+
if (r) return {
|
|
179
|
+
success: !1,
|
|
180
|
+
error: r.message
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
return l("/cms/products/attributes"), l("/cms/products/new"), l("/cms/products"), { success: !0 };
|
|
184
|
+
}
|
|
185
|
+
async function w(e) {
|
|
186
|
+
let { error: t } = await s().from("product_attribute_terms").delete().eq("id", e);
|
|
187
|
+
return t ? {
|
|
188
|
+
success: !1,
|
|
189
|
+
error: t.message
|
|
190
|
+
} : (l("/cms/products/attributes"), l("/cms/products/new"), l("/cms/products"), { success: !0 });
|
|
191
|
+
}
|
|
192
|
+
async function T(e) {
|
|
193
|
+
let t = s(), n = e.name.trim(), r = u(e.slug?.trim() || e.name);
|
|
194
|
+
if (!n || !r) return {
|
|
195
|
+
success: !1,
|
|
196
|
+
error: "Category name is required."
|
|
197
|
+
};
|
|
198
|
+
let { data: i, error: a } = await t.from("categories").insert({
|
|
199
|
+
name: n,
|
|
200
|
+
slug: r,
|
|
201
|
+
description: e.description?.trim() || null,
|
|
202
|
+
name_translations: e.nameTranslations || {},
|
|
203
|
+
description_translations: e.descriptionTranslations || {}
|
|
204
|
+
}).select().single();
|
|
205
|
+
return a ? {
|
|
206
|
+
success: !1,
|
|
207
|
+
error: a.message
|
|
208
|
+
} : (l("/cms/products/categories"), l("/cms/products/new"), l("/cms/products"), {
|
|
209
|
+
success: !0,
|
|
210
|
+
category: i
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
async function E(e, t) {
|
|
214
|
+
let n = s(), r = t.name.trim(), i = u(t.slug?.trim() || t.name);
|
|
215
|
+
if (!r || !i) return {
|
|
216
|
+
success: !1,
|
|
217
|
+
error: "Category name is required."
|
|
218
|
+
};
|
|
219
|
+
let { error: a } = await n.from("categories").update({
|
|
220
|
+
name: r,
|
|
221
|
+
slug: i,
|
|
222
|
+
description: t.description?.trim() || null,
|
|
223
|
+
name_translations: t.nameTranslations || {},
|
|
224
|
+
description_translations: t.descriptionTranslations || {}
|
|
225
|
+
}).eq("id", e);
|
|
226
|
+
return a ? {
|
|
227
|
+
success: !1,
|
|
228
|
+
error: a.message
|
|
229
|
+
} : (l("/cms/products/categories"), l("/cms/products/new"), l("/cms/products"), { success: !0 });
|
|
230
|
+
}
|
|
231
|
+
async function D(e) {
|
|
232
|
+
let { error: t } = await s().from("categories").delete().eq("id", e);
|
|
233
|
+
return t ? {
|
|
234
|
+
success: !1,
|
|
235
|
+
error: t.message
|
|
236
|
+
} : (l("/cms/products/categories"), l("/cms/products/new"), l("/cms/products"), { success: !0 });
|
|
237
|
+
}
|
|
238
|
+
async function O(e, t) {
|
|
239
|
+
let n = s();
|
|
240
|
+
try {
|
|
241
|
+
return await r(n, e, t), l("/cms/products"), l(`/cms/products/${e}/edit`), { success: !0 };
|
|
242
|
+
} catch (e) {
|
|
243
|
+
return {
|
|
244
|
+
success: !1,
|
|
245
|
+
error: e.message
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
250
|
+
export { g as bulkDeleteProductsAction, _ as bulkDraftProductsAction, T as createCategoryAction, d as createProductAction, y as createProductAttributeAction, x as createProductAttributeTermAction, D as deleteCategoryAction, m as deleteProductAction, b as deleteProductAttributeAction, w as deleteProductAttributeTermAction, v as publishProductAction, S as reorderProductAttributeTermsAction, O as syncProductCategoriesAction, E as updateCategoryAction, p as updateProductAction, C as updateProductAttributeTranslationsAction };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const e=require("../../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../currency.cjs"),n=require("../../../states.cjs"),r=require("../../../inventory-settings.cjs"),i=require("./server-actions.cjs"),a=require("./components/ZoneForm.cjs"),o=require("./components/RateForm.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("lucide-react"),l=require("@nextblock-cms/utils"),u=require("react/jsx-runtime"),d=require("@nextblock-cms/db/server"),f=require("@nextblock-cms/ui");async function p({searchParams:e}){let s=(0,d.getServiceRoleSupabaseClient)(),[{data:p},m,{data:h},{data:g}]=await Promise.all([s.from(`shipping_zones`).select(`
|
|
2
|
+
*,
|
|
3
|
+
shipping_zone_locations (*),
|
|
4
|
+
shipping_zone_methods (*)
|
|
5
|
+
`).order(`priority_order`,{ascending:!0}),r.getEcommerceInventorySettings(s),s.from(`languages`).select(`code, name, is_default`).eq(`is_active`,!0).order(`name`,{ascending:!0}),s.from(`currencies`).select(`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`).eq(`is_active`,!0).order(`is_default`,{ascending:!1}).order(`code`,{ascending:!0})]),_=g?.find(e=>e.is_default)?.code||g?.[0]?.code||`USD`,v=(g||[]).map(e=>t.normalizeCurrencyRecord(e));return(0,u.jsx)(f.TooltipProvider,{children:(0,u.jsxs)(`div`,{className:`space-y-6`,children:[e?.success?(0,u.jsx)(`div`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700`,children:e.success}):null,(0,u.jsx)(f.Card,{className:`overflow-hidden border-slate-200 dark:border-slate-800 shadow-sm`,children:(0,u.jsx)(f.CardContent,{className:`p-4 sm:p-5`,children:(0,u.jsxs)(`form`,{action:i.updateInventoryTrackingAction,className:`space-y-3`,children:[(0,u.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,u.jsxs)(`div`,{className:`flex items-start gap-3 min-w-0`,children:[(0,u.jsx)(`div`,{className:`p-2 bg-primary/10 rounded-lg text-primary shadow-inner shrink-0`,children:(0,u.jsx)(c.Boxes,{className:`h-4 w-4`})}),(0,u.jsxs)(`div`,{className:`min-w-0`,children:[(0,u.jsx)(f.CardTitle,{className:`text-base font-semibold leading-none`,children:`Inventory Tracking`}),(0,u.jsx)(f.CardDescription,{className:`mt-1 text-sm`,children:`Control whether checkout enforces stock counts and paid orders deduct inventory.`})]})]}),(0,u.jsx)(`div`,{className:`flex justify-end lg:justify-start shrink-0`,children:(0,u.jsx)(f.Button,{type:`submit`,size:`sm`,className:`w-full sm:w-auto`,children:`Save Inventory Settings`})})]}),(0,u.jsxs)(`div`,{className:`rounded-lg border bg-muted/20 px-4 py-3`,children:[(0,u.jsx)(`input`,{type:`hidden`,name:`trackQuantities`,value:`false`}),(0,u.jsxs)(`label`,{htmlFor:`track-quantities`,className:`flex cursor-pointer items-start gap-3`,children:[(0,u.jsx)(`input`,{id:`track-quantities`,name:`trackQuantities`,type:`checkbox`,value:`true`,defaultChecked:m.trackQuantities,className:`mt-0.5 h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary`}),(0,u.jsxs)(`span`,{className:`space-y-0.5`,children:[(0,u.jsx)(`span`,{className:`block text-sm font-medium text-slate-900 dark:text-slate-100`,children:`Track product quantities`}),(0,u.jsx)(`span`,{className:`block text-sm text-muted-foreground`,children:`Prevent overselling by checking stock during checkout and decrementing quantities after payment is confirmed.`})]})]})]})]})})}),(0,u.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight text-slate-900 dark:text-slate-100`,children:`Shipping Zones`}),(0,u.jsx)(`p`,{className:`text-slate-500 dark:text-slate-400 text-sm`,children:`Manage geographical delivery areas and their associated shipping rates.`})]}),(0,u.jsx)(a.ZoneForm,{})]}),(0,u.jsx)(`div`,{className:`grid gap-6`,children:!p||p.length===0?(0,u.jsx)(f.Card,{className:`bg-slate-50/50 dark:bg-slate-900/10 border-dashed`,children:(0,u.jsxs)(f.CardContent,{className:`flex flex-col items-center justify-center py-12`,children:[(0,u.jsx)(c.Truck,{className:`h-12 w-12 text-slate-300 dark:text-slate-700 mb-4`}),(0,u.jsx)(`p`,{className:`text-slate-600 dark:text-slate-400 font-medium`,children:`No shipping zones defined yet.`}),(0,u.jsx)(`p`,{className:`text-xs text-slate-500 mb-6 text-center max-w-xs`,children:`Create a zone to start defining shipping rates for specific regions (e.g., North America, Europe).`})]})}):p.map(e=>(0,u.jsxs)(f.Card,{className:`overflow-hidden border-slate-200 dark:border-slate-800 shadow-sm hover:shadow-md transition-shadow`,children:[(0,u.jsx)(f.CardHeader,{className:`bg-slate-50/50 dark:bg-slate-900/50 border-b dark:border-slate-800 py-4`,children:(0,u.jsxs)(`div`,{className:`flex justify-between items-start md:items-center`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,u.jsx)(`div`,{className:`p-2 bg-primary/10 rounded-lg text-primary shadow-inner`,children:(0,u.jsx)(c.Globe,{className:`h-5 w-5`})}),(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(f.CardTitle,{className:`text-lg font-bold`,children:e.name}),(0,u.jsxs)(f.Badge,{variant:`outline`,className:`text-[10px] uppercase font-bold py-0 h-4 border-slate-200 bg-white/50 dark:bg-black/20`,children:[`Prio: `,e.priority_order]})]}),(0,u.jsxs)(f.CardDescription,{className:`text-xs`,children:[e.shipping_zone_locations?.length||0,` regions covered`]})]})]}),(0,u.jsxs)(`div`,{className:`flex gap-1`,children:[(0,u.jsx)(a.ZoneForm,{mode:`edit`,initialData:{id:e.id,name:e.name,priority_order:e.priority_order,locations:e.shipping_zone_locations?.map(e=>({country_code:e.country_code,state_code:e.state_code}))||[]}}),(0,u.jsx)(`form`,{action:async()=>{"use server";await i.deleteShippingZone(e.id)},children:(0,u.jsx)(f.Button,{type:`submit`,variant:`ghost`,size:`icon`,className:`h-8 w-8 text-slate-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20`,children:(0,u.jsx)(c.Trash2,{className:`h-4 w-4`})})})]})]})}),(0,u.jsx)(f.CardContent,{className:`p-0`,children:(0,u.jsxs)(`div`,{className:`grid md:grid-cols-2 divide-y md:divide-y-0 md:divide-x divide-slate-100 dark:divide-slate-800`,children:[(0,u.jsxs)(`div`,{className:`p-6`,children:[(0,u.jsxs)(`h4`,{className:`text-[10px] font-bold uppercase tracking-widest text-slate-500 mb-4 flex items-center gap-1.5`,children:[(0,u.jsx)(c.Globe,{className:`h-3 w-3`}),` Target Regions`]}),(0,u.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.shipping_zone_locations?.length>0?e.shipping_zone_locations.map(e=>(0,u.jsxs)(f.Badge,{variant:`secondary`,className:`bg-slate-100 dark:bg-slate-800/80 text-slate-700 dark:text-slate-300 hover:bg-slate-200 border-none px-2 py-0.5 text-[11px] font-medium`,children:[e.country_code,e.state_code?(0,u.jsxs)(`span`,{className:`text-slate-400 ml-1`,children:[`(`,n.resolveSubdivisionName(e.country_code,e.state_code),`)`]}):``]},e.id)):(0,u.jsx)(`p`,{className:`text-sm text-slate-400 italic`,children:`No specific locations assigned.`})})]}),(0,u.jsxs)(`div`,{className:`p-6`,children:[(0,u.jsxs)(`div`,{className:`flex justify-between items-center mb-4`,children:[(0,u.jsxs)(`h4`,{className:`text-[10px] font-bold uppercase tracking-widest text-slate-500 flex items-center gap-1.5`,children:[(0,u.jsx)(c.Truck,{className:`h-3 w-3`}),` Shipping Methods`]}),(0,u.jsx)(o.RateForm,{zoneId:e.id,zoneName:e.name,languages:h||[],currencies:v,defaultCurrencyCode:_})]}),(0,u.jsx)(`div`,{className:`space-y-2`,children:e.shipping_zone_methods?.length>0?e.shipping_zone_methods.map(t=>(0,u.jsxs)(`div`,{className:`flex justify-between items-center group p-2 hover:bg-slate-50/80 dark:hover:bg-slate-800/30 rounded-lg transition-all border border-transparent hover:border-slate-100 dark:hover:border-slate-800`,children:[(0,u.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(`p`,{className:`text-sm font-semibold text-slate-900 dark:text-slate-100 truncate`,children:t.name}),(0,u.jsx)(f.Badge,{variant:`outline`,className:`h-4 px-1 text-[9px]`,children:t.currency_pricing_mode===`manual`?`Manual FX`:`Auto FX`}),(t.min_order_amount||0)>0&&(0,u.jsxs)(f.Tooltip,{children:[(0,u.jsx)(f.TooltipTrigger,{asChild:!0,children:(0,u.jsxs)(f.Badge,{variant:`outline`,className:`h-4 px-1 text-[9px] bg-emerald-50 text-emerald-700 dark:bg-emerald-900/20 dark:text-emerald-400 border-emerald-100 dark:border-emerald-900/50`,children:[(0,u.jsx)(c.Info,{className:`h-2 w-2 mr-0.5`}),(0,l.formatPrice)(t.min_order_amount,t.cost_currency?.toUpperCase()||_)]})}),(0,u.jsxs)(f.TooltipContent,{children:[`Available for orders over `,(0,l.formatPrice)(t.min_order_amount,t.cost_currency?.toUpperCase()||_)]})]})]}),(0,u.jsx)(`p`,{className:`text-[10px] text-slate-500 uppercase tracking-tighter mix-blend-multiply dark:mix-blend-normal`,children:t.method_type.replace(`_`,` `)})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,u.jsx)(`p`,{className:`text-sm font-black text-primary px-2`,children:t.method_type===`free_shipping`?`FREE`:(0,l.formatPrice)(t.cost_amount,t.cost_currency?.toUpperCase()||_)}),(0,u.jsxs)(`div`,{className:`flex opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,u.jsx)(o.RateForm,{zoneId:e.id,zoneName:e.name,languages:h||[],currencies:v,defaultCurrencyCode:_,mode:`edit`,initialData:t}),(0,u.jsx)(`form`,{action:async()=>{"use server";await i.deleteShippingRate(t.id)},children:(0,u.jsx)(f.Button,{type:`submit`,variant:`ghost`,size:`icon`,className:`h-7 w-7 text-slate-400 hover:text-red-500`,children:(0,u.jsx)(c.Trash2,{className:`h-3 w-3`})})})]})]})]},t.id)):(0,u.jsx)(`p`,{className:`text-xs text-slate-400 italic`,children:`No methods defined for this zone.`})})]})]})})]},e.id))})]})})}exports.ShippingPage=p;
|