@wix/himalaya-cli 0.1794.0 → 0.1796.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 (350) hide show
  1. package/dist/browser-plane/assets.json +5 -5
  2. package/dist/browser-plane/preview-deferred/{83e211fe9fba65cca1fac7a0d552fbd3ba2873496f1c6117d5ac561d489ac839.bin → 04eac2ea24e0edfcc5aaa757dc5d06c6bf35c3c5ce9ccbb448b305db05715492.bin} +1 -1
  3. package/dist/browser-plane/sw.js +8 -8
  4. package/dist/cli.mjs +79 -46
  5. package/dist/preview-assets.generated.bin +0 -0
  6. package/package.json +2 -2
  7. package/templates/beauty-salon/config.ts +16 -1
  8. package/templates/beauty-salon/l10n/ar.json +6 -5
  9. package/templates/beauty-salon/l10n/cs.json +6 -5
  10. package/templates/beauty-salon/l10n/da.json +6 -5
  11. package/templates/beauty-salon/l10n/de.json +6 -5
  12. package/templates/beauty-salon/l10n/el.json +6 -5
  13. package/templates/beauty-salon/l10n/en.json +8 -1
  14. package/templates/beauty-salon/l10n/es.json +6 -5
  15. package/templates/beauty-salon/l10n/fi.json +6 -5
  16. package/templates/beauty-salon/l10n/fr.json +6 -5
  17. package/templates/beauty-salon/l10n/he.json +5 -4
  18. package/templates/beauty-salon/l10n/hu.json +6 -5
  19. package/templates/beauty-salon/l10n/id.json +6 -5
  20. package/templates/beauty-salon/l10n/it.json +6 -5
  21. package/templates/beauty-salon/l10n/ja.json +6 -5
  22. package/templates/beauty-salon/l10n/ko.json +6 -5
  23. package/templates/beauty-salon/l10n/lt.json +6 -5
  24. package/templates/beauty-salon/l10n/nl.json +6 -5
  25. package/templates/beauty-salon/l10n/no.json +6 -5
  26. package/templates/beauty-salon/l10n/pl.json +6 -5
  27. package/templates/beauty-salon/l10n/pt.json +6 -5
  28. package/templates/beauty-salon/l10n/ru.json +6 -5
  29. package/templates/beauty-salon/l10n/sv.json +6 -5
  30. package/templates/beauty-salon/l10n/th.json +6 -5
  31. package/templates/beauty-salon/l10n/tr.json +6 -5
  32. package/templates/beauty-salon/l10n/uk.json +6 -5
  33. package/templates/beauty-salon/l10n/vi.json +6 -5
  34. package/templates/beauty-salon/l10n/zh.json +6 -5
  35. package/templates/beauty-salon/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  36. package/templates/branded-lite/config.ts +26 -1
  37. package/templates/branded-lite/dev/index.ts +955 -1
  38. package/templates/branded-lite/himalaya.content.json +3 -0
  39. package/templates/branded-lite/l10n/ar.json +106 -5
  40. package/templates/branded-lite/l10n/cs.json +106 -5
  41. package/templates/branded-lite/l10n/da.json +106 -5
  42. package/templates/branded-lite/l10n/de.json +106 -5
  43. package/templates/branded-lite/l10n/el.json +106 -5
  44. package/templates/branded-lite/l10n/en.json +43 -1
  45. package/templates/branded-lite/l10n/es.json +106 -5
  46. package/templates/branded-lite/l10n/fi.json +106 -5
  47. package/templates/branded-lite/l10n/fr.json +106 -5
  48. package/templates/branded-lite/l10n/he.json +86 -4
  49. package/templates/branded-lite/l10n/hu.json +106 -5
  50. package/templates/branded-lite/l10n/id.json +106 -5
  51. package/templates/branded-lite/l10n/it.json +106 -5
  52. package/templates/branded-lite/l10n/ja.json +106 -5
  53. package/templates/branded-lite/l10n/ko.json +106 -5
  54. package/templates/branded-lite/l10n/lt.json +106 -5
  55. package/templates/branded-lite/l10n/nl.json +106 -5
  56. package/templates/branded-lite/l10n/no.json +106 -5
  57. package/templates/branded-lite/l10n/pl.json +106 -5
  58. package/templates/branded-lite/l10n/pt.json +106 -5
  59. package/templates/branded-lite/l10n/ru.json +106 -5
  60. package/templates/branded-lite/l10n/sv.json +106 -5
  61. package/templates/branded-lite/l10n/th.json +106 -5
  62. package/templates/branded-lite/l10n/tr.json +106 -5
  63. package/templates/branded-lite/l10n/uk.json +106 -5
  64. package/templates/branded-lite/l10n/vi.json +106 -5
  65. package/templates/branded-lite/l10n/zh.json +106 -5
  66. package/templates/branded-lite/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  67. package/templates/branded-lite/tier5-src/_shared/program-content.ts +94 -0
  68. package/templates/branded-lite/tier5-src/_shared/program-progress-mark.ts +22 -0
  69. package/templates/branded-lite/tier5-src/_shared/program-reads.ts +72 -0
  70. package/templates/branded-lite/tier5-src/himi-branded-lite-program-participant/index.ts +46 -62
  71. package/templates/branded-lite/tier5-src/himi-branded-lite-program-participant/model.ts +12 -76
  72. package/templates/branded-lite/tier5-src/himi-branded-lite-program-step/index.ts +520 -0
  73. package/templates/branded-lite/tier5-src/himi-branded-lite-program-step/model.ts +69 -0
  74. package/templates/brandy/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  75. package/templates/community-club/config.ts +16 -1
  76. package/templates/community-club/l10n/ar.json +6 -5
  77. package/templates/community-club/l10n/cs.json +6 -5
  78. package/templates/community-club/l10n/da.json +6 -5
  79. package/templates/community-club/l10n/de.json +6 -5
  80. package/templates/community-club/l10n/el.json +6 -5
  81. package/templates/community-club/l10n/en.json +8 -1
  82. package/templates/community-club/l10n/es.json +6 -5
  83. package/templates/community-club/l10n/fi.json +6 -5
  84. package/templates/community-club/l10n/fr.json +6 -5
  85. package/templates/community-club/l10n/he.json +5 -4
  86. package/templates/community-club/l10n/hu.json +6 -5
  87. package/templates/community-club/l10n/id.json +6 -5
  88. package/templates/community-club/l10n/it.json +6 -5
  89. package/templates/community-club/l10n/ja.json +6 -5
  90. package/templates/community-club/l10n/ko.json +6 -5
  91. package/templates/community-club/l10n/lt.json +6 -5
  92. package/templates/community-club/l10n/nl.json +6 -5
  93. package/templates/community-club/l10n/no.json +6 -5
  94. package/templates/community-club/l10n/pl.json +6 -5
  95. package/templates/community-club/l10n/pt.json +6 -5
  96. package/templates/community-club/l10n/ru.json +6 -5
  97. package/templates/community-club/l10n/sv.json +6 -5
  98. package/templates/community-club/l10n/th.json +6 -5
  99. package/templates/community-club/l10n/tr.json +6 -5
  100. package/templates/community-club/l10n/uk.json +6 -5
  101. package/templates/community-club/l10n/vi.json +6 -5
  102. package/templates/community-club/l10n/zh.json +6 -5
  103. package/templates/community-club/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  104. package/templates/conference/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  105. package/templates/events-meetups/config.ts +16 -1
  106. package/templates/events-meetups/l10n/ar.json +6 -5
  107. package/templates/events-meetups/l10n/cs.json +6 -5
  108. package/templates/events-meetups/l10n/da.json +6 -5
  109. package/templates/events-meetups/l10n/de.json +6 -5
  110. package/templates/events-meetups/l10n/el.json +6 -5
  111. package/templates/events-meetups/l10n/en.json +8 -1
  112. package/templates/events-meetups/l10n/es.json +6 -5
  113. package/templates/events-meetups/l10n/fi.json +6 -5
  114. package/templates/events-meetups/l10n/fr.json +6 -5
  115. package/templates/events-meetups/l10n/he.json +5 -4
  116. package/templates/events-meetups/l10n/hu.json +6 -5
  117. package/templates/events-meetups/l10n/id.json +6 -5
  118. package/templates/events-meetups/l10n/it.json +6 -5
  119. package/templates/events-meetups/l10n/ja.json +6 -5
  120. package/templates/events-meetups/l10n/ko.json +6 -5
  121. package/templates/events-meetups/l10n/lt.json +6 -5
  122. package/templates/events-meetups/l10n/nl.json +6 -5
  123. package/templates/events-meetups/l10n/no.json +6 -5
  124. package/templates/events-meetups/l10n/pl.json +6 -5
  125. package/templates/events-meetups/l10n/pt.json +6 -5
  126. package/templates/events-meetups/l10n/ru.json +6 -5
  127. package/templates/events-meetups/l10n/sv.json +6 -5
  128. package/templates/events-meetups/l10n/th.json +6 -5
  129. package/templates/events-meetups/l10n/tr.json +6 -5
  130. package/templates/events-meetups/l10n/uk.json +6 -5
  131. package/templates/events-meetups/l10n/vi.json +6 -5
  132. package/templates/events-meetups/l10n/zh.json +6 -5
  133. package/templates/events-meetups/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  134. package/templates/fitness-gym/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  135. package/templates/gym-fitness/config.ts +16 -1
  136. package/templates/gym-fitness/l10n/ar.json +6 -5
  137. package/templates/gym-fitness/l10n/cs.json +6 -5
  138. package/templates/gym-fitness/l10n/da.json +6 -5
  139. package/templates/gym-fitness/l10n/de.json +6 -5
  140. package/templates/gym-fitness/l10n/el.json +6 -5
  141. package/templates/gym-fitness/l10n/en.json +8 -1
  142. package/templates/gym-fitness/l10n/es.json +6 -5
  143. package/templates/gym-fitness/l10n/fi.json +6 -5
  144. package/templates/gym-fitness/l10n/fr.json +6 -5
  145. package/templates/gym-fitness/l10n/he.json +5 -4
  146. package/templates/gym-fitness/l10n/hu.json +6 -5
  147. package/templates/gym-fitness/l10n/id.json +6 -5
  148. package/templates/gym-fitness/l10n/it.json +6 -5
  149. package/templates/gym-fitness/l10n/ja.json +6 -5
  150. package/templates/gym-fitness/l10n/ko.json +6 -5
  151. package/templates/gym-fitness/l10n/lt.json +6 -5
  152. package/templates/gym-fitness/l10n/nl.json +6 -5
  153. package/templates/gym-fitness/l10n/no.json +6 -5
  154. package/templates/gym-fitness/l10n/pl.json +6 -5
  155. package/templates/gym-fitness/l10n/pt.json +6 -5
  156. package/templates/gym-fitness/l10n/ru.json +6 -5
  157. package/templates/gym-fitness/l10n/sv.json +6 -5
  158. package/templates/gym-fitness/l10n/th.json +6 -5
  159. package/templates/gym-fitness/l10n/tr.json +6 -5
  160. package/templates/gym-fitness/l10n/uk.json +6 -5
  161. package/templates/gym-fitness/l10n/vi.json +6 -5
  162. package/templates/gym-fitness/l10n/zh.json +6 -5
  163. package/templates/gym-fitness/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  164. package/templates/medical-services/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  165. package/templates/nonprofit-cause/config.ts +16 -1
  166. package/templates/nonprofit-cause/l10n/ar.json +6 -5
  167. package/templates/nonprofit-cause/l10n/cs.json +6 -5
  168. package/templates/nonprofit-cause/l10n/da.json +6 -5
  169. package/templates/nonprofit-cause/l10n/de.json +6 -5
  170. package/templates/nonprofit-cause/l10n/el.json +6 -5
  171. package/templates/nonprofit-cause/l10n/en.json +8 -1
  172. package/templates/nonprofit-cause/l10n/es.json +6 -5
  173. package/templates/nonprofit-cause/l10n/fi.json +6 -5
  174. package/templates/nonprofit-cause/l10n/fr.json +6 -5
  175. package/templates/nonprofit-cause/l10n/he.json +5 -4
  176. package/templates/nonprofit-cause/l10n/hu.json +6 -5
  177. package/templates/nonprofit-cause/l10n/id.json +6 -5
  178. package/templates/nonprofit-cause/l10n/it.json +6 -5
  179. package/templates/nonprofit-cause/l10n/ja.json +6 -5
  180. package/templates/nonprofit-cause/l10n/ko.json +6 -5
  181. package/templates/nonprofit-cause/l10n/lt.json +6 -5
  182. package/templates/nonprofit-cause/l10n/nl.json +6 -5
  183. package/templates/nonprofit-cause/l10n/no.json +6 -5
  184. package/templates/nonprofit-cause/l10n/pl.json +6 -5
  185. package/templates/nonprofit-cause/l10n/pt.json +6 -5
  186. package/templates/nonprofit-cause/l10n/ru.json +6 -5
  187. package/templates/nonprofit-cause/l10n/sv.json +6 -5
  188. package/templates/nonprofit-cause/l10n/th.json +6 -5
  189. package/templates/nonprofit-cause/l10n/tr.json +6 -5
  190. package/templates/nonprofit-cause/l10n/uk.json +6 -5
  191. package/templates/nonprofit-cause/l10n/vi.json +6 -5
  192. package/templates/nonprofit-cause/l10n/zh.json +6 -5
  193. package/templates/nonprofit-cause/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  194. package/templates/personal-fitness-trainer/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  195. package/templates/podcast-creator/config.ts +16 -1
  196. package/templates/podcast-creator/l10n/ar.json +6 -5
  197. package/templates/podcast-creator/l10n/cs.json +6 -5
  198. package/templates/podcast-creator/l10n/da.json +6 -5
  199. package/templates/podcast-creator/l10n/de.json +6 -5
  200. package/templates/podcast-creator/l10n/el.json +6 -5
  201. package/templates/podcast-creator/l10n/en.json +8 -1
  202. package/templates/podcast-creator/l10n/es.json +6 -5
  203. package/templates/podcast-creator/l10n/fi.json +6 -5
  204. package/templates/podcast-creator/l10n/fr.json +6 -5
  205. package/templates/podcast-creator/l10n/he.json +5 -4
  206. package/templates/podcast-creator/l10n/hu.json +6 -5
  207. package/templates/podcast-creator/l10n/id.json +6 -5
  208. package/templates/podcast-creator/l10n/it.json +6 -5
  209. package/templates/podcast-creator/l10n/ja.json +6 -5
  210. package/templates/podcast-creator/l10n/ko.json +6 -5
  211. package/templates/podcast-creator/l10n/lt.json +6 -5
  212. package/templates/podcast-creator/l10n/nl.json +6 -5
  213. package/templates/podcast-creator/l10n/no.json +6 -5
  214. package/templates/podcast-creator/l10n/pl.json +6 -5
  215. package/templates/podcast-creator/l10n/pt.json +6 -5
  216. package/templates/podcast-creator/l10n/ru.json +6 -5
  217. package/templates/podcast-creator/l10n/sv.json +6 -5
  218. package/templates/podcast-creator/l10n/th.json +6 -5
  219. package/templates/podcast-creator/l10n/tr.json +6 -5
  220. package/templates/podcast-creator/l10n/uk.json +6 -5
  221. package/templates/podcast-creator/l10n/vi.json +6 -5
  222. package/templates/podcast-creator/l10n/zh.json +6 -5
  223. package/templates/podcast-creator/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  224. package/templates/portfolio-creative/config.ts +16 -1
  225. package/templates/portfolio-creative/l10n/ar.json +6 -5
  226. package/templates/portfolio-creative/l10n/cs.json +6 -5
  227. package/templates/portfolio-creative/l10n/da.json +6 -5
  228. package/templates/portfolio-creative/l10n/de.json +6 -5
  229. package/templates/portfolio-creative/l10n/el.json +6 -5
  230. package/templates/portfolio-creative/l10n/en.json +8 -1
  231. package/templates/portfolio-creative/l10n/es.json +6 -5
  232. package/templates/portfolio-creative/l10n/fi.json +6 -5
  233. package/templates/portfolio-creative/l10n/fr.json +6 -5
  234. package/templates/portfolio-creative/l10n/he.json +5 -4
  235. package/templates/portfolio-creative/l10n/hu.json +6 -5
  236. package/templates/portfolio-creative/l10n/id.json +6 -5
  237. package/templates/portfolio-creative/l10n/it.json +6 -5
  238. package/templates/portfolio-creative/l10n/ja.json +6 -5
  239. package/templates/portfolio-creative/l10n/ko.json +6 -5
  240. package/templates/portfolio-creative/l10n/lt.json +6 -5
  241. package/templates/portfolio-creative/l10n/nl.json +6 -5
  242. package/templates/portfolio-creative/l10n/no.json +6 -5
  243. package/templates/portfolio-creative/l10n/pl.json +6 -5
  244. package/templates/portfolio-creative/l10n/pt.json +6 -5
  245. package/templates/portfolio-creative/l10n/ru.json +6 -5
  246. package/templates/portfolio-creative/l10n/sv.json +6 -5
  247. package/templates/portfolio-creative/l10n/th.json +6 -5
  248. package/templates/portfolio-creative/l10n/tr.json +6 -5
  249. package/templates/portfolio-creative/l10n/uk.json +6 -5
  250. package/templates/portfolio-creative/l10n/vi.json +6 -5
  251. package/templates/portfolio-creative/l10n/zh.json +6 -5
  252. package/templates/portfolio-creative/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  253. package/templates/restaurant/config.ts +16 -1
  254. package/templates/restaurant/l10n/ar.json +6 -5
  255. package/templates/restaurant/l10n/cs.json +6 -5
  256. package/templates/restaurant/l10n/da.json +6 -5
  257. package/templates/restaurant/l10n/de.json +6 -5
  258. package/templates/restaurant/l10n/el.json +6 -5
  259. package/templates/restaurant/l10n/en.json +8 -1
  260. package/templates/restaurant/l10n/es.json +6 -5
  261. package/templates/restaurant/l10n/fi.json +6 -5
  262. package/templates/restaurant/l10n/fr.json +6 -5
  263. package/templates/restaurant/l10n/he.json +5 -4
  264. package/templates/restaurant/l10n/hu.json +6 -5
  265. package/templates/restaurant/l10n/id.json +6 -5
  266. package/templates/restaurant/l10n/it.json +6 -5
  267. package/templates/restaurant/l10n/ja.json +6 -5
  268. package/templates/restaurant/l10n/ko.json +6 -5
  269. package/templates/restaurant/l10n/lt.json +6 -5
  270. package/templates/restaurant/l10n/nl.json +6 -5
  271. package/templates/restaurant/l10n/no.json +6 -5
  272. package/templates/restaurant/l10n/pl.json +6 -5
  273. package/templates/restaurant/l10n/pt.json +6 -5
  274. package/templates/restaurant/l10n/ru.json +6 -5
  275. package/templates/restaurant/l10n/sv.json +6 -5
  276. package/templates/restaurant/l10n/th.json +6 -5
  277. package/templates/restaurant/l10n/tr.json +6 -5
  278. package/templates/restaurant/l10n/uk.json +6 -5
  279. package/templates/restaurant/l10n/vi.json +6 -5
  280. package/templates/restaurant/l10n/zh.json +6 -5
  281. package/templates/restaurant/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  282. package/templates/retail-store/config.ts +16 -1
  283. package/templates/retail-store/l10n/ar.json +6 -5
  284. package/templates/retail-store/l10n/cs.json +6 -5
  285. package/templates/retail-store/l10n/da.json +6 -5
  286. package/templates/retail-store/l10n/de.json +6 -5
  287. package/templates/retail-store/l10n/el.json +6 -5
  288. package/templates/retail-store/l10n/en.json +8 -1
  289. package/templates/retail-store/l10n/es.json +6 -5
  290. package/templates/retail-store/l10n/fi.json +6 -5
  291. package/templates/retail-store/l10n/fr.json +6 -5
  292. package/templates/retail-store/l10n/he.json +5 -4
  293. package/templates/retail-store/l10n/hu.json +6 -5
  294. package/templates/retail-store/l10n/id.json +6 -5
  295. package/templates/retail-store/l10n/it.json +6 -5
  296. package/templates/retail-store/l10n/ja.json +6 -5
  297. package/templates/retail-store/l10n/ko.json +6 -5
  298. package/templates/retail-store/l10n/lt.json +6 -5
  299. package/templates/retail-store/l10n/nl.json +6 -5
  300. package/templates/retail-store/l10n/no.json +6 -5
  301. package/templates/retail-store/l10n/pl.json +6 -5
  302. package/templates/retail-store/l10n/pt.json +6 -5
  303. package/templates/retail-store/l10n/ru.json +6 -5
  304. package/templates/retail-store/l10n/sv.json +6 -5
  305. package/templates/retail-store/l10n/th.json +6 -5
  306. package/templates/retail-store/l10n/tr.json +6 -5
  307. package/templates/retail-store/l10n/uk.json +6 -5
  308. package/templates/retail-store/l10n/vi.json +6 -5
  309. package/templates/retail-store/l10n/zh.json +6 -5
  310. package/templates/retail-store/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  311. package/templates/salon-spa/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  312. package/templates/wholesale-store/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  313. package/templates/yoga-studio/config.ts +27 -2
  314. package/templates/yoga-studio/dev/index.ts +958 -2
  315. package/templates/yoga-studio/himalaya.content.json +3 -0
  316. package/templates/yoga-studio/l10n/ar.json +106 -5
  317. package/templates/yoga-studio/l10n/cs.json +106 -5
  318. package/templates/yoga-studio/l10n/da.json +106 -5
  319. package/templates/yoga-studio/l10n/de.json +106 -5
  320. package/templates/yoga-studio/l10n/el.json +106 -5
  321. package/templates/yoga-studio/l10n/en.json +43 -1
  322. package/templates/yoga-studio/l10n/es.json +106 -5
  323. package/templates/yoga-studio/l10n/fi.json +106 -5
  324. package/templates/yoga-studio/l10n/fr.json +106 -5
  325. package/templates/yoga-studio/l10n/he.json +86 -4
  326. package/templates/yoga-studio/l10n/hu.json +106 -5
  327. package/templates/yoga-studio/l10n/id.json +106 -5
  328. package/templates/yoga-studio/l10n/it.json +106 -5
  329. package/templates/yoga-studio/l10n/ja.json +106 -5
  330. package/templates/yoga-studio/l10n/ko.json +106 -5
  331. package/templates/yoga-studio/l10n/lt.json +106 -5
  332. package/templates/yoga-studio/l10n/nl.json +106 -5
  333. package/templates/yoga-studio/l10n/no.json +106 -5
  334. package/templates/yoga-studio/l10n/pl.json +106 -5
  335. package/templates/yoga-studio/l10n/pt.json +106 -5
  336. package/templates/yoga-studio/l10n/ru.json +106 -5
  337. package/templates/yoga-studio/l10n/sv.json +106 -5
  338. package/templates/yoga-studio/l10n/th.json +106 -5
  339. package/templates/yoga-studio/l10n/tr.json +106 -5
  340. package/templates/yoga-studio/l10n/uk.json +106 -5
  341. package/templates/yoga-studio/l10n/vi.json +106 -5
  342. package/templates/yoga-studio/l10n/zh.json +106 -5
  343. package/templates/yoga-studio/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  344. package/templates/yoga-studio/tier5-src/_shared/program-content.ts +94 -0
  345. package/templates/yoga-studio/tier5-src/_shared/program-progress-mark.ts +22 -0
  346. package/templates/yoga-studio/tier5-src/_shared/program-reads.ts +72 -0
  347. package/templates/yoga-studio/tier5-src/himi-branded-lite-program-participant/index.ts +46 -62
  348. package/templates/yoga-studio/tier5-src/himi-branded-lite-program-participant/model.ts +12 -76
  349. package/templates/yoga-studio/tier5-src/himi-branded-lite-program-step/index.ts +520 -0
  350. package/templates/yoga-studio/tier5-src/himi-branded-lite-program-step/model.ts +69 -0
