@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,441 +1,444 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { convertMinorUnitAmount as e, normalizeCurrencyRecord as t } from "../../../../currency.es.js";
|
|
3
|
+
import { normalizeShippingRateCurrencyMode as n, sanitizeShippingRateAmountMaps as r } from "../../../../shipping-rate-currency.es.js";
|
|
4
|
+
import { createShippingRate as ee, updateShippingRate as te } from "../server-actions.es.js";
|
|
5
|
+
import { useEffect as i, useMemo as a, useState as o } from "react";
|
|
6
|
+
import { DollarSign as s, Edit2 as ne, Gift as re, Languages as ie, Plus as ae } from "lucide-react";
|
|
7
|
+
import { getCurrencyMinorUnitFactor as c, majorUnitAmountToMinor as l, minorUnitAmountToMajor as u, normalizeCurrencyCode as d } from "@nextblock-cms/utils";
|
|
8
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
9
|
+
import { Badge as m, Button as h, Dialog as oe, DialogContent as se, DialogDescription as ce, DialogFooter as le, DialogHeader as ue, DialogTitle as de, DialogTrigger as fe, Input as g, Label as _, Select as pe, SelectContent as v, SelectItem as y, SelectTrigger as b, SelectValue as x } from "@nextblock-cms/ui";
|
|
10
|
+
//#region src/lib/pages/cms/shipping/components/RateForm.tsx
|
|
11
|
+
function S(e, t) {
|
|
12
|
+
if (typeof e != "number") return "";
|
|
13
|
+
let n = u(e, t);
|
|
14
|
+
return c(t) === 1 ? n.toFixed(0) : n.toFixed(2);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
16
|
+
function me(e) {
|
|
17
|
+
return e.reduce((e, t) => (e[t.code] = c(t.code) === 1 ? "0" : "0.00", e), {});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return !Number.isFinite(f) || f < 0 ? null : we(f, m);
|
|
19
|
+
function C(e, t) {
|
|
20
|
+
let n = String(e || "").trim();
|
|
21
|
+
if (!n) return null;
|
|
22
|
+
let r = Number(n);
|
|
23
|
+
return !Number.isFinite(r) || r < 0 ? null : l(r, t);
|
|
25
24
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
u.amounts[c.code],
|
|
29
|
-
c.code
|
|
30
|
-
), m), {});
|
|
25
|
+
function w(e) {
|
|
26
|
+
return e.currencies.reduce((t, n) => (t[n.code] = S(e.amounts[n.code], n.code), t), {});
|
|
31
27
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
28
|
+
function T({ zoneId: l, zoneName: u, languages: T, currencies: E = [], defaultCurrencyCode: he = "USD", mode: ge = "create", initialData: D }) {
|
|
29
|
+
let [O, k] = o(!1), A = ge === "edit", j = a(() => T.find((e) => e.is_default) || T[0] || null, [T]), M = a(() => T.filter((e) => !e.is_default), [T]), N = d(he), P = a(() => {
|
|
30
|
+
let e = t({
|
|
31
|
+
code: N,
|
|
32
|
+
symbol: N,
|
|
33
|
+
exchange_rate: 1,
|
|
34
|
+
is_default: !0,
|
|
35
|
+
is_active: !0
|
|
36
|
+
}), n = (E.length > 0 ? E : [e]).map((e) => t(e)).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);
|
|
37
|
+
return n.length > 0 ? n : [e];
|
|
38
|
+
}, [E, N]), F = a(() => P.find((e) => e.is_default) || P[0], [P]), [I, L] = o(D?.name || ""), [R, z] = o(D?.name_translations || {}), [B, V] = o(D?.method_type || "flat_rate"), [H, U] = o(n(D?.currency_pricing_mode)), [W, G] = o(d(D?.cost_currency || F?.code || N)), [K, q] = o({}), [J, Y] = o({}), [X, Z] = o(!1), Q = a(() => {
|
|
39
|
+
if (H === "manual") return P.reduce((e, t) => (e[t.code] = K[t.code] ?? "", e), {});
|
|
40
|
+
let t = P.reduce((e, t) => (e[t.code] = K[t.code] ?? (t.code, ""), e), {}), n = C(K[W], W);
|
|
41
|
+
if (n === null) return t;
|
|
42
|
+
for (let r of P) {
|
|
43
|
+
if (r.code === W) {
|
|
44
|
+
t[r.code] = K[r.code] ?? S(n, r.code);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
t[r.code] = S(e({
|
|
48
|
+
amount: n,
|
|
49
|
+
fromCurrencyCode: W,
|
|
50
|
+
toCurrencyCode: r.code,
|
|
51
|
+
currencies: P
|
|
52
|
+
}), r.code);
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
}, [
|
|
56
|
+
P,
|
|
57
|
+
K,
|
|
58
|
+
H,
|
|
59
|
+
W
|
|
60
|
+
]), $ = a(() => {
|
|
61
|
+
if (H === "manual") return P.reduce((e, t) => (e[t.code] = J[t.code] ?? "", e), {});
|
|
62
|
+
let t = P.reduce((e, t) => (e[t.code] = J[t.code] ?? "", e), {}), n = C(J[W], W);
|
|
63
|
+
if (n === null) return t;
|
|
64
|
+
for (let r of P) {
|
|
65
|
+
if (r.code === W) {
|
|
66
|
+
t[r.code] = J[r.code] ?? S(n, r.code);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
t[r.code] = S(e({
|
|
70
|
+
amount: n,
|
|
71
|
+
fromCurrencyCode: W,
|
|
72
|
+
toCurrencyCode: r.code,
|
|
73
|
+
currencies: P
|
|
74
|
+
}), r.code);
|
|
75
|
+
}
|
|
76
|
+
return t;
|
|
77
|
+
}, [
|
|
78
|
+
P,
|
|
79
|
+
J,
|
|
80
|
+
H,
|
|
81
|
+
W
|
|
82
|
+
]);
|
|
83
|
+
i(() => {
|
|
84
|
+
F && (P.some((e) => e.code === W) || G(F.code));
|
|
85
|
+
}, [
|
|
86
|
+
P,
|
|
87
|
+
F,
|
|
88
|
+
W
|
|
89
|
+
]), i(() => {
|
|
90
|
+
if (!O || !F) return;
|
|
91
|
+
let e = n(D?.currency_pricing_mode), t = r({
|
|
92
|
+
currencies: P,
|
|
93
|
+
mode: e,
|
|
94
|
+
sourceCurrencyCode: D?.cost_currency || F.code,
|
|
95
|
+
costAmounts: D?.cost_amounts || void 0,
|
|
96
|
+
minOrderAmounts: D?.min_order_amounts || void 0,
|
|
97
|
+
fallbackCostAmount: D?.cost_amount,
|
|
98
|
+
fallbackMinOrderAmount: D?.min_order_amount
|
|
99
|
+
});
|
|
100
|
+
L(D?.name || ""), z(D?.name_translations || {}), V(D?.method_type || "flat_rate"), U(e), G(t.sourceCurrencyCode), q(w({
|
|
101
|
+
amounts: t.costAmounts,
|
|
102
|
+
currencies: P
|
|
103
|
+
})), Y(w({
|
|
104
|
+
amounts: t.minOrderAmounts,
|
|
105
|
+
currencies: P
|
|
106
|
+
}));
|
|
107
|
+
}, [
|
|
108
|
+
P,
|
|
109
|
+
F,
|
|
110
|
+
D,
|
|
111
|
+
O
|
|
112
|
+
]);
|
|
113
|
+
let _e = (e) => {
|
|
114
|
+
e !== H && (e === "manual" && (q(Q), Y($)), U(e));
|
|
115
|
+
};
|
|
116
|
+
return /* @__PURE__ */ p(oe, {
|
|
117
|
+
open: O,
|
|
118
|
+
onOpenChange: k,
|
|
119
|
+
children: [/* @__PURE__ */ f(fe, {
|
|
120
|
+
asChild: !0,
|
|
121
|
+
children: A ? /* @__PURE__ */ f(h, {
|
|
122
|
+
variant: "ghost",
|
|
123
|
+
size: "icon",
|
|
124
|
+
className: "h-7 w-7 text-slate-400 hover:text-primary",
|
|
125
|
+
children: /* @__PURE__ */ f(ne, { className: "h-3 w-3" })
|
|
126
|
+
}) : /* @__PURE__ */ p(h, {
|
|
127
|
+
variant: "outline",
|
|
128
|
+
size: "sm",
|
|
129
|
+
className: "h-8 gap-1.5 border-dashed hover:border-solid shadow-sm",
|
|
130
|
+
children: [/* @__PURE__ */ f(ae, { className: "h-3.5 w-3.5" }), "Add Rate"]
|
|
131
|
+
})
|
|
132
|
+
}), /* @__PURE__ */ f(se, {
|
|
133
|
+
className: "max-h-[85vh] max-w-4xl overflow-y-auto",
|
|
134
|
+
children: /* @__PURE__ */ p("form", {
|
|
135
|
+
onSubmit: async (e) => {
|
|
136
|
+
e.preventDefault(), Z(!0);
|
|
137
|
+
let t = {}, n = {};
|
|
138
|
+
if (H === "manual") for (let e of P) {
|
|
139
|
+
let r = e.code;
|
|
140
|
+
if (B === "free_shipping") t[r] = 0;
|
|
141
|
+
else {
|
|
142
|
+
let e = C(K[r], r);
|
|
143
|
+
if (e === null) {
|
|
144
|
+
Z(!1), alert(`Enter a valid shipping cost for ${r}.`);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
t[r] = e;
|
|
148
|
+
}
|
|
149
|
+
n[r] = C(J[r], r) ?? 0;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
let e = B === "free_shipping" ? 0 : C(K[W], W);
|
|
153
|
+
if (e === null) {
|
|
154
|
+
Z(!1), alert(`Enter a valid shipping cost for ${W}.`);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
t[W] = e, n[W] = C(J[W], W) ?? 0;
|
|
158
|
+
}
|
|
159
|
+
let r = {
|
|
160
|
+
name: I,
|
|
161
|
+
nameTranslations: R,
|
|
162
|
+
type: B,
|
|
163
|
+
currencyPricingMode: H,
|
|
164
|
+
sourceCurrencyCode: W,
|
|
165
|
+
costAmounts: t,
|
|
166
|
+
minOrderAmounts: n
|
|
167
|
+
}, i = A && D?.id ? await te(D.id, r) : await ee(l, r);
|
|
168
|
+
Z(!1), i.success ? k(!1) : i.error && alert(i.error);
|
|
169
|
+
},
|
|
170
|
+
children: [
|
|
171
|
+
/* @__PURE__ */ p(ue, { children: [/* @__PURE__ */ f(de, { children: A ? "Edit Shipping Rate" : "Add Shipping Rate" }), /* @__PURE__ */ p(ce, { children: [
|
|
172
|
+
"Configure shipping costs and localized labels for matching orders in ",
|
|
173
|
+
/* @__PURE__ */ f("strong", { children: u }),
|
|
174
|
+
"."
|
|
175
|
+
] })] }),
|
|
176
|
+
/* @__PURE__ */ p("div", {
|
|
177
|
+
className: "grid gap-5 py-6",
|
|
178
|
+
children: [
|
|
179
|
+
/* @__PURE__ */ p("div", {
|
|
180
|
+
className: "space-y-2",
|
|
181
|
+
children: [/* @__PURE__ */ p(_, {
|
|
182
|
+
htmlFor: "rate-name",
|
|
183
|
+
children: ["Rate Name", j ? ` (${j.name})` : ""]
|
|
184
|
+
}), /* @__PURE__ */ f(g, {
|
|
185
|
+
id: "rate-name",
|
|
186
|
+
value: I,
|
|
187
|
+
onChange: (e) => L(e.target.value),
|
|
188
|
+
placeholder: "e.g. Standard, Express, Free Shipping",
|
|
189
|
+
required: !0
|
|
190
|
+
})]
|
|
191
|
+
}),
|
|
192
|
+
M.length > 0 && /* @__PURE__ */ p("div", {
|
|
193
|
+
className: "space-y-4 rounded-xl border bg-slate-50/70 p-4 dark:bg-slate-900/40",
|
|
194
|
+
children: [/* @__PURE__ */ p("div", {
|
|
195
|
+
className: "flex items-center gap-2",
|
|
196
|
+
children: [/* @__PURE__ */ f(ie, { className: "h-4 w-4 text-slate-500" }), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("p", {
|
|
197
|
+
className: "text-sm font-medium",
|
|
198
|
+
children: "Translations"
|
|
199
|
+
}), /* @__PURE__ */ f("p", {
|
|
200
|
+
className: "text-xs text-muted-foreground",
|
|
201
|
+
children: "Add translated shipping rate labels for the active storefront languages."
|
|
202
|
+
})] })]
|
|
203
|
+
}), /* @__PURE__ */ f("div", {
|
|
204
|
+
className: "grid gap-4 md:grid-cols-2",
|
|
205
|
+
children: M.map((e) => /* @__PURE__ */ p("div", {
|
|
206
|
+
className: "space-y-2",
|
|
207
|
+
children: [/* @__PURE__ */ f(_, {
|
|
208
|
+
htmlFor: `rate-name-${e.code}`,
|
|
209
|
+
children: e.name
|
|
210
|
+
}), /* @__PURE__ */ f(g, {
|
|
211
|
+
id: `rate-name-${e.code}`,
|
|
212
|
+
value: R[e.code] || "",
|
|
213
|
+
onChange: (t) => z((n) => ({
|
|
214
|
+
...n,
|
|
215
|
+
[e.code]: t.target.value
|
|
216
|
+
})),
|
|
217
|
+
placeholder: I || "Translated label"
|
|
218
|
+
})]
|
|
219
|
+
}, e.code))
|
|
220
|
+
})]
|
|
221
|
+
}),
|
|
222
|
+
/* @__PURE__ */ p("div", {
|
|
223
|
+
className: "space-y-2",
|
|
224
|
+
children: [/* @__PURE__ */ f(_, {
|
|
225
|
+
htmlFor: "type",
|
|
226
|
+
children: "Method Type"
|
|
227
|
+
}), /* @__PURE__ */ p(pe, {
|
|
228
|
+
value: B,
|
|
229
|
+
onValueChange: (e) => {
|
|
230
|
+
V(e), e === "free_shipping" && q(me(P));
|
|
231
|
+
},
|
|
232
|
+
children: [/* @__PURE__ */ f(b, {
|
|
233
|
+
id: "type",
|
|
234
|
+
className: "bg-slate-50/50 dark:bg-slate-900/50",
|
|
235
|
+
children: /* @__PURE__ */ f(x, { placeholder: "Select type" })
|
|
236
|
+
}), /* @__PURE__ */ p(v, { children: [/* @__PURE__ */ f(y, {
|
|
237
|
+
value: "flat_rate",
|
|
238
|
+
children: /* @__PURE__ */ p("div", {
|
|
239
|
+
className: "flex items-center gap-2",
|
|
240
|
+
children: [/* @__PURE__ */ f("div", {
|
|
241
|
+
className: "p-1 min-w-5 h-5 rounded bg-emerald-100 dark:bg-emerald-900/30 text-emerald-600",
|
|
242
|
+
children: /* @__PURE__ */ f(s, { className: "h-3 w-3" })
|
|
243
|
+
}), /* @__PURE__ */ f("span", { children: "Flat Rate" })]
|
|
244
|
+
})
|
|
245
|
+
}), /* @__PURE__ */ f(y, {
|
|
246
|
+
value: "free_shipping",
|
|
247
|
+
children: /* @__PURE__ */ p("div", {
|
|
248
|
+
className: "flex items-center gap-2",
|
|
249
|
+
children: [/* @__PURE__ */ f("div", {
|
|
250
|
+
className: "p-1 min-w-5 h-5 rounded bg-amber-100 dark:bg-amber-900/30 text-amber-600",
|
|
251
|
+
children: /* @__PURE__ */ f(re, { className: "h-3 w-3" })
|
|
252
|
+
}), /* @__PURE__ */ f("span", { children: "Free Shipping" })]
|
|
253
|
+
})
|
|
254
|
+
})] })]
|
|
255
|
+
})]
|
|
256
|
+
}),
|
|
257
|
+
/* @__PURE__ */ p("div", {
|
|
258
|
+
className: "space-y-3 rounded-xl border bg-slate-50/70 p-4 dark:bg-slate-900/40",
|
|
259
|
+
children: [/* @__PURE__ */ p("label", {
|
|
260
|
+
className: "flex items-start gap-3",
|
|
261
|
+
children: [/* @__PURE__ */ f("input", {
|
|
262
|
+
type: "checkbox",
|
|
263
|
+
checked: H === "auto",
|
|
264
|
+
onChange: (e) => _e(e.target.checked ? "auto" : "manual"),
|
|
265
|
+
className: "mt-1 h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary"
|
|
266
|
+
}), /* @__PURE__ */ p("span", {
|
|
267
|
+
className: "space-y-1",
|
|
268
|
+
children: [/* @__PURE__ */ f("span", {
|
|
269
|
+
className: "block text-sm font-medium text-slate-900 dark:text-slate-100",
|
|
270
|
+
children: "Auto-sync all currency rates from one source amount"
|
|
271
|
+
}), /* @__PURE__ */ f("span", {
|
|
272
|
+
className: "block text-xs text-muted-foreground",
|
|
273
|
+
children: "Turn this off to set exact shipping costs and free-shipping thresholds for every active currency manually."
|
|
274
|
+
})]
|
|
275
|
+
})]
|
|
276
|
+
}), H === "auto" ? /* @__PURE__ */ p("div", {
|
|
277
|
+
className: "space-y-2",
|
|
278
|
+
children: [
|
|
279
|
+
/* @__PURE__ */ f(_, {
|
|
280
|
+
htmlFor: "rate-currency",
|
|
281
|
+
children: "Sync From Currency"
|
|
282
|
+
}),
|
|
283
|
+
/* @__PURE__ */ p(pe, {
|
|
284
|
+
value: W,
|
|
285
|
+
onValueChange: (e) => {
|
|
286
|
+
let t = d(e);
|
|
287
|
+
q((e) => ({
|
|
288
|
+
...e,
|
|
289
|
+
[t]: Q[t] ?? e[t] ?? ""
|
|
290
|
+
})), Y((e) => ({
|
|
291
|
+
...e,
|
|
292
|
+
[t]: $[t] ?? e[t] ?? ""
|
|
293
|
+
})), G(t);
|
|
294
|
+
},
|
|
295
|
+
children: [/* @__PURE__ */ f(b, {
|
|
296
|
+
id: "rate-currency",
|
|
297
|
+
className: "bg-background",
|
|
298
|
+
children: /* @__PURE__ */ f(x, { placeholder: "Select currency" })
|
|
299
|
+
}), /* @__PURE__ */ f(v, { children: P.map((e) => /* @__PURE__ */ p(y, {
|
|
300
|
+
value: e.code,
|
|
301
|
+
children: [e.code, e.is_default ? " (Default)" : ""]
|
|
302
|
+
}, e.code)) })]
|
|
303
|
+
}),
|
|
304
|
+
/* @__PURE__ */ f("p", {
|
|
305
|
+
className: "text-[10px] text-slate-500",
|
|
306
|
+
children: "Enter the source amount once and the other currencies will be derived automatically using the current FX rates."
|
|
307
|
+
})
|
|
308
|
+
]
|
|
309
|
+
}) : /* @__PURE__ */ f("p", {
|
|
310
|
+
className: "text-[10px] text-slate-500",
|
|
311
|
+
children: "Manual mode stores exact values per currency. This is the best choice when shipping should not follow exchange-rate math directly."
|
|
312
|
+
})]
|
|
313
|
+
}),
|
|
314
|
+
/* @__PURE__ */ p("div", {
|
|
315
|
+
className: "space-y-3",
|
|
316
|
+
children: [/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("p", {
|
|
317
|
+
className: "text-sm font-medium",
|
|
318
|
+
children: "Currency Rates"
|
|
319
|
+
}), /* @__PURE__ */ f("p", {
|
|
320
|
+
className: "text-xs text-muted-foreground",
|
|
321
|
+
children: B === "free_shipping" ? "Free-shipping methods keep cost at zero, but you can still control the threshold per currency." : H === "auto" ? `Only ${W} is editable. The rest are derived automatically.` : "Set the exact shopper-facing shipping price for each active currency."
|
|
322
|
+
})] }), /* @__PURE__ */ f("div", {
|
|
323
|
+
className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
|
|
324
|
+
children: P.map((e) => {
|
|
325
|
+
let t = H === "auto" && e.code !== W, n = c(e.code) === 1 ? "1" : "0.01";
|
|
326
|
+
return /* @__PURE__ */ p("div", {
|
|
327
|
+
className: "space-y-4 rounded-xl border bg-card/70 p-4 shadow-sm",
|
|
328
|
+
children: [
|
|
329
|
+
/* @__PURE__ */ p("div", {
|
|
330
|
+
className: "flex items-center justify-between gap-2",
|
|
331
|
+
children: [/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("p", {
|
|
332
|
+
className: "font-medium",
|
|
333
|
+
children: e.code
|
|
334
|
+
}), /* @__PURE__ */ p("p", {
|
|
335
|
+
className: "text-xs text-muted-foreground",
|
|
336
|
+
children: ["Rate ", e.exchange_rate]
|
|
337
|
+
})] }), /* @__PURE__ */ p("div", {
|
|
338
|
+
className: "flex flex-wrap items-center gap-2",
|
|
339
|
+
children: [
|
|
340
|
+
e.is_default ? /* @__PURE__ */ f(m, {
|
|
341
|
+
variant: "outline",
|
|
342
|
+
children: "Default"
|
|
343
|
+
}) : null,
|
|
344
|
+
H === "auto" && e.code === W ? /* @__PURE__ */ f(m, { children: "Source" }) : null,
|
|
345
|
+
t ? /* @__PURE__ */ f(m, {
|
|
346
|
+
variant: "outline",
|
|
347
|
+
children: "Derived"
|
|
348
|
+
}) : null
|
|
349
|
+
]
|
|
350
|
+
})]
|
|
351
|
+
}),
|
|
352
|
+
/* @__PURE__ */ p("div", {
|
|
353
|
+
className: "space-y-2",
|
|
354
|
+
children: [/* @__PURE__ */ p(_, {
|
|
355
|
+
htmlFor: `rate-cost-${e.code}`,
|
|
356
|
+
children: [
|
|
357
|
+
"Cost (",
|
|
358
|
+
e.code,
|
|
359
|
+
")"
|
|
360
|
+
]
|
|
361
|
+
}), /* @__PURE__ */ p("div", {
|
|
362
|
+
className: "relative",
|
|
363
|
+
children: [/* @__PURE__ */ f(s, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-slate-400" }), /* @__PURE__ */ f(g, {
|
|
364
|
+
id: `rate-cost-${e.code}`,
|
|
365
|
+
type: "number",
|
|
366
|
+
step: n,
|
|
367
|
+
min: "0",
|
|
368
|
+
value: Q[e.code] ?? "",
|
|
369
|
+
onChange: (t) => q((n) => ({
|
|
370
|
+
...n,
|
|
371
|
+
[e.code]: t.target.value
|
|
372
|
+
})),
|
|
373
|
+
className: "pl-9 bg-slate-50/50 dark:bg-slate-900/50 disabled:opacity-70",
|
|
374
|
+
disabled: B === "free_shipping" || t,
|
|
375
|
+
required: B !== "free_shipping" && H === "manual"
|
|
376
|
+
})]
|
|
377
|
+
})]
|
|
378
|
+
}),
|
|
379
|
+
/* @__PURE__ */ p("div", {
|
|
380
|
+
className: "space-y-2",
|
|
381
|
+
children: [/* @__PURE__ */ p(_, {
|
|
382
|
+
htmlFor: `rate-threshold-${e.code}`,
|
|
383
|
+
children: [
|
|
384
|
+
"Free-Shipping Threshold (",
|
|
385
|
+
e.code,
|
|
386
|
+
")"
|
|
387
|
+
]
|
|
388
|
+
}), /* @__PURE__ */ p("div", {
|
|
389
|
+
className: "relative",
|
|
390
|
+
children: [/* @__PURE__ */ f(s, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-slate-400" }), /* @__PURE__ */ f(g, {
|
|
391
|
+
id: `rate-threshold-${e.code}`,
|
|
392
|
+
type: "number",
|
|
393
|
+
step: n,
|
|
394
|
+
min: "0",
|
|
395
|
+
value: $[e.code] ?? "",
|
|
396
|
+
onChange: (t) => Y((n) => ({
|
|
397
|
+
...n,
|
|
398
|
+
[e.code]: t.target.value
|
|
399
|
+
})),
|
|
400
|
+
className: "pl-9 bg-slate-50/50 dark:bg-slate-900/50 disabled:opacity-70",
|
|
401
|
+
disabled: t,
|
|
402
|
+
placeholder: c(e.code) === 1 ? "0" : "0.00"
|
|
403
|
+
})]
|
|
404
|
+
})]
|
|
405
|
+
}),
|
|
406
|
+
t ? /* @__PURE__ */ p("p", {
|
|
407
|
+
className: "text-[10px] text-muted-foreground",
|
|
408
|
+
children: [
|
|
409
|
+
"This currency is synced automatically from ",
|
|
410
|
+
W,
|
|
411
|
+
"."
|
|
412
|
+
]
|
|
413
|
+
}) : H === "manual" ? /* @__PURE__ */ f("p", {
|
|
414
|
+
className: "text-[10px] text-muted-foreground",
|
|
415
|
+
children: "Enter the exact amount shoppers should see in this currency."
|
|
416
|
+
}) : null
|
|
417
|
+
]
|
|
418
|
+
}, e.code);
|
|
419
|
+
})
|
|
420
|
+
})]
|
|
421
|
+
})
|
|
422
|
+
]
|
|
423
|
+
}),
|
|
424
|
+
/* @__PURE__ */ p(le, {
|
|
425
|
+
className: "bg-slate-50 dark:bg-slate-900/50 -mx-6 -mb-6 p-4 border-t dark:border-slate-800",
|
|
426
|
+
children: [/* @__PURE__ */ f(h, {
|
|
427
|
+
type: "button",
|
|
428
|
+
variant: "ghost",
|
|
429
|
+
onClick: () => k(!1),
|
|
430
|
+
disabled: X,
|
|
431
|
+
children: "Cancel"
|
|
432
|
+
}), /* @__PURE__ */ f(h, {
|
|
433
|
+
type: "submit",
|
|
434
|
+
disabled: X || !I.trim(),
|
|
435
|
+
children: X ? A ? "Saving..." : "Adding..." : A ? "Save Changes" : "Add Rate"
|
|
436
|
+
})]
|
|
437
|
+
})
|
|
438
|
+
]
|
|
439
|
+
})
|
|
440
|
+
})]
|
|
441
|
+
});
|
|
438
442
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
};
|
|
443
|
+
//#endregion
|
|
444
|
+
export { T as RateForm };
|