@wix/himalaya-cli 0.1787.0 → 0.1789.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 (437) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/members-v1/src/index.d.ts +36 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/online-programs/src/index.d.ts +18 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-members.mjs +7 -0
  4. package/dist/cli.mjs +57 -13
  5. package/fixtures/wix-canned.json +8 -0
  6. package/guides/himi-json-output.md +7 -0
  7. package/guides/sdk-reference.json +25 -2
  8. package/package.json +2 -2
  9. package/templates/beauty-salon/config.ts +29 -1
  10. package/templates/beauty-salon/dev/index.ts +3702 -1505
  11. package/templates/beauty-salon/himalaya.content.json +13 -1
  12. package/templates/beauty-salon/l10n/ar.json +226 -264
  13. package/templates/beauty-salon/l10n/cs.json +226 -264
  14. package/templates/beauty-salon/l10n/da.json +226 -264
  15. package/templates/beauty-salon/l10n/de.json +226 -264
  16. package/templates/beauty-salon/l10n/el.json +226 -264
  17. package/templates/beauty-salon/l10n/en.json +158 -199
  18. package/templates/beauty-salon/l10n/es.json +226 -264
  19. package/templates/beauty-salon/l10n/fi.json +226 -264
  20. package/templates/beauty-salon/l10n/fr.json +227 -265
  21. package/templates/beauty-salon/l10n/he.json +186 -217
  22. package/templates/beauty-salon/l10n/hu.json +226 -264
  23. package/templates/beauty-salon/l10n/id.json +226 -264
  24. package/templates/beauty-salon/l10n/it.json +226 -264
  25. package/templates/beauty-salon/l10n/ja.json +226 -264
  26. package/templates/beauty-salon/l10n/ko.json +226 -264
  27. package/templates/beauty-salon/l10n/lt.json +226 -264
  28. package/templates/beauty-salon/l10n/nl.json +226 -264
  29. package/templates/beauty-salon/l10n/no.json +226 -264
  30. package/templates/beauty-salon/l10n/pl.json +226 -264
  31. package/templates/beauty-salon/l10n/pt.json +226 -264
  32. package/templates/beauty-salon/l10n/ru.json +226 -264
  33. package/templates/beauty-salon/l10n/sv.json +226 -264
  34. package/templates/beauty-salon/l10n/th.json +226 -264
  35. package/templates/beauty-salon/l10n/tr.json +226 -264
  36. package/templates/beauty-salon/l10n/uk.json +226 -264
  37. package/templates/beauty-salon/l10n/vi.json +226 -264
  38. package/templates/beauty-salon/l10n/zh.json +226 -264
  39. package/templates/beauty-salon/tier5-src/_shared/member-account-routes.ts +7 -3
  40. package/templates/beauty-salon/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +69 -16
  41. package/templates/beauty-salon/tier5-src/himi-branded-lite-account-settings/index.ts +46 -1082
  42. package/templates/beauty-salon/tier5-src/himi-branded-lite-account-settings/login-info.ts +262 -0
  43. package/templates/beauty-salon/tier5-src/himi-branded-lite-account-settings/personal-info.ts +824 -0
  44. package/templates/beauty-salon/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
  45. package/templates/beauty-salon/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
  46. package/templates/branded-lite/config.ts +29 -1
  47. package/templates/branded-lite/dev/index.ts +3915 -1513
  48. package/templates/branded-lite/himalaya.content.json +13 -1
  49. package/templates/branded-lite/l10n/ar.json +284 -267
  50. package/templates/branded-lite/l10n/cs.json +284 -267
  51. package/templates/branded-lite/l10n/da.json +284 -267
  52. package/templates/branded-lite/l10n/de.json +284 -267
  53. package/templates/branded-lite/l10n/el.json +284 -267
  54. package/templates/branded-lite/l10n/en.json +201 -207
  55. package/templates/branded-lite/l10n/es.json +284 -267
  56. package/templates/branded-lite/l10n/fi.json +284 -267
  57. package/templates/branded-lite/l10n/fr.json +288 -271
  58. package/templates/branded-lite/l10n/he.json +233 -219
  59. package/templates/branded-lite/l10n/hu.json +284 -267
  60. package/templates/branded-lite/l10n/id.json +284 -267
  61. package/templates/branded-lite/l10n/it.json +284 -267
  62. package/templates/branded-lite/l10n/ja.json +284 -267
  63. package/templates/branded-lite/l10n/ko.json +284 -267
  64. package/templates/branded-lite/l10n/lt.json +284 -267
  65. package/templates/branded-lite/l10n/nl.json +284 -267
  66. package/templates/branded-lite/l10n/no.json +284 -267
  67. package/templates/branded-lite/l10n/pl.json +284 -267
  68. package/templates/branded-lite/l10n/pt.json +284 -267
  69. package/templates/branded-lite/l10n/ru.json +284 -267
  70. package/templates/branded-lite/l10n/sv.json +284 -267
  71. package/templates/branded-lite/l10n/th.json +284 -267
  72. package/templates/branded-lite/l10n/tr.json +284 -267
  73. package/templates/branded-lite/l10n/uk.json +284 -267
  74. package/templates/branded-lite/l10n/vi.json +284 -267
  75. package/templates/branded-lite/l10n/zh.json +284 -267
  76. package/templates/branded-lite/tier5-src/_shared/member-account-routes.ts +7 -3
  77. package/templates/branded-lite/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +69 -16
  78. package/templates/branded-lite/tier5-src/himi-branded-lite-account-settings/index.ts +46 -1082
  79. package/templates/branded-lite/tier5-src/himi-branded-lite-account-settings/login-info.ts +262 -0
  80. package/templates/branded-lite/tier5-src/himi-branded-lite-account-settings/personal-info.ts +824 -0
  81. package/templates/branded-lite/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
  82. package/templates/branded-lite/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
  83. package/templates/branded-lite/tier5-src/himi-branded-lite-program-participant/index.ts +169 -4
  84. package/templates/branded-lite/tier5-src/himi-branded-lite-program-participant/model.ts +32 -1
  85. package/templates/brandy/README.md +4 -2
  86. package/templates/brandy/config.ts +12 -1
  87. package/templates/brandy/tier5-src/_shared/member-account-routes.ts +7 -3
  88. package/templates/community-club/config.ts +29 -1
  89. package/templates/community-club/dev/index.ts +3717 -1520
  90. package/templates/community-club/himalaya.content.json +13 -1
  91. package/templates/community-club/l10n/ar.json +218 -262
  92. package/templates/community-club/l10n/cs.json +218 -262
  93. package/templates/community-club/l10n/da.json +218 -262
  94. package/templates/community-club/l10n/de.json +218 -262
  95. package/templates/community-club/l10n/el.json +218 -262
  96. package/templates/community-club/l10n/en.json +140 -188
  97. package/templates/community-club/l10n/es.json +218 -262
  98. package/templates/community-club/l10n/fi.json +218 -262
  99. package/templates/community-club/l10n/fr.json +218 -262
  100. package/templates/community-club/l10n/he.json +180 -216
  101. package/templates/community-club/l10n/hu.json +218 -262
  102. package/templates/community-club/l10n/id.json +218 -262
  103. package/templates/community-club/l10n/it.json +218 -262
  104. package/templates/community-club/l10n/ja.json +218 -262
  105. package/templates/community-club/l10n/ko.json +218 -262
  106. package/templates/community-club/l10n/lt.json +218 -262
  107. package/templates/community-club/l10n/nl.json +218 -262
  108. package/templates/community-club/l10n/no.json +218 -262
  109. package/templates/community-club/l10n/pl.json +218 -262
  110. package/templates/community-club/l10n/pt.json +218 -262
  111. package/templates/community-club/l10n/ru.json +218 -262
  112. package/templates/community-club/l10n/sv.json +218 -262
  113. package/templates/community-club/l10n/th.json +218 -262
  114. package/templates/community-club/l10n/tr.json +218 -262
  115. package/templates/community-club/l10n/uk.json +218 -262
  116. package/templates/community-club/l10n/vi.json +218 -262
  117. package/templates/community-club/l10n/zh.json +218 -262
  118. package/templates/community-club/tier5-src/_shared/member-account-routes.ts +7 -3
  119. package/templates/community-club/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +69 -16
  120. package/templates/community-club/tier5-src/himi-branded-lite-account-settings/index.ts +46 -1082
  121. package/templates/community-club/tier5-src/himi-branded-lite-account-settings/login-info.ts +262 -0
  122. package/templates/community-club/tier5-src/himi-branded-lite-account-settings/personal-info.ts +824 -0
  123. package/templates/community-club/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
  124. package/templates/community-club/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
  125. package/templates/conference/tier5-src/_shared/member-account-routes.ts +7 -3
  126. package/templates/events-meetups/config.ts +29 -1
  127. package/templates/events-meetups/dev/index.ts +3703 -1506
  128. package/templates/events-meetups/himalaya.content.json +13 -1
  129. package/templates/events-meetups/l10n/ar.json +218 -262
  130. package/templates/events-meetups/l10n/cs.json +218 -262
  131. package/templates/events-meetups/l10n/da.json +218 -262
  132. package/templates/events-meetups/l10n/de.json +218 -262
  133. package/templates/events-meetups/l10n/el.json +218 -262
  134. package/templates/events-meetups/l10n/en.json +140 -188
  135. package/templates/events-meetups/l10n/es.json +218 -262
  136. package/templates/events-meetups/l10n/fi.json +218 -262
  137. package/templates/events-meetups/l10n/fr.json +218 -262
  138. package/templates/events-meetups/l10n/he.json +180 -216
  139. package/templates/events-meetups/l10n/hu.json +218 -262
  140. package/templates/events-meetups/l10n/id.json +218 -262
  141. package/templates/events-meetups/l10n/it.json +218 -262
  142. package/templates/events-meetups/l10n/ja.json +218 -262
  143. package/templates/events-meetups/l10n/ko.json +218 -262
  144. package/templates/events-meetups/l10n/lt.json +218 -262
  145. package/templates/events-meetups/l10n/nl.json +218 -262
  146. package/templates/events-meetups/l10n/no.json +218 -262
  147. package/templates/events-meetups/l10n/pl.json +218 -262
  148. package/templates/events-meetups/l10n/pt.json +218 -262
  149. package/templates/events-meetups/l10n/ru.json +218 -262
  150. package/templates/events-meetups/l10n/sv.json +218 -262
  151. package/templates/events-meetups/l10n/th.json +218 -262
  152. package/templates/events-meetups/l10n/tr.json +218 -262
  153. package/templates/events-meetups/l10n/uk.json +218 -262
  154. package/templates/events-meetups/l10n/vi.json +218 -262
  155. package/templates/events-meetups/l10n/zh.json +218 -262
  156. package/templates/events-meetups/tier5-src/_shared/member-account-routes.ts +7 -3
  157. package/templates/events-meetups/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +69 -16
  158. package/templates/events-meetups/tier5-src/himi-branded-lite-account-settings/index.ts +46 -1082
  159. package/templates/events-meetups/tier5-src/himi-branded-lite-account-settings/login-info.ts +262 -0
  160. package/templates/events-meetups/tier5-src/himi-branded-lite-account-settings/personal-info.ts +824 -0
  161. package/templates/events-meetups/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
  162. package/templates/events-meetups/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
  163. package/templates/fitness-gym/tier5-src/_shared/member-account-routes.ts +7 -3
  164. package/templates/gym-fitness/config.ts +29 -1
  165. package/templates/gym-fitness/dev/index.ts +3711 -1514
  166. package/templates/gym-fitness/himalaya.content.json +13 -1
  167. package/templates/gym-fitness/l10n/ar.json +226 -264
  168. package/templates/gym-fitness/l10n/cs.json +226 -264
  169. package/templates/gym-fitness/l10n/da.json +226 -264
  170. package/templates/gym-fitness/l10n/de.json +226 -264
  171. package/templates/gym-fitness/l10n/el.json +226 -264
  172. package/templates/gym-fitness/l10n/en.json +161 -202
  173. package/templates/gym-fitness/l10n/es.json +226 -264
  174. package/templates/gym-fitness/l10n/fi.json +226 -264
  175. package/templates/gym-fitness/l10n/fr.json +227 -265
  176. package/templates/gym-fitness/l10n/he.json +186 -217
  177. package/templates/gym-fitness/l10n/hu.json +226 -264
  178. package/templates/gym-fitness/l10n/id.json +226 -264
  179. package/templates/gym-fitness/l10n/it.json +226 -264
  180. package/templates/gym-fitness/l10n/ja.json +226 -264
  181. package/templates/gym-fitness/l10n/ko.json +226 -264
  182. package/templates/gym-fitness/l10n/lt.json +226 -264
  183. package/templates/gym-fitness/l10n/nl.json +226 -264
  184. package/templates/gym-fitness/l10n/no.json +226 -264
  185. package/templates/gym-fitness/l10n/pl.json +226 -264
  186. package/templates/gym-fitness/l10n/pt.json +226 -264
  187. package/templates/gym-fitness/l10n/ru.json +226 -264
  188. package/templates/gym-fitness/l10n/sv.json +226 -264
  189. package/templates/gym-fitness/l10n/th.json +226 -264
  190. package/templates/gym-fitness/l10n/tr.json +226 -264
  191. package/templates/gym-fitness/l10n/uk.json +226 -264
  192. package/templates/gym-fitness/l10n/vi.json +226 -264
  193. package/templates/gym-fitness/l10n/zh.json +226 -264
  194. package/templates/gym-fitness/tier5-src/_shared/member-account-routes.ts +7 -3
  195. package/templates/gym-fitness/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +69 -16
  196. package/templates/gym-fitness/tier5-src/himi-branded-lite-account-settings/index.ts +46 -1082
  197. package/templates/gym-fitness/tier5-src/himi-branded-lite-account-settings/login-info.ts +262 -0
  198. package/templates/gym-fitness/tier5-src/himi-branded-lite-account-settings/personal-info.ts +824 -0
  199. package/templates/gym-fitness/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
  200. package/templates/gym-fitness/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
  201. package/templates/medical-services/tier5-src/_shared/member-account-routes.ts +7 -3
  202. package/templates/nonprofit-cause/config.ts +29 -1
  203. package/templates/nonprofit-cause/dev/index.ts +3719 -1522
  204. package/templates/nonprofit-cause/himalaya.content.json +13 -1
  205. package/templates/nonprofit-cause/l10n/ar.json +218 -262
  206. package/templates/nonprofit-cause/l10n/cs.json +218 -262
  207. package/templates/nonprofit-cause/l10n/da.json +218 -262
  208. package/templates/nonprofit-cause/l10n/de.json +218 -262
  209. package/templates/nonprofit-cause/l10n/el.json +218 -262
  210. package/templates/nonprofit-cause/l10n/en.json +145 -193
  211. package/templates/nonprofit-cause/l10n/es.json +218 -262
  212. package/templates/nonprofit-cause/l10n/fi.json +218 -262
  213. package/templates/nonprofit-cause/l10n/fr.json +218 -262
  214. package/templates/nonprofit-cause/l10n/he.json +180 -216
  215. package/templates/nonprofit-cause/l10n/hu.json +218 -262
  216. package/templates/nonprofit-cause/l10n/id.json +218 -262
  217. package/templates/nonprofit-cause/l10n/it.json +218 -262
  218. package/templates/nonprofit-cause/l10n/ja.json +218 -262
  219. package/templates/nonprofit-cause/l10n/ko.json +218 -262
  220. package/templates/nonprofit-cause/l10n/lt.json +218 -262
  221. package/templates/nonprofit-cause/l10n/nl.json +218 -262
  222. package/templates/nonprofit-cause/l10n/no.json +218 -262
  223. package/templates/nonprofit-cause/l10n/pl.json +218 -262
  224. package/templates/nonprofit-cause/l10n/pt.json +218 -262
  225. package/templates/nonprofit-cause/l10n/ru.json +218 -262
  226. package/templates/nonprofit-cause/l10n/sv.json +218 -262
  227. package/templates/nonprofit-cause/l10n/th.json +218 -262
  228. package/templates/nonprofit-cause/l10n/tr.json +218 -262
  229. package/templates/nonprofit-cause/l10n/uk.json +218 -262
  230. package/templates/nonprofit-cause/l10n/vi.json +218 -262
  231. package/templates/nonprofit-cause/l10n/zh.json +218 -262
  232. package/templates/nonprofit-cause/tier5-src/_shared/member-account-routes.ts +7 -3
  233. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +69 -16
  234. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-account-settings/index.ts +46 -1082
  235. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-account-settings/login-info.ts +262 -0
  236. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-account-settings/personal-info.ts +824 -0
  237. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
  238. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
  239. package/templates/personal-fitness-trainer/config.ts +30 -2
  240. package/templates/personal-fitness-trainer/dev/index.ts +3698 -1476
  241. package/templates/personal-fitness-trainer/himalaya.content.json +13 -1
  242. package/templates/personal-fitness-trainer/tier5-src/_shared/member-account-routes.ts +7 -3
  243. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +69 -16
  244. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/index.ts +46 -1082
  245. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/login-info.ts +262 -0
  246. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/personal-info.ts +824 -0
  247. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
  248. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
  249. package/templates/podcast-creator/config.ts +29 -1
  250. package/templates/podcast-creator/dev/index.ts +3718 -1521
  251. package/templates/podcast-creator/himalaya.content.json +13 -1
  252. package/templates/podcast-creator/l10n/ar.json +224 -262
  253. package/templates/podcast-creator/l10n/cs.json +224 -262
  254. package/templates/podcast-creator/l10n/da.json +224 -262
  255. package/templates/podcast-creator/l10n/de.json +224 -262
  256. package/templates/podcast-creator/l10n/el.json +224 -262
  257. package/templates/podcast-creator/l10n/en.json +152 -193
  258. package/templates/podcast-creator/l10n/es.json +224 -262
  259. package/templates/podcast-creator/l10n/fi.json +224 -262
  260. package/templates/podcast-creator/l10n/fr.json +227 -265
  261. package/templates/podcast-creator/l10n/he.json +185 -216
  262. package/templates/podcast-creator/l10n/hu.json +224 -262
  263. package/templates/podcast-creator/l10n/id.json +224 -262
  264. package/templates/podcast-creator/l10n/it.json +224 -262
  265. package/templates/podcast-creator/l10n/ja.json +224 -262
  266. package/templates/podcast-creator/l10n/ko.json +224 -262
  267. package/templates/podcast-creator/l10n/lt.json +224 -262
  268. package/templates/podcast-creator/l10n/nl.json +224 -262
  269. package/templates/podcast-creator/l10n/no.json +224 -262
  270. package/templates/podcast-creator/l10n/pl.json +224 -262
  271. package/templates/podcast-creator/l10n/pt.json +224 -262
  272. package/templates/podcast-creator/l10n/ru.json +224 -262
  273. package/templates/podcast-creator/l10n/sv.json +224 -262
  274. package/templates/podcast-creator/l10n/th.json +224 -262
  275. package/templates/podcast-creator/l10n/tr.json +224 -262
  276. package/templates/podcast-creator/l10n/uk.json +224 -262
  277. package/templates/podcast-creator/l10n/vi.json +224 -262
  278. package/templates/podcast-creator/l10n/zh.json +224 -262
  279. package/templates/podcast-creator/tier5-src/_shared/member-account-routes.ts +7 -3
  280. package/templates/podcast-creator/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +69 -16
  281. package/templates/podcast-creator/tier5-src/himi-branded-lite-account-settings/index.ts +46 -1082
  282. package/templates/podcast-creator/tier5-src/himi-branded-lite-account-settings/login-info.ts +262 -0
  283. package/templates/podcast-creator/tier5-src/himi-branded-lite-account-settings/personal-info.ts +824 -0
  284. package/templates/podcast-creator/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
  285. package/templates/podcast-creator/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
  286. package/templates/portfolio-creative/config.ts +29 -1
  287. package/templates/portfolio-creative/dev/index.ts +3708 -1511
  288. package/templates/portfolio-creative/himalaya.content.json +13 -1
  289. package/templates/portfolio-creative/l10n/ar.json +226 -264
  290. package/templates/portfolio-creative/l10n/cs.json +226 -264
  291. package/templates/portfolio-creative/l10n/da.json +226 -264
  292. package/templates/portfolio-creative/l10n/de.json +226 -264
  293. package/templates/portfolio-creative/l10n/el.json +226 -264
  294. package/templates/portfolio-creative/l10n/en.json +155 -196
  295. package/templates/portfolio-creative/l10n/es.json +226 -264
  296. package/templates/portfolio-creative/l10n/fi.json +226 -264
  297. package/templates/portfolio-creative/l10n/fr.json +226 -264
  298. package/templates/portfolio-creative/l10n/he.json +186 -217
  299. package/templates/portfolio-creative/l10n/hu.json +226 -264
  300. package/templates/portfolio-creative/l10n/id.json +226 -264
  301. package/templates/portfolio-creative/l10n/it.json +226 -264
  302. package/templates/portfolio-creative/l10n/ja.json +226 -264
  303. package/templates/portfolio-creative/l10n/ko.json +226 -264
  304. package/templates/portfolio-creative/l10n/lt.json +226 -264
  305. package/templates/portfolio-creative/l10n/nl.json +226 -264
  306. package/templates/portfolio-creative/l10n/no.json +226 -264
  307. package/templates/portfolio-creative/l10n/pl.json +226 -264
  308. package/templates/portfolio-creative/l10n/pt.json +226 -264
  309. package/templates/portfolio-creative/l10n/ru.json +226 -264
  310. package/templates/portfolio-creative/l10n/sv.json +226 -264
  311. package/templates/portfolio-creative/l10n/th.json +226 -264
  312. package/templates/portfolio-creative/l10n/tr.json +226 -264
  313. package/templates/portfolio-creative/l10n/uk.json +226 -264
  314. package/templates/portfolio-creative/l10n/vi.json +226 -264
  315. package/templates/portfolio-creative/l10n/zh.json +226 -264
  316. package/templates/portfolio-creative/tier5-src/_shared/member-account-routes.ts +7 -3
  317. package/templates/portfolio-creative/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +69 -16
  318. package/templates/portfolio-creative/tier5-src/himi-branded-lite-account-settings/index.ts +46 -1082
  319. package/templates/portfolio-creative/tier5-src/himi-branded-lite-account-settings/login-info.ts +262 -0
  320. package/templates/portfolio-creative/tier5-src/himi-branded-lite-account-settings/personal-info.ts +824 -0
  321. package/templates/portfolio-creative/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
  322. package/templates/portfolio-creative/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
  323. package/templates/restaurant/config.ts +29 -1
  324. package/templates/restaurant/dev/index.ts +3706 -1509
  325. package/templates/restaurant/himalaya.content.json +13 -1
  326. package/templates/restaurant/l10n/ar.json +226 -264
  327. package/templates/restaurant/l10n/cs.json +226 -264
  328. package/templates/restaurant/l10n/da.json +226 -264
  329. package/templates/restaurant/l10n/de.json +226 -264
  330. package/templates/restaurant/l10n/el.json +226 -264
  331. package/templates/restaurant/l10n/en.json +152 -193
  332. package/templates/restaurant/l10n/es.json +226 -264
  333. package/templates/restaurant/l10n/fi.json +226 -264
  334. package/templates/restaurant/l10n/fr.json +226 -264
  335. package/templates/restaurant/l10n/he.json +186 -217
  336. package/templates/restaurant/l10n/hu.json +226 -264
  337. package/templates/restaurant/l10n/id.json +226 -264
  338. package/templates/restaurant/l10n/it.json +226 -264
  339. package/templates/restaurant/l10n/ja.json +226 -264
  340. package/templates/restaurant/l10n/ko.json +226 -264
  341. package/templates/restaurant/l10n/lt.json +226 -264
  342. package/templates/restaurant/l10n/nl.json +226 -264
  343. package/templates/restaurant/l10n/no.json +226 -264
  344. package/templates/restaurant/l10n/pl.json +226 -264
  345. package/templates/restaurant/l10n/pt.json +226 -264
  346. package/templates/restaurant/l10n/ru.json +226 -264
  347. package/templates/restaurant/l10n/sv.json +226 -264
  348. package/templates/restaurant/l10n/th.json +226 -264
  349. package/templates/restaurant/l10n/tr.json +226 -264
  350. package/templates/restaurant/l10n/uk.json +226 -264
  351. package/templates/restaurant/l10n/vi.json +226 -264
  352. package/templates/restaurant/l10n/zh.json +226 -264
  353. package/templates/restaurant/tier5-src/_shared/member-account-routes.ts +7 -3
  354. package/templates/restaurant/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +69 -16
  355. package/templates/restaurant/tier5-src/himi-branded-lite-account-settings/index.ts +46 -1082
  356. package/templates/restaurant/tier5-src/himi-branded-lite-account-settings/login-info.ts +262 -0
  357. package/templates/restaurant/tier5-src/himi-branded-lite-account-settings/personal-info.ts +824 -0
  358. package/templates/restaurant/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
  359. package/templates/restaurant/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
  360. package/templates/retail-store/config.ts +29 -1
  361. package/templates/retail-store/dev/index.ts +3708 -1511
  362. package/templates/retail-store/himalaya.content.json +13 -1
  363. package/templates/retail-store/l10n/ar.json +226 -270
  364. package/templates/retail-store/l10n/cs.json +226 -270
  365. package/templates/retail-store/l10n/da.json +226 -270
  366. package/templates/retail-store/l10n/de.json +226 -270
  367. package/templates/retail-store/l10n/el.json +226 -270
  368. package/templates/retail-store/l10n/en.json +154 -202
  369. package/templates/retail-store/l10n/es.json +226 -270
  370. package/templates/retail-store/l10n/fi.json +226 -270
  371. package/templates/retail-store/l10n/fr.json +226 -270
  372. package/templates/retail-store/l10n/he.json +186 -222
  373. package/templates/retail-store/l10n/hu.json +226 -270
  374. package/templates/retail-store/l10n/id.json +226 -270
  375. package/templates/retail-store/l10n/it.json +226 -270
  376. package/templates/retail-store/l10n/ja.json +226 -270
  377. package/templates/retail-store/l10n/ko.json +226 -270
  378. package/templates/retail-store/l10n/lt.json +226 -270
  379. package/templates/retail-store/l10n/nl.json +226 -270
  380. package/templates/retail-store/l10n/no.json +226 -270
  381. package/templates/retail-store/l10n/pl.json +226 -270
  382. package/templates/retail-store/l10n/pt.json +226 -270
  383. package/templates/retail-store/l10n/ru.json +226 -270
  384. package/templates/retail-store/l10n/sv.json +226 -270
  385. package/templates/retail-store/l10n/th.json +226 -270
  386. package/templates/retail-store/l10n/tr.json +226 -270
  387. package/templates/retail-store/l10n/uk.json +226 -270
  388. package/templates/retail-store/l10n/vi.json +226 -270
  389. package/templates/retail-store/l10n/zh.json +226 -270
  390. package/templates/retail-store/tier5-src/_shared/member-account-routes.ts +7 -3
  391. package/templates/retail-store/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +69 -16
  392. package/templates/retail-store/tier5-src/himi-branded-lite-account-settings/index.ts +46 -1082
  393. package/templates/retail-store/tier5-src/himi-branded-lite-account-settings/login-info.ts +262 -0
  394. package/templates/retail-store/tier5-src/himi-branded-lite-account-settings/personal-info.ts +824 -0
  395. package/templates/retail-store/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
  396. package/templates/retail-store/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
  397. package/templates/salon-spa/tier5-src/_shared/member-account-routes.ts +7 -3
  398. package/templates/wholesale-store/tier5-src/_shared/member-account-routes.ts +7 -3
  399. package/templates/yoga-studio/config.ts +29 -1
  400. package/templates/yoga-studio/dev/index.ts +3905 -1506
  401. package/templates/yoga-studio/himalaya.content.json +13 -1
  402. package/templates/yoga-studio/l10n/ar.json +300 -262
  403. package/templates/yoga-studio/l10n/cs.json +300 -262
  404. package/templates/yoga-studio/l10n/da.json +300 -262
  405. package/templates/yoga-studio/l10n/de.json +300 -262
  406. package/templates/yoga-studio/l10n/el.json +300 -262
  407. package/templates/yoga-studio/l10n/en.json +198 -197
  408. package/templates/yoga-studio/l10n/es.json +300 -262
  409. package/templates/yoga-studio/l10n/fi.json +300 -262
  410. package/templates/yoga-studio/l10n/fr.json +301 -263
  411. package/templates/yoga-studio/l10n/he.json +247 -216
  412. package/templates/yoga-studio/l10n/hu.json +300 -262
  413. package/templates/yoga-studio/l10n/id.json +300 -262
  414. package/templates/yoga-studio/l10n/it.json +300 -262
  415. package/templates/yoga-studio/l10n/ja.json +300 -262
  416. package/templates/yoga-studio/l10n/ko.json +300 -262
  417. package/templates/yoga-studio/l10n/lt.json +300 -262
  418. package/templates/yoga-studio/l10n/nl.json +300 -262
  419. package/templates/yoga-studio/l10n/no.json +300 -262
  420. package/templates/yoga-studio/l10n/pl.json +300 -262
  421. package/templates/yoga-studio/l10n/pt.json +300 -262
  422. package/templates/yoga-studio/l10n/ru.json +300 -262
  423. package/templates/yoga-studio/l10n/sv.json +300 -262
  424. package/templates/yoga-studio/l10n/th.json +300 -262
  425. package/templates/yoga-studio/l10n/tr.json +300 -262
  426. package/templates/yoga-studio/l10n/uk.json +300 -262
  427. package/templates/yoga-studio/l10n/vi.json +300 -262
  428. package/templates/yoga-studio/l10n/zh.json +300 -262
  429. package/templates/yoga-studio/tier5-src/_shared/member-account-routes.ts +7 -3
  430. package/templates/yoga-studio/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +69 -16
  431. package/templates/yoga-studio/tier5-src/himi-branded-lite-account-settings/index.ts +46 -1082
  432. package/templates/yoga-studio/tier5-src/himi-branded-lite-account-settings/login-info.ts +262 -0
  433. package/templates/yoga-studio/tier5-src/himi-branded-lite-account-settings/personal-info.ts +824 -0
  434. package/templates/yoga-studio/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
  435. package/templates/yoga-studio/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
  436. package/templates/yoga-studio/tier5-src/himi-branded-lite-program-participant/index.ts +169 -4
  437. package/templates/yoga-studio/tier5-src/himi-branded-lite-program-participant/model.ts +32 -1
