@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
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
const d = {
|
|
2
|
+
gst: "GST",
|
|
3
|
+
qst: "QST",
|
|
4
|
+
hst: "HST",
|
|
5
|
+
pst: "PST",
|
|
6
|
+
vat: "VAT",
|
|
7
|
+
sales_tax: "Sales Tax",
|
|
8
|
+
amusement_tax: "Amusement Tax",
|
|
9
|
+
retail_delivery_fee: "Retail Delivery Fee"
|
|
10
|
+
};
|
|
11
|
+
function c() {
|
|
12
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
13
|
+
}
|
|
14
|
+
function l(t) {
|
|
15
|
+
const e = t.tax_type?.trim().toLowerCase();
|
|
16
|
+
return e && d[e] ? d[e] : t.display_name || "Tax";
|
|
17
|
+
}
|
|
18
|
+
function s(t) {
|
|
19
|
+
return typeof t.effective_percentage == "number" ? t.effective_percentage : typeof t.percentage == "number" ? t.percentage : null;
|
|
20
|
+
}
|
|
21
|
+
function f(t) {
|
|
22
|
+
return t.jurisdiction ? t.jurisdiction : [t.state, t.country].filter(Boolean).join(", ") || null;
|
|
23
|
+
}
|
|
24
|
+
function p(t) {
|
|
25
|
+
return JSON.stringify({
|
|
26
|
+
source: t.source,
|
|
27
|
+
rate_id: t.rate.id ?? null,
|
|
28
|
+
display_name: l(t.rate),
|
|
29
|
+
percentage: s(t.rate),
|
|
30
|
+
jurisdiction: f(t.rate),
|
|
31
|
+
jurisdiction_level: t.rate.jurisdiction_level ?? null,
|
|
32
|
+
country: t.rate.country ?? null,
|
|
33
|
+
state: t.rate.state ?? null,
|
|
34
|
+
tax_type: t.rate.tax_type ?? null,
|
|
35
|
+
inclusive: t.rate.inclusive ?? null
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function _(t) {
|
|
39
|
+
const e = /* @__PURE__ */ new Map();
|
|
40
|
+
for (const o of t) {
|
|
41
|
+
const n = p(o), a = e.get(n);
|
|
42
|
+
if (!a) {
|
|
43
|
+
e.set(n, {
|
|
44
|
+
...o,
|
|
45
|
+
scope: "aggregate",
|
|
46
|
+
line_item_id: null
|
|
47
|
+
});
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
a.amount += o.amount, typeof a.taxable_amount == "number" || typeof o.taxable_amount == "number" ? a.taxable_amount = (typeof a.taxable_amount == "number" ? a.taxable_amount : 0) + (typeof o.taxable_amount == "number" ? o.taxable_amount : 0) : a.taxable_amount = null, a.description !== o.description && (a.description = null), a.taxability_reason !== o.taxability_reason && (a.taxability_reason = null);
|
|
51
|
+
}
|
|
52
|
+
return [...e.values()].sort((o, n) => {
|
|
53
|
+
const a = l(o.rate).localeCompare(l(n.rate));
|
|
54
|
+
return a !== 0 ? a : (s(o.rate) ?? 0) - (s(n.rate) ?? 0);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function y(t) {
|
|
58
|
+
if (!t || typeof t != "object" || Array.isArray(t))
|
|
59
|
+
return null;
|
|
60
|
+
const e = t;
|
|
61
|
+
return typeof e.currency != "string" ? null : {
|
|
62
|
+
source: e.source === "manual" || e.source === "stripe_checkout" || e.source === "none" ? e.source : "none",
|
|
63
|
+
mode: e.mode === "automatic" ? "automatic" : "manual",
|
|
64
|
+
currency: e.currency,
|
|
65
|
+
subtotal: typeof e.subtotal == "number" ? e.subtotal : 0,
|
|
66
|
+
shipping_total: typeof e.shipping_total == "number" ? e.shipping_total : 0,
|
|
67
|
+
tax_total: typeof e.tax_total == "number" ? e.tax_total : 0,
|
|
68
|
+
total: typeof e.total == "number" ? e.total : 0,
|
|
69
|
+
is_finalized: !!e.is_finalized,
|
|
70
|
+
lines: Array.isArray(e.lines) ? _(e.lines) : [],
|
|
71
|
+
updated_at: typeof e.updated_at == "string" ? e.updated_at : c()
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function x(t) {
|
|
75
|
+
const e = t.currency || "usd", o = t.calculation.mode === "manual" && !t.calculation.isPendingExternalCalculation;
|
|
76
|
+
return {
|
|
77
|
+
source: t.calculation.enabled && t.calculation.mode === "manual" ? "manual" : t.calculation.mode === "automatic" ? "stripe_checkout" : "none",
|
|
78
|
+
mode: t.calculation.mode,
|
|
79
|
+
currency: e,
|
|
80
|
+
subtotal: t.subtotal,
|
|
81
|
+
shipping_total: t.shippingTotal,
|
|
82
|
+
tax_total: t.calculation.amount,
|
|
83
|
+
total: t.total,
|
|
84
|
+
is_finalized: o,
|
|
85
|
+
lines: t.calculation.enabled && t.calculation.mode === "manual" ? t.calculation.lines.map((n) => ({
|
|
86
|
+
scope: "aggregate",
|
|
87
|
+
source: "manual",
|
|
88
|
+
amount: n.amount,
|
|
89
|
+
taxable_amount: t.calculation.taxableSubtotal,
|
|
90
|
+
description: n.name,
|
|
91
|
+
rate: {
|
|
92
|
+
id: n.id ?? null,
|
|
93
|
+
display_name: n.name,
|
|
94
|
+
percentage: n.rate,
|
|
95
|
+
country: n.country_code,
|
|
96
|
+
state: n.state_code ?? null
|
|
97
|
+
}
|
|
98
|
+
})) : [],
|
|
99
|
+
updated_at: c()
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function m(t) {
|
|
103
|
+
return {
|
|
104
|
+
id: t.id,
|
|
105
|
+
display_name: t.display_name,
|
|
106
|
+
percentage: t.percentage,
|
|
107
|
+
effective_percentage: t.effective_percentage,
|
|
108
|
+
jurisdiction: t.jurisdiction,
|
|
109
|
+
jurisdiction_level: t.jurisdiction_level,
|
|
110
|
+
country: t.country,
|
|
111
|
+
state: t.state,
|
|
112
|
+
tax_type: t.tax_type,
|
|
113
|
+
inclusive: t.inclusive,
|
|
114
|
+
description: t.description
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function b(t) {
|
|
118
|
+
const e = t.currency || t.session.currency || "usd", o = typeof t.session.amount_total == "number" ? t.session.amount_total : 0, n = t.session.total_details?.amount_tax ?? 0, a = [];
|
|
119
|
+
for (const i of t.lineItems)
|
|
120
|
+
for (const r of i.taxes || [])
|
|
121
|
+
a.push({
|
|
122
|
+
scope: "line_item",
|
|
123
|
+
source: "stripe_checkout",
|
|
124
|
+
amount: r.amount,
|
|
125
|
+
taxable_amount: r.taxable_amount,
|
|
126
|
+
description: i.description || void 0,
|
|
127
|
+
line_item_id: i.id,
|
|
128
|
+
taxability_reason: r.taxability_reason,
|
|
129
|
+
rate: m(r.rate)
|
|
130
|
+
});
|
|
131
|
+
if (a.length === 0)
|
|
132
|
+
for (const i of t.session.total_details?.breakdown?.taxes || [])
|
|
133
|
+
a.push({
|
|
134
|
+
scope: "aggregate",
|
|
135
|
+
source: "stripe_checkout",
|
|
136
|
+
amount: i.amount,
|
|
137
|
+
taxable_amount: i.taxable_amount,
|
|
138
|
+
description: i.rate.display_name,
|
|
139
|
+
taxability_reason: i.taxability_reason,
|
|
140
|
+
rate: m(i.rate)
|
|
141
|
+
});
|
|
142
|
+
const u = _(a);
|
|
143
|
+
return {
|
|
144
|
+
source: n > 0 || u.length > 0 ? "stripe_checkout" : "none",
|
|
145
|
+
mode: t.fallbackMode === "manual" ? "manual" : "automatic",
|
|
146
|
+
currency: e,
|
|
147
|
+
subtotal: t.subtotal,
|
|
148
|
+
shipping_total: t.shippingTotal,
|
|
149
|
+
tax_total: n,
|
|
150
|
+
total: o,
|
|
151
|
+
is_finalized: !0,
|
|
152
|
+
lines: u,
|
|
153
|
+
updated_at: c()
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
_ as aggregateOrderTaxLines,
|
|
158
|
+
x as buildOrderTaxDetailsFromCalculation,
|
|
159
|
+
b as buildOrderTaxDetailsFromStripeSession,
|
|
160
|
+
f as getOrderTaxRateJurisdiction,
|
|
161
|
+
l as getOrderTaxRateLabel,
|
|
162
|
+
s as getOrderTaxRatePercentage,
|
|
163
|
+
y as normalizeOrderTaxDetails
|
|
164
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("@nextblock-cms/ui"),d=require("@nextblock-cms/utils"),o=require("./ProductScopePicker.cjs.js");function n(r){if(!r)return"";const i=new Date(r);return Number.isNaN(i.getTime())?"":i.toISOString().slice(0,16)}function u(r,i){const s=d.getCurrencyMinorUnitFactor(i)===1?0:2;return r.toFixed(s)}function m(r,i){return r?.discount_amount?r.discount_type==="fixed"?u(d.minorUnitAmountToMajor(r.discount_amount,i),i):r.discount_amount:10}function p({action:r,products:i,coupon:s,selectedProductIds:l=[],submitLabel:c,currencyCode:a="USD"}){return e.jsxs("form",{action:r,children:[e.jsx("input",{type:"hidden",name:"currency_code",value:a}),e.jsxs(t.Card,{children:[e.jsx(t.CardHeader,{children:e.jsx(t.CardTitle,{children:s?.id?"Edit Coupon":"Create Coupon"})}),e.jsxs(t.CardContent,{className:"space-y-6",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"coupon-code",children:"Code"}),e.jsx(t.Input,{id:"coupon-code",name:"code",defaultValue:s?.code||"",className:"uppercase",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"coupon-name",children:"Name"}),e.jsx(t.Input,{id:"coupon-name",name:"name",defaultValue:s?.name||"",required:!0})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"provider-scope",children:"Provider scope"}),e.jsxs("select",{id:"provider-scope",name:"provider_scope",defaultValue:s?.provider_scope||"all",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",children:[e.jsx("option",{value:"all",children:"Stripe + Freemius"}),e.jsx("option",{value:"stripe",children:"Stripe only"}),e.jsx("option",{value:"freemius",children:"Freemius only"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"discount-type",children:"Discount type"}),e.jsxs("select",{id:"discount-type",name:"discount_type",defaultValue:s?.discount_type||"percent",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",children:[e.jsx("option",{value:"percent",children:"Percent"}),e.jsx("option",{value:"fixed",children:"Fixed amount"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"discount-amount",children:"Amount"}),e.jsx(t.Input,{id:"discount-amount",name:"discount_amount",type:"number",min:"0.01",step:"0.01",defaultValue:m(s,a),required:!0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Percent coupons use 1-100. Fixed coupons use regular amounts, for example $10.00."})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"starts-at",children:"Starts at"}),e.jsx(t.Input,{id:"starts-at",name:"starts_at",type:"datetime-local",defaultValue:n(s?.starts_at)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"ends-at",children:"Ends at"}),e.jsx(t.Input,{id:"ends-at",name:"ends_at",type:"datetime-local",defaultValue:n(s?.ends_at)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"redemption-limit",children:"Redemption limit"}),e.jsx(t.Input,{id:"redemption-limit",name:"redemption_limit",type:"number",min:"1",defaultValue:s?.redemption_limit||""})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"internal-note",children:"Internal note"}),e.jsx(t.Textarea,{id:"internal-note",name:"internal_note",defaultValue:s?.internal_note||"",rows:3})]}),e.jsxs("div",{className:"rounded-lg border bg-muted/20 p-4",children:[e.jsx("input",{type:"hidden",name:"is_active",value:"false"}),e.jsxs("label",{htmlFor:"coupon-active",className:"flex cursor-pointer items-start gap-3",children:[e.jsx("input",{id:"coupon-active",name:"is_active",type:"checkbox",value:"true",defaultChecked:s?.is_active??!0,className:"mt-0.5 h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:"Active"}),e.jsx("span",{className:"block text-sm text-muted-foreground",children:"Active coupons can be applied by shoppers during cart and checkout."})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:"Product scope"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Leave every product unchecked to apply this coupon to all products in the selected provider scope."})]}),e.jsx(o.ProductScopePicker,{products:i,selectedProductIds:l})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(t.Button,{type:"submit",children:c})})]})]})]})}exports.CouponEditorForm=p;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Card as m, CardHeader as u, CardTitle as p, CardContent as h, Label as d, Input as n, Textarea as f, Button as v } from "@nextblock-cms/ui";
|
|
3
|
+
import { minorUnitAmountToMajor as y, getCurrencyMinorUnitFactor as N } from "@nextblock-cms/utils";
|
|
4
|
+
import { ProductScopePicker as x } from "./ProductScopePicker.es.js";
|
|
5
|
+
function c(i) {
|
|
6
|
+
if (!i)
|
|
7
|
+
return "";
|
|
8
|
+
const a = new Date(i);
|
|
9
|
+
return Number.isNaN(a.getTime()) ? "" : a.toISOString().slice(0, 16);
|
|
10
|
+
}
|
|
11
|
+
function g(i, a) {
|
|
12
|
+
const r = N(a) === 1 ? 0 : 2;
|
|
13
|
+
return i.toFixed(r);
|
|
14
|
+
}
|
|
15
|
+
function b(i, a) {
|
|
16
|
+
return i?.discount_amount ? i.discount_type === "fixed" ? g(
|
|
17
|
+
y(i.discount_amount, a),
|
|
18
|
+
a
|
|
19
|
+
) : i.discount_amount : 10;
|
|
20
|
+
}
|
|
21
|
+
function V({
|
|
22
|
+
action: i,
|
|
23
|
+
products: a,
|
|
24
|
+
coupon: r,
|
|
25
|
+
selectedProductIds: s = [],
|
|
26
|
+
submitLabel: o,
|
|
27
|
+
currencyCode: l = "USD"
|
|
28
|
+
}) {
|
|
29
|
+
return /* @__PURE__ */ t("form", { action: i, children: [
|
|
30
|
+
/* @__PURE__ */ e("input", { type: "hidden", name: "currency_code", value: l }),
|
|
31
|
+
/* @__PURE__ */ t(m, { children: [
|
|
32
|
+
/* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(p, { children: r?.id ? "Edit Coupon" : "Create Coupon" }) }),
|
|
33
|
+
/* @__PURE__ */ t(h, { className: "space-y-6", children: [
|
|
34
|
+
/* @__PURE__ */ t("div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
35
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
36
|
+
/* @__PURE__ */ e(d, { htmlFor: "coupon-code", children: "Code" }),
|
|
37
|
+
/* @__PURE__ */ e(
|
|
38
|
+
n,
|
|
39
|
+
{
|
|
40
|
+
id: "coupon-code",
|
|
41
|
+
name: "code",
|
|
42
|
+
defaultValue: r?.code || "",
|
|
43
|
+
className: "uppercase",
|
|
44
|
+
required: !0
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
49
|
+
/* @__PURE__ */ e(d, { htmlFor: "coupon-name", children: "Name" }),
|
|
50
|
+
/* @__PURE__ */ e(n, { id: "coupon-name", name: "name", defaultValue: r?.name || "", required: !0 })
|
|
51
|
+
] })
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ t("div", { className: "grid gap-4 md:grid-cols-3", children: [
|
|
54
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
55
|
+
/* @__PURE__ */ e(d, { htmlFor: "provider-scope", children: "Provider scope" }),
|
|
56
|
+
/* @__PURE__ */ t(
|
|
57
|
+
"select",
|
|
58
|
+
{
|
|
59
|
+
id: "provider-scope",
|
|
60
|
+
name: "provider_scope",
|
|
61
|
+
defaultValue: r?.provider_scope || "all",
|
|
62
|
+
className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ e("option", { value: "all", children: "Stripe + Freemius" }),
|
|
65
|
+
/* @__PURE__ */ e("option", { value: "stripe", children: "Stripe only" }),
|
|
66
|
+
/* @__PURE__ */ e("option", { value: "freemius", children: "Freemius only" })
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
] }),
|
|
71
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
72
|
+
/* @__PURE__ */ e(d, { htmlFor: "discount-type", children: "Discount type" }),
|
|
73
|
+
/* @__PURE__ */ t(
|
|
74
|
+
"select",
|
|
75
|
+
{
|
|
76
|
+
id: "discount-type",
|
|
77
|
+
name: "discount_type",
|
|
78
|
+
defaultValue: r?.discount_type || "percent",
|
|
79
|
+
className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ e("option", { value: "percent", children: "Percent" }),
|
|
82
|
+
/* @__PURE__ */ e("option", { value: "fixed", children: "Fixed amount" })
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
88
|
+
/* @__PURE__ */ e(d, { htmlFor: "discount-amount", children: "Amount" }),
|
|
89
|
+
/* @__PURE__ */ e(
|
|
90
|
+
n,
|
|
91
|
+
{
|
|
92
|
+
id: "discount-amount",
|
|
93
|
+
name: "discount_amount",
|
|
94
|
+
type: "number",
|
|
95
|
+
min: "0.01",
|
|
96
|
+
step: "0.01",
|
|
97
|
+
defaultValue: b(r, l),
|
|
98
|
+
required: !0
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "Percent coupons use 1-100. Fixed coupons use regular amounts, for example $10.00." })
|
|
102
|
+
] })
|
|
103
|
+
] }),
|
|
104
|
+
/* @__PURE__ */ t("div", { className: "grid gap-4 md:grid-cols-3", children: [
|
|
105
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
106
|
+
/* @__PURE__ */ e(d, { htmlFor: "starts-at", children: "Starts at" }),
|
|
107
|
+
/* @__PURE__ */ e(
|
|
108
|
+
n,
|
|
109
|
+
{
|
|
110
|
+
id: "starts-at",
|
|
111
|
+
name: "starts_at",
|
|
112
|
+
type: "datetime-local",
|
|
113
|
+
defaultValue: c(r?.starts_at)
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
118
|
+
/* @__PURE__ */ e(d, { htmlFor: "ends-at", children: "Ends at" }),
|
|
119
|
+
/* @__PURE__ */ e(
|
|
120
|
+
n,
|
|
121
|
+
{
|
|
122
|
+
id: "ends-at",
|
|
123
|
+
name: "ends_at",
|
|
124
|
+
type: "datetime-local",
|
|
125
|
+
defaultValue: c(r?.ends_at)
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] }),
|
|
129
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
130
|
+
/* @__PURE__ */ e(d, { htmlFor: "redemption-limit", children: "Redemption limit" }),
|
|
131
|
+
/* @__PURE__ */ e(
|
|
132
|
+
n,
|
|
133
|
+
{
|
|
134
|
+
id: "redemption-limit",
|
|
135
|
+
name: "redemption_limit",
|
|
136
|
+
type: "number",
|
|
137
|
+
min: "1",
|
|
138
|
+
defaultValue: r?.redemption_limit || ""
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
] })
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
144
|
+
/* @__PURE__ */ e(d, { htmlFor: "internal-note", children: "Internal note" }),
|
|
145
|
+
/* @__PURE__ */ e(
|
|
146
|
+
f,
|
|
147
|
+
{
|
|
148
|
+
id: "internal-note",
|
|
149
|
+
name: "internal_note",
|
|
150
|
+
defaultValue: r?.internal_note || "",
|
|
151
|
+
rows: 3
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
] }),
|
|
155
|
+
/* @__PURE__ */ t("div", { className: "rounded-lg border bg-muted/20 p-4", children: [
|
|
156
|
+
/* @__PURE__ */ e("input", { type: "hidden", name: "is_active", value: "false" }),
|
|
157
|
+
/* @__PURE__ */ t("label", { htmlFor: "coupon-active", className: "flex cursor-pointer items-start gap-3", children: [
|
|
158
|
+
/* @__PURE__ */ e(
|
|
159
|
+
"input",
|
|
160
|
+
{
|
|
161
|
+
id: "coupon-active",
|
|
162
|
+
name: "is_active",
|
|
163
|
+
type: "checkbox",
|
|
164
|
+
value: "true",
|
|
165
|
+
defaultChecked: r?.is_active ?? !0,
|
|
166
|
+
className: "mt-0.5 h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary"
|
|
167
|
+
}
|
|
168
|
+
),
|
|
169
|
+
/* @__PURE__ */ t("span", { children: [
|
|
170
|
+
/* @__PURE__ */ e("span", { className: "block text-sm font-medium", children: "Active" }),
|
|
171
|
+
/* @__PURE__ */ e("span", { className: "block text-sm text-muted-foreground", children: "Active coupons can be applied by shoppers during cart and checkout." })
|
|
172
|
+
] })
|
|
173
|
+
] })
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ t("div", { className: "space-y-3", children: [
|
|
176
|
+
/* @__PURE__ */ t("div", { children: [
|
|
177
|
+
/* @__PURE__ */ e("h3", { className: "font-semibold", children: "Product scope" }),
|
|
178
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "Leave every product unchecked to apply this coupon to all products in the selected provider scope." })
|
|
179
|
+
] }),
|
|
180
|
+
/* @__PURE__ */ e(x, { products: a, selectedProductIds: s })
|
|
181
|
+
] }),
|
|
182
|
+
/* @__PURE__ */ e("div", { className: "flex justify-end", children: /* @__PURE__ */ e(v, { type: "submit", children: o }) })
|
|
183
|
+
] })
|
|
184
|
+
] })
|
|
185
|
+
] });
|
|
186
|
+
}
|
|
187
|
+
export {
|
|
188
|
+
V as CouponEditorForm
|
|
189
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("next/link"),r=require("@nextblock-cms/ui"),p=require("@nextblock-cms/db/server"),u=require("lucide-react"),h=require("@nextblock-cms/utils"),d=require("./actions.cjs.js"),f=require("./CreateCouponDialog.cjs.js"),j=require("./product-options.cjs.js");function y(t,n){return t.discount_type==="percent"?`${t.discount_amount}%`:h.formatPrice(t.discount_amount,n)}function g(t,n){return n?t==="synced"||t==="not_required"?"default":"secondary":"outline"}function v(t,n){const i=new Set;for(const c of t||[]){const a=c.product_id;a&&i.add(n.get(a)||a)}return i.size}function _(t,n){const i=v(t,n);return i===0?"All eligible products":`${i} scoped SKU${i===1?"":"s"}`}async function N({searchParams:t}){const n=p.getServiceRoleSupabaseClient();let i=n.from("coupons").select(`
|
|
2
|
+
*,
|
|
3
|
+
coupon_products(product_id),
|
|
4
|
+
coupon_freemius_mappings(sync_status, sync_error)
|
|
5
|
+
`).order("created_at",{ascending:!1});t?.q&&(i=i.or(`code.ilike.%${t.q}%,name.ilike.%${t.q}%`)),t?.status==="active"?i=i.eq("is_active",!0):t?.status==="inactive"&&(i=i.eq("is_active",!1));const[{data:c},{data:a},{data:l}]=await Promise.all([i,n.from("products").select("id, title, sku, payment_provider, freemius_product_id, language:languages(code, name), product_media(sort_order, media(file_path, object_key))").order("title",{ascending:!0}),n.from("currencies").select("code, is_default").eq("is_active",!0)]),o=l?.find(s=>s.is_default)?.code||l?.[0]?.code||"USD",x=new Map((a||[]).map(s=>[s.id,s.sku?.trim().toUpperCase()||s.id]));return e.jsxs("div",{className:"mx-auto w-full max-w-7xl space-y-6 px-6 py-8",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-end md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Coupons"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Create provider-aware discounts for Stripe checkout and Freemius licenses."})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsxs("form",{className:"flex gap-2",action:"/cms/coupons",children:[e.jsx("input",{name:"q",placeholder:"Search coupons",defaultValue:t?.q||"",className:"h-10 rounded-md border border-input bg-background px-3 py-2 text-sm"}),e.jsxs("select",{name:"status",defaultValue:t?.status||"all",className:"h-10 rounded-md border border-input bg-background px-3 py-2 text-sm",children:[e.jsx("option",{value:"all",children:"All"}),e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"inactive",children:"Inactive"})]}),e.jsx(r.Button,{type:"submit",variant:"outline",children:"Filter"})]}),e.jsx(f.CreateCouponDialog,{action:d.createCouponAction,products:j.normalizeCouponProductOptions(a),currencyCode:o})]})]}),e.jsxs(r.Card,{children:[e.jsxs(r.CardHeader,{children:[e.jsx(r.CardTitle,{children:"All Coupons"}),e.jsx(r.CardDescription,{children:"Freemius sync runs when a coupon is created, updated, toggled, or manually resynced."})]}),e.jsx(r.CardContent,{children:e.jsx("div",{className:"overflow-hidden rounded-lg border",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b bg-muted/40 text-xs uppercase text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3",children:"Code"}),e.jsx("th",{className:"px-4 py-3",children:"Scope"}),e.jsx("th",{className:"px-4 py-3",children:"Discount"}),e.jsx("th",{className:"px-4 py-3",children:"Usage"}),e.jsx("th",{className:"px-4 py-3",children:"Sync"}),e.jsx("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y",children:c?.length?c.map(s=>e.jsxs("tr",{className:"align-top",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono font-semibold",children:s.code}),e.jsx(r.Badge,{variant:s.is_active?"default":"outline",children:s.is_active?"Active":"Inactive"})]}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s.name})]}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("span",{className:"capitalize",children:s.provider_scope}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:_(s.coupon_products,x)})]}),e.jsx("td",{className:"px-4 py-3 font-medium",children:y(s,o)}),e.jsxs("td",{className:"px-4 py-3",children:[s.redemptions_count||0,s.redemption_limit?` / ${s.redemption_limit}`:""]}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsx(r.Badge,{variant:g(s.freemius_sync_status,s.is_active),children:s.freemius_sync_status}),s.freemius_sync_error?e.jsx("p",{className:"mt-1 max-w-[220px] text-xs text-destructive",children:s.freemius_sync_error}):null]}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex justify-end gap-1",children:[e.jsx(r.Button,{asChild:!0,variant:"outline",size:"sm",children:e.jsx(m,{href:`/cms/coupons/${s.id}/edit`,children:"Edit"})}),e.jsx("form",{action:async()=>{"use server";await d.toggleCouponActiveAction(s.id,!s.is_active)},children:e.jsx(r.Button,{type:"submit",variant:"outline",size:"sm",children:s.is_active?"Disable":"Enable"})}),e.jsx("form",{action:async()=>{"use server";await d.syncCouponAction(s.id)},children:e.jsx(r.Button,{type:"submit",variant:"ghost",size:"icon",title:"Resync Freemius","aria-label":`Resync Freemius coupon ${s.code}`,children:e.jsx(u.RefreshCw,{className:"h-4 w-4"})})}),e.jsx("form",{action:async()=>{"use server";await d.deleteCouponAction(s.id)},children:e.jsx(r.Button,{type:"submit",variant:"ghost",size:"icon",className:"text-destructive","aria-label":`Delete coupon ${s.code}`,children:e.jsx(u.Trash2,{className:"h-4 w-4"})})})]})})]},s.id)):e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-muted-foreground",children:"No coupons yet."})})})]})})})]})]})}exports.CouponsPage=N;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import p from "next/link";
|
|
3
|
+
import { Button as n, Card as f, CardHeader as h, CardTitle as x, CardDescription as y, CardContent as v, Badge as m } from "@nextblock-cms/ui";
|
|
4
|
+
import { getServiceRoleSupabaseClient as g } from "@nextblock-cms/db/server";
|
|
5
|
+
import { RefreshCw as _, Trash2 as N } from "lucide-react";
|
|
6
|
+
import { formatPrice as b } from "@nextblock-cms/utils";
|
|
7
|
+
import { createCouponAction as C, toggleCouponActiveAction as w, syncCouponAction as S, deleteCouponAction as k } from "./actions.es.js";
|
|
8
|
+
import { CreateCouponDialog as A } from "./CreateCouponDialog.es.js";
|
|
9
|
+
import { normalizeCouponProductOptions as q } from "./product-options.es.js";
|
|
10
|
+
function $(i, a) {
|
|
11
|
+
return i.discount_type === "percent" ? `${i.discount_amount}%` : b(i.discount_amount, a);
|
|
12
|
+
}
|
|
13
|
+
function z(i, a) {
|
|
14
|
+
return a ? i === "synced" || i === "not_required" ? "default" : "secondary" : "outline";
|
|
15
|
+
}
|
|
16
|
+
function D(i, a) {
|
|
17
|
+
const s = /* @__PURE__ */ new Set();
|
|
18
|
+
for (const d of i || []) {
|
|
19
|
+
const c = d.product_id;
|
|
20
|
+
c && s.add(a.get(c) || c);
|
|
21
|
+
}
|
|
22
|
+
return s.size;
|
|
23
|
+
}
|
|
24
|
+
function j(i, a) {
|
|
25
|
+
const s = D(i, a);
|
|
26
|
+
return s === 0 ? "All eligible products" : `${s} scoped SKU${s === 1 ? "" : "s"}`;
|
|
27
|
+
}
|
|
28
|
+
async function H({
|
|
29
|
+
searchParams: i
|
|
30
|
+
}) {
|
|
31
|
+
const a = g();
|
|
32
|
+
let s = a.from("coupons").select(
|
|
33
|
+
`
|
|
34
|
+
*,
|
|
35
|
+
coupon_products(product_id),
|
|
36
|
+
coupon_freemius_mappings(sync_status, sync_error)
|
|
37
|
+
`
|
|
38
|
+
).order("created_at", { ascending: !1 });
|
|
39
|
+
i?.q && (s = s.or(`code.ilike.%${i.q}%,name.ilike.%${i.q}%`)), i?.status === "active" ? s = s.eq("is_active", !0) : i?.status === "inactive" && (s = s.eq("is_active", !1));
|
|
40
|
+
const [{ data: d }, { data: c }, { data: l }] = await Promise.all([
|
|
41
|
+
s,
|
|
42
|
+
a.from("products").select(
|
|
43
|
+
"id, title, sku, payment_provider, freemius_product_id, language:languages(code, name), product_media(sort_order, media(file_path, object_key))"
|
|
44
|
+
).order("title", { ascending: !0 }),
|
|
45
|
+
a.from("currencies").select("code, is_default").eq("is_active", !0)
|
|
46
|
+
]), o = l?.find((t) => t.is_default)?.code || l?.[0]?.code || "USD", u = new Map(
|
|
47
|
+
(c || []).map((t) => [
|
|
48
|
+
t.id,
|
|
49
|
+
t.sku?.trim().toUpperCase() || t.id
|
|
50
|
+
])
|
|
51
|
+
);
|
|
52
|
+
return /* @__PURE__ */ r("div", { className: "mx-auto w-full max-w-7xl space-y-6 px-6 py-8", children: [
|
|
53
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col gap-4 md:flex-row md:items-end md:justify-between", children: [
|
|
54
|
+
/* @__PURE__ */ r("div", { children: [
|
|
55
|
+
/* @__PURE__ */ e("h1", { className: "text-3xl font-bold tracking-tight", children: "Coupons" }),
|
|
56
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "Create provider-aware discounts for Stripe checkout and Freemius licenses." })
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center", children: [
|
|
59
|
+
/* @__PURE__ */ r("form", { className: "flex gap-2", action: "/cms/coupons", children: [
|
|
60
|
+
/* @__PURE__ */ e(
|
|
61
|
+
"input",
|
|
62
|
+
{
|
|
63
|
+
name: "q",
|
|
64
|
+
placeholder: "Search coupons",
|
|
65
|
+
defaultValue: i?.q || "",
|
|
66
|
+
className: "h-10 rounded-md border border-input bg-background px-3 py-2 text-sm"
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
/* @__PURE__ */ r(
|
|
70
|
+
"select",
|
|
71
|
+
{
|
|
72
|
+
name: "status",
|
|
73
|
+
defaultValue: i?.status || "all",
|
|
74
|
+
className: "h-10 rounded-md border border-input bg-background px-3 py-2 text-sm",
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ e("option", { value: "all", children: "All" }),
|
|
77
|
+
/* @__PURE__ */ e("option", { value: "active", children: "Active" }),
|
|
78
|
+
/* @__PURE__ */ e("option", { value: "inactive", children: "Inactive" })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ e(n, { type: "submit", variant: "outline", children: "Filter" })
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ e(
|
|
85
|
+
A,
|
|
86
|
+
{
|
|
87
|
+
action: C,
|
|
88
|
+
products: q(c),
|
|
89
|
+
currencyCode: o
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
] })
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ r(f, { children: [
|
|
95
|
+
/* @__PURE__ */ r(h, { children: [
|
|
96
|
+
/* @__PURE__ */ e(x, { children: "All Coupons" }),
|
|
97
|
+
/* @__PURE__ */ e(y, { children: "Freemius sync runs when a coupon is created, updated, toggled, or manually resynced." })
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ e(v, { children: /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-lg border", children: /* @__PURE__ */ r("table", { className: "w-full text-left text-sm", children: [
|
|
100
|
+
/* @__PURE__ */ e("thead", { className: "border-b bg-muted/40 text-xs uppercase text-muted-foreground", children: /* @__PURE__ */ r("tr", { children: [
|
|
101
|
+
/* @__PURE__ */ e("th", { className: "px-4 py-3", children: "Code" }),
|
|
102
|
+
/* @__PURE__ */ e("th", { className: "px-4 py-3", children: "Scope" }),
|
|
103
|
+
/* @__PURE__ */ e("th", { className: "px-4 py-3", children: "Discount" }),
|
|
104
|
+
/* @__PURE__ */ e("th", { className: "px-4 py-3", children: "Usage" }),
|
|
105
|
+
/* @__PURE__ */ e("th", { className: "px-4 py-3", children: "Sync" }),
|
|
106
|
+
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-right", children: "Actions" })
|
|
107
|
+
] }) }),
|
|
108
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y", children: d?.length ? d.map((t) => /* @__PURE__ */ r("tr", { className: "align-top", children: [
|
|
109
|
+
/* @__PURE__ */ r("td", { className: "px-4 py-3", children: [
|
|
110
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
111
|
+
/* @__PURE__ */ e("span", { className: "font-mono font-semibold", children: t.code }),
|
|
112
|
+
/* @__PURE__ */ e(m, { variant: t.is_active ? "default" : "outline", children: t.is_active ? "Active" : "Inactive" })
|
|
113
|
+
] }),
|
|
114
|
+
/* @__PURE__ */ e("p", { className: "mt-1 text-xs text-muted-foreground", children: t.name })
|
|
115
|
+
] }),
|
|
116
|
+
/* @__PURE__ */ r("td", { className: "px-4 py-3", children: [
|
|
117
|
+
/* @__PURE__ */ e("span", { className: "capitalize", children: t.provider_scope }),
|
|
118
|
+
/* @__PURE__ */ e("p", { className: "mt-1 text-xs text-muted-foreground", children: j(t.coupon_products, u) })
|
|
119
|
+
] }),
|
|
120
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 font-medium", children: $(t, o) }),
|
|
121
|
+
/* @__PURE__ */ r("td", { className: "px-4 py-3", children: [
|
|
122
|
+
t.redemptions_count || 0,
|
|
123
|
+
t.redemption_limit ? ` / ${t.redemption_limit}` : ""
|
|
124
|
+
] }),
|
|
125
|
+
/* @__PURE__ */ r("td", { className: "px-4 py-3", children: [
|
|
126
|
+
/* @__PURE__ */ e(m, { variant: z(t.freemius_sync_status, t.is_active), children: t.freemius_sync_status }),
|
|
127
|
+
t.freemius_sync_error ? /* @__PURE__ */ e("p", { className: "mt-1 max-w-[220px] text-xs text-destructive", children: t.freemius_sync_error }) : null
|
|
128
|
+
] }),
|
|
129
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */ r("div", { className: "flex justify-end gap-1", children: [
|
|
130
|
+
/* @__PURE__ */ e(n, { asChild: !0, variant: "outline", size: "sm", children: /* @__PURE__ */ e(p, { href: `/cms/coupons/${t.id}/edit`, children: "Edit" }) }),
|
|
131
|
+
/* @__PURE__ */ e("form", { action: async () => {
|
|
132
|
+
"use server";
|
|
133
|
+
await w(t.id, !t.is_active);
|
|
134
|
+
}, children: /* @__PURE__ */ e(n, { type: "submit", variant: "outline", size: "sm", children: t.is_active ? "Disable" : "Enable" }) }),
|
|
135
|
+
/* @__PURE__ */ e("form", { action: async () => {
|
|
136
|
+
"use server";
|
|
137
|
+
await S(t.id);
|
|
138
|
+
}, children: /* @__PURE__ */ e(
|
|
139
|
+
n,
|
|
140
|
+
{
|
|
141
|
+
type: "submit",
|
|
142
|
+
variant: "ghost",
|
|
143
|
+
size: "icon",
|
|
144
|
+
title: "Resync Freemius",
|
|
145
|
+
"aria-label": `Resync Freemius coupon ${t.code}`,
|
|
146
|
+
children: /* @__PURE__ */ e(_, { className: "h-4 w-4" })
|
|
147
|
+
}
|
|
148
|
+
) }),
|
|
149
|
+
/* @__PURE__ */ e("form", { action: async () => {
|
|
150
|
+
"use server";
|
|
151
|
+
await k(t.id);
|
|
152
|
+
}, children: /* @__PURE__ */ e(
|
|
153
|
+
n,
|
|
154
|
+
{
|
|
155
|
+
type: "submit",
|
|
156
|
+
variant: "ghost",
|
|
157
|
+
size: "icon",
|
|
158
|
+
className: "text-destructive",
|
|
159
|
+
"aria-label": `Delete coupon ${t.code}`,
|
|
160
|
+
children: /* @__PURE__ */ e(N, { className: "h-4 w-4" })
|
|
161
|
+
}
|
|
162
|
+
) })
|
|
163
|
+
] }) })
|
|
164
|
+
] }, t.id)) : /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 6, className: "px-4 py-10 text-center text-muted-foreground", children: "No coupons yet." }) }) })
|
|
165
|
+
] }) }) })
|
|
166
|
+
] })
|
|
167
|
+
] });
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
H as CouponsPage
|
|
171
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),i=require("@nextblock-cms/ui/button"),o=require("@nextblock-cms/ui/dialog"),u=require("lucide-react"),c=require("./CouponEditorForm.cjs.js");function x({action:t,products:r,currencyCode:a}){const[n,s]=l.useState(!1);return e.jsxs(o.Dialog,{open:n,onOpenChange:s,children:[e.jsx(o.DialogTrigger,{asChild:!0,children:e.jsxs(i.Button,{type:"button",className:"gap-2",children:[e.jsx(u.Plus,{className:"h-4 w-4"}),"Create Coupon"]})}),e.jsxs(o.DialogContent,{className:"max-h-[90vh] overflow-y-auto sm:max-w-[92vw] lg:max-w-5xl xl:max-w-6xl",children:[e.jsx(o.DialogHeader,{children:e.jsx(o.DialogTitle,{className:"sr-only",children:"Create Coupon"})}),e.jsx(c.CouponEditorForm,{action:t,products:r,submitLabel:"Create Coupon",currencyCode:a})]})]})}exports.CreateCouponDialog=x;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { useState as i } from "react";
|
|
4
|
+
import { Button as m } from "@nextblock-cms/ui/button";
|
|
5
|
+
import { Dialog as s, DialogTrigger as p, DialogContent as u, DialogHeader as c, DialogTitle as C } from "@nextblock-cms/ui/dialog";
|
|
6
|
+
import { Plus as g } from "lucide-react";
|
|
7
|
+
import { CouponEditorForm as h } from "./CouponEditorForm.es.js";
|
|
8
|
+
function b({
|
|
9
|
+
action: r,
|
|
10
|
+
products: a,
|
|
11
|
+
currencyCode: t
|
|
12
|
+
}) {
|
|
13
|
+
const [l, n] = i(!1);
|
|
14
|
+
return /* @__PURE__ */ e(s, { open: l, onOpenChange: n, children: [
|
|
15
|
+
/* @__PURE__ */ o(p, { asChild: !0, children: /* @__PURE__ */ e(m, { type: "button", className: "gap-2", children: [
|
|
16
|
+
/* @__PURE__ */ o(g, { className: "h-4 w-4" }),
|
|
17
|
+
"Create Coupon"
|
|
18
|
+
] }) }),
|
|
19
|
+
/* @__PURE__ */ e(u, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[92vw] lg:max-w-5xl xl:max-w-6xl", children: [
|
|
20
|
+
/* @__PURE__ */ o(c, { children: /* @__PURE__ */ o(C, { className: "sr-only", children: "Create Coupon" }) }),
|
|
21
|
+
/* @__PURE__ */ o(
|
|
22
|
+
h,
|
|
23
|
+
{
|
|
24
|
+
action: r,
|
|
25
|
+
products: a,
|
|
26
|
+
submitLabel: "Create Coupon",
|
|
27
|
+
currencyCode: t
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
] })
|
|
31
|
+
] });
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
b as CreateCouponDialog
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("next/link"),p=require("next/navigation"),m=require("@nextblock-cms/ui"),f=require("@nextblock-cms/db/server"),x=require("./actions.cjs.js"),g=require("./CouponEditorForm.cjs.js"),C=require("./product-options.cjs.js");async function _({params:n}){const{id:o}=await n,t=f.getServiceRoleSupabaseClient(),[{data:s},{data:c},{data:u},{data:i}]=await Promise.all([t.from("coupons").select("*").eq("id",o).single(),t.from("products").select("id, title, sku, payment_provider, freemius_product_id, language:languages(code, name), product_media(sort_order, media(file_path, object_key))").order("title",{ascending:!0}),t.from("coupon_products").select("product_id").eq("coupon_id",o),t.from("currencies").select("code, is_default").eq("is_active",!0)]);s||p.notFound();const d=(u||[]).map(r=>r.product_id),a=i?.find(r=>r.is_default)?.code||i?.[0]?.code||"USD";return e.jsxs("div",{className:"mx-auto w-full max-w-5xl space-y-6 px-6 py-8",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Edit Coupon"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Changes are resynced to Freemius after saving."})]}),e.jsx(m.Button,{asChild:!0,variant:"outline",children:e.jsx(l,{href:"/cms/coupons",children:"Back to coupons"})})]}),e.jsx(g.CouponEditorForm,{action:x.updateCouponAction.bind(null,o),products:C.normalizeCouponProductOptions(c),coupon:s,selectedProductIds:d,submitLabel:"Save Coupon",currencyCode:a})]})}exports.EditCouponPage=_;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import l from "next/link";
|
|
3
|
+
import { notFound as m } from "next/navigation";
|
|
4
|
+
import { Button as f } from "@nextblock-cms/ui";
|
|
5
|
+
import { getServiceRoleSupabaseClient as _ } from "@nextblock-cms/db/server";
|
|
6
|
+
import { updateCouponAction as g } from "./actions.es.js";
|
|
7
|
+
import { CouponEditorForm as h } from "./CouponEditorForm.es.js";
|
|
8
|
+
import { normalizeCouponProductOptions as x } from "./product-options.es.js";
|
|
9
|
+
async function N({ params: n }) {
|
|
10
|
+
const { id: t } = await n, o = _(), [
|
|
11
|
+
{ data: c },
|
|
12
|
+
{ data: a },
|
|
13
|
+
{ data: s },
|
|
14
|
+
{ data: d }
|
|
15
|
+
] = await Promise.all([
|
|
16
|
+
o.from("coupons").select("*").eq("id", t).single(),
|
|
17
|
+
o.from("products").select(
|
|
18
|
+
"id, title, sku, payment_provider, freemius_product_id, language:languages(code, name), product_media(sort_order, media(file_path, object_key))"
|
|
19
|
+
).order("title", { ascending: !0 }),
|
|
20
|
+
o.from("coupon_products").select("product_id").eq("coupon_id", t),
|
|
21
|
+
o.from("currencies").select("code, is_default").eq("is_active", !0)
|
|
22
|
+
]);
|
|
23
|
+
c || m();
|
|
24
|
+
const u = (s || []).map((r) => r.product_id), p = d?.find((r) => r.is_default)?.code || d?.[0]?.code || "USD";
|
|
25
|
+
return /* @__PURE__ */ i("div", { className: "mx-auto w-full max-w-5xl space-y-6 px-6 py-8", children: [
|
|
26
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
27
|
+
/* @__PURE__ */ i("div", { children: [
|
|
28
|
+
/* @__PURE__ */ e("h1", { className: "text-3xl font-bold tracking-tight", children: "Edit Coupon" }),
|
|
29
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "Changes are resynced to Freemius after saving." })
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ e(f, { asChild: !0, variant: "outline", children: /* @__PURE__ */ e(l, { href: "/cms/coupons", children: "Back to coupons" }) })
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ e(
|
|
34
|
+
h,
|
|
35
|
+
{
|
|
36
|
+
action: g.bind(null, t),
|
|
37
|
+
products: x(a),
|
|
38
|
+
coupon: c,
|
|
39
|
+
selectedProductIds: u,
|
|
40
|
+
submitLabel: "Save Coupon",
|
|
41
|
+
currencyCode: p
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
] });
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
N as EditCouponPage
|
|
48
|
+
};
|