@webx-ui/module-catalog-landings 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1903 @@
1
+ import { provide as Qe, inject as Xe, defineComponent as ge, computed as x, ref as S, watch as de, onMounted as Ve, onBeforeUnmount as Ue, openBlock as v, createElementBlock as B, Fragment as re, createVNode as n, unref as e, withCtx as l, createSlots as Ye, createTextVNode as w, toDisplayString as f, createBlock as O, createCommentVNode as M, useModel as Se, createElementVNode as le, renderList as Ae, mergeModels as Ze, isRef as ea } from "vue";
2
+ import { useRoute as Me, useRouter as qe, onBeforeRouteLeave as aa, RouterLink as la } from "vue-router";
3
+ import { useLocales as $e, localizedValue as ze, confirm as Te, WxSkeleton as Pe, WxCard as ta, WxBreadcrumb as na, WxBreadcrumbItem as Ee, WxBadge as ue, WxAlert as be, WxActionBar as sa, WxButton as se, toast as I, WxAutocomplete as oa, WxText as X, WxSortableList as ua, WxIcon as xe, WxInputNumber as Ne, WxSelect as _e, WxLink as ia, WxInput as fe, useModal as ra, WxDialog as da, WxFormItem as K, WxTreeSelect as Ie, WxSwitch as he, WxTable as Re, WxProgress as ca, WxSpace as va, createModal as ga, WxTooltip as pa } from "@webx-ui/core";
4
+ import { useAdmin as pe, useTranslate as ce, useErrorText as ke, provideHistorySubject as ma, useBodyKeys as fa, WxScreenHead as ha, WxScreen as ba, WxSaveState as ya, rowMenuWidth as _a, WxListScreen as ka, WxRowMenu as wa, WxDate as xa, WxFilterChips as Va } from "@webx-ui/module-admin";
5
+ import { createCatalogApi as Sa, useFacetRegistry as $a, useCategoryTree as je } from "@webx-ui/module-catalog";
6
+ const Wa = "catalog/landings";
7
+ function Ca(y) {
8
+ const i = new URLSearchParams();
9
+ for (const [g, s] of Object.entries(y))
10
+ s == null || s === "" || i.set(g, typeof s == "boolean" ? s ? "1" : "0" : String(s));
11
+ return i;
12
+ }
13
+ function We(y) {
14
+ const i = `${y.apiPath}/${Wa}`, g = (s) => s.data;
15
+ return {
16
+ list: (s = {}) => {
17
+ const _ = Ca(s);
18
+ return y.http.get(_.size > 0 ? `${i}?${_}` : i);
19
+ },
20
+ get: (s) => y.http.get(`${i}/${s}`).then(g),
21
+ create: (s) => y.http.post(i, s).then(g),
22
+ save: (s, _) => y.http.put(`${i}/${s}`, _).then(g),
23
+ remove: (s) => y.http.delete(`${i}/${s}`).then(() => {
24
+ }),
25
+ restore: (s) => y.http.post(`${i}/${s}/restore`, {}).then(g),
26
+ publish: (s, _) => y.http.post(`${i}/${s}/${_ ? "publish" : "unpublish"}`, {}).then(g),
27
+ count: (s, _, V = null) => y.http.post(`${i}/count`, { category_id: s, filters: _, except: V }).then(g),
28
+ facets: (s) => y.http.get(s === null ? `${i}/facets` : `${i}/facets?category=${s}`).then(g),
29
+ preview: (s) => y.http.post(`${i}/generate`, { ...s, dry_run: !0 }).then(g),
30
+ generate: (s) => y.http.post(`${i}/generate`, s).then(g),
31
+ run: (s) => y.http.get(`${i}/generate/${s}`).then(g)
32
+ };
33
+ }
34
+ const La = [
35
+ "category_id",
36
+ "filters",
37
+ "name",
38
+ "slug",
39
+ "h1",
40
+ "text_above",
41
+ "text_below",
42
+ "sort",
43
+ "on_category",
44
+ "position",
45
+ "recommended",
46
+ "seo"
47
+ ];
48
+ function za(y) {
49
+ const i = {};
50
+ for (const g of La) i[g] = y[g] ?? null;
51
+ return Array.isArray(i.filters) && (i.filters = {}), i;
52
+ }
53
+ function Oe(y) {
54
+ const i = {};
55
+ for (const [g, s] of Object.entries(y ?? {}))
56
+ "values" in s ? s.values.length > 0 && (i[g] = { values: [...s.values] }) : (s.min !== null || s.max !== null) && (i[g] = { min: s.min, max: s.max });
57
+ return i;
58
+ }
59
+ const De = /* @__PURE__ */ Symbol("wx-catalog-landing");
60
+ function Ta(y) {
61
+ Qe(De, y);
62
+ }
63
+ function Ce() {
64
+ return Xe(De, null);
65
+ }
66
+ const Na = {
67
+ module: {
68
+ title: "Landings",
69
+ landing: "Landing"
70
+ },
71
+ landing: {
72
+ category_id: "Base",
73
+ filters: "Set",
74
+ name: "Name",
75
+ slug: "Address",
76
+ h1: "H1",
77
+ text_above: "Text above the list",
78
+ text_below: "Text under the list",
79
+ sort: "Default sort",
80
+ on_category: "In the category’s collections",
81
+ position: "Order",
82
+ is_published: "Published",
83
+ attention: "Needs attention",
84
+ "whole-catalog": "The whole catalogue",
85
+ "tab-main": "Main",
86
+ "tab-texts": "Texts",
87
+ "tab-recommended": "Recommended",
88
+ "tab-seo": "SEO",
89
+ "tab-history": "History",
90
+ display: "On the site",
91
+ "name-help": "The label in the panel and in the links of the collections.",
92
+ "category-help": "The list the landing narrows. Empty — the whole catalogue.",
93
+ "slug-help": "From the site’s root, like a category’s: /laptops-apple/.",
94
+ "sort-help": "The order a reader sees first; the one they choose wins.",
95
+ "sort-default": "As the category",
96
+ "on-category-help": "A link in «Collections» on the page of the base.",
97
+ "position-help": "Smaller first, in the collections and among the neighbours.",
98
+ "h1-help": "Empty — the name.",
99
+ "text-help": "Shown on the landing’s first page with nothing more chosen.",
100
+ recommended: "Recommended products",
101
+ "recommended-help": "A strip over the list, in this order; the list itself does not change.",
102
+ "recommended-search": "Find a product by name or SKU",
103
+ "recommended-empty": "No products picked.",
104
+ "recommended-remove": "Remove",
105
+ "set-add": "Add a facet",
106
+ "set-empty": "Add a facet and choose its values.",
107
+ "set-remove": "Remove the facet",
108
+ "set-values": "Choose values",
109
+ "set-from": "From",
110
+ "set-to": "To",
111
+ "set-count": "Products: :count",
112
+ "set-counting": "Counting…",
113
+ "set-taken": "This set on this base is already the landing «:name».",
114
+ "set-open-taken": "Open it",
115
+ "slug-suggested": "Suggested: :slug",
116
+ "slug-use": "Use",
117
+ "attention-value_removed": "A value of the set was deleted",
118
+ "attention-duplicate": "The set became another landing’s",
119
+ "attention-empty_set": "Nothing is left of the set"
120
+ },
121
+ panel: {
122
+ new: "New landing",
123
+ generate: "Create in bulk",
124
+ empty: "No landings yet.",
125
+ "empty-help": "A landing is a category’s list with filters chosen in advance, under an address, texts and SEO of its own.",
126
+ "nothing-found": "Nothing matches the filters.",
127
+ search: "Name or address",
128
+ "column-name": "Name",
129
+ "column-base": "Base",
130
+ "column-set": "Set",
131
+ "column-count": "Products",
132
+ "column-state": "State",
133
+ "column-updated": "Updated",
134
+ "filter-base": "Base",
135
+ "filter-attention": "Needs attention",
136
+ "filter-published": "Published only",
137
+ "filter-empty": "Empty only",
138
+ "filter-trashed": "In the bin",
139
+ published: "Published",
140
+ unpublished: "Not published",
141
+ "not-counted": "Not counted yet",
142
+ open: "Open",
143
+ "open-site": "Open on the site",
144
+ publish: "Publish",
145
+ unpublish: "Unpublish",
146
+ delete: "Delete",
147
+ restore: "Restore",
148
+ "delete-title": "Delete «:name»?",
149
+ "delete-text": "It goes to the bin, and its address stops answering. Its set stays taken until it is gone for good.",
150
+ deleted: "The landing is in the bin.",
151
+ restored: "The landing is back.",
152
+ "published-toast": "The landing is published.",
153
+ "unpublished-toast": "The landing is unpublished.",
154
+ saved: "The landing is saved.",
155
+ created: "The landing is created.",
156
+ save: "Save",
157
+ create: "Create",
158
+ "save-failed": "Not saved — see the fields.",
159
+ cancel: "Cancel",
160
+ "leave-title": "Leave without saving?",
161
+ "leave-text": "What you changed here will be lost.",
162
+ leave: "Leave",
163
+ untitled: "A new landing",
164
+ "in-bin": "In the bin",
165
+ trail: "Where you are"
166
+ },
167
+ generate: {
168
+ title: "Create landings in bulk",
169
+ bases: "Bases",
170
+ "bases-help": "One category or several; a landing per category and value.",
171
+ subtree: "With every category under them",
172
+ facet: "Facet",
173
+ values: "Values",
174
+ "values-help": "Empty — every value with products on the base.",
175
+ "min-products": "At least products",
176
+ "min-products-help": "For «every value»: values with fewer products on the base are left out.",
177
+ templates: "Templates",
178
+ "templates-help": "{category} and {value} are replaced: the slugs in the address, the names in the texts.",
179
+ slug: "Address",
180
+ name: "Name",
181
+ h1: "H1",
182
+ "seo-title": "SEO title",
183
+ "seo-description": "SEO description",
184
+ "template-empty": "Empty — not set",
185
+ publish: "Publish at once",
186
+ preview: "Preview",
187
+ back: "Back",
188
+ run: "Create :count",
189
+ close: "Close",
190
+ "column-address": "Address",
191
+ "column-h1": "H1",
192
+ "column-count": "Products",
193
+ "column-conflict": "Skipped because",
194
+ summary: "Will be created: :free; skipped: :skipped.",
195
+ nothing: "Nothing to create: every row is skipped.",
196
+ running: "Creating landings…",
197
+ done: "Created: :done; skipped: :skipped; refused: :failed.",
198
+ failed: "The generation stopped. What was created stays.",
199
+ "conflict-slug-taken": "The address :slug is taken.",
200
+ "conflict-set-taken": "The set is already the landing «:name».",
201
+ "conflict-empty": "No products.",
202
+ "conflict-no-slug": "A slug or a name to fill the template with is missing."
203
+ }
204
+ }, ve = "webx-catalog-landings", Be = /* @__PURE__ */ new WeakSet();
205
+ function me() {
206
+ try {
207
+ const { i18n: y } = pe();
208
+ Be.has(y) || (y.defaults(ve, Na), Be.add(y));
209
+ } catch {
210
+ }
211
+ }
212
+ const Oa = /* @__PURE__ */ ge({
213
+ name: "WxCatalogLandingEditor",
214
+ __name: "LandingEditorPage",
215
+ props: {
216
+ base: { default: "/catalog" }
217
+ },
218
+ setup(y) {
219
+ const i = y, g = pe(), s = We(g), _ = Me(), V = qe(), R = $e();
220
+ me();
221
+ const t = ce(ve), u = ke(), z = x(() => `${i.base}/landings`), T = x(() => _.params.id === void 0 || _.params.id === "new"), W = x(() => T.value ? null : Number(_.params.id)), h = S(null), L = S({}), E = S(""), F = S({}), j = S(!0), P = S(!1), N = S({}), m = x(() => g.can("catalog.manage")), $ = x(() => (h.value?.deleted_at ?? null) !== null), A = x(() => !m.value || P.value || $.value), b = x(() => JSON.stringify(L.value)), H = x(() => E.value !== "" && b.value !== E.value), ie = x(() => P.value ? "saving" : H.value || T.value ? "unsaved" : "saved"), Z = x(
222
+ () => g.state.manifest?.modules.find((a) => a.id === "catalog-landings")?.title ?? t("module.title")
223
+ ), J = x(() => {
224
+ const a = L.value.name;
225
+ return ze(a, R.active.value, "") || t("panel.untitled");
226
+ }), q = x(() => {
227
+ const a = h.value;
228
+ if (a)
229
+ return [a.category ?? t("landing.whole-catalog"), a.url ?? ""].filter(Boolean).join(" · ");
230
+ });
231
+ Ta({ landing: h, values: L, locked: A, suggested: F, list: z.value }), ma({ id: x(() => h.value?.id ?? null) });
232
+ function D(a) {
233
+ h.value = a, L.value = za(a), E.value = JSON.stringify(L.value);
234
+ }
235
+ function te() {
236
+ h.value = null, L.value = {
237
+ category_id: _.query.category ? Number(_.query.category) : null,
238
+ filters: {},
239
+ name: {},
240
+ slug: {},
241
+ h1: {},
242
+ text_above: {},
243
+ text_below: {},
244
+ sort: null,
245
+ on_category: !1,
246
+ position: 0,
247
+ recommended: [],
248
+ seo: {}
249
+ }, E.value = JSON.stringify(L.value);
250
+ }
251
+ async function Y() {
252
+ if (N.value = {}, W.value === null) {
253
+ te(), j.value = !1;
254
+ return;
255
+ }
256
+ j.value = !0;
257
+ try {
258
+ D(await s.get(W.value));
259
+ } catch (a) {
260
+ I.danger(u(a)), V.push(z.value);
261
+ } finally {
262
+ j.value = !1;
263
+ }
264
+ }
265
+ function G() {
266
+ return { ...L.value, filters: Oe(L.value.filters) };
267
+ }
268
+ async function Q() {
269
+ if (!(P.value || !m.value)) {
270
+ P.value = !0, N.value = {};
271
+ try {
272
+ if (W.value === null) {
273
+ const a = await s.create(G());
274
+ D(a), I.success(t("panel.created")), await V.replace(`${z.value}/${a.id}`);
275
+ } else
276
+ D(await s.save(W.value, G())), I.success(t("panel.saved"));
277
+ } catch (a) {
278
+ const o = a.body;
279
+ o?.errors && Object.keys(o.errors).length > 0 ? (N.value = o.errors, I.danger(t("panel.save-failed"))) : I.danger(u(a));
280
+ } finally {
281
+ P.value = !1;
282
+ }
283
+ }
284
+ }
285
+ async function ee(a) {
286
+ const o = h.value;
287
+ if (o)
288
+ try {
289
+ const ae = await s.publish(o.id, a);
290
+ h.value = { ...o, ...ae }, I.success(t(a ? "panel.published-toast" : "panel.unpublished-toast"));
291
+ } catch (ae) {
292
+ I.danger(u(ae));
293
+ }
294
+ }
295
+ async function ne() {
296
+ const a = h.value;
297
+ if (!(!a || !await Te({
298
+ title: t("panel.delete-title", { name: J.value }),
299
+ message: t("panel.delete-text"),
300
+ confirmText: t("panel.delete"),
301
+ cancelText: t("panel.cancel"),
302
+ tone: "danger"
303
+ })))
304
+ try {
305
+ await s.remove(a.id), I.success(t("panel.deleted")), E.value = b.value, V.push(z.value);
306
+ } catch (ae) {
307
+ I.danger(u(ae));
308
+ }
309
+ }
310
+ async function c() {
311
+ const a = h.value;
312
+ if (a)
313
+ try {
314
+ D(await s.restore(a.id)), I.success(t("panel.restored"));
315
+ } catch (o) {
316
+ I.danger(u(o));
317
+ }
318
+ }
319
+ function C(a) {
320
+ H.value && a.preventDefault();
321
+ }
322
+ function U(a) {
323
+ (a.ctrlKey || a.metaKey) && a.key.toLowerCase() === "s" && (a.preventDefault(), (H.value || T.value) && Q());
324
+ }
325
+ fa(U), de(W, (a, o) => {
326
+ o === null && a !== null && h.value?.id === a || Y();
327
+ }), Ve(() => {
328
+ Y(), window.addEventListener("beforeunload", C);
329
+ }), Ue(() => {
330
+ window.removeEventListener("beforeunload", C);
331
+ }), aa(async () => !H.value || !m.value ? !0 : await Te({
332
+ title: t("panel.leave-title"),
333
+ message: t("panel.leave-text"),
334
+ confirmText: t("panel.leave"),
335
+ cancelText: t("panel.cancel"),
336
+ tone: "danger"
337
+ }));
338
+ const r = x(() => {
339
+ const a = h.value;
340
+ if (!a || !m.value) return [];
341
+ if ($.value)
342
+ return [
343
+ { key: "restore", label: t("panel.restore"), icon: "refresh", run: () => {
344
+ c();
345
+ } }
346
+ ];
347
+ const o = [];
348
+ return a.url && o.push({
349
+ key: "site",
350
+ label: t("panel.open-site"),
351
+ icon: "external-link",
352
+ run: () => {
353
+ window.open(a.url ?? "", "_blank", "noopener");
354
+ }
355
+ }), o.push(
356
+ a.is_published ? {
357
+ key: "unpublish",
358
+ label: t("panel.unpublish"),
359
+ icon: "eye-off",
360
+ run: () => {
361
+ ee(!1);
362
+ }
363
+ } : { key: "publish", label: t("panel.publish"), icon: "eye", run: () => {
364
+ ee(!0);
365
+ } },
366
+ {
367
+ key: "delete",
368
+ label: t("panel.delete"),
369
+ icon: "trash",
370
+ danger: !0,
371
+ menu: !0,
372
+ run: () => {
373
+ ne();
374
+ }
375
+ }
376
+ ), o;
377
+ });
378
+ return (a, o) => (v(), B("div", {
379
+ class: "wx-catalog-landing-editor",
380
+ onKeydown: U
381
+ }, [
382
+ j.value ? (v(), B(re, { key: 0 }, [
383
+ n(e(Pe), {
384
+ class: "wx-catalog-landing-editor__ghost",
385
+ title: "",
386
+ rows: 1
387
+ }),
388
+ n(e(ta), null, {
389
+ default: l(() => [
390
+ n(e(Pe), { rows: 6 })
391
+ ]),
392
+ _: 1
393
+ })
394
+ ], 64)) : (v(), B(re, { key: 1 }, [
395
+ n(e(ha), {
396
+ divider: "",
397
+ back: z.value,
398
+ "back-label": Z.value,
399
+ title: J.value,
400
+ subtitle: q.value,
401
+ actions: r.value
402
+ }, Ye({
403
+ trail: l(() => [
404
+ n(e(na), {
405
+ size: "sm",
406
+ label: e(t)("panel.trail")
407
+ }, {
408
+ default: l(() => [
409
+ n(e(Ee), {
410
+ as: "router-link",
411
+ to: z.value
412
+ }, {
413
+ default: l(() => [
414
+ w(f(Z.value), 1)
415
+ ]),
416
+ _: 1
417
+ }, 8, ["to"]),
418
+ n(e(Ee), { current: "" }, {
419
+ default: l(() => [
420
+ w(f(J.value), 1)
421
+ ]),
422
+ _: 1
423
+ })
424
+ ]),
425
+ _: 1
426
+ }, 8, ["label"])
427
+ ]),
428
+ _: 2
429
+ }, [
430
+ h.value ? {
431
+ name: "title-after",
432
+ fn: l(() => [
433
+ $.value ? (v(), O(e(ue), {
434
+ key: 0,
435
+ dot: ""
436
+ }, {
437
+ default: l(() => [
438
+ w(f(e(t)("panel.in-bin")), 1)
439
+ ]),
440
+ _: 1
441
+ })) : (v(), O(e(ue), {
442
+ key: 1,
443
+ type: h.value.is_published ? "success" : "default",
444
+ dot: "",
445
+ size: "sm"
446
+ }, {
447
+ default: l(() => [
448
+ w(f(e(t)(h.value.is_published ? "panel.published" : "panel.unpublished")), 1)
449
+ ]),
450
+ _: 1
451
+ }, 8, ["type"]))
452
+ ]),
453
+ key: "0"
454
+ } : void 0
455
+ ]), 1032, ["back", "back-label", "title", "subtitle", "actions"]),
456
+ h.value?.attention ? (v(), O(e(be), {
457
+ key: 0,
458
+ type: "warning"
459
+ }, {
460
+ default: l(() => [
461
+ w(f(e(t)(`landing.attention-${h.value.attention}`)), 1)
462
+ ]),
463
+ _: 1
464
+ })) : M("", !0),
465
+ n(e(ba), {
466
+ modelValue: L.value,
467
+ "onUpdate:modelValue": o[0] || (o[0] = (ae) => L.value = ae),
468
+ name: "catalog.landing-form",
469
+ errors: N.value,
470
+ disabled: A.value
471
+ }, null, 8, ["modelValue", "errors", "disabled"]),
472
+ m.value && !$.value ? (v(), O(e(sa), { key: 1 }, {
473
+ state: l(() => [
474
+ n(e(ya), { state: ie.value }, null, 8, ["state"])
475
+ ]),
476
+ default: l(() => [
477
+ n(e(se), {
478
+ type: "primary",
479
+ loading: P.value,
480
+ disabled: !H.value && !T.value,
481
+ onClick: Q
482
+ }, {
483
+ default: l(() => [
484
+ w(f(e(t)(T.value ? "panel.create" : "panel.save")), 1)
485
+ ]),
486
+ _: 1
487
+ }, 8, ["loading", "disabled"])
488
+ ]),
489
+ _: 1
490
+ })) : M("", !0)
491
+ ], 64))
492
+ ], 32));
493
+ }
494
+ }), ye = (y, i) => {
495
+ const g = y.__vccOpts || y;
496
+ for (const [s, _] of i)
497
+ g[s] = _;
498
+ return g;
499
+ }, Fe = /* @__PURE__ */ ye(Oa, [["__scopeId", "data-v-0d735844"]]), Ua = { class: "wx-catalog-landing-products" }, Aa = { class: "wx-catalog-landing-products__item" }, Pa = { class: "wx-catalog-landing-products__name" }, Ea = /* @__PURE__ */ ge({
500
+ name: "WxCatalogLandingProducts",
501
+ __name: "LandingProductsField",
502
+ props: {
503
+ modelValue: { default: null },
504
+ modelModifiers: {}
505
+ },
506
+ emits: ["update:modelValue"],
507
+ setup(y) {
508
+ const i = Se(y, "modelValue"), g = pe(), s = Sa(g), _ = Ce();
509
+ me();
510
+ const V = ce(ve), R = ke(), t = x(() => _?.locked.value ?? !1), u = S(/* @__PURE__ */ new Map());
511
+ de(
512
+ () => _?.landing.value?.recommended_items,
513
+ (N) => {
514
+ for (const m of N ?? []) u.value.set(m.id, m);
515
+ },
516
+ { immediate: !0 }
517
+ );
518
+ const z = x({
519
+ get: () => (i.value ?? []).map(
520
+ (N) => u.value.get(N) ?? { id: N, name: `#${N}`, sku: null, deleted: !1 }
521
+ ),
522
+ set: (N) => {
523
+ i.value = N.map((m) => m.id);
524
+ }
525
+ }), T = S(""), W = S([]), h = S(!1), L = S("");
526
+ let E = 0;
527
+ async function F(N) {
528
+ const m = ++E;
529
+ h.value = !0, L.value = "";
530
+ try {
531
+ const $ = await s.products({ q: N, per_page: 10 });
532
+ if (m !== E) return;
533
+ const A = new Set(i.value ?? []);
534
+ W.value = $.data.filter((b) => !A.has(b.id)).map((b) => (u.value.set(b.id, { id: b.id, name: b.name, sku: b.sku }), {
535
+ value: String(b.id),
536
+ label: b.name,
537
+ description: b.sku ?? void 0
538
+ }));
539
+ } catch ($) {
540
+ m === E && (L.value = R($));
541
+ } finally {
542
+ m === E && (h.value = !1);
543
+ }
544
+ }
545
+ function j(N) {
546
+ const m = Number(N.value);
547
+ !Number.isFinite(m) || (i.value ?? []).includes(m) || (i.value = [...i.value ?? [], m], T.value = "", W.value = []);
548
+ }
549
+ function P(N) {
550
+ i.value = (i.value ?? []).filter((m) => m !== N);
551
+ }
552
+ return (N, m) => (v(), B("div", Ua, [
553
+ t.value ? M("", !0) : (v(), O(e(oa), {
554
+ key: 0,
555
+ modelValue: T.value,
556
+ "onUpdate:modelValue": m[0] || (m[0] = ($) => T.value = $),
557
+ options: W.value,
558
+ remote: "",
559
+ loading: h.value,
560
+ "min-length": 1,
561
+ clearable: "",
562
+ placeholder: e(V)("landing.recommended-search"),
563
+ "aria-label": e(V)("landing.recommended-search"),
564
+ onSearch: F,
565
+ onSelect: j
566
+ }, null, 8, ["modelValue", "options", "loading", "placeholder", "aria-label"])),
567
+ L.value ? (v(), O(e(X), {
568
+ key: 1,
569
+ size: "sm",
570
+ tone: "danger"
571
+ }, {
572
+ default: l(() => [
573
+ w(f(L.value), 1)
574
+ ]),
575
+ _: 1
576
+ })) : M("", !0),
577
+ n(e(ua), {
578
+ modelValue: z.value,
579
+ "onUpdate:modelValue": m[1] || (m[1] = ($) => z.value = $),
580
+ "item-key": "id",
581
+ "item-label": "name",
582
+ size: "sm",
583
+ disabled: t.value,
584
+ "empty-text": e(V)("landing.recommended-empty"),
585
+ "aria-label": e(V)("landing.recommended")
586
+ }, {
587
+ default: l(({ item: $ }) => [
588
+ le("span", Aa, [
589
+ le("span", Pa, f($.name), 1),
590
+ $.sku ? (v(), O(e(X), {
591
+ key: 0,
592
+ size: "sm",
593
+ tone: "muted"
594
+ }, {
595
+ default: l(() => [
596
+ w(f($.sku), 1)
597
+ ]),
598
+ _: 2
599
+ }, 1024)) : M("", !0),
600
+ $.deleted ? (v(), O(e(ue), {
601
+ key: 1,
602
+ size: "sm",
603
+ type: "warning",
604
+ round: ""
605
+ }, {
606
+ default: l(() => [
607
+ w(f(e(V)("panel.in-bin")), 1)
608
+ ]),
609
+ _: 1
610
+ })) : M("", !0)
611
+ ])
612
+ ]),
613
+ actions: l(({ item: $ }) => [
614
+ t.value ? M("", !0) : (v(), O(e(se), {
615
+ key: 0,
616
+ variant: "text",
617
+ size: "sm",
618
+ "aria-label": `${e(V)("landing.recommended-remove")}: ${$.name}`,
619
+ onClick: (A) => P($.id)
620
+ }, {
621
+ icon: l(() => [
622
+ n(e(xe), { name: "close" })
623
+ ]),
624
+ _: 1
625
+ }, 8, ["aria-label", "onClick"]))
626
+ ]),
627
+ _: 1
628
+ }, 8, ["modelValue", "disabled", "empty-text", "aria-label"])
629
+ ]));
630
+ }
631
+ }), Ba = /* @__PURE__ */ ye(Ea, [["__scopeId", "data-v-e1b47273"]]), Fa = { class: "wx-catalog-landing-set" }, Ma = ["data-facet"], qa = {
632
+ key: 0,
633
+ class: "wx-catalog-landing-set__range"
634
+ }, Ia = { class: "wx-catalog-landing-set__foot" }, Ra = /* @__PURE__ */ ge({
635
+ name: "WxCatalogLandingSet",
636
+ __name: "LandingSetField",
637
+ props: {
638
+ modelValue: { default: null },
639
+ modelModifiers: {}
640
+ },
641
+ emits: ["update:modelValue"],
642
+ setup(y) {
643
+ const i = Se(y, "modelValue"), g = pe(), s = We(g), _ = Ce();
644
+ me();
645
+ const V = ce(ve), R = ke(), t = x(() => _?.locked.value ?? !1), u = x(() => {
646
+ const c = _?.values.value.category_id;
647
+ return typeof c == "number" ? c : c ? Number(c) : null;
648
+ }), z = S([]), T = S(""), W = x(
649
+ () => i.value && !Array.isArray(i.value) ? i.value : {}
650
+ ), h = (c) => z.value.find((C) => C.key === c), L = x(
651
+ () => z.value.filter((c) => !(c.key in W.value)).map((c) => ({ value: c.key, label: c.label }))
652
+ );
653
+ let E = 0;
654
+ async function F() {
655
+ const c = ++E;
656
+ T.value = "";
657
+ try {
658
+ const C = await s.facets(u.value);
659
+ c === E && (z.value = C);
660
+ } catch (C) {
661
+ c === E && (T.value = R(C));
662
+ }
663
+ }
664
+ de(u, () => {
665
+ F();
666
+ }, { immediate: !0 });
667
+ function j(c, C) {
668
+ const U = h(c);
669
+ return U ? U.kind === "range" : !("values" in C);
670
+ }
671
+ function P(c) {
672
+ i.value = c;
673
+ }
674
+ function N(c) {
675
+ const C = h(String(c));
676
+ C && P({
677
+ ...W.value,
678
+ [C.key]: C.kind === "range" ? { min: null, max: null } : { values: [] }
679
+ });
680
+ }
681
+ function m(c) {
682
+ const C = { ...W.value };
683
+ delete C[c], P(C);
684
+ }
685
+ function $(c) {
686
+ return "values" in c ? c.values : [];
687
+ }
688
+ function A(c) {
689
+ return "values" in c ? { min: null, max: null } : c;
690
+ }
691
+ function b(c, C) {
692
+ const U = h(c)?.values ?? [], r = U.map((a) => ({
693
+ value: a.value,
694
+ label: `${a.label} (${a.count})`
695
+ }));
696
+ for (const a of $(C))
697
+ if (!U.some((o) => o.value === a)) {
698
+ const o = H(c, a);
699
+ r.push({ value: a, label: `${o} (0)` });
700
+ }
701
+ return r;
702
+ }
703
+ function H(c, C) {
704
+ return _?.landing.value?.chips.find((U) => U.key === c)?.text ?? `#${C}`;
705
+ }
706
+ function ie(c, C) {
707
+ P({ ...W.value, [c]: { values: Array.isArray(C) ? C.map(String) : [] } });
708
+ }
709
+ function Z(c, C, U) {
710
+ const r = W.value[c], a = r ? A(r) : { min: null, max: null };
711
+ P({ ...W.value, [c]: { ...a, [C]: U ?? null } });
712
+ }
713
+ function J(c) {
714
+ return h(c)?.label ?? c;
715
+ }
716
+ const q = S(null), D = S(!1), te = S("");
717
+ let Y, G = 0;
718
+ const Q = x(() => JSON.stringify([u.value, Oe(W.value)]));
719
+ async function ee() {
720
+ const c = ++G, C = Oe(W.value);
721
+ if (Object.keys(C).length === 0) {
722
+ q.value = null, D.value = !1, _ && (_.suggested.value = {});
723
+ return;
724
+ }
725
+ D.value = !0, te.value = "";
726
+ try {
727
+ const U = await s.count(u.value, C, _?.landing.value?.id ?? null);
728
+ if (c !== G) return;
729
+ q.value = U, _ && (_.suggested.value = Array.isArray(U.suggested) ? {} : U.suggested);
730
+ } catch (U) {
731
+ c === G && (q.value = null, te.value = R(U));
732
+ } finally {
733
+ c === G && (D.value = !1);
734
+ }
735
+ }
736
+ de(
737
+ Q,
738
+ () => {
739
+ clearTimeout(Y), Y = setTimeout(() => {
740
+ ee();
741
+ }, 350);
742
+ },
743
+ { immediate: !0 }
744
+ ), Ue(() => clearTimeout(Y));
745
+ const ne = x(
746
+ () => q.value?.taken && _ ? `${_.list}/${q.value.taken.id}` : null
747
+ );
748
+ return (c, C) => (v(), B("div", Fa, [
749
+ T.value ? (v(), O(e(be), {
750
+ key: 0,
751
+ type: "danger"
752
+ }, {
753
+ default: l(() => [
754
+ w(f(T.value), 1)
755
+ ]),
756
+ _: 1
757
+ })) : M("", !0),
758
+ Object.keys(W.value).length === 0 ? (v(), O(e(X), {
759
+ key: 1,
760
+ tone: "muted",
761
+ size: "sm"
762
+ }, {
763
+ default: l(() => [
764
+ w(f(e(V)("landing.set-empty")), 1)
765
+ ]),
766
+ _: 1
767
+ })) : M("", !0),
768
+ (v(!0), B(re, null, Ae(W.value, (U, r) => (v(), B("div", {
769
+ key: r,
770
+ class: "wx-catalog-landing-set__row",
771
+ "data-facet": r
772
+ }, [
773
+ n(e(X), {
774
+ class: "wx-catalog-landing-set__label",
775
+ size: "sm",
776
+ weight: "medium"
777
+ }, {
778
+ default: l(() => [
779
+ w(f(J(String(r))), 1)
780
+ ]),
781
+ _: 2
782
+ }, 1024),
783
+ j(String(r), U) ? (v(), B("div", qa, [
784
+ n(e(Ne), {
785
+ "model-value": A(U).min,
786
+ controls: !1,
787
+ disabled: t.value,
788
+ size: "sm",
789
+ placeholder: h(String(r))?.min?.toString() ?? e(V)("landing.set-from"),
790
+ "aria-label": `${J(String(r))}: ${e(V)("landing.set-from")}`,
791
+ "onUpdate:modelValue": (a) => Z(String(r), "min", a)
792
+ }, null, 8, ["model-value", "disabled", "placeholder", "aria-label", "onUpdate:modelValue"]),
793
+ n(e(Ne), {
794
+ "model-value": A(U).max,
795
+ controls: !1,
796
+ disabled: t.value,
797
+ size: "sm",
798
+ placeholder: h(String(r))?.max?.toString() ?? e(V)("landing.set-to"),
799
+ "aria-label": `${J(String(r))}: ${e(V)("landing.set-to")}`,
800
+ "onUpdate:modelValue": (a) => Z(String(r), "max", a)
801
+ }, null, 8, ["model-value", "disabled", "placeholder", "aria-label", "onUpdate:modelValue"])
802
+ ])) : (v(), O(e(_e), {
803
+ key: 1,
804
+ class: "wx-catalog-landing-set__values",
805
+ "model-value": $(U),
806
+ options: b(String(r), U),
807
+ multiple: "",
808
+ filterable: "",
809
+ clearable: "",
810
+ size: "sm",
811
+ disabled: t.value,
812
+ placeholder: e(V)("landing.set-values"),
813
+ "aria-label": J(String(r)),
814
+ "onUpdate:modelValue": (a) => ie(String(r), a)
815
+ }, null, 8, ["model-value", "options", "disabled", "placeholder", "aria-label", "onUpdate:modelValue"])),
816
+ n(e(se), {
817
+ variant: "text",
818
+ size: "sm",
819
+ disabled: t.value,
820
+ "aria-label": e(V)("landing.set-remove"),
821
+ title: e(V)("landing.set-remove"),
822
+ onClick: (a) => m(String(r))
823
+ }, {
824
+ icon: l(() => [
825
+ n(e(xe), { name: "close" })
826
+ ]),
827
+ _: 1
828
+ }, 8, ["disabled", "aria-label", "title", "onClick"])
829
+ ], 8, Ma))), 128)),
830
+ le("div", Ia, [
831
+ L.value.length > 0 ? (v(), O(e(_e), {
832
+ key: 0,
833
+ class: "wx-catalog-landing-set__add",
834
+ "model-value": null,
835
+ options: L.value,
836
+ filterable: "",
837
+ size: "sm",
838
+ disabled: t.value,
839
+ placeholder: e(V)("landing.set-add"),
840
+ "aria-label": e(V)("landing.set-add"),
841
+ "onUpdate:modelValue": N
842
+ }, null, 8, ["options", "disabled", "placeholder", "aria-label"])) : M("", !0),
843
+ D.value ? (v(), O(e(X), {
844
+ key: 1,
845
+ size: "sm",
846
+ tone: "muted"
847
+ }, {
848
+ default: l(() => [
849
+ w(f(e(V)("landing.set-counting")), 1)
850
+ ]),
851
+ _: 1
852
+ })) : q.value ? (v(), O(e(ue), {
853
+ key: 2,
854
+ class: "wx-catalog-landing-set__count",
855
+ type: q.value.count > 0 ? "success" : "warning",
856
+ size: "sm",
857
+ round: ""
858
+ }, {
859
+ default: l(() => [
860
+ w(f(e(V)("landing.set-count", { count: q.value.count })), 1)
861
+ ]),
862
+ _: 1
863
+ }, 8, ["type"])) : M("", !0)
864
+ ]),
865
+ te.value ? (v(), O(e(be), {
866
+ key: 2,
867
+ type: "danger"
868
+ }, {
869
+ default: l(() => [
870
+ w(f(te.value), 1)
871
+ ]),
872
+ _: 1
873
+ })) : M("", !0),
874
+ q.value?.taken ? (v(), O(e(be), {
875
+ key: 3,
876
+ type: "warning"
877
+ }, {
878
+ default: l(() => [
879
+ w(f(e(V)("landing.set-taken", { name: q.value.taken.name })) + " ", 1),
880
+ ne.value ? (v(), O(e(ia), {
881
+ key: 0,
882
+ as: e(la),
883
+ to: ne.value
884
+ }, {
885
+ default: l(() => [
886
+ w(f(e(V)("landing.set-open-taken")), 1)
887
+ ]),
888
+ _: 1
889
+ }, 8, ["as", "to"])) : M("", !0)
890
+ ]),
891
+ _: 1
892
+ })) : M("", !0)
893
+ ]));
894
+ }
895
+ }), ja = /* @__PURE__ */ ye(Ra, [["__scopeId", "data-v-899dfed0"]]), Da = { class: "wx-catalog-landing-slug" }, Ha = {
896
+ key: 0,
897
+ class: "wx-catalog-landing-slug__hint"
898
+ }, Ka = /* @__PURE__ */ ge({
899
+ name: "WxCatalogLandingSlug",
900
+ __name: "LandingSlugField",
901
+ props: /* @__PURE__ */ Ze({
902
+ localized: { type: Boolean, default: !1 }
903
+ }, {
904
+ modelValue: { default: null },
905
+ modelModifiers: {}
906
+ }),
907
+ emits: ["update:modelValue"],
908
+ setup(y) {
909
+ const i = y, g = Se(y, "modelValue"), s = Ce(), _ = $e();
910
+ me();
911
+ const V = ce(ve), R = x(() => s?.locked.value ?? !1), t = x(
912
+ () => g.value && typeof g.value == "object" ? g.value : {}
913
+ ), u = x(() => {
914
+ const T = s?.suggested.value ?? {}, W = _.active.value || Object.keys(T)[0] || "", h = T[W];
915
+ return h ? (i.localized ? t.value[W] : g.value) === h ? null : h : null;
916
+ });
917
+ function z() {
918
+ const T = s?.suggested.value ?? {};
919
+ if (!i.localized) {
920
+ g.value = u.value;
921
+ return;
922
+ }
923
+ const W = { ...t.value }, h = _.active.value;
924
+ for (const [L, E] of Object.entries(T))
925
+ (L === h || !W[L]) && (W[L] = E);
926
+ g.value = W;
927
+ }
928
+ return (T, W) => (v(), B("div", Da, [
929
+ n(e(fe), {
930
+ "model-value": g.value ?? void 0,
931
+ localized: i.localized,
932
+ disabled: R.value,
933
+ maxlength: 255,
934
+ "onUpdate:modelValue": W[0] || (W[0] = (h) => g.value = h)
935
+ }, null, 8, ["model-value", "localized", "disabled"]),
936
+ u.value && !R.value ? (v(), B("div", Ha, [
937
+ n(e(X), {
938
+ size: "sm",
939
+ tone: "muted"
940
+ }, {
941
+ default: l(() => [
942
+ w(f(e(V)("landing.slug-suggested", { slug: u.value })), 1)
943
+ ]),
944
+ _: 1
945
+ }),
946
+ n(e(se), {
947
+ size: "sm",
948
+ variant: "text",
949
+ onClick: z
950
+ }, {
951
+ default: l(() => [
952
+ w(f(e(V)("landing.slug-use")), 1)
953
+ ]),
954
+ _: 1
955
+ })
956
+ ])) : M("", !0)
957
+ ]));
958
+ }
959
+ }), Ga = /* @__PURE__ */ ye(Ka, [["__scopeId", "data-v-b1f93497"]]), we = "default", Ja = /* @__PURE__ */ ge({
960
+ name: "WxCatalogLandingSort",
961
+ __name: "LandingSortField",
962
+ props: {
963
+ modelValue: { default: null },
964
+ modelModifiers: {}
965
+ },
966
+ emits: ["update:modelValue"],
967
+ setup(y) {
968
+ const i = Se(y, "modelValue"), g = pe(), s = $a(g), _ = Ce();
969
+ me();
970
+ const V = ce(ve), R = x(() => [
971
+ // The registry's own 'default' stands for «none of the landing's own»: the category's order.
972
+ { value: we, label: V("landing.sort-default") },
973
+ ...s.sorts.value.filter((t) => t.key !== we).map((t) => ({ value: t.key, label: t.label }))
974
+ ]);
975
+ return Ve(() => {
976
+ s.load().catch(() => {
977
+ });
978
+ }), (t, u) => (v(), O(e(_e), {
979
+ "model-value": i.value ?? we,
980
+ options: R.value,
981
+ disabled: e(_)?.locked.value ?? !1,
982
+ "onUpdate:modelValue": u[0] || (u[0] = (z) => i.value = z && z !== we ? String(z) : null)
983
+ }, null, 8, ["model-value", "options", "disabled"]));
984
+ }
985
+ }), Qa = {
986
+ key: 1,
987
+ class: "wx-catalog-landings-generate"
988
+ }, Xa = {
989
+ key: 2,
990
+ class: "wx-catalog-landings-generate"
991
+ }, Ya = { class: "wx-catalog-landings-generate__mono" }, Za = {
992
+ key: 3,
993
+ class: "wx-catalog-landings-generate"
994
+ }, el = {
995
+ key: 2,
996
+ class: "wx-catalog-landings-generate__errors"
997
+ }, al = /* @__PURE__ */ ge({
998
+ __name: "GenerateDialog",
999
+ setup(y) {
1000
+ const { open: i, resolve: g } = ra(), s = pe(), _ = We(s), V = je(s), R = $e();
1001
+ me();
1002
+ const t = ce(ve), u = ke(), z = S("form"), T = S([]), W = S(!1), h = S(null), L = S([]), E = S(1), F = S({ slug: "", name: "", h1: "", title: "", description: "" }), j = S(!1), P = S([]), N = S({}), m = S(""), $ = S(!1), A = S(null), b = S(null);
1003
+ Ve(() => {
1004
+ V.load().catch(() => {
1005
+ });
1006
+ }), de(
1007
+ () => T.value[0] ?? null,
1008
+ async (r) => {
1009
+ if (r === null) {
1010
+ P.value = [];
1011
+ return;
1012
+ }
1013
+ try {
1014
+ P.value = (await _.facets(r)).filter((a) => a.kind !== "range");
1015
+ } catch (a) {
1016
+ m.value = u(a);
1017
+ }
1018
+ }
1019
+ );
1020
+ const H = x(
1021
+ () => P.value.map((r) => ({ value: r.key, label: r.label }))
1022
+ ), ie = x(
1023
+ () => (P.value.find((r) => r.key === h.value)?.values ?? []).map((r) => ({
1024
+ value: r.value,
1025
+ label: `${r.label} (${r.count})`
1026
+ }))
1027
+ );
1028
+ de(h, () => L.value = []);
1029
+ const Z = x(() => ({
1030
+ categories: T.value,
1031
+ subtree: W.value,
1032
+ facet: h.value ?? "",
1033
+ values: L.value.length > 0 ? L.value : null,
1034
+ min_products: E.value,
1035
+ ...F.value,
1036
+ publish: j.value
1037
+ })), J = x(() => T.value.length > 0 && h.value !== null);
1038
+ function q(r) {
1039
+ return N.value[r]?.[0];
1040
+ }
1041
+ function D(r) {
1042
+ const a = r.body;
1043
+ a?.errors ? N.value = a.errors : m.value = u(r);
1044
+ }
1045
+ async function te() {
1046
+ if (!(!J.value || $.value)) {
1047
+ $.value = !0, N.value = {}, m.value = "";
1048
+ try {
1049
+ A.value = await _.preview(Z.value), z.value = "preview";
1050
+ } catch (r) {
1051
+ D(r);
1052
+ } finally {
1053
+ $.value = !1;
1054
+ }
1055
+ }
1056
+ }
1057
+ let Y;
1058
+ async function G(r, a = 1500) {
1059
+ Y = setTimeout(async () => {
1060
+ try {
1061
+ b.value = await _.run(r), (b.value.status === "queued" || b.value.status === "running") && G(r);
1062
+ } catch {
1063
+ G(r, Math.min(a * 2, 15e3));
1064
+ }
1065
+ }, a);
1066
+ }
1067
+ async function Q() {
1068
+ if (!$.value) {
1069
+ $.value = !0, m.value = "";
1070
+ try {
1071
+ b.value = await _.generate(Z.value), z.value = "run", b.value.id !== null && !ee.value && G(b.value.id);
1072
+ } catch (r) {
1073
+ D(r), z.value = "form";
1074
+ } finally {
1075
+ $.value = !1;
1076
+ }
1077
+ }
1078
+ }
1079
+ Ue(() => clearTimeout(Y));
1080
+ const ee = x(() => b.value?.status === "done" || b.value?.status === "failed");
1081
+ function ne() {
1082
+ g(b.value && b.value.done > 0 ? b.value : null);
1083
+ }
1084
+ const c = (r) => r[R.active.value] ?? Object.values(r)[0] ?? "", C = x(() => [
1085
+ { key: "address", label: t("generate.column-address"), minWidth: 180 },
1086
+ { key: "title", label: t("generate.column-h1"), minWidth: 180, hideBelow: 560 },
1087
+ { key: "count", label: t("generate.column-count"), width: 100, align: "right" },
1088
+ { key: "conflict", label: t("generate.column-conflict"), minWidth: 180 }
1089
+ ]), U = x(
1090
+ () => (A.value?.rows ?? []).map((r, a) => ({ ...r, id: a }))
1091
+ );
1092
+ return (r, a) => (v(), O(e(da), {
1093
+ open: e(i),
1094
+ "onUpdate:open": [
1095
+ a[12] || (a[12] = (o) => ea(i) ? i.value = o : null),
1096
+ a[13] || (a[13] = (o) => !o && ne())
1097
+ ],
1098
+ title: e(t)("generate.title"),
1099
+ width: z.value === "form" ? 600 : 860
1100
+ }, {
1101
+ footer: l(() => [
1102
+ n(e(va), { size: "sm" }, {
1103
+ default: l(() => [
1104
+ z.value === "form" ? (v(), B(re, { key: 0 }, [
1105
+ n(e(se), {
1106
+ variant: "outline",
1107
+ onClick: ne
1108
+ }, {
1109
+ default: l(() => [
1110
+ w(f(e(t)("panel.cancel")), 1)
1111
+ ]),
1112
+ _: 1
1113
+ }),
1114
+ n(e(se), {
1115
+ type: "primary",
1116
+ loading: $.value,
1117
+ disabled: !J.value,
1118
+ onClick: te
1119
+ }, {
1120
+ default: l(() => [
1121
+ w(f(e(t)("generate.preview")), 1)
1122
+ ]),
1123
+ _: 1
1124
+ }, 8, ["loading", "disabled"])
1125
+ ], 64)) : z.value === "preview" ? (v(), B(re, { key: 1 }, [
1126
+ n(e(se), {
1127
+ variant: "outline",
1128
+ onClick: a[11] || (a[11] = (o) => z.value = "form")
1129
+ }, {
1130
+ default: l(() => [
1131
+ w(f(e(t)("generate.back")), 1)
1132
+ ]),
1133
+ _: 1
1134
+ }),
1135
+ n(e(se), {
1136
+ type: "primary",
1137
+ loading: $.value,
1138
+ disabled: (A.value?.free ?? 0) === 0,
1139
+ onClick: Q
1140
+ }, {
1141
+ default: l(() => [
1142
+ w(f(e(t)("generate.run", { count: A.value?.free ?? 0 })), 1)
1143
+ ]),
1144
+ _: 1
1145
+ }, 8, ["loading", "disabled"])
1146
+ ], 64)) : (v(), O(e(se), {
1147
+ key: 2,
1148
+ type: "primary",
1149
+ disabled: !ee.value,
1150
+ onClick: ne
1151
+ }, {
1152
+ default: l(() => [
1153
+ w(f(e(t)("generate.close")), 1)
1154
+ ]),
1155
+ _: 1
1156
+ }, 8, ["disabled"]))
1157
+ ]),
1158
+ _: 1
1159
+ })
1160
+ ]),
1161
+ default: l(() => [
1162
+ m.value ? (v(), O(e(be), {
1163
+ key: 0,
1164
+ type: "danger"
1165
+ }, {
1166
+ default: l(() => [
1167
+ w(f(m.value), 1)
1168
+ ]),
1169
+ _: 1
1170
+ })) : M("", !0),
1171
+ z.value === "form" ? (v(), B("div", Qa, [
1172
+ n(e(K), {
1173
+ label: e(t)("generate.bases"),
1174
+ help: e(t)("generate.bases-help"),
1175
+ error: q("categories"),
1176
+ required: ""
1177
+ }, {
1178
+ default: l(() => [
1179
+ n(e(Ie), {
1180
+ "model-value": T.value,
1181
+ nodes: e(V).nodes.value ?? [],
1182
+ "node-key": "id",
1183
+ "label-key": "name",
1184
+ "children-key": "children",
1185
+ multiple: "",
1186
+ "check-strictly": "",
1187
+ filterable: "",
1188
+ clearable: "",
1189
+ "onUpdate:modelValue": a[0] || (a[0] = (o) => T.value = Array.isArray(o) ? o.map(Number) : o ? [Number(o)] : [])
1190
+ }, null, 8, ["model-value", "nodes"])
1191
+ ]),
1192
+ _: 1
1193
+ }, 8, ["label", "help", "error"]),
1194
+ n(e(K), null, {
1195
+ default: l(() => [
1196
+ n(e(he), {
1197
+ modelValue: W.value,
1198
+ "onUpdate:modelValue": a[1] || (a[1] = (o) => W.value = o)
1199
+ }, {
1200
+ default: l(() => [
1201
+ w(f(e(t)("generate.subtree")), 1)
1202
+ ]),
1203
+ _: 1
1204
+ }, 8, ["modelValue"])
1205
+ ]),
1206
+ _: 1
1207
+ }),
1208
+ n(e(K), {
1209
+ label: e(t)("generate.facet"),
1210
+ error: q("facet"),
1211
+ required: ""
1212
+ }, {
1213
+ default: l(() => [
1214
+ n(e(_e), {
1215
+ modelValue: h.value,
1216
+ "onUpdate:modelValue": a[2] || (a[2] = (o) => h.value = o),
1217
+ options: H.value,
1218
+ disabled: T.value.length === 0
1219
+ }, null, 8, ["modelValue", "options", "disabled"])
1220
+ ]),
1221
+ _: 1
1222
+ }, 8, ["label", "error"]),
1223
+ n(e(K), {
1224
+ label: e(t)("generate.values"),
1225
+ help: e(t)("generate.values-help")
1226
+ }, {
1227
+ default: l(() => [
1228
+ n(e(_e), {
1229
+ modelValue: L.value,
1230
+ "onUpdate:modelValue": a[3] || (a[3] = (o) => L.value = o),
1231
+ options: ie.value,
1232
+ multiple: "",
1233
+ filterable: "",
1234
+ clearable: "",
1235
+ disabled: h.value === null
1236
+ }, null, 8, ["modelValue", "options", "disabled"])
1237
+ ]),
1238
+ _: 1
1239
+ }, 8, ["label", "help"]),
1240
+ n(e(K), {
1241
+ label: e(t)("generate.min-products"),
1242
+ help: e(t)("generate.min-products-help")
1243
+ }, {
1244
+ default: l(() => [
1245
+ n(e(Ne), {
1246
+ modelValue: E.value,
1247
+ "onUpdate:modelValue": a[4] || (a[4] = (o) => E.value = o),
1248
+ min: 0,
1249
+ disabled: L.value.length > 0
1250
+ }, null, 8, ["modelValue", "disabled"])
1251
+ ]),
1252
+ _: 1
1253
+ }, 8, ["label", "help"]),
1254
+ n(e(X), { weight: "medium" }, {
1255
+ default: l(() => [
1256
+ w(f(e(t)("generate.templates")), 1)
1257
+ ]),
1258
+ _: 1
1259
+ }),
1260
+ n(e(X), {
1261
+ size: "sm",
1262
+ tone: "muted"
1263
+ }, {
1264
+ default: l(() => [
1265
+ w(f(e(t)("generate.templates-help")), 1)
1266
+ ]),
1267
+ _: 1
1268
+ }),
1269
+ n(e(K), {
1270
+ label: e(t)("generate.slug"),
1271
+ error: q("slug")
1272
+ }, {
1273
+ default: l(() => [
1274
+ n(e(fe), {
1275
+ modelValue: F.value.slug,
1276
+ "onUpdate:modelValue": a[5] || (a[5] = (o) => F.value.slug = o),
1277
+ placeholder: "{category}-{value}"
1278
+ }, null, 8, ["modelValue"])
1279
+ ]),
1280
+ _: 1
1281
+ }, 8, ["label", "error"]),
1282
+ n(e(K), {
1283
+ label: e(t)("generate.name")
1284
+ }, {
1285
+ default: l(() => [
1286
+ n(e(fe), {
1287
+ modelValue: F.value.name,
1288
+ "onUpdate:modelValue": a[6] || (a[6] = (o) => F.value.name = o),
1289
+ placeholder: "{category} {value}"
1290
+ }, null, 8, ["modelValue"])
1291
+ ]),
1292
+ _: 1
1293
+ }, 8, ["label"]),
1294
+ n(e(K), {
1295
+ label: e(t)("generate.h1")
1296
+ }, {
1297
+ default: l(() => [
1298
+ n(e(fe), {
1299
+ modelValue: F.value.h1,
1300
+ "onUpdate:modelValue": a[7] || (a[7] = (o) => F.value.h1 = o),
1301
+ placeholder: e(t)("generate.template-empty")
1302
+ }, null, 8, ["modelValue", "placeholder"])
1303
+ ]),
1304
+ _: 1
1305
+ }, 8, ["label"]),
1306
+ n(e(K), {
1307
+ label: e(t)("generate.seo-title")
1308
+ }, {
1309
+ default: l(() => [
1310
+ n(e(fe), {
1311
+ modelValue: F.value.title,
1312
+ "onUpdate:modelValue": a[8] || (a[8] = (o) => F.value.title = o),
1313
+ placeholder: e(t)("generate.template-empty")
1314
+ }, null, 8, ["modelValue", "placeholder"])
1315
+ ]),
1316
+ _: 1
1317
+ }, 8, ["label"]),
1318
+ n(e(K), {
1319
+ label: e(t)("generate.seo-description")
1320
+ }, {
1321
+ default: l(() => [
1322
+ n(e(fe), {
1323
+ modelValue: F.value.description,
1324
+ "onUpdate:modelValue": a[9] || (a[9] = (o) => F.value.description = o),
1325
+ placeholder: e(t)("generate.template-empty")
1326
+ }, null, 8, ["modelValue", "placeholder"])
1327
+ ]),
1328
+ _: 1
1329
+ }, 8, ["label"]),
1330
+ n(e(K), null, {
1331
+ default: l(() => [
1332
+ n(e(he), {
1333
+ modelValue: j.value,
1334
+ "onUpdate:modelValue": a[10] || (a[10] = (o) => j.value = o)
1335
+ }, {
1336
+ default: l(() => [
1337
+ w(f(e(t)("generate.publish")), 1)
1338
+ ]),
1339
+ _: 1
1340
+ }, 8, ["modelValue"])
1341
+ ]),
1342
+ _: 1
1343
+ })
1344
+ ])) : z.value === "preview" && A.value ? (v(), B("div", Xa, [
1345
+ n(e(X), null, {
1346
+ default: l(() => [
1347
+ w(f(A.value.free > 0 ? e(t)("generate.summary", { free: A.value.free, skipped: A.value.total - A.value.free }) : e(t)("generate.nothing")), 1)
1348
+ ]),
1349
+ _: 1
1350
+ }),
1351
+ n(e(Re), {
1352
+ data: U.value,
1353
+ columns: C.value,
1354
+ "row-key": "id",
1355
+ flush: "",
1356
+ layout: "fixed"
1357
+ }, {
1358
+ "cell-address": l(({ row: o }) => [
1359
+ le("span", Ya, "/" + f(c(o.slug)) + "/", 1)
1360
+ ]),
1361
+ "cell-title": l(({ row: o }) => [
1362
+ w(f(c(Object.keys(o.h1).length > 0 ? o.h1 : o.name)), 1)
1363
+ ]),
1364
+ "cell-conflict": l(({ row: o }) => [
1365
+ o.conflict ? (v(), O(e(X), {
1366
+ key: 0,
1367
+ size: "sm",
1368
+ tone: "warning"
1369
+ }, {
1370
+ default: l(() => [
1371
+ w(f(o.message), 1)
1372
+ ]),
1373
+ _: 2
1374
+ }, 1024)) : M("", !0)
1375
+ ]),
1376
+ _: 1
1377
+ }, 8, ["data", "columns"])
1378
+ ])) : z.value === "run" && b.value ? (v(), B("div", Za, [
1379
+ ee.value ? (v(), O(e(be), {
1380
+ key: 1,
1381
+ type: b.value.status === "failed" ? "danger" : "success"
1382
+ }, {
1383
+ default: l(() => [
1384
+ w(f(b.value.status === "failed" ? e(t)("generate.failed") : e(t)("generate.done", { done: b.value.done, skipped: b.value.skipped, failed: b.value.failed })), 1)
1385
+ ]),
1386
+ _: 1
1387
+ }, 8, ["type"])) : (v(), B(re, { key: 0 }, [
1388
+ n(e(X), null, {
1389
+ default: l(() => [
1390
+ w(f(e(t)("generate.running")), 1)
1391
+ ]),
1392
+ _: 1
1393
+ }),
1394
+ n(e(ca), {
1395
+ value: b.value.done + b.value.failed,
1396
+ max: Math.max(1, b.value.total - b.value.skipped)
1397
+ }, null, 8, ["value", "max"])
1398
+ ], 64)),
1399
+ b.value.errors.length > 0 ? (v(), B("ul", el, [
1400
+ (v(!0), B(re, null, Ae(b.value.errors, (o, ae) => (v(), B("li", { key: ae }, [
1401
+ le("strong", null, "/" + f(o.slug) + "/", 1),
1402
+ w(" — " + f(o.message), 1)
1403
+ ]))), 128))
1404
+ ])) : M("", !0)
1405
+ ])) : M("", !0)
1406
+ ]),
1407
+ _: 1
1408
+ }, 8, ["open", "title", "width"]));
1409
+ }
1410
+ }), ll = /* @__PURE__ */ ye(al, [["__scopeId", "data-v-9deeece3"]]), tl = { class: "wx-catalog-landings" }, nl = { class: "wx-catalog-landings__name" }, sl = { class: "wx-catalog-landings__title" }, ol = { class: "wx-catalog-landings__slug" }, ul = { class: "wx-catalog-landings__chips" }, il = {
1411
+ key: 2,
1412
+ class: "wx-catalog-landings__count"
1413
+ }, rl = { class: "wx-catalog-landings__state" }, dl = { class: "wx-catalog-landings__sr" }, Le = "root", cl = /* @__PURE__ */ ge({
1414
+ name: "WxCatalogLandingsPage",
1415
+ __name: "LandingsPage",
1416
+ props: {
1417
+ base: { default: "/catalog" }
1418
+ },
1419
+ setup(y) {
1420
+ const i = y, g = pe(), s = We(g), _ = je(g), V = Me(), R = qe(), t = $e();
1421
+ me();
1422
+ const u = ce(ve), z = ce("webx-admin"), T = ke(), W = ga(ll), h = x(() => `${i.base}/landings`), L = x(() => g.can("catalog.manage")), E = S(null), F = S(!0), j = (p) => V.query[p] === "1", P = S(String(V.query.q ?? "")), N = S(Number(V.query.page ?? 1) || 1), m = S(V.query.category ? String(V.query.category) : null), $ = S(j("attention")), A = S(j("published")), b = S(j("empty")), H = S(j("trashed"));
1423
+ let ie = 25;
1424
+ const Z = x(
1425
+ () => g.state.manifest?.modules.find((p) => p.id === "catalog-landings")?.title ?? u("module.title")
1426
+ ), J = x(() => [
1427
+ {
1428
+ id: Le,
1429
+ name: u("landing.whole-catalog"),
1430
+ parent_id: null,
1431
+ children: []
1432
+ },
1433
+ ..._.nodes.value ?? []
1434
+ ]), q = x(() => {
1435
+ if (m.value === null) return "";
1436
+ if (m.value === Le) return u("landing.whole-catalog");
1437
+ const p = (k) => k.reduce(
1438
+ (d, oe) => d || (String(oe.id) === m.value ? oe.name : p(oe.children ?? [])),
1439
+ ""
1440
+ );
1441
+ return p(_.nodes.value ?? []) || `#${m.value}`;
1442
+ }), D = x(() => {
1443
+ const p = [];
1444
+ m.value !== null && p.push({
1445
+ key: "base",
1446
+ label: `${u("panel.filter-base")}: ${q.value}`,
1447
+ clear: () => m.value = null
1448
+ });
1449
+ for (const [k, d, oe] of [
1450
+ ["attention", $, "panel.filter-attention"],
1451
+ ["published", A, "panel.filter-published"],
1452
+ ["empty", b, "panel.filter-empty"],
1453
+ ["trashed", H, "panel.filter-trashed"]
1454
+ ])
1455
+ d.value && p.push({ key: k, label: u(oe), clear: () => d.value = !1 });
1456
+ return p;
1457
+ });
1458
+ function te() {
1459
+ m.value = null, $.value = !1, A.value = !1, b.value = !1, H.value = !1;
1460
+ }
1461
+ function Y(p) {
1462
+ return {
1463
+ q: p?.search ?? P.value,
1464
+ category: m.value ?? void 0,
1465
+ attention: $.value || void 0,
1466
+ published: A.value || void 0,
1467
+ empty: b.value || void 0,
1468
+ trashed: H.value || void 0,
1469
+ page: p?.page ?? N.value,
1470
+ per_page: p?.perPage ?? ie
1471
+ };
1472
+ }
1473
+ let G = 0;
1474
+ async function Q(p) {
1475
+ const k = ++G;
1476
+ F.value = !0;
1477
+ try {
1478
+ const d = await s.list(Y(p));
1479
+ k === G && (E.value = d);
1480
+ } catch (d) {
1481
+ I.danger(T(d));
1482
+ } finally {
1483
+ k === G && (F.value = !1);
1484
+ }
1485
+ }
1486
+ function ee() {
1487
+ const p = {}, k = Y();
1488
+ k.q && (p.q = k.q), k.category && (p.category = k.category), k.page && k.page > 1 && (p.page = String(k.page));
1489
+ for (const d of ["attention", "published", "empty", "trashed"])
1490
+ k[d] && (p[d] = "1");
1491
+ R.replace({ query: p });
1492
+ }
1493
+ function ne(p) {
1494
+ ie = p.perPage, Q(p);
1495
+ }
1496
+ de([m, $, A, b, H], () => {
1497
+ N.value = 1, ee(), Q();
1498
+ }), de([P, N], ee);
1499
+ const c = x(() => [
1500
+ { key: "name", label: u("panel.column-name"), minWidth: 220 },
1501
+ { key: "category", label: u("panel.column-base"), width: 180, hideBelow: 760 },
1502
+ { key: "chips", label: u("panel.column-set"), minWidth: 180, hideBelow: 640 },
1503
+ { key: "products_count", label: u("panel.column-count"), width: 110, align: "right" },
1504
+ { key: "state", label: u("panel.column-state"), width: 170, hideBelow: 900 },
1505
+ { key: "updated_at", label: u("panel.column-updated"), width: 130, hideBelow: 1180 },
1506
+ { key: "actions", label: "", width: _a, align: "right" }
1507
+ ]), C = (p) => ze(p.name, t.active.value, "") || `#${p.id}`, U = (p) => ze(p.slug, t.active.value, "");
1508
+ function r(p) {
1509
+ R.push(`${h.value}/${p.id}`);
1510
+ }
1511
+ async function a(p, k) {
1512
+ try {
1513
+ await s.publish(p.id, k), I.success(u(k ? "panel.published-toast" : "panel.unpublished-toast")), await Q();
1514
+ } catch (d) {
1515
+ I.danger(T(d));
1516
+ }
1517
+ }
1518
+ async function o(p) {
1519
+ if (await Te({
1520
+ title: u("panel.delete-title", { name: C(p) }),
1521
+ message: u("panel.delete-text"),
1522
+ confirmText: u("panel.delete"),
1523
+ cancelText: u("panel.cancel"),
1524
+ tone: "danger"
1525
+ }))
1526
+ try {
1527
+ await s.remove(p.id), I.success(u("panel.deleted")), await Q();
1528
+ } catch (d) {
1529
+ I.danger(T(d));
1530
+ }
1531
+ }
1532
+ async function ae(p) {
1533
+ try {
1534
+ await s.restore(p.id), I.success(u("panel.restored")), await Q();
1535
+ } catch (k) {
1536
+ I.danger(T(k));
1537
+ }
1538
+ }
1539
+ function He(p) {
1540
+ if (p.deleted_at !== null)
1541
+ return L.value ? [
1542
+ {
1543
+ key: "restore",
1544
+ icon: "refresh",
1545
+ label: u("panel.restore"),
1546
+ run: () => {
1547
+ ae(p);
1548
+ }
1549
+ }
1550
+ ] : [];
1551
+ const k = [
1552
+ { key: "open", icon: "edit", label: u("panel.open"), run: () => r(p) }
1553
+ ];
1554
+ return p.url && k.push({ key: "site", icon: "link", label: u("panel.open-site"), href: p.url }), L.value && k.push(
1555
+ p.is_published ? {
1556
+ key: "unpublish",
1557
+ icon: "eye-off",
1558
+ label: u("panel.unpublish"),
1559
+ run: () => {
1560
+ a(p, !1);
1561
+ }
1562
+ } : {
1563
+ key: "publish",
1564
+ icon: "eye",
1565
+ label: u("panel.publish"),
1566
+ run: () => {
1567
+ a(p, !0);
1568
+ }
1569
+ },
1570
+ {
1571
+ key: "delete",
1572
+ icon: "trash",
1573
+ label: u("panel.delete"),
1574
+ danger: !0,
1575
+ run: () => {
1576
+ o(p);
1577
+ }
1578
+ }
1579
+ ), k;
1580
+ }
1581
+ async function Ke() {
1582
+ await W({ base: i.base }) && await Q();
1583
+ }
1584
+ const Ge = x(
1585
+ () => L.value ? [
1586
+ {
1587
+ key: "new",
1588
+ label: u("panel.new"),
1589
+ icon: "plus",
1590
+ primary: !0,
1591
+ run: () => {
1592
+ R.push({
1593
+ path: `${h.value}/new`,
1594
+ query: m.value && m.value !== Le ? { category: m.value } : {}
1595
+ });
1596
+ }
1597
+ },
1598
+ { key: "generate", label: u("panel.generate"), icon: "grid", run: () => {
1599
+ Ke();
1600
+ } }
1601
+ ] : []
1602
+ ), Je = x(
1603
+ () => D.value.length > 0 || P.value ? u("panel.nothing-found") : u("panel.empty")
1604
+ );
1605
+ return Ve(() => {
1606
+ _.load().catch(() => {
1607
+ });
1608
+ }), (p, k) => (v(), B("div", tl, [
1609
+ n(e(ka), {
1610
+ title: Z.value,
1611
+ actions: Ge.value
1612
+ }, {
1613
+ default: l(() => [
1614
+ n(e(Re), {
1615
+ search: P.value,
1616
+ "onUpdate:search": k[5] || (k[5] = (d) => P.value = d),
1617
+ page: N.value,
1618
+ "onUpdate:page": k[6] || (k[6] = (d) => N.value = d),
1619
+ data: E.value,
1620
+ columns: c.value,
1621
+ "row-key": "id",
1622
+ searchable: "",
1623
+ clickable: "",
1624
+ hover: "",
1625
+ flush: "",
1626
+ loading: F.value,
1627
+ layout: "fixed",
1628
+ "filters-count": D.value.length,
1629
+ "filters-label": e(z)("filters.title"),
1630
+ "search-placeholder": e(u)("panel.search"),
1631
+ "empty-text": Je.value,
1632
+ "aria-label": Z.value,
1633
+ onRowClick: r,
1634
+ onStateChange: ne
1635
+ }, {
1636
+ filters: l(() => [
1637
+ n(e(K), {
1638
+ label: e(u)("panel.filter-base")
1639
+ }, {
1640
+ default: l(() => [
1641
+ n(e(Ie), {
1642
+ "model-value": m.value,
1643
+ nodes: J.value,
1644
+ "node-key": "id",
1645
+ "label-key": "name",
1646
+ "children-key": "children",
1647
+ "check-strictly": "",
1648
+ filterable: "",
1649
+ clearable: "",
1650
+ size: "sm",
1651
+ "onUpdate:modelValue": k[0] || (k[0] = (d) => m.value = d == null || Array.isArray(d) ? null : String(d))
1652
+ }, null, 8, ["model-value", "nodes"])
1653
+ ]),
1654
+ _: 1
1655
+ }, 8, ["label"]),
1656
+ n(e(K), {
1657
+ label: e(u)("panel.filter-attention")
1658
+ }, {
1659
+ default: l(() => [
1660
+ n(e(he), {
1661
+ modelValue: $.value,
1662
+ "onUpdate:modelValue": k[1] || (k[1] = (d) => $.value = d),
1663
+ size: "sm"
1664
+ }, null, 8, ["modelValue"])
1665
+ ]),
1666
+ _: 1
1667
+ }, 8, ["label"]),
1668
+ n(e(K), {
1669
+ label: e(u)("panel.filter-published")
1670
+ }, {
1671
+ default: l(() => [
1672
+ n(e(he), {
1673
+ modelValue: A.value,
1674
+ "onUpdate:modelValue": k[2] || (k[2] = (d) => A.value = d),
1675
+ size: "sm"
1676
+ }, null, 8, ["modelValue"])
1677
+ ]),
1678
+ _: 1
1679
+ }, 8, ["label"]),
1680
+ n(e(K), {
1681
+ label: e(u)("panel.filter-empty")
1682
+ }, {
1683
+ default: l(() => [
1684
+ n(e(he), {
1685
+ modelValue: b.value,
1686
+ "onUpdate:modelValue": k[3] || (k[3] = (d) => b.value = d),
1687
+ size: "sm"
1688
+ }, null, 8, ["modelValue"])
1689
+ ]),
1690
+ _: 1
1691
+ }, 8, ["label"]),
1692
+ n(e(K), {
1693
+ label: e(u)("panel.filter-trashed")
1694
+ }, {
1695
+ default: l(() => [
1696
+ n(e(he), {
1697
+ modelValue: H.value,
1698
+ "onUpdate:modelValue": k[4] || (k[4] = (d) => H.value = d),
1699
+ size: "sm"
1700
+ }, null, 8, ["modelValue"])
1701
+ ]),
1702
+ _: 1
1703
+ }, 8, ["label"]),
1704
+ D.value.length > 0 ? (v(), O(e(se), {
1705
+ key: 0,
1706
+ variant: "text",
1707
+ size: "sm",
1708
+ block: "",
1709
+ onClick: te
1710
+ }, {
1711
+ icon: l(() => [
1712
+ n(e(xe), { name: "close" })
1713
+ ]),
1714
+ default: l(() => [
1715
+ w(" " + f(e(z)("filters.reset")), 1)
1716
+ ]),
1717
+ _: 1
1718
+ })) : M("", !0)
1719
+ ]),
1720
+ applied: l(() => [
1721
+ n(e(Va), { filters: D.value }, null, 8, ["filters"])
1722
+ ]),
1723
+ "cell-name": l(({ row: d }) => [
1724
+ le("div", nl, [
1725
+ le("span", sl, f(C(d)), 1),
1726
+ le("span", ol, "/" + f(U(d)) + "/", 1)
1727
+ ])
1728
+ ]),
1729
+ "cell-category": l(({ row: d }) => [
1730
+ n(e(X), {
1731
+ size: "sm",
1732
+ truncate: "",
1733
+ tone: d.category === null ? "muted" : void 0
1734
+ }, {
1735
+ default: l(() => [
1736
+ w(f(d.category ?? e(u)("landing.whole-catalog")), 1)
1737
+ ]),
1738
+ _: 2
1739
+ }, 1032, ["tone"])
1740
+ ]),
1741
+ "cell-chips": l(({ row: d }) => [
1742
+ le("div", ul, [
1743
+ (v(!0), B(re, null, Ae(d.chips, (oe) => (v(), O(e(ue), {
1744
+ key: oe.key,
1745
+ size: "sm",
1746
+ variant: "soft"
1747
+ }, {
1748
+ default: l(() => [
1749
+ w(f(oe.label) + ": " + f(oe.text), 1)
1750
+ ]),
1751
+ _: 2
1752
+ }, 1024))), 128))
1753
+ ])
1754
+ ]),
1755
+ "cell-products_count": l(({ row: d }) => [
1756
+ d.products_count === null ? (v(), O(e(X), {
1757
+ key: 0,
1758
+ size: "sm",
1759
+ tone: "muted"
1760
+ }, {
1761
+ default: l(() => [
1762
+ w(f(e(u)("panel.not-counted")), 1)
1763
+ ]),
1764
+ _: 1
1765
+ })) : d.products_count === 0 ? (v(), O(e(ue), {
1766
+ key: 1,
1767
+ type: "warning",
1768
+ size: "sm",
1769
+ round: ""
1770
+ }, {
1771
+ default: l(() => [...k[7] || (k[7] = [
1772
+ w("0", -1)
1773
+ ])]),
1774
+ _: 1
1775
+ })) : (v(), B("span", il, f(d.products_count), 1))
1776
+ ]),
1777
+ "cell-state": l(({ row: d }) => [
1778
+ le("div", rl, [
1779
+ d.deleted_at ? (v(), O(e(ue), {
1780
+ key: 0,
1781
+ dot: "",
1782
+ size: "sm"
1783
+ }, {
1784
+ default: l(() => [
1785
+ w(f(e(u)("panel.in-bin")), 1)
1786
+ ]),
1787
+ _: 1
1788
+ })) : (v(), O(e(ue), {
1789
+ key: 1,
1790
+ type: d.is_published ? "success" : "default",
1791
+ dot: "",
1792
+ size: "sm"
1793
+ }, {
1794
+ default: l(() => [
1795
+ w(f(e(u)(d.is_published ? "panel.published" : "panel.unpublished")), 1)
1796
+ ]),
1797
+ _: 2
1798
+ }, 1032, ["type"])),
1799
+ d.attention ? (v(), O(e(pa), {
1800
+ key: 2,
1801
+ content: e(u)(`landing.attention-${d.attention}`)
1802
+ }, {
1803
+ default: l(() => [
1804
+ n(e(ue), {
1805
+ type: "warning",
1806
+ size: "sm",
1807
+ round: ""
1808
+ }, {
1809
+ default: l(() => [
1810
+ n(e(xe), {
1811
+ name: "warning",
1812
+ size: "sm"
1813
+ }),
1814
+ le("span", dl, f(e(u)("landing.attention")), 1)
1815
+ ]),
1816
+ _: 1
1817
+ })
1818
+ ]),
1819
+ _: 1
1820
+ }, 8, ["content"])) : M("", !0)
1821
+ ])
1822
+ ]),
1823
+ "cell-updated_at": l(({ row: d }) => [
1824
+ n(e(xa), {
1825
+ value: d.updated_at,
1826
+ compact: ""
1827
+ }, null, 8, ["value"])
1828
+ ]),
1829
+ "cell-actions": l(({ row: d }) => [
1830
+ n(e(wa), {
1831
+ actions: He(d),
1832
+ label: C(d)
1833
+ }, null, 8, ["actions", "label"])
1834
+ ]),
1835
+ _: 1
1836
+ }, 8, ["search", "page", "data", "columns", "loading", "filters-count", "filters-label", "search-placeholder", "empty-text", "aria-label"])
1837
+ ]),
1838
+ _: 1
1839
+ }, 8, ["title", "actions"])
1840
+ ]));
1841
+ }
1842
+ }), vl = /* @__PURE__ */ ye(cl, [["__scopeId", "data-v-3465bf8b"]]);
1843
+ function bl(y = {}) {
1844
+ const i = y.path ?? "/catalog", g = { base: i };
1845
+ return [
1846
+ {
1847
+ id: "catalog-landings",
1848
+ path: `${i}/landings`,
1849
+ routes: [
1850
+ {
1851
+ path: `${i}/landings`,
1852
+ name: "webx.catalog-landings",
1853
+ component: vl,
1854
+ props: g
1855
+ },
1856
+ {
1857
+ path: `${i}/landings/new`,
1858
+ name: "webx.catalog-landings.new",
1859
+ component: Fe,
1860
+ props: g
1861
+ },
1862
+ {
1863
+ path: `${i}/landings/:id(\\d+)`,
1864
+ name: "webx.catalog-landings.edit",
1865
+ component: Fe,
1866
+ props: g
1867
+ }
1868
+ ],
1869
+ types: {
1870
+ // Wide: a facet's row is a label, a list of values and a button, and half a form is too
1871
+ // narrow for a combobox of brands beside its label.
1872
+ "wx-catalog-landing-set": { component: ja, kind: "field", wide: !0 },
1873
+ "wx-catalog-landing-slug": { component: Ga, kind: "field" },
1874
+ "wx-catalog-landing-sort": { component: Ja, kind: "field" },
1875
+ "wx-catalog-landing-products": {
1876
+ component: Ba,
1877
+ kind: "field",
1878
+ wide: !0
1879
+ }
1880
+ }
1881
+ }
1882
+ ];
1883
+ }
1884
+ export {
1885
+ La as FORM_FIELDS,
1886
+ Wa as LANDINGS_API,
1887
+ Fe as WxCatalogLandingEditor,
1888
+ Ba as WxCatalogLandingProducts,
1889
+ ja as WxCatalogLandingSet,
1890
+ Ga as WxCatalogLandingSlug,
1891
+ Ja as WxCatalogLandingSort,
1892
+ vl as WxCatalogLandingsPage,
1893
+ bl as catalogLandings,
1894
+ Na as catalogLandingsMessages,
1895
+ Oe as cleanSet,
1896
+ We as createLandingsApi,
1897
+ za as formValues,
1898
+ De as landingEditorKey,
1899
+ Ca as landingSearch,
1900
+ Ta as provideLandingEditor,
1901
+ Ce as useLandingEditor
1902
+ };
1903
+ //# sourceMappingURL=index.js.map