@shopify/hydrogen 2026.10.0-preview.4 → 2026.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (437) hide show
  1. package/dist/cli/index.mjs +23 -12
  2. package/dist/client/client.d.mts +18 -15
  3. package/dist/client/client.mjs +8 -3
  4. package/dist/client/client.mjs.map +1 -1
  5. package/dist/client/errors.d.mts +35 -13
  6. package/dist/client/errors.mjs +23 -13
  7. package/dist/client/errors.mjs.map +1 -1
  8. package/dist/client/types.d.mts +140 -90
  9. package/dist/core/analytics/cart-tracker.d.mts +19 -10
  10. package/dist/core/analytics/cart-tracker.mjs +18 -10
  11. package/dist/core/analytics/cart-tracker.mjs.map +1 -1
  12. package/dist/core/analytics/events.d.mts +17 -11
  13. package/dist/core/analytics/events.mjs +13 -4
  14. package/dist/core/analytics/events.mjs.map +1 -1
  15. package/dist/core/analytics/types.d.mts +207 -118
  16. package/dist/core/analytics/utils/flatten-connection.d.mts +11 -9
  17. package/dist/core/analytics/utils/flatten-connection.mjs +7 -6
  18. package/dist/core/analytics/utils/flatten-connection.mjs.map +1 -1
  19. package/dist/core/cache/fetch-with-cache.d.mts +24 -4
  20. package/dist/core/cache/fetch-with-cache.mjs +17 -2
  21. package/dist/core/cache/fetch-with-cache.mjs.map +1 -1
  22. package/dist/core/cache/key.d.mts +2 -0
  23. package/dist/core/cache/key.mjs.map +1 -1
  24. package/dist/core/cache/run-with-cache.d.mts +56 -8
  25. package/dist/core/cache/run-with-cache.mjs +17 -6
  26. package/dist/core/cache/run-with-cache.mjs.map +1 -1
  27. package/dist/core/cache/store.d.mts +8 -6
  28. package/dist/core/cache/store.mjs.map +1 -1
  29. package/dist/core/cache/strategies.d.mts +27 -2
  30. package/dist/core/cache/strategies.mjs +6 -0
  31. package/dist/core/cache/strategies.mjs.map +1 -1
  32. package/dist/core/cart/actions.d.mts +37 -30
  33. package/dist/core/cart/actions.mjs +21 -9
  34. package/dist/core/cart/actions.mjs.map +1 -1
  35. package/dist/core/cart/attach-quantity-input.d.mts +8 -7
  36. package/dist/core/cart/attach-quantity-input.mjs +8 -7
  37. package/dist/core/cart/attach-quantity-input.mjs.map +1 -1
  38. package/dist/core/cart/buyer-identity-sync.d.mts +7 -6
  39. package/dist/core/cart/buyer-identity-sync.mjs.map +1 -1
  40. package/dist/core/cart/cart.d.mts +59 -46
  41. package/dist/core/cart/cart.mjs +46 -29
  42. package/dist/core/cart/cart.mjs.map +1 -1
  43. package/dist/core/cart/cookie.d.mts +8 -4
  44. package/dist/core/cart/cookie.mjs +8 -4
  45. package/dist/core/cart/cookie.mjs.map +1 -1
  46. package/dist/core/cart/form.d.mts +34 -20
  47. package/dist/core/cart/form.mjs +6 -4
  48. package/dist/core/cart/form.mjs.map +1 -1
  49. package/dist/core/cart/get-cart.d.mts +27 -15
  50. package/dist/core/cart/get-cart.mjs +13 -8
  51. package/dist/core/cart/get-cart.mjs.map +1 -1
  52. package/dist/core/cart/quantity.d.mts +16 -5
  53. package/dist/core/cart/quantity.mjs +16 -5
  54. package/dist/core/cart/quantity.mjs.map +1 -1
  55. package/dist/core/cart/queries.d.mts +25 -19
  56. package/dist/core/cart/queries.mjs +15 -1
  57. package/dist/core/cart/queries.mjs.map +1 -1
  58. package/dist/core/cart/server-handlers.d.mts +82 -45
  59. package/dist/core/cart/server-handlers.mjs +4 -0
  60. package/dist/core/cart/server-handlers.mjs.map +1 -1
  61. package/dist/core/cart/state.d.mts +110 -64
  62. package/dist/core/cart/state.mjs +24 -6
  63. package/dist/core/cart/state.mjs.map +1 -1
  64. package/dist/core/collection/collection.d.mts +52 -53
  65. package/dist/core/collection/collection.mjs +5 -3
  66. package/dist/core/collection/collection.mjs.map +1 -1
  67. package/dist/core/collection/reconciler.d.mts +23 -16
  68. package/dist/core/collection/reconciler.mjs +8 -4
  69. package/dist/core/collection/reconciler.mjs.map +1 -1
  70. package/dist/core/collection/state.d.mts +31 -26
  71. package/dist/core/collection/state.mjs +4 -3
  72. package/dist/core/collection/state.mjs.map +1 -1
  73. package/dist/core/collection/url.d.mts +70 -29
  74. package/dist/core/collection/url.mjs +63 -25
  75. package/dist/core/collection/url.mjs.map +1 -1
  76. package/dist/core/constants.d.mts +1 -0
  77. package/dist/core/constants.mjs +1 -0
  78. package/dist/core/constants.mjs.map +1 -1
  79. package/dist/core/logging/logging.d.mts +14 -8
  80. package/dist/core/logging/logging.mjs +15 -10
  81. package/dist/core/logging/logging.mjs.map +1 -1
  82. package/dist/core/logging/types.d.mts +28 -11
  83. package/dist/core/logging/types.mjs.map +1 -1
  84. package/dist/core/money/format.d.mts +6 -4
  85. package/dist/core/money/format.mjs +19 -9
  86. package/dist/core/money/format.mjs.map +1 -1
  87. package/dist/core/money/types.d.mts +41 -25
  88. package/dist/core/predictive-search/form.d.mts +37 -7
  89. package/dist/core/predictive-search/form.mjs +21 -3
  90. package/dist/core/predictive-search/form.mjs.map +1 -1
  91. package/dist/core/predictive-search/queries.d.mts +18 -30
  92. package/dist/core/predictive-search/queries.mjs +7 -3
  93. package/dist/core/predictive-search/queries.mjs.map +1 -1
  94. package/dist/core/predictive-search/search.d.mts +25 -27
  95. package/dist/core/predictive-search/search.mjs +20 -19
  96. package/dist/core/predictive-search/search.mjs.map +1 -1
  97. package/dist/core/predictive-search/server-handlers.d.mts +25 -26
  98. package/dist/core/predictive-search/server-handlers.mjs +4 -0
  99. package/dist/core/predictive-search/server-handlers.mjs.map +1 -1
  100. package/dist/core/predictive-search/store.d.mts +65 -24
  101. package/dist/core/predictive-search/store.mjs +12 -1
  102. package/dist/core/predictive-search/store.mjs.map +1 -1
  103. package/dist/core/predictive-search/url.d.mts +36 -37
  104. package/dist/core/predictive-search/url.mjs +14 -6
  105. package/dist/core/predictive-search/url.mjs.map +1 -1
  106. package/dist/core/product/form.d.mts +63 -16
  107. package/dist/core/product/form.mjs +8 -2
  108. package/dist/core/product/form.mjs.map +1 -1
  109. package/dist/core/product/options.d.mts +8 -10
  110. package/dist/core/product/options.mjs +8 -10
  111. package/dist/core/product/options.mjs.map +1 -1
  112. package/dist/core/product/product-form.d.mts +77 -29
  113. package/dist/core/product/product-form.mjs +32 -10
  114. package/dist/core/product/product-form.mjs.map +1 -1
  115. package/dist/core/product/state.d.mts +55 -32
  116. package/dist/core/product/url.d.mts +19 -13
  117. package/dist/core/product/url.mjs +10 -10
  118. package/dist/core/product/url.mjs.map +1 -1
  119. package/dist/core/request-context.d.mts +77 -19
  120. package/dist/core/request-context.mjs +5 -1
  121. package/dist/core/request-context.mjs.map +1 -1
  122. package/dist/core/request-routing/handle-shopify-redirects.d.mts +12 -4
  123. package/dist/core/request-routing/handle-shopify-redirects.mjs +9 -2
  124. package/dist/core/request-routing/handle-shopify-redirects.mjs.map +1 -1
  125. package/dist/core/request-routing/handle-shopify-routes.d.mts +5 -5
  126. package/dist/core/request-routing/handle-shopify-routes.mjs +7 -5
  127. package/dist/core/request-routing/handle-shopify-routes.mjs.map +1 -1
  128. package/dist/core/request-routing/interceptors/proxy.mjs +79 -43
  129. package/dist/core/request-routing/interceptors/proxy.mjs.map +1 -1
  130. package/dist/core/request-routing/interceptors/ucp-profile-proxy.mjs +69 -0
  131. package/dist/core/request-routing/interceptors/ucp-profile-proxy.mjs.map +1 -0
  132. package/dist/core/request-routing/interceptors/url-redirects.mjs +6 -1
  133. package/dist/core/request-routing/interceptors/url-redirects.mjs.map +1 -1
  134. package/dist/core/request-routing/interceptors/well-known.mjs +1 -1
  135. package/dist/core/request-routing/interceptors/well-known.mjs.map +1 -1
  136. package/dist/core/request-routing/registered-routes.d.mts +12 -0
  137. package/dist/core/request-routing/registered-routes.mjs +12 -0
  138. package/dist/core/request-routing/registered-routes.mjs.map +1 -1
  139. package/dist/core/request-routing/route-types.d.mts +43 -18
  140. package/dist/core/shop-pay/shop-pay.d.mts +71 -35
  141. package/dist/core/shop-pay/shop-pay.mjs +36 -10
  142. package/dist/core/shop-pay/shop-pay.mjs.map +1 -1
  143. package/dist/core/shopify-scripts/index.d.mts +15 -5
  144. package/dist/core/shopify-scripts/index.mjs +15 -5
  145. package/dist/core/shopify-scripts/index.mjs.map +1 -1
  146. package/dist/core/shopify-scripts/initialize.d.mts +12 -4
  147. package/dist/core/shopify-scripts/initialize.mjs +12 -4
  148. package/dist/core/shopify-scripts/initialize.mjs.map +1 -1
  149. package/dist/core/shopify-scripts/types.d.mts +58 -25
  150. package/dist/core/standard-routes/build.d.mts +11 -12
  151. package/dist/core/standard-routes/build.mjs +11 -12
  152. package/dist/core/standard-routes/build.mjs.map +1 -1
  153. package/dist/core/standard-routes/types.d.mts +30 -24
  154. package/dist/core/url.mjs +2 -1
  155. package/dist/core/url.mjs.map +1 -1
  156. package/dist/customer-account/client.d.mts +36 -69
  157. package/dist/customer-account/client.mjs +7 -8
  158. package/dist/customer-account/client.mjs.map +1 -1
  159. package/dist/customer-account/errors.d.mts +45 -36
  160. package/dist/customer-account/errors.mjs +21 -36
  161. package/dist/customer-account/errors.mjs.map +1 -1
  162. package/dist/customer-account/graphql.d.mts +11 -23
  163. package/dist/customer-account/graphql.mjs +3 -9
  164. package/dist/customer-account/graphql.mjs.map +1 -1
  165. package/dist/customer-account/session.d.mts +130 -100
  166. package/dist/customer-account/session.mjs +32 -10
  167. package/dist/customer-account/session.mjs.map +1 -1
  168. package/dist/customer-account/type-resolver.d.mts +7 -8
  169. package/dist/development/client/client.d.mts +18 -15
  170. package/dist/development/client/client.mjs +8 -3
  171. package/dist/development/client/client.mjs.map +1 -1
  172. package/dist/development/client/errors.d.mts +35 -13
  173. package/dist/development/client/errors.mjs +23 -13
  174. package/dist/development/client/errors.mjs.map +1 -1
  175. package/dist/development/client/types.d.mts +140 -90
  176. package/dist/development/core/analytics/cart-tracker.d.mts +19 -10
  177. package/dist/development/core/analytics/cart-tracker.mjs +18 -10
  178. package/dist/development/core/analytics/cart-tracker.mjs.map +1 -1
  179. package/dist/development/core/analytics/events.d.mts +17 -11
  180. package/dist/development/core/analytics/events.mjs +13 -4
  181. package/dist/development/core/analytics/events.mjs.map +1 -1
  182. package/dist/development/core/analytics/types.d.mts +207 -118
  183. package/dist/development/core/analytics/utils/flatten-connection.d.mts +11 -9
  184. package/dist/development/core/analytics/utils/flatten-connection.mjs +7 -6
  185. package/dist/development/core/analytics/utils/flatten-connection.mjs.map +1 -1
  186. package/dist/development/core/cache/fetch-with-cache.d.mts +24 -4
  187. package/dist/development/core/cache/fetch-with-cache.mjs +17 -2
  188. package/dist/development/core/cache/fetch-with-cache.mjs.map +1 -1
  189. package/dist/development/core/cache/key.d.mts +2 -0
  190. package/dist/development/core/cache/key.mjs.map +1 -1
  191. package/dist/development/core/cache/run-with-cache.d.mts +56 -8
  192. package/dist/development/core/cache/run-with-cache.mjs +17 -6
  193. package/dist/development/core/cache/run-with-cache.mjs.map +1 -1
  194. package/dist/development/core/cache/store.d.mts +8 -6
  195. package/dist/development/core/cache/store.mjs.map +1 -1
  196. package/dist/development/core/cache/strategies.d.mts +27 -2
  197. package/dist/development/core/cache/strategies.mjs +6 -0
  198. package/dist/development/core/cache/strategies.mjs.map +1 -1
  199. package/dist/development/core/cart/actions.d.mts +37 -30
  200. package/dist/development/core/cart/actions.mjs +21 -9
  201. package/dist/development/core/cart/actions.mjs.map +1 -1
  202. package/dist/development/core/cart/attach-quantity-input.d.mts +8 -7
  203. package/dist/development/core/cart/attach-quantity-input.mjs +8 -7
  204. package/dist/development/core/cart/attach-quantity-input.mjs.map +1 -1
  205. package/dist/development/core/cart/buyer-identity-sync.d.mts +6 -5
  206. package/dist/development/core/cart/buyer-identity-sync.mjs.map +1 -1
  207. package/dist/development/core/cart/cart.d.mts +59 -46
  208. package/dist/development/core/cart/cart.mjs +46 -29
  209. package/dist/development/core/cart/cart.mjs.map +1 -1
  210. package/dist/development/core/cart/cookie.d.mts +8 -4
  211. package/dist/development/core/cart/cookie.mjs +8 -4
  212. package/dist/development/core/cart/cookie.mjs.map +1 -1
  213. package/dist/development/core/cart/form.d.mts +34 -20
  214. package/dist/development/core/cart/form.mjs +6 -4
  215. package/dist/development/core/cart/form.mjs.map +1 -1
  216. package/dist/development/core/cart/get-cart.d.mts +27 -15
  217. package/dist/development/core/cart/get-cart.mjs +13 -8
  218. package/dist/development/core/cart/get-cart.mjs.map +1 -1
  219. package/dist/development/core/cart/quantity.d.mts +16 -5
  220. package/dist/development/core/cart/quantity.mjs +16 -5
  221. package/dist/development/core/cart/quantity.mjs.map +1 -1
  222. package/dist/development/core/cart/queries.d.mts +25 -19
  223. package/dist/development/core/cart/queries.mjs +15 -1
  224. package/dist/development/core/cart/queries.mjs.map +1 -1
  225. package/dist/development/core/cart/server-handlers.d.mts +82 -45
  226. package/dist/development/core/cart/server-handlers.mjs +4 -0
  227. package/dist/development/core/cart/server-handlers.mjs.map +1 -1
  228. package/dist/development/core/cart/state.d.mts +110 -64
  229. package/dist/development/core/cart/state.mjs +24 -6
  230. package/dist/development/core/cart/state.mjs.map +1 -1
  231. package/dist/development/core/collection/collection.d.mts +52 -53
  232. package/dist/development/core/collection/collection.mjs +5 -3
  233. package/dist/development/core/collection/collection.mjs.map +1 -1
  234. package/dist/development/core/collection/reconciler.d.mts +23 -16
  235. package/dist/development/core/collection/reconciler.mjs +8 -4
  236. package/dist/development/core/collection/reconciler.mjs.map +1 -1
  237. package/dist/development/core/collection/state.d.mts +31 -26
  238. package/dist/development/core/collection/state.mjs +4 -3
  239. package/dist/development/core/collection/state.mjs.map +1 -1
  240. package/dist/development/core/collection/url.d.mts +70 -29
  241. package/dist/development/core/collection/url.mjs +63 -25
  242. package/dist/development/core/collection/url.mjs.map +1 -1
  243. package/dist/development/core/constants.mjs.map +1 -1
  244. package/dist/development/core/logging/logging.d.mts +14 -8
  245. package/dist/development/core/logging/logging.mjs +15 -10
  246. package/dist/development/core/logging/logging.mjs.map +1 -1
  247. package/dist/development/core/logging/types.d.mts +28 -11
  248. package/dist/development/core/logging/types.mjs.map +1 -1
  249. package/dist/development/core/money/format.d.mts +6 -4
  250. package/dist/development/core/money/format.mjs +19 -9
  251. package/dist/development/core/money/format.mjs.map +1 -1
  252. package/dist/development/core/money/types.d.mts +41 -25
  253. package/dist/development/core/predictive-search/form.d.mts +37 -7
  254. package/dist/development/core/predictive-search/form.mjs +21 -3
  255. package/dist/development/core/predictive-search/form.mjs.map +1 -1
  256. package/dist/development/core/predictive-search/queries.d.mts +18 -30
  257. package/dist/development/core/predictive-search/queries.mjs +7 -3
  258. package/dist/development/core/predictive-search/queries.mjs.map +1 -1
  259. package/dist/development/core/predictive-search/search.d.mts +25 -27
  260. package/dist/development/core/predictive-search/search.mjs +20 -19
  261. package/dist/development/core/predictive-search/search.mjs.map +1 -1
  262. package/dist/development/core/predictive-search/server-handlers.d.mts +25 -26
  263. package/dist/development/core/predictive-search/server-handlers.mjs +4 -0
  264. package/dist/development/core/predictive-search/server-handlers.mjs.map +1 -1
  265. package/dist/development/core/predictive-search/store.d.mts +65 -24
  266. package/dist/development/core/predictive-search/store.mjs +12 -1
  267. package/dist/development/core/predictive-search/store.mjs.map +1 -1
  268. package/dist/development/core/predictive-search/url.d.mts +36 -37
  269. package/dist/development/core/predictive-search/url.mjs +14 -6
  270. package/dist/development/core/predictive-search/url.mjs.map +1 -1
  271. package/dist/development/core/product/form.d.mts +63 -16
  272. package/dist/development/core/product/form.mjs +8 -2
  273. package/dist/development/core/product/form.mjs.map +1 -1
  274. package/dist/development/core/product/options.d.mts +8 -10
  275. package/dist/development/core/product/options.mjs +8 -10
  276. package/dist/development/core/product/options.mjs.map +1 -1
  277. package/dist/development/core/product/product-form.d.mts +77 -29
  278. package/dist/development/core/product/product-form.mjs +32 -10
  279. package/dist/development/core/product/product-form.mjs.map +1 -1
  280. package/dist/development/core/product/state.d.mts +55 -32
  281. package/dist/development/core/product/url.d.mts +19 -13
  282. package/dist/development/core/product/url.mjs +10 -10
  283. package/dist/development/core/product/url.mjs.map +1 -1
  284. package/dist/development/core/request-context.d.mts +77 -19
  285. package/dist/development/core/request-context.mjs +5 -1
  286. package/dist/development/core/request-context.mjs.map +1 -1
  287. package/dist/development/core/request-routing/handle-shopify-redirects.d.mts +12 -4
  288. package/dist/development/core/request-routing/handle-shopify-redirects.mjs +9 -2
  289. package/dist/development/core/request-routing/handle-shopify-redirects.mjs.map +1 -1
  290. package/dist/development/core/request-routing/handle-shopify-routes.development.d.mts +9 -1
  291. package/dist/development/core/request-routing/handle-shopify-routes.development.mjs +7 -0
  292. package/dist/development/core/request-routing/handle-shopify-routes.development.mjs.map +1 -1
  293. package/dist/development/core/request-routing/handle-shopify-routes.mjs +7 -5
  294. package/dist/development/core/request-routing/handle-shopify-routes.mjs.map +1 -1
  295. package/dist/development/core/request-routing/interceptors/proxy.mjs +79 -43
  296. package/dist/development/core/request-routing/interceptors/proxy.mjs.map +1 -1
  297. package/dist/development/core/request-routing/interceptors/ucp-profile-proxy.mjs +69 -0
  298. package/dist/development/core/request-routing/interceptors/ucp-profile-proxy.mjs.map +1 -0
  299. package/dist/development/core/request-routing/interceptors/url-redirects.mjs +6 -1
  300. package/dist/development/core/request-routing/interceptors/url-redirects.mjs.map +1 -1
  301. package/dist/development/core/request-routing/interceptors/well-known.mjs +1 -1
  302. package/dist/development/core/request-routing/interceptors/well-known.mjs.map +1 -1
  303. package/dist/development/core/request-routing/registered-routes.d.mts +12 -0
  304. package/dist/development/core/request-routing/registered-routes.mjs +12 -0
  305. package/dist/development/core/request-routing/registered-routes.mjs.map +1 -1
  306. package/dist/development/core/request-routing/route-types.d.mts +43 -18
  307. package/dist/development/core/shop-pay/shop-pay.d.mts +71 -35
  308. package/dist/development/core/shop-pay/shop-pay.mjs +36 -10
  309. package/dist/development/core/shop-pay/shop-pay.mjs.map +1 -1
  310. package/dist/development/core/shopify-scripts/index.d.mts +15 -5
  311. package/dist/development/core/shopify-scripts/index.mjs +15 -5
  312. package/dist/development/core/shopify-scripts/index.mjs.map +1 -1
  313. package/dist/development/core/shopify-scripts/initialize.d.mts +12 -4
  314. package/dist/development/core/shopify-scripts/initialize.mjs +12 -4
  315. package/dist/development/core/shopify-scripts/initialize.mjs.map +1 -1
  316. package/dist/development/core/shopify-scripts/types.d.mts +58 -25
  317. package/dist/development/core/standard-routes/build.d.mts +11 -12
  318. package/dist/development/core/standard-routes/build.mjs +11 -12
  319. package/dist/development/core/standard-routes/build.mjs.map +1 -1
  320. package/dist/development/core/standard-routes/types.d.mts +30 -24
  321. package/dist/development/core/url.mjs +2 -1
  322. package/dist/development/core/url.mjs.map +1 -1
  323. package/dist/development/customer-account/session.d.mts +45 -54
  324. package/dist/development/customer-account/session.mjs +20 -4
  325. package/dist/development/customer-account/session.mjs.map +1 -1
  326. package/dist/development/globals.d.mts +20 -11
  327. package/dist/development/graphql/generated/storefront-api-types.d.mts +127 -1
  328. package/dist/development/graphql/graphql.d.mts +17 -16
  329. package/dist/development/graphql/graphql.mjs +7 -8
  330. package/dist/development/graphql/graphql.mjs.map +1 -1
  331. package/dist/development/graphql/type-resolver.d.mts +15 -8
  332. package/dist/development/react/cart.d.mts +78 -32
  333. package/dist/development/react/cart.mjs +56 -29
  334. package/dist/development/react/cart.mjs.map +1 -1
  335. package/dist/development/react/collection.d.mts +40 -22
  336. package/dist/development/react/collection.mjs +27 -7
  337. package/dist/development/react/collection.mjs.map +1 -1
  338. package/dist/development/react/predictive-search.d.mts +65 -50
  339. package/dist/development/react/predictive-search.mjs +23 -21
  340. package/dist/development/react/predictive-search.mjs.map +1 -1
  341. package/dist/development/react/product.d.mts +45 -16
  342. package/dist/development/react/product.mjs +13 -11
  343. package/dist/development/react/product.mjs.map +1 -1
  344. package/dist/development/react/shop-pay.d.mts +15 -0
  345. package/dist/development/react/shop-pay.mjs +9 -0
  346. package/dist/development/react/shop-pay.mjs.map +1 -1
  347. package/dist/development/react/shopify-scripts.d.mts +23 -2
  348. package/dist/development/react/shopify-scripts.mjs +9 -0
  349. package/dist/development/react/shopify-scripts.mjs.map +1 -1
  350. package/dist/development/vue/cart.d.mts +28 -23
  351. package/dist/development/vue/cart.mjs +42 -25
  352. package/dist/development/vue/cart.mjs.map +1 -1
  353. package/dist/development/vue/collection.d.mts +20 -12
  354. package/dist/development/vue/collection.mjs +15 -7
  355. package/dist/development/vue/collection.mjs.map +1 -1
  356. package/dist/development/vue/index.d.mts +2 -2
  357. package/dist/development/vue/index.mjs +2 -2
  358. package/dist/development/vue/predictive-search.d.mts +31 -36
  359. package/dist/development/vue/predictive-search.mjs +16 -22
  360. package/dist/development/vue/predictive-search.mjs.map +1 -1
  361. package/dist/development/vue/product.d.mts +16 -15
  362. package/dist/development/vue/product.mjs +11 -11
  363. package/dist/development/vue/product.mjs.map +1 -1
  364. package/dist/development/vue/shop-pay.d.mts +14 -17
  365. package/dist/development/vue/shop-pay.mjs +8 -0
  366. package/dist/development/vue/shop-pay.mjs.map +1 -1
  367. package/dist/development/vue/shopify-scripts.d.mts +11 -0
  368. package/dist/development/vue/shopify-scripts.mjs +6 -0
  369. package/dist/development/vue/shopify-scripts.mjs.map +1 -1
  370. package/dist/globals.d.mts +20 -11
  371. package/dist/graphql/generated/storefront-api-types.d.mts +127 -1
  372. package/dist/graphql/graphql.d.mts +17 -16
  373. package/dist/graphql/graphql.mjs +7 -8
  374. package/dist/graphql/graphql.mjs.map +1 -1
  375. package/dist/graphql/type-resolver.d.mts +15 -8
  376. package/dist/react/cart.d.mts +78 -32
  377. package/dist/react/cart.mjs +56 -29
  378. package/dist/react/cart.mjs.map +1 -1
  379. package/dist/react/collection.d.mts +40 -22
  380. package/dist/react/collection.mjs +27 -7
  381. package/dist/react/collection.mjs.map +1 -1
  382. package/dist/react/predictive-search.d.mts +65 -50
  383. package/dist/react/predictive-search.mjs +23 -21
  384. package/dist/react/predictive-search.mjs.map +1 -1
  385. package/dist/react/product.d.mts +45 -16
  386. package/dist/react/product.mjs +13 -11
  387. package/dist/react/product.mjs.map +1 -1
  388. package/dist/react/shop-pay.d.mts +15 -0
  389. package/dist/react/shop-pay.mjs +9 -0
  390. package/dist/react/shop-pay.mjs.map +1 -1
  391. package/dist/react/shopify-scripts.d.mts +23 -2
  392. package/dist/react/shopify-scripts.mjs +9 -0
  393. package/dist/react/shopify-scripts.mjs.map +1 -1
  394. package/dist/ts-plugin/index.cjs +6 -0
  395. package/dist/ts-plugin/index.cjs.map +1 -1
  396. package/dist/ts-plugin/index.d.cts +6 -0
  397. package/dist/vite/local-https.d.mts +51 -17
  398. package/dist/vite/local-https.mjs +26 -5
  399. package/dist/vite/local-https.mjs.map +1 -1
  400. package/dist/vue/cart.d.mts +28 -23
  401. package/dist/vue/cart.mjs +42 -25
  402. package/dist/vue/cart.mjs.map +1 -1
  403. package/dist/vue/collection.d.mts +20 -12
  404. package/dist/vue/collection.mjs +15 -7
  405. package/dist/vue/collection.mjs.map +1 -1
  406. package/dist/vue/index.d.mts +2 -2
  407. package/dist/vue/index.mjs +2 -2
  408. package/dist/vue/predictive-search.d.mts +31 -36
  409. package/dist/vue/predictive-search.mjs +16 -22
  410. package/dist/vue/predictive-search.mjs.map +1 -1
  411. package/dist/vue/product.d.mts +16 -15
  412. package/dist/vue/product.mjs +11 -11
  413. package/dist/vue/product.mjs.map +1 -1
  414. package/dist/vue/shop-pay.d.mts +14 -17
  415. package/dist/vue/shop-pay.mjs +8 -0
  416. package/dist/vue/shop-pay.mjs.map +1 -1
  417. package/dist/vue/shopify-scripts.d.mts +11 -0
  418. package/dist/vue/shopify-scripts.mjs +6 -0
  419. package/dist/vue/shopify-scripts.mjs.map +1 -1
  420. package/package.json +3 -1
  421. package/skills/hydrogen-analytics/SKILL.md +1 -1
  422. package/skills/hydrogen-cart-ui/SKILL.md +28 -2
  423. package/skills/hydrogen-collection-browser/SKILL.md +9 -1
  424. package/skills/hydrogen-collection-browser/references/nextjs.md +1 -1
  425. package/skills/hydrogen-collection-browser/references/nuxt.md +1 -1
  426. package/skills/hydrogen-collection-browser/references/react.md +151 -32
  427. package/skills/hydrogen-customer-account/SKILL.md +2 -0
  428. package/skills/hydrogen-request-handlers/SKILL.md +21 -11
  429. package/skills/hydrogen-setup/references/analytics.md +14 -8
  430. package/skills/hydrogen-setup/steps/1-inspect-app.md +2 -2
  431. package/skills/hydrogen-setup/steps/6-product-detail-page.md +21 -11
  432. package/skills/hydrogen-storefront-client/SKILL.md +1 -1
  433. package/skills/hydrogen-storefront-client/references/caching.md +2 -0
  434. package/skills/hydrogen-variant-form/SKILL.md +25 -7
  435. package/skills/hydrogen-variant-form/references/nextjs.md +39 -4
  436. package/skills/hydrogen-variant-form/references/nuxt.md +83 -42
  437. package/skills/hydrogen-variant-form/references/react.md +45 -9
