@feedmepos/mf-miniprogram-v2 0.2.10 → 0.2.11-dev.2

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.
Files changed (30) hide show
  1. package/dist/App-B0BXsVum.js +235 -0
  2. package/dist/{BrandFontPicker-BVfiQBLP.js → BrandFontPicker-D_MntcD2.js} +1 -1
  3. package/dist/{BrandKitView-BLH-bglF.js → BrandKitView-DHV0PUus.js} +2 -2
  4. package/dist/{ControlPlaneView-C3wvdkj9.js → ControlPlaneView-CPGMj9dc.js} +8269 -8167
  5. package/dist/{EcosystemView-BY2B_LEL.js → EcosystemView-Blo9u-dq.js} +5 -5
  6. package/dist/{LegacyWorkspaceEntry-DrL-C0xx.js → LegacyWorkspaceEntry-IRMa-8U4.js} +2 -2
  7. package/dist/{MobileProjectDialog-DsXmMUHH.js → MobileProjectDialog-QfVNJfyE.js} +2 -2
  8. package/dist/{MobileProjectsView-CMj0mnZh.js → MobileProjectsView-DVjw5R18.js} +4 -4
  9. package/dist/{ModuleCenterView-DG7ea0p5.js → ModuleCenterView-D_5TWuln.js} +1 -1
  10. package/dist/{ModuleDetailView-DweKadjB.js → ModuleDetailView-U8M_-5qs.js} +1 -1
  11. package/dist/{PagesView-W8d-G5HZ.js → PagesView-Bz5aN_A-.js} +1 -1
  12. package/dist/PortalSettingsView-C-5ahh8D.js +1847 -0
  13. package/dist/{TemplateCenterView-BH3C5h50.js → TemplateCenterView-Bd5haOtu.js} +2 -2
  14. package/dist/{WorkspaceEntryView-Dx8stquZ.js → WorkspaceEntryView-V-Tu9Iiy.js} +1 -1
  15. package/dist/app.js +11 -11
  16. package/dist/controlPlane-Bn-uDXG_.js +145 -0
  17. package/dist/index-DB33ug2V.js +125 -0
  18. package/dist/localPreference-CaizsY6G.js +972 -0
  19. package/dist/package.json +2 -1
  20. package/dist/{portalContext-CCW6O5KF.js → portalContext-FZ8_SePb.js} +2 -2
  21. package/dist/style.css +1 -1
  22. package/dist/useBrandKit-Dl8N-9UZ.js +1110 -0
  23. package/dist/{useModuleCatalog-C7kO_Rjg.js → useModuleCatalog-CNvI4aSK.js} +2 -2
  24. package/package.json +2 -1
  25. package/dist/App-DDgjAONU.js +0 -1129
  26. package/dist/PortalSettingsView-DFsXYy48.js +0 -123
  27. package/dist/controlPlane-CiuLVd7s.js +0 -145
  28. package/dist/index-BnE-gQP_.js +0 -81
  29. package/dist/localPreference-Cdti49bE.js +0 -62
  30. package/dist/useBrandKit-fmzepsFY.js +0 -1096
