@feedmepos/mf-miniprogram-v2 0.2.2-dev.10 → 0.2.2-dev.12

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,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-Boz_WlNM.js";
2
+ import { a as w } from "./routes-DXQSkGM7.js";
3
3
  import { c as M, e as y, m as $ } from "./controlPlane-CoEgf9BA.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.10",
3
+ "version": "0.2.2-dev.12",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -1,279 +0,0 @@
1
- import { defineComponent as D, ref as b, onMounted as L, resolveComponent as I, openBlock as r, createBlock as N, withCtx as h, createVNode as s, createElementVNode as n, toDisplayString as g, createElementBlock as d, Fragment as B, createCommentVNode as F, onScopeDispose as A, createTextVNode as M, renderList as U, unref as y } from "vue";
2
- import { useRoute as O, useRouter as E } from "vue-router";
3
- import { useDialog as Y } from "@feedmepos/ui-library";
4
- import { a as $ } from "./routes-Boz_WlNM.js";
5
- import { c as R, e as T, a as z } from "./controlPlane-CoEgf9BA.js";
6
- import { u as H } from "./portalContext-C4HL_0kl.js";
7
- import { w as P } from "./portalNavigation-DOF4Ah49.js";
8
- import { m as J } from "./index-D5qXvcfE.js";
9
- import { A as G } from "./AppTemplatePicker-C0lZyhK2.js";
10
- import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
11
- import { _ as K } 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__ */ D({
20
- __name: "MobileProjectDialog",
21
- props: {
22
- businessId: {},
23
- projectId: {},
24
- initialName: {}
25
- },
26
- emits: ["saved", "close"],
27
- setup(k, { emit: S }) {
28
- const a = k, C = S, i = b(a.initialName ?? ""), u = b(null), f = b([]), p = b(!a.projectId), c = b(!1), m = b(""), w = J();
29
- async function V() {
30
- var e, l;
31
- p.value = !0, m.value = "";
32
- try {
33
- const _ = await R($.appTemplates());
34
- f.value = _.templates, u.value = ((e = _.templates.find((j) => j.default)) == null ? void 0 : e.id) ?? ((l = _.templates[0]) == null ? void 0 : l.id) ?? null;
35
- } catch (_) {
36
- m.value = T(_);
37
- } finally {
38
- p.value = !1;
39
- }
40
- }
41
- async function o() {
42
- if (!(c.value || !i.value.trim() || i.value.trim().length > 120 || !a.projectId && !u.value)) {
43
- c.value = !0, m.value = "";
44
- try {
45
- const e = await R(a.projectId ? $.project(a.businessId, a.projectId) : $.projects(a.businessId), {
46
- method: a.projectId ? "PATCH" : "POST",
47
- body: JSON.stringify({ name: i.value.trim(), ...a.projectId ? {} : {
48
- projectId: w,
49
- kind: "mobile",
50
- appTemplate: u.value,
51
- country: z()
52
- } })
53
- });
54
- C("saved", e);
55
- } catch (e) {
56
- m.value = T(e);
57
- } finally {
58
- c.value = !1;
59
- }
60
- }
61
- }
62
- return L(() => {
63
- a.projectId || V();
64
- }), (e, l) => {
65
- const _ = I("FmTextField"), j = I("FmButton"), x = I("FmCard"), t = I("FmForm");
66
- return r(), N(t, { onValidationSuccess: o }, {
67
- default: h(() => [
68
- s(x, { class: "project-dialog" }, {
69
- default: h(() => [
70
- n("h2", null, g(k.projectId ? "Rename project" : "New Mobile project"), 1),
71
- s(_, {
72
- modelValue: i.value,
73
- "onUpdate:modelValue": l[0] || (l[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 ? F("", !0) : (r(), d(B, { key: 0 }, [
80
- p.value ? (r(), d("p", Q, "Loading templates…")) : (r(), N(G, {
81
- key: 1,
82
- templates: f.value,
83
- modelValue: u.value,
84
- "onUpdate:modelValue": l[1] || (l[1] = (v) => u.value = v),
85
- disabled: c.value
86
- }, null, 8, ["templates", "modelValue", "disabled"])),
87
- l[3] || (l[3] = n("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 ? (r(), d("p", W, g(m.value), 1)) : F("", !0),
90
- !k.projectId && !f.value.length && !p.value ? (r(), N(j, {
91
- key: 2,
92
- label: "Retry loading templates",
93
- variant: "secondary",
94
- onClick: V
95
- })) : F("", !0),
96
- n("footer", null, [
97
- s(j, {
98
- label: "Cancel",
99
- variant: "tertiary",
100
- disabled: c.value,
101
- onClick: l[2] || (l[2] = (v) => C("close"))
102
- }, null, 8, ["disabled"]),
103
- s(j, {
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
- }, ne = {
126
- key: 1,
127
- role: "status"
128
- }, re = {
129
- key: 2,
130
- class: "portal-empty"
131
- }, se = {
132
- key: 3,
133
- class: "mobile-projects__list",
134
- "aria-label": "Mobile projects"
135
- }, ie = { class: "mobile-projects__name" }, ue = ["title"], ce = ["datetime"], de = { class: "mobile-projects__actions" }, pe = { class: "w-[200px] py-4" }, me = /* @__PURE__ */ D({
136
- __name: "MobileProjectsView",
137
- setup(k) {
138
- const S = H(), a = O(), C = E(), i = Y(), u = b([]), f = b(!0), p = b(""), c = new AbortController();
139
- async function m() {
140
- f.value = !0, p.value = "";
141
- try {
142
- const o = await R($.projects(S.businessId.value), { signal: c.signal });
143
- u.value = o.projects;
144
- } catch (o) {
145
- c.signal.aborted || (p.value = T(o));
146
- } finally {
147
- f.value = !1;
148
- }
149
- }
150
- function w(o) {
151
- i.open({
152
- title: o ? "Rename project" : "New Mobile project",
153
- dialogComponent: Z,
154
- dialogComponentProps: {
155
- businessId: S.businessId.value,
156
- projectId: o == null ? void 0 : o.projectId,
157
- initialName: o == null ? void 0 : o.name,
158
- onClose: () => i.close(),
159
- onSaved: (e) => {
160
- i.close(), o ? m() : C.push(P(e.projectId, "workspace", { ...a.query, setup: "1" }));
161
- }
162
- }
163
- });
164
- }
165
- function V(o) {
166
- return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(new Date(o));
167
- }
168
- return L(() => {
169
- if (m(), a.query.create === "1") {
170
- const { create: o, ...e } = a.query;
171
- C.replace({ query: e }), w();
172
- }
173
- }), A(() => c.abort()), (o, e) => {
174
- const l = I("FmButton"), _ = I("RouterLink"), j = I("FmMenuItem"), x = I("FmMenu");
175
- return r(), d("div", ee, [
176
- n("div", te, [
177
- n("header", oe, [
178
- n("div", null, [
179
- e[3] || (e[3] = n("p", { class: "portal-eyebrow" }, "Mobile Ordering", -1)),
180
- n("h1", null, [
181
- e[2] || (e[2] = M("Projects ", -1)),
182
- f.value ? F("", !0) : (r(), d("span", ae, g(u.value.length), 1))
183
- ])
184
- ]),
185
- s(l, {
186
- label: "New project",
187
- icon: "add",
188
- onClick: e[0] || (e[0] = (t) => w())
189
- })
190
- ]),
191
- p.value ? (r(), d("p", le, [
192
- M(g(p.value) + " ", 1),
193
- s(l, {
194
- label: "Retry",
195
- variant: "tertiary",
196
- onClick: m
197
- })
198
- ])) : f.value ? (r(), d("p", ne, "Loading projects…")) : u.value.length ? (r(), d("section", se, [
199
- (r(!0), d(B, null, U(u.value, (t) => (r(), d("article", {
200
- key: t.projectId,
201
- class: "mobile-projects__row"
202
- }, [
203
- n("div", ie, [
204
- s(_, {
205
- to: y(P)(t.projectId, "workspace", y(a).query)
206
- }, {
207
- default: h(() => [
208
- M(g(t.name), 1)
209
- ]),
210
- _: 2
211
- }, 1032, ["to"]),
212
- n("span", {
213
- title: t.projectId
214
- }, "…" + g(t.projectId.slice(-6)), 9, ue)
215
- ]),
216
- s(K, {
217
- variant: t.isLive ? "success" : t.provisioningStatus === "failed" ? "error" : "neutral"
218
- }, {
219
- default: h(() => [
220
- M(g(t.isLive ? "Live" : t.provisioningStatus === "ready" ? "Draft" : t.provisioningStatus === "failed" ? "Setup failed" : t.provisioningStatus === "provisioning" ? "Setting up" : "Not set up"), 1)
221
- ]),
222
- _: 2
223
- }, 1032, ["variant"]),
224
- n("time", {
225
- datetime: t.updatedAt
226
- }, g(V(t.updatedAt)), 9, ce),
227
- n("div", de, [
228
- s(l, {
229
- label: t.provisioningStatus === "ready" ? "Open editor" : "Continue setup",
230
- variant: "secondary",
231
- onClick: (v) => y(C).push(y(P)(t.projectId, "workspace", y(a).query))
232
- }, null, 8, ["label", "onClick"]),
233
- s(x, {
234
- placement: "bottom-end",
235
- "close-on-click": ""
236
- }, {
237
- "menu-button": h(() => [
238
- s(l, {
239
- icon: "more_horiz",
240
- variant: "tertiary",
241
- "aria-label": `Actions for ${t.name}`
242
- }, null, 8, ["aria-label"])
243
- ]),
244
- default: h(() => [
245
- n("div", pe, [
246
- s(j, {
247
- label: "Rename project",
248
- icon: "edit",
249
- "onUpdate:modelValue": (v) => w(t)
250
- }, null, 8, ["onUpdate:modelValue"]),
251
- t.provisioningStatus === "ready" ? (r(), N(j, {
252
- key: 0,
253
- label: "View releases",
254
- icon: "deployed_code",
255
- "onUpdate:modelValue": (v) => y(C).push(y(P)(t.projectId, "releases", y(a).query))
256
- }, null, 8, ["onUpdate:modelValue"])) : F("", !0)
257
- ])
258
- ]),
259
- _: 2
260
- }, 1024)
261
- ])
262
- ]))), 128))
263
- ])) : (r(), d("section", re, [
264
- e[4] || (e[4] = n("h2", null, "Your first Mobile project", -1)),
265
- e[5] || (e[5] = n("p", null, "Create an app from a template to start editing.", -1)),
266
- s(l, {
267
- label: "New project",
268
- icon: "add",
269
- onClick: e[1] || (e[1] = (t) => w())
270
- })
271
- ]))
272
- ])
273
- ]);
274
- };
275
- }
276
- }), he = /* @__PURE__ */ q(me, [["__scopeId", "data-v-7f9be5bc"]]);
277
- export {
278
- he as default
279
- };
@@ -1,54 +0,0 @@
1
- const t = (e, s) => `/api/businesses/${e}/projects/${s}`, i = {
2
- projects: (e) => `/api/businesses/${e}/projects`,
3
- portalContext: (e) => `/api/businesses/${e}/portal-context`,
4
- project: (e, s) => t(e, s),
5
- provision: (e, s) => `${t(e, s)}/provision`,
6
- refreshSlug: (e, s) => `${t(e, s)}/refresh-slug`,
7
- sessions: (e, s) => `${t(e, s)}/sessions`,
8
- session: (e, s, r) => `${t(e, s)}/sessions/${r}`,
9
- messages: (e, s, r) => `${i.session(e, s, r)}/messages`,
10
- startStatus: (e, s, r) => `${i.session(e, s, r)}/start-status`,
11
- changes: (e, s, r, o = !1) => `${i.session(e, s, r)}/changes${o ? "?refresh=1" : ""}`,
12
- checkpoints: (e, s, r) => `${i.session(e, s, r)}/checkpoints`,
13
- aiBillingPreflight: (e, s, r) => `${i.session(e, s, r)}/ai-billing/preflight`,
14
- restoreCheckpoint: (e, s, r, o) => `${i.checkpoints(e, s, r)}/${o}/restore`,
15
- previewBridgeTicket: (e, s, r) => `${i.session(e, s, r)}/preview-bridge/ticket`,
16
- previewBridgeSocket: (e, s, r) => `${i.session(e, s, r)}/preview-bridge/socket`,
17
- uploads: (e, s, r, o = "") => `${i.session(e, s, r)}/uploads${o ? `?${o}` : ""}`,
18
- archive: (e, s, r) => `${i.session(e, s, r)}/archive`,
19
- commit: (e, s, r) => `${i.session(e, s, r)}/commit`,
20
- resume: (e, s, r) => `${i.session(e, s, r)}/resume`,
21
- restartPreview: (e, s, r) => `${i.session(e, s, r)}/restart-preview`,
22
- fork: (e, s, r) => `${i.session(e, s, r)}/fork`,
23
- flushEvents: (e, s, r) => `${i.session(e, s, r)}/events/flush`,
24
- revertTurn: (e, s, r) => `${i.session(e, s, r)}/turns/revert`,
25
- unrevertTurn: (e, s, r) => `${i.session(e, s, r)}/turns/unrevert`,
26
- releases: (e, s) => `${t(e, s)}/releases`,
27
- publishRelease: (e, s, r) => `${i.releases(e, s)}/${r}/publish`,
28
- releasePreviewUrl: (e, s, r) => `${i.releases(e, s)}/${r}/preview-url`,
29
- rollbackToRelease: (e, s, r) => `${t(e, s)}/rollback-to-release/${r}`,
30
- rollbackToV1: (e, s) => `${t(e, s)}/rollback-to-v1`,
31
- start: (e, s, r) => {
32
- const o = new URLSearchParams();
33
- e && o.set("businessId", e), s && o.set("projectId", s), r && o.set("sessionId", r);
34
- const a = o.toString();
35
- return `/api/start${a ? `?${a}` : ""}`;
36
- },
37
- opencode: (e = "") => `/api/opencode${e ? `/${e.replace(/^\/+/, "")}` : ""}`,
38
- /** The shared component library's catalog. Deliberately not under a
39
- * business/project path: the library belongs to no business, and the
40
- * module centre is not inside a workspace. */
41
- componentLibraryCatalog: () => "/api/component-library/catalog",
42
- /** The self-contained preview document the module centre frames. Fetched with
43
- * the portal's bearer and assigned to an iframe's `srcdoc`, never used as an
44
- * `<iframe src>` — a navigation request carries no Authorization header,
45
- * which is what a signed URL would otherwise exist to work around. */
46
- componentLibraryPreview: () => "/api/component-library/preview",
47
- /** The application templates this environment can provision, for the portal's
48
- * picker. Not under a business/project path: the answer is a property of
49
- * the environment, and it is needed BEFORE a project exists. */
50
- appTemplates: () => "/api/app-templates"
51
- };
52
- export {
53
- i as a
54
- };