@feedmepos/mf-miniprogram-v2 0.2.2-dev.13 → 0.2.2-dev.14
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,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as W, ref as r, computed as E, resolveComponent as h, openBlock as n, createBlock as S, withCtx as I, createVNode as d, createElementVNode as s, toDisplayString as c, createCommentVNode as F, unref as le, createElementBlock as v, onMounted as oe, onScopeDispose as ne, createTextVNode as k, Fragment as H, renderList as se } from "vue";
|
|
2
2
|
import { a as A } from "./routes-DXQSkGM7.js";
|
|
3
3
|
import { useDialog as ie } from "@feedmepos/ui-library";
|
|
4
|
-
import { c as P, e as
|
|
4
|
+
import { c as P, e as $ } from "./controlPlane-CoEgf9BA.js";
|
|
5
5
|
import { _ as re } from "./StatusBadge.vue_vue_type_script_setup_true_lang-Bh9Eoe_H.js";
|
|
6
|
-
import { _ as
|
|
7
|
-
const de = ["qsr", "coffee", "tea"],
|
|
6
|
+
import { _ as Y } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
7
|
+
const de = ["qsr", "coffee", "tea"], J = [
|
|
8
8
|
// `label` and `description` are MERCHANT-FACING: the portal's picker renders
|
|
9
9
|
// them, and they are the only thing a merchant chooses on. Say what the app does
|
|
10
10
|
// for their customers, never which package it is built from — the SDK is real and
|
|
@@ -32,50 +32,52 @@ const de = ["qsr", "coffee", "tea"], W = [
|
|
|
32
32
|
key: 2,
|
|
33
33
|
class: "portal-error",
|
|
34
34
|
role: "alert"
|
|
35
|
-
}, ce = /* @__PURE__ */
|
|
35
|
+
}, K = "miniprogram-vue-v2", ce = /* @__PURE__ */ W({
|
|
36
36
|
__name: "TemplateChoiceDialog",
|
|
37
37
|
props: {
|
|
38
38
|
choice: {}
|
|
39
39
|
},
|
|
40
40
|
emits: ["saved", "close"],
|
|
41
41
|
setup(x, { emit: g }) {
|
|
42
|
-
var B,
|
|
43
|
-
const i = x, C = g, m = r(((B = i.choice) == null ? void 0 : B.id) ?? ""),
|
|
42
|
+
var B, L, R, U, O, z, M;
|
|
43
|
+
const i = x, C = g, m = r(((B = i.choice) == null ? void 0 : B.id) ?? ""), b = r(((L = i.choice) == null ? void 0 : L.appTemplateId) ?? K), _ = r(((R = i.choice) == null ? void 0 : R.restaurantStyle) ?? "qsr"), f = r(((U = i.choice) == null ? void 0 : U.label) ?? ""), y = r(((O = i.choice) == null ? void 0 : O.description) ?? ""), T = r((((z = i.choice) == null ? void 0 : z.industries) ?? []).join(", ")), V = r(((M = i.choice) == null ? void 0 : M.default) ?? !1), e = r(!1), u = r(""), l = E(() => !!i.choice), t = E(
|
|
44
|
+
() => (l.value ? J : J.filter((p) => p.id === K)).map((p) => ({ label: p.label, value: p.id }))
|
|
45
|
+
), w = E(() => b.value === "miniprogram-vue-v2"), Q = de.map((p) => ({ label: p, value: p })), N = E(
|
|
44
46
|
() => !e.value && f.value.trim().length > 0 && y.value.trim().length > 0 && (l.value ? !0 : /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(m.value.trim()))
|
|
45
47
|
);
|
|
46
|
-
async function
|
|
48
|
+
async function X() {
|
|
47
49
|
if (!N.value) return;
|
|
48
50
|
e.value = !0, u.value = "";
|
|
49
|
-
const
|
|
51
|
+
const p = {
|
|
50
52
|
...l.value ? {} : { id: m.value.trim() },
|
|
51
|
-
appTemplateId:
|
|
53
|
+
appTemplateId: b.value,
|
|
52
54
|
label: f.value.trim(),
|
|
53
55
|
description: y.value.trim(),
|
|
54
56
|
industries: T.value.split(",").map((a) => a.trim()).filter(Boolean),
|
|
55
57
|
default: V.value,
|
|
56
|
-
...w.value ? { restaurantStyle:
|
|
58
|
+
...w.value ? { restaurantStyle: _.value } : {}
|
|
57
59
|
};
|
|
58
60
|
try {
|
|
59
61
|
await P(
|
|
60
62
|
l.value ? A.appTemplateChoice(i.choice.id) : A.appTemplateChoices(),
|
|
61
|
-
{ method: l.value ? "PATCH" : "POST", body: JSON.stringify(
|
|
63
|
+
{ method: l.value ? "PATCH" : "POST", body: JSON.stringify(p) }
|
|
62
64
|
), C("saved");
|
|
63
65
|
} catch (a) {
|
|
64
|
-
u.value =
|
|
66
|
+
u.value = $(a);
|
|
65
67
|
} finally {
|
|
66
68
|
e.value = !1;
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
|
-
return (
|
|
70
|
-
const
|
|
71
|
-
return n(), S(
|
|
71
|
+
return (p, a) => {
|
|
72
|
+
const D = h("FmTextField"), j = h("FmSelect"), Z = h("FmTextarea"), ee = h("FmSwitch"), q = h("FmButton"), te = h("FmCard"), ae = h("FmForm");
|
|
73
|
+
return n(), S(ae, { onValidationSuccess: X }, {
|
|
72
74
|
default: I(() => [
|
|
73
|
-
d(
|
|
75
|
+
d(te, { class: "template-choice-dialog" }, {
|
|
74
76
|
default: I(() => {
|
|
75
|
-
var
|
|
77
|
+
var G;
|
|
76
78
|
return [
|
|
77
|
-
s("h2", null, c(l.value ? `Edit ${(
|
|
78
|
-
l.value ? F("", !0) : (n(), S(
|
|
79
|
+
s("h2", null, c(l.value ? `Edit ${(G = x.choice) == null ? void 0 : G.label}` : "New template choice"), 1),
|
|
80
|
+
l.value ? F("", !0) : (n(), S(D, {
|
|
79
81
|
key: 0,
|
|
80
82
|
modelValue: m.value,
|
|
81
83
|
"onUpdate:modelValue": a[0] || (a[0] = (o) => m.value = o),
|
|
@@ -85,59 +87,59 @@ const de = ["qsr", "coffee", "tea"], W = [
|
|
|
85
87
|
disabled: e.value,
|
|
86
88
|
rules: [(o) => /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(o.trim()) || "Lowercase kebab-case, e.g. miniprogram-vue-v2-bakery"]
|
|
87
89
|
}, null, 8, ["modelValue", "disabled", "rules"])),
|
|
88
|
-
d(
|
|
89
|
-
modelValue:
|
|
90
|
-
"onUpdate:modelValue": a[1] || (a[1] = (o) =>
|
|
90
|
+
d(j, {
|
|
91
|
+
modelValue: b.value,
|
|
92
|
+
"onUpdate:modelValue": a[1] || (a[1] = (o) => b.value = o),
|
|
91
93
|
label: "Physical template",
|
|
92
|
-
items:
|
|
93
|
-
disabled: e.value || l.value
|
|
94
|
+
items: t.value,
|
|
95
|
+
disabled: e.value || l.value || t.value.length <= 1
|
|
94
96
|
}, null, 8, ["modelValue", "items", "disabled"]),
|
|
95
|
-
w.value ? (n(), S(
|
|
97
|
+
w.value ? (n(), S(j, {
|
|
96
98
|
key: 1,
|
|
97
|
-
modelValue:
|
|
98
|
-
"onUpdate:modelValue": a[2] || (a[2] = (o) =>
|
|
99
|
+
modelValue: _.value,
|
|
100
|
+
"onUpdate:modelValue": a[2] || (a[2] = (o) => _.value = o),
|
|
99
101
|
label: "Restaurant style",
|
|
100
102
|
"helper-text": "Only styles templates/miniprogram-vue-v2/src/brand/recipes.ts already implements.",
|
|
101
|
-
items:
|
|
103
|
+
items: le(Q),
|
|
102
104
|
disabled: e.value
|
|
103
105
|
}, null, 8, ["modelValue", "items", "disabled"])) : F("", !0),
|
|
104
|
-
d(
|
|
106
|
+
d(D, {
|
|
105
107
|
modelValue: f.value,
|
|
106
108
|
"onUpdate:modelValue": a[3] || (a[3] = (o) => f.value = o),
|
|
107
109
|
label: "Label",
|
|
108
110
|
placeholder: "Shown to merchants in the picker",
|
|
109
111
|
disabled: e.value
|
|
110
112
|
}, null, 8, ["modelValue", "disabled"]),
|
|
111
|
-
d(
|
|
113
|
+
d(Z, {
|
|
112
114
|
modelValue: y.value,
|
|
113
115
|
"onUpdate:modelValue": a[4] || (a[4] = (o) => y.value = o),
|
|
114
116
|
label: "Description",
|
|
115
117
|
placeholder: "One or two sentences on what the merchant gets",
|
|
116
118
|
disabled: e.value
|
|
117
119
|
}, null, 8, ["modelValue", "disabled"]),
|
|
118
|
-
d(
|
|
120
|
+
d(D, {
|
|
119
121
|
modelValue: T.value,
|
|
120
122
|
"onUpdate:modelValue": a[5] || (a[5] = (o) => T.value = o),
|
|
121
123
|
label: "Industries (comma-separated)",
|
|
122
124
|
placeholder: "e.g. Food & beverage",
|
|
123
125
|
disabled: e.value
|
|
124
126
|
}, null, 8, ["modelValue", "disabled"]),
|
|
125
|
-
d(
|
|
127
|
+
d(ee, {
|
|
126
128
|
modelValue: V.value,
|
|
127
129
|
"onUpdate:modelValue": a[6] || (a[6] = (o) => V.value = o),
|
|
128
130
|
label: "Default choice",
|
|
129
131
|
sublabel: "Used when a provision request names none",
|
|
130
132
|
disabled: e.value
|
|
131
133
|
}, null, 8, ["modelValue", "disabled"]),
|
|
132
|
-
u.value ? (n(),
|
|
134
|
+
u.value ? (n(), v("p", ue, c(u.value), 1)) : F("", !0),
|
|
133
135
|
s("footer", null, [
|
|
134
|
-
d(
|
|
136
|
+
d(q, {
|
|
135
137
|
label: "Cancel",
|
|
136
138
|
variant: "tertiary",
|
|
137
139
|
disabled: e.value,
|
|
138
140
|
onClick: a[7] || (a[7] = (o) => C("close"))
|
|
139
141
|
}, null, 8, ["disabled"]),
|
|
140
|
-
d(
|
|
142
|
+
d(q, {
|
|
141
143
|
label: l.value ? "Save" : "Create",
|
|
142
144
|
type: "submit",
|
|
143
145
|
loading: e.value,
|
|
@@ -153,7 +155,7 @@ const de = ["qsr", "coffee", "tea"], W = [
|
|
|
153
155
|
});
|
|
154
156
|
};
|
|
155
157
|
}
|
|
156
|
-
}), me = /* @__PURE__ */
|
|
158
|
+
}), me = /* @__PURE__ */ Y(ce, [["__scopeId", "data-v-9346a740"]]), pe = { class: "portal-page" }, ve = { class: "portal-page-inner" }, be = { class: "portal-page-heading" }, _e = {
|
|
157
159
|
key: 0,
|
|
158
160
|
class: "portal-error",
|
|
159
161
|
role: "alert"
|
|
@@ -164,19 +166,19 @@ const de = ["qsr", "coffee", "tea"], W = [
|
|
|
164
166
|
key: 2,
|
|
165
167
|
class: "template-choices__list",
|
|
166
168
|
"aria-label": "Template choices"
|
|
167
|
-
}, ye = { class: "template-choices__name" }, ge = { class: "template-choices__label" }, Ce = { key: 0 }, ke = { class: "template-choices__id" }, Te = { class: "template-choices__meta" }, Ve = ["datetime"], we = { class: "template-choices__actions" }, Se = /* @__PURE__ */
|
|
169
|
+
}, ye = { class: "template-choices__name" }, ge = { class: "template-choices__label" }, Ce = { key: 0 }, ke = { class: "template-choices__id" }, Te = { class: "template-choices__meta" }, Ve = ["datetime"], we = { class: "template-choices__actions" }, Se = /* @__PURE__ */ W({
|
|
168
170
|
__name: "TemplateCenterView",
|
|
169
171
|
setup(x) {
|
|
170
|
-
const g = ie(), i = r([]), C = r(!0), m = r(""),
|
|
171
|
-
async function
|
|
172
|
+
const g = ie(), i = r([]), C = r(!0), m = r(""), b = new AbortController();
|
|
173
|
+
async function _() {
|
|
172
174
|
C.value = !0, m.value = "";
|
|
173
175
|
try {
|
|
174
176
|
const e = await P(A.appTemplateChoices(), {
|
|
175
|
-
signal:
|
|
177
|
+
signal: b.signal
|
|
176
178
|
});
|
|
177
179
|
i.value = e.choices;
|
|
178
180
|
} catch (e) {
|
|
179
|
-
|
|
181
|
+
b.signal.aborted || (m.value = $(e));
|
|
180
182
|
} finally {
|
|
181
183
|
C.value = !1;
|
|
182
184
|
}
|
|
@@ -189,7 +191,7 @@ const de = ["qsr", "coffee", "tea"], W = [
|
|
|
189
191
|
choice: e,
|
|
190
192
|
onClose: () => g.close(),
|
|
191
193
|
onSaved: () => {
|
|
192
|
-
g.close(),
|
|
194
|
+
g.close(), _();
|
|
193
195
|
}
|
|
194
196
|
}
|
|
195
197
|
});
|
|
@@ -199,9 +201,9 @@ const de = ["qsr", "coffee", "tea"], W = [
|
|
|
199
201
|
await P(
|
|
200
202
|
u === "archived" ? A.appTemplateChoiceArchive(e.id) : A.appTemplateChoiceRestore(e.id),
|
|
201
203
|
{ method: "POST" }
|
|
202
|
-
), await
|
|
204
|
+
), await _();
|
|
203
205
|
} catch (l) {
|
|
204
|
-
m.value =
|
|
206
|
+
m.value = $(l);
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
function T(e) {
|
|
@@ -215,9 +217,9 @@ const de = ["qsr", "coffee", "tea"], W = [
|
|
|
215
217
|
function V(e) {
|
|
216
218
|
return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(new Date(e));
|
|
217
219
|
}
|
|
218
|
-
return oe(() => void
|
|
220
|
+
return oe(() => void _()), ne(() => b.abort()), (e, u) => {
|
|
219
221
|
const l = h("FmButton");
|
|
220
|
-
return n(),
|
|
222
|
+
return n(), v("div", pe, [
|
|
221
223
|
s("div", ve, [
|
|
222
224
|
s("header", be, [
|
|
223
225
|
u[1] || (u[1] = s("div", null, [
|
|
@@ -230,27 +232,27 @@ const de = ["qsr", "coffee", "tea"], W = [
|
|
|
230
232
|
onClick: u[0] || (u[0] = (t) => f())
|
|
231
233
|
})
|
|
232
234
|
]),
|
|
233
|
-
m.value ? (n(),
|
|
235
|
+
m.value ? (n(), v("p", _e, [
|
|
234
236
|
k(c(m.value) + " ", 1),
|
|
235
237
|
d(l, {
|
|
236
238
|
label: "Retry",
|
|
237
239
|
variant: "tertiary",
|
|
238
|
-
onClick:
|
|
240
|
+
onClick: _
|
|
239
241
|
})
|
|
240
|
-
])) : C.value ? (n(),
|
|
241
|
-
(n(!0),
|
|
242
|
+
])) : C.value ? (n(), v("p", he, "Loading template choices…")) : (n(), v("section", fe, [
|
|
243
|
+
(n(!0), v(H, null, se(i.value, (t) => (n(), v("article", {
|
|
242
244
|
key: t.id,
|
|
243
245
|
class: "template-choices__row"
|
|
244
246
|
}, [
|
|
245
247
|
s("div", ye, [
|
|
246
248
|
s("span", ge, [
|
|
247
249
|
k(c(t.label), 1),
|
|
248
|
-
t.default ? (n(),
|
|
250
|
+
t.default ? (n(), v("span", Ce, " · Default")) : F("", !0)
|
|
249
251
|
]),
|
|
250
252
|
s("span", ke, c(t.id), 1),
|
|
251
253
|
s("span", Te, [
|
|
252
254
|
k(c(t.appTemplateId), 1),
|
|
253
|
-
t.restaurantStyle ? (n(),
|
|
255
|
+
t.restaurantStyle ? (n(), v(H, { key: 0 }, [
|
|
254
256
|
k(" · " + c(t.restaurantStyle), 1)
|
|
255
257
|
], 64)) : F("", !0),
|
|
256
258
|
k(" · " + c(t.industries.join(", ") || "General-purpose") + " · " + c((t.environments ?? []).join(", ")), 1)
|
|
@@ -291,7 +293,7 @@ const de = ["qsr", "coffee", "tea"], W = [
|
|
|
291
293
|
]);
|
|
292
294
|
};
|
|
293
295
|
}
|
|
294
|
-
}), Pe = /* @__PURE__ */
|
|
296
|
+
}), Pe = /* @__PURE__ */ Y(Se, [["__scopeId", "data-v-da7cd846"]]);
|
|
295
297
|
export {
|
|
296
298
|
Pe as default
|
|
297
299
|
};
|
package/dist/app.js
CHANGED
|
@@ -70,7 +70,7 @@ const o = [
|
|
|
70
70
|
path: "/internal/template-center",
|
|
71
71
|
name: "miniprogram-v2-template-center",
|
|
72
72
|
meta: { title: "Template Center", requiresAdmin: !0 },
|
|
73
|
-
component: () => import("./TemplateCenterView-
|
|
73
|
+
component: () => import("./TemplateCenterView-B_Yvaeza.js")
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
path: "/:pathMatch(.*)*",
|