@oneclick.dev/cms-core-modules 0.0.83 → 0.0.85

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.
Files changed (67) hide show
  1. package/dist/{ContentEditor-CxKirDdL.mjs → ContentEditor-C5ydvk8b.mjs} +7067 -5886
  2. package/dist/{ContentEditor-CRFkD4tE.js → ContentEditor-DiveHwSJ.js} +43 -43
  3. package/dist/{Create-CsqVYhPO.mjs → Create-6uT9HWar.mjs} +35 -35
  4. package/dist/{Create-ip0MnS0o.js → Create-DuZ5nZrX.js} +1 -1
  5. package/dist/{DateFormatter-CvOfaUnU.mjs → DateFormatter-2B0R-DY4.mjs} +204 -400
  6. package/dist/DateFormatter-DbtOLV0L.js +1 -0
  7. package/dist/{Detail-RMXFuSRQ.js → Detail-BZ-iE9vf.js} +1 -1
  8. package/dist/{Detail-B4b_FLDa.mjs → Detail-C1Blq61w.mjs} +90 -90
  9. package/dist/{Detail-BayNaAg9.js → Detail-C8wQiDcv.js} +1 -1
  10. package/dist/{Detail-CbLk1v37.mjs → Detail-CJVMJDP7.mjs} +17 -17
  11. package/dist/{Detail-CnK-qbhE.js → Detail-CPqug27l.js} +1 -1
  12. package/dist/Detail-CjuhjPby.js +1 -0
  13. package/dist/{Detail-U0mgLKt6.mjs → Detail-CtItxMX4.mjs} +62 -63
  14. package/dist/{Detail-CVgWHbMC.mjs → Detail-Dnpnmy4-.mjs} +158 -158
  15. package/dist/{Entries-D7MHylQE.mjs → Entries-BkOPae4R.mjs} +49 -49
  16. package/dist/Entries-CcEW98F5.js +1 -0
  17. package/dist/{Find-XPcJxeRH.mjs → Find-Bd1uLqSa.mjs} +55 -55
  18. package/dist/Find-D4Qa45qC.js +1 -0
  19. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-CDc8MIq2.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-Bc946oSc.mjs} +1 -1
  20. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-StaNp-3y.js → NewReservationDialog.vue_vue_type_script_setup_true_lang-CqERfyYb.js} +1 -1
  21. package/dist/{Overview-CwCAeBnX.js → Overview-CA8wh_BI.js} +1 -1
  22. package/dist/{Overview-CgViRnNc.mjs → Overview-D4MFwRI_.mjs} +67 -68
  23. package/dist/{Overview-B2bFNGhH.js → Overview-Da0XexiT.js} +1 -1
  24. package/dist/Overview-DeQQ0FY3.js +1 -0
  25. package/dist/{Overview--XpvBbqz.mjs → Overview-DoOASlNz.mjs} +1 -3
  26. package/dist/{Overview-Cczt_dcE.mjs → Overview-gJSvftdE.mjs} +34 -34
  27. package/dist/{ReservationDetailDialog.vue_vue_type_script_setup_true_lang-B7ks5mbf.mjs → ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Cohhnd5x.mjs} +0 -1
  28. package/dist/{ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Vxubki_v.js → ReservationDetailDialog.vue_vue_type_script_setup_true_lang-VWVIxIr6.js} +1 -1
  29. package/dist/{SeoHealth-ZpvB7CS2.mjs → SeoHealth-Bc5chnaa.mjs} +14 -14
  30. package/dist/{SeoHealth-DFZ0LLBH.js → SeoHealth-BkpJ1F2Y.js} +1 -1
  31. package/dist/TableView-Ei_w_-bn.mjs +5745 -0
  32. package/dist/TableView-klOTPJKZ.js +4 -0
  33. package/dist/View-BaFlMcM6.js +1 -0
  34. package/dist/View-C4MBWRlA.mjs +28 -0
  35. package/dist/{agenda-Cl3s_FIE.mjs → agenda-C5grvzSa.mjs} +166 -169
  36. package/dist/agenda-DXMwVWpN.js +1 -0
  37. package/dist/{availability-B-tRp8hB.mjs → availability-C1NqOFsQ.mjs} +81 -81
  38. package/dist/{availability-BiBbzEIM.js → availability-D_wnfLsH.js} +1 -1
  39. package/dist/cms-core-modules.css +1 -1
  40. package/dist/{exceptions-DQPSFSj7.mjs → exceptions-BIwMhYa4.mjs} +1 -1
  41. package/dist/{exceptions-BA3PsW4n.js → exceptions-Cn7zooEu.js} +1 -1
  42. package/dist/{index-CBC9dWZ9.js → index-C9pSS15N.js} +2 -2
  43. package/dist/{index-YOOlBEZB.mjs → index-MwjeLHPP.mjs} +3 -3
  44. package/dist/index.cjs.js +1 -1
  45. package/dist/index.mjs +23 -23
  46. package/dist/{orders-DZzdsHOW.mjs → orders-DhQ2EFXS.mjs} +157 -157
  47. package/dist/orders-V1pch_ih.js +1 -0
  48. package/dist/server-handlers.cjs.js +1 -1
  49. package/dist/server-handlers.mjs +142 -147
  50. package/package.json +2 -2
  51. package/dist/DateFormatter-ls6HfWpS.js +0 -1
  52. package/dist/Detail-BcboL7NF.js +0 -1
  53. package/dist/Entries-BPkZ7Jg5.js +0 -1
  54. package/dist/Find-Ds6OvuH6.js +0 -1
  55. package/dist/Overview-B-8TLLjh.js +0 -1
  56. package/dist/TableView-BUPPcHUW.mjs +0 -89505
  57. package/dist/TableView-CksiPsTL.js +0 -586
  58. package/dist/View-DDXN0tKD.mjs +0 -25
  59. package/dist/View-DfzaVOzS.js +0 -1
  60. package/dist/agenda-rlFma_wn.js +0 -1
  61. package/dist/floating-ui.dom-B9WYoHj2.js +0 -1
  62. package/dist/floating-ui.dom-fpIfhXTZ.mjs +0 -1291
  63. package/dist/index-DYpruS-A-Cw57iwdY.mjs +0 -4210
  64. package/dist/index-DYpruS-A-DwDXo9Tq.js +0 -88
  65. package/dist/index-YMaY4uuk-BgpTtr73.js +0 -1
  66. package/dist/index-YMaY4uuk-C_xV5K9Z.mjs +0 -1300
  67. package/dist/orders-tP4WdF5q.js +0 -1
@@ -1,4 +1,4 @@
1
- import { defineComponent as Q, inject as H, computed as O, resolveComponent as i, openBlock as d, createBlock as x, withCtx as n, createVNode as t, unref as s, createCommentVNode as E, createTextVNode as m, toDisplayString as w, createElementBlock as S, Fragment as G, renderList as le, withModifiers as X, createElementVNode as u, ref as N, renderSlot as de, watch as ce, onMounted as pe, onUnmounted as fe, provide as W, withKeys as me } from "vue";
1
+ import { defineComponent as Q, inject as H, computed as O, resolveComponent as a, openBlock as d, createBlock as x, withCtx as n, createVNode as t, unref as s, createCommentVNode as E, createTextVNode as m, toDisplayString as w, createElementBlock as S, Fragment as G, renderList as le, withModifiers as X, createElementVNode as u, ref as N, renderSlot as de, watch as ce, onMounted as pe, onUnmounted as fe, provide as W, withKeys as me } from "vue";
2
2
  import { Globe as ge, Pencil as ve, Filter as _e, RotateCcw as be, ExternalLink as ye, ChevronLeft as Ce, Search as xe, Plus as we } from "lucide-vue-next";
3
3
  import { useModule as he, useModuleRoute as Y, useModulePermissions as Z, useFirebaseIntegration as J, useConfirmation as ke, useModuleBreadcrumbs as Pe } from "@oneclick.dev/cms-kit";
4
4
  import { i as Ee } from "./interpolation-BHSqsh8Q.mjs";
