@feedmepos/mf-miniprogram-v2 0.2.2-dev.21 → 0.2.2-dev.22

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.
@@ -2,9 +2,10 @@ import { defineComponent as N, computed as y, ref as q, onMounted as V, onBefore
2
2
  import { useCoreStore as $ } from "@feedmepos/mf-common";
3
3
  import { useRoute as D, RouterView as G } from "vue-router";
4
4
  import { P as c } from "./PortalIcon-DO0VrIoY.js";
5
- import { r as I, u as Q, t as U, w as L } from "./templatePickerFlag-BIYWgnaS.js";
6
- import { p as H } from "./portalContext-BFTX5VVx.js";
5
+ import { r as I, u as Q, w as L } from "./adminAccess-NgYNNa6s.js";
6
+ import { p as U } from "./portalContext-BFTX5VVx.js";
7
7
  import { p as d } from "./portalNavigation-DKCfwTH8.js";
8
+ import { t as H } from "./templatePickerFlag-CosY_15R.js";
8
9
  import { _ as J } from "./_plugin-vue_export-helper-CHgC5LLL.js";
9
10
  const W = {
10
11
  class: "portal-sidebar",
@@ -34,7 +35,7 @@ const W = {
34
35
  }, se = /* @__PURE__ */ N({
35
36
  __name: "App",
36
37
  setup(ie) {
37
- const r = D(), k = $(), s = H(), p = y(() => r.name === "miniprogram-v2-project"), b = q(
38
+ const r = D(), k = $(), s = U(), p = y(() => r.name === "miniprogram-v2-project"), b = q(
38
39
  I(
39
40
  "mpv2:portal-collapsed",
40
41
  typeof window < "u" && window.matchMedia("(max-width: 1000px)").matches
@@ -48,7 +49,7 @@ const W = {
48
49
  { name: "miniprogram-v2-ecosystem", label: "Ecosystem", icon: "ecosystem" },
49
50
  { name: "miniprogram-v2-brand-kit", label: "Brand Kit", icon: "brand" },
50
51
  { name: "miniprogram-v2-pages", label: "Pages", icon: "pages" }
51
- ], R = y(() => ({ name: "miniprogram-v2-mobile-projects", query: d(r.query) })), z = Q(), A = U();
52
+ ], R = y(() => ({ name: "miniprogram-v2-mobile-projects", query: d(r.query) })), z = Q(), A = H();
52
53
  let M = !1;
53
54
  V(() => {
54
55
  M = k.hideSidebar.value, k.hideSidebar.value = !0;
@@ -207,7 +208,7 @@ const W = {
207
208
  ], 64);
208
209
  };
209
210
  }
210
- }), ye = /* @__PURE__ */ J(se, [["__scopeId", "data-v-782c3640"]]);
211
+ }), fe = /* @__PURE__ */ J(se, [["__scopeId", "data-v-782c3640"]]);
211
212
  export {
212
- ye as default
213
+ fe as default
213
214
  };
@@ -10,11 +10,12 @@ import { r as Ul, a as eu, b as tu, s as Ua, c as qa, p as nu, A as ru, d as au,
10
10
  import { _ as ql, B as iu } from "./BrandFontPicker-kQKWf1hL.js";
11
11
  import { g as lu, C as Ss, F as Ts, u as Es, i as Fl, a as ou, t as cu } from "./useBrandKit-CkdPQRE-.js";
12
12
  import { _ as Bt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
13
- import { r as uu, w as du, a as pu, u as fu, t as Fa, b as ii } from "./templatePickerFlag-BIYWgnaS.js";
13
+ import { r as uu, w as du, a as pu, u as fu, b as ii } from "./adminAccess-NgYNNa6s.js";
14
14
  import { a as Ve } from "./routes-D6BQSP4i.js";
15
15
  import { _ as vn } from "./StatusBadge.vue_vue_type_script_setup_true_lang-CMgQ0bd_.js";
16
16
  import { u as hu } from "./portalContext-BFTX5VVx.js";
17
17
  import { a as mu, w as gu } from "./portalNavigation-DKCfwTH8.js";
18
+ import { t as Fa } from "./templatePickerFlag-CosY_15R.js";
18
19
  import { useRoute as li, useRouter as yu } from "vue-router";
19
20
  const bu = "data:image/svg+xml,%3csvg%20preserveAspectRatio='none'%20overflow='visible'%20style='display:%20block;'%20width='15.7373'%20height='15.7375'%20viewBox='0%200%2015.7373%2015.7375'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201197147446'%3e%3cpath%20id='Union'%20d='M7.86914%200.0891113C12.2164%200.0891573%2015.7373%201.09311%2015.7373%202.32544V13.5012C15.7373%2014.7335%2012.2164%2015.7375%207.86914%2015.7375C3.52179%2015.7375%200%2014.7336%200%2013.5012V2.32544C0%201.09308%203.52179%200.0891113%207.86914%200.0891113ZM7.86914%201.06665C3.92839%201.06665%201.39098%201.90833%200.984375%202.4104V13.4163C1.39115%2013.9183%203.92857%2014.76%207.86914%2014.76C11.8098%2014.76%2014.3474%2013.9183%2014.7539%2013.4163V2.4104C14.3474%201.90834%2011.8098%201.06669%207.86914%201.06665Z'%20fill='%231C1C1E'/%3e%3cpath%20id='Union_2'%20d='M7.86914%200C12.2163%207.21539e-05%2015.7373%200.998832%2015.7373%202.22363C15.7368%203.44831%2012.2159%204.44622%207.86914%204.44629C3.52211%204.44629%200.000533126%203.44835%200%202.22363C0%200.998788%203.52179%200%207.86914%200ZM7.86914%200.972656C4.14488%200.972656%201.67273%201.71814%201.06934%202.22363C1.67321%202.72264%204.14545%203.47461%207.86914%203.47461C11.5925%203.47455%2014.0641%202.7291%2014.668%202.22363C14.0646%201.71816%2011.5931%200.972719%207.86914%200.972656Z'%20fill='%231C1C1E'/%3e%3cpath%20id='Vector'%20d='M14.8687%2010.3687C13.8314%2011.2448%2011.0861%2011.8687%207.85626%2011.8687C4.62645%2011.8687%201.91837%2011.2514%200.868683%2010.3819'%20stroke='%231C1C1E'%20stroke-width='1.25'%20stroke-miterlimit='10'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20id='Vector_2'%20d='M14.8687%206.36841C13.8314%207.24065%2011.0861%207.86841%207.85626%207.86841C4.62645%207.86841%201.91837%207.25387%200.868683%206.38823'%20stroke='%231C1C1E'%20stroke-width='1.25'%20stroke-miterlimit='10'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3c/svg%3e";
20
21
  function Cs() {
@@ -24937,7 +24938,7 @@ ${Ze.value}`,
24937
24938
  ], 2);
24938
24939
  };
24939
24940
  }
24940
- }), jE = /* @__PURE__ */ Bt(ZT, [["__scopeId", "data-v-7d38c0ac"]]);
24941
+ }), UE = /* @__PURE__ */ Bt(ZT, [["__scopeId", "data-v-7d38c0ac"]]);
24941
24942
  export {
24942
- jE as default
24943
+ UE as default
24943
24944
  };
@@ -0,0 +1,313 @@
1
+ import { defineComponent as $, ref as f, onMounted as q, resolveComponent as w, openBlock as l, createBlock as R, withCtx as L, createVNode as g, createElementVNode as c, toDisplayString as N, unref as h, createElementBlock as b, Fragment as O, createCommentVNode as S, computed as E, h as a, withModifiers as T, onScopeDispose as Y, createTextVNode as z } from "vue";
2
+ import { useRoute as H, useRouter as J } from "vue-router";
3
+ import { components as G, useDialog as K } from "@feedmepos/ui-library";
4
+ import { a as P } from "./routes-D6BQSP4i.js";
5
+ import { c as M, e as B, a as Q } from "./controlPlane-sXaC6pAh.js";
6
+ import { u as W } from "./portalContext-BFTX5VVx.js";
7
+ import { w as F } from "./portalNavigation-DKCfwTH8.js";
8
+ import { A as X, p as Z } from "./AppTemplatePicker-CNJ6kIJk.js";
9
+ import { m as ee } from "./index-CIJWcl_6.js";
10
+ import { t as te } from "./templatePickerFlag-CosY_15R.js";
11
+ import { _ as A } from "./_plugin-vue_export-helper-CHgC5LLL.js";
12
+ import { _ as D } from "./StatusBadge.vue_vue_type_script_setup_true_lang-CMgQ0bd_.js";
13
+ const oe = {
14
+ key: 0,
15
+ role: "status"
16
+ }, ae = {
17
+ key: 1,
18
+ class: "portal-error",
19
+ role: "alert"
20
+ }, le = /* @__PURE__ */ $({
21
+ __name: "MobileProjectDialog",
22
+ props: {
23
+ businessId: {},
24
+ projectId: {},
25
+ initialName: {}
26
+ },
27
+ emits: ["saved", "close"],
28
+ setup(C, { emit: k }) {
29
+ const s = C, m = k, o = f(s.initialName ?? ""), u = f(null), v = f([]), r = !s.projectId && te(), d = f(r), n = f(!1), p = f(""), _ = ee();
30
+ async function x() {
31
+ var t, e;
32
+ d.value = !0, p.value = "";
33
+ try {
34
+ const i = await M(P.appTemplates());
35
+ v.value = i.templates, u.value = ((t = i.templates.find((y) => y.default)) == null ? void 0 : t.id) ?? ((e = i.templates[0]) == null ? void 0 : e.id) ?? null;
36
+ } catch (i) {
37
+ p.value = B(i);
38
+ } finally {
39
+ d.value = !1;
40
+ }
41
+ }
42
+ async function V() {
43
+ if (!(n.value || !o.value.trim() || o.value.trim().length > 120 || r && !u.value)) {
44
+ n.value = !0, p.value = "";
45
+ try {
46
+ const t = await M(s.projectId ? P.project(s.businessId, s.projectId) : P.projects(s.businessId), {
47
+ method: s.projectId ? "PATCH" : "POST",
48
+ body: JSON.stringify({ name: o.value.trim(), ...s.projectId ? {} : {
49
+ projectId: _,
50
+ kind: "mobile",
51
+ appTemplate: u.value,
52
+ country: Q()
53
+ } })
54
+ });
55
+ m("saved", t);
56
+ } catch (t) {
57
+ p.value = B(t);
58
+ } finally {
59
+ n.value = !1;
60
+ }
61
+ }
62
+ }
63
+ return q(() => {
64
+ r && x();
65
+ }), (t, e) => {
66
+ const i = w("FmTextField"), y = w("FmButton"), I = w("FmCard"), U = w("FmForm");
67
+ return l(), R(U, { onValidationSuccess: V }, {
68
+ default: L(() => [
69
+ g(I, { class: "project-dialog" }, {
70
+ default: L(() => [
71
+ c("h2", null, N(C.projectId ? "Rename project" : "New Mobile project"), 1),
72
+ g(i, {
73
+ modelValue: o.value,
74
+ "onUpdate:modelValue": e[0] || (e[0] = (j) => o.value = j),
75
+ label: "Project name",
76
+ placeholder: "e.g. Summer ordering",
77
+ disabled: n.value,
78
+ rules: [(j) => j.trim().length > 0 && j.trim().length <= 120 || "Enter a name up to 120 characters"]
79
+ }, null, 8, ["modelValue", "disabled", "rules"]),
80
+ h(r) ? (l(), b(O, { key: 0 }, [
81
+ d.value ? (l(), b("p", oe, "Loading templates…")) : (l(), R(X, {
82
+ key: 1,
83
+ templates: v.value,
84
+ modelValue: u.value,
85
+ "onUpdate:modelValue": e[1] || (e[1] = (j) => u.value = j),
86
+ disabled: n.value
87
+ }, null, 8, ["templates", "modelValue", "disabled"])),
88
+ e[3] || (e[3] = c("p", { class: "project-dialog__note" }, "Start a separate app from a template. Your live app stays as it is.", -1))
89
+ ], 64)) : S("", !0),
90
+ p.value ? (l(), b("p", ae, N(p.value), 1)) : S("", !0),
91
+ h(r) && !v.value.length && !d.value ? (l(), R(y, {
92
+ key: 2,
93
+ label: "Retry loading templates",
94
+ variant: "secondary",
95
+ onClick: x
96
+ })) : S("", !0),
97
+ c("footer", null, [
98
+ g(y, {
99
+ label: "Cancel",
100
+ variant: "tertiary",
101
+ disabled: n.value,
102
+ onClick: e[2] || (e[2] = (j) => m("close"))
103
+ }, null, 8, ["disabled"]),
104
+ g(y, {
105
+ label: C.projectId ? "Save" : "Create project",
106
+ type: "submit",
107
+ loading: n.value,
108
+ disabled: d.value || !o.value.trim() || o.value.trim().length > 120 || h(r) && !u.value
109
+ }, null, 8, ["label", "loading", "disabled"])
110
+ ])
111
+ ]),
112
+ _: 1
113
+ })
114
+ ]),
115
+ _: 1
116
+ });
117
+ };
118
+ }
119
+ }), se = /* @__PURE__ */ A(le, [["__scopeId", "data-v-bdfa4635"]]), re = { class: "portal-page" }, ne = { class: "portal-page-inner" }, ie = { class: "portal-page-heading" }, ue = {
120
+ key: 0,
121
+ class: "mobile-projects__count"
122
+ }, de = {
123
+ key: 0,
124
+ class: "portal-error",
125
+ role: "alert"
126
+ }, pe = {
127
+ key: 1,
128
+ role: "status"
129
+ }, ce = {
130
+ key: 2,
131
+ class: "portal-empty"
132
+ }, me = {
133
+ key: 3,
134
+ class: "rounded-2xl border border-portal-border-default bg-portal-bg-default",
135
+ "aria-label": "Mobile projects"
136
+ }, ve = /* @__PURE__ */ $({
137
+ __name: "MobileProjectsView",
138
+ setup(C) {
139
+ const { FmButton: k } = G, s = W(), m = H(), o = J(), u = K(), v = f([]), r = f(!0), d = f(""), n = new AbortController();
140
+ async function p() {
141
+ r.value = !0, d.value = "";
142
+ try {
143
+ const t = await M(P.projects(s.businessId.value), { signal: n.signal });
144
+ v.value = t.projects;
145
+ } catch (t) {
146
+ n.signal.aborted || (d.value = B(t));
147
+ } finally {
148
+ r.value = !1;
149
+ }
150
+ }
151
+ function _(t) {
152
+ u.open({
153
+ title: t ? "Rename project" : "New Mobile project",
154
+ dialogComponent: se,
155
+ dialogComponentProps: {
156
+ businessId: s.businessId.value,
157
+ projectId: t == null ? void 0 : t.projectId,
158
+ initialName: t == null ? void 0 : t.name,
159
+ onClose: () => u.close(),
160
+ onSaved: (e) => {
161
+ u.close(), t ? p() : o.push(F(e.projectId, "workspace", { ...m.query, setup: "1" }));
162
+ }
163
+ }
164
+ });
165
+ }
166
+ function x(t) {
167
+ return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(new Date(t));
168
+ }
169
+ const V = E(() => [
170
+ {
171
+ id: "project",
172
+ header: () => "Project",
173
+ cell: (t) => {
174
+ const e = t.row.original;
175
+ return a("div", { class: "flex min-w-0 flex-col gap-2" }, [
176
+ a("span", { class: "truncate fm-typo-en-body-md-600 text-portal-text-primary" }, e.name),
177
+ a(
178
+ "span",
179
+ { class: "fm-typo-en-body-sm-400 text-portal-text-muted", title: e.projectId },
180
+ `…${e.projectId.slice(-6)}`
181
+ )
182
+ ]);
183
+ }
184
+ },
185
+ {
186
+ id: "setup",
187
+ header: () => "Setup",
188
+ size: 130,
189
+ enableSorting: !1,
190
+ cell: (t) => a(
191
+ D,
192
+ { variant: t.row.original.provisioningStatus === "failed" ? "error" : "neutral", size: "sm" },
193
+ () => Z(t.row.original.provisioningStatus)
194
+ )
195
+ },
196
+ {
197
+ id: "live",
198
+ header: () => "Live",
199
+ size: 200,
200
+ enableSorting: !1,
201
+ cell: (t) => {
202
+ const e = t.row.original;
203
+ return a("div", { class: "flex flex-col items-start gap-2" }, [
204
+ a(
205
+ D,
206
+ { variant: e.isLive ? "success" : "neutral", size: "sm" },
207
+ () => e.isLive ? "Live project" : "Not live"
208
+ ),
209
+ a(
210
+ "span",
211
+ { class: "fm-typo-en-body-sm-400 text-portal-text-muted" },
212
+ e.hasUnpublishedRelease === void 0 ? "Release status unavailable" : e.hasUnpublishedRelease ? "Unpublished release available" : "No unpublished release"
213
+ )
214
+ ]);
215
+ }
216
+ },
217
+ {
218
+ id: "updatedAt",
219
+ header: () => "Last edited",
220
+ size: 170,
221
+ enableSorting: !1,
222
+ cell: (t) => a("span", { class: "fm-typo-en-body-sm-400 text-portal-text-muted" }, x(t.row.original.updatedAt))
223
+ },
224
+ {
225
+ id: "actions",
226
+ header: () => "",
227
+ size: 340,
228
+ enableSorting: !1,
229
+ cell: (t) => {
230
+ const e = t.row.original;
231
+ return a("div", { class: "flex flex-wrap items-center justify-end gap-4" }, [
232
+ e.provisioningStatus === "ready" ? a(k, {
233
+ icon: "deployed_code",
234
+ variant: "tertiary",
235
+ title: "View releases",
236
+ onClick: T(
237
+ () => o.push(F(e.projectId, "releases", m.query)),
238
+ ["stop"]
239
+ )
240
+ }) : null,
241
+ a(k, {
242
+ label: "Rename",
243
+ variant: "tertiary",
244
+ onClick: T(() => _(e), ["stop"])
245
+ }),
246
+ a(k, {
247
+ label: e.provisioningStatus === "ready" ? "Open editor" : "Continue setup",
248
+ variant: "secondary",
249
+ onClick: T(
250
+ () => o.push(F(e.projectId, "workspace", m.query)),
251
+ ["stop"]
252
+ )
253
+ })
254
+ ]);
255
+ }
256
+ }
257
+ ]);
258
+ return q(() => {
259
+ if (p(), m.query.create === "1") {
260
+ const { create: t, ...e } = m.query;
261
+ o.replace({ query: e }), _();
262
+ }
263
+ }), Y(() => n.abort()), (t, e) => {
264
+ const i = w("FmButton"), y = w("FmTable");
265
+ return l(), b("div", re, [
266
+ c("div", ne, [
267
+ c("header", ie, [
268
+ c("div", null, [
269
+ e[4] || (e[4] = c("p", { class: "portal-eyebrow" }, "Mobile Ordering", -1)),
270
+ c("h1", null, [
271
+ e[3] || (e[3] = z("Projects ", -1)),
272
+ r.value ? S("", !0) : (l(), b("span", ue, N(v.value.length), 1))
273
+ ])
274
+ ]),
275
+ g(i, {
276
+ label: "New project",
277
+ icon: "add",
278
+ onClick: e[0] || (e[0] = (I) => _())
279
+ })
280
+ ]),
281
+ d.value ? (l(), b("p", de, [
282
+ z(N(d.value) + " ", 1),
283
+ g(i, {
284
+ label: "Retry",
285
+ variant: "tertiary",
286
+ onClick: p
287
+ })
288
+ ])) : r.value ? (l(), b("p", pe, "Loading projects…")) : v.value.length ? (l(), b("section", me, [
289
+ g(y, {
290
+ "column-defs": V.value,
291
+ "row-data": v.value,
292
+ "page-size": v.value.length,
293
+ "hide-footer": "",
294
+ "pin-header-row": "",
295
+ onRowClick: e[2] || (e[2] = (I) => h(o).push(h(F)(I.original.projectId, "workspace", h(m).query)))
296
+ }, null, 8, ["column-defs", "row-data", "page-size"])
297
+ ])) : (l(), b("section", ce, [
298
+ e[5] || (e[5] = c("h2", null, "Your first Mobile project", -1)),
299
+ e[6] || (e[6] = c("p", null, "Create an app from a template to start editing.", -1)),
300
+ g(i, {
301
+ label: "New project",
302
+ icon: "add",
303
+ onClick: e[1] || (e[1] = (I) => _())
304
+ })
305
+ ]))
306
+ ])
307
+ ]);
308
+ };
309
+ }
310
+ }), Fe = /* @__PURE__ */ A(ve, [["__scopeId", "data-v-654073ab"]]);
311
+ export {
312
+ Fe as default
313
+ };
@@ -0,0 +1,48 @@
1
+ import { a as o } from "./routes-D6BQSP4i.js";
2
+ import { ref as i } from "vue";
3
+ import { c as u } from "./controlPlane-sXaC6pAh.js";
4
+ function s(t, e) {
5
+ if (typeof window > "u") return e;
6
+ try {
7
+ const n = window.localStorage.getItem(t);
8
+ return n === null ? e : n === "1";
9
+ } catch {
10
+ return e;
11
+ }
12
+ }
13
+ function l(t, e) {
14
+ if (typeof window > "u") return e;
15
+ try {
16
+ const n = Number(window.localStorage.getItem(t));
17
+ return Number.isFinite(n) ? n : e;
18
+ } catch {
19
+ return e;
20
+ }
21
+ }
22
+ function a(t, e) {
23
+ if (!(typeof window > "u"))
24
+ try {
25
+ window.localStorage.setItem(t, e);
26
+ } catch {
27
+ }
28
+ }
29
+ function w(t, e) {
30
+ a(t, e ? "1" : "0");
31
+ }
32
+ let r = null;
33
+ function d() {
34
+ return r || (r = u(o.adminWhoami()).then((t) => t.isAdmin).catch(() => !1)), r;
35
+ }
36
+ function h() {
37
+ const t = i(!1);
38
+ return d().then((e) => {
39
+ t.value = e;
40
+ }), t;
41
+ }
42
+ export {
43
+ l as a,
44
+ a as b,
45
+ s as r,
46
+ h as u,
47
+ w
48
+ };
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-BruZHfdq.js")
7
+ component: () => import("./MobileProjectsView-C5wIOuCu.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-l_gDDBtb.js")
24
+ component: () => import("./ControlPlaneView-DsXDkx9a.js")
25
25
  },
26
26
  {
27
27
  path: "/brand-kit",
@@ -78,7 +78,7 @@ const o = [
78
78
  path: "/:pathMatch(.*)*",
79
79
  redirect: (e) => ({ name: "miniprogram-v2-ecosystem", query: e.query, params: {} })
80
80
  }
81
- ], r = {}, a = t(() => import("./App-BdvPLQMC.js")), i = t(() => import("./LegacyWorkspaceEntry-lEMtmdIe.js"));
81
+ ], r = {}, a = t(() => import("./App-Ifw6j-OX.js")), i = t(() => import("./LegacyWorkspaceEntry-lEMtmdIe.js"));
82
82
  export {
83
83
  a as FmApp,
84
84
  i as MiniprogramWorkspace,
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-miniprogram-v2",
3
- "version": "0.2.2-dev.21",
3
+ "version": "0.2.2-dev.22",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",