@wix/himalaya-cli 0.1583.0 → 0.1585.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 (313) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-module.d.ts +7 -4
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/bindings.d.ts +7 -6
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/blog-v3/src/extensions.d.ts +2 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/comments-v1/src/extensions.d.ts +2 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/events/src/index.d.ts +3 -0
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/groups/src/extensions.d.ts +15 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/loyalty/src/extensions.d.ts +13 -0
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/members-v1/src/index.d.ts +19 -4
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +2 -2
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +8 -2
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-comments.mjs +3 -0
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-events.mjs +4 -2
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-groups.mjs +5 -0
  14. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-loyalty.mjs +4 -0
  15. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-members.mjs +10 -3
  16. package/dist/cli.mjs +2201 -1716
  17. package/dist/preview-assets.generated.bin +0 -0
  18. package/fixtures/wix-canned.json +25 -0
  19. package/guides/branded-lite-site-binding.md +7 -1
  20. package/guides/designing-himi-screens.md +47 -7
  21. package/guides/himi-skill.md +16 -0
  22. package/guides/index.json +1 -0
  23. package/guides/one-app-to-himi-app.md +52 -1
  24. package/guides/sdk-reference.json +37 -9
  25. package/guides/tier-5-add-a-screen.md +9 -0
  26. package/guides/wix-api-usage.md +9 -0
  27. package/package.json +2 -2
  28. package/templates/beauty-salon/config.ts +7 -0
  29. package/templates/beauty-salon/dev/index.ts +758 -352
  30. package/templates/beauty-salon/himalaya.content.json +3 -0
  31. package/templates/beauty-salon/tier5-src/_shared/branded-lite-hosted.ts +1 -1
  32. package/templates/beauty-salon/tier5-src/_shared/collection-contract.ts +19 -3
  33. package/templates/beauty-salon/tier5-src/_shared/himi-restaurants.ts +2 -1
  34. package/templates/beauty-salon/tier5-src/_shared/owner-editor-value.ts +164 -0
  35. package/templates/beauty-salon/tier5-src/_shared/store-product-info.ts +50 -0
  36. package/templates/beauty-salon/tier5-src/himi-blog-post/index.ts +21 -8
  37. package/templates/beauty-salon/tier5-src/himi-branded-lite-category/index.ts +3 -2
  38. package/templates/beauty-salon/tier5-src/himi-branded-lite-notifsettings/index.ts +173 -0
  39. package/templates/beauty-salon/tier5-src/himi-branded-lite-plans/index.ts +2 -1
  40. package/templates/beauty-salon/tier5-src/himi-store-product/index.ts +14 -3
  41. package/templates/beauty-salon/tier5-src/wix-spaces-plan-detail/index.ts +2 -1
  42. package/templates/beauty-salon/tier5-src/wix-spaces-whats-new/index.ts +2 -1
  43. package/templates/beauty-salon-owner/dev/index.ts +129 -66
  44. package/templates/beauty-salon-owner/tier5-src/_shared/collection-contract.ts +19 -3
  45. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-post/index.ts +7 -0
  46. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-product/index.ts +39 -6
  47. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-product-form/index.ts +14 -8
  48. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-products/index.ts +7 -4
  49. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-service/index.ts +38 -7
  50. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-service-form/index.ts +53 -7
  51. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-services/index.ts +4 -2
  52. package/templates/branded-lite/config.ts +9 -0
  53. package/templates/branded-lite/dev/index.ts +4988 -3304
  54. package/templates/branded-lite/himalaya.content.json +3 -0
  55. package/templates/branded-lite/tier5-src/_shared/branded-lite-hosted.ts +1 -1
  56. package/templates/branded-lite/tier5-src/_shared/collection-contract.ts +19 -3
  57. package/templates/branded-lite/tier5-src/_shared/event-registration.ts +86 -0
  58. package/templates/branded-lite/tier5-src/_shared/himi-restaurants.ts +2 -1
  59. package/templates/branded-lite/tier5-src/_shared/owner-editor-value.ts +164 -0
  60. package/templates/branded-lite/tier5-src/_shared/store-product-info.ts +50 -0
  61. package/templates/branded-lite/tier5-src/himi-blog-post/index.ts +21 -8
  62. package/templates/branded-lite/tier5-src/himi-branded-lite-badges/index.ts +2 -1
  63. package/templates/branded-lite/tier5-src/himi-branded-lite-category/index.ts +3 -2
  64. package/templates/branded-lite/tier5-src/himi-branded-lite-feed/index.ts +4 -3
  65. package/templates/branded-lite/tier5-src/himi-branded-lite-group-about/index.ts +243 -0
  66. package/templates/branded-lite/tier5-src/himi-branded-lite-loyalty/index.ts +115 -49
  67. package/templates/branded-lite/tier5-src/himi-branded-lite-plans/index.ts +2 -1
  68. package/templates/branded-lite/tier5-src/himi-branded-lite-podcasts/index.ts +2 -1
  69. package/templates/branded-lite/tier5-src/himi-branded-lite-portfolio/index.ts +2 -1
  70. package/templates/branded-lite/tier5-src/himi-branded-lite-portfolio-project/index.ts +3 -2
  71. package/templates/branded-lite/tier5-src/himi-branded-lite-program/facts.ts +52 -0
  72. package/templates/branded-lite/tier5-src/himi-branded-lite-program/index.ts +21 -11
  73. package/templates/branded-lite/tier5-src/himi-branded-lite-video/index.ts +2 -1
  74. package/templates/branded-lite/tier5-src/himi-events-detail/index.ts +12 -86
  75. package/templates/branded-lite/tier5-src/himi-events-list/index.ts +47 -6
  76. package/templates/branded-lite/tier5-src/himi-store-product/index.ts +13 -3
  77. package/templates/branded-lite/tier5-src/wix-spaces-forum-post/index.ts +3 -2
  78. package/templates/branded-lite/tier5-src/wix-spaces-member-detail/index.ts +53 -37
  79. package/templates/branded-lite/tier5-src/wix-spaces-members/index.ts +100 -34
  80. package/templates/branded-lite/tier5-src/wix-spaces-plan-detail/index.ts +2 -1
  81. package/templates/branded-lite/tier5-src/wix-spaces-whats-new/index.ts +2 -1
  82. package/templates/community-club/config.ts +16 -0
  83. package/templates/community-club/dev/index.ts +1930 -401
  84. package/templates/community-club/himalaya.content.json +6 -0
  85. package/templates/community-club/tier5-src/_shared/branded-lite-hosted.ts +1 -1
  86. package/templates/community-club/tier5-src/_shared/collection-contract.ts +19 -3
  87. package/templates/community-club/tier5-src/_shared/event-registration.ts +86 -0
  88. package/templates/community-club/tier5-src/_shared/himi-restaurants.ts +2 -1
  89. package/templates/community-club/tier5-src/himi-blog-post/index.ts +21 -8
  90. package/templates/community-club/tier5-src/himi-branded-lite-feed/index.ts +4 -3
  91. package/templates/community-club/tier5-src/himi-branded-lite-group-about/index.ts +243 -0
  92. package/templates/community-club/tier5-src/himi-branded-lite-notifsettings/index.ts +173 -0
  93. package/templates/community-club/tier5-src/himi-events-detail/index.ts +12 -86
  94. package/templates/community-club/tier5-src/himi-events-list/index.ts +47 -6
  95. package/templates/community-club/tier5-src/wix-spaces-whats-new/index.ts +2 -1
  96. package/templates/community-club-owner/dev/index.ts +53 -1
  97. package/templates/community-club-owner/tier5-src/_shared/collection-contract.ts +19 -3
  98. package/templates/community-club-owner/tier5-src/himi-owner-lite-event/index.ts +16 -8
  99. package/templates/community-club-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -7
  100. package/templates/community-club-owner/tier5-src/himi-owner-lite-events/index.ts +4 -2
  101. package/templates/community-club-owner/tier5-src/himi-owner-lite-post/index.ts +7 -0
  102. package/templates/community-club-owner/tier5-src/himi-owner-lite-product/index.ts +39 -6
  103. package/templates/community-club-owner/tier5-src/himi-owner-lite-product-form/index.ts +14 -8
  104. package/templates/community-club-owner/tier5-src/himi-owner-lite-products/index.ts +7 -4
  105. package/templates/events-meetups/config.ts +16 -0
  106. package/templates/events-meetups/dev/index.ts +1930 -401
  107. package/templates/events-meetups/himalaya.content.json +6 -0
  108. package/templates/events-meetups/tier5-src/_shared/branded-lite-hosted.ts +1 -1
  109. package/templates/events-meetups/tier5-src/_shared/collection-contract.ts +19 -3
  110. package/templates/events-meetups/tier5-src/_shared/event-registration.ts +86 -0
  111. package/templates/events-meetups/tier5-src/_shared/himi-restaurants.ts +2 -1
  112. package/templates/events-meetups/tier5-src/himi-blog-post/index.ts +21 -8
  113. package/templates/events-meetups/tier5-src/himi-branded-lite-feed/index.ts +4 -3
  114. package/templates/events-meetups/tier5-src/himi-branded-lite-group-about/index.ts +243 -0
  115. package/templates/events-meetups/tier5-src/himi-branded-lite-notifsettings/index.ts +173 -0
  116. package/templates/events-meetups/tier5-src/himi-events-detail/index.ts +12 -86
  117. package/templates/events-meetups/tier5-src/himi-events-list/index.ts +47 -6
  118. package/templates/events-meetups/tier5-src/wix-spaces-whats-new/index.ts +2 -1
  119. package/templates/events-meetups-owner/dev/index.ts +6 -0
  120. package/templates/events-meetups-owner/tier5-src/_shared/collection-contract.ts +19 -3
  121. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-event/index.ts +16 -8
  122. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -7
  123. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-events/index.ts +4 -2
  124. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-post/index.ts +7 -0
  125. package/templates/gym-fitness/config.ts +7 -0
  126. package/templates/gym-fitness/dev/index.ts +1115 -278
  127. package/templates/gym-fitness/himalaya.content.json +3 -0
  128. package/templates/gym-fitness/tier5-src/_shared/branded-lite-hosted.ts +1 -1
  129. package/templates/gym-fitness/tier5-src/_shared/collection-contract.ts +19 -3
  130. package/templates/gym-fitness/tier5-src/_shared/event-registration.ts +86 -0
  131. package/templates/gym-fitness/tier5-src/_shared/himi-restaurants.ts +2 -1
  132. package/templates/gym-fitness/tier5-src/_shared/owner-editor-value.ts +164 -0
  133. package/templates/gym-fitness/tier5-src/_shared/store-product-info.ts +50 -0
  134. package/templates/gym-fitness/tier5-src/himi-blog-post/index.ts +21 -8
  135. package/templates/gym-fitness/tier5-src/himi-branded-lite-category/index.ts +3 -2
  136. package/templates/gym-fitness/tier5-src/himi-branded-lite-notifsettings/index.ts +173 -0
  137. package/templates/gym-fitness/tier5-src/himi-branded-lite-plans/index.ts +2 -1
  138. package/templates/gym-fitness/tier5-src/himi-events-detail/index.ts +12 -86
  139. package/templates/gym-fitness/tier5-src/himi-events-list/index.ts +47 -6
  140. package/templates/gym-fitness/tier5-src/himi-store-product/index.ts +14 -3
  141. package/templates/gym-fitness/tier5-src/wix-spaces-plan-detail/index.ts +2 -1
  142. package/templates/gym-fitness/tier5-src/wix-spaces-whats-new/index.ts +2 -1
  143. package/templates/gym-fitness-owner/dev/index.ts +132 -66
  144. package/templates/gym-fitness-owner/tier5-src/_shared/collection-contract.ts +19 -3
  145. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-event/index.ts +16 -8
  146. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -7
  147. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-events/index.ts +4 -2
  148. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-post/index.ts +7 -0
  149. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-product/index.ts +39 -6
  150. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-product-form/index.ts +14 -8
  151. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-products/index.ts +7 -4
  152. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-service/index.ts +38 -7
  153. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-service-form/index.ts +53 -7
  154. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-services/index.ts +4 -2
  155. package/templates/nonprofit-cause/config.ts +16 -0
  156. package/templates/nonprofit-cause/dev/index.ts +1925 -396
  157. package/templates/nonprofit-cause/himalaya.content.json +6 -0
  158. package/templates/nonprofit-cause/tier5-src/_shared/branded-lite-hosted.ts +1 -1
  159. package/templates/nonprofit-cause/tier5-src/_shared/collection-contract.ts +19 -3
  160. package/templates/nonprofit-cause/tier5-src/_shared/event-registration.ts +86 -0
  161. package/templates/nonprofit-cause/tier5-src/_shared/himi-restaurants.ts +2 -1
  162. package/templates/nonprofit-cause/tier5-src/himi-blog-post/index.ts +21 -8
  163. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-feed/index.ts +4 -3
  164. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-group-about/index.ts +243 -0
  165. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-notifsettings/index.ts +173 -0
  166. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-plans/index.ts +2 -1
  167. package/templates/nonprofit-cause/tier5-src/himi-events-detail/index.ts +12 -86
  168. package/templates/nonprofit-cause/tier5-src/himi-events-list/index.ts +47 -6
  169. package/templates/nonprofit-cause/tier5-src/wix-spaces-plan-detail/index.ts +2 -1
  170. package/templates/nonprofit-cause/tier5-src/wix-spaces-whats-new/index.ts +2 -1
  171. package/templates/nonprofit-cause-owner/dev/index.ts +85 -65
  172. package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-contract.ts +19 -3
  173. package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-rich-guard.ts +27 -0
  174. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-event/index.ts +16 -8
  175. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -7
  176. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-events/index.ts +4 -2
  177. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-post/index.ts +7 -0
  178. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-service/index.ts +38 -7
  179. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-service-form/index.ts +53 -7
  180. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-services/index.ts +4 -2
  181. package/templates/owner-lite/dev/index.ts +132 -66
  182. package/templates/owner-lite/tier5-src/_shared/collection-contract.ts +19 -3
  183. package/templates/owner-lite/tier5-src/himi-owner-lite-event/index.ts +16 -8
  184. package/templates/owner-lite/tier5-src/himi-owner-lite-event-form/index.ts +16 -7
  185. package/templates/owner-lite/tier5-src/himi-owner-lite-events/index.ts +4 -2
  186. package/templates/owner-lite/tier5-src/himi-owner-lite-post/index.ts +7 -0
  187. package/templates/owner-lite/tier5-src/himi-owner-lite-product/index.ts +39 -6
  188. package/templates/owner-lite/tier5-src/himi-owner-lite-product-form/index.ts +14 -8
  189. package/templates/owner-lite/tier5-src/himi-owner-lite-products/index.ts +7 -4
  190. package/templates/owner-lite/tier5-src/himi-owner-lite-service/index.ts +38 -7
  191. package/templates/owner-lite/tier5-src/himi-owner-lite-service-form/index.ts +53 -7
  192. package/templates/owner-lite/tier5-src/himi-owner-lite-services/index.ts +4 -2
  193. package/templates/podcast-creator/config.ts +7 -0
  194. package/templates/podcast-creator/dev/index.ts +1051 -158
  195. package/templates/podcast-creator/himalaya.content.json +3 -0
  196. package/templates/podcast-creator/tier5-src/_shared/branded-lite-hosted.ts +1 -1
  197. package/templates/podcast-creator/tier5-src/_shared/collection-contract.ts +19 -3
  198. package/templates/podcast-creator/tier5-src/_shared/event-registration.ts +86 -0
  199. package/templates/podcast-creator/tier5-src/_shared/himi-restaurants.ts +2 -1
  200. package/templates/podcast-creator/tier5-src/himi-blog-post/index.ts +21 -8
  201. package/templates/podcast-creator/tier5-src/himi-branded-lite-feed/index.ts +4 -3
  202. package/templates/podcast-creator/tier5-src/himi-branded-lite-notifsettings/index.ts +173 -0
  203. package/templates/podcast-creator/tier5-src/himi-branded-lite-plans/index.ts +2 -1
  204. package/templates/podcast-creator/tier5-src/himi-branded-lite-podcasts/index.ts +2 -1
  205. package/templates/podcast-creator/tier5-src/himi-events-detail/index.ts +12 -86
  206. package/templates/podcast-creator/tier5-src/himi-events-list/index.ts +47 -6
  207. package/templates/podcast-creator/tier5-src/wix-spaces-plan-detail/index.ts +2 -1
  208. package/templates/podcast-creator/tier5-src/wix-spaces-whats-new/index.ts +2 -1
  209. package/templates/podcast-creator-owner/dev/index.ts +53 -1
  210. package/templates/podcast-creator-owner/tier5-src/_shared/collection-contract.ts +19 -3
  211. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-event/index.ts +16 -8
  212. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -7
  213. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-events/index.ts +4 -2
  214. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-post/index.ts +7 -0
  215. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-product/index.ts +39 -6
  216. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-product-form/index.ts +14 -8
  217. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-products/index.ts +7 -4
  218. package/templates/portfolio-creative/config.ts +7 -0
  219. package/templates/portfolio-creative/dev/index.ts +1305 -468
  220. package/templates/portfolio-creative/himalaya.content.json +3 -0
  221. package/templates/portfolio-creative/tier5-src/_shared/branded-lite-hosted.ts +1 -1
  222. package/templates/portfolio-creative/tier5-src/_shared/collection-contract.ts +19 -3
  223. package/templates/portfolio-creative/tier5-src/_shared/event-registration.ts +86 -0
  224. package/templates/portfolio-creative/tier5-src/_shared/himi-restaurants.ts +2 -1
  225. package/templates/portfolio-creative/tier5-src/_shared/owner-editor-value.ts +164 -0
  226. package/templates/portfolio-creative/tier5-src/_shared/store-product-info.ts +50 -0
  227. package/templates/portfolio-creative/tier5-src/himi-blog-post/index.ts +21 -8
  228. package/templates/portfolio-creative/tier5-src/himi-branded-lite-category/index.ts +3 -2
  229. package/templates/portfolio-creative/tier5-src/himi-branded-lite-notifsettings/index.ts +173 -0
  230. package/templates/portfolio-creative/tier5-src/himi-branded-lite-portfolio/index.ts +2 -1
  231. package/templates/portfolio-creative/tier5-src/himi-branded-lite-portfolio-project/index.ts +3 -2
  232. package/templates/portfolio-creative/tier5-src/himi-events-detail/index.ts +12 -86
  233. package/templates/portfolio-creative/tier5-src/himi-events-list/index.ts +47 -6
  234. package/templates/portfolio-creative/tier5-src/himi-store-product/index.ts +14 -3
  235. package/templates/portfolio-creative/tier5-src/wix-spaces-whats-new/index.ts +2 -1
  236. package/templates/portfolio-creative-owner/dev/index.ts +129 -66
  237. package/templates/portfolio-creative-owner/tier5-src/_shared/collection-contract.ts +19 -3
  238. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-post/index.ts +7 -0
  239. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-product/index.ts +39 -6
  240. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-product-form/index.ts +14 -8
  241. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-products/index.ts +7 -4
  242. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-service/index.ts +38 -7
  243. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-service-form/index.ts +53 -7
  244. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-services/index.ts +4 -2
  245. package/templates/restaurant/config.ts +7 -0
  246. package/templates/restaurant/dev/index.ts +1051 -158
  247. package/templates/restaurant/himalaya.content.json +3 -0
  248. package/templates/restaurant/tier5-src/_shared/branded-lite-hosted.ts +1 -1
  249. package/templates/restaurant/tier5-src/_shared/collection-contract.ts +19 -3
  250. package/templates/restaurant/tier5-src/_shared/event-registration.ts +86 -0
  251. package/templates/restaurant/tier5-src/_shared/himi-restaurants.ts +2 -1
  252. package/templates/restaurant/tier5-src/himi-blog-post/index.ts +21 -8
  253. package/templates/restaurant/tier5-src/himi-branded-lite-notifsettings/index.ts +173 -0
  254. package/templates/restaurant/tier5-src/himi-events-detail/index.ts +12 -86
  255. package/templates/restaurant/tier5-src/himi-events-list/index.ts +47 -6
  256. package/templates/restaurant/tier5-src/wix-spaces-whats-new/index.ts +2 -1
  257. package/templates/restaurant-owner/dev/index.ts +132 -66
  258. package/templates/restaurant-owner/tier5-src/_shared/collection-contract.ts +19 -3
  259. package/templates/restaurant-owner/tier5-src/himi-owner-lite-event/index.ts +16 -8
  260. package/templates/restaurant-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -7
  261. package/templates/restaurant-owner/tier5-src/himi-owner-lite-events/index.ts +4 -2
  262. package/templates/restaurant-owner/tier5-src/himi-owner-lite-post/index.ts +7 -0
  263. package/templates/restaurant-owner/tier5-src/himi-owner-lite-product/index.ts +39 -6
  264. package/templates/restaurant-owner/tier5-src/himi-owner-lite-product-form/index.ts +14 -8
  265. package/templates/restaurant-owner/tier5-src/himi-owner-lite-products/index.ts +7 -4
  266. package/templates/restaurant-owner/tier5-src/himi-owner-lite-service/index.ts +38 -7
  267. package/templates/restaurant-owner/tier5-src/himi-owner-lite-service-form/index.ts +53 -7
  268. package/templates/restaurant-owner/tier5-src/himi-owner-lite-services/index.ts +4 -2
  269. package/templates/retail-store/config.ts +7 -0
  270. package/templates/retail-store/dev/index.ts +597 -191
  271. package/templates/retail-store/himalaya.content.json +3 -0
  272. package/templates/retail-store/tier5-src/_shared/branded-lite-hosted.ts +1 -1
  273. package/templates/retail-store/tier5-src/_shared/collection-contract.ts +19 -3
  274. package/templates/retail-store/tier5-src/_shared/himi-restaurants.ts +2 -1
  275. package/templates/retail-store/tier5-src/_shared/owner-editor-value.ts +164 -0
  276. package/templates/retail-store/tier5-src/_shared/store-product-info.ts +50 -0
  277. package/templates/retail-store/tier5-src/himi-blog-post/index.ts +21 -8
  278. package/templates/retail-store/tier5-src/himi-branded-lite-category/index.ts +3 -2
  279. package/templates/retail-store/tier5-src/himi-branded-lite-notifsettings/index.ts +173 -0
  280. package/templates/retail-store/tier5-src/himi-store-product/index.ts +13 -3
  281. package/templates/retail-store/tier5-src/wix-spaces-whats-new/index.ts +2 -1
  282. package/templates/retail-store-owner/dev/index.ts +50 -1
  283. package/templates/retail-store-owner/tier5-src/_shared/collection-contract.ts +19 -3
  284. package/templates/retail-store-owner/tier5-src/himi-owner-lite-post/index.ts +7 -0
  285. package/templates/retail-store-owner/tier5-src/himi-owner-lite-product/index.ts +39 -6
  286. package/templates/retail-store-owner/tier5-src/himi-owner-lite-product-form/index.ts +14 -8
  287. package/templates/retail-store-owner/tier5-src/himi-owner-lite-products/index.ts +7 -4
  288. package/templates/yoga-studio/config.ts +7 -0
  289. package/templates/yoga-studio/dev/index.ts +1107 -110
  290. package/templates/yoga-studio/himalaya.content.json +3 -0
  291. package/templates/yoga-studio/tier5-src/_shared/branded-lite-hosted.ts +1 -1
  292. package/templates/yoga-studio/tier5-src/_shared/collection-contract.ts +19 -3
  293. package/templates/yoga-studio/tier5-src/_shared/event-registration.ts +86 -0
  294. package/templates/yoga-studio/tier5-src/_shared/himi-restaurants.ts +2 -1
  295. package/templates/yoga-studio/tier5-src/himi-blog-post/index.ts +21 -8
  296. package/templates/yoga-studio/tier5-src/himi-branded-lite-notifsettings/index.ts +173 -0
  297. package/templates/yoga-studio/tier5-src/himi-branded-lite-plans/index.ts +2 -1
  298. package/templates/yoga-studio/tier5-src/himi-branded-lite-program/facts.ts +52 -0
  299. package/templates/yoga-studio/tier5-src/himi-branded-lite-program/index.ts +21 -11
  300. package/templates/yoga-studio/tier5-src/himi-events-detail/index.ts +12 -86
  301. package/templates/yoga-studio/tier5-src/himi-events-list/index.ts +47 -6
  302. package/templates/yoga-studio/tier5-src/wix-spaces-plan-detail/index.ts +2 -1
  303. package/templates/yoga-studio/tier5-src/wix-spaces-whats-new/index.ts +2 -1
  304. package/templates/yoga-studio-owner/dev/index.ts +85 -65
  305. package/templates/yoga-studio-owner/tier5-src/_shared/collection-contract.ts +19 -3
  306. package/templates/yoga-studio-owner/tier5-src/_shared/owner-rich-guard.ts +27 -0
  307. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-event/index.ts +16 -8
  308. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -7
  309. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-events/index.ts +4 -2
  310. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-post/index.ts +7 -0
  311. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-service/index.ts +38 -7
  312. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-service-form/index.ts +53 -7
  313. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-services/index.ts +4 -2
