@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../../payment-config.cjs"),t=require("./queries.cjs"),n=require("./actions.cjs"),r=require("./PaymentsClient.cjs");let i=require("react/jsx-runtime");async function a(){let[a,o,s]=await Promise.all([t.getEnabledPaymentProviders(),t.getStoreConfigStatus(),e.getPaymentCredentialsView()]);async function c(e){"use server";let t={stripe:e.get(`stripe_enabled`)===`true`&&o.stripe.hasKeys,freemius:e.get(`freemius_enabled`)===`true`&&o.freemius.hasKeys};await n.updatePaymentSettings(t)}return(0,i.jsx)(r.PaymentsClient,{initialEnabledProviders:a,configStatus:o,credentials:s,saveAction:c,saveCredentialsAction:n.savePaymentProviderCredentials})}exports.PaymentsPage=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function PaymentsPage(): Promise<import(
|
|
1
|
+
export declare function PaymentsPage(): Promise<import('react').JSX.Element>;
|
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
);
|
|
1
|
+
import { getPaymentCredentialsView as e } from "../../../payment-config.es.js";
|
|
2
|
+
import { getEnabledPaymentProviders as t, getStoreConfigStatus as n } from "./queries.es.js";
|
|
3
|
+
import { savePaymentProviderCredentials as r, updatePaymentSettings as i } from "./actions.es.js";
|
|
4
|
+
import { PaymentsClient as a } from "./PaymentsClient.es.js";
|
|
5
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
6
|
+
//#region src/lib/pages/cms/payments/PaymentsPage.tsx
|
|
7
|
+
async function s() {
|
|
8
|
+
let [s, c, l] = await Promise.all([
|
|
9
|
+
t(),
|
|
10
|
+
n(),
|
|
11
|
+
e()
|
|
12
|
+
]);
|
|
13
|
+
async function u(e) {
|
|
14
|
+
"use server";
|
|
15
|
+
let t = {
|
|
16
|
+
stripe: e.get("stripe_enabled") === "true" && c.stripe.hasKeys,
|
|
17
|
+
freemius: e.get("freemius_enabled") === "true" && c.freemius.hasKeys
|
|
18
|
+
};
|
|
19
|
+
await i(t);
|
|
20
|
+
}
|
|
21
|
+
return /* @__PURE__ */ o(a, {
|
|
22
|
+
initialEnabledProviders: s,
|
|
23
|
+
configStatus: c,
|
|
24
|
+
credentials: l,
|
|
25
|
+
saveAction: u,
|
|
26
|
+
saveCredentialsAction: r
|
|
27
|
+
});
|
|
30
28
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { s as PaymentsPage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use server";const e=require("../../../payment-config.cjs");let t=require("@nextblock-cms/db/server"),n=require("next/cache");async function r(){let e=await(0,t.createClient)(),{data:{user:n}}=await e.auth.getUser();if(!n)throw Error(`Unauthorized`);let{data:r}=await e.from(`profiles`).select(`role`).eq(`id`,n.id).single();if(!r||r.role!==`ADMIN`)throw Error(`Forbidden`)}async function i(t){await r(),await e.savePaymentCredentials({stripe:{publishableKey:String(t.get(`stripe_publishableKey`)??``),secretKey:String(t.get(`stripe_secretKey`)??``),webhookSecret:String(t.get(`stripe_webhookSecret`)??``)},freemius:{developerId:String(t.get(`freemius_developerId`)??``),publicKey:String(t.get(`freemius_publicKey`)??``),productId:String(t.get(`freemius_productId`)??``),secretKey:String(t.get(`freemius_secretKey`)??``),apiKey:String(t.get(`freemius_apiKey`)??``)}}),(0,n.revalidatePath)(`/cms/payments`),(0,n.revalidatePath)(`/cms/dashboard`),(0,n.revalidatePath)(`/`,`layout`)}async function a(e){let r=await(0,t.createClient)(),{data:{user:i}}=await r.auth.getUser();if(!i)throw Error(`Unauthorized`);let{data:a}=await r.from(`profiles`).select(`role`).eq(`id`,i.id).single();if(!a||a.role!==`ADMIN`)throw Error(`Forbidden`);let{error:o}=await r.from(`site_settings`).upsert({key:`enabled_payment_providers`,value:e});if(o)throw console.error(`Error updating payment providers:`,o),Error(`Failed to update settings`);return(0,n.revalidatePath)(`/cms/payments`),(0,n.revalidatePath)(`/cms/taxes`),(0,n.revalidatePath)(`/`,`layout`),{success:!0}}exports.savePaymentProviderCredentials=i,exports.updatePaymentSettings=a;
|
|
@@ -1,51 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const { data: i } = await e.from("profiles").select("role").eq("id", r.id).single();
|
|
12
|
-
if (!i || i.role !== "ADMIN")
|
|
13
|
-
throw new Error("Forbidden");
|
|
1
|
+
"use server";
|
|
2
|
+
import { savePaymentCredentials as e } from "../../../payment-config.es.js";
|
|
3
|
+
import { createClient as t } from "@nextblock-cms/db/server";
|
|
4
|
+
import { revalidatePath as n } from "next/cache";
|
|
5
|
+
//#region src/lib/pages/cms/payments/actions.ts
|
|
6
|
+
async function r() {
|
|
7
|
+
let e = await t(), { data: { user: n } } = await e.auth.getUser();
|
|
8
|
+
if (!n) throw Error("Unauthorized");
|
|
9
|
+
let { data: r } = await e.from("profiles").select("role").eq("id", n.id).single();
|
|
10
|
+
if (!r || r.role !== "ADMIN") throw Error("Forbidden");
|
|
14
11
|
}
|
|
15
|
-
async function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
12
|
+
async function i(t) {
|
|
13
|
+
await r(), await e({
|
|
14
|
+
stripe: {
|
|
15
|
+
publishableKey: String(t.get("stripe_publishableKey") ?? ""),
|
|
16
|
+
secretKey: String(t.get("stripe_secretKey") ?? ""),
|
|
17
|
+
webhookSecret: String(t.get("stripe_webhookSecret") ?? "")
|
|
18
|
+
},
|
|
19
|
+
freemius: {
|
|
20
|
+
developerId: String(t.get("freemius_developerId") ?? ""),
|
|
21
|
+
publicKey: String(t.get("freemius_publicKey") ?? ""),
|
|
22
|
+
productId: String(t.get("freemius_productId") ?? ""),
|
|
23
|
+
secretKey: String(t.get("freemius_secretKey") ?? ""),
|
|
24
|
+
apiKey: String(t.get("freemius_apiKey") ?? "")
|
|
25
|
+
}
|
|
26
|
+
}), n("/cms/payments"), n("/cms/dashboard"), n("/", "layout");
|
|
30
27
|
}
|
|
31
|
-
async function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
value: e
|
|
43
|
-
});
|
|
44
|
-
if (o)
|
|
45
|
-
throw console.error("Error updating payment providers:", o), new Error("Failed to update settings");
|
|
46
|
-
return t("/cms/payments"), t("/cms/taxes"), t("/", "layout"), { success: !0 };
|
|
28
|
+
async function a(e) {
|
|
29
|
+
let r = await t(), { data: { user: i } } = await r.auth.getUser();
|
|
30
|
+
if (!i) throw Error("Unauthorized");
|
|
31
|
+
let { data: a } = await r.from("profiles").select("role").eq("id", i.id).single();
|
|
32
|
+
if (!a || a.role !== "ADMIN") throw Error("Forbidden");
|
|
33
|
+
let { error: o } = await r.from("site_settings").upsert({
|
|
34
|
+
key: "enabled_payment_providers",
|
|
35
|
+
value: e
|
|
36
|
+
});
|
|
37
|
+
if (o) throw console.error("Error updating payment providers:", o), Error("Failed to update settings");
|
|
38
|
+
return n("/cms/payments"), n("/cms/taxes"), n("/", "layout"), { success: !0 };
|
|
47
39
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
g as updatePaymentSettings
|
|
51
|
-
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { i as savePaymentProviderCredentials, a as updatePaymentSettings };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./actions.cjs"),t=require("./PaymentsPage.cjs");exports.PaymentsPage=t.PaymentsPage,exports.savePaymentProviderCredentials=e.savePaymentProviderCredentials,exports.updatePaymentSettings=e.updatePaymentSettings;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../../types.cjs"),t=require("../../../payment-config.cjs");let n=require("react"),r=require("@nextblock-cms/db/server");async function i(){return t.getPaymentConfigStatus()}async function a(){let{data:t,error:n}=await(0,r.createClient)().from(`site_settings`).select(`value`).eq(`key`,`enabled_payment_providers`).maybeSingle();return n||!t?{...e.DEFAULT_ENABLED_PAYMENT_PROVIDERS}:e.normalizeEnabledPaymentProviders(t.value)}async function o(){let e=await a();return e.stripe?`stripe`:e.freemius?`freemius`:`stripe`}var s={stripe:`Stripe`,freemius:`Freemius`};function c(e,t,n){let r=t[e],{hasKeys:i,missing:a}=n[e];return{provider:e,label:s[e],enabled:r,hasKeys:i,ready:r&&i,missing:i&&!r?[`Not enabled in CMS → Payments`]:a}}var l=(0,n.cache)(async()=>{let[e,t]=await Promise.all([a(),i()]);return{stripe:c(`stripe`,e,t),freemius:c(`freemius`,e,t)}});async function u(e){return(await l())[e]}async function d(t){return u(e.derivePaymentProviderFromProductType(t))}exports.getEnabledPaymentProviders=a,exports.getPaymentSettings=o,exports.getProviderReadiness=u,exports.getReadinessForProductType=d,exports.getStoreConfigStatus=i,exports.getStoreReadiness=l;
|
|
@@ -1,56 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { DEFAULT_ENABLED_PAYMENT_PROVIDERS as e, derivePaymentProviderFromProductType as t, normalizeEnabledPaymentProviders as n } from "../../../types.es.js";
|
|
2
|
+
import { getPaymentConfigStatus as r } from "../../../payment-config.es.js";
|
|
3
|
+
import { cache as i } from "react";
|
|
4
|
+
import { createClient as a } from "@nextblock-cms/db/server";
|
|
5
|
+
//#region src/lib/pages/cms/payments/queries.ts
|
|
6
|
+
async function o() {
|
|
7
|
+
return r();
|
|
7
8
|
}
|
|
8
|
-
async function
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
async function s() {
|
|
10
|
+
let { data: t, error: r } = await a().from("site_settings").select("value").eq("key", "enabled_payment_providers").maybeSingle();
|
|
11
|
+
return r || !t ? { ...e } : n(t.value);
|
|
11
12
|
}
|
|
12
|
-
async function
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
async function c() {
|
|
14
|
+
let e = await s();
|
|
15
|
+
return e.stripe ? "stripe" : e.freemius ? "freemius" : "stripe";
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
var l = {
|
|
18
|
+
stripe: "Stripe",
|
|
19
|
+
freemius: "Freemius"
|
|
19
20
|
};
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
missing: s && !r ? ["Not enabled in CMS → Payments"] : o
|
|
31
|
-
};
|
|
21
|
+
function u(e, t, n) {
|
|
22
|
+
let r = t[e], { hasKeys: i, missing: a } = n[e];
|
|
23
|
+
return {
|
|
24
|
+
provider: e,
|
|
25
|
+
label: l[e],
|
|
26
|
+
enabled: r,
|
|
27
|
+
hasKeys: i,
|
|
28
|
+
ready: r && i,
|
|
29
|
+
missing: i && !r ? ["Not enabled in CMS → Payments"] : a
|
|
30
|
+
};
|
|
32
31
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
stripe: i("stripe", e, t),
|
|
40
|
-
freemius: i("freemius", e, t)
|
|
41
|
-
};
|
|
32
|
+
var d = i(async () => {
|
|
33
|
+
let [e, t] = await Promise.all([s(), o()]);
|
|
34
|
+
return {
|
|
35
|
+
stripe: u("stripe", e, t),
|
|
36
|
+
freemius: u("freemius", e, t)
|
|
37
|
+
};
|
|
42
38
|
});
|
|
43
|
-
async function
|
|
44
|
-
|
|
39
|
+
async function f(e) {
|
|
40
|
+
return (await d())[e];
|
|
45
41
|
}
|
|
46
|
-
async function
|
|
47
|
-
|
|
42
|
+
async function p(e) {
|
|
43
|
+
return f(t(e));
|
|
48
44
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
v as getPaymentSettings,
|
|
52
|
-
p as getProviderReadiness,
|
|
53
|
-
_ as getReadinessForProductType,
|
|
54
|
-
l as getStoreConfigStatus,
|
|
55
|
-
g as getStoreReadiness
|
|
56
|
-
};
|
|
45
|
+
//#endregion
|
|
46
|
+
export { s as getEnabledPaymentProviders, c as getPaymentSettings, f as getProviderReadiness, p as getReadinessForProductType, o as getStoreConfigStatus, d as getStoreReadiness };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../../../_virtual/_rolldown/runtime.cjs"),t=require("./actions.cjs"),n=require("./server-actions.cjs"),r=require("./components/ProductsBulkTable.cjs"),i=require("./components/SyncFreemiusButton.cjs");let a=require("next/link");a=e.__toESM(a,1);let o=require("react/jsx-runtime"),s=require("@nextblock-cms/db/server"),c=require("@nextblock-cms/ui"),l=require("@nextblock-cms/utils/seo");async function u({searchParams:e,languageFilterNode:u,transferControlsNode:d}){let f=(0,s.getServiceRoleSupabaseClient)(),[p,{data:m}]=await Promise.all([(0,s.getActiveLanguagesServerSide)(),f.from(`currencies`).select(`code, is_default`).eq(`is_active`,!0).order(`is_default`,{ascending:!1}).order(`code`,{ascending:!0})]),h=e?.lang?parseInt(e.lang,10):void 0,{data:g}=await t.getProducts({languageId:h}),_=g||[],v=_.map(e=>e.id),{data:y}=v.length>0?await f.from(`blocks`).select(`id, product_id, block_type, content, order`).in(`product_id`,v).order(`order`,{ascending:!0}):{data:[]},b=new Map;for(let e of y||[]){if(!e.product_id)continue;let t=b.get(e.product_id)||[];t.push(e),b.set(e.product_id,t)}let x=_.map(e=>{let t=b.get(e.id)||[],n=(0,l.buildPageSeoDocument)(t,{documentTitle:e.title,documentType:`product`}),r=(0,l.auditSeo)({document:n,metaTitle:e.meta_title??void 0,metaDescription:e.meta_description??void 0,scope:`page`});return{...e,seo_score:r.score}}),S=Object.fromEntries(p.map(e=>[String(e.id),e.code.toUpperCase()])),C=m?.find(e=>e.is_default)?.code||m?.[0]?.code||`USD`;return(0,o.jsxs)(`div`,{className:`p-8 space-y-6`,children:[(0,o.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,o.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Products`}),(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,o.jsx)(`div`,{className:`h-10 w-[1px] bg-slate-200 dark:bg-slate-800 mx-2 hidden sm:block`}),d,u,(0,o.jsx)(i.SyncFreemiusButton,{title:`Sync Full Store`}),(0,o.jsx)(a.default,{href:`/cms/products/new`,children:(0,o.jsx)(c.Button,{children:`New Product`})})]})]}),(0,o.jsx)(r.ProductsBulkTable,{products:x,languageLabels:S,defaultCurrencyCode:C,deleteProductAction:n.deleteProductAction,bulkDeleteProductsAction:n.bulkDeleteProductsAction,bulkDraftProductsAction:n.bulkDraftProductsAction})]})}exports.ProductsPage=u;
|
|
@@ -1,67 +1,64 @@
|
|
|
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
|
-
] });
|
|
1
|
+
import { getProducts as e } from "./actions.es.js";
|
|
2
|
+
import { bulkDeleteProductsAction as t, bulkDraftProductsAction as n, deleteProductAction as r } from "./server-actions.es.js";
|
|
3
|
+
import { ProductsBulkTable as i } from "./components/ProductsBulkTable.es.js";
|
|
4
|
+
import { SyncFreemiusButton as a } from "./components/SyncFreemiusButton.es.js";
|
|
5
|
+
import o from "next/link";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import { getActiveLanguagesServerSide as l, getServiceRoleSupabaseClient as u } from "@nextblock-cms/db/server";
|
|
8
|
+
import { Button as d } from "@nextblock-cms/ui";
|
|
9
|
+
import { auditSeo as f, buildPageSeoDocument as p } from "@nextblock-cms/utils/seo";
|
|
10
|
+
//#region src/lib/pages/cms/products/ProductsPage.tsx
|
|
11
|
+
async function m({ searchParams: m, languageFilterNode: h, transferControlsNode: g }) {
|
|
12
|
+
let _ = u(), [v, { data: y }] = await Promise.all([l(), _.from("currencies").select("code, is_default").eq("is_active", !0).order("is_default", { ascending: !1 }).order("code", { ascending: !0 })]), b = m?.lang ? parseInt(m.lang, 10) : void 0, { data: x } = await e({ languageId: b }), S = x || [], C = S.map((e) => e.id), { data: w } = C.length > 0 ? await _.from("blocks").select("id, product_id, block_type, content, order").in("product_id", C).order("order", { ascending: !0 }) : { data: [] }, T = /* @__PURE__ */ new Map();
|
|
13
|
+
for (let e of w || []) {
|
|
14
|
+
if (!e.product_id) continue;
|
|
15
|
+
let t = T.get(e.product_id) || [];
|
|
16
|
+
t.push(e), T.set(e.product_id, t);
|
|
17
|
+
}
|
|
18
|
+
let E = S.map((e) => {
|
|
19
|
+
let t = T.get(e.id) || [], n = p(t, {
|
|
20
|
+
documentTitle: e.title,
|
|
21
|
+
documentType: "product"
|
|
22
|
+
}), r = f({
|
|
23
|
+
document: n,
|
|
24
|
+
metaTitle: e.meta_title ?? void 0,
|
|
25
|
+
metaDescription: e.meta_description ?? void 0,
|
|
26
|
+
scope: "page"
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
...e,
|
|
30
|
+
seo_score: r.score
|
|
31
|
+
};
|
|
32
|
+
}), D = Object.fromEntries(v.map((e) => [String(e.id), e.code.toUpperCase()])), O = y?.find((e) => e.is_default)?.code || y?.[0]?.code || "USD";
|
|
33
|
+
return /* @__PURE__ */ c("div", {
|
|
34
|
+
className: "p-8 space-y-6",
|
|
35
|
+
children: [/* @__PURE__ */ c("div", {
|
|
36
|
+
className: "flex justify-between items-center",
|
|
37
|
+
children: [/* @__PURE__ */ s("h1", {
|
|
38
|
+
className: "text-3xl font-bold",
|
|
39
|
+
children: "Products"
|
|
40
|
+
}), /* @__PURE__ */ c("div", {
|
|
41
|
+
className: "flex flex-wrap items-center gap-4",
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ s("div", { className: "h-10 w-[1px] bg-slate-200 dark:bg-slate-800 mx-2 hidden sm:block" }),
|
|
44
|
+
g,
|
|
45
|
+
h,
|
|
46
|
+
/* @__PURE__ */ s(a, { title: "Sync Full Store" }),
|
|
47
|
+
/* @__PURE__ */ s(o, {
|
|
48
|
+
href: "/cms/products/new",
|
|
49
|
+
children: /* @__PURE__ */ s(d, { children: "New Product" })
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
})]
|
|
53
|
+
}), /* @__PURE__ */ s(i, {
|
|
54
|
+
products: E,
|
|
55
|
+
languageLabels: D,
|
|
56
|
+
defaultCurrencyCode: O,
|
|
57
|
+
deleteProductAction: r,
|
|
58
|
+
bulkDeleteProductsAction: t,
|
|
59
|
+
bulkDraftProductsAction: n
|
|
60
|
+
})]
|
|
61
|
+
});
|
|
64
62
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { m as ProductsPage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../../../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../../../currency.cjs"),n=require("../../../../../variation-utils.cjs"),r=require("../../actions.cjs"),i=require("../../server-actions.cjs"),a=require("../../components/ProductForm.cjs"),o=require("../../../payments/queries.cjs"),s=require("../../components/DeleteProductButton.cjs"),c=require("../../components/FreemiusPricingDashboard.cjs");let l=require("next/link");l=e.__toESM(l,1);let u=require("lucide-react"),d=require("@nextblock-cms/utils"),f=require("react/jsx-runtime"),p=require("@nextblock-cms/db/server"),m=require("next/navigation"),h=require("@nextblock-cms/ui");async function g({params:e,mediaPickerNode:g,availableLanguagesProp:_,languageSwitcherNode:v,copyContentNode:y,translationCtaNode:b}){let{id:x}=await e,S=await r.getProduct(x);S||(0,m.notFound)();let C=S.product_type===`digital`||S.payment_provider===`freemius`,[w,T,E,D,O]=await Promise.all([o.getEnabledPaymentProviders(),o.getStoreConfigStatus(),C&&S.freemius_product_id?r.getFreemiusPricingByProductId(S.id):Promise.resolve(null),r.getGlobalProductAttributes(),(0,p.getServiceRoleSupabaseClient)().from(`currencies`).select(`code, symbol, exchange_rate, is_default, is_active, auto_sync_product_prices, auto_update_exchange_rate, exchange_rate_source, exchange_rate_updated_at, rounding_mode, rounding_increment, rounding_charm_amount`).eq(`is_active`,!0).order(`code`,{ascending:!0}).then(e=>e.data||[])]),k=(O||[]).map(e=>t.normalizeCurrencyRecord(e)),A=_.find(e=>e.id===S.language_id)?.code,{attributes:j,variants:M}=n.mapRawVariantRelations(S.product_variants||[],A),N=(D||[]).map(e=>({id:e.id,name:e.name,name_translations:e.name_translations||{},slug:e.slug,terms:(e.product_attribute_terms||[]).map(e=>({...e,value_translations:e.value_translations||{}}))})),P=s.DeleteProductButton,F=c.FreemiusPricingDashboard;return(0,f.jsxs)(`div`,{className:`space-y-8 w-full max-w-[1400px] mx-auto px-6 py-8`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between items-center flex-wrap gap-4 w-full`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(h.Button,{variant:`outline`,size:`icon`,"aria-label":`Back to products`,asChild:!0,children:(0,f.jsx)(l.default,{href:`/cms/products`,children:(0,f.jsx)(u.ArrowLeft,{className:`h-4 w-4`})})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Edit Product`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground truncate max-w-md`,title:S.title,children:S.title})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[v,y,b,P?(0,f.jsx)(P,{productName:S.title,redirectTo:`/cms/products`,className:`border-red-200 hover:bg-red-50 hover:text-red-700`,deleteAction:i.deleteProductAction.bind(null,S.id)}):null,S.slug&&S.status===`active`&&(0,f.jsx)(h.Button,{variant:`outline`,asChild:!0,children:(0,f.jsxs)(l.default,{href:`/product/${S.slug}`,target:`_blank`,children:[(0,f.jsx)(u.ExternalLink,{className:`w-4 h-4 mr-2`}),`View`]})})]})]}),(0,f.jsx)(a.ProductForm,{initialData:{id:S.id,title:S.title,slug:S.slug,sku:S.sku,upc:S.upc??void 0,stock:S.stock||0,price:S.price||0,prices:Object.entries(S.prices||{}).reduce((e,[t,n])=>(e[t]=(0,d.minorUnitAmountToMajor)(n,t),e),{}),is_taxable:typeof S.is_taxable!=`boolean`||S.is_taxable,product_type:S.product_type,payment_provider:S.payment_provider,status:S.status,short_description:S.short_description??void 0,description_json:S.description_json,sale_price:typeof S.sale_price==`number`?S.sale_price:void 0,sale_prices:Object.entries(S.sale_prices||{}).reduce((e,[t,n])=>(e[t]=typeof n==`number`?(0,d.minorUnitAmountToMajor)(n,t):null,e),{}),freemius_plan_id:S.freemius_plan_id??void 0,freemius_product_id:S.freemius_product_id??void 0,trial_period_days:S.trial_period_days??0,trial_requires_payment_method:S.trial_requires_payment_method??!1,language_id:S.language_id,translation_group_id:S.translation_group_id,product_media:S.product_media,variation_attributes:j.map(e=>({attribute_id:e.id,term_ids:e.terms.map(e=>e.id)})),variants:M.map(e=>({...e,upc:e.upc??null,price:e.price/100,prices:Object.entries(e.prices||{}).reduce((e,[t,n])=>(e[t]=(0,d.minorUnitAmountToMajor)(n,t),e),{}),sale_price:typeof e.sale_price==`number`?e.sale_price/100:null,sale_prices:Object.entries(e.sale_prices||{}).reduce((e,[t,n])=>(e[t]=typeof n==`number`?(0,d.minorUnitAmountToMajor)(n,t):null,e),{}),main_media_id:e.main_media_id??null,main_image_url:e.image_url??null}))},isEdit:!0,mediaPickerNode:g,availableLanguagesProp:_,globalAttributesProp:N,currenciesProp:k,enabledProviders:w,configStatus:T,updateAction:i.updateProductAction.bind(null,S.id),freemiusDashboardNode:C&&S.freemius_product_id&&E&&F?(0,f.jsx)(F,{productId:S.id,freemiusProductId:S.freemius_product_id,plans:E}):void 0})]})}exports.EditProductPage=g;
|
|
@@ -8,5 +8,5 @@ interface EditProductPageProps {
|
|
|
8
8
|
copyContentNode?: React.ReactNode;
|
|
9
9
|
translationCtaNode?: React.ReactNode;
|
|
10
10
|
}
|
|
11
|
-
export declare function EditProductPage({ params, mediaPickerNode, availableLanguagesProp, languageSwitcherNode, copyContentNode, translationCtaNode }: EditProductPageProps): Promise<import(
|
|
11
|
+
export declare function EditProductPage({ params, mediaPickerNode, availableLanguagesProp, languageSwitcherNode, copyContentNode, translationCtaNode }: EditProductPageProps): Promise<import('react').JSX.Element>;
|
|
12
12
|
export {};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { normalizeCurrencyRecord as e } from "../../../../../currency.es.js";
|
|
2
|
+
import { mapRawVariantRelations as t } from "../../../../../variation-utils.es.js";
|
|
3
|
+
import { getFreemiusPricingByProductId as n, getGlobalProductAttributes as r, getProduct as i } from "../../actions.es.js";
|
|
4
|
+
import { deleteProductAction as a, updateProductAction as o } from "../../server-actions.es.js";
|
|
5
|
+
import { ProductForm as s } from "../../components/ProductForm.es.js";
|
|
6
|
+
import { getEnabledPaymentProviders as c, getStoreConfigStatus as l } from "../../../payments/queries.es.js";
|
|
7
|
+
import { DeleteProductButton as u } from "../../components/DeleteProductButton.es.js";
|
|
8
|
+
import { FreemiusPricingDashboard as d } from "../../components/FreemiusPricingDashboard.es.js";
|
|
9
|
+
import f from "next/link";
|
|
10
|
+
import { ArrowLeft as p, ExternalLink as m } from "lucide-react";
|
|
11
|
+
import { minorUnitAmountToMajor as h } from "@nextblock-cms/utils";
|
|
12
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
13
|
+
import { getServiceRoleSupabaseClient as v } from "@nextblock-cms/db/server";
|
|
14
|
+
import { notFound as y } from "next/navigation";
|
|
15
|
+
import { Button as b } from "@nextblock-cms/ui";
|
|
16
|
+
//#region src/lib/pages/cms/products/[id]/edit/EditProductPage.tsx
|
|
17
|
+
async function x({ params: x, mediaPickerNode: S, availableLanguagesProp: C, languageSwitcherNode: w, copyContentNode: T, translationCtaNode: E }) {
|
|
18
|
+
let { id: D } = await x, O = await i(D);
|
|
19
|
+
O || y();
|
|
20
|
+
let k = O.product_type === "digital" || O.payment_provider === "freemius", [A, j, M, N, P] = await Promise.all([
|
|
21
|
+
c(),
|
|
22
|
+
l(),
|
|
23
|
+
k && O.freemius_product_id ? n(O.id) : Promise.resolve(null),
|
|
24
|
+
r(),
|
|
25
|
+
v().from("currencies").select("code, symbol, exchange_rate, is_default, is_active, auto_sync_product_prices, auto_update_exchange_rate, exchange_rate_source, exchange_rate_updated_at, rounding_mode, rounding_increment, rounding_charm_amount").eq("is_active", !0).order("code", { ascending: !0 }).then((e) => e.data || [])
|
|
26
|
+
]), F = (P || []).map((t) => e(t)), I = C.find((e) => e.id === O.language_id)?.code, { attributes: L, variants: R } = t(O.product_variants || [], I), z = (N || []).map((e) => ({
|
|
27
|
+
id: e.id,
|
|
28
|
+
name: e.name,
|
|
29
|
+
name_translations: e.name_translations || {},
|
|
30
|
+
slug: e.slug,
|
|
31
|
+
terms: (e.product_attribute_terms || []).map((e) => ({
|
|
32
|
+
...e,
|
|
33
|
+
value_translations: e.value_translations || {}
|
|
34
|
+
}))
|
|
35
|
+
})), B = u, V = d;
|
|
36
|
+
return /* @__PURE__ */ _("div", {
|
|
37
|
+
className: "space-y-8 w-full max-w-[1400px] mx-auto px-6 py-8",
|
|
38
|
+
children: [/* @__PURE__ */ _("div", {
|
|
39
|
+
className: "flex justify-between items-center flex-wrap gap-4 w-full",
|
|
40
|
+
children: [/* @__PURE__ */ _("div", {
|
|
41
|
+
className: "flex items-center gap-3",
|
|
42
|
+
children: [/* @__PURE__ */ g(b, {
|
|
43
|
+
variant: "outline",
|
|
44
|
+
size: "icon",
|
|
45
|
+
"aria-label": "Back to products",
|
|
46
|
+
asChild: !0,
|
|
47
|
+
children: /* @__PURE__ */ g(f, {
|
|
48
|
+
href: "/cms/products",
|
|
49
|
+
children: /* @__PURE__ */ g(p, { className: "h-4 w-4" })
|
|
50
|
+
})
|
|
51
|
+
}), /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("h1", {
|
|
52
|
+
className: "text-2xl font-bold",
|
|
53
|
+
children: "Edit Product"
|
|
54
|
+
}), /* @__PURE__ */ g("p", {
|
|
55
|
+
className: "text-sm text-muted-foreground truncate max-w-md",
|
|
56
|
+
title: O.title,
|
|
57
|
+
children: O.title
|
|
58
|
+
})] })]
|
|
59
|
+
}), /* @__PURE__ */ _("div", {
|
|
60
|
+
className: "flex items-center gap-3 flex-wrap",
|
|
61
|
+
children: [
|
|
62
|
+
w,
|
|
63
|
+
T,
|
|
64
|
+
E,
|
|
65
|
+
B ? /* @__PURE__ */ g(B, {
|
|
66
|
+
productName: O.title,
|
|
67
|
+
redirectTo: "/cms/products",
|
|
68
|
+
className: "border-red-200 hover:bg-red-50 hover:text-red-700",
|
|
69
|
+
deleteAction: a.bind(null, O.id)
|
|
70
|
+
}) : null,
|
|
71
|
+
O.slug && O.status === "active" && /* @__PURE__ */ g(b, {
|
|
72
|
+
variant: "outline",
|
|
73
|
+
asChild: !0,
|
|
74
|
+
children: /* @__PURE__ */ _(f, {
|
|
75
|
+
href: `/product/${O.slug}`,
|
|
76
|
+
target: "_blank",
|
|
77
|
+
children: [/* @__PURE__ */ g(m, { className: "w-4 h-4 mr-2" }), "View"]
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
})]
|
|
82
|
+
}), /* @__PURE__ */ g(s, {
|
|
83
|
+
initialData: {
|
|
84
|
+
id: O.id,
|
|
85
|
+
title: O.title,
|
|
86
|
+
slug: O.slug,
|
|
87
|
+
sku: O.sku,
|
|
88
|
+
upc: O.upc ?? void 0,
|
|
89
|
+
stock: O.stock || 0,
|
|
90
|
+
price: O.price || 0,
|
|
91
|
+
prices: Object.entries(O.prices || {}).reduce((e, [t, n]) => (e[t] = h(n, t), e), {}),
|
|
92
|
+
is_taxable: typeof O.is_taxable != "boolean" || O.is_taxable,
|
|
93
|
+
product_type: O.product_type,
|
|
94
|
+
payment_provider: O.payment_provider,
|
|
95
|
+
status: O.status,
|
|
96
|
+
short_description: O.short_description ?? void 0,
|
|
97
|
+
description_json: O.description_json,
|
|
98
|
+
sale_price: typeof O.sale_price == "number" ? O.sale_price : void 0,
|
|
99
|
+
sale_prices: Object.entries(O.sale_prices || {}).reduce((e, [t, n]) => (e[t] = typeof n == "number" ? h(n, t) : null, e), {}),
|
|
100
|
+
freemius_plan_id: O.freemius_plan_id ?? void 0,
|
|
101
|
+
freemius_product_id: O.freemius_product_id ?? void 0,
|
|
102
|
+
trial_period_days: O.trial_period_days ?? 0,
|
|
103
|
+
trial_requires_payment_method: O.trial_requires_payment_method ?? !1,
|
|
104
|
+
language_id: O.language_id,
|
|
105
|
+
translation_group_id: O.translation_group_id,
|
|
106
|
+
product_media: O.product_media,
|
|
107
|
+
variation_attributes: L.map((e) => ({
|
|
108
|
+
attribute_id: e.id,
|
|
109
|
+
term_ids: e.terms.map((e) => e.id)
|
|
110
|
+
})),
|
|
111
|
+
variants: R.map((e) => ({
|
|
112
|
+
...e,
|
|
113
|
+
upc: e.upc ?? null,
|
|
114
|
+
price: e.price / 100,
|
|
115
|
+
prices: Object.entries(e.prices || {}).reduce((e, [t, n]) => (e[t] = h(n, t), e), {}),
|
|
116
|
+
sale_price: typeof e.sale_price == "number" ? e.sale_price / 100 : null,
|
|
117
|
+
sale_prices: Object.entries(e.sale_prices || {}).reduce((e, [t, n]) => (e[t] = typeof n == "number" ? h(n, t) : null, e), {}),
|
|
118
|
+
main_media_id: e.main_media_id ?? null,
|
|
119
|
+
main_image_url: e.image_url ?? null
|
|
120
|
+
}))
|
|
121
|
+
},
|
|
122
|
+
isEdit: !0,
|
|
123
|
+
mediaPickerNode: S,
|
|
124
|
+
availableLanguagesProp: C,
|
|
125
|
+
globalAttributesProp: z,
|
|
126
|
+
currenciesProp: F,
|
|
127
|
+
enabledProviders: A,
|
|
128
|
+
configStatus: j,
|
|
129
|
+
updateAction: o.bind(null, O.id),
|
|
130
|
+
freemiusDashboardNode: k && O.freemius_product_id && M && V ? /* @__PURE__ */ g(V, {
|
|
131
|
+
productId: O.id,
|
|
132
|
+
freemiusProductId: O.freemius_product_id,
|
|
133
|
+
plans: M
|
|
134
|
+
}) : void 0
|
|
135
|
+
})]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
export { x as EditProductPage };
|