@@ -1,28 +1,32 @@
1
1
  import { CartData, CartState } from "./state.mjs";
2
2
 
3
3
  //#region src/core/cart/cart.d.ts
4
- /** Timeout (in milliseconds) for cart loads and mutations. */
4
+ /** The timeout in milliseconds for cart loads and mutations. */
5
5
  declare const STANDARD_ACTION_TIMEOUT_IN_MS = 30000;
6
6
  /**
7
- * Error thrown when the cart endpoint responds with a non-2xx status.
7
+ * The error that a cart load or cart change throws when your cart endpoint responds with a non-2xx status. Read `status` to handle specific failures.
8
8
  *
9
- * Carries the HTTP {@link CartNetworkError.status | status} code so callers
10
- * can distinguish transient failures from permanent ones.
9
+ * Without a cart endpoint from `configureCartEndpoint`, cart requests fail with other error types.
10
+ *
11
+ * @publicDocs
11
12
  */
12
13
  declare class CartNetworkError extends Error {
14
+ /** The HTTP status code that the cart endpoint returned. */
13
15
  readonly status: number;
16
+ /** Always `CartNetworkError`. */
17
+ name: string;
18
+ /** Always `"Something went wrong updating your cart. Please try again."`, including for a failed cart load. */
19
+ message: string;
20
+ /** The stack trace, when the JavaScript runtime records one. */
21
+ stack?: string;
14
22
  constructor(status: number);
15
23
  }
