@wix/himalaya-cli 0.1851.0 → 0.1853.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 (510) 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 +13 -3
  3. package/dist/browser-plane/assets.json +5 -5
  4. package/dist/browser-plane/preview-deferred/{166f7ee733ea8d0fe7bba8b796232efd4f5413e22af4a8aeee20cae1069b2fd6.bin → fb500748f6c4768468f2e7f985aa67c38633077c7a98caaa6b500c7b00eea8e9.bin} +1 -1
  5. package/dist/browser-plane/sw.js +7 -7
  6. package/dist/cli.mjs +10136 -9601
  7. package/dist/preview-assets.generated.bin +0 -0
  8. package/guides/component-index.md +1 -1
  9. package/guides/component-reference.json +2 -2
  10. package/guides/component-reference.md +8 -1
  11. package/guides/designing-himi-screens.md +5 -1
  12. package/guides/himi-json-output.md +13 -3
  13. package/guides/one-app-section-mappings.md +1 -1
  14. package/guides/one-app-to-himi-app.md +60 -10
  15. package/guides/sdk-reference.json +2 -2
  16. package/package.json +2 -2
  17. package/template-icons/bare-fashion.png +0 -0
  18. package/templates/bare-fashion/README.md +52 -0
  19. package/templates/bare-fashion/config.ts +474 -0
  20. package/templates/bare-fashion/dev/index.ts +16526 -0
  21. package/templates/bare-fashion/himalaya.content.json +70 -0
  22. package/templates/bare-fashion/himalaya.template.json +18 -0
  23. package/templates/bare-fashion/icon.png +0 -0
  24. package/templates/bare-fashion/platforms.json +3 -0
  25. package/templates/bare-fashion/tier5-src/_shared/app-locale.ts +70 -0
  26. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-address-book.ts +116 -0
  27. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-address-countries.ts +261 -0
  28. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-bag-count.ts +24 -0
  29. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-categories.ts +48 -0
  30. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-facets.ts +265 -0
  31. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-load-error.ts +38 -0
  32. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-product-card.ts +136 -0
  33. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-store-options.ts +129 -0
  34. package/templates/bare-fashion/tier5-src/_shared/branded-lite-hosted.ts +282 -0
  35. package/templates/bare-fashion/tier5-src/_shared/collection-contract.ts +228 -0
  36. package/templates/bare-fashion/tier5-src/_shared/collection-query.ts +201 -0
  37. package/templates/bare-fashion/tier5-src/_shared/collection-service.ts +429 -0
  38. package/templates/bare-fashion/tier5-src/_shared/engine-intl.ts +529 -0
  39. package/templates/bare-fashion/tier5-src/_shared/himi-account.ts +209 -0
  40. package/templates/bare-fashion/tier5-src/_shared/himi-copy.ts +123 -0
  41. package/templates/bare-fashion/tier5-src/_shared/himi-layouts.ts +142 -0
  42. package/templates/bare-fashion/tier5-src/_shared/himi-store-categories.ts +108 -0
  43. package/templates/bare-fashion/tier5-src/_shared/himi-store-saved.ts +57 -0
  44. package/templates/bare-fashion/tier5-src/_shared/himi-store.ts +7 -0
  45. package/templates/bare-fashion/tier5-src/_shared/himi-text.ts +24 -0
  46. package/templates/bare-fashion/tier5-src/_shared/hosted-checkout.ts +70 -0
  47. package/templates/bare-fashion/tier5-src/_shared/live-session.ts +172 -0
  48. package/templates/bare-fashion/tier5-src/_shared/local-preferences.ts +38 -0
  49. package/templates/bare-fashion/tier5-src/_shared/member-access.ts +63 -0
  50. package/templates/bare-fashion/tier5-src/_shared/member-avatar.ts +76 -0
  51. package/templates/bare-fashion/tier5-src/_shared/member-orders.ts +8 -0
  52. package/templates/bare-fashion/tier5-src/_shared/online-actions.ts +76 -0
  53. package/templates/bare-fashion/tier5-src/_shared/owner-load-error.ts +348 -0
  54. package/templates/bare-fashion/tier5-src/himi-bare-fashion-account/index.ts +127 -0
  55. package/templates/bare-fashion/tier5-src/himi-bare-fashion-address-form/index.ts +367 -0
  56. package/templates/bare-fashion/tier5-src/himi-bare-fashion-addresses/index.ts +202 -0
  57. package/templates/bare-fashion/tier5-src/himi-bare-fashion-appearance/index.ts +73 -0
  58. package/templates/bare-fashion/tier5-src/himi-bare-fashion-cart/index.ts +540 -0
  59. package/templates/bare-fashion/tier5-src/himi-bare-fashion-collection/index.ts +111 -0
  60. package/templates/bare-fashion/tier5-src/himi-bare-fashion-home/index.ts +241 -0
  61. package/templates/bare-fashion/tier5-src/himi-bare-fashion-nav/index.ts +56 -0
  62. package/templates/bare-fashion/tier5-src/himi-bare-fashion-order/index.ts +437 -0
  63. package/templates/bare-fashion/tier5-src/himi-bare-fashion-product/index.ts +650 -0
  64. package/templates/bare-fashion/tier5-src/himi-bare-fashion-products/index.ts +142 -0
  65. package/templates/bare-fashion/tier5-src/himi-bare-fashion-saved/index.ts +45 -0
  66. package/templates/bare-fashion/tier5-src/himi-bare-fashion-search/index.ts +199 -0
  67. package/templates/bare-fashion/tier5-src/himi-bare-fashion-shop/index.ts +79 -0
  68. package/templates/bare-fashion/tier5-src/himi-bare-fashion-sign-in/index.ts +269 -0
  69. package/templates/bare-fashion/tier5-src/himi-bare-fashion-wallet/index.ts +224 -0
  70. package/templates/bare-fashion/tier5-src/himi-branded-lite-info/index.ts +209 -0
  71. package/templates/bare-fashion/tier5-src/himi-branded-lite-orders/index.ts +327 -0
  72. package/templates/bare-fashion/tier5-src/wix-spaces-collections/index.ts +48 -0
  73. package/templates/bare-fashion/tier5-src/wix-spaces-delete-account/index.ts +59 -0
  74. package/templates/bare-fashion/tier5-src/wix-spaces-view-profile/index.ts +119 -0
  75. package/templates/bare-fashion/tokens.json +348 -0
  76. package/templates/beauty-salon/dev/index.ts +223 -0
  77. package/templates/beauty-salon/l10n/ar.json +6 -0
  78. package/templates/beauty-salon/l10n/cs.json +6 -0
  79. package/templates/beauty-salon/l10n/da.json +6 -0
  80. package/templates/beauty-salon/l10n/de.json +6 -0
  81. package/templates/beauty-salon/l10n/el.json +6 -0
  82. package/templates/beauty-salon/l10n/en.json +9 -2
  83. package/templates/beauty-salon/l10n/es.json +6 -0
  84. package/templates/beauty-salon/l10n/fi.json +6 -0
  85. package/templates/beauty-salon/l10n/fr.json +6 -0
  86. package/templates/beauty-salon/l10n/he.json +5 -0
  87. package/templates/beauty-salon/l10n/hu.json +6 -0
  88. package/templates/beauty-salon/l10n/id.json +6 -0
  89. package/templates/beauty-salon/l10n/it.json +6 -0
  90. package/templates/beauty-salon/l10n/ja.json +6 -0
  91. package/templates/beauty-salon/l10n/ko.json +6 -0
  92. package/templates/beauty-salon/l10n/lt.json +6 -0
  93. package/templates/beauty-salon/l10n/nl.json +6 -0
  94. package/templates/beauty-salon/l10n/no.json +6 -0
  95. package/templates/beauty-salon/l10n/pl.json +6 -0
  96. package/templates/beauty-salon/l10n/pt.json +6 -0
  97. package/templates/beauty-salon/l10n/ru.json +6 -0
  98. package/templates/beauty-salon/l10n/sv.json +6 -0
  99. package/templates/beauty-salon/l10n/th.json +6 -0
  100. package/templates/beauty-salon/l10n/tr.json +6 -0
  101. package/templates/beauty-salon/l10n/uk.json +6 -0
  102. package/templates/beauty-salon/l10n/vi.json +6 -0
  103. package/templates/beauty-salon/l10n/zh.json +6 -0
  104. package/templates/beauty-salon/tier5-src/_shared/collection-query.ts +8 -0
  105. package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +7 -1
  106. package/templates/beauty-salon/tier5-src/_shared/lifecycle.ts +15 -0
  107. package/templates/beauty-salon/tier5-src/_shared/nav-member-avatar.ts +92 -0
  108. package/templates/beauty-salon/tier5-src/himi-branded-lite-nav/index.ts +15 -6
  109. package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +26 -1
  110. package/templates/beauty-salon-owner/tier5-src/_shared/collection-query.ts +8 -0
  111. package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +7 -1
  112. package/templates/branded-lite/dev/index.ts +2167 -0
  113. package/templates/branded-lite/l10n/ar.json +6 -0
  114. package/templates/branded-lite/l10n/cs.json +6 -0
  115. package/templates/branded-lite/l10n/da.json +6 -0
  116. package/templates/branded-lite/l10n/de.json +6 -0
  117. package/templates/branded-lite/l10n/el.json +6 -0
  118. package/templates/branded-lite/l10n/en.json +12 -5
  119. package/templates/branded-lite/l10n/es.json +6 -0
  120. package/templates/branded-lite/l10n/fi.json +6 -0
  121. package/templates/branded-lite/l10n/fr.json +6 -0
  122. package/templates/branded-lite/l10n/he.json +5 -0
  123. package/templates/branded-lite/l10n/hu.json +6 -0
  124. package/templates/branded-lite/l10n/id.json +6 -0
  125. package/templates/branded-lite/l10n/it.json +6 -0
  126. package/templates/branded-lite/l10n/ja.json +6 -0
  127. package/templates/branded-lite/l10n/ko.json +6 -0
  128. package/templates/branded-lite/l10n/lt.json +6 -0
  129. package/templates/branded-lite/l10n/nl.json +6 -0
  130. package/templates/branded-lite/l10n/no.json +6 -0
  131. package/templates/branded-lite/l10n/pl.json +6 -0
  132. package/templates/branded-lite/l10n/pt.json +6 -0
  133. package/templates/branded-lite/l10n/ru.json +6 -0
  134. package/templates/branded-lite/l10n/sv.json +6 -0
  135. package/templates/branded-lite/l10n/th.json +6 -0
  136. package/templates/branded-lite/l10n/tr.json +6 -0
  137. package/templates/branded-lite/l10n/uk.json +6 -0
  138. package/templates/branded-lite/l10n/vi.json +6 -0
  139. package/templates/branded-lite/l10n/zh.json +6 -0
  140. package/templates/branded-lite/recipes/upcoming-bookings.json +118 -6
  141. package/templates/branded-lite/tier5-src/_shared/access-gates.ts +0 -13
  142. package/templates/branded-lite/tier5-src/_shared/collection-query-legacy.ts +7 -0
  143. package/templates/branded-lite/tier5-src/_shared/collection-query.ts +7 -0
  144. package/templates/branded-lite/tier5-src/_shared/collection-service.ts +7 -1
  145. package/templates/branded-lite/tier5-src/_shared/events-inline-options.ts +55 -3
  146. package/templates/branded-lite/tier5-src/_shared/events-inline.ts +5 -3
  147. package/templates/branded-lite/tier5-src/_shared/guest-sign-in.ts +36 -0
  148. package/templates/branded-lite/tier5-src/_shared/lifecycle.ts +15 -0
  149. package/templates/branded-lite/tier5-src/_shared/nav-member-avatar.ts +92 -0
  150. package/templates/branded-lite/tier5-src/_shared/upcoming-bookings-section.ts +15 -4
  151. package/templates/branded-lite/tier5-src/himi-branded-lite-access-nav/index.ts +14 -9
  152. package/templates/branded-lite/tier5-src/himi-branded-lite-inbox/index.ts +6 -1
  153. package/templates/branded-lite/tier5-src/himi-branded-lite-nav/index.ts +15 -6
  154. package/templates/branded-lite/tier5-src/himi-branded-lite-notifications/index.ts +8 -1
  155. package/templates/branded-lite/tier5-src/himi-events-list/index.ts +17 -0
  156. package/templates/branded-lite/tier5-src/himi-store-account/index.ts +26 -1
  157. package/templates/brandy/tier5-src/_shared/collection-query-legacy.ts +7 -0
  158. package/templates/brandy/tier5-src/_shared/collection-query.ts +7 -0
  159. package/templates/brandy/tier5-src/_shared/collection-service.ts +7 -1
  160. package/templates/brandy/tier5-src/_shared/guest-sign-in.ts +36 -0
  161. package/templates/brandy/tier5-src/himi-branded-lite-inbox/index.ts +6 -1
  162. package/templates/brandy/tier5-src/himi-branded-lite-notifications/index.ts +8 -1
  163. package/templates/brandy/tier5-src/himi-store-account/index.ts +26 -1
  164. package/templates/community-club/dev/index.ts +223 -0
  165. package/templates/community-club/l10n/ar.json +6 -0
  166. package/templates/community-club/l10n/cs.json +6 -0
  167. package/templates/community-club/l10n/da.json +6 -0
  168. package/templates/community-club/l10n/de.json +6 -0
  169. package/templates/community-club/l10n/el.json +6 -0
  170. package/templates/community-club/l10n/en.json +9 -2
  171. package/templates/community-club/l10n/es.json +6 -0
  172. package/templates/community-club/l10n/fi.json +6 -0
  173. package/templates/community-club/l10n/fr.json +6 -0
  174. package/templates/community-club/l10n/he.json +5 -0
  175. package/templates/community-club/l10n/hu.json +6 -0
  176. package/templates/community-club/l10n/id.json +6 -0
  177. package/templates/community-club/l10n/it.json +6 -0
  178. package/templates/community-club/l10n/ja.json +6 -0
  179. package/templates/community-club/l10n/ko.json +6 -0
  180. package/templates/community-club/l10n/lt.json +6 -0
  181. package/templates/community-club/l10n/nl.json +6 -0
  182. package/templates/community-club/l10n/no.json +6 -0
  183. package/templates/community-club/l10n/pl.json +6 -0
  184. package/templates/community-club/l10n/pt.json +6 -0
  185. package/templates/community-club/l10n/ru.json +6 -0
  186. package/templates/community-club/l10n/sv.json +6 -0
  187. package/templates/community-club/l10n/th.json +6 -0
  188. package/templates/community-club/l10n/tr.json +6 -0
  189. package/templates/community-club/l10n/uk.json +6 -0
  190. package/templates/community-club/l10n/vi.json +6 -0
  191. package/templates/community-club/l10n/zh.json +6 -0
  192. package/templates/community-club/tier5-src/_shared/collection-query.ts +8 -0
  193. package/templates/community-club/tier5-src/_shared/collection-service.ts +7 -1
  194. package/templates/community-club/tier5-src/_shared/events-inline-options.ts +77 -0
  195. package/templates/community-club/tier5-src/himi-events-list/index.ts +17 -0
  196. package/templates/community-club/tier5-src/himi-store-account/index.ts +26 -1
  197. package/templates/community-club-owner/tier5-src/_shared/collection-query.ts +8 -0
  198. package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +7 -1
  199. package/templates/conference/tier5-src/_shared/collection-query.ts +8 -0
  200. package/templates/conference/tier5-src/_shared/collection-service.ts +7 -1
  201. package/templates/conference/tier5-src/_shared/events-inline-options.ts +77 -0
  202. package/templates/conference/tier5-src/himi-events-list/index.ts +17 -0
  203. package/templates/conference/tier5-src/himi-store-account/index.ts +26 -1
  204. package/templates/events-meetups/dev/index.ts +142 -0
  205. package/templates/events-meetups/l10n/ar.json +6 -0
  206. package/templates/events-meetups/l10n/cs.json +6 -0
  207. package/templates/events-meetups/l10n/da.json +6 -0
  208. package/templates/events-meetups/l10n/de.json +6 -0
  209. package/templates/events-meetups/l10n/el.json +6 -0
  210. package/templates/events-meetups/l10n/en.json +8 -1
  211. package/templates/events-meetups/l10n/es.json +6 -0
  212. package/templates/events-meetups/l10n/fi.json +6 -0
  213. package/templates/events-meetups/l10n/fr.json +6 -0
  214. package/templates/events-meetups/l10n/he.json +5 -0
  215. package/templates/events-meetups/l10n/hu.json +6 -0
  216. package/templates/events-meetups/l10n/id.json +6 -0
  217. package/templates/events-meetups/l10n/it.json +6 -0
  218. package/templates/events-meetups/l10n/ja.json +6 -0
  219. package/templates/events-meetups/l10n/ko.json +6 -0
  220. package/templates/events-meetups/l10n/lt.json +6 -0
  221. package/templates/events-meetups/l10n/nl.json +6 -0
  222. package/templates/events-meetups/l10n/no.json +6 -0
  223. package/templates/events-meetups/l10n/pl.json +6 -0
  224. package/templates/events-meetups/l10n/pt.json +6 -0
  225. package/templates/events-meetups/l10n/ru.json +6 -0
  226. package/templates/events-meetups/l10n/sv.json +6 -0
  227. package/templates/events-meetups/l10n/th.json +6 -0
  228. package/templates/events-meetups/l10n/tr.json +6 -0
  229. package/templates/events-meetups/l10n/uk.json +6 -0
  230. package/templates/events-meetups/l10n/vi.json +6 -0
  231. package/templates/events-meetups/l10n/zh.json +6 -0
  232. package/templates/events-meetups/tier5-src/_shared/collection-query.ts +8 -0
  233. package/templates/events-meetups/tier5-src/_shared/collection-service.ts +7 -1
  234. package/templates/events-meetups/tier5-src/_shared/events-inline-options.ts +77 -0
  235. package/templates/events-meetups/tier5-src/himi-events-list/index.ts +17 -0
  236. package/templates/events-meetups/tier5-src/himi-store-account/index.ts +26 -1
  237. package/templates/events-meetups-owner/tier5-src/_shared/collection-query.ts +8 -0
  238. package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +7 -1
  239. package/templates/fitness-gym/tier5-src/_shared/collection-query.ts +8 -0
  240. package/templates/fitness-gym/tier5-src/_shared/collection-service.ts +7 -1
  241. package/templates/fitness-gym/tier5-src/_shared/guest-sign-in.ts +36 -0
  242. package/templates/fitness-gym/tier5-src/himi-branded-lite-notifications/index.ts +8 -1
  243. package/templates/fitness-gym/tier5-src/himi-store-account/index.ts +26 -1
  244. package/templates/gym-fitness/dev/index.ts +385 -0
  245. package/templates/gym-fitness/l10n/ar.json +6 -0
  246. package/templates/gym-fitness/l10n/cs.json +6 -0
  247. package/templates/gym-fitness/l10n/da.json +6 -0
  248. package/templates/gym-fitness/l10n/de.json +6 -0
  249. package/templates/gym-fitness/l10n/el.json +6 -0
  250. package/templates/gym-fitness/l10n/en.json +9 -2
  251. package/templates/gym-fitness/l10n/es.json +6 -0
  252. package/templates/gym-fitness/l10n/fi.json +6 -0
  253. package/templates/gym-fitness/l10n/fr.json +6 -0
  254. package/templates/gym-fitness/l10n/he.json +5 -0
  255. package/templates/gym-fitness/l10n/hu.json +6 -0
  256. package/templates/gym-fitness/l10n/id.json +6 -0
  257. package/templates/gym-fitness/l10n/it.json +6 -0
  258. package/templates/gym-fitness/l10n/ja.json +6 -0
  259. package/templates/gym-fitness/l10n/ko.json +6 -0
  260. package/templates/gym-fitness/l10n/lt.json +6 -0
  261. package/templates/gym-fitness/l10n/nl.json +6 -0
  262. package/templates/gym-fitness/l10n/no.json +6 -0
  263. package/templates/gym-fitness/l10n/pl.json +6 -0
  264. package/templates/gym-fitness/l10n/pt.json +6 -0
  265. package/templates/gym-fitness/l10n/ru.json +6 -0
  266. package/templates/gym-fitness/l10n/sv.json +6 -0
  267. package/templates/gym-fitness/l10n/th.json +6 -0
  268. package/templates/gym-fitness/l10n/tr.json +6 -0
  269. package/templates/gym-fitness/l10n/uk.json +6 -0
  270. package/templates/gym-fitness/l10n/vi.json +6 -0
  271. package/templates/gym-fitness/l10n/zh.json +6 -0
  272. package/templates/gym-fitness/tier5-src/_shared/collection-query.ts +8 -0
  273. package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +7 -1
  274. package/templates/gym-fitness/tier5-src/_shared/events-inline-options.ts +77 -0
  275. package/templates/gym-fitness/tier5-src/_shared/lifecycle.ts +15 -0
  276. package/templates/gym-fitness/tier5-src/_shared/nav-member-avatar.ts +92 -0
  277. package/templates/gym-fitness/tier5-src/himi-branded-lite-nav/index.ts +15 -6
  278. package/templates/gym-fitness/tier5-src/himi-events-list/index.ts +17 -0
  279. package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +26 -1
  280. package/templates/gym-fitness-owner/tier5-src/_shared/collection-query.ts +8 -0
  281. package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +7 -1
  282. package/templates/medical-services/tier5-src/_shared/collection-query.ts +8 -0
  283. package/templates/medical-services/tier5-src/_shared/collection-service.ts +7 -1
  284. package/templates/medical-services/tier5-src/_shared/guest-sign-in.ts +36 -0
  285. package/templates/medical-services/tier5-src/himi-branded-lite-notifications/index.ts +8 -1
  286. package/templates/medical-services/tier5-src/himi-store-account/index.ts +26 -1
  287. package/templates/nonprofit-cause/dev/index.ts +223 -0
  288. package/templates/nonprofit-cause/l10n/ar.json +6 -0
  289. package/templates/nonprofit-cause/l10n/cs.json +6 -0
  290. package/templates/nonprofit-cause/l10n/da.json +6 -0
  291. package/templates/nonprofit-cause/l10n/de.json +6 -0
  292. package/templates/nonprofit-cause/l10n/el.json +6 -0
  293. package/templates/nonprofit-cause/l10n/en.json +8 -1
  294. package/templates/nonprofit-cause/l10n/es.json +6 -0
  295. package/templates/nonprofit-cause/l10n/fi.json +6 -0
  296. package/templates/nonprofit-cause/l10n/fr.json +6 -0
  297. package/templates/nonprofit-cause/l10n/he.json +5 -0
  298. package/templates/nonprofit-cause/l10n/hu.json +6 -0
  299. package/templates/nonprofit-cause/l10n/id.json +6 -0
  300. package/templates/nonprofit-cause/l10n/it.json +6 -0
  301. package/templates/nonprofit-cause/l10n/ja.json +6 -0
  302. package/templates/nonprofit-cause/l10n/ko.json +6 -0
  303. package/templates/nonprofit-cause/l10n/lt.json +6 -0
  304. package/templates/nonprofit-cause/l10n/nl.json +6 -0
  305. package/templates/nonprofit-cause/l10n/no.json +6 -0
  306. package/templates/nonprofit-cause/l10n/pl.json +6 -0
  307. package/templates/nonprofit-cause/l10n/pt.json +6 -0
  308. package/templates/nonprofit-cause/l10n/ru.json +6 -0
  309. package/templates/nonprofit-cause/l10n/sv.json +6 -0
  310. package/templates/nonprofit-cause/l10n/th.json +6 -0
  311. package/templates/nonprofit-cause/l10n/tr.json +6 -0
  312. package/templates/nonprofit-cause/l10n/uk.json +6 -0
  313. package/templates/nonprofit-cause/l10n/vi.json +6 -0
  314. package/templates/nonprofit-cause/l10n/zh.json +6 -0
  315. package/templates/nonprofit-cause/tier5-src/_shared/collection-query.ts +8 -0
  316. package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +7 -1
  317. package/templates/nonprofit-cause/tier5-src/_shared/events-inline-options.ts +77 -0
  318. package/templates/nonprofit-cause/tier5-src/himi-events-list/index.ts +17 -0
  319. package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +26 -1
  320. package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-query.ts +8 -0
  321. package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +7 -1
  322. package/templates/owner-lite/tier5-src/_shared/collection-query.ts +8 -0
  323. package/templates/owner-lite/tier5-src/_shared/collection-service.ts +7 -1
  324. package/templates/personal-fitness-trainer/tier5-src/_shared/collection-query.ts +8 -0
  325. package/templates/personal-fitness-trainer/tier5-src/_shared/collection-service.ts +7 -1
  326. package/templates/personal-fitness-trainer/tier5-src/himi-store-account/index.ts +26 -1
  327. package/templates/podcast-creator/dev/index.ts +223 -0
  328. package/templates/podcast-creator/l10n/ar.json +6 -0
  329. package/templates/podcast-creator/l10n/cs.json +6 -0
  330. package/templates/podcast-creator/l10n/da.json +6 -0
  331. package/templates/podcast-creator/l10n/de.json +6 -0
  332. package/templates/podcast-creator/l10n/el.json +6 -0
  333. package/templates/podcast-creator/l10n/en.json +8 -1
  334. package/templates/podcast-creator/l10n/es.json +6 -0
  335. package/templates/podcast-creator/l10n/fi.json +6 -0
  336. package/templates/podcast-creator/l10n/fr.json +6 -0
  337. package/templates/podcast-creator/l10n/he.json +5 -0
  338. package/templates/podcast-creator/l10n/hu.json +6 -0
  339. package/templates/podcast-creator/l10n/id.json +6 -0
  340. package/templates/podcast-creator/l10n/it.json +6 -0
  341. package/templates/podcast-creator/l10n/ja.json +6 -0
  342. package/templates/podcast-creator/l10n/ko.json +6 -0
  343. package/templates/podcast-creator/l10n/lt.json +6 -0
  344. package/templates/podcast-creator/l10n/nl.json +6 -0
  345. package/templates/podcast-creator/l10n/no.json +6 -0
  346. package/templates/podcast-creator/l10n/pl.json +6 -0
  347. package/templates/podcast-creator/l10n/pt.json +6 -0
  348. package/templates/podcast-creator/l10n/ru.json +6 -0
  349. package/templates/podcast-creator/l10n/sv.json +6 -0
  350. package/templates/podcast-creator/l10n/th.json +6 -0
  351. package/templates/podcast-creator/l10n/tr.json +6 -0
  352. package/templates/podcast-creator/l10n/uk.json +6 -0
  353. package/templates/podcast-creator/l10n/vi.json +6 -0
  354. package/templates/podcast-creator/l10n/zh.json +6 -0
  355. package/templates/podcast-creator/tier5-src/_shared/collection-query.ts +8 -0
  356. package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +7 -1
  357. package/templates/podcast-creator/tier5-src/_shared/events-inline-options.ts +77 -0
  358. package/templates/podcast-creator/tier5-src/himi-events-list/index.ts +17 -0
  359. package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +26 -1
  360. package/templates/podcast-creator-owner/tier5-src/_shared/collection-query.ts +8 -0
  361. package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +7 -1
  362. package/templates/portfolio-creative/dev/index.ts +142 -0
  363. package/templates/portfolio-creative/l10n/ar.json +6 -0
  364. package/templates/portfolio-creative/l10n/cs.json +6 -0
  365. package/templates/portfolio-creative/l10n/da.json +6 -0
  366. package/templates/portfolio-creative/l10n/de.json +6 -0
  367. package/templates/portfolio-creative/l10n/el.json +6 -0
  368. package/templates/portfolio-creative/l10n/en.json +8 -1
  369. package/templates/portfolio-creative/l10n/es.json +6 -0
  370. package/templates/portfolio-creative/l10n/fi.json +6 -0
  371. package/templates/portfolio-creative/l10n/fr.json +6 -0
  372. package/templates/portfolio-creative/l10n/he.json +5 -0
  373. package/templates/portfolio-creative/l10n/hu.json +6 -0
  374. package/templates/portfolio-creative/l10n/id.json +6 -0
  375. package/templates/portfolio-creative/l10n/it.json +6 -0
  376. package/templates/portfolio-creative/l10n/ja.json +6 -0
  377. package/templates/portfolio-creative/l10n/ko.json +6 -0
  378. package/templates/portfolio-creative/l10n/lt.json +6 -0
  379. package/templates/portfolio-creative/l10n/nl.json +6 -0
  380. package/templates/portfolio-creative/l10n/no.json +6 -0
  381. package/templates/portfolio-creative/l10n/pl.json +6 -0
  382. package/templates/portfolio-creative/l10n/pt.json +6 -0
  383. package/templates/portfolio-creative/l10n/ru.json +6 -0
  384. package/templates/portfolio-creative/l10n/sv.json +6 -0
  385. package/templates/portfolio-creative/l10n/th.json +6 -0
  386. package/templates/portfolio-creative/l10n/tr.json +6 -0
  387. package/templates/portfolio-creative/l10n/uk.json +6 -0
  388. package/templates/portfolio-creative/l10n/vi.json +6 -0
  389. package/templates/portfolio-creative/l10n/zh.json +6 -0
  390. package/templates/portfolio-creative/tier5-src/_shared/collection-query.ts +8 -0
  391. package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +7 -1
  392. package/templates/portfolio-creative/tier5-src/_shared/events-inline-options.ts +77 -0
  393. package/templates/portfolio-creative/tier5-src/himi-events-list/index.ts +17 -0
  394. package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +26 -1
  395. package/templates/portfolio-creative-owner/tier5-src/_shared/collection-query.ts +8 -0
  396. package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +7 -1
  397. package/templates/restaurant/dev/index.ts +142 -0
  398. package/templates/restaurant/l10n/ar.json +6 -0
  399. package/templates/restaurant/l10n/cs.json +6 -0
  400. package/templates/restaurant/l10n/da.json +6 -0
  401. package/templates/restaurant/l10n/de.json +6 -0
  402. package/templates/restaurant/l10n/el.json +6 -0
  403. package/templates/restaurant/l10n/en.json +9 -2
  404. package/templates/restaurant/l10n/es.json +6 -0
  405. package/templates/restaurant/l10n/fi.json +6 -0
  406. package/templates/restaurant/l10n/fr.json +6 -0
  407. package/templates/restaurant/l10n/he.json +5 -0
  408. package/templates/restaurant/l10n/hu.json +6 -0
  409. package/templates/restaurant/l10n/id.json +6 -0
  410. package/templates/restaurant/l10n/it.json +6 -0
  411. package/templates/restaurant/l10n/ja.json +6 -0
  412. package/templates/restaurant/l10n/ko.json +6 -0
  413. package/templates/restaurant/l10n/lt.json +6 -0
  414. package/templates/restaurant/l10n/nl.json +6 -0
  415. package/templates/restaurant/l10n/no.json +6 -0
  416. package/templates/restaurant/l10n/pl.json +6 -0
  417. package/templates/restaurant/l10n/pt.json +6 -0
  418. package/templates/restaurant/l10n/ru.json +6 -0
  419. package/templates/restaurant/l10n/sv.json +6 -0
  420. package/templates/restaurant/l10n/th.json +6 -0
  421. package/templates/restaurant/l10n/tr.json +6 -0
  422. package/templates/restaurant/l10n/uk.json +6 -0
  423. package/templates/restaurant/l10n/vi.json +6 -0
  424. package/templates/restaurant/l10n/zh.json +6 -0
  425. package/templates/restaurant/tier5-src/_shared/collection-query.ts +8 -0
  426. package/templates/restaurant/tier5-src/_shared/collection-service.ts +7 -1
  427. package/templates/restaurant/tier5-src/_shared/events-inline-options.ts +77 -0
  428. package/templates/restaurant/tier5-src/himi-events-list/index.ts +17 -0
  429. package/templates/restaurant/tier5-src/himi-store-account/index.ts +26 -1
  430. package/templates/restaurant-owner/tier5-src/_shared/collection-query.ts +8 -0
  431. package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +7 -1
  432. package/templates/retail-store/dev/index.ts +142 -0
  433. package/templates/retail-store/l10n/ar.json +6 -0
  434. package/templates/retail-store/l10n/cs.json +6 -0
  435. package/templates/retail-store/l10n/da.json +6 -0
  436. package/templates/retail-store/l10n/de.json +6 -0
  437. package/templates/retail-store/l10n/el.json +6 -0
  438. package/templates/retail-store/l10n/en.json +8 -1
  439. package/templates/retail-store/l10n/es.json +6 -0
  440. package/templates/retail-store/l10n/fi.json +6 -0
  441. package/templates/retail-store/l10n/fr.json +6 -0
  442. package/templates/retail-store/l10n/he.json +5 -0
  443. package/templates/retail-store/l10n/hu.json +6 -0
  444. package/templates/retail-store/l10n/id.json +6 -0
  445. package/templates/retail-store/l10n/it.json +6 -0
  446. package/templates/retail-store/l10n/ja.json +6 -0
  447. package/templates/retail-store/l10n/ko.json +6 -0
  448. package/templates/retail-store/l10n/lt.json +6 -0
  449. package/templates/retail-store/l10n/nl.json +6 -0
  450. package/templates/retail-store/l10n/no.json +6 -0
  451. package/templates/retail-store/l10n/pl.json +6 -0
  452. package/templates/retail-store/l10n/pt.json +6 -0
  453. package/templates/retail-store/l10n/ru.json +6 -0
  454. package/templates/retail-store/l10n/sv.json +6 -0
  455. package/templates/retail-store/l10n/th.json +6 -0
  456. package/templates/retail-store/l10n/tr.json +6 -0
  457. package/templates/retail-store/l10n/uk.json +6 -0
  458. package/templates/retail-store/l10n/vi.json +6 -0
  459. package/templates/retail-store/l10n/zh.json +6 -0
  460. package/templates/retail-store/tier5-src/_shared/collection-query-legacy.ts +7 -0
  461. package/templates/retail-store/tier5-src/_shared/collection-query.ts +7 -0
  462. package/templates/retail-store/tier5-src/_shared/collection-service.ts +7 -1
  463. package/templates/retail-store/tier5-src/himi-store-account/index.ts +26 -1
  464. package/templates/retail-store-owner/tier5-src/_shared/collection-query.ts +8 -0
  465. package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +7 -1
  466. package/templates/salon-spa/tier5-src/_shared/collection-query.ts +8 -0
  467. package/templates/salon-spa/tier5-src/_shared/collection-service.ts +7 -1
  468. package/templates/salon-spa/tier5-src/himi-store-account/index.ts +26 -1
  469. package/templates/wholesale-store/tier5-src/_shared/collection-query-legacy.ts +7 -0
  470. package/templates/wholesale-store/tier5-src/_shared/collection-query.ts +7 -0
  471. package/templates/wholesale-store/tier5-src/_shared/collection-service.ts +7 -1
  472. package/templates/wholesale-store/tier5-src/himi-store-account/index.ts +26 -1
  473. package/templates/yoga-studio/dev/index.ts +304 -0
  474. package/templates/yoga-studio/l10n/ar.json +6 -0
  475. package/templates/yoga-studio/l10n/cs.json +6 -0
  476. package/templates/yoga-studio/l10n/da.json +6 -0
  477. package/templates/yoga-studio/l10n/de.json +6 -0
  478. package/templates/yoga-studio/l10n/el.json +6 -0
  479. package/templates/yoga-studio/l10n/en.json +10 -3
  480. package/templates/yoga-studio/l10n/es.json +6 -0
  481. package/templates/yoga-studio/l10n/fi.json +6 -0
  482. package/templates/yoga-studio/l10n/fr.json +6 -0
  483. package/templates/yoga-studio/l10n/he.json +5 -0
  484. package/templates/yoga-studio/l10n/hu.json +6 -0
  485. package/templates/yoga-studio/l10n/id.json +6 -0
  486. package/templates/yoga-studio/l10n/it.json +6 -0
  487. package/templates/yoga-studio/l10n/ja.json +6 -0
  488. package/templates/yoga-studio/l10n/ko.json +6 -0
  489. package/templates/yoga-studio/l10n/lt.json +6 -0
  490. package/templates/yoga-studio/l10n/nl.json +6 -0
  491. package/templates/yoga-studio/l10n/no.json +6 -0
  492. package/templates/yoga-studio/l10n/pl.json +6 -0
  493. package/templates/yoga-studio/l10n/pt.json +6 -0
  494. package/templates/yoga-studio/l10n/ru.json +6 -0
  495. package/templates/yoga-studio/l10n/sv.json +6 -0
  496. package/templates/yoga-studio/l10n/th.json +6 -0
  497. package/templates/yoga-studio/l10n/tr.json +6 -0
  498. package/templates/yoga-studio/l10n/uk.json +6 -0
  499. package/templates/yoga-studio/l10n/vi.json +6 -0
  500. package/templates/yoga-studio/l10n/zh.json +6 -0
  501. package/templates/yoga-studio/tier5-src/_shared/collection-query.ts +8 -0
  502. package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +7 -1
  503. package/templates/yoga-studio/tier5-src/_shared/events-inline-options.ts +77 -0
  504. package/templates/yoga-studio/tier5-src/_shared/lifecycle.ts +15 -0
  505. package/templates/yoga-studio/tier5-src/_shared/nav-member-avatar.ts +92 -0
  506. package/templates/yoga-studio/tier5-src/himi-branded-lite-nav/index.ts +15 -6
  507. package/templates/yoga-studio/tier5-src/himi-events-list/index.ts +17 -0
  508. package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +26 -1
  509. package/templates/yoga-studio-owner/tier5-src/_shared/collection-query.ts +8 -0
  510. package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +7 -1
