@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,160 +1,157 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { cn as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
] })
|
|
156
|
-
] });
|
|
1
|
+
"use client";
|
|
2
|
+
import { createCategoryAction as e } from "../server-actions.es.js";
|
|
3
|
+
import { useEffect as t, useMemo as n, useState as r } from "react";
|
|
4
|
+
import { Check as i, ChevronsUpDown as a, Loader2 as o, Search as s, X as c } from "lucide-react";
|
|
5
|
+
import { cn as l } from "@nextblock-cms/utils";
|
|
6
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
|
+
import { toast as f } from "sonner";
|
|
8
|
+
import { Badge as p, Button as m, Checkbox as h, Input as g, Popover as _, PopoverContent as v, PopoverTrigger as y } from "@nextblock-cms/ui";
|
|
9
|
+
//#region src/lib/pages/cms/products/components/ProductCategorySelector.tsx
|
|
10
|
+
function b({ categories: b = [], selectedIds: x = [], onChange: S, placeholder: C = "Select categories..." }) {
|
|
11
|
+
let [w, T] = r(!1), [E, D] = r(""), [O, k] = r(b), [A, j] = r(!1);
|
|
12
|
+
t(() => {
|
|
13
|
+
k(b);
|
|
14
|
+
}, [b]);
|
|
15
|
+
let M = n(() => O.filter((e) => x.includes(e.id)), [O, x]), N = n(() => {
|
|
16
|
+
if (!E) return O;
|
|
17
|
+
let e = E.toLowerCase();
|
|
18
|
+
return O.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e));
|
|
19
|
+
}, [O, E]), P = E.trim(), F = n(() => {
|
|
20
|
+
if (!P) return !1;
|
|
21
|
+
let e = P.toLowerCase();
|
|
22
|
+
return !O.some((t) => t.name.toLowerCase() === e);
|
|
23
|
+
}, [O, P]), I = async () => {
|
|
24
|
+
if (P) {
|
|
25
|
+
j(!0);
|
|
26
|
+
try {
|
|
27
|
+
let t = await e({ name: P });
|
|
28
|
+
if (t.success && t.category) {
|
|
29
|
+
let e = {
|
|
30
|
+
id: t.category.id,
|
|
31
|
+
name: t.category.name,
|
|
32
|
+
slug: t.category.slug
|
|
33
|
+
};
|
|
34
|
+
k((t) => [...t, e]), S([...x, e.id]), D(""), f.success(`Category "${e.name}" created successfully.`);
|
|
35
|
+
} else f.error(t.error || "Failed to create category.");
|
|
36
|
+
} catch (e) {
|
|
37
|
+
f.error(e.message || "An error occurred while creating category.");
|
|
38
|
+
} finally {
|
|
39
|
+
j(!1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, L = (e) => {
|
|
43
|
+
S(x.includes(e) ? x.filter((t) => t !== e) : [...x, e]);
|
|
44
|
+
}, R = (e, t) => {
|
|
45
|
+
t.stopPropagation(), S(x.filter((t) => t !== e));
|
|
46
|
+
};
|
|
47
|
+
return /* @__PURE__ */ d("div", {
|
|
48
|
+
className: "space-y-2",
|
|
49
|
+
children: [/* @__PURE__ */ u("div", {
|
|
50
|
+
className: "flex flex-wrap gap-1.5 min-h-[32px] p-1 border rounded-md bg-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
|
|
51
|
+
children: M.length === 0 ? /* @__PURE__ */ u("span", {
|
|
52
|
+
className: "text-xs text-muted-foreground self-center px-2 py-1 select-none",
|
|
53
|
+
children: "No categories selected."
|
|
54
|
+
}) : M.map((e) => /* @__PURE__ */ d(p, {
|
|
55
|
+
variant: "secondary",
|
|
56
|
+
className: "pl-2 pr-1.5 py-0.5 text-xs flex items-center gap-1 bg-amber-500/10 text-amber-800 dark:text-amber-300 border border-amber-500/20 rounded-full",
|
|
57
|
+
children: [e.name, /* @__PURE__ */ u("button", {
|
|
58
|
+
type: "button",
|
|
59
|
+
onClick: (t) => R(e.id, t),
|
|
60
|
+
className: "rounded-full p-0.5 text-muted-foreground hover:bg-amber-500/20 hover:text-amber-950 dark:hover:text-amber-50 transition-colors cursor-pointer",
|
|
61
|
+
"aria-label": `Remove ${e.name}`,
|
|
62
|
+
children: /* @__PURE__ */ u(c, { className: "h-3 w-3" })
|
|
63
|
+
})]
|
|
64
|
+
}, e.id))
|
|
65
|
+
}), /* @__PURE__ */ d(_, {
|
|
66
|
+
open: w,
|
|
67
|
+
onOpenChange: T,
|
|
68
|
+
children: [/* @__PURE__ */ u(y, {
|
|
69
|
+
asChild: !0,
|
|
70
|
+
children: /* @__PURE__ */ d(m, {
|
|
71
|
+
variant: "outline",
|
|
72
|
+
role: "combobox",
|
|
73
|
+
"aria-expanded": w,
|
|
74
|
+
className: "w-full justify-between h-8 text-xs font-normal",
|
|
75
|
+
children: [/* @__PURE__ */ u("span", {
|
|
76
|
+
className: "truncate",
|
|
77
|
+
children: x.length > 0 ? `${x.length} categor${x.length === 1 ? "y" : "ies"} selected` : C
|
|
78
|
+
}), /* @__PURE__ */ u(a, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })]
|
|
79
|
+
})
|
|
80
|
+
}), /* @__PURE__ */ d(v, {
|
|
81
|
+
className: "w-(--radix-popover-trigger-width) p-0",
|
|
82
|
+
align: "start",
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ d("div", {
|
|
85
|
+
className: "flex items-center border-b px-3",
|
|
86
|
+
children: [/* @__PURE__ */ u(s, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }), /* @__PURE__ */ u(g, {
|
|
87
|
+
className: "flex h-9 w-full rounded-md bg-transparent py-2 text-xs outline-none border-0 focus-visible:ring-0 focus-visible:ring-offset-0",
|
|
88
|
+
placeholder: "Search categories...",
|
|
89
|
+
value: E,
|
|
90
|
+
onChange: (e) => D(e.target.value)
|
|
91
|
+
})]
|
|
92
|
+
}),
|
|
93
|
+
F && /* @__PURE__ */ u("div", {
|
|
94
|
+
className: "border-b border-border/50 p-1",
|
|
95
|
+
children: /* @__PURE__ */ d(m, {
|
|
96
|
+
type: "button",
|
|
97
|
+
variant: "ghost",
|
|
98
|
+
size: "sm",
|
|
99
|
+
className: "w-full justify-start text-xs h-8 text-amber-600 dark:text-amber-400 hover:text-amber-700 hover:bg-amber-500/10 cursor-pointer",
|
|
100
|
+
onClick: I,
|
|
101
|
+
disabled: A,
|
|
102
|
+
children: [
|
|
103
|
+
A ? /* @__PURE__ */ u(o, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ u("span", {
|
|
104
|
+
className: "font-bold mr-1.5",
|
|
105
|
+
children: "+"
|
|
106
|
+
}),
|
|
107
|
+
"Create category \"",
|
|
108
|
+
P,
|
|
109
|
+
"\""
|
|
110
|
+
]
|
|
111
|
+
})
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ u("div", {
|
|
114
|
+
className: "max-h-60 overflow-y-auto p-1",
|
|
115
|
+
children: N.length === 0 ? /* @__PURE__ */ u("p", {
|
|
116
|
+
className: "py-4 text-center text-xs text-muted-foreground",
|
|
117
|
+
children: "No categories found."
|
|
118
|
+
}) : /* @__PURE__ */ u("div", {
|
|
119
|
+
className: "flex flex-col gap-0.5",
|
|
120
|
+
children: N.map((e) => {
|
|
121
|
+
let t = x.includes(e.id);
|
|
122
|
+
return /* @__PURE__ */ d("div", {
|
|
123
|
+
onClick: () => L(e.id),
|
|
124
|
+
className: l("relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-xs outline-none hover:bg-accent hover:text-accent-foreground text-left transition-colors", t && "bg-accent/40 font-medium"),
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ u("span", {
|
|
127
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center pointer-events-none",
|
|
128
|
+
children: /* @__PURE__ */ u(h, {
|
|
129
|
+
checked: t,
|
|
130
|
+
tabIndex: -1,
|
|
131
|
+
"aria-label": `Toggle ${e.name}`,
|
|
132
|
+
className: "h-3.5 w-3.5"
|
|
133
|
+
})
|
|
134
|
+
}),
|
|
135
|
+
/* @__PURE__ */ d("span", {
|
|
136
|
+
className: "flex flex-col",
|
|
137
|
+
children: [/* @__PURE__ */ u("span", { children: e.name }), /* @__PURE__ */ d("span", {
|
|
138
|
+
className: "font-mono text-[9px] text-muted-foreground leading-none",
|
|
139
|
+
children: ["/", e.slug]
|
|
140
|
+
})]
|
|
141
|
+
}),
|
|
142
|
+
t && /* @__PURE__ */ u("span", {
|
|
143
|
+
className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
144
|
+
children: /* @__PURE__ */ u(i, { className: "h-3.5 w-3.5 text-primary" })
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
}, e.id);
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
})]
|
|
153
|
+
})]
|
|
154
|
+
});
|
|
157
155
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
};
|
|
156
|
+
//#endregion
|
|
157
|
+
export { b as ProductCategorySelector };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../../../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../../types.cjs"),n=require("../../../../currency.cjs"),r=require("../../../../product-schema.cjs"),i=require("./ProductMediaManager.cjs"),a=require("./SyncFreemiusPricingButton.cjs"),o=require("./CurrencyPriceFields.cjs"),s=require("./SaleScheduleFields.cjs"),c=require("../product-price-sync.cjs"),ee=require("./VariationsEditor.cjs"),l=require("./ProductCategorySelector.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("lucide-react"),f=require("@nextblock-cms/utils"),p=require("react/jsx-runtime"),te=require("react-hook-form"),ne=require("@hookform/resolvers/zod"),m=require("@nextblock-cms/ui");function h({title:e,description:t,action:n,children:r,hideHeader:i}){return(0,p.jsxs)(`section`,{className:`rounded-lg border bg-card p-3 shadow-sm space-y-3`,children:[!i&&(0,p.jsxs)(`div`,{className:`flex items-start justify-between gap-4 flex-wrap border-b border-muted/50 pb-2 mb-1`,children:[(0,p.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,p.jsx)(`h2`,{className:`text-sm font-bold tracking-tight`,children:e}),t?(0,p.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-none`,children:t}):null]}),n]}),(0,p.jsx)(`div`,{className:i?``:`pt-1`,children:r})]})}function re(e,t,n){let r=t?Number.parseInt(t,10):void 0;return e?.language_id||(Number.isFinite(r)?r:void 0)||n.find(e=>e.is_default)?.id||n[0]?.id||1}function g(e,n,r,i,a){let o=(i.find(e=>e.is_default)??i[0])?.code||`USD`,s=e?.prices&&Object.keys(e.prices).length>0?e.prices:{[o]:typeof e?.price==`number`?e.price/100:0},ee=e?.sale_prices&&Object.keys(e.sale_prices).length>0?e.sale_prices:typeof e?.sale_price==`number`?{[o]:e.sale_price/100}:{},l=e?.product_type||``,u=e?.payment_provider||(e?.product_type?t.derivePaymentProviderFromProductType(e.product_type):`stripe`);return{...c.sanitizeProductFormValuesForStoreManagedCurrencies({product_type:l||`physical`,payment_provider:u,title:e?.title||``,slug:e?.slug||``,sku:e?.sku||``,upc:e?.upc||``,is_taxable:e?.is_taxable??!0,price:typeof e?.price==`number`?e.price/100:0,prices:s,sale_price:typeof e?.sale_price==`number`?e.sale_price/100:null,sale_prices:ee,stock:e?.stock||0,meta_title:e?.meta_title||``,meta_description:e?.meta_description||``,custom_canonical:e?.custom_canonical||``,short_description:e?.short_description||``,description_json:e?.description_json||{type:`doc`,content:[{type:`paragraph`}]},freemius_product_id:e?.freemius_product_id||``,freemius_plan_id:e?.freemius_plan_id||``,trial_period_days:e?.trial_period_days??0,trial_requires_payment_method:e?.trial_requires_payment_method??!1,status:e?.status||`draft`,language_id:re(e,n,r),translation_group_id:e?.translation_group_id||a||void 0,product_media:e?.product_media?.map(e=>({media_id:e.media_id}))||[],category_ids:e?.category_ids||[],variation_attributes:e?.variation_attributes||[],variants:e?.variants?.map(e=>({...e,prices:e.prices||{},sale_prices:e.sale_prices||{}}))||[]},i),product_type:l,payment_provider:u}}function ie(e){return e?e.map(e=>({id:e.id||e.media_id,media_id:e.media_id,file_path:e.media?.file_path||e.media?.object_key||``,alt:e.media?.alt_text||``,sort_order:e.sort_order??0})).sort((e,t)=>e.sort_order-t.sort_order):[]}function ae(e){return e.map(e=>({media_id:e.media_id}))}function oe(e){return e.map(e=>({media_id:e.media_id,file_path:e.file_path,alt:e.alt}))}var se=e=>e.toString().toLowerCase().trim().replace(/\s+/g,`-`).replace(/[^\w-]+/g,``).replace(/--+/g,`-`).replace(/^-+/,``).replace(/-+$/,``);function _({initialData:e,isEdit:t=!1,mediaPickerNode:re,availableLanguagesProp:_,globalAttributesProp:ce,currenciesProp:le,translationGroupId:v,targetLanguageId:y,freemiusDashboardNode:b,enabledProviders:ue,configStatus:x,createAction:S,updateAction:de,availableCategoriesProp:fe=[],hasOpenDraft:pe=!1,onSeoChange:me}){let[C,w]=(0,u.useState)(!1),[T,E]=(0,u.useState)(()=>!!e?.variants?.length),D=u.default.useMemo(()=>le.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),[le]),O=u.default.useMemo(()=>D.find(e=>e.is_default)??D[0],[D]),k=u.default.useMemo(()=>c.getStoreManagedPriceCurrencyCodes(D),[D]),he=(0,te.useForm)({resolver:(0,ne.zodResolver)(r.productSchema),defaultValues:g(e,y,_,D,v)}),{register:A,handleSubmit:j,setValue:M,reset:ge,watch:N,setError:P,formState:{errors:F,dirtyFields:I}}=he,L=(0,u.useRef)(!0),R=(0,u.useRef)(null),[_e,z]=(0,u.useState)(!1),[ve,B]=(0,u.useState)(null),[ye,be]=(0,u.useState)(null),V=N(),xe=he.formState.isDirty,Se=V.title,Ce=V.meta_title,we=V.meta_description;(0,u.useEffect)(()=>{me?.({title:Se,meta_title:Ce,meta_description:we})},[Se,Ce,we,me]),(0,u.useEffect)(()=>{if(!t)return;if(L.current){L.current=!1,R.current=JSON.stringify(V);return}if(!xe)return;let e=JSON.stringify(V);if(e===R.current)return;let n=setTimeout(()=>{C||(R.current=e,j(He)())},400);return()=>clearTimeout(n)},[V,t,xe,C,j]);let Te=N(`title`),H=N(`product_type`),U=H===`digital`?`freemius`:H===`physical`?`stripe`:void 0,W=H===`physical`,Ee=H===`digital`,De=U?ue[U]:!1,Oe=U?x[U].hasKeys:!1,ke=!!N(`freemius_product_id`),Ae=Number(N(`trial_period_days`)||0),je=!!N(`trial_requires_payment_method`),Me=N(`variants`)||[],G=N(`price`),K=N(`sale_price`),q=N(`prices`)||{},J=N(`sale_prices`)||{},Y=(Me?.length||0)>0,Ne=N(`language_id`),Pe=_.find(e=>e.id===Ne)?.code||_.find(e=>e.is_default)?.code||_[0]?.code,X=u.default.useMemo(()=>c.resolveEditorCurrencyPriceMaps({currencies:D,prices:q,salePrices:J,fallbackPrice:G,fallbackSalePrice:K}),[G,K,D,q,J]),Fe=u.default.useMemo(()=>e?.variants?.map(e=>({...e,prices:e.prices||{},sale_prices:e.sale_prices||{}})),[e?.variants]);(0,u.useEffect)(()=>{if(I.title&&!t){let e=se(Te);M(`slug`,e,{shouldValidate:!0})}},[Te,I.title,M,t]);let[Z,Ie]=(0,u.useState)(()=>ie(e?.product_media)),[Q,$]=(0,u.useState)(new Set);(0,u.useEffect)(()=>{ge(g(e,y,_,D,v)),Ie(ie(e?.product_media)),$(new Set),E(!!e?.variants?.length)},[_,D,e,ge,y,v]);let Le=e=>{let t=new Set(e.map(e=>e.id)),n=Z.filter(e=>!t.has(e.id)),r=new Set(Q);n.forEach(e=>{e.media_id&&r.add(e.media_id)}),$(r),Ie(e),M(`product_media`,ae(e),{shouldDirty:!0}),M(`explicitly_removed_media_ids`,Array.from(r),{shouldDirty:!0})};(0,u.useEffect)(()=>{M(`explicitly_removed_media_ids`,Array.from(Q))},[Q,M]),(0,u.useEffect)(()=>{Y&&E(!0)},[Y]),(0,u.useEffect)(()=>{A(`is_taxable`),A(`price`),A(`sale_price`),A(`payment_provider`),A(`trial_requires_payment_method`)},[A]),(0,u.useEffect)(()=>{if(!Ee){M(`trial_period_days`,0,{shouldDirty:!1,shouldValidate:!0}),M(`trial_requires_payment_method`,!1,{shouldDirty:!1,shouldValidate:!0});return}Ae<=0&&M(`trial_requires_payment_method`,!1,{shouldDirty:!1,shouldValidate:!0})},[Ee,M,Ae]),(0,u.useEffect)(()=>{U&&M(`payment_provider`,U,{shouldDirty:!1,shouldValidate:!0})},[U,M]),(0,u.useEffect)(()=>{O&&q[O.code]===void 0&&M(`prices`,{...q,[O.code]:G||0},{shouldDirty:!1})},[G,O,q,M]);let Re=(0,u.useCallback)((e,t)=>{let n={...q,[e]:t};M(`prices`,n,{shouldDirty:!0,shouldValidate:!0}),e===O?.code&&M(`price`,t,{shouldDirty:!0,shouldValidate:!0})},[O?.code,q,M]),ze=(0,u.useCallback)((e,t)=>{let n={...J,[e]:t};M(`sale_prices`,n,{shouldDirty:!0,shouldValidate:!0}),e===O?.code&&M(`sale_price`,t,{shouldDirty:!0,shouldValidate:!0})},[O?.code,J,M]),Be=(0,u.useCallback)(()=>{if(!O)return;let e=new Set(k),t=q[O.code]??G??0,r=J[O.code]??K??null,i=D.reduce((r,i)=>{if(i.code!==O.code&&e.has(i.code))return r;let a=n.convertMinorUnitAmount({amount:(0,f.majorUnitAmountToMinor)(t,O.code),fromCurrencyCode:O.code,toCurrencyCode:i.code,currencies:D,applyRounding:!0});return r[i.code]=(0,f.minorUnitAmountToMajor)(a,i.code),r},{}),a=D.reduce((t,i)=>{if(i.code!==O.code&&e.has(i.code))return t;if(typeof r!=`number`)return(i.code===O.code||!e.has(i.code))&&(t[i.code]=null),t;let a=n.convertMinorUnitAmount({amount:(0,f.majorUnitAmountToMinor)(r,O.code),fromCurrencyCode:O.code,toCurrencyCode:i.code,currencies:D,applyRounding:!0});return t[i.code]=(0,f.minorUnitAmountToMajor)(a,i.code),t},{});M(`prices`,i,{shouldDirty:!0,shouldValidate:!0}),M(`sale_prices`,a,{shouldDirty:!0,shouldValidate:!0}),M(`price`,i[O.code]??t,{shouldDirty:!0,shouldValidate:!0}),M(`sale_price`,a[O.code]??null,{shouldDirty:!0,shouldValidate:!0})},[D,O,q,J,M,k,G,K]),Ve=(0,u.useCallback)(({variationAttributes:e,variants:t})=>{M(`variation_attributes`,e,{shouldDirty:!0}),M(`variants`,t,{shouldDirty:!0,shouldValidate:!0})},[M]),He=async e=>{w(!0),z(!0),B(null);try{if(!U){let e=`Select whether this product is physical or digital before saving.`;P(`product_type`,{type:`manual`,message:e}),t?B(e):alert(e),w(!1),z(!1);return}let n=W?0:Math.max(0,Number(e.trial_period_days||0)),r={...e,product_type:e.product_type,payment_provider:U,freemius_product_id:W?``:e.freemius_product_id,freemius_plan_id:W?``:e.freemius_plan_id,trial_period_days:n,trial_requires_payment_method:!W&&n>0&&e.trial_requires_payment_method,upc:W?e.upc:null,is_taxable:W?e.is_taxable:!1,variation_attributes:W?e.variation_attributes:[],variants:W?e.variants:[]},i=c.sanitizeProductFormValuesForStoreManagedCurrencies(r,D);if(t&&de)await de(i),be(new Date);else if(S)await S(i);else throw Error(`Product form action is not configured.`)}catch(e){if(console.error(e),e.message===`NEXT_REDIRECT`)return;let n=e.message||`An error occurred while saving.`;if(e.code===`23505`){let t=e.message?.toLowerCase()||``;t.includes(`products_slug_key`)||t.includes(`slug`)?(n=`This slug is already in use. Please choose another one.`,P(`slug`,{type:`manual`,message:n})):(t.includes(`products_sku_key`)||t.includes(`sku`))&&(n=`This SKU is already in use.`,P(`sku`,{type:`manual`,message:n}))}t?B(n):alert(n)}finally{w(!1),z(!1)}},Ue=Y?`bg-muted/60 text-muted-foreground opacity-70`:``,We=oe(Z);return(0,p.jsxs)(`form`,{onSubmit:j(He),className:`space-y-2.5 pb-4`,children:[(0,p.jsx)(`input`,{type:`hidden`,...A(`translation_group_id`)}),(0,p.jsx)(`input`,{type:`hidden`,...A(`payment_provider`)}),(0,p.jsxs)(`div`,{className:`space-y-2.5 w-full`,children:[(0,p.jsxs)(`div`,{className:`rounded-lg border bg-card p-2.5 px-4 shadow-sm flex items-center justify-between gap-3 flex-wrap`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,p.jsxs)(`div`,{className:`flex h-9 items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`text-sm font-bold whitespace-nowrap leading-none pt-0.5`,children:`Product Type`}),F.product_type&&(0,p.jsx)(d.AlertCircle,{className:`h-4 w-4 text-destructive`})]}),(0,p.jsx)(`div`,{className:`flex h-9 items-center`,children:(0,p.jsxs)(m.Select,{onValueChange:e=>M(`product_type`,e,{shouldDirty:!0,shouldValidate:!0}),value:H||void 0,children:[(0,p.jsx)(m.SelectTrigger,{className:`w-[160px] h-9 text-xs`,children:(0,p.jsx)(m.SelectValue,{placeholder:`Select Type`})}),(0,p.jsxs)(m.SelectContent,{children:[(0,p.jsx)(m.SelectItem,{value:`physical`,children:`Physical Product`}),(0,p.jsx)(m.SelectItem,{value:`digital`,children:`Digital Product`})]})]})})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,p.jsxs)(`div`,{className:`flex h-9 items-center gap-3`,children:[(0,p.jsx)(`span`,{className:`text-[11px] font-semibold text-muted-foreground uppercase tracking-wider leading-none`,children:`Payment Provider`}),(0,p.jsx)(m.Badge,{variant:`outline`,className:`text-xs py-1 font-bold bg-muted/30 leading-none`,children:U?U===`stripe`?`Stripe`:`Freemius`:`—`})]}),U&&(0,p.jsx)(`div`,{className:`flex h-9 items-center gap-2`,children:De&&Oe?(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5 text-emerald-600 text-[10px] font-bold bg-emerald-50 px-2 py-1 rounded-full border border-emerald-100 uppercase leading-none`,children:[(0,p.jsx)(d.CheckCircle2,{className:`h-3 w-3`}),`Ready`]}):(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5 text-amber-600 text-[10px] font-bold bg-amber-50 px-2 py-1 rounded-full border border-amber-100 uppercase leading-none`,children:[(0,p.jsx)(d.AlertCircle,{className:`h-3 w-3`}),De?`Keys Missing`:`Disabled`]})}),!Oe&&U&&x[U].missing.length>0&&(0,p.jsxs)(`a`,{href:`/cms/payments`,className:`hidden xl:flex h-9 items-center gap-1 text-[10px] text-muted-foreground bg-muted/50 px-2 py-1 rounded border border-dashed leading-none hover:text-foreground hover:border-solid`,children:[(0,p.jsx)(d.Info,{className:`h-3 w-3`}),`Missing: `,x[U].missing.join(`, `),` — set up payments`]})]})]}),(0,p.jsxs)(h,{title:`Product Information`,hideHeader:!0,children:[t&&(0,p.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground pb-2 border-b border-border/40 mb-2.5`,children:[(0,p.jsx)(`span`,{className:`font-semibold text-[11px] uppercase tracking-wider text-muted-foreground/80`,children:`Product Settings`}),(0,p.jsx)(`div`,{className:`flex items-center gap-1.5 min-h-[16px]`,children:_e?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`relative flex h-2 w-2`,children:[(0,p.jsx)(`span`,{className:`animate-ping absolute inline-flex h-full w-full rounded-full bg-amber-400 opacity-75`}),(0,p.jsx)(`span`,{className:`relative inline-flex rounded-full h-2 w-2 bg-amber-500`})]}),(0,p.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400 font-medium`,children:`Autosaving settings...`})]}):ve?(0,p.jsxs)(`span`,{className:`text-red-500 font-medium`,children:[`Error saving settings: `,ve]}):ye?(0,p.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-400 font-medium`,children:[`Settings autosaved at `,ye.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})]}):(0,p.jsx)(`span`,{className:`text-muted-foreground/60`,children:`Settings autosave in draft mode`})})]}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-2.5`,children:[(0,p.jsxs)(`div`,{className:`col-span-2 space-y-1`,children:[(0,p.jsx)(m.Label,{htmlFor:`title`,className:`text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none`,children:`Title`}),(0,p.jsx)(m.Input,{id:`title`,placeholder:`Product title`,...A(`title`),className:`h-8 text-sm`}),F.title&&(0,p.jsx)(`p`,{className:`text-destructive text-[11px] leading-none`,children:F.title.message})]}),(0,p.jsxs)(`div`,{className:`col-span-2 space-y-1`,children:[(0,p.jsx)(m.Label,{htmlFor:`slug`,className:`text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none`,children:`Slug`}),(0,p.jsx)(m.Input,{id:`slug`,placeholder:`product-slug`,...A(`slug`),className:`h-8 text-sm`}),F.slug&&(0,p.jsx)(`p`,{className:`text-destructive text-[11px] leading-none`,children:F.slug.message})]}),(0,p.jsxs)(`div`,{className:`col-span-1 space-y-1`,children:[(0,p.jsx)(m.Label,{htmlFor:`sku`,className:`text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none`,children:`SKU`}),(0,p.jsx)(m.Input,{id:`sku`,placeholder:`SKU`,...A(`sku`),className:`h-8 text-sm font-mono`}),F.sku&&(0,p.jsx)(`p`,{className:`text-destructive text-[11px] leading-none`,children:F.sku.message})]}),(0,p.jsxs)(`div`,{className:`col-span-1 space-y-1`,children:[(0,p.jsx)(m.Label,{htmlFor:`upc_ean`,className:`text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none`,children:`UPC / EAN`}),(0,p.jsx)(m.Input,{id:`upc_ean`,placeholder:`000000000`,...A(`upc`),className:`h-8 text-sm font-mono`,readOnly:Y})]})]}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-12 gap-2.5 mt-2`,children:[(0,p.jsxs)(`div`,{className:`${t?`lg:col-span-3`:`lg:col-span-4`} col-span-2 space-y-1`,children:[(0,p.jsx)(m.Label,{htmlFor:`meta_title`,className:`text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none`,children:`Meta Title`}),(0,p.jsx)(m.Input,{id:`meta_title`,...A(`meta_title`),placeholder:`SEO page title (50-60 chars)`,className:`h-8 text-sm`})]}),(0,p.jsxs)(`div`,{className:`lg:col-span-4 col-span-2 space-y-1`,children:[(0,p.jsx)(m.Label,{htmlFor:`meta_description`,className:`text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none`,children:`Meta Description`}),(0,p.jsx)(m.Input,{id:`meta_description`,...A(`meta_description`),placeholder:`SEO description (150-160 chars)`,className:`h-8 text-sm`})]}),(0,p.jsxs)(`div`,{className:`${t?`lg:col-span-3`:`lg:col-span-4`} col-span-2 space-y-1`,children:[(0,p.jsx)(m.Label,{htmlFor:`custom_canonical`,className:`text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none`,children:`Canonical URL (optional)`}),(0,p.jsx)(m.Input,{id:`custom_canonical`,...A(`custom_canonical`),placeholder:`Blank = self-referencing. Absolute https://… URL or /relative path to override.`,className:`h-8 text-sm`})]})]})]}),(0,p.jsx)(h,{title:`Product Categories`,description:`Assign this product to one or more categories.`,children:(0,p.jsx)(l.ProductCategorySelector,{categories:fe,selectedIds:N(`category_ids`)||[],onChange:e=>M(`category_ids`,e,{shouldDirty:!0,shouldValidate:!0})})}),(0,p.jsxs)(`section`,{className:`rounded-lg border bg-card p-3 shadow-sm space-y-3`,children:[W&&(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-4 flex-wrap border-b border-muted/50 pb-2`,children:[(0,p.jsx)(`div`,{className:`flex items-center gap-4`,children:(0,p.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,p.jsx)(`h2`,{className:`text-sm font-bold tracking-tight`,children:`Pricing & Inventory`}),(0,p.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-none`,children:`Manage simple or variant pricing.`})]})}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/40 rounded-md px-2.5 py-1.5`,children:[(0,p.jsx)(`span`,{className:`text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none`,children:`Stock`}),(0,p.jsx)(m.Input,{id:`stock`,type:`number`,min:`0`,...A(`stock`,{valueAsNumber:!0}),placeholder:`0`,readOnly:Y,className:`${Ue} h-8 w-20 text-sm text-center font-mono bg-background`})]}),Y?(0,p.jsx)(m.Badge,{variant:`secondary`,className:`text-[11px] py-0 px-2 h-5`,children:`Variant pricing`}):null]})]}),W?(0,p.jsxs)(`div`,{className:`space-y-3`,children:[(0,p.jsxs)(`div`,{className:`w-full`,children:[(0,p.jsx)(o.CurrencyPriceFields,{idPrefix:`product`,currencies:D,prices:X.prices,salePrices:X.salePrices,managedCurrencyCodes:k,onPriceChange:Re,onSalePriceChange:ze,onAutoFill:Be,readOnly:Y,helperText:Y?`Parent prices stay as a fallback, but active variants define the live shopper price.`:void 0,trailing:(0,p.jsx)(s.SaleScheduleFields,{idPrefix:`product`,startAt:N(`sale_start_at`),endAt:N(`sale_end_at`),onChange:(e,t)=>M(e,t,{shouldDirty:!0,shouldValidate:!0}),error:F.sale_end_at?.message,bare:!0})}),F.price&&(0,p.jsx)(`p`,{className:`text-destructive text-sm mt-1`,children:F.price.message}),F.sale_price&&(0,p.jsx)(`p`,{className:`text-destructive text-sm mt-1`,children:F.sale_price.message}),F.stock&&(0,p.jsx)(`p`,{className:`text-destructive text-[10px] font-medium leading-none mt-1`,children:F.stock.message})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded border border-dashed p-2.5 bg-muted/5`,children:[(0,p.jsx)(`span`,{className:`text-xs font-bold uppercase tracking-wider text-muted-foreground`,children:Y?`Variations Active`:`Variations`}),(0,p.jsx)(m.Button,{type:`button`,variant:T?`outline`:`default`,onClick:()=>E(e=>!e),size:`sm`,className:`h-7 text-xs px-3`,children:T?`Hide`:`Manage`})]}),T&&(0,p.jsx)(`div`,{className:`border-t pt-3`,children:(0,p.jsx)(ee.VariationsEditor,{globalAttributes:ce,currentLanguageCode:Pe,baseSku:N(`sku`)||``,basePrice:G||0,basePrices:q,baseSalePrice:typeof K==`number`?K:null,baseSalePrices:J,currencies:D,availableVariantImages:We,initialVariationAttributes:e?.variation_attributes,initialVariants:Fe,onChange:Ve})})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsxs)(`div`,{className:`flex items-end gap-4 w-full`,children:[(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(m.Label,{htmlFor:`freemius_product_id`,className:`text-[11px] uppercase tracking-wider text-muted-foreground font-bold mb-1.5 block`,children:`Freemius Product ID`}),(0,p.jsx)(m.Input,{id:`freemius_product_id`,...A(`freemius_product_id`),className:`h-9`})]}),(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(m.Label,{htmlFor:`freemius_plan_id`,className:`text-[11px] uppercase tracking-wider text-muted-foreground font-bold mb-1.5 block`,children:`Freemius Plan ID`}),(0,p.jsx)(m.Input,{id:`freemius_plan_id`,...A(`freemius_plan_id`),className:`h-9`})]}),ke?(0,p.jsx)(a.SyncFreemiusPricingButton,{productId:N(`freemius_product_id`),hasOpenDraft:pe}):null]}),(0,p.jsxs)(`div`,{className:`bg-muted/10 border rounded-md overflow-hidden`,children:[(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center gap-6 bg-muted/20 border-b p-2.5 px-4`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`text-[11px] font-bold uppercase tracking-wider text-muted-foreground`,children:`Free Trial`}),(0,p.jsxs)(m.Badge,{variant:`outline`,className:`font-mono text-xs shadow-sm bg-background`,children:[String(N(`trial_period_days`)||0),` Days`]})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`text-[11px] font-bold uppercase tracking-wider text-muted-foreground`,children:`Card Required`}),(0,p.jsx)(m.Badge,{variant:je?`default`:`secondary`,className:`text-xs shadow-sm`,children:je?`Yes`:`No`})]}),(0,p.jsx)(`span`,{className:`text-[10px] text-muted-foreground ml-auto`,children:`Managed in Freemius dashboard`}),(0,p.jsx)(`input`,{type:`hidden`,...A(`trial_period_days`,{valueAsNumber:!0})})]}),(0,p.jsxs)(`div`,{className:`w-full p-4 pt-3 space-y-2`,children:[(0,p.jsx)(o.CurrencyPriceFields,{idPrefix:`product`,currencies:D,prices:X.prices,salePrices:X.salePrices,managedCurrencyCodes:k,onPriceChange:Re,onSalePriceChange:ze,onAutoFill:Be,readOnly:!0,trailing:(0,p.jsx)(s.SaleScheduleFields,{idPrefix:`product`,startAt:N(`sale_start_at`),endAt:N(`sale_end_at`),onChange:(e,t)=>M(e,t,{shouldDirty:!0,shouldValidate:!0}),error:F.sale_end_at?.message,bare:!0})}),(0,p.jsx)(`p`,{className:`text-[10px] leading-snug text-muted-foreground`,children:`Scheduling a sale on a Freemius product generates a time-bounded Freemius coupon so the discount is enforced at Freemius checkout.`})]})]})]}),b&&(0,p.jsx)(`div`,{className:`pt-2 border-t`,children:b})]})]}),(0,p.jsx)(h,{title:`Product Description`,hideHeader:!0,children:(0,p.jsx)(`div`,{className:`space-y-2`,children:(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsx)(m.Label,{htmlFor:`short_description`,className:`text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none`,children:`Short Description`}),(0,p.jsx)(m.Input,{id:`short_description`,...A(`short_description`),placeholder:`Brief summary for product cards...`,className:`h-8 text-sm`})]})})}),(0,p.jsxs)(h,{title:`Media Gallery`,description:`Drag to reorder. First image is the hero.`,children:[(0,p.jsx)(i.ProductMediaManager,{initialMedia:Z,onUpdate:Le,mediaPickerNode:re}),(0,p.jsx)(`input`,{type:`hidden`,...A(`product_media`)})]}),!t&&(0,p.jsxs)(`div`,{className:`rounded-lg border bg-card p-3 px-4 shadow-sm flex items-center justify-between gap-3 flex-wrap`,children:[(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`New products start as a draft. Publish it from the top bar once it's ready.`}),(0,p.jsx)(m.Button,{disabled:C,type:`submit`,size:`sm`,className:`h-8 text-sm px-5`,children:C?`Saving...`:`Save Changes`})]})]})]})}exports.ProductForm=_;
|