16
24
  /**
17
- * A reactive, framework-agnostic cart state machine.
25
+ * Holds the customer's cart and runs cart changes in any framework. In React, `CartProvider` creates the store for you.
18
26
  *
19
- * The store manages optimistic mutations and server reconciliation — the client's
20
- * *intent*. Cart-level costs and totals are always server-authoritative, but
21
- * line-level data (quantity, estimated cost) and discount applicability are
22
- * projected optimistically until the server response arrives.
27
+ * The store shows line and discount code changes before the server responds, then updates the cart from each server response. Cart costs change only when the server responds.
23
28
  *
24
- * Mutations are dispatched via {@link CartStore.handleFormSubmit} (from HTML
25
- * forms) or through Shopify Standard Action `shopify:cart:*` events.
29
+ * Cart changes start from cart form submissions or from Standard Actions `shopify:cart:*` events. Cart changes need the Standard Actions script, which `ShopifyScripts` adds to the page. Cart loads and changes time out after 30 seconds.
26
30
  *
27
31
  * @example
28
32
  * ```ts
@@ -41,67 +45,71 @@ declare class CartNetworkError extends Error {
41
45
  */
42
46
  type CartStore = {
43
47
  /**
44
- * Activates the store — starts listening for Shopify standard action events
45
- * and triggers the initial cart load if no `initialData` was provided.
46
- * Idempotent; no-op without `document` (SSR-safe).
48
+ * Starts handling cart events, and loads the cart when you created the store without initial data. Repeated calls have no effect. During server rendering, the method does nothing.
47
49
  */
48
- connect(): void; /** Tears down the store — cancels in-flight requests, removes event listeners, releases resources. */
49
- destroy(): void; /** Replaces the settled cart data with a fresh server response. */
50
- hydrate(data: CartData): void; /** Returns the current {@link CartState}, with optimistic projections applied on top of settled data. */
50
+ connect(): void; /** Stops the store. Cancels in-flight cart requests and stops handling cart events. */
51
+ destroy(): void; /** Replaces the store's cart with a different cart that the server loaded. The method ignores data for the cart that the store already holds, and ignores data while cart changes are in flight. */
52
+ hydrate(data: CartData): void; /** Returns the current cart state, including changes that the server hasn't confirmed yet. */
51
53
  getState(): CartState;
52
54
  /**
53
- * Registers a listener invoked on every state change. Returns an unsubscribe function.
54
- * Compatible with React's `useSyncExternalStore`.
55
+ * Calls the listener on every state change and returns a function that removes the listener. The method works with React's `useSyncExternalStore`.
55
56
  *
56
- * @param listener - Callback receiving the new {@link CartState} snapshot
57
+ * @param listener - The function that receives each new state.
58
+ */
59
+ subscribe(listener: (state: CartState) => void): () => void;
60
+ /**
61
+ * Loads the full cart from the server.
62
+ *
63
+ * The promise rejects when the load fails, with a `CartNetworkError` when your cart endpoint returns a non-2xx status.
57
64
  */
58
- subscribe(listener: (state: CartState) => void): () => void; /** Triggers a full cart load from the server endpoint. */
59
65
  fetch(): Promise<void>;
60
66
  /**
61
- * Reconciles the cart after an out-of-band mutation: revalidates the current
62
- * cart, or loads one when none is present yet (e.g. just created server-side).
67
+ * Reloads the cart after a cart change that skipped the store, such as a server action. When the store has no cart yet, the method picks up the cart that the server created.
68
+ *
69
+ * A failed reload adds an entry to the network errors in the cart state.
63
70
  */
64
- refresh(): void; /** Resets the store — aborts in-flight requests, clears data and errors, and re-fetches when connected. */
71
+ refresh(): void; /** Clears the cart data and errors and cancels in-flight cart requests. After you connect the store, the method also loads the cart again when the store held a cart. */
65
72
  reset(): void;
66
73
  /**
67
- * Intercepts a native `SubmitEvent` from a cart form, parses the intent and
68
- * field values, and dispatches the matching transaction.
74
+ * Runs the cart change that a cart form submission describes. Pass the form's submit event, and call `event.preventDefault()` to stop the browser's own form submission. The method connects the store when you haven't connected it.
69
75
  *
70
- * The submitter's `value` attribute determines the action — `"add"`,
71
- * `"increase"`, `"decrease"`, `"remove"`, `"set"`, `"discount-apply"`,
72
- * `"discount-remove"`, `"note-update"`, or `"attributes-update"`. An empty
73
- * value with a `merchandiseId` field is treated as `"add"`.
76
+ * The submit button's value sets the change: `add`, `increase`,
77
+ * `decrease`, `remove`, `set`, `discount-apply`, `discount-remove`,
78
+ * `note-update`, or `attributes-update`. A button without a value adds
79
+ * the line when the form has a `merchandiseId` field. A `set` with an empty or
80
+ * zero quantity removes the line. When your cart fragment selects the variant's
81
+ * available quantity, the store caps a `set` quantity at that number.
74
82
  *
75
- * The returned promise rejects with a `TypeError` if `event.target` is not
76
- * a form or `event.submitter` is missing, and with an `Error` if the
77
- * submitter's value is not a recognized intent.
83
+ * The promise rejects with a type error when the event target isn't a form or
84
+ * the event has no submitter. The promise rejects with an error when the button's
85
+ * value isn't a recognized change, or when the form lacks a required field
86
+ * such as the line ID.
78
87
  */
79
88
  handleFormSubmit(event: SubmitEvent, eventDetail?: Record<string, unknown>): Promise<void>;
80
89
  };
