@wix/himalaya-cli 0.1392.0 → 0.1393.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 (284) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/bookings-v2/src/extensions.d.ts +7 -5
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-bookings.mjs +4 -4
  3. package/dist/cli.mjs +31 -24
  4. package/dist/preview-assets.generated.bin +0 -0
  5. package/guides/sdk-reference.json +4 -4
  6. package/package.json +2 -2
  7. package/templates/beauty-salon/tier5-src/_shared/owner-load-error.ts +115 -12
  8. package/templates/beauty-salon/tier5-src/himi-branded-lite-cart/index.ts +52 -28
  9. package/templates/beauty-salon-owner/dev/index.ts +545 -100
  10. package/templates/beauty-salon-owner/himalaya.content.json +6 -0
  11. package/templates/beauty-salon-owner/tier5-src/_shared/owner-account.ts +6 -2
  12. package/templates/beauty-salon-owner/tier5-src/_shared/owner-booking-respond.ts +82 -0
  13. package/templates/beauty-salon-owner/tier5-src/_shared/owner-load-error.ts +115 -12
  14. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-account/index.ts +7 -4
  15. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-appointments/index.ts +2 -2
  16. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-ask/live.ts +3 -3
  17. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-home/index.ts +2 -2
  18. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-order/index.ts +3 -3
  19. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-orders/index.ts +2 -2
  20. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-overview/index.ts +2 -2
  21. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-post/index.ts +60 -43
  22. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-post-form/index.ts +10 -23
  23. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-posts/index.ts +2 -2
  24. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-product/index.ts +31 -32
  25. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-product-form/index.ts +23 -43
  26. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-products/index.ts +2 -2
  27. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-service/index.ts +18 -20
  28. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-service-form/index.ts +16 -29
  29. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-services/index.ts +2 -2
  30. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-sites/index.ts +2 -2
  31. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-today/index.ts +315 -0
  32. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-wrist/index.ts +42 -15
  33. package/templates/branded-lite/tier5-src/_shared/owner-load-error.ts +115 -12
  34. package/templates/branded-lite/tier5-src/himi-branded-lite-cart/index.ts +52 -28
  35. package/templates/branded-lite/tier5-src/himi-branded-lite-group/index.ts +24 -24
  36. package/templates/community-club/tier5-src/_shared/owner-load-error.ts +115 -12
  37. package/templates/community-club/tier5-src/himi-branded-lite-group/index.ts +24 -24
  38. package/templates/community-club-owner/dev/index.ts +317 -100
  39. package/templates/community-club-owner/himalaya.content.json +6 -0
  40. package/templates/community-club-owner/tier5-src/_shared/owner-account.ts +6 -2
  41. package/templates/community-club-owner/tier5-src/_shared/owner-booking-respond.ts +82 -0
  42. package/templates/community-club-owner/tier5-src/_shared/owner-load-error.ts +115 -12
  43. package/templates/community-club-owner/tier5-src/himi-owner-lite-account/index.ts +7 -4
  44. package/templates/community-club-owner/tier5-src/himi-owner-lite-ask/live.ts +3 -3
  45. package/templates/community-club-owner/tier5-src/himi-owner-lite-event/index.ts +18 -20
  46. package/templates/community-club-owner/tier5-src/himi-owner-lite-event-form/index.ts +20 -28
  47. package/templates/community-club-owner/tier5-src/himi-owner-lite-events/index.ts +2 -2
  48. package/templates/community-club-owner/tier5-src/himi-owner-lite-home/index.ts +2 -2
  49. package/templates/community-club-owner/tier5-src/himi-owner-lite-order/index.ts +3 -3
  50. package/templates/community-club-owner/tier5-src/himi-owner-lite-orders/index.ts +2 -2
  51. package/templates/community-club-owner/tier5-src/himi-owner-lite-overview/index.ts +2 -2
  52. package/templates/community-club-owner/tier5-src/himi-owner-lite-post/index.ts +60 -43
  53. package/templates/community-club-owner/tier5-src/himi-owner-lite-post-form/index.ts +10 -23
  54. package/templates/community-club-owner/tier5-src/himi-owner-lite-posts/index.ts +2 -2
  55. package/templates/community-club-owner/tier5-src/himi-owner-lite-product/index.ts +31 -32
  56. package/templates/community-club-owner/tier5-src/himi-owner-lite-product-form/index.ts +23 -43
  57. package/templates/community-club-owner/tier5-src/himi-owner-lite-products/index.ts +2 -2
  58. package/templates/community-club-owner/tier5-src/himi-owner-lite-sites/index.ts +2 -2
  59. package/templates/community-club-owner/tier5-src/himi-owner-lite-today/index.ts +315 -0
  60. package/templates/community-club-owner/tier5-src/himi-owner-lite-wrist/index.ts +42 -15
  61. package/templates/events-meetups/tier5-src/_shared/owner-load-error.ts +115 -12
  62. package/templates/events-meetups/tier5-src/himi-branded-lite-group/index.ts +24 -24
  63. package/templates/events-meetups-owner/dev/index.ts +275 -100
  64. package/templates/events-meetups-owner/himalaya.content.json +6 -0
  65. package/templates/events-meetups-owner/tier5-src/_shared/owner-account.ts +6 -2
  66. package/templates/events-meetups-owner/tier5-src/_shared/owner-booking-respond.ts +82 -0
  67. package/templates/events-meetups-owner/tier5-src/_shared/owner-load-error.ts +115 -12
  68. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-account/index.ts +7 -4
  69. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-ask/live.ts +3 -3
  70. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-event/index.ts +18 -20
  71. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-event-form/index.ts +20 -28
  72. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-events/index.ts +2 -2
  73. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-home/index.ts +2 -2
  74. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-overview/index.ts +2 -2
  75. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-post/index.ts +60 -43
  76. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-post-form/index.ts +10 -23
  77. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-posts/index.ts +2 -2
  78. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-sites/index.ts +2 -2
  79. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-today/index.ts +315 -0
  80. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-wrist/index.ts +42 -15
  81. package/templates/gym-fitness/tier5-src/_shared/owner-load-error.ts +115 -12
  82. package/templates/gym-fitness/tier5-src/himi-branded-lite-cart/index.ts +52 -28
  83. package/templates/gym-fitness-owner/dev/index.ts +545 -100
  84. package/templates/gym-fitness-owner/himalaya.content.json +6 -0
  85. package/templates/gym-fitness-owner/tier5-src/_shared/owner-account.ts +6 -2
  86. package/templates/gym-fitness-owner/tier5-src/_shared/owner-booking-respond.ts +82 -0
  87. package/templates/gym-fitness-owner/tier5-src/_shared/owner-load-error.ts +115 -12
  88. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-account/index.ts +7 -4
  89. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-appointments/index.ts +2 -2
  90. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-ask/live.ts +3 -3
  91. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-event/index.ts +18 -20
  92. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-event-form/index.ts +20 -28
  93. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-events/index.ts +2 -2
  94. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-home/index.ts +2 -2
  95. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-order/index.ts +3 -3
  96. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-orders/index.ts +2 -2
  97. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-overview/index.ts +2 -2
  98. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-post/index.ts +60 -43
  99. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-post-form/index.ts +10 -23
  100. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-posts/index.ts +2 -2
  101. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-product/index.ts +31 -32
  102. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-product-form/index.ts +23 -43
  103. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-products/index.ts +2 -2
  104. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-service/index.ts +18 -20
  105. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-service-form/index.ts +16 -29
  106. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-services/index.ts +2 -2
  107. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-sites/index.ts +2 -2
  108. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-today/index.ts +315 -0
  109. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-wrist/index.ts +42 -15
  110. package/templates/himi-chat/tier5-src/_shared/owner-load-error.ts +115 -12
  111. package/templates/nonprofit-cause/tier5-src/_shared/owner-load-error.ts +115 -12
  112. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-group/index.ts +24 -24
  113. package/templates/nonprofit-cause-owner/dev/index.ts +503 -100
  114. package/templates/nonprofit-cause-owner/himalaya.content.json +6 -0
  115. package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-account.ts +6 -2
  116. package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-booking-respond.ts +82 -0
  117. package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-load-error.ts +115 -12
  118. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-account/index.ts +7 -4
  119. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-appointments/index.ts +2 -2
  120. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-ask/live.ts +3 -3
  121. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-event/index.ts +18 -20
  122. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-event-form/index.ts +20 -28
  123. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-events/index.ts +2 -2
  124. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-home/index.ts +2 -2
  125. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-overview/index.ts +2 -2
  126. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-post/index.ts +60 -43
  127. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-post-form/index.ts +10 -23
  128. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-posts/index.ts +2 -2
  129. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-service/index.ts +18 -20
  130. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-service-form/index.ts +16 -29
  131. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-services/index.ts +2 -2
  132. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-sites/index.ts +2 -2
  133. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-today/index.ts +315 -0
  134. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-wrist/index.ts +42 -15
  135. package/templates/owner-lite/dev/index.ts +545 -100
  136. package/templates/owner-lite/himalaya.content.json +6 -0
  137. package/templates/owner-lite/tier5-src/_shared/owner-account.ts +6 -2
  138. package/templates/owner-lite/tier5-src/_shared/owner-booking-respond.ts +82 -0
  139. package/templates/owner-lite/tier5-src/_shared/owner-load-error.ts +115 -12
  140. package/templates/owner-lite/tier5-src/himi-owner-lite-account/index.ts +7 -4
  141. package/templates/owner-lite/tier5-src/himi-owner-lite-appointments/index.ts +2 -2
  142. package/templates/owner-lite/tier5-src/himi-owner-lite-ask/live.ts +3 -3
  143. package/templates/owner-lite/tier5-src/himi-owner-lite-event/index.ts +18 -20
  144. package/templates/owner-lite/tier5-src/himi-owner-lite-event-form/index.ts +20 -28
  145. package/templates/owner-lite/tier5-src/himi-owner-lite-events/index.ts +2 -2
  146. package/templates/owner-lite/tier5-src/himi-owner-lite-home/index.ts +2 -2
  147. package/templates/owner-lite/tier5-src/himi-owner-lite-order/index.ts +3 -3
  148. package/templates/owner-lite/tier5-src/himi-owner-lite-orders/index.ts +2 -2
  149. package/templates/owner-lite/tier5-src/himi-owner-lite-overview/index.ts +2 -2
  150. package/templates/owner-lite/tier5-src/himi-owner-lite-post/index.ts +60 -43
  151. package/templates/owner-lite/tier5-src/himi-owner-lite-post-form/index.ts +10 -23
  152. package/templates/owner-lite/tier5-src/himi-owner-lite-posts/index.ts +2 -2
  153. package/templates/owner-lite/tier5-src/himi-owner-lite-product/index.ts +31 -32
  154. package/templates/owner-lite/tier5-src/himi-owner-lite-product-form/index.ts +23 -43
  155. package/templates/owner-lite/tier5-src/himi-owner-lite-products/index.ts +2 -2
  156. package/templates/owner-lite/tier5-src/himi-owner-lite-service/index.ts +18 -20
  157. package/templates/owner-lite/tier5-src/himi-owner-lite-service-form/index.ts +16 -29
  158. package/templates/owner-lite/tier5-src/himi-owner-lite-services/index.ts +2 -2
  159. package/templates/owner-lite/tier5-src/himi-owner-lite-sites/index.ts +2 -2
  160. package/templates/owner-lite/tier5-src/himi-owner-lite-today/index.ts +315 -0
  161. package/templates/owner-lite/tier5-src/himi-owner-lite-wrist/index.ts +42 -15
  162. package/templates/podcast-creator/tier5-src/_shared/owner-load-error.ts +115 -12
  163. package/templates/podcast-creator-owner/dev/index.ts +317 -100
  164. package/templates/podcast-creator-owner/himalaya.content.json +6 -0
  165. package/templates/podcast-creator-owner/tier5-src/_shared/owner-account.ts +6 -2
  166. package/templates/podcast-creator-owner/tier5-src/_shared/owner-booking-respond.ts +82 -0
  167. package/templates/podcast-creator-owner/tier5-src/_shared/owner-load-error.ts +115 -12
  168. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-account/index.ts +7 -4
  169. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-ask/live.ts +3 -3
  170. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-event/index.ts +18 -20
  171. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-event-form/index.ts +20 -28
  172. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-events/index.ts +2 -2
  173. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-home/index.ts +2 -2
  174. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-order/index.ts +3 -3
  175. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-orders/index.ts +2 -2
  176. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-overview/index.ts +2 -2
  177. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-post/index.ts +60 -43
  178. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-post-form/index.ts +10 -23
  179. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-posts/index.ts +2 -2
  180. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-product/index.ts +31 -32
  181. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-product-form/index.ts +23 -43
  182. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-products/index.ts +2 -2
  183. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-sites/index.ts +2 -2
  184. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-today/index.ts +315 -0
  185. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-wrist/index.ts +42 -15
  186. package/templates/portfolio-creative/tier5-src/_shared/owner-load-error.ts +115 -12
  187. package/templates/portfolio-creative/tier5-src/himi-branded-lite-cart/index.ts +52 -28
  188. package/templates/portfolio-creative-owner/dev/index.ts +545 -100
  189. package/templates/portfolio-creative-owner/himalaya.content.json +6 -0
  190. package/templates/portfolio-creative-owner/tier5-src/_shared/owner-account.ts +6 -2
  191. package/templates/portfolio-creative-owner/tier5-src/_shared/owner-booking-respond.ts +82 -0
  192. package/templates/portfolio-creative-owner/tier5-src/_shared/owner-load-error.ts +115 -12
  193. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-account/index.ts +7 -4
  194. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-appointments/index.ts +2 -2
  195. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-ask/live.ts +3 -3
  196. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-home/index.ts +2 -2
  197. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-order/index.ts +3 -3
  198. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-orders/index.ts +2 -2
  199. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-overview/index.ts +2 -2
  200. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-post/index.ts +60 -43
  201. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-post-form/index.ts +10 -23
  202. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-posts/index.ts +2 -2
  203. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-product/index.ts +31 -32
  204. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-product-form/index.ts +23 -43
  205. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-products/index.ts +2 -2
  206. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-service/index.ts +18 -20
  207. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-service-form/index.ts +16 -29
  208. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-services/index.ts +2 -2
  209. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-sites/index.ts +2 -2
  210. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-today/index.ts +315 -0
  211. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-wrist/index.ts +42 -15
  212. package/templates/restaurant/tier5-src/_shared/owner-load-error.ts +115 -12
  213. package/templates/restaurant-owner/dev/index.ts +545 -100
  214. package/templates/restaurant-owner/himalaya.content.json +6 -0
  215. package/templates/restaurant-owner/tier5-src/_shared/owner-account.ts +6 -2
  216. package/templates/restaurant-owner/tier5-src/_shared/owner-booking-respond.ts +82 -0
  217. package/templates/restaurant-owner/tier5-src/_shared/owner-load-error.ts +115 -12
  218. package/templates/restaurant-owner/tier5-src/himi-owner-lite-account/index.ts +7 -4
  219. package/templates/restaurant-owner/tier5-src/himi-owner-lite-appointments/index.ts +2 -2
  220. package/templates/restaurant-owner/tier5-src/himi-owner-lite-ask/live.ts +3 -3
  221. package/templates/restaurant-owner/tier5-src/himi-owner-lite-event/index.ts +18 -20
  222. package/templates/restaurant-owner/tier5-src/himi-owner-lite-event-form/index.ts +20 -28
  223. package/templates/restaurant-owner/tier5-src/himi-owner-lite-events/index.ts +2 -2
  224. package/templates/restaurant-owner/tier5-src/himi-owner-lite-home/index.ts +2 -2
  225. package/templates/restaurant-owner/tier5-src/himi-owner-lite-order/index.ts +3 -3
  226. package/templates/restaurant-owner/tier5-src/himi-owner-lite-orders/index.ts +2 -2
  227. package/templates/restaurant-owner/tier5-src/himi-owner-lite-overview/index.ts +2 -2
  228. package/templates/restaurant-owner/tier5-src/himi-owner-lite-post/index.ts +60 -43
  229. package/templates/restaurant-owner/tier5-src/himi-owner-lite-post-form/index.ts +10 -23
  230. package/templates/restaurant-owner/tier5-src/himi-owner-lite-posts/index.ts +2 -2
  231. package/templates/restaurant-owner/tier5-src/himi-owner-lite-product/index.ts +31 -32
  232. package/templates/restaurant-owner/tier5-src/himi-owner-lite-product-form/index.ts +23 -43
  233. package/templates/restaurant-owner/tier5-src/himi-owner-lite-products/index.ts +2 -2
  234. package/templates/restaurant-owner/tier5-src/himi-owner-lite-service/index.ts +18 -20
  235. package/templates/restaurant-owner/tier5-src/himi-owner-lite-service-form/index.ts +16 -29
  236. package/templates/restaurant-owner/tier5-src/himi-owner-lite-services/index.ts +2 -2
  237. package/templates/restaurant-owner/tier5-src/himi-owner-lite-sites/index.ts +2 -2
  238. package/templates/restaurant-owner/tier5-src/himi-owner-lite-today/index.ts +315 -0
  239. package/templates/restaurant-owner/tier5-src/himi-owner-lite-wrist/index.ts +42 -15
  240. package/templates/retail-store/tier5-src/_shared/owner-load-error.ts +115 -12
  241. package/templates/retail-store/tier5-src/himi-branded-lite-cart/index.ts +52 -28
  242. package/templates/retail-store-owner/dev/index.ts +317 -100
  243. package/templates/retail-store-owner/himalaya.content.json +6 -0
  244. package/templates/retail-store-owner/tier5-src/_shared/owner-account.ts +6 -2
  245. package/templates/retail-store-owner/tier5-src/_shared/owner-booking-respond.ts +82 -0
  246. package/templates/retail-store-owner/tier5-src/_shared/owner-load-error.ts +115 -12
  247. package/templates/retail-store-owner/tier5-src/himi-owner-lite-account/index.ts +7 -4
  248. package/templates/retail-store-owner/tier5-src/himi-owner-lite-ask/live.ts +3 -3
  249. package/templates/retail-store-owner/tier5-src/himi-owner-lite-home/index.ts +2 -2
  250. package/templates/retail-store-owner/tier5-src/himi-owner-lite-order/index.ts +3 -3
  251. package/templates/retail-store-owner/tier5-src/himi-owner-lite-orders/index.ts +2 -2
  252. package/templates/retail-store-owner/tier5-src/himi-owner-lite-overview/index.ts +2 -2
  253. package/templates/retail-store-owner/tier5-src/himi-owner-lite-post/index.ts +60 -43
  254. package/templates/retail-store-owner/tier5-src/himi-owner-lite-post-form/index.ts +10 -23
  255. package/templates/retail-store-owner/tier5-src/himi-owner-lite-posts/index.ts +2 -2
  256. package/templates/retail-store-owner/tier5-src/himi-owner-lite-product/index.ts +31 -32
  257. package/templates/retail-store-owner/tier5-src/himi-owner-lite-product-form/index.ts +23 -43
  258. package/templates/retail-store-owner/tier5-src/himi-owner-lite-products/index.ts +2 -2
  259. package/templates/retail-store-owner/tier5-src/himi-owner-lite-sites/index.ts +2 -2
  260. package/templates/retail-store-owner/tier5-src/himi-owner-lite-today/index.ts +315 -0
  261. package/templates/retail-store-owner/tier5-src/himi-owner-lite-wrist/index.ts +42 -15
  262. package/templates/yoga-studio/tier5-src/_shared/owner-load-error.ts +115 -12
  263. package/templates/yoga-studio-owner/dev/index.ts +503 -100
  264. package/templates/yoga-studio-owner/himalaya.content.json +6 -0
  265. package/templates/yoga-studio-owner/tier5-src/_shared/owner-account.ts +6 -2
  266. package/templates/yoga-studio-owner/tier5-src/_shared/owner-booking-respond.ts +82 -0
  267. package/templates/yoga-studio-owner/tier5-src/_shared/owner-load-error.ts +115 -12
  268. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-account/index.ts +7 -4
  269. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-appointments/index.ts +2 -2
  270. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-ask/live.ts +3 -3
  271. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-event/index.ts +18 -20
  272. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-event-form/index.ts +20 -28
  273. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-events/index.ts +2 -2
  274. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-home/index.ts +2 -2
  275. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-overview/index.ts +2 -2
  276. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-post/index.ts +60 -43
  277. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-post-form/index.ts +10 -23
  278. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-posts/index.ts +2 -2
  279. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-service/index.ts +18 -20
  280. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-service-form/index.ts +16 -29
  281. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-services/index.ts +2 -2
  282. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-sites/index.ts +2 -2
  283. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-today/index.ts +315 -0
  284. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-wrist/index.ts +42 -15
