@wix/himalaya-cli 0.1761.0 → 0.1763.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 (741) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +5 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +10 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-shell.d.ts +23 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +136 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +112 -0
  6. package/dist/browser-plane/assets.json +5 -5
  7. package/dist/browser-plane/preview-deferred/{7c3c05d452efd3f1e1e81b47dde7d9fa870c1e5217b00b253661a22b571fdbef.bin → a96903bb457796ee606fe986078d9629ba53b5ba4013bdb94e8afba3288284ed.bin} +1 -1
  8. package/dist/browser-plane/sw.js +7 -7
  9. package/dist/cli.mjs +51413 -50002
  10. package/dist/preview-assets.generated.bin +0 -0
  11. package/guides/base44-app-to-himi-app.md +56 -0
  12. package/guides/component-reference.json +1 -1
  13. package/guides/component-reference.md +10 -0
  14. package/guides/himi-json-output.md +35 -0
  15. package/guides/one-app-section-mappings.md +6 -6
  16. package/guides/one-app-to-himi-app.md +33 -4
  17. package/guides/push-cli-onboarding.md +25 -14
  18. package/guides/recipe-dynamic-list.md +4 -2
  19. package/guides/wix-business-context.md +1 -1
  20. package/package.json +2 -2
  21. package/templates/beauty-salon/l10n/ar.json +9 -420
  22. package/templates/beauty-salon/l10n/cs.json +9 -420
  23. package/templates/beauty-salon/l10n/da.json +9 -420
  24. package/templates/beauty-salon/l10n/de.json +9 -420
  25. package/templates/beauty-salon/l10n/el.json +9 -420
  26. package/templates/beauty-salon/l10n/en.json +8 -61
  27. package/templates/beauty-salon/l10n/es.json +9 -420
  28. package/templates/beauty-salon/l10n/fi.json +9 -420
  29. package/templates/beauty-salon/l10n/fr.json +9 -420
  30. package/templates/beauty-salon/l10n/he.json +9 -338
  31. package/templates/beauty-salon/l10n/hu.json +9 -420
  32. package/templates/beauty-salon/l10n/id.json +9 -420
  33. package/templates/beauty-salon/l10n/it.json +9 -420
  34. package/templates/beauty-salon/l10n/ja.json +9 -420
  35. package/templates/beauty-salon/l10n/ko.json +9 -420
  36. package/templates/beauty-salon/l10n/lt.json +9 -420
  37. package/templates/beauty-salon/l10n/nl.json +9 -420
  38. package/templates/beauty-salon/l10n/no.json +9 -420
  39. package/templates/beauty-salon/l10n/pl.json +9 -420
  40. package/templates/beauty-salon/l10n/pt.json +9 -420
  41. package/templates/beauty-salon/l10n/ru.json +9 -420
  42. package/templates/beauty-salon/l10n/sv.json +9 -420
  43. package/templates/beauty-salon/l10n/th.json +9 -420
  44. package/templates/beauty-salon/l10n/tr.json +9 -420
  45. package/templates/beauty-salon/l10n/uk.json +9 -420
  46. package/templates/beauty-salon/l10n/vi.json +9 -420
  47. package/templates/beauty-salon/l10n/zh.json +9 -420
  48. package/templates/branded-lite/l10n/ar.json +31 -5
  49. package/templates/branded-lite/l10n/cs.json +31 -5
  50. package/templates/branded-lite/l10n/da.json +31 -5
  51. package/templates/branded-lite/l10n/de.json +31 -5
  52. package/templates/branded-lite/l10n/el.json +31 -5
  53. package/templates/branded-lite/l10n/en.json +8 -6
  54. package/templates/branded-lite/l10n/es.json +31 -5
  55. package/templates/branded-lite/l10n/fi.json +31 -5
  56. package/templates/branded-lite/l10n/fr.json +31 -5
  57. package/templates/branded-lite/l10n/he.json +27 -4
  58. package/templates/branded-lite/l10n/hu.json +31 -5
  59. package/templates/branded-lite/l10n/id.json +31 -5
  60. package/templates/branded-lite/l10n/it.json +31 -5
  61. package/templates/branded-lite/l10n/ja.json +31 -5
  62. package/templates/branded-lite/l10n/ko.json +31 -5
  63. package/templates/branded-lite/l10n/lt.json +31 -5
  64. package/templates/branded-lite/l10n/nl.json +31 -5
  65. package/templates/branded-lite/l10n/no.json +31 -5
  66. package/templates/branded-lite/l10n/pl.json +31 -5
  67. package/templates/branded-lite/l10n/pt.json +31 -5
  68. package/templates/branded-lite/l10n/ru.json +31 -5
  69. package/templates/branded-lite/l10n/sv.json +31 -5
  70. package/templates/branded-lite/l10n/th.json +31 -5
  71. package/templates/branded-lite/l10n/tr.json +31 -5
  72. package/templates/branded-lite/l10n/uk.json +31 -5
  73. package/templates/branded-lite/l10n/vi.json +31 -5
  74. package/templates/branded-lite/l10n/zh.json +31 -5
  75. package/templates/branded-lite/recipes/blog-search.json +45 -0
  76. package/templates/{events-meetups/recipes/programs-participant-carousel.json → branded-lite/recipes/galleries-carousel.json} +39 -118
  77. package/templates/{gym-fitness/recipes/programs-participant-carousel.json → branded-lite/recipes/galleries-list.json} +43 -121
  78. package/templates/{community-club/recipes/events-inline-list.json → branded-lite/recipes/group-feed.json} +112 -89
  79. package/templates/{beauty-salon/recipes/programs-participant-carousel.json → branded-lite/recipes/groups-cards.json} +71 -93
  80. package/templates/{beauty-salon/recipes/groups-list.json → branded-lite/recipes/services-list.json} +33 -9
  81. package/templates/{community-club/recipes/groups-list.json → branded-lite/recipes/subscriptions-list.json} +124 -60
  82. package/templates/branded-lite/recipes/upcoming-bookings.json +350 -0
  83. package/templates/branded-lite/recipes/videos-carousel.json +248 -0
  84. package/templates/branded-lite/tier5-src/_shared/blog-list.ts +75 -21
  85. package/templates/branded-lite/tier5-src/_shared/galleries-section.ts +115 -0
  86. package/templates/branded-lite/tier5-src/_shared/group-feed-section.ts +137 -0
  87. package/templates/branded-lite/tier5-src/_shared/groups-section.ts +7 -3
  88. package/templates/branded-lite/tier5-src/_shared/my-subscriptions-section.ts +107 -0
  89. package/templates/branded-lite/tier5-src/_shared/plans-section.ts +11 -3
  90. package/templates/branded-lite/tier5-src/_shared/programs-section.ts +2 -0
  91. package/templates/branded-lite/tier5-src/_shared/services-section.ts +122 -0
  92. package/templates/branded-lite/tier5-src/_shared/upcoming-bookings-section.ts +102 -0
  93. package/templates/branded-lite/tier5-src/_shared/videos-section.ts +91 -0
  94. package/templates/brandy/README.md +21 -3
  95. package/templates/brandy/config.ts +131 -14
  96. package/templates/brandy/dev/index.ts +41 -5
  97. package/templates/brandy/dev/member-screens.ts +14412 -0
  98. package/templates/brandy/provisioning.member.example.json +25 -0
  99. package/templates/brandy/tier5-src/_shared/branded-lite-hosted.ts +280 -0
  100. package/templates/brandy/tier5-src/_shared/branded-load-state.ts +109 -0
  101. package/templates/brandy/tier5-src/_shared/chat-live.ts +242 -0
  102. package/templates/brandy/tier5-src/_shared/collection-contract.ts +228 -0
  103. package/templates/brandy/tier5-src/_shared/collection-query-legacy.ts +194 -0
  104. package/templates/brandy/tier5-src/_shared/collection-query.ts +252 -0
  105. package/templates/brandy/tier5-src/_shared/collection-service.ts +423 -0
  106. package/templates/brandy/tier5-src/_shared/engine-intl.ts +523 -0
  107. package/templates/brandy/tier5-src/_shared/himi-account.ts +194 -0
  108. package/templates/brandy/tier5-src/_shared/himi-store.ts +7 -0
  109. package/templates/brandy/tier5-src/_shared/himi-text.ts +24 -0
  110. package/templates/brandy/tier5-src/_shared/hosted-checkout.ts +70 -0
  111. package/templates/brandy/tier5-src/_shared/iap-worker.ts +127 -0
  112. package/templates/brandy/tier5-src/_shared/inbox-rooms.ts +68 -0
  113. package/templates/brandy/tier5-src/_shared/live-session.ts +172 -0
  114. package/templates/brandy/tier5-src/_shared/local-preferences.ts +38 -0
  115. package/templates/brandy/tier5-src/_shared/member-access.ts +63 -0
  116. package/templates/brandy/tier5-src/_shared/member-account-routes.ts +52 -0
  117. package/templates/brandy/tier5-src/_shared/member-orders.ts +8 -0
  118. package/templates/brandy/tier5-src/_shared/member-read.ts +82 -0
  119. package/templates/brandy/tier5-src/_shared/member-screen.ts +99 -0
  120. package/templates/brandy/tier5-src/_shared/notification-target.ts +141 -0
  121. package/templates/brandy/tier5-src/_shared/online-actions.ts +76 -0
  122. package/templates/brandy/tier5-src/_shared/owner-load-error.ts +348 -0
  123. package/templates/brandy/tier5-src/_shared/payment-setup.ts +6 -0
  124. package/templates/brandy/tier5-src/_shared/pricing-plan-display.ts +64 -0
  125. package/templates/brandy/tier5-src/_shared/rich-body.ts +78 -0
  126. package/templates/brandy/tier5-src/_shared/rich-content-link.ts +34 -0
  127. package/templates/brandy/tier5-src/_shared/sign-in-sheet.ts +18 -0
  128. package/templates/brandy/tier5-src/_shared/store-order-presentation.ts +56 -0
  129. package/templates/brandy/tier5-src/_shared/wix-bi.ts +85 -0
  130. package/templates/brandy/tier5-src/_shared/wix-member-links.ts +114 -0
  131. package/templates/brandy/tier5-src/himi-branded-lite-inbox/index.ts +92 -0
  132. package/templates/brandy/tier5-src/himi-branded-lite-notifications/index.ts +256 -0
  133. package/templates/brandy/tier5-src/himi-branded-lite-order/index.ts +477 -0
  134. package/templates/brandy/tier5-src/himi-branded-lite-orders/index.ts +327 -0
  135. package/templates/brandy/tier5-src/himi-store-account/index.ts +1007 -0
  136. package/templates/brandy/tier5-src/wix-spaces-chat-thread/index.ts +350 -0
  137. package/templates/brandy/tier5-src/wix-spaces-delete-account/index.ts +59 -0
  138. package/templates/brandy/tier5-src/wix-spaces-my-subscriptions/index.ts +89 -0
  139. package/templates/brandy/tier5-src/wix-spaces-subscription-detail/index.ts +139 -0
  140. package/templates/brandy/tokens.json +25 -0
  141. package/templates/community-club/l10n/ar.json +0 -412
  142. package/templates/community-club/l10n/cs.json +0 -412
  143. package/templates/community-club/l10n/da.json +0 -412
  144. package/templates/community-club/l10n/de.json +0 -412
  145. package/templates/community-club/l10n/el.json +0 -412
  146. package/templates/community-club/l10n/en.json +1 -46
  147. package/templates/community-club/l10n/es.json +0 -412
  148. package/templates/community-club/l10n/fi.json +0 -412
  149. package/templates/community-club/l10n/fr.json +0 -412
  150. package/templates/community-club/l10n/he.json +0 -331
  151. package/templates/community-club/l10n/hu.json +0 -412
  152. package/templates/community-club/l10n/id.json +0 -412
  153. package/templates/community-club/l10n/it.json +0 -412
  154. package/templates/community-club/l10n/ja.json +0 -412
  155. package/templates/community-club/l10n/ko.json +0 -412
  156. package/templates/community-club/l10n/lt.json +0 -412
  157. package/templates/community-club/l10n/nl.json +0 -412
  158. package/templates/community-club/l10n/no.json +0 -412
  159. package/templates/community-club/l10n/pl.json +0 -412
  160. package/templates/community-club/l10n/pt.json +0 -412
  161. package/templates/community-club/l10n/ru.json +0 -412
  162. package/templates/community-club/l10n/sv.json +0 -412
  163. package/templates/community-club/l10n/th.json +0 -412
  164. package/templates/community-club/l10n/tr.json +0 -412
  165. package/templates/community-club/l10n/uk.json +0 -412
  166. package/templates/community-club/l10n/vi.json +0 -412
  167. package/templates/community-club/l10n/zh.json +0 -412
  168. package/templates/events-meetups/l10n/ar.json +0 -412
  169. package/templates/events-meetups/l10n/cs.json +0 -412
  170. package/templates/events-meetups/l10n/da.json +0 -412
  171. package/templates/events-meetups/l10n/de.json +0 -412
  172. package/templates/events-meetups/l10n/el.json +0 -412
  173. package/templates/events-meetups/l10n/en.json +1 -46
  174. package/templates/events-meetups/l10n/es.json +0 -412
  175. package/templates/events-meetups/l10n/fi.json +0 -412
  176. package/templates/events-meetups/l10n/fr.json +0 -412
  177. package/templates/events-meetups/l10n/he.json +0 -331
  178. package/templates/events-meetups/l10n/hu.json +0 -412
  179. package/templates/events-meetups/l10n/id.json +0 -412
  180. package/templates/events-meetups/l10n/it.json +0 -412
  181. package/templates/events-meetups/l10n/ja.json +0 -412
  182. package/templates/events-meetups/l10n/ko.json +0 -412
  183. package/templates/events-meetups/l10n/lt.json +0 -412
  184. package/templates/events-meetups/l10n/nl.json +0 -412
  185. package/templates/events-meetups/l10n/no.json +0 -412
  186. package/templates/events-meetups/l10n/pl.json +0 -412
  187. package/templates/events-meetups/l10n/pt.json +0 -412
  188. package/templates/events-meetups/l10n/ru.json +0 -412
  189. package/templates/events-meetups/l10n/sv.json +0 -412
  190. package/templates/events-meetups/l10n/th.json +0 -412
  191. package/templates/events-meetups/l10n/tr.json +0 -412
  192. package/templates/events-meetups/l10n/uk.json +0 -412
  193. package/templates/events-meetups/l10n/vi.json +0 -412
  194. package/templates/events-meetups/l10n/zh.json +0 -412
  195. package/templates/gym-fitness/l10n/ar.json +9 -405
  196. package/templates/gym-fitness/l10n/cs.json +9 -405
  197. package/templates/gym-fitness/l10n/da.json +9 -405
  198. package/templates/gym-fitness/l10n/de.json +9 -405
  199. package/templates/gym-fitness/l10n/el.json +9 -405
  200. package/templates/gym-fitness/l10n/en.json +8 -51
  201. package/templates/gym-fitness/l10n/es.json +9 -405
  202. package/templates/gym-fitness/l10n/fi.json +9 -405
  203. package/templates/gym-fitness/l10n/fr.json +9 -405
  204. package/templates/gym-fitness/l10n/he.json +9 -326
  205. package/templates/gym-fitness/l10n/hu.json +9 -405
  206. package/templates/gym-fitness/l10n/id.json +9 -405
  207. package/templates/gym-fitness/l10n/it.json +9 -405
  208. package/templates/gym-fitness/l10n/ja.json +9 -405
  209. package/templates/gym-fitness/l10n/ko.json +9 -405
  210. package/templates/gym-fitness/l10n/lt.json +9 -405
  211. package/templates/gym-fitness/l10n/nl.json +9 -405
  212. package/templates/gym-fitness/l10n/no.json +9 -405
  213. package/templates/gym-fitness/l10n/pl.json +9 -405
  214. package/templates/gym-fitness/l10n/pt.json +9 -405
  215. package/templates/gym-fitness/l10n/ru.json +9 -405
  216. package/templates/gym-fitness/l10n/sv.json +9 -405
  217. package/templates/gym-fitness/l10n/th.json +9 -405
  218. package/templates/gym-fitness/l10n/tr.json +9 -405
  219. package/templates/gym-fitness/l10n/uk.json +9 -405
  220. package/templates/gym-fitness/l10n/vi.json +9 -405
  221. package/templates/gym-fitness/l10n/zh.json +9 -405
  222. package/templates/nonprofit-cause/l10n/ar.json +0 -387
  223. package/templates/nonprofit-cause/l10n/cs.json +0 -387
  224. package/templates/nonprofit-cause/l10n/da.json +0 -387
  225. package/templates/nonprofit-cause/l10n/de.json +0 -387
  226. package/templates/nonprofit-cause/l10n/el.json +0 -387
  227. package/templates/nonprofit-cause/l10n/en.json +1 -46
  228. package/templates/nonprofit-cause/l10n/es.json +0 -387
  229. package/templates/nonprofit-cause/l10n/fi.json +0 -387
  230. package/templates/nonprofit-cause/l10n/fr.json +0 -387
  231. package/templates/nonprofit-cause/l10n/he.json +0 -311
  232. package/templates/nonprofit-cause/l10n/hu.json +0 -387
  233. package/templates/nonprofit-cause/l10n/id.json +0 -387
  234. package/templates/nonprofit-cause/l10n/it.json +0 -387
  235. package/templates/nonprofit-cause/l10n/ja.json +0 -387
  236. package/templates/nonprofit-cause/l10n/ko.json +0 -387
  237. package/templates/nonprofit-cause/l10n/lt.json +0 -387
  238. package/templates/nonprofit-cause/l10n/nl.json +0 -387
  239. package/templates/nonprofit-cause/l10n/no.json +0 -387
  240. package/templates/nonprofit-cause/l10n/pl.json +0 -387
  241. package/templates/nonprofit-cause/l10n/pt.json +0 -387
  242. package/templates/nonprofit-cause/l10n/ru.json +0 -387
  243. package/templates/nonprofit-cause/l10n/sv.json +0 -387
  244. package/templates/nonprofit-cause/l10n/th.json +0 -387
  245. package/templates/nonprofit-cause/l10n/tr.json +0 -387
  246. package/templates/nonprofit-cause/l10n/uk.json +0 -387
  247. package/templates/nonprofit-cause/l10n/vi.json +0 -387
  248. package/templates/nonprofit-cause/l10n/zh.json +0 -387
  249. package/templates/podcast-creator/l10n/ar.json +0 -417
  250. package/templates/podcast-creator/l10n/cs.json +0 -417
  251. package/templates/podcast-creator/l10n/da.json +0 -417
  252. package/templates/podcast-creator/l10n/de.json +0 -417
  253. package/templates/podcast-creator/l10n/el.json +0 -417
  254. package/templates/podcast-creator/l10n/en.json +1 -46
  255. package/templates/podcast-creator/l10n/es.json +0 -417
  256. package/templates/podcast-creator/l10n/fi.json +0 -417
  257. package/templates/podcast-creator/l10n/fr.json +0 -417
  258. package/templates/podcast-creator/l10n/he.json +0 -335
  259. package/templates/podcast-creator/l10n/hu.json +0 -417
  260. package/templates/podcast-creator/l10n/id.json +0 -417
  261. package/templates/podcast-creator/l10n/it.json +0 -417
  262. package/templates/podcast-creator/l10n/ja.json +0 -417
  263. package/templates/podcast-creator/l10n/ko.json +0 -417
  264. package/templates/podcast-creator/l10n/lt.json +0 -417
  265. package/templates/podcast-creator/l10n/nl.json +0 -417
  266. package/templates/podcast-creator/l10n/no.json +0 -417
  267. package/templates/podcast-creator/l10n/pl.json +0 -417
  268. package/templates/podcast-creator/l10n/pt.json +0 -417
  269. package/templates/podcast-creator/l10n/ru.json +0 -417
  270. package/templates/podcast-creator/l10n/sv.json +0 -417
  271. package/templates/podcast-creator/l10n/th.json +0 -417
  272. package/templates/podcast-creator/l10n/tr.json +0 -417
  273. package/templates/podcast-creator/l10n/uk.json +0 -417
  274. package/templates/podcast-creator/l10n/vi.json +0 -417
  275. package/templates/podcast-creator/l10n/zh.json +0 -417
  276. package/templates/portfolio-creative/l10n/ar.json +0 -437
  277. package/templates/portfolio-creative/l10n/cs.json +0 -437
  278. package/templates/portfolio-creative/l10n/da.json +0 -437
  279. package/templates/portfolio-creative/l10n/de.json +0 -437
  280. package/templates/portfolio-creative/l10n/el.json +0 -437
  281. package/templates/portfolio-creative/l10n/en.json +1 -46
  282. package/templates/portfolio-creative/l10n/es.json +0 -437
  283. package/templates/portfolio-creative/l10n/fi.json +0 -437
  284. package/templates/portfolio-creative/l10n/fr.json +0 -437
  285. package/templates/portfolio-creative/l10n/he.json +0 -351
  286. package/templates/portfolio-creative/l10n/hu.json +0 -437
  287. package/templates/portfolio-creative/l10n/id.json +0 -437
  288. package/templates/portfolio-creative/l10n/it.json +0 -437
  289. package/templates/portfolio-creative/l10n/ja.json +0 -437
  290. package/templates/portfolio-creative/l10n/ko.json +0 -437
  291. package/templates/portfolio-creative/l10n/lt.json +0 -437
  292. package/templates/portfolio-creative/l10n/nl.json +0 -437
  293. package/templates/portfolio-creative/l10n/no.json +0 -437
  294. package/templates/portfolio-creative/l10n/pl.json +0 -437
  295. package/templates/portfolio-creative/l10n/pt.json +0 -437
  296. package/templates/portfolio-creative/l10n/ru.json +0 -437
  297. package/templates/portfolio-creative/l10n/sv.json +0 -437
  298. package/templates/portfolio-creative/l10n/th.json +0 -437
  299. package/templates/portfolio-creative/l10n/tr.json +0 -437
  300. package/templates/portfolio-creative/l10n/uk.json +0 -437
  301. package/templates/portfolio-creative/l10n/vi.json +0 -437
  302. package/templates/portfolio-creative/l10n/zh.json +0 -437
  303. package/templates/restaurant/l10n/ar.json +0 -447
  304. package/templates/restaurant/l10n/cs.json +0 -447
  305. package/templates/restaurant/l10n/da.json +0 -447
  306. package/templates/restaurant/l10n/de.json +0 -447
  307. package/templates/restaurant/l10n/el.json +0 -447
  308. package/templates/restaurant/l10n/en.json +1 -46
  309. package/templates/restaurant/l10n/es.json +0 -447
  310. package/templates/restaurant/l10n/fi.json +0 -447
  311. package/templates/restaurant/l10n/fr.json +0 -447
  312. package/templates/restaurant/l10n/he.json +0 -359
  313. package/templates/restaurant/l10n/hu.json +0 -447
  314. package/templates/restaurant/l10n/id.json +0 -447
  315. package/templates/restaurant/l10n/it.json +0 -447
  316. package/templates/restaurant/l10n/ja.json +0 -447
  317. package/templates/restaurant/l10n/ko.json +0 -447
  318. package/templates/restaurant/l10n/lt.json +0 -447
  319. package/templates/restaurant/l10n/nl.json +0 -447
  320. package/templates/restaurant/l10n/no.json +0 -447
  321. package/templates/restaurant/l10n/pl.json +0 -447
  322. package/templates/restaurant/l10n/pt.json +0 -447
  323. package/templates/restaurant/l10n/ru.json +0 -447
  324. package/templates/restaurant/l10n/sv.json +0 -447
  325. package/templates/restaurant/l10n/th.json +0 -447
  326. package/templates/restaurant/l10n/tr.json +0 -447
  327. package/templates/restaurant/l10n/uk.json +0 -447
  328. package/templates/restaurant/l10n/vi.json +0 -447
  329. package/templates/restaurant/l10n/zh.json +0 -447
  330. package/templates/retail-store/l10n/ar.json +0 -462
  331. package/templates/retail-store/l10n/cs.json +0 -462
  332. package/templates/retail-store/l10n/da.json +0 -462
  333. package/templates/retail-store/l10n/de.json +0 -462
  334. package/templates/retail-store/l10n/el.json +0 -462
  335. package/templates/retail-store/l10n/en.json +1 -61
  336. package/templates/retail-store/l10n/es.json +0 -462
  337. package/templates/retail-store/l10n/fi.json +0 -462
  338. package/templates/retail-store/l10n/fr.json +0 -462
  339. package/templates/retail-store/l10n/he.json +0 -371
  340. package/templates/retail-store/l10n/hu.json +0 -462
  341. package/templates/retail-store/l10n/id.json +0 -462
  342. package/templates/retail-store/l10n/it.json +0 -462
  343. package/templates/retail-store/l10n/ja.json +0 -462
  344. package/templates/retail-store/l10n/ko.json +0 -462
  345. package/templates/retail-store/l10n/lt.json +0 -462
  346. package/templates/retail-store/l10n/nl.json +0 -462
  347. package/templates/retail-store/l10n/no.json +0 -462
  348. package/templates/retail-store/l10n/pl.json +0 -462
  349. package/templates/retail-store/l10n/pt.json +0 -462
  350. package/templates/retail-store/l10n/ru.json +0 -462
  351. package/templates/retail-store/l10n/sv.json +0 -462
  352. package/templates/retail-store/l10n/th.json +0 -462
  353. package/templates/retail-store/l10n/tr.json +0 -462
  354. package/templates/retail-store/l10n/uk.json +0 -462
  355. package/templates/retail-store/l10n/vi.json +0 -462
  356. package/templates/retail-store/l10n/zh.json +0 -462
  357. package/templates/yoga-studio/l10n/ar.json +9 -197
  358. package/templates/yoga-studio/l10n/cs.json +9 -197
  359. package/templates/yoga-studio/l10n/da.json +9 -197
  360. package/templates/yoga-studio/l10n/de.json +9 -197
  361. package/templates/yoga-studio/l10n/el.json +9 -197
  362. package/templates/yoga-studio/l10n/en.json +8 -30
  363. package/templates/yoga-studio/l10n/es.json +9 -197
  364. package/templates/yoga-studio/l10n/fi.json +9 -197
  365. package/templates/yoga-studio/l10n/fr.json +9 -197
  366. package/templates/yoga-studio/l10n/he.json +9 -159
  367. package/templates/yoga-studio/l10n/hu.json +9 -197
  368. package/templates/yoga-studio/l10n/id.json +9 -197
  369. package/templates/yoga-studio/l10n/it.json +9 -197
  370. package/templates/yoga-studio/l10n/ja.json +9 -197
  371. package/templates/yoga-studio/l10n/ko.json +9 -197
  372. package/templates/yoga-studio/l10n/lt.json +9 -197
  373. package/templates/yoga-studio/l10n/nl.json +9 -197
  374. package/templates/yoga-studio/l10n/no.json +9 -197
  375. package/templates/yoga-studio/l10n/pl.json +9 -197
  376. package/templates/yoga-studio/l10n/pt.json +9 -197
  377. package/templates/yoga-studio/l10n/ru.json +9 -197
  378. package/templates/yoga-studio/l10n/sv.json +9 -197
  379. package/templates/yoga-studio/l10n/th.json +9 -197
  380. package/templates/yoga-studio/l10n/tr.json +9 -197
  381. package/templates/yoga-studio/l10n/uk.json +9 -197
  382. package/templates/yoga-studio/l10n/vi.json +9 -197
  383. package/templates/yoga-studio/l10n/zh.json +9 -197
  384. package/templates/beauty-salon/recipes/announcement-card.json +0 -72
  385. package/templates/beauty-salon/recipes/blog-hero.json +0 -95
  386. package/templates/beauty-salon/recipes/blog-list-thumb-start.json +0 -394
  387. package/templates/beauty-salon/recipes/blog-list.json +0 -394
  388. package/templates/beauty-salon/recipes/blog-see-all.json +0 -50
  389. package/templates/beauty-salon/recipes/events-inline-list.json +0 -228
  390. package/templates/beauty-salon/recipes/events-inline.json +0 -309
  391. package/templates/beauty-salon/recipes/faq-list.json +0 -503
  392. package/templates/beauty-salon/recipes/members-list.json +0 -445
  393. package/templates/beauty-salon/recipes/plans-card.json +0 -811
  394. package/templates/beauty-salon/recipes/products-carousel.json +0 -141
  395. package/templates/beauty-salon/recipes/products-grid.json +0 -143
  396. package/templates/beauty-salon/recipes/programs-card.json +0 -254
  397. package/templates/beauty-salon/recipes/programs-carousel.json +0 -234
  398. package/templates/beauty-salon/recipes/programs-filters.json +0 -94
  399. package/templates/beauty-salon/recipes/programs-see-all.json +0 -43
  400. package/templates/beauty-salon/recipes/section-error.json +0 -58
  401. package/templates/beauty-salon/tier5-src/_shared/announcement-section.ts +0 -122
  402. package/templates/beauty-salon/tier5-src/_shared/blog-list.ts +0 -207
  403. package/templates/beauty-salon/tier5-src/_shared/event-registration.ts +0 -86
  404. package/templates/beauty-salon/tier5-src/_shared/events-card.ts +0 -33
  405. package/templates/beauty-salon/tier5-src/_shared/events-inline-options.ts +0 -25
  406. package/templates/beauty-salon/tier5-src/_shared/events-inline.ts +0 -84
  407. package/templates/beauty-salon/tier5-src/_shared/faq-list.ts +0 -405
  408. package/templates/beauty-salon/tier5-src/_shared/groups-section.ts +0 -110
  409. package/templates/beauty-salon/tier5-src/_shared/member-activity.ts +0 -34
  410. package/templates/beauty-salon/tier5-src/_shared/member-row-extras.ts +0 -175
  411. package/templates/beauty-salon/tier5-src/_shared/members-directory-view.ts +0 -39
  412. package/templates/beauty-salon/tier5-src/_shared/members-directory.ts +0 -271
  413. package/templates/beauty-salon/tier5-src/_shared/plan-facts.ts +0 -87
  414. package/templates/beauty-salon/tier5-src/_shared/plans-section.ts +0 -106
  415. package/templates/beauty-salon/tier5-src/_shared/products-section.ts +0 -76
  416. package/templates/beauty-salon/tier5-src/_shared/program-fields.ts +0 -16
  417. package/templates/beauty-salon/tier5-src/_shared/programs-section.ts +0 -740
  418. package/templates/beauty-salon/tier5-src/_shared/relative-time.ts +0 -21
  419. package/templates/community-club/recipes/announcement-card.json +0 -72
  420. package/templates/community-club/recipes/blog-hero.json +0 -95
  421. package/templates/community-club/recipes/blog-list-thumb-start.json +0 -394
  422. package/templates/community-club/recipes/blog-list.json +0 -394
  423. package/templates/community-club/recipes/blog-see-all.json +0 -50
  424. package/templates/community-club/recipes/events-inline.json +0 -309
  425. package/templates/community-club/recipes/faq-list.json +0 -503
  426. package/templates/community-club/recipes/members-list.json +0 -445
  427. package/templates/community-club/recipes/plans-card.json +0 -811
  428. package/templates/community-club/recipes/products-carousel.json +0 -141
  429. package/templates/community-club/recipes/products-grid.json +0 -143
  430. package/templates/community-club/recipes/programs-card.json +0 -254
  431. package/templates/community-club/recipes/programs-carousel.json +0 -234
  432. package/templates/community-club/recipes/programs-filters.json +0 -94
  433. package/templates/community-club/recipes/programs-participant-carousel.json +0 -257
  434. package/templates/community-club/recipes/programs-see-all.json +0 -43
  435. package/templates/community-club/recipes/section-error.json +0 -58
  436. package/templates/community-club/tier5-src/_shared/announcement-section.ts +0 -122
  437. package/templates/community-club/tier5-src/_shared/blog-list.ts +0 -207
  438. package/templates/community-club/tier5-src/_shared/events-card.ts +0 -33
  439. package/templates/community-club/tier5-src/_shared/events-inline-options.ts +0 -25
  440. package/templates/community-club/tier5-src/_shared/events-inline.ts +0 -84
  441. package/templates/community-club/tier5-src/_shared/faq-list.ts +0 -405
  442. package/templates/community-club/tier5-src/_shared/groups-section.ts +0 -110
  443. package/templates/community-club/tier5-src/_shared/member-activity.ts +0 -34
  444. package/templates/community-club/tier5-src/_shared/member-row-extras.ts +0 -175
  445. package/templates/community-club/tier5-src/_shared/members-directory-view.ts +0 -39
  446. package/templates/community-club/tier5-src/_shared/members-directory.ts +0 -271
  447. package/templates/community-club/tier5-src/_shared/plan-facts.ts +0 -87
  448. package/templates/community-club/tier5-src/_shared/plans-section.ts +0 -106
  449. package/templates/community-club/tier5-src/_shared/products-section.ts +0 -76
  450. package/templates/community-club/tier5-src/_shared/program-fields.ts +0 -16
  451. package/templates/community-club/tier5-src/_shared/programs-section.ts +0 -740
  452. package/templates/community-club/tier5-src/_shared/relative-time.ts +0 -21
  453. package/templates/events-meetups/recipes/announcement-card.json +0 -72
  454. package/templates/events-meetups/recipes/blog-hero.json +0 -95
  455. package/templates/events-meetups/recipes/blog-list-thumb-start.json +0 -394
  456. package/templates/events-meetups/recipes/blog-list.json +0 -394
  457. package/templates/events-meetups/recipes/blog-see-all.json +0 -50
  458. package/templates/events-meetups/recipes/events-inline-list.json +0 -228
  459. package/templates/events-meetups/recipes/events-inline.json +0 -309
  460. package/templates/events-meetups/recipes/faq-list.json +0 -503
  461. package/templates/events-meetups/recipes/groups-list.json +0 -196
  462. package/templates/events-meetups/recipes/members-list.json +0 -445
  463. package/templates/events-meetups/recipes/plans-card.json +0 -811
  464. package/templates/events-meetups/recipes/products-carousel.json +0 -141
  465. package/templates/events-meetups/recipes/products-grid.json +0 -143
  466. package/templates/events-meetups/recipes/programs-card.json +0 -254
  467. package/templates/events-meetups/recipes/programs-carousel.json +0 -234
  468. package/templates/events-meetups/recipes/programs-filters.json +0 -94
  469. package/templates/events-meetups/recipes/programs-see-all.json +0 -43
  470. package/templates/events-meetups/recipes/section-error.json +0 -58
  471. package/templates/events-meetups/tier5-src/_shared/announcement-section.ts +0 -122
  472. package/templates/events-meetups/tier5-src/_shared/blog-list.ts +0 -207
  473. package/templates/events-meetups/tier5-src/_shared/detail-presence.ts +0 -51
  474. package/templates/events-meetups/tier5-src/_shared/events-card.ts +0 -33
  475. package/templates/events-meetups/tier5-src/_shared/events-inline-options.ts +0 -25
  476. package/templates/events-meetups/tier5-src/_shared/events-inline.ts +0 -84
  477. package/templates/events-meetups/tier5-src/_shared/faq-list.ts +0 -405
  478. package/templates/events-meetups/tier5-src/_shared/groups-section.ts +0 -110
  479. package/templates/events-meetups/tier5-src/_shared/member-activity.ts +0 -34
  480. package/templates/events-meetups/tier5-src/_shared/member-row-extras.ts +0 -175
  481. package/templates/events-meetups/tier5-src/_shared/members-directory-view.ts +0 -39
  482. package/templates/events-meetups/tier5-src/_shared/members-directory.ts +0 -271
  483. package/templates/events-meetups/tier5-src/_shared/plan-facts.ts +0 -87
  484. package/templates/events-meetups/tier5-src/_shared/plans-section.ts +0 -106
  485. package/templates/events-meetups/tier5-src/_shared/products-section.ts +0 -76
  486. package/templates/events-meetups/tier5-src/_shared/program-fields.ts +0 -16
  487. package/templates/events-meetups/tier5-src/_shared/programs-section.ts +0 -740
  488. package/templates/events-meetups/tier5-src/_shared/relative-time.ts +0 -21
  489. package/templates/gym-fitness/recipes/announcement-card.json +0 -72
  490. package/templates/gym-fitness/recipes/blog-hero.json +0 -95
  491. package/templates/gym-fitness/recipes/blog-list-thumb-start.json +0 -394
  492. package/templates/gym-fitness/recipes/blog-list.json +0 -394
  493. package/templates/gym-fitness/recipes/blog-see-all.json +0 -50
  494. package/templates/gym-fitness/recipes/events-inline-list.json +0 -228
  495. package/templates/gym-fitness/recipes/events-inline.json +0 -309
  496. package/templates/gym-fitness/recipes/faq-list.json +0 -503
  497. package/templates/gym-fitness/recipes/groups-list.json +0 -196
  498. package/templates/gym-fitness/recipes/members-list.json +0 -445
  499. package/templates/gym-fitness/recipes/plans-card.json +0 -811
  500. package/templates/gym-fitness/recipes/products-carousel.json +0 -141
  501. package/templates/gym-fitness/recipes/products-grid.json +0 -143
  502. package/templates/gym-fitness/recipes/programs-card.json +0 -254
  503. package/templates/gym-fitness/recipes/programs-carousel.json +0 -234
  504. package/templates/gym-fitness/recipes/programs-filters.json +0 -94
  505. package/templates/gym-fitness/recipes/programs-see-all.json +0 -43
  506. package/templates/gym-fitness/recipes/section-error.json +0 -58
  507. package/templates/gym-fitness/tier5-src/_shared/announcement-section.ts +0 -122
  508. package/templates/gym-fitness/tier5-src/_shared/blog-list.ts +0 -207
  509. package/templates/gym-fitness/tier5-src/_shared/events-card.ts +0 -33
  510. package/templates/gym-fitness/tier5-src/_shared/events-inline-options.ts +0 -25
  511. package/templates/gym-fitness/tier5-src/_shared/events-inline.ts +0 -84
  512. package/templates/gym-fitness/tier5-src/_shared/faq-list.ts +0 -405
  513. package/templates/gym-fitness/tier5-src/_shared/groups-section.ts +0 -110
  514. package/templates/gym-fitness/tier5-src/_shared/member-activity.ts +0 -34
  515. package/templates/gym-fitness/tier5-src/_shared/member-row-extras.ts +0 -175
  516. package/templates/gym-fitness/tier5-src/_shared/members-directory-view.ts +0 -39
  517. package/templates/gym-fitness/tier5-src/_shared/members-directory.ts +0 -271
  518. package/templates/gym-fitness/tier5-src/_shared/plan-facts.ts +0 -87
  519. package/templates/gym-fitness/tier5-src/_shared/plans-section.ts +0 -106
  520. package/templates/gym-fitness/tier5-src/_shared/products-section.ts +0 -76
  521. package/templates/gym-fitness/tier5-src/_shared/program-fields.ts +0 -16
  522. package/templates/gym-fitness/tier5-src/_shared/programs-section.ts +0 -740
  523. package/templates/gym-fitness/tier5-src/_shared/relative-time.ts +0 -21
  524. package/templates/nonprofit-cause/recipes/announcement-card.json +0 -72
  525. package/templates/nonprofit-cause/recipes/blog-hero.json +0 -95
  526. package/templates/nonprofit-cause/recipes/blog-list-thumb-start.json +0 -394
  527. package/templates/nonprofit-cause/recipes/blog-list.json +0 -394
  528. package/templates/nonprofit-cause/recipes/blog-see-all.json +0 -50
  529. package/templates/nonprofit-cause/recipes/events-inline-list.json +0 -228
  530. package/templates/nonprofit-cause/recipes/events-inline.json +0 -309
  531. package/templates/nonprofit-cause/recipes/faq-list.json +0 -503
  532. package/templates/nonprofit-cause/recipes/groups-list.json +0 -196
  533. package/templates/nonprofit-cause/recipes/members-list.json +0 -445
  534. package/templates/nonprofit-cause/recipes/plans-card.json +0 -811
  535. package/templates/nonprofit-cause/recipes/products-carousel.json +0 -141
  536. package/templates/nonprofit-cause/recipes/products-grid.json +0 -143
  537. package/templates/nonprofit-cause/recipes/programs-card.json +0 -254
  538. package/templates/nonprofit-cause/recipes/programs-carousel.json +0 -234
  539. package/templates/nonprofit-cause/recipes/programs-filters.json +0 -94
  540. package/templates/nonprofit-cause/recipes/programs-participant-carousel.json +0 -257
  541. package/templates/nonprofit-cause/recipes/programs-see-all.json +0 -43
  542. package/templates/nonprofit-cause/recipes/section-error.json +0 -58
  543. package/templates/nonprofit-cause/tier5-src/_shared/announcement-section.ts +0 -122
  544. package/templates/nonprofit-cause/tier5-src/_shared/blog-list.ts +0 -207
  545. package/templates/nonprofit-cause/tier5-src/_shared/events-card.ts +0 -33
  546. package/templates/nonprofit-cause/tier5-src/_shared/events-inline-options.ts +0 -25
  547. package/templates/nonprofit-cause/tier5-src/_shared/events-inline.ts +0 -84
  548. package/templates/nonprofit-cause/tier5-src/_shared/faq-list.ts +0 -405
  549. package/templates/nonprofit-cause/tier5-src/_shared/groups-section.ts +0 -110
  550. package/templates/nonprofit-cause/tier5-src/_shared/member-activity.ts +0 -34
  551. package/templates/nonprofit-cause/tier5-src/_shared/member-row-extras.ts +0 -175
  552. package/templates/nonprofit-cause/tier5-src/_shared/members-directory-view.ts +0 -39
  553. package/templates/nonprofit-cause/tier5-src/_shared/members-directory.ts +0 -271
  554. package/templates/nonprofit-cause/tier5-src/_shared/plan-facts.ts +0 -87
  555. package/templates/nonprofit-cause/tier5-src/_shared/plans-section.ts +0 -106
  556. package/templates/nonprofit-cause/tier5-src/_shared/products-section.ts +0 -76
  557. package/templates/nonprofit-cause/tier5-src/_shared/program-fields.ts +0 -16
  558. package/templates/nonprofit-cause/tier5-src/_shared/programs-section.ts +0 -740
  559. package/templates/nonprofit-cause/tier5-src/_shared/relative-time.ts +0 -21
  560. package/templates/podcast-creator/recipes/announcement-card.json +0 -72
  561. package/templates/podcast-creator/recipes/blog-hero.json +0 -95
  562. package/templates/podcast-creator/recipes/blog-list-thumb-start.json +0 -394
  563. package/templates/podcast-creator/recipes/blog-list.json +0 -394
  564. package/templates/podcast-creator/recipes/blog-see-all.json +0 -50
  565. package/templates/podcast-creator/recipes/events-inline-list.json +0 -228
  566. package/templates/podcast-creator/recipes/events-inline.json +0 -309
  567. package/templates/podcast-creator/recipes/faq-list.json +0 -503
  568. package/templates/podcast-creator/recipes/groups-list.json +0 -196
  569. package/templates/podcast-creator/recipes/members-list.json +0 -445
  570. package/templates/podcast-creator/recipes/plans-card.json +0 -811
  571. package/templates/podcast-creator/recipes/products-carousel.json +0 -141
  572. package/templates/podcast-creator/recipes/products-grid.json +0 -143
  573. package/templates/podcast-creator/recipes/programs-card.json +0 -254
  574. package/templates/podcast-creator/recipes/programs-carousel.json +0 -234
  575. package/templates/podcast-creator/recipes/programs-filters.json +0 -94
  576. package/templates/podcast-creator/recipes/programs-participant-carousel.json +0 -257
  577. package/templates/podcast-creator/recipes/programs-see-all.json +0 -43
  578. package/templates/podcast-creator/recipes/section-error.json +0 -58
  579. package/templates/podcast-creator/tier5-src/_shared/announcement-section.ts +0 -122
  580. package/templates/podcast-creator/tier5-src/_shared/blog-list.ts +0 -207
  581. package/templates/podcast-creator/tier5-src/_shared/events-card.ts +0 -33
  582. package/templates/podcast-creator/tier5-src/_shared/events-inline-options.ts +0 -25
  583. package/templates/podcast-creator/tier5-src/_shared/events-inline.ts +0 -84
  584. package/templates/podcast-creator/tier5-src/_shared/faq-list.ts +0 -405
  585. package/templates/podcast-creator/tier5-src/_shared/groups-section.ts +0 -110
  586. package/templates/podcast-creator/tier5-src/_shared/member-activity.ts +0 -34
  587. package/templates/podcast-creator/tier5-src/_shared/member-row-extras.ts +0 -175
  588. package/templates/podcast-creator/tier5-src/_shared/members-directory-view.ts +0 -39
  589. package/templates/podcast-creator/tier5-src/_shared/members-directory.ts +0 -271
  590. package/templates/podcast-creator/tier5-src/_shared/plan-facts.ts +0 -87
  591. package/templates/podcast-creator/tier5-src/_shared/plans-section.ts +0 -106
  592. package/templates/podcast-creator/tier5-src/_shared/products-section.ts +0 -76
  593. package/templates/podcast-creator/tier5-src/_shared/program-fields.ts +0 -16
  594. package/templates/podcast-creator/tier5-src/_shared/programs-section.ts +0 -740
  595. package/templates/podcast-creator/tier5-src/_shared/relative-time.ts +0 -21
  596. package/templates/portfolio-creative/recipes/announcement-card.json +0 -72
  597. package/templates/portfolio-creative/recipes/blog-hero.json +0 -95
  598. package/templates/portfolio-creative/recipes/blog-list-thumb-start.json +0 -394
  599. package/templates/portfolio-creative/recipes/blog-list.json +0 -394
  600. package/templates/portfolio-creative/recipes/blog-see-all.json +0 -50
  601. package/templates/portfolio-creative/recipes/events-inline-list.json +0 -228
  602. package/templates/portfolio-creative/recipes/events-inline.json +0 -309
  603. package/templates/portfolio-creative/recipes/faq-list.json +0 -503
  604. package/templates/portfolio-creative/recipes/groups-list.json +0 -196
  605. package/templates/portfolio-creative/recipes/members-list.json +0 -445
  606. package/templates/portfolio-creative/recipes/plans-card.json +0 -811
  607. package/templates/portfolio-creative/recipes/products-carousel.json +0 -141
  608. package/templates/portfolio-creative/recipes/products-grid.json +0 -143
  609. package/templates/portfolio-creative/recipes/programs-card.json +0 -254
  610. package/templates/portfolio-creative/recipes/programs-carousel.json +0 -234
  611. package/templates/portfolio-creative/recipes/programs-filters.json +0 -94
  612. package/templates/portfolio-creative/recipes/programs-participant-carousel.json +0 -257
  613. package/templates/portfolio-creative/recipes/programs-see-all.json +0 -43
  614. package/templates/portfolio-creative/recipes/section-error.json +0 -58
  615. package/templates/portfolio-creative/tier5-src/_shared/announcement-section.ts +0 -122
  616. package/templates/portfolio-creative/tier5-src/_shared/blog-list.ts +0 -207
  617. package/templates/portfolio-creative/tier5-src/_shared/events-card.ts +0 -33
  618. package/templates/portfolio-creative/tier5-src/_shared/events-inline-options.ts +0 -25
  619. package/templates/portfolio-creative/tier5-src/_shared/events-inline.ts +0 -84
  620. package/templates/portfolio-creative/tier5-src/_shared/faq-list.ts +0 -405
  621. package/templates/portfolio-creative/tier5-src/_shared/groups-section.ts +0 -110
  622. package/templates/portfolio-creative/tier5-src/_shared/member-activity.ts +0 -34
  623. package/templates/portfolio-creative/tier5-src/_shared/member-row-extras.ts +0 -175
  624. package/templates/portfolio-creative/tier5-src/_shared/members-directory-view.ts +0 -39
  625. package/templates/portfolio-creative/tier5-src/_shared/members-directory.ts +0 -271
  626. package/templates/portfolio-creative/tier5-src/_shared/plan-facts.ts +0 -87
  627. package/templates/portfolio-creative/tier5-src/_shared/plans-section.ts +0 -106
  628. package/templates/portfolio-creative/tier5-src/_shared/products-section.ts +0 -76
  629. package/templates/portfolio-creative/tier5-src/_shared/program-fields.ts +0 -16
  630. package/templates/portfolio-creative/tier5-src/_shared/programs-section.ts +0 -740
  631. package/templates/portfolio-creative/tier5-src/_shared/relative-time.ts +0 -21
  632. package/templates/restaurant/recipes/announcement-card.json +0 -72
  633. package/templates/restaurant/recipes/blog-hero.json +0 -95
  634. package/templates/restaurant/recipes/blog-list-thumb-start.json +0 -394
  635. package/templates/restaurant/recipes/blog-list.json +0 -394
  636. package/templates/restaurant/recipes/blog-see-all.json +0 -50
  637. package/templates/restaurant/recipes/events-inline-list.json +0 -228
  638. package/templates/restaurant/recipes/events-inline.json +0 -309
  639. package/templates/restaurant/recipes/faq-list.json +0 -503
  640. package/templates/restaurant/recipes/groups-list.json +0 -196
  641. package/templates/restaurant/recipes/members-list.json +0 -445
  642. package/templates/restaurant/recipes/plans-card.json +0 -811
  643. package/templates/restaurant/recipes/products-carousel.json +0 -141
  644. package/templates/restaurant/recipes/products-grid.json +0 -143
  645. package/templates/restaurant/recipes/programs-card.json +0 -254
  646. package/templates/restaurant/recipes/programs-carousel.json +0 -234
  647. package/templates/restaurant/recipes/programs-filters.json +0 -94
  648. package/templates/restaurant/recipes/programs-participant-carousel.json +0 -257
  649. package/templates/restaurant/recipes/programs-see-all.json +0 -43
  650. package/templates/restaurant/recipes/section-error.json +0 -58
  651. package/templates/restaurant/tier5-src/_shared/announcement-section.ts +0 -122
  652. package/templates/restaurant/tier5-src/_shared/blog-list.ts +0 -207
  653. package/templates/restaurant/tier5-src/_shared/events-card.ts +0 -33
  654. package/templates/restaurant/tier5-src/_shared/events-inline-options.ts +0 -25
  655. package/templates/restaurant/tier5-src/_shared/events-inline.ts +0 -84
  656. package/templates/restaurant/tier5-src/_shared/faq-list.ts +0 -405
  657. package/templates/restaurant/tier5-src/_shared/groups-section.ts +0 -110
  658. package/templates/restaurant/tier5-src/_shared/member-activity.ts +0 -34
  659. package/templates/restaurant/tier5-src/_shared/member-row-extras.ts +0 -175
  660. package/templates/restaurant/tier5-src/_shared/members-directory-view.ts +0 -39
  661. package/templates/restaurant/tier5-src/_shared/members-directory.ts +0 -271
  662. package/templates/restaurant/tier5-src/_shared/plan-facts.ts +0 -87
  663. package/templates/restaurant/tier5-src/_shared/plans-section.ts +0 -106
  664. package/templates/restaurant/tier5-src/_shared/products-section.ts +0 -76
  665. package/templates/restaurant/tier5-src/_shared/program-fields.ts +0 -16
  666. package/templates/restaurant/tier5-src/_shared/programs-section.ts +0 -740
  667. package/templates/restaurant/tier5-src/_shared/relative-time.ts +0 -21
  668. package/templates/retail-store/recipes/announcement-card.json +0 -72
  669. package/templates/retail-store/recipes/blog-hero.json +0 -95
  670. package/templates/retail-store/recipes/blog-list-thumb-start.json +0 -394
  671. package/templates/retail-store/recipes/blog-list.json +0 -394
  672. package/templates/retail-store/recipes/blog-see-all.json +0 -50
  673. package/templates/retail-store/recipes/events-inline-list.json +0 -228
  674. package/templates/retail-store/recipes/events-inline.json +0 -309
  675. package/templates/retail-store/recipes/faq-list.json +0 -503
  676. package/templates/retail-store/recipes/groups-list.json +0 -196
  677. package/templates/retail-store/recipes/members-list.json +0 -445
  678. package/templates/retail-store/recipes/plans-card.json +0 -811
  679. package/templates/retail-store/recipes/products-carousel.json +0 -141
  680. package/templates/retail-store/recipes/products-grid.json +0 -143
  681. package/templates/retail-store/recipes/programs-card.json +0 -254
  682. package/templates/retail-store/recipes/programs-carousel.json +0 -234
  683. package/templates/retail-store/recipes/programs-filters.json +0 -94
  684. package/templates/retail-store/recipes/programs-participant-carousel.json +0 -257
  685. package/templates/retail-store/recipes/programs-see-all.json +0 -43
  686. package/templates/retail-store/recipes/section-error.json +0 -58
  687. package/templates/retail-store/tier5-src/_shared/announcement-section.ts +0 -122
  688. package/templates/retail-store/tier5-src/_shared/blog-list.ts +0 -207
  689. package/templates/retail-store/tier5-src/_shared/event-registration.ts +0 -86
  690. package/templates/retail-store/tier5-src/_shared/events-card.ts +0 -33
  691. package/templates/retail-store/tier5-src/_shared/events-inline-options.ts +0 -25
  692. package/templates/retail-store/tier5-src/_shared/events-inline.ts +0 -84
  693. package/templates/retail-store/tier5-src/_shared/faq-list.ts +0 -405
  694. package/templates/retail-store/tier5-src/_shared/groups-section.ts +0 -110
  695. package/templates/retail-store/tier5-src/_shared/member-activity.ts +0 -34
  696. package/templates/retail-store/tier5-src/_shared/member-row-extras.ts +0 -175
  697. package/templates/retail-store/tier5-src/_shared/members-directory-view.ts +0 -39
  698. package/templates/retail-store/tier5-src/_shared/members-directory.ts +0 -271
  699. package/templates/retail-store/tier5-src/_shared/plan-facts.ts +0 -87
  700. package/templates/retail-store/tier5-src/_shared/plans-section.ts +0 -106
  701. package/templates/retail-store/tier5-src/_shared/products-section.ts +0 -76
  702. package/templates/retail-store/tier5-src/_shared/program-fields.ts +0 -16
  703. package/templates/retail-store/tier5-src/_shared/programs-section.ts +0 -740
  704. package/templates/retail-store/tier5-src/_shared/relative-time.ts +0 -21
  705. package/templates/yoga-studio/recipes/announcement-card.json +0 -72
  706. package/templates/yoga-studio/recipes/blog-hero.json +0 -95
  707. package/templates/yoga-studio/recipes/blog-list-thumb-start.json +0 -394
  708. package/templates/yoga-studio/recipes/blog-list.json +0 -394
  709. package/templates/yoga-studio/recipes/blog-see-all.json +0 -50
  710. package/templates/yoga-studio/recipes/events-inline-list.json +0 -228
  711. package/templates/yoga-studio/recipes/events-inline.json +0 -309
  712. package/templates/yoga-studio/recipes/faq-list.json +0 -503
  713. package/templates/yoga-studio/recipes/groups-list.json +0 -196
  714. package/templates/yoga-studio/recipes/members-list.json +0 -445
  715. package/templates/yoga-studio/recipes/plans-card.json +0 -811
  716. package/templates/yoga-studio/recipes/products-carousel.json +0 -141
  717. package/templates/yoga-studio/recipes/products-grid.json +0 -143
  718. package/templates/yoga-studio/recipes/programs-card.json +0 -254
  719. package/templates/yoga-studio/recipes/programs-carousel.json +0 -234
  720. package/templates/yoga-studio/recipes/programs-filters.json +0 -94
  721. package/templates/yoga-studio/recipes/programs-participant-carousel.json +0 -257
  722. package/templates/yoga-studio/recipes/programs-see-all.json +0 -43
  723. package/templates/yoga-studio/recipes/section-error.json +0 -58
  724. package/templates/yoga-studio/tier5-src/_shared/announcement-section.ts +0 -122
  725. package/templates/yoga-studio/tier5-src/_shared/blog-list.ts +0 -207
  726. package/templates/yoga-studio/tier5-src/_shared/events-card.ts +0 -33
  727. package/templates/yoga-studio/tier5-src/_shared/events-inline-options.ts +0 -25
  728. package/templates/yoga-studio/tier5-src/_shared/events-inline.ts +0 -84
  729. package/templates/yoga-studio/tier5-src/_shared/faq-list.ts +0 -405
  730. package/templates/yoga-studio/tier5-src/_shared/groups-section.ts +0 -110
  731. package/templates/yoga-studio/tier5-src/_shared/member-activity.ts +0 -34
  732. package/templates/yoga-studio/tier5-src/_shared/member-row-extras.ts +0 -175
  733. package/templates/yoga-studio/tier5-src/_shared/members-directory-view.ts +0 -39
  734. package/templates/yoga-studio/tier5-src/_shared/members-directory.ts +0 -271
  735. package/templates/yoga-studio/tier5-src/_shared/plan-facts.ts +0 -87
  736. package/templates/yoga-studio/tier5-src/_shared/plans-section.ts +0 -106
  737. package/templates/yoga-studio/tier5-src/_shared/products-section.ts +0 -76
  738. package/templates/yoga-studio/tier5-src/_shared/program-fields.ts +0 -16
  739. package/templates/yoga-studio/tier5-src/_shared/programs-section.ts +0 -740
  740. package/templates/yoga-studio/tier5-src/_shared/relative-time.ts +0 -21
  741. /package/templates/{community-club → brandy}/tier5-src/_shared/detail-presence.ts +0 -0
