corpushub-design-system 0.0.18 → 0.0.20
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,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import { attachBearerFromSession, installAuthRefreshInterceptor, } from './installAuthRefreshInterceptor';
|
|
2
3
|
import { clearSession, setAccessToken, setRefreshAccessTokenImpl, } from './session';
|
|
3
4
|
const authApi = axios.create({
|
|
4
5
|
withCredentials: true,
|
|
@@ -14,6 +15,11 @@ const authApiBase = import.meta.env.VITE_APP_AUTH_API ?? '';
|
|
|
14
15
|
if (authApiBase) {
|
|
15
16
|
configureAuthApiBaseUrl(authApiBase);
|
|
16
17
|
}
|
|
18
|
+
installAuthRefreshInterceptor(authApi);
|
|
19
|
+
authApi.interceptors.request.use((config) => {
|
|
20
|
+
attachBearerFromSession(config);
|
|
21
|
+
return config;
|
|
22
|
+
});
|
|
17
23
|
/** Gateway: `/api/auth/refresh` → auth service `/auth/refresh` (StripPrefix=1 drops `/api` only). */
|
|
18
24
|
setRefreshAccessTokenImpl(async () => {
|
|
19
25
|
try {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import authApi from '../auth/authApi';
|
|
2
2
|
function updateLiveTour(liveTour) {
|
|
3
|
-
return
|
|
3
|
+
return authApi.patch('/profile/live-tour', { liveTour });
|
|
4
4
|
}
|
|
5
5
|
function updateSettings(settings) {
|
|
6
|
-
return
|
|
6
|
+
return authApi.patch('/profile/settings', { settings });
|
|
7
7
|
}
|
|
8
8
|
const ProfileService = {
|
|
9
9
|
updateLiveTour,
|
|
@@ -14,5 +14,6 @@ export type Props = JSX.IntrinsicElements['button'] & {
|
|
|
14
14
|
hideDivider?: boolean;
|
|
15
15
|
right?: boolean;
|
|
16
16
|
icon?: string;
|
|
17
|
+
dataTour?: string;
|
|
17
18
|
};
|
|
18
|
-
export default function DropdownButton({ text, list, className, disabled, active, color, size, onSelect, hideDivider, right, icon, }: Props): import("react").JSX.Element;
|
|
19
|
+
export default function DropdownButton({ text, list, className, disabled, active, color, size, onSelect, hideDivider, right, icon, dataTour, }: Props): import("react").JSX.Element;
|
|
@@ -15,7 +15,7 @@ export const DropdownButtonColors = [
|
|
|
15
15
|
'secondary',
|
|
16
16
|
'tertiary',
|
|
17
17
|
];
|
|
18
|
-
export default function DropdownButton({ text, list, className = '', disabled = false, active = false, color = 'primary', size = 'large', onSelect, hideDivider, right, icon, }) {
|
|
18
|
+
export default function DropdownButton({ text, list, className = '', disabled = false, active = false, color = 'primary', size = 'large', onSelect, hideDivider, right, icon, dataTour, }) {
|
|
19
19
|
const [show, setShow] = useState(false);
|
|
20
20
|
const containerRef = useRef(null);
|
|
21
21
|
useEffect(() => {
|
|
@@ -35,7 +35,7 @@ export default function DropdownButton({ text, list, className = '', disabled =
|
|
|
35
35
|
const getClassNames = cx('ds-dropdown-button', className, size, color, {
|
|
36
36
|
active: !disabled && active,
|
|
37
37
|
});
|
|
38
|
-
return (_jsxs("div", { className: "ds-dropdown-container", ref: containerRef, children: [_jsxs("button", { type: "button", disabled: disabled, className: getClassNames, onClick: () => setShow(!show), children: [_jsxs("div", { className: "left-side", children: [icon && _jsx(Icon, { name: icon, className: "icon-custom" }), _jsx("span", { className: "text", children: text })] }), !hideDivider && _jsx("div", { className: "divider", children: "\u00A0" }), _jsx(Icon, { name: "arrow_drop_down", className: "icon-arrow" })] }), show && (_jsx(DropdownList, { right: right, list: list, onSelect: (s) => {
|
|
38
|
+
return (_jsxs("div", { className: "ds-dropdown-container", ref: containerRef, children: [_jsxs("button", { type: "button", disabled: disabled, className: getClassNames, onClick: () => setShow(!show), "data-tour": dataTour, children: [_jsxs("div", { className: "left-side", children: [icon && _jsx(Icon, { name: icon, className: "icon-custom" }), _jsx("span", { className: "text", children: text })] }), !hideDivider && _jsx("div", { className: "divider", children: "\u00A0" }), _jsx(Icon, { name: "arrow_drop_down", className: "icon-arrow" })] }), show && (_jsx(DropdownList, { right: right, list: list, onSelect: (s) => {
|
|
39
39
|
onSelect && onSelect(s);
|
|
40
40
|
setTimeout(function () {
|
|
41
41
|
setShow(false);
|