@feedmepos/mf-miniprogram-v2 0.2.2-dev.12 → 0.2.2-dev.13
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/TemplateCenterView-BjA03jMI.js +297 -0
- package/dist/app.js +1 -1
- package/dist/package.json +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/TemplateCenterView-QFMGVcnE.js +0 -354
package/package.json
CHANGED
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
import { defineComponent as le, ref as r, computed as S, watch as B, onMounted as oe, resolveComponent as y, openBlock as s, createBlock as k, withCtx as O, createVNode as c, createElementVNode as i, toDisplayString as m, createCommentVNode as V, unref as be, createElementBlock as p, Fragment as R, renderList as ne, createTextVNode as g, onScopeDispose as _e } from "vue";
|
|
2
|
-
import { a as A } from "./routes-DXQSkGM7.js";
|
|
3
|
-
import { useDialog as he } from "@feedmepos/ui-library";
|
|
4
|
-
import { c as z, e as j } from "./controlPlane-CoEgf9BA.js";
|
|
5
|
-
import { _ as fe } from "./StatusBadge.vue_vue_type_script_setup_true_lang-Bh9Eoe_H.js";
|
|
6
|
-
import { _ as se } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
7
|
-
const ye = ["qsr", "coffee", "tea"], L = [
|
|
8
|
-
// `label` and `description` are MERCHANT-FACING: the portal's picker renders
|
|
9
|
-
// them, and they are the only thing a merchant chooses on. Say what the app does
|
|
10
|
-
// for their customers, never which package it is built from — the SDK is real and
|
|
11
|
-
// load-bearing and means nothing to the person making this decision.
|
|
12
|
-
{
|
|
13
|
-
id: "miniprogram-vue",
|
|
14
|
-
label: "Phone ordering app",
|
|
15
|
-
description: "Menu browsing, cart and checkout, membership and rewards, and order history — for customers ordering on their own phone.",
|
|
16
|
-
industries: [],
|
|
17
|
-
environments: ["dev", "prod"],
|
|
18
|
-
default: !0
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: "miniprogram-vue-v2",
|
|
22
|
-
label: "Phone, kiosk and tablet",
|
|
23
|
-
description: "Everything in the phone app, plus self-order kiosk and in-store tablet surfaces sharing the same menu, cart and membership.",
|
|
24
|
-
industries: [],
|
|
25
|
-
// Dev only, deliberately. It has never been provisioned end-to-end: the
|
|
26
|
-
// preview proxy, the component-library unpack and the release build have
|
|
27
|
-
// only been exercised locally. Add 'prod' after a real merchant has run
|
|
28
|
-
// through all three.
|
|
29
|
-
environments: ["dev"]
|
|
30
|
-
}
|
|
31
|
-
], ge = { class: "template-choice-dialog__environments" }, Ce = {
|
|
32
|
-
key: 2,
|
|
33
|
-
class: "template-choice-dialog__prod-warning"
|
|
34
|
-
}, ke = {
|
|
35
|
-
key: 4,
|
|
36
|
-
class: "portal-error",
|
|
37
|
-
role: "alert"
|
|
38
|
-
}, E = "__none__", Ve = /* @__PURE__ */ le({
|
|
39
|
-
__name: "TemplateChoiceDialog",
|
|
40
|
-
props: {
|
|
41
|
-
choice: {}
|
|
42
|
-
},
|
|
43
|
-
emits: ["saved", "close"],
|
|
44
|
-
setup(N, { emit: T }) {
|
|
45
|
-
var q, G, Y, H, J, K, W, Q, X;
|
|
46
|
-
const d = N, w = T, v = r(((q = d.choice) == null ? void 0 : q.id) ?? ""), b = r(((G = d.choice) == null ? void 0 : G.appTemplateId) ?? ((Y = L[0]) == null ? void 0 : Y.id) ?? ""), _ = r(((H = d.choice) == null ? void 0 : H.restaurantStyle) ?? E), h = r(((J = d.choice) == null ? void 0 : J.label) ?? ""), C = r(((K = d.choice) == null ? void 0 : K.description) ?? ""), F = r((((W = d.choice) == null ? void 0 : W.industries) ?? []).join(", ")), f = r([...((Q = d.choice) == null ? void 0 : Q.environments) ?? ["dev"]]), o = r(((X = d.choice) == null ? void 0 : X.default) ?? !1), l = r(!1), u = r(""), a = S(() => !!d.choice), x = L.map((n) => ({ label: n.label, value: n.id })), P = S(() => b.value === "miniprogram-vue-v2"), ie = [
|
|
47
|
-
{ label: "None (v1-style layout)", value: E },
|
|
48
|
-
...ye.map((n) => ({ label: n, value: n }))
|
|
49
|
-
];
|
|
50
|
-
B(b, () => {
|
|
51
|
-
P.value || (_.value = E);
|
|
52
|
-
});
|
|
53
|
-
const D = S(() => L.find((n) => n.id === b.value)), re = S(
|
|
54
|
-
() => ["dev", "prod"].map((n) => {
|
|
55
|
-
var e;
|
|
56
|
-
return {
|
|
57
|
-
label: n,
|
|
58
|
-
value: n,
|
|
59
|
-
disabled: !((e = D.value) != null && e.environments.includes(n))
|
|
60
|
-
};
|
|
61
|
-
})
|
|
62
|
-
);
|
|
63
|
-
B(D, () => {
|
|
64
|
-
f.value = f.value.filter((n) => {
|
|
65
|
-
var e;
|
|
66
|
-
return (e = D.value) == null ? void 0 : e.environments.includes(n);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
const $ = r(!1), I = S(() => f.value.includes("prod"));
|
|
70
|
-
B(I, (n) => {
|
|
71
|
-
n || ($.value = !1);
|
|
72
|
-
});
|
|
73
|
-
const M = S(
|
|
74
|
-
() => !l.value && h.value.trim().length > 0 && C.value.trim().length > 0 && f.value.length > 0 && (a.value ? !0 : /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(v.value.trim())) && (!I.value || $.value)
|
|
75
|
-
);
|
|
76
|
-
async function de() {
|
|
77
|
-
if (!M.value) return;
|
|
78
|
-
l.value = !0, u.value = "";
|
|
79
|
-
const n = {
|
|
80
|
-
...a.value ? {} : { id: v.value.trim() },
|
|
81
|
-
appTemplateId: b.value,
|
|
82
|
-
label: h.value.trim(),
|
|
83
|
-
description: C.value.trim(),
|
|
84
|
-
industries: F.value.split(",").map((e) => e.trim()).filter(Boolean),
|
|
85
|
-
environments: f.value,
|
|
86
|
-
default: o.value,
|
|
87
|
-
...P.value && _.value !== E ? { restaurantStyle: _.value } : {}
|
|
88
|
-
};
|
|
89
|
-
try {
|
|
90
|
-
await z(
|
|
91
|
-
a.value ? A.appTemplateChoice(d.choice.id) : A.appTemplateChoices(),
|
|
92
|
-
{ method: a.value ? "PATCH" : "POST", body: JSON.stringify(n) }
|
|
93
|
-
), w("saved");
|
|
94
|
-
} catch (e) {
|
|
95
|
-
u.value = j(e);
|
|
96
|
-
} finally {
|
|
97
|
-
l.value = !1;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return oe(() => {
|
|
101
|
-
!a.value && !h.value && (h.value = "");
|
|
102
|
-
}), (n, e) => {
|
|
103
|
-
const U = y("FmTextField"), Z = y("FmSelect"), ue = y("FmTextarea"), ee = y("FmCheckbox"), ce = y("FmSwitch"), ae = y("FmButton"), me = y("FmCard"), pe = y("FmForm");
|
|
104
|
-
return s(), k(pe, { onValidationSuccess: de }, {
|
|
105
|
-
default: O(() => [
|
|
106
|
-
c(me, { class: "template-choice-dialog" }, {
|
|
107
|
-
default: O(() => {
|
|
108
|
-
var te;
|
|
109
|
-
return [
|
|
110
|
-
i("h2", null, m(a.value ? `Edit ${(te = N.choice) == null ? void 0 : te.label}` : "New template choice"), 1),
|
|
111
|
-
a.value ? V("", !0) : (s(), k(U, {
|
|
112
|
-
key: 0,
|
|
113
|
-
modelValue: v.value,
|
|
114
|
-
"onUpdate:modelValue": e[0] || (e[0] = (t) => v.value = t),
|
|
115
|
-
label: "Choice id",
|
|
116
|
-
placeholder: "e.g. miniprogram-vue-v2-bakery",
|
|
117
|
-
"helper-text": "Lowercase, kebab-case. Cannot be changed after creation.",
|
|
118
|
-
disabled: l.value,
|
|
119
|
-
rules: [(t) => /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(t.trim()) || "Lowercase kebab-case, e.g. miniprogram-vue-v2-bakery"]
|
|
120
|
-
}, null, 8, ["modelValue", "disabled", "rules"])),
|
|
121
|
-
c(Z, {
|
|
122
|
-
modelValue: b.value,
|
|
123
|
-
"onUpdate:modelValue": e[1] || (e[1] = (t) => b.value = t),
|
|
124
|
-
label: "Physical template",
|
|
125
|
-
items: be(x),
|
|
126
|
-
disabled: l.value || a.value
|
|
127
|
-
}, null, 8, ["modelValue", "items", "disabled"]),
|
|
128
|
-
P.value ? (s(), k(Z, {
|
|
129
|
-
key: 1,
|
|
130
|
-
modelValue: _.value,
|
|
131
|
-
"onUpdate:modelValue": e[2] || (e[2] = (t) => _.value = t),
|
|
132
|
-
label: "Restaurant style",
|
|
133
|
-
"helper-text": "Only styles templates/miniprogram-vue-v2/src/brand/recipes.ts already implements.",
|
|
134
|
-
items: ie,
|
|
135
|
-
disabled: l.value
|
|
136
|
-
}, null, 8, ["modelValue", "disabled"])) : V("", !0),
|
|
137
|
-
c(U, {
|
|
138
|
-
modelValue: h.value,
|
|
139
|
-
"onUpdate:modelValue": e[3] || (e[3] = (t) => h.value = t),
|
|
140
|
-
label: "Label",
|
|
141
|
-
placeholder: "Shown to merchants in the picker",
|
|
142
|
-
disabled: l.value
|
|
143
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
144
|
-
c(ue, {
|
|
145
|
-
modelValue: C.value,
|
|
146
|
-
"onUpdate:modelValue": e[4] || (e[4] = (t) => C.value = t),
|
|
147
|
-
label: "Description",
|
|
148
|
-
placeholder: "One or two sentences on what the merchant gets",
|
|
149
|
-
disabled: l.value
|
|
150
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
151
|
-
c(U, {
|
|
152
|
-
modelValue: F.value,
|
|
153
|
-
"onUpdate:modelValue": e[5] || (e[5] = (t) => F.value = t),
|
|
154
|
-
label: "Industries (comma-separated)",
|
|
155
|
-
placeholder: "e.g. Food & beverage",
|
|
156
|
-
disabled: l.value
|
|
157
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
158
|
-
i("div", ge, [
|
|
159
|
-
e[10] || (e[10] = i("p", { class: "template-choice-dialog__label" }, "Environments", -1)),
|
|
160
|
-
(s(!0), p(R, null, ne(re.value, (t) => (s(), k(ee, {
|
|
161
|
-
key: t.value,
|
|
162
|
-
modelValue: f.value,
|
|
163
|
-
"onUpdate:modelValue": e[6] || (e[6] = (ve) => f.value = ve),
|
|
164
|
-
value: t.value,
|
|
165
|
-
label: t.value,
|
|
166
|
-
disabled: l.value || t.disabled
|
|
167
|
-
}, null, 8, ["modelValue", "value", "label", "disabled"]))), 128))
|
|
168
|
-
]),
|
|
169
|
-
I.value ? (s(), p("p", Ce, [...e[11] || (e[11] = [
|
|
170
|
-
g(" This choice will be offered to merchants creating a project in ", -1),
|
|
171
|
-
i("strong", null, "prod", -1),
|
|
172
|
-
g(" as soon as it saves — there is no deploy step in between. ", -1)
|
|
173
|
-
])])) : V("", !0),
|
|
174
|
-
I.value ? (s(), k(ee, {
|
|
175
|
-
key: 3,
|
|
176
|
-
modelValue: $.value,
|
|
177
|
-
"onUpdate:modelValue": e[7] || (e[7] = (t) => $.value = t),
|
|
178
|
-
value: !0,
|
|
179
|
-
label: "I understand this affects prod immediately",
|
|
180
|
-
disabled: l.value
|
|
181
|
-
}, null, 8, ["modelValue", "disabled"])) : V("", !0),
|
|
182
|
-
c(ce, {
|
|
183
|
-
modelValue: o.value,
|
|
184
|
-
"onUpdate:modelValue": e[8] || (e[8] = (t) => o.value = t),
|
|
185
|
-
label: "Default choice",
|
|
186
|
-
sublabel: "Used when a provision request names none",
|
|
187
|
-
disabled: l.value
|
|
188
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
189
|
-
u.value ? (s(), p("p", ke, m(u.value), 1)) : V("", !0),
|
|
190
|
-
i("footer", null, [
|
|
191
|
-
c(ae, {
|
|
192
|
-
label: "Cancel",
|
|
193
|
-
variant: "tertiary",
|
|
194
|
-
disabled: l.value,
|
|
195
|
-
onClick: e[9] || (e[9] = (t) => w("close"))
|
|
196
|
-
}, null, 8, ["disabled"]),
|
|
197
|
-
c(ae, {
|
|
198
|
-
label: a.value ? "Save" : "Create",
|
|
199
|
-
type: "submit",
|
|
200
|
-
loading: l.value,
|
|
201
|
-
disabled: !M.value
|
|
202
|
-
}, null, 8, ["label", "loading", "disabled"])
|
|
203
|
-
])
|
|
204
|
-
];
|
|
205
|
-
}),
|
|
206
|
-
_: 1
|
|
207
|
-
})
|
|
208
|
-
]),
|
|
209
|
-
_: 1
|
|
210
|
-
});
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
}), Te = /* @__PURE__ */ se(Ve, [["__scopeId", "data-v-f14457dc"]]), we = { class: "portal-page" }, Se = { class: "portal-page-inner" }, Fe = { class: "portal-page-heading" }, Ae = {
|
|
214
|
-
key: 0,
|
|
215
|
-
class: "portal-error",
|
|
216
|
-
role: "alert"
|
|
217
|
-
}, xe = {
|
|
218
|
-
key: 1,
|
|
219
|
-
role: "status"
|
|
220
|
-
}, $e = {
|
|
221
|
-
key: 2,
|
|
222
|
-
class: "template-choices__list",
|
|
223
|
-
"aria-label": "Template choices"
|
|
224
|
-
}, Ie = { class: "template-choices__name" }, Ee = { class: "template-choices__label" }, Ne = { key: 0 }, Pe = { class: "template-choices__id" }, De = { class: "template-choices__meta" }, Ue = ["datetime"], Be = { class: "template-choices__actions" }, Le = /* @__PURE__ */ le({
|
|
225
|
-
__name: "TemplateCenterView",
|
|
226
|
-
setup(N) {
|
|
227
|
-
const T = he(), d = r([]), w = r(!0), v = r(""), b = new AbortController();
|
|
228
|
-
async function _() {
|
|
229
|
-
w.value = !0, v.value = "";
|
|
230
|
-
try {
|
|
231
|
-
const o = await z(A.appTemplateChoices(), {
|
|
232
|
-
signal: b.signal
|
|
233
|
-
});
|
|
234
|
-
d.value = o.choices;
|
|
235
|
-
} catch (o) {
|
|
236
|
-
b.signal.aborted || (v.value = j(o));
|
|
237
|
-
} finally {
|
|
238
|
-
w.value = !1;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
function h(o) {
|
|
242
|
-
T.open({
|
|
243
|
-
title: o ? `Edit ${o.label}` : "New template choice",
|
|
244
|
-
dialogComponent: Te,
|
|
245
|
-
dialogComponentProps: {
|
|
246
|
-
choice: o,
|
|
247
|
-
onClose: () => T.close(),
|
|
248
|
-
onSaved: () => {
|
|
249
|
-
T.close(), _();
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
async function C(o, l) {
|
|
255
|
-
try {
|
|
256
|
-
await z(
|
|
257
|
-
l === "archived" ? A.appTemplateChoiceArchive(o.id) : A.appTemplateChoiceRestore(o.id),
|
|
258
|
-
{ method: "POST" }
|
|
259
|
-
), await _();
|
|
260
|
-
} catch (u) {
|
|
261
|
-
v.value = j(u);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
function F(o) {
|
|
265
|
-
T.open({
|
|
266
|
-
title: `Archive ${o.label}?`,
|
|
267
|
-
message: "It stops appearing for new projects. Merchants already provisioned from it are unaffected — it is never consulted again after provisioning.",
|
|
268
|
-
primaryActions: { text: "Archive", close: !0, variant: "primary" },
|
|
269
|
-
secondaryActions: { text: "Cancel", close: !0, variant: "tertiary" }
|
|
270
|
-
}).onPrimary(() => void C(o, "archived"));
|
|
271
|
-
}
|
|
272
|
-
function f(o) {
|
|
273
|
-
return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(new Date(o));
|
|
274
|
-
}
|
|
275
|
-
return oe(() => void _()), _e(() => b.abort()), (o, l) => {
|
|
276
|
-
const u = y("FmButton");
|
|
277
|
-
return s(), p("div", we, [
|
|
278
|
-
i("div", Se, [
|
|
279
|
-
i("header", Fe, [
|
|
280
|
-
l[1] || (l[1] = i("div", null, [
|
|
281
|
-
i("p", { class: "portal-eyebrow" }, "Internal"),
|
|
282
|
-
i("h1", null, "Template Center")
|
|
283
|
-
], -1)),
|
|
284
|
-
c(u, {
|
|
285
|
-
label: "New choice",
|
|
286
|
-
icon: "add",
|
|
287
|
-
onClick: l[0] || (l[0] = (a) => h())
|
|
288
|
-
})
|
|
289
|
-
]),
|
|
290
|
-
v.value ? (s(), p("p", Ae, [
|
|
291
|
-
g(m(v.value) + " ", 1),
|
|
292
|
-
c(u, {
|
|
293
|
-
label: "Retry",
|
|
294
|
-
variant: "tertiary",
|
|
295
|
-
onClick: _
|
|
296
|
-
})
|
|
297
|
-
])) : w.value ? (s(), p("p", xe, "Loading template choices…")) : (s(), p("section", $e, [
|
|
298
|
-
(s(!0), p(R, null, ne(d.value, (a) => (s(), p("article", {
|
|
299
|
-
key: a.id,
|
|
300
|
-
class: "template-choices__row"
|
|
301
|
-
}, [
|
|
302
|
-
i("div", Ie, [
|
|
303
|
-
i("span", Ee, [
|
|
304
|
-
g(m(a.label), 1),
|
|
305
|
-
a.default ? (s(), p("span", Ne, " · Default")) : V("", !0)
|
|
306
|
-
]),
|
|
307
|
-
i("span", Pe, m(a.id), 1),
|
|
308
|
-
i("span", De, [
|
|
309
|
-
g(m(a.appTemplateId), 1),
|
|
310
|
-
a.restaurantStyle ? (s(), p(R, { key: 0 }, [
|
|
311
|
-
g(" · " + m(a.restaurantStyle), 1)
|
|
312
|
-
], 64)) : V("", !0),
|
|
313
|
-
g(" · " + m(a.industries.join(", ") || "General-purpose") + " · " + m((a.environments ?? []).join(", ")), 1)
|
|
314
|
-
])
|
|
315
|
-
]),
|
|
316
|
-
c(fe, {
|
|
317
|
-
variant: a.status === "active" ? "success" : "neutral"
|
|
318
|
-
}, {
|
|
319
|
-
default: O(() => [
|
|
320
|
-
g(m(a.status === "active" ? "Active" : "Archived"), 1)
|
|
321
|
-
]),
|
|
322
|
-
_: 2
|
|
323
|
-
}, 1032, ["variant"]),
|
|
324
|
-
i("time", {
|
|
325
|
-
datetime: a.updatedAt
|
|
326
|
-
}, m(f(a.updatedAt)), 9, Ue),
|
|
327
|
-
i("div", Be, [
|
|
328
|
-
c(u, {
|
|
329
|
-
label: "Edit",
|
|
330
|
-
variant: "secondary",
|
|
331
|
-
onClick: (x) => h(a)
|
|
332
|
-
}, null, 8, ["onClick"]),
|
|
333
|
-
a.status === "active" ? (s(), k(u, {
|
|
334
|
-
key: 0,
|
|
335
|
-
label: "Archive",
|
|
336
|
-
variant: "tertiary",
|
|
337
|
-
onClick: (x) => F(a)
|
|
338
|
-
}, null, 8, ["onClick"])) : (s(), k(u, {
|
|
339
|
-
key: 1,
|
|
340
|
-
label: "Restore",
|
|
341
|
-
variant: "tertiary",
|
|
342
|
-
onClick: (x) => C(a, "active")
|
|
343
|
-
}, null, 8, ["onClick"]))
|
|
344
|
-
])
|
|
345
|
-
]))), 128))
|
|
346
|
-
]))
|
|
347
|
-
])
|
|
348
|
-
]);
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
}), Ge = /* @__PURE__ */ se(Le, [["__scopeId", "data-v-da7cd846"]]);
|
|
352
|
-
export {
|
|
353
|
-
Ge as default
|
|
354
|
-
};
|