@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,211 +1,289 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ZoneForm as
|
|
6
|
-
import { RateForm as
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { getEcommerceInventorySettings as D } from "../../../inventory-settings.es.js";
|
|
10
|
-
import { resolveSubdivisionName as E } from "../../../states.es.js";
|
|
1
|
+
import { normalizeCurrencyRecord as e } from "../../../currency.es.js";
|
|
2
|
+
import { resolveSubdivisionName as t } from "../../../states.es.js";
|
|
3
|
+
import { getEcommerceInventorySettings as n } from "../../../inventory-settings.es.js";
|
|
4
|
+
import { deleteShippingRate as r, deleteShippingZone as i, updateInventoryTrackingAction as a } from "./server-actions.es.js";
|
|
5
|
+
import { ZoneForm as o } from "./components/ZoneForm.es.js";
|
|
6
|
+
import { RateForm as s } from "./components/RateForm.es.js";
|
|
7
|
+
import "react";
|
|
8
|
+
import { Boxes as c, Globe as l, Info as u, Trash2 as d, Truck as f } from "lucide-react";
|
|
11
9
|
import { formatPrice as p } from "@nextblock-cms/utils";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
shipping_zone_locations (*),
|
|
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
|
-
|
|
10
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
11
|
+
import { getServiceRoleSupabaseClient as g } from "@nextblock-cms/db/server";
|
|
12
|
+
import { Badge as _, Button as v, Card as y, CardContent as b, CardDescription as x, CardHeader as S, CardTitle as C, Tooltip as w, TooltipContent as T, TooltipProvider as E, TooltipTrigger as D } from "@nextblock-cms/ui";
|
|
13
|
+
//#region src/lib/pages/cms/shipping/ShippingPage.tsx
|
|
14
|
+
async function O({ searchParams: O }) {
|
|
15
|
+
let k = g(), [{ data: A }, j, { data: M }, { data: N }] = await Promise.all([
|
|
16
|
+
k.from("shipping_zones").select("\n *,\n shipping_zone_locations (*),\n shipping_zone_methods (*)\n ").order("priority_order", { ascending: !0 }),
|
|
17
|
+
n(k),
|
|
18
|
+
k.from("languages").select("code, name, is_default").eq("is_active", !0).order("name", { ascending: !0 }),
|
|
19
|
+
k.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 })
|
|
20
|
+
]), P = N?.find((e) => e.is_default)?.code || N?.[0]?.code || "USD", F = (N || []).map((t) => e(t));
|
|
21
|
+
return /* @__PURE__ */ m(E, { children: /* @__PURE__ */ h("div", {
|
|
22
|
+
className: "space-y-6",
|
|
23
|
+
children: [
|
|
24
|
+
O?.success ? /* @__PURE__ */ m("div", {
|
|
25
|
+
className: "rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700",
|
|
26
|
+
children: O.success
|
|
27
|
+
}) : null,
|
|
28
|
+
/* @__PURE__ */ m(y, {
|
|
29
|
+
className: "overflow-hidden border-slate-200 dark:border-slate-800 shadow-sm",
|
|
30
|
+
children: /* @__PURE__ */ m(b, {
|
|
31
|
+
className: "p-4 sm:p-5",
|
|
32
|
+
children: /* @__PURE__ */ h("form", {
|
|
33
|
+
action: a,
|
|
34
|
+
className: "space-y-3",
|
|
35
|
+
children: [/* @__PURE__ */ h("div", {
|
|
36
|
+
className: "flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",
|
|
37
|
+
children: [/* @__PURE__ */ h("div", {
|
|
38
|
+
className: "flex items-start gap-3 min-w-0",
|
|
39
|
+
children: [/* @__PURE__ */ m("div", {
|
|
40
|
+
className: "p-2 bg-primary/10 rounded-lg text-primary shadow-inner shrink-0",
|
|
41
|
+
children: /* @__PURE__ */ m(c, { className: "h-4 w-4" })
|
|
42
|
+
}), /* @__PURE__ */ h("div", {
|
|
43
|
+
className: "min-w-0",
|
|
44
|
+
children: [/* @__PURE__ */ m(C, {
|
|
45
|
+
className: "text-base font-semibold leading-none",
|
|
46
|
+
children: "Inventory Tracking"
|
|
47
|
+
}), /* @__PURE__ */ m(x, {
|
|
48
|
+
className: "mt-1 text-sm",
|
|
49
|
+
children: "Control whether checkout enforces stock counts and paid orders deduct inventory."
|
|
50
|
+
})]
|
|
51
|
+
})]
|
|
52
|
+
}), /* @__PURE__ */ m("div", {
|
|
53
|
+
className: "flex justify-end lg:justify-start shrink-0",
|
|
54
|
+
children: /* @__PURE__ */ m(v, {
|
|
55
|
+
type: "submit",
|
|
56
|
+
size: "sm",
|
|
57
|
+
className: "w-full sm:w-auto",
|
|
58
|
+
children: "Save Inventory Settings"
|
|
59
|
+
})
|
|
60
|
+
})]
|
|
61
|
+
}), /* @__PURE__ */ h("div", {
|
|
62
|
+
className: "rounded-lg border bg-muted/20 px-4 py-3",
|
|
63
|
+
children: [/* @__PURE__ */ m("input", {
|
|
64
|
+
type: "hidden",
|
|
65
|
+
name: "trackQuantities",
|
|
66
|
+
value: "false"
|
|
67
|
+
}), /* @__PURE__ */ h("label", {
|
|
68
|
+
htmlFor: "track-quantities",
|
|
69
|
+
className: "flex cursor-pointer items-start gap-3",
|
|
70
|
+
children: [/* @__PURE__ */ m("input", {
|
|
71
|
+
id: "track-quantities",
|
|
72
|
+
name: "trackQuantities",
|
|
73
|
+
type: "checkbox",
|
|
74
|
+
value: "true",
|
|
75
|
+
defaultChecked: j.trackQuantities,
|
|
76
|
+
className: "mt-0.5 h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary"
|
|
77
|
+
}), /* @__PURE__ */ h("span", {
|
|
78
|
+
className: "space-y-0.5",
|
|
79
|
+
children: [/* @__PURE__ */ m("span", {
|
|
80
|
+
className: "block text-sm font-medium text-slate-900 dark:text-slate-100",
|
|
81
|
+
children: "Track product quantities"
|
|
82
|
+
}), /* @__PURE__ */ m("span", {
|
|
83
|
+
className: "block text-sm text-muted-foreground",
|
|
84
|
+
children: "Prevent overselling by checking stock during checkout and decrementing quantities after payment is confirmed."
|
|
85
|
+
})]
|
|
86
|
+
})]
|
|
87
|
+
})]
|
|
88
|
+
})]
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ h("div", {
|
|
93
|
+
className: "flex justify-between items-center",
|
|
94
|
+
children: [/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h2", {
|
|
95
|
+
className: "text-2xl font-bold tracking-tight text-slate-900 dark:text-slate-100",
|
|
96
|
+
children: "Shipping Zones"
|
|
97
|
+
}), /* @__PURE__ */ m("p", {
|
|
98
|
+
className: "text-slate-500 dark:text-slate-400 text-sm",
|
|
99
|
+
children: "Manage geographical delivery areas and their associated shipping rates."
|
|
100
|
+
})] }), /* @__PURE__ */ m(o, {})]
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ m("div", {
|
|
103
|
+
className: "grid gap-6",
|
|
104
|
+
children: !A || A.length === 0 ? /* @__PURE__ */ m(y, {
|
|
105
|
+
className: "bg-slate-50/50 dark:bg-slate-900/10 border-dashed",
|
|
106
|
+
children: /* @__PURE__ */ h(b, {
|
|
107
|
+
className: "flex flex-col items-center justify-center py-12",
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ m(f, { className: "h-12 w-12 text-slate-300 dark:text-slate-700 mb-4" }),
|
|
110
|
+
/* @__PURE__ */ m("p", {
|
|
111
|
+
className: "text-slate-600 dark:text-slate-400 font-medium",
|
|
112
|
+
children: "No shipping zones defined yet."
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ m("p", {
|
|
115
|
+
className: "text-xs text-slate-500 mb-6 text-center max-w-xs",
|
|
116
|
+
children: "Create a zone to start defining shipping rates for specific regions (e.g., North America, Europe)."
|
|
117
|
+
})
|
|
118
|
+
]
|
|
119
|
+
})
|
|
120
|
+
}) : A.map((e) => /* @__PURE__ */ h(y, {
|
|
121
|
+
className: "overflow-hidden border-slate-200 dark:border-slate-800 shadow-sm hover:shadow-md transition-shadow",
|
|
122
|
+
children: [/* @__PURE__ */ m(S, {
|
|
123
|
+
className: "bg-slate-50/50 dark:bg-slate-900/50 border-b dark:border-slate-800 py-4",
|
|
124
|
+
children: /* @__PURE__ */ h("div", {
|
|
125
|
+
className: "flex justify-between items-start md:items-center",
|
|
126
|
+
children: [/* @__PURE__ */ h("div", {
|
|
127
|
+
className: "flex items-center gap-3",
|
|
128
|
+
children: [/* @__PURE__ */ m("div", {
|
|
129
|
+
className: "p-2 bg-primary/10 rounded-lg text-primary shadow-inner",
|
|
130
|
+
children: /* @__PURE__ */ m(l, { className: "h-5 w-5" })
|
|
131
|
+
}), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ h("div", {
|
|
132
|
+
className: "flex items-center gap-2",
|
|
133
|
+
children: [/* @__PURE__ */ m(C, {
|
|
134
|
+
className: "text-lg font-bold",
|
|
135
|
+
children: e.name
|
|
136
|
+
}), /* @__PURE__ */ h(_, {
|
|
137
|
+
variant: "outline",
|
|
138
|
+
className: "text-[10px] uppercase font-bold py-0 h-4 border-slate-200 bg-white/50 dark:bg-black/20",
|
|
139
|
+
children: ["Prio: ", e.priority_order]
|
|
140
|
+
})]
|
|
141
|
+
}), /* @__PURE__ */ h(x, {
|
|
142
|
+
className: "text-xs",
|
|
143
|
+
children: [e.shipping_zone_locations?.length || 0, " regions covered"]
|
|
144
|
+
})] })]
|
|
145
|
+
}), /* @__PURE__ */ h("div", {
|
|
146
|
+
className: "flex gap-1",
|
|
147
|
+
children: [/* @__PURE__ */ m(o, {
|
|
148
|
+
mode: "edit",
|
|
149
|
+
initialData: {
|
|
150
|
+
id: e.id,
|
|
151
|
+
name: e.name,
|
|
152
|
+
priority_order: e.priority_order,
|
|
153
|
+
locations: e.shipping_zone_locations?.map((e) => ({
|
|
154
|
+
country_code: e.country_code,
|
|
155
|
+
state_code: e.state_code
|
|
156
|
+
})) || []
|
|
157
|
+
}
|
|
158
|
+
}), /* @__PURE__ */ m("form", {
|
|
159
|
+
action: async () => {
|
|
160
|
+
"use server";
|
|
161
|
+
await i(e.id);
|
|
162
|
+
},
|
|
163
|
+
children: /* @__PURE__ */ m(v, {
|
|
164
|
+
type: "submit",
|
|
165
|
+
variant: "ghost",
|
|
166
|
+
size: "icon",
|
|
167
|
+
className: "h-8 w-8 text-slate-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20",
|
|
168
|
+
children: /* @__PURE__ */ m(d, { className: "h-4 w-4" })
|
|
169
|
+
})
|
|
170
|
+
})]
|
|
171
|
+
})]
|
|
172
|
+
})
|
|
173
|
+
}), /* @__PURE__ */ m(b, {
|
|
174
|
+
className: "p-0",
|
|
175
|
+
children: /* @__PURE__ */ h("div", {
|
|
176
|
+
className: "grid md:grid-cols-2 divide-y md:divide-y-0 md:divide-x divide-slate-100 dark:divide-slate-800",
|
|
177
|
+
children: [/* @__PURE__ */ h("div", {
|
|
178
|
+
className: "p-6",
|
|
179
|
+
children: [/* @__PURE__ */ h("h4", {
|
|
180
|
+
className: "text-[10px] font-bold uppercase tracking-widest text-slate-500 mb-4 flex items-center gap-1.5",
|
|
181
|
+
children: [/* @__PURE__ */ m(l, { className: "h-3 w-3" }), " Target Regions"]
|
|
182
|
+
}), /* @__PURE__ */ m("div", {
|
|
183
|
+
className: "flex flex-wrap gap-1.5",
|
|
184
|
+
children: e.shipping_zone_locations?.length > 0 ? e.shipping_zone_locations.map((e) => /* @__PURE__ */ h(_, {
|
|
185
|
+
variant: "secondary",
|
|
186
|
+
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",
|
|
187
|
+
children: [e.country_code, e.state_code ? /* @__PURE__ */ h("span", {
|
|
188
|
+
className: "text-slate-400 ml-1",
|
|
189
|
+
children: [
|
|
190
|
+
"(",
|
|
191
|
+
t(e.country_code, e.state_code),
|
|
192
|
+
")"
|
|
193
|
+
]
|
|
194
|
+
}) : ""]
|
|
195
|
+
}, e.id)) : /* @__PURE__ */ m("p", {
|
|
196
|
+
className: "text-sm text-slate-400 italic",
|
|
197
|
+
children: "No specific locations assigned."
|
|
198
|
+
})
|
|
199
|
+
})]
|
|
200
|
+
}), /* @__PURE__ */ h("div", {
|
|
201
|
+
className: "p-6",
|
|
202
|
+
children: [/* @__PURE__ */ h("div", {
|
|
203
|
+
className: "flex justify-between items-center mb-4",
|
|
204
|
+
children: [/* @__PURE__ */ h("h4", {
|
|
205
|
+
className: "text-[10px] font-bold uppercase tracking-widest text-slate-500 flex items-center gap-1.5",
|
|
206
|
+
children: [/* @__PURE__ */ m(f, { className: "h-3 w-3" }), " Shipping Methods"]
|
|
207
|
+
}), /* @__PURE__ */ m(s, {
|
|
208
|
+
zoneId: e.id,
|
|
209
|
+
zoneName: e.name,
|
|
210
|
+
languages: M || [],
|
|
211
|
+
currencies: F,
|
|
212
|
+
defaultCurrencyCode: P
|
|
213
|
+
})]
|
|
214
|
+
}), /* @__PURE__ */ m("div", {
|
|
215
|
+
className: "space-y-2",
|
|
216
|
+
children: e.shipping_zone_methods?.length > 0 ? e.shipping_zone_methods.map((t) => /* @__PURE__ */ h("div", {
|
|
217
|
+
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",
|
|
218
|
+
children: [/* @__PURE__ */ h("div", {
|
|
219
|
+
className: "flex-1 min-w-0",
|
|
220
|
+
children: [/* @__PURE__ */ h("div", {
|
|
221
|
+
className: "flex items-center gap-2",
|
|
222
|
+
children: [
|
|
223
|
+
/* @__PURE__ */ m("p", {
|
|
224
|
+
className: "text-sm font-semibold text-slate-900 dark:text-slate-100 truncate",
|
|
225
|
+
children: t.name
|
|
226
|
+
}),
|
|
227
|
+
/* @__PURE__ */ m(_, {
|
|
228
|
+
variant: "outline",
|
|
229
|
+
className: "h-4 px-1 text-[9px]",
|
|
230
|
+
children: t.currency_pricing_mode === "manual" ? "Manual FX" : "Auto FX"
|
|
231
|
+
}),
|
|
232
|
+
(t.min_order_amount || 0) > 0 && /* @__PURE__ */ h(w, { children: [/* @__PURE__ */ m(D, {
|
|
233
|
+
asChild: !0,
|
|
234
|
+
children: /* @__PURE__ */ h(_, {
|
|
235
|
+
variant: "outline",
|
|
236
|
+
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",
|
|
237
|
+
children: [/* @__PURE__ */ m(u, { className: "h-2 w-2 mr-0.5" }), p(t.min_order_amount, t.cost_currency?.toUpperCase() || P)]
|
|
238
|
+
})
|
|
239
|
+
}), /* @__PURE__ */ h(T, { children: ["Available for orders over ", p(t.min_order_amount, t.cost_currency?.toUpperCase() || P)] })] })
|
|
240
|
+
]
|
|
241
|
+
}), /* @__PURE__ */ m("p", {
|
|
242
|
+
className: "text-[10px] text-slate-500 uppercase tracking-tighter mix-blend-multiply dark:mix-blend-normal",
|
|
243
|
+
children: t.method_type.replace("_", " ")
|
|
244
|
+
})]
|
|
245
|
+
}), /* @__PURE__ */ h("div", {
|
|
246
|
+
className: "flex items-center gap-1",
|
|
247
|
+
children: [/* @__PURE__ */ m("p", {
|
|
248
|
+
className: "text-sm font-black text-primary px-2",
|
|
249
|
+
children: t.method_type === "free_shipping" ? "FREE" : p(t.cost_amount, t.cost_currency?.toUpperCase() || P)
|
|
250
|
+
}), /* @__PURE__ */ h("div", {
|
|
251
|
+
className: "flex opacity-0 group-hover:opacity-100 transition-opacity",
|
|
252
|
+
children: [/* @__PURE__ */ m(s, {
|
|
253
|
+
zoneId: e.id,
|
|
254
|
+
zoneName: e.name,
|
|
255
|
+
languages: M || [],
|
|
256
|
+
currencies: F,
|
|
257
|
+
defaultCurrencyCode: P,
|
|
258
|
+
mode: "edit",
|
|
259
|
+
initialData: t
|
|
260
|
+
}), /* @__PURE__ */ m("form", {
|
|
261
|
+
action: async () => {
|
|
262
|
+
"use server";
|
|
263
|
+
await r(t.id);
|
|
264
|
+
},
|
|
265
|
+
children: /* @__PURE__ */ m(v, {
|
|
266
|
+
type: "submit",
|
|
267
|
+
variant: "ghost",
|
|
268
|
+
size: "icon",
|
|
269
|
+
className: "h-7 w-7 text-slate-400 hover:text-red-500",
|
|
270
|
+
children: /* @__PURE__ */ m(d, { className: "h-3 w-3" })
|
|
271
|
+
})
|
|
272
|
+
})]
|
|
273
|
+
})]
|
|
274
|
+
})]
|
|
275
|
+
}, t.id)) : /* @__PURE__ */ m("p", {
|
|
276
|
+
className: "text-xs text-slate-400 italic",
|
|
277
|
+
children: "No methods defined for this zone."
|
|
278
|
+
})
|
|
279
|
+
})]
|
|
280
|
+
})]
|
|
281
|
+
})
|
|
282
|
+
})]
|
|
283
|
+
}, e.id))
|
|
284
|
+
})
|
|
285
|
+
]
|
|
286
|
+
}) });
|
|
208
287
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
};
|
|
288
|
+
//#endregion
|
|
289
|
+
export { O as ShippingPage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../../../../currency.cjs"),t=require("../../../../shipping-rate-currency.cjs"),n=require("../server-actions.cjs");let r=require("react"),i=require("lucide-react"),a=require("@nextblock-cms/utils"),o=require("react/jsx-runtime"),s=require("@nextblock-cms/ui");function c(e,t){if(typeof e!=`number`)return``;let n=(0,a.minorUnitAmountToMajor)(e,t);return(0,a.getCurrencyMinorUnitFactor)(t)===1?n.toFixed(0):n.toFixed(2)}function l(e){return e.reduce((e,t)=>(e[t.code]=(0,a.getCurrencyMinorUnitFactor)(t.code)===1?`0`:`0.00`,e),{})}function u(e,t){let n=String(e||``).trim();if(!n)return null;let r=Number(n);return!Number.isFinite(r)||r<0?null:(0,a.majorUnitAmountToMinor)(r,t)}function d(e){return e.currencies.reduce((t,n)=>(t[n.code]=c(e.amounts[n.code],n.code),t),{})}function f({zoneId:f,zoneName:p,languages:m,currencies:h=[],defaultCurrencyCode:g=`USD`,mode:_=`create`,initialData:v}){let[y,b]=(0,r.useState)(!1),x=_===`edit`,S=(0,r.useMemo)(()=>m.find(e=>e.is_default)||m[0]||null,[m]),C=(0,r.useMemo)(()=>m.filter(e=>!e.is_default),[m]),w=(0,a.normalizeCurrencyCode)(g),T=(0,r.useMemo)(()=>{let t=e.normalizeCurrencyRecord({code:w,symbol:w,exchange_rate:1,is_default:!0,is_active:!0}),n=(h.length>0?h:[t]).map(t=>e.normalizeCurrencyRecord(t)).filter(e=>e.is_active!==!1).sort((e,t)=>e.is_default===t.is_default?e.code.localeCompare(t.code):e.is_default?-1:1);return n.length>0?n:[t]},[h,w]),E=(0,r.useMemo)(()=>T.find(e=>e.is_default)||T[0],[T]),[D,O]=(0,r.useState)(v?.name||``),[k,A]=(0,r.useState)(v?.name_translations||{}),[j,M]=(0,r.useState)(v?.method_type||`flat_rate`),[N,P]=(0,r.useState)(t.normalizeShippingRateCurrencyMode(v?.currency_pricing_mode)),[F,I]=(0,r.useState)((0,a.normalizeCurrencyCode)(v?.cost_currency||E?.code||w)),[L,R]=(0,r.useState)({}),[z,B]=(0,r.useState)({}),[V,H]=(0,r.useState)(!1),U=(0,r.useMemo)(()=>{if(N===`manual`)return T.reduce((e,t)=>(e[t.code]=L[t.code]??``,e),{});let t=T.reduce((e,t)=>(e[t.code]=L[t.code]??(t.code,``),e),{}),n=u(L[F],F);if(n===null)return t;for(let r of T){if(r.code===F){t[r.code]=L[r.code]??c(n,r.code);continue}t[r.code]=c(e.convertMinorUnitAmount({amount:n,fromCurrencyCode:F,toCurrencyCode:r.code,currencies:T}),r.code)}return t},[T,L,N,F]),W=(0,r.useMemo)(()=>{if(N===`manual`)return T.reduce((e,t)=>(e[t.code]=z[t.code]??``,e),{});let t=T.reduce((e,t)=>(e[t.code]=z[t.code]??``,e),{}),n=u(z[F],F);if(n===null)return t;for(let r of T){if(r.code===F){t[r.code]=z[r.code]??c(n,r.code);continue}t[r.code]=c(e.convertMinorUnitAmount({amount:n,fromCurrencyCode:F,toCurrencyCode:r.code,currencies:T}),r.code)}return t},[T,z,N,F]);(0,r.useEffect)(()=>{E&&(T.some(e=>e.code===F)||I(E.code))},[T,E,F]),(0,r.useEffect)(()=>{if(!y||!E)return;let e=t.normalizeShippingRateCurrencyMode(v?.currency_pricing_mode),n=t.sanitizeShippingRateAmountMaps({currencies:T,mode:e,sourceCurrencyCode:v?.cost_currency||E.code,costAmounts:v?.cost_amounts||void 0,minOrderAmounts:v?.min_order_amounts||void 0,fallbackCostAmount:v?.cost_amount,fallbackMinOrderAmount:v?.min_order_amount});O(v?.name||``),A(v?.name_translations||{}),M(v?.method_type||`flat_rate`),P(e),I(n.sourceCurrencyCode),R(d({amounts:n.costAmounts,currencies:T})),B(d({amounts:n.minOrderAmounts,currencies:T}))},[T,E,v,y]);let G=e=>{e!==N&&(e===`manual`&&(R(U),B(W)),P(e))};return(0,o.jsxs)(s.Dialog,{open:y,onOpenChange:b,children:[(0,o.jsx)(s.DialogTrigger,{asChild:!0,children:x?(0,o.jsx)(s.Button,{variant:`ghost`,size:`icon`,className:`h-7 w-7 text-slate-400 hover:text-primary`,children:(0,o.jsx)(i.Edit2,{className:`h-3 w-3`})}):(0,o.jsxs)(s.Button,{variant:`outline`,size:`sm`,className:`h-8 gap-1.5 border-dashed hover:border-solid shadow-sm`,children:[(0,o.jsx)(i.Plus,{className:`h-3.5 w-3.5`}),`Add Rate`]})}),(0,o.jsx)(s.DialogContent,{className:`max-h-[85vh] max-w-4xl overflow-y-auto`,children:(0,o.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),H(!0);let t={},r={};if(N===`manual`)for(let e of T){let n=e.code;if(j===`free_shipping`)t[n]=0;else{let e=u(L[n],n);if(e===null){H(!1),alert(`Enter a valid shipping cost for ${n}.`);return}t[n]=e}r[n]=u(z[n],n)??0}else{let e=j===`free_shipping`?0:u(L[F],F);if(e===null){H(!1),alert(`Enter a valid shipping cost for ${F}.`);return}t[F]=e,r[F]=u(z[F],F)??0}let i={name:D,nameTranslations:k,type:j,currencyPricingMode:N,sourceCurrencyCode:F,costAmounts:t,minOrderAmounts:r},a=x&&v?.id?await n.updateShippingRate(v.id,i):await n.createShippingRate(f,i);H(!1),a.success?b(!1):a.error&&alert(a.error)},children:[(0,o.jsxs)(s.DialogHeader,{children:[(0,o.jsx)(s.DialogTitle,{children:x?`Edit Shipping Rate`:`Add Shipping Rate`}),(0,o.jsxs)(s.DialogDescription,{children:[`Configure shipping costs and localized labels for matching orders in `,(0,o.jsx)(`strong`,{children:p}),`.`]})]}),(0,o.jsxs)(`div`,{className:`grid gap-5 py-6`,children:[(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(s.Label,{htmlFor:`rate-name`,children:[`Rate Name`,S?` (${S.name})`:``]}),(0,o.jsx)(s.Input,{id:`rate-name`,value:D,onChange:e=>O(e.target.value),placeholder:`e.g. Standard, Express, Free Shipping`,required:!0})]}),C.length>0&&(0,o.jsxs)(`div`,{className:`space-y-4 rounded-xl border bg-slate-50/70 p-4 dark:bg-slate-900/40`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(i.Languages,{className:`h-4 w-4 text-slate-500`}),(0,o.jsxs)(`div`,{children:[(0,o.jsx)(`p`,{className:`text-sm font-medium`,children:`Translations`}),(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add translated shipping rate labels for the active storefront languages.`})]})]}),(0,o.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:C.map(e=>(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsx)(s.Label,{htmlFor:`rate-name-${e.code}`,children:e.name}),(0,o.jsx)(s.Input,{id:`rate-name-${e.code}`,value:k[e.code]||``,onChange:t=>A(n=>({...n,[e.code]:t.target.value})),placeholder:D||`Translated label`})]},e.code))})]}),(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsx)(s.Label,{htmlFor:`type`,children:`Method Type`}),(0,o.jsxs)(s.Select,{value:j,onValueChange:e=>{M(e),e===`free_shipping`&&R(l(T))},children:[(0,o.jsx)(s.SelectTrigger,{id:`type`,className:`bg-slate-50/50 dark:bg-slate-900/50`,children:(0,o.jsx)(s.SelectValue,{placeholder:`Select type`})}),(0,o.jsxs)(s.SelectContent,{children:[(0,o.jsx)(s.SelectItem,{value:`flat_rate`,children:(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`div`,{className:`p-1 min-w-5 h-5 rounded bg-emerald-100 dark:bg-emerald-900/30 text-emerald-600`,children:(0,o.jsx)(i.DollarSign,{className:`h-3 w-3`})}),(0,o.jsx)(`span`,{children:`Flat Rate`})]})}),(0,o.jsx)(s.SelectItem,{value:`free_shipping`,children:(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`div`,{className:`p-1 min-w-5 h-5 rounded bg-amber-100 dark:bg-amber-900/30 text-amber-600`,children:(0,o.jsx)(i.Gift,{className:`h-3 w-3`})}),(0,o.jsx)(`span`,{children:`Free Shipping`})]})})]})]})]}),(0,o.jsxs)(`div`,{className:`space-y-3 rounded-xl border bg-slate-50/70 p-4 dark:bg-slate-900/40`,children:[(0,o.jsxs)(`label`,{className:`flex items-start gap-3`,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:N===`auto`,onChange:e=>G(e.target.checked?`auto`:`manual`),className:`mt-1 h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary`}),(0,o.jsxs)(`span`,{className:`space-y-1`,children:[(0,o.jsx)(`span`,{className:`block text-sm font-medium text-slate-900 dark:text-slate-100`,children:`Auto-sync all currency rates from one source amount`}),(0,o.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Turn this off to set exact shipping costs and free-shipping thresholds for every active currency manually.`})]})]}),N===`auto`?(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsx)(s.Label,{htmlFor:`rate-currency`,children:`Sync From Currency`}),(0,o.jsxs)(s.Select,{value:F,onValueChange:e=>{let t=(0,a.normalizeCurrencyCode)(e);R(e=>({...e,[t]:U[t]??e[t]??``})),B(e=>({...e,[t]:W[t]??e[t]??``})),I(t)},children:[(0,o.jsx)(s.SelectTrigger,{id:`rate-currency`,className:`bg-background`,children:(0,o.jsx)(s.SelectValue,{placeholder:`Select currency`})}),(0,o.jsx)(s.SelectContent,{children:T.map(e=>(0,o.jsxs)(s.SelectItem,{value:e.code,children:[e.code,e.is_default?` (Default)`:``]},e.code))})]}),(0,o.jsx)(`p`,{className:`text-[10px] text-slate-500`,children:`Enter the source amount once and the other currencies will be derived automatically using the current FX rates.`})]}):(0,o.jsx)(`p`,{className:`text-[10px] text-slate-500`,children:`Manual mode stores exact values per currency. This is the best choice when shipping should not follow exchange-rate math directly.`})]}),(0,o.jsxs)(`div`,{className:`space-y-3`,children:[(0,o.jsxs)(`div`,{children:[(0,o.jsx)(`p`,{className:`text-sm font-medium`,children:`Currency Rates`}),(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j===`free_shipping`?`Free-shipping methods keep cost at zero, but you can still control the threshold per currency.`:N===`auto`?`Only ${F} is editable. The rest are derived automatically.`:`Set the exact shopper-facing shipping price for each active currency.`})]}),(0,o.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:T.map(e=>{let t=N===`auto`&&e.code!==F,n=(0,a.getCurrencyMinorUnitFactor)(e.code)===1?`1`:`0.01`;return(0,o.jsxs)(`div`,{className:`space-y-4 rounded-xl border bg-card/70 p-4 shadow-sm`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,o.jsxs)(`div`,{children:[(0,o.jsx)(`p`,{className:`font-medium`,children:e.code}),(0,o.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Rate `,e.exchange_rate]})]}),(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e.is_default?(0,o.jsx)(s.Badge,{variant:`outline`,children:`Default`}):null,N===`auto`&&e.code===F?(0,o.jsx)(s.Badge,{children:`Source`}):null,t?(0,o.jsx)(s.Badge,{variant:`outline`,children:`Derived`}):null]})]}),(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(s.Label,{htmlFor:`rate-cost-${e.code}`,children:[`Cost (`,e.code,`)`]}),(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(i.DollarSign,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-slate-400`}),(0,o.jsx)(s.Input,{id:`rate-cost-${e.code}`,type:`number`,step:n,min:`0`,value:U[e.code]??``,onChange:t=>R(n=>({...n,[e.code]:t.target.value})),className:`pl-9 bg-slate-50/50 dark:bg-slate-900/50 disabled:opacity-70`,disabled:j===`free_shipping`||t,required:j!==`free_shipping`&&N===`manual`})]})]}),(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(s.Label,{htmlFor:`rate-threshold-${e.code}`,children:[`Free-Shipping Threshold (`,e.code,`)`]}),(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(i.DollarSign,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-slate-400`}),(0,o.jsx)(s.Input,{id:`rate-threshold-${e.code}`,type:`number`,step:n,min:`0`,value:W[e.code]??``,onChange:t=>B(n=>({...n,[e.code]:t.target.value})),className:`pl-9 bg-slate-50/50 dark:bg-slate-900/50 disabled:opacity-70`,disabled:t,placeholder:(0,a.getCurrencyMinorUnitFactor)(e.code)===1?`0`:`0.00`})]})]}),t?(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[`This currency is synced automatically from `,F,`.`]}):N===`manual`?(0,o.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Enter the exact amount shoppers should see in this currency.`}):null]},e.code)})})]})]}),(0,o.jsxs)(s.DialogFooter,{className:`bg-slate-50 dark:bg-slate-900/50 -mx-6 -mb-6 p-4 border-t dark:border-slate-800`,children:[(0,o.jsx)(s.Button,{type:`button`,variant:`ghost`,onClick:()=>b(!1),disabled:V,children:`Cancel`}),(0,o.jsx)(s.Button,{type:`submit`,disabled:V||!D.trim(),children:V?x?`Saving...`:`Adding...`:x?`Save Changes`:`Add Rate`})]})]})})]})}exports.RateForm=f;
|
|
@@ -22,5 +22,5 @@ interface RateFormProps {
|
|
|
22
22
|
min_order_amounts?: Record<string, number> | null;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
export declare function RateForm({ zoneId, zoneName, languages, currencies, defaultCurrencyCode, mode, initialData, }: RateFormProps): import(
|
|
25
|
+
export declare function RateForm({ zoneId, zoneName, languages, currencies, defaultCurrencyCode, mode, initialData, }: RateFormProps): import('react').JSX.Element;
|
|
26
26
|
export {};
|