@engenty/wizards-runtime 0.9.3 → 0.9.5
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/README.md +34 -39
- package/apps/runtime/dist/assistant/docs.js +1 -1
- package/apps/runtime/dist/assistant/primer.js +2 -2
- package/apps/runtime/dist/cli/main.js +2 -0
- package/apps/runtime/dist/credits/credits.js +9 -3
- package/apps/runtime/dist/db/migrations/tenant/0020_project_page.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0020_snapshot.json +3475 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +7 -0
- package/apps/runtime/dist/db/schema.js +2 -0
- package/apps/runtime/dist/docs/dev/api.md +1 -1
- package/apps/runtime/dist/docs/dev/integration/channels.md +4 -4
- package/apps/runtime/dist/docs/dev/integration/claude-code-plugin.md +1 -1
- package/apps/runtime/dist/docs/dev/integration/embed.md +1 -1
- package/apps/runtime/dist/docs/dev/integration/index.md +2 -3
- package/apps/runtime/dist/docs/dev/integration/link-and-share.md +1 -1
- package/apps/runtime/dist/docs/dev/integration/mcp-apps.md +1 -1
- package/apps/runtime/dist/docs/dev/integration/mcp.md +1 -1
- package/apps/runtime/dist/docs/dev/integration/meta.json +0 -1
- package/apps/runtime/dist/docs/dev/integration/openui.md +1 -1
- package/apps/runtime/dist/docs/dev/integration/results.md +1 -3
- package/apps/runtime/dist/docs/dev/plugins/routes.md +1 -1
- package/apps/runtime/dist/docs/dev/wizard-format/themes.md +2 -2
- package/apps/runtime/dist/docs/dev/wizard-format/validate.md +1 -1
- package/apps/runtime/dist/docs/meta.json +1 -1
- package/apps/runtime/dist/docs/{user → user-guide}/ai-apps.md +4 -5
- package/apps/runtime/dist/docs/{user → user-guide}/build-a-wizard.md +27 -28
- package/apps/runtime/dist/docs/{user → user-guide}/command-line.md +9 -8
- package/apps/runtime/dist/docs/{user → user-guide}/connectors.md +6 -6
- package/apps/runtime/dist/docs/{user → user-guide}/create-account.md +10 -11
- package/apps/runtime/dist/docs/{user → user-guide}/data.md +5 -5
- package/apps/runtime/dist/docs/{user → user-guide}/first-start.md +5 -5
- package/apps/runtime/dist/docs/{user → user-guide}/index.md +3 -3
- package/apps/runtime/dist/docs/{user → user-guide}/install.md +21 -25
- package/apps/runtime/dist/docs/{user → user-guide}/local-only.md +5 -6
- package/apps/runtime/dist/docs/{user → user-guide}/meta.json +0 -2
- package/apps/runtime/dist/docs/{user → user-guide}/models.md +13 -22
- package/apps/runtime/dist/docs/{user → user-guide}/plugins.md +2 -2
- package/apps/runtime/dist/docs/{user → user-guide}/run.md +21 -36
- package/apps/runtime/dist/docs/{user → user-guide}/server.md +1 -1
- package/apps/runtime/dist/docs/{user → user-guide}/space.md +17 -27
- package/apps/runtime/dist/docs/{user → user-guide}/steps.md +22 -34
- package/apps/runtime/dist/docs/{user → user-guide}/test-and-share.md +32 -75
- package/apps/runtime/dist/docs/{user → user-guide}/troubleshooting.md +3 -4
- package/apps/runtime/dist/engine/runner.js +11 -1
- package/apps/runtime/dist/manage.js +15 -2
- package/apps/runtime/dist/plugins/runs.js +4 -1
- package/apps/runtime/dist/routes/runs.js +4 -1
- package/apps/runtime/dist/routes/studio.js +12 -0
- package/apps/runtime/dist/services/errors.js +1 -0
- package/apps/runtime/dist/services/pages.js +262 -0
- package/apps/runtime/dist/services/projects.js +73 -2
- package/apps/runtime/dist/services/runs.js +2 -0
- package/apps/runtime/dist/services/wizards.js +30 -1
- package/apps/web/dist/assets/{AboutDialog-DsGqq2Es.js → AboutDialog-lUBGgvKu.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-Hn7oDuyx.js → ChangelogDialog-B2IJbKX8.js} +1 -1
- package/apps/web/dist/assets/EditorPage-B1syriTz.js +4 -0
- package/apps/web/dist/assets/{FlowPreview-DZ1XL_o1.js → FlowPreview-BUKI8h6o.js} +1 -1
- package/apps/web/dist/assets/{Harness-BBpl_EUW.js → Harness-D35I3Jlp.js} +2 -2
- package/apps/web/dist/assets/Marketplace-C-ft5u_6.js +2 -0
- package/apps/web/dist/assets/NewWizardChannels-PDeL4f5D.js +1 -0
- package/apps/web/dist/assets/{NewWizardPage-kpm-UyQC.js → NewWizardPage-BHw086HN.js} +2 -2
- package/apps/web/dist/assets/OnboardingPage-BYa8Xekc.js +1 -0
- package/apps/web/dist/assets/PreviewPane-Cuatuhi-.js +4 -0
- package/apps/web/dist/assets/ProjectPage-DTbTN9rE.js +1 -0
- package/apps/web/dist/assets/PublicRunner-BnT-zZrI.js +1 -0
- package/apps/web/dist/assets/{ReadOnly-CcW91P4l.js → ReadOnly-C5fdw_kg.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-Bkd5LuRn.js +2 -0
- package/apps/web/dist/assets/SetupPage-CHnbGccO.js +1 -0
- package/apps/web/dist/assets/{SharePage-CC7V2TYJ.js → SharePage-BiPJsotS.js} +1 -1
- package/apps/web/dist/assets/changelog-Do_saoEi.js +1 -0
- package/apps/web/dist/assets/{coins-RUupcqZx.js → coins-DVGgwSrK.js} +1 -1
- package/apps/web/dist/assets/index-C-u3ZXBZ.js +14 -0
- package/apps/web/dist/assets/index-DtjKnB3s.css +1 -0
- package/apps/web/dist/assets/{phone-ChnpShTU.js → phone-DD2g0U0Q.js} +1 -1
- package/apps/web/dist/assets/runners-D6mK0B73.js +1 -0
- package/apps/web/dist/assets/session-BHCBxqVb.js +2 -0
- package/apps/web/dist/assets/{settings-menu-CLw_oucZ.js → settings-menu-DGDn2688.js} +1 -1
- package/apps/web/dist/assets/theme-DQ10nO_L.js +11 -0
- package/apps/web/dist/assets/ui-BV4KP5n2.js +137 -0
- package/apps/web/dist/assets/{upload-0sFU9K8-.js → upload-uc9uftDy.js} +1 -1
- package/apps/web/dist/assets/{useMutation-1jFwXbI6.js → useMutation-BfQIRblT.js} +1 -1
- package/apps/web/dist/assets/{volume-2-C51sO2X0.js → volume-2-BlaOos9n.js} +1 -1
- package/apps/web/dist/assets/{wrench-DdT-nErU.js → wrench-Cfpkphyw.js} +1 -1
- package/apps/web/dist/index.html +8 -8
- package/apps/web/dist/install.ps1 +1 -1
- package/apps/web/dist/install.sh +1 -1
- package/apps/web/dist/mcp/flow.html +2 -2
- package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +3 -3
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +12 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +12 -0
- package/node_modules/@engenty/wizards-shared/dist/projects.d.ts +36 -0
- package/node_modules/@engenty/wizards-shared/dist/projects.js +25 -0
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +4 -0
- package/node_modules/@engenty/wizards-shared/dist/run.js +8 -0
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +2 -2
- package/apps/runtime/dist/docs/dev/integration/wordpress.md +0 -10
- package/apps/runtime/dist/docs/user/assistant.md +0 -77
- package/apps/runtime/dist/docs/user/wordpress.md +0 -121
- package/apps/web/dist/assets/EditorPage-DsJqhoXy.js +0 -4
- package/apps/web/dist/assets/Marketplace-BF0Rx0VR.js +0 -2
- package/apps/web/dist/assets/NewWizardChannels-WaAOvmzw.js +0 -1
- package/apps/web/dist/assets/OnboardingPage-Birm-hM5.js +0 -1
- package/apps/web/dist/assets/ProjectPage-CqtpxOq5.js +0 -1
- package/apps/web/dist/assets/PublicRunner-CXTHGYHv.js +0 -1
- package/apps/web/dist/assets/RunDrawer-ByvmBv6e.js +0 -4
- package/apps/web/dist/assets/RunnerView-DcduYZly.js +0 -1
- package/apps/web/dist/assets/SettingsPage-Q2CUb7kK.js +0 -2
- package/apps/web/dist/assets/SetupPage-C7mzUoiR.js +0 -1
- package/apps/web/dist/assets/changelog-7DN_qWR2.js +0 -1
- package/apps/web/dist/assets/index-myC3mJie.css +0 -1
- package/apps/web/dist/assets/index-qnpoZzuw.js +0 -14
- package/apps/web/dist/assets/session-DekDyd9S.js +0 -2
- package/apps/web/dist/assets/theme-DjpqxoRe.js +0 -11
- package/apps/web/dist/assets/ui-DRYauuxF.js +0 -137
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Test and share
|
|
3
3
|
description: Try the wizard, publish it, and hand out its link or put it on a website.
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.3
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Test
|
|
@@ -17,8 +17,8 @@ runs it is measured from the latest ones.
|
|
|
17
17
|
## Publish
|
|
18
18
|
|
|
19
19
|
A wizard goes live the first time you share it. “Share” publishes the draft as version 1 as the
|
|
20
|
-
dialog opens, and the dialog says “Published when you shared it”. Nobody has the link
|
|
21
|
-
“Only you” under “Access”
|
|
20
|
+
dialog opens, and the dialog says “Published when you shared it”. Nobody has the link until you hand it
|
|
21
|
+
out, and “Only you” under “Access” switches it off. A draft with issues is not published: the dialog lists
|
|
22
22
|
what to fix first, with “Let the assistant fix it”.
|
|
23
23
|
|
|
24
24
|
After that, the editor’s top bar shows “Publish changes” whenever the draft differs from the
|
|
@@ -40,7 +40,7 @@ the first share. The editor’s top bar and the wizard’s card on the start pag
|
|
|
40
40
|
| “Live · 1 note” | It runs in the cloud, but one step does less there (see “Share”) |
|
|
41
41
|
| “Local” | It is published on your computer without an account. The link only answers on this computer, while engenty wizards is running |
|
|
42
42
|
| “On its way to the cloud” | The version hasn’t arrived on engenty.ai yet. The studio tries again by itself |
|
|
43
|
-
| “Not in the cloud” | engenty.ai
|
|
43
|
+
| “Not in the cloud” | engenty.ai runs no version of it. “Share” says why and what helps. If an older version still runs there, the chip shows that version in amber with a crossed-out cloud |
|
|
44
44
|
|
|
45
45
|
On a card, “Link” copies the address others can open, and the arrow opens it. A wizard that
|
|
46
46
|
runs only on this computer has no address for others. Its “Link” says so and explains how an
|
|
@@ -53,78 +53,38 @@ The ⋯ menu on a card and in the editor has “Duplicate”, “Export as a wiz
|
|
|
53
53
|
|
|
54
54
|
“Share” says who may open the wizard and how others reach it, and it copies the link.
|
|
55
55
|
|
|
56
|
+

|
|
57
|
+
|
|
56
58
|
| Part | Does |
|
|
57
59
|
|---|---|
|
|
58
|
-
| Access | With “Anyone with the link”, anyone can open and fill it in, up to the runs a day set under “Settings”. “Only you” switches the link off: everyone else sees a notice, and you test in the studio |
|
|
59
|
-
| How others reach it | The
|
|
60
|
-
| QR code | One of the links as a QR code to download or print
|
|
61
|
-
| Website | The code for a website (see below)
|
|
62
|
-
| Copy link | The link people open. It opens the first
|
|
63
|
-
| Settings (the gear) | “Limit per day” (50 runs unless you change it, with what that costs at most),
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
| 1 · Access | With “Anyone with the link”, anyone can open and fill it in, up to the runs a day set under “Settings”. “Only you” switches the link off: everyone else sees a notice, and you test in the studio |
|
|
61
|
+
| 2 · How others reach it | The ways the wizard runs (see below). Each row copies its own link. “Change” lets you choose them, from the same list as for a new wizard |
|
|
62
|
+
| 3 · QR code | One of the links as a QR code to download or print |
|
|
63
|
+
| 4 · Website | The code for a website (see below) |
|
|
64
|
+
| 5 · Copy link | The link people open. It opens the first way that is on, and the wizard offers the other on its first page |
|
|
65
|
+
| 6 · Settings (the gear) | “Limit per day” (50 runs unless you change it, with what that costs at most), “Offer a translation” (a machine translation per language, which you can edit), and “Create a new link”: the old link and its QR code stop working, in the cloud too |
|
|
66
|
+
|
|
67
|
+
The picture is from a computer without an account: the box at the top offers “Sign in” and
|
|
68
|
+
“Create account”, and “Access” says “Only on this computer” (see
|
|
69
|
+
[Who can open the link](#who-can-open-the-link)). Where the draft has changes, the dialog says so
|
|
70
|
+
at the top and leads to “Publish changes”.
|
|
66
71
|
|
|
67
72
|
One visitor can start 6 runs an hour.
|
|
68
73
|
|
|
69
|
-
###
|
|
70
|
-
|
|
71
|
-
A wizard can run page by page or as a chat. Where this studio offers them, it can also run as a
|
|
72
|
-
live conversation on top of the chat, or as a video call on a stage with the chat beside it. In
|
|
73
|
-
a conversation or a call, the person talks, and the wizard talks back and sees the camera. For
|
|
74
|
-
now, both need an OpenAI API key under Models. A plugin can add further ways, such as a kiosk
|
|
75
|
-
page or a messenger.
|
|
74
|
+
### Page by page or as a chat
|
|
76
75
|
|
|
77
|
-
A wizard you start on the “New wizard” page runs step by step unless you choose more under “How
|
|
76
|
+
A wizard can run page by page or as a chat. A wizard you start on the “New wizard” page runs step by step unless you choose more under “How
|
|
78
77
|
should it run?”. A wizard without its own choice, such as one from a template or an import, has
|
|
79
|
-
the step-by-step page and the chat switched on. You can change
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
Where a channel can’t take a step, the step goes to the wizard’s page. The person gets a link for
|
|
83
|
-
a photo, a signature or a sign-in, and comes back afterwards. If nobody can hand a step off (for
|
|
84
|
-
example, one that takes minutes on a channel that can’t wait), the row shows “Not possible: …”
|
|
85
|
-
under the channel’s name. A channel that still needs something says so in its row:
|
|
86
|
-
|
|
87
|
-
| The row says | What you can do |
|
|
88
|
-
|---|---|
|
|
89
|
-
| “Not set up yet” | “Set up” opens the channel’s settings inside the dialog. “Back” returns to the rows |
|
|
90
|
-
| “Waiting” | Nothing for now. The channel is waiting for something, for example a number that was requested |
|
|
91
|
-
| “Not in your plan” | “See {plan}” or “See the plans” shows the plan that has it |
|
|
78
|
+
the step-by-step page and the chat switched on. You can change that later under “Change” in the
|
|
79
|
+
share dialog.
|
|
92
80
|
|
|
93
|
-
The cards on the start page show the
|
|
94
|
-
first. Once wizards with two or more statuses are in the space, a row of pills above the cards
|
|
81
|
+
The cards on the start page show the ways that are on as small icons, the link’s own first. Once wizards with two or more statuses are in the space, a row of pills above the cards
|
|
95
82
|
narrows them to one status: “Draft”, “Local”, “Live” or “Not in the cloud”.
|
|
96
83
|
|
|
97
|
-
The link opens the first
|
|
98
|
-
|
|
99
|
-
wizard’s first page, for example “Or: Chat”. An address that is switched off sends people to
|
|
84
|
+
The link opens the first way that is on. The other answers under its own address (`/steps` or
|
|
85
|
+
`/chat`) and is offered on the wizard’s first page, for example “Or: Chat”. An address that is switched off sends people to
|
|
100
86
|
the link instead.
|
|
101
87
|
|
|
102
|
-
### WhatsApp, SMS and calls
|
|
103
|
-
|
|
104
|
-
On engenty.ai a wizard can also run in a WhatsApp chat, by text message and as a phone call,
|
|
105
|
-
where the team’s plan includes them. These channels are not part of the open source engenty
|
|
106
|
-
wizards. On your computer, you get them through your account in the cloud.
|
|
107
|
-
|
|
108
|
-
When you switch one on for a wizard, its row in the share dialog shows the number and the
|
|
109
|
-
**keyword**. Whoever sends the keyword to the number starts the wizard. “Link” copies a link that
|
|
110
|
-
writes the message, and the QR code view draws it. You change the keyword under “Settings”.
|
|
111
|
-
|
|
112
|
-
- **WhatsApp**: one field per message, buttons for up to three choices and a list for more. The
|
|
113
|
-
person sends a photo or a file in the chat, “send location” for a place, and a voice message
|
|
114
|
-
for a text field. A free message can go out within 24 hours of the person’s last one. A wizard
|
|
115
|
-
that finishes later reaches back with an approved template, or waits for the person’s next
|
|
116
|
-
message.
|
|
117
|
-
- **SMS**: text only. Choices come as numbered lines, answered with the number, and a place as a
|
|
118
|
-
typed address. Long texts come as their gist, and every picture, document and the whole result
|
|
119
|
-
as links.
|
|
120
|
-
- **Calls**: the speech model talks, as the chat’s live voice does. It asks for one field at a
|
|
121
|
-
time, reads out the choices and reads email addresses and numbers back. If several wizards are
|
|
122
|
-
on for calls, the call first asks which one.
|
|
123
|
-
|
|
124
|
-
What a channel can’t take (a signature or a sign-in, and by text or phone also a photo or a
|
|
125
|
-
file) arrives as a link to the wizard’s page. The conversation goes on once it has been filled in
|
|
126
|
-
there. “stop” ends a run in a chat, and the keyword starts a new one.
|
|
127
|
-
|
|
128
88
|
### Who can open the link
|
|
129
89
|
|
|
130
90
|
engenty wizards on your computer only answers on `localhost`. The link works on that computer,
|
|
@@ -137,8 +97,7 @@ not for anyone else. To let others run the wizard:
|
|
|
137
97
|
|
|
138
98
|
### In the cloud
|
|
139
99
|
|
|
140
|
-
Once you sign in to an account under Settings → Account,
|
|
141
|
-
arrives on engenty.ai. Your avatar then carries a small cloud, and its menu says “Connected to
|
|
100
|
+
Once you sign in to an account under Settings → Account, your avatar carries a small cloud, and its menu says “Connected to
|
|
142
101
|
engenty.ai” with your credits. The share dialog gives the wizard’s address at engenty.ai, which
|
|
143
102
|
stays the same when you publish again. Where the cloud doesn’t run this version, the dialog says
|
|
144
103
|
so at the top:
|
|
@@ -150,7 +109,7 @@ so at the top:
|
|
|
150
109
|
|
|
151
110
|
Without an account, the dialog says that the wizard runs only on this computer (“Only on this
|
|
152
111
|
computer” under “Access”). It greys out the ways others reach it and offers “Sign in” and “Create
|
|
153
|
-
account”.
|
|
112
|
+
account”.
|
|
154
113
|
|
|
155
114
|
What goes to the cloud and what stays:
|
|
156
115
|
|
|
@@ -158,8 +117,8 @@ What goes to the cloud and what stays:
|
|
|
158
117
|
|---|---|
|
|
159
118
|
| The published version and its files | Drafts and the chat with the assistant |
|
|
160
119
|
| The space’s name, what it says about itself, its colours, facts and logo | Runs and results on your computer |
|
|
161
|
-
| The
|
|
162
|
-
| How the link is shared: on or off, runs a day,
|
|
120
|
+
| The pages and tables of Knowledge, with their categories | What the wizards keep: their lists and notes |
|
|
121
|
+
| How the link is shared: on or off, runs a day, page or chat | Connected accounts, keys, the space’s documents and its connected systems |
|
|
163
122
|
|
|
164
123
|
At engenty.ai/studio you see the space and its runs there. A small laptop icon marks the space,
|
|
165
124
|
and a note says “You edit this space in engenty wizards on your computer.” The studio there
|
|
@@ -195,7 +154,9 @@ has both the step-by-step page and the chat on, you first choose what the websit
|
|
|
195
154
|
<script async src="https://example.com/embed.js" data-wizard="TOKEN" data-mode="bubble" data-label="Questions?" data-text="A quote in 2 minutes"></script>
|
|
196
155
|
```
|
|
197
156
|
|
|
198
|
-
The
|
|
157
|
+
The dialog gives the code once the wizard is published, open to anyone with the link, and
|
|
158
|
+
reachable by others: on your computer that takes an account (see
|
|
159
|
+
[Who can open the link](#who-can-open-the-link)). Until then it says so instead. A chat in the
|
|
199
160
|
page that is switched off for the wizard shows the step-by-step page instead. The chat button
|
|
200
161
|
always opens the chat.
|
|
201
162
|
|
|
@@ -212,9 +173,6 @@ Your website’s own styles reach the button through the class `engenty-wizard-b
|
|
|
212
173
|
button through `engenty-wizard-launcher` and the bubble through `engenty-wizard-bubble`. A page
|
|
213
174
|
shows only one bubble: a second bubble tag does nothing.
|
|
214
175
|
|
|
215
|
-
On WordPress the plugin writes this code for you, and its results show the page: see
|
|
216
|
-
[WordPress](./wordpress.md).
|
|
217
|
-
|
|
218
176
|
## Results people share
|
|
219
177
|
|
|
220
178
|
On the result page, a person can share what they got as a link. The result of a run over the
|
|
@@ -224,5 +182,4 @@ website: see [Share a result](./run.md#share-a-result).
|
|
|
224
182
|
|
|
225
183
|
## Move a wizard
|
|
226
184
|
|
|
227
|
-
Export it as a wizard file (`.wizard`) from its ⋯ menu, and import it in another studio
|
|
228
|
-
the WordPress plugin. See [Build a wizard](./build-a-wizard.md#take-it-with-you).
|
|
185
|
+
Export it as a wizard file (`.wizard`) from its ⋯ menu, and import it in another studio. See [Build a wizard](./build-a-wizard.md#take-it-with-you).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Troubleshooting
|
|
3
3
|
description: What to do when a link no longer works, a client shows as not signed in, or an export fails.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.3
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
`wizards doctor` checks engenty wizards on your computer and says what is wrong. Start there.
|
|
@@ -35,16 +35,15 @@ version: 0.5.0
|
|
|
35
35
|
|
|
36
36
|
| What you see | What to do |
|
|
37
37
|
|---|---|
|
|
38
|
-
| PDF or PNG export, or a step on a website, fails | `wizards doctor` names the browser engenty wizards uses. Install Chrome, Edge or Chromium (on a Mac also Brave), or set `CHROME_PATH` to one; see [Settings](./command-line.md#settings) |
|
|
38
|
+
| PDF or PNG export, or a step on a website, fails | `wizards doctor` names the browser engenty wizards uses. Install Chrome, Edge or Chromium (on a Mac and on Windows also Brave), or set `CHROME_PATH` to one; see [Settings](./command-line.md#settings) |
|
|
39
39
|
| A widget offers no video | Install ffmpeg, or set `FFMPEG_PATH` |
|
|
40
40
|
| “This wizard isn’t available right now.” | The link is switched off, or the account the wizard runs on has no credits left. See [Test and share](./test-and-share.md) |
|
|
41
41
|
| “This wizard has reached its limit for today. Try again tomorrow.” | The link’s runs for the day are used up; the day starts at midnight UTC. Raise “Limit per day” under Settings (the gear) in the share dialog |
|
|
42
42
|
| “You’ve started a lot of runs just now. Try again in an hour.” | One visitor started more runs in an hour than the link allows (`LIMIT_VISITOR_RUNS_PER_HOUR`, see [Settings](./command-line.md#settings)) |
|
|
43
43
|
| “This wizard doesn’t exist or was deleted.” | It is not published, or its link was replaced by a new one |
|
|
44
44
|
| Others can’t open the link | engenty wizards on your computer answers on `localhost` only. See [who can open the link](./test-and-share.md#who-can-open-the-link) |
|
|
45
|
-
| The chat has no phone button, or “Join” stays grey | A live conversation needs “Live voice” or “Video call” switched on for the wizard (see [Channels](./test-and-share.md#channels); your own test run always has it) and an OpenAI API key under Settings → Models |
|
|
46
45
|
| The camera, microphone or location doesn’t work | Allow it in the browser’s site settings (the lock icon in the address bar) |
|
|
47
|
-
| A connector
|
|
46
|
+
| A built-in connector is missing from Settings → Connectors | It needs an OAuth client in the settings file. See [Connectors](./connectors.md) |
|
|
48
47
|
| A step stops at a plugin’s tool | That plugin is not installed here. See [Plugins](./plugins.md) |
|
|
49
48
|
|
|
50
49
|
## Updating
|
|
@@ -51,6 +51,12 @@ export class NoCreditsError extends NotedError {
|
|
|
51
51
|
super(note("wizardRunOutCredits"));
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
/** A visitor's run past the day's or the month's budget for visitors (the Manage-App's guest budget). */
|
|
55
|
+
export class GuestBudgetError extends NotedError {
|
|
56
|
+
constructor() {
|
|
57
|
+
super(note("guestBudget"));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
54
60
|
/** The runs this process drives right now, with the handle that stops each. */
|
|
55
61
|
const active = new Map();
|
|
56
62
|
// --- the line ------------------------------------------------------------------
|
|
@@ -158,7 +164,11 @@ export async function createRun(input) {
|
|
|
158
164
|
}
|
|
159
165
|
// The run's expected cost is held before it starts; what it really costs is booked per call.
|
|
160
166
|
const estimate = await estimateRun(input.wizardId, input.version, input.definition, await stepsWithoutModel(input.definition));
|
|
161
|
-
|
|
167
|
+
const held = await reserveForRun(id, estimate.reserve, input.mode === "live" && !!input.visitorId);
|
|
168
|
+
if (held === "guest_budget") {
|
|
169
|
+
throw new GuestBudgetError();
|
|
170
|
+
}
|
|
171
|
+
if (!held) {
|
|
162
172
|
throw new NoCreditsError();
|
|
163
173
|
}
|
|
164
174
|
await db.insert(schema.run).values({
|
|
@@ -171,8 +171,14 @@ export function verifyKey(key) {
|
|
|
171
171
|
export function grantActive(userId, clientId, tenantId) {
|
|
172
172
|
return call("POST", "/v1/grants/check", { userId, clientId, tenantId });
|
|
173
173
|
}
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
/** `guest`: a visitor started the run, so it counts against the organization's guest budget. */
|
|
175
|
+
export function reserve(tenantId, runId, credits, guest = false) {
|
|
176
|
+
return call("POST", "/v1/reservations", {
|
|
177
|
+
tenantId,
|
|
178
|
+
runId,
|
|
179
|
+
credits,
|
|
180
|
+
...(guest ? { guest: true } : {}),
|
|
181
|
+
});
|
|
176
182
|
}
|
|
177
183
|
export function release(runId) {
|
|
178
184
|
return call("POST", "/v1/reservations/release", { runId });
|
|
@@ -223,6 +229,13 @@ export async function withdrawChannelRequest(id) {
|
|
|
223
229
|
export function bookChannelUsage(id, input) {
|
|
224
230
|
return call("POST", `/v1/tenants/${encodeURIComponent(id)}/channels/usage`, input);
|
|
225
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* The team's public page data, whole (services/pages.ts): Manage keeps it and serves the page at
|
|
234
|
+
* `<slug>.<PAGES_DOMAIN>`. What it answers names the page's address.
|
|
235
|
+
*/
|
|
236
|
+
export function putPages(tenantId, data) {
|
|
237
|
+
return call("PUT", `/v1/pages/${encodeURIComponent(tenantId)}`, data);
|
|
238
|
+
}
|
|
226
239
|
/** A push to the mobile app on one device; the Manage-App holds the APNs and FCM keys. */
|
|
227
240
|
export function pushToDevice(input) {
|
|
228
241
|
return call("POST", "/v1/push", input);
|
|
@@ -6,7 +6,7 @@ import { db, schema, withTenant } from "../db/client.js";
|
|
|
6
6
|
import { answerAsk } from "../engine/asks.js";
|
|
7
7
|
import { watchRun } from "../engine/events.js";
|
|
8
8
|
import { fieldErrorsIn } from "../engine/input.js";
|
|
9
|
-
import { cancel, createRun, goBack, NoCreditsError, RunInputError, retry, reviewStep, submitPage, } from "../engine/runner.js";
|
|
9
|
+
import { cancel, createRun, GuestBudgetError, goBack, NoCreditsError, RunInputError, retry, reviewStep, submitPage, } from "../engine/runner.js";
|
|
10
10
|
import { saveAsset } from "../files/storage.js";
|
|
11
11
|
import { checkUpload } from "../files/upload-check.js";
|
|
12
12
|
import { wizardUnavailable } from "../limits.js";
|
|
@@ -67,6 +67,9 @@ export function runsApiFor(pluginId) {
|
|
|
67
67
|
if (err instanceof ModelUnavailableError) {
|
|
68
68
|
throw new ServiceError("refused", errorText(err, textLang(wizardLang(version.definition))));
|
|
69
69
|
}
|
|
70
|
+
if (err instanceof GuestBudgetError) {
|
|
71
|
+
throw new ServiceError("refused", noteText({ code: "guestBudget" }, wizardLang(version.definition)));
|
|
72
|
+
}
|
|
70
73
|
if (err instanceof NoCreditsError) {
|
|
71
74
|
throw new ServiceError("no_credits", noteText({ code: "wizardRunOutCredits" }, wizardLang(version.definition)));
|
|
72
75
|
}
|
|
@@ -22,7 +22,7 @@ import { fieldErrorsIn } from "../engine/input.js";
|
|
|
22
22
|
import { fromOwner } from "../engine/owner.js";
|
|
23
23
|
import { pushAvailable, setPushDevice } from "../engine/push.js";
|
|
24
24
|
import { liveResources } from "../engine/resources.js";
|
|
25
|
-
import { cancel, createRun, editOutput, goBack, NoCreditsError, projectIdOf, RunConflict, RunInputError, retry, reviewStep, runView, submitPage, talkAllowed, } from "../engine/runner.js";
|
|
25
|
+
import { cancel, createRun, editOutput, GuestBudgetError, goBack, NoCreditsError, projectIdOf, RunConflict, RunInputError, retry, reviewStep, runView, submitPage, talkAllowed, } from "../engine/runner.js";
|
|
26
26
|
import { basePath, env } from "../env.js";
|
|
27
27
|
import { loadAsset, saveAsset } from "../files/storage.js";
|
|
28
28
|
import { checkUpload } from "../files/upload-check.js";
|
|
@@ -409,6 +409,9 @@ export const publicRoutes = new Hono()
|
|
|
409
409
|
return c.json({ runId });
|
|
410
410
|
}
|
|
411
411
|
catch (err) {
|
|
412
|
+
if (err instanceof GuestBudgetError) {
|
|
413
|
+
return refuse(c, { code: "guestBudget" }, 429);
|
|
414
|
+
}
|
|
412
415
|
if (err instanceof NoCreditsError || err instanceof ModelUnavailableError) {
|
|
413
416
|
return refuse(c, { code: "wizardUnavailable" }, 403);
|
|
414
417
|
}
|
|
@@ -51,6 +51,7 @@ import { categoryContents, listKnowledge, resolvePath, valueContents, } from "..
|
|
|
51
51
|
import { writeSummary } from "../services/knowledge-model.js";
|
|
52
52
|
import { applyWebsite, finishOnboarding, needsOnboarding } from "../services/onboarding.js";
|
|
53
53
|
import { exportWizard, importWizard } from "../services/package.js";
|
|
54
|
+
import { pagePreview } from "../services/pages.js";
|
|
54
55
|
import { profileSchema, saveProfile, saveUserLang, userLang, userProfile, } from "../services/profile.js";
|
|
55
56
|
import { addProjectFile, addProjectFileFromUrl, fileView, orderProjectFiles, projectFile, projectFileContent, projectFiles, reindexProjectFile, removeProjectFile, updateProjectFile, } from "../services/project-files.js";
|
|
56
57
|
import { documentText, queueIndex, searchKnowledge } from "../services/project-index.js";
|
|
@@ -236,6 +237,10 @@ export const studio = new Hono()
|
|
|
236
237
|
role: user.role,
|
|
237
238
|
/** The plan the team is on; null alone, or where the Manage-App names none. */
|
|
238
239
|
plan: info?.plan ?? null,
|
|
240
|
+
/** The team's address for its public page (`acme.wizards.page`); null alone, or behind its switch. */
|
|
241
|
+
pagesHost: feature("pages", { ...info?.features, ...person?.features })
|
|
242
|
+
? (info?.pagesHost ?? null)
|
|
243
|
+
: null,
|
|
239
244
|
},
|
|
240
245
|
/** The feature switches: the code's defaults, what the Manage-App says of the team and the person, this install's file. */
|
|
241
246
|
features: features(managed ? { ...info?.features, ...person?.features } : overview?.tenant.features),
|
|
@@ -508,6 +513,8 @@ export const studio = new Hono()
|
|
|
508
513
|
name: p.name,
|
|
509
514
|
brand: p.brand,
|
|
510
515
|
facts: p.facts,
|
|
516
|
+
/** The space's public page; null until it is set up. */
|
|
517
|
+
page: p.page ?? null,
|
|
511
518
|
mcpServers: maskedServers(p),
|
|
512
519
|
wizardCount: p.wizardCount,
|
|
513
520
|
/** `local`: synced from a local install, where it is changed. */
|
|
@@ -524,6 +531,11 @@ export const studio = new Hono()
|
|
|
524
531
|
const patch = projectPatchSchema.parse(await c.req.json());
|
|
525
532
|
await updateProject(c.get("user").id, c.req.param("id"), patch);
|
|
526
533
|
return c.json({ ok: true });
|
|
534
|
+
})
|
|
535
|
+
// The team's public page as Manage will draw it, for the preview beside the page's fields.
|
|
536
|
+
.get("/projects/:id/page", async (c) => {
|
|
537
|
+
await ownedProject(c.get("user").id, c.req.param("id"));
|
|
538
|
+
return c.json(await pagePreview());
|
|
527
539
|
})
|
|
528
540
|
// --- the space's themes: how its wizards' pages look (docs/plans/themes.md) ---
|
|
529
541
|
.get("/projects/:id/themes", async (c) => c.json(await listThemes(c.get("user").id, c.req.param("id"))))
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { langOf, wizardLang, } from "@engenty/wizards-shared/definition";
|
|
2
|
+
import { effortOf } from "@engenty/wizards-shared/marketplace";
|
|
3
|
+
import { resultsOf } from "@engenty/wizards-shared/marketplace-entry";
|
|
4
|
+
import { factType, pageSlugOf, runTheme, } from "@engenty/wizards-shared/projects";
|
|
5
|
+
import { and, eq, inArray } from "drizzle-orm";
|
|
6
|
+
import { db, schema } from "../db/client.js";
|
|
7
|
+
import { env } from "../env.js";
|
|
8
|
+
import { feature } from "../features.js";
|
|
9
|
+
import { managed, putPages, tenantInfo } from "../manage.js";
|
|
10
|
+
import { currentTenant } from "../tenants/tenant.js";
|
|
11
|
+
import { mainLogoId } from "./brand.js";
|
|
12
|
+
/** About how many rows the teaser's step list has. */
|
|
13
|
+
const STEP_ROWS = 5;
|
|
14
|
+
/** Fields whose answer is a file the person brings. */
|
|
15
|
+
const UPLOAD_KINDS = new Set(["file", "image", "audio"]);
|
|
16
|
+
/** Facts that name who stands behind the page, by key. */
|
|
17
|
+
const NAME_KEYS = ["name", "firma", "unternehmen", "company", "firmenname", "kanzlei"];
|
|
18
|
+
/** A wizard's language where the page knows it, else the page's. */
|
|
19
|
+
function pageLangOf(def, fallback) {
|
|
20
|
+
const lang = langOf(wizardLang(def));
|
|
21
|
+
return lang === "de" || lang === "en" ? lang : fallback;
|
|
22
|
+
}
|
|
23
|
+
/** Who acts in a step: the person on a page, in a review or a surface; the AI everywhere else. */
|
|
24
|
+
const by = (step) => step.type === "page" || step.type === "review" || step.type === "surface" ? "you" : "ai";
|
|
25
|
+
/** "A und B", "A, B und C". */
|
|
26
|
+
function joinTitles(titles, lang) {
|
|
27
|
+
if (titles.length <= 1) {
|
|
28
|
+
return titles[0] ?? "";
|
|
29
|
+
}
|
|
30
|
+
const and = lang === "de" ? " und " : " and ";
|
|
31
|
+
return `${titles.slice(0, -1).join(", ")}${and}${titles.at(-1)}`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The way through as the teaser shows it: the steps along the path a run takes when no
|
|
35
|
+
* condition applies (a branch's "otherwise", else the next step), each page, review and result
|
|
36
|
+
* step as written, the AI steps between them merged into one row, and about five rows in all.
|
|
37
|
+
* An `each` step is one step and so one row.
|
|
38
|
+
*/
|
|
39
|
+
export function pageSteps(def, lang) {
|
|
40
|
+
const path = [];
|
|
41
|
+
const seen = new Set();
|
|
42
|
+
let at = 0;
|
|
43
|
+
while (at >= 0 && at < def.steps.length && !seen.has(def.steps[at].id)) {
|
|
44
|
+
const step = def.steps[at];
|
|
45
|
+
seen.add(step.id);
|
|
46
|
+
path.push(step);
|
|
47
|
+
const otherwise = step.next?.find((r) => r.when === undefined && r.ask === undefined);
|
|
48
|
+
if (!otherwise) {
|
|
49
|
+
at += 1;
|
|
50
|
+
}
|
|
51
|
+
else if (otherwise.goto === "end") {
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
at = def.steps.findIndex((s) => s.id === otherwise.goto);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const rows = [];
|
|
59
|
+
for (const step of path) {
|
|
60
|
+
const who = by(step);
|
|
61
|
+
const merge = who === "ai" && step.type !== "result";
|
|
62
|
+
const last = rows.at(-1);
|
|
63
|
+
if (merge && last?.merge) {
|
|
64
|
+
last.titles.push(step.title);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
rows.push({ titles: [step.title], by: who, merge });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const kept = rows.length > STEP_ROWS ? [...rows.slice(0, STEP_ROWS - 1), rows.at(-1)] : rows;
|
|
71
|
+
return kept.map((r) => ({ title: joinTitles(r.titles, lang).slice(0, 80), by: r.by }));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The space's facts as the imprint: who stands behind the page, one line per fact, the postcode
|
|
75
|
+
* and the town as one line after the address, the website apart; null without filled facts.
|
|
76
|
+
*/
|
|
77
|
+
export function imprintOf(facts, fallbackName) {
|
|
78
|
+
const filled = facts.filter((f) => f.value.trim());
|
|
79
|
+
if (!filled.length) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
const named = filled.find((f) => NAME_KEYS.includes(f.key));
|
|
83
|
+
const website = filled.find((f) => f.key === "website" || factType(f) === "url");
|
|
84
|
+
const town = ["plz", "ort"]
|
|
85
|
+
.map((key) => filled.find((f) => f.key === key)?.value.trim())
|
|
86
|
+
.filter(Boolean)
|
|
87
|
+
.join(" ");
|
|
88
|
+
const apart = new Set(["plz", "ort", named?.key, website?.key]);
|
|
89
|
+
const lines = [];
|
|
90
|
+
for (const f of filled) {
|
|
91
|
+
const type = factType(f);
|
|
92
|
+
if (apart.has(f.key) || type === "longtext" || type === "boolean") {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
lines.push(f.value.trim());
|
|
96
|
+
if (f.key === "adresse" && town) {
|
|
97
|
+
lines.push(town);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (town && !lines.includes(town)) {
|
|
101
|
+
lines.push(town);
|
|
102
|
+
}
|
|
103
|
+
const site = website?.value.trim();
|
|
104
|
+
return {
|
|
105
|
+
name: (named?.value.trim() || fallbackName).slice(0, 200),
|
|
106
|
+
lines: lines.map((l) => l.slice(0, 200)).slice(0, 8),
|
|
107
|
+
...(site ? { website: /^https?:\/\//i.test(site) ? site : `https://${site}` } : {}),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** A wizard's address on the page, from its title, unique among the page's wizards; kept once made. */
|
|
111
|
+
function wizardSlug(title, taken) {
|
|
112
|
+
const base = pageSlugOf(title) || "wizard";
|
|
113
|
+
let slug = base;
|
|
114
|
+
for (let n = 2; taken.has(slug); n++) {
|
|
115
|
+
slug = `${base.slice(0, 44)}-${n}`;
|
|
116
|
+
}
|
|
117
|
+
taken.add(slug);
|
|
118
|
+
return slug;
|
|
119
|
+
}
|
|
120
|
+
/** The team's page data as Manage expects it; null where this runtime is not a team's. */
|
|
121
|
+
export async function pageTeam() {
|
|
122
|
+
if (!managed) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
const tenantId = currentTenant();
|
|
126
|
+
const team = await tenantInfo(tenantId);
|
|
127
|
+
// Only one space of a team has its page on (services/projects.ts).
|
|
128
|
+
const spaces = await db.query.project.findMany({
|
|
129
|
+
where: eq(schema.project.tenantId, tenantId),
|
|
130
|
+
});
|
|
131
|
+
// Behind its switch the team has no page: what Manage holds is sent as none.
|
|
132
|
+
const space = feature("pages", team.features) ? (spaces.find((p) => p.page?.on) ?? null) : null;
|
|
133
|
+
const page = space?.page;
|
|
134
|
+
const lang = page?.lang ?? "de";
|
|
135
|
+
const base = { slug: team.slug ?? tenantId, name: team.name, lang };
|
|
136
|
+
if (!(space && page)) {
|
|
137
|
+
return { ...base, space: null };
|
|
138
|
+
}
|
|
139
|
+
const listed = page.wizards.length
|
|
140
|
+
? await db.query.wizard.findMany({
|
|
141
|
+
where: and(eq(schema.wizard.projectId, space.id), inArray(schema.wizard.id, page.wizards), eq(schema.wizard.shareEnabled, true)),
|
|
142
|
+
})
|
|
143
|
+
: [];
|
|
144
|
+
// Addresses made before hold; a wizard new to the page gets one that is free among them.
|
|
145
|
+
const kept = page.slugs ?? {};
|
|
146
|
+
const taken = new Set(Object.values(kept));
|
|
147
|
+
const made = {};
|
|
148
|
+
const wizards = [];
|
|
149
|
+
for (const id of page.wizards) {
|
|
150
|
+
const w = listed.find((x) => x.id === id);
|
|
151
|
+
if (!w || w.publishedVersion === null) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const version = await db.query.wizardVersion.findFirst({
|
|
155
|
+
where: and(eq(schema.wizardVersion.wizardId, w.id), eq(schema.wizardVersion.version, w.publishedVersion)),
|
|
156
|
+
columns: { definition: true },
|
|
157
|
+
});
|
|
158
|
+
if (!version) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
const def = version.definition;
|
|
162
|
+
const wizardLanguage = pageLangOf(def, lang);
|
|
163
|
+
const effort = effortOf(def);
|
|
164
|
+
const uploads = def.steps.some((s) => s.type === "page" && s.fields.some((f) => UPLOAD_KINDS.has(f.kind)));
|
|
165
|
+
const exampleToken = page.examples[w.id];
|
|
166
|
+
const example = exampleToken
|
|
167
|
+
? await db.query.run.findFirst({
|
|
168
|
+
where: and(eq(schema.run.wizardId, w.id), eq(schema.run.shareToken, exampleToken)),
|
|
169
|
+
columns: { status: true, expiresAt: true },
|
|
170
|
+
})
|
|
171
|
+
: null;
|
|
172
|
+
const shown = example?.status === "done" && !(example.expiresAt && example.expiresAt < new Date());
|
|
173
|
+
const slug = kept[w.id] ?? wizardSlug(def.title, taken);
|
|
174
|
+
if (!kept[w.id]) {
|
|
175
|
+
made[w.id] = slug;
|
|
176
|
+
}
|
|
177
|
+
wizards.push({
|
|
178
|
+
slug,
|
|
179
|
+
title: def.title.slice(0, 120),
|
|
180
|
+
description: def.description.slice(0, 600),
|
|
181
|
+
avatar: def.avatar,
|
|
182
|
+
lang: wizardLanguage,
|
|
183
|
+
results: resultsOf(def).slice(0, 12),
|
|
184
|
+
effort: { fields: effort.fields, reviews: effort.reviews, minutes: effort.minutes, uploads },
|
|
185
|
+
steps: pageSteps(def, wizardLanguage),
|
|
186
|
+
runUrl: `${env.publicUrl}/w/${w.shareToken}`,
|
|
187
|
+
...(shown ? { exampleUrl: `${env.publicUrl}/s/${exampleToken}` } : {}),
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
if (Object.keys(made).length) {
|
|
191
|
+
await db
|
|
192
|
+
.update(schema.project)
|
|
193
|
+
.set({ page: { ...page, slugs: { ...kept, ...made } } })
|
|
194
|
+
.where(eq(schema.project.id, space.id));
|
|
195
|
+
}
|
|
196
|
+
if (!wizards.length) {
|
|
197
|
+
return { ...base, space: null };
|
|
198
|
+
}
|
|
199
|
+
const logo = await mainLogoId(space.id);
|
|
200
|
+
return {
|
|
201
|
+
...base,
|
|
202
|
+
space: {
|
|
203
|
+
slug: page.slug,
|
|
204
|
+
title: page.title,
|
|
205
|
+
...(page.headline ? { headline: page.headline } : {}),
|
|
206
|
+
...(page.intro ? { intro: page.intro } : {}),
|
|
207
|
+
lang,
|
|
208
|
+
...(lang === "de" && page.form ? { form: page.form } : {}),
|
|
209
|
+
brand: {
|
|
210
|
+
name: (space.brand.name ?? "").slice(0, 120),
|
|
211
|
+
logoUrl: logo ? `${env.publicUrl}/api/public/logos/${logo}` : null,
|
|
212
|
+
theme: runTheme(space.brand),
|
|
213
|
+
},
|
|
214
|
+
imprint: imprintOf(space.facts, space.brand.name || space.name),
|
|
215
|
+
wizards,
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Where the team's page is opened: `https://<host>`; on a `.localhost` domain in development
|
|
221
|
+
* `http://<host>:<Manage's port>`, as Manage serves it there.
|
|
222
|
+
*/
|
|
223
|
+
export function pageOrigin(host) {
|
|
224
|
+
if (host.endsWith(".localhost")) {
|
|
225
|
+
const port = URL.canParse(env.manage.url) ? new URL(env.manage.url).port : "";
|
|
226
|
+
return `http://${host}${port ? `:${port}` : ""}`;
|
|
227
|
+
}
|
|
228
|
+
return `https://${host}`;
|
|
229
|
+
}
|
|
230
|
+
/** What the studio's "Public page" part shows beside its fields: the team's address and page data. */
|
|
231
|
+
export async function pagePreview() {
|
|
232
|
+
if (!managed) {
|
|
233
|
+
return { host: null, origin: null, team: null };
|
|
234
|
+
}
|
|
235
|
+
const team = await tenantInfo(currentTenant());
|
|
236
|
+
const host = feature("pages", team.features) ? (team.pagesHost ?? null) : null;
|
|
237
|
+
return { host, origin: host ? pageOrigin(host) : null, team: await pageTeam() };
|
|
238
|
+
}
|
|
239
|
+
let last = Promise.resolve();
|
|
240
|
+
/**
|
|
241
|
+
* Sends the team's page data to Manage, whole; a space switched off or with no listed wizard
|
|
242
|
+
* published and shared is sent as none. Not waited for by the change that caused it: a failure
|
|
243
|
+
* is logged, and the next change sends everything again. `pagesSettled` waits for the last send.
|
|
244
|
+
*/
|
|
245
|
+
export function pushPages() {
|
|
246
|
+
if (!managed) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const send = async () => {
|
|
250
|
+
const data = await pageTeam();
|
|
251
|
+
if (data) {
|
|
252
|
+
await putPages(currentTenant(), data);
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
last = last.then(send, send).catch((err) => {
|
|
256
|
+
console.error("[pages] the page was not sent:", err.message);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
/** Resolves once every push so far has been answered or has failed. */
|
|
260
|
+
export function pagesSettled() {
|
|
261
|
+
return last;
|
|
262
|
+
}
|