Merge branch 'bugfix/rc-2.5.0' into develop

This commit is contained in:
Alexey Safronov 2024-02-22 22:33:59 +04:00
commit b149385f92
7 changed files with 96 additions and 72 deletions

View File

@ -323,51 +323,45 @@ module.exports = (env, argv) => {
...deps,
...sharedDeps,
},
})
}),
);
const htmlTemplate = {
title: title,
template: "./public/index.html",
publicPath: homepage,
base: `${homepage}/`,
};
if (!!env.hideText) {
config.plugins.push(
new HtmlWebpackPlugin({
title: title,
template: "./public/index.html",
publicPath: homepage,
base: `${homepage}/`,
custom: `<style type="text/css">
div,
p,
a,
span,
button,
h1,
h2,
h3,
h4,
h5,
h6,
::placeholder {
color: rgba(0, 0, 0, 0) !important;
htmlTemplate.custom = `
<style type="text/css">
div,
p,
a,
span,
button,
h1,
h2,
h3,
h4,
h5,
h6,
::placeholder {
color: rgba(0, 0, 0, 0) !important;
}
</style>`,
})
);
</style>`;
} else {
config.plugins.push(
new HtmlWebpackPlugin({
template: "./public/index.html",
publicPath: homepage,
title: title,
base: `${homepage}/`,
browserDetectorUrl: `/static/scripts/browserDetector.js?hash=${
runtime.checksums["browserDetector.js"] || dateHash
}`,
configUrl: `/static/scripts/config.json?hash=${
runtime.checksums["config.json"] || dateHash
}`,
})
);
htmlTemplate.browserDetectorUrl = `/static/scripts/browserDetector.js?hash=${
runtime.checksums["browserDetector.js"] || dateHash
}`;
htmlTemplate.configUrl = `/static/scripts/config.json?hash=${
runtime.checksums["config.json"] || dateHash
}`;
}
config.plugins.push(new HtmlWebpackPlugin(htmlTemplate));
const defines = {
VERSION: JSON.stringify(version),
BUILD_AT: DefinePlugin.runtimeValue(function () {

View File

@ -291,42 +291,35 @@ module.exports = (env, argv) => {
})
);
const htmlTemplate = {
title: title,
template: "./public/index.html",
publicPath: homepage,
base: `${homepage}/`,
};
if (!!env.hideText) {
config.plugins.push(
new HtmlWebpackPlugin({
title: title,
template: "./public/index.html",
publicPath: homepage,
base: `${homepage}/`,
custom: `<style type="text/css">
div,
p,
a,
span,
button,
h1,
h2,
h3,
h4,
h5,
h6,
::placeholder {
color: rgba(0, 0, 0, 0) !important;
}
</style>`,
})
);
} else {
config.plugins.push(
new HtmlWebpackPlugin({
template: "./public/index.html",
publicPath: homepage,
title: title,
base: `${homepage}/`,
})
);
htmlTemplate.custom = `
<style type="text/css">
div,
p,
a,
span,
button,
h1,
h2,
h3,
h4,
h5,
h6,
::placeholder {
color: rgba(0, 0, 0, 0) !important;
}
</style>`;
}
config.plugins.push(new HtmlWebpackPlugin(htmlTemplate));
const defines = {
VERSION: JSON.stringify(version),
BUILD_AT: DefinePlugin.runtimeValue(function () {

View File

@ -94,6 +94,7 @@ export type TSettings = {
formGallery: TFormGallery;
wizardToken?: string;
defaultPage?: string;
tagManagerId?: string;
};
export type TCustomSchema = {

View File

@ -8,7 +8,12 @@ import { getPortalTenantExtra } from "../api/portal";
import { TUser } from "../api/people/types";
import { TCapabilities, TThirdPartyProvider } from "../api/settings/types";
import { logout as logoutDesktop } from "../utils/desktop";
import { frameCallEvent, isAdmin, isPublicRoom } from "../utils/common";
import {
frameCallEvent,
isAdmin,
isPublicRoom,
insertDataLayer,
} from "../utils/common";
import { getCookie, setCookie } from "../utils/cookie";
import { TTenantExtraRes } from "../api/portal/types";
import { TenantStatus } from "../enums";
@ -164,6 +169,10 @@ class AuthStore {
return Promise.all(requests).then(() => {
const user = this.userStore?.user;
if (user?.id) {
insertDataLayer(user.id);
}
if (
user &&
this.settingsStore?.standalone &&

View File

@ -28,6 +28,7 @@ import {
getShowText,
initArticleAlertsData,
isPublicRoom,
insertTagManager,
} from "../utils/common";
import { setCookie, getCookie } from "../utils/cookie";
import { combineUrl } from "../utils/combineUrl";
@ -584,6 +585,10 @@ class SettingsStore {
if (origSettings?.domainValidator) {
this.domainValidator = origSettings.domainValidator;
}
if (origSettings?.tagManagerId) {
insertTagManager(origSettings.tagManagerId);
}
};
get isPortalDeactivate() {

View File

@ -106,6 +106,7 @@ declare global {
Tiff: new (arg: object) => {
toDataURL: () => string;
};
dataLayer?: Record<string, unknown>[];
}
export type ContextMenuModel =

View File

@ -922,3 +922,24 @@ export const getIconPathByFolderType = (
return folderIconPath[folderType ?? FolderType.DEFAULT] ?? defaultPath;
};
export const insertTagManager = (id: string) => {
const script = document.createElement("script");
script.innerHTML = `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','${id}');`;
const noScript = document.createElement("noscript");
noScript.innerHTML = `<iframe src="https://www.googletagmanager.com/ns.html?id=${id}"
height="0" width="0" style="display:none;visibility:hidden"></iframe>`;
document.head.insertBefore(script, document.head.childNodes[0]);
document.body.insertBefore(noScript, document.body.childNodes[0]);
};
export const insertDataLayer = (id: string) => {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ user_id: id });
};