@wix/himalaya-cli 0.1544.0 → 0.1545.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 (225) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/agent/src/index.d.ts +5 -2
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/state/src/index.d.ts +14 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/state/src/read.d.ts +60 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/activity-counters-v1/src/index.d.ts +19 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/ai-site-chat/src/index.d.ts +19 -0
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/analytics/src/index.d.ts +42 -2
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/async-jobs/src/index.d.ts +19 -0
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/automations-v1/src/index.d.ts +19 -0
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/badges-v2/src/index.d.ts +19 -0
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/billing-tax-v1/src/index.d.ts +19 -0
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/blog-v3/src/extensions.d.ts +5 -4
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/blog-v3/src/index.d.ts +19 -0
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/bookings-v2/src/extensions.d.ts +4 -4
  14. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/bookings-v2/src/index.d.ts +19 -0
  15. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/business-feed/src/index.d.ts +11 -0
  16. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/business-tools-v1/src/index.d.ts +19 -0
  17. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/chat-web/src/index.d.ts +22 -1
  18. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/comments-v1/src/index.d.ts +19 -0
  19. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/contacts/src/index.d.ts +19 -0
  20. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/coupons/src/index.d.ts +24 -2
  21. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/crm-tasks/src/index.d.ts +11 -0
  22. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/dashboard-setup/src/index.d.ts +11 -0
  23. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/data-collections-v1/src/index.d.ts +19 -0
  24. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/donations/src/index.d.ts +19 -0
  25. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/ecom/src/extensions.d.ts +6 -5
  26. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/ecom/src/index.d.ts +19 -0
  27. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/email-marketing-v1/src/index.d.ts +19 -0
  28. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/events/src/index.d.ts +24 -2
  29. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/faq-v2/src/index.d.ts +19 -0
  30. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/forms/src/index.d.ts +19 -0
  31. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/forum/src/index.d.ts +19 -0
  32. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/genie-chat/src/index.d.ts +11 -0
  33. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/gift-cards/src/index.d.ts +19 -0
  34. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/groups/src/index.d.ts +19 -0
  35. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/inbox/src/extensions.d.ts +2 -1
  36. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/inbox/src/index.d.ts +19 -0
  37. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/invoices/src/index.d.ts +24 -2
  38. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/loyalty/src/index.d.ts +28 -4
  39. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/marketing-v1/src/index.d.ts +19 -0
  40. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/members-feed-viewer/src/index.d.ts +23 -1
  41. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/members-v1/src/index.d.ts +25 -3
  42. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/new-releases/src/index.d.ts +23 -1
  43. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/notification-preferences/src/index.d.ts +23 -2
  44. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/notifications-v3/src/index.d.ts +19 -0
  45. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/online-programs/src/index.d.ts +25 -3
  46. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/portfolio/src/index.d.ts +25 -3
  47. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/pricing-plans/src/index.d.ts +28 -6
  48. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/redirects-v1/src/index.d.ts +19 -0
  49. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/restaurants/src/extensions.d.ts +2 -2
  50. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/restaurants/src/index.d.ts +19 -0
  51. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/reviews/src/index.d.ts +24 -2
  52. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/seo-v1/src/index.d.ts +19 -0
  53. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/site-list/src/index.d.ts +19 -0
  54. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/site-media/src/index.d.ts +11 -0
  55. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/social-feed/src/index.d.ts +23 -1
  56. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/stores-collections/src/display.d.ts +3 -2
  57. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/stores-collections/src/index.d.ts +27 -3
  58. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/stores-v1/src/catalog.d.ts +7 -7
  59. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/stores-v1/src/display.d.ts +4 -3
  60. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/stores-v1/src/extensions.d.ts +2 -1
  61. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/stores-v1/src/index.d.ts +19 -0
  62. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/table-reservations/src/index.d.ts +25 -3
  63. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/users/src/index.d.ts +23 -1
  64. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/video/src/index.d.ts +19 -0
  65. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/wix-data/src/index.d.ts +27 -3
  66. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/workflows-v1/src/index.d.ts +19 -0
  67. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk-auto/_shared/runtime.generated.d.ts +8 -0
  68. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/checkout.mjs +12 -4
  69. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +36 -11
  70. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/state.mjs +206 -12
  71. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-activity-counters.mjs +19 -5
  72. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-ai-site-chat.mjs +19 -5
  73. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-analytics.mjs +21 -7
  74. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-async-jobs.mjs +19 -5
  75. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-automations.mjs +19 -5
  76. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-badges.mjs +19 -5
  77. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-billing-tax.mjs +19 -5
  78. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-blog.mjs +31 -14
  79. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-bookings.mjs +26 -12
  80. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-business-tools.mjs +20 -6
  81. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-chat-web.mjs +29 -7
  82. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-comments.mjs +28 -5
  83. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-contacts.mjs +19 -5
  84. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-coupons.mjs +14 -6
  85. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-data-collections.mjs +19 -5
  86. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-data.mjs +15 -5
  87. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-donations.mjs +19 -5
  88. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-ecom.mjs +33 -16
  89. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-email-marketing.mjs +19 -5
  90. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-events.mjs +14 -6
  91. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-faq.mjs +20 -6
  92. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-forms.mjs +19 -5
  93. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-forum.mjs +19 -5
  94. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-gift-cards.mjs +19 -5
  95. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-groups.mjs +19 -5
  96. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-inbox.mjs +21 -7
  97. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-invoices.mjs +14 -6
  98. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-loyalty.mjs +16 -8
  99. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-marketing.mjs +19 -5
  100. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-members-feed-viewer.mjs +21 -10
  101. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-members.mjs +17 -8
  102. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-new-releases.mjs +17 -5
  103. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-notification-preferences.mjs +20 -6
  104. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-notifications.mjs +19 -5
  105. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-online-programs.mjs +16 -8
  106. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-portfolio.mjs +16 -8
  107. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-pricing-plans.mjs +22 -14
  108. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-redirects.mjs +19 -5
  109. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-restaurants.mjs +22 -7
  110. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-reviews.mjs +14 -6
  111. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-rich-content-editor.mjs +3 -0
  112. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-seo.mjs +19 -5
  113. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-site-list.mjs +19 -5
  114. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-social-feed.mjs +15 -5
  115. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-stores-collections.mjs +20 -10
  116. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-stores.mjs +116 -83
  117. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-table-reservations.mjs +16 -8
  118. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-users.mjs +15 -5
  119. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-video.mjs +9 -1
  120. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-workflows.mjs +19 -5
  121. package/dist/cli.mjs +90 -57
  122. package/dist/preview-assets.generated.bin +0 -0
  123. package/fixtures/wix-canned.json +8 -8
  124. package/guides/dynamic-list.service.ts +38 -29
  125. package/guides/form-submit.service.ts +2 -1
  126. package/guides/index.json +6 -0
  127. package/guides/offline-reading.md +63 -0
  128. package/guides/recipe-dynamic-list.md +2 -0
  129. package/guides/recipe-four-state.md +1 -0
  130. package/guides/sdk-reference.json +225 -99
  131. package/guides/testing-himi-apps.md +2 -0
  132. package/guides/tier-5-add-a-screen.md +2 -0
  133. package/package.json +2 -2
  134. package/templates/beauty-salon/dev/index.ts +4 -3
  135. package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +6 -9
  136. package/templates/beauty-salon/tier5-src/_shared/iap-presentation.ts +7 -3
  137. package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +1 -1
  138. package/templates/beauty-salon/tier5-src/himi-branded-lite-orders/index.ts +3 -0
  139. package/templates/beauty-salon-owner/dev/index.ts +19 -19
  140. package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +6 -9
  141. package/templates/beauty-salon-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  142. package/templates/branded-lite/dev/index.ts +38 -20
  143. package/templates/branded-lite/tier5-src/_shared/collection-query-legacy.ts +194 -0
  144. package/templates/branded-lite/tier5-src/_shared/collection-query.ts +158 -99
  145. package/templates/branded-lite/tier5-src/_shared/collection-service.ts +31 -11
  146. package/templates/branded-lite/tier5-src/_shared/iap-presentation.ts +7 -3
  147. package/templates/branded-lite/tier5-src/_shared/read-service.ts +255 -0
  148. package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +1 -1
  149. package/templates/branded-lite/tier5-src/himi-branded-lite-orders/index.ts +3 -0
  150. package/templates/branded-lite/tier5-src/himi-branded-lite-shop/index.ts +202 -159
  151. package/templates/branded-lite/tier5-src/himi-store-product/index.ts +130 -201
  152. package/templates/community-club/dev/index.ts +4 -4
  153. package/templates/community-club/tier5-src/_shared/collection-service.ts +6 -9
  154. package/templates/community-club/tier5-src/_shared/iap-presentation.ts +7 -3
  155. package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +1 -1
  156. package/templates/community-club-owner/dev/index.ts +19 -19
  157. package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +6 -9
  158. package/templates/community-club-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  159. package/templates/events-meetups/dev/index.ts +3 -3
  160. package/templates/events-meetups/tier5-src/_shared/collection-service.ts +6 -9
  161. package/templates/events-meetups/tier5-src/_shared/iap-presentation.ts +7 -3
  162. package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +1 -1
  163. package/templates/events-meetups-owner/dev/index.ts +17 -17
  164. package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +6 -9
  165. package/templates/events-meetups-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  166. package/templates/gym-fitness/dev/index.ts +5 -4
  167. package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +6 -9
  168. package/templates/gym-fitness/tier5-src/_shared/iap-presentation.ts +7 -3
  169. package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +1 -1
  170. package/templates/gym-fitness/tier5-src/himi-branded-lite-orders/index.ts +3 -0
  171. package/templates/gym-fitness-owner/dev/index.ts +20 -20
  172. package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +6 -9
  173. package/templates/gym-fitness-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  174. package/templates/nonprofit-cause/dev/index.ts +4 -4
  175. package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +6 -9
  176. package/templates/nonprofit-cause/tier5-src/_shared/iap-presentation.ts +7 -3
  177. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +1 -1
  178. package/templates/nonprofit-cause-owner/dev/index.ts +18 -18
  179. package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +6 -9
  180. package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  181. package/templates/owner-lite/dev/index.ts +20 -20
  182. package/templates/owner-lite/tier5-src/_shared/collection-service.ts +6 -9
  183. package/templates/owner-lite/tier5-src/_shared/owner-module-data.ts +1 -1
  184. package/templates/podcast-creator/dev/index.ts +4 -4
  185. package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +6 -9
  186. package/templates/podcast-creator/tier5-src/_shared/iap-presentation.ts +7 -3
  187. package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +1 -1
  188. package/templates/podcast-creator-owner/dev/index.ts +19 -19
  189. package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +6 -9
  190. package/templates/podcast-creator-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  191. package/templates/portfolio-creative/dev/index.ts +5 -4
  192. package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +6 -9
  193. package/templates/portfolio-creative/tier5-src/_shared/iap-presentation.ts +7 -3
  194. package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +1 -1
  195. package/templates/portfolio-creative/tier5-src/himi-branded-lite-orders/index.ts +3 -0
  196. package/templates/portfolio-creative-owner/dev/index.ts +19 -19
  197. package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +6 -9
  198. package/templates/portfolio-creative-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  199. package/templates/restaurant/dev/index.ts +3 -3
  200. package/templates/restaurant/tier5-src/_shared/collection-service.ts +6 -9
  201. package/templates/restaurant/tier5-src/_shared/iap-presentation.ts +7 -3
  202. package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +1 -1
  203. package/templates/restaurant-owner/dev/index.ts +20 -20
  204. package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +6 -9
  205. package/templates/restaurant-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  206. package/templates/retail-store/dev/index.ts +19 -1
  207. package/templates/retail-store/tier5-src/_shared/collection-query-legacy.ts +194 -0
  208. package/templates/retail-store/tier5-src/_shared/collection-query.ts +158 -99
  209. package/templates/retail-store/tier5-src/_shared/collection-service.ts +31 -11
  210. package/templates/retail-store/tier5-src/_shared/iap-presentation.ts +7 -3
  211. package/templates/retail-store/tier5-src/_shared/read-service.ts +255 -0
  212. package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +1 -1
  213. package/templates/retail-store/tier5-src/himi-branded-lite-orders/index.ts +3 -0
  214. package/templates/retail-store/tier5-src/himi-branded-lite-shop/index.ts +202 -159
  215. package/templates/retail-store/tier5-src/himi-store-product/index.ts +130 -201
  216. package/templates/retail-store-owner/dev/index.ts +18 -18
  217. package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +6 -9
  218. package/templates/retail-store-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  219. package/templates/yoga-studio/dev/index.ts +4 -4
  220. package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +6 -9
  221. package/templates/yoga-studio/tier5-src/_shared/iap-presentation.ts +7 -3
  222. package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +1 -1
  223. package/templates/yoga-studio-owner/dev/index.ts +18 -18
  224. package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +6 -9
  225. package/templates/yoga-studio-owner/tier5-src/_shared/owner-module-data.ts +1 -1