81
- /** Actions for reconciling cart state after updates outside Standard Actions. */
90
+ /** The store action that reloads the cart after a cart change outside the store. */
82
91
  type CartActions = Pick<CartStore, "refresh">;
92
+ /** The cart that the server loaded for the first render. */
83
93
  type CartInitialData<TData extends CartData = CartData> = {
84
- cart: TData | null;
94
+ /** The loaded cart, or `null` when the server found no cart. */cart: TData | null; /** Load errors from the server. The store ignores the errors. */
85
95
  errors?: Array<{
86
96
  message: string;
87
97
  }>;
88
98
  };
89
- /** Options for {@link createCartStore}. */
99
+ /** Options for creating a cart store. */
90
100
  type CreateCartStoreOptions<TData extends CartData = CartData> = {
91
101
  /**
92
- * Server-loaded cart data to hydrate the store with on creation.
102
+ * The cart that the server loaded, or a promise of the cart for streamed data.
93
103
  *
94
- * Accepts a synchronous value or a `PromiseLike` for streamed/deferred data.
95
- * When omitted, the store starts empty and loads the cart on {@link CartStore.connect}.
104
+ * Pass the `data` property of the cart GET handler's result. A `null` cart
105
+ * tells the store that no cart exists yet. Without initial data, the store starts empty and loads the cart when you call `connect()`.
96
106
  */
97
107
  initialData?: CartInitialData<TData> | PromiseLike<CartInitialData<TData>>;
98
108
  };
