@zextras/carbonio-shell-ui 7.0.1-devel.1720609013362 → 7.0.1-devel.1721746471977
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/lib/boot/app/app-direct-exports.d.ts +2 -1
- package/lib/boot/app/app-direct-exports.js +5 -3
- package/lib/boot/app/app-direct-exports.js.map +1 -1
- package/lib/boot/posthog.d.ts +8 -0
- package/lib/boot/posthog.js +99 -0
- package/lib/boot/posthog.js.map +1 -0
- package/lib/dark-mode/use-dark-mode.d.ts +5 -0
- package/lib/dark-mode/use-dark-mode.js +33 -0
- package/lib/dark-mode/use-dark-mode.js.map +1 -0
- package/lib/dark-mode/use-dark-reader-result-value.d.ts +11 -0
- package/lib/dark-mode/use-dark-reader-result-value.js +37 -0
- package/lib/dark-mode/use-dark-reader-result-value.js.map +1 -0
- package/lib/dark-mode/utils.d.ts +3 -0
- package/lib/dark-mode/utils.js +11 -0
- package/lib/dark-mode/utils.js.map +1 -0
- package/lib/shell/shell-context.d.ts +1 -0
- package/lib/store/account/hooks.d.ts +4 -0
- package/lib/store/account/hooks.js +11 -1
- package/lib/store/account/hooks.js.map +1 -1
- package/lib/store/login/hooks.d.ts +6 -0
- package/lib/store/login/hooks.js +29 -0
- package/lib/store/login/hooks.js.map +1 -0
- package/lib/store/login/store.d.ts +1 -0
- package/lib/store/login/store.js +1 -0
- package/lib/store/login/store.js.map +1 -1
- package/lib/types/account/index.d.ts +1 -0
- package/lib/utils/utils.d.ts +1 -2
- package/lib/utils/utils.js +5 -7
- package/lib/utils/utils.js.map +1 -1
- package/package.json +7 -4
- package/lib/boot/matomo.d.ts +0 -12
- package/lib/boot/matomo.js +0 -22
- package/lib/boot/matomo.js.map +0 -1
- package/lib/boot/tracker.d.ts +0 -11
- package/lib/boot/tracker.js +0 -57
- package/lib/boot/tracker.js.map +0 -1
|
@@ -32,4 +32,5 @@ export declare const updatePrimaryBadge: (badge: Partial<import("../../lib").Bad
|
|
|
32
32
|
* \});
|
|
33
33
|
*/
|
|
34
34
|
upsertApp: (app: Pick<import("../../types/apps").CarbonioModule, "description" | "name" | "display">) => void;
|
|
35
|
-
export {
|
|
35
|
+
export { useIsCarbonioCE } from '../../store/login/hooks';
|
|
36
|
+
export { useTracker } from '../posthog';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
var _a, _b;
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.useSearchFolders = exports.useSearchFolder = exports.getRoots = exports.useRoots = exports.getRoot = exports.useRoot = exports.useFolders = exports.useFolder = exports.getFolders = exports.getFolder = exports.useRefresh = exports.useNotify = exports.renameTag = exports.deleteTag = exports.createTag = exports.changeTagColor = exports.useTags = exports.getTags = exports.updateAccount = exports.updateSettings = exports.useAuthenticated = exports.getUserRights = exports.getUserRight = exports.useUserRights = exports.useUserRight = exports.useUserSettings = exports.useUserSetting = exports.useUserAccounts = exports.useUserAccount = exports.getUserSettings = exports.getUserSetting = exports.getUserAccounts = exports.getUserAccount = exports.removeComponents = exports.removeActions = exports.registerActions = exports.removeFunctions = exports.registerFunctions = exports.getIntegratedFunction = exports.getIntegratedComponent = exports.getActionFactory = exports.getActionsFactory = exports.getActions = exports.getAction = exports.useIntegratedFunction = exports.useIntegratedComponent = exports.useActionFactory = exports.useActionsFactory = exports.useActions = exports.useAction = void 0;
|
|
10
|
-
exports.
|
|
10
|
+
exports.useTracker = exports.useIsCarbonioCE = exports.upsertApp = exports.removeSecondaryAccessoryView = exports.removePrimaryAccessoryView = exports.removeUtilityView = exports.removeSearchView = exports.removeSettingsView = exports.removeBoardView = exports.removeRoute = exports.setRouteVisibility = exports.updateUtilityBadge = exports.updatePrimaryBadge = exports.useLocalStorage = exports.useIsMobile = exports.runSearch = exports.getNotificationManager = exports.pushHistory = exports.goBackHistory = exports.replaceHistory = exports.useCurrentRoute = exports.getCurrentRoute = exports.useReplaceHistoryCallback = exports.useGoBackHistoryCallback = exports.usePushHistoryCallback = exports.useBoardHooks = exports.setCurrentBoard = exports.reopenBoards = exports.minimizeBoards = exports.useBoard = exports.useBoardById = exports.useBoardContextById = exports.getBoardContextById = exports.getBoardById = exports.updateBoardContext = exports.updateBoard = exports.closeBoard = exports.getRootByUser = exports.useRootByUser = exports.useFoldersAccordionByView = exports.useFoldersByView = exports.getSearchFolders = exports.getSearchFolder = void 0;
|
|
11
11
|
const app_1 = require("../../store/app");
|
|
12
12
|
const store_1 = require("../../store/integrations/store");
|
|
13
13
|
var hooks_1 = require("../../store/integrations/hooks");
|
|
@@ -112,6 +112,8 @@ _b = app_1.useAppStore.getState(), exports.updatePrimaryBadge = _b.updatePrimary
|
|
|
112
112
|
* \});
|
|
113
113
|
*/
|
|
114
114
|
exports.upsertApp = _b.upsertApp;
|
|
115
|
-
var
|
|
116
|
-
Object.defineProperty(exports, "
|
|
115
|
+
var hooks_3 = require("../../store/login/hooks");
|
|
116
|
+
Object.defineProperty(exports, "useIsCarbonioCE", { enumerable: true, get: function () { return hooks_3.useIsCarbonioCE; } });
|
|
117
|
+
var posthog_1 = require("../posthog");
|
|
118
|
+
Object.defineProperty(exports, "useTracker", { enumerable: true, get: function () { return posthog_1.useTracker; } });
|
|
117
119
|
//# sourceMappingURL=app-direct-exports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-direct-exports.js","sourceRoot":"","sources":["../../../src/boot/app/app-direct-exports.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AAEH,yCAA8C;AAC9C,0DAAsE;AAEtE,wDAOwC;AANvC,kGAAA,SAAS,OAAA;AACT,mGAAA,UAAU,OAAA;AACV,0GAAA,iBAAiB,OAAA;AACjB,yGAAA,gBAAgB,OAAA;AAChB,+GAAA,sBAAsB,OAAA;AACtB,8GAAA,qBAAqB,OAAA;AAGtB,4DAO0C;AANzC,oGAAA,SAAS,OAAA;AACT,qGAAA,UAAU,OAAA;AACV,4GAAA,iBAAiB,OAAA;AACjB,2GAAA,gBAA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,OAAA;AAGd,6CAa4B;AAZ3B,oGAAA,UAAU,OAAA;AACV,qGAAA,WAAW,OAAA;AACX,4GAAA,kBAAkB,OAAA;AAClB,sGAAA,YAAY,OAAA;AACZ,6GAAA,mBAAmB,OAAA;AACnB,6GAAA,mBAAmB,OAAA;AACnB,sGAAA,YAAY,OAAA;AACZ,kGAAA,QAAQ,OAAA;AACR,wGAAA,cAAc,OAAA;AACd,sGAAA,YAAY,OAAA;AACZ,yGAAA,eAAe,OAAA;AACf,uGAAA,aAAa,OAAA;AAGd,6CAS6B;AAR5B,+GAAA,sBAAsB,OAAA;AACtB,iHAAA,wBAAwB,OAAA;AACxB,kHAAA,yBAAyB,OAAA;AACzB,wGAAA,eAAe,OAAA;AACf,wGAAA,eAAe,OAAA;AACf,uGAAA,cAAc,OAAA;AACd,sGAAA,aAAa,OAAA;AACb,oGAAA,WAAW,OAAA;AAGZ,8EAAgF;AAAvE,6HAAA,sBAAsB,OAAA;AAE/B,sDAAoD;AAA3C,uGAAA,SAAS,OAAA;AAElB,6DAA4D;AAAnD,0GAAA,WAAW,OAAA;AAEpB,qEAAoE;AAA3D,kHAAA,eAAe,OAAA;AAEX,KAuBT,iBAAW,CAAC,QAAQ,EAAE,EAtBzB,0BAAkB,0BAClB,0BAAkB,0BAClB,0BAAkB,0BAClB,mBAAW,mBACX,uBAAe,uBACf,0BAAkB,0BAClB,wBAAgB,wBAChB,yBAAiB,yBACjB,kCAA0B,kCAC1B,oCAA4B;AAC5B;;;;;;;;;;GAUG;AACH,iBAAS,gBACiB;AAE3B,
|
|
1
|
+
{"version":3,"file":"app-direct-exports.js","sourceRoot":"","sources":["../../../src/boot/app/app-direct-exports.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AAEH,yCAA8C;AAC9C,0DAAsE;AAEtE,wDAOwC;AANvC,kGAAA,SAAS,OAAA;AACT,mGAAA,UAAU,OAAA;AACV,0GAAA,iBAAiB,OAAA;AACjB,yGAAA,gBAAgB,OAAA;AAChB,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1
|
+
import React from 'react';
|
|
2
|
+
export declare const TrackerProvider: ({ children }: React.PropsWithChildren<Record<never, never>>) => React.JSX.Element;
|
|
3
|
+
interface Tracker {
|
|
4
|
+
enableTracker: (enable: boolean) => void;
|
|
5
|
+
reset: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const useTracker: () => Tracker;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.useTracker = exports.TrackerProvider = void 0;
|
|
27
|
+
/*
|
|
28
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
29
|
+
*
|
|
30
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
31
|
+
*/
|
|
32
|
+
const react_1 = __importStar(require("react"));
|
|
33
|
+
const react_2 = require("posthog-js/react");
|
|
34
|
+
const account_1 = require("../store/account");
|
|
35
|
+
const hooks_1 = require("../store/login/hooks");
|
|
36
|
+
const utils_1 = require("../utils/utils");
|
|
37
|
+
const TrackerProvider = ({ children }) => {
|
|
38
|
+
const options = (0, react_1.useMemo)(() => ({
|
|
39
|
+
api_host: 'https://stats.zextras.tools',
|
|
40
|
+
person_profiles: 'identified_only',
|
|
41
|
+
opt_out_capturing_by_default: true,
|
|
42
|
+
disable_session_recording: true,
|
|
43
|
+
disable_surveys: true
|
|
44
|
+
}), []);
|
|
45
|
+
return (react_1.default.createElement(react_2.PostHogProvider, { apiKey: POSTHOG_API_KEY, options: options }, children));
|
|
46
|
+
};
|
|
47
|
+
exports.TrackerProvider = TrackerProvider;
|
|
48
|
+
const hashToSHA256 = async (value) => {
|
|
49
|
+
const encoder = new TextEncoder();
|
|
50
|
+
const data = encoder.encode(value);
|
|
51
|
+
return window.crypto.subtle.digest('SHA-256', data);
|
|
52
|
+
};
|
|
53
|
+
const arrayBufferToBase64 = (buffer) => {
|
|
54
|
+
const bytes = new Uint8Array(buffer);
|
|
55
|
+
const binary = bytes.reduce((res, byte) => res + String.fromCharCode(byte), '');
|
|
56
|
+
return window.btoa(binary);
|
|
57
|
+
};
|
|
58
|
+
const useTracker = () => {
|
|
59
|
+
const postHog = (0, react_2.usePostHog)();
|
|
60
|
+
const isCarbonioCE = (0, hooks_1.useIsCarbonioCE)();
|
|
61
|
+
const [isOptedIn, setIsOptedIn] = (0, react_1.useState)(postHog.has_opted_in_capturing());
|
|
62
|
+
(0, react_1.useEffect)(() => {
|
|
63
|
+
if (isCarbonioCE !== undefined) {
|
|
64
|
+
postHog.setPersonProperties({ is_ce: isCarbonioCE });
|
|
65
|
+
}
|
|
66
|
+
}, [isCarbonioCE, postHog]);
|
|
67
|
+
(0, react_1.useEffect)(() => {
|
|
68
|
+
const newValue = !isCarbonioCE || !isOptedIn;
|
|
69
|
+
if (postHog.config.disable_surveys !== newValue && isCarbonioCE !== undefined) {
|
|
70
|
+
postHog.set_config({ disable_surveys: newValue });
|
|
71
|
+
}
|
|
72
|
+
}, [isCarbonioCE, isOptedIn, postHog]);
|
|
73
|
+
const enableTracker = (0, react_1.useCallback)((enable) => {
|
|
74
|
+
if (!(0, utils_1.getCurrentLocationHost)().includes('127.0.0.1') &&
|
|
75
|
+
!(0, utils_1.getCurrentLocationHost)().includes('localhost')) {
|
|
76
|
+
if (enable) {
|
|
77
|
+
const { account } = account_1.useAccountStore.getState();
|
|
78
|
+
if (account?.id) {
|
|
79
|
+
hashToSHA256(account.id).then((arrayBuffer) => {
|
|
80
|
+
const hashUserId = arrayBufferToBase64(arrayBuffer);
|
|
81
|
+
postHog.identify(hashUserId);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
postHog.opt_in_capturing();
|
|
85
|
+
setIsOptedIn(true);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
postHog.opt_out_capturing();
|
|
89
|
+
setIsOptedIn(false);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, [postHog]);
|
|
93
|
+
const reset = (0, react_1.useCallback)(() => {
|
|
94
|
+
postHog.reset();
|
|
95
|
+
}, [postHog]);
|
|
96
|
+
return { enableTracker, reset };
|
|
97
|
+
};
|
|
98
|
+
exports.useTracker = useTracker;
|
|
99
|
+
//# sourceMappingURL=posthog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posthog.js","sourceRoot":"","sources":["../../src/boot/posthog.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,+CAAyE;AAGzE,4CAA+D;AAE/D,8CAAmD;AACnD,gDAAuD;AACvD,0CAAwD;AAEjD,MAAM,eAAe,GAAG,CAAC,EAC/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AO,CAAC,gBAAgB,EAAE,CAAC;gBAC3B,YAAY,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;iBAAM,CAAC;gBACP,OAAO,CAAC,iBAAiB,EAAE,CAAC;gBAC5B,YAAY,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACF,CAAC;IACF,CAAC,EACD,CAAC,OAAO,CAAC,CACT,CAAC;IAEF,MAAM,KAAK,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAC9B,OAAO,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AACjC,CAAC,CAAC;AAhDW,QAAA,UAAU,cAgDrB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDarkMode = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
8
|
+
*/
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const use_dark_reader_result_value_1 = require("./use-dark-reader-result-value");
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
const useDarkMode = () => {
|
|
13
|
+
const darkReaderResultValue = (0, use_dark_reader_result_value_1.useDarkReaderResultValue)();
|
|
14
|
+
const [darkModeEnabled, setDarkModeEnabled] = (0, react_1.useState)(false);
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
16
|
+
if (darkReaderResultValue) {
|
|
17
|
+
setDarkModeEnabled((darkReaderResultValue === 'auto' && (0, utils_1.getPrefersColorSchemeDarkMedia)().matches) ||
|
|
18
|
+
darkReaderResultValue === 'enabled');
|
|
19
|
+
}
|
|
20
|
+
}, [darkReaderResultValue]);
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
22
|
+
const setCallback = (event) => {
|
|
23
|
+
setDarkModeEnabled(event.matches);
|
|
24
|
+
};
|
|
25
|
+
(0, utils_1.getPrefersColorSchemeDarkMedia)().addEventListener('change', setCallback);
|
|
26
|
+
return () => {
|
|
27
|
+
(0, utils_1.getPrefersColorSchemeDarkMedia)().removeEventListener('change', setCallback);
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
return { darkModeEnabled, darkReaderStatus: darkReaderResultValue };
|
|
31
|
+
};
|
|
32
|
+
exports.useDarkMode = useDarkMode;
|
|
33
|
+
//# sourceMappingURL=use-dark-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-dark-mode.js","sourceRoot":"","sources":["../../src/dark-mode/use-dark-mode.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,iCAA4C;AAE5C,iFAA0E;AAE1E,mCAAyD;AAElD,MAAM,WAAW,GAAG,GAGzB,EAAE;IACH,MAAM,qBAAqB,GAAG,IAAA,uDAAwB,GAAE,CAAC;IAEzD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAC;IAEvE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACd,IAAI,qBAAqB,EAAE,CAAC;YAC3B,kBAAkB,CACjB,CAAC,qBAAqB,KAAK,MAAM,IAAI,IAAA,sCAA8B,GAAE,CAAC,OAAO,CAAC;gBAC7E,qBAAqB,KAAK,SAAS,CACpC,CAAC;QACH,CAAC;IACF,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAE5B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACd,MAAM,WAAW,GAAG,CAAC,KAA0B,EAAQ,EAAE;YACxD,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC,CAAC;QACF,IAAA,sCAA8B,GAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACzE,OAAO,GAAS,EAAE;YACjB,IAAA,sCAA8B,GAAE,CAAC,mBAAmB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC7E,CAAC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,CAAC;AACrE,CAAC,CAAC;AA5BW,QAAA,WAAW,eA4BtB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DarkReaderPropValues } from './utils';
|
|
2
|
+
import { DARK_READER_PROP_KEY, SHELL_APP_ID } from '../constants';
|
|
3
|
+
import type { ZimletProp } from '../types/account';
|
|
4
|
+
export interface ZappDarkreaderModeZimletProp extends ZimletProp {
|
|
5
|
+
name: typeof DARK_READER_PROP_KEY;
|
|
6
|
+
zimlet: typeof SHELL_APP_ID;
|
|
7
|
+
_content: DarkReaderPropValues;
|
|
8
|
+
}
|
|
9
|
+
export declare function isZappDarkreaderModeZimletProp(prop: ZimletProp): prop is ZappDarkreaderModeZimletProp;
|
|
10
|
+
export declare function isDarkReaderPropValues(maybeDarkReaderPropValue: unknown): maybeDarkReaderPropValue is DarkReaderPropValues;
|
|
11
|
+
export declare function useDarkReaderResultValue(): undefined | DarkReaderPropValues;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.useDarkReaderResultValue = exports.isDarkReaderPropValues = exports.isZappDarkreaderModeZimletProp = void 0;
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const lodash_1 = require("lodash");
|
|
11
|
+
const constants_1 = require("../constants");
|
|
12
|
+
const account_1 = require("../store/account");
|
|
13
|
+
const store_1 = require("../store/login/store");
|
|
14
|
+
function isZappDarkreaderModeZimletProp(prop) {
|
|
15
|
+
return prop.name === constants_1.DARK_READER_PROP_KEY && prop.zimlet === constants_1.SHELL_APP_ID;
|
|
16
|
+
}
|
|
17
|
+
exports.isZappDarkreaderModeZimletProp = isZappDarkreaderModeZimletProp;
|
|
18
|
+
function isDarkReaderPropValues(maybeDarkReaderPropValue) {
|
|
19
|
+
return (typeof maybeDarkReaderPropValue === 'string' &&
|
|
20
|
+
constants_1.DARK_READER_VALUES.includes(maybeDarkReaderPropValue));
|
|
21
|
+
}
|
|
22
|
+
exports.isDarkReaderPropValues = isDarkReaderPropValues;
|
|
23
|
+
// return the final calculated value between ZappDarkreaderModeZimletProp value and carbonioWebUiDarkMode config
|
|
24
|
+
function useDarkReaderResultValue() {
|
|
25
|
+
const settings = (0, account_1.useUserSettings)();
|
|
26
|
+
const { carbonioWebUiDarkMode } = (0, store_1.useLoginConfigStore)();
|
|
27
|
+
const settingReceived = (0, react_1.useMemo)(() => (0, lodash_1.size)(settings.prefs) > 0 || (0, lodash_1.size)(settings.attrs) > 0 || (0, lodash_1.size)(settings.props) > 0, [settings]);
|
|
28
|
+
return (0, react_1.useMemo)(() => {
|
|
29
|
+
if (settingReceived) {
|
|
30
|
+
const result = (0, lodash_1.find)(settings.props, (value) => isZappDarkreaderModeZimletProp(value))?._content;
|
|
31
|
+
return result || (carbonioWebUiDarkMode && 'enabled') || 'disabled';
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
}, [settingReceived, settings, carbonioWebUiDarkMode]);
|
|
35
|
+
}
|
|
36
|
+
exports.useDarkReaderResultValue = useDarkReaderResultValue;
|
|
37
|
+
//# sourceMappingURL=use-dark-reader-result-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-dark-reader-result-value.js","sourceRoot":"","sources":["../../src/dark-mode/use-dark-reader-result-value.ts"],"names":[],"mappings":";AAAA;;;;GAIG;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ACxD,CAAC;AApBD,4DAoBC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.getPrefersColorSchemeDarkMedia = void 0;
|
|
9
|
+
const getPrefersColorSchemeDarkMedia = () => window.matchMedia('(prefers-color-scheme: dark)');
|
|
10
|
+
exports.getPrefersColorSchemeDarkMedia = getPrefersColorSchemeDarkMedia;
|
|
11
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/dark-mode/utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAII,MAAM,8BAA8B,GAAG,GAAmB,EAAE,CAClE,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC;AADtC,QAAA,8BAA8B,kCACQ"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Account, AccountRightName, AccountRights, AccountRightTarget, AccountSettings } from '../../types/account';
|
|
2
2
|
export declare const useAuthenticated: () => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Return the authenticated user account. Throws if the user is not authenticated.
|
|
5
|
+
* Note: this hook should be used only where the user is for sure logically authenticated
|
|
6
|
+
*/
|
|
3
7
|
export declare const useUserAccount: () => Account;
|
|
4
8
|
export declare const useUserAccounts: () => Array<Account>;
|
|
5
9
|
export declare const useUserRights: () => AccountRights;
|
|
@@ -11,7 +11,17 @@ const lodash_1 = require("lodash");
|
|
|
11
11
|
const store_1 = require("./store");
|
|
12
12
|
const useAuthenticated = () => (0, store_1.useAccountStore)((s) => s.authenticated);
|
|
13
13
|
exports.useAuthenticated = useAuthenticated;
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Return the authenticated user account. Throws if the user is not authenticated.
|
|
16
|
+
* Note: this hook should be used only where the user is for sure logically authenticated
|
|
17
|
+
*/
|
|
18
|
+
const useUserAccount = () => {
|
|
19
|
+
const account = (0, store_1.useAccountStore)((s) => s.account);
|
|
20
|
+
if (account === undefined) {
|
|
21
|
+
throw new Error('User is not authenticated');
|
|
22
|
+
}
|
|
23
|
+
return account;
|
|
24
|
+
};
|
|
15
25
|
exports.useUserAccount = useUserAccount;
|
|
16
26
|
const useUserAccounts = () => {
|
|
17
27
|
const acct = (0, store_1.useAccountStore)((s) => s.account);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/store/account/hooks.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,iCAAgC;AAEhC,mCAAyC;AAEzC,mCAA0C;AASnC,MAAM,gBAAgB,GAAG,GAAY,EAAE,CAAC,IAAA,uBAAe,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;AAA1E,QAAA,gBAAgB,oBAA0D;
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/store/account/hooks.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,iCAAgC;AAEhC,mCAAyC;AAEzC,mCAA0C;AASnC,MAAM,gBAAgB,GAAG,GAAY,EAAE,CAAC,IAAA,uBAAe,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;AAA1E,QAAA,gBAAgB,oBAA0D;AAEvF;;;GAGG;AACI,MAAM,cAAc,GAAG,GAAY,EAAE;IAC3C,MAAM,OAAO,GAAG,IAAA,uBAAe,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAClD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,2B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AADjF,QAAA,YAAY,gBACqE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useIsCarbonioCE = exports.useLogo = void 0;
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const store_1 = require("./store");
|
|
9
|
+
const carbonio_svg_1 = __importDefault(require("../../../assets/carbonio.svg"));
|
|
10
|
+
const use_dark_mode_1 = require("../../dark-mode/use-dark-mode");
|
|
11
|
+
function useLogo() {
|
|
12
|
+
const { carbonioWebUiAppLogo, carbonioWebUiDarkAppLogo } = (0, store_1.useLoginConfigStore)();
|
|
13
|
+
const { darkModeEnabled } = (0, use_dark_mode_1.useDarkMode)();
|
|
14
|
+
return (0, react_1.useMemo)(() => {
|
|
15
|
+
if (darkModeEnabled) {
|
|
16
|
+
return carbonioWebUiDarkAppLogo ?? carbonioWebUiAppLogo ?? carbonio_svg_1.default;
|
|
17
|
+
}
|
|
18
|
+
return carbonioWebUiAppLogo ?? carbonioWebUiDarkAppLogo ?? carbonio_svg_1.default;
|
|
19
|
+
}, [carbonioWebUiDarkAppLogo, carbonioWebUiAppLogo, darkModeEnabled]);
|
|
20
|
+
}
|
|
21
|
+
exports.useLogo = useLogo;
|
|
22
|
+
/**
|
|
23
|
+
* Hook useful to know if is Carbonio CE or not
|
|
24
|
+
*/
|
|
25
|
+
function useIsCarbonioCE() {
|
|
26
|
+
return (0, store_1.useLoginConfigStore)((state) => state.isCarbonioCE);
|
|
27
|
+
}
|
|
28
|
+
exports.useIsCarbonioCE = useIsCarbonioCE;
|
|
29
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/store/login/hooks.ts"],"names":[],"mappings":";;;;;;AAMA,iCAAgC;AAEhC,mCAA8C;AAC9C,gFAAuD;AACvD,iEAA4D;AAE5D,SAAgB,OAAO;IACtB,MAAM,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,GAAG,IAAA,2BAAmB,GAAE,CAAC;IAEjF,MAAM,EAAE,eAAe,EAAE,GAAG,IAAA,2BAAW,GAAE,CAAC;IAE1C,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;QACnB,IAAI,eAAe,EAAE,CAAC;YACrB,OAAO,wBAAwB,IAAI,oBAAoB,IAAI,sBAAW,CAAC;QACxE,CAAC;QACD,OAAO,oBAAoB,IAAI,wBAAwB,IAAI,sBAAW,CAAC;IACxE,CAAC,EAAE,CAAC,wBAAwB,EAAE,oBAAoB,EAAE,eAAe,CAAC,CAAC,CAAC;AACvE,CAAC;AAXD,0BAWC;AAED;;GAEG;AACH,SAAgB,eAAe;IAC9B,OAAO,IAAA,2BAAmB,EAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AAC3D,CAAC;AAFD,0CAEC"}
|
|
@@ -8,5 +8,6 @@ export type LoginConfigStore = {
|
|
|
8
8
|
carbonioWebUiDarkPrimaryColor?: string;
|
|
9
9
|
carbonioWebUiLogoutURL?: string;
|
|
10
10
|
loaded: boolean;
|
|
11
|
+
isCarbonioCE: boolean | undefined;
|
|
11
12
|
};
|
|
12
13
|
export declare const useLoginConfigStore: import("zustand").UseBoundStore<import("zustand").StoreApi<LoginConfigStore>>;
|
package/lib/store/login/store.js
CHANGED
|
@@ -10,6 +10,7 @@ const zustand_1 = require("zustand");
|
|
|
10
10
|
// extra currying as suggested in https://github.com/pmndrs/zustand/blob/main/docs/guides/typescript.md#basic-usage
|
|
11
11
|
exports.useLoginConfigStore = (0, zustand_1.create)()(() => ({
|
|
12
12
|
loaded: false,
|
|
13
|
+
isCarbonioCE: undefined,
|
|
13
14
|
// setup defaults for fields which does not depend on dark mode
|
|
14
15
|
carbonioWebUiTitle: 'Carbonio Client',
|
|
15
16
|
// default to png because this icon is used also in notification, and svg are not supported there
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/store/login/store.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,qCAAiC;
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/store/login/store.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,qCAAiC;AAejC,mHAAmH;AACtG,QAAA,mBAAmB,GAAG,IAAA,gBAAM,GAAoB,CAAC,GAAG,EAAE,CAAC,CAAC;IACpE,MAAM,EAAE,KAAK;IACb,YAAY,EAAE,SAAS;IACvB,+DAA+D;IAC/D,kBAAkB,EAAE,iBAAiB;IACrC,iGAAiG;IACjG,oBAAoB,EAAE,GAAG,SAAS,aAAa;CAC/C,CAAC,CAAC,CAAC"}
|
|
@@ -84,6 +84,7 @@ export interface AccountSettingsPrefs {
|
|
|
84
84
|
* @deprecated the timezone preference is going to be removed, because now we rely on the system timezone.
|
|
85
85
|
*/
|
|
86
86
|
zimbraPrefTimeZoneId?: string;
|
|
87
|
+
carbonioPrefSendAnalytics?: BooleanString;
|
|
87
88
|
[key: string]: string | number | Array<string | number> | undefined;
|
|
88
89
|
}
|
|
89
90
|
export type AccountSettingsAttrs = {
|
package/lib/utils/utils.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
-
import type React from 'react';
|
|
3
2
|
export type ElementPosition = {
|
|
4
3
|
top: number;
|
|
5
4
|
left: number;
|
|
@@ -14,7 +13,7 @@ export declare const testFolderIsChecked: ({ string }: {
|
|
|
14
13
|
}) => boolean;
|
|
15
14
|
export declare function setGlobalCursor(cursor: CSSProperties['cursor']): void;
|
|
16
15
|
export declare function setElementSizeAndPosition(element: HTMLElement, key: keyof SizeAndPosition, value: number | undefined): void;
|
|
17
|
-
export declare function stopPropagation(event: Event | React.SyntheticEvent): void;
|
|
18
16
|
export declare function createExportForTestOnly<TObj extends Record<string, unknown>>(objToExport: TObj): {
|
|
19
17
|
[K in keyof TObj]: TObj[K] | undefined;
|
|
20
18
|
};
|
|
19
|
+
export declare const getCurrentLocationHost: () => string;
|
package/lib/utils/utils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getCurrentLocationHost = exports.createExportForTestOnly = exports.setElementSizeAndPosition = exports.setGlobalCursor = exports.testFolderIsChecked = void 0;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
|
-
const testFolderIsChecked = ({ string }) => /#/.test(string
|
|
5
|
+
const testFolderIsChecked = ({ string }) => /#/.test(string ?? '');
|
|
6
6
|
exports.testFolderIsChecked = testFolderIsChecked;
|
|
7
7
|
function setGlobalCursor(cursor) {
|
|
8
8
|
// remove previously set cursor
|
|
@@ -23,17 +23,15 @@ function setElementSizeAndPosition(element, key, value) {
|
|
|
23
23
|
element.style[key] = value !== undefined ? `${value}px` : '';
|
|
24
24
|
}
|
|
25
25
|
exports.setElementSizeAndPosition = setElementSizeAndPosition;
|
|
26
|
-
function stopPropagation(event) {
|
|
27
|
-
event.stopPropagation();
|
|
28
|
-
}
|
|
29
|
-
exports.stopPropagation = stopPropagation;
|
|
30
26
|
function createExportForTestOnly(objToExport) {
|
|
31
27
|
return process.env.NODE_ENV === 'test'
|
|
32
28
|
? objToExport
|
|
33
|
-
: (0, lodash_1.reduce)(objToExport, (accumulator,
|
|
29
|
+
: (0, lodash_1.reduce)(objToExport, (accumulator, _value, key) => {
|
|
34
30
|
accumulator[key] = undefined;
|
|
35
31
|
return accumulator;
|
|
36
32
|
}, {});
|
|
37
33
|
}
|
|
38
34
|
exports.createExportForTestOnly = createExportForTestOnly;
|
|
35
|
+
const getCurrentLocationHost = () => window.location.host;
|
|
36
|
+
exports.getCurrentLocationHost = getCurrentLocationHost;
|
|
39
37
|
//# sourceMappingURL=utils.js.map
|
package/lib/utils/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":";;;AAOA,mCAAgC;AAczB,MAAM,mBAAmB,GAAG,CAAC,EAAE,MAAM,EAAkC,EAAW,EAAE,CAC1F,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;AADX,QAAA,mBAAmB,uBACR;AAExB,SAAgB,eAAe,CAAC,MAA+B;IAC9D,+BAA+B;IAC/B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACxC,IAAI,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;IACF,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC;IAC3C,IAAI,MAAM,EAAE,CAAC;QACZ,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAiB,MAAM,EAAE,CAAC,CAAC;IACxD,CAAC;AACF,CAAC;AAZD,0CAYC;AAED,SAAgB,yBAAyB,CACxC,OAAoB,EACpB,GAA0B,EAC1B,KAAyB;IAEzB,6CAA6C;IAC7C,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9D,CAAC;AAPD,8DAOC;AAED,SAAgB,uBAAuB,CACtC,WAAiB;IAEjB,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM;QACrC,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,IAAA,eAAM,EACN,WAAW,EACX,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;YAC5B,WAAW,CAAC,GAAiB,CAAC,GAAG,SAAS,CAAC;YAC3C,OAAO,WAAW,CAAC;QACpB,CAAC,EACD,EAAmC,CACnC,CAAC;AACL,CAAC;AAbD,0DAaC;AAEM,MAAM,sBAAsB,GAAG,GAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;AAA5D,QAAA,sBAAsB,0BAAsC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zextras/carbonio-shell-ui",
|
|
3
|
-
"version": "7.0.1-devel.
|
|
3
|
+
"version": "7.0.1-devel.1721746471977",
|
|
4
4
|
"description": "The Zextras Carbonio web client",
|
|
5
5
|
"main": "./lib/lib.js",
|
|
6
6
|
"types": "./lib/lib.d.ts",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"@faker-js/faker": "^8.4.1",
|
|
60
60
|
"@microsoft/api-extractor": "^7.42.3",
|
|
61
61
|
"@svgr/webpack": "^8.1.0",
|
|
62
|
+
"@testing-library/dom": "^8.20.1",
|
|
62
63
|
"@testing-library/jest-dom": "^6.4.2",
|
|
63
64
|
"@testing-library/react": "^12.1.5",
|
|
64
65
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -105,17 +106,19 @@
|
|
|
105
106
|
},
|
|
106
107
|
"dependencies": {
|
|
107
108
|
"@fontsource/roboto": "^5.0.8",
|
|
108
|
-
"@reduxjs/toolkit": "^1
|
|
109
|
+
"@reduxjs/toolkit": "^1.9.7",
|
|
109
110
|
"@sentry/browser": "^7.103.0",
|
|
111
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
110
112
|
"@tinymce/tinymce-react": "^4.3.2",
|
|
111
113
|
"@zextras/carbonio-design-system": "^6.0.1",
|
|
112
|
-
"@zextras/carbonio-ui-preview": "^
|
|
114
|
+
"@zextras/carbonio-ui-preview": "^2.0.0",
|
|
113
115
|
"darkreader": "^4.9.79",
|
|
114
116
|
"history": "^5.3.0",
|
|
115
117
|
"i18next": "^22.5.1",
|
|
116
118
|
"i18next-http-backend": "^2.5.0",
|
|
117
119
|
"immer": "^10.0.3",
|
|
118
120
|
"lodash": "^4.17.21",
|
|
121
|
+
"posthog-js": "^1.145.1",
|
|
119
122
|
"react": "^17.0.2",
|
|
120
123
|
"react-dom": "^17.0.2",
|
|
121
124
|
"react-i18next": "^12.3.1",
|
|
@@ -129,7 +132,7 @@
|
|
|
129
132
|
"peerDependencies": {
|
|
130
133
|
"@reduxjs/toolkit": "^1 >=1.9",
|
|
131
134
|
"@zextras/carbonio-design-system": "^6.0.1",
|
|
132
|
-
"@zextras/carbonio-ui-preview": "
|
|
135
|
+
"@zextras/carbonio-ui-preview": ">= 1",
|
|
133
136
|
"core-js": "^3.31.1",
|
|
134
137
|
"lodash": "^4.17.21",
|
|
135
138
|
"react": "^17.0.2",
|
package/lib/boot/matomo.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface MatomoTracker {
|
|
2
|
-
trackPageView(customTitle?: string): void;
|
|
3
|
-
trackEvent(category: string, action: string, name?: string, value?: number): void;
|
|
4
|
-
setCustomUrl(url: string): void;
|
|
5
|
-
}
|
|
6
|
-
declare global {
|
|
7
|
-
const Matomo: {
|
|
8
|
-
getTracker(trackerUrl: string, siteId: number): MatomoTracker;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export declare function initMatomo(url: string): void;
|
|
12
|
-
export declare function getMatomoTracker(url: string, siteId: number): MatomoTracker;
|
package/lib/boot/matomo.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMatomoTracker = exports.initMatomo = void 0;
|
|
4
|
-
function initMatomo(url) {
|
|
5
|
-
const matomoScriptId = 'matomo-script';
|
|
6
|
-
if (document.getElementById(matomoScriptId)) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const matomoScript = document.createElement('script');
|
|
10
|
-
const scriptElement = document.getElementsByTagName('script')[0];
|
|
11
|
-
matomoScript.type = 'text/javascript';
|
|
12
|
-
matomoScript.async = true;
|
|
13
|
-
matomoScript.src = `${url}matomo.js`;
|
|
14
|
-
matomoScript.id = matomoScriptId;
|
|
15
|
-
scriptElement.parentNode?.insertBefore(matomoScript, scriptElement);
|
|
16
|
-
}
|
|
17
|
-
exports.initMatomo = initMatomo;
|
|
18
|
-
function getMatomoTracker(url, siteId) {
|
|
19
|
-
return Matomo.getTracker(`${url}matomo.php`, siteId);
|
|
20
|
-
}
|
|
21
|
-
exports.getMatomoTracker = getMatomoTracker;
|
|
22
|
-
//# sourceMappingURL=matomo.js.map
|
package/lib/boot/matomo.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matomo.js","sourceRoot":"","sources":["../../src/boot/matomo.ts"],"names":[],"mappings":";;;AAgBA,SAAgB,UAAU,CAAC,GAAW;IACrC,MAAM,cAAc,GAAG,eAAe,CAAC;IAEvC,IAAI,QAAQ,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,CAAC;QAC7C,OAAO;IACR,CAAC;IAED,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACtD,MAAM,aAAa,GAAG,QAAQ,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,YAAY,CAAC,IAAI,GAAG,iBAAiB,CAAC;IACtC,YAAY,CAAC,KAAK,GAAG,IAAI,CAAC;IAC1B,YAAY,CAAC,GAAG,GAAG,GAAG,GAAG,WAAW,CAAC;IACrC,YAAY,CAAC,EAAE,GAAG,cAAc,CAAC;IACjC,aAAa,CAAC,UAAU,EAAE,YAAY,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AACrE,CAAC;AAdD,gCAcC;AAED,SAAgB,gBAAgB,CAAC,GAAW,EAAE,MAAc;IAC3D,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,GAAG,YAAY,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC;AAFD,4CAEC"}
|
package/lib/boot/tracker.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare class Tracker {
|
|
2
|
-
private static readonly URL;
|
|
3
|
-
private matomoTracker;
|
|
4
|
-
private static isEnabled;
|
|
5
|
-
private readonly siteId;
|
|
6
|
-
constructor(siteId: number);
|
|
7
|
-
static enableTracker(isEnabled: boolean): void;
|
|
8
|
-
trackPageView(customTitle?: string): void;
|
|
9
|
-
trackEvent(category: string, action: string, name?: string, value?: number): void;
|
|
10
|
-
private getMatomoTrackerInstance;
|
|
11
|
-
}
|
package/lib/boot/tracker.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
4
|
-
*
|
|
5
|
-
* SPDX-License-Identifier: AGPL-3.0-only
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.Tracker = void 0;
|
|
9
|
-
const matomo_1 = require("./matomo");
|
|
10
|
-
class Tracker {
|
|
11
|
-
static URL = 'https://analytics.zextras.tools/';
|
|
12
|
-
matomoTracker;
|
|
13
|
-
static isEnabled = false;
|
|
14
|
-
siteId;
|
|
15
|
-
constructor(siteId) {
|
|
16
|
-
this.siteId = siteId;
|
|
17
|
-
if (Tracker.isEnabled) {
|
|
18
|
-
this.matomoTracker = (0, matomo_1.getMatomoTracker)(Tracker.URL, siteId);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
this.matomoTracker = null;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
static enableTracker(isEnabled) {
|
|
25
|
-
if (isEnabled) {
|
|
26
|
-
(0, matomo_1.initMatomo)(Tracker.URL);
|
|
27
|
-
}
|
|
28
|
-
Tracker.isEnabled = isEnabled;
|
|
29
|
-
}
|
|
30
|
-
trackPageView(customTitle) {
|
|
31
|
-
const tracker = this.getMatomoTrackerInstance();
|
|
32
|
-
tracker?.setCustomUrl(window.location.href);
|
|
33
|
-
tracker?.trackPageView(customTitle);
|
|
34
|
-
}
|
|
35
|
-
trackEvent(category, action, name, value) {
|
|
36
|
-
const tracker = this.getMatomoTrackerInstance();
|
|
37
|
-
tracker?.setCustomUrl(window.location.href);
|
|
38
|
-
tracker?.trackEvent(category, action, name, value);
|
|
39
|
-
}
|
|
40
|
-
getMatomoTrackerInstance() {
|
|
41
|
-
if (!Tracker.isEnabled) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
if (this.matomoTracker === null) {
|
|
45
|
-
try {
|
|
46
|
-
this.matomoTracker = (0, matomo_1.getMatomoTracker)(Tracker.URL, this.siteId);
|
|
47
|
-
}
|
|
48
|
-
catch (e) {
|
|
49
|
-
// eslint-disable-next-line no-console
|
|
50
|
-
console.warn('Matomo is not initialized yet: ', e);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return this.matomoTracker;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.Tracker = Tracker;
|
|
57
|
-
//# sourceMappingURL=tracker.js.map
|
package/lib/boot/tracker.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tracker.js","sourceRoot":"","sources":["../../src/boot/tracker.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,qCAA4E;AAE5E,MAAa,OAAO;IACX,MAAM,CAAU,GAAG,GAAG,kCAAkC,CAAC;IAEzD,aAAa,CAAuB;IAEpC,MAAM,CAAC,SAAS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