@wix/himalaya-cli 0.1740.0 → 0.1742.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 (318) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/locale.d.ts +3 -1
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/members-v1/src/index.d.ts +7 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/pricing-plans/src/index.d.ts +6 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +57 -3
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/l10n.mjs +51 -2
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-members.mjs +6 -0
  7. package/dist/browser-plane/assets.json +5 -5
  8. package/dist/browser-plane/preview-deferred/{4235535ddd6e62ae867fd4d3588054909040428cffec9bea2807693a68e297d9.bin → d13ef703cc8f4d7eaa9b12967b618314b75002b5d4441dedbcc65e3601c4750d.bin} +1 -1
  9. package/dist/browser-plane/sw.js +6 -6
  10. package/dist/cli.mjs +497 -226
  11. package/dist/preview-assets.generated.bin +0 -0
  12. package/guides/getting-started.md +18 -7
  13. package/guides/himi-json-output.md +12 -1
  14. package/guides/himi-skill.md +18 -7
  15. package/guides/one-app-to-himi-app.md +11 -2
  16. package/guides/sdk-reference.json +11 -2
  17. package/guides/skill.md +24 -13
  18. package/package.json +2 -2
  19. package/templates/beauty-salon/l10n/en.json +55 -0
  20. package/templates/beauty-salon/l10n/fr.json +5103 -0
  21. package/templates/beauty-salon/l10n/he.json +319 -0
  22. package/templates/beauty-salon/recipes/blog-list-thumb-start.json +364 -0
  23. package/templates/beauty-salon/recipes/blog-list.json +364 -0
  24. package/templates/beauty-salon/recipes/blog-see-all.json +50 -0
  25. package/templates/beauty-salon/recipes/events-inline-list.json +203 -0
  26. package/templates/beauty-salon/recipes/events-inline.json +284 -0
  27. package/templates/beauty-salon/recipes/members-list.json +445 -0
  28. package/templates/beauty-salon/recipes/plans-card.json +811 -0
  29. package/templates/beauty-salon/recipes/programs-card.json +254 -0
  30. package/templates/beauty-salon/recipes/programs-carousel.json +234 -0
  31. package/templates/beauty-salon/recipes/section-error.json +58 -0
  32. package/templates/beauty-salon/tier5-src/_shared/blog-list.ts +207 -0
  33. package/templates/beauty-salon/tier5-src/_shared/event-registration.ts +86 -0
  34. package/templates/beauty-salon/tier5-src/_shared/events-card.ts +33 -0
  35. package/templates/beauty-salon/tier5-src/_shared/events-inline-options.ts +25 -0
  36. package/templates/beauty-salon/tier5-src/_shared/events-inline.ts +82 -0
  37. package/templates/beauty-salon/tier5-src/_shared/member-activity.ts +34 -0
  38. package/templates/beauty-salon/tier5-src/_shared/member-row-extras.ts +167 -0
  39. package/templates/beauty-salon/tier5-src/_shared/members-directory-view.ts +39 -0
  40. package/templates/beauty-salon/tier5-src/_shared/members-directory.ts +267 -0
  41. package/templates/beauty-salon/tier5-src/_shared/plan-facts.ts +87 -0
  42. package/templates/beauty-salon/tier5-src/_shared/plans-section.ts +106 -0
  43. package/templates/beauty-salon/tier5-src/_shared/programs-section.ts +728 -0
  44. package/templates/beauty-salon/tier5-src/_shared/relative-time.ts +21 -0
  45. package/templates/beauty-salon/tier5-src/wix-spaces-app-language/index.ts +18 -3
  46. package/templates/branded-lite/l10n/fr.json +9098 -0
  47. package/templates/branded-lite/l10n/he.json +92 -0
  48. package/templates/branded-lite/recipes/blog-list-thumb-start.json +364 -0
  49. package/templates/branded-lite/recipes/blog-list.json +364 -0
  50. package/templates/branded-lite/recipes/blog-see-all.json +50 -0
  51. package/templates/branded-lite/recipes/events-inline-list.json +203 -0
  52. package/templates/branded-lite/recipes/events-inline.json +284 -0
  53. package/templates/branded-lite/recipes/members-list.json +445 -0
  54. package/templates/branded-lite/recipes/plans-card.json +811 -0
  55. package/templates/branded-lite/recipes/programs-card.json +254 -0
  56. package/templates/branded-lite/recipes/programs-carousel.json +234 -0
  57. package/templates/branded-lite/recipes/section-error.json +58 -0
  58. package/templates/branded-lite/tier5-src/_shared/blog-list.ts +207 -0
  59. package/templates/branded-lite/tier5-src/_shared/events-card.ts +33 -0
  60. package/templates/branded-lite/tier5-src/_shared/events-inline-options.ts +25 -0
  61. package/templates/branded-lite/tier5-src/_shared/events-inline.ts +82 -0
  62. package/templates/branded-lite/tier5-src/_shared/group-privacy.ts +14 -0
  63. package/templates/branded-lite/tier5-src/_shared/member-row-extras.ts +1 -1
  64. package/templates/branded-lite/tier5-src/_shared/members-directory-view.ts +39 -0
  65. package/templates/branded-lite/tier5-src/_shared/members-directory.ts +267 -0
  66. package/templates/branded-lite/tier5-src/_shared/plan-facts.ts +87 -0
  67. package/templates/branded-lite/tier5-src/_shared/plans-section.ts +106 -0
  68. package/templates/branded-lite/tier5-src/_shared/programs-section.ts +728 -0
  69. package/templates/branded-lite/tier5-src/_shared/relative-time.ts +21 -0
  70. package/templates/branded-lite/tier5-src/himi-branded-lite-group/index.ts +11 -4
  71. package/templates/branded-lite/tier5-src/himi-branded-lite-group-about/index.ts +2 -6
  72. package/templates/branded-lite/tier5-src/wix-spaces-app-language/index.ts +18 -3
  73. package/templates/community-club/l10n/en.json +45 -0
  74. package/templates/community-club/l10n/fr.json +3318 -0
  75. package/templates/community-club/l10n/he.json +327 -0
  76. package/templates/community-club/recipes/blog-list-thumb-start.json +364 -0
  77. package/templates/community-club/recipes/blog-list.json +364 -0
  78. package/templates/community-club/recipes/blog-see-all.json +50 -0
  79. package/templates/community-club/recipes/events-inline-list.json +203 -0
  80. package/templates/community-club/recipes/events-inline.json +284 -0
  81. package/templates/community-club/recipes/members-list.json +445 -0
  82. package/templates/community-club/recipes/plans-card.json +811 -0
  83. package/templates/community-club/recipes/programs-card.json +254 -0
  84. package/templates/community-club/recipes/programs-carousel.json +234 -0
  85. package/templates/community-club/recipes/section-error.json +58 -0
  86. package/templates/community-club/tier5-src/_shared/blog-list.ts +207 -0
  87. package/templates/community-club/tier5-src/_shared/detail-presence.ts +51 -0
  88. package/templates/community-club/tier5-src/_shared/events-card.ts +33 -0
  89. package/templates/community-club/tier5-src/_shared/events-inline-options.ts +25 -0
  90. package/templates/community-club/tier5-src/_shared/events-inline.ts +82 -0
  91. package/templates/community-club/tier5-src/_shared/group-privacy.ts +14 -0
  92. package/templates/community-club/tier5-src/_shared/member-activity.ts +34 -0
  93. package/templates/community-club/tier5-src/_shared/member-row-extras.ts +167 -0
  94. package/templates/community-club/tier5-src/_shared/members-directory-view.ts +39 -0
  95. package/templates/community-club/tier5-src/_shared/members-directory.ts +267 -0
  96. package/templates/community-club/tier5-src/_shared/plan-facts.ts +87 -0
  97. package/templates/community-club/tier5-src/_shared/plans-section.ts +106 -0
  98. package/templates/community-club/tier5-src/_shared/programs-section.ts +728 -0
  99. package/templates/community-club/tier5-src/_shared/relative-time.ts +21 -0
  100. package/templates/community-club/tier5-src/himi-branded-lite-group/index.ts +11 -4
  101. package/templates/community-club/tier5-src/himi-branded-lite-group-about/index.ts +2 -6
  102. package/templates/community-club/tier5-src/wix-spaces-app-language/index.ts +18 -3
  103. package/templates/events-meetups/l10n/en.json +45 -0
  104. package/templates/events-meetups/l10n/fr.json +3178 -0
  105. package/templates/events-meetups/l10n/he.json +327 -0
  106. package/templates/events-meetups/recipes/blog-list-thumb-start.json +364 -0
  107. package/templates/events-meetups/recipes/blog-list.json +364 -0
  108. package/templates/events-meetups/recipes/blog-see-all.json +50 -0
  109. package/templates/events-meetups/recipes/events-inline-list.json +203 -0
  110. package/templates/events-meetups/recipes/events-inline.json +284 -0
  111. package/templates/events-meetups/recipes/members-list.json +445 -0
  112. package/templates/events-meetups/recipes/plans-card.json +811 -0
  113. package/templates/events-meetups/recipes/programs-card.json +254 -0
  114. package/templates/events-meetups/recipes/programs-carousel.json +234 -0
  115. package/templates/events-meetups/recipes/section-error.json +58 -0
  116. package/templates/events-meetups/tier5-src/_shared/blog-list.ts +207 -0
  117. package/templates/events-meetups/tier5-src/_shared/detail-presence.ts +51 -0
  118. package/templates/events-meetups/tier5-src/_shared/events-card.ts +33 -0
  119. package/templates/events-meetups/tier5-src/_shared/events-inline-options.ts +25 -0
  120. package/templates/events-meetups/tier5-src/_shared/events-inline.ts +82 -0
  121. package/templates/events-meetups/tier5-src/_shared/group-privacy.ts +14 -0
  122. package/templates/events-meetups/tier5-src/_shared/member-activity.ts +34 -0
  123. package/templates/events-meetups/tier5-src/_shared/member-row-extras.ts +167 -0
  124. package/templates/events-meetups/tier5-src/_shared/members-directory-view.ts +39 -0
  125. package/templates/events-meetups/tier5-src/_shared/members-directory.ts +267 -0
  126. package/templates/events-meetups/tier5-src/_shared/plan-facts.ts +87 -0
  127. package/templates/events-meetups/tier5-src/_shared/plans-section.ts +106 -0
  128. package/templates/events-meetups/tier5-src/_shared/programs-section.ts +728 -0
  129. package/templates/events-meetups/tier5-src/_shared/relative-time.ts +21 -0
  130. package/templates/events-meetups/tier5-src/himi-branded-lite-group/index.ts +11 -4
  131. package/templates/events-meetups/tier5-src/himi-branded-lite-group-about/index.ts +2 -6
  132. package/templates/events-meetups/tier5-src/wix-spaces-app-language/index.ts +18 -3
  133. package/templates/gym-fitness/l10n/en.json +45 -0
  134. package/templates/gym-fitness/l10n/fr.json +5694 -0
  135. package/templates/gym-fitness/l10n/he.json +307 -0
  136. package/templates/gym-fitness/recipes/blog-list-thumb-start.json +364 -0
  137. package/templates/gym-fitness/recipes/blog-list.json +364 -0
  138. package/templates/gym-fitness/recipes/blog-see-all.json +50 -0
  139. package/templates/gym-fitness/recipes/events-inline-list.json +203 -0
  140. package/templates/gym-fitness/recipes/events-inline.json +284 -0
  141. package/templates/gym-fitness/recipes/members-list.json +445 -0
  142. package/templates/gym-fitness/recipes/plans-card.json +811 -0
  143. package/templates/gym-fitness/recipes/programs-card.json +254 -0
  144. package/templates/gym-fitness/recipes/programs-carousel.json +234 -0
  145. package/templates/gym-fitness/recipes/section-error.json +58 -0
  146. package/templates/gym-fitness/tier5-src/_shared/blog-list.ts +207 -0
  147. package/templates/gym-fitness/tier5-src/_shared/events-card.ts +33 -0
  148. package/templates/gym-fitness/tier5-src/_shared/events-inline-options.ts +25 -0
  149. package/templates/gym-fitness/tier5-src/_shared/events-inline.ts +82 -0
  150. package/templates/gym-fitness/tier5-src/_shared/member-activity.ts +34 -0
  151. package/templates/gym-fitness/tier5-src/_shared/member-row-extras.ts +167 -0
  152. package/templates/gym-fitness/tier5-src/_shared/members-directory-view.ts +39 -0
  153. package/templates/gym-fitness/tier5-src/_shared/members-directory.ts +267 -0
  154. package/templates/gym-fitness/tier5-src/_shared/plan-facts.ts +87 -0
  155. package/templates/gym-fitness/tier5-src/_shared/plans-section.ts +106 -0
  156. package/templates/gym-fitness/tier5-src/_shared/programs-section.ts +728 -0
  157. package/templates/gym-fitness/tier5-src/_shared/relative-time.ts +21 -0
  158. package/templates/gym-fitness/tier5-src/wix-spaces-app-language/index.ts +18 -3
  159. package/templates/nonprofit-cause/l10n/en.json +45 -0
  160. package/templates/nonprofit-cause/l10n/fr.json +3766 -0
  161. package/templates/nonprofit-cause/l10n/he.json +307 -0
  162. package/templates/nonprofit-cause/recipes/blog-list-thumb-start.json +364 -0
  163. package/templates/nonprofit-cause/recipes/blog-list.json +364 -0
  164. package/templates/nonprofit-cause/recipes/blog-see-all.json +50 -0
  165. package/templates/nonprofit-cause/recipes/events-inline-list.json +203 -0
  166. package/templates/nonprofit-cause/recipes/events-inline.json +284 -0
  167. package/templates/nonprofit-cause/recipes/members-list.json +445 -0
  168. package/templates/nonprofit-cause/recipes/plans-card.json +811 -0
  169. package/templates/nonprofit-cause/recipes/programs-card.json +254 -0
  170. package/templates/nonprofit-cause/recipes/programs-carousel.json +234 -0
  171. package/templates/nonprofit-cause/recipes/section-error.json +58 -0
  172. package/templates/nonprofit-cause/tier5-src/_shared/blog-list.ts +207 -0
  173. package/templates/nonprofit-cause/tier5-src/_shared/events-card.ts +33 -0
  174. package/templates/nonprofit-cause/tier5-src/_shared/events-inline-options.ts +25 -0
  175. package/templates/nonprofit-cause/tier5-src/_shared/events-inline.ts +82 -0
  176. package/templates/nonprofit-cause/tier5-src/_shared/group-privacy.ts +14 -0
  177. package/templates/nonprofit-cause/tier5-src/_shared/member-activity.ts +34 -0
  178. package/templates/nonprofit-cause/tier5-src/_shared/member-row-extras.ts +167 -0
  179. package/templates/nonprofit-cause/tier5-src/_shared/members-directory-view.ts +39 -0
  180. package/templates/nonprofit-cause/tier5-src/_shared/members-directory.ts +267 -0
  181. package/templates/nonprofit-cause/tier5-src/_shared/plan-facts.ts +87 -0
  182. package/templates/nonprofit-cause/tier5-src/_shared/plans-section.ts +106 -0
  183. package/templates/nonprofit-cause/tier5-src/_shared/programs-section.ts +728 -0
  184. package/templates/nonprofit-cause/tier5-src/_shared/relative-time.ts +21 -0
  185. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-group/index.ts +11 -4
  186. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-group-about/index.ts +2 -6
  187. package/templates/nonprofit-cause/tier5-src/wix-spaces-app-language/index.ts +18 -3
  188. package/templates/podcast-creator/l10n/en.json +45 -0
  189. package/templates/podcast-creator/l10n/fr.json +3608 -0
  190. package/templates/podcast-creator/l10n/he.json +311 -0
  191. package/templates/podcast-creator/recipes/blog-list-thumb-start.json +364 -0
  192. package/templates/podcast-creator/recipes/blog-list.json +364 -0
  193. package/templates/podcast-creator/recipes/blog-see-all.json +50 -0
  194. package/templates/podcast-creator/recipes/events-inline-list.json +203 -0
  195. package/templates/podcast-creator/recipes/events-inline.json +284 -0
  196. package/templates/podcast-creator/recipes/members-list.json +445 -0
  197. package/templates/podcast-creator/recipes/plans-card.json +811 -0
  198. package/templates/podcast-creator/recipes/programs-card.json +254 -0
  199. package/templates/podcast-creator/recipes/programs-carousel.json +234 -0
  200. package/templates/podcast-creator/recipes/section-error.json +58 -0
  201. package/templates/podcast-creator/tier5-src/_shared/blog-list.ts +207 -0
  202. package/templates/podcast-creator/tier5-src/_shared/events-card.ts +33 -0
  203. package/templates/podcast-creator/tier5-src/_shared/events-inline-options.ts +25 -0
  204. package/templates/podcast-creator/tier5-src/_shared/events-inline.ts +82 -0
  205. package/templates/podcast-creator/tier5-src/_shared/member-activity.ts +34 -0
  206. package/templates/podcast-creator/tier5-src/_shared/member-row-extras.ts +167 -0
  207. package/templates/podcast-creator/tier5-src/_shared/members-directory-view.ts +39 -0
  208. package/templates/podcast-creator/tier5-src/_shared/members-directory.ts +267 -0
  209. package/templates/podcast-creator/tier5-src/_shared/plan-facts.ts +87 -0
  210. package/templates/podcast-creator/tier5-src/_shared/plans-section.ts +106 -0
  211. package/templates/podcast-creator/tier5-src/_shared/programs-section.ts +728 -0
  212. package/templates/podcast-creator/tier5-src/_shared/relative-time.ts +21 -0
  213. package/templates/podcast-creator/tier5-src/wix-spaces-app-language/index.ts +18 -3
  214. package/templates/portfolio-creative/l10n/en.json +45 -0
  215. package/templates/portfolio-creative/l10n/fr.json +4197 -0
  216. package/templates/portfolio-creative/l10n/he.json +335 -0
  217. package/templates/portfolio-creative/recipes/blog-list-thumb-start.json +364 -0
  218. package/templates/portfolio-creative/recipes/blog-list.json +364 -0
  219. package/templates/portfolio-creative/recipes/blog-see-all.json +50 -0
  220. package/templates/portfolio-creative/recipes/events-inline-list.json +203 -0
  221. package/templates/portfolio-creative/recipes/events-inline.json +284 -0
  222. package/templates/portfolio-creative/recipes/members-list.json +445 -0
  223. package/templates/portfolio-creative/recipes/plans-card.json +811 -0
  224. package/templates/portfolio-creative/recipes/programs-card.json +254 -0
  225. package/templates/portfolio-creative/recipes/programs-carousel.json +234 -0
  226. package/templates/portfolio-creative/recipes/section-error.json +58 -0
  227. package/templates/portfolio-creative/tier5-src/_shared/blog-list.ts +207 -0
  228. package/templates/portfolio-creative/tier5-src/_shared/events-card.ts +33 -0
  229. package/templates/portfolio-creative/tier5-src/_shared/events-inline-options.ts +25 -0
  230. package/templates/portfolio-creative/tier5-src/_shared/events-inline.ts +82 -0
  231. package/templates/portfolio-creative/tier5-src/_shared/member-activity.ts +34 -0
  232. package/templates/portfolio-creative/tier5-src/_shared/member-row-extras.ts +167 -0
  233. package/templates/portfolio-creative/tier5-src/_shared/members-directory-view.ts +39 -0
  234. package/templates/portfolio-creative/tier5-src/_shared/members-directory.ts +267 -0
  235. package/templates/portfolio-creative/tier5-src/_shared/plan-facts.ts +87 -0
  236. package/templates/portfolio-creative/tier5-src/_shared/plans-section.ts +106 -0
  237. package/templates/portfolio-creative/tier5-src/_shared/programs-section.ts +728 -0
  238. package/templates/portfolio-creative/tier5-src/_shared/relative-time.ts +21 -0
  239. package/templates/portfolio-creative/tier5-src/wix-spaces-app-language/index.ts +18 -3
  240. package/templates/restaurant/l10n/en.json +45 -0
  241. package/templates/restaurant/l10n/fr.json +3845 -0
  242. package/templates/restaurant/l10n/he.json +335 -0
  243. package/templates/restaurant/recipes/blog-list-thumb-start.json +364 -0
  244. package/templates/restaurant/recipes/blog-list.json +364 -0
  245. package/templates/restaurant/recipes/blog-see-all.json +50 -0
  246. package/templates/restaurant/recipes/events-inline-list.json +203 -0
  247. package/templates/restaurant/recipes/events-inline.json +284 -0
  248. package/templates/restaurant/recipes/members-list.json +445 -0
  249. package/templates/restaurant/recipes/plans-card.json +811 -0
  250. package/templates/restaurant/recipes/programs-card.json +254 -0
  251. package/templates/restaurant/recipes/programs-carousel.json +234 -0
  252. package/templates/restaurant/recipes/section-error.json +58 -0
  253. package/templates/restaurant/tier5-src/_shared/blog-list.ts +207 -0
  254. package/templates/restaurant/tier5-src/_shared/events-card.ts +33 -0
  255. package/templates/restaurant/tier5-src/_shared/events-inline-options.ts +25 -0
  256. package/templates/restaurant/tier5-src/_shared/events-inline.ts +82 -0
  257. package/templates/restaurant/tier5-src/_shared/member-activity.ts +34 -0
  258. package/templates/restaurant/tier5-src/_shared/member-row-extras.ts +167 -0
  259. package/templates/restaurant/tier5-src/_shared/members-directory-view.ts +39 -0
  260. package/templates/restaurant/tier5-src/_shared/members-directory.ts +267 -0
  261. package/templates/restaurant/tier5-src/_shared/plan-facts.ts +87 -0
  262. package/templates/restaurant/tier5-src/_shared/plans-section.ts +106 -0
  263. package/templates/restaurant/tier5-src/_shared/programs-section.ts +728 -0
  264. package/templates/restaurant/tier5-src/_shared/relative-time.ts +21 -0
  265. package/templates/restaurant/tier5-src/wix-spaces-app-language/index.ts +18 -3
  266. package/templates/retail-store/l10n/en.json +60 -0
  267. package/templates/retail-store/l10n/fr.json +3621 -0
  268. package/templates/retail-store/l10n/he.json +355 -0
  269. package/templates/retail-store/recipes/blog-list-thumb-start.json +364 -0
  270. package/templates/retail-store/recipes/blog-list.json +364 -0
  271. package/templates/retail-store/recipes/blog-see-all.json +50 -0
  272. package/templates/retail-store/recipes/events-inline-list.json +203 -0
  273. package/templates/retail-store/recipes/events-inline.json +284 -0
  274. package/templates/retail-store/recipes/members-list.json +445 -0
  275. package/templates/retail-store/recipes/plans-card.json +811 -0
  276. package/templates/retail-store/recipes/programs-card.json +254 -0
  277. package/templates/retail-store/recipes/programs-carousel.json +234 -0
  278. package/templates/retail-store/recipes/section-error.json +58 -0
  279. package/templates/retail-store/tier5-src/_shared/blog-list.ts +207 -0
  280. package/templates/retail-store/tier5-src/_shared/event-registration.ts +86 -0
  281. package/templates/retail-store/tier5-src/_shared/events-card.ts +33 -0
  282. package/templates/retail-store/tier5-src/_shared/events-inline-options.ts +25 -0
  283. package/templates/retail-store/tier5-src/_shared/events-inline.ts +82 -0
  284. package/templates/retail-store/tier5-src/_shared/member-activity.ts +34 -0
  285. package/templates/retail-store/tier5-src/_shared/member-row-extras.ts +167 -0
  286. package/templates/retail-store/tier5-src/_shared/members-directory-view.ts +39 -0
  287. package/templates/retail-store/tier5-src/_shared/members-directory.ts +267 -0
  288. package/templates/retail-store/tier5-src/_shared/plan-facts.ts +87 -0
  289. package/templates/retail-store/tier5-src/_shared/plans-section.ts +106 -0
  290. package/templates/retail-store/tier5-src/_shared/programs-section.ts +728 -0
  291. package/templates/retail-store/tier5-src/_shared/relative-time.ts +21 -0
  292. package/templates/retail-store/tier5-src/wix-spaces-app-language/index.ts +18 -3
  293. package/templates/yoga-studio/l10n/en.json +24 -0
  294. package/templates/yoga-studio/l10n/fr.json +4595 -0
  295. package/templates/yoga-studio/l10n/he.json +132 -0
  296. package/templates/yoga-studio/recipes/blog-list-thumb-start.json +364 -0
  297. package/templates/yoga-studio/recipes/blog-list.json +364 -0
  298. package/templates/yoga-studio/recipes/blog-see-all.json +50 -0
  299. package/templates/yoga-studio/recipes/events-inline-list.json +203 -0
  300. package/templates/yoga-studio/recipes/events-inline.json +284 -0
  301. package/templates/yoga-studio/recipes/members-list.json +445 -0
  302. package/templates/yoga-studio/recipes/plans-card.json +811 -0
  303. package/templates/yoga-studio/recipes/programs-card.json +254 -0
  304. package/templates/yoga-studio/recipes/programs-carousel.json +234 -0
  305. package/templates/yoga-studio/recipes/section-error.json +58 -0
  306. package/templates/yoga-studio/tier5-src/_shared/blog-list.ts +207 -0
  307. package/templates/yoga-studio/tier5-src/_shared/events-card.ts +33 -0
  308. package/templates/yoga-studio/tier5-src/_shared/events-inline-options.ts +25 -0
  309. package/templates/yoga-studio/tier5-src/_shared/events-inline.ts +82 -0
  310. package/templates/yoga-studio/tier5-src/_shared/member-activity.ts +34 -0
  311. package/templates/yoga-studio/tier5-src/_shared/member-row-extras.ts +167 -0
  312. package/templates/yoga-studio/tier5-src/_shared/members-directory-view.ts +39 -0
  313. package/templates/yoga-studio/tier5-src/_shared/members-directory.ts +267 -0
  314. package/templates/yoga-studio/tier5-src/_shared/plan-facts.ts +87 -0
  315. package/templates/yoga-studio/tier5-src/_shared/plans-section.ts +106 -0
  316. package/templates/yoga-studio/tier5-src/_shared/programs-section.ts +728 -0
  317. package/templates/yoga-studio/tier5-src/_shared/relative-time.ts +21 -0
  318. package/templates/yoga-studio/tier5-src/wix-spaces-app-language/index.ts +18 -3