99
109
  /**
100
- * Creates a new {@link CartStore} for the given initial data.
110
+ * Creates a cart store that holds the cart and applies cart changes before the server responds.
101
111
  *
102
- * The store is inert until {@link CartStore.connect} is called — no network
103
- * requests are made and no event listeners are attached at creation time.
104
- * Framework adapters call `connect()` on mount and `destroy()` on unmount.
112
+ * Call `connect()` to start the store and `destroy()` to stop it. The React and Vue cart providers call both for you.
105
113
  *
106
114
  * @example
107
115
  * ```ts
@@ -118,18 +126,23 @@ type CreateCartStoreOptions<TData extends CartData = CartData> = {
118
126
  * // Empty — loads the cart on connect()
119
127
  * const store = createCartStore();
120
128
  * ```
129
+ * @param options The cart that the server loaded for the first render.
130
+ * @returns The cart store. Read the cart with `getState()` and listen for changes with `subscribe()`.
131
+ * @publicDocs
121
132
  */
122
133
  declare function createCartStore<TData extends CartData = CartData>(options?: CreateCartStoreOptions<TData>): CartStore;
123
134
  /**
124
- * Routes cart loads and mutations to a custom endpoint instead of the
125
- * Standard Actions default handler.
135
+ * Sends every cart load and cart change on the page to your cart endpoint. Without an endpoint, Standard Actions handles cart requests with its default handler.
126
136
  *
127
- * Logs a warning if called again with a different endpoint.
137
+ * Call the function before you connect a cart store. The first cart load then goes to your endpoint. A later call with a different endpoint replaces the first endpoint and logs a warning. In React, `CartProvider` sets the endpoint to `/api/cart` when the provider mounts.
128
138
  *
139
+ * @param endpoint The URL path of your cart route.
140
+ * @returns Nothing. Later cart loads and changes on the page go to the endpoint.
129
141
  * @example
130
142
  * ```ts
131
143
  * configureCartEndpoint("/storefront/cart");
132
144
  * ```
145
+ * @publicDocs
133
146
  */
