@wix/himalaya-cli 0.1747.0 → 0.1749.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 (381) hide show
  1. package/bin/himi +16 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +3 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +9 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-shell.d.ts +34 -8
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +45 -18
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/l10n.mjs +1 -1
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +36 -14
  8. package/dist/browser-plane/assets.json +7 -7
  9. package/dist/browser-plane/preview-deferred/{63821bbb8f637899037252154a5587f0596e4b537173c7f50551f9e44f7c22c0.bin → b40ea5d0d6251898ff5617139fde8be008dd11e99a70b14c1052093685401700.bin} +1 -1
  10. package/dist/browser-plane/sw.js +6 -6
  11. package/dist/browser-plane/t5-frame.html +1 -1
  12. package/dist/browser-plane/t5-worker-frame.html +1 -1
  13. package/dist/cli.mjs +2616 -1883
  14. package/dist/preview-assets.generated.bin +0 -0
  15. package/guides/component-reference.json +1 -1
  16. package/guides/component-reference.md +9 -0
  17. package/guides/one-app-to-himi-app.md +11 -6
  18. package/guides/wix-business-context.md +25 -1
  19. package/guides/wix-site-to-himi-app.md +2 -1
  20. package/package.json +2 -2
  21. package/template-icons/medical-services.png +0 -0
  22. package/templates/beauty-salon/dev/index.ts +1 -0
  23. package/templates/beauty-salon/l10n/en.json +6 -0
  24. package/templates/beauty-salon/l10n/fr.json +36 -5
  25. package/templates/beauty-salon/l10n/he.json +29 -4
  26. package/templates/beauty-salon/recipes/blog-hero.json +95 -0
  27. package/templates/beauty-salon/recipes/blog-list-thumb-start.json +177 -147
  28. package/templates/beauty-salon/recipes/blog-list.json +172 -142
  29. package/templates/beauty-salon/recipes/events-inline-list.json +30 -5
  30. package/templates/beauty-salon/recipes/events-inline.json +30 -5
  31. package/templates/beauty-salon/recipes/faq-list.json +503 -0
  32. package/templates/beauty-salon/recipes/groups-list.json +196 -0
  33. package/templates/beauty-salon/recipes/products-carousel.json +141 -0
  34. package/templates/beauty-salon/recipes/products-grid.json +143 -0
  35. package/templates/beauty-salon/tier5-src/_shared/blog-list.ts +9 -9
  36. package/templates/beauty-salon/tier5-src/_shared/events-inline.ts +7 -5
  37. package/templates/beauty-salon/tier5-src/_shared/faq-list.ts +405 -0
  38. package/templates/beauty-salon/tier5-src/_shared/groups-section.ts +110 -0
  39. package/templates/beauty-salon/tier5-src/_shared/member-bookings.ts +17 -4
  40. package/templates/beauty-salon/tier5-src/_shared/member-row-extras.ts +10 -2
  41. package/templates/beauty-salon/tier5-src/_shared/members-directory.ts +9 -5
  42. package/templates/beauty-salon/tier5-src/_shared/products-section.ts +76 -0
  43. package/templates/beauty-salon/tier5-src/_shared/programs-section.ts +2 -2
  44. package/templates/beauty-salon/tier5-src/_shared/staff-name.ts +18 -0
  45. package/templates/beauty-salon/tier5-src/himi-booking-bookings/index.ts +6 -2
  46. package/templates/beauty-salon/tier5-src/himi-booking-service/index.ts +7 -2
  47. package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +6 -4
  48. package/templates/beauty-salon-owner/dev/index.ts +54 -0
  49. package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +30 -4
  50. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  51. package/templates/branded-lite/dev/index.ts +1 -0
  52. package/templates/branded-lite/l10n/fr.json +15 -5
  53. package/templates/branded-lite/l10n/he.json +12 -4
  54. package/templates/branded-lite/recipes/blog-hero.json +95 -0
  55. package/templates/branded-lite/recipes/blog-list-thumb-start.json +177 -147
  56. package/templates/branded-lite/recipes/blog-list.json +172 -142
  57. package/templates/branded-lite/recipes/events-inline-list.json +30 -5
  58. package/templates/branded-lite/recipes/events-inline.json +30 -5
  59. package/templates/branded-lite/recipes/faq-list.json +503 -0
  60. package/templates/branded-lite/recipes/groups-list.json +196 -0
  61. package/templates/branded-lite/recipes/products-carousel.json +141 -0
  62. package/templates/branded-lite/recipes/products-grid.json +143 -0
  63. package/templates/branded-lite/tier5-src/_shared/blog-list.ts +9 -9
  64. package/templates/branded-lite/tier5-src/_shared/events-inline.ts +7 -5
  65. package/templates/branded-lite/tier5-src/_shared/faq-list.ts +405 -0
  66. package/templates/branded-lite/tier5-src/_shared/groups-section.ts +110 -0
  67. package/templates/branded-lite/tier5-src/_shared/member-bookings.ts +17 -4
  68. package/templates/branded-lite/tier5-src/_shared/member-row-extras.ts +10 -2
  69. package/templates/branded-lite/tier5-src/_shared/members-directory.ts +9 -5
  70. package/templates/branded-lite/tier5-src/_shared/products-section.ts +76 -0
  71. package/templates/branded-lite/tier5-src/_shared/programs-section.ts +2 -2
  72. package/templates/branded-lite/tier5-src/_shared/staff-name.ts +18 -0
  73. package/templates/branded-lite/tier5-src/himi-booking-bookings/index.ts +6 -2
  74. package/templates/branded-lite/tier5-src/himi-booking-service/index.ts +7 -2
  75. package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +6 -4
  76. package/templates/branded-lite/tier5-src/himi-branded-lite-faq/index.ts +5 -369
  77. package/templates/brandy/README.md +46 -5
  78. package/templates/brandy/config.ts +11 -0
  79. package/templates/brandy/himalaya.template.json +1 -1
  80. package/templates/community-club/dev/index.ts +1 -0
  81. package/templates/community-club/l10n/fr.json +25 -5
  82. package/templates/community-club/l10n/he.json +20 -4
  83. package/templates/community-club/recipes/blog-hero.json +95 -0
  84. package/templates/community-club/recipes/blog-list-thumb-start.json +177 -147
  85. package/templates/community-club/recipes/blog-list.json +172 -142
  86. package/templates/community-club/recipes/events-inline-list.json +30 -5
  87. package/templates/community-club/recipes/events-inline.json +30 -5
  88. package/templates/community-club/recipes/faq-list.json +503 -0
  89. package/templates/community-club/recipes/groups-list.json +196 -0
  90. package/templates/community-club/recipes/products-carousel.json +141 -0
  91. package/templates/community-club/recipes/products-grid.json +143 -0
  92. package/templates/community-club/tier5-src/_shared/blog-list.ts +9 -9
  93. package/templates/community-club/tier5-src/_shared/events-inline.ts +7 -5
  94. package/templates/community-club/tier5-src/_shared/faq-list.ts +405 -0
  95. package/templates/community-club/tier5-src/_shared/groups-section.ts +110 -0
  96. package/templates/community-club/tier5-src/_shared/member-bookings.ts +17 -4
  97. package/templates/community-club/tier5-src/_shared/member-row-extras.ts +10 -2
  98. package/templates/community-club/tier5-src/_shared/members-directory.ts +9 -5
  99. package/templates/community-club/tier5-src/_shared/products-section.ts +76 -0
  100. package/templates/community-club/tier5-src/_shared/programs-section.ts +2 -2
  101. package/templates/community-club-owner/dev/index.ts +54 -0
  102. package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +30 -4
  103. package/templates/community-club-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  104. package/templates/conference/dev/index.ts +1 -0
  105. package/templates/events-meetups/dev/index.ts +1 -0
  106. package/templates/events-meetups/l10n/fr.json +25 -5
  107. package/templates/events-meetups/l10n/he.json +20 -4
  108. package/templates/events-meetups/recipes/blog-hero.json +95 -0
  109. package/templates/events-meetups/recipes/blog-list-thumb-start.json +177 -147
  110. package/templates/events-meetups/recipes/blog-list.json +172 -142
  111. package/templates/events-meetups/recipes/events-inline-list.json +30 -5
  112. package/templates/events-meetups/recipes/events-inline.json +30 -5
  113. package/templates/events-meetups/recipes/faq-list.json +503 -0
  114. package/templates/events-meetups/recipes/groups-list.json +196 -0
  115. package/templates/events-meetups/recipes/products-carousel.json +141 -0
  116. package/templates/events-meetups/recipes/products-grid.json +143 -0
  117. package/templates/events-meetups/tier5-src/_shared/blog-list.ts +9 -9
  118. package/templates/events-meetups/tier5-src/_shared/events-inline.ts +7 -5
  119. package/templates/events-meetups/tier5-src/_shared/faq-list.ts +405 -0
  120. package/templates/events-meetups/tier5-src/_shared/groups-section.ts +110 -0
  121. package/templates/events-meetups/tier5-src/_shared/member-bookings.ts +17 -4
  122. package/templates/events-meetups/tier5-src/_shared/member-row-extras.ts +10 -2
  123. package/templates/events-meetups/tier5-src/_shared/members-directory.ts +9 -5
  124. package/templates/events-meetups/tier5-src/_shared/products-section.ts +76 -0
  125. package/templates/events-meetups/tier5-src/_shared/programs-section.ts +2 -2
  126. package/templates/events-meetups-owner/dev/index.ts +54 -0
  127. package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +30 -4
  128. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  129. package/templates/gym-fitness/dev/index.ts +1 -0
  130. package/templates/gym-fitness/l10n/en.json +6 -0
  131. package/templates/gym-fitness/l10n/fr.json +36 -5
  132. package/templates/gym-fitness/l10n/he.json +29 -4
  133. package/templates/gym-fitness/recipes/blog-hero.json +95 -0
  134. package/templates/gym-fitness/recipes/blog-list-thumb-start.json +177 -147
  135. package/templates/gym-fitness/recipes/blog-list.json +172 -142
  136. package/templates/gym-fitness/recipes/events-inline-list.json +30 -5
  137. package/templates/gym-fitness/recipes/events-inline.json +30 -5
  138. package/templates/gym-fitness/recipes/faq-list.json +503 -0
  139. package/templates/gym-fitness/recipes/groups-list.json +196 -0
  140. package/templates/gym-fitness/recipes/products-carousel.json +141 -0
  141. package/templates/gym-fitness/recipes/products-grid.json +143 -0
  142. package/templates/gym-fitness/tier5-src/_shared/blog-list.ts +9 -9
  143. package/templates/gym-fitness/tier5-src/_shared/events-inline.ts +7 -5
  144. package/templates/gym-fitness/tier5-src/_shared/faq-list.ts +405 -0
  145. package/templates/gym-fitness/tier5-src/_shared/groups-section.ts +110 -0
  146. package/templates/gym-fitness/tier5-src/_shared/member-bookings.ts +17 -4
  147. package/templates/gym-fitness/tier5-src/_shared/member-row-extras.ts +10 -2
  148. package/templates/gym-fitness/tier5-src/_shared/members-directory.ts +9 -5
  149. package/templates/gym-fitness/tier5-src/_shared/products-section.ts +76 -0
  150. package/templates/gym-fitness/tier5-src/_shared/programs-section.ts +2 -2
  151. package/templates/gym-fitness/tier5-src/_shared/staff-name.ts +18 -0
  152. package/templates/gym-fitness/tier5-src/himi-booking-bookings/index.ts +6 -2
  153. package/templates/gym-fitness/tier5-src/himi-booking-service/index.ts +7 -2
  154. package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +6 -4
  155. package/templates/gym-fitness-owner/dev/index.ts +54 -0
  156. package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +30 -4
  157. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  158. package/templates/medical-services/README.md +53 -0
  159. package/templates/medical-services/config.ts +320 -0
  160. package/templates/medical-services/dev/index.ts +17783 -0
  161. package/templates/medical-services/himalaya.content.json +46 -0
  162. package/templates/medical-services/himalaya.template.json +14 -0
  163. package/templates/medical-services/icon.png +0 -0
  164. package/templates/medical-services/platforms.json +1 -0
  165. package/templates/medical-services/tier5-src/_shared/app-locale.ts +61 -0
  166. package/templates/medical-services/tier5-src/_shared/booking-location.ts +147 -0
  167. package/templates/medical-services/tier5-src/_shared/booking-session.ts +222 -0
  168. package/templates/medical-services/tier5-src/_shared/branded-lite-hosted.ts +280 -0
  169. package/templates/medical-services/tier5-src/_shared/branded-load-state.ts +109 -0
  170. package/templates/medical-services/tier5-src/_shared/business-chat-copy.ts +40 -0
  171. package/templates/medical-services/tier5-src/_shared/business-chat-history.ts +51 -0
  172. package/templates/medical-services/tier5-src/_shared/business-chat-message-model.ts +177 -0
  173. package/templates/medical-services/tier5-src/_shared/business-chat-model.ts +56 -0
  174. package/templates/medical-services/tier5-src/_shared/business-chat-presenter.ts +576 -0
  175. package/templates/medical-services/tier5-src/_shared/business-chat-transport.ts +148 -0
  176. package/templates/medical-services/tier5-src/_shared/collection-contract.ts +228 -0
  177. package/templates/medical-services/tier5-src/_shared/collection-query.ts +193 -0
  178. package/templates/medical-services/tier5-src/_shared/collection-service.ts +400 -0
  179. package/templates/medical-services/tier5-src/_shared/engine-intl.ts +523 -0
  180. package/templates/medical-services/tier5-src/_shared/faq-list.ts +405 -0
  181. package/templates/medical-services/tier5-src/_shared/himi-account.ts +194 -0
  182. package/templates/medical-services/tier5-src/_shared/himi-booking-saved.ts +88 -0
  183. package/templates/medical-services/tier5-src/_shared/himi-bookings.ts +318 -0
  184. package/templates/medical-services/tier5-src/_shared/himi-copy.ts +116 -0
  185. package/templates/medical-services/tier5-src/_shared/himi-store.ts +7 -0
  186. package/templates/medical-services/tier5-src/_shared/himi-text.ts +24 -0
  187. package/templates/medical-services/tier5-src/_shared/host-events.ts +66 -0
  188. package/templates/medical-services/tier5-src/_shared/hosted-checkout.ts +70 -0
  189. package/templates/medical-services/tier5-src/_shared/iap-attendance-form.ts +106 -0
  190. package/templates/medical-services/tier5-src/_shared/iap-attendance-purchase.ts +216 -0
  191. package/templates/medical-services/tier5-src/_shared/iap-attendance.ts +38 -0
  192. package/templates/medical-services/tier5-src/_shared/iap-worker.ts +127 -0
  193. package/templates/medical-services/tier5-src/_shared/inbox-rooms.ts +68 -0
  194. package/templates/medical-services/tier5-src/_shared/local-preferences.ts +38 -0
  195. package/templates/medical-services/tier5-src/_shared/member-access.ts +52 -0
  196. package/templates/medical-services/tier5-src/_shared/member-account-routes.ts +52 -0
  197. package/templates/medical-services/tier5-src/_shared/member-bookings.ts +107 -0
  198. package/templates/medical-services/tier5-src/_shared/member-screen.ts +99 -0
  199. package/templates/medical-services/tier5-src/_shared/notification-target.ts +141 -0
  200. package/templates/medical-services/tier5-src/_shared/offset-page.ts +10 -0
  201. package/templates/medical-services/tier5-src/_shared/online-actions.ts +76 -0
  202. package/templates/medical-services/tier5-src/_shared/owner-load-error.ts +348 -0
  203. package/templates/medical-services/tier5-src/_shared/payment-setup.ts +6 -0
  204. package/templates/medical-services/tier5-src/_shared/rich-body.ts +78 -0
  205. package/templates/medical-services/tier5-src/_shared/rich-content-link.ts +34 -0
  206. package/templates/medical-services/tier5-src/_shared/sign-in-sheet.ts +18 -0
  207. package/templates/medical-services/tier5-src/_shared/staff-name.ts +18 -0
  208. package/templates/medical-services/tier5-src/_shared/weekly-goal.ts +107 -0
  209. package/templates/medical-services/tier5-src/_shared/wix-bi.ts +85 -0
  210. package/templates/medical-services/tier5-src/_shared/wix-member-links.ts +114 -0
  211. package/templates/medical-services/tier5-src/_shared/wix-service-price.ts +146 -0
  212. package/templates/medical-services/tier5-src/business-chat/index.ts +732 -0
  213. package/templates/medical-services/tier5-src/himi-booking-account/index.ts +252 -0
  214. package/templates/medical-services/tier5-src/himi-booking-bookings/index.ts +468 -0
  215. package/templates/medical-services/tier5-src/himi-booking-service/index.ts +1190 -0
  216. package/templates/medical-services/tier5-src/himi-booking-services/index.ts +791 -0
  217. package/templates/medical-services/tier5-src/himi-booking-time/index.ts +1729 -0
  218. package/templates/medical-services/tier5-src/himi-branded-lite-faq/index.ts +6 -0
  219. package/templates/medical-services/tier5-src/himi-branded-lite-notifications/index.ts +256 -0
  220. package/templates/medical-services/tier5-src/himi-clinic-home/index.ts +389 -0
  221. package/templates/medical-services/tier5-src/himi-store-account/index.ts +998 -0
  222. package/templates/medical-services/tokens.json +418 -0
  223. package/templates/nonprofit-cause/dev/index.ts +1 -0
  224. package/templates/nonprofit-cause/l10n/fr.json +25 -5
  225. package/templates/nonprofit-cause/l10n/he.json +20 -4
  226. package/templates/nonprofit-cause/recipes/blog-hero.json +95 -0
  227. package/templates/nonprofit-cause/recipes/blog-list-thumb-start.json +177 -147
  228. package/templates/nonprofit-cause/recipes/blog-list.json +172 -142
  229. package/templates/nonprofit-cause/recipes/events-inline-list.json +30 -5
  230. package/templates/nonprofit-cause/recipes/events-inline.json +30 -5
  231. package/templates/nonprofit-cause/recipes/faq-list.json +503 -0
  232. package/templates/nonprofit-cause/recipes/groups-list.json +196 -0
  233. package/templates/nonprofit-cause/recipes/products-carousel.json +141 -0
  234. package/templates/nonprofit-cause/recipes/products-grid.json +143 -0
  235. package/templates/nonprofit-cause/tier5-src/_shared/blog-list.ts +9 -9
  236. package/templates/nonprofit-cause/tier5-src/_shared/events-inline.ts +7 -5
  237. package/templates/nonprofit-cause/tier5-src/_shared/faq-list.ts +405 -0
  238. package/templates/nonprofit-cause/tier5-src/_shared/groups-section.ts +110 -0
  239. package/templates/nonprofit-cause/tier5-src/_shared/member-bookings.ts +17 -4
  240. package/templates/nonprofit-cause/tier5-src/_shared/member-row-extras.ts +10 -2
  241. package/templates/nonprofit-cause/tier5-src/_shared/members-directory.ts +9 -5
  242. package/templates/nonprofit-cause/tier5-src/_shared/products-section.ts +76 -0
  243. package/templates/nonprofit-cause/tier5-src/_shared/programs-section.ts +2 -2
  244. package/templates/nonprofit-cause-owner/dev/index.ts +54 -0
  245. package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +30 -4
  246. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  247. package/templates/owner-lite/dev/index.ts +54 -0
  248. package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +30 -4
  249. package/templates/owner-lite/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  250. package/templates/podcast-creator/dev/index.ts +1 -0
  251. package/templates/podcast-creator/l10n/fr.json +35 -5
  252. package/templates/podcast-creator/l10n/he.json +28 -4
  253. package/templates/podcast-creator/recipes/blog-hero.json +95 -0
  254. package/templates/podcast-creator/recipes/blog-list-thumb-start.json +177 -147
  255. package/templates/podcast-creator/recipes/blog-list.json +172 -142
  256. package/templates/podcast-creator/recipes/events-inline-list.json +30 -5
  257. package/templates/podcast-creator/recipes/events-inline.json +30 -5
  258. package/templates/podcast-creator/recipes/faq-list.json +503 -0
  259. package/templates/podcast-creator/recipes/groups-list.json +196 -0
  260. package/templates/podcast-creator/recipes/products-carousel.json +141 -0
  261. package/templates/podcast-creator/recipes/products-grid.json +143 -0
  262. package/templates/podcast-creator/tier5-src/_shared/blog-list.ts +9 -9
  263. package/templates/podcast-creator/tier5-src/_shared/events-inline.ts +7 -5
  264. package/templates/podcast-creator/tier5-src/_shared/faq-list.ts +405 -0
  265. package/templates/podcast-creator/tier5-src/_shared/groups-section.ts +110 -0
  266. package/templates/podcast-creator/tier5-src/_shared/member-bookings.ts +17 -4
  267. package/templates/podcast-creator/tier5-src/_shared/member-row-extras.ts +10 -2
  268. package/templates/podcast-creator/tier5-src/_shared/members-directory.ts +9 -5
  269. package/templates/podcast-creator/tier5-src/_shared/products-section.ts +76 -0
  270. package/templates/podcast-creator/tier5-src/_shared/programs-section.ts +2 -2
  271. package/templates/podcast-creator-owner/dev/index.ts +54 -0
  272. package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +30 -4
  273. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  274. package/templates/portfolio-creative/dev/index.ts +1 -0
  275. package/templates/portfolio-creative/l10n/fr.json +25 -5
  276. package/templates/portfolio-creative/l10n/he.json +20 -4
  277. package/templates/portfolio-creative/recipes/blog-hero.json +95 -0
  278. package/templates/portfolio-creative/recipes/blog-list-thumb-start.json +177 -147
  279. package/templates/portfolio-creative/recipes/blog-list.json +172 -142
  280. package/templates/portfolio-creative/recipes/events-inline-list.json +30 -5
  281. package/templates/portfolio-creative/recipes/events-inline.json +30 -5
  282. package/templates/portfolio-creative/recipes/faq-list.json +503 -0
  283. package/templates/portfolio-creative/recipes/groups-list.json +196 -0
  284. package/templates/portfolio-creative/recipes/products-carousel.json +141 -0
  285. package/templates/portfolio-creative/recipes/products-grid.json +143 -0
  286. package/templates/portfolio-creative/tier5-src/_shared/blog-list.ts +9 -9
  287. package/templates/portfolio-creative/tier5-src/_shared/events-inline.ts +7 -5
  288. package/templates/portfolio-creative/tier5-src/_shared/faq-list.ts +405 -0
  289. package/templates/portfolio-creative/tier5-src/_shared/groups-section.ts +110 -0
  290. package/templates/portfolio-creative/tier5-src/_shared/member-bookings.ts +17 -4
  291. package/templates/portfolio-creative/tier5-src/_shared/member-row-extras.ts +10 -2
  292. package/templates/portfolio-creative/tier5-src/_shared/members-directory.ts +9 -5
  293. package/templates/portfolio-creative/tier5-src/_shared/products-section.ts +76 -0
  294. package/templates/portfolio-creative/tier5-src/_shared/programs-section.ts +2 -2
  295. package/templates/portfolio-creative-owner/dev/index.ts +54 -0
  296. package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +30 -4
  297. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  298. package/templates/restaurant/dev/index.ts +1 -0
  299. package/templates/restaurant/l10n/fr.json +35 -5
  300. package/templates/restaurant/l10n/he.json +28 -4
  301. package/templates/restaurant/recipes/blog-hero.json +95 -0
  302. package/templates/restaurant/recipes/blog-list-thumb-start.json +177 -147
  303. package/templates/restaurant/recipes/blog-list.json +172 -142
  304. package/templates/restaurant/recipes/events-inline-list.json +30 -5
  305. package/templates/restaurant/recipes/events-inline.json +30 -5
  306. package/templates/restaurant/recipes/faq-list.json +503 -0
  307. package/templates/restaurant/recipes/groups-list.json +196 -0
  308. package/templates/restaurant/recipes/products-carousel.json +141 -0
  309. package/templates/restaurant/recipes/products-grid.json +143 -0
  310. package/templates/restaurant/tier5-src/_shared/blog-list.ts +9 -9
  311. package/templates/restaurant/tier5-src/_shared/events-inline.ts +7 -5
  312. package/templates/restaurant/tier5-src/_shared/faq-list.ts +405 -0
  313. package/templates/restaurant/tier5-src/_shared/groups-section.ts +110 -0
  314. package/templates/restaurant/tier5-src/_shared/member-bookings.ts +17 -4
  315. package/templates/restaurant/tier5-src/_shared/member-row-extras.ts +10 -2
  316. package/templates/restaurant/tier5-src/_shared/members-directory.ts +9 -5
  317. package/templates/restaurant/tier5-src/_shared/products-section.ts +76 -0
  318. package/templates/restaurant/tier5-src/_shared/programs-section.ts +2 -2
  319. package/templates/restaurant-owner/dev/index.ts +54 -0
  320. package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +30 -4
  321. package/templates/restaurant-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  322. package/templates/retail-store/dev/index.ts +1 -0
  323. package/templates/retail-store/l10n/fr.json +25 -5
  324. package/templates/retail-store/l10n/he.json +20 -4
  325. package/templates/retail-store/recipes/blog-hero.json +95 -0
  326. package/templates/retail-store/recipes/blog-list-thumb-start.json +177 -147
  327. package/templates/retail-store/recipes/blog-list.json +172 -142
  328. package/templates/retail-store/recipes/events-inline-list.json +30 -5
  329. package/templates/retail-store/recipes/events-inline.json +30 -5
  330. package/templates/retail-store/recipes/faq-list.json +503 -0
  331. package/templates/retail-store/recipes/groups-list.json +196 -0
  332. package/templates/retail-store/recipes/products-carousel.json +141 -0
  333. package/templates/retail-store/recipes/products-grid.json +143 -0
  334. package/templates/retail-store/tier5-src/_shared/blog-list.ts +9 -9
  335. package/templates/retail-store/tier5-src/_shared/events-inline.ts +7 -5
  336. package/templates/retail-store/tier5-src/_shared/faq-list.ts +405 -0
  337. package/templates/retail-store/tier5-src/_shared/groups-section.ts +110 -0
  338. package/templates/retail-store/tier5-src/_shared/member-bookings.ts +17 -4
  339. package/templates/retail-store/tier5-src/_shared/member-row-extras.ts +10 -2
  340. package/templates/retail-store/tier5-src/_shared/members-directory.ts +9 -5
  341. package/templates/retail-store/tier5-src/_shared/products-section.ts +76 -0
  342. package/templates/retail-store/tier5-src/_shared/programs-section.ts +2 -2
  343. package/templates/retail-store-owner/dev/index.ts +54 -0
  344. package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +30 -4
  345. package/templates/retail-store-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  346. package/templates/salon-spa/dev/index.ts +1 -0
  347. package/templates/salon-spa/tier5-src/_shared/member-bookings.ts +17 -4
  348. package/templates/salon-spa/tier5-src/_shared/staff-name.ts +18 -0
  349. package/templates/salon-spa/tier5-src/himi-booking-bookings/index.ts +6 -2
  350. package/templates/salon-spa/tier5-src/himi-booking-service/index.ts +7 -2
  351. package/templates/salon-spa/tier5-src/himi-booking-time/index.ts +6 -4
  352. package/templates/wholesale-store/dev/index.ts +1 -0
  353. package/templates/yoga-studio/dev/index.ts +1 -0
  354. package/templates/yoga-studio/l10n/en.json +6 -0
  355. package/templates/yoga-studio/l10n/fr.json +46 -5
  356. package/templates/yoga-studio/l10n/he.json +37 -4
  357. package/templates/yoga-studio/recipes/blog-hero.json +95 -0
  358. package/templates/yoga-studio/recipes/blog-list-thumb-start.json +177 -147
  359. package/templates/yoga-studio/recipes/blog-list.json +172 -142
  360. package/templates/yoga-studio/recipes/events-inline-list.json +30 -5
  361. package/templates/yoga-studio/recipes/events-inline.json +30 -5
  362. package/templates/yoga-studio/recipes/faq-list.json +503 -0
  363. package/templates/yoga-studio/recipes/groups-list.json +196 -0
  364. package/templates/yoga-studio/recipes/products-carousel.json +141 -0
  365. package/templates/yoga-studio/recipes/products-grid.json +143 -0
  366. package/templates/yoga-studio/tier5-src/_shared/blog-list.ts +9 -9
  367. package/templates/yoga-studio/tier5-src/_shared/events-inline.ts +7 -5
  368. package/templates/yoga-studio/tier5-src/_shared/faq-list.ts +405 -0
  369. package/templates/yoga-studio/tier5-src/_shared/groups-section.ts +110 -0
  370. package/templates/yoga-studio/tier5-src/_shared/member-bookings.ts +17 -4
  371. package/templates/yoga-studio/tier5-src/_shared/member-row-extras.ts +10 -2
  372. package/templates/yoga-studio/tier5-src/_shared/members-directory.ts +9 -5
  373. package/templates/yoga-studio/tier5-src/_shared/products-section.ts +76 -0
  374. package/templates/yoga-studio/tier5-src/_shared/programs-section.ts +2 -2
  375. package/templates/yoga-studio/tier5-src/_shared/staff-name.ts +18 -0
  376. package/templates/yoga-studio/tier5-src/himi-booking-bookings/index.ts +6 -2
  377. package/templates/yoga-studio/tier5-src/himi-booking-service/index.ts +7 -2
  378. package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +6 -4
  379. package/templates/yoga-studio-owner/dev/index.ts +54 -0
  380. package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +30 -4
  381. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
