@shopify/hydrogen-react 2025.1.2 → 2025.1.4

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 (480) hide show
  1. package/dist/browser-dev/AddToCartButton.mjs.map +1 -1
  2. package/dist/browser-dev/BaseButton.mjs.map +1 -1
  3. package/dist/browser-dev/BuyNowButton.mjs.map +1 -1
  4. package/dist/browser-dev/CartCheckoutButton.mjs.map +1 -1
  5. package/dist/browser-dev/CartCost.mjs.map +1 -1
  6. package/dist/browser-dev/CartLineProvider.mjs.map +1 -1
  7. package/dist/browser-dev/CartLineQuantity.mjs.map +1 -1
  8. package/dist/browser-dev/CartLineQuantityAdjustButton.mjs.map +1 -1
  9. package/dist/browser-dev/CartProvider.mjs +4 -7
  10. package/dist/browser-dev/CartProvider.mjs.map +1 -1
  11. package/dist/browser-dev/ExternalVideo.mjs.map +1 -1
  12. package/dist/browser-dev/Image.mjs +2 -4
  13. package/dist/browser-dev/Image.mjs.map +1 -1
  14. package/dist/browser-dev/MediaFile.mjs.map +1 -1
  15. package/dist/browser-dev/ModelViewer.mjs.map +1 -1
  16. package/dist/browser-dev/Money.mjs.map +1 -1
  17. package/dist/browser-dev/ProductPrice.mjs.map +1 -1
  18. package/dist/browser-dev/ProductProvider.mjs +15 -12
  19. package/dist/browser-dev/ProductProvider.mjs.map +1 -1
  20. package/dist/browser-dev/RichText.components.mjs +2 -4
  21. package/dist/browser-dev/RichText.components.mjs.map +1 -1
  22. package/dist/browser-dev/RichText.mjs.map +1 -1
  23. package/dist/browser-dev/ShopPayButton.mjs.map +1 -1
  24. package/dist/browser-dev/ShopifyProvider.mjs +19 -2
  25. package/dist/browser-dev/ShopifyProvider.mjs.map +1 -1
  26. package/dist/browser-dev/Video.mjs.map +1 -1
  27. package/dist/browser-dev/_virtual/with-selector.mjs +3 -2
  28. package/dist/browser-dev/_virtual/with-selector.mjs.map +1 -1
  29. package/dist/browser-dev/_virtual/with-selector2.mjs +5 -0
  30. package/dist/browser-dev/_virtual/with-selector2.mjs.map +1 -0
  31. package/dist/browser-dev/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
  32. package/dist/browser-dev/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -1
  33. package/dist/browser-dev/analytics-utils.mjs.map +1 -1
  34. package/dist/browser-dev/analytics.mjs +6 -9
  35. package/dist/browser-dev/analytics.mjs.map +1 -1
  36. package/dist/browser-dev/cart-hooks.mjs +25 -7
  37. package/dist/browser-dev/cart-hooks.mjs.map +1 -1
  38. package/dist/browser-dev/cookies-utils.mjs +5 -5
  39. package/dist/browser-dev/cookies-utils.mjs.map +1 -1
  40. package/dist/browser-dev/flatten-connection.mjs.map +1 -1
  41. package/dist/browser-dev/getProductOptions.mjs +2 -4
  42. package/dist/browser-dev/getProductOptions.mjs.map +1 -1
  43. package/dist/browser-dev/index.mjs +4 -0
  44. package/dist/browser-dev/index.mjs.map +1 -1
  45. package/dist/browser-dev/load-script.mjs.map +1 -1
  46. package/dist/browser-dev/node_modules/@xstate/fsm/es/index.mjs +10 -18
  47. package/dist/browser-dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
  48. package/dist/browser-dev/node_modules/@xstate/react/es/fsm.mjs +5 -9
  49. package/dist/browser-dev/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
  50. package/dist/browser-dev/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
  51. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs +1 -2
  52. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
  53. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs +5 -10
  54. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
  55. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs +1 -2
  56. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
  57. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs +1 -2
  58. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
  59. package/dist/browser-dev/node_modules/use-sync-external-store/shim/index.mjs +1 -2
  60. package/dist/browser-dev/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
  61. package/dist/browser-dev/node_modules/use-sync-external-store/shim/with-selector.mjs +12 -7
  62. package/dist/browser-dev/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
  63. package/dist/browser-dev/optionValueDecoder.mjs +1 -2
  64. package/dist/browser-dev/optionValueDecoder.mjs.map +1 -1
  65. package/dist/browser-dev/packages/hydrogen-react/package.json.mjs +1 -1
  66. package/dist/browser-dev/parse-metafield.mjs +2 -2
  67. package/dist/browser-dev/parse-metafield.mjs.map +1 -1
  68. package/dist/browser-dev/storefront-client.mjs +1 -2
  69. package/dist/browser-dev/storefront-client.mjs.map +1 -1
  70. package/dist/browser-dev/tracking-utils.mjs +88 -0
  71. package/dist/browser-dev/tracking-utils.mjs.map +1 -0
  72. package/dist/browser-dev/useCartAPIStateMachine.mjs +6 -12
  73. package/dist/browser-dev/useCartAPIStateMachine.mjs.map +1 -1
  74. package/dist/browser-dev/useCartActions.mjs.map +1 -1
  75. package/dist/browser-dev/useMoney.mjs.map +1 -1
  76. package/dist/browser-dev/useSelectedOptionInUrlParam.mjs.map +1 -1
  77. package/dist/browser-dev/useShopifyCookies.mjs +97 -11
  78. package/dist/browser-dev/useShopifyCookies.mjs.map +1 -1
  79. package/dist/browser-prod/AddToCartButton.mjs.map +1 -1
  80. package/dist/browser-prod/BaseButton.mjs.map +1 -1
  81. package/dist/browser-prod/BuyNowButton.mjs.map +1 -1
  82. package/dist/browser-prod/CartCheckoutButton.mjs.map +1 -1
  83. package/dist/browser-prod/CartCost.mjs.map +1 -1
  84. package/dist/browser-prod/CartLineProvider.mjs.map +1 -1
  85. package/dist/browser-prod/CartLineQuantity.mjs.map +1 -1
  86. package/dist/browser-prod/CartLineQuantityAdjustButton.mjs.map +1 -1
  87. package/dist/browser-prod/CartProvider.mjs +4 -7
  88. package/dist/browser-prod/CartProvider.mjs.map +1 -1
  89. package/dist/browser-prod/ExternalVideo.mjs.map +1 -1
  90. package/dist/browser-prod/Image.mjs +2 -4
  91. package/dist/browser-prod/Image.mjs.map +1 -1
  92. package/dist/browser-prod/MediaFile.mjs.map +1 -1
  93. package/dist/browser-prod/ModelViewer.mjs.map +1 -1
  94. package/dist/browser-prod/Money.mjs.map +1 -1
  95. package/dist/browser-prod/ProductPrice.mjs.map +1 -1
  96. package/dist/browser-prod/ProductProvider.mjs +15 -12
  97. package/dist/browser-prod/ProductProvider.mjs.map +1 -1
  98. package/dist/browser-prod/RichText.components.mjs +2 -4
  99. package/dist/browser-prod/RichText.components.mjs.map +1 -1
  100. package/dist/browser-prod/RichText.mjs.map +1 -1
  101. package/dist/browser-prod/ShopPayButton.mjs.map +1 -1
  102. package/dist/browser-prod/ShopifyProvider.mjs +19 -2
  103. package/dist/browser-prod/ShopifyProvider.mjs.map +1 -1
  104. package/dist/browser-prod/Video.mjs.map +1 -1
  105. package/dist/browser-prod/_virtual/with-selector.mjs +3 -2
  106. package/dist/browser-prod/_virtual/with-selector.mjs.map +1 -1
  107. package/dist/browser-prod/_virtual/with-selector2.mjs +5 -0
  108. package/dist/browser-prod/_virtual/with-selector2.mjs.map +1 -0
  109. package/dist/browser-prod/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
  110. package/dist/browser-prod/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -1
  111. package/dist/browser-prod/analytics-utils.mjs.map +1 -1
  112. package/dist/browser-prod/analytics.mjs +7 -11
  113. package/dist/browser-prod/analytics.mjs.map +1 -1
  114. package/dist/browser-prod/cart-hooks.mjs +25 -7
  115. package/dist/browser-prod/cart-hooks.mjs.map +1 -1
  116. package/dist/browser-prod/cookies-utils.mjs +5 -5
  117. package/dist/browser-prod/cookies-utils.mjs.map +1 -1
  118. package/dist/browser-prod/flatten-connection.mjs.map +1 -1
  119. package/dist/browser-prod/getProductOptions.mjs +2 -4
  120. package/dist/browser-prod/getProductOptions.mjs.map +1 -1
  121. package/dist/browser-prod/index.mjs +4 -0
  122. package/dist/browser-prod/index.mjs.map +1 -1
  123. package/dist/browser-prod/load-script.mjs.map +1 -1
  124. package/dist/browser-prod/node_modules/@xstate/fsm/es/index.mjs +10 -18
  125. package/dist/browser-prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
  126. package/dist/browser-prod/node_modules/@xstate/react/es/fsm.mjs +5 -9
  127. package/dist/browser-prod/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
  128. package/dist/browser-prod/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
  129. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs +1 -2
  130. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
  131. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs +5 -10
  132. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
  133. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs +1 -2
  134. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
  135. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs +1 -2
  136. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
  137. package/dist/browser-prod/node_modules/use-sync-external-store/shim/index.mjs +1 -2
  138. package/dist/browser-prod/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
  139. package/dist/browser-prod/node_modules/use-sync-external-store/shim/with-selector.mjs +12 -7
  140. package/dist/browser-prod/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
  141. package/dist/browser-prod/optionValueDecoder.mjs +1 -2
  142. package/dist/browser-prod/optionValueDecoder.mjs.map +1 -1
  143. package/dist/browser-prod/packages/hydrogen-react/package.json.mjs +1 -1
  144. package/dist/browser-prod/parse-metafield.mjs +2 -2
  145. package/dist/browser-prod/parse-metafield.mjs.map +1 -1
  146. package/dist/browser-prod/storefront-client.mjs +1 -2
  147. package/dist/browser-prod/storefront-client.mjs.map +1 -1
  148. package/dist/browser-prod/tracking-utils.mjs +88 -0
  149. package/dist/browser-prod/tracking-utils.mjs.map +1 -0
  150. package/dist/browser-prod/useCartAPIStateMachine.mjs +6 -12
  151. package/dist/browser-prod/useCartAPIStateMachine.mjs.map +1 -1
  152. package/dist/browser-prod/useCartActions.mjs.map +1 -1
  153. package/dist/browser-prod/useMoney.mjs.map +1 -1
  154. package/dist/browser-prod/useSelectedOptionInUrlParam.mjs.map +1 -1
  155. package/dist/browser-prod/useShopifyCookies.mjs +97 -11
  156. package/dist/browser-prod/useShopifyCookies.mjs.map +1 -1
  157. package/dist/node-dev/AddToCartButton.js.map +1 -1
  158. package/dist/node-dev/AddToCartButton.mjs.map +1 -1
  159. package/dist/node-dev/BaseButton.js.map +1 -1
  160. package/dist/node-dev/BaseButton.mjs.map +1 -1
  161. package/dist/node-dev/BuyNowButton.js.map +1 -1
  162. package/dist/node-dev/BuyNowButton.mjs.map +1 -1
  163. package/dist/node-dev/CartCheckoutButton.js.map +1 -1
  164. package/dist/node-dev/CartCheckoutButton.mjs.map +1 -1
  165. package/dist/node-dev/CartCost.js.map +1 -1
  166. package/dist/node-dev/CartCost.mjs.map +1 -1
  167. package/dist/node-dev/CartLineProvider.js.map +1 -1
  168. package/dist/node-dev/CartLineProvider.mjs.map +1 -1
  169. package/dist/node-dev/CartLineQuantity.js.map +1 -1
  170. package/dist/node-dev/CartLineQuantity.mjs.map +1 -1
  171. package/dist/node-dev/CartLineQuantityAdjustButton.js.map +1 -1
  172. package/dist/node-dev/CartLineQuantityAdjustButton.mjs.map +1 -1
  173. package/dist/node-dev/CartProvider.js +3 -6
  174. package/dist/node-dev/CartProvider.js.map +1 -1
  175. package/dist/node-dev/CartProvider.mjs +4 -7
  176. package/dist/node-dev/CartProvider.mjs.map +1 -1
  177. package/dist/node-dev/ExternalVideo.js.map +1 -1
  178. package/dist/node-dev/ExternalVideo.mjs.map +1 -1
  179. package/dist/node-dev/Image.js +2 -4
  180. package/dist/node-dev/Image.js.map +1 -1
  181. package/dist/node-dev/Image.mjs +2 -4
  182. package/dist/node-dev/Image.mjs.map +1 -1
  183. package/dist/node-dev/MediaFile.js.map +1 -1
  184. package/dist/node-dev/MediaFile.mjs.map +1 -1
  185. package/dist/node-dev/ModelViewer.js.map +1 -1
  186. package/dist/node-dev/ModelViewer.mjs.map +1 -1
  187. package/dist/node-dev/Money.js.map +1 -1
  188. package/dist/node-dev/Money.mjs.map +1 -1
  189. package/dist/node-dev/ProductPrice.js.map +1 -1
  190. package/dist/node-dev/ProductPrice.mjs.map +1 -1
  191. package/dist/node-dev/ProductProvider.js +14 -11
  192. package/dist/node-dev/ProductProvider.js.map +1 -1
  193. package/dist/node-dev/ProductProvider.mjs +15 -12
  194. package/dist/node-dev/ProductProvider.mjs.map +1 -1
  195. package/dist/node-dev/RichText.components.js +2 -4
  196. package/dist/node-dev/RichText.components.js.map +1 -1
  197. package/dist/node-dev/RichText.components.mjs +2 -4
  198. package/dist/node-dev/RichText.components.mjs.map +1 -1
  199. package/dist/node-dev/RichText.js.map +1 -1
  200. package/dist/node-dev/RichText.mjs.map +1 -1
  201. package/dist/node-dev/ShopPayButton.js.map +1 -1
  202. package/dist/node-dev/ShopPayButton.mjs.map +1 -1
  203. package/dist/node-dev/ShopifyProvider.js +18 -1
  204. package/dist/node-dev/ShopifyProvider.js.map +1 -1
  205. package/dist/node-dev/ShopifyProvider.mjs +19 -2
  206. package/dist/node-dev/ShopifyProvider.mjs.map +1 -1
  207. package/dist/node-dev/Video.js.map +1 -1
  208. package/dist/node-dev/Video.mjs.map +1 -1
  209. package/dist/node-dev/_virtual/with-selector.js +3 -2
  210. package/dist/node-dev/_virtual/with-selector.js.map +1 -1
  211. package/dist/node-dev/_virtual/with-selector.mjs +3 -2
  212. package/dist/node-dev/_virtual/with-selector.mjs.map +1 -1
  213. package/dist/node-dev/_virtual/with-selector2.js +5 -0
  214. package/dist/node-dev/_virtual/with-selector2.js.map +1 -0
  215. package/dist/node-dev/_virtual/with-selector2.mjs +5 -0
  216. package/dist/node-dev/_virtual/with-selector2.mjs.map +1 -0
  217. package/dist/node-dev/analytics-schema-custom-storefront-customer-tracking.js.map +1 -1
  218. package/dist/node-dev/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
  219. package/dist/node-dev/analytics-schema-trekkie-storefront-page-view.js.map +1 -1
  220. package/dist/node-dev/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -1
  221. package/dist/node-dev/analytics-utils.js.map +1 -1
  222. package/dist/node-dev/analytics-utils.mjs.map +1 -1
  223. package/dist/node-dev/analytics.js +6 -9
  224. package/dist/node-dev/analytics.js.map +1 -1
  225. package/dist/node-dev/analytics.mjs +6 -9
  226. package/dist/node-dev/analytics.mjs.map +1 -1
  227. package/dist/node-dev/cart-hooks.js +24 -6
  228. package/dist/node-dev/cart-hooks.js.map +1 -1
  229. package/dist/node-dev/cart-hooks.mjs +25 -7
  230. package/dist/node-dev/cart-hooks.mjs.map +1 -1
  231. package/dist/node-dev/cookies-utils.js +4 -4
  232. package/dist/node-dev/cookies-utils.js.map +1 -1
  233. package/dist/node-dev/cookies-utils.mjs +5 -5
  234. package/dist/node-dev/cookies-utils.mjs.map +1 -1
  235. package/dist/node-dev/flatten-connection.js.map +1 -1
  236. package/dist/node-dev/flatten-connection.mjs.map +1 -1
  237. package/dist/node-dev/getProductOptions.js +2 -4
  238. package/dist/node-dev/getProductOptions.js.map +1 -1
  239. package/dist/node-dev/getProductOptions.mjs +2 -4
  240. package/dist/node-dev/getProductOptions.mjs.map +1 -1
  241. package/dist/node-dev/index.js +4 -0
  242. package/dist/node-dev/index.js.map +1 -1
  243. package/dist/node-dev/index.mjs +4 -0
  244. package/dist/node-dev/index.mjs.map +1 -1
  245. package/dist/node-dev/load-script.js.map +1 -1
  246. package/dist/node-dev/load-script.mjs.map +1 -1
  247. package/dist/node-dev/node_modules/@xstate/fsm/es/index.js +10 -18
  248. package/dist/node-dev/node_modules/@xstate/fsm/es/index.js.map +1 -1
  249. package/dist/node-dev/node_modules/@xstate/fsm/es/index.mjs +10 -18
  250. package/dist/node-dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
  251. package/dist/node-dev/node_modules/@xstate/react/es/fsm.js +5 -9
  252. package/dist/node-dev/node_modules/@xstate/react/es/fsm.js.map +1 -1
  253. package/dist/node-dev/node_modules/@xstate/react/es/fsm.mjs +5 -9
  254. package/dist/node-dev/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
  255. package/dist/node-dev/node_modules/@xstate/react/es/useConstant.js.map +1 -1
  256. package/dist/node-dev/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
  257. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +1 -2
  258. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
  259. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs +1 -2
  260. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
  261. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +5 -10
  262. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
  263. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs +5 -10
  264. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
  265. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +1 -2
  266. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
  267. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs +1 -2
  268. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
  269. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +1 -2
  270. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
  271. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs +1 -2
  272. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
  273. package/dist/node-dev/node_modules/use-sync-external-store/shim/index.js +1 -2
  274. package/dist/node-dev/node_modules/use-sync-external-store/shim/index.js.map +1 -1
  275. package/dist/node-dev/node_modules/use-sync-external-store/shim/index.mjs +1 -2
  276. package/dist/node-dev/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
  277. package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.js +12 -7
  278. package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
  279. package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.mjs +12 -7
  280. package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
  281. package/dist/node-dev/optionValueDecoder.js +1 -2
  282. package/dist/node-dev/optionValueDecoder.js.map +1 -1
  283. package/dist/node-dev/optionValueDecoder.mjs +1 -2
  284. package/dist/node-dev/optionValueDecoder.mjs.map +1 -1
  285. package/dist/node-dev/packages/hydrogen-react/package.json.js +1 -1
  286. package/dist/node-dev/packages/hydrogen-react/package.json.mjs +1 -1
  287. package/dist/node-dev/parse-metafield.js +2 -2
  288. package/dist/node-dev/parse-metafield.js.map +1 -1
  289. package/dist/node-dev/parse-metafield.mjs +2 -2
  290. package/dist/node-dev/parse-metafield.mjs.map +1 -1
  291. package/dist/node-dev/storefront-client.js +1 -2
  292. package/dist/node-dev/storefront-client.js.map +1 -1
  293. package/dist/node-dev/storefront-client.mjs +1 -2
  294. package/dist/node-dev/storefront-client.mjs.map +1 -1
  295. package/dist/node-dev/tracking-utils.js +88 -0
  296. package/dist/node-dev/tracking-utils.js.map +1 -0
  297. package/dist/node-dev/tracking-utils.mjs +88 -0
  298. package/dist/node-dev/tracking-utils.mjs.map +1 -0
  299. package/dist/node-dev/useCartAPIStateMachine.js +6 -12
  300. package/dist/node-dev/useCartAPIStateMachine.js.map +1 -1
  301. package/dist/node-dev/useCartAPIStateMachine.mjs +6 -12
  302. package/dist/node-dev/useCartAPIStateMachine.mjs.map +1 -1
  303. package/dist/node-dev/useCartActions.js.map +1 -1
  304. package/dist/node-dev/useCartActions.mjs.map +1 -1
  305. package/dist/node-dev/useMoney.js.map +1 -1
  306. package/dist/node-dev/useMoney.mjs.map +1 -1
  307. package/dist/node-dev/useSelectedOptionInUrlParam.js.map +1 -1
  308. package/dist/node-dev/useSelectedOptionInUrlParam.mjs.map +1 -1
  309. package/dist/node-dev/useShopifyCookies.js +95 -9
  310. package/dist/node-dev/useShopifyCookies.js.map +1 -1
  311. package/dist/node-dev/useShopifyCookies.mjs +97 -11
  312. package/dist/node-dev/useShopifyCookies.mjs.map +1 -1
  313. package/dist/node-prod/AddToCartButton.js.map +1 -1
  314. package/dist/node-prod/AddToCartButton.mjs.map +1 -1
  315. package/dist/node-prod/BaseButton.js.map +1 -1
  316. package/dist/node-prod/BaseButton.mjs.map +1 -1
  317. package/dist/node-prod/BuyNowButton.js.map +1 -1
  318. package/dist/node-prod/BuyNowButton.mjs.map +1 -1
  319. package/dist/node-prod/CartCheckoutButton.js.map +1 -1
  320. package/dist/node-prod/CartCheckoutButton.mjs.map +1 -1
  321. package/dist/node-prod/CartCost.js.map +1 -1
  322. package/dist/node-prod/CartCost.mjs.map +1 -1
  323. package/dist/node-prod/CartLineProvider.js.map +1 -1
  324. package/dist/node-prod/CartLineProvider.mjs.map +1 -1
  325. package/dist/node-prod/CartLineQuantity.js.map +1 -1
  326. package/dist/node-prod/CartLineQuantity.mjs.map +1 -1
  327. package/dist/node-prod/CartLineQuantityAdjustButton.js.map +1 -1
  328. package/dist/node-prod/CartLineQuantityAdjustButton.mjs.map +1 -1
  329. package/dist/node-prod/CartProvider.js +3 -6
  330. package/dist/node-prod/CartProvider.js.map +1 -1
  331. package/dist/node-prod/CartProvider.mjs +4 -7
  332. package/dist/node-prod/CartProvider.mjs.map +1 -1
  333. package/dist/node-prod/ExternalVideo.js.map +1 -1
  334. package/dist/node-prod/ExternalVideo.mjs.map +1 -1
  335. package/dist/node-prod/Image.js +2 -4
  336. package/dist/node-prod/Image.js.map +1 -1
  337. package/dist/node-prod/Image.mjs +2 -4
  338. package/dist/node-prod/Image.mjs.map +1 -1
  339. package/dist/node-prod/MediaFile.js.map +1 -1
  340. package/dist/node-prod/MediaFile.mjs.map +1 -1
  341. package/dist/node-prod/ModelViewer.js.map +1 -1
  342. package/dist/node-prod/ModelViewer.mjs.map +1 -1
  343. package/dist/node-prod/Money.js.map +1 -1
  344. package/dist/node-prod/Money.mjs.map +1 -1
  345. package/dist/node-prod/ProductPrice.js.map +1 -1
  346. package/dist/node-prod/ProductPrice.mjs.map +1 -1
  347. package/dist/node-prod/ProductProvider.js +14 -11
  348. package/dist/node-prod/ProductProvider.js.map +1 -1
  349. package/dist/node-prod/ProductProvider.mjs +15 -12
  350. package/dist/node-prod/ProductProvider.mjs.map +1 -1
  351. package/dist/node-prod/RichText.components.js +2 -4
  352. package/dist/node-prod/RichText.components.js.map +1 -1
  353. package/dist/node-prod/RichText.components.mjs +2 -4
  354. package/dist/node-prod/RichText.components.mjs.map +1 -1
  355. package/dist/node-prod/RichText.js.map +1 -1
  356. package/dist/node-prod/RichText.mjs.map +1 -1
  357. package/dist/node-prod/ShopPayButton.js.map +1 -1
  358. package/dist/node-prod/ShopPayButton.mjs.map +1 -1
  359. package/dist/node-prod/ShopifyProvider.js +18 -1
  360. package/dist/node-prod/ShopifyProvider.js.map +1 -1
  361. package/dist/node-prod/ShopifyProvider.mjs +19 -2
  362. package/dist/node-prod/ShopifyProvider.mjs.map +1 -1
  363. package/dist/node-prod/Video.js.map +1 -1
  364. package/dist/node-prod/Video.mjs.map +1 -1
  365. package/dist/node-prod/_virtual/with-selector.js +3 -2
  366. package/dist/node-prod/_virtual/with-selector.js.map +1 -1
  367. package/dist/node-prod/_virtual/with-selector.mjs +3 -2
  368. package/dist/node-prod/_virtual/with-selector.mjs.map +1 -1
  369. package/dist/node-prod/_virtual/with-selector2.js +5 -0
  370. package/dist/node-prod/_virtual/with-selector2.js.map +1 -0
  371. package/dist/node-prod/_virtual/with-selector2.mjs +5 -0
  372. package/dist/node-prod/_virtual/with-selector2.mjs.map +1 -0
  373. package/dist/node-prod/analytics-schema-custom-storefront-customer-tracking.js.map +1 -1
  374. package/dist/node-prod/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
  375. package/dist/node-prod/analytics-schema-trekkie-storefront-page-view.js.map +1 -1
  376. package/dist/node-prod/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -1
  377. package/dist/node-prod/analytics-utils.js.map +1 -1
  378. package/dist/node-prod/analytics-utils.mjs.map +1 -1
  379. package/dist/node-prod/analytics.js +7 -11
  380. package/dist/node-prod/analytics.js.map +1 -1
  381. package/dist/node-prod/analytics.mjs +7 -11
  382. package/dist/node-prod/analytics.mjs.map +1 -1
  383. package/dist/node-prod/cart-hooks.js +24 -6
  384. package/dist/node-prod/cart-hooks.js.map +1 -1
  385. package/dist/node-prod/cart-hooks.mjs +25 -7
  386. package/dist/node-prod/cart-hooks.mjs.map +1 -1
  387. package/dist/node-prod/cookies-utils.js +4 -4
  388. package/dist/node-prod/cookies-utils.js.map +1 -1
  389. package/dist/node-prod/cookies-utils.mjs +5 -5
  390. package/dist/node-prod/cookies-utils.mjs.map +1 -1
  391. package/dist/node-prod/flatten-connection.js.map +1 -1
  392. package/dist/node-prod/flatten-connection.mjs.map +1 -1
  393. package/dist/node-prod/getProductOptions.js +2 -4
  394. package/dist/node-prod/getProductOptions.js.map +1 -1
  395. package/dist/node-prod/getProductOptions.mjs +2 -4
  396. package/dist/node-prod/getProductOptions.mjs.map +1 -1
  397. package/dist/node-prod/index.js +4 -0
  398. package/dist/node-prod/index.js.map +1 -1
  399. package/dist/node-prod/index.mjs +4 -0
  400. package/dist/node-prod/index.mjs.map +1 -1
  401. package/dist/node-prod/load-script.js.map +1 -1
  402. package/dist/node-prod/load-script.mjs.map +1 -1
  403. package/dist/node-prod/node_modules/@xstate/fsm/es/index.js +10 -18
  404. package/dist/node-prod/node_modules/@xstate/fsm/es/index.js.map +1 -1
  405. package/dist/node-prod/node_modules/@xstate/fsm/es/index.mjs +10 -18
  406. package/dist/node-prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
  407. package/dist/node-prod/node_modules/@xstate/react/es/fsm.js +5 -9
  408. package/dist/node-prod/node_modules/@xstate/react/es/fsm.js.map +1 -1
  409. package/dist/node-prod/node_modules/@xstate/react/es/fsm.mjs +5 -9
  410. package/dist/node-prod/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
  411. package/dist/node-prod/node_modules/@xstate/react/es/useConstant.js.map +1 -1
  412. package/dist/node-prod/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
  413. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +1 -2
  414. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
  415. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs +1 -2
  416. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
  417. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +5 -10
  418. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
  419. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs +5 -10
  420. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
  421. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +1 -2
  422. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
  423. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs +1 -2
  424. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
  425. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +1 -2
  426. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
  427. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs +1 -2
  428. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
  429. package/dist/node-prod/node_modules/use-sync-external-store/shim/index.js +1 -2
  430. package/dist/node-prod/node_modules/use-sync-external-store/shim/index.js.map +1 -1
  431. package/dist/node-prod/node_modules/use-sync-external-store/shim/index.mjs +1 -2
  432. package/dist/node-prod/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
  433. package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.js +12 -7
  434. package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
  435. package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.mjs +12 -7
  436. package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
  437. package/dist/node-prod/optionValueDecoder.js +1 -2
  438. package/dist/node-prod/optionValueDecoder.js.map +1 -1
  439. package/dist/node-prod/optionValueDecoder.mjs +1 -2
  440. package/dist/node-prod/optionValueDecoder.mjs.map +1 -1
  441. package/dist/node-prod/packages/hydrogen-react/package.json.js +1 -1
  442. package/dist/node-prod/packages/hydrogen-react/package.json.mjs +1 -1
  443. package/dist/node-prod/parse-metafield.js +2 -2
  444. package/dist/node-prod/parse-metafield.js.map +1 -1
  445. package/dist/node-prod/parse-metafield.mjs +2 -2
  446. package/dist/node-prod/parse-metafield.mjs.map +1 -1
  447. package/dist/node-prod/storefront-client.js +1 -2
  448. package/dist/node-prod/storefront-client.js.map +1 -1
  449. package/dist/node-prod/storefront-client.mjs +1 -2
  450. package/dist/node-prod/storefront-client.mjs.map +1 -1
  451. package/dist/node-prod/tracking-utils.js +88 -0
  452. package/dist/node-prod/tracking-utils.js.map +1 -0
  453. package/dist/node-prod/tracking-utils.mjs +88 -0
  454. package/dist/node-prod/tracking-utils.mjs.map +1 -0
  455. package/dist/node-prod/useCartAPIStateMachine.js +6 -12
  456. package/dist/node-prod/useCartAPIStateMachine.js.map +1 -1
  457. package/dist/node-prod/useCartAPIStateMachine.mjs +6 -12
  458. package/dist/node-prod/useCartAPIStateMachine.mjs.map +1 -1
  459. package/dist/node-prod/useCartActions.js.map +1 -1
  460. package/dist/node-prod/useCartActions.mjs.map +1 -1
  461. package/dist/node-prod/useMoney.js.map +1 -1
  462. package/dist/node-prod/useMoney.mjs.map +1 -1
  463. package/dist/node-prod/useSelectedOptionInUrlParam.js.map +1 -1
  464. package/dist/node-prod/useSelectedOptionInUrlParam.mjs.map +1 -1
  465. package/dist/node-prod/useShopifyCookies.js +95 -9
  466. package/dist/node-prod/useShopifyCookies.js.map +1 -1
  467. package/dist/node-prod/useShopifyCookies.mjs +97 -11
  468. package/dist/node-prod/useShopifyCookies.mjs.map +1 -1
  469. package/dist/types/Image.d.ts +1 -1
  470. package/dist/types/ShopifyProvider.d.ts +5 -0
  471. package/dist/types/cookies-utils.d.ts +4 -0
  472. package/dist/types/index.d.cts +1 -0
  473. package/dist/types/index.d.ts +1 -0
  474. package/dist/types/tracking-utils.d.ts +22 -0
  475. package/dist/types/useShopifyCookies.d.ts +28 -2
  476. package/dist/umd/hydrogen-react.dev.js +543 -367
  477. package/dist/umd/hydrogen-react.dev.js.map +1 -1
  478. package/dist/umd/hydrogen-react.prod.js +18 -18
  479. package/dist/umd/hydrogen-react.prod.js.map +1 -1
  480. package/package.json +35 -22