@@ -52,6 +52,9 @@
52
52
  "himi_delete_account": {
53
53
  "displayName": "Delete Account"
54
54
  },
55
+ "himi_notif_settings": {
56
+ "displayName": "Notif Settings"
57
+ },
55
58
  "himi_order": {
56
59
  "displayName": "Order"
57
60
  },
@@ -97,6 +97,7 @@ export const HOSTED_SCREEN_VERTICALS: Readonly<Record<string, readonly BrandedLi
97
97
  himi_gift_card: ["giftCards"],
98
98
  himi_gift_cards: ["giftCards"],
99
99
  himi_groups: ["groups"],
100
+ himi_group_about: ["groups"],
100
101
  himi_invoice: ["invoices"],
101
102
  himi_invoices: ["invoices"],
102
103
  himi_loyalty: ["loyalty"],
@@ -107,7 +108,6 @@ export const HOSTED_SCREEN_VERTICALS: Readonly<Record<string, readonly BrandedLi
107
108
  himi_my_events: ["events"],
108
109
  himi_my_subscriptions: ["plans"],
109
110
  himi_new_message: ["inbox", "members"],
110
- himi_notif_settings: ["notifsettings"],
111
111
  himi_notifications: ["notifications"],
112
112
  himi_orders: ["store"],
