jcicl 1.1.2 → 1.1.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.
- package/AuthContext/AuthProvider.d.ts +5 -0
- package/AuthContext/AuthProvider.js +85 -76
- package/AuthContext/index.d.ts +1 -1
- package/AuthContext/msalConfig.js +439 -435
- package/AuthenticatedApiClient.d.ts +3 -5
- package/AuthenticatedApiClient.js +36 -17
- package/LoginPage/LoginPage.js +32 -38
- package/Table/Table.js +8 -8
- package/assets/style.css +1 -1
- package/assets/tailwind.css +1 -1
- package/createUseApi.d.ts +1 -2
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { BaseApiClient } from './api';
|
|
2
|
-
|
|
3
|
-
type AcquireTokenFn = (scopes?: string[]) => Promise<string>;
|
|
1
|
+
import { BaseApiClient, ApiResponse } from './api';
|
|
2
|
+
import { AcquireTokenFn } from './AuthContext';
|
|
4
3
|
/**
|
|
5
4
|
* Auth-aware API client for JCIT applications using Microsoft Identity Platform.
|
|
6
5
|
*
|
|
@@ -37,6 +36,5 @@ export declare class AuthenticatedApiClient extends BaseApiClient {
|
|
|
37
36
|
protected request<T>(endpoint: string, method?: 'GET' | 'POST' | 'PUT' | 'DELETE', body?: unknown, options?: {
|
|
38
37
|
timeoutMs?: number;
|
|
39
38
|
headers?: Record<string, string>;
|
|
40
|
-
}): Promise<
|
|
39
|
+
}): Promise<ApiResponse<T>>;
|
|
41
40
|
}
|
|
42
|
-
export {};
|
|
@@ -1,30 +1,49 @@
|
|
|
1
|
-
var
|
|
2
|
-
var d = (r, e, t) => e in r ?
|
|
3
|
-
var
|
|
4
|
-
import { BaseApiClient as
|
|
5
|
-
class
|
|
1
|
+
var o = Object.defineProperty;
|
|
2
|
+
var d = (r, e, t) => e in r ? o(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => d(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { BaseApiClient as h } from "./api.js";
|
|
5
|
+
class g extends h {
|
|
6
6
|
/**
|
|
7
7
|
* @param baseUrl - Base URL of the .NET Core API (e.g. import.meta.env.VITE_API_BASE_URL)
|
|
8
8
|
* @param acquireToken - Token acquisition function from useAuthContext()
|
|
9
9
|
* @param defaultScopes - Optional scope overrides for every request
|
|
10
10
|
*/
|
|
11
|
-
constructor(t,
|
|
11
|
+
constructor(t, a, u = []) {
|
|
12
12
|
super(t);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.acquireToken =
|
|
13
|
+
i(this, "acquireToken");
|
|
14
|
+
i(this, "defaultScopes");
|
|
15
|
+
this.acquireToken = a, this.defaultScopes = u;
|
|
16
16
|
}
|
|
17
|
-
async request(t,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
async request(t, a = "GET", u, s) {
|
|
18
|
+
let c;
|
|
19
|
+
try {
|
|
20
|
+
c = await this.acquireToken(this.defaultScopes.length > 0 ? this.defaultScopes : void 0);
|
|
21
|
+
} catch (n) {
|
|
22
|
+
return {
|
|
23
|
+
success: !1,
|
|
24
|
+
error: {
|
|
25
|
+
status: 401,
|
|
26
|
+
statusText: "Unauthorized",
|
|
27
|
+
message: n instanceof Error ? n.message : "Failed to acquire access token"
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return c ? super.request(t, a, u, {
|
|
32
|
+
...s,
|
|
21
33
|
headers: {
|
|
22
|
-
...
|
|
23
|
-
|
|
34
|
+
...s == null ? void 0 : s.headers,
|
|
35
|
+
Authorization: `Bearer ${c}`
|
|
24
36
|
}
|
|
25
|
-
})
|
|
37
|
+
}) : {
|
|
38
|
+
success: !1,
|
|
39
|
+
error: {
|
|
40
|
+
status: 0,
|
|
41
|
+
statusText: "Redirecting",
|
|
42
|
+
message: "Authentication redirect in progress."
|
|
43
|
+
}
|
|
44
|
+
};
|
|
26
45
|
}
|
|
27
46
|
}
|
|
28
47
|
export {
|
|
29
|
-
|
|
48
|
+
g as AuthenticatedApiClient
|
|
30
49
|
};
|
package/LoginPage/LoginPage.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { useAuthContext as
|
|
4
|
-
import { ThemeContext as
|
|
5
|
-
import { l as
|
|
6
|
-
function
|
|
7
|
-
return /* @__PURE__ */
|
|
1
|
+
import { jsx as t, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as u } from "react";
|
|
3
|
+
import { useAuthContext as m } from "../AuthContext/AuthProvider.js";
|
|
4
|
+
import { ThemeContext as x } from "../ThemeContext.js";
|
|
5
|
+
import { l as b } from "../.chunks/jocologo.js";
|
|
6
|
+
function p() {
|
|
7
|
+
return /* @__PURE__ */ o(
|
|
8
8
|
"svg",
|
|
9
9
|
{
|
|
10
10
|
width: "20",
|
|
@@ -14,54 +14,48 @@ function w() {
|
|
|
14
14
|
"aria-hidden": "true",
|
|
15
15
|
focusable: "false",
|
|
16
16
|
children: [
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */
|
|
17
|
+
/* @__PURE__ */ t("rect", { x: "1", y: "1", width: "9", height: "9", fill: "#f25022" }),
|
|
18
|
+
/* @__PURE__ */ t("rect", { x: "11", y: "1", width: "9", height: "9", fill: "#7fba00" }),
|
|
19
|
+
/* @__PURE__ */ t("rect", { x: "1", y: "11", width: "9", height: "9", fill: "#00a4ef" }),
|
|
20
|
+
/* @__PURE__ */ t("rect", { x: "11", y: "11", width: "9", height: "9", fill: "#ffb900" })
|
|
21
21
|
]
|
|
22
22
|
}
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
appTitle:
|
|
27
|
-
logoSrc:
|
|
28
|
-
logoAlt:
|
|
29
|
-
subtitle:
|
|
30
|
-
backgroundColor:
|
|
31
|
-
cardBackgroundColor:
|
|
25
|
+
function j({
|
|
26
|
+
appTitle: l,
|
|
27
|
+
logoSrc: r = b,
|
|
28
|
+
logoAlt: s = "Application logo",
|
|
29
|
+
subtitle: i,
|
|
30
|
+
backgroundColor: a,
|
|
31
|
+
cardBackgroundColor: c = "#ffffff"
|
|
32
32
|
}) {
|
|
33
|
-
const { login:
|
|
34
|
-
return /* @__PURE__ */
|
|
33
|
+
const { login: f, isLoading: n } = m(), e = u(x), d = a ?? (e == null ? void 0 : e.themeLightD) ?? "#f0f2f5", g = (e == null ? void 0 : e.themeDark) ?? "#2F2F2F", h = (e == null ? void 0 : e.themeColor) ?? "#1a1a1a";
|
|
34
|
+
return /* @__PURE__ */ t(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
37
|
className: "flex items-center justify-center w-full h-screen font-[Roboto,sans-serif]",
|
|
38
|
-
style: { backgroundColor:
|
|
39
|
-
children: /* @__PURE__ */
|
|
38
|
+
style: { backgroundColor: d },
|
|
39
|
+
children: /* @__PURE__ */ o(
|
|
40
40
|
"div",
|
|
41
41
|
{
|
|
42
42
|
className: "flex flex-col items-center gap-6 rounded-xl py-10 px-12 shadow-[0_4px_24px_rgba(0,0,0,0.12)] min-w-80 max-w-[400px] w-full box-border",
|
|
43
|
-
style: { backgroundColor:
|
|
43
|
+
style: { backgroundColor: c },
|
|
44
44
|
children: [
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ t("img", { src: r, alt: s, className: "max-w-40 max-h-16 object-contain" }),
|
|
46
|
+
/* @__PURE__ */ t("h1", { className: "m-0 text-2xl font-medium text-[#1a1a1a] text-center leading-[1.3]", children: l }),
|
|
47
|
+
i && /* @__PURE__ */ t("p", { className: "m-0 text-sm text-[#666] text-center leading-relaxed", children: i }),
|
|
48
|
+
/* @__PURE__ */ o(
|
|
49
49
|
"button",
|
|
50
50
|
{
|
|
51
|
-
onClick:
|
|
51
|
+
onClick: f,
|
|
52
52
|
disabled: n,
|
|
53
53
|
type: "button",
|
|
54
54
|
"aria-label": "Sign in with Microsoft",
|
|
55
|
-
style: {
|
|
56
|
-
|
|
57
|
-
t.currentTarget.style.backgroundColor = m;
|
|
58
|
-
},
|
|
59
|
-
onMouseLeave: (t) => {
|
|
60
|
-
t.currentTarget.style.backgroundColor = l;
|
|
61
|
-
},
|
|
62
|
-
className: "flex items-center justify-center gap-3 text-white border-none rounded py-[10px] px-5 text-sm font-semibold cursor-pointer w-full transition-colors duration-[180ms] focus-visible:outline-2 focus-visible:outline-[#0078d4] focus-visible:outline-offset-2 disabled:opacity-65 disabled:cursor-not-allowed",
|
|
55
|
+
style: { "--login-btn-bg": g, "--login-btn-hover": h },
|
|
56
|
+
className: "flex items-center justify-center gap-3 text-white border-none rounded py-[10px] px-5 text-sm font-semibold cursor-pointer w-full transition-colors duration-[180ms] bg-[var(--login-btn-bg)] enabled:hover:bg-[var(--login-btn-hover)] focus-visible:outline-2 focus-visible:outline-[#0078d4] focus-visible:outline-offset-2 disabled:opacity-65 disabled:cursor-not-allowed",
|
|
63
57
|
children: [
|
|
64
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ t(p, {}),
|
|
65
59
|
n ? "Signing in…" : "Sign in with Microsoft"
|
|
66
60
|
]
|
|
67
61
|
}
|
|
@@ -73,5 +67,5 @@ function C({
|
|
|
73
67
|
);
|
|
74
68
|
}
|
|
75
69
|
export {
|
|
76
|
-
|
|
70
|
+
j as default
|
|
77
71
|
};
|
package/Table/Table.js
CHANGED
|
@@ -4141,7 +4141,7 @@ $RC=function(a,b){if(b=document.getElementById(b))(a=document.getElementById(a))
|
|
|
4141
4141
|
!1,
|
|
4142
4142
|
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
|
|
4143
4143
|
);
|
|
4144
|
-
}, ef.version = "19.2.
|
|
4144
|
+
}, ef.version = "19.2.1", ef;
|
|
4145
4145
|
}
|
|
4146
4146
|
var Hs = {};
|
|
4147
4147
|
/**
|
|
@@ -8562,12 +8562,12 @@ Error generating stack: ` + R.message + `
|
|
|
8562
8562
|
}
|
|
8563
8563
|
function Mo() {
|
|
8564
8564
|
var l = le.version;
|
|
8565
|
-
if (l !== "19.2.
|
|
8565
|
+
if (l !== "19.2.1")
|
|
8566
8566
|
throw Error(
|
|
8567
8567
|
X(
|
|
8568
8568
|
527,
|
|
8569
8569
|
l,
|
|
8570
|
-
"19.2.
|
|
8570
|
+
"19.2.1"
|
|
8571
8571
|
)
|
|
8572
8572
|
);
|
|
8573
8573
|
}
|
|
@@ -8790,7 +8790,7 @@ Error generating stack: ` + R.message + `
|
|
|
8790
8790
|
}
|
|
8791
8791
|
cl(R);
|
|
8792
8792
|
});
|
|
8793
|
-
}, Hs.version = "19.2.
|
|
8793
|
+
}, Hs.version = "19.2.1", Hs;
|
|
8794
8794
|
}
|
|
8795
8795
|
var nf = {};
|
|
8796
8796
|
/**
|
|
@@ -15028,7 +15028,7 @@ $RC=function(a,b){if(b=document.getElementById(b))(a=document.getElementById(a))
|
|
|
15028
15028
|
!1,
|
|
15029
15029
|
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
|
|
15030
15030
|
);
|
|
15031
|
-
}, nf.version = "19.2.
|
|
15031
|
+
}, nf.version = "19.2.1";
|
|
15032
15032
|
}()), nf;
|
|
15033
15033
|
}
|
|
15034
15034
|
var Ns = {};
|
|
@@ -20520,11 +20520,11 @@ Check the top-level render call using <` + b + ">."), b = "", h != null && x !==
|
|
|
20520
20520
|
}
|
|
20521
20521
|
function Hl() {
|
|
20522
20522
|
var e = Nc.version;
|
|
20523
|
-
if (e !== "19.2.
|
|
20523
|
+
if (e !== "19.2.1")
|
|
20524
20524
|
throw Error(
|
|
20525
20525
|
`Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:
|
|
20526
20526
|
- react: ` + (e + `
|
|
20527
|
-
- react-dom: 19.2.
|
|
20527
|
+
- react-dom: 19.2.1
|
|
20528
20528
|
Learn more: https://react.dev/warnings/version-mismatch`)
|
|
20529
20529
|
);
|
|
20530
20530
|
}
|
|
@@ -21785,7 +21785,7 @@ performance.now();setTimeout(w,2300>q&&2E3<q?2300-q:500)})])},types:[]});z.ready
|
|
|
21785
21785
|
}
|
|
21786
21786
|
rl(x);
|
|
21787
21787
|
});
|
|
21788
|
-
}, Ns.version = "19.2.
|
|
21788
|
+
}, Ns.version = "19.2.1";
|
|
21789
21789
|
}()), Ns;
|
|
21790
21790
|
}
|
|
21791
21791
|
var rf, sf;
|