@wix/himalaya-cli 0.1544.0 → 0.1546.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 (227) 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 +1002 -806
  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/himi-json-output.md +29 -0
  127. package/guides/iap-products.md +49 -4
  128. package/guides/index.json +6 -0
  129. package/guides/offline-reading.md +63 -0
  130. package/guides/recipe-dynamic-list.md +2 -0
  131. package/guides/recipe-four-state.md +1 -0
  132. package/guides/sdk-reference.json +225 -99
  133. package/guides/testing-himi-apps.md +2 -0
  134. package/guides/tier-5-add-a-screen.md +2 -0
  135. package/package.json +2 -2
  136. package/templates/beauty-salon/dev/index.ts +4 -3
  137. package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +6 -9
  138. package/templates/beauty-salon/tier5-src/_shared/iap-presentation.ts +7 -3
  139. package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +1 -1
  140. package/templates/beauty-salon/tier5-src/himi-branded-lite-orders/index.ts +3 -0
  141. package/templates/beauty-salon-owner/dev/index.ts +19 -19
  142. package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +6 -9
  143. package/templates/beauty-salon-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  144. package/templates/branded-lite/dev/index.ts +38 -20
  145. package/templates/branded-lite/tier5-src/_shared/collection-query-legacy.ts +194 -0
  146. package/templates/branded-lite/tier5-src/_shared/collection-query.ts +158 -99
  147. package/templates/branded-lite/tier5-src/_shared/collection-service.ts +31 -11
  148. package/templates/branded-lite/tier5-src/_shared/iap-presentation.ts +7 -3
  149. package/templates/branded-lite/tier5-src/_shared/read-service.ts +255 -0
  150. package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +1 -1
  151. package/templates/branded-lite/tier5-src/himi-branded-lite-orders/index.ts +3 -0
  152. package/templates/branded-lite/tier5-src/himi-branded-lite-shop/index.ts +202 -159
  153. package/templates/branded-lite/tier5-src/himi-store-product/index.ts +130 -201
  154. package/templates/community-club/dev/index.ts +4 -4
  155. package/templates/community-club/tier5-src/_shared/collection-service.ts +6 -9
  156. package/templates/community-club/tier5-src/_shared/iap-presentation.ts +7 -3
  157. package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +1 -1
  158. package/templates/community-club-owner/dev/index.ts +19 -19
  159. package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +6 -9
  160. package/templates/community-club-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  161. package/templates/events-meetups/dev/index.ts +3 -3
  162. package/templates/events-meetups/tier5-src/_shared/collection-service.ts +6 -9
  163. package/templates/events-meetups/tier5-src/_shared/iap-presentation.ts +7 -3
  164. package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +1 -1
  165. package/templates/events-meetups-owner/dev/index.ts +17 -17
  166. package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +6 -9
  167. package/templates/events-meetups-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  168. package/templates/gym-fitness/dev/index.ts +5 -4
  169. package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +6 -9
  170. package/templates/gym-fitness/tier5-src/_shared/iap-presentation.ts +7 -3
  171. package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +1 -1
  172. package/templates/gym-fitness/tier5-src/himi-branded-lite-orders/index.ts +3 -0
  173. package/templates/gym-fitness-owner/dev/index.ts +20 -20
  174. package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +6 -9
  175. package/templates/gym-fitness-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  176. package/templates/nonprofit-cause/dev/index.ts +4 -4
  177. package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +6 -9
  178. package/templates/nonprofit-cause/tier5-src/_shared/iap-presentation.ts +7 -3
  179. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +1 -1
  180. package/templates/nonprofit-cause-owner/dev/index.ts +18 -18
  181. package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +6 -9
  182. package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  183. package/templates/owner-lite/dev/index.ts +20 -20
  184. package/templates/owner-lite/tier5-src/_shared/collection-service.ts +6 -9
  185. package/templates/owner-lite/tier5-src/_shared/owner-module-data.ts +1 -1
  186. package/templates/podcast-creator/dev/index.ts +4 -4
  187. package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +6 -9
  188. package/templates/podcast-creator/tier5-src/_shared/iap-presentation.ts +7 -3
  189. package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +1 -1
  190. package/templates/podcast-creator-owner/dev/index.ts +19 -19
  191. package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +6 -9
  192. package/templates/podcast-creator-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  193. package/templates/portfolio-creative/dev/index.ts +5 -4
  194. package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +6 -9
  195. package/templates/portfolio-creative/tier5-src/_shared/iap-presentation.ts +7 -3
  196. package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +1 -1
  197. package/templates/portfolio-creative/tier5-src/himi-branded-lite-orders/index.ts +3 -0
  198. package/templates/portfolio-creative-owner/dev/index.ts +19 -19
  199. package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +6 -9
  200. package/templates/portfolio-creative-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  201. package/templates/restaurant/dev/index.ts +3 -3
  202. package/templates/restaurant/tier5-src/_shared/collection-service.ts +6 -9
  203. package/templates/restaurant/tier5-src/_shared/iap-presentation.ts +7 -3
  204. package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +1 -1
  205. package/templates/restaurant-owner/dev/index.ts +20 -20
  206. package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +6 -9
  207. package/templates/restaurant-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  208. package/templates/retail-store/dev/index.ts +19 -1
  209. package/templates/retail-store/tier5-src/_shared/collection-query-legacy.ts +194 -0
  210. package/templates/retail-store/tier5-src/_shared/collection-query.ts +158 -99
  211. package/templates/retail-store/tier5-src/_shared/collection-service.ts +31 -11
  212. package/templates/retail-store/tier5-src/_shared/iap-presentation.ts +7 -3
  213. package/templates/retail-store/tier5-src/_shared/read-service.ts +255 -0
  214. package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +1 -1
  215. package/templates/retail-store/tier5-src/himi-branded-lite-orders/index.ts +3 -0
  216. package/templates/retail-store/tier5-src/himi-branded-lite-shop/index.ts +202 -159
  217. package/templates/retail-store/tier5-src/himi-store-product/index.ts +130 -201
  218. package/templates/retail-store-owner/dev/index.ts +18 -18
  219. package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +6 -9
  220. package/templates/retail-store-owner/tier5-src/_shared/owner-module-data.ts +1 -1
  221. package/templates/yoga-studio/dev/index.ts +4 -4
  222. package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +6 -9
  223. package/templates/yoga-studio/tier5-src/_shared/iap-presentation.ts +7 -3
  224. package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +1 -1
  225. package/templates/yoga-studio-owner/dev/index.ts +18 -18
  226. package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +6 -9
  227. package/templates/yoga-studio-owner/tier5-src/_shared/owner-module-data.ts +1 -1
