@myxtra/authentication-green 1.3.0-alpha.0 → 1.3.1
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-
|
|
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-293d70cb.mjs";
|
|
2
2
|
class H {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
@@ -96,7 +96,7 @@ function Oe(t, e) {
|
|
|
96
96
|
if (!e.options.mutationKey)
|
|
97
97
|
return !1;
|
|
98
98
|
if (s) {
|
|
99
|
-
if (
|
|
99
|
+
if (I(e.options.mutationKey) !== I(o))
|
|
100
100
|
return !1;
|
|
101
101
|
} else if (!se(e.options.mutationKey, o))
|
|
102
102
|
return !1;
|
|
@@ -104,9 +104,9 @@ function Oe(t, e) {
|
|
|
104
104
|
return !(typeof r == "boolean" && e.state.status === "loading" !== r || i && !i(e));
|
|
105
105
|
}
|
|
106
106
|
function ge(t, e) {
|
|
107
|
-
return ((e == null ? void 0 : e.queryKeyHashFn) ||
|
|
107
|
+
return ((e == null ? void 0 : e.queryKeyHashFn) || I)(t);
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function I(t) {
|
|
110
110
|
return JSON.stringify(t, (e, s) => fe(s) ? Object.keys(s).sort().reduce((r, i) => (r[i] = s[i], r), {}) : s);
|
|
111
111
|
}
|
|
112
112
|
function se(t, e) {
|
|
@@ -930,7 +930,7 @@ function Ze() {
|
|
|
930
930
|
variables: void 0
|
|
931
931
|
};
|
|
932
932
|
}
|
|
933
|
-
class
|
|
933
|
+
class Tt extends H {
|
|
934
934
|
constructor(e) {
|
|
935
935
|
super(), this.config = e || {}, this.mutations = [], this.mutationId = 0;
|
|
936
936
|
}
|
|
@@ -992,7 +992,7 @@ class It extends H {
|
|
|
992
992
|
}), this.resuming;
|
|
993
993
|
}
|
|
994
994
|
}
|
|
995
|
-
function
|
|
995
|
+
function It() {
|
|
996
996
|
return {
|
|
997
997
|
onFetch: (t) => {
|
|
998
998
|
t.fetchFn = () => {
|
|
@@ -1067,7 +1067,7 @@ function Ut(t, e) {
|
|
|
1067
1067
|
}
|
|
1068
1068
|
class We {
|
|
1069
1069
|
constructor(e = {}) {
|
|
1070
|
-
this.queryCache = e.queryCache || new Lt(), this.mutationCache = e.mutationCache || new
|
|
1070
|
+
this.queryCache = e.queryCache || new Lt(), this.mutationCache = e.mutationCache || new Tt(), this.logger = e.logger || be, this.defaultOptions = e.defaultOptions || {}, this.queryDefaults = [], this.mutationDefaults = [], this.mountCount = 0;
|
|
1071
1071
|
}
|
|
1072
1072
|
mount() {
|
|
1073
1073
|
this.mountCount++, this.mountCount === 1 && (this.unsubscribeFocus = re.subscribe(() => {
|
|
@@ -1189,7 +1189,7 @@ class We {
|
|
|
1189
1189
|
}
|
|
1190
1190
|
fetchInfiniteQuery(e, s, r) {
|
|
1191
1191
|
const i = Y(e, s, r);
|
|
1192
|
-
return i.behavior =
|
|
1192
|
+
return i.behavior = It(), this.fetchQuery(i);
|
|
1193
1193
|
}
|
|
1194
1194
|
prefetchInfiniteQuery(e, s, r) {
|
|
1195
1195
|
return this.fetchInfiniteQuery(e, s, r).then(k).catch(k);
|
|
@@ -1213,7 +1213,7 @@ class We {
|
|
|
1213
1213
|
this.defaultOptions = e;
|
|
1214
1214
|
}
|
|
1215
1215
|
setQueryDefaults(e, s) {
|
|
1216
|
-
const r = this.queryDefaults.find((i) =>
|
|
1216
|
+
const r = this.queryDefaults.find((i) => I(e) === I(i.queryKey));
|
|
1217
1217
|
r ? r.defaultOptions = s : this.queryDefaults.push({
|
|
1218
1218
|
queryKey: e,
|
|
1219
1219
|
defaultOptions: s
|
|
@@ -1226,7 +1226,7 @@ class We {
|
|
|
1226
1226
|
return s == null ? void 0 : s.defaultOptions;
|
|
1227
1227
|
}
|
|
1228
1228
|
setMutationDefaults(e, s) {
|
|
1229
|
-
const r = this.mutationDefaults.find((i) =>
|
|
1229
|
+
const r = this.mutationDefaults.find((i) => I(e) === I(i.mutationKey));
|
|
1230
1230
|
r ? r.defaultOptions = s : this.mutationDefaults.push({
|
|
1231
1231
|
mutationKey: e,
|
|
1232
1232
|
defaultOptions: s
|
|
@@ -1918,7 +1918,10 @@ var Rs = d.forwardRef(
|
|
|
1918
1918
|
);
|
|
1919
1919
|
Rs.displayName = "TextField";
|
|
1920
1920
|
d.createContext(void 0);
|
|
1921
|
-
var Es = ({ children: t }) => /* @__PURE__ */ n.jsx("div", { className: "card__header__action", children: t }), Os = (
|
|
1921
|
+
var Es = ({ children: t }) => /* @__PURE__ */ n.jsx("div", { className: "card__header__action", children: t }), Os = (t) => {
|
|
1922
|
+
var e = t, { children: s } = e, r = A(e, ["children"]);
|
|
1923
|
+
return /* @__PURE__ */ n.jsx("div", E(x({ className: "card__body" }, r), { children: s }));
|
|
1924
|
+
}, Ss = (t) => /* @__PURE__ */ n.jsx(
|
|
1922
1925
|
"svg",
|
|
1923
1926
|
E(x({
|
|
1924
1927
|
width: "24",
|
|
@@ -2015,7 +2018,7 @@ var Es = ({ children: t }) => /* @__PURE__ */ n.jsx("div", { className: "card__h
|
|
|
2015
2018
|
}
|
|
2016
2019
|
)
|
|
2017
2020
|
})
|
|
2018
|
-
), Ds = Ls,
|
|
2021
|
+
), Ds = Ls, Ts = (t) => /* @__PURE__ */ n.jsxs(
|
|
2019
2022
|
"svg",
|
|
2020
2023
|
E(x({
|
|
2021
2024
|
width: "24",
|
|
@@ -2052,7 +2055,7 @@ var Es = ({ children: t }) => /* @__PURE__ */ n.jsx("div", { className: "card__h
|
|
|
2052
2055
|
/* @__PURE__ */ n.jsx("defs", { children: /* @__PURE__ */ n.jsx("clipPath", { id: "clip0_19_444", children: /* @__PURE__ */ n.jsx("rect", { width: "24", height: "24", fill: "white" }) }) })
|
|
2053
2056
|
]
|
|
2054
2057
|
})
|
|
2055
|
-
),
|
|
2058
|
+
), Is = Ts, Us = (t) => /* @__PURE__ */ n.jsxs(
|
|
2056
2059
|
"svg",
|
|
2057
2060
|
E(x({
|
|
2058
2061
|
width: "24",
|
|
@@ -2570,7 +2573,7 @@ U.Error = or;
|
|
|
2570
2573
|
var dr = (t) => {
|
|
2571
2574
|
var e = t, { type: s = "div", className: r, children: i } = e, o = A(e, ["type", "className", "children"]);
|
|
2572
2575
|
return d.createElement(s, x({ className: O("dialog__body", r) }, o), i);
|
|
2573
|
-
}, ye = () => document.body.style.removeProperty("overflow"),
|
|
2576
|
+
}, ye = () => document.body.style.removeProperty("overflow"), Te = (t) => t.preventDefault(), hr = 'a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])', fr = (t) => {
|
|
2574
2577
|
var e = t, { className: s, children: r, shouldAnimate: i = !0 } = e, o = A(e, ["className", "children", "shouldAnimate"]);
|
|
2575
2578
|
const { ref: a, defaultOpen: u, isModal: l, onClose: h } = X();
|
|
2576
2579
|
return d.useEffect(() => {
|
|
@@ -2590,7 +2593,7 @@ var dr = (t) => {
|
|
|
2590
2593
|
if (!c)
|
|
2591
2594
|
return;
|
|
2592
2595
|
if (u && (c.removeAttribute("open"), c.showModal(), c.focus()), l)
|
|
2593
|
-
return c.addEventListener("cancel",
|
|
2596
|
+
return c.addEventListener("cancel", Te), () => c.removeEventListener("cancel", Te);
|
|
2594
2597
|
const p = ({ clientX: v, clientY: f }) => {
|
|
2595
2598
|
const { top: y, right: g, bottom: m, left: C } = c.getBoundingClientRect(), _ = 0 < f && 0 < v, j = y < f && f < m, S = C < v && v < g;
|
|
2596
2599
|
_ && !(j && S) && h();
|
|
@@ -2876,7 +2879,7 @@ const B = ({
|
|
|
2876
2879
|
getTermsAndConditionsEndpoint: o,
|
|
2877
2880
|
postTermsAndConditionsEndpoint: a
|
|
2878
2881
|
};
|
|
2879
|
-
}, Er = (t) => t ? /* @__PURE__ */ n.jsx("ul", { className: "bou-menu__list", children: t == null ? void 0 : t.map(({ label: e, icon: s, url: r }, i) => /* @__PURE__ */ n.jsx(
|
|
2882
|
+
}, Er = (t) => t != null && t.length ? /* @__PURE__ */ n.jsx("ul", { className: "bou-menu__list", children: t == null ? void 0 : t.map(({ label: e, icon: s, url: r }, i) => /* @__PURE__ */ n.jsx(
|
|
2880
2883
|
B,
|
|
2881
2884
|
{
|
|
2882
2885
|
className: "bou-menu-item",
|
|
@@ -2942,7 +2945,7 @@ const B = ({
|
|
|
2942
2945
|
className: "manage-privacy",
|
|
2943
2946
|
mobileUrl: `${e}/manage-privacy`,
|
|
2944
2947
|
desktopUrl: `${e}/manage-privacy/permissions`,
|
|
2945
|
-
icon: /* @__PURE__ */ n.jsx(
|
|
2948
|
+
icon: /* @__PURE__ */ n.jsx(Is, {}),
|
|
2946
2949
|
label: t("privacy")
|
|
2947
2950
|
}
|
|
2948
2951
|
),
|
|
@@ -2999,13 +3002,13 @@ const Ar = () => {
|
|
|
2999
3002
|
] })
|
|
3000
3003
|
] });
|
|
3001
3004
|
};
|
|
3002
|
-
var
|
|
3005
|
+
var T = /* @__PURE__ */ ((t) => (t.Authenticated = "authenticated", t.NotAuthenticated = "notAuthenticated", t.Pending = "pending", t))(T || {});
|
|
3003
3006
|
const Nr = () => {
|
|
3004
3007
|
const { authenticationStatus: t } = Re();
|
|
3005
|
-
return t ===
|
|
3008
|
+
return t === T.NotAuthenticated ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
3006
3009
|
/* @__PURE__ */ n.jsx(Pr, {}),
|
|
3007
3010
|
/* @__PURE__ */ n.jsx(Ar, {})
|
|
3008
|
-
] }) : t ===
|
|
3011
|
+
] }) : t === T.Pending ? /* @__PURE__ */ n.jsx(Sr, {}) : /* @__PURE__ */ n.jsx(Or, {});
|
|
3009
3012
|
};
|
|
3010
3013
|
/*! js-cookie v3.0.5 | MIT */
|
|
3011
3014
|
function ee(t) {
|
|
@@ -3078,7 +3081,7 @@ function Ce(t, e) {
|
|
|
3078
3081
|
);
|
|
3079
3082
|
}
|
|
3080
3083
|
var xe = Ce(Mr, { path: "/" });
|
|
3081
|
-
class
|
|
3084
|
+
class Ie extends Error {
|
|
3082
3085
|
constructor(e) {
|
|
3083
3086
|
super(e), this.name = "UnauthorizedError";
|
|
3084
3087
|
}
|
|
@@ -3094,22 +3097,22 @@ const Fr = () => {
|
|
|
3094
3097
|
headers: { "Accept-Language": t.language }
|
|
3095
3098
|
});
|
|
3096
3099
|
if (!r.ok)
|
|
3097
|
-
throw r.status === 401 ? new
|
|
3100
|
+
throw r.status === 401 ? new Ie(`${r.status} - ${r.statusText}`) : new Error("Network response was not ok");
|
|
3098
3101
|
return await r.json();
|
|
3099
3102
|
},
|
|
3100
|
-
retry: (r, i) => i instanceof
|
|
3103
|
+
retry: (r, i) => i instanceof Ie ? !1 : r < 2,
|
|
3101
3104
|
refetchOnWindowFocus: !1
|
|
3102
3105
|
});
|
|
3103
3106
|
}, Ct = () => {
|
|
3104
3107
|
var u, l;
|
|
3105
3108
|
const t = xe.get("profile"), e = !!t, [s, r] = d.useState(
|
|
3106
|
-
e ?
|
|
3109
|
+
e ? T.Authenticated : T.Pending
|
|
3107
3110
|
), [i, o] = d.useState(
|
|
3108
3111
|
e ? JSON.parse(t) : void 0
|
|
3109
3112
|
), a = Fr();
|
|
3110
3113
|
return d.useEffect(() => {
|
|
3111
|
-
if (a.isError && (xe.remove("profile"), r(
|
|
3112
|
-
r(
|
|
3114
|
+
if (a.isError && (xe.remove("profile"), r(T.NotAuthenticated)), a.isSuccess) {
|
|
3115
|
+
r(T.Authenticated);
|
|
3113
3116
|
const h = {
|
|
3114
3117
|
firstName: a.data.firstName,
|
|
3115
3118
|
lastName: a.data.lastName
|
|
@@ -3136,14 +3139,14 @@ const Fr = () => {
|
|
|
3136
3139
|
}
|
|
3137
3140
|
);
|
|
3138
3141
|
};
|
|
3139
|
-
var Lr = Object.defineProperty, Dr = Object.defineProperties,
|
|
3142
|
+
var Lr = Object.defineProperty, Dr = Object.defineProperties, Tr = Object.getOwnPropertyDescriptors, ae = Object.getOwnPropertySymbols, xt = Object.prototype.hasOwnProperty, gt = Object.prototype.propertyIsEnumerable, Ue = (t, e, s) => e in t ? Lr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s, q = (t, e) => {
|
|
3140
3143
|
for (var s in e || (e = {}))
|
|
3141
3144
|
xt.call(e, s) && Ue(t, s, e[s]);
|
|
3142
3145
|
if (ae)
|
|
3143
3146
|
for (var s of ae(e))
|
|
3144
3147
|
gt.call(e, s) && Ue(t, s, e[s]);
|
|
3145
3148
|
return t;
|
|
3146
|
-
}, G = (t, e) => Dr(t,
|
|
3149
|
+
}, G = (t, e) => Dr(t, Tr(e)), Z = (t, e) => {
|
|
3147
3150
|
var s = {};
|
|
3148
3151
|
for (var r in t)
|
|
3149
3152
|
xt.call(t, r) && e.indexOf(r) < 0 && (s[r] = t[r]);
|
|
@@ -3151,7 +3154,7 @@ var Lr = Object.defineProperty, Dr = Object.defineProperties, Ir = Object.getOwn
|
|
|
3151
3154
|
for (var r of ae(t))
|
|
3152
3155
|
e.indexOf(r) < 0 && gt.call(t, r) && (s[r] = t[r]);
|
|
3153
3156
|
return s;
|
|
3154
|
-
},
|
|
3157
|
+
}, Ir = d.forwardRef((t, e) => {
|
|
3155
3158
|
const s = t, { isAuthenticated: r, className: i } = s, o = Z(s, ["isAuthenticated", "className"]);
|
|
3156
3159
|
return /* @__PURE__ */ n.jsx(
|
|
3157
3160
|
V,
|
|
@@ -3167,7 +3170,7 @@ var Lr = Object.defineProperty, Dr = Object.defineProperties, Ir = Object.getOwn
|
|
|
3167
3170
|
}, o)
|
|
3168
3171
|
);
|
|
3169
3172
|
});
|
|
3170
|
-
|
|
3173
|
+
Ir.displayName = "AuthenticationButton";
|
|
3171
3174
|
var Ur = (t) => {
|
|
3172
3175
|
var e = t, {
|
|
3173
3176
|
children: s
|
|
@@ -3230,7 +3233,7 @@ const Vr = () => {
|
|
|
3230
3233
|
}
|
|
3231
3234
|
});
|
|
3232
3235
|
}, $r = () => {
|
|
3233
|
-
const { i18n: t } = Q(), { getTermsAndConditionsEndpoint: e } = $(), { authenticationStatus: s } = Ct(), r = xe.get("hasAcceptedLatestTermsAndConditions"), i = [], o = r === "true", a = s ===
|
|
3236
|
+
const { i18n: t } = Q(), { getTermsAndConditionsEndpoint: e } = $(), { authenticationStatus: s } = Ct(), r = xe.get("hasAcceptedLatestTermsAndConditions"), i = [], o = r === "true", a = s === T.Authenticated;
|
|
3234
3237
|
return nt({
|
|
3235
3238
|
queryKey: ["gdpr"],
|
|
3236
3239
|
queryFn: async () => {
|