@@ -0,0 +1,142 @@
1
+ // Tier-5 bundle: BARE — full products gallery (inner Shop screen).
2
+ // Category chips on top, a sort picker and a Filter button that opens the filter
3
+ // panel (price + the store's product options, e.g. COLOR / SIZE).
4
+ //
5
+ // The filter panel and sort picker are BottomSheets on THIS screen, not navigation
6
+ // modals: a modal is a separate screen with its own worker, and state does not
7
+ // cross screens (tier-5 guide).
8
+ //
9
+ // Opened with `category` = a category id or name ("NEW IN", "ON SALE"); absent ⇒ ALL.
10
+ import { defineService } from "@himalaya/state";
11
+ import { searchStoreProducts, type StoreProduct } from "@himalaya/wix-stores";
12
+ import { queryCollections } from "@himalaya/wix-stores-collections";
13
+ import { orderCategories } from "../_shared/bare-fashion-categories.js";
14
+ import { cardId, toggleFavorite, type ProductCard } from "../_shared/bare-fashion-product-card.js";
15
+ import { FACETS_BOOT, applyFacets, countText, currencyOf, facetActions, idOf, option, toRow, type Chip, type FacetState, type Option, type Row } from "../_shared/bare-fashion-facets.js";
16
+ import { errorFlags, errorKindOf, type ErrorKind } from "../_shared/bare-fashion-load-error.js";
17
+
18
+ const ALL = "all";
19
+ const MAX_PRODUCTS = 500;
20
+
21
+ interface S extends FacetState {
22
+ status: "loading" | "ready" | "error";
23
+ isLoading: boolean;
24
+ notLoading: boolean;
25
+ isErrored: boolean;
26
+ notErrored: boolean;
27
+ /** Why the last load failed: the error state shows the offline or the server variant. */
28
+ errorKind?: ErrorKind;
29
+ hideOfflineError?: boolean;
30
+ hideServerError?: boolean;
31
+
32
+ categoryChips: Chip[];
33
+ categorySelected: string[];
34
+ /** The category row: one chip per category, with its selected state. */
35
+ categoryOptions: Option[];
36
+
37
+ results: ProductCard[];
38
+ countLabel: string;
39
+ showLabel: string;
40
+ noResults: boolean;
41
+ noEmpty: boolean;
42
+ emptyText: string;
43
+ }
44
+
45
+ // The full catalog stays out of bound state; only derived rows are rendered.
46
+ let rows: Row[] = [];
47
+ let categoryPicked = false;
48
+ let currency: string | undefined;
49
+
50
+ function input(): { category?: string } {
51
+ return (globalThis as { himalaya?: { input?: { category?: string } } }).himalaya?.input ?? {};
52
+ }
53
+
54
+ async function fetchAll(): Promise<StoreProduct[]> {
55
+ const out: StoreProduct[] = [];
56
+ let cursor: string | undefined;
57
+ do {
58
+ const res = await searchStoreProducts({ limit: 100, ...(cursor ? { cursor } : {}) });
59
+ out.push(...(res.products ?? []));
60
+ cursor = res.pagingMetadata?.cursors?.next ?? undefined;
61
+ } while (cursor && out.length < MAX_PRODUCTS);
62
+ return out;
63
+ }
64
+
65
+ function derive(s: S): S {
66
+ const category = s.categorySelected[0] ?? ALL;
67
+ const inCategory = category === ALL ? rows : rows.filter((r) => r.categoryIds.includes(category));
68
+ const { next, active } = applyFacets(s, inCategory, currency);
69
+ const n = next.results.length;
70
+ const ready = s.status === "ready";
71
+ return {
72
+ ...next,
73
+ isLoading: s.status === "loading",
74
+ notLoading: s.status !== "loading",
75
+ isErrored: s.status === "error",
76
+ notErrored: s.status !== "error",
77
+ ...errorFlags(s.status, s.errorKind),
78
+ categoryOptions: s.categoryChips.map((c) => option(c, c.id === category)),
79
+ countLabel: ready ? countText(n) : "",
80
+ showLabel: `Show ${countText(n)}`,
81
+ noResults: n === 0,
82
+ noEmpty: !ready || n > 0,
83
+ emptyText: active ? "No products match these filters." : "No products in this category yet.",
84
+ };
85
+ }
86
+ async function load(s: S): Promise<S> {
87
+ try {
88
+ const [products, collections] = await Promise.all([
89
+ fetchAll(),
90
+ queryCollections({ query: { paging: { limit: 50 } } }).then((r) => r.collections ?? [], () => []),
91
+ ]);
92
+ currency = products.map(currencyOf).find(Boolean);
93
+ rows = products.map(toRow).filter((r) => r.card.id);
94
+ const cats = orderCategories(collections).filter((c) => c.id);
95
+ const categoryChips: Chip[] = [{ id: ALL, label: "ALL" }, ...cats.map((c) => ({ id: c.id ?? "", label: (c.name ?? "").toUpperCase() }))];
96
+ // Pre-select the category the shopper came from: an id, or a name ("NEW IN").
97
+ const want = (input().category ?? "").trim();
98
+ const match = want.toLowerCase() === ALL
99
+ ? categoryChips[0]
100
+ : cats.find((c) => c.id === want || (c.name ?? "").trim().toUpperCase() === want.toUpperCase());
101
+ // A retry keeps the shopper's own pick; the first load uses the link's category.
102
+ const current = categoryPicked ? s.categorySelected[0] : undefined;
103
+ const keep = current && categoryChips.some((c) => c.id === current) ? current : undefined;
104
+ return derive({ ...s, status: "ready", categoryChips, categorySelected: [match?.id ?? keep ?? ALL] });
105
+ } catch (e) {
106
+ return derive({ ...s, status: "error", errorKind: errorKindOf(e) });
107
+ }
108
+ }
109
+
110
+ const BOOT: S = derive({
111
+ ...FACETS_BOOT,
112
+ status: "loading", isLoading: true, notLoading: false, isErrored: false, notErrored: true,
113
+ categoryChips: [], categorySelected: [ALL], categoryOptions: [],
114
+ results: [], countLabel: "", showLabel: "", noResults: true, noEmpty: true, emptyText: "",
115
+ });
116
+
117
+ type A = (s: S, arg?: unknown) => S | Promise<S>;
118
+ const svc = defineService<S, {
119
+ load: A; retry: A; selectCategory: A; sort: A; openFilters: A; openSort: A; closePanel: A;
120
+ selectPrice: A; selectOpt1: A; selectOpt2: A; selectOpt3: A; clearFilters: A; toggleSave: A;
121
+ }>("bareFashionProducts", {
122
+ state: BOOT,
123
+ actions: {
124
+ load: (s) => load(s),
125
+ retry: (s) => load(derive({ ...s, status: "loading" })),
126
+ // Single-select: one category is always chosen.
127
+ selectCategory: (s, arg) => {
128
+ const id = idOf(arg);
129
+ if (!s.categoryChips.some((c) => c.id === id)) return s;
130
+ categoryPicked = true;
131
+ return derive({ ...s, categorySelected: [id] });
132
+ },
133
+ ...facetActions(derive),
134
+ toggleSave: (s, arg) => {
135
+ try { toggleFavorite(s.results, cardId(arg)); } catch { return s; }
136
+ return derive(s);
137
+ },
138
+ },
139
+ });
140
+
141
+ svc.load();
142
+ export { svc };
@@ -0,0 +1,45 @@
1
+ import { defineService } from "@himalaya/state";
2
+ import { readSavedProducts, removeSavedProduct } from "../_shared/himi-store-saved.js";
3
+ import { cardId, savedCard, type ProductCard } from "../_shared/bare-fashion-product-card.js";
4
+ import { stashCopy, copyParam } from "../_shared/himi-copy.js";
5
+
6
+ type Row = ProductCard;
7
+ interface S {
8
+ status: "loading" | "ready" | "error";
9
+ rows: Row[];
10
+ error: string;
11
+ emptyText: string;
12
+ isLoading: boolean;
13
+ notLoading: boolean;
14
+ notErrored: boolean;
15
+ noEmpty: boolean;
16
+ }
17
+ function shape(s: Pick<S, "status" | "rows" | "error">): S {
18
+ return { ...s, isLoading: s.status === "loading", notLoading: s.status !== "loading", notErrored: s.status !== "error", noEmpty: s.status !== "ready" || s.rows.length > 0, emptyText: copyParam("savedProducts.empty", "Tap the heart on an item to add it to your wishlist.") };
19
+ }
20
+ function loadRows(): Row[] {
21
+ return readSavedProducts().map(savedCard);
22
+ }
23
+ function failed(s: S): S {
24
+ return shape({ ...s, status: "error", error: copyParam("savedProducts.error", "Could not update your wishlist. Try again.") });
25
+ }
26
+ const svc = defineService<S, {
27
+ load: (s: S, arg?: unknown) => S;
28
+ remove: (s: S, arg?: unknown) => S;
29
+ }>("bareFashionSaved", {
30
+ state: shape({ status: "loading", rows: [], error: "" }),
31
+ actions: {
32
+ load: (s, arg) => {
33
+ stashCopy(arg);
34
+ try { return shape({ status: "ready", rows: loadRows(), error: "" }); }
35
+ catch { return failed(s); }
36
+ },
37
+ remove: (s, arg) => {
38
+ try {
39
+ removeSavedProduct(cardId(arg));
40
+ return shape({ status: "ready", rows: loadRows(), error: "" });
41
+ } catch { return failed(s); }
42
+ },
43
+ },
44
+ });
45
+ export { svc };
@@ -0,0 +1,199 @@
1
+ // Tier-5 bundle: BARE — full-screen search (opened from the Shop tab's search bar).
2
+ // Opens with the query field focused. Empty query → the shopper's recent searches.
3
+ // Non-empty query → matching products under the same sort picker and filter panel
4
+ // as the Products screen (shared in ../_shared/bare-facets.ts).
5
+ //
6
+ // Recent searches live on this device only (the host's app-scoped KV). A query is
7
+ // saved when the shopper presses Search on the keyboard, taps a recent search, or
8
+ // opens a product from the results — never per keystroke.
9
+ import { defineService, navigate } from "@himalaya/state";
10
+ import { dismiss } from "@himalaya/keyboard";
11
+ import { searchStoreProducts } from "@himalaya/wix-stores";
12
+ import { cardId, toggleFavorite, type ProductCard } from "../_shared/bare-fashion-product-card.js";
13
+ import { FACETS_BOOT, applyFacets, countText, currencyOf, facetActions, idOf, toRow, type FacetState, type Row } from "../_shared/bare-fashion-facets.js";
14
+ import { errorFlags, errorKindOf, type ErrorKind } from "../_shared/bare-fashion-load-error.js";
15
+
16
+ const RECENT_KEY = "bare:recent-searches:v1";
17
+ const RECENT_MAX = 10;
18
+ const RESULT_LIMIT = 100;
19
+
20
+ interface Recent { id: string; label: string }
21
+
22
+ interface S extends FacetState {
23
+ status: "idle" | "loading" | "ready" | "error";
24
+ query: string;
25
+ /** Non-empty seed ⇒ the field takes focus (and the keyboard opens) on appear. */
26
+ focusToken: string;
27
+ recent: Recent[];
28
+ hideRecent: boolean;
29
+ hideQueryArea: boolean;
30
+ isLoading: boolean;
31
+ notLoading: boolean;
32
+ notErrored: boolean;
33
+ /** Why the last load failed: the error state shows the offline or the server variant. */
34
+ errorKind?: ErrorKind;
35
+ hideOfflineError?: boolean;
36
+ hideServerError?: boolean;
37
+ results: ProductCard[];
38
+ countLabel: string;
39
+ showLabel: string;
40
+ noResults: boolean;
41
+ noEmpty: boolean;
42
+ emptyText: string;
43
+ }
44
+
45
+ // The fetched result rows stay out of bound state; only derived cards are rendered.
46
+ let rows: Row[] = [];
47
+ let currency: string | undefined;
48
+ // Search responses can land out of order; only the latest query may write state.
49
+ let latestQuery = "";
50
+
51
+ // ---------------------------------------------------------------------------
52
+ // Recent searches (device KV — a failed read or write never breaks search)
53
+ // ---------------------------------------------------------------------------
54
+
55
+ type StorageLike = { getItem(key: string): string | null; setItem(key: string, value: string): void };
56
+ function storage(): StorageLike | undefined {
57
+ const host = globalThis as { himalaya?: { storage?: StorageLike }; localStorage?: StorageLike };
58
+ return host.himalaya?.storage ?? host.localStorage;
59
+ }
60
+
61
+ /** The recent searches kept on the device, or `ok: false` when the stored list cannot be read
62
+ * (no storage, or a value this version did not write). Recent searches are then not offered. */
63
+ function storedRecent(): { ok: true; list: Recent[] } | { ok: false } {
64
+ try {
65
+ const parsed: unknown = JSON.parse(storage()?.getItem(RECENT_KEY) ?? "[]");
66
+ if (!Array.isArray(parsed)) return { ok: false };
67
+ return { ok: true, list: parsed.filter((q): q is string => typeof q === "string" && !!q.trim())
68
+ .slice(0, RECENT_MAX).map((q) => ({ id: q, label: q })) };
69
+ } catch {
70
+ return { ok: false };
71
+ }
72
+ }
73
+ function readRecent(): Recent[] {
74
+ const stored = storedRecent();
75
+ return stored.ok ? stored.list : [];
76
+ }
77
+
78
+ function writeRecent(list: Recent[]): Recent[] {
79
+ try { storage()?.setItem(RECENT_KEY, JSON.stringify(list.map((r) => r.id))); } catch { /* keep in memory */ }
80
+ return list;
81
+ }
82
+
83
+ /** Newest first; a repeat (any letter case) moves to the top. */
84
+ function remember(list: Recent[], query: string): Recent[] {
85
+ const q = query.trim();
86
+ if (!q) return list;
87
+ const rest = list.filter((r) => r.id.toLowerCase() !== q.toLowerCase());
88
+ return writeRecent([{ id: q, label: q }, ...rest].slice(0, RECENT_MAX));
89
+ }
90
+
91
+ // ---------------------------------------------------------------------------
92
+ // Derive + search
93
+ // ---------------------------------------------------------------------------
94
+
95
+ function queryOf(arg: unknown): string {
96
+ return String((arg as { value?: unknown } | undefined)?.value ?? "").trim().slice(0, 256);
97
+ }
98
+
99
+ function derive(s: S): S {
100
+ const { next, active } = applyFacets(s, s.query ? rows : [], currency);
101
+ const n = next.results.length;
102
+ const ready = s.status === "ready";
103
+ return {
104
+ ...next,
105
+ hideRecent: !!s.query || s.recent.length === 0,
106
+ hideQueryArea: !s.query,
107
+ isLoading: s.status === "loading",
108
+ notLoading: s.status !== "loading",
109
+ notErrored: s.status !== "error",
110
+ ...errorFlags(s.status, s.errorKind),
111
+ countLabel: ready ? countText(n) : "",
112
+ showLabel: `Show ${countText(n)}`,
113
+ noResults: !ready || n === 0,
114
+ noEmpty: !ready || n > 0,
115
+ emptyText: active ? "No products match these filters." : `No products match “${s.query}”.`,
116
+ };
117
+ }
118
+
119
+ async function run(s: S, query: string): Promise<S | undefined> {
120
+ latestQuery = query;
121
+ if (!query) {
122
+ rows = [];
123
+ return derive({ ...s, query: "", status: "idle", panel: "none" });
124
+ }
125
+ try {
126
+ const res = await searchStoreProducts({ query, limit: RESULT_LIMIT });
127
+ if (query !== latestQuery) return undefined;
128
+ const products = res.products ?? [];
129
+ currency = products.map(currencyOf).find(Boolean) ?? currency;
130
+ rows = products.map(toRow).filter((r) => r.card.id);
131
+ return derive({ ...s, query, status: "ready" });
132
+ } catch (e) {
133
+ if (query !== latestQuery) return undefined;
134
+ rows = [];
135
+ return derive({ ...s, query, status: "error", errorKind: errorKindOf(e) });
136
+ }
137
+ }
138
+
139
+ const BOOT: S = derive({
140
+ ...FACETS_BOOT,
141
+ status: "idle", query: "", focusToken: "open", recent: [], hideRecent: true, hideQueryArea: true,
142
+ isLoading: false, notLoading: true, notErrored: true,
143
+ results: [], countLabel: "", showLabel: "", noResults: true, noEmpty: true, emptyText: "",
144
+ });
145
+
146
+ type A = (s: S, arg?: unknown) => S | undefined | Promise<S | undefined>;
147
+ const svc = defineService<S, {
148
+ load: A; change: A; submit: A; pickRecent: A; removeRecent: A; retry: A; openProduct: A; toggleSave: A;
149
+ sort: A; openFilters: A; openSort: A; closePanel: A;
150
+ selectPrice: A; selectOpt1: A; selectOpt2: A; selectOpt3: A; clearFilters: A;
151
+ }>("bareFashionSearch", {
152
+ state: BOOT,
153
+ actions: {
154
+ // Every open starts a fresh search: the host can keep this worker alive between
155
+ // opens, so clear the last query and re-request focus with a new token.
156
+ load: (s) => {
157
+ rows = [];
158
+ latestQuery = "";
159
+ return derive({ ...s, query: "", status: "idle", panel: "none", recent: readRecent(), focusToken: String(Date.now()) });
160
+ },
161
+ change: (s, arg) => {
162
+ const query = queryOf(arg);
163
+ return query === s.query && s.status !== "error" ? s : run(query ? { ...s, status: "loading" } : s, query);
164
+ },
165
+ // Keyboard Search key: search now and keep the query as a recent search.
166
+ submit: (s, arg) => {
167
+ const query = queryOf(arg) || s.query;
168
+ const recent = remember(s.recent, query);
169
+ return run({ ...s, recent, status: query ? "loading" : s.status }, query);
170
+ },
171
+ // A recent search fills the field and runs. Dismiss the keyboard first: the
172
+ // field adopts a worker value only while it is not focused.
173
+ pickRecent: (s, arg) => {
174
+ const query = idOf(arg);
175
+ if (!query) return s;
176
+ dismiss().catch(() => undefined);
177
+ return run({ ...s, recent: remember(s.recent, query), status: "loading" }, query);
178
+ },
179
+ removeRecent: (s, arg) => {
180
+ const id = idOf(arg);
181
+ return derive({ ...s, recent: writeRecent(s.recent.filter((r) => r.id !== id)) });
182
+ },
183
+ retry: (s) => run({ ...s, status: "loading" }, s.query),
184
+ // Opening a result counts as a completed search.
185
+ openProduct: (s, arg) => {
186
+ const id = cardId(arg);
187
+ if (!id) return s;
188
+ return navigate({ ...s, recent: remember(s.recent, s.query) }, { screenId: "himi_product", args: { id } });
189
+ },
190
+ toggleSave: (s, arg) => {
191
+ try { toggleFavorite(s.results, cardId(arg)); } catch { return s; }
192
+ return derive(s);
193
+ },
194
+ ...facetActions(derive),
195
+ },
196
+ });
197
+
198
+ svc.load();
199
+ export { svc };
@@ -0,0 +1,79 @@
1
+ // Tier-5 bundle: himi-store — Shop tab. A search bar over the category list.
2
+ // The bar opens the full-screen search (himi_search, worker himi-bare-fashion-search); this
3
+ // screen shows the site's categories as full-width image tiles.
4
+ import { defineService } from "@himalaya/state";
5
+ import { getCurrentCart } from "@himalaya/wix-ecom";
6
+ import { queryCollections } from "@himalaya/wix-stores-collections";
7
+ import { copyParam } from "../_shared/himi-copy.js";
8
+ import { publishBagCount } from "../_shared/bare-fashion-bag-count.js";
9
+ import { categoryCard, orderCategories, type CategoryCard } from "../_shared/bare-fashion-categories.js";
10
+ import { errorFlags, errorKindOf, type ErrorKind } from "../_shared/bare-fashion-load-error.js";
11
+
12
+ interface S {
13
+ status: "loading" | "ready" | "error";
14
+ categories: CategoryCard[];
15
+ cartCount: number;
16
+ emptyText: string;
17
+ isLoading: boolean;
18
+ isErrored: boolean;
19
+ notErrored: boolean;
20
+ hideCategories: boolean;
21
+ /** Why the last load failed: the error state shows the offline or the server variant. */
22
+ errorKind?: ErrorKind;
23
+ hideOfflineError?: boolean;
24
+ hideServerError?: boolean;
25
+ noEmpty: boolean;
26
+ }
27
+
28
+ /** Live cart size (sum of line-item quantities) for the Cart tab badge, or `ok: false` when the
29
+ * cart cannot be read: the screen does not fail, and the badge keeps its stored count. */
30
+ async function cartItemCount(): Promise<{ ok: true; count: number } | { ok: false }> {
31
+ try {
32
+ const cart = await getCurrentCart();
33
+ return { ok: true, count: (cart.lineItems ?? []).reduce((n, li) => n + (li.quantity ?? 1), 0) };
34
+ } catch {
35
+ return { ok: false };
36
+ }
37
+ }
38
+
39
+ /** Recompute every derived flag. State is not reactive: each action must re-derive. */
40
+ function derive(s: S): S {
41
+ const empty = s.status === "ready" && s.categories.length === 0;
42
+ return {
43
+ ...s,
44
+ isLoading: s.status === "loading",
45
+ isErrored: s.status === "error",
46
+ notErrored: s.status !== "error",
47
+ ...errorFlags(s.status, s.errorKind),
48
+ hideCategories: s.status !== "ready",
49
+ noEmpty: !empty,
50
+ emptyText: copyParam("shop.emptyText", "No categories are published yet."),
51
+ };
52
+ }
53
+
54
+ async function load(s: S): Promise<S> {
55
+ const [categoriesResult, live] = await Promise.all([
56
+ queryCollections({ query: { paging: { limit: 50 } } }).then((r) => ({ ok: true as const, r }), (e: unknown) => ({ ok: false as const, e })),
57
+ cartItemCount(),
58
+ ]);
59
+ if (live.ok) await publishBagCount(live.count);
60
+ const cartCount = live.ok ? live.count : s.cartCount;
61
+ if (!categoriesResult.ok) return derive({ ...s, status: "error", errorKind: errorKindOf(categoriesResult.e), cartCount });
62
+ const categories = orderCategories(categoriesResult.r.collections ?? []).map(categoryCard).filter((c) => c.id);
63
+ return derive({ ...s, status: "ready", categories, cartCount });
64
+ }
65
+
66
+ const svc = defineService<S, {
67
+ load: (s: S) => Promise<S>;
68
+ retry: (s: S) => Promise<S>;
69
+ }>("bareFashionShop", {
70
+ state: derive({ status: "loading", categories: [], cartCount: 0, emptyText: "",
71
+ isLoading: true, isErrored: false, notErrored: true, hideCategories: true, noEmpty: true }),
72
+ actions: {
73
+ load: (s) => load(s),
74
+ retry: (s) => load(derive({ ...s, status: "loading" })),
75
+ },
76
+ });
77
+
78
+ svc.load();
79
+ export { svc };