@@ -3554,6 +3554,12 @@
3554
3554
  "translation": "已釘選",
3555
3555
  "origin": "machine"
3556
3556
  },
3557
+ "h_39fc72124884": {
3558
+ "key": "blogCommon.undoCta",
3559
+ "source": "Undo",
3560
+ "translation": "復原",
3561
+ "origin": "one-app:mobile-apps-inbox:CONFIRMATION_UNDO_BUTTON_TITLE"
3562
+ },
3557
3563
  "h_d01f3a6fc64b": {
3558
3564
  "key": "blog.categoriesLabel",
3559
3565
  "source": "Post categories",
@@ -4334,6 +4340,36 @@
4334
4340
  "translation": "完成獎勵",
4335
4341
  "origin": "machine"
4336
4342
  },
4343
+ "h_6a3631a770f9": {
4344
+ "key": "programStep.doneLine",
4345
+ "source": "You completed this step.",
4346
+ "translation": "你已完成此步驟。",
4347
+ "origin": "machine"
4348
+ },
4349
+ "h_84d11445f673": {
4350
+ "key": "programStep.backToProgramCta",
4351
+ "source": "Back to program",
4352
+ "translation": "返回計劃",
4353
+ "origin": "machine"
4354
+ },
4355
+ "h_9a64a79e6ff7": {
4356
+ "key": "programStep.completeCta",
4357
+ "source": "Complete step",
4358
+ "translation": "完成步驟",
4359
+ "origin": "machine"
4360
+ },
4361
+ "h_da57050ad0b6": {
4362
+ "key": "programStep.previousCta",
4363
+ "source": "Previous step",
4364
+ "translation": "上一步",
4365
+ "origin": "machine"
4366
+ },
4367
+ "h_df053606a2f2": {
4368
+ "key": "programStep.openOnWebCta",
4369
+ "source": "Open on the website",
4370
+ "translation": "在網站上開啟",
4371
+ "origin": "machine"
4372
+ },
4337
4373
  "h_1e9b74b4dda5": {
4338
4374
  "source": "Show all ({count})",
4339
4375
  "translation": "查看全部({count})",
@@ -6464,11 +6500,6 @@
6464
6500
  "translation": "更多操作",
6465
6501
  "origin": "one-app:wix-one-app-pos:pos.home.topBar.actions.accessibility"
6466
6502
  },
