@oneclick.dev/cms-core-modules 0.0.122 → 0.0.124

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 (162) hide show
  1. package/dist/{ContentEditor-CoJjsV-m.js → ContentEditor-BcIUumah.js} +63 -59
  2. package/dist/{ContentEditor-DIwqplfB.mjs → ContentEditor-DX1bTQKs.mjs} +27894 -26319
  3. package/dist/{Detail-Dk8E6_uF.mjs → Detail-B7pe808q.mjs} +15 -14
  4. package/dist/Detail-BESGmY7z.js +1 -0
  5. package/dist/{Detail-Cn9Bk0u0.mjs → Detail-B_Q7Qkuz.mjs} +26 -25
  6. package/dist/Detail-CNiLIEh9.js +1 -0
  7. package/dist/{Detail-B_scnidb.mjs → Detail-DNxAzeCs.mjs} +35 -34
  8. package/dist/Detail-t3tOcy3X.js +1 -0
  9. package/dist/Editor-D4evcdhv.mjs +768 -0
  10. package/dist/Editor-gLLtuJbY.js +1 -0
  11. package/dist/FormStatusBadge.vue_vue_type_script_setup_true_lang-BjKpsqT9.js +1 -0
  12. package/dist/FormStatusBadge.vue_vue_type_script_setup_true_lang-D5v5AhLe.mjs +76 -0
  13. package/dist/Knowledge-B66vxz--.js +1 -0
  14. package/dist/Knowledge-BnMTTuJ7.mjs +742 -0
  15. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-bZidw6RT.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-8I_Z9cD_.mjs} +530 -530
  16. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BVE_uURZ.js +1 -0
  17. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BdFa-xNf.mjs +3566 -0
  18. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DzPOadcU.js +925 -0
  19. package/dist/Overview-BE4uYPx0.mjs +745 -0
  20. package/dist/Overview-CQRpFhbJ.mjs +286 -0
  21. package/dist/Overview-CTs7sX4d.js +1 -0
  22. package/dist/Overview-Cj89XXKN.js +1 -0
  23. package/dist/Overview-D_c18mbR.mjs +248 -0
  24. package/dist/Overview-g4Rcj245.js +1 -0
  25. package/dist/TableCalculationWidget-CkQPrVUd.js +59 -0
  26. package/dist/TableCalculationWidget-CrqcLGfU.mjs +254 -0
  27. package/dist/TableDataWidget-7qvC3Egd.js +1 -0
  28. package/dist/TableDataWidget-DMTSoGRO.mjs +121 -0
  29. package/dist/TableOverviewCard-AFq-puJs.js +1 -0
  30. package/dist/TableOverviewCard-Ci0d4o4w.mjs +391 -0
  31. package/dist/TableResultView.vue_vue_type_script_setup_true_lang-CBn-Oxl9.mjs +534 -0
  32. package/dist/TableResultView.vue_vue_type_script_setup_true_lang-C_Lv-SmJ.js +1 -0
  33. package/dist/TableRowActionCard-BhdnnPaq.mjs +266 -0
  34. package/dist/TableRowActionCard-IzB6tNN-.js +1 -0
  35. package/dist/TableView-6mdrL3zx.js +4 -0
  36. package/dist/TableView-Du5nOE6R.mjs +8228 -0
  37. package/dist/Test-CzmOmi53.mjs +447 -0
  38. package/dist/Test-USDtNFY1.js +1 -0
  39. package/dist/UserDetail-DpUL3mhk.mjs +1483 -0
  40. package/dist/UserDetail-KRIfxaYd.js +1 -0
  41. package/dist/{agenda-BCKDYOeF.mjs → agenda-DWdbWUbb.mjs} +10 -9
  42. package/dist/agenda-r9Gl85GL.js +1 -0
  43. package/dist/cms-core-modules.css +1 -1
  44. package/dist/dateRangePresets-B-l5b_wR.mjs +48 -0
  45. package/dist/dateRangePresets-CPWqst_x.js +1 -0
  46. package/dist/fuse-Deb-Iq39.mjs +1473 -0
  47. package/dist/fuse-_CGUd5Zq.js +1 -0
  48. package/dist/{index-DU3Ib10Z.mjs → index-B_qaX29C.mjs} +7 -6
  49. package/dist/index-CQuN5rKx.js +1 -0
  50. package/dist/index-CnDGeInm.js +1 -0
  51. package/dist/index-CqDTc5Ig.mjs +20 -0
  52. package/dist/index-CyvvAdt4.js +1 -0
  53. package/dist/index-DIRD7t5_.mjs +20 -0
  54. package/dist/index-OJuBYR60.mjs +57 -0
  55. package/dist/{index-Bk3yLv_G.js → index-yHLT6gaZ.js} +3 -3
  56. package/dist/index.cjs.js +1 -1
  57. package/dist/index.mjs +671 -118
  58. package/dist/{orders-CElKNc1v.mjs → orders-BfTLIm7U.mjs} +10 -9
  59. package/dist/orders-DUa2PVoa.js +1 -0
  60. package/dist/reports-ChCsd1Gk.mjs +1107 -0
  61. package/dist/reports-DmJPm8uP.js +158 -0
  62. package/dist/row-item-C1dUyimV.mjs +204 -0
  63. package/dist/row-item-Cyo3m3MZ.js +1 -0
  64. package/dist/server-handlers.cjs.js +1 -1
  65. package/dist/server-handlers.mjs +1764 -605
  66. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +9 -3
  67. package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +2 -0
  68. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +4 -2
  69. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +9 -3
  70. package/dist/src/appointments/pages/edit/orders.vue.d.ts +9 -3
  71. package/dist/src/appointments/pages/edit/reports.vue.d.ts +229 -1
  72. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Container.d.ts +1 -1
  73. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Row.d.ts +7 -0
  74. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Stack.d.ts +7 -0
  75. package/dist/src/contentManager/components/content-editor/tiptap-extensions/helpers/resizeHistory.d.ts +9 -0
  76. package/dist/src/contentManager/components/content-editor/tiptap-menus/ElementEditorMenu.vue.d.ts +3 -1
  77. package/dist/src/firebaseAuthManager/components/DeleteUserDialog.vue.d.ts +25 -0
  78. package/dist/src/firebaseAuthManager/components/ReasonActionDialog.vue.d.ts +23 -0
  79. package/dist/src/firebaseAuthManager/components/UserStatusBadge.vue.d.ts +5 -0
  80. package/dist/src/firebaseAuthManager/config.d.ts +151 -0
  81. package/dist/src/firebaseAuthManager/index.d.ts +163 -0
  82. package/dist/src/firebaseAuthManager/index.vue.d.ts +14 -0
  83. package/dist/src/firebaseAuthManager/metadata.d.ts +2 -0
  84. package/dist/src/firebaseAuthManager/pages/Overview.vue.d.ts +2 -0
  85. package/dist/src/firebaseAuthManager/pages/UserDetail.vue.d.ts +2 -0
  86. package/dist/src/firebaseAuthManager/permissions.d.ts +5 -0
  87. package/dist/src/firebaseAuthManager/routes.d.ts +5 -0
  88. package/dist/src/firebaseAuthManager/server.d.ts +162 -0
  89. package/dist/src/firebaseAuthManager/types.d.ts +84 -0
  90. package/dist/src/formBuilder/components/FormPreviewDialog.vue.d.ts +12 -0
  91. package/dist/src/formBuilder/components/FormStatusBadge.vue.d.ts +9 -0
  92. package/dist/src/formBuilder/config.d.ts +31 -0
  93. package/dist/src/formBuilder/index.d.ts +44 -0
  94. package/dist/src/formBuilder/index.vue.d.ts +14 -0
  95. package/dist/src/formBuilder/lib/forms.d.ts +11 -0
  96. package/dist/src/formBuilder/metadata.d.ts +2 -0
  97. package/dist/src/formBuilder/pages/Editor.vue.d.ts +2 -0
  98. package/dist/src/formBuilder/pages/Overview.vue.d.ts +2 -0
  99. package/dist/src/formBuilder/permissions.d.ts +5 -0
  100. package/dist/src/formBuilder/routes.d.ts +5 -0
  101. package/dist/src/formBuilder/server.d.ts +87 -0
  102. package/dist/src/formBuilder/tools.d.ts +1 -0
  103. package/dist/src/formBuilder/types.d.ts +46 -0
  104. package/dist/src/helpbot/composables/useHelpbotApi.d.ts +18 -0
  105. package/dist/src/helpbot/config.d.ts +17 -0
  106. package/dist/src/helpbot/index.d.ts +29 -0
  107. package/dist/src/helpbot/index.vue.d.ts +2 -0
  108. package/dist/src/helpbot/metadata.d.ts +2 -0
  109. package/dist/src/helpbot/pages/Knowledge.vue.d.ts +4 -0
  110. package/dist/src/helpbot/pages/Overview.vue.d.ts +2 -0
  111. package/dist/src/helpbot/pages/Test.vue.d.ts +4 -0
  112. package/dist/src/helpbot/permissions.d.ts +5 -0
  113. package/dist/src/helpbot/routes.d.ts +5 -0
  114. package/dist/src/helpbot/types.d.ts +42 -0
  115. package/dist/src/index.d.ts +3 -0
  116. package/dist/src/server-handlers.d.ts +2 -0
  117. package/dist/src/table/chat-components/TableCalculationWidget.vue.d.ts +15 -0
  118. package/dist/src/table/chat-components/TableDataWidget.vue.d.ts +15 -0
  119. package/dist/src/table/chat-components/TableOverviewCard.vue.d.ts +61 -0
  120. package/dist/src/table/chat-components/TableResultView.vue.d.ts +48 -0
  121. package/dist/src/table/chat-components/TableRowActionCard.vue.d.ts +15 -0
  122. package/dist/src/table/components/filters/DialogTableFilterOptionItem.vue.d.ts +16 -0
  123. package/dist/src/table/components/filters/NumberComparisonFilter.vue.d.ts +12 -0
  124. package/dist/src/table/components/filters/NumberComparisonFilterSettings.vue.d.ts +12 -0
  125. package/dist/src/table/components/filters/NumberRangeFilter.vue.d.ts +12 -0
  126. package/dist/src/table/components/filters/NumberRangeFilterSettings.vue.d.ts +12 -0
  127. package/dist/src/table/components/filters/filter-utils.d.ts +14 -0
  128. package/dist/src/table/composables/useTableAgentTools.d.ts +33 -0
  129. package/dist/src/table/index.d.ts +339 -0
  130. package/dist/src/table/tool-sandbox.d.ts +13 -0
  131. package/dist/src/table/tool-utils.d.ts +11 -0
  132. package/dist/src/table/tools.d.ts +333 -1
  133. package/dist/src/table/types.d.ts +79 -0
  134. package/dist/tool-sandbox-DdkMLkDK.mjs +182 -0
  135. package/dist/tool-sandbox-DoF1PsyS.js +115 -0
  136. package/dist/types-9N-DKxNj.mjs +250 -0
  137. package/dist/types-BMraG1kN.js +1 -0
  138. package/dist/types-Cem0vPo_.js +1 -0
  139. package/dist/types-ibC3-e1N.mjs +2630 -0
  140. package/dist/useHelpbotApi-BIIungOh.js +1 -0
  141. package/dist/useHelpbotApi-HC9JSiSn.mjs +229 -0
  142. package/dist/useTableAgentTools-D5mzGf3A.js +1 -0
  143. package/dist/useTableAgentTools-DcN3kYRL.mjs +131 -0
  144. package/dist/vee-validate-zod-BQElPD0m.js +1 -0
  145. package/dist/vee-validate-zod-CN16K2x9.mjs +1780 -0
  146. package/package.json +17 -17
  147. package/src/formBuilder/tools.ts +1 -0
  148. package/src/table/tools.ts +304 -1
  149. package/dist/Detail-BCUUNWvp.js +0 -1
  150. package/dist/Detail-DGg_xXZc.js +0 -1
  151. package/dist/Detail-Sc2qZdxj.js +0 -1
  152. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BdZbcubW.js +0 -1
  153. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +0 -925
  154. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +0 -5021
  155. package/dist/TableView-Ctnep-Qu.mjs +0 -6247
  156. package/dist/TableView-DJqyJL9L.js +0 -4
  157. package/dist/agenda-B54F8cEr.js +0 -1
  158. package/dist/orders-BMosTk6r.js +0 -1
  159. package/dist/reports-BQT_GZzU.js +0 -158
  160. package/dist/reports-DksZCTOw.mjs +0 -837
  161. package/dist/vee-validate-zod-SjDT8X35.mjs +0 -4404
  162. package/dist/vee-validate-zod-VCmLnrtQ.js +0 -1
