@rebuy/rebuy-hydrogen 1.0.0-rc.1 → 1.0.1

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.
@@ -1,5 +1,6 @@
1
1
  import React, { useState, useEffect, useContext } from 'react';
2
2
  import { RebuyContext } from './RebuyContextProvider.client';
3
+ import { flattenConnection } from '@shopify/hydrogen';
3
4
 
4
5
  import * as Utilities from '@rebuy/rebuy/utilities';
5
6
  import RebuyClient from '@rebuy/rebuy/client';
@@ -59,8 +60,16 @@ export default function RebuyWidgetContainer(props) {
59
60
 
60
61
  const fetchData = async () => {
61
62
  const response = await Rebuy.getStorefrontData(request.url, request.parameters);
62
- setProducts(response.data);
63
- setMetadata(response.metadata);
63
+
64
+ const { data, metadata } = response;
65
+ data.forEach((product) => {
66
+ product.variants = {
67
+ nodes: flattenConnection(product.variants),
68
+ };
69
+ });
70
+
71
+ setProducts(data);
72
+ setMetadata(metadata);
64
73
  };
65
74
 
66
75
  const childrenWithProps = (data) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebuy/rebuy-hydrogen",
3
3
  "description": "This is the default library for Rebuy + Shopify Hydrogen",
4
- "version": "1.0.0-rc.1",
4
+ "version": "1.0.1",
5
5
  "license": "MIT",
6
6
  "author": "Rebuy, Inc.",
7
7
  "type": "module",