134
147
  declare function configureCartEndpoint(endpoint: string): void;
135
148
  //#endregion
@@ -23,15 +23,17 @@ const EMPTY_QUANTITY = 0;
23
23
  const FNV1A_OFFSET_BASIS = 2166136261;
24
24
  const FNV1A_PRIME = 16777619;
25
25
  const CART_REVALIDATION_ERROR_MESSAGE = "Something went wrong refreshing your cart. Please try again.";
26
- /** Timeout (in milliseconds) for cart loads and mutations. */
26
+ /** The timeout in milliseconds for cart loads and mutations. */
27
27
  const STANDARD_ACTION_TIMEOUT_IN_MS = 3e4;
28
28
  /**
29
- * Error thrown when the cart endpoint responds with a non-2xx status.
29
+ * The error that a cart load or cart change throws when your cart endpoint responds with a non-2xx status. Read `status` to handle specific failures.
30
30
  *
31
- * Carries the HTTP {@link CartNetworkError.status | status} code so callers
32
- * can distinguish transient failures from permanent ones.
31
+ * Without a cart endpoint from `configureCartEndpoint`, cart requests fail with other error types.
32
+ *
33
+ * @publicDocs
33
34
  */
34
35
  var CartNetworkError = class extends Error {
36
+ /** The HTTP status code that the cart endpoint returned. */
35
37
  status;
36
38
  constructor(status) {
37
39
  super("Something went wrong updating your cart. Please try again.");
@@ -554,10 +556,11 @@ function getAddErrorKeys(payload, lineIds, failure) {
554
556
  }
555
557
  function mergeServerLine(previous, next) {
556
558
  if (!previous) return next;
557
- const merchandise = next.merchandise ? {
559
+ const swapped = previous.merchandise?.id !== void 0 && next.merchandise?.id !== void 0 && previous.merchandise.id !== next.merchandise.id;
560
+ const merchandise = next.merchandise && !swapped ? {
558
561
  ...previous.merchandise,
559
562
  ...next.merchandise
560
- } : previous.merchandise;
563
+ } : next.merchandise ?? previous.merchandise;
561
564
  return {
562
565
  ...previous,
563
566
  ...next,
@@ -677,17 +680,21 @@ const CART_TRANSACTION_TYPES = defineTransactionTypes({
677
680
  data: reconcileCartLines(state.data, lines)
678
681
  };
679
682
  },
680
- projectPromise: (state, result, payload, addError) => {
683
+ projectPromise: (state, result, payload, addError, options) => {
681
684
  if (hasProjectedErrors(result)) addError((current, timestampMs) => projectLineErrors(current, result, [payload.lineId], timestampMs));
682
685
  if (!result.cart) return state;
683
- const serverLines = getLines(cartResponseFromStandardEvent(result.cart));
684
- const matching = serverLines.find((line) => line.id === payload.lineId);
686
+ const cart = cartResponseFromStandardEvent(result.cart);
687
+ const matching = getLines(cart).find((line) => line.id === payload.lineId);
688
+ if (!matching && payload.quantity > 0 && options.mergeServerCart) return {
689
+ ...state,
690
+ data: adoptServerLines(state.data, cart)
691
+ };
685
692
  const previous = getLines(state.data);
686
- let lines = previous.filter((line) => line.id !== payload.lineId);
693
+ let lines = previous;
687
694
  if (matching) {
688
695
  const prior = previous.find((line) => line.id === payload.lineId);
689
696
  lines = previous.map((line) => line.id === payload.lineId ? mergeServerLine(prior, matching) : line);
690
- } else if (payload.quantity > 0 && previous.length === 1 && serverLines.length === 1) lines = [mergeServerLine(previous[0], serverLines[0])];
697
+ } else if (payload.quantity === 0) lines = previous.filter((line) => line.id !== payload.lineId);
691
698
  return {
692
699
  ...state,
693
700
  data: reconcileCartLines(state.data, lines)
@@ -718,14 +725,11 @@ const CART_TRANSACTION_TYPES = defineTransactionTypes({
718
725
  if (hasProjectedErrors(result)) addError((current, timestampMs) => projectDiscountErrors(current, result, payload.discountCodes, timestampMs, resolvedCodes));
719
726
  if (!result.cart) return state;
720
727
  const cart = cartResponseFromStandardEvent(result.cart);
721
- if (options.mergeServerCart) return {
722
- ...state,
723
- data: mergeAuthoritativeCartData(state.data, cart)
724
- };
728
+ const data = options.mergeServerCart ? adoptServerLines(state.data, cart) : state.data;
725
729
  return {
726
730
  ...state,
727
731
  data: {
728
- ...state.data,
732
+ ...data,
729
733
  discountCodes: cart.discountCodes
730
734
  }
731
735
  };
@@ -872,16 +876,14 @@ function trimPendingTransaction(store, type, definition, payload, promise, ident
872
876
  }
873
877
  function addSnapshotFields(state, result) {
874
878
  if (!result.cart) return state;
875
- const cart = cartResponseFromStandardEvent(result.cart);
879
+ const { lines: _lines, checkoutUrl, updatedAt, ...fields } = cartResponseFromStandardEvent(result.cart);
876
880
  return {
877
881
  ...state,
878
882
  data: {
879
883
  ...state.data,
880
- id: cart.id,
881
- checkoutUrl: cart.checkoutUrl ?? state.data.checkoutUrl,
882
- updatedAt: cart.updatedAt ?? state.data.updatedAt,
883
- totalQuantity: cart.totalQuantity,
884
- cost: cart.cost
884
+ ...fields,
885
+ checkoutUrl: checkoutUrl ?? state.data.checkoutUrl,
886
+ updatedAt: updatedAt ?? state.data.updatedAt
885
887
  }
886
888
  };
887
889
  }
@@ -1377,11 +1379,9 @@ function loadCartInStore(store, cartPromise) {
1377
1379
  return promise;
1378
1380
  }
1379
1381
  /**
1380
- * Creates a new {@link CartStore} for the given initial data.
1382
+ * Creates a cart store that holds the cart and applies cart changes before the server responds.
1381
1383
  *
1382
- * The store is inert until {@link CartStore.connect} is called — no network
1383
- * requests are made and no event listeners are attached at creation time.
1384
- * Framework adapters call `connect()` on mount and `destroy()` on unmount.
1384
+ * Call `connect()` to start the store and `destroy()` to stop it. The React and Vue cart providers call both for you.
1385
1385
  *
1386
1386
  * @example
1387
1387
  * ```ts
@@ -1398,6 +1398,9 @@ function loadCartInStore(store, cartPromise) {
1398
1398
  * // Empty — loads the cart on connect()
1399
1399
  * const store = createCartStore();
1400
1400
  * ```
1401
+ * @param options The cart that the server loaded for the first render.
1402
+ * @returns The cart store. Read the cart with `getState()` and listen for changes with `subscribe()`.
1403
+ * @publicDocs
1401
1404
  */
1402
1405
  function createCartStore(options = {}) {
1403
1406
  const initialData = options.initialData;
@@ -1552,15 +1555,17 @@ async function handleFormSubmitInStore(store, handlers, event, eventDetail) {
1552
1555
  throw new Error(`Unknown cart form intent: "${intent}"`);
1553
1556
  }
1554
1557
  /**
1555
- * Routes cart loads and mutations to a custom endpoint instead of the
1556
- * Standard Actions default handler.
1558
+ * Sends every cart load and cart change on the page to your cart endpoint. Without an endpoint, Standard Actions handles cart requests with its default handler.
1557
1559
  *
1558
- * Logs a warning if called again with a different endpoint.
1560
+ * Call the function before you connect a cart store. The first cart load then goes to your endpoint. A later call with a different endpoint replaces the first endpoint and logs a warning. In React, `CartProvider` sets the endpoint to `/api/cart` when the provider mounts.
1559
1561
  *
1562
+ * @param endpoint The URL path of your cart route.
1563
+ * @returns Nothing. Later cart loads and changes on the page go to the endpoint.
1560
1564
  * @example
1561
1565
  * ```ts
1562
1566
  * configureCartEndpoint("/storefront/cart");
1563
1567
  * ```
1568
+ * @publicDocs
1564
1569
  */
1565
1570
  function configureCartEndpoint(endpoint) {
1566
1571
  if (configuredCartEndpoint === endpoint) return;
@@ -1642,6 +1647,18 @@ function fetchCartData(cartId, signal) {
1642
1647
  attributes: cart.attributes ?? []
1643
1648
  } : null);
1644
1649
  }
1650
+ function adoptServerLines(previous, authoritative) {
1651
+ const previousLines = new Map(getLines(previous).map((line) => [line.id, line]));
1652
+ const nodes = getLines(authoritative).map((line) => mergeServerLine(previousLines.get(line.id), line));
1653
+ return {
1654
+ ...previous,
1655
+ lines: {
1656
+ ...previous.lines,
1657
+ ...authoritative.lines,
1658
+ nodes
1659
+ }
1660
+ };
1661
+ }
1645
1662
  function mergeAuthoritativeCartData(previous, authoritative) {
1646
1663
  const previousLines = new Map(getLines(previous).map((line) => [line.id, line]));
1647
1664
  const lines = getLines(authoritative).map((line) => mergeServerLine(previousLines.get(line.id), line));