@@ -11,12 +11,26 @@ function wixCall(method, path, body, opts) {
11
11
  )
12
12
  );
13
13
  }
14
- return globalThis.himalaya.wixApi.call(
15
- method,
16
- path,
17
- body,
18
- wixCallHeaders(opts)
19
- );
14
+ const api = globalThis.himalaya.wixApi;
15
+ const verb = method.toUpperCase();
16
+ const readShaped = verb === "GET" || verb === "HEAD" || verb === "POST" && /\/(query|query-cursor|search|list|count)(\?|$)/.test(
17
+ path.split("#")[0]
18
+ );
19
+ if (readShaped && (opts?.cache || opts?.onCacheResult)) {
20
+ if (!api.read)
21
+ return Promise.reject(
22
+ new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime")
23
+ );
24
+ return api.read(method, path, body, wixCallHeaders(opts), {
25
+ cache: opts.cache ?? "default"
26
+ }).then((result) => {
27
+ opts.onCacheResult?.(result.cache);
28
+ return result.data;
29
+ });
30
+ }
31
+ if (opts?.cache === "only-if-cached")
32
+ return Promise.reject(new Error("OFFLINE_CACHE_MISS"));
33
+ return api.call(method, path, body, wixCallHeaders(opts));
20
34
  }
21
35
  function wixQueryPath(path, req) {
22
36
  const parts = [];
@@ -1,9 +1,18 @@
1
1
  // ../../stdlib/wix-sdk/chat-web/src/index.ts
2
- function wixCall(method, path, body, headers) {
3
- if (!globalThis.himalaya?.wixApi) {
2
+ function wixCall(method, path, body, headers, options) {
3
+ const api = globalThis.himalaya?.wixApi;
4
+ if (!api) {
4
5
  return Promise.reject(new Error("@himalaya/wix-chat-web: host did not install the wixApi bridge"));
5
6
  }
6
- return globalThis.himalaya.wixApi.call(method, path, body, headers);
7
+ const readShaped = method === "GET" || method === "HEAD" || method === "POST" && (/\/(query|search|list|count)(\?|$)/.test(path) || /\/_api\/chat-web\/v1\/chatrooms-for-list-view(?:\/(?:business|siteMember))?(?:[?#]|$)/.test(path));
8
+ if (readShaped && (options?.cache || options?.onCacheResult)) {
9
+ if (!api.read) return Promise.reject(new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime"));
10
+ return api.read(method, path, body ?? null, headers, { cache: options.cache ?? "default" }).then((result) => {
11
+ options.onCacheResult?.(result.cache);
12
+ return result.data;
13
+ });
14
+ }
15
+ return api.call(method, path, body, headers);
7
16
  }
8
17
  function uuid() {
9
18
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
@@ -92,10 +101,17 @@ async function getMessagesPage(chatroomId, params = {}) {
92
101
  throw chatWebError("invalid_argument", "invalid ordering");
93
102
  }
94
103
  const { chatToken } = await getChatToken(params);
104
+ if (!chatToken) {
105
+ if (params.cache || params.onCacheResult) throw chatWebError("token_empty", "Chat authorization unavailable");
106
+ return { items: [], next: void 0, nextPointer: void 0 };
107
+ }
95
108
  const query = queryString({ chatToken, pageSize: size, ordering, nextPointer });
96
109
  const res = await wixCall(
97
110
  "GET",
98
- `${BASE}/_api/chat-web/v1/chatrooms/${room}/messages?${query}`
111
+ `${BASE}/_api/chat-web/v1/chatrooms/${room}/messages?${query}`,
112
+ void 0,
113
+ void 0,
114
+ params
99
115
  );
100
116
  if (!res || typeof res !== "object") throw chatWebError("invalid_response", "history response is not an object");
101
117
  const items = requiredArray(res.items, "items");
@@ -138,6 +154,9 @@ async function getChatToken(options = {}) {
138
154
  }
139
155
  return { chatToken: options.chatToken };
140
156
  }
157
+ if (options.cache === "only-if-cached") {
158
+ throw chatWebError("token_empty", "Chat authorization unavailable offline");
159
+ }
141
160
  const role = options.role ?? "owner";
142
161
  if (role !== "owner" && role !== "member") {
143
162
  throw chatWebError("invalid_argument", "invalid role");
@@ -156,14 +175,17 @@ async function getChatToken(options = {}) {
156
175
  failure = e;
157
176
  }
158
177
  }
159
- throw failure === void 0 ? chatWebError("token_empty", `chat token mint returned no token after ${TOKEN_MINT_ATTEMPTS} attempts`) : chatWebError("token_mint_failed", `chat token mint failed after ${TOKEN_MINT_ATTEMPTS} attempts`, failure);
178
+ throw failure === void 0 ? chatWebError("token_empty", "Chat authorization unavailable") : chatWebError("token_mint_failed", `chat token mint failed after ${TOKEN_MINT_ATTEMPTS} attempts`, failure);
160
179
  }
161
180
  async function listChatrooms(pageSize = 20, options = {}) {
162
181
  if (options.role === "member") return (await listChatroomsPage({ ...options, pageSize })).items;
163
182
  const { chatToken } = await getChatToken(options);
164
183
  const res = await wixCall(
165
184
  "GET",
166
- `${BASE}/_api/chat-web/v2/chatrooms?chatToken=${encodeURIComponent(chatToken)}&pageSize=${pageSize}`
185
+ `${BASE}/_api/chat-web/v2/chatrooms?chatToken=${encodeURIComponent(chatToken)}&pageSize=${pageSize}`,
186
+ void 0,
187
+ void 0,
188
+ options
167
189
  );
168
190
  return res.chatrooms?.items ?? [];
169
191
  }
@@ -197,7 +219,7 @@ async function listChatroomsPage(params = {}) {
197
219
  lastMessageLimit: LAST_MESSAGE_LIMIT,
198
220
  unreadChatroomLimit: unreadLimit
199
221
  });
200
- const res = await wixCall("POST", `${BASE}/_api/chat-web/v1/chatrooms-for-list-view${type}?${query}`, { participantIds, labelIds: [] });
222
+ const res = await wixCall("POST", `${BASE}/_api/chat-web/v1/chatrooms-for-list-view${type}?${query}`, { participantIds, labelIds: [] }, void 0, params);
201
223
  if (!res || typeof res !== "object" || !res.chatrooms || typeof res.chatrooms !== "object") {
202
224
  throw chatWebError("invalid_response", "list response has no chatrooms");
203
225
  }
@@ -189,12 +189,26 @@ function wixCall(method, path, body, opts) {
189
189
  )
190
190
  );
191
191
  }
192
- return globalThis.himalaya.wixApi.call(
193
- method,
194
- path,
195
- body,
196
- wixCallHeaders(opts)
192
+ const api = globalThis.himalaya.wixApi;
193
+ const verb = method.toUpperCase();
194
+ const readShaped = verb === "GET" || verb === "HEAD" || verb === "POST" && /\/(query|query-cursor|search|list|count)(\?|$)/.test(
195
+ path.split("#")[0]
197
196
  );
197
+ if (readShaped && (opts?.cache || opts?.onCacheResult)) {
198
+ if (!api.read)
199
+ return Promise.reject(
200
+ new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime")
201
+ );
202
+ return api.read(method, path, body, wixCallHeaders(opts), {
203
+ cache: opts.cache ?? "default"
204
+ }).then((result) => {
205
+ opts.onCacheResult?.(result.cache);
206
+ return result.data;
207
+ });
208
+ }
209
+ if (opts?.cache === "only-if-cached")
210
+ return Promise.reject(new Error("OFFLINE_CACHE_MISS"));
211
+ return api.call(method, path, body, wixCallHeaders(opts));
198
212
  }
199
213
  function wixQueryPath(path, req) {
200
214
  const parts = [];
@@ -490,6 +504,15 @@ function send(verb, template, req, opts, route, queue) {
490
504
  const headers = site ? { "wix-site-id": site } : void 0;
491
505
  const target = route.query ? wixQueryPath2(path, withoutFields(req, fields)) : path;
492
506
  const body = route.query ? void 0 : req;
507
+ const readShaped = verb === "GET" || verb === "HEAD" || verb === "POST" && /\/(query|query-cursor|search|list|count)(?:\?|$)/i.test(target.split("#")[0]);
508
+ if (readShaped && (opts?.cache || opts?.onCacheResult)) {
509
+ if (!api.read) return Promise.reject(new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime"));
510
+ return api.read(verb, target, body, headers, { cache: opts.cache ?? "default" }).then((result) => {
511
+ opts.onCacheResult?.(result.cache);
512
+ return result.data;
513
+ });
514
+ }
515
+ if (opts?.cache === "only-if-cached") return Promise.reject(new Error("OFFLINE_CACHE_MISS"));
493
516
  if (!queue) return api.call(verb, target, body, headers);
494
517
  if (!api.offline) return api.call(verb, target, body, headers).then((value) => ({ status: "sent", value }));
495
518
  return api.call(verb, target, body, headers, { offline: "queue" });
@@ -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 wixQueryPath(path, req) {
33
47
  const parts = [];
@@ -1,18 +1,26 @@
1
1
  // ../../stdlib/wix-sdk/coupons/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(
5
5
  new Error("@himalaya/wix-coupons: host did not install the wixApi bridge")
6
6
  );
7
7
  }
8
- 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);
9
17
  }
10
- function queryCoupons(req = {}) {
11
- return wixCall("POST", "/stores/v2/coupons/query", { query: req });
18
+ function queryCoupons(req = {}, readOptions) {
19
+ return wixCall("POST", "/stores/v2/coupons/query", { query: req }, readOptions);
12
20
  }
13
- function getCoupon(id) {
21
+ function getCoupon(id, options) {
14
22
  if (!id) throw new Error("getCoupon: id is required");
15
- return wixCall("GET", `/stores/v2/coupons/${encodeURIComponent(id)}`);
23
+ return wixCall("GET", `/stores/v2/coupons/${encodeURIComponent(id)}`, void 0, options);
16
24
  }
17
25
  function createCoupon(specification) {
18
26
  return wixCall("POST", "/stores/v2/coupons", { specification });
@@ -21,12 +21,26 @@ function wixCall(method, path, body, opts) {
21
21
  )
22
22
  );
23
23
  }
24
- return globalThis.himalaya.wixApi.call(
25
- method,
26
- path,
27
- body,
28
- wixCallHeaders(opts)
24
+ const api = globalThis.himalaya.wixApi;
25
+ const verb = method.toUpperCase();
26
+ const readShaped = verb === "GET" || verb === "HEAD" || verb === "POST" && /\/(query|query-cursor|search|list|count)(\?|$)/.test(
27
+ path.split("#")[0]
29
28
  );
29
+ if (readShaped && (opts?.cache || opts?.onCacheResult)) {
30
+ if (!api.read)
31
+ return Promise.reject(
32
+ new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime")
33
+ );
34
+ return api.read(method, path, body, wixCallHeaders(opts), {
35
+ cache: opts.cache ?? "default"
36
+ }).then((result) => {
37
+ opts.onCacheResult?.(result.cache);
38
+ return result.data;
39
+ });
40
+ }
41
+ if (opts?.cache === "only-if-cached")
42
+ return Promise.reject(new Error("OFFLINE_CACHE_MISS"));
43
+ return api.call(method, path, body, wixCallHeaders(opts));
30
44
  }
31
45
  function wixQueryPath(path, req) {
32
46
  const parts = [];
@@ -1,11 +1,19 @@
1
1
  // ../../stdlib/wix-sdk/wix-data/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(
5
5
  new Error("@himalaya/wix-data: host did not install the wixApi bridge")
6
6
  );
7
7
  }
8
- 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);
9
17
  }
10
18
  function queryDataItems(dataCollectionId, limit = 50, filter, returnTotalCount = false, offset = 0, sort, options) {
11
19
  if (!dataCollectionId) throw new Error("queryDataItems: dataCollectionId is required");
@@ -32,14 +40,16 @@ function queryDataItems(dataCollectionId, limit = 50, filter, returnTotalCount =
32
40
  ...options?.language ? { language: options.language } : {},
33
41
  ...options?.includeDraftItems ? { publishPluginOptions: { includeDraftItems: true } } : {}
34
42
  };
35
- return wixCall("POST", "/wix-data/v2/items/query", body);
43
+ return wixCall("POST", "/wix-data/v2/items/query", body, options);
36
44
  }
37
- function getDataItem(dataCollectionId, dataItemId) {
45
+ function getDataItem(dataCollectionId, dataItemId, options) {
38
46
  if (!dataCollectionId) throw new Error("getDataItem: dataCollectionId is required");
39
47
  if (!dataItemId) throw new Error("getDataItem: dataItemId is required");
40
48
  return wixCall(
41
49
  "GET",
42
- `/wix-data/v2/items/${encodeURIComponent(dataItemId)}?dataCollectionId=${encodeURIComponent(dataCollectionId)}`
50
+ `/wix-data/v2/items/${encodeURIComponent(dataItemId)}?dataCollectionId=${encodeURIComponent(dataCollectionId)}`,
51
+ void 0,
52
+ options
43
53
  );
44
54
  }
45
55
  function insertDataItem(dataCollectionId, data, options) {
@@ -11,12 +11,26 @@ function wixCall(method, path, body, opts) {
11
11
  )
12
12
  );
13
13
  }
14
- return globalThis.himalaya.wixApi.call(
15
- method,
16
- path,
17
- body,
18
- wixCallHeaders(opts)
14
+ const api = globalThis.himalaya.wixApi;
15
+ const verb = method.toUpperCase();
16
+ const readShaped = verb === "GET" || verb === "HEAD" || verb === "POST" && /\/(query|query-cursor|search|list|count)(\?|$)/.test(
17
+ path.split("#")[0]
19
18
  );
19
+ if (readShaped && (opts?.cache || opts?.onCacheResult)) {
20
+ if (!api.read)
21
+ return Promise.reject(
22
+ new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime")
23
+ );
24
+ return api.read(method, path, body, wixCallHeaders(opts), {
25
+ cache: opts.cache ?? "default"
26
+ }).then((result) => {
27
+ opts.onCacheResult?.(result.cache);
28
+ return result.data;
29
+ });
30
+ }
31
+ if (opts?.cache === "only-if-cached")
32
+ return Promise.reject(new Error("OFFLINE_CACHE_MISS"));
33
+ return api.call(method, path, body, wixCallHeaders(opts));
20
34
  }
21
35
  function createDonationCampaign(req = {}, opts) {
22
36
  return wixCall(
@@ -1,6 +1,6 @@
1
1
  // ../../stdlib/wix-sdk/ecom/src/extensions.ts
2
- function getOrder(orderId) {
3
- return wixCall("GET", `/ecom/v1/orders/${orderId}`);
2
+ function getOrder(orderId, options) {
3
+ return wixCall("GET", `/ecom/v1/orders/${orderId}`, void 0, options);
4
4
  }
5
5
  function archiveOrder(orderId) {
6
6
  return wixCall("POST", `/ecom/v1/orders/${orderId}/archive`, {});
@@ -67,12 +67,15 @@ function isOrdersForbiddenError(error) {
67
67
  const msg = error instanceof Error ? error.message : String(error ?? "");
68
68
  return /READ_ORDER_FORBIDDEN|read order:\s*permission denied/i.test(msg);
69
69
  }
70
- async function getCurrentCart() {
70
+ async function getCurrentCart(opts) {
71
71
  try {
72
- const r = await wixCall("GET", "/ecom/v1/carts/current");
72
+ const r = await wixCall("GET", "/ecom/v1/carts/current", void 0, opts);
73
73
  return r.cart ?? r;
74
74
  } catch (e) {
75
- if (isEmptyCurrentCartError(e)) return { lineItems: [] };
75
+ if (isEmptyCurrentCartError(e)) {
76
+ opts?.onCacheResult?.({ source: "network", fetchedAt: Date.now(), cacheable: false });
77
+ return { lineItems: [] };
78
+ }
76
79
  throw e;
77
80
  }
78
81
  }
@@ -135,11 +138,11 @@ function memberAddressFieldMask(patch) {
135
138
  walk(patch, "");
136
139
  return paths.join(",");
137
140
  }
138
- function listMemberAddresses() {
139
- return wixCall("GET", MEMBER_ADDRESSES_URL);
141
+ function listMemberAddresses(options) {
142
+ return wixCall("GET", MEMBER_ADDRESSES_URL, void 0, options);
140
143
  }
141
- function getMemberAddress(addressId) {
142
- return wixCall("GET", memberAddressUrl(addressId, "getMemberAddress"));
144
+ function getMemberAddress(addressId, options) {
145
+ return wixCall("GET", memberAddressUrl(addressId, "getMemberAddress"), void 0, options);
143
146
  }
144
147
  function getDefaultMemberAddress() {
145
148
  return wixCall("GET", `${MEMBER_ADDRESSES_URL}/get-default-address`);
@@ -172,11 +175,11 @@ function savedPaymentMethodPath(savedPaymentMethodId, fn) {
172
175
  if (!savedPaymentMethodId) throw new Error(`${fn}: savedPaymentMethodId is required`);
173
176
  return `${SAVED_PAYMENT_METHODS_PATH}/${encodeURIComponent(savedPaymentMethodId)}`;
174
177
  }
175
- function listMySavedPaymentMethods(opts = {}) {
178
+ function listMySavedPaymentMethods(opts = {}, options) {
176
179
  const query = ["siteMemberId=me"];
177
180
  if (opts.limit) query.push(`paging.limit=${Math.max(1, Math.min(100, Math.floor(opts.limit)))}`);
178
181
  if (opts.cursor) query.push(`paging.cursor=${encodeURIComponent(opts.cursor)}`);
179
- return wixCall("GET", `${SAVED_PAYMENT_METHODS_PATH}?${query.join("&")}`);
182
+ return wixCall("GET", `${SAVED_PAYMENT_METHODS_PATH}?${query.join("&")}`, void 0, options);
180
183
  }
181
184
  function deleteSavedPaymentMethod(savedPaymentMethodId) {
182
185
  return wixCall("DELETE", savedPaymentMethodPath(savedPaymentMethodId, "deleteSavedPaymentMethod"));
@@ -246,12 +249,26 @@ function wixCall(method, path, body, opts) {
246
249
  new Error("@himalaya/wix-ecom: host did not install the wixApi bridge")
247
250
  );
248
251
  }
249
- return globalThis.himalaya.wixApi.call(
250
- method,
251
- path,
252
- body,
253
- wixCallHeaders(opts)
252
+ const api = globalThis.himalaya.wixApi;
253
+ const verb = method.toUpperCase();
254
+ const readShaped = verb === "GET" || verb === "HEAD" || verb === "POST" && /\/(query|query-cursor|search|list|count)(\?|$)/.test(
255
+ path.split("#")[0]
254
256
  );
257
+ if (readShaped && (opts?.cache || opts?.onCacheResult)) {
258
+ if (!api.read)
259
+ return Promise.reject(
260
+ new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime")
261
+ );
262
+ return api.read(method, path, body, wixCallHeaders(opts), {
263
+ cache: opts.cache ?? "default"
264
+ }).then((result) => {
265
+ opts.onCacheResult?.(result.cache);
266
+ return result.data;
267
+ });
268
+ }
269
+ if (opts?.cache === "only-if-cached")
270
+ return Promise.reject(new Error("OFFLINE_CACHE_MISS"));
271
+ return api.call(method, path, body, wixCallHeaders(opts));
255
272
  }
256
273
  function searchOrders(req = {}, opts) {
257
274
  return wixCall(
@@ -11,12 +11,26 @@ function wixCall(method, path, body, opts) {
11
11
  )
12
12
  );
13
13
  }
14
- return globalThis.himalaya.wixApi.call(
15
- method,
16
- path,
17
- body,
18
- wixCallHeaders(opts)
14
+ const api = globalThis.himalaya.wixApi;
15
+ const verb = method.toUpperCase();
16
+ const readShaped = verb === "GET" || verb === "HEAD" || verb === "POST" && /\/(query|query-cursor|search|list|count)(\?|$)/.test(
17
+ path.split("#")[0]
19
18
  );
19
+ if (readShaped && (opts?.cache || opts?.onCacheResult)) {
20
+ if (!api.read)
21
+ return Promise.reject(
22
+ new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime")
23
+ );
24
+ return api.read(method, path, body, wixCallHeaders(opts), {
25
+ cache: opts.cache ?? "default"
26
+ }).then((result) => {
27
+ opts.onCacheResult?.(result.cache);
28
+ return result.data;
29
+ });
30
+ }
31
+ if (opts?.cache === "only-if-cached")
32
+ return Promise.reject(new Error("OFFLINE_CACHE_MISS"));
33
+ return api.call(method, path, body, wixCallHeaders(opts));
20
34
  }
21
35
  function wixQueryPath(path, req) {
22
36
  const parts = [];
@@ -258,11 +258,19 @@ function eventDescription(e) {
258
258
  }
259
259
 
260
260
  // ../../stdlib/wix-sdk/events/src/index.ts
261
- function wixCall(method, path, body) {
261
+ function wixCall(method, path, body, readOptions) {
262
262
  if (!globalThis.himalaya?.wixApi) {
263
263
  return Promise.reject(new Error("@himalaya/wix-events: host did not install the wixApi bridge"));
264
264
  }
265
- return globalThis.himalaya.wixApi.call(method, path, body);
265
+ const api = globalThis.himalaya.wixApi;
266
+ if (readOptions?.cache || readOptions?.onCacheResult) {
267
+ if (!api.read) return Promise.reject(new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime"));
268
+ return api.read(method, path, body, readOptions.site ? { "wix-site-id": readOptions.site } : void 0, { cache: readOptions.cache ?? "default" }).then((result) => {
269
+ readOptions.onCacheResult?.(result.cache);
270
+ return result.data;
271
+ });
272
+ }
273
+ return readOptions?.site ? api.call(method, path, body, { "wix-site-id": readOptions.site }) : api.call(method, path, body);
266
274
  }
267
275
  var BASE = "https://manage.wix.com/_api/wix-one-events-server/events-in-clubs";
268
276
  var EVENT_STATUSES = Object.freeze(["UPCOMING", "STARTED", "ENDED", "CANCELED", "DRAFT"]);
@@ -287,10 +295,10 @@ function eventStartMs(e) {
287
295
  const ms = s ? new Date(s).getTime() : NaN;
288
296
  return Number.isNaN(ms) ? Number.POSITIVE_INFINITY : ms;
289
297
  }
290
- async function queryEvents(opts = {}) {
298
+ async function queryEvents(opts = {}, readOptions) {
291
299
  const limit = opts.limit ?? opts.query?.paging?.limit ?? 50;
292
300
  const offset = opts.offset ?? opts.query?.paging?.offset ?? 0;
293
- const res = await wixCall("POST", "/events/v3/events/query", { query: { ...opts.query, paging: { limit, offset } } });
301
+ const res = await wixCall("POST", "/events/v3/events/query", { query: { ...opts.query, paging: { limit, offset } } }, readOptions);
294
302
  let events = (res.events ?? []).map(decodeEvent);
295
303
  if (opts.statuses) {
296
304
  const wanted = new Set(opts.statuses);
@@ -304,11 +312,11 @@ async function queryEvents(opts = {}) {
304
312
  if (opts.order === "start") events = events.slice().sort((a, b) => eventStartMs(a) - eventStartMs(b));
305
313
  return { ...res, events };
306
314
  }
307
- async function getEvent(eventId, opts = {}) {
315
+ async function getEvent(eventId, opts = {}, readOptions) {
308
316
  if (!eventId) throw new Error("getEvent: eventId is required");
309
317
  const fields = (opts.fields ?? []).map((f) => `fields=${encodeURIComponent(f)}`).join("&");
310
318
  const query = fields ? `?${fields}` : "";
311
- const res = await wixCall("GET", `/events/v3/events/${encodeURIComponent(eventId)}${query}`);
319
+ const res = await wixCall("GET", `/events/v3/events/${encodeURIComponent(eventId)}${query}`, void 0, readOptions);
312
320
  return { ...res, event: decodeEvent(res.event) };
313
321
  }
314
322
  function deleteEvent(eventId) {
@@ -9,12 +9,26 @@ function wixCall(method, path, body, opts) {
9
9
  new Error("@himalaya/wix-faq-v2: 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)
17
- );
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]
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 = [];
@@ -9,12 +9,26 @@ function wixCall(method, path, body, opts) {
9
9
  new Error("@himalaya/wix-forms: 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 queryForms(req, opts) {
20
34
  if (req?.filter?.["namespace"] == null || req?.filter?.["namespace"] === "")
@@ -92,12 +92,26 @@ function wixCall(method, path, body, opts) {
92
92
  new Error("@himalaya/wix-forum: host did not install the wixApi bridge")
93
93
  );
94
94
  }
95
- return globalThis.himalaya.wixApi.call(
96
- method,
97
- path,
98
- body,
99
- wixCallHeaders(opts)
95
+ const api = globalThis.himalaya.wixApi;
96
+ const verb = method.toUpperCase();
97
+ const readShaped = verb === "GET" || verb === "HEAD" || verb === "POST" && /\/(query|query-cursor|search|list|count)(\?|$)/.test(
98
+ path.split("#")[0]
100
99
  );
100
+ if (readShaped && (opts?.cache || opts?.onCacheResult)) {
101
+ if (!api.read)
102
+ return Promise.reject(
103
+ new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime")
104
+ );
105
+ return api.read(method, path, body, wixCallHeaders(opts), {
106
+ cache: opts.cache ?? "default"
107
+ }).then((result) => {
108
+ opts.onCacheResult?.(result.cache);
109
+ return result.data;
110
+ });
111
+ }
112
+ if (opts?.cache === "only-if-cached")
113
+ return Promise.reject(new Error("OFFLINE_CACHE_MISS"));
114
+ return api.call(method, path, body, wixCallHeaders(opts));
101
115
  }
102
116
  function queryPosts(req = {}, opts) {
103
117
  return wixCall(
@@ -11,12 +11,26 @@ function wixCall(method, path, body, opts) {
11
11
  )
12
12
  );
13
13
  }
14
- return globalThis.himalaya.wixApi.call(
15
- method,
16
- path,
17
- body,
18
- wixCallHeaders(opts)
14
+ const api = globalThis.himalaya.wixApi;
15
+ const verb = method.toUpperCase();
16
+ const readShaped = verb === "GET" || verb === "HEAD" || verb === "POST" && /\/(query|query-cursor|search|list|count)(\?|$)/.test(
17
+ path.split("#")[0]
19
18
  );
19
+ if (readShaped && (opts?.cache || opts?.onCacheResult)) {
20
+ if (!api.read)
21
+ return Promise.reject(
22
+ new Error("READ_LIFECYCLE_UNSUPPORTED: update the Himalaya runtime")
23
+ );
24
+ return api.read(method, path, body, wixCallHeaders(opts), {
25
+ cache: opts.cache ?? "default"
26
+ }).then((result) => {
27
+ opts.onCacheResult?.(result.cache);
28
+ return result.data;
29
+ });
30
+ }
31
+ if (opts?.cache === "only-if-cached")
32
+ return Promise.reject(new Error("OFFLINE_CACHE_MISS"));
33
+ return api.call(method, path, body, wixCallHeaders(opts));
20
34
  }
21
35
  function wixQueryPath(path, req) {
22
36
  const parts = [];