@wix/himalaya-cli 0.1929.0 → 0.1930.0
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/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +2 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +7 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/chat-web/src/index.d.ts +12 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-chat-web.mjs +19 -9
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{95a3ae045bad903e458ea7a5800e60e1044f0f754a65d7127de66ba62e897068.bin → 7656e5effbeaee2ab20810b9903e7e785d9dffb0a0563f25c2746011cf4e23e9.bin} +1 -1
- package/dist/browser-plane/sw.js +10 -10
- package/dist/cli.mjs +254 -70
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/component-index.md +1 -1
- package/guides/component-reference.json +1 -1
- package/guides/component-reference.md +7 -0
- package/guides/sdk-reference.json +2 -2
- package/package.json +2 -2
- package/templates/bare-fashion/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/beauty-salon/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/beauty-salon-owner/dev/index.ts +169 -139
- package/templates/beauty-salon-owner/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/beauty-salon-owner/tier5-src/_shared/owner-maestro-availability.ts +12 -2
- package/templates/beauty-salon-owner/tier5-src/_shared/owner-maestro-tab.ts +81 -5
- package/templates/beauty-salon-owner/tier5-src/_shared/owner-selected-site.ts +15 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/owner-widget-reads.ts +7 -0
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-home/index.ts +30 -8
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-inbox/index.ts +47 -8
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +12 -5
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-maestro/index.ts +132 -39
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +10 -8
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-order/index.ts +4 -1
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-record/index.ts +7 -1
- package/templates/beauty-salon-owner/tier5-src/wix-owner-booking/index.ts +4 -1
- package/templates/branded-lite/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/brandy/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/community-club/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/community-club-owner/dev/index.ts +167 -132
- package/templates/community-club-owner/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/community-club-owner/tier5-src/_shared/owner-maestro-availability.ts +12 -2
- package/templates/community-club-owner/tier5-src/_shared/owner-maestro-tab.ts +81 -5
- package/templates/community-club-owner/tier5-src/_shared/owner-selected-site.ts +15 -0
- package/templates/community-club-owner/tier5-src/_shared/owner-widget-reads.ts +7 -0
- package/templates/community-club-owner/tier5-src/himi-owner-lite-home/index.ts +30 -8
- package/templates/community-club-owner/tier5-src/himi-owner-lite-inbox/index.ts +47 -8
- package/templates/community-club-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +12 -5
- package/templates/community-club-owner/tier5-src/himi-owner-lite-maestro/index.ts +132 -39
- package/templates/community-club-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +10 -8
- package/templates/community-club-owner/tier5-src/himi-owner-lite-order/index.ts +4 -1
- package/templates/community-club-owner/tier5-src/himi-owner-lite-record/index.ts +7 -1
- package/templates/conference/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/events-meetups/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/events-meetups-owner/dev/index.ts +165 -125
- package/templates/events-meetups-owner/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/events-meetups-owner/tier5-src/_shared/owner-maestro-availability.ts +12 -2
- package/templates/events-meetups-owner/tier5-src/_shared/owner-maestro-tab.ts +81 -5
- package/templates/events-meetups-owner/tier5-src/_shared/owner-selected-site.ts +15 -0
- package/templates/events-meetups-owner/tier5-src/_shared/owner-widget-reads.ts +7 -0
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-home/index.ts +30 -8
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-inbox/index.ts +47 -8
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +12 -5
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-maestro/index.ts +132 -39
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +10 -8
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-record/index.ts +7 -1
- package/templates/fitness-gym/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/gym-fitness/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/gym-fitness-owner/dev/index.ts +169 -139
- package/templates/gym-fitness-owner/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/gym-fitness-owner/tier5-src/_shared/owner-maestro-availability.ts +12 -2
- package/templates/gym-fitness-owner/tier5-src/_shared/owner-maestro-tab.ts +81 -5
- package/templates/gym-fitness-owner/tier5-src/_shared/owner-selected-site.ts +15 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/owner-widget-reads.ts +7 -0
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-home/index.ts +30 -8
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-inbox/index.ts +47 -8
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +12 -5
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-maestro/index.ts +132 -39
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +10 -8
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-order/index.ts +4 -1
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-record/index.ts +7 -1
- package/templates/gym-fitness-owner/tier5-src/wix-owner-booking/index.ts +4 -1
- package/templates/himi-chat/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/medical-services/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/nonprofit-cause/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/nonprofit-cause-owner/dev/index.ts +167 -132
- package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-maestro-availability.ts +12 -2
- package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-maestro-tab.ts +81 -5
- package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-selected-site.ts +15 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-widget-reads.ts +7 -0
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-home/index.ts +30 -8
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-inbox/index.ts +47 -8
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +12 -5
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-maestro/index.ts +132 -39
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +10 -8
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-record/index.ts +7 -1
- package/templates/nonprofit-cause-owner/tier5-src/wix-owner-booking/index.ts +4 -1
- package/templates/owner-lite/dev/index.ts +171 -141
- package/templates/owner-lite/himalaya.content.json +1 -1
- package/templates/owner-lite/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/owner-lite/tier5-src/_shared/owner-maestro-availability.ts +12 -2
- package/templates/owner-lite/tier5-src/_shared/owner-maestro-tab.ts +81 -5
- package/templates/owner-lite/tier5-src/_shared/owner-selected-site.ts +15 -0
- package/templates/owner-lite/tier5-src/_shared/owner-widget-reads.ts +7 -0
- package/templates/owner-lite/tier5-src/himi-owner-lite-home/index.ts +30 -8
- package/templates/owner-lite/tier5-src/himi-owner-lite-inbox/index.ts +47 -8
- package/templates/owner-lite/tier5-src/himi-owner-lite-inbox-thread/index.ts +12 -5
- package/templates/owner-lite/tier5-src/himi-owner-lite-maestro/index.ts +132 -39
- package/templates/owner-lite/tier5-src/himi-owner-lite-maestro-history/index.ts +10 -8
- package/templates/owner-lite/tier5-src/himi-owner-lite-order/index.ts +4 -1
- package/templates/owner-lite/tier5-src/himi-owner-lite-record/index.ts +7 -1
- package/templates/owner-lite/tier5-src/wix-owner-booking/index.ts +4 -1
- package/templates/personal-fitness-trainer/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/podcast-creator/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/podcast-creator-owner/dev/index.ts +167 -132
- package/templates/podcast-creator-owner/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/podcast-creator-owner/tier5-src/_shared/owner-maestro-availability.ts +12 -2
- package/templates/podcast-creator-owner/tier5-src/_shared/owner-maestro-tab.ts +81 -5
- package/templates/podcast-creator-owner/tier5-src/_shared/owner-selected-site.ts +15 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/owner-widget-reads.ts +7 -0
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-home/index.ts +30 -8
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-inbox/index.ts +47 -8
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +12 -5
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-maestro/index.ts +132 -39
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +10 -8
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-order/index.ts +4 -1
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-record/index.ts +7 -1
- package/templates/portfolio-creative/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/portfolio-creative-owner/dev/index.ts +169 -139
- package/templates/portfolio-creative-owner/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/portfolio-creative-owner/tier5-src/_shared/owner-maestro-availability.ts +12 -2
- package/templates/portfolio-creative-owner/tier5-src/_shared/owner-maestro-tab.ts +81 -5
- package/templates/portfolio-creative-owner/tier5-src/_shared/owner-selected-site.ts +15 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/owner-widget-reads.ts +7 -0
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-home/index.ts +30 -8
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-inbox/index.ts +47 -8
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +12 -5
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-maestro/index.ts +132 -39
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +10 -8
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-order/index.ts +4 -1
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-record/index.ts +7 -1
- package/templates/portfolio-creative-owner/tier5-src/wix-owner-booking/index.ts +4 -1
- package/templates/professional-services/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/restaurant/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/restaurant-owner/dev/index.ts +169 -139
- package/templates/restaurant-owner/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/restaurant-owner/tier5-src/_shared/owner-maestro-availability.ts +12 -2
- package/templates/restaurant-owner/tier5-src/_shared/owner-maestro-tab.ts +81 -5
- package/templates/restaurant-owner/tier5-src/_shared/owner-selected-site.ts +15 -0
- package/templates/restaurant-owner/tier5-src/_shared/owner-widget-reads.ts +7 -0
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-home/index.ts +30 -8
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-inbox/index.ts +47 -8
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +12 -5
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-maestro/index.ts +132 -39
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +10 -8
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-order/index.ts +4 -1
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-record/index.ts +7 -1
- package/templates/restaurant-owner/tier5-src/wix-owner-booking/index.ts +4 -1
- package/templates/retail-store/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/retail-store-owner/dev/index.ts +167 -132
- package/templates/retail-store-owner/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/retail-store-owner/tier5-src/_shared/owner-maestro-availability.ts +12 -2
- package/templates/retail-store-owner/tier5-src/_shared/owner-maestro-tab.ts +81 -5
- package/templates/retail-store-owner/tier5-src/_shared/owner-selected-site.ts +15 -0
- package/templates/retail-store-owner/tier5-src/_shared/owner-widget-reads.ts +7 -0
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-home/index.ts +30 -8
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-inbox/index.ts +47 -8
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +12 -5
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-maestro/index.ts +132 -39
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +10 -8
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-order/index.ts +4 -1
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-record/index.ts +7 -1
- package/templates/salon-spa/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/wholesale-store/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/yoga-studio/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/yoga-studio-owner/dev/index.ts +167 -132
- package/templates/yoga-studio-owner/tier5-src/_shared/owner-load-error.ts +1 -1
- package/templates/yoga-studio-owner/tier5-src/_shared/owner-maestro-availability.ts +12 -2
- package/templates/yoga-studio-owner/tier5-src/_shared/owner-maestro-tab.ts +81 -5
- package/templates/yoga-studio-owner/tier5-src/_shared/owner-selected-site.ts +15 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/owner-widget-reads.ts +7 -0
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-home/index.ts +30 -8
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-inbox/index.ts +47 -8
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +12 -5
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-maestro/index.ts +132 -39
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +10 -8
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-record/index.ts +7 -1
- package/templates/yoga-studio-owner/tier5-src/wix-owner-booking/index.ts +4 -1
|
@@ -2,7 +2,7 @@ import { defineService } from '@himalaya/state';
|
|
|
2
2
|
import { getOwnerRecord, ownerModuleError, type OwnerRecord } from '../_shared/owner-module-data.js';
|
|
3
3
|
import { ownerInput, inputOwnerModule, openOwnerDashboard } from '../_shared/owner-module-runtime.js';
|
|
4
4
|
import { stashCopy, copyParam } from '../_shared/himi-copy.js';
|
|
5
|
-
import { askMaestroHidden } from '../_shared/owner-maestro-tab.js';
|
|
5
|
+
import { askMaestroHidden, askMaestroNav } from '../_shared/owner-maestro-tab.js';
|
|
6
6
|
const moduleId = inputOwnerModule();
|
|
7
7
|
interface State {
|
|
8
8
|
/** The record on screen, so the screen can name it to another screen. */
|
|
@@ -18,6 +18,12 @@ const svc = defineService('himiOwnerRecord', {
|
|
|
18
18
|
state: { id: '', askMaestroHidden: 'true', status: 'loading', title: '', subtitle: '', image: '', noImage: true, statusLabel: '', fields: [], error: '',
|
|
19
19
|
notLoading: false, notErrored: true, hideContent: true, handoffError: '' } as State,
|
|
20
20
|
actions: {
|
|
21
|
+
// "Ask Maestro": the chat opens on the Maestro tab, about this record.
|
|
22
|
+
// The screen says what kind of record this is (only a contact's detail has the button). No
|
|
23
|
+
// subject: a contact's title is a person's name, which the Maestro worker reads itself.
|
|
24
|
+
askMaestro(state: State, arg?: unknown): State {
|
|
25
|
+
return askMaestroNav(state, { kind: (arg as { kind?: unknown } | undefined)?.kind, id: state.id });
|
|
26
|
+
},
|
|
21
27
|
async load(state: State, arg?: unknown): Promise<State | undefined> {
|
|
22
28
|
stashCopy(arg);
|
|
23
29
|
const revision = ++generation;
|
|
@@ -146,7 +146,7 @@ const CODED = /HTTP (\d{3}) \[([A-Z0-9_]+)\]/;
|
|
|
146
146
|
* `HTTP 428 [MISSING_METASITE_ID]: Couldn't extract metasiteId from the request
|
|
147
147
|
* context` where "6 orders" belongs.
|
|
148
148
|
*/
|
|
149
|
-
const SITE_CONTEXT_CODES = ["MISSING_METASITE_ID", "MISSING_REQUEST_SITE_CONTEXT", "MISSING_SITE_CONTEXT"];
|
|
149
|
+
export const SITE_CONTEXT_CODES = ["MISSING_METASITE_ID", "MISSING_REQUEST_SITE_CONTEXT", "MISSING_SITE_CONTEXT"];
|
|
150
150
|
/** Longest raw upstream text worth showing. Beyond this it stops being a
|
|
151
151
|
* message and starts being a payload dump. */
|
|
152
152
|
const MAX_RAW = 200;
|
|
@@ -146,7 +146,7 @@ const CODED = /HTTP (\d{3}) \[([A-Z0-9_]+)\]/;
|
|
|
146
146
|
* `HTTP 428 [MISSING_METASITE_ID]: Couldn't extract metasiteId from the request
|
|
147
147
|
* context` where "6 orders" belongs.
|
|
148
148
|
*/
|
|
149
|
-
const SITE_CONTEXT_CODES = ["MISSING_METASITE_ID", "MISSING_REQUEST_SITE_CONTEXT", "MISSING_SITE_CONTEXT"];
|
|
149
|
+
export const SITE_CONTEXT_CODES = ["MISSING_METASITE_ID", "MISSING_REQUEST_SITE_CONTEXT", "MISSING_SITE_CONTEXT"];
|
|
150
150
|
/** Longest raw upstream text worth showing. Beyond this it stops being a
|
|
151
151
|
* message and starts being a payload dump. */
|
|
152
152
|
const MAX_RAW = 200;
|
|
@@ -13104,13 +13104,9 @@ const SCREENS = runtimeSetting({
|
|
|
13104
13104
|
"fullWidth": true,
|
|
13105
13105
|
"leadingIcon": "ai",
|
|
13106
13106
|
"action": {
|
|
13107
|
-
"actionId": "
|
|
13107
|
+
"actionId": "tier5.himiOwnerRecord.askMaestro",
|
|
13108
13108
|
"params": {
|
|
13109
|
-
"
|
|
13110
|
-
"kind": "contact",
|
|
13111
|
-
"id": "$service:himiOwnerRecord.id",
|
|
13112
|
-
"title": "Maestro",
|
|
13113
|
-
"subtitle": "Your business assistant, by Symphony."
|
|
13109
|
+
"kind": "contact"
|
|
13114
13110
|
}
|
|
13115
13111
|
}
|
|
13116
13112
|
}
|
|
@@ -57291,6 +57287,9 @@ const SCREENS = runtimeSetting({
|
|
|
57291
57287
|
],
|
|
57292
57288
|
"minBinaryVersion": "0.1.0",
|
|
57293
57289
|
"bundleVersion": "0.0.1"
|
|
57290
|
+
},
|
|
57291
|
+
"topBar": {
|
|
57292
|
+
"actions": []
|
|
57294
57293
|
}
|
|
57295
57294
|
},
|
|
57296
57295
|
"himi_owner_lite_brief": {
|
|
@@ -64166,6 +64165,22 @@ const SCREENS = runtimeSetting({
|
|
|
64166
64165
|
"collapseWhenEmpty": true
|
|
64167
64166
|
}
|
|
64168
64167
|
}
|
|
64168
|
+
},
|
|
64169
|
+
{
|
|
64170
|
+
"id": "himi_owner_lite_maestro.context",
|
|
64171
|
+
"body": {
|
|
64172
|
+
"package": "himalaya",
|
|
64173
|
+
"type": "Text",
|
|
64174
|
+
"props": {
|
|
64175
|
+
"text": "$service:himiOwnerLiteMaestro.contextLabel",
|
|
64176
|
+
"style": "footnote",
|
|
64177
|
+
"color": "textSecondary",
|
|
64178
|
+
"maxLines": 1
|
|
64179
|
+
}
|
|
64180
|
+
},
|
|
64181
|
+
"modifiers": {
|
|
64182
|
+
"hiddenPath": "$service:himiOwnerLiteMaestro.contextHidden"
|
|
64183
|
+
}
|
|
64169
64184
|
}
|
|
64170
64185
|
]
|
|
64171
64186
|
}
|
|
@@ -64429,16 +64444,32 @@ const SCREENS = runtimeSetting({
|
|
|
64429
64444
|
"package": "himalaya",
|
|
64430
64445
|
"type": "Text",
|
|
64431
64446
|
"props": {
|
|
64432
|
-
"text": "
|
|
64447
|
+
"text": "$item.content",
|
|
64433
64448
|
"style": "footnote",
|
|
64434
64449
|
"color": "textSecondary",
|
|
64435
|
-
"maxLines":
|
|
64450
|
+
"maxLines": 2
|
|
64436
64451
|
}
|
|
64437
64452
|
},
|
|
64438
64453
|
"modifiers": {
|
|
64439
64454
|
"hiddenPath": "$item.thinkingHidden"
|
|
64440
64455
|
}
|
|
64441
64456
|
},
|
|
64457
|
+
{
|
|
64458
|
+
"id": "",
|
|
64459
|
+
"body": {
|
|
64460
|
+
"package": "himalaya",
|
|
64461
|
+
"type": "Text",
|
|
64462
|
+
"props": {
|
|
64463
|
+
"text": "$item.content",
|
|
64464
|
+
"style": "footnote",
|
|
64465
|
+
"color": "textSecondary",
|
|
64466
|
+
"maxLines": 3
|
|
64467
|
+
}
|
|
64468
|
+
},
|
|
64469
|
+
"modifiers": {
|
|
64470
|
+
"hiddenPath": "$item.noteHidden"
|
|
64471
|
+
}
|
|
64472
|
+
},
|
|
64442
64473
|
{
|
|
64443
64474
|
"id": "himi_owner_lite_maestro.card_$item.id",
|
|
64444
64475
|
"body": {
|
|
@@ -64629,6 +64660,7 @@ const SCREENS = runtimeSetting({
|
|
|
64629
64660
|
"top": 18,
|
|
64630
64661
|
"bottom": 24
|
|
64631
64662
|
},
|
|
64663
|
+
"keyboardDismiss": "tap",
|
|
64632
64664
|
"onAppear": {
|
|
64633
64665
|
"actionId": "tier5.himiOwnerLiteMaestro.load"
|
|
64634
64666
|
}
|
|
@@ -64647,88 +64679,34 @@ const SCREENS = runtimeSetting({
|
|
|
64647
64679
|
"minBinaryVersion": "0.1.0",
|
|
64648
64680
|
"bundleVersion": "0.0.1"
|
|
64649
64681
|
},
|
|
64650
|
-
"
|
|
64651
|
-
"
|
|
64652
|
-
|
|
64653
|
-
|
|
64654
|
-
|
|
64655
|
-
|
|
64656
|
-
"
|
|
64657
|
-
|
|
64658
|
-
{
|
|
64659
|
-
"
|
|
64660
|
-
"
|
|
64661
|
-
|
|
64662
|
-
"type": "Text",
|
|
64663
|
-
"props": {
|
|
64664
|
-
"text": "$service:himiOwnerLiteMaestro.contextLabel",
|
|
64665
|
-
"style": "footnote",
|
|
64666
|
-
"color": "textSecondary",
|
|
64667
|
-
"maxLines": 1,
|
|
64668
|
-
"collapseWhenEmpty": true
|
|
64669
|
-
}
|
|
64670
|
-
}
|
|
64671
|
-
},
|
|
64672
|
-
{
|
|
64673
|
-
"id": "",
|
|
64674
|
-
"body": {
|
|
64675
|
-
"package": "himalaya",
|
|
64676
|
-
"type": "Spacer",
|
|
64677
|
-
"props": {}
|
|
64678
|
-
}
|
|
64679
|
-
},
|
|
64680
|
-
{
|
|
64681
|
-
"id": "himi_owner_lite_maestro.history",
|
|
64682
|
-
"body": {
|
|
64683
|
-
"package": "himalaya",
|
|
64684
|
-
"type": "Button",
|
|
64685
|
-
"props": {
|
|
64686
|
-
"title": "History",
|
|
64687
|
-
"style": "link",
|
|
64688
|
-
"size": "sm",
|
|
64689
|
-
"fullWidth": false,
|
|
64690
|
-
"action": {
|
|
64691
|
-
"actionId": "himi.open",
|
|
64692
|
-
"params": {
|
|
64693
|
-
"screenId": "himi_owner_lite_maestro_history",
|
|
64694
|
-
"title": "Conversations",
|
|
64695
|
-
"subtitle": "Pick up where you left off."
|
|
64696
|
-
}
|
|
64697
|
-
}
|
|
64698
|
-
}
|
|
64699
|
-
}
|
|
64700
|
-
},
|
|
64701
|
-
{
|
|
64702
|
-
"id": "himi_owner_lite_maestro.newChat",
|
|
64703
|
-
"body": {
|
|
64704
|
-
"package": "himalaya",
|
|
64705
|
-
"type": "Button",
|
|
64706
|
-
"props": {
|
|
64707
|
-
"title": "New chat",
|
|
64708
|
-
"style": "link",
|
|
64709
|
-
"size": "sm",
|
|
64710
|
-
"fullWidth": false,
|
|
64711
|
-
"action": {
|
|
64712
|
-
"actionId": "tier5.himiOwnerLiteMaestro.newChat"
|
|
64713
|
-
}
|
|
64714
|
-
}
|
|
64715
|
-
}
|
|
64682
|
+
"topBar": {
|
|
64683
|
+
"actions": [
|
|
64684
|
+
{
|
|
64685
|
+
"id": "himi_owner_lite_maestro.history",
|
|
64686
|
+
"icon": "clock",
|
|
64687
|
+
"accessibilityLabel": "History",
|
|
64688
|
+
"onTap": {
|
|
64689
|
+
"actionId": "himi.open",
|
|
64690
|
+
"params": {
|
|
64691
|
+
"screenId": "himi_owner_lite_maestro_history",
|
|
64692
|
+
"title": "Conversations",
|
|
64693
|
+
"subtitle": "Pick up where you left off."
|
|
64716
64694
|
}
|
|
64717
|
-
|
|
64718
|
-
|
|
64719
|
-
|
|
64720
|
-
"modifiers": {
|
|
64721
|
-
"background": {
|
|
64722
|
-
"token": "surfacePrimary"
|
|
64723
|
-
},
|
|
64724
|
-
"padding": {
|
|
64725
|
-
"leading": 16,
|
|
64726
|
-
"trailing": 16,
|
|
64727
|
-
"top": 4,
|
|
64728
|
-
"bottom": 4
|
|
64695
|
+
},
|
|
64696
|
+
"hiddenPath": "$service:himiOwnerLiteMaestro.chatHidden",
|
|
64697
|
+
"hiddenPathScope": "screen"
|
|
64729
64698
|
},
|
|
64730
|
-
|
|
64731
|
-
|
|
64699
|
+
{
|
|
64700
|
+
"id": "himi_owner_lite_maestro.newChat",
|
|
64701
|
+
"icon": "edit",
|
|
64702
|
+
"accessibilityLabel": "New chat",
|
|
64703
|
+
"onTap": {
|
|
64704
|
+
"actionId": "tier5.himiOwnerLiteMaestro.newChat"
|
|
64705
|
+
},
|
|
64706
|
+
"hiddenPath": "$service:himiOwnerLiteMaestro.chatHidden",
|
|
64707
|
+
"hiddenPathScope": "screen"
|
|
64708
|
+
}
|
|
64709
|
+
]
|
|
64732
64710
|
},
|
|
64733
64711
|
"stickyFooter": {
|
|
64734
64712
|
"id": "himi_owner_lite_maestro.composer",
|
|
@@ -64826,50 +64804,111 @@ const SCREENS = runtimeSetting({
|
|
|
64826
64804
|
}
|
|
64827
64805
|
},
|
|
64828
64806
|
{
|
|
64829
|
-
"id": "
|
|
64807
|
+
"id": "",
|
|
64830
64808
|
"body": {
|
|
64831
64809
|
"package": "himalaya",
|
|
64832
|
-
"type": "
|
|
64810
|
+
"type": "HStack",
|
|
64833
64811
|
"props": {
|
|
64834
|
-
"
|
|
64835
|
-
"
|
|
64812
|
+
"spacing": 8,
|
|
64813
|
+
"alignment": "trailing",
|
|
64814
|
+
"children": [
|
|
64836
64815
|
{
|
|
64837
|
-
"id": "
|
|
64816
|
+
"id": "himi_owner_lite_maestro.input",
|
|
64838
64817
|
"body": {
|
|
64839
64818
|
"package": "himalaya",
|
|
64840
|
-
"type": "
|
|
64819
|
+
"type": "TextField",
|
|
64841
64820
|
"props": {
|
|
64842
|
-
"
|
|
64843
|
-
"
|
|
64844
|
-
"
|
|
64845
|
-
"
|
|
64846
|
-
|
|
64847
|
-
|
|
64848
|
-
|
|
64849
|
-
"
|
|
64850
|
-
|
|
64851
|
-
|
|
64852
|
-
|
|
64853
|
-
|
|
64854
|
-
|
|
64821
|
+
"valuePath": "$service:himiOwnerLiteMaestro.input",
|
|
64822
|
+
"placeholder": "Ask Maestro…",
|
|
64823
|
+
"keyboard": "default",
|
|
64824
|
+
"autoCapitalization": "sentences",
|
|
64825
|
+
"multilineMaxLines": 4,
|
|
64826
|
+
"maxLength": 4000,
|
|
64827
|
+
"onChange": {
|
|
64828
|
+
"actionId": "tier5.himiOwnerLiteMaestro.setInput"
|
|
64829
|
+
},
|
|
64830
|
+
"borderless": true
|
|
64831
|
+
}
|
|
64832
|
+
},
|
|
64833
|
+
"modifiers": {
|
|
64834
|
+
"weight": 1,
|
|
64835
|
+
"accessibilityLabel": "Ask Maestro…",
|
|
64836
|
+
"background": {
|
|
64837
|
+
"token": "surfaceSecondary"
|
|
64838
|
+
},
|
|
64839
|
+
"cornerRadius": 22,
|
|
64840
|
+
"padding": {
|
|
64841
|
+
"leading": 16,
|
|
64842
|
+
"trailing": 12,
|
|
64843
|
+
"top": 11,
|
|
64844
|
+
"bottom": 11
|
|
64855
64845
|
}
|
|
64856
64846
|
}
|
|
64857
|
-
}
|
|
64858
|
-
|
|
64859
|
-
|
|
64860
|
-
|
|
64861
|
-
|
|
64862
|
-
|
|
64863
|
-
|
|
64864
|
-
|
|
64865
|
-
|
|
64866
|
-
|
|
64867
|
-
|
|
64868
|
-
|
|
64847
|
+
},
|
|
64848
|
+
{
|
|
64849
|
+
"id": "",
|
|
64850
|
+
"body": {
|
|
64851
|
+
"package": "himalaya",
|
|
64852
|
+
"type": "ZStack",
|
|
64853
|
+
"props": {
|
|
64854
|
+
"alignment": "center",
|
|
64855
|
+
"children": [
|
|
64856
|
+
{
|
|
64857
|
+
"id": "himi_owner_lite_maestro.send_off",
|
|
64858
|
+
"body": {
|
|
64859
|
+
"package": "himalaya",
|
|
64860
|
+
"type": "Icon",
|
|
64861
|
+
"props": {
|
|
64862
|
+
"name": "send",
|
|
64863
|
+
"size": 20,
|
|
64864
|
+
"tint": "textTertiary"
|
|
64865
|
+
}
|
|
64866
|
+
},
|
|
64867
|
+
"modifiers": {
|
|
64868
|
+
"accessibilityRole": "decorative",
|
|
64869
|
+
"width": 44,
|
|
64870
|
+
"height": 44,
|
|
64871
|
+
"cornerRadius": 22,
|
|
64872
|
+
"background": {
|
|
64873
|
+
"token": "surfaceSecondary"
|
|
64874
|
+
}
|
|
64875
|
+
}
|
|
64876
|
+
},
|
|
64877
|
+
{
|
|
64878
|
+
"id": "himi_owner_lite_maestro.send",
|
|
64879
|
+
"body": {
|
|
64880
|
+
"package": "himalaya",
|
|
64881
|
+
"type": "Icon",
|
|
64882
|
+
"props": {
|
|
64883
|
+
"name": "send",
|
|
64884
|
+
"size": 20,
|
|
64885
|
+
"tint": "textOnAccent"
|
|
64886
|
+
}
|
|
64887
|
+
},
|
|
64888
|
+
"modifiers": {
|
|
64889
|
+
"accessibilityRole": "button",
|
|
64890
|
+
"width": 44,
|
|
64891
|
+
"height": 44,
|
|
64892
|
+
"cornerRadius": 22,
|
|
64893
|
+
"background": {
|
|
64894
|
+
"token": "accentPrimary"
|
|
64895
|
+
},
|
|
64896
|
+
"accessibilityLabel": "Send",
|
|
64897
|
+
"onTap": {
|
|
64898
|
+
"actionId": "tier5.himiOwnerLiteMaestro.submit"
|
|
64899
|
+
},
|
|
64900
|
+
"hiddenPath": "$service:himiOwnerLiteMaestro.noInput"
|
|
64901
|
+
}
|
|
64902
|
+
}
|
|
64903
|
+
]
|
|
64869
64904
|
}
|
|
64905
|
+
},
|
|
64906
|
+
"modifiers": {
|
|
64907
|
+
"width": 44,
|
|
64908
|
+
"height": 44
|
|
64870
64909
|
}
|
|
64871
64910
|
}
|
|
64872
|
-
|
|
64911
|
+
]
|
|
64873
64912
|
}
|
|
64874
64913
|
}
|
|
64875
64914
|
}
|
|
@@ -64896,8 +64935,7 @@ const SCREENS = runtimeSetting({
|
|
|
64896
64935
|
},
|
|
64897
64936
|
"hostTitle": {
|
|
64898
64937
|
"title": "Maestro",
|
|
64899
|
-
"
|
|
64900
|
-
"replaces": "himi_owner_lite_maestro.header"
|
|
64938
|
+
"replaces": "himi_owner_lite_maestro.header.title"
|
|
64901
64939
|
}
|
|
64902
64940
|
},
|
|
64903
64941
|
"himi_owner_lite_maestro_history": {
|
|
@@ -65034,7 +65072,7 @@ const SCREENS = runtimeSetting({
|
|
|
65034
65072
|
"package": "himalaya",
|
|
65035
65073
|
"type": "Icon",
|
|
65036
65074
|
"props": {
|
|
65037
|
-
"name": "
|
|
65075
|
+
"name": "chat",
|
|
65038
65076
|
"size": 20,
|
|
65039
65077
|
"tint": "accentPrimary"
|
|
65040
65078
|
}
|
|
@@ -65120,8 +65158,7 @@ const SCREENS = runtimeSetting({
|
|
|
65120
65158
|
"screenId": "himi_owner_lite_maestro",
|
|
65121
65159
|
"conversationId": "$item.id",
|
|
65122
65160
|
"n": "$item.stamp",
|
|
65123
|
-
"title": "Maestro"
|
|
65124
|
-
"subtitle": "Your business assistant, by Symphony."
|
|
65161
|
+
"title": "Maestro"
|
|
65125
65162
|
}
|
|
65126
65163
|
}
|
|
65127
65164
|
}
|
|
@@ -65209,6 +65246,9 @@ const SCREENS = runtimeSetting({
|
|
|
65209
65246
|
"minBinaryVersion": "0.1.0",
|
|
65210
65247
|
"bundleVersion": "0.0.1"
|
|
65211
65248
|
},
|
|
65249
|
+
"topBar": {
|
|
65250
|
+
"actions": []
|
|
65251
|
+
},
|
|
65212
65252
|
"hostTitle": {
|
|
65213
65253
|
"title": "Conversations",
|
|
65214
65254
|
"subtitle": "Pick up where you left off.",
|
|
@@ -86624,14 +86664,9 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
86624
86664
|
"fullWidth": true,
|
|
86625
86665
|
"leadingIcon": "ai",
|
|
86626
86666
|
"action": {
|
|
86627
|
-
"actionId": "
|
|
86667
|
+
"actionId": "tier5.himiOwnerLiteOrder.askMaestro",
|
|
86628
86668
|
"params": {
|
|
86629
|
-
"
|
|
86630
|
-
"kind": "order",
|
|
86631
|
-
"id": "$service:himiOwnerLiteOrder.id",
|
|
86632
|
-
"subject": "$service:himiOwnerLiteOrder.title",
|
|
86633
|
-
"title": "Maestro",
|
|
86634
|
-
"subtitle": "Your business assistant, by Symphony."
|
|
86669
|
+
"kind": "order"
|
|
86635
86670
|
}
|
|
86636
86671
|
}
|
|
86637
86672
|
}
|
|
@@ -91588,14 +91623,9 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
91588
91623
|
"fullWidth": true,
|
|
91589
91624
|
"leadingIcon": "ai",
|
|
91590
91625
|
"action": {
|
|
91591
|
-
"actionId": "
|
|
91626
|
+
"actionId": "tier5.ownerBooking.askMaestro",
|
|
91592
91627
|
"params": {
|
|
91593
|
-
"
|
|
91594
|
-
"kind": "booking",
|
|
91595
|
-
"id": "$service:ownerBooking.id",
|
|
91596
|
-
"subject": "$service:ownerBooking.title",
|
|
91597
|
-
"title": "Maestro",
|
|
91598
|
-
"subtitle": "Your business assistant, by Symphony."
|
|
91628
|
+
"kind": "booking"
|
|
91599
91629
|
}
|
|
91600
91630
|
}
|
|
91601
91631
|
}
|
|
@@ -146,7 +146,7 @@ const CODED = /HTTP (\d{3}) \[([A-Z0-9_]+)\]/;
|
|
|
146
146
|
* `HTTP 428 [MISSING_METASITE_ID]: Couldn't extract metasiteId from the request
|
|
147
147
|
* context` where "6 orders" belongs.
|
|
148
148
|
*/
|
|
149
|
-
const SITE_CONTEXT_CODES = ["MISSING_METASITE_ID", "MISSING_REQUEST_SITE_CONTEXT", "MISSING_SITE_CONTEXT"];
|
|
149
|
+
export const SITE_CONTEXT_CODES = ["MISSING_METASITE_ID", "MISSING_REQUEST_SITE_CONTEXT", "MISSING_SITE_CONTEXT"];
|
|
150
150
|
/** Longest raw upstream text worth showing. Beyond this it stops being a
|
|
151
151
|
* message and starts being a payload dump. */
|
|
152
152
|
const MAX_RAW = 200;
|
|
@@ -28,9 +28,19 @@ export async function symphonyAccount(api: MaestroWixApi): Promise<string> {
|
|
|
28
28
|
return typeof id === "string" ? id.trim() : "";
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/** The account's Spaces. Throws when they could not be asked.
|
|
32
|
+
*
|
|
33
|
+
* Not asked a second time here after a refusal. The first call a run makes for the Symphony
|
|
34
|
+
* account can answer 403 (measured live 2026-11-28), but a worker has no timer to wait with, and
|
|
35
|
+
* the host remembers a credential it could not get for ten seconds, so an immediate second ask
|
|
36
|
+
* is refused the same way. The caller asks again on its own schedule. */
|
|
37
|
+
async function readSpaces(api: MaestroWixApi, account: string): Promise<Spaces | null> {
|
|
38
|
+
return (await api.call("POST", SPACES, {}, forSymphonyAccount(account))) as Spaces | null;
|
|
39
|
+
}
|
|
40
|
+
|
|
31
41
|
/** Whether `site` is the website of one of the owner's Spaces. Throws when it could not be asked. */
|
|
32
42
|
export async function isSpaceWebsite(api: MaestroWixApi, account: string, site: string): Promise<boolean> {
|
|
33
|
-
const res =
|
|
43
|
+
const res = await readSpaces(api, account);
|
|
34
44
|
return (res?.workspaces ?? []).some((w) => w?.website?.metaSiteId === site);
|
|
35
45
|
}
|
|
36
46
|
|
|
@@ -45,7 +55,7 @@ export interface SpaceWebsite { id: string; name: string; space: string }
|
|
|
45
55
|
export async function spaceWebsites(api: MaestroWixApi): Promise<SpaceWebsite[]> {
|
|
46
56
|
const account = await symphonyAccount(api);
|
|
47
57
|
if (!account) return [];
|
|
48
|
-
const res =
|
|
58
|
+
const res = await readSpaces(api, account);
|
|
49
59
|
const out: SpaceWebsite[] = [];
|
|
50
60
|
for (const w of res?.workspaces ?? []) {
|
|
51
61
|
const id = typeof w?.website?.metaSiteId === "string" ? w.website.metaSiteId.trim() : "";
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
// when the record changes while it stays on screen, so the button can lag one visit behind the tab.
|
|
13
13
|
// Shown too long, it opens the Maestro screen, which says so itself when Maestro is unavailable.
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { navigate, type NavDirective } from "@himalaya/state";
|
|
16
|
+
import { currentBusinessId } from "./owner-selected-site.js";
|
|
16
17
|
|
|
17
18
|
type StorageLike = { getItem(key: string): string | null; setItem(key: string, value: string): void };
|
|
18
|
-
type Host = { storage?: StorageLike
|
|
19
|
+
type Host = { storage?: StorageLike };
|
|
19
20
|
const host = (): Host | undefined => (globalThis as { himalaya?: Host }).himalaya;
|
|
20
21
|
|
|
21
22
|
const KEY = "himi.ownerLite.maestroTab.v1";
|
|
@@ -36,7 +37,82 @@ export function maestroTabIsFor(site: string): boolean {
|
|
|
36
37
|
* Maestro for the business on screen. The business is the one the host scoped, else the one
|
|
37
38
|
* picked on Sites, as the Maestro screen reads it. */
|
|
38
39
|
export function askMaestroHidden(): "true" | "false" {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
return maestroTabIsFor(currentBusinessId()) ? "false" : "true";
|
|
41
|
+
}
|
|
42
|
+
// ── "Ask Maestro" from a detail screen ─────────────────────────────────────────────────────
|
|
43
|
+
// The detail screen's worker leaves the item here and switches to the Maestro tab; the Maestro
|
|
44
|
+
// screen's worker reads it when the tab appears. A screen param cannot carry it: a tab switch
|
|
45
|
+
// takes none. The request names the business it was left for, and is good for half a minute:
|
|
46
|
+
// the Maestro worker acts on each stamp once, for that business only, and a request the tab
|
|
47
|
+
// never picked up (the switch was dropped, or a turn was streaming there) is then ignored.
|
|
48
|
+
// It is dropped as soon as its chat is used (a first turn) or left (New chat), and when the
|
|
49
|
+
// owner changes. Not on the read itself: the Maestro screen loads twice as it opens, and both
|
|
50
|
+
// loads must find it.
|
|
51
|
+
|
|
52
|
+
const ASK_KEY = "himi.ownerLite.maestroAsk.v1";
|
|
53
|
+
const ASK_REQUEST_TTL_MS = 30_000;
|
|
54
|
+
|
|
55
|
+
export type AskMaestroKind = "order" | "booking" | "contact";
|
|
56
|
+
export interface AskMaestroRequest { kind: AskMaestroKind; id: string; subject: string; site: string; n: number }
|
|
57
|
+
|
|
58
|
+
export const isAskMaestroKind = (v: unknown): v is AskMaestroKind => v === "order" || v === "booking" || v === "contact";
|
|
59
|
+
|
|
60
|
+
/** Leave "ask Maestro about this item" for the Maestro tab. False when it could not be left
|
|
61
|
+
* (no id, no business, or a host without storage): the caller then opens the Maestro screen
|
|
62
|
+
* with params. */
|
|
63
|
+
export function requestAskMaestro(kind: unknown, id: unknown, subject: unknown, now: number): boolean {
|
|
64
|
+
const item = typeof id === "string" ? id.trim() : "";
|
|
65
|
+
const site = currentBusinessId();
|
|
66
|
+
if (!isAskMaestroKind(kind) || !item || !site) return false;
|
|
67
|
+
const storage = host()?.storage;
|
|
68
|
+
if (!storage) return false;
|
|
69
|
+
try {
|
|
70
|
+
storage.setItem(ASK_KEY, JSON.stringify({ kind, id: item, subject: typeof subject === "string" ? subject.trim() : "", site, n: now }));
|
|
71
|
+
return true;
|
|
72
|
+
} catch { return false; }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The request a detail screen left for `site`, while it is recent. */
|
|
76
|
+
export function pendingAskRequest(now: number, site: string): AskMaestroRequest | null {
|
|
77
|
+
try {
|
|
78
|
+
const raw = host()?.storage?.getItem(ASK_KEY);
|
|
79
|
+
if (!raw) return null;
|
|
80
|
+
const v = JSON.parse(raw) as Partial<AskMaestroRequest> | null;
|
|
81
|
+
if (!v || !isAskMaestroKind(v.kind) || typeof v.id !== "string" || !v.id || typeof v.n !== "number") return null;
|
|
82
|
+
// An item of another business is never asked about here: the owner switched in between.
|
|
83
|
+
if (!site || v.site !== site) return null;
|
|
84
|
+
if (now < v.n || now - v.n > ASK_REQUEST_TTL_MS) return null;
|
|
85
|
+
return { kind: v.kind, id: v.id, subject: typeof v.subject === "string" ? v.subject : "", site, n: v.n };
|
|
86
|
+
} catch { return null; }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Drop the request: its chat was used or left (`stamp`: only the request with that stamp, so a
|
|
90
|
+
* newer one a detail screen left meanwhile stays), or the owner changed (no stamp: whatever is
|
|
91
|
+
* there). Never throws. */
|
|
92
|
+
export function clearAskRequest(stamp?: number): void {
|
|
93
|
+
try {
|
|
94
|
+
const storage = host()?.storage;
|
|
95
|
+
if (!storage) return;
|
|
96
|
+
if (stamp !== undefined) {
|
|
97
|
+
const raw = storage.getItem(ASK_KEY);
|
|
98
|
+
if (!raw || (JSON.parse(raw) as { n?: unknown } | null)?.n !== stamp) return;
|
|
99
|
+
}
|
|
100
|
+
storage.setItem(ASK_KEY, "");
|
|
101
|
+
} catch { /* no storage on this host, or nothing readable there: nothing to drop */ }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** A detail worker's `askMaestro` action: leave the item, then switch to the Maestro tab at its
|
|
105
|
+
* root: a tab left on History or on a past chat would otherwise show that, and the root is
|
|
106
|
+
* what reads the request. Every binary that can show the Maestro tab knows `{ tab, reset }`:
|
|
107
|
+
* the form shipped on 2026-10-27, and the tab needs the NDJSON stream of 2026-11-25.
|
|
108
|
+
* On a host where the item cannot be left, open the Maestro screen about it instead. */
|
|
109
|
+
export function askMaestroNav<S extends object>(state: S, arg: unknown): S & { _nav: NavDirective } {
|
|
110
|
+
const a = (arg && typeof arg === "object" ? arg : {}) as { kind?: unknown; id?: unknown; subject?: unknown };
|
|
111
|
+
if (requestAskMaestro(a.kind, a.id, a.subject, Date.now())) return navigate(state, { tab: "maestro", reset: true });
|
|
112
|
+
const args: Record<string, string> = {};
|
|
113
|
+
for (const key of ["kind", "id", "subject"] as const) {
|
|
114
|
+
const value = a[key];
|
|
115
|
+
if (typeof value === "string" && value) args[key] = value;
|
|
116
|
+
}
|
|
117
|
+
return navigate(state, { screenId: "himi_owner_lite_maestro", args });
|
|
42
118
|
}
|
|
@@ -107,3 +107,18 @@ export function fallbackNameFrom(arg: unknown, current = ""): string {
|
|
|
107
107
|
const v = (arg as { businessName?: unknown } | undefined)?.businessName;
|
|
108
108
|
return typeof v === "string" && v.trim() ? v.trim() : current;
|
|
109
109
|
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The business the owner is working in, as an id for a call that must name it ("" = none known).
|
|
113
|
+
*
|
|
114
|
+
* The picked one first: the Sites pick records it at the moment of the switch, for every worker.
|
|
115
|
+
* The host's own scope (`__himiPreferenceBusiness`) is the fallback, not the first choice: a tab
|
|
116
|
+
* kept alive across a switch keeps the scope it was opened with (measured live 2026-11-28: after
|
|
117
|
+
* a switch the Inbox tab went on reading the first business, while Home read the new one).
|
|
118
|
+
*/
|
|
119
|
+
export function currentBusinessId(): string {
|
|
120
|
+
const picked = readSelectedSite()?.id?.trim();
|
|
121
|
+
if (picked) return picked;
|
|
122
|
+
const scoped = (globalThis as { himalaya?: { input?: Record<string, unknown> } }).himalaya?.input?.__himiPreferenceBusiness;
|
|
123
|
+
return typeof scoped === "string" ? scoped.trim() : "";
|
|
124
|
+
}
|
|
@@ -21,3 +21,10 @@ export function isSectionUnavailable(e: unknown): boolean {
|
|
|
21
21
|
const text = String((e as Error)?.message ?? e);
|
|
22
22
|
return /^HTTP (?:403|404|428)\b/.test(text) || /^HTTP \d{3} \[(?:FAILED_PRECONDITION|PERMISSION_DENIED)\]/.test(text);
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
/** The business has not set this area up: its app is not installed on the site, which Wix
|
|
26
|
+
* answers with 428. Narrower than `isSectionUnavailable`: a 403 or a 404 may be a mistake
|
|
27
|
+
* worth showing, while this one is simply "nothing here". Read from the leading status only. */
|
|
28
|
+
export function isNotInstalled(e: unknown): boolean {
|
|
29
|
+
return /^HTTP 428\b/.test(String((e as Error)?.message ?? e));
|
|
30
|
+
}
|