@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,149 +1,219 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { isDigitalItem as e } from "../types.es.js";
|
|
3
|
+
import { useCurrency as t } from "../CurrencyProvider.es.js";
|
|
4
|
+
import { getCartItemActivePrice as n, useCartSubtotal as r } from "../cart-store.es.js";
|
|
5
|
+
import { useCart as i } from "../use-cart.es.js";
|
|
6
|
+
import { usePriceFormatter as a } from "../use-price-formatter.es.js";
|
|
7
|
+
import { getTrialSummary as o } from "../trials.es.js";
|
|
8
|
+
import { CouponForm as s } from "./CouponForm.es.js";
|
|
9
|
+
import { Sheet as c, SheetContent as l, SheetDescription as u, SheetHeader as d, SheetTitle as f } from "@nextblock-cms/ui/sheet";
|
|
10
|
+
import { Badge as p } from "@nextblock-cms/ui/badge";
|
|
11
|
+
import { Button as m } from "@nextblock-cms/ui/button";
|
|
12
|
+
import h from "next/link";
|
|
13
|
+
import { useRef as g } from "react";
|
|
14
|
+
import { Minus as _, Plus as v, Trash2 as y } from "lucide-react";
|
|
15
|
+
import { useTranslations as b } from "@nextblock-cms/utils";
|
|
16
|
+
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
17
|
+
//#region src/lib/components/CartDrawer.tsx
|
|
18
|
+
var w = () => {
|
|
19
|
+
let w = a(), T = i((e) => e), E = r(), { t: D } = b(), O = g(null), k = (e, t, n) => {
|
|
20
|
+
let r = D(e, n);
|
|
21
|
+
return r === e ? t : r;
|
|
22
|
+
}, { activeCurrencyCode: A, currencies: j } = t();
|
|
23
|
+
if (!T) return null;
|
|
24
|
+
let { isOpen: M, setIsOpen: N, items: P, updateQuantity: F, removeItem: I } = T, L = (t) => P.reduce((n, r) => e(r) || r.sku !== t ? n : n + r.quantity, 0);
|
|
25
|
+
return /* @__PURE__ */ S(c, {
|
|
26
|
+
open: M,
|
|
27
|
+
onOpenChange: N,
|
|
28
|
+
children: /* @__PURE__ */ C(l, {
|
|
29
|
+
className: "flex w-full flex-col pr-0 sm:max-w-lg",
|
|
30
|
+
onOpenAutoFocus: () => {
|
|
31
|
+
O.current = document.activeElement;
|
|
32
|
+
},
|
|
33
|
+
onCloseAutoFocus: (e) => {
|
|
34
|
+
e.preventDefault(), O.current?.focus();
|
|
35
|
+
},
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ C(d, {
|
|
38
|
+
className: "px-1 text-left",
|
|
39
|
+
children: [/* @__PURE__ */ C(f, { children: [
|
|
40
|
+
D("ecommerce.shopping_cart"),
|
|
41
|
+
" (",
|
|
42
|
+
P.length,
|
|
43
|
+
")"
|
|
44
|
+
] }), /* @__PURE__ */ S(u, {
|
|
45
|
+
className: "sr-only",
|
|
46
|
+
children: D("ecommerce.shopping_cart")
|
|
47
|
+
})]
|
|
48
|
+
}),
|
|
49
|
+
P.length > 0 ? /* @__PURE__ */ S("div", {
|
|
50
|
+
className: "flex flex-1 flex-col gap-5 overflow-y-auto overscroll-contain p-1 pr-6 pt-4",
|
|
51
|
+
children: P.map((t) => {
|
|
52
|
+
let r = L(t.sku);
|
|
53
|
+
return /* @__PURE__ */ S("div", {
|
|
54
|
+
className: "flex gap-4",
|
|
55
|
+
children: (() => {
|
|
56
|
+
let i = n(t, {
|
|
57
|
+
currencyCode: A,
|
|
58
|
+
currencies: j
|
|
59
|
+
}), a = o(t, D);
|
|
60
|
+
return /* @__PURE__ */ C(x, { children: [t.image_url ? /* @__PURE__ */ S("div", {
|
|
61
|
+
className: "relative aspect-square h-20 w-20 min-w-fit overflow-hidden rounded border bg-neutral-100",
|
|
62
|
+
children: /* @__PURE__ */ S("img", {
|
|
63
|
+
src: t.image_url,
|
|
64
|
+
alt: "",
|
|
65
|
+
width: 80,
|
|
66
|
+
height: 80,
|
|
67
|
+
loading: "lazy",
|
|
68
|
+
decoding: "async",
|
|
69
|
+
className: "h-full w-full object-cover"
|
|
70
|
+
})
|
|
71
|
+
}) : /* @__PURE__ */ S("div", {
|
|
72
|
+
className: "flex h-20 w-20 items-center justify-center rounded bg-secondary",
|
|
73
|
+
children: /* @__PURE__ */ S("span", {
|
|
74
|
+
className: "text-xs text-muted-foreground",
|
|
75
|
+
children: D("ecommerce.no_image")
|
|
76
|
+
})
|
|
77
|
+
}), /* @__PURE__ */ C("div", {
|
|
78
|
+
className: "flex min-w-0 flex-1 flex-col justify-between",
|
|
79
|
+
children: [/* @__PURE__ */ C("div", {
|
|
80
|
+
className: "flex justify-between gap-2",
|
|
81
|
+
children: [/* @__PURE__ */ C("div", {
|
|
82
|
+
className: "min-w-0",
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ S("span", {
|
|
85
|
+
className: "line-clamp-2 text-sm font-medium leading-tight",
|
|
86
|
+
children: t.title
|
|
87
|
+
}),
|
|
88
|
+
t.variant_label && /* @__PURE__ */ S("div", {
|
|
89
|
+
className: "mt-1 text-xs text-muted-foreground",
|
|
90
|
+
children: t.variant_label
|
|
91
|
+
}),
|
|
92
|
+
a && /* @__PURE__ */ C("div", {
|
|
93
|
+
className: "mt-1 text-xs font-medium text-emerald-700",
|
|
94
|
+
children: [
|
|
95
|
+
a.label,
|
|
96
|
+
" - ",
|
|
97
|
+
a.paymentRequirementLabel
|
|
98
|
+
]
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
}), /* @__PURE__ */ C("span", {
|
|
102
|
+
className: "text-sm font-semibold tabular-nums",
|
|
103
|
+
children: [i.sale_price && /* @__PURE__ */ C(x, { children: [
|
|
104
|
+
/* @__PURE__ */ C("span", {
|
|
105
|
+
className: "sr-only",
|
|
106
|
+
children: [k("ecommerce.regular_price", "Regular price"), " "]
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ S("s", {
|
|
109
|
+
className: "mr-1.5 text-xs font-normal text-muted-foreground",
|
|
110
|
+
children: w(i.price, A)
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ C("span", {
|
|
113
|
+
className: "sr-only",
|
|
114
|
+
children: [k("ecommerce.sale_price", "Sale price"), " "]
|
|
115
|
+
})
|
|
116
|
+
] }), w(i.sale_price ?? i.price, A)]
|
|
117
|
+
})]
|
|
118
|
+
}), /* @__PURE__ */ C("div", {
|
|
119
|
+
className: "flex items-center justify-between text-sm",
|
|
120
|
+
children: [e(t) ? /* @__PURE__ */ S(p, {
|
|
121
|
+
variant: "secondary",
|
|
122
|
+
className: "font-normal text-xs",
|
|
123
|
+
children: k("ecommerce.license_count_one", "1 license", { count: 1 })
|
|
124
|
+
}) : /* @__PURE__ */ C("div", {
|
|
125
|
+
role: "group",
|
|
126
|
+
"aria-label": `${k("ecommerce.quantity", "Quantity")}: ${t.title}`,
|
|
127
|
+
className: "flex items-center rounded-md border text-xs",
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ S("button", {
|
|
130
|
+
onClick: () => F(t.id, t.quantity - 1),
|
|
131
|
+
className: "flex h-7 w-7 items-center justify-center rounded-l-md border-r focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
|
|
132
|
+
type: "button",
|
|
133
|
+
"aria-label": k("ecommerce.decrease_quantity", "Decrease quantity"),
|
|
134
|
+
children: /* @__PURE__ */ S(_, { className: "h-3 w-3" })
|
|
135
|
+
}),
|
|
136
|
+
/* @__PURE__ */ S("span", {
|
|
137
|
+
"aria-live": "polite",
|
|
138
|
+
"aria-atomic": "true",
|
|
139
|
+
className: "flex h-7 w-8 items-center justify-center tabular-nums",
|
|
140
|
+
children: t.quantity
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ S("button", {
|
|
143
|
+
onClick: () => F(t.id, t.quantity + 1),
|
|
144
|
+
className: "flex h-7 w-7 items-center justify-center rounded-r-md border-l focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
|
|
145
|
+
type: "button",
|
|
146
|
+
"aria-label": k("ecommerce.increase_quantity", "Increase quantity"),
|
|
147
|
+
disabled: typeof t.stock == "number" && r >= t.stock,
|
|
148
|
+
children: /* @__PURE__ */ S(v, { className: "h-3 w-3" })
|
|
149
|
+
})
|
|
150
|
+
]
|
|
151
|
+
}), /* @__PURE__ */ S("button", {
|
|
152
|
+
onClick: () => I(t.id),
|
|
153
|
+
className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-destructive focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
|
|
154
|
+
type: "button",
|
|
155
|
+
"aria-label": k("ecommerce.remove_item", `Remove ${t.title} from cart`, { item: t.title }),
|
|
156
|
+
children: /* @__PURE__ */ S(y, { className: "h-4 w-4" })
|
|
157
|
+
})]
|
|
158
|
+
})]
|
|
159
|
+
})] });
|
|
160
|
+
})()
|
|
161
|
+
}, t.id);
|
|
162
|
+
})
|
|
163
|
+
}) : /* @__PURE__ */ C("div", {
|
|
164
|
+
className: "flex h-full flex-col items-center justify-center space-y-2",
|
|
165
|
+
children: [/* @__PURE__ */ S("span", {
|
|
166
|
+
className: "text-muted-foreground",
|
|
167
|
+
children: D("ecommerce.cart_empty")
|
|
168
|
+
}), /* @__PURE__ */ S(m, {
|
|
169
|
+
variant: "outline",
|
|
170
|
+
onClick: () => N(!1),
|
|
171
|
+
children: D("ecommerce.continue_shopping")
|
|
172
|
+
})]
|
|
173
|
+
}),
|
|
174
|
+
P.length > 0 && /* @__PURE__ */ C("div", {
|
|
175
|
+
className: "border-t pr-6 pt-4",
|
|
176
|
+
children: [
|
|
177
|
+
/* @__PURE__ */ C("div", {
|
|
178
|
+
className: "flex items-center justify-between text-base font-medium",
|
|
179
|
+
children: [/* @__PURE__ */ S("span", { children: D("ecommerce.subtotal") }), /* @__PURE__ */ S("span", { children: w(E, A) })]
|
|
180
|
+
}),
|
|
181
|
+
/* @__PURE__ */ S("p", {
|
|
182
|
+
className: "mb-4 mt-1 text-xs text-muted-foreground",
|
|
183
|
+
children: D("ecommerce.shipping_taxes_calculated")
|
|
184
|
+
}),
|
|
185
|
+
/* @__PURE__ */ S("div", {
|
|
186
|
+
className: "mb-4",
|
|
187
|
+
children: /* @__PURE__ */ S(s, {
|
|
188
|
+
items: P,
|
|
189
|
+
currencyCode: A,
|
|
190
|
+
compact: !0
|
|
191
|
+
})
|
|
192
|
+
}),
|
|
193
|
+
/* @__PURE__ */ S(m, {
|
|
194
|
+
asChild: !0,
|
|
195
|
+
variant: "outline",
|
|
196
|
+
className: "w-full mb-3",
|
|
197
|
+
children: /* @__PURE__ */ S(h, {
|
|
198
|
+
href: "/cart",
|
|
199
|
+
onClick: () => N(!1),
|
|
200
|
+
children: D("ecommerce.view_full_cart")
|
|
201
|
+
})
|
|
202
|
+
}),
|
|
203
|
+
/* @__PURE__ */ S(m, {
|
|
204
|
+
asChild: !0,
|
|
205
|
+
className: "w-full",
|
|
206
|
+
children: /* @__PURE__ */ S(h, {
|
|
207
|
+
href: "/checkout",
|
|
208
|
+
onClick: () => N(!1),
|
|
209
|
+
children: D("ecommerce.ready_to_checkout")
|
|
210
|
+
})
|
|
211
|
+
})
|
|
212
|
+
]
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
})
|
|
216
|
+
});
|
|
149
217
|
};
|
|
218
|
+
//#endregion
|
|
219
|
+
export { w as CartDrawer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cart-store.cjs"),t=require("../use-cart.cjs");let n=require("@nextblock-cms/ui/badge"),r=require("@nextblock-cms/ui/button"),i=require("lucide-react"),a=require("@nextblock-cms/utils"),o=require("react/jsx-runtime");var s=()=>{let s=e.useCartStore(e=>e.toggleCart),c=e.useCartTotalItems(),l=t.useCart(e=>e.isOpen)!==void 0,{t:u}=(0,a.useTranslations)(),d=u(`ecommerce.open_cart_count`,{count:c}),f=d===`ecommerce.open_cart_count`?`Open cart (${c} items)`:d;return l?(0,o.jsxs)(r.Button,{variant:`ghost`,size:`icon`,className:`relative`,onClick:s,"aria-label":f,"aria-haspopup":`dialog`,children:[(0,o.jsx)(i.ShoppingBag,{className:`h-5 w-5`}),c>0&&(0,o.jsx)(n.Badge,{variant:`destructive`,className:`absolute -right-1 -top-1 h-4 w-4 items-center justify-center p-0 text-[10px]`,children:c})]}):(0,o.jsx)(r.Button,{variant:`ghost`,size:`icon`,className:`relative`,"aria-label":f,"aria-haspopup":`dialog`,children:(0,o.jsx)(i.ShoppingBag,{className:`h-5 w-5`})})};exports.CartIcon=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CartIcon: () => import(
|
|
1
|
+
export declare const CartIcon: () => import('react').JSX.Element;
|
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
) : /* @__PURE__ */ a(s, { variant: "ghost", size: "icon", className: "relative", "aria-label": r, "aria-haspopup": "dialog", children: /* @__PURE__ */ a(i, { className: "h-5 w-5" }) });
|
|
33
|
-
};
|
|
34
|
-
export {
|
|
35
|
-
j as CartIcon
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCartStore as e, useCartTotalItems as t } from "../cart-store.es.js";
|
|
3
|
+
import { useCart as n } from "../use-cart.es.js";
|
|
4
|
+
import { Badge as r } from "@nextblock-cms/ui/badge";
|
|
5
|
+
import { Button as i } from "@nextblock-cms/ui/button";
|
|
6
|
+
import { ShoppingBag as a } from "lucide-react";
|
|
7
|
+
import { useTranslations as o } from "@nextblock-cms/utils";
|
|
8
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
|
+
//#region src/lib/components/CartIcon.tsx
|
|
10
|
+
var l = () => {
|
|
11
|
+
let l = e((e) => e.toggleCart), u = t(), d = n((e) => e.isOpen) !== void 0, { t: f } = o(), p = f("ecommerce.open_cart_count", { count: u }), m = p === "ecommerce.open_cart_count" ? `Open cart (${u} items)` : p;
|
|
12
|
+
return d ? /* @__PURE__ */ c(i, {
|
|
13
|
+
variant: "ghost",
|
|
14
|
+
size: "icon",
|
|
15
|
+
className: "relative",
|
|
16
|
+
onClick: l,
|
|
17
|
+
"aria-label": m,
|
|
18
|
+
"aria-haspopup": "dialog",
|
|
19
|
+
children: [/* @__PURE__ */ s(a, { className: "h-5 w-5" }), u > 0 && /* @__PURE__ */ s(r, {
|
|
20
|
+
variant: "destructive",
|
|
21
|
+
className: "absolute -right-1 -top-1 h-4 w-4 items-center justify-center p-0 text-[10px]",
|
|
22
|
+
children: u
|
|
23
|
+
})]
|
|
24
|
+
}) : /* @__PURE__ */ s(i, {
|
|
25
|
+
variant: "ghost",
|
|
26
|
+
size: "icon",
|
|
27
|
+
className: "relative",
|
|
28
|
+
"aria-label": m,
|
|
29
|
+
"aria-haspopup": "dialog",
|
|
30
|
+
children: /* @__PURE__ */ s(a, { className: "h-5 w-5" })
|
|
31
|
+
});
|
|
36
32
|
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { l as CartIcon };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../types.cjs"),t=require("../CurrencyProvider.cjs"),n=require("../cart-store.cjs"),r=require("../use-cart.cjs"),i=require("../use-price-formatter.cjs"),a=require("../trials.cjs"),o=require("./CouponForm.cjs"),s=require("../countries.cjs"),c=require("../states.cjs"),ee=require("../server-actions/shipping-actions.cjs"),te=require("../PaymentReadinessProvider.cjs"),ne=require("../server-actions/tax-actions.cjs"),l=require("../customer.cjs");let re=require("@nextblock-cms/ui/badge"),ie=require("@nextblock-cms/ui/button"),u=require("react"),d=require("lucide-react"),ae=require("@nextblock-cms/utils"),f=require("react/jsx-runtime"),p=require("@nextblock-cms/ui/input"),m=require("@nextblock-cms/ui/label"),h=require("@nextblock-cms/ui/card"),oe=require("@nextblock-cms/ui/checkbox"),se=require("@nextblock-cms/ui/separator"),g=require("@nextblock-cms/ui/radio-group"),ce=require("@freemius/checkout");var le=process.env.NEXT_PUBLIC_IS_SANDBOX===`true`,_=`nextblock-checkout-draft-v1`;function v(e,t){return{...l.emptyCustomerAddress(),company_name:e?.company_name||``,recipient_name:e?.recipient_name||t||``,line1:e?.line1||``,line2:e?.line2||``,city:e?.city||``,state:e?.state||``,postal_code:e?.postal_code||``,country_code:s.normalizeCountryCode(e?.country_code)||`CA`}}function ue(e){let t=l.normalizeCustomerAddress(e);return!(!t?.country_code||!t.postal_code||c.countryUsesStructuredStates(t.country_code)&&!t.state)}function de(e,t,r){return e.reduce((e,i)=>{let{price:a,sale_price:o}=n.getCartItemActivePrice(i,{currencyCode:t,currencies:r});return e+(o??a)*i.quantity},0)}function fe({idPrefix:e,title:t,description:n,value:r,onChange:i}){let{t:a,lang:o}=(0,ae.useTranslations)(),ee=(0,u.useMemo)(()=>{try{return new Intl.DisplayNames([o],{type:`region`})}catch{return null}},[o]),te=a(`company_name`)===`company_name`?`Company name`:a(`company_name`),ne=a(`select_an_option`)===`select_an_option`?`Select an option`:a(`select_an_option`),l=a(`state_province`)===`state_province`?`State / Province`:a(`state_province`),re=c.getStatesForCountry(r.country_code),ie=c.countryUsesStructuredStates(r.country_code);return(0,f.jsxs)(h.Card,{children:[(0,f.jsxs)(h.CardHeader,{children:[(0,f.jsxs)(h.CardTitle,{role:`heading`,"aria-level":2,className:`flex items-center gap-2`,children:[(0,f.jsx)(d.MapPin,{className:`w-5 h-5`}),t]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n})]}),(0,f.jsxs)(h.CardContent,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(m.Label,{htmlFor:`${e}-company`,children:te}),(0,f.jsx)(p.Input,{id:`${e}-company`,name:`${e}-company`,autoComplete:`${e} organization`,value:r.company_name,onChange:e=>i({...r,company_name:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(m.Label,{htmlFor:`${e}-name`,children:a(`full_name`)}),(0,f.jsx)(p.Input,{id:`${e}-name`,name:`${e}-name`,autoComplete:`${e} name`,required:!0,value:r.recipient_name,onChange:e=>i({...r,recipient_name:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(m.Label,{htmlFor:`${e}-country`,children:a(`country`)}),(0,f.jsx)(`select`,{id:`${e}-country`,name:`${e}-country`,autoComplete:`${e} country`,required:!0,className:`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,value:r.country_code,onChange:e=>{let t=e.target.value,n=c.getStatesForCountry(t);i({...r,country_code:t,state:n.some(e=>e.code===r.state)?r.state:``})},children:s.countries.map(e=>(0,f.jsx)(`option`,{value:e.code,children:ee?.of(e.code)??e.name},e.code))})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(m.Label,{htmlFor:`${e}-line1`,children:a(`address_line_1`)}),(0,f.jsx)(p.Input,{id:`${e}-line1`,name:`${e}-line1`,autoComplete:`${e} address-line1`,required:!0,value:r.line1,onChange:e=>i({...r,line1:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(m.Label,{htmlFor:`${e}-line2`,children:a(`address_line_2`)}),(0,f.jsx)(p.Input,{id:`${e}-line2`,name:`${e}-line2`,autoComplete:`${e} address-line2`,value:r.line2,onChange:e=>i({...r,line2:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(m.Label,{htmlFor:`${e}-city`,children:a(`city`)}),(0,f.jsx)(p.Input,{id:`${e}-city`,name:`${e}-city`,autoComplete:`${e} address-level2`,required:!0,value:r.city,onChange:e=>i({...r,city:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(m.Label,{htmlFor:`${e}-state`,children:a(`state_province`)}),ie?(0,f.jsxs)(`select`,{id:`${e}-state`,name:`${e}-state`,autoComplete:`${e} address-level1`,required:!0,className:`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,value:r.state,onChange:e=>i({...r,state:e.target.value}),children:[(0,f.jsx)(`option`,{value:``,children:`${ne}: ${l}`}),re.map(e=>(0,f.jsx)(`option`,{value:e.code,children:c.getSubdivisionLabel(r.country_code,e,o)},e.code))]}):(0,f.jsx)(p.Input,{id:`${e}-state`,name:`${e}-state`,autoComplete:`${e} address-level1`,value:r.state,onChange:e=>i({...r,state:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(m.Label,{htmlFor:`${e}-postal`,children:a(`postal_zip_code`)}),(0,f.jsx)(p.Input,{id:`${e}-postal`,name:`${e}-postal`,autoComplete:`${e} postal-code`,required:!0,value:r.postal_code,onChange:e=>i({...r,postal_code:e.target.value})})]})]})]})]})}function pe({title:e,description:t,badgeLabel:n,children:r}){return(0,f.jsxs)(h.Card,{children:[(0,f.jsx)(h.CardHeader,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(h.CardTitle,{role:`heading`,"aria-level":2,children:e}),(0,f.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:t})]}),n?(0,f.jsx)(re.Badge,{variant:`secondary`,children:n}):null]})}),(0,f.jsx)(h.CardContent,{className:`space-y-4`,children:r})]})}var y=({initialCustomer:s})=>{let y=i.usePriceFormatter(),[me,he]=(0,u.useState)({}),[b,x]=(0,u.useState)(null),[S,C]=(0,u.useState)({}),[w,ge]=(0,u.useState)(s?.email||``),[T,_e]=(0,u.useState)(``),[E,ve]=(0,u.useState)(s?.phone||``),[ye,be]=(0,u.useState)(!1),[xe,Se]=(0,u.useState)(null),[Ce,D]=(0,u.useState)(!1),[we,Te]=(0,u.useState)(!1),[Ee,O]=(0,u.useState)(!1),[k,A]=(0,u.useState)([]),[j,M]=(0,u.useState)(null),[N,P]=(0,u.useState)(null),[F,De]=(0,u.useState)(null),[I,Oe]=(0,u.useState)(()=>v(s?.billingAddress,s?.fullName)),[L,ke]=(0,u.useState)(()=>v(s?.shippingAddress??s?.billingAddress,s?.fullName)),[R,Ae]=(0,u.useState)(!s?.shippingAddress||l.addressesMatch(s?.billingAddress,s?.shippingAddress)),z=r.useCart(e=>e),{t:B,lang:je}=(0,ae.useTranslations)(),{activeCurrencyCode:V,currencies:H}=t.useCurrency(),Me=te.usePaymentReadiness(),U=z?.items??[],W=(0,u.useMemo)(()=>U.filter(t=>!e.isDigitalItem(t)),[U]),G=(0,u.useMemo)(()=>U.filter(t=>e.isDigitalItem(t)),[U]),K=s?.isAuthenticated??!1,q=(e,t,n)=>{let r=B(e,n);if(r!==e)return r;if(!n)return t;let i=t;return Object.entries(n).forEach(([e,t])=>{i=i.replace(RegExp(`\\{${e}\\}`,`g`),String(t))}),i},J=W.length>0,Ne=(0,u.useMemo)(()=>de(U,V,H),[V,H,U]),Pe=(0,u.useMemo)(()=>de(W,V,H),[V,H,W]),Fe=(0,u.useMemo)(()=>de(G,V,H),[V,H,G]),Ie=F?.providerDiscounts.stripe??0,Le=F?.providerDiscounts.freemius??0,Y=Math.max(0,Pe-Ie),Re=Math.max(0,Fe-Le),X=(0,u.useMemo)(()=>R?I:L,[I,L,R]),Z=(0,u.useMemo)(()=>J?X:I,[I,J,X]),Q=!J||ue(X),$=(0,u.useMemo)(()=>k.find(e=>e.id===j),[k,j]),ze=(0,u.useMemo)(()=>Y+($?.amount??0)+(N&&!N.isPendingExternalCalculation?N.amount:0),[Y,$,N]),Be=ze+Re;if((0,u.useEffect)(()=>{if(!(K||typeof window>`u`))try{let e=window.localStorage.getItem(_);if(!e)return;let t=JSON.parse(e);t.email&&ge(t.email),t.phone&&ve(t.phone),t.billingAddress&&Oe(v(t.billingAddress)),t.shippingAddress&&ke(v(t.shippingAddress)),typeof t.useBillingForShipping==`boolean`&&Ae(t.useBillingForShipping),(typeof t.selectedMethodId==`string`||t.selectedMethodId===null)&&M(t.selectedMethodId)}catch(e){console.error(`[Checkout] Failed to restore checkout draft:`,e)}},[K]),(0,u.useEffect)(()=>{if(typeof window<`u`)try{if(K){window.localStorage.removeItem(_);return}window.localStorage.setItem(_,JSON.stringify({email:w,phone:E,billingAddress:I,shippingAddress:L,useBillingForShipping:R,selectedMethodId:j}))}catch{}},[I,w,K,E,j,L,R]),(0,u.useEffect)(()=>{if(!J){A([]),M(null),D(!1);return}if(!Q){A([]),M(null),D(!1);return}let e=!1,t=setTimeout(async()=>{if(X.country_code){D(!0),Te(!1);try{let t=await ee.getShippingEstimates(Y,{country:X.country_code,state:X.state,postal_code:X.postal_code},je,V);if(e)return;if(t.success&&t.methods){let e=t.methods;A(e),M(t=>t&&e.some(e=>e.id===t)?t:e[0]?.id??null)}else A([]),M(null)}catch(t){if(e)return;console.error(`[Checkout] Failed to load shipping rates:`,t),A([]),M(null),Te(!0)}finally{e||D(!1)}}},400);return()=>{e=!0,clearTimeout(t)}},[V,J,Q,je,X.country_code,X.postal_code,X.state,Y]),(0,u.useEffect)(()=>{let e=!1,t=setTimeout(async()=>{if(!J||!Z.country_code){O(!1),P(null);return}if(c.countryUsesStructuredStates(Z.country_code)&&!Z.state){O(!1),P(null);return}O(!0);try{let t=await ne.getTaxEstimate(W,{country_code:Z.country_code,state:Z.state},V,F?.code??null,U);if(e)return;P(t.success&&t.tax?t.tax:null)}catch(t){if(e)return;console.error(`[Checkout] Failed to load the tax estimate:`,t),P(null)}finally{e||O(!1)}},300);return()=>{e=!0,clearTimeout(t)}},[V,J,W,Z.country_code,Z.state,F?.code,U]),(0,u.useEffect)(()=>{let e=e=>{e.persisted&&x(null)};return window.addEventListener(`pageshow`,e),()=>window.removeEventListener(`pageshow`,e)},[]),!z)return(0,f.jsxs)(`div`,{role:`status`,"aria-busy":`true`,className:`container mx-auto px-4 py-12 md:px-6`,children:[(0,f.jsx)(`span`,{className:`sr-only`,children:B(`loading`)===`loading`?`Loading…`:B(`loading`)}),(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl`,children:[(0,f.jsx)(`div`,{className:`mb-8 h-9 w-48 rounded-md bg-muted`}),(0,f.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-12 lg:items-start`,children:[(0,f.jsxs)(`div`,{className:`space-y-6 lg:col-span-8`,children:[(0,f.jsx)(`div`,{className:`h-56 rounded-xl border bg-muted/40`}),(0,f.jsx)(`div`,{className:`h-96 rounded-xl border bg-muted/40`})]}),(0,f.jsx)(`div`,{className:`lg:col-span-4`,children:(0,f.jsx)(`div`,{className:`h-72 rounded-xl border bg-muted/40`})})]})]})]});let Ve=()=>{be(!1),Se(null)},He=ye?(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center overscroll-contain bg-black/60 backdrop-blur-sm`,onClick:Ve,onKeyDown:e=>{e.key===`Escape`&&Ve()},children:(0,f.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`sandbox-checkout-title`,className:`relative bg-background border rounded-xl shadow-2xl p-8 max-w-md mx-4`,onClick:e=>e.stopPropagation(),children:[(0,f.jsx)(`button`,{type:`button`,autoFocus:!0,onClick:Ve,"aria-label":q(`close`,`Close`),className:`absolute top-4 right-4 inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring`,children:(0,f.jsx)(d.X,{className:`w-5 h-5`})}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,f.jsx)(`div`,{className:`p-2 rounded-full bg-amber-100 dark:bg-amber-900/20`,children:(0,f.jsx)(d.FlaskConical,{className:`h-6 w-6 text-amber-600 dark:text-amber-400`})}),(0,f.jsx)(`h2`,{id:`sandbox-checkout-title`,className:`text-xl font-semibold`,children:B(`ecommerce.checkout_successful`)})]}),(0,f.jsx)(`p`,{className:`text-muted-foreground mb-2`,children:B(`ecommerce.sandbox_notice`)}),(0,f.jsx)(`p`,{className:`text-muted-foreground mb-2`,children:xe===`stripe`?q(`ecommerce.sandbox_checkout_stripe_description`,`This simulated step represents the Stripe checkout for physical products.`):q(`ecommerce.sandbox_checkout_freemius_description`,`This simulated step represents the Freemius checkout for digital products.`)}),(0,f.jsx)(`p`,{className:`text-muted-foreground mb-6`,children:B(`ecommerce.license_notice`)}),(0,f.jsx)(`a`,{href:`https://nextblock.dev`,target:`_blank`,rel:`noopener noreferrer`,className:`block w-full text-center py-3 px-4 rounded-lg bg-primary text-primary-foreground font-semibold hover:opacity-90 transition-opacity`,children:B(`ecommerce.purchase_at`)})]})}):null,Ue=(e,t,n)=>(C(n=>({...n,[e]:t})),n&&document.getElementById(n)?.focus(),null),We=(e,t)=>t.recipient_name.trim()?t.line1.trim()?t.city.trim()?c.countryUsesStructuredStates(t.country_code)&&!t.state?`${e}-state`:t.postal_code.trim()?`${e}-line1`:`${e}-postal`:`${e}-city`:`${e}-line1`:`${e}-name`,Ge=e=>{if(!K&&(!w||!/^\S+@\S+\.\S+$/.test(w)))return _e(B(`ecommerce.invalid_email`)),Ue(e,B(`ecommerce.invalid_email`),`checkout-email`);let t=l.normalizeCustomerAddress(I);if(!l.isCustomerAddressComplete(t))return Ue(e,B(`checkout_complete_billing_address`),We(`billing`,I));let n=J?l.normalizeCustomerAddress(R?I:L):null;if(e===`stripe`){if(!l.isCustomerAddressComplete(n))return Ue(e,B(`checkout_complete_shipping_address`),R?We(`billing`,I):We(`shipping`,L));if(!j)return Ue(e,q(`ecommerce.shipping_method_required`,`Please select a shipping method before continuing.`))}return _e(``),{normalizedBillingAddress:t,normalizedShippingAddress:n}},Ke=async(e,t,n)=>{C(t=>({...t,[e]:``}));let r=Ge(e);if(r){if(le){let n=new Set(t.map(e=>e.id)),r=U.filter(e=>!n.has(e.id));if(z.setItems(r),r.length===0&&z.removeCoupon(),Se(e),be(!0),typeof window<`u`&&r.length===0)try{window.localStorage.removeItem(_)}catch{}return}x(n);try{let n=await fetch(`/api/checkout`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({items:t,customerEmail:K?void 0:w,customerPhone:E||null,billingAddress:r.normalizedBillingAddress,shippingAddress:e===`stripe`?r.normalizedShippingAddress:null,shippingMethodId:e===`stripe`?j:null,locale:je,currencyCode:V,couponCode:F?.code??z.appliedCoupon?.code??null,couponContextItems:U})}),i=await n.json();if(!n.ok){let t=i?.errorKey&&typeof i.errorKey==`string`?q(i.errorKey,i?.error||q(`ecommerce.generic_error`,`Something went wrong.`),i.errorParams):i?.error||B(`ecommerce.generic_error`);C(n=>({...n,[e]:t})),x(null);return}if(i.customProps&&i.customProps.provider===`freemius`){let t=i.customProps,n=null,r=()=>{window.location.href=`/checkout/success?session_id=${t.order_id}`},a=e=>(n||=fetch(`/api/checkout/freemius/sync`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({orderId:t.order_id,checkoutResponse:e})}).then(async e=>{if(!e.ok){let t=await e.json().catch(()=>null);console.error(`Freemius checkout sync failed:`,t)}}),n),o={product_id:t.plugin_id,public_key:t.public_key,sandbox:t.sandbox},s={name:B(`ecommerce.checkout_overlay_title`),plan_id:t.plan_id,...t.billing_cycle?{billing_cycle:t.billing_cycle}:{},...t.trial?{trial:t.trial}:{},...t.coupon?{coupon:t.coupon}:{},user_email:t.user_email,user_firstname:t.user_firstname,user_lastname:t.user_lastname,sandbox:t.sandbox,purchaseCompleted:function(e){a(e)},success:function(e){(async()=>{try{await a(e)}finally{r()}})()}};try{new ce.Checkout(o).open(s),x(null)}catch(t){console.error(`[Checkout] Freemius overlay failed to open:`,t),C(t=>({...t,[e]:B(`ecommerce.checkout_popup_blocked`)})),i.url&&(window.location.href=i.url),x(null)}}else i.url?window.location.href=i.url:(C(t=>({...t,[e]:B(`ecommerce.checkout_failed`)+(i.error||q(`ecommerce.unknown_error`,`Unknown error`))})),x(null))}catch(t){console.error(t),C(t=>({...t,[e]:B(`ecommerce.generic_error`)})),x(null)}}};if(U.length===0)return(0,f.jsxs)(f.Fragment,{children:[He,(0,f.jsxs)(`div`,{className:`container mx-auto flex min-h-[50vh] flex-col items-center justify-center p-8 text-center`,children:[(0,f.jsx)(`h1`,{className:`mb-4 text-2xl font-bold`,children:B(`ecommerce.cart_empty`)}),(0,f.jsx)(`p`,{className:`mb-8 text-muted-foreground`,children:B(`ecommerce.cart_empty_description`)}),(0,f.jsx)(ie.Button,{asChild:!0,children:(0,f.jsx)(`a`,{href:`/shop`,children:B(`ecommerce.go_to_shop`)})})]})]});let qe=q(`ecommerce.checkout_payments_unavailable`,`This store is not able to take payments right now. Please contact the seller to complete your purchase.`),Je=Me.stripe?null:qe,Ye=Me.freemius?null:qe,Xe=Je||(J?Q?Ce?q(`ecommerce.calculating_shipping`,`Calculating shipping...`):j?null:k.length>0?B(`ecommerce.select_rate`):B(`ecommerce.no_rates_for_region`):q(`ecommerce.waiting_on_address_info`,`Complete your shipping address to view available shipping options.`):null),Ze=b!==null||Xe!==null,Qe=W.length===1?q(`ecommerce.item_count_one`,`{count} item`,{count:W.length}):q(`ecommerce.item_count_other`,`{count} items`,{count:W.length}),$e=G.length===1?q(`ecommerce.license_count_one`,`{count} license`,{count:G.length}):q(`ecommerce.license_count_other`,`{count} licenses`,{count:G.length}),et=t=>e.isDigitalItem(t)?q(`ecommerce.digital_label`,`Digital`):q(`ecommerce.physical_label`,`Physical`),tt=e=>e===`monthly`?q(`ecommerce.checkout_billing_cycle_monthly`,`Monthly subscription`):e===`annual`?q(`ecommerce.checkout_billing_cycle_annual`,`Annual subscription`):e===`lifetime`?q(`ecommerce.checkout_billing_cycle_lifetime`,`Lifetime subscription`):null;return(0,f.jsxs)(`div`,{className:`container mx-auto px-4 py-12 md:px-6`,children:[He,(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl`,children:[(0,f.jsx)(`h1`,{className:`mb-8 text-3xl font-bold`,children:B(`ecommerce.checkout`)}),(0,f.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-12 lg:items-start`,children:[(0,f.jsxs)(`div`,{className:`lg:col-span-8 space-y-6`,children:[(0,f.jsxs)(h.Card,{children:[(0,f.jsx)(h.CardHeader,{children:(0,f.jsxs)(h.CardTitle,{role:`heading`,"aria-level":2,className:`flex items-center gap-2`,children:[(0,f.jsx)(d.CreditCard,{className:`w-5 h-5`}),B(`ecommerce.contact_information`)]})}),(0,f.jsxs)(h.CardContent,{className:`space-y-4`,children:[K?(0,f.jsx)(`div`,{className:`rounded-xl border bg-muted/20 p-4 text-sm text-muted-foreground`,children:B(`checkout_prefill_notice`,{email:s?.email||``})}):(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(m.Label,{htmlFor:`checkout-email`,children:[B(`ecommerce.email_address`),` `,(0,f.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,f.jsx)(p.Input,{id:`checkout-email`,name:`email`,type:`email`,autoComplete:`email`,spellCheck:!1,"aria-invalid":T?!0:void 0,"aria-describedby":T?`checkout-email-error`:void 0,placeholder:B(`ecommerce.email_placeholder`),value:w,onChange:e=>{ge(e.target.value),T&&_e(``)},required:!0}),T?(0,f.jsx)(`p`,{id:`checkout-email-error`,role:`alert`,className:`text-xs text-destructive mt-1`,children:T}):null]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(m.Label,{htmlFor:`checkout-phone`,children:B(`phone_number`)}),(0,f.jsx)(p.Input,{id:`checkout-phone`,name:`phone`,type:`tel`,inputMode:`tel`,autoComplete:`tel`,placeholder:B(`optional`),value:E,onChange:e=>ve(e.target.value)})]})]})]}),(0,f.jsx)(fe,{idPrefix:`billing`,title:B(`billing_address`),description:B(`checkout_billing_address_help`),value:I,onChange:Oe}),J?(0,f.jsxs)(`div`,{className:`flex items-center space-x-3 rounded-xl border bg-muted/20 p-4`,children:[(0,f.jsx)(oe.Checkbox,{id:`use-billing-for-shipping`,checked:R,onCheckedChange:e=>Ae(!!e)}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(m.Label,{htmlFor:`use-billing-for-shipping`,className:`cursor-pointer`,children:B(`use_billing_for_shipping`)}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:B(`checkout_use_billing_for_shipping_help`)})]})]}):null,J&&!R?(0,f.jsx)(fe,{idPrefix:`shipping`,title:B(`shipping_address`),description:B(`checkout_shipping_address_help`),value:L,onChange:ke}):null,J?(0,f.jsxs)(h.Card,{children:[(0,f.jsx)(h.CardHeader,{children:(0,f.jsxs)(h.CardTitle,{role:`heading`,"aria-level":2,className:`flex items-center gap-2`,children:[(0,f.jsx)(d.ChevronRight,{className:`w-5 h-5 text-primary`}),B(`ecommerce.shipping_method`)]})}),(0,f.jsx)(h.CardContent,{children:Ce?(0,f.jsxs)(`div`,{role:`status`,className:`flex items-center justify-center py-6`,children:[(0,f.jsx)(d.Loader2,{className:`w-6 h-6 animate-spin text-muted-foreground`}),(0,f.jsx)(`span`,{className:`sr-only`,children:q(`ecommerce.calculating_shipping`,`Calculating shipping…`)})]}):we?(0,f.jsx)(`div`,{role:`alert`,className:`rounded-lg bg-destructive/10 px-4 py-3 text-center text-sm text-destructive`,children:q(`ecommerce.shipping_calculation_failed`,`We couldn't calculate shipping right now. Please try again.`)}):k.length>0?(0,f.jsx)(g.RadioGroup,{value:j??``,onValueChange:M,"aria-label":B(`ecommerce.shipping_method`),className:`space-y-3`,children:k.map(e=>(0,f.jsxs)(m.Label,{htmlFor:`shipping-method-${e.id}`,className:`flex items-center justify-between gap-3 p-4 rounded-lg border-2 cursor-pointer transition-colors ${j===e.id?`border-primary bg-primary/5`:`border-border hover:border-muted-foreground/40`}`,children:[(0,f.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3`,children:[(0,f.jsx)(g.RadioGroupItem,{id:`shipping-method-${e.id}`,value:e.id}),(0,f.jsx)(`span`,{className:`font-medium break-words`,children:e.name})]}),(0,f.jsx)(`span`,{className:`font-bold tabular-nums`,children:y(e.amount,V)})]},e.id))}):(0,f.jsx)(`div`,{className:`py-4 text-center text-muted-foreground bg-muted/30 rounded-lg italic`,children:Q?B(`ecommerce.no_rates_for_region`):q(`ecommerce.waiting_on_address_info`,`Complete your shipping address to view available shipping options.`)})})]}):null]}),(0,f.jsxs)(`div`,{className:`lg:col-span-4 space-y-6`,children:[(0,f.jsxs)(h.Card,{className:`top-6`,children:[(0,f.jsx)(h.CardHeader,{children:(0,f.jsx)(h.CardTitle,{role:`heading`,"aria-level":2,children:B(`ecommerce.order_summary`)})}),(0,f.jsxs)(h.CardContent,{className:`space-y-4`,children:[(0,f.jsx)(`div`,{className:`space-y-3 max-h-[260px] overflow-y-auto pr-2`,children:U.map(e=>{let t=n.getCartItemActivePrice(e,{currencyCode:V,currencies:H}),r=a.getTrialSummary(e,B);return(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[e.image_url?(0,f.jsx)(`div`,{className:`h-10 w-10 shrink-0 overflow-hidden rounded border bg-neutral-100`,children:(0,f.jsx)(`img`,{src:e.image_url,alt:e.title,className:`h-full w-full object-cover`})}):null,(0,f.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium text-xs line-clamp-1`,children:e.title}),(0,f.jsx)(re.Badge,{variant:`outline`,className:`text-[9px] uppercase`,children:et(e)})]}),e.variant_label?(0,f.jsx)(`span`,{className:`text-[10px] text-muted-foreground line-clamp-1`,children:e.variant_label}):null,(0,f.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[B(`ecommerce.qty`),`: `,e.quantity]}),r?(0,f.jsxs)(`span`,{className:`text-[10px] font-medium text-emerald-700`,children:[r.label,` - `,r.paymentRequirementLabel]}):null]})]}),(0,f.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5 shrink-0`,children:[(0,f.jsx)(`span`,{className:`font-medium text-xs`,children:y((t.sale_price??t.price)*e.quantity,V)}),t.sale_price?(0,f.jsx)(`span`,{className:`text-[9px] text-muted-foreground line-through`,children:y(t.price*e.quantity,V)}):null]})]},`${e.id}-${e.variant_id||`base`}`)})}),(0,f.jsx)(se.Separator,{}),(0,f.jsx)(o.CouponForm,{items:U,currencyCode:V,onQuoteChange:De}),(0,f.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{children:B(`ecommerce.subtotal`)}),(0,f.jsx)(`span`,{children:y(Ne,V)})]}),W.length>0?(0,f.jsxs)(`div`,{className:`flex justify-between text-muted-foreground`,children:[(0,f.jsx)(`span`,{children:q(`ecommerce.physical_products`,`Physical products`)}),(0,f.jsx)(`span`,{children:y(Pe,V)})]}):null,G.length>0?(0,f.jsxs)(`div`,{className:`flex justify-between text-muted-foreground`,children:[(0,f.jsx)(`span`,{children:q(`ecommerce.digital_products`,`Digital products`)}),(0,f.jsx)(`span`,{children:y(Fe,V)})]}):null,F?(0,f.jsxs)(`div`,{className:`flex justify-between text-emerald-600`,children:[(0,f.jsxs)(`span`,{children:[q(`ecommerce.discount`,`Discount`),` (`,F.code,`)`]}),(0,f.jsxs)(`span`,{children:[`-`,y(F.discountTotal,V)]})]}):null,(W.length>0||G.length>0)&&(0,f.jsxs)(`div`,{className:`flex justify-between font-bold text-lg pt-2 border-t mt-2`,children:[(0,f.jsx)(`span`,{children:q(`ecommerce.estimated_total`,`Estimated total`)}),(0,f.jsx)(`span`,{className:`text-primary`,children:y(Be,V)})]})]})]})]}),W.length>0?(0,f.jsxs)(pe,{title:q(`ecommerce.stripe_checkout_title`,`Stripe Checkout`),description:q(`ecommerce.stripe_checkout_description`,`Pay for physical products in one Stripe checkout session.`),badgeLabel:Qe,children:[(0,f.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{children:q(`ecommerce.physical_subtotal`,`Physical subtotal`)}),(0,f.jsx)(`span`,{children:y(Pe,V)})]}),Ie>0?(0,f.jsxs)(`div`,{className:`flex justify-between text-emerald-600`,children:[(0,f.jsx)(`span`,{children:q(`ecommerce.discount`,`Discount`)}),(0,f.jsxs)(`span`,{children:[`-`,y(Ie,V)]})]}):null,(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{children:B(`ecommerce.shipping`)}),(0,f.jsx)(`span`,{children:$?y($.amount,V):`-`})]}),(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{children:q(`ecommerce.tax`,`Tax`)}),(0,f.jsx)(`span`,{children:Ee?`...`:N?.isPendingExternalCalculation?q(`ecommerce.tax_calculated_on_stripe`,`Calculated on Stripe`):N?y(N.amount,V):`-`})]}),N&&N.lines.length>0?(0,f.jsx)(`div`,{className:`rounded-lg bg-muted/20 px-3 py-2 text-xs text-muted-foreground`,children:N.lines.map(e=>(0,f.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,f.jsxs)(`span`,{children:[e.name,` (`,e.rate.toFixed(4),`%)`]}),(0,f.jsx)(`span`,{children:y(e.amount,V)})]},e.id||`${e.name}-${e.rate}`))}):null,(0,f.jsxs)(`div`,{className:`flex justify-between font-semibold pt-2 border-t`,children:[(0,f.jsx)(`span`,{children:q(`ecommerce.total_on_stripe`,`Total on Stripe`)}),(0,f.jsx)(`span`,{children:y(ze,V)})]})]}),(0,f.jsxs)(ie.Button,{className:`w-full`,size:`lg`,onClick:()=>Ke(`stripe`,W,`stripe`),disabled:Ze,children:[b===`stripe`?(0,f.jsx)(d.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}):(0,f.jsx)(d.Package,{className:`mr-2 h-4 w-4`}),b===`stripe`?B(`ecommerce.processing`):q(`ecommerce.checkout_physical_products`,`Checkout Physical Products`)]}),Xe&&b===null?(0,f.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:Xe}):null,S.stripe?(0,f.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:S.stripe}):null,(0,f.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:N?.isPendingExternalCalculation?q(`checkout_stripe_tax_finalized_notice`,`Tax will be finalized by Stripe Tax on the payment step.`):q(`ecommerce.shipping_taxes_collected_on_stripe`,`Shipping and taxes are only collected during the Stripe step for physical products.`)})]}):null,G.length>0?(0,f.jsxs)(pe,{title:q(`ecommerce.freemius_checkout_title`,`Freemius Checkout`),description:q(`ecommerce.freemius_checkout_description`,`Digital products use the Freemius checkout flow.`),badgeLabel:$e,children:[(0,f.jsx)(`div`,{className:`space-y-3`,children:G.map(e=>{let t=n.getCartItemActivePrice(e,{currencyCode:V,currencies:H}),r=a.getTrialSummary(e,B),i=`freemius:${e.id}`,o=r?me[i]||`paid`:void 0;return(0,f.jsxs)(`div`,{className:`rounded-lg border p-3 space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`font-medium`,children:e.title}),e.billing_cycle?(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground capitalize`,children:tt(e.billing_cycle)}):null,r?(0,f.jsxs)(`p`,{className:`text-xs font-medium text-emerald-700`,children:[r.label,` - `,r.paymentRequirementLabel]}):null]}),(0,f.jsx)(`span`,{className:`font-medium`,children:y(t.sale_price??t.price,V)})]}),r&&!e.trial_requires_payment_method&&(0,f.jsxs)(`div`,{className:`bg-muted/30 p-3 rounded-md border text-sm mt-2 mb-3`,children:[(0,f.jsx)(`p`,{className:`font-medium mb-3`,children:q(`ecommerce.freemius_trial_preference_title`,`How would you like to start your trial?`)}),(0,f.jsxs)(g.RadioGroup,{value:me[i]||`paid`,onValueChange:e=>he(t=>({...t,[i]:e})),className:`gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-start space-x-3`,children:[(0,f.jsx)(g.RadioGroupItem,{value:`paid`,id:`${i}-paid`,className:`mt-1`}),(0,f.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,f.jsx)(m.Label,{htmlFor:`${i}-paid`,className:`font-medium leading-none cursor-pointer`,children:q(`ecommerce.freemius_trial_with_card`,`Enter Payment Details Now (Still get full trial length free)`)}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:q(`ecommerce.freemius_trial_with_card_help`,`You will not be billed until the trial ends. Cancel anytime.`)})]})]}),(0,f.jsxs)(`div`,{className:`flex items-start space-x-3`,children:[(0,f.jsx)(g.RadioGroupItem,{value:`free`,id:`${i}-free`,className:`mt-1`}),(0,f.jsx)(`div`,{className:`grid gap-1.5`,children:(0,f.jsx)(m.Label,{htmlFor:`${i}-free`,className:`font-medium leading-none cursor-pointer`,children:q(`ecommerce.freemius_trial_no_card`,`Start Free Trial (No card required)`)})})]})]})]}),(0,f.jsxs)(ie.Button,{className:`w-full h-auto min-h-[2.75rem] py-2`,onClick:()=>Ke(`freemius`,[{...e,...o?{trial_preference:o}:{}}],i),disabled:b!==null||Ye!==null,children:[b===i?(0,f.jsx)(d.Loader2,{className:`mr-2 h-4 w-4 shrink-0 animate-spin`}):(0,f.jsx)(d.Download,{className:`mr-2 h-4 w-4 shrink-0`}),(0,f.jsx)(`span`,{className:`whitespace-normal text-left`,children:b===i?B(`ecommerce.processing`):G.length>1?q(`ecommerce.checkout_product`,`Checkout {title}`,{title:e.title}):q(`ecommerce.checkout_digital_product`,`Checkout Digital Product`)})]})]},i)})}),(0,f.jsxs)(`div`,{className:`flex justify-between text-sm font-semibold border-t pt-3`,children:[(0,f.jsx)(`span`,{children:q(`ecommerce.digital_subtotal`,`Digital subtotal`)}),(0,f.jsx)(`span`,{children:y(Fe,V)})]}),Le>0?(0,f.jsxs)(`div`,{className:`flex justify-between text-sm font-semibold text-emerald-600`,children:[(0,f.jsx)(`span`,{children:q(`ecommerce.discount`,`Discount`)}),(0,f.jsxs)(`span`,{children:[`-`,y(Le,V)]})]}):null,Ye?(0,f.jsx)(`div`,{className:`rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs`,children:Ye}):null,S.freemius?(0,f.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:S.freemius}):null,(0,f.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:G.length>1?q(`ecommerce.freemius_multi_checkout_notice`,`Freemius licenses are completed one at a time, so each digital product gets its own checkout action.`):q(`ecommerce.freemius_tax_notice`,`Taxes and compliance for digital products are handled inside the Freemius checkout.`)})]}):null]})]})]})]})};exports.Checkout=y;
|
|
@@ -2,5 +2,5 @@ import { CheckoutCustomerDefaults } from '../customer';
|
|
|
2
2
|
interface CheckoutProps {
|
|
3
3
|
initialCustomer?: CheckoutCustomerDefaults;
|
|
4
4
|
}
|
|
5
|
-
export declare const Checkout: ({ initialCustomer }: CheckoutProps) => import(
|
|
5
|
+
export declare const Checkout: ({ initialCustomer }: CheckoutProps) => import('react').JSX.Element;
|
|
6
6
|
export {};
|