@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;
|
|
@@ -13,7 +13,7 @@ import { formatWeekdayDateTime } from "../_shared/engine-intl.js";
|
|
|
13
13
|
import { ownerLoadError, isBridgeUnavailable, isOwnerPreviewDemo } from "../_shared/owner-load-error.js";
|
|
14
14
|
import { DEMO_APPOINTMENTS, DEMO_NOTE, demoAppointmentWindow } from "../_shared/owner-preview-demo.js";
|
|
15
15
|
import { copyParam } from "../_shared/himi-copy.js";
|
|
16
|
-
import { askMaestroHidden } from "../_shared/owner-maestro-tab.js";
|
|
16
|
+
import { askMaestroHidden, askMaestroNav } from "../_shared/owner-maestro-tab.js";
|
|
17
17
|
|
|
18
18
|
interface ActionRow { id: string; label: string; action: string; url: string; screen: string; title: string; }
|
|
19
19
|
interface KV { id: string; label: string; value: string; }
|
|
@@ -206,9 +206,12 @@ const svc = defineService<BookingState, {
|
|
|
206
206
|
markPaid: (s: BookingState) => Promise<BookingState>;
|
|
207
207
|
setAttended: (s: BookingState) => Promise<BookingState>;
|
|
208
208
|
setNoShow: (s: BookingState) => Promise<BookingState>;
|
|
209
|
+
askMaestro: (s: BookingState) => BookingState;
|
|
209
210
|
}>("ownerBooking", {
|
|
210
211
|
state: { id: "", askMaestroHidden: "true", status: "loading", title: "", subtitle: "", initial: "?", when: "—", ends: "—", participants: "—", email: "—", phone: "—", staff: "—", location: "", locationHeader: "", videoLabel: "", videoUrl: "", intakeHeader: "", intake: "", actions: [], bookingStatus: "—", payment: "—", statusRaw: "", paymentRaw: "", orderId: "", isClass: false, attendedRaw: false, hideConfirm: true, hideMarkPaid: true, hideAttendance: true, hideDecline: true, hideCancel: true, revision: "", actionError: "", error: "", demoNote: "", notDemo: true },
|
|
211
212
|
actions: {
|
|
213
|
+
// "Ask Maestro": the chat opens on the Maestro tab, about this booking.
|
|
214
|
+
askMaestro: (s) => askMaestroNav(s, { kind: "booking", id: s.id, subject: s.title }),
|
|
212
215
|
load: async (s) => {
|
|
213
216
|
try { return { ...(await fetchInto(s)), id: bookingId(), askMaestroHidden: askMaestroHidden() }; }
|
|
214
217
|
catch (e) {
|
|
@@ -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;
|
|
@@ -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
|
}
|
|
@@ -56908,6 +56904,9 @@ const SCREENS = runtimeSetting({
|
|
|
56908
56904
|
],
|
|
56909
56905
|
"minBinaryVersion": "0.1.0",
|
|
56910
56906
|
"bundleVersion": "0.0.1"
|
|
56907
|
+
},
|
|
56908
|
+
"topBar": {
|
|
56909
|
+
"actions": []
|
|
56911
56910
|
}
|
|
56912
56911
|
},
|
|
56913
56912
|
"himi_owner_lite_brief": {
|
|
@@ -63783,6 +63782,22 @@ const SCREENS = runtimeSetting({
|
|
|
63783
63782
|
"collapseWhenEmpty": true
|
|
63784
63783
|
}
|
|
63785
63784
|
}
|
|
63785
|
+
},
|
|
63786
|
+
{
|
|
63787
|
+
"id": "himi_owner_lite_maestro.context",
|
|
63788
|
+
"body": {
|
|
63789
|
+
"package": "himalaya",
|
|
63790
|
+
"type": "Text",
|
|
63791
|
+
"props": {
|
|
63792
|
+
"text": "$service:himiOwnerLiteMaestro.contextLabel",
|
|
63793
|
+
"style": "footnote",
|
|
63794
|
+
"color": "textSecondary",
|
|
63795
|
+
"maxLines": 1
|
|
63796
|
+
}
|
|
63797
|
+
},
|
|
63798
|
+
"modifiers": {
|
|
63799
|
+
"hiddenPath": "$service:himiOwnerLiteMaestro.contextHidden"
|
|
63800
|
+
}
|
|
63786
63801
|
}
|
|
63787
63802
|
]
|
|
63788
63803
|
}
|
|
@@ -64046,16 +64061,32 @@ const SCREENS = runtimeSetting({
|
|
|
64046
64061
|
"package": "himalaya",
|
|
64047
64062
|
"type": "Text",
|
|
64048
64063
|
"props": {
|
|
64049
|
-
"text": "
|
|
64064
|
+
"text": "$item.content",
|
|
64050
64065
|
"style": "footnote",
|
|
64051
64066
|
"color": "textSecondary",
|
|
64052
|
-
"maxLines":
|
|
64067
|
+
"maxLines": 2
|
|
64053
64068
|
}
|
|
64054
64069
|
},
|
|
64055
64070
|
"modifiers": {
|
|
64056
64071
|
"hiddenPath": "$item.thinkingHidden"
|
|
64057
64072
|
}
|
|
64058
64073
|
},
|
|
64074
|
+
{
|
|
64075
|
+
"id": "",
|
|
64076
|
+
"body": {
|
|
64077
|
+
"package": "himalaya",
|
|
64078
|
+
"type": "Text",
|
|
64079
|
+
"props": {
|
|
64080
|
+
"text": "$item.content",
|
|
64081
|
+
"style": "footnote",
|
|
64082
|
+
"color": "textSecondary",
|
|
64083
|
+
"maxLines": 3
|
|
64084
|
+
}
|
|
64085
|
+
},
|
|
64086
|
+
"modifiers": {
|
|
64087
|
+
"hiddenPath": "$item.noteHidden"
|
|
64088
|
+
}
|
|
64089
|
+
},
|
|
64059
64090
|
{
|
|
64060
64091
|
"id": "himi_owner_lite_maestro.card_$item.id",
|
|
64061
64092
|
"body": {
|
|
@@ -64246,6 +64277,7 @@ const SCREENS = runtimeSetting({
|
|
|
64246
64277
|
"top": 18,
|
|
64247
64278
|
"bottom": 24
|
|
64248
64279
|
},
|
|
64280
|
+
"keyboardDismiss": "tap",
|
|
64249
64281
|
"onAppear": {
|
|
64250
64282
|
"actionId": "tier5.himiOwnerLiteMaestro.load"
|
|
64251
64283
|
}
|
|
@@ -64264,88 +64296,34 @@ const SCREENS = runtimeSetting({
|
|
|
64264
64296
|
"minBinaryVersion": "0.1.0",
|
|
64265
64297
|
"bundleVersion": "0.0.1"
|
|
64266
64298
|
},
|
|
64267
|
-
"
|
|
64268
|
-
"
|
|
64269
|
-
|
|
64270
|
-
|
|
64271
|
-
|
|
64272
|
-
|
|
64273
|
-
"
|
|
64274
|
-
|
|
64275
|
-
{
|
|
64276
|
-
"
|
|
64277
|
-
"
|
|
64278
|
-
|
|
64279
|
-
"type": "Text",
|
|
64280
|
-
"props": {
|
|
64281
|
-
"text": "$service:himiOwnerLiteMaestro.contextLabel",
|
|
64282
|
-
"style": "footnote",
|
|
64283
|
-
"color": "textSecondary",
|
|
64284
|
-
"maxLines": 1,
|
|
64285
|
-
"collapseWhenEmpty": true
|
|
64286
|
-
}
|
|
64287
|
-
}
|
|
64288
|
-
},
|
|
64289
|
-
{
|
|
64290
|
-
"id": "",
|
|
64291
|
-
"body": {
|
|
64292
|
-
"package": "himalaya",
|
|
64293
|
-
"type": "Spacer",
|
|
64294
|
-
"props": {}
|
|
64295
|
-
}
|
|
64296
|
-
},
|
|
64297
|
-
{
|
|
64298
|
-
"id": "himi_owner_lite_maestro.history",
|
|
64299
|
-
"body": {
|
|
64300
|
-
"package": "himalaya",
|
|
64301
|
-
"type": "Button",
|
|
64302
|
-
"props": {
|
|
64303
|
-
"title": "History",
|
|
64304
|
-
"style": "link",
|
|
64305
|
-
"size": "sm",
|
|
64306
|
-
"fullWidth": false,
|
|
64307
|
-
"action": {
|
|
64308
|
-
"actionId": "himi.open",
|
|
64309
|
-
"params": {
|
|
64310
|
-
"screenId": "himi_owner_lite_maestro_history",
|
|
64311
|
-
"title": "Conversations",
|
|
64312
|
-
"subtitle": "Pick up where you left off."
|
|
64313
|
-
}
|
|
64314
|
-
}
|
|
64315
|
-
}
|
|
64316
|
-
}
|
|
64317
|
-
},
|
|
64318
|
-
{
|
|
64319
|
-
"id": "himi_owner_lite_maestro.newChat",
|
|
64320
|
-
"body": {
|
|
64321
|
-
"package": "himalaya",
|
|
64322
|
-
"type": "Button",
|
|
64323
|
-
"props": {
|
|
64324
|
-
"title": "New chat",
|
|
64325
|
-
"style": "link",
|
|
64326
|
-
"size": "sm",
|
|
64327
|
-
"fullWidth": false,
|
|
64328
|
-
"action": {
|
|
64329
|
-
"actionId": "tier5.himiOwnerLiteMaestro.newChat"
|
|
64330
|
-
}
|
|
64331
|
-
}
|
|
64332
|
-
}
|
|
64299
|
+
"topBar": {
|
|
64300
|
+
"actions": [
|
|
64301
|
+
{
|
|
64302
|
+
"id": "himi_owner_lite_maestro.history",
|
|
64303
|
+
"icon": "clock",
|
|
64304
|
+
"accessibilityLabel": "History",
|
|
64305
|
+
"onTap": {
|
|
64306
|
+
"actionId": "himi.open",
|
|
64307
|
+
"params": {
|
|
64308
|
+
"screenId": "himi_owner_lite_maestro_history",
|
|
64309
|
+
"title": "Conversations",
|
|
64310
|
+
"subtitle": "Pick up where you left off."
|
|
64333
64311
|
}
|
|
64334
|
-
|
|
64335
|
-
|
|
64336
|
-
|
|
64337
|
-
"modifiers": {
|
|
64338
|
-
"background": {
|
|
64339
|
-
"token": "surfacePrimary"
|
|
64312
|
+
},
|
|
64313
|
+
"hiddenPath": "$service:himiOwnerLiteMaestro.chatHidden",
|
|
64314
|
+
"hiddenPathScope": "screen"
|
|
64340
64315
|
},
|
|
64341
|
-
|
|
64342
|
-
"
|
|
64343
|
-
"
|
|
64344
|
-
"
|
|
64345
|
-
"
|
|
64346
|
-
|
|
64347
|
-
|
|
64348
|
-
|
|
64316
|
+
{
|
|
64317
|
+
"id": "himi_owner_lite_maestro.newChat",
|
|
64318
|
+
"icon": "edit",
|
|
64319
|
+
"accessibilityLabel": "New chat",
|
|
64320
|
+
"onTap": {
|
|
64321
|
+
"actionId": "tier5.himiOwnerLiteMaestro.newChat"
|
|
64322
|
+
},
|
|
64323
|
+
"hiddenPath": "$service:himiOwnerLiteMaestro.chatHidden",
|
|
64324
|
+
"hiddenPathScope": "screen"
|
|
64325
|
+
}
|
|
64326
|
+
]
|
|
64349
64327
|
},
|
|
64350
64328
|
"stickyFooter": {
|
|
64351
64329
|
"id": "himi_owner_lite_maestro.composer",
|
|
@@ -64443,50 +64421,111 @@ const SCREENS = runtimeSetting({
|
|
|
64443
64421
|
}
|
|
64444
64422
|
},
|
|
64445
64423
|
{
|
|
64446
|
-
"id": "
|
|
64424
|
+
"id": "",
|
|
64447
64425
|
"body": {
|
|
64448
64426
|
"package": "himalaya",
|
|
64449
|
-
"type": "
|
|
64427
|
+
"type": "HStack",
|
|
64450
64428
|
"props": {
|
|
64451
|
-
"
|
|
64452
|
-
"
|
|
64429
|
+
"spacing": 8,
|
|
64430
|
+
"alignment": "trailing",
|
|
64431
|
+
"children": [
|
|
64453
64432
|
{
|
|
64454
|
-
"id": "
|
|
64433
|
+
"id": "himi_owner_lite_maestro.input",
|
|
64455
64434
|
"body": {
|
|
64456
64435
|
"package": "himalaya",
|
|
64457
|
-
"type": "
|
|
64436
|
+
"type": "TextField",
|
|
64458
64437
|
"props": {
|
|
64459
|
-
"
|
|
64460
|
-
"
|
|
64461
|
-
"
|
|
64462
|
-
"
|
|
64463
|
-
|
|
64464
|
-
|
|
64465
|
-
|
|
64466
|
-
"
|
|
64467
|
-
|
|
64468
|
-
|
|
64469
|
-
|
|
64470
|
-
|
|
64471
|
-
|
|
64438
|
+
"valuePath": "$service:himiOwnerLiteMaestro.input",
|
|
64439
|
+
"placeholder": "Ask Maestro…",
|
|
64440
|
+
"keyboard": "default",
|
|
64441
|
+
"autoCapitalization": "sentences",
|
|
64442
|
+
"multilineMaxLines": 4,
|
|
64443
|
+
"maxLength": 4000,
|
|
64444
|
+
"onChange": {
|
|
64445
|
+
"actionId": "tier5.himiOwnerLiteMaestro.setInput"
|
|
64446
|
+
},
|
|
64447
|
+
"borderless": true
|
|
64448
|
+
}
|
|
64449
|
+
},
|
|
64450
|
+
"modifiers": {
|
|
64451
|
+
"weight": 1,
|
|
64452
|
+
"accessibilityLabel": "Ask Maestro…",
|
|
64453
|
+
"background": {
|
|
64454
|
+
"token": "surfaceSecondary"
|
|
64455
|
+
},
|
|
64456
|
+
"cornerRadius": 22,
|
|
64457
|
+
"padding": {
|
|
64458
|
+
"leading": 16,
|
|
64459
|
+
"trailing": 12,
|
|
64460
|
+
"top": 11,
|
|
64461
|
+
"bottom": 11
|
|
64472
64462
|
}
|
|
64473
64463
|
}
|
|
64474
|
-
}
|
|
64475
|
-
|
|
64476
|
-
|
|
64477
|
-
|
|
64478
|
-
|
|
64479
|
-
|
|
64480
|
-
|
|
64481
|
-
|
|
64482
|
-
|
|
64483
|
-
|
|
64484
|
-
|
|
64485
|
-
|
|
64464
|
+
},
|
|
64465
|
+
{
|
|
64466
|
+
"id": "",
|
|
64467
|
+
"body": {
|
|
64468
|
+
"package": "himalaya",
|
|
64469
|
+
"type": "ZStack",
|
|
64470
|
+
"props": {
|
|
64471
|
+
"alignment": "center",
|
|
64472
|
+
"children": [
|
|
64473
|
+
{
|
|
64474
|
+
"id": "himi_owner_lite_maestro.send_off",
|
|
64475
|
+
"body": {
|
|
64476
|
+
"package": "himalaya",
|
|
64477
|
+
"type": "Icon",
|
|
64478
|
+
"props": {
|
|
64479
|
+
"name": "send",
|
|
64480
|
+
"size": 20,
|
|
64481
|
+
"tint": "textTertiary"
|
|
64482
|
+
}
|
|
64483
|
+
},
|
|
64484
|
+
"modifiers": {
|
|
64485
|
+
"accessibilityRole": "decorative",
|
|
64486
|
+
"width": 44,
|
|
64487
|
+
"height": 44,
|
|
64488
|
+
"cornerRadius": 22,
|
|
64489
|
+
"background": {
|
|
64490
|
+
"token": "surfaceSecondary"
|
|
64491
|
+
}
|
|
64492
|
+
}
|
|
64493
|
+
},
|
|
64494
|
+
{
|
|
64495
|
+
"id": "himi_owner_lite_maestro.send",
|
|
64496
|
+
"body": {
|
|
64497
|
+
"package": "himalaya",
|
|
64498
|
+
"type": "Icon",
|
|
64499
|
+
"props": {
|
|
64500
|
+
"name": "send",
|
|
64501
|
+
"size": 20,
|
|
64502
|
+
"tint": "textOnAccent"
|
|
64503
|
+
}
|
|
64504
|
+
},
|
|
64505
|
+
"modifiers": {
|
|
64506
|
+
"accessibilityRole": "button",
|
|
64507
|
+
"width": 44,
|
|
64508
|
+
"height": 44,
|
|
64509
|
+
"cornerRadius": 22,
|
|
64510
|
+
"background": {
|
|
64511
|
+
"token": "accentPrimary"
|
|
64512
|
+
},
|
|
64513
|
+
"accessibilityLabel": "Send",
|
|
64514
|
+
"onTap": {
|
|
64515
|
+
"actionId": "tier5.himiOwnerLiteMaestro.submit"
|
|
64516
|
+
},
|
|
64517
|
+
"hiddenPath": "$service:himiOwnerLiteMaestro.noInput"
|
|
64518
|
+
}
|
|
64519
|
+
}
|
|
64520
|
+
]
|
|
64486
64521
|
}
|
|
64522
|
+
},
|
|
64523
|
+
"modifiers": {
|
|
64524
|
+
"width": 44,
|
|
64525
|
+
"height": 44
|
|
64487
64526
|
}
|
|
64488
64527
|
}
|
|
64489
|
-
|
|
64528
|
+
]
|
|
64490
64529
|
}
|
|
64491
64530
|
}
|
|
64492
64531
|
}
|
|
@@ -64513,8 +64552,7 @@ const SCREENS = runtimeSetting({
|
|
|
64513
64552
|
},
|
|
64514
64553
|
"hostTitle": {
|
|
64515
64554
|
"title": "Maestro",
|
|
64516
|
-
"
|
|
64517
|
-
"replaces": "himi_owner_lite_maestro.header"
|
|
64555
|
+
"replaces": "himi_owner_lite_maestro.header.title"
|
|
64518
64556
|
}
|
|
64519
64557
|
},
|
|
64520
64558
|
"himi_owner_lite_maestro_history": {
|
|
@@ -64651,7 +64689,7 @@ const SCREENS = runtimeSetting({
|
|
|
64651
64689
|
"package": "himalaya",
|
|
64652
64690
|
"type": "Icon",
|
|
64653
64691
|
"props": {
|
|
64654
|
-
"name": "
|
|
64692
|
+
"name": "chat",
|
|
64655
64693
|
"size": 20,
|
|
64656
64694
|
"tint": "accentPrimary"
|
|
64657
64695
|
}
|
|
@@ -64737,8 +64775,7 @@ const SCREENS = runtimeSetting({
|
|
|
64737
64775
|
"screenId": "himi_owner_lite_maestro",
|
|
64738
64776
|
"conversationId": "$item.id",
|
|
64739
64777
|
"n": "$item.stamp",
|
|
64740
|
-
"title": "Maestro"
|
|
64741
|
-
"subtitle": "Your business assistant, by Symphony."
|
|
64778
|
+
"title": "Maestro"
|
|
64742
64779
|
}
|
|
64743
64780
|
}
|
|
64744
64781
|
}
|
|
@@ -64826,6 +64863,9 @@ const SCREENS = runtimeSetting({
|
|
|
64826
64863
|
"minBinaryVersion": "0.1.0",
|
|
64827
64864
|
"bundleVersion": "0.0.1"
|
|
64828
64865
|
},
|
|
64866
|
+
"topBar": {
|
|
64867
|
+
"actions": []
|
|
64868
|
+
},
|
|
64829
64869
|
"hostTitle": {
|
|
64830
64870
|
"title": "Conversations",
|
|
64831
64871
|
"subtitle": "Pick up where you left off.",
|
|
@@ -82908,14 +82948,9 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
82908
82948
|
"fullWidth": true,
|
|
82909
82949
|
"leadingIcon": "ai",
|
|
82910
82950
|
"action": {
|
|
82911
|
-
"actionId": "
|
|
82951
|
+
"actionId": "tier5.ownerBooking.askMaestro",
|
|
82912
82952
|
"params": {
|
|
82913
|
-
"
|
|
82914
|
-
"kind": "booking",
|
|
82915
|
-
"id": "$service:ownerBooking.id",
|
|
82916
|
-
"subject": "$service:ownerBooking.title",
|
|
82917
|
-
"title": "Maestro",
|
|
82918
|
-
"subtitle": "Your business assistant, by Symphony."
|
|
82953
|
+
"kind": "booking"
|
|
82919
82954
|
}
|
|
82920
82955
|
}
|
|
82921
82956
|
}
|
|
@@ -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
|
}
|