6467
- "h_39fc72124884": {
6468
- "source": "Undo",
6469
- "translation": "復原",
6470
- "origin": "one-app:mobile-apps-inbox:CONFIRMATION_UNDO_BUTTON_TITLE"
6471
- },
6472
6503
  "h_83087836c0d0": {
6473
6504
  "source": "Updated {date}",
6474
6505
  "translation": "更新於 {date}",
@@ -9538,6 +9569,76 @@
9538
9569
  "source": "You're offline. Connect to the internet and try again.",
9539
9570
  "translation": "你目前處於離線狀態。請連上網路後再試一次。",
9540
9571
  "origin": "machine"
9572
+ },
9573
+ "h_0f7448e4008f": {
9574
+ "source": "Step complete",
9575
+ "translation": "步驟已完成",
9576
+ "origin": "machine"
9577
+ },
9578
+ "h_10b4aca84b8f": {
9579
+ "source": "This step opens {date}.",
9580
+ "translation": "此步驟將於 {date} 開放。",
9581
+ "origin": "machine"
9582
+ },
9583
+ "h_2bfa90cd944d": {
9584
+ "source": "This video plays on the program's website.",
9585
+ "translation": "此影片在計劃的網站上播放。",
9586
+ "origin": "machine"
9587
+ },
9588
+ "h_2d271e1482bb": {
9589
+ "source": "You completed every step of {program}.",
9590
+ "translation": "你已完成 {program} 的所有步驟。",
9591
+ "origin": "machine"
9592
+ },
9593
+ "h_4bb492b2e31e": {
9594
+ "source": "This program has ended, so its steps can't be changed.",
9595
+ "translation": "此計劃已結束,因此無法變更其步驟。",
9596
+ "origin": "machine"
9597
+ },
9598
+ "h_5805034de293": {
9599
+ "source": "You finished {section}.",
9600
+ "translation": "你已完成 {section}。",
9601
+ "origin": "machine"
9602
+ },
9603
+ "h_6e67115ffcf5": {
9604
+ "source": "Nice work. Keep going.",
9605
+ "translation": "做得好,繼續加油。",
9606
+ "origin": "machine"
9607
+ },
9608
+ "h_704b86872900": {
9609
+ "source": "This step isn't part of the program anymore.",
9610
+ "translation": "此步驟已不再屬於這個計劃。",
9611
+ "origin": "machine"
9612
+ },
9613
+ "h_70d85409fab9": {
9614
+ "source": "Section complete",
9615
+ "translation": "單元已完成",
9616
+ "origin": "machine"
9617
+ },
9618
+ "h_7c37a620879d": {
9619
+ "source": "Step {index} of {total}",
9620
+ "translation": "第 {index} 步,共 {total} 步",
9621
+ "origin": "machine"
9622
+ },
9623
+ "h_83416aefdd52": {
9624
+ "source": "This step couldn't be saved. Try again.",
9625
+ "translation": "無法儲存此步驟,請再試一次。",
9626
+ "origin": "machine"
9627
+ },
9628
+ "h_a5fe9933b06c": {
9629
+ "source": "This step can't be shown in the app right now.",
9630
+ "translation": "目前無法在 App 中顯示此步驟。",
9631
+ "origin": "machine"
9632
+ },
9633
+ "h_b676bb944def": {
9634
+ "source": "This step couldn't be undone. Try again.",
9635
+ "translation": "無法復原此步驟,請再試一次。",
9636
+ "origin": "machine"
9637
+ },
9638
+ "h_c019808bbd94": {
9639
+ "source": "Take this quiz on the program's website.",
9640
+ "translation": "請在計劃的網站上完成此測驗。",
9641
+ "origin": "machine"
9541
9642
  }
