@wix/himalaya-cli 0.1952.0 → 0.1954.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.
Files changed (108) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/auth-providers/wix/src/index.d.ts +5 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-auth.mjs +2 -1
  3. package/dist/cli.mjs +88 -27
  4. package/guides/one-app-section-mappings.md +3 -3
  5. package/guides/one-app-to-himi-app.md +3 -3
  6. package/package.json +2 -2
  7. package/templates/bare-fashion/tier5-src/_shared/engine-intl.ts +6 -0
  8. package/templates/beauty-salon/tier5-src/_shared/agenda-calendar.ts +95 -0
  9. package/templates/beauty-salon/tier5-src/_shared/booking-session.ts +10 -0
  10. package/templates/beauty-salon/tier5-src/_shared/class-sessions.ts +113 -0
  11. package/templates/beauty-salon/tier5-src/_shared/engine-intl.ts +6 -0
  12. package/templates/beauty-salon/tier5-src/himi-branded-lite-agenda/index.ts +13 -146
  13. package/templates/beauty-salon-owner/tier5-src/_shared/engine-intl.ts +6 -0
  14. package/templates/beauty-salon-owner/tier5-src/_shared/owner-selected-site.ts +13 -0
  15. package/templates/branded-lite/l10n/ar.json +5 -0
  16. package/templates/branded-lite/l10n/cs.json +5 -0
  17. package/templates/branded-lite/l10n/da.json +5 -0
  18. package/templates/branded-lite/l10n/de.json +5 -0
  19. package/templates/branded-lite/l10n/el.json +5 -0
  20. package/templates/branded-lite/l10n/es.json +5 -0
  21. package/templates/branded-lite/l10n/fi.json +5 -0
  22. package/templates/branded-lite/l10n/fr.json +5 -0
  23. package/templates/branded-lite/l10n/he.json +4 -0
  24. package/templates/branded-lite/l10n/hu.json +5 -0
  25. package/templates/branded-lite/l10n/id.json +5 -0
  26. package/templates/branded-lite/l10n/it.json +5 -0
  27. package/templates/branded-lite/l10n/ja.json +5 -0
  28. package/templates/branded-lite/l10n/ko.json +5 -0
  29. package/templates/branded-lite/l10n/lt.json +5 -0
  30. package/templates/branded-lite/l10n/nl.json +5 -0
  31. package/templates/branded-lite/l10n/no.json +5 -0
  32. package/templates/branded-lite/l10n/pl.json +5 -0
  33. package/templates/branded-lite/l10n/pt.json +5 -0
  34. package/templates/branded-lite/l10n/ru.json +5 -0
  35. package/templates/branded-lite/l10n/sv.json +5 -0
  36. package/templates/branded-lite/l10n/th.json +5 -0
  37. package/templates/branded-lite/l10n/tr.json +5 -0
  38. package/templates/branded-lite/l10n/uk.json +5 -0
  39. package/templates/branded-lite/l10n/vi.json +5 -0
  40. package/templates/branded-lite/l10n/zh.json +5 -0
  41. package/templates/branded-lite/recipes/class-calendar.json +707 -0
  42. package/templates/branded-lite/recipes/upcoming-sessions.json +280 -0
  43. package/templates/branded-lite/tier5-src/_shared/agenda-calendar.ts +95 -0
  44. package/templates/branded-lite/tier5-src/_shared/booking-session.ts +10 -0
  45. package/templates/branded-lite/tier5-src/_shared/class-calendar-section.ts +280 -0
  46. package/templates/branded-lite/tier5-src/_shared/class-sessions.ts +113 -0
  47. package/templates/branded-lite/tier5-src/_shared/engine-intl.ts +6 -0
  48. package/templates/branded-lite/tier5-src/_shared/upcoming-sessions-section.ts +121 -0
  49. package/templates/branded-lite/tier5-src/himi-branded-lite-agenda/index.ts +13 -146
  50. package/templates/brandy/tier5-src/_shared/engine-intl.ts +6 -0
  51. package/templates/community-club/tier5-src/_shared/engine-intl.ts +6 -0
  52. package/templates/community-club-owner/tier5-src/_shared/engine-intl.ts +6 -0
  53. package/templates/community-club-owner/tier5-src/_shared/owner-selected-site.ts +13 -0
  54. package/templates/conference/tier5-src/_shared/engine-intl.ts +6 -0
  55. package/templates/events-meetups/tier5-src/_shared/engine-intl.ts +6 -0
  56. package/templates/events-meetups-owner/tier5-src/_shared/engine-intl.ts +6 -0
  57. package/templates/events-meetups-owner/tier5-src/_shared/owner-selected-site.ts +13 -0
  58. package/templates/fitness-gym/tier5-src/_shared/agenda-calendar.ts +95 -0
  59. package/templates/fitness-gym/tier5-src/_shared/booking-session.ts +10 -0
  60. package/templates/fitness-gym/tier5-src/_shared/class-sessions.ts +113 -0
  61. package/templates/fitness-gym/tier5-src/_shared/engine-intl.ts +6 -0
  62. package/templates/fitness-gym/tier5-src/himi-branded-lite-agenda/index.ts +13 -146
  63. package/templates/gym-fitness/tier5-src/_shared/agenda-calendar.ts +95 -0
  64. package/templates/gym-fitness/tier5-src/_shared/booking-session.ts +10 -0
  65. package/templates/gym-fitness/tier5-src/_shared/class-sessions.ts +113 -0
  66. package/templates/gym-fitness/tier5-src/_shared/engine-intl.ts +6 -0
  67. package/templates/gym-fitness/tier5-src/himi-branded-lite-agenda/index.ts +13 -146
  68. package/templates/gym-fitness-owner/tier5-src/_shared/engine-intl.ts +6 -0
  69. package/templates/gym-fitness-owner/tier5-src/_shared/owner-selected-site.ts +13 -0
  70. package/templates/medical-services/tier5-src/_shared/booking-session.ts +10 -0
  71. package/templates/medical-services/tier5-src/_shared/engine-intl.ts +6 -0
  72. package/templates/nonprofit-cause/tier5-src/_shared/engine-intl.ts +6 -0
  73. package/templates/nonprofit-cause-owner/tier5-src/_shared/engine-intl.ts +6 -0
  74. package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-selected-site.ts +13 -0
  75. package/templates/owner-lite/tier5-src/_shared/engine-intl.ts +6 -0
  76. package/templates/owner-lite/tier5-src/_shared/owner-selected-site.ts +13 -0
  77. package/templates/personal-fitness-trainer/tier5-src/_shared/agenda-calendar.ts +95 -0
  78. package/templates/personal-fitness-trainer/tier5-src/_shared/booking-session.ts +10 -0
  79. package/templates/personal-fitness-trainer/tier5-src/_shared/class-sessions.ts +113 -0
  80. package/templates/personal-fitness-trainer/tier5-src/_shared/engine-intl.ts +6 -0
  81. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-agenda/index.ts +13 -146
  82. package/templates/podcast-creator/tier5-src/_shared/engine-intl.ts +6 -0
  83. package/templates/podcast-creator-owner/tier5-src/_shared/engine-intl.ts +6 -0
  84. package/templates/podcast-creator-owner/tier5-src/_shared/owner-selected-site.ts +13 -0
  85. package/templates/portfolio-creative/tier5-src/_shared/engine-intl.ts +6 -0
  86. package/templates/portfolio-creative-owner/tier5-src/_shared/engine-intl.ts +6 -0
  87. package/templates/portfolio-creative-owner/tier5-src/_shared/owner-selected-site.ts +13 -0
  88. package/templates/professional-services/tier5-src/_shared/booking-session.ts +10 -0
  89. package/templates/professional-services/tier5-src/_shared/engine-intl.ts +6 -0
  90. package/templates/restaurant/tier5-src/_shared/engine-intl.ts +6 -0
  91. package/templates/restaurant-owner/tier5-src/_shared/engine-intl.ts +6 -0
  92. package/templates/restaurant-owner/tier5-src/_shared/owner-selected-site.ts +13 -0
  93. package/templates/retail-store/tier5-src/_shared/engine-intl.ts +6 -0
  94. package/templates/retail-store-owner/tier5-src/_shared/engine-intl.ts +6 -0
  95. package/templates/retail-store-owner/tier5-src/_shared/owner-selected-site.ts +13 -0
  96. package/templates/salon-spa/tier5-src/_shared/agenda-calendar.ts +95 -0
  97. package/templates/salon-spa/tier5-src/_shared/booking-session.ts +10 -0
  98. package/templates/salon-spa/tier5-src/_shared/class-sessions.ts +113 -0
  99. package/templates/salon-spa/tier5-src/_shared/engine-intl.ts +6 -0
  100. package/templates/salon-spa/tier5-src/himi-branded-lite-agenda/index.ts +13 -146
  101. package/templates/wholesale-store/tier5-src/_shared/engine-intl.ts +6 -0
  102. package/templates/yoga-studio/tier5-src/_shared/agenda-calendar.ts +95 -0
  103. package/templates/yoga-studio/tier5-src/_shared/booking-session.ts +10 -0
  104. package/templates/yoga-studio/tier5-src/_shared/class-sessions.ts +113 -0
  105. package/templates/yoga-studio/tier5-src/_shared/engine-intl.ts +6 -0
  106. package/templates/yoga-studio/tier5-src/himi-branded-lite-agenda/index.ts +13 -146
  107. package/templates/yoga-studio-owner/tier5-src/_shared/engine-intl.ts +6 -0
  108. package/templates/yoga-studio-owner/tier5-src/_shared/owner-selected-site.ts +13 -0
