@feedmepos/mf-miniprogram-v2 0.2.2-dev.13 → 0.2.2-dev.15

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 Y, ref as r, computed as D, 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 J, createElementBlock as p, onMounted as oe, onScopeDispose as ne, createTextVNode as k, Fragment as K, renderList as se } from "vue";
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 E } from "./controlPlane-CoEgf9BA.js";
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 Q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
- const de = ["qsr", "coffee", "tea"], W = [
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__ */ Y({
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, U, L, R, O, z, M, j;
43
- const i = x, C = g, m = r(((B = i.choice) == null ? void 0 : B.id) ?? ""), v = r(((U = i.choice) == null ? void 0 : U.appTemplateId) ?? ((L = W[0]) == null ? void 0 : L.id) ?? ""), b = r(((R = i.choice) == null ? void 0 : R.restaurantStyle) ?? "qsr"), f = r(((O = i.choice) == null ? void 0 : O.label) ?? ""), y = r(((z = i.choice) == null ? void 0 : z.description) ?? ""), T = r((((M = i.choice) == null ? void 0 : M.industries) ?? []).join(", ")), V = r(((j = i.choice) == null ? void 0 : j.default) ?? !1), e = r(!1), u = r(""), l = D(() => !!i.choice), t = W.map((_) => ({ label: _.label, value: _.id })), w = D(() => v.value === "miniprogram-vue-v2"), X = de.map((_) => ({ label: _, value: _ })), N = D(
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 Z() {
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: v.value,
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: b.value } : {}
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 = E(a);
66
+ u.value = $(a);
65
67
  } finally {
66
68
  e.value = !1;
67
69
  }
68
70
  }
69
- return (_, a) => {
70
- const $ = h("FmTextField"), q = h("FmSelect"), ee = h("FmTextarea"), te = h("FmSwitch"), G = h("FmButton"), ae = h("FmCard"), le = h("FmForm");
71
- return n(), S(le, { onValidationSuccess: Z }, {
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(ae, { class: "template-choice-dialog" }, {
75
+ d(te, { class: "template-choice-dialog" }, {
74
76
  default: I(() => {
75
- var H;
77
+ var G;
76
78
  return [
77
- s("h2", null, c(l.value ? `Edit ${(H = x.choice) == null ? void 0 : H.label}` : "New template choice"), 1),
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(q, {
89
- modelValue: v.value,
90
- "onUpdate:modelValue": a[1] || (a[1] = (o) => v.value = 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: J(t),
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(q, {
97
+ w.value ? (n(), S(j, {
96
98
  key: 1,
97
- modelValue: b.value,
98
- "onUpdate:modelValue": a[2] || (a[2] = (o) => b.value = 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: J(X),
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(ee, {
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(te, {
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(), p("p", ue, c(u.value), 1)) : F("", !0),
134
+ u.value ? (n(), v("p", ue, c(u.value), 1)) : F("", !0),
133
135
  s("footer", null, [
134
- d(G, {
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(G, {
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__ */ Q(ce, [["__scopeId", "data-v-2b30dcea"]]), pe = { class: "portal-page" }, ve = { class: "portal-page-inner" }, be = { class: "portal-page-heading" }, _e = {
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__ */ Y({
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(""), v = new AbortController();
171
- async function b() {
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: v.signal
177
+ signal: b.signal
176
178
  });
177
179
  i.value = e.choices;
178
180
  } catch (e) {
179
- v.signal.aborted || (m.value = E(e));
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(), b();
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 b();
204
+ ), await _();
203
205
  } catch (l) {
204
- m.value = E(l);
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 b()), ne(() => v.abort()), (e, u) => {
220
+ return oe(() => void _()), ne(() => b.abort()), (e, u) => {
219
221
  const l = h("FmButton");
220
- return n(), p("div", pe, [
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(), p("p", _e, [
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: b
240
+ onClick: _
239
241
  })
240
- ])) : C.value ? (n(), p("p", he, "Loading template choices…")) : (n(), p("section", fe, [
241
- (n(!0), p(K, null, se(i.value, (t) => (n(), p("article", {
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(), p("span", Ce, " · Default")) : F("", !0)
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(), p(K, { key: 0 }, [
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__ */ Q(Se, [["__scopeId", "data-v-da7cd846"]]);
296
+ }), Pe = /* @__PURE__ */ Y(Se, [["__scopeId", "data-v-da7cd846"]]);
295
297
  export {
296
298
  Pe as default
297
299
  };
package/dist/app.js CHANGED
@@ -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-C7Eg9mU3.js")
24
+ component: () => import("./ControlPlaneView-Dz7nThOH.js")
25
25
  },
26
26
  {
27
27
  path: "/brand-kit",
@@ -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-BjA03jMI.js")
73
+ component: () => import("./TemplateCenterView-B_Yvaeza.js")
74
74
  },
75
75
  {
76
76
  path: "/:pathMatch(.*)*",
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-miniprogram-v2",
3
- "version": "0.2.2-dev.13",
3
+ "version": "0.2.2-dev.15",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",