9542
9643
  }
9543
9644
  }
@@ -124,6 +124,7 @@ export const HOSTED_SCREEN_VERTICALS: Readonly<Record<string, readonly BrandedLi
124
124
  himi_programs: ["programs"],
125
125
  himi_member_programs: ["programs"],
126
126
  himi_program_participant: ["programs"],
127
+ himi_program_step: ["programs"],
127
128
  himi_reservations: ["reservations"],
128
129
  himi_reserve: ["restaurants"],
129
130
  himi_review: ["reviews"],
@@ -0,0 +1,94 @@
1
+ // The content of an online program as a joined member walks it: which steps are done, the order of
2
+ // the sections and of their steps, when a section opens, and how a step is named. One source for the
3
+ // participant page (himi_program_participant) and the step screen (himi_program_step), so the two
4
+ // never disagree on what is done or what comes next.
5
+ // Pure: the reads live in program-reads.ts, so a node test can import this file without the SDK.
6
+ import type { WixParticipant, WixResolvedStep, WixSection, WixStep } from "@himalaya/wix-online-programs";
7
+ import { copyParam } from "./himi-copy.js";
8
+
9
+ /** What the member's content reads can be trusted for. `undefined` is a read the site refused this member.
10
+ * An EMPTY read can also mean "not allowed" (the SDK says so), so the participation's own counts decide
11
+ * between "none" and "unavailable":
12
+ * - no steps listed while the participation reports some: the steps are unavailable;
13
+ * - steps that name a section while no section is read: the steps are unavailable (order and locks unknown);
14
+ * - no resolved step read while the participation reports done ones: the done marks are unknown. A read that
15
+ * returned rows was allowed, even when none of them marks a listed step (a deleted step, a quiz under review). */
16
+ export function contentReadability(input: {
17
+ sections: readonly WixSection[] | undefined;
18
+ steps: readonly WixStep[] | undefined;
19
+ resolved: readonly WixResolvedStep[] | undefined;
20
+ participant?: WixParticipant;
21
+ }): { listed: WixStep[]; done: Map<string, WixResolvedStep>; contentAvailable: boolean; marksKnown: boolean; reportedTotal: number; reportedDone: number } {
22
+ const reported = input.participant?.progress;
23
+ const reportedTotal = Math.max(0, Number(reported?.totalStepsAvailable ?? 0) || 0);
24
+ const reportedDone = Math.max(0, Number(reported?.totalStepsCompleted ?? 0) || 0);
25
+ const listed = (input.steps ?? []).filter((step) => !!step.id);
26
+ const sectionsMissing = listed.some((step) => !!step.sectionId) && !(input.sections ?? []).some((section) => !!section.id);
27
+ const contentAvailable = input.steps !== undefined && !(listed.length === 0 && reportedTotal > 0) && !sectionsMissing;
28
+ const done = doneStepIds(input.resolved ?? []);
29
+ const marksKnown = contentAvailable && input.resolved !== undefined && !(input.resolved.length === 0 && reportedDone > 0);
30
+ return { listed, done, contentAvailable, marksKnown, reportedTotal, reportedDone };
31
+ }
32
+
33
+ // The spec gives a resolved step's `status` no values. Completing a step on amit1 returned
34
+ // `COMPLETED` (2026-11-18); a record with no status is the same completion. Any other status (a quiz
35
+ // waiting for review, a failed one) is not done until it says so.
36
+ const DONE_STATUSES = new Set(["", "COMPLETED"]);
37
+
38
+ export function doneStepIds(resolved: readonly WixResolvedStep[]): Map<string, WixResolvedStep> {
39
+ const done = new Map<string, WixResolvedStep>();
40
+ for (const step of resolved) {
41
+ if (!step.programStepId) continue;
42
+ if (!DONE_STATUSES.has(String(step.status ?? "").toUpperCase())) continue;
43
+ done.set(step.programStepId, step);
44
+ }
45
+ return done;
46
+ }
47
+
48
+ export const order = (value: unknown, fallback: number): number => (typeof value === "number" && Number.isFinite(value) ? value : fallback);
49
+
50
+ export function stepKind(step: WixStep): { label: string; icon: string } {
51
+ const type = String(step.stepType ?? "").toUpperCase();
52
+ if (type === "VIDEO") return { label: copyParam("programParticipant.kind.video", "Video"), icon: "play_circle" };
53
+ if (type === "QUIZ") return { label: copyParam("programParticipant.kind.quiz", "Quiz"), icon: "checklist" };
54
+ return { label: copyParam("programParticipant.kind.article", "Article"), icon: "document" };
55
+ }
56
+
57
+ export const stepTitle = (step: WixStep): string => String(step.description?.title ?? "").trim() || copyParam("programParticipant.stepFallbackName", "Step");
58
+ export const sectionTitle = (section: WixSection): string => String(section.description?.title ?? "").trim() || copyParam("programParticipant.sectionFallbackName", "Section");
59
+
60
+ /** When a section opens for this member: the enrollment start plus the section's delay. */
61
+ export function opensAt(section: WixSection | undefined, participant: WixParticipant | undefined): number {
62
+ const delay = Number(section?.delayInDays ?? 0);
63
+ const start = Date.parse(participant?.enrollmentInfo?.startDate ?? "");
64
+ if (!(delay > 0) || !Number.isFinite(start)) return Number.NaN;
65
+ return start + delay * 86_400_000;
66
+ }
67
+
68
+ /** The sections in order, each with its steps in order; steps of an unknown section (or of none) come
69
+ * last, in a group without a section. The one order of a program's content: the Content tab lists it,
70
+ * and the step screen walks it for the previous and the next step. */
71
+ export function contentGroups(sectionsIn: readonly WixSection[], steps: readonly WixStep[]): Array<{ section?: WixSection; steps: WixStep[] }> {
72
+ const sections = [...sectionsIn].filter((s) => !!s.id)
73
+ .map((section, index) => ({ section, index }))
74
+ .sort((a, b) => order(a.section.ordering, a.index) - order(b.section.ordering, b.index))
75
+ .map(({ section }) => section);
76
+ const known = new Set(sections.map((s) => s.id));
77
+ const bySection = new Map<string, WixStep[]>();
78
+ steps.filter((step) => !!step.id).forEach((step) => {
79
+ // A step of an unknown section (or of none) is listed after the sections, without a header.
80
+ const key = step.sectionId && known.has(step.sectionId) ? step.sectionId : "";
81
+ const list = bySection.get(key) ?? [];
82
+ list.push(step);
83
+ bySection.set(key, list);
84
+ });
85
+ for (const list of bySection.values()) {
86
+ const indexed = list.map((step, index) => ({ step, index }));
87
+ indexed.sort((a, b) => order(a.step.ordering, a.index) - order(b.step.ordering, b.index));
88
+ list.splice(0, list.length, ...indexed.map(({ step }) => step));
89
+ }
90
+ return [
91
+ ...sections.map((section) => ({ section, steps: bySection.get(section.id!) ?? [] })),
92
+ ...(bySection.get("") ? [{ steps: bySection.get("")! }] : []),
93
+ ];
94
+ }
@@ -0,0 +1,22 @@
1
+ // A mark that a member's progress on one program changed on this device, so a screen that stays
2
+ // mounted under the step screen (the participant page: iOS sends it nothing on Back) knows to read
3
+ // the progress again. The step screen writes it after a complete or an undo; the participant page
4
+ // polls it. Device-local, never the progress itself: Wix stays the one home of the resolved steps.
5
+ // Every call is wrapped, so a build without the `local_database` grant just never refreshes early.
6
+ import { get as dbGet, upsert as dbUpsert } from "@himalaya/local-db";
7
+
8
+ const ENTITY = "program_progress";
9
+
10
+ /** How often a mounted participant page looks at the mark. A local read, no network. */
11
+ export const PROGRESS_POLL_MS = 2000;
12
+
13
+ export async function markProgress(programId: string): Promise<void> {
14
+ if (!programId) return;
15
+ try { await dbUpsert(ENTITY, { id: programId, at: String(Date.now()) }); } catch { /* capability not granted */ }
16
+ }
17
+
18
+ /** The program's last mark, or "" when none was written (or the store is not granted). */
19
+ export async function progressMark(programId: string): Promise<string> {
20
+ if (!programId) return "";
21
+ try { return String((await dbGet(ENTITY, programId))?.at ?? ""); } catch { return ""; }
22
+ }
@@ -0,0 +1,72 @@
1
+ // The reads of an online program's content as a joined member sees it, shared by the participant page
2
+ // (himi_program_participant) and the step screen (himi_program_step): the program, every step, every
3
+ // resolved step, and how a refusal and a non-participant read. The pure model is program-content.ts.
4
+ import {
5
+ getProgram,
6
+ queryParticipantSteps,
7
+ queryPrograms,
8
+ queryResolvedSteps,
9
+ type WixParticipant,
10
+ type WixProgramFull,
11
+ type WixResolvedStep,
12
+ type WixStep,
13
+ } from "@himalaya/wix-online-programs";
14
+ import { copyParam } from "./himi-copy.js";
15
+ import type { Standing } from "./program-standing.js";
16
+
17
+ const PAGE_LIMIT = 100;
18
+ const MAX_PAGES = 10;
19
+
20
+ /** getProgram first; the programs query is the fallback when the GET path fails (as on himi_program). */
21
+ export async function fetchProgram(id: string): Promise<WixProgramFull | undefined> {
22
+ try {
23
+ return (await getProgram(id)).program;
24
+ } catch {
25
+ const response = await queryPrograms({ cursorPaging: { limit: 50 } });
26
+ return (response.programs ?? []).find((candidate) => candidate.id === id);
27
+ }
28
+ }
29
+
30
+ /** Every step of the program as a participant sees it. `descriptionFieldSet: "EXTENDED"` adds the
31
+ * description and the video address, which the default field set leaves out. */
32
+ export async function allSteps(programId: string, descriptionFieldSet?: string): Promise<WixStep[]> {
33
+ const steps: WixStep[] = [];
34
+ let cursor: string | undefined;
35
+ for (let page = 0; page < MAX_PAGES; page++) {
36
+ const response = await queryParticipantSteps(programId, { limit: PAGE_LIMIT, cursor, ...(descriptionFieldSet ? { descriptionFieldSet } : {}) });
37
+ // The filter is the program, but a member's read has ignored a filter before: keep only this program's steps.
38
+ steps.push(...(response.steps ?? []).filter((step) => !step.programId || step.programId === programId));
39
+ const next = response.pagingMetadata?.cursors?.next ?? "";
40
+ if (!response.pagingMetadata?.hasNext || !next || next === cursor) break;
41
+ cursor = next;
42
+ }
43
+ return steps;
44
+ }
45
+
46
+ /** Every resolved step of one participant. */
47
+ export async function allResolved(participantId: string): Promise<WixResolvedStep[]> {
48
+ const resolved: WixResolvedStep[] = [];
49
+ let cursor: string | undefined;
50
+ for (let page = 0; page < MAX_PAGES; page++) {
51
+ const response = await queryResolvedSteps(participantId, { limit: PAGE_LIMIT, cursor });
52
+ resolved.push(...(response.resolvedSteps ?? []).filter((step) => !step.participantId || step.participantId === participantId));
53
+ const next = response.pagingMetadata?.cursors?.next ?? "";
54
+ if (!response.pagingMetadata?.hasNext || !next || next === cursor) break;
55
+ cursor = next;
56
+ }
57
+ return resolved;
58
+ }
59
+
60
+ /** Why a member who is not in the program sees none of its content. */
61
+ export function gateTextOf(standing: Standing, participant: WixParticipant | undefined): string {
62
+ const paused = standing === "suspended" || String(participant?.enrollmentStatus ?? "").toUpperCase() === "SUSPENDED";
63
+ return paused
64
+ ? copyParam("programParticipant.pausedText", "Your participation in this program is paused.")
65
+ : copyParam("programParticipant.notJoinedText", "You're not in this program yet. Open the program to join it.");
66
+ }
67
+
68
+ /** The site refused this member the read (as opposed to failing it). */
69
+ export function isRefused(error: unknown): boolean {
70
+ const status = (error as { status?: unknown } | null)?.status;
71
+ return status === 403 || /\bHTTP\s*403\b|PERMISSION_DENIED/i.test(String(error));
72
+ }
@@ -11,8 +11,9 @@
11
11
  // steps. The done marks come from the resolved steps; Wix's participant progress is the
