@wix/himalaya-cli 0.1947.0 → 0.1949.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/sdk/files/src/index.d.ts +23 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/admob-ids.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/index.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/social-feed/src/index.d.ts +13 -4
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/video/src/display.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +8 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/files.mjs +4 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +3 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-video.mjs +4 -0
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{da958a2a47eef7082c7892c1cc755a58bbeefcb4b617b47fde87f1ce567b3e64.bin → a8cfd0e17359578587e8937e88dedd40b46d533f08b4d2fdac4c47d5bae6f385.bin} +1 -1
- package/dist/browser-plane/sw.js +9 -9
- package/dist/cli.mjs +1906 -800
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/app-icon.md +7 -3
- package/guides/getting-started.md +6 -1
- package/guides/himi-skill.md +6 -1
- package/guides/himi-test.md +30 -1
- package/guides/one-app-section-mappings.md +1 -1
- package/guides/one-app-to-himi-app.md +23 -16
- package/guides/sdk-reference.json +28 -7
- package/guides/skill.md +1 -1
- package/package.json +2 -2
- package/templates/beauty-salon-owner/config.ts +7 -0
- package/templates/beauty-salon-owner/dev/index.ts +567 -0
- package/templates/beauty-salon-owner/himalaya.content.json +3 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/owner-maestro-activity.ts +151 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/owner-maestro-availability.ts +15 -2
- package/templates/beauty-salon-owner/tier5-src/_shared/owner-maestro-chat.ts +20 -7
- package/templates/beauty-salon-owner/tier5-src/_shared/owner-maestro-when.ts +13 -0
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-maestro/index.ts +60 -11
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-maestro-activity/index.ts +228 -0
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +1 -11
- package/templates/branded-lite/l10n/ar.json +21 -0
- package/templates/branded-lite/l10n/cs.json +21 -0
- package/templates/branded-lite/l10n/da.json +21 -0
- package/templates/branded-lite/l10n/de.json +21 -0
- package/templates/branded-lite/l10n/el.json +21 -0
- package/templates/branded-lite/l10n/en.json +5 -0
- package/templates/branded-lite/l10n/es.json +21 -0
- package/templates/branded-lite/l10n/fi.json +21 -0
- package/templates/branded-lite/l10n/fr.json +21 -0
- package/templates/branded-lite/l10n/he.json +21 -0
- package/templates/branded-lite/l10n/hu.json +21 -0
- package/templates/branded-lite/l10n/id.json +21 -0
- package/templates/branded-lite/l10n/it.json +21 -0
- package/templates/branded-lite/l10n/ja.json +21 -0
- package/templates/branded-lite/l10n/ko.json +21 -0
- package/templates/branded-lite/l10n/lt.json +21 -0
- package/templates/branded-lite/l10n/nl.json +21 -0
- package/templates/branded-lite/l10n/no.json +21 -0
- package/templates/branded-lite/l10n/pl.json +21 -0
- package/templates/branded-lite/l10n/pt.json +21 -0
- package/templates/branded-lite/l10n/ru.json +21 -0
- package/templates/branded-lite/l10n/sv.json +21 -0
- package/templates/branded-lite/l10n/th.json +21 -0
- package/templates/branded-lite/l10n/tr.json +21 -0
- package/templates/branded-lite/l10n/uk.json +21 -0
- package/templates/branded-lite/l10n/vi.json +21 -0
- package/templates/branded-lite/l10n/zh.json +21 -0
- package/templates/branded-lite/recipes/form-section.json +958 -0
- package/templates/branded-lite/recipes/group-feed.json +221 -3
- package/templates/branded-lite/recipes/groups-newsfeed.json +160 -2
- package/templates/branded-lite/recipes/video-library.json +475 -0
- package/templates/branded-lite/tier5-src/_shared/event-agenda.ts +15 -15
- package/templates/branded-lite/tier5-src/_shared/event-schedule-section.ts +8 -8
- package/templates/branded-lite/tier5-src/_shared/form-section.ts +640 -0
- package/templates/branded-lite/tier5-src/_shared/group-feed-section.ts +119 -7
- package/templates/branded-lite/tier5-src/_shared/groups-newsfeed-section.ts +17 -9
- package/templates/branded-lite/tier5-src/_shared/videos-section.ts +134 -2
- package/templates/branded-lite/tier5-src/himi-branded-lite-form/index.ts +4 -588
- package/templates/branded-lite/tier5-src/himi-branded-lite-video/index.ts +4 -2
- package/templates/branded-lite/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/community-club/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/community-club-owner/config.ts +7 -0
- package/templates/community-club-owner/dev/index.ts +567 -0
- package/templates/community-club-owner/himalaya.content.json +3 -0
- package/templates/community-club-owner/tier5-src/_shared/owner-maestro-activity.ts +151 -0
- package/templates/community-club-owner/tier5-src/_shared/owner-maestro-availability.ts +15 -2
- package/templates/community-club-owner/tier5-src/_shared/owner-maestro-chat.ts +20 -7
- package/templates/community-club-owner/tier5-src/_shared/owner-maestro-when.ts +13 -0
- package/templates/community-club-owner/tier5-src/himi-owner-lite-maestro/index.ts +60 -11
- package/templates/community-club-owner/tier5-src/himi-owner-lite-maestro-activity/index.ts +228 -0
- package/templates/community-club-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +1 -11
- package/templates/conference/tier5-src/_shared/event-agenda.ts +15 -15
- package/templates/conference/tier5-src/himi-conference-agenda/index.ts +3 -5
- package/templates/conference/tier5-src/himi-conference-home/index.ts +5 -6
- package/templates/conference/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/events-meetups/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/events-meetups-owner/config.ts +7 -0
- package/templates/events-meetups-owner/dev/index.ts +567 -0
- package/templates/events-meetups-owner/himalaya.content.json +3 -0
- package/templates/events-meetups-owner/tier5-src/_shared/owner-maestro-activity.ts +151 -0
- package/templates/events-meetups-owner/tier5-src/_shared/owner-maestro-availability.ts +15 -2
- package/templates/events-meetups-owner/tier5-src/_shared/owner-maestro-chat.ts +20 -7
- package/templates/events-meetups-owner/tier5-src/_shared/owner-maestro-when.ts +13 -0
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-maestro/index.ts +60 -11
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-maestro-activity/index.ts +228 -0
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +1 -11
- package/templates/gym-fitness/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/gym-fitness-owner/config.ts +7 -0
- package/templates/gym-fitness-owner/dev/index.ts +567 -0
- package/templates/gym-fitness-owner/himalaya.content.json +3 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/owner-maestro-activity.ts +151 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/owner-maestro-availability.ts +15 -2
- package/templates/gym-fitness-owner/tier5-src/_shared/owner-maestro-chat.ts +20 -7
- package/templates/gym-fitness-owner/tier5-src/_shared/owner-maestro-when.ts +13 -0
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-maestro/index.ts +60 -11
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-maestro-activity/index.ts +228 -0
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +1 -11
- package/templates/nonprofit-cause/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/nonprofit-cause-owner/config.ts +7 -0
- package/templates/nonprofit-cause-owner/dev/index.ts +567 -0
- package/templates/nonprofit-cause-owner/himalaya.content.json +3 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-maestro-activity.ts +151 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-maestro-availability.ts +15 -2
- package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-maestro-chat.ts +20 -7
- package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-maestro-when.ts +13 -0
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-maestro/index.ts +60 -11
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-maestro-activity/index.ts +228 -0
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +1 -11
- package/templates/owner-lite/config.ts +7 -0
- package/templates/owner-lite/dev/index.ts +567 -0
- package/templates/owner-lite/himalaya.content.json +3 -0
- package/templates/owner-lite/tier5-src/_shared/owner-maestro-activity.ts +151 -0
- package/templates/owner-lite/tier5-src/_shared/owner-maestro-availability.ts +15 -2
- package/templates/owner-lite/tier5-src/_shared/owner-maestro-chat.ts +20 -7
- package/templates/owner-lite/tier5-src/_shared/owner-maestro-when.ts +13 -0
- package/templates/owner-lite/tier5-src/himi-owner-lite-maestro/index.ts +60 -11
- package/templates/owner-lite/tier5-src/himi-owner-lite-maestro-activity/index.ts +228 -0
- package/templates/owner-lite/tier5-src/himi-owner-lite-maestro-history/index.ts +1 -11
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-video/index.ts +4 -2
- package/templates/podcast-creator/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/podcast-creator-owner/config.ts +7 -0
- package/templates/podcast-creator-owner/dev/index.ts +567 -0
- package/templates/podcast-creator-owner/himalaya.content.json +3 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/owner-maestro-activity.ts +151 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/owner-maestro-availability.ts +15 -2
- package/templates/podcast-creator-owner/tier5-src/_shared/owner-maestro-chat.ts +20 -7
- package/templates/podcast-creator-owner/tier5-src/_shared/owner-maestro-when.ts +13 -0
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-maestro/index.ts +60 -11
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-maestro-activity/index.ts +228 -0
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +1 -11
- package/templates/portfolio-creative/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/portfolio-creative-owner/config.ts +7 -0
- package/templates/portfolio-creative-owner/dev/index.ts +567 -0
- package/templates/portfolio-creative-owner/himalaya.content.json +3 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/owner-maestro-activity.ts +151 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/owner-maestro-availability.ts +15 -2
- package/templates/portfolio-creative-owner/tier5-src/_shared/owner-maestro-chat.ts +20 -7
- package/templates/portfolio-creative-owner/tier5-src/_shared/owner-maestro-when.ts +13 -0
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-maestro/index.ts +60 -11
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-maestro-activity/index.ts +228 -0
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +1 -11
- package/templates/professional-services/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/restaurant/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/restaurant-owner/config.ts +7 -0
- package/templates/restaurant-owner/dev/index.ts +567 -0
- package/templates/restaurant-owner/himalaya.content.json +3 -0
- package/templates/restaurant-owner/tier5-src/_shared/owner-maestro-activity.ts +151 -0
- package/templates/restaurant-owner/tier5-src/_shared/owner-maestro-availability.ts +15 -2
- package/templates/restaurant-owner/tier5-src/_shared/owner-maestro-chat.ts +20 -7
- package/templates/restaurant-owner/tier5-src/_shared/owner-maestro-when.ts +13 -0
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-maestro/index.ts +60 -11
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-maestro-activity/index.ts +228 -0
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +1 -11
- package/templates/retail-store-owner/config.ts +7 -0
- package/templates/retail-store-owner/dev/index.ts +567 -0
- package/templates/retail-store-owner/himalaya.content.json +3 -0
- package/templates/retail-store-owner/tier5-src/_shared/owner-maestro-activity.ts +151 -0
- package/templates/retail-store-owner/tier5-src/_shared/owner-maestro-availability.ts +15 -2
- package/templates/retail-store-owner/tier5-src/_shared/owner-maestro-chat.ts +20 -7
- package/templates/retail-store-owner/tier5-src/_shared/owner-maestro-when.ts +13 -0
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-maestro/index.ts +60 -11
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-maestro-activity/index.ts +228 -0
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +1 -11
- package/templates/yoga-studio/tier5-src/himi-events-detail/index.ts +7 -6
- package/templates/yoga-studio-owner/config.ts +7 -0
- package/templates/yoga-studio-owner/dev/index.ts +567 -0
- package/templates/yoga-studio-owner/himalaya.content.json +3 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/owner-maestro-activity.ts +151 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/owner-maestro-availability.ts +15 -2
- package/templates/yoga-studio-owner/tier5-src/_shared/owner-maestro-chat.ts +20 -7
- package/templates/yoga-studio-owner/tier5-src/_shared/owner-maestro-when.ts +13 -0
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-maestro/index.ts +60 -11
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-maestro-activity/index.ts +228 -0
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-maestro-history/index.ts +1 -11
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// Tier-5 bundle: __HIMI_APP_NAME__ — what Maestro is doing for the business on screen.
|
|
2
|
+
//
|
|
3
|
+
// One list in three groups, read from Symphony: the tasks the owner gave Maestro, the routines it
|
|
4
|
+
// runs on a schedule, and the goals it works toward. A row opens the Maestro screen on the chat
|
|
5
|
+
// it belongs to; a routine can be paused and resumed here. Nothing is cached: storage is shared
|
|
6
|
+
// by everyone who signs in on the device, and a business id is not an account.
|
|
7
|
+
|
|
8
|
+
import { defineService } from "@himalaya/state";
|
|
9
|
+
import { copyParam, stashCopy } from "../_shared/himi-copy.js";
|
|
10
|
+
import { currentBusinessId } from "../_shared/owner-selected-site.js";
|
|
11
|
+
import { spaceIdsOf, symphonyAccount, type MaestroWixApi } from "../_shared/owner-maestro-availability.js";
|
|
12
|
+
import { whenLabel } from "../_shared/owner-maestro-when.js";
|
|
13
|
+
import {
|
|
14
|
+
goalsOf, routinesOf, setRoutinePaused, tasksOf,
|
|
15
|
+
type GoalStanding, type MaestroGoal, type MaestroRoutine, type MaestroTask, type TaskStanding,
|
|
16
|
+
} from "../_shared/owner-maestro-activity.js";
|
|
17
|
+
|
|
18
|
+
interface Host { wixApi?: MaestroWixApi }
|
|
19
|
+
const host = (): Host => (globalThis as { himalaya?: Host }).himalaya ?? {};
|
|
20
|
+
|
|
21
|
+
/** One row. `key` names it among all three groups; `id` is the task, routine or goal itself.
|
|
22
|
+
* `section` is the group's heading, on its first row only. `stamp` marks the list a row was
|
|
23
|
+
* shown in, so opening the same chat from a later list is a new request to the Maestro screen. */
|
|
24
|
+
export interface ActivityRow {
|
|
25
|
+
key: string; id: string; section: string; title: string; status: string; subtitle: string; conversationId: string; stamp: string;
|
|
26
|
+
/** Marks a row that waits on the owner. */
|
|
27
|
+
attentionHidden: string;
|
|
28
|
+
/** A row with a chat opens it; one without is not a button. Exactly one of the two is "false". */
|
|
29
|
+
openHidden: string; plainHidden: string;
|
|
30
|
+
/** Routines only: the button that pauses or resumes, and whether it is offered. */
|
|
31
|
+
toggleLabel: string; toggleHidden: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface MaestroActivityState {
|
|
35
|
+
items: ActivityRow[]; itemsHidden: string;
|
|
36
|
+
/** Shown until the first read ends. */
|
|
37
|
+
loadingHidden: string;
|
|
38
|
+
/** Says there is nothing to list ("" collapses the line). */
|
|
39
|
+
emptyText: string;
|
|
40
|
+
/** Says the task list was cut, and to how many ("" collapses the line). */
|
|
41
|
+
cutText: string;
|
|
42
|
+
/** Says what could not be read, which is not the same as having none. With rows on screen it
|
|
43
|
+
* is about the groups that are missing. */
|
|
44
|
+
error: string; errorHidden: string;
|
|
45
|
+
/** A change Symphony did not take ("" collapses the line). */
|
|
46
|
+
actionError: string;
|
|
47
|
+
_tasks: MaestroTask[]; _routines: MaestroRoutine[]; _goals: MaestroGoal[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const initial: MaestroActivityState = {
|
|
51
|
+
items: [], itemsHidden: "true", loadingHidden: "false",
|
|
52
|
+
emptyText: "", cutText: "", error: "", errorHidden: "true", actionError: "",
|
|
53
|
+
_tasks: [], _routines: [], _goals: [],
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const EVERY_FIELD = Object.keys(initial) as Array<keyof MaestroActivityState>;
|
|
57
|
+
|
|
58
|
+
/** Symphony's window is thirty days of tasks. Every one that waits on the owner is listed; of the
|
|
59
|
+
* rest, the newest up to this many, and the screen says when it left some out. */
|
|
60
|
+
const MAX_OTHER_TASKS = 50;
|
|
61
|
+
|
|
62
|
+
const TASK_STATUS: Record<TaskStanding, () => string> = {
|
|
63
|
+
needs_you: () => copyParam("ownerMaestroActivity.needsYou", "Needs you"),
|
|
64
|
+
working: () => copyParam("ownerMaestroActivity.working", "Working on it"),
|
|
65
|
+
paused: () => copyParam("ownerMaestroActivity.taskPaused", "Paused"),
|
|
66
|
+
done: () => copyParam("ownerMaestroActivity.done", "Done"),
|
|
67
|
+
stopped: () => copyParam("ownerMaestroActivity.stopped", "Stopped"),
|
|
68
|
+
failed: () => copyParam("ownerMaestroActivity.failed", "Didn't finish"),
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const GOAL_STATUS: Record<GoalStanding, () => string> = {
|
|
72
|
+
suggested: () => copyParam("ownerMaestroActivity.goalSuggested", "Suggested"),
|
|
73
|
+
starting: () => copyParam("ownerMaestroActivity.goalStarting", "Getting started"),
|
|
74
|
+
active: () => copyParam("ownerMaestroActivity.goalActive", "In progress"),
|
|
75
|
+
achieved: () => copyParam("ownerMaestroActivity.goalAchieved", "Achieved"),
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const untitled = (): string => copyParam("ownerMaestroActivity.untitled", "Untitled");
|
|
79
|
+
const joined = (...parts: string[]): string => parts.filter(Boolean).join(" · ");
|
|
80
|
+
const NO_TOGGLE = { toggleLabel: "", toggleHidden: "true" };
|
|
81
|
+
/** Whether the row is a button: only one that has a chat to open. */
|
|
82
|
+
const opening = (conversationId: string): { openHidden: string; plainHidden: string } =>
|
|
83
|
+
(conversationId ? { openHidden: "false", plainHidden: "true" } : { openHidden: "true", plainHidden: "false" });
|
|
84
|
+
|
|
85
|
+
/** A routine's state in words, in Symphony's own order: what Symphony holds it on comes before
|
|
86
|
+
* the owner's pause, since resuming does not lift it. */
|
|
87
|
+
function routineStatus(r: MaestroRoutine): string {
|
|
88
|
+
if (r.ended) return copyParam("ownerMaestroActivity.routineEnded", "Ended");
|
|
89
|
+
if (r.heldBy === "credits") return copyParam("ownerMaestroActivity.routineNoCredits", "Paused: out of credits");
|
|
90
|
+
if (r.heldBy === "error") return copyParam("ownerMaestroActivity.routineError", "Paused: something went wrong");
|
|
91
|
+
if (r.heldBy === "setup") return copyParam("ownerMaestroActivity.routineSetup", "Paused: needs setting up in Symphony");
|
|
92
|
+
return r.paused ? copyParam("ownerMaestroActivity.routinePaused", "Paused") : copyParam("ownerMaestroActivity.routineOn", "On");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** The state as the screen shows it: tasks (the ones that wait on the owner first), then
|
|
96
|
+
* routines, then goals, each group headed on its first row. */
|
|
97
|
+
function shown(s: MaestroActivityState): MaestroActivityState {
|
|
98
|
+
const now = Date.now();
|
|
99
|
+
const stamp = String(now);
|
|
100
|
+
const others = s._tasks.filter((t) => t.standing !== "needs_you");
|
|
101
|
+
const tasks = [...s._tasks.filter((t) => t.standing === "needs_you"), ...others.slice(0, MAX_OTHER_TASKS)];
|
|
102
|
+
const left = others.length - Math.min(others.length, MAX_OTHER_TASKS);
|
|
103
|
+
const groups: Array<{ heading: string; rows: Array<Omit<ActivityRow, "section" | "stamp">> }> = [
|
|
104
|
+
{ heading: copyParam("ownerMaestroActivity.tasks", "Tasks"), rows: tasks.map((t) => ({
|
|
105
|
+
key: `tasks_${t.id}`, id: t.id, title: t.title || untitled(), status: TASK_STATUS[t.standing](),
|
|
106
|
+
subtitle: joined(t.note, whenLabel(t.updated, now)), conversationId: t.conversationId,
|
|
107
|
+
attentionHidden: t.standing === "needs_you" ? "false" : "true", ...opening(t.conversationId), ...NO_TOGGLE,
|
|
108
|
+
})) },
|
|
109
|
+
{ heading: copyParam("ownerMaestroActivity.routines", "Routines"), rows: s._routines.map((r) => ({
|
|
110
|
+
key: `routines_${r.id}`, id: r.id, title: r.name || untitled(), status: routineStatus(r), subtitle: r.schedule, conversationId: r.conversationId,
|
|
111
|
+
attentionHidden: "true", ...opening(r.conversationId),
|
|
112
|
+
toggleLabel: r.paused ? copyParam("ownerMaestroActivity.resume", "Resume") : copyParam("ownerMaestroActivity.pause", "Pause"),
|
|
113
|
+
// Not for one that is over, nor one Symphony holds: the owner's switch would change nothing they can see.
|
|
114
|
+
toggleHidden: r.ended || r.heldBy ? "true" : "false",
|
|
115
|
+
})) },
|
|
116
|
+
{ heading: copyParam("ownerMaestroActivity.goals", "Goals"), rows: s._goals.map((g) => ({
|
|
117
|
+
key: `goals_${g.id}`, id: g.id, title: g.title || untitled(), status: GOAL_STATUS[g.standing](), subtitle: whenLabel(g.updated, now),
|
|
118
|
+
conversationId: g.conversationId, attentionHidden: "true", ...opening(g.conversationId), ...NO_TOGGLE,
|
|
119
|
+
})) },
|
|
120
|
+
];
|
|
121
|
+
const items: ActivityRow[] = groups.flatMap((g) => g.rows.map((row, index) => ({ ...row, section: index === 0 ? g.heading : "", stamp })));
|
|
122
|
+
return {
|
|
123
|
+
...s, items, itemsHidden: items.length ? "false" : "true", loadingHidden: "true",
|
|
124
|
+
cutText: left === 1 ? copyParam("ownerMaestroActivity.taskCut", "1 older task is not listed.")
|
|
125
|
+
: left > 1 ? copyParam("ownerMaestroActivity.tasksCut", "{count} older tasks are not listed.").replace("{count}", String(left)) : "",
|
|
126
|
+
emptyText: items.length || s.errorHidden === "false" ? ""
|
|
127
|
+
: copyParam("ownerMaestroActivity.empty", "Nothing yet. What you ask Maestro to do for this business shows up here."),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const loaded: MaestroActivityState = { ...initial, loadingHidden: "true" };
|
|
132
|
+
const none = (): MaestroActivityState => shown(loaded);
|
|
133
|
+
const failed = (): MaestroActivityState =>
|
|
134
|
+
({ ...loaded, error: copyParam("ownerMaestroActivity.loadFailed", "Maestro's activity couldn't be loaded. Try again in a moment."), errorHidden: "false" });
|
|
135
|
+
|
|
136
|
+
const idOf = (arg: unknown): string => {
|
|
137
|
+
const id = (arg as { id?: unknown } | undefined)?.id;
|
|
138
|
+
return typeof id === "string" ? id : "";
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
// A read started for a business the owner has since left, or overtaken by a newer read, is dropped.
|
|
142
|
+
let reads = 0;
|
|
143
|
+
/** The state as it is now, which an action that waited on Symphony may no longer hold. */
|
|
144
|
+
const live = (fallback: MaestroActivityState): MaestroActivityState =>
|
|
145
|
+
(svc as unknown as { getState?: () => MaestroActivityState }).getState?.() ?? fallback;
|
|
146
|
+
// One change at a time: each result is built from the state it started with.
|
|
147
|
+
let changing = false;
|
|
148
|
+
// The owner's own switches: a read that started before one was made was answered with what was
|
|
149
|
+
// true before it, so the switch goes over that read's answer. `upTo` is the newest read started
|
|
150
|
+
// when the change was made.
|
|
151
|
+
const switched = new Map<string, { paused: boolean; upTo: number }>();
|
|
152
|
+
|
|
153
|
+
const svc = defineService<MaestroActivityState, {
|
|
154
|
+
load: (s: MaestroActivityState, arg?: unknown) => Promise<MaestroActivityState>;
|
|
155
|
+
toggleRoutine: (s: MaestroActivityState, arg?: unknown) => Promise<MaestroActivityState>;
|
|
156
|
+
}>("himiOwnerLiteMaestroActivity", {
|
|
157
|
+
state: initial,
|
|
158
|
+
// Read again on every appear and never shown from an earlier run.
|
|
159
|
+
notPersisted: EVERY_FIELD,
|
|
160
|
+
notHydrated: EVERY_FIELD,
|
|
161
|
+
actions: {
|
|
162
|
+
load: async (s, arg) => {
|
|
163
|
+
stashCopy(arg);
|
|
164
|
+
const site = currentBusinessId();
|
|
165
|
+
const api = host().wixApi;
|
|
166
|
+
// Counted even when nothing can be asked: a read still out for the last business is then stale.
|
|
167
|
+
const read = ++reads;
|
|
168
|
+
if (!site || !api) return failed();
|
|
169
|
+
// Whatever this read finds, it is for a screen that is gone once a newer read started or the
|
|
170
|
+
// owner picked another business.
|
|
171
|
+
const stale = (): boolean => read !== reads || currentBusinessId() !== site;
|
|
172
|
+
// A dropped read leaves the screen as it is. When it was the first, and no newer read is on
|
|
173
|
+
// its way, that would be "Loading…" for good: it says it failed, with Try again.
|
|
174
|
+
const dropped = (): MaestroActivityState => {
|
|
175
|
+
const now = live(s);
|
|
176
|
+
return now.loadingHidden === "false" && read === reads ? failed() : now;
|
|
177
|
+
};
|
|
178
|
+
try {
|
|
179
|
+
// No Symphony account, or a business that is not a Space: nothing to list.
|
|
180
|
+
const account = await symphonyAccount(api);
|
|
181
|
+
const spaces = account ? await spaceIdsOf(api, account, site) : [];
|
|
182
|
+
if (!spaces.length) return stale() ? dropped() : none();
|
|
183
|
+
// Each group on its own: one that could not be read does not take the others with it.
|
|
184
|
+
const [tasks, routines, goals] = await Promise.allSettled([tasksOf(api, spaces), routinesOf(api, spaces), goalsOf(api, spaces)]);
|
|
185
|
+
if (stale()) return dropped();
|
|
186
|
+
const read3 = [tasks, routines, goals];
|
|
187
|
+
if (read3.every((r) => r.status === "rejected")) return failed();
|
|
188
|
+
const partial = read3.some((r) => r.status === "rejected");
|
|
189
|
+
return shown({
|
|
190
|
+
...loaded,
|
|
191
|
+
_tasks: tasks.status === "fulfilled" ? tasks.value : [],
|
|
192
|
+
_routines: routines.status === "fulfilled" ? routines.value.map((r) => {
|
|
193
|
+
const mine = switched.get(r.id);
|
|
194
|
+
return mine && read <= mine.upTo ? { ...r, paused: mine.paused } : r;
|
|
195
|
+
}) : [],
|
|
196
|
+
_goals: goals.status === "fulfilled" ? goals.value : [],
|
|
197
|
+
error: partial ? copyParam("ownerMaestroActivity.partFailed", "Some of Maestro's activity couldn't be loaded.") : "",
|
|
198
|
+
errorHidden: partial ? "false" : "true",
|
|
199
|
+
});
|
|
200
|
+
} catch {
|
|
201
|
+
return stale() ? dropped() : failed();
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
// Pause a routine that is on, or resume one the owner paused.
|
|
205
|
+
toggleRoutine: async (s, arg) => {
|
|
206
|
+
const routine = s._routines.find((r) => r.id === idOf(arg));
|
|
207
|
+
const api = host().wixApi;
|
|
208
|
+
if (!routine || routine.ended || routine.heldBy || changing || !api) return s;
|
|
209
|
+
changing = true;
|
|
210
|
+
try {
|
|
211
|
+
await setRoutinePaused(api, routine.id, !routine.paused);
|
|
212
|
+
// A read still out was answered before this change, and one may have finished while
|
|
213
|
+
// Symphony was being told: the change goes onto the list as it is now, and over the
|
|
214
|
+
// answer of any read that started before it.
|
|
215
|
+
switched.set(routine.id, { paused: !routine.paused, upTo: reads });
|
|
216
|
+
const now = live(s);
|
|
217
|
+
const routines = now._routines.map((r) => (r.id === routine.id ? { ...r, paused: !routine.paused } : r));
|
|
218
|
+
return shown({ ...now, _routines: routines, actionError: "" });
|
|
219
|
+
} catch {
|
|
220
|
+
return shown({ ...live(s), actionError: copyParam("ownerMaestroActivity.changeFailed", "That didn't go through. Try again in a moment.") });
|
|
221
|
+
} finally { changing = false; }
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// No module-scope `svc.load()`: a bridge call made while the bundle is still being evaluated
|
|
227
|
+
// stalls on the Android WebView, and `onAppear` loads the list anyway.
|
|
228
|
+
export { svc };
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
// messages itself. Nothing is cached here: storage is shared by everyone who signs in on the
|
|
6
6
|
// device, and a business id is not an account.
|
|
7
7
|
|
|
8
|
-
import { formatClock, formatMonthDayTime } from "../_shared/engine-intl.js";
|
|
9
8
|
import { defineService } from "@himalaya/state";
|
|
10
9
|
import { copyParam, stashCopy } from "../_shared/himi-copy.js";
|
|
11
10
|
import { currentBusinessId } from "../_shared/owner-selected-site.js";
|
|
12
11
|
import { noteDeletedChat } from "../_shared/owner-maestro-tab.js";
|
|
12
|
+
import { whenLabel } from "../_shared/owner-maestro-when.js";
|
|
13
13
|
import { symphonyAccount, type MaestroWixApi } from "../_shared/owner-maestro-availability.js";
|
|
14
14
|
import { deleteChat, pastChats, pinChat, renameChat, type PastChat } from "../_shared/owner-maestro-chat.js";
|
|
15
15
|
|
|
@@ -77,16 +77,6 @@ function bucketOf(updated: string, now: number): string {
|
|
|
77
77
|
return copyParam("ownerMaestroHistory.older", "Older");
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
/** When a chat was last active: the time for one from today, whose rows would otherwise all
|
|
81
|
-
* read the same date; the date and the time for an older one. */
|
|
82
|
-
function whenLabel(updated: string, now: number): string {
|
|
83
|
-
const at = Date.parse(updated);
|
|
84
|
-
if (Number.isNaN(at)) return "";
|
|
85
|
-
const midnight = new Date(now);
|
|
86
|
-
midnight.setHours(0, 0, 0, 0);
|
|
87
|
-
return at >= midnight.getTime() ? formatClock(new Date(at)) : formatMonthDayTime(new Date(at));
|
|
88
|
-
}
|
|
89
|
-
|
|
90
80
|
/** Rows: pinned chats first under their own heading, then by recency, each heading named on
|
|
91
81
|
* its first row only. */
|
|
92
82
|
function rowsOf(chats: PastChat[], now: number, s: Pick<MaestroHistoryState, "_open" | "_confirm">): HistoryRow[] {
|
|
@@ -475,7 +475,7 @@ function calendarFallbackUrl(s: S, end: number): string {
|
|
|
475
475
|
|
|
476
476
|
/** The Events v3 fieldsets the detail reads (see `WixEventFieldset`). DETAILS carries mainImage and
|
|
477
477
|
* shortDescription: REGISTRATION fills eventType, which skips the query enrichment that used to supply them. */
|
|
478
|
-
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"
|
|
478
|
+
export const EVENT_DETAIL_FIELDSETS: WixEventFieldset[] = ["DETAILS", "TEXTS", "REGISTRATION", "URLS", "FORM"];
|
|
479
479
|
|
|
480
480
|
function detailCopy(key: string, fallback: string): string { return copyParam(key, fallback); }
|
|
481
481
|
|
|
@@ -1065,25 +1065,26 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
|
|
|
1065
1065
|
const dates = detailDate(e);
|
|
1066
1066
|
const place = detailPlace(e);
|
|
1067
1067
|
const registration = registrationUi(e, Date.now());
|
|
1068
|
-
const rawEvent = e as unknown as { shortDescription?: string;
|
|
1068
|
+
const rawEvent = e as unknown as { shortDescription?: string; dateAndTimeSettings?: { recurrenceStatus?: string; recurringEvents?: { categoryId?: string } }; registration?: { allowedGuestTypes?: string; tickets?: { lowestPrice?: EventDetailMoney; highestPrice?: EventDetailMoney } } };
|
|
1069
1069
|
const lowest = detailMoney(rawEvent.registration?.tickets?.lowestPrice);
|
|
1070
1070
|
const highest = detailMoney(rawEvent.registration?.tickets?.highestPrice);
|
|
1071
1071
|
const price = kind === "tickets" && lowest ? (highest && highest !== lowest ? detailCopy("event.priceFrom", "From {price}").replace("{price}", lowest) : lowest) : "";
|
|
1072
1072
|
const memberProbeNeeded = kind === "rsvp" || rawEvent.registration?.allowedGuestTypes === "MEMBER";
|
|
1073
1073
|
const isMember = memberProbeNeeded ? await signedInMember() : false;
|
|
1074
1074
|
const [scheduleResponse, policyResponse, rsvpResponse] = await Promise.all([
|
|
1075
|
-
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`.
|
|
1076
|
-
|
|
1075
|
+
// `limit` is required: without it Wix answers the agenda's `total` with an EMPTY `items`. Read whatever the
|
|
1076
|
+
// event's agenda switch says: it is the website's agenda page, and Wix still answers a visitor with it off.
|
|
1077
|
+
bestEffort("GET", `/events/v1/schedule?eventId=${encodeURIComponent(id)}&limit=100`),
|
|
1077
1078
|
bestEffort("POST", "/events-policies/v2/policies/query", { query: { filter: { eventId: { $eq: id } }, paging: { limit: 100 } } }),
|
|
1078
1079
|
kind === "rsvp" && isMember ? bestEffort("GET", `/events/v2/rsvps/current?eventId=${encodeURIComponent(id)}`) : undefined,
|
|
1079
1080
|
]);
|
|
1080
1081
|
let optionalReadFailed = [scheduleResponse, policyResponse, rsvpResponse].some((response) => response?.ok === false);
|
|
1081
1082
|
const scheduleRaw = (scheduleResponse?.ok ? scheduleResponse.value : undefined) as { agenda?: Array<Record<string, unknown>>; schedule?: Array<Record<string, unknown>>; items?: Array<Record<string, unknown>>; agendaItems?: Array<Record<string, unknown>> } | undefined;
|
|
1082
|
-
// A hidden or
|
|
1083
|
+
// A hidden, canceled or draft session is not on the agenda, and an item id is listed once (an owner's
|
|
1083
1084
|
// read carries a draft and its published copy); sessions in start order.
|
|
1084
1085
|
const seenItems = new Set<string>();
|
|
1085
1086
|
const scheduleSource = (scheduleRaw?.agenda ?? scheduleRaw?.agendaItems ?? scheduleRaw?.schedule ?? scheduleRaw?.items ?? [])
|
|
1086
|
-
.filter((item) => item.hidden !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
|
+
.filter((item) => item.hidden !== true && item.draft !== true && String(item.status ?? "").toUpperCase() !== "CANCELED")
|
|
1087
1088
|
.filter((item) => { const key = String(item.id ?? ""); if (!key) return true; if (seenItems.has(key)) return false; seenItems.add(key); return true; })
|
|
1088
1089
|
.map((item) => ({ item, at: Date.parse(String((item.timeSlot as { start?: string } | undefined)?.start ?? item.startTime ?? item.startDate ?? "")) }))
|
|
1089
1090
|
.sort((a, b) => (Number.isNaN(a.at) ? Infinity : a.at) - (Number.isNaN(b.at) ? Infinity : b.at))
|
|
@@ -187,6 +187,13 @@ export default defineApp({
|
|
|
187
187
|
"parentScreenId": "himi_owner_lite_maestro",
|
|
188
188
|
"tabId": "maestro"
|
|
189
189
|
},
|
|
190
|
+
{
|
|
191
|
+
"screenId": "himi_owner_lite_maestro_activity",
|
|
192
|
+
"isPublic": false,
|
|
193
|
+
"paramKeys": [],
|
|
194
|
+
"parentScreenId": "himi_owner_lite_maestro",
|
|
195
|
+
"tabId": "maestro"
|
|
196
|
+
},
|
|
190
197
|
{
|
|
191
198
|
"screenId": "himi_owner_lite_brief",
|
|
192
199
|
"isPublic": false,
|