@webx-ui/module-catalog-landings 0.2.2 → 0.2.3

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.
@@ -1,768 +0,0 @@
1
- import { provide as ke, inject as xe, defineComponent as H, useModel as K, computed as A, ref as O, watch as ae, openBlock as r, createElementBlock as F, createBlock as k, unref as a, createCommentVNode as $, withCtx as f, createTextVNode as S, toDisplayString as w, createVNode as W, createElementVNode as ne, onBeforeUnmount as we, Fragment as Se, renderList as $e, mergeModels as Le, onMounted as Ve, defineAsyncComponent as ge } from "vue";
2
- import { WxAutocomplete as Ae, WxText as U, WxSortableList as Ne, WxButton as se, WxIcon as me, WxBadge as pe, WxAlert as te, WxInputNumber as ue, WxSelect as le, WxLink as Ce, useLocales as Te, WxInput as Oe } from "@webx-ui/core";
3
- import { useAdmin as q, useTranslate as G, useErrorText as ve } from "@webx-ui/module-admin";
4
- import { createCatalogApi as We, useFacetRegistry as ze } from "@webx-ui/module-catalog";
5
- import { RouterLink as Fe } from "vue-router";
6
- const he = /* @__PURE__ */ Symbol("wx-catalog-landing");
7
- function dt(s) {
8
- ke(he, s);
9
- }
10
- function J() {
11
- return xe(he, null);
12
- }
13
- const Ee = {
14
- module: {
15
- title: "Landings",
16
- landing: "Landing"
17
- },
18
- landing: {
19
- category_id: "Base",
20
- filters: "Set",
21
- name: "Name",
22
- slug: "Address",
23
- h1: "H1",
24
- text_above: "Text above the list",
25
- text_below: "Text under the list",
26
- sort: "Default sort",
27
- on_category: "In the category’s collections",
28
- position: "Order",
29
- is_published: "Published",
30
- attention: "Needs attention",
31
- "whole-catalog": "The whole catalogue",
32
- "tab-main": "Main",
33
- "tab-texts": "Texts",
34
- "tab-recommended": "Recommended",
35
- "tab-seo": "SEO",
36
- "tab-history": "History",
37
- display: "On the site",
38
- "name-help": "The label in the panel and in the links of the collections.",
39
- "category-help": "The list the landing narrows. Empty — the whole catalogue.",
40
- "slug-help": "From the site’s root, like a category’s: /laptops-apple/.",
41
- "sort-help": "The order a reader sees first; the one they choose wins.",
42
- "sort-default": "As the category",
43
- "on-category-help": "A link in «Collections» on the page of the base.",
44
- "position-help": "Smaller first, in the collections and among the neighbours.",
45
- "h1-help": "Empty — the name.",
46
- "text-help": "Shown on the landing’s first page with nothing more chosen.",
47
- recommended: "Recommended products",
48
- "recommended-help": "A strip over the list, in this order; the list itself does not change.",
49
- "recommended-search": "Find a product by name or SKU",
50
- "recommended-empty": "No products picked.",
51
- "recommended-remove": "Remove",
52
- "set-add": "Add a facet",
53
- "set-empty": "Add a facet and choose its values.",
54
- "set-remove": "Remove the facet",
55
- "set-values": "Choose values",
56
- "set-from": "From",
57
- "set-to": "To",
58
- "set-count": "Products: :count",
59
- "set-counting": "Counting…",
60
- "set-taken": "This set on this base is already the landing «:name».",
61
- "set-open-taken": "Open it",
62
- "slug-suggested": "Suggested: :slug",
63
- "slug-use": "Use",
64
- "attention-value_removed": "A value of the set was deleted",
65
- "attention-duplicate": "The set became another landing’s",
66
- "attention-empty_set": "Nothing is left of the set"
67
- },
68
- panel: {
69
- new: "New landing",
70
- generate: "Create in bulk",
71
- empty: "No landings yet.",
72
- "empty-help": "A landing is a category’s list with filters chosen in advance, under an address, texts and SEO of its own.",
73
- "nothing-found": "Nothing matches the filters.",
74
- search: "Name or address",
75
- "column-name": "Name",
76
- "column-base": "Base",
77
- "column-set": "Set",
78
- "column-count": "Products",
79
- "column-state": "State",
80
- "column-updated": "Updated",
81
- "filter-base": "Base",
82
- "filter-attention": "Needs attention",
83
- "filter-published": "Published only",
84
- "filter-empty": "Empty only",
85
- "filter-trashed": "In the bin",
86
- published: "Published",
87
- unpublished: "Not published",
88
- "not-counted": "Not counted yet",
89
- open: "Open",
90
- "open-site": "Open on the site",
91
- publish: "Publish",
92
- unpublish: "Unpublish",
93
- delete: "Delete",
94
- restore: "Restore",
95
- "delete-title": "Delete «:name»?",
96
- "delete-text": "It goes to the bin, and its address stops answering. Its set stays taken until it is gone for good.",
97
- deleted: "The landing is in the bin.",
98
- restored: "The landing is back.",
99
- "published-toast": "The landing is published.",
100
- "unpublished-toast": "The landing is unpublished.",
101
- saved: "The landing is saved.",
102
- created: "The landing is created.",
103
- save: "Save",
104
- create: "Create",
105
- "save-failed": "Not saved — see the fields.",
106
- cancel: "Cancel",
107
- "leave-title": "Leave without saving?",
108
- "leave-text": "What you changed here will be lost.",
109
- leave: "Leave",
110
- untitled: "A new landing",
111
- "in-bin": "In the bin",
112
- trail: "Where you are"
113
- },
114
- generate: {
115
- title: "Create landings in bulk",
116
- bases: "Bases",
117
- "bases-help": "One category or several; a landing per category and value.",
118
- subtree: "With every category under them",
119
- facet: "Facet",
120
- values: "Values",
121
- "values-help": "Empty — every value with products on the base.",
122
- "min-products": "At least products",
123
- "min-products-help": "For «every value»: values with fewer products on the base are left out.",
124
- templates: "Templates",
125
- "templates-help": "{category} and {value} are replaced: the slugs in the address, the names in the texts.",
126
- slug: "Address",
127
- name: "Name",
128
- h1: "H1",
129
- "seo-title": "SEO title",
130
- "seo-description": "SEO description",
131
- "template-empty": "Empty — not set",
132
- publish: "Publish at once",
133
- preview: "Preview",
134
- back: "Back",
135
- run: "Create :count",
136
- close: "Close",
137
- "column-address": "Address",
138
- "column-h1": "H1",
139
- "column-count": "Products",
140
- "column-conflict": "Skipped because",
141
- summary: "Will be created: :free; skipped: :skipped.",
142
- nothing: "Nothing to create: every row is skipped.",
143
- running: "Creating landings…",
144
- done: "Created: :done; skipped: :skipped; refused: :failed.",
145
- failed: "The generation stopped. What was created stays.",
146
- "conflict-slug-taken": "The address :slug is taken.",
147
- "conflict-set-taken": "The set is already the landing «:name».",
148
- "conflict-empty": "No products.",
149
- "conflict-no-slug": "A slug or a name to fill the template with is missing."
150
- }
151
- }, I = "webx-catalog-landings", re = /* @__PURE__ */ new WeakSet();
152
- function Q() {
153
- try {
154
- const { i18n: s } = q();
155
- re.has(s) || (s.defaults(I, Ee), re.add(s));
156
- } catch {
157
- }
158
- }
159
- const Pe = { class: "wx-catalog-landing-products" }, Ue = { class: "wx-catalog-landing-products__item" }, Ie = { class: "wx-catalog-landing-products__name" }, Me = /* @__PURE__ */ H({
160
- name: "WxCatalogLandingProducts",
161
- __name: "LandingProductsField",
162
- props: {
163
- modelValue: { default: null },
164
- modelModifiers: {}
165
- },
166
- emits: ["update:modelValue"],
167
- setup(s) {
168
- const e = K(s, "modelValue"), l = q(), t = We(l), o = J();
169
- Q();
170
- const i = G(I), z = ve(), p = A(() => o?.locked.value ?? !1), _ = O(/* @__PURE__ */ new Map());
171
- ae(
172
- () => o?.landing.value?.recommended_items,
173
- (b) => {
174
- for (const c of b ?? []) _.value.set(c.id, c);
175
- },
176
- { immediate: !0 }
177
- );
178
- const L = A({
179
- get: () => (e.value ?? []).map(
180
- (b) => _.value.get(b) ?? { id: b, name: `#${b}`, sku: null, deleted: !1 }
181
- ),
182
- set: (b) => {
183
- e.value = b.map((c) => c.id);
184
- }
185
- }), x = O(""), u = O([]), v = O(!1), V = O("");
186
- let C = 0;
187
- async function X(b) {
188
- const c = ++C;
189
- v.value = !0, V.value = "";
190
- try {
191
- const h = await t.products({ q: b, per_page: 10 });
192
- if (c !== C) return;
193
- const P = new Set(e.value ?? []);
194
- u.value = h.data.filter((N) => !P.has(N.id)).map((N) => (_.value.set(N.id, { id: N.id, name: N.name, sku: N.sku }), {
195
- value: String(N.id),
196
- label: N.name,
197
- description: N.sku ?? void 0
198
- }));
199
- } catch (h) {
200
- c === C && (V.value = z(h));
201
- } finally {
202
- c === C && (v.value = !1);
203
- }
204
- }
205
- function Y(b) {
206
- const c = Number(b.value);
207
- !Number.isFinite(c) || (e.value ?? []).includes(c) || (e.value = [...e.value ?? [], c], x.value = "", u.value = []);
208
- }
209
- function E(b) {
210
- e.value = (e.value ?? []).filter((c) => c !== b);
211
- }
212
- return (b, c) => (r(), F("div", Pe, [
213
- p.value ? $("", !0) : (r(), k(a(Ae), {
214
- key: 0,
215
- modelValue: x.value,
216
- "onUpdate:modelValue": c[0] || (c[0] = (h) => x.value = h),
217
- options: u.value,
218
- remote: "",
219
- loading: v.value,
220
- "min-length": 1,
221
- clearable: "",
222
- placeholder: a(i)("landing.recommended-search"),
223
- "aria-label": a(i)("landing.recommended-search"),
224
- onSearch: X,
225
- onSelect: Y
226
- }, null, 8, ["modelValue", "options", "loading", "placeholder", "aria-label"])),
227
- V.value ? (r(), k(a(U), {
228
- key: 1,
229
- size: "sm",
230
- tone: "danger"
231
- }, {
232
- default: f(() => [
233
- S(w(V.value), 1)
234
- ]),
235
- _: 1
236
- })) : $("", !0),
237
- W(a(Ne), {
238
- modelValue: L.value,
239
- "onUpdate:modelValue": c[1] || (c[1] = (h) => L.value = h),
240
- "item-key": "id",
241
- "item-label": "name",
242
- size: "sm",
243
- disabled: p.value,
244
- "empty-text": a(i)("landing.recommended-empty"),
245
- "aria-label": a(i)("landing.recommended")
246
- }, {
247
- default: f(({ item: h }) => [
248
- ne("span", Ue, [
249
- ne("span", Ie, w(h.name), 1),
250
- h.sku ? (r(), k(a(U), {
251
- key: 0,
252
- size: "sm",
253
- tone: "muted"
254
- }, {
255
- default: f(() => [
256
- S(w(h.sku), 1)
257
- ]),
258
- _: 2
259
- }, 1024)) : $("", !0),
260
- h.deleted ? (r(), k(a(pe), {
261
- key: 1,
262
- size: "sm",
263
- type: "warning",
264
- round: ""
265
- }, {
266
- default: f(() => [
267
- S(w(a(i)("panel.in-bin")), 1)
268
- ]),
269
- _: 1
270
- })) : $("", !0)
271
- ])
272
- ]),
273
- actions: f(({ item: h }) => [
274
- p.value ? $("", !0) : (r(), k(a(se), {
275
- key: 0,
276
- variant: "text",
277
- size: "sm",
278
- "aria-label": `${a(i)("landing.recommended-remove")}: ${h.name}`,
279
- onClick: (P) => E(h.id)
280
- }, {
281
- icon: f(() => [
282
- W(a(me), { name: "close" })
283
- ]),
284
- _: 1
285
- }, 8, ["aria-label", "onClick"]))
286
- ]),
287
- _: 1
288
- }, 8, ["modelValue", "disabled", "empty-text", "aria-label"])
289
- ]));
290
- }
291
- }), oe = (s, e) => {
292
- const l = s.__vccOpts || s;
293
- for (const [t, o] of e)
294
- l[t] = o;
295
- return l;
296
- }, Be = /* @__PURE__ */ oe(Me, [["__scopeId", "data-v-e1b47273"]]), Re = "catalog/landings";
297
- function je(s) {
298
- const e = new URLSearchParams();
299
- for (const [l, t] of Object.entries(s))
300
- t == null || t === "" || e.set(l, typeof t == "boolean" ? t ? "1" : "0" : String(t));
301
- return e;
302
- }
303
- function De(s) {
304
- const e = `${s.apiPath}/${Re}`, l = (t) => t.data;
305
- return {
306
- list: (t = {}) => {
307
- const o = je(t);
308
- return s.http.get(o.size > 0 ? `${e}?${o}` : e);
309
- },
310
- get: (t) => s.http.get(`${e}/${t}`).then(l),
311
- create: (t) => s.http.post(e, t).then(l),
312
- save: (t, o) => s.http.put(`${e}/${t}`, o).then(l),
313
- remove: (t) => s.http.delete(`${e}/${t}`).then(() => {
314
- }),
315
- restore: (t) => s.http.post(`${e}/${t}/restore`, {}).then(l),
316
- publish: (t, o) => s.http.post(`${e}/${t}/${o ? "publish" : "unpublish"}`, {}).then(l),
317
- count: (t, o, i = null) => s.http.post(`${e}/count`, { category_id: t, filters: o, except: i }).then(l),
318
- facets: (t) => s.http.get(t === null ? `${e}/facets` : `${e}/facets?category=${t}`).then(l),
319
- preview: (t) => s.http.post(`${e}/generate`, { ...t, dry_run: !0 }).then(l),
320
- generate: (t) => s.http.post(`${e}/generate`, t).then(l),
321
- run: (t) => s.http.get(`${e}/generate/${t}`).then(l)
322
- };
323
- }
324
- const He = [
325
- "category_id",
326
- "filters",
327
- "name",
328
- "slug",
329
- "h1",
330
- "text_above",
331
- "text_below",
332
- "sort",
333
- "on_category",
334
- "position",
335
- "recommended",
336
- "seo"
337
- ];
338
- function ut(s) {
339
- const e = {};
340
- for (const l of He) e[l] = s[l] ?? null;
341
- return Array.isArray(e.filters) && (e.filters = {}), e;
342
- }
343
- function ce(s) {
344
- const e = {};
345
- for (const [l, t] of Object.entries(s ?? {}))
346
- "values" in t ? t.values.length > 0 && (e[l] = { values: [...t.values] }) : (t.min !== null || t.max !== null) && (e[l] = { min: t.min, max: t.max });
347
- return e;
348
- }
349
- const Ke = { class: "wx-catalog-landing-set" }, qe = ["data-facet"], Ge = {
350
- key: 0,
351
- class: "wx-catalog-landing-set__range"
352
- }, Je = { class: "wx-catalog-landing-set__foot" }, Qe = /* @__PURE__ */ H({
353
- name: "WxCatalogLandingSet",
354
- __name: "LandingSetField",
355
- props: {
356
- modelValue: { default: null },
357
- modelModifiers: {}
358
- },
359
- emits: ["update:modelValue"],
360
- setup(s) {
361
- const e = K(s, "modelValue"), l = q(), t = De(l), o = J();
362
- Q();
363
- const i = G(I), z = ve(), p = A(() => o?.locked.value ?? !1), _ = A(() => {
364
- const n = o?.values.value.category_id;
365
- return typeof n == "number" ? n : n ? Number(n) : null;
366
- }), L = O([]), x = O(""), u = A(
367
- () => e.value && !Array.isArray(e.value) ? e.value : {}
368
- ), v = (n) => L.value.find((d) => d.key === n), V = A(
369
- () => L.value.filter((n) => !(n.key in u.value)).map((n) => ({ value: n.key, label: n.label }))
370
- );
371
- let C = 0;
372
- async function X() {
373
- const n = ++C;
374
- x.value = "";
375
- try {
376
- const d = await t.facets(_.value);
377
- n === C && (L.value = d);
378
- } catch (d) {
379
- n === C && (x.value = z(d));
380
- }
381
- }
382
- ae(_, () => {
383
- X();
384
- }, { immediate: !0 });
385
- function Y(n, d) {
386
- const g = v(n);
387
- return g ? g.kind === "range" : !("values" in d);
388
- }
389
- function E(n) {
390
- e.value = n;
391
- }
392
- function b(n) {
393
- const d = v(String(n));
394
- d && E({
395
- ...u.value,
396
- [d.key]: d.kind === "range" ? { min: null, max: null } : { values: [] }
397
- });
398
- }
399
- function c(n) {
400
- const d = { ...u.value };
401
- delete d[n], E(d);
402
- }
403
- function h(n) {
404
- return "values" in n ? n.values : [];
405
- }
406
- function P(n) {
407
- return "values" in n ? { min: null, max: null } : n;
408
- }
409
- function N(n, d) {
410
- const g = v(n)?.values ?? [], m = g.map((y) => ({
411
- value: y.value,
412
- label: `${y.label} (${y.count})`
413
- }));
414
- for (const y of h(d))
415
- if (!g.some((ee) => ee.value === y)) {
416
- const ee = fe(n, y);
417
- m.push({ value: y, label: `${ee} (0)` });
418
- }
419
- return m;
420
- }
421
- function fe(n, d) {
422
- return o?.landing.value?.chips.find((g) => g.key === n)?.text ?? `#${d}`;
423
- }
424
- function be(n, d) {
425
- E({ ...u.value, [n]: { values: Array.isArray(d) ? d.map(String) : [] } });
426
- }
427
- function ie(n, d, g) {
428
- const m = u.value[n], y = m ? P(m) : { min: null, max: null };
429
- E({ ...u.value, [n]: { ...y, [d]: g ?? null } });
430
- }
431
- function M(n) {
432
- return v(n)?.label ?? n;
433
- }
434
- const T = O(null), B = O(!1), R = O("");
435
- let Z, j = 0;
436
- const ye = A(() => JSON.stringify([_.value, ce(u.value)]));
437
- async function _e() {
438
- const n = ++j, d = ce(u.value);
439
- if (Object.keys(d).length === 0) {
440
- T.value = null, B.value = !1, o && (o.suggested.value = {});
441
- return;
442
- }
443
- B.value = !0, R.value = "";
444
- try {
445
- const g = await t.count(_.value, d, o?.landing.value?.id ?? null);
446
- if (n !== j) return;
447
- T.value = g, o && (o.suggested.value = Array.isArray(g.suggested) ? {} : g.suggested);
448
- } catch (g) {
449
- n === j && (T.value = null, R.value = z(g));
450
- } finally {
451
- n === j && (B.value = !1);
452
- }
453
- }
454
- ae(
455
- ye,
456
- () => {
457
- clearTimeout(Z), Z = setTimeout(() => {
458
- _e();
459
- }, 350);
460
- },
461
- { immediate: !0 }
462
- ), we(() => clearTimeout(Z));
463
- const de = A(
464
- () => T.value?.taken && o ? `${o.list}/${T.value.taken.id}` : null
465
- );
466
- return (n, d) => (r(), F("div", Ke, [
467
- x.value ? (r(), k(a(te), {
468
- key: 0,
469
- type: "danger"
470
- }, {
471
- default: f(() => [
472
- S(w(x.value), 1)
473
- ]),
474
- _: 1
475
- })) : $("", !0),
476
- Object.keys(u.value).length === 0 ? (r(), k(a(U), {
477
- key: 1,
478
- tone: "muted",
479
- size: "sm"
480
- }, {
481
- default: f(() => [
482
- S(w(a(i)("landing.set-empty")), 1)
483
- ]),
484
- _: 1
485
- })) : $("", !0),
486
- (r(!0), F(Se, null, $e(u.value, (g, m) => (r(), F("div", {
487
- key: m,
488
- class: "wx-catalog-landing-set__row",
489
- "data-facet": m
490
- }, [
491
- W(a(U), {
492
- class: "wx-catalog-landing-set__label",
493
- size: "sm",
494
- weight: "medium"
495
- }, {
496
- default: f(() => [
497
- S(w(M(String(m))), 1)
498
- ]),
499
- _: 2
500
- }, 1024),
501
- Y(String(m), g) ? (r(), F("div", Ge, [
502
- W(a(ue), {
503
- "model-value": P(g).min,
504
- controls: !1,
505
- disabled: p.value,
506
- size: "sm",
507
- placeholder: v(String(m))?.min?.toString() ?? a(i)("landing.set-from"),
508
- "aria-label": `${M(String(m))}: ${a(i)("landing.set-from")}`,
509
- "onUpdate:modelValue": (y) => ie(String(m), "min", y)
510
- }, null, 8, ["model-value", "disabled", "placeholder", "aria-label", "onUpdate:modelValue"]),
511
- W(a(ue), {
512
- "model-value": P(g).max,
513
- controls: !1,
514
- disabled: p.value,
515
- size: "sm",
516
- placeholder: v(String(m))?.max?.toString() ?? a(i)("landing.set-to"),
517
- "aria-label": `${M(String(m))}: ${a(i)("landing.set-to")}`,
518
- "onUpdate:modelValue": (y) => ie(String(m), "max", y)
519
- }, null, 8, ["model-value", "disabled", "placeholder", "aria-label", "onUpdate:modelValue"])
520
- ])) : (r(), k(a(le), {
521
- key: 1,
522
- class: "wx-catalog-landing-set__values",
523
- "model-value": h(g),
524
- options: N(String(m), g),
525
- multiple: "",
526
- filterable: "",
527
- clearable: "",
528
- size: "sm",
529
- disabled: p.value,
530
- placeholder: a(i)("landing.set-values"),
531
- "aria-label": M(String(m)),
532
- "onUpdate:modelValue": (y) => be(String(m), y)
533
- }, null, 8, ["model-value", "options", "disabled", "placeholder", "aria-label", "onUpdate:modelValue"])),
534
- W(a(se), {
535
- variant: "text",
536
- size: "sm",
537
- disabled: p.value,
538
- "aria-label": a(i)("landing.set-remove"),
539
- title: a(i)("landing.set-remove"),
540
- onClick: (y) => c(String(m))
541
- }, {
542
- icon: f(() => [
543
- W(a(me), { name: "close" })
544
- ]),
545
- _: 1
546
- }, 8, ["disabled", "aria-label", "title", "onClick"])
547
- ], 8, qe))), 128)),
548
- ne("div", Je, [
549
- V.value.length > 0 ? (r(), k(a(le), {
550
- key: 0,
551
- class: "wx-catalog-landing-set__add",
552
- "model-value": null,
553
- options: V.value,
554
- filterable: "",
555
- size: "sm",
556
- disabled: p.value,
557
- placeholder: a(i)("landing.set-add"),
558
- "aria-label": a(i)("landing.set-add"),
559
- "onUpdate:modelValue": b
560
- }, null, 8, ["options", "disabled", "placeholder", "aria-label"])) : $("", !0),
561
- B.value ? (r(), k(a(U), {
562
- key: 1,
563
- size: "sm",
564
- tone: "muted"
565
- }, {
566
- default: f(() => [
567
- S(w(a(i)("landing.set-counting")), 1)
568
- ]),
569
- _: 1
570
- })) : T.value ? (r(), k(a(pe), {
571
- key: 2,
572
- class: "wx-catalog-landing-set__count",
573
- type: T.value.count > 0 ? "success" : "warning",
574
- size: "sm",
575
- round: ""
576
- }, {
577
- default: f(() => [
578
- S(w(a(i)("landing.set-count", { count: T.value.count })), 1)
579
- ]),
580
- _: 1
581
- }, 8, ["type"])) : $("", !0)
582
- ]),
583
- R.value ? (r(), k(a(te), {
584
- key: 2,
585
- type: "danger"
586
- }, {
587
- default: f(() => [
588
- S(w(R.value), 1)
589
- ]),
590
- _: 1
591
- })) : $("", !0),
592
- T.value?.taken ? (r(), k(a(te), {
593
- key: 3,
594
- type: "warning"
595
- }, {
596
- default: f(() => [
597
- S(w(a(i)("landing.set-taken", { name: T.value.taken.name })) + " ", 1),
598
- de.value ? (r(), k(a(Ce), {
599
- key: 0,
600
- as: a(Fe),
601
- to: de.value
602
- }, {
603
- default: f(() => [
604
- S(w(a(i)("landing.set-open-taken")), 1)
605
- ]),
606
- _: 1
607
- }, 8, ["as", "to"])) : $("", !0)
608
- ]),
609
- _: 1
610
- })) : $("", !0)
611
- ]));
612
- }
613
- }), Xe = /* @__PURE__ */ oe(Qe, [["__scopeId", "data-v-899dfed0"]]), Ye = { class: "wx-catalog-landing-slug" }, Ze = {
614
- key: 0,
615
- class: "wx-catalog-landing-slug__hint"
616
- }, et = /* @__PURE__ */ H({
617
- name: "WxCatalogLandingSlug",
618
- __name: "LandingSlugField",
619
- props: /* @__PURE__ */ Le({
620
- localized: { type: Boolean, default: !1 }
621
- }, {
622
- modelValue: { default: null },
623
- modelModifiers: {}
624
- }),
625
- emits: ["update:modelValue"],
626
- setup(s) {
627
- const e = s, l = K(s, "modelValue"), t = J(), o = Te();
628
- Q();
629
- const i = G(I), z = A(() => t?.locked.value ?? !1), p = A(
630
- () => l.value && typeof l.value == "object" ? l.value : {}
631
- ), _ = A(() => {
632
- const x = t?.suggested.value ?? {}, u = o.active.value || Object.keys(x)[0] || "", v = x[u];
633
- return v ? (e.localized ? p.value[u] : l.value) === v ? null : v : null;
634
- });
635
- function L() {
636
- const x = t?.suggested.value ?? {};
637
- if (!e.localized) {
638
- l.value = _.value;
639
- return;
640
- }
641
- const u = { ...p.value }, v = o.active.value;
642
- for (const [V, C] of Object.entries(x))
643
- (V === v || !u[V]) && (u[V] = C);
644
- l.value = u;
645
- }
646
- return (x, u) => (r(), F("div", Ye, [
647
- W(a(Oe), {
648
- "model-value": l.value ?? void 0,
649
- localized: e.localized,
650
- disabled: z.value,
651
- maxlength: 255,
652
- "onUpdate:modelValue": u[0] || (u[0] = (v) => l.value = v)
653
- }, null, 8, ["model-value", "localized", "disabled"]),
654
- _.value && !z.value ? (r(), F("div", Ze, [
655
- W(a(U), {
656
- size: "sm",
657
- tone: "muted"
658
- }, {
659
- default: f(() => [
660
- S(w(a(i)("landing.slug-suggested", { slug: _.value })), 1)
661
- ]),
662
- _: 1
663
- }),
664
- W(a(se), {
665
- size: "sm",
666
- variant: "text",
667
- onClick: L
668
- }, {
669
- default: f(() => [
670
- S(w(a(i)("landing.slug-use")), 1)
671
- ]),
672
- _: 1
673
- })
674
- ])) : $("", !0)
675
- ]));
676
- }
677
- }), tt = /* @__PURE__ */ oe(et, [["__scopeId", "data-v-b1f93497"]]), D = "default", at = /* @__PURE__ */ H({
678
- name: "WxCatalogLandingSort",
679
- __name: "LandingSortField",
680
- props: {
681
- modelValue: { default: null },
682
- modelModifiers: {}
683
- },
684
- emits: ["update:modelValue"],
685
- setup(s) {
686
- const e = K(s, "modelValue"), l = q(), t = ze(l), o = J();
687
- Q();
688
- const i = G(I), z = A(() => [
689
- // The registry's own 'default' stands for «none of the landing's own»: the category's order.
690
- { value: D, label: i("landing.sort-default") },
691
- ...t.sorts.value.filter((p) => p.key !== D).map((p) => ({ value: p.key, label: p.label }))
692
- ]);
693
- return Ve(() => {
694
- t.load().catch(() => {
695
- });
696
- }), (p, _) => (r(), k(a(le), {
697
- "model-value": e.value ?? D,
698
- options: z.value,
699
- disabled: a(o)?.locked.value ?? !1,
700
- "onUpdate:modelValue": _[0] || (_[0] = (L) => e.value = L && L !== D ? String(L) : null)
701
- }, null, 8, ["model-value", "options", "disabled"]));
702
- }
703
- });
704
- function rt(s = {}) {
705
- const e = s.path ?? "/catalog", l = { base: e };
706
- return [
707
- {
708
- id: "catalog-landings",
709
- path: `${e}/landings`,
710
- routes: [
711
- {
712
- path: `${e}/landings`,
713
- name: "webx.catalog-landings",
714
- component: () => import("./LandingsPage-BAIQAJv2.js"),
715
- props: l
716
- },
717
- {
718
- path: `${e}/landings/new`,
719
- name: "webx.catalog-landings.new",
720
- component: () => import("./LandingEditorPage-Dt1xmQXl.js"),
721
- props: l
722
- },
723
- {
724
- path: `${e}/landings/:id(\\d+)`,
725
- name: "webx.catalog-landings.edit",
726
- component: () => import("./LandingEditorPage-Dt1xmQXl.js"),
727
- props: l
728
- }
729
- ],
730
- types: {
731
- // Wide: a facet's row is a label, a list of values and a button, and half a form is too
732
- // narrow for a combobox of brands beside its label.
733
- "wx-catalog-landing-set": { component: Xe, kind: "field", wide: !0 },
734
- "wx-catalog-landing-slug": { component: tt, kind: "field" },
735
- "wx-catalog-landing-sort": { component: at, kind: "field" },
736
- "wx-catalog-landing-products": {
737
- component: Be,
738
- kind: "field",
739
- wide: !0
740
- }
741
- }
742
- }
743
- ];
744
- }
745
- const ct = ge(() => import("./LandingsPage-BAIQAJv2.js")), gt = ge(() => import("./LandingEditorPage-Dt1xmQXl.js"));
746
- export {
747
- He as F,
748
- Re as L,
749
- I as N,
750
- gt as W,
751
- oe as _,
752
- ce as a,
753
- Be as b,
754
- De as c,
755
- Xe as d,
756
- tt as e,
757
- ut as f,
758
- at as g,
759
- ct as h,
760
- rt as i,
761
- Ee as j,
762
- je as k,
763
- he as l,
764
- J as m,
765
- dt as p,
766
- Q as u
767
- };
768
- //# sourceMappingURL=index-DEreqbgG.js.map