@wix/himalaya-cli 0.1944.0 → 0.1946.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 (371) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/ecom/src/extensions.d.ts +27 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +1 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-ecom.mjs +16 -0
  4. package/dist/browser-plane/assets.json +5 -5
  5. package/dist/browser-plane/preview-deferred/{e113c7cdcf8f56ad861b2564505fab2a1975c7a995f92d2f999f9c4ce1a09a40.bin → 9521361aa5be10b9a96b96c0ea2f7e157e728874b20de5200879cbd735eefb38.bin} +1 -1
  6. package/dist/browser-plane/sw.js +9 -9
  7. package/dist/cli.mjs +1548 -912
  8. package/dist/preview-assets.generated.bin +0 -0
  9. package/fixtures/wix-canned.json +6 -0
  10. package/guides/himi-json-output.md +15 -6
  11. package/guides/one-app-section-mappings.md +2 -2
  12. package/guides/one-app-to-himi-app.md +13 -4
  13. package/guides/release-notes.md +8 -0
  14. package/guides/sdk-reference.json +55 -0
  15. package/package.json +2 -2
  16. package/templates/bare-fashion/dev/index.ts +3 -1
  17. package/templates/bare-fashion/tier5-src/_shared/bare-fashion-product-card.ts +5 -4
  18. package/templates/bare-fashion/tier5-src/_shared/collection-service.ts +35 -15
  19. package/templates/bare-fashion/tier5-src/_shared/engine-intl.ts +65 -0
  20. package/templates/bare-fashion/tier5-src/_shared/himi-store-saved.ts +275 -13
  21. package/templates/bare-fashion/tier5-src/himi-bare-fashion-cart/index.ts +19 -12
  22. package/templates/bare-fashion/tier5-src/himi-bare-fashion-collection/index.ts +9 -4
  23. package/templates/bare-fashion/tier5-src/himi-bare-fashion-home/index.ts +10 -4
  24. package/templates/bare-fashion/tier5-src/himi-bare-fashion-product/index.ts +17 -8
  25. package/templates/bare-fashion/tier5-src/himi-bare-fashion-products/index.ts +8 -4
  26. package/templates/bare-fashion/tier5-src/himi-bare-fashion-saved/index.ts +31 -12
  27. package/templates/bare-fashion/tier5-src/himi-bare-fashion-search/index.ts +8 -4
  28. package/templates/beauty-salon/dev/index.ts +1 -0
  29. package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +35 -15
  30. package/templates/beauty-salon/tier5-src/_shared/engine-intl.ts +65 -0
  31. package/templates/beauty-salon/tier5-src/_shared/himi-store-facets.ts +4 -4
  32. package/templates/beauty-salon/tier5-src/_shared/himi-store-saved.ts +275 -13
  33. package/templates/beauty-salon/tier5-src/_shared/weekly-goal.ts +28 -12
  34. package/templates/beauty-salon/tier5-src/himi-booking-bookings/index.ts +7 -2
  35. package/templates/beauty-salon/tier5-src/himi-branded-lite-cart/index.ts +13 -7
  36. package/templates/beauty-salon/tier5-src/himi-branded-lite-category/index.ts +6 -1
  37. package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +14 -13
  38. package/templates/beauty-salon/tier5-src/himi-branded-lite-shop/index.ts +9 -3
  39. package/templates/beauty-salon/tier5-src/himi-store-product/index.ts +7 -5
  40. package/templates/beauty-salon/tier5-src/himi-store-saved/index.ts +31 -12
  41. package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +35 -15
  42. package/templates/beauty-salon-owner/tier5-src/_shared/engine-intl.ts +65 -0
  43. package/templates/branded-lite/dev/index.ts +4 -2
  44. package/templates/branded-lite/l10n/ar.json +5 -5
  45. package/templates/branded-lite/l10n/cs.json +5 -5
  46. package/templates/branded-lite/l10n/da.json +5 -5
  47. package/templates/branded-lite/l10n/de.json +5 -5
  48. package/templates/branded-lite/l10n/el.json +5 -5
  49. package/templates/branded-lite/l10n/es.json +5 -5
  50. package/templates/branded-lite/l10n/fi.json +5 -5
  51. package/templates/branded-lite/l10n/fr.json +5 -5
  52. package/templates/branded-lite/l10n/he.json +4 -4
  53. package/templates/branded-lite/l10n/hu.json +5 -5
  54. package/templates/branded-lite/l10n/id.json +5 -5
  55. package/templates/branded-lite/l10n/it.json +5 -5
  56. package/templates/branded-lite/l10n/ja.json +5 -5
  57. package/templates/branded-lite/l10n/ko.json +5 -5
  58. package/templates/branded-lite/l10n/lt.json +5 -5
  59. package/templates/branded-lite/l10n/nl.json +5 -5
  60. package/templates/branded-lite/l10n/no.json +5 -5
  61. package/templates/branded-lite/l10n/pl.json +5 -5
  62. package/templates/branded-lite/l10n/pt.json +5 -5
  63. package/templates/branded-lite/l10n/ru.json +5 -5
  64. package/templates/branded-lite/l10n/sv.json +5 -5
  65. package/templates/branded-lite/l10n/th.json +5 -5
  66. package/templates/branded-lite/l10n/tr.json +5 -5
  67. package/templates/branded-lite/l10n/uk.json +5 -5
  68. package/templates/branded-lite/l10n/vi.json +5 -5
  69. package/templates/branded-lite/l10n/zh.json +5 -5
  70. package/templates/branded-lite/recipes/wishlist-grid.json +1 -1
  71. package/templates/branded-lite/tier5-src/_shared/collection-service.ts +42 -19
  72. package/templates/branded-lite/tier5-src/_shared/engine-intl.ts +65 -0
  73. package/templates/branded-lite/tier5-src/_shared/himi-store-facets.ts +4 -4
  74. package/templates/branded-lite/tier5-src/_shared/himi-store-saved.ts +275 -13
  75. package/templates/branded-lite/tier5-src/_shared/performance-tracker-section.ts +24 -16
  76. package/templates/branded-lite/tier5-src/_shared/performance-tracker-weeks.ts +27 -20
  77. package/templates/branded-lite/tier5-src/_shared/saved-products-section.ts +14 -8
  78. package/templates/branded-lite/tier5-src/_shared/weekly-goal.ts +28 -12
  79. package/templates/branded-lite/tier5-src/himi-booking-bookings/index.ts +7 -2
  80. package/templates/branded-lite/tier5-src/himi-branded-lite-cart/index.ts +13 -7
  81. package/templates/branded-lite/tier5-src/himi-branded-lite-category/index.ts +6 -1
  82. package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +14 -13
  83. package/templates/branded-lite/tier5-src/himi-branded-lite-shop/index.ts +9 -3
  84. package/templates/branded-lite/tier5-src/himi-store-product/index.ts +32 -15
  85. package/templates/branded-lite/tier5-src/himi-store-saved/index.ts +31 -12
  86. package/templates/brandy/tier5-src/_shared/collection-service.ts +42 -19
  87. package/templates/brandy/tier5-src/_shared/engine-intl.ts +65 -0
  88. package/templates/brandy/tier5-src/_shared/himi-store-saved.ts +275 -13
  89. package/templates/brandy/tier5-src/himi-branded-lite-cart/index.ts +13 -7
  90. package/templates/community-club/dev/index.ts +1 -0
  91. package/templates/community-club/l10n/ar.json +5 -0
  92. package/templates/community-club/l10n/cs.json +5 -0
  93. package/templates/community-club/l10n/da.json +5 -0
  94. package/templates/community-club/l10n/de.json +5 -0
  95. package/templates/community-club/l10n/el.json +5 -0
  96. package/templates/community-club/l10n/es.json +5 -0
  97. package/templates/community-club/l10n/fi.json +5 -0
  98. package/templates/community-club/l10n/fr.json +5 -0
  99. package/templates/community-club/l10n/he.json +4 -0
  100. package/templates/community-club/l10n/hu.json +5 -0
  101. package/templates/community-club/l10n/id.json +5 -0
  102. package/templates/community-club/l10n/it.json +5 -0
  103. package/templates/community-club/l10n/ja.json +5 -0
  104. package/templates/community-club/l10n/ko.json +5 -0
  105. package/templates/community-club/l10n/lt.json +5 -0
  106. package/templates/community-club/l10n/nl.json +5 -0
  107. package/templates/community-club/l10n/no.json +5 -0
  108. package/templates/community-club/l10n/pl.json +5 -0
  109. package/templates/community-club/l10n/pt.json +5 -0
  110. package/templates/community-club/l10n/ru.json +5 -0
  111. package/templates/community-club/l10n/sv.json +5 -0
  112. package/templates/community-club/l10n/th.json +5 -0
  113. package/templates/community-club/l10n/tr.json +5 -0
  114. package/templates/community-club/l10n/uk.json +5 -0
  115. package/templates/community-club/l10n/vi.json +5 -0
  116. package/templates/community-club/l10n/zh.json +5 -0
  117. package/templates/community-club/tier5-src/_shared/collection-service.ts +35 -15
  118. package/templates/community-club/tier5-src/_shared/engine-intl.ts +65 -0
  119. package/templates/community-club/tier5-src/_shared/himi-store-saved.ts +275 -13
  120. package/templates/community-club/tier5-src/_shared/weekly-goal.ts +28 -12
  121. package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +14 -13
  122. package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +35 -15
  123. package/templates/community-club-owner/tier5-src/_shared/engine-intl.ts +65 -0
  124. package/templates/conference/tier5-src/_shared/collection-service.ts +35 -15
  125. package/templates/conference/tier5-src/_shared/engine-intl.ts +65 -0
  126. package/templates/events-meetups/dev/index.ts +1 -0
  127. package/templates/events-meetups/l10n/ar.json +5 -0
  128. package/templates/events-meetups/l10n/cs.json +5 -0
  129. package/templates/events-meetups/l10n/da.json +5 -0
  130. package/templates/events-meetups/l10n/de.json +5 -0
  131. package/templates/events-meetups/l10n/el.json +5 -0
  132. package/templates/events-meetups/l10n/es.json +5 -0
  133. package/templates/events-meetups/l10n/fi.json +5 -0
  134. package/templates/events-meetups/l10n/fr.json +5 -0
  135. package/templates/events-meetups/l10n/he.json +4 -0
  136. package/templates/events-meetups/l10n/hu.json +5 -0
  137. package/templates/events-meetups/l10n/id.json +5 -0
  138. package/templates/events-meetups/l10n/it.json +5 -0
  139. package/templates/events-meetups/l10n/ja.json +5 -0
  140. package/templates/events-meetups/l10n/ko.json +5 -0
  141. package/templates/events-meetups/l10n/lt.json +5 -0
  142. package/templates/events-meetups/l10n/nl.json +5 -0
  143. package/templates/events-meetups/l10n/no.json +5 -0
  144. package/templates/events-meetups/l10n/pl.json +5 -0
  145. package/templates/events-meetups/l10n/pt.json +5 -0
  146. package/templates/events-meetups/l10n/ru.json +5 -0
  147. package/templates/events-meetups/l10n/sv.json +5 -0
  148. package/templates/events-meetups/l10n/th.json +5 -0
  149. package/templates/events-meetups/l10n/tr.json +5 -0
  150. package/templates/events-meetups/l10n/uk.json +5 -0
  151. package/templates/events-meetups/l10n/vi.json +5 -0
  152. package/templates/events-meetups/l10n/zh.json +5 -0
  153. package/templates/events-meetups/tier5-src/_shared/collection-service.ts +35 -15
  154. package/templates/events-meetups/tier5-src/_shared/engine-intl.ts +65 -0
  155. package/templates/events-meetups/tier5-src/_shared/himi-store-saved.ts +275 -13
  156. package/templates/events-meetups/tier5-src/_shared/weekly-goal.ts +28 -12
  157. package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +14 -13
  158. package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +35 -15
  159. package/templates/events-meetups-owner/tier5-src/_shared/engine-intl.ts +65 -0
  160. package/templates/fitness-gym/tier5-src/_shared/collection-service.ts +35 -15
  161. package/templates/fitness-gym/tier5-src/_shared/engine-intl.ts +65 -0
  162. package/templates/fitness-gym/tier5-src/_shared/weekly-goal.ts +28 -12
  163. package/templates/fitness-gym/tier5-src/himi-booking-bookings/index.ts +7 -2
  164. package/templates/fitness-gym/tier5-src/himi-fitcoach-home/index.ts +3 -2
  165. package/templates/gym-fitness/dev/index.ts +3 -1
  166. package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +35 -15
  167. package/templates/gym-fitness/tier5-src/_shared/engine-intl.ts +65 -0
  168. package/templates/gym-fitness/tier5-src/_shared/himi-store-facets.ts +4 -4
  169. package/templates/gym-fitness/tier5-src/_shared/himi-store-saved.ts +275 -13
  170. package/templates/gym-fitness/tier5-src/_shared/weekly-goal.ts +28 -12
  171. package/templates/gym-fitness/tier5-src/himi-booking-bookings/index.ts +7 -2
  172. package/templates/gym-fitness/tier5-src/himi-branded-lite-cart/index.ts +13 -7
  173. package/templates/gym-fitness/tier5-src/himi-branded-lite-category/index.ts +6 -1
  174. package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +14 -13
  175. package/templates/gym-fitness/tier5-src/himi-branded-lite-shop/index.ts +9 -3
  176. package/templates/gym-fitness/tier5-src/himi-store-product/index.ts +7 -5
  177. package/templates/gym-fitness/tier5-src/himi-store-saved/index.ts +31 -12
  178. package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +35 -15
  179. package/templates/gym-fitness-owner/tier5-src/_shared/engine-intl.ts +65 -0
  180. package/templates/medical-services/tier5-src/_shared/collection-service.ts +35 -15
  181. package/templates/medical-services/tier5-src/_shared/engine-intl.ts +65 -0
  182. package/templates/medical-services/tier5-src/_shared/weekly-goal.ts +28 -12
  183. package/templates/medical-services/tier5-src/himi-booking-bookings/index.ts +7 -2
  184. package/templates/nonprofit-cause/dev/index.ts +1 -0
  185. package/templates/nonprofit-cause/l10n/ar.json +5 -0
  186. package/templates/nonprofit-cause/l10n/cs.json +5 -0
  187. package/templates/nonprofit-cause/l10n/da.json +5 -0
  188. package/templates/nonprofit-cause/l10n/de.json +5 -0
  189. package/templates/nonprofit-cause/l10n/el.json +5 -0
  190. package/templates/nonprofit-cause/l10n/es.json +5 -0
  191. package/templates/nonprofit-cause/l10n/fi.json +5 -0
  192. package/templates/nonprofit-cause/l10n/fr.json +5 -0
  193. package/templates/nonprofit-cause/l10n/he.json +4 -0
  194. package/templates/nonprofit-cause/l10n/hu.json +5 -0
  195. package/templates/nonprofit-cause/l10n/id.json +5 -0
  196. package/templates/nonprofit-cause/l10n/it.json +5 -0
  197. package/templates/nonprofit-cause/l10n/ja.json +5 -0
  198. package/templates/nonprofit-cause/l10n/ko.json +5 -0
  199. package/templates/nonprofit-cause/l10n/lt.json +5 -0
  200. package/templates/nonprofit-cause/l10n/nl.json +5 -0
  201. package/templates/nonprofit-cause/l10n/no.json +5 -0
  202. package/templates/nonprofit-cause/l10n/pl.json +5 -0
  203. package/templates/nonprofit-cause/l10n/pt.json +5 -0
  204. package/templates/nonprofit-cause/l10n/ru.json +5 -0
  205. package/templates/nonprofit-cause/l10n/sv.json +5 -0
  206. package/templates/nonprofit-cause/l10n/th.json +5 -0
  207. package/templates/nonprofit-cause/l10n/tr.json +5 -0
  208. package/templates/nonprofit-cause/l10n/uk.json +5 -0
  209. package/templates/nonprofit-cause/l10n/vi.json +5 -0
  210. package/templates/nonprofit-cause/l10n/zh.json +5 -0
  211. package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +35 -15
  212. package/templates/nonprofit-cause/tier5-src/_shared/engine-intl.ts +65 -0
  213. package/templates/nonprofit-cause/tier5-src/_shared/himi-store-saved.ts +275 -13
  214. package/templates/nonprofit-cause/tier5-src/_shared/weekly-goal.ts +28 -12
  215. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +14 -13
  216. package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +35 -15
  217. package/templates/nonprofit-cause-owner/tier5-src/_shared/engine-intl.ts +65 -0
  218. package/templates/owner-lite/tier5-src/_shared/collection-service.ts +35 -15
  219. package/templates/owner-lite/tier5-src/_shared/engine-intl.ts +65 -0
  220. package/templates/personal-fitness-trainer/tier5-src/_shared/collection-service.ts +35 -15
  221. package/templates/personal-fitness-trainer/tier5-src/_shared/engine-intl.ts +65 -0
  222. package/templates/personal-fitness-trainer/tier5-src/_shared/weekly-goal.ts +28 -12
  223. package/templates/personal-fitness-trainer/tier5-src/himi-booking-bookings/index.ts +7 -2
  224. package/templates/podcast-creator/dev/index.ts +1 -0
  225. package/templates/podcast-creator/l10n/ar.json +5 -0
  226. package/templates/podcast-creator/l10n/cs.json +5 -0
  227. package/templates/podcast-creator/l10n/da.json +5 -0
  228. package/templates/podcast-creator/l10n/de.json +5 -0
  229. package/templates/podcast-creator/l10n/el.json +5 -0
  230. package/templates/podcast-creator/l10n/es.json +5 -0
  231. package/templates/podcast-creator/l10n/fi.json +5 -0
  232. package/templates/podcast-creator/l10n/fr.json +5 -0
  233. package/templates/podcast-creator/l10n/he.json +4 -0
  234. package/templates/podcast-creator/l10n/hu.json +5 -0
  235. package/templates/podcast-creator/l10n/id.json +5 -0
  236. package/templates/podcast-creator/l10n/it.json +5 -0
  237. package/templates/podcast-creator/l10n/ja.json +5 -0
  238. package/templates/podcast-creator/l10n/ko.json +5 -0
  239. package/templates/podcast-creator/l10n/lt.json +5 -0
  240. package/templates/podcast-creator/l10n/nl.json +5 -0
  241. package/templates/podcast-creator/l10n/no.json +5 -0
  242. package/templates/podcast-creator/l10n/pl.json +5 -0
  243. package/templates/podcast-creator/l10n/pt.json +5 -0
  244. package/templates/podcast-creator/l10n/ru.json +5 -0
  245. package/templates/podcast-creator/l10n/sv.json +5 -0
  246. package/templates/podcast-creator/l10n/th.json +5 -0
  247. package/templates/podcast-creator/l10n/tr.json +5 -0
  248. package/templates/podcast-creator/l10n/uk.json +5 -0
  249. package/templates/podcast-creator/l10n/vi.json +5 -0
  250. package/templates/podcast-creator/l10n/zh.json +5 -0
  251. package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +35 -15
  252. package/templates/podcast-creator/tier5-src/_shared/engine-intl.ts +65 -0
  253. package/templates/podcast-creator/tier5-src/_shared/himi-store-saved.ts +275 -13
  254. package/templates/podcast-creator/tier5-src/_shared/weekly-goal.ts +28 -12
  255. package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +14 -13
  256. package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +35 -15
  257. package/templates/podcast-creator-owner/tier5-src/_shared/engine-intl.ts +65 -0
  258. package/templates/portfolio-creative/dev/index.ts +1 -0
  259. package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +35 -15
  260. package/templates/portfolio-creative/tier5-src/_shared/engine-intl.ts +65 -0
  261. package/templates/portfolio-creative/tier5-src/_shared/himi-store-facets.ts +4 -4
  262. package/templates/portfolio-creative/tier5-src/_shared/himi-store-saved.ts +275 -13
  263. package/templates/portfolio-creative/tier5-src/_shared/weekly-goal.ts +28 -12
  264. package/templates/portfolio-creative/tier5-src/himi-branded-lite-cart/index.ts +13 -7
  265. package/templates/portfolio-creative/tier5-src/himi-branded-lite-category/index.ts +6 -1
  266. package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +14 -13
  267. package/templates/portfolio-creative/tier5-src/himi-branded-lite-shop/index.ts +9 -3
  268. package/templates/portfolio-creative/tier5-src/himi-store-product/index.ts +7 -5
  269. package/templates/portfolio-creative/tier5-src/himi-store-saved/index.ts +31 -12
  270. package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +35 -15
  271. package/templates/portfolio-creative-owner/tier5-src/_shared/engine-intl.ts +65 -0
  272. package/templates/professional-services/tier5-src/_shared/collection-service.ts +35 -15
  273. package/templates/professional-services/tier5-src/_shared/engine-intl.ts +65 -0
  274. package/templates/professional-services/tier5-src/_shared/weekly-goal.ts +28 -12
  275. package/templates/professional-services/tier5-src/himi-booking-bookings/index.ts +7 -2
  276. package/templates/restaurant/dev/index.ts +1 -0
  277. package/templates/restaurant/l10n/ar.json +5 -0
  278. package/templates/restaurant/l10n/cs.json +5 -0
  279. package/templates/restaurant/l10n/da.json +5 -0
  280. package/templates/restaurant/l10n/de.json +5 -0
  281. package/templates/restaurant/l10n/el.json +5 -0
  282. package/templates/restaurant/l10n/es.json +5 -0
  283. package/templates/restaurant/l10n/fi.json +5 -0
  284. package/templates/restaurant/l10n/fr.json +5 -0
  285. package/templates/restaurant/l10n/he.json +4 -0
  286. package/templates/restaurant/l10n/hu.json +5 -0
  287. package/templates/restaurant/l10n/id.json +5 -0
  288. package/templates/restaurant/l10n/it.json +5 -0
  289. package/templates/restaurant/l10n/ja.json +5 -0
  290. package/templates/restaurant/l10n/ko.json +5 -0
  291. package/templates/restaurant/l10n/lt.json +5 -0
  292. package/templates/restaurant/l10n/nl.json +5 -0
  293. package/templates/restaurant/l10n/no.json +5 -0
  294. package/templates/restaurant/l10n/pl.json +5 -0
  295. package/templates/restaurant/l10n/pt.json +5 -0
  296. package/templates/restaurant/l10n/ru.json +5 -0
  297. package/templates/restaurant/l10n/sv.json +5 -0
  298. package/templates/restaurant/l10n/th.json +5 -0
  299. package/templates/restaurant/l10n/tr.json +5 -0
  300. package/templates/restaurant/l10n/uk.json +5 -0
  301. package/templates/restaurant/l10n/vi.json +5 -0
  302. package/templates/restaurant/l10n/zh.json +5 -0
  303. package/templates/restaurant/tier5-src/_shared/collection-service.ts +35 -15
  304. package/templates/restaurant/tier5-src/_shared/engine-intl.ts +65 -0
  305. package/templates/restaurant/tier5-src/_shared/himi-store-saved.ts +275 -13
  306. package/templates/restaurant/tier5-src/_shared/weekly-goal.ts +28 -12
  307. package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +14 -13
  308. package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +35 -15
  309. package/templates/restaurant-owner/tier5-src/_shared/engine-intl.ts +65 -0
  310. package/templates/retail-store/dev/index.ts +1 -0
  311. package/templates/retail-store/tier5-src/_shared/collection-service.ts +42 -19
  312. package/templates/retail-store/tier5-src/_shared/engine-intl.ts +65 -0
  313. package/templates/retail-store/tier5-src/_shared/himi-store-facets.ts +4 -4
  314. package/templates/retail-store/tier5-src/_shared/himi-store-saved.ts +275 -13
  315. package/templates/retail-store/tier5-src/_shared/weekly-goal.ts +28 -12
  316. package/templates/retail-store/tier5-src/himi-branded-lite-cart/index.ts +13 -7
  317. package/templates/retail-store/tier5-src/himi-branded-lite-category/index.ts +6 -1
  318. package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +14 -13
  319. package/templates/retail-store/tier5-src/himi-branded-lite-shop/index.ts +9 -3
  320. package/templates/retail-store/tier5-src/himi-store-product/index.ts +32 -15
  321. package/templates/retail-store/tier5-src/himi-store-saved/index.ts +31 -12
  322. package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +35 -15
  323. package/templates/retail-store-owner/tier5-src/_shared/engine-intl.ts +65 -0
  324. package/templates/salon-spa/tier5-src/_shared/collection-service.ts +35 -15
  325. package/templates/salon-spa/tier5-src/_shared/engine-intl.ts +65 -0
  326. package/templates/salon-spa/tier5-src/_shared/weekly-goal.ts +28 -12
  327. package/templates/salon-spa/tier5-src/himi-booking-bookings/index.ts +7 -2
  328. package/templates/wholesale-store/dev/index.ts +2 -2
  329. package/templates/wholesale-store/tier5-src/_shared/collection-service.ts +42 -19
  330. package/templates/wholesale-store/tier5-src/_shared/engine-intl.ts +65 -0
  331. package/templates/wholesale-store/tier5-src/_shared/himi-store-collection.ts +7 -3
  332. package/templates/wholesale-store/tier5-src/_shared/himi-store-saved.ts +275 -13
  333. package/templates/wholesale-store/tier5-src/himi-branded-lite-cart/index.ts +13 -7
  334. package/templates/wholesale-store/tier5-src/himi-store-product/index.ts +32 -15
  335. package/templates/wholesale-store/tier5-src/himi-store-saved/index.ts +31 -12
  336. package/templates/wholesale-store/tier5-src/himi-wholesale-home/index.ts +19 -8
  337. package/templates/yoga-studio/dev/index.ts +3 -1
  338. package/templates/yoga-studio/l10n/ar.json +5 -0
  339. package/templates/yoga-studio/l10n/cs.json +5 -0
  340. package/templates/yoga-studio/l10n/da.json +5 -0
  341. package/templates/yoga-studio/l10n/de.json +5 -0
  342. package/templates/yoga-studio/l10n/el.json +5 -0
  343. package/templates/yoga-studio/l10n/es.json +5 -0
  344. package/templates/yoga-studio/l10n/fi.json +5 -0
  345. package/templates/yoga-studio/l10n/fr.json +5 -0
  346. package/templates/yoga-studio/l10n/he.json +4 -0
  347. package/templates/yoga-studio/l10n/hu.json +5 -0
  348. package/templates/yoga-studio/l10n/id.json +5 -0
  349. package/templates/yoga-studio/l10n/it.json +5 -0
  350. package/templates/yoga-studio/l10n/ja.json +5 -0
  351. package/templates/yoga-studio/l10n/ko.json +5 -0
  352. package/templates/yoga-studio/l10n/lt.json +5 -0
  353. package/templates/yoga-studio/l10n/nl.json +5 -0
  354. package/templates/yoga-studio/l10n/no.json +5 -0
  355. package/templates/yoga-studio/l10n/pl.json +5 -0
  356. package/templates/yoga-studio/l10n/pt.json +5 -0
  357. package/templates/yoga-studio/l10n/ru.json +5 -0
  358. package/templates/yoga-studio/l10n/sv.json +5 -0
  359. package/templates/yoga-studio/l10n/th.json +5 -0
  360. package/templates/yoga-studio/l10n/tr.json +5 -0
  361. package/templates/yoga-studio/l10n/uk.json +5 -0
  362. package/templates/yoga-studio/l10n/vi.json +5 -0
  363. package/templates/yoga-studio/l10n/zh.json +5 -0
  364. package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +35 -15
  365. package/templates/yoga-studio/tier5-src/_shared/engine-intl.ts +65 -0
  366. package/templates/yoga-studio/tier5-src/_shared/himi-store-saved.ts +275 -13
  367. package/templates/yoga-studio/tier5-src/_shared/weekly-goal.ts +28 -12
  368. package/templates/yoga-studio/tier5-src/himi-booking-bookings/index.ts +7 -2
  369. package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +14 -13
  370. package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +35 -15
  371. package/templates/yoga-studio-owner/tier5-src/_shared/engine-intl.ts +65 -0