@@ -135,5 +135,10 @@ export interface WixNativeAuthConfig {
135
135
  * login gate; a Himi sign-out is never undone by it. Refused in consumer and account mode.
136
136
  * See docs/wix-authentication.md → "Adopting a legacy session on an in-place upgrade". */
137
137
  adoptLegacySession?: boolean;
138
+ /** #6681 — whether `bootstrap()` mints an anonymous visitor token on a signed-out launch.
139
+ * Default `true`. Set `false` for an app whose OAuth client has no site (so the anonymous grant is
140
+ * refused with a 400) and whose signed-out surfaces need no visitor: the provider then settles
141
+ * signed out without the wasted round trip. Only the bootstrap mint is skipped; sign-in is unchanged. */
142
+ mintVisitor?: boolean;
138
143
  }
139
144
  export declare function WixNativeAuthProvider(config: WixNativeAuthConfig): AuthProvider;
@@ -1392,7 +1392,8 @@ function WixNativeAuthProvider(config) {
1392
1392
  ...config.petriOverrides ? { petriOverrides: config.petriOverrides } : {},
1393
1393
  devMode: config.devMode ?? false,
1394
1394
  ...config.hostProvided ? { hostProvided: true } : {},
1395
- ...config.adoptLegacySession ? { adoptLegacySession: true } : {}
1395
+ ...config.adoptLegacySession ? { adoptLegacySession: true } : {},
1396
+ ...config.mintVisitor === false ? { mintVisitor: false } : {}
1396
1397
  }
1397
1398
  };
1398
1399
  }
