@wix/himalaya-cli 0.1851.0 → 0.1853.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 (510) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +5 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +13 -3
  3. package/dist/browser-plane/assets.json +5 -5
  4. package/dist/browser-plane/preview-deferred/{166f7ee733ea8d0fe7bba8b796232efd4f5413e22af4a8aeee20cae1069b2fd6.bin → fb500748f6c4768468f2e7f985aa67c38633077c7a98caaa6b500c7b00eea8e9.bin} +1 -1
  5. package/dist/browser-plane/sw.js +7 -7
  6. package/dist/cli.mjs +10136 -9601
  7. package/dist/preview-assets.generated.bin +0 -0
  8. package/guides/component-index.md +1 -1
  9. package/guides/component-reference.json +2 -2
  10. package/guides/component-reference.md +8 -1
  11. package/guides/designing-himi-screens.md +5 -1
  12. package/guides/himi-json-output.md +13 -3
  13. package/guides/one-app-section-mappings.md +1 -1
  14. package/guides/one-app-to-himi-app.md +60 -10
  15. package/guides/sdk-reference.json +2 -2
  16. package/package.json +2 -2
  17. package/template-icons/bare-fashion.png +0 -0
  18. package/templates/bare-fashion/README.md +52 -0
  19. package/templates/bare-fashion/config.ts +474 -0
  20. package/templates/bare-fashion/dev/index.ts +16526 -0
  21. package/templates/bare-fashion/himalaya.content.json +70 -0
  22. package/templates/bare-fashion/himalaya.template.json +18 -0
  23. package/templates/bare-fashion/icon.png +0 -0
  24. package/templates/bare-fashion/platforms.json +3 -0
  25. package/templates/bare-fashion/tier5-src/_shared/app-locale.ts +70 -0
  26. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-address-book.ts +116 -0
  27. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-address-countries.ts +261 -0
  28. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-bag-count.ts +24 -0
  29. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-categories.ts +48 -0
  30. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-facets.ts +265 -0
  31. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-load-error.ts +38 -0
  32. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-product-card.ts +136 -0
  33. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-store-options.ts +129 -0
  34. package/templates/bare-fashion/tier5-src/_shared/branded-lite-hosted.ts +282 -0
  35. package/templates/bare-fashion/tier5-src/_shared/collection-contract.ts +228 -0
  36. package/templates/bare-fashion/tier5-src/_shared/collection-query.ts +201 -0
  37. package/templates/bare-fashion/tier5-src/_shared/collection-service.ts +429 -0
  38. package/templates/bare-fashion/tier5-src/_shared/engine-intl.ts +529 -0
  39. package/templates/bare-fashion/tier5-src/_shared/himi-account.ts +209 -0
  40. package/templates/bare-fashion/tier5-src/_shared/himi-copy.ts +123 -0
  41. package/templates/bare-fashion/tier5-src/_shared/himi-layouts.ts +142 -0
  42. package/templates/bare-fashion/tier5-src/_shared/himi-store-categories.ts +108 -0
  43. package/templates/bare-fashion/tier5-src/_shared/himi-store-saved.ts +57 -0
  44. package/templates/bare-fashion/tier5-src/_shared/himi-store.ts +7 -0
  45. package/templates/bare-fashion/tier5-src/_shared/himi-text.ts +24 -0
  46. package/templates/bare-fashion/tier5-src/_shared/hosted-checkout.ts +70 -0
  47. package/templates/bare-fashion/tier5-src/_shared/live-session.ts +172 -0
  48. package/templates/bare-fashion/tier5-src/_shared/local-preferences.ts +38 -0
  49. package/templates/bare-fashion/tier5-src/_shared/member-access.ts +63 -0
  50. package/templates/bare-fashion/tier5-src/_shared/member-avatar.ts +76 -0
  51. package/templates/bare-fashion/tier5-src/_shared/member-orders.ts +8 -0
  52. package/templates/bare-fashion/tier5-src/_shared/online-actions.ts +76 -0
  53. package/templates/bare-fashion/tier5-src/_shared/owner-load-error.ts +348 -0
  54. package/templates/bare-fashion/tier5-src/himi-bare-fashion-account/index.ts +127 -0
  55. package/templates/bare-fashion/tier5-src/himi-bare-fashion-address-form/index.ts +367 -0
  56. package/templates/bare-fashion/tier5-src/himi-bare-fashion-addresses/index.ts +202 -0
  57. package/templates/bare-fashion/tier5-src/himi-bare-fashion-appearance/index.ts +73 -0
  58. package/templates/bare-fashion/tier5-src/himi-bare-fashion-cart/index.ts +540 -0
  59. package/templates/bare-fashion/tier5-src/himi-bare-fashion-collection/index.ts +111 -0
  60. package/templates/bare-fashion/tier5-src/himi-bare-fashion-home/index.ts +241 -0
  61. package/templates/bare-fashion/tier5-src/himi-bare-fashion-nav/index.ts +56 -0
  62. package/templates/bare-fashion/tier5-src/himi-bare-fashion-order/index.ts +437 -0
  63. package/templates/bare-fashion/tier5-src/himi-bare-fashion-product/index.ts +650 -0
  64. package/templates/bare-fashion/tier5-src/himi-bare-fashion-products/index.ts +142 -0
  65. package/templates/bare-fashion/tier5-src/himi-bare-fashion-saved/index.ts +45 -0
  66. package/templates/bare-fashion/tier5-src/himi-bare-fashion-search/index.ts +199 -0
  67. package/templates/bare-fashion/tier5-src/himi-bare-fashion-shop/index.ts +79 -0
  68. package/templates/bare-fashion/tier5-src/himi-bare-fashion-sign-in/index.ts +269 -0
  69. package/templates/bare-fashion/tier5-src/himi-bare-fashion-wallet/index.ts +224 -0
  70. package/templates/bare-fashion/tier5-src/himi-branded-lite-info/index.ts +209 -0
  71. package/templates/bare-fashion/tier5-src/himi-branded-lite-orders/index.ts +327 -0
  72. package/templates/bare-fashion/tier5-src/wix-spaces-collections/index.ts +48 -0
  73. package/templates/bare-fashion/tier5-src/wix-spaces-delete-account/index.ts +59 -0
  74. package/templates/bare-fashion/tier5-src/wix-spaces-view-profile/index.ts +119 -0
  75. package/templates/bare-fashion/tokens.json +348 -0
  76. package/templates/beauty-salon/dev/index.ts +223 -0
  77. package/templates/beauty-salon/l10n/ar.json +6 -0
  78. package/templates/beauty-salon/l10n/cs.json +6 -0
  79. package/templates/beauty-salon/l10n/da.json +6 -0
  80. package/templates/beauty-salon/l10n/de.json +6 -0
  81. package/templates/beauty-salon/l10n/el.json +6 -0
  82. package/templates/beauty-salon/l10n/en.json +9 -2
  83. package/templates/beauty-salon/l10n/es.json +6 -0
  84. package/templates/beauty-salon/l10n/fi.json +6 -0
  85. package/templates/beauty-salon/l10n/fr.json +6 -0
  86. package/templates/beauty-salon/l10n/he.json +5 -0
  87. package/templates/beauty-salon/l10n/hu.json +6 -0
  88. package/templates/beauty-salon/l10n/id.json +6 -0
  89. package/templates/beauty-salon/l10n/it.json +6 -0
  90. package/templates/beauty-salon/l10n/ja.json +6 -0
  91. package/templates/beauty-salon/l10n/ko.json +6 -0
  92. package/templates/beauty-salon/l10n/lt.json +6 -0
  93. package/templates/beauty-salon/l10n/nl.json +6 -0
  94. package/templates/beauty-salon/l10n/no.json +6 -0
  95. package/templates/beauty-salon/l10n/pl.json +6 -0
  96. package/templates/beauty-salon/l10n/pt.json +6 -0
  97. package/templates/beauty-salon/l10n/ru.json +6 -0
  98. package/templates/beauty-salon/l10n/sv.json +6 -0
  99. package/templates/beauty-salon/l10n/th.json +6 -0
  100. package/templates/beauty-salon/l10n/tr.json +6 -0
  101. package/templates/beauty-salon/l10n/uk.json +6 -0
  102. package/templates/beauty-salon/l10n/vi.json +6 -0
  103. package/templates/beauty-salon/l10n/zh.json +6 -0
  104. package/templates/beauty-salon/tier5-src/_shared/collection-query.ts +8 -0
  105. package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +7 -1
  106. package/templates/beauty-salon/tier5-src/_shared/lifecycle.ts +15 -0
  107. package/templates/beauty-salon/tier5-src/_shared/nav-member-avatar.ts +92 -0
  108. package/templates/beauty-salon/tier5-src/himi-branded-lite-nav/index.ts +15 -6
  109. package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +26 -1
  110. package/templates/beauty-salon-owner/tier5-src/_shared/collection-query.ts +8 -0
  111. package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +7 -1
  112. package/templates/branded-lite/dev/index.ts +2167 -0
  113. package/templates/branded-lite/l10n/ar.json +6 -0
  114. package/templates/branded-lite/l10n/cs.json +6 -0
  115. package/templates/branded-lite/l10n/da.json +6 -0
  116. package/templates/branded-lite/l10n/de.json +6 -0
  117. package/templates/branded-lite/l10n/el.json +6 -0
  118. package/templates/branded-lite/l10n/en.json +12 -5
  119. package/templates/branded-lite/l10n/es.json +6 -0
  120. package/templates/branded-lite/l10n/fi.json +6 -0
  121. package/templates/branded-lite/l10n/fr.json +6 -0
  122. package/templates/branded-lite/l10n/he.json +5 -0
  123. package/templates/branded-lite/l10n/hu.json +6 -0
  124. package/templates/branded-lite/l10n/id.json +6 -0
  125. package/templates/branded-lite/l10n/it.json +6 -0
  126. package/templates/branded-lite/l10n/ja.json +6 -0
  127. package/templates/branded-lite/l10n/ko.json +6 -0
  128. package/templates/branded-lite/l10n/lt.json +6 -0
  129. package/templates/branded-lite/l10n/nl.json +6 -0
  130. package/templates/branded-lite/l10n/no.json +6 -0
  131. package/templates/branded-lite/l10n/pl.json +6 -0
  132. package/templates/branded-lite/l10n/pt.json +6 -0
  133. package/templates/branded-lite/l10n/ru.json +6 -0
  134. package/templates/branded-lite/l10n/sv.json +6 -0
  135. package/templates/branded-lite/l10n/th.json +6 -0
  136. package/templates/branded-lite/l10n/tr.json +6 -0
  137. package/templates/branded-lite/l10n/uk.json +6 -0
  138. package/templates/branded-lite/l10n/vi.json +6 -0
  139. package/templates/branded-lite/l10n/zh.json +6 -0
  140. package/templates/branded-lite/recipes/upcoming-bookings.json +118 -6
  141. package/templates/branded-lite/tier5-src/_shared/access-gates.ts +0 -13
  142. package/templates/branded-lite/tier5-src/_shared/collection-query-legacy.ts +7 -0
  143. package/templates/branded-lite/tier5-src/_shared/collection-query.ts +7 -0
  144. package/templates/branded-lite/tier5-src/_shared/collection-service.ts +7 -1
  145. package/templates/branded-lite/tier5-src/_shared/events-inline-options.ts +55 -3
  146. package/templates/branded-lite/tier5-src/_shared/events-inline.ts +5 -3
  147. package/templates/branded-lite/tier5-src/_shared/guest-sign-in.ts +36 -0
  148. package/templates/branded-lite/tier5-src/_shared/lifecycle.ts +15 -0
  149. package/templates/branded-lite/tier5-src/_shared/nav-member-avatar.ts +92 -0
  150. package/templates/branded-lite/tier5-src/_shared/upcoming-bookings-section.ts +15 -4
  151. package/templates/branded-lite/tier5-src/himi-branded-lite-access-nav/index.ts +14 -9
  152. package/templates/branded-lite/tier5-src/himi-branded-lite-inbox/index.ts +6 -1
  153. package/templates/branded-lite/tier5-src/himi-branded-lite-nav/index.ts +15 -6
  154. package/templates/branded-lite/tier5-src/himi-branded-lite-notifications/index.ts +8 -1
  155. package/templates/branded-lite/tier5-src/himi-events-list/index.ts +17 -0
  156. package/templates/branded-lite/tier5-src/himi-store-account/index.ts +26 -1
  157. package/templates/brandy/tier5-src/_shared/collection-query-legacy.ts +7 -0
  158. package/templates/brandy/tier5-src/_shared/collection-query.ts +7 -0
  159. package/templates/brandy/tier5-src/_shared/collection-service.ts +7 -1
  160. package/templates/brandy/tier5-src/_shared/guest-sign-in.ts +36 -0
  161. package/templates/brandy/tier5-src/himi-branded-lite-inbox/index.ts +6 -1
  162. package/templates/brandy/tier5-src/himi-branded-lite-notifications/index.ts +8 -1
  163. package/templates/brandy/tier5-src/himi-store-account/index.ts +26 -1
  164. package/templates/community-club/dev/index.ts +223 -0
  165. package/templates/community-club/l10n/ar.json +6 -0
  166. package/templates/community-club/l10n/cs.json +6 -0
  167. package/templates/community-club/l10n/da.json +6 -0
  168. package/templates/community-club/l10n/de.json +6 -0
  169. package/templates/community-club/l10n/el.json +6 -0
  170. package/templates/community-club/l10n/en.json +9 -2
  171. package/templates/community-club/l10n/es.json +6 -0
  172. package/templates/community-club/l10n/fi.json +6 -0
  173. package/templates/community-club/l10n/fr.json +6 -0
  174. package/templates/community-club/l10n/he.json +5 -0
  175. package/templates/community-club/l10n/hu.json +6 -0
  176. package/templates/community-club/l10n/id.json +6 -0
  177. package/templates/community-club/l10n/it.json +6 -0
  178. package/templates/community-club/l10n/ja.json +6 -0
  179. package/templates/community-club/l10n/ko.json +6 -0
  180. package/templates/community-club/l10n/lt.json +6 -0
  181. package/templates/community-club/l10n/nl.json +6 -0
  182. package/templates/community-club/l10n/no.json +6 -0
  183. package/templates/community-club/l10n/pl.json +6 -0
  184. package/templates/community-club/l10n/pt.json +6 -0
  185. package/templates/community-club/l10n/ru.json +6 -0
  186. package/templates/community-club/l10n/sv.json +6 -0
  187. package/templates/community-club/l10n/th.json +6 -0
  188. package/templates/community-club/l10n/tr.json +6 -0
  189. package/templates/community-club/l10n/uk.json +6 -0
  190. package/templates/community-club/l10n/vi.json +6 -0
  191. package/templates/community-club/l10n/zh.json +6 -0
  192. package/templates/community-club/tier5-src/_shared/collection-query.ts +8 -0
  193. package/templates/community-club/tier5-src/_shared/collection-service.ts +7 -1
  194. package/templates/community-club/tier5-src/_shared/events-inline-options.ts +77 -0
  195. package/templates/community-club/tier5-src/himi-events-list/index.ts +17 -0
  196. package/templates/community-club/tier5-src/himi-store-account/index.ts +26 -1
  197. package/templates/community-club-owner/tier5-src/_shared/collection-query.ts +8 -0
  198. package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +7 -1
  199. package/templates/conference/tier5-src/_shared/collection-query.ts +8 -0
  200. package/templates/conference/tier5-src/_shared/collection-service.ts +7 -1
  201. package/templates/conference/tier5-src/_shared/events-inline-options.ts +77 -0
  202. package/templates/conference/tier5-src/himi-events-list/index.ts +17 -0
  203. package/templates/conference/tier5-src/himi-store-account/index.ts +26 -1
  204. package/templates/events-meetups/dev/index.ts +142 -0
  205. package/templates/events-meetups/l10n/ar.json +6 -0
  206. package/templates/events-meetups/l10n/cs.json +6 -0
  207. package/templates/events-meetups/l10n/da.json +6 -0
  208. package/templates/events-meetups/l10n/de.json +6 -0
  209. package/templates/events-meetups/l10n/el.json +6 -0
  210. package/templates/events-meetups/l10n/en.json +8 -1
  211. package/templates/events-meetups/l10n/es.json +6 -0
  212. package/templates/events-meetups/l10n/fi.json +6 -0
  213. package/templates/events-meetups/l10n/fr.json +6 -0
  214. package/templates/events-meetups/l10n/he.json +5 -0
  215. package/templates/events-meetups/l10n/hu.json +6 -0
  216. package/templates/events-meetups/l10n/id.json +6 -0
  217. package/templates/events-meetups/l10n/it.json +6 -0
  218. package/templates/events-meetups/l10n/ja.json +6 -0
  219. package/templates/events-meetups/l10n/ko.json +6 -0
  220. package/templates/events-meetups/l10n/lt.json +6 -0
  221. package/templates/events-meetups/l10n/nl.json +6 -0
  222. package/templates/events-meetups/l10n/no.json +6 -0
  223. package/templates/events-meetups/l10n/pl.json +6 -0
  224. package/templates/events-meetups/l10n/pt.json +6 -0
  225. package/templates/events-meetups/l10n/ru.json +6 -0
  226. package/templates/events-meetups/l10n/sv.json +6 -0
  227. package/templates/events-meetups/l10n/th.json +6 -0
  228. package/templates/events-meetups/l10n/tr.json +6 -0
  229. package/templates/events-meetups/l10n/uk.json +6 -0
  230. package/templates/events-meetups/l10n/vi.json +6 -0
  231. package/templates/events-meetups/l10n/zh.json +6 -0
  232. package/templates/events-meetups/tier5-src/_shared/collection-query.ts +8 -0
  233. package/templates/events-meetups/tier5-src/_shared/collection-service.ts +7 -1
  234. package/templates/events-meetups/tier5-src/_shared/events-inline-options.ts +77 -0
  235. package/templates/events-meetups/tier5-src/himi-events-list/index.ts +17 -0
  236. package/templates/events-meetups/tier5-src/himi-store-account/index.ts +26 -1
  237. package/templates/events-meetups-owner/tier5-src/_shared/collection-query.ts +8 -0
  238. package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +7 -1
  239. package/templates/fitness-gym/tier5-src/_shared/collection-query.ts +8 -0
  240. package/templates/fitness-gym/tier5-src/_shared/collection-service.ts +7 -1
  241. package/templates/fitness-gym/tier5-src/_shared/guest-sign-in.ts +36 -0
  242. package/templates/fitness-gym/tier5-src/himi-branded-lite-notifications/index.ts +8 -1
  243. package/templates/fitness-gym/tier5-src/himi-store-account/index.ts +26 -1
  244. package/templates/gym-fitness/dev/index.ts +385 -0
  245. package/templates/gym-fitness/l10n/ar.json +6 -0
  246. package/templates/gym-fitness/l10n/cs.json +6 -0
  247. package/templates/gym-fitness/l10n/da.json +6 -0
  248. package/templates/gym-fitness/l10n/de.json +6 -0
  249. package/templates/gym-fitness/l10n/el.json +6 -0
  250. package/templates/gym-fitness/l10n/en.json +9 -2
  251. package/templates/gym-fitness/l10n/es.json +6 -0
  252. package/templates/gym-fitness/l10n/fi.json +6 -0
  253. package/templates/gym-fitness/l10n/fr.json +6 -0
  254. package/templates/gym-fitness/l10n/he.json +5 -0
  255. package/templates/gym-fitness/l10n/hu.json +6 -0
  256. package/templates/gym-fitness/l10n/id.json +6 -0
  257. package/templates/gym-fitness/l10n/it.json +6 -0
  258. package/templates/gym-fitness/l10n/ja.json +6 -0
  259. package/templates/gym-fitness/l10n/ko.json +6 -0
  260. package/templates/gym-fitness/l10n/lt.json +6 -0
  261. package/templates/gym-fitness/l10n/nl.json +6 -0
  262. package/templates/gym-fitness/l10n/no.json +6 -0
  263. package/templates/gym-fitness/l10n/pl.json +6 -0
  264. package/templates/gym-fitness/l10n/pt.json +6 -0
  265. package/templates/gym-fitness/l10n/ru.json +6 -0
  266. package/templates/gym-fitness/l10n/sv.json +6 -0
  267. package/templates/gym-fitness/l10n/th.json +6 -0
  268. package/templates/gym-fitness/l10n/tr.json +6 -0
  269. package/templates/gym-fitness/l10n/uk.json +6 -0
  270. package/templates/gym-fitness/l10n/vi.json +6 -0
  271. package/templates/gym-fitness/l10n/zh.json +6 -0
  272. package/templates/gym-fitness/tier5-src/_shared/collection-query.ts +8 -0
  273. package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +7 -1
  274. package/templates/gym-fitness/tier5-src/_shared/events-inline-options.ts +77 -0
  275. package/templates/gym-fitness/tier5-src/_shared/lifecycle.ts +15 -0
  276. package/templates/gym-fitness/tier5-src/_shared/nav-member-avatar.ts +92 -0
  277. package/templates/gym-fitness/tier5-src/himi-branded-lite-nav/index.ts +15 -6
  278. package/templates/gym-fitness/tier5-src/himi-events-list/index.ts +17 -0
  279. package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +26 -1
  280. package/templates/gym-fitness-owner/tier5-src/_shared/collection-query.ts +8 -0
  281. package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +7 -1
  282. package/templates/medical-services/tier5-src/_shared/collection-query.ts +8 -0
  283. package/templates/medical-services/tier5-src/_shared/collection-service.ts +7 -1
  284. package/templates/medical-services/tier5-src/_shared/guest-sign-in.ts +36 -0
  285. package/templates/medical-services/tier5-src/himi-branded-lite-notifications/index.ts +8 -1
  286. package/templates/medical-services/tier5-src/himi-store-account/index.ts +26 -1
  287. package/templates/nonprofit-cause/dev/index.ts +223 -0
  288. package/templates/nonprofit-cause/l10n/ar.json +6 -0
  289. package/templates/nonprofit-cause/l10n/cs.json +6 -0
  290. package/templates/nonprofit-cause/l10n/da.json +6 -0
  291. package/templates/nonprofit-cause/l10n/de.json +6 -0
  292. package/templates/nonprofit-cause/l10n/el.json +6 -0
  293. package/templates/nonprofit-cause/l10n/en.json +8 -1
  294. package/templates/nonprofit-cause/l10n/es.json +6 -0
  295. package/templates/nonprofit-cause/l10n/fi.json +6 -0
  296. package/templates/nonprofit-cause/l10n/fr.json +6 -0
  297. package/templates/nonprofit-cause/l10n/he.json +5 -0
  298. package/templates/nonprofit-cause/l10n/hu.json +6 -0
  299. package/templates/nonprofit-cause/l10n/id.json +6 -0
  300. package/templates/nonprofit-cause/l10n/it.json +6 -0
  301. package/templates/nonprofit-cause/l10n/ja.json +6 -0
  302. package/templates/nonprofit-cause/l10n/ko.json +6 -0
  303. package/templates/nonprofit-cause/l10n/lt.json +6 -0
  304. package/templates/nonprofit-cause/l10n/nl.json +6 -0
  305. package/templates/nonprofit-cause/l10n/no.json +6 -0
  306. package/templates/nonprofit-cause/l10n/pl.json +6 -0
  307. package/templates/nonprofit-cause/l10n/pt.json +6 -0
  308. package/templates/nonprofit-cause/l10n/ru.json +6 -0
  309. package/templates/nonprofit-cause/l10n/sv.json +6 -0
  310. package/templates/nonprofit-cause/l10n/th.json +6 -0
  311. package/templates/nonprofit-cause/l10n/tr.json +6 -0
  312. package/templates/nonprofit-cause/l10n/uk.json +6 -0
  313. package/templates/nonprofit-cause/l10n/vi.json +6 -0
  314. package/templates/nonprofit-cause/l10n/zh.json +6 -0
  315. package/templates/nonprofit-cause/tier5-src/_shared/collection-query.ts +8 -0
  316. package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +7 -1
  317. package/templates/nonprofit-cause/tier5-src/_shared/events-inline-options.ts +77 -0
  318. package/templates/nonprofit-cause/tier5-src/himi-events-list/index.ts +17 -0
  319. package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +26 -1
  320. package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-query.ts +8 -0
  321. package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +7 -1
  322. package/templates/owner-lite/tier5-src/_shared/collection-query.ts +8 -0
  323. package/templates/owner-lite/tier5-src/_shared/collection-service.ts +7 -1
  324. package/templates/personal-fitness-trainer/tier5-src/_shared/collection-query.ts +8 -0
  325. package/templates/personal-fitness-trainer/tier5-src/_shared/collection-service.ts +7 -1
  326. package/templates/personal-fitness-trainer/tier5-src/himi-store-account/index.ts +26 -1
  327. package/templates/podcast-creator/dev/index.ts +223 -0
  328. package/templates/podcast-creator/l10n/ar.json +6 -0
  329. package/templates/podcast-creator/l10n/cs.json +6 -0
  330. package/templates/podcast-creator/l10n/da.json +6 -0
  331. package/templates/podcast-creator/l10n/de.json +6 -0
  332. package/templates/podcast-creator/l10n/el.json +6 -0
  333. package/templates/podcast-creator/l10n/en.json +8 -1
  334. package/templates/podcast-creator/l10n/es.json +6 -0
  335. package/templates/podcast-creator/l10n/fi.json +6 -0
  336. package/templates/podcast-creator/l10n/fr.json +6 -0
  337. package/templates/podcast-creator/l10n/he.json +5 -0
  338. package/templates/podcast-creator/l10n/hu.json +6 -0
  339. package/templates/podcast-creator/l10n/id.json +6 -0
  340. package/templates/podcast-creator/l10n/it.json +6 -0
  341. package/templates/podcast-creator/l10n/ja.json +6 -0
  342. package/templates/podcast-creator/l10n/ko.json +6 -0
  343. package/templates/podcast-creator/l10n/lt.json +6 -0
  344. package/templates/podcast-creator/l10n/nl.json +6 -0
  345. package/templates/podcast-creator/l10n/no.json +6 -0
  346. package/templates/podcast-creator/l10n/pl.json +6 -0
  347. package/templates/podcast-creator/l10n/pt.json +6 -0
  348. package/templates/podcast-creator/l10n/ru.json +6 -0
  349. package/templates/podcast-creator/l10n/sv.json +6 -0
  350. package/templates/podcast-creator/l10n/th.json +6 -0
  351. package/templates/podcast-creator/l10n/tr.json +6 -0
  352. package/templates/podcast-creator/l10n/uk.json +6 -0
  353. package/templates/podcast-creator/l10n/vi.json +6 -0
  354. package/templates/podcast-creator/l10n/zh.json +6 -0
  355. package/templates/podcast-creator/tier5-src/_shared/collection-query.ts +8 -0
  356. package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +7 -1
  357. package/templates/podcast-creator/tier5-src/_shared/events-inline-options.ts +77 -0
  358. package/templates/podcast-creator/tier5-src/himi-events-list/index.ts +17 -0
  359. package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +26 -1
  360. package/templates/podcast-creator-owner/tier5-src/_shared/collection-query.ts +8 -0
  361. package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +7 -1
  362. package/templates/portfolio-creative/dev/index.ts +142 -0
  363. package/templates/portfolio-creative/l10n/ar.json +6 -0
  364. package/templates/portfolio-creative/l10n/cs.json +6 -0
  365. package/templates/portfolio-creative/l10n/da.json +6 -0
  366. package/templates/portfolio-creative/l10n/de.json +6 -0
  367. package/templates/portfolio-creative/l10n/el.json +6 -0
  368. package/templates/portfolio-creative/l10n/en.json +8 -1
  369. package/templates/portfolio-creative/l10n/es.json +6 -0
  370. package/templates/portfolio-creative/l10n/fi.json +6 -0
  371. package/templates/portfolio-creative/l10n/fr.json +6 -0
  372. package/templates/portfolio-creative/l10n/he.json +5 -0
  373. package/templates/portfolio-creative/l10n/hu.json +6 -0
  374. package/templates/portfolio-creative/l10n/id.json +6 -0
  375. package/templates/portfolio-creative/l10n/it.json +6 -0
  376. package/templates/portfolio-creative/l10n/ja.json +6 -0
  377. package/templates/portfolio-creative/l10n/ko.json +6 -0
  378. package/templates/portfolio-creative/l10n/lt.json +6 -0
  379. package/templates/portfolio-creative/l10n/nl.json +6 -0
  380. package/templates/portfolio-creative/l10n/no.json +6 -0
  381. package/templates/portfolio-creative/l10n/pl.json +6 -0
  382. package/templates/portfolio-creative/l10n/pt.json +6 -0
  383. package/templates/portfolio-creative/l10n/ru.json +6 -0
  384. package/templates/portfolio-creative/l10n/sv.json +6 -0
  385. package/templates/portfolio-creative/l10n/th.json +6 -0
  386. package/templates/portfolio-creative/l10n/tr.json +6 -0
  387. package/templates/portfolio-creative/l10n/uk.json +6 -0
  388. package/templates/portfolio-creative/l10n/vi.json +6 -0
  389. package/templates/portfolio-creative/l10n/zh.json +6 -0
  390. package/templates/portfolio-creative/tier5-src/_shared/collection-query.ts +8 -0
  391. package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +7 -1
  392. package/templates/portfolio-creative/tier5-src/_shared/events-inline-options.ts +77 -0
  393. package/templates/portfolio-creative/tier5-src/himi-events-list/index.ts +17 -0
  394. package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +26 -1
  395. package/templates/portfolio-creative-owner/tier5-src/_shared/collection-query.ts +8 -0
  396. package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +7 -1
  397. package/templates/restaurant/dev/index.ts +142 -0
  398. package/templates/restaurant/l10n/ar.json +6 -0
  399. package/templates/restaurant/l10n/cs.json +6 -0
  400. package/templates/restaurant/l10n/da.json +6 -0
  401. package/templates/restaurant/l10n/de.json +6 -0
  402. package/templates/restaurant/l10n/el.json +6 -0
  403. package/templates/restaurant/l10n/en.json +9 -2
  404. package/templates/restaurant/l10n/es.json +6 -0
  405. package/templates/restaurant/l10n/fi.json +6 -0
  406. package/templates/restaurant/l10n/fr.json +6 -0
  407. package/templates/restaurant/l10n/he.json +5 -0
  408. package/templates/restaurant/l10n/hu.json +6 -0
  409. package/templates/restaurant/l10n/id.json +6 -0
  410. package/templates/restaurant/l10n/it.json +6 -0
  411. package/templates/restaurant/l10n/ja.json +6 -0
  412. package/templates/restaurant/l10n/ko.json +6 -0
  413. package/templates/restaurant/l10n/lt.json +6 -0
  414. package/templates/restaurant/l10n/nl.json +6 -0
  415. package/templates/restaurant/l10n/no.json +6 -0
  416. package/templates/restaurant/l10n/pl.json +6 -0
  417. package/templates/restaurant/l10n/pt.json +6 -0
  418. package/templates/restaurant/l10n/ru.json +6 -0
  419. package/templates/restaurant/l10n/sv.json +6 -0
  420. package/templates/restaurant/l10n/th.json +6 -0
  421. package/templates/restaurant/l10n/tr.json +6 -0
  422. package/templates/restaurant/l10n/uk.json +6 -0
  423. package/templates/restaurant/l10n/vi.json +6 -0
  424. package/templates/restaurant/l10n/zh.json +6 -0
  425. package/templates/restaurant/tier5-src/_shared/collection-query.ts +8 -0
  426. package/templates/restaurant/tier5-src/_shared/collection-service.ts +7 -1
  427. package/templates/restaurant/tier5-src/_shared/events-inline-options.ts +77 -0
  428. package/templates/restaurant/tier5-src/himi-events-list/index.ts +17 -0
  429. package/templates/restaurant/tier5-src/himi-store-account/index.ts +26 -1
  430. package/templates/restaurant-owner/tier5-src/_shared/collection-query.ts +8 -0
  431. package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +7 -1
  432. package/templates/retail-store/dev/index.ts +142 -0
  433. package/templates/retail-store/l10n/ar.json +6 -0
  434. package/templates/retail-store/l10n/cs.json +6 -0
  435. package/templates/retail-store/l10n/da.json +6 -0
  436. package/templates/retail-store/l10n/de.json +6 -0
  437. package/templates/retail-store/l10n/el.json +6 -0
  438. package/templates/retail-store/l10n/en.json +8 -1
  439. package/templates/retail-store/l10n/es.json +6 -0
  440. package/templates/retail-store/l10n/fi.json +6 -0
  441. package/templates/retail-store/l10n/fr.json +6 -0
  442. package/templates/retail-store/l10n/he.json +5 -0
  443. package/templates/retail-store/l10n/hu.json +6 -0
  444. package/templates/retail-store/l10n/id.json +6 -0
  445. package/templates/retail-store/l10n/it.json +6 -0
  446. package/templates/retail-store/l10n/ja.json +6 -0
  447. package/templates/retail-store/l10n/ko.json +6 -0
  448. package/templates/retail-store/l10n/lt.json +6 -0
  449. package/templates/retail-store/l10n/nl.json +6 -0
  450. package/templates/retail-store/l10n/no.json +6 -0
  451. package/templates/retail-store/l10n/pl.json +6 -0
  452. package/templates/retail-store/l10n/pt.json +6 -0
  453. package/templates/retail-store/l10n/ru.json +6 -0
  454. package/templates/retail-store/l10n/sv.json +6 -0
  455. package/templates/retail-store/l10n/th.json +6 -0
  456. package/templates/retail-store/l10n/tr.json +6 -0
  457. package/templates/retail-store/l10n/uk.json +6 -0
  458. package/templates/retail-store/l10n/vi.json +6 -0
  459. package/templates/retail-store/l10n/zh.json +6 -0
  460. package/templates/retail-store/tier5-src/_shared/collection-query-legacy.ts +7 -0
  461. package/templates/retail-store/tier5-src/_shared/collection-query.ts +7 -0
  462. package/templates/retail-store/tier5-src/_shared/collection-service.ts +7 -1
  463. package/templates/retail-store/tier5-src/himi-store-account/index.ts +26 -1
  464. package/templates/retail-store-owner/tier5-src/_shared/collection-query.ts +8 -0
  465. package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +7 -1
  466. package/templates/salon-spa/tier5-src/_shared/collection-query.ts +8 -0
  467. package/templates/salon-spa/tier5-src/_shared/collection-service.ts +7 -1
  468. package/templates/salon-spa/tier5-src/himi-store-account/index.ts +26 -1
  469. package/templates/wholesale-store/tier5-src/_shared/collection-query-legacy.ts +7 -0
  470. package/templates/wholesale-store/tier5-src/_shared/collection-query.ts +7 -0
  471. package/templates/wholesale-store/tier5-src/_shared/collection-service.ts +7 -1
  472. package/templates/wholesale-store/tier5-src/himi-store-account/index.ts +26 -1
  473. package/templates/yoga-studio/dev/index.ts +304 -0
  474. package/templates/yoga-studio/l10n/ar.json +6 -0
  475. package/templates/yoga-studio/l10n/cs.json +6 -0
  476. package/templates/yoga-studio/l10n/da.json +6 -0
  477. package/templates/yoga-studio/l10n/de.json +6 -0
  478. package/templates/yoga-studio/l10n/el.json +6 -0
  479. package/templates/yoga-studio/l10n/en.json +10 -3
  480. package/templates/yoga-studio/l10n/es.json +6 -0
  481. package/templates/yoga-studio/l10n/fi.json +6 -0
  482. package/templates/yoga-studio/l10n/fr.json +6 -0
  483. package/templates/yoga-studio/l10n/he.json +5 -0
  484. package/templates/yoga-studio/l10n/hu.json +6 -0
  485. package/templates/yoga-studio/l10n/id.json +6 -0
  486. package/templates/yoga-studio/l10n/it.json +6 -0
  487. package/templates/yoga-studio/l10n/ja.json +6 -0
  488. package/templates/yoga-studio/l10n/ko.json +6 -0
  489. package/templates/yoga-studio/l10n/lt.json +6 -0
  490. package/templates/yoga-studio/l10n/nl.json +6 -0
  491. package/templates/yoga-studio/l10n/no.json +6 -0
  492. package/templates/yoga-studio/l10n/pl.json +6 -0
  493. package/templates/yoga-studio/l10n/pt.json +6 -0
  494. package/templates/yoga-studio/l10n/ru.json +6 -0
  495. package/templates/yoga-studio/l10n/sv.json +6 -0
  496. package/templates/yoga-studio/l10n/th.json +6 -0
  497. package/templates/yoga-studio/l10n/tr.json +6 -0
  498. package/templates/yoga-studio/l10n/uk.json +6 -0
  499. package/templates/yoga-studio/l10n/vi.json +6 -0
  500. package/templates/yoga-studio/l10n/zh.json +6 -0
  501. package/templates/yoga-studio/tier5-src/_shared/collection-query.ts +8 -0
  502. package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +7 -1
  503. package/templates/yoga-studio/tier5-src/_shared/events-inline-options.ts +77 -0
  504. package/templates/yoga-studio/tier5-src/_shared/lifecycle.ts +15 -0
  505. package/templates/yoga-studio/tier5-src/_shared/nav-member-avatar.ts +92 -0
  506. package/templates/yoga-studio/tier5-src/himi-branded-lite-nav/index.ts +15 -6
  507. package/templates/yoga-studio/tier5-src/himi-events-list/index.ts +17 -0
  508. package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +26 -1
  509. package/templates/yoga-studio-owner/tier5-src/_shared/collection-query.ts +8 -0
  510. package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +7 -1
