@wix/himalaya-cli 0.1257.0 → 0.1259.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/motion/src/index.d.ts +45 -5
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/sdk-types/src/capabilities.generated.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/audio-record.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calendar.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calls.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/contacts.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/location.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +18 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/photos.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdk-types.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/tasks.mjs +1 -1
- package/dist/cli.mjs +47 -23
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/sdk-reference.json +15 -3
- package/package.json +2 -2
- package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/beauty-salon/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/beauty-salon/tier5-src/himi-booking-bookings/index.ts +41 -4
- package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +31 -7
- package/templates/beauty-salon-owner/dev/index.ts +4 -1
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/branded-lite/config.ts +14 -1
- package/templates/branded-lite/dev/index.ts +845 -2
- package/templates/branded-lite/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/branded-lite/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/branded-lite/tier5-src/himi-booking-bookings/index.ts +41 -4
- package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +31 -7
- package/templates/branded-lite/tier5-src/himi-branded-lite-steps/index.ts +524 -0
- package/templates/community-club/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/community-club/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +31 -7
- package/templates/community-club-owner/dev/index.ts +4 -1
- package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/events-meetups/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/events-meetups/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +31 -7
- package/templates/events-meetups-owner/dev/index.ts +4 -1
- package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/gym-fitness/config.ts +14 -1
- package/templates/gym-fitness/dev/index.ts +844 -1
- package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/gym-fitness/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/gym-fitness/tier5-src/himi-booking-bookings/index.ts +41 -4
- package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +31 -7
- package/templates/gym-fitness/tier5-src/himi-branded-lite-steps/index.ts +524 -0
- package/templates/gym-fitness-owner/dev/index.ts +4 -1
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/nonprofit-cause/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +31 -7
- package/templates/nonprofit-cause-owner/dev/index.ts +4 -1
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/owner-lite/dev/index.ts +4 -1
- package/templates/owner-lite/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/podcast-creator/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +31 -7
- package/templates/podcast-creator-owner/dev/index.ts +4 -1
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/portfolio-creative/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +31 -7
- package/templates/portfolio-creative-owner/dev/index.ts +4 -1
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/restaurant/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/restaurant/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +31 -7
- package/templates/restaurant-owner/dev/index.ts +4 -1
- package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/retail-store/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/retail-store/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +31 -7
- package/templates/retail-store-owner/dev/index.ts +4 -1
- package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/yoga-studio/dev/index.ts +90 -1
- package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +7 -0
- package/templates/yoga-studio/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/yoga-studio/tier5-src/himi-booking-bookings/index.ts +41 -4
- package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +31 -7
- package/templates/yoga-studio-owner/dev/index.ts +4 -1
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +7 -0
|
@@ -14,6 +14,7 @@ import { formatServicePrice } from "../_shared/wix-service-price.js";
|
|
|
14
14
|
import { cleanTitle, initials } from "../_shared/himi-text.js";
|
|
15
15
|
import { accentColor as resolveAccentColor, ACCENT_KEY, LAYOUT_KEY, type LayoutId, recommendLayout, resolveLayout } from "../_shared/himi-layouts.js";
|
|
16
16
|
import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
|
|
17
|
+
import { parseWeeklyGoal, weeklyGoalProgress, weeklySessionsFromPages } from "../_shared/weekly-goal.js";
|
|
17
18
|
import { isBridgeUnavailable } from "../_shared/owner-load-error.js";
|
|
18
19
|
import { formatDateMedium } from "../_shared/engine-intl.js";
|
|
19
20
|
import { readSavedProducts, type SavedProduct } from "../_shared/himi-store-saved.js";
|
|
@@ -837,7 +838,10 @@ function derive(state: State): State {
|
|
|
837
838
|
// hide them entirely, so every non-bookings layout renders unchanged.
|
|
838
839
|
noTodaysClasses: state.todaysClasses.length === 0,
|
|
839
840
|
noCoachAvatars: state.coachAvatars.length === 0,
|
|
840
|
-
|
|
841
|
+
// The weekly-goal Gauge shows only for a signed-in member of an app that provisions
|
|
842
|
+
// `goals.weeklySessions` — the label is set by refreshPersonal exactly then, and stays "" for
|
|
843
|
+
// a visitor or an app without a goal (so it shows at "0 of 2", but never as fake progress).
|
|
844
|
+
noWeeklyGoal: state.weeklyGoalLabel === "",
|
|
841
845
|
// Collapse gates for the salonLuxe / calmStudio / communityPulse blocks —
|
|
842
846
|
// the same contract: empty data hides the block entirely.
|
|
843
847
|
noServiceShowcase: state.serviceShowcase.length === 0,
|
|
@@ -1070,6 +1074,8 @@ function memberSchedule(rows: MemberBookingRow[], now = new Date()): { label: st
|
|
|
1070
1074
|
async function refreshPersonal(generation: number, arg?: unknown): Promise<void> {
|
|
1071
1075
|
const member = await memberAccess();
|
|
1072
1076
|
let rows: MemberBookingRow[] = [], progress = { label: "", fraction: 0 }, error = false;
|
|
1077
|
+
let weekly: { count: number; fraction: number; label: string } | null = null;
|
|
1078
|
+
const weeklyGoal = parseWeeklyGoal(paramValue(arg, "weeklyGoal"));
|
|
1073
1079
|
if (member.email && parseVerticals(arg).includes("bookings")) {
|
|
1074
1080
|
const now = new Date();
|
|
1075
1081
|
const [upcoming, past] = await Promise.allSettled([
|
|
@@ -1087,10 +1093,24 @@ async function refreshPersonal(generation: number, arg?: unknown): Promise<void>
|
|
|
1087
1093
|
// when either query failed.
|
|
1088
1094
|
progress = memberSchedule([...upcoming.value.items, ...past.value.items], now);
|
|
1089
1095
|
}
|
|
1096
|
+
if (weeklyGoal > 0 && past.status === "fulfilled") {
|
|
1097
|
+
// The goal counts sessions that already HAPPENED this week (_shared/weekly-goal.ts). A
|
|
1098
|
+
// failed past read leaves it hidden rather than claiming "0 of N".
|
|
1099
|
+
// Pages further back only while the first page still sits inside this week; a failing
|
|
1100
|
+
// later page hides the Gauge too.
|
|
1101
|
+
try {
|
|
1102
|
+
const readPast = (cursor: string) =>
|
|
1103
|
+
fetchMemberBookings({ query: "", filter: "value:Past", sort: "za", savedIds: [] }, cursor, now.toISOString(), member);
|
|
1104
|
+
const goal = weeklyGoalProgress(await weeklySessionsFromPages(past.value, readPast, now.getTime()), weeklyGoal);
|
|
1105
|
+
weekly = { count: goal.done, fraction: goal.fraction, label: goal.label };
|
|
1106
|
+
} catch {
|
|
1107
|
+
weekly = null;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1090
1110
|
error = upcoming.status === "rejected" || past.status === "rejected";
|
|
1091
|
-
try { await assertMemberAccess(member); } catch { rows = []; progress = { label: "", fraction: 0 }; error = false; }
|
|
1111
|
+
try { await assertMemberAccess(member); } catch { rows = []; progress = { label: "", fraction: 0 }; error = false; weekly = null; }
|
|
1092
1112
|
}
|
|
1093
|
-
if (generation === personalGeneration) svc.personalLoaded({ generation, rows, progress, error });
|
|
1113
|
+
if (generation === personalGeneration) svc.personalLoaded({ generation, rows, progress, error, weekly });
|
|
1094
1114
|
}
|
|
1095
1115
|
async function refresh(state: State, arg?: unknown): Promise<State | undefined> {
|
|
1096
1116
|
const generation = ++personalGeneration;
|
|
@@ -1102,7 +1122,9 @@ async function refresh(state: State, arg?: unknown): Promise<State | undefined>
|
|
|
1102
1122
|
const current = svc.getState();
|
|
1103
1123
|
return derive({ ...publicState, nextBooking: current.nextBooking, hideNextBooking: current.hideNextBooking,
|
|
1104
1124
|
memberProgressLabel: current.memberProgressLabel, memberProgressFraction: current.memberProgressFraction,
|
|
1105
|
-
hideMemberProgress: current.hideMemberProgress, personalError: current.personalError, hidePersonalError: current.hidePersonalError
|
|
1125
|
+
hideMemberProgress: current.hideMemberProgress, personalError: current.personalError, hidePersonalError: current.hidePersonalError,
|
|
1126
|
+
// The weekly goal is PERSONAL (member bookings); the public refresh resets it, so keep it.
|
|
1127
|
+
weeklyClassCount: current.weeklyClassCount, weeklyClassGoalFraction: current.weeklyClassGoalFraction, weeklyGoalLabel: current.weeklyGoalLabel });
|
|
1106
1128
|
}
|
|
1107
1129
|
|
|
1108
1130
|
const svc = defineService<State, {
|
|
@@ -1113,15 +1135,17 @@ const svc = defineService<State, {
|
|
|
1113
1135
|
refresh: (state: State, arg?: unknown) => Promise<State | undefined>;
|
|
1114
1136
|
dismissOnboarding: (state: State) => State;
|
|
1115
1137
|
clearPersonal: (state: State) => State;
|
|
1116
|
-
personalLoaded: (state: State, arg: { generation: number; rows: MemberBookingRow[]; progress: { label: string; fraction: number }; error: boolean }) => State;
|
|
1138
|
+
personalLoaded: (state: State, arg: { generation: number; rows: MemberBookingRow[]; progress: { label: string; fraction: number }; error: boolean; weekly: { count: number; fraction: number; label: string } | null }) => State;
|
|
1117
1139
|
}>("himiBrandedHome", {
|
|
1118
1140
|
state: baseState(),
|
|
1119
1141
|
actions: {
|
|
1120
|
-
clearPersonal: state => ({ ...state, nextBooking: [], hideNextBooking: true, memberProgressLabel: "", memberProgressFraction: 0, hideMemberProgress: true, personalError: false, hidePersonalError: true
|
|
1142
|
+
clearPersonal: state => derive({ ...state, nextBooking: [], hideNextBooking: true, memberProgressLabel: "", memberProgressFraction: 0, hideMemberProgress: true, personalError: false, hidePersonalError: true,
|
|
1143
|
+
weeklyClassCount: 0, weeklyClassGoalFraction: 0, weeklyGoalLabel: "" }),
|
|
1121
1144
|
personalLoaded: (state, arg) => arg.generation !== personalGeneration ? state : derive({ ...state,
|
|
1122
1145
|
nextBooking: arg.rows, hideNextBooking: !arg.rows.length,
|
|
1123
1146
|
memberProgressLabel: arg.progress.label, memberProgressFraction: arg.progress.fraction, hideMemberProgress: !arg.progress.label,
|
|
1124
|
-
personalError: arg.error, hidePersonalError: !arg.error
|
|
1147
|
+
personalError: arg.error, hidePersonalError: !arg.error,
|
|
1148
|
+
weeklyClassCount: arg.weekly?.count ?? 0, weeklyClassGoalFraction: arg.weekly?.fraction ?? 0, weeklyGoalLabel: arg.weekly?.label ?? "" }),
|
|
1125
1149
|
refresh,
|
|
1126
1150
|
// "Got it" on the first-run card: persist + hide. Persistence is
|
|
1127
1151
|
// best-effort — the UI hides either way for this session.
|
|
@@ -52094,7 +52094,10 @@ const SCREENS = runtimeSetting({
|
|
|
52094
52094
|
}
|
|
52095
52095
|
},
|
|
52096
52096
|
"modifiers": {
|
|
52097
|
-
"accessibilityRole": "decorative"
|
|
52097
|
+
"accessibilityRole": "decorative",
|
|
52098
|
+
"padding": {
|
|
52099
|
+
"leading": 12
|
|
52100
|
+
}
|
|
52098
52101
|
}
|
|
52099
52102
|
},
|
|
52100
52103
|
{
|
|
@@ -11,6 +11,8 @@ export interface CollectionSaving {
|
|
|
11
11
|
type State = Record<string, unknown>;
|
|
12
12
|
interface BackendCollection {
|
|
13
13
|
restorePagesOnLoad?: boolean;
|
|
14
|
+
/** Sees the load action's argument (the screen's onAppear params) BEFORE the query runs. */
|
|
15
|
+
onLoad?(arg: unknown): void;
|
|
14
16
|
controller: ReturnType<typeof createCollectionQuery<CollectionRow>>;
|
|
15
17
|
apply(state: State, page: CollectionQueryState<CollectionRow>): State;
|
|
16
18
|
}
|
|
@@ -294,6 +296,7 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
294
296
|
actions.collectionDataChanged = s => derive(backend.apply(s, backend.controller.getState()));
|
|
295
297
|
actions.load = (_s, arg) => {
|
|
296
298
|
stashCopy(arg); syncSaved(); applyNavigationCriteria(arg, _s);
|
|
299
|
+
backend.onLoad?.(arg);
|
|
297
300
|
return backend.controller.query(criteria(), backend.restorePagesOnLoad).then(() => undefined);
|
|
298
301
|
};
|
|
299
302
|
actions.refresh = (_s, arg) => {
|
|
@@ -320,6 +323,9 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
320
323
|
export function defineBackendCollection<S extends object, Row extends object>(name: string, options: {
|
|
321
324
|
/** Revalidate already opened pages on navigation return; explicit refresh resets. */
|
|
322
325
|
restorePagesOnLoad?: boolean;
|
|
326
|
+
/** The load action's argument (onAppear params beyond `copy`), before the query runs — for a
|
|
327
|
+
* domain setting that rides the descriptor, e.g. My Bookings' `weeklyGoal`. */
|
|
328
|
+
onLoad?(arg: unknown): void;
|
|
323
329
|
state: S;
|
|
324
330
|
source: CollectionQuerySource<Row>;
|
|
325
331
|
apply(state: S, page: CollectionQueryState<Row>): S;
|
|
@@ -330,6 +336,7 @@ export function defineBackendCollection<S extends object, Row extends object>(na
|
|
|
330
336
|
const controller = createCollectionQuery(options.source, () => { publish?.(); });
|
|
331
337
|
const definition = decorateCollection(name, { state: options.state as State, actions: options.actions as Record<string, Reducer> | undefined }, options.saving, {
|
|
332
338
|
restorePagesOnLoad: options.restorePagesOnLoad,
|
|
339
|
+
onLoad: options.onLoad,
|
|
333
340
|
controller: controller as unknown as BackendCollection['controller'],
|
|
334
341
|
apply: (state, page) => options.apply(state as S, page as unknown as CollectionQueryState<Row>) as State,
|
|
335
342
|
});
|