@@ -10,25 +10,24 @@ import { getPost, getDraftPost, publishDraftPost, revertDraftPost, deleteDraftPo
10
10
  import { parseRicosJson } from "@himalaya/wix-rich-content";
11
11
  import { openRichLink } from "../_shared/rich-content-link.js";
12
12
  import { richBody } from "../_shared/rich-body.js";
13
- import { ownerLoadError, isBridgeUnavailable, isOwnerPreviewDemo, shouldQueueOwnerWrite } from "../_shared/owner-load-error.js";
13
+ import { ownerLoadError, isBridgeUnavailable, isTransportFailure, isOwnerPreviewDemo, ownerDemoFallback, ownerWriteError, isNotFound } from "../_shared/owner-load-error.js";
14
14
  import { DEMO_POSTS, DEMO_NOTE, DEMO_SAVE_NOTE } from "../_shared/owner-preview-demo.js";
15
15
  import { stashCopy, copyParam } from "../_shared/himi-copy.js";
16
- import { get as dbGet, upsert as dbUpsert, remove as dbRemove, enqueue as dbEnqueue, type DbEntity } from "../_shared/owner-local-db.js";
16
+ import { get as dbGet, upsert as dbUpsert, remove as dbRemove, type DbEntity } from "../_shared/owner-local-db.js";
17
17
  import { formatDateMedium } from "../_shared/engine-intl.js";
18
18
  import { blankFlags } from "../_shared/detail-facts.js";
19
19
 
20
- // Offline-first (data-offline): owner CRUD is WRITE-BEHIND against the encrypted
21
- // `owner_posts` entity — publish/unpublish/delete update the local store
22
- // OPTIMISTICALLY so the detail/list repaint from cache immediately, then the wix
23
- // write is attempted; if it can't reach the bridge/network the mutation is ENQUEUED
24
- // for replay on reconnect, and detail reads fall back to the last-synced local row.
20
+ // Offline-first (data-offline): detail reads fall back to the last-synced local row
21
+ // of the encrypted `owner_posts` entity. Publish/unpublish/delete are
22
+ // SERVER-CONFIRMED: the local row changes only after Wix accepts the write; a failed
23
+ // one leaves it alone and tells the owner why. No host replays a queued write, so
24
+ // nothing is queued.
25
25
  // Every local-db call is wrapped (try/catch) so a build that ships without the
26
- // `local_database` grant behaves exactly as before (online-only, no cache/queue).
26
+ // `local_database` grant behaves exactly as before (online-only, no cache).
27
27
  const ENTITY = "owner_posts";
28
28
  async function cachePut(row: DbEntity): Promise<void> { try { await dbUpsert(ENTITY, row); } catch { /* capability not granted */ } }
29
29
  async function cacheDrop(id: string): Promise<void> { try { await dbRemove(ENTITY, id); } catch { /* capability not granted */ } }
30
30
  async function cacheGet(id: string): Promise<DbEntity | null> { try { return await dbGet(ENTITY, id); } catch { return null; } }
31
- async function queueWrite(actionId: string, params: Record<string, string>): Promise<void> { try { await dbEnqueue(actionId, params); } catch { /* capability not granted */ } }
32
31
  /** [rico] #3370 — keep the body's plain text with the post's cached row, so the offline detail shows it. It is
33
32
  * merged into the row the posts list wrote rather than replacing it; a later list re-sync writes its own rows
34
33
  * and drops it again, until the detail is next opened online. */
@@ -250,16 +249,39 @@ function cachedDetail(s: PostState, row: DbEntity): PostState {
250
249
  });