package/dist/cli.mjs CHANGED
@@ -3964,6 +3964,7 @@ var init_himi_package = __esm({
3964
3964
  var ICON_VIEW_BOX, ICON_STROKE_WIDTH, ICON_FALLBACK, ICON_CATALOG, ICON_NORMALIZED_INDEX, ICON_NAMES;
3965
3965
  var init_icon_catalog_generated = __esm({
3966
3966
  "../../core/ts/src/icon-catalog.generated.ts"() {
3967
+ "use strict";
3967
3968
  init_define_HHP_CATALOG();
3968
3969
  ICON_VIEW_BOX = 24;
3969
3970
  ICON_STROKE_WIDTH = 2;
@@ -25040,11 +25041,21 @@ async function bootBundleWorker(bundleJs, opts) {
25040
25041
  }
25041
25042
  if (opts.snapshotServices !== false) for (const { name, def: def2 } of captured) services2[name] = clone(def2.state);
25042
25043
  }
25043
- return { services: services2, calls, errors, oversizeWixResponses, handles, navDirectives, pollDirectives, dispose: () => {
25044
- for (const t2 of timers) clearTimeout(t2);
25045
- timers.clear();
25046
- guestSession?.dispose();
25047
- } };
25044
+ return {
25045
+ services: services2,
25046
+ calls,
25047
+ errors,
25048
+ oversizeWixResponses,
25049
+ handles,
25050
+ navDirectives,
25051
+ pollDirectives,
25052
+ pendingTimers: () => guestActions !== void 0 ? void 0 : timers.size,
25053
+ dispose: () => {
25054
+ for (const t2 of timers) clearTimeout(t2);
25055
+ timers.clear();
25056
+ guestSession?.dispose();
25057
+ }
25058
+ };
25048
25059
  }
25049
25060
  async function loadBundleServicesLive(bundleJs, opts) {
25050
25061
  const { services: services2, calls, errors, oversizeWixResponses, dispose } = await bootBundleWorker(bundleJs, opts);
@@ -210414,6 +210425,7 @@ function barePngUrls(raw) {
210414
210425
  const settings = record3(record3(section3).settings);
210415
210426
  add(record3(settings.data).url);
210416
210427
  add(settings.imageUri);
210428
+ add(settings.coverImageUrl);
210417
210429
  if (Array.isArray(settings.items)) for (const item2 of settings.items) add(record3(item2).imageUrl);
210418
210430
  }
210419
210431
  return [...found];
@@ -210609,18 +210621,28 @@ function withoutNode(node4, id) {
210609
210621
  };
210610
210622
  return walk6(node4);
210611
210623
  }
210612
- function withoutTap(node4, id) {
210624
+ function patchNode(node4, id, patch) {
210613
210625
  const walk6 = (value2) => {
210614
210626
  if (Array.isArray(value2)) return value2.map(walk6);
210615
210627
  if (!value2 || typeof value2 !== "object") return value2;
210616
210628
  const entry = value2;
210617
210629
  const next = Object.fromEntries(Object.entries(entry).map(([k3, v2]) => [k3, walk6(v2)]));
210618
- if (entry.id !== id) return next;
210619
- const { onTap: _onTap, pressFeedback: _pressFeedback, ...modifiers } = obj19(next.modifiers);
210620
- return { ...next, modifiers };
210630
+ return entry.id === id ? patch(next) : next;
210621
210631
  };
210622
210632
  return walk6(node4);
210623
210633
  }
210634
+ function withoutTap(node4, id) {
210635
+ return patchNode(node4, id, (entry) => {
210636
+ const { onTap: _onTap, pressFeedback: _pressFeedback, ...modifiers } = obj19(entry.modifiers);
210637
+ return { ...entry, modifiers };
210638
+ });
210639
+ }
210640
+ function withProps(node4, id, props2) {
210641
+ return patchNode(node4, id, (entry) => {
210642
+ const body = obj19(entry.body);
210643
+ return { ...entry, body: { ...body, props: { ...obj19(body.props), ...props2 } } };
210644
+ });
210645
+ }
210624
210646
  function plansSection(id, s5, index, ctx, options2) {
210625
210647
  if (!ctx.hasScreen("himi_plan")) throw new RecipeError("this scaffold has no himi_plan screen for a plan card to open");
210626
210648
  const svc = ctx.uses("plans", `plans${index}`, { ...options2 });
@@ -210845,16 +210867,10 @@ function blogCarousel(type2, layoutGaps) {
210845
210867
  };
210846
210868
  }
210847
210869
  function withOpenParams(node4, id, values) {
210848
- const walk6 = (value2) => {
210849
- if (Array.isArray(value2)) return value2.map(walk6);
210850
- if (!value2 || typeof value2 !== "object") return value2;
210851
- const entry = value2;
210852
- const next = Object.fromEntries(Object.entries(entry).map(([k3, v2]) => [k3, walk6(v2)]));
210853
- if (entry.id !== id) return next;
210854
- const body = obj19(next.body), props2 = obj19(body.props), action = obj19(props2.action);
210855
- return { ...next, body: { ...body, props: { ...props2, action: { ...action, params: { ...obj19(action.params), ...values } } } } };
210856
- };
210857
- return walk6(node4);
210870
+ return patchNode(node4, id, (entry) => {
210871
+ const body = obj19(entry.body), props2 = obj19(body.props), action = obj19(props2.action);
210872
+ return { ...entry, body: { ...body, props: { ...props2, action: { ...action, params: { ...obj19(action.params), ...values } } } } };
210873
+ });
210858
210874
  }
210859
210875
  function eventsInline(id, s5, st2, index, ctx) {
210860
210876
  const { categoryIds, eventIds } = eventsSelection(st2);
@@ -211627,7 +211643,7 @@ function addNavigation(out2, plan, taken2, pageIconOf) {
211627
211643
  out2.routes.push({ layoutItemId: "(more)", label: "More", screenId, kind: "generated" });
211628
211644
  out2.tabs.push({ layoutItemId: "(more)", label: "More", screenId });
211629
211645
  }
211630
- var TEMPLATE_HOME_SCREEN, TEMPLATE_SCREEN_PARAM_KEYS, SYSTEM_ALL_PRODUCTS_ID, collectionParams, TEMPLATE_PARAMS, countOf2, SCREEN_ADAPTATIONS, FALLBACK_TARGETS, NO_INLINE_SECTION, BOTTOM_TABS_BEFORE_MORE, TEMPLATE_VERTICALS, PAGE_TYPE_ICONS, HOME_TAB_ICON, TEMPLATE_FALLBACKS, MODULES, obj19, arr3, str15, node3, text10, vstack, hstack, inset, youtubeIdOf, DIRECT_VIDEO_FILE, UNREAD_IMAGE_RATIO, BUSINESS_CHAT_SCREEN, SUBSCRIPTIONS_MAX, selectedPlanIds, MEMBERS_RAIL, PROGRAMS_DEFAULT_LIMIT, PROGRAMS_INLINE_MAX, PODCAST_INLINE, GALLERIES_INLINE_MAX, GALLERIES_LIST_INLINE, BLOG_HERO_MAX, BLOG_SEARCH_POSTS, EVENT_SCHEDULE_INLINE, SHOP_ALL, SERVICES_INLINE, UPCOMING_INLINE, HISTORY_INLINE, PRODUCTS_INLINE, GROUP_FEED_POSTS_MAX, POST_ACTION_LABELS, postActionsGap, NEWSFEED_GROUPS_MAX, LOYALTY_TIERS_INLINE, VIDEOS_INLINE_DEFAULT, VIDEOS_INLINE_MAX, WISHLIST_INLINE, SOCIAL_NETWORKS, HANDLERS, memberActionService, MERGED_PAGES_BUNDLE, hasCtaButton, chevron;
211646
+ var TEMPLATE_HOME_SCREEN, TEMPLATE_SCREEN_PARAM_KEYS, SYSTEM_ALL_PRODUCTS_ID, collectionParams, TEMPLATE_PARAMS, countOf2, SCREEN_ADAPTATIONS, FALLBACK_TARGETS, BOTTOM_TABS_BEFORE_MORE, TEMPLATE_VERTICALS, PAGE_TYPE_ICONS, HOME_TAB_ICON, TEMPLATE_FALLBACKS, MODULES, obj19, arr3, str15, node3, text10, vstack, hstack, inset, youtubeIdOf, DIRECT_VIDEO_FILE, UNREAD_IMAGE_RATIO, BUSINESS_CHAT_SCREEN, SUBSCRIPTIONS_MAX, selectedPlanIds, MEMBERS_RAIL, PROGRAMS_DEFAULT_LIMIT, PROGRAMS_INLINE_MAX, PODCAST_INLINE, GALLERIES_INLINE_MAX, GALLERIES_LIST_INLINE, BLOG_HERO_MAX, BLOG_SEARCH_POSTS, EVENT_SCHEDULE_INLINE, SHOP_ALL, SERVICES_INLINE, UPCOMING_INLINE, CALENDAR_INLINE, UPCOMING_SESSIONS_INLINE, UPCOMING_INTERVALS, HISTORY_INLINE, PRODUCTS_INLINE, GROUP_FEED_POSTS_MAX, POST_ACTION_LABELS, postActionsGap, NEWSFEED_GROUPS_MAX, LOYALTY_TIERS_INLINE, VIDEOS_INLINE_DEFAULT, VIDEOS_INLINE_MAX, WISHLIST_INLINE, SOCIAL_NETWORKS, HANDLERS, memberActionService, MERGED_PAGES_BUNDLE, hasCtaButton, chevron;
211631
211647
  var init_generate = __esm({
211632
211648
  "src/one-app/generate.ts"() {
211633
211649
  init_define_HHP_CATALOG();
@@ -211760,7 +211776,6 @@ var init_generate = __esm({
211760
211776
  stores_products_search_section: { screen: "himi_shop", needsScreen: true },
211761
211777
  stores_wishlist_section: { screen: "himi_saved_products", needsScreen: true }
211762
211778
  };
211763
- NO_INLINE_SECTION = "its data has no inline section yet";
211764
211779
  BOTTOM_TABS_BEFORE_MORE = 4;
211765
211780
  TEMPLATE_VERTICALS = {
211766
211781
  platform_general_members_section: "himi_members",
@@ -211867,6 +211882,9 @@ var init_generate = __esm({
211867
211882
  services: { file: "services-section", register: "registerServicesSection", capabilities: ["wix_api"] },
211868
211883
  // The member's own bookings: the read goes through the same member identity as My Bookings.
211869
211884
  upcomingBookings: { file: "upcoming-bookings-section", register: "registerUpcomingBookingsSection", capabilities: ["wix_api"] },
211885
+ // The Agenda inline (week strip, filters, the day's sessions) and the business's next sessions: the Agenda's reads and the member's places.
211886
+ classCalendar: { file: "class-calendar-section", register: "registerClassCalendarSection", capabilities: ["wix_api"] },
211887
+ upcomingSessions: { file: "upcoming-sessions-section", register: "registerUpcomingSessionsSection", capabilities: ["wix_api"] },
211870
211888
  // The member's weekly goal, streak and all-time sessions, counted from the same member-scoped bookings (and the same rule) as My Bookings.
211871
211889
  performanceTracker: { file: "performance-tracker-section", register: "registerPerformanceTrackerSection", capabilities: ["wix_api"] },
211872
211890
  videos: { file: "videos-section", register: "registerVideosSection", capabilities: ["wix_api"] },
@@ -211914,6 +211932,9 @@ var init_generate = __esm({
211914
211932
  SHOP_ALL = "all";
211915
211933
  SERVICES_INLINE = 6;
211916
211934
  UPCOMING_INLINE = 3;
211935
+ CALENDAR_INLINE = 10;
211936
+ UPCOMING_SESSIONS_INLINE = 3;
211937
+ UPCOMING_INTERVALS = /* @__PURE__ */ new Set(["day", "week", "month"]);
211917
211938
  HISTORY_INLINE = 1;
211918
211939
  PRODUCTS_INLINE = { carousel: 8, grid: 6 };
211919
211940
  GROUP_FEED_POSTS_MAX = 20;
@@ -212020,7 +212041,17 @@ var init_generate = __esm({
212020
212041
  if (!/^\w[\w~.-]*(?:\/[\w~./-]+)?$/.test(ref)) return ctx.unsupported(elementId, "media_elements_video_section", `its Wix video reference "${url}" is not a playable URL or a media id`);
212021
212042
  url = /\//.test(ref) ? `https://video.wixstatic.com/video/${ref}` : `https://video.wixstatic.com/video/${ref}/file`;
212022
212043
  }
212023
- return vstack(`${id}.box`, [node3(id, "Video", { url, controls: true, ...aspect, loop: !!st2.loop, autoplay: !!st2.autoplay }, { cornerRadius: 8, fillMaxWidth: true, accessibilityLabel: ctx.page.label })], 0, inset(8, 8));
212044
+ const cover2 = str15(st2.coverImageUrl).trim();
212045
+ const poster = cover2 && webUrl(cover2) ? cover2 : "";
212046
+ if (cover2 && !poster) ctx.gap(elementId, "media_elements_video_section", `its cover image "${cover2}" is not an http(s) URL; the video has no poster and the player shows its own default`);
212047
+ return vstack(`${id}.box`, [node3(id, "Video", {
212048
+ url,
212049
+ ...poster ? { poster: ctx.imageUrl(poster) } : {},
212050
+ controls: true,
212051
+ ...aspect,
212052
+ loop: !!st2.loop,
212053
+ autoplay: !!st2.autoplay
212054
+ }, { cornerRadius: 8, fillMaxWidth: true, accessibilityLabel: ctx.page.label })], 0, inset(8, 8));
212024
212055
  },
212025
212056
  // A list of image cards, each with a title and the tap the source gave it. The source may lay the title over the image
212026
212057
  // (`imageOverlay`); here it sits under the image, so the image stays clear and the title stays readable.
@@ -212641,11 +212672,41 @@ var init_generate = __esm({
212641
212672
  children2.push(...ctx.optionalRecipe("section-error", { svc, id, action: "load" }));
212642
212673
  return vstack(`${id}.box`, children2, 12, { ...inset(16, 16), onAppear: { actionId: `tier5.${svc}.load`, params: {} } });
212643
212674
  },
212644
- // The data of this is a template screen of its own (`TEMPLATE_VERTICALS`): beside other sections the page keeps the source's title and a link to it.
212645
- bookings_agenda_section: (_id, _s2, _st, _i2, ctx, elementId) => ctx.unsupported(elementId, "bookings_agenda_section", NO_INLINE_SECTION),
212646
- // The source strip is the Bookings member widget: the business's next 3 bookable sessions with the member's booked status, whatever its
212647
- // `interval` setting says (the Bookings provider reads only the business). The agenda screen lists the site's upcoming sessions.
212648
- platform_general_upcoming_section: (_id, _s2, _st, _i2, ctx, elementId) => ctx.unsupported(elementId, "platform_general_upcoming_section", "the source strip shows the business's next 3 bookable sessions with the member's booked status; the agenda screen lists the site's upcoming sessions, so the section is not shown inline"),
212675
+ // The Agenda inline, as the source section draws it: its title with See All to the Agenda, the week strip (pages by week, opens into
212676
+ // the month), filter chips, and the sessions of the selected day (or the next day with one), each with the one control the member can
212677
+ // use. The source section has no settings of its own. Booking and the member's sheet (cancel, leave, add to calendar) stay on the
212678
+ // screens that own them: Book opens Choose Time on the session, and the rest open the class on it.
212679
+ bookings_agenda_section: (id, s5, _st, index, ctx, sectionId) => {
212680
+ const type2 = "bookings_agenda_section";
212681
+ if (!ctx.hasScreen("himi_service")) return ctx.unsupported(sectionId, type2, "this scaffold has no himi_service screen for a session to open");
212682
+ const hasAgenda = ctx.hasScreen("himi_agenda");
212683
+ const timeScreen = ctx.hasScreen("himi_time") ? "himi_time" : "himi_service";
212684
+ ctx.gap(sectionId, type2, `the section shows the first ${CALENDAR_INLINE} sessions of the selected day (or the next day with one)${hasAgenda ? `, and See All opens the Agenda (the source's "Upcoming Classes" link)` : ""}; its filters are chips (All, the member's Booked sessions, each class), not the source's filter sheet; Booked and On waitlist open the class on the session, where the source opens a sheet to cancel or add it to the calendar (the Agenda keeps that sheet)`);
212685
+ const svc = ctx.uses("classCalendar", `classCalendar${index}`, { limit: CALENDAR_INLINE });
212686
+ const title = s5.showTitle === true ? str15(s5.title).trim() : "";
212687
+ const firstWeekday = ctx.firstWeekday ?? "0";
212688
+ let node4 = withProps(ctx.recipe("class-calendar", { svc, id, title, seeAllLabel: "See All", seeAllScreen: "himi_agenda", timeScreen, serviceScreen: "himi_service" }), `${id}.week`, { firstWeekday: Number(firstWeekday) });
212689
+ node4 = withoutNode(node4, title ? `${id}.headSpacer` : `${id}.title`);
212690
+ if (!hasAgenda) node4 = withoutNode(node4, `${id}.all`);
212691
+ return vstack(`${id}.box`, [node4, ...ctx.optionalRecipe("section-error", { svc, id, action: "retry" })], 12, { ...inset(16, 16), onAppear: { actionId: `tier5.${svc}.load`, params: { firstWeekday } } });
212692
+ },
212693
+ // The source strip is the Bookings member widget: the business's next sessions in its `interval` window, with the member's own place
212694
+ // (Booked, On waitlist). A visitor sees the same sessions without a badge; a row opens the class on that session, View All the Agenda.
212695
+ platform_general_upcoming_section: (id, s5, st2, index, ctx, sectionId) => {
212696
+ const type2 = "platform_general_upcoming_section";
212697
+ if (!ctx.hasScreen("himi_service")) return ctx.unsupported(sectionId, type2, "this scaffold has no himi_service screen for a session to open");
212698
+ const authored2 = str15(st2.interval).trim();
212699
+ const interval = UPCOMING_INTERVALS.has(authored2) ? authored2 : "month";
212700
+ if (authored2 && authored2 !== interval) ctx.gap(sectionId, type2, `its time window ${JSON.stringify(authored2)} is not one this generator knows; the section lists the sessions of the coming month`);
212701
+ const hasAgenda = ctx.hasScreen("himi_agenda");
212702
+ ctx.gap(sectionId, type2, `the section lists the business's next ${UPCOMING_SESSIONS_INLINE} class and course sessions in its window (the Agenda's read), with the member's Booked or On waitlist badge; a row opens the class on its session${hasAgenda ? ", and View All opens the Agenda" : ""}`);
212703
+ const svc = ctx.uses("upcomingSessions", `upcomingSessions${index}`, { limit: UPCOMING_SESSIONS_INLINE, interval });
212704
+ const title = str15(s5.title).trim();
212705
+ let node4 = ctx.recipe("upcoming-sessions", { svc, id, title, seeAllLabel: "View All", seeAllScreen: "himi_agenda", serviceScreen: "himi_service" });
212706
+ node4 = withoutNode(node4, title ? `${id}.headSpacer` : `${id}.title`);
212707
+ if (!hasAgenda) node4 = withoutNode(node4, `${id}.all`);
212708
+ return vstack(`${id}.box`, [node4, ...ctx.optionalRecipe("section-error", { svc, id, action: "load" })], 12, { ...inset(16, 16), onAppear: { actionId: `tier5.${svc}.load`, params: {} } });
212709
+ },
212649
212710
  // Shared galleries are the members' Shared Gallery, a different data source from the Pro Gallery list the shared loader reads (the
212650
212711
  // migration guide says not to substitute it), so the section is not shown inline: it keeps its title and links to the galleries screen.
212651
212712
  shared_gallery_list_section: (_id, _s2, _st, _i2, ctx, elementId) => ctx.unsupported(elementId, "shared_gallery_list_section", "the source's shared galleries are the members' Shared Gallery, a different data source from the site's Pro Gallery, so they are not shown inline; the link opens the site's galleries, not the members' shared ones"),
@@ -116,7 +116,7 @@ carousel placement remain separate gaps; the mappings above stay Partial.
116
116
  | Source sectionDefinitionId | Source viewer component | Himalaya implementation | Placement / reuse | Class | Settings, actions and gaps |
117
117
  | --- | --- | --- | --- | --- | --- |
118
118
  | `bookings_services_list_section` | `wix.bookings.sectionServiceList` | [himi_services / himi_service](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/packages/himi-booking/dev/index.ts) + [services worker](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/tier5-bundles-src/himi-booking-services/index.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Screen; inline adapter needed | Module | Reuse the member service catalog/detail and established booking/time flow. Translate the actual instance filters and preserve the source section CTA; compose inline when required. |
119
- | `bookings_agenda_section` | `wix.bookings.sectionAgenda` | [himi_agenda](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/apps/himi-branded-lite/dev/index.ts) + [Bookings agenda worker](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/tier5-bundles-src/himi-branded-lite-agenda/index.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Existing base; adaptation needed | Partial | The template agenda lists the site's upcoming class and course sessions under a week/month calendar, with booking and waitlist for a signed-in member. A page made only of this section opens it; beside other sections the page keeps a link to it. The source section's own settings, if any, and its inline layout are not established. |
119
+ | `bookings_agenda_section` | `wix.bookings.sectionAgenda` | [himi_agenda](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/apps/himi-branded-lite/dev/index.ts) + [Bookings agenda worker](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/tier5-bundles-src/himi-branded-lite-agenda/index.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Existing base; adaptation needed | Partial | The template agenda lists the site's upcoming class and course sessions under a week/month calendar, with booking and waitlist for a signed-in member. A page made only of this section opens it. Beside other sections `himi one-app generate` shows it inline (`class-calendar` recipe + `class-calendar-section` module over the Agenda's reads): the week strip with paging, filter chips (All, the member's Booked sessions, each class), and the selected day's sessions with coach, spots, place and the Agenda's one control (Book opens Choose Time on the session). The source section has no settings; its filter sheet and booked-session sheet are reported gaps. |
120
120
  | `upcoming_bookings_section` | `wix.bookings.sectionUpcomingBookings` | [himi_bookings](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/packages/himi-booking/dev/index.ts) + [member bookings worker](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/tier5-bundles-src/himi-booking-bookings/index.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Existing base; adaptation needed | Partial | Reuse member-booking data and existing detail/actions. Preserve the upcoming-only selection, limit, and source CTA; do not render all historical bookings as upcoming. |
121
121
  | `performance_tracker_section` | `wix.bookings.sectionPerformanceTracker` | Branded Lite performance-tracker recipe over the member's own Bookings | Generated inline by `himi one-app generate` | Partial | Shows the member's progress against the source's weekly goal (default 2), the weekly streak and the all-time sessions, counted from their confirmed past bookings with the rule of My Bookings' "This week"; a guest sees a sign-in prompt. It does not read the source's tracker service or its attended marks, and it has no daily activity or Apple Health data: each is reported as an adapted gap. |
122
122
 
@@ -220,7 +220,7 @@ carousel placement remain separate gaps; the mappings above stay Partial.
220
220
  | Source sectionDefinitionId | Source viewer component | Himalaya implementation | Placement / reuse | Class | Settings, actions and gaps |
221
221
  | --- | --- | --- | --- | --- | --- |
222
222
  | `platform_general_contact_section` | `wix.platform.general.contact_section` | [Core Text/Button/Map composition](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/src/builder.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Inline composition | Composition | Compose the supplied business contact/address/description and source visibility/get-in-touch settings. Wire phone/email/URL/chat actions to existing target capabilities; the Structure alone may need business contact values supplied alongside it. |
223
- | `platform_general_upcoming_section` | `wix.platform.general.upcoming_section` | [My Bookings data](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/tier5-bundles-src/himi-booking-bookings/index.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") + [existing home modules](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/src/home-modules-screen.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Existing base; adaptation needed | Partial | Reuse real member upcoming-booking logic and compose the source strip/limit. Preserve visitor/access behavior and the original agenda CTA; this does not resolve the separate Bookings agenda gap. |
223
+ | `platform_general_upcoming_section` | `wix.platform.general.upcoming_section` | [My Bookings data](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/tier5-bundles-src/himi-booking-bookings/index.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") + [existing home modules](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/src/home-modules-screen.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Existing base; adaptation needed | Partial | Generated inline by `himi one-app generate` (`upcoming-sessions` recipe + `upcoming-sessions-section` module over the Agenda's reads): the business's next 3 class and course sessions in the source's `interval` window (`day`, `week`, `month`), with a date block, local times, the coach and the member's Booked / On waitlist badge; visitors see the same sessions without a badge. A row opens the class on its session; View All opens the Agenda, the source's CTA. A page made only of the section opens `himi_agenda`. |
224
224
  | `platform_general_announcement_section` | `wix.platform.general.announcement_section` | `announcement-section` shared module + `announcement-card` recipe, mapped by `himi one-app generate` | Inline section; the content is read at runtime, never baked at migration time | Module | The latest announcement (title, rich body, creator, date) through the one read-only call the native app makes: `GET https://manage.wix.com/_api/mobile-apps-announcements/v1/announcements/latest?includeReaderData=false`, authorized with the app's own signed instance (Member when signed in, else Visitor). `includeReaderData` stays false (true needs the One App manage permission and answers 403); `AddCurrentMemberAsReader` is a write and is never called. Known server behaviour, shared with the native app: a site with no announcement gets its default welcome text saved once by this read, so do not call it during migration collection or validation. The section has no settings. The announcement `content` is a DraftJS raw state for announcements written in the app or a Ricos document (shown rich). A DraftJS state with pictures (an atomic block pointing at a `wix-draft-plugin-image` entity, shape read from a live site) is shown rich too, its pictures in order with the text and sized from the Wix media name; a DraftJS state without pictures is shown as plain text, and other entities (video, file, gallery) are left out. Native hosts send the consumer credential to exactly this GET path only (the `isSupportedConsumerEndpoint` family in `WixApiCapability`, Android and Swift), so a phone shows the section from the first Player/app native release that carries that entry; the local web preview (`himi run`) needs nothing. |
225
225
  | `platform_general_members_section` | `membersArea.MembersAboutWidget` | [Member data](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/tier5-bundles-src/wix-spaces-members/index.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") + [existing member avatars/home composition](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/src/home-modules-screen.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Inline composition | Composition | Reuse member rows/avatar presentation and the member-directory destination. Preserve source strip/title/count/privacy settings rather than copying seeded dashboard members. |
226
226
  | `platform_elements_divider_section` | `wix.platform.elements.divider_section` | [Core Divider / layout modifiers](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/src/builder.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Inline primitive | Primitive | Translate orientation/style/spacing from instance settings where supported and retain section margins. |
@@ -380,7 +380,7 @@ These are the exact definitions whose target cells above remain empty. “Not fo
380
380
  | Server group | Unmapped source definition | Missing implementation / decision |
381
381
  | --- | --- | --- |
382
382
  | `mobile-app-widgets-section-definitions.json` | `mobile_app_widgets.viewer` | Arbitrary mobile-app widget runtime has no verified matching Himalaya implementation. Widget-specific code/content needs a user decision. |
383
- | `bookings-section-definitions.json` | `bookings_agenda_section` | The template's himi_agenda screen lists the site's upcoming class and course sessions; the source section's inline layout is not reproduced. Member My Bookings, a service time picker, and the Spaces schedule (which queries Events) are different features. |
383
+ | `bookings-section-definitions.json` | `bookings_agenda_section` | The template's himi_agenda screen lists the site's upcoming class and course sessions, and beside other sections the generator shows the same schedule inline as a week strip with the day's sessions. Member My Bookings, a service time picker, and the Spaces schedule (which queries Events) are different features. |
384
384
  | `events-section-definitions.json` | `events_discussion_section` | No event-scoped discussion implementation was found. Groups/social feed and Blog comments must not be selected automatically. |
385
385
  | `events-section-definitions.json` | `events_guests_section` | The Events detail has only a best-effort attendee summary/avatar strip using an owner-scoped guest query. It is not a full consumer guest-list section; leave the mapping unassigned. |
386
386
  | `groups-section-definitions.json` | `single_group_feed_section` | A feed exists, but it selects a relevant/home group internally and does not accept the configured fixed-group selector. No verified single-group feed adapter exists; keep this target empty until a policy/implementation is chosen. |
@@ -209,7 +209,7 @@ participants or derive program completion from a badge title.
209
209
 
210
210
  `himi one-app generate` connects these sections to a screen the template already ships. A page made only of the section opens
211
211
  the screen as its tab. Beside other sections, a scaffold that ships the section's inline recipe (the branded-lite starter does for
212
- groups, a single group's feed, FAQ, products, paid plans, the member's subscriptions, the blog carousel, the services list, upcoming bookings, videos and the performance tracker: see "Data sections" below) shows the data in place; a scaffold without it keeps the
212
+ groups, a single group's feed, FAQ, products, paid plans, the member's subscriptions, the blog carousel, the services list, upcoming bookings, videos, the performance tracker, the class calendar and the upcoming sessions strip: see "Data sections" below) shows the data in place; a scaffold without it keeps the
213
213
  source's title (only when the source shows it) and a **See All** button to the screen, as this table says.
214
214
 
215
215
  | Source section | Screen | What the section passes |
@@ -222,9 +222,9 @@ source's title (only when the source shows it) and a **See All** button to the s
222
222
  | `faq_list_section` | `himi_faq` | nothing: no question count or category selection |
223
223
  | `newBlog_postlist_carousel_full_section` | `himi_blog` | nothing: the screen does not open on a category |
224
224
  | `stores_products_grid_section`, `stores_products_carousel_section` | `himi_shop` | `categoryId`: the section's collection (Wix's "All Products" collection is the shop's own All chip) |
225
- | `platform_general_upcoming_section` | `himi_agenda` | nothing: the source strip is the Bookings member widget (the business's next 3 bookable sessions with the member's booked status; the Events module does not feed it), whatever its `interval` says |
225
+ | `platform_general_upcoming_section` | `himi_agenda` | nothing to the screen. Beside other sections, a scaffold with `himi_service` and the `upcoming-sessions` recipe shows the strip inline: the business's next 3 class and course sessions in the source's `interval` window (`day`, `week` or `month` from now; another value is the month, reported), each with a date block, the day and local times, the coach, and the member's Booked or On waitlist badge. A row opens `himi_service` on its session, and View All opens this screen |
226
226
  | `vod_list_section` | `himi_videos` | nothing: the screen is the channel list (the source has no setting to choose a channel). Beside other sections it shows each channel in place, as the source does: its cover, title and size ("1 video · Free"), Play All, its first five clips as rows (the length on the thumbnail, the video's host when it is not Wix) and See All to the channel (`himi_video_channel`) when it has more; the first three channels, with See All to this screen when the site has more. A clip and Play All open `himi_video`, which plays a Wix-hosted or YouTube video; Play All starts on the first of those among the clips the section reads (the rows and one more) and does not go on to the next clip (reported as a gap); a channel with none there shows no Play All, and its rows and See All still open every clip. A site with no ready video shows "No videos yet."; a failed read shows the shared error piece |
227
- | `bookings_agenda_section` | `himi_agenda` | nothing: the screen is the calendar of the site's class and course sessions |
227
+ | `bookings_agenda_section` | `himi_agenda` | nothing: the screen is the calendar of the site's class and course sessions. Beside other sections, a scaffold with `himi_service` and the `class-calendar` recipe shows the calendar inline: the Agenda's week strip (it pages and opens into the month), filter chips (All, the member's Booked sessions, each class), and the first 10 sessions of the selected day or the next day with one, each with its coach, spots, place and one control (Book opens `himi_time` on the session; View Course and Join Waitlist open `himi_service` on it). See All opens this screen; the source's filter sheet and its booked-session sheet are reported gaps |
228
228
  | `progallery_carousel_section` | `himi_galleries` | `maxGalleries`, `isCarousel`, `isShowName`: a rail of the first `maxGalleries` gallery covers (full-width cards when the carousel is off). With exactly ONE gallery and the carousel on, the source shows that gallery as a collage, and so does the section: the gallery's name (when names are on) with View All, then its first five pictures as one big tile and four small, the last small tile with "+N" for the pictures past the five; a tile and View All open the gallery (`himi_gallery`). The section's own title is not shown there (the header is the gallery's name), and a picture's caption over its tile is reported as a gap. Like the list section it reads the One App's galleries service as a member: a visitor sees the "no galleries" state |
229
229
  | `proGallery_gallery_list_section` | `himi_galleries` | nothing: the section has no settings. Beside other sections it shows the site's first 10 galleries as full-width cards (a card opens `himi_gallery`), with View All to this screen, and reports that gap. Like the source, which reads the One App's own galleries service as a member and never shows hidden or empty galleries, the section lists them for a signed-in member only: a visitor sees the "no galleries" state, and so does a member where that service cannot be read (the web bridge refuses its host: the public Pro Gallery list has no hidden flag, so it is never used as a stand-in) |
230
230
  | `shared_gallery_list_section` | `himi_galleries` | nothing. Never shown inline: it is the members' Shared Gallery, a different data source from the site's Pro Gallery. It keeps its title and a See All link that opens the site's galleries, not the members' shared ones, and reports that gap |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1952.0",
3
+ "version": "0.1954.0",
4
4
  "type": "module",
5
5
  "description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
6
6
  "keywords": [
@@ -82,5 +82,5 @@
82
82
  "artifactId": "himalaya-cli"
83
83
  }
84
84
  },
85
- "falconPackageHash": "490e5dc1a2ade49f58214dbb2e9632a0533a797f287a1acaa48b1c21"
85
+ "falconPackageHash": "efb6a804b5633b8cf9a1609bfd04a9322c802f1b63e4c19cb9e9ffdf"
86
86
  }
@@ -118,6 +118,12 @@ export function formatDateMedium(date: Date, locale = appLocale(), timeZone?: st
118
118
  return `${MONTHS_SHORT[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
119
119
  }
120
120
 
121
+ /** `{ month: "short" }` — "Dec": a date block's month, under its day number. */
122
+ export function formatMonthShort(date: Date, locale = appLocale(), timeZone?: string): string {
123
+ if (hasIntl()) return dateFormat(locale, { month: "short" }, timeZone).format(date);
124
+ return MONTHS_SHORT[date.getMonth()]!;
125
+ }
126
+
121
127
  /** `{ month: "short", year: "numeric" }` — "Jul 2026", without parsing a localized day.
122
128
  * Like the other date helpers, an engine without Intl keeps the documented en-US fallback. */
123
129
  export function formatMonthYear(date: Date, locale = "en-US", timeZone?: string): string {
@@ -0,0 +1,95 @@
1
+ // The Bookings Agenda's calendar rules: which days a page dims and dots, which days it reads, and where the selection
2
+ // goes when the calendar pages. Shared by the Agenda screen and the class calendar section a page shows inline, so the
3
+ // two calendars behave the same.
4
+ import { addDays, dayKey, toDate, weekOf, type DayDecoration, type Weekday } from "@himalaya/time";
5
+ import type { Session } from "./booking-session.js";
6
+
7
+ /** How far past the selected day the list reaches. */
8
+ export const AGENDA_DAYS = 28;
9
+
10
+ /** The first and last cell any month grid of `day`'s month can have, padding included. */
11
+ function monthGrid(day: string): { start: string; end: string } {
12
+ const d = toDate(day);
13
+ if (!d) return { start: day, end: day };
14
+ return { start: dayKey(new Date(d.getFullYear(), d.getMonth(), 1 - 6)), end: dayKey(new Date(d.getFullYear(), d.getMonth() + 1, 6)) };
15
+ }
16
+
17
+ /** One dot per day that has a session — "something is on", not how much — and the visible
18
+ * days before today dimmed and unselectable: the agenda is what is still to come. */
19
+ export function decorationsOf(sessions: Session[], today: string, rangeStart: string, rangeEnd: string): DayDecoration[] {
20
+ const out: DayDecoration[] = [];
21
+ const dimmed = new Set<string>();
22
+ const dim = (from: string, to: string) => {
23
+ for (let day = from; day && day < today && day <= to; day = dayKey(addDays(day, 1))) {
24
+ if (!dimmed.has(day)) { dimmed.add(day); out.push({ date: day, disabled: true }); }
25
+ }
26
+ };
27
+ // Bounded by the visible days: a page a year back dims its 7-42 cells, not a year.
28
+ dim(rangeStart, rangeEnd);
29
+ // And this month's grid: an older binary (no week mode) draws it on first open, while it
30
+ // reports nothing until the member pages.
31
+ dim(monthGrid(today).start, today);
32
+ for (const date of [...new Set(sessions.filter((s) => s.day >= today).map((s) => s.day))].sort()) out.push({ date, dotCount: 1 });
33
+ return out;
34
+ }
35
+
36
+ /** The days to load: the visible days (never before today) through AGENDA_DAYS past the
37
+ * selected day, so the list under the calendar always has its full reach. */
38
+ export function windowFor(today: string, rangeStart: string, rangeEnd: string, selected: string): { start: string; end: string } {
39
+ const start = rangeStart > today ? rangeStart : today;
40
+ const from = selected > today ? selected : today;
41
+ // Through the last cell of the selected day's month grid as well, which is what an older
42
+ // binary draws before it has reported any page: every dot on it is then real.
43
+ const end = [rangeEnd, dayKey(addDays(from, AGENDA_DAYS)), monthGrid(from).end].reduce((a, b) => (b > a ? b : a));
44
+ return { start, end };
45
+ }
46
+
47
+ /** Where the selection goes when the calendar pages away from it: the first day of the
48
+ * page (the 1st of the titled month in month view — the grid's first cell is padding),
49
+ * or today when that is on the page. A page wholly before today has no day to select (past
50
+ * days are disabled), so `current` stays selected and the list keeps showing from it. */
51
+ export function selectionForRange(today: string, rangeStart: string, rangeEnd: string, current = today): string {
52
+ const { first, last } = titledDays(rangeStart, rangeEnd);
53
+ if (today >= first && today <= last) return today;
54
+ return last < today ? current : first;
55
+ }
56
+
57
+ /** The days a page is about: the whole week, or a month grid's TITLED month — its padding cells
58
+ * belong to the neighbouring months. */
59
+ export function titledDays(rangeStart: string, rangeEnd: string): { first: string; last: string } {
60
+ let first = rangeStart;
61
+ let last = rangeEnd;
62
+ const span = Math.round((Date.parse(rangeEnd) - Date.parse(rangeStart)) / 86_400_000);
63
+ if (span > 7) {
64
+ // A month grid: its padding cells belong to the neighbouring months. Today counts only when
65
+ // it is in the TITLED month — a today in the trailing padding would move the selection, and
66
+ // with it the grid, a month forward.
67
+ const d = toDate(rangeStart);
68
+ if (d) {
69
+ const month = rangeStart.endsWith("-01") ? d : new Date(d.getFullYear(), d.getMonth() + 1, 1);
70
+ first = dayKey(month);
71
+ last = dayKey(new Date(month.getFullYear(), month.getMonth() + 1, 0));
72
+ }
73
+ }
74
+ return { first, last };
75
+ }
76
+
77
+ /** The month grid (whole weeks) of `day`'s month, as a calendar draws it. */
78
+ export function monthGridOf(day: string, firstWeekday: number): { start: string; end: string } | undefined {
79
+ const d = toDate(day);
80
+ if (!d) return undefined;
81
+ const fw = (((firstWeekday % 7) + 7) % 7) as Weekday;
82
+ const start = weekOf(new Date(d.getFullYear(), d.getMonth(), 1), fw)[0];
83
+ const end = weekOf(new Date(d.getFullYear(), d.getMonth() + 1, 0), fw)[6];
84
+ return start && end ? { start, end } : undefined;
85
+ }
86
+
87
+ /** Does the selection survive a page change? Inside the page's TITLED days, yes — a selection in a
88
+ * month grid's padding belongs to the neighbouring month. Today stays selected on any page that
89
+ * shows it: opening a week that straddles two months into the month holding most of it must not
90
+ * move the agenda off today. */
91
+ export function keepsSelection(cur: { today: string; selectedDate: string }, start: string, end: string): boolean {
92
+ const page = titledDays(start, end);
93
+ if (cur.selectedDate >= page.first && cur.selectedDate <= page.last) return true;
94
+ return !!cur.today && cur.selectedDate === cur.today && cur.today >= start && cur.today <= end;
95
+ }
@@ -138,6 +138,16 @@ export function bySession(found: Map<string, MemberPlace>, inWindow: Session[]):
138
138
  return out;
139
139
  }
140
140
 
141
+ /** "1 hr", "45 min", "1 hr 30 min" — the length under a session's time (the Agenda row, the class calendar section). */
142
+ export function lengthLabel(start: string, end: string): string {
143
+ const mins = Math.round((Date.parse(end) - Date.parse(start)) / 60_000);
144
+ if (!Number.isFinite(mins) || mins <= 0) return "";
145
+ const h = Math.floor(mins / 60), m = mins % 60;
146
+ return h && m
147
+ ? copyTemplate("agenda.lengthHoursMinutes", "{h} hr {m} min", { h, m })
148
+ : h ? copyTemplate("agenda.lengthHours", "{h} hr", { h }) : copyTemplate("agenda.lengthMinutes", "{m} min", { m });
149
+ }
150
+
141
151
  /** "4 spots left", "1 spot left", or "Full". Empty when the site reports no capacity, and for a
142
152
  * course: a session's open spots do not say whether the course has room. */
143
153
  export function spotsLabel(s: Session): string {
@@ -0,0 +1,113 @@
1
+ // The site's class and course sessions, read the way the Bookings Agenda reads them: the CLASS and COURSE services (an
2
+ // appointment's availability is every free slot of a day, a booking grid rather than a schedule), then each service's
3
+ // sessions in a window. Shared by the Agenda screen and the page sections that show the same schedule inline (the class
4
+ // calendar and the upcoming sessions strip), so a session reads the same everywhere.
5
+ import { addDays, dayKey } from "@himalaya/time";
6
+ import { queryServiceAvailability, queryServices, type WixAvailabilityEntry, type WixService } from "@himalaya/wix-bookings";
7
+ import { compareText } from "./engine-intl.js";
8
+ import { sessionOf, type Session } from "./booking-session.js";
9
+
10
+ /** Services whose sessions are fixed events: a class's are each booked on their own, a course's are listed but the course is
11
+ * booked as a whole (on its service screen). */
12
+ const SESSION_TYPES = new Set(["CLASS", "COURSE"]);
13
+
14
+ /** How long a page's sections share one read: the sections a page shows together appear together, so the second one reuses the
15
+ * first one's catalog and availability instead of reading them again. Short, so a later appearance still reads fresh. */
16
+ export const SHARED_READ_MS = 5_000;
17
+
18
+ export interface ShareOptions {
19
+ /** Reuse a read another section of the page started or finished in the last SHARED_READ_MS. Off for the Agenda screen. */
20
+ share?: boolean;
21
+ }
22
+
23
+ let sharedCatalog: { at: number; read: Promise<WixService[]> } | undefined;
24
+
25
+ /** Every visible class and course service of the site. Every page, not the first 100: a class past the first page would
26
+ * silently be missing. Bounded, so a misbehaving paging answer cannot loop forever. */
27
+ export async function readClassServices(options: ShareOptions = {}): Promise<WixService[]> {
28
+ if (!options.share) return readCatalog();
29
+ if (sharedCatalog && Date.now() - sharedCatalog.at < SHARED_READ_MS) return sharedCatalog.read;
30
+ const entry = { at: Date.now(), read: readCatalog() };
31
+ sharedCatalog = entry;
32
+ // A failed read is not shared: the next section reads again.
33
+ entry.read.catch(() => { if (sharedCatalog === entry) sharedCatalog = undefined; });
34
+ return entry.read;
35
+ }
36
+
37
+ async function readCatalog(): Promise<WixService[]> {
38
+ const all: WixService[] = [];
39
+ for (let page = 0; page < 10; page++) {
40
+ const res = await queryServices({ query: { paging: { limit: 100, offset: page * 100 } } } as never);
41
+ const batch = res.services ?? [];
42
+ all.push(...batch);
43
+ if (batch.length < 100) break;
44
+ }
45
+ return all.filter((svc) => {
46
+ const raw = svc as WixService & { type?: string; hidden?: boolean };
47
+ return !!svc.id && SESSION_TYPES.has((raw.type ?? "").toUpperCase()) && raw.hidden !== true;
48
+ });
49
+ }
50
+
51
+ /** Sessions once each, by start then title: the order every schedule lists them in. */
52
+ export function orderedSessions(list: Session[]): Session[] {
53
+ const seen = new Set<string>();
54
+ return list
55
+ .filter((s) => (seen.has(s.key) ? false : (seen.add(s.key), true)))
56
+ .sort((a, b) => Date.parse(a.start) - Date.parse(b.start) || compareText(a.title, b.title));
57
+ }
58
+
59
+ /** Every session of `services` from the start of local day `start` through the end of local day `end`. Each service is its own
60
+ * call (the proven single-service availability query), so one service failing (a draft, a removed schedule) costs its own
61
+ * sessions, never the whole schedule; every service failing fails the read. */
62
+ export async function readClassSessions(services: readonly WixService[], start: string, end: string, options: ShareOptions = {}): Promise<Session[]> {
63
+ const read = options.share ? sharedAvailability : availability;
64
+ const settled = await Promise.allSettled(services.map((svc) => read(svc.id, start, end)));
65
+ const failures = settled.filter((r) => r.status === "rejected").length;
66
+ if (services.length && failures === services.length) throw (settled[0] as PromiseRejectedResult).reason;
67
+ const out: Session[] = [];
68
+ settled.forEach((r, i) => {
69
+ if (r.status !== "fulfilled") return;
70
+ for (const entry of r.value) {
71
+ const session = sessionOf(entry, services[i]!);
72
+ // A shared read may span more days than asked for: only the asked days are this read's.
73
+ if (session && session.day >= start && session.day <= end) out.push(session);
74
+ }
75
+ });
76
+ return orderedSessions(out);
77
+ }
78
+
79
+ /** One service's availability from the start of local day `start` through the end of local day `end`. */
80
+ async function availability(serviceId: string, start: string, end: string): Promise<WixAvailabilityEntry[]> {
81
+ const from = new Date(`${start}T00:00:00`).toISOString();
82
+ const to = new Date(`${dayKey(addDays(end, 1))}T00:00:00`).toISOString();
83
+ return (await queryServiceAvailability(serviceId, from, to, { bookable: false })).availabilityEntries ?? [];
84
+ }
85
+
86
+ interface Segment { start: string; end: string; at: number; read: Promise<WixAvailabilityEntry[]> }
87
+ const segments = new Map<string, Segment[]>();
88
+
89
+ /** `availability`, reusing the days another section of the page read in the last SHARED_READ_MS: only the days no recent read
90
+ * covers are fetched (the class calendar's weeks and the upcoming strip's month overlap almost entirely). */
91
+ async function sharedAvailability(serviceId: string, start: string, end: string): Promise<WixAvailabilityEntry[]> {
92
+ const now = Date.now();
93
+ const fresh = (segments.get(serviceId) ?? []).filter((x) => now - x.at < SHARED_READ_MS).sort((a, b) => (a.start < b.start ? -1 : 1));
94
+ const parts: Segment[] = [];
95
+ let day = start;
96
+ for (const x of fresh) {
97
+ if (day > end) break;
98
+ if (x.end < day || x.start > end) continue;
99
+ if (x.start > day) parts.push(fetchSegment(serviceId, day, dayKey(addDays(x.start, -1)), now));
100
+ parts.push(x);
101
+ day = dayKey(addDays(x.end, 1));
102
+ }
103
+ if (day <= end) parts.push(fetchSegment(serviceId, day, end, now));
104
+ segments.set(serviceId, [...fresh, ...parts.filter((x) => !fresh.includes(x))]);
105
+ return (await Promise.all(parts.map((x) => x.read))).flat();
106
+ }
107
+
108
+ function fetchSegment(serviceId: string, start: string, end: string, at: number): Segment {
109
+ const segment: Segment = { start, end, at, read: availability(serviceId, start, end) };
110
+ // A failed read is not shared: the next section reads those days again.
111
+ segment.read.catch(() => { segments.set(serviceId, (segments.get(serviceId) ?? []).filter((x) => x !== segment)); });
112
+ return segment;
113
+ }
@@ -118,6 +118,12 @@ export function formatDateMedium(date: Date, locale = appLocale(), timeZone?: st
118
118
  return `${MONTHS_SHORT[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
119
119
  }
120
120
 
121
+ /** `{ month: "short" }` — "Dec": a date block's month, under its day number. */
122
+ export function formatMonthShort(date: Date, locale = appLocale(), timeZone?: string): string {
123
+ if (hasIntl()) return dateFormat(locale, { month: "short" }, timeZone).format(date);
124
+ return MONTHS_SHORT[date.getMonth()]!;
125
+ }
126
+
121
127
  /** `{ month: "short", year: "numeric" }` — "Jul 2026", without parsing a localized day.
122
128
  * Like the other date helpers, an engine without Intl keeps the documented en-US fallback. */
123
129
  export function formatMonthYear(date: Date, locale = "en-US", timeZone?: string): string {