@@ -12,7 +12,7 @@ const $e = { class: "flex items-center gap-2" }, Se = {
12
12
  }, Le = {
13
13
  key: 2,
14
14
  class: "bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"
15
- }, ze = ["href"], Ae = ["href"], De = /* @__PURE__ */ Q({
15
+ }, Ae = ["href"], ze = ["href"], De = /* @__PURE__ */ Q({
16
16
  __name: "ListView",
17
17
  props: {
18
18
  entries: {
@@ -21,22 +21,22 @@ const $e = { class: "flex items-center gap-2" }, Se = {
21
21
  }
22
22
  },
23
23
  setup(K) {
24
- const r = H("selection"), h = H("collection"), D = K, { config: g } = he(), { navigateTo: c, params: B } = Y(), { hasPermission: M } = Z(), p = (a, e) => {
25
- a ? r.value.push(e) : r.value = r.value.filter((f) => f !== e);
26
- }, k = (a) => {
24
+ const r = H("selection"), h = H("collection"), D = K, { config: g } = he(), { navigateTo: c, params: B } = Y(), { hasPermission: M } = Z(), p = (i, e) => {
25
+ i ? r.value.push(e) : r.value = r.value.filter((f) => f !== e);
26
+ }, k = (i) => {
27
27
  if (!h.value) return "about:blank";
28
28
  let e = g.domain?.trim(), f = h.value.defaultLanguageRoutePattern?.trim();
29
- if (console.log("waza", { domain: e, pattern: f, entry: a }), !e || !f) return "about:blank";
29
+ if (!e || !f) return "about:blank";
30
30
  e.endsWith("/") && (e = e.slice(0, -1)), f.startsWith("/") || (f = "/" + f);
31
- const y = a.liveByLocale.find((_) => _.locale === g.defaultLanguage)?.slug;
32
- return Ee(e + f, [{ name: "slug", value: y }, { name: "id", value: a.id }, { name: "lang", value: g.defaultLanguage || "en" }]);
33
- }, A = (a) => `${(window.location.origin + window.location.pathname).replace(/\/$/, "")}/${a.id}`, $ = O(() => D.entries?.map((a) => ({
34
- ...a,
35
- status: a.archived ? "archived" : a.liveByLocale && a.liveByLocale.length > 0 ? "published" : "draft",
36
- publishProgress: { completed: a.liveByLocale.length, total: g.supportedLanguages?.length || 1 }
31
+ const y = i.liveByLocale.find((_) => _.locale === g.defaultLanguage)?.slug;
32
+ return Ee(e + f, [{ name: "slug", value: y }, { name: "id", value: i.id }, { name: "lang", value: g.defaultLanguage || "en" }]);
33
+ }, z = (i) => `${(window.location.origin + window.location.pathname).replace(/\/$/, "")}/${i.id}`, $ = O(() => D.entries?.map((i) => ({
34
+ ...i,
35
+ status: i.archived ? "archived" : i.liveByLocale && i.liveByLocale.length > 0 ? "published" : "draft",
36
+ publishProgress: { completed: i.liveByLocale.length, total: g.supportedLanguages?.length || 1 }
37
37
  })) || []);
38
- return (a, e) => {
39
- const f = i("TableHead"), y = i("TableRow"), _ = i("TableHeader"), P = i("Checkbox"), V = i("TableCell"), U = i("Button"), T = i("TableBody"), j = i("Table"), R = i("Card");
38
+ return (i, e) => {
39
+ const f = a("TableHead"), y = a("TableRow"), _ = a("TableHeader"), P = a("Checkbox"), V = a("TableCell"), U = a("Button"), T = a("TableBody"), j = a("Table"), R = a("Card");
40
40
  return d(), x(R, { class: "w-full py-4 px-4" }, {
41
41
  default: n(() => [
42
42
  t(j, { class: "rounded overflow-hidden" }, {
@@ -136,9 +136,9 @@ const $e = { class: "flex items-center gap-2" }, Se = {
136
136
  ]),
137
137
  _: 1
138
138
  })
139
- ], 8, ze)) : E("", !0),
139
+ ], 8, Ae)) : E("", !0),
140
140
  u("a", {
141
- href: A(v),
141
+ href: z(v),
142
142
  rel: "noreferrer",
143
143
  onClick: e[2] || (e[2] = X(() => {
144
144
  }, ["stop"]))
@@ -152,7 +152,7 @@ const $e = { class: "flex items-center gap-2" }, Se = {
152
152
  ]),
153
153
  _: 1
154
154
  })
155
- ], 8, Ae)
155
+ ], 8, ze)
156
156
  ]),
157
157
  _: 2
158
158
  }, 1024)
@@ -190,8 +190,8 @@ const $e = { class: "flex items-center gap-2" }, Se = {
190
190
  };
191
191
  };
