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