@@ -0,0 +1,139 @@
1
+ // Privacy — the Public profile switch and the blocked members list. The switch saves at once
2
+ // (joinCommunity / leaveCommunity), so this modal has no Save. Turning it off asks first, because
3
+ // the member also leaves the site's community; turning it on does not. A member record with no
4
+ // privacy status shows no switch, only a notice.
5
+ import { defineService } from "@himalaya/state";
6
+ import { alert } from "@himalaya/ui";
7
+ import { getMyMember, joinCommunity, leaveCommunity } from "@himalaya/wix-members";
8
+ import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
9
+ import { svc as blockedMembers } from "./blocked-members.js";
10
+ import {
11
+ businessNameOf, clean, fetchMember, isSignedOut, loadErrorVariant, sameAccess, signedOutError, type WixMemberResponse,
12
+ } from "./shared.js";
13
+
14
+ interface S {
15
+ phase: "loading" | "ready" | "error" | "signedOut";
16
+ errorVariant: "offline" | "server";
17
+ memberId: string;
18
+ memberEmail: string;
19
+ memberScope: string;
20
+ businessName: string;
21
+ /** "Choose if other members of {business} can see your profile." */
22
+ description: string;
23
+ /** The API returned PUBLIC or PRIVATE. Otherwise the switch is replaced by a notice. */
24
+ privacyKnown: boolean;
25
+ privacyUnknown: boolean;
26
+ isPublic: boolean;
27
+ statusLine: string;
28
+ busy: boolean;
29
+ /** A switch change that did not save. */
30
+ errorText: string;
31
+ noErrorText: boolean;
32
+ }
33
+
34
+ const EMPTY: S = {
35
+ phase: "loading", errorVariant: "server", memberId: "", memberEmail: "", memberScope: "", businessName: "",
36
+ description: "", privacyKnown: false, privacyUnknown: true, isPublic: false, statusLine: "", busy: false,
37
+ errorText: "", noErrorText: true,
38
+ };
39
+
40
+ function statusLine(isPublic: boolean): string {
41
+ return isPublic
42
+ ? copyParam("accountSettings.publicProfileOn", "Other members can see your profile.")
43
+ : copyParam("accountSettings.publicProfileOff", "Only you can see your profile.");
44
+ }
45
+
46
+ function withStatus(s: S, privacyStatus: unknown): S {
47
+ const status = clean(privacyStatus).toUpperCase();
48
+ const known = status === "PUBLIC" || status === "PRIVATE";
49
+ const isPublic = status === "PUBLIC";
50
+ return { ...s, privacyKnown: known, privacyUnknown: !known, isPublic, statusLine: known ? statusLine(isPublic) : "" };
51
+ }
52
+
53
+ let loadVersion = 0;
54
+ let mutationInFlight = false;
55
+ /** The member moved the switch again while a change was saving. That move is not saved, so the
56
+ * switch must be drawn again from the result, or it keeps showing the dropped position. */
57
+ let flipDropped = false;
58
+
59
+ const svc = defineService<S, {
60
+ load: (s: S, arg?: unknown) => Promise<S>;
61
+ showLoading: (s: S) => S;
62
+ begin: (s: S, patch: Partial<S>) => S;
63
+ setPublic: (s: S, arg?: unknown) => Promise<S | undefined>;
64
+ }>("himiBrandedAccountPrivacy", {
65
+ state: { ...EMPTY },
66
+ notHydrated: Object.keys(EMPTY) as (keyof S)[],
67
+ notPersisted: Object.keys(EMPTY) as (keyof S)[],
68
+ actions: {
69
+ showLoading: (s) => ({ ...EMPTY, businessName: s.businessName, description: s.description }),
70
+ begin: (s, patch) => ({ ...s, ...patch, noErrorText: !(patch.errorText ?? s.errorText) }),
71
+ load: async (_s, arg): Promise<S> => {
72
+ const version = ++loadVersion;
73
+ stashCopy(arg);
74
+ const businessName = businessNameOf(arg) || svc.getState().businessName;
75
+ const description = copyTemplate("accountSettings.privacyDescription", "Choose if other members of {business} can see your profile.", { business: businessName });
76
+ if (svc.getState().phase !== "loading") await svc.showLoading();
77
+ // The blocked members section loads with the modal; its own onAppear does the same on a device.
78
+ void blockedMembers.load(arg).catch(() => undefined);
79
+ try {
80
+ const { member, email, scope } = await fetchMember();
81
+ if (version !== loadVersion) return svc.getState();
82
+ return withStatus({ ...EMPTY, phase: "ready", memberId: clean(member.id), memberEmail: email, memberScope: scope, businessName, description }, member.privacyStatus);
83
+ } catch (error) {
84
+ if (version !== loadVersion) return svc.getState();
85
+ return { ...EMPTY, businessName, description, phase: isSignedOut(error) ? "signedOut" : "error", errorVariant: loadErrorVariant(error) };
86
+ }
87
+ },
88
+ setPublic: async (s, arg): Promise<S | undefined> => {
89
+ if (s.phase !== "ready" || !s.privacyKnown || !s.memberId) return undefined;
90
+ if (mutationInFlight) { flipDropped = true; return undefined; }
91
+ const value = (arg as { value?: unknown } | undefined)?.value;
92
+ const wantPublic = value === true || value === "true";
93
+ if (wantPublic === s.isPublic) return undefined;
94
+ flipDropped = false;
95
+ // Draw the switch from `final`; after a dropped move, flip it first so the host redraws it.
96
+ const settle = async (final: S): Promise<S> => {
97
+ if (flipDropped) { flipDropped = false; await svc.begin({ isPublic: !final.isPublic }); }
98
+ return final;
99
+ };
100
+ mutationInFlight = true;
101
+ try {
102
+ // The switch already moved: follow it, so that a Cancel below moves it back.
103
+ await svc.begin({ isPublic: wantPublic, errorText: "" });
104
+ if (!wantPublic) {
105
+ let confirmed = false;
106
+ try {
107
+ const answer = await alert({
108
+ title: copyParam("accountSettings.makePrivateTitle", "Make your profile private?"),
109
+ message: copyTemplate("accountSettings.makePrivateBody", "Other members can't see your profile. You also leave the community of {business}.", { business: s.businessName }),
110
+ confirmLabel: copyParam("accountSettings.makePrivateConfirm", "Make private"),
111
+ cancelLabel: copyParam("common.cancelCta", "Cancel"),
112
+ });
113
+ confirmed = answer.confirmed;
114
+ } catch { /* no presenter: nothing was confirmed */ }
115
+ // Cancel: the switch and its status line go back to public together.
116
+ if (!confirmed) return await settle({ ...svc.getState(), isPublic: true, statusLine: statusLine(true) });
117
+ }
118
+ await svc.begin({ busy: true });
119
+ if (!(await sameAccess(s.memberEmail, s.memberScope))) throw signedOutError();
120
+ const response = wantPublic ? await joinCommunity() : await leaveCommunity();
121
+ if (response.member?.id !== s.memberId || !response.member.privacyStatus) throw new Error("The profile privacy update was not confirmed for this member.");
122
+ const refreshed = await getMyMember({ fieldsets: ["FULL"] }) as WixMemberResponse;
123
+ if (refreshed.member?.id !== s.memberId || !(await sameAccess(s.memberEmail, s.memberScope))) throw signedOutError();
124
+ // A stale read or a rejected write leaves the OLD status in the readback: that is not a save.
125
+ const status = clean(refreshed.member.privacyStatus).toUpperCase();
126
+ if (status !== (wantPublic ? "PUBLIC" : "PRIVATE")) throw new Error("The profile privacy update was not confirmed by the readback.");
127
+ return await settle({ ...withStatus(svc.getState(), status), busy: false, errorText: "", noErrorText: true });
128
+ } catch (error) {
129
+ // The member changed mid-save: show none of the previous member's privacy, only Sign in.
130
+ if (isSignedOut(error)) return { ...EMPTY, businessName: s.businessName, description: s.description, phase: "signedOut" };
131
+ const latest = svc.getState();
132
+ return await settle({ ...latest, isPublic: s.isPublic, statusLine: statusLine(s.isPublic), busy: false,
133
+ errorText: copyParam("accountSettings.privacyError", "Your privacy setting was not updated."), noErrorText: false });
134
+ } finally { mutationInFlight = false; }
135
+ },
136
+ },
137
+ });
138
+
139
+ export { svc as privacy };
@@ -0,0 +1,136 @@
1
+ // Shared by the Account settings menu and its three modals (Personal info, Login info with its
2
+ // Change password step, Privacy). Each modal is its own screen, so each boots this bundle in its
3
+ // own worker and loads the member itself: nothing here is shared state, only the checks.
4
+ import { dispatch } from "@himalaya/dispatch";
5
+ import { classifyLoadError } from "@himalaya/state";
6
+ import { getMyMember } from "@himalaya/wix-members";
7
+ import { getMyData } from "@himalaya/wix-users";
8
+ import { hostSiteFromInput } from "../_shared/branded-lite-hosted.js";
9
+ import { memberAccess } from "../_shared/member-access.js";
10
+ import type { MemberAccountRoutes } from "../_shared/member-account-routes.js";
11
+
12
+ export type WixMemberRecord = {
13
+ id?: string;
14
+ loginEmail?: string;
15
+ contact?: {
16
+ firstName?: string;
17
+ lastName?: string;
18
+ phones?: string[];
19
+ birthdate?: string;
20
+ company?: string;
21
+ jobTitle?: string;
22
+ customFields?: Record<string, { name?: string; value?: unknown } | undefined>;
23
+ };
24
+ profile?: { nickname?: string; title?: string; slug?: string; photo?: { id?: string; url?: string } };
25
+ privacyStatus?: string;
26
+ };
27
+ export type WixMemberResponse = { member?: WixMemberRecord };
28
+
29
+ export function rawText(value: unknown): string { return typeof value === "string" ? value : ""; }
30
+ export function clean(value: unknown): string { return rawText(value).trim(); }
31
+
32
+ export function signedOutError(): Error {
33
+ return Object.assign(new Error("signed_out"), { code: "signed_out" });
34
+ }
35
+ export function isSignedOut(error: unknown): boolean {
36
+ return (error as { code?: string } | null)?.code === "signed_out";
37
+ }
38
+
39
+ /** The load-error variant the modals' ErrorState draws: `offline` only when the request never left. */
40
+ export function loadErrorVariant(error: unknown): "offline" | "server" {
41
+ return classifyLoadError(error) === "offline" ? "offline" : "server";
42
+ }
43
+
44
+ /** The site a hosted build was opened for (`himalaya.input.__himiHostSite`), or "" when the build
45
+ * is not hosted. A hosted build serves many businesses, so this wins over the build's own name. */
46
+ export const hostedBusinessName = clean(hostSiteFromInput((globalThis as { himalaya?: { input?: unknown } }).himalaya?.input)?.name);
47
+
48
+ /** The business name each modal shows as its subtitle and in its copy: the hosted site's, else the
49
+ * descriptor param (the build's own business). */
50
+ export function businessNameOf(arg: unknown): string {
51
+ return hostedBusinessName || clean((arg as { businessName?: unknown } | undefined)?.businessName);
52
+ }
53
+
54
+ /** The signed-in member's own record, read with the member's token, and the identity it was read for. */
55
+ export async function fetchMember(siteUrlInput?: unknown): Promise<{ email: string; scope: string; siteUrl: string; member: WixMemberRecord & { id: string } }> {
56
+ const access = await memberAccess();
57
+ if (!access.email) throw signedOutError();
58
+ const response = await getMyMember({ fieldsets: ["FULL"] }) as WixMemberResponse;
59
+ if (!response.member?.id) throw new Error("The signed-in member profile is unavailable.");
60
+ const after = await memberAccess();
61
+ if (!after.email || after.email !== access.email || after.scope !== access.scope) throw signedOutError();
62
+ const siteUrl = clean(siteUrlInput).replace(/\/$/, "");
63
+ return { email: access.email, scope: access.scope, siteUrl, member: response.member as WixMemberRecord & { id: string } };
64
+ }
65
+
66
+ /** The same member is still signed in, by email, scope and member id. */
67
+ export async function currentMemberRecordMatches(email: string, scope: string, memberId: string): Promise<boolean> {
68
+ const before = await memberAccess();
69
+ if (!before.email || before.email !== email || before.scope !== scope) return false;
70
+ const response = await getMyMember({ fieldsets: ["FULL"] }) as WixMemberResponse;
71
+ const after = await memberAccess();
72
+ return response.member?.id === memberId && after.email === email && after.scope === scope;
73
+ }
74
+
75
+ /** Who is signed in: a member, nobody, or `unavailable` when the host could not say at all.
76
+ * `memberAccess()` reads both failures as "nobody"; the menu must not ask a member to sign in
77
+ * because the identity read failed. Older hosts without `memberIdentity` answer through
78
+ * wix-users (the same rung memberAccess uses); a host that fails both ways is unavailable. */
79
+ export async function memberIdentityState(): Promise<"member" | "guest" | "unavailable"> {
80
+ let raw: unknown;
81
+ let unavailable = false;
82
+ try { raw = await dispatch("himi.wix.memberIdentity"); }
83
+ catch { unavailable = true; }
84
+ const value = raw as { email?: unknown; signedIn?: unknown; payload?: { email?: unknown; signedIn?: unknown } } | null;
85
+ // A host can say a member is signed in before it has the email.
86
+ if (clean(value?.email ?? value?.payload?.email) || (value?.signedIn ?? value?.payload?.signedIn) === true) return "member";
87
+ if (!unavailable) return "guest";
88
+ try {
89
+ const profile = await getMyData();
90
+ return clean(profile.email ?? profile.contactEmail) ? "member" : "guest";
91
+ } catch {
92
+ return "unavailable";
93
+ }
94
+ }
95
+
96
+ /** Same identity by email and scope alone (no network). */
97
+ export async function sameAccess(email: string, scope: string): Promise<boolean> {
98
+ const current = await memberAccess();
99
+ return !!current.email && current.email === email && current.scope === scope;
100
+ }
101
+
102
+ /** An http(s) URL split at its authority (between `//` and the first `/`, `?` or `#`). A worker has
103
+ * no URL global, so the authority is split by hand. */
104
+ const HTTP_URL = /^https?:\/\/([^/?#]*)(?:[/?#]\S*)?$/i;
105
+ /** A website handoff needs a real http(s) site: the documented placeholder (example.com) never counts,
106
+ * and neither does a URL with userinfo (`https://shop.acme.com@evil.example` opens evil.example). */
107
+ export function siteHandoffAvailable(siteUrl: string): boolean {
108
+ const match = HTTP_URL.exec(siteUrl);
109
+ if (!match || siteUrl.includes("\\")) return false;
110
+ const authority = match[1];
111
+ if (authority.includes("@")) return false;
112
+ const host = authority.replace(/:\d+$/, "").toLowerCase();
113
+ if (!host || /[\s:]/.test(host)) return false;
114
+ return host !== "example.com" && !host.endsWith(".example.com");
115
+ }
116
+
117
+ export function memberInitials(firstName: string, lastName: string, nickname: string): string {
118
+ return ([firstName[0], lastName[0]].filter(Boolean).join("") || nickname.slice(0, 1) || "M").toUpperCase();
119
+ }
120
+
121
+ /** Login info's Password section.
122
+ * - `row`: this app changes the password (a native app on HimalayaCore 1.5.0 or later).
123
+ * - `notice-preview`: the web host, a preview of the app.
124
+ * - `notice-here`: inside another Wix app, an older binary, or an unknown platform and version. */
125
+ export type PasswordMode = "row" | "notice-preview" | "notice-here";
126
+ export function passwordMode(routes: Pick<MemberAccountRoutes, "passwordCredentials" | "webPreview">): PasswordMode {
127
+ if (routes.passwordCredentials) return "row";
128
+ return routes.webPreview ? "notice-preview" : "notice-here";
129
+ }
130
+
131
+ /** The case the Password section draws: the mode, and for a notice whether it links the website. */
132
+ export function passwordCase(mode: PasswordMode, siteLink: boolean): string {
133
+ if (mode === "row") return "row";
134
+ const base = mode === "notice-preview" ? "preview" : "here";
135
+ return siteLink ? `${base}-link` : base;
136
+ }
@@ -13,9 +13,20 @@
13
13
  //
14
14
  // The next step opens the step screen when the host serves one (the load arg `stepScreen`);
15
15
  // without it the button shows the step in the Content tab, where it is marked "Next step".
16
+ //
17
+ // Rewards, leave and share (B4), on the Overview: the certificate (when the program has one and
18
+ // the member completed it; a time-limited link fetched at the tap, opened in the system browser),
19
+ // a link to the badges list (when the program awards badges and the host serves `badgesScreen`),
20
+ // "Leave program" behind a confirm alert (then the program page, which owns rejoining), and the
21
+ // program's site link in the system share sheet.
16
22
  import { connectivity, defineService, navigate } from "@himalaya/state";
23
+ import { open as openUrl } from "@himalaya/open-url";
24
+ import { share as shareSheet } from "@himalaya/share";
25
+ import { alert } from "@himalaya/ui";
17
26
  import {
27
+ getCertificateDownloadUrl,
18
28
  getProgram,
29
+ leaveProgram,
19
30
  listSections,
20
31
  participationsByProgram,
21
32
  queryParticipantSteps,
@@ -23,7 +34,7 @@ import {
23
34
  queryResolvedSteps,
24
35
  searchMemberParticipation,
25
36
  type WixParticipant,
26
- type WixProgram,
37
+ type WixProgramFull,
27
38
  type WixResolvedStep,
28
39
  type WixStep,
29
40
  } from "@himalaya/wix-online-programs";
@@ -39,7 +50,7 @@ import { inProgram, standingOf, STATUS, type Standing } from "../_shared/program
39
50
  import { assertMemberAccess, memberAccess, memberChanged, type MemberAccess } from "../_shared/member-access.js";
40
51
  import { initials } from "../_shared/himi-text.js";
41
52
  import { copyParam, stashCopy } from "../_shared/himi-copy.js";
42
- import { buildContent, type ContentRow } from "./model.js";
53
+ import { buildContent, rewardsOf, shareUrlOf, type ContentRow } from "./model.js";
43
54
 
44
55
  export const SERVICE = "himiBrandedProgramParticipant";
45
56
  /** The program page a member who is not in the program goes back to. */
@@ -92,6 +103,27 @@ interface State {
92
103
  hideContentEmpty: boolean;
93
104
  /** The Content tab's line when it has no rows: no steps yet, or steps the site will not show this member. */
94
105
  contentEmptyText: string;
106
+ /** The program has a certificate and the member completed it. */
107
+ hasCertificate: boolean;
108
+ /** The program awards badges and the host serves the badges vertical. */
109
+ hasBadges: boolean;
110
+ badgesLine: string;
111
+ hideCertificate: boolean;
112
+ hideBadges: boolean;
113
+ /** The Rewards card: hidden when there is neither a certificate nor badges to show. */
114
+ hideRewards: boolean;
115
+ /** The program's page on the site; "" hides Share. */
116
+ shareUrl: string;
117
+ hideShare: boolean;
118
+ /** The member may leave: in the program and the program has not ended. */
119
+ canLeave: boolean;
120
+ hideLeave: boolean;
121
+ /** A certificate fetch or a leave is in flight: both buttons wait. */
122
+ busy: boolean;
123
+ /** Why the certificate did not open, shown in the Rewards card next to its button; "" when none. */
124
+ certificateMessage: string;
125
+ /** Why a leave did not happen, shown under Leave; "" when none. */
126
+ actionMessage: string;
95
127
  }
96
128
 
97
129
  let rows: ContentRow[] = [];
@@ -99,6 +131,12 @@ let rows: ContentRow[] = [];
99
131
  let shownFor: MemberAccess | undefined;
100
132
  let access: Access = "member";
101
133
  let stepScreen = "";
134
+ /** The badges list; "" when the host has no badges vertical. */
135
+ let badgesScreen = "";
136
+ /** The participation the page on screen was built for: what Leave and the certificate act on. */
137
+ let participantId = "";
138
+ /** A certificate fetch or a leave is running: a second tap waits (the busy flag lands a publish later). */
139
+ let acting = false;
102
140
  let loadSeq = 0;
103
141
 
104
142
  function inputId(): string {
@@ -128,6 +166,11 @@ function derive(state: State): State {
128
166
  hideProgress: !member || state.progressLabel === "",
129
167
  hideNextStep: !member || !state.nextStepId,
130
168
  hideContentEmpty: !member || !content || rows.length > 0,
169
+ hideCertificate: !member || !state.hasCertificate,
170
+ hideBadges: !member || !state.hasBadges,
171
+ hideRewards: !member || (!state.hasCertificate && !state.hasBadges),
172
+ hideShare: !member || !state.shareUrl,
173
+ hideLeave: !member || !state.canLeave,
131
174
  };
132
175
  }
133
176
 
@@ -137,10 +180,12 @@ const INITIAL_STATE: State = derive({
137
180
  progress: 0, progressLabel: "", hideProgress: true, nextStepId: "", nextStepTitle: "", nextStepSection: "", hideNextStep: true,
138
181
  nextLine: "", gateText: "", contentEmptyText: "", isLoading: true, notLoading: false, hideError: true, needsSignIn: false, noSignIn: true,
139
182
  hideNotJoined: true, hideBody: true, hideOverview: true, hideContentEmpty: true,
183
+ hasCertificate: false, hasBadges: false, badgesLine: "", hideCertificate: true, hideBadges: true, hideRewards: true,
184
+ shareUrl: "", hideShare: true, canLeave: false, hideLeave: true, busy: false, certificateMessage: "", actionMessage: "",
140
185
  });
141
186
 
142
187
  /** getProgram first; the programs query is the fallback when the GET path fails (as on himi_program). */
143
- async function fetchProgram(id: string): Promise<WixProgram | undefined> {
188
+ async function fetchProgram(id: string): Promise<WixProgramFull | undefined> {
144
189
  try {
145
190
  return (await getProgram(id)).program;
146
191
  } catch {
@@ -196,6 +241,8 @@ async function load(state: State, arg?: unknown): Promise<undefined> {
196
241
  stashCopy(arg);
197
242
  const asked = (arg as { stepScreen?: unknown } | undefined)?.stepScreen;
198
243
  if (typeof asked === "string") stepScreen = asked;
244
+ const badges = (arg as { badgesScreen?: unknown } | undefined)?.badgesScreen;
245
+ if (typeof badges === "string") badgesScreen = badges;
199
246
  const id = inputId();
200
247
  const seq = ++loadSeq;
201
248
  const current = () => seq === loadSeq && inputId() === id;
@@ -219,6 +266,7 @@ async function load(state: State, arg?: unknown): Promise<undefined> {
219
266
  if (!member.email) {
220
267
  access = "signIn";
221
268
  rows = [];
269
+ participantId = "";
222
270
  shownFor = member;
223
271
  void svc.publish({ programId: id, status: "ready" });
224
272
  return undefined;
@@ -241,6 +289,7 @@ async function load(state: State, arg?: unknown): Promise<undefined> {
241
289
  if (!participant || !inProgram(standing, participant)) {
242
290
  access = "notJoined";
243
291
  rows = [];
292
+ participantId = "";
244
293
  shownFor = member;
245
294
  void svc.publish({ ...header, status: "ready", gateText: gateTextOf(standing, participant) });
246
295
  return undefined;
@@ -261,10 +310,14 @@ async function load(state: State, arg?: unknown): Promise<undefined> {
261
310
  await assertMemberAccess(member);
262
311
  if (!current()) return undefined;
263
312
  const model = buildContent({ sections, steps, resolved, participant, now: Date.now(), locale });
313
+ const rewards = rewardsOf(program);
314
+ const completed = standing === "completed";
264
315
  access = "member";
265
316
  rows = model.rows;
317
+ participantId = participant.id;
266
318
  shownFor = member;
267
319
  const status = STATUS[standing as Exclude<Standing, "none">];
320
+ const hasBadges = !!badgesScreen && rewards.badgeIds.length > 0;
268
321
  void svc.publish({
269
322
  ...header,
270
323
  status: "ready",
@@ -279,6 +332,20 @@ async function load(state: State, arg?: unknown): Promise<undefined> {
279
332
  contentEmptyText: model.contentAvailable
280
333
  ? copyParam("programParticipant.contentEmpty", "This program has no steps yet.")
281
334
  : copyParam("programParticipant.contentUnavailable", "This program's steps can't be shown in the app right now."),
335
+ hasCertificate: rewards.certificate && completed,
336
+ hasBadges,
337
+ badgesLine: !hasBadges ? ""
338
+ : completed ? copyParam("programParticipant.badgesEarnedLine", "You completed the program. See the badges it awards.")
339
+ : copyParam("programParticipant.badgesLine", "Complete the program to earn its badges."),
340
+ shareUrl: shareUrlOf(program),
341
+ // Only a member still working through a running program may leave. A completed member keeps the
342
+ // program and its certificate (leaving deletes the participation the certificate link needs), and an
343
+ // ended program has nothing left to leave. `standingOf` reads "completed" before "ended": both checked.
344
+ canLeave: standing === "joined" && !isProgramEnded(program),
345
+ // A load that works clears what an earlier failed attempt said.
346
+ busy: false,
347
+ certificateMessage: "",
348
+ actionMessage: "",
282
349
  });
283
350
  } catch (error) {
284
351
  if (!current()) return undefined;
@@ -289,8 +356,10 @@ async function load(state: State, arg?: unknown): Promise<undefined> {
289
356
  if (changed) {
290
357
  rows = [];
291
358
  access = "member";
359
+ participantId = "";
292
360
  shownFor = undefined;
293
- void svc.publish({ status: "loading", programId: "", standingLine: "", progress: 0, progressLabel: "", nextStepId: "", nextStepTitle: "", nextStepSection: "", nextLine: "" });
361
+ void svc.publish({ status: "loading", programId: "", standingLine: "", progress: 0, progressLabel: "", nextStepId: "", nextStepTitle: "", nextStepSection: "", nextLine: "",
362
+ hasCertificate: false, hasBadges: false, badgesLine: "", shareUrl: "", canLeave: false, busy: false, certificateMessage: "", actionMessage: "" });
294
363
  void svc.load();
295
364
  return undefined;
296
365
  }
@@ -301,6 +370,86 @@ async function load(state: State, arg?: unknown): Promise<undefined> {
301
370
  return undefined;
302
371
  }
303
372
 
373
+ /** The page on screen is still the one an action started on: same program route, ready, same member and
374
+ * participation. Checked again after every await, before anything is opened, deleted or published. */
375
+ function stillOn(programId: string, forParticipant: string, forMember: MemberAccess): boolean {
376
+ const now = svc.getState();
377
+ return inputId() === programId && now.programId === programId && now.status === "ready"
378
+ && participantId === forParticipant && sameMember(shownFor, forMember);
379
+ }
380
+
381
+ /** The certificate link is time-limited: fetched at the tap, never kept. */
382
+ async function openCertificate(state: State): Promise<undefined> {
383
+ if (acting || !state.hasCertificate || !participantId || !shownFor) return undefined;
384
+ acting = true;
385
+ const forMember = shownFor;
386
+ const forParticipant = participantId;
387
+ const programId = state.programId;
388
+ void svc.publish({ busy: true, certificateMessage: "" });
389
+ try {
390
+ await assertMemberAccess(forMember);
391
+ const { downloadUrl } = await getCertificateDownloadUrl(forParticipant);
392
+ // The link is a bearer URL to this member's certificate: open it only if the same member is still
393
+ // signed in and the same page is still on screen; otherwise drop it and leave the new page alone.
394
+ await assertMemberAccess(forMember);
395
+ if (!stillOn(programId, forParticipant, forMember)) { void svc.publish({ busy: false }); return undefined; }
396
+ if (!downloadUrl || !/^https:\/\//i.test(downloadUrl)) throw new Error("No certificate link");
397
+ const { opened } = await openUrl(downloadUrl, "system_browser");
398
+ if (!stillOn(programId, forParticipant, forMember)) { void svc.publish({ busy: false }); return undefined; }
399
+ void svc.publish({ busy: false, certificateMessage: opened ? "" : copyParam("programParticipant.certificateFailed", "The certificate can't be opened right now. Try again.") });
400
+ } catch (error) {
401
+ if (await memberChanged(forMember, error)) { void svc.publish({ busy: false }); void svc.load(); return undefined; }
402
+ void svc.publish({ busy: false, certificateMessage: failedLine("programParticipant.certificateFailed", "The certificate can't be opened right now. Try again.") });
403
+ } finally {
404
+ acting = false;
405
+ }
406
+ return undefined;
407
+ }
408
+
409
+ function failedLine(key: string, fallback: string): string {
410
+ return connectivity().online ? copyParam(key, fallback) : copyParam("programParticipant.offlineAction", "You're offline. Connect to the internet and try again.");
411
+ }
412
+
413
+ /** Leave after the member confirms; then the program page, which owns rejoining. Every outcome but the
414
+ * navigation is a publish, so nothing that loaded while the alert was open is rolled back. */
415
+ async function leave(state: State): Promise<State | undefined> {
416
+ if (acting || !state.canLeave || !participantId || !shownFor) return undefined;
417
+ const forMember = shownFor;
418
+ const forParticipant = participantId;
419
+ const programId = state.programId;
420
+ // No alert host (or another alert is open, e.g. a second tap) counts as "not confirmed": never leave
421
+ // without the member's yes.
422
+ const { confirmed } = await alert({
423
+ title: copyParam("programParticipant.leaveTitle", "Leave this program?"),
424
+ message: copyParam("programParticipant.leaveMessage", "You'll lose access to its steps. You can join again from the program page."),
425
+ confirmLabel: copyParam("programParticipant.leaveConfirm", "Leave"),
426
+ cancelLabel: copyParam("common.cancelCta", "Cancel"),
427
+ destructive: true,
428
+ }).catch(() => ({ confirmed: false }));
429
+ // The page may have moved on while the alert was open: another program or member, or a refresh that
430
+ // ended the program or completed it (no Leave any more).
431
+ if (!confirmed || acting || !stillOn(programId, forParticipant, forMember) || !svc.getState().canLeave) return undefined;
432
+ acting = true;
433
+ try {
434
+ void svc.publish({ busy: true, actionMessage: "" });
435
+ try {
436
+ await assertMemberAccess(forMember);
437
+ // A refresh or route change during the member check (one that completed or ended the program too):
438
+ // delete nothing.
439
+ if (!stillOn(programId, forParticipant, forMember) || !svc.getState().canLeave) { void svc.publish({ busy: false }); return undefined; }
440
+ await leaveProgram(forParticipant);
441
+ } catch (error) {
442
+ if (await memberChanged(forMember, error)) { void svc.publish({ busy: false }); void svc.load(); return undefined; }
443
+ void svc.publish({ busy: false, actionMessage: failedLine("programParticipant.leaveFailed", "We couldn't take you out of the program. Try again.") });
444
+ return undefined;
445
+ }
446
+ participantId = "";
447
+ return navigate(derive({ ...svc.getState(), busy: false, canLeave: false }), { screenId: PROGRAM_SCREEN, args: { id: programId }, presentation: "replace" });
448
+ } finally {
449
+ acting = false;
450
+ }
451
+ }
452
+
304
453
  type Actions = {
305
454
  load: (state: State, arg?: unknown) => Promise<undefined>;
306
455
  refresh: (state: State) => Promise<undefined>;
@@ -308,6 +457,10 @@ type Actions = {
308
457
  selectTab: (state: State, arg?: unknown) => State;
309
458
  openStep: (state: State) => State;
310
459
  openLink: (state: State, arg?: unknown) => Promise<undefined>;
460
+ openCertificate: (state: State) => Promise<undefined>;
461
+ openBadges: (state: State) => State;
462
+ shareProgram: (state: State) => Promise<undefined>;
463
+ leave: (state: State) => Promise<State | undefined>;
311
464
  };
312
465
 
313
466
  const svc = defineService<State, Actions>(SERVICE, {
@@ -329,6 +482,18 @@ const svc = defineService<State, Actions>(SERVICE, {
329
482
  return derive({ ...state, tab: "content" });
330
483
  },
331
484
  openLink: async (_state, arg) => { await openRichLink(arg); return undefined; },
485
+ openCertificate,
486
+ openBadges: (state) => {
487
+ // The badges list: one badge's page shows only what its caller passes, which this page does not read.
488
+ if (!state.hasBadges || !badgesScreen) return state;
489
+ return navigate(state, { screenId: badgesScreen });
490
+ },
491
+ shareProgram: async (state) => {
492
+ if (!state.shareUrl) return undefined;
493
+ try { await shareSheet({ subject: state.name, text: state.name, url: state.shareUrl }); } catch { /* the sheet is best-effort */ }
494
+ return undefined;
495
+ },
496
+ leave,
332
497
  },
333
498
  });
334
499
 
@@ -2,7 +2,7 @@
2
2
  // flat row list (a section header, then its steps) plus the Overview's progress and next step.
3
3
  // Pure — the worker reads the program, the participation and the content; this file only decides
4
4
  // what the member sees.
5
- import type { WixParticipant, WixResolvedStep, WixSection, WixStep } from "@himalaya/wix-online-programs";
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
8
 
@@ -204,3 +204,34 @@ export function buildContent(input: {
204
204
  contentAvailable,
205
205
  };
206
206
  }
207
+
208
+ /** What the program awards on completion (rewards with another trigger are not shown), as the participant page shows it. */
209
+ export interface Rewards {
210
+ /** The program has a certificate connected. */
211
+ certificate: boolean;
212
+ /** Distinct badge ids the program awards, in the order the site lists them. */
213
+ badgeIds: string[];
214
+ }
215
+
216
+ export function rewardsOf(program: Pick<WixProgramFull, "rewards"> | undefined): Rewards {
217
+ const badgeIds: string[] = [];
218
+ let certificate = false;
219
+ for (const reward of program?.rewards ?? []) {
220
+ // Only what completing the program earns: the page promises these "when you complete the program".
221
+ const trigger = String(reward?.trigger ?? "ALL_STEPS_COMPLETED").toUpperCase();
222
+ if (trigger !== "ALL_STEPS_COMPLETED") continue;
223
+ if (reward?.certificate?.id) certificate = true;
224
+ for (const id of reward?.badgeIds ?? []) if (typeof id === "string" && id && !badgeIds.includes(id)) badgeIds.push(id);
225
+ }
226
+ return { certificate, badgeIds };
227
+ }
228
+
229
+ /** The program's page on the live site, for the share sheet; "" when the site gives no https link. */
230
+ export function shareUrlOf(program: Pick<WixProgramFull, "seo"> | undefined): string {
231
+ const base = program?.seo?.url?.base ?? "";
232
+ const path = program?.seo?.url?.path ?? "";
233
+ // No `URL` in every worker engine: join by hand. A base with a query or a fragment is not a page base.
234
+ if (!/^https:\/\/[^/?#\s]+(\/[^?#\s]*)?$/i.test(base) || /[\s]/.test(path)) return "";
235
+ const tail = path.replace(/^\/+/, "");
236
+ return tail ? `${base.replace(/\/+$/, "")}/${tail}` : base;
237
+ }
@@ -38,8 +38,10 @@ The whole app is the `site` block in `provisioning.json`:
38
38
  }
39
39
  ```
40
40
 
41
- The placeholder origin above is not a real site. Replace it by deriving the block from your site's
42
- own menu, from inside this folder:
41
+ The placeholder origin above is not a real site. Until you replace it, the app loads its pages from
42
+ `WIX_SITE_URL` when that is set (the published template preview uses it to show a demo site), and
43
+ once you set your own origin `WIX_SITE_URL` is ignored. Replace it by deriving the block from your
44
+ site's own menu, from inside this folder:
43
45
 
44
46
  ```bash
45
47
  himi site analyze --url https://your-account.wixsite.com/your-site --apply
@@ -25,6 +25,17 @@ import { ConsoleTelemetrySink } from "@himalaya/telemetry-console";
25
25
  import { WixConsumerAuthProvider } from "@himalaya/wix-auth";
26
26
  import provisioning from "./provisioning.json" with { type: "json" };
27
27
 
28
+ /** The stand-in origin ./provisioning.json ships with. It is not a site: every page under it is a 404. */
29
+ const PLACEHOLDER_SITE_ORIGIN = "https://your-account.wixsite.com/your-site";
30
+
31
+ /** While the origin is still the stand-in, WIX_SITE_URL (the same variable the other templates read
32
+ * for their site) takes its place, so a preview built with it shows a live site instead of a 404.
33
+ * Once you set your own origin, by hand or with `himi site analyze`, WIX_SITE_URL is ignored. */
34
+ function withPreviewOrigin(provisioned: SiteShellConfig): SiteShellConfig {
35
+ const fallback = process.env.WIX_SITE_URL?.trim();
36
+ return provisioned.origin === PLACEHOLDER_SITE_ORIGIN && fallback ? { ...provisioned, origin: fallback } : provisioned;
37
+ }
38
+
28
39
  /** Your website and its page map. Validated here, so a mistake in provisioning.json (an http
29
40
  * origin, a duplicate page id, no tab) fails `himi validate`, `render` and `push` instead of
30
41
  * shipping a broken app.
@@ -50,7 +61,7 @@ import provisioning from "./provisioning.json" with { type: "json" };
50
61
  * native page is linkable from outside the app (`<scheme>://screen/<screenId>`) only with "public": true.
51
62
  * `pageTitle` — "auto" (default: no title on a page a tab, sidebar or drawer row opens; a title on
52
63
  * overflow and link-opened pages), "always" or "never"; a page's `showTitle` overrides it. */
53
- export const site = provisioning.site as SiteShellConfig;
64
+ export const site = withPreviewOrigin(provisioning.site as SiteShellConfig);
54
65
  assertSiteShellConfig(site);
55
66
  const nav = siteNav(site);
56
67
  // The app opens on its first tab, and everything that names the home screen (`himi init`,