@wix/himalaya-cli 0.1750.0 → 0.1752.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/app-config.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-module.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +16 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/himi-package.d.ts +478 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/host-compatibility.d.ts +56 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/icon-catalog.generated.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-shell.d.ts +154 -7
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validator.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/auth-providers/wix/src/index.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/auth-providers/wix/src/native-engine.d.ts +49 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/copy.generated.d.ts +16 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/feedback.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/index.d.ts +2 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/podcast-service.d.ts +105 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/podcast.d.ts +116 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/auth.mjs +27 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +326 -13
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +757 -83
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +156 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-auth/worker.mjs +133 -13
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-auth.mjs +139 -13
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{b40ea5d0d6251898ff5617139fde8be008dd11e99a70b14c1052093685401700.bin → 2671d1cadb15daa5e59440f4c924e30c221ab3d405e8a56a0ab1cdbe4764af3d.bin} +1 -1
- package/dist/browser-plane/sw.js +7 -7
- package/dist/cli.mjs +37219 -33014
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/app-config.md +1 -1
- package/guides/component-reference.json +1 -1
- package/guides/component-reference.md +4 -0
- package/guides/designing-himi-screens.md +7 -0
- package/guides/getting-started.md +2 -0
- package/guides/headless-loop.md +1 -1
- package/guides/himi-json-output.md +25 -3
- package/guides/himi-skill.md +2 -0
- package/guides/index.json +6 -0
- package/guides/push-cli-onboarding.md +13 -0
- package/guides/qa-builds.md +15 -2
- package/guides/recipe-podcast.md +149 -0
- package/guides/releasing-with-himi-serve.md +51 -0
- package/guides/store-submission.md +46 -1
- package/guides/tier-5-add-a-screen.md +16 -2
- package/guides/wix-business-context.md +29 -0
- package/guides/wix-platform-usage.md +7 -2
- package/package.json +10 -10
- package/template-icons/fitness-gym.png +0 -0
- package/templates/beauty-salon/dev/index.ts +1 -1
- package/templates/beauty-salon/l10n/en.json +1 -1
- package/templates/beauty-salon/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/beauty-salon/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/beauty-salon/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
- package/templates/branded-lite/dev/index.ts +101 -1
- package/templates/branded-lite/l10n/en.json +22 -1
- package/templates/branded-lite/l10n/es.json +22 -0
- package/templates/branded-lite/l10n/fr.json +18 -0
- package/templates/branded-lite/l10n/he.json +15 -0
- package/templates/branded-lite/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/branded-lite/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/branded-lite/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
- package/templates/branded-lite/tier5-src/himi-branded-lite-podcasts/index.ts +14 -234
- package/templates/brandy/README.md +33 -0
- package/templates/brandy/config.ts +51 -7
- package/templates/brandy/dev/index.ts +23 -9
- package/templates/community-club/l10n/en.json +1 -1
- package/templates/community-club/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/community-club/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/events-meetups/l10n/en.json +1 -1
- package/templates/events-meetups/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/events-meetups/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/fitness-gym/README.md +53 -0
- package/templates/fitness-gym/config.ts +560 -0
- package/templates/fitness-gym/dev/index.ts +25787 -0
- package/templates/fitness-gym/himalaya.content.json +64 -0
- package/templates/fitness-gym/himalaya.template.json +15 -0
- package/templates/fitness-gym/icon.png +0 -0
- package/templates/fitness-gym/platforms.json +1 -0
- package/templates/fitness-gym/tier5-src/_shared/app-locale.ts +61 -0
- package/templates/fitness-gym/tier5-src/_shared/booking-location.ts +147 -0
- package/templates/fitness-gym/tier5-src/_shared/booking-session.ts +224 -0
- package/templates/fitness-gym/tier5-src/_shared/branded-lite-hosted.ts +280 -0
- package/templates/fitness-gym/tier5-src/_shared/branded-load-state.ts +109 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-copy.ts +40 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-history.ts +51 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-message-model.ts +177 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-model.ts +56 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-presenter.ts +576 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-transport.ts +148 -0
- package/templates/fitness-gym/tier5-src/_shared/collection-contract.ts +228 -0
- package/templates/fitness-gym/tier5-src/_shared/collection-query.ts +193 -0
- package/templates/fitness-gym/tier5-src/_shared/collection-service.ts +400 -0
- package/templates/fitness-gym/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/fitness-gym/tier5-src/_shared/engine-intl.ts +523 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-account.ts +194 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-booking-saved.ts +88 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-bookings.ts +318 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-copy.ts +116 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-media.ts +29 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-store.ts +7 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-text.ts +24 -0
- package/templates/fitness-gym/tier5-src/_shared/host-events.ts +66 -0
- package/templates/fitness-gym/tier5-src/_shared/hosted-checkout.ts +70 -0
- package/templates/fitness-gym/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/fitness-gym/tier5-src/_shared/iap-attendance-purchase.ts +216 -0
- package/templates/fitness-gym/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/fitness-gym/tier5-src/_shared/iap-worker.ts +127 -0
- package/templates/fitness-gym/tier5-src/_shared/inbox-rooms.ts +68 -0
- package/templates/fitness-gym/tier5-src/_shared/local-preferences.ts +38 -0
- package/templates/fitness-gym/tier5-src/_shared/member-access.ts +63 -0
- package/templates/fitness-gym/tier5-src/_shared/member-account-routes.ts +52 -0
- package/templates/fitness-gym/tier5-src/_shared/member-bookings.ts +107 -0
- package/templates/fitness-gym/tier5-src/_shared/member-screen.ts +99 -0
- package/templates/fitness-gym/tier5-src/_shared/notification-target.ts +141 -0
- package/templates/fitness-gym/tier5-src/_shared/offset-page.ts +10 -0
- package/templates/fitness-gym/tier5-src/_shared/online-actions.ts +76 -0
- package/templates/fitness-gym/tier5-src/_shared/owner-load-error.ts +348 -0
- package/templates/fitness-gym/tier5-src/_shared/payment-setup.ts +6 -0
- package/templates/fitness-gym/tier5-src/_shared/pricing-plan-display.ts +64 -0
- package/templates/fitness-gym/tier5-src/_shared/program-description.ts +11 -0
- package/templates/fitness-gym/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/fitness-gym/tier5-src/_shared/program-standing.ts +46 -0
- package/templates/fitness-gym/tier5-src/_shared/rich-body.ts +78 -0
- package/templates/fitness-gym/tier5-src/_shared/rich-content-link.ts +34 -0
- package/templates/fitness-gym/tier5-src/_shared/sign-in-sheet.ts +18 -0
- package/templates/fitness-gym/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/fitness-gym/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/fitness-gym/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/fitness-gym/tier5-src/_shared/wix-member-links.ts +114 -0
- package/templates/fitness-gym/tier5-src/_shared/wix-service-price.ts +146 -0
- package/templates/fitness-gym/tier5-src/business-chat/index.ts +732 -0
- package/templates/fitness-gym/tier5-src/business-contact/index.ts +6 -0
- package/templates/fitness-gym/tier5-src/himi-booking-account/index.ts +267 -0
- package/templates/fitness-gym/tier5-src/himi-booking-bookings/index.ts +468 -0
- package/templates/fitness-gym/tier5-src/himi-booking-service/index.ts +1190 -0
- package/templates/fitness-gym/tier5-src/himi-booking-services/index.ts +791 -0
- package/templates/fitness-gym/tier5-src/himi-booking-time/index.ts +1729 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-agenda/index.ts +988 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-member-programs/index.ts +656 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-notifications/index.ts +256 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-plans/index.ts +495 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-program/facts.ts +52 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-program/index.ts +845 -0
- package/templates/fitness-gym/tier5-src/himi-fitcoach-goal/index.ts +190 -0
- package/templates/fitness-gym/tier5-src/himi-fitcoach-home/index.ts +619 -0
- package/templates/fitness-gym/tier5-src/himi-store-account/index.ts +1007 -0
- package/templates/fitness-gym/tier5-src/wix-spaces-my-subscriptions/index.ts +84 -0
- package/templates/fitness-gym/tier5-src/wix-spaces-subscription-detail/index.ts +139 -0
- package/templates/fitness-gym/tokens.json +414 -0
- package/templates/gym-fitness/dev/index.ts +1 -1
- package/templates/gym-fitness/l10n/en.json +1 -1
- package/templates/gym-fitness/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/gym-fitness/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/gym-fitness/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
- package/templates/medical-services/dev/index.ts +2 -1
- package/templates/medical-services/tier5-src/himi-booking-account/index.ts +16 -1
- package/templates/nonprofit-cause/l10n/en.json +1 -1
- package/templates/nonprofit-cause/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/nonprofit-cause/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/personal-fitness-trainer/dev/index.ts +2 -2
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
- package/templates/podcast-creator/dev/index.ts +100 -0
- package/templates/podcast-creator/l10n/en.json +22 -1
- package/templates/podcast-creator/l10n/es.json +22 -0
- package/templates/podcast-creator/l10n/fr.json +18 -0
- package/templates/podcast-creator/l10n/he.json +15 -0
- package/templates/podcast-creator/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/podcast-creator/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/podcast-creator/tier5-src/himi-branded-lite-podcasts/index.ts +14 -234
- package/templates/portfolio-creative/l10n/en.json +1 -1
- package/templates/portfolio-creative/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/portfolio-creative/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/restaurant/l10n/en.json +1 -1
- package/templates/restaurant/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/restaurant/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/retail-store/l10n/en.json +1 -1
- package/templates/retail-store/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/retail-store/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/salon-spa/dev/index.ts +1 -1
- package/templates/salon-spa/tier5-src/himi-booking-account/index.ts +16 -1
- package/templates/salon-spa/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
- package/templates/yoga-studio/dev/index.ts +1 -1
- package/templates/yoga-studio/l10n/en.json +1 -1
- package/templates/yoga-studio/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/yoga-studio/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/yoga-studio/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
|
@@ -126,6 +126,14 @@ interface S extends LoadFlags {
|
|
|
126
126
|
/** A location is chosen and has no session in the loaded days: its own empty state. */
|
|
127
127
|
locationEmpty: boolean;
|
|
128
128
|
notLocationEmpty: boolean;
|
|
129
|
+
/** The optional "All · Booked" filter, for an app that asks for it (`load` param `filters: "1"`):
|
|
130
|
+
* "booked" lists only the member's own sessions (booked or on the waitlist). Off by default, so
|
|
131
|
+
* an app that does not bind it lists every session, as before. */
|
|
132
|
+
filter?: "all" | "booked";
|
|
133
|
+
hideFilter?: boolean;
|
|
134
|
+
/** The booked filter is on and the member has no session in the loaded days. */
|
|
135
|
+
bookedEmpty?: boolean;
|
|
136
|
+
notBookedEmpty?: boolean;
|
|
129
137
|
}
|
|
130
138
|
|
|
131
139
|
const flag = (on: boolean): string => (on ? "true" : "");
|
|
@@ -300,6 +308,10 @@ let quietUntil = 0;
|
|
|
300
308
|
* it. Cleared by the list's own scroll and a calendar tap, whose plain day the renderer compares
|
|
301
309
|
* with what it reported (an echo of the member's own scroll never moves the list). */
|
|
302
310
|
let scrollNonce = 0;
|
|
311
|
+
/** The "All · Booked" filter: offered when the screen's load asks for it, and the member's choice. */
|
|
312
|
+
let filtersOn = false;
|
|
313
|
+
/** The member the "Booked" choice was made by: another member (or a sign-out) opens on "All". */
|
|
314
|
+
let bookedFilterFor = "";
|
|
303
315
|
let busy = false;
|
|
304
316
|
/** An Add to Calendar flow is running (a permission prompt, a save, the calendar page). Its own
|
|
305
317
|
* flag, not `busy`: the session sheet must still close while it runs. */
|
|
@@ -428,14 +440,22 @@ function derive(s: S): S {
|
|
|
428
440
|
// From today on (the loaded days never start before it), at the chosen location. The list is
|
|
429
441
|
// one run of days: a tap on the calendar SCROLLS it to a day, and scrolling it moves the
|
|
430
442
|
// selection, so it never starts at the selected day (the days above it would vanish).
|
|
431
|
-
const
|
|
443
|
+
const bookedOnly = filtersOn && !!member?.email && bookedFilterFor === member.email;
|
|
444
|
+
const mine = (x: Session) => { const p = places.get(x.key)?.place; return p === "booked" || p === "waitlisted"; };
|
|
445
|
+
const shown = sessions.filter((x) => x.day >= s.today && (!locationKey || x.locationKey === locationKey) && (!bookedOnly || mine(x)));
|
|
432
446
|
const events = rowsOk === false ? [] : shown.map((x, i) => eventOf(x, places.get(x.key), shown[i + 1]?.day !== x.day));
|
|
433
447
|
const sheet = sessions.find((x) => x.key === sheetKey);
|
|
434
448
|
const sheetPlace = sheet ? places.get(sheet.key)?.place ?? "" : "";
|
|
435
449
|
const loaded = s.status === "ready" && rowsOk !== false && !!services;
|
|
436
|
-
const locationEmpty = loaded && !!locationKey && shown.length === 0;
|
|
450
|
+
const locationEmpty = loaded && !!locationKey && shown.length === 0 && !bookedOnly;
|
|
451
|
+
const bookedEmpty = loaded && bookedOnly && shown.length === 0;
|
|
437
452
|
return {
|
|
438
453
|
...s,
|
|
454
|
+
filter: bookedOnly ? "booked" : "all",
|
|
455
|
+
// A visitor has no sessions of their own: the filter shows only to a signed-in member.
|
|
456
|
+
hideFilter: !filtersOn || !member?.email,
|
|
457
|
+
bookedEmpty,
|
|
458
|
+
notBookedEmpty: !bookedEmpty,
|
|
439
459
|
...locationMenu(choices, chosenLocation.id),
|
|
440
460
|
locationSheetOpen: locationSheet,
|
|
441
461
|
locationEmpty,
|
|
@@ -449,7 +469,7 @@ function derive(s: S): S {
|
|
|
449
469
|
signedIn: !!member?.email,
|
|
450
470
|
updateRequired: rowsOk === false,
|
|
451
471
|
listHidden: s.busy === true || rowsOk === false || events.length === 0,
|
|
452
|
-
...emptyFlags(loaded && services!.length === 0, loaded && services!.length > 0 && events.length === 0 && !locationEmpty),
|
|
472
|
+
...emptyFlags(loaded && services!.length === 0, loaded && services!.length > 0 && events.length === 0 && !locationEmpty && !bookedEmpty),
|
|
453
473
|
sheetOpen: !!sheet && !!sheetPlace,
|
|
454
474
|
sheetTitle: sheet?.title ?? "",
|
|
455
475
|
sheetWhen: sheet ? joined(dayLabel(sheet.start, { absolute: true }), timeLabel(sheet.start), lengthLabel(sheet.start, sheet.end)) : "",
|
|
@@ -630,6 +650,7 @@ function initial(): S {
|
|
|
630
650
|
sheetOpen: false, sheetTitle: "", sheetWhen: "", sheetMeta: "", sheetHideCalendar: true, sheetHideCancel: true, sheetHideLeave: true, sheetBusy: false, sheetServiceId: "", sheetSessionId: "", sheetStart: "",
|
|
631
651
|
locationOptions: [], locationLabel: "", locationA11y: "", hasLocationMenu: false, noLocationMenu: true,
|
|
632
652
|
locationActive: false, noLocationActive: true, locationSheetOpen: false, locationEmpty: false, notLocationEmpty: true,
|
|
653
|
+
filter: "all", hideFilter: true, bookedEmpty: false, notBookedEmpty: true,
|
|
633
654
|
};
|
|
634
655
|
}
|
|
635
656
|
|
|
@@ -673,10 +694,13 @@ const svc = defineService<S, {
|
|
|
673
694
|
openLocations: (s: S) => S;
|
|
674
695
|
closeLocations: (s: S) => S;
|
|
675
696
|
selectLocation: (s: S, p?: unknown) => Promise<S | undefined>;
|
|
697
|
+
setFilter: (s: S, p?: unknown) => S;
|
|
676
698
|
}>("himiBrandedAgenda", {
|
|
677
699
|
// An action's result belongs to that visit: a cold start must not replay it from saved state,
|
|
678
700
|
// nor reopen the location sheet.
|
|
679
|
-
notHydrated: ["resultOpen", "resultOpenB", "resultText", "resultOk", "resultInfo", "locationSheetOpen"],
|
|
701
|
+
notHydrated: ["resultOpen", "resultOpenB", "resultText", "resultOk", "resultInfo", "locationSheetOpen", "filter", "hideFilter", "bookedEmpty", "notBookedEmpty"],
|
|
702
|
+
// The optional Booked filter is the member's choice for this run: never written to the device.
|
|
703
|
+
notPersisted: ["filter", "hideFilter", "bookedEmpty", "notBookedEmpty"],
|
|
680
704
|
state: initial(),
|
|
681
705
|
actions: {
|
|
682
706
|
load: async (s, p) => {
|
|
@@ -688,6 +712,7 @@ const svc = defineService<S, {
|
|
|
688
712
|
}
|
|
689
713
|
const signInScreen = argOf(p, "signInScreenId");
|
|
690
714
|
if (/^[a-z][a-z0-9_]{0,63}$/.test(signInScreen)) signInScreenId = signInScreen;
|
|
715
|
+
if (argOf(p, "filters") === "1") filtersOn = true;
|
|
691
716
|
const fw = Number(argOf(p, "firstWeekday") || s.firstWeekday);
|
|
692
717
|
const today = dayKey(new Date());
|
|
693
718
|
// First appearance: open on this week. A re-appearance keeps the member's place and
|
|
@@ -932,6 +957,14 @@ const svc = defineService<S, {
|
|
|
932
957
|
locationSheet = true;
|
|
933
958
|
return derive({ ...s, ...wanted });
|
|
934
959
|
},
|
|
960
|
+
// The "All · Booked" filter (a segmented control's id, or `{ id }`). A list of the member's own
|
|
961
|
+
// sessions, from the same loaded days; the calendar's dots follow it.
|
|
962
|
+
setFilter: (s, p) => {
|
|
963
|
+
const id = typeof p === "string" ? p : argOf(p, "id") || argOf(p, "value") || argOf(p, "selectedId");
|
|
964
|
+
if (id !== "all" && id !== "booked") return s;
|
|
965
|
+
bookedFilterFor = id === "booked" ? member?.email ?? "" : "";
|
|
966
|
+
return derive({ ...s, ...wanted });
|
|
967
|
+
},
|
|
935
968
|
closeLocations: (s) => {
|
|
936
969
|
if (!locationSheet) return s;
|
|
937
970
|
locationSheet = false;
|
|
@@ -14241,7 +14241,7 @@ const SCREENS = runtimeSetting({
|
|
|
14241
14241
|
}
|
|
14242
14242
|
},
|
|
14243
14243
|
"modifiers": {
|
|
14244
|
-
"width":
|
|
14244
|
+
"width": 80
|
|
14245
14245
|
}
|
|
14246
14246
|
},
|
|
14247
14247
|
{
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// How a worker reads an Online Program's lifecycle and name. Wix returns them in more than one
|
|
2
|
+
// shape (v3 `status` or `state`; `description.title`, `settings.title`, a flat `title` or
|
|
3
|
+
// `details.title`), so every screen that lists programs reads them here, the same way.
|
|
4
|
+
import type { WixProgram } from "@himalaya/wix-online-programs";
|
|
5
|
+
import { cleanTitle } from "./himi-text.js";
|
|
6
|
+
|
|
7
|
+
export function programStatus(p: WixProgram): string {
|
|
8
|
+
return (p.status ?? p.state ?? "").toUpperCase();
|
|
9
|
+
}
|
|
10
|
+
export const isProgramEnded = (p: WixProgram): boolean => programStatus(p) === "ENDED" || programStatus(p) === "FINISHED";
|
|
11
|
+
export const isProgramDraft = (p: WixProgram): boolean => programStatus(p) === "DRAFT";
|
|
12
|
+
|
|
13
|
+
/** The program's own name, cleaned; "" when it has none (the caller picks its own fallback word). */
|
|
14
|
+
export function programName(p: WixProgram): string {
|
|
15
|
+
return cleanTitle(p.description?.title ?? p.settings?.title ?? p.title ?? p.details?.title);
|
|
16
|
+
}
|
|
@@ -22,7 +22,8 @@ import { iapPriceFields, onlineProgramItem, type IapPollDirective } from "@himal
|
|
|
22
22
|
import { createIapCommerce } from "@himalaya/iap-checkout";
|
|
23
23
|
import { createCollectionQuery, type CollectionPage, type CollectionQueryState } from "./collection-query.js";
|
|
24
24
|
import { memberAccess, memberAccessChanged, memberAccessDenied, type MemberAccess } from "./member-access.js";
|
|
25
|
-
import {
|
|
25
|
+
import { initials } from "./himi-text.js";
|
|
26
|
+
import { isProgramDraft, isProgramEnded, programName } from "./program-fields.js";
|
|
26
27
|
import { programImage } from "./himi-media.js";
|
|
27
28
|
import { descriptionBody } from "./rich-body.js";
|
|
28
29
|
import { programDescription } from "./program-description.js";
|
|
@@ -125,19 +126,15 @@ export interface State {
|
|
|
125
126
|
const full = (p: WixProgram): WixProgramFull => p as WixProgramFull;
|
|
126
127
|
|
|
127
128
|
function programTitle(p: WixProgram): string {
|
|
128
|
-
return
|
|
129
|
-
|| copyParam("memberPrograms.programFallbackName", "Program");
|
|
129
|
+
return programName(p) || copyParam("memberPrograms.programFallbackName", "Program");
|
|
130
130
|
}
|
|
131
131
|
function programDetails(p: WixProgram): string {
|
|
132
132
|
// The body may be a Ricos document or serialized text: read it the way the catalog and detail do.
|
|
133
133
|
const raw = descriptionBody(programDescription(p)).bodyText.replace(/\s+/g, " ").trim();
|
|
134
134
|
return raw.length > 140 ? `${raw.slice(0, 139).trimEnd()}…` : raw;
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
const isEnded = (p: WixProgram) => programStatus(p) === "ENDED" || programStatus(p) === "FINISHED";
|
|
140
|
-
const isDraft = (p: WixProgram) => programStatus(p) === "DRAFT";
|
|
136
|
+
const isEnded = isProgramEnded;
|
|
137
|
+
const isDraft = isProgramDraft;
|
|
141
138
|
function accessType(p: WixProgram): string {
|
|
142
139
|
return (full(p).restrictions?.accessType ?? "PUBLIC").toUpperCase();
|
|
143
140
|
}
|
|
@@ -126,6 +126,14 @@ interface S extends LoadFlags {
|
|
|
126
126
|
/** A location is chosen and has no session in the loaded days: its own empty state. */
|
|
127
127
|
locationEmpty: boolean;
|
|
128
128
|
notLocationEmpty: boolean;
|
|
129
|
+
/** The optional "All · Booked" filter, for an app that asks for it (`load` param `filters: "1"`):
|
|
130
|
+
* "booked" lists only the member's own sessions (booked or on the waitlist). Off by default, so
|
|
131
|
+
* an app that does not bind it lists every session, as before. */
|
|
132
|
+
filter?: "all" | "booked";
|
|
133
|
+
hideFilter?: boolean;
|
|
134
|
+
/** The booked filter is on and the member has no session in the loaded days. */
|
|
135
|
+
bookedEmpty?: boolean;
|
|
136
|
+
notBookedEmpty?: boolean;
|
|
129
137
|
}
|
|
130
138
|
|
|
131
139
|
const flag = (on: boolean): string => (on ? "true" : "");
|
|
@@ -300,6 +308,10 @@ let quietUntil = 0;
|
|
|
300
308
|
* it. Cleared by the list's own scroll and a calendar tap, whose plain day the renderer compares
|
|
301
309
|
* with what it reported (an echo of the member's own scroll never moves the list). */
|
|
302
310
|
let scrollNonce = 0;
|
|
311
|
+
/** The "All · Booked" filter: offered when the screen's load asks for it, and the member's choice. */
|
|
312
|
+
let filtersOn = false;
|
|
313
|
+
/** The member the "Booked" choice was made by: another member (or a sign-out) opens on "All". */
|
|
314
|
+
let bookedFilterFor = "";
|
|
303
315
|
let busy = false;
|
|
304
316
|
/** An Add to Calendar flow is running (a permission prompt, a save, the calendar page). Its own
|
|
305
317
|
* flag, not `busy`: the session sheet must still close while it runs. */
|
|
@@ -428,14 +440,22 @@ function derive(s: S): S {
|
|
|
428
440
|
// From today on (the loaded days never start before it), at the chosen location. The list is
|
|
429
441
|
// one run of days: a tap on the calendar SCROLLS it to a day, and scrolling it moves the
|
|
430
442
|
// selection, so it never starts at the selected day (the days above it would vanish).
|
|
431
|
-
const
|
|
443
|
+
const bookedOnly = filtersOn && !!member?.email && bookedFilterFor === member.email;
|
|
444
|
+
const mine = (x: Session) => { const p = places.get(x.key)?.place; return p === "booked" || p === "waitlisted"; };
|
|
445
|
+
const shown = sessions.filter((x) => x.day >= s.today && (!locationKey || x.locationKey === locationKey) && (!bookedOnly || mine(x)));
|
|
432
446
|
const events = rowsOk === false ? [] : shown.map((x, i) => eventOf(x, places.get(x.key), shown[i + 1]?.day !== x.day));
|
|
433
447
|
const sheet = sessions.find((x) => x.key === sheetKey);
|
|
434
448
|
const sheetPlace = sheet ? places.get(sheet.key)?.place ?? "" : "";
|
|
435
449
|
const loaded = s.status === "ready" && rowsOk !== false && !!services;
|
|
436
|
-
const locationEmpty = loaded && !!locationKey && shown.length === 0;
|
|
450
|
+
const locationEmpty = loaded && !!locationKey && shown.length === 0 && !bookedOnly;
|
|
451
|
+
const bookedEmpty = loaded && bookedOnly && shown.length === 0;
|
|
437
452
|
return {
|
|
438
453
|
...s,
|
|
454
|
+
filter: bookedOnly ? "booked" : "all",
|
|
455
|
+
// A visitor has no sessions of their own: the filter shows only to a signed-in member.
|
|
456
|
+
hideFilter: !filtersOn || !member?.email,
|
|
457
|
+
bookedEmpty,
|
|
458
|
+
notBookedEmpty: !bookedEmpty,
|
|
439
459
|
...locationMenu(choices, chosenLocation.id),
|
|
440
460
|
locationSheetOpen: locationSheet,
|
|
441
461
|
locationEmpty,
|
|
@@ -449,7 +469,7 @@ function derive(s: S): S {
|
|
|
449
469
|
signedIn: !!member?.email,
|
|
450
470
|
updateRequired: rowsOk === false,
|
|
451
471
|
listHidden: s.busy === true || rowsOk === false || events.length === 0,
|
|
452
|
-
...emptyFlags(loaded && services!.length === 0, loaded && services!.length > 0 && events.length === 0 && !locationEmpty),
|
|
472
|
+
...emptyFlags(loaded && services!.length === 0, loaded && services!.length > 0 && events.length === 0 && !locationEmpty && !bookedEmpty),
|
|
453
473
|
sheetOpen: !!sheet && !!sheetPlace,
|
|
454
474
|
sheetTitle: sheet?.title ?? "",
|
|
455
475
|
sheetWhen: sheet ? joined(dayLabel(sheet.start, { absolute: true }), timeLabel(sheet.start), lengthLabel(sheet.start, sheet.end)) : "",
|
|
@@ -630,6 +650,7 @@ function initial(): S {
|
|
|
630
650
|
sheetOpen: false, sheetTitle: "", sheetWhen: "", sheetMeta: "", sheetHideCalendar: true, sheetHideCancel: true, sheetHideLeave: true, sheetBusy: false, sheetServiceId: "", sheetSessionId: "", sheetStart: "",
|
|
631
651
|
locationOptions: [], locationLabel: "", locationA11y: "", hasLocationMenu: false, noLocationMenu: true,
|
|
632
652
|
locationActive: false, noLocationActive: true, locationSheetOpen: false, locationEmpty: false, notLocationEmpty: true,
|
|
653
|
+
filter: "all", hideFilter: true, bookedEmpty: false, notBookedEmpty: true,
|
|
633
654
|
};
|
|
634
655
|
}
|
|
635
656
|
|
|
@@ -673,10 +694,13 @@ const svc = defineService<S, {
|
|
|
673
694
|
openLocations: (s: S) => S;
|
|
674
695
|
closeLocations: (s: S) => S;
|
|
675
696
|
selectLocation: (s: S, p?: unknown) => Promise<S | undefined>;
|
|
697
|
+
setFilter: (s: S, p?: unknown) => S;
|
|
676
698
|
}>("himiBrandedAgenda", {
|
|
677
699
|
// An action's result belongs to that visit: a cold start must not replay it from saved state,
|
|
678
700
|
// nor reopen the location sheet.
|
|
679
|
-
notHydrated: ["resultOpen", "resultOpenB", "resultText", "resultOk", "resultInfo", "locationSheetOpen"],
|
|
701
|
+
notHydrated: ["resultOpen", "resultOpenB", "resultText", "resultOk", "resultInfo", "locationSheetOpen", "filter", "hideFilter", "bookedEmpty", "notBookedEmpty"],
|
|
702
|
+
// The optional Booked filter is the member's choice for this run: never written to the device.
|
|
703
|
+
notPersisted: ["filter", "hideFilter", "bookedEmpty", "notBookedEmpty"],
|
|
680
704
|
state: initial(),
|
|
681
705
|
actions: {
|
|
682
706
|
load: async (s, p) => {
|
|
@@ -688,6 +712,7 @@ const svc = defineService<S, {
|
|
|
688
712
|
}
|
|
689
713
|
const signInScreen = argOf(p, "signInScreenId");
|
|
690
714
|
if (/^[a-z][a-z0-9_]{0,63}$/.test(signInScreen)) signInScreenId = signInScreen;
|
|
715
|
+
if (argOf(p, "filters") === "1") filtersOn = true;
|
|
691
716
|
const fw = Number(argOf(p, "firstWeekday") || s.firstWeekday);
|
|
692
717
|
const today = dayKey(new Date());
|
|
693
718
|
// First appearance: open on this week. A re-appearance keeps the member's place and
|
|
@@ -932,6 +957,14 @@ const svc = defineService<S, {
|
|
|
932
957
|
locationSheet = true;
|
|
933
958
|
return derive({ ...s, ...wanted });
|
|
934
959
|
},
|
|
960
|
+
// The "All · Booked" filter (a segmented control's id, or `{ id }`). A list of the member's own
|
|
961
|
+
// sessions, from the same loaded days; the calendar's dots follow it.
|
|
962
|
+
setFilter: (s, p) => {
|
|
963
|
+
const id = typeof p === "string" ? p : argOf(p, "id") || argOf(p, "value") || argOf(p, "selectedId");
|
|
964
|
+
if (id !== "all" && id !== "booked") return s;
|
|
965
|
+
bookedFilterFor = id === "booked" ? member?.email ?? "" : "";
|
|
966
|
+
return derive({ ...s, ...wanted });
|
|
967
|
+
},
|
|
935
968
|
closeLocations: (s) => {
|
|
936
969
|
if (!locationSheet) return s;
|
|
937
970
|
locationSheet = false;
|