12
12
  // fallback count when the content cannot be listed.
13
13
  //
14
- // The next step opens the step screen when the host serves one (the load arg `stepScreen`);
15
- // without it the button shows the step in the Content tab, where it is marked "Next step".
14
+ // The next step, and a step row of the Content tab, open the step screen when the host serves one
15
+ // (the load arg `stepScreen`); without it the next step button shows the step in the Content tab,
16
+ // where it is marked "Next step", and a row stays where it is.
16
17
  //
17
18
  // Rewards, leave and share (B4), on the Overview: the certificate (when the program has one and
18
19
  // the member completed it; a time-limited link fetched at the tap, opened in the system browser),
@@ -25,18 +26,11 @@ import { share as shareSheet } from "@himalaya/share";
25
26
  import { alert } from "@himalaya/ui";
26
27
  import {
27
28
  getCertificateDownloadUrl,
28
- getProgram,
29
29
  leaveProgram,
30
30
  listSections,
31
31
  participationsByProgram,
32
- queryParticipantSteps,
33
- queryPrograms,
34
- queryResolvedSteps,
35
32
  searchMemberParticipation,
36
33
  type WixParticipant,
37
- type WixProgramFull,
38
- type WixResolvedStep,
39
- type WixStep,
40
34
  } from "@himalaya/wix-online-programs";
