@rebuy/rebuy-hydrogen 3.0.0-beta.4 → 3.0.0-beta.5
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 +25 -26
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +25 -26
- package/dist/index.mjs.map +3 -3
- package/dist/providers/RebuyHydrogenReactContextProvider.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -175,6 +175,9 @@ var getRebuyConfig = async (rebuyKey, storeDomain) => {
|
|
175
175
|
|
176
176
|
// src/providers/RebuyHydrogenContextProvider.tsx
|
177
177
|
var import_jsx_runtime = require("react/jsx-runtime");
|
178
|
+
var PUBLIC_PRIMARY_DOMAIN = process.env.PUBLIC_PRIMARY_DOMAIN;
|
179
|
+
var PUBLIC_REBUY_API_KEY = process.env.PUBLIC_REBUY_API_KEY;
|
180
|
+
var PUBLIC_STORE_DOMAIN = process.env.PUBLIC_STORE_DOMAIN;
|
178
181
|
var RebuyHydrogenContext = ({
|
179
182
|
cartAttributes,
|
180
183
|
cartCost,
|
@@ -184,31 +187,28 @@ var RebuyHydrogenContext = ({
|
|
184
187
|
cartQuantity,
|
185
188
|
children
|
186
189
|
}) => {
|
187
|
-
|
188
|
-
|
189
|
-
const storeDomain = process.env.PUBLIC_STORE_DOMAIN;
|
190
|
-
if (!primaryDomain) {
|
191
|
-
throw new Error("Missing required environment variable: PRIMARY_DOMAIN");
|
190
|
+
if (!PUBLIC_PRIMARY_DOMAIN) {
|
191
|
+
throw new Error("Missing required environment variable: PUBLIC_PRIMARY_DOMAIN");
|
192
192
|
}
|
193
|
-
if (!
|
193
|
+
if (!PUBLIC_REBUY_API_KEY) {
|
194
194
|
throw new Error("Missing required environment variable: PUBLIC_REBUY_API_KEY");
|
195
195
|
}
|
196
|
-
if (!
|
196
|
+
if (!PUBLIC_STORE_DOMAIN) {
|
197
197
|
throw new Error("Missing required environment variable: PUBLIC_STORE_DOMAIN");
|
198
198
|
}
|
199
199
|
const [rebuyConfig, setRebuyConfig] = (0, import_react3.useState)(null);
|
200
200
|
const location = (0, import_react2.useLocation)();
|
201
201
|
const queryObject = Utilities2.queryStringToObject(location.search);
|
202
|
-
const windowUrl = `${
|
202
|
+
const windowUrl = `${PUBLIC_PRIMARY_DOMAIN}${location.pathname}${location.search}`;
|
203
203
|
(0, import_react3.useEffect)(() => {
|
204
204
|
const initConfig = async () => {
|
205
|
-
const config = await getRebuyConfig(
|
205
|
+
const config = await getRebuyConfig(PUBLIC_REBUY_API_KEY, PUBLIC_STORE_DOMAIN);
|
206
206
|
setRebuyConfig(config);
|
207
207
|
};
|
208
208
|
if (!rebuyConfig?.shop) {
|
209
209
|
initConfig();
|
210
210
|
}
|
211
|
-
}, [rebuyConfig,
|
211
|
+
}, [rebuyConfig, PUBLIC_REBUY_API_KEY, PUBLIC_STORE_DOMAIN]);
|
212
212
|
const contextParameters = (0, import_react3.useMemo)(
|
213
213
|
() => createContextParameters({
|
214
214
|
cacheKey: rebuyConfig?.shop?.cache_key,
|
@@ -719,33 +719,35 @@ var CART_FRAGMENT = `#graphql
|
|
719
719
|
|
720
720
|
// src/providers/RebuyHydrogenReactContextProvider.tsx
|
721
721
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
722
|
+
var PUBLIC_PRIMARY_DOMAIN2 = process.env.PUBLIC_PRIMARY_DOMAIN;
|
723
|
+
var PUBLIC_REBUY_API_KEY2 = process.env.PUBLIC_REBUY_API_KEY;
|
724
|
+
var PUBLIC_STORE_DOMAIN2 = process.env.PUBLIC_STORE_DOMAIN;
|
725
|
+
var PUBLIC_STOREFRONT_ID = process.env.PUBLIC_STOREFRONT_ID;
|
726
|
+
var PUBLIC_STOREFRONT_API_TOKEN = process.env.PUBLIC_STOREFRONT_API_TOKEN || "";
|
722
727
|
var RebuyHydrogenReactContext = ({ children }) => {
|
723
|
-
|
724
|
-
|
725
|
-
const storeDomain = process.env.PUBLIC_STORE_DOMAIN;
|
726
|
-
if (!primaryDomain) {
|
727
|
-
throw new Error("Missing required environment variable: PRIMARY_DOMAIN");
|
728
|
+
if (!PUBLIC_PRIMARY_DOMAIN2) {
|
729
|
+
throw new Error("Missing required environment variable: PUBLIC_PRIMARY_DOMAIN");
|
728
730
|
}
|
729
|
-
if (!
|
731
|
+
if (!PUBLIC_REBUY_API_KEY2) {
|
730
732
|
throw new Error("Missing required environment variable: PUBLIC_REBUY_API_KEY");
|
731
733
|
}
|
732
|
-
if (!
|
734
|
+
if (!PUBLIC_STORE_DOMAIN2) {
|
733
735
|
throw new Error("Missing required environment variable: PUBLIC_STORE_DOMAIN");
|
734
736
|
}
|
735
737
|
const [rebuyConfig, setRebuyConfig] = (0, import_react5.useState)(null);
|
736
738
|
const location = (0, import_react4.useLocation)();
|
737
739
|
const queryObject = Utilities3.queryStringToObject(location.search);
|
738
|
-
const windowUrl = `${
|
740
|
+
const windowUrl = `${PUBLIC_PRIMARY_DOMAIN2}${location.pathname}${location.search}`;
|
739
741
|
const cart = (0, import_hydrogen_react.useCart)();
|
740
742
|
(0, import_react5.useEffect)(() => {
|
741
743
|
const initConfig = async () => {
|
742
|
-
const config = await getRebuyConfig(
|
744
|
+
const config = await getRebuyConfig(PUBLIC_REBUY_API_KEY2, PUBLIC_STORE_DOMAIN2);
|
743
745
|
setRebuyConfig(config);
|
744
746
|
};
|
745
747
|
if (!rebuyConfig?.shop) {
|
746
748
|
initConfig();
|
747
749
|
}
|
748
|
-
}, [rebuyConfig,
|
750
|
+
}, [rebuyConfig, PUBLIC_REBUY_API_KEY2, PUBLIC_STORE_DOMAIN2]);
|
749
751
|
const contextParameters = (0, import_react5.useMemo)(
|
750
752
|
() => createContextParameters({
|
751
753
|
cacheKey: rebuyConfig?.shop?.cache_key,
|
@@ -794,9 +796,6 @@ var RebuyHydrogenReactContextProvider = ({
|
|
794
796
|
onNoteUpdateComplete,
|
795
797
|
storefrontApiVersion = "2025-01"
|
796
798
|
}) => {
|
797
|
-
const publicStoreDomain = process.env.PUBLIC_STORE_DOMAIN;
|
798
|
-
const storefrontId = process.env.PUBLIC_STOREFRONT_ID;
|
799
|
-
const storefrontToken = process.env.PUBLIC_STOREFRONT_API_TOKEN || "";
|
800
799
|
const adapted = {
|
801
800
|
onAttributesUpdate: onAttributesUpdate ? () => onAttributesUpdate() : void 0,
|
802
801
|
onAttributesUpdateComplete: onAttributesUpdateComplete ? () => onAttributesUpdateComplete() : void 0,
|
@@ -820,10 +819,10 @@ var RebuyHydrogenReactContextProvider = ({
|
|
820
819
|
{
|
821
820
|
countryIsoCode,
|
822
821
|
languageIsoCode,
|
823
|
-
storeDomain:
|
822
|
+
storeDomain: PUBLIC_STORE_DOMAIN2,
|
824
823
|
storefrontApiVersion,
|
825
|
-
storefrontId,
|
826
|
-
storefrontToken,
|
824
|
+
storefrontId: PUBLIC_STOREFRONT_ID,
|
825
|
+
storefrontToken: PUBLIC_STOREFRONT_API_TOKEN,
|
827
826
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
828
827
|
import_hydrogen_react.CartProvider,
|
829
828
|
{
|