@engenty/wizards-runtime 0.9.5 → 0.9.7
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/apps/runtime/dist/agents/architect.js +2 -2
- package/apps/runtime/dist/agents/chat-clients.js +299 -0
- package/apps/runtime/dist/agents/company.js +111 -0
- package/apps/runtime/dist/agents/studio-assistant.js +8 -4
- package/apps/runtime/dist/agents/subscription.js +163 -134
- package/apps/runtime/dist/agents/website.js +571 -53
- package/apps/runtime/dist/app.js +6 -3
- package/apps/runtime/dist/assistant/knows.js +5 -5
- package/apps/runtime/dist/assistant/primer.js +3 -3
- package/apps/runtime/dist/auth/account.js +12 -12
- package/apps/runtime/dist/auth/keys.js +18 -8
- package/apps/runtime/dist/cli/account.js +20 -18
- package/apps/runtime/dist/cli/features.js +3 -3
- package/apps/runtime/dist/cli/ui.js +6 -0
- package/apps/runtime/dist/db/schema.js +1 -1
- package/apps/runtime/dist/docs/dev/plugins/index.md +1 -1
- package/apps/runtime/dist/docs/dev/plugins/server.md +2 -2
- package/apps/runtime/dist/docs/dev/plugins/studio.md +1 -1
- package/apps/runtime/dist/docs/user-guide/ai-apps.md +1 -1
- package/apps/runtime/dist/docs/user-guide/command-line.md +1 -1
- package/apps/runtime/dist/docs/user-guide/create-account.md +6 -6
- package/apps/runtime/dist/docs/user-guide/first-start.md +1 -1
- package/apps/runtime/dist/docs/user-guide/index.md +5 -5
- package/apps/runtime/dist/docs/user-guide/models.md +14 -8
- package/apps/runtime/dist/docs/user-guide/space.md +1 -1
- package/apps/runtime/dist/features.js +4 -4
- package/apps/runtime/dist/harness/cursor.js +4 -0
- package/apps/runtime/dist/manage.js +4 -4
- package/apps/runtime/dist/mcp/auth.js +1 -1
- package/apps/runtime/dist/models.js +75 -5
- package/apps/runtime/dist/routes/lang.js +13 -4
- package/apps/runtime/dist/routes/runs.js +1 -1
- package/apps/runtime/dist/routes/studio.js +66 -37
- package/apps/runtime/dist/services/access.js +3 -3
- package/apps/runtime/dist/services/architect.js +4 -2
- package/apps/runtime/dist/services/assistant-chats.js +10 -1
- package/apps/runtime/dist/services/onboarding.js +268 -48
- package/apps/runtime/dist/services/pages.js +17 -15
- package/apps/runtime/dist/services/wizards.js +2 -2
- package/apps/runtime/dist/texts.js +42 -8
- package/apps/web/dist/assets/{AboutDialog-lUBGgvKu.js → AboutDialog-B3tljxg5.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-B2IJbKX8.js → ChangelogDialog-DfWTNzyl.js} +1 -1
- package/apps/web/dist/assets/EditorPage-XDdz2UM4.js +4 -0
- package/apps/web/dist/assets/{FlowPreview-BUKI8h6o.js → FlowPreview-CKNVCFbp.js} +1 -1
- package/apps/web/dist/assets/{Harness-D35I3Jlp.js → Harness-BCec49Cq.js} +2 -2
- package/apps/web/dist/assets/Marketplace-BuYeaxK2.js +2 -0
- package/apps/web/dist/assets/{NewWizardChannels-PDeL4f5D.js → NewWizardChannels-DRNji-bk.js} +1 -1
- package/apps/web/dist/assets/NewWizardPage-4TpgYOaI.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-Cf52NOIt.js +1 -0
- package/apps/web/dist/assets/PreviewPane-C4yMcZPM.js +4 -0
- package/apps/web/dist/assets/ProjectPage-D6Tah3QK.js +1 -0
- package/apps/web/dist/assets/{PublicRunner-BnT-zZrI.js → PublicRunner-Bftc1c4m.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-C5fdw_kg.js → ReadOnly-DVQm9IYx.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-Cd-osLDu.js +2 -0
- package/apps/web/dist/assets/SetupPage-Dc8U5k5P.js +1 -0
- package/apps/web/dist/assets/{SharePage-BiPJsotS.js → SharePage-Cn-bqSyr.js} +1 -1
- package/apps/web/dist/assets/changelog-CjSBB-a4.js +1 -0
- package/apps/web/dist/assets/{coins-DVGgwSrK.js → coins-DgDTBbeg.js} +1 -1
- package/apps/web/dist/assets/index-DS3zUVw_.css +1 -0
- package/apps/web/dist/assets/index-Da7hPToW.js +14 -0
- package/apps/web/dist/assets/oss-credits-C2JUsf2d.js +1 -0
- package/apps/web/dist/assets/{phone-DD2g0U0Q.js → phone-D1Drdiio.js} +1 -1
- package/apps/web/dist/assets/preload-helper-DpV6A1kQ.js +1 -0
- package/apps/web/dist/assets/{qr-scanner.min-C_UI0gH-.js → qr-scanner.min-BGqShvxG.js} +1 -1
- package/apps/web/dist/assets/{runners-D6mK0B73.js → runners-CTd0YAiA.js} +1 -1
- package/apps/web/dist/assets/{session-BHCBxqVb.js → session-DX2BcTfz.js} +1 -1
- package/apps/web/dist/assets/{settings-menu-DGDn2688.js → settings-menu-ay9jNbQu.js} +1 -1
- package/apps/web/dist/assets/theme-DanjuO1H.js +11 -0
- package/apps/web/dist/assets/ui-CJCF3Mhe.js +137 -0
- package/apps/web/dist/assets/{upload-uc9uftDy.js → upload-Dj7KPL--.js} +1 -1
- package/apps/web/dist/assets/{useMutation-BfQIRblT.js → useMutation-CUSQpD-i.js} +1 -1
- package/apps/web/dist/assets/{volume-2-BlaOos9n.js → volume-2-CcHZOU2m.js} +1 -1
- package/apps/web/dist/assets/{wrench-Cfpkphyw.js → wrench-CfJTFnMJ.js} +1 -1
- package/apps/web/dist/index.html +9 -9
- package/apps/web/dist/mcp/flow.html +56 -56
- package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +6 -0
- package/node_modules/@engenty/wizards-shared/dist/assistant.js +2 -0
- package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +4 -0
- package/node_modules/@engenty/wizards-shared/dist/definition.js +9 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +5 -5
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +5 -5
- package/node_modules/@engenty/wizards-shared/dist/features.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/features.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/projects.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/projects.js +2 -2
- package/node_modules/@engenty/wizards-shared/dist/providers.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/providers.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +2 -2
- package/node_modules/@engenty/wizards-shared/dist/run.js +4 -4
- package/package.json +3 -3
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/EditorPage-B1syriTz.js +0 -4
- package/apps/web/dist/assets/Marketplace-C-ft5u_6.js +0 -2
- package/apps/web/dist/assets/NewWizardPage-BHw086HN.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-BYa8Xekc.js +0 -1
- package/apps/web/dist/assets/PreviewPane-Cuatuhi-.js +0 -4
- package/apps/web/dist/assets/ProjectPage-DTbTN9rE.js +0 -1
- package/apps/web/dist/assets/SettingsPage-Bkd5LuRn.js +0 -2
- package/apps/web/dist/assets/SetupPage-CHnbGccO.js +0 -1
- package/apps/web/dist/assets/changelog-Do_saoEi.js +0 -1
- package/apps/web/dist/assets/index-C-u3ZXBZ.js +0 -14
- package/apps/web/dist/assets/index-DtjKnB3s.css +0 -1
- package/apps/web/dist/assets/oss-credits-D7izqI_0.js +0 -1
- package/apps/web/dist/assets/preload-helper-CNEI7N0N.js +0 -1
- package/apps/web/dist/assets/theme-DQ10nO_L.js +0 -11
- package/apps/web/dist/assets/ui-BV4KP5n2.js +0 -137
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { factKey, PROJECT_LIMITS, } from "@engenty/wizards-shared/projects";
|
|
2
|
+
import { nanoid } from "nanoid";
|
|
3
|
+
import { readCompany } from "../agents/company.js";
|
|
4
|
+
import { readContact, readWebsite } from "../agents/website.js";
|
|
2
5
|
import { managed } from "../manage.js";
|
|
3
6
|
import { readSetting, writeSetting } from "../settings.js";
|
|
7
|
+
import { serverText } from "../texts.js";
|
|
4
8
|
import { isAdminRole } from "./access.js";
|
|
5
|
-
import {
|
|
6
|
-
import { listProjects, updateProject } from "./projects.js";
|
|
9
|
+
import { addProjectFileFromUrl, projectFiles } from "./project-files.js";
|
|
10
|
+
import { listProjects, ownedProject, updateProject } from "./projects.js";
|
|
7
11
|
/**
|
|
8
|
-
* The first visit of
|
|
12
|
+
* The first visit of an organization's studio in the cloud: a short wizard asks who the organization is, reads
|
|
9
13
|
* its website into the space, takes first documents and explains the space. It shows once, to
|
|
10
|
-
* the people who may change the
|
|
14
|
+
* the people who may change the organization, and never to an organization that already has wizards; the mark
|
|
11
15
|
* that it is done sits in the control database under the tenant.
|
|
12
16
|
*/
|
|
13
17
|
const key = (tenantId) => `onboarding:${tenantId}`;
|
|
@@ -51,6 +55,22 @@ function telling(color) {
|
|
|
51
55
|
const light = (r + g + b) / 3;
|
|
52
56
|
return spread > 24 && light > 24 && light < 235;
|
|
53
57
|
}
|
|
58
|
+
/** A colour's hue, 0–360. */
|
|
59
|
+
function hue(color) {
|
|
60
|
+
const [r, g, b] = [1, 3, 5].map((i) => Number.parseInt(color.slice(i, i + 2), 16) / 255);
|
|
61
|
+
const max = Math.max(r, g, b);
|
|
62
|
+
const d = max - Math.min(r, g, b);
|
|
63
|
+
if (d === 0) {
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
const h = max === r ? ((g - b) / d) % 6 : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
|
|
67
|
+
return (h * 60 + 360) % 360;
|
|
68
|
+
}
|
|
69
|
+
/** Two colours of one hue, a shade of the other: one brand colour, not two. */
|
|
70
|
+
function shadeOf(a, b) {
|
|
71
|
+
const d = Math.abs(hue(a) - hue(b));
|
|
72
|
+
return Math.min(d, 360 - d) < 20;
|
|
73
|
+
}
|
|
54
74
|
/** A page title is often "Company – Slogan" or "Home | Company": the company's part of it. */
|
|
55
75
|
export function companyOf(title) {
|
|
56
76
|
const parts = title
|
|
@@ -65,20 +85,75 @@ export function companyOf(title) {
|
|
|
65
85
|
// The shortest telling part is the name; a slogan is longer.
|
|
66
86
|
return (named.sort((a, b) => a.length - b.length)[0] ?? parts[0]).slice(0, 120);
|
|
67
87
|
}
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
88
|
+
/** A paragraph of Markdown as words: links and emphasis as their text, pictures left out. */
|
|
89
|
+
const plain = (p) => p
|
|
90
|
+
.replace(/!\[[^\]]*\]\([^)]*\)/g, "")
|
|
91
|
+
.replace(/\[([^\]]*)\]\([^)]*\)/g, "$1")
|
|
92
|
+
.replace(/[*_`]+/g, "")
|
|
93
|
+
.replace(/\s+/g, " ")
|
|
94
|
+
.trim();
|
|
95
|
+
/** Sentences about the company, not a teaser, a menu or a cookie notice. */
|
|
96
|
+
const prose = (p) => /[.!?…]$|[.!?]\s/.test(p) &&
|
|
97
|
+
p.split(" ").length >= 8 &&
|
|
98
|
+
!/cookie|datenschutz|privacy|einwilligung|consent|zustimmung/i.test(p);
|
|
99
|
+
/** At most `max` characters, cut after a sentence where it is longer. */
|
|
100
|
+
function cut(text, max = 600) {
|
|
101
|
+
if (text.length <= max) {
|
|
102
|
+
return text;
|
|
72
103
|
}
|
|
73
|
-
const
|
|
104
|
+
const part = text.slice(0, max);
|
|
105
|
+
const end = Math.max(part.lastIndexOf(". "), part.lastIndexOf("! "), part.lastIndexOf("? "));
|
|
106
|
+
return end > max / 2 ? part.slice(0, end + 1) : part;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The about text: a description that says something, else a paragraph of the home page, else
|
|
110
|
+
* what the imprint gives as the company's purpose (its "Unternehmensgegenstand"); a slogan only
|
|
111
|
+
* where nothing longer is there.
|
|
112
|
+
*/
|
|
113
|
+
export function aboutOf(description, text, purpose = "") {
|
|
114
|
+
// A heading, a list or a paragraph that is mostly links (a menu, a footer) is no account.
|
|
115
|
+
const linked = (p) => [...p.matchAll(/\[([^\]]*)\]\([^)]*\)/g)].reduce((n, m) => n + m[1].length, 0) >
|
|
116
|
+
plain(p).length / 2;
|
|
117
|
+
const paragraphs = text
|
|
74
118
|
.split(/\n{2,}/)
|
|
75
|
-
.
|
|
76
|
-
.
|
|
77
|
-
|
|
119
|
+
.filter((p) => !(/^\s*(#|!?\[|[-*+] |\d+\. )/.test(p) || linked(p)))
|
|
120
|
+
.map((p) => plain(p.replace(/^>\s*/, "")))
|
|
121
|
+
.filter(prose);
|
|
122
|
+
const [desc, does] = [description.trim(), purpose.trim()];
|
|
123
|
+
return cut([
|
|
124
|
+
desc.length >= 120 ? desc : "",
|
|
125
|
+
paragraphs.find((p) => p.length >= 120),
|
|
126
|
+
does.length >= 120 ? does : "",
|
|
127
|
+
desc.length >= 40 ? desc : "",
|
|
128
|
+
paragraphs.find((p) => p.length >= 80),
|
|
129
|
+
desc,
|
|
130
|
+
does,
|
|
131
|
+
].find(Boolean) ?? "");
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The brand's fonts out of what the site uses: the families it serves itself (its `@font-face`
|
|
135
|
+
* rules, its Google Fonts link), at most two, the second only where one of them is clearly the
|
|
136
|
+
* headings' font.
|
|
137
|
+
*/
|
|
138
|
+
export function brandFonts(fonts, lang) {
|
|
139
|
+
const served = fonts.filter((f) => f.weights.length).slice(0, 2);
|
|
140
|
+
const [a, b] = served;
|
|
141
|
+
if (!a) {
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
if (!b || Boolean(a.headings) === Boolean(b.headings)) {
|
|
145
|
+
return [{ family: a.family, role: serverText(lang, "fontRoleAll"), weights: a.weights }];
|
|
146
|
+
}
|
|
147
|
+
return served.map((f) => ({
|
|
148
|
+
family: f.family,
|
|
149
|
+
role: serverText(lang, f.headings ? "fontRoleHeadings" : "fontRoleText"),
|
|
150
|
+
weights: f.weights,
|
|
151
|
+
}));
|
|
78
152
|
}
|
|
79
153
|
/**
|
|
80
154
|
* Up to three brand colours out of what the site declares and uses: the theme colour first, then
|
|
81
|
-
* the stylesheet's named colours, then the most used ones; greys and near-whites left out
|
|
155
|
+
* the stylesheet's named colours, then the most used ones; greys and near-whites left out, and
|
|
156
|
+
* shades of a colour already taken.
|
|
82
157
|
*/
|
|
83
158
|
export function brandColors(brand) {
|
|
84
159
|
const candidates = [
|
|
@@ -89,7 +164,7 @@ export function brandColors(brand) {
|
|
|
89
164
|
const colors = [];
|
|
90
165
|
for (const c of candidates) {
|
|
91
166
|
const value = hex(c.value);
|
|
92
|
-
if (value && telling(value) && !colors.some((x) => x.value
|
|
167
|
+
if (value && telling(value) && !colors.some((x) => shadeOf(x.value, value))) {
|
|
93
168
|
colors.push({ name: c.name.replace(/^--/, "").slice(0, 120) || "Colour", value });
|
|
94
169
|
}
|
|
95
170
|
if (colors.length === 3) {
|
|
@@ -98,55 +173,200 @@ export function brandColors(brand) {
|
|
|
98
173
|
}
|
|
99
174
|
return colors;
|
|
100
175
|
}
|
|
176
|
+
/** The facts a company's site states, by the keys the Info & brand page offers them under. */
|
|
177
|
+
const FACTS = [
|
|
178
|
+
["adresse", "street", "factAddress"],
|
|
179
|
+
["plz", "postcode", "factPostcode"],
|
|
180
|
+
["ort", "city", "factCity"],
|
|
181
|
+
["uid", "vatId", "factVatId"],
|
|
182
|
+
["telefon", "phone", "factPhone"],
|
|
183
|
+
["e_mail", "email", "factEmail"],
|
|
184
|
+
["website", "website", "factWebsite"],
|
|
185
|
+
];
|
|
186
|
+
/** The profiles on social networks, under their networks' names. */
|
|
187
|
+
const PROFILES = [
|
|
188
|
+
["linkedin", "LinkedIn"],
|
|
189
|
+
["facebook", "Facebook"],
|
|
190
|
+
["instagram", "Instagram"],
|
|
191
|
+
["youtube", "YouTube"],
|
|
192
|
+
["xing", "XING"],
|
|
193
|
+
["x", "X"],
|
|
194
|
+
["tiktok", "TikTok"],
|
|
195
|
+
];
|
|
196
|
+
/**
|
|
197
|
+
* The facts beyond the basics an imprint states, labelled as the company's country names them:
|
|
198
|
+
* Austria's Firmenbuch ("FN 44903 i"), Germany's Handelsregister ("HRB 12345").
|
|
199
|
+
*/
|
|
200
|
+
function moreFacts(found, lang) {
|
|
201
|
+
const trade = /^HR[AB]/.test(found.register ?? "");
|
|
202
|
+
return [
|
|
203
|
+
["company", serverText(lang, "factCompany")],
|
|
204
|
+
["register", serverText(lang, trade ? "factTradeRegister" : "factRegister")],
|
|
205
|
+
["court", serverText(lang, trade ? "factTradeRegisterCourt" : "factRegisterCourt")],
|
|
206
|
+
["management", serverText(lang, "factManagement")],
|
|
207
|
+
...PROFILES,
|
|
208
|
+
];
|
|
209
|
+
}
|
|
210
|
+
/** A value as it compares: "FN 44903 i" is "FN 44903i". */
|
|
211
|
+
const sameValue = (a, b) => a.replace(/\s+/g, "").toLowerCase() === b.replace(/\s+/g, "").toLowerCase();
|
|
212
|
+
/**
|
|
213
|
+
* The space's facts with what the site states added: a fact the space has a value for stays as
|
|
214
|
+
* it is, an empty one is filled, a missing one is added, the basics under their usual keys, the
|
|
215
|
+
* others under a key made from their label. `more`: facts a model read, by label; one whose
|
|
216
|
+
* value the space already has is left out.
|
|
217
|
+
*/
|
|
218
|
+
export function withFacts(facts, found, lang, more = []) {
|
|
219
|
+
const next = [...facts];
|
|
220
|
+
let added = 0;
|
|
221
|
+
const basicKey = (label) => FACTS.find(([, , l]) => factKey(serverText(lang, l)) === factKey(label))?.[0] ?? null;
|
|
222
|
+
const rows = [
|
|
223
|
+
...FACTS.map(([key, field, label]) => [
|
|
224
|
+
key,
|
|
225
|
+
found[field],
|
|
226
|
+
serverText(lang, label),
|
|
227
|
+
]),
|
|
228
|
+
...moreFacts(found, lang).map(([field, label]) => [
|
|
229
|
+
null,
|
|
230
|
+
found[field],
|
|
231
|
+
label,
|
|
232
|
+
]),
|
|
233
|
+
...more
|
|
234
|
+
.filter((m, i) => !more.slice(0, i).some((x) => sameValue(x.value, m.value)))
|
|
235
|
+
.map((m) => [
|
|
236
|
+
basicKey(m.label),
|
|
237
|
+
m.value,
|
|
238
|
+
m.label,
|
|
239
|
+
]),
|
|
240
|
+
];
|
|
241
|
+
for (const [i, [basic, raw, name]] of rows.entries()) {
|
|
242
|
+
const value = raw?.trim();
|
|
243
|
+
const key = basic ?? factKey(name);
|
|
244
|
+
const at = next.findIndex((f) => f.key === key || f.label.trim().toLowerCase() === name.toLowerCase());
|
|
245
|
+
if (!value ||
|
|
246
|
+
// Beyond the basics, a value the space has under another label is not added twice.
|
|
247
|
+
(i >= FACTS.length && next.some((f) => sameValue(f.value, value))) ||
|
|
248
|
+
(at >= 0 && next[at].value.trim()) ||
|
|
249
|
+
(at < 0 && next.length >= PROJECT_LIMITS.facts)) {
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
if (at >= 0) {
|
|
253
|
+
next[at] = { ...next[at], value };
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
next.push({
|
|
257
|
+
key: basic ??
|
|
258
|
+
factKey(name, next.map((f) => f.key)),
|
|
259
|
+
label: name,
|
|
260
|
+
value,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
added++;
|
|
264
|
+
}
|
|
265
|
+
return { facts: next, added };
|
|
266
|
+
}
|
|
267
|
+
/** At most this many pictures of the home page become brand material. */
|
|
268
|
+
const ASSETS = 4;
|
|
101
269
|
/**
|
|
102
270
|
* Reads a website into the space's Info & brand: the company's name, what it does, up to three
|
|
103
|
-
* of its colours
|
|
104
|
-
*
|
|
271
|
+
* of its colours, the facts its imprint and contact page state (its full name with its legal
|
|
272
|
+
* form among them, where the site goes by a shorter one) and, where the space has none yet, its
|
|
273
|
+
* fonts, its logo and the big pictures of its home page as brand material. What the assistant
|
|
274
|
+
* does on request, done once at the start: patterns read the pages, one model call checks and
|
|
275
|
+
* completes name, about, facts and fonts; without a model or credits the patterns' reading
|
|
276
|
+
* stands.
|
|
105
277
|
*/
|
|
106
|
-
export async function applyWebsite(userId, projectId, url) {
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
const about = aboutOf(reading.description, reading.text);
|
|
278
|
+
export async function applyWebsite(userId, projectId, url, lang) {
|
|
279
|
+
const signal = AbortSignal.timeout(30_000);
|
|
280
|
+
const reading = await readWebsite(url, signal, { inline: true });
|
|
110
281
|
const colors = brandColors(reading.brand);
|
|
282
|
+
const pages = [{ url: reading.url, text: reading.text }];
|
|
283
|
+
const contact = await readContact(reading, signal, pages).catch(() => reading.contact);
|
|
284
|
+
const website = new URL(reading.url).origin;
|
|
285
|
+
// What the patterns read; a model checks and completes it where one may be used.
|
|
286
|
+
const found = {
|
|
287
|
+
name: companyOf(reading.siteName || reading.title || new URL(reading.url).hostname),
|
|
288
|
+
about: aboutOf(reading.description, reading.text, contact.purpose),
|
|
289
|
+
fonts: brandFonts(reading.brand.fonts, lang),
|
|
290
|
+
};
|
|
291
|
+
const read = await readCompany({
|
|
292
|
+
lang,
|
|
293
|
+
pages,
|
|
294
|
+
found: {
|
|
295
|
+
name: found.name,
|
|
296
|
+
company: contact.company,
|
|
297
|
+
about: found.about,
|
|
298
|
+
facts: withFacts([], { ...contact, website }, lang).facts.map(({ label, value }) => ({
|
|
299
|
+
label,
|
|
300
|
+
value,
|
|
301
|
+
})),
|
|
302
|
+
fonts: reading.brand.fonts,
|
|
303
|
+
},
|
|
304
|
+
signal: AbortSignal.timeout(30_000),
|
|
305
|
+
});
|
|
306
|
+
const name = read?.name ?? found.name;
|
|
307
|
+
const about = read?.about ?? found.about;
|
|
308
|
+
const company = read?.company ?? contact.company;
|
|
309
|
+
const project = await ownedProject(userId, projectId);
|
|
310
|
+
const fonts = project.brand.fonts?.length ? [] : read?.fonts.length ? read.fonts : found.fonts;
|
|
311
|
+
const facts = withFacts(project.facts, {
|
|
312
|
+
...contact,
|
|
313
|
+
// The full name only where it says more than the name the space goes by.
|
|
314
|
+
company: company?.toLowerCase() === name.toLowerCase() ? undefined : company,
|
|
315
|
+
website,
|
|
316
|
+
}, lang, read?.facts);
|
|
111
317
|
await updateProject(userId, projectId, {
|
|
112
318
|
brand: {
|
|
113
319
|
name,
|
|
114
320
|
...(about ? { about } : {}),
|
|
115
321
|
...(colors.length ? { colors } : {}),
|
|
322
|
+
...(fonts.length ? { fonts: fonts.map((f) => ({ ...f, id: nanoid(10) })) } : {}),
|
|
116
323
|
},
|
|
324
|
+
...(facts.added ? { facts: facts.facts } : {}),
|
|
117
325
|
});
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
326
|
+
const host = new URL(reading.url).hostname;
|
|
327
|
+
const [logo, assets] = await Promise.all([
|
|
328
|
+
(async () => {
|
|
329
|
+
const first = reading.brand.logos[0];
|
|
330
|
+
if (!first || (await projectFiles(projectId, "logo")).length > 0) {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
return keep(projectId, first.url, "logo", first.hint);
|
|
334
|
+
})(),
|
|
335
|
+
(async () => {
|
|
336
|
+
if ((await projectFiles(projectId, "asset")).length > 0) {
|
|
337
|
+
return 0;
|
|
338
|
+
}
|
|
339
|
+
const pictures = reading.brand.images.filter((i) => i.hero).slice(0, ASSETS);
|
|
340
|
+
const until = AbortSignal.timeout(30_000);
|
|
341
|
+
let kept = 0;
|
|
342
|
+
// One after the other: the brand material keeps the page's order.
|
|
343
|
+
for (const picture of pictures) {
|
|
344
|
+
const description = picture.alt.startsWith("share image")
|
|
345
|
+
? `share image of ${host}`
|
|
346
|
+
: picture.alt || `picture on the home page of ${host}`;
|
|
347
|
+
kept += Number(await keep(projectId, picture.url, "asset", description, until));
|
|
348
|
+
}
|
|
349
|
+
return kept;
|
|
350
|
+
})(),
|
|
351
|
+
]);
|
|
352
|
+
return {
|
|
353
|
+
name,
|
|
354
|
+
about: Boolean(about),
|
|
355
|
+
colors: colors.length,
|
|
356
|
+
fonts: fonts.length,
|
|
357
|
+
logo,
|
|
358
|
+
facts: facts.added,
|
|
359
|
+
assets,
|
|
360
|
+
};
|
|
124
361
|
}
|
|
125
|
-
|
|
126
|
-
async function
|
|
362
|
+
/** A picture of the site kept in the space; one that cannot be fetched is no loss. */
|
|
363
|
+
async function keep(projectId, url, kind, description, signal = AbortSignal.timeout(15_000)) {
|
|
127
364
|
try {
|
|
128
|
-
|
|
129
|
-
const mime = res.headers.get("content-type")?.split(";")[0].trim().toLowerCase() ?? "";
|
|
130
|
-
if (!res.ok || !mime.startsWith("image/")) {
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
const data = new Uint8Array(await res.arrayBuffer());
|
|
134
|
-
if (data.byteLength === 0 || data.byteLength > LOGO_BYTES) {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
const name = decodeURIComponent(new URL(url).pathname.split("/").pop() || "logo");
|
|
138
|
-
await addProjectFile(projectId, {
|
|
139
|
-
kind: "logo",
|
|
140
|
-
name,
|
|
141
|
-
mime,
|
|
142
|
-
data,
|
|
143
|
-
description: hint || undefined,
|
|
144
|
-
source: url,
|
|
145
|
-
});
|
|
365
|
+
await addProjectFileFromUrl(projectId, { url, kind, description, signal });
|
|
146
366
|
return true;
|
|
147
367
|
}
|
|
148
368
|
catch {
|
|
149
|
-
//
|
|
369
|
+
// The person adds it under Space → Logos or Brand material.
|
|
150
370
|
return false;
|
|
151
371
|
}
|
|
152
372
|
}
|
|
@@ -117,22 +117,24 @@ function wizardSlug(title, taken) {
|
|
|
117
117
|
taken.add(slug);
|
|
118
118
|
return slug;
|
|
119
119
|
}
|
|
120
|
-
/** The
|
|
121
|
-
export async function
|
|
120
|
+
/** The organization's page data as Manage expects it; null where this runtime is not an organization's. */
|
|
121
|
+
export async function pageOrganization() {
|
|
122
122
|
if (!managed) {
|
|
123
123
|
return null;
|
|
124
124
|
}
|
|
125
125
|
const tenantId = currentTenant();
|
|
126
|
-
const
|
|
127
|
-
// Only one space of
|
|
126
|
+
const organization = await tenantInfo(tenantId);
|
|
127
|
+
// Only one space of an organization has its page on (services/projects.ts).
|
|
128
128
|
const spaces = await db.query.project.findMany({
|
|
129
129
|
where: eq(schema.project.tenantId, tenantId),
|
|
130
130
|
});
|
|
131
|
-
// Behind its switch the
|
|
132
|
-
const space = feature("pages",
|
|
131
|
+
// Behind its switch the organization has no page: what Manage holds is sent as none.
|
|
132
|
+
const space = feature("pages", organization.features)
|
|
133
|
+
? (spaces.find((p) => p.page?.on) ?? null)
|
|
134
|
+
: null;
|
|
133
135
|
const page = space?.page;
|
|
134
136
|
const lang = page?.lang ?? "de";
|
|
135
|
-
const base = { slug:
|
|
137
|
+
const base = { slug: organization.slug ?? tenantId, name: organization.name, lang };
|
|
136
138
|
if (!(space && page)) {
|
|
137
139
|
return { ...base, space: null };
|
|
138
140
|
}
|
|
@@ -217,7 +219,7 @@ export async function pageTeam() {
|
|
|
217
219
|
};
|
|
218
220
|
}
|
|
219
221
|
/**
|
|
220
|
-
* Where the
|
|
222
|
+
* Where the organization's page is opened: `https://<host>`; on a `.localhost` domain in development
|
|
221
223
|
* `http://<host>:<Manage's port>`, as Manage serves it there.
|
|
222
224
|
*/
|
|
223
225
|
export function pageOrigin(host) {
|
|
@@ -227,18 +229,18 @@ export function pageOrigin(host) {
|
|
|
227
229
|
}
|
|
228
230
|
return `https://${host}`;
|
|
229
231
|
}
|
|
230
|
-
/** What the studio's "Public page" part shows beside its fields: the
|
|
232
|
+
/** What the studio's "Public page" part shows beside its fields: the organization's address and page data. */
|
|
231
233
|
export async function pagePreview() {
|
|
232
234
|
if (!managed) {
|
|
233
|
-
return { host: null, origin: null,
|
|
235
|
+
return { host: null, origin: null, organization: null };
|
|
234
236
|
}
|
|
235
|
-
const
|
|
236
|
-
const host = feature("pages",
|
|
237
|
-
return { host, origin: host ? pageOrigin(host) : null,
|
|
237
|
+
const organization = await tenantInfo(currentTenant());
|
|
238
|
+
const host = feature("pages", organization.features) ? (organization.pagesHost ?? null) : null;
|
|
239
|
+
return { host, origin: host ? pageOrigin(host) : null, organization: await pageOrganization() };
|
|
238
240
|
}
|
|
239
241
|
let last = Promise.resolve();
|
|
240
242
|
/**
|
|
241
|
-
* Sends the
|
|
243
|
+
* Sends the organization's page data to Manage, whole; a space switched off or with no listed wizard
|
|
242
244
|
* published and shared is sent as none. Not waited for by the change that caused it: a failure
|
|
243
245
|
* is logged, and the next change sends everything again. `pagesSettled` waits for the last send.
|
|
244
246
|
*/
|
|
@@ -247,7 +249,7 @@ export function pushPages() {
|
|
|
247
249
|
return;
|
|
248
250
|
}
|
|
249
251
|
const send = async () => {
|
|
250
|
-
const data = await
|
|
252
|
+
const data = await pageOrganization();
|
|
251
253
|
if (data) {
|
|
252
254
|
await putPages(currentTenant(), data);
|
|
253
255
|
}
|
|
@@ -364,7 +364,7 @@ export async function updateWizardSettings(userId, wizardId, patch) {
|
|
|
364
364
|
.update(schema.wizard)
|
|
365
365
|
.set({ ...patch, ...(runners ? { runners } : {}), updatedAt: new Date() })
|
|
366
366
|
.where(eq(schema.wizard.id, w.id));
|
|
367
|
-
// Switched off, the wizard leaves the
|
|
367
|
+
// Switched off, the wizard leaves the organization's public page; on, it may return to it.
|
|
368
368
|
if (patch.shareEnabled !== undefined && patch.shareEnabled !== w.shareEnabled) {
|
|
369
369
|
pushPages();
|
|
370
370
|
}
|
|
@@ -451,7 +451,7 @@ export async function publishWizard(userId, wizardId) {
|
|
|
451
451
|
.update(schema.wizard)
|
|
452
452
|
.set({ publishedVersion: version, updatedAt: new Date() })
|
|
453
453
|
.where(eq(schema.wizard.id, w.id));
|
|
454
|
-
// The
|
|
454
|
+
// The organization's public page shows the new version's title, results and steps.
|
|
455
455
|
pushPages();
|
|
456
456
|
return { version, shareUrl: shareUrl(w.shareToken), shareEnabled: w.shareEnabled };
|
|
457
457
|
}
|
|
@@ -93,14 +93,14 @@ const EN = {
|
|
|
93
93
|
onlyAvailableComputer: "This is only available on your computer.",
|
|
94
94
|
somethingWentWrongTry: "Something went wrong. Try again.",
|
|
95
95
|
unknownApp: "Unknown app.",
|
|
96
|
-
|
|
96
|
+
onlyOrganizationAdminsChange: "Only organization admins can change its models.",
|
|
97
97
|
notAvailableCloud: "This isn’t available in the cloud.",
|
|
98
98
|
noApiKeySet: "No API key is set.",
|
|
99
|
-
|
|
99
|
+
onlyOrganizationAdminsTest: "Only organization admins can test its models.",
|
|
100
100
|
notFound: "This doesn’t exist or was deleted.",
|
|
101
101
|
ownKeysNotInPlan: "Your own API keys aren’t part of the {plan} plan.",
|
|
102
|
-
|
|
103
|
-
planUnavailable: "The
|
|
102
|
+
ownKeysNotInOrganizationPlan: "Your own API keys aren’t part of the organization’s plan.",
|
|
103
|
+
planUnavailable: "The organization’s plan can’t be checked right now. Try again later.",
|
|
104
104
|
shareEmailName: "Email",
|
|
105
105
|
shareEmailDescription: "As attachments to one or more addresses",
|
|
106
106
|
shareTo: "To",
|
|
@@ -155,6 +155,24 @@ const EN = {
|
|
|
155
155
|
shareInterrupted: "Sending was interrupted. Try again.",
|
|
156
156
|
shareNotInResult: "“{name}” ({format}) is not part of this result.",
|
|
157
157
|
shareCannotRender: "“{name}” couldn’t be made as {format}. Choose another format.",
|
|
158
|
+
// The labels of the facts the first visit reads from a website, as the Info & brand page has them.
|
|
159
|
+
factAddress: "Address",
|
|
160
|
+
factPostcode: "Postcode",
|
|
161
|
+
factCity: "City",
|
|
162
|
+
factVatId: "VAT ID",
|
|
163
|
+
factPhone: "Phone",
|
|
164
|
+
factEmail: "Email",
|
|
165
|
+
factWebsite: "Website",
|
|
166
|
+
factCompany: "Company",
|
|
167
|
+
factRegister: "Company register number",
|
|
168
|
+
factRegisterCourt: "Register court",
|
|
169
|
+
factTradeRegister: "Commercial register number",
|
|
170
|
+
factTradeRegisterCourt: "Register court",
|
|
171
|
+
factManagement: "Management",
|
|
172
|
+
// What the first visit writes as the purpose of a brand font.
|
|
173
|
+
fontRoleAll: "Headings and body text",
|
|
174
|
+
fontRoleHeadings: "Headings",
|
|
175
|
+
fontRoleText: "Body text",
|
|
158
176
|
};
|
|
159
177
|
const DE = {
|
|
160
178
|
keyUnknown: "Der Anbieter kennt diesen API-Key nicht.",
|
|
@@ -245,14 +263,14 @@ const DE = {
|
|
|
245
263
|
onlyAvailableComputer: "Das gibt es nur auf deinem Computer.",
|
|
246
264
|
somethingWentWrongTry: "Da ist etwas schiefgelaufen. Versuch es noch einmal.",
|
|
247
265
|
unknownApp: "Diese App gibt es nicht.",
|
|
248
|
-
|
|
266
|
+
onlyOrganizationAdminsChange: "Nur Admins der Organisation ändern ihre Modelle.",
|
|
249
267
|
notAvailableCloud: "Das gibt es nicht in der Cloud.",
|
|
250
268
|
noApiKeySet: "Kein API-Key hinterlegt.",
|
|
251
|
-
|
|
269
|
+
onlyOrganizationAdminsTest: "Nur Admins der Organisation testen ihre Modelle.",
|
|
252
270
|
notFound: "Das gibt es nicht oder nicht mehr.",
|
|
253
271
|
ownKeysNotInPlan: "Eigene API-Keys gibt es nicht im Paket {plan}.",
|
|
254
|
-
|
|
255
|
-
planUnavailable: "Das Paket
|
|
272
|
+
ownKeysNotInOrganizationPlan: "Eigene API-Keys gibt es nicht im Paket der Organisation.",
|
|
273
|
+
planUnavailable: "Das Paket der Organisation lässt sich gerade nicht prüfen. Versuch es später noch einmal.",
|
|
256
274
|
shareEmailName: "E-Mail",
|
|
257
275
|
shareEmailDescription: "Als Anhang an eine oder mehrere Adressen",
|
|
258
276
|
shareTo: "An",
|
|
@@ -307,6 +325,22 @@ const DE = {
|
|
|
307
325
|
shareInterrupted: "Das Senden wurde unterbrochen. Versuch es noch einmal.",
|
|
308
326
|
shareNotInResult: "„{name}“ ({format}) gehört nicht zu diesem Ergebnis.",
|
|
309
327
|
shareCannotRender: "„{name}“ ließ sich nicht als {format} erstellen. Wähle ein anderes Format.",
|
|
328
|
+
factAddress: "Adresse",
|
|
329
|
+
factPostcode: "PLZ",
|
|
330
|
+
factCity: "Ort",
|
|
331
|
+
factVatId: "USt-IdNr.",
|
|
332
|
+
factPhone: "Telefon",
|
|
333
|
+
factEmail: "E-Mail",
|
|
334
|
+
factWebsite: "Website",
|
|
335
|
+
factCompany: "Firmenname",
|
|
336
|
+
factRegister: "Firmenbuchnummer",
|
|
337
|
+
factRegisterCourt: "Firmenbuchgericht",
|
|
338
|
+
factTradeRegister: "Handelsregisternummer",
|
|
339
|
+
factTradeRegisterCourt: "Registergericht",
|
|
340
|
+
factManagement: "Geschäftsführung",
|
|
341
|
+
fontRoleAll: "Überschriften und Fließtext",
|
|
342
|
+
fontRoleHeadings: "Überschriften",
|
|
343
|
+
fontRoleText: "Fließtext",
|
|
310
344
|
};
|
|
311
345
|
export const SERVER_TEXTS = { en: EN, de: DE };
|
|
312
346
|
/** A line of the server's table in a language; English where the language lacks it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{$t as r,
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{$t as r,Bt as i,Ht as a,Jt as o,Mr as s,Rr as c,Ut as l,Vt as u,Zt as d,on as f,sr as p}from"./ui-CJCF3Mhe.js";import{t as m}from"./preload-helper-DpV6A1kQ.js";import{t as h}from"./logo-CGNoptDg.js";import{G as g,nt as _,rt as v}from"./index-Da7hPToW.js";import{c as y,f as b}from"./settings-menu-ay9jNbQu.js";import{ReleaseNotes as x,loadReleases as S,releaseDate as C,releaseLabel as w}from"./ChangelogDialog-DfWTNzyl.js";var T=e(t(),1),E=[{name:`engenty wizards`,description:`credit.engenty-wizards`,homepage:`https://github.com/engenty/wizards`,license:`FSL-1.1-MIT`},{name:`engenty`,description:`credit.engenty`,homepage:`https://github.com/engenty/engenty`,license:`FSL-1.1-MIT`}],D=[{name:`Mastra`,description:`credit.mastra`,homepage:`https://github.com/mastra-ai/mastra`,license:`Apache-2.0`},{name:`AI SDK`,description:`credit.ai-sdk`,homepage:`https://github.com/vercel/ai`,license:`Apache-2.0`},{name:`Model Context Protocol`,description:`credit.model-context-protocol`,homepage:`https://github.com/modelcontextprotocol/typescript-sdk`,license:`MIT`},{name:`Hono`,description:`credit.hono`,homepage:`https://github.com/honojs/hono`,license:`MIT`},{name:`Drizzle ORM`,description:`credit.drizzle-orm`,homepage:`https://github.com/drizzle-team/drizzle-orm`,license:`Apache-2.0`},{name:`libSQL`,description:`credit.libsql`,homepage:`https://github.com/tursodatabase/libsql`,license:`MIT`},{name:`Playwright`,description:`credit.playwright`,homepage:`https://github.com/microsoft/playwright`,license:`Apache-2.0`},{name:`React`,description:`credit.react`,homepage:`https://github.com/facebook/react`,license:`MIT`},{name:`Vite`,description:`credit.vite`,homepage:`https://github.com/vitejs/vite`,license:`MIT`},{name:`Tailwind CSS`,description:`credit.tailwind-css`,homepage:`https://github.com/tailwindlabs/tailwindcss`,license:`MIT`},{name:`React Flow`,description:`credit.react-flow`,homepage:`https://github.com/xyflow/xyflow`,license:`MIT`},{name:`TanStack Query`,description:`credit.tanstack-query`,homepage:`https://github.com/TanStack/query`,license:`MIT`},{name:`xterm.js`,description:`credit.xterm-js`,homepage:`https://github.com/xtermjs/xterm.js`,license:`MIT`},{name:`Lucide`,description:`credit.lucide`,homepage:`https://github.com/lucide-icons/lucide`,license:`ISC`},{name:`Geist & Geist Mono`,description:`credit.geist-geist-mono`,homepage:`https://github.com/vercel/geist-font`,license:`OFL-1.1`},{name:`Space Grotesk`,description:`credit.space-grotesk`,homepage:`https://github.com/floriankarsten/space-grotesk`,license:`OFL-1.1`},{name:`git-cliff`,description:`credit.git-cliff`,homepage:`https://github.com/orhun/git-cliff`,license:`MIT OR Apache-2.0`}],O=e(n(),1),k=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function A({name:e,homepage:t,version:n,license:r,description:i}){return(0,O.jsxs)(`li`,{className:`py-2.5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,O.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-[0.875rem] text-ink underline-offset-4 hover:underline`,children:[e,(0,O.jsx)(s,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,O.jsx)(`span`,{className:`font-medium text-[0.875rem] text-ink`,children:e}),n?(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:n}):null,(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:r})]}),i?(0,O.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:i}):null]})}function j({title:e,hint:t,children:n}){return(0,O.jsxs)(`section`,{className:`mt-6`,children:[(0,O.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:e}),t?(0,O.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3`,children:t}):null,n]})}function M({credits:e}){return(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,O.jsx)(A,{name:e.name,homepage:e.homepage,license:e.license,description:f(e.description)},e.name))})}function N({label:e,packages:t}){return(0,O.jsxs)(`div`,{className:`mt-4`,children:[(0,O.jsx)(`h4`,{className:`font-medium text-[0.75rem] text-ink-3 tracking-wide`,children:e}),(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,O.jsx)(A,{...e},e.name))})]})}function P({active:e}){let[t,n]=(0,T.useState)(null),[r,i]=(0,T.useState)(``);(0,T.useEffect)(()=>{if(!e||t)return;let r=!1;return m(()=>import(`./oss-credits-C2JUsf2d.js`).then(e=>{r||n(e.default)}),[]),()=>{r=!0}},[e,t]),(0,T.useEffect)(()=>{e||i(``)},[e]);let a=r.trim().toLowerCase(),s=e=>a?e.filter(e=>k(a,e.name,e.license,f(e.description))):e,c=e=>a?e.filter(e=>k(a,e.name,e.license,e.version)):e,d=s(E),p=s(D),h=t?[{id:`shared`,label:f(`about.creditsShared`),packages:c(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:c(e.packages)}))].filter(e=>e.packages.length>0):[],g=d.length===0&&p.length===0&&h.length===0;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:f(`about.creditsHint`)}),(0,O.jsx)(l,{type:`search`,value:r,placeholder:f(`about.search`),onChange:e=>i(e.target.value)}),d.length>0?(0,O.jsx)(j,{title:f(`about.creditsProduct`),children:(0,O.jsx)(M,{credits:d})}):null,p.length>0?(0,O.jsx)(j,{title:f(`about.creditsBuiltWith`),children:(0,O.jsx)(M,{credits:p})}):null,t===null?(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,O.jsx)(o,{})}):h.length>0?(0,O.jsx)(j,{title:f(`about.creditsDeps`),hint:a?void 0:f(`about.creditsDepsHint`),children:h.map(e=>(0,O.jsx)(N,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&g?(0,O.jsx)(u,{children:f(`about.noMatches`)}):null]})}var F=[`new`,`earlier`,`credits`],I=e=>f(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),L=e=>e===1?f(`about.change`):f(`about.changes`,{n:e});function R({me:e,active:t,initialTab:n=`new`}){let i=e?.mode===`local`,{data:a,latest:s}=_(i&&t),[l,u]=(0,T.useState)(null),[p,m]=(0,T.useState)(n);(0,T.useEffect)(()=>m(n),[n]);let E=b(F.indexOf(p)),D=a?.newer&&s?s:v;(0,T.useEffect)(()=>{if(!t)return;let e=!1;return u(null),S(D===`0.9.7`?void 0:D).then(t=>{e||u(t)}),()=>{e=!0}},[t,D]);let k=l?.find(e=>e.version===`v${D}`)??l?.[0]??null,A=l?.filter(e=>e!==k)??[],j=i?a?.kind??null:`cloud`;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-center pt-4 text-center`,children:[(0,O.jsx)(h,{size:96}),(0,O.jsxs)(`div`,{className:`mt-4 font-display font-semibold text-[1.5rem] tracking-tight`,children:[`engenty`,(0,O.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,O.jsx)(`span`,{className:`ml-1.5 font-normal text-ink-3`,children:`wizards`})]}),(0,O.jsxs)(`div`,{className:`mt-1 text-[0.9375rem] text-ink-3 tabular-nums`,children:[f(`about.version`,{v}),j?` · ${f(`about.kind.${j}`)}`:``]})]}),i?(0,O.jsx)(`div`,{className:`mt-5`,children:(0,O.jsx)(g,{enabled:t})}):null,(0,O.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,O.jsx)(d,{value:p,onChange:m,options:F.map(e=>({id:e,label:I(e)})),label:f(`about.title`)})}),(0,O.jsxs)(`div`,{className:r(`mt-5`,y(E)),children:[p===`new`?l===null?(0,O.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,O.jsx)(o,{})}):k?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[w(k),(0,O.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:C(k)})]}),(0,O.jsx)(`div`,{className:`mt-3`,children:(0,O.jsx)(x,{release:k})})]}):(0,O.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:f(`about.changelogEmpty`)}):null,p===`earlier`?(0,O.jsx)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:A.map(e=>(0,O.jsxs)(`details`,{className:`group/r py-2`,children:[(0,O.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-baseline gap-3 text-[0.875rem] [&::-webkit-details-marker]:hidden`,children:[(0,O.jsx)(c,{className:`size-3.5 shrink-0 self-center text-ink-4 transition group-open/r:rotate-90`}),(0,O.jsx)(`span`,{className:`font-medium text-ink tabular-nums`,children:w(e)}),(0,O.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:C(e)}),(0,O.jsx)(`span`,{className:`ml-auto text-[0.8125rem] text-ink-4`,children:L(e.commits.length)})]}),(0,O.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,O.jsx)(x,{release:e})})]},e.version??`unreleased`))}):null,p===`credits`?(0,O.jsx)(P,{active:!0}):null]},p)]})}function z({open:e,onClose:t,me:n}){return(0,O.jsxs)(i,{open:e,onClose:t,wide:!0,height:`tall`,children:[(0,O.jsx)(`div`,{className:`-mt-2 -mr-2 sticky top-0 z-10 flex h-0 justify-end`,children:(0,O.jsx)(a,{label:f(`common.close`),onClick:t,children:(0,O.jsx)(p,{className:`size-4`})})}),(0,O.jsx)(R,{me:n,active:e})]})}export{z as AboutDialog,R as AboutPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{$t as r,Bt as i,Jt as a,Ut as o,Vt as s,on as c}from"./ui-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{$t as r,Bt as i,Jt as a,Ut as o,Vt as s,on as c}from"./ui-CJCF3Mhe.js";import{t as l}from"./preload-helper-DpV6A1kQ.js";var u=e(t(),1),d=e(n(),1);function f(e){switch(e.group){case`Added`:return{label:`NEW`,dot:`bg-moss`};case`Fixed`:return{label:`FIXED`,dot:`bg-amber`};case`Changed`:return{label:`CHANGED`,dot:`bg-cobalt`};case`Performance`:return{label:`PERFORMANCE`,dot:`bg-ember`};case`Deploy`:return{label:`DEPLOY`,dot:`bg-ink-4`};case`Docs`:return{label:`DOCS`,dot:`bg-ink-4`};default:return{label:`OTHER`,dot:`bg-ink-4`}}}var p=e=>e.version?e.version.replace(/^v/,``):c(`about.unreleased`),m=e=>e.timestamp?new Date(e.timestamp*1e3).toISOString().slice(0,10):``,h=e=>e.charAt(0).toUpperCase()+e.slice(1);function g(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=[];for(let t of e){if(`${p(t)} ${m(t)}`.toLowerCase().includes(n)){r.push(t);continue}let e=t.commits.filter(e=>`${f(e).label} ${e.scope??``} ${e.message}`.toLowerCase().includes(n));e.length>0&&r.push({...t,commits:e})}return r}async function _(e){if(e)try{let t=await fetch(`https://raw.githubusercontent.com/engenty/wizards/v${e}/apps/web/src/about/changelog.json`,{signal:AbortSignal.timeout(5e3)});if(t.ok)return await t.json()}catch{}return(await l(async()=>{let{default:e}=await import(`./changelog-CjSBB-a4.js`);return{default:e}},[])).default}function v({release:e}){return(0,d.jsx)(`ul`,{className:`flex flex-col gap-2`,children:e.commits.map(e=>{let t=f(e);return(0,d.jsxs)(`li`,{className:`flex items-start gap-2.5 text-[0.875rem]`,children:[(0,d.jsx)(`span`,{className:r(`mt-[7px] size-1.5 shrink-0 rounded-full`,t.dot)}),(0,d.jsxs)(`span`,{className:`min-w-0 text-ink-2`,children:[(0,d.jsxs)(`span`,{className:`font-semibold text-[0.75rem] text-ink tracking-wide`,children:[t.label,e.scope?` [${e.scope}]`:``]}),` `,h(e.message),e.breaking?(0,d.jsx)(`span`,{className:`ml-1.5 rounded-full bg-rose-tint px-1.5 py-0.5 font-medium text-[0.75rem] text-rose`,children:c(`about.breaking`)}):null]})]},e.id)})})}function y({open:e,onClose:t,version:n}){let[r,l]=(0,u.useState)(null),[f,h]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(!e||r)return;let t=!1;return _(n).then(e=>{t||l(e)}),()=>{t=!0}},[e,r,n]),(0,u.useEffect)(()=>{e||h(``)},[e]);let y=r?g(r,f):[];return(0,d.jsxs)(i,{open:e,onClose:t,title:c(`about.changelog`),wide:!0,height:`tall`,children:[(0,d.jsx)(`p`,{className:`-mt-3 mb-4 text-[0.875rem] text-ink-3`,children:c(`about.changelogHint`)}),r===null?(0,d.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,d.jsx)(a,{})}):r.length===0?(0,d.jsx)(s,{children:c(`about.changelogEmpty`)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(o,{type:`search`,value:f,placeholder:c(`about.search`),onChange:e=>h(e.target.value)}),y.length===0?(0,d.jsx)(s,{children:c(`about.noMatches`)}):null,y.map(e=>(0,d.jsxs)(`section`,{className:`mt-6`,children:[(0,d.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[p(e),(0,d.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:m(e)})]}),(0,d.jsx)(`div`,{className:`mt-3`,children:(0,d.jsx)(v,{release:e})})]},e.version??`unreleased`))]})]})}export{y as ChangelogDialog,v as ReleaseNotes,_ as loadReleases,m as releaseDate,p as releaseLabel};
|