@webx-ui/module-inbox 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FieldDialog.d.ts +5 -1
- package/dist/FormEditorPage-HsbIZcG_.js +843 -0
- package/dist/FormEditorPage-HsbIZcG_.js.map +1 -0
- package/dist/FormNotifications.d.ts +19 -13
- package/dist/{InboxPage-CCYXnZed.js → InboxPage-Dd_8TGGg.js} +2 -2
- package/dist/{InboxPage-CCYXnZed.js.map → InboxPage-Dd_8TGGg.js.map} +1 -1
- package/dist/{StatusesPage-Mra8TB7G.js → StatusesPage-DKJmpZoG.js} +2 -2
- package/dist/{StatusesPage-Mra8TB7G.js.map → StatusesPage-DKJmpZoG.js.map} +1 -1
- package/dist/{SubmissionPage-DVNKYpWH.js → SubmissionPage-BoE9jEhj.js} +176 -208
- package/dist/SubmissionPage-BoE9jEhj.js.map +1 -0
- package/dist/{index-BQj2UlUS.js → index-Dxbb2lUM.js} +691 -641
- package/dist/index-Dxbb2lUM.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +16 -3
- package/package.json +3 -3
- package/dist/FormEditorPage-BoHzlFfz.js +0 -786
- package/dist/FormEditorPage-BoHzlFfz.js.map +0 -1
- package/dist/SubmissionPage-DVNKYpWH.js.map +0 -1
- package/dist/index-BQj2UlUS.js.map +0 -1
|
@@ -0,0 +1,843 @@
|
|
|
1
|
+
import { defineComponent as D, useModel as H, computed as g, openBlock as y, createBlock as w, unref as e, withCtx as t, createVNode as l, isRef as T, createTextVNode as k, toDisplayString as _, createCommentVNode as F, mergeModels as ae, createElementBlock as N, createElementVNode as A, ref as I, onMounted as ve, Fragment as de, renderList as be, reactive as xe, watch as ye } from "vue";
|
|
2
|
+
import { useRouter as re, useRoute as ge } from "vue-router";
|
|
3
|
+
import { useTranslate as G, useAdmin as ne, emptyLink as se, WxLinkPicker as _e, WxRelationsField as he, useErrorText as ke, WxScreenHead as Ve } from "@webx-ui/module-admin";
|
|
4
|
+
import { WxCard as B, WxFormItem as W, WxSwitch as pe, WxInputNumber as ue, WxSelect as le, WxText as S, WxAlert as oe, WxAction as K, WxTable as we, toast as R, WxInput as P, WxRadioGroup as $e, WxSpace as Ue, WxButton as te, WxIcon as We, WxLink as ze, confirm as Fe, useLocales as Se, localizedValue as Ce, WxSkeleton as Te, WxBadge as Ae, WxTabs as Be, WxTab as O, WxActionBar as Ie } from "@webx-ui/core";
|
|
5
|
+
import { o as C, u as me, _ as J, a as Ne, c as ce, F as Ee } from "./index-Dxbb2lUM.js";
|
|
6
|
+
const Le = /* @__PURE__ */ D({
|
|
7
|
+
__name: "FormAntispam",
|
|
8
|
+
props: /* @__PURE__ */ ae({
|
|
9
|
+
site: {}
|
|
10
|
+
}, {
|
|
11
|
+
modelValue: { required: !0 },
|
|
12
|
+
modelModifiers: {}
|
|
13
|
+
}),
|
|
14
|
+
emits: ["update:modelValue"],
|
|
15
|
+
setup(v) {
|
|
16
|
+
const d = H(v, "modelValue"), i = v, s = G("webx-inbox"), V = C(d, "antispam.honeypot", !0), n = C(d, "antispam.min_seconds", 3), $ = C(d, "antispam.throttle", 5), r = C(d, "antispam.captcha", "off"), U = g(() => [
|
|
17
|
+
{ value: "off", label: s("panel.captcha-off") },
|
|
18
|
+
{ value: "recaptcha", label: s("panel.captcha-recaptcha") },
|
|
19
|
+
{ value: "turnstile", label: s("panel.captcha-turnstile") }
|
|
20
|
+
]), p = g(() => {
|
|
21
|
+
const m = r.value;
|
|
22
|
+
return m !== "recaptcha" && m !== "turnstile" ? null : { provider: m, site: i.site?.[m] ?? null };
|
|
23
|
+
}), c = g(() => {
|
|
24
|
+
const m = p.value?.site;
|
|
25
|
+
return m ? s(`panel.captcha-${p.value.provider}-${m.type}`) : null;
|
|
26
|
+
});
|
|
27
|
+
return (m, x) => (y(), w(e(B), null, {
|
|
28
|
+
default: t(() => [
|
|
29
|
+
l(e(W), {
|
|
30
|
+
help: e(s)("panel.honeypot-help")
|
|
31
|
+
}, {
|
|
32
|
+
default: t(() => [
|
|
33
|
+
l(e(pe), {
|
|
34
|
+
modelValue: e(V),
|
|
35
|
+
"onUpdate:modelValue": x[0] || (x[0] = (h) => T(V) ? V.value = h : null),
|
|
36
|
+
label: e(s)("panel.honeypot")
|
|
37
|
+
}, null, 8, ["modelValue", "label"])
|
|
38
|
+
]),
|
|
39
|
+
_: 1
|
|
40
|
+
}, 8, ["help"]),
|
|
41
|
+
l(e(W), {
|
|
42
|
+
label: e(s)("panel.min-seconds"),
|
|
43
|
+
help: e(s)("panel.min-seconds-help")
|
|
44
|
+
}, {
|
|
45
|
+
default: t(() => [
|
|
46
|
+
l(e(ue), {
|
|
47
|
+
modelValue: e(n),
|
|
48
|
+
"onUpdate:modelValue": x[1] || (x[1] = (h) => T(n) ? n.value = h : null),
|
|
49
|
+
min: 0,
|
|
50
|
+
max: 120
|
|
51
|
+
}, null, 8, ["modelValue"])
|
|
52
|
+
]),
|
|
53
|
+
_: 1
|
|
54
|
+
}, 8, ["label", "help"]),
|
|
55
|
+
l(e(W), {
|
|
56
|
+
label: e(s)("panel.throttle"),
|
|
57
|
+
help: e(s)("panel.throttle-help")
|
|
58
|
+
}, {
|
|
59
|
+
default: t(() => [
|
|
60
|
+
l(e(ue), {
|
|
61
|
+
modelValue: e($),
|
|
62
|
+
"onUpdate:modelValue": x[2] || (x[2] = (h) => T($) ? $.value = h : null),
|
|
63
|
+
min: 0,
|
|
64
|
+
max: 120
|
|
65
|
+
}, null, 8, ["modelValue"])
|
|
66
|
+
]),
|
|
67
|
+
_: 1
|
|
68
|
+
}, 8, ["label", "help"]),
|
|
69
|
+
l(e(W), {
|
|
70
|
+
label: e(s)("panel.captcha"),
|
|
71
|
+
help: e(s)("panel.captcha-keys")
|
|
72
|
+
}, {
|
|
73
|
+
default: t(() => [
|
|
74
|
+
l(e(le), {
|
|
75
|
+
modelValue: e(r),
|
|
76
|
+
"onUpdate:modelValue": x[3] || (x[3] = (h) => T(r) ? r.value = h : null),
|
|
77
|
+
options: U.value
|
|
78
|
+
}, null, 8, ["modelValue", "options"])
|
|
79
|
+
]),
|
|
80
|
+
_: 1
|
|
81
|
+
}, 8, ["label", "help"]),
|
|
82
|
+
c.value ? (y(), w(e(S), {
|
|
83
|
+
key: 0,
|
|
84
|
+
size: "sm",
|
|
85
|
+
tone: "muted"
|
|
86
|
+
}, {
|
|
87
|
+
default: t(() => [
|
|
88
|
+
k(_(c.value), 1)
|
|
89
|
+
]),
|
|
90
|
+
_: 1
|
|
91
|
+
})) : F("", !0),
|
|
92
|
+
p.value?.site && !p.value.site.configured ? (y(), w(e(oe), {
|
|
93
|
+
key: 1,
|
|
94
|
+
type: "warning",
|
|
95
|
+
variant: "soft",
|
|
96
|
+
closable: !1,
|
|
97
|
+
description: e(s)("panel.captcha-unconfigured")
|
|
98
|
+
}, null, 8, ["description"])) : F("", !0)
|
|
99
|
+
]),
|
|
100
|
+
_: 1
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
}), Me = { class: "wx-inbox-embed" }, qe = { class: "wx-inbox-embed__snippet" }, Oe = { class: "wx-inbox-embed__snippet" }, Re = { class: "wx-inbox-embed__snippet" }, Pe = /* @__PURE__ */ D({
|
|
104
|
+
__name: "FormEmbed",
|
|
105
|
+
props: {
|
|
106
|
+
form: {},
|
|
107
|
+
slug: {},
|
|
108
|
+
fields: {}
|
|
109
|
+
},
|
|
110
|
+
setup(v) {
|
|
111
|
+
const d = v;
|
|
112
|
+
me();
|
|
113
|
+
const i = G("webx-inbox"), s = ne(), V = g(
|
|
114
|
+
() => s.state.manifest?.modules.some((x) => x.id === "blocks") ?? !1
|
|
115
|
+
), n = g(() => `<x-webx-inbox::form slug="${d.slug}" />`), $ = g(
|
|
116
|
+
() => V.value ? n.value : `{{-- resources/views/blocks/contact.blade.php --}}
|
|
117
|
+
<x-webx-inbox::form slug="${d.slug}" />`
|
|
118
|
+
), r = g(
|
|
119
|
+
() => d.fields.find((x) => x.type === "hidden" && x.is_enabled)?.key ?? "page"
|
|
120
|
+
), U = g(
|
|
121
|
+
() => `<x-webx-inbox::form slug="${d.slug}" :values="['${r.value}' => url()->current()]" />
|
|
122
|
+
<x-webx-inbox::form slug="${d.slug}" placement="footer" />`
|
|
123
|
+
), p = g(() => [
|
|
124
|
+
{ key: "key", label: i("fields.name") },
|
|
125
|
+
{ key: "title", label: i("fields.title") },
|
|
126
|
+
{ key: "type", label: i("fields.type"), hideBelow: 520 }
|
|
127
|
+
]), c = g(() => d.fields.filter((x) => x.is_enabled));
|
|
128
|
+
async function m(x) {
|
|
129
|
+
try {
|
|
130
|
+
await navigator.clipboard.writeText(x), R.success(i("panel.copied"));
|
|
131
|
+
} catch {
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return (x, h) => (y(), N("div", Me, [
|
|
135
|
+
l(e(B), {
|
|
136
|
+
title: e(i)("panel.embed-blade")
|
|
137
|
+
}, {
|
|
138
|
+
default: t(() => [
|
|
139
|
+
l(e(S), {
|
|
140
|
+
size: "sm",
|
|
141
|
+
tone: "muted"
|
|
142
|
+
}, {
|
|
143
|
+
default: t(() => [
|
|
144
|
+
k(_(e(i)("panel.embed-blade-help")), 1)
|
|
145
|
+
]),
|
|
146
|
+
_: 1
|
|
147
|
+
}),
|
|
148
|
+
A("div", qe, [
|
|
149
|
+
A("code", null, _(n.value), 1),
|
|
150
|
+
l(e(K), {
|
|
151
|
+
icon: "copy",
|
|
152
|
+
title: e(i)("panel.copy"),
|
|
153
|
+
onClick: h[0] || (h[0] = (f) => m(n.value))
|
|
154
|
+
}, null, 8, ["title"])
|
|
155
|
+
])
|
|
156
|
+
]),
|
|
157
|
+
_: 1
|
|
158
|
+
}, 8, ["title"]),
|
|
159
|
+
l(e(B), {
|
|
160
|
+
title: e(i)("panel.embed-block")
|
|
161
|
+
}, {
|
|
162
|
+
default: t(() => [
|
|
163
|
+
l(e(S), {
|
|
164
|
+
size: "sm",
|
|
165
|
+
tone: "muted"
|
|
166
|
+
}, {
|
|
167
|
+
default: t(() => [
|
|
168
|
+
k(_(e(i)(V.value ? "panel.embed-block-panel-help" : "panel.embed-block-help")), 1)
|
|
169
|
+
]),
|
|
170
|
+
_: 1
|
|
171
|
+
}),
|
|
172
|
+
A("div", Oe, [
|
|
173
|
+
A("code", null, _($.value), 1),
|
|
174
|
+
l(e(K), {
|
|
175
|
+
icon: "copy",
|
|
176
|
+
title: e(i)("panel.copy"),
|
|
177
|
+
onClick: h[1] || (h[1] = (f) => m($.value))
|
|
178
|
+
}, null, 8, ["title"])
|
|
179
|
+
])
|
|
180
|
+
]),
|
|
181
|
+
_: 1
|
|
182
|
+
}, 8, ["title"]),
|
|
183
|
+
l(e(B), {
|
|
184
|
+
title: e(i)("panel.embed-extras")
|
|
185
|
+
}, {
|
|
186
|
+
default: t(() => [
|
|
187
|
+
l(e(S), {
|
|
188
|
+
size: "sm",
|
|
189
|
+
tone: "muted"
|
|
190
|
+
}, {
|
|
191
|
+
default: t(() => [
|
|
192
|
+
k(_(e(i)("panel.embed-extras-help")), 1)
|
|
193
|
+
]),
|
|
194
|
+
_: 1
|
|
195
|
+
}),
|
|
196
|
+
A("div", Re, [
|
|
197
|
+
A("code", null, _(U.value), 1),
|
|
198
|
+
l(e(K), {
|
|
199
|
+
icon: "copy",
|
|
200
|
+
title: e(i)("panel.copy"),
|
|
201
|
+
onClick: h[2] || (h[2] = (f) => m(U.value))
|
|
202
|
+
}, null, 8, ["title"])
|
|
203
|
+
])
|
|
204
|
+
]),
|
|
205
|
+
_: 1
|
|
206
|
+
}, 8, ["title"]),
|
|
207
|
+
l(e(B), {
|
|
208
|
+
title: e(i)("panel.embed-names")
|
|
209
|
+
}, {
|
|
210
|
+
default: t(() => [
|
|
211
|
+
l(e(S), {
|
|
212
|
+
size: "sm",
|
|
213
|
+
tone: "muted"
|
|
214
|
+
}, {
|
|
215
|
+
default: t(() => [
|
|
216
|
+
k(_(e(i)("panel.embed-names-help")), 1)
|
|
217
|
+
]),
|
|
218
|
+
_: 1
|
|
219
|
+
}),
|
|
220
|
+
l(e(we), {
|
|
221
|
+
data: c.value,
|
|
222
|
+
columns: p.value,
|
|
223
|
+
"row-key": "id",
|
|
224
|
+
flush: "",
|
|
225
|
+
"empty-text": e(i)("fields.no-fields")
|
|
226
|
+
}, {
|
|
227
|
+
"cell-key": t(({ row: f }) => [
|
|
228
|
+
l(e(S), {
|
|
229
|
+
mono: "",
|
|
230
|
+
size: "sm"
|
|
231
|
+
}, {
|
|
232
|
+
default: t(() => [
|
|
233
|
+
k("fields[" + _(f.key) + "]", 1)
|
|
234
|
+
]),
|
|
235
|
+
_: 2
|
|
236
|
+
}, 1024)
|
|
237
|
+
]),
|
|
238
|
+
"cell-title": t(({ row: f }) => [
|
|
239
|
+
k(_(Object.values(f.title)[0] ?? f.key), 1)
|
|
240
|
+
]),
|
|
241
|
+
"cell-type": t(({ row: f }) => [
|
|
242
|
+
k(_(e(i)(`fields.type-${f.type}`)), 1)
|
|
243
|
+
]),
|
|
244
|
+
_: 1
|
|
245
|
+
}, 8, ["data", "columns", "empty-text"])
|
|
246
|
+
]),
|
|
247
|
+
_: 1
|
|
248
|
+
}, 8, ["title"])
|
|
249
|
+
]));
|
|
250
|
+
}
|
|
251
|
+
}), De = /* @__PURE__ */ J(Pe, [["__scopeId", "data-v-7f9788ed"]]), Ge = { class: "wx-inbox-general" }, Ke = /* @__PURE__ */ D({
|
|
252
|
+
__name: "FormGeneral",
|
|
253
|
+
props: /* @__PURE__ */ ae({
|
|
254
|
+
errors: {}
|
|
255
|
+
}, {
|
|
256
|
+
settings: { required: !0 },
|
|
257
|
+
settingsModifiers: {},
|
|
258
|
+
options: { required: !0 },
|
|
259
|
+
optionsModifiers: {}
|
|
260
|
+
}),
|
|
261
|
+
emits: ["update:settings", "update:options"],
|
|
262
|
+
setup(v) {
|
|
263
|
+
const d = H(
|
|
264
|
+
v,
|
|
265
|
+
"settings"
|
|
266
|
+
), i = H(v, "options"), s = G("webx-inbox"), V = C(i, "thank-you.heading", {}), n = C(i, "thank-you.text", {}), $ = C(i, "design.submit-text", {}), r = C(i, "redirect", null), U = g({
|
|
267
|
+
get: () => {
|
|
268
|
+
const p = r.value;
|
|
269
|
+
return typeof p == "string" ? { ...se(), target: "url", url: p } : p ?? { ...se(), target: "none" };
|
|
270
|
+
},
|
|
271
|
+
set: (p) => {
|
|
272
|
+
r.value = p === null || p.target === "none" ? null : p;
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
return (p, c) => (y(), N("div", Ge, [
|
|
276
|
+
l(e(B), null, {
|
|
277
|
+
default: t(() => [
|
|
278
|
+
l(e(W), {
|
|
279
|
+
label: e(s)("panel.title"),
|
|
280
|
+
error: v.errors.title?.[0],
|
|
281
|
+
required: ""
|
|
282
|
+
}, {
|
|
283
|
+
default: t(() => [
|
|
284
|
+
l(e(P), {
|
|
285
|
+
modelValue: d.value.title,
|
|
286
|
+
"onUpdate:modelValue": c[0] || (c[0] = (m) => d.value.title = m),
|
|
287
|
+
localized: ""
|
|
288
|
+
}, null, 8, ["modelValue"])
|
|
289
|
+
]),
|
|
290
|
+
_: 1
|
|
291
|
+
}, 8, ["label", "error"]),
|
|
292
|
+
l(e(W), {
|
|
293
|
+
label: e(s)("panel.slug"),
|
|
294
|
+
help: e(s)("panel.slug-help"),
|
|
295
|
+
error: v.errors.slug?.[0],
|
|
296
|
+
required: ""
|
|
297
|
+
}, {
|
|
298
|
+
default: t(() => [
|
|
299
|
+
l(e(P), {
|
|
300
|
+
modelValue: d.value.slug,
|
|
301
|
+
"onUpdate:modelValue": c[1] || (c[1] = (m) => d.value.slug = m),
|
|
302
|
+
placeholder: "contact"
|
|
303
|
+
}, null, 8, ["modelValue"])
|
|
304
|
+
]),
|
|
305
|
+
_: 1
|
|
306
|
+
}, 8, ["label", "help", "error"]),
|
|
307
|
+
l(e(W), {
|
|
308
|
+
help: e(s)("panel.is-enabled-help")
|
|
309
|
+
}, {
|
|
310
|
+
default: t(() => [
|
|
311
|
+
l(e(pe), {
|
|
312
|
+
modelValue: d.value.is_enabled,
|
|
313
|
+
"onUpdate:modelValue": c[2] || (c[2] = (m) => d.value.is_enabled = m),
|
|
314
|
+
label: e(s)("panel.is-enabled")
|
|
315
|
+
}, null, 8, ["modelValue", "label"])
|
|
316
|
+
]),
|
|
317
|
+
_: 1
|
|
318
|
+
}, 8, ["help"])
|
|
319
|
+
]),
|
|
320
|
+
_: 1
|
|
321
|
+
}),
|
|
322
|
+
l(e(B), {
|
|
323
|
+
title: e(s)("panel.after-sending")
|
|
324
|
+
}, {
|
|
325
|
+
default: t(() => [
|
|
326
|
+
l(e(W), {
|
|
327
|
+
label: e(s)("panel.submit-text")
|
|
328
|
+
}, {
|
|
329
|
+
default: t(() => [
|
|
330
|
+
l(e(P), {
|
|
331
|
+
modelValue: e($),
|
|
332
|
+
"onUpdate:modelValue": c[3] || (c[3] = (m) => T($) ? $.value = m : null),
|
|
333
|
+
localized: ""
|
|
334
|
+
}, null, 8, ["modelValue"])
|
|
335
|
+
]),
|
|
336
|
+
_: 1
|
|
337
|
+
}, 8, ["label"]),
|
|
338
|
+
l(e(W), {
|
|
339
|
+
label: e(s)("panel.thank-you-heading")
|
|
340
|
+
}, {
|
|
341
|
+
default: t(() => [
|
|
342
|
+
l(e(P), {
|
|
343
|
+
modelValue: e(V),
|
|
344
|
+
"onUpdate:modelValue": c[4] || (c[4] = (m) => T(V) ? V.value = m : null),
|
|
345
|
+
localized: ""
|
|
346
|
+
}, null, 8, ["modelValue"])
|
|
347
|
+
]),
|
|
348
|
+
_: 1
|
|
349
|
+
}, 8, ["label"]),
|
|
350
|
+
l(e(W), {
|
|
351
|
+
label: e(s)("panel.thank-you-text")
|
|
352
|
+
}, {
|
|
353
|
+
default: t(() => [
|
|
354
|
+
l(Ne, {
|
|
355
|
+
modelValue: e(n),
|
|
356
|
+
"onUpdate:modelValue": c[5] || (c[5] = (m) => T(n) ? n.value = m : null)
|
|
357
|
+
}, null, 8, ["modelValue"])
|
|
358
|
+
]),
|
|
359
|
+
_: 1
|
|
360
|
+
}, 8, ["label"]),
|
|
361
|
+
l(e(W), {
|
|
362
|
+
label: e(s)("panel.redirect"),
|
|
363
|
+
help: e(s)("panel.redirect-help"),
|
|
364
|
+
error: v.errors["options.redirect"]?.[0]
|
|
365
|
+
}, {
|
|
366
|
+
default: t(() => [
|
|
367
|
+
l(e(_e), {
|
|
368
|
+
modelValue: U.value,
|
|
369
|
+
"onUpdate:modelValue": c[6] || (c[6] = (m) => U.value = m),
|
|
370
|
+
attributes: !1
|
|
371
|
+
}, null, 8, ["modelValue"])
|
|
372
|
+
]),
|
|
373
|
+
_: 1
|
|
374
|
+
}, 8, ["label", "help", "error"])
|
|
375
|
+
]),
|
|
376
|
+
_: 1
|
|
377
|
+
}, 8, ["title"])
|
|
378
|
+
]));
|
|
379
|
+
}
|
|
380
|
+
}), je = /* @__PURE__ */ J(Ke, [["__scopeId", "data-v-27d224bf"]]), He = /^[^\s@]+@[^\s@]+$/;
|
|
381
|
+
function j(v) {
|
|
382
|
+
return "admin_id" in v;
|
|
383
|
+
}
|
|
384
|
+
function fe(v, d = []) {
|
|
385
|
+
return j(v) ? d.find(
|
|
386
|
+
(s) => s.type === "admin" && s.admin_id === v.admin_id
|
|
387
|
+
)?.problem ?? null : He.test((v.email ?? "").trim()) ? null : "invalid_email";
|
|
388
|
+
}
|
|
389
|
+
function Je(v, d = []) {
|
|
390
|
+
return (v ?? []).some((i) => fe(i, d) === null);
|
|
391
|
+
}
|
|
392
|
+
const Qe = {
|
|
393
|
+
key: 1,
|
|
394
|
+
class: "wx-inbox-notifications__way",
|
|
395
|
+
"data-way": "email"
|
|
396
|
+
}, Xe = { class: "wx-inbox-recipients" }, Ye = { class: "wx-inbox-recipients__row" }, Ze = {
|
|
397
|
+
key: 2,
|
|
398
|
+
class: "wx-inbox-notifications__way",
|
|
399
|
+
"data-way": "channels"
|
|
400
|
+
}, el = { class: "wx-inbox-channels" }, ll = /* @__PURE__ */ D({
|
|
401
|
+
__name: "FormNotifications",
|
|
402
|
+
props: /* @__PURE__ */ ae({
|
|
403
|
+
fields: {},
|
|
404
|
+
errors: {},
|
|
405
|
+
reported: {},
|
|
406
|
+
notifications: { type: Boolean },
|
|
407
|
+
via: {}
|
|
408
|
+
}, {
|
|
409
|
+
modelValue: { required: !0 },
|
|
410
|
+
modelModifiers: {}
|
|
411
|
+
}),
|
|
412
|
+
emits: ["update:modelValue"],
|
|
413
|
+
setup(v) {
|
|
414
|
+
const d = v, i = H(v, "modelValue"), s = ne(), V = ce(s), n = G("webx-inbox"), $ = I([]), r = C(i, "recipients", []), U = C(i, "email_field", ""), p = C(i, "notify_channels", []), c = g({
|
|
415
|
+
get: () => i.value.notify_via ?? d.via ?? "email",
|
|
416
|
+
set: (u) => {
|
|
417
|
+
i.value = { ...i.value, notify_via: u };
|
|
418
|
+
}
|
|
419
|
+
}), m = g(() => [
|
|
420
|
+
{ value: "email", label: n("panel.via-email") },
|
|
421
|
+
{ value: "channels", label: n("panel.via-channels") }
|
|
422
|
+
]), x = g(() => !d.notifications || c.value === "email"), h = re(), f = g(() => s.can("notifications.manage")), z = g(() => `${s.basePath}/notifications`.replace(/\/{2,}/g, "/"));
|
|
423
|
+
function ie(u) {
|
|
424
|
+
u.metaKey || u.ctrlKey || u.shiftKey || u.button !== 0 || (u.preventDefault(), h.push("/notifications"));
|
|
425
|
+
}
|
|
426
|
+
ve(async () => {
|
|
427
|
+
try {
|
|
428
|
+
$.value = await V.recipients();
|
|
429
|
+
} catch {
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
const L = g(
|
|
433
|
+
() => $.value.map((u) => ({ value: u.id, label: `${u.name} · ${u.email}` }))
|
|
434
|
+
), Q = g(() => [
|
|
435
|
+
{ value: "", label: n("panel.no-email-field") },
|
|
436
|
+
...d.fields.filter((u) => u.type === "email").map((u) => ({ value: u.key, label: X(u) }))
|
|
437
|
+
]);
|
|
438
|
+
function X(u) {
|
|
439
|
+
const a = Object.values(u.title ?? {}).find(
|
|
440
|
+
(o) => typeof o == "string" && o.trim() !== ""
|
|
441
|
+
);
|
|
442
|
+
return a === void 0 ? u.name ?? u.key : u.name ? `${a} · ${u.name}` : a;
|
|
443
|
+
}
|
|
444
|
+
function q(u) {
|
|
445
|
+
if (!j(u)) return null;
|
|
446
|
+
const a = fe(u, d.reported);
|
|
447
|
+
return a === null ? null : n(`panel.recipient-${a}`);
|
|
448
|
+
}
|
|
449
|
+
function E(u) {
|
|
450
|
+
r.value = [...r.value, u];
|
|
451
|
+
}
|
|
452
|
+
async function Y(u) {
|
|
453
|
+
const a = r.value[u];
|
|
454
|
+
a !== void 0 && (j(a) || (a.email ?? "").trim() !== "") && !await Fe({
|
|
455
|
+
title: n("panel.remove-recipient-title"),
|
|
456
|
+
message: n("panel.remove-recipient-text"),
|
|
457
|
+
confirmText: n("panel.remove"),
|
|
458
|
+
cancelText: n("panel.cancel"),
|
|
459
|
+
tone: "danger"
|
|
460
|
+
}) || (r.value = r.value.filter((b, M) => M !== u));
|
|
461
|
+
}
|
|
462
|
+
function Z(u, a) {
|
|
463
|
+
r.value = r.value.map((o, b) => b === u ? { admin_id: a } : o);
|
|
464
|
+
}
|
|
465
|
+
function ee(u, a) {
|
|
466
|
+
r.value = r.value.map((o, b) => b === u ? { email: a } : o);
|
|
467
|
+
}
|
|
468
|
+
return (u, a) => (y(), w(e(B), {
|
|
469
|
+
class: "wx-inbox-notifications",
|
|
470
|
+
title: d.notifications ? void 0 : e(n)("panel.recipients")
|
|
471
|
+
}, {
|
|
472
|
+
default: t(() => [
|
|
473
|
+
l(e(W), {
|
|
474
|
+
label: e(n)("panel.email-field"),
|
|
475
|
+
help: d.notifications ? e(n)("panel.email-field-help-channels") : e(n)("panel.email-field-help"),
|
|
476
|
+
error: v.errors["options.email_field"]?.[0]
|
|
477
|
+
}, {
|
|
478
|
+
default: t(() => [
|
|
479
|
+
l(e(le), {
|
|
480
|
+
modelValue: e(U),
|
|
481
|
+
"onUpdate:modelValue": a[0] || (a[0] = (o) => T(U) ? U.value = o : null),
|
|
482
|
+
options: Q.value
|
|
483
|
+
}, null, 8, ["modelValue", "options"])
|
|
484
|
+
]),
|
|
485
|
+
_: 1
|
|
486
|
+
}, 8, ["label", "help", "error"]),
|
|
487
|
+
d.notifications ? (y(), w(e(W), {
|
|
488
|
+
key: 0,
|
|
489
|
+
label: e(n)("panel.notify-via")
|
|
490
|
+
}, {
|
|
491
|
+
default: t(() => [
|
|
492
|
+
l(e($e), {
|
|
493
|
+
modelValue: c.value,
|
|
494
|
+
"onUpdate:modelValue": a[1] || (a[1] = (o) => c.value = o),
|
|
495
|
+
options: m.value,
|
|
496
|
+
inline: ""
|
|
497
|
+
}, null, 8, ["modelValue", "options"])
|
|
498
|
+
]),
|
|
499
|
+
_: 1
|
|
500
|
+
}, 8, ["label"])) : F("", !0),
|
|
501
|
+
x.value ? (y(), N("section", Qe, [
|
|
502
|
+
d.notifications ? (y(), w(e(S), {
|
|
503
|
+
key: 0,
|
|
504
|
+
weight: "medium"
|
|
505
|
+
}, {
|
|
506
|
+
default: t(() => [
|
|
507
|
+
k(_(e(n)("panel.recipients")), 1)
|
|
508
|
+
]),
|
|
509
|
+
_: 1
|
|
510
|
+
})) : F("", !0),
|
|
511
|
+
l(e(S), {
|
|
512
|
+
size: "sm",
|
|
513
|
+
tone: "muted"
|
|
514
|
+
}, {
|
|
515
|
+
default: t(() => [
|
|
516
|
+
k(_(e(n)("panel.recipients-help")), 1)
|
|
517
|
+
]),
|
|
518
|
+
_: 1
|
|
519
|
+
}),
|
|
520
|
+
v.errors["options.recipients"] ? (y(), w(e(oe), {
|
|
521
|
+
key: 1,
|
|
522
|
+
type: "danger",
|
|
523
|
+
variant: "soft",
|
|
524
|
+
description: v.errors["options.recipients"]?.[0]
|
|
525
|
+
}, null, 8, ["description"])) : F("", !0),
|
|
526
|
+
A("div", Xe, [
|
|
527
|
+
e(r).length === 0 ? (y(), w(e(S), {
|
|
528
|
+
key: 0,
|
|
529
|
+
size: "sm",
|
|
530
|
+
tone: "placeholder"
|
|
531
|
+
}, {
|
|
532
|
+
default: t(() => [
|
|
533
|
+
k(_(e(n)("panel.no-recipients")), 1)
|
|
534
|
+
]),
|
|
535
|
+
_: 1
|
|
536
|
+
})) : F("", !0),
|
|
537
|
+
(y(!0), N(de, null, be(e(r), (o, b) => (y(), N("div", {
|
|
538
|
+
key: b,
|
|
539
|
+
class: "wx-inbox-recipients__item"
|
|
540
|
+
}, [
|
|
541
|
+
A("div", Ye, [
|
|
542
|
+
e(j)(o) ? (y(), w(e(le), {
|
|
543
|
+
key: 0,
|
|
544
|
+
"model-value": o.admin_id,
|
|
545
|
+
options: L.value,
|
|
546
|
+
"onUpdate:modelValue": (M) => Z(b, Number(M))
|
|
547
|
+
}, null, 8, ["model-value", "options", "onUpdate:modelValue"])) : (y(), w(e(P), {
|
|
548
|
+
key: 1,
|
|
549
|
+
"model-value": o.email,
|
|
550
|
+
type: "email",
|
|
551
|
+
placeholder: "sales@example.com",
|
|
552
|
+
"onUpdate:modelValue": (M) => ee(b, String(M))
|
|
553
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])),
|
|
554
|
+
l(e(K), {
|
|
555
|
+
icon: "trash",
|
|
556
|
+
tone: "danger",
|
|
557
|
+
title: e(n)("panel.remove"),
|
|
558
|
+
onClick: (M) => Y(b)
|
|
559
|
+
}, null, 8, ["title", "onClick"])
|
|
560
|
+
]),
|
|
561
|
+
q(o) ? (y(), w(e(S), {
|
|
562
|
+
key: 0,
|
|
563
|
+
size: "sm",
|
|
564
|
+
tone: "danger"
|
|
565
|
+
}, {
|
|
566
|
+
default: t(() => [
|
|
567
|
+
k(_(q(o)), 1)
|
|
568
|
+
]),
|
|
569
|
+
_: 2
|
|
570
|
+
}, 1024)) : F("", !0)
|
|
571
|
+
]))), 128))
|
|
572
|
+
]),
|
|
573
|
+
l(e(Ue), { size: "sm" }, {
|
|
574
|
+
default: t(() => [
|
|
575
|
+
l(e(te), {
|
|
576
|
+
variant: "outline",
|
|
577
|
+
icon: "user",
|
|
578
|
+
disabled: L.value.length === 0,
|
|
579
|
+
onClick: a[2] || (a[2] = (o) => E({ admin_id: Number(L.value[0]?.value) }))
|
|
580
|
+
}, {
|
|
581
|
+
default: t(() => [
|
|
582
|
+
k(_(e(n)("panel.add-admin")), 1)
|
|
583
|
+
]),
|
|
584
|
+
_: 1
|
|
585
|
+
}, 8, ["disabled"]),
|
|
586
|
+
l(e(te), {
|
|
587
|
+
variant: "outline",
|
|
588
|
+
onClick: a[3] || (a[3] = (o) => E({ email: "" }))
|
|
589
|
+
}, {
|
|
590
|
+
icon: t(() => [
|
|
591
|
+
l(e(We), { name: "mail" })
|
|
592
|
+
]),
|
|
593
|
+
default: t(() => [
|
|
594
|
+
k(" " + _(e(n)("panel.add-email")), 1)
|
|
595
|
+
]),
|
|
596
|
+
_: 1
|
|
597
|
+
})
|
|
598
|
+
]),
|
|
599
|
+
_: 1
|
|
600
|
+
})
|
|
601
|
+
])) : (y(), N("section", Ze, [
|
|
602
|
+
l(e(S), { weight: "medium" }, {
|
|
603
|
+
default: t(() => [
|
|
604
|
+
k(_(e(n)("panel.notify-through")), 1)
|
|
605
|
+
]),
|
|
606
|
+
_: 1
|
|
607
|
+
}),
|
|
608
|
+
l(e(S), {
|
|
609
|
+
size: "sm",
|
|
610
|
+
tone: "muted"
|
|
611
|
+
}, {
|
|
612
|
+
default: t(() => [
|
|
613
|
+
k(_(e(n)("panel.notify-through-help")), 1)
|
|
614
|
+
]),
|
|
615
|
+
_: 1
|
|
616
|
+
}),
|
|
617
|
+
A("div", el, [
|
|
618
|
+
l(e(he), {
|
|
619
|
+
modelValue: e(p),
|
|
620
|
+
"onUpdate:modelValue": a[4] || (a[4] = (o) => T(p) ? p.value = o : null),
|
|
621
|
+
target: "notify-inbox-submission",
|
|
622
|
+
sortable: !1,
|
|
623
|
+
"add-text": e(n)("panel.pick-channels"),
|
|
624
|
+
"empty-text": e(n)("panel.no-channels"),
|
|
625
|
+
"none-text": e(n)("panel.no-channels-yet")
|
|
626
|
+
}, null, 8, ["modelValue", "add-text", "empty-text", "none-text"]),
|
|
627
|
+
f.value ? (y(), w(e(ze), {
|
|
628
|
+
key: 0,
|
|
629
|
+
href: z.value,
|
|
630
|
+
size: "sm",
|
|
631
|
+
onClick: ie
|
|
632
|
+
}, {
|
|
633
|
+
default: t(() => [
|
|
634
|
+
k(_(e(n)("panel.set-up-channels")), 1)
|
|
635
|
+
]),
|
|
636
|
+
_: 1
|
|
637
|
+
}, 8, ["href"])) : F("", !0)
|
|
638
|
+
])
|
|
639
|
+
]))
|
|
640
|
+
]),
|
|
641
|
+
_: 1
|
|
642
|
+
}, 8, ["title"]));
|
|
643
|
+
}
|
|
644
|
+
}), tl = /* @__PURE__ */ J(ll, [["__scopeId", "data-v-bbb57f10"]]), al = { class: "wx-inbox-editor" }, nl = /* @__PURE__ */ D({
|
|
645
|
+
__name: "FormEditorPage",
|
|
646
|
+
props: {
|
|
647
|
+
base: { default: "/inbox" }
|
|
648
|
+
},
|
|
649
|
+
setup(v) {
|
|
650
|
+
const d = v, i = ne(), s = ce(i), V = ge(), n = re(), $ = Se();
|
|
651
|
+
me();
|
|
652
|
+
const r = G("webx-inbox"), U = ke(), p = I(null), c = I([]), m = I(!0), x = I(!1), h = I({});
|
|
653
|
+
let f = xe({
|
|
654
|
+
slug: "",
|
|
655
|
+
title: {},
|
|
656
|
+
is_enabled: !0
|
|
657
|
+
});
|
|
658
|
+
const z = I({}), L = I(["general", "fields", "notifications", "antispam", "embed"].includes(String(V.query.tab)) ? String(V.query.tab) : "general"), Q = g(
|
|
659
|
+
() => f.is_enabled && !Je(z.value.recipients, p.value?.recipients) && !X.value
|
|
660
|
+
), X = g(() => {
|
|
661
|
+
if (p.value?.notifications !== !0) return !1;
|
|
662
|
+
const a = p.value.channels ?? [];
|
|
663
|
+
return (z.value.notify_channels ?? []).some(
|
|
664
|
+
(o) => a.find((b) => b.id === o)?.sends ?? !0
|
|
665
|
+
);
|
|
666
|
+
}), q = g(() => i.can("inbox.manage")), E = g(() => Number(V.params.id)), Y = g(
|
|
667
|
+
() => p.value === null ? "" : Ce(f.title, $.active.value, f.slug)
|
|
668
|
+
), Z = g(() => `${d.base}?form=${E.value}`);
|
|
669
|
+
async function ee() {
|
|
670
|
+
m.value = !0;
|
|
671
|
+
try {
|
|
672
|
+
const a = await s.form(E.value);
|
|
673
|
+
p.value = a, c.value = a.fields ?? [], f.slug = a.slug, f.title = { ...a.title }, f.is_enabled = a.is_enabled, z.value = { ...a.options };
|
|
674
|
+
} catch (a) {
|
|
675
|
+
R.danger(U(a)), n.replace(d.base);
|
|
676
|
+
} finally {
|
|
677
|
+
m.value = !1;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
ye(E, () => {
|
|
681
|
+
ee();
|
|
682
|
+
}, { immediate: !0 });
|
|
683
|
+
async function u() {
|
|
684
|
+
x.value = !0, h.value = {};
|
|
685
|
+
try {
|
|
686
|
+
const a = await s.saveForm(E.value, {
|
|
687
|
+
slug: f.slug.trim(),
|
|
688
|
+
title: f.title,
|
|
689
|
+
is_enabled: f.is_enabled,
|
|
690
|
+
options: z.value
|
|
691
|
+
});
|
|
692
|
+
p.value = a, R.success(r("panel.saved"));
|
|
693
|
+
} catch (a) {
|
|
694
|
+
const o = a.body;
|
|
695
|
+
o?.errors ? (h.value = o.errors, R.danger(r("panel.failed"))) : R.danger(U(a));
|
|
696
|
+
} finally {
|
|
697
|
+
x.value = !1;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return (a, o) => (y(), N("div", al, [
|
|
701
|
+
m.value ? (y(), w(e(B), { key: 0 }, {
|
|
702
|
+
default: t(() => [
|
|
703
|
+
l(e(Te), {
|
|
704
|
+
title: "",
|
|
705
|
+
rows: 8
|
|
706
|
+
})
|
|
707
|
+
]),
|
|
708
|
+
_: 1
|
|
709
|
+
})) : p.value ? (y(), N(de, { key: 1 }, [
|
|
710
|
+
l(e(Ve), {
|
|
711
|
+
class: "wx-inbox-editor__head",
|
|
712
|
+
title: Y.value,
|
|
713
|
+
subtitle: p.value.slug,
|
|
714
|
+
back: Z.value,
|
|
715
|
+
"back-label": e(r)("panel.forms")
|
|
716
|
+
}, {
|
|
717
|
+
"title-after": t(() => [
|
|
718
|
+
e(f).is_enabled ? F("", !0) : (y(), w(e(Ae), {
|
|
719
|
+
key: 0,
|
|
720
|
+
type: "default"
|
|
721
|
+
}, {
|
|
722
|
+
default: t(() => [
|
|
723
|
+
k(_(e(r)("panel.off")), 1)
|
|
724
|
+
]),
|
|
725
|
+
_: 1
|
|
726
|
+
}))
|
|
727
|
+
]),
|
|
728
|
+
_: 1
|
|
729
|
+
}, 8, ["title", "subtitle", "back", "back-label"]),
|
|
730
|
+
Q.value ? (y(), w(e(oe), {
|
|
731
|
+
key: 0,
|
|
732
|
+
class: "wx-inbox-editor__silent",
|
|
733
|
+
type: "warning",
|
|
734
|
+
variant: "soft",
|
|
735
|
+
closable: !1,
|
|
736
|
+
title: e(r)("panel.notifies-nobody"),
|
|
737
|
+
description: e(r)("panel.notifies-nobody-text")
|
|
738
|
+
}, null, 8, ["title", "description"])) : F("", !0),
|
|
739
|
+
l(e(Be), {
|
|
740
|
+
modelValue: L.value,
|
|
741
|
+
"onUpdate:modelValue": o[5] || (o[5] = (b) => L.value = b),
|
|
742
|
+
class: "wx-inbox-editor__tabs",
|
|
743
|
+
"keep-alive": ""
|
|
744
|
+
}, {
|
|
745
|
+
default: t(() => [
|
|
746
|
+
l(e(O), {
|
|
747
|
+
value: "general",
|
|
748
|
+
label: e(r)("panel.tab-general")
|
|
749
|
+
}, {
|
|
750
|
+
default: t(() => [
|
|
751
|
+
l(je, {
|
|
752
|
+
settings: e(f),
|
|
753
|
+
"onUpdate:settings": o[0] || (o[0] = (b) => T(f) ? f.value = b : f = b),
|
|
754
|
+
options: z.value,
|
|
755
|
+
"onUpdate:options": o[1] || (o[1] = (b) => z.value = b),
|
|
756
|
+
errors: h.value
|
|
757
|
+
}, null, 8, ["settings", "options", "errors"])
|
|
758
|
+
]),
|
|
759
|
+
_: 1
|
|
760
|
+
}, 8, ["label"]),
|
|
761
|
+
l(e(O), {
|
|
762
|
+
value: "fields",
|
|
763
|
+
label: e(r)("panel.tab-fields")
|
|
764
|
+
}, {
|
|
765
|
+
default: t(() => [
|
|
766
|
+
l(Ee, {
|
|
767
|
+
modelValue: c.value,
|
|
768
|
+
"onUpdate:modelValue": o[2] || (o[2] = (b) => c.value = b),
|
|
769
|
+
form: p.value,
|
|
770
|
+
"can-manage": q.value
|
|
771
|
+
}, null, 8, ["modelValue", "form", "can-manage"])
|
|
772
|
+
]),
|
|
773
|
+
_: 1
|
|
774
|
+
}, 8, ["label"]),
|
|
775
|
+
l(e(O), {
|
|
776
|
+
value: "notifications",
|
|
777
|
+
label: e(r)("panel.tab-notifications")
|
|
778
|
+
}, {
|
|
779
|
+
default: t(() => [
|
|
780
|
+
l(tl, {
|
|
781
|
+
modelValue: z.value,
|
|
782
|
+
"onUpdate:modelValue": o[3] || (o[3] = (b) => z.value = b),
|
|
783
|
+
fields: c.value,
|
|
784
|
+
errors: h.value,
|
|
785
|
+
reported: p.value.recipients,
|
|
786
|
+
notifications: p.value.notifications,
|
|
787
|
+
via: p.value.notify_via
|
|
788
|
+
}, null, 8, ["modelValue", "fields", "errors", "reported", "notifications", "via"])
|
|
789
|
+
]),
|
|
790
|
+
_: 1
|
|
791
|
+
}, 8, ["label"]),
|
|
792
|
+
l(e(O), {
|
|
793
|
+
value: "antispam",
|
|
794
|
+
label: e(r)("panel.tab-antispam")
|
|
795
|
+
}, {
|
|
796
|
+
default: t(() => [
|
|
797
|
+
l(Le, {
|
|
798
|
+
modelValue: z.value,
|
|
799
|
+
"onUpdate:modelValue": o[4] || (o[4] = (b) => z.value = b),
|
|
800
|
+
site: p.value.captcha
|
|
801
|
+
}, null, 8, ["modelValue", "site"])
|
|
802
|
+
]),
|
|
803
|
+
_: 1
|
|
804
|
+
}, 8, ["label"]),
|
|
805
|
+
l(e(O), {
|
|
806
|
+
value: "embed",
|
|
807
|
+
label: e(r)("panel.tab-embed")
|
|
808
|
+
}, {
|
|
809
|
+
default: t(() => [
|
|
810
|
+
l(De, {
|
|
811
|
+
form: p.value,
|
|
812
|
+
slug: e(f).slug,
|
|
813
|
+
fields: c.value
|
|
814
|
+
}, null, 8, ["form", "slug", "fields"])
|
|
815
|
+
]),
|
|
816
|
+
_: 1
|
|
817
|
+
}, 8, ["label"])
|
|
818
|
+
]),
|
|
819
|
+
_: 1
|
|
820
|
+
}, 8, ["modelValue"]),
|
|
821
|
+
q.value ? (y(), w(e(Ie), { key: 1 }, {
|
|
822
|
+
default: t(() => [
|
|
823
|
+
l(e(te), {
|
|
824
|
+
type: "primary",
|
|
825
|
+
loading: x.value,
|
|
826
|
+
onClick: u
|
|
827
|
+
}, {
|
|
828
|
+
default: t(() => [
|
|
829
|
+
k(_(e(r)("panel.save")), 1)
|
|
830
|
+
]),
|
|
831
|
+
_: 1
|
|
832
|
+
}, 8, ["loading"])
|
|
833
|
+
]),
|
|
834
|
+
_: 1
|
|
835
|
+
})) : F("", !0)
|
|
836
|
+
], 64)) : F("", !0)
|
|
837
|
+
]));
|
|
838
|
+
}
|
|
839
|
+
}), rl = /* @__PURE__ */ J(nl, [["__scopeId", "data-v-e9102f38"]]);
|
|
840
|
+
export {
|
|
841
|
+
rl as default
|
|
842
|
+
};
|
|
843
|
+
//# sourceMappingURL=FormEditorPage-HsbIZcG_.js.map
|