251
250
  }
252
251
 
253
- async function refresh(prev: PostState, id: string, actionMessage = ""): Promise<PostState> {
252
+ /** The re-read after a write Wix CONFIRMED: when it fails — thrown or as an error state
253
+ * ("post not found" for a 5xx on both reads) — the confirmed change stays on screen. */
254
+ async function reread(prev: PostState, actionMessage: string, confirmed: PostState): Promise<PostState> {
255
+ try {
256
+ // A reread right after a CONFIRMED write never drops the row that write just cached: a
257
+ // both-404 here is a lagging read, not proof the post is gone.
258
+ const next = await refresh(prev, prev.id, actionMessage, { dropIfGone: false });
259
+ return next.status === "error" ? confirmed : next;
260
+ } catch {
261
+ return confirmed;
262
+ }
263
+ }
264
+
265
+ async function refresh(prev: PostState, id: string, actionMessage = "", opts: { dropIfGone?: boolean } = {}): Promise<PostState> {
254
266
  let post: any | undefined;
255
267
  let draft: any | undefined;
256
268
  let lastError: unknown;
257
- try { post = (await getPost(id)).post; } catch (e) { lastError = e; /* draft-only */ }
269
+ let postError: unknown;
270
+ try { post = (await getPost(id)).post; } catch (e) { lastError = postError = e; /* draft-only */ }
258
271
  try { draft = (await getDraftPost(id)).draftPost; } catch (e) { lastError = e; /* published-only or missing */ }
259
272
  if (!post && !draft) {
260
273
  // Both arms swallowed their errors above; surface the DESIGNED bridge
261
- // boundary so the callers' catches can fall back to the demo post.
262
- if (isBridgeUnavailable(lastError)) throw lastError;
274
+ // boundary (and a device with no connection) so the callers' catches can fall
275
+ // back to the cached row or the demo post — never "post not found" for a post
276
+ // that was only unreachable.
277
+ // Either read counts: a published-only post's draft read is always a 404, so the
278
+ // published read's failure is the one that says whether the post was only unreachable.
279
+ for (const err of [postError, lastError]) {
280
+ if (isBridgeUnavailable(err) || isTransportFailure(err)) throw err;
281
+ }
282
+ // Wix says it is gone on BOTH reads (a published-only post's draft read is a 404 on its
283
+ // own): its cached row must not outlive it, or an offline load repaints a deleted post.
284
+ if (opts.dropIfGone !== false && isNotFound(postError) && isNotFound(lastError)) await cacheDrop(id);
263
285
  return shape({ ...prev, id, status: "error", title: "", error: copyParam("ownerPost.errorNotFound", "post not found"), actionMessage });
264
286
  }
265
287
  const title = (draft?.title || post?.title || "Untitled post").trim();
@@ -336,9 +358,10 @@ const svc = defineService<PostState, {
336
358
  return loaded;
337
359
  } catch (e) {
338
360
  // Offline: fall back to the last-synced local row before the demo/error paths.
339
- const cached = await cacheGet(id);
361
+ // Wix says it is gone (e.g. a delete whose reply was lost): drop the row, never show it.
362
+ const cached = isNotFound(e) ? (await cacheDrop(id), null) : await cacheGet(id);
340
363
  if (cached) return cachedDetail(s, cached);
341
- if (isBridgeUnavailable(e)) {
364
+ if (ownerDemoFallback(e)) {
342
365
  const demo = demoDetail(s, id);
343
366
  if (demo) return demo;
344
367
  }
@@ -359,9 +382,10 @@ const svc = defineService<PostState, {
359
382
  await cacheBodyText(loaded);
360
383
  return loaded;
361
384
  } catch (e) {
362
- const cached = await cacheGet(s.id);
385
+ // Wix says it is gone (e.g. a delete whose reply was lost): drop the row, never show it.
386
+ const cached = isNotFound(e) ? (await cacheDrop(s.id), null) : await cacheGet(s.id);
363
387
  if (cached) return cachedDetail(s, cached);
364
- if (isBridgeUnavailable(e)) {
388
+ if (ownerDemoFallback(e)) {
365
389
  const demo = demoDetail(s, s.id);
366
390
  if (demo) return demo;
367
391
  }
@@ -373,19 +397,18 @@ const svc = defineService<PostState, {
373
397
  if (isOwnerPreviewDemo() || s.demoNote) return shape({ ...s, actionMessage: copyParam("ownerCommon.demoSaveNote", DEMO_SAVE_NOTE) });
374
398
  if (!s.id) return shape({ ...s, actionMessage: copyParam("ownerPost.noIdMessage", "No post id.") });
375
399
  if (s.postStatusRaw === "PUBLISHED") return shape({ ...s, actionMessage: copyParam("ownerPost.alreadyPublished", "Post is already published.") });
376
- // Optimistic local write — the detail/list repaint from cache immediately.
377
- const optimistic = shape({ ...s, postStatusRaw: "PUBLISHED", postStatus: "Published", actionMessage: copyParam("ownerPost.publishedMessage", "Post published.") });
378
- await cachePut(cacheRow(optimistic));
379
400
  try {
380
401
  await publishDraftPost(s.id);
381
- return refresh(s, s.id, copyParam("ownerPost.publishedMessage", "Post published."));
382
402
  } catch (e) {
383
- if (shouldQueueOwnerWrite(e)) {
384
- await queueWrite("tier5.himiOwnerLitePost.publish", { id: s.id });
385
- return shape({ ...optimistic, actionMessage: copyParam("ownerCommon.demoSaveNote", DEMO_SAVE_NOTE) });
386
- }
387
- return shape({ ...s, actionMessage: ownerLoadError(e) });
403
+ // Nothing replays a queued write: the post is as it was, and the owner is told why.
404
+ return shape({ ...s, actionMessage: ownerWriteError(e) });
388
405
  }
406
+ // Wix confirmed it: the list repaints from cache at once, and a re-read that fails
407
+ // afterwards still shows the confirmed change rather than undoing it on screen.
408
+ const published = copyParam("ownerPost.publishedMessage", "Post published.");
409
+ const confirmed = shape({ ...s, postStatusRaw: "PUBLISHED", postStatus: "Published", actionMessage: published });
410
+ await cachePut(cacheRow(confirmed));
411
+ return reread(s, published, confirmed);
389
412
  },
390
413
  unpublish: async (s0) => {
391
414
  const s = disarm(s0);
@@ -394,19 +417,16 @@ const svc = defineService<PostState, {
394
417
  if (s.postStatusRaw !== "PUBLISHED" && s.postStatusRaw !== "SCHEDULED") {
395
418
  return shape({ ...s, actionMessage: copyParam("ownerPost.alreadyDraft", "Post is already a draft.") });
396
419
  }
397
- // Optimistic local write — the detail/list repaint from cache immediately.
398
- const optimistic = shape({ ...s, postStatusRaw: "UNPUBLISHED", postStatus: "Draft", actionMessage: "Post moved to drafts." });
399
- await cachePut(cacheRow(optimistic));
400
420
  try {
401
421
  await revertDraftPost(s.id);
402
- return refresh(s, s.id, copyParam("ownerPost.unpublishedMessage", "Post moved to drafts."));
403
422
  } catch (e) {
404
- if (shouldQueueOwnerWrite(e)) {
405
- await queueWrite("tier5.himiOwnerLitePost.unpublish", { id: s.id });
406
- return shape({ ...optimistic, actionMessage: copyParam("ownerCommon.demoSaveNote", DEMO_SAVE_NOTE) });
407
- }
408
- return shape({ ...s, actionMessage: ownerLoadError(e) });
423
+ // Nothing replays a queued write: the post is as it was, and the owner is told why.
424
+ return shape({ ...s, actionMessage: ownerWriteError(e) });
409
425
  }
426
+ const unpublished = copyParam("ownerPost.unpublishedMessage", "Post moved to drafts.");
427
+ const confirmed = shape({ ...s, postStatusRaw: "UNPUBLISHED", postStatus: "Draft", actionMessage: unpublished });
428
+ await cachePut(cacheRow(confirmed));
429
+ return reread(s, unpublished, confirmed);
410
430
  },
411
431
  // #3158 — destructive, so two steps. `delete` (the Manage card's Delete button)
412
432
  // only ARMS the inline confirmation, which names the record and says it cannot
@@ -423,18 +443,15 @@ const svc = defineService<PostState, {
423
443
  const s = disarm(s0);
424
444
  if (isOwnerPreviewDemo() || s.demoNote) return shape({ ...s, actionMessage: copyParam("ownerCommon.demoSaveNote", DEMO_SAVE_NOTE) });
425
445
  if (!s.id) return shape({ ...s, actionMessage: copyParam("ownerPost.noIdMessage", "No post id.") });
426
- // Optimistic local delete — the list drops the row immediately.
427
- await cacheDrop(s.id);
428
446
  try {
429
447
  await deleteDraftPost(s.id);
430
- return shape({ ...s, status: "deleted", title: "", emptyText: copyParam("ownerPost.deletedEmpty", "Post deleted."), actionMessage: "" });
431
448
  } catch (e) {
432
- if (shouldQueueOwnerWrite(e)) {
433
- await queueWrite("tier5.himiOwnerLitePost.delete", { id: s.id });
434
- return shape({ ...s, status: "deleted", title: "", emptyText: copyParam("ownerPost.deletedEmpty", "Post deleted."), actionMessage: copyParam("ownerCommon.demoSaveNote", DEMO_SAVE_NOTE) });
435
- }
436
- return shape({ ...s, actionMessage: ownerLoadError(e) });
449
+ // Nothing replays a queued write: the post stays, and the owner is told why.
450
+ return shape({ ...s, actionMessage: ownerWriteError(e) });
437
451
  }
452
+ // Only a delete Wix confirmed leaves the local list.
453
+ await cacheDrop(s.id);
454
+ return shape({ ...s, status: "deleted", title: "", emptyText: copyParam("ownerPost.deletedEmpty", "Post deleted."), actionMessage: "" });
438
455
  } finally {
439
456
  deleteInFlight = false;
440
457
  }
@@ -10,21 +10,20 @@ import { wixCall } from "@himalaya/wix-site-media";
10
10
  import { wixMediaUrl, WIX_DETAIL_IMAGE } from "../_shared/himi-store.js";
11
11
  import { defineService } from "@himalaya/state";
12
12
  import { getDraftPost, createDraftPost, updateDraftPost, type WixDraftPostWrite, type WixRichContent } from "@himalaya/wix-blog";
13
- import { ownerLoadError, isBridgeUnavailable, isOwnerPreviewDemo, shouldQueueOwnerWrite } from "../_shared/owner-load-error.js";
13
+ import { ownerLoadError, isOwnerPreviewDemo, ownerDemoFallback, ownerWriteError } from "../_shared/owner-load-error.js";
14
14
  import { DEMO_POSTS, DEMO_NOTE, DEMO_SAVE_NOTE, demoRefusalPatch } from "../_shared/owner-preview-demo.js";
15
15
  import { stashCopy, copyParam } from "../_shared/himi-copy.js";
16
- import { get as dbGet, upsert as dbUpsert, remove as dbRemove, enqueue as dbEnqueue, type DbEntity } from "../_shared/owner-local-db.js";
16
+ import { get as dbGet, upsert as dbUpsert, remove as dbRemove, type DbEntity } from "../_shared/owner-local-db.js";
17
17
 
18
18
  // Offline-first (data-offline): owner CRUD is WRITE-BEHIND against the encrypted
19
- // `owner_posts` entity — cache confirmed writes, or enqueue offline edits for
20
- // replay on reconnect. Failed cover imports must not appear as saved drafts.
19
+ // `owner_posts` entity — cache confirmed writes only; a failed save says nothing was
20
+ // saved (no host replays a queue). Failed cover imports must not appear as saved drafts.
21
21
  // Every local-db call is wrapped (try/catch) so a build that ships without the
22
22
  // `local_database` grant behaves exactly as before (online-only, no cache/queue).
23
23
  const ENTITY = "owner_posts";
24
24
  async function cachePut(row: DbEntity): Promise<void> { try { await dbUpsert(ENTITY, row); } catch { /* capability not granted */ } }
25
25
  async function cacheDrop(id: string): Promise<void> { try { await dbRemove(ENTITY, id); } catch { /* capability not granted */ } }
26
26
  async function cacheGet(id: string): Promise<DbEntity | null> { try { return await dbGet(ENTITY, id); } catch { return null; } }
27
- async function queueWrite(actionId: string, params: Record<string, string>): Promise<void> { try { await dbEnqueue(actionId, params); } catch { /* capability not granted */ } }
28
27
 
29
28
  type Mode = "create" | "edit";
30
29
 
@@ -223,7 +222,7 @@ const svc = defineService<PostFormState, {
223
222
  status: "idle", error: "", savedMessage: "",
224
223
  });
225
224
  }
226
- if (isBridgeUnavailable(e)) {
225
+ if (ownerDemoFallback(e)) {
227
226
  const d = DEMO_POSTS.find((x) => x.id === id);
228
227
  if (d) {
229
228
  return shape({
@@ -342,23 +341,11 @@ const svc = defineService<PostFormState, {
342
341
  await cachePut(localRow(id));
343
342
  return savedState(id, editing ? copyParam("ownerPostForm.updatedMessage", "Post updated.") : copyParam("ownerPostForm.createdMessage", "Draft created."));
344
343
  } catch (e) {
345
- if (shouldQueueOwnerWrite(e)) {
346
- // Demo / web-preview (no owner bridge; the record came from demo sample
347
- // data, marked by demoNote): a queued write could never replay, so answer
348
- // with the demo save note instead of the real-offline write-behind.
349
- if (s.demoNote) return demoRefusal(s);
350
- // Real device offline: cache and queue the edit for reconnect. `preserveBody` stays
351
- // "true" even for a body edit, so a bundle rolled back past this change keeps the stored
352
- // body rather than flattening it to text. This bundle replays `richContentJson`.
353
- await cachePut(localRow(localId));
354
- await queueWrite("tier5.himiOwnerLitePostForm.submit", {
355
- id: targetId, title, excerpt, coverUrl, coverChanged: String(coverChanged), preserveBody: "true",
356
- body: postBodyText(kept), ...(bodyEdited ? { richContentJson: bodyRaw } : {}),
357
- isFeatured: String(isFeatured), mode: editing ? "edit" : "create",
358
- });
359
- return savedState(localId, copyParam("ownerPostForm.savedOffline", "Saved offline — will sync when you reconnect."));
360
- }
361
- return shape({ ...s, status: "error", error: ownerLoadError(e), savedMessage: "" });
344
+ // Demo / web-preview: the record came from demo sample data (marked by demoNote).
345
+ if (s.demoNote) return demoRefusal(s);
346
+ // Never "saved offline": nothing replays a queued write on any platform. The
347
+ // typed values stay in the form (the body in its editor), so a retry is one tap.
348
+ return shape({ ...s, title, excerpt, coverUrl, isFeatured: isFeatured ? "true" : "false", status: "error", error: ownerWriteError(e), savedMessage: "" });
362
349
  }
363
350
  })()),
364
351
  },
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { defineService } from "../_shared/collection-service.js";
6
6
  import { queryPosts, queryDraftPosts } from "@himalaya/wix-blog";
7
- import { ownerLoadError, isBridgeUnavailable, isOwnerPreviewDemo } from "../_shared/owner-load-error.js";
7
+ import { ownerLoadError, isOwnerPreviewDemo, ownerDemoFallback } from "../_shared/owner-load-error.js";
8
8
  import { DEMO_POSTS, DEMO_NOTE } from "../_shared/owner-preview-demo.js";
9
9
  import { stashCopy, copyParam } from "../_shared/himi-copy.js";
10
10
  import { getAll, upsert, type DbEntity } from "../_shared/owner-local-db.js";
@@ -227,7 +227,7 @@ async function loadList(s: PostsState): Promise<PostsState> {
227
227
  } catch (e) {
228
228
  // Offline / fetch failure: keep the last-synced cache BEFORE the demo/error fallbacks.
229
229
  if (cached.length) return base;
230
- if (isBridgeUnavailable(e)) return demoList(s);
230
+ if (ownerDemoFallback(e)) return demoList(s);
231
231
  return shape({ ...s, status: "error", allPosts: [], posts: [], error: ownerLoadError(e) });
232
232
  }
233
233
  }
@@ -7,24 +7,22 @@
7
7
  import { defineService } from "@himalaya/state";
8
8
  import { getProduct, updateProduct, deleteProduct, type WixProduct } from "@himalaya/wix-stores";
9
9
  import { plainText, productImage, wixMediaUrl, WIX_DETAIL_IMAGE, type StoreProduct } from "../_shared/himi-store.js";
10
- import { ownerLoadError, isBridgeUnavailable, isOwnerPreviewDemo, shouldQueueOwnerWrite } from "../_shared/owner-load-error.js";
10
+ import { ownerLoadError, isOwnerPreviewDemo, ownerDemoFallback, ownerWriteError, isNotFound } from "../_shared/owner-load-error.js";
11
11
  import { DEMO_PRODUCTS, DEMO_NOTE, DEMO_SAVE_NOTE } from "../_shared/owner-preview-demo.js";
12
12
  import { stashCopy, copyParam } from "../_shared/himi-copy.js";
13
- import { get as dbGet, upsert as dbUpsert, remove as dbRemove, enqueue as dbEnqueue, type DbEntity } from "../_shared/owner-local-db.js";
13
+ import { get as dbGet, upsert as dbUpsert, remove as dbRemove, type DbEntity } from "../_shared/owner-local-db.js";
14
14
  import { blankFlags } from "../_shared/detail-facts.js";
15
15
 
16
- // Offline-first (data-offline): owner CRUD is WRITE-BEHIND against the encrypted
17
- // `owner_products` entity — the local store is updated OPTIMISTICALLY so the
18
- // detail/list repaint from cache immediately, then the Wix write is attempted; if
19
- // it can't reach the bridge/network the mutation is ENQUEUED for replay on
20
- // reconnect, and detail reads fall back to the last-synced local row. Every
21
- // local-db call is wrapped (try/catch) so a build that ships without the
22
- // `local_database` grant behaves exactly as before (online-only, no cache/queue).
16
+ // Offline-first (data-offline): detail reads fall back to the last-synced local row
17
+ // of the encrypted `owner_products` entity. Writes are SERVER-CONFIRMED: the local
18
+ // row changes only after Wix accepts the write; a failed one leaves it alone and
19
+ // tells the owner why. No host replays a queued write, so nothing is queued.
20
+ // Every local-db call is wrapped (try/catch) so a build that ships without the
21
+ // `local_database` grant behaves exactly as before (online-only, no cache).
23
22
  const ENTITY = "owner_products";
24
23
  async function cachePut(row: DbEntity): Promise<void> { try { await dbUpsert(ENTITY, row); } catch { /* capability not granted */ } }
25
24
  async function cacheDrop(id: string): Promise<void> { try { await dbRemove(ENTITY, id); } catch { /* capability not granted */ } }
26
25
  async function cacheGet(id: string): Promise<DbEntity | null> { try { return await dbGet(ENTITY, id); } catch { return null; } }
27
- async function queueWrite(actionId: string, params: Record<string, string>): Promise<void> { try { await dbEnqueue(actionId, params); } catch { /* capability not granted */ } }
28
26
 
29
27
  interface ProductState {
30
28
  id: string;
@@ -265,19 +263,21 @@ async function setVisibility(s: ProductState, visible: boolean, msg: string): Pr
265
263
  : copyParam("ownerProduct.alreadyHidden", "Already hidden."),
266
264
  });
267
265
  }
268
- // Optimistic local write — the detail/list repaint from cache immediately.
269
- const optimistic = shape({ ...s, visibleRaw: visible, statusLabel: visible ? "Visible in store" : "Hidden", subtitle: visible ? "Visible in store" : "Hidden from store", actionMessage: msg });
270
- await cachePut(cacheRow(optimistic));
271
266
  try {
272
267
  await updateProduct(s.id, { visible });
273
- return refresh(s, s.id, msg);
274
268
  } catch (e) {
275
- if (shouldQueueOwnerWrite(e)) {
276
- // Offline / no bridge: queue the visibility write to replay on reconnect.
277
- await queueWrite("tier5.himiOwnerLiteProduct." + (visible ? "show" : "hide"), { id: s.id });
278
- return shape({ ...optimistic, actionMessage: copyParam("ownerCommon.demoSaveNote", DEMO_SAVE_NOTE) });
279
- }
280
- return shape({ ...s, actionMessage: ownerLoadError(e) });
269
+ // Nothing replays a queued write: the record is as it was, and the owner is told why.
270
+ return shape({ ...s, actionMessage: ownerWriteError(e) });
271
+ }
272
+ // Wix confirmed it: the list repaints from cache at once, and a re-read that fails
273
+ // afterwards still shows the confirmed change rather than undoing it on screen.
274
+ const confirmed = shape({ ...s, visibleRaw: visible, statusLabel: visible ? "Visible in store" : "Hidden", subtitle: visible ? "Visible in store" : "Hidden from store", actionMessage: msg });
275
+ await cachePut(cacheRow(confirmed));
276
+ try {
277
+ const next = await refresh(s, s.id, msg);
278
+ return next.status === "error" ? confirmed : next;
279
+ } catch {
280
+ return confirmed;
281
281
  }
282
282
  }
283
283
 
@@ -321,9 +321,10 @@ const svc = defineService<ProductState, {
321
321
  return await refresh(shape({ ...s, id, status: "loading" }), id);
322
322
  } catch (e) {
323
323
  // Offline: fall back to the last-synced local row before the demo/error paths.
324
- const cached = await cacheGet(id);
324
+ // Wix says it is gone (e.g. a delete whose reply was lost): drop the row, never show it.
325
+ const cached = isNotFound(e) ? (await cacheDrop(id), null) : await cacheGet(id);
325
326
  if (cached) return cachedDetail(s, cached);
326
- if (isBridgeUnavailable(e)) {
327
+ if (ownerDemoFallback(e)) {
327
328
  const demo = demoDetail(s, id);
328
329
  if (demo) return demo;
329
330
  }
@@ -342,9 +343,10 @@ const svc = defineService<ProductState, {
342
343
  try {
343
344
  return await refresh(shape({ ...s, status: "loading" }), s.id);
344
345
  } catch (e) {
345
- const cached = await cacheGet(s.id);
346
+ // Wix says it is gone (e.g. a delete whose reply was lost): drop the row, never show it.
347
+ const cached = isNotFound(e) ? (await cacheDrop(s.id), null) : await cacheGet(s.id);
346
348
  if (cached) return cachedDetail(s, cached);
347
- if (isBridgeUnavailable(e)) {
349
+ if (ownerDemoFallback(e)) {
348
350
  const demo = demoDetail(s, s.id);
349
351
  if (demo) return demo;
350
352
  }
@@ -368,18 +370,15 @@ const svc = defineService<ProductState, {
368
370
  const s = disarm(s0);
369
371
  if (isOwnerPreviewDemo() || s.demoNote) return shape({ ...s, actionMessage: copyParam("ownerCommon.demoSaveNote", DEMO_SAVE_NOTE) });
370
372
  if (!s.id) return shape({ ...s, actionMessage: copyParam("ownerProduct.noIdMessage", "No product id.") });
371
- // Optimistic local delete — the list drops the row immediately.
372
- await cacheDrop(s.id);
373
373
  try {
374
374
  await deleteProduct(s.id);
375
- return shape({ ...s, status: "deleted", title: "", emptyText: copyParam("ownerProduct.deletedEmpty", "Product deleted."), actionMessage: "" });
376
375
  } catch (e) {
377
- if (shouldQueueOwnerWrite(e)) {
378
- await queueWrite("tier5.himiOwnerLiteProduct.delete", { id: s.id });
379
- return shape({ ...s, status: "deleted", title: "", emptyText: copyParam("ownerProduct.deletedEmpty", "Product deleted."), actionMessage: copyParam("ownerCommon.demoSaveNote", DEMO_SAVE_NOTE) });
380
- }
381
- return shape({ ...s, actionMessage: ownerLoadError(e) });
376
+ // Nothing replays a queued write: the record stays, and the owner is told why.
377
+ return shape({ ...s, actionMessage: ownerWriteError(e) });
382
378
  }
379
+ // Only a delete Wix confirmed leaves the local list.
380
+ await cacheDrop(s.id);
381
+ return shape({ ...s, status: "deleted", title: "", emptyText: copyParam("ownerProduct.deletedEmpty", "Product deleted."), actionMessage: "" });
383
382
  } finally {
384
383
  deleteInFlight = false;
385
384
  }
@@ -15,29 +15,28 @@ import {
15
15
  type WixProduct,
16
16
  type WixProductWrite,
17
17
  } from "@himalaya/wix-stores";
18
- import { get as dbGet, upsert as dbUpsert, remove as dbRemove, enqueue as dbEnqueue, type DbEntity } from "../_shared/owner-local-db.js";
18
+ import { get as dbGet, upsert as dbUpsert, remove as dbRemove, type DbEntity } from "../_shared/owner-local-db.js";
19
19
  import { htmlIsTrivial, htmlPreviewText } from "../_shared/owner-rich-guard.js";
20
20
  import { postBodyText, plainPostBody } from "../_shared/owner-post-content.js";
21
21
  import { editorSubmitValue, queuedDocument, editorChanged, cachedRichVerdict, editorRunKeys, resetHydratedEditorOnOlderRuntime, editorAfterSave, liveState, settleOverLive } from "../_shared/owner-editor-value.js";
22
22
  import { parseRicosJson } from "@himalaya/wix-rich-content";
23
23
  import { ricosUploadService } from "@himalaya/wix-rich-content-editor";
24
- import { ownerLoadError, isBridgeUnavailable, isOwnerPreviewDemo, shouldQueueOwnerWrite } from "../_shared/owner-load-error.js";
24
+ import { ownerLoadError, isOwnerPreviewDemo, ownerDemoFallback, ownerWriteError } from "../_shared/owner-load-error.js";
25
25
  import { DEMO_PRODUCTS, DEMO_NOTE, DEMO_SAVE_NOTE, demoRefusalPatch, editablePrice } from "../_shared/owner-preview-demo.js";
26
26
  import { stashCopy, copyParam } from "../_shared/himi-copy.js";
27
27
 
28
28
  type Mode = "create" | "edit";
29
29
 
30
- // Offline-first (data-offline): owner CRUD is WRITE-BEHIND against the encrypted
31
- // `owner_products` entity — the local store is updated OPTIMISTICALLY so the list
32
- // repaints from cache immediately, then the Wix write is attempted; if it can't
33
- // reach the bridge/network the mutation is ENQUEUED for replay on reconnect. Every
34
- // local-db call is wrapped (try/catch) so a build that ships without the
35
- // `local_database` grant behaves exactly as before (online-only, no cache/queue).
30
+ // Offline-first (data-offline): writes to the encrypted `owner_products` entity are
31
+ // SERVER-CONFIRMED — the list's local row changes only after Wix accepts the save;
32
+ // a failed one leaves it alone, keeps the form, and tells the owner why. No host
33
+ // replays a queued write, so nothing is queued.
34
+ // Every local-db call is wrapped (try/catch) so a build that ships without the
35
+ // `local_database` grant behaves exactly as before (online-only, no cache).
36
36
  const ENTITY = "owner_products";
37
37
  async function cachePut(row: DbEntity): Promise<void> { try { await dbUpsert(ENTITY, row); } catch { /* capability not granted */ } }
38
38
  async function cacheDrop(id: string): Promise<void> { try { await dbRemove(ENTITY, id); } catch { /* capability not granted */ } }
39
39
  async function cacheGet(id: string): Promise<DbEntity | null> { try { return await dbGet(ENTITY, id); } catch { return null; } }
40
- async function queueWrite(actionId: string, params: Record<string, string>): Promise<void> { try { await dbEnqueue(actionId, params); } catch { /* capability not granted */ } }
41
40
 
42
41
  // The store's currency — the Apptestersite detail view shows € prices.
43
42
  const CURRENCY = "EUR";
@@ -268,7 +267,7 @@ const svc = defineService<ProductFormState, {
268
267
  status: "idle", error: "", savedMessage: "",
269
268
  });
270
269
  }
271
- if (isBridgeUnavailable(e)) {
270
+ if (ownerDemoFallback(e)) {
272
271
  const d = DEMO_PRODUCTS.find((p) => p.id === id);
273
272
  if (d) {
274
273
  return shape({
@@ -356,7 +355,7 @@ const svc = defineService<ProductFormState, {
356
355
  const knownPlain = s.descriptionMode === "plain" || (s.descriptionMode === "editor" && !s.descriptionPending && s.descriptionJson === "");
357
356
  const descriptionProtected = cachedRichVerdict(heldDoc as never, knownPlain);
358
357
 
359
- // Optimistic local write — the list repaints from cache immediately (offline or not).
358
+ // The row the cache gets once Wix accepts the save.
360
359
  // Replay starts with default worker state. An untouched description was omitted from the
361
360
  // queued PATCH, so retain its cached mirror/document/verdict when replacing the local row.
362
361
  const cached = replay && targetId ? await cacheGet(targetId) : null;
@@ -380,7 +379,6 @@ const svc = defineService<ProductFormState, {
380
379
  return { descriptionDirty: a.dirty, descriptionEdits: a.edits, ...(a.editedDuringSave ? { status: "idle" as const, savedMessage: "" } : {}) };
381
380
  };
382
381
  const localId = mode === "edit" && targetId ? targetId : `local-${Date.now()}`;
383
- await cachePut(localRow(localId));
384
382
  try {
385
383
  let id = targetId;
386
384
  if (mode === "edit" && targetId) {
@@ -388,9 +386,9 @@ const svc = defineService<ProductFormState, {
388
386
  } else {
389
387
  const r = await createProduct(write);
390
388
  id = r.product?.id || localId;
391
- // Reconcile the optimistic local id with the server-assigned id.
392
- if (id !== localId) { await cacheDrop(localId); await cachePut(localRow(id)); }
393
389
  }
390
+ // The local row follows only what Wix confirmed, under the id Wix assigned.
391
+ await cachePut(localRow(id));
394
392
  return shape({
395
393
  ...s,
396
394
  mode: "edit",
@@ -407,44 +405,26 @@ const svc = defineService<ProductFormState, {
407
405
  ...afterSaved(),
408
406
  });
409
407
  } catch (e) {
410
- if (shouldQueueOwnerWrite(e)) {
411
- // Demo / web-preview (no owner bridge; the record came from DEMO_PRODUCTS,
412
- // marked by demoNote): a queued write could never replay, so answer with
413
- // the demo save note instead of the real-offline write-behind.
414
- if (s.demoNote) return demoRefusal(s);
415
- // Real device offline: the optimistic cache row already shows; queue the
416
- // write to replay (WriteQueue, idempotent) when connectivity returns.
417
- // A document rides as `descriptionJson` with descriptionEdited "false", so a bundle rolled back
418
- // past this change leaves the description rather than flattening it to text.
419
- await queueWrite("tier5.himiOwnerLiteProductForm.submit", { id: targetId, name, price, sku, description, visible: String(visible), mode,
420
- ...(docRaw ? { descriptionJson: docRaw, descriptionEdited: "false" } : { descriptionEdited: String(descriptionEdited) }) });
421
- return shape({
422
- ...s, mode: "edit", id: localId, name, price, sku, ...savedDescription,
423
- visible: visible ? "true" : "false", status: "saved",
424
- savedMessage: copyParam("ownerProductForm.savedOffline", "Saved offline — will sync when you reconnect."),
425
- savedId: localId,
426
- ...afterSaved(),
427
- });
428
- }
429
- return shape({ ...s, status: "error", error: ownerLoadError(e), savedMessage: "" });
408
+ // Never "saved offline": nothing replays a queued write on any platform. The cache was
409
+ // not touched, and the typed values stay in the form (the description in its editor) so
410
+ // a retry is one tap.
411
+ // Demo / web-preview: the record came from DEMO_PRODUCTS (marked by demoNote).
412
+ if (s.demoNote) return demoRefusal(s);
413
+ return shape({ ...s, name, price, sku, ...(s.descriptionMode === "editor" ? {} : { description }), visible: visible ? "true" : "false", status: "error", error: ownerWriteError(e), savedMessage: "" });
430
414
  }
431
415
  })()),
432
416
  remove: async (s) => {
433
417
  if (isOwnerPreviewDemo() || s.demoNote) return demoRefusal(s);
434
418
  if (!s.id) return shape({ ...s, status: "error", error: copyParam("ownerProductForm.errorNoDelete", "No product to delete."), savedMessage: "" });
435
- // Optimistic local delete — the list drops the row immediately.
436
- await cacheDrop(s.id);
437
419
  try {
438
420
  await deleteProduct(s.id);
439
- return shape({ ...s, id: "", status: "saved", error: "", savedMessage: copyParam("ownerProductForm.deletedMessage", "Product deleted."), savedId: "" });
440
421
  } catch (e) {
441
- if (shouldQueueOwnerWrite(e)) {
442
- if (s.demoNote) return demoRefusal(s);
443
- await queueWrite("tier5.himiOwnerLiteProductForm.remove", { id: s.id });
444
- return shape({ ...s, id: "", status: "saved", error: "", savedMessage: copyParam("ownerProductForm.deletedOffline", "Deleted offline — will sync when you reconnect."), savedId: "" });
445
- }
446
- return shape({ ...s, status: "error", error: ownerLoadError(e), savedMessage: "" });
422
+ // Nothing replays a queued delete: the row stays, and the owner is told why.
423
+ return shape({ ...s, status: "error", error: ownerWriteError(e), savedMessage: "" });
447
424
  }
425
+ // Only a delete Wix confirmed leaves the local list.
426
+ await cacheDrop(s.id);
427
+ return shape({ ...s, id: "", status: "saved", error: "", savedMessage: copyParam("ownerProductForm.deletedMessage", "Product deleted."), savedId: "" });
448
428
  },
449
429
  },
450
430
  });
@@ -7,7 +7,7 @@
7
7
  import { compareText } from "../_shared/engine-intl.js";
8
8
  import { defineBackendCollection } from "../_shared/collection-service.js";
9
9
  import { searchStoreProducts, productImage, productPrice, plainText, type StoreProduct } from "../_shared/himi-store.js";
10
- import { ownerLoadError, isBridgeUnavailable, isOwnerPreviewDemo } from "../_shared/owner-load-error.js";
10
+ import { ownerLoadError, isOwnerPreviewDemo, ownerDemoFallback } from "../_shared/owner-load-error.js";
11
11
  import { DEMO_PRODUCTS, DEMO_NOTE } from "../_shared/owner-preview-demo.js";
12
12
  import { copyParam } from "../_shared/himi-copy.js";
13
13
  import { getAll, upsert, type DbEntity } from "../_shared/owner-local-db.js";
@@ -191,7 +191,7 @@ const svc = defineBackendCollection("himiOwnerLiteProducts", {
191
191
  const items = (await readCachedRows()).filter(item => !!item.id);
192
192
  if (items.length) return { items, nextCursor: "", complete: false, metadata: { fromCache: true, demoNote: "" } };
193
193
  }
194
- if (!cursor && isBridgeUnavailable(error)) return demoPage();
194
+ if (!cursor && ownerDemoFallback(error)) return demoPage();
195
195
  throw error;
196
196
  }
197
197
  },
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { defineService } from "@himalaya/state";
10
10
  import { querySites, type WixSite } from "@himalaya/wix-site-list";
11
- import { ownerLoadError, isBridgeUnavailable, isOwnerPreviewDemo } from "../_shared/owner-load-error.js";
11
+ import { ownerLoadError, isOwnerPreviewDemo, ownerDemoFallback } from "../_shared/owner-load-error.js";
12
12
  import { DEMO_SITES, DEMO_NOTE } from "../_shared/owner-preview-demo.js";
13
13
  import { stashCopy, copyParam } from "../_shared/himi-copy.js";
14
14
  import { getAll, upsert, type DbEntity } from "../_shared/owner-local-db.js";
@@ -165,7 +165,7 @@ async function loadList(s: SitesState): Promise<SitesState> {
165
165
  } catch (e) {
166
166
  // Offline / fetch failure: keep the last-synced cache BEFORE the demo/error fallbacks.
167
167
  if (repairedCache.length) return base;
168
- if (isBridgeUnavailable(e)) return demoList(s);
168
+ if (ownerDemoFallback(e)) return demoList(s);
169
169
  return shape({ ...s, status: "error", allSites: [], sites: [], error: ownerLoadError(e) });
170
170
  }
171
171
  }