@oneclick.dev/cms-core-modules 0.0.53 → 0.0.54
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/dist/CalendarDate-CRT2Viyt.mjs +830 -0
- package/dist/CalendarDate-CWtpXgpD.js +1 -0
- package/dist/Components-D9yIIosM.mjs +623 -0
- package/dist/Components-DXbx0RLV.js +1 -0
- package/dist/ContentEditor-DRJFQKCv.mjs +34915 -0
- package/dist/ContentEditor-DzTi8fSZ.js +290 -0
- package/dist/Create-BP8TX6rj.js +1 -0
- package/dist/Create-Bwf1RXdG.mjs +1248 -0
- package/dist/DateFormatter-BbcSwTs4.js +1 -0
- package/dist/DateFormatter-CbO0PVUK.mjs +99 -0
- package/dist/Detail-B-PnkcXD.mjs +3473 -0
- package/dist/Detail-BVlGSjOq.mjs +380 -0
- package/dist/Detail-C4E1T87K.mjs +26 -0
- package/dist/Detail-CNfTDUE5.js +1 -0
- package/dist/Detail-Cd5CBVN0.js +1 -0
- package/dist/Detail-CpfOQChd.mjs +585 -0
- package/dist/Detail-CwagT6gQ.mjs +650 -0
- package/dist/Detail-DUo6qKqO.js +1 -0
- package/dist/Detail-Dd_OkpcN.js +1 -0
- package/dist/Detail-mvSGbnFU.js +1 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-BWuKVkvV.js +1 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D0-EcU0_.mjs +55 -0
- package/dist/Entries-DcpPvlYj.js +1 -0
- package/dist/Entries-QLMtTYLX.mjs +713 -0
- package/dist/Find-BPR0uU-Z.mjs +229 -0
- package/dist/Find-BidEQJxT.js +1 -0
- package/dist/GlobalStyling-CMzPRd18.js +17 -0
- package/dist/GlobalStyling-DoLHUJeV.mjs +988 -0
- package/dist/Overview-BDlBCUI_.js +1 -0
- package/dist/Overview-BH3NwvNX.mjs +26 -0
- package/dist/Overview-BLsZMHNW.mjs +178 -0
- package/dist/Overview-BNMZ9MUK.js +1 -0
- package/dist/Overview-BbvfH1u-.js +1 -0
- package/dist/Overview-CDN88OSM.mjs +190 -0
- package/dist/Overview-CEPodGCn.mjs +311 -0
- package/dist/Overview-CvquDPhB.js +1 -0
- package/dist/Overview-D54pjmI6.mjs +633 -0
- package/dist/Overview-D67UjG6n.mjs +947 -0
- package/dist/Overview-KT2Mgfh5.js +1 -0
- package/dist/Overview-T-lsy3UZ.js +1 -0
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-0xZSq0rx.js +1 -0
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-Bj_PVLLV.mjs +392 -0
- package/dist/TableView-CpO53xcX.js +111 -0
- package/dist/TableView-D9J5rUls.mjs +72921 -0
- package/dist/TemplateList.vue_vue_type_script_setup_true_lang-B_AtWnHa.js +1 -0
- package/dist/TemplateList.vue_vue_type_script_setup_true_lang-BiLAkhIA.mjs +40 -0
- package/dist/View-DlHBZbFu.js +1 -0
- package/dist/View-Dv5QMrSn.mjs +25 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/dist/agenda-B49oKGeh.mjs +706 -0
- package/dist/agenda-DipQ5IWP.js +1 -0
- package/dist/availability-C7q9tq6l.js +1 -0
- package/dist/availability-DeCkqiu8.mjs +613 -0
- package/dist/cms-core-modules.css +1 -1
- package/dist/countries-BTPvmrsb.mjs +4 -0
- package/dist/countries-CgZ081No.js +1 -0
- package/dist/exceptions-D3b18TiY.mjs +647 -0
- package/dist/exceptions-DJ9zWX3k.js +1 -0
- package/dist/floating-ui.dom-C82nbomj.js +1 -0
- package/dist/floating-ui.dom-ouSgPqty.mjs +1133 -0
- package/dist/google-CvtuJwgk.mjs +4 -0
- package/dist/google-D4N3gb01.js +1 -0
- package/dist/index--jjEzba7.mjs +24 -0
- package/dist/index-9HVlmvK3.js +1 -0
- package/dist/index-BEGU8Kme.mjs +12 -0
- package/dist/index-Bwi1mtkq.mjs +24 -0
- package/dist/index-BzuHN-r8.mjs +24 -0
- package/dist/index-CImCyE3L.mjs +24 -0
- package/dist/index-CKPshlZ8-BQiiP6r_.mjs +1264 -0
- package/dist/index-CKPshlZ8-CIz1tDwX.js +1 -0
- package/dist/index-CQiY-oTN.mjs +24 -0
- package/dist/index-CSxYBeVA.js +1 -0
- package/dist/index-CkiNvRzs.js +1 -0
- package/dist/index-Co4ON2Di.js +1 -0
- package/dist/index-CwqrAU-H.js +1 -0
- package/dist/index-Cz-baGax.js +1 -0
- package/dist/index-D2a6wEPh.js +1 -0
- package/dist/index-DFQGVHTs.js +1 -0
- package/dist/index-DI6mydpm.mjs +138 -0
- package/dist/index-DMoyoaks.mjs +22 -0
- package/dist/index-DT1wWnUk.mjs +24 -0
- package/dist/index-DUeFrD-B.js +1 -0
- package/dist/index-DsnoK4ia.mjs +579 -0
- package/dist/index-R2oUDsjx.js +1 -0
- package/dist/index-RLz1QPrf.mjs +203 -0
- package/dist/index-UtjLbLw-.js +1 -0
- package/dist/index-_mG-aU3Z.mjs +87 -0
- package/dist/index-_sQDF1pH.js +1 -0
- package/dist/index-ijdf0d9-.js +1 -0
- package/dist/index-klI238nT.mjs +24 -0
- package/dist/index.cjs.js +1 -330
- package/dist/index.mjs +287 -69051
- package/dist/interpolation-BNUjI7LH.js +1 -0
- package/dist/interpolation-BpGXqOz8.mjs +59 -0
- package/dist/payment-kTjsV0Jj.js +1 -0
- package/dist/payment-zpCM0LD-.mjs +981 -0
- package/dist/regular-C4_3YXqx.mjs +602 -0
- package/dist/regular-DFwPEbZO.js +1 -0
- package/dist/regular-slots-4ooEpICB.mjs +67 -0
- package/dist/regular-slots-BAVGbomI.js +1 -0
- package/dist/resources-MpQkSstv.mjs +563 -0
- package/dist/resources-iM28T3dD.js +1 -0
- package/dist/src/appointments/index.d.ts +4 -28
- package/dist/src/appointments/routes.d.ts +3 -9
- package/dist/src/content-manager/index.d.ts +5 -147
- package/dist/src/content-manager/routes.d.ts +4 -128
- package/dist/src/custom/index.d.ts +2 -2
- package/dist/src/custom/routes.d.ts +1 -1
- package/dist/src/mail-templates/index.d.ts +2 -30
- package/dist/src/mail-templates/routes.d.ts +1 -11
- package/dist/src/product-collections/index.d.ts +2 -30
- package/dist/src/product-collections/routes.d.ts +1 -11
- package/dist/src/products/index.d.ts +2 -30
- package/dist/src/products/routes.d.ts +1 -11
- package/dist/src/promo-codes/index.d.ts +2 -30
- package/dist/src/promo-codes/routes.d.ts +1 -11
- package/dist/src/shipping-options/index.d.ts +2 -30
- package/dist/src/shipping-options/routes.d.ts +1 -11
- package/dist/src/table/index.d.ts +2 -70
- package/dist/src/table/routes.d.ts +1 -51
- package/dist/utils-BVKy9S2J.mjs +29 -0
- package/dist/utils-D6CaKJbp.js +2 -0
- package/dist/vee-validate-zod-BPQyEfpF.js +1 -0
- package/dist/vee-validate-zod-IXkfh-6Q.mjs +4402 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("@oneclick.dev/cms-kit"),o=require("./TemplateList.vue_vue_type_script_setup_true_lang-B_AtWnHa.js"),s={class:"relative"},i=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},setup(r){const c=r;t.useModuleBreadcrumbs(()=>[]),t.useFirebaseIntegration(c.config.project);const n=async()=>{};return e.onMounted(()=>{n()}),(u,a)=>(e.openBlock(),e.createElementBlock("div",s,[e.createVNode(o._sfc_main)]))}});exports.default=i;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineComponent as r, onMounted as n, createElementBlock as c, openBlock as s, createVNode as a } from "vue";
|
|
2
|
+
import { useModuleBreadcrumbs as i, useFirebaseIntegration as p } from "@oneclick.dev/cms-kit";
|
|
3
|
+
import { _ as m } from "./TemplateList.vue_vue_type_script_setup_true_lang-BiLAkhIA.mjs";
|
|
4
|
+
const u = { class: "relative" }, v = /* @__PURE__ */ r({
|
|
5
|
+
__name: "Overview",
|
|
6
|
+
props: {
|
|
7
|
+
config: {
|
|
8
|
+
type: Object,
|
|
9
|
+
required: !0
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
setup(e) {
|
|
13
|
+
const t = e;
|
|
14
|
+
i(() => []), p(t.config.project);
|
|
15
|
+
const o = async () => {
|
|
16
|
+
};
|
|
17
|
+
return n(() => {
|
|
18
|
+
o();
|
|
19
|
+
}), (_, d) => (s(), c("div", u, [
|
|
20
|
+
a(m)
|
|
21
|
+
]));
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export {
|
|
25
|
+
v as default
|
|
26
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { defineComponent as B, resolveComponent as i, createBlock as x, openBlock as a, withCtx as n, createVNode as e, createTextVNode as _, createElementBlock as f, Fragment as O, renderList as P, unref as c, createElementVNode as o, toDisplayString as g, createCommentVNode as y, ref as E, onMounted as N, withKeys as j } from "vue";
|
|
2
|
+
import { Pencil as z, Search as H, Plus as M } from "lucide-vue-next";
|
|
3
|
+
import { useModuleRoute as $, useModulePermissions as V, useLogs as R, useModuleBreadcrumbs as F, useFirebaseIntegration as I } from "@oneclick.dev/cms-kit";
|
|
4
|
+
import { r as L } from "./countries-BTPvmrsb.mjs";
|
|
5
|
+
const Q = { class: "flex items-center gap-2" }, S = { class: "flex items-center gap-2" }, q = { key: 0 }, A = { key: 1 }, K = { key: 2 }, D = { class: "flex items-center gap-2" }, U = /* @__PURE__ */ B({
|
|
6
|
+
__name: "ListView",
|
|
7
|
+
props: {
|
|
8
|
+
options: {
|
|
9
|
+
type: Array,
|
|
10
|
+
required: !0
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
setup(h) {
|
|
14
|
+
const { navigateTo: d } = $(), { hasPermission: C } = V();
|
|
15
|
+
return (k, l) => {
|
|
16
|
+
const p = i("TableHead"), b = i("TableRow"), w = i("TableHeader"), r = i("TableCell"), T = i("Button"), u = i("TableBody"), s = i("Table");
|
|
17
|
+
return a(), x(s, null, {
|
|
18
|
+
default: n(() => [
|
|
19
|
+
e(w, null, {
|
|
20
|
+
default: n(() => [
|
|
21
|
+
e(b, null, {
|
|
22
|
+
default: n(() => [
|
|
23
|
+
e(p, null, {
|
|
24
|
+
default: n(() => [...l[0] || (l[0] = [
|
|
25
|
+
_("Name", -1)
|
|
26
|
+
])]),
|
|
27
|
+
_: 1
|
|
28
|
+
}),
|
|
29
|
+
e(p, null, {
|
|
30
|
+
default: n(() => [...l[1] || (l[1] = [
|
|
31
|
+
_("Countries", -1)
|
|
32
|
+
])]),
|
|
33
|
+
_: 1
|
|
34
|
+
}),
|
|
35
|
+
e(p, null, {
|
|
36
|
+
default: n(() => [...l[2] || (l[2] = [
|
|
37
|
+
_("Price", -1)
|
|
38
|
+
])]),
|
|
39
|
+
_: 1
|
|
40
|
+
}),
|
|
41
|
+
e(p, null, {
|
|
42
|
+
default: n(() => [...l[3] || (l[3] = [
|
|
43
|
+
_("Actions", -1)
|
|
44
|
+
])]),
|
|
45
|
+
_: 1
|
|
46
|
+
})
|
|
47
|
+
]),
|
|
48
|
+
_: 1
|
|
49
|
+
})
|
|
50
|
+
]),
|
|
51
|
+
_: 1
|
|
52
|
+
}),
|
|
53
|
+
e(u, null, {
|
|
54
|
+
default: n(() => [
|
|
55
|
+
(a(!0), f(O, null, P(h.options, (t) => (a(), x(b, {
|
|
56
|
+
key: t.id,
|
|
57
|
+
onClick: (v) => c(d)(t.id),
|
|
58
|
+
class: "cursor-pointer"
|
|
59
|
+
}, {
|
|
60
|
+
default: n(() => [
|
|
61
|
+
e(r, { class: "font-medium" }, {
|
|
62
|
+
default: n(() => [
|
|
63
|
+
o("div", Q, [
|
|
64
|
+
o("span", null, g(t.title), 1)
|
|
65
|
+
])
|
|
66
|
+
]),
|
|
67
|
+
_: 2
|
|
68
|
+
}, 1024),
|
|
69
|
+
e(r, null, {
|
|
70
|
+
default: n(() => [
|
|
71
|
+
o("div", S, [
|
|
72
|
+
!t.countries || t.countries.length === 0 ? (a(), f("span", q, "Everywhere")) : y("", !0),
|
|
73
|
+
t.countries && t.countries.length < 3 ? (a(), f("span", A, g(t.countries.map((v) => c(L).find((m) => m.cca2 === v)?.name.common).join(", ")), 1)) : y("", !0),
|
|
74
|
+
t.countries && t.countries.length >= 3 ? (a(), f("span", K, g(t.countries.length) + " countries", 1)) : y("", !0)
|
|
75
|
+
])
|
|
76
|
+
]),
|
|
77
|
+
_: 2
|
|
78
|
+
}, 1024),
|
|
79
|
+
e(r, null, {
|
|
80
|
+
default: n(() => [
|
|
81
|
+
o("div", D, [
|
|
82
|
+
o("span", null, g(t.price || "FREE"), 1)
|
|
83
|
+
])
|
|
84
|
+
]),
|
|
85
|
+
_: 2
|
|
86
|
+
}, 1024),
|
|
87
|
+
e(r, null, {
|
|
88
|
+
default: n(() => [
|
|
89
|
+
e(T, {
|
|
90
|
+
variant: "ghost",
|
|
91
|
+
size: "icon"
|
|
92
|
+
}, {
|
|
93
|
+
default: n(() => [
|
|
94
|
+
e(c(z), { class: "size-4" })
|
|
95
|
+
]),
|
|
96
|
+
_: 1
|
|
97
|
+
})
|
|
98
|
+
]),
|
|
99
|
+
_: 1
|
|
100
|
+
})
|
|
101
|
+
]),
|
|
102
|
+
_: 2
|
|
103
|
+
}, 1032, ["onClick"]))), 128))
|
|
104
|
+
]),
|
|
105
|
+
_: 1
|
|
106
|
+
})
|
|
107
|
+
]),
|
|
108
|
+
_: 1
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}), W = { class: "relative" }, G = {
|
|
113
|
+
ref: "container",
|
|
114
|
+
class: "flex items-center justify-between gap-4 w-full mt-12 mb-8"
|
|
115
|
+
}, J = { class: "flex items-center gap-4" }, X = { class: "text-lg whitespace-nowrap" }, Y = { class: "relative w-full max-w-sm items-center" }, Z = { class: "absolute start-0 inset-y-0 flex items-center justify-center px-2" }, ee = { class: "flex items-center gap-4" }, le = /* @__PURE__ */ B({
|
|
116
|
+
__name: "Overview",
|
|
117
|
+
props: {
|
|
118
|
+
config: {
|
|
119
|
+
type: Object,
|
|
120
|
+
required: !0
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
setup(h) {
|
|
124
|
+
const d = h, { hasPermission: C } = V(), { navigateTo: k } = $(), { log: l, logWarning: p, logError: b } = R();
|
|
125
|
+
F(() => []);
|
|
126
|
+
const w = I(d.config.project), r = E([]), T = async () => {
|
|
127
|
+
const u = async () => {
|
|
128
|
+
if (!d.config.shippingOptionsCollection) return [];
|
|
129
|
+
const s = d.config.shippingOptionsCollection.split(":");
|
|
130
|
+
return s.length !== 2 ? [] : (await w.get(s[0]))?.[s[1]] || [];
|
|
131
|
+
};
|
|
132
|
+
return r.value = await u(), r.value;
|
|
133
|
+
};
|
|
134
|
+
return N(() => {
|
|
135
|
+
T();
|
|
136
|
+
}), (u, s) => {
|
|
137
|
+
const t = i("Input"), v = i("Button");
|
|
138
|
+
return a(), f("div", W, [
|
|
139
|
+
o("div", G, [
|
|
140
|
+
o("div", J, [
|
|
141
|
+
o("p", X, g(r.value?.length) + " options", 1),
|
|
142
|
+
o("div", Y, [
|
|
143
|
+
e(t, {
|
|
144
|
+
id: "search",
|
|
145
|
+
type: "text",
|
|
146
|
+
placeholder: "Search...",
|
|
147
|
+
class: "pl-8",
|
|
148
|
+
modelValue: u.searchQuery,
|
|
149
|
+
"onUpdate:modelValue": s[0] || (s[0] = (m) => u.searchQuery = m),
|
|
150
|
+
onKeydown: s[1] || (s[1] = j((m) => u.searchQuery = "", ["escape"]))
|
|
151
|
+
}, null, 8, ["modelValue"]),
|
|
152
|
+
o("span", Z, [
|
|
153
|
+
e(c(H), { class: "size-4 text-muted-foreground" })
|
|
154
|
+
])
|
|
155
|
+
])
|
|
156
|
+
]),
|
|
157
|
+
o("div", ee, [
|
|
158
|
+
c(C)("create-option") ? (a(), x(v, {
|
|
159
|
+
key: 0,
|
|
160
|
+
variant: "outline",
|
|
161
|
+
onClick: s[2] || (s[2] = (m) => c(k)("new"))
|
|
162
|
+
}, {
|
|
163
|
+
default: n(() => [
|
|
164
|
+
e(c(M), { class: "size-4" }),
|
|
165
|
+
s[3] || (s[3] = _(" New Option ", -1))
|
|
166
|
+
]),
|
|
167
|
+
_: 1
|
|
168
|
+
})) : y("", !0)
|
|
169
|
+
])
|
|
170
|
+
], 512),
|
|
171
|
+
e(U, { options: r.value }, null, 8, ["options"])
|
|
172
|
+
]);
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
export {
|
|
177
|
+
le as default
|
|
178
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),E=require("lucide-vue-next"),h=require("@oneclick.dev/cms-kit"),F=require("./index-DUeFrD-B.js"),U=require("./utils-D6CaKJbp.js"),B=require("./index-ijdf0d9-.js"),Z={class:"grid @md:grid-cols-2 @2xl:grid-cols-3 @3xl:grid-cols-4 @4xl:grid-cols-5 @5xl:grid-cols-6 gap-6"},ee=["onClick","onContextmenu"],te=["src"],oe={class:"font-semibold"},ne={class:"text-sm text-muted-foreground flex items-center gap-2"},le={class:"flex items-center gap-2"},re={key:0},se=e.defineComponent({__name:"GridView",props:{products:{type:Array,required:!0}},setup(g){const o=e.inject("selection"),{navigateTo:m}=h.useModuleRoute(),{hasPermission:V}=h.useModulePermissions(),C=(s,l)=>{const f=l.ctrlKey||l.metaKey;if(l.shiftKey)console.log("range");else if(f||o.value.length>0){const r=o.value.indexOf(s.id);r>-1?o.value.splice(r,1):o.value.push(s.id)}else o.value=[],m(s.id)},n=s=>{s.target.closest(".GRID_ITEM")||(o.value=[])},d=(s,l)=>{l.ctrlKey||l.metaKey?o.value.includes(s.id)?o.value.splice(o.value.indexOf(s.id),1):o.value.push(s.id):o.value.includes(s.id)||(o.value=[s.id])};return(s,l)=>(e.openBlock(),e.createElementBlock("div",{class:"@container mb-4 flex-1 select-none",onClick:l[0]||(l[0]=f=>o.value=[]),onContextmenu:n},[e.createElementVNode("div",Z,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.products,f=>(e.openBlock(),e.createElementBlock("div",{key:f.id,onClick:e.withModifiers(w=>C(f,w),["stop"]),onContextmenu:w=>d(f,w),class:"GRID_ITEM cursor-pointer"},[e.createElementVNode("div",{class:e.normalizeClass(["aspect-square bg-muted rounded-xl overflow-hidden mb-2 transition-all duration-200",{"outline outline-4 outline-primary/50":e.unref(o).includes(f.id)}])},[f.featuredMedia?(e.openBlock(),e.createElementBlock("img",{key:0,src:f.featuredMedia,class:"w-full h-full object-cover pointer-events-none",draggable:"false"},null,8,te)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",null,[e.createElementVNode("p",oe,e.toDisplayString(f.title),1),e.createElementVNode("p",ne,[e.createElementVNode("span",le,[f.status==="published"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l[1]||(l[1]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-green-500"},null,-1)),l[2]||(l[2]=e.createTextVNode(" Published ",-1))],64)):f.status==="draft"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[l[3]||(l[3]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-blue-500"},null,-1)),l[4]||(l[4]=e.createTextVNode(" Draft ",-1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[l[5]||(l[5]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-gray-300"},null,-1)),l[6]||(l[6]=e.createTextVNode(" Archived ",-1))],64))]),f.variantsTotal>1?(e.openBlock(),e.createElementBlock("span",re,"| "+e.toDisplayString(f.variantsTotal)+" variants",1)):e.createCommentVNode("",!0)])])],40,ee))),128))])],32))}}),ae={class:"flex items-center gap-2"},ie={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},ce={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},ue={key:2,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},de=e.defineComponent({__name:"ListView",props:{products:{type:Array,required:!0}},setup(g){const o=e.inject("selection"),{navigateTo:m}=h.useModuleRoute(),{hasPermission:V}=h.useModulePermissions(),C=(n,d)=>{n?o.value.push(d):o.value=o.value.filter(s=>s!==d)};return(n,d)=>{const s=e.resolveComponent("TableHead"),l=e.resolveComponent("TableRow"),f=e.resolveComponent("TableHeader"),w=e.resolveComponent("Checkbox"),r=e.resolveComponent("TableCell"),u=e.resolveComponent("AvatarImage"),t=e.resolveComponent("AvatarFallback"),p=e.resolveComponent("Avatar"),x=e.resolveComponent("TableBody"),N=e.resolveComponent("Table"),b=e.resolveComponent("Card");return e.openBlock(),e.createBlock(b,{class:"w-full py-4 px-4"},{default:e.withCtx(()=>[e.createVNode(N,{class:"rounded overflow-hidden"},{default:e.withCtx(()=>[e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(l,null,{default:e.withCtx(()=>[e.unref(o)?.length>0?(e.openBlock(),e.createBlock(s,{key:0})):e.createCommentVNode("",!0),e.createVNode(s,null,{default:e.withCtx(()=>[...d[1]||(d[1]=[e.createTextVNode("Title",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...d[2]||(d[2]=[e.createTextVNode("Status",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode(" Variants",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode("Price",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(x,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.products,v=>(e.openBlock(),e.createBlock(l,{key:v.id,onClick:_=>e.unref(m)(v.id),class:"cursor-pointer"},{default:e.withCtx(()=>[e.unref(o)?.length>0?(e.openBlock(),e.createBlock(r,{key:0},{default:e.withCtx(()=>[e.createVNode(w,{"model-value":e.unref(o)?.includes(v.id),"onUpdate:modelValue":_=>C(_,v.id),onClick:d[0]||(d[0]=e.withModifiers(()=>{},["prevent","stop"]))},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(r,{class:"font-medium"},{default:e.withCtx(()=>[e.createElementVNode("div",ae,[e.createVNode(p,{class:"size-12 rounded-xl"},{default:e.withCtx(()=>[e.createVNode(u,{src:v.media?.[0],class:"object-cover"},null,8,["src"]),e.createVNode(t,{class:"rounded-xl"})]),_:2},1024),e.createElementVNode("span",null,e.toDisplayString(v.title),1)])]),_:2},1024),e.createVNode(r,null,{default:e.withCtx(()=>[v.status==="published"?(e.openBlock(),e.createElementBlock("span",ie,"Published")):v.status==="draft"?(e.openBlock(),e.createElementBlock("span",ce,"Draft")):v.status==="archived"?(e.openBlock(),e.createElementBlock("span",ue,"Archived")):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(r,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v.variantsTotal),1)]),_:2},1024),e.createVNode(r,{class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(" € "+e.toDisplayString(v.price||0),1)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})}}}),O=F.isClient?window:void 0;function $(g){var o;const m=e.toValue(g);return(o=m?.$el)!=null?o:m}function me(){const g=e.shallowRef(!1),o=e.getCurrentInstance();return o&&e.onMounted(()=>{g.value=!0},o),g}function pe(g){const o=me();return e.computed(()=>(o.value,!!g()))}function fe(g,o,m={}){const{window:V=O,...C}=m;let n;const d=pe(()=>V&&"ResizeObserver"in V),s=()=>{n&&(n.disconnect(),n=void 0)},l=e.computed(()=>{const r=e.toValue(g);return Array.isArray(r)?r.map(u=>$(u)):[$(r)]}),f=e.watch(l,r=>{if(s(),d.value&&V){n=new ResizeObserver(o);for(const u of r)u&&n.observe(u,C)}},{immediate:!0,flush:"post"}),w=()=>{s(),f()};return F.tryOnScopeDispose(w),{isSupported:d,stop:w}}function ve(g,o={width:0,height:0},m={}){const{window:V=O,box:C="content-box"}=m,n=e.computed(()=>{var r,u;return(u=(r=$(g))==null?void 0:r.namespaceURI)==null?void 0:u.includes("svg")}),d=e.shallowRef(o.width),s=e.shallowRef(o.height),{stop:l}=fe(g,([r])=>{const u=C==="border-box"?r.borderBoxSize:C==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;if(V&&n.value){const t=$(g);if(t){const p=t.getBoundingClientRect();d.value=p.width,s.value=p.height}}else if(u){const t=F.toArray(u);d.value=t.reduce((p,{inlineSize:x})=>p+x,0),s.value=t.reduce((p,{blockSize:x})=>p+x,0)}else d.value=r.contentRect.width,s.value=r.contentRect.height},m);F.tryOnMounted(()=>{const r=$(g);r&&(d.value="offsetWidth"in r?r.offsetWidth:o.width,s.value="offsetHeight"in r?r.offsetHeight:o.height)});const f=e.watch(()=>$(g),r=>{d.value=r?o.width:0,s.value=r?o.height:0});function w(){l(),f()}return{width:d,height:s,stop:w}}const Ce={class:"truncate"},xe={key:0},ge={key:1},Ve={key:2},we={key:3},Ne={class:"relative w-full max-w-sm items-center"},be={class:"truncate"},ke={class:"truncate"},he={class:"flex items-center space-x-2 mb-4"},_e={class:"flex items-center space-x-2 mb-4"},ye={class:"flex items-center space-x-2 mb-4"},Be=e.defineComponent({__name:"FilterPopover",setup(g){const o=e.inject("filter"),m=e.inject("collections"),V=()=>{o.value={collections:[],published:!0,draft:!0,archived:!1}};return(C,n)=>{const d=e.resolveComponent("Button"),s=e.resolveComponent("PopoverTrigger"),l=e.resolveComponent("ComboboxTrigger"),f=e.resolveComponent("ComboboxAnchor"),w=e.resolveComponent("ComboboxInput"),r=e.resolveComponent("ComboboxEmpty"),u=e.resolveComponent("ComboboxItemIndicator"),t=e.resolveComponent("ComboboxItem"),p=e.resolveComponent("ScrollArea"),x=e.resolveComponent("ComboboxGroup"),N=e.resolveComponent("ComboboxList"),b=e.resolveComponent("Combobox"),v=e.resolveComponent("Checkbox"),_=e.resolveComponent("PopoverContent"),y=e.resolveComponent("Popover");return e.openBlock(),e.createBlock(y,null,{default:e.withCtx(()=>[e.createVNode(s,{asChild:""},{default:e.withCtx(()=>[e.createVNode(d,{variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.Filter),{class:"size-4"}),n[4]||(n[4]=e.createTextVNode(" Filter ",-1))]),_:1})]),_:1}),e.createVNode(_,{class:"w-64"},{default:e.withCtx(()=>[n[14]||(n[14]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Collection ",-1)),e.createVNode(b,{modelValue:e.unref(o).collections,"onUpdate:modelValue":n[0]||(n[0]=i=>e.unref(o).collections=i),by:"id",multiple:!0,class:"mb-6"},{default:e.withCtx(()=>[e.createVNode(f,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(l,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(d,{variant:"outline",class:"justify-between w-full"},{default:e.withCtx(()=>[e.createElementVNode("span",Ce,[e.unref(o).collections.length===1?(e.openBlock(),e.createElementBlock("span",xe,e.toDisplayString(e.unref(m).find(i=>i.id===e.unref(o).collections[0])?.title),1)):e.unref(o).collections.length===2?(e.openBlock(),e.createElementBlock("span",ge,e.toDisplayString(e.unref(m).find(i=>i.id===e.unref(o).collections[0])?.title)+", "+e.toDisplayString(e.unref(m).find(i=>i.id===e.unref(o).collections[1])?.title),1)):e.unref(o).collections.length>2?(e.openBlock(),e.createElementBlock("span",Ve,e.toDisplayString(e.unref(m).find(i=>i.id===e.unref(o).collections[0])?.title)+", "+e.toDisplayString(e.unref(m).find(i=>i.id===e.unref(o).collections[1])?.title)+" + "+e.toDisplayString(e.unref(o).collections.length-2),1)):(e.openBlock(),e.createElementBlock("span",we,"Select collection"))]),e.createVNode(e.unref(E.ChevronsUpDown),{class:"ml-2 size-4 shrink-0 opacity-50"})]),_:1})]),_:1})]),_:1}),e.createVNode(N,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ne,[e.createVNode(w,{placeholder:"Select category..."})]),e.createVNode(r,null,{default:e.withCtx(()=>[...n[5]||(n[5]=[e.createTextVNode(" No category found. ",-1)])]),_:1}),e.unref(m)?.filter(i=>i.status==="published")?.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n[7]||(n[7]=e.createElementVNode("p",{class:"px-2 py-1.5 text-sm font-medium mt-2"},"Published",-1)),e.createVNode(x,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"max-h-[200px] overflow-y-auto"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m).filter(i=>i.status==="published"),i=>(e.openBlock(),e.createBlock(t,{key:i.id,value:i.id},{default:e.withCtx(()=>[n[6]||(n[6]=e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1)),e.createElementVNode("span",be,e.toDisplayString(i.title),1),e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(e.unref(E.Check),{class:e.normalizeClass(e.unref(U.classNames)("ml-auto size-4"))},null,8,["class"])]),_:1})]),_:2},1032,["value"]))),128))]),_:1})]),_:1})],64)):e.createCommentVNode("",!0),e.unref(m)?.filter(i=>i.status==="draft")?.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[n[9]||(n[9]=e.createElementVNode("p",{class:"px-2 py-1.5 text-sm font-medium"},"Drafts",-1)),e.createVNode(x,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"max-h-[200px] overflow-y-auto"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m).filter(i=>i.status==="draft"),i=>(e.openBlock(),e.createBlock(t,{key:i.id,value:i.id},{default:e.withCtx(()=>[n[8]||(n[8]=e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1)),e.createElementVNode("span",ke,e.toDisplayString(i.title),1),e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(e.unref(E.Check),{class:e.normalizeClass(e.unref(U.classNames)("ml-auto size-4"))},null,8,["class"])]),_:1})]),_:2},1032,["value"]))),128))]),_:1})]),_:1})],64)):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["modelValue"]),n[15]||(n[15]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Status ",-1)),e.createElementVNode("div",he,[e.createVNode(v,{id:"chk_published_products",modelValue:e.unref(o).published,"onUpdate:modelValue":n[1]||(n[1]=i=>e.unref(o).published=i)},null,8,["modelValue"]),n[10]||(n[10]=e.createElementVNode("label",{for:"chk_published_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show published products ",-1))]),e.createElementVNode("div",_e,[e.createVNode(v,{id:"chk_draft_products",modelValue:e.unref(o).draft,"onUpdate:modelValue":n[2]||(n[2]=i=>e.unref(o).draft=i)},null,8,["modelValue"]),n[11]||(n[11]=e.createElementVNode("label",{for:"chk_draft_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show draft products ",-1))]),e.createElementVNode("div",ye,[e.createVNode(v,{id:"chk_archived_products",modelValue:e.unref(o).archived,"onUpdate:modelValue":n[3]||(n[3]=i=>e.unref(o).archived=i)},null,8,["modelValue"]),n[12]||(n[12]=e.createElementVNode("label",{for:"chk_archived_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show archived products ",-1))]),e.unref(o).collections.length>0||!e.unref(o).published||!e.unref(o).draft||e.unref(o).archived?(e.openBlock(),e.createBlock(d,{key:0,variant:"secondary",class:"ml-auto my-2",size:"sm",onClick:V},{default:e.withCtx(()=>[e.createVNode(e.unref(E.RotateCcw),{class:"size-3"}),n[13]||(n[13]=e.createElementVNode("span",{class:"ml-0.5 text-xs"},"Reset filters",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),Ee=e.defineComponent({__name:"ProductContextMenu",emits:["selectAll","duplicateProduct","deleteProduct","deleteSelection"],setup(g,{emit:o}){const m=o,V=e.inject("products"),C=e.inject("selection"),n=e.inject("config"),{hasPermission:d}=h.useModulePermissions(),{navigateTo:s}=h.useModuleRoute(),l=e.computed(()=>C.value?.length!==1?null:V.value?.find(u=>u.id===C.value[0])),f=u=>{let t=n.previewUrl;t=t.replace("{{ id","{{id"),t=t.replace("id }}","id}}"),t=t.replace("{{id}}",u.id),t=t.replace("{{ slug","{{slug"),t=t.replace("slug }}","slug}}"),t=t.replace("{{slug}}",u.slug),window.open(t,"_blank")},w=async(u,t)=>{try{if(!["draft","published","archived"].includes(t))return;await h.useFirebaseIntegration(n.project).update(n.productCollection,u.id,{status:t}),u.status=t,B.toast.success("Product status changed")}catch{B.toast.error("Failed to change product status")}},r=async u=>{try{if(!["draft","published","archived"].includes(u))return;const t=h.useFirebaseIntegration(n.project),p=[];C.value.forEach(async x=>{p.push(t.update(n.productCollection,x,{status:u}))}),B.toast.promise(Promise.all(p),{loading:`Changing status of ${C.value.length} products...`,success:()=>{const x=C.value.length;return C.value.forEach(N=>{V.value.find(b=>b.id==N).status=u}),C.value=[],`Product status changed for ${x} products`},error:x=>"Failed to change product status"})}catch{B.toast.error("Failed to change product status")}};return(u,t)=>{const p=e.resolveComponent("ContextMenuTrigger"),x=e.resolveComponent("ContextMenuShortcut"),N=e.resolveComponent("ContextMenuItem"),b=e.resolveComponent("ContextMenuContent"),v=e.resolveComponent("ContextMenuSeparator"),_=e.resolveComponent("ContextMenuSubTrigger"),y=e.resolveComponent("ContextMenuCheckboxItem"),i=e.resolveComponent("ContextMenuSubContent"),D=e.resolveComponent("ContextMenuSub"),I=e.resolveComponent("ContextMenu");return e.openBlock(),e.createBlock(I,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"flex flex-1"},{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default")]),_:3}),e.unref(C).length===0?(e.openBlock(),e.createBlock(b,{key:0,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(N,{inset:"",onClick:t[0]||(t[0]=k=>m("selectAll"))},{default:e.withCtx(()=>[t[13]||(t[13]=e.createTextVNode(" Select all ",-1)),e.createVNode(x,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("⌘ + A",-1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(C).length===1&&l.value?(e.openBlock(),e.createBlock(b,{key:1,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(N,{inset:"",onClick:t[1]||(t[1]=k=>e.unref(s)(l.value.id))},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Edit product ",-1)])]),_:1}),e.createVNode(v),e.unref(n).previewUrl?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(N,{inset:"",onClick:t[2]||(t[2]=k=>f(l.value))},{default:e.withCtx(()=>[t[15]||(t[15]=e.createTextVNode(" Preview product ",-1)),e.createVNode(x,null,{default:e.withCtx(()=>[e.createVNode(e.unref(E.ExternalLink),{class:"size-4"})]),_:1})]),_:1}),e.createVNode(v)],64)):e.createCommentVNode("",!0),e.createVNode(N,{inset:"",onClick:t[3]||(t[3]=k=>m("duplicateProduct",l.value))},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Duplicate product ",-1)])]),_:1}),e.createVNode(D,null,{default:e.withCtx(()=>[e.createVNode(_,{inset:""},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Change status ",-1)])]),_:1}),e.createVNode(i,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(y,{onClick:t[4]||(t[4]=k=>w(l.value,"draft")),modelValue:l.value.status==="draft"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1},8,["modelValue"]),e.createVNode(y,{onClick:t[5]||(t[5]=k=>w(l.value,"published")),modelValue:l.value.status==="published"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1},8,["modelValue"]),e.createVNode(y,{onClick:t[6]||(t[6]=k=>w(l.value,"archived")),modelValue:l.value.status==="archived"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1},8,["modelValue"])]),_:1})]),_:1}),e.createVNode(N,{inset:"",variant:"destructive",onClick:t[7]||(t[7]=k=>m("deleteProduct",l.value))},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode(" Delete product ",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(C).length>1?(e.openBlock(),e.createBlock(b,{key:2,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(D,null,{default:e.withCtx(()=>[e.createVNode(_,{inset:""},{default:e.withCtx(()=>[e.createTextVNode(" Change status ("+e.toDisplayString(e.unref(C).length)+") ",1)]),_:1}),e.createVNode(i,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(y,{onClick:t[8]||(t[8]=k=>r("draft"))},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1}),e.createVNode(y,{onClick:t[9]||(t[9]=k=>r("published"))},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1}),e.createVNode(y,{onClick:t[10]||(t[10]=k=>r("archived"))},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(N,{inset:"",variant:"destructive",onClick:t[11]||(t[11]=k=>m("deleteSelection"))},{default:e.withCtx(()=>[e.createTextVNode(" Delete products ("+e.toDisplayString(e.unref(C).length)+") ",1)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:3})}}}),Pe={class:"relative flex flex-col flex-1"},Se={ref:"container",class:"flex items-center justify-between gap-4 w-full mt-12 mb-8"},Te={class:"flex items-center gap-4"},Me={class:"text-lg whitespace-nowrap"},$e={class:"relative w-full max-w-sm items-center"},De={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},ze={class:"flex items-center gap-4"},Ae={class:"flex flex-1"},Fe=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},async setup(g){let o,m;const V=g,{hasPermission:C}=h.useModulePermissions(),{navigateTo:n}=h.useModuleRoute(),{confirm:d}=h.useConfirmation();h.useModuleBreadcrumbs(()=>[]);const s=h.useFirebaseIntegration(V.config.project),l=e.ref([]),f=async()=>{const c=await s.find(V.config.productCollection);l.value=c||[]},w=e.useTemplateRef("container"),{width:r}=ve(w),u=e.ref("grid"),t=e.ref(1),p=e.ref([]),x=e.ref(""),N=e.ref([]);N.value=([o,m]=e.withAsyncContext(()=>y()),o=await o,m(),o);const b=e.computed(()=>u.value==="grid"?r.value<768?6:r.value<896?8:r.value<1024?10:12:10),v=e.computed(()=>l.value.filter(c=>!(T.value.collections.length>0&&!c.collections?.some(a=>T.value.collections.includes(a))||!T.value.published&&c.status==="published"||!T.value.draft&&c.status==="draft"||!T.value.archived&&c.status==="archived")).filter(c=>c.title.toLowerCase().includes(x.value.toLowerCase())||c.slug.toLowerCase().includes(x.value.toLowerCase())||c.id.toLowerCase().includes(x.value.toLowerCase()))),_=e.computed(()=>{if(v.value.length<=b.value)return v.value;const c=(t.value-1)*b.value,a=c+b.value;return v.value.slice(c,a)});async function y(){if(!V.config.collectionsCollection)return[];const c=V.config.collectionsCollection.split(":");return c.length!==2?[]:(await s.get(c[0]))?.[c[1]]||[]}async function i(c){return(await s.find(V.config.productCollection,{filters:[{field:"slug",operator:"==",value:c}]})).length>0}const D=()=>{p.value=_.value.map(c=>c.id)},I=async c=>{try{let a={...c},S=a.slug+"-copy",M=2;for(;await i(S);)S=a.slug+"-copy-"+M,M++;a.id=void 0,a.createdAt=new Date,a.updatedAt=new Date,a.slug=S,a.status="draft",a.title=a.title+" (copy)";const A=await s.add(V.config.productCollection,a);n(A.id),B.toast.success("Product duplicated")}catch{B.toast.error("Failed to duplicate product")}},k=async c=>{if(await d(`Are you sure you want to delete "${c.title}"?`))try{await s.remove(V.config.productCollection,c.id),l.value=l.value.filter(S=>S.id!==c.id),p.value=[],B.toast.success("Product deleted")}catch{B.toast.error("Failed to delete product")}},L=async()=>{if(await d(`Are you sure you want to delete all selected products (${p.value.length})?`))try{p.value.forEach(async a=>{await s.remove(V.config.productCollection,a)}),l.value=l.value.filter(a=>!p.value.includes(a.id)),p.value=[],B.toast.success("Products deleted")}catch{B.toast.error("Failed to delete products")}},T=e.ref({collections:[],published:!0,draft:!0,archived:!1});e.watch(T,()=>{t.value=1});const R=c=>{c.target?.matches("input, textarea")||c.target?.isContentEditable||(c.key==="Escape"&&(p.value=[]),(c.metaKey||c.ctrlKey)&&c.key.toLowerCase()==="a"&&(c.preventDefault(),D()))};return e.onMounted(()=>{f(),window.addEventListener("keydown",R)}),e.onUnmounted(()=>{window.removeEventListener("keydown",R)}),e.provide("config",V.config),e.provide("filter",T),e.provide("products",l),e.provide("collections",N),e.provide("selection",p),(c,a)=>{const S=e.resolveComponent("Input"),M=e.resolveComponent("Button"),A=e.resolveComponent("SegmentedControlButton"),K=e.resolveComponent("SegmentedControl"),q=e.resolveComponent("PaginationFirst"),G=e.resolveComponent("PaginationPrev"),H=e.resolveComponent("PaginationListItem"),W=e.resolveComponent("PaginationEllipsis"),Q=e.resolveComponent("PaginationNext"),X=e.resolveComponent("PaginationLast"),J=e.resolveComponent("PaginationList"),Y=e.resolveComponent("Pagination");return e.openBlock(),e.createElementBlock("div",Pe,[e.createElementVNode("div",Se,[e.createElementVNode("div",Te,[e.createElementVNode("p",Me,e.toDisplayString(v.value?.length)+" products",1),e.createElementVNode("div",$e,[e.createVNode(S,{id:"search",type:"text",placeholder:"Search...",class:"pl-8",onKeydown:a[0]||(a[0]=e.withKeys(P=>x.value="",["escape"])),modelValue:x.value,"onUpdate:modelValue":a[1]||(a[1]=P=>x.value=P)},null,8,["modelValue"]),e.createElementVNode("span",De,[e.createVNode(e.unref(E.Search),{class:"size-4 text-muted-foreground"})])])]),e.createElementVNode("div",ze,[p.value.length>0?(e.openBlock(),e.createBlock(M,{key:0,variant:"destructive",onClick:L},{default:e.withCtx(()=>[e.createTextVNode(" Delete Selection ("+e.toDisplayString(p.value.length)+") ",1)]),_:1})):e.createCommentVNode("",!0),e.unref(C)("create-product")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(M,{variant:"outline",onClick:a[2]||(a[2]=P=>e.unref(n)("new"))},{default:e.withCtx(()=>[e.createVNode(e.unref(E.Plus),{class:"size-4"}),a[5]||(a[5]=e.createTextVNode(" New Product ",-1))]),_:1}),a[6]||(a[6]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1))],64)):e.createCommentVNode("",!0),e.createVNode(Be),a[7]||(a[7]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1)),e.createElementVNode("div",null,[e.createVNode(K,{modelValue:u.value,"onUpdate:modelValue":a[3]||(a[3]=P=>u.value=P),"aria-label":"View mode"},{default:e.withCtx(()=>[e.createVNode(A,{value:"grid"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.LayoutGrid),{class:"size-4"})]),_:1}),e.createVNode(A,{value:"list"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.List),{class:"size-4"})]),_:1})]),_:1},8,["modelValue"])])])],512),e.createElementVNode("div",Ae,[e.createVNode(Ee,{onSelectAll:D,onDuplicateProduct:I,onDeleteProduct:k,onDeleteSelection:L},{default:e.withCtx(()=>[u.value==="grid"?(e.openBlock(),e.createBlock(se,{key:0,products:_.value},null,8,["products"])):(e.openBlock(),e.createBlock(de,{key:1,products:_.value},null,8,["products"]))]),_:1})]),v.value?.length>b.value?(e.openBlock(),e.createBlock(Y,{key:0,page:t.value,"onUpdate:page":a[4]||(a[4]=P=>t.value=P),"items-per-page":b.value,total:v.value?.length,"sibling-count":1,"show-edges":""},{default:e.withCtx(()=>[e.createVNode(J,{class:"flex items-center gap-1"},{default:e.withCtx(({items:P})=>[e.createVNode(q),e.createVNode(G),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P,(z,j)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[z.type==="page"?(e.openBlock(),e.createBlock(H,{key:j,value:z.value,"as-child":""},{default:e.withCtx(()=>[e.createVNode(M,{class:"size-10 p-0",variant:z.value===t.value?"default":"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(z.value),1)]),_:2},1032,["variant"])]),_:2},1032,["value"])):(e.openBlock(),e.createBlock(W,{key:z.type,index:j},null,8,["index"]))],64))),256)),e.createVNode(Q),e.createVNode(X)]),_:1})]),_:1},8,["page","items-per-page","total"])):e.createCommentVNode("",!0)])}}});exports.default=Fe;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),f=require("lucide-vue-next"),r=require("@oneclick.dev/cms-kit"),N=require("./countries-CgZ081No.js"),C={class:"flex items-center gap-2"},h={class:"flex items-center gap-2"},v={key:0},w={key:1},x={key:2},y={class:"flex items-center gap-2"},k=e.defineComponent({__name:"ListView",props:{options:{type:Array,required:!0}},setup(d){const{navigateTo:c}=r.useModuleRoute(),{hasPermission:V}=r.useModulePermissions();return(g,n)=>{const a=e.resolveComponent("TableHead"),m=e.resolveComponent("TableRow"),p=e.resolveComponent("TableHeader"),s=e.resolveComponent("TableCell"),_=e.resolveComponent("Button"),l=e.resolveComponent("TableBody"),o=e.resolveComponent("Table");return e.openBlock(),e.createBlock(o,null,{default:e.withCtx(()=>[e.createVNode(p,null,{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(a,null,{default:e.withCtx(()=>[...n[0]||(n[0]=[e.createTextVNode("Name",-1)])]),_:1}),e.createVNode(a,null,{default:e.withCtx(()=>[...n[1]||(n[1]=[e.createTextVNode("Countries",-1)])]),_:1}),e.createVNode(a,null,{default:e.withCtx(()=>[...n[2]||(n[2]=[e.createTextVNode("Price",-1)])]),_:1}),e.createVNode(a,null,{default:e.withCtx(()=>[...n[3]||(n[3]=[e.createTextVNode("Actions",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(l,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.options,t=>(e.openBlock(),e.createBlock(m,{key:t.id,onClick:u=>e.unref(c)(t.id),class:"cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(s,{class:"font-medium"},{default:e.withCtx(()=>[e.createElementVNode("div",C,[e.createElementVNode("span",null,e.toDisplayString(t.title),1)])]),_:2},1024),e.createVNode(s,null,{default:e.withCtx(()=>[e.createElementVNode("div",h,[!t.countries||t.countries.length===0?(e.openBlock(),e.createElementBlock("span",v,"Everywhere")):e.createCommentVNode("",!0),t.countries&&t.countries.length<3?(e.openBlock(),e.createElementBlock("span",w,e.toDisplayString(t.countries.map(u=>e.unref(N.rawCountries).find(i=>i.cca2===u)?.name.common).join(", ")),1)):e.createCommentVNode("",!0),t.countries&&t.countries.length>=3?(e.openBlock(),e.createElementBlock("span",x,e.toDisplayString(t.countries.length)+" countries",1)):e.createCommentVNode("",!0)])]),_:2},1024),e.createVNode(s,null,{default:e.withCtx(()=>[e.createElementVNode("div",y,[e.createElementVNode("span",null,e.toDisplayString(t.price||"FREE"),1)])]),_:2},1024),e.createVNode(s,null,{default:e.withCtx(()=>[e.createVNode(_,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(f.Pencil),{class:"size-4"})]),_:1})]),_:1})]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})}}}),B={class:"relative"},b={ref:"container",class:"flex items-center justify-between gap-4 w-full mt-12 mb-8"},E={class:"flex items-center gap-4"},T={class:"text-lg whitespace-nowrap"},$={class:"relative w-full max-w-sm items-center"},P={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},S={class:"flex items-center gap-4"},O=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},setup(d){const c=d,{hasPermission:V}=r.useModulePermissions(),{navigateTo:g}=r.useModuleRoute(),{log:n,logWarning:a,logError:m}=r.useLogs();r.useModuleBreadcrumbs(()=>[]);const p=r.useFirebaseIntegration(c.config.project),s=e.ref([]),_=async()=>{const l=async()=>{if(!c.config.shippingOptionsCollection)return[];const o=c.config.shippingOptionsCollection.split(":");return o.length!==2?[]:(await p.get(o[0]))?.[o[1]]||[]};return s.value=await l(),s.value};return e.onMounted(()=>{_()}),(l,o)=>{const t=e.resolveComponent("Input"),u=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",B,[e.createElementVNode("div",b,[e.createElementVNode("div",E,[e.createElementVNode("p",T,e.toDisplayString(s.value?.length)+" options",1),e.createElementVNode("div",$,[e.createVNode(t,{id:"search",type:"text",placeholder:"Search...",class:"pl-8",modelValue:l.searchQuery,"onUpdate:modelValue":o[0]||(o[0]=i=>l.searchQuery=i),onKeydown:o[1]||(o[1]=e.withKeys(i=>l.searchQuery="",["escape"]))},null,8,["modelValue"]),e.createElementVNode("span",P,[e.createVNode(e.unref(f.Search),{class:"size-4 text-muted-foreground"})])])]),e.createElementVNode("div",S,[e.unref(V)("create-option")?(e.openBlock(),e.createBlock(u,{key:0,variant:"outline",onClick:o[2]||(o[2]=i=>e.unref(g)("new"))},{default:e.withCtx(()=>[e.createVNode(e.unref(f.Plus),{class:"size-4"}),o[3]||(o[3]=e.createTextVNode(" New Option ",-1))]),_:1})):e.createCommentVNode("",!0)])],512),e.createVNode(k,{options:s.value},null,8,["options"])])}}});exports.default=O;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { defineComponent as $, resolveComponent as n, createBlock as g, openBlock as a, withCtx as t, createVNode as e, createTextVNode as _, createElementBlock as v, Fragment as j, renderList as z, unref as c, createElementVNode as r, createCommentVNode as T, toDisplayString as h, ref as V, computed as I, onMounted as L, withKeys as N } from "vue";
|
|
2
|
+
import { Pencil as F, Search as H, Plus as M } from "lucide-vue-next";
|
|
3
|
+
import { useModuleRoute as P, useModulePermissions as S, useLogs as E, useModuleBreadcrumbs as R, useFirebaseIntegration as q } from "@oneclick.dev/cms-kit";
|
|
4
|
+
const D = { class: "flex items-center gap-2" }, K = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"
|
|
7
|
+
}, O = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"
|
|
10
|
+
}, Q = /* @__PURE__ */ $({
|
|
11
|
+
__name: "ListView",
|
|
12
|
+
props: {
|
|
13
|
+
collections: {
|
|
14
|
+
type: Array,
|
|
15
|
+
required: !0
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
setup(b) {
|
|
19
|
+
const { navigateTo: m } = P();
|
|
20
|
+
return (k, l) => {
|
|
21
|
+
const f = n("TableHead"), x = n("TableRow"), B = n("TableHeader"), y = n("AvatarImage"), u = n("AvatarFallback"), i = n("Avatar"), d = n("TableCell"), w = n("Button"), p = n("TableBody"), s = n("Table");
|
|
22
|
+
return a(), g(s, null, {
|
|
23
|
+
default: t(() => [
|
|
24
|
+
e(B, null, {
|
|
25
|
+
default: t(() => [
|
|
26
|
+
e(x, null, {
|
|
27
|
+
default: t(() => [
|
|
28
|
+
e(f, { class: "w-[100px]" }, {
|
|
29
|
+
default: t(() => [...l[0] || (l[0] = [
|
|
30
|
+
_(" Title ", -1)
|
|
31
|
+
])]),
|
|
32
|
+
_: 1
|
|
33
|
+
}),
|
|
34
|
+
e(f, null, {
|
|
35
|
+
default: t(() => [...l[1] || (l[1] = [
|
|
36
|
+
_("Status", -1)
|
|
37
|
+
])]),
|
|
38
|
+
_: 1
|
|
39
|
+
}),
|
|
40
|
+
e(f, null, {
|
|
41
|
+
default: t(() => [...l[2] || (l[2] = [
|
|
42
|
+
_(" Type", -1)
|
|
43
|
+
])]),
|
|
44
|
+
_: 1
|
|
45
|
+
}),
|
|
46
|
+
e(f, { class: "text-right" }, {
|
|
47
|
+
default: t(() => [...l[3] || (l[3] = [
|
|
48
|
+
_(" Actions ", -1)
|
|
49
|
+
])]),
|
|
50
|
+
_: 1
|
|
51
|
+
})
|
|
52
|
+
]),
|
|
53
|
+
_: 1
|
|
54
|
+
})
|
|
55
|
+
]),
|
|
56
|
+
_: 1
|
|
57
|
+
}),
|
|
58
|
+
e(p, null, {
|
|
59
|
+
default: t(() => [
|
|
60
|
+
(a(!0), v(j, null, z(b.collections, (o) => (a(), g(x, {
|
|
61
|
+
key: o.id,
|
|
62
|
+
onClick: (A) => c(m)(o.id),
|
|
63
|
+
class: "cursor-pointer"
|
|
64
|
+
}, {
|
|
65
|
+
default: t(() => [
|
|
66
|
+
e(d, { class: "font-medium" }, {
|
|
67
|
+
default: t(() => [
|
|
68
|
+
r("div", D, [
|
|
69
|
+
o.thumbnail ? (a(), g(i, {
|
|
70
|
+
key: 0,
|
|
71
|
+
class: "size-12 rounded-xl"
|
|
72
|
+
}, {
|
|
73
|
+
default: t(() => [
|
|
74
|
+
e(y, {
|
|
75
|
+
src: o.thumbnail,
|
|
76
|
+
class: "object-cover"
|
|
77
|
+
}, null, 8, ["src"]),
|
|
78
|
+
e(u, { class: "rounded-xl" })
|
|
79
|
+
]),
|
|
80
|
+
_: 2
|
|
81
|
+
}, 1024)) : T("", !0),
|
|
82
|
+
r("span", null, h(o.title), 1)
|
|
83
|
+
])
|
|
84
|
+
]),
|
|
85
|
+
_: 2
|
|
86
|
+
}, 1024),
|
|
87
|
+
e(d, null, {
|
|
88
|
+
default: t(() => [
|
|
89
|
+
o.status === "published" ? (a(), v("span", K, "Published")) : o.status === "draft" ? (a(), v("span", O, "Draft")) : T("", !0)
|
|
90
|
+
]),
|
|
91
|
+
_: 2
|
|
92
|
+
}, 1024),
|
|
93
|
+
e(d, null, {
|
|
94
|
+
default: t(() => [
|
|
95
|
+
_(h(o.type), 1)
|
|
96
|
+
]),
|
|
97
|
+
_: 2
|
|
98
|
+
}, 1024),
|
|
99
|
+
e(d, { class: "text-right" }, {
|
|
100
|
+
default: t(() => [
|
|
101
|
+
e(w, {
|
|
102
|
+
size: "icon",
|
|
103
|
+
variant: "ghost"
|
|
104
|
+
}, {
|
|
105
|
+
default: t(() => [
|
|
106
|
+
e(c(F), { class: "size-4" })
|
|
107
|
+
]),
|
|
108
|
+
_: 1
|
|
109
|
+
})
|
|
110
|
+
]),
|
|
111
|
+
_: 1
|
|
112
|
+
})
|
|
113
|
+
]),
|
|
114
|
+
_: 2
|
|
115
|
+
}, 1032, ["onClick"]))), 128))
|
|
116
|
+
]),
|
|
117
|
+
_: 1
|
|
118
|
+
})
|
|
119
|
+
]),
|
|
120
|
+
_: 1
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}), U = { class: "relative" }, W = {
|
|
125
|
+
ref: "container",
|
|
126
|
+
class: "flex items-center justify-between gap-4 w-full mt-12 mb-8"
|
|
127
|
+
}, G = { class: "flex items-center gap-4" }, J = { class: "text-lg whitespace-nowrap" }, X = { class: "relative w-full max-w-sm items-center" }, Y = { class: "absolute start-0 inset-y-0 flex items-center justify-center px-2" }, Z = { class: "flex items-center gap-4" }, ne = /* @__PURE__ */ $({
|
|
128
|
+
__name: "Overview",
|
|
129
|
+
props: {
|
|
130
|
+
config: {
|
|
131
|
+
type: Object,
|
|
132
|
+
required: !0
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
setup(b) {
|
|
136
|
+
const m = b, { hasPermission: k } = S(), { navigateTo: l } = P(), { log: f, logWarning: x, logError: B } = E();
|
|
137
|
+
R(() => []);
|
|
138
|
+
const y = q(m.config.project), u = V([]), i = V(""), d = I(() => u.value.filter((p) => p.title.toLowerCase().includes(i.value.toLowerCase()))), w = async () => {
|
|
139
|
+
const p = async () => {
|
|
140
|
+
if (!m.config.collectionsCollection) return [];
|
|
141
|
+
const s = m.config.collectionsCollection.split(":");
|
|
142
|
+
return s.length !== 2 ? [] : (await y.get(s[0]))?.[s[1]] || [];
|
|
143
|
+
};
|
|
144
|
+
return u.value = await p(), u.value;
|
|
145
|
+
};
|
|
146
|
+
return L(() => {
|
|
147
|
+
w();
|
|
148
|
+
}), (p, s) => {
|
|
149
|
+
const o = n("Input"), A = n("Button");
|
|
150
|
+
return a(), v("div", U, [
|
|
151
|
+
r("div", W, [
|
|
152
|
+
r("div", G, [
|
|
153
|
+
r("p", J, h(u.value?.length) + " collections", 1),
|
|
154
|
+
r("div", X, [
|
|
155
|
+
e(o, {
|
|
156
|
+
id: "search",
|
|
157
|
+
type: "text",
|
|
158
|
+
placeholder: "Search...",
|
|
159
|
+
class: "pl-8",
|
|
160
|
+
modelValue: i.value,
|
|
161
|
+
"onUpdate:modelValue": s[0] || (s[0] = (C) => i.value = C),
|
|
162
|
+
onKeydown: s[1] || (s[1] = N((C) => i.value = "", ["escape"]))
|
|
163
|
+
}, null, 8, ["modelValue"]),
|
|
164
|
+
r("span", Y, [
|
|
165
|
+
e(c(H), { class: "size-4 text-muted-foreground" })
|
|
166
|
+
])
|
|
167
|
+
])
|
|
168
|
+
]),
|
|
169
|
+
r("div", Z, [
|
|
170
|
+
c(k)("create-collection") ? (a(), g(A, {
|
|
171
|
+
key: 0,
|
|
172
|
+
variant: "outline",
|
|
173
|
+
onClick: s[2] || (s[2] = (C) => c(l)("new"))
|
|
174
|
+
}, {
|
|
175
|
+
default: t(() => [
|
|
176
|
+
e(c(M), { class: "size-4" }),
|
|
177
|
+
s[3] || (s[3] = _(" New Collection ", -1))
|
|
178
|
+
]),
|
|
179
|
+
_: 1
|
|
180
|
+
})) : T("", !0)
|
|
181
|
+
])
|
|
182
|
+
], 512),
|
|
183
|
+
e(Q, { collections: c(d) }, null, 8, ["collections"])
|
|
184
|
+
]);
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
export {
|
|
189
|
+
ne as default
|
|
190
|
+
};
|