@@ -0,0 +1,267 @@
1
+ // Public site-member directory as a registrable service. Search, sorting, totals and offset paging match OneApp's
2
+ // Members v1 query; no owner roster or build-time count is substituted. The One App row's extras are opt-in and each
3
+ // is read defensively: the role line ("Member · Active 11h ago" / "Last seen Nov 6, 2025"), the member's badges as
4
+ // colored chips with a "+N" overflow, and a Follow control. A fact the site does not return is hidden, never invented.
5
+ import { defineService } from "@himalaya/state";
6
+ import { queryMembers, getMyFollowing, followMember, unfollowMember, type WixMember } from "@himalaya/wix-members";
7
+ import { query as queryBadges, type WixBadge } from "@himalaya/wix-badges";
8
+ import { wixMediaUrl, type WixImageSize } from "@himalaya/wix-media";
9
+ import { createCollectionQuery } from "./collection-query.js";
10
+ import { readAccess, assertReadAccess, readAccessDenied, type ReadAccess } from "./member-read.js";
11
+ import { memberAccessChanged } from "./member-access.js";
12
+ // The paged badge-assignments read (POST /badges/v4/assignments/query; the generated listMembersBadgeIds route answers 404 live).
13
+ import { badgesByMember } from "./member-row-extras.js";
14
+ import { withEmptyFlags } from "./empty-flags.js";
15
+ import { stashCopy, copyParam, copyTemplate, copyPlural } from "./himi-copy.js";
16
+ import { activityLine, badgeToken } from "./members-directory-view.js";
17
+
18
+ export interface MembersDirectoryOptions {
19
+ /** "Member" under the name. */
20
+ showRole?: boolean;
21
+ /** "Active 11h ago" / "Last seen <date>", from the member's last login. */
22
+ showActivity?: boolean;
23
+ /** The member's badges as colored chips (the first three and a "+N"). */
24
+ showBadges?: boolean;
25
+ /** A Follow control on each row. */
26
+ showFollow?: boolean;
27
+ /** A letter heading above each initial's group. Default on. */
28
+ letterBands?: boolean;
29
+ }
30
+
31
+ /** A 40pt row avatar, at 3x: a Wix media reference becomes a fetchable, avatar-sized URL. */
32
+ const AVATAR_IMAGE: WixImageSize = { width: 120, height: 120, quality: 85 };
33
+ /** One chip and a "+N" for the rest, as the original shows: three chips in the name column collapsed the third into a tall thin bar on a device. */
34
+ const BADGE_SLOTS = 1;
35
+ const BADGE_PAGE = 100;
36
+ /** How many catalog pages are read before the catalog is refused as too long. */
37
+ const BADGE_PAGES = 5;
38
+ interface Chip { id: string; label: string; token: string }
39
+ interface Row {
40
+ id: string; name: string; subtitle: string; initial: string; photo: string; sectionTitle: string;
41
+ role: string; hasRole: boolean; activity: string; hasActivity: boolean; roleLine: string; hasRoleLine: boolean; noRoleLine: boolean;
42
+ badges: Chip[]; hasBadges: boolean; noBadges: boolean; badgeOverflow: string; hasOverflow: boolean; noOverflow: boolean;
43
+ badge1Label: string; badge1Token: string; hasBadge1: boolean; noBadge1: boolean;
44
+ canFollow: boolean; noFollow: boolean; isFollowing: boolean; followLabel: string;
45
+ }
46
+ interface S {
47
+ status: "loading" | "ready" | "error";
48
+ members: Row[]; emptyText: string;
49
+ query: string; total: number | null; searchLabel: string; searchPlaceholder: string;
50
+ nextCursor: string; noMore: boolean; noPageError: boolean;
51
+ error: string; notErrored: boolean; notLoading: boolean; hideSearch: boolean;
52
+ actionMessage: string;
53
+ }
54
+ const PAGE_SIZE = 50;
55
+ const SEARCH_FIELDS = ["contact.firstName", "contact.lastName", "profile.nickname"];
56
+
57
+ function name(m: WixMember): string {
58
+ const nick = m.profile?.nickname?.trim();
59
+ if (nick) return nick;
60
+ const full = [m.contact?.firstName, m.contact?.lastName].filter(Boolean).join(" ").trim();
61
+ return full || "Member";
62
+ }
63
+
64
+ /** What the page's extra reads found: unknown stays absent. */
65
+ interface Extras { badges: Map<string, Chip[]>; following: Set<string> | undefined }
66
+
67
+ export function registerMembersDirectory(serviceName: string, options: MembersDirectoryOptions = {}) {
68
+ const letterBands = options.letterBands !== false;
69
+ let directoryAccess: ReadAccess | undefined;
70
+ // Set once the reader has typed a search: from then on the field stays mounted, even while a cleared search
71
+ // reloads the full directory (no rows, no query yet), so it never unmounts and loses focus mid-edit.
72
+ let searched = false;
73
+ let badgeCatalog: Map<string, Chip> | undefined;
74
+ // Follow state the reader has changed here, by member id.
75
+ const followed = new Map<string, boolean>();
76
+ let notice = "";
77
+ let signedIn = false;
78
+
79
+ async function badgeDefinitions(): Promise<Map<string, Chip>> {
80
+ if (badgeCatalog) return badgeCatalog;
81
+ // A cursor request carries the cursor alone (the service refuses one that repeats the limit). A catalog longer than the pages read is
82
+ // refused whole: a partial one would drop chips from members who hold the badges past it, with no sign.
83
+ const badges: WixBadge[] = [];
84
+ let cursor: string | undefined;
85
+ for (let page = 0; page < BADGE_PAGES; page++) {
86
+ const response = await queryBadges({ query: { cursorPaging: cursor ? { cursor } : { limit: BADGE_PAGE } } });
87
+ badges.push(...(response.badges ?? []));
88
+ // hasNext with no next cursor is an incomplete answer, not the end: refuse it rather than accept a partial catalog.
89
+ if (response.pagingMetadata?.hasNext && !response.pagingMetadata.cursors?.next) throw new Error("Badge catalog page is incomplete (hasNext without a cursor)");
90
+ cursor = response.pagingMetadata?.hasNext ? response.pagingMetadata.cursors?.next : undefined;
91
+ if (!cursor) break;
92
+ }
93
+ if (cursor) throw new Error("Badge catalog is longer than the pages read");
94
+ badgeCatalog = new Map(badges.filter((b: WixBadge) => b.id && b.title).map((b: WixBadge) => [b.id as string, { id: b.id as string, label: b.title as string, token: badgeToken(b.backgroundColor) }]));
95
+ return badgeCatalog;
96
+ }
97
+
98
+ async function extrasFor(members: WixMember[], member: boolean): Promise<Extras> {
99
+ const ids = members.map((m) => m.id);
100
+ const badges = new Map<string, Chip[]>();
101
+ const [badgeRead, followRead] = await Promise.allSettled([
102
+ options.showBadges ? Promise.all([badgeDefinitions(), badgesByMember(ids)]) : Promise.resolve(undefined),
103
+ options.showFollow && member ? getMyFollowing(ids) : Promise.resolve(undefined),
104
+ ]);
105
+ // A badge or follow read that fails leaves its chips off the rows; the list itself still loads.
106
+ if (badgeRead.status === "rejected") console.warn("members_directory: the badges could not be read", badgeRead.reason);
107
+ if (followRead.status === "rejected") console.warn("members_directory: the follow state could not be read", followRead.reason);
108
+ if (badgeRead.status === "fulfilled" && badgeRead.value) {
109
+ const [catalog, held] = badgeRead.value;
110
+ for (const [memberId, badgeIds] of held) {
111
+ const chips = badgeIds.flatMap((id) => catalog.get(id) ?? []);
112
+ if (chips.length) badges.set(memberId, chips);
113
+ }
114
+ }
115
+ return { badges, following: followRead.status === "fulfilled" ? followRead.value : undefined };
116
+ }
117
+
118
+ function row(m: WixMember, extras: Extras, now: number): Row {
119
+ const n = name(m);
120
+ const role = options.showRole ? copyParam("members.roleMember", "Member") : "";
121
+ const activity = options.showActivity ? activityLine(m.lastLoginDate, now) : "";
122
+ const roleLine = [role, activity].filter(Boolean).join(" · ");
123
+ const chips = extras.badges.get(m.id) ?? [];
124
+ const shown = chips.slice(0, BADGE_SLOTS);
125
+ const overflow = chips.length > BADGE_SLOTS ? `+${chips.length - BADGE_SLOTS}` : "";
126
+ const slot = (i: number) => ({ label: shown[i]?.label ?? "", token: shown[i]?.token ?? "textSecondary", has: !!shown[i] });
127
+ const b1 = slot(0);
128
+ const isFollowing = followed.get(m.id) ?? extras.following?.has(m.id) ?? false;
129
+ // Login emails are not directory subtitles. Only public profile content is presented.
130
+ return {
131
+ id: m.id, name: n, subtitle: "", initial: (n[0] || "#").toUpperCase(), photo: wixMediaUrl(m.profile?.photo?.url, AVATAR_IMAGE) || wixMediaUrl(m.profile?.photo?.id, AVATAR_IMAGE) || "", sectionTitle: "",
132
+ role, hasRole: !!role, activity, hasActivity: !!activity, roleLine, hasRoleLine: !!roleLine, noRoleLine: !roleLine,
133
+ badges: chips, hasBadges: chips.length > 0, noBadges: chips.length === 0, badgeOverflow: overflow, hasOverflow: !!overflow, noOverflow: !overflow,
134
+ badge1Label: b1.label, badge1Token: b1.token, hasBadge1: b1.has, noBadge1: !b1.has,
135
+ canFollow: !!options.showFollow, noFollow: !options.showFollow, isFollowing,
136
+ followLabel: options.showFollow ? isFollowing ? copyParam("members.following", "Following") : copyParam("members.follow", "Follow") : "",
137
+ };
138
+ }
139
+
140
+ /** A row with the reader's own follow change applied: it wins over a page read that raced the write. */
141
+ const withFollow = (item: Row): Row => {
142
+ const isFollowing = followed.get(item.id);
143
+ if (isFollowing === undefined || !item.canFollow) return item;
144
+ return { ...item, isFollowing, followLabel: isFollowing ? copyParam("members.following", "Following") : copyParam("members.follow", "Follow") };
145
+ };
146
+
147
+ function sections(rows: Row[]): Row[] {
148
+ if (!letterBands) return rows;
149
+ const groups = new Map<string, Row[]>();
150
+ for (const item of rows) {
151
+ const group = groups.get(item.initial) ?? [];
152
+ group.push(item); groups.set(item.initial, group);
153
+ }
154
+ return [...groups.keys()].sort().flatMap(letter => groups.get(letter)!.map((item, index) => ({ ...item, sectionTitle: index ? "" : letter })));
155
+ }
156
+
157
+ const directory = createCollectionQuery<Row>({
158
+ id: item => item.id,
159
+ clearOnError: readAccessDenied,
160
+ errorMessage: (error) => {
161
+ console.warn("members_directory: the members could not be read", error);
162
+ return copyParam("members.loadError", "Members couldn't be loaded.");
163
+ },
164
+ async fetch(criteria, cursor) {
165
+ const offset = cursor ? Number(cursor) : 0;
166
+ if (!Number.isSafeInteger(offset) || offset < 0) throw new Error("Invalid member page offset");
167
+ const access = cursor ? directoryAccess : await readAccess();
168
+ if (!access) throw memberAccessChanged();
169
+ // A first-page read replaces the reader's own follow taps with what the server says: they must not outlive the session or the reader.
170
+ if (!cursor) { directoryAccess = access; followed.clear(); }
171
+ await assertReadAccess(access);
172
+ const response = await queryMembers({ query: {
173
+ filter: { status: "APPROVED", privacyStatus: "PUBLIC" },
174
+ sorting: [{ fieldName: "profile.nickname", order: "ASC" }],
175
+ paging: { limit: PAGE_SIZE, offset },
176
+ }, ...(criteria.query ? { search: { expression: criteria.query, fields: SEARCH_FIELDS } } : {}) });
177
+ await assertReadAccess(access);
178
+ if (access !== directoryAccess) throw memberAccessChanged();
179
+ if (!Array.isArray(response.members) || response.members.some(member => !member?.id)) throw new Error("Invalid member page");
180
+ const metadata = response.metadata;
181
+ if (metadata?.offset !== undefined && metadata.offset !== offset) throw new Error("Mismatched member page offset");
182
+ const total = !metadata?.tooManyToCount && typeof metadata?.total === "number" && Number.isSafeInteger(metadata.total) && metadata.total >= 0
183
+ ? metadata.total : undefined;
184
+ const next = offset + response.members.length;
185
+ if (!response.members.length && total !== undefined && total > next) throw new Error("Incomplete member page");
186
+ signedIn = !!access.member.email;
187
+ const extras = await extrasFor(response.members, signedIn);
188
+ const now = Date.now();
189
+ return {
190
+ items: response.members.map(member => row(member, extras, now)), total,
191
+ nextCursor: response.members.length && (total === undefined ? response.members.length === PAGE_SIZE : next < total) ? String(next) : "",
192
+ };
193
+ },
194
+ }, () => { void svc.changed(); });
195
+
196
+ function project(): S {
197
+ const page = directory.getState();
198
+ const loading = page.status === "idle" || page.status === "loading";
199
+ const total = page.total ?? null;
200
+ const failed = page.status === "error";
201
+ return {
202
+ status: failed ? "error" : loading ? "loading" : "ready",
203
+ members: sections(page.items.map(withFollow)), query: page.criteria.query, total,
204
+ searchLabel: total === null ? "" : copyPlural("members.countLabel", "{n, plural, one {# member} other {# members}}", total),
205
+ searchPlaceholder: total === null ? "" : copyTemplate("members.searchWithCount", "Search {count} members", { count: total }),
206
+ emptyText: page.status === "ready" && !page.items.length ? page.criteria.query ? copyParam("members.emptyNoResults", "No results") : copyParam("members.emptyTitle", "No members yet") : "",
207
+ nextCursor: loading || page.loadingMore || page.pageError ? "" : page.nextCursor,
208
+ noMore: !page.nextCursor || loading || page.loadingMore || page.pageError,
209
+ noPageError: !page.pageError,
210
+ error: page.error, notErrored: !failed,
211
+ // The skeleton stands in for rows that are not there yet; a typed search keeps the previous rows on screen
212
+ // while its response is in flight, so it must not paint skeletons above them.
213
+ notLoading: !(loading && !page.items.length),
214
+ // A successful empty SEARCH keeps its field reachable (to clear the query); a directory that is
215
+ // loading or truly empty (no query, no rows) has nothing to search.
216
+ hideSearch: failed || (!page.items.length && !page.criteria.query && !searched),
217
+ actionMessage: notice,
218
+ };
219
+ }
220
+
221
+ const pendingFollows = new Set<string>();
222
+ const svc = defineService<S, {
223
+ load: (s: S, arg?: unknown) => Promise<undefined>;
224
+ filter: (s: S, arg?: unknown) => Promise<undefined>;
225
+ loadMore: (s: S) => Promise<undefined>;
226
+ retry: (s: S) => Promise<undefined>;
227
+ follow: (s: S, arg?: unknown) => Promise<S>;
228
+ changed: (s: S) => S;
229
+ }>(serviceName, withEmptyFlags({
230
+ state: { status: "loading", members: [], emptyText: "", query: "", total: null, searchLabel: "", searchPlaceholder: "", nextCursor: "", noMore: true, noPageError: true,
231
+ error: "", notErrored: true, notLoading: false, hideSearch: true, actionMessage: "" },
232
+ // A restored worker must re-read the current reader/site before showing a roster.
233
+ notHydrated: ["status", "members", "emptyText", "query", "total", "searchLabel", "searchPlaceholder", "nextCursor", "noMore", "noPageError", "error", "notErrored", "notLoading", "hideSearch", "actionMessage"],
234
+ actions: {
235
+ // The screen's onAppear fires on every re-appear (back from a profile): a directory that already loaded keeps its pages and scroll
236
+ // position. Only an empty or failed one reads; retry always does.
237
+ load: async (_s, arg) => { stashCopy(arg); const loaded = directory.getState(); if (loaded.status !== "ready" || !loaded.items.length) await directory.query(loaded.criteria); return undefined; },
238
+ filter: async (_s, arg) => {
239
+ const value = typeof arg === "string" ? arg : (arg as { value?: unknown })?.value;
240
+ if (typeof value === "string" && value.trim()) searched = true;
241
+ await directory.query({ query: typeof value === "string" ? value : "" }); return undefined;
242
+ },
243
+ loadMore: async () => { await directory.loadMore(); return undefined; },
244
+ retry: async () => { await directory.retry(); return undefined; },
245
+ // The row's Follow / Following toggle. A visitor is asked to sign in; the write is confirmed before the label flips.
246
+ follow: async (_s, arg) => {
247
+ const id = (arg as { id?: unknown } | undefined)?.id;
248
+ if (typeof id !== "string" || !id || !options.showFollow || pendingFollows.has(id)) return project();
249
+ if (!signedIn) { notice = copyParam("members.followSignIn", "Sign in to follow members."); return project(); }
250
+ const current = directory.getState().items.find((item) => item.id === id);
251
+ const following = followed.get(id) ?? current?.isFollowing ?? false;
252
+ pendingFollows.add(id);
253
+ try {
254
+ if (following) await unfollowMember(id); else await followMember(id);
255
+ followed.set(id, !following);
256
+ notice = "";
257
+ } catch {
258
+ notice = copyParam("members.followFailed", "Couldn't update. Try again.");
259
+ } finally { pendingFollows.delete(id); }
260
+ return project();
261
+ },
262
+ changed: () => project(),
263
+ },
264
+ }, { members: "noMembers" }));
265
+ // No load at registration: the page's onAppear loads (with the copy pack), so a page-hosted service reads only when its section appears.
266
+ return svc;
267
+ }
@@ -0,0 +1,87 @@
1
+ // What a pricing plan says about itself, in the viewer's language: the price cadence / validity line and the
2
+ // plan-detail facts (terms, cancellation, purchase limit, start date). Shared by every worker that shows a plan
3
+ // (the plans list and detail, the inline plans section) so one plan reads the same everywhere.
4
+ //
5
+ // Each duration phrase is ONE plural key per unit, so a translation fits the whole phrase ("por 10 años") instead of
6
+ // gluing translated words around English ones. Its English fallback is the wording the workers always had.
7
+ import type { WixPlan } from "@himalaya/wix-pricing-plans";
8
+ import { copyParam, copyPlural, copyTemplate } from "./himi-copy.js";
9
+
10
+ type PlanUnit = "day" | "week" | "month" | "year";
11
+ const UNITS: readonly PlanUnit[] = ["day", "week", "month", "year"];
12
+ const unitKey = (unit: PlanUnit) => unit[0]!.toUpperCase() + unit.slice(1);
13
+
14
+ // The English wording per unit, as LITERALS: a pinned-language build finds a worker's translatable text by looking for the
15
+ // catalog's English source as a string literal in the bundle, which a pattern assembled from the unit would never be.
16
+ const VALID_FOR: Record<PlanUnit, string> = {
17
+ day: "{n, plural, one {for # day} other {for # days}}",
18
+ week: "{n, plural, one {for # week} other {for # weeks}}",
19
+ month: "{n, plural, one {for # month} other {for # months}}",
20
+ year: "{n, plural, one {for # year} other {for # years}}",
21
+ };
22
+ const EVERY: Record<PlanUnit, string> = {
23
+ day: "{n, plural, one {per day} other {every # days}}",
24
+ week: "{n, plural, one {per week} other {every # weeks}}",
25
+ month: "{n, plural, one {per month} other {every # months}}",
26
+ year: "{n, plural, one {per year} other {every # years}}",
27
+ };
28
+
29
+ /** Wix durations name their unit "DAY" / "WEEKS" …: the singular lower-case noun. */
30
+ function singularUnit(unit?: string): string {
31
+ return (unit || "").toLowerCase().replace(/s$/, "");
32
+ }
33
+
34
+ /** "for 10 years" — a one-time plan valid for a fixed duration. */
35
+ function validFor(count: number, unit: string): string {
36
+ const known = UNITS.find((candidate) => candidate === unit);
37
+ if (!known) return `for ${count} ${unit}${count === 1 ? "" : "s"}`;
38
+ return copyPlural(`plans.validFor${unitKey(known)}`, VALID_FOR[known], count);
39
+ }
40
+
41
+ /** "per month" / "every 3 months" — a subscription's billing cycle. */
42
+ export function every(count: number, unit: string): string {
43
+ const known = UNITS.find((candidate) => candidate === unit);
44
+ if (!known) return count === 1 ? `per ${unit}` : `every ${count} ${unit}s`;
45
+ return copyPlural(`plans.every${unitKey(known)}`, EVERY[known], count);
46
+ }
47
+
48
+ /** The cadence or validity line under a price; "" when the plan names none. */
49
+ export function planPeriodLine(plan: WixPlan): string {
50
+ const pricing = plan.pricing;
51
+ if (pricing?.subscription?.cycleDuration) {
52
+ const count = pricing.subscription.cycleDuration.count ?? 0;
53
+ const unit = singularUnit(pricing.subscription.cycleDuration.unit);
54
+ return count && unit ? every(count, unit) : copyParam("plans.periodRecurring", "recurring");
55
+ }
56
+ if (pricing?.singlePaymentForDuration) {
57
+ const count = pricing.singlePaymentForDuration.count ?? 0;
58
+ const unit = singularUnit(pricing.singlePaymentForDuration.unit);
59
+ return count && unit ? validFor(count, unit) : copyParam("plans.oneTimeFact", "one-time");
60
+ }
61
+ if (pricing?.singlePaymentUnlimited) return copyParam("plans.oneTimeFact", "one-time");
62
+ return "";
63
+ }
64
+
65
+ export interface PlanFacts {
66
+ /** The owner's terms and conditions; collapses when the plan has none. */
67
+ terms: string; noTerms: boolean;
68
+ cancelLine: string; noCancelLine: boolean;
69
+ limitLine: string; noLimitLine: boolean;
70
+ startLine: string; noStartLine: boolean;
71
+ }
72
+
73
+ /** The plan-detail facts beyond name, price, pitch and benefits; every line is "" (and its `no…` flag true) when the plan
74
+ * does not state it. */
75
+ export function planFacts(plan: WixPlan): PlanFacts {
76
+ const terms = (plan.termsAndConditions ?? "").trim();
77
+ const cancelLine = plan.buyerCanCancel === true ? copyParam("plans.buyerCanCancel", "You can cancel this plan yourself.") : "";
78
+ const limit = plan.maxPurchasesPerBuyer ?? 0;
79
+ const limitLine = limit > 0 ? copyTemplate("plans.limitPerBuyer", "Limit: {n} per member.", { n: limit }) : "";
80
+ const startLine = plan.allowFutureStartDate === true ? copyParam("plans.futureStartDate", "You can choose a later start date.") : "";
81
+ return {
82
+ terms, noTerms: !terms,
83
+ cancelLine, noCancelLine: !cancelLine,
84
+ limitLine, noLimitLine: !limitLine,
85
+ startLine, noStartLine: !startLine,
86
+ };
87
+ }
@@ -0,0 +1,106 @@
1
+ // The INLINE plans section: the site's pricing plans as cards (name, pitch, price, validity, the whole benefits list), hosted by
2
+ // any worker that wants them next to other sections. It is data only and read-only: a card opens the plan's own screen
3
+ // (`himi_plan`), which is where joining and paying live. The `plans-card` recipe is the card that reads it,
4
+ // bound as `$service:<serviceName>.*`.
5
+ import { defineService } from "@himalaya/state";
6
+ import { listPublicPlans, type WixPlan } from "@himalaya/wix-pricing-plans";
7
+ import { descriptionBody } from "./rich-body.js";
8
+ import { formatCurrency } from "./engine-intl.js";
9
+ import { copyParam, stashCopy } from "./himi-copy.js";
10
+ import { planPeriodLine } from "./plan-facts.js";
11
+
12
+ /** The recipe binds `perk1…perkN`, so the list has a fixed ceiling. */
13
+ export const PLANS_SECTION_MAX_PERKS = 12;
14
+
15
+ export interface PlansSectionOptions {
16
+ /** The plans the source section selected, in its order. Absent or empty: every published plan. */
17
+ planIds?: readonly string[];
18
+ /** The source's "show benefits list" switch; the list is shown unless it is off. */
19
+ showBenefits?: boolean;
20
+ }
21
+
22
+ export interface PlansSectionRow {
23
+ id: string;
24
+ name: string;
25
+ description: string; noDescription: boolean;
26
+ priceLine: string; noPrice: boolean;
27
+ periodLine: string; noPeriod: boolean;
28
+ badge: string; noBadge: boolean;
29
+ perks: string[];
30
+ [perk: `perk${number}`]: string;
31
+ [flag: `noPerk${number}`]: boolean;
32
+ }
33
+
34
+ export interface PlansSectionState {
35
+ status: "loading" | "ready" | "error";
36
+ rows: PlansSectionRow[];
37
+ isLoading: boolean; notLoading: boolean;
38
+ isErrored: boolean; notErrored: boolean;
39
+ hasRows: boolean; noRows: boolean;
40
+ }
41
+
42
+ function money(plan: WixPlan): string {
43
+ const price = plan.pricing?.price;
44
+ const raw = price?.value;
45
+ if (raw == null || raw === "" || Number.isNaN(Number(raw))) return "";
46
+ try { return formatCurrency(Number(raw), price?.currency || "USD"); } catch { return `${raw}`; }
47
+ }
48
+
49
+ export function plansSectionRow(plan: WixPlan, showBenefits = true): PlansSectionRow {
50
+ const perks = showBenefits
51
+ ? (plan.perks?.values ?? []).map((perk) => (perk ?? "").trim()).filter(Boolean).slice(0, PLANS_SECTION_MAX_PERKS)
52
+ : [];
53
+ const description = descriptionBody(plan.description).bodyText;
54
+ const priceLine = money(plan);
55
+ const periodLine = planPeriodLine(plan);
56
+ const badge = plan.primary ? copyParam("plans.popularBadge", "Popular") : "";
57
+ return {
58
+ id: plan.id || "", name: (plan.name || copyParam("plans.planFallbackName", "Plan")).trim(),
59
+ description, noDescription: !description, priceLine, noPrice: !priceLine, periodLine, noPeriod: !periodLine, badge, noBadge: !badge, perks,
60
+ ...planPerkFields(perks),
61
+ };
62
+ }
63
+
64
+ /** The flat `perk1…perkN` / `noPerk1…noPerkN` fields a card binds, from a plan's benefit lines. */
65
+ export function planPerkFields(perks: readonly string[]): { [perk: `perk${number}`]: string; [flag: `noPerk${number}`]: boolean } {
66
+ const fields: { [key: string]: string | boolean } = {};
67
+ for (let i = 1; i <= PLANS_SECTION_MAX_PERKS; i++) { fields[`perk${i}`] = perks[i - 1] ?? ""; fields[`noPerk${i}`] = !perks[i - 1]; }
68
+ return fields as ReturnType<typeof planPerkFields>;
69
+ }
70
+
71
+ function derive(status: PlansSectionState["status"], rows: PlansSectionRow[]): PlansSectionState {
72
+ return {
73
+ status, rows,
74
+ isLoading: status === "loading", notLoading: status !== "loading",
75
+ isErrored: status === "error", notErrored: status !== "error",
76
+ hasRows: rows.length > 0, noRows: rows.length === 0,
77
+ };
78
+ }
79
+
80
+ /** The selected plans in the source's order; every published plan when none is selected. Archived plans never show. */
81
+ export function selectPlans(plans: readonly WixPlan[], planIds: readonly string[] = []): WixPlan[] {
82
+ const live = plans.filter((plan) => !plan.archived && !!plan.id);
83
+ if (!planIds.length) return live;
84
+ const rank = new Map(planIds.map((id, index) => [id, index]));
85
+ return live.filter((plan) => rank.has(plan.id)).sort((a, b) => (rank.get(a.id) ?? 0) - (rank.get(b.id) ?? 0));
86
+ }
87
+
88
+ export function registerPlansSection(serviceName: string, options: PlansSectionOptions = {}) {
89
+ const showBenefits = options.showBenefits !== false;
90
+ const planIds = (options.planIds ?? []).filter((id) => typeof id === "string" && id);
91
+ return defineService<PlansSectionState, { load: (state: PlansSectionState, arg?: unknown) => Promise<PlansSectionState> }>(serviceName, {
92
+ state: derive("loading", []),
93
+ actions: {
94
+ load: async (_state, arg) => {
95
+ stashCopy(arg);
96
+ try {
97
+ const response = await listPublicPlans();
98
+ return derive("ready", selectPlans(response.plans ?? [], planIds).map((plan) => plansSectionRow(plan, showBenefits)));
99
+ } catch (error) {
100
+ console.warn("plans_section: the plans could not be read", error);
101
+ return derive("error", []);
102
+ }
103
+ },
104
+ },
105
+ });
106
+ }