@myxtra/authentication-green 1.2.2 → 1.2.4

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,4 +1,4 @@
1
- import { r as d, j as n, g as wt, u as Q, a as Qe, b as _t, E as Rt } from "./index-964ee255.mjs";
1
+ import { r as d, j as n, g as wt, u as Q, a as Qe, b as _t, E as Rt } from "./index-3a8fc734.mjs";
2
2
  class H {
3
3
  constructor() {
4
4
  this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
@@ -56,7 +56,7 @@ function Ot(t, e, s) {
56
56
  ...t
57
57
  };
58
58
  }
59
- function I(t, e, s) {
59
+ function D(t, e, s) {
60
60
  return J(t) ? [{
61
61
  ...e,
62
62
  queryKey: t
@@ -719,11 +719,11 @@ class Lt extends H {
719
719
  return this.queries;
720
720
  }
721
721
  find(e, s) {
722
- const [r] = I(e, s);
722
+ const [r] = D(e, s);
723
723
  return typeof r.exact > "u" && (r.exact = !0), this.queries.find((i) => Ee(r, i));
724
724
  }
725
725
  findAll(e, s) {
726
- const [r] = I(e, s);
726
+ const [r] = D(e, s);
727
727
  return Object.keys(r).length > 0 ? this.queries.filter((i) => Ee(r, i)) : this.queries;
728
728
  }
729
729
  notify(e) {
@@ -1081,7 +1081,7 @@ class We {
1081
1081
  this.mountCount--, this.mountCount === 0 && ((e = this.unsubscribeFocus) == null || e.call(this), this.unsubscribeFocus = void 0, (s = this.unsubscribeOnline) == null || s.call(this), this.unsubscribeOnline = void 0);
1082
1082
  }
1083
1083
  isFetching(e, s) {
1084
- const [r] = I(e, s);
1084
+ const [r] = D(e, s);
1085
1085
  return r.fetchStatus = "fetching", this.queryCache.findAll(r).length;
1086
1086
  }
1087
1087
  isMutating(e) {
@@ -1127,7 +1127,7 @@ class We {
1127
1127
  return (r = this.queryCache.find(e, s)) == null ? void 0 : r.state;
1128
1128
  }
1129
1129
  removeQueries(e, s) {
1130
- const [r] = I(e, s), i = this.queryCache;
1130
+ const [r] = D(e, s), i = this.queryCache;
1131
1131
  P.batch(() => {
1132
1132
  i.findAll(r).forEach((o) => {
1133
1133
  i.remove(o);
@@ -1135,7 +1135,7 @@ class We {
1135
1135
  });
1136
1136
  }
1137
1137
  resetQueries(e, s, r) {
1138
- const [i, o] = I(e, s, r), a = this.queryCache, u = {
1138
+ const [i, o] = D(e, s, r), a = this.queryCache, u = {
1139
1139
  type: "active",
1140
1140
  ...i
1141
1141
  };
@@ -1144,13 +1144,13 @@ class We {
1144
1144
  }), this.refetchQueries(u, o)));
1145
1145
  }
1146
1146
  cancelQueries(e, s, r) {
1147
- const [i, o = {}] = I(e, s, r);
1147
+ const [i, o = {}] = D(e, s, r);
1148
1148
  typeof o.revert > "u" && (o.revert = !0);
1149
1149
  const a = P.batch(() => this.queryCache.findAll(i).map((u) => u.cancel(o)));
1150
1150
  return Promise.all(a).then(k).catch(k);
1151
1151
  }
1152
1152
  invalidateQueries(e, s, r) {
1153
- const [i, o] = I(e, s, r);
1153
+ const [i, o] = D(e, s, r);
1154
1154
  return P.batch(() => {
1155
1155
  var a, u;
1156
1156
  if (this.queryCache.findAll(i).forEach((h) => {
@@ -1165,7 +1165,7 @@ class We {
1165
1165
  });
1166
1166
  }
1167
1167
  refetchQueries(e, s, r) {
1168
- const [i, o] = I(e, s, r), a = P.batch(() => this.queryCache.findAll(i).filter((l) => !l.isDisabled()).map((l) => {
1168
+ const [i, o] = D(e, s, r), a = P.batch(() => this.queryCache.findAll(i).filter((l) => !l.isDisabled()).map((l) => {
1169
1169
  var h;
1170
1170
  return l.fetch(void 0, {
1171
1171
  ...o,
@@ -2999,13 +2999,13 @@ const Ar = () => {
2999
2999
  ] })
3000
3000
  ] });
3001
3001
  };
3002
- var D = /* @__PURE__ */ ((t) => (t.Authenticated = "authenticated", t.NotAuthenticated = "notAuthenticated", t.Pending = "pending", t))(D || {});
3002
+ var I = /* @__PURE__ */ ((t) => (t.Authenticated = "authenticated", t.NotAuthenticated = "notAuthenticated", t.Pending = "pending", t))(I || {});
3003
3003
  const Nr = () => {
3004
3004
  const { authenticationStatus: t } = Re();
3005
- return t === D.NotAuthenticated ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3005
+ return t === I.NotAuthenticated ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3006
3006
  /* @__PURE__ */ n.jsx(Pr, {}),
3007
3007
  /* @__PURE__ */ n.jsx(Ar, {})
3008
- ] }) : t === D.Pending ? /* @__PURE__ */ n.jsx(Sr, {}) : /* @__PURE__ */ n.jsx(Or, {});
3008
+ ] }) : t === I.Pending ? /* @__PURE__ */ n.jsx(Sr, {}) : /* @__PURE__ */ n.jsx(Or, {});
3009
3009
  };
3010
3010
  /*! js-cookie v3.0.5 | MIT */
3011
3011
  function ee(t) {
@@ -3086,7 +3086,6 @@ class Te extends Error {
3086
3086
  const Fr = () => {
3087
3087
  const { i18n: t } = Q(), { profileEndpoint: e } = $();
3088
3088
  return nt({
3089
- // @ts-expect-error queryKey is the right type
3090
3089
  queryKey: ["profile"],
3091
3090
  queryFn: async () => {
3092
3091
  const r = await fetch(e, {
@@ -3098,19 +3097,19 @@ const Fr = () => {
3098
3097
  throw r.status === 401 ? new Te(`${r.status} - ${r.statusText}`) : new Error("Network response was not ok");
3099
3098
  return await r.json();
3100
3099
  },
3101
- retry: (r, i) => i instanceof Te ? !1 : 3,
3100
+ retry: (r, i) => i instanceof Te ? !1 : r < 2,
3102
3101
  refetchOnWindowFocus: !1
3103
3102
  });
3104
3103
  }, Ct = () => {
3105
3104
  var u, l;
3106
3105
  const t = xe.get("profile"), e = !!t, [s, r] = d.useState(
3107
- e ? D.Authenticated : D.Pending
3106
+ e ? I.Authenticated : I.Pending
3108
3107
  ), [i, o] = d.useState(
3109
3108
  e ? JSON.parse(t) : void 0
3110
3109
  ), a = Fr();
3111
3110
  return d.useEffect(() => {
3112
- if (a.isError && e && (xe.remove("profile"), r(D.NotAuthenticated)), a.isError && !e && r(D.NotAuthenticated), a.isSuccess) {
3113
- r(D.Authenticated);
3111
+ if (a.isError && (xe.remove("profile"), r(I.NotAuthenticated)), a.isSuccess) {
3112
+ r(I.Authenticated);
3114
3113
  const h = {
3115
3114
  firstName: a.data.firstName,
3116
3115
  lastName: a.data.lastName
@@ -3118,13 +3117,10 @@ const Fr = () => {
3118
3117
  o(h);
3119
3118
  }
3120
3119
  }, [
3121
- s,
3122
3120
  e,
3123
- t,
3124
3121
  (u = a.data) == null ? void 0 : u.firstName,
3125
3122
  (l = a.data) == null ? void 0 : l.lastName,
3126
3123
  a.isError,
3127
- a.isLoading,
3128
3124
  a.isSuccess
3129
3125
  ]), { authenticationStatus: s, profile: i };
3130
3126
  }, kr = ({ position: t, bouMenuItems: e }) => {
@@ -3234,7 +3230,7 @@ const Vr = () => {
3234
3230
  }
3235
3231
  });
3236
3232
  }, $r = () => {
3237
- const { i18n: t } = Q(), { getTermsAndConditionsEndpoint: e } = $(), { authenticationStatus: s } = Ct(), r = xe.get("hasAcceptedLatestTermsAndConditions"), i = [], o = r === "true", a = s === D.Authenticated;
3233
+ const { i18n: t } = Q(), { getTermsAndConditionsEndpoint: e } = $(), { authenticationStatus: s } = Ct(), r = xe.get("hasAcceptedLatestTermsAndConditions"), i = [], o = r === "true", a = s === I.Authenticated;
3238
3234
  return nt({
3239
3235
  queryKey: ["gdpr"],
3240
3236
  queryFn: async () => {
@@ -8987,7 +8987,7 @@ class sh extends HTMLElement {
8987
8987
  async connectedCallback() {
8988
8988
  const t = this.attachShadow({ mode: "open" });
8989
8989
  uh(t);
8990
- const n = Sd(t), r = (await import("./App-b84d28ed.mjs")).default;
8990
+ const n = Sd(t), r = (await import("./App-e8ac02e6.mjs")).default;
8991
8991
  n.render(
8992
8992
  /* @__PURE__ */ nr.jsx(
8993
8993
  r,
@@ -1,4 +1,4 @@
1
- import { c as f } from "./index-964ee255.mjs";
1
+ import { c as f } from "./index-3a8fc734.mjs";
2
2
  export {
3
3
  f as default
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myxtra/authentication-green",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "main": "./dist/xtra-authentication.mjs",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -19,9 +19,9 @@
19
19
  "translations:pull": "crowdin pull && prettier --write './src/assets/locales'"
20
20
  },
21
21
  "dependencies": {
22
- "@myxtra/authentication-react": "1.6.2",
23
- "@myxtra/shared": "1.6.2",
24
- "@myxtra/ui-react": "1.6.2",
22
+ "@myxtra/authentication-react": "1.6.3",
23
+ "@myxtra/shared": "1.6.3",
24
+ "@myxtra/ui-react": "1.6.3",
25
25
  "@tanstack/react-query": "^4.32.0",
26
26
  "clsx": "^2.0.0",
27
27
  "i18next": "^22.5.1",