41
35
  import { getMyMember } from "@himalaya/wix-members";
42
36
  import { i18n } from "@himalaya/wix-platform";
@@ -50,13 +44,13 @@ import { inProgram, standingOf, STATUS, type Standing } from "../_shared/program
50
44
  import { assertMemberAccess, memberAccess, memberChanged, type MemberAccess } from "../_shared/member-access.js";
51
45
  import { initials } from "../_shared/himi-text.js";
52
46
  import { copyParam, stashCopy } from "../_shared/himi-copy.js";
47
+ import { allResolved, allSteps, fetchProgram, gateTextOf, isRefused } from "../_shared/program-reads.js";
48
+ import { PROGRESS_POLL_MS, progressMark } from "../_shared/program-progress-mark.js";
53
49
  import { buildContent, rewardsOf, shareUrlOf, type ContentRow } from "./model.js";
54
50
 
55
51
  export const SERVICE = "himiBrandedProgramParticipant";
56
52
  /** The program page a member who is not in the program goes back to. */
57
53
  const PROGRAM_SCREEN = "himi_program";
58
- const PAGE_LIMIT = 100;
59
- const MAX_PAGES = 10;
60
54
 
61
55
  type Tab = "overview" | "content";
62
56
  type Access = "member" | "signIn" | "notJoined";
@@ -138,6 +132,19 @@ let participantId = "";
138
132
  /** A certificate fetch or a leave is running: a second tap waits (the busy flag lands a publish later). */
139
133
  let acting = false;
140
134
  let loadSeq = 0;
135
+ /** The progress mark (program-progress-mark.ts) this page last loaded at; a newer one reloads it. */
136
+ let seenMark = "";
137
+ /** A reload the progress mark started is running: the next polls wait for it. */
138
+ let syncing = false;
139
+ /** A mark whose reload failed: the next polls skip 1, 3, 7, 15, then at most 29 ticks (about a minute) before
140
+ * they try it again, so a site that keeps failing is not read in full every 2 s. A new mark starts over. */
141
+ let retry = { mark: "", fails: 0, skip: 0 };
142
+ const MAX_RETRY_SKIP = 29;
143
+ /** Once the page opens a step, it looks at the progress mark: iOS keeps it mounted under the step screen
144
+ * and sends nothing on Back, so a complete or an undo made there would otherwise never show here. A page
145
+ * that never opened a step never polls. */
146
+ const PROGRESS_POLL = { id: "himi-program-progress", intervalMs: PROGRESS_POLL_MS, action: `${SERVICE}.syncProgress` };
147
+ const withProgressPoll = (state: State): State => ({ ...state, _poll: { ...PROGRESS_POLL } } as State);
141
148
 