@@ -0,0 +1,350 @@
1
+ // Tier-5 bundle: Wix Spaces clone — Chat thread (ON-DEVICE, site-scoped, REAL write).
2
+ // himalaya.input.id carries EITHER a chatroom id (inbox-opened threads) OR a MEMBER
3
+ // id (member picker / member detail "Message"). When the input is a member id we
4
+ // resolve (get-or-create) the 1:1 chatroom first; getMessages/sendChatMessage always
5
+ // operate on the resolved CHATROOM id.
6
+ //
7
+ // LIVE: once the conversation is open, `load` also returns what keeps it live —
8
+ // `_shared/chat-live.ts` picks a `wix-realtime://` stream when the screen passes a
9
+ // `chatRealtime` channel, else a 4 s foreground `_poll` of `refresh`. A message from the
10
+ // business then appears without the member leaving the screen. `load`, `setDraft` and
11
+ // `send` keep their contract; the directives are stripped by the runtime, never state.
12
+ import { defineService, type PollDirective, type PollStopDirective, type StreamDirective } from "@himalaya/state";
13
+ import { getMessages, sendChatMessage, getOrCreateDirectChatroom, getChatToken, type ChatMessage } from "@himalaya/wix-chat-web";
14
+ import { getMyData } from "@himalaya/wix-users";
15
+ import { formatMonthDay, formatMonthDayTime } from "../_shared/engine-intl.js";
16
+ import { initials } from "../_shared/himi-text.js";
17
+ import { copyParam, stashCopy } from "../_shared/himi-copy.js";
18
+ import { presence, presenceAfterError, detailInputId, type PresenceFlags } from "../_shared/detail-presence.js";
19
+ import { isOfflineFailure, writeMayHaveLanded } from "../_shared/owner-load-error.js";
20
+ import { logChatSendError } from "../_shared/wix-bi.js";
21
+ import { CHAT_LIVE_POLL_ID, chatRealtimeConfig, createReloadGate, createSendIntents, createVisitToken, liveDirectives, postWithVisitToken, isTokenRejected, liveFallback, type ChatLiveMode, type ChatRealtimeConfig } from "../_shared/chat-live.js";
22
+
23
+ import { memberAccess, memberAccessChanged } from "../_shared/member-access.js";
24
+ import { readAccess, assertReadAccess, readAccessDenied, NO_READ_SIGN_IN, type ReadAccess } from "../_shared/member-read.js";
25
+
26
+ const SERVICE = "spacesChatThread";
27
+ const EMPTY_TEXT = "No messages yet. Say hello!";
28
+
29
+ // `mine` / `notMine` pick the incoming or outgoing row layout (the descriptor hides the other
30
+ // one). Empty strings and `*Hidden` flags let a row drop its badge, avatar or attachment.
31
+ // `leadFill` (" " for my messages) stays for screens that right-align with a gated spacer.
32
+ interface Row {
33
+ id: string; text: string; when: string; leadFill: string; mine: boolean; notMine: boolean;
34
+ senderBadge: string; avatarUrl: string; avatarInitials: string;
35
+ imageUrl: string; imageDescription: string; imageHidden: boolean; dayLabel: string; dayHidden: boolean;
36
+ }
37
+ interface S extends PresenceFlags {
38
+ threadMember: ReadAccess | null; signInRequired: boolean; noSignIn: boolean;
39
+ status: "loading" | "ready"; messages: Row[]; emptyText: string; emptyHidden: boolean; draft: string; sendHint: string; resolvedChatroomId: string; myUserId: string;
40
+ /** Send token for the host's transcript scroll: a new value follows the tail. */
41
+ scrollSend: string;
42
+ /** Which path keeps the open thread live (diagnostic). */
43
+ live?: ChatLiveMode;
44
+ _stream?: StreamDirective;
45
+ _poll?: PollDirective | PollStopDirective;
46
+ }
47
+
48
+ function inputId(): string {
49
+ return (globalThis as { himalaya?: { input?: { id?: string } } }).himalaya?.input?.id ?? "";
50
+ }
51
+ function inputKind(): string {
52
+ // The native nav plumbs an optional `kind` flat onto himalaya.input (screen|id|kind).
53
+ return (globalThis as { himalaya?: { input?: { kind?: string } } }).himalaya?.input?.kind ?? "";
54
+ }
55
+ // Resolve the raw input id (member OR chatroom) to a real CHATROOM id.
56
+ // kind==="chatroom" → the inbox already passed a resolved chatroom id; use it as-is.
57
+ // otherwise (member picker / member detail) → the raw id is a MEMBER id; get-or-create
58
+ // the 1:1 chatroom. On failure return "" — NOT the raw member id: sending to a member
59
+ // id 404s ("Chatroom not found"), which would surface as a misleading "Couldn't send".
60
+ async function resolveChatroomId(raw: string, kind: string): Promise<string> {
61
+ if (!raw) return "";
62
+ if (kind === "chatroom") return raw;
63
+ try {
64
+ return await getOrCreateDirectChatroom(raw);
65
+ } catch {
66
+ return "";
67
+ }
68
+ }
69
+ function val(arg?: unknown): string {
70
+ return typeof arg === "string" ? arg : ((arg as { value?: string; text?: string })?.value ?? (arg as { text?: string })?.text ?? "");
71
+ }
72
+ function dayKeyOf(d: Date): string {
73
+ return `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
74
+ }
75
+ /** chat-web marks the business side as "business", "businessUser" or "user" (the same predicate
76
+ * as wix-owner-inbox-thread); a visitor or member is anything else. */
77
+ function isBusinessSender(m: ChatMessage): boolean {
78
+ const type = String(m.sender?.type ?? "").toLowerCase();
79
+ return type === "business" || type === "businessuser" || type === "user";
80
+ }
81
+ function norm(m: ChatMessage, i: number, myUserId: string): Row & { timestamp: number; dayKey: string } {
82
+ const mm = m as unknown as {
83
+ id?: string; summary?: string; data?: Array<{ mimeType?: string; data?: { text?: string; uri?: string; thumbnailUrl?: string } }>;
84
+ payload?: { text?: string }; content?: string; createdAt?: number; createdDate?: string;
85
+ senderDisplayData?: { name?: string; image?: { url?: string } };
86
+ };
87
+ const text = mm.data?.find((part) => part.data?.text)?.data?.text || mm.summary || mm.payload?.text || mm.content || "";
88
+ const ms = mm.createdAt || (mm.createdDate ? Date.parse(mm.createdDate) : 0);
89
+ const date = ms ? new Date(ms) : null;
90
+ const senderName = mm.senderDisplayData?.name || "";
91
+ const avatarUrl = mm.senderDisplayData?.image?.url || "";
92
+ const image = mm.data?.find((part) => part.mimeType?.startsWith("image/") || part.data?.thumbnailUrl);
93
+ const imageUrl = image?.data?.thumbnailUrl || image?.data?.uri || "";
94
+ // Mine when the message sender matches my user id (resolved once per load).
95
+ const mine = !!(myUserId && m.sender?.userId && m.sender.userId === myUserId);
96
+ return {
97
+ id: mm.id || `m${i}`, text: text || "Message", when: date ? formatMonthDayTime(date) : "", leadFill: mine ? " " : "", mine, notMine: !mine,
98
+ senderBadge: isBusinessSender(m) ? copyParam("chatThread.businessBadge", "Business") : "",
99
+ avatarUrl, avatarInitials: initials(senderName),
100
+ imageUrl, imageDescription: imageUrl ? `${senderName || "Message"} attachment` : "", imageHidden: !imageUrl,
101
+ dayLabel: "", dayHidden: true, timestamp: ms, dayKey: date ? dayKeyOf(date) : "",
102
+ };
103
+ }
104
+
105
+ /** Oldest first, one row per message id, and a day label on the first message of each day. */
106
+ function rowsOf(messages: ChatMessage[], myUserId: string): Row[] {
107
+ const sorted = messages.map((m, i) => norm(m, i, myUserId)).sort((a, b) => a.timestamp - b.timestamp);
108
+ const today = new Date();
109
+ const todayKey = dayKeyOf(today);
110
+ const yesterdayKey = dayKeyOf(new Date(today.getFullYear(), today.getMonth(), today.getDate() - 1));
111
+ const seen = new Set<string>();
112
+ const rows: Row[] = [];
113
+ let previousDay = "";
114
+ for (const { timestamp, dayKey, ...row } of sorted) {
115
+ if (seen.has(row.id)) continue;
116
+ seen.add(row.id);
117
+ const startsDay = !!dayKey && dayKey !== previousDay;
118
+ if (dayKey) previousDay = dayKey;
119
+ const dayLabel = !startsDay ? "" : dayKey === todayKey ? copyParam("chatThread.today", "Today") : dayKey === yesterdayKey ? copyParam("chatThread.yesterday", "Yesterday") : formatMonthDay(new Date(timestamp));
120
+ rows.push({ ...row, dayLabel, dayHidden: !dayLabel });
121
+ }
122
+ return rows;
123
+ }
124
+
125
+ function nextScrollToken(prev: string): string {
126
+ return String((Number(prev) || 0) + 1);
127
+ }
128
+
129
+ // ONE member chatToken per visit (`_shared/chat-live.ts`): a 4 s re-read would otherwise
130
+ // mint a token every 4 s on top of its GET. Reset on every `load`.
131
+ const memberToken = createVisitToken(() => getChatToken({ role: "member" }).then((t) => t.chatToken));
132
+
133
+ async function reload(id: string, myUserId: string, member: ReadAccess): Promise<Row[]> {
134
+ if (!id) return [];
135
+ for (let attempt = 0; ; attempt++) {
136
+ const token = memberToken.get();
137
+ try {
138
+ const chatToken = await token;
139
+ await assertReadAccess(member);
140
+ const msgs = await getMessages(id, 30, { role: "member", chatToken });
141
+ return rowsOf(msgs ?? [], myUserId);
142
+ } catch (error) {
143
+ memberToken.drop(token);
144
+ // An expired visit token gets one fresh attempt. A repeated refusal still
145
+ // clears private history; checking identity before each read prevents stale retries.
146
+ if (attempt > 0 || !isTokenRejected(error)) throw error;
147
+ }
148
+ }
149
+ }
150
+
151
+ /** Send ids that belong to the intent (conversation + text), not the tap. */
152
+ const intents = createSendIntents();
153
+
154
+ /** Post once per intent: a retried tap of the same text reuses its message id, so a send
155
+ * that failed ambiguously and is tapped again stays one message. */
156
+ async function postOnce(chatroomId: string, text: string, member: ReadAccess): Promise<void> {
157
+ const messageId = intents.idFor(chatroomId, text);
158
+ await postWithVisitToken(memberToken, async (chatToken) => {
159
+ await assertReadAccess(member);
160
+ if (liveState().threadMember !== member) throw memberAccessChanged();
161
+ return sendChatMessage(chatroomId, text, { role: "member", chatToken, messageId });
162
+ });
163
+ intents.settle(chatroomId, text);
164
+ }
165
+
166
+ /** A send in flight. Set synchronously before the first `await`: an async action publishes
167
+ * no state until it returns, so a state flag could not stop a second tap. */
168
+ let sendingNow = false;
169
+
170
+ // The conversation a live re-read reads, and the channel the screen passed (if any).
171
+ let current = { chatroomId: "", myUserId: "" };
172
+ let realtime: ChatRealtimeConfig | null = null;
173
+ const gate = createReloadGate(() => reload(current.chatroomId, current.myUserId, liveState().threadMember!));
174
+
175
+ /** A tick or a stream event: re-read the open conversation. A failed tick keeps the
176
+ * thread as it is — the next one tries again.
177
+ *
178
+ * The read lands on the LIVE state (`svc.getState()`), not the state the tick started
179
+ * with: the runtime replaces the whole service state with what an action returns, so a
180
+ * tick that resolves after the member typed or sent would otherwise put back the old
181
+ * draft and the old messages. */
182
+ async function reread(s: S): Promise<S> {
183
+ if (!s.found || !s.resolvedChatroomId || s.resolvedChatroomId !== current.chatroomId) return s;
184
+ try {
185
+ await assertThreadMember(s);
186
+ const messages = await gate.request();
187
+ await assertThreadMember(s);
188
+ const now = svc.getState();
189
+ if (now.threadMember !== s.threadMember || now.resolvedChatroomId !== s.resolvedChatroomId) return now;
190
+ return { ...now, messages, emptyText: messages.length ? "" : now.emptyText || EMPTY_TEXT, emptyHidden: messages.length > 0 };
191
+ } catch (error) {
192
+ const now = svc.getState();
193
+ if (now.threadMember !== s.threadMember) return now;
194
+ return readAccessDenied(error) ? threadFailure(error) : now;
195
+ }
196
+ }
197
+
198
+ /** The live service state, for an action that awaited. A typed function rather than
199
+ * `svc.getState()` inline, so `svc`'s own initializer does not reference it. */
200
+ function liveState(): S {
201
+ return svc.getState();
202
+ }
203
+
204
+ // Resolve my user id once (best-effort) so messages can be tagged mine/other.
205
+ async function resolveMyUserId(): Promise<string> {
206
+ try { return (await getMyData()).userId || ""; } catch { return ""; }
207
+ }
208
+
209
+ const INITIAL: S = { status: "loading", messages: [], emptyText: "", emptyHidden: true, scrollSend: "", draft: "", sendHint: "", resolvedChatroomId: "", myUserId: "", ...presence("loading"), ...NO_READ_SIGN_IN, threadMember: null };
210
+ let loadVersion = 0;
211
+
212
+ async function threadFailure(error: unknown): Promise<S> {
213
+ const version = loadVersion;
214
+ const member = await memberAccess();
215
+ const flags = member.email ? NO_READ_SIGN_IN : { signInRequired: true, noSignIn: false };
216
+ if (version !== loadVersion) return liveState();
217
+ current = { chatroomId: "", myUserId: "" };
218
+ memberToken.reset();
219
+ return { ...INITIAL, status: "ready", ...presenceAfterError(error), ...flags, live: "off", _poll: { id: CHAT_LIVE_POLL_ID, stop: true } };
220
+ }
221
+ async function assertThreadMember(s: S): Promise<void> {
222
+ if (!s.threadMember?.member?.email) throw new Error("Unauthenticated: sign in to read messages");
223
+ await assertReadAccess(s.threadMember);
224
+ }
225
+
226
+ const svc = defineService<S, {
227
+ prepare: (s: S) => S;
228
+ load: (s: S, a?: unknown) => Promise<S | undefined>;
229
+ setDraft: (s: S, a?: unknown) => S;
230
+ send: (s: S) => Promise<S>;
231
+ refresh: (s: S) => Promise<S>;
232
+ onStreamEvent: (s: S) => Promise<S>;
233
+ onStreamError: (s: S) => S;
234
+ }>(SERVICE, {
235
+ state: INITIAL,
236
+ actions: {
237
+ prepare: (s) => ({ ...s, ...INITIAL, _poll: { id: CHAT_LIVE_POLL_ID, stop: true } }),
238
+ load: async (s, a): Promise<S | undefined> => {
239
+ const version = ++loadVersion;
240
+ await svc.prepare();
241
+ current = { chatroomId: "", myUserId: "" };
242
+ stashCopy(a);
243
+ const param = (a as { chatRealtime?: unknown } | null | undefined)?.chatRealtime;
244
+ if (param !== undefined) realtime = chatRealtimeConfig(param);
245
+ const raw = inputId();
246
+ // No thread / recipient id (a stale link, a route opened directly) -> the shared
247
+ // not-found state, and no composer: there is nobody to send to.
248
+ if (!detailInputId()) return { ...INITIAL, status: "ready", messages: [], emptyText: "", emptyHidden: true, ...presence("missing") };
249
+ memberToken.reset();
250
+ try {
251
+ const member = await readAccess();
252
+ if (!member.member.email) throw new Error("Unauthenticated: sign in to read messages");
253
+ // Resolve chatroom + my user id concurrently (myUserId tags own messages).
254
+ const [chatroomId, myUserId] = await Promise.all([resolveChatroomId(raw, inputKind()), resolveMyUserId()]);
255
+ // A recipient whose 1:1 chatroom could not be resolved is not a conversation yet:
256
+ // reload("") would return [] without throwing and publish a live, empty thread
257
+ // whose Send can only fail. Show the load-error line instead.
258
+ if (!chatroomId) return version === loadVersion ? { ...INITIAL, status: "ready", ...presence("failed") } : undefined;
259
+ const messages = await reload(chatroomId, myUserId, member);
260
+ await assertReadAccess(member);
261
+ if (version !== loadVersion) return undefined;
262
+ current = { chatroomId, myUserId };
263
+ const previous = s.threadMember;
264
+ const sameReader = previous?.member.email === member.member.email && previous?.member.scope === member.member.scope && previous?.tenant === member.tenant;
265
+ const draft = sameReader && s.resolvedChatroomId === chatroomId ? s.draft : "";
266
+ return { ...INITIAL, draft, threadMember: member, status: "ready", resolvedChatroomId: chatroomId, myUserId, messages, emptyText: messages.length ? "" : EMPTY_TEXT, emptyHidden: messages.length > 0, scrollSend: messages.length ? nextScrollToken(s.scrollSend) : "", ...presence("found"), ...liveDirectives(realtime, chatroomId, SERVICE) };
267
+ } catch (e) {
268
+ // A thread whose messages cannot be read is not a live, empty conversation: a 404
269
+ // is the shared not-found state, anything else the load-error line — never a
270
+ // "Say hello!" composer that can only fail.
271
+ if (version !== loadVersion) return undefined;
272
+ const failed = await threadFailure(e);
273
+ return version === loadVersion ? failed : undefined;
274
+ }
275
+ },
276
+ setDraft: (s, a) => ({ ...s, draft: val(a) }),
277
+ // The fallback poll's tick.
278
+ refresh: async (s) => reread(s),
279
+ // "The conversation changed" — the event's payload is deliberately not read.
280
+ onStreamEvent: async (s) => reread(s),
281
+ // The channel is gone, or this host refuses it (the web host does): poll instead.
282
+ onStreamError: (s) => (s.found && s.resolvedChatroomId ? { ...s, ...liveFallback(SERVICE) } : s),
283
+ // REAL WRITE: send the typed message to the RESOLVED chatroom id, then re-read.
284
+ // Every return builds on the LIVE state: the runtime replaces state wholesale, and ticks
285
+ // or typing may have changed it while this awaited.
286
+ send: async (s) => {
287
+ if (!s.found) return s;
288
+ const text = s.draft.trim();
289
+ try { await assertThreadMember(s); }
290
+ catch (error) { return liveState().threadMember !== s.threadMember ? liveState() : threadFailure(error); }
291
+ if (liveState().threadMember !== s.threadMember) return liveState();
292
+ const checked = liveState();
293
+ if (!text) return checked.draft.trim() ? checked : { ...checked, sendHint: "Type a message first." };
294
+ if (sendingNow) return checked;
295
+ sendingNow = true;
296
+ try {
297
+ // Resolve lazily in case send() runs before load() settled.
298
+ let chatroomId = s.resolvedChatroomId;
299
+ if (!chatroomId) chatroomId = await resolveChatroomId(inputId(), inputKind());
300
+ if (!chatroomId) return { ...liveState(), sendHint: "Couldn't start conversation." };
301
+ try {
302
+ await postOnce(chatroomId, text, s.threadMember!);
303
+ } catch (e) {
304
+ if (liveState().threadMember !== s.threadMember) return liveState();
305
+ try { await assertThreadMember(s); }
306
+ catch (error) { return threadFailure(error); }
307
+ // Surface a short reason (the SDK rejects with "HTTP <code>: <body>") so a
308
+ // real failure is diagnosable on-device instead of an opaque "Couldn't send".
309
+ // A failure that may have posted anyway (a gateway timeout after the backend stored
310
+ // it) must not read as "Couldn't send": say it may have gone. A retry of the same text
311
+ // reuses its message id, so it cannot become a second message.
312
+ const msg = (e as { message?: string })?.message || "";
313
+ if (writeMayHaveLanded(e)) return { ...liveState(), resolvedChatroomId: chatroomId, sendHint: "Couldn't confirm it was sent — check before sending again." };
314
+ logChatSendError({ chatroomId, error: e, offline: isOfflineFailure(e) });
315
+ return { ...liveState(), resolvedChatroomId: chatroomId, sendHint: msg ? `Couldn't send — ${msg.slice(0, 80)}` : "Couldn't send — try again." };
316
+ }
317
+ await assertThreadMember(s);
318
+ if (liveState().threadMember !== s.threadMember) return liveState();
319
+ // SENT. From here on nothing may say otherwise: a failed re-read must not offer a
320
+ // second Send of a message that already posted.
321
+ const myUserId = s.myUserId || (await resolveMyUserId());
322
+ // Re-read THROUGH the live-read gate, so this read queues behind a tick already in
323
+ // flight instead of racing it: whatever lands last then holds the sent reply.
324
+ current = { chatroomId, myUserId };
325
+ const cleared = (now: S): string => (now.draft.trim() === text ? "" : now.draft);
326
+ try {
327
+ const messages = await gate.request();
328
+ await assertThreadMember(s);
329
+ if (liveState().threadMember !== s.threadMember) return liveState();
330
+ const now = liveState();
331
+ return { ...now, resolvedChatroomId: chatroomId, myUserId, messages, draft: cleared(now), emptyText: "", emptyHidden: true, scrollSend: nextScrollToken(now.scrollSend), sendHint: "Sent ✓" };
332
+ } catch (error) {
333
+ if (liveState().threadMember !== s.threadMember) return liveState();
334
+ if (readAccessDenied(error)) return threadFailure(error);
335
+ const now = liveState();
336
+ const local: Row = { id: `local-${now.messages.length}`, text, when: "", leadFill: " ", mine: true, notMine: false, senderBadge: "", avatarUrl: "", avatarInitials: "", imageUrl: "", imageDescription: "", imageHidden: true, dayLabel: "", dayHidden: true };
337
+ return { ...now, resolvedChatroomId: chatroomId, myUserId, messages: [...now.messages, local], draft: cleared(now), emptyText: "", emptyHidden: true, scrollSend: nextScrollToken(now.scrollSend), sendHint: "Sent ✓" };
338
+ }
339
+ } catch (error) {
340
+ if (liveState().threadMember !== s.threadMember) return liveState();
341
+ return threadFailure(error);
342
+ } finally {
343
+ sendingNow = false;
344
+ }
345
+ },
346
+ },
347
+ });
348
+ svc.prepare();
349
+ svc.load();
350
+ export { svc };
@@ -0,0 +1,59 @@
1
+ // Tier-5 bundle: Wix Spaces clone — Delete my account.
2
+ // Confirm calls DELETE /members/v1/members/my then signs out. Failures surface
3
+ // in `message` so the UI can keep the confirmation (no silent no-op).
4
+ import { defineService } from "@himalaya/state";
5
+ import { dispatch } from "@himalaya/dispatch";
6
+
7
+ interface S {
8
+ status: "ready";
9
+ title: string;
10
+ body: string;
11
+ cta: string;
12
+ message: string;
13
+ done: boolean;
14
+ notDone: boolean;
15
+ }
16
+
17
+ function wixApi() {
18
+ return (globalThis as { himalaya?: { wixApi?: { call: (m: string, p: string, b?: unknown) => Promise<unknown> } } }).himalaya?.wixApi;
19
+ }
20
+
21
+ const svc = defineService<S, { confirm: (s: S) => Promise<S> }>("spacesDeleteAccount", {
22
+ state: {
23
+ status: "ready",
24
+ title: "Delete your account",
25
+ body: "This will permanently delete your membership on this site. This action can't be undone.",
26
+ cta: "Delete Account",
27
+ message: "",
28
+ done: false,
29
+ notDone: true,
30
+ },
31
+ actions: {
32
+ confirm: async (s) => {
33
+ try {
34
+ const api = wixApi();
35
+ if (!api) throw new Error("wixApi unavailable");
36
+ await api.call("DELETE", "/members/v1/members/my");
37
+ try { await dispatch("himi.wix.signOut"); } catch { /* best-effort */ }
38
+ return {
39
+ ...s,
40
+ message: "Your membership was deleted. You’ve been signed out.",
41
+ done: true,
42
+ notDone: false,
43
+ cta: "Done",
44
+ };
45
+ } catch (err) {
46
+ const msg = String((err as { message?: unknown })?.message ?? err ?? "Delete failed");
47
+ return {
48
+ ...s,
49
+ message: /403|FORBIDDEN|permission|denied/i.test(msg)
50
+ ? "This site doesn’t allow members to delete their own account from the app."
51
+ : "Couldn’t delete the account. Try again or contact the site owner.",
52
+ done: false,
53
+ notDone: true,
54
+ };
55
+ }
56
+ },
57
+ },
58
+ });
59
+ export { svc };
@@ -0,0 +1,89 @@
1
+ import { defineService } from "@himalaya/state";
2
+ import { listMyPlanOrders, type WixPlanOrder } from "@himalaya/wix-pricing-plans";
3
+ import { hostSessionFromGlobal } from "@himalaya/iap";
4
+ import { memberAccess, assertMemberAccess, memberAccessDenied, memberChanged } from "../_shared/member-access.js";
5
+ import { orderDate, orderPrice, orderStatus } from "../_shared/pricing-plan-display.js";
6
+ import { descriptionBody } from "../_shared/rich-body.js";
7
+ import { copyParam, stashCopy } from "../_shared/himi-copy.js";
8
+ import { isHttp401 } from "../_shared/member-read.js";
9
+
10
+ interface Row { id: string; name: string; subtitle: string; description: string; price: string; endDate: string; noEndDate: boolean; expired: boolean; dateLabel: string }
11
+ interface S {
12
+ status: string; orders: Row[]; rows: Row[]; allOrders: Row[]; selectedTab: string; nextCursor: string;
13
+ emptyText: string; hideAccountCta: boolean; noOrders: boolean;
14
+ isLoading: boolean; notLoading: boolean; hideError: boolean; denied: boolean;
15
+ hideEmpty: boolean; hideEmptyLoadMore: boolean; hideDeniedError: boolean; hideRetryError: boolean; pageError: boolean; loadingPage: boolean;
16
+ }
17
+ const initial = (): S => ({ status: "loading", orders: [], rows: [], allOrders: [], selectedTab: "active", nextCursor: "", emptyText: "", hideAccountCta: true, noOrders: true, isLoading: true, notLoading: false, hideError: true, denied: false, hideEmpty: true, hideEmptyLoadMore: true, hideDeniedError: true, hideRetryError: true, pageError: false, loadingPage: false });
18
+ /** The visitor state: the Sign in card, never an error. */
19
+ const guest = (): S => ({ ...initial(), status: "guest", emptyText: copyParam("mySubscriptions.guestBody", "Sign in to see your subscriptions."), isLoading: false, notLoading: true, hideAccountCta: false });
20
+ let sequence = 0;
21
+ let scope = "";
22
+ let offset = 0;
23
+ let pending = false;
24
+ const session = hostSessionFromGlobal();
25
+
26
+ function project(state: S): S {
27
+ // Keep the unfiltered `orders` contract for older descriptors without tabs.
28
+ const orders = state.allOrders;
29
+ const rows = orders.filter(row => row.expired === (state.selectedTab === "expired"));
30
+ return { ...state, orders, rows, noOrders: rows.length === 0, hideEmpty: state.status !== "ready" || rows.length > 0 || Boolean(state.nextCursor),
31
+ hideEmptyLoadMore: state.status !== "ready" || rows.length > 0 || !state.nextCursor,
32
+ emptyText: orders.length ? "" : state.selectedTab === "expired" ? copyParam("mySubscriptions.expiredEmpty", "No expired subscriptions") : copyParam("mySubscriptions.activeEmpty", "No active subscriptions") };
33
+ }
34
+ function norm(order: WixPlanOrder): Row {
35
+ const periodEnd = !order.earliestEndDate && !order.endDate && order.status === "ACTIVE" && (order.pricing?.subscription ?? order.priceDetails?.subscription) ? orderDate(order.currentCycle?.endedDate) : "";
36
+ const endDate = orderDate(order.earliestEndDate ?? order.endDate) || periodEnd;
37
+ return { id: order.id, name: order.planName || copyParam("plans.planFallbackName", "Plan"), subtitle: orderStatus(order),
38
+ description: descriptionBody(order.planDescription).bodyText, price: orderPrice(order), endDate, noEndDate: !endDate, dateLabel: periodEnd ? copyParam("subscriptionDetail.periodEnd", "Current period ends") : order.status === "CANCELED" ? copyParam("subscriptionDetail.endDate", "End date") : order.status === "ENDED" ? copyParam("mySubscriptions.expiredOn", "Expired on") : copyParam("mySubscriptions.validUntil", "Valid until"),
39
+ expired: ["ENDED", "CANCELED"].includes(order.status ?? "") };
40
+ }
41
+ async function readPage(state: S, reset: boolean): Promise<S | undefined> {
42
+ if (!reset && pending) return undefined;
43
+ const seq = reset ? ++sequence : sequence;
44
+ pending = true;
45
+ if (!reset) void svc.beginPage();
46
+ const member = await memberAccess();
47
+ const key = JSON.stringify([member.email, member.scope]);
48
+ if (seq !== sequence) return undefined;
49
+ if (key !== scope) { scope = key; offset = 0; state = initial(); void svc.clear(); }
50
+ if (!member.email) { pending = false; return guest(); }
51
+ try {
52
+ const start = reset ? 0 : offset;
53
+ const result = await listMyPlanOrders({ statuses: ["ACTIVE", "PENDING", "PAUSED", "CANCELED", "ENDED"], limit: 50, offset: start });
54
+ await assertMemberAccess(member);
55
+ if (seq !== sequence) return undefined;
56
+ const raw = result.orders ?? [];
57
+ offset = start + raw.length;
58
+ const rows = raw.filter(order => order.id && order.status !== "DRAFT").map(norm);
59
+ const allOrders = [...new Map([...(reset ? [] : state.allOrders), ...rows].map(row => [row.id, row])).values()];
60
+ return project({ ...state, status: "ready", allOrders, isLoading: false, notLoading: true, hideError: true, denied: false, hideAccountCta: true,
61
+ selectedTab: svc.getState().selectedTab, hideDeniedError: true, hideRetryError: true, nextCursor: raw.length === 50 ? String(offset) : "", pageError: false, loadingPage: false });
62
+ } catch (error) {
63
+ if (seq !== sequence) return undefined;
64
+ if (await memberChanged(member, error)) { scope = ""; void svc.clear(); void svc.load(); return undefined; }
65
+ // Wix refused the read as unauthenticated: the host's identity was stale or a visitor's, and Sign in is the fix.
66
+ if (isHttp401(error)) return guest();
67
+ state = project({ ...state, selectedTab: svc.getState().selectedTab });
68
+ const denied = memberAccessDenied(error);
69
+ if (denied) return { ...initial(), selectedTab: state.selectedTab, status: "error", emptyText: copyParam("mySubscriptions.accessDenied", "Subscriptions are unavailable for this account."), isLoading: false, notLoading: true, hideError: false, denied: true, hideDeniedError: false, hideRetryError: true };
70
+ return { ...state, status: "error", emptyText: copyParam("mySubscriptions.loadError", "Subscriptions could not be loaded."), isLoading: false, notLoading: true, hideError: false, denied: false, hideDeniedError: true, hideRetryError: false, hideEmpty: true, hideEmptyLoadMore: true, pageError: !reset && state.allOrders.length > 0, loadingPage: false };
71
+ } finally { if (seq === sequence) pending = false; }
72
+ }
73
+ const svc = defineService<S, {
74
+ clear: (s: S) => S; beginPage: (s: S) => S; load: (s: S, arg?: unknown) => Promise<S | undefined>;
75
+ retry: (s: S) => Promise<S | undefined>; nextPage: (s: S) => Promise<S | undefined>; selectTab: (s: S, arg?: unknown) => S;
76
+ }>("spacesMySubscriptions", {
77
+ state: initial(), notHydrated: Object.keys(initial()) as Array<keyof S>,
78
+ actions: {
79
+ clear: () => initial(),
80
+ beginPage: state => ({ ...state, loadingPage: true }),
81
+ load: (state, arg) => { stashCopy(arg); return readPage(state, true); },
82
+ retry: state => readPage(state, !state.pageError),
83
+ nextPage: state => state.nextCursor ? readPage(state, false) : Promise.resolve(undefined),
84
+ selectTab: (state, arg) => { const raw = typeof arg === "string" ? arg : (arg as { selectedId?: string; id?: string; value?: string })?.selectedId ?? (arg as { id?: string })?.id ?? (arg as { value?: string })?.value; return project({ ...state, selectedTab: raw === "expired" ? "expired" : "active" }); },
85
+ },
86
+ });
87
+ session.subscribe(() => { ++sequence; scope = ""; pending = false; void svc.clear(); void svc.load(); });
88
+ svc.load();
89
+ export { svc };
@@ -0,0 +1,139 @@
1
+ import { defineService } from "@himalaya/state";
2
+ import { getMyPlanOrder, requestCancellation, type WixPlanOrder } from "@himalaya/wix-pricing-plans";
3
+ import { hostSessionFromGlobal } from "@himalaya/iap";
4
+ import { memberAccess, assertMemberAccess, memberAccessDenied, memberChanged, type MemberAccess } from "../_shared/member-access.js";
5
+ import { orderDate, orderPrice, orderStatus, orderFacts } from "../_shared/pricing-plan-display.js";
6
+ import { presence, presenceAfterError, detailInputId, type PresenceFlags } from "../_shared/detail-presence.js";
7
+ import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
8
+
9
+ interface S extends PresenceFlags {
10
+ denied: boolean; hideDeniedError: boolean; notActive: boolean; isActive: boolean;
11
+ status: string; name: string; subtitle: string; price: string; validity: string;
12
+ facts: ReturnType<typeof orderFacts>; hideAccountCta: boolean;
13
+ hideCancel: boolean; hideConfirmation: boolean; showConfirmation: boolean; busy: boolean; noScheduledOption: boolean;
14
+ effectiveAt: string; confirmation: string; actionMessage: string; actionError: string; hasActionError: boolean; noActionError: boolean;
15
+ }
16
+ const initial = (): S => ({ denied: false, hideDeniedError: true, notActive: true, isActive: false, status: "loading", name: "", subtitle: "", price: "", validity: "", facts: [], hideAccountCta: true,
17
+ hideCancel: true, hideConfirmation: true, showConfirmation: false, busy: false, noScheduledOption: true, effectiveAt: "IMMEDIATELY", confirmation: "", actionMessage: "", actionError: "none", hasActionError: false, noActionError: true, ...presence("loading") });
18
+ let order: WixPlanOrder | null = null;
19
+ let sequence = 0;
20
+ let cancelInFlight = false;
21
+ const cancellationsSent = new Set<string>();
22
+ let orderMemberKey = "";
23
+ const memberKey = (member: MemberAccess): string => JSON.stringify([member.scope, member.email]);
24
+ const cancellationKey = (id: string, owner = orderMemberKey): string => JSON.stringify([owner, id]);
25
+ const session = hostSessionFromGlobal();
26
+ function canCancel(o: WixPlanOrder): boolean {
27
+ // The member API enforces the PURCHASED policy. Current public plan settings are not the
28
+ // historical policy, and an archived plan must not prevent canceling an existing order.
29
+ return Boolean(o.id) && ["ACTIVE", "PENDING", "PAUSED"].includes(o.status ?? "") && o.type !== "EXTERNAL"
30
+ && !o.autoRenewCanceled && o.cancellation?.effectiveAt !== "NEXT_PAYMENT_DATE";
31
+ }
32
+ function project(o: WixPlanOrder, message = ""): S {
33
+ const end = orderDate(o.earliestEndDate ?? o.endDate ?? o.currentCycle?.endedDate);
34
+ const scheduled = Boolean((o.pricing?.subscription ?? o.priceDetails?.subscription) && o.currentCycle?.endedDate && Date.parse(o.currentCycle.endedDate) > Date.now());
35
+ const renews = o.status === "ACTIVE" && scheduled ? orderDate(o.currentCycle?.endedDate) : "";
36
+ return { ...initial(), ...presence("found"), status: "ready", notActive: o.status !== "ACTIVE", isActive: o.status === "ACTIVE", name: o.planName || copyParam("subscriptionDetail.fallbackName", "Subscription"), subtitle: orderStatus(o), price: orderPrice(o),
37
+ validity: (o.earliestEndDate || o.autoRenewCanceled || o.cancellation?.effectiveAt === "NEXT_PAYMENT_DATE") && end ? copyTemplate("subscriptionDetail.scheduledEndMessage", "Your subscription ends on {date}.", { date: end }) : renews ? copyTemplate("placeSummary.planRenews", "Renews {date}", { date: renews }) : "",
38
+ facts: orderFacts(o), hideCancel: !canCancel(o) || cancellationsSent.has(cancellationKey(o.id)), noScheduledOption: !scheduled,
39
+ effectiveAt: scheduled ? "NEXT_PAYMENT_DATE" : "IMMEDIATELY", actionMessage: message };
40
+ }
41
+ function confirmation(effectiveAt: string): string {
42
+ const end = orderDate(order?.currentCycle?.endedDate);
43
+ return effectiveAt === "NEXT_PAYMENT_DATE" && end
44
+ ? copyTemplate("subscriptionDetail.cancelAtPeriodEndBody", "Request cancellation at the next payment date, {date}?", { date: end })
45
+ : copyParam("subscriptionDetail.cancelImmediatelyBody", "Request cancellation now? Your access can end immediately.");
46
+ }
47
+ async function load(_state: S, arg?: unknown): Promise<S | undefined> {
48
+ stashCopy(arg);
49
+ const seq = ++sequence;
50
+ if (order && order.id !== detailInputId()) { order = null; void svc.clear(); }
51
+ const member = await memberAccess();
52
+ if (seq !== sequence) return undefined;
53
+ if (!member.email) { order = null; return { ...initial(), status: "guest", subtitle: copyParam("mySubscriptions.guestBody", "Sign in to see your subscriptions."), hideAccountCta: false, ...presence("missing"), hideNotFound: true }; }
54
+ const id = detailInputId();
55
+ if (!id) return { ...initial(), status: "ready", subtitle: copyParam("subscriptionDetail.missingId", "Open a subscription from My Subscriptions."), ...presence("missing") };
56
+ try {
57
+ const result = await getMyPlanOrder(id);
58
+ await assertMemberAccess(member);
59
+ if (seq !== sequence) return undefined;
60
+ orderMemberKey = memberKey(member);
61
+ order = result.order;
62
+ if (!order?.id || order.status === "DRAFT") { order = null; return { ...initial(), status: "ready", ...presence("missing") }; }
63
+ return project(order, cancellationsSent.has(cancellationKey(order.id)) && canCancel(order) ? copyParam("subscriptionDetail.cancelPending", "Cancellation requested. Refresh to see the latest status.") : "");
64
+ } catch (error) {
65
+ if (seq !== sequence) return undefined;
66
+ order = null;
67
+ if (await memberChanged(member, error)) { void svc.clear(); void svc.load(); return undefined; }
68
+ const denied = memberAccessDenied(error);
69
+ const flags = presenceAfterError(error);
70
+ return { ...initial(), status: "ready", subtitle: copyParam("subscriptionDetail.loadError", "This subscription could not be loaded."), ...flags, denied, hideLoadError: denied || flags.hideLoadError, hideDeniedError: !denied };
71
+ }
72
+ }
73
+ type SubscriptionActions = {
74
+ beginCancel: (s: S) => S; clear: (s: S) => S; load: typeof load; requestCancel: (s: S) => S;
75
+ dismissCancel: (s: S) => S; chooseEffectiveAt: (s: S, arg?: unknown) => S;
76
+ confirmCancel: (s: S) => Promise<S | undefined>;
77
+ };
78
+ const svc: ReturnType<typeof defineService<S, SubscriptionActions>> = defineService<S, SubscriptionActions>("spacesSubscriptionDetail", {
79
+ state: initial(), notHydrated: Object.keys(initial()) as Array<keyof S>,
80
+ actions: {
81
+ beginCancel: state => ({ ...state, busy: true }),
82
+ clear: () => initial(), load,
83
+ requestCancel: state => !order || order.id !== detailInputId() || state.hideCancel || cancelInFlight ? state : { ...state, hideConfirmation: false, showConfirmation: true, actionMessage: "", actionError: "none", hasActionError: false, noActionError: true, confirmation: confirmation(state.effectiveAt) },
84
+ dismissCancel: state => cancelInFlight ? state : { ...state, hideConfirmation: true, showConfirmation: false },
85
+ chooseEffectiveAt: (state, arg) => {
86
+ if (cancelInFlight || state.hideConfirmation) return state;
87
+ const value = typeof arg === "string" ? arg : (arg as { value?: string; selectedId?: string })?.value ?? (arg as { selectedId?: string })?.selectedId;
88
+ const effectiveAt = value === "NEXT_PAYMENT_DATE" && !state.noScheduledOption ? value : "IMMEDIATELY";
89
+ return { ...state, effectiveAt, confirmation: confirmation(effectiveAt) };
90
+ },
91
+ confirmCancel: async (state): Promise<S | undefined> => {
92
+ if (state.hideConfirmation || state.hideCancel || !order || order.id !== detailInputId() || !canCancel(order) || cancelInFlight || cancellationsSent.has(cancellationKey(order.id))) return undefined;
93
+ cancelInFlight = true;
94
+ void svc.beginCancel();
95
+ const seq = sequence;
96
+ const id = order.id;
97
+ const isCurrent = (): boolean => seq === sequence && detailInputId() === id;
98
+ const member = await memberAccess();
99
+ const requestKey = cancellationKey(id, memberKey(member));
100
+ try {
101
+ if (!isCurrent()) return seq === sequence ? load(svc.getState()) : undefined;
102
+ await assertMemberAccess(member);
103
+ if (!isCurrent()) return seq === sequence ? load(svc.getState()) : undefined;
104
+ // Refresh policy/lifecycle facts before writing; never cancel a stale/other member order.
105
+ const latest = (await getMyPlanOrder(id)).order;
106
+ await assertMemberAccess(member);
107
+ if (!isCurrent()) return seq === sequence ? load(svc.getState()) : undefined;
108
+ if (!latest || !canCancel(latest)) { order = latest; return latest ? project(latest) : { ...initial(), ...presence("missing") }; }
109
+ if (state.effectiveAt === "NEXT_PAYMENT_DATE" && (!latest.currentCycle?.endedDate || Date.parse(latest.currentCycle.endedDate) <= Date.now())) {
110
+ order = latest; return { ...project(latest), actionMessage: copyParam("subscriptionDetail.changedBeforeCancel", "Your subscription changed. Review the details before canceling.") };
111
+ }
112
+ await requestCancellation(id, state.effectiveAt === "NEXT_PAYMENT_DATE" ? "NEXT_PAYMENT_DATE" : "IMMEDIATELY");
113
+ // An accepted write remains fenced for its original member even when a session
114
+ // change overtakes its response. Check ownership before publishing, not before
115
+ // remembering the acknowledgement; reads can still report ACTIVE afterward.
116
+ cancellationsSent.add(requestKey);
117
+ if (!isCurrent()) return load(svc.getState());
118
+ await assertMemberAccess(member);
119
+ if (!isCurrent()) return load(svc.getState());
120
+ const refreshed = (await getMyPlanOrder(id)).order;
121
+ await assertMemberAccess(member);
122
+ if (!isCurrent()) return load(svc.getState());
123
+ order = refreshed;
124
+ return project(refreshed, canCancel(refreshed) ? copyParam("subscriptionDetail.cancelPending", "Cancellation requested. Refresh to see the latest status.") : "");
125
+ } catch (error) {
126
+ if (!isCurrent()) return seq === sequence ? load(svc.getState()) : undefined;
127
+ if (await memberChanged(member, error)) { order = null; orderMemberKey = ""; void svc.clear(); void svc.load(); return undefined; }
128
+ if (!isCurrent()) return seq === sequence ? load(svc.getState()) : undefined;
129
+ return { ...state, busy: false, hideConfirmation: true, showConfirmation: false, actionError: cancellationsSent.has(requestKey) ? "cancelRefreshFailed" : memberAccessDenied(error) ? "cancelDenied" : "cancelFailed", hasActionError: true, noActionError: false, hideCancel: cancellationsSent.has(requestKey) || memberAccessDenied(error) || state.hideCancel,
130
+ actionMessage: cancellationsSent.has(requestKey) ? copyParam("subscriptionDetail.cancelRefreshFailed", "Cancellation requested, but the latest status could not be loaded. Refresh the details.")
131
+ : memberAccessDenied(error) ? copyParam("subscriptionDetail.cancelDenied", "This subscription cannot be canceled from this account. Contact the business for help.")
132
+ : copyParam("subscriptionDetail.cancelFailed", "Cancellation failed. Try again.") };
133
+ } finally { cancelInFlight = false; }
134
+ },
135
+ },
136
+ });
137
+ session.subscribe(() => { ++sequence; order = null; orderMemberKey = ""; void svc.clear(); void svc.load(); });
138
+ svc.load();
139
+ export { svc };