@@ -1 +1 @@
1
- {"version":3,"file":"fsm.mjs","sources":["../../../../../../../../node_modules/@xstate/react/es/fsm.js"],"sourcesContent":["var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nimport { createMachine, interpret, InterpreterStatus } from '@xstate/fsm';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport useConstant from './useConstant';\nfunction identity(a) {\n return a;\n}\nvar getServiceState = function (service) {\n var currentValue;\n service\n .subscribe(function (state) {\n currentValue = state;\n })\n .unsubscribe();\n return currentValue;\n};\nexport function useMachine(stateMachine, options) {\n var persistedStateRef = useRef();\n if (process.env.NODE_ENV !== 'production') {\n var _a = __read(useState(stateMachine), 1), initialMachine = _a[0];\n if (stateMachine !== initialMachine) {\n console.warn('Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\\n' +\n 'Please make sure that you pass the same Machine as argument each time.');\n }\n }\n var _b = __read(useConstant(function () {\n var queue = [];\n var service = interpret(createMachine(stateMachine.config, options ? options : stateMachine._options));\n var send = service.send;\n service.send = function (event) {\n if (service.status === InterpreterStatus.NotStarted) {\n queue.push(event);\n return;\n }\n send(event);\n persistedStateRef.current = service.state;\n };\n return [service, queue];\n }), 2), service = _b[0], queue = _b[1];\n useIsomorphicLayoutEffect(function () {\n if (options) {\n service._machine._options = options;\n }\n });\n var useServiceResult = useService(service);\n useEffect(function () {\n service.start(persistedStateRef.current);\n queue.forEach(service.send);\n persistedStateRef.current = service.state;\n return function () {\n service.stop();\n };\n }, []);\n return useServiceResult;\n}\nvar isEqual = function (_prevState, nextState) { return nextState.changed === false; };\nexport function useService(service) {\n var getSnapshot = useCallback(function () { return getServiceState(service); }, [service]);\n var subscribe = useCallback(function (handleStoreChange) {\n var unsubscribe = service.subscribe(handleStoreChange).unsubscribe;\n return unsubscribe;\n }, [service]);\n var storeSnapshot = useSyncExternalStoreWithSelector(subscribe, getSnapshot, getSnapshot, identity, isEqual);\n return [storeSnapshot, service.send, service];\n}\n"],"names":["n","queue","service","interpret","createMachine","InterpreterStatus","useIsomorphicLayoutEffect","useSyncExternalStoreWithSelector"],"mappings":";;;;;AAAA,IAAI,SAAkC,SAAU,GAAGA,IAAG;AAClD,MAAI,IAAI,OAAO,WAAW,cAAc,EAAE,OAAO,QAAQ;AACzD,MAAI,CAAC;AAAG,WAAO;AACf,MAAI,IAAI,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAE,GAAE;AAC/B,MAAI;AACA,YAAQA,OAAM,UAAUA,OAAM,MAAM,EAAE,IAAI,EAAE,KAAM,GAAE;AAAM,SAAG,KAAK,EAAE,KAAK;AAAA,EAC5E,SACM,OAAO;AAAE,QAAI,EAAE,MAAc;AAAA,EAAG,UAC/B;AACJ,QAAI;AACA,UAAI,KAAK,CAAC,EAAE,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B,UAAU,QAAQ;AACpC,WAAO,WAAY;AACf,cAAQ,KAAI;AAAA,IACxB;AAAA,EACK,GAAE,CAAE,CAAA;AACL,SAAO;AACX;AACA,IAAI,UAAU,SAAU,YAAY,WAAW;AAAE,SAAO,UAAU,YAAY;;AACvE,SAAS,WAAW,SAAS;AAChC,MAAI,cAAc,YAAY,WAAY;AAAE,WAAO,gBAAgB,OAAO;AAAA,EAAI,GAAE,CAAC,OAAO,CAAC;AACzF,MAAI,YAAY,YAAY,SAAU,mBAAmB;AACrD,QAAI,cAAc,QAAQ,UAAU,iBAAiB,EAAE;AACvD,WAAO;AAAA,EACf,GAAO,CAAC,OAAO,CAAC;AACZ,MAAI,gBAAgBC,oBAAAA,iCAAiC,WAAW,aAAa,aAAa,UAAU,OAAO;AAC3G,SAAO,CAAC,eAAe,QAAQ,MAAM,OAAO;AAChD;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"fsm.mjs","sources":["../../../../../../../../node_modules/@xstate/react/es/fsm.js"],"sourcesContent":["var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nimport { createMachine, interpret, InterpreterStatus } from '@xstate/fsm';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport useConstant from './useConstant';\nfunction identity(a) {\n return a;\n}\nvar getServiceState = function (service) {\n var currentValue;\n service\n .subscribe(function (state) {\n currentValue = state;\n })\n .unsubscribe();\n return currentValue;\n};\nexport function useMachine(stateMachine, options) {\n var persistedStateRef = useRef();\n if (process.env.NODE_ENV !== 'production') {\n var _a = __read(useState(stateMachine), 1), initialMachine = _a[0];\n if (stateMachine !== initialMachine) {\n console.warn('Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\\n' +\n 'Please make sure that you pass the same Machine as argument each time.');\n }\n }\n var _b = __read(useConstant(function () {\n var queue = [];\n var service = interpret(createMachine(stateMachine.config, options ? options : stateMachine._options));\n var send = service.send;\n service.send = function (event) {\n if (service.status === InterpreterStatus.NotStarted) {\n queue.push(event);\n return;\n }\n send(event);\n persistedStateRef.current = service.state;\n };\n return [service, queue];\n }), 2), service = _b[0], queue = _b[1];\n useIsomorphicLayoutEffect(function () {\n if (options) {\n service._machine._options = options;\n }\n });\n var useServiceResult = useService(service);\n useEffect(function () {\n service.start(persistedStateRef.current);\n queue.forEach(service.send);\n persistedStateRef.current = service.state;\n return function () {\n service.stop();\n };\n }, []);\n return useServiceResult;\n}\nvar isEqual = function (_prevState, nextState) { return nextState.changed === false; };\nexport function useService(service) {\n var getSnapshot = useCallback(function () { return getServiceState(service); }, [service]);\n var subscribe = useCallback(function (handleStoreChange) {\n var unsubscribe = service.subscribe(handleStoreChange).unsubscribe;\n return unsubscribe;\n }, [service]);\n var storeSnapshot = useSyncExternalStoreWithSelector(subscribe, getSnapshot, getSnapshot, identity, isEqual);\n return [storeSnapshot, service.send, service];\n}\n"],"names":["n","queue","service","interpret","createMachine","InterpreterStatus","useIsomorphicLayoutEffect","useSyncExternalStoreWithSelector"],"mappings":";;;;;AAAA,IAAI,SAAkC,SAAU,GAAGA,IAAG;AAClD,MAAI,IAAI,OAAO,WAAW,cAAc,EAAE,OAAO,QAAQ;AACzD,MAAI,CAAC,EAAG,QAAO;AACf,MAAI,IAAI,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAA,GAAI;AAC/B,MAAI;AACA,YAAQA,OAAM,UAAUA,OAAM,MAAM,EAAE,IAAI,EAAE,KAAM,GAAE,KAAM,IAAG,KAAK,EAAE,KAAK;AAAA,EACjF,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W,OAAO;AACzC,YAAU,WAAY;AAClB,YAAQ,MAAM,kBAAkB,OAAO;AACvC,UAAM,QAAQ,QAAQ,IAAI;AAC1B,sBAAkB,UAAU,QAAQ;AACpC,WAAO,WAAY;AACf,cAAQ,KAAM;AAAA,IACjB;AAAA,EACJ,GAAE,EAAE;AACL,SAAO;AACX;AACA,IAAI,UAAU,SAAU,YAAY,WAAW;AAAE,SAAO,UAAU,YAAY;AAAQ;AAC/E,SAAS,WAAW,SAAS;AAChC,MAAI,cAAc,YAAY,WAAY;AAAE,WAAO,gBAAgB,OAAO;AAAA,EAAE,GAAI,CAAC,OAAO,CAAC;AACzF,MAAI,YAAY,YAAY,SAAU,mBAAmB;AACrD,QAAI,cAAc,QAAQ,UAAU,iBAAiB,EAAE;AACvD,WAAO;AAAA,EACf,GAAO,CAAC,OAAO,CAAC;AACZ,MAAI,gBAAgBC,oBAAAA,iCAAiC,WAAW,aAAa,aAAa,UAAU,OAAO;AAC3G,SAAO,CAAC,eAAe,QAAQ,MAAM,OAAO;AAChD;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"useConstant.mjs","sources":["../../../../../../../../node_modules/@xstate/react/es/useConstant.js"],"sourcesContent":["import * as React from 'react';\nexport default function useConstant(fn) {\n var ref = React.useRef();\n if (!ref.current) {\n ref.current = { v: fn() };\n }\n return ref.current.v;\n}\n"],"names":[],"mappings":";AACe,SAAS,YAAY,IAAI;AACpC,MAAI,MAAM,MAAM;AAChB,MAAI,CAAC,IAAI,SAAS;AACd,QAAI,UAAU,EAAE,GAAG,GAAI,EAAA;AAAA,EAC1B;AACD,SAAO,IAAI,QAAQ;AACvB;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"useConstant.mjs","sources":["../../../../../../../../node_modules/@xstate/react/es/useConstant.js"],"sourcesContent":["import * as React from 'react';\nexport default function useConstant(fn) {\n var ref = React.useRef();\n if (!ref.current) {\n ref.current = { v: fn() };\n }\n return ref.current.v;\n}\n"],"names":[],"mappings":";AACe,SAAS,YAAY,IAAI;AACpC,MAAI,MAAM,MAAM,OAAQ;AACxB,MAAI,CAAC,IAAI,SAAS;AACd,QAAI,UAAU,EAAE,GAAG,GAAE,EAAI;AAAA,EACjC;AACI,SAAO,IAAI,QAAQ;AACvB;","x_google_ignoreList":[0]}
@@ -12,8 +12,7 @@ import { __require as requireShim } from "../../shim/index.mjs";
12
12
  */
13
13
  var hasRequiredWithSelector_development;
14
14
  function requireWithSelector_development() {
15
- if (hasRequiredWithSelector_development)
16
- return withSelector_development;
15
+ if (hasRequiredWithSelector_development) return withSelector_development;
17
16
  hasRequiredWithSelector_development = 1;
18
17
  if (process.env.NODE_ENV !== "production") {
19
18
  (function() {
@@ -1 +1 @@
1
- {"version":3,"file":"with-selector.development.mjs","sources":["../../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\nvar shim = require('use-sync-external-store/shim');\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\nvar useSyncExternalStore = shim.useSyncExternalStore;\n\n// for CommonJS interop.\n\nvar useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.\n\nfunction useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {\n // Use this to track the rendered snapshot.\n var instRef = useRef(null);\n var inst;\n\n if (instRef.current === null) {\n inst = {\n hasValue: false,\n value: null\n };\n instRef.current = inst;\n } else {\n inst = instRef.current;\n }\n\n var _useMemo = useMemo(function () {\n // Track the memoized state using closure variables that are local to this\n // memoized instance of a getSnapshot function. Intentionally not using a\n // useRef hook, because that state would be shared across all concurrent\n // copies of the hook/component.\n var hasMemo = false;\n var memoizedSnapshot;\n var memoizedSelection;\n\n var memoizedSelector = function (nextSnapshot) {\n if (!hasMemo) {\n // The first time the hook is called, there is no memoized result.\n hasMemo = true;\n memoizedSnapshot = nextSnapshot;\n\n var _nextSelection = selector(nextSnapshot);\n\n if (isEqual !== undefined) {\n // Even if the selector has changed, the currently rendered selection\n // may be equal to the new selection. We should attempt to reuse the\n // current value if possible, to preserve downstream memoizations.\n if (inst.hasValue) {\n var currentSelection = inst.value;\n\n if (isEqual(currentSelection, _nextSelection)) {\n memoizedSelection = currentSelection;\n return currentSelection;\n }\n }\n }\n\n memoizedSelection = _nextSelection;\n return _nextSelection;\n } // We may be able to reuse the previous invocation's result.\n\n\n // We may be able to reuse the previous invocation's result.\n var prevSnapshot = memoizedSnapshot;\n var prevSelection = memoizedSelection;\n\n if (objectIs(prevSnapshot, nextSnapshot)) {\n // The snapshot is the same as last time. Reuse the previous selection.\n return prevSelection;\n } // The snapshot has changed, so we need to compute a new selection.\n\n\n // The snapshot has changed, so we need to compute a new selection.\n var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n\n // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {\n return prevSelection;\n }\n\n memoizedSnapshot = nextSnapshot;\n memoizedSelection = nextSelection;\n return nextSelection;\n }; // Assigning this to a constant so that Flow knows it can't change.\n\n\n // Assigning this to a constant so that Flow knows it can't change.\n var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;\n\n var getSnapshotWithSelector = function () {\n return memoizedSelector(getSnapshot());\n };\n\n var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n };\n return [getSnapshotWithSelector, getServerSnapshotWithSelector];\n }, [getSnapshot, getServerSnapshot, selector, isEqual]),\n getSelection = _useMemo[0],\n getServerSelection = _useMemo[1];\n\n var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);\n useEffect(function () {\n inst.hasValue = true;\n inst.value = value;\n }, [value]);\n useDebugValue(value);\n return value;\n}\n\nexports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n"],"names":["require$$0","require$$1"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,KAAC,WAAW;AAKd,UACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,gCACpC,YACF;AACA,uCAA+B,4BAA4B,IAAI,MAAK,CAAE;AAAA,MACvE;AACS,UAAI,QAAQA;AACtB,UAAI,OAAOC;AAMX,eAAS,GAAG,GAAG,GAAG;AAChB,eAAO,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BAA0B,WAAY;AACxC,mBAAO,iBAAiB,YAAW,CAAE;AAAA,UAC3C;AAEI,cAAI,gCAAgC,2BAA2B,OAAO,SAAY,WAAY;AAC5F,mBAAO,iBAAiB,uBAAsB,CAAE;AAAA,UACtD;AACI,iBAAO,CAAC,yBAAyB,6BAA6B;AAAA,QAC/D,GAAE,CAAC,aAAa,mBAAmB,UAAU,OAAO,CAAC,GAClD,eAAe,SAAS,CAAC,GACzB,qBAAqB,SAAS,CAAC;AAEnC,YAAI,QAAQ,qBAAqB,WAAW,cAAc,kBAAkB;AAC5E,kBAAU,WAAY;AACpB,eAAK,WAAW;AAChB,eAAK,QAAQ;AAAA,QACjB,GAAK,CAAC,KAAK,CAAC;AACV,sBAAc,KAAK;AACnB,eAAO;AAAA,MACR;AAEuC,+BAAA,mCAAG;AAE3C,UACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,+BACpC,YACF;AACA,uCAA+B,2BAA2B,IAAI,MAAK,CAAE;AAAA,MACtE;AAAA,IAED;EACA;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"with-selector.development.mjs","sources":["../../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\nvar shim = require('use-sync-external-store/shim');\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\nvar useSyncExternalStore = shim.useSyncExternalStore;\n\n// for CommonJS interop.\n\nvar useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.\n\nfunction useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {\n // Use this to track the rendered snapshot.\n var instRef = useRef(null);\n var inst;\n\n if (instRef.current === null) {\n inst = {\n hasValue: false,\n value: null\n };\n instRef.current = inst;\n } else {\n inst = instRef.current;\n }\n\n var _useMemo = useMemo(function () {\n // Track the memoized state using closure variables that are local to this\n // memoized instance of a getSnapshot function. Intentionally not using a\n // useRef hook, because that state would be shared across all concurrent\n // copies of the hook/component.\n var hasMemo = false;\n var memoizedSnapshot;\n var memoizedSelection;\n\n var memoizedSelector = function (nextSnapshot) {\n if (!hasMemo) {\n // The first time the hook is called, there is no memoized result.\n hasMemo = true;\n memoizedSnapshot = nextSnapshot;\n\n var _nextSelection = selector(nextSnapshot);\n\n if (isEqual !== undefined) {\n // Even if the selector has changed, the currently rendered selection\n // may be equal to the new selection. We should attempt to reuse the\n // current value if possible, to preserve downstream memoizations.\n if (inst.hasValue) {\n var currentSelection = inst.value;\n\n if (isEqual(currentSelection, _nextSelection)) {\n memoizedSelection = currentSelection;\n return currentSelection;\n }\n }\n }\n\n memoizedSelection = _nextSelection;\n return _nextSelection;\n } // We may be able to reuse the previous invocation's result.\n\n\n // We may be able to reuse the previous invocation's result.\n var prevSnapshot = memoizedSnapshot;\n var prevSelection = memoizedSelection;\n\n if (objectIs(prevSnapshot, nextSnapshot)) {\n // The snapshot is the same as last time. Reuse the previous selection.\n return prevSelection;\n } // The snapshot has changed, so we need to compute a new selection.\n\n\n // The snapshot has changed, so we need to compute a new selection.\n var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n\n // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {\n return prevSelection;\n }\n\n memoizedSnapshot = nextSnapshot;\n memoizedSelection = nextSelection;\n return nextSelection;\n }; // Assigning this to a constant so that Flow knows it can't change.\n\n\n // Assigning this to a constant so that Flow knows it can't change.\n var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;\n\n var getSnapshotWithSelector = function () {\n return memoizedSelector(getSnapshot());\n };\n\n var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n };\n return [getSnapshotWithSelector, getServerSnapshotWithSelector];\n }, [getSnapshot, getServerSnapshot, selector, isEqual]),\n getSelection = _useMemo[0],\n getServerSelection = _useMemo[1];\n\n var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);\n useEffect(function () {\n inst.hasValue = true;\n inst.value = value;\n }, [value]);\n useDebugValue(value);\n return value;\n}\n\nexports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n"],"names":["require$$0","require$$1"],"mappings":";;;;;;;;;;;;;;;;AAYA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,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,gBAAI,gBAAgB,SAAS,YAAY;AASzC,gBAAI,YAAY,UAAa,QAAQ,eAAe,aAAa,GAAG;AAClE,qBAAO;AAAA,YACf;AAEM,+BAAmB;AACnB,gCAAoB;AACpB,mBAAO;AAAA,UACb;AAII,cAAI,yBAAyB,sBAAsB,SAAY,OAAO;AAEtE,cAAI,0BAA0B,WAAY;AACxC,mBAAO,iBAAiB,aAAa;AAAA,UACtC;AAED,cAAI,gCAAgC,2BAA2B,OAAO,SAAY,WAAY;AAC5F,mBAAO,iBAAiB,wBAAwB;AAAA,UACjD;AACD,iBAAO,CAAC,yBAAyB,6BAA6B;AAAA,QAC/D,GAAE,CAAC,aAAa,mBAAmB,UAAU,OAAO,CAAC,GAClD,eAAe,SAAS,CAAC,GACzB,qBAAqB,SAAS,CAAC;AAEnC,YAAI,QAAQ,qBAAqB,WAAW,cAAc,kBAAkB;AAC5E,kBAAU,WAAY;AACpB,eAAK,WAAW;AAChB,eAAK,QAAQ;AAAA,QACjB,GAAK,CAAC,KAAK,CAAC;AACV,sBAAc,KAAK;AACnB,eAAO;AAAA,MACT;AAEA,+BAAA,mCAA2C;AAE3C,UACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,+BACpC,YACF;AACA,uCAA+B,2BAA2B,IAAI,OAAO;AAAA,MACvE;AAAA,IAEA,GAAM;AAAA,EACN;;;","x_google_ignoreList":[0]}
@@ -12,8 +12,7 @@ import { __require as requireShim } from "../../shim/index.mjs";
12
12
  */
13
13
  var hasRequiredWithSelector_production_min;
14
14
  function requireWithSelector_production_min() {
15
- if (hasRequiredWithSelector_production_min)
16
- return withSelector_production_min;
15
+ if (hasRequiredWithSelector_production_min) return withSelector_production_min;
17
16
  hasRequiredWithSelector_production_min = 1;
18
17
  var h = React__default, n = requireShim();
19
18
  function p(a, b) {
@@ -25,8 +24,7 @@ function requireWithSelector_production_min() {
25
24
  if (null === c.current) {
26
25
  var f = { hasValue: false, value: null };
27
26
  c.current = f;
28
- } else
29
- f = c.current;
27
+ } else f = c.current;
30
28
  c = v(function() {
31
29
  function a2(a3) {
32
30
  if (!c2) {
@@ -35,17 +33,14 @@ function requireWithSelector_production_min() {
35
33
  a3 = l(a3);
36
34
  if (void 0 !== g && f.hasValue) {
37
35
  var b2 = f.value;
38
- if (g(b2, a3))
39
- return k = b2;
36
+ if (g(b2, a3)) return k = b2;
40
37
  }
41
38
  return k = a3;
42
39
  }
43
40
  b2 = k;
44
- if (q(d2, a3))
45
- return b2;
41
+ if (q(d2, a3)) return b2;
46
42
  var e2 = l(a3);
47
- if (void 0 !== g && g(b2, e2))
48
- return b2;
43
+ if (void 0 !== g && g(b2, e2)) return b2;
49
44
  d2 = a3;
50
45
  return k = e2;
51
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"with-selector.production.min.mjs","sources":["../../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!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E,EAAG,CAAA;AAAA,MAAC,GAAE,SAAO,IAAE,SAAO,WAAU;AAAC,eAAOA,GAAE,EAAC,CAAE;AAAA,MAAC,CAAC;AAAA,IAAC,GAAE,CAAC,GAAE,GAAE,GAAE,CAAC,CAAC;AAAE,QAAI,IAAE,EAAE,GAAE,EAAE,CAAC,GAAE,EAAE,CAAC,CAAC;AACrf,MAAE,WAAU;AAAC,QAAE,WAAS;AAAG,QAAE,QAAM;AAAA,IAAC,GAAE,CAAC,CAAC,CAAC;AAAE,MAAE,CAAC;AAAE,WAAO;AAAA,EAAC;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"with-selector.production.min.mjs","sources":["../../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n"],"names":["require$$0","require$$1","a","c","d","b","e"],"mappings":";;;;;;;;;;;;;;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E;AAAA,MAAC,CAAC;AAAA,IAAC,GAAE,CAAC,GAAE,GAAE,GAAE,CAAC,CAAC;AAAE,QAAI,IAAE,EAAE,GAAE,EAAE,CAAC,GAAE,EAAE,CAAC,CAAC;AACrf,MAAE,WAAU;AAAC,QAAE,WAAS;AAAG,QAAE,QAAM;AAAA,IAAC,GAAE,CAAC,CAAC,CAAC;AAAE,MAAE,CAAC;AAAE,WAAO;AAAA,EAAC;;;","x_google_ignoreList":[0]}
@@ -11,8 +11,7 @@ import React__default from "react";
11
11
  */
12
12
  var hasRequiredUseSyncExternalStoreShim_development;
13
13
  function requireUseSyncExternalStoreShim_development() {
14
- if (hasRequiredUseSyncExternalStoreShim_development)
15
- return useSyncExternalStoreShim_development;
14
+ if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
16
15
  hasRequiredUseSyncExternalStoreShim_development = 1;
17
16
  if (process.env.NODE_ENV !== "production") {
18
17
  (function() {
@@ -1 +1 @@
1
- {"version":3,"file":"use-sync-external-store-shim.development.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\n// dispatch for CommonJS interop named imports.\n\nvar useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nvar didWarnOld18Alpha = false;\nvar didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\n\nfunction useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n// React do not expose a way to check if we're hydrating. So users of the shim\n// will need to track that themselves and return the correct value\n// from `getSnapshot`.\ngetServerSnapshot) {\n {\n if (!didWarnOld18Alpha) {\n if (React.startTransition !== undefined) {\n didWarnOld18Alpha = true;\n\n error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');\n }\n }\n } // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n\n\n var value = getSnapshot();\n\n {\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n\n if (!objectIs(value, cachedValue)) {\n error('The result of getSnapshot should be cached to avoid an infinite loop');\n\n didWarnUncachedGetSnapshot = true;\n }\n }\n } // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n\n\n var _useState = useState({\n inst: {\n value: value,\n getSnapshot: getSnapshot\n }\n }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n\n\n useLayoutEffect(function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }, [subscribe, value, getSnapshot]);\n useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n\n var handleStoreChange = function () {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }; // Subscribe to the store and return a clean-up function.\n\n\n return subscribe(handleStoreChange);\n }, [subscribe]);\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n var prevValue = inst.value;\n\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n\nfunction useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\n\nvar isServerEnvironment = !canUseDOM;\n\nvar shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;\nvar useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;\n\nexports.useSyncExternalStore = useSyncExternalStore$2;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n"],"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;AAAA,MACF;AAED,eAAS,uBAAuB,WAAW,aAAa,mBAAmB;AAKzE,eAAO,YAAW;AAAA,MACnB;AAED,UAAI,YAAY,CAAC,EAAE,OAAO,WAAW,eAAe,OAAO,OAAO,aAAa,eAAe,OAAO,OAAO,SAAS,kBAAkB;AAEvI,UAAI,sBAAsB,CAAC;AAE3B,UAAI,OAAO,sBAAsB,yBAAyB;AAC1D,UAAI,yBAAyB,MAAM,yBAAyB,SAAY,MAAM,uBAAuB;AAEzE,2CAAA,uBAAG;AAE/B,UACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,+BACpC,YACF;AACA,uCAA+B,2BAA2B,IAAI,MAAK,CAAE;AAAA,MACtE;AAAA,IAED;EACA;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"use-sync-external-store-shim.development.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\n// dispatch for CommonJS interop named imports.\n\nvar useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nvar didWarnOld18Alpha = false;\nvar didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\n\nfunction useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n// React do not expose a way to check if we're hydrating. So users of the shim\n// will need to track that themselves and return the correct value\n// from `getSnapshot`.\ngetServerSnapshot) {\n {\n if (!didWarnOld18Alpha) {\n if (React.startTransition !== undefined) {\n didWarnOld18Alpha = true;\n\n error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');\n }\n }\n } // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n\n\n var value = getSnapshot();\n\n {\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n\n if (!objectIs(value, cachedValue)) {\n error('The result of getSnapshot should be cached to avoid an infinite loop');\n\n didWarnUncachedGetSnapshot = true;\n }\n }\n } // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n\n\n var _useState = useState({\n inst: {\n value: value,\n getSnapshot: getSnapshot\n }\n }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n\n\n useLayoutEffect(function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }, [subscribe, value, getSnapshot]);\n useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n\n var handleStoreChange = function () {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }; // Subscribe to the store and return a clean-up function.\n\n\n return subscribe(handleStoreChange);\n }, [subscribe]);\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n var prevValue = inst.value;\n\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n\nfunction useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\n\nvar isServerEnvironment = !canUseDOM;\n\nvar shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;\nvar useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;\n\nexports.useSyncExternalStore = useSyncExternalStore$2;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n"],"names":["require$$0","error"],"mappings":";;;;;;;;;;;;;;;AAYA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,KAAC,WAAW;AAKd,UACE,OAAO,mCAAmC,eAC1C,OAAO,+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C,EAAE,OAAO,WAAW,eAAe,OAAO,OAAO,aAAa,eAAe,OAAO,OAAO,SAAS,kBAAkB;AAEvI,UAAI,sBAAsB,CAAC;AAE3B,UAAI,OAAO,sBAAsB,yBAAyB;AAC1D,UAAI,yBAAyB,MAAM,yBAAyB,SAAY,MAAM,uBAAuB;AAErG,2CAAA,uBAA+B;AAE/B,UACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,+BACpC,YACF;AACA,uCAA+B,2BAA2B,IAAI,OAAO;AAAA,MACvE;AAAA,IAEA,GAAM;AAAA,EACN;;;","x_google_ignoreList":[0]}
@@ -11,8 +11,7 @@ import React__default from "react";
11
11
  */
12
12
  var hasRequiredUseSyncExternalStoreShim_production_min;
13
13
  function requireUseSyncExternalStoreShim_production_min() {
14
- if (hasRequiredUseSyncExternalStoreShim_production_min)
15
- return useSyncExternalStoreShim_production_min;
14
+ if (hasRequiredUseSyncExternalStoreShim_production_min) return useSyncExternalStoreShim_production_min;
16
15
  hasRequiredUseSyncExternalStoreShim_production_min = 1;
17
16
  var e = React__default;
18
17
  function h(a, b) {
@@ -1 +1 @@
1
- {"version":3,"file":"use-sync-external-store-shim.production.min.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n"],"names":["require$$0"],"mappings":";;;;;;;;;;;;;;;;AASa,MAAI,IAAEA;AAAiB,WAAS,EAAE,GAAE,GAAE;AAAC,WAAO,MAAI,MAAI,MAAI,KAAG,IAAE,MAAI,IAAE,MAAI,MAAI,KAAG,MAAI;AAAA,EAAC;AAAC,MAAI,IAAE,eAAa,OAAO,OAAO,KAAG,OAAO,KAAG,GAAE,IAAE,EAAE,UAAS,IAAE,EAAE,WAAU,IAAE,EAAE,iBAAgB,IAAE,EAAE;AAAc,WAAS,EAAE,GAAE,GAAE;AAAC,QAAI,IAAE,EAAC,GAAG,IAAE,EAAE,EAAC,MAAK,EAAC,OAAM,GAAE,aAAY,EAAC,EAAC,CAAC,GAAE,IAAE,EAAE,CAAC,EAAE,MAAK,IAAE,EAAE,CAAC;AAAE,MAAE,WAAU;AAAC,QAAE,QAAM;AAAE,QAAE,cAAY;AAAE,QAAE,CAAC,KAAG,EAAE,EAAC,MAAK,EAAC,CAAC;AAAA,IAAC,GAAE,CAAC,GAAE,GAAE,CAAC,CAAC;AAAE,MAAE,WAAU;AAAC,QAAE,CAAC,KAAG,EAAE,EAAC,MAAK,EAAC,CAAC;AAAE,aAAO,EAAE,WAAU;AAAC,UAAE,CAAC,KAAG,EAAE,EAAC,MAAK,EAAC,CAAC;AAAA,MAAC,CAAC;AAAA,IAAC,GAAE,CAAC,CAAC,CAAC;AAAE,MAAE,CAAC;AAAE,WAAO;AAAA,EAAC;AAClc,WAAS,EAAE,GAAE;AAAC,QAAI,IAAE,EAAE;AAAY,QAAE,EAAE;AAAM,QAAG;AAAC,UAAI,IAAE,EAAG;AAAC,aAAM,CAAC,EAAE,GAAE,CAAC;AAAA,IAAC,SAAO,GAAE;AAAC,aAAM;AAAA,IAAE;AAAA,EAAC;AAAC,WAAS,EAAE,GAAE,GAAE;AAAC,WAAO,EAAC;AAAA,EAAE;AAAC,MAAI,IAAE,gBAAc,OAAO,UAAQ,gBAAc,OAAO,OAAO,YAAU,gBAAc,OAAO,OAAO,SAAS,gBAAc,IAAE;AAAE,0CAA4B,uBAAC,WAAS,EAAE,uBAAqB,EAAE,uBAAqB;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"use-sync-external-store-shim.production.min.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n"],"names":["require$$0"],"mappings":";;;;;;;;;;;;;;;AASa,MAAI,IAAEA;AAAiB,WAAS,EAAE,GAAE,GAAE;AAAC,WAAO,MAAI,MAAI,MAAI,KAAG,IAAE,MAAI,IAAE,MAAI,MAAI,KAAG,MAAI;AAAA,EAAC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oreShim_development } from "../cjs/use-sync-external-store-shim.development.mjs";
4
4
  var hasRequiredShim;
5
5
  function requireShim() {
6
- if (hasRequiredShim)
7
- return shim.exports;
6
+ if (hasRequiredShim) return shim.exports;
8
7
  hasRequiredShim = 1;
9
8
  if (process.env.NODE_ENV === "production") {
10
9
  shim.exports = requireUseSyncExternalStoreShim_production_min();
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/shim/index.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n"],"names":["shimModule","require$$0","require$$1"],"mappings":";;;;;;;;AAEA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzCA,SAAA,UAAiBC;EACnB,OAAO;AACLD,SAAA,UAAiBE;EACnB;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/shim/index.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n"],"names":["shimModule","require$$0","require$$1"],"mappings":";;;;;;;AAEA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzCA,SAAA,UAAiBC,+CAAgE;AAAA,EACnF,OAAO;AACLD,SAAA,UAAiBE,4CAA6D;AAAA,EAChF;;;","x_google_ignoreList":[0]}
@@ -1,13 +1,18 @@
1
- import { __module as withSelector } from "../../../_virtual/with-selector.mjs";
1
+ import { __module as withSelector } from "../../../_virtual/with-selector2.mjs";
2
2
  import { __require as requireWithSelector_production_min } from "../cjs/use-sync-external-store-shim/with-selector.production.min.mjs";
3
3
  import { __require as requireWithSelector_development } from "../cjs/use-sync-external-store-shim/with-selector.development.mjs";
4
- if (process.env.NODE_ENV === "production") {
5
- withSelector.exports = requireWithSelector_production_min();
6
- } else {
7
- withSelector.exports = requireWithSelector_development();
4
+ var hasRequiredWithSelector;
5
+ function requireWithSelector() {
6
+ if (hasRequiredWithSelector) return withSelector.exports;
7
+ hasRequiredWithSelector = 1;
8
+ if (process.env.NODE_ENV === "production") {
9
+ withSelector.exports = requireWithSelector_production_min();
10
+ } else {
11
+ withSelector.exports = requireWithSelector_development();
12
+ }
13
+ return withSelector.exports;
8
14
  }
9
- var withSelectorExports = withSelector.exports;
10
15
  export {
11
- withSelectorExports as w
16
+ requireWithSelector as __require
12
17
  };
13
18
  //# sourceMappingURL=with-selector.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"with-selector.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/shim/with-selector.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n"],"names":["withSelectorModule","require$$0","require$$1"],"mappings":";;;AAEA,IAAI,QAAQ,IAAI,aAAa,cAAc;AACzCA,eAAA,UAAiBC;AACnB,OAAO;AACLD,eAAA,UAAiBE;AACnB;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"with-selector.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/shim/with-selector.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n"],"names":["withSelectorModule","require$$0","require$$1"],"mappings":";;;;;;;AAEA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzCA,iBAAA,UAAiBC,mCAA8E;AAAA,EACjG,OAAO;AACLD,iBAAA,UAAiBE,gCAA2E;AAAA,EAC9F;;;","x_google_ignoreList":[0]}
@@ -30,8 +30,7 @@ const isOptionValueCombinationInEncodedVariant = /* @__PURE__ */ (() => {
30
30
  };
31
31
  })();
32
32
  function decodeEncodedVariant(encodedVariantField) {
33
- if (!encodedVariantField)
34
- return [];
33
+ if (!encodedVariantField) return [];
35
34
  if (encodedVariantField.startsWith("v1_")) {
36
35
  return v1Decoder(stripVersion(encodedVariantField));
37
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"optionValueDecoder.mjs","sources":["../../src/optionValueDecoder.ts"],"sourcesContent":["/**\n * This file provides utility functions for determining whether or not an option value combination is present in an encoded option value string.\n *\n * In V1 of the encoding strategy, option value arrays are encoded as a trie with the following rules:\n * - `:` `,` ` ` and `-` are control characters.\n * - `:` indicates a new option. ex: 0:1 indicates value 0 for the option in position 1, value 1 for the option in position 2.\n * - `,` indicates the end of a repeated prefix, mulitple consecutive commas indicate the end of multiple repeated prefixes.\n * - ` ` indicates a gap in the sequence of option values. ex: `0 4` indicates option values in position 0 and 4 are present.\n * - `-` indicates a continuous range of option values. ex: `0 1-3 4`. Ranges are only present encoded in the final option value position, so for example the trie for the set [[0,0,0],[0,0,1], ..., [0,2,2]] will be structured as `0:0:0-2,1:0-2,2:0-2`, not `0:0-2:0-2`.\n */\n\nimport {Product} from './storefront-api-types.js';\n\nconst OPTION_VALUE_SEPARATOR = ',';\n\nconst V1_CONTROL_CHARS = {\n OPTION: ':',\n END_OF_PREFIX: ',',\n SEQUENCE_GAP: ' ',\n RANGE: '-',\n};\n\nexport type IsOptionValueCombinationInEncodedVariant = (\n targetOptionValueCombination: number[],\n encodedVariantField: string,\n) => boolean;\n\n/**\n * Determine whether an option value combination is present in an encoded option value string. Function is memoized by encodedVariantField.\n *\n * @param targetOptionValueCombination - Indices of option values to look up in the encoded option value string. A partial set of indices may be passed to determine whether a node or any children is present. For example, if a product has 3 options, passing [0] will return true if any option value combination for the first option's option value is present in the encoded string.\n * @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/2025-01/objects/Product#field-encodedvariantexistence) or [product.encodedVariantAvailability](/docs/api/storefront/2025-01/objects/Product#field-encodedvariantavailability)\n * @returns - True if a full or partial targetOptionValueIndices is present in the encoded option value string, false otherwise.\n */\nexport const isOptionValueCombinationInEncodedVariant: IsOptionValueCombinationInEncodedVariant =\n ((): IsOptionValueCombinationInEncodedVariant => {\n const decodedOptionValues = new Map<string, Set<string>>();\n\n return function (\n targetOptionValueCombination: number[],\n encodedVariantField: string,\n ): boolean {\n if (targetOptionValueCombination.length === 0) {\n return false;\n }\n\n if (!decodedOptionValues.has(encodedVariantField)) {\n const decodedOptionValuesSet = new Set<string>();\n\n for (const optionValue of decodeEncodedVariant(encodedVariantField)) {\n // add the complete option value to the decoded option values set\n decodedOptionValuesSet.add(optionValue.join(OPTION_VALUE_SEPARATOR));\n\n // add all composite parts of the option value to the decoded option values set. e.g. if the option value is [0,1,2], add \"0\", \"0,1\", \"0,1,2\"\n for (let i = 0; i < optionValue.length; i++) {\n decodedOptionValuesSet.add(\n optionValue.slice(0, i + 1).join(OPTION_VALUE_SEPARATOR),\n );\n }\n }\n\n decodedOptionValues.set(encodedVariantField, decodedOptionValuesSet);\n }\n\n return Boolean(\n decodedOptionValues\n .get(encodedVariantField)\n ?.has(targetOptionValueCombination.join(OPTION_VALUE_SEPARATOR)),\n );\n };\n })();\n\ntype EncodedVariantField =\n | Product['encodedVariantAvailability']\n // eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents\n | Product['encodedVariantExistence'];\ntype DecodedOptionValues = number[][];\n\n/**\n * For an encoded option value string, decode into option value combinations. Entries represent a valid combination formatted as an array of option value positions.\n * @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/2025-01/objects/Product#field-encodedvariantexistence) or [product.encodedVariantAvailability](/docs/api/storefront/2025-01/objects/Product#field-encodedvariantavailability)\n * @returns Decoded option value combinations\n */\nexport function decodeEncodedVariant(\n encodedVariantField: EncodedVariantField,\n): DecodedOptionValues {\n if (!encodedVariantField) return [];\n\n if (encodedVariantField.startsWith('v1_')) {\n return v1Decoder(stripVersion(encodedVariantField));\n }\n\n throw new Error('Unsupported option value encoding');\n}\n\nconst stripVersion: (encodedVariantField: string) => string = (\n encodedVariantField: string,\n) => encodedVariantField.replace(/^v1_/, '');\n\n/**\n * We encode an array of arrays representing variants, expressed in terms of options and option values, as a trie.\n *\n * This encoding strategy allows extremely large numbers of variants to be expressed in an extremely compact data structure.\n *\n * Integers represent option and values, so [0,0,0] represents option_value at array index 0 for the options at array indexes 0, 1 and 2\n *\n * `:`, `,`, ` ` and `-` are control characters.\n * `:` indicates a new option\n * `,` indicates the end of a repeated prefix, mulitple consecutive commas indicate the end of multiple repeated prefixes.\n * ` ` indicates a gap in the sequence of option values\n * `-` indicates a continuous range of option values\n *\n * Encoding process:\n *\n * example input array: [[0,0,0], [0,1,0], [0,1,1], [1,0,0], [1,0,1], [1,1,1], [2,0,1], [2,1,0]]\n *\n * step 1: encode as string: \"0:0:0,0:1:0,0:1:1,1:0:0,1:0:1,1:1:1,2:0:1,2:1:0,\"\n * step 2: combine nodes that share a prefix: \"0:0:0,0:1:0 1,1:0:0 1,1:1:1,2:0:1,2:1:0,\"\n * step 3: encode data as a trie so no prefixes need to be repeated: \"0:0:0,1:0 1,,1:0:0 1,1:1,,2:0:1,1:0,,\"\n * step 4: since the options are sorted, use a dash to express ranges: \"0:0:0,1:0-1,,1:0:0-1,1:1,,2:0:1,1:0,,\"\n */\nfunction v1Decoder(encodedVariantField: string): number[][] {\n const tokenizer = /[ :,-]/g;\n let index = 0;\n let token: RegExpExecArray | null;\n const options: number[][] = [];\n const currentOptionValue: number[] = [];\n let depth = 0;\n let rangeStart: number | null = null;\n\n // iterate over control characters\n while ((token = tokenizer.exec(encodedVariantField))) {\n const operation = token[0];\n const optionValueIndex =\n Number.parseInt(encodedVariantField.slice(index, token.index)) || 0;\n\n if (rangeStart !== null) {\n // If a range has been started, iterate over the range and add each option value to the list of options\n // - `rangeStart` is set if the last control char was a dash, e.g. `0` for 0-2. It represents the numeric option value position for the start of the range.\n // - `optionValueIndex` is the numeric option value position for the end of the range\n for (; rangeStart < optionValueIndex; rangeStart++) {\n currentOptionValue[depth] = rangeStart;\n options.push([...currentOptionValue]);\n }\n // indicates the range has been processed\n rangeStart = null;\n }\n\n currentOptionValue[depth] = optionValueIndex;\n\n if (operation === V1_CONTROL_CHARS.RANGE) {\n // dash operation indicates we are in a range. e.g. 0-2 means option values 0, 1, 2\n rangeStart = optionValueIndex;\n } else if (operation === V1_CONTROL_CHARS.OPTION) {\n // colon operation indicates that we are moving down to the next layer of option values. e.g. 0:0:0-2 means we traverse down from option1 to option3 and represents [[0,0,0], [0,0,1], [0,0,2]]\n depth++;\n } else {\n if (\n operation === V1_CONTROL_CHARS.SEQUENCE_GAP ||\n (operation === V1_CONTROL_CHARS.END_OF_PREFIX &&\n encodedVariantField[token.index - 1] !==\n V1_CONTROL_CHARS.END_OF_PREFIX)\n ) {\n // add the current option value to the list of options if we hit a gap in our sequence or we are at the end of our depth and need to move back up\n options.push([...currentOptionValue]);\n }\n if (operation === V1_CONTROL_CHARS.END_OF_PREFIX) {\n // go up an option level, trash the last item in currentOptionValue\n currentOptionValue.pop();\n depth--;\n }\n }\n index = tokenizer.lastIndex;\n }\n\n // The while loop only iterates control characters, meaning if an encoded string ends with an index it will not be processed.\n const encodingEndsWithIndex = encodedVariantField.match(/\\d+$/g);\n if (encodingEndsWithIndex) {\n const finalValueIndex = parseInt(encodingEndsWithIndex[0]);\n if (rangeStart != null) {\n // process final range\n for (; rangeStart <= finalValueIndex; rangeStart++) {\n currentOptionValue[depth] = rangeStart;\n options.push([...currentOptionValue]);\n }\n } else {\n // process final index\n options.push([finalValueIndex]);\n }\n }\n\n return options;\n}\n"],"names":[],"mappings":"AAaA,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AAAA,EACvB,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,cAAc;AAAA,EACd,OAAO;AACT;AAcO,MAAM,2CACsC,uBAAA;A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B,cAAc;AAClD,2BAAmB,KAAK,IAAI;AAC5B,gBAAQ,KAAK,CAAC,GAAG,kBAAkB,CAAC;AAAA,MACtC;AAEa,mBAAA;AAAA,IACf;AAEA,uBAAmB,KAAK,IAAI;AAExB,QAAA,cAAc,iBAAiB,OAAO;AAE3B,mBAAA;AAAA,IAAA,WACJ,cAAc,iBAAiB,QAAQ;AAEhD;AAAA,IAAA,OACK;AACL,UACE,cAAc,iBAAiB,gBAC9B,cAAc,iBAAiB,iBAC9B,oBAAoB,MAAM,QAAQ,CAAC,MACjC,iBAAiB,eACrB;AAEA,gBAAQ,KAAK,CAAC,GAAG,kBAAkB,CAAC;AAAA,MACtC;AACI,UAAA,cAAc,iBAAiB,eAAe;AAEhD,2BAAmB,IAAI;AACvB;AAAA,MACF;AAAA,IACF;AACA,YAAQ,UAAU;AAAA,EACpB;AAGM,QAAA,wBAAwB,oBAAoB,MAAM,OAAO;AAC/D,MAAI,uBAAuB;AACzB,UAAM,kBAAkB,SAAS,sBAAsB,CAAC,CAAC;AACzD,QAAI,cAAc,MAAM;AAEf,aAAA,cAAc,iBAAiB,cAAc;AAClD,2BAAmB,KAAK,IAAI;AAC5B,gBAAQ,KAAK,CAAC,GAAG,kBAAkB,CAAC;AAAA,MACtC;AAAA,IAAA,OACK;AAEG,cAAA,KAAK,CAAC,eAAe,CAAC;AAAA,IAChC;AAAA,EACF;AAEO,SAAA;AACT;"}
1
+ {"version":3,"file":"optionValueDecoder.mjs","sources":["../../src/optionValueDecoder.ts"],"sourcesContent":["/**\n * This file provides utility functions for determining whether or not an option value combination is present in an encoded option value string.\n *\n * In V1 of the encoding strategy, option value arrays are encoded as a trie with the following rules:\n * - `:` `,` ` ` and `-` are control characters.\n * - `:` indicates a new option. ex: 0:1 indicates value 0 for the option in position 1, value 1 for the option in position 2.\n * - `,` indicates the end of a repeated prefix, mulitple consecutive commas indicate the end of multiple repeated prefixes.\n * - ` ` indicates a gap in the sequence of option values. ex: `0 4` indicates option values in position 0 and 4 are present.\n * - `-` indicates a continuous range of option values. ex: `0 1-3 4`. Ranges are only present encoded in the final option value position, so for example the trie for the set [[0,0,0],[0,0,1], ..., [0,2,2]] will be structured as `0:0:0-2,1:0-2,2:0-2`, not `0:0-2:0-2`.\n */\n\nimport {Product} from './storefront-api-types.js';\n\nconst OPTION_VALUE_SEPARATOR = ',';\n\nconst V1_CONTROL_CHARS = {\n OPTION: ':',\n END_OF_PREFIX: ',',\n SEQUENCE_GAP: ' ',\n RANGE: '-',\n};\n\nexport type IsOptionValueCombinationInEncodedVariant = (\n targetOptionValueCombination: number[],\n encodedVariantField: string,\n) => boolean;\n\n/**\n * Determine whether an option value combination is present in an encoded option value string. Function is memoized by encodedVariantField.\n *\n * @param targetOptionValueCombination - Indices of option values to look up in the encoded option value string. A partial set of indices may be passed to determine whether a node or any children is present. For example, if a product has 3 options, passing [0] will return true if any option value combination for the first option's option value is present in the encoded string.\n * @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/2025-01/objects/Product#field-encodedvariantexistence) or [product.encodedVariantAvailability](/docs/api/storefront/2025-01/objects/Product#field-encodedvariantavailability)\n * @returns - True if a full or partial targetOptionValueIndices is present in the encoded option value string, false otherwise.\n */\nexport const isOptionValueCombinationInEncodedVariant: IsOptionValueCombinationInEncodedVariant =\n ((): IsOptionValueCombinationInEncodedVariant => {\n const decodedOptionValues = new Map<string, Set<string>>();\n\n return function (\n targetOptionValueCombination: number[],\n encodedVariantField: string,\n ): boolean {\n if (targetOptionValueCombination.length === 0) {\n return false;\n }\n\n if (!decodedOptionValues.has(encodedVariantField)) {\n const decodedOptionValuesSet = new Set<string>();\n\n for (const optionValue of decodeEncodedVariant(encodedVariantField)) {\n // add the complete option value to the decoded option values set\n decodedOptionValuesSet.add(optionValue.join(OPTION_VALUE_SEPARATOR));\n\n // add all composite parts of the option value to the decoded option values set. e.g. if the option value is [0,1,2], add \"0\", \"0,1\", \"0,1,2\"\n for (let i = 0; i < optionValue.length; i++) {\n decodedOptionValuesSet.add(\n optionValue.slice(0, i + 1).join(OPTION_VALUE_SEPARATOR),\n );\n }\n }\n\n decodedOptionValues.set(encodedVariantField, decodedOptionValuesSet);\n }\n\n return Boolean(\n decodedOptionValues\n .get(encodedVariantField)\n ?.has(targetOptionValueCombination.join(OPTION_VALUE_SEPARATOR)),\n );\n };\n })();\n\ntype EncodedVariantField =\n | Product['encodedVariantAvailability']\n // eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents\n | Product['encodedVariantExistence'];\ntype DecodedOptionValues = number[][];\n\n/**\n * For an encoded option value string, decode into option value combinations. Entries represent a valid combination formatted as an array of option value positions.\n * @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/2025-01/objects/Product#field-encodedvariantexistence) or [product.encodedVariantAvailability](/docs/api/storefront/2025-01/objects/Product#field-encodedvariantavailability)\n * @returns Decoded option value combinations\n */\nexport function decodeEncodedVariant(\n encodedVariantField: EncodedVariantField,\n): DecodedOptionValues {\n if (!encodedVariantField) return [];\n\n if (encodedVariantField.startsWith('v1_')) {\n return v1Decoder(stripVersion(encodedVariantField));\n }\n\n throw new Error('Unsupported option value encoding');\n}\n\nconst stripVersion: (encodedVariantField: string) => string = (\n encodedVariantField: string,\n) => encodedVariantField.replace(/^v1_/, '');\n\n/**\n * We encode an array of arrays representing variants, expressed in terms of options and option values, as a trie.\n *\n * This encoding strategy allows extremely large numbers of variants to be expressed in an extremely compact data structure.\n *\n * Integers represent option and values, so [0,0,0] represents option_value at array index 0 for the options at array indexes 0, 1 and 2\n *\n * `:`, `,`, ` ` and `-` are control characters.\n * `:` indicates a new option\n * `,` indicates the end of a repeated prefix, mulitple consecutive commas indicate the end of multiple repeated prefixes.\n * ` ` indicates a gap in the sequence of option values\n * `-` indicates a continuous range of option values\n *\n * Encoding process:\n *\n * example input array: [[0,0,0], [0,1,0], [0,1,1], [1,0,0], [1,0,1], [1,1,1], [2,0,1], [2,1,0]]\n *\n * step 1: encode as string: \"0:0:0,0:1:0,0:1:1,1:0:0,1:0:1,1:1:1,2:0:1,2:1:0,\"\n * step 2: combine nodes that share a prefix: \"0:0:0,0:1:0 1,1:0:0 1,1:1:1,2:0:1,2:1:0,\"\n * step 3: encode data as a trie so no prefixes need to be repeated: \"0:0:0,1:0 1,,1:0:0 1,1:1,,2:0:1,1:0,,\"\n * step 4: since the options are sorted, use a dash to express ranges: \"0:0:0,1:0-1,,1:0:0-1,1:1,,2:0:1,1:0,,\"\n */\nfunction v1Decoder(encodedVariantField: string): number[][] {\n const tokenizer = /[ :,-]/g;\n let index = 0;\n let token: RegExpExecArray | null;\n const options: number[][] = [];\n const currentOptionValue: number[] = [];\n let depth = 0;\n let rangeStart: number | null = null;\n\n // iterate over control characters\n while ((token = tokenizer.exec(encodedVariantField))) {\n const operation = token[0];\n const optionValueIndex =\n Number.parseInt(encodedVariantField.slice(index, token.index)) || 0;\n\n if (rangeStart !== null) {\n // If a range has been started, iterate over the range and add each option value to the list of options\n // - `rangeStart` is set if the last control char was a dash, e.g. `0` for 0-2. It represents the numeric option value position for the start of the range.\n // - `optionValueIndex` is the numeric option value position for the end of the range\n for (; rangeStart < optionValueIndex; rangeStart++) {\n currentOptionValue[depth] = rangeStart;\n options.push([...currentOptionValue]);\n }\n // indicates the range has been processed\n rangeStart = null;\n }\n\n currentOptionValue[depth] = optionValueIndex;\n\n if (operation === V1_CONTROL_CHARS.RANGE) {\n // dash operation indicates we are in a range. e.g. 0-2 means option values 0, 1, 2\n rangeStart = optionValueIndex;\n } else if (operation === V1_CONTROL_CHARS.OPTION) {\n // colon operation indicates that we are moving down to the next layer of option values. e.g. 0:0:0-2 means we traverse down from option1 to option3 and represents [[0,0,0], [0,0,1], [0,0,2]]\n depth++;\n } else {\n if (\n operation === V1_CONTROL_CHARS.SEQUENCE_GAP ||\n (operation === V1_CONTROL_CHARS.END_OF_PREFIX &&\n encodedVariantField[token.index - 1] !==\n V1_CONTROL_CHARS.END_OF_PREFIX)\n ) {\n // add the current option value to the list of options if we hit a gap in our sequence or we are at the end of our depth and need to move back up\n options.push([...currentOptionValue]);\n }\n if (operation === V1_CONTROL_CHARS.END_OF_PREFIX) {\n // go up an option level, trash the last item in currentOptionValue\n currentOptionValue.pop();\n depth--;\n }\n }\n index = tokenizer.lastIndex;\n }\n\n // The while loop only iterates control characters, meaning if an encoded string ends with an index it will not be processed.\n const encodingEndsWithIndex = encodedVariantField.match(/\\d+$/g);\n if (encodingEndsWithIndex) {\n const finalValueIndex = parseInt(encodingEndsWithIndex[0]);\n if (rangeStart != null) {\n // process final range\n for (; rangeStart <= finalValueIndex; rangeStart++) {\n currentOptionValue[depth] = rangeStart;\n options.push([...currentOptionValue]);\n }\n } else {\n // process final index\n options.push([finalValueIndex]);\n }\n }\n\n return options;\n}\n"],"names":[],"mappings":"AAaA,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AAAA,EACvB,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,cAAc;AAAA,EACd,OAAO;AACT;AAcO,MAAM,2CACsC,uBAAA;AACzC,QAAA,0CAA0B,IAAyB;AAElD,SAAA,SACL,8BACA,qBACS;AA5Bf;AA6BU,QAAA,6BAA6B,WAAW,GAAG;AACtC,aAAA;AAAA,IAAA;AAGT,QAAI,CAAC,oBAAoB,IAAI,mBAAmB,GAAG;AAC3C,YAAA,6CAA6B,IAAY;AAEpC,iBAAA,eAAe,qBAAqB,mBAAmB,GAAG;AAEnE,+BAAuB,IAAI,YAAY,KAAK,sBAAsB,CAAC;AAGnE,iBAAS,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;AACpB,iCAAA;AAAA,YACrB,YAAY,MAAM,GAAG,IAAI,CAAC,EAAE,KAAK,sBAAsB;AAAA,UACzD;AAAA,QAAA;AAAA,MACF;AAGkB,0BAAA,IAAI,qBAAqB,sBAAsB;AAAA,IAAA;AAG9D,WAAA;AAAA,OACL,yBACG,IAAI,mBAAmB,MAD1B,mBAEI,IAAI,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,wBAAwB,oBAAoB,MAAM,OAAO;AAC/D,MAAI,uBAAuB;AACzB,UAAM,kBAAkB,SAAS,sBAAsB,CAAC,CAAC;AACzD,QAAI,cAAc,MAAM;AAEf,aAAA,cAAc,iBAAiB,cAAc;AAClD,2BAAmB,KAAK,IAAI;AAC5B,gBAAQ,KAAK,CAAC,GAAG,kBAAkB,CAAC;AAAA,MAAA;AAAA,IACtC,OACK;AAEG,cAAA,KAAK,CAAC,eAAe,CAAC;AAAA,IAAA;AAAA,EAChC;AAGK,SAAA;AACT;"}
@@ -1,4 +1,4 @@
1
- const version = "2025.1.2";
1
+ const version = "2025.1.4";
2
2
  export {
3
3
  version
4
4
  };
@@ -29,6 +29,7 @@ function parseMetafield(metafield) {
29
29
  ...metafield,
30
30
  parsedValue: metafield.value
31
31
  };
32
+ // TODO: 'money' should probably be parsed even further to like `useMoney()`, but that logic needs to be extracted first so it's not a hook
32
33
  case "dimension":
33
34
  case "money":
34
35
  case "json":
@@ -99,8 +100,7 @@ function parseMetafield(metafield) {
99
100
  function parseJSON(json) {
100
101
  if (String(json).includes("__proto__")) {
101
102
  return JSON.parse(json, (k, v) => {
102
- if (k !== "__proto__")
103
- return v;
103
+ if (k !== "__proto__") return v;
104
104
  });
105
105
  }
106
106
  return JSON.parse(json);
@@ -1 +1 @@
1
- {"version":3,"file":"parse-metafield.mjs","sources":["../../src/parse-metafield.ts"],"sourcesContent":["import type {\n Collection,\n GenericFile,\n Metafield as MetafieldBaseType,\n MoneyV2,\n Page,\n Product,\n ProductVariant,\n} from './storefront-api-types.js';\nimport type {PartialDeep, Simplify} from 'type-fest';\nimport {flattenConnection} from './flatten-connection.js';\nimport {RootASTNode as RichTextRootASTNode} from './RichText.types.js';\n\n/**\n * A function that uses `metafield.type` to parse the Metafield's `value` or `reference` or `references` (depending on the `metafield.type`) and places the result in `metafield.parsedValue`\n *\n * TypeScript developers can use the type `ParsedMetafields` from this package to get the returned object's type correct. For example:\n *\n * ```\n * parseMetafield<ParsedMetafields['boolean']>({type: 'boolean', value: 'false'}\n * ```\n */\nexport function parseMetafield<ReturnGeneric>(\n metafield: PartialDeep<MetafieldBaseType, {recurseIntoArrays: true}>,\n): ReturnGeneric {\n if (!metafield.type) {\n const noTypeError = `parseMetafield(): The 'type' field is required in order to parse the Metafield.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noTypeError);\n } else {\n console.error(`${noTypeError} Returning 'parsedValue' of 'null'`);\n return {\n ...metafield,\n parsedValue: null,\n } as ReturnGeneric;\n }\n }\n\n switch (metafield.type) {\n case 'boolean':\n return {\n ...metafield,\n parsedValue: metafield.value === 'true',\n } as ReturnGeneric;\n\n case 'collection_reference':\n case 'file_reference':\n case 'page_reference':\n case 'product_reference':\n case 'variant_reference':\n return {\n ...metafield,\n parsedValue: metafield.reference,\n } as ReturnGeneric;\n\n case 'color':\n case 'multi_line_text_field':\n case 'single_line_text_field':\n case 'url':\n return {\n ...metafield,\n parsedValue: metafield.value,\n } as ReturnGeneric;\n\n // TODO: 'money' should probably be parsed even further to like `useMoney()`, but that logic needs to be extracted first so it's not a hook\n case 'dimension':\n case 'money':\n case 'json':\n case 'rating':\n case 'volume':\n case 'weight':\n case 'rich_text_field':\n case 'list.color':\n case 'list.dimension':\n case 'list.number_integer':\n case 'list.number_decimal':\n case 'list.rating':\n case 'list.single_line_text_field':\n case 'list.url':\n case 'list.volume':\n case 'list.weight': {\n let parsedValue = null;\n try {\n parsedValue = parseJSON(metafield.value ?? '');\n } catch (err) {\n const parseError = `parseMetafield(): attempted to JSON.parse the 'metafield.value' property, but failed.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(parseError);\n } else {\n console.error(`${parseError} Returning 'null' for 'parsedValue'`);\n }\n parsedValue = null;\n }\n return {\n ...metafield,\n parsedValue,\n } as ReturnGeneric;\n }\n\n case 'date':\n case 'date_time':\n return {\n ...metafield,\n parsedValue: new Date(metafield.value ?? ''),\n } as ReturnGeneric;\n\n case 'list.date':\n case 'list.date_time': {\n const jsonParseValue = parseJSON(metafield?.value ?? '') as string[];\n return {\n ...metafield,\n parsedValue: jsonParseValue.map((dateString) => new Date(dateString)),\n } as ReturnGeneric;\n }\n\n case 'number_decimal':\n case 'number_integer':\n return {\n ...metafield,\n parsedValue: Number(metafield.value),\n } as ReturnGeneric;\n\n case 'list.collection_reference':\n case 'list.file_reference':\n case 'list.page_reference':\n case 'list.product_reference':\n case 'list.variant_reference':\n return {\n ...metafield,\n parsedValue: flattenConnection(metafield.references ?? undefined),\n } as ReturnGeneric;\n\n default: {\n const typeNotFoundError = `parseMetafield(): the 'metafield.type' you passed in is not supported. Your type: \"${metafield.type}\". If you believe this is an error, please open an issue on GitHub.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(typeNotFoundError);\n } else {\n console.error(\n `${typeNotFoundError} Returning 'parsedValue' of 'null'`,\n );\n return {\n ...metafield,\n parsedValue: null,\n } as ReturnGeneric;\n }\n }\n }\n}\n\n/**\n * Parses a JSON string while preventing prototype injection attacks.\n */\nexport function parseJSON(json: string): unknown {\n if (String(json).includes('__proto__')) {\n return JSON.parse(json, (k, v) => {\n if (k !== '__proto__') return v as unknown;\n }) as unknown;\n }\n return JSON.parse(json) as unknown;\n}\n\n// taken from https://shopify.dev/apps/metafields/types\nexport const allMetafieldTypesArray = [\n 'boolean',\n 'collection_reference',\n 'color',\n 'date',\n 'date_time',\n 'dimension',\n 'file_reference',\n 'json',\n 'money',\n 'rich_text_field',\n 'multi_line_text_field',\n 'number_decimal',\n 'number_integer',\n 'page_reference',\n 'product_reference',\n 'rating',\n 'single_line_text_field',\n 'url',\n 'variant_reference',\n 'volume',\n 'weight',\n // list metafields\n 'list.collection_reference',\n 'list.color',\n 'list.date',\n 'list.date_time',\n 'list.dimension',\n 'list.file_reference',\n 'list.number_integer',\n 'list.number_decimal',\n 'list.page_reference',\n 'list.product_reference',\n 'list.rating',\n 'list.single_line_text_field',\n 'list.url',\n 'list.variant_reference',\n 'list.volume',\n 'list.weight',\n] as const;\n\n/** A union of all the supported `metafield.type`s */\nexport type MetafieldTypeTypes = (typeof allMetafieldTypesArray)[number];\n\n/**\n * A mapping of a Metafield's `type` to the TypeScript type that is returned from `parseMetafield()`\n * For example, when using `parseMetafield()`, the type will be correctly returned when used like the following:\n *\n * ```\n * const parsedMetafield = parseMetafield<ParsedMetafields['boolean']>(metafield);`\n * ```\n * `parsedMetafield.parsedValue`'s type is now `boolean`\n */\nexport type ParsedMetafields<ExtraTypeGeneric = void> = {\n /** A Metafield that's been parsed, with a `parsedValue` of `boolean` */\n boolean: Simplify<BooleanParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of a `Collection` object (as defined by the Storefront API) */\n collection_reference: Simplify<CollectionParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `string` */\n color: Simplify<ColorParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Date` */\n date: Simplify<DatesParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Date` */\n date_time: Simplify<DatesParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Measurement` */\n dimension: Simplify<MeasurementParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of a `GenericFile` object (as defined by the Storefront API) */\n file_reference: Simplify<FileRefParsedMetafield>;\n /**\n * A Metafield that's been parsed, with a `parsedValue` of type `unknown`, unless you pass in the type as a generic. For example:\n *\n * ```\n * ParsedMetafields<MyJsonType>['json']\n * ```\n */\n json: Simplify<JsonParsedMetafield<ExtraTypeGeneric>>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Money` */\n money: Simplify<MoneyParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `string` */\n multi_line_text_field: Simplify<TextParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `number` */\n number_decimal: Simplify<NumberParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `number` */\n number_integer: Simplify<NumberParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of a `Page` object (as defined by the Storefront API) */\n page_reference: Simplify<PageParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of a `Product` object (as defined by the Storefront API) */\n product_reference: Simplify<ProductParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Rating` */\n rating: Simplify<RatingParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Rating` */\n rich_text_field: Simplify<RichTextParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `string` */\n single_line_text_field: Simplify<TextParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `string` */\n url: Simplify<TextParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of a `ProductVariant` object (as defined by the Storefront API) */\n variant_reference: Simplify<VariantParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Measurement` */\n volume: Simplify<MeasurementParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Measurement` */\n weight: Simplify<MeasurementParsedMetafield>;\n // list metafields\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Collection` objects (as defined by the Storefront API) */\n 'list.collection_reference': Simplify<CollectionListParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of strings */\n 'list.color': Simplify<ColorListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of Date objects */\n 'list.date': Simplify<DatesListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of Date objects */\n 'list.date_time': Simplify<DatesListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Measurement` objects */\n 'list.dimension': Simplify<MeasurementListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `GenericFile` objects (as defined by the Storefront API) */\n 'list.file_reference': Simplify<FileListParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of numbers */\n 'list.number_integer': Simplify<NumberListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of numbers */\n 'list.number_decimal': Simplify<NumberListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Page` objects (as defined by the Storefront API) */\n 'list.page_reference': Simplify<PageListParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Product` objects (as defined by the Storefront API) */\n 'list.product_reference': Simplify<ProductListParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Rating`s */\n 'list.rating': Simplify<RatingListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of strings */\n 'list.single_line_text_field': Simplify<TextListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of strings */\n 'list.url': Simplify<TextListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `ProductVariant` objects (as defined by the Storefront API) */\n 'list.variant_reference': Simplify<VariantListParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Measurement`s */\n 'list.volume': Simplify<MeasurementListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Measurement`s */\n 'list.weight': Simplify<MeasurementListParsedMetafield>;\n};\n\ninterface ParsedBase extends MetafieldBaseType {\n type: MetafieldTypeTypes;\n parsedValue: unknown;\n}\n\ninterface BooleanParsedMetafield extends ParsedBase {\n type: 'boolean';\n parsedValue: boolean | null;\n}\ntype CollectionParsedRefMetafield = MetafieldBaseType & {\n type: 'collection_reference';\n parsedValue: Collection | null;\n};\ntype ColorParsedMetafield = MetafieldBaseType & {\n type: 'color';\n parsedValue: string | null;\n};\ntype DatesParsedMetafield = MetafieldBaseType & {\n type: 'date' | 'date_time';\n parsedValue: Date | null;\n};\n\ntype MeasurementParsedMetafield = MetafieldBaseType & {\n type: 'dimension' | 'weight' | 'volume';\n parsedValue: Measurement | null;\n};\n\ntype FileRefParsedMetafield = MetafieldBaseType & {\n type: 'file_reference';\n parsedValue: GenericFile | null;\n};\n\ntype JsonParsedMetafield<JsonTypeGeneric = void> = MetafieldBaseType & {\n type: 'json';\n parsedValue: JsonTypeGeneric extends void ? unknown : JsonTypeGeneric | null;\n};\n\ntype MoneyParsedMetafield = MetafieldBaseType & {\n type: 'money';\n parsedValue: MoneyV2 | null;\n};\n\ntype TextParsedMetafield = MetafieldBaseType & {\n type: 'single_line_text_field' | 'multi_line_text_field' | 'url';\n parsedValue: string | null;\n};\n\ntype NumberParsedMetafield = MetafieldBaseType & {\n type: 'number_decimal' | 'number_integer';\n parsedValue: number | null;\n};\n\ntype PageParsedRefMetafield = MetafieldBaseType & {\n type: 'page_reference';\n parsedValue: Page | null;\n};\n\ntype ProductParsedRefMetafield = MetafieldBaseType & {\n type: 'product_reference';\n parsedValue: Product | null;\n};\n\ntype RatingParsedMetafield = MetafieldBaseType & {\n type: 'rating';\n parsedValue: Rating | null;\n};\n\ntype RichTextParsedMetafield = MetafieldBaseType & {\n type: 'rich_text_field';\n parsedValue: RichTextRootASTNode | null;\n};\n\ntype VariantParsedRefMetafield = MetafieldBaseType & {\n type: 'variant_reference';\n parsedValue: ProductVariant | null;\n};\n\ntype CollectionListParsedRefMetafield = MetafieldBaseType & {\n type: 'list.collection_reference';\n parsedValue: Array<Collection> | null;\n};\n\ntype ColorListParsedMetafield = MetafieldBaseType & {\n type: 'list.color';\n parsedValue: Array<string> | null;\n};\n\ntype DatesListParsedMetafield = MetafieldBaseType & {\n type: 'list.date' | 'list.date_time';\n parsedValue: Array<Date> | null;\n};\n\ntype MeasurementListParsedMetafield = MetafieldBaseType & {\n type: 'list.dimension' | 'list.weight' | 'list.volume';\n parsedValue: Array<Measurement> | null;\n};\n\ntype FileListParsedRefMetafield = MetafieldBaseType & {\n type: 'list.file_reference';\n parsedValue: Array<GenericFile> | null;\n};\n\ntype TextListParsedMetafield = MetafieldBaseType & {\n type: 'list.single_line_text_field' | 'list.url';\n parsedValue: Array<string> | null;\n};\n\ntype NumberListParsedMetafield = MetafieldBaseType & {\n type: 'list.number_decimal' | 'list.number_integer';\n parsedValue: Array<number> | null;\n};\n\ntype PageListParsedRefMetafield = MetafieldBaseType & {\n type: 'list.page_reference';\n parsedValue: Array<Page> | null;\n};\n\ntype ProductListParsedRefMetafield = MetafieldBaseType & {\n type: 'list.product_reference';\n parsedValue: Array<Product> | null;\n};\n\ntype RatingListParsedMetafield = MetafieldBaseType & {\n type: 'list.rating';\n parsedValue: Array<Rating> | null;\n};\n\ntype VariantListParsedRefMetafield = MetafieldBaseType & {\n type: 'list.variant_reference';\n parsedValue: Array<ProductVariant> | null;\n};\n\nexport type Measurement = {\n unit: string;\n value: number;\n};\n\nexport interface Rating {\n value: number;\n scale_min: number;\n scale_max: number;\n}\n"],"names":[],"mappings":";AAsBO,SAAS,eACd,WACe;AACX,MAAA,CAAC,UAAU,MAAM;AACnB,UAAM,cAAc;AACE;AACd,YAAA,IAAI,MAAM,WAAW;AAAA,IAO7B;AAAA,EACF;AAEA,UAAQ,UAAU,MAAM;AAAA,IACtB,KAAK;AACI,aAAA;AAAA,QACL,GAAG;AAAA,QACH,aAAa,UAAU,UAAU;AAAA,MAAA;AAAA,IAGrC,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACI,aAAA;AAAA,QACL,GAAG;AAAA,QACH,aAAa,UAAU;AAAA,MAAA;AAAA,IAG3B,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACI,aAAA;AAAA,QACL,GAAG;AAAA,QACH,aAAa,UAAU;AAAA,MAAA;AAAA,IAI3B,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;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se-metafield.mjs","sources":["../../src/parse-metafield.ts"],"sourcesContent":["import type {\n Collection,\n GenericFile,\n Metafield as MetafieldBaseType,\n MoneyV2,\n Page,\n Product,\n ProductVariant,\n} from './storefront-api-types.js';\nimport type {PartialDeep, Simplify} from 'type-fest';\nimport {flattenConnection} from './flatten-connection.js';\nimport {RootASTNode as RichTextRootASTNode} from './RichText.types.js';\n\n/**\n * A function that uses `metafield.type` to parse the Metafield's `value` or `reference` or `references` (depending on the `metafield.type`) and places the result in `metafield.parsedValue`\n *\n * TypeScript developers can use the type `ParsedMetafields` from this package to get the returned object's type correct. For example:\n *\n * ```\n * parseMetafield<ParsedMetafields['boolean']>({type: 'boolean', value: 'false'}\n * ```\n */\nexport function parseMetafield<ReturnGeneric>(\n metafield: PartialDeep<MetafieldBaseType, {recurseIntoArrays: true}>,\n): ReturnGeneric {\n if (!metafield.type) {\n const noTypeError = `parseMetafield(): The 'type' field is required in order to parse the Metafield.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noTypeError);\n } else {\n console.error(`${noTypeError} Returning 'parsedValue' of 'null'`);\n return {\n ...metafield,\n parsedValue: null,\n } as ReturnGeneric;\n }\n }\n\n switch (metafield.type) {\n case 'boolean':\n return {\n ...metafield,\n parsedValue: metafield.value === 'true',\n } as ReturnGeneric;\n\n case 'collection_reference':\n case 'file_reference':\n case 'page_reference':\n case 'product_reference':\n case 'variant_reference':\n return {\n ...metafield,\n parsedValue: metafield.reference,\n } as ReturnGeneric;\n\n case 'color':\n case 'multi_line_text_field':\n case 'single_line_text_field':\n case 'url':\n return {\n ...metafield,\n parsedValue: metafield.value,\n } as ReturnGeneric;\n\n // TODO: 'money' should probably be parsed even further to like `useMoney()`, but that logic needs to be extracted first so it's not a hook\n case 'dimension':\n case 'money':\n case 'json':\n case 'rating':\n case 'volume':\n case 'weight':\n case 'rich_text_field':\n case 'list.color':\n case 'list.dimension':\n case 'list.number_integer':\n case 'list.number_decimal':\n case 'list.rating':\n case 'list.single_line_text_field':\n case 'list.url':\n case 'list.volume':\n case 'list.weight': {\n let parsedValue = null;\n try {\n parsedValue = parseJSON(metafield.value ?? '');\n } catch (err) {\n const parseError = `parseMetafield(): attempted to JSON.parse the 'metafield.value' property, but failed.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(parseError);\n } else {\n console.error(`${parseError} Returning 'null' for 'parsedValue'`);\n }\n parsedValue = null;\n }\n return {\n ...metafield,\n parsedValue,\n } as ReturnGeneric;\n }\n\n case 'date':\n case 'date_time':\n return {\n ...metafield,\n parsedValue: new Date(metafield.value ?? ''),\n } as ReturnGeneric;\n\n case 'list.date':\n case 'list.date_time': {\n const jsonParseValue = parseJSON(metafield?.value ?? '') as string[];\n return {\n ...metafield,\n parsedValue: jsonParseValue.map((dateString) => new Date(dateString)),\n } as ReturnGeneric;\n }\n\n case 'number_decimal':\n case 'number_integer':\n return {\n ...metafield,\n parsedValue: Number(metafield.value),\n } as ReturnGeneric;\n\n case 'list.collection_reference':\n case 'list.file_reference':\n case 'list.page_reference':\n case 'list.product_reference':\n case 'list.variant_reference':\n return {\n ...metafield,\n parsedValue: flattenConnection(metafield.references ?? undefined),\n } as ReturnGeneric;\n\n default: {\n const typeNotFoundError = `parseMetafield(): the 'metafield.type' you passed in is not supported. Your type: \"${metafield.type}\". If you believe this is an error, please open an issue on GitHub.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(typeNotFoundError);\n } else {\n console.error(\n `${typeNotFoundError} Returning 'parsedValue' of 'null'`,\n );\n return {\n ...metafield,\n parsedValue: null,\n } as ReturnGeneric;\n }\n }\n }\n}\n\n/**\n * Parses a JSON string while preventing prototype injection attacks.\n */\nexport function parseJSON(json: string): unknown {\n if (String(json).includes('__proto__')) {\n return JSON.parse(json, (k, v) => {\n if (k !== '__proto__') return v as unknown;\n }) as unknown;\n }\n return JSON.parse(json) as unknown;\n}\n\n// taken from https://shopify.dev/apps/metafields/types\nexport const allMetafieldTypesArray = [\n 'boolean',\n 'collection_reference',\n 'color',\n 'date',\n 'date_time',\n 'dimension',\n 'file_reference',\n 'json',\n 'money',\n 'rich_text_field',\n 'multi_line_text_field',\n 'number_decimal',\n 'number_integer',\n 'page_reference',\n 'product_reference',\n 'rating',\n 'single_line_text_field',\n 'url',\n 'variant_reference',\n 'volume',\n 'weight',\n // list metafields\n 'list.collection_reference',\n 'list.color',\n 'list.date',\n 'list.date_time',\n 'list.dimension',\n 'list.file_reference',\n 'list.number_integer',\n 'list.number_decimal',\n 'list.page_reference',\n 'list.product_reference',\n 'list.rating',\n 'list.single_line_text_field',\n 'list.url',\n 'list.variant_reference',\n 'list.volume',\n 'list.weight',\n] as const;\n\n/** A union of all the supported `metafield.type`s */\nexport type MetafieldTypeTypes = (typeof allMetafieldTypesArray)[number];\n\n/**\n * A mapping of a Metafield's `type` to the TypeScript type that is returned from `parseMetafield()`\n * For example, when using `parseMetafield()`, the type will be correctly returned when used like the following:\n *\n * ```\n * const parsedMetafield = parseMetafield<ParsedMetafields['boolean']>(metafield);`\n * ```\n * `parsedMetafield.parsedValue`'s type is now `boolean`\n */\nexport type ParsedMetafields<ExtraTypeGeneric = void> = {\n /** A Metafield that's been parsed, with a `parsedValue` of `boolean` */\n boolean: Simplify<BooleanParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of a `Collection` object (as defined by the Storefront API) */\n collection_reference: Simplify<CollectionParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `string` */\n color: Simplify<ColorParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Date` */\n date: Simplify<DatesParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Date` */\n date_time: Simplify<DatesParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Measurement` */\n dimension: Simplify<MeasurementParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of a `GenericFile` object (as defined by the Storefront API) */\n file_reference: Simplify<FileRefParsedMetafield>;\n /**\n * A Metafield that's been parsed, with a `parsedValue` of type `unknown`, unless you pass in the type as a generic. For example:\n *\n * ```\n * ParsedMetafields<MyJsonType>['json']\n * ```\n */\n json: Simplify<JsonParsedMetafield<ExtraTypeGeneric>>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Money` */\n money: Simplify<MoneyParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `string` */\n multi_line_text_field: Simplify<TextParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `number` */\n number_decimal: Simplify<NumberParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `number` */\n number_integer: Simplify<NumberParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of a `Page` object (as defined by the Storefront API) */\n page_reference: Simplify<PageParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of a `Product` object (as defined by the Storefront API) */\n product_reference: Simplify<ProductParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Rating` */\n rating: Simplify<RatingParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Rating` */\n rich_text_field: Simplify<RichTextParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `string` */\n single_line_text_field: Simplify<TextParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `string` */\n url: Simplify<TextParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of a `ProductVariant` object (as defined by the Storefront API) */\n variant_reference: Simplify<VariantParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Measurement` */\n volume: Simplify<MeasurementParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of type `Measurement` */\n weight: Simplify<MeasurementParsedMetafield>;\n // list metafields\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Collection` objects (as defined by the Storefront API) */\n 'list.collection_reference': Simplify<CollectionListParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of strings */\n 'list.color': Simplify<ColorListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of Date objects */\n 'list.date': Simplify<DatesListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of Date objects */\n 'list.date_time': Simplify<DatesListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Measurement` objects */\n 'list.dimension': Simplify<MeasurementListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `GenericFile` objects (as defined by the Storefront API) */\n 'list.file_reference': Simplify<FileListParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of numbers */\n 'list.number_integer': Simplify<NumberListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of numbers */\n 'list.number_decimal': Simplify<NumberListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Page` objects (as defined by the Storefront API) */\n 'list.page_reference': Simplify<PageListParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Product` objects (as defined by the Storefront API) */\n 'list.product_reference': Simplify<ProductListParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Rating`s */\n 'list.rating': Simplify<RatingListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of strings */\n 'list.single_line_text_field': Simplify<TextListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of strings */\n 'list.url': Simplify<TextListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `ProductVariant` objects (as defined by the Storefront API) */\n 'list.variant_reference': Simplify<VariantListParsedRefMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Measurement`s */\n 'list.volume': Simplify<MeasurementListParsedMetafield>;\n /** A Metafield that's been parsed, with a `parsedValue` of an array of `Measurement`s */\n 'list.weight': Simplify<MeasurementListParsedMetafield>;\n};\n\ninterface ParsedBase extends MetafieldBaseType {\n type: MetafieldTypeTypes;\n parsedValue: unknown;\n}\n\ninterface BooleanParsedMetafield extends ParsedBase {\n type: 'boolean';\n parsedValue: boolean | null;\n}\ntype CollectionParsedRefMetafield = MetafieldBaseType & {\n type: 'collection_reference';\n parsedValue: Collection | null;\n};\ntype ColorParsedMetafield = MetafieldBaseType & {\n type: 'color';\n parsedValue: string | null;\n};\ntype DatesParsedMetafield = MetafieldBaseType & {\n type: 'date' | 'date_time';\n parsedValue: Date | null;\n};\n\ntype MeasurementParsedMetafield = MetafieldBaseType & {\n type: 'dimension' | 'weight' | 'volume';\n parsedValue: Measurement | null;\n};\n\ntype FileRefParsedMetafield = MetafieldBaseType & {\n type: 'file_reference';\n parsedValue: GenericFile | null;\n};\n\ntype JsonParsedMetafield<JsonTypeGeneric = void> = MetafieldBaseType & {\n type: 'json';\n parsedValue: JsonTypeGeneric extends void ? unknown : JsonTypeGeneric | null;\n};\n\ntype MoneyParsedMetafield = MetafieldBaseType & {\n type: 'money';\n parsedValue: MoneyV2 | null;\n};\n\ntype TextParsedMetafield = MetafieldBaseType & {\n type: 'single_line_text_field' | 'multi_line_text_field' | 'url';\n parsedValue: string | null;\n};\n\ntype NumberParsedMetafield = MetafieldBaseType & {\n type: 'number_decimal' | 'number_integer';\n parsedValue: number | null;\n};\n\ntype PageParsedRefMetafield = MetafieldBaseType & {\n type: 'page_reference';\n parsedValue: Page | null;\n};\n\ntype ProductParsedRefMetafield = MetafieldBaseType & {\n type: 'product_reference';\n parsedValue: Product | null;\n};\n\ntype RatingParsedMetafield = MetafieldBaseType & {\n type: 'rating';\n parsedValue: Rating | null;\n};\n\ntype RichTextParsedMetafield = MetafieldBaseType & {\n type: 'rich_text_field';\n parsedValue: RichTextRootASTNode | null;\n};\n\ntype VariantParsedRefMetafield = MetafieldBaseType & {\n type: 'variant_reference';\n parsedValue: ProductVariant | null;\n};\n\ntype CollectionListParsedRefMetafield = MetafieldBaseType & {\n type: 'list.collection_reference';\n parsedValue: Array<Collection> | null;\n};\n\ntype ColorListParsedMetafield = MetafieldBaseType & {\n type: 'list.color';\n parsedValue: Array<string> | null;\n};\n\ntype DatesListParsedMetafield = MetafieldBaseType & {\n type: 'list.date' | 'list.date_time';\n parsedValue: Array<Date> | null;\n};\n\ntype MeasurementListParsedMetafield = MetafieldBaseType & {\n type: 'list.dimension' | 'list.weight' | 'list.volume';\n parsedValue: Array<Measurement> | null;\n};\n\ntype FileListParsedRefMetafield = MetafieldBaseType & {\n type: 'list.file_reference';\n parsedValue: Array<GenericFile> | null;\n};\n\ntype TextListParsedMetafield = MetafieldBaseType & {\n type: 'list.single_line_text_field' | 'list.url';\n parsedValue: Array<string> | null;\n};\n\ntype NumberListParsedMetafield = MetafieldBaseType & {\n type: 'list.number_decimal' | 'list.number_integer';\n parsedValue: Array<number> | null;\n};\n\ntype PageListParsedRefMetafield = MetafieldBaseType & {\n type: 'list.page_reference';\n parsedValue: Array<Page> | null;\n};\n\ntype ProductListParsedRefMetafield = MetafieldBaseType & {\n type: 'list.product_reference';\n parsedValue: Array<Product> | null;\n};\n\ntype RatingListParsedMetafield = MetafieldBaseType & {\n type: 'list.rating';\n parsedValue: Array<Rating> | null;\n};\n\ntype VariantListParsedRefMetafield = MetafieldBaseType & {\n type: 'list.variant_reference';\n parsedValue: Array<ProductVariant> | null;\n};\n\nexport type Measurement = {\n unit: string;\n value: number;\n};\n\nexport interface Rating {\n value: number;\n scale_min: number;\n scale_max: number;\n}\n"],"names":[],"mappings":";AAsBO,SAAS,eACd,WACe;AACX,MAAA,CAAC,UAAU,MAAM;AACnB,UAAM,cAAc;AACE;AACd,YAAA,IAAI,MAAM,WAAW;AAAA,IAAA;AAAA,EAO7B;AAGF,UAAQ,UAAU,MAAM;AAAA,IACtB,KAAK;AACI,aAAA;AAAA,QACL,GAAG;AAAA,QACH,aAAa,UAAU,UAAU;AAAA,MACnC;AAAA,IAEF,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACI,aAAA;AAAA,QACL,GAAG;AAAA,QACH,aAAa,UA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,cAAc,MAAS;AAAA,MAClE;AAAA,IAEF,SAAS;AACD,YAAA,oBAAoB,sFAAsF,UAAU,IAAI;AACxG;AACd,cAAA,IAAI,MAAM,iBAAiB;AAAA,MAAA;AAAA,IASnC;AAAA,EACF;AAEJ;AAKO,SAAS,UAAU,MAAuB;AAC/C,MAAI,OAAO,IAAI,EAAE,SAAS,WAAW,GAAG;AACtC,WAAO,KAAK,MAAM,MAAM,CAAC,GAAG,MAAM;AAC5B,UAAA,MAAM,YAAoB,QAAA;AAAA,IAAA,CAC/B;AAAA,EAAA;AAEI,SAAA,KAAK,MAAM,IAAI;AACxB;"}
@@ -43,8 +43,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
43
43
  getStorefrontApiUrl(overrideProps) {
44
44
  const domain = getShopifyDomain(overrideProps);
45
45
  const apiUrl = domain + (domain.endsWith("/") ? "api" : "/api");
46
- if (isMockShop(domain))
47
- return apiUrl;
46
+ if (isMockShop(domain)) return apiUrl;
48
47
  return `${apiUrl}/${(overrideProps == null ? void 0 : overrideProps.storefrontApiVersion) ?? storefrontApiVersion}/graphql.json`;
49
48
  },
50
49
  getPrivateTokenHeaders(overrideProps) {
@@ -1 +1 @@
1
- {"version":3,"file":"storefront-client.mjs","sources":["../../src/storefront-client.ts"],"sourcesContent":["import {SFAPI_VERSION} from './storefront-api-constants.js';\n\nexport type StorefrontClientProps = {\n /** The host name of the domain (eg: `{shop}.myshopify.com`). */\n storeDomain?: string;\n /** The Storefront API delegate access token. Refer to the [authentication](https://shopify.dev/api/storefront#authentication) and [delegate access token](https://shopify.dev/apps/auth/oauth/delegate-access-tokens) documentation for more details. */\n privateStorefrontToken?: string;\n /** The Storefront API access token. Refer to the [authentication](https://shopify.dev/api/storefront#authentication) documentation for more details. */\n publicStorefrontToken?: string;\n /** The Storefront API version. This should almost always be the same as the version Hydrogen React was built for. Learn more about Shopify [API versioning](https://shopify.dev/api/usage/versioning) for more details. */\n storefrontApiVersion?: string;\n /**\n * Customizes which `\"content-type\"` header is added when using `getPrivateTokenHeaders()` and `getPublicTokenHeaders()`. When fetching with a `JSON.stringify()`-ed `body`, use `\"json\"`. When fetching with a `body` that is a plain string, use `\"graphql\"`. Defaults to `\"json\"`\n *\n * Can also be customized on a call-by-call basis by passing in `'contentType'` to both `getPrivateTokenHeaders({...})` and `getPublicTokenHeaders({...})`, for example: `getPublicTokenHeaders({contentType: 'graphql'})`\n */\n contentType?: 'json' | 'graphql';\n};\n\nconst MOCK_SHOP_DOMAIN = 'mock.shop';\nconst isMockShop = (domain: string): boolean =>\n domain.includes(MOCK_SHOP_DOMAIN);\n\n/**\n * The `createStorefrontClient()` function creates helpers that enable you to quickly query the Shopify Storefront API.\n *\n * When used on the server, it is recommended to use the `privateStorefrontToken` prop. When used on the client, it is recommended to use the `publicStorefrontToken` prop.\n */\nexport function createStorefrontClient({\n storeDomain,\n privateStorefrontToken,\n publicStorefrontToken,\n storefrontApiVersion = SFAPI_VERSION,\n contentType,\n}: StorefrontClientProps): StorefrontClientReturn {\n if (!storeDomain) {\n if (__HYDROGEN_DEV__) {\n storeDomain = MOCK_SHOP_DOMAIN;\n warnOnce(\n `storeDomain missing, defaulting to ${MOCK_SHOP_DOMAIN}`,\n 'info',\n );\n } else {\n throw new Error(\n H2_PREFIX_ERROR +\n `\\`storeDomain\\` is required when creating a new Storefront client in production.`,\n );\n }\n }\n\n if (storefrontApiVersion !== SFAPI_VERSION) {\n warnOnce(\n `The Storefront API version that you're using is different than the version this build of Hydrogen React is targeting.` +\n `\\nYou may run into unexpected errors if these versions don't match. Received version: \"${storefrontApiVersion}\"; expected version \"${SFAPI_VERSION}\"`,\n );\n }\n\n // only warn if not in a browser environment\n if (\n __HYDROGEN_DEV__ &&\n !privateStorefrontToken &&\n !globalThis.document &&\n !isMockShop(storeDomain)\n ) {\n warnOnce(\n `Using a private storefront token is recommended for server environments.` +\n `\\nRefer to the authentication https://shopify.dev/api/storefront#authentication documentation for more details.`,\n );\n }\n\n // only warn if in a browser environment and you're using the privateStorefrontToken\n if (__HYDROGEN_DEV__ && privateStorefrontToken && globalThis.document) {\n warnOnce(\n 'You are attempting to use a private token in an environment where it can be easily accessed by anyone.' +\n '\\nThis is a security risk; please use the public token and the `publicStorefrontToken` prop',\n );\n }\n\n const getShopifyDomain: StorefrontClientReturn['getShopifyDomain'] = (\n overrideProps,\n ) => {\n const domain = overrideProps?.storeDomain ?? storeDomain;\n return domain.includes('://') ? domain : `https://${domain}`;\n };\n\n return {\n getShopifyDomain,\n getStorefrontApiUrl(overrideProps): string {\n const domain = getShopifyDomain(overrideProps);\n const apiUrl = domain + (domain.endsWith('/') ? 'api' : '/api');\n\n if (isMockShop(domain)) return apiUrl;\n\n return `${apiUrl}/${\n overrideProps?.storefrontApiVersion ?? storefrontApiVersion\n }/graphql.json`;\n },\n getPrivateTokenHeaders(overrideProps): Record<string, string> {\n if (\n !privateStorefrontToken &&\n !overrideProps?.privateStorefrontToken &&\n !isMockShop(storeDomain)\n ) {\n throw new Error(\n H2_PREFIX_ERROR +\n 'You did not pass in a `privateStorefrontToken` while using `createStorefrontClient()` or `getPrivateTokenHeaders()`',\n );\n }\n\n if (__HYDROGEN_DEV__ && !overrideProps?.buyerIp) {\n warnOnce(\n 'It is recommended to pass in the `buyerIp` property which improves analytics and data in the admin.',\n );\n }\n\n const finalContentType = overrideProps?.contentType ?? contentType;\n\n return {\n // default to json\n 'content-type':\n finalContentType === 'graphql'\n ? 'application/graphql'\n : 'application/json',\n 'X-SDK-Variant': 'hydrogen-react',\n 'X-SDK-Variant-Source': 'react',\n 'X-SDK-Version': storefrontApiVersion,\n 'Shopify-Storefront-Private-Token':\n overrideProps?.privateStorefrontToken ?? privateStorefrontToken ?? '',\n ...(overrideProps?.buyerIp\n ? {'Shopify-Storefront-Buyer-IP': overrideProps.buyerIp}\n : {}),\n };\n },\n getPublicTokenHeaders(overrideProps): Record<string, string> {\n if (\n !publicStorefrontToken &&\n !overrideProps?.publicStorefrontToken &&\n !isMockShop(storeDomain)\n ) {\n throw new Error(\n H2_PREFIX_ERROR +\n 'You did not pass in a `publicStorefrontToken` while using `createStorefrontClient()` or `getPublicTokenHeaders()`',\n );\n }\n\n const finalContentType =\n overrideProps?.contentType ?? contentType ?? 'json';\n\n return getPublicTokenHeadersRaw(\n finalContentType,\n storefrontApiVersion,\n overrideProps?.publicStorefrontToken ?? publicStorefrontToken ?? '',\n );\n },\n };\n}\n\nexport function getPublicTokenHeadersRaw(\n contentType: 'graphql' | 'json',\n storefrontApiVersion: string,\n accessToken: string,\n): {\n 'content-type': string;\n 'X-SDK-Variant': string;\n 'X-SDK-Variant-Source': string;\n 'X-SDK-Version': string;\n 'X-Shopify-Storefront-Access-Token': string;\n} {\n return {\n // default to json\n 'content-type':\n contentType === 'graphql' ? 'application/graphql' : 'application/json',\n 'X-SDK-Variant': 'hydrogen-react',\n 'X-SDK-Variant-Source': 'react',\n 'X-SDK-Version': storefrontApiVersion,\n 'X-Shopify-Storefront-Access-Token': accessToken,\n };\n}\n\nconst warnings = new Set<string>();\nconst H2_PREFIX_ERROR = '[h2:error:createStorefrontClient] ';\nconst warnOnce = (string: string, type: 'warn' | 'info' = 'warn'): void => {\n if (!warnings.has(string)) {\n console[type](`[h2:${type}:createStorefrontClient] ` + string);\n warnings.add(string);\n }\n};\n\ntype OverrideTokenHeaderProps = Partial<\n Pick<StorefrontClientProps, 'contentType'>\n>;\n\ntype StorefrontClientReturn = {\n /**\n * Creates the fully-qualified URL to your myshopify.com domain.\n *\n * By default, it will use the config you passed in when calling `createStorefrontClient()`. However, you can override the following settings on each invocation of `getShopifyDomain({...})`:\n *\n * - `storeDomain`\n */\n getShopifyDomain: (\n props?: Partial<Pick<StorefrontClientProps, 'storeDomain'>>,\n ) => string;\n /**\n * Creates the fully-qualified URL to your store's GraphQL endpoint.\n *\n * By default, it will use the config you passed in when calling `createStorefrontClient()`. However, you can override the following settings on each invocation of `getStorefrontApiUrl({...})`:\n *\n * - `storeDomain`\n * - `storefrontApiVersion`\n */\n getStorefrontApiUrl: (\n props?: Partial<\n Pick<StorefrontClientProps, 'storeDomain' | 'storefrontApiVersion'>\n >,\n ) => string;\n /**\n * Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint. This method uses the private Server-to-Server token which reduces the chance of throttling but must not be exposed to clients. Server-side calls should prefer using this over `getPublicTokenHeaders()`.\n *\n * By default, it will use the config you passed in when calling `createStorefrontClient()`. However, you can override the following settings on each invocation of `getPrivateTokenHeaders({...})`:\n *\n * - `contentType`\n * - `privateStorefrontToken`\n * - `buyerIp`\n *\n * Note that `contentType` defaults to what you configured in `createStorefrontClient({...})` and defaults to `'json'`, but a specific call may require using `graphql`. When using `JSON.stringify()` on the `body`, use `'json'`; otherwise, use `'graphql'`.\n */\n getPrivateTokenHeaders: (\n props?: OverrideTokenHeaderProps &\n Pick<StorefrontClientProps, 'privateStorefrontToken'> & {\n /**\n * The client's IP address. Passing this to the Storefront API when using a server-to-server token will help improve your store's analytics data.\n */\n buyerIp?: string;\n },\n ) => Record<string, string>;\n /**\n * Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint. This method uses the public token which increases the chance of throttling but also can be exposed to clients. Server-side calls should prefer using `getPublicTokenHeaders()`.\n *\n * By default, it will use the config you passed in when calling `createStorefrontClient()`. However, you can override the following settings on each invocation of `getPublicTokenHeaders({...})`:\n *\n * - `contentType`\n * - `publicStorefrontToken`\n *\n * Note that `contentType` defaults to what you configured in `createStorefrontClient({...})` and defaults to `'json'`, but a specific call may require using `graphql`. When using `JSON.stringify()` on the `body`, use `'json'`; otherwise, use `'graphql'`.\n */\n getPublicTokenHeaders: (\n props?: OverrideTokenHeaderProps &\n Pick<StorefrontClientProps, 'publicStorefrontToken'>,\n ) => Record<string, string>;\n};\n"],"names":[],"mappings":";AAmBA,MAAM,mBAAmB;AACzB,MAAM,aAAa,CAAC,WAClB,OAAO,SAAS,gBAAgB;AAO3B,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA,u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A0B,0BAA0B;AAAA,QACrE,IAAI,+CAAe,WACf,EAAC,+BAA+B,cAAc,QAAA,IAC9C,CAAC;AAAA,MAAA;AAAA,IAET;AAAA,IACA,sBAAsB,eAAuC;AAEzD,UAAA,CAAC,yBACD,EAAC,+CAAe,0BAChB,CAAC,WAAW,WAAW,GACvB;AACA,cAAM,IAAI;AAAA,UACR,kBACE;AAAA,QAAA;AAAA,MAEN;AAEM,YAAA,oBACJ,+CAAe,gBAAe,eAAe;AAExC,aAAA;AAAA,QACL;AAAA,QACA;AAAA,SACA,+CAAe,0BAAyB,yBAAyB;AAAA,MAAA;AAAA,IAErE;AAAA,EAAA;AAEJ;AAEgB,SAAA,yBACd,aACA,sBACA,aAOA;AACO,SAAA;AAAA;AAAA,IAEL,gBACE,gBAAgB,YAAY,wBAAwB;AAAA,IACtD,iBAAiB;AAAA,IACjB,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,IACjB,qCAAqC;AAAA,EAAA;AAEzC;AAEA,MAAM,+BAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,WAAW,CAAC,QAAgB,OAAwB,WAAiB;AACzE,MAAI,CAAC,SAAS,IAAI,MAAM,GAAG;AACzB,YAAQ,IAAI,EAAE,OAAO,IAAI,8BAA8B,MAAM;AAC7D,aAAS,IAAI,MAAM;AAAA,EACrB;AACF;"}
1
+ {"version":3,"file":"storefront-client.mjs","sources":["../../src/storefront-client.ts"],"sourcesContent":["import {SFAPI_VERSION} from './storefront-api-constants.js';\n\nexport type StorefrontClientProps = {\n /** The host name of the domain (eg: `{shop}.myshopify.com`). */\n storeDomain?: string;\n /** The Storefront API delegate access token. Refer to the [authentication](https://shopify.dev/api/storefront#authentication) and [delegate access token](https://shopify.dev/apps/auth/oauth/delegate-access-tokens) documentation for more details. */\n privateStorefrontToken?: string;\n /** The Storefront API access token. Refer to the [authentication](https://shopify.dev/api/storefront#authentication) documentation for more details. */\n publicStorefrontToken?: string;\n /** The Storefront API version. This should almost always be the same as the version Hydrogen React was built for. Learn more about Shopify [API versioning](https://shopify.dev/api/usage/versioning) for more details. */\n storefrontApiVersion?: string;\n /**\n * Customizes which `\"content-type\"` header is added when using `getPrivateTokenHeaders()` and `getPublicTokenHeaders()`. When fetching with a `JSON.stringify()`-ed `body`, use `\"json\"`. When fetching with a `body` that is a plain string, use `\"graphql\"`. Defaults to `\"json\"`\n *\n * Can also be customized on a call-by-call basis by passing in `'contentType'` to both `getPrivateTokenHeaders({...})` and `getPublicTokenHeaders({...})`, for example: `getPublicTokenHeaders({contentType: 'graphql'})`\n */\n contentType?: 'json' | 'graphql';\n};\n\nconst MOCK_SHOP_DOMAIN = 'mock.shop';\nconst isMockShop = (domain: string): boolean =>\n domain.includes(MOCK_SHOP_DOMAIN);\n\n/**\n * The `createStorefrontClient()` function creates helpers that enable you to quickly query the Shopify Storefront API.\n *\n * When used on the server, it is recommended to use the `privateStorefrontToken` prop. When used on the client, it is recommended to use the `publicStorefrontToken` prop.\n */\nexport function createStorefrontClient({\n storeDomain,\n privateStorefrontToken,\n publicStorefrontToken,\n storefrontApiVersion = SFAPI_VERSION,\n contentType,\n}: StorefrontClientProps): StorefrontClientReturn {\n if (!storeDomain) {\n if (__HYDROGEN_DEV__) {\n storeDomain = MOCK_SHOP_DOMAIN;\n warnOnce(\n `storeDomain missing, defaulting to ${MOCK_SHOP_DOMAIN}`,\n 'info',\n );\n } else {\n throw new Error(\n H2_PREFIX_ERROR +\n `\\`storeDomain\\` is required when creating a new Storefront client in production.`,\n );\n }\n }\n\n if (storefrontApiVersion !== SFAPI_VERSION) {\n warnOnce(\n `The Storefront API version that you're using is different than the version this build of Hydrogen React is targeting.` +\n `\\nYou may run into unexpected errors if these versions don't match. Received version: \"${storefrontApiVersion}\"; expected version \"${SFAPI_VERSION}\"`,\n );\n }\n\n // only warn if not in a browser environment\n if (\n __HYDROGEN_DEV__ &&\n !privateStorefrontToken &&\n !globalThis.document &&\n !isMockShop(storeDomain)\n ) {\n warnOnce(\n `Using a private storefront token is recommended for server environments.` +\n `\\nRefer to the authentication https://shopify.dev/api/storefront#authentication documentation for more details.`,\n );\n }\n\n // only warn if in a browser environment and you're using the privateStorefrontToken\n if (__HYDROGEN_DEV__ && privateStorefrontToken && globalThis.document) {\n warnOnce(\n 'You are attempting to use a private token in an environment where it can be easily accessed by anyone.' +\n '\\nThis is a security risk; please use the public token and the `publicStorefrontToken` prop',\n );\n }\n\n const getShopifyDomain: StorefrontClientReturn['getShopifyDomain'] = (\n overrideProps,\n ) => {\n const domain = overrideProps?.storeDomain ?? storeDomain;\n return domain.includes('://') ? domain : `https://${domain}`;\n };\n\n return {\n getShopifyDomain,\n getStorefrontApiUrl(overrideProps): string {\n const domain = getShopifyDomain(overrideProps);\n const apiUrl = domain + (domain.endsWith('/') ? 'api' : '/api');\n\n if (isMockShop(domain)) return apiUrl;\n\n return `${apiUrl}/${\n overrideProps?.storefrontApiVersion ?? storefrontApiVersion\n }/graphql.json`;\n },\n getPrivateTokenHeaders(overrideProps): Record<string, string> {\n if (\n !privateStorefrontToken &&\n !overrideProps?.privateStorefrontToken &&\n !isMockShop(storeDomain)\n ) {\n throw new Error(\n H2_PREFIX_ERROR +\n 'You did not pass in a `privateStorefrontToken` while using `createStorefrontClient()` or `getPrivateTokenHeaders()`',\n );\n }\n\n if (__HYDROGEN_DEV__ && !overrideProps?.buyerIp) {\n warnOnce(\n 'It is recommended to pass in the `buyerIp` property which improves analytics and data in the admin.',\n );\n }\n\n const finalContentType = overrideProps?.contentType ?? contentType;\n\n return {\n // default to json\n 'content-type':\n finalContentType === 'graphql'\n ? 'application/graphql'\n : 'application/json',\n 'X-SDK-Variant': 'hydrogen-react',\n 'X-SDK-Variant-Source': 'react',\n 'X-SDK-Version': storefrontApiVersion,\n 'Shopify-Storefront-Private-Token':\n overrideProps?.privateStorefrontToken ?? privateStorefrontToken ?? '',\n ...(overrideProps?.buyerIp\n ? {'Shopify-Storefront-Buyer-IP': overrideProps.buyerIp}\n : {}),\n };\n },\n getPublicTokenHeaders(overrideProps): Record<string, string> {\n if (\n !publicStorefrontToken &&\n !overrideProps?.publicStorefrontToken &&\n !isMockShop(storeDomain)\n ) {\n throw new Error(\n H2_PREFIX_ERROR +\n 'You did not pass in a `publicStorefrontToken` while using `createStorefrontClient()` or `getPublicTokenHeaders()`',\n );\n }\n\n const finalContentType =\n overrideProps?.contentType ?? contentType ?? 'json';\n\n return getPublicTokenHeadersRaw(\n finalContentType,\n storefrontApiVersion,\n overrideProps?.publicStorefrontToken ?? publicStorefrontToken ?? '',\n );\n },\n };\n}\n\nexport function getPublicTokenHeadersRaw(\n contentType: 'graphql' | 'json',\n storefrontApiVersion: string,\n accessToken: string,\n): {\n 'content-type': string;\n 'X-SDK-Variant': string;\n 'X-SDK-Variant-Source': string;\n 'X-SDK-Version': string;\n 'X-Shopify-Storefront-Access-Token': string;\n} {\n return {\n // default to json\n 'content-type':\n contentType === 'graphql' ? 'application/graphql' : 'application/json',\n 'X-SDK-Variant': 'hydrogen-react',\n 'X-SDK-Variant-Source': 'react',\n 'X-SDK-Version': storefrontApiVersion,\n 'X-Shopify-Storefront-Access-Token': accessToken,\n };\n}\n\nconst warnings = new Set<string>();\nconst H2_PREFIX_ERROR = '[h2:error:createStorefrontClient] ';\nconst warnOnce = (string: string, type: 'warn' | 'info' = 'warn'): void => {\n if (!warnings.has(string)) {\n console[type](`[h2:${type}:createStorefrontClient] ` + string);\n warnings.add(string);\n }\n};\n\ntype OverrideTokenHeaderProps = Partial<\n Pick<StorefrontClientProps, 'contentType'>\n>;\n\ntype StorefrontClientReturn = {\n /**\n * Creates the fully-qualified URL to your myshopify.com domain.\n *\n * By default, it will use the config you passed in when calling `createStorefrontClient()`. However, you can override the following settings on each invocation of `getShopifyDomain({...})`:\n *\n * - `storeDomain`\n */\n getShopifyDomain: (\n props?: Partial<Pick<StorefrontClientProps, 'storeDomain'>>,\n ) => string;\n /**\n * Creates the fully-qualified URL to your store's GraphQL endpoint.\n *\n * By default, it will use the config you passed in when calling `createStorefrontClient()`. However, you can override the following settings on each invocation of `getStorefrontApiUrl({...})`:\n *\n * - `storeDomain`\n * - `storefrontApiVersion`\n */\n getStorefrontApiUrl: (\n props?: Partial<\n Pick<StorefrontClientProps, 'storeDomain' | 'storefrontApiVersion'>\n >,\n ) => string;\n /**\n * Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint. This method uses the private Server-to-Server token which reduces the chance of throttling but must not be exposed to clients. Server-side calls should prefer using this over `getPublicTokenHeaders()`.\n *\n * By default, it will use the config you passed in when calling `createStorefrontClient()`. However, you can override the following settings on each invocation of `getPrivateTokenHeaders({...})`:\n *\n * - `contentType`\n * - `privateStorefrontToken`\n * - `buyerIp`\n *\n * Note that `contentType` defaults to what you configured in `createStorefrontClient({...})` and defaults to `'json'`, but a specific call may require using `graphql`. When using `JSON.stringify()` on the `body`, use `'json'`; otherwise, use `'graphql'`.\n */\n getPrivateTokenHeaders: (\n props?: OverrideTokenHeaderProps &\n Pick<StorefrontClientProps, 'privateStorefrontToken'> & {\n /**\n * The client's IP address. Passing this to the Storefront API when using a server-to-server token will help improve your store's analytics data.\n */\n buyerIp?: string;\n },\n ) => Record<string, string>;\n /**\n * Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint. This method uses the public token which increases the chance of throttling but also can be exposed to clients. Server-side calls should prefer using `getPublicTokenHeaders()`.\n *\n * By default, it will use the config you passed in when calling `createStorefrontClient()`. However, you can override the following settings on each invocation of `getPublicTokenHeaders({...})`:\n *\n * - `contentType`\n * - `publicStorefrontToken`\n *\n * Note that `contentType` defaults to what you configured in `createStorefrontClient({...})` and defaults to `'json'`, but a specific call may require using `graphql`. When using `JSON.stringify()` on the `body`, use `'json'`; otherwise, use `'graphql'`.\n */\n getPublicTokenHeaders: (\n props?: OverrideTokenHeaderProps &\n Pick<StorefrontClientProps, 'publicStorefrontToken'>,\n ) => Record<string, string>;\n};\n"],"names":[],"mappings":";AAmBA,MAAM,mBAAmB;AACzB,MAAM,aAAa,CAAC,WAClB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