@@ -2457,6 +2457,11 @@
2457
2457
  "translation": "sélectionné(s)",
2458
2458
  "origin": "one-app:wix-one-app-forms:FORMS_FIELD_COMPOSER_SELECTED_ITEMS"
2459
2459
  },
2460
+ "h_dd3b86d1ef21": {
2461
+ "source": "Product",
2462
+ "translation": "Article",
2463
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2464
+ },
2460
2465
  "h_34d8b60fe253": {
2461
2466
  "source": "Hide",
2462
2467
  "translation": "Masquer",
@@ -2026,6 +2026,10 @@
2026
2026
  "source": "selected",
2027
2027
  "translation": "נבחר"
2028
2028
  },
2029
+ "h_dd3b86d1ef21": {
2030
+ "source": "Product",
2031
+ "translation": "מוצר"
2032
+ },
2029
2033
  "h_34d8b60fe253": {
2030
2034
  "source": "Hide",
2031
2035
  "translation": "הסתרה"
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "kijelölve",
2478
2478
  "origin": "one-app:wix-one-app-forms:FORMS_FIELD_COMPOSER_SELECTED_ITEMS"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "Termék",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "Elrejtés",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "dipilih",
2478
2478
  "origin": "one-app:wix-one-app-forms:FORMS_FIELD_COMPOSER_SELECTED_ITEMS"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "Produk",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "Sembunyikan",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "selezionato",
2478
2478
  "origin": "machine"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "Prodotto",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "Nascondi",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "選択中",
2478
2478
  "origin": "one-app:mobile-apps-inbox:ARIA_BUSINESS_SELECTOR_SELECTED"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "商品",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "非表示",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "선택됨",
2478
2478
  "origin": "one-app:wix-one-app-forms:FORMS_FIELD_COMPOSER_SELECTED_ITEMS"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "제품",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "비공개",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "pasirinkta",
2478
2478
  "origin": "one-app:wix-one-app-forms:FORMS_FIELD_COMPOSER_SELECTED_ITEMS"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "Produktas",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "Slėpti",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "geselecteerd",
2478
2478
  "origin": "one-app:wix-one-app-forms:FORMS_FIELD_COMPOSER_SELECTED_ITEMS"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "Product",
2483
+ "origin": "machine"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "Verbergen",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "valgte",
2478
2478
  "origin": "one-app:wix-one-app-forms:FORMS_FIELD_COMPOSER_SELECTED_ITEMS"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "Produkt",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "Skjul",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "wybrano",
2478
2478
  "origin": "machine"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "Produkt",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "Ukryj",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "selecionado",
2478
2478
  "origin": "machine"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "Produto",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "Ocultar",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "выбрано",
2478
2478
  "origin": "one-app:wix-one-app-forms:FORMS_FIELD_COMPOSER_SELECTED_ITEMS"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "Товар",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "Скрыть",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "valda",
2478
2478
  "origin": "one-app:wix-one-app-forms:FORMS_FIELD_COMPOSER_SELECTED_ITEMS"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "Produkt",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "Dölj",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "เลือกแล้ว",
2478
2478
  "origin": "one-app:mobile-apps-inbox:ARIA_BUSINESS_SELECTOR_SELECTED"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "สินค้า",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "ซ่อน",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "seçili",
2478
2478
  "origin": "one-app:wix-one-app-forms:FORMS_FIELD_COMPOSER_SELECTED_ITEMS"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "Ürün",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "Gizle",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "обрано",
2478
2478
  "origin": "one-app:wix-one-app-forms:FORMS_FIELD_COMPOSER_SELECTED_ITEMS"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "Товар",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "Приховати",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "đã chọn",
2478
2478
  "origin": "one-app:wix-one-app-forms:FORMS_FIELD_COMPOSER_SELECTED_ITEMS"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "Sản phẩm",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "Ẩn",
@@ -2477,6 +2477,11 @@
2477
2477
  "translation": "已選擇",
2478
2478
  "origin": "one-app:mobile-apps-inbox:ARIA_BUSINESS_SELECTOR_SELECTED"
2479
2479
  },
