@webx-ui/module-inbox 0.7.0 → 0.8.1

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/index.js CHANGED
@@ -1,3796 +1,18 @@
1
- import { defineComponent as ae, useModel as Ve, computed as x, unref as e, openBlock as o, createBlock as y, withCtx as a, createVNode as t, mergeModels as Ce, inject as _l, ref as F, watch as Te, isRef as se, createElementVNode as L, createElementBlock as D, Fragment as Q, createCommentVNode as E, createTextVNode as S, toDisplayString as h, renderList as fe, createSlots as Re, onMounted as xl, reactive as wl, nextTick as kl, useTemplateRef as ml, normalizeClass as il } from "vue";
2
- import { useRouter as Fe, useRoute as Le } from "vue-router";
3
- import { useAdmin as oe, i18nKey as Vl, useTranslate as le, useErrorText as me, WxRowMenu as Ae, WxRelationsField as $l, WxScreenHead as al, createRelationsApi as Tl, rowMenuWidth as Sl, WxDate as De, WxFilterChips as Cl, WxListScreen as fl, WxNotes as Ul } from "@webx-ui/module-admin";
4
- import { useLocales as xe, WxLocales as zl, WxRichText as ul, localizedValue as _e, useModal as He, WxDialog as Xe, WxFormItem as G, WxSelect as pe, WxInput as J, WxText as j, WxAction as he, WxButton as ee, WxIcon as ge, WxInputNumber as ke, WxDatePicker as tl, WxTagsInput as Al, WxCheckbox as ve, WxSpace as qe, toast as X, createModal as Ge, WxCard as te, WxEmpty as je, WxSortableList as nl, WxBadge as ye, confirm as Ue, WxSwitch as vl, WxAlert as $e, WxTable as bl, WxLink as Wl, WxSkeleton as We, WxTabs as sl, WxTab as be, WxActionBar as Fl, WxAutocomplete as ql, WxTextarea as Nl, WxRadioGroup as Il, WxCheckboxGroup as El, useElementWidth as Ml, WxEntityCard as Pl, WxAvatar as rl, WxTooltip as Bl, WxListDetail as Ol, WxIndicator as dl, WxDescriptions as cl, WxDescriptionsItem as Pe, WxFileCard as Rl, WxTimeline as Dl, WxTimelineItem as Ll } from "@webx-ui/core";
5
- const hl = /* @__PURE__ */ ae({
6
- __name: "LocalizedRichText",
7
- props: /* @__PURE__ */ Ce({
8
- placeholder: { default: void 0 },
9
- minHeight: { default: "160px" }
10
- }, {
11
- modelValue: { default: "" },
12
- modelModifiers: {}
13
- }),
14
- emits: ["update:modelValue"],
15
- setup(u) {
16
- const i = Ve(u, "modelValue"), r = u, d = xe(), m = x(() => {
17
- const s = d.active.value;
18
- return d.list.value.some(($) => $.code === s) ? s : d.list.value[0]?.code ?? "";
19
- }), w = x({
20
- get: () => {
21
- const s = i.value;
22
- return typeof s == "string" ? m.value === "" || m.value === d.list.value[0]?.code ? s : "" : s[m.value] ?? "";
23
- },
24
- set: (s) => {
25
- if (m.value === "") {
26
- i.value = s;
27
- return;
28
- }
29
- const l = typeof i.value == "string" ? { [m.value]: i.value } : i.value;
30
- i.value = { ...l, [m.value]: s };
31
- }
32
- });
33
- return (s, l) => e(d).list.value.length > 0 ? (o(), y(e(zl), { key: 0 }, {
34
- default: a(() => [
35
- t(e(ul), {
36
- modelValue: w.value,
37
- "onUpdate:modelValue": l[0] || (l[0] = ($) => w.value = $),
38
- placeholder: r.placeholder,
39
- "min-height": r.minHeight
40
- }, null, 8, ["modelValue", "placeholder", "min-height"])
41
- ]),
42
- _: 1
43
- })) : (o(), y(e(ul), {
44
- key: 1,
45
- modelValue: w.value,
46
- "onUpdate:modelValue": l[1] || (l[1] = ($) => w.value = $),
47
- placeholder: r.placeholder,
48
- "min-height": r.minHeight
49
- }, null, 8, ["modelValue", "placeholder", "min-height"]));
50
- }
51
- }), Be = /* @__PURE__ */ new WeakMap();
52
- function ce(u) {
53
- const i = `${u.apiPath}/inbox`, r = (s) => s.data, d = () => {
54
- }, m = (s) => (Be.delete(u.http), s);
55
- function w() {
56
- const s = Be.get(u.http);
57
- if (s !== void 0)
58
- return s.then(($) => [...$]);
59
- const l = u.http.get(`${i}/statuses`).then(r);
60
- return Be.set(u.http, l), l.catch(() => Be.delete(u.http)), l.then(($) => [...$]);
61
- }
62
- return {
63
- forms: () => u.http.get(`${i}/forms`).then(r),
64
- form: (s) => u.http.get(`${i}/forms/${s}`).then(r),
65
- createForm: (s) => u.http.post(`${i}/forms`, s).then(r),
66
- saveForm: (s, l) => u.http.put(`${i}/forms/${s}`, l).then(r),
67
- removeForm: (s) => u.http.delete(`${i}/forms/${s}`).then(d),
68
- duplicateForm: (s) => u.http.post(`${i}/forms/${s}/duplicate`, {}).then(r),
69
- sortForms: (s) => u.http.post(`${i}/forms/sorting`, { ids: s }).then(d),
70
- fields: (s) => u.http.get(`${i}/forms/${s}/fields`).then(r),
71
- createField: (s, l) => u.http.post(`${i}/forms/${s}/fields`, l).then(r),
72
- saveField: (s, l) => u.http.put(`${i}/fields/${s}`, l).then(r),
73
- removeField: (s) => u.http.delete(`${i}/fields/${s}`).then(d),
74
- sortFields: (s, l) => u.http.post(`${i}/forms/${s}/fields/sorting`, { ids: l }).then(d),
75
- statuses: w,
76
- createStatus: (s) => u.http.post(`${i}/statuses`, s).then(r).then(m),
77
- saveStatus: (s, l) => u.http.put(`${i}/statuses/${s}`, l).then(r).then(m),
78
- removeStatus: (s) => u.http.delete(`${i}/statuses/${s}`).then(d).then(m),
79
- sortStatuses: (s) => u.http.post(`${i}/statuses/sorting`, { ids: s }).then(d).then(m),
80
- recipients: () => u.http.get(`${i}/recipients`).then(r),
81
- submissions: (s, l = {}) => u.http.get(`${i}/forms/${s}/submissions`, { query: ll(l) }).then(($) => ({
82
- ...$.meta,
83
- data: $.data,
84
- columns: $.columns,
85
- counts: $.counts,
86
- // Optional on the wire: a server from before placements answers without them.
87
- placements: $.placements ?? []
88
- })),
89
- submission: (s, l = {}) => u.http.get(`${i}/submissions/${s}`, { query: ll(l) }).then(r),
90
- createSubmission: (s, l) => u.http.post(`${i}/forms/${s}/submissions`, { fields: l }).then(r),
91
- saveSubmission: (s, l) => u.http.put(`${i}/submissions/${s}`, l).then(r),
92
- removeSubmission: (s) => u.http.delete(`${i}/submissions/${s}`).then(d),
93
- notifySubmission: (s) => u.http.post(`${i}/submissions/${s}/notify`).then(r),
94
- massSubmissions: (s) => u.http.post(`${i}/submissions/mass`, s).then(r),
95
- exportUrl: (s, l = {}) => {
96
- const $ = new URLSearchParams();
97
- for (const [f, A] of Object.entries(ll(l)))
98
- A != null && A !== "" && $.set(f, String(A));
99
- const b = $.toString();
100
- return `${i}/forms/${s}/submissions/export${b === "" ? "" : `?${b}`}`;
101
- }
102
- };
103
- }
104
- function ll(u) {
105
- return {
106
- view: u.view === void 0 || u.view === "" ? void 0 : u.view,
107
- search: u.search === void 0 || u.search === "" ? void 0 : u.search,
108
- assignee: u.assignee ?? void 0,
109
- placement: u.placement ?? void 0,
110
- sort: u.sort ?? void 0,
111
- page: u.page,
112
- per_page: u.per_page
113
- };
114
- }
115
- const Hl = {
116
- module: {
117
- title: "Inbox"
118
- },
119
- panel: {
120
- forms: "Forms",
121
- "new-form": "New form",
122
- "no-forms": "No forms yet.",
123
- "no-forms-help": "A form is a few questions and a list of who hears the answers.",
124
- unread: "Unread",
125
- submissions: "Submissions in all",
126
- off: "Off",
127
- settings: "Settings",
128
- duplicate: "Duplicate",
129
- delete: "Delete",
130
- "delete-form-title": "Delete “:form”?",
131
- "delete-form-text": "The form and its questions go. This cannot be undone.",
132
- cancel: "Cancel",
133
- save: "Save",
134
- saved: "Saved.",
135
- deleted: "Deleted.",
136
- duplicated: "A copy was made.",
137
- failed: "Some values were not accepted. Check the highlighted fields.",
138
- "reorder-failed": "The new order could not be saved.",
139
- reorder: "Reorder",
140
- "new-form-title": "New form",
141
- title: "Title",
142
- slug: "Address",
143
- "slug-help": "What the form is called on the site and where it posts.",
144
- "is-enabled": "Active",
145
- "is-enabled-help": "A form that is off is neither drawn nor accepted.",
146
- "tab-general": "General",
147
- "tab-fields": "Fields",
148
- "tab-notifications": "Notifications",
149
- "tab-antispam": "Antispam",
150
- "tab-embed": "Embedding",
151
- "after-sending": "After sending",
152
- "thank-you-heading": "Heading",
153
- "thank-you-text": "Text",
154
- "submit-text": "Text on the button",
155
- redirect: "Go to this address instead",
156
- "redirect-help": "Left empty, the thank-you takes the form’s place on the page.",
157
- recipients: "Who is written to",
158
- "recipients-help": "Nobody here means nobody is told. The submission is kept either way.",
159
- "no-recipients": "Nobody yet.",
160
- "add-admin": "Add an administrator",
161
- "add-email": "Add an address",
162
- remove: "Remove",
163
- "remove-recipient-title": "Remove this recipient?",
164
- "remove-recipient-text": "They stop being told when something arrives.",
165
- "email-field": "The field holding the sender’s address",
166
- "email-field-help": "A reply to the notification then goes to whoever wrote in.",
167
- "notify-through": "Notify through",
168
- "notify-through-help": "Channels of the Notifications section: Telegram, e-mail and others. A submission from the site goes to each of them by its own template, beside the letter above.",
169
- "pick-channels": "Add a channel",
170
- "no-channels": "No channels chosen.",
171
- "set-up-channels": "Set up channels",
172
- channels: "Channels",
173
- "channels-none": "Nothing was sent through channels.",
174
- "channels-failed": "A channel did not deliver the notification",
175
- "no-email-field": "None",
176
- honeypot: "Hidden field",
177
- "honeypot-help": "A field nobody sees and a robot fills in.",
178
- "min-seconds": "Fastest a person could send it, in seconds",
179
- "min-seconds-help": "Zero switches the check off.",
180
- throttle: "Sends a minute from one address",
181
- "throttle-help": "Zero switches the limit off.",
182
- captcha: "Captcha",
183
- "captcha-keys": "The keys are not set in the panel but in the site’s .env: WEBX_INBOX_RECAPTCHA_KEY / WEBX_INBOX_RECAPTCHA_SECRET for reCAPTCHA, WEBX_INBOX_TURNSTILE_KEY / WEBX_INBOX_TURNSTILE_SECRET for Turnstile.",
184
- "captcha-off": "Off",
185
- "captcha-recaptcha": "reCAPTCHA",
186
- "captcha-turnstile": "Turnstile",
187
- "captcha-unconfigured": "The site has no keys for this captcha yet, so the form refuses every submission until they are in its .env.",
188
- "captcha-recaptcha-checkbox": "This site draws reCAPTCHA as the “I’m not a robot” checkbox, so its keys must be v2 Checkbox keys. To run it invisibly, create v2 Invisible keys and set WEBX_INBOX_RECAPTCHA_TYPE=invisible.",
189
- "captcha-recaptcha-invisible": "This site runs reCAPTCHA invisibly when the form is sent, so its keys must be v2 Invisible keys (WEBX_INBOX_RECAPTCHA_TYPE=invisible).",
190
- "captcha-recaptcha-v3": "This site runs reCAPTCHA v3: no widget, only a score checked when the form is sent, so its keys must be v3 keys (WEBX_INBOX_RECAPTCHA_TYPE=v3).",
191
- "captcha-turnstile-checkbox": "This site draws Turnstile when the page opens, and a Managed widget shows visitors “Verify you are human”. To run it invisibly, set WEBX_INBOX_TURNSTILE_MODE=invisible and the widget mode to Invisible in Cloudflare.",
192
- "captcha-turnstile-invisible": "This site runs Turnstile invisibly when the form is sent. Set the widget mode to Invisible in Cloudflare: a Managed widget still shows a challenge when it decides one is needed.",
193
- "embed-blade": "On a page of the site",
194
- "embed-blade-help": "Put the tag where the form belongs. The markup is published and rewritten by the site.",
195
- "embed-block": "In the block builder",
196
- "embed-block-help": "A block type prints the same tag, so an editor drops the form in without touching a template.",
197
- "embed-block-panel-help": "On this site block templates are written in the panel, in Blocks: put the same tag into the template of a block there.",
198
- "embed-extras": "Filled in and placed",
199
- "embed-extras-help": ":values fills the hidden fields by their name; placement names where the form stands, so the submission remembers it and the site can style each place.",
200
- loading: "Loading…",
201
- "embed-names": "Names of the fields",
202
- "embed-names-help": "A hidden field is filled in by the page: the address it was sent from, a product, a campaign.",
203
- copy: "Copy",
204
- copied: "Copied.",
205
- statuses: "Statuses",
206
- "new-status": "New status",
207
- "status-key": "Key",
208
- "status-color": "Colour",
209
- "status-default": "Given to a new submission",
210
- "status-spam": "Spam",
211
- "status-closed": "Nothing further expected",
212
- "in-use": "In use",
213
- "delete-status-title": "Delete “:status”?",
214
- "delete-status-text": "Only a status nothing is in can go.",
215
- "no-statuses": "No statuses yet.",
216
- "color-default": "Grey",
217
- "color-primary": "Blue",
218
- "color-success": "Green",
219
- "color-warning": "Amber",
220
- "color-info": "Cyan",
221
- "color-danger": "Red",
222
- // The submissions: the list on the right of the section, and one of them opened.
223
- id: "ID",
224
- received: "Received",
225
- status: "Status",
226
- assignee: "Assignee",
227
- unassigned: "Nobody",
228
- "submissions-empty": "Nothing has come in through this form yet.",
229
- "search-submissions": "Search the answers",
230
- "view-all": "All",
231
- "view-unread": "Unread",
232
- export: "Export",
233
- "new-submission": "New submission",
234
- "new-submission-title": "A submission by hand",
235
- "new-submission-help": "For one that came by telephone or on paper. It is written the same way and lands in the same list.",
236
- created: "Added.",
237
- submission: "Submission :id",
238
- previous: "Previous",
239
- next: "Next",
240
- "mark-read": "Mark as read",
241
- "mark-unread": "Mark as unread",
242
- "delete-submission-title": "Delete this submission?",
243
- "delete-submission-text": "It goes with its attachments. This cannot be undone.",
244
- selected: ":count selected",
245
- "move-to": "Move to",
246
- "delete-selected-title": "Delete :count submissions?",
247
- answers: "Answers",
248
- attachments: "Attachments",
249
- details: "Details",
250
- "meta-page": "Page",
251
- "meta-placement": "Placement",
252
- "any-placement": "Any placement",
253
- "placement-none": "Not specified",
254
- "meta-referrer": "Came from",
255
- "meta-ip": "Address",
256
- "meta-agent": "Browser",
257
- "meta-locale": "Language",
258
- "meta-source": "How it arrived",
259
- "source-web": "From the site",
260
- "source-panel": "Typed in",
261
- notified: "The notification went out",
262
- "not-notified": "No notification was sent",
263
- "notify-failed": "The notification could not be sent",
264
- reply: "Reply by mail",
265
- log: "What has happened",
266
- "event-created": "Arrived",
267
- "event-status": "Status: :to",
268
- "event-assignee": "Given to :to",
269
- "event-unassigned": "Left to nobody",
270
- "event-note": "A note was added",
271
- "event-notified": "The notification went out",
272
- "event-handled": "Handed to :name",
273
- "event-handler-error": ":name failed: :error",
274
- system: "System",
275
- "no-answers": "Nothing was filled in.",
276
- download: "Download",
277
- "no-files-by-hand": "A file cannot be attached by hand: the files a submission carries are what was posted with it.",
278
- "submissions-none": "Nothing here under this filter.",
279
- "notifies-nobody": "Nobody is told about this form",
280
- "notifies-nobody-text": "Every submission is kept here, but no letter goes out. Add a recipient on the Notifications tab.",
281
- "notifies-nobody-short": "Nobody is told",
282
- "recipient-admin_deleted": "This administrator no longer exists and gets no letter.",
283
- "recipient-admin_inactive": "This administrator is switched off and gets no letter.",
284
- "recipient-invalid_email": "This is not an e-mail address.",
285
- "event-no-recipients": "Nobody was told: the form names no recipients",
286
- "notified-nobody": "No notification: the form names nobody to tell",
287
- "notify-queued": "The notification is waiting in the queue",
288
- "notify-again": "Send the notification again",
289
- "notify-sent-again": "The notification has been sent again",
290
- "notify-recipient-queued": "waiting",
291
- "notify-recipient-delivered": "sent",
292
- "notify-recipient-failed": "failed",
293
- "event-notify-queued": "The notification was queued",
294
- "event-notify-failed": "The notification to :to failed",
295
- "event-value": "Answer “:field” corrected: “:from” → “:to”"
296
- },
297
- fields: {
298
- field: "Field",
299
- "new-field": "New field",
300
- "edit-field": "Field",
301
- edit: "Edit",
302
- "no-fields": "No questions yet.",
303
- "no-fields-help": "A form with no fields draws nothing on the page.",
304
- "save-first": "Save the form first, then write its questions.",
305
- delete: "Delete",
306
- "delete-title": "Delete “:field”?",
307
- "delete-text": "It stops being asked. Answers already given keep it.",
308
- cancel: "Cancel",
309
- save: "Save",
310
- name: "Name",
311
- "name-help": "What the field is called in the HTML. Left empty, it answers to f17.",
312
- type: "Type",
313
- title: "Label",
314
- placeholder: "Placeholder",
315
- help: "Hint under the field",
316
- "is-enabled": "Shown",
317
- "is-required": "Required",
318
- "is-fullsize": "Full width",
319
- "in-table": "A column in the list",
320
- choices: "Choices",
321
- "choice-value": "Value",
322
- "choice-label": "Label",
323
- "add-choice": "Add a choice",
324
- "no-choices": "No choices yet. A field with none accepts nothing.",
325
- maxlength: "Longest answer, in characters",
326
- rows: "Height, in lines",
327
- pattern: "Pattern the answer has to match",
328
- "pattern-help": "The browser’s own, written without delimiters: [0-9+ ()-]{6,}",
329
- earliest: "Earliest date",
330
- latest: "Latest date",
331
- "min-choices": "Fewest ticks",
332
- "max-choices": "Most ticks",
333
- "consent-text": "The sentence beside the tick",
334
- "consent-text-help": "A link is allowed here: it is printed as written.",
335
- "max-size": "Largest file, in kilobytes",
336
- extensions: "Extensions allowed",
337
- "extensions-help": "Comma separated. Empty means the list the site allows.",
338
- multiple: "Several files at once",
339
- "type-text": "Text",
340
- "type-email": "E-mail",
341
- "type-tel": "Telephone",
342
- "type-textarea": "Long text",
343
- "type-select": "Drop-down",
344
- "type-radio": "One of several",
345
- "type-checkbox": "Several of several",
346
- "type-consent": "Consent",
347
- "type-date": "Date",
348
- "type-file": "File",
349
- "type-hidden": "Hidden"
350
- },
351
- relations: {
352
- form: "Form",
353
- "field-search": "Find a form by its name or address",
354
- "field-empty": "No form",
355
- "field-remove": "Remove the form",
356
- "field-missing": "No such form",
357
- "field-off": "Switched off",
358
- "field-nothing": "No form matches",
359
- "field-searching": "Searching…",
360
- unknown: "The Inbox has no form “:slug”. It has: :forms.",
361
- "unknown-none": "The Inbox has no form “:slug” — it has no forms yet."
362
- }
363
- }, pl = /* @__PURE__ */ new WeakSet();
364
- function ue() {
365
- try {
366
- const { i18n: u } = oe();
367
- pl.has(u) || (u.defaults("webx-inbox", Hl), pl.add(u));
368
- } catch {
369
- }
370
- }
371
- function ol() {
372
- const u = _l(Vl, null), i = xe();
373
- return (r) => {
374
- const d = u?.state.locale;
375
- return (d === void 0 ? void 0 : r.title[d]) || _e(r.title, i.active.value, r.key);
376
- };
377
- }
378
- const Xl = [
379
- "text",
380
- "email",
381
- "tel",
382
- "textarea",
383
- "select",
384
- "radio",
385
- "checkbox",
386
- "consent",
387
- "date",
388
- "file",
389
- "hidden"
390
- ], Gl = ["default", "primary", "success", "warning", "info", "danger"], jl = { class: "wx-inbox-field-form" }, Kl = { class: "wx-inbox-field-form__row" }, Yl = {
391
- key: 2,
392
- class: "wx-inbox-choices"
393
- }, Zl = { class: "wx-inbox-field-form__row" }, Ql = { class: "wx-inbox-field-form__checks" }, Jl = /* @__PURE__ */ ae({
394
- __name: "FieldDialog",
395
- props: {
396
- field: {},
397
- form: {}
398
- },
399
- setup(u) {
400
- const i = u, { resolve: r, dismiss: d, open: m } = He(), w = oe(), s = ce(w);
401
- ue();
402
- const l = le("webx-inbox"), $ = me(), b = F(!1), f = F({}), A = F(""), k = F("text"), U = F({}), c = F({}), q = F({}), V = F({}), W = F(!0), I = F(!1), R = F(!0), M = F(!1);
403
- Te(
404
- () => i.field,
405
- (B) => {
406
- A.value = B?.name ?? "", k.value = B?.type ?? "text", U.value = { ...B?.title ?? {} }, c.value = { ...B?.placeholder ?? {} }, q.value = { ...B?.help ?? {} }, V.value = { ...B?.options ?? {} }, W.value = B?.is_enabled ?? !0, I.value = B?.is_required ?? !1, R.value = B?.is_fullsize ?? !0, M.value = B?.in_table ?? !1, f.value = {};
407
- },
408
- { immediate: !0 }
409
- );
410
- const T = x(
411
- () => Xl.map((B) => ({ value: B, label: l(`fields.type-${B}`) }))
412
- ), g = x(() => ["select", "radio", "checkbox"].includes(k.value)), z = x(
413
- () => Array.isArray(V.value.choices) ? V.value.choices : []
414
- ), N = x({
415
- get: () => Array.isArray(V.value.extensions) ? V.value.extensions : [],
416
- set: (B) => v(
417
- "extensions",
418
- B.map((C) => C.replace(/^\./, ""))
419
- )
420
- });
421
- function v(B, C) {
422
- V.value = { ...V.value, [B]: C };
423
- }
424
- function H() {
425
- v("choices", [...z.value, { value: "", label: {} }]);
426
- }
427
- function K(B) {
428
- v(
429
- "choices",
430
- z.value.filter((C, _) => _ !== B)
431
- );
432
- }
433
- function Y(B, C) {
434
- v(
435
- "choices",
436
- z.value.map((_, ne) => ne === B ? { ..._, ...C } : _)
437
- );
438
- }
439
- function P(B) {
440
- return f.value[B]?.[0];
441
- }
442
- async function Z() {
443
- b.value = !0, f.value = {};
444
- const B = {
445
- name: A.value.trim() === "" ? null : A.value.trim(),
446
- type: k.value,
447
- title: U.value,
448
- placeholder: c.value,
449
- help: q.value,
450
- options: V.value,
451
- is_enabled: W.value,
452
- is_required: I.value,
453
- is_fullsize: R.value,
454
- in_table: M.value
455
- };
456
- try {
457
- r(
458
- i.field === null ? await s.createField(i.form.id, B) : await s.saveField(i.field.id, B)
459
- );
460
- } catch (C) {
461
- const _ = C.body;
462
- _?.errors ? (f.value = _.errors, X.danger(l("panel.failed"))) : X.danger($(C));
463
- } finally {
464
- b.value = !1;
465
- }
466
- }
467
- return (B, C) => (o(), y(e(Xe), {
468
- open: e(m),
469
- "onUpdate:open": C[21] || (C[21] = (_) => se(m) ? m.value = _ : null),
470
- title: u.field ? e(l)("fields.edit-field") : e(l)("fields.new-field"),
471
- width: 720
472
- }, {
473
- footer: a(() => [
474
- t(e(qe), { size: "sm" }, {
475
- default: a(() => [
476
- t(e(ee), {
477
- variant: "outline",
478
- onClick: C[20] || (C[20] = (_) => e(d)())
479
- }, {
480
- default: a(() => [
481
- S(h(e(l)("fields.cancel")), 1)
482
- ]),
483
- _: 1
484
- }),
485
- t(e(ee), {
486
- type: "primary",
487
- loading: b.value,
488
- onClick: Z
489
- }, {
490
- default: a(() => [
491
- S(h(e(l)("fields.save")), 1)
492
- ]),
493
- _: 1
494
- }, 8, ["loading"])
495
- ]),
496
- _: 1
497
- })
498
- ]),
499
- default: a(() => [
500
- L("div", jl, [
501
- L("div", Kl, [
502
- t(e(G), {
503
- label: e(l)("fields.type")
504
- }, {
505
- default: a(() => [
506
- t(e(pe), {
507
- modelValue: k.value,
508
- "onUpdate:modelValue": C[0] || (C[0] = (_) => k.value = _),
509
- options: T.value
510
- }, null, 8, ["modelValue", "options"])
511
- ]),
512
- _: 1
513
- }, 8, ["label"]),
514
- t(e(G), {
515
- label: e(l)("fields.name"),
516
- help: e(l)("fields.name-help"),
517
- error: P("name")
518
- }, {
519
- default: a(() => [
520
- t(e(J), {
521
- modelValue: A.value,
522
- "onUpdate:modelValue": C[1] || (C[1] = (_) => A.value = _),
523
- placeholder: "email"
524
- }, null, 8, ["modelValue"])
525
- ]),
526
- _: 1
527
- }, 8, ["label", "help", "error"])
528
- ]),
529
- t(e(G), {
530
- label: e(l)("fields.title"),
531
- error: P("title"),
532
- required: ""
533
- }, {
534
- default: a(() => [
535
- t(e(J), {
536
- modelValue: U.value,
537
- "onUpdate:modelValue": C[2] || (C[2] = (_) => U.value = _),
538
- localized: ""
539
- }, null, 8, ["modelValue"])
540
- ]),
541
- _: 1
542
- }, 8, ["label", "error"]),
543
- k.value !== "hidden" ? (o(), D(Q, { key: 0 }, [
544
- k.value !== "consent" ? (o(), y(e(G), {
545
- key: 0,
546
- label: e(l)("fields.placeholder")
547
- }, {
548
- default: a(() => [
549
- t(e(J), {
550
- modelValue: c.value,
551
- "onUpdate:modelValue": C[3] || (C[3] = (_) => c.value = _),
552
- localized: ""
553
- }, null, 8, ["modelValue"])
554
- ]),
555
- _: 1
556
- }, 8, ["label"])) : E("", !0),
557
- t(e(G), {
558
- label: e(l)("fields.help")
559
- }, {
560
- default: a(() => [
561
- t(e(J), {
562
- modelValue: q.value,
563
- "onUpdate:modelValue": C[4] || (C[4] = (_) => q.value = _),
564
- localized: ""
565
- }, null, 8, ["modelValue"])
566
- ]),
567
- _: 1
568
- }, 8, ["label"])
569
- ], 64)) : E("", !0),
570
- k.value === "consent" ? (o(), y(e(G), {
571
- key: 1,
572
- label: e(l)("fields.consent-text"),
573
- help: e(l)("fields.consent-text-help")
574
- }, {
575
- default: a(() => [
576
- t(hl, {
577
- "model-value": V.value.text ?? {},
578
- "min-height": "100px",
579
- "onUpdate:modelValue": C[5] || (C[5] = (_) => v("text", _))
580
- }, null, 8, ["model-value"])
581
- ]),
582
- _: 1
583
- }, 8, ["label", "help"])) : E("", !0),
584
- g.value ? (o(), D("div", Yl, [
585
- t(e(j), {
586
- size: "sm",
587
- weight: "medium"
588
- }, {
589
- default: a(() => [
590
- S(h(e(l)("fields.choices")), 1)
591
- ]),
592
- _: 1
593
- }),
594
- z.value.length === 0 ? (o(), y(e(j), {
595
- key: 0,
596
- size: "sm",
597
- tone: "placeholder"
598
- }, {
599
- default: a(() => [
600
- S(h(e(l)("fields.no-choices")), 1)
601
- ]),
602
- _: 1
603
- })) : E("", !0),
604
- (o(!0), D(Q, null, fe(z.value, (_, ne) => (o(), D("div", {
605
- key: ne,
606
- class: "wx-inbox-choices__row"
607
- }, [
608
- t(e(J), {
609
- "model-value": _.value,
610
- placeholder: e(l)("fields.choice-value"),
611
- "onUpdate:modelValue": (re) => Y(ne, { value: String(re) })
612
- }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"]),
613
- t(e(J), {
614
- "model-value": _.label,
615
- localized: "",
616
- placeholder: e(l)("fields.choice-label"),
617
- "onUpdate:modelValue": (re) => Y(ne, { label: re })
618
- }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"]),
619
- t(e(he), {
620
- icon: "trash",
621
- title: e(l)("fields.delete"),
622
- onClick: (re) => K(ne)
623
- }, null, 8, ["title", "onClick"])
624
- ]))), 128)),
625
- t(e(ee), {
626
- variant: "outline",
627
- size: "sm",
628
- onClick: H
629
- }, {
630
- icon: a(() => [
631
- t(e(ge), { name: "plus" })
632
- ]),
633
- default: a(() => [
634
- S(" " + h(e(l)("fields.add-choice")), 1)
635
- ]),
636
- _: 1
637
- }),
638
- P("options.choices") ? (o(), y(e(j), {
639
- key: 1,
640
- size: "sm",
641
- tone: "danger"
642
- }, {
643
- default: a(() => [
644
- S(h(P("options.choices")), 1)
645
- ]),
646
- _: 1
647
- })) : E("", !0)
648
- ])) : E("", !0),
649
- L("div", Zl, [
650
- k.value === "textarea" ? (o(), y(e(G), {
651
- key: 0,
652
- label: e(l)("fields.rows")
653
- }, {
654
- default: a(() => [
655
- t(e(ke), {
656
- "model-value": V.value.rows ?? 5,
657
- min: 2,
658
- max: 30,
659
- "onUpdate:modelValue": C[6] || (C[6] = (_) => v("rows", _))
660
- }, null, 8, ["model-value"])
661
- ]),
662
- _: 1
663
- }, 8, ["label"])) : E("", !0),
664
- ["text", "email", "textarea"].includes(k.value) ? (o(), y(e(G), {
665
- key: 1,
666
- label: e(l)("fields.maxlength")
667
- }, {
668
- default: a(() => [
669
- t(e(ke), {
670
- "model-value": V.value.maxlength ?? null,
671
- min: 1,
672
- max: 2e4,
673
- "onUpdate:modelValue": C[7] || (C[7] = (_) => v("maxlength", _))
674
- }, null, 8, ["model-value"])
675
- ]),
676
- _: 1
677
- }, 8, ["label"])) : E("", !0),
678
- k.value === "tel" ? (o(), y(e(G), {
679
- key: 2,
680
- label: e(l)("fields.pattern"),
681
- help: e(l)("fields.pattern-help")
682
- }, {
683
- default: a(() => [
684
- t(e(J), {
685
- "model-value": V.value.pattern ?? "",
686
- "onUpdate:modelValue": C[8] || (C[8] = (_) => v("pattern", _))
687
- }, null, 8, ["model-value"])
688
- ]),
689
- _: 1
690
- }, 8, ["label", "help"])) : E("", !0),
691
- k.value === "date" ? (o(), D(Q, { key: 3 }, [
692
- t(e(G), {
693
- label: e(l)("fields.earliest")
694
- }, {
695
- default: a(() => [
696
- t(e(tl), {
697
- clearable: "",
698
- "model-value": V.value.min ?? null,
699
- "onUpdate:modelValue": C[9] || (C[9] = (_) => v("min", _))
700
- }, null, 8, ["model-value"])
701
- ]),
702
- _: 1
703
- }, 8, ["label"]),
704
- t(e(G), {
705
- label: e(l)("fields.latest")
706
- }, {
707
- default: a(() => [
708
- t(e(tl), {
709
- clearable: "",
710
- "model-value": V.value.max ?? null,
711
- "onUpdate:modelValue": C[10] || (C[10] = (_) => v("max", _))
712
- }, null, 8, ["model-value"])
713
- ]),
714
- _: 1
715
- }, 8, ["label"])
716
- ], 64)) : E("", !0),
717
- k.value === "checkbox" ? (o(), D(Q, { key: 4 }, [
718
- t(e(G), {
719
- label: e(l)("fields.min-choices")
720
- }, {
721
- default: a(() => [
722
- t(e(ke), {
723
- "model-value": V.value.min ?? null,
724
- min: 0,
725
- "onUpdate:modelValue": C[11] || (C[11] = (_) => v("min", _))
726
- }, null, 8, ["model-value"])
727
- ]),
728
- _: 1
729
- }, 8, ["label"]),
730
- t(e(G), {
731
- label: e(l)("fields.max-choices")
732
- }, {
733
- default: a(() => [
734
- t(e(ke), {
735
- "model-value": V.value.max ?? null,
736
- min: 0,
737
- "onUpdate:modelValue": C[12] || (C[12] = (_) => v("max", _))
738
- }, null, 8, ["model-value"])
739
- ]),
740
- _: 1
741
- }, 8, ["label"])
742
- ], 64)) : E("", !0),
743
- k.value === "file" ? (o(), y(e(G), {
744
- key: 5,
745
- label: e(l)("fields.max-size")
746
- }, {
747
- default: a(() => [
748
- t(e(ke), {
749
- "model-value": V.value.max_size ?? null,
750
- min: 1,
751
- "onUpdate:modelValue": C[13] || (C[13] = (_) => v("max_size", _))
752
- }, null, 8, ["model-value"])
753
- ]),
754
- _: 1
755
- }, 8, ["label"])) : E("", !0)
756
- ]),
757
- k.value === "file" ? (o(), D(Q, { key: 3 }, [
758
- t(e(G), {
759
- label: e(l)("fields.extensions"),
760
- help: e(l)("fields.extensions-help")
761
- }, {
762
- default: a(() => [
763
- t(e(Al), {
764
- modelValue: N.value,
765
- "onUpdate:modelValue": C[14] || (C[14] = (_) => N.value = _)
766
- }, null, 8, ["modelValue"])
767
- ]),
768
- _: 1
769
- }, 8, ["label", "help"]),
770
- t(e(ve), {
771
- "model-value": !!V.value.multiple,
772
- label: e(l)("fields.multiple"),
773
- "onUpdate:modelValue": C[15] || (C[15] = (_) => v("multiple", _))
774
- }, null, 8, ["model-value", "label"])
775
- ], 64)) : E("", !0),
776
- L("div", Ql, [
777
- t(e(ve), {
778
- modelValue: W.value,
779
- "onUpdate:modelValue": C[16] || (C[16] = (_) => W.value = _),
780
- label: e(l)("fields.is-enabled")
781
- }, null, 8, ["modelValue", "label"]),
782
- t(e(ve), {
783
- modelValue: I.value,
784
- "onUpdate:modelValue": C[17] || (C[17] = (_) => I.value = _),
785
- label: e(l)("fields.is-required")
786
- }, null, 8, ["modelValue", "label"]),
787
- k.value !== "hidden" ? (o(), y(e(ve), {
788
- key: 0,
789
- modelValue: R.value,
790
- "onUpdate:modelValue": C[18] || (C[18] = (_) => R.value = _),
791
- label: e(l)("fields.is-fullsize")
792
- }, null, 8, ["modelValue", "label"])) : E("", !0),
793
- t(e(ve), {
794
- modelValue: M.value,
795
- "onUpdate:modelValue": C[19] || (C[19] = (_) => M.value = _),
796
- label: e(l)("fields.in-table")
797
- }, null, 8, ["modelValue", "label"])
798
- ])
799
- ])
800
- ]),
801
- _: 1
802
- }, 8, ["open", "title"]));
803
- }
804
- }), ie = (u, i) => {
805
- const r = u.__vccOpts || u;
806
- for (const [d, m] of i)
807
- r[d] = m;
808
- return r;
809
- }, et = /* @__PURE__ */ ie(Jl, [["__scopeId", "data-v-a3de6c60"]]), lt = { class: "wx-inbox-field" }, tt = { class: "wx-inbox-field__name" }, at = /* @__PURE__ */ ae({
810
- __name: "FieldList",
811
- props: /* @__PURE__ */ Ce({
812
- form: {},
813
- canManage: { type: Boolean }
814
- }, {
815
- modelValue: { required: !0 },
816
- modelModifiers: {}
817
- }),
818
- emits: ["update:modelValue"],
819
- setup(u) {
820
- const i = u, r = Ve(u, "modelValue"), d = oe(), m = ce(d), w = xe();
821
- ue();
822
- const s = le("webx-inbox"), l = me(), $ = Ge(et);
823
- function b(V) {
824
- return _e(V.title, w.active.value, V.key);
825
- }
826
- function f(V) {
827
- return [
828
- s(`fields.type-${V.type}`),
829
- ...V.is_required ? [s("fields.is-required")] : [],
830
- ...V.in_table ? [s("fields.in-table")] : [],
831
- ...V.is_fullsize ? [] : [s("fields.is-fullsize")]
832
- ];
833
- }
834
- const A = x(() => r.value.length === 0);
835
- async function k(V) {
836
- const W = await $({ field: V, form: i.form });
837
- W && (r.value = V === null ? [...r.value, W] : r.value.map((I) => I.id === W.id ? W : I));
838
- }
839
- async function U(V) {
840
- if (await Ue({
841
- title: s("fields.delete-title", { field: b(V) }),
842
- message: s("fields.delete-text"),
843
- confirmText: s("fields.delete"),
844
- cancelText: s("fields.cancel"),
845
- tone: "danger"
846
- }))
847
- try {
848
- await m.removeField(V.id), r.value = r.value.filter((I) => I.id !== V.id), X.success(s("panel.deleted"));
849
- } catch (I) {
850
- X.danger(l(I));
851
- }
852
- }
853
- function c(V) {
854
- return i.canManage ? [
855
- { key: "edit", icon: "edit", label: s("fields.edit"), run: () => {
856
- k(V);
857
- } },
858
- {
859
- key: "delete",
860
- icon: "trash",
861
- label: s("fields.delete"),
862
- danger: !0,
863
- run: () => {
864
- U(V);
865
- }
866
- }
867
- ] : [];
868
- }
869
- async function q() {
870
- try {
871
- await m.sortFields(
872
- i.form.id,
873
- r.value.map((V) => V.id)
874
- );
875
- } catch (V) {
876
- X.danger(l(V, s("panel.reorder-failed")));
877
- }
878
- }
879
- return (V, W) => (o(), y(e(te), {
880
- title: e(s)("panel.tab-fields")
881
- }, Re({
882
- default: a(() => [
883
- A.value ? (o(), y(e(je), {
884
- key: 0,
885
- title: e(s)("fields.no-fields"),
886
- description: e(s)("fields.no-fields-help")
887
- }, null, 8, ["title", "description"])) : (o(), y(e(nl), {
888
- key: 1,
889
- modelValue: r.value,
890
- "onUpdate:modelValue": W[1] || (W[1] = (I) => r.value = I),
891
- plain: "",
892
- "item-key": "id",
893
- "item-label": b,
894
- "drag-label": e(s)("panel.reorder"),
895
- disabled: !u.canManage,
896
- "aria-label": e(s)("panel.tab-fields"),
897
- onMove: q
898
- }, {
899
- default: a(({ item: I }) => [
900
- L("div", lt, [
901
- L("div", tt, [
902
- t(e(j), {
903
- weight: "medium",
904
- truncate: ""
905
- }, {
906
- default: a(() => [
907
- S(h(b(I)), 1)
908
- ]),
909
- _: 2
910
- }, 1024),
911
- I.is_enabled ? E("", !0) : (o(), y(e(ye), {
912
- key: 0,
913
- type: "default"
914
- }, {
915
- default: a(() => [
916
- S(h(e(s)("panel.off")), 1)
917
- ]),
918
- _: 1
919
- }))
920
- ]),
921
- t(e(j), {
922
- size: "sm",
923
- tone: "muted",
924
- truncate: ""
925
- }, {
926
- default: a(() => [
927
- L("code", null, "fields[" + h(I.key) + "]", 1),
928
- S(" · " + h(f(I).join(" · ")), 1)
929
- ]),
930
- _: 2
931
- }, 1024)
932
- ])
933
- ]),
934
- actions: a(({ item: I }) => [
935
- t(e(Ae), {
936
- actions: c(I),
937
- label: b(I)
938
- }, null, 8, ["actions", "label"])
939
- ]),
940
- _: 1
941
- }, 8, ["modelValue", "drag-label", "disabled", "aria-label"]))
942
- ]),
943
- _: 2
944
- }, [
945
- u.canManage ? {
946
- name: "extra",
947
- fn: a(() => [
948
- t(e(ee), {
949
- type: "primary",
950
- size: "sm",
951
- onClick: W[0] || (W[0] = (I) => k(null))
952
- }, {
953
- icon: a(() => [
954
- t(e(ge), { name: "plus" })
955
- ]),
956
- default: a(() => [
957
- S(" " + h(e(s)("fields.new-field")), 1)
958
- ]),
959
- _: 1
960
- })
961
- ]),
962
- key: "0"
963
- } : void 0
964
- ]), 1032, ["title"]));
965
- }
966
- }), nt = /* @__PURE__ */ ie(at, [["__scopeId", "data-v-db38e823"]]);
967
- function de(u, i, r) {
968
- return x({
969
- get: () => u.value[i] ?? r,
970
- set: (d) => {
971
- const m = { ...u.value };
972
- d === "" || d === null || d === void 0 ? delete m[i] : m[i] = d, u.value = m;
973
- }
974
- });
975
- }
976
- const st = /* @__PURE__ */ ae({
977
- __name: "FormAntispam",
978
- props: /* @__PURE__ */ Ce({
979
- site: {}
980
- }, {
981
- modelValue: { required: !0 },
982
- modelModifiers: {}
983
- }),
984
- emits: ["update:modelValue"],
985
- setup(u) {
986
- const i = Ve(u, "modelValue"), r = u, d = le("webx-inbox"), m = de(i, "antispam.honeypot", !0), w = de(i, "antispam.min_seconds", 3), s = de(i, "antispam.throttle", 5), l = de(i, "antispam.captcha", "off"), $ = x(() => [
987
- { value: "off", label: d("panel.captcha-off") },
988
- { value: "recaptcha", label: d("panel.captcha-recaptcha") },
989
- { value: "turnstile", label: d("panel.captcha-turnstile") }
990
- ]), b = x(() => {
991
- const A = l.value;
992
- return A !== "recaptcha" && A !== "turnstile" ? null : { provider: A, site: r.site?.[A] ?? null };
993
- }), f = x(() => {
994
- const A = b.value?.site;
995
- return A ? d(`panel.captcha-${b.value.provider}-${A.type}`) : null;
996
- });
997
- return (A, k) => (o(), y(e(te), null, {
998
- default: a(() => [
999
- t(e(G), {
1000
- help: e(d)("panel.honeypot-help")
1001
- }, {
1002
- default: a(() => [
1003
- t(e(vl), {
1004
- modelValue: e(m),
1005
- "onUpdate:modelValue": k[0] || (k[0] = (U) => se(m) ? m.value = U : null),
1006
- label: e(d)("panel.honeypot")
1007
- }, null, 8, ["modelValue", "label"])
1008
- ]),
1009
- _: 1
1010
- }, 8, ["help"]),
1011
- t(e(G), {
1012
- label: e(d)("panel.min-seconds"),
1013
- help: e(d)("panel.min-seconds-help")
1014
- }, {
1015
- default: a(() => [
1016
- t(e(ke), {
1017
- modelValue: e(w),
1018
- "onUpdate:modelValue": k[1] || (k[1] = (U) => se(w) ? w.value = U : null),
1019
- min: 0,
1020
- max: 120
1021
- }, null, 8, ["modelValue"])
1022
- ]),
1023
- _: 1
1024
- }, 8, ["label", "help"]),
1025
- t(e(G), {
1026
- label: e(d)("panel.throttle"),
1027
- help: e(d)("panel.throttle-help")
1028
- }, {
1029
- default: a(() => [
1030
- t(e(ke), {
1031
- modelValue: e(s),
1032
- "onUpdate:modelValue": k[2] || (k[2] = (U) => se(s) ? s.value = U : null),
1033
- min: 0,
1034
- max: 120
1035
- }, null, 8, ["modelValue"])
1036
- ]),
1037
- _: 1
1038
- }, 8, ["label", "help"]),
1039
- t(e(G), {
1040
- label: e(d)("panel.captcha"),
1041
- help: e(d)("panel.captcha-keys")
1042
- }, {
1043
- default: a(() => [
1044
- t(e(pe), {
1045
- modelValue: e(l),
1046
- "onUpdate:modelValue": k[3] || (k[3] = (U) => se(l) ? l.value = U : null),
1047
- options: $.value
1048
- }, null, 8, ["modelValue", "options"])
1049
- ]),
1050
- _: 1
1051
- }, 8, ["label", "help"]),
1052
- f.value ? (o(), y(e(j), {
1053
- key: 0,
1054
- size: "sm",
1055
- tone: "muted"
1056
- }, {
1057
- default: a(() => [
1058
- S(h(f.value), 1)
1059
- ]),
1060
- _: 1
1061
- })) : E("", !0),
1062
- b.value?.site && !b.value.site.configured ? (o(), y(e($e), {
1063
- key: 1,
1064
- type: "warning",
1065
- variant: "soft",
1066
- closable: !1,
1067
- description: e(d)("panel.captcha-unconfigured")
1068
- }, null, 8, ["description"])) : E("", !0)
1069
- ]),
1070
- _: 1
1071
- }));
1072
- }
1073
- }), ot = { class: "wx-inbox-embed" }, it = { class: "wx-inbox-embed__snippet" }, ut = { class: "wx-inbox-embed__snippet" }, rt = { class: "wx-inbox-embed__snippet" }, dt = /* @__PURE__ */ ae({
1074
- __name: "FormEmbed",
1075
- props: {
1076
- form: {},
1077
- slug: {},
1078
- fields: {}
1079
- },
1080
- setup(u) {
1081
- const i = u;
1082
- ue();
1083
- const r = le("webx-inbox"), d = oe(), m = x(
1084
- () => d.state.manifest?.modules.some((k) => k.id === "blocks") ?? !1
1085
- ), w = x(() => `<x-webx-inbox::form slug="${i.slug}" />`), s = x(
1086
- () => m.value ? w.value : `{{-- resources/views/blocks/contact.blade.php --}}
1087
- <x-webx-inbox::form slug="${i.slug}" />`
1088
- ), l = x(
1089
- () => i.fields.find((k) => k.type === "hidden" && k.is_enabled)?.key ?? "page"
1090
- ), $ = x(
1091
- () => `<x-webx-inbox::form slug="${i.slug}" :values="['${l.value}' => url()->current()]" />
1092
- <x-webx-inbox::form slug="${i.slug}" placement="footer" />`
1093
- ), b = x(() => [
1094
- { key: "key", label: r("fields.name") },
1095
- { key: "title", label: r("fields.title") },
1096
- { key: "type", label: r("fields.type"), hideBelow: 520 }
1097
- ]), f = x(() => i.fields.filter((k) => k.is_enabled));
1098
- async function A(k) {
1099
- try {
1100
- await navigator.clipboard.writeText(k), X.success(r("panel.copied"));
1101
- } catch {
1102
- }
1103
- }
1104
- return (k, U) => (o(), D("div", ot, [
1105
- t(e(te), {
1106
- title: e(r)("panel.embed-blade")
1107
- }, {
1108
- default: a(() => [
1109
- t(e(j), {
1110
- size: "sm",
1111
- tone: "muted"
1112
- }, {
1113
- default: a(() => [
1114
- S(h(e(r)("panel.embed-blade-help")), 1)
1115
- ]),
1116
- _: 1
1117
- }),
1118
- L("div", it, [
1119
- L("code", null, h(w.value), 1),
1120
- t(e(he), {
1121
- icon: "copy",
1122
- title: e(r)("panel.copy"),
1123
- onClick: U[0] || (U[0] = (c) => A(w.value))
1124
- }, null, 8, ["title"])
1125
- ])
1126
- ]),
1127
- _: 1
1128
- }, 8, ["title"]),
1129
- t(e(te), {
1130
- title: e(r)("panel.embed-block")
1131
- }, {
1132
- default: a(() => [
1133
- t(e(j), {
1134
- size: "sm",
1135
- tone: "muted"
1136
- }, {
1137
- default: a(() => [
1138
- S(h(e(r)(m.value ? "panel.embed-block-panel-help" : "panel.embed-block-help")), 1)
1139
- ]),
1140
- _: 1
1141
- }),
1142
- L("div", ut, [
1143
- L("code", null, h(s.value), 1),
1144
- t(e(he), {
1145
- icon: "copy",
1146
- title: e(r)("panel.copy"),
1147
- onClick: U[1] || (U[1] = (c) => A(s.value))
1148
- }, null, 8, ["title"])
1149
- ])
1150
- ]),
1151
- _: 1
1152
- }, 8, ["title"]),
1153
- t(e(te), {
1154
- title: e(r)("panel.embed-extras")
1155
- }, {
1156
- default: a(() => [
1157
- t(e(j), {
1158
- size: "sm",
1159
- tone: "muted"
1160
- }, {
1161
- default: a(() => [
1162
- S(h(e(r)("panel.embed-extras-help")), 1)
1163
- ]),
1164
- _: 1
1165
- }),
1166
- L("div", rt, [
1167
- L("code", null, h($.value), 1),
1168
- t(e(he), {
1169
- icon: "copy",
1170
- title: e(r)("panel.copy"),
1171
- onClick: U[2] || (U[2] = (c) => A($.value))
1172
- }, null, 8, ["title"])
1173
- ])
1174
- ]),
1175
- _: 1
1176
- }, 8, ["title"]),
1177
- t(e(te), {
1178
- title: e(r)("panel.embed-names")
1179
- }, {
1180
- default: a(() => [
1181
- t(e(j), {
1182
- size: "sm",
1183
- tone: "muted"
1184
- }, {
1185
- default: a(() => [
1186
- S(h(e(r)("panel.embed-names-help")), 1)
1187
- ]),
1188
- _: 1
1189
- }),
1190
- t(e(bl), {
1191
- data: f.value,
1192
- columns: b.value,
1193
- "row-key": "id",
1194
- flush: "",
1195
- "empty-text": e(r)("fields.no-fields")
1196
- }, {
1197
- "cell-key": a(({ row: c }) => [
1198
- t(e(j), {
1199
- mono: "",
1200
- size: "sm"
1201
- }, {
1202
- default: a(() => [
1203
- S("fields[" + h(c.key) + "]", 1)
1204
- ]),
1205
- _: 2
1206
- }, 1024)
1207
- ]),
1208
- "cell-title": a(({ row: c }) => [
1209
- S(h(Object.values(c.title)[0] ?? c.key), 1)
1210
- ]),
1211
- "cell-type": a(({ row: c }) => [
1212
- S(h(e(r)(`fields.type-${c.type}`)), 1)
1213
- ]),
1214
- _: 1
1215
- }, 8, ["data", "columns", "empty-text"])
1216
- ]),
1217
- _: 1
1218
- }, 8, ["title"])
1219
- ]));
1220
- }
1221
- }), ct = /* @__PURE__ */ ie(dt, [["__scopeId", "data-v-7f9788ed"]]), pt = { class: "wx-inbox-general" }, mt = /* @__PURE__ */ ae({
1222
- __name: "FormGeneral",
1223
- props: /* @__PURE__ */ Ce({
1224
- errors: {}
1225
- }, {
1226
- settings: { required: !0 },
1227
- settingsModifiers: {},
1228
- options: { required: !0 },
1229
- optionsModifiers: {}
1230
- }),
1231
- emits: ["update:settings", "update:options"],
1232
- setup(u) {
1233
- const i = Ve(
1234
- u,
1235
- "settings"
1236
- ), r = Ve(u, "options"), d = le("webx-inbox"), m = de(r, "thank-you.heading", {}), w = de(r, "thank-you.text", {}), s = de(r, "design.submit-text", {}), l = de(r, "redirect", "");
1237
- return ($, b) => (o(), D("div", pt, [
1238
- t(e(te), null, {
1239
- default: a(() => [
1240
- t(e(G), {
1241
- label: e(d)("panel.title"),
1242
- error: u.errors.title?.[0],
1243
- required: ""
1244
- }, {
1245
- default: a(() => [
1246
- t(e(J), {
1247
- modelValue: i.value.title,
1248
- "onUpdate:modelValue": b[0] || (b[0] = (f) => i.value.title = f),
1249
- localized: ""
1250
- }, null, 8, ["modelValue"])
1251
- ]),
1252
- _: 1
1253
- }, 8, ["label", "error"]),
1254
- t(e(G), {
1255
- label: e(d)("panel.slug"),
1256
- help: e(d)("panel.slug-help"),
1257
- error: u.errors.slug?.[0],
1258
- required: ""
1259
- }, {
1260
- default: a(() => [
1261
- t(e(J), {
1262
- modelValue: i.value.slug,
1263
- "onUpdate:modelValue": b[1] || (b[1] = (f) => i.value.slug = f),
1264
- placeholder: "contact"
1265
- }, null, 8, ["modelValue"])
1266
- ]),
1267
- _: 1
1268
- }, 8, ["label", "help", "error"]),
1269
- t(e(G), {
1270
- help: e(d)("panel.is-enabled-help")
1271
- }, {
1272
- default: a(() => [
1273
- t(e(vl), {
1274
- modelValue: i.value.is_enabled,
1275
- "onUpdate:modelValue": b[2] || (b[2] = (f) => i.value.is_enabled = f),
1276
- label: e(d)("panel.is-enabled")
1277
- }, null, 8, ["modelValue", "label"])
1278
- ]),
1279
- _: 1
1280
- }, 8, ["help"])
1281
- ]),
1282
- _: 1
1283
- }),
1284
- t(e(te), {
1285
- title: e(d)("panel.after-sending")
1286
- }, {
1287
- default: a(() => [
1288
- t(e(G), {
1289
- label: e(d)("panel.submit-text")
1290
- }, {
1291
- default: a(() => [
1292
- t(e(J), {
1293
- modelValue: e(s),
1294
- "onUpdate:modelValue": b[3] || (b[3] = (f) => se(s) ? s.value = f : null),
1295
- localized: ""
1296
- }, null, 8, ["modelValue"])
1297
- ]),
1298
- _: 1
1299
- }, 8, ["label"]),
1300
- t(e(G), {
1301
- label: e(d)("panel.thank-you-heading")
1302
- }, {
1303
- default: a(() => [
1304
- t(e(J), {
1305
- modelValue: e(m),
1306
- "onUpdate:modelValue": b[4] || (b[4] = (f) => se(m) ? m.value = f : null),
1307
- localized: ""
1308
- }, null, 8, ["modelValue"])
1309
- ]),
1310
- _: 1
1311
- }, 8, ["label"]),
1312
- t(e(G), {
1313
- label: e(d)("panel.thank-you-text")
1314
- }, {
1315
- default: a(() => [
1316
- t(hl, {
1317
- modelValue: e(w),
1318
- "onUpdate:modelValue": b[5] || (b[5] = (f) => se(w) ? w.value = f : null)
1319
- }, null, 8, ["modelValue"])
1320
- ]),
1321
- _: 1
1322
- }, 8, ["label"]),
1323
- t(e(G), {
1324
- label: e(d)("panel.redirect"),
1325
- help: e(d)("panel.redirect-help")
1326
- }, {
1327
- default: a(() => [
1328
- t(e(J), {
1329
- modelValue: e(l),
1330
- "onUpdate:modelValue": b[6] || (b[6] = (f) => se(l) ? l.value = f : null),
1331
- placeholder: "/thank-you"
1332
- }, null, 8, ["modelValue"])
1333
- ]),
1334
- _: 1
1335
- }, 8, ["label", "help"])
1336
- ]),
1337
- _: 1
1338
- }, 8, ["title"])
1339
- ]));
1340
- }
1341
- }), ft = /* @__PURE__ */ ie(mt, [["__scopeId", "data-v-1932aefe"]]), vt = /^[^\s@]+@[^\s@]+$/;
1342
- function Oe(u) {
1343
- return "admin_id" in u;
1344
- }
1345
- function yl(u, i = []) {
1346
- return Oe(u) ? i.find(
1347
- (d) => d.type === "admin" && d.admin_id === u.admin_id
1348
- )?.problem ?? null : vt.test((u.email ?? "").trim()) ? null : "invalid_email";
1349
- }
1350
- function bt(u, i = []) {
1351
- return (u ?? []).some((r) => yl(r, i) === null);
1352
- }
1353
- const ht = { class: "wx-inbox-notifications" }, yt = { class: "wx-inbox-recipients" }, gt = { class: "wx-inbox-recipients__row" }, _t = { class: "wx-inbox-channels" }, xt = /* @__PURE__ */ ae({
1354
- __name: "FormNotifications",
1355
- props: /* @__PURE__ */ Ce({
1356
- fields: {},
1357
- errors: {},
1358
- reported: {},
1359
- notifications: { type: Boolean }
1360
- }, {
1361
- modelValue: { required: !0 },
1362
- modelModifiers: {}
1363
- }),
1364
- emits: ["update:modelValue"],
1365
- setup(u) {
1366
- const i = u, r = Ve(u, "modelValue"), d = oe(), m = ce(d), w = le("webx-inbox"), s = F([]), l = de(r, "recipients", []), $ = de(r, "email_field", ""), b = de(r, "notify_channels", []), f = Fe(), A = x(() => d.can("notifications.manage")), k = x(() => `${d.basePath}/notifications`.replace(/\/{2,}/g, "/"));
1367
- function U(T) {
1368
- T.metaKey || T.ctrlKey || T.shiftKey || T.button !== 0 || (T.preventDefault(), f.push("/notifications"));
1369
- }
1370
- xl(async () => {
1371
- try {
1372
- s.value = await m.recipients();
1373
- } catch {
1374
- }
1375
- });
1376
- const c = x(
1377
- () => s.value.map((T) => ({ value: T.id, label: `${T.name} · ${T.email}` }))
1378
- ), q = x(() => [
1379
- { value: "", label: w("panel.no-email-field") },
1380
- ...i.fields.filter((T) => T.type === "email").map((T) => ({ value: T.key, label: T.key }))
1381
- ]);
1382
- function V(T) {
1383
- if (!Oe(T)) return null;
1384
- const g = yl(T, i.reported);
1385
- return g === null ? null : w(`panel.recipient-${g}`);
1386
- }
1387
- function W(T) {
1388
- l.value = [...l.value, T];
1389
- }
1390
- async function I(T) {
1391
- const g = l.value[T];
1392
- g !== void 0 && (Oe(g) || (g.email ?? "").trim() !== "") && !await Ue({
1393
- title: w("panel.remove-recipient-title"),
1394
- message: w("panel.remove-recipient-text"),
1395
- confirmText: w("panel.remove"),
1396
- cancelText: w("panel.cancel"),
1397
- tone: "danger"
1398
- }) || (l.value = l.value.filter((N, v) => v !== T));
1399
- }
1400
- function R(T, g) {
1401
- l.value = l.value.map((z, N) => N === T ? { admin_id: g } : z);
1402
- }
1403
- function M(T, g) {
1404
- l.value = l.value.map((z, N) => N === T ? { email: g } : z);
1405
- }
1406
- return (T, g) => (o(), D("div", ht, [
1407
- t(e(te), {
1408
- title: e(w)("panel.recipients")
1409
- }, {
1410
- default: a(() => [
1411
- t(e(j), {
1412
- size: "sm",
1413
- tone: "muted"
1414
- }, {
1415
- default: a(() => [
1416
- S(h(e(w)("panel.recipients-help")), 1)
1417
- ]),
1418
- _: 1
1419
- }),
1420
- u.errors["options.recipients"] ? (o(), y(e($e), {
1421
- key: 0,
1422
- type: "danger",
1423
- variant: "soft",
1424
- description: u.errors["options.recipients"]?.[0]
1425
- }, null, 8, ["description"])) : E("", !0),
1426
- L("div", yt, [
1427
- e(l).length === 0 ? (o(), y(e(j), {
1428
- key: 0,
1429
- size: "sm",
1430
- tone: "placeholder"
1431
- }, {
1432
- default: a(() => [
1433
- S(h(e(w)("panel.no-recipients")), 1)
1434
- ]),
1435
- _: 1
1436
- })) : E("", !0),
1437
- (o(!0), D(Q, null, fe(e(l), (z, N) => (o(), D("div", {
1438
- key: N,
1439
- class: "wx-inbox-recipients__item"
1440
- }, [
1441
- L("div", gt, [
1442
- e(Oe)(z) ? (o(), y(e(pe), {
1443
- key: 0,
1444
- "model-value": z.admin_id,
1445
- options: c.value,
1446
- "onUpdate:modelValue": (v) => R(N, Number(v))
1447
- }, null, 8, ["model-value", "options", "onUpdate:modelValue"])) : (o(), y(e(J), {
1448
- key: 1,
1449
- "model-value": z.email,
1450
- type: "email",
1451
- placeholder: "sales@example.com",
1452
- "onUpdate:modelValue": (v) => M(N, String(v))
1453
- }, null, 8, ["model-value", "onUpdate:modelValue"])),
1454
- t(e(he), {
1455
- icon: "trash",
1456
- tone: "danger",
1457
- title: e(w)("panel.remove"),
1458
- onClick: (v) => I(N)
1459
- }, null, 8, ["title", "onClick"])
1460
- ]),
1461
- V(z) ? (o(), y(e(j), {
1462
- key: 0,
1463
- size: "sm",
1464
- tone: "danger"
1465
- }, {
1466
- default: a(() => [
1467
- S(h(V(z)), 1)
1468
- ]),
1469
- _: 2
1470
- }, 1024)) : E("", !0)
1471
- ]))), 128))
1472
- ]),
1473
- t(e(qe), { size: "sm" }, {
1474
- default: a(() => [
1475
- t(e(ee), {
1476
- variant: "outline",
1477
- icon: "user",
1478
- disabled: c.value.length === 0,
1479
- onClick: g[0] || (g[0] = (z) => W({ admin_id: Number(c.value[0]?.value) }))
1480
- }, {
1481
- default: a(() => [
1482
- S(h(e(w)("panel.add-admin")), 1)
1483
- ]),
1484
- _: 1
1485
- }, 8, ["disabled"]),
1486
- t(e(ee), {
1487
- variant: "outline",
1488
- onClick: g[1] || (g[1] = (z) => W({ email: "" }))
1489
- }, {
1490
- icon: a(() => [
1491
- t(e(ge), { name: "mail" })
1492
- ]),
1493
- default: a(() => [
1494
- S(" " + h(e(w)("panel.add-email")), 1)
1495
- ]),
1496
- _: 1
1497
- })
1498
- ]),
1499
- _: 1
1500
- }),
1501
- t(e(G), {
1502
- label: e(w)("panel.email-field"),
1503
- help: e(w)("panel.email-field-help"),
1504
- error: u.errors["options.email_field"]?.[0]
1505
- }, {
1506
- default: a(() => [
1507
- t(e(pe), {
1508
- modelValue: e($),
1509
- "onUpdate:modelValue": g[2] || (g[2] = (z) => se($) ? $.value = z : null),
1510
- options: q.value
1511
- }, null, 8, ["modelValue", "options"])
1512
- ]),
1513
- _: 1
1514
- }, 8, ["label", "help", "error"])
1515
- ]),
1516
- _: 1
1517
- }, 8, ["title"]),
1518
- i.notifications ? (o(), y(e(te), {
1519
- key: 0,
1520
- title: e(w)("panel.notify-through")
1521
- }, {
1522
- default: a(() => [
1523
- t(e(j), {
1524
- size: "sm",
1525
- tone: "muted"
1526
- }, {
1527
- default: a(() => [
1528
- S(h(e(w)("panel.notify-through-help")), 1)
1529
- ]),
1530
- _: 1
1531
- }),
1532
- L("div", _t, [
1533
- t(e($l), {
1534
- modelValue: e(b),
1535
- "onUpdate:modelValue": g[3] || (g[3] = (z) => se(b) ? b.value = z : null),
1536
- target: "notify-inbox-submission",
1537
- sortable: !1,
1538
- "add-text": e(w)("panel.pick-channels"),
1539
- "empty-text": e(w)("panel.no-channels")
1540
- }, null, 8, ["modelValue", "add-text", "empty-text"]),
1541
- A.value ? (o(), y(e(Wl), {
1542
- key: 0,
1543
- href: k.value,
1544
- size: "sm",
1545
- onClick: U
1546
- }, {
1547
- default: a(() => [
1548
- S(h(e(w)("panel.set-up-channels")), 1)
1549
- ]),
1550
- _: 1
1551
- }, 8, ["href"])) : E("", !0)
1552
- ])
1553
- ]),
1554
- _: 1
1555
- }, 8, ["title"])) : E("", !0)
1556
- ]));
1557
- }
1558
- }), wt = /* @__PURE__ */ ie(xt, [["__scopeId", "data-v-ee478a8e"]]), kt = { class: "wx-inbox-editor" }, Vt = /* @__PURE__ */ ae({
1559
- __name: "FormEditorPage",
1560
- props: {
1561
- base: { default: "/inbox" }
1562
- },
1563
- setup(u) {
1564
- const i = u, r = oe(), d = ce(r), m = Le(), w = Fe(), s = xe();
1565
- ue();
1566
- const l = le("webx-inbox"), $ = me(), b = F(null), f = F([]), A = F(!0), k = F(!1), U = F({});
1567
- let c = wl({
1568
- slug: "",
1569
- title: {},
1570
- is_enabled: !0
1571
- });
1572
- const q = F({}), W = F(["general", "fields", "notifications", "antispam", "embed"].includes(String(m.query.tab)) ? String(m.query.tab) : "general"), I = x(
1573
- () => c.is_enabled && !bt(q.value.recipients, b.value?.recipients) && !R.value
1574
- ), R = x(() => {
1575
- if (b.value?.notifications !== !0) return !1;
1576
- const H = b.value.channels ?? [];
1577
- return (q.value.notify_channels ?? []).some(
1578
- (K) => H.find((Y) => Y.id === K)?.sends ?? !0
1579
- );
1580
- }), M = x(() => r.can("inbox.manage")), T = x(() => Number(m.params.id)), g = x(
1581
- () => b.value === null ? "" : _e(c.title, s.active.value, c.slug)
1582
- ), z = x(() => `${i.base}?form=${T.value}`);
1583
- async function N() {
1584
- A.value = !0;
1585
- try {
1586
- const H = await d.form(T.value);
1587
- b.value = H, f.value = H.fields ?? [], c.slug = H.slug, c.title = { ...H.title }, c.is_enabled = H.is_enabled, q.value = { ...H.options };
1588
- } catch (H) {
1589
- X.danger($(H)), w.replace(i.base);
1590
- } finally {
1591
- A.value = !1;
1592
- }
1593
- }
1594
- Te(T, () => {
1595
- N();
1596
- }, { immediate: !0 });
1597
- async function v() {
1598
- k.value = !0, U.value = {};
1599
- try {
1600
- const H = await d.saveForm(T.value, {
1601
- slug: c.slug.trim(),
1602
- title: c.title,
1603
- is_enabled: c.is_enabled,
1604
- options: q.value
1605
- });
1606
- b.value = H, X.success(l("panel.saved"));
1607
- } catch (H) {
1608
- const K = H.body;
1609
- K?.errors ? (U.value = K.errors, X.danger(l("panel.failed"))) : X.danger($(H));
1610
- } finally {
1611
- k.value = !1;
1612
- }
1613
- }
1614
- return (H, K) => (o(), D("div", kt, [
1615
- A.value ? (o(), y(e(te), { key: 0 }, {
1616
- default: a(() => [
1617
- t(e(We), {
1618
- title: "",
1619
- rows: 8
1620
- })
1621
- ]),
1622
- _: 1
1623
- })) : b.value ? (o(), D(Q, { key: 1 }, [
1624
- t(e(al), {
1625
- class: "wx-inbox-editor__head",
1626
- title: g.value,
1627
- subtitle: b.value.slug,
1628
- back: z.value,
1629
- "back-label": e(l)("panel.forms")
1630
- }, {
1631
- "title-after": a(() => [
1632
- e(c).is_enabled ? E("", !0) : (o(), y(e(ye), {
1633
- key: 0,
1634
- type: "default"
1635
- }, {
1636
- default: a(() => [
1637
- S(h(e(l)("panel.off")), 1)
1638
- ]),
1639
- _: 1
1640
- }))
1641
- ]),
1642
- _: 1
1643
- }, 8, ["title", "subtitle", "back", "back-label"]),
1644
- I.value ? (o(), y(e($e), {
1645
- key: 0,
1646
- class: "wx-inbox-editor__silent",
1647
- type: "warning",
1648
- variant: "soft",
1649
- closable: !1,
1650
- title: e(l)("panel.notifies-nobody"),
1651
- description: e(l)("panel.notifies-nobody-text")
1652
- }, null, 8, ["title", "description"])) : E("", !0),
1653
- t(e(sl), {
1654
- modelValue: W.value,
1655
- "onUpdate:modelValue": K[5] || (K[5] = (Y) => W.value = Y),
1656
- class: "wx-inbox-editor__tabs",
1657
- "keep-alive": ""
1658
- }, {
1659
- default: a(() => [
1660
- t(e(be), {
1661
- value: "general",
1662
- label: e(l)("panel.tab-general")
1663
- }, {
1664
- default: a(() => [
1665
- t(ft, {
1666
- settings: e(c),
1667
- "onUpdate:settings": K[0] || (K[0] = (Y) => se(c) ? c.value = Y : c = Y),
1668
- options: q.value,
1669
- "onUpdate:options": K[1] || (K[1] = (Y) => q.value = Y),
1670
- errors: U.value
1671
- }, null, 8, ["settings", "options", "errors"])
1672
- ]),
1673
- _: 1
1674
- }, 8, ["label"]),
1675
- t(e(be), {
1676
- value: "fields",
1677
- label: e(l)("panel.tab-fields")
1678
- }, {
1679
- default: a(() => [
1680
- t(nt, {
1681
- modelValue: f.value,
1682
- "onUpdate:modelValue": K[2] || (K[2] = (Y) => f.value = Y),
1683
- form: b.value,
1684
- "can-manage": M.value
1685
- }, null, 8, ["modelValue", "form", "can-manage"])
1686
- ]),
1687
- _: 1
1688
- }, 8, ["label"]),
1689
- t(e(be), {
1690
- value: "notifications",
1691
- label: e(l)("panel.tab-notifications")
1692
- }, {
1693
- default: a(() => [
1694
- t(wt, {
1695
- modelValue: q.value,
1696
- "onUpdate:modelValue": K[3] || (K[3] = (Y) => q.value = Y),
1697
- fields: f.value,
1698
- errors: U.value,
1699
- reported: b.value.recipients,
1700
- notifications: b.value.notifications
1701
- }, null, 8, ["modelValue", "fields", "errors", "reported", "notifications"])
1702
- ]),
1703
- _: 1
1704
- }, 8, ["label"]),
1705
- t(e(be), {
1706
- value: "antispam",
1707
- label: e(l)("panel.tab-antispam")
1708
- }, {
1709
- default: a(() => [
1710
- t(st, {
1711
- modelValue: q.value,
1712
- "onUpdate:modelValue": K[4] || (K[4] = (Y) => q.value = Y),
1713
- site: b.value.captcha
1714
- }, null, 8, ["modelValue", "site"])
1715
- ]),
1716
- _: 1
1717
- }, 8, ["label"]),
1718
- t(e(be), {
1719
- value: "embed",
1720
- label: e(l)("panel.tab-embed")
1721
- }, {
1722
- default: a(() => [
1723
- t(ct, {
1724
- form: b.value,
1725
- slug: e(c).slug,
1726
- fields: f.value
1727
- }, null, 8, ["form", "slug", "fields"])
1728
- ]),
1729
- _: 1
1730
- }, 8, ["label"])
1731
- ]),
1732
- _: 1
1733
- }, 8, ["modelValue"]),
1734
- M.value ? (o(), y(e(Fl), { key: 1 }, {
1735
- default: a(() => [
1736
- t(e(ee), {
1737
- type: "primary",
1738
- loading: k.value,
1739
- onClick: v
1740
- }, {
1741
- default: a(() => [
1742
- S(h(e(l)("panel.save")), 1)
1743
- ]),
1744
- _: 1
1745
- }, 8, ["loading"])
1746
- ]),
1747
- _: 1
1748
- })) : E("", !0)
1749
- ], 64)) : E("", !0)
1750
- ]));
1751
- }
1752
- }), $t = /* @__PURE__ */ ie(Vt, [["__scopeId", "data-v-4e3d1a4c"]]), Tt = { class: "wx-inbox-form-field" }, St = {
1753
- key: 0,
1754
- class: "wx-inbox-form-field__chosen"
1755
- }, Ct = { class: "wx-inbox-form-field__text" }, Ut = { class: "wx-inbox-form-field__title" }, zt = {
1756
- key: 0,
1757
- class: "wx-inbox-form-field__slug"
1758
- }, At = {
1759
- key: 1,
1760
- class: "wx-inbox-form-field__empty"
1761
- }, Wt = { class: "wx-inbox-form-field__search" }, Ft = /* @__PURE__ */ ae({
1762
- name: "WxInboxFormField",
1763
- __name: "FormField",
1764
- props: /* @__PURE__ */ Ce({
1765
- disabled: { type: Boolean, default: !1 },
1766
- placeholder: { default: void 0 },
1767
- emptyText: { default: void 0 }
1768
- }, {
1769
- modelValue: { default: null },
1770
- modelModifiers: {}
1771
- }),
1772
- emits: ["update:modelValue"],
1773
- setup(u) {
1774
- const i = u, r = Ve(u, "modelValue");
1775
- ue();
1776
- const d = oe(), m = le("webx-inbox"), w = Tl(d, "inbox-form"), s = x(() => typeof r.value == "string" ? r.value.trim() : ""), l = F(/* @__PURE__ */ new Map()), $ = F(/* @__PURE__ */ new Set()), b = F([]), f = F(!1), A = F("");
1777
- function k(g) {
1778
- const z = new Map(l.value);
1779
- for (const N of g) N.slug && z.set(N.slug, N);
1780
- l.value = z;
1781
- }
1782
- async function U(g) {
1783
- if (!(g === "" || l.value.has(g) || $.value.has(g)))
1784
- try {
1785
- const z = await w.search(g);
1786
- k(z), z.some((N) => N.slug === g) || ($.value = /* @__PURE__ */ new Set([...$.value, g]));
1787
- } catch {
1788
- }
1789
- }
1790
- Te(s, (g) => {
1791
- U(g);
1792
- }, { immediate: !0 });
1793
- const c = x(() => s.value === "" ? null : l.value.get(s.value) ?? null), q = x(() => s.value === "" ? null : c.value === null ? $.value.has(s.value) ? m("relations.field-missing") : null : c.value.visible ? null : m("relations.field-off")), V = x(
1794
- () => b.value.filter((g) => g.slug && g.slug !== s.value).map((g) => ({
1795
- value: g.title,
1796
- description: [g.slug, g.visible ? null : m("relations.field-off")].filter((z) => typeof z == "string" && z !== "").join(" · "),
1797
- id: g.slug
1798
- }))
1799
- );
1800
- async function W(g) {
1801
- f.value = !0;
1802
- try {
1803
- const z = await w.search(g);
1804
- b.value = z, k(z);
1805
- } catch {
1806
- b.value = [];
1807
- } finally {
1808
- f.value = !1;
1809
- }
1810
- }
1811
- function I() {
1812
- b.value.length === 0 && !f.value && W(A.value);
1813
- }
1814
- function R(g) {
1815
- typeof g.id != "string" || g.id === "" || (r.value = g.id, kl(() => {
1816
- A.value = "";
1817
- }));
1818
- }
1819
- function M() {
1820
- r.value = null;
1821
- }
1822
- const T = x(() => i.placeholder ?? m("relations.field-search"));
1823
- return (g, z) => (o(), D("div", Tt, [
1824
- s.value !== "" ? (o(), D("div", St, [
1825
- L("span", Ct, [
1826
- L("span", Ut, h(c.value?.title ?? s.value), 1),
1827
- c.value ? (o(), D("span", zt, h(s.value), 1)) : E("", !0)
1828
- ]),
1829
- q.value ? (o(), y(e(ye), {
1830
- key: 0,
1831
- type: "warning"
1832
- }, {
1833
- default: a(() => [
1834
- S(h(q.value), 1)
1835
- ]),
1836
- _: 1
1837
- })) : E("", !0),
1838
- i.disabled ? E("", !0) : (o(), y(e(he), {
1839
- key: 1,
1840
- type: "remove",
1841
- size: "sm",
1842
- title: e(m)("relations.field-remove"),
1843
- onClick: M
1844
- }, null, 8, ["title"]))
1845
- ])) : (o(), D("p", At, h(i.emptyText ?? e(m)("relations.field-empty")), 1)),
1846
- L("div", Wt, [
1847
- t(e(ql), {
1848
- modelValue: A.value,
1849
- "onUpdate:modelValue": z[0] || (z[0] = (N) => A.value = N),
1850
- options: V.value,
1851
- remote: "",
1852
- teleport: "",
1853
- loading: f.value,
1854
- "loading-text": e(m)("relations.field-searching"),
1855
- "empty-text": e(m)("relations.field-nothing"),
1856
- placeholder: T.value,
1857
- "aria-label": T.value,
1858
- disabled: i.disabled,
1859
- onSearch: W,
1860
- onOpen: I,
1861
- onSelect: R
1862
- }, null, 8, ["modelValue", "options", "loading", "loading-text", "empty-text", "placeholder", "aria-label", "disabled"])
1863
- ])
1864
- ]));
1865
- }
1866
- }), qt = /* @__PURE__ */ ie(Ft, [["__scopeId", "data-v-91f60441"]]), Nt = { class: "wx-inbox-create" }, It = /* @__PURE__ */ ae({
1867
- __name: "FormCreateDialog",
1868
- setup(u) {
1869
- const { resolve: i, dismiss: r, open: d } = He(), m = oe(), w = ce(m);
1870
- ue();
1871
- const s = le("webx-inbox"), l = me(), $ = F({}), b = F(""), f = F(!1), A = F({});
1872
- function k(c) {
1873
- return A.value[c]?.[0];
1874
- }
1875
- async function U() {
1876
- f.value = !0, A.value = {};
1877
- try {
1878
- i(
1879
- await w.createForm({
1880
- title: $.value,
1881
- slug: b.value.trim(),
1882
- is_enabled: !0,
1883
- options: {}
1884
- })
1885
- );
1886
- } catch (c) {
1887
- const q = c.body;
1888
- q?.errors ? (A.value = q.errors, X.danger(s("panel.failed"))) : X.danger(l(c));
1889
- } finally {
1890
- f.value = !1;
1891
- }
1892
- }
1893
- return (c, q) => (o(), y(e(Xe), {
1894
- open: e(d),
1895
- "onUpdate:open": q[3] || (q[3] = (V) => se(d) ? d.value = V : null),
1896
- title: e(s)("panel.new-form-title"),
1897
- width: 520
1898
- }, {
1899
- footer: a(() => [
1900
- t(e(qe), { size: "sm" }, {
1901
- default: a(() => [
1902
- t(e(ee), {
1903
- variant: "outline",
1904
- onClick: q[2] || (q[2] = (V) => e(r)())
1905
- }, {
1906
- default: a(() => [
1907
- S(h(e(s)("panel.cancel")), 1)
1908
- ]),
1909
- _: 1
1910
- }),
1911
- t(e(ee), {
1912
- type: "primary",
1913
- loading: f.value,
1914
- onClick: U
1915
- }, {
1916
- default: a(() => [
1917
- S(h(e(s)("panel.save")), 1)
1918
- ]),
1919
- _: 1
1920
- }, 8, ["loading"])
1921
- ]),
1922
- _: 1
1923
- })
1924
- ]),
1925
- default: a(() => [
1926
- L("div", Nt, [
1927
- t(e(G), {
1928
- label: e(s)("panel.title"),
1929
- error: k("title"),
1930
- required: ""
1931
- }, {
1932
- default: a(() => [
1933
- t(e(J), {
1934
- modelValue: $.value,
1935
- "onUpdate:modelValue": q[0] || (q[0] = (V) => $.value = V),
1936
- localized: "",
1937
- autofocus: ""
1938
- }, null, 8, ["modelValue"])
1939
- ]),
1940
- _: 1
1941
- }, 8, ["label", "error"]),
1942
- t(e(G), {
1943
- label: e(s)("panel.slug"),
1944
- help: e(s)("panel.slug-help"),
1945
- error: k("slug")
1946
- }, {
1947
- default: a(() => [
1948
- t(e(J), {
1949
- modelValue: b.value,
1950
- "onUpdate:modelValue": q[1] || (q[1] = (V) => b.value = V),
1951
- placeholder: "contact"
1952
- }, null, 8, ["modelValue"])
1953
- ]),
1954
- _: 1
1955
- }, 8, ["label", "help", "error"])
1956
- ])
1957
- ]),
1958
- _: 1
1959
- }, 8, ["open", "title"]));
1960
- }
1961
- }), Et = /* @__PURE__ */ ie(It, [["__scopeId", "data-v-55fb40d8"]]), Mt = { class: "wx-inbox-by-hand" }, Pt = /* @__PURE__ */ ae({
1962
- __name: "SubmissionCreateDialog",
1963
- props: {
1964
- form: {}
1965
- },
1966
- setup(u) {
1967
- const i = u, { resolve: r, dismiss: d, open: m } = He(), w = oe(), s = ce(w), l = xe();
1968
- ue();
1969
- const $ = le("webx-inbox"), b = me(), f = F([]), A = F(!0), k = F(!1), U = F({}), c = F({}), q = x(() => f.value.filter((z) => z.type !== "file")), V = x(() => f.value.some((z) => z.type === "file"));
1970
- function W(z) {
1971
- return c.value[`fields.${z.key}`]?.[0];
1972
- }
1973
- function I(z) {
1974
- return _e(z.title, l.active.value, z.key);
1975
- }
1976
- function R(z, N = "") {
1977
- return _e(
1978
- z,
1979
- l.active.value,
1980
- N
1981
- );
1982
- }
1983
- function M(z) {
1984
- return (z.options.choices ?? []).map((N) => ({
1985
- value: N.value,
1986
- label: R(N.label, N.value)
1987
- }));
1988
- }
1989
- async function T() {
1990
- try {
1991
- const z = await s.form(i.form.id);
1992
- f.value = (z.fields ?? []).filter((N) => N.is_enabled);
1993
- for (const N of f.value)
1994
- U.value[N.key] = N.type === "checkbox" ? [] : N.type === "consent" ? !1 : "";
1995
- } catch (z) {
1996
- X.danger(b(z));
1997
- } finally {
1998
- A.value = !1;
1999
- }
2000
- }
2001
- T();
2002
- async function g() {
2003
- k.value = !0, c.value = {};
2004
- try {
2005
- r(await s.createSubmission(i.form.id, U.value));
2006
- } catch (z) {
2007
- const N = z.body;
2008
- N?.errors ? (c.value = N.errors, X.danger($("panel.failed"))) : X.danger(b(z));
2009
- } finally {
2010
- k.value = !1;
2011
- }
2012
- }
2013
- return (z, N) => (o(), y(e(Xe), {
2014
- open: e(m),
2015
- "onUpdate:open": N[1] || (N[1] = (v) => se(m) ? m.value = v : null),
2016
- title: e($)("panel.new-submission-title"),
2017
- width: 560
2018
- }, {
2019
- footer: a(() => [
2020
- t(e(qe), { size: "sm" }, {
2021
- default: a(() => [
2022
- t(e(ee), {
2023
- variant: "outline",
2024
- onClick: N[0] || (N[0] = (v) => e(d)())
2025
- }, {
2026
- default: a(() => [
2027
- S(h(e($)("panel.cancel")), 1)
2028
- ]),
2029
- _: 1
2030
- }),
2031
- t(e(ee), {
2032
- type: "primary",
2033
- loading: k.value,
2034
- disabled: A.value,
2035
- onClick: g
2036
- }, {
2037
- default: a(() => [
2038
- S(h(e($)("panel.save")), 1)
2039
- ]),
2040
- _: 1
2041
- }, 8, ["loading", "disabled"])
2042
- ]),
2043
- _: 1
2044
- })
2045
- ]),
2046
- default: a(() => [
2047
- L("div", Mt, [
2048
- t(e($e), {
2049
- type: "info",
2050
- closable: !1
2051
- }, {
2052
- default: a(() => [
2053
- S(h(e($)("panel.new-submission-help")), 1)
2054
- ]),
2055
- _: 1
2056
- }),
2057
- A.value ? (o(), y(e(We), {
2058
- key: 0,
2059
- rows: 4
2060
- })) : (o(), D(Q, { key: 1 }, [
2061
- (o(!0), D(Q, null, fe(q.value, (v) => (o(), y(e(G), {
2062
- key: v.id,
2063
- label: I(v),
2064
- help: R(v.help),
2065
- error: W(v),
2066
- required: v.is_required
2067
- }, {
2068
- default: a(() => [
2069
- v.type === "textarea" ? (o(), y(e(Nl), {
2070
- key: 0,
2071
- modelValue: U.value[v.key],
2072
- "onUpdate:modelValue": (H) => U.value[v.key] = H,
2073
- rows: v.options.rows ?? 4,
2074
- placeholder: R(v.placeholder)
2075
- }, null, 8, ["modelValue", "onUpdate:modelValue", "rows", "placeholder"])) : v.type === "select" ? (o(), y(e(pe), {
2076
- key: 1,
2077
- modelValue: U.value[v.key],
2078
- "onUpdate:modelValue": (H) => U.value[v.key] = H,
2079
- options: M(v),
2080
- clearable: "",
2081
- placeholder: R(v.placeholder)
2082
- }, null, 8, ["modelValue", "onUpdate:modelValue", "options", "placeholder"])) : v.type === "radio" ? (o(), y(e(Il), {
2083
- key: 2,
2084
- modelValue: U.value[v.key],
2085
- "onUpdate:modelValue": (H) => U.value[v.key] = H,
2086
- options: M(v)
2087
- }, null, 8, ["modelValue", "onUpdate:modelValue", "options"])) : v.type === "checkbox" ? (o(), y(e(El), {
2088
- key: 3,
2089
- modelValue: U.value[v.key],
2090
- "onUpdate:modelValue": (H) => U.value[v.key] = H,
2091
- options: M(v)
2092
- }, null, 8, ["modelValue", "onUpdate:modelValue", "options"])) : v.type === "consent" ? (o(), y(e(ve), {
2093
- key: 4,
2094
- modelValue: U.value[v.key],
2095
- "onUpdate:modelValue": (H) => U.value[v.key] = H,
2096
- label: R(v.options.text, I(v))
2097
- }, null, 8, ["modelValue", "onUpdate:modelValue", "label"])) : v.type === "date" ? (o(), y(e(tl), {
2098
- key: 5,
2099
- modelValue: U.value[v.key],
2100
- "onUpdate:modelValue": (H) => U.value[v.key] = H,
2101
- placeholder: R(v.placeholder)
2102
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : (o(), y(e(J), {
2103
- key: 6,
2104
- modelValue: U.value[v.key],
2105
- "onUpdate:modelValue": (H) => U.value[v.key] = H,
2106
- type: v.type === "email" ? "email" : v.type === "tel" ? "tel" : "text",
2107
- placeholder: R(v.placeholder),
2108
- maxlength: v.options.maxlength
2109
- }, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "maxlength"]))
2110
- ]),
2111
- _: 2
2112
- }, 1032, ["label", "help", "error", "required"]))), 128)),
2113
- V.value ? (o(), y(e($e), {
2114
- key: 0,
2115
- type: "warning",
2116
- closable: !1
2117
- }, {
2118
- default: a(() => [
2119
- S(h(e($)("panel.no-files-by-hand")), 1)
2120
- ]),
2121
- _: 1
2122
- })) : E("", !0)
2123
- ], 64))
2124
- ])
2125
- ]),
2126
- _: 1
2127
- }, 8, ["open", "title"]));
2128
- }
2129
- }), Bt = /* @__PURE__ */ ie(Pt, [["__scopeId", "data-v-72006299"]]), Ot = { class: "wx-submissions__mass" }, Rt = { class: "wx-submissions__state" }, Dt = 640, Lt = /* @__PURE__ */ ae({
2130
- __name: "SubmissionList",
2131
- props: {
2132
- form: {},
2133
- base: { default: "/inbox" }
2134
- },
2135
- emits: ["changed"],
2136
- setup(u, { expose: i, emit: r }) {
2137
- const d = u, m = r, w = oe(), s = ce(w), l = Le(), $ = Fe(), b = xe();
2138
- ue();
2139
- const f = ml("root"), A = Ml(f), k = x(() => A.value > 0 && A.value < Dt), U = x(() => k.value ? Number.POSITIVE_INFINITY : 0), c = le("webx-inbox"), q = le("webx-admin"), V = me(), W = F(null), I = F([]), R = F(!1), M = F([]), T = F(!1), g = x(() => w.can("inbox.update")), z = Ge(Bt), N = x({
2140
- get: () => typeof l.query.view == "string" && l.query.view !== "" ? l.query.view : "all",
2141
- set: (n) => {
2142
- $.replace({
2143
- query: { ...l.query, view: n === "all" ? void 0 : n, page: void 0 }
2144
- });
2145
- }
2146
- }), v = x(() => ({
2147
- view: N.value,
2148
- search: typeof l.query.search == "string" ? l.query.search : "",
2149
- assignee: typeof l.query.assignee == "string" ? l.query.assignee : null,
2150
- placement: typeof l.query.placement == "string" ? l.query.placement : null,
2151
- sort: typeof l.query.sort == "string" ? l.query.sort : null,
2152
- page: Number(l.query.page ?? 1) || 1
2153
- })), H = x(
2154
- () => (W.value?.placements ?? []).map(
2155
- (n) => n === null ? { value: "none", label: c("panel.placement-none") } : { value: n, label: n }
2156
- )
2157
- ), K = x(
2158
- () => H.value.length > 1 || v.value.placement !== null
2159
- ), Y = x(() => {
2160
- const n = v.value.placement;
2161
- if (n === null) return [];
2162
- const O = H.value.find((p) => p.value === n)?.label ?? (n === "none" ? c("panel.placement-none") : n);
2163
- return [
2164
- {
2165
- key: "placement",
2166
- label: `${c("panel.meta-placement")}: ${O}`,
2167
- clear: () => P(void 0)
2168
- }
2169
- ];
2170
- });
2171
- function P(n) {
2172
- $.replace({
2173
- query: {
2174
- ...l.query,
2175
- placement: typeof n == "string" && n !== "" ? n : void 0,
2176
- page: void 0
2177
- }
2178
- });
2179
- }
2180
- const Z = x(() => {
2181
- const n = W.value?.counts, O = [
2182
- { value: "all", label: c("panel.view-all"), badge: n?.all || void 0 },
2183
- { value: "unread", label: c("panel.view-unread"), badge: n?.unread || void 0 }
2184
- ];
2185
- for (const p of I.value)
2186
- O.push({
2187
- value: p.key,
2188
- label: re(p),
2189
- badge: n?.statuses[p.key] || void 0
2190
- });
2191
- return O;
2192
- });
2193
- function B(n, O) {
2194
- const p = W.value?.columns?.[O];
2195
- return p ? n.values[p.key] ?? "" : "";
2196
- }
2197
- const C = x(() => {
2198
- const n = W.value?.columns ?? [];
2199
- return k.value ? [{ key: "card", label: "" }] : [
2200
- ...n.map((O, p) => ({
2201
- key: `values.${O.key}`,
2202
- label: O.label,
2203
- sortable: !0,
2204
- // The first answer is what the row is recognised by and stays at any width; every one
2205
- // after it is worth less than the room it takes, so it goes a step sooner. The steps are
2206
- // wide — 640, 960 — because an answer is a sentence and not a number: two of them plus
2207
- // the status and the date is already what a 755px pane holds without scrolling sideways,
2208
- // which is what the pane beside the forms actually is on a 1280 screen (§11).
2209
- hideBelow: p === 0 ? void 0 : 320 + p * 320
2210
- })),
2211
- // A floor rather than a width: the cell holds a badge, sometimes an avatar and sometimes
2212
- // a paperclip, and a fixed width that any of them overflows makes the whole table scroll
2213
- // sideways by two pixels.
2214
- { key: "status", label: c("panel.status"), minWidth: 100 },
2215
- {
2216
- key: "created_at",
2217
- label: c("panel.received"),
2218
- sortable: !0,
2219
- width: 120,
2220
- // "today at 16:22" is three words the table will break over two lines given half a
2221
- // chance, and a date read down a column has to be one line to be read at all.
2222
- cellClass: "wx-submissions__when",
2223
- hideBelow: 520
2224
- // Kept on the card, unlike most dates: "when did this come in" is one of the two
2225
- // questions a submission is looked at for, and the other one is who sent it.
2226
- },
2227
- { key: "actions", label: "", width: Sl, align: "right", hideOnCards: !0 }
2228
- ];
2229
- }), _ = x(
2230
- () => v.value.view === "all" && v.value.search === "" && v.value.assignee === null && v.value.placement === null ? c("panel.submissions-empty") : c("panel.submissions-none")
2231
- ), ne = x(
2232
- () => I.value.map((n) => ({ value: n.id, label: re(n) }))
2233
- ), re = ol();
2234
- function Ke() {
2235
- return _e(d.form.title, b.active.value, d.form.slug);
2236
- }
2237
- async function Se(n) {
2238
- R.value = !0;
2239
- try {
2240
- W.value = await s.submissions(d.form.id, {
2241
- view: v.value.view,
2242
- search: n?.search ?? v.value.search,
2243
- assignee: v.value.assignee,
2244
- placement: v.value.placement,
2245
- sort: n?.sort ? `${n.sort.order === "desc" ? "-" : ""}${n.sort.key}` : null,
2246
- page: n?.page ?? v.value.page,
2247
- per_page: n?.perPage
2248
- });
2249
- } catch (O) {
2250
- X.danger(V(O));
2251
- } finally {
2252
- R.value = !1;
2253
- }
2254
- }
2255
- function Ye(n) {
2256
- const O = {
2257
- ...l.query,
2258
- search: n.search === "" ? void 0 : n.search,
2259
- sort: n.sort === null ? void 0 : `${n.sort.order === "desc" ? "-" : ""}${n.sort.key}`,
2260
- page: n.page === 1 ? void 0 : String(n.page)
2261
- };
2262
- $.replace({ query: O }), Se(n);
2263
- }
2264
- Te([() => d.form.id, N, () => v.value.assignee, () => v.value.placement], () => {
2265
- M.value = [], Se();
2266
- }), Ze();
2267
- async function Ze() {
2268
- try {
2269
- I.value = await s.statuses();
2270
- } catch (n) {
2271
- X.danger(V(n));
2272
- }
2273
- }
2274
- function Ne(n) {
2275
- $.push({ path: `${d.base}/submissions/${n.id}`, query: { ...l.query } });
2276
- }
2277
- function Ie(n) {
2278
- return g.value ? [
2279
- {
2280
- key: "read",
2281
- icon: n.is_read ? "eye-off" : "eye",
2282
- label: n.is_read ? c("panel.mark-unread") : c("panel.mark-read"),
2283
- run: () => {
2284
- ze([n.id], n.is_read ? "unread" : "read");
2285
- }
2286
- },
2287
- {
2288
- key: "delete",
2289
- icon: "trash",
2290
- label: c("panel.delete"),
2291
- danger: !0,
2292
- run: () => {
2293
- Ee([n.id]);
2294
- }
2295
- }
2296
- ] : [];
2297
- }
2298
- async function Qe(n) {
2299
- typeof n == "number" && (T.value = !0, await ze(
2300
- M.value.map((O) => O.id),
2301
- "status",
2302
- n
2303
- ), T.value = !1);
2304
- }
2305
- async function Ee(n) {
2306
- await Ue({
2307
- title: n.length === 1 ? c("panel.delete-submission-title") : c("panel.delete-selected-title", { count: n.length }),
2308
- message: c("panel.delete-submission-text"),
2309
- confirmText: c("panel.delete"),
2310
- cancelText: c("panel.cancel"),
2311
- tone: "danger"
2312
- }) && await ze(n, "delete");
2313
- }
2314
- async function ze(n, O, p) {
2315
- if (n.length !== 0)
2316
- try {
2317
- await s.massSubmissions({ ids: n, action: O, status_id: p }), M.value = [], await Se(), m("changed");
2318
- } catch (we) {
2319
- X.danger(V(we));
2320
- }
2321
- }
2322
- async function Me() {
2323
- const n = await z({ form: d.form });
2324
- n && (X.success(c("panel.created")), await Se(), m("changed"), $.push({ path: `${d.base}/submissions/${n.id}`, query: { ...l.query } }));
2325
- }
2326
- const Je = x(
2327
- () => s.exportUrl(d.form.id, {
2328
- view: v.value.view,
2329
- search: v.value.search,
2330
- assignee: v.value.assignee,
2331
- placement: v.value.placement,
2332
- sort: v.value.sort
2333
- })
2334
- ), el = x(() => [
2335
- { key: "export", label: c("panel.export"), icon: "download", href: Je.value }
2336
- ]);
2337
- return i({ create: Me }), (n, O) => (o(), D("div", {
2338
- ref_key: "root",
2339
- ref: f,
2340
- class: "wx-submissions"
2341
- }, [
2342
- t(e(al), {
2343
- class: "wx-submissions__head",
2344
- level: 3,
2345
- title: Ke(),
2346
- subtitle: u.form.slug,
2347
- actions: el.value
2348
- }, null, 8, ["title", "subtitle", "actions"]),
2349
- t(e(sl), {
2350
- modelValue: N.value,
2351
- "onUpdate:modelValue": O[2] || (O[2] = (p) => N.value = p),
2352
- class: "wx-submissions__views",
2353
- items: Z.value,
2354
- "collapse-below": 560,
2355
- "aria-label": e(c)("panel.status")
2356
- }, {
2357
- default: a(() => [
2358
- t(e(bl), {
2359
- data: W.value,
2360
- columns: C.value,
2361
- "row-key": "id",
2362
- searchable: "",
2363
- clickable: "",
2364
- hover: "",
2365
- flush: "",
2366
- loading: R.value,
2367
- "loading-text": e(c)("panel.loading"),
2368
- selectable: g.value,
2369
- "select-row-label": e(q)("filters.select-row"),
2370
- "select-all-label": e(q)("filters.select-all"),
2371
- "row-class": (p) => p.is_read ? void 0 : "is-unread",
2372
- "search-placeholder": e(c)("panel.search-submissions"),
2373
- "empty-text": _.value,
2374
- "cards-below": U.value,
2375
- "filters-count": Y.value.length,
2376
- onRowClick: Ne,
2377
- onStateChange: Ye,
2378
- onSelectionChange: O[1] || (O[1] = (p, we) => M.value = we)
2379
- }, Re({
2380
- "cell-status": a(({ row: p }) => [
2381
- L("div", Rt, [
2382
- p.status ? (o(), y(e(ye), {
2383
- key: 0,
2384
- type: p.status.color
2385
- }, {
2386
- default: a(() => [
2387
- S(h(e(re)(p.status)), 1)
2388
- ]),
2389
- _: 2
2390
- }, 1032, ["type"])) : E("", !0),
2391
- p.assignee ? (o(), y(e(rl), {
2392
- key: 1,
2393
- name: p.assignee.name,
2394
- title: p.assignee.name,
2395
- size: "xs",
2396
- tone: "auto"
2397
- }, null, 8, ["name", "title"])) : E("", !0),
2398
- p.files_count > 0 ? (o(), y(e(Bl), {
2399
- key: 2,
2400
- content: e(c)("panel.attachments")
2401
- }, {
2402
- default: a(() => [
2403
- t(e(ge), {
2404
- name: "file",
2405
- size: "sm"
2406
- })
2407
- ]),
2408
- _: 1
2409
- }, 8, ["content"])) : E("", !0)
2410
- ])
2411
- ]),
2412
- "cell-created_at": a(({ row: p }) => [
2413
- t(e(De), {
2414
- value: p.created_at,
2415
- compact: ""
2416
- }, null, 8, ["value"])
2417
- ]),
2418
- "cell-card": a(({ row: p }) => [
2419
- t(e(Pl), {
2420
- variant: "plain",
2421
- shape: "circle",
2422
- title: B(p, 0)
2423
- }, {
2424
- subtitle: a(() => [
2425
- S(h(B(p, 1)), 1)
2426
- ]),
2427
- meta: a(() => [
2428
- p.status ? (o(), y(e(ye), {
2429
- key: 0,
2430
- type: p.status.color,
2431
- size: "sm"
2432
- }, {
2433
- default: a(() => [
2434
- S(h(e(re)(p.status)), 1)
2435
- ]),
2436
- _: 2
2437
- }, 1032, ["type"])) : E("", !0),
2438
- p.assignee ? (o(), y(e(rl), {
2439
- key: 1,
2440
- name: p.assignee.name,
2441
- title: p.assignee.name,
2442
- size: "xs",
2443
- tone: "auto"
2444
- }, null, 8, ["name", "title"])) : E("", !0),
2445
- p.files_count > 0 ? (o(), y(e(ge), {
2446
- key: 2,
2447
- name: "file",
2448
- size: "sm"
2449
- })) : E("", !0),
2450
- t(e(De), {
2451
- value: p.created_at
2452
- }, null, 8, ["value"])
2453
- ]),
2454
- _: 2
2455
- }, 1032, ["title"])
2456
- ]),
2457
- "card-actions": a(({ row: p }) => [
2458
- t(e(Ae), {
2459
- actions: Ie(p),
2460
- label: String(p.id)
2461
- }, null, 8, ["actions", "label"])
2462
- ]),
2463
- "cell-actions": a(({ row: p }) => [
2464
- t(e(Ae), {
2465
- actions: Ie(p),
2466
- label: String(p.id)
2467
- }, null, 8, ["actions", "label"])
2468
- ]),
2469
- _: 2
2470
- }, [
2471
- M.value.length > 0 ? {
2472
- name: "actions",
2473
- fn: a(() => [
2474
- L("div", Ot, [
2475
- t(e(j), {
2476
- size: "sm",
2477
- weight: "medium"
2478
- }, {
2479
- default: a(() => [
2480
- S(h(e(c)("panel.selected", { count: M.value.length })), 1)
2481
- ]),
2482
- _: 1
2483
- }),
2484
- t(e(pe), {
2485
- "model-value": null,
2486
- options: ne.value,
2487
- placeholder: e(c)("panel.move-to"),
2488
- disabled: T.value,
2489
- size: "sm",
2490
- style: { width: "180px" },
2491
- "onUpdate:modelValue": Qe
2492
- }, null, 8, ["options", "placeholder", "disabled"]),
2493
- t(e(ee), {
2494
- size: "sm",
2495
- variant: "outline",
2496
- type: "danger",
2497
- icon: "trash",
2498
- onClick: O[0] || (O[0] = (p) => Ee(M.value.map((we) => we.id)))
2499
- }, {
2500
- default: a(() => [
2501
- S(h(e(c)("panel.delete")), 1)
2502
- ]),
2503
- _: 1
2504
- })
2505
- ])
2506
- ]),
2507
- key: "0"
2508
- } : void 0,
2509
- K.value ? {
2510
- name: "filters",
2511
- fn: a(() => [
2512
- t(e(G), {
2513
- label: e(c)("panel.meta-placement")
2514
- }, {
2515
- default: a(() => [
2516
- t(e(pe), {
2517
- "model-value": v.value.placement,
2518
- options: H.value,
2519
- placeholder: e(c)("panel.any-placement"),
2520
- clearable: "",
2521
- size: "sm",
2522
- "onUpdate:modelValue": P
2523
- }, null, 8, ["model-value", "options", "placeholder"])
2524
- ]),
2525
- _: 1
2526
- }, 8, ["label"])
2527
- ]),
2528
- key: "1"
2529
- } : void 0,
2530
- Y.value.length > 0 ? {
2531
- name: "applied",
2532
- fn: a(() => [
2533
- t(e(Cl), { filters: Y.value }, null, 8, ["filters"])
2534
- ]),
2535
- key: "2"
2536
- } : void 0
2537
- ]), 1032, ["data", "columns", "loading", "loading-text", "selectable", "select-row-label", "select-all-label", "row-class", "search-placeholder", "empty-text", "cards-below", "filters-count"])
2538
- ]),
2539
- _: 1
2540
- }, 8, ["modelValue", "items", "aria-label"])
2541
- ], 512));
2542
- }
2543
- }), Ht = /* @__PURE__ */ ie(Lt, [["__scopeId", "data-v-b23e9ac8"]]), Xt = ["onClick"], Gt = { class: "wx-inbox-form__name" }, jt = /* @__PURE__ */ ae({
2544
- __name: "InboxPage",
2545
- props: {
2546
- base: { default: "/inbox" }
2547
- },
2548
- setup(u) {
2549
- const i = u, r = oe(), d = ce(r), m = Le(), w = Fe(), s = xe();
2550
- ue();
2551
- const l = le("webx-inbox"), $ = me(), b = F([]), f = F(!0), A = ml("pane"), k = F(!0), U = F(!1), c = x(() => r.can("inbox.manage")), q = Ge(Et), V = x(
2552
- () => r.state.manifest?.modules.find((P) => P.id === "inbox")?.title ?? l("module.title")
2553
- ), W = x(() => {
2554
- const P = m.query.form;
2555
- return typeof P == "string" && P !== "" ? Number(P) : null;
2556
- }), I = x(() => b.value.find((P) => P.id === W.value) ?? null);
2557
- function R(P) {
2558
- return _e(P.title, s.active.value, P.slug);
2559
- }
2560
- async function M() {
2561
- f.value = !0;
2562
- try {
2563
- b.value = await d.forms();
2564
- } catch (P) {
2565
- X.danger($(P));
2566
- } finally {
2567
- f.value = !1;
2568
- }
2569
- }
2570
- M(), Te([b, I], () => {
2571
- b.value.length === 0 || I.value !== null || w.replace({ query: { ...m.query, form: String(b.value[0].id) } });
2572
- });
2573
- function T(P, Z) {
2574
- w.replace({ query: { ...m.query, form: String(P.id) } }), Z();
2575
- }
2576
- function g(P) {
2577
- w.push(`${i.base}/forms/${P.id}`);
2578
- }
2579
- function z(P) {
2580
- return c.value ? [
2581
- { key: "settings", icon: "settings", label: l("panel.settings"), run: () => g(P) },
2582
- { key: "duplicate", icon: "copy", label: l("panel.duplicate"), run: () => v(P) },
2583
- // A form that has taken submissions is switched off, never deleted (§2.4). The line is
2584
- // left out rather than greyed: a menu is a list of what is possible.
2585
- ...P.submissions_count === 0 ? [
2586
- {
2587
- key: "delete",
2588
- icon: "trash",
2589
- label: l("panel.delete"),
2590
- danger: !0,
2591
- run: () => H(P)
2592
- }
2593
- ] : []
2594
- ] : [];
2595
- }
2596
- async function N() {
2597
- const P = await q({});
2598
- P && (await M(), g(P));
2599
- }
2600
- async function v(P) {
2601
- try {
2602
- const Z = await d.duplicateForm(P.id);
2603
- X.success(l("panel.duplicated")), await M(), g(Z);
2604
- } catch (Z) {
2605
- X.danger($(Z));
2606
- }
2607
- }
2608
- async function H(P) {
2609
- if (await Ue({
2610
- title: l("panel.delete-form-title", { form: R(P) }),
2611
- message: l("panel.delete-form-text"),
2612
- confirmText: l("panel.delete"),
2613
- cancelText: l("panel.cancel"),
2614
- tone: "danger"
2615
- }))
2616
- try {
2617
- if (await d.removeForm(P.id), X.success(l("panel.deleted")), W.value === P.id) {
2618
- const B = { ...m.query };
2619
- delete B.form, w.replace({ query: B });
2620
- }
2621
- await M();
2622
- } catch (B) {
2623
- X.danger($(B));
2624
- }
2625
- }
2626
- async function K() {
2627
- try {
2628
- await d.sortForms(b.value.map((P) => P.id));
2629
- } catch (P) {
2630
- X.danger($(P, l("panel.reorder-failed"))), await M();
2631
- }
2632
- }
2633
- const Y = x(() => {
2634
- const P = [];
2635
- return c.value && P.push({
2636
- key: "statuses",
2637
- label: l("panel.statuses"),
2638
- icon: "tag",
2639
- run: () => {
2640
- w.push(`${i.base}/statuses`);
2641
- }
2642
- }), r.can("inbox.update") && I.value !== null && P.push({
2643
- key: "new-submission",
2644
- label: l("panel.new-submission"),
2645
- icon: "plus",
2646
- primary: !0,
2647
- run: () => {
2648
- A.value?.create();
2649
- }
2650
- }), P;
2651
- });
2652
- return (P, Z) => (o(), y(e(fl), {
2653
- title: V.value,
2654
- actions: Y.value,
2655
- card: !1
2656
- }, Re({
2657
- default: a(() => [
2658
- t(e(te), {
2659
- class: "wx-inbox",
2660
- padding: "none"
2661
- }, {
2662
- default: a(() => [
2663
- t(e(Ol), {
2664
- "filters-open": U.value,
2665
- "onUpdate:filtersOpen": Z[2] || (Z[2] = (B) => U.value = B),
2666
- class: "wx-inbox__panes",
2667
- "filters-width": 270,
2668
- "detail-min": 420,
2669
- "filters-title": e(l)("panel.forms"),
2670
- onFiltersInline: Z[3] || (Z[3] = (B) => k.value = B)
2671
- }, {
2672
- filters: a(({ inline: B, close: C }) => [
2673
- f.value ? (o(), y(e(We), {
2674
- key: 0,
2675
- class: "wx-inbox__loading",
2676
- rows: 5
2677
- })) : (o(), D(Q, { key: 1 }, [
2678
- !B && c.value ? (o(), y(e(ee), {
2679
- key: 0,
2680
- class: "wx-inbox__new-form",
2681
- variant: "outline",
2682
- block: "",
2683
- onClick: N
2684
- }, {
2685
- icon: a(() => [
2686
- t(e(ge), { name: "plus" })
2687
- ]),
2688
- default: a(() => [
2689
- S(" " + h(e(l)("panel.new-form")), 1)
2690
- ]),
2691
- _: 1
2692
- })) : E("", !0),
2693
- t(e(nl), {
2694
- modelValue: b.value,
2695
- "onUpdate:modelValue": Z[1] || (Z[1] = (_) => b.value = _),
2696
- class: il(["wx-inbox__forms", { "is-panel": !B }]),
2697
- plain: "",
2698
- size: "sm",
2699
- "item-key": "id",
2700
- "item-label": R,
2701
- "drag-label": e(l)("panel.reorder"),
2702
- disabled: !c.value,
2703
- title: B ? e(l)("panel.forms") : void 0,
2704
- onMove: K
2705
- }, Re({
2706
- default: a(({ item: _ }) => [
2707
- L("button", {
2708
- type: "button",
2709
- class: il(["wx-inbox-form", { "is-current": _.id === W.value, "is-off": !_.is_enabled }]),
2710
- onClick: (ne) => T(_, C)
2711
- }, [
2712
- L("span", Gt, [
2713
- t(e(j), {
2714
- truncate: "",
2715
- weight: "medium",
2716
- tone: _.is_enabled ? "default" : "muted"
2717
- }, {
2718
- default: a(() => [
2719
- S(h(R(_)), 1)
2720
- ]),
2721
- _: 2
2722
- }, 1032, ["tone"]),
2723
- _.is_enabled && _.notifies === !1 ? (o(), y(e(ge), {
2724
- key: 0,
2725
- class: "wx-inbox-form__silent",
2726
- name: "warning",
2727
- label: e(l)("panel.notifies-nobody-short"),
2728
- title: e(l)("panel.notifies-nobody-short")
2729
- }, null, 8, ["label", "title"])) : E("", !0),
2730
- _.unread_count ? (o(), y(e(dl), {
2731
- key: 1,
2732
- class: "wx-inbox-form__count",
2733
- type: "primary",
2734
- value: _.unread_count,
2735
- label: e(l)("panel.unread")
2736
- }, null, 8, ["value", "label"])) : _.submissions_count ? (o(), y(e(dl), {
2737
- key: 2,
2738
- class: "wx-inbox-form__count",
2739
- type: "neutral",
2740
- value: _.submissions_count,
2741
- label: e(l)("panel.submissions")
2742
- }, null, 8, ["value", "label"])) : E("", !0)
2743
- ]),
2744
- t(e(j), {
2745
- size: "sm",
2746
- tone: "muted",
2747
- truncate: ""
2748
- }, {
2749
- default: a(() => [
2750
- S(h(_.slug), 1)
2751
- ]),
2752
- _: 2
2753
- }, 1024)
2754
- ], 10, Xt)
2755
- ]),
2756
- actions: a(({ item: _ }) => [
2757
- t(e(Ae), {
2758
- actions: z(_),
2759
- label: R(_)
2760
- }, null, 8, ["actions", "label"])
2761
- ]),
2762
- _: 2
2763
- }, [
2764
- B && c.value ? {
2765
- name: "extra",
2766
- fn: a(() => [
2767
- t(e(he), {
2768
- icon: "plus",
2769
- size: "sm",
2770
- title: e(l)("panel.new-form"),
2771
- onClick: N
2772
- }, null, 8, ["title"])
2773
- ]),
2774
- key: "0"
2775
- } : void 0
2776
- ]), 1032, ["modelValue", "class", "drag-label", "disabled", "title"])
2777
- ], 64))
2778
- ]),
2779
- list: a(() => [
2780
- f.value ? (o(), y(e(We), {
2781
- key: 0,
2782
- class: "wx-inbox__loading",
2783
- rows: 6
2784
- })) : I.value ? (o(), y(Ht, {
2785
- ref_key: "pane",
2786
- ref: A,
2787
- key: I.value.id,
2788
- form: I.value,
2789
- base: i.base,
2790
- onChanged: M
2791
- }, null, 8, ["form", "base"])) : (o(), y(e(je), {
2792
- key: 2,
2793
- title: e(l)("panel.no-forms"),
2794
- description: e(l)("panel.no-forms-help")
2795
- }, null, 8, ["title", "description"]))
2796
- ]),
2797
- _: 1
2798
- }, 8, ["filters-open", "filters-title"])
2799
- ]),
2800
- _: 1
2801
- })
2802
- ]),
2803
- _: 2
2804
- }, [
2805
- k.value ? void 0 : {
2806
- name: "actions",
2807
- fn: a(() => [
2808
- t(e(ee), {
2809
- variant: "outline",
2810
- onClick: Z[0] || (Z[0] = (B) => U.value = !0)
2811
- }, {
2812
- icon: a(() => [
2813
- t(e(ge), { name: "list" })
2814
- ]),
2815
- default: a(() => [
2816
- S(" " + h(e(l)("panel.forms")), 1)
2817
- ]),
2818
- _: 1
2819
- })
2820
- ]),
2821
- key: "0"
2822
- }
2823
- ]), 1032, ["title", "actions"]));
2824
- }
2825
- }), Kt = { class: "wx-inbox-status-form" }, Yt = { class: "wx-inbox-status-form__checks" }, Zt = /* @__PURE__ */ ae({
2826
- __name: "StatusDialog",
2827
- props: {
2828
- status: {}
2829
- },
2830
- setup(u) {
2831
- const i = u, { resolve: r, dismiss: d, open: m } = He(), w = oe(), s = ce(w);
2832
- ue();
2833
- const l = le("webx-inbox"), $ = me(), b = F(""), f = F({}), A = F("default"), k = F(!1), U = F(!1), c = F(!1), q = F(!1), V = F({});
2834
- Te(
2835
- () => i.status,
2836
- (M) => {
2837
- b.value = M?.key ?? "", f.value = { ...M?.title ?? {} }, A.value = M?.color ?? "default", k.value = M?.is_default ?? !1, U.value = M?.is_spam ?? !1, c.value = M?.is_closed ?? !1, V.value = {};
2838
- },
2839
- { immediate: !0 }
2840
- );
2841
- const W = x(
2842
- () => Gl.map((M) => ({ value: M, label: l(`panel.color-${M}`) }))
2843
- );
2844
- function I(M) {
2845
- return V.value[M]?.[0];
2846
- }
2847
- async function R() {
2848
- q.value = !0, V.value = {};
2849
- const M = {
2850
- key: b.value.trim(),
2851
- title: f.value,
2852
- color: A.value,
2853
- is_default: k.value,
2854
- is_spam: U.value,
2855
- is_closed: c.value
2856
- };
2857
- try {
2858
- r(
2859
- i.status === null ? await s.createStatus(M) : await s.saveStatus(i.status.id, M)
2860
- );
2861
- } catch (T) {
2862
- const g = T.body;
2863
- g?.errors ? (V.value = g.errors, X.danger(l("panel.failed"))) : X.danger($(T));
2864
- } finally {
2865
- q.value = !1;
2866
- }
2867
- }
2868
- return (M, T) => (o(), y(e(Xe), {
2869
- open: e(m),
2870
- "onUpdate:open": T[7] || (T[7] = (g) => se(m) ? m.value = g : null),
2871
- title: u.status ? e(l)("panel.settings") : e(l)("panel.new-status"),
2872
- width: 520
2873
- }, {
2874
- footer: a(() => [
2875
- t(e(qe), { size: "sm" }, {
2876
- default: a(() => [
2877
- t(e(ee), {
2878
- variant: "outline",
2879
- onClick: T[6] || (T[6] = (g) => e(d)())
2880
- }, {
2881
- default: a(() => [
2882
- S(h(e(l)("panel.cancel")), 1)
2883
- ]),
2884
- _: 1
2885
- }),
2886
- t(e(ee), {
2887
- type: "primary",
2888
- loading: q.value,
2889
- onClick: R
2890
- }, {
2891
- default: a(() => [
2892
- S(h(e(l)("panel.save")), 1)
2893
- ]),
2894
- _: 1
2895
- }, 8, ["loading"])
2896
- ]),
2897
- _: 1
2898
- })
2899
- ]),
2900
- default: a(() => [
2901
- L("div", Kt, [
2902
- t(e(G), {
2903
- label: e(l)("panel.title"),
2904
- error: I("title"),
2905
- required: ""
2906
- }, {
2907
- default: a(() => [
2908
- t(e(J), {
2909
- modelValue: f.value,
2910
- "onUpdate:modelValue": T[0] || (T[0] = (g) => f.value = g),
2911
- localized: ""
2912
- }, null, 8, ["modelValue"])
2913
- ]),
2914
- _: 1
2915
- }, 8, ["label", "error"]),
2916
- t(e(G), {
2917
- label: e(l)("panel.status-key"),
2918
- error: I("key"),
2919
- required: ""
2920
- }, {
2921
- default: a(() => [
2922
- t(e(J), {
2923
- modelValue: b.value,
2924
- "onUpdate:modelValue": T[1] || (T[1] = (g) => b.value = g),
2925
- placeholder: "in-progress"
2926
- }, null, 8, ["modelValue"])
2927
- ]),
2928
- _: 1
2929
- }, 8, ["label", "error"]),
2930
- t(e(G), {
2931
- label: e(l)("panel.status-color"),
2932
- error: I("color")
2933
- }, {
2934
- default: a(() => [
2935
- t(e(pe), {
2936
- modelValue: A.value,
2937
- "onUpdate:modelValue": T[2] || (T[2] = (g) => A.value = g),
2938
- options: W.value
2939
- }, null, 8, ["modelValue", "options"])
2940
- ]),
2941
- _: 1
2942
- }, 8, ["label", "error"]),
2943
- L("div", Yt, [
2944
- t(e(ve), {
2945
- modelValue: k.value,
2946
- "onUpdate:modelValue": T[3] || (T[3] = (g) => k.value = g),
2947
- label: e(l)("panel.status-default")
2948
- }, null, 8, ["modelValue", "label"]),
2949
- t(e(ve), {
2950
- modelValue: U.value,
2951
- "onUpdate:modelValue": T[4] || (T[4] = (g) => U.value = g),
2952
- label: e(l)("panel.status-spam")
2953
- }, null, 8, ["modelValue", "label"]),
2954
- t(e(ve), {
2955
- modelValue: c.value,
2956
- "onUpdate:modelValue": T[5] || (T[5] = (g) => c.value = g),
2957
- disabled: U.value,
2958
- label: e(l)("panel.status-closed")
2959
- }, null, 8, ["modelValue", "disabled", "label"])
2960
- ])
2961
- ])
2962
- ]),
2963
- _: 1
2964
- }, 8, ["open", "title"]));
2965
- }
2966
- }), Qt = /* @__PURE__ */ ie(Zt, [["__scopeId", "data-v-b520b53b"]]), Jt = { class: "wx-inbox-statuses" }, ea = { class: "wx-inbox-status" }, la = /* @__PURE__ */ ae({
2967
- __name: "StatusesPage",
2968
- props: {
2969
- base: { default: "/inbox" }
2970
- },
2971
- setup(u) {
2972
- const i = u, r = oe(), d = ce(r);
2973
- ue();
2974
- const m = le("webx-inbox"), w = me(), s = F([]), l = F(!0), $ = r.can("inbox.manage"), b = Ge(Qt), f = ol();
2975
- async function A() {
2976
- l.value = !0;
2977
- try {
2978
- s.value = await d.statuses();
2979
- } catch (W) {
2980
- X.danger(w(W));
2981
- } finally {
2982
- l.value = !1;
2983
- }
2984
- }
2985
- A();
2986
- async function k(W) {
2987
- await b({ status: W }) && await A();
2988
- }
2989
- async function U(W) {
2990
- if (await Ue({
2991
- title: m("panel.delete-status-title", { status: f(W) }),
2992
- message: m("panel.delete-status-text"),
2993
- confirmText: m("panel.delete"),
2994
- cancelText: m("panel.cancel"),
2995
- tone: "danger"
2996
- }))
2997
- try {
2998
- await d.removeStatus(W.id), X.success(m("panel.deleted")), await A();
2999
- } catch (R) {
3000
- X.danger(w(R));
3001
- }
3002
- }
3003
- function c(W) {
3004
- return $ ? [
3005
- { key: "edit", icon: "edit", label: m("panel.settings"), run: () => {
3006
- k(W);
3007
- } },
3008
- // A status with submissions in them cannot go: they would have nothing to be in. The
3009
- // line is left out rather than greyed, the way every list of the panel does it.
3010
- ...W.submissions_count === 0 ? [
3011
- {
3012
- key: "delete",
3013
- icon: "trash",
3014
- label: m("panel.delete"),
3015
- danger: !0,
3016
- run: () => {
3017
- U(W);
3018
- }
3019
- }
3020
- ] : []
3021
- ] : [];
3022
- }
3023
- const q = x(
3024
- () => $ ? [
3025
- {
3026
- key: "new",
3027
- label: m("panel.new-status"),
3028
- icon: "plus",
3029
- primary: !0,
3030
- run: () => {
3031
- k(null);
3032
- }
3033
- }
3034
- ] : []
3035
- );
3036
- async function V() {
3037
- try {
3038
- await d.sortStatuses(s.value.map((W) => W.id));
3039
- } catch (W) {
3040
- X.danger(w(W, m("panel.reorder-failed"))), await A();
3041
- }
3042
- }
3043
- return (W, I) => (o(), D("div", Jt, [
3044
- t(e(fl), {
3045
- title: e(m)("panel.statuses"),
3046
- back: i.base,
3047
- "back-label": e(m)("panel.forms"),
3048
- actions: q.value
3049
- }, {
3050
- default: a(() => [
3051
- !l.value && s.value.length === 0 ? (o(), y(e(je), {
3052
- key: 0,
3053
- title: e(m)("panel.no-statuses")
3054
- }, null, 8, ["title"])) : (o(), y(e(nl), {
3055
- key: 1,
3056
- modelValue: s.value,
3057
- "onUpdate:modelValue": I[0] || (I[0] = (R) => s.value = R),
3058
- plain: "",
3059
- "item-key": "id",
3060
- "item-label": e(f),
3061
- "drag-label": e(m)("panel.reorder"),
3062
- disabled: !e($),
3063
- "aria-label": e(m)("panel.statuses"),
3064
- onMove: V
3065
- }, {
3066
- default: a(({ item: R }) => [
3067
- L("div", ea, [
3068
- t(e(ye), {
3069
- type: R.color
3070
- }, {
3071
- default: a(() => [
3072
- S(h(e(f)(R)), 1)
3073
- ]),
3074
- _: 2
3075
- }, 1032, ["type"]),
3076
- t(e(j), {
3077
- size: "sm",
3078
- tone: "muted",
3079
- truncate: ""
3080
- }, {
3081
- default: a(() => [
3082
- L("code", null, h(R.key), 1),
3083
- R.is_default ? (o(), D(Q, { key: 0 }, [
3084
- S(" · " + h(e(m)("panel.status-default")), 1)
3085
- ], 64)) : E("", !0),
3086
- R.is_spam ? (o(), D(Q, { key: 1 }, [
3087
- S(" · " + h(e(m)("panel.status-spam")), 1)
3088
- ], 64)) : R.is_closed ? (o(), D(Q, { key: 2 }, [
3089
- S(" · " + h(e(m)("panel.status-closed")), 1)
3090
- ], 64)) : E("", !0),
3091
- R.submissions_count ? (o(), D(Q, { key: 3 }, [
3092
- S(" · " + h(e(m)("panel.in-use")) + " (" + h(R.submissions_count) + ") ", 1)
3093
- ], 64)) : E("", !0)
3094
- ]),
3095
- _: 2
3096
- }, 1024)
3097
- ])
3098
- ]),
3099
- actions: a(({ item: R }) => [
3100
- t(e(Ae), {
3101
- actions: c(R),
3102
- label: e(f)(R)
3103
- }, null, 8, ["actions", "label"])
3104
- ]),
3105
- _: 1
3106
- }, 8, ["modelValue", "item-label", "drag-label", "disabled", "aria-label"]))
3107
- ]),
3108
- _: 1
3109
- }, 8, ["title", "back", "back-label", "actions"])
3110
- ]));
3111
- }
3112
- }), ta = /* @__PURE__ */ ie(la, [["__scopeId", "data-v-ba548af9"]]), aa = { class: "wx-submission" }, na = {
3113
- key: 1,
3114
- class: "wx-submission__panes"
3115
- }, sa = { class: "wx-submission__main" }, oa = { class: "wx-submission__value" }, ia = { class: "wx-submission__files" }, ua = { class: "wx-submission__by" }, ra = { class: "wx-submission__fields" }, da = ["href"], ca = {
3116
- key: 1,
3117
- class: "wx-submission__detail"
3118
- }, pa = { class: "wx-submission__detail" }, ma = {
3119
- key: 5,
3120
- class: "wx-submission__recipients"
3121
- }, fa = { key: 6 }, va = { class: "wx-submission__fields" }, ba = {
3122
- key: 1,
3123
- class: "wx-submission__recipients"
3124
- }, ha = { class: "wx-submission__channel-text" }, ya = { key: 2 }, ga = { class: "wx-submission__aside" }, _a = { class: "wx-submission__fields" }, xa = { class: "wx-submission__field" }, wa = { class: "wx-submission__field" }, ka = /* @__PURE__ */ ae({
3125
- __name: "SubmissionPage",
3126
- props: {
3127
- base: { default: "/inbox" }
3128
- },
3129
- setup(u) {
3130
- const i = u, r = oe(), d = ce(r), m = Le(), w = Fe(), s = xe();
3131
- ue();
3132
- const l = le("webx-inbox"), $ = le("webx-admin"), b = me(), f = F(null), A = F([]), k = F([]), U = F(!0), c = x(() => r.can("inbox.update")), q = x(() => Number(m.params.id)), V = x(() => ({
3133
- view: typeof m.query.view == "string" ? m.query.view : void 0,
3134
- search: typeof m.query.search == "string" ? m.query.search : void 0,
3135
- assignee: typeof m.query.assignee == "string" ? m.query.assignee : void 0
3136
- })), W = x(() => ({ path: i.base, query: { ...m.query } })), I = x(
3137
- () => A.value.map((n) => ({ value: n.id, label: M(n) }))
3138
- ), R = x(
3139
- () => k.value.map((n) => ({ value: n.id, label: n.name }))
3140
- ), M = ol(), T = x(() => l("panel.submission", { id: String(q.value) })), g = x(() => {
3141
- const n = f.value?.form;
3142
- return n === void 0 ? "" : _e(n.title ?? {}, s.active.value, n.slug ?? "");
3143
- }), z = x(() => (f.value?.values ?? []).find((p) => p.type === "email" && (p.value ?? "") !== "")?.value ?? null), N = x(() => {
3144
- if (z.value === null) return null;
3145
- const n = encodeURIComponent(`${g.value} — ${T.value}`);
3146
- return `mailto:${z.value}?subject=${n}`;
3147
- });
3148
- async function v() {
3149
- U.value = !0;
3150
- try {
3151
- f.value = await d.submission(q.value, V.value);
3152
- } catch (n) {
3153
- X.danger(b(n)), w.replace(W.value);
3154
- } finally {
3155
- U.value = !1;
3156
- }
3157
- }
3158
- async function H() {
3159
- try {
3160
- A.value = await d.statuses(), c.value && (k.value = await d.recipients());
3161
- } catch (n) {
3162
- X.danger(b(n));
3163
- }
3164
- }
3165
- Te(q, () => {
3166
- v();
3167
- }, { immediate: !0 }), H();
3168
- async function K(n) {
3169
- try {
3170
- f.value = await d.saveSubmission(q.value, n), X.success(l("panel.saved"));
3171
- } catch (O) {
3172
- X.danger(b(O)), await v();
3173
- }
3174
- }
3175
- function Y(n) {
3176
- typeof n == "number" && K({ status_id: n });
3177
- }
3178
- function P(n) {
3179
- K({ assignee_id: typeof n == "number" ? n : null });
3180
- }
3181
- const Z = x(() => {
3182
- const n = [];
3183
- return N.value && n.push({
3184
- key: "reply",
3185
- label: l("panel.reply"),
3186
- icon: "mail",
3187
- primary: !0,
3188
- href: N.value,
3189
- target: "_self"
3190
- }), c.value && f.value !== null && n.push(
3191
- {
3192
- key: "unread",
3193
- icon: "eye-off",
3194
- label: l("panel.mark-unread"),
3195
- menu: !0,
3196
- run: () => {
3197
- Ye();
3198
- }
3199
- },
3200
- {
3201
- key: "notify",
3202
- icon: "mail",
3203
- label: l("panel.notify-again"),
3204
- menu: !0,
3205
- run: () => {
3206
- B();
3207
- }
3208
- },
3209
- {
3210
- key: "delete",
3211
- icon: "trash",
3212
- label: l("panel.delete"),
3213
- danger: !0,
3214
- run: () => {
3215
- Ze();
3216
- }
3217
- }
3218
- ), n;
3219
- });
3220
- async function B() {
3221
- try {
3222
- f.value = await d.notifySubmission(q.value), X.success(l("panel.notify-sent-again"));
3223
- } catch (n) {
3224
- X.danger(b(n));
3225
- }
3226
- }
3227
- const C = x(() => f.value?.notification ?? null);
3228
- function _(n) {
3229
- return l(`panel.notify-recipient-${n}`);
3230
- }
3231
- const ne = x(() => f.value?.channels ?? null), re = x(() => (ne.value ?? []).some((n) => n.status === "failed")), Ke = x(() => (ne.value ?? []).some((n) => n.retryable));
3232
- function Se(n) {
3233
- return n.status === "failed" ? "danger" : n.status === "sent" ? "success" : n.status === "skipped" ? "warning" : "default";
3234
- }
3235
- async function Ye() {
3236
- try {
3237
- await d.massSubmissions({ ids: [q.value], action: "unread" }), w.push(W.value);
3238
- } catch (n) {
3239
- X.danger(b(n));
3240
- }
3241
- }
3242
- async function Ze() {
3243
- if (await Ue({
3244
- title: l("panel.delete-submission-title"),
3245
- message: l("panel.delete-submission-text"),
3246
- confirmText: l("panel.delete"),
3247
- cancelText: l("panel.cancel"),
3248
- tone: "danger"
3249
- }))
3250
- try {
3251
- await d.removeSubmission(q.value), X.success(l("panel.deleted")), w.push(W.value);
3252
- } catch (O) {
3253
- X.danger(b(O));
3254
- }
3255
- }
3256
- function Ne(n) {
3257
- n !== null && w.push({ path: `${i.base}/submissions/${n}`, query: { ...m.query } });
3258
- }
3259
- function Ie(n) {
3260
- const O = A.value.find((p) => p.key === n);
3261
- return O === void 0 ? n : M(O);
3262
- }
3263
- const Qe = x(
3264
- () => f.value?.events?.some((n) => n.type === "no_recipients") ?? !1
3265
- );
3266
- function Ee(n) {
3267
- switch (n.type) {
3268
- case "created":
3269
- return l("panel.event-created");
3270
- case "status":
3271
- return l("panel.event-status", { to: Ie(n.to ?? "") });
3272
- case "assignee":
3273
- return n.to === null || n.to === "" ? l("panel.event-unassigned") : l("panel.event-assignee", { to: n.to });
3274
- case "note":
3275
- return l("panel.event-note");
3276
- case "notified":
3277
- return l("panel.event-notified");
3278
- // A handler of `webx-inbox.handlers`: `from` is its class, shown by its own short name.
3279
- case "handled":
3280
- return l("panel.event-handled", { name: Me(n.from) });
3281
- case "handler_error":
3282
- return l("panel.event-handler-error", {
3283
- name: Me(n.from),
3284
- error: n.to ?? ""
3285
- });
3286
- case "no_recipients":
3287
- return l("panel.event-no-recipients");
3288
- case "notify_queued":
3289
- return l("panel.event-notify-queued");
3290
- case "notify_failed":
3291
- return l("panel.event-notify-failed", { to: n.to ?? "" });
3292
- // An answer corrected by hand: named by the label it was asked under, when it still has one.
3293
- case "value":
3294
- return l("panel.event-value", {
3295
- field: ze(n.field ?? ""),
3296
- from: n.from ?? "",
3297
- to: n.to ?? ""
3298
- });
3299
- default:
3300
- return n.type;
3301
- }
3302
- }
3303
- function ze(n) {
3304
- return f.value?.values.find((p) => p.name === n)?.label || n;
3305
- }
3306
- function Me(n) {
3307
- return (n ?? "").split("\\").pop() ?? "";
3308
- }
3309
- function Je(n) {
3310
- return `${Math.max(1, Math.round(n / 1024))} KB`;
3311
- }
3312
- const el = x(() => {
3313
- const n = f.value?.meta ?? {}, O = [];
3314
- typeof n.page == "string" && n.page !== "" && O.push({ label: l("panel.meta-page"), value: n.page, link: !0 });
3315
- const p = f.value?.placement;
3316
- typeof p == "string" && p !== "" && O.push({ label: l("panel.meta-placement"), value: p }), typeof n.referrer == "string" && n.referrer !== "" && O.push({ label: l("panel.meta-referrer"), value: n.referrer, link: !0 });
3317
- for (const [we, gl] of Object.entries(n.utm ?? {}))
3318
- O.push({ label: we, value: String(gl) });
3319
- return typeof n.locale == "string" && n.locale !== "" && O.push({ label: l("panel.meta-locale"), value: n.locale }), typeof n.ip == "string" && n.ip !== "" && O.push({ label: l("panel.meta-ip"), value: n.ip }), typeof n.user_agent == "string" && n.user_agent !== "" && O.push({ label: l("panel.meta-agent"), value: n.user_agent }), O;
3320
- });
3321
- return (n, O) => (o(), D("div", aa, [
3322
- t(e(al), {
3323
- title: T.value,
3324
- subtitle: g.value,
3325
- back: W.value,
3326
- actions: Z.value
3327
- }, {
3328
- extra: a(() => [
3329
- t(e(he), {
3330
- icon: "chevron-left",
3331
- size: "lg",
3332
- title: e(l)("panel.previous"),
3333
- disabled: !f.value?.previous_id,
3334
- onClick: O[0] || (O[0] = (p) => Ne(f.value?.previous_id ?? null))
3335
- }, null, 8, ["title", "disabled"]),
3336
- t(e(he), {
3337
- icon: "chevron-right",
3338
- size: "lg",
3339
- title: e(l)("panel.next"),
3340
- disabled: !f.value?.next_id,
3341
- onClick: O[1] || (O[1] = (p) => Ne(f.value?.next_id ?? null))
3342
- }, null, 8, ["title", "disabled"])
3343
- ]),
3344
- _: 1
3345
- }, 8, ["title", "subtitle", "back", "actions"]),
3346
- U.value ? (o(), y(e(We), {
3347
- key: 0,
3348
- rows: 6
3349
- })) : f.value ? (o(), D("div", na, [
3350
- L("div", sa, [
3351
- t(e(te), {
3352
- title: e(l)("panel.answers")
3353
- }, {
3354
- default: a(() => [
3355
- f.value.values.length === 0 ? (o(), y(e(je), {
3356
- key: 0,
3357
- size: "sm",
3358
- description: e(l)("panel.no-answers")
3359
- }, null, 8, ["description"])) : (o(), y(e(cl), {
3360
- key: 1,
3361
- columns: 1,
3362
- layout: "vertical"
3363
- }, {
3364
- default: a(() => [
3365
- (o(!0), D(Q, null, fe(f.value.values, (p) => (o(), y(e(Pe), {
3366
- key: p.id,
3367
- label: p.label ?? p.name
3368
- }, {
3369
- default: a(() => [
3370
- L("p", oa, h(p.value || "—"), 1)
3371
- ]),
3372
- _: 2
3373
- }, 1032, ["label"]))), 128))
3374
- ]),
3375
- _: 1
3376
- }))
3377
- ]),
3378
- _: 1
3379
- }, 8, ["title"]),
3380
- f.value.files.length > 0 ? (o(), y(e(te), {
3381
- key: 0,
3382
- title: e(l)("panel.attachments")
3383
- }, {
3384
- default: a(() => [
3385
- L("div", ia, [
3386
- (o(!0), D(Q, null, fe(f.value.files, (p) => (o(), y(e(Rl), {
3387
- key: p.id,
3388
- name: p.name,
3389
- type: p.mime ?? void 0,
3390
- "download-url": p.url,
3391
- "download-label": e(l)("panel.download"),
3392
- size: "sm"
3393
- }, {
3394
- meta: a(() => [
3395
- S(h(Je(p.size)), 1)
3396
- ]),
3397
- _: 2
3398
- }, 1032, ["name", "type", "download-url", "download-label"]))), 128))
3399
- ])
3400
- ]),
3401
- _: 1
3402
- }, 8, ["title"])) : E("", !0),
3403
- re.value ? (o(), y(e($e), {
3404
- key: 1,
3405
- type: "warning",
3406
- closable: !1,
3407
- title: e(l)("panel.channels-failed")
3408
- }, null, 8, ["title"])) : E("", !0),
3409
- t(e(te), { class: "wx-submission__more" }, {
3410
- default: a(() => [
3411
- t(e(sl), {
3412
- variant: "pill",
3413
- "aria-label": T.value
3414
- }, {
3415
- default: a(() => [
3416
- t(e(be), {
3417
- value: "notes",
3418
- label: e($)("notes.title")
3419
- }, {
3420
- default: a(() => [
3421
- t(e(Ul), {
3422
- id: f.value.id,
3423
- type: "inbox_submission",
3424
- title: "",
3425
- can: c.value,
3426
- onChange: v
3427
- }, null, 8, ["id", "can"])
3428
- ]),
3429
- _: 1
3430
- }, 8, ["label"]),
3431
- t(e(be), {
3432
- value: "log",
3433
- label: e(l)("panel.log")
3434
- }, {
3435
- default: a(() => [
3436
- t(e(Dl), { size: "sm" }, {
3437
- default: a(() => [
3438
- (o(!0), D(Q, null, fe(f.value.events, (p) => (o(), y(e(Ll), {
3439
- key: p.id
3440
- }, {
3441
- default: a(() => [
3442
- t(e(j), {
3443
- size: "sm",
3444
- as: "p",
3445
- class: "wx-submission__event"
3446
- }, {
3447
- default: a(() => [
3448
- S(h(Ee(p)), 1)
3449
- ]),
3450
- _: 2
3451
- }, 1024),
3452
- L("p", ua, [
3453
- t(e(j), {
3454
- size: "sm",
3455
- tone: "muted"
3456
- }, {
3457
- default: a(() => [
3458
- S(h(p.author?.name ?? e(l)("panel.system")), 1)
3459
- ]),
3460
- _: 2
3461
- }, 1024),
3462
- t(e(De), {
3463
- value: p.created_at
3464
- }, null, 8, ["value"])
3465
- ])
3466
- ]),
3467
- _: 2
3468
- }, 1024))), 128))
3469
- ]),
3470
- _: 1
3471
- })
3472
- ]),
3473
- _: 1
3474
- }, 8, ["label"]),
3475
- t(e(be), {
3476
- value: "details",
3477
- label: e(l)("panel.details")
3478
- }, {
3479
- default: a(() => [
3480
- L("div", ra, [
3481
- t(e(cl), {
3482
- columns: 1,
3483
- layout: "vertical",
3484
- size: "sm"
3485
- }, {
3486
- default: a(() => [
3487
- t(e(Pe), {
3488
- label: e(l)("panel.received")
3489
- }, {
3490
- default: a(() => [
3491
- t(e(De), {
3492
- value: f.value.created_at,
3493
- tone: "default"
3494
- }, null, 8, ["value"])
3495
- ]),
3496
- _: 1
3497
- }, 8, ["label"]),
3498
- t(e(Pe), {
3499
- label: e(l)("panel.meta-source")
3500
- }, {
3501
- default: a(() => [
3502
- t(e(ye), {
3503
- type: f.value.source === "panel" ? "info" : "default"
3504
- }, {
3505
- default: a(() => [
3506
- S(h(f.value.source === "panel" ? e(l)("panel.source-panel") : e(l)("panel.source-web")), 1)
3507
- ]),
3508
- _: 1
3509
- }, 8, ["type"])
3510
- ]),
3511
- _: 1
3512
- }, 8, ["label"]),
3513
- (o(!0), D(Q, null, fe(el.value, (p) => (o(), y(e(Pe), {
3514
- key: p.label,
3515
- label: p.label
3516
- }, {
3517
- default: a(() => [
3518
- p.link ? (o(), D("a", {
3519
- key: 0,
3520
- href: p.value,
3521
- target: "_blank",
3522
- rel: "noreferrer"
3523
- }, h(p.value), 9, da)) : (o(), D("span", ca, h(p.value), 1))
3524
- ]),
3525
- _: 2
3526
- }, 1032, ["label"]))), 128))
3527
- ]),
3528
- _: 1
3529
- }),
3530
- C.value?.state === "failed" ? (o(), y(e($e), {
3531
- key: 0,
3532
- type: "warning",
3533
- closable: !1,
3534
- title: e(l)("panel.notify-failed")
3535
- }, {
3536
- default: a(() => [
3537
- L("span", pa, h(C.value.error), 1)
3538
- ]),
3539
- _: 1
3540
- }, 8, ["title"])) : C.value?.state === "queued" ? (o(), y(e(j), {
3541
- key: 1,
3542
- size: "sm",
3543
- tone: "muted"
3544
- }, {
3545
- default: a(() => [
3546
- S(h(e(l)("panel.notify-queued")), 1)
3547
- ]),
3548
- _: 1
3549
- })) : C.value?.state === "delivered" ? (o(), y(e(j), {
3550
- key: 2,
3551
- size: "sm",
3552
- tone: "muted"
3553
- }, {
3554
- default: a(() => [
3555
- S(h(e(l)("panel.notified")), 1)
3556
- ]),
3557
- _: 1
3558
- })) : Qe.value ? (o(), y(e(j), {
3559
- key: 3,
3560
- size: "sm",
3561
- tone: "muted"
3562
- }, {
3563
- default: a(() => [
3564
- S(h(e(l)("panel.notified-nobody")), 1)
3565
- ]),
3566
- _: 1
3567
- })) : (o(), y(e(j), {
3568
- key: 4,
3569
- size: "sm",
3570
- tone: "muted"
3571
- }, {
3572
- default: a(() => [
3573
- S(h(e(l)("panel.not-notified")), 1)
3574
- ]),
3575
- _: 1
3576
- })),
3577
- C.value && C.value.recipients.length > 0 ? (o(), D("ul", ma, [
3578
- (o(!0), D(Q, null, fe(C.value.recipients, (p) => (o(), D("li", {
3579
- key: p.address
3580
- }, [
3581
- t(e(j), { size: "sm" }, {
3582
- default: a(() => [
3583
- S(h(p.address), 1)
3584
- ]),
3585
- _: 2
3586
- }, 1024),
3587
- t(e(ye), {
3588
- type: p.state === "failed" ? "danger" : p.state === "delivered" ? "success" : "default"
3589
- }, {
3590
- default: a(() => [
3591
- S(h(_(p.state)), 1)
3592
- ]),
3593
- _: 2
3594
- }, 1032, ["type"])
3595
- ]))), 128))
3596
- ])) : E("", !0),
3597
- c.value && (C.value?.state === "failed" || C.value?.state === "queued") ? (o(), D("div", fa, [
3598
- t(e(ee), {
3599
- size: "sm",
3600
- onClick: B
3601
- }, {
3602
- default: a(() => [
3603
- S(h(e(l)("panel.notify-again")), 1)
3604
- ]),
3605
- _: 1
3606
- })
3607
- ])) : E("", !0)
3608
- ])
3609
- ]),
3610
- _: 1
3611
- }, 8, ["label"]),
3612
- ne.value ? (o(), y(e(be), {
3613
- key: 0,
3614
- value: "channels",
3615
- label: e(l)("panel.channels")
3616
- }, {
3617
- default: a(() => [
3618
- L("div", va, [
3619
- ne.value.length === 0 ? (o(), y(e(j), {
3620
- key: 0,
3621
- size: "sm",
3622
- tone: "muted"
3623
- }, {
3624
- default: a(() => [
3625
- S(h(e(l)("panel.channels-none")), 1)
3626
- ]),
3627
- _: 1
3628
- })) : (o(), D("ul", ba, [
3629
- (o(!0), D(Q, null, fe(ne.value, (p) => (o(), D("li", {
3630
- key: p.id,
3631
- class: "wx-submission__channel"
3632
- }, [
3633
- L("div", ha, [
3634
- t(e(j), { size: "sm" }, {
3635
- default: a(() => [
3636
- S(h(p.channel), 1)
3637
- ]),
3638
- _: 2
3639
- }, 1024),
3640
- p.recipient !== "" ? (o(), y(e(j), {
3641
- key: 0,
3642
- size: "sm",
3643
- tone: "muted"
3644
- }, {
3645
- default: a(() => [
3646
- S(h(p.recipient_label ?? p.recipient), 1)
3647
- ]),
3648
- _: 2
3649
- }, 1024)) : E("", !0),
3650
- p.error ?? p.reason_label ? (o(), y(e(j), {
3651
- key: 1,
3652
- size: "sm",
3653
- tone: "muted",
3654
- class: "wx-submission__detail"
3655
- }, {
3656
- default: a(() => [
3657
- S(h(p.error ?? p.reason_label), 1)
3658
- ]),
3659
- _: 2
3660
- }, 1024)) : E("", !0)
3661
- ]),
3662
- t(e(ye), {
3663
- type: Se(p)
3664
- }, {
3665
- default: a(() => [
3666
- S(h(p.status_label), 1)
3667
- ]),
3668
- _: 2
3669
- }, 1032, ["type"])
3670
- ]))), 128))
3671
- ])),
3672
- c.value && Ke.value ? (o(), D("div", ya, [
3673
- t(e(ee), {
3674
- size: "sm",
3675
- onClick: B
3676
- }, {
3677
- default: a(() => [
3678
- S(h(e(l)("panel.notify-again")), 1)
3679
- ]),
3680
- _: 1
3681
- })
3682
- ])) : E("", !0)
3683
- ])
3684
- ]),
3685
- _: 1
3686
- }, 8, ["label"])) : E("", !0)
3687
- ]),
3688
- _: 1
3689
- }, 8, ["aria-label"])
3690
- ]),
3691
- _: 1
3692
- })
3693
- ]),
3694
- L("aside", ga, [
3695
- t(e(te), null, {
3696
- default: a(() => [
3697
- L("div", _a, [
3698
- L("label", xa, [
3699
- t(e(j), {
3700
- size: "sm",
3701
- tone: "muted"
3702
- }, {
3703
- default: a(() => [
3704
- S(h(e(l)("panel.status")), 1)
3705
- ]),
3706
- _: 1
3707
- }),
3708
- t(e(pe), {
3709
- "model-value": f.value.status?.id ?? null,
3710
- options: I.value,
3711
- disabled: !c.value,
3712
- "onUpdate:modelValue": Y
3713
- }, null, 8, ["model-value", "options", "disabled"])
3714
- ]),
3715
- L("label", wa, [
3716
- t(e(j), {
3717
- size: "sm",
3718
- tone: "muted"
3719
- }, {
3720
- default: a(() => [
3721
- S(h(e(l)("panel.assignee")), 1)
3722
- ]),
3723
- _: 1
3724
- }),
3725
- t(e(pe), {
3726
- "model-value": f.value.assignee?.id ?? null,
3727
- options: R.value,
3728
- disabled: !c.value,
3729
- clearable: "",
3730
- placeholder: e(l)("panel.unassigned"),
3731
- "onUpdate:modelValue": P
3732
- }, null, 8, ["model-value", "options", "disabled", "placeholder"])
3733
- ])
3734
- ])
3735
- ]),
3736
- _: 1
3737
- })
3738
- ])
3739
- ])) : E("", !0)
3740
- ]));
3741
- }
3742
- }), Va = /* @__PURE__ */ ie(ka, [["__scopeId", "data-v-89eacc36"]]);
3743
- function Ua(u = {}) {
3744
- const i = u.path ?? "/inbox";
3745
- return {
3746
- id: "inbox",
3747
- path: i,
3748
- landing: u.landing ?? !0,
3749
- routes: [
3750
- // The section's own path travels as a prop, so a panel that mounted it somewhere else
3751
- // still links between its screens correctly.
3752
- { path: i, name: "webx.inbox", component: jt, props: { base: i } },
3753
- {
3754
- path: `${i}/statuses`,
3755
- name: "webx.inbox.statuses",
3756
- component: ta,
3757
- props: { base: i }
3758
- },
3759
- {
3760
- path: `${i}/forms/:id(\\d+)`,
3761
- name: "webx.inbox.form",
3762
- component: $t,
3763
- props: { base: i }
3764
- },
3765
- // A submission has an address of its own, not a dialog over the list (§11): it goes in
3766
- // the mail to whoever deals with it, it gets pasted into a chat, an agent links to it.
3767
- {
3768
- path: `${i}/submissions/:id(\\d+)`,
3769
- name: "webx.inbox.submission",
3770
- component: Va,
3771
- props: { base: i }
3772
- }
3773
- ],
3774
- // A form of the Inbox as a field of any screen or block — the contact block's form — chosen
3775
- // by name and kept by slug. Here and not in the panel: what it lists is this section's.
3776
- types: {
3777
- "wx-inbox-form": { component: qt, kind: "field" }
3778
- }
3779
- };
3780
- }
1
+ import "vue";
2
+ import { e as x, b as i, F as b, W as n, f as e, g as t, h as I, S, i as W, c as r, j as m, k as F, o as g } from "./index-BQj2UlUS.js";
3781
3
  export {
3782
- Xl as FIELD_TYPES,
3783
- Gl as STATUS_COLORS,
3784
- nt as WxInboxFieldList,
3785
- $t as WxInboxFormEditor,
3786
- qt as WxInboxFormField,
3787
- jt as WxInboxPage,
3788
- ta as WxInboxStatusesPage,
3789
- Ht as WxInboxSubmissionList,
3790
- Va as WxInboxSubmissionPage,
3791
- ce as createInboxApi,
3792
- Ua as inbox,
3793
- Hl as inboxMessages,
3794
- de as option
4
+ x as FIELD_TYPES,
5
+ i as STATUS_COLORS,
6
+ b as WxInboxFieldList,
7
+ n as WxInboxFormEditor,
8
+ e as WxInboxFormField,
9
+ t as WxInboxPage,
10
+ I as WxInboxStatusesPage,
11
+ S as WxInboxSubmissionList,
12
+ W as WxInboxSubmissionPage,
13
+ r as createInboxApi,
14
+ m as inbox,
15
+ F as inboxMessages,
16
+ g as option
3795
17
  };
3796
18
  //# sourceMappingURL=index.js.map