@@ -1,123 +0,0 @@
1
- import { defineComponent as k, computed as p, ref as l, onMounted as P, onScopeDispose as S, resolveComponent as x, openBlock as o, createElementBlock as n, createElementVNode as s, toDisplayString as d, createCommentVNode as h, Fragment as I, createVNode as A, unref as M } from "vue";
2
- import { useRoute as N } from "vue-router";
3
- import { e as _, f as $ } from "./index-BnE-gQP_.js";
4
- import { j as B, e as E } from "./controlPlane-CiuLVd7s.js";
5
- import { useCoreStore as F } from "@feedmepos/mf-common";
6
- import { u as U } from "./portalContext-CCW6O5KF.js";
7
- import { l as V } from "./portalNavigation-DLcC7Koh.js";
8
- import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
9
- const L = { class: "portal-page" }, R = { class: "portal-page-inner settings-page" }, T = { class: "portal-page-heading" }, j = ["href"], D = {
10
- key: 0,
11
- class: "portal-error",
12
- role: "alert"
13
- }, H = { class: "portal-section" }, O = { class: "settings-value" }, z = { class: "portal-section" }, K = { class: "settings-icon-row" }, Y = { class: "settings-icon" }, G = ["src"], J = { class: "portal-section" }, Q = { class: "settings-logo" }, W = ["src"], X = /* @__PURE__ */ k({
14
- __name: "PortalSettingsView",
15
- setup(Z) {
16
- const a = U(), y = N(), c = F(), w = p(
17
- () => {
18
- var t;
19
- return new URL(
20
- V({
21
- ...y.query,
22
- businessId: a.businessId.value,
23
- country: c.currentCountry.value ?? null,
24
- restaurantId: ((t = c.currentRestaurant.value) == null ? void 0 : t._id) ?? null
25
- }),
26
- _("fmmf:prod") === "dev" ? "https://portal.feedmedev.cc" : "https://portal.feedme.cc"
27
- ).href;
28
- }
29
- ), m = l(null), g = l(!0), r = l(null), v = l(!1), f = $(_("fmmf:prod")).apiOrigin, C = p(() => `${f}/metadata/${a.businessId.value}/pwa-512x512.png`), b = p(() => {
30
- var t;
31
- return (t = B()) == null ? void 0 : t.thumbnail;
32
- }), i = new AbortController();
33
- return P(async () => {
34
- var t;
35
- try {
36
- const e = await fetch(`${f}/metadata/${a.businessId.value}/config`, {
37
- signal: AbortSignal.any([i.signal, AbortSignal.timeout(15e3)])
38
- });
39
- if (e.status === 404) return;
40
- if (!e.ok) throw new Error(`Could not load app assets (HTTP ${e.status})`);
41
- const u = await e.json();
42
- m.value = ((t = u.pwaConfig) == null ? void 0 : t.name) ?? null;
43
- } catch (e) {
44
- i.signal.aborted || (r.value = E(e));
45
- } finally {
46
- g.value = !1;
47
- }
48
- }), S(() => i.abort()), (t, e) => {
49
- const u = x("FmIcon");
50
- return o(), n("div", L, [
51
- s("div", R, [
52
- s("header", T, [
53
- e[1] || (e[1] = s("div", null, [
54
- s("p", { class: "portal-eyebrow" }, "Your app identity"),
55
- s("h1", null, "Settings")
56
- ], -1)),
57
- s("a", {
58
- href: w.value,
59
- class: "portal-link-button",
60
- target: "_blank",
61
- rel: "noopener"
62
- }, "Manage assets in original Portal ↗", 8, j)
63
- ]),
64
- e[10] || (e[10] = s("div", { class: "settings-tabs" }, [
65
- s("span", null, "Assets")
66
- ], -1)),
67
- e[11] || (e[11] = s("p", { class: "portal-notice" }, " App assets are still managed by the original Mini Program. Edit them there to preserve existing subscription rules and shared business settings. ", -1)),
68
- r.value ? (o(), n("p", D, d(r.value), 1)) : h("", !0),
69
- s("section", H, [
70
- e[2] || (e[2] = s("h2", null, "App name", -1)),
71
- e[3] || (e[3] = s("p", { class: "portal-description" }, "Shown under the icon on your customer’s home screen.", -1)),
72
- s("p", O, d(g.value ? "Loading…" : r.value ? "Unavailable" : m.value || "Not configured"), 1),
73
- e[4] || (e[4] = s("p", { class: "portal-description" }, " The original Portal applies the “FeedMe x” naming rule for non-Premium businesses. ", -1))
74
- ]),
75
- s("section", z, [
76
- e[7] || (e[7] = s("div", { class: "portal-section-head" }, [
77
- s("div", null, [
78
- s("h2", null, "App icon"),
79
- s("p", { class: "portal-description" }, "One square image for the home screen.")
80
- ])
81
- ], -1)),
82
- s("div", K, [
83
- s("div", Y, [
84
- v.value ? (o(), n(I, { key: 1 }, [
85
- A(u, {
86
- name: "image",
87
- size: "xl"
88
- }),
89
- e[5] || (e[5] = s("span", null, "No icon available", -1))
90
- ], 64)) : (o(), n("img", {
91
- key: 0,
92
- src: C.value,
93
- alt: "Current app icon",
94
- onError: e[0] || (e[0] = (ee) => v.value = !0)
95
- }, null, 40, G))
96
- ]),
97
- e[6] || (e[6] = s("div", null, [
98
- s("h3", null, "Icon guidelines"),
99
- s("p", { class: "portal-description" }, " Use a square image, ideally at least 1024 × 1024 pixels. Keep the important artwork inside the central 4/5 safe area. "),
100
- s("p", { class: "portal-description" }, "Changes to this shared icon are not part of a release build.")
101
- ], -1))
102
- ])
103
- ]),
104
- s("section", J, [
105
- e[8] || (e[8] = s("h2", null, "Business branding", -1)),
106
- s("div", Q, [
107
- b.value ? (o(), n("img", {
108
- key: 0,
109
- src: b.value,
110
- alt: "Business logo"
111
- }, null, 8, W)) : h("", !0),
112
- s("p", null, d(M(a).businessName.value), 1)
113
- ]),
114
- e[9] || (e[9] = s("p", { class: "portal-description" }, " Cover images and other shared business assets remain available in the original Portal. ", -1))
115
- ])
116
- ])
117
- ]);
118
- };
119
- }
120
- }), ue = /* @__PURE__ */ q(X, [["__scopeId", "data-v-6c0e4447"]]);
121
- export {
122
- ue as default
123
- };
@@ -1,145 +0,0 @@
1
- import { f, e as d, D as p } from "./index-BnE-gQP_.js";
2
- import { useCoreStore as a, FeedMeAuth as m } from "@feedmepos/mf-common";
3
- const h = [
4
- "AE",
5
- "AU",
6
- "BN",
7
- "GB",
8
- "ID",
9
- "JP",
10
- "MA",
11
- "MO",
12
- "MV",
13
- "MY",
14
- "PK",
15
- "SG",
16
- "TH",
17
- "VN"
18
- ];
19
- function w(e) {
20
- return typeof e == "string" && h.includes(e);
21
- }
22
- function g(e) {
23
- if (typeof e != "string") return null;
24
- const n = e.trim().toUpperCase();
25
- return w(n) ? n : null;
26
- }
27
- function U(e, n) {
28
- const t = n === "MY" ? "" : `.${n.toLowerCase()}`, r = e === "dev" ? "-dev" : "", o = e === "dev" ? "https://portal.feedmedev.cc" : "https://portal.feedme.cc", s = e === "dev" ? "https://license.feedmedev.cc" : "https://license.feedme.cc";
29
- return {
30
- country: n,
31
- portalApiBaseUrl: `https://portal-v2${r}${t}.feedmeapi.com`,
32
- licenseApiBaseUrl: `https://license-v2${r}${t}.feedmeapi.com/api`,
33
- purchaseUrl: `${o}/purchase`,
34
- aiTokenPurchaseUrl: `${s}/purchase`,
35
- usageUrl: `${s}/token`
36
- };
37
- }
38
- function k(e, n, t) {
39
- const r = new URL(U(e, n).usageUrl);
40
- return r.searchParams.set("businessId", t), r.searchParams.set("country", n), r.toString();
41
- }
42
- function B(e) {
43
- return e.replace(/\/+$/, "");
44
- }
45
- function y() {
46
- return B("https://miniprogram-v2-api.feedme.vip");
47
- }
48
- function v(e) {
49
- const n = y();
50
- return n ? `${n}${e.startsWith("/") ? e : `/${e}`}` : e;
51
- }
52
- function i() {
53
- return a().currentBusiness.value;
54
- }
55
- function u() {
56
- var e;
57
- return ((e = i()) == null ? void 0 : e._id) ?? p;
58
- }
59
- function C() {
60
- var e;
61
- return ((e = i()) == null ? void 0 : e.url) ?? void 0;
62
- }
63
- function D() {
64
- var e;
65
- return ((e = i()) == null ? void 0 : e.name) ?? u();
66
- }
67
- function $() {
68
- return a().currentCountry.value;
69
- }
70
- function x() {
71
- var r;
72
- const e = (r = C()) == null ? void 0 : r.trim().toLowerCase(), n = e && /^[a-z0-9-]+$/.test(e) ? e : u(), t = f(d("fmmf:prod")).liveDomain;
73
- return `https://${n}.${t}`;
74
- }
75
- function S(e) {
76
- return new Promise((n) => window.setTimeout(n, e));
77
- }
78
- function F(e) {
79
- return e instanceof Error ? e.message : String(e);
80
- }
81
- class T extends Error {
82
- constructor(n, t) {
83
- super(t), this.status = n, this.body = t;
84
- }
85
- }
86
- function c() {
87
- var n;
88
- return ((n = a().sessionUser.value) == null ? void 0 : n.token) || m.token || "";
89
- }
90
- async function E() {
91
- let e = c();
92
- const n = Date.now() + 5e3;
93
- for (; !e && Date.now() < n; )
94
- await S(100), e = c();
95
- return e ? `Bearer ${e}` : null;
96
- }
97
- async function P(e, n = {}) {
98
- const t = new Request(e, n), r = await E();
99
- r && t.headers.set("Authorization", r);
100
- const o = g($());
101
- return o && t.headers.set("x-feedme-country", o), fetch(t);
102
- }
103
- async function l(e, n = {}) {
104
- const t = new Headers(n.headers);
105
- n.body && !t.has("Content-Type") && t.set("Content-Type", "application/json");
106
- const r = new AbortController(), o = window.setTimeout(() => r.abort(), 15e3);
107
- try {
108
- const s = await P(v(e), {
109
- ...n,
110
- headers: t,
111
- signal: n.signal ?? r.signal
112
- });
113
- if (!s.ok) throw new T(s.status, await s.text());
114
- return s;
115
- } catch (s) {
116
- throw s instanceof DOMException && s.name === "AbortError" ? new Error("Control-plane request timed out") : s;
117
- } finally {
118
- window.clearTimeout(o);
119
- }
120
- }
121
- async function b(e, n = {}) {
122
- return (await l(e, n)).json();
123
- }
124
- async function I(e, n = {}) {
125
- return (await l(e, n)).text();
126
- }
127
- export {
128
- T as C,
129
- x as a,
130
- P as b,
131
- b as c,
132
- v as d,
133
- F as e,
134
- I as f,
135
- U as g,
136
- E as h,
137
- $ as i,
138
- i as j,
139
- u as k,
140
- C as l,
141
- D as m,
142
- g as n,
143
- k as o,
144
- S as s
145
- };
@@ -1,81 +0,0 @@
1
- const g = 10, f = 5242880, a = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif"]), o = {
2
- "image/png": "png",
3
- "image/jpeg": "jpg",
4
- "image/webp": "webp",
5
- "image/gif": "gif",
6
- "image/svg+xml": "svg",
7
- "text/markdown": "md",
8
- "application/json": "json",
9
- "application/zip+dotlottie": "lottie"
10
- }, v = `${Object.keys(o).join(",")},.svg,.md,.markdown,.json,.lottie,.dotlottie`;
11
- function l(e, t) {
12
- var r;
13
- const n = t.split(";")[0].trim().toLowerCase(), i = (r = e.split(".").pop()) == null ? void 0 : r.toLowerCase();
14
- return i === "svg" ? "image/svg+xml" : i === "md" || i === "markdown" ? "text/markdown" : i === "json" ? "application/json" : i === "lottie" || i === "dotlottie" ? "application/zip+dotlottie" : Object.hasOwn(o, n) ? n : null;
15
- }
16
- function T(e) {
17
- return a.has(e);
18
- }
19
- const u = "69cde0740c0106001ca83dff", E = "0000000074656d706c617465", m = {
20
- dev: {
21
- env: "dev",
22
- liveDomain: "feedmedev.vip",
23
- apiOrigin: "https://api.feedmedev.vip",
24
- workerNamePrefix: "miniprogram-v2-dev",
25
- d1DatabaseName: "miniprogram-v2-dev-metadata",
26
- r2BucketName: "miniprogram-v2-dev-artifacts",
27
- v1Origin: "https://brand.feedmedev.vip"
28
- },
29
- prod: {
30
- env: "prod",
31
- liveDomain: "feedme.vip",
32
- apiOrigin: "https://api.feedme.vip",
33
- workerNamePrefix: "miniprogram-v2-prod",
34
- d1DatabaseName: "miniprogram-v2-prod-metadata",
35
- r2BucketName: "miniprogram-v2-prod-artifacts",
36
- v1Origin: "https://brand.feedme.vip"
37
- }
38
- };
39
- function s(e) {
40
- return e === "dev" || e === "prod";
41
- }
42
- function A(e) {
43
- if (!s(e))
44
- throw new Error(`MINIPROGRAM_ENV must be 'dev' or 'prod', got ${JSON.stringify(e)}`);
45
- return m[e];
46
- }
47
- function N(e) {
48
- const t = e.toLowerCase().replace(/^fmmf:/, "");
49
- return t === "prod" || t === "production" ? "prod" : "dev";
50
- }
51
- const p = /^[a-f0-9]{24}$/;
52
- function d(e) {
53
- return p.test(e);
54
- }
55
- function w(e = crypto.randomUUID()) {
56
- const t = c("prj", e, 24);
57
- return t.length === 27 ? t : t.padEnd(27, "0");
58
- }
59
- function C(e) {
60
- if (!d(e)) throw new Error(`Invalid business id: ${e}`);
61
- return `prj${e}`;
62
- }
63
- function c(e, t, n) {
64
- const r = t.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replaceAll("-", "").slice(0, n);
65
- return `${e}${r || Date.now().toString(36)}`;
66
- }
67
- export {
68
- a as C,
69
- u as D,
70
- g as M,
71
- E as T,
72
- f as a,
73
- v as b,
74
- l as c,
75
- d,
76
- N as e,
77
- A as f,
78
- T as i,
79
- C as l,
80
- w as m
81
- };
@@ -1,62 +0,0 @@
1
- import "./index-BnE-gQP_.js";
2
- import { a as u } from "./routes-W8KfuhWL.js";
3
- import { ref as o } from "vue";
4
- import { c as a } from "./controlPlane-CiuLVd7s.js";
5
- let r = null;
6
- function i() {
7
- return r || (r = a(u.adminWhoami()).catch(() => ({
8
- isAdmin: !1,
9
- isFeedMeStaff: !1
10
- }))), r;
11
- }
12
- function f() {
13
- return i().then((e) => e.isAdmin);
14
- }
15
- function w() {
16
- const e = o(!1);
17
- return f().then((t) => {
18
- e.value = t;
19
- }), e;
20
- }
21
- function h() {
22
- const e = o(!1);
23
- return i().then((t) => {
24
- e.value = t.isFeedMeStaff === !0;
25
- }), e;
26
- }
27
- function S(e, t) {
28
- if (typeof window > "u") return t;
29
- try {
30
- const n = window.localStorage.getItem(e);
31
- return n === null ? t : n === "1";
32
- } catch {
33
- return t;
34
- }
35
- }
36
- function p(e, t) {
37
- if (typeof window > "u") return t;
38
- try {
39
- const n = Number(window.localStorage.getItem(e));
40
- return Number.isFinite(n) ? n : t;
41
- } catch {
42
- return t;
43
- }
44
- }
45
- function d(e, t) {
46
- if (!(typeof window > "u"))
47
- try {
48
- window.localStorage.setItem(e, t);
49
- } catch {
50
- }
51
- }
52
- function v(e, t) {
53
- d(e, t ? "1" : "0");
54
- }
55
- export {
56
- h as a,
57
- p as b,
58
- d as c,
59
- S as r,
60
- w as u,
61
- v as w
62
- };