142
149
  function inputId(): string {
143
150
  const input = (globalThis as { himalaya?: { input?: { id?: unknown } } }).himalaya?.input;
@@ -184,56 +191,6 @@ const INITIAL_STATE: State = derive({
184
191
  shareUrl: "", hideShare: true, canLeave: false, hideLeave: true, busy: false, certificateMessage: "", actionMessage: "",
185
192
  });
186
193
 
187
- /** getProgram first; the programs query is the fallback when the GET path fails (as on himi_program). */
188
- async function fetchProgram(id: string): Promise<WixProgramFull | undefined> {
189
- try {
190
- return (await getProgram(id)).program;
191
- } catch {
192
- const response = await queryPrograms({ cursorPaging: { limit: 50 } });
193
- return (response.programs ?? []).find((candidate) => candidate.id === id);
194
- }
195
- }
196
-
197
- async function allSteps(programId: string): Promise<WixStep[]> {
198
- const steps: WixStep[] = [];
199
- let cursor: string | undefined;
200
- for (let page = 0; page < MAX_PAGES; page++) {
201
- const response = await queryParticipantSteps(programId, { limit: PAGE_LIMIT, cursor });
202
- // The filter is the program, but a member's read has ignored a filter before: keep only this program's steps.
203
- steps.push(...(response.steps ?? []).filter((step) => !step.programId || step.programId === programId));
204
- const next = response.pagingMetadata?.cursors?.next ?? "";
205
- if (!response.pagingMetadata?.hasNext || !next || next === cursor) break;
206
- cursor = next;
207
- }
208
- return steps;
209
- }
210
-
211
- async function allResolved(participantId: string): Promise<WixResolvedStep[]> {
212
- const resolved: WixResolvedStep[] = [];
213
- let cursor: string | undefined;
214
- for (let page = 0; page < MAX_PAGES; page++) {
215
- const response = await queryResolvedSteps(participantId, { limit: PAGE_LIMIT, cursor });
216
- resolved.push(...(response.resolvedSteps ?? []).filter((step) => !step.participantId || step.participantId === participantId));
217
- const next = response.pagingMetadata?.cursors?.next ?? "";
218
- if (!response.pagingMetadata?.hasNext || !next || next === cursor) break;
219
- cursor = next;
220
- }
221
- return resolved;
222
- }
223
-
224
- function gateTextOf(standing: Standing, participant: WixParticipant | undefined): string {
225
- const paused = standing === "suspended" || String(participant?.enrollmentStatus ?? "").toUpperCase() === "SUSPENDED";
226
- return paused
227
- ? copyParam("programParticipant.pausedText", "Your participation in this program is paused.")
228
- : copyParam("programParticipant.notJoinedText", "You're not in this program yet. Open the program to join it.");
229
- }
230
-
231
- /** The site refused this member the read (as opposed to failing it). */
232
- function isRefused(error: unknown): boolean {
233
- const status = (error as { status?: unknown } | null)?.status;
234
- return status === 403 || /\bHTTP\s*403\b|PERMISSION_DENIED/i.test(String(error));
235
- }
236
-
237
194
  const sameMember = (a: MemberAccess | undefined, b: MemberAccess | undefined): boolean =>
238
195
  !!a && !!b && a.email === b.email && a.scope === b.scope;
239
196
 
@@ -280,6 +237,8 @@ async function load(state: State, arg?: unknown): Promise<undefined> {
280
237
  const header = { programId: id, name, image, initial: initials(name), description: body.bodyText, descriptionJson: body.bodyJson };
281
238
  const memberId = (await getMyMember()).member?.id;
282
239
  if (!memberId) throw new Error("Current member unavailable");
240
+ // Read before the participation and the content: a mark written while they are read is newer, so the poll reloads again.
241
+ const mark = await progressMark(id);
283
242
  const participation = await searchMemberParticipation(id, memberId);
284
243
  await assertMemberAccess(member);
285
244
  if (!current()) return undefined;
@@ -317,6 +276,7 @@ async function load(state: State, arg?: unknown): Promise<undefined> {
317
276
  participantId = participant.id;
318
277
  shownFor = member;
319
278
  const status = STATUS[standing as Exclude<Standing, "none">];
279
+ seenMark = mark;
320
280
  const hasBadges = !!badgesScreen && rewards.badgeIds.length > 0;
321
281
  void svc.publish({
322
282
  ...header,
@@ -456,6 +416,8 @@ type Actions = {
456
416
  publish: (state: State, patch: Partial<State>) => State;
457
417
  selectTab: (state: State, arg?: unknown) => State;
458
418
  openStep: (state: State) => State;
419
+ openRow: (state: State, arg?: unknown) => State;
420
+ syncProgress: (state: State) => Promise<undefined>;
459
421
  openLink: (state: State, arg?: unknown) => Promise<undefined>;
460
422
  openCertificate: (state: State) => Promise<undefined>;
461
423
  openBadges: (state: State) => State;
@@ -478,10 +440,32 @@ const svc = defineService<State, Actions>(SERVICE, {
478
440
  },
479
441
  openStep: (state) => {
480
442
  if (!state.nextStepId) return state;
481
- if (stepScreen) return navigate(state, { screenId: stepScreen, args: { id: state.programId, stepId: state.nextStepId } });
443
+ if (stepScreen) return navigate(withProgressPoll(state), { screenId: stepScreen, args: { id: state.programId, stepId: state.nextStepId } });
482
444
  return derive({ ...state, tab: "content" });
483
445
  },
446
+ openRow: (state, arg) => {
447
+ const stepId = String((arg as { id?: unknown } | undefined)?.id ?? "");
448
+ if (!stepScreen || !stepId || !rows.some((row) => row.stepId === stepId)) return state;
449
+ return navigate(withProgressPoll(state), { screenId: stepScreen, args: { id: state.programId, stepId } });
450
+ },
484
451
  openLink: async (_state, arg) => { await openRichLink(arg); return undefined; },
452
+ syncProgress: async (state) => {
453
+ if (state.status !== "ready" || access !== "member" || !state.programId) return undefined;
454
+ const mark = await progressMark(state.programId);
455
+ if (!mark || mark === seenMark || syncing) return undefined;
456
+ if (retry.mark === mark && retry.skip > 0) {
457
+ retry.skip -= 1;
458
+ return undefined;
459
+ }
460
+ syncing = true;
461
+ try { await load(svc.getState()); } finally { syncing = false; }
462
+ // `load` records the mark only once it has read the new progress: a failed reload is retried, later each time.
463
+ if (seenMark !== mark) {
464
+ const fails = retry.mark === mark ? retry.fails + 1 : 1;
465
+ retry = { mark, fails, skip: Math.min(2 ** fails - 1, MAX_RETRY_SKIP) };
466
+ }
467
+ return undefined;
468
+ },
485
469
  openCertificate,
486
470
  openBadges: (state) => {
487
471
  // The badges list: one badge's page shows only what its caller passes, which this page does not read.
@@ -5,10 +5,15 @@
5
5
  import type { WixParticipant, WixProgramFull, WixResolvedStep, WixSection, WixStep } from "@himalaya/wix-online-programs";
6
6
  import { copyParam, copyTemplate } from "../_shared/himi-copy.js";
7
7
  import { formatDateMedium } from "../_shared/engine-intl.js";
8
+ import { contentGroups, contentReadability, opensAt, sectionTitle, stepKind, stepTitle } from "../_shared/program-content.js";
9
+
10
+ export { doneStepIds } from "../_shared/program-content.js";
8
11
 
9
12
  /** One row of the Content tab: a section header or a step. Flat, so the list stays at the scroll root. */
10
13
  export interface ContentRow {
11
14
  id: string;
15
+ /** The step's own id (a step row opens the step screen with it); "" on a section header. */
16
+ stepId: string;
12
17
  isSection: boolean;
13
18
  notSection: boolean;
14
19
  isStep: boolean;
@@ -53,47 +58,9 @@ export interface ContentModel {
53
58
  contentAvailable: boolean;
54
59
  }
55
60
 
56
- // The spec gives a resolved step's `status` no values. Completing a step on amit1 returned
57
- // `COMPLETED` (2026-11-18); a record with no status is the same completion. Any other status (a quiz
58
- // waiting for review, a failed one) is not done until it says so.
59
- const DONE_STATUSES = new Set(["", "COMPLETED"]);
60
-
61
- export function doneStepIds(resolved: readonly WixResolvedStep[]): Map<string, WixResolvedStep> {
62
- const done = new Map<string, WixResolvedStep>();
63
- for (const step of resolved) {
64
- if (!step.programStepId) continue;
65
- if (!DONE_STATUSES.has(String(step.status ?? "").toUpperCase())) continue;
66
- done.set(step.programStepId, step);
67
- }
68
- return done;
69
- }
70
-
71
- const order = (value: unknown, fallback: number): number => (typeof value === "number" && Number.isFinite(value) ? value : fallback);
72
-
73
- function stepKind(step: WixStep): { label: string; icon: string } {
74
- const type = String(step.stepType ?? "").toUpperCase();
75
- if (type === "VIDEO") return { label: copyParam("programParticipant.kind.video", "Video"), icon: "play_circle" };
76
- if (type === "QUIZ") return { label: copyParam("programParticipant.kind.quiz", "Quiz"), icon: "checklist" };
77
- return { label: copyParam("programParticipant.kind.article", "Article"), icon: "document" };
78
- }
79
-
80
- const stepTitle = (step: WixStep): string => String(step.description?.title ?? "").trim() || copyParam("programParticipant.stepFallbackName", "Step");
81
- const sectionTitle = (section: WixSection): string => String(section.description?.title ?? "").trim() || copyParam("programParticipant.sectionFallbackName", "Section");
82
-
83
- /** When a section opens for this member: the enrollment start plus the section's delay. */
84
- function opensAt(section: WixSection | undefined, participant: WixParticipant | undefined): number {
85
- const delay = Number(section?.delayInDays ?? 0);
86
- const start = Date.parse(participant?.enrollmentInfo?.startDate ?? "");
87
- if (!(delay > 0) || !Number.isFinite(start)) return Number.NaN;
88
- return start + delay * 86_400_000;
89
- }
90
-
91
- /** `undefined` for a read the site refused this member. An EMPTY read can also mean "not allowed"
92
- * (the SDK says so), so the participation's own counts decide between "none" and "unavailable":
93
- * - no steps listed while the participation reports some: the steps are unavailable;
94
- * - steps that name a section while no section is read: the steps are unavailable (locks unknown);
95
- * - steps listed but no done step while the participation reports done ones: the marks are unknown,
96
- * so no step is marked either way and the counts come from the participation. */
61
+ /** `undefined` for a read the site refused this member; `contentReadability` (shared with the step screen)
62
+ * decides what an empty read means. Unknown marks mark no step either way, and the counts then come
63
+ * from the participation. */
97
64
  export function buildContent(input: {
98
65
  sections: readonly WixSection[] | undefined;
99
66
  steps: readonly WixStep[] | undefined;
@@ -102,51 +69,20 @@ export function buildContent(input: {
102
69
  now: number;
103
70
  locale?: string;
104
71
  }): ContentModel {
105
- const reported = input.participant?.progress;
106
- const reportedTotal = Math.max(0, Number(reported?.totalStepsAvailable ?? 0) || 0);
107
- const reportedDone = Math.max(0, Number(reported?.totalStepsCompleted ?? 0) || 0);
108
- const listed = (input.steps ?? []).filter((step) => !!step.id);
109
- // Steps that name a section, with no section read: their order and delay locks are unknown, and a
110
- // locked step would show as open. So the steps are unavailable too.
111
- const sectionsMissing = listed.some((step) => !!step.sectionId) && !(input.sections ?? []).some((section) => !!section.id);
112
- const contentAvailable = input.steps !== undefined && !(listed.length === 0 && reportedTotal > 0) && !sectionsMissing;
113
- const done = doneStepIds(input.resolved ?? []);
114
- const anyDone = listed.some((step) => done.has(step.id!));
115
- const marksKnown = contentAvailable && input.resolved !== undefined && !(!anyDone && reportedDone > 0);
116
- const sections = [...(input.sections ?? [])].filter((s) => !!s.id)
117
- .map((section, index) => ({ section, index }))
118
- .sort((a, b) => order(a.section.ordering, a.index) - order(b.section.ordering, b.index))
119
- .map(({ section }) => section);
120
- const known = new Set(sections.map((s) => s.id));
121
- const bySection = new Map<string, WixStep[]>();
122
- (contentAvailable ? listed : []).forEach((step) => {
123
- // A step of an unknown section (or of none) is listed after the sections, without a header.
124
- const key = step.sectionId && known.has(step.sectionId) ? step.sectionId : "";
125
- const list = bySection.get(key) ?? [];
126
- list.push(step);
127
- bySection.set(key, list);
128
- });
129
- for (const list of bySection.values()) {
130
- const indexed = list.map((step, index) => ({ step, index }));
131
- indexed.sort((a, b) => order(a.step.ordering, a.index) - order(b.step.ordering, b.index));
132
- list.splice(0, list.length, ...indexed.map(({ step }) => step));
133
- }
72
+ const { listed, done, contentAvailable, marksKnown, reportedTotal, reportedDone } = contentReadability(input);
73
+ const groups = contentGroups(input.sections ?? [], contentAvailable ? listed : []);
134
74
 
135
75
  const rows: ContentRow[] = [];
136
76
  let next: NextStep | undefined;
137
77
  let nextOpens = Number.NaN;
138
78
  let total = 0;
139
79
  let doneCount = 0;
140
- const groups: Array<{ section?: WixSection; steps: WixStep[] }> = [
141
- ...sections.map((section) => ({ section, steps: bySection.get(section.id!) ?? [] })),
142
- ...(bySection.get("") ? [{ steps: bySection.get("")! }] : []),
143
- ];
144
80
  for (const { section, steps } of groups) {
145
81
  const opens = opensAt(section, input.participant);
146
82
  const locked = Number.isFinite(opens) && opens > input.now;
147
83
  if (section) {
148
84
  rows.push({
149
- id: `section-${section.id}`, isSection: true, notSection: false, isStep: false, notStep: true,
85
+ id: `section-${section.id}`, stepId: "", isSection: true, notSection: false, isStep: false, notStep: true,
150
86
  title: sectionTitle(section),
151
87
  meta: locked
152
88
  ? copyTemplate("programParticipant.sectionOpens", "Opens {date}", { date: formatDateMedium(new Date(opens), input.locale) })
@@ -166,7 +102,7 @@ export function buildContent(input: {
166
102
  if (marksKnown && !isDone && locked && !(nextOpens <= opens)) nextOpens = opens;
167
103
  const kind = stepKind(step);
168
104
  rows.push({
169
- id: `step-${step.id}`, isSection: false, notSection: true, isStep: true, notStep: false,
105
+ id: `step-${step.id}`, stepId: step.id!, isSection: false, notSection: true, isStep: true, notStep: false,
170
106
  title: stepTitle(step),
171
107
  meta: kind.label,
172
108
  icon: locked ? "lock" : kind.icon,