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