codeforlife 2.11.5 → 2.11.7
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/Countdown-CL7dyZrl.cjs +2 -0
- package/dist/{Countdown-BtUbr1J_.cjs.map → Countdown-CL7dyZrl.cjs.map} +1 -1
- package/dist/Countdown-snRYiLrs.js +28 -0
- package/dist/{Countdown-DhjAmB0u.js.map → Countdown-snRYiLrs.js.map} +1 -1
- package/dist/Image-B_6DmnVe.cjs +2 -0
- package/dist/{Image-CgRVUblT.cjs.map → Image-B_6DmnVe.cjs.map} +1 -1
- package/dist/{Image-DTOu0h-V.js → Image-mkNhOo5p.js} +3 -3
- package/dist/{Image-DTOu0h-V.js.map → Image-mkNhOo5p.js.map} +1 -1
- package/dist/LinkButton-BQMG96aQ.cjs +2 -0
- package/dist/{LinkButton-Kw2brLTK.cjs.map → LinkButton-BQMG96aQ.cjs.map} +1 -1
- package/dist/LinkButton-CRDs950E.js +12 -0
- package/dist/{LinkButton-sQ5jgHnX.js.map → LinkButton-CRDs950E.js.map} +1 -1
- package/dist/Navigate-Ch0ljYa-.cjs +2 -0
- package/dist/{Navigate-CrMwdIBB.cjs.map → Navigate-Ch0ljYa-.cjs.map} +1 -1
- package/dist/Navigate-Zt9DRJve.js +25 -0
- package/dist/{Navigate-ClPcw87e.js.map → Navigate-Zt9DRJve.js.map} +1 -1
- package/dist/api/endpoints/index.cjs.js +1 -1
- package/dist/api/endpoints/index.cjs.js.map +1 -1
- package/dist/api/endpoints/index.es.js +29 -28
- package/dist/api/endpoints/index.es.js.map +1 -1
- package/dist/api/index.cjs.js +1 -3
- package/dist/api/index.cjs.js.map +1 -1
- package/dist/api/index.es.js +33 -515
- package/dist/api/index.es.js.map +1 -1
- package/dist/api-DIgp_6Vr.cjs +2 -0
- package/dist/{api-9cnyvZj7.cjs.map → api-DIgp_6Vr.cjs.map} +1 -1
- package/dist/api-G8CV5bUa.cjs +2 -0
- package/dist/{api-CAH3GT1O.cjs.map → api-G8CV5bUa.cjs.map} +1 -1
- package/dist/{api-BFYu8ZvQ.js → api-uh8UKwsU.js} +25 -25
- package/dist/{api-BFYu8ZvQ.js.map → api-uh8UKwsU.js.map} +1 -1
- package/dist/auth-B6anBtxF.js +238 -0
- package/dist/{auth-Bb8WkZGN.js.map → auth-B6anBtxF.js.map} +1 -1
- package/dist/auth-C2OUeLmQ.cjs +2 -0
- package/dist/{auth-BwpsrTko.cjs.map → auth-C2OUeLmQ.cjs.map} +1 -1
- package/dist/components/form/index.cjs.js +1 -1
- package/dist/components/form/index.es.js +1 -1
- package/dist/components/index.cjs.js +1 -1
- package/dist/components/index.cjs.js.map +1 -1
- package/dist/components/index.es.js +118 -118
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/page/index.cjs.js +1 -1
- package/dist/components/page/index.es.js +1 -1
- package/dist/components/router/index.cjs.js +1 -1
- package/dist/components/router/index.es.js +2 -2
- package/dist/components/table/index.cjs.js +1 -1
- package/dist/components/table/index.es.js +1 -1
- package/dist/features/index.cjs.js +1 -1
- package/dist/features/index.cjs.js.map +1 -1
- package/dist/features/index.es.js +24 -22
- package/dist/features/index.es.js.map +1 -1
- package/dist/general-BPbbmkeX.cjs +2 -0
- package/dist/{general-Bo6JGvKB.cjs.map → general-BPbbmkeX.cjs.map} +1 -1
- package/dist/hooks/index.cjs.js +1 -1
- package/dist/hooks/index.es.js +1 -1
- package/dist/index-B3QkMBQe.cjs +2 -0
- package/dist/{index-5C9hpxRF.cjs.map → index-B3QkMBQe.cjs.map} +1 -1
- package/dist/index-BIL7PoEV.js +622 -0
- package/dist/index-BIL7PoEV.js.map +1 -0
- package/dist/index-C08WO83n.js +237 -0
- package/dist/{index-hdS8RgRc.js.map → index-C08WO83n.js.map} +1 -1
- package/dist/{index-CHboZsxD.js → index-CDxf6gMv.js} +92 -92
- package/dist/{index-CHboZsxD.js.map → index-CDxf6gMv.js.map} +1 -1
- package/dist/index-D2B9uIE4.cjs +2 -0
- package/dist/{index-B89FjK7v.cjs.map → index-D2B9uIE4.cjs.map} +1 -1
- package/dist/index-Dadidnct.cjs +2 -0
- package/dist/index-Dadidnct.cjs.map +1 -0
- package/dist/index-IXGAdLKG.js +30 -0
- package/dist/{index-B3e_XaVG.js.map → index-IXGAdLKG.js.map} +1 -1
- package/dist/index-JY2Et3RQ.cjs +2 -0
- package/dist/{index-CwC9mpb3.cjs.map → index-JY2Et3RQ.cjs.map} +1 -1
- package/dist/{schemas-BMQZbhti.js → schemas-UIk-meAN.js} +2 -2
- package/dist/{schemas-BMQZbhti.js.map → schemas-UIk-meAN.js.map} +1 -1
- package/dist/schemas-hIW9-H6-.cjs +2 -0
- package/dist/{schemas-DXX4rh8i.cjs.map → schemas-hIW9-H6-.cjs.map} +1 -1
- package/dist/server/App.cjs.js +1 -1
- package/dist/server/App.cjs.js.map +1 -1
- package/dist/server/App.es.js +11 -11
- package/dist/server/App.es.js.map +1 -1
- package/dist/server/entry.cjs.js +1 -1
- package/dist/server/entry.cjs.js.map +1 -1
- package/dist/server/entry.es.js +17 -17
- package/dist/server/entry.es.js.map +1 -1
- package/dist/{session-D312kYKk.js → session-COyN01K0.js} +11 -10
- package/dist/{session-D312kYKk.js.map → session-COyN01K0.js.map} +1 -1
- package/dist/session-eOp0H-EC.cjs +2 -0
- package/dist/{session-CacrgFSv.cjs.map → session-eOp0H-EC.cjs.map} +1 -1
- package/dist/theme/components/index.cjs.js +1 -1
- package/dist/theme/components/index.es.js +1 -1
- package/dist/theme/index.cjs.js +1 -1
- package/dist/theme/index.cjs.js.map +1 -1
- package/dist/theme/index.es.js +49 -49
- package/dist/theme/index.es.js.map +1 -1
- package/dist/{urls-CGZI0f1w.cjs → urls-2gheISSO.cjs} +2 -2
- package/dist/{urls-CGZI0f1w.cjs.map → urls-2gheISSO.cjs.map} +1 -1
- package/dist/{urls-DP4a8kxP.js → urls-BG788CnL.js} +2 -2
- package/dist/{urls-DP4a8kxP.js.map → urls-BG788CnL.js.map} +1 -1
- package/dist/utils/api.cjs.js +1 -1
- package/dist/utils/api.es.js +2 -2
- package/dist/utils/router.cjs.js +1 -1
- package/dist/utils/router.cjs.js.map +1 -1
- package/dist/utils/router.es.js +2 -2
- package/dist/utils/store.cjs.js +1 -1
- package/dist/utils/store.cjs.js.map +1 -1
- package/dist/utils/store.es.js +6 -6
- package/dist/utils/test.cjs.js +1 -1
- package/dist/utils/test.cjs.js.map +1 -1
- package/dist/utils/test.es.js +9 -9
- package/dist/utils/test.es.js.map +1 -1
- package/dist/utils/theme.cjs.js +1 -1
- package/dist/utils/theme.es.js +2 -2
- package/package.json +1 -1
- package/dist/Countdown-BtUbr1J_.cjs +0 -2
- package/dist/Countdown-DhjAmB0u.js +0 -28
- package/dist/Image-CgRVUblT.cjs +0 -2
- package/dist/LinkButton-Kw2brLTK.cjs +0 -2
- package/dist/LinkButton-sQ5jgHnX.js +0 -12
- package/dist/Navigate-ClPcw87e.js +0 -25
- package/dist/Navigate-CrMwdIBB.cjs +0 -2
- package/dist/_commonjsHelpers-DKOUU3wS.cjs +0 -2
- package/dist/_commonjsHelpers-DKOUU3wS.cjs.map +0 -1
- package/dist/_commonjsHelpers-DaMA6jEr.js +0 -9
- package/dist/_commonjsHelpers-DaMA6jEr.js.map +0 -1
- package/dist/api-9cnyvZj7.cjs +0 -2
- package/dist/api-CAH3GT1O.cjs +0 -2
- package/dist/auth-Bb8WkZGN.js +0 -237
- package/dist/auth-BwpsrTko.cjs +0 -2
- package/dist/client-CUE3jVb4.js +0 -25227
- package/dist/client-CUE3jVb4.js.map +0 -1
- package/dist/client-C_dmBP2e.cjs +0 -251
- package/dist/client-C_dmBP2e.cjs.map +0 -1
- package/dist/emotion-server-create-instance.browser.esm-CgeoyX9a.js +0 -2122
- package/dist/emotion-server-create-instance.browser.esm-CgeoyX9a.js.map +0 -1
- package/dist/emotion-server-create-instance.browser.esm-CpbXhK4a.cjs +0 -6
- package/dist/emotion-server-create-instance.browser.esm-CpbXhK4a.cjs.map +0 -1
- package/dist/en-gb-B_rK7Jx1.js +0 -20
- package/dist/en-gb-B_rK7Jx1.js.map +0 -1
- package/dist/en-gb-CpyEkKq3.cjs +0 -2
- package/dist/en-gb-CpyEkKq3.cjs.map +0 -1
- package/dist/general-Bo6JGvKB.cjs +0 -2
- package/dist/index-5C9hpxRF.cjs +0 -2
- package/dist/index-B3e_XaVG.js +0 -30
- package/dist/index-B89FjK7v.cjs +0 -2
- package/dist/index-BRHFlEjS.js +0 -1187
- package/dist/index-BRHFlEjS.js.map +0 -1
- package/dist/index-CwC9mpb3.cjs +0 -2
- package/dist/index-DuArGzQE.cjs +0 -5
- package/dist/index-DuArGzQE.cjs.map +0 -1
- package/dist/index-hdS8RgRc.js +0 -237
- package/dist/jsx-runtime-B2pbW5Fp.cjs +0 -23
- package/dist/jsx-runtime-B2pbW5Fp.cjs.map +0 -1
- package/dist/jsx-runtime-lzYHhGH3.js +0 -285
- package/dist/jsx-runtime-lzYHhGH3.js.map +0 -1
- package/dist/rtk-query.modern-CjetfYPg.js +0 -3038
- package/dist/rtk-query.modern-CjetfYPg.js.map +0 -1
- package/dist/rtk-query.modern-PBCErCqb.cjs +0 -15
- package/dist/rtk-query.modern-PBCErCqb.cjs.map +0 -1
- package/dist/schemas-DXX4rh8i.cjs +0 -2
- package/dist/server.browser-DeLuEZOk.cjs +0 -205
- package/dist/server.browser-DeLuEZOk.cjs.map +0 -1
- package/dist/server.browser-gAvZ6xhz.js +0 -19744
- package/dist/server.browser-gAvZ6xhz.js.map +0 -1
- package/dist/session-CacrgFSv.cjs +0 -2
- package/dist/style-BgmNVuOg.cjs +0 -2
- package/dist/style-BgmNVuOg.cjs.map +0 -1
- package/dist/style-C3515J9T.js +0 -5
- package/dist/style-C3515J9T.js.map +0 -1
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { j as n } from "./jsx-runtime-lzYHhGH3.js";
|
|
2
|
-
import { Link as i, IconButton as m, ListItem as a, Tab as c } from "@mui/material";
|
|
3
|
-
import { useEffect as p } from "react";
|
|
4
|
-
import { Link as o } from "react-router";
|
|
5
|
-
import "@mui/icons-material";
|
|
6
|
-
import "./palette-CYwuLBW7.js";
|
|
7
|
-
import { e as u } from "./auth-Bb8WkZGN.js";
|
|
8
|
-
const I = (t) => /* @__PURE__ */ n.jsx(i, { component: o, ...t }), v = (t) => /* @__PURE__ */ n.jsx(m, { ...t, component: o }), N = (t) => /* @__PURE__ */ n.jsx(a, { ...t, component: o }), B = (t) => /* @__PURE__ */ n.jsx(c, { ...t, component: o }), E = ({
|
|
9
|
-
delta: t,
|
|
10
|
-
to: s,
|
|
11
|
-
...e
|
|
12
|
-
}) => {
|
|
13
|
-
const r = u();
|
|
14
|
-
return p(() => {
|
|
15
|
-
typeof t == "number" ? r(t) : r(s, e);
|
|
16
|
-
}, [r, t, s, e]), /* @__PURE__ */ n.jsx(n.Fragment, {});
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
I as L,
|
|
20
|
-
E as N,
|
|
21
|
-
v as a,
|
|
22
|
-
N as b,
|
|
23
|
-
B as c
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=Navigate-ClPcw87e.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("./jsx-runtime-B2pbW5Fp.cjs"),e=require("@mui/material"),u=require("react"),r=require("react-router");require("@mui/icons-material");require("./palette-BnIdHKDE.cjs");const c=require("./auth-BwpsrTko.cjs"),x=t=>n.jsxRuntimeExports.jsx(e.Link,{component:r.Link,...t}),m=t=>n.jsxRuntimeExports.jsx(e.IconButton,{...t,component:r.Link}),L=t=>n.jsxRuntimeExports.jsx(e.ListItem,{...t,component:r.Link}),a=t=>n.jsxRuntimeExports.jsx(e.Tab,{...t,component:r.Link}),k=({delta:t,to:s,...o})=>{const i=c.useNavigate();return u.useEffect(()=>{typeof t=="number"?i(t):i(s,o)},[i,t,s,o]),n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{})};exports.Link=x;exports.LinkIconButton=m;exports.LinkListItem=L;exports.LinkTab=a;exports.Navigate=k;
|
|
2
|
-
//# sourceMappingURL=Navigate-CrMwdIBB.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}exports.commonjsGlobal=o;exports.getDefaultExportFromCjs=l;
|
|
2
|
-
//# sourceMappingURL=_commonjsHelpers-DKOUU3wS.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_commonjsHelpers-DKOUU3wS.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
var o = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
-
function l(e) {
|
|
3
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
|
-
}
|
|
5
|
-
export {
|
|
6
|
-
o as c,
|
|
7
|
-
l as g
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=_commonjsHelpers-DaMA6jEr.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_commonjsHelpers-DaMA6jEr.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/api-9cnyvZj7.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("react");function u(g){const{page:e=0,limit:a=150}=g||{},[c,f]=r.useState({page:e,limit:a,offset:e*a});return[c,t=>{f(({page:p,limit:o})=>{const s=typeof t=="function"?t({page:p,limit:o}):t;let i=s.page;const n=s.limit;return n!==o&&(i=0),{page:i,limit:n,offset:i*n}})}]}exports.usePagination=u;
|
|
2
|
-
//# sourceMappingURL=api-9cnyvZj7.cjs.map
|
package/dist/api-CAH3GT1O.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const f=require("./jsx-runtime-B2pbW5Fp.cjs"),d=require("@mui/material");require("react");const y=require("./utils/general.cjs.js");require("yup");const x=require("@mui/icons-material"),h=()=>f.jsxRuntimeExports.jsxs(d.Stack,{alignItems:"center",alignContent:"center",children:[f.jsxRuntimeExports.jsx(x.SyncProblem,{color:"error"}),f.jsxRuntimeExports.jsx(d.Typography,{color:"error.main",children:"Failed to sync data"})]});function S(r,t){if(t.url&&Object.entries(t.url).forEach(([o,s])=>{r=r.replace(`<${o}>`,String(s))}),t.search){const o=[];for(const s in t.search){const c=t.search[s];if(c!==void 0)if(Array.isArray(c))for(const i of c)o.push([s,String(i)]);else o.push([s,String(c)])}o.length!==0&&(r+=`?${new URLSearchParams(o).toString()}`)}return r}function l(r){return typeof r=="number"||typeof r=="string"}function g(r){return{type:r,id:"LIST"}}function m(r,t){const{includeListTag:o=!1,argKeysAreIds:s=!1,id:c="id"}=t||{};function i(e,u=o){const n=e.map(p=>({type:r,id:String(p)}));return u&&n.push(g(r)),n}function a(e){return y.getNestedProperty(e,c)}return(e,u,n)=>{if(!u){if(n){if(l(n))return i([n]);if(Array.isArray(n)){if(n.length&&l(n[0]))return i(n)}else if(typeof n=="object"&&s)return i(Object.keys(n))}if(e)return Array.isArray(e)?i(e.map(a)):a(e)!==void 0?i([a(e)]):i(e.data.map(a),!0)}return i([])}}function j(r,t){if(r===t)throw Error("List and detail are the same.");return{list:r,detail:t}}function E(r,t,o){const{data:s,isLoading:c,isSuccess:i}=r,a=r.error,{loading:e=f.jsxRuntimeExports.jsx(d.CircularProgress,{}),error:u=f.jsxRuntimeExports.jsx(h,{})}=o||{};if(a)return console.error(a),u;if(c)return e;if(s)return t(s);if(i)throw Error("Expected to get data from API but got nothing.");return e}function A(r){return["GET","HEAD","OPTIONS","TRACE"].includes(r.toUpperCase())}exports.SyncError=h;exports.buildUrl=S;exports.handleResultState=E;exports.isModelId=l;exports.isSafeHttpMethod=A;exports.listTag=g;exports.modelUrls=j;exports.tagData=m;
|
|
2
|
-
//# sourceMappingURL=api-CAH3GT1O.cjs.map
|
package/dist/auth-Bb8WkZGN.js
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import { j as S } from "./jsx-runtime-lzYHhGH3.js";
|
|
2
|
-
import * as j from "yup";
|
|
3
|
-
import { object as L } from "yup";
|
|
4
|
-
import { useEffect as g, useState as V, useCallback as J } from "react";
|
|
5
|
-
import q from "js-cookie";
|
|
6
|
-
import { useNavigate as k, useLocation as w, useSearchParams as z, useParams as B, createSearchParams as G } from "react-router";
|
|
7
|
-
import { useSelector as H } from "react-redux";
|
|
8
|
-
import { SESSION_METADATA_COOKIE_NAME as K } from "./settings/index.es.js";
|
|
9
|
-
import { b as Q } from "./session-oI-Ht2C8.js";
|
|
10
|
-
import { makeOAuth2StorageKey as R, generateOAuth2CodeChallenge as W } from "./utils/auth.es.js";
|
|
11
|
-
import "@mui/material";
|
|
12
|
-
import { generateSecureRandomString as X } from "./utils/general.es.js";
|
|
13
|
-
import "@mui/icons-material";
|
|
14
|
-
import "./schemas-BMQZbhti.js";
|
|
15
|
-
import "./urls-DP4a8kxP.js";
|
|
16
|
-
import { tryValidateSync as $ } from "./utils/schema.es.js";
|
|
17
|
-
import "./palette-CYwuLBW7.js";
|
|
18
|
-
function C() {
|
|
19
|
-
const e = k(), s = T();
|
|
20
|
-
return (o, t = void 0) => {
|
|
21
|
-
if (typeof o == "number") e(o);
|
|
22
|
-
else {
|
|
23
|
-
const { next: a = !0, ...i } = t || {};
|
|
24
|
-
e(
|
|
25
|
-
a && "next" in s ? s.next : o,
|
|
26
|
-
i
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function F() {
|
|
32
|
-
return w();
|
|
33
|
-
}
|
|
34
|
-
function T(e, s) {
|
|
35
|
-
const o = Object.fromEntries(z()[0].entries());
|
|
36
|
-
return e ? $(o, L(e), s) : o;
|
|
37
|
-
}
|
|
38
|
-
function Y(e, s) {
|
|
39
|
-
const o = B();
|
|
40
|
-
return e ? $(o, L(e), s) : o;
|
|
41
|
-
}
|
|
42
|
-
function Se({
|
|
43
|
-
shape: e,
|
|
44
|
-
children: s,
|
|
45
|
-
onValidationError: o,
|
|
46
|
-
onValidationSuccess: t = () => {
|
|
47
|
-
},
|
|
48
|
-
validateOptions: a
|
|
49
|
-
}) {
|
|
50
|
-
const i = Y(e, a), n = C();
|
|
51
|
-
return g(
|
|
52
|
-
() => {
|
|
53
|
-
i ? t(i) : o(n);
|
|
54
|
-
},
|
|
55
|
-
[]
|
|
56
|
-
// eslint-disable-line react-hooks/exhaustive-deps
|
|
57
|
-
), i ? s(i) : /* @__PURE__ */ S.jsx(S.Fragment, {});
|
|
58
|
-
}
|
|
59
|
-
function v(e = K) {
|
|
60
|
-
return H(Q) ? JSON.parse(q.get(e)) : void 0;
|
|
61
|
-
}
|
|
62
|
-
v.predefine = (e = K) => () => v(e);
|
|
63
|
-
function ve(e, s = {}) {
|
|
64
|
-
const { userType: o, next: t = !0 } = s, { pathname: a } = F(), i = C(), n = v(), c = o && (!n || n.user_type !== o);
|
|
65
|
-
return g(() => {
|
|
66
|
-
c && i({
|
|
67
|
-
pathname: "/login" + {
|
|
68
|
-
teacher: "/teacher",
|
|
69
|
-
student: "/student",
|
|
70
|
-
indy: "/independent"
|
|
71
|
-
}[o],
|
|
72
|
-
search: t ? G({ next: a }).toString() : void 0
|
|
73
|
-
});
|
|
74
|
-
}, [i, c, o, t, a]), c ? /* @__PURE__ */ S.jsx(S.Fragment, {}) : typeof e == "function" ? e(n) : e;
|
|
75
|
-
}
|
|
76
|
-
function Z(e, s = 32, o = "state") {
|
|
77
|
-
const t = R(e, o), a = sessionStorage.getItem(t), [i, n] = V();
|
|
78
|
-
g(() => {
|
|
79
|
-
let u;
|
|
80
|
-
a && a.length === s ? u = a : (u = X(s), sessionStorage.setItem(t, u)), n(u);
|
|
81
|
-
}, [t, a, s]);
|
|
82
|
-
const c = J(() => {
|
|
83
|
-
sessionStorage.removeItem(t), n(void 0);
|
|
84
|
-
}, [t]);
|
|
85
|
-
return [i, c];
|
|
86
|
-
}
|
|
87
|
-
function D(e, s = 128, o = "codeChallenge") {
|
|
88
|
-
const t = R(e, o), a = sessionStorage.getItem(t), [i, n] = V();
|
|
89
|
-
g(() => {
|
|
90
|
-
let u;
|
|
91
|
-
if (a) {
|
|
92
|
-
const r = JSON.parse(a);
|
|
93
|
-
typeof r == "object" && r && "verifier" in r && typeof r.verifier == "string" && r.verifier.length === s && "challenge" in r && typeof r.challenge == "string" && "method" in r && r.method === "S256" && (u = {
|
|
94
|
-
verifier: r.verifier,
|
|
95
|
-
challenge: r.challenge,
|
|
96
|
-
method: r.method
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
u ? n(u) : W(s).then((r) => {
|
|
100
|
-
sessionStorage.setItem(
|
|
101
|
-
t,
|
|
102
|
-
JSON.stringify(r)
|
|
103
|
-
), n(r);
|
|
104
|
-
}).catch((r) => {
|
|
105
|
-
r && console.error(r);
|
|
106
|
-
});
|
|
107
|
-
}, [t, a, s]);
|
|
108
|
-
const c = J(() => {
|
|
109
|
-
sessionStorage.removeItem(t), n(void 0);
|
|
110
|
-
}, [t]);
|
|
111
|
-
return [i, c];
|
|
112
|
-
}
|
|
113
|
-
function U({
|
|
114
|
-
provider: e,
|
|
115
|
-
authUri: s,
|
|
116
|
-
clientId: o,
|
|
117
|
-
redirectUri: t,
|
|
118
|
-
scope: a,
|
|
119
|
-
responseType: i = "code",
|
|
120
|
-
accessType: n = "offline",
|
|
121
|
-
prompt: c,
|
|
122
|
-
useSessionMetadata: u,
|
|
123
|
-
useLoginMutation: r,
|
|
124
|
-
onCreateSession: A,
|
|
125
|
-
onRetrieveSession: P
|
|
126
|
-
}) {
|
|
127
|
-
const [d, I] = Z(e), [
|
|
128
|
-
{
|
|
129
|
-
verifier: h,
|
|
130
|
-
challenge: x,
|
|
131
|
-
method: O
|
|
132
|
-
} = {},
|
|
133
|
-
E
|
|
134
|
-
] = D(e), [
|
|
135
|
-
M,
|
|
136
|
-
{
|
|
137
|
-
originalArgs: m = {},
|
|
138
|
-
isLoading: N,
|
|
139
|
-
isError: b
|
|
140
|
-
}
|
|
141
|
-
] = r(), _ = u(), p = C(), f = T({ code: j.string(), state: j.string() }) || {}, l = F().state || {};
|
|
142
|
-
if (g(() => {
|
|
143
|
-
f.code && f.state && p(".", {
|
|
144
|
-
// Removes the URL containing the search params from the history stack.
|
|
145
|
-
replace: !0,
|
|
146
|
-
// Ensure we don't break the auth flow by navigating to another page.
|
|
147
|
-
next: !1,
|
|
148
|
-
// Store the search params in the page's state instead.
|
|
149
|
-
state: { code: f.code, state: f.state }
|
|
150
|
-
});
|
|
151
|
-
}, [f.code, f.state, p]), g(() => {
|
|
152
|
-
_ ? P(_) : (
|
|
153
|
-
// If the state and code verifier have been generated...
|
|
154
|
-
d && h && // ...and the page's state contains a code...
|
|
155
|
-
l.code && // ...and the page's state contains the stored state...
|
|
156
|
-
l.state === d && // ...and the login endpoint was not called with the current values or has
|
|
157
|
-
// not returned an error...
|
|
158
|
-
(m.code !== l.code || m.code_verifier !== h || m.redirect_uri !== t || !b) && // ...and the login endpoint is not currently being called...
|
|
159
|
-
!N && M({
|
|
160
|
-
code: l.code,
|
|
161
|
-
code_verifier: h,
|
|
162
|
-
redirect_uri: t
|
|
163
|
-
}).unwrap().then(A).catch(() => {
|
|
164
|
-
p(".", {
|
|
165
|
-
replace: !0,
|
|
166
|
-
state: {
|
|
167
|
-
notifications: [
|
|
168
|
-
{
|
|
169
|
-
props: {
|
|
170
|
-
error: !0,
|
|
171
|
-
children: "Failed to login. Please try again."
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
]
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
}).finally(() => {
|
|
178
|
-
I(), E();
|
|
179
|
-
})
|
|
180
|
-
);
|
|
181
|
-
}, [
|
|
182
|
-
p,
|
|
183
|
-
t,
|
|
184
|
-
// State
|
|
185
|
-
d,
|
|
186
|
-
l.state,
|
|
187
|
-
I,
|
|
188
|
-
// Code
|
|
189
|
-
h,
|
|
190
|
-
l.code,
|
|
191
|
-
E,
|
|
192
|
-
// Login
|
|
193
|
-
M,
|
|
194
|
-
N,
|
|
195
|
-
b,
|
|
196
|
-
m.code,
|
|
197
|
-
m.code_verifier,
|
|
198
|
-
m.redirect_uri,
|
|
199
|
-
// Session
|
|
200
|
-
_,
|
|
201
|
-
A,
|
|
202
|
-
P
|
|
203
|
-
]), d && x && O) {
|
|
204
|
-
const y = {
|
|
205
|
-
client_id: o,
|
|
206
|
-
redirect_uri: t,
|
|
207
|
-
scope: a,
|
|
208
|
-
response_type: i,
|
|
209
|
-
access_type: n,
|
|
210
|
-
state: d,
|
|
211
|
-
code_challenge: x,
|
|
212
|
-
code_challenge_method: O
|
|
213
|
-
};
|
|
214
|
-
return c && (y.prompt = c), [
|
|
215
|
-
s + "?" + new URLSearchParams(y).toString(),
|
|
216
|
-
y
|
|
217
|
-
];
|
|
218
|
-
}
|
|
219
|
-
return [];
|
|
220
|
-
}
|
|
221
|
-
const _e = (e) => U(
|
|
222
|
-
// @ts-expect-error value is assignable
|
|
223
|
-
"useSessionMetadata" in e ? e : { ...e, useSessionMetadata: v }
|
|
224
|
-
);
|
|
225
|
-
export {
|
|
226
|
-
ve as a,
|
|
227
|
-
Z as b,
|
|
228
|
-
D as c,
|
|
229
|
-
_e as d,
|
|
230
|
-
C as e,
|
|
231
|
-
F as f,
|
|
232
|
-
T as g,
|
|
233
|
-
Y as h,
|
|
234
|
-
Se as i,
|
|
235
|
-
v as u
|
|
236
|
-
};
|
|
237
|
-
//# sourceMappingURL=auth-Bb8WkZGN.js.map
|
package/dist/auth-BwpsrTko.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const y=require("./jsx-runtime-B2pbW5Fp.cjs"),q=require("yup"),l=require("react"),$=require("js-cookie"),S=require("react-router"),w=require("react-redux"),V=require("./settings/index.cjs.js"),z=require("./session-CE2U7oL1.cjs"),E=require("./utils/auth.cjs.js");require("@mui/material");const B=require("./utils/general.cjs.js");require("@mui/icons-material");require("./schemas-DXX4rh8i.cjs");require("./urls-CGZI0f1w.cjs");const k=require("./utils/schema.cjs.js");require("./palette-BnIdHKDE.cjs");function G(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const T=G(q);function v(){const e=S.useNavigate(),r=x();return(t,s=void 0)=>{if(typeof t=="number")e(t);else{const{next:o=!0,...i}=s||{};e(o&&"next"in r?r.next:t,i)}}}function C(){return S.useLocation()}function x(e,r){const t=Object.fromEntries(S.useSearchParams()[0].entries());return e?k.tryValidateSync(t,q.object(e),r):t}function J(e,r){const t=S.useParams();return e?k.tryValidateSync(t,q.object(e),r):t}function H({shape:e,children:r,onValidationError:t,onValidationSuccess:s=()=>{},validateOptions:o}){const i=J(e,o),a=v();return l.useEffect(()=>{i?s(i):t(a)},[]),i?r(i):y.jsxRuntimeExports.jsx(y.jsxRuntimeExports.Fragment,{})}function m(e=V.SESSION_METADATA_COOKIE_NAME){return w.useSelector(z.selectIsLoggedIn)?JSON.parse($.get(e)):void 0}m.predefine=(e=V.SESSION_METADATA_COOKIE_NAME)=>()=>m(e);function Q(e,r={}){const{userType:t,next:s=!0}=r,{pathname:o}=C(),i=v(),a=m(),c=t&&(!a||a.user_type!==t);return l.useEffect(()=>{c&&i({pathname:"/login"+{teacher:"/teacher",student:"/student",indy:"/independent"}[t],search:s?S.createSearchParams({next:o}).toString():void 0})},[i,c,t,s,o]),c?y.jsxRuntimeExports.jsx(y.jsxRuntimeExports.Fragment,{}):typeof e=="function"?e(a):e}function F(e,r=32,t="state"){const s=E.makeOAuth2StorageKey(e,t),o=sessionStorage.getItem(s),[i,a]=l.useState();l.useEffect(()=>{let u;o&&o.length===r?u=o:(u=B.generateSecureRandomString(r),sessionStorage.setItem(s,u)),a(u)},[s,o,r]);const c=l.useCallback(()=>{sessionStorage.removeItem(s),a(void 0)},[s]);return[i,c]}function D(e,r=128,t="codeChallenge"){const s=E.makeOAuth2StorageKey(e,t),o=sessionStorage.getItem(s),[i,a]=l.useState();l.useEffect(()=>{let u;if(o){const n=JSON.parse(o);typeof n=="object"&&n&&"verifier"in n&&typeof n.verifier=="string"&&n.verifier.length===r&&"challenge"in n&&typeof n.challenge=="string"&&"method"in n&&n.method==="S256"&&(u={verifier:n.verifier,challenge:n.challenge,method:n.method})}u?a(u):E.generateOAuth2CodeChallenge(r).then(n=>{sessionStorage.setItem(s,JSON.stringify(n)),a(n)}).catch(n=>{n&&console.error(n)})},[s,o,r]);const c=l.useCallback(()=>{sessionStorage.removeItem(s),a(void 0)},[s]);return[i,c]}function W({provider:e,authUri:r,clientId:t,redirectUri:s,scope:o,responseType:i="code",accessType:a="offline",prompt:c,useSessionMetadata:u,useLoginMutation:n,onCreateSession:P,onRetrieveSession:j}){const[h,I]=F(e),[{verifier:p,challenge:b,method:M}={},N]=D(e),[R,{originalArgs:f={},isLoading:L,isError:K}]=n(),O=u(),_=v(),d=x({code:T.string(),state:T.string()})||{},g=C().state||{};if(l.useEffect(()=>{d.code&&d.state&&_(".",{replace:!0,next:!1,state:{code:d.code,state:d.state}})},[d.code,d.state,_]),l.useEffect(()=>{O?j(O):h&&p&&g.code&&g.state===h&&(f.code!==g.code||f.code_verifier!==p||f.redirect_uri!==s||!K)&&!L&&R({code:g.code,code_verifier:p,redirect_uri:s}).unwrap().then(P).catch(()=>{_(".",{replace:!0,state:{notifications:[{props:{error:!0,children:"Failed to login. Please try again."}}]}})}).finally(()=>{I(),N()})},[_,s,h,g.state,I,p,g.code,N,R,L,K,f.code,f.code_verifier,f.redirect_uri,O,P,j]),h&&b&&M){const A={client_id:t,redirect_uri:s,scope:o,response_type:i,access_type:a,state:h,code_challenge:b,code_challenge_method:M};return c&&(A.prompt=c),[r+"?"+new URLSearchParams(A).toString(),A]}return[]}const X=e=>W("useSessionMetadata"in e?e:{...e,useSessionMetadata:m});exports.useLocation=C;exports.useNavigate=v;exports.useOAuth2=X;exports.useOAuth2CodeChallenge=D;exports.useOAuth2State=F;exports.useParams=J;exports.useParamsRequired=H;exports.useSearchParams=x;exports.useSession=Q;exports.useSessionMetadata=m;
|
|
2
|
-
//# sourceMappingURL=auth-BwpsrTko.cjs.map
|