@wix/himalaya-cli 0.1749.0 → 0.1751.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 (324) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +3 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/himi-package.d.ts +478 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/host-compatibility.d.ts +56 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/icon-catalog.generated.d.ts +1 -1
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +4 -0
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-shell.d.ts +156 -8
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validator.d.ts +3 -0
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/index.d.ts +2 -0
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/podcast-service.d.ts +105 -0
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/podcast.d.ts +116 -0
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +326 -13
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +730 -81
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +155 -0
  14. package/dist/browser-plane/assets.json +5 -5
  15. package/dist/browser-plane/preview-deferred/{b40ea5d0d6251898ff5617139fde8be008dd11e99a70b14c1052093685401700.bin → 21f35a12bd94f4ab97a9a75453c4adcadc438daf024a4b1950d5c356c123bd01.bin} +1 -1
  16. package/dist/browser-plane/sw.js +7 -7
  17. package/dist/cli.mjs +44618 -35753
  18. package/dist/preview-assets.generated.bin +0 -0
  19. package/guides/component-reference.json +1 -1
  20. package/guides/component-reference.md +4 -0
  21. package/guides/designing-himi-screens.md +7 -0
  22. package/guides/getting-started.md +5 -1
  23. package/guides/headless-loop.md +1 -1
  24. package/guides/himi-json-output.md +54 -1
  25. package/guides/himi-skill.md +5 -1
  26. package/guides/index.json +6 -0
  27. package/guides/one-app-to-himi-app.md +31 -8
  28. package/guides/qa-builds.md +12 -1
  29. package/guides/recipe-podcast.md +149 -0
  30. package/guides/skill.md +3 -1
  31. package/guides/store-submission.md +149 -34
  32. package/guides/tier-5-add-a-screen.md +16 -2
  33. package/guides/wix-business-context.md +43 -0
  34. package/guides/wix-platform-usage.md +7 -2
  35. package/package.json +10 -10
  36. package/template-icons/fitness-gym.png +0 -0
  37. package/template-icons/personal-fitness-trainer.png +0 -0
  38. package/templates/beauty-salon/config.ts +12 -0
  39. package/templates/beauty-salon/dev/index.ts +1 -1
  40. package/templates/beauty-salon/l10n/en.json +1 -1
  41. package/templates/beauty-salon/tier5-src/_shared/booking-session.ts +3 -1
  42. package/templates/beauty-salon/tier5-src/_shared/business-chat-transport.ts +148 -0
  43. package/templates/beauty-salon/tier5-src/_shared/header-badges.ts +113 -0
  44. package/templates/beauty-salon/tier5-src/_shared/location-pin.ts +97 -0
  45. package/templates/beauty-salon/tier5-src/_shared/member-access.ts +17 -6
  46. package/templates/beauty-salon/tier5-src/_shared/program-fields.ts +16 -0
  47. package/templates/beauty-salon/tier5-src/_shared/programs-section.ts +5 -8
  48. package/templates/beauty-salon/tier5-src/_shared/source-badges.ts +72 -0
  49. package/templates/beauty-salon/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  50. package/templates/beauty-salon/tier5-src/himi-branded-lite-nav/index.ts +152 -0
  51. package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +13 -4
  52. package/templates/beauty-salon/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  53. package/templates/branded-lite/config.ts +12 -0
  54. package/templates/branded-lite/dev/index.ts +101 -1
  55. package/templates/branded-lite/l10n/en.json +22 -1
  56. package/templates/branded-lite/l10n/es.json +22 -0
  57. package/templates/branded-lite/l10n/fr.json +23 -0
  58. package/templates/branded-lite/l10n/he.json +19 -0
  59. package/templates/branded-lite/tier5-src/_shared/booking-session.ts +3 -1
  60. package/templates/branded-lite/tier5-src/_shared/location-pin.ts +97 -0
  61. package/templates/branded-lite/tier5-src/_shared/member-access.ts +17 -6
  62. package/templates/branded-lite/tier5-src/_shared/program-fields.ts +16 -0
  63. package/templates/branded-lite/tier5-src/_shared/programs-section.ts +5 -8
  64. package/templates/branded-lite/tier5-src/himi-branded-lite-access-nav/index.ts +10 -5
  65. package/templates/branded-lite/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  66. package/templates/branded-lite/tier5-src/himi-branded-lite-nav/index.ts +152 -0
  67. package/templates/branded-lite/tier5-src/himi-branded-lite-podcasts/index.ts +14 -234
  68. package/templates/branded-lite/tier5-src/himi-branded-lite-video/index.ts +12 -1
  69. package/templates/branded-lite/tier5-src/himi-store-account/index.ts +13 -4
  70. package/templates/branded-lite/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  71. package/templates/brandy/README.md +33 -0
  72. package/templates/brandy/config.ts +51 -7
  73. package/templates/brandy/dev/index.ts +23 -9
  74. package/templates/community-club/l10n/en.json +1 -1
  75. package/templates/community-club/tier5-src/_shared/member-access.ts +17 -6
  76. package/templates/community-club/tier5-src/_shared/program-fields.ts +16 -0
  77. package/templates/community-club/tier5-src/_shared/programs-section.ts +5 -8
  78. package/templates/community-club/tier5-src/himi-store-account/index.ts +13 -4
  79. package/templates/community-club/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  80. package/templates/conference/tier5-src/_shared/member-access.ts +17 -6
  81. package/templates/conference/tier5-src/himi-store-account/index.ts +13 -4
  82. package/templates/events-meetups/l10n/en.json +1 -1
  83. package/templates/events-meetups/tier5-src/_shared/member-access.ts +17 -6
  84. package/templates/events-meetups/tier5-src/_shared/program-fields.ts +16 -0
  85. package/templates/events-meetups/tier5-src/_shared/programs-section.ts +5 -8
  86. package/templates/events-meetups/tier5-src/himi-store-account/index.ts +13 -4
  87. package/templates/events-meetups/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  88. package/templates/fitness-gym/README.md +53 -0
  89. package/templates/fitness-gym/config.ts +560 -0
  90. package/templates/fitness-gym/dev/index.ts +25787 -0
  91. package/templates/fitness-gym/himalaya.content.json +64 -0
  92. package/templates/fitness-gym/himalaya.template.json +15 -0
  93. package/templates/fitness-gym/icon.png +0 -0
  94. package/templates/fitness-gym/platforms.json +1 -0
  95. package/templates/fitness-gym/tier5-src/_shared/app-locale.ts +61 -0
  96. package/templates/fitness-gym/tier5-src/_shared/booking-location.ts +147 -0
  97. package/templates/fitness-gym/tier5-src/_shared/booking-session.ts +224 -0
  98. package/templates/fitness-gym/tier5-src/_shared/branded-lite-hosted.ts +280 -0
  99. package/templates/fitness-gym/tier5-src/_shared/branded-load-state.ts +109 -0
  100. package/templates/fitness-gym/tier5-src/_shared/business-chat-copy.ts +40 -0
  101. package/templates/fitness-gym/tier5-src/_shared/business-chat-history.ts +51 -0
  102. package/templates/fitness-gym/tier5-src/_shared/business-chat-message-model.ts +177 -0
  103. package/templates/fitness-gym/tier5-src/_shared/business-chat-model.ts +56 -0
  104. package/templates/fitness-gym/tier5-src/_shared/business-chat-presenter.ts +576 -0
  105. package/templates/fitness-gym/tier5-src/_shared/business-chat-transport.ts +148 -0
  106. package/templates/fitness-gym/tier5-src/_shared/collection-contract.ts +228 -0
  107. package/templates/fitness-gym/tier5-src/_shared/collection-query.ts +193 -0
  108. package/templates/fitness-gym/tier5-src/_shared/collection-service.ts +400 -0
  109. package/templates/fitness-gym/tier5-src/_shared/detail-presence.ts +51 -0
  110. package/templates/fitness-gym/tier5-src/_shared/engine-intl.ts +523 -0
  111. package/templates/fitness-gym/tier5-src/_shared/himi-account.ts +194 -0
  112. package/templates/fitness-gym/tier5-src/_shared/himi-booking-saved.ts +88 -0
  113. package/templates/fitness-gym/tier5-src/_shared/himi-bookings.ts +318 -0
  114. package/templates/fitness-gym/tier5-src/_shared/himi-copy.ts +116 -0
  115. package/templates/fitness-gym/tier5-src/_shared/himi-media.ts +29 -0
  116. package/templates/fitness-gym/tier5-src/_shared/himi-store.ts +7 -0
  117. package/templates/fitness-gym/tier5-src/_shared/himi-text.ts +24 -0
  118. package/templates/fitness-gym/tier5-src/_shared/host-events.ts +66 -0
  119. package/templates/fitness-gym/tier5-src/_shared/hosted-checkout.ts +70 -0
  120. package/templates/fitness-gym/tier5-src/_shared/iap-attendance-form.ts +106 -0
  121. package/templates/fitness-gym/tier5-src/_shared/iap-attendance-purchase.ts +216 -0
  122. package/templates/fitness-gym/tier5-src/_shared/iap-attendance.ts +38 -0
  123. package/templates/fitness-gym/tier5-src/_shared/iap-worker.ts +127 -0
  124. package/templates/fitness-gym/tier5-src/_shared/inbox-rooms.ts +68 -0
  125. package/templates/fitness-gym/tier5-src/_shared/local-preferences.ts +38 -0
  126. package/templates/fitness-gym/tier5-src/_shared/member-access.ts +63 -0
  127. package/templates/fitness-gym/tier5-src/_shared/member-account-routes.ts +52 -0
  128. package/templates/fitness-gym/tier5-src/_shared/member-bookings.ts +107 -0
  129. package/templates/fitness-gym/tier5-src/_shared/member-screen.ts +99 -0
  130. package/templates/fitness-gym/tier5-src/_shared/notification-target.ts +141 -0
  131. package/templates/fitness-gym/tier5-src/_shared/offset-page.ts +10 -0
  132. package/templates/fitness-gym/tier5-src/_shared/online-actions.ts +76 -0
  133. package/templates/fitness-gym/tier5-src/_shared/owner-load-error.ts +348 -0
  134. package/templates/fitness-gym/tier5-src/_shared/payment-setup.ts +6 -0
  135. package/templates/fitness-gym/tier5-src/_shared/pricing-plan-display.ts +64 -0
  136. package/templates/fitness-gym/tier5-src/_shared/program-description.ts +11 -0
  137. package/templates/fitness-gym/tier5-src/_shared/program-fields.ts +16 -0
  138. package/templates/fitness-gym/tier5-src/_shared/program-standing.ts +46 -0
  139. package/templates/fitness-gym/tier5-src/_shared/rich-body.ts +78 -0
  140. package/templates/fitness-gym/tier5-src/_shared/rich-content-link.ts +34 -0
  141. package/templates/fitness-gym/tier5-src/_shared/sign-in-sheet.ts +18 -0
  142. package/templates/fitness-gym/tier5-src/_shared/staff-name.ts +18 -0
  143. package/templates/fitness-gym/tier5-src/_shared/weekly-goal.ts +107 -0
  144. package/templates/fitness-gym/tier5-src/_shared/wix-bi.ts +85 -0
  145. package/templates/fitness-gym/tier5-src/_shared/wix-member-links.ts +114 -0
  146. package/templates/fitness-gym/tier5-src/_shared/wix-service-price.ts +146 -0
  147. package/templates/fitness-gym/tier5-src/business-chat/index.ts +732 -0
  148. package/templates/fitness-gym/tier5-src/business-contact/index.ts +6 -0
  149. package/templates/fitness-gym/tier5-src/himi-booking-account/index.ts +267 -0
  150. package/templates/fitness-gym/tier5-src/himi-booking-bookings/index.ts +468 -0
  151. package/templates/fitness-gym/tier5-src/himi-booking-service/index.ts +1190 -0
  152. package/templates/fitness-gym/tier5-src/himi-booking-services/index.ts +791 -0
  153. package/templates/fitness-gym/tier5-src/himi-booking-time/index.ts +1729 -0
  154. package/templates/fitness-gym/tier5-src/himi-branded-lite-agenda/index.ts +988 -0
  155. package/templates/fitness-gym/tier5-src/himi-branded-lite-member-programs/index.ts +656 -0
  156. package/templates/fitness-gym/tier5-src/himi-branded-lite-notifications/index.ts +256 -0
  157. package/templates/fitness-gym/tier5-src/himi-branded-lite-plans/index.ts +495 -0
  158. package/templates/fitness-gym/tier5-src/himi-branded-lite-program/facts.ts +52 -0
  159. package/templates/fitness-gym/tier5-src/himi-branded-lite-program/index.ts +845 -0
  160. package/templates/fitness-gym/tier5-src/himi-fitcoach-goal/index.ts +191 -0
  161. package/templates/fitness-gym/tier5-src/himi-fitcoach-home/index.ts +619 -0
  162. package/templates/fitness-gym/tier5-src/himi-store-account/index.ts +1007 -0
  163. package/templates/fitness-gym/tier5-src/wix-spaces-my-subscriptions/index.ts +84 -0
  164. package/templates/fitness-gym/tier5-src/wix-spaces-subscription-detail/index.ts +139 -0
  165. package/templates/fitness-gym/tokens.json +414 -0
  166. package/templates/gym-fitness/config.ts +12 -0
  167. package/templates/gym-fitness/dev/index.ts +1 -1
  168. package/templates/gym-fitness/l10n/en.json +1 -1
  169. package/templates/gym-fitness/tier5-src/_shared/booking-session.ts +3 -1
  170. package/templates/gym-fitness/tier5-src/_shared/business-chat-transport.ts +148 -0
  171. package/templates/gym-fitness/tier5-src/_shared/header-badges.ts +113 -0
  172. package/templates/gym-fitness/tier5-src/_shared/location-pin.ts +97 -0
  173. package/templates/gym-fitness/tier5-src/_shared/member-access.ts +17 -6
  174. package/templates/gym-fitness/tier5-src/_shared/program-fields.ts +16 -0
  175. package/templates/gym-fitness/tier5-src/_shared/programs-section.ts +5 -8
  176. package/templates/gym-fitness/tier5-src/_shared/source-badges.ts +72 -0
  177. package/templates/gym-fitness/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  178. package/templates/gym-fitness/tier5-src/himi-branded-lite-nav/index.ts +152 -0
  179. package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +13 -4
  180. package/templates/gym-fitness/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  181. package/templates/medical-services/dev/index.ts +2 -1
  182. package/templates/medical-services/tier5-src/_shared/booking-session.ts +3 -1
  183. package/templates/medical-services/tier5-src/_shared/member-access.ts +17 -6
  184. package/templates/medical-services/tier5-src/himi-booking-account/index.ts +16 -1
  185. package/templates/medical-services/tier5-src/himi-store-account/index.ts +13 -4
  186. package/templates/nonprofit-cause/l10n/en.json +1 -1
  187. package/templates/nonprofit-cause/tier5-src/_shared/member-access.ts +17 -6
  188. package/templates/nonprofit-cause/tier5-src/_shared/program-fields.ts +16 -0
  189. package/templates/nonprofit-cause/tier5-src/_shared/programs-section.ts +5 -8
  190. package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +13 -4
  191. package/templates/nonprofit-cause/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  192. package/templates/personal-fitness-trainer/README.md +51 -0
  193. package/templates/personal-fitness-trainer/config.ts +343 -0
  194. package/templates/personal-fitness-trainer/dev/index.ts +24813 -0
  195. package/templates/personal-fitness-trainer/himalaya.content.json +79 -0
  196. package/templates/personal-fitness-trainer/himalaya.template.json +14 -0
  197. package/templates/personal-fitness-trainer/icon.png +0 -0
  198. package/templates/personal-fitness-trainer/platforms.json +3 -0
  199. package/templates/personal-fitness-trainer/splash.json +3 -0
  200. package/templates/personal-fitness-trainer/tier5-src/_shared/app-locale.ts +61 -0
  201. package/templates/personal-fitness-trainer/tier5-src/_shared/booking-location.ts +147 -0
  202. package/templates/personal-fitness-trainer/tier5-src/_shared/booking-session.ts +224 -0
  203. package/templates/personal-fitness-trainer/tier5-src/_shared/branded-lite-hosted.ts +280 -0
  204. package/templates/personal-fitness-trainer/tier5-src/_shared/branded-load-state.ts +109 -0
  205. package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-copy.ts +40 -0
  206. package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-history.ts +51 -0
  207. package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-message-model.ts +177 -0
  208. package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-model.ts +56 -0
  209. package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-presenter.ts +576 -0
  210. package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-transport.ts +148 -0
  211. package/templates/personal-fitness-trainer/tier5-src/_shared/collection-contract.ts +228 -0
  212. package/templates/personal-fitness-trainer/tier5-src/_shared/collection-query.ts +193 -0
  213. package/templates/personal-fitness-trainer/tier5-src/_shared/collection-service.ts +400 -0
  214. package/templates/personal-fitness-trainer/tier5-src/_shared/detail-presence.ts +51 -0
  215. package/templates/personal-fitness-trainer/tier5-src/_shared/empty-flags.ts +33 -0
  216. package/templates/personal-fitness-trainer/tier5-src/_shared/engine-intl.ts +523 -0
  217. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-account.ts +194 -0
  218. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-booking-saved.ts +88 -0
  219. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-bookings.ts +318 -0
  220. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-copy.ts +116 -0
  221. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-layouts.ts +142 -0
  222. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-store.ts +7 -0
  223. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-text.ts +24 -0
  224. package/templates/personal-fitness-trainer/tier5-src/_shared/host-events.ts +66 -0
  225. package/templates/personal-fitness-trainer/tier5-src/_shared/hosted-checkout.ts +70 -0
  226. package/templates/personal-fitness-trainer/tier5-src/_shared/iap-attendance-form.ts +106 -0
  227. package/templates/personal-fitness-trainer/tier5-src/_shared/iap-attendance-purchase.ts +216 -0
  228. package/templates/personal-fitness-trainer/tier5-src/_shared/iap-attendance.ts +38 -0
  229. package/templates/personal-fitness-trainer/tier5-src/_shared/iap-worker.ts +127 -0
  230. package/templates/personal-fitness-trainer/tier5-src/_shared/inbox-rooms.ts +68 -0
  231. package/templates/personal-fitness-trainer/tier5-src/_shared/local-preferences.ts +38 -0
  232. package/templates/personal-fitness-trainer/tier5-src/_shared/member-access.ts +63 -0
  233. package/templates/personal-fitness-trainer/tier5-src/_shared/member-account-routes.ts +52 -0
  234. package/templates/personal-fitness-trainer/tier5-src/_shared/member-bookings.ts +107 -0
  235. package/templates/personal-fitness-trainer/tier5-src/_shared/member-screen.ts +99 -0
  236. package/templates/personal-fitness-trainer/tier5-src/_shared/offset-page.ts +10 -0
  237. package/templates/personal-fitness-trainer/tier5-src/_shared/online-actions.ts +76 -0
  238. package/templates/personal-fitness-trainer/tier5-src/_shared/owner-load-error.ts +348 -0
  239. package/templates/personal-fitness-trainer/tier5-src/_shared/payment-setup.ts +6 -0
  240. package/templates/personal-fitness-trainer/tier5-src/_shared/pricing-plan-display.ts +64 -0
  241. package/templates/personal-fitness-trainer/tier5-src/_shared/rich-body.ts +78 -0
  242. package/templates/personal-fitness-trainer/tier5-src/_shared/rich-content-link.ts +34 -0
  243. package/templates/personal-fitness-trainer/tier5-src/_shared/sign-in-sheet.ts +18 -0
  244. package/templates/personal-fitness-trainer/tier5-src/_shared/staff-name.ts +18 -0
  245. package/templates/personal-fitness-trainer/tier5-src/_shared/video-caption.ts +21 -0
  246. package/templates/personal-fitness-trainer/tier5-src/_shared/weekly-goal.ts +107 -0
  247. package/templates/personal-fitness-trainer/tier5-src/_shared/wix-bi.ts +85 -0
  248. package/templates/personal-fitness-trainer/tier5-src/_shared/wix-service-price.ts +146 -0
  249. package/templates/personal-fitness-trainer/tier5-src/business-chat/index.ts +732 -0
  250. package/templates/personal-fitness-trainer/tier5-src/business-contact/index.ts +6 -0
  251. package/templates/personal-fitness-trainer/tier5-src/himi-booking-bookings/index.ts +468 -0
  252. package/templates/personal-fitness-trainer/tier5-src/himi-booking-service/index.ts +1190 -0
  253. package/templates/personal-fitness-trainer/tier5-src/himi-booking-services/index.ts +791 -0
  254. package/templates/personal-fitness-trainer/tier5-src/himi-booking-time/index.ts +1729 -0
  255. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +242 -0
  256. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/index.ts +1094 -0
  257. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-agenda/index.ts +988 -0
  258. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-appearance/index.ts +94 -0
  259. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-notifsettings/index.ts +173 -0
  260. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-plans/index.ts +495 -0
  261. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-splash/index.ts +35 -0
  262. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-video/index.ts +226 -0
  263. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-videos/index.ts +145 -0
  264. package/templates/personal-fitness-trainer/tier5-src/himi-fitness-trainer-home/index.ts +70 -0
  265. package/templates/personal-fitness-trainer/tier5-src/himi-fitness-trainer-profile/index.ts +53 -0
  266. package/templates/personal-fitness-trainer/tier5-src/himi-store-account/index.ts +1007 -0
  267. package/templates/personal-fitness-trainer/tier5-src/wix-spaces-app-language/index.ts +73 -0
  268. package/templates/personal-fitness-trainer/tier5-src/wix-spaces-delete-account/index.ts +59 -0
  269. package/templates/personal-fitness-trainer/tier5-src/wix-spaces-my-subscriptions/index.ts +84 -0
  270. package/templates/personal-fitness-trainer/tier5-src/wix-spaces-subscription-detail/index.ts +139 -0
  271. package/templates/personal-fitness-trainer/tier5-src/wix-spaces-view-profile/index.ts +119 -0
  272. package/templates/personal-fitness-trainer/tokens.json +381 -0
  273. package/templates/podcast-creator/dev/index.ts +100 -0
  274. package/templates/podcast-creator/l10n/en.json +22 -1
  275. package/templates/podcast-creator/l10n/es.json +22 -0
  276. package/templates/podcast-creator/l10n/fr.json +18 -0
  277. package/templates/podcast-creator/l10n/he.json +15 -0
  278. package/templates/podcast-creator/tier5-src/_shared/member-access.ts +17 -6
  279. package/templates/podcast-creator/tier5-src/_shared/program-fields.ts +16 -0
  280. package/templates/podcast-creator/tier5-src/_shared/programs-section.ts +5 -8
  281. package/templates/podcast-creator/tier5-src/himi-branded-lite-podcasts/index.ts +14 -234
  282. package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +13 -4
  283. package/templates/podcast-creator/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  284. package/templates/portfolio-creative/l10n/en.json +1 -1
  285. package/templates/portfolio-creative/tier5-src/_shared/member-access.ts +17 -6
  286. package/templates/portfolio-creative/tier5-src/_shared/program-fields.ts +16 -0
  287. package/templates/portfolio-creative/tier5-src/_shared/programs-section.ts +5 -8
  288. package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +13 -4
  289. package/templates/portfolio-creative/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  290. package/templates/restaurant/l10n/en.json +1 -1
  291. package/templates/restaurant/tier5-src/_shared/member-access.ts +17 -6
  292. package/templates/restaurant/tier5-src/_shared/program-fields.ts +16 -0
  293. package/templates/restaurant/tier5-src/_shared/programs-section.ts +5 -8
  294. package/templates/restaurant/tier5-src/himi-store-account/index.ts +13 -4
  295. package/templates/restaurant/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  296. package/templates/retail-store/l10n/en.json +1 -1
  297. package/templates/retail-store/tier5-src/_shared/member-access.ts +17 -6
  298. package/templates/retail-store/tier5-src/_shared/program-fields.ts +16 -0
  299. package/templates/retail-store/tier5-src/_shared/programs-section.ts +5 -8
  300. package/templates/retail-store/tier5-src/himi-store-account/index.ts +13 -4
  301. package/templates/retail-store/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  302. package/templates/salon-spa/dev/index.ts +1 -1
  303. package/templates/salon-spa/tier5-src/_shared/booking-session.ts +3 -1
  304. package/templates/salon-spa/tier5-src/_shared/member-access.ts +17 -6
  305. package/templates/salon-spa/tier5-src/himi-booking-account/index.ts +16 -1
  306. package/templates/salon-spa/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  307. package/templates/salon-spa/tier5-src/himi-store-account/index.ts +13 -4
  308. package/templates/wholesale-store/tier5-src/_shared/member-access.ts +17 -6
  309. package/templates/wholesale-store/tier5-src/himi-store-account/index.ts +13 -4
  310. package/templates/yoga-studio/config.ts +12 -0
  311. package/templates/yoga-studio/dev/index.ts +1 -1
  312. package/templates/yoga-studio/l10n/en.json +1 -1
  313. package/templates/yoga-studio/tier5-src/_shared/booking-session.ts +3 -1
  314. package/templates/yoga-studio/tier5-src/_shared/business-chat-transport.ts +148 -0
  315. package/templates/yoga-studio/tier5-src/_shared/header-badges.ts +113 -0
  316. package/templates/yoga-studio/tier5-src/_shared/location-pin.ts +97 -0
  317. package/templates/yoga-studio/tier5-src/_shared/member-access.ts +17 -6
  318. package/templates/yoga-studio/tier5-src/_shared/program-fields.ts +16 -0
  319. package/templates/yoga-studio/tier5-src/_shared/programs-section.ts +5 -8
  320. package/templates/yoga-studio/tier5-src/_shared/source-badges.ts +72 -0
  321. package/templates/yoga-studio/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  322. package/templates/yoga-studio/tier5-src/himi-branded-lite-nav/index.ts +152 -0
  323. package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +13 -4
  324. package/templates/yoga-studio/tier5-src/wix-spaces-view-profile/index.ts +68 -55
