@feedmepos/mf-miniprogram-v2 0.2.8 → 0.2.9-dev.10

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 (26) hide show
  1. package/dist/{App-CI4ncIRr.js → App-DvS0M-h7.js} +3 -3
  2. package/dist/{BrandFontPicker-Ud9cZQm1.js → BrandFontPicker-D8OXBoHt.js} +1 -1
  3. package/dist/{BrandKitView-n5K3qyUW.js → BrandKitView-lDQ2s5BD.js} +2 -2
  4. package/dist/{ControlPlaneView-BPVh5gPy.js → ControlPlaneView-AkjSV1Ik.js} +11465 -10556
  5. package/dist/{EcosystemView-j7eC2CsA.js → EcosystemView-BMleE1Oz.js} +6 -6
  6. package/dist/{LegacyWorkspaceEntry-CADRpDkg.js → LegacyWorkspaceEntry-DBIDEJNj.js} +2 -2
  7. package/dist/{MobileProjectDialog-DYlIwjzr.js → MobileProjectDialog-B3fhhssO.js} +3 -3
  8. package/dist/{MobileProjectsView-BFljhsY0.js → MobileProjectsView-BQ3f5seS.js} +7 -6
  9. package/dist/{ModuleCenterView-886eyuBg.js → ModuleCenterView-_yy5EJVi.js} +1 -1
  10. package/dist/{ModuleDetailView-B1IXOpig.js → ModuleDetailView-oe44R9vG.js} +1 -1
  11. package/dist/{PagesView-D5uGpfrp.js → PagesView-CRJ9PifL.js} +1 -1
  12. package/dist/{PortalSettingsView-B7NohuU5.js → PortalSettingsView-CP87BEmb.js} +5 -5
  13. package/dist/{TemplateCenterView-BJ3MBEUa.js → TemplateCenterView-Kl3rlE4I.js} +5 -4
  14. package/dist/{WorkspaceEntryView-mpPpAsq4.js → WorkspaceEntryView-hi6v5jO2.js} +1 -1
  15. package/dist/app.js +11 -11
  16. package/dist/{controlPlane-DuIuUbyk.js → controlPlane-D17RrVO0.js} +11 -11
  17. package/dist/index-BnE-gQP_.js +81 -0
  18. package/dist/{localPreference-C18SIo-s.js → localPreference-cX7JCvEc.js} +13 -12
  19. package/dist/package.json +1 -1
  20. package/dist/{portalContext-BkAoYip4.js → portalContext-BWcPaz4H.js} +17 -16
  21. package/dist/{routes-B9oMJsaM.js → routes-D17DkfPa.js} +1 -0
  22. package/dist/style.css +1 -1
  23. package/dist/{useBrandKit-DDqx19_h.js → useBrandKit-C8qxHPWH.js} +3 -3
  24. package/dist/{useModuleCatalog-CLRJw1aG.js → useModuleCatalog-D_F-vVPX.js} +21 -20
  25. package/package.json +1 -1
  26. package/dist/index-CIJWcl_6.js +0 -56
@@ -0,0 +1,81 @@
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,6 +1,7 @@
1
- import { a as u } from "./routes-B9oMJsaM.js";
1
+ import "./index-BnE-gQP_.js";
2
+ import { a as u } from "./routes-D17DkfPa.js";
2
3
  import { ref as o } from "vue";
3
- import { c as a } from "./controlPlane-DuIuUbyk.js";
4
+ import { c as a } from "./controlPlane-D17RrVO0.js";
4
5
  let r = null;
