@telicent-oss/ds 0.27.4 → 0.27.5
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/ds.js +32 -3
- package/dist/ds.umd.cjs +32 -3
- package/dist/logout-syncer/sw.js +1 -1
- package/dist/src/candidate-packages/authorize-flow/broadcastChannelService.d.ts +6 -2
- package/dist/src/candidate-packages/authorize-flow/types.d.ts +2 -2
- package/dist/src/candidate-packages/authorize-flow/useAuthSync.d.ts +4 -0
- package/dist/src/export.d.ts +1 -0
- package/package.json +1 -1
package/dist/ds.js
CHANGED
|
@@ -80471,6 +80471,13 @@ const FeatureMap = ({
|
|
|
80471
80471
|
/* @__PURE__ */ jsx$1(FlexGridItem, { flexGrow: 0, p: 1, children: /* @__PURE__ */ jsx$1(LayerSelector, { ...styleSelector.props }) })
|
|
80472
80472
|
] }) }) }) });
|
|
80473
80473
|
};
|
|
80474
|
+
var AuthEvent = /* @__PURE__ */ ((AuthEvent2) => {
|
|
80475
|
+
AuthEvent2["AUTHENTICATED"] = "authenticated";
|
|
80476
|
+
AuthEvent2["REAUTHENTICATED"] = "reauthenticated";
|
|
80477
|
+
AuthEvent2["USER_CHANGED"] = "user-changed";
|
|
80478
|
+
AuthEvent2["UNAUTHORIZED"] = "unauthorized";
|
|
80479
|
+
return AuthEvent2;
|
|
80480
|
+
})(AuthEvent || {});
|
|
80474
80481
|
const listeners = /* @__PURE__ */ new Set();
|
|
80475
80482
|
let lastMessage = null;
|
|
80476
80483
|
const bc = new BroadcastChannel("auth-events");
|
|
@@ -80503,13 +80510,13 @@ const AuthModal = ({
|
|
|
80503
80510
|
};
|
|
80504
80511
|
useEffect(() => {
|
|
80505
80512
|
const unsubscribe = onAuthEvent((event) => {
|
|
80506
|
-
if (event ===
|
|
80513
|
+
if (event === AuthEvent.UNAUTHORIZED && !alreadyTriggered.current) {
|
|
80507
80514
|
setIsOpen(true);
|
|
80508
80515
|
alreadyTriggered.current = true;
|
|
80509
80516
|
setTimeout(() => {
|
|
80510
80517
|
alreadyTriggered.current = false;
|
|
80511
80518
|
}, debounceMs);
|
|
80512
|
-
} else if (event ===
|
|
80519
|
+
} else if (event === AuthEvent.AUTHENTICATED || event === AuthEvent.REAUTHENTICATED) {
|
|
80513
80520
|
setIsOpen(false);
|
|
80514
80521
|
alreadyTriggered.current = false;
|
|
80515
80522
|
}
|
|
@@ -80538,6 +80545,25 @@ const AuthModal = ({
|
|
|
80538
80545
|
/* @__PURE__ */ jsx$1(Box, { ml: "auto", mt: 2, children: /* @__PURE__ */ jsx$1(Button2, { variant: "primary", onClick: handleLoginClick, size: "large", children: "Login" }) })
|
|
80539
80546
|
] }) });
|
|
80540
80547
|
};
|
|
80548
|
+
const registerAuthSync = (queryClient2) => onAuthEvent((event) => {
|
|
80549
|
+
switch (event) {
|
|
80550
|
+
case AuthEvent.AUTHENTICATED:
|
|
80551
|
+
case AuthEvent.REAUTHENTICATED:
|
|
80552
|
+
queryClient2.refetchQueries({
|
|
80553
|
+
stale: true
|
|
80554
|
+
});
|
|
80555
|
+
break;
|
|
80556
|
+
case AuthEvent.USER_CHANGED:
|
|
80557
|
+
window.location.reload();
|
|
80558
|
+
break;
|
|
80559
|
+
}
|
|
80560
|
+
});
|
|
80561
|
+
const useAuthSync = (queryClient2) => {
|
|
80562
|
+
useEffect(() => {
|
|
80563
|
+
const unsubscribe = registerAuthSync(queryClient2);
|
|
80564
|
+
return unsubscribe;
|
|
80565
|
+
}, [queryClient2]);
|
|
80566
|
+
};
|
|
80541
80567
|
function bind(fn2, thisArg) {
|
|
80542
80568
|
return function wrap() {
|
|
80543
80569
|
return fn2.apply(thisArg, arguments);
|
|
@@ -82937,7 +82963,7 @@ function withSessionHandling(instance, {
|
|
|
82937
82963
|
exact: true
|
|
82938
82964
|
}));
|
|
82939
82965
|
}
|
|
82940
|
-
broadcastChannel == null ? void 0 : broadcastChannel.postMessage(
|
|
82966
|
+
broadcastChannel == null ? void 0 : broadcastChannel.postMessage(AuthEvent.UNAUTHORIZED);
|
|
82941
82967
|
}
|
|
82942
82968
|
return Promise.reject(err);
|
|
82943
82969
|
});
|
|
@@ -84298,6 +84324,7 @@ export {
|
|
|
84298
84324
|
AppChrome,
|
|
84299
84325
|
AppSwitch,
|
|
84300
84326
|
AppSwitchLibrarySchema,
|
|
84327
|
+
AuthEvent,
|
|
84301
84328
|
AuthModal,
|
|
84302
84329
|
BinIcon,
|
|
84303
84330
|
Button2 as Button,
|
|
@@ -84432,11 +84459,13 @@ export {
|
|
|
84432
84459
|
loggerLevelOrder,
|
|
84433
84460
|
onAuthEvent,
|
|
84434
84461
|
parseOrThrowWithInput,
|
|
84462
|
+
registerAuthSync,
|
|
84435
84463
|
renderErrorToHtml,
|
|
84436
84464
|
requestWipe,
|
|
84437
84465
|
setupWipe,
|
|
84438
84466
|
toStringEncoded,
|
|
84439
84467
|
uriComponentCodec,
|
|
84468
|
+
useAuthSync,
|
|
84440
84469
|
useDebounce,
|
|
84441
84470
|
useExtendedTheme,
|
|
84442
84471
|
useFloatingPanels
|
package/dist/ds.umd.cjs
CHANGED
|
@@ -80489,6 +80489,13 @@ uniform ${i3} ${s4} u_${a3};
|
|
|
80489
80489
|
/* @__PURE__ */ jsx$1(FlexGridItem, { flexGrow: 0, p: 1, children: /* @__PURE__ */ jsx$1(LayerSelector, { ...styleSelector.props }) })
|
|
80490
80490
|
] }) }) }) });
|
|
80491
80491
|
};
|
|
80492
|
+
var AuthEvent = /* @__PURE__ */ ((AuthEvent2) => {
|
|
80493
|
+
AuthEvent2["AUTHENTICATED"] = "authenticated";
|
|
80494
|
+
AuthEvent2["REAUTHENTICATED"] = "reauthenticated";
|
|
80495
|
+
AuthEvent2["USER_CHANGED"] = "user-changed";
|
|
80496
|
+
AuthEvent2["UNAUTHORIZED"] = "unauthorized";
|
|
80497
|
+
return AuthEvent2;
|
|
80498
|
+
})(AuthEvent || {});
|
|
80492
80499
|
const listeners = /* @__PURE__ */ new Set();
|
|
80493
80500
|
let lastMessage = null;
|
|
80494
80501
|
const bc = new BroadcastChannel("auth-events");
|
|
@@ -80521,13 +80528,13 @@ uniform ${i3} ${s4} u_${a3};
|
|
|
80521
80528
|
};
|
|
80522
80529
|
React$2.useEffect(() => {
|
|
80523
80530
|
const unsubscribe = onAuthEvent((event) => {
|
|
80524
|
-
if (event ===
|
|
80531
|
+
if (event === AuthEvent.UNAUTHORIZED && !alreadyTriggered.current) {
|
|
80525
80532
|
setIsOpen(true);
|
|
80526
80533
|
alreadyTriggered.current = true;
|
|
80527
80534
|
setTimeout(() => {
|
|
80528
80535
|
alreadyTriggered.current = false;
|
|
80529
80536
|
}, debounceMs);
|
|
80530
|
-
} else if (event ===
|
|
80537
|
+
} else if (event === AuthEvent.AUTHENTICATED || event === AuthEvent.REAUTHENTICATED) {
|
|
80531
80538
|
setIsOpen(false);
|
|
80532
80539
|
alreadyTriggered.current = false;
|
|
80533
80540
|
}
|
|
@@ -80556,6 +80563,25 @@ uniform ${i3} ${s4} u_${a3};
|
|
|
80556
80563
|
/* @__PURE__ */ jsx$1(Box, { ml: "auto", mt: 2, children: /* @__PURE__ */ jsx$1(Button, { variant: "primary", onClick: handleLoginClick, size: "large", children: "Login" }) })
|
|
80557
80564
|
] }) });
|
|
80558
80565
|
};
|
|
80566
|
+
const registerAuthSync = (queryClient2) => onAuthEvent((event) => {
|
|
80567
|
+
switch (event) {
|
|
80568
|
+
case AuthEvent.AUTHENTICATED:
|
|
80569
|
+
case AuthEvent.REAUTHENTICATED:
|
|
80570
|
+
queryClient2.refetchQueries({
|
|
80571
|
+
stale: true
|
|
80572
|
+
});
|
|
80573
|
+
break;
|
|
80574
|
+
case AuthEvent.USER_CHANGED:
|
|
80575
|
+
window.location.reload();
|
|
80576
|
+
break;
|
|
80577
|
+
}
|
|
80578
|
+
});
|
|
80579
|
+
const useAuthSync = (queryClient2) => {
|
|
80580
|
+
React$2.useEffect(() => {
|
|
80581
|
+
const unsubscribe = registerAuthSync(queryClient2);
|
|
80582
|
+
return unsubscribe;
|
|
80583
|
+
}, [queryClient2]);
|
|
80584
|
+
};
|
|
80559
80585
|
function bind(fn, thisArg) {
|
|
80560
80586
|
return function wrap() {
|
|
80561
80587
|
return fn.apply(thisArg, arguments);
|
|
@@ -82955,7 +82981,7 @@ uniform ${i3} ${s4} u_${a3};
|
|
|
82955
82981
|
exact: true
|
|
82956
82982
|
}));
|
|
82957
82983
|
}
|
|
82958
|
-
broadcastChannel == null ? void 0 : broadcastChannel.postMessage(
|
|
82984
|
+
broadcastChannel == null ? void 0 : broadcastChannel.postMessage(AuthEvent.UNAUTHORIZED);
|
|
82959
82985
|
}
|
|
82960
82986
|
return Promise.reject(err);
|
|
82961
82987
|
});
|
|
@@ -84320,6 +84346,7 @@ uniform ${i3} ${s4} u_${a3};
|
|
|
84320
84346
|
exports2.AppChrome = AppChrome;
|
|
84321
84347
|
exports2.AppSwitch = AppSwitch;
|
|
84322
84348
|
exports2.AppSwitchLibrarySchema = AppSwitchLibrarySchema;
|
|
84349
|
+
exports2.AuthEvent = AuthEvent;
|
|
84323
84350
|
exports2.AuthModal = AuthModal;
|
|
84324
84351
|
exports2.BinIcon = BinIcon;
|
|
84325
84352
|
exports2.Button = Button;
|
|
@@ -84454,11 +84481,13 @@ uniform ${i3} ${s4} u_${a3};
|
|
|
84454
84481
|
exports2.loggerLevelOrder = loggerLevelOrder;
|
|
84455
84482
|
exports2.onAuthEvent = onAuthEvent;
|
|
84456
84483
|
exports2.parseOrThrowWithInput = parseOrThrowWithInput;
|
|
84484
|
+
exports2.registerAuthSync = registerAuthSync;
|
|
84457
84485
|
exports2.renderErrorToHtml = renderErrorToHtml;
|
|
84458
84486
|
exports2.requestWipe = requestWipe;
|
|
84459
84487
|
exports2.setupWipe = setupWipe;
|
|
84460
84488
|
exports2.toStringEncoded = toStringEncoded;
|
|
84461
84489
|
exports2.uriComponentCodec = uriComponentCodec;
|
|
84490
|
+
exports2.useAuthSync = useAuthSync;
|
|
84462
84491
|
exports2.useDebounce = useDebounce;
|
|
84463
84492
|
exports2.useExtendedTheme = useExtendedTheme;
|
|
84464
84493
|
exports2.useFloatingPanels = useFloatingPanels;
|
package/dist/logout-syncer/sw.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
export declare enum AuthEvent {
|
|
2
|
+
AUTHENTICATED = "authenticated",
|
|
3
|
+
REAUTHENTICATED = "reauthenticated",
|
|
4
|
+
USER_CHANGED = "user-changed",
|
|
5
|
+
UNAUTHORIZED = "unauthorized"
|
|
6
|
+
}
|
|
2
7
|
export declare function onAuthEvent(callback: (event: AuthEvent) => void): () => void;
|
|
3
8
|
export declare function broadcastAuthEvent(event: AuthEvent): void;
|
|
4
|
-
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { QueryClient, QueryKey } from '@tanstack/react-query';
|
|
3
3
|
|
|
4
4
|
export interface SessionHandlingConfig {
|
|
5
5
|
queryClient?: QueryClient;
|
|
6
6
|
broadcastChannel?: BroadcastChannel;
|
|
7
|
-
keysToInvalidate?:
|
|
7
|
+
keysToInvalidate?: QueryKey[];
|
|
8
8
|
}
|
|
9
9
|
export interface AuthConfig {
|
|
10
10
|
getToken: () => string | null;
|
package/dist/src/export.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './v1/components/utils/index';
|
|
|
15
15
|
export * from './component-library/Map';
|
|
16
16
|
export * from './candidate-packages/authorize-flow/AuthModal';
|
|
17
17
|
export * from './candidate-packages/authorize-flow/broadcastChannelService';
|
|
18
|
+
export * from './candidate-packages/authorize-flow/useAuthSync';
|
|
18
19
|
export * from './candidate-packages/authorize-flow';
|
|
19
20
|
export { getCodec, type Codec, base64Codec, uriComponentCodec, ENCODE_SEARCH_PARAMS_MODES_Schema, type ENCODE_SEARCH_PARAMS_MODES_Type, toStringEncoded, type URLSearchParamsInit, GRAPH_APP, type LoggerLevelString, type LoggerLevel, loggerLevelOrder, Logger, } from './candidate-packages/utils-lib/src/index';
|
|
20
21
|
export { setupWipe, WipeConfigSchema, type WipeConfig, } from './candidate-packages/logout-syncer/setupWipe';
|