2480
+ "h_dd3b86d1ef21": {
2481
+ "source": "Product",
2482
+ "translation": "產品",
2483
+ "origin": "one-app:wix-one-app-ecom-platform:merchant.ordersList.filters.products.heading"
2484
+ },
2480
2485
  "h_34d8b60fe253": {
2481
2486
  "source": "Hide",
2482
2487
  "translation": "隱藏",
@@ -15,7 +15,10 @@ type MemberAvatarFactory = (changed: () => void) => {
15
15
 
16
16
  export interface CollectionSaving {
17
17
  read(): string[];
18
- write(ids: string[], rows: Record<string, unknown>[]): void;
18
+ /** May settle later (an account write); a rejection restores the selection and says so. */
19
+ write(ids: string[], rows: Record<string, unknown>[]): void | Promise<void>;
20
+ /** Re-read the saved ids `read` answers (an account list), before a load or refresh reads them. */
21
+ refresh?(): Promise<void>;
19
22
  }
20
23
  type State = Record<string, unknown>;
21
24
  interface BackendCollection {
@@ -263,19 +266,33 @@ export function decorateCollection(name: string, def: { state: State; actions?:
263
266
  const criteriaBefore = criteriaKey();
264
267
  const before = [...prefs.savedIds], undoBefore = lastUndo;
265
268
  update(arg, s);
269
+ const failed = () => {
270
+ prefs.savedIds = before; lastUndo = undoBefore;
271
+ saveMessage = copyParam('collection.saveError', 'Could not save this change. Try again.');
272
+ };
273
+ const finish = (settledLater: boolean) => {
274
+ persisted.write(prefs);
275
+ if (backend && config.backendQuery && criteriaBefore !== criteriaKey()) return backend.controller.query(criteria()).then(() => undefined);
276
+ // A write that settled later lands on the rows as they are now, not as they were when it began.
277
+ return derive(settledLater && backend ? backend.apply(s, backend.controller.getState()) : s);
278
+ };
266
279
  if (saving && JSON.stringify(before) !== JSON.stringify(prefs.savedIds)) {
280
+ let written: void | Promise<void>;
267
281
  try {
268
- saving.write(prefs.savedIds, Array.isArray(s[config.rows]) ? s[config.rows] as CollectionRow[] : []);
269
- saveMessage = '';
282
+ written = saving.write(prefs.savedIds, Array.isArray(s[config.rows]) ? s[config.rows] as CollectionRow[] : []);
270
283
  } catch {
271
- prefs.savedIds = before; lastUndo = undoBefore;
272
- saveMessage = copyParam('collection.saveError', 'Could not save this change. Try again.');
284
+ failed();
285
+ return finish(false);
286
+ }
287
+ if (written && typeof written.then === 'function') {
288
+ return written.then(() => { saveMessage = ''; return finish(true); }, () => { failed(); return finish(true); });
273
289
  }
290
+ saveMessage = '';
274
291
  }
275
- persisted.write(prefs);
276
- if (backend && config.backendQuery && criteriaBefore !== criteriaKey()) return backend.controller.query(criteria()).then(() => undefined);
277
- return derive(s);
292
+ return finish(false);
278
293
  };
294
+ /** Runs `then` once the saved ids are re-read (an account list); at once, in the same turn, when there is nothing to re-read. */
295
+ const afterSavingRefresh = (then: () => Promise<undefined>): Promise<undefined> => saving?.refresh ? saving.refresh().catch(() => undefined).then(then) : then();
279
296
  /** Filter and sort in ONE criteria change, so a tab that sets both runs one query, not two. */
280
297
  const setCriteria = (arg: unknown): void => {
281
298
  const input = object(arg);
@@ -329,15 +346,18 @@ export function decorateCollection(name: string, def: { state: State; actions?:
329
346
  if (backend) {
330
347
  actions.collectionDataChanged = s => derive(backend.apply(s, backend.controller.getState()));
331
348
  actions.load = (_s, arg) => {
332
- stashCopy(arg); syncSaved(); applyNavigationCriteria(arg, _s);
333
- const reset = backend.onLoad?.(arg);
334
- if (reset) { setCriteria(reset); persisted.write(prefs); }
335
- // A load of what the screen already shows is the screen coming back: it revalidates behind its rows.
336
- return backend.controller.query(criteria(), backend.restorePagesOnLoad, true).then(() => undefined);
349
+ stashCopy(arg);
350
+ return afterSavingRefresh(() => {
351
+ syncSaved(); applyNavigationCriteria(arg, _s);
352
+ const reset = backend.onLoad?.(arg);
353
+ if (reset) { setCriteria(reset); persisted.write(prefs); }
354
+ // A load of what the screen already shows is the screen coming back: it revalidates behind its rows.
355
+ return backend.controller.query(criteria(), backend.restorePagesOnLoad, true).then(() => undefined);
356
+ });
337
357
  };
338
358
  actions.refresh = (_s, arg) => {
339
- stashCopy(arg); syncSaved();
340
- return backend.controller.query(criteria()).then(() => undefined);
359
+ stashCopy(arg);
360
+ return afterSavingRefresh(() => { syncSaved(); return backend.controller.query(criteria()).then(() => undefined); });
341
361
  };
342
362
  actions.loadMore = () => backend.controller.loadMore().then(() => undefined);
343
363
  actions.retry = actions.collectionRetry = () => backend.controller.retry().then(() => undefined);
@@ -27,6 +27,21 @@ export function hasIntl(): boolean {
27
27
  return typeof Intl !== "undefined";
28
28
  }
29
29
 
30
+ /** ECMA-402's first day of the week for `locale` (1 = Monday … 7 = Sunday), or undefined where this engine has no
31
+ * `Intl.Locale` week info (QuickJS has no `Intl`; older JSC / V8 / Hermes have no week info). Callers keep a CLDR table for
32
+ * that case, so every engine starts the same week (`weekly-goal.ts` `firstWeekdayOf`). */
33
+ export function intlFirstDayOfWeek(locale: string): number | undefined {
34
+ try {
35
+ // The guard form `worker-globals:check` reads as guarded: the `Intl` use sits inside the `typeof` test's block.
36
+ if (typeof Intl !== "undefined" && typeof Intl.Locale === "function") {
37
+ const loc = new Intl.Locale(locale) as Intl.Locale & { getWeekInfo?: () => { firstDay?: number }; weekInfo?: { firstDay?: number } };
38
+ const firstDay = (typeof loc.getWeekInfo === "function" ? loc.getWeekInfo() : loc.weekInfo)?.firstDay;
39
+ if (typeof firstDay === "number" && Number.isInteger(firstDay) && firstDay >= 1 && firstDay <= 7) return firstDay;
40
+ }
41
+ } catch { /* a malformed tag */ }
42
+ return undefined;
43
+ }
44
+
30
45
  /** The device's IANA time zone, or "UTC" where this engine has no ECMA-402 or no zone data. */
31
46
  export function deviceTimeZone(): string {
32
47
  try {
@@ -536,3 +551,53 @@ export function formatTimeZoneLabel(date: Date, timeZone: string, locale = "en")
536
551
  }
537
552
  return "";
538
553
  }
554
+
555
+ // ── The first day of the week ──────────────────────────────────────────────────────────────────────────────────────────────
556
+ // 0 = Sunday … 6 = Saturday, for the app language: the one rule every weekly count and every week a screen shows uses
557
+ // (`weekly-goal.ts`, the performance tracker, the Agenda's descriptor, the one-app generator). CLDR week data: Sunday for "en" /
558
+ // "en-US", Monday for "en-GB" or "de", Saturday for "ar-EG". ECMA-402 week info where the engine has it (`intlFirstDayOfWeek`),
559
+ // a CLDR table where it has not, so iOS, Android, web and a build host agree. It lives here rather than in its own file because
560
+ // every generated template already ships this module, and the public catalog's manifest lists each template file.
561
+
562
+ /** 0 = Sunday … 6 = Saturday, as `Date.prototype.getDay`. */
563
+ export type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
564
+ export const MONDAY: Weekday = 1;
565
+
566
+ // CLDR `weekData.firstDay` (supplemental data), by region: every region not listed starts on Monday.
567
+ const SUNDAY_REGIONS = new Set("AG AS BD BR BS BT BW BZ CA CN CO DM DO ET GT GU HK HN ID IL IN JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PT PY SA SG SV TH TT TW UM US VE VI WS YE ZA ZW".split(" "));
568
+ const SATURDAY_REGIONS = new Set("AE AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY".split(" "));
569
+ const FRIDAY_REGIONS = new Set(["MV"]);
570
+ // The region CLDR's likely subtags give a bare language, for the languages whose region does not start on Monday.
571
+ const LIKELY_REGION: Record<string, string> = {
572
+ en: "US", he: "IL", iw: "IL", ar: "EG", pt: "BR", ja: "JP", zh: "CN", ko: "KR", hi: "IN", bn: "BD", th: "TH", id: "ID",
573
+ fa: "IR", ur: "PK", my: "MM", km: "KH", lo: "LA", ne: "NP", am: "ET", mr: "IN", ta: "IN", te: "IN", gu: "IN", kn: "IN",
574
+ ml: "IN", pa: "IN", fil: "PH", tl: "PH", zu: "ZA", dz: "BT", dv: "MV", ps: "AF",
575
+ };
576
+
577
+ /** The region of a language tag ("en-GB" → "GB", "zh-Hant-TW" → "TW"), else its language's likely region, else "". */
578
+ function regionOf(locale: string): string {
579
+ const parts = locale.split(/[-_]/);
580
+ const region = parts.slice(1).find((p) => /^(?:[A-Za-z]{2}|\d{3})$/.test(p));
581
+ if (region) return region.toUpperCase();
582
+ // A script with no region: Traditional Chinese is Taiwan's.
583
+ if (parts[0]?.toLowerCase() === "zh" && parts.some((p) => p.toLowerCase() === "hant")) return "TW";
584
+ return LIKELY_REGION[(parts[0] ?? "").toLowerCase()] ?? "";
585
+ }
586
+
587
+ /** The first day of the week for `locale` (the app language by default). */
588
+ export function firstWeekdayOf(locale: string = appLocale()): Weekday {
589
+ // ECMA-402 numbers the days 1 = Monday … 7 = Sunday. A malformed tag or an engine without week info: the CLDR table below.
590
+ const firstDay = intlFirstDayOfWeek(locale);
591
+ if (firstDay !== undefined) return (firstDay % 7) as Weekday;
592
+ const region = regionOf(locale);
593
+ if (SUNDAY_REGIONS.has(region)) return 0;
594
+ if (SATURDAY_REGIONS.has(region)) return 6;
595
+ if (FRIDAY_REGIONS.has(region)) return 5;
596
+ return MONDAY;
597
+ }
598
+
599
+ /** A screen's `firstWeekday` param (0..6, or its text) when it pins one, else the app language's first day. */
600
+ export function resolveFirstWeekday(raw?: unknown, locale: string = appLocale()): Weekday {
601
+ const n = typeof raw === "number" ? raw : typeof raw === "string" && raw.trim() !== "" ? Number(raw) : NaN;
602
+ return Number.isInteger(n) && n >= 0 && n <= 6 ? (n as Weekday) : firstWeekdayOf(locale);
603
+ }