@wix/himalaya-cli 0.1581.0 → 0.1583.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 +8 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +26 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validator.d.ts +18 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +5 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +5 -1
- package/dist/cli.mjs +17195 -17232
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/component-reference.json +4 -3
- package/guides/component-reference.md +24 -2
- package/package.json +2 -2
- package/templates/beauty-salon/config.ts +20 -1
- package/templates/beauty-salon/dev/index.ts +1751 -629
- package/templates/beauty-salon/tier5-src/_shared/booking-location.ts +147 -0
- package/templates/beauty-salon/tier5-src/_shared/booking-session.ts +222 -0
- package/templates/beauty-salon/tier5-src/himi-booking-service/index.ts +277 -14
- package/templates/beauty-salon/tier5-src/himi-booking-services/index.ts +351 -92
- package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +25 -5
- package/templates/beauty-salon/tier5-src/himi-branded-lite-agenda/index.ts +219 -220
- package/templates/branded-lite/config.ts +20 -1
- package/templates/branded-lite/dev/index.ts +1688 -566
- package/templates/branded-lite/l10n/en.json +2 -2
- package/templates/branded-lite/tier5-src/_shared/booking-location.ts +147 -0
- package/templates/branded-lite/tier5-src/_shared/booking-session.ts +222 -0
- package/templates/branded-lite/tier5-src/himi-booking-service/index.ts +277 -14
- package/templates/branded-lite/tier5-src/himi-booking-services/index.ts +351 -92
- package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +25 -5
- package/templates/branded-lite/tier5-src/himi-branded-lite-agenda/index.ts +219 -220
- package/templates/community-club/config.ts +20 -1
- package/templates/events-meetups/config.ts +20 -1
- package/templates/gym-fitness/config.ts +20 -1
- package/templates/gym-fitness/dev/index.ts +1751 -629
- package/templates/gym-fitness/tier5-src/_shared/booking-location.ts +147 -0
- package/templates/gym-fitness/tier5-src/_shared/booking-session.ts +222 -0
- package/templates/gym-fitness/tier5-src/himi-booking-service/index.ts +277 -14
- package/templates/gym-fitness/tier5-src/himi-booking-services/index.ts +351 -92
- package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +25 -5
- package/templates/gym-fitness/tier5-src/himi-branded-lite-agenda/index.ts +219 -220
- package/templates/nonprofit-cause/config.ts +20 -1
- package/templates/podcast-creator/config.ts +20 -1
- package/templates/portfolio-creative/config.ts +20 -1
- package/templates/restaurant/config.ts +20 -1
- package/templates/retail-store/config.ts +20 -1
- package/templates/yoga-studio/config.ts +20 -1
- package/templates/yoga-studio/dev/index.ts +1533 -411
- package/templates/yoga-studio/tier5-src/_shared/booking-location.ts +147 -0
- package/templates/yoga-studio/tier5-src/_shared/booking-session.ts +222 -0
- package/templates/yoga-studio/tier5-src/himi-booking-service/index.ts +277 -14
- package/templates/yoga-studio/tier5-src/himi-booking-services/index.ts +351 -92
- package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +25 -5
- package/templates/yoga-studio/tier5-src/himi-branded-lite-agenda/index.ts +219 -220
|
@@ -17,6 +17,7 @@ import { displayName, getMyData, type WixMyData } from "@himalaya/wix-users";
|
|
|
17
17
|
import { formatServicePrice, serviceIsChargeable } from "../_shared/wix-service-price.js";
|
|
18
18
|
import { stashCopy, copyParam, copyPlural, copyTemplate } from "../_shared/himi-copy.js";
|
|
19
19
|
import { upsert as dbUpsert, remove as dbRemove, enqueue as dbEnqueue, type DbEntity } from "@himalaya/local-db";
|
|
20
|
+
import { locationChoice, readSharedLocationResult, writeSharedLocation } from "../_shared/booking-location.js";
|
|
20
21
|
import { isBridgeUnavailable } from "../_shared/owner-load-error.js";
|
|
21
22
|
import { emitHostEvent, hostEventInstant } from "../_shared/host-events.js";
|
|
22
23
|
import { availabilityBeyond, courseReadWindows, courseSessionsAvailability, courseWindowOpen, slotIdAt } from "../_shared/himi-bookings.js";
|
|
@@ -71,6 +72,9 @@ interface SlotRow {
|
|
|
71
72
|
locKey: string;
|
|
72
73
|
locLabel: string;
|
|
73
74
|
locSub: string;
|
|
75
|
+
/** The location as every bookings screen keys it (`booking-location.ts`): what the shared
|
|
76
|
+
* choice of Services and the Agenda names. "" when it has none. */
|
|
77
|
+
locPlace: string;
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
/** One time in a staff group: a pill with three looks. */
|
|
@@ -523,6 +527,7 @@ function slotRows(entries: ReadonlyArray<{ slot?: WixBookingSlotFull; bookable?:
|
|
|
523
527
|
locKey: loc.key,
|
|
524
528
|
locLabel: loc.label,
|
|
525
529
|
locSub: loc.sub,
|
|
530
|
+
locPlace: locationChoice(slot.location as Parameters<typeof locationChoice>[0]).key,
|
|
526
531
|
});
|
|
527
532
|
}
|
|
528
533
|
return { rows, slots, waitlist };
|
|
@@ -552,9 +557,9 @@ function locationMatches(row: SlotRow, locationId: string): boolean {
|
|
|
552
557
|
|
|
553
558
|
/** Every distinct location of the window's times (the greyed ones read so far included), in the
|
|
554
559
|
* order they first appear. */
|
|
555
|
-
function windowLocations(): Array<{ key: string; label: string; sub: string }> {
|
|
556
|
-
const seen = new Map<string, { key: string; label: string; sub: string }>();
|
|
557
|
-
for (const row of [...allRows, ...[...greyByDay.values()].flat()]) if (row.locKey && !seen.has(row.locKey)) seen.set(row.locKey, { key: row.locKey, label: row.locLabel, sub: row.locSub });
|
|
560
|
+
function windowLocations(): Array<{ key: string; label: string; sub: string; place: string }> {
|
|
561
|
+
const seen = new Map<string, { key: string; label: string; sub: string; place: string }>();
|
|
562
|
+
for (const row of [...allRows, ...[...greyByDay.values()].flat()]) if (row.locKey && !seen.has(row.locKey)) seen.set(row.locKey, { key: row.locKey, label: row.locLabel, sub: row.locSub, place: row.locPlace });
|
|
558
563
|
return [...seen.values()];
|
|
559
564
|
}
|
|
560
565
|
|
|
@@ -1236,8 +1241,17 @@ const svc = defineService<S, {
|
|
|
1236
1241
|
// A location with no times left (greyed ones included) goes back to "All locations", and so
|
|
1237
1242
|
// does a filter that would hide the time this load restores (a host's start, a guest's pick).
|
|
1238
1243
|
const restored = startRow ?? picked;
|
|
1239
|
-
|
|
1240
|
-
|
|
1244
|
+
// The location chosen on any bookings screen (this one writes its choices there too), matched
|
|
1245
|
+
// by the key they all share; this screen's own choice only when the store cannot answer. A
|
|
1246
|
+
// pooled worker re-shown later otherwise kept an older choice than Services' newer one.
|
|
1247
|
+
// A place the other screens cannot name (the client's own place) is never written there, so
|
|
1248
|
+
// this screen keeps it rather than lose it to the shared value.
|
|
1249
|
+
const shared = await readSharedLocationResult();
|
|
1250
|
+
const own = windowLocations().find((l) => l.key === chosen.locationId);
|
|
1251
|
+
const preferred = own && !own.place ? own.key
|
|
1252
|
+
: shared ? (shared.id ? windowLocations().find((l) => l.place === shared.id)?.key ?? "" : "") : chosen.locationId;
|
|
1253
|
+
const locationId = windowLocations().some((l) => l.key === preferred) && (!restored || locationMatches(restored, preferred))
|
|
1254
|
+
? preferred : "";
|
|
1241
1255
|
return derive(withDay({
|
|
1242
1256
|
...next,
|
|
1243
1257
|
days,
|
|
@@ -1322,6 +1336,12 @@ const svc = defineService<S, {
|
|
|
1322
1336
|
const keep = allRows.some((row) => row.dayKey === s.selectedDay && row.selectable && locationMatches(row, locationId));
|
|
1323
1337
|
const first = allRows.filter((row) => row.selectable && locationMatches(row, locationId)).sort(byDay)[0];
|
|
1324
1338
|
const revision = ++dayRevision;
|
|
1339
|
+
// Kept for Services and the Agenda, which filter by the same location. Not awaited (it never
|
|
1340
|
+
// throws): the choice shows at once, and a search still running settles as it always has.
|
|
1341
|
+
// A place with no shared key (the client's place) is this screen's alone: Services and the
|
|
1342
|
+
// Agenda keep their own choice instead of falling back to "All locations".
|
|
1343
|
+
const picked = windowLocations().find((l) => l.key === locationId);
|
|
1344
|
+
if (!locationId || picked?.place) void writeSharedLocation({ id: picked?.place ?? "", label: picked?.label ?? "" });
|
|
1325
1345
|
if (keep || !first) return derive(next);
|
|
1326
1346
|
if (lastService?.type !== "CLASS") await loadGreyDay(s.id, first.dayKey);
|
|
1327
1347
|
// A newer day or location choice made during the read wins.
|