@@ -1,16 +1,24 @@
1
1
  // ../../stdlib/wix-sdk/reviews/src/index.ts
2
- function wixCall(method, path, body) {
2
+ function wixCall(method, path, body, readOptions) {
3
3
  if (!globalThis.himalaya?.wixApi) {
4
4
  return Promise.reject(new Error("@himalaya/wix-reviews: host did not install the wixApi bridge"));
5
5
  }
6
- return globalThis.himalaya.wixApi.call(method, path, body);
6
+ const api = globalThis.himalaya.wixApi;
7
+ if (readOptions?.cache || readOptions?.onCacheResult) {
8
+ if (!api.read) return Promise.reject(new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime"));
9
+ return api.read(method, path, body, readOptions.site ? { "wix-site-id": readOptions.site } : void 0, { cache: readOptions.cache ?? "default" }).then((result) => {
10
+ readOptions.onCacheResult?.(result.cache);
11
+ return result.data;
12
+ });
13
+ }
14
+ return readOptions?.site ? api.call(method, path, body, { "wix-site-id": readOptions.site }) : api.call(method, path, body);
7
15
  }
8
- function queryReviews(query, returnPrivateReviews = false) {
9
- return wixCall("POST", "/reviews/v1/reviews/query", { query, returnPrivateReviews });
16
+ function queryReviews(query, returnPrivateReviews = false, readOptions) {
17
+ return wixCall("POST", "/reviews/v1/reviews/query", { query, returnPrivateReviews }, readOptions);
10
18
  }
11
- function getReview(id, returnPrivateReviews = true) {
19
+ function getReview(id, returnPrivateReviews = true, readOptions) {
12
20
  const qs = returnPrivateReviews ? "?returnPrivateReviews=true" : "";
13
- return wixCall("GET", `/reviews/v1/reviews/${encodeURIComponent(id)}${qs}`);
21
+ return wixCall("GET", `/reviews/v1/reviews/${encodeURIComponent(id)}${qs}`, void 0, readOptions);
14
22
  }
15
23
  function countReviews(filter, returnPrivateReviews = true) {
16
24
  return wixCall("POST", "/reviews/v1/reviews/count", { filter: filter ?? {}, returnPrivateReviews });
@@ -6,6 +6,9 @@ function defineService(name, def) {
6
6
  "@himalaya/state: defineService called outside a Himalaya runtime. This bundle must run inside a JSWorker (Tier 5)."
7
7
  );
8
8
  }
9
+ if (def.readLifecycle && (himalaya.readLifecycleVersion ?? 0) < 1) {
10
+ throw new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime before installing this screen");
11
+ }
9
12
  return himalaya.defineService(name, def);
10
13
  }
11
14
 
@@ -9,12 +9,26 @@ function wixCall(method, path, body, opts) {
9
9
  new Error("@himalaya/wix-seo-v1: host did not install the wixApi bridge")
10
10
  );
11
11
  }
12
- return globalThis.himalaya.wixApi.call(
13
- method,
14
- path,
15
- body,
16
- wixCallHeaders(opts)
12
+ const api = globalThis.himalaya.wixApi;
13
+ const verb = method.toUpperCase();
14
+ const readShaped = verb === "GET" || verb === "HEAD" || verb === "POST" && /\/(query|query-cursor|search|list|count)(\?|$)/.test(
15
+ path.split("#")[0]
17
16
  );
17
+ if (readShaped && (opts?.cache || opts?.onCacheResult)) {
18
+ if (!api.read)
19
+ return Promise.reject(
20
+ new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime")
21
+ );
22
+ return api.read(method, path, body, wixCallHeaders(opts), {
23
+ cache: opts.cache ?? "default"
24
+ }).then((result) => {
25
+ opts.onCacheResult?.(result.cache);
26
+ return result.data;
27
+ });
28
+ }
29
+ if (opts?.cache === "only-if-cached")
30
+ return Promise.reject(new Error("OFFLINE_CACHE_MISS"));
31
+ return api.call(method, path, body, wixCallHeaders(opts));
18
32
  }
19
33
  function wixQueryPath(path, req) {
20
34
  const parts = [];
@@ -22,12 +22,26 @@ function wixCall(method, path, body, opts) {
22
22
  )
23
23
  );
24
24
  }
25
- return globalThis.himalaya.wixApi.call(
26
- method,
27
- path,
28
- body,
29
- wixCallHeaders(opts)
25
+ const api = globalThis.himalaya.wixApi;
26
+ const verb = method.toUpperCase();
27
+ const readShaped = verb === "GET" || verb === "HEAD" || verb === "POST" && /\/(query|query-cursor|search|list|count)(\?|$)/.test(
28
+ path.split("#")[0]
30
29
  );
30
+ if (readShaped && (opts?.cache || opts?.onCacheResult)) {
31
+ if (!api.read)
32
+ return Promise.reject(
33
+ new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime")
34
+ );
35
+ return api.read(method, path, body, wixCallHeaders(opts), {
36
+ cache: opts.cache ?? "default"
37
+ }).then((result) => {
38
+ opts.onCacheResult?.(result.cache);
39
+ return result.data;
40
+ });
41
+ }
42
+ if (opts?.cache === "only-if-cached")
43
+ return Promise.reject(new Error("OFFLINE_CACHE_MISS"));
44
+ return api.call(method, path, body, wixCallHeaders(opts));
31
45
  }
32
46
  function querySites(req = {}, opts) {
33
47
  return wixCall(
@@ -1,17 +1,27 @@
1
1
  // ../../stdlib/wix-sdk/social-feed/src/index.ts
2
- function wixCall(method, path, body) {
2
+ function wixCall(method, path, body, readOptions) {
3
3
  if (!globalThis.himalaya?.wixApi) {
4
- return Promise.reject(new Error("@himalaya/wix-social-feed: host did not install the wixApi bridge"));
4
+ return Promise.reject(
5
+ new Error("@himalaya/wix-social-feed: host did not install the wixApi bridge")
6
+ );
5
7
  }
6
- return globalThis.himalaya.wixApi.call(method, path, body);
8
+ const api = globalThis.himalaya.wixApi;
9
+ if (readOptions?.cache || readOptions?.onCacheResult) {
10
+ if (!api.read) return Promise.reject(new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime"));
11
+ return api.read(method, path, body, readOptions.site ? { "wix-site-id": readOptions.site } : void 0, { cache: readOptions.cache ?? "default" }).then((result) => {
12
+ readOptions.onCacheResult?.(result.cache);
13
+ return result.data;
14
+ });
15
+ }
16
+ return readOptions?.site ? api.call(method, path, body, { "wix-site-id": readOptions.site }) : api.call(method, path, body);
7
17
  }
8
18
  var FEED_BASE = "https://social.wix.com/api/v1/feed";
9
19
  var FEED_SERVERLESS = "https://social.wix.com/serverless/mobile/feed";
10
20
  var GROUPS_APP_DEF_ID = "148c2287-c669-d849-d153-463c7486a694";
11
- function listFeedItems(groupId, limit = 20) {
21
+ function listFeedItems(groupId, limit = 20, options) {
12
22
  if (!groupId) throw new Error("listFeedItems: groupId is required");
13
23
  const qs = `containerId=${encodeURIComponent(groupId)}&appDefId=${GROUPS_APP_DEF_ID}&limit=${limit}&feedType=all&contentType=DRAFTJS`;
14
- return wixCall("GET", `${FEED_SERVERLESS}/v4/feedPosts/?${qs}`);
24
+ return wixCall("GET", `${FEED_SERVERLESS}/v4/feedPosts/?${qs}`, void 0, options);
15
25
  }
16
26
  function createFeedItem(groupId, content) {
17
27
  if (!groupId) throw new Error("createFeedItem: groupId is required");
@@ -79,18 +79,20 @@ function wixMediaUrl(value, size = WIX_LIST_IMAGE) {
79
79
 
80
80
  // ../../stdlib/wix-sdk/stores-collections/src/display.ts
81
81
  var STORES_TREE = { appNamespace: "@wix/stores" };
82
- function queryStoreCategories(limit = 50, cursor) {
82
+ function queryStoreCategories(limit = 50, cursor, options) {
83
83
  return wixCall("POST", "/categories/v1/categories/query", {
84
84
  query: { cursorPaging: { limit, ...cursor ? { cursor } : {} } },
85
85
  treeReference: STORES_TREE,
86
86
  fields: ["DESCRIPTION"]
87
- });
87
+ }, options);
88
88
  }
89
- function getStoreCategory(categoryId) {
89
+ function getStoreCategory(categoryId, options) {
90
90
  if (!categoryId) throw new Error("getStoreCategory: categoryId is required");
91
91
  return wixCall(
92
92
  "GET",
93
- `/categories/v1/categories/${encodeURIComponent(categoryId)}?treeReference.appNamespace=${encodeURIComponent("@wix/stores")}&fields=DESCRIPTION`
93
+ `/categories/v1/categories/${encodeURIComponent(categoryId)}?treeReference.appNamespace=${encodeURIComponent("@wix/stores")}&fields=DESCRIPTION`,
94
+ void 0,
95
+ options
94
96
  );
95
97
  }
96
98
  function categoryCount(c) {
@@ -102,21 +104,29 @@ function categoryImage(c, size = WIX_LIST_IMAGE) {
102
104
  }
103
105
 
104
106
  // ../../stdlib/wix-sdk/stores-collections/src/index.ts
105
- function wixCall(method, path, body) {
107
+ function wixCall(method, path, body, readOptions) {
106
108
  if (!globalThis.himalaya?.wixApi) {
107
109
  return Promise.reject(
108
110
  new Error("@himalaya/wix-stores-collections: host did not install the wixApi bridge")
109
111
  );
110
112
  }
111
- return globalThis.himalaya.wixApi.call(method, path, body);
113
+ const api = globalThis.himalaya.wixApi;
114
+ if (readOptions?.cache || readOptions?.onCacheResult) {
115
+ if (!api.read) return Promise.reject(new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime"));
116
+ return api.read(method, path, body, readOptions.site ? { "wix-site-id": readOptions.site } : void 0, { cache: readOptions.cache ?? "default" }).then((result) => {
117
+ readOptions.onCacheResult?.(result.cache);
118
+ return result.data;
119
+ });
120
+ }
121
+ return readOptions?.site ? api.call(method, path, body, { "wix-site-id": readOptions.site }) : api.call(method, path, body);
112
122
  }
113
- function getCollection(collectionId) {
123
+ function getCollection(collectionId, options) {
114
124
  if (!collectionId) throw new Error("getCollection: collectionId is required");
115
- return wixCall("GET", `/stores/v1/collections/${encodeURIComponent(collectionId)}?includeNumberOfProducts=true`);
125
+ return wixCall("GET", `/stores/v1/collections/${encodeURIComponent(collectionId)}?includeNumberOfProducts=true`, void 0, options);
116
126
  }
117
- function queryCollections(req = {}) {
127
+ function queryCollections(req = {}, options) {
118
128
  const body = { includeNumberOfProducts: true, ...req };
119
- return wixCall("POST", "/stores/v1/collections/query", body);
129
+ return wixCall("POST", "/stores/v1/collections/query", body, options);
120
130
  }
121
131
  function createCollection(collection) {
122
132
  return wixCall("POST", "/stores/v1/collections", { collection });
@@ -1,26 +1,34 @@
1
1
  // ../../stdlib/wix-sdk/stores-v1/src/catalog.ts
2
2
  var CATALOG_VERSION_KEY = "wix.stores.catalog-version.v1";
3
- var memo;
4
- var memoStamp;
5
- var inflight;
6
- var generation = 0;
7
- var resolveUnavailable = false;
3
+ var catalogStates = /* @__PURE__ */ new Map();
4
+ function stateFor(site) {
5
+ const key = site ?? "";
6
+ let state = catalogStates.get(key);
7
+ if (!state) {
8
+ state = { generation: 0, resolveUnavailable: false };
9
+ catalogStates.set(key, state);
10
+ }
11
+ return state;
12
+ }
13
+ function catalogKey(site) {
14
+ return site ? `${CATALOG_VERSION_KEY}:site:${encodeURIComponent(site)}` : CATALOG_VERSION_KEY;
15
+ }
8
16
  function catalogStorage() {
9
17
  const host = globalThis;
10
18
  return host.himalaya?.storage ?? host.localStorage;
11
19
  }
12
- function persistedCatalogVersion() {
20
+ function persistedCatalogVersion(site) {
13
21
  try {
14
- const value = catalogStorage()?.getItem(CATALOG_VERSION_KEY);
22
+ const value = catalogStorage()?.getItem(catalogKey(site));
15
23
  return value === "v1" || value === "v3" ? value : void 0;
16
24
  } catch {
17
25
  return void 0;
18
26
  }
19
27
  }
20
28
  var CLEARED_PREFIX = "cleared:";
21
- function catalogWitness() {
29
+ function catalogWitness(site) {
22
30
  try {
23
- return catalogStorage()?.getItem(CATALOG_VERSION_KEY) ?? "";
31
+ return catalogStorage()?.getItem(catalogKey(site)) ?? "";
24
32
  } catch {
25
33
  return "";
26
34
  }
@@ -28,55 +36,58 @@ function catalogWitness() {
28
36
  function clearedToken() {
29
37
  return `${CLEARED_PREFIX}${Date.now().toString(36)}.${Math.random().toString(36).slice(2, 10)}`;
30
38
  }
31
- function rememberCatalogVersion(version, persist = true, witness) {
39
+ function rememberCatalogVersion(version, persist = true, witness, site) {
40
+ const state = stateFor(site);
32
41
  const store = catalogStorage();
33
42
  if (!store) {
34
- memo = version;
35
- memoStamp = void 0;
43
+ state.memo = version;
44
+ state.memoStamp = void 0;
36
45
  return;
37
46
  }
38
47
  let current;
39
48
  try {
40
- current = store.getItem(CATALOG_VERSION_KEY) ?? "";
49
+ current = store.getItem(catalogKey(site)) ?? "";
41
50
  } catch {
42
- memo = version;
43
- memoStamp = void 0;
51
+ state.memo = version;
52
+ state.memoStamp = void 0;
44
53
  return;
45
54
  }
46
55
  if (witness !== void 0 && current !== witness) return;
47
56
  if (persist) {
48
57
  try {
49
- if (current !== version) store.setItem(CATALOG_VERSION_KEY, version);
58
+ if (current !== version) store.setItem(catalogKey(site), version);
50
59
  } catch {
51
- memo = version;
52
- memoStamp = void 0;
60
+ state.memo = version;
61
+ state.memoStamp = void 0;
53
62
  return;
54
63
  }
55
64
  }
56
- memo = version;
57
- memoStamp = persist ? version : current;
58
- }
59
- function liveMemo() {
60
- if (!memo || memoStamp === void 0) return memo;
61
- if (catalogWitness() !== memoStamp) {
62
- memo = void 0;
63
- memoStamp = void 0;
65
+ state.memo = version;
66
+ state.memoStamp = persist ? version : current;
67
+ }
68
+ function liveMemo(site) {
69
+ const state = stateFor(site);
70
+ if (!state.memo || state.memoStamp === void 0) return state.memo;
71
+ if (catalogWitness(site) !== state.memoStamp) {
72
+ state.memo = void 0;
73
+ state.memoStamp = void 0;
64
74
  }
65
- return memo;
66
- }
67
- function forgetCatalogVersion() {
68
- generation += 1;
69
- memo = void 0;
70
- memoStamp = void 0;
71
- inflight = void 0;
72
- resolveUnavailable = false;
75
+ return state.memo;
76
+ }
77
+ function forgetCatalogVersion(site) {
78
+ const state = stateFor(site);
79
+ state.generation += 1;
80
+ state.memo = void 0;
81
+ state.memoStamp = void 0;
82
+ state.inflight = void 0;
83
+ state.resolveUnavailable = false;
73
84
  try {
74
- catalogStorage()?.setItem(CATALOG_VERSION_KEY, clearedToken());
85
+ catalogStorage()?.setItem(catalogKey(site), clearedToken());
75
86
  } catch {
76
87
  }
77
88
  }
78
- function observedCatalogVersion() {
79
- return liveMemo() ?? persistedCatalogVersion();
89
+ function observedCatalogVersion(site) {
90
+ return liveMemo(site) ?? persistedCatalogVersion(site);
80
91
  }
81
92
  function isCatalogMismatch(e) {
82
93
  return /CATALOG_V[13]|catalog version/i.test(String(e?.message ?? e));
@@ -87,48 +98,52 @@ function catalogVersionFromMismatch(e) {
87
98
  if (/CATALOG_V3(_SITE)?_CALLING/i.test(message)) return "v3";
88
99
  return void 0;
89
100
  }
90
- function noteCatalogMismatch(attempted, error, witness) {
101
+ function noteCatalogMismatch(attempted, error, witness, site) {
91
102
  const named = catalogVersionFromMismatch(error);
92
- rememberCatalogVersion(named ?? (attempted === "v3" ? "v1" : "v3"), named !== void 0, witness);
93
- }
94
- async function readWithCatalogFallback(attempt) {
95
- const first = observedCatalogVersion() ?? (resolveUnavailable ? "v3" : await resolveCatalogVersion());
96
- const witness = catalogWitness();
97
- const startedAt = generation;
103
+ rememberCatalogVersion(named ?? (attempted === "v3" ? "v1" : "v3"), named !== void 0, witness, site);
104
+ }
105
+ async function readWithCatalogFallback(attempt, cacheOnly = false, site) {
106
+ const state = stateFor(site);
107
+ const observed = observedCatalogVersion(site);
108
+ const first = observed ?? (cacheOnly || state.resolveUnavailable ? "v3" : await resolveCatalogVersion(site));
109
+ const witness = catalogWitness(site);
110
+ const startedAt = state.generation;
98
111
  try {
99
112
  return await attempt(first);
100
113
  } catch (error) {
114
+ if (cacheOnly && !observed && /OFFLINE_CACHE_MISS/.test(String(error))) return attempt(first === "v3" ? "v1" : "v3");
101
115
  if (!isCatalogMismatch(error)) throw error;
102
- if (generation === startedAt) noteCatalogMismatch(first, error, witness);
116
+ if (state.generation === startedAt) noteCatalogMismatch(first, error, witness, site);
103
117
  const named = catalogVersionFromMismatch(error);
104
118
  const corrected = named !== void 0 && named !== first ? named : first === "v3" ? "v1" : "v3";
105
119
  return attempt(corrected);
106
120
  }
107
121
  }
108
- async function resolveCatalogVersion() {
109
- const known = liveMemo();
122
+ async function resolveCatalogVersion(site) {
123
+ const state = stateFor(site);
124
+ const known = liveMemo(site);
110
125
  if (known) return known;
111
- const stored = persistedCatalogVersion();
126
+ const stored = persistedCatalogVersion(site);
112
127
  if (stored) {
113
- memo = stored;
114
- memoStamp = stored;
128
+ state.memo = stored;
129
+ state.memoStamp = stored;
115
130
  return stored;
116
131
  }
117
- if (!inflight) {
118
- const startedAt = generation;
119
- const witness = catalogWitness();
120
- inflight = wixCall("GET", "/stores/v3/provision/version").then((res) => {
132
+ if (!state.inflight) {
133
+ const startedAt = state.generation;
134
+ const witness = catalogWitness(site);
135
+ state.inflight = wixCall("GET", "/stores/v3/provision/version", void 0, site ? { site } : void 0).then((res) => {
121
136
  const v = res?.catalogVersion === "V1_CATALOG" ? "v1" : "v3";
122
- if (generation === startedAt) rememberCatalogVersion(v, true, witness);
137
+ if (state.generation === startedAt) rememberCatalogVersion(v, true, witness, site);
123
138
  return v;
124
139
  }).catch(() => {
125
- if (generation === startedAt) resolveUnavailable = true;
140
+ if (state.generation === startedAt) state.resolveUnavailable = true;
126
141
  return "v3";
127
142
  }).finally(() => {
128
- if (generation === startedAt) inflight = void 0;
143
+ if (state.generation === startedAt) state.inflight = void 0;
129
144
  });
130
145
  }
131
- return inflight;
146
+ return state.inflight;
132
147
  }
133
148
 
134
149
  // ../../stdlib/wix-sdk/stores-v1/src/products-v3.ts
@@ -349,22 +364,22 @@ function fromV1(res, offset) {
349
364
  }
350
365
  };
351
366
  }
352
- function queryV1(limit, cursor) {
367
+ function queryV1(limit, cursor, options) {
353
368
  const offset = v1Offset(cursor);
354
369
  return wixCall("POST", "/stores/v1/products/query", {
355
370
  query: { paging: { limit, offset } }
356
- }).then((res) => fromV1(res, offset));
371
+ }, options).then((res) => fromV1(res, offset));
357
372
  }
358
- async function queryStoreProducts(limit = 50, cursor, fields) {
373
+ async function queryStoreProducts(limit = 50, cursor, fields, options) {
359
374
  return readWithCatalogFallback((version) => {
360
- if (version === "v1") return queryV1(limit, cursor);
375
+ if (version === "v1") return queryV1(limit, cursor, options);
361
376
  return wixCall("POST", "/stores/v3/products/query", {
362
377
  query: { cursorPaging: cursor ? { limit, cursor } : { limit } },
363
378
  fields: readFields(fields)
364
- });
365
- });
379
+ }, options);
380
+ }, options?.cache === "only-if-cached", options?.site);
366
381
  }
367
- async function searchStoreProducts(options = {}) {
382
+ async function searchStoreProducts(options = {}, readOptions) {
368
383
  const query = (options.query ?? "").trim().slice(0, 256);
369
384
  const limit = Math.max(1, Math.min(100, Math.floor(options.limit ?? 50) || 50));
370
385
  const ids = options.ids === void 0 ? void 0 : [...new Set(options.ids.filter((id) => typeof id === "string" && !!id))].slice(0, 500);
@@ -383,7 +398,7 @@ async function searchStoreProducts(options = {}) {
383
398
  paging: { limit, offset },
384
399
  ...Object.keys(filter2).length ? { filter: JSON.stringify(filter2) } : {},
385
400
  ...sorted ? { sort: JSON.stringify([{ name: ascending ? "asc" : "desc" }]) } : {}
386
- } }).then((res) => fromV1(res, offset));
401
+ } }, readOptions).then((res) => fromV1(res, offset));
387
402
  }
388
403
  const filter = {
389
404
  ...ids ? { id: { $in: ids } } : {},
@@ -399,22 +414,24 @@ async function searchStoreProducts(options = {}) {
399
414
  return wixCall("POST", `/stores/v3/products/${search ? "search" : "query"}`, {
400
415
  [search ? "search" : "query"]: criteria,
401
416
  fields: readFields(options.fields)
402
- });
403
- });
417
+ }, readOptions);
418
+ }, readOptions?.cache === "only-if-cached", readOptions?.site);
404
419
  }
405
- function getProductV1(productId) {
406
- return wixCall("GET", `/stores/v1/products/${encodeURIComponent(productId)}`);
420
+ function getProductV1(productId, readOptions) {
421
+ return wixCall("GET", `/stores/v1/products/${encodeURIComponent(productId)}`, void 0, readOptions);
407
422
  }
408
- async function getStoreProduct(productId, fields) {
423
+ async function getStoreProduct(productId, fields, readOptions) {
409
424
  if (!productId) throw new Error("getStoreProduct: productId is required");
410
425
  return readWithCatalogFallback((version) => {
411
- if (version === "v1") return getProductV1(productId);
426
+ if (version === "v1") return getProductV1(productId, readOptions);
412
427
  const query = readFields(fields).map((f) => `fields=${encodeURIComponent(f)}`).join("&");
413
428
  return wixCall(
414
429
  "GET",
415
- `/stores/v3/products/${encodeURIComponent(productId)}?${query}`
430
+ `/stores/v3/products/${encodeURIComponent(productId)}?${query}`,
431
+ void 0,
432
+ readOptions
416
433
  );
417
- });
434
+ }, readOptions?.cache === "only-if-cached", readOptions?.site);
418
435
  }
419
436
  function productImage(p, size = WIX_LIST_IMAGE) {
420
437
  const raw = rawMediaSlot(p.media?.mainMedia) || rawMediaSlot(p.media?.main) || rawMediaSlot(p.media?.items?.[0]) || rawMediaSlot(p.media?.itemsInfo?.items?.[0]) || "";
@@ -736,20 +753,22 @@ function queryProducts(req = {}) {
736
753
  return { products: page.map(fromV3Product) };
737
754
  });
738
755
  }
739
- function getProduct(productId, opts = {}) {
756
+ function getProduct(productId, opts = {}, readOptions) {
740
757
  if (!productId) throw new Error("getProduct: productId is required");
741
758
  const id = encodeURIComponent(productId);
742
759
  const fields = opts.richDescription ? V3_DETAIL_READ_FIELDS : V3_READ_FIELDS;
743
760
  return readWithCatalogFallback(async (v) => {
744
- if (v === "v1") return wixCall("GET", `/stores/v1/products/${id}`);
761
+ if (v === "v1") return wixCall("GET", `/stores/v1/products/${id}`, void 0, readOptions);
745
762
  const res = await wixCall(
746
763
  "GET",
747
- `/stores/v3/products/${id}?${fields.map((f) => `fields=${f}`).join("&")}`
764
+ `/stores/v3/products/${id}?${fields.map((f) => `fields=${f}`).join("&")}`,
765
+ void 0,
766
+ readOptions
748
767
  );
749
768
  if (!res.product) return { product: void 0 };
750
769
  const product = fromV3Product(res.product);
751
770
  return { product: opts.richDescription ? { ...product, richDescription: res.product.description ?? null } : product };
752
- });
771
+ }, readOptions?.cache === "only-if-cached", readOptions?.site);
753
772
  }
754
773
  async function createProduct(product) {
755
774
  if (await resolveCatalogVersion() === "v1") {
@@ -806,12 +825,26 @@ function wixCall(method, path, body, opts) {
806
825
  )
807
826
  );
808
827
  }
809
- return globalThis.himalaya.wixApi.call(
810
- method,
811
- path,
812
- body,
813
- wixCallHeaders(opts)
828
+ const api = globalThis.himalaya.wixApi;
829
+ const verb = method.toUpperCase();
830
+ const readShaped = verb === "GET" || verb === "HEAD" || verb === "POST" && /\/(query|query-cursor|search|list|count)(\?|$)/.test(
831
+ path.split("#")[0]
814
832
  );
833
+ if (readShaped && (opts?.cache || opts?.onCacheResult)) {
834
+ if (!api.read)
835
+ return Promise.reject(
836
+ new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime")
837
+ );
838
+ return api.read(method, path, body, wixCallHeaders(opts), {
839
+ cache: opts.cache ?? "default"
840
+ }).then((result) => {
841
+ opts.onCacheResult?.(result.cache);
842
+ return result.data;
843
+ });
844
+ }
845
+ if (opts?.cache === "only-if-cached")
846
+ return Promise.reject(new Error("OFFLINE_CACHE_MISS"));
847
+ return api.call(method, path, body, wixCallHeaders(opts));
815
848
  }
816
849
  function addProductMedia(productId, opts) {
817
850
  if (!productId) throw new Error("addProductMedia: productId is required");
@@ -1,15 +1,23 @@
1
1
  // ../../stdlib/wix-sdk/table-reservations/src/index.ts
2
- function wixCall(method, path, body) {
2
+ function wixCall(method, path, body, readOptions) {
3
3
  if (!globalThis.himalaya?.wixApi) {
4
4
  return Promise.reject(new Error("@himalaya/wix-table-reservations: host did not install the wixApi bridge"));
5
5
  }
6
- return globalThis.himalaya.wixApi.call(method, path, body);
6
+ const api = globalThis.himalaya.wixApi;
7
+ if (readOptions?.cache || readOptions?.onCacheResult) {
8
+ if (!api.read) return Promise.reject(new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime"));
9
+ return api.read(method, path, body, readOptions.site ? { "wix-site-id": readOptions.site } : void 0, { cache: readOptions.cache ?? "default" }).then((result) => {
10
+ readOptions.onCacheResult?.(result.cache);
11
+ return result.data;
12
+ });
13
+ }
14
+ return readOptions?.site ? api.call(method, path, body, { "wix-site-id": readOptions.site }) : api.call(method, path, body);
7
15
  }
8
- function queryReservations(query) {
9
- return wixCall("POST", "/table-reservations/reservations/v1/reservations/query", { query });
16
+ function queryReservations(query, readOptions) {
17
+ return wixCall("POST", "/table-reservations/reservations/v1/reservations/query", { query }, readOptions);
10
18
  }
11
- function getReservation(reservationId) {
12
- return wixCall("GET", `/table-reservations/reservations/v1/reservations/${reservationId}`);
19
+ function getReservation(reservationId, readOptions) {
20
+ return wixCall("GET", `/table-reservations/reservations/v1/reservations/${reservationId}`, void 0, readOptions);
13
21
  }
14
22
  function updateReservationStatus(reservationId, revision, status) {
15
23
  return wixCall("PATCH", `/table-reservations/reservations/v1/reservations/${reservationId}`, {
@@ -20,8 +28,8 @@ function updateReservationStatus(reservationId, revision, status) {
20
28
  function cancelReservation(reservationId, revision) {
21
29
  return wixCall("POST", `/table-reservations/reservations/v1/reservations/${reservationId}/cancel`, { revision });
22
30
  }
23
- function listReservationLocations() {
24
- return wixCall("GET", "/table-reservations/reservation-locations/v1/reservation-locations");
31
+ function listReservationLocations(readOptions) {
32
+ return wixCall("GET", "/table-reservations/reservation-locations/v1/reservation-locations", void 0, readOptions);
25
33
  }
26
34
  function createHeldReservation(reservationDetails) {
27
35
  return wixCall("POST", "/table-reservations/reservations/v1/reservations/hold", { reservationDetails });
@@ -1,12 +1,22 @@
1
1
  // ../../stdlib/wix-sdk/users/src/index.ts
2
- function wixCall(method, path, body) {
2
+ function wixCall(method, path, body, readOptions) {
3
3
  if (!globalThis.himalaya?.wixApi) {
4
- return Promise.reject(new Error("@himalaya/wix-users: host did not install the wixApi bridge"));
4
+ return Promise.reject(
5
+ new Error("@himalaya/wix-users: host did not install the wixApi bridge")
6
+ );
5
7
  }
6
- return globalThis.himalaya.wixApi.call(method, path, body);
8
+ const api = globalThis.himalaya.wixApi;
9
+ if (readOptions?.cache || readOptions?.onCacheResult) {
10
+ if (!api.read) return Promise.reject(new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime"));
11
+ return api.read(method, path, body, readOptions.site ? { "wix-site-id": readOptions.site } : void 0, { cache: readOptions.cache ?? "default" }).then((result) => {
12
+ readOptions.onCacheResult?.(result.cache);
13
+ return result.data;
14
+ });
15
+ }
16
+ return readOptions?.site ? api.call(method, path, body, { "wix-site-id": readOptions.site }) : api.call(method, path, body);
7
17
  }
8
- function getMyData() {
9
- return wixCall("GET", "https://users.wix.com/wix-users/v1/users/my-data?includeProfile=true");
18
+ function getMyData(options) {
19
+ return wixCall("GET", "https://users.wix.com/wix-users/v1/users/my-data?includeProfile=true", void 0, options);
10
20
  }
11
21
  function displayName(d) {
12
22
  const full = [d.profile?.firstName, d.profile?.lastName].filter(Boolean).join(" ").trim();
@@ -197,8 +197,16 @@ async function wixVideoQuery(query, variables = {}, opts) {
197
197
  if (!wixApi) throw wixVideoError("@himalaya/wix-video: host did not install the wixApi bridge");
198
198
  const headers = callHeaders(opts);
199
199
  let response;
200
+ const lifecycle = !!(opts?.cache || opts?.onCacheResult);
201
+ if (lifecycle && !wixApi.read) throw wixVideoError("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime");
200
202
  try {
201
- response = await (headers ? wixApi.call("POST", WIX_VIDEO_GRAPHQL_URL, { query, variables }, headers) : wixApi.call("POST", WIX_VIDEO_GRAPHQL_URL, { query, variables }));
203
+ if (lifecycle) {
204
+ const result = await wixApi.read("POST", WIX_VIDEO_GRAPHQL_URL, { query, variables }, headers, { cache: opts.cache ?? "default" });
205
+ opts.onCacheResult?.(result.cache);
206
+ response = result.data;
207
+ } else {
208
+ response = await (headers ? wixApi.call("POST", WIX_VIDEO_GRAPHQL_URL, { query, variables }, headers) : wixApi.call("POST", WIX_VIDEO_GRAPHQL_URL, { query, variables }));
209
+ }
202
210
  } catch (error) {
203
211
  throw transportError(error);
204
212
  }