@nextblock-cms/ecom 0.18.8 → 0.19.2
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 +26 -25
- package/lib/CurrencyProvider.cjs.js +1 -1
- package/lib/CurrencyProvider.es.js +41 -45
- package/lib/PaymentReadinessProvider.cjs.js +1 -1
- package/lib/PaymentReadinessProvider.es.js +15 -19
- package/lib/cart-store.cjs.js +1 -1
- package/lib/cart-store.d.ts +4 -0
- package/lib/cart-store.es.js +77 -69
- package/lib/components/AccountNavigationMenu.cjs.js +1 -1
- package/lib/components/AccountNavigationMenu.es.js +44 -62
- package/lib/components/AddToCartButton.cjs.js +1 -1
- package/lib/components/AddToCartButton.es.js +50 -78
- package/lib/components/Cart.cjs.js +1 -1
- package/lib/components/Cart.es.js +154 -381
- package/lib/components/CartDrawer.cjs.js +1 -1
- package/lib/components/CartDrawer.es.js +143 -297
- package/lib/components/CartIcon.cjs.js +1 -1
- package/lib/components/CartIcon.es.js +21 -47
- package/lib/components/Checkout.cjs.js +1 -1
- package/lib/components/Checkout.es.js +814 -1614
- package/lib/components/CouponForm.cjs.js +1 -1
- package/lib/components/CouponForm.es.js +104 -155
- package/lib/components/CurrencySwitcher.cjs.js +1 -1
- package/lib/components/CurrencySwitcher.es.js +14 -33
- package/lib/components/CustomerProfileForm.cjs.js +1 -1
- package/lib/components/CustomerProfileForm.es.js +264 -672
- package/lib/components/FeaturedProduct.cjs.js +1 -1
- package/lib/components/FeaturedProduct.es.js +46 -125
- package/lib/components/FreemiusLicensePanel.cjs.js +1 -1
- package/lib/components/FreemiusLicensePanel.es.js +45 -125
- package/lib/components/InvoiceDocument.cjs.js +1 -1
- package/lib/components/InvoiceDocument.es.js +148 -487
- package/lib/components/InvoiceViewerShell.cjs.js +2 -2
- package/lib/components/InvoiceViewerShell.d.ts +4 -1
- package/lib/components/InvoiceViewerShell.es.js +59 -142
- package/lib/components/ProductCard.cjs.js +1 -1
- package/lib/components/ProductCard.d.ts +3 -1
- package/lib/components/ProductCard.es.js +128 -242
- package/lib/components/ProductDetailsLayout.cjs.js +1 -1
- package/lib/components/ProductDetailsLayout.es.js +311 -652
- package/lib/components/ProductGallery.cjs.js +1 -1
- package/lib/components/ProductGallery.d.ts +2 -0
- package/lib/components/ProductGallery.es.js +37 -66
- package/lib/components/ProductGrid.cjs.js +1 -1
- package/lib/components/ProductGrid.es.js +23 -32
- package/lib/components/ShippingEstimator.cjs.js +1 -1
- package/lib/components/ShippingEstimator.es.js +118 -231
- package/lib/components/SimpleTiptapRenderer.cjs.js +1 -1
- package/lib/components/SimpleTiptapRenderer.es.js +111 -294
- package/lib/components/SubscriptionSelector.cjs.js +1 -1
- package/lib/components/SubscriptionSelector.es.js +120 -181
- package/lib/freemius-trial-provision.cjs.js +1 -0
- package/lib/freemius-trial-provision.d.ts +85 -0
- package/lib/freemius-trial-provision.es.js +136 -0
- package/lib/invoice.cjs.js +1 -1
- package/lib/invoice.d.ts +1 -1
- package/lib/invoice.es.js +6 -5
- package/lib/pages/cms/coupons/CouponEditorForm.cjs.js +1 -1
- package/lib/pages/cms/coupons/CouponEditorForm.es.js +115 -375
- package/lib/pages/cms/coupons/CouponsPage.cjs.js +2 -2
- package/lib/pages/cms/coupons/CouponsPage.es.js +116 -368
- package/lib/pages/cms/coupons/CreateCouponDialog.cjs.js +1 -1
- package/lib/pages/cms/coupons/CreateCouponDialog.es.js +26 -62
- package/lib/pages/cms/coupons/EditCouponPage.cjs.js +1 -1
- package/lib/pages/cms/coupons/EditCouponPage.es.js +35 -71
- package/lib/pages/cms/coupons/ProductScopePicker.cjs.js +1 -1
- package/lib/pages/cms/coupons/ProductScopePicker.es.js +72 -167
- package/lib/pages/cms/orders/ExportReportsDialog.cjs.js +1 -1
- package/lib/pages/cms/orders/ExportReportsDialog.es.js +87 -247
- package/lib/pages/cms/orders/OrderDetailPage.cjs.js +1 -1
- package/lib/pages/cms/orders/OrderDetailPage.es.js +95 -283
- package/lib/pages/cms/orders/OrderPrintButton.cjs.js +1 -1
- package/lib/pages/cms/orders/OrderPrintButton.es.js +9 -21
- package/lib/pages/cms/orders/OrderStatusForm.cjs.js +1 -1
- package/lib/pages/cms/orders/OrderStatusForm.es.js +46 -106
- package/lib/pages/cms/orders/OrdersPage.cjs.js +1 -1
- package/lib/pages/cms/orders/OrdersPage.es.js +78 -257
- package/lib/pages/cms/payments/PaymentsClient.cjs.js +1 -1
- package/lib/pages/cms/payments/PaymentsClient.es.js +192 -580
- package/lib/pages/cms/payments/PaymentsPage.cjs.js +1 -1
- package/lib/pages/cms/payments/PaymentsPage.es.js +14 -22
- package/lib/pages/cms/products/ProductsPage.cjs.js +1 -1
- package/lib/pages/cms/products/ProductsPage.es.js +47 -87
- package/lib/pages/cms/products/_id_/edit/EditProductPage.cjs.js +1 -1
- package/lib/pages/cms/products/_id_/edit/EditProductPage.es.js +97 -177
- package/lib/pages/cms/products/attributes/AttributeManagementPage.cjs.js +1 -1
- package/lib/pages/cms/products/attributes/AttributeManagementPage.es.js +40 -84
- package/lib/pages/cms/products/attributes/components/AttributeManager.cjs.js +1 -1
- package/lib/pages/cms/products/attributes/components/AttributeManager.es.js +192 -455
- package/lib/pages/cms/products/categories/CategoryManagementPage.cjs.js +1 -1
- package/lib/pages/cms/products/categories/CategoryManagementPage.es.js +28 -72
- package/lib/pages/cms/products/categories/components/CategoryManager.cjs.js +1 -1
- package/lib/pages/cms/products/categories/components/CategoryManager.es.js +183 -490
- package/lib/pages/cms/products/components/CopyProductFromLanguage.cjs.js +1 -1
- package/lib/pages/cms/products/components/CopyProductFromLanguage.es.js +69 -177
- package/lib/pages/cms/products/components/CurrencyPriceFields.cjs.js +1 -1
- package/lib/pages/cms/products/components/CurrencyPriceFields.es.js +102 -213
- package/lib/pages/cms/products/components/DeleteProductButton.cjs.js +1 -1
- package/lib/pages/cms/products/components/DeleteProductButton.es.js +25 -45
- package/lib/pages/cms/products/components/FreemiusPricingDashboard.cjs.js +1 -1
- package/lib/pages/cms/products/components/FreemiusPricingDashboard.es.js +58 -202
- package/lib/pages/cms/products/components/ProductCategorySelector.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductCategorySelector.es.js +89 -235
- package/lib/pages/cms/products/components/ProductForm.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductForm.es.js +526 -1110
- package/lib/pages/cms/products/components/ProductMediaManager.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductMediaManager.es.js +63 -154
- package/lib/pages/cms/products/components/ProductsBulkTable.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductsBulkTable.es.js +213 -544
- package/lib/pages/cms/products/components/SaleScheduleFields.cjs.js +1 -1
- package/lib/pages/cms/products/components/SaleScheduleFields.es.js +91 -207
- package/lib/pages/cms/products/components/SyncFreemiusButton.cjs.js +1 -1
- package/lib/pages/cms/products/components/SyncFreemiusButton.es.js +16 -28
- package/lib/pages/cms/products/components/SyncFreemiusPricingButton.cjs.js +2 -2
- package/lib/pages/cms/products/components/SyncFreemiusPricingButton.es.js +25 -37
- package/lib/pages/cms/products/components/VariationsEditor.cjs.js +1 -1
- package/lib/pages/cms/products/components/VariationsEditor.es.js +261 -492
- package/lib/pages/cms/products/inventory/InventoryPage.cjs.js +1 -1
- package/lib/pages/cms/products/inventory/InventoryPage.es.js +12 -32
- package/lib/pages/cms/products/inventory/InventoryTableClient.cjs.js +2 -2
- package/lib/pages/cms/products/inventory/InventoryTableClient.es.js +145 -365
- package/lib/pages/cms/products/new/NewProductPage.cjs.js +1 -1
- package/lib/pages/cms/products/new/NewProductPage.es.js +30 -42
- package/lib/pages/cms/shipping/ShippingPage.cjs.js +2 -2
- package/lib/pages/cms/shipping/ShippingPage.es.js +155 -507
- package/lib/pages/cms/shipping/components/RateForm.cjs.js +1 -1
- package/lib/pages/cms/shipping/components/RateForm.es.js +334 -717
- package/lib/pages/cms/shipping/components/ZoneForm.cjs.js +1 -1
- package/lib/pages/cms/shipping/components/ZoneForm.es.js +158 -392
- package/lib/pages/cms/taxes/TaxesPage.cjs.js +1 -1
- package/lib/pages/cms/taxes/TaxesPage.es.js +119 -447
- package/lib/pages/cms/taxes/components/TaxRateForm.cjs.js +1 -1
- package/lib/pages/cms/taxes/components/TaxRateForm.es.js +52 -156
- package/lib/product-context.cjs.js +1 -1
- package/lib/product-context.es.js +10 -14
- package/lib/trials.cjs.js +1 -1
- package/lib/trials.d.ts +10 -3
- package/lib/trials.es.js +28 -21
- package/lib/types.d.ts +2 -0
- package/lib/use-price-formatter.cjs.js +1 -0
- package/lib/use-price-formatter.d.ts +11 -0
- package/lib/use-price-formatter.es.js +13 -0
- package/lib/variation-utils.cjs.js +1 -1
- package/lib/variation-utils.d.ts +10 -0
- package/lib/variation-utils.es.js +139 -123
- package/package.json +4 -4
- package/server.cjs.js +1 -1
- package/server.d.ts +1 -0
- package/server.es.js +180 -172
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-
|
|
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;
|
|
@@ -1,71 +1,35 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import { useState as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Dialog as
|
|
6
|
-
import { Plus as
|
|
7
|
-
import { CouponEditorForm as
|
|
8
|
-
function
|
|
9
|
-
action:
|
|
10
|
-
products:
|
|
11
|
-
currencyCode:
|
|
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
12
|
}) {
|
|
13
|
-
const [
|
|
14
|
-
return /* @__PURE__ */ e(
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/CreateCouponDialog.tsx",
|
|
18
|
-
lineNumber: 32,
|
|
19
|
-
columnNumber: 11
|
|
20
|
-
}, this),
|
|
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" }),
|
|
21
17
|
"Create Coupon"
|
|
22
|
-
] }
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/CreateCouponDialog.tsx",
|
|
28
|
-
lineNumber: 30,
|
|
29
|
-
columnNumber: 7
|
|
30
|
-
}, this),
|
|
31
|
-
/* @__PURE__ */ e(c, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[92vw] lg:max-w-5xl xl:max-w-6xl", children: [
|
|
32
|
-
/* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(p, { className: "sr-only", children: "Create Coupon" }, void 0, !1, {
|
|
33
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/CreateCouponDialog.tsx",
|
|
34
|
-
lineNumber: 38,
|
|
35
|
-
columnNumber: 11
|
|
36
|
-
}, this) }, void 0, !1, {
|
|
37
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/CreateCouponDialog.tsx",
|
|
38
|
-
lineNumber: 37,
|
|
39
|
-
columnNumber: 9
|
|
40
|
-
}, this),
|
|
41
|
-
/* @__PURE__ */ e(
|
|
42
|
-
C,
|
|
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,
|
|
43
23
|
{
|
|
44
|
-
action:
|
|
45
|
-
products:
|
|
24
|
+
action: r,
|
|
25
|
+
products: a,
|
|
46
26
|
submitLabel: "Create Coupon",
|
|
47
|
-
currencyCode:
|
|
48
|
-
}
|
|
49
|
-
void 0,
|
|
50
|
-
!1,
|
|
51
|
-
{
|
|
52
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/CreateCouponDialog.tsx",
|
|
53
|
-
lineNumber: 40,
|
|
54
|
-
columnNumber: 9
|
|
55
|
-
},
|
|
56
|
-
this
|
|
27
|
+
currencyCode: t
|
|
28
|
+
}
|
|
57
29
|
)
|
|
58
|
-
] }
|
|
59
|
-
|
|
60
|
-
lineNumber: 36,
|
|
61
|
-
columnNumber: 7
|
|
62
|
-
}, this)
|
|
63
|
-
] }, void 0, !0, {
|
|
64
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/CreateCouponDialog.tsx",
|
|
65
|
-
lineNumber: 29,
|
|
66
|
-
columnNumber: 5
|
|
67
|
-
}, this);
|
|
30
|
+
] })
|
|
31
|
+
] });
|
|
68
32
|
}
|
|
69
33
|
export {
|
|
70
|
-
|
|
34
|
+
b as CreateCouponDialog
|
|
71
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-
|
|
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=_;
|
|
@@ -1,84 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { notFound as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { getServiceRoleSupabaseClient as
|
|
6
|
-
import { updateCouponAction as
|
|
7
|
-
import { CouponEditorForm as
|
|
8
|
-
import { normalizeCouponProductOptions as
|
|
9
|
-
async function
|
|
10
|
-
const { id:
|
|
11
|
-
{ data:
|
|
12
|
-
{ data:
|
|
13
|
-
{ data:
|
|
14
|
-
{ data:
|
|
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
15
|
] = await Promise.all([
|
|
16
|
-
o.from("coupons").select("*").eq("id",
|
|
16
|
+
o.from("coupons").select("*").eq("id", t).single(),
|
|
17
17
|
o.from("products").select(
|
|
18
18
|
"id, title, sku, payment_provider, freemius_product_id, language:languages(code, name), product_media(sort_order, media(file_path, object_key))"
|
|
19
19
|
).order("title", { ascending: !0 }),
|
|
20
|
-
o.from("coupon_products").select("product_id").eq("coupon_id",
|
|
20
|
+
o.from("coupon_products").select("product_id").eq("coupon_id", t),
|
|
21
21
|
o.from("currencies").select("code, is_default").eq("is_active", !0)
|
|
22
22
|
]);
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */ e("h1", { className: "text-3xl font-bold tracking-tight", children: "Edit Coupon" },
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "Changes are resynced to Freemius after saving." }, void 0, !1, {
|
|
34
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/EditCouponPage.tsx",
|
|
35
|
-
lineNumber: 51,
|
|
36
|
-
columnNumber: 11
|
|
37
|
-
}, this)
|
|
38
|
-
] }, void 0, !0, {
|
|
39
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/EditCouponPage.tsx",
|
|
40
|
-
lineNumber: 49,
|
|
41
|
-
columnNumber: 9
|
|
42
|
-
}, this),
|
|
43
|
-
/* @__PURE__ */ e(p, { asChild: !0, variant: "outline", children: /* @__PURE__ */ e(d, { href: "/cms/coupons", children: "Back to coupons" }, void 0, !1, {
|
|
44
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/EditCouponPage.tsx",
|
|
45
|
-
lineNumber: 56,
|
|
46
|
-
columnNumber: 11
|
|
47
|
-
}, this) }, void 0, !1, {
|
|
48
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/EditCouponPage.tsx",
|
|
49
|
-
lineNumber: 55,
|
|
50
|
-
columnNumber: 9
|
|
51
|
-
}, this)
|
|
52
|
-
] }, void 0, !0, {
|
|
53
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/EditCouponPage.tsx",
|
|
54
|
-
lineNumber: 48,
|
|
55
|
-
columnNumber: 7
|
|
56
|
-
}, this),
|
|
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
|
+
] }),
|
|
57
33
|
/* @__PURE__ */ e(
|
|
58
|
-
|
|
34
|
+
h,
|
|
59
35
|
{
|
|
60
|
-
action:
|
|
61
|
-
products:
|
|
62
|
-
coupon:
|
|
63
|
-
selectedProductIds:
|
|
36
|
+
action: g.bind(null, t),
|
|
37
|
+
products: x(a),
|
|
38
|
+
coupon: c,
|
|
39
|
+
selectedProductIds: u,
|
|
64
40
|
submitLabel: "Save Coupon",
|
|
65
|
-
currencyCode:
|
|
66
|
-
}
|
|
67
|
-
void 0,
|
|
68
|
-
!1,
|
|
69
|
-
{
|
|
70
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/EditCouponPage.tsx",
|
|
71
|
-
lineNumber: 60,
|
|
72
|
-
columnNumber: 7
|
|
73
|
-
},
|
|
74
|
-
this
|
|
41
|
+
currencyCode: p
|
|
42
|
+
}
|
|
75
43
|
)
|
|
76
|
-
] }
|
|
77
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/EditCouponPage.tsx",
|
|
78
|
-
lineNumber: 47,
|
|
79
|
-
columnNumber: 5
|
|
80
|
-
}, this);
|
|
44
|
+
] });
|
|
81
45
|
}
|
|
82
46
|
export {
|
|
83
|
-
|
|
47
|
+
N as EditCouponPage
|
|
84
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),p=require("@nextblock-cms/ui/button"),j=require("@nextblock-cms/ui/input"),y=require("lucide-react");function k(s){const r=s.sku?.trim();return r?r.toUpperCase():`PRODUCT:${s.id}`}function v(s){const r=new Map;for(const o of s){const c=k(o),i=r.get(c);if(i){i.productIds.push(o.id);continue}r.set(c,{key:c,title:o.title,sku:o.sku?.trim()||"No SKU",thumbnailUrl:o.thumbnailUrl??null,productIds:[o.id]})}return[...r.values()]}function S({products:s,selectedProductIds:r=[]}){const o=a.useMemo(()=>new Set(r),[r]),[c,i]=a.useState(o),[u,b]=a.useState(""),d=a.useMemo(()=>v(s),[s]),h=a.useMemo(()=>{const t=u.trim().toLowerCase();return t?d.filter(n=>[n.title,n.sku].some(l=>l.toLowerCase().includes(t))):d},[d,u]),x=t=>{i(new Set(s.filter(n=>n.payment_provider===t).map(n=>n.id)))};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(p.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>i(new Set(s.map(t=>t.id))),children:"Select All"}),e.jsx(p.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>x("stripe"),children:"Stripe"}),e.jsx(p.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>x("freemius"),children:"Freemius"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(y.Search,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(j.Input,{type:"search",value:u,onChange:t=>b(t.target.value),placeholder:"Search products by title or SKU",className:"pl-9"})]}),e.jsxs("div",{className:"grid max-h-[420px] gap-2 overflow-y-auto rounded-lg border p-3 md:grid-cols-2",children:[h.map(t=>{const n=t.productIds.some(l=>c.has(l));return e.jsxs("label",{className:"flex cursor-pointer items-center gap-3 rounded-md px-2 py-2 hover:bg-muted/40",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:l=>{const m=new Set(c);for(const f of t.productIds)l.target.checked?m.add(f):m.delete(f);i(m)},className:"mt-0.5 h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary"}),n?t.productIds.map(l=>e.jsx("input",{type:"hidden",name:"product_ids",value:l},l)):null,e.jsx("span",{className:"flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-md border bg-muted",children:t.thumbnailUrl?e.jsx("img",{src:t.thumbnailUrl,alt:"",loading:"lazy",className:"h-full w-full object-cover"}):e.jsx(y.ImageIcon,{className:"h-5 w-5 text-muted-foreground","aria-hidden":"true"})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block whitespace-normal break-words text-sm font-medium",children:t.title}),e.jsx("span",{className:"block font-mono text-xs text-muted-foreground",children:t.sku})]})]},t.key)}),h.length===0?e.jsx("div",{className:"px-2 py-8 text-center text-sm text-muted-foreground md:col-span-2",children:"No matching products."}):null]})]})}exports.ProductScopePicker=S;
|
|
@@ -1,215 +1,120 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Input as
|
|
6
|
-
import { Search as
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
return
|
|
2
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as p, useState as b } from "react";
|
|
4
|
+
import { Button as h } from "@nextblock-cms/ui/button";
|
|
5
|
+
import { Input as v } from "@nextblock-cms/ui/input";
|
|
6
|
+
import { Search as w, ImageIcon as g } from "lucide-react";
|
|
7
|
+
function N(r) {
|
|
8
|
+
const s = r.sku?.trim();
|
|
9
|
+
return s ? s.toUpperCase() : `PRODUCT:${r.id}`;
|
|
10
10
|
}
|
|
11
11
|
function S(r) {
|
|
12
|
-
const
|
|
13
|
-
for (const
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
|
|
12
|
+
const s = /* @__PURE__ */ new Map();
|
|
13
|
+
for (const o of r) {
|
|
14
|
+
const a = N(o), i = s.get(a);
|
|
15
|
+
if (i) {
|
|
16
|
+
i.productIds.push(o.id);
|
|
17
17
|
continue;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
key:
|
|
21
|
-
title:
|
|
22
|
-
sku:
|
|
23
|
-
thumbnailUrl:
|
|
24
|
-
productIds: [
|
|
19
|
+
s.set(a, {
|
|
20
|
+
key: a,
|
|
21
|
+
title: o.title,
|
|
22
|
+
sku: o.sku?.trim() || "No SKU",
|
|
23
|
+
thumbnailUrl: o.thumbnailUrl ?? null,
|
|
24
|
+
productIds: [o.id]
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
return [...
|
|
27
|
+
return [...s.values()];
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function P({
|
|
30
30
|
products: r,
|
|
31
|
-
selectedProductIds:
|
|
31
|
+
selectedProductIds: s = []
|
|
32
32
|
}) {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
return
|
|
36
|
-
(
|
|
33
|
+
const o = p(() => new Set(s), [s]), [a, i] = b(o), [d, k] = b(""), u = p(() => S(r), [r]), f = p(() => {
|
|
34
|
+
const e = d.trim().toLowerCase();
|
|
35
|
+
return e ? u.filter(
|
|
36
|
+
(n) => [n.title, n.sku].some((l) => l.toLowerCase().includes(e))
|
|
37
37
|
) : u;
|
|
38
|
-
}, [u,
|
|
39
|
-
|
|
38
|
+
}, [u, d]), x = (e) => {
|
|
39
|
+
i(
|
|
40
40
|
new Set(
|
|
41
|
-
r.filter((
|
|
41
|
+
r.filter((n) => n.payment_provider === e).map((n) => n.id)
|
|
42
42
|
)
|
|
43
43
|
);
|
|
44
44
|
};
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
45
|
+
return /* @__PURE__ */ c("div", { className: "space-y-3", children: [
|
|
46
|
+
/* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
47
|
+
/* @__PURE__ */ t(
|
|
48
|
+
h,
|
|
49
49
|
{
|
|
50
50
|
type: "button",
|
|
51
51
|
variant: "outline",
|
|
52
52
|
size: "sm",
|
|
53
|
-
onClick: () =>
|
|
53
|
+
onClick: () => i(new Set(r.map((e) => e.id))),
|
|
54
54
|
children: "Select All"
|
|
55
|
-
}
|
|
56
|
-
void 0,
|
|
57
|
-
!1,
|
|
58
|
-
{
|
|
59
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/ProductScopePicker.tsx",
|
|
60
|
-
lineNumber: 94,
|
|
61
|
-
columnNumber: 9
|
|
62
|
-
},
|
|
63
|
-
this
|
|
55
|
+
}
|
|
64
56
|
),
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
|
|
72
|
-
lineNumber: 105,
|
|
73
|
-
columnNumber: 9
|
|
74
|
-
}, this)
|
|
75
|
-
] }, void 0, !0, {
|
|
76
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/ProductScopePicker.tsx",
|
|
77
|
-
lineNumber: 93,
|
|
78
|
-
columnNumber: 7
|
|
79
|
-
}, this),
|
|
80
|
-
/* @__PURE__ */ e("div", { className: "relative", children: [
|
|
81
|
-
/* @__PURE__ */ e(P, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }, void 0, !1, {
|
|
82
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/ProductScopePicker.tsx",
|
|
83
|
-
lineNumber: 111,
|
|
84
|
-
columnNumber: 9
|
|
85
|
-
}, this),
|
|
86
|
-
/* @__PURE__ */ e(
|
|
87
|
-
x,
|
|
57
|
+
/* @__PURE__ */ t(h, { type: "button", variant: "outline", size: "sm", onClick: () => x("stripe"), children: "Stripe" }),
|
|
58
|
+
/* @__PURE__ */ t(h, { type: "button", variant: "outline", size: "sm", onClick: () => x("freemius"), children: "Freemius" })
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
61
|
+
/* @__PURE__ */ t(w, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
62
|
+
/* @__PURE__ */ t(
|
|
63
|
+
v,
|
|
88
64
|
{
|
|
89
65
|
type: "search",
|
|
90
|
-
value:
|
|
91
|
-
onChange: (
|
|
66
|
+
value: d,
|
|
67
|
+
onChange: (e) => k(e.target.value),
|
|
92
68
|
placeholder: "Search products by title or SKU",
|
|
93
69
|
className: "pl-9"
|
|
94
|
-
}
|
|
95
|
-
void 0,
|
|
96
|
-
!1,
|
|
97
|
-
{
|
|
98
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/ProductScopePicker.tsx",
|
|
99
|
-
lineNumber: 112,
|
|
100
|
-
columnNumber: 9
|
|
101
|
-
},
|
|
102
|
-
this
|
|
70
|
+
}
|
|
103
71
|
)
|
|
104
|
-
] },
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
/* @__PURE__ */ e("div", { className: "grid max-h-[420px] gap-2 overflow-y-auto rounded-lg border p-3 md:grid-cols-2", children: [
|
|
110
|
-
N.map((s) => {
|
|
111
|
-
const o = s.productIds.some((i) => l.has(i));
|
|
112
|
-
return /* @__PURE__ */ e(
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ c("div", { className: "grid max-h-[420px] gap-2 overflow-y-auto rounded-lg border p-3 md:grid-cols-2", children: [
|
|
74
|
+
f.map((e) => {
|
|
75
|
+
const n = e.productIds.some((l) => a.has(l));
|
|
76
|
+
return /* @__PURE__ */ c(
|
|
113
77
|
"label",
|
|
114
78
|
{
|
|
115
79
|
className: "flex cursor-pointer items-center gap-3 rounded-md px-2 py-2 hover:bg-muted/40",
|
|
116
80
|
children: [
|
|
117
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ t(
|
|
118
82
|
"input",
|
|
119
83
|
{
|
|
120
84
|
type: "checkbox",
|
|
121
|
-
checked:
|
|
122
|
-
onChange: (
|
|
123
|
-
const
|
|
124
|
-
for (const
|
|
125
|
-
|
|
126
|
-
|
|
85
|
+
checked: n,
|
|
86
|
+
onChange: (l) => {
|
|
87
|
+
const m = new Set(a);
|
|
88
|
+
for (const y of e.productIds)
|
|
89
|
+
l.target.checked ? m.add(y) : m.delete(y);
|
|
90
|
+
i(m);
|
|
127
91
|
},
|
|
128
92
|
className: "mt-0.5 h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary"
|
|
129
|
-
}
|
|
130
|
-
void 0,
|
|
131
|
-
!1,
|
|
132
|
-
{
|
|
133
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/ProductScopePicker.tsx",
|
|
134
|
-
lineNumber: 130,
|
|
135
|
-
columnNumber: 15
|
|
136
|
-
},
|
|
137
|
-
this
|
|
93
|
+
}
|
|
138
94
|
),
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
lineNumber: 150,
|
|
142
|
-
columnNumber: 21
|
|
143
|
-
}, this)) : null,
|
|
144
|
-
/* @__PURE__ */ e("span", { className: "flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-md border bg-muted", children: s.thumbnailUrl ? /* @__PURE__ */ e(
|
|
95
|
+
n ? e.productIds.map((l) => /* @__PURE__ */ t("input", { type: "hidden", name: "product_ids", value: l }, l)) : null,
|
|
96
|
+
/* @__PURE__ */ t("span", { className: "flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-md border bg-muted", children: e.thumbnailUrl ? /* @__PURE__ */ t(
|
|
145
97
|
"img",
|
|
146
98
|
{
|
|
147
|
-
src:
|
|
99
|
+
src: e.thumbnailUrl,
|
|
148
100
|
alt: "",
|
|
149
101
|
loading: "lazy",
|
|
150
102
|
className: "h-full w-full object-cover"
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
{
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
columnNumber: 19
|
|
158
|
-
},
|
|
159
|
-
this
|
|
160
|
-
) : /* @__PURE__ */ e(v, { className: "h-5 w-5 text-muted-foreground", "aria-hidden": "true" }, void 0, !1, {
|
|
161
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/ProductScopePicker.tsx",
|
|
162
|
-
lineNumber: 162,
|
|
163
|
-
columnNumber: 19
|
|
164
|
-
}, this) }, void 0, !1, {
|
|
165
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/ProductScopePicker.tsx",
|
|
166
|
-
lineNumber: 153,
|
|
167
|
-
columnNumber: 15
|
|
168
|
-
}, this),
|
|
169
|
-
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1", children: [
|
|
170
|
-
/* @__PURE__ */ e("span", { className: "block whitespace-normal break-words text-sm font-medium", children: s.title }, void 0, !1, {
|
|
171
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/ProductScopePicker.tsx",
|
|
172
|
-
lineNumber: 166,
|
|
173
|
-
columnNumber: 17
|
|
174
|
-
}, this),
|
|
175
|
-
/* @__PURE__ */ e("span", { className: "block font-mono text-xs text-muted-foreground", children: s.sku }, void 0, !1, {
|
|
176
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/ProductScopePicker.tsx",
|
|
177
|
-
lineNumber: 169,
|
|
178
|
-
columnNumber: 17
|
|
179
|
-
}, this)
|
|
180
|
-
] }, void 0, !0, {
|
|
181
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/ProductScopePicker.tsx",
|
|
182
|
-
lineNumber: 165,
|
|
183
|
-
columnNumber: 15
|
|
184
|
-
}, this)
|
|
103
|
+
}
|
|
104
|
+
) : /* @__PURE__ */ t(g, { className: "h-5 w-5 text-muted-foreground", "aria-hidden": "true" }) }),
|
|
105
|
+
/* @__PURE__ */ c("span", { className: "min-w-0 flex-1", children: [
|
|
106
|
+
/* @__PURE__ */ t("span", { className: "block whitespace-normal break-words text-sm font-medium", children: e.title }),
|
|
107
|
+
/* @__PURE__ */ t("span", { className: "block font-mono text-xs text-muted-foreground", children: e.sku })
|
|
108
|
+
] })
|
|
185
109
|
]
|
|
186
110
|
},
|
|
187
|
-
|
|
188
|
-
!0,
|
|
189
|
-
{
|
|
190
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/ProductScopePicker.tsx",
|
|
191
|
-
lineNumber: 126,
|
|
192
|
-
columnNumber: 13
|
|
193
|
-
},
|
|
194
|
-
this
|
|
111
|
+
e.key
|
|
195
112
|
);
|
|
196
113
|
}),
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
columnNumber: 11
|
|
201
|
-
}, this) : null
|
|
202
|
-
] }, void 0, !0, {
|
|
203
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/ProductScopePicker.tsx",
|
|
204
|
-
lineNumber: 121,
|
|
205
|
-
columnNumber: 7
|
|
206
|
-
}, this)
|
|
207
|
-
] }, void 0, !0, {
|
|
208
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/coupons/ProductScopePicker.tsx",
|
|
209
|
-
lineNumber: 92,
|
|
210
|
-
columnNumber: 5
|
|
211
|
-
}, this);
|
|
114
|
+
f.length === 0 ? /* @__PURE__ */ t("div", { className: "px-2 py-8 text-center text-sm text-muted-foreground md:col-span-2", children: "No matching products." }) : null
|
|
115
|
+
] })
|
|
116
|
+
] });
|
|
212
117
|
}
|
|
213
118
|
export {
|
|
214
|
-
|
|
119
|
+
P as ProductScopePicker
|
|
215
120
|
};
|