oiu-core 0.1.2 → 0.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/dist/auth/OAuthService/index.d.ts +1 -0
- package/dist/auth/OAuthService/index.d.ts.map +1 -1
- package/dist/auth/OAuthService/utils.d.ts +9 -0
- package/dist/auth/OAuthService/utils.d.ts.map +1 -1
- package/dist/{index-UqQU8IRT.js → index-YSAkS2Gn.js} +4 -4
- package/dist/{main-CYS3ZFhm.js → main-DDVh2kVN.js} +27 -24
- package/dist/main.js +1 -1
- package/dist/theme/UITheme.d.ts +1 -1
- package/dist/theme/UITheme.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ export default function CreateOAuthService(settings: UserManagerSettings, store:
|
|
|
12
12
|
declare class OAuthService extends AuthService {
|
|
13
13
|
private _userManager;
|
|
14
14
|
private _popUpPolicy;
|
|
15
|
+
private _onIdentityCreated?;
|
|
15
16
|
/**
|
|
16
17
|
* Initialize a new instance of the Auth service
|
|
17
18
|
* @param prefix
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/auth/OAuthService/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EAGnB,mBAAmB,EAEtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,OAAO,EAAe,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAoB,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAI/E;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,QAAQ,EAAE,mBAAmB,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,EAAE,OAAO,EAAE,OAAO,gBAExH;AA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B,OAAO,CAAC,YAAY;CAOvB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { User } from 'oidc-client-ts';
|
|
2
|
+
import { Identity } from '../_type';
|
|
1
3
|
export declare enum PopupPolicy {
|
|
2
4
|
/** Alwais use popup and if not allowed the authentication will fail */
|
|
3
5
|
Always = 1,
|
|
@@ -10,5 +12,12 @@ export type Options = {
|
|
|
10
12
|
/** Prefix use to store the authentication this allow use multiples authentications */
|
|
11
13
|
prefix: string;
|
|
12
14
|
popupPolicy?: PopupPolicy;
|
|
15
|
+
/** Trigger when a new identity is created
|
|
16
|
+
* This is useful when you want to add custom properties to the identity or do some side effect when the user is authenticated
|
|
17
|
+
* @param identity The identity created from the user and the jwt
|
|
18
|
+
* @param user The user returned by the oidc-client-ts library
|
|
19
|
+
* @param jwt The decoded jwt token
|
|
20
|
+
*/
|
|
21
|
+
onIdentityCreated?: (identity: Identity, user: User, jwt: unknown) => void;
|
|
13
22
|
};
|
|
14
23
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/auth/OAuthService/utils.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACnB,uEAAuE;IACvE,MAAM,IAAI;IACV,0CAA0C;IAC1C,KAAK,IAAI;IACT,iDAAiD;IACjD,eAAe,IAAI;CACtB;AACD,MAAM,MAAM,OAAO,GAAG;IAClB,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/auth/OAuthService/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIpC,oBAAY,WAAW;IACnB,uEAAuE;IACvE,MAAM,IAAI;IACV,0CAA0C;IAC1C,KAAK,IAAI;IACT,iDAAiD;IACjD,eAAe,IAAI;CACtB;AACD,MAAM,MAAM,OAAO,GAAG;IAClB,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9E,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Re, P as f, a as $, d as Ue } from "./main-
|
|
1
|
+
import { A as Re, P as f, a as $, d as Ue } from "./main-DDVh2kVN.js";
|
|
2
2
|
class j extends Error {
|
|
3
3
|
}
|
|
4
4
|
j.prototype.name = "InvalidTokenError";
|
|
@@ -2450,8 +2450,8 @@ class ht extends Re {
|
|
|
2450
2450
|
*/
|
|
2451
2451
|
constructor(e, s, i) {
|
|
2452
2452
|
super();
|
|
2453
|
-
const { prefix: r, popupPolicy: o = f.Never } = i,
|
|
2454
|
-
this._userManager = new dt({ ...e, userStore:
|
|
2453
|
+
const { prefix: r, popupPolicy: o = f.Never, onIdentityCreated: n } = i, a = new ee({ prefix: r, store: s });
|
|
2454
|
+
this._userManager = new dt({ ...e, userStore: a }), this._popUpPolicy = o, this._onIdentityCreated = n, this._userManager.events.addUserSignedOut(async () => {
|
|
2455
2455
|
console.warn("User SignedOut event triggger"), await this._userManager.removeUser(), this._updateState("signedout");
|
|
2456
2456
|
});
|
|
2457
2457
|
}
|
|
@@ -2629,7 +2629,7 @@ class ht extends Re {
|
|
|
2629
2629
|
roles: e.profile.role ?? []
|
|
2630
2630
|
}
|
|
2631
2631
|
}, i = Ue(e.access_token);
|
|
2632
|
-
return s.profile.firstName = i.given_name, s.profile.lastName = i.family_name, s.profile.roles = i.role, s.profile.username = i.preferred_username, s;
|
|
2632
|
+
return s.profile.firstName = i.given_name, s.profile.lastName = i.family_name, s.profile.roles = i.role, s.profile.username = i.preferred_username, this._onIdentityCreated?.(s, e, i), s;
|
|
2633
2633
|
}
|
|
2634
2634
|
_createArguments(e, s) {
|
|
2635
2635
|
return {
|
|
@@ -6305,7 +6305,7 @@ function Gm() {
|
|
|
6305
6305
|
if (!e) throw new Error(jm);
|
|
6306
6306
|
return kn(e);
|
|
6307
6307
|
}
|
|
6308
|
-
const
|
|
6308
|
+
const ON = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6309
6309
|
__proto__: null,
|
|
6310
6310
|
getBrowserLangInfo: Gm,
|
|
6311
6311
|
getBrowserLocale: Wm,
|
|
@@ -7604,7 +7604,7 @@ const qc = "ant", ry = "anticon", gC = (e, t) => t || (e ? `${qc}-${e}` : qc), t
|
|
|
7604
7604
|
getPrefixCls: gC,
|
|
7605
7605
|
iconPrefixCls: ry
|
|
7606
7606
|
}), {
|
|
7607
|
-
Consumer:
|
|
7607
|
+
Consumer: IN
|
|
7608
7608
|
} = tr, cd = {};
|
|
7609
7609
|
function Su(e) {
|
|
7610
7610
|
const t = S.useContext(tr), {
|
|
@@ -19280,7 +19280,7 @@ function zR({ services: e, ...t }) {
|
|
|
19280
19280
|
const r = qe(() => Ro(BR, { services: e }), [e]);
|
|
19281
19281
|
return /* @__PURE__ */ be(r, { ...t });
|
|
19282
19282
|
}
|
|
19283
|
-
const
|
|
19283
|
+
const MN = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
19284
19284
|
__proto__: null,
|
|
19285
19285
|
ConfigLoader: HS,
|
|
19286
19286
|
ErrorCode: Es,
|
|
@@ -19318,12 +19318,12 @@ function UR({ className: e, children: t, getPermissionFor: r, defaultAbility: n
|
|
|
19318
19318
|
var zv = /* @__PURE__ */ ((e) => (e[e.Always = 1] = "Always", e[e.Never = 2] = "Never", e[e.RedirectIfFails = 3] = "RedirectIfFails", e))(zv || {});
|
|
19319
19319
|
const WR = () => import(
|
|
19320
19320
|
/* @vite-ignore */
|
|
19321
|
-
"./index-
|
|
19321
|
+
"./index-YSAkS2Gn.js"
|
|
19322
19322
|
);
|
|
19323
19323
|
async function GR(e, t, r) {
|
|
19324
19324
|
return (await WR()).default(e, t, r);
|
|
19325
19325
|
}
|
|
19326
|
-
const
|
|
19326
|
+
const FN = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
19327
19327
|
__proto__: null,
|
|
19328
19328
|
Allowed: sE,
|
|
19329
19329
|
AuthResultStatus: Bh,
|
|
@@ -20948,7 +20948,7 @@ function $T(e, t, r = {}) {
|
|
|
20948
20948
|
delete n[i];
|
|
20949
20949
|
}), e(n);
|
|
20950
20950
|
}
|
|
20951
|
-
const
|
|
20951
|
+
const DN = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
20952
20952
|
__proto__: null,
|
|
20953
20953
|
ErrType: qv,
|
|
20954
20954
|
buildQueryString: $T,
|
|
@@ -23186,7 +23186,7 @@ function gN(e) {
|
|
|
23186
23186
|
}
|
|
23187
23187
|
return t;
|
|
23188
23188
|
}
|
|
23189
|
-
const
|
|
23189
|
+
const LN = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
23190
23190
|
__proto__: null,
|
|
23191
23191
|
appSlice: Un,
|
|
23192
23192
|
buildStorage: fb,
|
|
@@ -23217,7 +23217,7 @@ function vN(e, { sig: t, loader: r, useSkeleton: n }) {
|
|
|
23217
23217
|
};
|
|
23218
23218
|
return o.displayName = `WL(${e.displayName || e.name})`, o;
|
|
23219
23219
|
}
|
|
23220
|
-
const
|
|
23220
|
+
const kN = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
23221
23221
|
__proto__: null,
|
|
23222
23222
|
withError: Ro,
|
|
23223
23223
|
wl: vN
|
|
@@ -23237,7 +23237,7 @@ function Ju({
|
|
|
23237
23237
|
} : {
|
|
23238
23238
|
reduxTheme: Zt(p).theme,
|
|
23239
23239
|
themeName: localStorage.getItem("theme") ?? Zt(p).theme ?? t
|
|
23240
|
-
}), u = qe(() => n(l), [n, l]);
|
|
23240
|
+
}, EN), u = qe(() => n(l), [n, l]);
|
|
23241
23241
|
bc(() => {
|
|
23242
23242
|
const p = typeof localStorage > "u" ? null : localStorage.getItem("theme"), m = p ?? t ?? c;
|
|
23243
23243
|
c !== m && s(bN(m)), typeof localStorage < "u" && !p && localStorage.setItem("theme", m);
|
|
@@ -23253,24 +23253,27 @@ function Ju({
|
|
|
23253
23253
|
return /* @__PURE__ */ be(d, { lang: a, token: u, children: e });
|
|
23254
23254
|
}
|
|
23255
23255
|
function EN(e, t) {
|
|
23256
|
+
return e.reduxTheme === t.reduxTheme && e.themeName === t.themeName;
|
|
23257
|
+
}
|
|
23258
|
+
function wN(e, t) {
|
|
23256
23259
|
return `/themes/${e}/${t}`;
|
|
23257
23260
|
}
|
|
23258
|
-
function
|
|
23261
|
+
function SN() {
|
|
23259
23262
|
return mt((e) => Zt(e).theme);
|
|
23260
23263
|
}
|
|
23261
|
-
const
|
|
23264
|
+
const HN = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
23262
23265
|
__proto__: null,
|
|
23263
23266
|
UITheme: Ju,
|
|
23264
|
-
getResByTheme:
|
|
23265
|
-
useThemeName:
|
|
23267
|
+
getResByTheme: wN,
|
|
23268
|
+
useThemeName: SN
|
|
23266
23269
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
23267
|
-
function
|
|
23270
|
+
function VN(e) {
|
|
23268
23271
|
const { translation: t, wait: r, themeProvider: n } = e;
|
|
23269
23272
|
qm(t.defaultLang, t.langs);
|
|
23270
23273
|
const o = rr;
|
|
23271
23274
|
o.spin = r.spin, o.spinProps = r.spinProps, r.skeleton && (o.skeleton = r.skeleton, o.skeletonProps = r.skeletonProps), n && (Ju.provider = n);
|
|
23272
23275
|
}
|
|
23273
|
-
function
|
|
23276
|
+
function BN(e, t = {}, r) {
|
|
23274
23277
|
return qe(() => {
|
|
23275
23278
|
console.debug("useInitOIU called: ", e);
|
|
23276
23279
|
const { modules: n, slices: o = [] } = t, { setLang: i } = Zo.actions, s = Gm();
|
|
@@ -23287,14 +23290,14 @@ export {
|
|
|
23287
23290
|
jh as A,
|
|
23288
23291
|
zv as P,
|
|
23289
23292
|
Bh as a,
|
|
23290
|
-
|
|
23291
|
-
|
|
23293
|
+
MN as b,
|
|
23294
|
+
ON as c,
|
|
23292
23295
|
J0 as d,
|
|
23293
|
-
|
|
23294
|
-
|
|
23295
|
-
|
|
23296
|
-
|
|
23297
|
-
|
|
23298
|
-
|
|
23299
|
-
|
|
23296
|
+
LN as e,
|
|
23297
|
+
HN as f,
|
|
23298
|
+
DN as g,
|
|
23299
|
+
kN as h,
|
|
23300
|
+
FN as i,
|
|
23301
|
+
VN as j,
|
|
23302
|
+
BN as u
|
|
23300
23303
|
};
|
package/dist/main.js
CHANGED
package/dist/theme/UITheme.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { LangInfo } from '../language';
|
|
|
3
3
|
import { ThemePayload } from '../redux';
|
|
4
4
|
export type UIThemeProps<Token> = PropsWithChildren<{
|
|
5
5
|
/** Theme used by default */
|
|
6
|
-
defaultTheme
|
|
6
|
+
defaultTheme?: ThemePayload;
|
|
7
7
|
/** Style element ID in the document head where the CSS variables will be injected */
|
|
8
8
|
id?: string;
|
|
9
9
|
/** Load the component styles configuration according with the selected theme */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UITheme.d.ts","sourceRoot":"","sources":["../../lib/theme/UITheme.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAA4B,MAAM,OAAO,CAAC;AAGnF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAuC,YAAY,EAAE,MAAM,UAAU,CAAC;AAM7E,MAAM,MAAM,YAAY,CAAC,KAAK,IAAI,iBAAiB,CAAC;IAChD,4BAA4B;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