@@ -8,6 +8,10 @@ export interface CollectionQuery {
8
8
  filter: string;
9
9
  sort: 'default' | 'az' | 'za';
10
10
  savedIds: string[];
11
+ /** What the list is limited to beyond the controls above (a domain's own selection, e.g. the events of some categories), as one
12
+ * canonical string. Part of the criteria, so a list opened on another selection never shows or restores this one's rows. Absent
13
+ * when there is none: criteria without it keep the key they always had. */
14
+ scope?: string;
11
15
  }
12
16
  export interface CollectionPage<Row> {
13
17
  items: Row[];
@@ -52,11 +56,14 @@ export interface CollectionReadOptions {
52
56
  cache: 'only-if-cached' | 'reload';
53
57
  onCacheResult(metadata: ReadMetadata): void;
54
58
  }
59
+ /** A scope is read back by its domain, so it is never cut: this exceeds the largest selection the events list encodes (100 ids of 64 characters, about 6.9k). */
60
+ const SCOPE_MAX = 8192;
55
61
  const normalize = (q: Partial<CollectionQuery>): CollectionQuery => ({
56
62
  query: typeof q.query === 'string' ? q.query.trim().slice(0, 256) : '',
57
63
  filter: typeof q.filter === 'string' ? q.filter.slice(0, 256) : 'all',
58
64
  sort: q.sort === 'az' || q.sort === 'za' ? q.sort : 'default',
59
65
  savedIds: Array.isArray(q.savedIds) ? [...new Set(q.savedIds.filter(id => typeof id === 'string' && id.length > 0 && id.length <= 256))].slice(0, 500) : [],
66
+ ...(typeof q.scope === 'string' && q.scope ? { scope: q.scope.slice(0, SCOPE_MAX) } : {}),
60
67
  });
61
68
  const copyQuery = (q: CollectionQuery): CollectionQuery => ({ ...q, savedIds: [...q.savedIds] });
62
69
 
@@ -19,6 +19,8 @@ interface BackendCollection {
19
19
  /** Sees the load action's argument (the screen's onAppear params) BEFORE the query runs. A returned
20
20
  * `{ filter, sort }` resets the criteria for that load (a screen that always opens on one view). */
21
21
  onLoad?(arg: unknown): CollectionCriteriaReset | void;
22
+ /** The collection's own selection as part of every query's criteria (see `CollectionQuery.scope`); "" for none. */
23
+ scope?(): string;
22
24
  controller: ReturnType<typeof createCollectionQuery<CollectionRow>>;
23
25
  apply(state: State, page: CollectionQueryState<CollectionRow>): State;
24
26
  }
@@ -288,7 +290,7 @@ export function decorateCollection(name: string, def: { state: State; actions?:
288
290
  // A screen with no search field clears a query an older screen persisted, or it narrows every view for good.
289
291
  if (typeof input.query === 'string') prefs.query = input.query.slice(0, 256);
290
292
  };
291
- const criteria = () => ({ query: prefs.query, sort: prefs.sort, filter: prefs.filter, savedIds: prefs.filter === 'saved' ? prefs.savedIds : [] });
293
+ const criteria = () => ({ query: prefs.query, sort: prefs.sort, filter: prefs.filter, savedIds: prefs.filter === 'saved' ? prefs.savedIds : [], ...(backend?.scope ? { scope: backend.scope() } : {}) });
292
294
  const criteriaKey = () => JSON.stringify(criteria());
293
295
  actions.collectionDismissFilters = change(() => { filtersPresented = false; });
294
296
  actions.collectionFilters = change(() => { filtersPresented = !filtersPresented; });
@@ -378,6 +380,9 @@ export function defineBackendCollection<S extends object, Row extends object>(na
378
380
  /** The load action's argument (onAppear params beyond `copy`), before the query runs — for a
379
381
  * domain setting that rides the descriptor, e.g. My Bookings' `weeklyGoal`. */
380
382
  onLoad?(arg: unknown): CollectionCriteriaReset | void;
383
+ /** A selection the list is limited to, as one canonical string ("" for none): it joins the criteria, so another selection is another
384
+ * result set (no stale rows behind a revalidation, no restore of another selection's pages) and `source` reads it off `criteria.scope`. */
385
+ scope?(): string;
381
386
  state: S;
382
387
  source: CollectionQuerySource<Row>;
383
388
  apply(state: S, page: CollectionQueryState<Row>): S;
@@ -397,6 +402,7 @@ export function defineBackendCollection<S extends object, Row extends object>(na
397
402
  restorePagesOnLoad: options.restorePagesOnLoad,
398
403
  readLifecycle: options.readLifecycle,
399
404
  onLoad: avatar ? arg => { avatar.onLoad(arg); return options.onLoad?.(arg); } : options.onLoad,
405
+ scope: options.scope,
400
406
  controller: controller as unknown as BackendCollection['controller'],
401
407
  apply: (state, page) => {
402
408
  const applied = { ...options.apply(state as S, page as unknown as CollectionQueryState<Row>), ...(options.readLifecycle ? { readStatus: page.read } : {}) } as State;
@@ -3,10 +3,19 @@
3
3
  export interface EventsInlineOptions {
4
4
  /** How many events the section shows. Clamped to 1..10; default 3. */
5
5
  limit?: number;
6
+ /** Show only events in these categories (Wix event category ids). Empty or absent: every category. */
7
+ categoryIds?: readonly string[];
8
+ /** Show only these events (Wix event ids). Empty or absent: every event. */
9
+ eventIds?: readonly string[];
6
10
  }
7
11
 
12
+ /** The events a list is limited to: both lists empty is no limit. */
13
+ export interface EventsSelection { categoryIds: string[]; eventIds: string[] }
14
+
8
15
  export const EVENTS_INLINE_DEFAULT_LIMIT = 3;
9
16
  export const EVENTS_INLINE_MAX_LIMIT = 10;
17
+ /** More ids than this are dropped: a selection is a handful of categories or events, and each id rides the query. */
18
+ export const EVENTS_SELECTION_MAX_IDS = 50;
10
19
 
11
20
  /** A bad or missing limit is the default, never an error: the value arrives from a generated recipe. */
12
21
  export function eventsInlineLimit(value: unknown): number {
@@ -15,11 +24,54 @@ export function eventsInlineLimit(value: unknown): number {
15
24
  return Math.min(EVENTS_INLINE_MAX_LIMIT, Math.max(1, Math.trunc(n)));
16
25
  }
17
26
 
18
- /** Events that have not finished: not started yet, or still running (a festival on its second day is still on). */
19
- export function upcomingFilter(nowIso: string): Record<string, unknown> {
27
+ /** Wix ids are UUIDs; anything else (a route value is user-controllable text) never becomes part of a query. */
28
+ const ID = /^[A-Za-z0-9_-]{1,64}$/;
29
+
30
+ /** The ids in a list, or in a comma-separated string (how a `himi.open` link carries them): valid, distinct, at most 50. */
31
+ export function eventsSelectionIds(value: unknown): string[] {
32
+ const parts = Array.isArray(value) ? value : typeof value === "string" ? value.split(",") : [];
33
+ const ids = parts.flatMap((part) => (typeof part === "string" && ID.test(part.trim()) ? [part.trim()] : []));
34
+ return [...new Set(ids)].slice(0, EVENTS_SELECTION_MAX_IDS);
35
+ }
36
+
37
+ export function eventsSelectionOf(source: { categoryIds?: unknown; eventIds?: unknown } | undefined): EventsSelection {
38
+ return { categoryIds: eventsSelectionIds(source?.categoryIds), eventIds: eventsSelectionIds(source?.eventIds) };
39
+ }
40
+
41
+ /** A selection as the canonical string a collection carries in its criteria (`CollectionQuery.scope`): "" for none, so no scope is set. */
42
+ export function eventsSelectionScope(selection: EventsSelection): string {
43
+ return hasEventsSelection(selection) ? JSON.stringify({ categoryIds: selection.categoryIds, eventIds: selection.eventIds }) : "";
44
+ }
45
+
46
+ /** The selection a scope string names (every id is checked again: a scope is data that crossed a cache). Anything unreadable is none. */
47
+ export function eventsSelectionFromScope(scope: unknown): EventsSelection {
48
+ if (typeof scope !== "string" || !scope) return { categoryIds: [], eventIds: [] };
49
+ try { return eventsSelectionOf(JSON.parse(scope) as { categoryIds?: unknown; eventIds?: unknown }); } catch { return { categoryIds: [], eventIds: [] }; }
50
+ }
51
+
52
+ /** Whether a selection limits anything. */
53
+ export function hasEventsSelection(selection: EventsSelection): boolean {
54
+ return selection.categoryIds.length > 0 || selection.eventIds.length > 0;
55
+ }
56
+
57
+ /**
58
+ * The query filter of a selection: events in any of the categories (`categories.id $hasSome`, which a visitor may query) and events
59
+ * among the chosen ones (`id $in`). A selection naming both narrows by both. `limitIds` further narrows the chosen events, for
60
+ * a list that also shows only the visitor's saved events: an id both lists agree on, so a saved event outside the selection stays out.
61
+ */
62
+ export function eventsSelectionFilter(selection: EventsSelection, limitIds?: readonly string[]): Record<string, unknown> {
63
+ const ids = limitIds && selection.eventIds.length ? selection.eventIds.filter((id) => limitIds.includes(id)) : limitIds ? [...limitIds] : selection.eventIds;
64
+ return {
65
+ ...(selection.categoryIds.length ? { "categories.id": { $hasSome: selection.categoryIds } } : {}),
66
+ ...(limitIds || selection.eventIds.length ? { id: { $in: ids } } : {}),
67
+ };
68
+ }
69
+
70
+ /** Events that have not finished: not started yet, or still running (a festival on its second day is still on). Narrowed to a selection when given one. */
71
+ export function upcomingFilter(nowIso: string, selection?: EventsSelection): Record<string, unknown> {
20
72
  return {
21
73
  status: { $ne: "DRAFT" },
22
74
  $or: [{ "dateAndTimeSettings.startDate": { $gte: nowIso } }, { "dateAndTimeSettings.endDate": { $gte: nowIso } }],
75
+ ...(selection ? eventsSelectionFilter(selection) : {}),
23
76
  };
24
77
  }
25
-
@@ -11,9 +11,9 @@ import { share as shareSheet } from "@himalaya/share";
11
11
  import { normalizeEvent } from "./himi-events";
12
12
  import { copyParam, stashCopy } from "./himi-copy.js";
13
13
  import { withDateBadge, withRegistration, type ListEventRow } from "./events-card.js";
14
- import { eventsInlineLimit, upcomingFilter, type EventsInlineOptions } from "./events-inline-options.js";
14
+ import { eventsInlineLimit, eventsSelectionOf, upcomingFilter, type EventsInlineOptions } from "./events-inline-options.js";
15
15
 
16
- export { EVENTS_INLINE_DEFAULT_LIMIT, EVENTS_INLINE_MAX_LIMIT, eventsInlineLimit, upcomingFilter, type EventsInlineOptions } from "./events-inline-options.js";
16
+ export { EVENTS_INLINE_DEFAULT_LIMIT, EVENTS_INLINE_MAX_LIMIT, eventsInlineLimit, eventsSelectionOf, upcomingFilter, type EventsInlineOptions } from "./events-inline-options.js";
17
17
 
18
18
  export interface EventsInlineState {
19
19
  status: "loading" | "ready" | "error";
@@ -42,6 +42,8 @@ function derive(state: Omit<EventsInlineState, "isLoading" | "notLoading" | "isE
42
42
 
43
43
  export function registerEventsInline(serviceName: string, options: EventsInlineOptions = {}) {
44
44
  const limit = eventsInlineLimit(options.limit);
45
+ // A section limited to categories or to chosen events (the source's own selection) reads only those, and counts only those for See all.
46
+ const selection = eventsSelectionOf(options);
45
47
  const initial = derive({ status: "loading", rows: [], hasMore: false, emptyText: "", emptyBody: "" });
46
48
  return defineService<EventsInlineState, {
47
49
  load: (state: EventsInlineState, arg?: unknown) => Promise<EventsInlineState>;
@@ -54,7 +56,7 @@ export function registerEventsInline(serviceName: string, options: EventsInlineO
54
56
  try {
55
57
  const res = await queryEvents({
56
58
  limit, offset: 0, fields: ["DETAILS", "REGISTRATION", "URLS"],
57
- query: { filter: upcomingFilter(new Date().toISOString()),
59
+ query: { filter: upcomingFilter(new Date().toISOString(), selection),
58
60
  sort: [{ fieldName: "dateAndTimeSettings.startDate", order: "ASC" }, { fieldName: "id", order: "ASC" }] },
59
61
  });
60
62
  const raw: WixEvent[] = (res.events ?? []).filter((event) => !!event.id);
@@ -0,0 +1,36 @@
1
+ // A member-only screen that a guest opens offers the app's sign-in at once, as the sheet the app's other
2
+ // screens use (`signInPresentation`, and `signInSheetStyle: "page"` where the app asks for it). Opt-in: the
3
+ // screen's load params must name `signInScreenId`, so an app that passes none keeps the screen's own Sign in state.
4
+ //
5
+ // The sheet is a modal with no return path: closing it, signed in or not, leaves the guest on this screen, which
6
+ // loads again and shows the member's content, or its Sign in state when the sheet was only closed. One offer per
7
+ // guest: a reload that follows a dismissed sheet does not open a second one, and a member's visit resets it.
8
+ import { dispatch } from "@himalaya/dispatch";
9
+ import { signInPageStyle, signInSheetStyle } from "./sign-in-sheet.js";
10
+
11
+ const field = (arg: unknown, key: string): string => {
12
+ const value = (arg as Record<string, unknown> | null | undefined)?.[key];
13
+ return typeof value === "string" ? value.trim() : "";
14
+ };
15
+
16
+ export interface GuestSignIn {
17
+ /** The screen loaded for a guest: open the sign-in sheet, once. */
18
+ offer(arg: unknown): void;
19
+ /** The screen loaded for a member: the next guest is offered the sheet again. */
20
+ member(): void;
21
+ }
22
+
23
+ export function guestSignIn(): GuestSignIn {
24
+ let offered = false;
25
+ return {
26
+ offer(arg) {
27
+ const screenId = field(arg, "signInScreenId");
28
+ const presentation = field(arg, "signInPresentation");
29
+ if (!screenId || offered || (presentation !== "sheet" && presentation !== "full_screen")) return;
30
+ offered = true;
31
+ const args = { screenId, mode: "signin", presentation, modal: "1", ...signInSheetStyle(presentation, signInPageStyle(field(arg, "signInSheetStyle"))) };
32
+ void Promise.resolve(dispatch("himi.open", args)).catch(() => undefined);
33
+ },
34
+ member() { offered = false; },
35
+ };
36
+ }
@@ -0,0 +1,15 @@
1
+ // Shared by the app-level nav workers that serve more than one piece (header badges, access gates, the member avatar).
2
+ // Its own module so a worker that serves only some of them does not bundle the others.
3
+
4
+ /**
5
+ * The reserved lifecycle hooks of a service that serves more than one piece: the host calls one `onForeground` and
6
+ * one `onIdentityChange`, so each piece's hook runs in turn.
7
+ */
8
+ export function chainLifecycle<S>(
9
+ ...pieces: Array<{ onForeground: (s: S) => Promise<S>; onIdentityChange: (s: S) => Promise<S> }>
10
+ ): { onForeground: (s: S) => Promise<S>; onIdentityChange: (s: S) => Promise<S> } {
11
+ return {
12
+ onForeground: async (s) => { let next = s; for (const piece of pieces) next = await piece.onForeground(next); return next; },
13
+ onIdentityChange: async (s) => { let next = s; for (const piece of pieces) next = await piece.onIdentityChange(next); return next; },
14
+ };
15
+ }
@@ -0,0 +1,92 @@
1
+ // The signed-in member's profile photo and initials, for the top-bar avatar every tab root draws at its leading edge
2
+ // (`navigation.topBarDefault.items`, bound as `$app:brandedLiteNav.memberImage` / `.memberInitials`). A Visitor has
3
+ // neither: both are "" and the avatar draws the person glyph. Shared by the app-level nav workers that serve it.
4
+ //
5
+ // Like the header badges (`header-badges.ts`) it is read at launch, whenever the signed-in identity changes (the native
6
+ // host session clock, or the reserved `onIdentityChange` hook a web host delivers), and on every foreground (a photo
7
+ // changed in Account settings shows on return). A read that finishes after the identity changed, or after a newer read
8
+ // began, is dropped. The values are the member's personal data: declare them `notPersisted` and `notHydrated`, so a
9
+ // stored snapshot never shows the previous member's face.
10
+ import { hostSessionFromGlobal } from "@himalaya/iap";
11
+ import { loadMemberProfile } from "./himi-account.js";
12
+
13
+ export interface MemberAvatarState {
14
+ memberImage: string;
15
+ memberInitials: string;
16
+ }
17
+ export const MEMBER_AVATAR_INITIAL: MemberAvatarState = { memberImage: "", memberInitials: "" };
18
+ export const MEMBER_AVATAR_KEYS: (keyof MemberAvatarState)[] = ["memberImage", "memberInitials"];
19
+
20
+ // A `type`, not an `interface`: `defineService` constrains its actions to `Record<string, fn>`.
21
+ export type MemberAvatarActionSignatures<S> = {
22
+ /** Re-read the member's photo and initials. Only the newest read lands. */
23
+ refreshMemberAvatar: (s: S) => Promise<S>;
24
+ /** Forget the member (a new identity), committed at once so no stale face waits on a network read. */
25
+ dropMemberAvatar: (s: S) => Promise<S>;
26
+ /** Reserved lifecycle hooks the app-service host delivers to every service that declares them. */
27
+ onForeground: (s: S) => Promise<S>;
28
+ onIdentityChange: (s: S) => Promise<S>;
29
+ };
30
+
31
+ export interface MemberAvatar<S> {
32
+ actions: MemberAvatarActionSignatures<S>;
33
+ /** Call once after `defineService`: the launch read, and the session clock's notifications. */
34
+ start(): void;
35
+ }
36
+
37
+ type Update<S> = (s: S, change: (current: S) => Promise<S>) => Promise<S>;
38
+ type Self = () => { refreshMemberAvatar(): Promise<unknown>; dropMemberAvatar(): Promise<unknown> };
39
+
40
+ /**
41
+ * @param update serializes state changes for the worker, so overlapping actions build on the preceding result
42
+ * @param self the worker's own service handle (read lazily: it does not exist yet when this is called)
43
+ */
44
+ export function memberAvatar<S extends MemberAvatarState>(update: Update<S>, self: Self): MemberAvatar<S> {
45
+ /** Which read is the newest: an older one that finishes later must not overwrite a newer answer. */
46
+ let read = 0;
47
+ /** The host session generation the avatar on show was read under. */
48
+ let generation = -1;
49
+ const session = hostSessionFromGlobal();
50
+
51
+ const actions: MemberAvatarActionSignatures<S> = {
52
+ refreshMemberAvatar: async (s) => {
53
+ const mine = ++read;
54
+ // A guest comes back as the placeholder ("M" initials); the avatar draws the person glyph for a guest, so only a member's values count.
55
+ const profile = await loadMemberProfile("");
56
+ return update(s, async (current) => mine === read
57
+ ? { ...current, memberImage: profile.isMember ? profile.memberImage : "", memberInitials: profile.isMember ? profile.memberInitials : "" }
58
+ : current);
59
+ },
60
+ dropMemberAvatar: async (s) => {
61
+ ++read; // a read already in flight belongs to the previous identity
62
+ return update(s, async (current) => ({ ...current, ...MEMBER_AVATAR_INITIAL }));
63
+ },
64
+ onForeground: async (s) => update(s, async (current) => current).finally(() => { void self().refreshMemberAvatar(); }),
65
+ onIdentityChange: async (s) => {
66
+ ++read;
67
+ const dropped = await update(s, async (current) => ({ ...current, ...MEMBER_AVATAR_INITIAL }));
68
+ void self().refreshMemberAvatar();
69
+ return dropped;
70
+ },
71
+ };
72
+
73
+ /** A session notification: a new generation is a new identity, so the previous member's face goes first. */
74
+ async function onSession(): Promise<void> {
75
+ const now = session.current().generation;
76
+ if (now !== generation) {
77
+ generation = now;
78
+ await self().dropMemberAvatar();
79
+ }
80
+ await self().refreshMemberAvatar();
81
+ }
82
+
83
+ return {
84
+ actions,
85
+ start(): void {
86
+ // Subscribing notifies at once, which is the launch read; a host with no clock needs the explicit one.
87
+ let notified = false;
88
+ session.subscribe(() => { notified = true; void onSession(); });
89
+ if (!notified) void self().refreshMemberAvatar();
90
+ },
91
+ };
92
+ }
@@ -2,7 +2,9 @@
2
2
  // shows them, their latest past ones. It reads through the same member-scoped read as My Bookings (himi_bookings), so a booking
3
3
  // shows only for the member whose email it carries, and a guest or a refused member gets the sign-in state instead of a read.
4
4
  // limit -> at most N bookings per list, and `noMore` is false when the member has more upcoming ones (See All shows then),
5
- // showPast -> also the latest past bookings (the source's `previousBookings.enabled`),
5
+ // showPast -> also the History block under the upcoming ones (the source's `previousBookings.enabled`): its heading and Show All link,
6
+ // the latest past bookings (`pastLimit`) with Book Again, or the source's empty state when the member has none,
7
+ // pastLimit-> at most N past bookings in History (the source's section shows 1; default: `limit`),
6
8
  // emptyText-> the source's own empty line (unset: the stock one).
7
9
  // A page worker registers it under a service name; the descriptor binds `$service:<serviceName>.*` (recipe upcoming-bookings.json).
8
10
  import { defineService } from "@himalaya/state";
@@ -14,8 +16,10 @@ import { memberAccess, memberAccessDenied, memberChanged } from "./member-access
14
16
  export interface UpcomingBookingsOptions {
15
17
  /** Show at most this many bookings in each list. */
16
18
  limit: number;
17
- /** Also show the member's latest past bookings. */
19
+ /** Also show the History block: the member's latest past bookings, or its empty state. */
18
20
  showPast?: boolean;
21
+ /** Show at most this many past bookings in History (the source's section shows 1). Default: `limit`. */
22
+ pastLimit?: number;
19
23
  /** The source section's own text for "no upcoming bookings". */
20
24
  emptyText?: string;
21
25
  }
@@ -26,6 +30,8 @@ export interface BookingCard {
26
30
  when: string;
27
31
  /** The staff member and the place, "" when the booking names neither. */
28
32
  detail: string; noDetail: boolean;
33
+ /** The service a past booking can be booked again from; "" (and no Book Again button) when the record names none. */
34
+ serviceId: string; noBookAgain: boolean;
29
35
  a11y: string;
30
36
  }
31
37
 
@@ -38,6 +44,10 @@ export interface UpcomingBookingsState {
38
44
  emptyText: string;
39
45
  notLoading: boolean; notErrored: boolean; notSignedOut: boolean;
40
46
  noUpcoming: boolean; noPast: boolean;
47
+ /** The History block is hidden: nothing shown yet, or a guest. Once a member's read answered it stays, with the past bookings or the empty state. */
48
+ noHistory: boolean;
49
+ /** The member has no past booking (History says so, as the source's does). */
50
+ noPastEmpty: boolean;
41
51
  /** The member has no upcoming booking (shown only once the read answered for a signed-in member). */
42
52
  noEmpty: boolean;
43
53
  /** false when the member has more upcoming bookings than the section shows. */
@@ -46,7 +56,7 @@ export interface UpcomingBookingsState {
46
56
 
47
57
  const card = (row: MemberBookingRow): BookingCard => {
48
58
  const detail = [row.staff, row.placeName].filter(Boolean).join(" · ");
49
- return { id: row.id, title: row.title, when: row.subtitle, detail, noDetail: !detail, a11y: [row.title, row.subtitle, detail].filter(Boolean).join(", ") };
59
+ return { id: row.id, title: row.title, when: row.subtitle, detail, noDetail: !detail, serviceId: row.serviceId, noBookAgain: !row.serviceId, a11y: [row.title, row.subtitle, detail].filter(Boolean).join(", ") };
50
60
  };
51
61
 
52
62
  export function registerUpcomingBookingsSection(serviceName: string, options: UpcomingBookingsOptions) {
@@ -55,6 +65,7 @@ export function registerUpcomingBookingsSection(serviceName: string, options: Up
55
65
  emptyText: options.emptyText?.trim() || copyParam("upcomingBookings.emptyText", "You don't have any upcoming bookings."),
56
66
  notLoading: status !== "loading", notErrored: status !== "error", notSignedOut: !signedOut,
57
67
  noUpcoming: !upcoming.length, noPast: !past.length,
68
+ noHistory: !(status === "ready" && !signedOut), noPastEmpty: !(status === "ready" && !signedOut && !past.length),
58
69
  noEmpty: !(status === "ready" && !signedOut && !upcoming.length),
59
70
  noMore: !more,
60
71
  });
@@ -82,7 +93,7 @@ export function registerUpcomingBookingsSection(serviceName: string, options: Up
82
93
  const read = (filter: string, sort: "default" | "za") => fetchMemberBookings({ query: "", filter, sort, savedIds: [] }, "", now, member);
83
94
  const [next, previous] = await Promise.all([read("value:Upcoming", "default"), options.showPast ? read("value:Past", "za") : undefined]);
84
95
  if (seq !== sequence) return undefined;
85
- return view("ready", false, next.items.slice(0, options.limit).map(card), (previous?.items ?? []).slice(0, options.limit).map(card),
96
+ return view("ready", false, next.items.slice(0, options.limit).map(card), (previous?.items ?? []).slice(0, options.pastLimit ?? options.limit).map(card),
86
97
  next.items.length > options.limit || !!next.nextCursor);
87
98
  } catch (error) {
88
99
  if (seq !== sequence) return undefined;
@@ -14,10 +14,12 @@
14
14
 
15
15
  import { defineService } from "@himalaya/state";
16
16
  import { HEADER_BADGE_KEYS, headerBadges, type HeaderBadgeActionSignatures, type HeaderBadges, type HeaderBadgeState } from "../_shared/header-badges.js";
17
- import { ACCESS_GATES_INITIAL, ACCESS_STATE_KEYS, accessGates, chainLifecycle, type AccessGateActionSignatures, type AccessGates, type AccessGateState } from "../_shared/access-gates.js";
17
+ import { ACCESS_GATES_INITIAL, ACCESS_STATE_KEYS, accessGates, type AccessGateActionSignatures, type AccessGates, type AccessGateState } from "../_shared/access-gates.js";
18
+ import { MEMBER_AVATAR_INITIAL, MEMBER_AVATAR_KEYS, memberAvatar, type MemberAvatar, type MemberAvatarActionSignatures, type MemberAvatarState } from "../_shared/nav-member-avatar.js";
19
+ import { chainLifecycle } from "../_shared/lifecycle.js";
18
20
  import { LOCATION_PIN_INITIAL, locationPin, type LocationPin, type LocationPinActionSignatures, type LocationPinState } from "../_shared/location-pin.js";
19
21
 
20
- type State = HeaderBadgeState & AccessGateState & LocationPinState;
22
+ type State = HeaderBadgeState & AccessGateState & LocationPinState & MemberAvatarState;
21
23
 
22
24
  // State changes await native work; overlapping actions must use the preceding result.
23
25
  let stateQueue: Promise<State> | undefined;
@@ -31,16 +33,18 @@ function updateInOrder(s: State, update: (current: State) => Promise<State>): Pr
31
33
  const badges: HeaderBadges<State> = headerBadges<State>(updateInOrder, () => svc);
32
34
  const access: AccessGates<State> = accessGates<State>(updateInOrder, () => svc);
33
35
  const pin: LocationPin<State> = locationPin<State>(updateInOrder, () => svc);
36
+ const avatar: MemberAvatar<State> = memberAvatar<State>(updateInOrder, () => svc);
34
37
 
35
- const svc = defineService<State, HeaderBadgeActionSignatures<State> & AccessGateActionSignatures<State> & LocationPinActionSignatures<State>>("brandedLiteNav", {
38
+ const svc = defineService<State, HeaderBadgeActionSignatures<State> & AccessGateActionSignatures<State> & LocationPinActionSignatures<State> & MemberAvatarActionSignatures<State>>("brandedLiteNav", {
36
39
  // Every count unavailable until the first read lands, and no failure to report. Every gate pending (locked).
37
- state: { notificationsBadge: null, chatBadge: null, cartBadge: null, errorText: "", ...ACCESS_GATES_INITIAL, ...LOCATION_PIN_INITIAL },
38
- // The counts and the gates describe THIS run (see _shared/header-badges.ts, _shared/access-gates.ts): never stored,
39
- // never restored, so a snapshot can neither show another day's numbers nor keep a tab open.
40
- notPersisted: [...HEADER_BADGE_KEYS, ...ACCESS_STATE_KEYS],
41
- notHydrated: [...HEADER_BADGE_KEYS, ...ACCESS_STATE_KEYS],
40
+ state: { notificationsBadge: null, chatBadge: null, cartBadge: null, errorText: "", ...ACCESS_GATES_INITIAL, ...LOCATION_PIN_INITIAL, ...MEMBER_AVATAR_INITIAL },
41
+ // The counts and the gates describe THIS run (see _shared/header-badges.ts, _shared/access-gates.ts), and the avatar is
42
+ // the member's personal data (_shared/nav-member-avatar.ts): never stored, never restored, so a snapshot can neither show
43
+ // another day's numbers nor keep a tab open nor show the previous member's face.
44
+ notPersisted: [...HEADER_BADGE_KEYS, ...ACCESS_STATE_KEYS, ...MEMBER_AVATAR_KEYS],
45
+ notHydrated: [...HEADER_BADGE_KEYS, ...ACCESS_STATE_KEYS, ...MEMBER_AVATAR_KEYS],
42
46
  // The host calls one `onForeground` and one `onIdentityChange`: each piece runs in turn.
43
- actions: { ...badges.actions, ...access.actions, ...pin.actions, ...chainLifecycle<State>(badges.actions, access.actions) },
47
+ actions: { ...badges.actions, ...access.actions, ...pin.actions, ...avatar.actions, ...chainLifecycle<State>(badges.actions, access.actions, avatar.actions) },
44
48
  });
45
49
 
46
50
  export { svc };
@@ -48,3 +52,4 @@ export { svc };
48
52
  badges.start();
49
53
  access.start();
50
54
  pin.start();
55
+ avatar.start();
@@ -24,6 +24,7 @@ import {
24
24
  type InboxPage,
25
25
  } from "../_shared/member-inbox-transport.js";
26
26
  import { copyParam, stashCopy } from "../_shared/himi-copy.js";
27
+ import { guestSignIn } from "../_shared/guest-sign-in.js";
27
28
 
28
29
  type Row = Omit<InboxRow, "at">;
29
30
  const strip = ({ at: _at, ...row }: InboxRow): Row => row;
@@ -383,6 +384,9 @@ const idOf = (arg: unknown): string => textOf(arg, "id");
383
384
  const PIN = new Set(["1", "true"]);
384
385
  /** `undefined` = nothing to publish: a superseded read returns it rather than a snapshot, because the runtime replaces the
385
386
  * whole state with what an action returns and a snapshot taken now would overwrite what the newer read publishes next. */
387
+ /** A guest who opened the Inbox is offered the app's sign-in at once (the load params opt in: `signInScreenId`). */
388
+ const guest = guestSignIn();
389
+
386
390
  async function loadList(s: S, arg: unknown, retry: boolean): Promise<S | undefined> {
387
391
  stashCopy(arg);
388
392
  const screen = (arg as { businessScreenId?: unknown } | null)?.businessScreenId;
@@ -396,7 +400,8 @@ async function loadList(s: S, arg: unknown, retry: boolean): Promise<S | undefin
396
400
  let gen = -1;
397
401
  try {
398
402
  const identity = await chatIdentity();
399
- if (!identity.authenticated) return signedOutState();
403
+ if (!identity.authenticated) { guest.offer(arg); return signedOutState(); }
404
+ guest.member();
400
405
  const key = `${identity.email}|${identity.scope}`;
401
406
  switched = ownerKey !== "" && ownerKey !== key;
402
407
  if (switched) forgetMember();
@@ -23,8 +23,10 @@ import { applyBrand } from "@himalaya/theme";
23
23
  import { hostSiteFromInput, hostedHiddenFlags } from "../_shared/branded-lite-hosted.js";
24
24
  import { LOCATION_PIN_INITIAL, locationPin, type LocationPin, type LocationPinActionSignatures, type LocationPinState } from "../_shared/location-pin.js";
25
25
  import { HEADER_BADGES_INITIAL, HEADER_BADGE_KEYS, headerBadges, type HeaderBadgeActionSignatures, type HeaderBadges, type HeaderBadgeState } from "../_shared/header-badges.js";
26
+ import { MEMBER_AVATAR_INITIAL, MEMBER_AVATAR_KEYS, memberAvatar, type MemberAvatar, type MemberAvatarActionSignatures, type MemberAvatarState } from "../_shared/nav-member-avatar.js";
27
+ import { chainLifecycle } from "../_shared/lifecycle.js";
26
28
 
27
- interface NavState extends HeaderBadgeState, LocationPinState {
29
+ interface NavState extends HeaderBadgeState, LocationPinState, MemberAvatarState {
28
30
  error: string;
29
31
  /** Notifications received but not yet opened. Drives the app-icon badge. */
30
32
  unread: number;
@@ -70,6 +72,8 @@ const hostedSite = hostSiteFromInput((globalThis as { himalaya?: { input?: unkno
70
72
 
71
73
  // The header badge counts (bell, chat, cart): one service piece shared with the template's badges-only worker.
72
74
  const badges: HeaderBadges<NavState> = headerBadges<NavState>(updateInOrder, () => svc);
75
+ // The member's photo and initials for the top-bar avatar (`topBarDefault`, bound as `$app:brandedLiteNav.memberImage`).
76
+ const avatar: MemberAvatar<NavState> = memberAvatar<NavState>(updateInOrder, () => svc);
73
77
  // The Services top-bar location pin (`noLocationMenu`): one piece shared with the access-gates worker.
74
78
  const pin: LocationPin<NavState> = locationPin<NavState>(updateInOrder, () => svc);
75
79
 
@@ -79,11 +83,12 @@ const svc = defineService<NavState, {
79
83
  onNotification: (s: NavState, params?: unknown) => Promise<NavState>;
80
84
  /** Zero the count (the user has caught up). */
81
85
  clearUnread: (s: NavState) => Promise<NavState>;
82
- } & HeaderBadgeActionSignatures<NavState> & LocationPinActionSignatures<NavState>>("brandedLiteNav", {
83
- state: { error: "", unread: 0, hasUnread: false, unreadIds: [], lastTemplateId: "", lastTopic: "", lastResolvedLink: "", hosted: hostedHiddenFlags(hostedSite), ...LOCATION_PIN_INITIAL, ...HEADER_BADGES_INITIAL },
84
- // The header badge counts describe THIS run (see _shared/header-badges.ts): never stored, never restored.
85
- notPersisted: HEADER_BADGE_KEYS,
86
- notHydrated: HEADER_BADGE_KEYS,
86
+ } & HeaderBadgeActionSignatures<NavState> & LocationPinActionSignatures<NavState> & MemberAvatarActionSignatures<NavState>>("brandedLiteNav", {
87
+ state: { error: "", unread: 0, hasUnread: false, unreadIds: [], lastTemplateId: "", lastTopic: "", lastResolvedLink: "", hosted: hostedHiddenFlags(hostedSite), ...LOCATION_PIN_INITIAL, ...HEADER_BADGES_INITIAL, ...MEMBER_AVATAR_INITIAL },
88
+ // The header badge counts describe THIS run (see _shared/header-badges.ts), and the avatar is the signed-in member's
89
+ // personal data (_shared/nav-member-avatar.ts): never stored, never restored.
90
+ notPersisted: [...HEADER_BADGE_KEYS, ...MEMBER_AVATAR_KEYS],
91
+ notHydrated: [...HEADER_BADGE_KEYS, ...MEMBER_AVATAR_KEYS],
87
92
  actions: {
88
93
  onNotification: async (s, params) => {
89
94
  return updateInOrder(s, (current) => {
@@ -103,6 +108,9 @@ const svc = defineService<NavState, {
103
108
  .finally(() => badges.refresh()),
104
109
  ...pin.actions,
105
110
  ...badges.actions,
111
+ ...avatar.actions,
112
+ // The host calls one `onForeground` and one `onIdentityChange`: the badges and the avatar each run in turn.
113
+ ...chainLifecycle<NavState>(badges.actions, avatar.actions),
106
114
  },
107
115
  });
108
116
 
@@ -144,6 +152,7 @@ export { svc };
144
152
  pin.start(!!hostedSite && hostedHiddenFlags(hostedSite).bookings);
145
153
  // Subscribing notifies at once, which is the launch read; a host with no clock needs the explicit one.
146
154
  badges.start();
155
+ avatar.start();
147
156
 
148
157
  // Hosted mode: the site's own brand over the build's. The shell's brand slot is scoped to this
149
158
  // host session, so a site switch drops it.
@@ -14,6 +14,7 @@ import { navigate } from "@himalaya/state";
14
14
  import { notificationOpen, urlHost, type NotificationOpen } from "../_shared/notification-target.js";
15
15
  import { openRichLink } from "../_shared/rich-content-link.js";
16
16
  import { copyParam, copyTemplate } from "../_shared/himi-copy.js";
17
+ import { guestSignIn } from "../_shared/guest-sign-in.js";
17
18
 
18
19
  interface Row {
19
20
  id: string;
@@ -147,6 +148,8 @@ function currentInbox(s: S): S | undefined {
147
148
  }
148
149
 
149
150
  const defineService = withOnlineWrites(registerService, ["markOneRead","markAll"], { messageFields: ["actionMessage"] });
151
+ /** A guest who opened Notifications is offered the app's sign-in at once (the load params opt in: `signInScreenId`). */
152
+ const guest = guestSignIn();
150
153
  const INITIAL = { ...LOADING, items: [] as Row[], emptyText: "", actionMessage: "", pendingUrl: "", inboxMember: null };
151
154
  const svc = defineService<S, {
152
155
  prepare: (s: S) => S;
@@ -166,11 +169,15 @@ const svc = defineService<S, {
166
169
  const served = servedScreens(arg);
167
170
  try {
168
171
  const member = await requireMember();
172
+ // At once, not after the read: a signed-in load whose read fails would otherwise leave the one-shot offer consumed for the next guest.
173
+ guest.member();
169
174
  const items = (await queryNotifications(25)).map((n) => norm(n, served));
170
175
  await assertMemberAccess(member);
171
176
  return { ...s, ...loaded("items", items, COPY), inboxMember: member, actionMessage: "", pendingUrl: "" };
172
177
  } catch (err) {
173
- return { ...s, ...loadFailed("items", (await memberAccess()).email ? err : signInRequired(), COPY), inboxMember: null, actionMessage: "", pendingUrl: "" };
178
+ const signedIn = !!(await memberAccess()).email;
179
+ if (!signedIn) guest.offer(arg);
180
+ return { ...s, ...loadFailed("items", signedIn ? err : signInRequired(), COPY), inboxMember: null, actionMessage: "", pendingUrl: "" };
174
181
  }
175
182
  },
176
183
  // Mark one read; optimistically clear its dot. Real write is best-effort and
@@ -7,6 +7,7 @@ import { offsetPage } from "../_shared/offset-page.js";
7
7
  import { copyParam } from "../_shared/himi-copy.js";
8
8
  import { eventPageUrlOf, registrationUi } from "../_shared/event-registration.js";
9
9
  import { share as shareSheet } from "@himalaya/share";
10
+ import { eventsSelectionFilter, eventsSelectionFromScope, eventsSelectionOf, eventsSelectionScope, type EventsSelection } from "../_shared/events-inline-options.js";
10
11
 
11
12
  // Offline-first (data-offline): the public events list is a read-through catalog —
12
13
  // paint the last-synced rows from the on-device store first (instant, works offline),
@@ -58,8 +59,20 @@ interface S {
58
59
  nextCursor?: string; complete?: boolean; total?: number; loadingMore?: boolean; pageError?: boolean; fromCache?: boolean;
59
60
  }
60
61
  let queryNow = new Date().toISOString();
62
+
63
+ // A link may open the list on some events only (`categoryIds` / `eventIds`, comma-separated: a See All from a section the app owner
64
+ // limited to a category). It is the selection of the visit that opened the screen: a visit that names none is the full list again.
65
+ // A route value is user-controllable text, so only well-formed ids are read (`eventsSelectionIds`). The selection is part of the
66
+ // query's criteria (`scope`), so rows, cached pages and restored pages are always those of the selection being shown.
67
+ let selection: EventsSelection = { categoryIds: [], eventIds: [] };
68
+ function readSelection(arg?: unknown): EventsSelection {
69
+ const own = (value: unknown) => (value && typeof value === "object" && ("categoryIds" in value || "eventIds" in value) ? value : undefined);
70
+ return eventsSelectionOf((own(arg) ?? (globalThis as { himalaya?: { input?: unknown } }).himalaya?.input) as { categoryIds?: unknown; eventIds?: unknown } | undefined);
71
+ }
61
72
  const svc = defineBackendCollection<S, ListEventRow>("himiEvents", {
62
73
  restorePagesOnLoad: true,
74
+ onLoad(arg) { selection = readSelection(arg); },
75
+ scope: () => eventsSelectionScope(selection),
63
76
  state: { status: "loading", query: "", all: [], results: [], emptyText: "", countLabel: "", errored: false, notErrored: true,
64
77
  isLoading: true, notLoading: false, noEmpty: true },
65
78
  source: {
@@ -69,6 +82,8 @@ const svc = defineBackendCollection<S, ListEventRow>("himiEvents", {
69
82
  // The list now OPENS on Upcoming, so the default view must keep its offline-first paint:
70
83
  // serve the cache for it too, minus the rows that have finished.
71
84
  const upcoming = criteria.filter === "value:Upcoming";
85
+ // The cache holds the whole catalog: a list limited to some events must not paint rows outside the selection first.
86
+ if (criteria.scope) return undefined;
72
87
  if (criteria.query || (criteria.filter !== "all" && !upcoming) || criteria.sort !== "default") return undefined;
73
88
  const rows = await readCached();
74
89
  return { items: upcoming ? rows.filter((row) => row.statusLabel !== "Past") : rows, nextCursor: "", metadata: { fromCache: true } };
@@ -81,6 +96,8 @@ const svc = defineBackendCollection<S, ListEventRow>("himiEvents", {
81
96
  // nothing for "Harvest" when the event is "Harvest Tasting".
82
97
  if (criteria.query) filter.title = { $startsWith: criteria.query };
83
98
  if (criteria.filter === "saved") filter.id = { $in: criteria.savedIds };
99
+ // The selection also limits Saved: a saved event outside it stays out (`eventsSelectionFilter` intersects the two id lists).
100
+ Object.assign(filter, eventsSelectionFilter(eventsSelectionFromScope(criteria.scope), criteria.filter === "saved" ? criteria.savedIds : undefined));
84
101
  // Upcoming = not started yet OR not finished yet: an event in progress (a festival on its
85
102
  // second day) is still on. The start-date arm is what keeps a START-ONLY event (no endDate
86
103
  // — valid in Wix Events) in the list; a filter on endDate alone dropped it from both views.