@rebuy/rebuy-hydrogen 3.0.0-beta.7 → 3.0.0-beta.9

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.
package/dist/index.js CHANGED
@@ -176,6 +176,7 @@ var getRebuyConfig = async (rebuyKey, storeDomain) => {
176
176
  // src/providers/RebuyHydrogenContextProvider.tsx
177
177
  var import_jsx_runtime = require("react/jsx-runtime");
178
178
  var RebuyHydrogenContext = ({
179
+ apiKey,
179
180
  cartAttributes,
180
181
  cartCost,
181
182
  cartId,
@@ -183,9 +184,8 @@ var RebuyHydrogenContext = ({
183
184
  cartNote,
184
185
  cartQuantity,
185
186
  children,
186
- shop,
187
- apiKey,
188
- publicStoreDomain
187
+ publicStoreDomain,
188
+ shop
189
189
  }) => {
190
190
  const [rebuyConfig, setRebuyConfig] = (0, import_react3.useState)(null);
191
191
  const location = (0, import_react2.useLocation)();
@@ -224,26 +224,26 @@ var RebuyHydrogenContext = ({
224
224
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RebuyContext.Provider, { value: contextValue, children });
225
225
  };
226
226
  var RebuyHydrogenContextProvider = ({
227
+ apiKey,
227
228
  cart,
228
229
  children,
229
- shop,
230
- apiKey,
231
- publicStoreDomain
230
+ publicStoreDomain,
231
+ shop
232
232
  }) => {
233
233
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.Await, { resolve: cart, children: (resolvedCart) => {
234
234
  const cart2 = resolvedCart;
235
235
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
236
236
  RebuyHydrogenContext,
237
237
  {
238
+ apiKey,
238
239
  cartAttributes: cart2?.attributes,
239
240
  cartCost: cart2?.cost?.subtotalAmount?.amount,
240
241
  cartId: cart2?.id,
241
242
  cartLines: cart2?.lines?.nodes,
242
243
  cartNote: cart2?.note,
243
244
  cartQuantity: cart2?.totalQuantity,
244
- shop,
245
- apiKey,
246
245
  publicStoreDomain,
246
+ shop,
247
247
  children
248
248
  }
249
249
  );
@@ -852,7 +852,7 @@ var Utilities4 = __toESM(require("@rebuy/rebuy/utilities"), 1);
852
852
  var import_hydrogen = require("@shopify/hydrogen");
853
853
  var import_react6 = __toESM(require("react"), 1);
854
854
  var RebuyWidgetContainerBase = ({ children, ...props }) => {
855
- const { collection, collectionId, dataSource, limit, options, product, productId, variant, variantId } = props;
855
+ const { apiKey, collection, collectionId, dataSource, limit, options, product, productId, variant, variantId } = props;
856
856
  const contextParameters = (0, import_react6.useContext)(RebuyContext);
857
857
  const [Rebuy, setRebuy] = (0, import_react6.useState)(null);
858
858
  const [initialized, setInitialized] = (0, import_react6.useState)(false);
@@ -861,10 +861,9 @@ var RebuyWidgetContainerBase = ({ children, ...props }) => {
861
861
  const shopifyCollectionId = collection?.id ?? collectionId ?? null;
862
862
  const [products, setProducts] = (0, import_react6.useState)([]);
863
863
  const [metadata, setMetadata] = (0, import_react6.useState)();
864
- const REBUY_API_KEY = process.env.PUBLIC_REBUY_API_KEY;
865
864
  (0, import_react6.useEffect)(() => {
866
865
  if (!Rebuy) {
867
- const client = new import_rebuy2.RebuyClient(REBUY_API_KEY);
866
+ const client = new import_rebuy2.RebuyClient(apiKey);
868
867
  client.setContextParameters(
869
868
  contextParameters
870
869
  // TODO: fix this type when @rebuy/rebuy is moved to typescript
@@ -875,7 +874,7 @@ var RebuyWidgetContainerBase = ({ children, ...props }) => {
875
874
  setRebuy(client);
876
875
  setInitialized(true);
877
876
  }
878
- }, [REBUY_API_KEY, Rebuy, contextParameters, options]);
877
+ }, [apiKey, Rebuy, contextParameters, options]);
879
878
  (0, import_react6.useEffect)(() => {
880
879
  if (!Rebuy) return;
881
880
  Rebuy.setContextParameters(