@wix/himalaya-cli 0.1749.0 → 0.1751.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +3 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/himi-package.d.ts +478 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/host-compatibility.d.ts +56 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/icon-catalog.generated.d.ts +1 -1
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +4 -0
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-shell.d.ts +156 -8
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validator.d.ts +3 -0
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/index.d.ts +2 -0
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/podcast-service.d.ts +105 -0
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/podcast.d.ts +116 -0
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +326 -13
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +730 -81
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +155 -0
  14. package/dist/browser-plane/assets.json +5 -5
  15. package/dist/browser-plane/preview-deferred/{b40ea5d0d6251898ff5617139fde8be008dd11e99a70b14c1052093685401700.bin → 21f35a12bd94f4ab97a9a75453c4adcadc438daf024a4b1950d5c356c123bd01.bin} +1 -1
  16. package/dist/browser-plane/sw.js +7 -7
  17. package/dist/cli.mjs +44618 -35753
  18. package/dist/preview-assets.generated.bin +0 -0
  19. package/guides/component-reference.json +1 -1
  20. package/guides/component-reference.md +4 -0
  21. package/guides/designing-himi-screens.md +7 -0
  22. package/guides/getting-started.md +5 -1
  23. package/guides/headless-loop.md +1 -1
  24. package/guides/himi-json-output.md +54 -1
  25. package/guides/himi-skill.md +5 -1
  26. package/guides/index.json +6 -0
  27. package/guides/one-app-to-himi-app.md +31 -8
  28. package/guides/qa-builds.md +12 -1
  29. package/guides/recipe-podcast.md +149 -0
  30. package/guides/skill.md +3 -1
  31. package/guides/store-submission.md +149 -34
  32. package/guides/tier-5-add-a-screen.md +16 -2
  33. package/guides/wix-business-context.md +43 -0
  34. package/guides/wix-platform-usage.md +7 -2
  35. package/package.json +10 -10
  36. package/template-icons/fitness-gym.png +0 -0
  37. package/template-icons/personal-fitness-trainer.png +0 -0
  38. package/templates/beauty-salon/config.ts +12 -0
  39. package/templates/beauty-salon/dev/index.ts +1 -1
  40. package/templates/beauty-salon/l10n/en.json +1 -1
  41. package/templates/beauty-salon/tier5-src/_shared/booking-session.ts +3 -1
  42. package/templates/beauty-salon/tier5-src/_shared/business-chat-transport.ts +148 -0
  43. package/templates/beauty-salon/tier5-src/_shared/header-badges.ts +113 -0
  44. package/templates/beauty-salon/tier5-src/_shared/location-pin.ts +97 -0
  45. package/templates/beauty-salon/tier5-src/_shared/member-access.ts +17 -6
  46. package/templates/beauty-salon/tier5-src/_shared/program-fields.ts +16 -0
  47. package/templates/beauty-salon/tier5-src/_shared/programs-section.ts +5 -8
  48. package/templates/beauty-salon/tier5-src/_shared/source-badges.ts +72 -0
  49. package/templates/beauty-salon/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  50. package/templates/beauty-salon/tier5-src/himi-branded-lite-nav/index.ts +152 -0
  51. package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +13 -4
  52. package/templates/beauty-salon/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  53. package/templates/branded-lite/config.ts +12 -0
  54. package/templates/branded-lite/dev/index.ts +101 -1
  55. package/templates/branded-lite/l10n/en.json +22 -1
  56. package/templates/branded-lite/l10n/es.json +22 -0
  57. package/templates/branded-lite/l10n/fr.json +23 -0
  58. package/templates/branded-lite/l10n/he.json +19 -0
  59. package/templates/branded-lite/tier5-src/_shared/booking-session.ts +3 -1
  60. package/templates/branded-lite/tier5-src/_shared/location-pin.ts +97 -0
  61. package/templates/branded-lite/tier5-src/_shared/member-access.ts +17 -6
  62. package/templates/branded-lite/tier5-src/_shared/program-fields.ts +16 -0
  63. package/templates/branded-lite/tier5-src/_shared/programs-section.ts +5 -8
  64. package/templates/branded-lite/tier5-src/himi-branded-lite-access-nav/index.ts +10 -5
  65. package/templates/branded-lite/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  66. package/templates/branded-lite/tier5-src/himi-branded-lite-nav/index.ts +152 -0
  67. package/templates/branded-lite/tier5-src/himi-branded-lite-podcasts/index.ts +14 -234
  68. package/templates/branded-lite/tier5-src/himi-branded-lite-video/index.ts +12 -1
  69. package/templates/branded-lite/tier5-src/himi-store-account/index.ts +13 -4
  70. package/templates/branded-lite/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  71. package/templates/brandy/README.md +33 -0
  72. package/templates/brandy/config.ts +51 -7
  73. package/templates/brandy/dev/index.ts +23 -9
  74. package/templates/community-club/l10n/en.json +1 -1
  75. package/templates/community-club/tier5-src/_shared/member-access.ts +17 -6
  76. package/templates/community-club/tier5-src/_shared/program-fields.ts +16 -0
  77. package/templates/community-club/tier5-src/_shared/programs-section.ts +5 -8
  78. package/templates/community-club/tier5-src/himi-store-account/index.ts +13 -4
  79. package/templates/community-club/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  80. package/templates/conference/tier5-src/_shared/member-access.ts +17 -6
  81. package/templates/conference/tier5-src/himi-store-account/index.ts +13 -4
  82. package/templates/events-meetups/l10n/en.json +1 -1
  83. package/templates/events-meetups/tier5-src/_shared/member-access.ts +17 -6
  84. package/templates/events-meetups/tier5-src/_shared/program-fields.ts +16 -0
  85. package/templates/events-meetups/tier5-src/_shared/programs-section.ts +5 -8
  86. package/templates/events-meetups/tier5-src/himi-store-account/index.ts +13 -4
  87. package/templates/events-meetups/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  88. package/templates/fitness-gym/README.md +53 -0
  89. package/templates/fitness-gym/config.ts +560 -0
  90. package/templates/fitness-gym/dev/index.ts +25787 -0
  91. package/templates/fitness-gym/himalaya.content.json +64 -0
  92. package/templates/fitness-gym/himalaya.template.json +15 -0
  93. package/templates/fitness-gym/icon.png +0 -0
  94. package/templates/fitness-gym/platforms.json +1 -0
  95. package/templates/fitness-gym/tier5-src/_shared/app-locale.ts +61 -0
  96. package/templates/fitness-gym/tier5-src/_shared/booking-location.ts +147 -0
  97. package/templates/fitness-gym/tier5-src/_shared/booking-session.ts +224 -0
  98. package/templates/fitness-gym/tier5-src/_shared/branded-lite-hosted.ts +280 -0
  99. package/templates/fitness-gym/tier5-src/_shared/branded-load-state.ts +109 -0
  100. package/templates/fitness-gym/tier5-src/_shared/business-chat-copy.ts +40 -0
  101. package/templates/fitness-gym/tier5-src/_shared/business-chat-history.ts +51 -0
  102. package/templates/fitness-gym/tier5-src/_shared/business-chat-message-model.ts +177 -0
  103. package/templates/fitness-gym/tier5-src/_shared/business-chat-model.ts +56 -0
  104. package/templates/fitness-gym/tier5-src/_shared/business-chat-presenter.ts +576 -0
  105. package/templates/fitness-gym/tier5-src/_shared/business-chat-transport.ts +148 -0
  106. package/templates/fitness-gym/tier5-src/_shared/collection-contract.ts +228 -0
  107. package/templates/fitness-gym/tier5-src/_shared/collection-query.ts +193 -0
  108. package/templates/fitness-gym/tier5-src/_shared/collection-service.ts +400 -0
  109. package/templates/fitness-gym/tier5-src/_shared/detail-presence.ts +51 -0
  110. package/templates/fitness-gym/tier5-src/_shared/engine-intl.ts +523 -0
  111. package/templates/fitness-gym/tier5-src/_shared/himi-account.ts +194 -0
  112. package/templates/fitness-gym/tier5-src/_shared/himi-booking-saved.ts +88 -0
  113. package/templates/fitness-gym/tier5-src/_shared/himi-bookings.ts +318 -0
  114. package/templates/fitness-gym/tier5-src/_shared/himi-copy.ts +116 -0
  115. package/templates/fitness-gym/tier5-src/_shared/himi-media.ts +29 -0
  116. package/templates/fitness-gym/tier5-src/_shared/himi-store.ts +7 -0
  117. package/templates/fitness-gym/tier5-src/_shared/himi-text.ts +24 -0
  118. package/templates/fitness-gym/tier5-src/_shared/host-events.ts +66 -0
  119. package/templates/fitness-gym/tier5-src/_shared/hosted-checkout.ts +70 -0
  120. package/templates/fitness-gym/tier5-src/_shared/iap-attendance-form.ts +106 -0
  121. package/templates/fitness-gym/tier5-src/_shared/iap-attendance-purchase.ts +216 -0
  122. package/templates/fitness-gym/tier5-src/_shared/iap-attendance.ts +38 -0
  123. package/templates/fitness-gym/tier5-src/_shared/iap-worker.ts +127 -0
  124. package/templates/fitness-gym/tier5-src/_shared/inbox-rooms.ts +68 -0
  125. package/templates/fitness-gym/tier5-src/_shared/local-preferences.ts +38 -0
  126. package/templates/fitness-gym/tier5-src/_shared/member-access.ts +63 -0
  127. package/templates/fitness-gym/tier5-src/_shared/member-account-routes.ts +52 -0
  128. package/templates/fitness-gym/tier5-src/_shared/member-bookings.ts +107 -0
  129. package/templates/fitness-gym/tier5-src/_shared/member-screen.ts +99 -0
  130. package/templates/fitness-gym/tier5-src/_shared/notification-target.ts +141 -0
  131. package/templates/fitness-gym/tier5-src/_shared/offset-page.ts +10 -0
  132. package/templates/fitness-gym/tier5-src/_shared/online-actions.ts +76 -0
  133. package/templates/fitness-gym/tier5-src/_shared/owner-load-error.ts +348 -0
  134. package/templates/fitness-gym/tier5-src/_shared/payment-setup.ts +6 -0
  135. package/templates/fitness-gym/tier5-src/_shared/pricing-plan-display.ts +64 -0
  136. package/templates/fitness-gym/tier5-src/_shared/program-description.ts +11 -0
  137. package/templates/fitness-gym/tier5-src/_shared/program-fields.ts +16 -0
  138. package/templates/fitness-gym/tier5-src/_shared/program-standing.ts +46 -0
  139. package/templates/fitness-gym/tier5-src/_shared/rich-body.ts +78 -0
  140. package/templates/fitness-gym/tier5-src/_shared/rich-content-link.ts +34 -0
  141. package/templates/fitness-gym/tier5-src/_shared/sign-in-sheet.ts +18 -0
  142. package/templates/fitness-gym/tier5-src/_shared/staff-name.ts +18 -0
  143. package/templates/fitness-gym/tier5-src/_shared/weekly-goal.ts +107 -0
  144. package/templates/fitness-gym/tier5-src/_shared/wix-bi.ts +85 -0
  145. package/templates/fitness-gym/tier5-src/_shared/wix-member-links.ts +114 -0
  146. package/templates/fitness-gym/tier5-src/_shared/wix-service-price.ts +146 -0
  147. package/templates/fitness-gym/tier5-src/business-chat/index.ts +732 -0
  148. package/templates/fitness-gym/tier5-src/business-contact/index.ts +6 -0
  149. package/templates/fitness-gym/tier5-src/himi-booking-account/index.ts +267 -0
  150. package/templates/fitness-gym/tier5-src/himi-booking-bookings/index.ts +468 -0
  151. package/templates/fitness-gym/tier5-src/himi-booking-service/index.ts +1190 -0
  152. package/templates/fitness-gym/tier5-src/himi-booking-services/index.ts +791 -0
  153. package/templates/fitness-gym/tier5-src/himi-booking-time/index.ts +1729 -0
  154. package/templates/fitness-gym/tier5-src/himi-branded-lite-agenda/index.ts +988 -0
  155. package/templates/fitness-gym/tier5-src/himi-branded-lite-member-programs/index.ts +656 -0
  156. package/templates/fitness-gym/tier5-src/himi-branded-lite-notifications/index.ts +256 -0
  157. package/templates/fitness-gym/tier5-src/himi-branded-lite-plans/index.ts +495 -0
  158. package/templates/fitness-gym/tier5-src/himi-branded-lite-program/facts.ts +52 -0
  159. package/templates/fitness-gym/tier5-src/himi-branded-lite-program/index.ts +845 -0
  160. package/templates/fitness-gym/tier5-src/himi-fitcoach-goal/index.ts +191 -0
  161. package/templates/fitness-gym/tier5-src/himi-fitcoach-home/index.ts +619 -0
  162. package/templates/fitness-gym/tier5-src/himi-store-account/index.ts +1007 -0
  163. package/templates/fitness-gym/tier5-src/wix-spaces-my-subscriptions/index.ts +84 -0
  164. package/templates/fitness-gym/tier5-src/wix-spaces-subscription-detail/index.ts +139 -0
  165. package/templates/fitness-gym/tokens.json +414 -0
  166. package/templates/gym-fitness/config.ts +12 -0
  167. package/templates/gym-fitness/dev/index.ts +1 -1
  168. package/templates/gym-fitness/l10n/en.json +1 -1
  169. package/templates/gym-fitness/tier5-src/_shared/booking-session.ts +3 -1
  170. package/templates/gym-fitness/tier5-src/_shared/business-chat-transport.ts +148 -0
  171. package/templates/gym-fitness/tier5-src/_shared/header-badges.ts +113 -0
  172. package/templates/gym-fitness/tier5-src/_shared/location-pin.ts +97 -0
  173. package/templates/gym-fitness/tier5-src/_shared/member-access.ts +17 -6
  174. package/templates/gym-fitness/tier5-src/_shared/program-fields.ts +16 -0
  175. package/templates/gym-fitness/tier5-src/_shared/programs-section.ts +5 -8
  176. package/templates/gym-fitness/tier5-src/_shared/source-badges.ts +72 -0
  177. package/templates/gym-fitness/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  178. package/templates/gym-fitness/tier5-src/himi-branded-lite-nav/index.ts +152 -0
  179. package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +13 -4
  180. package/templates/gym-fitness/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  181. package/templates/medical-services/dev/index.ts +2 -1
  182. package/templates/medical-services/tier5-src/_shared/booking-session.ts +3 -1
  183. package/templates/medical-services/tier5-src/_shared/member-access.ts +17 -6
  184. package/templates/medical-services/tier5-src/himi-booking-account/index.ts +16 -1
  185. package/templates/medical-services/tier5-src/himi-store-account/index.ts +13 -4
  186. package/templates/nonprofit-cause/l10n/en.json +1 -1
  187. package/templates/nonprofit-cause/tier5-src/_shared/member-access.ts +17 -6
  188. package/templates/nonprofit-cause/tier5-src/_shared/program-fields.ts +16 -0
  189. package/templates/nonprofit-cause/tier5-src/_shared/programs-section.ts +5 -8
  190. package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +13 -4
  191. package/templates/nonprofit-cause/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  192. package/templates/personal-fitness-trainer/README.md +51 -0
  193. package/templates/personal-fitness-trainer/config.ts +343 -0
  194. package/templates/personal-fitness-trainer/dev/index.ts +24813 -0
  195. package/templates/personal-fitness-trainer/himalaya.content.json +79 -0
  196. package/templates/personal-fitness-trainer/himalaya.template.json +14 -0
  197. package/templates/personal-fitness-trainer/icon.png +0 -0
  198. package/templates/personal-fitness-trainer/platforms.json +3 -0
  199. package/templates/personal-fitness-trainer/splash.json +3 -0
  200. package/templates/personal-fitness-trainer/tier5-src/_shared/app-locale.ts +61 -0
  201. package/templates/personal-fitness-trainer/tier5-src/_shared/booking-location.ts +147 -0
  202. package/templates/personal-fitness-trainer/tier5-src/_shared/booking-session.ts +224 -0
  203. package/templates/personal-fitness-trainer/tier5-src/_shared/branded-lite-hosted.ts +280 -0
  204. package/templates/personal-fitness-trainer/tier5-src/_shared/branded-load-state.ts +109 -0
  205. package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-copy.ts +40 -0
  206. package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-history.ts +51 -0
  207. package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-message-model.ts +177 -0
  208. package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-model.ts +56 -0
  209. package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-presenter.ts +576 -0
  210. package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-transport.ts +148 -0
  211. package/templates/personal-fitness-trainer/tier5-src/_shared/collection-contract.ts +228 -0
  212. package/templates/personal-fitness-trainer/tier5-src/_shared/collection-query.ts +193 -0
  213. package/templates/personal-fitness-trainer/tier5-src/_shared/collection-service.ts +400 -0
  214. package/templates/personal-fitness-trainer/tier5-src/_shared/detail-presence.ts +51 -0
  215. package/templates/personal-fitness-trainer/tier5-src/_shared/empty-flags.ts +33 -0
  216. package/templates/personal-fitness-trainer/tier5-src/_shared/engine-intl.ts +523 -0
  217. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-account.ts +194 -0
  218. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-booking-saved.ts +88 -0
  219. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-bookings.ts +318 -0
  220. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-copy.ts +116 -0
  221. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-layouts.ts +142 -0
  222. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-store.ts +7 -0
  223. package/templates/personal-fitness-trainer/tier5-src/_shared/himi-text.ts +24 -0
  224. package/templates/personal-fitness-trainer/tier5-src/_shared/host-events.ts +66 -0
  225. package/templates/personal-fitness-trainer/tier5-src/_shared/hosted-checkout.ts +70 -0
  226. package/templates/personal-fitness-trainer/tier5-src/_shared/iap-attendance-form.ts +106 -0
  227. package/templates/personal-fitness-trainer/tier5-src/_shared/iap-attendance-purchase.ts +216 -0
  228. package/templates/personal-fitness-trainer/tier5-src/_shared/iap-attendance.ts +38 -0
  229. package/templates/personal-fitness-trainer/tier5-src/_shared/iap-worker.ts +127 -0
  230. package/templates/personal-fitness-trainer/tier5-src/_shared/inbox-rooms.ts +68 -0
  231. package/templates/personal-fitness-trainer/tier5-src/_shared/local-preferences.ts +38 -0
  232. package/templates/personal-fitness-trainer/tier5-src/_shared/member-access.ts +63 -0
  233. package/templates/personal-fitness-trainer/tier5-src/_shared/member-account-routes.ts +52 -0
  234. package/templates/personal-fitness-trainer/tier5-src/_shared/member-bookings.ts +107 -0
  235. package/templates/personal-fitness-trainer/tier5-src/_shared/member-screen.ts +99 -0
  236. package/templates/personal-fitness-trainer/tier5-src/_shared/offset-page.ts +10 -0
  237. package/templates/personal-fitness-trainer/tier5-src/_shared/online-actions.ts +76 -0
  238. package/templates/personal-fitness-trainer/tier5-src/_shared/owner-load-error.ts +348 -0
  239. package/templates/personal-fitness-trainer/tier5-src/_shared/payment-setup.ts +6 -0
  240. package/templates/personal-fitness-trainer/tier5-src/_shared/pricing-plan-display.ts +64 -0
  241. package/templates/personal-fitness-trainer/tier5-src/_shared/rich-body.ts +78 -0
  242. package/templates/personal-fitness-trainer/tier5-src/_shared/rich-content-link.ts +34 -0
  243. package/templates/personal-fitness-trainer/tier5-src/_shared/sign-in-sheet.ts +18 -0
  244. package/templates/personal-fitness-trainer/tier5-src/_shared/staff-name.ts +18 -0
  245. package/templates/personal-fitness-trainer/tier5-src/_shared/video-caption.ts +21 -0
  246. package/templates/personal-fitness-trainer/tier5-src/_shared/weekly-goal.ts +107 -0
  247. package/templates/personal-fitness-trainer/tier5-src/_shared/wix-bi.ts +85 -0
  248. package/templates/personal-fitness-trainer/tier5-src/_shared/wix-service-price.ts +146 -0
  249. package/templates/personal-fitness-trainer/tier5-src/business-chat/index.ts +732 -0
  250. package/templates/personal-fitness-trainer/tier5-src/business-contact/index.ts +6 -0
  251. package/templates/personal-fitness-trainer/tier5-src/himi-booking-bookings/index.ts +468 -0
  252. package/templates/personal-fitness-trainer/tier5-src/himi-booking-service/index.ts +1190 -0
  253. package/templates/personal-fitness-trainer/tier5-src/himi-booking-services/index.ts +791 -0
  254. package/templates/personal-fitness-trainer/tier5-src/himi-booking-time/index.ts +1729 -0
  255. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +242 -0
  256. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/index.ts +1094 -0
  257. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-agenda/index.ts +988 -0
  258. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-appearance/index.ts +94 -0
  259. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-notifsettings/index.ts +173 -0
  260. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-plans/index.ts +495 -0
  261. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-splash/index.ts +35 -0
  262. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-video/index.ts +226 -0
  263. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-videos/index.ts +145 -0
  264. package/templates/personal-fitness-trainer/tier5-src/himi-fitness-trainer-home/index.ts +70 -0
  265. package/templates/personal-fitness-trainer/tier5-src/himi-fitness-trainer-profile/index.ts +53 -0
  266. package/templates/personal-fitness-trainer/tier5-src/himi-store-account/index.ts +1007 -0
  267. package/templates/personal-fitness-trainer/tier5-src/wix-spaces-app-language/index.ts +73 -0
  268. package/templates/personal-fitness-trainer/tier5-src/wix-spaces-delete-account/index.ts +59 -0
  269. package/templates/personal-fitness-trainer/tier5-src/wix-spaces-my-subscriptions/index.ts +84 -0
  270. package/templates/personal-fitness-trainer/tier5-src/wix-spaces-subscription-detail/index.ts +139 -0
  271. package/templates/personal-fitness-trainer/tier5-src/wix-spaces-view-profile/index.ts +119 -0
  272. package/templates/personal-fitness-trainer/tokens.json +381 -0
  273. package/templates/podcast-creator/dev/index.ts +100 -0
  274. package/templates/podcast-creator/l10n/en.json +22 -1
  275. package/templates/podcast-creator/l10n/es.json +22 -0
  276. package/templates/podcast-creator/l10n/fr.json +18 -0
  277. package/templates/podcast-creator/l10n/he.json +15 -0
  278. package/templates/podcast-creator/tier5-src/_shared/member-access.ts +17 -6
  279. package/templates/podcast-creator/tier5-src/_shared/program-fields.ts +16 -0
  280. package/templates/podcast-creator/tier5-src/_shared/programs-section.ts +5 -8
  281. package/templates/podcast-creator/tier5-src/himi-branded-lite-podcasts/index.ts +14 -234
  282. package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +13 -4
  283. package/templates/podcast-creator/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  284. package/templates/portfolio-creative/l10n/en.json +1 -1
  285. package/templates/portfolio-creative/tier5-src/_shared/member-access.ts +17 -6
  286. package/templates/portfolio-creative/tier5-src/_shared/program-fields.ts +16 -0
  287. package/templates/portfolio-creative/tier5-src/_shared/programs-section.ts +5 -8
  288. package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +13 -4
  289. package/templates/portfolio-creative/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  290. package/templates/restaurant/l10n/en.json +1 -1
  291. package/templates/restaurant/tier5-src/_shared/member-access.ts +17 -6
  292. package/templates/restaurant/tier5-src/_shared/program-fields.ts +16 -0
  293. package/templates/restaurant/tier5-src/_shared/programs-section.ts +5 -8
  294. package/templates/restaurant/tier5-src/himi-store-account/index.ts +13 -4
  295. package/templates/restaurant/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  296. package/templates/retail-store/l10n/en.json +1 -1
  297. package/templates/retail-store/tier5-src/_shared/member-access.ts +17 -6
  298. package/templates/retail-store/tier5-src/_shared/program-fields.ts +16 -0
  299. package/templates/retail-store/tier5-src/_shared/programs-section.ts +5 -8
  300. package/templates/retail-store/tier5-src/himi-store-account/index.ts +13 -4
  301. package/templates/retail-store/tier5-src/wix-spaces-view-profile/index.ts +68 -55
  302. package/templates/salon-spa/dev/index.ts +1 -1
  303. package/templates/salon-spa/tier5-src/_shared/booking-session.ts +3 -1
  304. package/templates/salon-spa/tier5-src/_shared/member-access.ts +17 -6
  305. package/templates/salon-spa/tier5-src/himi-booking-account/index.ts +16 -1
  306. package/templates/salon-spa/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  307. package/templates/salon-spa/tier5-src/himi-store-account/index.ts +13 -4
  308. package/templates/wholesale-store/tier5-src/_shared/member-access.ts +17 -6
  309. package/templates/wholesale-store/tier5-src/himi-store-account/index.ts +13 -4
  310. package/templates/yoga-studio/config.ts +12 -0
  311. package/templates/yoga-studio/dev/index.ts +1 -1
  312. package/templates/yoga-studio/l10n/en.json +1 -1
  313. package/templates/yoga-studio/tier5-src/_shared/booking-session.ts +3 -1
  314. package/templates/yoga-studio/tier5-src/_shared/business-chat-transport.ts +148 -0
  315. package/templates/yoga-studio/tier5-src/_shared/header-badges.ts +113 -0
  316. package/templates/yoga-studio/tier5-src/_shared/location-pin.ts +97 -0
  317. package/templates/yoga-studio/tier5-src/_shared/member-access.ts +17 -6
  318. package/templates/yoga-studio/tier5-src/_shared/program-fields.ts +16 -0
  319. package/templates/yoga-studio/tier5-src/_shared/programs-section.ts +5 -8
  320. package/templates/yoga-studio/tier5-src/_shared/source-badges.ts +72 -0
  321. package/templates/yoga-studio/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  322. package/templates/yoga-studio/tier5-src/himi-branded-lite-nav/index.ts +152 -0
  323. package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +13 -4
  324. package/templates/yoga-studio/tier5-src/wix-spaces-view-profile/index.ts +68 -55
