@nextblock-cms/ecom 0.20.3 → 0.21.0
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/_virtual/_rolldown/runtime.cjs.js +1 -0
- package/index.cjs.js +1 -1
- package/index.es.js +38 -146
- package/lib/CurrencyProvider.cjs.js +1 -1
- package/lib/CurrencyProvider.d.ts +1 -1
- package/lib/CurrencyProvider.es.js +85 -95
- package/lib/PaymentReadinessProvider.cjs.js +1 -1
- package/lib/PaymentReadinessProvider.d.ts +1 -1
- package/lib/PaymentReadinessProvider.es.js +24 -27
- package/lib/cart-store.cjs.js +1 -1
- package/lib/cart-store.es.js +109 -121
- package/lib/components/AccountNavigationMenu.cjs.js +1 -1
- package/lib/components/AccountNavigationMenu.d.ts +1 -1
- package/lib/components/AccountNavigationMenu.es.js +36 -50
- package/lib/components/AddToCartButton.cjs.js +1 -1
- package/lib/components/AddToCartButton.d.ts +1 -1
- package/lib/components/AddToCartButton.es.js +94 -89
- package/lib/components/Cart.cjs.js +1 -1
- package/lib/components/Cart.d.ts +1 -1
- package/lib/components/Cart.es.js +261 -180
- package/lib/components/CartDrawer.cjs.js +1 -1
- package/lib/components/CartDrawer.d.ts +1 -1
- package/lib/components/CartDrawer.es.js +218 -148
- package/lib/components/CartIcon.cjs.js +1 -1
- package/lib/components/CartIcon.d.ts +1 -1
- package/lib/components/CartIcon.es.js +33 -35
- package/lib/components/Checkout.cjs.js +1 -1
- package/lib/components/Checkout.d.ts +1 -1
- package/lib/components/Checkout.es.js +1092 -1108
- package/lib/components/CouponForm.cjs.js +1 -1
- package/lib/components/CouponForm.d.ts +1 -1
- package/lib/components/CouponForm.es.js +136 -148
- package/lib/components/CurrencySwitcher.cjs.js +1 -1
- package/lib/components/CurrencySwitcher.d.ts +1 -1
- package/lib/components/CurrencySwitcher.es.js +22 -18
- package/lib/components/CustomerProfileForm.cjs.js +1 -1
- package/lib/components/CustomerProfileForm.es.js +454 -313
- package/lib/components/FeaturedProduct.cjs.js +1 -1
- package/lib/components/FeaturedProduct.d.ts +1 -1
- package/lib/components/FeaturedProduct.es.js +98 -83
- package/lib/components/FreemiusLicensePanel.cjs.js +1 -1
- package/lib/components/FreemiusLicensePanel.d.ts +1 -1
- package/lib/components/FreemiusLicensePanel.es.js +70 -65
- package/lib/components/InvoiceDocument.cjs.js +1 -1
- package/lib/components/InvoiceDocument.es.js +256 -192
- package/lib/components/InvoiceViewerShell.cjs.js +2 -2
- package/lib/components/InvoiceViewerShell.d.ts +1 -1
- package/lib/components/InvoiceViewerShell.es.js +75 -106
- package/lib/components/ProductCard.cjs.js +1 -1
- package/lib/components/ProductCard.d.ts +1 -1
- package/lib/components/ProductCard.es.js +186 -171
- package/lib/components/ProductDetailsLayout.cjs.js +1 -1
- package/lib/components/ProductDetailsLayout.es.js +405 -404
- package/lib/components/ProductGallery.cjs.js +1 -1
- package/lib/components/ProductGallery.d.ts +1 -1
- package/lib/components/ProductGallery.es.js +51 -54
- package/lib/components/ProductGrid.cjs.js +1 -1
- package/lib/components/ProductGrid.d.ts +1 -1
- package/lib/components/ProductGrid.es.js +23 -25
- package/lib/components/ShippingEstimator.cjs.js +1 -1
- package/lib/components/ShippingEstimator.d.ts +1 -1
- package/lib/components/ShippingEstimator.es.js +158 -153
- package/lib/components/ShortDescription.cjs.js +1 -1
- package/lib/components/ShortDescription.es.js +17 -17
- package/lib/components/SimpleTiptapRenderer.cjs.js +1 -1
- package/lib/components/SimpleTiptapRenderer.es.js +238 -211
- package/lib/components/SubscriptionSelector.cjs.js +1 -1
- package/lib/components/SubscriptionSelector.es.js +159 -154
- package/lib/countries.cjs.js +1 -1
- package/lib/countries.es.js +232 -75
- package/lib/coupon-server.cjs.js +1 -1
- package/lib/coupon-server.es.js +180 -224
- package/lib/coupons.cjs.js +1 -1
- package/lib/coupons.es.js +12 -14
- package/lib/currency-constants.cjs.js +1 -1
- package/lib/currency-constants.es.js +4 -4
- package/lib/currency-rest-client.cjs.js +1 -1
- package/lib/currency-rest-client.es.js +15 -22
- package/lib/currency-store.cjs.js +1 -1
- package/lib/currency-store.es.js +20 -27
- package/lib/currency-sync.cjs.js +1 -1
- package/lib/currency-sync.es.js +124 -170
- package/lib/currency.cjs.js +1 -1
- package/lib/currency.es.js +242 -310
- package/lib/customer-addresses.cjs.js +1 -1
- package/lib/customer-addresses.es.js +80 -109
- package/lib/customer-orders.cjs.js +1 -1
- package/lib/customer-orders.es.js +31 -43
- package/lib/customer.cjs.js +1 -1
- package/lib/customer.es.js +43 -52
- package/lib/export-helpers.cjs.js +1 -1
- package/lib/export-helpers.es.js +53 -52
- package/lib/factory.cjs.js +1 -1
- package/lib/factory.es.js +10 -7
- package/lib/freemius-coupons.cjs.js +1 -1
- package/lib/freemius-coupons.es.js +245 -262
- package/lib/freemius-license-claim.cjs.js +1 -1
- package/lib/freemius-license-claim.es.js +87 -71
- package/lib/freemius-license.cjs.js +1 -1
- package/lib/freemius-license.es.js +32 -39
- package/lib/freemius-order-sync.cjs.js +1 -1
- package/lib/freemius-order-sync.es.js +226 -290
- package/lib/freemius-trial-provision.cjs.js +1 -1
- package/lib/freemius-trial-provision.es.js +136 -130
- package/lib/inventory-settings.cjs.js +1 -1
- package/lib/inventory-settings.es.js +69 -77
- package/lib/invoice-server.cjs.js +3 -3
- package/lib/invoice-server.es.js +94 -141
- package/lib/invoice-ui.cjs.js +1 -1
- package/lib/invoice-ui.es.js +50 -66
- package/lib/invoice.cjs.js +1 -1
- package/lib/invoice.es.js +85 -94
- package/lib/order-inventory.cjs.js +25 -25
- package/lib/order-inventory.es.js +67 -79
- package/lib/order-tax-details.cjs.js +1 -1
- package/lib/order-tax-details.es.js +142 -153
- package/lib/pages/cms/coupons/CouponEditorForm.cjs.js +1 -1
- 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.js +2 -2
- 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.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- package/lib/pages/cms/coupons/actions.es.js +112 -115
- package/lib/pages/cms/coupons/index.cjs.js +1 -0
- package/lib/pages/cms/coupons/index.es.js +3 -0
- package/lib/pages/cms/coupons/product-options.cjs.js +1 -1
- package/lib/pages/cms/coupons/product-options.es.js +21 -23
- package/lib/pages/cms/orders/ExportReportsDialog.cjs.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- 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.js +3 -3
- package/lib/pages/cms/orders/actions.es.js +53 -69
- package/lib/pages/cms/orders/export-actions.cjs.js +1 -1
- package/lib/pages/cms/orders/export-actions.es.js +23 -26
- package/lib/pages/cms/orders/index.cjs.js +1 -0
- package/lib/pages/cms/orders/index.es.js +6 -0
- package/lib/pages/cms/orders/server-actions.cjs.js +1 -1
- package/lib/pages/cms/orders/server-actions.es.js +60 -51
- package/lib/pages/cms/payments/PaymentsClient.cjs.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- package/lib/pages/cms/payments/actions.es.js +38 -48
- package/lib/pages/cms/payments/index.cjs.js +1 -0
- package/lib/pages/cms/payments/index.es.js +3 -0
- package/lib/pages/cms/payments/queries.cjs.js +1 -1
- package/lib/pages/cms/payments/queries.es.js +38 -48
- package/lib/pages/cms/products/ProductsPage.cjs.js +1 -1
- 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.d.ts +1 -1
- package/lib/pages/cms/products/_id_/edit/EditProductPage.cjs.js +1 -1
- package/lib/pages/cms/products/_id_/edit/EditProductPage.es.js +138 -155
- package/lib/pages/cms/products/actions.cjs.js +4 -4
- package/lib/pages/cms/products/actions.es.js +121 -162
- package/lib/pages/cms/products/attributes/AttributeManagementPage.cjs.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- package/lib/pages/cms/products/categories/components/CategoryManager.es.js +315 -262
- package/lib/pages/cms/products/components/CopyProductFromLanguage.cjs.js +1 -1
- package/lib/pages/cms/products/components/CopyProductFromLanguage.es.js +115 -113
- package/lib/pages/cms/products/components/CurrencyPriceFields.cjs.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- package/lib/pages/cms/products/components/ProductCategorySelector.es.js +156 -159
- package/lib/pages/cms/products/components/ProductForm.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductForm.es.js +872 -693
- package/lib/pages/cms/products/components/ProductMediaManager.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductMediaManager.es.js +106 -103
- package/lib/pages/cms/products/components/ProductsBulkTable.cjs.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- 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.js +2 -2
- 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.js +1 -1
- 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.js +1 -0
- package/lib/pages/cms/products/index.es.js +8 -0
- package/lib/pages/cms/products/inventory/InventoryPage.cjs.js +1 -1
- 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.js +2 -2
- 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.js +3 -3
- package/lib/pages/cms/products/inventory/actions.es.js +83 -91
- package/lib/pages/cms/products/new/NewProductPage.cjs.js +1 -1
- 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.js +1 -1
- package/lib/pages/cms/products/product-price-sync.es.js +74 -89
- package/lib/pages/cms/products/server-actions.cjs.js +1 -1
- package/lib/pages/cms/products/server-actions.es.js +250 -233
- package/lib/pages/cms/shipping/ShippingPage.cjs.js +2 -2
- package/lib/pages/cms/shipping/ShippingPage.es.js +287 -209
- package/lib/pages/cms/shipping/components/RateForm.cjs.js +1 -1
- 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.js +1 -1
- package/lib/pages/cms/shipping/components/ZoneForm.es.js +245 -224
- package/lib/pages/cms/shipping/index.cjs.js +1 -0
- package/lib/pages/cms/shipping/index.es.js +3 -0
- package/lib/pages/cms/shipping/server-actions.cjs.js +1 -1
- package/lib/pages/cms/shipping/server-actions.es.js +131 -149
- package/lib/pages/cms/taxes/TaxesPage.cjs.js +1 -1
- 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.js +1 -1
- package/lib/pages/cms/taxes/actions.es.js +41 -53
- package/lib/pages/cms/taxes/components/TaxRateForm.cjs.js +1 -1
- 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.js +1 -0
- package/lib/pages/cms/taxes/index.es.js +3 -0
- package/lib/payment-config.cjs.js +1 -1
- package/lib/payment-config.es.js +110 -126
- package/lib/product-actions.cjs.js +4 -4
- package/lib/product-actions.es.js +289 -544
- package/lib/product-context.cjs.js +1 -1
- package/lib/product-context.es.js +13 -15
- package/lib/product-schema.cjs.js +1 -1
- package/lib/product-schema.es.js +99 -134
- package/lib/providers/freemius.cjs.js +1 -5
- package/lib/providers/freemius.es.js +446 -530
- package/lib/providers/stripe.cjs.js +1 -1
- package/lib/providers/stripe.es.js +417 -477
- package/lib/server-actions/coupon-actions.cjs.js +1 -1
- package/lib/server-actions/coupon-actions.es.js +22 -22
- package/lib/server-actions/customer-actions.cjs.js +1 -1
- package/lib/server-actions/customer-actions.es.js +26 -28
- package/lib/server-actions/product-actions.cjs.js +1 -1
- package/lib/server-actions/product-actions.es.js +9 -15
- package/lib/server-actions/shipping-actions.cjs.js +1 -1
- package/lib/server-actions/shipping-actions.es.js +27 -24
- package/lib/server-actions/tax-actions.cjs.js +1 -1
- package/lib/server-actions/tax-actions.es.js +33 -39
- package/lib/shared-inventory.cjs.js +2 -2
- package/lib/shared-inventory.es.js +111 -160
- package/lib/shipping/resolver.cjs.js +2 -2
- package/lib/shipping/resolver.es.js +44 -61
- package/lib/shipping-rate-currency.cjs.js +1 -1
- package/lib/shipping-rate-currency.es.js +52 -67
- package/lib/states.cjs.js +1 -1
- package/lib/states.es.js +333 -154
- package/lib/stripe/checkout.cjs.js +1 -1
- package/lib/stripe/checkout.es.js +125 -181
- package/lib/stripe/client.cjs.js +1 -1
- package/lib/stripe/client.es.js +14 -19
- package/lib/stripe/order-sync.cjs.js +1 -1
- package/lib/stripe/order-sync.es.js +106 -126
- package/lib/stripe/webhooks.cjs.js +1 -1
- package/lib/stripe/webhooks.es.js +37 -31
- package/lib/tax-calculation.cjs.js +1 -1
- package/lib/tax-calculation.es.js +84 -98
- package/lib/trials.cjs.js +1 -1
- package/lib/trials.es.js +24 -30
- package/lib/types.cjs.js +1 -1
- package/lib/types.es.js +21 -27
- package/lib/use-cart.cjs.js +1 -1
- package/lib/use-cart.es.js +38 -40
- package/lib/use-price-formatter.cjs.js +1 -1
- package/lib/use-price-formatter.es.js +10 -11
- package/lib/variation-utils.cjs.js +1 -1
- package/lib/variation-utils.es.js +199 -261
- package/lib/zod-config.cjs.js +1 -1
- package/lib/zod-config.es.js +5 -6
- package/package.json +16 -16
- package/server.cjs.js +1 -1
- package/server.es.js +56 -211
|
@@ -1,1114 +1,1098 @@
|
|
|
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
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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 } from "../cart-store.es.js";
|
|
5
|
+
import { useCart as r } from "../use-cart.es.js";
|
|
6
|
+
import { usePriceFormatter as i } from "../use-price-formatter.es.js";
|
|
7
|
+
import { getTrialSummary as a } from "../trials.es.js";
|
|
8
|
+
import { CouponForm as o } from "./CouponForm.es.js";
|
|
9
|
+
import { countries as s, normalizeCountryCode as c } from "../countries.es.js";
|
|
10
|
+
import { countryUsesStructuredStates as l, getStatesForCountry as ee, getSubdivisionLabel as te } from "../states.es.js";
|
|
11
|
+
import { getShippingEstimates as ne } from "../server-actions/shipping-actions.es.js";
|
|
12
|
+
import { usePaymentReadiness as re } from "../PaymentReadinessProvider.es.js";
|
|
13
|
+
import { getTaxEstimate as ie } from "../server-actions/tax-actions.es.js";
|
|
14
|
+
import { addressesMatch as ae, emptyCustomerAddress as u, isCustomerAddressComplete as oe, normalizeCustomerAddress as se } from "../customer.es.js";
|
|
15
|
+
import { Badge as ce } from "@nextblock-cms/ui/badge";
|
|
16
|
+
import { Button as le } from "@nextblock-cms/ui/button";
|
|
17
|
+
import { useEffect as d, useMemo as f, useState as p } from "react";
|
|
18
|
+
import { ChevronRight as ue, CreditCard as de, Download as fe, FlaskConical as pe, Loader2 as me, MapPin as m, Package as he, X as ge } from "lucide-react";
|
|
19
|
+
import { useTranslations as _e } from "@nextblock-cms/utils";
|
|
20
|
+
import { Fragment as ve, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
21
|
+
import { Input as _ } from "@nextblock-cms/ui/input";
|
|
22
|
+
import { Label as v } from "@nextblock-cms/ui/label";
|
|
23
|
+
import { Card as y, CardContent as b, CardHeader as x, CardTitle as S } from "@nextblock-cms/ui/card";
|
|
24
|
+
import { Checkbox as ye } from "@nextblock-cms/ui/checkbox";
|
|
25
|
+
import { Separator as be } from "@nextblock-cms/ui/separator";
|
|
26
|
+
import { RadioGroup as xe, RadioGroupItem as Se } from "@nextblock-cms/ui/radio-group";
|
|
27
|
+
import { Checkout as Ce } from "@freemius/checkout";
|
|
28
|
+
//#region libs/ecommerce/src/lib/components/Checkout.tsx
|
|
29
|
+
var we = process.env.NEXT_PUBLIC_IS_SANDBOX === "true", C = "nextblock-checkout-draft-v1";
|
|
30
|
+
function w(e, t) {
|
|
31
|
+
return {
|
|
32
|
+
...u(),
|
|
33
|
+
company_name: e?.company_name || "",
|
|
34
|
+
recipient_name: e?.recipient_name || t || "",
|
|
35
|
+
line1: e?.line1 || "",
|
|
36
|
+
line2: e?.line2 || "",
|
|
37
|
+
city: e?.city || "",
|
|
38
|
+
state: e?.state || "",
|
|
39
|
+
postal_code: e?.postal_code || "",
|
|
40
|
+
country_code: c(e?.country_code) || "CA"
|
|
41
|
+
};
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
function Te(e) {
|
|
44
|
+
let t = se(e);
|
|
45
|
+
return !(!t?.country_code || !t.postal_code || l(t.country_code) && !t.state);
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
function Ee(e, t, r) {
|
|
48
|
+
return e.reduce((e, i) => {
|
|
49
|
+
let { price: a, sale_price: o } = n(i, {
|
|
50
|
+
currencyCode: t,
|
|
51
|
+
currencies: r
|
|
52
|
+
});
|
|
53
|
+
return e + (o ?? a) * i.quantity;
|
|
54
|
+
}, 0);
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
56
|
+
function De({ idPrefix: e, title: t, description: n, value: r, onChange: i }) {
|
|
57
|
+
let { t: a, lang: o } = _e(), c = f(() => {
|
|
58
|
+
try {
|
|
59
|
+
return new Intl.DisplayNames([o], { type: "region" });
|
|
60
|
+
} catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}, [o]), ne = a("company_name") === "company_name" ? "Company name" : a("company_name"), re = a("select_an_option") === "select_an_option" ? "Select an option" : a("select_an_option"), ie = a("state_province") === "state_province" ? "State / Province" : a("state_province"), ae = ee(r.country_code), u = l(r.country_code);
|
|
64
|
+
return /* @__PURE__ */ g(y, { children: [/* @__PURE__ */ g(x, { children: [/* @__PURE__ */ g(S, {
|
|
65
|
+
role: "heading",
|
|
66
|
+
"aria-level": 2,
|
|
67
|
+
className: "flex items-center gap-2",
|
|
68
|
+
children: [/* @__PURE__ */ h(m, { className: "w-5 h-5" }), t]
|
|
69
|
+
}), /* @__PURE__ */ h("p", {
|
|
70
|
+
className: "text-sm text-muted-foreground",
|
|
71
|
+
children: n
|
|
72
|
+
})] }), /* @__PURE__ */ g(b, {
|
|
73
|
+
className: "space-y-4",
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ g("div", {
|
|
76
|
+
className: "grid gap-4 sm:grid-cols-3",
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ g("div", {
|
|
79
|
+
className: "space-y-2",
|
|
80
|
+
children: [/* @__PURE__ */ h(v, {
|
|
81
|
+
htmlFor: `${e}-company`,
|
|
82
|
+
children: ne
|
|
83
|
+
}), /* @__PURE__ */ h(_, {
|
|
84
|
+
id: `${e}-company`,
|
|
85
|
+
name: `${e}-company`,
|
|
86
|
+
autoComplete: `${e} organization`,
|
|
87
|
+
value: r.company_name,
|
|
88
|
+
onChange: (e) => i({
|
|
89
|
+
...r,
|
|
90
|
+
company_name: e.target.value
|
|
91
|
+
})
|
|
92
|
+
})]
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ g("div", {
|
|
95
|
+
className: "space-y-2",
|
|
96
|
+
children: [/* @__PURE__ */ h(v, {
|
|
97
|
+
htmlFor: `${e}-name`,
|
|
98
|
+
children: a("full_name")
|
|
99
|
+
}), /* @__PURE__ */ h(_, {
|
|
100
|
+
id: `${e}-name`,
|
|
101
|
+
name: `${e}-name`,
|
|
102
|
+
autoComplete: `${e} name`,
|
|
103
|
+
required: !0,
|
|
104
|
+
value: r.recipient_name,
|
|
105
|
+
onChange: (e) => i({
|
|
106
|
+
...r,
|
|
107
|
+
recipient_name: e.target.value
|
|
108
|
+
})
|
|
109
|
+
})]
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ g("div", {
|
|
112
|
+
className: "space-y-2",
|
|
113
|
+
children: [/* @__PURE__ */ h(v, {
|
|
114
|
+
htmlFor: `${e}-country`,
|
|
115
|
+
children: a("country")
|
|
116
|
+
}), /* @__PURE__ */ h("select", {
|
|
117
|
+
id: `${e}-country`,
|
|
118
|
+
name: `${e}-country`,
|
|
119
|
+
autoComplete: `${e} country`,
|
|
120
|
+
required: !0,
|
|
121
|
+
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",
|
|
122
|
+
value: r.country_code,
|
|
123
|
+
onChange: (e) => {
|
|
124
|
+
let t = e.target.value, n = ee(t);
|
|
125
|
+
i({
|
|
126
|
+
...r,
|
|
127
|
+
country_code: t,
|
|
128
|
+
state: n.some((e) => e.code === r.state) ? r.state : ""
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
children: s.map((e) => /* @__PURE__ */ h("option", {
|
|
132
|
+
value: e.code,
|
|
133
|
+
children: c?.of(e.code) ?? e.name
|
|
134
|
+
}, e.code))
|
|
135
|
+
})]
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
}),
|
|
139
|
+
/* @__PURE__ */ g("div", {
|
|
140
|
+
className: "space-y-2",
|
|
141
|
+
children: [/* @__PURE__ */ h(v, {
|
|
142
|
+
htmlFor: `${e}-line1`,
|
|
143
|
+
children: a("address_line_1")
|
|
144
|
+
}), /* @__PURE__ */ h(_, {
|
|
145
|
+
id: `${e}-line1`,
|
|
146
|
+
name: `${e}-line1`,
|
|
147
|
+
autoComplete: `${e} address-line1`,
|
|
148
|
+
required: !0,
|
|
149
|
+
value: r.line1,
|
|
150
|
+
onChange: (e) => i({
|
|
151
|
+
...r,
|
|
152
|
+
line1: e.target.value
|
|
153
|
+
})
|
|
154
|
+
})]
|
|
155
|
+
}),
|
|
156
|
+
/* @__PURE__ */ g("div", {
|
|
157
|
+
className: "space-y-2",
|
|
158
|
+
children: [/* @__PURE__ */ h(v, {
|
|
159
|
+
htmlFor: `${e}-line2`,
|
|
160
|
+
children: a("address_line_2")
|
|
161
|
+
}), /* @__PURE__ */ h(_, {
|
|
162
|
+
id: `${e}-line2`,
|
|
163
|
+
name: `${e}-line2`,
|
|
164
|
+
autoComplete: `${e} address-line2`,
|
|
165
|
+
value: r.line2,
|
|
166
|
+
onChange: (e) => i({
|
|
167
|
+
...r,
|
|
168
|
+
line2: e.target.value
|
|
169
|
+
})
|
|
170
|
+
})]
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ g("div", {
|
|
173
|
+
className: "grid gap-4 sm:grid-cols-3",
|
|
174
|
+
children: [
|
|
175
|
+
/* @__PURE__ */ g("div", {
|
|
176
|
+
className: "space-y-2",
|
|
177
|
+
children: [/* @__PURE__ */ h(v, {
|
|
178
|
+
htmlFor: `${e}-city`,
|
|
179
|
+
children: a("city")
|
|
180
|
+
}), /* @__PURE__ */ h(_, {
|
|
181
|
+
id: `${e}-city`,
|
|
182
|
+
name: `${e}-city`,
|
|
183
|
+
autoComplete: `${e} address-level2`,
|
|
184
|
+
required: !0,
|
|
185
|
+
value: r.city,
|
|
186
|
+
onChange: (e) => i({
|
|
187
|
+
...r,
|
|
188
|
+
city: e.target.value
|
|
189
|
+
})
|
|
190
|
+
})]
|
|
191
|
+
}),
|
|
192
|
+
/* @__PURE__ */ g("div", {
|
|
193
|
+
className: "space-y-2",
|
|
194
|
+
children: [/* @__PURE__ */ h(v, {
|
|
195
|
+
htmlFor: `${e}-state`,
|
|
196
|
+
children: a("state_province")
|
|
197
|
+
}), u ? /* @__PURE__ */ g("select", {
|
|
198
|
+
id: `${e}-state`,
|
|
199
|
+
name: `${e}-state`,
|
|
200
|
+
autoComplete: `${e} address-level1`,
|
|
201
|
+
required: !0,
|
|
202
|
+
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",
|
|
203
|
+
value: r.state,
|
|
204
|
+
onChange: (e) => i({
|
|
205
|
+
...r,
|
|
206
|
+
state: e.target.value
|
|
207
|
+
}),
|
|
208
|
+
children: [/* @__PURE__ */ h("option", {
|
|
209
|
+
value: "",
|
|
210
|
+
children: `${re}: ${ie}`
|
|
211
|
+
}), ae.map((e) => /* @__PURE__ */ h("option", {
|
|
212
|
+
value: e.code,
|
|
213
|
+
children: te(r.country_code, e, o)
|
|
214
|
+
}, e.code))]
|
|
215
|
+
}) : /* @__PURE__ */ h(_, {
|
|
216
|
+
id: `${e}-state`,
|
|
217
|
+
name: `${e}-state`,
|
|
218
|
+
autoComplete: `${e} address-level1`,
|
|
219
|
+
value: r.state,
|
|
220
|
+
onChange: (e) => i({
|
|
221
|
+
...r,
|
|
222
|
+
state: e.target.value
|
|
223
|
+
})
|
|
224
|
+
})]
|
|
225
|
+
}),
|
|
226
|
+
/* @__PURE__ */ g("div", {
|
|
227
|
+
className: "space-y-2",
|
|
228
|
+
children: [/* @__PURE__ */ h(v, {
|
|
229
|
+
htmlFor: `${e}-postal`,
|
|
230
|
+
children: a("postal_zip_code")
|
|
231
|
+
}), /* @__PURE__ */ h(_, {
|
|
232
|
+
id: `${e}-postal`,
|
|
233
|
+
name: `${e}-postal`,
|
|
234
|
+
autoComplete: `${e} postal-code`,
|
|
235
|
+
required: !0,
|
|
236
|
+
value: r.postal_code,
|
|
237
|
+
onChange: (e) => i({
|
|
238
|
+
...r,
|
|
239
|
+
postal_code: e.target.value
|
|
240
|
+
})
|
|
241
|
+
})]
|
|
242
|
+
})
|
|
243
|
+
]
|
|
244
|
+
})
|
|
245
|
+
]
|
|
246
|
+
})] });
|
|
217
247
|
}
|
|
218
|
-
function
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
248
|
+
function Oe({ title: e, description: t, badgeLabel: n, children: r }) {
|
|
249
|
+
return /* @__PURE__ */ g(y, { children: [/* @__PURE__ */ h(x, { children: /* @__PURE__ */ g("div", {
|
|
250
|
+
className: "flex items-center justify-between gap-3 flex-wrap",
|
|
251
|
+
children: [/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h(S, {
|
|
252
|
+
role: "heading",
|
|
253
|
+
"aria-level": 2,
|
|
254
|
+
children: e
|
|
255
|
+
}), /* @__PURE__ */ h("p", {
|
|
256
|
+
className: "mt-1 text-sm text-muted-foreground",
|
|
257
|
+
children: t
|
|
258
|
+
})] }), n ? /* @__PURE__ */ h(ce, {
|
|
259
|
+
variant: "secondary",
|
|
260
|
+
children: n
|
|
261
|
+
}) : null]
|
|
262
|
+
}) }), /* @__PURE__ */ h(b, {
|
|
263
|
+
className: "space-y-4",
|
|
264
|
+
children: r
|
|
265
|
+
})] });
|
|
234
266
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
),
|
|
1065
|
-
disabled: f !== null || Ne !== null,
|
|
1066
|
-
children: [
|
|
1067
|
-
f === i ? /* @__PURE__ */ e(Se, { className: "mr-2 h-4 w-4 shrink-0 animate-spin" }) : /* @__PURE__ */ e(kt, { className: "mr-2 h-4 w-4 shrink-0" }),
|
|
1068
|
-
/* @__PURE__ */ e("span", { className: "whitespace-normal text-left", children: f === i ? s("ecommerce.processing") : C.length > 1 ? l(
|
|
1069
|
-
"ecommerce.checkout_product",
|
|
1070
|
-
"Checkout {title}",
|
|
1071
|
-
{ title: t.title }
|
|
1072
|
-
) : l(
|
|
1073
|
-
"ecommerce.checkout_digital_product",
|
|
1074
|
-
"Checkout Digital Product"
|
|
1075
|
-
) })
|
|
1076
|
-
]
|
|
1077
|
-
}
|
|
1078
|
-
)
|
|
1079
|
-
] }, i);
|
|
1080
|
-
}) }),
|
|
1081
|
-
/* @__PURE__ */ r("div", { className: "flex justify-between text-sm font-semibold border-t pt-3", children: [
|
|
1082
|
-
/* @__PURE__ */ e("span", { children: l(
|
|
1083
|
-
"ecommerce.digital_subtotal",
|
|
1084
|
-
"Digital subtotal"
|
|
1085
|
-
) }),
|
|
1086
|
-
/* @__PURE__ */ e("span", { children: o(_e, a) })
|
|
1087
|
-
] }),
|
|
1088
|
-
be > 0 ? /* @__PURE__ */ r("div", { className: "flex justify-between text-sm font-semibold text-emerald-600", children: [
|
|
1089
|
-
/* @__PURE__ */ e("span", { children: l("ecommerce.discount", "Discount") }),
|
|
1090
|
-
/* @__PURE__ */ r("span", { children: [
|
|
1091
|
-
"-",
|
|
1092
|
-
o(be, a)
|
|
1093
|
-
] })
|
|
1094
|
-
] }) : null,
|
|
1095
|
-
Ne ? /* @__PURE__ */ e("div", { className: "rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs", children: Ne }) : null,
|
|
1096
|
-
S.freemius ? /* @__PURE__ */ e("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,
|
|
1097
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: C.length > 1 ? l(
|
|
1098
|
-
"ecommerce.freemius_multi_checkout_notice",
|
|
1099
|
-
"Freemius licenses are completed one at a time, so each digital product gets its own checkout action."
|
|
1100
|
-
) : l(
|
|
1101
|
-
"ecommerce.freemius_tax_notice",
|
|
1102
|
-
"Taxes and compliance for digital products are handled inside the Freemius checkout."
|
|
1103
|
-
) })
|
|
1104
|
-
]
|
|
1105
|
-
}
|
|
1106
|
-
) : null
|
|
1107
|
-
] })
|
|
1108
|
-
] })
|
|
1109
|
-
] })
|
|
1110
|
-
] });
|
|
1111
|
-
};
|
|
1112
|
-
export {
|
|
1113
|
-
mr as Checkout
|
|
267
|
+
var T = ({ initialCustomer: s }) => {
|
|
268
|
+
let c = i(), [ee, te] = p({}), [u, m] = p(null), [T, E] = p({}), [D, ke] = p(s?.email || ""), [O, Ae] = p(""), [k, je] = p(s?.phone || ""), [Me, Ne] = p(!1), [Pe, Fe] = p(null), [Ie, A] = p(!1), [Le, Re] = p(!1), [ze, j] = p(!1), [M, N] = p([]), [P, F] = p(null), [I, L] = p(null), [R, Be] = p(null), [z, Ve] = p(() => w(s?.billingAddress, s?.fullName)), [B, He] = p(() => w(s?.shippingAddress ?? s?.billingAddress, s?.fullName)), [V, Ue] = p(!s?.shippingAddress || ae(s?.billingAddress, s?.shippingAddress)), H = r((e) => e), { t: U, lang: We } = _e(), { activeCurrencyCode: W, currencies: G } = t(), Ge = re(), K = H?.items ?? [], q = f(() => K.filter((t) => !e(t)), [K]), J = f(() => K.filter((t) => e(t)), [K]), Y = s?.isAuthenticated ?? !1, X = (e, t, n) => {
|
|
269
|
+
let r = U(e, n);
|
|
270
|
+
if (r !== e) return r;
|
|
271
|
+
if (!n) return t;
|
|
272
|
+
let i = t;
|
|
273
|
+
return Object.entries(n).forEach(([e, t]) => {
|
|
274
|
+
i = i.replace(RegExp(`\\{${e}\\}`, "g"), String(t));
|
|
275
|
+
}), i;
|
|
276
|
+
}, Z = q.length > 0, Ke = f(() => Ee(K, W, G), [
|
|
277
|
+
W,
|
|
278
|
+
G,
|
|
279
|
+
K
|
|
280
|
+
]), qe = f(() => Ee(q, W, G), [
|
|
281
|
+
W,
|
|
282
|
+
G,
|
|
283
|
+
q
|
|
284
|
+
]), Je = f(() => Ee(J, W, G), [
|
|
285
|
+
W,
|
|
286
|
+
G,
|
|
287
|
+
J
|
|
288
|
+
]), Ye = R?.providerDiscounts.stripe ?? 0, Xe = R?.providerDiscounts.freemius ?? 0, Ze = Math.max(0, qe - Ye), Qe = Math.max(0, Je - Xe), Q = f(() => V ? z : B, [
|
|
289
|
+
z,
|
|
290
|
+
B,
|
|
291
|
+
V
|
|
292
|
+
]), $ = f(() => Z ? Q : z, [
|
|
293
|
+
z,
|
|
294
|
+
Z,
|
|
295
|
+
Q
|
|
296
|
+
]), $e = !Z || Te(Q), et = f(() => M.find((e) => e.id === P), [M, P]), tt = f(() => Ze + (et?.amount ?? 0) + (I && !I.isPendingExternalCalculation ? I.amount : 0), [
|
|
297
|
+
Ze,
|
|
298
|
+
et,
|
|
299
|
+
I
|
|
300
|
+
]), nt = tt + Qe;
|
|
301
|
+
if (d(() => {
|
|
302
|
+
if (!(Y || typeof window > "u")) try {
|
|
303
|
+
let e = window.localStorage.getItem(C);
|
|
304
|
+
if (!e) return;
|
|
305
|
+
let t = JSON.parse(e);
|
|
306
|
+
t.email && ke(t.email), t.phone && je(t.phone), t.billingAddress && Ve(w(t.billingAddress)), t.shippingAddress && He(w(t.shippingAddress)), typeof t.useBillingForShipping == "boolean" && Ue(t.useBillingForShipping), (typeof t.selectedMethodId == "string" || t.selectedMethodId === null) && F(t.selectedMethodId);
|
|
307
|
+
} catch (e) {
|
|
308
|
+
console.error("[Checkout] Failed to restore checkout draft:", e);
|
|
309
|
+
}
|
|
310
|
+
}, [Y]), d(() => {
|
|
311
|
+
if (typeof window < "u") try {
|
|
312
|
+
if (Y) {
|
|
313
|
+
window.localStorage.removeItem(C);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
window.localStorage.setItem(C, JSON.stringify({
|
|
317
|
+
email: D,
|
|
318
|
+
phone: k,
|
|
319
|
+
billingAddress: z,
|
|
320
|
+
shippingAddress: B,
|
|
321
|
+
useBillingForShipping: V,
|
|
322
|
+
selectedMethodId: P
|
|
323
|
+
}));
|
|
324
|
+
} catch {}
|
|
325
|
+
}, [
|
|
326
|
+
z,
|
|
327
|
+
D,
|
|
328
|
+
Y,
|
|
329
|
+
k,
|
|
330
|
+
P,
|
|
331
|
+
B,
|
|
332
|
+
V
|
|
333
|
+
]), d(() => {
|
|
334
|
+
if (!Z) {
|
|
335
|
+
N([]), F(null), A(!1);
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
if (!$e) {
|
|
339
|
+
N([]), F(null), A(!1);
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
let e = !1, t = setTimeout(async () => {
|
|
343
|
+
if (Q.country_code) {
|
|
344
|
+
A(!0), Re(!1);
|
|
345
|
+
try {
|
|
346
|
+
let t = await ne(Ze, {
|
|
347
|
+
country: Q.country_code,
|
|
348
|
+
state: Q.state,
|
|
349
|
+
postal_code: Q.postal_code
|
|
350
|
+
}, We, W);
|
|
351
|
+
if (e) return;
|
|
352
|
+
if (t.success && t.methods) {
|
|
353
|
+
let e = t.methods;
|
|
354
|
+
N(e), F((t) => t && e.some((e) => e.id === t) ? t : e[0]?.id ?? null);
|
|
355
|
+
} else N([]), F(null);
|
|
356
|
+
} catch (t) {
|
|
357
|
+
if (e) return;
|
|
358
|
+
console.error("[Checkout] Failed to load shipping rates:", t), N([]), F(null), Re(!0);
|
|
359
|
+
} finally {
|
|
360
|
+
e || A(!1);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}, 400);
|
|
364
|
+
return () => {
|
|
365
|
+
e = !0, clearTimeout(t);
|
|
366
|
+
};
|
|
367
|
+
}, [
|
|
368
|
+
W,
|
|
369
|
+
Z,
|
|
370
|
+
$e,
|
|
371
|
+
We,
|
|
372
|
+
Q.country_code,
|
|
373
|
+
Q.postal_code,
|
|
374
|
+
Q.state,
|
|
375
|
+
Ze
|
|
376
|
+
]), d(() => {
|
|
377
|
+
let e = !1, t = setTimeout(async () => {
|
|
378
|
+
if (!Z || !$.country_code) {
|
|
379
|
+
j(!1), L(null);
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
if (l($.country_code) && !$.state) {
|
|
383
|
+
j(!1), L(null);
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
j(!0);
|
|
387
|
+
try {
|
|
388
|
+
let t = await ie(q, {
|
|
389
|
+
country_code: $.country_code,
|
|
390
|
+
state: $.state
|
|
391
|
+
}, W, R?.code ?? null, K);
|
|
392
|
+
if (e) return;
|
|
393
|
+
L(t.success && t.tax ? t.tax : null);
|
|
394
|
+
} catch (t) {
|
|
395
|
+
if (e) return;
|
|
396
|
+
console.error("[Checkout] Failed to load the tax estimate:", t), L(null);
|
|
397
|
+
} finally {
|
|
398
|
+
e || j(!1);
|
|
399
|
+
}
|
|
400
|
+
}, 300);
|
|
401
|
+
return () => {
|
|
402
|
+
e = !0, clearTimeout(t);
|
|
403
|
+
};
|
|
404
|
+
}, [
|
|
405
|
+
W,
|
|
406
|
+
Z,
|
|
407
|
+
q,
|
|
408
|
+
$.country_code,
|
|
409
|
+
$.state,
|
|
410
|
+
R?.code,
|
|
411
|
+
K
|
|
412
|
+
]), d(() => {
|
|
413
|
+
let e = (e) => {
|
|
414
|
+
e.persisted && m(null);
|
|
415
|
+
};
|
|
416
|
+
return window.addEventListener("pageshow", e), () => window.removeEventListener("pageshow", e);
|
|
417
|
+
}, []), !H) return /* @__PURE__ */ g("div", {
|
|
418
|
+
role: "status",
|
|
419
|
+
"aria-busy": "true",
|
|
420
|
+
className: "container mx-auto px-4 py-12 md:px-6",
|
|
421
|
+
children: [/* @__PURE__ */ h("span", {
|
|
422
|
+
className: "sr-only",
|
|
423
|
+
children: U("loading") === "loading" ? "Loading…" : U("loading")
|
|
424
|
+
}), /* @__PURE__ */ g("div", {
|
|
425
|
+
className: "mx-auto max-w-6xl",
|
|
426
|
+
children: [/* @__PURE__ */ h("div", { className: "mb-8 h-9 w-48 rounded-md bg-muted" }), /* @__PURE__ */ g("div", {
|
|
427
|
+
className: "grid gap-8 lg:grid-cols-12 lg:items-start",
|
|
428
|
+
children: [/* @__PURE__ */ g("div", {
|
|
429
|
+
className: "space-y-6 lg:col-span-8",
|
|
430
|
+
children: [/* @__PURE__ */ h("div", { className: "h-56 rounded-xl border bg-muted/40" }), /* @__PURE__ */ h("div", { className: "h-96 rounded-xl border bg-muted/40" })]
|
|
431
|
+
}), /* @__PURE__ */ h("div", {
|
|
432
|
+
className: "lg:col-span-4",
|
|
433
|
+
children: /* @__PURE__ */ h("div", { className: "h-72 rounded-xl border bg-muted/40" })
|
|
434
|
+
})]
|
|
435
|
+
})]
|
|
436
|
+
})]
|
|
437
|
+
});
|
|
438
|
+
let rt = () => {
|
|
439
|
+
Ne(!1), Fe(null);
|
|
440
|
+
}, it = Me ? /* @__PURE__ */ h("div", {
|
|
441
|
+
className: "fixed inset-0 z-50 flex items-center justify-center overscroll-contain bg-black/60 backdrop-blur-sm",
|
|
442
|
+
onClick: rt,
|
|
443
|
+
onKeyDown: (e) => {
|
|
444
|
+
e.key === "Escape" && rt();
|
|
445
|
+
},
|
|
446
|
+
children: /* @__PURE__ */ g("div", {
|
|
447
|
+
role: "dialog",
|
|
448
|
+
"aria-modal": "true",
|
|
449
|
+
"aria-labelledby": "sandbox-checkout-title",
|
|
450
|
+
className: "relative bg-background border rounded-xl shadow-2xl p-8 max-w-md mx-4",
|
|
451
|
+
onClick: (e) => e.stopPropagation(),
|
|
452
|
+
children: [
|
|
453
|
+
/* @__PURE__ */ h("button", {
|
|
454
|
+
type: "button",
|
|
455
|
+
autoFocus: !0,
|
|
456
|
+
onClick: rt,
|
|
457
|
+
"aria-label": X("close", "Close"),
|
|
458
|
+
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",
|
|
459
|
+
children: /* @__PURE__ */ h(ge, { className: "w-5 h-5" })
|
|
460
|
+
}),
|
|
461
|
+
/* @__PURE__ */ g("div", {
|
|
462
|
+
className: "flex items-center gap-3 mb-4",
|
|
463
|
+
children: [/* @__PURE__ */ h("div", {
|
|
464
|
+
className: "p-2 rounded-full bg-amber-100 dark:bg-amber-900/20",
|
|
465
|
+
children: /* @__PURE__ */ h(pe, { className: "h-6 w-6 text-amber-600 dark:text-amber-400" })
|
|
466
|
+
}), /* @__PURE__ */ h("h2", {
|
|
467
|
+
id: "sandbox-checkout-title",
|
|
468
|
+
className: "text-xl font-semibold",
|
|
469
|
+
children: U("ecommerce.checkout_successful")
|
|
470
|
+
})]
|
|
471
|
+
}),
|
|
472
|
+
/* @__PURE__ */ h("p", {
|
|
473
|
+
className: "text-muted-foreground mb-2",
|
|
474
|
+
children: U("ecommerce.sandbox_notice")
|
|
475
|
+
}),
|
|
476
|
+
/* @__PURE__ */ h("p", {
|
|
477
|
+
className: "text-muted-foreground mb-2",
|
|
478
|
+
children: Pe === "stripe" ? X("ecommerce.sandbox_checkout_stripe_description", "This simulated step represents the Stripe checkout for physical products.") : X("ecommerce.sandbox_checkout_freemius_description", "This simulated step represents the Freemius checkout for digital products.")
|
|
479
|
+
}),
|
|
480
|
+
/* @__PURE__ */ h("p", {
|
|
481
|
+
className: "text-muted-foreground mb-6",
|
|
482
|
+
children: U("ecommerce.license_notice")
|
|
483
|
+
}),
|
|
484
|
+
/* @__PURE__ */ h("a", {
|
|
485
|
+
href: "https://nextblock.dev",
|
|
486
|
+
target: "_blank",
|
|
487
|
+
rel: "noopener noreferrer",
|
|
488
|
+
className: "block w-full text-center py-3 px-4 rounded-lg bg-primary text-primary-foreground font-semibold hover:opacity-90 transition-opacity",
|
|
489
|
+
children: U("ecommerce.purchase_at")
|
|
490
|
+
})
|
|
491
|
+
]
|
|
492
|
+
})
|
|
493
|
+
}) : null, at = (e, t, n) => (E((n) => ({
|
|
494
|
+
...n,
|
|
495
|
+
[e]: t
|
|
496
|
+
})), n && document.getElementById(n)?.focus(), null), ot = (e, t) => t.recipient_name.trim() ? t.line1.trim() ? t.city.trim() ? l(t.country_code) && !t.state ? `${e}-state` : t.postal_code.trim() ? `${e}-line1` : `${e}-postal` : `${e}-city` : `${e}-line1` : `${e}-name`, st = (e) => {
|
|
497
|
+
if (!Y && (!D || !/^\S+@\S+\.\S+$/.test(D))) return Ae(U("ecommerce.invalid_email")), at(e, U("ecommerce.invalid_email"), "checkout-email");
|
|
498
|
+
let t = se(z);
|
|
499
|
+
if (!oe(t)) return at(e, U("checkout_complete_billing_address"), ot("billing", z));
|
|
500
|
+
let n = Z ? se(V ? z : B) : null;
|
|
501
|
+
if (e === "stripe") {
|
|
502
|
+
if (!oe(n)) return at(e, U("checkout_complete_shipping_address"), V ? ot("billing", z) : ot("shipping", B));
|
|
503
|
+
if (!P) return at(e, X("ecommerce.shipping_method_required", "Please select a shipping method before continuing."));
|
|
504
|
+
}
|
|
505
|
+
return Ae(""), {
|
|
506
|
+
normalizedBillingAddress: t,
|
|
507
|
+
normalizedShippingAddress: n
|
|
508
|
+
};
|
|
509
|
+
}, ct = async (e, t, n) => {
|
|
510
|
+
E((t) => ({
|
|
511
|
+
...t,
|
|
512
|
+
[e]: ""
|
|
513
|
+
}));
|
|
514
|
+
let r = st(e);
|
|
515
|
+
if (r) {
|
|
516
|
+
if (we) {
|
|
517
|
+
let n = new Set(t.map((e) => e.id)), r = K.filter((e) => !n.has(e.id));
|
|
518
|
+
if (H.setItems(r), r.length === 0 && H.removeCoupon(), Fe(e), Ne(!0), typeof window < "u" && r.length === 0) try {
|
|
519
|
+
window.localStorage.removeItem(C);
|
|
520
|
+
} catch {}
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
m(n);
|
|
524
|
+
try {
|
|
525
|
+
let n = await fetch("/api/checkout", {
|
|
526
|
+
method: "POST",
|
|
527
|
+
headers: { "Content-Type": "application/json" },
|
|
528
|
+
body: JSON.stringify({
|
|
529
|
+
items: t,
|
|
530
|
+
customerEmail: Y ? void 0 : D,
|
|
531
|
+
customerPhone: k || null,
|
|
532
|
+
billingAddress: r.normalizedBillingAddress,
|
|
533
|
+
shippingAddress: e === "stripe" ? r.normalizedShippingAddress : null,
|
|
534
|
+
shippingMethodId: e === "stripe" ? P : null,
|
|
535
|
+
locale: We,
|
|
536
|
+
currencyCode: W,
|
|
537
|
+
couponCode: R?.code ?? H.appliedCoupon?.code ?? null,
|
|
538
|
+
couponContextItems: K
|
|
539
|
+
})
|
|
540
|
+
}), i = await n.json();
|
|
541
|
+
if (!n.ok) {
|
|
542
|
+
let t = i?.errorKey && typeof i.errorKey == "string" ? X(i.errorKey, i?.error || X("ecommerce.generic_error", "Something went wrong."), i.errorParams) : i?.error || U("ecommerce.generic_error");
|
|
543
|
+
E((n) => ({
|
|
544
|
+
...n,
|
|
545
|
+
[e]: t
|
|
546
|
+
})), m(null);
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
if (i.customProps && i.customProps.provider === "freemius") {
|
|
550
|
+
let t = i.customProps, n = null, r = () => {
|
|
551
|
+
window.location.href = `/checkout/success?session_id=${t.order_id}`;
|
|
552
|
+
}, a = (e) => (n ||= fetch("/api/checkout/freemius/sync", {
|
|
553
|
+
method: "POST",
|
|
554
|
+
headers: { "Content-Type": "application/json" },
|
|
555
|
+
body: JSON.stringify({
|
|
556
|
+
orderId: t.order_id,
|
|
557
|
+
checkoutResponse: e
|
|
558
|
+
})
|
|
559
|
+
}).then(async (e) => {
|
|
560
|
+
if (!e.ok) {
|
|
561
|
+
let t = await e.json().catch(() => null);
|
|
562
|
+
console.error("Freemius checkout sync failed:", t);
|
|
563
|
+
}
|
|
564
|
+
}), n), o = {
|
|
565
|
+
product_id: t.plugin_id,
|
|
566
|
+
public_key: t.public_key,
|
|
567
|
+
sandbox: t.sandbox
|
|
568
|
+
}, s = {
|
|
569
|
+
name: U("ecommerce.checkout_overlay_title"),
|
|
570
|
+
plan_id: t.plan_id,
|
|
571
|
+
...t.billing_cycle ? { billing_cycle: t.billing_cycle } : {},
|
|
572
|
+
...t.trial ? { trial: t.trial } : {},
|
|
573
|
+
...t.coupon ? { coupon: t.coupon } : {},
|
|
574
|
+
user_email: t.user_email,
|
|
575
|
+
user_firstname: t.user_firstname,
|
|
576
|
+
user_lastname: t.user_lastname,
|
|
577
|
+
sandbox: t.sandbox,
|
|
578
|
+
purchaseCompleted: function(e) {
|
|
579
|
+
a(e);
|
|
580
|
+
},
|
|
581
|
+
success: function(e) {
|
|
582
|
+
(async () => {
|
|
583
|
+
try {
|
|
584
|
+
await a(e);
|
|
585
|
+
} finally {
|
|
586
|
+
r();
|
|
587
|
+
}
|
|
588
|
+
})();
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
try {
|
|
592
|
+
new Ce(o).open(s), m(null);
|
|
593
|
+
} catch (t) {
|
|
594
|
+
console.error("[Checkout] Freemius overlay failed to open:", t), E((t) => ({
|
|
595
|
+
...t,
|
|
596
|
+
[e]: U("ecommerce.checkout_popup_blocked")
|
|
597
|
+
})), i.url && (window.location.href = i.url), m(null);
|
|
598
|
+
}
|
|
599
|
+
} else i.url ? window.location.href = i.url : (E((t) => ({
|
|
600
|
+
...t,
|
|
601
|
+
[e]: U("ecommerce.checkout_failed") + (i.error || X("ecommerce.unknown_error", "Unknown error"))
|
|
602
|
+
})), m(null));
|
|
603
|
+
} catch (t) {
|
|
604
|
+
console.error(t), E((t) => ({
|
|
605
|
+
...t,
|
|
606
|
+
[e]: U("ecommerce.generic_error")
|
|
607
|
+
})), m(null);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
if (K.length === 0) return /* @__PURE__ */ g(ve, { children: [it, /* @__PURE__ */ g("div", {
|
|
612
|
+
className: "container mx-auto flex min-h-[50vh] flex-col items-center justify-center p-8 text-center",
|
|
613
|
+
children: [
|
|
614
|
+
/* @__PURE__ */ h("h1", {
|
|
615
|
+
className: "mb-4 text-2xl font-bold",
|
|
616
|
+
children: U("ecommerce.cart_empty")
|
|
617
|
+
}),
|
|
618
|
+
/* @__PURE__ */ h("p", {
|
|
619
|
+
className: "mb-8 text-muted-foreground",
|
|
620
|
+
children: U("ecommerce.cart_empty_description")
|
|
621
|
+
}),
|
|
622
|
+
/* @__PURE__ */ h(le, {
|
|
623
|
+
asChild: !0,
|
|
624
|
+
children: /* @__PURE__ */ h("a", {
|
|
625
|
+
href: "/shop",
|
|
626
|
+
children: U("ecommerce.go_to_shop")
|
|
627
|
+
})
|
|
628
|
+
})
|
|
629
|
+
]
|
|
630
|
+
})] });
|
|
631
|
+
let lt = X("ecommerce.checkout_payments_unavailable", "This store is not able to take payments right now. Please contact the seller to complete your purchase."), ut = Ge.stripe ? null : lt, dt = Ge.freemius ? null : lt, ft = ut || (Z ? $e ? Ie ? X("ecommerce.calculating_shipping", "Calculating shipping...") : P ? null : M.length > 0 ? U("ecommerce.select_rate") : U("ecommerce.no_rates_for_region") : X("ecommerce.waiting_on_address_info", "Complete your shipping address to view available shipping options.") : null), pt = u !== null || ft !== null, mt = q.length === 1 ? X("ecommerce.item_count_one", "{count} item", { count: q.length }) : X("ecommerce.item_count_other", "{count} items", { count: q.length }), ht = J.length === 1 ? X("ecommerce.license_count_one", "{count} license", { count: J.length }) : X("ecommerce.license_count_other", "{count} licenses", { count: J.length }), gt = (t) => e(t) ? X("ecommerce.digital_label", "Digital") : X("ecommerce.physical_label", "Physical"), _t = (e) => e === "monthly" ? X("ecommerce.checkout_billing_cycle_monthly", "Monthly subscription") : e === "annual" ? X("ecommerce.checkout_billing_cycle_annual", "Annual subscription") : e === "lifetime" ? X("ecommerce.checkout_billing_cycle_lifetime", "Lifetime subscription") : null;
|
|
632
|
+
return /* @__PURE__ */ g("div", {
|
|
633
|
+
className: "container mx-auto px-4 py-12 md:px-6",
|
|
634
|
+
children: [it, /* @__PURE__ */ g("div", {
|
|
635
|
+
className: "mx-auto max-w-6xl",
|
|
636
|
+
children: [/* @__PURE__ */ h("h1", {
|
|
637
|
+
className: "mb-8 text-3xl font-bold",
|
|
638
|
+
children: U("ecommerce.checkout")
|
|
639
|
+
}), /* @__PURE__ */ g("div", {
|
|
640
|
+
className: "grid gap-8 lg:grid-cols-12 lg:items-start",
|
|
641
|
+
children: [/* @__PURE__ */ g("div", {
|
|
642
|
+
className: "lg:col-span-8 space-y-6",
|
|
643
|
+
children: [
|
|
644
|
+
/* @__PURE__ */ g(y, { children: [/* @__PURE__ */ h(x, { children: /* @__PURE__ */ g(S, {
|
|
645
|
+
role: "heading",
|
|
646
|
+
"aria-level": 2,
|
|
647
|
+
className: "flex items-center gap-2",
|
|
648
|
+
children: [/* @__PURE__ */ h(de, { className: "w-5 h-5" }), U("ecommerce.contact_information")]
|
|
649
|
+
}) }), /* @__PURE__ */ g(b, {
|
|
650
|
+
className: "space-y-4",
|
|
651
|
+
children: [Y ? /* @__PURE__ */ h("div", {
|
|
652
|
+
className: "rounded-xl border bg-muted/20 p-4 text-sm text-muted-foreground",
|
|
653
|
+
children: U("checkout_prefill_notice", { email: s?.email || "" })
|
|
654
|
+
}) : /* @__PURE__ */ g("div", {
|
|
655
|
+
className: "space-y-2",
|
|
656
|
+
children: [
|
|
657
|
+
/* @__PURE__ */ g(v, {
|
|
658
|
+
htmlFor: "checkout-email",
|
|
659
|
+
children: [
|
|
660
|
+
U("ecommerce.email_address"),
|
|
661
|
+
" ",
|
|
662
|
+
/* @__PURE__ */ h("span", {
|
|
663
|
+
className: "text-destructive",
|
|
664
|
+
children: "*"
|
|
665
|
+
})
|
|
666
|
+
]
|
|
667
|
+
}),
|
|
668
|
+
/* @__PURE__ */ h(_, {
|
|
669
|
+
id: "checkout-email",
|
|
670
|
+
name: "email",
|
|
671
|
+
type: "email",
|
|
672
|
+
autoComplete: "email",
|
|
673
|
+
spellCheck: !1,
|
|
674
|
+
"aria-invalid": O ? !0 : void 0,
|
|
675
|
+
"aria-describedby": O ? "checkout-email-error" : void 0,
|
|
676
|
+
placeholder: U("ecommerce.email_placeholder"),
|
|
677
|
+
value: D,
|
|
678
|
+
onChange: (e) => {
|
|
679
|
+
ke(e.target.value), O && Ae("");
|
|
680
|
+
},
|
|
681
|
+
required: !0
|
|
682
|
+
}),
|
|
683
|
+
O ? /* @__PURE__ */ h("p", {
|
|
684
|
+
id: "checkout-email-error",
|
|
685
|
+
role: "alert",
|
|
686
|
+
className: "text-xs text-destructive mt-1",
|
|
687
|
+
children: O
|
|
688
|
+
}) : null
|
|
689
|
+
]
|
|
690
|
+
}), /* @__PURE__ */ g("div", {
|
|
691
|
+
className: "space-y-2",
|
|
692
|
+
children: [/* @__PURE__ */ h(v, {
|
|
693
|
+
htmlFor: "checkout-phone",
|
|
694
|
+
children: U("phone_number")
|
|
695
|
+
}), /* @__PURE__ */ h(_, {
|
|
696
|
+
id: "checkout-phone",
|
|
697
|
+
name: "phone",
|
|
698
|
+
type: "tel",
|
|
699
|
+
inputMode: "tel",
|
|
700
|
+
autoComplete: "tel",
|
|
701
|
+
placeholder: U("optional"),
|
|
702
|
+
value: k,
|
|
703
|
+
onChange: (e) => je(e.target.value)
|
|
704
|
+
})]
|
|
705
|
+
})]
|
|
706
|
+
})] }),
|
|
707
|
+
/* @__PURE__ */ h(De, {
|
|
708
|
+
idPrefix: "billing",
|
|
709
|
+
title: U("billing_address"),
|
|
710
|
+
description: U("checkout_billing_address_help"),
|
|
711
|
+
value: z,
|
|
712
|
+
onChange: Ve
|
|
713
|
+
}),
|
|
714
|
+
Z ? /* @__PURE__ */ g("div", {
|
|
715
|
+
className: "flex items-center space-x-3 rounded-xl border bg-muted/20 p-4",
|
|
716
|
+
children: [/* @__PURE__ */ h(ye, {
|
|
717
|
+
id: "use-billing-for-shipping",
|
|
718
|
+
checked: V,
|
|
719
|
+
onCheckedChange: (e) => Ue(!!e)
|
|
720
|
+
}), /* @__PURE__ */ g("div", {
|
|
721
|
+
className: "space-y-1",
|
|
722
|
+
children: [/* @__PURE__ */ h(v, {
|
|
723
|
+
htmlFor: "use-billing-for-shipping",
|
|
724
|
+
className: "cursor-pointer",
|
|
725
|
+
children: U("use_billing_for_shipping")
|
|
726
|
+
}), /* @__PURE__ */ h("p", {
|
|
727
|
+
className: "text-sm text-muted-foreground",
|
|
728
|
+
children: U("checkout_use_billing_for_shipping_help")
|
|
729
|
+
})]
|
|
730
|
+
})]
|
|
731
|
+
}) : null,
|
|
732
|
+
Z && !V ? /* @__PURE__ */ h(De, {
|
|
733
|
+
idPrefix: "shipping",
|
|
734
|
+
title: U("shipping_address"),
|
|
735
|
+
description: U("checkout_shipping_address_help"),
|
|
736
|
+
value: B,
|
|
737
|
+
onChange: He
|
|
738
|
+
}) : null,
|
|
739
|
+
Z ? /* @__PURE__ */ g(y, { children: [/* @__PURE__ */ h(x, { children: /* @__PURE__ */ g(S, {
|
|
740
|
+
role: "heading",
|
|
741
|
+
"aria-level": 2,
|
|
742
|
+
className: "flex items-center gap-2",
|
|
743
|
+
children: [/* @__PURE__ */ h(ue, { className: "w-5 h-5 text-primary" }), U("ecommerce.shipping_method")]
|
|
744
|
+
}) }), /* @__PURE__ */ h(b, { children: Ie ? /* @__PURE__ */ g("div", {
|
|
745
|
+
role: "status",
|
|
746
|
+
className: "flex items-center justify-center py-6",
|
|
747
|
+
children: [/* @__PURE__ */ h(me, { className: "w-6 h-6 animate-spin text-muted-foreground" }), /* @__PURE__ */ h("span", {
|
|
748
|
+
className: "sr-only",
|
|
749
|
+
children: X("ecommerce.calculating_shipping", "Calculating shipping…")
|
|
750
|
+
})]
|
|
751
|
+
}) : Le ? /* @__PURE__ */ h("div", {
|
|
752
|
+
role: "alert",
|
|
753
|
+
className: "rounded-lg bg-destructive/10 px-4 py-3 text-center text-sm text-destructive",
|
|
754
|
+
children: X("ecommerce.shipping_calculation_failed", "We couldn't calculate shipping right now. Please try again.")
|
|
755
|
+
}) : M.length > 0 ? /* @__PURE__ */ h(xe, {
|
|
756
|
+
value: P ?? "",
|
|
757
|
+
onValueChange: F,
|
|
758
|
+
"aria-label": U("ecommerce.shipping_method"),
|
|
759
|
+
className: "space-y-3",
|
|
760
|
+
children: M.map((e) => /* @__PURE__ */ g(v, {
|
|
761
|
+
htmlFor: `shipping-method-${e.id}`,
|
|
762
|
+
className: `flex items-center justify-between gap-3 p-4 rounded-lg border-2 cursor-pointer transition-colors ${P === e.id ? "border-primary bg-primary/5" : "border-border hover:border-muted-foreground/40"}`,
|
|
763
|
+
children: [/* @__PURE__ */ g("span", {
|
|
764
|
+
className: "flex min-w-0 items-center gap-3",
|
|
765
|
+
children: [/* @__PURE__ */ h(Se, {
|
|
766
|
+
id: `shipping-method-${e.id}`,
|
|
767
|
+
value: e.id
|
|
768
|
+
}), /* @__PURE__ */ h("span", {
|
|
769
|
+
className: "font-medium break-words",
|
|
770
|
+
children: e.name
|
|
771
|
+
})]
|
|
772
|
+
}), /* @__PURE__ */ h("span", {
|
|
773
|
+
className: "font-bold tabular-nums",
|
|
774
|
+
children: c(e.amount, W)
|
|
775
|
+
})]
|
|
776
|
+
}, e.id))
|
|
777
|
+
}) : /* @__PURE__ */ h("div", {
|
|
778
|
+
className: "py-4 text-center text-muted-foreground bg-muted/30 rounded-lg italic",
|
|
779
|
+
children: $e ? U("ecommerce.no_rates_for_region") : X("ecommerce.waiting_on_address_info", "Complete your shipping address to view available shipping options.")
|
|
780
|
+
}) })] }) : null
|
|
781
|
+
]
|
|
782
|
+
}), /* @__PURE__ */ g("div", {
|
|
783
|
+
className: "lg:col-span-4 space-y-6",
|
|
784
|
+
children: [
|
|
785
|
+
/* @__PURE__ */ g(y, {
|
|
786
|
+
className: "top-6",
|
|
787
|
+
children: [/* @__PURE__ */ h(x, { children: /* @__PURE__ */ h(S, {
|
|
788
|
+
role: "heading",
|
|
789
|
+
"aria-level": 2,
|
|
790
|
+
children: U("ecommerce.order_summary")
|
|
791
|
+
}) }), /* @__PURE__ */ g(b, {
|
|
792
|
+
className: "space-y-4",
|
|
793
|
+
children: [
|
|
794
|
+
/* @__PURE__ */ h("div", {
|
|
795
|
+
className: "space-y-3 max-h-[260px] overflow-y-auto pr-2",
|
|
796
|
+
children: K.map((e) => {
|
|
797
|
+
let t = n(e, {
|
|
798
|
+
currencyCode: W,
|
|
799
|
+
currencies: G
|
|
800
|
+
}), r = a(e, U);
|
|
801
|
+
return /* @__PURE__ */ g("div", {
|
|
802
|
+
className: "flex items-start justify-between gap-4",
|
|
803
|
+
children: [/* @__PURE__ */ g("div", {
|
|
804
|
+
className: "flex gap-3",
|
|
805
|
+
children: [e.image_url ? /* @__PURE__ */ h("div", {
|
|
806
|
+
className: "h-10 w-10 shrink-0 overflow-hidden rounded border bg-neutral-100",
|
|
807
|
+
children: /* @__PURE__ */ h("img", {
|
|
808
|
+
src: e.image_url,
|
|
809
|
+
alt: e.title,
|
|
810
|
+
className: "h-full w-full object-cover"
|
|
811
|
+
})
|
|
812
|
+
}) : null, /* @__PURE__ */ g("div", {
|
|
813
|
+
className: "grid gap-0.5",
|
|
814
|
+
children: [
|
|
815
|
+
/* @__PURE__ */ g("div", {
|
|
816
|
+
className: "flex items-center gap-2",
|
|
817
|
+
children: [/* @__PURE__ */ h("span", {
|
|
818
|
+
className: "font-medium text-xs line-clamp-1",
|
|
819
|
+
children: e.title
|
|
820
|
+
}), /* @__PURE__ */ h(ce, {
|
|
821
|
+
variant: "outline",
|
|
822
|
+
className: "text-[9px] uppercase",
|
|
823
|
+
children: gt(e)
|
|
824
|
+
})]
|
|
825
|
+
}),
|
|
826
|
+
e.variant_label ? /* @__PURE__ */ h("span", {
|
|
827
|
+
className: "text-[10px] text-muted-foreground line-clamp-1",
|
|
828
|
+
children: e.variant_label
|
|
829
|
+
}) : null,
|
|
830
|
+
/* @__PURE__ */ g("span", {
|
|
831
|
+
className: "text-[10px] text-muted-foreground",
|
|
832
|
+
children: [
|
|
833
|
+
U("ecommerce.qty"),
|
|
834
|
+
": ",
|
|
835
|
+
e.quantity
|
|
836
|
+
]
|
|
837
|
+
}),
|
|
838
|
+
r ? /* @__PURE__ */ g("span", {
|
|
839
|
+
className: "text-[10px] font-medium text-emerald-700",
|
|
840
|
+
children: [
|
|
841
|
+
r.label,
|
|
842
|
+
" - ",
|
|
843
|
+
r.paymentRequirementLabel
|
|
844
|
+
]
|
|
845
|
+
}) : null
|
|
846
|
+
]
|
|
847
|
+
})]
|
|
848
|
+
}), /* @__PURE__ */ g("div", {
|
|
849
|
+
className: "flex flex-col items-end gap-0.5 shrink-0",
|
|
850
|
+
children: [/* @__PURE__ */ h("span", {
|
|
851
|
+
className: "font-medium text-xs",
|
|
852
|
+
children: c((t.sale_price ?? t.price) * e.quantity, W)
|
|
853
|
+
}), t.sale_price ? /* @__PURE__ */ h("span", {
|
|
854
|
+
className: "text-[9px] text-muted-foreground line-through",
|
|
855
|
+
children: c(t.price * e.quantity, W)
|
|
856
|
+
}) : null]
|
|
857
|
+
})]
|
|
858
|
+
}, `${e.id}-${e.variant_id || "base"}`);
|
|
859
|
+
})
|
|
860
|
+
}),
|
|
861
|
+
/* @__PURE__ */ h(be, {}),
|
|
862
|
+
/* @__PURE__ */ h(o, {
|
|
863
|
+
items: K,
|
|
864
|
+
currencyCode: W,
|
|
865
|
+
onQuoteChange: Be
|
|
866
|
+
}),
|
|
867
|
+
/* @__PURE__ */ g("div", {
|
|
868
|
+
className: "space-y-2 text-sm",
|
|
869
|
+
children: [
|
|
870
|
+
/* @__PURE__ */ g("div", {
|
|
871
|
+
className: "flex justify-between",
|
|
872
|
+
children: [/* @__PURE__ */ h("span", { children: U("ecommerce.subtotal") }), /* @__PURE__ */ h("span", { children: c(Ke, W) })]
|
|
873
|
+
}),
|
|
874
|
+
q.length > 0 ? /* @__PURE__ */ g("div", {
|
|
875
|
+
className: "flex justify-between text-muted-foreground",
|
|
876
|
+
children: [/* @__PURE__ */ h("span", { children: X("ecommerce.physical_products", "Physical products") }), /* @__PURE__ */ h("span", { children: c(qe, W) })]
|
|
877
|
+
}) : null,
|
|
878
|
+
J.length > 0 ? /* @__PURE__ */ g("div", {
|
|
879
|
+
className: "flex justify-between text-muted-foreground",
|
|
880
|
+
children: [/* @__PURE__ */ h("span", { children: X("ecommerce.digital_products", "Digital products") }), /* @__PURE__ */ h("span", { children: c(Je, W) })]
|
|
881
|
+
}) : null,
|
|
882
|
+
R ? /* @__PURE__ */ g("div", {
|
|
883
|
+
className: "flex justify-between text-emerald-600",
|
|
884
|
+
children: [/* @__PURE__ */ g("span", { children: [
|
|
885
|
+
X("ecommerce.discount", "Discount"),
|
|
886
|
+
" (",
|
|
887
|
+
R.code,
|
|
888
|
+
")"
|
|
889
|
+
] }), /* @__PURE__ */ g("span", { children: ["-", c(R.discountTotal, W)] })]
|
|
890
|
+
}) : null,
|
|
891
|
+
(q.length > 0 || J.length > 0) && /* @__PURE__ */ g("div", {
|
|
892
|
+
className: "flex justify-between font-bold text-lg pt-2 border-t mt-2",
|
|
893
|
+
children: [/* @__PURE__ */ h("span", { children: X("ecommerce.estimated_total", "Estimated total") }), /* @__PURE__ */ h("span", {
|
|
894
|
+
className: "text-primary",
|
|
895
|
+
children: c(nt, W)
|
|
896
|
+
})]
|
|
897
|
+
})
|
|
898
|
+
]
|
|
899
|
+
})
|
|
900
|
+
]
|
|
901
|
+
})]
|
|
902
|
+
}),
|
|
903
|
+
q.length > 0 ? /* @__PURE__ */ g(Oe, {
|
|
904
|
+
title: X("ecommerce.stripe_checkout_title", "Stripe Checkout"),
|
|
905
|
+
description: X("ecommerce.stripe_checkout_description", "Pay for physical products in one Stripe checkout session."),
|
|
906
|
+
badgeLabel: mt,
|
|
907
|
+
children: [
|
|
908
|
+
/* @__PURE__ */ g("div", {
|
|
909
|
+
className: "space-y-2 text-sm",
|
|
910
|
+
children: [
|
|
911
|
+
/* @__PURE__ */ g("div", {
|
|
912
|
+
className: "flex justify-between",
|
|
913
|
+
children: [/* @__PURE__ */ h("span", { children: X("ecommerce.physical_subtotal", "Physical subtotal") }), /* @__PURE__ */ h("span", { children: c(qe, W) })]
|
|
914
|
+
}),
|
|
915
|
+
Ye > 0 ? /* @__PURE__ */ g("div", {
|
|
916
|
+
className: "flex justify-between text-emerald-600",
|
|
917
|
+
children: [/* @__PURE__ */ h("span", { children: X("ecommerce.discount", "Discount") }), /* @__PURE__ */ g("span", { children: ["-", c(Ye, W)] })]
|
|
918
|
+
}) : null,
|
|
919
|
+
/* @__PURE__ */ g("div", {
|
|
920
|
+
className: "flex justify-between",
|
|
921
|
+
children: [/* @__PURE__ */ h("span", { children: U("ecommerce.shipping") }), /* @__PURE__ */ h("span", { children: et ? c(et.amount, W) : "-" })]
|
|
922
|
+
}),
|
|
923
|
+
/* @__PURE__ */ g("div", {
|
|
924
|
+
className: "flex justify-between",
|
|
925
|
+
children: [/* @__PURE__ */ h("span", { children: X("ecommerce.tax", "Tax") }), /* @__PURE__ */ h("span", { children: ze ? "..." : I?.isPendingExternalCalculation ? X("ecommerce.tax_calculated_on_stripe", "Calculated on Stripe") : I ? c(I.amount, W) : "-" })]
|
|
926
|
+
}),
|
|
927
|
+
I && I.lines.length > 0 ? /* @__PURE__ */ h("div", {
|
|
928
|
+
className: "rounded-lg bg-muted/20 px-3 py-2 text-xs text-muted-foreground",
|
|
929
|
+
children: I.lines.map((e) => /* @__PURE__ */ g("div", {
|
|
930
|
+
className: "flex justify-between gap-3",
|
|
931
|
+
children: [/* @__PURE__ */ g("span", { children: [
|
|
932
|
+
e.name,
|
|
933
|
+
" (",
|
|
934
|
+
e.rate.toFixed(4),
|
|
935
|
+
"%)"
|
|
936
|
+
] }), /* @__PURE__ */ h("span", { children: c(e.amount, W) })]
|
|
937
|
+
}, e.id || `${e.name}-${e.rate}`))
|
|
938
|
+
}) : null,
|
|
939
|
+
/* @__PURE__ */ g("div", {
|
|
940
|
+
className: "flex justify-between font-semibold pt-2 border-t",
|
|
941
|
+
children: [/* @__PURE__ */ h("span", { children: X("ecommerce.total_on_stripe", "Total on Stripe") }), /* @__PURE__ */ h("span", { children: c(tt, W) })]
|
|
942
|
+
})
|
|
943
|
+
]
|
|
944
|
+
}),
|
|
945
|
+
/* @__PURE__ */ g(le, {
|
|
946
|
+
className: "w-full",
|
|
947
|
+
size: "lg",
|
|
948
|
+
onClick: () => ct("stripe", q, "stripe"),
|
|
949
|
+
disabled: pt,
|
|
950
|
+
children: [u === "stripe" ? /* @__PURE__ */ h(me, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ h(he, { className: "mr-2 h-4 w-4" }), u === "stripe" ? U("ecommerce.processing") : X("ecommerce.checkout_physical_products", "Checkout Physical Products")]
|
|
951
|
+
}),
|
|
952
|
+
ft && u === null ? /* @__PURE__ */ h("p", {
|
|
953
|
+
className: "text-[11px] text-muted-foreground",
|
|
954
|
+
children: ft
|
|
955
|
+
}) : null,
|
|
956
|
+
T.stripe ? /* @__PURE__ */ h("div", {
|
|
957
|
+
role: "alert",
|
|
958
|
+
className: "rounded-lg border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive",
|
|
959
|
+
children: T.stripe
|
|
960
|
+
}) : null,
|
|
961
|
+
/* @__PURE__ */ h("p", {
|
|
962
|
+
className: "text-[11px] text-muted-foreground",
|
|
963
|
+
children: I?.isPendingExternalCalculation ? X("checkout_stripe_tax_finalized_notice", "Tax will be finalized by Stripe Tax on the payment step.") : X("ecommerce.shipping_taxes_collected_on_stripe", "Shipping and taxes are only collected during the Stripe step for physical products.")
|
|
964
|
+
})
|
|
965
|
+
]
|
|
966
|
+
}) : null,
|
|
967
|
+
J.length > 0 ? /* @__PURE__ */ g(Oe, {
|
|
968
|
+
title: X("ecommerce.freemius_checkout_title", "Freemius Checkout"),
|
|
969
|
+
description: X("ecommerce.freemius_checkout_description", "Digital products use the Freemius checkout flow."),
|
|
970
|
+
badgeLabel: ht,
|
|
971
|
+
children: [
|
|
972
|
+
/* @__PURE__ */ h("div", {
|
|
973
|
+
className: "space-y-3",
|
|
974
|
+
children: J.map((e) => {
|
|
975
|
+
let t = n(e, {
|
|
976
|
+
currencyCode: W,
|
|
977
|
+
currencies: G
|
|
978
|
+
}), r = a(e, U), i = `freemius:${e.id}`, o = r ? ee[i] || "paid" : void 0;
|
|
979
|
+
return /* @__PURE__ */ g("div", {
|
|
980
|
+
className: "rounded-lg border p-3 space-y-3",
|
|
981
|
+
children: [
|
|
982
|
+
/* @__PURE__ */ g("div", {
|
|
983
|
+
className: "flex items-start justify-between gap-3",
|
|
984
|
+
children: [/* @__PURE__ */ g("div", { children: [
|
|
985
|
+
/* @__PURE__ */ h("p", {
|
|
986
|
+
className: "font-medium",
|
|
987
|
+
children: e.title
|
|
988
|
+
}),
|
|
989
|
+
e.billing_cycle ? /* @__PURE__ */ h("p", {
|
|
990
|
+
className: "text-xs text-muted-foreground capitalize",
|
|
991
|
+
children: _t(e.billing_cycle)
|
|
992
|
+
}) : null,
|
|
993
|
+
r ? /* @__PURE__ */ g("p", {
|
|
994
|
+
className: "text-xs font-medium text-emerald-700",
|
|
995
|
+
children: [
|
|
996
|
+
r.label,
|
|
997
|
+
" - ",
|
|
998
|
+
r.paymentRequirementLabel
|
|
999
|
+
]
|
|
1000
|
+
}) : null
|
|
1001
|
+
] }), /* @__PURE__ */ h("span", {
|
|
1002
|
+
className: "font-medium",
|
|
1003
|
+
children: c(t.sale_price ?? t.price, W)
|
|
1004
|
+
})]
|
|
1005
|
+
}),
|
|
1006
|
+
r && !e.trial_requires_payment_method && /* @__PURE__ */ g("div", {
|
|
1007
|
+
className: "bg-muted/30 p-3 rounded-md border text-sm mt-2 mb-3",
|
|
1008
|
+
children: [/* @__PURE__ */ h("p", {
|
|
1009
|
+
className: "font-medium mb-3",
|
|
1010
|
+
children: X("ecommerce.freemius_trial_preference_title", "How would you like to start your trial?")
|
|
1011
|
+
}), /* @__PURE__ */ g(xe, {
|
|
1012
|
+
value: ee[i] || "paid",
|
|
1013
|
+
onValueChange: (e) => te((t) => ({
|
|
1014
|
+
...t,
|
|
1015
|
+
[i]: e
|
|
1016
|
+
})),
|
|
1017
|
+
className: "gap-3",
|
|
1018
|
+
children: [/* @__PURE__ */ g("div", {
|
|
1019
|
+
className: "flex items-start space-x-3",
|
|
1020
|
+
children: [/* @__PURE__ */ h(Se, {
|
|
1021
|
+
value: "paid",
|
|
1022
|
+
id: `${i}-paid`,
|
|
1023
|
+
className: "mt-1"
|
|
1024
|
+
}), /* @__PURE__ */ g("div", {
|
|
1025
|
+
className: "grid gap-1.5",
|
|
1026
|
+
children: [/* @__PURE__ */ h(v, {
|
|
1027
|
+
htmlFor: `${i}-paid`,
|
|
1028
|
+
className: "font-medium leading-none cursor-pointer",
|
|
1029
|
+
children: X("ecommerce.freemius_trial_with_card", "Enter Payment Details Now (Still get full trial length free)")
|
|
1030
|
+
}), /* @__PURE__ */ h("p", {
|
|
1031
|
+
className: "text-xs text-muted-foreground",
|
|
1032
|
+
children: X("ecommerce.freemius_trial_with_card_help", "You will not be billed until the trial ends. Cancel anytime.")
|
|
1033
|
+
})]
|
|
1034
|
+
})]
|
|
1035
|
+
}), /* @__PURE__ */ g("div", {
|
|
1036
|
+
className: "flex items-start space-x-3",
|
|
1037
|
+
children: [/* @__PURE__ */ h(Se, {
|
|
1038
|
+
value: "free",
|
|
1039
|
+
id: `${i}-free`,
|
|
1040
|
+
className: "mt-1"
|
|
1041
|
+
}), /* @__PURE__ */ h("div", {
|
|
1042
|
+
className: "grid gap-1.5",
|
|
1043
|
+
children: /* @__PURE__ */ h(v, {
|
|
1044
|
+
htmlFor: `${i}-free`,
|
|
1045
|
+
className: "font-medium leading-none cursor-pointer",
|
|
1046
|
+
children: X("ecommerce.freemius_trial_no_card", "Start Free Trial (No card required)")
|
|
1047
|
+
})
|
|
1048
|
+
})]
|
|
1049
|
+
})]
|
|
1050
|
+
})]
|
|
1051
|
+
}),
|
|
1052
|
+
/* @__PURE__ */ g(le, {
|
|
1053
|
+
className: "w-full h-auto min-h-[2.75rem] py-2",
|
|
1054
|
+
onClick: () => ct("freemius", [{
|
|
1055
|
+
...e,
|
|
1056
|
+
...o ? { trial_preference: o } : {}
|
|
1057
|
+
}], i),
|
|
1058
|
+
disabled: u !== null || dt !== null,
|
|
1059
|
+
children: [u === i ? /* @__PURE__ */ h(me, { className: "mr-2 h-4 w-4 shrink-0 animate-spin" }) : /* @__PURE__ */ h(fe, { className: "mr-2 h-4 w-4 shrink-0" }), /* @__PURE__ */ h("span", {
|
|
1060
|
+
className: "whitespace-normal text-left",
|
|
1061
|
+
children: u === i ? U("ecommerce.processing") : J.length > 1 ? X("ecommerce.checkout_product", "Checkout {title}", { title: e.title }) : X("ecommerce.checkout_digital_product", "Checkout Digital Product")
|
|
1062
|
+
})]
|
|
1063
|
+
})
|
|
1064
|
+
]
|
|
1065
|
+
}, i);
|
|
1066
|
+
})
|
|
1067
|
+
}),
|
|
1068
|
+
/* @__PURE__ */ g("div", {
|
|
1069
|
+
className: "flex justify-between text-sm font-semibold border-t pt-3",
|
|
1070
|
+
children: [/* @__PURE__ */ h("span", { children: X("ecommerce.digital_subtotal", "Digital subtotal") }), /* @__PURE__ */ h("span", { children: c(Je, W) })]
|
|
1071
|
+
}),
|
|
1072
|
+
Xe > 0 ? /* @__PURE__ */ g("div", {
|
|
1073
|
+
className: "flex justify-between text-sm font-semibold text-emerald-600",
|
|
1074
|
+
children: [/* @__PURE__ */ h("span", { children: X("ecommerce.discount", "Discount") }), /* @__PURE__ */ g("span", { children: ["-", c(Xe, W)] })]
|
|
1075
|
+
}) : null,
|
|
1076
|
+
dt ? /* @__PURE__ */ h("div", {
|
|
1077
|
+
className: "rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs",
|
|
1078
|
+
children: dt
|
|
1079
|
+
}) : null,
|
|
1080
|
+
T.freemius ? /* @__PURE__ */ h("div", {
|
|
1081
|
+
role: "alert",
|
|
1082
|
+
className: "rounded-lg border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive",
|
|
1083
|
+
children: T.freemius
|
|
1084
|
+
}) : null,
|
|
1085
|
+
/* @__PURE__ */ h("p", {
|
|
1086
|
+
className: "text-[11px] text-muted-foreground",
|
|
1087
|
+
children: J.length > 1 ? X("ecommerce.freemius_multi_checkout_notice", "Freemius licenses are completed one at a time, so each digital product gets its own checkout action.") : X("ecommerce.freemius_tax_notice", "Taxes and compliance for digital products are handled inside the Freemius checkout.")
|
|
1088
|
+
})
|
|
1089
|
+
]
|
|
1090
|
+
}) : null
|
|
1091
|
+
]
|
|
1092
|
+
})]
|
|
1093
|
+
})]
|
|
1094
|
+
})]
|
|
1095
|
+
});
|
|
1114
1096
|
};
|
|
1097
|
+
//#endregion
|
|
1098
|
+
export { T as Checkout };
|