@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,137 +1,189 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
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
|
-
|
|
1
|
+
import { buildInvoiceDocumentLabels as e } from "../../../invoice-ui.es.js";
|
|
2
|
+
import { InvoiceViewerShell as t } from "../../../components/InvoiceViewerShell.es.js";
|
|
3
|
+
import { getInvoicePresentationData as n } from "../../../invoice-server.es.js";
|
|
4
|
+
import { getOrderDetails as r } from "./actions.es.js";
|
|
5
|
+
import { OrderPrintButton as i } from "./OrderPrintButton.es.js";
|
|
6
|
+
import { OrderStatusForm as a } from "./OrderStatusForm.es.js";
|
|
7
|
+
import o from "next/link";
|
|
8
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
|
+
import { notFound as l } from "next/navigation";
|
|
10
|
+
//#region src/lib/pages/cms/orders/OrderDetailPage.tsx
|
|
11
|
+
var u = (e, t = "usd") => new Intl.NumberFormat("en-US", {
|
|
12
|
+
style: "currency",
|
|
13
|
+
currency: t
|
|
14
|
+
}).format(e / 100);
|
|
15
|
+
async function d({ params: d }) {
|
|
16
|
+
let { id: m } = await d, [h, g] = await Promise.all([r(m), n(m).catch(() => null)]);
|
|
17
|
+
h || l();
|
|
18
|
+
let _ = g?.order.customer_details ?? h.customer_details, v = e((e) => e);
|
|
19
|
+
return /* @__PURE__ */ c("div", {
|
|
20
|
+
className: "mx-auto w-full max-w-6xl px-4 py-10 md:px-6",
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ c("div", {
|
|
23
|
+
className: "flex flex-col gap-4 border-b pb-6 md:flex-row md:items-start md:justify-between",
|
|
24
|
+
children: [/* @__PURE__ */ c("div", { children: [
|
|
25
|
+
/* @__PURE__ */ c("div", {
|
|
26
|
+
className: "mb-2 flex items-center gap-2 text-sm text-gray-500",
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ s(o, {
|
|
29
|
+
href: "/cms/orders",
|
|
30
|
+
className: "hover:underline",
|
|
31
|
+
children: "Orders"
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ s("span", { children: "/" }),
|
|
34
|
+
/* @__PURE__ */ s("span", {
|
|
35
|
+
className: "font-mono",
|
|
36
|
+
children: h.id
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ c("h1", {
|
|
41
|
+
className: "flex flex-wrap items-center gap-3 text-3xl font-bold tracking-tight",
|
|
42
|
+
children: ["Order", /* @__PURE__ */ s(p, {
|
|
43
|
+
status: h.status,
|
|
44
|
+
size: "lg"
|
|
45
|
+
})]
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ s("p", {
|
|
48
|
+
className: "mt-2 text-sm text-muted-foreground",
|
|
49
|
+
children: "Review the finalized invoice, customer details, and payment metadata in one place."
|
|
50
|
+
})
|
|
51
|
+
] }), /* @__PURE__ */ s("div", {
|
|
52
|
+
className: "w-full max-w-md",
|
|
53
|
+
children: /* @__PURE__ */ s(a, {
|
|
54
|
+
orderId: m,
|
|
55
|
+
currentStatus: h.status
|
|
56
|
+
})
|
|
57
|
+
})]
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ c("div", {
|
|
60
|
+
className: "mt-6 grid gap-4 md:grid-cols-2",
|
|
61
|
+
children: [/* @__PURE__ */ c("div", {
|
|
62
|
+
className: "rounded-lg border bg-white p-4 dark:border-slate-800 dark:bg-slate-900",
|
|
63
|
+
children: [/* @__PURE__ */ s("h3", {
|
|
64
|
+
className: "mb-3 text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-500",
|
|
65
|
+
children: "Customer"
|
|
66
|
+
}), /* @__PURE__ */ c("div", {
|
|
67
|
+
className: "space-y-2 text-sm",
|
|
68
|
+
children: [
|
|
69
|
+
_?.name ? /* @__PURE__ */ s("p", {
|
|
70
|
+
className: "font-semibold text-gray-900 dark:text-white",
|
|
71
|
+
children: _.name
|
|
72
|
+
}) : null,
|
|
73
|
+
_?.email ? /* @__PURE__ */ s("p", {
|
|
74
|
+
className: "text-gray-600 dark:text-gray-400",
|
|
75
|
+
children: _.email
|
|
76
|
+
}) : null,
|
|
77
|
+
_?.phone ? /* @__PURE__ */ s("p", {
|
|
78
|
+
className: "text-gray-600 dark:text-gray-400",
|
|
79
|
+
children: _.phone
|
|
80
|
+
}) : null,
|
|
81
|
+
!_?.name && !_?.email && !_?.phone ? /* @__PURE__ */ s("p", {
|
|
82
|
+
className: "italic text-gray-400",
|
|
83
|
+
children: "No contact info captured."
|
|
84
|
+
}) : null,
|
|
85
|
+
h.user_id ? /* @__PURE__ */ c("p", {
|
|
86
|
+
className: "pt-1 font-mono text-[10px] uppercase tracking-wider text-gray-400",
|
|
87
|
+
children: [
|
|
88
|
+
"User ID: ",
|
|
89
|
+
h.user_id.slice(0, 13),
|
|
90
|
+
"..."
|
|
91
|
+
]
|
|
92
|
+
}) : null
|
|
93
|
+
]
|
|
94
|
+
})]
|
|
95
|
+
}), /* @__PURE__ */ c("div", {
|
|
96
|
+
className: "rounded-lg border bg-white p-4 dark:border-slate-800 dark:bg-slate-900",
|
|
97
|
+
children: [/* @__PURE__ */ s("h3", {
|
|
98
|
+
className: "mb-3 text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-500",
|
|
99
|
+
children: "Payment Details"
|
|
100
|
+
}), /* @__PURE__ */ c("div", {
|
|
101
|
+
className: "space-y-2 text-sm",
|
|
102
|
+
children: [
|
|
103
|
+
/* @__PURE__ */ s(f, {
|
|
104
|
+
label: "Provider",
|
|
105
|
+
value: h.provider || "stripe",
|
|
106
|
+
capitalize: !0
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ s(f, {
|
|
109
|
+
label: "Currency",
|
|
110
|
+
value: (h.currency || "usd").toUpperCase()
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ s(f, {
|
|
113
|
+
label: "Created",
|
|
114
|
+
value: new Date(h.created_at || "").toLocaleDateString()
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ s(f, {
|
|
117
|
+
label: "Invoice #",
|
|
118
|
+
value: g?.order.invoice_number || "Pending assignment"
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ s(f, {
|
|
121
|
+
label: "Paid on",
|
|
122
|
+
value: g?.order.paid_at ? new Date(g.order.paid_at).toLocaleString() : "Pending payment"
|
|
123
|
+
}),
|
|
124
|
+
/* @__PURE__ */ s(f, {
|
|
125
|
+
label: "Total",
|
|
126
|
+
value: typeof h.total == "number" ? u(h.total, h.currency || "usd") : "--"
|
|
127
|
+
}),
|
|
128
|
+
h.discount_total ? /* @__PURE__ */ s(f, {
|
|
129
|
+
label: "Discount",
|
|
130
|
+
value: `${h.coupon_code ? `${h.coupon_code} ` : ""}-${u(h.discount_total, h.currency || "usd")}`
|
|
131
|
+
}) : null,
|
|
132
|
+
h.stripe_session_id ? /* @__PURE__ */ c("div", {
|
|
133
|
+
className: "mt-3 border-t pt-3 dark:border-slate-800",
|
|
134
|
+
children: [/* @__PURE__ */ s("p", {
|
|
135
|
+
className: "mb-1 text-xs text-gray-500",
|
|
136
|
+
children: "Session ID"
|
|
137
|
+
}), /* @__PURE__ */ s("p", {
|
|
138
|
+
className: "break-all rounded bg-gray-50 p-1 font-mono text-xs dark:bg-slate-800",
|
|
139
|
+
children: h.stripe_session_id
|
|
140
|
+
})]
|
|
141
|
+
}) : null
|
|
142
|
+
]
|
|
143
|
+
})]
|
|
144
|
+
})]
|
|
145
|
+
}),
|
|
146
|
+
/* @__PURE__ */ s("div", {
|
|
147
|
+
className: "mt-6 flex justify-end print:hidden",
|
|
148
|
+
children: /* @__PURE__ */ s(i, { disabled: !g })
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ s(t, {
|
|
151
|
+
invoice: g,
|
|
152
|
+
labels: v,
|
|
153
|
+
locale: "en-US",
|
|
154
|
+
title: g?.order.invoice_number || "Order invoice",
|
|
155
|
+
description: "Open the printable invoice below and update the order status whenever you need to.",
|
|
156
|
+
printLabel: "Print / Save as PDF",
|
|
157
|
+
action: {
|
|
158
|
+
href: "/cms/orders",
|
|
159
|
+
label: "Back to orders",
|
|
160
|
+
variant: "outline"
|
|
161
|
+
},
|
|
162
|
+
emptyMessage: "The printable invoice will appear here after the order payment metadata is synced.",
|
|
163
|
+
className: "max-w-none px-0 py-6 md:px-0",
|
|
164
|
+
showHeader: !1
|
|
165
|
+
})
|
|
166
|
+
]
|
|
167
|
+
});
|
|
120
168
|
}
|
|
121
|
-
function
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
169
|
+
function f({ label: e, value: t, capitalize: n = !1 }) {
|
|
170
|
+
return /* @__PURE__ */ c("div", {
|
|
171
|
+
className: "flex items-center justify-between gap-3",
|
|
172
|
+
children: [/* @__PURE__ */ s("span", {
|
|
173
|
+
className: "text-gray-500",
|
|
174
|
+
children: e
|
|
175
|
+
}), /* @__PURE__ */ s("span", {
|
|
176
|
+
className: n ? "capitalize font-medium" : "font-medium",
|
|
177
|
+
children: t
|
|
178
|
+
})]
|
|
179
|
+
});
|
|
130
180
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
133
|
-
|
|
181
|
+
function p({ status: e, size: t = "md" }) {
|
|
182
|
+
let n = "bg-gray-100 text-gray-700 dark:bg-slate-800 dark:text-gray-300";
|
|
183
|
+
return e === "paid" && (n = "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"), e === "trial" && (n = "bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300"), e === "pending" && (n = "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400"), e === "shipped" && (n = "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"), e === "cancelled" && (n = "bg-slate-200 text-slate-700 dark:bg-slate-800 dark:text-slate-300"), e === "refunded" && (n = "bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-300"), e === "failed" && (n = "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"), /* @__PURE__ */ s("span", {
|
|
184
|
+
className: `${t === "lg" ? "px-3 py-1 text-sm" : "px-2 py-0.5 text-xs"} rounded-full font-medium capitalize ${n}`,
|
|
185
|
+
children: e
|
|
186
|
+
});
|
|
134
187
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
};
|
|
188
|
+
//#endregion
|
|
189
|
+
export { d as OrderDetailPage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";let e=require("lucide-react"),t=require("react/jsx-runtime"),n=require("@nextblock-cms/ui");function r({disabled:r=!1}){return(0,t.jsxs)(n.Button,{type:`button`,variant:`outline`,onClick:()=>window.print(),disabled:r,children:[(0,t.jsx)(e.Printer,{className:`mr-2 h-4 w-4`}),`Print / Save as PDF`]})}exports.OrderPrintButton=r;
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Button as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/* @__PURE__ */ n(o, { className: "mr-2 h-4 w-4" }),
|
|
15
|
-
"Print / Save as PDF"
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
);
|
|
1
|
+
"use client";
|
|
2
|
+
import { Printer as e } from "lucide-react";
|
|
3
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
|
+
import { Button as r } from "@nextblock-cms/ui";
|
|
5
|
+
//#region src/lib/pages/cms/orders/OrderPrintButton.tsx
|
|
6
|
+
function i({ disabled: i = !1 }) {
|
|
7
|
+
return /* @__PURE__ */ n(r, {
|
|
8
|
+
type: "button",
|
|
9
|
+
variant: "outline",
|
|
10
|
+
onClick: () => window.print(),
|
|
11
|
+
disabled: i,
|
|
12
|
+
children: [/* @__PURE__ */ t(e, { className: "mr-2 h-4 w-4" }), "Print / Save as PDF"]
|
|
13
|
+
});
|
|
19
14
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { i as OrderPrintButton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("./server-actions.cjs");let t=require("react"),n=require("react/jsx-runtime"),r=require("next/navigation"),i=require("@nextblock-cms/ui");var a=[{value:`pending`,label:`Pending`},{value:`trial`,label:`Trial`},{value:`paid`,label:`Paid`},{value:`shipped`,label:`Shipped`},{value:`cancelled`,label:`Cancelled`},{value:`refunded`,label:`Refunded`}];function o({orderId:o,currentStatus:s}){let c=(0,r.useRouter)(),[l,u]=(0,t.useState)(a.some(e=>e.value===s)?s:`pending`),[d,f]=(0,t.useState)(null),[p,m]=(0,t.useTransition)(),h=(0,t.useMemo)(()=>l!==s,[s,l]);return(0,n.jsxs)(`div`,{className:`rounded-lg border bg-white p-4 dark:border-slate-800 dark:bg-slate-900`,children:[(0,n.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end`,children:[(0,n.jsxs)(`div`,{className:`min-w-[220px] flex-1 space-y-2`,children:[(0,n.jsx)(`p`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-500`,children:`Order Status`}),(0,n.jsxs)(i.Select,{value:l,onValueChange:e=>{u(e),f(null)},children:[(0,n.jsx)(i.SelectTrigger,{children:(0,n.jsx)(i.SelectValue,{placeholder:`Select status`})}),(0,n.jsx)(i.SelectContent,{children:a.map(e=>(0,n.jsx)(i.SelectItem,{value:e.value,children:e.label},e.value))})]})]}),(0,n.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,n.jsx)(i.Button,{type:`button`,onClick:()=>{h&&(f(null),m(async()=>{try{let t=await e.updateOrderStatus(o,l);if(!t.success){f(t.error||`Failed to update order status.`);return}c.refresh()}catch(e){console.error(e),f(`Unexpected error while saving the order status.`)}}))},disabled:p||!h,children:p?`Saving...`:`Save`})})]}),d?(0,n.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:d}):h?null:(0,n.jsx)(`p`,{className:`mt-2 text-xs text-slate-500`,children:`Status is already up to date.`})]})}exports.OrderStatusForm=o;
|
|
@@ -1,71 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { updateOrderStatus as e } from "./server-actions.es.js";
|
|
3
|
+
import { useMemo as t, useState as n, useTransition as r } from "react";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import { useRouter as o } from "next/navigation";
|
|
6
|
+
import { Button as s, Select as c, SelectContent as l, SelectItem as u, SelectTrigger as d, SelectValue as f } from "@nextblock-cms/ui";
|
|
7
|
+
//#region src/lib/pages/cms/orders/OrderStatusForm.tsx
|
|
8
|
+
var p = [
|
|
9
|
+
{
|
|
10
|
+
value: "pending",
|
|
11
|
+
label: "Pending"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
value: "trial",
|
|
15
|
+
label: "Trial"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: "paid",
|
|
19
|
+
label: "Paid"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: "shipped",
|
|
23
|
+
label: "Shipped"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: "cancelled",
|
|
27
|
+
label: "Cancelled"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: "refunded",
|
|
31
|
+
label: "Refunded"
|
|
32
|
+
}
|
|
14
33
|
];
|
|
15
|
-
function
|
|
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
|
-
d ? /* @__PURE__ */ l("p", { className: "mt-2 text-xs text-red-600 dark:text-red-400", children: d }) : n ? null : /* @__PURE__ */ l("p", { className: "mt-2 text-xs text-slate-500", children: "Status is already up to date." })
|
|
67
|
-
] });
|
|
34
|
+
function m({ orderId: m, currentStatus: h }) {
|
|
35
|
+
let g = o(), [_, v] = n(p.some((e) => e.value === h) ? h : "pending"), [y, b] = n(null), [x, S] = r(), C = t(() => _ !== h, [h, _]);
|
|
36
|
+
return /* @__PURE__ */ a("div", {
|
|
37
|
+
className: "rounded-lg border bg-white p-4 dark:border-slate-800 dark:bg-slate-900",
|
|
38
|
+
children: [/* @__PURE__ */ a("div", {
|
|
39
|
+
className: "flex flex-col gap-3 sm:flex-row sm:items-end",
|
|
40
|
+
children: [/* @__PURE__ */ a("div", {
|
|
41
|
+
className: "min-w-[220px] flex-1 space-y-2",
|
|
42
|
+
children: [/* @__PURE__ */ i("p", {
|
|
43
|
+
className: "text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-500",
|
|
44
|
+
children: "Order Status"
|
|
45
|
+
}), /* @__PURE__ */ a(c, {
|
|
46
|
+
value: _,
|
|
47
|
+
onValueChange: (e) => {
|
|
48
|
+
v(e), b(null);
|
|
49
|
+
},
|
|
50
|
+
children: [/* @__PURE__ */ i(d, { children: /* @__PURE__ */ i(f, { placeholder: "Select status" }) }), /* @__PURE__ */ i(l, { children: p.map((e) => /* @__PURE__ */ i(u, {
|
|
51
|
+
value: e.value,
|
|
52
|
+
children: e.label
|
|
53
|
+
}, e.value)) })]
|
|
54
|
+
})]
|
|
55
|
+
}), /* @__PURE__ */ i("div", {
|
|
56
|
+
className: "flex items-center gap-2",
|
|
57
|
+
children: /* @__PURE__ */ i(s, {
|
|
58
|
+
type: "button",
|
|
59
|
+
onClick: () => {
|
|
60
|
+
C && (b(null), S(async () => {
|
|
61
|
+
try {
|
|
62
|
+
let t = await e(m, _);
|
|
63
|
+
if (!t.success) {
|
|
64
|
+
b(t.error || "Failed to update order status.");
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
g.refresh();
|
|
68
|
+
} catch (e) {
|
|
69
|
+
console.error(e), b("Unexpected error while saving the order status.");
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
},
|
|
73
|
+
disabled: x || !C,
|
|
74
|
+
children: x ? "Saving..." : "Save"
|
|
75
|
+
})
|
|
76
|
+
})]
|
|
77
|
+
}), y ? /* @__PURE__ */ i("p", {
|
|
78
|
+
className: "mt-2 text-xs text-red-600 dark:text-red-400",
|
|
79
|
+
children: y
|
|
80
|
+
}) : C ? null : /* @__PURE__ */ i("p", {
|
|
81
|
+
className: "mt-2 text-xs text-slate-500",
|
|
82
|
+
children: "Status is already up to date."
|
|
83
|
+
})]
|
|
84
|
+
});
|
|
68
85
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
};
|
|
86
|
+
//#endregion
|
|
87
|
+
export { m as OrderStatusForm };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../../../_virtual/_rolldown/runtime.cjs"),t=require("./actions.cjs"),n=require("./ExportReportsDialog.cjs");let r=require("next/link");r=e.__toESM(r,1);let i=require("react/jsx-runtime");var a=(e,t=`usd`)=>new Intl.NumberFormat(`en-US`,{style:`currency`,currency:t}).format(e/100);async function o({searchParams:e}){let o=await e,c=Number(o.page)||1,l=o.status||`all`,{data:u,totalPages:d}=await t.getOrders(c,l);return(0,i.jsxs)(`div`,{className:`p-6 space-y-6`,children:[(0,i.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,i.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:`Orders`}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(n.ExportReportsDialog,{}),(0,i.jsx)(r.default,{href:`/cms/orders?page=${c}&status=${l}`,className:`px-3 py-2 text-sm font-medium border rounded hover:bg-gray-50 dark:hover:bg-slate-800`,children:`Refresh`})]})]}),(0,i.jsx)(`div`,{className:`flex gap-2 border-b pb-4`,children:[`all`,`paid`,`trial`,`pending`,`failed`].map(e=>(0,i.jsx)(r.default,{href:`/cms/orders?page=1&status=${e}`,className:`px-3 py-1 rounded-full text-sm font-medium capitalize ${l===e?`bg-black text-white dark:bg-white dark:text-black`:`bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-slate-800 dark:text-gray-300 dark:hover:bg-slate-700`}`,children:e},e))}),(0,i.jsx)(`div`,{className:`border rounded-lg overflow-hidden dark:border-slate-800`,children:(0,i.jsxs)(`table`,{className:`w-full text-sm text-left align-middle`,children:[(0,i.jsx)(`thead`,{className:`bg-gray-50 text-gray-500 font-medium border-b dark:bg-slate-900 dark:text-slate-400 dark:border-slate-800`,children:(0,i.jsxs)(`tr`,{children:[(0,i.jsx)(`th`,{className:`px-4 py-3`,children:`ID`}),(0,i.jsx)(`th`,{className:`px-4 py-3`,children:`Customer`}),(0,i.jsx)(`th`,{className:`px-4 py-3`,children:`Status`}),(0,i.jsx)(`th`,{className:`px-4 py-3`,children:`Provider`}),(0,i.jsx)(`th`,{className:`px-4 py-3 text-right`,children:`Amount`}),(0,i.jsx)(`th`,{className:`px-4 py-3 text-right`,children:`Date`}),(0,i.jsx)(`th`,{className:`px-4 py-3 text-right`,children:`Actions`})]})}),(0,i.jsx)(`tbody`,{className:`divide-y dark:divide-slate-800`,children:u.length===0?(0,i.jsx)(`tr`,{children:(0,i.jsx)(`td`,{colSpan:7,className:`px-4 py-8 text-center text-gray-500`,children:`No orders found.`})}):u.map(e=>{let t=e.customer_details,n=t?.name||t?.email||e.customer?.full_name||`Guest Customer`;return(0,i.jsxs)(`tr`,{className:`hover:bg-gray-50 dark:hover:bg-slate-800/50`,children:[(0,i.jsxs)(`td`,{className:`px-4 py-3 font-mono text-gray-500`,children:[e.id.slice(0,8),`...`]}),(0,i.jsx)(`td`,{className:`px-4 py-3 font-medium`,children:n}),(0,i.jsx)(`td`,{className:`px-4 py-3`,children:(0,i.jsx)(s,{status:e.status})}),(0,i.jsx)(`td`,{className:`px-4 py-3 capitalize text-gray-600 dark:text-gray-400`,children:e.provider===`freemius`?`Freemius`:`Stripe`}),(0,i.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,i.jsxs)(`div`,{className:`flex flex-col items-end`,children:[(0,i.jsx)(`span`,{children:a(e.total,e.currency||`usd`)}),e.discount_total?(0,i.jsxs)(`span`,{className:`text-[10px] text-emerald-600`,children:[e.coupon_code,` -`,a(e.discount_total,e.currency||`usd`)]}):null]})}),(0,i.jsx)(`td`,{className:`px-4 py-3 text-right text-gray-500 whitespace-nowrap`,children:new Date(e.created_at||``).toLocaleDateString()}),(0,i.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,i.jsx)(r.default,{href:`/cms/orders/${e.id}`,className:`text-blue-600 hover:underline dark:text-blue-400`,children:`View`})})]},e.id)})})]})}),(0,i.jsxs)(`div`,{className:`flex justify-between items-center pt-4`,children:[(0,i.jsxs)(`div`,{className:`text-sm text-gray-500`,children:[`Page `,c,` of `,d]}),(0,i.jsxs)(`div`,{className:`flex gap-2`,children:[(0,i.jsx)(r.default,{href:`/cms/orders?page=${Math.max(1,c-1)}&status=${l}`,className:`px-3 py-1 border rounded text-sm ${c<=1?`pointer-events-none opacity-50`:`hover:bg-gray-50 dark:hover:bg-slate-800`}`,children:`Previous`}),(0,i.jsx)(r.default,{href:`/cms/orders?page=${Math.min(d,c+1)}&status=${l}`,className:`px-3 py-1 border rounded text-sm ${c>=d?`pointer-events-none opacity-50`:`hover:bg-gray-50 dark:hover:bg-slate-800`}`,children:`Next`})]})]})]})}function s({status:e}){let t=`bg-gray-100 text-gray-700 dark:bg-slate-800 dark:text-gray-300`;return e===`paid`&&(t=`bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400`),e===`trial`&&(t=`bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300`),e===`pending`&&(t=`bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400`),e===`failed`&&(t=`bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400`),(0,i.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium capitalize ${t}`,children:e})}exports.OrdersPage=o;
|