@nextblock-cms/ecom 0.20.1 → 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
package/lib/states.es.js
CHANGED
|
@@ -1,161 +1,340 @@
|
|
|
1
|
-
import { normalizeCountryCode as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
1
|
+
import { normalizeCountryCode as e } from "./countries.es.js";
|
|
2
|
+
var t = {
|
|
3
|
+
US: [
|
|
4
|
+
{
|
|
5
|
+
code: "AL",
|
|
6
|
+
name: "Alabama"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
code: "AK",
|
|
10
|
+
name: "Alaska"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
code: "AZ",
|
|
14
|
+
name: "Arizona"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
code: "AR",
|
|
18
|
+
name: "Arkansas"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
code: "CA",
|
|
22
|
+
name: "California"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
code: "CO",
|
|
26
|
+
name: "Colorado"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
code: "CT",
|
|
30
|
+
name: "Connecticut"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
code: "DE",
|
|
34
|
+
name: "Delaware"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
code: "DC",
|
|
38
|
+
name: "District of Columbia"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
code: "FL",
|
|
42
|
+
name: "Florida"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
code: "GA",
|
|
46
|
+
name: "Georgia"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
code: "HI",
|
|
50
|
+
name: "Hawaii"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
code: "ID",
|
|
54
|
+
name: "Idaho"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
code: "IL",
|
|
58
|
+
name: "Illinois"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
code: "IN",
|
|
62
|
+
name: "Indiana"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
code: "IA",
|
|
66
|
+
name: "Iowa"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
code: "KS",
|
|
70
|
+
name: "Kansas"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
code: "KY",
|
|
74
|
+
name: "Kentucky"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
code: "LA",
|
|
78
|
+
name: "Louisiana"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
code: "ME",
|
|
82
|
+
name: "Maine"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
code: "MD",
|
|
86
|
+
name: "Maryland"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
code: "MA",
|
|
90
|
+
name: "Massachusetts"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
code: "MI",
|
|
94
|
+
name: "Michigan"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
code: "MN",
|
|
98
|
+
name: "Minnesota"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
code: "MS",
|
|
102
|
+
name: "Mississippi"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
code: "MO",
|
|
106
|
+
name: "Missouri"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
code: "MT",
|
|
110
|
+
name: "Montana"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
code: "NE",
|
|
114
|
+
name: "Nebraska"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
code: "NV",
|
|
118
|
+
name: "Nevada"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
code: "NH",
|
|
122
|
+
name: "New Hampshire"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
code: "NJ",
|
|
126
|
+
name: "New Jersey"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
code: "NM",
|
|
130
|
+
name: "New Mexico"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
code: "NY",
|
|
134
|
+
name: "New York"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
code: "NC",
|
|
138
|
+
name: "North Carolina"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
code: "ND",
|
|
142
|
+
name: "North Dakota"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
code: "OH",
|
|
146
|
+
name: "Ohio"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
code: "OK",
|
|
150
|
+
name: "Oklahoma"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
code: "OR",
|
|
154
|
+
name: "Oregon"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
code: "PA",
|
|
158
|
+
name: "Pennsylvania"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
code: "RI",
|
|
162
|
+
name: "Rhode Island"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
code: "SC",
|
|
166
|
+
name: "South Carolina"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
code: "SD",
|
|
170
|
+
name: "South Dakota"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
code: "TN",
|
|
174
|
+
name: "Tennessee"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
code: "TX",
|
|
178
|
+
name: "Texas"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
code: "UT",
|
|
182
|
+
name: "Utah"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
code: "VT",
|
|
186
|
+
name: "Vermont"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
code: "VA",
|
|
190
|
+
name: "Virginia"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
code: "WA",
|
|
194
|
+
name: "Washington"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
code: "WV",
|
|
198
|
+
name: "West Virginia"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
code: "WI",
|
|
202
|
+
name: "Wisconsin"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
code: "WY",
|
|
206
|
+
name: "Wyoming"
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
CA: [
|
|
210
|
+
{
|
|
211
|
+
code: "AB",
|
|
212
|
+
name: "Alberta"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
code: "BC",
|
|
216
|
+
name: "British Columbia"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
code: "MB",
|
|
220
|
+
name: "Manitoba"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
code: "NB",
|
|
224
|
+
name: "New Brunswick"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
code: "NL",
|
|
228
|
+
name: "Newfoundland and Labrador"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
code: "NS",
|
|
232
|
+
name: "Nova Scotia"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
code: "NT",
|
|
236
|
+
name: "Northwest Territories"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
code: "NU",
|
|
240
|
+
name: "Nunavut"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
code: "ON",
|
|
244
|
+
name: "Ontario"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
code: "PE",
|
|
248
|
+
name: "Prince Edward Island"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
code: "QC",
|
|
252
|
+
name: "Quebec"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
code: "SK",
|
|
256
|
+
name: "Saskatchewan"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
code: "YT",
|
|
260
|
+
name: "Yukon"
|
|
261
|
+
}
|
|
262
|
+
]
|
|
263
|
+
}, n = {
|
|
264
|
+
CA: {
|
|
265
|
+
BC: "Colombie-Britannique",
|
|
266
|
+
NB: "Nouveau-Brunswick",
|
|
267
|
+
NL: "Terre-Neuve-et-Labrador",
|
|
268
|
+
NS: "Nouvelle-Écosse",
|
|
269
|
+
NT: "Territoires du Nord-Ouest",
|
|
270
|
+
PE: "Île-du-Prince-Édouard",
|
|
271
|
+
QC: "Québec"
|
|
272
|
+
},
|
|
273
|
+
US: {
|
|
274
|
+
CA: "Californie",
|
|
275
|
+
DC: "District de Columbia",
|
|
276
|
+
FL: "Floride",
|
|
277
|
+
GA: "Géorgie",
|
|
278
|
+
HI: "Hawaï",
|
|
279
|
+
LA: "Louisiane",
|
|
280
|
+
NC: "Caroline du Nord",
|
|
281
|
+
ND: "Dakota du Nord",
|
|
282
|
+
NM: "Nouveau-Mexique",
|
|
283
|
+
PA: "Pennsylvanie",
|
|
284
|
+
SC: "Caroline du Sud",
|
|
285
|
+
SD: "Dakota du Sud",
|
|
286
|
+
VA: "Virginie",
|
|
287
|
+
WV: "Virginie-Occidentale"
|
|
288
|
+
}
|
|
97
289
|
};
|
|
98
|
-
function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return a && l[a]?.[e.code] || e.name;
|
|
290
|
+
function r(t, r, i) {
|
|
291
|
+
if (!i || !i.toLowerCase().startsWith("fr")) return r.name;
|
|
292
|
+
let a = e(t);
|
|
293
|
+
return a && n[a]?.[r.code] || r.name;
|
|
103
294
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
295
|
+
var i = {
|
|
296
|
+
US: {
|
|
297
|
+
CALIFORNIA: "CA",
|
|
298
|
+
NEWYORK: "NY",
|
|
299
|
+
"NEW YORK": "NY",
|
|
300
|
+
DISTRICTOFCOLUMBIA: "DC",
|
|
301
|
+
"DISTRICT OF COLUMBIA": "DC"
|
|
302
|
+
},
|
|
303
|
+
CA: {
|
|
304
|
+
QUEBEC: "QC",
|
|
305
|
+
ONTARIO: "ON",
|
|
306
|
+
"BRITISH COLUMBIA": "BC",
|
|
307
|
+
BRITISHCOLUMBIA: "BC",
|
|
308
|
+
"NEWFOUNDLAND AND LABRADOR": "NL",
|
|
309
|
+
NEWFOUNDLANDANDLABRADOR: "NL",
|
|
310
|
+
"NORTHWEST TERRITORIES": "NT",
|
|
311
|
+
NORTHWESTTERRITORIES: "NT",
|
|
312
|
+
"PRINCE EDWARD ISLAND": "PE",
|
|
313
|
+
PRINCEEDWARDISLAND: "PE"
|
|
314
|
+
}
|
|
124
315
|
};
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
-
|
|
316
|
+
function a(n) {
|
|
317
|
+
let r = e(n);
|
|
318
|
+
return r ? t[r] ?? [] : [];
|
|
128
319
|
}
|
|
129
|
-
function
|
|
130
|
-
|
|
320
|
+
function o(e) {
|
|
321
|
+
return a(e).length > 0;
|
|
131
322
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (N)
|
|
144
|
-
return N.code;
|
|
145
|
-
const u = c.replace(/\s+/g, "");
|
|
146
|
-
return s[o]?.[c] ?? s[o]?.[u] ?? c;
|
|
323
|
+
function s(n, r) {
|
|
324
|
+
let a = e(n), o = r?.trim();
|
|
325
|
+
if (!a || !o) return o || null;
|
|
326
|
+
let s = t[a];
|
|
327
|
+
if (!s?.length) return o.toUpperCase();
|
|
328
|
+
let c = o.toUpperCase(), l = s.find((e) => e.code === c);
|
|
329
|
+
if (l) return l.code;
|
|
330
|
+
let u = s.find((e) => e.name.toUpperCase() === c);
|
|
331
|
+
if (u) return u.code;
|
|
332
|
+
let d = c.replace(/\s+/g, "");
|
|
333
|
+
return i[a]?.[c] ?? i[a]?.[d] ?? c;
|
|
147
334
|
}
|
|
148
|
-
function
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
(c) => c.code === a
|
|
152
|
-
)?.name ?? a;
|
|
335
|
+
function c(n, r) {
|
|
336
|
+
let i = e(n), a = s(n, r);
|
|
337
|
+
return !i || !a ? r ?? null : t[i]?.find((e) => e.code === a)?.name ?? a;
|
|
153
338
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
R as countryUsesStructuredStates,
|
|
157
|
-
S as getStatesForCountry,
|
|
158
|
-
T as getSubdivisionLabel,
|
|
159
|
-
I as normalizeSubdivisionCode,
|
|
160
|
-
E as resolveSubdivisionName
|
|
161
|
-
};
|
|
339
|
+
//#endregion
|
|
340
|
+
export { t as STATES_BY_COUNTRY, o as countryUsesStructuredStates, a as getStatesForCountry, r as getSubdivisionLabel, s as normalizeSubdivisionCode, c as resolveSubdivisionName };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const e=require("../currency.cjs.js"),t=require("../shipping/resolver.cjs.js"),n=require("./client.cjs.js");let r=require("@nextblock-cms/db/server"),i=require("@supabase/supabase-js");var a=async(a,o,s,c)=>{let l=process.env.NEXT_PUBLIC_SUPABASE_URL||process.env.SUPABASE_URL,u=process.env.SUPABASE_SERVICE_ROLE_KEY||process.env.SUPABASE_SECRET_KEY;if(!l||!u)return console.error(`Missing Supabase credentials for checkout (Service Key required).`),{error:`Internal Server Error`,url:null};let d=(0,i.createClient)(l,u),f=process.env.NEXT_PUBLIC_URL||`http://localhost:4200`;if(!a.length)return{error:`Cart is empty`,url:null};let{data:p}=await d.from(`currencies`).select(`code, symbol, exchange_rate, is_default, is_active, auto_sync_product_prices, auto_update_exchange_rate, exchange_rate_source, exchange_rate_updated_at, rounding_mode, rounding_increment, rounding_charm_amount`).eq(`is_active`,!0).order(`code`,{ascending:!0}),m=p??[],h=e.getDefaultCurrency(m),g=m.find(e=>e.code===(c||``).toUpperCase())??h;if(!await(0,r.verifyPackageOnline)(`ecommerce`))return{error:`E-Commerce Package not active. Please purchase a license to accept payments.`,url:null};let _=a.map(e=>e.product_id),{data:v,error:y}=await d.from(`products`).select(`id, title, price, prices, sale_price, sale_prices, sale_start_at, sale_end_at, scheduled_price, scheduled_prices, scheduled_price_at`).in(`id`,_);if(y||!v)return console.error(`Error fetching products for validation:`,y),{error:`Failed to validate product prices`,url:null};let b=new Map(v.map(e=>[e.id,e])),x=[],S=0,C=[];for(let t of a){let n=b.get(t.product_id);if(!n){console.warn(`Product ${t.product_id} not found in DB, skipping.`);continue}let r=e.resolveEffectivePriceForCurrency({prices:n.prices||{},salePrices:n.sale_prices||{},fallbackPrice:n.price,fallbackSalePrice:n.sale_price,saleStartAt:n.sale_start_at,saleEndAt:n.sale_end_at,scheduledPrice:n.scheduled_price,scheduledPrices:n.scheduled_prices||{},scheduledPriceAt:n.scheduled_price_at,currencyCode:g.code,currencies:m}),i=r.sale_price??r.price;i<=0&&console.warn(`[Checkout Session Warning] Product ${n.title} has zero or negative price!`),x.push({price_data:{currency:g.code.toLowerCase(),product_data:{name:n.title,images:[],metadata:{productId:n.id}},unit_amount:i},quantity:t.quantity}),S+=i*t.quantity,C.push({product_id:n.id,quantity:t.quantity,price_at_purchase:i})}if(x.length===0)return{error:`No valid items in cart`,url:null};let{data:w,error:T}=await d.from(`orders`).insert({total:S,user_id:o,currency:g.code,exchange_rate_at_purchase:g.exchange_rate}).select(`id`).single();if(T||!w)return console.error(`Failed to create pending order:`,T),console.error(`Order Data attempted:`,{status:`pending`,total:S}),{error:`Failed to initiate order: ${T?.message||`Unknown error`}`,url:null};let E=C.map(e=>({order_id:w.id,product_id:e.product_id,quantity:e.quantity,price_at_purchase:e.price_at_purchase})),{error:D}=await d.from(`order_items`).insert(E);D&&console.error(`Failed to insert order items:`,D);let O=[],k=s;if(!k&&o){let{data:e}=await d.from(`user_addresses`).select(`country_code, state_code, postal_code`).eq(`user_id`,o).eq(`address_type`,`shipping`).limit(1).single();e&&(k={country:e.country_code,state:e.state_code,postal_code:e.postal_code})}k&&(O=(await t.resolveShippingOptions(S,k,null,g.code)).map(e=>({shipping_rate_data:{type:`fixed_amount`,fixed_amount:{amount:e.amount,currency:e.currency.toLowerCase()},display_name:e.name}})));try{let e=await(await n.getStripeClient()).checkout.sessions.create({mode:`payment`,success_url:`${f}/checkout/success?session_id={CHECKOUT_SESSION_ID}`,cancel_url:`${f}/`,line_items:x,billing_address_collection:`required`,shipping_address_collection:{allowed_countries:`US.CA.GB.AU.NZ.IE.FR.DE.IT.ES.MX.BR.AR.CL.CO.PE.ZA.NG.KE.IN.JP.KR.CN.SG.MY.PH.TH.VN.ID.AE.SA.EG.MA.DZ.TN.PT.NL.BE.CH.AT.SE.NO.DK.FI.PL.CZ.HU.RO.BG.GR.TR.IL.CY.MT`.split(`.`)},shipping_options:O.length>0?O:void 0,metadata:{orderId:w.id}});return await d.from(`orders`).update({stripe_session_id:e.id}).eq(`id`,w.id),{url:e.url}}catch(e){return console.error(`Stripe session creation failed:`,e),{error:e.message,url:null}}};exports.createCheckoutSession=a;
|