@@ -0,0 +1,11 @@
1
+ import type { WixProgram } from "@himalaya/wix-online-programs";
2
+
3
+ /** v3 nests the body in description.details; older responses use settings or a
4
+ * flat description. The body itself may be a Ricos document or serialized text. */
5
+ export function programDescription(program: WixProgram): unknown {
6
+ const raw = (program as { description?: unknown }).description;
7
+ const nested = raw && typeof raw === "object" ? raw as { details?: unknown; nodes?: unknown } : undefined;
8
+ return program.settings?.description ?? nested?.details
9
+ ?? (typeof raw === "string" || Array.isArray(nested?.nodes) ? raw : undefined)
10
+ ?? program.details?.description;
11
+ }
@@ -0,0 +1,16 @@
1
+ // How a worker reads an Online Program's lifecycle and name. Wix returns them in more than one
2
+ // shape (v3 `status` or `state`; `description.title`, `settings.title`, a flat `title` or
3
+ // `details.title`), so every screen that lists programs reads them here, the same way.
4
+ import type { WixProgram } from "@himalaya/wix-online-programs";
5
+ import { cleanTitle } from "./himi-text.js";
6
+
7
+ export function programStatus(p: WixProgram): string {
8
+ return (p.status ?? p.state ?? "").toUpperCase();
9
+ }
10
+ export const isProgramEnded = (p: WixProgram): boolean => programStatus(p) === "ENDED" || programStatus(p) === "FINISHED";
11
+ export const isProgramDraft = (p: WixProgram): boolean => programStatus(p) === "DRAFT";
12
+
13
+ /** The program's own name, cleaned; "" when it has none (the caller picks its own fallback word). */
14
+ export function programName(p: WixProgram): string {
15
+ return cleanTitle(p.description?.title ?? p.settings?.title ?? p.title ?? p.details?.title);
16
+ }
@@ -0,0 +1,46 @@
1
+ // The member's standing on one Online Program — the One App participant/application states, folded.
2
+ // Shared by the programs list cards and the program detail screen so both read a member the same way.
3
+ import type { WixJoinApplication, WixParticipant } from "@himalaya/wix-online-programs";
4
+
5
+ export type Standing = "none" | "joined" | "completed" | "finished" | "suspended" | "pending" | "approved" | "invited";
6
+
7
+ export function standingOf(ended: boolean, participant: WixParticipant | undefined, application: WixJoinApplication | undefined): Standing {
8
+ // A withdrawn participant is history even if its old progress says completed.
9
+ // Only its matching admitted application is history too; newer requests remain visible.
10
+ if (["LEFT", "REMOVED", "AUTO_REMOVED"].includes((participant?.enrollmentStatus ?? "").toUpperCase())) {
11
+ if (participant?.id && application?.participantId === participant.id && application.status?.toUpperCase() === "APPROVED") application = undefined;
12
+ participant = undefined;
13
+ }
14
+ if (participant) {
15
+ const progress = (participant.progressStatus ?? "").toUpperCase();
16
+ const enrollment = (participant.enrollmentStatus ?? "").toUpperCase();
17
+ if (progress === "COMPLETED") return "completed";
18
+ if (progress === "FAILED" || ended) return "finished";
19
+ if (enrollment === "SUSPENDED") return "suspended";
20
+ return "joined";
21
+ }
22
+ const status = (application?.status ?? "").toUpperCase();
23
+ const payment = (application?.paymentStatus ?? "").toUpperCase();
24
+ if (status === "APPROVAL_PENDING") return "pending";
25
+ if (status === "SUSPENDED") return "suspended";
26
+ if (status === "APPROVED") {
27
+ // The same reading as joinProgram: a free or settled approval is enrolling, and an offline payment
28
+ // waits on the owner. Only an approval that still owes money asks the member to pay.
29
+ if (payment === "NO_PAYMENT_REQUIRED" || payment === "PAYMENT_SUCCESSFUL") return application?.participantId ? "joined" : "pending";
30
+ if (payment === "PENDING_OWNER_APPROVAL") return "pending";
31
+ return "approved";
32
+ }
33
+ if (status === "PAYMENT_PENDING") return "approved";
34
+ if (status === "INVITED") return "invited";
35
+ return "none";
36
+ }
37
+
38
+ export const STATUS: Record<Exclude<Standing, "none">, { key: string; fallback: string; icon: string; color: string }> = {
39
+ joined: { key: "memberPrograms.status.joined", fallback: "Joined", icon: "checkmark", color: "accentPrimary" },
40
+ completed: { key: "memberPrograms.status.completed", fallback: "Program complete", icon: "trophy", color: "success" },
41
+ finished: { key: "memberPrograms.status.ended", fallback: "Program ended", icon: "flag", color: "textSecondary" },
42
+ suspended: { key: "memberPrograms.status.suspended", fallback: "Participation suspended", icon: "close", color: "warning" },
43
+ pending: { key: "memberPrograms.status.pending", fallback: "Pending request", icon: "clock", color: "warning" },
44
+ approved: { key: "memberPrograms.status.approved", fallback: "Request approved", icon: "checkmark", color: "success" },
45
+ invited: { key: "memberPrograms.status.invited", fallback: "Invited", icon: "mail", color: "accentPrimary" },
46
+ };
@@ -0,0 +1,78 @@
1
+ // [rico] #3370 — an entity's Ricos body, prepared for a RichContent component and its plain-text fallback.
2
+ // One rule for every worker that renders a body (the blog post and the owner post detail today; #3372's
3
+ // verticals next), so they cannot drift apart.
4
+ // Inside the platform source this import is a relative path, so node test runs resolve it; an app's copy
5
+ // imports "@himalaya/wix-rich-content".
6
+ import { encodeRichContent, parseRicosJson, ricosToPlainText } from "@himalaya/wix-rich-content";
7
+
8
+ /** What a body-rendering worker publishes: `<name>Json` for `documentJsonPath`, and the plain text. */
9
+ export interface RichBody {
10
+ /** The document as ONE JSON string (media sized, disallowed links dropped); "" when there is no document
11
+ * or the encoder rejected it. RichContent draws nothing for "", so a screen gates its plain text on it. */
12
+ bodyJson: string;
13
+ /** The plain text: the document's own text when it has any, else `fallback`. */
14
+ bodyText: string;
15
+ }
16
+
17
+ /** [rico] #3372 — the media width for a document drawn in a LIST row (a feed post, a comment, a CMS item): the
18
+ * list-image size (WIX_LIST_IMAGE), so a scrolling list never downloads every image at detail size. */
19
+ export const ROW_IMAGE_WIDTH = 1000;
20
+
21
+ /** Prepares `richContent` (a Ricos document, as a Wix API returns it, or its JSON string). No document, or one
22
+ * that is not a document, gives `{ bodyJson: "", bodyText: fallback }`. A document past the viewer's limits
23
+ * gives bodyJson "" and its plain text — except one rejected as too deep, which is not walked again (the
24
+ * plain-text walk has no depth limit), so `fallback` stands in for it. `imageWidth` sizes its media (default
25
+ * the 1400 px detail budget). */
26
+ export function richBody(richContent: unknown, fallback = "", imageWidth = 1400): RichBody {
27
+ const doc = parseRicosJson(richContent);
28
+ if (!doc) return { bodyJson: "", bodyText: fallback };
29
+ // 1400 px by default — the detail-image budget, which is also the encoder's maximum; list rows pass
30
+ // ROW_IMAGE_WIDTH.
31
+ const { json, rejected } = encodeRichContent(doc, { imageWidth });
32
+ const text = rejected === "too_deep" ? "" : ricosToPlainText(doc);
33
+ return { bodyJson: json, bodyText: text || fallback };
34
+ }
35
+
36
+ /** A Wix description may be Ricos (including serialized JSON), HTML or ordinary text.
37
+ * Keep rich documents on the existing bounded encoder path. Non-document JSON and
38
+ * clearly malformed serialization use an independent fallback. Ambiguous bracketed
39
+ * prose stays readable; this does not attempt to repair arbitrary JSON syntax. */
40
+ export function descriptionBody(value: unknown, fallback = "", imageWidth = 1400): RichBody {
41
+ if (typeof value !== "string") return richBody(value, fallback, imageWidth);
42
+ const text = value.trim();
43
+ if (/^[{[]/.test(text)) {
44
+ try {
45
+ const parsed: unknown = JSON.parse(text);
46
+ // Passing the parsed value avoids parsing a valid Ricos document twice; a
47
+ // different JSON structure is rejected by the same existing document check.
48
+ if (parsed && typeof parsed === "object") return richBody(parsed, fallback, imageWidth);
49
+ } catch {
50
+ const objectLike = /^\{\s*(?:["'}]|nodes\b)/.test(text);
51
+ // Only reject scalar-looking malformed arrays when their syntax is clearly
52
+ // unfinished (or contains JS's non-JSON `undefined`). Balanced bracketed
53
+ // prose such as "[1,000]" and "[12:30, 13:30]" is not JSON and stays readable.
54
+ const arrayTokens = text.replace(/"(?:\\.|[^"\\])*"/g, "")
55
+ .replace(/\b(?:true|false|null|undefined)\b/g, "")
56
+ .replace(/-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/g, "");
57
+ const arrayLike = /^\[\s*[{"]/.test(text)
58
+ || (text.startsWith("[") && /^[\s[\]{},:]*$/.test(arrayTokens)
59
+ && (/,\s*]?$/.test(text) || /\bundefined\b/.test(text) || !text.endsWith("]")));
60
+ if (objectLike || arrayLike) return { bodyJson: "", bodyText: fallback };
61
+ }
62
+ }
63
+ // Legacy HTML descriptions stay text. Preserve paragraph breaks and ordinary prose's
64
+ // bare '<' (e.g. "ages < 8"), without relying on browser-only DOM APIs in workers.
65
+ const plain = text
66
+ .replace(/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi, "")
67
+ .replace(/<br\s*\/?\s*>/gi, "\n")
68
+ .replace(/<\/(?:p|div|h[1-6]|li)\s*>/gi, "\n\n")
69
+ .replace(/<\/?[a-z][^>]*>/gi, "")
70
+ .replace(/&(?:nbsp|amp|lt|gt|quot|apos|#39);/gi, (entity) => ({
71
+ "&nbsp;": " ", "&amp;": "&", "&lt;": "<", "&gt;": ">", "&quot;": '"', "&apos;": "'", "&#39;": "'",
72
+ })[entity.toLowerCase()] ?? entity)
73
+ .replace(/[\t\r ]+/g, " ")
74
+ .replace(/ *\n */g, "\n")
75
+ .replace(/\n{3,}/g, "\n\n")
76
+ .trim();
77
+ return { bodyJson: "", bodyText: plain || fallback };
78
+ }
@@ -0,0 +1,34 @@
1
+ // [rico] #3370 — a RichContent `on_link` tap reaches the worker as `{ url }` (the renderers merge the tapped
2
+ // link into the action's args). Only http(s) with a host, mailto and tel ever reach the OS; anything
3
+ // else is dropped here, before any dispatch. The renderers already refuse other schemes, but the action
4
+ // arrives here as plain data, so the worker checks it again rather than trusting whoever sent it.
5
+ import { open, defaultMode } from "@himalaya/open-url";
6
+
7
+ /** The viewer's link rule, verbatim (`LINK` in @himalaya/wix-rich-content's display.ts, which the package does
8
+ * not export); a parity test pins this copy to the original. */
9
+ const LINK = /^(https?:\/\/[^\s/?#]\S*|mailto:\S+|tel:\S+)$/i;
10
+ /** ASCII whitespace only, as the viewer trims a link before applying the rule. */
11
+ const trimAscii = (s: string): string => s.replace(/^[\t\n\v\f\r ]+|[\t\n\v\f\r ]+$/g, "");
12
+
13
+ /** The url of a link tap (`{ url }`, `{ args: { url } }` or a bare string), or "" when it is missing or
14
+ * not an http(s), mailto or tel link. */
15
+ export function richLinkUrl(arg: unknown): string {
16
+ const a = arg as { url?: unknown; args?: { url?: unknown } } | null | undefined;
17
+ const raw = typeof arg === "string" ? arg
18
+ : typeof a?.url === "string" ? a.url
19
+ : typeof a?.args?.url === "string" ? a.args.url : "";
20
+ const url = trimAscii(raw);
21
+ return LINK.test(url) ? url : "";
22
+ }
23
+
24
+ /** Opens a link tap through `capability.open_url` (http(s) in the in-app browser, mailto/tel in the system
25
+ * handler). False when the link is blocked, nothing took it, or the host threw. */
26
+ export async function openRichLink(arg: unknown): Promise<boolean> {
27
+ const url = richLinkUrl(arg);
28
+ if (!url) return false;
29
+ try {
30
+ return (await open(url, defaultMode(url))).opened;
31
+ } catch {
32
+ return false;
33
+ }
34
+ }
@@ -0,0 +1,18 @@
1
+ // A sign-in sheet can be a form page rather than a drawer. `sheetStyle: "page"` keeps the iOS sheet
2
+ // and opens a full-screen modal on Android and web, whose sheet is a bottom drawer. A host older
3
+ // than the param ignores it and draws its own sheet.
4
+ //
5
+ // Opt-in per app: the app passes `signInSheetStyle: "page"` beside `signInPresentation`. These
6
+ // workers are shared (Salon & Spa runs them too), and an app that opens its other sign-ins as a
7
+ // plain sheet must not get a page from some of them and a drawer from the rest.
8
+
9
+ /** The app's `signInSheetStyle` param, read beside `signInPresentation`: "page", else "". */
10
+ export function signInPageStyle(value: unknown): "page" | "" {
11
+ return value === "page" ? "page" : "";
12
+ }
13
+
14
+ /** The nav args a sign-in opened with `presentation` adds: `sheetStyle` on a sheet the app asked
15
+ * to open as a page, else none. */
16
+ export function signInSheetStyle(presentation: string | undefined, style: "page" | ""): { sheetStyle?: "page" } {
17
+ return presentation === "sheet" && style === "page" ? { sheetStyle: "page" } : {};
18
+ }
@@ -0,0 +1,18 @@
1
+ // How a staff member's name splits into words for initials and short names, shared by every
2
+ // worker that shows Bookings staff (himi-booking-service, himi-clinic-home), so a doctor's
3
+ // initials read the same on every screen ("Dr. John Wang, MD" is "JW" everywhere).
4
+
5
+ /** A courtesy title a staff name may start with ("Dr. John Wang"): not a name of its own. */
6
+ const TITLE = /^(dr|prof|mr|mrs|ms|mx)\.?$/i;
7
+ /** A credential or suffix a staff name may end with ("John Wang, MD", "Martin King Jr."). No
8
+ * "Do" or "Pa": they are surnames too ("Anh Do"). */
9
+ const SUFFIX = /^(md|phd|dds|dmd|rn|np|jr|sr|ii|iii|iv)\.?$/i;
10
+
11
+ /** The name's words without a leading title or trailing credentials, commas dropped. A one-word
12
+ * name keeps its word, title or not. */
13
+ export function nameWords(name: string): { title: string; words: string[] } {
14
+ const words = name.split(/\s+/).map((word) => word.replace(/,+$/, "")).filter(Boolean);
15
+ const title = words.length > 1 && TITLE.test(words[0]!) ? words.shift()! : "";
16
+ while (words.length > 1 && SUFFIX.test(words[words.length - 1]!)) words.pop();
17
+ return { title, words };
18
+ }
@@ -0,0 +1,107 @@
1
+ // The weekly session goal (`provisioning.goals.weeklySessions`) over a member's own bookings —
2
+ // shared by the home weekly-goal Gauge (himi-branded-lite-home) and the My Bookings "This week"
3
+ // card (himi-booking-bookings), so the two can never count differently.
4
+ //
5
+ // WHAT COUNTS as a session toward the goal: a CONFIRMED booking whose start falls in the CURRENT
6
+ // calendar week (Monday 00:00 local → now) and is already in the past. An allow-list, not a
7
+ // deny-list: CREATED (checkout never completed), PENDING / PENDING_APPROVAL / PENDING_CHECKOUT,
8
+ // WAITING_LIST, CANCELED and DECLINED — and any status Wix adds later — do not count. That is
9
+ // "booked and it happened", not verified
10
+ // attendance: the member-scoped queryBookings row carries no attendance/check-in field (the Wix
11
+ // Attendance API is owner-scoped), so a no-show still counts. Future bookings this week do not
12
+ // count — they have not happened yet.
13
+ //
14
+ // DETERMINISM: nothing here runs at worker boot; every clock read is an argument. PURE (no network,
15
+ // no bridge) so the rules are unit-tested directly; the read lives with its caller.
16
+
17
+ import type { MemberBookingRow } from "./member-bookings.js";
18
+ import { copyParam, copyTemplate } from "./himi-copy.js";
19
+
20
+ export const MAX_WEEKLY_SESSION_GOAL = 21;
21
+
22
+ /** The one status that means the session was booked and held (as memberBookingRow normalizes
23
+ * it: upper-case, `_` → space). */
24
+ const COUNTS_AS_SESSION = /^CONFIRMED$/;
25
+
26
+ /** At most this many pages of past bookings are read for one week's count. */
27
+ export const MAX_WEEKLY_PAGES = 4;
28
+
29
+ /** The onAppear `weeklyGoal` param → a goal in [1, 21], or 0 = no goal provisioned. */
30
+ export function parseWeeklyGoal(raw: unknown): number {
31
+ const n = typeof raw === "number" ? raw : typeof raw === "string" && raw.trim() !== "" ? Number(raw) : NaN;
32
+ return Number.isInteger(n) && n >= 1 ? Math.min(n, MAX_WEEKLY_SESSION_GOAL) : 0;
33
+ }
34
+
35
+ /** Monday 00:00 local of `now`'s week, epoch ms. */
36
+ export function weekStartMs(now: number): number {
37
+ const d = new Date(now);
38
+ d.setHours(0, 0, 0, 0);
39
+ d.setDate(d.getDate() - ((d.getDay() + 6) % 7));
40
+ return d.getTime();
41
+ }
42
+
43
+ /** Sessions toward the goal among `rows` — see the file header for what counts. */
44
+ export function weeklySessionsDone(rows: readonly MemberBookingRow[], now: number): number {
45
+ const from = weekStartMs(now);
46
+ const seen = new Set<string>();
47
+ for (const row of rows) {
48
+ const start = Date.parse(row.start);
49
+ if (!Number.isFinite(start) || start < from || start >= now) continue;
50
+ if (!COUNTS_AS_SESSION.test((row.status || "").trim().toUpperCase())) continue;
51
+ seen.add(row.id || `${row.start}|${row.title}`);
52
+ }
53
+ return seen.size;
54
+ }
55
+
56
+ export interface BookingsPage {
57
+ items: MemberBookingRow[];
58
+ nextCursor?: string;
59
+ }
60
+
61
+ /** Sessions toward the goal from PAST bookings read newest-first: `first` is the first page, and
62
+ * `next(cursor)` reads more only while the oldest row so far is still inside this week (a page of
63
+ * 50 almost always reaches back before Monday). Bounded to MAX_WEEKLY_PAGES reads; a failing
64
+ * read rejects, so the caller hides the count rather than under-counting. */
65
+ export async function weeklySessionsFromPages(
66
+ first: BookingsPage,
67
+ next: (cursor: string) => Promise<BookingsPage>,
68
+ now: number,
69
+ ): Promise<number> {
70
+ const from = weekStartMs(now);
71
+ const rows = [...first.items];
72
+ let page = first;
73
+ for (let read = 1; read < MAX_WEEKLY_PAGES && page.nextCursor; read++) {
74
+ const oldest = page.items[page.items.length - 1];
75
+ if (oldest && Date.parse(oldest.start) < from) break;
76
+ page = await next(page.nextCursor);
77
+ rows.push(...page.items);
78
+ }
79
+ return weeklySessionsDone(rows, now);
80
+ }
81
+
82
+ export interface WeeklyGoalProgress {
83
+ done: number;
84
+ goal: number;
85
+ /** 0..1 — the Gauge / ProgressBar fill. */
86
+ fraction: number;
87
+ met: boolean;
88
+ /** "1 of 2 sessions this week" */
89
+ label: string;
90
+ /** "1 more to reach your weekly goal" / "Weekly goal reached. Great consistency." */
91
+ remainingLabel: string;
92
+ }
93
+
94
+ export function weeklyGoalProgress(done: number, goal: number): WeeklyGoalProgress {
95
+ const safeGoal = Math.max(1, goal);
96
+ const met = done >= safeGoal;
97
+ return {
98
+ done,
99
+ goal: safeGoal,
100
+ fraction: Math.min(done / safeGoal, 1),
101
+ met,
102
+ label: copyTemplate("weeklyGoal.progress", "{done} of {goal} sessions this week", { done, goal: safeGoal }),
103
+ remainingLabel: met
104
+ ? copyParam("weeklyGoal.met", "Weekly goal reached. Great consistency.")
105
+ : copyTemplate("weeklyGoal.remaining", "{count} more to reach your weekly goal", { count: safeGoal - done }),
106
+ };
107
+ }
@@ -0,0 +1,85 @@
1
+ // RN BI events whose fields exist only in a worker (epic #4973). The platform maps send every
2
+ // other RN event; these go through `wixPlatform.bi.log`, built inline with RN's own field names
3
+ // rather than by bundling a `@wix/bi-logger-*` package. The host owns every identity and common
4
+ // field (msid, uuid, installationId, contactId, _lv, ...), so none is named here.
5
+ import { bi, type BiLogEvent } from "@himalaya/wix-platform";
6
+
7
+ /** Sends one event without waiting for it and never throws: BI must not change a screen. A
8
+ * screen whose descriptor does not declare `wix_platform` is refused by the host, which is
9
+ * swallowed here like any other BI failure. */
10
+ export function logBi(event: BiLogEvent): void {
11
+ try {
12
+ void Promise.resolve(bi.log(event)).catch(() => undefined);
13
+ } catch {
14
+ /* BI is best-effort */
15
+ }
16
+ }
17
+
18
+ /** The HTTP status a Wix SDK error carries (`HTTP 429: ...`, or a `status` field), else 0. */
19
+ export function wixErrorStatus(error: unknown): number {
20
+ const own = Number((error as { status?: unknown; statusCode?: unknown } | null)?.status ?? (error as { statusCode?: unknown } | null)?.statusCode);
21
+ if (Number.isFinite(own) && own > 0) return own;
22
+ const match = /\bHTTP (\d{3})\b/.exec(String((error as Error | null)?.message ?? error ?? ""));
23
+ return match ? Number(match[1]) : 0;
24
+ }
25
+
26
+ function applicationErrorCode(body: unknown): string {
27
+ const o = body as { details?: { applicationError?: { code?: unknown } }; applicationError?: { code?: unknown }; code?: unknown } | null;
28
+ const code = o?.details?.applicationError?.code ?? o?.applicationError?.code ?? o?.code;
29
+ return typeof code === "string" ? code : "";
30
+ }
31
+
32
+ /** The code both native bridges put in an application error's message: `HTTP 400 [CODE]: description`
33
+ * (iOS JSWorker.swift `WixApiCapability.Error.application`, Android WebViewJSWorker.kt `Error.Application`). */
34
+ const BRIDGE_APPLICATION_CODE = /\bHTTP \d{3} \[([A-Za-z0-9_.:-]+)\]/;
35
+
36
+ /** The Wix application error code of a failed call (RN's `serializeError(e).code`): read from the
37
+ * error itself, else from the `[CODE]` the native bridges put after `HTTP <status> `, else from the
38
+ * JSON body after `HTTP <status>: ` (the bridges' raw-status arm and the web host's wixCall). ""
39
+ * when there is none. */
40
+ export function wixErrorCode(error: unknown): string {
41
+ const own = applicationErrorCode(error);
42
+ if (own) return own;
43
+ const message = String((error as Error | null)?.message ?? error ?? "");
44
+ const bracketed = BRIDGE_APPLICATION_CODE.exec(message);
45
+ if (bracketed) return bracketed[1];
46
+ const start = message.indexOf("{");
47
+ if (start < 0) return "";
48
+ try {
49
+ return applicationErrorCode(JSON.parse(message.slice(start)));
50
+ } catch {
51
+ return "";
52
+ }
53
+ }
54
+
55
+ // RN's `ErrorIndicationType` (mobile-apps-inbox services/errorIndications/errorIndications.type.ts).
56
+ const ERROR_INDICATIONS = new Set([
57
+ "ACCESS_TOKEN_EXPIRED", "ALLOWED_MESSAGING_TIME_WINDOW_EXPIRED", "ATTACHMENT_SIZE_EXCEEDS_ALLOWED_LIMIT", "CAMPAIGN_SUSPENDED",
58
+ "FACEBOOK_ALLOWED_WINDOW_EXPIRED", "GMAIL_ADV_PROTECTION", "INSTAGRAM_ALLOWED_WINDOW_EXPIRED", "INVALID_CHARACTERS",
59
+ "INVALID_PHONE_NUMBER", "INVALID_RECIPIENT_ADDRESS", "LANDLINE_OR_UNREACHABLE_CARRIER", "MESSAGE_FILTERED",
60
+ "MMS_NOT_SUPPORTED_RECEIVING_PHONE_NUMBER", "NETWORK_ISSUE", "NO_MATCHING_RECIPIENT_FOUND", "POLICY_VIOLATION", "QUOTA_EXCEEDED",
61
+ "RATE_LIMIT", "RATE_LIMIT_ERROR", "RECIPIENT_BLOCKED_MESSAGES", "RECIPIENT_NOT_AVAILABLE", "SERVICE_UNAVAILABLE",
62
+ "TELCO_LANDLINE_OR_UNREACHABLE_CARRIER", "TELCO_MEDIA_EXCEEDS_MESSAGING_PROVIDER_SIZE_LIMIT",
63
+ "TELCO_MESSAGE_DELIVERY_UNKNOWN_DESTINATION_HANDSET", "TELCO_MESSAGE_FILTERED", "TELCO_MESSAGE_FROM_NUMBER_STILL_BEING_CONFIGURED",
64
+ "TELCO_MESSAGE_FROM_UNREGISTERED_NUMBER", "TELCO_UNKNOWN_ERROR", "TELCO_UNREACHABLE_DESTINATION_HANDSET", "TOO_MANY_REQUESTS",
65
+ "TOTAL_ATTACHMENTS_SIZE_EXCEEDS_ALLOWED_LIMIT", "UNEXPECTED_ERROR_RETRY_LATER", "UNKNOWN_FAILED_CODE", "UNSUPPORTED",
66
+ "UNSUPPORTED_MESSAGE_TYPE", "USER_RATE_LIMIT",
67
+ ]);
68
+
69
+ /** 5:1604 inboxSendMessageErrorMsgShown (`@wix/bi-logger-crm-data` v2, endpoint ''), for a chat
70
+ * send that failed and said so. RN's `errorReason` is the failed message's indication code, and
71
+ * RN reports a code it does not know as UNSUPPORTED (`getErrorIndicationFromCode`); a send that
72
+ * never left the device is NETWORK_ISSUE and a 429 is RATE_LIMIT. */
73
+ export function logChatSendError(input: { chatroomId: string; contactId?: string; error: unknown; offline: boolean }): void {
74
+ const code = wixErrorCode(input.error);
75
+ const errorReason = input.offline ? "NETWORK_ISSUE"
76
+ : ERROR_INDICATIONS.has(code) ? code
77
+ : wixErrorStatus(input.error) === 429 ? "RATE_LIMIT"
78
+ : "UNSUPPORTED";
79
+ logBi({
80
+ evid: 1604,
81
+ src: 5,
82
+ endpoint: "",
83
+ params: { origin: "native", chatroomId: input.chatroomId, ...(input.contactId ? { contact_id: input.contactId } : {}), errorReason },
84
+ });
85
+ }
@@ -0,0 +1,114 @@
1
+ // The destination data the inbox tap needs from the Wix member-link catalog (the one an app's push taps use):
2
+ // which links a member notification carries, and the canonical Himi screen and param each one opens.
3
+ //
4
+ // This is a COPY, on purpose. A worker's shared helpers are copied into the starter app by the template
5
+ // generator, which follows only relative imports that stay inside the bundles source folder, so a worker
6
+ // cannot import the catalog from its own package without breaking `himi init`.
7
+ // The copy is pinned to the catalog by the notification-target parity test (every id, link, param and
8
+ // screen must match), so a catalog change fails that test until this file follows it.
9
+ //
10
+ // Generated from the catalog's `id`, `matches`, `screenParam` and `canonicalScreen`; `vertical`, `audience`
11
+ // and the commentary belong to the catalog and are not repeated here.
12
+
13
+ export interface MemberLinkDestination {
14
+ id: string;
15
+ /** Longest first, as in the catalog. */
16
+ matches: readonly string[];
17
+ /** The capture that names the item; absent for a list screen. */
18
+ screenParam?: string;
19
+ canonicalScreen: string;
20
+ }
21
+
22
+ export const MEMBER_LINK_DESTINATIONS: readonly MemberLinkDestination[] = [
23
+ {
24
+ id: "store.order",
25
+ matches: [
26
+ "my-account/:site/stores/orders/:orderId",
27
+ ],
28
+ screenParam: "orderId",
29
+ canonicalScreen: "himi_order",
30
+ },
31
+ {
32
+ id: "bookings.session",
33
+ matches: [
34
+ "bookings/app/:site/:businessId/:sessionId",
35
+ ],
36
+ canonicalScreen: "himi_bookings",
37
+ },
38
+ {
39
+ id: "groups.post",
40
+ matches: [
41
+ "clubs-member/club/:groupId/feed/post/:postId/:commentId",
42
+ "clubs-member/club/:groupId/feed/post/:postId",
43
+ ],
44
+ screenParam: "groupId",
45
+ canonicalScreen: "himi_group",
46
+ },
47
+ {
48
+ id: "forum.thread",
49
+ matches: [
50
+ "forum/post/:postId/:commentId/:replyId",
51
+ "forum/post/:postId/:commentId",
52
+ "forum/post/:postId",
53
+ ],
54
+ screenParam: "postId",
55
+ canonicalScreen: "himi_forum_post",
56
+ },
57
+ {
58
+ id: "forum.create",
59
+ matches: [
60
+ "forum/create-post",
61
+ ],
62
+ canonicalScreen: "himi_create_post",
63
+ },
64
+ {
65
+ id: "blog.post",
66
+ matches: [
67
+ "blog/post/:postId",
68
+ ],
69
+ screenParam: "postId",
70
+ canonicalScreen: "himi_blog_post",
71
+ },
72
+ {
73
+ id: "members.profile",
74
+ matches: [
75
+ "members-area/member-profile/:memberId",
76
+ ],
77
+ screenParam: "memberId",
78
+ canonicalScreen: "himi_member",
79
+ },
80
+ {
81
+ id: "events.event",
82
+ matches: [
83
+ "my-account/app/140603ad-af8d-84a5-2c80-a0f60cb47351/:instanceId/:eventId/guest-list/:path",
84
+ "my-account/app/140603ad-af8d-84a5-2c80-a0f60cb47351/:instanceId/:eventId/details",
85
+ ],
86
+ screenParam: "eventId",
87
+ canonicalScreen: "himi_event",
88
+ },
89
+ {
90
+ id: "galleries.shared",
91
+ matches: [
92
+ "shared-gallery/:site/preview/:itemId",
93
+ ],
94
+ canonicalScreen: "himi_galleries",
95
+ },
96
+ {
97
+ id: "galleries.album",
98
+ matches: [
99
+ "lists/:site/:listId/media/:itemId/:commentId",
100
+ "lists/:site/:listId/:tab/:commentId",
101
+ "spaces/lists/:site/:listId/:tab",
102
+ "lists/:site/:listId/:itemId",
103
+ ],
104
+ screenParam: "listId",
105
+ canonicalScreen: "himi_photo_album",
106
+ },
107
+ {
108
+ id: "notifications.list",
109
+ matches: [
110
+ "notifications/list/:site",
111
+ ],
112
+ canonicalScreen: "himi_notifications",
113
+ },
114
+ ];