@@ -0,0 +1,405 @@
1
+ // The FAQ as a registrable service: one worker for the himi_faq screen and for a migrated page's FAQ section.
2
+ // registerFaqList(name) -> the screen: every question, search, categories (the himi_faq bundle is this call);
3
+ // registerFaqList(name, options) -> a section: `limit` (the source's NumberOfFAQs), `showCategories`, `firstOpen`, `oneAtATime`, `showSearch`.
4
+ // State and flags are the screen's own (`loadingHidden`, `errorHidden`, ...), so the faq-list recipe and the himi_faq descriptor bind the same names.
5
+ import { defineService } from "@himalaya/state";
6
+ import {
7
+ queryCategories,
8
+ queryQuestionEntries,
9
+ type WixCategory,
10
+ type WixQuestionEntry,
11
+ } from "@himalaya/wix-faq";
12
+ import { openRichLink } from "../_shared/rich-content-link.js";
13
+ import { richBody, ROW_IMAGE_WIDTH } from "../_shared/rich-body.js";
14
+
15
+ interface FaqQuestion {
16
+ id: string;
17
+ categoryId: string;
18
+ question: string;
19
+ /** The PLAIN_TEXT answer: the RichContent fallback, and what shows with no trusted document. */
20
+ answer: string;
21
+ /** [rico] #3372 — the RICH_CONTENT answer as ONE document string, used ONLY when its text matches the plain
22
+ * answer (a legacy DraftJS record converts unreliably); "" otherwise. */
23
+ answerJson: string;
24
+ /** answerJson !== "" — gates the plain answer, because RichContent draws nothing for "". */
25
+ hasAnswerJson: boolean;
26
+ sortOrder?: number;
27
+ status: string;
28
+ }
29
+
30
+ interface FaqCategory {
31
+ id: string;
32
+ title: string;
33
+ sortOrder?: number;
34
+ }
35
+
36
+ interface QuestionRow {
37
+ id: string;
38
+ title: string;
39
+ answer: string;
40
+ answerJson: string;
41
+ hasAnswerJson: boolean;
42
+ expanded: boolean;
43
+ }
44
+
45
+ interface CategorySection {
46
+ id: string;
47
+ title: string;
48
+ questions: QuestionRow[];
49
+ }
50
+
51
+ interface FaqDisplayRow extends QuestionRow {
52
+ categoryTitle: string;
53
+ categoryHeaderHidden: boolean;
54
+ }
55
+
56
+ interface FaqState {
57
+ status: "loading" | "ready" | "error" | "forbidden" | "notInstalled";
58
+ categories: FaqCategory[];
59
+ questions: FaqQuestion[];
60
+ sections: CategorySection[];
61
+ rows: FaqDisplayRow[];
62
+ query: string;
63
+ expandedIds: string[];
64
+ otherTitle: string;
65
+ loadingHidden: boolean;
66
+ contentHidden: boolean;
67
+ emptyHidden: boolean;
68
+ errorHidden: boolean;
69
+ forbiddenHidden: boolean;
70
+ notInstalledHidden: boolean;
71
+ /** The section's search field is off (the source's showSearchBar is false). */
72
+ searchHidden: boolean;
73
+ }
74
+
75
+ /** What a source FAQ section sets. Every option defaults to what the himi_faq screen does. */
76
+ export interface FaqListOptions {
77
+ /** Show at most this many questions (the source's NumberOfFAQs). */
78
+ limit?: number;
79
+ /** false: no category headers. */
80
+ showCategories?: boolean;
81
+ /** Open the first question when the list first loads. */
82
+ firstOpen?: boolean;
83
+ /** Opening a question closes the others. */
84
+ oneAtATime?: boolean;
85
+ /** false: no search field. */
86
+ showSearch?: boolean;
87
+ }
88
+
89
+ const PAGE_SIZE = 100;
90
+
91
+ /** Caps on the static pairs, matching `BRANDED_LITE_FAQ_LIMITS` in the app contract. The
92
+ * param is re-bounded here because a worker must not trust a descriptor it did not build. */
93
+ const STATIC_LIMITS = { pairs: 20, question: 200, answer: 1500 } as const;
94
+ const STATIC_CATEGORY: FaqCategory = { id: "himi-static-faq", title: "" };
95
+
96
+ /** The site's own FAQ pairs — questions it publishes as page sections rather than
97
+ * through the Wix FAQ app, carried in by `site analyze --apply` as the `staticFaq` onAppear
98
+ * param (a JSON string: action params are string-valued). They are the FALLBACK: shown only
99
+ * when the FAQ app yields no visible question, so an owner-edited Wix FAQ always wins. */
100
+
101
+ function parseStaticFaq(raw: unknown): FaqQuestion[] {
102
+ let pairs: unknown = raw;
103
+ if (typeof raw === "string") {
104
+ try {
105
+ pairs = JSON.parse(raw);
106
+ } catch {
107
+ // A malformed param is a DESCRIPTOR bug, not an empty FAQ: there is no fallback to
108
+ // offer, so the screen shows exactly what the Wix FAQ read says — its content, its
109
+ // empty card, or its error card — rather than pretending the site has no questions.
110
+ pairs = undefined;
111
+ }
112
+ }
113
+ if (!Array.isArray(pairs)) return [];
114
+ const out: FaqQuestion[] = [];
115
+ for (const pair of pairs) {
116
+ if (out.length >= STATIC_LIMITS.pairs) break;
117
+ const row = pair && typeof pair === "object" ? pair as { q?: unknown; a?: unknown } : {};
118
+ const question = typeof row.q === "string" ? row.q.trim().slice(0, STATIC_LIMITS.question) : "";
119
+ const answer = typeof row.a === "string" ? row.a.trim().slice(0, STATIC_LIMITS.answer) : "";
120
+ if (!question || !answer) continue;
121
+ out.push({
122
+ id: `himi-static-faq-${out.length}`,
123
+ categoryId: STATIC_CATEGORY.id,
124
+ question,
125
+ answer,
126
+ // The site's own pairs are plain strings: there is no document to render.
127
+ answerJson: "",
128
+ hasAnswerJson: false,
129
+ sortOrder: out.length,
130
+ status: "VISIBLE",
131
+ });
132
+ }
133
+ return out;
134
+ }
135
+
136
+ function sortByWixOrder<T extends { id: string; sortOrder?: number }>(left: T, right: T): number {
137
+ const a = Number.isFinite(left.sortOrder) ? left.sortOrder! : Number.POSITIVE_INFINITY;
138
+ const b = Number.isFinite(right.sortOrder) ? right.sortOrder! : Number.POSITIVE_INFINITY;
139
+ return a - b || (left.id < right.id ? -1 : left.id > right.id ? 1 : 0);
140
+ }
141
+
142
+ function uniqueById<T extends { id: string }>(rows: T[]): T[] {
143
+ return [...new Map(rows.filter((row) => row.id).map((row) => [row.id, row])).values()];
144
+ }
145
+
146
+ function sectionsFor(state: Pick<FaqState, "categories" | "questions" | "query" | "expandedIds" | "otherTitle">, limit?: number): CategorySection[] {
147
+ const needle = state.query.trim().toLowerCase();
148
+ const visible = state.questions
149
+ .filter((row) => row.status.toUpperCase() !== "HIDDEN")
150
+ .filter((row) => !needle || `${row.question}\n${row.answer}`.toLowerCase().includes(needle))
151
+ .sort(sortByWixOrder)
152
+ .slice(0, limit ?? Number.POSITIVE_INFINITY);
153
+ const expanded = new Set(state.expandedIds);
154
+ const known = new Set(state.categories.map((category) => category.id));
155
+ const row = (question: FaqQuestion): QuestionRow => ({
156
+ id: question.id,
157
+ title: question.question,
158
+ answer: question.answer,
159
+ answerJson: question.answerJson,
160
+ hasAnswerJson: question.hasAnswerJson,
161
+ expanded: expanded.has(question.id),
162
+ });
163
+ const sections = state.categories
164
+ .slice()
165
+ .sort(sortByWixOrder)
166
+ .map((category) => ({
167
+ id: category.id,
168
+ title: category.title,
169
+ questions: visible.filter((question) => question.categoryId === category.id).map(row),
170
+ }))
171
+ .filter((section) => section.questions.length > 0);
172
+ const orphaned = visible.filter((question) => !known.has(question.categoryId));
173
+ if (orphaned.length) sections.push({ id: "other", title: state.otherTitle, questions: orphaned.map(row) });
174
+ return sections;
175
+ }
176
+
177
+ function ready(state: FaqState, options: FaqListOptions = {}): FaqState {
178
+ const sections = sectionsFor(state, options.limit);
179
+ const rows = sections.flatMap((section) => section.questions.map((question, index) => ({
180
+ ...question,
181
+ categoryTitle: section.title,
182
+ // An untitled section (the static fallback's) has no header to show.
183
+ categoryHeaderHidden: options.showCategories === false || index !== 0 || !section.title,
184
+ })));
185
+ return {
186
+ ...state,
187
+ status: "ready",
188
+ sections,
189
+ rows,
190
+ loadingHidden: true,
191
+ contentHidden: sections.length === 0,
192
+ emptyHidden: sections.length > 0,
193
+ errorHidden: true,
194
+ forbiddenHidden: true,
195
+ notInstalledHidden: true,
196
+ };
197
+ }
198
+
199
+ function failure(state: FaqState, status: FaqState["status"]): FaqState {
200
+ return {
201
+ ...state,
202
+ status,
203
+ categories: [],
204
+ questions: [],
205
+ sections: [],
206
+ rows: [],
207
+ loadingHidden: true,
208
+ contentHidden: true,
209
+ emptyHidden: true,
210
+ errorHidden: status !== "error",
211
+ forbiddenHidden: status !== "forbidden",
212
+ notInstalledHidden: status !== "notInstalled",
213
+ };
214
+ }
215
+
216
+ function httpStatus(error: unknown): number | undefined {
217
+ if (!error || typeof error !== "object") return undefined;
218
+ const row = error as { status?: unknown; statusCode?: unknown; response?: { status?: unknown }; message?: unknown };
219
+ for (const value of [row.status, row.statusCode, row.response?.status]) {
220
+ if (typeof value === "number") return value;
221
+ }
222
+ const match = typeof row.message === "string" ? row.message.match(/\b(403|428)\b/) : null;
223
+ return match ? Number(match[1]) : undefined;
224
+ }
225
+
226
+ async function allCategories(): Promise<FaqCategory[]> {
227
+ const rows: FaqCategory[] = [];
228
+ const seen = new Set<string>();
229
+ let cursor = "";
230
+ do {
231
+ const response = await queryCategories({ query: { cursorPaging: { limit: PAGE_SIZE, ...(cursor ? { cursor } : {}) } } });
232
+ rows.push(...(response.categories ?? []).map((category: WixCategory) => ({
233
+ id: category.id ?? "",
234
+ title: (category.title ?? "").trim() || "Other",
235
+ ...(typeof category.sortOrder === "number" ? { sortOrder: category.sortOrder } : {}),
236
+ })));
237
+ const next = response.pagingMetadata?.cursors?.next ?? "";
238
+ if (!next || seen.has(next)) break;
239
+ seen.add(next);
240
+ cursor = next;
241
+ } while (cursor);
242
+ return uniqueById(rows);
243
+ }
244
+
245
+ /** The answer's text with every whitespace run collapsed to one space: PLAIN_TEXT and a document's plain text
246
+ * may separate blocks differently ("\n" vs "\n\n"), and that is not a garbled conversion, but a space inside
247
+ * the text is content ("New York" is not "NewYork"). */
248
+ const normalizeSpace = (text: string): string => text.replace(/\s+/g, " ").trim();
249
+
250
+ /** [rico] #3372 — the RICH_CONTENT answer as a document string, trusted ONLY when its text matches the
251
+ * PLAIN_TEXT answer. Wix converts a legacy DraftJS answer to Ricos unreliably, and the plain answer is
252
+ * the one a visitor has always been shown, so a document that disagrees with it is dropped. */
253
+ function richAnswer(plain: string, rich: unknown): string {
254
+ // richBody encodes FIRST, so a document past the viewer's limits (too deep included) is rejected without an
255
+ // unbounded plain-text walk, and gives "". Answers render in a list, so their media are list-sized.
256
+ const { bodyJson, bodyText } = richBody(rich, "", ROW_IMAGE_WIDTH);
257
+ return bodyJson && normalizeSpace(bodyText) === normalizeSpace(plain) ? bodyJson : "";
258
+ }
259
+
260
+ /** Every question entry in one content format, following THAT query's own cursors: a cursor belongs to the
261
+ * request that returned it, so the two formats never share one. */
262
+ async function entriesIn(contentFormat: "PLAIN_TEXT" | "RICH_CONTENT"): Promise<WixQuestionEntry[]> {
263
+ const rows: WixQuestionEntry[] = [];
264
+ const seen = new Set<string>();
265
+ let cursor = "";
266
+ do {
267
+ const response = await queryQuestionEntries({
268
+ query: {
269
+ cursorPaging: { limit: PAGE_SIZE, ...(cursor ? { cursor } : {}) },
270
+ filter: { status: { $in: ["VISIBLE", "UNKNOWN"] } },
271
+ },
272
+ contentFormat,
273
+ });
274
+ rows.push(...(response.questionEntries ?? []));
275
+ const next = response.pagingMetadata?.cursors?.next ?? "";
276
+ if (!next || seen.has(next)) break;
277
+ seen.add(next);
278
+ cursor = next;
279
+ } while (cursor);
280
+ return rows;
281
+ }
282
+
283
+ async function allQuestions(): Promise<FaqQuestion[]> {
284
+ // Both formats are read in parallel, each paged on its own. PLAIN_TEXT is the list; a RICH_CONTENT read
285
+ // that fails only costs the documents — every answer keeps its plain text.
286
+ const [plain, rich] = await Promise.all([
287
+ entriesIn("PLAIN_TEXT"),
288
+ entriesIn("RICH_CONTENT").catch(() => [] as WixQuestionEntry[]),
289
+ ]);
290
+ const richById = new Map(rich.map((question: WixQuestionEntry) => [question.id ?? "", question.richContent]));
291
+ const rows = plain.map((question: WixQuestionEntry) => {
292
+ const answer = (question.plainText ?? "").trim();
293
+ const answerJson = richAnswer(answer, richById.get(question.id ?? ""));
294
+ return {
295
+ id: question.id ?? "",
296
+ categoryId: question.categoryId ?? "",
297
+ question: (question.question ?? "").trim(),
298
+ answer,
299
+ answerJson,
300
+ hasAnswerJson: answerJson !== "",
301
+ ...(typeof question.sortOrder === "number" ? { sortOrder: question.sortOrder } : {}),
302
+ status: question.status ?? "UNKNOWN",
303
+ };
304
+ }).filter((question) =>
305
+ question.id && question.question && question.status.toUpperCase() !== "HIDDEN",
306
+ );
307
+ return uniqueById(rows);
308
+ }
309
+
310
+ const INITIAL: FaqState = {
311
+ status: "loading",
312
+ categories: [],
313
+ questions: [],
314
+ sections: [],
315
+ rows: [],
316
+ query: "",
317
+ expandedIds: [],
318
+ otherTitle: "Other",
319
+ loadingHidden: false,
320
+ contentHidden: true,
321
+ emptyHidden: true,
322
+ errorHidden: true,
323
+ forbiddenHidden: true,
324
+ notInstalledHidden: true,
325
+ searchHidden: false,
326
+ };
327
+
328
+ export function registerFaqList(serviceName: string, options: FaqListOptions = {}) {
329
+ /** The site's own FAQ pairs: the FALLBACK shown only when the FAQ app yields no visible question (see parseStaticFaq). */
330
+ let staticQuestions: FaqQuestion[] = [];
331
+ const initial: FaqState = { ...INITIAL, searchHidden: options.showSearch === false };
332
+ let latestState = initial;
333
+ let loadGeneration = 0;
334
+ /** The reader opened or closed a question: `firstOpen` then stops deciding what is open. */
335
+ let touched = false;
336
+
337
+ const settle = (state: FaqState): FaqState => ready(state, options);
338
+
339
+ /** The site's pairs as a ready state, or undefined when there are none to fall back to. */
340
+ function staticFallback(state: FaqState): FaqState | undefined {
341
+ if (!staticQuestions.length) return undefined;
342
+ return settle({ ...state, categories: [STATIC_CATEGORY], questions: staticQuestions });
343
+ }
344
+
345
+ function commit(state: FaqState): FaqState {
346
+ latestState = state;
347
+ return state;
348
+ }
349
+
350
+ async function loadFaq(state: FaqState, arg?: { otherCategory?: string; staticFaq?: unknown }): Promise<FaqState> {
351
+ latestState = state;
352
+ // Only when the caller passed the param: `retry` is dispatched with no params and must keep
353
+ // the pairs the screen's onAppear delivered.
354
+ if (arg && "staticFaq" in arg) staticQuestions = parseStaticFaq(arg.staticFaq);
355
+ const generation = ++loadGeneration;
356
+ try {
357
+ const [categories, questions] = await Promise.all([allCategories(), allQuestions()]);
358
+ if (generation !== loadGeneration) return latestState;
359
+ const otherTitle = String(arg?.otherCategory ?? latestState.otherTitle).trim() || latestState.otherTitle;
360
+ let live = settle({ ...latestState, categories, questions, otherTitle });
361
+ const first = live.sections[0]?.questions[0]?.id;
362
+ if (options.firstOpen && !touched && !live.expandedIds.length && first) live = settle({ ...live, expandedIds: [first] });
363
+ // The Wix FAQ app answered but holds nothing a visitor can see — the site's own pairs,
364
+ // when it has any, instead of an empty state over a site whose FAQ is right there.
365
+ if (questions.length === 0) return commit(staticFallback(live) ?? live);
366
+ return commit(live);
367
+ } catch (error) {
368
+ if (generation !== loadGeneration) return latestState;
369
+ console.warn("faq_list: the questions could not be read", error);
370
+ const status = httpStatus(error);
371
+ // No FAQ app (428), no visitor access (403) or a failed read: a site whose FAQ is page
372
+ // content still has an FAQ to show, so its pairs replace the failure card.
373
+ const fallback = staticFallback(latestState);
374
+ if (fallback) return commit(fallback);
375
+ return commit(failure(latestState, status === 403 ? "forbidden" : status === 428 ? "notInstalled" : "error"));
376
+ }
377
+ }
378
+
379
+ return defineService(serviceName, {
380
+ state: initial,
381
+ actions: {
382
+ load: loadFaq,
383
+ retry: loadFaq,
384
+ search: (state: FaqState, arg?: { value?: string }) => commit(settle({ ...state, query: String(arg?.value ?? "").slice(0, 256) })),
385
+ toggle: (state: FaqState, arg?: { id?: string }) => {
386
+ const id = String(arg?.id ?? "");
387
+ if (!id || !state.questions.some((question) => question.id === id)) return state;
388
+ touched = true;
389
+ const open = state.expandedIds.includes(id);
390
+ const expandedIds = open
391
+ ? state.expandedIds.filter((candidate) => candidate !== id)
392
+ : options.oneAtATime ? [id] : [...state.expandedIds, id];
393
+ return commit(settle({ ...state, expandedIds }));
394
+ },
395
+ // [rico] #3372 — an answer RichContent's on_link: `{ url }` of the tapped link. Only http(s), mailto and
396
+ // tel links reach open_url; the FAQ has no message line, so a refused link simply does nothing.
397
+ openLink: async (state: FaqState, arg?: unknown) => {
398
+ await openRichLink(arg);
399
+ return state;
400
+ },
401
+ },
402
+ });
403
+ }
404
+
405
+ export { sectionsFor, httpStatus, parseStaticFaq };
@@ -0,0 +1,194 @@
1
+ import { dispatch } from "@himalaya/dispatch";
2
+ // Relative for node resolution (see himi-store.ts note); rewritten off-repo.
3
+ import { displayName, getMyData, initials, type WixMyData } from "@himalaya/wix-users";
4
+ import { getMyMember } from "@himalaya/wix-members";
5
+ import { wixMediaUrl } from "@himalaya/wix-media";
6
+ import { formatDateMedium, formatWeekdayDateTime } from "../_shared/engine-intl.js";
7
+ import { copyParam } from "./himi-copy.js";
8
+
9
+ export interface AccountProfile {
10
+ isMember: boolean;
11
+ identityLine: string;
12
+ detailLine: string;
13
+ memberName: string;
14
+ memberEmail: string;
15
+ memberImage: string;
16
+ memberInitials: string;
17
+ hasMemberImage: boolean;
18
+ noMemberImage: boolean;
19
+ }
20
+
21
+ export interface AccountActivityRow {
22
+ id: string;
23
+ title: string;
24
+ subtitle: string;
25
+ meta: string;
26
+ status: string;
27
+ }
28
+
29
+ export function strOf(arg: unknown): string {
30
+ if (typeof arg === "string") return arg;
31
+ const a = arg as { value?: string; text?: string } | undefined;
32
+ return a?.value ?? a?.text ?? "";
33
+ }
34
+
35
+ export function titleCase(value?: string): string {
36
+ return (value || "")
37
+ .toLowerCase()
38
+ .split(/[_\s-]+/)
39
+ .filter(Boolean)
40
+ .map((part) => part[0].toUpperCase() + part.slice(1))
41
+ .join(" ");
42
+ }
43
+
44
+ export function fmtDate(value?: string): string {
45
+ if (!value) return "";
46
+ const date = new Date(value);
47
+ if (Number.isNaN(date.getTime())) return "";
48
+ return formatDateMedium(date);
49
+ }
50
+
51
+ export function fmtDateTime(value?: string): string {
52
+ if (!value) return "";
53
+ const date = new Date(value);
54
+ if (Number.isNaN(date.getTime())) return "";
55
+ return formatWeekdayDateTime(date);
56
+ }
57
+
58
+ function initialsFromName(value: string): string {
59
+ const parts = value.trim().split(/\s+/).filter(Boolean);
60
+ if (!parts.length) return "";
61
+ const first = parts[0]?.[0] ?? "";
62
+ const last = parts.length > 1 ? parts[parts.length - 1]?.[0] ?? "" : "";
63
+ return (first + last).toUpperCase();
64
+ }
65
+
66
+ function profileImage(data: WixMyData): string {
67
+ const profile = data.profile as { profileImage?: string; photo?: { url?: string }; imageUrl?: string } | undefined;
68
+ return profile?.profileImage || profile?.photo?.url || profile?.imageUrl || "";
69
+ }
70
+
71
+ function profileFromData(data: WixMyData, fallbackEmail = ""): AccountProfile {
72
+ const email = fallbackEmail || data.email || data.contactEmail || "";
73
+ const name = displayName(data) || email || "Member";
74
+ const image = profileImage(data);
75
+ return {
76
+ isMember: true,
77
+ identityLine: copyParam("account.signedIn", "Signed in"),
78
+ detailLine: email || name,
79
+ memberName: name,
80
+ memberEmail: email,
81
+ memberImage: image,
82
+ memberInitials: initials(data) || initialsFromName(name) || "M",
83
+ hasMemberImage: !!image,
84
+ noMemberImage: !image,
85
+ };
86
+ }
87
+
88
+ /** The signed-in site member's name and photo from their member record, or undefined when it
89
+ * cannot be read or names nobody (the caller then shows the email). */
90
+ async function siteMemberProfile(email: string): Promise<AccountProfile | undefined> {
91
+ try {
92
+ const member = (await getMyMember({ fieldsets: ["FULL"] }))?.member;
93
+ const name = [member?.contact?.firstName, member?.contact?.lastName].map((part) => (part ?? "").trim()).filter(Boolean).join(" ")
94
+ || (member?.profile?.nickname ?? "").trim();
95
+ if (!name) return undefined;
96
+ const image = wixMediaUrl(member?.profile?.photo?.url) || wixMediaUrl(member?.profile?.photo?.id) || "";
97
+ return {
98
+ isMember: true,
99
+ identityLine: copyParam("account.signedIn", "Signed in"),
100
+ detailLine: email || name,
101
+ memberName: name,
102
+ memberEmail: email || member?.loginEmail || "",
103
+ memberImage: image,
104
+ memberInitials: initialsFromName(name) || "M",
105
+ hasMemberImage: !!image,
106
+ noMemberImage: !image,
107
+ };
108
+ } catch {
109
+ return undefined;
110
+ }
111
+ }
112
+
113
+ export function guestProfile(detailLine: string): AccountProfile {
114
+ return {
115
+ isMember: false,
116
+ identityLine: copyParam("account.guestIdentity", "Browsing as a guest"),
117
+ detailLine,
118
+ memberName: "",
119
+ memberEmail: "",
120
+ memberImage: "",
121
+ memberInitials: "M",
122
+ hasMemberImage: false,
123
+ noMemberImage: true,
124
+ };
125
+ }
126
+
127
+ /** `himi.wix.memberIdentity`: the member's email ("" when none is known) and whether a member is
128
+ * signed in. `signedIn` is true only when the host says so explicitly — native hosts answer it
129
+ * for a member whose email is not known yet (an injected or hosted session before `members/my`
130
+ * answers); hosts that predate it answer the email alone. */
131
+ export async function memberIdentity(): Promise<{ email: string; signedIn: boolean }> {
132
+ try {
133
+ const identity = await dispatch("himi.wix.memberIdentity") as unknown;
134
+ const direct = identity as { email?: unknown; signedIn?: unknown } | null;
135
+ const wrapped = identity as { payload?: { email?: unknown; signedIn?: unknown } } | null;
136
+ const raw = direct?.email ?? wrapped?.payload?.email;
137
+ const email = typeof raw === "string" ? raw : "";
138
+ const signedIn = (direct?.signedIn ?? wrapped?.payload?.signedIn) === true;
139
+ return { email, signedIn: signedIn || !!email };
140
+ } catch {
141
+ return { email: "", signedIn: false };
142
+ }
143
+ }
144
+
145
+ export async function signedInEmail(): Promise<string> {
146
+ return (await memberIdentity()).email;
147
+ }
148
+
149
+ /** A signed-in member nothing names yet: signed in, with a neutral label rather than another
150
+ * member's name or the sign-in form. */
151
+ function neutralMemberProfile(): AccountProfile {
152
+ const name = copyParam("account.member", "Member");
153
+ return {
154
+ isMember: true,
155
+ identityLine: copyParam("account.signedIn", "Signed in"),
156
+ detailLine: name,
157
+ memberName: name,
158
+ memberEmail: "",
159
+ memberImage: "",
160
+ memberInitials: "M",
161
+ hasMemberImage: false,
162
+ noMemberImage: true,
163
+ };
164
+ }
165
+
166
+ export async function loadMemberProfile(guestDetailLine: string): Promise<AccountProfile> {
167
+ // `himi.wix.memberIdentity` is the session source of truth. Visitor-scoped
168
+ // getMyData can still return a site/account nickname (e.g. apptestercoowner)
169
+ // after sign-out or for anonymous — never treat that as a signed-in member.
170
+ const identity = await memberIdentity();
171
+ if (!identity.signedIn) return guestProfile(guestDetailLine);
172
+ const storedEmail = identity.email;
173
+ if (!storedEmail) return (await siteMemberProfile("")) ?? neutralMemberProfile();
174
+ try {
175
+ const data = await getMyData();
176
+ return profileFromData(data, storedEmail);
177
+ } catch {
178
+ // The account profile is an owner endpoint: the web host refuses it, and a site member need
179
+ // not have one. The member's own record (the Members API) still names them.
180
+ const member = await siteMemberProfile(storedEmail);
181
+ if (member) return member;
182
+ return {
183
+ isMember: true,
184
+ identityLine: copyParam("account.signedIn", "Signed in"),
185
+ detailLine: storedEmail,
186
+ memberName: storedEmail,
187
+ memberEmail: storedEmail,
188
+ memberImage: "",
189
+ memberInitials: initialsFromName(storedEmail) || "M",
190
+ hasMemberImage: false,
191
+ noMemberImage: true,
192
+ };
193
+ }
194
+ }
@@ -0,0 +1,88 @@
1
+ // Saved (favorite) booking services use the host's durable, app-scoped KV, shared by every
2
+ // screen worker — the service detail toggles a row (himi-booking-service `toggleSaved`), the
3
+ // Favorites list reads them (himi-booking-saved). Same model as _shared/himi-store-saved.ts: a
4
+ // failed write must never claim that a save succeeded.
5
+ export interface SavedService {
6
+ id: string;
7
+ name: string;
8
+ /** The price line as the detail showed it ("$250"), kept so the list paints offline. */
9
+ price: string;
10
+ /** The duration line ("1 hr"). */
11
+ duration: string;
12
+ image: string;
13
+ category: string;
14
+ /** A course: the list's Book passes `course` to the time screen, which then refuses a course
15
+ * whose record failed to load instead of offering its sessions one by one. */
16
+ course?: boolean;
17
+ }
18
+ type StorageLike = { getItem(key: string): string | null; setItem(key: string, value: string): void };
19
+ type Host = { himalaya?: { storage?: StorageLike; input?: Record<string, unknown> }; localStorage?: StorageLike };
20
+ const BASE = "himi-booking:saved-services:v1";
21
+ function storage(): StorageLike {
22
+ const host = globalThis as Host;
23
+ const kv = host.himalaya?.storage ?? host.localStorage;
24
+ if (!kv) throw new Error("Saved-service storage is unavailable");
25
+ return kv;
26
+ }
27
+ const validPart = (value: unknown): value is string => typeof value === "string" && /^[A-Za-z0-9_.:-]{1,128}$/.test(value) && value !== "default";
28
+ /** Saves belong to whoever made them. A signed-in member's live under the host's authenticated
29
+ * account + business — the partition collection preferences use, so a second member on the same
30
+ * device never sees them; a visitor's live on the device. A member's partition, read for the
31
+ * first time, takes the visitor's saves on this device (signing in carries them, like a cart),
32
+ * once — the device list is then emptied. */
33
+ function storeKey(kv: StorageLike): string {
34
+ const input = (globalThis as Host).himalaya?.input;
35
+ const account = input?.__himiPreferenceAccount, business = input?.__himiPreferenceBusiness;
36
+ if (!validPart(account) || !validPart(business)) return BASE;
37
+ const key = `${BASE}.${account}.${encodeURIComponent(business)}`;
38
+ if (kv.getItem(key) === null) {
39
+ const visitor = kv.getItem(BASE);
40
+ if (visitor !== null) {
41
+ kv.setItem(key, visitor);
42
+ // Empty the device list only once the member's copy is confirmed: a web host may swallow a
43
+ // failed write, and clearing then would lose the visitor's saves.
44
+ if (kv.getItem(key) === visitor) kv.setItem(BASE, "[]");
45
+ }
46
+ }
47
+ return key;
48
+ }
49
+ const str = (value: unknown): string => (typeof value === "string" ? value : "");
50
+ export function readSavedServices(): SavedService[] {
51
+ const kv = storage();
52
+ const raw = kv.getItem(storeKey(kv));
53
+ if (!raw) return [];
54
+ const parsed: unknown = JSON.parse(raw);
55
+ if (!Array.isArray(parsed)) throw new Error("Invalid saved-service data");
56
+ const rows = new Map<string, SavedService>();
57
+ for (const value of parsed) {
58
+ if (!value || typeof value !== "object") continue;
59
+ const row = value as Record<string, unknown>;
60
+ if (typeof row.id !== "string" || !row.id.trim() || typeof row.name !== "string") continue;
61
+ rows.set(row.id, { id: row.id, name: row.name, price: str(row.price), duration: str(row.duration), image: str(row.image), category: str(row.category), ...(row.course === true ? { course: true } : {}) });
62
+ }
63
+ return [...rows.values()];
64
+ }
65
+
66
+ export function isServiceSaved(id: string): boolean {
67
+ return readSavedServices().some(row => row.id === id);
68
+ }
69
+ export function writeSavedServices(rows: SavedService[]): void {
70
+ const kv = storage();
71
+ const key = storeKey(kv);
72
+ const value = JSON.stringify(rows);
73
+ kv.setItem(key, value);
74
+ // Web hosts may swallow quota/security errors. Confirm the synchronous write
75
+ // before displaying success; a missing/mismatched read is a failed save.
76
+ if (kv.getItem(key) !== value) throw new Error("Saved-service write did not persist");
77
+ }
78
+ /** Save or unsave; returns the new saved state. The newest save is listed first. */
79
+ export function toggleSavedService(service: SavedService): boolean {
80
+ if (!service.id.trim() || !service.name.trim()) throw new Error("No service to save");
81
+ const rows = readSavedServices();
82
+ const saved = !rows.some(row => row.id === service.id);
83
+ writeSavedServices(saved ? [service, ...rows] : rows.filter(row => row.id !== service.id));
84
+ return saved;
85
+ }
86
+ export function removeSavedService(id: string): void {
87
+ writeSavedServices(readSavedServices().filter(row => row.id !== id));
88
+ }