@mx-cartographer/experiences 5.2.8-alpha.mm2 → 5.2.8-alpha.mm3

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 +1 @@
1
- export declare const AccountBanner: () => "" | import("react/jsx-runtime").JSX.Element | undefined;
1
+ export declare const AccountBanner: () => import("react/jsx-runtime").JSX.Element | null;
@@ -1,7 +1,8 @@
1
1
  export declare class Fetch {
2
2
  endpoint: string;
3
3
  headers: {};
4
- constructor(endpoint: string, token: string);
4
+ fetchOptions: {};
5
+ constructor(endpoint: string, token: string, options?: {});
5
6
  get: (url: string) => Promise<any>;
6
7
  post: (url: string, data?: any) => Promise<any>;
7
8
  put: (url: string, data: any) => Promise<any>;
package/dist/index.es.js CHANGED
@@ -843,18 +843,20 @@ const Bt = 44, Hr = (A, t) => A.find((i) => i.guid === t), Fs = (A, t) => A.find
843
843
  class _A {
844
844
  endpoint = "/";
845
845
  headers = {};
846
- constructor(t, i) {
846
+ fetchOptions = {};
847
+ constructor(t, i, n = {}) {
847
848
  this.endpoint = t, this.headers = {
848
849
  Accept: "application/json",
849
850
  "Accept-Language": ht(),
850
851
  "Content-Type": "application/json",
851
852
  "MD-Session-Token": i
852
- };
853
+ }, this.fetchOptions = n;
853
854
  }
854
855
  get = async (t) => {
855
856
  const i = {
856
857
  method: "GET",
857
- headers: this.headers
858
+ headers: this.headers,
859
+ ...this.fetchOptions
858
860
  };
859
861
  return fetch(`${this.endpoint}${t}`, i).then((n) => {
860
862
  if (n.ok)
@@ -989,11 +991,19 @@ const ic = "https://analytics.moneydesktop.com";
989
991
  class nc {
990
992
  fetchInstance;
991
993
  constructor() {
992
- this.fetchInstance = new _A(ic, "");
994
+ this.fetchInstance = new _A(ic, "", {
995
+ mode: "cors",
996
+ credentials: "include"
997
+ // This might help with CORS if the server supports credentials
998
+ });
993
999
  }
994
1000
  requestCampaignBanner = async (t) => {
995
- const i = `/banner/${t}/account_widget_banner`;
996
- return this.fetchInstance.get(i).then((n) => n.banner);
1001
+ try {
1002
+ const i = `/banner/${t}/account_widget_banner`;
1003
+ return this.fetchInstance.get(i).then((n) => n.banner);
1004
+ } catch (i) {
1005
+ return console.error("Error fetching banner:", i), null;
1006
+ }
997
1007
  };
998
1008
  }
999
1009
  class Ot {
@@ -20845,10 +20855,16 @@ const YR = ({
20845
20855
  });
20846
20856
  var zn = /* @__PURE__ */ ((A) => (A[A.Main = 0] = "Main", A[A.RightSide = 1] = "RightSide", A))(zn || {});
20847
20857
  const r3 = () => {
20848
- const A = uA(), { banner: t, loadBanner: i } = zA();
20858
+ const A = uA(), { banner: t, loadBanner: i } = zA(), [n, r] = h.useState(!1);
20849
20859
  return h.useEffect(() => {
20850
- i();
20851
- }, []), t?.redirect_url && t?.image_url && /* @__PURE__ */ e(
20860
+ (async () => {
20861
+ try {
20862
+ await i();
20863
+ } catch (I) {
20864
+ console.error("Failed to load banner:", I), r(!0);
20865
+ }
20866
+ })();
20867
+ }, [i]), n || !t?.redirect_url || !t?.image_url ? null : /* @__PURE__ */ e(
20852
20868
  O,
20853
20869
  {
20854
20870
  sx: {
@@ -20857,7 +20873,7 @@ const r3 = () => {
20857
20873
  justifyContent: "center",
20858
20874
  maxWidth: "100%"
20859
20875
  },
20860
- children: /* @__PURE__ */ e("a", { href: t?.redirect_url, rel: "noreferrer", target: "_blank", children: /* @__PURE__ */ e(
20876
+ children: /* @__PURE__ */ e("a", { href: t.redirect_url, rel: "noreferrer", target: "_blank", children: /* @__PURE__ */ e(
20861
20877
  "img",
20862
20878
  {
20863
20879
  alt: "",