@@ -0,0 +1,742 @@
1
+ import { defineComponent as Ue, ref as c, computed as j, onMounted as Ve, resolveComponent as f, openBlock as a, createElementBlock as u, createElementVNode as l, createBlock as m, withCtx as n, createTextVNode as r, createCommentVNode as v, createVNode as s, unref as d, normalizeClass as te, toDisplayString as i, Fragment as b, renderList as J, resolveDynamicComponent as ye, withModifiers as Re, nextTick as Me } from "vue";
2
+ import { RefreshCw as Be, Clock3 as le, AlertCircle as X, Search as Le, Plus as Ce, Upload as se, BookOpen as Ee, Pencil as je, Eye as Ie, Loader2 as Y, Trash2 as Te, FileText as De, CheckCircle2 as Ke } from "lucide-vue-next";
3
+ import { t as A } from "./index-RLz1QPrf.mjs";
4
+ import { useModuleBreadcrumbs as Oe, useConfirmation as He } from "@oneclick.dev/cms-kit";
5
+ import { u as We, g as B } from "./useHelpbotApi-HC9JSiSn.mjs";
6
+ const qe = { class: "mx-auto flex w-full max-w-7xl flex-col gap-6 py-6 @3xl:py-8" }, Qe = { class: "flex flex-col gap-4 @2xl:flex-row @2xl:items-start @2xl:justify-between" }, Ge = { class: "flex items-center gap-2" }, Je = { class: "flex items-start gap-3 rounded-xl border bg-muted/30 px-4 py-3 text-sm" }, Xe = {
7
+ key: 0,
8
+ class: "flex items-start gap-3 rounded-xl border border-destructive/30 bg-destructive/5 px-4 py-3 text-sm",
9
+ role: "alert"
10
+ }, Ye = { class: "flex-1" }, Ze = { class: "mt-0.5 text-muted-foreground" }, et = { class: "flex flex-col gap-3 @2xl:flex-row @2xl:items-center @2xl:justify-between" }, tt = { class: "ml-2 rounded-full bg-background/70 px-2 py-0.5 text-[11px] tabular-nums" }, lt = { class: "ml-2 rounded-full bg-background/70 px-2 py-0.5 text-[11px] tabular-nums" }, st = { class: "flex w-full flex-col gap-2 @md:flex-row @2xl:w-auto" }, at = { class: "relative min-w-0 flex-1 @2xl:w-72" }, ot = {
11
+ key: 0,
12
+ class: "grid gap-3 @2xl:grid-cols-2"
13
+ }, nt = {
14
+ key: 1,
15
+ class: "rounded-xl border-2 border-dashed px-6 py-14 text-center"
16
+ }, it = { class: "mx-auto grid size-12 place-items-center rounded-xl bg-muted text-muted-foreground" }, ut = { class: "mt-4 font-semibold" }, rt = { class: "mx-auto mt-1 max-w-md text-sm leading-6 text-muted-foreground" }, dt = {
17
+ key: 2,
18
+ class: "grid gap-3 @2xl:grid-cols-2"
19
+ }, ct = { class: "flex min-w-0 items-start justify-between gap-3" }, mt = { class: "min-w-0" }, vt = ["title"], pt = {
20
+ key: 0,
21
+ class: "mt-1 text-xs text-muted-foreground"
22
+ }, ft = { class: "mt-3 line-clamp-2 min-h-10 text-sm leading-5 text-muted-foreground" }, xt = { class: "mt-4 flex items-center justify-end gap-1 border-t pt-3" }, gt = {
23
+ key: 0,
24
+ class: "space-y-3"
25
+ }, bt = {
26
+ key: 1,
27
+ class: "rounded-xl border-2 border-dashed px-6 py-14 text-center"
28
+ }, wt = { class: "mx-auto grid size-12 place-items-center rounded-xl bg-muted text-muted-foreground" }, _t = { class: "mt-4 font-semibold" }, ht = { class: "mx-auto mt-1 max-w-md text-sm leading-6 text-muted-foreground" }, kt = {
29
+ key: 2,
30
+ class: "space-y-3"
31
+ }, yt = { class: "flex min-w-0 flex-1 items-center gap-3" }, Ct = { class: "grid size-10 shrink-0 place-items-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400" }, Tt = { class: "min-w-0" }, Dt = ["title"], zt = { class: "mt-0.5 text-xs text-muted-foreground" }, Ft = { class: "flex items-center justify-between gap-2 @md:justify-end" }, Pt = {
32
+ key: 0,
33
+ class: "space-y-3 py-2"
34
+ }, $t = {
35
+ key: 1,
36
+ class: "space-y-4"
37
+ }, St = { class: "mt-1 font-medium" }, At = { class: "mt-2 max-h-[50vh] overflow-y-auto rounded-lg border bg-muted/20 p-4 text-sm leading-6 whitespace-pre-wrap" }, Nt = { class: "space-y-1.5" }, Ut = { class: "space-y-1.5" }, Vt = {
38
+ key: 3,
39
+ class: "flex items-start gap-2 rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",
40
+ role: "alert"
41
+ }, Rt = ["disabled"], Mt = { class: "grid size-11 place-items-center rounded-xl bg-primary/10 text-primary" }, Bt = { class: "mt-3 max-w-full truncate text-sm font-medium" }, Lt = { class: "mt-1 text-xs text-muted-foreground" }, Et = {
42
+ key: 0,
43
+ class: "flex items-start gap-2 rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",
44
+ role: "alert"
45
+ }, qt = /* @__PURE__ */ Ue({
46
+ __name: "Knowledge",
47
+ setup(jt) {
48
+ Oe(() => [{ text: "Knowledge" }]);
49
+ const { confirm: ae } = He(), h = We(), I = c("answers"), k = c(""), K = c([]), O = c([]), L = c(null), F = c(!0), H = c(""), N = c(!1), _ = c("create"), Z = c(""), C = c(""), T = c(""), W = c(!1), P = c(!1), D = c(""), E = c(!1), q = c(null), g = c(null), $ = c(!1), y = c(""), z = c(""), oe = j(
50
+ () => L.value?.permissions.canManageKnowledge === !0
51
+ ), x = j(
52
+ () => oe.value && L.value?.configured !== !1 && L.value?.connected !== !1
53
+ ), Q = j(() => k.value.trim().toLowerCase()), ne = j(() => Q.value ? K.value.filter(
54
+ (o) => `${o.title} ${o.preview}`.toLowerCase().includes(Q.value)
55
+ ) : K.value), ie = j(() => Q.value ? O.value.filter(
56
+ (o) => o.filename.toLowerCase().includes(Q.value)
57
+ ) : O.value), ue = {
58
+ available: {
59
+ label: "Available",
60
+ className: "bg-emerald-500/10 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",
61
+ icon: Ke
62
+ },
63
+ processing: {
64
+ label: "Processing",
65
+ className: "bg-amber-500/10 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300",
66
+ icon: le
67
+ },
68
+ failed: {
69
+ label: "Needs attention",
70
+ className: "bg-destructive/10 text-destructive",
71
+ icon: X
72
+ },
73
+ unknown: {
74
+ label: "Status pending",
75
+ className: "bg-muted text-muted-foreground",
76
+ icon: le
77
+ }
78
+ };
79
+ function U(o) {
80
+ return ue[o] || ue.unknown;
81
+ }
82
+ function V(o) {
83
+ if (!o) return "";
84
+ const e = new Date(o);
85
+ return Number.isNaN(e.getTime()) ? "" : new Intl.DateTimeFormat(void 0, { dateStyle: "medium" }).format(e);
86
+ }
87
+ function R(o) {
88
+ return !o || o < 1 ? "" : o < 1024 * 1024 ? `${Math.max(1, Math.round(o / 1024))} KB` : `${(o / (1024 * 1024)).toFixed(1)} MB`;
89
+ }
90
+ async function S(o = !0) {
91
+ o && (F.value = !0), H.value = "";
92
+ const [e, w, p] = await Promise.allSettled([
93
+ h.getStatus(),
94
+ h.listTexts(),
95
+ h.listFiles()
96
+ ]);
97
+ e.status === "fulfilled" && (L.value = e.value), w.status === "fulfilled" && (K.value = w.value), p.status === "fulfilled" && (O.value = p.value);
98
+ const M = [e, w, p].filter(
99
+ (ee) => ee.status === "rejected"
100
+ );
101
+ M.length && (H.value = B(
102
+ M[0].reason,
103
+ M.length === 3 ? "The helpbot knowledge could not be loaded." : "Some knowledge could not be loaded."
104
+ )), F.value = !1;
105
+ }
106
+ function re() {
107
+ x.value && (_.value = "create", Z.value = "", C.value = "", T.value = "", D.value = "", N.value = !0);
108
+ }
109
+ async function ze(o) {
110
+ _.value = x.value ? "edit" : "view", Z.value = o.title, C.value = o.title, T.value = o.content || "", D.value = "", W.value = !0, N.value = !0;
111
+ try {
112
+ const e = await h.getText(o.title);
113
+ C.value = e.title || o.title, T.value = e.content || "";
114
+ } catch (e) {
115
+ D.value = B(
116
+ e,
117
+ "This answer could not be opened."
118
+ );
119
+ } finally {
120
+ W.value = !1;
121
+ }
122
+ }
123
+ async function de() {
124
+ if (!x.value || _.value === "view") return;
125
+ const o = C.value.trim(), e = T.value.trim();
126
+ if (D.value = "", !o || !e) {
127
+ D.value = "Add both a title and an answer before saving.";
128
+ return;
129
+ }
130
+ P.value = !0;
131
+ try {
132
+ _.value === "create" ? (await h.createText(o, e), A.success("Answer added", {
133
+ description: "It will become available after processing completes."
134
+ })) : (await h.updateText(Z.value, o, e), A.success("Answer updated", {
135
+ description: "The updated answer is being prepared for the helpbot."
136
+ })), N.value = !1, await S(!1);
137
+ } catch (w) {
138
+ D.value = B(w, "The answer could not be saved.");
139
+ } finally {
140
+ P.value = !1;
141
+ }
142
+ }
143
+ async function Fe(o) {
144
+ if (!(!x.value || !await ae(
145
+ `Remove “${o.title}” from the helpbot's knowledge?`,
146
+ "Remove answer",
147
+ "Remove"
148
+ ))) {
149
+ z.value = `text:${o.title}`;
150
+ try {
151
+ await h.deleteText(o.title), A.success("Answer removed"), await S(!1);
152
+ } catch (w) {
153
+ A.error("Could not remove answer", {
154
+ description: B(w)
155
+ });
156
+ } finally {
157
+ z.value = "";
158
+ }
159
+ }
160
+ }
161
+ function ce() {
162
+ x.value && (g.value = null, y.value = "", E.value = !0, Me(() => {
163
+ q.value && (q.value.value = "");
164
+ }));
165
+ }
166
+ function Pe(o) {
167
+ const e = o.target.files?.[0] || null;
168
+ if (y.value = "", !e) {
169
+ g.value = null;
170
+ return;
171
+ }
172
+ if (!e.name.toLowerCase().endsWith(".pdf")) {
173
+ g.value = null, y.value = "Choose a PDF file.";
174
+ return;
175
+ }
176
+ if (e.size > 15 * 1024 * 1024) {
177
+ g.value = null, y.value = "Choose a PDF smaller than 15 MB.";
178
+ return;
179
+ }
180
+ g.value = e;
181
+ }
182
+ async function $e() {
183
+ if (!x.value || !g.value) {
184
+ y.value = "Choose a PDF file to upload.";
185
+ return;
186
+ }
187
+ $.value = !0, y.value = "";
188
+ try {
189
+ const o = g.value.name;
190
+ await h.uploadFile(g.value), E.value = !1, g.value = null, A.success(`${o} uploaded`, {
191
+ description: "It will become available after processing completes."
192
+ }), await S(!1);
193
+ } catch (o) {
194
+ y.value = B(o, "The PDF could not be uploaded.");
195
+ } finally {
196
+ $.value = !1;
197
+ }
198
+ }
199
+ async function Se(o) {
200
+ if (!(!x.value || !await ae(
201
+ `Remove “${o.filename}” from the helpbot's knowledge?`,
202
+ "Remove PDF",
203
+ "Remove"
204
+ ))) {
205
+ z.value = `file:${o.filename}`;
206
+ try {
207
+ await h.deleteFile(o.filename), A.success("PDF removed"), await S(!1);
208
+ } catch (w) {
209
+ A.error("Could not remove PDF", {
210
+ description: B(w)
211
+ });
212
+ } finally {
213
+ z.value = "";
214
+ }
215
+ }
216
+ }
217
+ return Ve(S), (o, e) => {
218
+ const w = f("Badge"), p = f("Button"), M = f("TabsTrigger"), ee = f("TabsList"), me = f("Input"), G = f("Skeleton"), ve = f("CardContent"), pe = f("Card"), fe = f("TabsContent"), Ae = f("Tabs"), xe = f("DialogTitle"), ge = f("DialogDescription"), be = f("DialogHeader"), Ne = f("Textarea"), we = f("DialogFooter"), _e = f("DialogContent"), he = f("Dialog");
219
+ return a(), u("main", qe, [
220
+ l("header", Qe, [
221
+ e[12] || (e[12] = l("div", { class: "max-w-2xl" }, [
222
+ l("h1", { class: "text-2xl font-semibold tracking-tight @2xl:text-3xl" }, "Knowledge"),
223
+ l("p", { class: "mt-2 text-sm leading-6 text-muted-foreground" }, " Maintain the approved answers and PDF guides your website helpbot may use. ")
224
+ ], -1)),
225
+ l("div", Ge, [
226
+ !F.value && L.value && !oe.value ? (a(), m(w, {
227
+ key: 0,
228
+ variant: "secondary"
229
+ }, {
230
+ default: n(() => [...e[11] || (e[11] = [
231
+ r(" Read only ", -1)
232
+ ])]),
233
+ _: 1
234
+ })) : v("", !0),
235
+ s(p, {
236
+ variant: "outline",
237
+ size: "icon",
238
+ disabled: F.value,
239
+ "aria-label": "Refresh knowledge",
240
+ onClick: e[0] || (e[0] = (t) => S())
241
+ }, {
242
+ default: n(() => [
243
+ s(d(Be), {
244
+ class: te(["size-4", { "animate-spin": F.value }])
245
+ }, null, 8, ["class"])
246
+ ]),
247
+ _: 1
248
+ }, 8, ["disabled"])
249
+ ])
250
+ ]),
251
+ l("div", Je, [
252
+ s(d(le), { class: "mt-0.5 size-4 shrink-0 text-primary" }),
253
+ e[13] || (e[13] = l("p", { class: "leading-6 text-muted-foreground" }, " Saved changes are processed before the helpbot can use them. Important answers should be checked in the private test after processing completes. ", -1))
254
+ ]),
255
+ H.value ? (a(), u("div", Xe, [
256
+ s(d(X), { class: "mt-0.5 size-4 shrink-0 text-destructive" }),
257
+ l("div", Ye, [
258
+ e[14] || (e[14] = l("p", { class: "font-medium" }, "Some knowledge is unavailable", -1)),
259
+ l("p", Ze, i(H.value), 1)
260
+ ]),
261
+ s(p, {
262
+ variant: "ghost",
263
+ size: "sm",
264
+ onClick: e[1] || (e[1] = (t) => S())
265
+ }, {
266
+ default: n(() => [...e[15] || (e[15] = [
267
+ r("Try again", -1)
268
+ ])]),
269
+ _: 1
270
+ })
271
+ ])) : v("", !0),
272
+ s(Ae, {
273
+ modelValue: I.value,
274
+ "onUpdate:modelValue": e[3] || (e[3] = (t) => I.value = t),
275
+ class: "min-w-0"
276
+ }, {
277
+ default: n(() => [
278
+ l("div", et, [
279
+ s(ee, { class: "grid w-full grid-cols-2 @2xl:w-[340px]" }, {
280
+ default: n(() => [
281
+ s(M, { value: "answers" }, {
282
+ default: n(() => [
283
+ e[16] || (e[16] = r(" Answers ", -1)),
284
+ l("span", tt, i(K.value.length), 1)
285
+ ]),
286
+ _: 1
287
+ }),
288
+ s(M, { value: "files" }, {
289
+ default: n(() => [
290
+ e[17] || (e[17] = r(" PDF guides ", -1)),
291
+ l("span", lt, i(O.value.length), 1)
292
+ ]),
293
+ _: 1
294
+ })
295
+ ]),
296
+ _: 1
297
+ }),
298
+ l("div", st, [
299
+ l("div", at, [
300
+ s(d(Le), { class: "pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
301
+ s(me, {
302
+ modelValue: k.value,
303
+ "onUpdate:modelValue": e[2] || (e[2] = (t) => k.value = t),
304
+ class: "pl-9",
305
+ placeholder: I.value === "answers" ? "Search answers…" : "Search PDF guides…"
306
+ }, null, 8, ["modelValue", "placeholder"])
307
+ ]),
308
+ x.value && I.value === "answers" ? (a(), m(p, {
309
+ key: 0,
310
+ class: "shrink-0",
311
+ onClick: re
312
+ }, {
313
+ default: n(() => [
314
+ s(d(Ce), { class: "mr-2 size-4" }),
315
+ e[18] || (e[18] = r(" Add answer ", -1))
316
+ ]),
317
+ _: 1
318
+ })) : x.value ? (a(), m(p, {
319
+ key: 1,
320
+ class: "shrink-0",
321
+ onClick: ce
322
+ }, {
323
+ default: n(() => [
324
+ s(d(se), { class: "mr-2 size-4" }),
325
+ e[19] || (e[19] = r(" Upload PDF ", -1))
326
+ ]),
327
+ _: 1
328
+ })) : v("", !0)
329
+ ])
330
+ ]),
331
+ s(fe, {
332
+ value: "answers",
333
+ class: "mt-5"
334
+ }, {
335
+ default: n(() => [
336
+ F.value ? (a(), u("div", ot, [
337
+ (a(), u(b, null, J(4, (t) => s(G, {
338
+ key: t,
339
+ class: "h-36 rounded-xl"
340
+ })), 64))
341
+ ])) : ne.value.length === 0 ? (a(), u("div", nt, [
342
+ l("div", it, [
343
+ s(d(Ee), { class: "size-6" })
344
+ ]),
345
+ l("h2", ut, i(k.value ? "No matching answers" : "No saved answers yet"), 1),
346
+ l("p", rt, i(k.value ? "Try a different search term." : "Add the first approved business answer for your website helpbot."), 1),
347
+ x.value && !k.value ? (a(), m(p, {
348
+ key: 0,
349
+ variant: "outline",
350
+ class: "mt-4",
351
+ onClick: re
352
+ }, {
353
+ default: n(() => [
354
+ s(d(Ce), { class: "mr-2 size-4" }),
355
+ e[20] || (e[20] = r(" Add first answer ", -1))
356
+ ]),
357
+ _: 1
358
+ })) : v("", !0)
359
+ ])) : (a(), u("div", dt, [
360
+ (a(!0), u(b, null, J(ne.value, (t) => (a(), m(pe, {
361
+ key: t.title,
362
+ class: "min-w-0"
363
+ }, {
364
+ default: n(() => [
365
+ s(ve, { class: "flex h-full flex-col p-5" }, {
366
+ default: n(() => [
367
+ l("div", ct, [
368
+ l("div", mt, [
369
+ l("h2", {
370
+ class: "truncate font-semibold",
371
+ title: t.title
372
+ }, i(t.title), 9, vt),
373
+ V(t.updatedAt) ? (a(), u("p", pt, " Updated " + i(V(t.updatedAt)), 1)) : v("", !0)
374
+ ]),
375
+ l("span", {
376
+ class: te(["inline-flex shrink-0 items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium", U(t.status).className])
377
+ }, [
378
+ (a(), m(ye(U(t.status).icon), { class: "size-3.5" })),
379
+ r(" " + i(U(t.status).label), 1)
380
+ ], 2)
381
+ ]),
382
+ l("p", ft, i(t.preview || "Open this answer to review its full content."), 1),
383
+ l("div", xt, [
384
+ s(p, {
385
+ variant: "ghost",
386
+ size: "sm",
387
+ onClick: (ke) => ze(t)
388
+ }, {
389
+ default: n(() => [
390
+ x.value ? (a(), m(d(je), {
391
+ key: 0,
392
+ class: "mr-2 size-4"
393
+ })) : (a(), m(d(Ie), {
394
+ key: 1,
395
+ class: "mr-2 size-4"
396
+ })),
397
+ r(" " + i(x.value ? "Edit" : "View"), 1)
398
+ ]),
399
+ _: 1
400
+ }, 8, ["onClick"]),
401
+ x.value ? (a(), m(p, {
402
+ key: 0,
403
+ variant: "ghost",
404
+ size: "icon",
405
+ class: "size-9 text-destructive hover:text-destructive",
406
+ disabled: z.value === `text:${t.title}`,
407
+ "aria-label": `Remove ${t.title}`,
408
+ onClick: (ke) => Fe(t)
409
+ }, {
410
+ default: n(() => [
411
+ z.value === `text:${t.title}` ? (a(), m(d(Y), {
412
+ key: 0,
413
+ class: "size-4 animate-spin"
414
+ })) : (a(), m(d(Te), {
415
+ key: 1,
416
+ class: "size-4"
417
+ }))
418
+ ]),
419
+ _: 2
420
+ }, 1032, ["disabled", "aria-label", "onClick"])) : v("", !0)
421
+ ])
422
+ ]),
423
+ _: 2
424
+ }, 1024)
425
+ ]),
426
+ _: 2
427
+ }, 1024))), 128))
428
+ ]))
429
+ ]),
430
+ _: 1
431
+ }),
432
+ s(fe, {
433
+ value: "files",
434
+ class: "mt-5"
435
+ }, {
436
+ default: n(() => [
437
+ F.value ? (a(), u("div", gt, [
438
+ (a(), u(b, null, J(3, (t) => s(G, {
439
+ key: t,
440
+ class: "h-20 rounded-xl"
441
+ })), 64))
442
+ ])) : ie.value.length === 0 ? (a(), u("div", bt, [
443
+ l("div", wt, [
444
+ s(d(De), { class: "size-6" })
445
+ ]),
446
+ l("h2", _t, i(k.value ? "No matching PDF guides" : "No PDF guides yet"), 1),
447
+ l("p", ht, i(k.value ? "Try a different filename." : "Upload approved menus, policies, product guides, or other reference documents."), 1),
448
+ x.value && !k.value ? (a(), m(p, {
449
+ key: 0,
450
+ variant: "outline",
451
+ class: "mt-4",
452
+ onClick: ce
453
+ }, {
454
+ default: n(() => [
455
+ s(d(se), { class: "mr-2 size-4" }),
456
+ e[21] || (e[21] = r(" Upload first PDF ", -1))
457
+ ]),
458
+ _: 1
459
+ })) : v("", !0)
460
+ ])) : (a(), u("div", kt, [
461
+ (a(!0), u(b, null, J(ie.value, (t) => (a(), m(pe, {
462
+ key: t.filename
463
+ }, {
464
+ default: n(() => [
465
+ s(ve, { class: "flex flex-col gap-4 p-4 @md:flex-row @md:items-center" }, {
466
+ default: n(() => [
467
+ l("div", yt, [
468
+ l("div", Ct, [
469
+ s(d(De), { class: "size-5" })
470
+ ]),
471
+ l("div", Tt, [
472
+ l("p", {
473
+ class: "truncate text-sm font-medium",
474
+ title: t.filename
475
+ }, i(t.filename), 9, Dt),
476
+ l("p", zt, [
477
+ R(t.size) ? (a(), u(b, { key: 0 }, [
478
+ r(i(R(t.size)), 1)
479
+ ], 64)) : v("", !0),
480
+ R(t.size) && t.pages ? (a(), u(b, { key: 1 }, [
481
+ r(" · ")
482
+ ], 64)) : v("", !0),
483
+ t.pages ? (a(), u(b, { key: 2 }, [
484
+ r(i(t.pages) + " page" + i(t.pages === 1 ? "" : "s"), 1)
485
+ ], 64)) : v("", !0),
486
+ (R(t.size) || t.pages) && V(t.updatedAt) ? (a(), u(b, { key: 3 }, [
487
+ r(" · ")
488
+ ], 64)) : v("", !0),
489
+ V(t.updatedAt) ? (a(), u(b, { key: 4 }, [
490
+ r("Updated " + i(V(t.updatedAt)), 1)
491
+ ], 64)) : v("", !0),
492
+ !R(t.size) && !t.pages && !V(t.updatedAt) ? (a(), u(b, { key: 5 }, [
493
+ r(" PDF guide ")
494
+ ], 64)) : v("", !0)
495
+ ])
496
+ ])
497
+ ]),
498
+ l("div", Ft, [
499
+ l("span", {
500
+ class: te(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium", U(t.status).className])
501
+ }, [
502
+ (a(), m(ye(U(t.status).icon), { class: "size-3.5" })),
503
+ r(" " + i(U(t.status).label), 1)
504
+ ], 2),
505
+ x.value ? (a(), m(p, {
506
+ key: 0,
507
+ variant: "ghost",
508
+ size: "icon",
509
+ class: "size-9 text-destructive hover:text-destructive",
510
+ disabled: z.value === `file:${t.filename}`,
511
+ "aria-label": `Remove ${t.filename}`,
512
+ onClick: (ke) => Se(t)
513
+ }, {
514
+ default: n(() => [
515
+ z.value === `file:${t.filename}` ? (a(), m(d(Y), {
516
+ key: 0,
517
+ class: "size-4 animate-spin"
518
+ })) : (a(), m(d(Te), {
519
+ key: 1,
520
+ class: "size-4"
521
+ }))
522
+ ]),
523
+ _: 2
524
+ }, 1032, ["disabled", "aria-label", "onClick"])) : v("", !0)
525
+ ])
526
+ ]),
527
+ _: 2
528
+ }, 1024)
529
+ ]),
530
+ _: 2
531
+ }, 1024))), 128))
532
+ ]))
533
+ ]),
534
+ _: 1
535
+ })
536
+ ]),
537
+ _: 1
538
+ }, 8, ["modelValue"]),
539
+ s(he, {
540
+ open: N.value,
541
+ "onUpdate:open": e[7] || (e[7] = (t) => N.value = t)
542
+ }, {
543
+ default: n(() => [
544
+ s(_e, { class: "sm:max-w-2xl" }, {
545
+ default: n(() => [
546
+ s(be, null, {
547
+ default: n(() => [
548
+ s(xe, null, {
549
+ default: n(() => [
550
+ r(i(_.value === "create" ? "Add an answer" : _.value === "edit" ? "Edit answer" : "Review answer"), 1)
551
+ ]),
552
+ _: 1
553
+ }),
554
+ s(ge, null, {
555
+ default: n(() => [
556
+ r(i(_.value === "view" ? "This approved information is available to the website helpbot." : "Write the approved information as clearly and completely as possible."), 1)
557
+ ]),
558
+ _: 1
559
+ })
560
+ ]),
561
+ _: 1
562
+ }),
563
+ W.value ? (a(), u("div", Pt, [
564
+ s(G, { class: "h-10 w-full" }),
565
+ s(G, { class: "h-56 w-full" })
566
+ ])) : _.value === "view" ? (a(), u("div", $t, [
567
+ l("div", null, [
568
+ e[22] || (e[22] = l("p", { class: "text-xs font-medium uppercase tracking-wide text-muted-foreground" }, "Topic", -1)),
569
+ l("p", St, i(C.value), 1)
570
+ ]),
571
+ l("div", null, [
572
+ e[23] || (e[23] = l("p", { class: "text-xs font-medium uppercase tracking-wide text-muted-foreground" }, "Answer", -1)),
573
+ l("div", At, i(T.value || "No answer content is available."), 1)
574
+ ])
575
+ ])) : (a(), u("form", {
576
+ key: 2,
577
+ class: "space-y-4",
578
+ onSubmit: Re(de, ["prevent"])
579
+ }, [
580
+ l("div", Nt, [
581
+ e[24] || (e[24] = l("label", {
582
+ for: "helpbot-answer-title",
583
+ class: "text-sm font-medium"
584
+ }, "Topic or question", -1)),
585
+ s(me, {
586
+ id: "helpbot-answer-title",
587
+ modelValue: C.value,
588
+ "onUpdate:modelValue": e[4] || (e[4] = (t) => C.value = t),
589
+ placeholder: "For example: Opening hours",
590
+ disabled: P.value,
591
+ maxlength: "160"
592
+ }, null, 8, ["modelValue", "disabled"]),
593
+ e[25] || (e[25] = l("p", { class: "text-xs text-muted-foreground" }, " Use a short title your team will recognize. ", -1))
594
+ ]),
595
+ l("div", Ut, [
596
+ e[26] || (e[26] = l("label", {
597
+ for: "helpbot-answer-content",
598
+ class: "text-sm font-medium"
599
+ }, "Approved answer", -1)),
600
+ s(Ne, {
601
+ id: "helpbot-answer-content",
602
+ modelValue: T.value,
603
+ "onUpdate:modelValue": e[5] || (e[5] = (t) => T.value = t),
604
+ rows: "12",
605
+ placeholder: "Write the complete, up-to-date answer visitors should receive…",
606
+ disabled: P.value,
607
+ maxlength: "500000"
608
+ }, null, 8, ["modelValue", "disabled"])
609
+ ])
610
+ ], 32)),
611
+ D.value ? (a(), u("div", Vt, [
612
+ s(d(X), { class: "mt-0.5 size-4 shrink-0" }),
613
+ l("span", null, i(D.value), 1)
614
+ ])) : v("", !0),
615
+ s(we, null, {
616
+ default: n(() => [
617
+ s(p, {
618
+ variant: "outline",
619
+ onClick: e[6] || (e[6] = (t) => N.value = !1)
620
+ }, {
621
+ default: n(() => [
622
+ r(i(_.value === "view" ? "Close" : "Cancel"), 1)
623
+ ]),
624
+ _: 1
625
+ }),
626
+ _.value !== "view" ? (a(), m(p, {
627
+ key: 0,
628
+ disabled: P.value || W.value || !C.value.trim() || !T.value.trim(),
629
+ onClick: de
630
+ }, {
631
+ default: n(() => [
632
+ P.value ? (a(), m(d(Y), {
633
+ key: 0,
634
+ class: "mr-2 size-4 animate-spin"
635
+ })) : v("", !0),
636
+ r(" " + i(P.value ? "Saving…" : "Save answer"), 1)
637
+ ]),
638
+ _: 1
639
+ }, 8, ["disabled"])) : v("", !0)
640
+ ]),
641
+ _: 1
642
+ })
643
+ ]),
644
+ _: 1
645
+ })
646
+ ]),
647
+ _: 1
648
+ }, 8, ["open"]),
649
+ s(he, {
650
+ open: E.value,
651
+ "onUpdate:open": e[10] || (e[10] = (t) => E.value = t)
652
+ }, {
653
+ default: n(() => [
654
+ s(_e, { class: "sm:max-w-lg" }, {
655
+ default: n(() => [
656
+ s(be, null, {
657
+ default: n(() => [
658
+ s(xe, null, {
659
+ default: n(() => [...e[27] || (e[27] = [
660
+ r("Upload a PDF guide", -1)
661
+ ])]),
662
+ _: 1
663
+ }),
664
+ s(ge, null, {
665
+ default: n(() => [...e[28] || (e[28] = [
666
+ r(" Choose an approved PDF up to 15 MB containing information the helpbot may use. ", -1)
667
+ ])]),
668
+ _: 1
669
+ })
670
+ ]),
671
+ _: 1
672
+ }),
673
+ l("input", {
674
+ ref_key: "uploadInput",
675
+ ref: q,
676
+ type: "file",
677
+ accept: "application/pdf,.pdf",
678
+ class: "sr-only",
679
+ onChange: Pe
680
+ }, null, 544),
681
+ l("button", {
682
+ type: "button",
683
+ class: "flex min-h-40 w-full flex-col items-center justify-center rounded-xl border-2 border-dashed p-6 text-center transition-colors hover:border-primary/50 hover:bg-muted/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
684
+ disabled: $.value,
685
+ onClick: e[8] || (e[8] = (t) => q.value?.click())
686
+ }, [
687
+ l("div", Mt, [
688
+ s(d(se), { class: "size-5" })
689
+ ]),
690
+ g.value ? (a(), u(b, { key: 0 }, [
691
+ l("span", Bt, i(g.value.name), 1),
692
+ l("span", Lt, i(R(g.value.size)) + " · Click to choose another file ", 1)
693
+ ], 64)) : (a(), u(b, { key: 1 }, [
694
+ e[29] || (e[29] = l("span", { class: "mt-3 text-sm font-medium" }, "Choose a PDF", -1)),
695
+ e[30] || (e[30] = l("span", { class: "mt-1 text-xs text-muted-foreground" }, "Click to browse your files", -1))
696
+ ], 64))
697
+ ], 8, Rt),
698
+ y.value ? (a(), u("div", Et, [
699
+ s(d(X), { class: "mt-0.5 size-4 shrink-0" }),
700
+ l("span", null, i(y.value), 1)
701
+ ])) : v("", !0),
702
+ s(we, null, {
703
+ default: n(() => [
704
+ s(p, {
705
+ variant: "outline",
706
+ disabled: $.value,
707
+ onClick: e[9] || (e[9] = (t) => E.value = !1)
708
+ }, {
709
+ default: n(() => [...e[31] || (e[31] = [
710
+ r(" Cancel ", -1)
711
+ ])]),
712
+ _: 1
713
+ }, 8, ["disabled"]),
714
+ s(p, {
715
+ disabled: $.value || !g.value,
716
+ onClick: $e
717
+ }, {
718
+ default: n(() => [
719
+ $.value ? (a(), m(d(Y), {
720
+ key: 0,
721
+ class: "mr-2 size-4 animate-spin"
722
+ })) : v("", !0),
723
+ r(" " + i($.value ? "Uploading…" : "Upload PDF"), 1)
724
+ ]),
725
+ _: 1
726
+ }, 8, ["disabled"])
727
+ ]),
728
+ _: 1
729
+ })
730
+ ]),
731
+ _: 1
732
+ })
733
+ ]),
734
+ _: 1
735
+ }, 8, ["open"])
736
+ ]);
737
+ };
738
+ }
739
+ });
740
+ export {
741
+ qt as default
742
+ };