192
192
  return (g, c) => {
193
- const B = i("Button"), M = i("PopoverTrigger"), p = i("Checkbox"), k = i("PopoverContent"), A = i("Popover");
194
- return d(), x(A, null, {
193
+ const B = a("Button"), M = a("PopoverTrigger"), p = a("Checkbox"), k = a("PopoverContent"), z = a("Popover");
194
+ return d(), x(z, null, {
195
195
  default: n(() => [
196
196
  t(M, { asChild: "" }, {
197
197
  default: n(() => [
@@ -257,28 +257,28 @@ const $e = { class: "flex items-center gap-2" }, Se = {
257
257
  __name: "ContentEntryContextMenu",
258
258
  emits: ["selectAll", "duplicateEntry", "deleteEntry", "deleteSelection"],
259
259
  setup(K, { emit: r }) {
260
- const h = r, D = H("entries"), g = H("selection"), c = H("config"), { hasPermission: B } = Z(), { navigateTo: M } = Y(), p = O(() => g.value?.length !== 1 ? null : D.value?.find((a) => a.id === g.value[0])), k = (a) => {
260
+ const h = r, D = H("entries"), g = H("selection"), c = H("config"), { hasPermission: B } = Z(), { navigateTo: M } = Y(), p = O(() => g.value?.length !== 1 ? null : D.value?.find((i) => i.id === g.value[0])), k = (i) => {
261
261
  let e = c.previewUrl;
262
- e = e.replace("{{ id", "{{id"), e = e.replace("id }}", "id}}"), e = e.replace("{{id}}", a.id), e = e.replace("{{ slug", "{{slug"), e = e.replace("slug }}", "slug}}"), e = e.replace("{{slug}}", a.slug), window.open(e, "_blank");
263
- }, A = async (a, e) => {
262
+ e = e.replace("{{ id", "{{id"), e = e.replace("id }}", "id}}"), e = e.replace("{{id}}", i.id), e = e.replace("{{ slug", "{{slug"), e = e.replace("slug }}", "slug}}"), e = e.replace("{{slug}}", i.slug), window.open(e, "_blank");
263
+ }, z = async (i, e) => {
264
264
  try {
265
265
  if (!["draft", "published", "archived"].includes(e)) return;
266
- await J(c.project).update(c.contentCollection, a.id, { status: e }), a.status = e, L.success("Entry status changed");
266
+ await J(c.project).update(c.contentCollection, i.id, { status: e }), i.status = e, L.success("Entry status changed");
267
267
  } catch {
268
268
  L.error("Failed to change entry status");
269
269
  }
270
- }, $ = async (a) => {
270
+ }, $ = async (i) => {
271
271
  try {
272
- if (!["draft", "published", "archived"].includes(a)) return;
272
+ if (!["draft", "published", "archived"].includes(i)) return;
273
273
  const e = J(c.project), f = [];
274
274
  g.value.forEach(async (y) => {
275
- f.push(e.update(c.contentCollection, y, { status: a }));
275
+ f.push(e.update(c.contentCollection, y, { status: i }));
276
276
  }), L.promise(Promise.all(f), {
277
277
  loading: `Changing status of ${g.value.length} entries...`,
278
278
  success: () => {
279
279
  const y = g.value.length;
280
280
  return g.value.forEach((_) => {
281
- D.value.find((P) => P.id == _).status = a;
281
+ D.value.find((P) => P.id == _).status = i;
282
282
  }), g.value = [], `Entry status changed for ${y} entries`;
283
283
  },
284
284
  error: (y) => "Failed to change entry status"
@@ -287,13 +287,13 @@ const $e = { class: "flex items-center gap-2" }, Se = {
287
287
  L.error("Failed to change entry status");
288
288
  }
289
289
  };
290
- return (a, e) => {
291
- const f = i("ContextMenuTrigger"), y = i("ContextMenuShortcut"), _ = i("ContextMenuItem"), P = i("ContextMenuContent"), V = i("ContextMenuSeparator"), U = i("ContextMenuSubTrigger"), T = i("ContextMenuCheckboxItem"), j = i("ContextMenuSubContent"), R = i("ContextMenuSub"), v = i("ContextMenu");
290
+ return (i, e) => {
291
+ const f = a("ContextMenuTrigger"), y = a("ContextMenuShortcut"), _ = a("ContextMenuItem"), P = a("ContextMenuContent"), V = a("ContextMenuSeparator"), U = a("ContextMenuSubTrigger"), T = a("ContextMenuCheckboxItem"), j = a("ContextMenuSubContent"), R = a("ContextMenuSub"), v = a("ContextMenu");
292
292
  return d(), x(v, null, {
293
293
  default: n(() => [
294
294
  t(f, { class: "flex flex-1" }, {
295
295
  default: n(() => [
296
- de(a.$slots, "default")
296
+ de(i.$slots, "default")
297
297
  ]),
298
298
  _: 3
299
299
  }),
@@ -373,7 +373,7 @@ const $e = { class: "flex items-center gap-2" }, Se = {
373
373
  t(j, { class: "w-48" }, {
374
374
  default: n(() => [
375
375
  t(T, {
376
- onClick: e[4] || (e[4] = (C) => A(p.value, "draft")),
376
+ onClick: e[4] || (e[4] = (C) => z(p.value, "draft")),
377
377
  modelValue: p.value.status === "draft"
378
378
  }, {
379
379
  default: n(() => [...e[18] || (e[18] = [
@@ -383,7 +383,7 @@ const $e = { class: "flex items-center gap-2" }, Se = {
383
383
  _: 1
384
384
  }, 8, ["modelValue"]),
385
385
  t(T, {
386
- onClick: e[5] || (e[5] = (C) => A(p.value, "published")),
386
+ onClick: e[5] || (e[5] = (C) => z(p.value, "published")),
387
387
  modelValue: p.value.status === "published"
388
388
  }, {
389
389
  default: n(() => [...e[19] || (e[19] = [
@@ -393,7 +393,7 @@ const $e = { class: "flex items-center gap-2" }, Se = {
393
393
  _: 1
394
394
  }, 8, ["modelValue"]),
395
395
  t(T, {
396
- onClick: e[6] || (e[6] = (C) => A(p.value, "archived")),
396
+ onClick: e[6] || (e[6] = (C) => z(p.value, "archived")),
397
397
  modelValue: p.value.status === "archived"
398
398
  }, {
399
399
  default: n(() => [...e[20] || (e[20] = [
@@ -506,7 +506,7 @@ const $e = { class: "flex items-center gap-2" }, Se = {
506
506
  Pe(() => [
507
507
  { text: p.value?.name ?? "" }
508
508
  ]);
509
- const A = async () => {
509
+ const z = async () => {
510
510
  const o = await M.get(r.config.collectionsCollection, g.value.collectionId);
511
511
  o ? p.value = o : (c("/"), L.error("Collection not found"));
512
512
  }, $ = async () => {
@@ -520,7 +520,7 @@ const $e = { class: "flex items-center gap-2" }, Se = {
520
520
  ]
521
521
  });
522
522
  k.value = o || [];
523
- }, a = N(1), e = N([]), f = N(""), y = N(10), _ = (o) => {
523
+ }, i = N(1), e = N([]), f = N(""), y = N(10), _ = (o) => {
524
524
  if (!o) return 0;
525
525
  if (typeof o?.toDate == "function")
526
526
  return o.toDate().getTime();
@@ -529,16 +529,16 @@ const $e = { class: "flex items-center gap-2" }, Se = {
529
529
  }, P = O(() => {
530
530
  const o = f.value.trim().toLowerCase();
531
531
  return [...o ? k.value.filter((b) => {
532
- const z = String(b?.title ?? "").toLowerCase(), F = String(b?.slug ?? "").toLowerCase();
533
- return z.includes(o) || F.includes(o) || b?.id === o;
534
- }) : k.value].sort((b, z) => {
532
+ const A = String(b?.title ?? "").toLowerCase(), F = String(b?.slug ?? "").toLowerCase();
533
+ return A.includes(o) || F.includes(o) || b?.id === o;
534
+ }) : k.value].sort((b, A) => {
535
535
  const F = _(b?.updated?.at) || _(b?.updatedAt) || _(b?.createdAt);
536
- return (_(z?.updated?.at) || _(z?.updatedAt) || _(z?.createdAt)) - F;
536
+ return (_(A?.updated?.at) || _(A?.updatedAt) || _(A?.createdAt)) - F;
537
537
  });
538
538
  }), V = O(() => {
539
539
  if (P.value.length <= y.value)
540
540
  return P.value;
541
- const o = (a.value - 1) * y.value, l = o + y.value;
541
+ const o = (i.value - 1) * y.value, l = o + y.value;
542
542
  return P.value.slice(o, l);
543
543
  });
544
544
  async function U(o) {
@@ -556,9 +556,9 @@ const $e = { class: "flex items-center gap-2" }, Se = {
556
556
  e.value = V.value.map((o) => o.id);
557
557
  }, j = async (o) => {
558
558
  try {
559
- let l = { ...o }, b = l.slug + "-copy", z = 2;
559
+ let l = { ...o }, b = l.slug + "-copy", A = 2;
560
560
  for (; await U(b); )
561
- b = l.slug + "-copy-" + z, z++;
561
+ b = l.slug + "-copy-" + A, A++;
562
562
  l.id = void 0, l.createdAt = /* @__PURE__ */ new Date(), l.updatedAt = /* @__PURE__ */ new Date(), l.slug = b, l.status = "draft", l.title = l.title + " (copy)";
563
563
  const F = await M.add(r.config.contentCollection, l);
564
564
  c(F.id), L.success("Entry duplicated");
@@ -587,17 +587,17 @@ const $e = { class: "flex items-center gap-2" }, Se = {
587
587
  archived: !1
588
588
  });
589
589
  ce(C, () => {
590
- a.value = 1;
590
+ i.value = 1;
591
591
  });
592
592
  const ee = (o) => {
593
593
  o.target?.matches("input, textarea") || o.target?.isContentEditable || (o.key === "Escape" && (e.value = []), (o.metaKey || o.ctrlKey) && o.key.toLowerCase() === "a" && (o.preventDefault(), T()));
594
594
  };
595
595
  return pe(() => {
596
- A(), $(), window.addEventListener("keydown", ee);
596
+ z(), $(), window.addEventListener("keydown", ee);
597
597
  }), fe(() => {
598
598
  window.removeEventListener("keydown", ee);
599
599
  }), W("config", r.config), W("filter", C), W("entries", k), W("selection", e), W("collection", p), (o, l) => {
600
- const b = i("Button"), z = i("Input"), F = i("PaginationFirst"), te = i("PaginationPrev"), oe = i("PaginationListItem"), se = i("PaginationEllipsis"), ae = i("PaginationNext"), ie = i("PaginationLast"), re = i("PaginationList"), ue = i("Pagination");
600
+ const b = a("Button"), A = a("Input"), F = a("PaginationFirst"), te = a("PaginationPrev"), oe = a("PaginationListItem"), se = a("PaginationEllipsis"), ae = a("PaginationNext"), ie = a("PaginationLast"), re = a("PaginationList"), ue = a("Pagination");
601
601
  return p.value ? (d(), S("div", Ke, [
602
602
  u("div", qe, [
603
603
  t(b, {
@@ -616,7 +616,7 @@ const $e = { class: "flex items-center gap-2" }, Se = {
616
616
  u("div", Ge, [
617
617
  u("p", Oe, w(P.value?.length) + " " + w(p.value?.contentEntryNamePlural || "entries"), 1),
618
618
  u("div", Qe, [
619
- t(z, {
619
+ t(A, {
620
620
  id: "search",
621
621
  type: "text",
622
622
  placeholder: "Search...",
@@ -676,8 +676,8 @@ const $e = { class: "flex items-center gap-2" }, Se = {
676
676
  ]),
677
677
  P.value?.length > y.value ? (d(), x(ue, {
678
678
  key: 0,
679
- page: a.value,
680
- "onUpdate:page": l[4] || (l[4] = (I) => a.value = I),
679
+ page: i.value,
680
+ "onUpdate:page": l[4] || (l[4] = (I) => i.value = I),
681
681
  "items-per-page": y.value,
682
682
  total: P.value?.length,
683
683
  "sibling-count": 1,
@@ -697,7 +697,7 @@ const $e = { class: "flex items-center gap-2" }, Se = {
697
697
  default: n(() => [
698
698
  t(b, {
699
699
  class: "size-10 p-0",
700
- variant: q.value === a.value ? "default" : "outline"
700
+ variant: q.value === i.value ? "default" : "outline"
701
701
  }, {
702
702
  default: n(() => [
703
703
  m(w(q.value), 1)
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),P=require("lucide-vue-next"),V=require("@oneclick.dev/cms-kit"),H=require("./interpolation-We8hT28L.js"),_=require("./index-ijdf0d9-.js"),O={class:"flex items-center gap-2"},W={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},G={key:0},Q={key:1},X={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},J={key:2,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},Y=["href"],Z=["href"],ee=e.defineComponent({__name:"ListView",props:{entries:{type:Array,required:!0}},setup(D){const r=e.inject("selection"),v=e.inject("collection"),b=D,{config:c}=V.useModule(),{navigateTo:a,params:E}=V.useModuleRoute(),{hasPermission:N}=V.useModulePermissions(),s=(l,t)=>{l?r.value.push(t):r.value=r.value.filter(i=>i!==t)},g=l=>{if(!v.value)return"about:blank";let t=c.domain?.trim(),i=v.value.defaultLanguageRoutePattern?.trim();if(!t||!i)return"about:blank";t.endsWith("/")&&(t=t.slice(0,-1)),i.startsWith("/")||(i="/"+i);const m=l.liveByLocale.find(u=>u.locale===c.defaultLanguage)?.slug;return H.interpolateTemplateFromVariableContext(t+i,[{name:"slug",value:m},{name:"id",value:l.id},{name:"lang",value:c.defaultLanguage||"en"}])},y=l=>`${(window.location.origin+window.location.pathname).replace(/\/$/,"")}/${l.id}`,x=e.computed(()=>b.entries?.map(l=>({...l,status:l.archived?"archived":l.liveByLocale&&l.liveByLocale.length>0?"published":"draft",publishProgress:{completed:l.liveByLocale.length,total:c.supportedLanguages?.length||1}}))||[]);return(l,t)=>{const i=e.resolveComponent("TableHead"),m=e.resolveComponent("TableRow"),u=e.resolveComponent("TableHeader"),C=e.resolveComponent("Checkbox"),w=e.resolveComponent("TableCell"),T=e.resolveComponent("Button"),h=e.resolveComponent("TableBody"),$=e.resolveComponent("Table"),M=e.resolveComponent("Card");return e.openBlock(),e.createBlock(M,{class:"w-full py-4 px-4"},{default:e.withCtx(()=>[e.createVNode($,{class:"rounded overflow-hidden"},{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.unref(r)?.length>0?(e.openBlock(),e.createBlock(i,{key:0})):e.createCommentVNode("",!0),e.createVNode(i,{class:"capitalize"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)?.contentEntryName||"entry"),1)]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("Last updated at",-1)])]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("Status",-1)])]),_:1}),e.createVNode(i,{class:"text-right"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Edit",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(h,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,d=>(e.openBlock(),e.createBlock(m,{key:d.id,onClick:f=>e.unref(a)("collections/"+e.unref(E).collectionId+"/"+d.id),class:"cursor-pointer"},{default:e.withCtx(()=>[e.unref(r)?.length>0?(e.openBlock(),e.createBlock(w,{key:0},{default:e.withCtx(()=>[e.createVNode(C,{"model-value":e.unref(r)?.includes(d.id),"onUpdate:modelValue":f=>s(f,d.id),onClick:t[0]||(t[0]=e.withModifiers(()=>{},["prevent","stop"]))},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(w,{class:"font-medium"},{default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createElementVNode("span",null,e.toDisplayString(d.title),1)])]),_:2},1024),e.createVNode(w,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.updated?.at?new Date(d.updated.at).toLocaleString():"N/A"),1)]),_:2},1024),e.createVNode(w,null,{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("span",W,[d.publishProgress.completed===d.publishProgress.total?(e.openBlock(),e.createElementBlock("span",G,"Published")):(e.openBlock(),e.createElementBlock("span",Q,"Partly Published ("+e.toDisplayString(d.publishProgress.completed)+"/"+e.toDisplayString(d.publishProgress.total)+")",1))])):d.status==="draft"?(e.openBlock(),e.createElementBlock("span",X,"Draft")):d.status==="archived"?(e.openBlock(),e.createElementBlock("span",J,"Archived")):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(w,{class:"text-right"},{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("a",{key:0,href:g(d),target:"_blank",rel:"noreferrer",onClick:t[1]||(t[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(T,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Globe),{class:"size-4"})]),_:1})],8,Y)):e.createCommentVNode("",!0),e.createElementVNode("a",{href:y(d),rel:"noreferrer",onClick:t[2]||(t[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(T,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Pencil),{class:"size-4"})]),_:1})],8,Z)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})}}}),te={class:"flex items-center space-x-2 mb-4"},oe={for:"chk_published_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},ne={class:"flex items-center space-x-2 mb-4"},le={for:"chk_draft_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},re={class:"flex items-center space-x-2 mb-4"},ae={for:"chk_archived_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},se=e.defineComponent({__name:"FilterPopover",setup(D){const r=e.inject("filter"),v=e.ref(""),b=()=>{r.value={published:!0,draft:!0,archived:!1}};return(c,a)=>{const E=e.resolveComponent("Button"),N=e.resolveComponent("PopoverTrigger"),s=e.resolveComponent("Checkbox"),g=e.resolveComponent("PopoverContent"),y=e.resolveComponent("Popover");return e.openBlock(),e.createBlock(y,null,{default:e.withCtx(()=>[e.createVNode(N,{asChild:""},{default:e.withCtx(()=>[e.createVNode(E,{variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Filter),{class:"size-4"}),a[3]||(a[3]=e.createTextVNode(" Filter ",-1))]),_:1})]),_:1}),e.createVNode(g,{class:"w-64"},{default:e.withCtx(()=>[a[5]||(a[5]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Status ",-1)),e.createElementVNode("div",te,[e.createVNode(s,{id:"chk_published_entries",modelValue:e.unref(r).published,"onUpdate:modelValue":a[0]||(a[0]=x=>e.unref(r).published=x)},null,8,["modelValue"]),e.createElementVNode("label",oe," Show published "+e.toDisplayString(v.value||"entries"),1)]),e.createElementVNode("div",ne,[e.createVNode(s,{id:"chk_draft_entries",modelValue:e.unref(r).draft,"onUpdate:modelValue":a[1]||(a[1]=x=>e.unref(r).draft=x)},null,8,["modelValue"]),e.createElementVNode("label",le," Show draft "+e.toDisplayString(v.value||"entries"),1)]),e.createElementVNode("div",re,[e.createVNode(s,{id:"chk_archived_entries",modelValue:e.unref(r).archived,"onUpdate:modelValue":a[2]||(a[2]=x=>e.unref(r).archived=x)},null,8,["modelValue"]),e.createElementVNode("label",ae," Show archived "+e.toDisplayString(v.value||"entries"),1)]),!e.unref(r).published||!e.unref(r).draft||e.unref(r).archived?(e.openBlock(),e.createBlock(E,{key:0,variant:"secondary",class:"ml-auto my-2",size:"sm",onClick:b},{default:e.withCtx(()=>[e.createVNode(e.unref(P.RotateCcw),{class:"size-3"}),a[4]||(a[4]=e.createElementVNode("span",{class:"ml-0.5 text-xs"},"Reset filters",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),ie=e.defineComponent({__name:"ContentEntryContextMenu",emits:["selectAll","duplicateEntry","deleteEntry","deleteSelection"],setup(D,{emit:r}){const v=r,b=e.inject("entries"),c=e.inject("selection"),a=e.inject("config"),{hasPermission:E}=V.useModulePermissions(),{navigateTo:N}=V.useModuleRoute(),s=e.computed(()=>c.value?.length!==1?null:b.value?.find(l=>l.id===c.value[0])),g=l=>{let t=a.previewUrl;t=t.replace("{{ id","{{id"),t=t.replace("id }}","id}}"),t=t.replace("{{id}}",l.id),t=t.replace("{{ slug","{{slug"),t=t.replace("slug }}","slug}}"),t=t.replace("{{slug}}",l.slug),window.open(t,"_blank")},y=async(l,t)=>{try{if(!["draft","published","archived"].includes(t))return;await V.useFirebaseIntegration(a.project).update(a.contentCollection,l.id,{status:t}),l.status=t,_.toast.success("Entry status changed")}catch{_.toast.error("Failed to change entry status")}},x=async l=>{try{if(!["draft","published","archived"].includes(l))return;const t=V.useFirebaseIntegration(a.project),i=[];c.value.forEach(async m=>{i.push(t.update(a.contentCollection,m,{status:l}))}),_.toast.promise(Promise.all(i),{loading:`Changing status of ${c.value.length} entries...`,success:()=>{const m=c.value.length;return c.value.forEach(u=>{b.value.find(C=>C.id==u).status=l}),c.value=[],`Entry status changed for ${m} entries`},error:m=>"Failed to change entry status"})}catch{_.toast.error("Failed to change entry status")}};return(l,t)=>{const i=e.resolveComponent("ContextMenuTrigger"),m=e.resolveComponent("ContextMenuShortcut"),u=e.resolveComponent("ContextMenuItem"),C=e.resolveComponent("ContextMenuContent"),w=e.resolveComponent("ContextMenuSeparator"),T=e.resolveComponent("ContextMenuSubTrigger"),h=e.resolveComponent("ContextMenuCheckboxItem"),$=e.resolveComponent("ContextMenuSubContent"),M=e.resolveComponent("ContextMenuSub"),d=e.resolveComponent("ContextMenu");return e.openBlock(),e.createBlock(d,null,{default:e.withCtx(()=>[e.createVNode(i,{class:"flex flex-1"},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3}),e.unref(c).length===0?(e.openBlock(),e.createBlock(C,{key:0,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[0]||(t[0]=f=>v("selectAll"))},{default:e.withCtx(()=>[t[13]||(t[13]=e.createTextVNode(" Select all ",-1)),e.createVNode(m,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("⌘ + A",-1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length===1&&s.value?(e.openBlock(),e.createBlock(C,{key:1,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[1]||(t[1]=f=>e.unref(N)(s.value.id))},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Edit entry ",-1)])]),_:1}),e.createVNode(w),e.unref(a).previewUrl?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(u,{inset:"",onClick:t[2]||(t[2]=f=>g(s.value))},{default:e.withCtx(()=>[t[15]||(t[15]=e.createTextVNode(" Preview entry ",-1)),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(P.ExternalLink),{class:"size-4"})]),_:1})]),_:1}),e.createVNode(w)],64)):e.createCommentVNode("",!0),e.createVNode(u,{inset:"",onClick:t[3]||(t[3]=f=>v("duplicateEntry",s.value))},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Duplicate entry ",-1)])]),_:1}),e.createVNode(M,null,{default:e.withCtx(()=>[e.createVNode(T,{inset:""},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Change status ",-1)])]),_:1}),e.createVNode($,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[4]||(t[4]=f=>y(s.value,"draft")),modelValue:s.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(h,{onClick:t[5]||(t[5]=f=>y(s.value,"published")),modelValue:s.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(h,{onClick:t[6]||(t[6]=f=>y(s.value,"archived")),modelValue:s.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(u,{inset:"",variant:"destructive",onClick:t[7]||(t[7]=f=>v("deleteEntry",s.value))},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode(" Delete entry ",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length>1?(e.openBlock(),e.createBlock(C,{key:2,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(M,null,{default:e.withCtx(()=>[e.createVNode(T,{inset:""},{default:e.withCtx(()=>[e.createTextVNode(" Change status ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1}),e.createVNode($,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[8]||(t[8]=f=>x("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(h,{onClick:t[9]||(t[9]=f=>x("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(h,{onClick:t[10]||(t[10]=f=>x("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(u,{inset:"",variant:"destructive",onClick:t[11]||(t[11]=f=>v("deleteSelection"))},{default:e.withCtx(()=>[e.createTextVNode(" Delete entries ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:3})}}}),ce={key:0,class:"relative flex flex-col flex-1"},de={class:"flex items-center justify-between gap-4 w-full my-4"},ue={ref:"container",class:"flex items-center justify-between gap-4 w-full mb-8"},pe={class:"flex items-center gap-4"},me={class:"text-lg whitespace-nowrap"},fe={class:"relative w-full max-w-sm items-center"},ve={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},ge={class:"flex items-center gap-4"},Ce={class:"capitalize"},xe={class:"flex mb-4"},Ve=e.defineComponent({__name:"Entries",props:{config:{type:Object,required:!0}},setup(D){const r=D,{hasPermission:v,isAdmin:b}=V.useModulePermissions(),{params:c,navigateTo:a}=V.useModuleRoute(),{confirm:E}=V.useConfirmation(),N=V.useFirebaseIntegration(r.config.project),s=e.ref(null),g=e.ref([]);V.useModuleBreadcrumbs(()=>[{text:s.value?.name??""}]);const y=async()=>{const n=await N.get(r.config.collectionsCollection,c.value.collectionId);n?s.value=n:(a("/"),_.toast.error("Collection not found"))},x=async()=>{const n=await N.find(r.config.contentCollection,{filters:[{field:"collectionId",operator:"==",value:c.value.collectionId}]});g.value=n||[]},l=e.ref(1),t=e.ref([]),i=e.ref(""),m=e.ref(10),u=n=>{if(!n)return 0;if(typeof n?.toDate=="function")return n.toDate().getTime();const o=n instanceof Date?n:new Date(n);return Number.isNaN(o.getTime())?0:o.getTime()},C=e.computed(()=>{const n=i.value.trim().toLowerCase();return[...n?g.value.filter(p=>{const k=String(p?.title??"").toLowerCase(),S=String(p?.slug??"").toLowerCase();return k.includes(n)||S.includes(n)||p?.id===n}):g.value].sort((p,k)=>{const S=u(p?.updated?.at)||u(p?.updatedAt)||u(p?.createdAt);return(u(k?.updated?.at)||u(k?.updatedAt)||u(k?.createdAt))-S})}),w=e.computed(()=>{if(C.value.length<=m.value)return C.value;const n=(l.value-1)*m.value,o=n+m.value;return C.value.slice(n,o)});async function T(n){return(await N.find(r.config.contentCollection,{filters:[{field:"slug",operator:"==",value:n}]})).length>0}const h=()=>{t.value=w.value.map(n=>n.id)},$=async n=>{try{let o={...n},p=o.slug+"-copy",k=2;for(;await T(p);)p=o.slug+"-copy-"+k,k++;o.id=void 0,o.createdAt=new Date,o.updatedAt=new Date,o.slug=p,o.status="draft",o.title=o.title+" (copy)";const S=await N.add(r.config.contentCollection,o);a(S.id),_.toast.success("Entry duplicated")}catch{_.toast.error("Failed to duplicate entry")}},M=async n=>{if(await E(`Are you sure you want to delete "${n.title}"?`))try{await N.remove(r.config.contentCollection,n.id),g.value=g.value.filter(p=>p.id!==n.id),t.value=[],_.toast.success("Entry deleted")}catch{_.toast.error("Failed to delete entry")}},d=async()=>{if(await E(`Are you sure you want to delete all selected ${s?.contentEntryNamePlural||"entries"} (${t.value.length})?`))try{t.value.forEach(async o=>{await N.remove(r.config.contentCollection,o)}),g.value=g.value.filter(o=>!t.value.includes(o.id)),t.value=[],_.toast.success("Entries deleted")}catch{_.toast.error("Failed to delete entries")}},f=e.ref({published:!0,draft:!0,archived:!1});e.watch(f,()=>{l.value=1});const A=n=>{n.target?.matches("input, textarea")||n.target?.isContentEditable||(n.key==="Escape"&&(t.value=[]),(n.metaKey||n.ctrlKey)&&n.key.toLowerCase()==="a"&&(n.preventDefault(),h()))};return e.onMounted(()=>{y(),x(),window.addEventListener("keydown",A)}),e.onUnmounted(()=>{window.removeEventListener("keydown",A)}),e.provide("config",r.config),e.provide("filter",f),e.provide("entries",g),e.provide("selection",t),e.provide("collection",s),(n,o)=>{const p=e.resolveComponent("Button"),k=e.resolveComponent("Input"),S=e.resolveComponent("PaginationFirst"),F=e.resolveComponent("PaginationPrev"),I=e.resolveComponent("PaginationListItem"),U=e.resolveComponent("PaginationEllipsis"),j=e.resolveComponent("PaginationNext"),R=e.resolveComponent("PaginationLast"),q=e.resolveComponent("PaginationList"),K=e.resolveComponent("Pagination");return s.value?(e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("div",de,[e.createVNode(p,{onClick:o[0]||(o[0]=B=>e.unref(a)("/")),variant:"link",class:"!pl-0"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.ChevronLeft),{class:"size-4"}),o[5]||(o[5]=e.createTextVNode(" Collections ",-1))]),_:1})]),e.createElementVNode("div",ue,[e.createElementVNode("div",pe,[e.createElementVNode("p",me,e.toDisplayString(C.value?.length)+" "+e.toDisplayString(s.value?.contentEntryNamePlural||"entries"),1),e.createElementVNode("div",fe,[e.createVNode(k,{id:"search",type:"text",placeholder:"Search...",class:"pl-8",onKeydown:o[1]||(o[1]=e.withKeys(B=>i.value="",["escape"])),modelValue:i.value,"onUpdate:modelValue":o[2]||(o[2]=B=>i.value=B)},null,8,["modelValue"]),e.createElementVNode("span",ve,[e.createVNode(e.unref(P.Search),{class:"size-4 text-muted-foreground"})])])]),e.createElementVNode("div",ge,[t.value.length>0?(e.openBlock(),e.createBlock(p,{key:0,variant:"destructive",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(" Delete Selection ("+e.toDisplayString(t.value.length)+") ",1)]),_:1})):e.createCommentVNode("",!0),e.unref(b)()||e.unref(v)("create-entry")&&s.value?.allowUserEntryManagement?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(c)?.collectionId?(e.openBlock(),e.createBlock(p,{key:0,variant:"outline",onClick:o[3]||(o[3]=B=>e.unref(a)(`collections/${e.unref(c).collectionId}/new`))},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Plus),{class:"size-4"}),e.createElementVNode("span",null,[o[6]||(o[6]=e.createTextVNode(" New ",-1)),e.createElementVNode("span",Ce,e.toDisplayString(s.value?.contentEntryName||"entry"),1)])]),_:1})):e.createCommentVNode("",!0),o[7]||(o[7]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1))],64)):e.createCommentVNode("",!0),e.createVNode(se)])],512),e.createElementVNode("div",xe,[e.createVNode(ie,{onSelectAll:h,onDuplicateEntry:$,onDeleteEntry:M,onDeleteSelection:d},{default:e.withCtx(()=>[e.createVNode(ee,{entries:w.value},null,8,["entries"])]),_:1})]),C.value?.length>m.value?(e.openBlock(),e.createBlock(K,{key:0,page:l.value,"onUpdate:page":o[4]||(o[4]=B=>l.value=B),"items-per-page":m.value,total:C.value?.length,"sibling-count":1,"show-edges":""},{default:e.withCtx(()=>[e.createVNode(q,{class:"flex items-center gap-1"},{default:e.withCtx(({items:B})=>[e.createVNode(S),e.createVNode(F),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B,(L,z)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[L.type==="page"?(e.openBlock(),e.createBlock(I,{key:z,value:L.value,"as-child":""},{default:e.withCtx(()=>[e.createVNode(p,{class:"size-10 p-0",variant:L.value===l.value?"default":"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(L.value),1)]),_:2},1032,["variant"])]),_:2},1032,["value"])):(e.openBlock(),e.createBlock(U,{key:L.type,index:z},null,8,["index"]))],64))),256)),e.createVNode(j),e.createVNode(R)]),_:1})]),_:1},8,["page","items-per-page","total"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}});exports.default=Ve;
@@ -1,11 +1,11 @@
1
- import { defineComponent as Y, ref as y, withAsyncContext as M, watch as $, onMounted as O, resolveComponent as s, openBlock as d, createElementBlock as j, createElementVNode as c, createVNode as t, unref as v, withCtx as l, createTextVNode as o, createBlock as g, createCommentVNode as T, toDisplayString as r, Fragment as Q, renderList as h } from "vue";
2
- import { useModulePermissions as G, useModuleRoute as J, useModuleStorage as K, useModuleBreadcrumbs as W, useFirebaseIntegration as X, useRoute as Z, useRouter as ee } from "@oneclick.dev/cms-kit";
3
- import { Plus as te, Search as le, Loader2 as ne, Pencil as oe } from "lucide-vue-next";
4
- import { u as se } from "./index-CrGjxSwa.mjs";
5
- const ae = { class: "relative" }, ue = {
1
+ import { defineComponent as Y, ref as _, withAsyncContext as M, watch as $, onMounted as Q, resolveComponent as s, openBlock as d, createElementBlock as j, createElementVNode as c, createVNode as t, unref as v, withCtx as l, createTextVNode as o, createBlock as g, createCommentVNode as T, toDisplayString as i, Fragment as h, renderList as G } from "vue";
2
+ import { useModulePermissions as J, useModuleRoute as K, useModuleStorage as W, useModuleBreadcrumbs as X, useFirebaseIntegration as Z, useRoute as ee, useRouter as te, useOverlayParams as le } from "@oneclick.dev/cms-kit";
3
+ import { Plus as ne, Search as oe, Loader2 as se, Pencil as ae } from "lucide-vue-next";
4
+ import { u as ue } from "./index-CrGjxSwa.mjs";
5
+ const re = { class: "relative" }, ie = {
6
6
  ref: "container",
7
7
  class: "w-full max-w-5xl mx-auto"
8
- }, ie = { class: "flex justify-between items-center mb-4" }, re = { class: "relative w-full max-w-sm items-center" }, de = { class: "absolute start-0 inset-y-0 flex items-center justify-center px-2 pointer-events-none" }, ce = { class: "absolute end-0 inset-y-0 flex items-center justify-center px-2 pointer-events-none" }, ye = /* @__PURE__ */ Y({
8
+ }, de = { class: "flex justify-between items-center mb-4" }, ce = { class: "relative w-full max-w-sm items-center" }, fe = { class: "absolute start-0 inset-y-0 flex items-center justify-center px-2 pointer-events-none" }, me = { class: "absolute end-0 inset-y-0 flex items-center justify-center px-2 pointer-events-none" }, be = /* @__PURE__ */ Y({
9
9
  __name: "Find",
10
10
  props: {
11
11
  config: {
@@ -15,68 +15,68 @@ const ae = { class: "relative" }, ue = {
15
15
  },
16
16
  async setup(z) {
17
17
  let a, b;
18
- const x = z, { hasPermission: fe } = G(), { navigateTo: B } = J(), { getModuleData: F } = K();
19
- W(() => [
18
+ const x = z, { hasPermission: pe } = J(), { navigateTo: S } = K(), { getModuleData: F } = W();
19
+ X(() => [
20
20
  { text: "Promo codes list" }
21
21
  ]);
22
- const w = y([]);
22
+ const w = _([]);
23
23
  w.value = ([a, b] = M(() => F("promo-types")), a = await a, b(), a || []);
24
- const _ = y([]), k = X(x.config.project);
25
- _.value = ([a, b] = M(() => k.find(x.config.promoCodeCollection)), a = await a, b(), a);
26
- const N = Z(), R = ee(), u = y(N.query.q || ""), C = y(""), S = y(!1), P = se(async () => {
27
- S.value = !0;
28
- let i = u.value.trim().toUpperCase();
29
- i.length === 0 ? _.value = await k.find(x.config.promoCodeCollection) : _.value = await k.find(x.config.promoCodeCollection, {
24
+ const y = _([]), k = Z(x.config.project);
25
+ y.value = ([a, b] = M(() => k.find(x.config.promoCodeCollection)), a = await a, b(), a);
26
+ const q = ee(), R = te(), D = le(), u = _(D.value.q || q.query.q || ""), C = _(""), P = _(!1), B = ue(async () => {
27
+ P.value = !0;
28
+ let r = u.value.trim().toUpperCase();
29
+ r.length === 0 ? y.value = await k.find(x.config.promoCodeCollection) : y.value = await k.find(x.config.promoCodeCollection, {
30
30
  filters: [
31
31
  {
32
32
  field: "code",
33
33
  operator: ">=",
34
- value: i
34
+ value: r
35
35
  },
36
36
  {
37
37
  field: "code",
38
38
  operator: "<",
39
- value: i.slice(0, -1) + String.fromCharCode(i.slice(-1).charCodeAt(0) + 1)
39
+ value: r.slice(0, -1) + String.fromCharCode(r.slice(-1).charCodeAt(0) + 1)
40
40
  }
41
41
  ]
42
- }), C.value = u.value, S.value = !1;
42
+ }), C.value = u.value, P.value = !1;
43
43
  }, 600);
44
44
  $(u, async () => {
45
- await P(), R.replace({
45
+ await B(), R.replace({
46
46
  query: {
47
- ...N.query,
47
+ ...q.query,
48
48
  q: u.value.trim() ? u.value.trim() : void 0
49
49
  // remove param when empty
50
50
  }
51
51
  });
52
52
  });
53
- const D = (i) => {
53
+ const H = (r) => {
54
54
  const e = /* @__PURE__ */ new Date();
55
- return i.expiresAt > e && i.startsAt < e;
55
+ return r.expiresAt > e && r.startsAt < e;
56
56
  };
57
- return O(async () => {
58
- u.value.trim() && await P();
59
- }), (i, e) => {
60
- const V = s("Button"), H = s("Input"), q = s("TableCaption"), f = s("TableHead"), A = s("TableRow"), E = s("TableHeader"), m = s("TableCell"), I = s("TableBody"), L = s("Table"), U = s("Card");
61
- return d(), j("div", ae, [
62
- c("div", ue, [
63
- c("div", ie, [
57
+ return Q(async () => {
58
+ u.value.trim() && await B();
59
+ }), (r, e) => {
60
+ const N = s("Button"), E = s("Input"), V = s("TableCaption"), f = s("TableHead"), A = s("TableRow"), I = s("TableHeader"), m = s("TableCell"), L = s("TableBody"), U = s("Table"), O = s("Card");
61
+ return d(), j("div", re, [
62
+ c("div", ie, [
63
+ c("div", de, [
64
64
  e[3] || (e[3] = c("h1", { class: "text-2xl font-bold" }, "Find Promo Codes", -1)),
65
- t(V, {
66
- onClick: e[0] || (e[0] = (n) => v(B)("")),
65
+ t(N, {
66
+ onClick: e[0] || (e[0] = (n) => v(S)("")),
67
67
  variant: "outline"
68
68
  }, {
69
69
  default: l(() => [
70
- t(v(te), { class: "size-4" }),
70
+ t(v(ne), { class: "size-4" }),
71
71
  e[2] || (e[2] = o(" Create New Promo Code ", -1))
72
72
  ]),
73
73
  _: 1
74
74
  })
75
75
  ]),
76
- t(U, { class: "p-4" }, {
76
+ t(O, { class: "p-4" }, {
77
77
  default: l(() => [
78
- c("div", re, [
79
- t(H, {
78
+ c("div", ce, [
79
+ t(E, {
80
80
  id: "search",
81
81
  type: "text",
82
82
  placeholder: "Search...",
@@ -84,33 +84,33 @@ const ae = { class: "relative" }, ue = {
84
84
  "onUpdate:modelValue": e[1] || (e[1] = (n) => u.value = n),
85
85
  class: "px-8"
86
86
  }, null, 8, ["modelValue"]),
87
- c("span", de, [
88
- t(v(le), { class: "size-4 text-muted-foreground" })
87
+ c("span", fe, [
88
+ t(v(oe), { class: "size-4 text-muted-foreground" })
89
89
  ]),
90
- c("span", ce, [
91
- S.value ? (d(), g(v(ne), {
90
+ c("span", me, [
91
+ P.value ? (d(), g(v(se), {
92
92
  key: 0,
93
93
  class: "size-4 text-muted-foreground animate-spin"
94
94
  })) : T("", !0)
95
95
  ])
96
96
  ]),
97
- t(L, null, {
97
+ t(U, null, {
98
98
  default: l(() => [
99
- C.value ? T("", !0) : (d(), g(q, { key: 0 }, {
99
+ C.value ? T("", !0) : (d(), g(V, { key: 0 }, {
100
100
  default: l(() => [...e[4] || (e[4] = [
101
101
  o("A list of your most recent promo codes.", -1)
102
102
  ])]),
103
103
  _: 1
104
104
  })),
105
- C.value ? (d(), g(q, { key: 1 }, {
105
+ C.value ? (d(), g(V, { key: 1 }, {
106
106
  default: l(() => [
107
107
  e[5] || (e[5] = o("A list of your promo codes starting with ", -1)),
108
- c("strong", null, '"' + r(C.value) + '"', 1),
108
+ c("strong", null, '"' + i(C.value) + '"', 1),
109
109
  e[6] || (e[6] = o(".", -1))
110
110
  ]),
111
111
  _: 1
112
112
  })) : T("", !0),
113
- t(E, null, {
113
+ t(I, null, {
114
114
  default: l(() => [
115
115
  t(A, null, {
116
116
  default: l(() => [
@@ -156,51 +156,51 @@ const ae = { class: "relative" }, ue = {
156
156
  ]),
157
157
  _: 1
158
158
  }),
159
- _.value?.length > 0 ? (d(), g(I, { key: 2 }, {
159
+ y.value?.length > 0 ? (d(), g(L, { key: 2 }, {
160
160
  default: l(() => [
161
- (d(!0), j(Q, null, h(_.value, (n) => (d(), g(A, {
161
+ (d(!0), j(h, null, G(y.value, (n) => (d(), g(A, {
162
162
  key: n.id
163
163
  }, {
164
164
  default: l(() => [
165
165
  t(m, { class: "font-medium uppercase" }, {
166
166
  default: l(() => [
167
- o(r(n.code), 1)
167
+ o(i(n.code), 1)
168
168
  ]),
169
169
  _: 2
170
170
  }, 1024),
171
171
  t(m, null, {
172
172
  default: l(() => [
173
- o(r(w.value.find((p) => p.key === n.type)?.label), 1)
173
+ o(i(w.value.find((p) => p.key === n.type)?.label), 1)
174
174
  ]),
175
175
  _: 2
176
176
  }, 1024),
177
177
  t(m, null, {
178
178
  default: l(() => [
179
- o(r(w.value.find((p) => p.key === n.type)?.valuePrefix) + " " + r(n.value) + " " + r(w.value.find((p) => p.key === n.type)?.valueSuffix), 1)
179
+ o(i(w.value.find((p) => p.key === n.type)?.valuePrefix) + " " + i(n.value) + " " + i(w.value.find((p) => p.key === n.type)?.valueSuffix), 1)
180
180
  ]),
181
181
  _: 2
182
182
  }, 1024),
183
183
  t(m, null, {
184
184
  default: l(() => [
185
- o(r(n.usageLimit === 1 ? n.usageCount > 0 ? "Yes" : "No" : n.usageCount === 0 ? "No" : n.usageCount === 1 ? "1 time" : n.usageCount + " times"), 1)
185
+ o(i(n.usageLimit === 1 ? n.usageCount > 0 ? "Yes" : "No" : n.usageCount === 0 ? "No" : n.usageCount === 1 ? "1 time" : n.usageCount + " times"), 1)
186
186
  ]),
187
187
  _: 2
188
188
  }, 1024),
189
189
  t(m, null, {
190
190
  default: l(() => [
191
- o(r(D(n) ? "Yes" : "No"), 1)
191
+ o(i(H(n) ? "Yes" : "No"), 1)
192
192
  ]),
193
193
  _: 2
194
194
  }, 1024),
195
195
  t(m, null, {
196
196
  default: l(() => [
197
- t(V, {
197
+ t(N, {
198
198
  variant: "ghost",
199
199
  size: "icon",
200
- onClick: (p) => v(B)("/promo-codes/" + n.id)
200
+ onClick: (p) => v(S)("/promo-codes/" + n.id)
201
201
  }, {
202
202
  default: l(() => [
203
- t(v(oe), { class: "size-4" })
203
+ t(v(ae), { class: "size-4" })
204
204
  ]),
205
205
  _: 1
206
206
  }, 8, ["onClick"])
@@ -225,5 +225,5 @@ const ae = { class: "relative" }, ue = {
225
225
  }
226
226
  });
227
227
  export {
228
- ye as default
228
+ be as default
229
229
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=require("@oneclick.dev/cms-kit"),x=require("lucide-vue-next"),A=require("./index-4tjmIans.js"),M={class:"relative"},j={ref:"container",class:"w-full max-w-5xl mx-auto"},z={class:"flex justify-between items-center mb-4"},F={class:"relative w-full max-w-sm items-center"},R={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2 pointer-events-none"},H={class:"absolute end-0 inset-y-0 flex items-center justify-center px-2 pointer-events-none"},I=e.defineComponent({__name:"Find",props:{config:{type:Object,required:!0}},async setup(T){let n,d;const f=T,{hasPermission:L}=r.useModulePermissions(),{navigateTo:N}=r.useModuleRoute(),{getModuleData:b}=r.useModuleStorage();r.useModuleBreadcrumbs(()=>[{text:"Promo codes list"}]);const m=e.ref([]);m.value=([n,d]=e.withAsyncContext(()=>b("promo-types")),n=await n,d(),n||[]);const c=e.ref([]),v=r.useFirebaseIntegration(f.config.project);c.value=([n,d]=e.withAsyncContext(()=>v.find(f.config.promoCodeCollection)),n=await n,d(),n);const V=r.useRoute(),k=r.useRouter(),h=r.useOverlayParams(),l=e.ref(h.value.q||V.query.q||""),p=e.ref(""),C=e.ref(!1),y=A.useDebounceFn(async()=>{C.value=!0;let a=l.value.trim().toUpperCase();a.length===0?c.value=await v.find(f.config.promoCodeCollection):c.value=await v.find(f.config.promoCodeCollection,{filters:[{field:"code",operator:">=",value:a},{field:"code",operator:"<",value:a.slice(0,-1)+String.fromCharCode(a.slice(-1).charCodeAt(0)+1)}]}),p.value=l.value,C.value=!1},600);e.watch(l,async()=>{await y(),k.replace({query:{...V.query,q:l.value.trim()?l.value.trim():void 0}})});const B=a=>{const t=new Date;return a.expiresAt>t&&a.startsAt<t};return e.onMounted(async()=>{l.value.trim()&&await y()}),(a,t)=>{const w=e.resolveComponent("Button"),S=e.resolveComponent("Input"),_=e.resolveComponent("TableCaption"),s=e.resolveComponent("TableHead"),g=e.resolveComponent("TableRow"),q=e.resolveComponent("TableHeader"),i=e.resolveComponent("TableCell"),D=e.resolveComponent("TableBody"),P=e.resolveComponent("Table"),E=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",M,[e.createElementVNode("div",j,[e.createElementVNode("div",z,[t[3]||(t[3]=e.createElementVNode("h1",{class:"text-2xl font-bold"},"Find Promo Codes",-1)),e.createVNode(w,{onClick:t[0]||(t[0]=o=>e.unref(N)("")),variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(x.Plus),{class:"size-4"}),t[2]||(t[2]=e.createTextVNode(" Create New Promo Code ",-1))]),_:1})]),e.createVNode(E,{class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",F,[e.createVNode(S,{id:"search",type:"text",placeholder:"Search...",modelValue:l.value,"onUpdate:modelValue":t[1]||(t[1]=o=>l.value=o),class:"px-8"},null,8,["modelValue"]),e.createElementVNode("span",R,[e.createVNode(e.unref(x.Search),{class:"size-4 text-muted-foreground"})]),e.createElementVNode("span",H,[C.value?(e.openBlock(),e.createBlock(e.unref(x.Loader2),{key:0,class:"size-4 text-muted-foreground animate-spin"})):e.createCommentVNode("",!0)])]),e.createVNode(P,null,{default:e.withCtx(()=>[p.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(_,{key:0},{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("A list of your most recent promo codes.",-1)])]),_:1})),p.value?(e.openBlock(),e.createBlock(_,{key:1},{default:e.withCtx(()=>[t[5]||(t[5]=e.createTextVNode("A list of your promo codes starting with ",-1)),e.createElementVNode("strong",null,'"'+e.toDisplayString(p.value)+'"',1),t[6]||(t[6]=e.createTextVNode(".",-1))]),_:1})):e.createCommentVNode("",!0),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(g,null,{default:e.withCtx(()=>[e.createVNode(s,null,{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Code",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Type",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("Value",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Used",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("Still eligible",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Action",-1)])]),_:1})]),_:1})]),_:1}),c.value?.length>0?(e.openBlock(),e.createBlock(D,{key:2},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,o=>(e.openBlock(),e.createBlock(g,{key:o.id},{default:e.withCtx(()=>[e.createVNode(i,{class:"font-medium uppercase"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.code),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value.find(u=>u.key===o.type)?.label),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value.find(u=>u.key===o.type)?.valuePrefix)+" "+e.toDisplayString(o.value)+" "+e.toDisplayString(m.value.find(u=>u.key===o.type)?.valueSuffix),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.usageLimit===1?o.usageCount>0?"Yes":"No":o.usageCount===0?"No":o.usageCount===1?"1 time":o.usageCount+" times"),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(B(o)?"Yes":"No"),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(w,{variant:"ghost",size:"icon",onClick:u=>e.unref(N)("/promo-codes/"+o.id)},{default:e.withCtx(()=>[e.createVNode(e.unref(x.Pencil),{class:"size-4"})]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024))),128))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})],512)])}}});exports.default=I;
@@ -2,7 +2,7 @@ import { defineComponent as ue, ref as d, watch as de, inject as re, computed as
2
2
  import { Plus as ve, CalendarIcon as me } from "lucide-vue-next";
3
3
  import { useModuleRoute as fe, useModule as ge, useFirebaseIntegration as _e } from "@oneclick.dev/cms-kit";
4
4
  import { c as Ve } from "./utils-BVKy9S2J.mjs";
5
- import { o as q, g as R, h as De } from "./DateFormatter-CvOfaUnU.mjs";
5
+ import { c as q, b as R, $ as De } from "./DateFormatter-2B0R-DY4.mjs";
6
6
  const Se = { class: "@container/new-res-form space-y-5 py-4" }, be = { class: "grid gap-4" }, xe = { class: "grid gap-4 @md/new-res-form:grid-cols-2" }, ye = { class: "grid gap-2" }, Pe = { class: "flex gap-2 items-center" }, we = { class: "grid gap-2" }, $e = { class: "flex gap-2 items-center" }, Ce = { class: "grid gap-2" }, Te = { class: "grid gap-2" }, he = { class: "grid gap-4" }, Ne = { class: "grid gap-4 @md/new-res-form:grid-cols-2" }, Oe = { class: "grid gap-2" }, Fe = { class: "grid gap-4 @md/new-res-form:grid-cols-2" }, Ie = { class: "grid gap-2" }, Ue = { class: "grid gap-2" }, ke = { class: "flex items-center h-9 px-3 text-sm text-muted-foreground" }, Me = { class: "grid gap-4" }, Re = { class: "grid gap-4 @md/new-res-form:grid-cols-2" }, Le = { class: "grid gap-2" }, Be = { class: "grid gap-2" }, Ee = { class: "grid gap-4 @md/new-res-form:grid-cols-2" }, je = { class: "grid gap-2" }, Ae = { class: "grid gap-2" }, He = { class: "mt-4 text-red-400" }, ze = { class: "list-disc pl-4" }, Ge = { key: 0 }, qe = { key: 1 }, Ze = /* @__PURE__ */ ue({
7
7
  __name: "NewReservationDialog",
8
8
  setup(Je) {