@wix/himalaya-cli 0.1928.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 +256 -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
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { defineService } from "@himalaya/state";
|
|
10
10
|
import { getOrder, type WixOrder, type WixOrderLineItem } from "@himalaya/wix-ecom";
|
|
11
11
|
import { ownerLoadError, isOwnerPreviewDemo, ownerDemoFallback } from "../_shared/owner-load-error.js";
|
|
12
|
-
import { askMaestroHidden } from "../_shared/owner-maestro-tab.js";
|
|
12
|
+
import { askMaestroHidden, askMaestroNav } from "../_shared/owner-maestro-tab.js";
|
|
13
13
|
import { DEMO_ORDERS, DEMO_NOTE, demoOrderDate } from "../_shared/owner-preview-demo.js";
|
|
14
14
|
import { stashCopy, copyParam } from "../_shared/himi-copy.js";
|
|
15
15
|
import { formatDateMedium } from "../_shared/engine-intl.js";
|
|
@@ -287,9 +287,12 @@ const svc = defineService<OrderState, {
|
|
|
287
287
|
follow: (s: OrderState) => OrderState | undefined;
|
|
288
288
|
onFollowStarted: (s: OrderState, activityId?: string) => OrderState;
|
|
289
289
|
unfollow: (s: OrderState) => OrderState;
|
|
290
|
+
askMaestro: (s: OrderState) => OrderState;
|
|
290
291
|
}>("himiOwnerLiteOrder", {
|
|
291
292
|
state: shape({ status: "loading" }),
|
|
292
293
|
actions: {
|
|
294
|
+
// "Ask Maestro": the chat opens on the Maestro tab, about this order.
|
|
295
|
+
askMaestro: (s) => askMaestroNav(s, { kind: "order", id: s.id, subject: s.title }),
|
|
293
296
|
load: async (s, arg) => {
|
|
294
297
|
stashCopy(arg); // absorb the descriptor's onAppear copy-pack param
|
|
295
298
|
const id = idFrom(arg, s.id) || inputId();
|
|
@@ -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
|
}
|
|
@@ -56832,6 +56828,9 @@ const SCREENS = runtimeSetting({
|
|
|
56832
56828
|
],
|
|
56833
56829
|
"minBinaryVersion": "0.1.0",
|
|
56834
56830
|
"bundleVersion": "0.0.1"
|
|
56831
|
+
},
|
|
56832
|
+
"topBar": {
|
|
56833
|
+
"actions": []
|
|
56835
56834
|
}
|
|
56836
56835
|
},
|
|
56837
56836
|
"himi_owner_lite_brief": {
|
|
@@ -63707,6 +63706,22 @@ const SCREENS = runtimeSetting({
|
|
|
63707
63706
|
"collapseWhenEmpty": true
|
|
63708
63707
|
}
|
|
63709
63708
|
}
|
|
63709
|
+
},
|
|
63710
|
+
{
|
|
63711
|
+
"id": "himi_owner_lite_maestro.context",
|
|
63712
|
+
"body": {
|
|
63713
|
+
"package": "himalaya",
|
|
63714
|
+
"type": "Text",
|
|
63715
|
+
"props": {
|
|
63716
|
+
"text": "$service:himiOwnerLiteMaestro.contextLabel",
|
|
63717
|
+
"style": "footnote",
|
|
63718
|
+
"color": "textSecondary",
|
|
63719
|
+
"maxLines": 1
|
|
63720
|
+
}
|
|
63721
|
+
},
|
|
63722
|
+
"modifiers": {
|
|
63723
|
+
"hiddenPath": "$service:himiOwnerLiteMaestro.contextHidden"
|
|
63724
|
+
}
|
|
63710
63725
|
}
|
|
63711
63726
|
]
|
|
63712
63727
|
}
|
|
@@ -63970,16 +63985,32 @@ const SCREENS = runtimeSetting({
|
|
|
63970
63985
|
"package": "himalaya",
|
|
63971
63986
|
"type": "Text",
|
|
63972
63987
|
"props": {
|
|
63973
|
-
"text": "
|
|
63988
|
+
"text": "$item.content",
|
|
63974
63989
|
"style": "footnote",
|
|
63975
63990
|
"color": "textSecondary",
|
|
63976
|
-
"maxLines":
|
|
63991
|
+
"maxLines": 2
|
|
63977
63992
|
}
|
|
63978
63993
|
},
|
|
63979
63994
|
"modifiers": {
|
|
63980
63995
|
"hiddenPath": "$item.thinkingHidden"
|
|
63981
63996
|
}
|
|
63982
63997
|
},
|
|
63998
|
+
{
|
|
63999
|
+
"id": "",
|
|
64000
|
+
"body": {
|
|
64001
|
+
"package": "himalaya",
|
|
64002
|
+
"type": "Text",
|
|
64003
|
+
"props": {
|
|
64004
|
+
"text": "$item.content",
|
|
64005
|
+
"style": "footnote",
|
|
64006
|
+
"color": "textSecondary",
|
|
64007
|
+
"maxLines": 3
|
|
64008
|
+
}
|
|
64009
|
+
},
|
|
64010
|
+
"modifiers": {
|
|
64011
|
+
"hiddenPath": "$item.noteHidden"
|
|
64012
|
+
}
|
|
64013
|
+
},
|
|
63983
64014
|
{
|
|
63984
64015
|
"id": "himi_owner_lite_maestro.card_$item.id",
|
|
63985
64016
|
"body": {
|
|
@@ -64170,6 +64201,7 @@ const SCREENS = runtimeSetting({
|
|
|
64170
64201
|
"top": 18,
|
|
64171
64202
|
"bottom": 24
|
|
64172
64203
|
},
|
|
64204
|
+
"keyboardDismiss": "tap",
|
|
64173
64205
|
"onAppear": {
|
|
64174
64206
|
"actionId": "tier5.himiOwnerLiteMaestro.load"
|
|
64175
64207
|
}
|
|
@@ -64188,88 +64220,34 @@ const SCREENS = runtimeSetting({
|
|
|
64188
64220
|
"minBinaryVersion": "0.1.0",
|
|
64189
64221
|
"bundleVersion": "0.0.1"
|
|
64190
64222
|
},
|
|
64191
|
-
"
|
|
64192
|
-
"
|
|
64193
|
-
|
|
64194
|
-
|
|
64195
|
-
|
|
64196
|
-
|
|
64197
|
-
"
|
|
64198
|
-
|
|
64199
|
-
{
|
|
64200
|
-
"
|
|
64201
|
-
"
|
|
64202
|
-
|
|
64203
|
-
"type": "Text",
|
|
64204
|
-
"props": {
|
|
64205
|
-
"text": "$service:himiOwnerLiteMaestro.contextLabel",
|
|
64206
|
-
"style": "footnote",
|
|
64207
|
-
"color": "textSecondary",
|
|
64208
|
-
"maxLines": 1,
|
|
64209
|
-
"collapseWhenEmpty": true
|
|
64210
|
-
}
|
|
64211
|
-
}
|
|
64212
|
-
},
|
|
64213
|
-
{
|
|
64214
|
-
"id": "",
|
|
64215
|
-
"body": {
|
|
64216
|
-
"package": "himalaya",
|
|
64217
|
-
"type": "Spacer",
|
|
64218
|
-
"props": {}
|
|
64219
|
-
}
|
|
64220
|
-
},
|
|
64221
|
-
{
|
|
64222
|
-
"id": "himi_owner_lite_maestro.history",
|
|
64223
|
-
"body": {
|
|
64224
|
-
"package": "himalaya",
|
|
64225
|
-
"type": "Button",
|
|
64226
|
-
"props": {
|
|
64227
|
-
"title": "History",
|
|
64228
|
-
"style": "link",
|
|
64229
|
-
"size": "sm",
|
|
64230
|
-
"fullWidth": false,
|
|
64231
|
-
"action": {
|
|
64232
|
-
"actionId": "himi.open",
|
|
64233
|
-
"params": {
|
|
64234
|
-
"screenId": "himi_owner_lite_maestro_history",
|
|
64235
|
-
"title": "Conversations",
|
|
64236
|
-
"subtitle": "Pick up where you left off."
|
|
64237
|
-
}
|
|
64238
|
-
}
|
|
64239
|
-
}
|
|
64240
|
-
}
|
|
64241
|
-
},
|
|
64242
|
-
{
|
|
64243
|
-
"id": "himi_owner_lite_maestro.newChat",
|
|
64244
|
-
"body": {
|
|
64245
|
-
"package": "himalaya",
|
|
64246
|
-
"type": "Button",
|
|
64247
|
-
"props": {
|
|
64248
|
-
"title": "New chat",
|
|
64249
|
-
"style": "link",
|
|
64250
|
-
"size": "sm",
|
|
64251
|
-
"fullWidth": false,
|
|
64252
|
-
"action": {
|
|
64253
|
-
"actionId": "tier5.himiOwnerLiteMaestro.newChat"
|
|
64254
|
-
}
|
|
64255
|
-
}
|
|
64256
|
-
}
|
|
64223
|
+
"topBar": {
|
|
64224
|
+
"actions": [
|
|
64225
|
+
{
|
|
64226
|
+
"id": "himi_owner_lite_maestro.history",
|
|
64227
|
+
"icon": "clock",
|
|
64228
|
+
"accessibilityLabel": "History",
|
|
64229
|
+
"onTap": {
|
|
64230
|
+
"actionId": "himi.open",
|
|
64231
|
+
"params": {
|
|
64232
|
+
"screenId": "himi_owner_lite_maestro_history",
|
|
64233
|
+
"title": "Conversations",
|
|
64234
|
+
"subtitle": "Pick up where you left off."
|
|
64257
64235
|
}
|
|
64258
|
-
|
|
64259
|
-
|
|
64260
|
-
|
|
64261
|
-
"modifiers": {
|
|
64262
|
-
"background": {
|
|
64263
|
-
"token": "surfacePrimary"
|
|
64264
|
-
},
|
|
64265
|
-
"padding": {
|
|
64266
|
-
"leading": 16,
|
|
64267
|
-
"trailing": 16,
|
|
64268
|
-
"top": 4,
|
|
64269
|
-
"bottom": 4
|
|
64236
|
+
},
|
|
64237
|
+
"hiddenPath": "$service:himiOwnerLiteMaestro.chatHidden",
|
|
64238
|
+
"hiddenPathScope": "screen"
|
|
64270
64239
|
},
|
|
64271
|
-
|
|
64272
|
-
|
|
64240
|
+
{
|
|
64241
|
+
"id": "himi_owner_lite_maestro.newChat",
|
|
64242
|
+
"icon": "edit",
|
|
64243
|
+
"accessibilityLabel": "New chat",
|
|
64244
|
+
"onTap": {
|
|
64245
|
+
"actionId": "tier5.himiOwnerLiteMaestro.newChat"
|
|
64246
|
+
},
|
|
64247
|
+
"hiddenPath": "$service:himiOwnerLiteMaestro.chatHidden",
|
|
64248
|
+
"hiddenPathScope": "screen"
|
|
64249
|
+
}
|
|
64250
|
+
]
|
|
64273
64251
|
},
|
|
64274
64252
|
"stickyFooter": {
|
|
64275
64253
|
"id": "himi_owner_lite_maestro.composer",
|
|
@@ -64367,50 +64345,111 @@ const SCREENS = runtimeSetting({
|
|
|
64367
64345
|
}
|
|
64368
64346
|
},
|
|
64369
64347
|
{
|
|
64370
|
-
"id": "
|
|
64348
|
+
"id": "",
|
|
64371
64349
|
"body": {
|
|
64372
64350
|
"package": "himalaya",
|
|
64373
|
-
"type": "
|
|
64351
|
+
"type": "HStack",
|
|
64374
64352
|
"props": {
|
|
64375
|
-
"
|
|
64376
|
-
"
|
|
64353
|
+
"spacing": 8,
|
|
64354
|
+
"alignment": "trailing",
|
|
64355
|
+
"children": [
|
|
64377
64356
|
{
|
|
64378
|
-
"id": "
|
|
64357
|
+
"id": "himi_owner_lite_maestro.input",
|
|
64379
64358
|
"body": {
|
|
64380
64359
|
"package": "himalaya",
|
|
64381
|
-
"type": "
|
|
64360
|
+
"type": "TextField",
|
|
64382
64361
|
"props": {
|
|
64383
|
-
"
|
|
64384
|
-
"
|
|
64385
|
-
"
|
|
64386
|
-
"
|
|
64387
|
-
|
|
64388
|
-
|
|
64389
|
-
|
|
64390
|
-
"
|
|
64391
|
-
|
|
64392
|
-
|
|
64393
|
-
|
|
64394
|
-
|
|
64395
|
-
|
|
64362
|
+
"valuePath": "$service:himiOwnerLiteMaestro.input",
|
|
64363
|
+
"placeholder": "Ask Maestro…",
|
|
64364
|
+
"keyboard": "default",
|
|
64365
|
+
"autoCapitalization": "sentences",
|
|
64366
|
+
"multilineMaxLines": 4,
|
|
64367
|
+
"maxLength": 4000,
|
|
64368
|
+
"onChange": {
|
|
64369
|
+
"actionId": "tier5.himiOwnerLiteMaestro.setInput"
|
|
64370
|
+
},
|
|
64371
|
+
"borderless": true
|
|
64372
|
+
}
|
|
64373
|
+
},
|
|
64374
|
+
"modifiers": {
|
|
64375
|
+
"weight": 1,
|
|
64376
|
+
"accessibilityLabel": "Ask Maestro…",
|
|
64377
|
+
"background": {
|
|
64378
|
+
"token": "surfaceSecondary"
|
|
64379
|
+
},
|
|
64380
|
+
"cornerRadius": 22,
|
|
64381
|
+
"padding": {
|
|
64382
|
+
"leading": 16,
|
|
64383
|
+
"trailing": 12,
|
|
64384
|
+
"top": 11,
|
|
64385
|
+
"bottom": 11
|
|
64396
64386
|
}
|
|
64397
64387
|
}
|
|
64398
|
-
}
|
|
64399
|
-
|
|
64400
|
-
|
|
64401
|
-
|
|
64402
|
-
|
|
64403
|
-
|
|
64404
|
-
|
|
64405
|
-
|
|
64406
|
-
|
|
64407
|
-
|
|
64408
|
-
|
|
64409
|
-
|
|
64388
|
+
},
|
|
64389
|
+
{
|
|
64390
|
+
"id": "",
|
|
64391
|
+
"body": {
|
|
64392
|
+
"package": "himalaya",
|
|
64393
|
+
"type": "ZStack",
|
|
64394
|
+
"props": {
|
|
64395
|
+
"alignment": "center",
|
|
64396
|
+
"children": [
|
|
64397
|
+
{
|
|
64398
|
+
"id": "himi_owner_lite_maestro.send_off",
|
|
64399
|
+
"body": {
|
|
64400
|
+
"package": "himalaya",
|
|
64401
|
+
"type": "Icon",
|
|
64402
|
+
"props": {
|
|
64403
|
+
"name": "send",
|
|
64404
|
+
"size": 20,
|
|
64405
|
+
"tint": "textTertiary"
|
|
64406
|
+
}
|
|
64407
|
+
},
|
|
64408
|
+
"modifiers": {
|
|
64409
|
+
"accessibilityRole": "decorative",
|
|
64410
|
+
"width": 44,
|
|
64411
|
+
"height": 44,
|
|
64412
|
+
"cornerRadius": 22,
|
|
64413
|
+
"background": {
|
|
64414
|
+
"token": "surfaceSecondary"
|
|
64415
|
+
}
|
|
64416
|
+
}
|
|
64417
|
+
},
|
|
64418
|
+
{
|
|
64419
|
+
"id": "himi_owner_lite_maestro.send",
|
|
64420
|
+
"body": {
|
|
64421
|
+
"package": "himalaya",
|
|
64422
|
+
"type": "Icon",
|
|
64423
|
+
"props": {
|
|
64424
|
+
"name": "send",
|
|
64425
|
+
"size": 20,
|
|
64426
|
+
"tint": "textOnAccent"
|
|
64427
|
+
}
|
|
64428
|
+
},
|
|
64429
|
+
"modifiers": {
|
|
64430
|
+
"accessibilityRole": "button",
|
|
64431
|
+
"width": 44,
|
|
64432
|
+
"height": 44,
|
|
64433
|
+
"cornerRadius": 22,
|
|
64434
|
+
"background": {
|
|
64435
|
+
"token": "accentPrimary"
|
|
64436
|
+
},
|
|
64437
|
+
"accessibilityLabel": "Send",
|
|
64438
|
+
"onTap": {
|
|
64439
|
+
"actionId": "tier5.himiOwnerLiteMaestro.submit"
|
|
64440
|
+
},
|
|
64441
|
+
"hiddenPath": "$service:himiOwnerLiteMaestro.noInput"
|
|
64442
|
+
}
|
|
64443
|
+
}
|
|
64444
|
+
]
|
|
64410
64445
|
}
|
|
64446
|
+
},
|
|
64447
|
+
"modifiers": {
|
|
64448
|
+
"width": 44,
|
|
64449
|
+
"height": 44
|
|
64411
64450
|
}
|
|
64412
64451
|
}
|
|
64413
|
-
|
|
64452
|
+
]
|
|
64414
64453
|
}
|
|
64415
64454
|
}
|
|
64416
64455
|
}
|
|
@@ -64437,8 +64476,7 @@ const SCREENS = runtimeSetting({
|
|
|
64437
64476
|
},
|
|
64438
64477
|
"hostTitle": {
|
|
64439
64478
|
"title": "Maestro",
|
|
64440
|
-
"
|
|
64441
|
-
"replaces": "himi_owner_lite_maestro.header"
|
|
64479
|
+
"replaces": "himi_owner_lite_maestro.header.title"
|
|
64442
64480
|
}
|
|
64443
64481
|
},
|
|
64444
64482
|
"himi_owner_lite_maestro_history": {
|
|
@@ -64575,7 +64613,7 @@ const SCREENS = runtimeSetting({
|
|
|
64575
64613
|
"package": "himalaya",
|
|
64576
64614
|
"type": "Icon",
|
|
64577
64615
|
"props": {
|
|
64578
|
-
"name": "
|
|
64616
|
+
"name": "chat",
|
|
64579
64617
|
"size": 20,
|
|
64580
64618
|
"tint": "accentPrimary"
|
|
64581
64619
|
}
|
|
@@ -64661,8 +64699,7 @@ const SCREENS = runtimeSetting({
|
|
|
64661
64699
|
"screenId": "himi_owner_lite_maestro",
|
|
64662
64700
|
"conversationId": "$item.id",
|
|
64663
64701
|
"n": "$item.stamp",
|
|
64664
|
-
"title": "Maestro"
|
|
64665
|
-
"subtitle": "Your business assistant, by Symphony."
|
|
64702
|
+
"title": "Maestro"
|
|
64666
64703
|
}
|
|
64667
64704
|
}
|
|
64668
64705
|
}
|
|
@@ -64750,6 +64787,9 @@ const SCREENS = runtimeSetting({
|
|
|
64750
64787
|
"minBinaryVersion": "0.1.0",
|
|
64751
64788
|
"bundleVersion": "0.0.1"
|
|
64752
64789
|
},
|
|
64790
|
+
"topBar": {
|
|
64791
|
+
"actions": []
|
|
64792
|
+
},
|
|
64753
64793
|
"hostTitle": {
|
|
64754
64794
|
"title": "Conversations",
|
|
64755
64795
|
"subtitle": "Pick up where you left off.",
|
|
@@ -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
|
+
}
|