Merge branch 'hotfix/v2.0.2' into feature/js-sdk-loader

This commit is contained in:
Ilya Oleshko 2024-01-26 20:36:01 +03:00
commit f00031b8bf
10 changed files with 37 additions and 8 deletions

View File

@ -46,7 +46,7 @@
"element-resize-detector": "^1.2.4",
"file-saver": "^2.0.5",
"firebase": "^8.10.1",
"hex-to-rgba": "^2.0.2",
"hex-to-rgba": "^2.0.1",
"queue-promise": "2.2.1",
"react-avatar-editor": "^13.0.0",
"react-colorful": "^5.6.1",

View File

@ -424,6 +424,8 @@ const ShellWrapper = inject(({ auth, backup, clientLoadingStore }) => {
whiteLabelLogoUrls,
standalone,
currentDeviceType,
isFrame,
frameConfig,
} = settingsStore;
const isBase = settingsStore.theme.isBase;
@ -462,7 +464,7 @@ const ShellWrapper = inject(({ auth, backup, clientLoadingStore }) => {
setTheme,
roomsMode,
setSnackbarExist,
userTheme: userTheme,
userTheme: isFrame ? frameConfig?.theme : userTheme,
userId: auth?.userStore?.user?.id,
whiteLabelLogoUrls,
standalone,

View File

@ -36,6 +36,7 @@ export type BreadCrumb = {
label: string;
id: number | string;
isRoom: boolean;
shared: boolean;
};
type setItems = (value: Item[] | null) => Item[];
@ -199,6 +200,8 @@ export type FilesSelectorProps = {
id: string | number;
title: string;
path?: string[];
fileExst?: string;
inPublic?: boolean;
},
breadCrumbs: BreadCrumb[]
) => void;

View File

@ -127,6 +127,7 @@ const FilesSelector = ({
title: string;
path?: string[];
fileExst?: string;
inPublic?: boolean;
} | null>(null);
const [total, setTotal] = React.useState<number>(0);
@ -218,6 +219,9 @@ const FilesSelector = ({
});
const onSelectAction = (item: Item) => {
const inPublic =
breadCrumbs.findIndex((f: any) => f.roomType === RoomsType.PublicRoom) >
-1;
if (item.isFolder) {
setIsFirstLoad(true);
setItems(null);
@ -247,6 +251,7 @@ const FilesSelector = ({
id: item.id,
title: item.title,
fileExst: item.fileExst,
inPublic: inPublic,
});
}
};

View File

@ -26,6 +26,7 @@ const Sdk = ({
updateProfileCulture,
getRoomsIcon,
fetchExternalLinks,
getFilePrimaryLink,
}) => {
const [isDataReady, setIsDataReady] = useState(false);
@ -146,10 +147,11 @@ const Sdk = ({
const links = await fetchExternalLinks(data[0].id);
const requestTokens = links.map((link) => {
const { id, title, requestToken } = link.sharedTo;
const { id, title, requestToken, primary } = link.sharedTo;
return {
id,
primary,
title,
requestToken,
};
@ -164,9 +166,17 @@ const Sdk = ({
);
const onSelectFile = useCallback(
(data) => {
async (data) => {
data.icon = getIcon(64, data.fileExst);
if (data.inPublic) {
const link = await getFilePrimaryLink(data.id);
const { id, title, requestToken, primary } = link.sharedTo;
data.requestTokens = [{ id, primary, title, requestToken }];
}
frameCallEvent({ event: "onSelectCallback", data });
},
[frameCallEvent]
@ -219,7 +229,7 @@ const Sdk = ({
};
export default inject(
({ auth, settingsStore, peopleStore, publicRoomStore }) => {
({ auth, settingsStore, peopleStore, publicRoomStore, filesStore }) => {
const { login, logout, userStore } = auth;
const { theme, setFrameConfig, frameConfig, getSettings, isLoaded } =
auth.settingsStore;
@ -227,6 +237,7 @@ export default inject(
const { updateProfileCulture } = peopleStore.targetUserStore;
const { getIcon, getRoomsIcon } = settingsStore;
const { fetchExternalLinks } = publicRoomStore;
const { getFilePrimaryLink } = filesStore;
return {
theme,
@ -242,6 +253,7 @@ export default inject(
updateProfileCulture,
user,
fetchExternalLinks,
getFilePrimaryLink,
};
}
)(observer(Sdk));

View File

@ -3965,6 +3965,10 @@ class FilesStore {
return link;
};
getFilePrimaryLink = async (fileId) => {
return await api.files.getFileLink(fileId);
};
setRoomShared = (roomId, shared) => {
const roomIndex = this.folders.findIndex((r) => r.id === roomId);

View File

@ -8,7 +8,7 @@ import UserStore from "./UserStore";
import TfaStore from "./TfaStore";
import InfoPanelStore from "./InfoPanelStore";
import { logout as logoutDesktop, desktopConstants } from "../desktop";
import { isAdmin, setCookie } from "../utils";
import { isAdmin, setCookie, frameCallEvent } from "../utils";
import { getCookie } from "@docspace/components/utils/cookie";
import CurrentQuotasStore from "./CurrentQuotaStore";
import CurrentTariffStatusStore from "./CurrentTariffStatusStore";
@ -332,10 +332,12 @@ class AuthStore {
this.isLogout = true;
const { isDesktopClient: isDesktop } = this.settingsStore;
const { isDesktopClient: isDesktop, isFrame } = this.settingsStore;
isDesktop && logoutDesktop();
isFrame && frameCallEvent({ event: "onSignOut" });
if (ssoLogoutUrl) return ssoLogoutUrl;
if (!reset) return;

View File

@ -933,7 +933,6 @@ class SettingsStore {
});
if (!!frameConfig) {
this.setTheme(frameConfig?.theme);
frameCallEvent({
event: "onAppReady",
data: { frameId: frameConfig.frameId },

View File

@ -129,6 +129,7 @@ const Selector = ({
avatar: item.avatar,
icon: item.icon,
label: item.label,
shared: item.shared,
});
if (isMultiSelect) {

View File

@ -52,6 +52,7 @@
onAppError: (e) => console.log("onAppError", e),
onEditorCloseCallback: null,
onAuthSuccess: null,
onSignOut: null,
},
};