@feedmepos/mf-miniprogram-v2 0.2.2-dev.10 → 0.2.2-dev.11
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/{ControlPlaneView-BJ6QP0bK.js → ControlPlaneView-BN9srEtl.js} +4152 -4124
- package/dist/MobileProjectsView-QbURgYLB.js +296 -0
- package/dist/app.js +2 -2
- package/dist/package.json +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/MobileProjectsView-DAWuOiCr.js +0 -279
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { defineComponent as U, ref as j, onMounted as B, resolveComponent as I, openBlock as n, createBlock as P, withCtx as C, createVNode as r, createElementVNode as o, toDisplayString as _, createElementBlock as d, Fragment as D, createCommentVNode as S, onScopeDispose as A, createTextVNode as F, renderList as O, unref as g } from "vue";
|
|
2
|
+
import { useRoute as E, useRouter as Y } from "vue-router";
|
|
3
|
+
import { useDialog as z } from "@feedmepos/ui-library";
|
|
4
|
+
import { a as R } from "./routes-Boz_WlNM.js";
|
|
5
|
+
import { c as x, e as L, a as H } from "./controlPlane-CoEgf9BA.js";
|
|
6
|
+
import { u as J } from "./portalContext-C4HL_0kl.js";
|
|
7
|
+
import { w as N } from "./portalNavigation-DOF4Ah49.js";
|
|
8
|
+
import { m as G } from "./index-D5qXvcfE.js";
|
|
9
|
+
import { A as K } from "./AppTemplatePicker-C0lZyhK2.js";
|
|
10
|
+
import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
11
|
+
import { _ as T } from "./StatusBadge.vue_vue_type_script_setup_true_lang-Bh9Eoe_H.js";
|
|
12
|
+
const Q = {
|
|
13
|
+
key: 0,
|
|
14
|
+
role: "status"
|
|
15
|
+
}, W = {
|
|
16
|
+
key: 1,
|
|
17
|
+
class: "portal-error",
|
|
18
|
+
role: "alert"
|
|
19
|
+
}, X = /* @__PURE__ */ U({
|
|
20
|
+
__name: "MobileProjectDialog",
|
|
21
|
+
props: {
|
|
22
|
+
businessId: {},
|
|
23
|
+
projectId: {},
|
|
24
|
+
initialName: {}
|
|
25
|
+
},
|
|
26
|
+
emits: ["saved", "close"],
|
|
27
|
+
setup(k, { emit: V }) {
|
|
28
|
+
const l = k, h = V, i = j(l.initialName ?? ""), u = j(null), f = j([]), p = j(!l.projectId), c = j(!1), m = j(""), w = G();
|
|
29
|
+
async function M() {
|
|
30
|
+
var e, s;
|
|
31
|
+
p.value = !0, m.value = "";
|
|
32
|
+
try {
|
|
33
|
+
const b = await x(R.appTemplates());
|
|
34
|
+
f.value = b.templates, u.value = ((e = b.templates.find((y) => y.default)) == null ? void 0 : e.id) ?? ((s = b.templates[0]) == null ? void 0 : s.id) ?? null;
|
|
35
|
+
} catch (b) {
|
|
36
|
+
m.value = L(b);
|
|
37
|
+
} finally {
|
|
38
|
+
p.value = !1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function a() {
|
|
42
|
+
if (!(c.value || !i.value.trim() || i.value.trim().length > 120 || !l.projectId && !u.value)) {
|
|
43
|
+
c.value = !0, m.value = "";
|
|
44
|
+
try {
|
|
45
|
+
const e = await x(l.projectId ? R.project(l.businessId, l.projectId) : R.projects(l.businessId), {
|
|
46
|
+
method: l.projectId ? "PATCH" : "POST",
|
|
47
|
+
body: JSON.stringify({ name: i.value.trim(), ...l.projectId ? {} : {
|
|
48
|
+
projectId: w,
|
|
49
|
+
kind: "mobile",
|
|
50
|
+
appTemplate: u.value,
|
|
51
|
+
country: H()
|
|
52
|
+
} })
|
|
53
|
+
});
|
|
54
|
+
h("saved", e);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
m.value = L(e);
|
|
57
|
+
} finally {
|
|
58
|
+
c.value = !1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return B(() => {
|
|
63
|
+
l.projectId || M();
|
|
64
|
+
}), (e, s) => {
|
|
65
|
+
const b = I("FmTextField"), y = I("FmButton"), $ = I("FmCard"), t = I("FmForm");
|
|
66
|
+
return n(), P(t, { onValidationSuccess: a }, {
|
|
67
|
+
default: C(() => [
|
|
68
|
+
r($, { class: "project-dialog" }, {
|
|
69
|
+
default: C(() => [
|
|
70
|
+
o("h2", null, _(k.projectId ? "Rename project" : "New Mobile project"), 1),
|
|
71
|
+
r(b, {
|
|
72
|
+
modelValue: i.value,
|
|
73
|
+
"onUpdate:modelValue": s[0] || (s[0] = (v) => i.value = v),
|
|
74
|
+
label: "Project name",
|
|
75
|
+
placeholder: "e.g. Summer ordering",
|
|
76
|
+
disabled: c.value,
|
|
77
|
+
rules: [(v) => v.trim().length > 0 && v.trim().length <= 120 || "Enter a name up to 120 characters"]
|
|
78
|
+
}, null, 8, ["modelValue", "disabled", "rules"]),
|
|
79
|
+
k.projectId ? S("", !0) : (n(), d(D, { key: 0 }, [
|
|
80
|
+
p.value ? (n(), d("p", Q, "Loading templates…")) : (n(), P(K, {
|
|
81
|
+
key: 1,
|
|
82
|
+
templates: f.value,
|
|
83
|
+
modelValue: u.value,
|
|
84
|
+
"onUpdate:modelValue": s[1] || (s[1] = (v) => u.value = v),
|
|
85
|
+
disabled: c.value
|
|
86
|
+
}, null, 8, ["templates", "modelValue", "disabled"])),
|
|
87
|
+
s[3] || (s[3] = o("p", { class: "project-dialog__note" }, "Start a separate app from a template. Your live app stays as it is.", -1))
|
|
88
|
+
], 64)),
|
|
89
|
+
m.value ? (n(), d("p", W, _(m.value), 1)) : S("", !0),
|
|
90
|
+
!k.projectId && !f.value.length && !p.value ? (n(), P(y, {
|
|
91
|
+
key: 2,
|
|
92
|
+
label: "Retry loading templates",
|
|
93
|
+
variant: "secondary",
|
|
94
|
+
onClick: M
|
|
95
|
+
})) : S("", !0),
|
|
96
|
+
o("footer", null, [
|
|
97
|
+
r(y, {
|
|
98
|
+
label: "Cancel",
|
|
99
|
+
variant: "tertiary",
|
|
100
|
+
disabled: c.value,
|
|
101
|
+
onClick: s[2] || (s[2] = (v) => h("close"))
|
|
102
|
+
}, null, 8, ["disabled"]),
|
|
103
|
+
r(y, {
|
|
104
|
+
label: k.projectId ? "Save" : "Create project",
|
|
105
|
+
type: "submit",
|
|
106
|
+
loading: c.value,
|
|
107
|
+
disabled: p.value || !i.value.trim() || i.value.trim().length > 120 || !k.projectId && !u.value
|
|
108
|
+
}, null, 8, ["label", "loading", "disabled"])
|
|
109
|
+
])
|
|
110
|
+
]),
|
|
111
|
+
_: 1
|
|
112
|
+
})
|
|
113
|
+
]),
|
|
114
|
+
_: 1
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}), Z = /* @__PURE__ */ q(X, [["__scopeId", "data-v-c903cb52"]]), ee = { class: "portal-page" }, te = { class: "portal-page-inner" }, oe = { class: "portal-page-heading" }, ae = {
|
|
119
|
+
key: 0,
|
|
120
|
+
class: "mobile-projects__count"
|
|
121
|
+
}, le = {
|
|
122
|
+
key: 0,
|
|
123
|
+
class: "portal-error",
|
|
124
|
+
role: "alert"
|
|
125
|
+
}, se = {
|
|
126
|
+
key: 1,
|
|
127
|
+
role: "status"
|
|
128
|
+
}, ne = {
|
|
129
|
+
key: 2,
|
|
130
|
+
class: "portal-empty"
|
|
131
|
+
}, re = {
|
|
132
|
+
key: 3,
|
|
133
|
+
class: "mobile-projects__list",
|
|
134
|
+
"aria-label": "Mobile projects"
|
|
135
|
+
}, ie = { class: "mobile-projects__name" }, ue = ["title"], ce = { class: "mobile-projects__status" }, de = { class: "mobile-projects__status" }, pe = { class: "mobile-projects__label" }, me = { class: "mobile-projects__status" }, ve = ["datetime"], _e = { class: "mobile-projects__actions" }, be = { class: "w-[200px] py-4" }, je = /* @__PURE__ */ U({
|
|
136
|
+
__name: "MobileProjectsView",
|
|
137
|
+
setup(k) {
|
|
138
|
+
const V = J(), l = E(), h = Y(), i = z(), u = j([]), f = j(!0), p = j(""), c = new AbortController();
|
|
139
|
+
async function m() {
|
|
140
|
+
f.value = !0, p.value = "";
|
|
141
|
+
try {
|
|
142
|
+
const a = await x(R.projects(V.businessId.value), { signal: c.signal });
|
|
143
|
+
u.value = a.projects;
|
|
144
|
+
} catch (a) {
|
|
145
|
+
c.signal.aborted || (p.value = L(a));
|
|
146
|
+
} finally {
|
|
147
|
+
f.value = !1;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function w(a) {
|
|
151
|
+
i.open({
|
|
152
|
+
title: a ? "Rename project" : "New Mobile project",
|
|
153
|
+
dialogComponent: Z,
|
|
154
|
+
dialogComponentProps: {
|
|
155
|
+
businessId: V.businessId.value,
|
|
156
|
+
projectId: a == null ? void 0 : a.projectId,
|
|
157
|
+
initialName: a == null ? void 0 : a.name,
|
|
158
|
+
onClose: () => i.close(),
|
|
159
|
+
onSaved: (e) => {
|
|
160
|
+
i.close(), a ? m() : h.push(N(e.projectId, "workspace", { ...l.query, setup: "1" }));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function M(a) {
|
|
166
|
+
return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(new Date(a));
|
|
167
|
+
}
|
|
168
|
+
return B(() => {
|
|
169
|
+
if (m(), l.query.create === "1") {
|
|
170
|
+
const { create: a, ...e } = l.query;
|
|
171
|
+
h.replace({ query: e }), w();
|
|
172
|
+
}
|
|
173
|
+
}), A(() => c.abort()), (a, e) => {
|
|
174
|
+
const s = I("FmButton"), b = I("RouterLink"), y = I("FmMenuItem"), $ = I("FmMenu");
|
|
175
|
+
return n(), d("div", ee, [
|
|
176
|
+
o("div", te, [
|
|
177
|
+
o("header", oe, [
|
|
178
|
+
o("div", null, [
|
|
179
|
+
e[3] || (e[3] = o("p", { class: "portal-eyebrow" }, "Mobile Ordering", -1)),
|
|
180
|
+
o("h1", null, [
|
|
181
|
+
e[2] || (e[2] = F("Projects ", -1)),
|
|
182
|
+
f.value ? S("", !0) : (n(), d("span", ae, _(u.value.length), 1))
|
|
183
|
+
])
|
|
184
|
+
]),
|
|
185
|
+
r(s, {
|
|
186
|
+
label: "New project",
|
|
187
|
+
icon: "add",
|
|
188
|
+
onClick: e[0] || (e[0] = (t) => w())
|
|
189
|
+
})
|
|
190
|
+
]),
|
|
191
|
+
p.value ? (n(), d("p", le, [
|
|
192
|
+
F(_(p.value) + " ", 1),
|
|
193
|
+
r(s, {
|
|
194
|
+
label: "Retry",
|
|
195
|
+
variant: "tertiary",
|
|
196
|
+
onClick: m
|
|
197
|
+
})
|
|
198
|
+
])) : f.value ? (n(), d("p", se, "Loading projects…")) : u.value.length ? (n(), d("section", re, [
|
|
199
|
+
(n(!0), d(D, null, O(u.value, (t) => (n(), d("article", {
|
|
200
|
+
key: t.projectId,
|
|
201
|
+
class: "mobile-projects__row"
|
|
202
|
+
}, [
|
|
203
|
+
o("div", ie, [
|
|
204
|
+
r(b, {
|
|
205
|
+
to: g(N)(t.projectId, "workspace", g(l).query)
|
|
206
|
+
}, {
|
|
207
|
+
default: C(() => [
|
|
208
|
+
F(_(t.name), 1)
|
|
209
|
+
]),
|
|
210
|
+
_: 2
|
|
211
|
+
}, 1032, ["to"]),
|
|
212
|
+
o("span", {
|
|
213
|
+
title: t.projectId
|
|
214
|
+
}, "…" + _(t.projectId.slice(-6)), 9, ue)
|
|
215
|
+
]),
|
|
216
|
+
o("div", ce, [
|
|
217
|
+
e[6] || (e[6] = o("span", { class: "mobile-projects__label" }, "Setup", -1)),
|
|
218
|
+
r(T, {
|
|
219
|
+
variant: t.provisioningStatus === "failed" ? "error" : "neutral"
|
|
220
|
+
}, {
|
|
221
|
+
default: C(() => [
|
|
222
|
+
F(_(t.provisioningStatus === "ready" ? "Ready" : t.provisioningStatus === "failed" ? "Setup failed" : t.provisioningStatus === "provisioning" ? "Setting up" : "Not set up"), 1)
|
|
223
|
+
]),
|
|
224
|
+
_: 2
|
|
225
|
+
}, 1032, ["variant"])
|
|
226
|
+
]),
|
|
227
|
+
o("div", de, [
|
|
228
|
+
r(T, {
|
|
229
|
+
variant: t.isLive ? "success" : "neutral"
|
|
230
|
+
}, {
|
|
231
|
+
default: C(() => [
|
|
232
|
+
F(_(t.isLive ? "Live project" : "Not live"), 1)
|
|
233
|
+
]),
|
|
234
|
+
_: 2
|
|
235
|
+
}, 1032, ["variant"]),
|
|
236
|
+
o("span", pe, _(t.hasUnpublishedRelease === void 0 ? "Release status unavailable" : t.hasUnpublishedRelease ? "Unpublished release available" : "No unpublished release"), 1)
|
|
237
|
+
]),
|
|
238
|
+
o("div", me, [
|
|
239
|
+
e[7] || (e[7] = o("span", { class: "mobile-projects__label" }, "Last edited", -1)),
|
|
240
|
+
o("time", {
|
|
241
|
+
datetime: t.updatedAt
|
|
242
|
+
}, _(M(t.updatedAt)), 9, ve)
|
|
243
|
+
]),
|
|
244
|
+
o("div", _e, [
|
|
245
|
+
r(s, {
|
|
246
|
+
label: t.provisioningStatus === "ready" ? "Open editor" : "Continue setup",
|
|
247
|
+
variant: "secondary",
|
|
248
|
+
onClick: (v) => g(h).push(g(N)(t.projectId, "workspace", g(l).query))
|
|
249
|
+
}, null, 8, ["label", "onClick"]),
|
|
250
|
+
r($, {
|
|
251
|
+
placement: "bottom-end",
|
|
252
|
+
"close-on-click": ""
|
|
253
|
+
}, {
|
|
254
|
+
"menu-button": C(() => [
|
|
255
|
+
r(s, {
|
|
256
|
+
icon: "more_horiz",
|
|
257
|
+
variant: "tertiary",
|
|
258
|
+
"aria-label": `Actions for ${t.name}`
|
|
259
|
+
}, null, 8, ["aria-label"])
|
|
260
|
+
]),
|
|
261
|
+
default: C(() => [
|
|
262
|
+
o("div", be, [
|
|
263
|
+
r(y, {
|
|
264
|
+
label: "Rename project",
|
|
265
|
+
icon: "edit",
|
|
266
|
+
"onUpdate:modelValue": (v) => w(t)
|
|
267
|
+
}, null, 8, ["onUpdate:modelValue"]),
|
|
268
|
+
t.provisioningStatus === "ready" ? (n(), P(y, {
|
|
269
|
+
key: 0,
|
|
270
|
+
label: "View releases",
|
|
271
|
+
icon: "deployed_code",
|
|
272
|
+
"onUpdate:modelValue": (v) => g(h).push(g(N)(t.projectId, "releases", g(l).query))
|
|
273
|
+
}, null, 8, ["onUpdate:modelValue"])) : S("", !0)
|
|
274
|
+
])
|
|
275
|
+
]),
|
|
276
|
+
_: 2
|
|
277
|
+
}, 1024)
|
|
278
|
+
])
|
|
279
|
+
]))), 128))
|
|
280
|
+
])) : (n(), d("section", ne, [
|
|
281
|
+
e[4] || (e[4] = o("h2", null, "Your first Mobile project", -1)),
|
|
282
|
+
e[5] || (e[5] = o("p", null, "Create an app from a template to start editing.", -1)),
|
|
283
|
+
r(s, {
|
|
284
|
+
label: "New project",
|
|
285
|
+
icon: "add",
|
|
286
|
+
onClick: e[1] || (e[1] = (t) => w())
|
|
287
|
+
})
|
|
288
|
+
]))
|
|
289
|
+
])
|
|
290
|
+
]);
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
}), Me = /* @__PURE__ */ q(je, [["__scopeId", "data-v-984161f0"]]);
|
|
294
|
+
export {
|
|
295
|
+
Me as default
|
|
296
|
+
};
|
package/dist/app.js
CHANGED
|
@@ -4,7 +4,7 @@ const o = [
|
|
|
4
4
|
path: "/platforms/mobile",
|
|
5
5
|
name: "miniprogram-v2-mobile-projects",
|
|
6
6
|
meta: { title: "Mobile" },
|
|
7
|
-
component: () => import("./MobileProjectsView-
|
|
7
|
+
component: () => import("./MobileProjectsView-QbURgYLB.js")
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
path: "/",
|
|
@@ -21,7 +21,7 @@ const o = [
|
|
|
21
21
|
{
|
|
22
22
|
path: "/p/:projectId/:view(workspace|releases|sessions)?",
|
|
23
23
|
name: "miniprogram-v2-project",
|
|
24
|
-
component: () => import("./ControlPlaneView-
|
|
24
|
+
component: () => import("./ControlPlaneView-BN9srEtl.js")
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
path: "/brand-kit",
|