@feedmepos/mf-miniprogram-v2 0.2.0-dev.3 → 0.2.1-dev.1
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.
- package/dist/AppTabs.vue_vue_type_script_setup_true_lang-DyhbprzT.js +269 -0
- package/dist/{ControlPlaneView-BIHhP7C_.js → ControlPlaneView-h52H_zs_.js} +5703 -5657
- package/dist/ModuleCenterView-hbGbGDMR.js +151 -0
- package/dist/ModuleDetailView-BWPMt2b3.js +191 -0
- package/dist/ModuleEmptyState.vue_vue_type_script_setup_true_lang-BQDnigyG.js +124 -0
- package/dist/app.js +19 -5
- package/dist/package.json +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { useCoreStore as c, FeedMeAuth as v } from "@feedmepos/mf-common";
|
|
2
|
+
import { defineComponent as h, computed as g, resolveComponent as $, openBlock as w, createElementBlock as b, createVNode as k, renderSlot as y } from "vue";
|
|
3
|
+
import "@feedmepos/ui-library";
|
|
4
|
+
import { useRouter as B } from "vue-router";
|
|
5
|
+
const t = {
|
|
6
|
+
project: (e) => `/api/projects/${e}`,
|
|
7
|
+
provision: (e) => `/api/projects/${e}/provision`,
|
|
8
|
+
refreshSlug: (e) => `/api/projects/${e}/refresh-slug`,
|
|
9
|
+
sessions: (e) => `/api/projects/${e}/sessions`,
|
|
10
|
+
session: (e, s) => `/api/projects/${e}/sessions/${s}`,
|
|
11
|
+
messages: (e, s) => `${t.session(e, s)}/messages`,
|
|
12
|
+
startStatus: (e, s) => `${t.session(e, s)}/start-status`,
|
|
13
|
+
changes: (e, s, r = !1) => `${t.session(e, s)}/changes${r ? "?refresh=1" : ""}`,
|
|
14
|
+
checkpoints: (e, s) => `${t.session(e, s)}/checkpoints`,
|
|
15
|
+
aiBillingPreflight: (e, s) => `${t.session(e, s)}/ai-billing/preflight`,
|
|
16
|
+
restoreCheckpoint: (e, s, r) => `${t.checkpoints(e, s)}/${r}/restore`,
|
|
17
|
+
previewBridgeTicket: (e, s) => `${t.session(e, s)}/preview-bridge/ticket`,
|
|
18
|
+
previewBridgeSocket: (e, s) => `${t.session(e, s)}/preview-bridge/socket`,
|
|
19
|
+
uploads: (e, s, r = "") => `${t.session(e, s)}/uploads${r ? `?${r}` : ""}`,
|
|
20
|
+
archive: (e, s) => `${t.session(e, s)}/archive`,
|
|
21
|
+
commit: (e, s) => `${t.session(e, s)}/commit`,
|
|
22
|
+
resume: (e, s) => `${t.session(e, s)}/resume`,
|
|
23
|
+
restartPreview: (e, s) => `${t.session(e, s)}/restart-preview`,
|
|
24
|
+
fork: (e, s) => `${t.session(e, s)}/fork`,
|
|
25
|
+
flushEvents: (e, s) => `${t.session(e, s)}/events/flush`,
|
|
26
|
+
revertTurn: (e, s) => `${t.session(e, s)}/turns/revert`,
|
|
27
|
+
unrevertTurn: (e, s) => `${t.session(e, s)}/turns/unrevert`,
|
|
28
|
+
releases: (e) => `${t.project(e)}/releases`,
|
|
29
|
+
publishRelease: (e, s) => `${t.releases(e)}/${s}/publish`,
|
|
30
|
+
releasePreviewUrl: (e, s) => `${t.releases(e)}/${s}/preview-url`,
|
|
31
|
+
rollbackToRelease: (e, s) => `${t.project(e)}/rollback-to-release/${s}`,
|
|
32
|
+
rollbackToV1: (e) => `${t.project(e)}/rollback-to-v1`,
|
|
33
|
+
start: (e, s) => {
|
|
34
|
+
const r = new URLSearchParams();
|
|
35
|
+
e && r.set("businessId", e), s && r.set("sessionId", s);
|
|
36
|
+
const n = r.toString();
|
|
37
|
+
return `/api/start${n ? `?${n}` : ""}`;
|
|
38
|
+
},
|
|
39
|
+
opencode: (e = "") => `/api/opencode${e ? `/${e.replace(/^\/+/, "")}` : ""}`,
|
|
40
|
+
/** The shared component library's catalog. Deliberately not under
|
|
41
|
+
* `/api/projects/:businessId`: the library belongs to no business, and the
|
|
42
|
+
* module centre is not inside a workspace. */
|
|
43
|
+
componentLibraryCatalog: () => "/api/component-library/catalog",
|
|
44
|
+
/** The self-contained preview document the module centre frames. Fetched with
|
|
45
|
+
* the portal's bearer and assigned to an iframe's `srcdoc`, never used as an
|
|
46
|
+
* `<iframe src>` — a navigation request carries no Authorization header,
|
|
47
|
+
* which is what a signed URL would otherwise exist to work around. */
|
|
48
|
+
componentLibraryPreview: () => "/api/component-library/preview"
|
|
49
|
+
}, C = [
|
|
50
|
+
"AE",
|
|
51
|
+
"AU",
|
|
52
|
+
"BN",
|
|
53
|
+
"GB",
|
|
54
|
+
"ID",
|
|
55
|
+
"JP",
|
|
56
|
+
"MA",
|
|
57
|
+
"MO",
|
|
58
|
+
"MV",
|
|
59
|
+
"MY",
|
|
60
|
+
"PK",
|
|
61
|
+
"SG",
|
|
62
|
+
"TH",
|
|
63
|
+
"VN"
|
|
64
|
+
];
|
|
65
|
+
function T(e) {
|
|
66
|
+
return typeof e == "string" && C.includes(e);
|
|
67
|
+
}
|
|
68
|
+
function U(e) {
|
|
69
|
+
if (typeof e != "string") return null;
|
|
70
|
+
const s = e.trim().toUpperCase();
|
|
71
|
+
return T(s) ? s : null;
|
|
72
|
+
}
|
|
73
|
+
function E(e, s) {
|
|
74
|
+
const r = s === "MY" ? "" : `.${s.toLowerCase()}`, n = e === "dev" ? "-dev" : "", i = e === "dev" ? "https://portal.feedmedev.cc" : "https://portal.feedme.cc", o = e === "dev" ? "https://license.feedmedev.cc" : "https://license.feedme.cc";
|
|
75
|
+
return {
|
|
76
|
+
country: s,
|
|
77
|
+
portalApiBaseUrl: `https://portal-v2${n}${r}.feedmeapi.com`,
|
|
78
|
+
licenseApiBaseUrl: `https://license-v2${n}${r}.feedmeapi.com/api`,
|
|
79
|
+
purchaseUrl: `${i}/purchase`,
|
|
80
|
+
usageUrl: `${o}/token`
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function Y(e, s, r) {
|
|
84
|
+
const n = new URL(E(e, s).usageUrl);
|
|
85
|
+
return n.searchParams.set("businessId", r), n.searchParams.set("country", s), n.toString();
|
|
86
|
+
}
|
|
87
|
+
const S = "69cde0740c0106001ca83dff", N = {
|
|
88
|
+
dev: {
|
|
89
|
+
env: "dev",
|
|
90
|
+
liveDomain: "feedmedev.vip",
|
|
91
|
+
apiOrigin: "https://api.feedmedev.vip",
|
|
92
|
+
workerNamePrefix: "miniprogram-v2-dev",
|
|
93
|
+
d1DatabaseName: "miniprogram-v2-dev-metadata",
|
|
94
|
+
r2BucketName: "miniprogram-v2-dev-artifacts",
|
|
95
|
+
v1Origin: "https://brand.feedmedev.vip"
|
|
96
|
+
},
|
|
97
|
+
prod: {
|
|
98
|
+
env: "prod",
|
|
99
|
+
liveDomain: "feedme.vip",
|
|
100
|
+
apiOrigin: "https://api.feedme.vip",
|
|
101
|
+
workerNamePrefix: "miniprogram-v2-prod",
|
|
102
|
+
d1DatabaseName: "miniprogram-v2-prod-metadata",
|
|
103
|
+
r2BucketName: "miniprogram-v2-prod-artifacts",
|
|
104
|
+
v1Origin: "https://brand.feedme.vip"
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
function P(e) {
|
|
108
|
+
return e === "dev" || e === "prod";
|
|
109
|
+
}
|
|
110
|
+
function M(e) {
|
|
111
|
+
if (!P(e))
|
|
112
|
+
throw new Error(`MINIPROGRAM_ENV must be 'dev' or 'prod', got ${JSON.stringify(e)}`);
|
|
113
|
+
return N[e];
|
|
114
|
+
}
|
|
115
|
+
function _(e) {
|
|
116
|
+
const s = e.toLowerCase().replace(/^fmmf:/, "");
|
|
117
|
+
return s === "prod" || s === "production" ? "prod" : "dev";
|
|
118
|
+
}
|
|
119
|
+
function R(e) {
|
|
120
|
+
return e.replace(/\/+$/, "");
|
|
121
|
+
}
|
|
122
|
+
function D() {
|
|
123
|
+
return R("https://miniprogram-v2-api.feedmedev.vip");
|
|
124
|
+
}
|
|
125
|
+
function x(e) {
|
|
126
|
+
const s = D();
|
|
127
|
+
return s ? `${s}${e.startsWith("/") ? e : `/${e}`}` : e;
|
|
128
|
+
}
|
|
129
|
+
function l() {
|
|
130
|
+
return c().currentBusiness.value;
|
|
131
|
+
}
|
|
132
|
+
function p() {
|
|
133
|
+
var e;
|
|
134
|
+
return ((e = l()) == null ? void 0 : e._id) ?? S;
|
|
135
|
+
}
|
|
136
|
+
function A() {
|
|
137
|
+
var e;
|
|
138
|
+
return ((e = l()) == null ? void 0 : e.url) ?? void 0;
|
|
139
|
+
}
|
|
140
|
+
function K() {
|
|
141
|
+
var e;
|
|
142
|
+
return ((e = l()) == null ? void 0 : e.name) ?? p();
|
|
143
|
+
}
|
|
144
|
+
function j() {
|
|
145
|
+
return c().currentCountry.value;
|
|
146
|
+
}
|
|
147
|
+
function Q() {
|
|
148
|
+
var n;
|
|
149
|
+
const e = (n = A()) == null ? void 0 : n.trim().toLowerCase(), s = e && /^[a-z0-9-]+$/.test(e) ? e : p(), r = M(_("fmmf:dev")).liveDomain;
|
|
150
|
+
return `https://${s}.${r}`;
|
|
151
|
+
}
|
|
152
|
+
function I(e) {
|
|
153
|
+
return new Promise((s) => window.setTimeout(s, e));
|
|
154
|
+
}
|
|
155
|
+
function X(e) {
|
|
156
|
+
return e instanceof Error ? e.message : String(e);
|
|
157
|
+
}
|
|
158
|
+
class L extends Error {
|
|
159
|
+
constructor(s, r) {
|
|
160
|
+
super(r), this.status = s, this.body = r;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function u() {
|
|
164
|
+
var s;
|
|
165
|
+
return ((s = c().sessionUser.value) == null ? void 0 : s.token) || v.token || "";
|
|
166
|
+
}
|
|
167
|
+
async function O() {
|
|
168
|
+
let e = u();
|
|
169
|
+
const s = Date.now() + 5e3;
|
|
170
|
+
for (; !e && Date.now() < s; )
|
|
171
|
+
await I(100), e = u();
|
|
172
|
+
return e ? `Bearer ${e}` : null;
|
|
173
|
+
}
|
|
174
|
+
async function F(e, s = {}) {
|
|
175
|
+
const r = new Request(e, s), n = await O();
|
|
176
|
+
n && r.headers.set("Authorization", n);
|
|
177
|
+
const i = U(j());
|
|
178
|
+
return i && r.headers.set("x-feedme-country", i), fetch(r);
|
|
179
|
+
}
|
|
180
|
+
async function m(e, s = {}) {
|
|
181
|
+
const r = new Headers(s.headers);
|
|
182
|
+
s.body && !r.has("Content-Type") && r.set("Content-Type", "application/json");
|
|
183
|
+
const n = new AbortController(), i = window.setTimeout(() => n.abort(), 15e3);
|
|
184
|
+
try {
|
|
185
|
+
const o = await F(x(e), {
|
|
186
|
+
...s,
|
|
187
|
+
headers: r,
|
|
188
|
+
signal: s.signal ?? n.signal
|
|
189
|
+
});
|
|
190
|
+
if (!o.ok) throw new L(o.status, await o.text());
|
|
191
|
+
return o;
|
|
192
|
+
} catch (o) {
|
|
193
|
+
throw o instanceof DOMException && o.name === "AbortError" ? new Error("Control-plane request timed out") : o;
|
|
194
|
+
} finally {
|
|
195
|
+
window.clearTimeout(i);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async function Z(e, s = {}) {
|
|
199
|
+
return (await m(e, s)).json();
|
|
200
|
+
}
|
|
201
|
+
async function ee(e, s = {}) {
|
|
202
|
+
return (await m(e, s)).text();
|
|
203
|
+
}
|
|
204
|
+
const z = { class: "flex min-w-0 shrink-0 items-center gap-12 border-b border-fm-color-neutral-gray-100 bg-fm-color-neutral-white px-16" }, V = "miniprogram-v2-module-center", se = /* @__PURE__ */ h({
|
|
205
|
+
__name: "AppTabs",
|
|
206
|
+
props: {
|
|
207
|
+
active: {},
|
|
208
|
+
sessionCount: {}
|
|
209
|
+
},
|
|
210
|
+
emits: ["select"],
|
|
211
|
+
setup(e, { emit: s }) {
|
|
212
|
+
const r = e, n = s, i = B(), o = g(() => [
|
|
213
|
+
{ label: "Workspace", value: "workspace", icon: "space_dashboard" },
|
|
214
|
+
{ label: "Releases", value: "releases", icon: "rocket_launch" },
|
|
215
|
+
...r.sessionCount == null ? [{ label: "Sessions", value: "sessions", icon: "history" }] : [{ label: "Sessions", value: "sessions", icon: "history", badge: r.sessionCount }],
|
|
216
|
+
{ label: "Module library", value: "modules", icon: "widgets" }
|
|
217
|
+
]);
|
|
218
|
+
function d(a) {
|
|
219
|
+
if (a === "modules") {
|
|
220
|
+
i.push({ name: V });
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (!(a !== "workspace" && a !== "releases" && a !== "sessions")) {
|
|
224
|
+
if (r.active === "modules") {
|
|
225
|
+
i.push({
|
|
226
|
+
name: "miniprogram-v2-control",
|
|
227
|
+
query: a === "workspace" ? {} : { view: a }
|
|
228
|
+
});
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
n("select", a);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return (a, q) => {
|
|
235
|
+
const f = $("FmTabs");
|
|
236
|
+
return w(), b("header", z, [
|
|
237
|
+
k(f, {
|
|
238
|
+
class: "min-w-0 flex-1",
|
|
239
|
+
items: o.value,
|
|
240
|
+
"model-value": e.active,
|
|
241
|
+
"onUpdate:modelValue": d
|
|
242
|
+
}, null, 8, ["items", "model-value"]),
|
|
243
|
+
y(a.$slots, "actions")
|
|
244
|
+
]);
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
export {
|
|
249
|
+
L as C,
|
|
250
|
+
S as D,
|
|
251
|
+
se as _,
|
|
252
|
+
M as a,
|
|
253
|
+
_ as b,
|
|
254
|
+
p as c,
|
|
255
|
+
F as d,
|
|
256
|
+
X as e,
|
|
257
|
+
x as f,
|
|
258
|
+
t as g,
|
|
259
|
+
Z as h,
|
|
260
|
+
O as i,
|
|
261
|
+
A as j,
|
|
262
|
+
j as k,
|
|
263
|
+
K as l,
|
|
264
|
+
Y as m,
|
|
265
|
+
U as n,
|
|
266
|
+
Q as o,
|
|
267
|
+
ee as p,
|
|
268
|
+
I as s
|
|
269
|
+
};
|