113
113
  himi_photo_album: ["galleries"],
@@ -19,6 +19,8 @@ export interface CollectionConfig {
19
19
  /** Numeric 0–5 row field rendered as a Rating (accessible "N out of 5") instead of
20
20
  * folding a "★★★★☆" glyph string into the metadata line, so screen readers get a value. */
21
21
  rating?: string;
22
+ /** Domain-provided calendar text and its unavailable flag, kept separate from media. */
23
+ dateBadge?: { text: string; hidden: string };
22
24
  sectioned?: boolean;
23
25
  view: 'list' | 'grid';
24
26
  backendQuery?: boolean;
@@ -38,7 +40,13 @@ export interface CollectionConfig {
38
40
  /** The card's primary verb, shown as a visible button beside the overflow.
39
41
  * `screenId` opens that screen with the row id; without it the verb reuses the
40
42
  * row's own tap action (the detail screen that owns the verb). */
41
- primaryVerb?: { label: string; screenId?: string };
43
+ primaryVerb?: { label: string; screenId?: string;
44
+ /** A row field holding THIS row's verb label (Register, RSVP, Buy Tickets…); `label` stays the fallback copy. */
45
+ labelPath?: string;
46
+ /** A row boolean that hides the verb on rows that offer no action (an event with no registration). */
47
+ hiddenPath?: string };
48
+ /** The worker action that shares a row (`tier5.<service>.<name>` with `{ id }`): adds Share to the card's overflow menu. */
49
+ shareAction?: string;
42
50
  /** A TIME-BOUND entity (an event, a booking, a reservation): the boolean row field the
43
51
  * DOMAIN sets once the record has finished — computed by the same rule as the row's own
44
52
  * "Past" label, in the same place, so the two cannot disagree. A finished
@@ -73,7 +81,7 @@ export const COLLECTIONS: Record<string, CollectionConfig> = {
73
81
  himiBookingBookings: { rows: 'rows', title: 'title', subtitle: 'subtitle', metadata: ['status'], view: 'list', backendQuery: true,
74
82
  defaultFilter: 'value:Upcoming', searchPlaceholder: 'Search by booking ID', countNoun: ['booking', 'bookings'], filterValues: ['Upcoming', 'Past', 'Cancelled'],
75
83
  sortLabels: { default: 'Soonest', az: 'Oldest', za: 'Latest' } },
76
- himiEvents: { rows: 'results', title: 'title', subtitle: 'dateLine', image: 'image', view: 'grid', backendQuery: true, defaultFilter: 'value:Upcoming', searchPlaceholder: 'Search events', countNoun: ['event', 'events'], filterValues: ['Upcoming', 'Past'], sortLabels: { default: 'Date', az: 'Title A–Z', za: 'Title Z–A' }, primaryVerb: { label: 'Register' }, endedWhen: 'isPast' },
84
+ himiEvents: { rows: 'results', title: 'title', subtitle: 'dateLine', image: 'image', dateBadge: { text: 'dateBadge', hidden: 'noDateBadge' }, gridColumns: 1, view: 'grid', backendQuery: true, defaultFilter: 'value:Upcoming', searchPlaceholder: 'Search events', countNoun: ['event', 'events'], filterValues: ['Upcoming', 'Past'], sortLabels: { default: 'Date', az: 'Title A–Z', za: 'Title Z–A' }, primaryVerb: { label: 'Register', labelPath: 'actionLabel', hiddenPath: 'noAction' }, shareAction: 'share', endedWhen: 'isPast' },
77
85
  himiBlogFeed: { rows: 'posts', title: 'title', subtitle: 'excerpt', image: 'image', filter: 'category', filterValuesFrom: 'categories', view: 'grid', narrowedBy: 'selectedCategoryId' },
78
86
  himiOwnerLiteProducts: { rows: 'products', title: 'name', subtitle: 'price', image: 'image', view: 'grid', backendQuery: true, countNoun: ['product', 'products'] },
79
87
  himiOwnerModules: { instanceInput: 'module', rows: 'rows', title: 'title', subtitle: 'subtitle', image: 'image', filter: 'statusLabel', view: 'list', paged: true, reviewAction: 'prepareRecord', reviewSelectedAction: 'prepareSelected' },
@@ -208,7 +216,15 @@ export function projectCollection(source: CollectionRow[], config: CollectionCon
208
216
  ...(config.endedWhen ? (() => {
209
217
  const ended = row[config.endedWhen] === true || (config.endedWhen === 'isPast' && row.statusLabel === 'Past');
210
218
  return { collectionEnded: ended, collectionNotEnded: !ended };
211
- })() : {}) })),
219
+ })() : {}),
220
+ // A row restored from state saved by an older build has no badge flag. An unset hidden flag
221
+ // fails open and would paint an empty chip, so it reads as "no badge" until a refresh.
222
+ ...(config.dateBadge && typeof row[config.dateBadge.hidden] !== 'boolean'
223
+ ? { [config.dateBadge.text]: '', [config.dateBadge.hidden]: true } : {}),
224
+ // Same for a per-row verb: an unset hidden flag fails open and would show a verb with an unresolved
225
+ // label, so a row without the flag offers no action until a refresh establishes one.
226
+ ...(config.primaryVerb?.hiddenPath && typeof row[config.primaryVerb.hiddenPath] !== 'boolean'
227
+ ? { ...(config.primaryVerb.labelPath ? { [config.primaryVerb.labelPath]: '' } : {}), [config.primaryVerb.hiddenPath]: true } : {}) })),
212
228
  filters, loaded: rows.length,
213
229
  };
214
230
  }
@@ -1,3 +1,4 @@
1
+ import { descriptionBody } from "./rich-body.js";
1
2
  // Shared restaurants-menu shaping for himi workers (branded-lite `restaurants`
2
3
  // vertical): dish cards + menu categories derived from the Wix Restaurants
3
4
  // Menus hierarchy (menu → sections → items). Used by BOTH the menus worker
@@ -166,7 +167,7 @@ export function itemPriceVariants(item: WixItem): Array<{ id: string; variantId:
166
167
 
167
168
  /** HTML-stripped, whitespace-collapsed description snippet (≤ 90 chars). */
168
169
  export function descriptionSnippet(value: unknown, maxLength = 90): string {
169
- const text = (typeof value === "string" ? value : "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
170
+ const text = descriptionBody(value).bodyText.replace(/\s+/g, " ").trim();
170
171
  return text.length > maxLength ? `${text.slice(0, maxLength - 1).trimEnd()}…` : text;
171
172
  }
172
173
 
@@ -0,0 +1,164 @@
1
+ // [rico] #3371 — how an owner form reads a RichContentEditor out of `submit(s, values)`.
2
+ //
3
+ // The editor writes its Ricos document into the Form's value bag as a JSON STRING under its `name`,
4
+ // on every change and again on blur. The value is ABSENT when the editor never became ready (the
5
+ // engine page is not bundled, failed, or timed out): the stored body must then stay exactly as it is
6
+ // (user decision, 2026-09-26 — save everything but the body). A document is written exactly as the
7
+ // editor produced it: never re-encoded (encodeRichContent is the VIEWER's; it rewrites media ids and
8
+ // drops nodes the owner never touched).
9
+ // Inside the platform source this import is a relative path, so node test runs resolve it; an app's
10
+ // copy imports "@himalaya/wix-rich-content".
11
+ import { parseRicosJson, isPlainRicos, richContentOverLimits, type RicosDocument } from "@himalaya/wix-rich-content";
12
+
13
+ export type EditorValue =
14
+ | { kind: "absent" } // leave the stored body untouched
15
+ | { kind: "unchanged" } // byte-identical to the seed: nothing to write
16
+ | { kind: "doc"; doc: RicosDocument; json: string } // write `doc`; `json` is the editor's own string
17
+ | { kind: "too_large" } // past the rich-content limits: save the rest, say why
18
+ | { kind: "invalid" }; // not a Ricos document: refuse, write nothing
19
+
20
+ const TEXT_ONLY = new Set(["PARAGRAPH", "TEXT", "HEADING", "BULLETED_LIST", "ORDERED_LIST", "LIST_ITEM", "BLOCKQUOTE", "CODE_BLOCK"]);
21
+ /** No visible text and no non-text node (an image, a divider, an embed…): an empty body. */
22
+ export function isEmptyDocument(doc: RicosDocument): boolean {
23
+ const empty = (nodes: RicosDocument["nodes"] | undefined): boolean => (nodes ?? []).every((n) =>
24
+ TEXT_ONLY.has(String(n?.type)) && !String(n.textData?.text ?? "").trim() && empty(n.nodes));
25
+ return empty(doc.nodes);
26
+ }
27
+
28
+ /** A Ricos JSON string checked as every viewer would: the limits first, then the shape. */
29
+ function checkedDocument(raw: string): EditorValue {
30
+ // Every viewer renders a body past the limits as its fallback, so it is never written. One parse
31
+ // feeds both checks; a string past the byte limit is refused before it is parsed at all.
32
+ if (richContentOverLimits(raw, null) === "too_large") return { kind: "too_large" };
33
+ const doc = parseRicosJson(raw);
34
+ if (!doc) return { kind: "invalid" };
35
+ return richContentOverLimits(raw, doc) ? { kind: "too_large" } : { kind: "doc", doc, json: raw };
36
+ }
37
+
38
+ /** `raw` is `values[name]`; `seededJson` is the string the form published as the editor's seed. */
39
+ export function editorValue(raw: unknown, seededJson: string): EditorValue {
40
+ if (typeof raw !== "string" || raw === "") return { kind: "absent" };
41
+ if (seededJson !== "" && raw === seededJson) return { kind: "unchanged" };
42
+ const checked = checkedDocument(raw);
43
+ // An empty editor over no body (a record that had none) writes nothing, rather than an empty document.
44
+ if (checked.kind === "doc" && seededJson === "" && isEmptyDocument(checked.doc)) return { kind: "unchanged" };
45
+ return checked;
46
+ }
47
+
48
+ // ── The per-field editor machinery every owner form shares (post body, event / product description,
49
+ // FAQ answer). Each form keeps `<key>Json` (the seed), `<key>Pending` and `<key>Dirty` in its state.
50
+
51
+ /** `<key>Pending`: until this run's load lands, the descriptor hides the editor — it seeds ONCE, so a
52
+ * provisional editor the owner typed into would keep that text over the real document.
53
+ * `<key>Dirty`: the editor's on_change fired since the field was loaded or saved. Once ready the bag
54
+ * ALWAYS holds a document — the engine's own re-serialization of the seed, not byte-equal to it — so
55
+ * only this says the owner edited the field. Every arm fires a pending on_change before it releases a
56
+ * Form submit, so an edit made inside the debounce window is reported before the submit reads it. */
57
+ export interface EditorGate { pending: boolean; dirty: boolean }
58
+
59
+ /** What a live submit does with `values[name]`: only an edit the editor reported counts. */
60
+ export function editorSubmitValue(raw: unknown, seededJson: string, gate: EditorGate): EditorValue {
61
+ return gate.pending || !gate.dirty ? { kind: "absent" } : editorValue(raw, seededJson);
62
+ }
63
+
64
+ /** A queued write's document. A replay runs in a FRESH worker with no editor, so the string is checked
65
+ * again (shape and limits); "absent" when the item carries none. Never "unchanged": it was an edit. */
66
+ export function queuedDocument(raw: unknown): EditorValue {
67
+ return typeof raw === "string" && raw !== "" ? checkedDocument(raw) : { kind: "absent" };
68
+ }
69
+
70
+ /** The editor's on_change: the field is now edited, and a confirmation of an earlier save is stale.
71
+ * No timing window: an arm fires the pending on_change BEFORE it releases a submit, so any on_change
72
+ * that arrives after a save carries an edit that save did not write. */
73
+ export function editorChanged<S extends { status: string; savedMessage: string }>(s: S): Pick<S, "status" | "savedMessage"> {
74
+ return { status: s.status === "saved" ? "idle" : s.status, savedMessage: "" };
75
+ }
76
+
77
+ /** The offline cache's verdict on the stored body (`<key>Protected`): rich unless KNOWN plain. From the
78
+ * document when the form knows it; otherwise plain only when the record was loaded as plain. A bundle
79
+ * rolled back past the editor reads this flag to decide whether its plain field may overwrite the body. */
80
+ export function cachedRichVerdict(doc: RicosDocument | null, knownPlain: boolean): "true" | "false" {
81
+ if (doc) return isPlainRicos(doc) ? "false" : "true";
82
+ return knownPlain ? "false" : "true";
83
+ }
84
+
85
+ /** The keys of one editor field that describe THIS run, never the last one: the seed (`<key>Json`),
86
+ * the load gate (`<key>Pending`), the edit flag (`<key>Dirty`) and its counter (`<key>Edits`). A form
87
+ * lists them in `defineService(name, { notHydrated })`, so a cold boot takes their DECLARED values: the
88
+ * editor seeds once, and a persisted seed would be painted as its content and saved back over a newer
89
+ * record. */
90
+ export function editorRunKeys<K extends string>(key: K): [`${K}Json`, `${K}Pending`, `${K}Dirty`, `${K}Edits`] {
91
+ return [`${key}Json`, `${key}Pending`, `${key}Dirty`, `${key}Edits`];
92
+ }
93
+
94
+ /** Does the form already hold `target` with its editor run in progress? A `load` for it then keeps the form as
95
+ * it is: on the way back to a warm worker (its refresh and onAppear) a re-read would race an edit in flight and
96
+ * reset the reported edit, and the editor, which seeds once, would show another document than the state holds.
97
+ * An edit form holds its record once the editor loaded; a create form holds a draft once the owner edited. */
98
+ export function holdsLoadedForm(state: object, target: { id: string; mode: string }, key: string): boolean {
99
+ const s = state as Record<string, unknown>;
100
+ if (s.status === 'error' || s.error || s.mode !== target.mode || (s.id ?? '') !== target.id) return false;
101
+ return target.mode === 'create' ? s[`${key}Dirty`] === true || Number(s[`${key}Edits`] ?? 0) > 0 : s[`${key}Pending`] === false;
102
+ }
103
+
104
+ /** The same keys on a runtime that ignores `notHydrated` (a binary from before #3644, still served new
105
+ * bundles over the air): reset them in place, before any action runs. A no-op where the runtime
106
+ * honours the option (`himalaya.hydrationOptOut`). */
107
+ export function resetHydratedEditorOnOlderRuntime(svc: unknown, key: string, pendingAtBoot: boolean, extra: Record<string, unknown> = {}): void {
108
+ if ((globalThis as { himalaya?: { hydrationOptOut?: unknown } }).himalaya?.hydrationOptOut === true) return;
109
+ const booted = (svc as { getState?: () => Record<string, unknown> | undefined }).getState?.();
110
+ if (!booted || typeof booted !== "object") return;
111
+ if (booted[`${key}Json`]) booted[`${key}Json`] = "";
112
+ booted[`${key}Pending`] = pendingAtBoot;
113
+ booted[`${key}Dirty`] = false;
114
+ booted[`${key}Edits`] = 0;
115
+ Object.assign(booted, extra);
116
+ }
117
+
118
+ /** What an awaited save leaves the field as, read from the LIVE state when it lands. An on_change that
119
+ * arrived while the save was in flight (`<key>Edits` moved) is an edit the save did not write: the
120
+ * field stays dirty and the save's confirmation is stale. Otherwise a save that wrote the field
121
+ * re-bases it as saved. `live` is the service's state now (none, or one that never moved: the start state). */
122
+ export function editorAfterSave(key: string, start: Record<string, unknown>, live: Record<string, unknown> | undefined, wrote: boolean):
123
+ { dirty: boolean; edits: number; editedDuringSave: boolean } {
124
+ const atStart = Number(start[`${key}Edits`] ?? 0);
125
+ const now = Number(live?.[`${key}Edits`] ?? atStart);
126
+ // Only a counter that MOVED ON counts; one behind the start is a host that does not apply results.
127
+ const editedDuringSave = now > atStart;
128
+ return editedDuringSave
129
+ ? { dirty: true, edits: now, editedDuringSave }
130
+ : { dirty: wrote ? false : Boolean(start[`${key}Dirty`]), edits: atStart, editedDuringSave };
131
+ }
132
+
133
+ /** The live state of a service handle, when the runtime gives one. */
134
+ export function liveState(svc: unknown): Record<string, unknown> | undefined {
135
+ const st = (svc as { getState?: () => unknown } | undefined)?.getState?.();
136
+ return st && typeof st === "object" ? st as Record<string, unknown> : undefined;
137
+ }
138
+
139
+ /** An awaited action's result, laid over the LIVE state: only the keys the action CHANGED (against the
140
+ * state it started from) are written, so anything the owner did while it awaited — an edit, a field in
141
+ * the details sheet, closing the sheet — survives a save that lands after it, success or failure. A
142
+ * key both changed goes to the action. Where the host gives no live state, the result as it is. */
143
+ /** An awaited load's result, unless the form moved to another record while it read. On a warm return the host's bare
144
+ * refresh and the screen's onAppear run together: after a save the refresh fetches the record just saved while the
145
+ * onAppear of a create screen opens a blank form, and the refresh landing last turned the new form into that record's
146
+ * edit. Nothing lands then (`undefined`, the runtime's no-op), nor from a load that changes nothing: started with the
147
+ * same state as the onAppear, it would put back the record that one replaced. A load for the record the form still
148
+ * holds lands as it is; so does any load where the host gives no live state. */
149
+ export function landsOnLive<S extends object>(svc: unknown, start: S, result: S): S | undefined {
150
+ if (result === start) return undefined;
151
+ const now = liveState(svc);
152
+ if (!now || now === start) return result;
153
+ const s0 = start as Record<string, unknown>;
154
+ return now.id !== s0.id || now.mode !== s0.mode ? undefined : result;
155
+ }
156
+
157
+ export function settleOverLive<S extends object>(svc: unknown, start: S, result: S): S {
158
+ const now = liveState(svc) as S | undefined;
159
+ if (!now || now === start || now === result) return result;
160
+ const out = { ...now } as Record<string, unknown>;
161
+ const r = result as Record<string, unknown>, s0 = start as Record<string, unknown>;
162
+ for (const k of Object.keys(r)) if (!Object.is(r[k], s0[k])) out[k] = r[k];
163
+ return out as S;
164
+ }
@@ -0,0 +1,50 @@
1
+ import type { StoreProduct } from "./himi-store.js";
2
+ import { cleanTitle } from "./himi-text.js";
3
+ import { descriptionBody } from "./rich-body.js";
4
+ import { isEmptyDocument } from "./owner-editor-value.js";
5
+
6
+ /** V3 returns only section ids and titles for `INFO_SECTION`; the rich and HTML bodies
7
+ * are separate fields. `DESCRIPTION` keeps the product's own Ricos description. A V1
8
+ * catalog ignores all of these. */
9
+ export const PRODUCT_DETAIL_FIELDS = ["DESCRIPTION", "INFO_SECTION", "INFO_SECTION_DESCRIPTION", "INFO_SECTION_PLAIN_DESCRIPTION"] as const;
10
+
11
+ export interface ProductInfoSection {
12
+ id: string;
13
+ title: string;
14
+ body: string;
15
+ bodyJson: string;
16
+ hasBodyJson: boolean;
17
+ noTitle: boolean;
18
+ expanded: boolean;
19
+ collapsed: boolean;
20
+ }
21
+
22
+ /** Keep authored order and bodies; retain expansion only where the source identity is unambiguous. */
23
+ export function productInfoSections(product: StoreProduct, previous: ProductInfoSection[]): ProductInfoSection[] {
24
+ const expanded = new Map(previous.map(section => [section.id, section.expanded]));
25
+ const occurrences = new Map<string, number>();
26
+ const sections = [...(product.infoSections ?? []), ...(product.additionalInfoSections ?? [])];
27
+ const titles = sections.map(section => cleanTitle(section.title));
28
+ const titleCounts = new Map<string, number>();
29
+ const previousTitleCounts = new Map<string, number>();
30
+ for (const title of titles) titleCounts.set(title, (titleCounts.get(title) ?? 0) + 1);
31
+ for (const section of previous) previousTitleCounts.set(section.title, (previousTitleCounts.get(section.title) ?? 0) + 1);
32
+ return sections.flatMap((section, index) => {
33
+ const title = titles[index];
34
+ const sourceId = "uniqueName" in section ? section.uniqueName?.trim() : "";
35
+ const key = sourceId || title;
36
+ const occurrence = occurrences.get(key) ?? 0;
37
+ occurrences.set(key, occurrence + 1);
38
+ const id = `info:${key}:${occurrence}`;
39
+ const fallback = descriptionBody("plainDescription" in section ? section.plainDescription : "").bodyText;
40
+ const rich = descriptionBody(section.description, fallback);
41
+ const body = rich.bodyText.trim() ? rich.bodyText : fallback;
42
+ // The bounded encoder can keep an empty paragraph. It must not hide real plain instructions.
43
+ const bodyJson = rich.bodyJson && !isEmptyDocument(JSON.parse(rich.bodyJson)) ? rich.bodyJson : "";
44
+ if (!body && !bodyJson) return [];
45
+ // V1 supplies no section id: duplicate titles cannot safely carry expansion through a refresh.
46
+ const mayKeepExpanded = !!sourceId || (titleCounts.get(title) === 1 && (previousTitleCounts.get(title) ?? 0) < 2);
47
+ const opened = !title || (mayKeepExpanded && (expanded.get(id) ?? false));
48
+ return [{ id, title, body, bodyJson, hasBodyJson: !!bodyJson, noTitle: !title, expanded: opened, collapsed: !opened }];
49
+ });
50
+ }
@@ -1,7 +1,7 @@
1
1
  // Tier-5 bundle: Himi Blog post detail - reader content plus member actions.
2
2
  import { defineService } from "@himalaya/state";
3
3
  import { share as shareSheet } from "@himalaya/share";
4
- import { getPost, likePost, unlikePost, type WixPost } from "@himalaya/wix-blog";
4
+ import { getPost, likePost, unlikePost, type WixPost, type WixPostWithContent } from "@himalaya/wix-blog";
5
5
  import { comments, BLOG_COMMENTS_APP_ID, blogCommentRow, listBlogComments, type WixBlogCommentRow } from "@himalaya/wix-comments";
6
6
  import { get, type DbEntity } from "@himalaya/local-db";
7
7
  import { isSavedId, toggleSavedId } from "../_shared/himi-blog-saved";
@@ -38,6 +38,7 @@ interface S {
38
38
  signInRequired: boolean; noSignIn: boolean; signInScreenId: string;
39
39
  status: "loading" | "ready" | "error";
40
40
  id: string;
41
+ commentResourceId: string;
41
42
  title: string;
42
43
  subtitle: string;
43
44
  /** Author byline ("By <name>") — resolved from the post payload's writer-ish
@@ -80,7 +81,7 @@ interface S {
80
81
  blogScreenId: string;
81
82
  }
82
83
 
83
- type PostWithExtras = WixPost & {
84
+ type PostWithExtras = WixPostWithContent & {
84
85
  media?: { wixMedia?: { image?: { url?: string } }; embedMedia?: { thumbnail?: { url?: string } } };
85
86
  coverImage?: { image?: { url?: string }; url?: string };
86
87
  metrics?: { likeCount?: number; likes?: number; totalComments?: number; commentCount?: number; comments?: number };
@@ -219,6 +220,7 @@ const baseState: S = derive({
219
220
  ...NO_READ_SIGN_IN, signInScreenId: "himi_account",
220
221
  status: "loading",
221
222
  id: "",
223
+ commentResourceId: "",
222
224
  title: "",
223
225
  subtitle: "",
224
226
  byline: "",
@@ -265,6 +267,7 @@ async function cachedPostState(s: S, id: string): Promise<S> {
265
267
  ...s,
266
268
  status: "ready",
267
269
  id,
270
+ commentResourceId: "",
268
271
  title,
269
272
  subtitle: String(cached.meta ?? ""),
270
273
  excerpt: String(cached.excerpt ?? "").trim(),
@@ -294,19 +297,28 @@ async function loadPostState(s: S): Promise<S | undefined> {
294
297
  }
295
298
  try {
296
299
  const access = await readAccess();
297
- const [postResult, commentsResult] = await Promise.allSettled([getPost(id, {}, { preserveAccessErrors: true }), listBlogComments(id)]);
298
- if (postResult.status === "rejected") throw postResult.reason;
300
+ const response = await getPost(id, { fieldsets: ["RICH_CONTENT", "CONTENT_TEXT", "INTERNAL_ID"] }, { preserveAccessErrors: true });
301
+ await assertReadAccess(access);
302
+ if (version !== loadVersion) return undefined;
303
+ const post = response.post as PostWithExtras;
304
+ // Native Blog v3 Comments scopes by internalId, not the navigation UUID.
305
+ // A missing projection cannot establish that the post has no comments.
306
+ const commentResourceId = post.internalId?.trim() ?? "";
307
+ let commentsUnavailable = !commentResourceId;
308
+ let comments: CommentRow[] = [];
309
+ if (commentResourceId) {
310
+ try { comments = (await listBlogComments(commentResourceId)).map(toCommentRow); }
311
+ catch { commentsUnavailable = true; }
312
+ }
299
313
  await assertReadAccess(access);
300
314
  if (version !== loadVersion) return undefined;
301
- const post = (((postResult.value as unknown as { post?: WixPost }).post) ?? postResult.value) as PostWithExtras;
302
- const commentsUnavailable = commentsResult.status === "rejected";
303
- const comments = commentsResult.status === "fulfilled" ? commentsResult.value.map(toCommentRow) : [];
304
315
  const cover = imageUrl(post);
305
316
  const title = post.title || "Untitled post";
306
317
  return derive({
307
318
  ...clean,
308
319
  status: "ready",
309
320
  id,
321
+ commentResourceId,
310
322
  title,
311
323
  subtitle: subtitle(post),
312
324
  byline: bylineOf(post),
@@ -398,9 +410,10 @@ const svc = defineService<S, {
398
410
  submitComment: async (s) => {
399
411
  const text = s.commentDraft.trim();
400
412
  if (!text) return derive({ ...s, actionMessage: copyParam("blogPost.commentValidation", "Write a comment first.") });
413
+ if (!s.commentResourceId) return derive({ ...s, actionMessage: copyParam("blogPost.commentsUnavailable", "Comments are unavailable right now.") });
401
414
  try {
402
415
  const { comment } = await comments.createComment({
403
- comment: { appId: BLOG_COMMENTS_APP_ID, contextId: s.id, resourceId: s.id, content: { richContent: commentRichContent(text) } },
416
+ comment: { appId: BLOG_COMMENTS_APP_ID, contextId: s.commentResourceId, resourceId: s.commentResourceId, content: { richContent: commentRichContent(text) } },
404
417
  });
405
418
  const created = blogCommentRow(comment);
406
419
  // Named to avoid shadowing the `comments` namespace import in this same block scope.
@@ -1,3 +1,4 @@
1
+ import { descriptionBody } from "../_shared/rich-body.js";
1
2
  // A category-scoped Shop gallery. Reuses Shop's card projection, filters, saved
2
3
  // products, view preferences and App Store price presentation; the route remains
3
4
  // himi_collection { id }. Never substitute the full catalog for a missing category.
@@ -117,12 +118,12 @@ const actions = {
117
118
  const category = (await getStoreCategory(id)).category;
118
119
  if (version !== loadVersion) return undefined;
119
120
  if (!category?.id && !category?.name) return derive({ ...s, ...presence("missing"), loadId: version });
120
- header = { name: category.name ?? "", subtitle: categoryCount(category), description: category.description ?? "" };
121
+ header = { name: category.name ?? "", subtitle: categoryCount(category), description: descriptionBody(category.description).bodyText };
121
122
  } catch {
122
123
  const category = (await getCollection(id)).collection;
123
124
  if (version !== loadVersion) return undefined;
124
125
  if (!category) return derive({ ...s, ...presence("missing"), loadId: version });
125
- header = { name: category.name ?? "", subtitle: "", description: category.description ?? "" };
126
+ header = { name: category.name ?? "", subtitle: "", description: descriptionBody(category.description).bodyText };
126
127
  }
127
128
  } catch (error) {
128
129
  if (version !== loadVersion) return undefined;
@@ -0,0 +1,173 @@
1
+ import { withOnlineWrites } from "../_shared/online-actions.js";
2
+ // himi-branded-lite-notifsettings — reads the site's notification topics + the member's preferences.
3
+ // a failed query is an error with Retry (or Sign in when Wix refuses the
4
+ // visitor) and an empty one is a real empty state — never sample rows presented as
5
+ // the customer's own. Samples appear only in the host's explicit sample preview
6
+ // (_shared/branded-load-state.ts).
7
+ // any exist. INTERACTIVE: tapping a row toggles that topic On/Off — optimistic +
8
+ // best-effort upsertMyNotificationPreferences (a no-op on sample rows).
9
+ import { defineService as registerService } from "@himalaya/state";
10
+ import { withEmptyFlags } from "../_shared/empty-flags.js";
11
+ import { stashCopy } from "../_shared/himi-copy.js";
12
+ import { memberAccess, assertMemberAccess, type MemberAccess } from "../_shared/member-access.js";
13
+ import { LOADING, loaded, loadFailed, type LoadCopy, type LoadFlags } from "../_shared/branded-load-state.js";
14
+ import {
15
+ getNotificationTopics,
16
+ getMyNotificationPreferences,
17
+ upsertMyNotificationPreferences,
18
+ muteStatusFor,
19
+ readTopics,
20
+ readPreferences,
21
+ isDeliveredNow,
22
+ isLocked,
23
+ preferenceFor,
24
+ type NotificationTopicDefinition,
25
+ type PreferenceInfo,
26
+ } from "@himalaya/wix-notification-preferences";
27
+
28
+ /** The channel this surface delivers on — read for the row state, written on toggle.
29
+ * One constant, so the read and the write cannot drift apart. */
30
+ const CHANNEL = "MOBILE";
31
+
32
+ /** `note` is the line under a row's switch — only a locked topic has one. */
33
+ interface Row { id: string; name: string; subtitle: string; note: string; on: boolean; locked: boolean;
34
+ /** Inverse of `locked` (hiddenWhen hides on TRUE) and the plain On/Off a locked row shows. */
35
+ notLocked: boolean; stateLabel: string }
36
+ interface S extends LoadFlags {
37
+ preferencesMember: MemberAccess | null;
38
+ topics: Row[]; emptyText: string; actionMessage: string;
39
+ isMock: boolean; notMock: boolean; /** #2849 — hiddenWhen() hides on TRUE, so these are inverted: the empty-state banner
40
+ * shows only when the site really has none, and the unavailable one only when the
41
+ * query failed. A failed query must never render the sentence that claims the
42
+ * customer has no content. */
43
+ notMockEmpty: boolean; notMockUnavailable: boolean;
44
+ }
45
+
46
+ /** Whether this topic is actually being DELIVERED — not merely what the recipient
47
+ * asked for. `isDeliveredNow` prefers the server's `granted` verdict, so a topic the
48
+ * member unmuted under a channel-wide mute renders OFF instead of promising a
49
+ * notification that will never arrive. No preference row at all ⇒ the topic's default,
50
+ * which is delivery. */
51
+ function isOn(topicId: string, prefs: PreferenceInfo[]): boolean {
52
+ const p = preferenceFor(topicId, prefs, CHANNEL);
53
+ if (!p) return true;
54
+ return isDeliveredNow(p.stateData);
55
+ }
56
+
57
+ /** A row the server says cannot be changed here (a broader rule overrides it). */
58
+ function locked(topicId: string, prefs: PreferenceInfo[]): boolean {
59
+ return isLocked(preferenceFor(topicId, prefs, CHANNEL)?.stateData);
60
+ }
61
+
62
+ /** Row subtitle doubles as an affordance: current state + how to change it. */
63
+ function subtitleFor(on: boolean): string {
64
+ return on ? "On · tap to mute" : "Off · tap to enable";
65
+ }
66
+
67
+ function row(id: string, name: string, on: boolean): Row {
68
+ return { id, name, subtitle: subtitleFor(on), note: "", on, locked: false, notLocked: true, stateLabel: on ? "On" : "Off" };
69
+ }
70
+
71
+ function norm(t: NotificationTopicDefinition, prefs: PreferenceInfo[]): Row {
72
+ const name = (t.displayName || "Notification").trim() || "Notification";
73
+ const id = t.topicId || name;
74
+ const r = row(id, name, isOn(id, prefs));
75
+ // An overridden row says so instead of offering a toggle that cannot take effect.
76
+ return locked(id, prefs)
77
+ ? { ...r, locked: true, notLocked: false, subtitle: "Managed by your channel settings", note: "Managed by your channel settings" }
78
+ : r;
79
+ }
80
+
81
+ const MOCK: Row[] = [
82
+ row("sample-orders", "Order updates", true),
83
+ row("sample-bookings", "Bookings & reminders", true),
84
+ row("sample-promos", "Promotions & offers", false),
85
+ row("sample-community", "Community activity", true),
86
+ ];
87
+
88
+ /** sample rows reach the screen ONLY in the host's explicit sample preview;
89
+ * a failed or empty query is an honest error / empty state (branded-load-state.ts). */
90
+ const COPY: LoadCopy<Row> = {
91
+ prefix: "notifsettings",
92
+ empty: "No notification topics to manage yet.",
93
+ error: "Notification settings couldn't be loaded.",
94
+ signIn: "Sign in to manage your notifications.",
95
+ sample: () => MOCK.map((r) => ({ ...r })),
96
+ };
97
+
98
+ const defineService = withOnlineWrites(registerService, ["toggle"], { messageFields: ["actionMessage"] });
99
+ const INITIAL = { ...LOADING, topics: [] as Row[], emptyText: "", actionMessage: "", preferencesMember: null };
100
+ const signInRequired = () => new Error("Unauthenticated: sign in to manage notifications");
101
+ let loadVersion = 0;
102
+ const svc = defineService<S, {
103
+ prepare: (s: S) => S;
104
+ load: (s: S, arg?: unknown) => Promise<S | undefined>;
105
+ toggle: (s: S, p?: { id?: string; value?: unknown }) => Promise<S | undefined>;
106
+ }>("himiBrandedNotifSettings", withEmptyFlags({
107
+ state: INITIAL,
108
+ actions: {
109
+ prepare: (s) => ({ ...s, ...INITIAL }),
110
+ load: async (s, arg): Promise<S | undefined> => {
111
+ stashCopy(arg);
112
+ const version = ++loadVersion;
113
+ await svc.prepare();
114
+ try {
115
+ const member = await memberAccess();
116
+ if (!member.email) throw signInRequired();
117
+ const [topicsRes, prefsRes] = await Promise.all([
118
+ getNotificationTopics(),
119
+ getMyNotificationPreferences(),
120
+ ]);
121
+ await assertMemberAccess(member);
122
+ const prefs = readPreferences(prefsRes);
123
+ const topics = readTopics(topicsRes).map((t) => norm(t, prefs));
124
+ return version === loadVersion ? { ...s, ...loaded("topics", topics, COPY), preferencesMember: member, actionMessage: "" } : undefined;
125
+ } catch {
126
+ const member = await memberAccess();
127
+ // An authenticated denial is not repaired by an endless sign-in loop.
128
+ const failure = member.email ? new Error(COPY.error) : signInRequired();
129
+ return version === loadVersion ? { ...s, ...loadFailed("topics", failure, COPY), preferencesMember: null, actionMessage: "" } : undefined;
130
+ }
131
+ },
132
+ // Flip one topic's On/Off. Optimistic (updates the row immediately); the real
133
+ // upsert is best-effort and a no-op on sample rows.
134
+ toggle: async (s, p): Promise<S | undefined> => {
135
+ const id = p?.id;
136
+ const target = s.topics.find((r) => r.id === id);
137
+ if (s.busy || !id || !target || target.locked) return undefined;
138
+ if (!s.isMock) {
139
+ try {
140
+ if (!s.preferencesMember) return undefined;
141
+ await assertMemberAccess(s.preferencesMember);
142
+ if (svc.getState().preferencesMember !== s.preferencesMember) return undefined;
143
+ } catch {
144
+ await svc.load();
145
+ return undefined;
146
+ }
147
+ }
148
+ let nextOn = true;
149
+ const topics = s.topics.map((r) => {
150
+ if (r.id !== id) return r;
151
+ // A Toggle sends the NEXT state as `value` (action-payload contract); honour it so
152
+ // a repeated event can never flip the row the wrong way. A bare tap still flips.
153
+ nextOn = typeof p?.value === "boolean" ? p.value : !r.on;
154
+ return { ...r, on: nextOn, subtitle: subtitleFor(nextOn), stateLabel: nextOn ? "On" : "Off" };
155
+ });
156
+ if (!s.isMock && !id.startsWith("sample-")) {
157
+ try {
158
+ // `stateData.state` is a SCALAR enum — the old nested `{ muteStatus }` was a
159
+ // shape this service does not have, so every write was malformed.
160
+ await upsertMyNotificationPreferences([
161
+ { topicId: id, channel: CHANNEL, stateData: { state: muteStatusFor(nextOn) } },
162
+ ]);
163
+ } catch { /* keep the optimistic state */ }
164
+ try { await assertMemberAccess(s.preferencesMember!); }
165
+ catch { await svc.load(); return undefined; }
166
+ }
167
+ return svc.getState().preferencesMember === s.preferencesMember ? { ...svc.getState(), topics } : undefined;
168
+ },
169
+ },
170
+ }, { topics: "noTopics" }));
171
+ svc.prepare();
172
+ svc.load();
173
+ export { svc };