@@ -0,0 +1,141 @@
1
+ // Where a tap on a member notification goes. The route table is DERIVED from the Wix member-link catalog
2
+ // (via the pinned copy in ./wix-member-links.ts), the one an app's push taps use, so a
3
+ // notification in the inbox opens exactly what the same notification opens as a push: each destination's canonical
4
+ // Himi screen, with the item id under `id` (branded-lite's `push.routes` is built the same way).
5
+ //
6
+ // Beyond the catalog there are a few links the One App registry and the Business Manager send that a member can
7
+ // receive, listed in EXTRA_ROUTES with where each was read (wix-private/mobile-modules at 7cdefdc557fb):
8
+ // blog wix-one-app-new-blog/src/services/get-deep-links.ts (the multi-site form of a post link)
9
+ // inbox mobile-apps-inbox/src/module/deepLinks.ts (a chatroom)
10
+ // stores, bookings, club
11
+ // hybrid-mobile-platform/src/pushNotifications/deepLinks.ts (links sent by the Business Manager,
12
+ // Ping automations and the owner app to a branded app's members)
13
+ // Loyalty, coupons and FAQ links are NOT here: the catalog records that no push reaches them, and a route for a
14
+ // link nothing sends is dead config that nobody notices.
15
+ //
16
+ // A link that matches no row is NOT guessed at: it falls back to the notification's web link (https only) or to
17
+ // a visible "can't open", never to a made-up screen. A screen the app does not have opens nothing, exactly as the
18
+ // same push tap would. Programs have no catalog entry and so fall back; add a row, and a test, when a real payload
19
+ // names one.
20
+
21
+ import { MEMBER_LINK_DESTINATIONS } from "./wix-member-links.js";
22
+
23
+ /** The notification's own link, as the Members Feed Viewer returns it. */
24
+ export interface NotificationLink {
25
+ webUrlData?: { webUrl?: string };
26
+ mobileData?: { data?: string };
27
+ }
28
+
29
+ export interface NotificationTarget {
30
+ screenId: string;
31
+ /** Screen arguments. Nav params are strings. */
32
+ args: Record<string, string>;
33
+ }
34
+
35
+ export type NotificationOpen =
36
+ | { kind: "screen"; target: NotificationTarget }
37
+ | { kind: "url"; url: string }
38
+ | { kind: "none" };
39
+
40
+ export interface Route {
41
+ /** `a/:name/b` — `:name` captures one segment; every other segment must match exactly. */
42
+ pattern: string;
43
+ screenId: string;
44
+ /** Capture name → screen argument name. `kind` and the like are fixed arguments. */
45
+ args?: Record<string, string>;
46
+ fixed?: Record<string, string>;
47
+ }
48
+
49
+ /** The catalog's links, each opening its destination's canonical screen with the item under `id`. The inbox
50
+ * itself is left out: a notification that points at the list has nowhere further to go. */
51
+ const CATALOG_ROUTES: readonly Route[] = MEMBER_LINK_DESTINATIONS
52
+ .filter((destination) => destination.id !== "notifications.list")
53
+ .flatMap((destination) => destination.matches.map((pattern): Route => ({
54
+ pattern,
55
+ screenId: destination.canonicalScreen,
56
+ ...(destination.screenParam ? { args: { [destination.screenParam]: "id" } } : {}),
57
+ })));
58
+
59
+ const CHATROOM = { screenId: "himi_chat_thread", args: { chatroomId: "id" }, fixed: { kind: "chatroom" } };
60
+
61
+ const EXTRA_ROUTES: readonly Route[] = [
62
+ { pattern: "blog/post/:metaSiteId/:postId", screenId: "himi_blog_post", args: { postId: "id" } },
63
+ { pattern: "inbox/chatroom-by-id/:chatroomId", ...CHATROOM },
64
+ { pattern: "inbox/conversation-by-chatroom-id/:chatroomId", ...CHATROOM },
65
+ { pattern: "stores/:metaSiteId/catalog-for-inbox/:productId", screenId: "himi_product", args: { productId: "id" } },
66
+ { pattern: "bookings/:metaSiteId/service/:serviceId/details", screenId: "himi_service", args: { serviceId: "id" } },
67
+ { pattern: "platform/club/:tabId/:metaSiteId", screenId: "himi_branded_home" },
68
+ ];
69
+
70
+ export const NOTIFICATION_ROUTES: readonly Route[] = [...CATALOG_ROUTES, ...EXTRA_ROUTES];
71
+
72
+ /** Every screen a notification link can open: what an app is asked about when it says which of them it serves. */
73
+ export const NOTIFICATION_SCREEN_IDS: readonly string[] = [...new Set(NOTIFICATION_ROUTES.map((route) => route.screenId))];
74
+
75
+ /** A captured id: a GUID, a slug or a short token. Anything else (an encoded separator, a space, an empty
76
+ * segment, a segment of only dots such as `..`) means the link is not one of ours, so it opens nothing. */
77
+ const SAFE_SEGMENT = /^(?!\.+$)[A-Za-z0-9._~-]{1,128}$/;
78
+
79
+ /** The path of a `<scheme>://<path>` link, without query or fragment. null when it is not one. */
80
+ function pathOf(link: string): string | null {
81
+ const body = link.trim().replace(/^[a-z][a-z0-9+.-]*:\/\//i, "").split(/[?#]/, 1)[0].replace(/^\/+|\/+$/g, "");
82
+ return body ? body : null;
83
+ }
84
+
85
+ function match(route: Route, segments: string[]): NotificationTarget | null {
86
+ const parts = route.pattern.split("/");
87
+ if (parts.length !== segments.length) return null;
88
+ const captured: Record<string, string> = {};
89
+ for (let i = 0; i < parts.length; i++) {
90
+ if (parts[i].startsWith(":")) {
91
+ if (!SAFE_SEGMENT.test(segments[i])) return null;
92
+ captured[parts[i].slice(1)] = segments[i];
93
+ } else if (parts[i] !== segments[i]) {
94
+ return null;
95
+ }
96
+ }
97
+ const args: Record<string, string> = { ...route.fixed };
98
+ for (const [capture, name] of Object.entries(route.args ?? {})) args[name] = captured[capture];
99
+ return { screenId: route.screenId, args };
100
+ }
101
+
102
+ /** The screen a `wix://` link opens, or null when no row of the table claims it. */
103
+ export function screenForLink(link: string | undefined): NotificationTarget | null {
104
+ const path = link ? pathOf(link) : null;
105
+ if (!path) return null;
106
+ const segments = path.split("/");
107
+ for (const route of NOTIFICATION_ROUTES) {
108
+ const target = match(route, segments);
109
+ if (target) return target;
110
+ }
111
+ return null;
112
+ }
113
+
114
+ /** Not every Tier-5 JS engine has `URL`, so a link is read by hand: `https://<host>[:port][/…]`, where the host
115
+ * is a dotted name of letters, digits and hyphens. Credentials (`user@`), a backslash, whitespace or any
116
+ * control character, and every other scheme (http, javascript:, data:, a custom scheme) are refused: a
117
+ * notification's web link is written by the site, so it is not trusted to run anything. */
118
+ const HTTPS_LINK = /^https:\/\/([A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)+)(?::\d{1,5})?(?:[/?#][^\s\\\u0000-\u001f\u007f]*)?$/;
119
+
120
+ /** An https link, or null. */
121
+ export function safeWebUrl(raw: string | undefined): string | null {
122
+ const url = raw?.trim() ?? "";
123
+ // The cap keeps the match cheap on a hostile, site-written value.
124
+ return url.length <= 2048 && HTTPS_LINK.test(url) ? url : null;
125
+ }
126
+
127
+ /** The host of a link `safeWebUrl` accepted, for showing the member where a tap goes. */
128
+ export function urlHost(url: string): string {
129
+ return HTTPS_LINK.exec(url)?.[1] ?? "";
130
+ }
131
+
132
+ /** What a tap on this notification does. A recognised app link wins over the web link: a native screen is the
133
+ * intent, and the web link is only the way out for a notification that names no screen of ours. */
134
+ export function notificationOpen(link: NotificationLink | undefined, served?: ReadonlySet<string>): NotificationOpen {
135
+ const target = screenForLink(link?.mobileData?.data);
136
+ // `served` is the screens this app actually has: a link to one it lacks (an order link in an app without the Store) is
137
+ // not opened, and falls to the web link or the visible "can't open", exactly like a link no row claims.
138
+ if (target && (!served || served.has(target.screenId))) return { kind: "screen", target };
139
+ const url = safeWebUrl(link?.webUrlData?.webUrl);
140
+ return url ? { kind: "url", url } : { kind: "none" };
141
+ }
@@ -0,0 +1,10 @@
1
+ /** Offset APIs keep the offset opaque to collection UI. Advance by raw rows,
2
+ * never by a member/status-filtered projection. A full page without a total is
3
+ * deliberately incomplete until a subsequent (possibly empty) page confirms it. */
4
+ export function offsetPage(cursor: string, count: number, limit: number, metadata?: { total?: number }) {
5
+ const offset = cursor ? Number(cursor) : 0;
6
+ if (!Number.isSafeInteger(offset) || offset < 0) throw new Error("Invalid page offset");
7
+ const total = typeof metadata?.total === "number" && Number.isFinite(metadata.total) && metadata.total >= 0 ? metadata.total : undefined;
8
+ const next = offset + count;
9
+ return { nextCursor: count > 0 && (total === undefined ? count >= limit : next < total) ? String(next) : "", ...(total === undefined ? {} : { total }) };
10
+ }
@@ -0,0 +1,76 @@
1
+ import { connectivity, defineService as register, type ServiceDefinition } from '@himalaya/state';
2
+
3
+ // Template generation enables this behavior only in the selected two starter families.
4
+ export const offlineWritesEnabled = false;
5
+
6
+ export const offlineWriteMessage = 'You’re offline. Connect to save this change, then submit it again.';
7
+
8
+ /** The guard runs before the reducer: entered values survive and no optimistic
9
+ * changes, success state, or queued writes can occur. It never submits on reconnect. */
10
+ export function offlineWriteState<S extends object>(state: S): S {
11
+ const next: Record<string, unknown> = { ...state, error: offlineWriteMessage, message: offlineWriteMessage };
12
+ for (const key of ['saving', 'isSaving', 'submitting', 'isSubmitting', 'adding', 'added', 'bookingInFlight']) {
13
+ if (key in next) next[key] = false;
14
+ }
15
+ for (const key of ['savedMessage', 'successMessage']) {
16
+ if (key in next) next[key] = '';
17
+ }
18
+ // A saved/favourited item is business state, not a submission-success flag.
19
+ return next as S;
20
+ }
21
+
22
+ interface OfflineWriteOptions<S> {
23
+ derive?: (state: S) => S;
24
+ /** Exempt only non-mutating branches of a registered action. */
25
+ requiresConnectivity?: (action: string, state: S, argument?: unknown) => boolean;
26
+ messageFields?: readonly string[] | ((action: string) => readonly string[]);
27
+ draftFields?: readonly string[] | Readonly<Record<string, string>>;
28
+ secretFields?: readonly string[];
29
+ }
30
+
31
+ export function withOnlineWrites<S extends object>(registerService: typeof register, names: readonly string[], options: OfflineWriteOptions<S> = {}): typeof register {
32
+ if (!offlineWritesEnabled) return registerService;
33
+ return ((name: string, definition: ServiceDefinition<Record<string, unknown>>) => {
34
+ let currentState: (() => Record<string, unknown>) | undefined;
35
+ const handle = registerService(name, {
36
+ ...definition,
37
+ notHydrated: [...new Set([...(definition.notHydrated ?? []), ...(options.secretFields ?? [])])],
38
+ actions: Object.fromEntries(Object.entries(definition.actions ?? {}).map(([action, reduce]) => [action,
39
+ (state: Record<string, unknown>, ...args: never[]) => {
40
+ if (!names.includes(action)) return reduce(state, ...args);
41
+ if (options.requiresConnectivity?.(action, state as S, args[0]) === false) return reduce(state, ...args);
42
+ const fields = typeof options.messageFields === 'function' ? options.messageFields(action) : options.messageFields ?? ['message'];
43
+ if (connectivity().online) {
44
+ let cleared = false;
45
+ for (const field of ['error', 'message', ...fields]) {
46
+ if (state[field] === offlineWriteMessage) { state[field] = ''; cleared = true; }
47
+ }
48
+ // Keep the runtime's state object: reducers may mutate it and return undefined.
49
+ const result = reduce(state, ...args);
50
+ if (!cleared) return result;
51
+ // Publish cleared feedback even for a void reducer. An async completion must
52
+ // keep any newer state published by another action while it was awaiting.
53
+ const finish = (next: Record<string, unknown> | undefined) => next === undefined ? currentState?.() ?? state : next;
54
+ return result && typeof (result as Promise<unknown>).then === 'function'
55
+ ? Promise.resolve(result).then(finish)
56
+ : finish(result as Record<string, unknown> | undefined);
57
+ }
58
+ const draft = { ...state };
59
+ const argument = args[0] as Record<string, unknown> | undefined;
60
+ const draftFields = options.draftFields ?? [];
61
+ const entries = Array.isArray(draftFields) ? draftFields.map(key => [key, key]) : Object.entries(draftFields);
62
+ for (const [key, source] of entries) {
63
+ if (argument && key in state && typeof argument[source] === typeof state[key]) draft[key] = argument[source];
64
+ }
65
+ for (const key of options.secretFields ?? []) draft[key] = '';
66
+ const feedback = Object.fromEntries(fields.map(key => [key, offlineWriteMessage]));
67
+ let next = { ...offlineWriteState(draft), ...feedback };
68
+ if (options.derive) next = options.derive(next as S) as Record<string, unknown>;
69
+ return { ...next, ...feedback };
70
+ },
71
+ ])),
72
+ });
73
+ if (typeof handle.getState === 'function') currentState = () => handle.getState();
74
+ return handle;
75
+ }) as typeof register;
76
+ }
@@ -0,0 +1,348 @@
1
+ import { copyParam } from "./himi-copy.js";
2
+
3
+ /** Host-owned preview input. Absent on native and older hosts.
4
+ *
5
+ * `"sample"` — the built-in demo records; `"live"` — the viewer's own business over the
6
+ * owner rung; `"fixtures"` — a DEV web host over a sealed hermetic gateway, where
7
+ * the dev fixtures are the sample data. `"fixtures"` is neither live nor demo, so a
8
+ * worker READS through the bridge as it does on a device; it is still a preview host
9
+ * (`isOwnerPreviewHost`), so failure copy may name the web preview. */
10
+ function ownerPreviewMode(): unknown {
11
+ return (globalThis as unknown as { himalaya?: { input?: Record<string, unknown> } }).himalaya?.input?.__himiOwnerPreview;
12
+ }
13
+
14
+ export function isOwnerPreviewLive(): boolean {
15
+ return ownerPreviewMode() === "live";
16
+ }
17
+
18
+ /**
19
+ * Whether we are in the web preview AT ALL — i.e. the host declared a mode.
20
+ *
21
+ * `isBridgeUnavailable` cannot answer this: it reads "not live" as "preview",
22
+ * and on NATIVE there is no input at all, so `undefined` satisfies it. That is
23
+ * left alone for the other apps that use it to pick a demo fallback or to queue
24
+ * a write. Owner-lite reads ask `ownerDemoFallback` instead. It is NOT
25
+ * harmless for choosing COPY: native workers format their failures the same way (`"HTTP \(code): \(body)"`, JSWorker.swift;
26
+ * `"HTTP ${e.code}: ..."`, WebViewJSWorker.kt), so a transient `HTTP 503` on a
27
+ * phone would otherwise be answered with "open this app on a device" — on the
28
+ * device. Callers that pick a SENTENCE ask this instead.
29
+ */
30
+ export function isOwnerPreviewHost(): boolean {
31
+ return ownerPreviewMode() !== undefined;
32
+ }
33
+
34
+ export function isOwnerPreviewDemo(): boolean {
35
+ return ownerPreviewMode() === "sample";
36
+ }
37
+
38
+ /** Legacy hosts can still request the old demo fallback. An explicit live
39
+ * preview must never replace an authentication failure or outage with samples. */
40
+ export function isBridgeUnavailable(e: unknown): boolean {
41
+ if (ownerPreviewMode() === "live") return false;
42
+ return /HTTP (405|501|502|503)\b/.test(String((e as Error)?.message ?? e));
43
+ }
44
+
45
+ /**
46
+ * Whether a failed owner-lite READ may answer with the built-in demo records.
47
+ *
48
+ * Only where a demo was asked for: a web preview host that is not live. On a phone no
49
+ * mode is injected, so `isBridgeUnavailable` alone is `true` for a transient Wix
50
+ * `HTTP 503` — and the owner was shown sample appointments, orders and sites as if
51
+ * they were their business. Native falls through to the screen's error state.
52
+ * `isBridgeUnavailable` keeps its semantics: other apps' callers depend on it.
53
+ */
54
+ export function ownerDemoFallback(e: unknown): boolean {
55
+ return isOwnerPreviewHost() && !isOwnerPreviewLive() && isBridgeUnavailable(e);
56
+ }
57
+
58
+ /**
59
+ * The sentence for an owner WRITE that failed because the device could not reach Wix at
60
+ * all (a transport failure). Nothing replays a queued write on any platform — every host's
61
+ * `drain` passes an empty closure — so the honest answer is that nothing was saved.
62
+ * Copy-as-configuration under `ownerCommon.`, which every owner screen forwards.
63
+ */
64
+ export function ownerOfflineNotSaved(): string {
65
+ return copyParam(
66
+ "ownerCommon.offlineNotSaved",
67
+ "You’re offline — nothing was saved. Try again when you reconnect.",
68
+ );
69
+ }
70
+
71
+ /** The sentence for an owner WRITE that Wix answered with an unavailable status: the
72
+ * device is online, so it is not "offline" — but nothing was saved all the same. */
73
+ /**
74
+ * Whether a failed WRITE may have landed on Wix anyway, so the user must not be told it
75
+ * was not saved: a transport failure mid-request (timeout, reset, fetch rejection), the web
76
+ * host's after-send envelope (`HTTP 502 {…"sent":true}`), the serve bridge's mid-request
77
+ * `webwix_bridge_upstream_failed`, or a gateway status (502/503/504) that can arrive after
78
+ * the backend already ran. Only connect-time failures (`isOfflineFailure`) and the designed
79
+ * 405/501 bridge refusals prove nothing happened.
80
+ */
81
+ export function writeMayHaveLanded(e: unknown): boolean {
82
+ if (isOfflineFailure(e)) return false;
83
+ if (isTransportFailure(e)) return true;
84
+ const msg = String((e as Error)?.message ?? e ?? "");
85
+ if (/"sent"\s*:\s*true/.test(msg)) return true;
86
+ // The web host's own envelope WITHOUT `sent: true` failed before the request left it, and
87
+ // a disabled owner rung / bridge refuses by design without sending anything.
88
+ if (/\bwebwix_(?:direct_failed|owner_disabled|bridge_disabled)\b/.test(msg)) return false;
89
+ // `webwix_bridge_upstream_failed` stays ambiguous: the same code covers a lookup that failed
90
+ // before sending and a serve-bridge failure mid-request, and nothing in it says which.
91
+ return /\bwebwix_bridge_upstream_failed\b/.test(msg) || /HTTP (502|503|504)\b/.test(msg);
92
+ }
93
+
94
+ /** Wix answered that the record does not exist (`HTTP 404`). A detail must not fall back to
95
+ * its cached row then: that row is what a delete whose reply was lost leaves behind. */
96
+ export function isNotFound(e: unknown): boolean {
97
+ if (/HTTP 404\b/.test(String((e as Error)?.message ?? e ?? ""))) return true;
98
+ // An SDK that answers a 404 with its own "not found" error keeps the HTTP one as `cause`
99
+ // (the blog SDK's getPost, after its query fallback also finds nothing).
100
+ const cause = (e as { cause?: unknown } | null | undefined)?.cause;
101
+ return cause !== undefined && cause !== e && /HTTP 404\b/.test(String((cause as Error)?.message ?? cause));
102
+ }
103
+
104
+ export function ownerUnavailableNotSaved(): string {
105
+ return copyParam(
106
+ "ownerCommon.unavailableNotSaved",
107
+ "Wix isn’t available right now — nothing was saved. Try again in a moment.",
108
+ );
109
+ }
110
+
111
+ /** The sentence for an owner WRITE that may have landed (`writeMayHaveLanded`): it can't
112
+ * be called saved or not saved. */
113
+ export function ownerWriteUnconfirmed(): string {
114
+ return copyParam(
115
+ "ownerCommon.writeUnconfirmed",
116
+ "Wix didn’t confirm this, so it may or may not have been saved. Check before trying again.",
117
+ );
118
+ }
119
+
120
+ /** Display copy for a failed owner write: `ownerOfflineNotSaved` when the request never
121
+ * left the device, `ownerWriteUnconfirmed` when it may have landed, `ownerUnavailableNotSaved`
122
+ * for the designed 405/501 bridge refusals outside a live preview, else `ownerLoadError`. */
123
+ export function ownerWriteError(e: unknown): string {
124
+ if (isOfflineFailure(e)) return ownerOfflineNotSaved();
125
+ if (writeMayHaveLanded(e)) return ownerWriteUnconfirmed();
126
+ if (!isOwnerPreviewLive() && /HTTP (405|501)\b/.test(String((e as Error)?.message ?? e))) return ownerUnavailableNotSaved();
127
+ return ownerLoadError(e);
128
+ }
129
+
130
+ /** `HTTP 403: …` → "403", when the message carries a status at all. */
131
+ const STATUS = /HTTP (\d{3})\b/;
132
+ /** A wire body that is an HTML DOCUMENT, not a message. */
133
+ const HTML_BODY = /<!DOCTYPE html|<html[\s>]|<head[\s>]/i;
134
+ /** A wire body that is a JSON ENVELOPE, not a message. The serve bridge answers
135
+ * its typed refusals this way — `HTTP 501: {"error":"webwix_owner_no_session",
136
+ * "app":"…"}` — and it is short enough to slip under MAX_RAW, so truncation
137
+ * never caught it and the owner read the machine's word for it. */
138
+ const JSON_BODY = /HTTP \d{3}:\s*[[{]/;
139
+ /** `HTTP <status> [SERVICE_CODE]: message` — the shape a Wix service uses when
140
+ * it refuses with a named reason. */
141
+ const CODED = /HTTP (\d{3}) \[([A-Z0-9_]+)\]/;
142
+ /**
143
+ * The codes that all mean one thing to an owner: the session cannot address this
144
+ * business. Found on a real session whose account did not own the business the app
145
+ * had persisted — Home rendered
146
+ * `HTTP 428 [MISSING_METASITE_ID]: Couldn't extract metasiteId from the request
147
+ * context` where "6 orders" belongs.
148
+ */
149
+ const SITE_CONTEXT_CODES = ["MISSING_METASITE_ID", "MISSING_REQUEST_SITE_CONTEXT", "MISSING_SITE_CONTEXT"];
150
+ /** Longest raw upstream text worth showing. Beyond this it stops being a
151
+ * message and starts being a payload dump. */
152
+ const MAX_RAW = 200;
153
+
154
+ /**
155
+ * A TRANSPORT failure: the request never got an HTTP answer at all.
156
+ *
157
+ * Each host describes one in its own platform's words, and every one of them is a
158
+ * diagnostic dump rather than a message. iOS's JSWorker hands a worker the Swift
159
+ * description of the `NSError` —
160
+ * `Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server."
161
+ * UserInfo={… NSErrorFailingURLStringKey=http://127.0.0.1:8178/__dev/wix/proxy, …}`
162
+ * — which Aria painted verbatim: the domain, the code, and the local server's
163
+ * own URL. Android's bridge carries the `java.net` exception text, and a browser's
164
+ * fetch rejects with "Failed to fetch" / "Load failed" / "NetworkError …".
165
+ *
166
+ * Only a message with NO HTTP status qualifies: a status means Wix answered, and
167
+ * that case keeps its own reductions below.
168
+ */
169
+ const TRANSPORT = [
170
+ /\bError Domain=\w+/, // any Cocoa NSError description
171
+ /\bNSURLErrorDomain\b/,
172
+ /\bjava\.(?:net|io)\.\w+(?:Exception|Error)\b/,
173
+ /\b(?:UnknownHost|Connect|SocketTimeout|NoRouteToHost|SSLHandshake)Exception\b/,
174
+ // Android's WebViewJSWorker bridges `e.message ?: e.javaClass.simpleName`, so
175
+ // the class name is usually absent and only OkHttp's own message arrives.
176
+ /^Failed to connect to \S/,
177
+ /^Unable to resolve host\b/,
178
+ /\b(?:Connection refused|Network is unreachable|Software caused connection abort)\b/,
179
+ // OkHttp / HttpURLConnection messages a dropped connection produces mid-request, which
180
+ // Android's bridge forwards without the exception class.
181
+ /\b(?:Connection reset|ECONNRESET|ETIMEDOUT|EPIPE|Broken pipe|stream was reset)\b/,
182
+ /^unexpected end of stream\b/i,
183
+ /^(?:timeout|Read timed out|connect timed out)$/i,
184
+ /\bFailed to fetch\b/,
185
+ /\bNetworkError when attempting to fetch\b/,
186
+ /^(?:TypeError: )?Load failed$/,
187
+ /\bnet::ERR_[A-Z_]+/,
188
+ ];
189
+
190
+ /** Did this failure happen below HTTP — no answer from Wix at all? */
191
+ export function isTransportFailure(e: unknown): boolean {
192
+ const msg = String((e as Error)?.message ?? e ?? "");
193
+ if (STATUS.test(msg)) return false;
194
+ return TRANSPORT.some((re) => re.test(msg));
195
+ }
196
+
197
+ /** A failed READ says nothing about the record's existence when Wix is
198
+ * unreachable, overloaded or failing. Unlike the legacy bridge predicate this
199
+ * is independent of preview mode; a live preview's gateway failure is one too. */
200
+ export function readWasUnreachable(e: unknown): boolean {
201
+ const msg = String((e as Error)?.message ?? e ?? "");
202
+ return isTransportFailure(e) || /HTTP (?:408|429|5\d{2})\b/.test(msg);
203
+ }
204
+
205
+ /** Transport failures that happen while CONNECTING — no connection, no route, no such host,
206
+ * connection refused — so the request provably never left the device. Every other
207
+ * transport failure (a timeout, a reset, a bad or truncated response, a browser's fetch
208
+ * rejection, which says nothing about when it failed) may come after Wix took the write. */
209
+ const NEVER_SENT = [
210
+ /\bNSURLErrorDomain Code=-10(?:09|04|03|06|20|18)\b/, // not connected / cannot connect / no host / DNS / data not allowed / roaming off
211
+ /\b(?:UnknownHost|Connect|NoRouteToHost)Exception\b/,
212
+ /^Failed to connect to \S/,
213
+ /^Unable to resolve host\b/,
214
+ /\b(?:Connection refused|Network is unreachable)\b/,
215
+ /\bnet::ERR_(?:INTERNET_DISCONNECTED|NAME_NOT_RESOLVED|CONNECTION_REFUSED|ADDRESS_UNREACHABLE|NETWORK_ACCESS_DENIED)\b/,
216
+ ];
217
+
218
+ /** No HTTP answer, and the request provably never left the device: the user is offline, and
219
+ * a write certainly did not happen. Anything else may have landed (see `NEVER_SENT`). */
220
+ export function isOfflineFailure(e: unknown): boolean {
221
+ if (!isTransportFailure(e)) return false;
222
+ const msg = String((e as Error)?.message ?? e ?? "");
223
+ return NEVER_SENT.some((re) => re.test(msg));
224
+ }
225
+
226
+ /** The one sentence for a transport failure. Copy-as-configuration: the key is
227
+ * under `ownerCommon.`, which every owner screen (Aria included) forwards. */
228
+ export function ownerTransportFailureText(): string {
229
+ return copyParam(
230
+ "ownerCommon.networkUnreachable",
231
+ "Couldn’t reach Wix. Check your connection and try again.",
232
+ );
233
+ }
234
+
235
+ /**
236
+ * Reduce a wire failure to something a PERSON can read.
237
+ *
238
+ * Wix's edge answers some failures with a full HTML error page rather than JSON
239
+ * — a `403 Error: Forbidden | Wix.com` document. `ownerLoadError` used to return
240
+ * the raw body, so the Orders screen rendered an entire `<!DOCTYPE html>…<head>…`
241
+ * document as its error message (seen on iOS, and the same worker code runs on
242
+ * every surface). Keep the STATUS, which is the diagnosable part, and drop the
243
+ * markup; a long non-HTML body is truncated for the same reason.
244
+ */
245
+ function humanWireError(msg: string): string {
246
+ if (isTransportFailure(msg)) return ownerTransportFailureText();
247
+ const status = STATUS.exec(msg)?.[1];
248
+ // A JSON ENVELOPE or a NAMED REASON CODE is the machine's word for it, and the
249
+ // owner gets neither. Both reductions used to live in `ownerDisplayError` only,
250
+ // on the belief that this function's output was parsed downstream — see the note
251
+ // on `ownerLoadError`, which records why that was wrong and how it was checked.
252
+ if (JSON_BODY.test(msg) && status) {
253
+ return copyParam(
254
+ "ownerCommon.upstreamStatus",
255
+ `Wix returned an error (HTTP ${status}). Try again in a moment.`,
256
+ );
257
+ }
258
+ const coded = CODED.exec(msg);
259
+ if (coded) {
260
+ if (SITE_CONTEXT_CODES.includes(coded[2])) {
261
+ return copyParam(
262
+ "ownerCommon.noSiteContext",
263
+ "This business isn’t available to your Wix account right now. Switch business, or sign in again as its owner.",
264
+ );
265
+ }
266
+ return copyParam(
267
+ "ownerCommon.upstreamStatus",
268
+ `Wix returned an error (HTTP ${coded[1]}). Try again in a moment.`,
269
+ );
270
+ }
271
+ if (HTML_BODY.test(msg)) {
272
+ if (status === "403") {
273
+ return copyParam(
274
+ "ownerCommon.forbidden",
275
+ "This account isn’t permitted to read that. Check the site’s permissions for your Wix user, then try again.",
276
+ );
277
+ }
278
+ return copyParam(
279
+ "ownerCommon.upstreamHtml",
280
+ status ? `Wix returned an error (HTTP ${status}). Try again in a moment.` : "Wix returned an unreadable error. Try again in a moment.",
281
+ );
282
+ }
283
+ return msg.length > MAX_RAW ? `${msg.slice(0, MAX_RAW).trimEnd()}…` : msg;
284
+ }
285
+
286
+ /**
287
+ * The one sentence every owner screen gives for the DESIGNED bridge boundary.
288
+ *
289
+ * Copy-as-configuration (himi-copy): the key lives under the `ownerCommon.`
290
+ * prefix the dev module forwards to all owner screens, so one pack retitles it
291
+ * everywhere. With no pack this returns the stock copy verbatim.
292
+ */
293
+ export function ownerPreviewUnavailable(): string {
294
+ return copyParam(
295
+ "ownerCommon.bridgeUnavailable",
296
+ "Owner data isn’t available in the web preview — open this app on a device (▦ Open on phone) and sign in as the site owner.",
297
+ );
298
+ }
299
+
300
+ /**
301
+ * `ownerLoadError` for a screen that does nothing but RENDER the string.
302
+ *
303
+ * One difference left, and it is about WHERE the app is rather than what the
304
+ * error says: this names the web preview when there IS one. `isBridgeUnavailable`
305
+ * reads "not live" as "preview", and native injects no mode at all, so the
306
+ * default would answer a device-side `HTTP 503` with "open this app on a device"
307
+ * — on the device. That predicate is deliberately left alone: other apps'
308
+ * demo and write-queue decisions depend on exactly it.
309
+ *
310
+ * The reductions this used to add are now in `humanWireError`, so every owner
311
+ * screen gets them rather than the two that happened to call this.
312
+ */
313
+ export function ownerDisplayError(e: unknown): string {
314
+ if (isOwnerPreviewHost() && isBridgeUnavailable(e)) return ownerPreviewUnavailable();
315
+ return humanWireError(String((e as Error)?.message ?? e));
316
+ }
317
+
318
+ /**
319
+ * The default. Reduces the same shapes as `ownerDisplayError`.
320
+ *
321
+ * It used to reduce LESS, on the stated grounds that its output is parsed
322
+ * downstream — "the products worker matches `CATALOG_V3_CALLING_CATALOG_V1_API`
323
+ * in it to choose its v1 fallback". **That was not true**, and it cost 17 owner
324
+ * screens their error copy: they printed `HTTP 428 [MISSING_METASITE_ID]: …`
325
+ * verbatim for a contract that does not exist.
326
+ *
327
+ * Checked before changing it, and worth recording so nobody restores the belief:
328
+ *
329
+ * • the catalog v1/v3 decision is made INSIDE the Wix stores SDK, on the RAW
330
+ * thrown error — its `catalogVersionFromMismatch` reads the error's own
331
+ * `message`, and only that module calls it. It never sees this function's
332
+ * output.
333
+ * • `CATALOG_V3_CALLING_CATALOG_V1_API` appears nowhere else in the codebase
334
+ * outside comments, tests and that one SDK module.
335
+ * • the collection framework's `clearOnError` is handed the RAW error
336
+ * (`error => /401|403|forbidden/i.test(String(error))`), separately from
337
+ * `errorMessage: ownerLoadError` — so the one place that does match on a
338
+ * failure is unaffected by what this returns.
339
+ *
340
+ * So: the raw error remains available to logic everywhere it was; this function's
341
+ * result is display copy, and now reads like it.
342
+ */
343
+ export function ownerLoadError(e: unknown): string {
344
+ const msg = String((e as Error)?.message ?? e);
345
+ // Same host guard as `ownerDisplayError`: on a phone, "open this app on a device" is false.
346
+ if (isOwnerPreviewHost() && isBridgeUnavailable(e)) return ownerPreviewUnavailable();
347
+ return humanWireError(msg);
348
+ }
@@ -0,0 +1,6 @@
1
+ import { copyParam } from "./himi-copy.js";
2
+
3
+ /** No provider or country guess: Wix only established that online payment is unavailable. */
4
+ export function paymentSetupMessage(prefix: string): string {
5
+ return copyParam(`${prefix}.paymentSetupUnavailable`, "This site is not accepting online payments. Go back or contact the business for other payment options.");
6
+ }
@@ -0,0 +1,64 @@
1
+ import type { WixPlanOrder, WixPlanPricing } from "@himalaya/wix-pricing-plans";
2
+ import { copyParam, copyTemplate } from "./himi-copy.js";
3
+ import { formatCurrency, formatDateMedium } from "./engine-intl.js";
4
+
5
+ export function planDuration(pricing?: WixPlanPricing): string {
6
+ if (pricing?.singlePaymentUnlimited) return copyParam("plans.unlimited", "Unlimited duration");
7
+ const cycle = pricing?.subscription;
8
+ if (cycle && !cycle.cycleCount) return copyParam("plans.untilCanceled", "Until canceled");
9
+ const duration = cycle?.cycleDuration ?? pricing?.singlePaymentForDuration;
10
+ const count = (duration?.count ?? 0) * (cycle ? cycle.cycleCount ?? 0 : 1);
11
+ const unit = duration?.unit?.toLowerCase().replace(/s$/, "");
12
+ if (!count || !unit) return "";
13
+ const units: Record<string, [string, string]> = { day: ["day", "days"], week: ["week", "weeks"], month: ["month", "months"], year: ["year", "years"] };
14
+ const pair = units[unit];
15
+ if (!pair) return "";
16
+ return copyTemplate("plans.validFor", "Valid for {count} {unit}", { count, unit: copyParam(`plans.${unit}.${count === 1 ? "one" : "other"}`, pair[count === 1 ? 0 : 1]) });
17
+ }
18
+
19
+ export function orderDate(value?: string): string {
20
+ return value && Number.isFinite(Date.parse(value)) ? formatDateMedium(new Date(value)) : "";
21
+ }
22
+
23
+ /** The purchased order owns its price; today's plan is never a price fallback. */
24
+ export function orderPrice(order: WixPlanOrder): string {
25
+ const cycle = order.currentCycle?.index ?? 1;
26
+ const span = order.pricing?.prices?.find(({ duration }) => {
27
+ const from = duration?.cycleFrom ?? 1;
28
+ return cycle >= from && (!duration?.numberOfCycles || cycle < from + duration.numberOfCycles);
29
+ });
30
+ const currency = order.priceDetails?.currency ?? order.pricing?.currency ?? span?.price?.currency;
31
+ return purchasedMoney(span?.price?.total, span?.price?.currency) || span?.price?.formattedTotal
32
+ || purchasedMoney(order.priceDetails?.total, order.priceDetails?.currency)
33
+ || purchasedMoney(order.pricing?.total, order.pricing?.currency)
34
+ || purchasedMoney(order.priceDetails?.planPrice, currency)
35
+ || purchasedMoney(order.planPrice, currency);
36
+ }
37
+ function purchasedMoney(value?: string, currency?: string): string {
38
+ return value !== undefined && value !== "" && Number.isFinite(Number(value)) && currency
39
+ ? formatCurrency(Number(value), currency) : "";
40
+ }
41
+
42
+ export function orderStatus(order: WixPlanOrder): string {
43
+ const status = order.status ?? "";
44
+ const labels: Record<string, string> = { ACTIVE: "Active", PENDING: "Pending", PAUSED: "Paused", CANCELED: "Canceled", ENDED: "Expired", DRAFT: "Pending payment" };
45
+ return copyParam(`subscriptionDetail.status.${status}`, labels[status] ?? "Status unavailable");
46
+ }
47
+
48
+ export function orderFacts(order: WixPlanOrder): Array<{ id: string; label: string; value: string; positive: boolean; notPositive: boolean }> {
49
+ const payment: Record<string, string> = { ONLINE: "Online", OFFLINE: "Offline", EXTERNAL: "External" };
50
+ const statuses: Record<string, string> = { PAID: "Paid", UNPAID: "Unpaid", FAILED: "Failed", PENDING: "Pending", REFUNDED: "Refunded", NOT_APPLICABLE: "Not applicable" };
51
+ const pairs: Array<[string, string, string]> = [
52
+ ["purchaseDate", "Purchase date", orderDate(order.createdDate)],
53
+ ["startDate", "Start date", orderDate(order.startDate)],
54
+ ["endDate", "End date", orderDate(order.earliestEndDate ?? order.endDate)],
55
+ ["paymentMethod", "Payment method", payment[order.type ?? ""] ? copyParam(`subscriptionDetail.payment.${order.type}`, payment[order.type!]) : ""],
56
+ ["lastPaymentStatus", "Last payment status", statuses[order.lastPaymentStatus ?? ""] ? copyParam(`subscriptionDetail.paymentStatus.${order.lastPaymentStatus}`, statuses[order.lastPaymentStatus!]) : ""],
57
+ ];
58
+ if (order.autoRenewCanceled || order.cancellation?.effectiveAt === "NEXT_PAYMENT_DATE") {
59
+ pairs.push(["scheduledEnd", "Scheduled end", orderDate(order.earliestEndDate ?? order.endDate ?? order.currentCycle?.endedDate)]);
60
+ } else if (order.status === "ACTIVE" && (order.pricing?.subscription ?? order.priceDetails?.subscription) && order.currentCycle?.endedDate) {
61
+ pairs.push(["periodEnd", "Current period ends", orderDate(order.currentCycle.endedDate)]);
62
+ }
63
+ return pairs.filter(([, , value]) => Boolean(value)).map(([id, label, value]) => ({ id, label: copyParam(`subscriptionDetail.${id}`, label), value, positive: id === "lastPaymentStatus" && order.lastPaymentStatus === "PAID", notPositive: id !== "lastPaymentStatus" || order.lastPaymentStatus !== "PAID" }));
64
+ }