@swift-food-services/catering-widget 0.1.0-beta.1 → 0.1.0-beta.3

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.cjs CHANGED
@@ -26,12 +26,10 @@ function useCateringConfig() {
26
26
  function useStorage() {
27
27
  return useCateringConfig().storage;
28
28
  }
29
-
30
- // src/api/baseUrl.ts
31
- var DEFAULT_API_BASE_URL = "https://api.swiftfood.uk";
32
29
  function resolveBaseUrl(override) {
33
30
  if (override) return override.replace(/\/$/, "");
34
- return (DEFAULT_API_BASE_URL).replace(/\/$/, "");
31
+ const envUrl = "https://swiftfoods-32981ec7b5a4.herokuapp.com";
32
+ return (envUrl).replace(/\/$/, "");
35
33
  }
36
34
 
37
35
  // src/api/client.ts
@@ -3821,8 +3819,12 @@ function DateSessionNav({
3821
3819
  }
3822
3820
 
3823
3821
  // src/shims/fetchWithAuth.ts
3822
+ var runtimeBaseUrl;
3823
+ function setWidgetBaseUrl(url) {
3824
+ runtimeBaseUrl = url;
3825
+ }
3824
3826
  async function fetchWithAuth(input, init) {
3825
- const url = input.startsWith("http://") || input.startsWith("https://") ? input : `${resolveBaseUrl()}${input}`;
3827
+ const url = input.startsWith("http://") || input.startsWith("https://") ? input : `${resolveBaseUrl(runtimeBaseUrl)}${input}`;
3826
3828
  const headers = {
3827
3829
  ...{}
3828
3830
  };
@@ -4633,12 +4635,7 @@ var GOOGLE_MAPS_CONFIG = {
4633
4635
  "name"
4634
4636
  ]
4635
4637
  };
4636
- var GOOGLE_MAPS_API_KEY = "";
4637
- if (typeof window !== "undefined" && (!GOOGLE_MAPS_API_KEY)) {
4638
- console.warn(
4639
- "[@swift-food-services/catering-widget] Google Maps API key was not injected at build time. The address-autocomplete field will not work. Set SWIFT_WIDGET_GOOGLE_MAPS_KEY before running the widget build."
4640
- );
4641
- }
4638
+ var GOOGLE_MAPS_API_KEY = "AIzaSyBa84yiNxYkVBImykiXqJMMnLFX7txfbeI";
4642
4639
 
4643
4640
  // src/utils/google-maps-loader.ts
4644
4641
  var isLoading = false;
@@ -12648,6 +12645,7 @@ var STUB_PARTNER_ID = "stub";
12648
12645
  function CateringWidget(props) {
12649
12646
  const {
12650
12647
  publishableKey,
12648
+ baseUrl,
12651
12649
  theme,
12652
12650
  initialData,
12653
12651
  stickyTopOffset,
@@ -12657,7 +12655,8 @@ function CateringWidget(props) {
12657
12655
  } = props;
12658
12656
  const partnerId = STUB_PARTNER_ID;
12659
12657
  const [baseConfig] = react.useState(() => {
12660
- const apiClient = createApiClient({ publishableKey });
12658
+ setWidgetBaseUrl(baseUrl);
12659
+ const apiClient = createApiClient({ publishableKey, baseUrl });
12661
12660
  const api = createApiEndpoints(apiClient);
12662
12661
  setCateringServiceEndpoints(api);
12663
12662
  return {