5
6
  function i() {
6
7
  return r || (r = a(u.adminWhoami()).catch(() => ({
@@ -11,19 +12,19 @@ function i() {
11
12
  function f() {
12
13
  return i().then((e) => e.isAdmin);
13
14
  }
14
- function l() {
15
+ function w() {
15
16
  const e = o(!1);
16
17
  return f().then((t) => {
17
18
  e.value = t;
18
19
  }), e;
19
20
  }
20
- function w() {
21
+ function h() {
21
22
  const e = o(!1);
22
23
  return i().then((t) => {
23
24
  e.value = t.isFeedMeStaff === !0;
24
25
  }), e;
25
26
  }
26
- function h(e, t) {
27
+ function S(e, t) {
27
28
  if (typeof window > "u") return t;
28
29
  try {
29
30
  const n = window.localStorage.getItem(e);
@@ -32,7 +33,7 @@ function h(e, t) {
32
33
  return t;
33
34
  }
34
35
  }
35
- function S(e, t) {
36
+ function p(e, t) {
36
37
  if (typeof window > "u") return t;
37
38
  try {
38
39
  const n = Number(window.localStorage.getItem(e));
@@ -48,14 +49,14 @@ function d(e, t) {
48
49
  } catch {
49
50
  }
50
51
  }
51
- function p(e, t) {
52
+ function v(e, t) {
52
53
  d(e, t ? "1" : "0");
53
54
  }
54
55
  export {
55
- w as a,
56
- S as b,
56
+ h as a,
57
+ p as b,
57
58
  d as c,
58
- h as r,
59
- l as u,
60
- p as w
59
+ S as r,
60
+ w as u,
61
+ v as w
61
62
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-miniprogram-v2",
3
- "version": "0.2.8",
3
+ "version": "0.2.9-dev.10",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -1,47 +1,48 @@
1
- import { a as b } from "./routes-B9oMJsaM.js";
1
+ import "./index-BnE-gQP_.js";
2
+ import { a as b } from "./routes-D17DkfPa.js";
2
3
  import { useCoreStore as d } from "@feedmepos/mf-common";
3
- import { c as g, e as h } from "./controlPlane-DuIuUbyk.js";
4
+ import { c as g, e as h } from "./controlPlane-D17RrVO0.js";
4
5
  import { provide as y, computed as f, ref as c, watch as C, onScopeDispose as w, inject as x } from "vue";
5
6
  function P() {
6
- const e = d(), r = f(() => {
7
+ const e = d(), n = f(() => {
7
8
  var t;
8
9
  return ((t = e.currentBusiness.value) == null ? void 0 : t._id) ?? null;
9
10
  }), v = f(() => {
10
11
  var t;
11
12
  return ((t = e.currentBusiness.value) == null ? void 0 : t.name) ?? "Your business";
12
13
  }), s = c(null), a = c(!1), i = c(null);
13
- let n = 0, o = null;
14
+ let r = 0, o = null;
14
15
  async function m() {
15
- const t = ++n;
16
+ const t = ++r;
16
17
  o == null || o.abort(), o = new AbortController();
17
- const u = r.value;
18
+ const u = n.value;
18
19
  if (i.value = null, s.value = null, a.value = !!u, !!u)
19
20
  try {
20
21
  const l = await g(b.portalContext(u), {
21
22
  signal: AbortSignal.any([o.signal, AbortSignal.timeout(15e3)])
22
23
  });
23
- t === n && (s.value = l);
24
+ t === r && (s.value = l);
24
25
  } catch (l) {
25
- t === n && (i.value = h(l));
26
+ t === r && (i.value = h(l));
26
27
  } finally {
27
- t === n && (a.value = !1);
28
+ t === r && (a.value = !1);
28
29
  }
29
30
  }
30
- return C([r, () => e.currentCountry.value], m, { immediate: !0 }), w(() => {
31
- n++, o == null || o.abort();
32
- }), { businessId: r, businessName: v, context: s, loading: a, error: i, refresh: m };
31
+ return C([n, () => e.currentCountry.value], m, { immediate: !0 }), w(() => {
32
+ r++, o == null || o.abort();
33
+ }), { businessId: n, businessName: v, context: s, loading: a, error: i, refresh: m };
33
34
  }
34
35
  const p = Symbol("miniprogram-portal");
35
- function R() {
36
+ function j() {
36
37
  const e = P();
37
38
  return y(p, e), e;
38
39
  }
39
- function j() {
40
+ function D() {
40
41
  const e = x(p);
41
42
  if (!e) throw new Error("Portal views must be mounted inside the Miniprogram shell");
42
43
  return e;
43
44
  }
44
45
  export {
45
- R as p,
46
- j as u
46
+ j as p,
47
+ D as u
47
48
  };
@@ -8,6 +8,7 @@ const t = (e, s) => `/api/businesses/${e}/projects/${s}`, i = {
8
8
  session: (e, s, a) => `${t(e, s)}/sessions/${a}`,
9
9
  messages: (e, s, a) => `${i.session(e, s, a)}/messages`,
10
10
  startStatus: (e, s, a) => `${i.session(e, s, a)}/start-status`,
11
+ sessionPreviewUrl: (e, s, a) => `${i.session(e, s, a)}/preview-url`,
11
12
  /** Server-side render of one library module, proxied to the session's own
12
13
  * sandbox — what the swap panel's candidate cards fetch instead of the
13
14
  * browser reaching the public preview host directly (see