@zextras/carbonio-ui-commons 2.0.0-beta.1 → 2.0.0-beta.10
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/index.js +3710 -108
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +3560 -0
- package/lib/index.mjs.map +1 -0
- package/lib/types/index.d.ts +75 -9
- package/lib/{theme → types/theme}/theme-mui.d.ts +2 -2
- package/lib/{theme → types/theme}/theme.d.ts +1 -1
- package/lib/types/types/index.d.ts +9 -0
- package/package.json +31 -28
- package/lib/components/breadcrumbs/static-breadcrumbs.js +0 -27
- package/lib/components/breadcrumbs/static-breadcrumbs.js.map +0 -1
- package/lib/components/list/list-item.js +0 -33
- package/lib/components/list/list-item.js.map +0 -1
- package/lib/components/list/list.js +0 -18
- package/lib/components/list/list.js.map +0 -1
- package/lib/components/modals/folder-initialization-error-modal.js +0 -62
- package/lib/components/modals/folder-initialization-error-modal.js.map +0 -1
- package/lib/components/modals/modal-footer.js +0 -89
- package/lib/components/modals/modal-footer.js.map +0 -1
- package/lib/components/modals/modal-header.js +0 -24
- package/lib/components/modals/modal-header.js.map +0 -1
- package/lib/components/select/color-select.js +0 -93
- package/lib/components/select/color-select.js.map +0 -1
- package/lib/components/select/folders/flat-folder.js +0 -91
- package/lib/components/select/folders/flat-folder.js.map +0 -1
- package/lib/components/select/folders/flat-folders.js +0 -83
- package/lib/components/select/folders/flat-folders.js.map +0 -1
- package/lib/components/select/folders/flat-root.js +0 -93
- package/lib/components/select/folders/flat-root.js.map +0 -1
- package/lib/components/select/folders/folder-accordions-custom-component.js +0 -84
- package/lib/components/select/folders/folder-accordions-custom-component.js.map +0 -1
- package/lib/components/select/folders/folder-selector.js +0 -72
- package/lib/components/select/folders/folder-selector.js.map +0 -1
- package/lib/components/select/folders/folders-accordion.js +0 -86
- package/lib/components/select/folders/folders-accordion.js.map +0 -1
- package/lib/components/select/folders/hooks.js +0 -61
- package/lib/components/select/folders/hooks.js.map +0 -1
- package/lib/components/select/folders/status-icon.js +0 -35
- package/lib/components/select/folders/status-icon.js.map +0 -1
- package/lib/components/select/folders/utils.js +0 -100
- package/lib/components/select/folders/utils.js.map +0 -1
- package/lib/components/select/folders-selector.js +0 -78
- package/lib/components/select/folders-selector.js.map +0 -1
- package/lib/components/select/select-label-factory.js +0 -45
- package/lib/components/select/select-label-factory.js.map +0 -1
- package/lib/components/sidebar/sidebar-accordion-mui.js +0 -85
- package/lib/components/sidebar/sidebar-accordion-mui.js.map +0 -1
- package/lib/components/tags/delete-tag-modal.js +0 -85
- package/lib/components/tags/delete-tag-modal.js.map +0 -1
- package/lib/constants/folders.js +0 -40
- package/lib/constants/folders.js.map +0 -1
- package/lib/constants/participants.js +0 -19
- package/lib/constants/participants.js.map +0 -1
- package/lib/constants/search.js +0 -124
- package/lib/constants/search.js.map +0 -1
- package/lib/constants/utils/index.js +0 -58
- package/lib/constants/utils/index.js.map +0 -1
- package/lib/helpers/api-wrapper.js +0 -18
- package/lib/helpers/api-wrapper.js.map +0 -1
- package/lib/helpers/email-parser.js +0 -28
- package/lib/helpers/email-parser.js.map +0 -1
- package/lib/helpers/errors.js +0 -11
- package/lib/helpers/errors.js.map +0 -1
- package/lib/helpers/folders.js +0 -196
- package/lib/helpers/folders.js.map +0 -1
- package/lib/helpers/identities.js +0 -202
- package/lib/helpers/identities.js.map +0 -1
- package/lib/helpers/search.js +0 -34
- package/lib/helpers/search.js.map +0 -1
- package/lib/helpers/use-history-navigation.js +0 -25
- package/lib/helpers/use-history-navigation.js.map +0 -1
- package/lib/hooks/use-initialize-folders.js +0 -117
- package/lib/hooks/use-initialize-folders.js.map +0 -1
- package/lib/hooks/use-initialize-tags.js +0 -27
- package/lib/hooks/use-initialize-tags.js.map +0 -1
- package/lib/hooks/use-update-view.js +0 -23
- package/lib/hooks/use-update-view.js.map +0 -1
- package/lib/index.d.ts +0 -75
- package/lib/integrations/constants.js +0 -15
- package/lib/integrations/constants.js.map +0 -1
- package/lib/integrations/default-contact-input.js +0 -54
- package/lib/integrations/default-contact-input.js.map +0 -1
- package/lib/integrations/hooks.js +0 -14
- package/lib/integrations/hooks.js.map +0 -1
- package/lib/integrations/search/use-run-search.js +0 -10
- package/lib/integrations/search/use-run-search.js.map +0 -1
- package/lib/integrations/types.js +0 -8
- package/lib/integrations/types.js.map +0 -1
- package/lib/notice.template.d.ts +0 -1
- package/lib/notice.template.js +0 -8
- package/lib/notice.template.js.map +0 -1
- package/lib/soap/errors/generic-soap-api-error.js +0 -20
- package/lib/soap/errors/generic-soap-api-error.js.map +0 -1
- package/lib/soap/errors/soap-api-error.js +0 -12
- package/lib/soap/errors/soap-api-error.js.map +0 -1
- package/lib/soap/get-folder.js +0 -25
- package/lib/soap/get-folder.js.map +0 -1
- package/lib/soap/get-share-info.js +0 -22
- package/lib/soap/get-share-info.js.map +0 -1
- package/lib/soap/no-op.js +0 -24
- package/lib/soap/no-op.js.map +0 -1
- package/lib/soap/tags.js +0 -30
- package/lib/soap/tags.js.map +0 -1
- package/lib/store/zustand/folder/hooks.js +0 -180
- package/lib/store/zustand/folder/hooks.js.map +0 -1
- package/lib/store/zustand/folder/store.js +0 -34
- package/lib/store/zustand/folder/store.js.map +0 -1
- package/lib/store/zustand/folder/utils.js +0 -58
- package/lib/store/zustand/folder/utils.js.map +0 -1
- package/lib/store/zustand/tags/hooks.js +0 -20
- package/lib/store/zustand/tags/hooks.js.map +0 -1
- package/lib/store/zustand/tags/index.js +0 -24
- package/lib/store/zustand/tags/index.js.map +0 -1
- package/lib/store/zustand/tags/store.js +0 -18
- package/lib/store/zustand/tags/store.js.map +0 -1
- package/lib/theme/theme-mui.js +0 -279
- package/lib/theme/theme-mui.js.map +0 -1
- package/lib/theme/theme.js +0 -8
- package/lib/theme/theme.js.map +0 -1
- package/lib/types/actions/index.js +0 -8
- package/lib/types/actions/index.js.map +0 -1
- package/lib/types/emotion.js +0 -3
- package/lib/types/emotion.js.map +0 -1
- package/lib/types/folder/index.js +0 -3
- package/lib/types/folder/index.js.map +0 -1
- package/lib/types/i18next.js +0 -3
- package/lib/types/i18next.js.map +0 -1
- package/lib/types/identities/index.js +0 -8
- package/lib/types/identities/index.js.map +0 -1
- package/lib/types/index.js +0 -31
- package/lib/types/index.js.map +0 -1
- package/lib/types/modals/index.js +0 -8
- package/lib/types/modals/index.js.map +0 -1
- package/lib/types/select/index.js +0 -8
- package/lib/types/select/index.js.map +0 -1
- package/lib/types/sidebar/index.js +0 -8
- package/lib/types/sidebar/index.js.map +0 -1
- package/lib/types/soap/index.js +0 -3
- package/lib/types/soap/index.js.map +0 -1
- package/lib/types/tags/index.js +0 -8
- package/lib/types/tags/index.js.map +0 -1
- package/lib/types/workers/index.js +0 -3
- package/lib/types/workers/index.js.map +0 -1
- package/lib/utils/clipboard.js +0 -27
- package/lib/utils/clipboard.js.map +0 -1
- package/lib/utils/get-prefs.js +0 -15
- package/lib/utils/get-prefs.js.map +0 -1
- package/lib/utils/index.js +0 -8
- package/lib/utils/index.js.map +0 -1
- package/lib/utils/use-prefs.js +0 -15
- package/lib/utils/use-prefs.js.map +0 -1
- package/lib/utils/utils.js +0 -55
- package/lib/utils/utils.js.map +0 -1
- package/lib/worker/folder.js +0 -10
- package/lib/worker/folder.js.map +0 -1
- package/lib/worker/handle-message.js +0 -331
- package/lib/worker/handle-message.js.map +0 -1
- package/lib/worker/index.js +0 -15
- package/lib/worker/index.js.map +0 -1
- package/lib/worker/tags.js +0 -64
- package/lib/worker/tags.js.map +0 -1
- package/lib/worker/utils.js +0 -23
- package/lib/worker/utils.js.map +0 -1
- /package/lib/{components → types/components}/breadcrumbs/static-breadcrumbs.d.ts +0 -0
- /package/lib/{components → types/components}/list/list-item.d.ts +0 -0
- /package/lib/{components → types/components}/list/list.d.ts +0 -0
- /package/lib/{components → types/components}/modals/folder-initialization-error-modal.d.ts +0 -0
- /package/lib/{components → types/components}/modals/modal-footer.d.ts +0 -0
- /package/lib/{components → types/components}/modals/modal-header.d.ts +0 -0
- /package/lib/{components → types/components}/select/color-select.d.ts +0 -0
- /package/lib/{components → types/components}/select/folders/flat-folder.d.ts +0 -0
- /package/lib/{components → types/components}/select/folders/flat-folders.d.ts +0 -0
- /package/lib/{components → types/components}/select/folders/flat-root.d.ts +0 -0
- /package/lib/{components → types/components}/select/folders/folder-accordions-custom-component.d.ts +0 -0
- /package/lib/{components → types/components}/select/folders/folder-selector.d.ts +0 -0
- /package/lib/{components → types/components}/select/folders/folders-accordion.d.ts +0 -0
- /package/lib/{components → types/components}/select/folders/hooks.d.ts +0 -0
- /package/lib/{components → types/components}/select/folders/status-icon.d.ts +0 -0
- /package/lib/{components → types/components}/select/folders/utils.d.ts +0 -0
- /package/lib/{components → types/components}/select/folders-selector.d.ts +0 -0
- /package/lib/{components → types/components}/select/select-label-factory.d.ts +0 -0
- /package/lib/{components → types/components}/sidebar/sidebar-accordion-mui.d.ts +0 -0
- /package/lib/{components → types/components}/tags/delete-tag-modal.d.ts +0 -0
- /package/lib/{constants → types/constants}/folders.d.ts +0 -0
- /package/lib/{constants → types/constants}/participants.d.ts +0 -0
- /package/lib/{constants → types/constants}/search.d.ts +0 -0
- /package/lib/{constants → types/constants}/utils/index.d.ts +0 -0
- /package/lib/{helpers → types/helpers}/api-wrapper.d.ts +0 -0
- /package/lib/{helpers → types/helpers}/email-parser.d.ts +0 -0
- /package/lib/{helpers → types/helpers}/errors.d.ts +0 -0
- /package/lib/{helpers → types/helpers}/folders.d.ts +0 -0
- /package/lib/{helpers → types/helpers}/identities.d.ts +0 -0
- /package/lib/{helpers → types/helpers}/search.d.ts +0 -0
- /package/lib/{helpers → types/helpers}/use-history-navigation.d.ts +0 -0
- /package/lib/{hooks → types/hooks}/use-initialize-folders.d.ts +0 -0
- /package/lib/{hooks → types/hooks}/use-initialize-tags.d.ts +0 -0
- /package/lib/{hooks → types/hooks}/use-update-view.d.ts +0 -0
- /package/lib/{integrations → types/integrations}/constants.d.ts +0 -0
- /package/lib/{integrations → types/integrations}/default-contact-input.d.ts +0 -0
- /package/lib/{integrations → types/integrations}/hooks.d.ts +0 -0
- /package/lib/{integrations → types/integrations}/search/use-run-search.d.ts +0 -0
- /package/lib/{integrations → types/integrations}/types.d.ts +0 -0
- /package/lib/{soap → types/soap}/errors/generic-soap-api-error.d.ts +0 -0
- /package/lib/{soap → types/soap}/errors/soap-api-error.d.ts +0 -0
- /package/lib/{soap → types/soap}/get-folder.d.ts +0 -0
- /package/lib/{soap → types/soap}/get-share-info.d.ts +0 -0
- /package/lib/{soap → types/soap}/no-op.d.ts +0 -0
- /package/lib/{soap → types/soap}/tags.d.ts +0 -0
- /package/lib/{store → types/store}/zustand/folder/hooks.d.ts +0 -0
- /package/lib/{store → types/store}/zustand/folder/store.d.ts +0 -0
- /package/lib/{store → types/store}/zustand/folder/utils.d.ts +0 -0
- /package/lib/{store → types/store}/zustand/tags/hooks.d.ts +0 -0
- /package/lib/{store → types/store}/zustand/tags/index.d.ts +0 -0
- /package/lib/{store → types/store}/zustand/tags/store.d.ts +0 -0
- /package/lib/types/{actions → types/actions}/index.d.ts +0 -0
- /package/lib/types/{emotion.d.ts → types/emotion.d.ts} +0 -0
- /package/lib/types/{folder → types/folder}/index.d.ts +0 -0
- /package/lib/types/{i18next.d.ts → types/i18next.d.ts} +0 -0
- /package/lib/types/{identities → types/identities}/index.d.ts +0 -0
- /package/lib/types/{modals → types/modals}/index.d.ts +0 -0
- /package/lib/types/{select → types/select}/index.d.ts +0 -0
- /package/lib/types/{sidebar → types/sidebar}/index.d.ts +0 -0
- /package/lib/types/{soap → types/soap}/index.d.ts +0 -0
- /package/lib/types/{tags → types/tags}/index.d.ts +0 -0
- /package/lib/types/{workers → types/workers}/index.d.ts +0 -0
- /package/lib/{utils → types/utils}/clipboard.d.ts +0 -0
- /package/lib/{utils → types/utils}/get-prefs.d.ts +0 -0
- /package/lib/{utils → types/utils}/index.d.ts +0 -0
- /package/lib/{utils → types/utils}/use-prefs.d.ts +0 -0
- /package/lib/{utils → types/utils}/utils.d.ts +0 -0
- /package/lib/{worker → types/worker}/folder.d.ts +0 -0
- /package/lib/{worker → types/worker}/handle-message.d.ts +0 -0
- /package/lib/{worker → types/worker}/index.d.ts +0 -0
- /package/lib/{worker → types/worker}/tags.d.ts +0 -0
- /package/lib/{worker → types/worker}/utils.d.ts +0 -0
package/lib/index.js
CHANGED
|
@@ -1,115 +1,3717 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var carbonioDesignSystem = require('@zextras/carbonio-design-system');
|
|
5
|
+
var ExpandMoreIcon = require('@mui/icons-material/ExpandMore');
|
|
6
|
+
var material = require('@mui/material');
|
|
7
|
+
var carbonioShellUi = require('@zextras/carbonio-shell-ui');
|
|
8
|
+
var lodash = require('lodash');
|
|
9
|
+
var reactI18next = require('react-i18next');
|
|
10
|
+
var produce = require('immer');
|
|
11
|
+
var zustand = require('zustand');
|
|
12
|
+
var path = require('path');
|
|
13
|
+
var _styled = require('@emotion/styled/base');
|
|
14
|
+
var i18next = require('i18next');
|
|
15
|
+
var carbonioUiSoapLib = require('@zextras/carbonio-ui-soap-lib');
|
|
16
|
+
var reactRouterDom = require('react-router-dom');
|
|
17
|
+
|
|
18
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
19
|
+
|
|
20
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
21
|
+
var ExpandMoreIcon__default = /*#__PURE__*/_interopDefaultCompat(ExpandMoreIcon);
|
|
22
|
+
var produce__default = /*#__PURE__*/_interopDefaultCompat(produce);
|
|
23
|
+
var path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
24
|
+
var _styled__default = /*#__PURE__*/_interopDefaultCompat(_styled);
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
|
|
28
|
+
*
|
|
29
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
30
|
+
*/
|
|
31
|
+
const StaticBreadcrumbs = ({
|
|
32
|
+
crumbs,
|
|
33
|
+
size = 'large',
|
|
34
|
+
tooltipLabel
|
|
35
|
+
}) => {
|
|
36
|
+
const crumbsCount = crumbs.length;
|
|
37
|
+
const tooltip = tooltipLabel ?? crumbs.reduce((result, crumb) => `${result}/${crumb.label}`, '');
|
|
38
|
+
const firstCrumb = crumbs[0];
|
|
39
|
+
const restCrumbs = crumbs.slice(1);
|
|
40
|
+
return /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Tooltip, {
|
|
41
|
+
label: tooltip
|
|
42
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
43
|
+
mainAlignment: "flex-start",
|
|
44
|
+
wrap: "nowrap",
|
|
45
|
+
width: "fill"
|
|
46
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
47
|
+
width: "fit",
|
|
48
|
+
mainAlignment: "flex-start",
|
|
49
|
+
padding: {
|
|
50
|
+
left: 'small',
|
|
51
|
+
right: 'extrasmall'
|
|
52
|
+
}
|
|
53
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Text, {
|
|
54
|
+
size: size,
|
|
55
|
+
color: crumbsCount === 1 ? 'text' : 'secondary'
|
|
56
|
+
}, firstCrumb?.label ?? '')), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
57
|
+
mainAlignment: "flex-start",
|
|
58
|
+
maxWidth: "70%"
|
|
59
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Breadcrumbs, {
|
|
60
|
+
crumbs: restCrumbs,
|
|
61
|
+
dropdownProps: {
|
|
62
|
+
disabled: true
|
|
63
|
+
}
|
|
64
|
+
}))));
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
69
|
+
*
|
|
70
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
const theme = material.createTheme({
|
|
74
|
+
palette: {
|
|
75
|
+
currentColor: {
|
|
76
|
+
regular: 'currentColor',
|
|
77
|
+
hover: 'currentColor',
|
|
78
|
+
active: 'currentColor',
|
|
79
|
+
focus: 'currentColor',
|
|
80
|
+
disabled: 'currentColor'
|
|
81
|
+
},
|
|
82
|
+
transparent: {
|
|
83
|
+
regular: 'rgba(0, 0, 0, 0)',
|
|
84
|
+
hover: 'rgba(0, 0, 0, 0.05)',
|
|
85
|
+
active: 'rgba(0, 0, 0, 0.1)',
|
|
86
|
+
focus: 'rgba(0, 0, 0, 0.05)',
|
|
87
|
+
disabled: 'rgba(0, 0, 0, 0)'
|
|
88
|
+
},
|
|
89
|
+
primary: {
|
|
90
|
+
regular: '#2b73d2',
|
|
91
|
+
hover: '#225ca8',
|
|
92
|
+
active: '#1e5092',
|
|
93
|
+
focus: '#225ca8',
|
|
94
|
+
disabled: '#aac8ee',
|
|
95
|
+
main: '#2b73d2'
|
|
96
|
+
},
|
|
97
|
+
secondary: {
|
|
98
|
+
regular: '#828282',
|
|
99
|
+
hover: '#696969',
|
|
100
|
+
active: '#5c5c5c',
|
|
101
|
+
focus: '#696969',
|
|
102
|
+
disabled: '#cccccc',
|
|
103
|
+
main: '#828282'
|
|
104
|
+
},
|
|
105
|
+
header: {
|
|
106
|
+
regular: '#cfd5dc',
|
|
107
|
+
hover: '#b1bbc6',
|
|
108
|
+
active: '#a3aebc',
|
|
109
|
+
focus: '#b1bbc6',
|
|
110
|
+
disabled: '#cfd5dc'
|
|
111
|
+
},
|
|
112
|
+
highlight: {
|
|
113
|
+
regular: '#d5e3f6',
|
|
114
|
+
hover: '#abc7ed',
|
|
115
|
+
active: '#96b8e8',
|
|
116
|
+
focus: '#abc7ed',
|
|
117
|
+
disabled: '#d5e3f6'
|
|
118
|
+
},
|
|
119
|
+
gray0: {
|
|
120
|
+
regular: '#414141',
|
|
121
|
+
hover: '#282828',
|
|
122
|
+
active: '#1b1b1b',
|
|
123
|
+
focus: '#282828',
|
|
124
|
+
disabled: '#cccccc'
|
|
125
|
+
},
|
|
126
|
+
gray1: {
|
|
127
|
+
regular: '#828282',
|
|
128
|
+
hover: '#696969',
|
|
129
|
+
active: '#5c5c5c',
|
|
130
|
+
focus: '#696969',
|
|
131
|
+
disabled: '#cccccc'
|
|
132
|
+
},
|
|
133
|
+
gray2: {
|
|
134
|
+
regular: '#cfd5dc',
|
|
135
|
+
hover: '#b1bbc6',
|
|
136
|
+
active: '#a3aebc',
|
|
137
|
+
focus: '#b1bbc6',
|
|
138
|
+
disabled: '#cfd5dc'
|
|
139
|
+
},
|
|
140
|
+
gray3: {
|
|
141
|
+
regular: '#e6e9ed',
|
|
142
|
+
hover: '#c8cfd8',
|
|
143
|
+
active: '#bac2cd',
|
|
144
|
+
focus: '#c8cfd8',
|
|
145
|
+
disabled: '#e6e9ed'
|
|
146
|
+
},
|
|
147
|
+
gray4: {
|
|
148
|
+
regular: '#eeeff3',
|
|
149
|
+
hover: '#d0d3de',
|
|
150
|
+
active: '#c1c5d3',
|
|
151
|
+
focus: '#d0d3de',
|
|
152
|
+
disabled: '#eeeff3'
|
|
153
|
+
},
|
|
154
|
+
gray5: {
|
|
155
|
+
regular: '#f5f6f8',
|
|
156
|
+
hover: '#d7dbe3',
|
|
157
|
+
active: '#c8ced9',
|
|
158
|
+
focus: '#d7dbe3',
|
|
159
|
+
disabled: '#f5f6f8'
|
|
160
|
+
},
|
|
161
|
+
gray6: {
|
|
162
|
+
regular: '#ffffff',
|
|
163
|
+
hover: '#e6e6e6',
|
|
164
|
+
active: '#d9d9d9',
|
|
165
|
+
focus: '#e6e6e6',
|
|
166
|
+
disabled: '#ffffff'
|
|
167
|
+
},
|
|
168
|
+
warning: {
|
|
169
|
+
regular: '#ffc107',
|
|
170
|
+
hover: '#d39e00',
|
|
171
|
+
active: '#ba8b00',
|
|
172
|
+
focus: '#d39e00',
|
|
173
|
+
disabled: '#ffe699',
|
|
174
|
+
main: '#ffc107'
|
|
175
|
+
},
|
|
176
|
+
error: {
|
|
177
|
+
regular: '#d74942',
|
|
178
|
+
hover: '#be3028',
|
|
179
|
+
active: '#a92a24',
|
|
180
|
+
focus: '#be3028',
|
|
181
|
+
disabled: '#edaeab',
|
|
182
|
+
main: '#d74942'
|
|
183
|
+
},
|
|
184
|
+
success: {
|
|
185
|
+
regular: '#8bc34a',
|
|
186
|
+
hover: '#71a436',
|
|
187
|
+
active: '#639030',
|
|
188
|
+
focus: '#71a436',
|
|
189
|
+
disabled: '#cee6b2',
|
|
190
|
+
main: '#8bc34a'
|
|
191
|
+
},
|
|
192
|
+
info: {
|
|
193
|
+
regular: '#2196d3',
|
|
194
|
+
hover: '#1a75a7',
|
|
195
|
+
active: '#176691',
|
|
196
|
+
focus: '#1a75a7',
|
|
197
|
+
disabled: '#a7d7f1',
|
|
198
|
+
main: '#2196d3'
|
|
199
|
+
},
|
|
200
|
+
text: {
|
|
201
|
+
regular: '#333333',
|
|
202
|
+
hover: '#1a1a1a',
|
|
203
|
+
active: '#0d0d0d',
|
|
204
|
+
focus: '#1a1a1a',
|
|
205
|
+
disabled: '#cccccc',
|
|
206
|
+
main: '#333333'
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
avatarColors: {
|
|
210
|
+
avatar_1: '#EF9A9A',
|
|
211
|
+
avatar_2: '#F48FB1',
|
|
212
|
+
avatar_3: '#CE93D8',
|
|
213
|
+
avatar_4: '#B39DDB',
|
|
214
|
+
avatar_5: '#9FA8DA',
|
|
215
|
+
avatar_6: '#90CAF9',
|
|
216
|
+
avatar_7: '#81D4FA',
|
|
217
|
+
avatar_8: '#80DEEA',
|
|
218
|
+
avatar_9: '#80CBC4',
|
|
219
|
+
avatar_10: '#A5D6A7',
|
|
220
|
+
avatar_11: '#C5E1A5',
|
|
221
|
+
avatar_12: '#E6EE9C',
|
|
222
|
+
avatar_13: '#FFE082',
|
|
223
|
+
avatar_14: '#FFCC80',
|
|
224
|
+
avatar_15: '#FFAB91',
|
|
225
|
+
avatar_16: '#BCAAA4',
|
|
226
|
+
avatar_17: '#E57373',
|
|
227
|
+
avatar_18: '#F06292',
|
|
228
|
+
avatar_19: '#BA68C8',
|
|
229
|
+
avatar_20: '#9575CD',
|
|
230
|
+
avatar_21: '#7986CB',
|
|
231
|
+
avatar_22: '#64B5F6',
|
|
232
|
+
avatar_23: '#4FC3F7',
|
|
233
|
+
avatar_24: '#4DD0E1',
|
|
234
|
+
avatar_25: '#4DB6AC',
|
|
235
|
+
avatar_26: '#81C784',
|
|
236
|
+
avatar_27: '#AED581',
|
|
237
|
+
avatar_28: '#DCE775',
|
|
238
|
+
avatar_29: '#FFD54F',
|
|
239
|
+
avatar_30: '#FFB74D',
|
|
240
|
+
avatar_31: '#FF8A65',
|
|
241
|
+
avatar_32: '#A1887F',
|
|
242
|
+
avatar_33: '#0097A7',
|
|
243
|
+
avatar_34: '#EF5350',
|
|
244
|
+
avatar_35: '#EC407A',
|
|
245
|
+
avatar_36: '#AB47BC',
|
|
246
|
+
avatar_37: '#7E57C2',
|
|
247
|
+
avatar_38: '#5C6BC0',
|
|
248
|
+
avatar_39: '#42A5F5',
|
|
249
|
+
avatar_40: '#29B6F6',
|
|
250
|
+
avatar_41: '#26C6DA',
|
|
251
|
+
avatar_42: '#26A69A',
|
|
252
|
+
avatar_43: '#66BB6A',
|
|
253
|
+
avatar_44: '#9CCC65',
|
|
254
|
+
avatar_45: '#D4E157',
|
|
255
|
+
avatar_46: '#FFCA28',
|
|
256
|
+
avatar_47: '#FFA726',
|
|
257
|
+
avatar_48: '#FF7043',
|
|
258
|
+
avatar_49: '#8D6E63',
|
|
259
|
+
avatar_50: '#0288D1'
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
const themeMui = material.createTheme({
|
|
263
|
+
components: {
|
|
264
|
+
MuiSvgIcon: {
|
|
265
|
+
styleOverrides: {
|
|
266
|
+
root: {
|
|
267
|
+
color: theme.palette.text.regular,
|
|
268
|
+
'&:hover': {
|
|
269
|
+
background: theme.palette.gray3.hover
|
|
270
|
+
},
|
|
271
|
+
fontSize: '1.25rem',
|
|
272
|
+
fontWeight: 400
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
MuiAccordionSummary: {
|
|
277
|
+
styleOverrides: {
|
|
278
|
+
root: {
|
|
279
|
+
padding: '0 1rem 0 0',
|
|
280
|
+
margin: '0',
|
|
281
|
+
minHeight: '0',
|
|
282
|
+
justifyContent: 'left'
|
|
283
|
+
},
|
|
284
|
+
content: {
|
|
285
|
+
margin: '0',
|
|
286
|
+
maxWidth: 'calc(100% - 1.25rem)'
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
MuiAccordionDetails: {
|
|
291
|
+
styleOverrides: {
|
|
292
|
+
root: {
|
|
293
|
+
background: 'transparent',
|
|
294
|
+
padding: '0 0 0 0.5rem',
|
|
295
|
+
margin: '0'
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
MuiButtonBase: {
|
|
300
|
+
styleOverrides: {
|
|
301
|
+
root: {
|
|
302
|
+
padding: '0'
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
MuiPaper: {
|
|
307
|
+
styleOverrides: {
|
|
308
|
+
root: {
|
|
309
|
+
borderBottomLeftRadius: '0',
|
|
310
|
+
borderTopLeftRadius: '0',
|
|
311
|
+
borderBottomRightRadius: '0',
|
|
312
|
+
borderTopRightRadius: '0'
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
MuiAccordion: {
|
|
317
|
+
styleOverrides: {
|
|
318
|
+
root: {
|
|
319
|
+
':last-of-type': {
|
|
320
|
+
borderBottomLeftRadius: '0',
|
|
321
|
+
borderTopLeftRadius: '0',
|
|
322
|
+
borderBottomRightRadius: '0',
|
|
323
|
+
borderTopRightRadius: '0'
|
|
324
|
+
},
|
|
325
|
+
':first-of-type': {
|
|
326
|
+
borderBottomLeftRadius: '0',
|
|
327
|
+
borderTopLeftRadius: '0',
|
|
328
|
+
borderBottomRightRadius: '0',
|
|
329
|
+
borderTopRightRadius: '0'
|
|
330
|
+
},
|
|
331
|
+
boxShadow: 'none',
|
|
332
|
+
background: 'transparent',
|
|
333
|
+
'&.MuiAccordion-root:before': {
|
|
334
|
+
top: '0'
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
const themeMuiExtension = parentTheme => lodash.merge({}, themeMui, parentTheme);
|
|
342
|
+
|
|
343
|
+
/*
|
|
344
|
+
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
|
|
345
|
+
*
|
|
346
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
347
|
+
*/
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
*
|
|
351
|
+
* @param link
|
|
352
|
+
*/
|
|
353
|
+
const getLinkIdMapKey = link => {
|
|
354
|
+
if (!link) {
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
if (!link.rid || !link.zid) {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
return `${link.zid}:${link.rid}`;
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
/*
|
|
364
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
365
|
+
*
|
|
366
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
367
|
+
*/
|
|
368
|
+
|
|
369
|
+
const IM_LOGS = '14';
|
|
370
|
+
const USER_ROOT = '1';
|
|
371
|
+
let folders = {};
|
|
372
|
+
const searches = {};
|
|
373
|
+
const linksIdMap = {};
|
|
374
|
+
// used to check if a newly created folder is being added to the correct store
|
|
375
|
+
let view;
|
|
376
|
+
const testUtils = {
|
|
377
|
+
getFolders: () => folders,
|
|
378
|
+
resetFolders: () => {
|
|
379
|
+
folders = {};
|
|
380
|
+
},
|
|
381
|
+
setFolders: data => {
|
|
382
|
+
folders = data;
|
|
383
|
+
},
|
|
384
|
+
setCurrentView: current => {
|
|
385
|
+
view = current;
|
|
386
|
+
},
|
|
387
|
+
getCurrentView: () => view
|
|
388
|
+
};
|
|
389
|
+
const sortFoldersByName = obj => obj.sort((a, b) => {
|
|
390
|
+
const aLowerName = a.name.toLowerCase();
|
|
391
|
+
const bLowerName = b.name.toLowerCase();
|
|
392
|
+
if (aLowerName < bLowerName) {
|
|
393
|
+
return -1;
|
|
394
|
+
}
|
|
395
|
+
if (aLowerName > bLowerName) {
|
|
396
|
+
return 1;
|
|
397
|
+
}
|
|
398
|
+
return 0;
|
|
399
|
+
});
|
|
400
|
+
const updateChildren = (folder, changes) => {
|
|
401
|
+
if (changes.absFolderPath && folder.children.length) {
|
|
402
|
+
folder.children.forEach(child => {
|
|
403
|
+
const childFolder = folders[child.id];
|
|
404
|
+
if (changes.absFolderPath && childFolder.absFolderPath) {
|
|
405
|
+
const paths = childFolder.absFolderPath.split('/').slice(2);
|
|
406
|
+
childFolder.absFolderPath = `${changes.absFolderPath}/${paths.join('/')}`;
|
|
407
|
+
}
|
|
408
|
+
if (childFolder.children.length) {
|
|
409
|
+
updateChildren(childFolder, changes);
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
const testFolderIsChecked = ({
|
|
415
|
+
string
|
|
416
|
+
}) => /#/.test(string || '');
|
|
417
|
+
const omit = ({
|
|
418
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
419
|
+
link: _1,
|
|
420
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
421
|
+
folder: _2,
|
|
422
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
423
|
+
search: _3,
|
|
424
|
+
...obj
|
|
425
|
+
}) => obj;
|
|
426
|
+
const hasId$1 = (f, id) => f.id.split(':').includes(id);
|
|
427
|
+
const normalize = (f, p) => ({
|
|
428
|
+
id: f.id,
|
|
429
|
+
uuid: f.uuid,
|
|
430
|
+
name: f.name,
|
|
431
|
+
absFolderPath: f.absFolderPath,
|
|
432
|
+
l: f.l,
|
|
433
|
+
luuid: f.luuid,
|
|
434
|
+
checked: testFolderIsChecked({
|
|
435
|
+
string: f.f
|
|
436
|
+
}),
|
|
437
|
+
f: f.f,
|
|
438
|
+
// the type defined in shell is not correct refs: SHELL-118
|
|
439
|
+
// FIXME: remove the cast when the type will be fixed
|
|
440
|
+
color: f.color || p?.color,
|
|
441
|
+
rgb: f.rgb,
|
|
442
|
+
u: f.u,
|
|
443
|
+
i4u: f.i4u,
|
|
444
|
+
view: f.view,
|
|
445
|
+
rev: f.rev,
|
|
446
|
+
ms: f.ms,
|
|
447
|
+
md: f.md,
|
|
448
|
+
n: f.n,
|
|
449
|
+
i4n: f.i4n,
|
|
450
|
+
s: f.s,
|
|
451
|
+
i4ms: f.i4ms,
|
|
452
|
+
i4next: f.i4next,
|
|
453
|
+
url: f.url,
|
|
454
|
+
activesyncdisabled: !!f.activesyncdisabled,
|
|
455
|
+
webOfflineSyncDays: f.webOfflineSyncDays,
|
|
456
|
+
perm: f.perm,
|
|
457
|
+
recursive: !!f.recursive,
|
|
458
|
+
rest: f.rest,
|
|
459
|
+
deletable: !!f.deletable,
|
|
460
|
+
meta: f.meta,
|
|
461
|
+
acl: f.acl,
|
|
462
|
+
retentionPolicy: f.retentionPolicy
|
|
463
|
+
});
|
|
464
|
+
const normalizeSearch = s => ({
|
|
465
|
+
...normalize(s),
|
|
466
|
+
query: s.query,
|
|
467
|
+
sortBy: s.sortBy,
|
|
468
|
+
types: s.types
|
|
469
|
+
});
|
|
470
|
+
const normalizeLink = (l, p) => ({
|
|
471
|
+
...normalize(l, p),
|
|
472
|
+
owner: l.owner,
|
|
473
|
+
zid: l.zid,
|
|
474
|
+
rid: l.rid,
|
|
475
|
+
ruuid: l.ruuid,
|
|
476
|
+
oname: l.oname,
|
|
477
|
+
reminder: !!l.reminder,
|
|
478
|
+
broken: !!l.broken
|
|
479
|
+
});
|
|
480
|
+
const processSearch = (soapSearch, parent) => {
|
|
481
|
+
const search = {
|
|
482
|
+
...normalizeSearch(soapSearch),
|
|
483
|
+
parent: parent?.id,
|
|
484
|
+
isLink: parent?.isLink
|
|
485
|
+
};
|
|
486
|
+
searches[search.id] = search;
|
|
487
|
+
};
|
|
488
|
+
const processLink = (soapLink, depth, parent) => {
|
|
489
|
+
const link = {
|
|
490
|
+
...normalizeLink(soapLink, parent),
|
|
491
|
+
isLink: true,
|
|
492
|
+
children: [],
|
|
493
|
+
parent: parent?.id,
|
|
494
|
+
depth
|
|
495
|
+
};
|
|
496
|
+
// eslint-disable-next-line no-param-reassign
|
|
497
|
+
folders[soapLink.id] = link;
|
|
498
|
+
|
|
499
|
+
// Get the zid:rid key of the link and add it to the links id map
|
|
500
|
+
const linkIdMapKey = getLinkIdMapKey(soapLink);
|
|
501
|
+
linkIdMapKey && (linksIdMap[linkIdMapKey] = soapLink.id);
|
|
502
|
+
soapLink?.folder?.forEach(f => {
|
|
503
|
+
if (!hasId$1(f, IM_LOGS)) {
|
|
504
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
505
|
+
const child = processFolder(f, depth + 1, link);
|
|
506
|
+
link.children.push(child);
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
soapLink?.link?.forEach(l => {
|
|
510
|
+
if (!hasId$1(l, IM_LOGS)) {
|
|
511
|
+
const child = processLink(l, depth + 1, link);
|
|
512
|
+
link.children.push(child);
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
soapLink?.search?.forEach(s => {
|
|
516
|
+
processSearch(s, link);
|
|
517
|
+
});
|
|
518
|
+
return link;
|
|
519
|
+
};
|
|
520
|
+
const processFolder = (soapFolder, depth, parent) => {
|
|
521
|
+
const folder = {
|
|
522
|
+
...normalize(soapFolder, parent),
|
|
523
|
+
isLink: false,
|
|
524
|
+
children: [],
|
|
525
|
+
parent: parent?.id,
|
|
526
|
+
depth
|
|
527
|
+
};
|
|
528
|
+
folders[soapFolder.id] = folder;
|
|
529
|
+
soapFolder?.folder?.forEach(f => {
|
|
530
|
+
if (!hasId$1(f, IM_LOGS)) {
|
|
531
|
+
const child = processFolder(f, depth + 1, folder);
|
|
532
|
+
if (!hasId$1(f, USER_ROOT)) {
|
|
533
|
+
folder.children.push(child);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
soapFolder?.link?.forEach(l => {
|
|
538
|
+
if (!hasId$1(l, IM_LOGS)) {
|
|
539
|
+
const child = processLink(l, depth + 1, folder);
|
|
540
|
+
if (!hasId$1(l, USER_ROOT)) {
|
|
541
|
+
folder.children.push(child);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
soapFolder?.search?.forEach(s => {
|
|
546
|
+
processSearch(s, folder);
|
|
547
|
+
});
|
|
548
|
+
return folder;
|
|
549
|
+
};
|
|
550
|
+
const handleFolderRefresh = (soapFolders, currentView) => {
|
|
551
|
+
view = currentView;
|
|
552
|
+
if (soapFolders.length > 1) {
|
|
553
|
+
const sharedAccounts = soapFolders.slice(1);
|
|
554
|
+
return [processFolder(soapFolders[0], 0), ...sharedAccounts.map(folder => processLink(folder, 0))];
|
|
555
|
+
}
|
|
556
|
+
return processFolder(soapFolders[0], 0);
|
|
557
|
+
};
|
|
558
|
+
const handleFolderCreated = created => created.forEach(val => {
|
|
559
|
+
if (val.id && val.l && view && val.view === view) {
|
|
560
|
+
const parent = folders[val.l];
|
|
561
|
+
const folder = {
|
|
562
|
+
...normalize(val, parent),
|
|
563
|
+
isLink: false,
|
|
564
|
+
children: [],
|
|
565
|
+
parent: parent?.id,
|
|
566
|
+
depth: parent && parent.depth !== undefined ? parent.depth + 1 : 0
|
|
567
|
+
};
|
|
568
|
+
folders[val.id] = folder;
|
|
569
|
+
parent.children.push(folder);
|
|
570
|
+
sortFoldersByName(parent.children);
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
const handleLinkCreated = created => created.forEach(val => {
|
|
574
|
+
if (val.id && val.l && view && val.view === view) {
|
|
575
|
+
const parent = folders[val.l];
|
|
576
|
+
const folder = {
|
|
577
|
+
...normalizeLink(val, parent),
|
|
578
|
+
isLink: true,
|
|
579
|
+
children: [],
|
|
580
|
+
parent: parent?.id,
|
|
581
|
+
depth: parent && parent.depth !== undefined ? parent.depth + 1 : 0
|
|
582
|
+
};
|
|
583
|
+
folders[val.id] = folder;
|
|
584
|
+
parent.children.push(folder);
|
|
585
|
+
sortFoldersByName(parent.children);
|
|
586
|
+
}
|
|
587
|
+
});
|
|
588
|
+
function getKeyByValue(map, searchValue) {
|
|
589
|
+
return Object.keys(map).find(key => searchValue.id === `${map[key].zid}:${map[key].rid}`);
|
|
590
|
+
}
|
|
591
|
+
function folderIsSharedWithMe(folderId) {
|
|
592
|
+
if (!folderId) return false;
|
|
593
|
+
const folder = folders[folderId];
|
|
594
|
+
if (folder?.parent) {
|
|
595
|
+
return folderIsSharedWithMe(folder?.parent);
|
|
596
|
+
}
|
|
597
|
+
return folder?.name === 'USER_ROOT';
|
|
598
|
+
}
|
|
599
|
+
const handleFolderModified = modified =>
|
|
600
|
+
// the type defined in shell is not correct refs: SHELL-118
|
|
601
|
+
// FIXME: remove the ts-ignore when the type will be fixed
|
|
602
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
603
|
+
// @ts-ignore
|
|
604
|
+
modified.forEach(val => {
|
|
605
|
+
if (!val.id) return;
|
|
606
|
+
const mountPointId = val.id.includes(':') ? getKeyByValue(folders, val) : val.id;
|
|
607
|
+
const parentMountPointId = getKeyByValue(folders, {
|
|
608
|
+
id: val.l
|
|
609
|
+
});
|
|
610
|
+
const isSharedWithMe = folderIsSharedWithMe(mountPointId);
|
|
611
|
+
const parentIsSharedWithMe = folderIsSharedWithMe(parentMountPointId);
|
|
612
|
+
const parentFolderId = parentIsSharedWithMe && parentMountPointId ? parentMountPointId : val.l;
|
|
613
|
+
const folderId = isSharedWithMe && mountPointId ? mountPointId : val.id;
|
|
614
|
+
const folder = folderId ? folders[folderId] : null;
|
|
615
|
+
if (folder) {
|
|
616
|
+
Object.assign(folder, omit({
|
|
617
|
+
...val,
|
|
618
|
+
id: folderId
|
|
619
|
+
}));
|
|
620
|
+
updateChildren(folder, val);
|
|
621
|
+
if (typeof val.f !== 'undefined') {
|
|
622
|
+
folder.checked = testFolderIsChecked({
|
|
623
|
+
string: val.f
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
const oldParentId = folder.parent;
|
|
627
|
+
if (oldParentId) {
|
|
628
|
+
const oldParent = folders[oldParentId];
|
|
629
|
+
if (oldParent) {
|
|
630
|
+
if (!val.l) {
|
|
631
|
+
oldParent.children = oldParent.children.map(f => f.id !== val.id ? f : folder);
|
|
632
|
+
} else {
|
|
633
|
+
const newParent = parentFolderId ? folders[parentFolderId] : null;
|
|
634
|
+
if (newParent) {
|
|
635
|
+
oldParent.children = oldParent.children.filter(f => f.id !== folderId);
|
|
636
|
+
newParent.children.push(folder);
|
|
637
|
+
sortFoldersByName(newParent.children);
|
|
638
|
+
folder.parent = newParent.id;
|
|
639
|
+
folder.depth = newParent?.depth !== undefined ? newParent.depth + 1 : 0;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
folders[folderId] = folder;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
const handleFolderDeleted = deleted => deleted.forEach(val => {
|
|
648
|
+
const folder = folders[val];
|
|
649
|
+
if (folder) {
|
|
650
|
+
if (folder.parent) {
|
|
651
|
+
const parent = folders[folder.parent];
|
|
652
|
+
parent.children = parent.children.filter(obj => obj.id !== val);
|
|
653
|
+
}
|
|
654
|
+
delete folders[val];
|
|
655
|
+
delete searches[val];
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
const handleFolderNotify = notify => {
|
|
659
|
+
handleFolderCreated(notify.created?.folder ?? []);
|
|
660
|
+
handleLinkCreated(notify.created?.link ?? []);
|
|
661
|
+
// the type defined in shell is not correct refs: SHELL-118
|
|
662
|
+
// FIXME: remove the ts-ignore when the type will be fixed
|
|
663
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
664
|
+
// @ts-ignore
|
|
665
|
+
handleFolderModified([...(notify.modified?.folder ?? []), ...(notify.modified?.link ?? [])]);
|
|
666
|
+
handleFolderDeleted(notify.deleted ?? []);
|
|
667
|
+
};
|
|
668
|
+
const handleFoldersMessages = ({
|
|
669
|
+
data
|
|
670
|
+
}) => {
|
|
671
|
+
if (data.op === 'refresh' && data.folder) {
|
|
672
|
+
handleFolderRefresh(data.folder, data.currentView);
|
|
673
|
+
}
|
|
674
|
+
if (data.op === 'notify') {
|
|
675
|
+
handleFolderNotify(data.notify);
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
const handleMessage = ({
|
|
679
|
+
data
|
|
680
|
+
}) => {
|
|
681
|
+
handleFoldersMessages({
|
|
682
|
+
data
|
|
683
|
+
});
|
|
684
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
685
|
+
// @ts-ignore
|
|
686
|
+
postMessage({
|
|
687
|
+
folders,
|
|
688
|
+
linksIdMap,
|
|
689
|
+
searches
|
|
690
|
+
});
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
/*
|
|
694
|
+
* SPDX-FileCopyrightText: 2021 Zextras <https://www.zextras.com>
|
|
695
|
+
*
|
|
696
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
697
|
+
*/
|
|
698
|
+
|
|
699
|
+
const SidebarAccordionMui = ({
|
|
700
|
+
accordions,
|
|
701
|
+
folderId,
|
|
702
|
+
localStorageName,
|
|
703
|
+
AccordionCustomComponent,
|
|
704
|
+
setSelectedFolder,
|
|
705
|
+
buttonFindShares,
|
|
706
|
+
initialExpanded
|
|
707
|
+
}) => {
|
|
708
|
+
const [openIds, setOpenIds] = carbonioShellUi.useLocalStorage(localStorageName, initialExpanded ?? []);
|
|
709
|
+
const sidebarRef = React.useRef(null);
|
|
710
|
+
const onClick = React.useCallback(({
|
|
711
|
+
accordion,
|
|
712
|
+
expanded
|
|
713
|
+
}) => {
|
|
714
|
+
if (expanded) {
|
|
715
|
+
setOpenIds(state => state.includes(accordion.id) ? state : [...state, accordion.id]);
|
|
716
|
+
} else {
|
|
717
|
+
setOpenIds(state => state.filter(id => id !== accordion.id));
|
|
718
|
+
}
|
|
719
|
+
}, [setOpenIds]);
|
|
720
|
+
return /*#__PURE__*/React__default.default.createElement(material.Container, {
|
|
721
|
+
ref: sidebarRef,
|
|
722
|
+
disableGutters: true
|
|
723
|
+
}, accordions.map(accordion => accordion.id === 'find_shares' ? buttonFindShares : /*#__PURE__*/React__default.default.createElement(material.Accordion, {
|
|
724
|
+
disableGutters: true,
|
|
725
|
+
slotProps: {
|
|
726
|
+
transition: {
|
|
727
|
+
unmountOnExit: true
|
|
728
|
+
}
|
|
729
|
+
},
|
|
730
|
+
expanded: openIds.includes(accordion.id),
|
|
731
|
+
key: accordion.id
|
|
732
|
+
}, /*#__PURE__*/React__default.default.createElement(material.AccordionSummary, {
|
|
733
|
+
onClick: () => {
|
|
734
|
+
setSelectedFolder?.(accordion.id);
|
|
735
|
+
},
|
|
736
|
+
expandIcon: accordion?.children?.length > 0 && !hasId$1(accordion, 'all') && /*#__PURE__*/React__default.default.createElement("button", {
|
|
737
|
+
style: {
|
|
738
|
+
all: 'unset',
|
|
739
|
+
cursor: 'pointer'
|
|
740
|
+
},
|
|
741
|
+
onClick: e => {
|
|
742
|
+
e.preventDefault();
|
|
743
|
+
onClick({
|
|
744
|
+
accordion,
|
|
745
|
+
expanded: !openIds.includes(accordion.id)
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
}, /*#__PURE__*/React__default.default.createElement(ExpandMoreIcon__default.default, {
|
|
749
|
+
color: "primary"
|
|
750
|
+
})),
|
|
751
|
+
"aria-controls": "panel1a-content",
|
|
752
|
+
id: accordion.id,
|
|
753
|
+
sx: {
|
|
754
|
+
backgroundColor: accordion.id === folderId ? theme.palette.highlight.hover : theme.palette.gray5.regular,
|
|
755
|
+
'&:hover': {
|
|
756
|
+
backgroundColor: accordion.id === folderId ? theme.palette.highlight.active : theme.palette.gray5.hover
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
}, /*#__PURE__*/React__default.default.createElement(AccordionCustomComponent, {
|
|
760
|
+
item: accordion
|
|
761
|
+
})), accordion?.children?.length > 0 && /*#__PURE__*/React__default.default.createElement(material.AccordionDetails, null, /*#__PURE__*/React__default.default.createElement(SidebarAccordionMui, {
|
|
762
|
+
accordions: accordion.children,
|
|
763
|
+
folderId: folderId,
|
|
764
|
+
key: accordion.id,
|
|
765
|
+
localStorageName: localStorageName,
|
|
766
|
+
AccordionCustomComponent: AccordionCustomComponent,
|
|
767
|
+
setSelectedFolder: setSelectedFolder,
|
|
768
|
+
buttonFindShares: buttonFindShares,
|
|
769
|
+
initialExpanded: initialExpanded
|
|
770
|
+
})))));
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
function _extends() {
|
|
774
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
775
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
776
|
+
var t = arguments[e];
|
|
777
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
778
|
+
}
|
|
779
|
+
return n;
|
|
780
|
+
}, _extends.apply(null, arguments);
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
const ModalFooter = ({
|
|
784
|
+
mainAlignment = 'center',
|
|
785
|
+
crossAlignment = 'center',
|
|
786
|
+
onConfirm,
|
|
787
|
+
label,
|
|
788
|
+
secondaryAction,
|
|
789
|
+
secondaryLabel,
|
|
790
|
+
primaryBtnType = 'default',
|
|
791
|
+
secondaryBtnType = 'default',
|
|
792
|
+
disabled,
|
|
793
|
+
secondaryDisabled,
|
|
794
|
+
background = 'primary',
|
|
795
|
+
secondarybackground,
|
|
796
|
+
color = 'primary',
|
|
797
|
+
secondaryColor = 'secondary',
|
|
798
|
+
size = 'medium',
|
|
799
|
+
showDivider = true,
|
|
800
|
+
tooltip,
|
|
801
|
+
secondaryTooltip,
|
|
802
|
+
paddingTop = 'medium',
|
|
803
|
+
additionalAction,
|
|
804
|
+
additionalBtnType = 'outlined',
|
|
805
|
+
additionalColor = 'secondary',
|
|
806
|
+
additionalLabel,
|
|
807
|
+
primaryButtonIcon
|
|
808
|
+
}) => {
|
|
809
|
+
const [t] = reactI18next.useTranslation();
|
|
810
|
+
const cancelLabel = React.useMemo(() => t('label.cancel', 'cancel'), [t]);
|
|
811
|
+
const secondaryTypeAndColor = React.useMemo(() => {
|
|
812
|
+
if (secondaryBtnType === 'ghost') {
|
|
813
|
+
return {
|
|
814
|
+
type: secondaryBtnType,
|
|
815
|
+
color: secondaryColor
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
if (secondaryBtnType === 'default') {
|
|
819
|
+
return {
|
|
820
|
+
type: secondaryBtnType,
|
|
821
|
+
backgroundColor: secondaryColor || secondarybackground
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
return {
|
|
825
|
+
type: secondaryBtnType,
|
|
826
|
+
backgroundColor: secondarybackground,
|
|
827
|
+
labelColor: secondaryColor
|
|
828
|
+
};
|
|
829
|
+
}, [secondaryBtnType, secondaryColor, secondarybackground]);
|
|
830
|
+
const primaryTypeAndColor = React.useMemo(() => {
|
|
831
|
+
if (primaryBtnType === 'ghost') {
|
|
832
|
+
return {
|
|
833
|
+
type: primaryBtnType,
|
|
834
|
+
color
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
if (primaryBtnType === 'default') {
|
|
838
|
+
return {
|
|
839
|
+
type: primaryBtnType,
|
|
840
|
+
backgroundColor: color || background
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
return {
|
|
844
|
+
type: primaryBtnType,
|
|
845
|
+
backgroundColor: background,
|
|
846
|
+
labelColor: color
|
|
847
|
+
};
|
|
848
|
+
}, [background, color, primaryBtnType]);
|
|
849
|
+
return /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
850
|
+
mainAlignment: mainAlignment,
|
|
851
|
+
crossAlignment: crossAlignment,
|
|
852
|
+
padding: {
|
|
853
|
+
top: paddingTop
|
|
854
|
+
}
|
|
855
|
+
}, showDivider && /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
856
|
+
padding: {
|
|
857
|
+
top: 'small',
|
|
858
|
+
bottom: 'small'
|
|
859
|
+
},
|
|
860
|
+
mainAlignment: "center",
|
|
861
|
+
crossAlignment: "flex-start",
|
|
862
|
+
orientation: "horizontal",
|
|
863
|
+
height: "fit"
|
|
864
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Divider, null)), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
865
|
+
orientation: "horizontal",
|
|
866
|
+
mainAlignment: "space-between"
|
|
867
|
+
}, additionalAction && /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
868
|
+
orientation: "horizontal",
|
|
869
|
+
width: "fit"
|
|
870
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Button, {
|
|
871
|
+
color: additionalColor,
|
|
872
|
+
type: additionalBtnType,
|
|
873
|
+
onClick: additionalAction,
|
|
874
|
+
label: additionalLabel ?? cancelLabel,
|
|
875
|
+
size: size
|
|
876
|
+
}), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
877
|
+
horizontal: "extrasmall"
|
|
878
|
+
})), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
879
|
+
padding: {
|
|
880
|
+
top: 'small',
|
|
881
|
+
bottom: 'small'
|
|
882
|
+
},
|
|
883
|
+
mainAlignment: "flex-end",
|
|
884
|
+
crossAlignment: "flex-start",
|
|
885
|
+
orientation: "horizontal",
|
|
886
|
+
height: "fit"
|
|
887
|
+
}, secondaryAction && /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
888
|
+
right: "small",
|
|
889
|
+
vertical: "small"
|
|
890
|
+
}, secondaryTooltip ? /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Tooltip, {
|
|
891
|
+
label: secondaryTooltip,
|
|
892
|
+
placement: "top",
|
|
893
|
+
maxWidth: "fit"
|
|
894
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Button, _extends({}, secondaryTypeAndColor, {
|
|
895
|
+
onClick: secondaryAction,
|
|
896
|
+
label: secondaryLabel ?? cancelLabel,
|
|
897
|
+
disabled: secondaryDisabled,
|
|
898
|
+
size: size
|
|
899
|
+
}))) : /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Button, _extends({}, secondaryTypeAndColor, {
|
|
900
|
+
onClick: secondaryAction,
|
|
901
|
+
label: secondaryLabel ?? cancelLabel,
|
|
902
|
+
disabled: secondaryDisabled,
|
|
903
|
+
size: size
|
|
904
|
+
}))), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
905
|
+
vertical: "small"
|
|
906
|
+
}, tooltip ? /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Tooltip, {
|
|
907
|
+
label: tooltip,
|
|
908
|
+
placement: "top",
|
|
909
|
+
maxWidth: "fit"
|
|
910
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Button, _extends({
|
|
911
|
+
size: size,
|
|
912
|
+
onClick: onConfirm,
|
|
913
|
+
label: label,
|
|
914
|
+
disabled: disabled,
|
|
915
|
+
icon: primaryButtonIcon,
|
|
916
|
+
iconPlacement: "left"
|
|
917
|
+
}, primaryTypeAndColor))) : /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Button, _extends({
|
|
918
|
+
size: size,
|
|
919
|
+
onClick: onConfirm,
|
|
920
|
+
label: label,
|
|
921
|
+
disabled: disabled,
|
|
922
|
+
icon: primaryButtonIcon,
|
|
923
|
+
iconPlacement: "left"
|
|
924
|
+
}, primaryTypeAndColor))))));
|
|
925
|
+
};
|
|
926
|
+
|
|
927
|
+
/*
|
|
928
|
+
* SPDX-FileCopyrightText: 2021 Zextras <https://www.zextras.com>
|
|
929
|
+
*
|
|
930
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
931
|
+
*/
|
|
932
|
+
const ModalHeader = ({
|
|
933
|
+
title,
|
|
934
|
+
onClose,
|
|
935
|
+
showCloseIcon = true
|
|
936
|
+
}) => /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
937
|
+
mainAlignment: "space-between",
|
|
938
|
+
width: "100%"
|
|
939
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
940
|
+
takeAvailableSpace: true,
|
|
941
|
+
mainAlignment: "space-between",
|
|
942
|
+
width: "100%"
|
|
943
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
944
|
+
width: "calc(100% - 1.5rem)",
|
|
945
|
+
takeAvailableSpace: true,
|
|
946
|
+
mainAlignment: "flex-start"
|
|
947
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Text, {
|
|
948
|
+
weight: "bold",
|
|
949
|
+
size: "large"
|
|
950
|
+
}, title)), onClose && showCloseIcon && /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
951
|
+
mainAlignment: "flex-start"
|
|
952
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.IconButton, {
|
|
953
|
+
size: "medium",
|
|
954
|
+
style: {
|
|
955
|
+
padding: 0,
|
|
956
|
+
margin: 0
|
|
957
|
+
},
|
|
958
|
+
onClick: onClose,
|
|
959
|
+
icon: "CloseOutline"
|
|
960
|
+
}))), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
961
|
+
top: "medium"
|
|
962
|
+
}), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Divider, null), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
963
|
+
bottom: "medium"
|
|
964
|
+
}));
|
|
965
|
+
|
|
966
|
+
/*
|
|
967
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
968
|
+
*
|
|
969
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
970
|
+
*/
|
|
971
|
+
|
|
972
|
+
const FolderInitializationErrorModal = ({
|
|
973
|
+
onClose
|
|
974
|
+
}) => {
|
|
975
|
+
const [t] = reactI18next.useTranslation();
|
|
976
|
+
const title = t('modal.initializeError.title', 'Oops!…Something went wrong');
|
|
977
|
+
const body = t('modal.initializeError.content', 'Please reload the page or try again later');
|
|
978
|
+
const onConfirmLabel = t('modal.initializeError.buttonConfirm', 'Reload');
|
|
979
|
+
const onConfirm = React.useCallback(() => {
|
|
980
|
+
window.location.reload();
|
|
981
|
+
}, []);
|
|
982
|
+
return /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, /*#__PURE__*/React__default.default.createElement(ModalHeader, {
|
|
983
|
+
onClose: onClose,
|
|
984
|
+
title: title
|
|
985
|
+
}), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, null, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Text, null, body)), /*#__PURE__*/React__default.default.createElement(ModalFooter, {
|
|
986
|
+
onConfirm: onConfirm,
|
|
987
|
+
label: onConfirmLabel,
|
|
988
|
+
disabled: false
|
|
989
|
+
}));
|
|
990
|
+
};
|
|
991
|
+
|
|
992
|
+
/*
|
|
993
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
994
|
+
*
|
|
995
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
996
|
+
*/
|
|
997
|
+
|
|
998
|
+
// eslint-disable-next-line no-shadow
|
|
999
|
+
const FolderActionsType = {
|
|
1000
|
+
NEW: 'new',
|
|
1001
|
+
MOVE: 'move',
|
|
1002
|
+
DELETE: 'delete',
|
|
1003
|
+
EDIT: 'edit',
|
|
1004
|
+
EMPTY: 'empty',
|
|
1005
|
+
REMOVE_FROM_LIST: 'removeFromList',
|
|
1006
|
+
SHARES_INFO: 'sharesInfo',
|
|
1007
|
+
SHARE: 'share',
|
|
1008
|
+
MARK_ALL_READ: 'read'
|
|
1009
|
+
};
|
|
1010
|
+
const FOLDERS = {
|
|
1011
|
+
USER_ROOT: '1',
|
|
1012
|
+
INBOX: '2',
|
|
1013
|
+
TRASH: '3',
|
|
1014
|
+
SPAM: '4',
|
|
1015
|
+
SENT: '5',
|
|
1016
|
+
DRAFTS: '6',
|
|
1017
|
+
CONTACTS: '7',
|
|
1018
|
+
TAGS: '8',
|
|
1019
|
+
CONVERSATIONS: '9',
|
|
1020
|
+
CALENDAR: '10',
|
|
1021
|
+
ROOT: '11',
|
|
1022
|
+
NOTEBOOK: '12',
|
|
1023
|
+
// no longer created in new mailboxes since Helix (bug 39647). old mailboxes may still contain a system folder with id 12
|
|
1024
|
+
AUTO_CONTACTS: '13',
|
|
1025
|
+
IM_LOGS: '14',
|
|
1026
|
+
TASKS: '15',
|
|
1027
|
+
BRIEFCASE: '16',
|
|
1028
|
+
LAST_SYSTEM_FOLDER_POSITION: '16.1'
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
/*
|
|
1032
|
+
* SPDX-FileCopyrightText: 2021 Zextras <https://www.zextras.com>
|
|
1033
|
+
*
|
|
1034
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
1035
|
+
*/
|
|
1036
|
+
|
|
1037
|
+
const FoldersAccordion = ({
|
|
1038
|
+
folders,
|
|
1039
|
+
onFolderSelected,
|
|
1040
|
+
FolderAccordionCustomComponent,
|
|
1041
|
+
selectedFolderId,
|
|
1042
|
+
disabledFolderIds,
|
|
1043
|
+
filterChildren
|
|
1044
|
+
}) => {
|
|
1045
|
+
const filteredFolders = folders.map(root => ({
|
|
1046
|
+
...root,
|
|
1047
|
+
children: lodash.filter(root.children, filterChildren)
|
|
1048
|
+
}));
|
|
1049
|
+
const [openIds, setOpenIds] = React.useState([FOLDERS.USER_ROOT]);
|
|
1050
|
+
const handleExpandFolderClick = (folderId, callback) => callback(state => state.includes(folderId) ? state.filter(id => id !== folderId) : [...state, folderId]);
|
|
1051
|
+
return /*#__PURE__*/React__default.default.createElement(material.Container, {
|
|
1052
|
+
disableGutters: true,
|
|
1053
|
+
"data-testid": 'accordion-folders-selector'
|
|
1054
|
+
}, filteredFolders.map(folder => /*#__PURE__*/React__default.default.createElement(material.Accordion, {
|
|
1055
|
+
disableGutters: true,
|
|
1056
|
+
slotProps: {
|
|
1057
|
+
transition: {
|
|
1058
|
+
unmountOnExit: true
|
|
1059
|
+
}
|
|
1060
|
+
},
|
|
1061
|
+
expanded: openIds.includes(folder.id),
|
|
1062
|
+
key: folder.id
|
|
1063
|
+
}, /*#__PURE__*/React__default.default.createElement(material.AccordionSummary, {
|
|
1064
|
+
"data-testid": `folder-accordion-item-${folder.id}`,
|
|
1065
|
+
onClick: e => {
|
|
1066
|
+
if (disabledFolderIds?.includes(folder.id)) {
|
|
1067
|
+
e.preventDefault();
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
onFolderSelected?.(folder);
|
|
1071
|
+
},
|
|
1072
|
+
expandIcon: folder?.children?.length > 0 && !hasId$1(folder, 'all') && /*#__PURE__*/React__default.default.createElement(ExpandMoreIcon__default.default, {
|
|
1073
|
+
color: "primary",
|
|
1074
|
+
onClick: e => {
|
|
1075
|
+
e.preventDefault();
|
|
1076
|
+
handleExpandFolderClick(folder.id, setOpenIds);
|
|
1077
|
+
}
|
|
1078
|
+
}),
|
|
1079
|
+
"aria-controls": "panel1a-content",
|
|
1080
|
+
id: folder.id,
|
|
1081
|
+
sx: {
|
|
1082
|
+
margin: 0,
|
|
1083
|
+
backgroundColor: folder.id === selectedFolderId ? theme.palette.highlight.hover : theme.palette.gray6.regular,
|
|
1084
|
+
'&:hover': {
|
|
1085
|
+
backgroundColor: folder.id === selectedFolderId ? theme.palette.highlight.active : theme.palette.gray6.hover
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
}, /*#__PURE__*/React__default.default.createElement(FolderAccordionCustomComponent, {
|
|
1089
|
+
folder: folder
|
|
1090
|
+
})), folder?.children?.length > 0 && /*#__PURE__*/React__default.default.createElement(material.AccordionDetails, null, /*#__PURE__*/React__default.default.createElement(FoldersAccordion, {
|
|
1091
|
+
folders: folder.children,
|
|
1092
|
+
selectedFolderId: selectedFolderId,
|
|
1093
|
+
key: folder.id,
|
|
1094
|
+
disabledFolderIds: disabledFolderIds,
|
|
1095
|
+
FolderAccordionCustomComponent: FolderAccordionCustomComponent,
|
|
1096
|
+
onFolderSelected: onFolderSelected,
|
|
1097
|
+
filterChildren: filterChildren
|
|
1098
|
+
})))));
|
|
1099
|
+
};
|
|
1100
|
+
|
|
1101
|
+
/*
|
|
1102
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
1103
|
+
*
|
|
1104
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
1105
|
+
*/
|
|
1106
|
+
|
|
1107
|
+
const FOLDER_VIEW = {
|
|
1108
|
+
search_folder: 'search folder',
|
|
1109
|
+
tag: 'tag',
|
|
1110
|
+
conversation: 'conversation',
|
|
1111
|
+
message: 'message',
|
|
1112
|
+
contact: 'contact',
|
|
1113
|
+
document: 'document',
|
|
1114
|
+
appointment: 'appointment',
|
|
1115
|
+
virtual_conversation: 'virtual conversation',
|
|
1116
|
+
remote_folder: 'remote folder',
|
|
1117
|
+
wiki: 'wiki',
|
|
1118
|
+
task: 'task',
|
|
1119
|
+
chat: 'chat'
|
|
1120
|
+
};
|
|
1121
|
+
// eslint-disable-next-line no-shadow
|
|
1122
|
+
let TagsActionsType = /*#__PURE__*/function (TagsActionsType) {
|
|
1123
|
+
TagsActionsType["NEW"] = "new";
|
|
1124
|
+
TagsActionsType["DELETE"] = "delete";
|
|
1125
|
+
TagsActionsType["EDIT"] = "edit";
|
|
1126
|
+
TagsActionsType["Apply"] = "apply";
|
|
1127
|
+
return TagsActionsType;
|
|
1128
|
+
}({});
|
|
1129
|
+
const DRAG_DATA_TYPE = {
|
|
1130
|
+
MESSAGE: 'message',
|
|
1131
|
+
CONVERSATION: 'conversation',
|
|
1132
|
+
FOLDER: 'folder',
|
|
1133
|
+
CONTACT: 'contact'
|
|
1134
|
+
};
|
|
1135
|
+
const ZIMBRA_STANDARD_COLORS = [{
|
|
1136
|
+
zValue: 0,
|
|
1137
|
+
hex: '#000000',
|
|
1138
|
+
zLabel: 'black'
|
|
1139
|
+
}, {
|
|
1140
|
+
zValue: 1,
|
|
1141
|
+
hex: '#2b73d2',
|
|
1142
|
+
zLabel: 'blue'
|
|
1143
|
+
}, {
|
|
1144
|
+
zValue: 2,
|
|
1145
|
+
hex: '#29B6F6',
|
|
1146
|
+
zLabel: 'cyan'
|
|
1147
|
+
}, {
|
|
1148
|
+
zValue: 3,
|
|
1149
|
+
hex: '#66BB6A',
|
|
1150
|
+
zLabel: 'green'
|
|
1151
|
+
}, {
|
|
1152
|
+
zValue: 4,
|
|
1153
|
+
hex: '#7e57c2',
|
|
1154
|
+
zLabel: 'purple'
|
|
1155
|
+
}, {
|
|
1156
|
+
zValue: 5,
|
|
1157
|
+
hex: '#ef5350',
|
|
1158
|
+
zLabel: 'red'
|
|
1159
|
+
}, {
|
|
1160
|
+
zValue: 6,
|
|
1161
|
+
hex: '#ffc107',
|
|
1162
|
+
zLabel: 'yellow'
|
|
1163
|
+
}, {
|
|
1164
|
+
zValue: 7,
|
|
1165
|
+
hex: '#edaeab',
|
|
1166
|
+
zLabel: 'pink'
|
|
1167
|
+
}, {
|
|
1168
|
+
zValue: 8,
|
|
1169
|
+
hex: '#828282',
|
|
1170
|
+
zLabel: 'gray'
|
|
1171
|
+
}, {
|
|
1172
|
+
zValue: 9,
|
|
1173
|
+
hex: '#FF7043',
|
|
1174
|
+
zLabel: 'orange'
|
|
1175
|
+
}];
|
|
1176
|
+
let JSNS = /*#__PURE__*/function (JSNS) {
|
|
1177
|
+
JSNS["ACCOUNT"] = "urn:zimbraAccount";
|
|
1178
|
+
JSNS["ADMIN"] = "urn:zimbraAdmin";
|
|
1179
|
+
JSNS["MAIL"] = "urn:zimbraMail";
|
|
1180
|
+
JSNS["ALL"] = "urn:zimbra";
|
|
1181
|
+
JSNS["SYNC"] = "urn:zimbraSync";
|
|
1182
|
+
return JSNS;
|
|
1183
|
+
}({});
|
|
1184
|
+
const ROOT_NAME = 'USER_ROOT';
|
|
1185
|
+
|
|
1186
|
+
/*
|
|
1187
|
+
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
|
|
1188
|
+
*
|
|
1189
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
1190
|
+
*/
|
|
1191
|
+
const folderWorker = new Worker(path__default.default.dirname('./folder.ts'));
|
|
1192
|
+
const tagsWorker = new Worker(path__default.default.dirname('./tags.ts'));
|
|
1193
|
+
|
|
1194
|
+
/*
|
|
1195
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
1196
|
+
*
|
|
1197
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
1198
|
+
*/
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
// extra currying as suggested in https://github.com/pmndrs/zustand/blob/main/docs/guides/typescript.md#basic-usage
|
|
1202
|
+
const useFolderStore = zustand.create()(set => ({
|
|
1203
|
+
folders: {},
|
|
1204
|
+
linksIdMap: {},
|
|
1205
|
+
searches: {},
|
|
1206
|
+
updateFolder: (id, opt) => {
|
|
1207
|
+
set(produce__default.default(state => {
|
|
1208
|
+
if (state?.folders?.[id]) {
|
|
1209
|
+
state.folders[id] = {
|
|
1210
|
+
...state.folders[id],
|
|
1211
|
+
...opt
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
}));
|
|
1215
|
+
}
|
|
1216
|
+
}));
|
|
1217
|
+
folderWorker.onmessage = ({
|
|
1218
|
+
data
|
|
1219
|
+
}) => {
|
|
1220
|
+
useFolderStore.setState(data);
|
|
1221
|
+
};
|
|
1222
|
+
|
|
1223
|
+
/*
|
|
1224
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
1225
|
+
*
|
|
1226
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
1227
|
+
*/
|
|
1228
|
+
const NO_ACCOUNT_NAME$1 = 'No account';
|
|
1229
|
+
|
|
1230
|
+
/*
|
|
1231
|
+
* Describe the folder id syntax
|
|
1232
|
+
*
|
|
1233
|
+
* [<zid>:]<folderId>
|
|
1234
|
+
*
|
|
1235
|
+
* e.g. a79fa996-e90e-4f04-97c4-c84209bb8277:2
|
|
1236
|
+
*/
|
|
1237
|
+
const FOLDERID_REGEX = /^([^:]+(?=:))*:?(\d+)$/;
|
|
1238
|
+
/**
|
|
1239
|
+
* Parse the given folder id and returns on object with the composing parts of the folder id
|
|
1240
|
+
* @param folderId
|
|
1241
|
+
*/
|
|
1242
|
+
const getFolderIdParts = folderId => {
|
|
1243
|
+
const result = {
|
|
1244
|
+
zid: null,
|
|
1245
|
+
id: null
|
|
1246
|
+
};
|
|
1247
|
+
if (!folderId || !folderId.match(FOLDERID_REGEX)) {
|
|
1248
|
+
return result;
|
|
1249
|
+
}
|
|
1250
|
+
const parts = FOLDERID_REGEX.exec(folderId);
|
|
1251
|
+
if (!parts) {
|
|
1252
|
+
return result;
|
|
1253
|
+
}
|
|
1254
|
+
[, result.zid = null, result.id = null] = parts;
|
|
1255
|
+
return result;
|
|
1256
|
+
};
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* Get the account name of the owner of the given folder, if the owner is an
|
|
1260
|
+
* "other" account, different from the primary account of the current user.
|
|
1261
|
+
* If the owner is the primary account then <code>null</code> is returned
|
|
1262
|
+
* @param folderId
|
|
1263
|
+
* @param folderRoots
|
|
1264
|
+
*/
|
|
1265
|
+
const getFolderOtherOwnerAccountName = (folderId, folderRoots) => {
|
|
1266
|
+
if (!folderId) {
|
|
1267
|
+
return null;
|
|
1268
|
+
}
|
|
1269
|
+
const {
|
|
1270
|
+
zid
|
|
1271
|
+
} = getFolderIdParts(folderId);
|
|
1272
|
+
if (!zid) {
|
|
1273
|
+
return null;
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
/** find the folderRoots for which the id corresponds to the message zid
|
|
1277
|
+
* if the folderRoots has an owner, return the owner
|
|
1278
|
+
* if not, return null
|
|
1279
|
+
* */
|
|
1280
|
+
|
|
1281
|
+
const matchingFolderRoot = lodash.find(folderRoots, c => c.id.includes(zid));
|
|
1282
|
+
if (!matchingFolderRoot) {
|
|
1283
|
+
return null;
|
|
1284
|
+
}
|
|
1285
|
+
return 'owner' in matchingFolderRoot && matchingFolderRoot.owner ? matchingFolderRoot.owner : null;
|
|
1286
|
+
};
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* Returns the account name of the owner of the folder, based on the folder id
|
|
1290
|
+
* @param folderId
|
|
1291
|
+
* @param folderRoots
|
|
1292
|
+
*/
|
|
1293
|
+
const getFolderOwnerAccountName = (folderId, folderRoots) => {
|
|
1294
|
+
const primaryAccount = carbonioShellUi.getUserAccount();
|
|
1295
|
+
|
|
1296
|
+
/*
|
|
1297
|
+
* Try to get the account of the "other" owner, aka an owner which
|
|
1298
|
+
* is not the primary account of the current user
|
|
1299
|
+
*/
|
|
1300
|
+
const otherOwnerAccount = getFolderOtherOwnerAccountName(folderId, folderRoots);
|
|
1301
|
+
if (!otherOwnerAccount) {
|
|
1302
|
+
return primaryAccount?.name ?? NO_ACCOUNT_NAME$1;
|
|
1303
|
+
}
|
|
1304
|
+
return otherOwnerAccount;
|
|
1305
|
+
};
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* Tells if a folder with the given id is a spam folder
|
|
1309
|
+
* @param folderId
|
|
1310
|
+
* @param folderType
|
|
1311
|
+
*/
|
|
1312
|
+
const isA = (folderId, folderType) => {
|
|
1313
|
+
if (!folderId) {
|
|
1314
|
+
return false;
|
|
1315
|
+
}
|
|
1316
|
+
return getFolderIdParts(folderId).id === folderType;
|
|
1317
|
+
};
|
|
1318
|
+
|
|
1319
|
+
/**
|
|
1320
|
+
* Tells if a folder with the given id is the default account root folder
|
|
1321
|
+
* @param folderId
|
|
1322
|
+
*/
|
|
1323
|
+
const isDefaultAccountRoot = folderId => folderId === FOLDERS.USER_ROOT;
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
* Tells if a folder with the given id is a root folder
|
|
1327
|
+
* @param folderId
|
|
1328
|
+
*/
|
|
1329
|
+
const isRoot = folderId => isA(folderId, FOLDERS.USER_ROOT);
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* Tells if the given folder is a link to a folder shared by another user
|
|
1333
|
+
* @param folder
|
|
1334
|
+
*/
|
|
1335
|
+
const isLink = folder => (folder && folder.isLink && getFolderIdParts(folder.id).zid === null) ?? false;
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* Tells if a folder is a folder of a shared account
|
|
1339
|
+
* @param folderId
|
|
1340
|
+
*/
|
|
1341
|
+
function isSharedAccountFolder(folderId) {
|
|
1342
|
+
return getFolderIdParts(folderId).zid !== null;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
/**
|
|
1346
|
+
* Tells if a folder is a system one
|
|
1347
|
+
* @param folderId
|
|
1348
|
+
*/
|
|
1349
|
+
const isSystemFolder = folderId => {
|
|
1350
|
+
const {
|
|
1351
|
+
id
|
|
1352
|
+
} = getFolderIdParts(folderId);
|
|
1353
|
+
if (!id) {
|
|
1354
|
+
return false;
|
|
1355
|
+
}
|
|
1356
|
+
const systemFoldersIds = Object.values(FOLDERS);
|
|
1357
|
+
return systemFoldersIds.includes(folderId);
|
|
1358
|
+
};
|
|
1359
|
+
|
|
1360
|
+
/**
|
|
1361
|
+
* Tells if a folder is a trashed folder
|
|
1362
|
+
* @param folder
|
|
1363
|
+
* @param folderId
|
|
1364
|
+
*/
|
|
1365
|
+
const isTrashed = ({
|
|
1366
|
+
folder,
|
|
1367
|
+
folderId
|
|
1368
|
+
}) => {
|
|
1369
|
+
if (!folder && !folderId) {
|
|
1370
|
+
return false;
|
|
1371
|
+
}
|
|
1372
|
+
const folderIdAbsPath = useFolderStore.getState()?.folders?.[folderId ?? '']?.absFolderPath;
|
|
1373
|
+
const path = folder ? folder.absFolderPath : folderIdAbsPath;
|
|
1374
|
+
if (!path) {
|
|
1375
|
+
return false;
|
|
1376
|
+
}
|
|
1377
|
+
return path.toLowerCase().startsWith('/trash');
|
|
1378
|
+
};
|
|
1379
|
+
|
|
1380
|
+
/**
|
|
1381
|
+
* Tells if a folder with the given id is a trash folder
|
|
1382
|
+
* @param folderId
|
|
1383
|
+
*/
|
|
1384
|
+
const isTrash$1 = folderId => isA(folderId, FOLDERS.TRASH);
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* Tells if the current user has read permission on the given folder/link
|
|
1388
|
+
* @param folder
|
|
1389
|
+
*/
|
|
1390
|
+
const isReadAllowed = folder => !folder.perm || folder.perm.includes('r');
|
|
1391
|
+
|
|
1392
|
+
/**
|
|
1393
|
+
* Tells if the current user has write permission on the given folder/link
|
|
1394
|
+
* @param folder
|
|
1395
|
+
*/
|
|
1396
|
+
const isWriteAllowed = folder => !folder.perm || folder.perm.includes('w');
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Tells if the current user has insertion permission on the given folder/link
|
|
1400
|
+
* @param folder
|
|
1401
|
+
*/
|
|
1402
|
+
const isInsertAllowed = folder => !folder.perm || folder.perm.includes('i');
|
|
1403
|
+
|
|
1404
|
+
/**
|
|
1405
|
+
* Tells if the current user has subfolder creation permission on the given folder/link
|
|
1406
|
+
* @param folder
|
|
1407
|
+
*/
|
|
1408
|
+
const isCreateAllowed = folder => !folder.perm || folder.perm.includes('c');
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* Tells if the current user has deletion permission on the given folder/link
|
|
1412
|
+
* @param folder
|
|
1413
|
+
*/
|
|
1414
|
+
const isDeleteAllowed = folder => !folder.perm || folder.perm.includes('d');
|
|
1415
|
+
|
|
1416
|
+
/**
|
|
1417
|
+
* Tells if the current user has administration permission on the given folder/link
|
|
1418
|
+
* @param folder
|
|
1419
|
+
*/
|
|
1420
|
+
const isAdministerAllowed = folder => !folder.perm || folder.perm.includes('a');
|
|
1421
|
+
|
|
1422
|
+
/*
|
|
1423
|
+
* SPDX-FileCopyrightText: 2025 Zextras <https://www.zextras.com>
|
|
1424
|
+
*
|
|
1425
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
1426
|
+
*/
|
|
1427
|
+
|
|
1428
|
+
function flattenAndFilterFoldersWithCap(folders, search, limit, filterFolders) {
|
|
1429
|
+
if (limit <= 0) return [];
|
|
1430
|
+
const lowerCaseSearch = search.toLowerCase();
|
|
1431
|
+
const flattenAndFilter = foldersToProcess => lodash.filter(foldersToProcess, filterFolders).flatMap(folder => {
|
|
1432
|
+
const isMatch = folder.name.toLowerCase().includes(lowerCaseSearch);
|
|
1433
|
+
const matched = isMatch ? [{
|
|
1434
|
+
...folder,
|
|
1435
|
+
children: []
|
|
1436
|
+
}] : [];
|
|
1437
|
+
return [...matched, ...flattenAndFilter(folder.children)];
|
|
1438
|
+
});
|
|
1439
|
+
return flattenAndFilter(folders).slice(0, limit);
|
|
1440
|
+
}
|
|
1441
|
+
const getFolderIconColor = f => {
|
|
1442
|
+
if ('color' in f && f?.color) {
|
|
1443
|
+
return Number(f.color) < 10 ? ZIMBRA_STANDARD_COLORS[Number(f.color)].hex : f?.rgb ?? ZIMBRA_STANDARD_COLORS[0].hex;
|
|
1444
|
+
}
|
|
1445
|
+
return ZIMBRA_STANDARD_COLORS[0].hex;
|
|
1446
|
+
};
|
|
1447
|
+
const getFolderDefaultIcon = folder => {
|
|
1448
|
+
const folderView = 'view' in folder && folder.view;
|
|
1449
|
+
switch (folderView) {
|
|
1450
|
+
case FOLDER_VIEW.appointment:
|
|
1451
|
+
return 'Calendar2';
|
|
1452
|
+
default:
|
|
1453
|
+
return 'FolderOutline';
|
|
1454
|
+
}
|
|
1455
|
+
};
|
|
1456
|
+
const getFolderIconName = folder => {
|
|
1457
|
+
const {
|
|
1458
|
+
id
|
|
1459
|
+
} = getFolderIdParts(folder.id);
|
|
1460
|
+
if (id === FOLDERS.USER_ROOT || 'isLink' in folder && folder.isLink && folder.oname === ROOT_NAME) {
|
|
1461
|
+
return null;
|
|
1462
|
+
}
|
|
1463
|
+
const folderDefaultIcon = getFolderDefaultIcon(folder);
|
|
1464
|
+
if (id && isSystemFolder(id)) {
|
|
1465
|
+
switch (id) {
|
|
1466
|
+
case FOLDERS.INBOX:
|
|
1467
|
+
return 'InboxOutline';
|
|
1468
|
+
case FOLDERS.DRAFTS:
|
|
1469
|
+
return 'FileOutline';
|
|
1470
|
+
case FOLDERS.SENT:
|
|
1471
|
+
return 'PaperPlaneOutline';
|
|
1472
|
+
case FOLDERS.SPAM:
|
|
1473
|
+
return 'SlashOutline';
|
|
1474
|
+
case FOLDERS.TRASH:
|
|
1475
|
+
return 'Trash2Outline';
|
|
1476
|
+
default:
|
|
1477
|
+
return folderDefaultIcon;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
return folderDefaultIcon;
|
|
1481
|
+
};
|
|
1482
|
+
const getSystemFolderTranslatedName = ({
|
|
1483
|
+
folderName
|
|
1484
|
+
}) => {
|
|
1485
|
+
if (folderName) {
|
|
1486
|
+
switch (folderName) {
|
|
1487
|
+
case 'Inbox':
|
|
1488
|
+
return carbonioShellUi.t('folders.inbox', 'Inbox');
|
|
1489
|
+
case 'Sent':
|
|
1490
|
+
return carbonioShellUi.t('folders.sent', 'Sent');
|
|
1491
|
+
case 'Drafts':
|
|
1492
|
+
return carbonioShellUi.t('folders.drafts', 'Drafts');
|
|
1493
|
+
case 'Trash':
|
|
1494
|
+
return carbonioShellUi.t('folders.trash', 'Trash');
|
|
1495
|
+
case 'Spam':
|
|
1496
|
+
return carbonioShellUi.t('folders.spam', 'Spam');
|
|
1497
|
+
case 'Junk':
|
|
1498
|
+
return carbonioShellUi.t('folders.junk', 'Junk');
|
|
1499
|
+
default:
|
|
1500
|
+
return folderName;
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
return folderName;
|
|
1504
|
+
};
|
|
1505
|
+
const getFolderTranslatedName = ({
|
|
1506
|
+
folderId,
|
|
1507
|
+
folderName
|
|
1508
|
+
}) => {
|
|
1509
|
+
const {
|
|
1510
|
+
id
|
|
1511
|
+
} = getFolderIdParts(folderId ?? '');
|
|
1512
|
+
if (id && isSystemFolder(id)) {
|
|
1513
|
+
return getSystemFolderTranslatedName({
|
|
1514
|
+
folderName
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
return folderName;
|
|
1518
|
+
};
|
|
1519
|
+
|
|
1520
|
+
/**
|
|
1521
|
+
* Process the absolute path of the given folder, removing
|
|
1522
|
+
* the leading slash
|
|
1523
|
+
*
|
|
1524
|
+
* @param folder
|
|
1525
|
+
* @return the array of the crumbs name of the path
|
|
1526
|
+
*/
|
|
1527
|
+
const getFolderAbsPathParts = folder => {
|
|
1528
|
+
if (!folder) {
|
|
1529
|
+
return [];
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
// Exception for root folders
|
|
1533
|
+
if (isRoot(folder?.id)) {
|
|
1534
|
+
return [folder.name ?? ''];
|
|
1535
|
+
}
|
|
1536
|
+
const reg = /^\/?(.*)$/gm;
|
|
1537
|
+
const matches = reg.exec(folder.absFolderPath ?? '');
|
|
1538
|
+
if (!matches) {
|
|
1539
|
+
return [];
|
|
1540
|
+
}
|
|
1541
|
+
return matches[1].split('/');
|
|
1542
|
+
};
|
|
1543
|
+
const FlatFolder = ({
|
|
1544
|
+
folder,
|
|
1545
|
+
onFolderSelected,
|
|
1546
|
+
...rest
|
|
1547
|
+
}) => {
|
|
1548
|
+
const iconName = getFolderIconName(folder);
|
|
1549
|
+
const iconColor = getFolderIconColor(folder);
|
|
1550
|
+
const parts = getFolderAbsPathParts(folder);
|
|
1551
|
+
|
|
1552
|
+
/*
|
|
1553
|
+
* Create the crumbs array and try to get the translations
|
|
1554
|
+
* for the first part which usually represent a system folder
|
|
1555
|
+
* for which a translated name is available
|
|
1556
|
+
*/
|
|
1557
|
+
const crumbs = parts.map((part, index) => ({
|
|
1558
|
+
id: `${index} `,
|
|
1559
|
+
label: index === 0 ? getSystemFolderTranslatedName({
|
|
1560
|
+
folderName: part
|
|
1561
|
+
}) : part
|
|
1562
|
+
}));
|
|
1563
|
+
const selectionHandler = React.useCallback(() => onFolderSelected?.(folder) ?? lodash.noop, [onFolderSelected, folder]);
|
|
1564
|
+
return /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, _extends({
|
|
1565
|
+
width: "fill",
|
|
1566
|
+
"main-alignment": "flex-start",
|
|
1567
|
+
orientation: "vertical",
|
|
1568
|
+
crossAlignment: "flex-start",
|
|
1569
|
+
padding: {
|
|
1570
|
+
top: 'small',
|
|
1571
|
+
right: 'small',
|
|
1572
|
+
bottom: 'small',
|
|
1573
|
+
left: 'extralarge'
|
|
1574
|
+
},
|
|
1575
|
+
height: '2.6rem',
|
|
1576
|
+
onClick: selectionHandler,
|
|
1577
|
+
wrap: "nowrap"
|
|
1578
|
+
}, rest), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
1579
|
+
mainAlignment: "flex-start",
|
|
1580
|
+
wrap: "nowrap",
|
|
1581
|
+
width: "fill"
|
|
1582
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
1583
|
+
width: "fit"
|
|
1584
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Icon, {
|
|
1585
|
+
color: iconColor,
|
|
1586
|
+
icon: iconName ?? 'FolderOutline',
|
|
1587
|
+
size: "large"
|
|
1588
|
+
})), /*#__PURE__*/React__default.default.createElement(StaticBreadcrumbs, {
|
|
1589
|
+
crumbs: crumbs,
|
|
1590
|
+
size: "large"
|
|
1591
|
+
})));
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
const FOLDER_ROW_HEIGHT = '2.6rem';
|
|
1595
|
+
const CustomContainer = /*#__PURE__*/_styled__default.default(carbonioDesignSystem.Container, process.env.NODE_ENV === "production" ? {
|
|
1596
|
+
target: "ejcyqrf0"
|
|
1597
|
+
} : {
|
|
1598
|
+
target: "ejcyqrf0",
|
|
1599
|
+
label: "CustomContainer"
|
|
1600
|
+
})("&:hover{background-color:", ({
|
|
1601
|
+
theme,
|
|
1602
|
+
$active
|
|
1603
|
+
}) => $active ? theme.palette.highlight.active : theme.palette.gray6.hover, ";}" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZsYXQtcm9vdC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBcUNnRSIsImZpbGUiOiJmbGF0LXJvb3QudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIFNQRFgtRmlsZUNvcHlyaWdodFRleHQ6IDIwMjUgWmV4dHJhcyA8aHR0cHM6Ly93d3cuemV4dHJhcy5jb20+XG4gKlxuICogU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEFHUEwtMy4wLW9ubHlcbiAqL1xuXG5pbXBvcnQgUmVhY3QsIHsgdXNlU3RhdGUsIHVzZUNhbGxiYWNrLCBSZWFjdEVsZW1lbnQgfSBmcm9tICdyZWFjdCc7XG5cbmltcG9ydCB7XG5cdFRleHQsXG5cdENvbnRhaW5lcixcblx0UGFkZGluZyxcblx0QXZhdGFyLFxuXHRUb29sdGlwLFxuXH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dDwvTGlzdD5cblx0XHRcdDwvQ29sbGFwc2U+XG5cdFx0PC9Sb3c+XG5cdCk7XG59O1xuIl19 */"));
|
|
1604
|
+
const FlatRoot = ({
|
|
1605
|
+
folder,
|
|
1606
|
+
childrenFolders,
|
|
1607
|
+
isOpen = false,
|
|
1608
|
+
onFolderSelected,
|
|
1609
|
+
onOpenStatusChange,
|
|
1610
|
+
selectedFolderId,
|
|
1611
|
+
allowRootSelection
|
|
1612
|
+
}) => {
|
|
1613
|
+
const [open, setOpen] = React.useState(isOpen);
|
|
1614
|
+
const account = carbonioShellUi.useUserAccount();
|
|
1615
|
+
const rootLabel = folder.id === FOLDERS.USER_ROOT ? account.name : folder.name;
|
|
1616
|
+
const toggleOpen = React.useCallback(e => {
|
|
1617
|
+
e.stopPropagation();
|
|
1618
|
+
setOpen(op => {
|
|
1619
|
+
onOpenStatusChange && onOpenStatusChange(!op);
|
|
1620
|
+
return !op;
|
|
1621
|
+
});
|
|
1622
|
+
}, [onOpenStatusChange]);
|
|
1623
|
+
const onClick = React.useCallback(e => {
|
|
1624
|
+
e.stopPropagation();
|
|
1625
|
+
if (!open) {
|
|
1626
|
+
setOpen(true);
|
|
1627
|
+
}
|
|
1628
|
+
if (!allowRootSelection) {
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1631
|
+
onFolderSelected?.(folder);
|
|
1632
|
+
}, [open, allowRootSelection, onFolderSelected, folder]);
|
|
1633
|
+
return /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
1634
|
+
width: "fill",
|
|
1635
|
+
style: {
|
|
1636
|
+
cursor: 'pointer'
|
|
1637
|
+
}
|
|
1638
|
+
}, /*#__PURE__*/React__default.default.createElement(CustomContainer, {
|
|
1639
|
+
orientation: "horizontal",
|
|
1640
|
+
width: "fill",
|
|
1641
|
+
height: "fit",
|
|
1642
|
+
mainAlignment: "space-between",
|
|
1643
|
+
padding: 'small',
|
|
1644
|
+
onClick: onClick,
|
|
1645
|
+
"data-testid": `folder-flat-root-${folder.id}`,
|
|
1646
|
+
background: selectedFolderId === folder.id ? 'highlight.active' : 'gray6',
|
|
1647
|
+
$active: selectedFolderId === folder.id
|
|
1648
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
1649
|
+
orientation: "horizontal",
|
|
1650
|
+
width: "fill",
|
|
1651
|
+
mainAlignment: "flex-start"
|
|
1652
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
1653
|
+
horizontal: "small"
|
|
1654
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Avatar, {
|
|
1655
|
+
label: rootLabel,
|
|
1656
|
+
size: "medium"
|
|
1657
|
+
})), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Tooltip, {
|
|
1658
|
+
label: rootLabel,
|
|
1659
|
+
placement: "right",
|
|
1660
|
+
maxWidth: "100%"
|
|
1661
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Text, null, rootLabel))), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
1662
|
+
right: "small"
|
|
1663
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.IconButton, {
|
|
1664
|
+
customSize: {
|
|
1665
|
+
iconSize: 'large',
|
|
1666
|
+
paddingSize: 0
|
|
1667
|
+
},
|
|
1668
|
+
onClick: toggleOpen,
|
|
1669
|
+
icon: open ? 'ChevronUp' : 'ChevronDown'
|
|
1670
|
+
}))), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Collapse, {
|
|
1671
|
+
crossSize: "100%",
|
|
1672
|
+
orientation: "vertical",
|
|
1673
|
+
open: open,
|
|
1674
|
+
disableTransition: false
|
|
1675
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.List, null, childrenFolders.map(childFolder => /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.ListItem, {
|
|
1676
|
+
key: childFolder.id,
|
|
1677
|
+
selected: selectedFolderId === childFolder.id,
|
|
1678
|
+
active: selectedFolderId === childFolder.id,
|
|
1679
|
+
background: 'gray6',
|
|
1680
|
+
activeBackground: 'highlight',
|
|
1681
|
+
selectedBackground: 'gray5'
|
|
1682
|
+
}, visible => visible ? /*#__PURE__*/React__default.default.createElement(FlatFolder, {
|
|
1683
|
+
"data-testid": `folder-flat-item-${childFolder.id}`,
|
|
1684
|
+
folder: childFolder,
|
|
1685
|
+
onFolderSelected: onFolderSelected
|
|
1686
|
+
}) : /*#__PURE__*/React__default.default.createElement("div", {
|
|
1687
|
+
style: {
|
|
1688
|
+
height: `${FOLDER_ROW_HEIGHT}`
|
|
1689
|
+
}
|
|
1690
|
+
}))))));
|
|
1691
|
+
};
|
|
1692
|
+
|
|
1693
|
+
/*
|
|
1694
|
+
* SPDX-FileCopyrightText: 2025 Zextras <https://www.zextras.com>
|
|
1695
|
+
*
|
|
1696
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
1697
|
+
*/
|
|
1698
|
+
|
|
1699
|
+
const FlatFolders = ({
|
|
1700
|
+
rootFolders,
|
|
1701
|
+
searchString,
|
|
1702
|
+
onFolderSelected,
|
|
1703
|
+
selectedFolderId,
|
|
1704
|
+
allowRootSelection,
|
|
1705
|
+
filterChildren
|
|
1706
|
+
}) => {
|
|
1707
|
+
const [hasMoreResults, setHasMoreResults] = React__default.default.useState(false);
|
|
1708
|
+
const [t] = reactI18next.useTranslation();
|
|
1709
|
+
const flatFilteredFolders = React.useMemo(() => {
|
|
1710
|
+
let remaining = 100;
|
|
1711
|
+
return rootFolders.map(rootFolder => {
|
|
1712
|
+
if (remaining <= 0) {
|
|
1713
|
+
return {
|
|
1714
|
+
...rootFolder,
|
|
1715
|
+
children: []
|
|
1716
|
+
};
|
|
1717
|
+
}
|
|
1718
|
+
const currentFolder = {
|
|
1719
|
+
...rootFolder,
|
|
1720
|
+
name: getSystemFolderTranslatedName({
|
|
1721
|
+
folderName: rootFolder.name
|
|
1722
|
+
}),
|
|
1723
|
+
children: []
|
|
1724
|
+
};
|
|
1725
|
+
const children = flattenAndFilterFoldersWithCap(rootFolder.children, searchString, remaining, filterChildren);
|
|
1726
|
+
remaining -= children.length;
|
|
1727
|
+
if (remaining <= 0) {
|
|
1728
|
+
setHasMoreResults(true);
|
|
1729
|
+
} else {
|
|
1730
|
+
setHasMoreResults(false);
|
|
1731
|
+
}
|
|
1732
|
+
return {
|
|
1733
|
+
...currentFolder,
|
|
1734
|
+
children
|
|
1735
|
+
};
|
|
1736
|
+
}).filter(folder => folder !== null);
|
|
1737
|
+
}, [filterChildren, rootFolders, searchString]);
|
|
1738
|
+
const hasMoreResultsWarningLabel = t('modal.messageFilteringList', 'Only the first 100 results are displayed. Narrow your search criteria to view the complete list.');
|
|
1739
|
+
return /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, hasMoreResults && /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
1740
|
+
top: "small",
|
|
1741
|
+
bottom: "large"
|
|
1742
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
1743
|
+
wrap: "nowrap",
|
|
1744
|
+
takeAvailableSpace: true,
|
|
1745
|
+
width: "fill"
|
|
1746
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Text, {
|
|
1747
|
+
"data-testid": 'has-more-results',
|
|
1748
|
+
textAlign: "left",
|
|
1749
|
+
size: "small"
|
|
1750
|
+
}, hasMoreResultsWarningLabel))), !hasMoreResults && /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
1751
|
+
vertical: "medium"
|
|
1752
|
+
}), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
1753
|
+
"data-testid": 'flat-folders-selector',
|
|
1754
|
+
orientation: 'vertical',
|
|
1755
|
+
style: {
|
|
1756
|
+
overflowY: 'auto'
|
|
1757
|
+
}
|
|
1758
|
+
}, flatFilteredFolders.map(folder => /*#__PURE__*/React__default.default.createElement(FlatRoot, {
|
|
1759
|
+
key: folder.id,
|
|
1760
|
+
folder: folder,
|
|
1761
|
+
childrenFolders: folder.children,
|
|
1762
|
+
isOpen: true,
|
|
1763
|
+
onFolderSelected: onFolderSelected,
|
|
1764
|
+
selectedFolderId: selectedFolderId,
|
|
1765
|
+
allowRootSelection: allowRootSelection
|
|
1766
|
+
}))));
|
|
1767
|
+
};
|
|
1768
|
+
|
|
1769
|
+
/*
|
|
1770
|
+
* SPDX-FileCopyrightText: 2025 Zextras <https://www.zextras.com>
|
|
1771
|
+
*
|
|
1772
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
1773
|
+
*/
|
|
1774
|
+
|
|
1775
|
+
const RowWithIcon = (icon, color, tooltipText) => /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
1776
|
+
left: "small"
|
|
1777
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Tooltip, {
|
|
1778
|
+
placement: "right",
|
|
1779
|
+
label: tooltipText
|
|
1780
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, null, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Icon, {
|
|
1781
|
+
icon: icon,
|
|
1782
|
+
color: color,
|
|
1783
|
+
size: "medium"
|
|
1784
|
+
}))));
|
|
1785
|
+
const StatusIcon = ({
|
|
1786
|
+
folder
|
|
1787
|
+
}) => {
|
|
1788
|
+
if (folder.acl?.grant) {
|
|
1789
|
+
const tooltipText = i18next.t('tooltip.folder_sharing_status', {
|
|
1790
|
+
count: folder.acl.grant.length,
|
|
1791
|
+
defaultValue_one: 'Shared with {{count}} person',
|
|
1792
|
+
defaultValue: 'Shared with {{count}} people'
|
|
1793
|
+
});
|
|
1794
|
+
return RowWithIcon('Shared', 'shared', tooltipText);
|
|
1795
|
+
}
|
|
1796
|
+
if (folder.isLink) {
|
|
1797
|
+
const tooltipText = i18next.t('tooltip.folder_linked_status', 'Linked to me');
|
|
1798
|
+
return RowWithIcon('Linked', 'linked', tooltipText);
|
|
1799
|
+
}
|
|
1800
|
+
return /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null);
|
|
1801
|
+
};
|
|
1802
|
+
|
|
1803
|
+
const FittedRow = /*#__PURE__*/_styled__default.default(carbonioDesignSystem.Row, process.env.NODE_ENV === "production" ? {
|
|
1804
|
+
target: "e1asttf60"
|
|
1805
|
+
} : {
|
|
1806
|
+
target: "e1asttf60",
|
|
1807
|
+
label: "FittedRow"
|
|
1808
|
+
})("max-width:calc(100% - (2 * ", ({
|
|
1809
|
+
theme
|
|
1810
|
+
}) => theme.sizes.padding.small, "));height:3rem;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZvbGRlci1hY2NvcmRpb25zLWN1c3RvbS1jb21wb25lbnQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWlCNkIiLCJmaWxlIjoiZm9sZGVyLWFjY29yZGlvbnMtY3VzdG9tLWNvbXBvbmVudC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogU1BEWC1GaWxlQ29weXJpZ2h0VGV4dDogMjAyNSBaZXh0cmFzIDxodHRwczovL3d3dy56ZXh0cmFzLmNvbT5cbiAqXG4gKiBTUERYLUxpY2Vuc2UtSWRlbnRpZmllcjogQUdQTC0zLjAtb25seVxuICovXG5pbXBvcnQgUmVhY3QsIHsgdXNlTWVtbyB9IGZyb20gJ3JlYWN0JztcblxuaW1wb3J0IHsgQWNjb3JkaW9uSXRlbSwgQXZhdGFyLCBQYWRkaW5nLCBSb3csIFRvb2x0aXAgfSBmcm9tICdAemV4dHJhcy9jYXJib25pby1kZXNpZ24tc3lzdGVtJztcbmltcG9ydCB7IHVzZVVzZXJBY2NvdW50IH0gZnJvbSAnQHpleHRyYXMvY2FyYm9uaW8tc2hlbGwtdWknO1xuaW1wb3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cdDwvUGFkZGluZz5cblx0XHRcdCl9XG5cdFx0XHQ8VG9vbHRpcCBsYWJlbD17YWNjb3JkaW9uSXRlbS5sYWJlbH0gcGxhY2VtZW50PVwicmlnaHRcIiBtYXhXaWR0aD1cIjEwMCVcIj5cblx0XHRcdFx0PEFjY29yZGlvbkl0ZW0gZGF0YS10ZXN0aWQ9e2BhY2NvcmRpb24tZm9sZGVyLWl0ZW0tJHtmb2xkZXIuaWR9YH0gaXRlbT17YWNjb3JkaW9uSXRlbX0+XG5cdFx0XHRcdFx0PFN0YXR1c0ljb24gZm9sZGVyPXtmb2xkZXJ9IC8+XG5cdFx0XHRcdDwvQWNjb3JkaW9uSXRlbT5cblx0XHRcdDwvVG9vbHRpcD5cblx0XHQ8L0ZpdHRlZFJvdz5cblx0KTtcbn07XG4iXX0= */"));
|
|
1811
|
+
const FolderAccordionCustomComponent = ({
|
|
1812
|
+
folder
|
|
1813
|
+
}) => {
|
|
1814
|
+
const accountName = carbonioShellUi.useUserAccount().name;
|
|
1815
|
+
const textProps = React.useMemo(() => ({
|
|
1816
|
+
size: 'small'
|
|
1817
|
+
}), []);
|
|
1818
|
+
const accordionItem = React.useMemo(() => ({
|
|
1819
|
+
...folder,
|
|
1820
|
+
label: folder.id === FOLDERS.USER_ROOT ? accountName : getFolderTranslatedName({
|
|
1821
|
+
folderId: folder.id,
|
|
1822
|
+
folderName: folder.name
|
|
1823
|
+
}) ?? '',
|
|
1824
|
+
icon: getFolderIconName(folder) ?? undefined,
|
|
1825
|
+
iconColor: getFolderIconColor(folder) ?? '',
|
|
1826
|
+
textProps
|
|
1827
|
+
}), [folder, accountName, textProps]);
|
|
1828
|
+
|
|
1829
|
+
// hide folders where a share was provided and subsequently removed
|
|
1830
|
+
if (folder.isLink && folder.broken) {
|
|
1831
|
+
return /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null);
|
|
1832
|
+
}
|
|
1833
|
+
const showAvatar = folder.id === FOLDERS.USER_ROOT || folder.isLink && folder.oname === ROOT_NAME;
|
|
1834
|
+
return /*#__PURE__*/React__default.default.createElement(FittedRow, null, showAvatar && /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
1835
|
+
left: "small"
|
|
1836
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Avatar, {
|
|
1837
|
+
label: accordionItem.label,
|
|
1838
|
+
colorLabel: accordionItem.iconColor,
|
|
1839
|
+
size: "medium"
|
|
1840
|
+
})), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Tooltip, {
|
|
1841
|
+
label: accordionItem.label,
|
|
1842
|
+
placement: "right",
|
|
1843
|
+
maxWidth: "100%"
|
|
1844
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.AccordionItem, {
|
|
1845
|
+
"data-testid": `accordion-folder-item-${folder.id}`,
|
|
1846
|
+
item: accordionItem
|
|
1847
|
+
}, /*#__PURE__*/React__default.default.createElement(StatusIcon, {
|
|
1848
|
+
folder: folder
|
|
1849
|
+
}))));
|
|
1850
|
+
};
|
|
1851
|
+
|
|
1852
|
+
/*
|
|
1853
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
1854
|
+
*
|
|
1855
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
1856
|
+
*/
|
|
1857
|
+
|
|
1858
|
+
const hasId = (f, id) => f.id.split(':').includes(id);
|
|
1859
|
+
const isTrash = f => hasId(f, FOLDERS.TRASH);
|
|
1860
|
+
const isNestedInTrash = item => !!item?.absFolderPath?.includes(`/Trash/`);
|
|
1861
|
+
const isTrashOrNestedInIt = item => isTrash(item) || isNestedInTrash(item);
|
|
1862
|
+
const folderViewFilter = v => deep => f => f.view === v || !deep || typeof f.view === 'undefined' && !isRoot(f.id);
|
|
1863
|
+
const filterNodes = (children, f, sortFunction, deep) => {
|
|
1864
|
+
const childrenSorted = sortFunction ? lodash.sortBy(children, sortFunction) : children;
|
|
1865
|
+
return childrenSorted.filter(f(deep)).map(i => ({
|
|
1866
|
+
...i,
|
|
1867
|
+
children: filterNodes(i.children, f, sortFunction, true)
|
|
1868
|
+
}));
|
|
1869
|
+
};
|
|
1870
|
+
const mapNodes = (children, {
|
|
1871
|
+
mapFunction,
|
|
1872
|
+
filterFunction,
|
|
1873
|
+
recursionKey,
|
|
1874
|
+
sortFunction,
|
|
1875
|
+
deep
|
|
1876
|
+
}) => lodash.sortBy(children, sortFunction).reduce((acc, folder) => {
|
|
1877
|
+
if (filterFunction(deep)(folder)) {
|
|
1878
|
+
acc.push({
|
|
1879
|
+
...mapFunction(folder),
|
|
1880
|
+
[recursionKey]: mapNodes(folder.children, {
|
|
1881
|
+
mapFunction,
|
|
1882
|
+
filterFunction,
|
|
1883
|
+
recursionKey,
|
|
1884
|
+
sortFunction,
|
|
1885
|
+
deep: true
|
|
1886
|
+
})
|
|
1887
|
+
});
|
|
1888
|
+
}
|
|
1889
|
+
return acc;
|
|
1890
|
+
}, []);
|
|
1891
|
+
|
|
1892
|
+
/**
|
|
1893
|
+
* Recursive function that returns a flat map of the children folders
|
|
1894
|
+
* @param children
|
|
1895
|
+
*/
|
|
1896
|
+
const getFlatChildrenFolders = children => {
|
|
1897
|
+
let destination = {};
|
|
1898
|
+
children.forEach(child => {
|
|
1899
|
+
destination[child.id] = child;
|
|
1900
|
+
if (child.children) {
|
|
1901
|
+
destination = {
|
|
1902
|
+
...destination,
|
|
1903
|
+
...getFlatChildrenFolders(child.children)
|
|
1904
|
+
};
|
|
1905
|
+
}
|
|
1906
|
+
});
|
|
1907
|
+
return destination;
|
|
1908
|
+
};
|
|
1909
|
+
|
|
1910
|
+
/*
|
|
1911
|
+
* SPDX-FileCopyrightText: 2021 Zextras <https://www.zextras.com>
|
|
1912
|
+
*
|
|
1913
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
1914
|
+
*/
|
|
1915
|
+
|
|
1916
|
+
/**
|
|
1917
|
+
* Returns the folder with given ID or undefined
|
|
1918
|
+
* @params id */
|
|
1919
|
+
const useFolder = id => useFolderStore(s => s.folders?.[id]);
|
|
1920
|
+
|
|
1921
|
+
/**
|
|
1922
|
+
* Returns the folder with given ID or undefined
|
|
1923
|
+
* @params id */
|
|
1924
|
+
const getFolder = id => useFolderStore.getState()?.folders?.[id];
|
|
1925
|
+
|
|
1926
|
+
/**
|
|
1927
|
+
* Returns a folders' map including roots and links. Each folder has its own tree structure included inside its children
|
|
1928
|
+
*/
|
|
1929
|
+
const useFoldersMap = () => useFolderStore(s => s.folders);
|
|
1930
|
+
|
|
1931
|
+
/**
|
|
1932
|
+
* Returns a folders' map including roots and links. Each folder has its own tree structure included inside its children
|
|
1933
|
+
*/
|
|
1934
|
+
const getFoldersMap = () => useFolderStore.getState().folders;
|
|
1935
|
+
|
|
1936
|
+
/**
|
|
1937
|
+
* Returns a folders' array including only links. Each folder has its own tree structure included inside its children
|
|
1938
|
+
*/
|
|
1939
|
+
const getLinksArray = view => lodash.filter(lodash.values(useFolderStore.getState().folders), folder => {
|
|
1940
|
+
if (view && folder.view !== view) {
|
|
1941
|
+
return false;
|
|
1942
|
+
}
|
|
1943
|
+
return folder.isLink;
|
|
1944
|
+
});
|
|
1945
|
+
|
|
1946
|
+
/**
|
|
1947
|
+
* Returns the root folder id for a given folder
|
|
1948
|
+
* @param folder a Folder or LinkFolder
|
|
1949
|
+
* @returns the root folder id or null if the folder is not a link or the root folder
|
|
1950
|
+
*/
|
|
1951
|
+
function getRootFolderId(folder) {
|
|
1952
|
+
const parent = folder?.parent && getFolder(folder.parent);
|
|
1953
|
+
if ('oname' in folder && folder?.oname === ROOT_NAME) {
|
|
1954
|
+
return folder.id;
|
|
1955
|
+
}
|
|
1956
|
+
if (parent) {
|
|
1957
|
+
return getRootFolderId(parent);
|
|
1958
|
+
}
|
|
1959
|
+
return folder.id;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
/**
|
|
1963
|
+
* Returns the root folder of the provided folderId or undefined
|
|
1964
|
+
* @params id
|
|
1965
|
+
* @returns the root folder or undefined
|
|
1966
|
+
* */
|
|
1967
|
+
const useRoot = id => useFolderStore(s => {
|
|
1968
|
+
const folder = s.folders?.[id];
|
|
1969
|
+
if (folder) {
|
|
1970
|
+
const rootFolderId = getRootFolderId(folder);
|
|
1971
|
+
return s.folders?.[rootFolderId];
|
|
1972
|
+
}
|
|
1973
|
+
return undefined;
|
|
1974
|
+
});
|
|
1975
|
+
|
|
1976
|
+
/**
|
|
1977
|
+
* Returns the root folder of the provided folderId or undefined
|
|
1978
|
+
* @params id
|
|
1979
|
+
* @returns the root folder or undefined
|
|
1980
|
+
* */
|
|
1981
|
+
const getRoot = id => {
|
|
1982
|
+
const folder = useFolderStore.getState().folders?.[id];
|
|
1983
|
+
if (folder) {
|
|
1984
|
+
const rootFolderId = getRootFolderId(folder);
|
|
1985
|
+
return useFolderStore.getState().folders?.[rootFolderId];
|
|
1986
|
+
}
|
|
1987
|
+
return undefined;
|
|
1988
|
+
};
|
|
1989
|
+
|
|
1990
|
+
/**
|
|
1991
|
+
* Returns a roots' array. Each root has its own tree structure included inside its children
|
|
1992
|
+
*/
|
|
1993
|
+
const useRootsArray = () => useFolderStore(s => lodash.filter(s.folders, f => f.id?.split(':')?.includes(FOLDERS.USER_ROOT)));
|
|
1994
|
+
|
|
1995
|
+
/**
|
|
1996
|
+
* Returns a roots' array. Each root has its own tree structure included inside its children
|
|
1997
|
+
*/
|
|
1998
|
+
const getRootsArray = () => lodash.filter(useFolderStore.getState().folders, f => f.id?.split(':')?.includes(FOLDERS.USER_ROOT));
|
|
1999
|
+
|
|
2000
|
+
/**
|
|
2001
|
+
* Returns a roots' map. Each root has its own tree structure included inside its children
|
|
2002
|
+
*/
|
|
2003
|
+
const useRootsMap = () => useFolderStore(s => lodash.keyBy(lodash.filter(s.folders, f => f.id?.split(':')?.includes(FOLDERS.USER_ROOT)), 'id'));
|
|
2004
|
+
|
|
2005
|
+
/**
|
|
2006
|
+
* Returns a roots' map. Each root has its own tree structure included inside its children
|
|
2007
|
+
*/
|
|
2008
|
+
const getRootsMap = () => lodash.keyBy(lodash.filter(useFolderStore.getState().folders, f => f.id?.split(':')?.includes(FOLDERS.USER_ROOT)), 'id');
|
|
2009
|
+
|
|
2010
|
+
// ROOTS BY VIEW
|
|
2011
|
+
/**
|
|
2012
|
+
* Returns a root with given user ID.
|
|
2013
|
+
* @params userId
|
|
2014
|
+
*/
|
|
2015
|
+
const useRootByUser = userId => useFolderStore(s => lodash.find(s.folders, f => f.name === userId));
|
|
2016
|
+
|
|
2017
|
+
/**
|
|
2018
|
+
* Returns a root with given user ID.
|
|
2019
|
+
* @params userId
|
|
2020
|
+
*/
|
|
2021
|
+
const getRootByUser = userId => {
|
|
2022
|
+
const {
|
|
2023
|
+
folders
|
|
2024
|
+
} = useFolderStore.getState();
|
|
2025
|
+
return lodash.find(folders, f => f.name === userId);
|
|
2026
|
+
};
|
|
2027
|
+
|
|
2028
|
+
/**
|
|
2029
|
+
* Returns the root account id for a given folder
|
|
2030
|
+
* @param folder a Folder or LinkFolder
|
|
2031
|
+
* @returns the root account id or null if the folder is not a link or the root folder
|
|
2032
|
+
*/
|
|
2033
|
+
function getRootAccountId(id) {
|
|
2034
|
+
const roots = getRootsArray();
|
|
2035
|
+
const root = lodash.find(roots, r => lodash.some(r.id?.split(':'), v => id?.split(':')?.includes(v)));
|
|
2036
|
+
return root?.id;
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
/**
|
|
2040
|
+
* Return a flat array of folder that are children of the given root
|
|
2041
|
+
* @param rootId
|
|
2042
|
+
*/
|
|
2043
|
+
const useFoldersMapByRoot = rootId => {
|
|
2044
|
+
const root = useRoot(rootId);
|
|
2045
|
+
return React.useMemo(() => getFlatChildrenFolders(root?.children ?? []), [root?.children]);
|
|
2046
|
+
};
|
|
2047
|
+
|
|
2048
|
+
/**
|
|
2049
|
+
* Return a flat array of folder that are children of the given root
|
|
2050
|
+
* @param rootId
|
|
2051
|
+
*/
|
|
2052
|
+
const getFoldersArrayByRoot = rootId => {
|
|
2053
|
+
const root = getRoot(rootId);
|
|
2054
|
+
if (!root) {
|
|
2055
|
+
return [];
|
|
2056
|
+
}
|
|
2057
|
+
return Object.values(getFlatChildrenFolders(root.children));
|
|
2058
|
+
};
|
|
2059
|
+
|
|
2060
|
+
// SEARCHES
|
|
2061
|
+
const useSearchFolder = id => useFolderStore(s => s.searches?.[id]);
|
|
2062
|
+
const getSearchFolder = id => useFolderStore.getState().searches[id];
|
|
2063
|
+
const useSearchFolders = () => useFolderStore(s => s.searches);
|
|
2064
|
+
const getSearchFolders = () => useFolderStore.getState().searches;
|
|
2065
|
+
|
|
2066
|
+
// useful hooks to update the value of a folder. Created because we don't receive acl data from notify when we modify folder grants.
|
|
2067
|
+
|
|
2068
|
+
/**
|
|
2069
|
+
* Returns a callback function to update a specific folder.
|
|
2070
|
+
*
|
|
2071
|
+
* @returns callback function to update a specific folder
|
|
2072
|
+
*/
|
|
2073
|
+
const useUpdateFolder = () => useFolderStore(s => s.updateFolder);
|
|
2074
|
+
|
|
2075
|
+
/**
|
|
2076
|
+
* Returns a callback function to update a specific folder.
|
|
2077
|
+
*
|
|
2078
|
+
* @returns callback function to update a specific folder
|
|
2079
|
+
*/
|
|
2080
|
+
const getUpdateFolder = () => useFolderStore.getState().updateFolder;
|
|
2081
|
+
|
|
2082
|
+
/*
|
|
2083
|
+
* SPDX-FileCopyrightText: 2025 Zextras <https://www.zextras.com>
|
|
2084
|
+
*
|
|
2085
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2086
|
+
*/
|
|
2087
|
+
|
|
2088
|
+
/**
|
|
2089
|
+
* calculate the sorting criteria for a given folder
|
|
2090
|
+
* system folders are placed before user folders
|
|
2091
|
+
* the trash folder is always the last one
|
|
2092
|
+
* @param folder
|
|
2093
|
+
* @returns the sorting criteria
|
|
2094
|
+
*/
|
|
2095
|
+
const getSortCriteria = folder => {
|
|
2096
|
+
const {
|
|
2097
|
+
id
|
|
2098
|
+
} = getFolderIdParts(folder.id);
|
|
2099
|
+
if (id === FOLDERS.TRASH) {
|
|
2100
|
+
return FOLDERS.LAST_SYSTEM_FOLDER_POSITION;
|
|
2101
|
+
}
|
|
2102
|
+
return parseInt(id ?? '', 10) < 17 ? ` ${id}` : folder.name.toLowerCase();
|
|
2103
|
+
};
|
|
2104
|
+
|
|
2105
|
+
/**
|
|
2106
|
+
* recursively sort the children of a folder according to a given sort function
|
|
2107
|
+
* @param children
|
|
2108
|
+
* @param sortFunction
|
|
2109
|
+
* @returns the sorted children
|
|
2110
|
+
*/
|
|
2111
|
+
const sortFolders = ({
|
|
2112
|
+
children,
|
|
2113
|
+
sortFunction
|
|
2114
|
+
}) => {
|
|
2115
|
+
const childrenSorted = lodash.sortBy(children, sortFunction);
|
|
2116
|
+
return childrenSorted.map(folder => ({
|
|
2117
|
+
...folder,
|
|
2118
|
+
children: sortFolders({
|
|
2119
|
+
children: folder.children,
|
|
2120
|
+
sortFunction
|
|
2121
|
+
})
|
|
2122
|
+
}));
|
|
2123
|
+
};
|
|
2124
|
+
|
|
2125
|
+
/**
|
|
2126
|
+
* sorts the children of the useRootsArray hook according to the specified sort function
|
|
2127
|
+
* @returns the sorted children
|
|
2128
|
+
*/
|
|
2129
|
+
const useFolders = () => {
|
|
2130
|
+
const roots = useRootsArray();
|
|
2131
|
+
return React.useMemo(() => sortFolders({
|
|
2132
|
+
children: roots,
|
|
2133
|
+
sortFunction: getSortCriteria
|
|
2134
|
+
}), [roots]);
|
|
2135
|
+
};
|
|
2136
|
+
|
|
2137
|
+
/**
|
|
2138
|
+
* sorts the children of the getRootsArray hook according to the specified sort function
|
|
2139
|
+
* @returns the sorted children
|
|
2140
|
+
*/
|
|
2141
|
+
const getFolders = () => {
|
|
2142
|
+
const roots = getRootsArray();
|
|
2143
|
+
return sortFolders({
|
|
2144
|
+
children: roots,
|
|
2145
|
+
sortFunction: getSortCriteria
|
|
2146
|
+
});
|
|
2147
|
+
};
|
|
2148
|
+
|
|
2149
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
2150
|
+
/*
|
|
2151
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
2152
|
+
*
|
|
2153
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2154
|
+
*/
|
|
2155
|
+
const FolderSelector = ({
|
|
2156
|
+
inputLabel,
|
|
2157
|
+
onNewFolderClick,
|
|
2158
|
+
selectedFolderId,
|
|
2159
|
+
onFolderSelected,
|
|
2160
|
+
allowRootSelection,
|
|
2161
|
+
showSharedAccounts,
|
|
2162
|
+
filterChildren
|
|
2163
|
+
}) => {
|
|
2164
|
+
const [inputValue, setInputValue] = React.useState('');
|
|
2165
|
+
const selectedFolder = selectedFolderId && getFolder(selectedFolderId);
|
|
2166
|
+
const folders = useFolders();
|
|
2167
|
+
const rootFolders = React.useMemo(() => showSharedAccounts ? folders : folders.filter(root => root.id === FOLDERS.USER_ROOT), [folders, showSharedAccounts]);
|
|
2168
|
+
const disabledFolderIdsSelection = allowRootSelection ? [] : rootFolders.map(folder => folder.id);
|
|
2169
|
+
const [t] = reactI18next.useTranslation();
|
|
2170
|
+
const inputName = selectedFolder ? selectedFolder.name : '';
|
|
2171
|
+
return /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Input, {
|
|
2172
|
+
"data-testid": 'folder-name-filter',
|
|
2173
|
+
inputName: inputName,
|
|
2174
|
+
label: inputLabel ?? t('label.filter_folders', 'Filter folders'),
|
|
2175
|
+
backgroundColor: "gray5",
|
|
2176
|
+
value: inputValue,
|
|
2177
|
+
onChange: e => setInputValue(e.target.value)
|
|
2178
|
+
}), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
2179
|
+
style: {
|
|
2180
|
+
overflowY: 'auto',
|
|
2181
|
+
display: 'block'
|
|
2182
|
+
},
|
|
2183
|
+
height: "fit",
|
|
2184
|
+
width: "fill",
|
|
2185
|
+
orientation: "vertical",
|
|
2186
|
+
mainAlignment: "flex-start",
|
|
2187
|
+
minHeight: "30vh",
|
|
2188
|
+
maxHeight: "60vh"
|
|
2189
|
+
}, inputValue.length > 0 ? /*#__PURE__*/React__default.default.createElement(FlatFolders, {
|
|
2190
|
+
rootFolders: rootFolders,
|
|
2191
|
+
searchString: inputValue,
|
|
2192
|
+
onFolderSelected: onFolderSelected,
|
|
2193
|
+
selectedFolderId: selectedFolderId,
|
|
2194
|
+
allowRootSelection: allowRootSelection,
|
|
2195
|
+
filterChildren: filterChildren
|
|
2196
|
+
}) : /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.ThemeProvider, {
|
|
2197
|
+
extension: themeMuiExtension
|
|
2198
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
2199
|
+
vertical: "medium"
|
|
2200
|
+
}), /*#__PURE__*/React__default.default.createElement(FoldersAccordion, {
|
|
2201
|
+
folders: rootFolders,
|
|
2202
|
+
onFolderSelected: onFolderSelected,
|
|
2203
|
+
selectedFolderId: selectedFolderId,
|
|
2204
|
+
disabledFolderIds: disabledFolderIdsSelection,
|
|
2205
|
+
FolderAccordionCustomComponent: FolderAccordionCustomComponent,
|
|
2206
|
+
filterChildren: filterChildren
|
|
2207
|
+
}))), onNewFolderClick && /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
2208
|
+
padding: {
|
|
2209
|
+
top: 'medium',
|
|
2210
|
+
bottom: 'medium'
|
|
2211
|
+
},
|
|
2212
|
+
mainAlignment: "center",
|
|
2213
|
+
crossAlignment: "flex-start"
|
|
2214
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Button, {
|
|
2215
|
+
type: "ghost",
|
|
2216
|
+
label: t('label.new_folder', 'New Folder'),
|
|
2217
|
+
color: "primary",
|
|
2218
|
+
onClick: onNewFolderClick
|
|
2219
|
+
})));
|
|
2220
|
+
};
|
|
2221
|
+
|
|
2222
|
+
const Square$1 = /*#__PURE__*/_styled__default.default("div", process.env.NODE_ENV === "production" ? {
|
|
2223
|
+
target: "eiytx182"
|
|
2224
|
+
} : {
|
|
2225
|
+
target: "eiytx182",
|
|
2226
|
+
label: "Square"
|
|
2227
|
+
})("width:1rem;height:1rem;background:", ({
|
|
2228
|
+
$color
|
|
2229
|
+
}) => $color, ";border-radius:0.25rem;opacity:", ({
|
|
2230
|
+
$disabled
|
|
2231
|
+
}) => $disabled ? 0.5 : 1, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNlbGVjdC1sYWJlbC1mYWN0b3J5LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFZcUYiLCJmaWxlIjoic2VsZWN0LWxhYmVsLWZhY3RvcnkudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIFNQRFgtRmlsZUNvcHlyaWdodFRleHQ6IDIwMjIgWmV4dHJhcyA8aHR0cHM6Ly93d3cuemV4dHJhcy5jb20+XG4gKlxuICogU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEFHUEwtMy4wLW9ubHlcbiAqL1xuaW1wb3J0IFJlYWN0LCB7IFJlYWN0RWxlbWVudCB9IGZyb20gJ3JlYWN0JztcblxuaW1wb3J0IHsgQ29udGFpbmVyLCBJY29uLCBQYWRkaW5nLCBSb3csIFRleHQsIGdldENvbG9yIH0gZnJvbSAnQHpleHRyYXMvY2FyYm9uaW8tZGVzaWduLXN5c3RlbSc7XG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbmltcG9ydCB7IEN1c3RvbUxhYmVsRmFjdG9yeVByb3BzIH0gZnJvbSAnLi4vLi4vdHlwZXMvc2VsZWN0JztcblxuZXhwb3J0IGNvbnN0IFNxdWFyZSA9IHN0eWxlZC5kaXY8eyAkZGlzYWJsZWQ/OiBib29sZWFuOyAkY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x0PC9UZXh0PlxuXHRcdFx0XHQ8Um93PlxuXHRcdFx0XHRcdDxQYWRkaW5nIHJpZ2h0PVwic21hbGxcIj5cblx0XHRcdFx0XHRcdDxTcXVhcmUgJGNvbG9yPXtzZWxlY3RlZFswXS5jb2xvcn0gJGRpc2FibGVkPXtkaXNhYmxlZH0gLz5cblx0XHRcdFx0XHQ8L1BhZGRpbmc+XG5cdFx0XHRcdFx0PFRleHRVcHBlckNhc2UgZGlzYWJsZWQ9e2Rpc2FibGVkfT57c2VsZWN0ZWRbMF0ubGFiZWx9PC9UZXh0VXBwZXJDYXNlPlxuXHRcdFx0XHQ8L1Jvdz5cblx0XHRcdDwvUm93PlxuXHRcdDwvUm93PlxuXHRcdDxJY29uXG5cdFx0XHRzaXplPVwibGFyZ2VcIlxuXHRcdFx0aWNvbj17b3BlbiA/ICdDaGV2cm9uVXBPdXRsaW5lJyA6ICdDaGV2cm9uRG93bk91dGxpbmUnfVxuXHRcdFx0ZGlzYWJsZWQ9e2Rpc2FibGVkfVxuXHRcdFx0Y29sb3I9eyhkaXNhYmxlZCAmJiAndGV4dC5kaXNhYmxlZCcpIHx8ICgob3BlbiB8fCBmb2N1cykgJiYgJ3ByaW1hcnknKSB8fCAnc2Vjb25kYXJ5J31cblx0XHRcdHN0eWxlPXt7IGFsaWduU2VsZjogJ2NlbnRlcicgfX1cblx0XHQvPlxuXHQ8L0NvbG9yQ29udGFpbmVyPlxuKTtcbiJdfQ== */"));
|
|
2232
|
+
const ColorContainer$1 = /*#__PURE__*/_styled__default.default(carbonioDesignSystem.Container, process.env.NODE_ENV === "production" ? {
|
|
2233
|
+
target: "eiytx181"
|
|
2234
|
+
} : {
|
|
2235
|
+
target: "eiytx181",
|
|
2236
|
+
label: "ColorContainer"
|
|
2237
|
+
})("border-bottom:0.0625rem solid ", ({
|
|
2238
|
+
theme
|
|
2239
|
+
}) => theme.palette.gray2.regular, ";transition:background 0.2s ease-out;&:hover{background:", ({
|
|
2240
|
+
theme,
|
|
2241
|
+
background
|
|
2242
|
+
}) => carbonioDesignSystem.getColor(`${background}.hover`, theme), ";}" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNlbGVjdC1sYWJlbC1mYWN0b3J5LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFvQndDIiwiZmlsZSI6InNlbGVjdC1sYWJlbC1mYWN0b3J5LnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBTUERYLUZpbGVDb3B5cmlnaHRUZXh0OiAyMDIyIFpleHRyYXMgPGh0dHBzOi8vd3d3LnpleHRyYXMuY29tPlxuICpcbiAqIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBBR1BMLTMuMC1vbmx5XG4gKi9cbmltcG9ydCBSZWFjdCwgeyBSZWFjdEVsZW1lbnQgfSBmcm9tICdyZWFjdCc7XG5cbmltcG9ydCB7IENvbnRhaW5lciwgSWNvbiwgUGFkZGluZywgUm93LCBUZXh0LCBnZXRDb2xvciB9IGZyb20gJ0B6ZXh0cmFzL2NhcmJvbmlvLWRlc2lnbi1zeXN0ZW0nO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG5pbXBvcnQgeyBDdXN0b21MYWJlbEZhY3RvcnlQcm9wcyB9IGZyb20gJy4uLy4uL3R5cGVzL3NlbGVjdCc7XG5cbmV4cG9ydCBjb25zdCBTcXVhcmUgPSBzdHlsZWQuZGl2PHsgJGRpc2FibGVkPzogYm9vbGVhbjsgJGNvbG9yOiBzdHJpbmcgfCB1bmRlZmluZWQgfT5gXG5cdHdpZHRoOiAxcmVtO1xuXHRoZWlnaHQ6IDFyZW07XG5cdGJhY2tncm91bmQ6ICR7KHsgJGNvbG9yIH0pOiBzdHJpbmcgfCB1bmRlZmluZWQgPT4gJGNvbG9yfTtcblx0Ym9yZGVyLXJhZGl1czog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ZWR9IC8+XG5cdFx0XHRcdFx0PC9QYWRkaW5nPlxuXHRcdFx0XHRcdDxUZXh0VXBwZXJDYXNlIGRpc2FibGVkPXtkaXNhYmxlZH0+e3NlbGVjdGVkWzBdLmxhYmVsfTwvVGV4dFVwcGVyQ2FzZT5cblx0XHRcdFx0PC9Sb3c+XG5cdFx0XHQ8L1Jvdz5cblx0XHQ8L1Jvdz5cblx0XHQ8SWNvblxuXHRcdFx0c2l6ZT1cImxhcmdlXCJcblx0XHRcdGljb249e29wZW4gPyAnQ2hldnJvblVwT3V0bGluZScgOiAnQ2hldnJvbkRvd25PdXRsaW5lJ31cblx0XHRcdGRpc2FibGVkPXtkaXNhYmxlZH1cblx0XHRcdGNvbG9yPXsoZGlzYWJsZWQgJiYgJ3RleHQuZGlzYWJsZWQnKSB8fCAoKG9wZW4gfHwgZm9jdXMpICYmICdwcmltYXJ5JykgfHwgJ3NlY29uZGFyeSd9XG5cdFx0XHRzdHlsZT17eyBhbGlnblNlbGY6ICdjZW50ZXInIH19XG5cdFx0Lz5cblx0PC9Db2xvckNvbnRhaW5lcj5cbik7XG4iXX0= */"));
|
|
2243
|
+
const TextUpperCase$1 = /*#__PURE__*/_styled__default.default(carbonioDesignSystem.Text, process.env.NODE_ENV === "production" ? {
|
|
2244
|
+
target: "eiytx180"
|
|
2245
|
+
} : {
|
|
2246
|
+
target: "eiytx180",
|
|
2247
|
+
label: "TextUpperCase"
|
|
2248
|
+
})("text-transform:capitalize;color:", ({
|
|
2249
|
+
theme,
|
|
2250
|
+
disabled
|
|
2251
|
+
}) => disabled ? theme.palette.text.disabled : theme.palette.text.regular, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNlbGVjdC1sYWJlbC1mYWN0b3J5LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0QmtDIiwiZmlsZSI6InNlbGVjdC1sYWJ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ImxhcmdlXCJcblx0XHRcdGljb249e29wZW4gPyAnQ2hldnJvblVwT3V0bGluZScgOiAnQ2hldnJvbkRvd25PdXRsaW5lJ31cblx0XHRcdGRpc2FibGVkPXtkaXNhYmxlZH1cblx0XHRcdGNvbG9yPXsoZGlzYWJsZWQgJiYgJ3RleHQuZGlzYWJsZWQnKSB8fCAoKG9wZW4gfHwgZm9jdXMpICYmICdwcmltYXJ5JykgfHwgJ3NlY29uZGFyeSd9XG5cdFx0XHRzdHlsZT17eyBhbGlnblNlbGY6ICdjZW50ZXInIH19XG5cdFx0Lz5cblx0PC9Db2xvckNvbnRhaW5lcj5cbik7XG4iXX0= */"));
|
|
2252
|
+
const FolderSelectorLabelFactory = ({
|
|
2253
|
+
selected,
|
|
2254
|
+
label,
|
|
2255
|
+
open,
|
|
2256
|
+
focus,
|
|
2257
|
+
disabled
|
|
2258
|
+
}) => /*#__PURE__*/React__default.default.createElement(ColorContainer$1, {
|
|
2259
|
+
orientation: "horizontal",
|
|
2260
|
+
width: "fill",
|
|
2261
|
+
crossAlignment: "center",
|
|
2262
|
+
mainAlignment: "space-between",
|
|
2263
|
+
borderRadius: "half",
|
|
2264
|
+
padding: {
|
|
2265
|
+
all: 'small'
|
|
2266
|
+
},
|
|
2267
|
+
background: "gray5",
|
|
2268
|
+
style: {
|
|
2269
|
+
cursor: disabled ? 'no-drop' : 'pointer'
|
|
2270
|
+
}
|
|
2271
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
2272
|
+
width: "100%",
|
|
2273
|
+
takeAvailableSpace: true,
|
|
2274
|
+
mainAlignment: "space-between"
|
|
2275
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
2276
|
+
orientation: "vertical",
|
|
2277
|
+
crossAlignment: "flex-start",
|
|
2278
|
+
mainAlignment: "flex-start",
|
|
2279
|
+
padding: {
|
|
2280
|
+
left: 'small'
|
|
2281
|
+
}
|
|
2282
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Text, {
|
|
2283
|
+
size: "small",
|
|
2284
|
+
disabled: disabled,
|
|
2285
|
+
color: disabled && 'text.disabled' || (open || focus) && 'primary' || 'secondary'
|
|
2286
|
+
}, label), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, null, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
2287
|
+
right: "small"
|
|
2288
|
+
}, /*#__PURE__*/React__default.default.createElement(Square$1, {
|
|
2289
|
+
$color: selected[0].color,
|
|
2290
|
+
$disabled: disabled
|
|
2291
|
+
})), /*#__PURE__*/React__default.default.createElement(TextUpperCase$1, {
|
|
2292
|
+
disabled: disabled
|
|
2293
|
+
}, selected[0].label)))), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Icon, {
|
|
2294
|
+
size: "large",
|
|
2295
|
+
icon: open ? 'ChevronUpOutline' : 'ChevronDownOutline',
|
|
2296
|
+
disabled: disabled,
|
|
2297
|
+
color: disabled && 'text.disabled' || (open || focus) && 'primary' || 'secondary',
|
|
2298
|
+
style: {
|
|
2299
|
+
alignSelf: 'center'
|
|
2300
|
+
}
|
|
2301
|
+
}));
|
|
2302
|
+
|
|
2303
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__$1() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2304
|
+
const Square = /*#__PURE__*/_styled__default.default("div", process.env.NODE_ENV === "production" ? {
|
|
2305
|
+
target: "e1zwtqe2"
|
|
2306
|
+
} : {
|
|
2307
|
+
target: "e1zwtqe2",
|
|
2308
|
+
label: "Square"
|
|
2309
|
+
})("width:1.125rem;height:1.125rem;position:relative;top:-0.1875rem;border:0.0625rem solid ", ({
|
|
2310
|
+
theme
|
|
2311
|
+
}) => theme.palette.gray2.regular, ";background:", ({
|
|
2312
|
+
$color
|
|
2313
|
+
}) => $color, ";border-radius:0.25rem;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbG9yLXNlbGVjdC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBZTZDIiwiZmlsZSI6ImNvbG9yLXNlbGVjdC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogU1BEWC1GaWxlQ29weXJpZ2h0VGV4dDogMjAyNCBaZXh0cmFzIDxodHRwczovL3d3dy56ZXh0cmFzLmNvbT5cbiAqXG4gKiBTUERYLUxpY2Vuc2UtSWRlbnRpZmllcjogQUdQTC0zLjAtb25seVxuICovXG5pbXBvcnQgUmVhY3QsIHsgdXNlTWVtbyB9IGZyb20gJ3JlYWN0JztcblxuaW1wb3J0IHR5cGUgeyBTZWxlY3RQcm9wcywgU2luZ2xlU2VsZWN0aW9uT25DaGFuZ2UgfSBmcm9tICdAemV4dHJhcy9jYXJib25pby1kZXNpZ24tc3lzdGVtJztcbmltcG9ydCB7IENvbnRhaW5lciwgSWNvbiwgUGFkZGluZywgUm93LCBTZWxlY3QsIFRleHQgfSBmcm9tICdAemV4dHJhcy9jYXJib25pby1kZXNpZ24tc3lzdGVtJztcbmltcG9ydCB7IHVzZVRyYW5zbGF0aW9uIH0gZnJvbSAncmVhY3QtaTE4bmV4dCc7XG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbmltcG9ydCB7IFpJTUJSQV9TVEFOREFSRF9DT0xPUlMgfSBmcm9tICcuLi8uLi9jb25zdGFudHMvdXRpbHMnO1xuaW1wb3J0IHsgQ3VzdG9tTGFiZWxGYWN0b3J5UHJvcHMgfSBmcm9tICcuLi8uLi90eXBlcy9zZWxlY3QnO1xuXG5jb25zdCBTcXVhcmUgPSBzdHlsZWQuZGl2PHsgJGNvbG9yOiBzdHJpbmcgfT5gXG5cdHdpZHRoOiAxLjEyNXJlbT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WdodD1cImZpdFwiXG5cdFx0XHRcdFx0XHQ+XG5cdFx0XHRcdFx0XHRcdDxQYWRkaW5nIGxlZnQ9XCJzbWFsbFwiPlxuXHRcdFx0XHRcdFx0XHRcdDxUZXh0VXBwZXJDYXNlPntjb2xvckxhYmVsfTwvVGV4dFVwcGVyQ2FzZT5cblx0XHRcdFx0XHRcdFx0PC9QYWRkaW5nPlxuXHRcdFx0XHRcdFx0XHQ8U3F1YXJlICRjb2xvcj17ZWwuaGV4fSAvPlxuXHRcdFx0XHRcdFx0PC9Db250YWluZXI+XG5cdFx0XHRcdFx0KVxuXHRcdFx0XHR9O1xuXHRcdFx0fSksXG5cdFx0W3RdXG5cdCk7XG5cdGNvbnN0IGRlZmF1bHRTZWxlY3Rpb24gPSB1c2VNZW1vKCgpID0+IGNvbG9yc1tkZWZhdWx0Q29sb3JdLCBbY29sb3JzLCBkZWZhdWx0Q29sb3JdKTtcblxuXHRyZXR1cm4gKFxuXHRcdDxTZWxlY3Rcblx0XHRcdGxhYmVsPXtsYWJlbH1cblx0XHRcdG9uQ2hhbmdlPXtvbkNoYW5nZX1cblx0XHRcdGl0ZW1zPXtjb2xvcnN9XG5cdFx0XHRkZWZhdWx0U2VsZWN0aW9uPXtkZWZhdWx0U2VsZWN0aW9ufVxuXHRcdFx0TGFiZWxGYWN0b3J5PXtMYWJlbEZhY3Rvcnl9XG5cdFx0XHRkYXRhLXRlc3RpZD1cImNvbG9yLXNlbGVjdFwiXG5cdFx0Lz5cblx0KTtcbn07XG4iXX0= */"));
|
|
2314
|
+
const ColorContainer = /*#__PURE__*/_styled__default.default(carbonioDesignSystem.Container, process.env.NODE_ENV === "production" ? {
|
|
2315
|
+
target: "e1zwtqe1"
|
|
2316
|
+
} : {
|
|
2317
|
+
target: "e1zwtqe1",
|
|
2318
|
+
label: "ColorContainer"
|
|
2319
|
+
})("border-bottom:0.0625rem solid ", ({
|
|
2320
|
+
theme
|
|
2321
|
+
}) => theme.palette.gray2.regular, ";cursor:'pointer';" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbG9yLXNlbGVjdC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBeUIrQyIsImZpbGUiOiJjb2xvci1zZWxlY3QudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIFNQRFgtRmlsZUNvcHlyaWdodFRleHQ6IDIwMjQgWmV4dHJhcyA8aHR0cHM6Ly93d3cuemV4dHJhcy5jb20+XG4gKlxuICogU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEFHUEwtMy4wLW9ubHlcbiAqL1xuaW1wb3J0IFJlYWN0LCB7IHVzZU1lbW8gfSBmcm9tICdyZWFjdCc7XG5cbmltcG9ydCB0eXBlIHsgU2VsZWN0UHJvcHMsIFNpbmdsZVNlbGVjdGlvbk9uQ2hhbmdlIH0gZnJvbSAnQHpleHRyYXMvY2FyYm9uaW8tZGVzaWduLXN5c3RlbSc7XG5pbXBvcnQgeyBDb250YWluZXIsIEljb24sIFBhZGRpbmcsIFJvdywgU2VsZWN0LCBUZXh0IH0gZnJvbSAnQHpleHRyYXMvY2FyYm9uaW8tZGVzaWduLXN5c3RlbSc7XG5pbXBvcnQgeyB1c2VUcmFuc2xhdGlvbiB9IGZyb20gJ3JlYWN0LWkxOG5leHQnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG5pbXBvcnQgeyBaSU1CUkFfU1RBTkRBUkRfQ09MT1JTIH0gZnJvbSAnLi4vLi4vY29uc3RhbnRzL3V0aWxzJztcbmltcG9ydCB7IEN1c3RvbUxhYmVsRmFjdG9yeVByb3BzIH0gZnJvbSAnLi4vLi4vdHlwZXMvc2VsZWN0JztcblxuY29uc3QgU3F1YXJlID0gc3R5bGVkLmRpdjx7ICRjb2xvcjogc3RyaW5nIH0+YFxuXHR3aWR0aDogMS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XRcIlxuXHRcdFx0XHRcdFx0PlxuXHRcdFx0XHRcdFx0XHQ8UGFkZGluZyBsZWZ0PVwic21hbGxcIj5cblx0XHRcdFx0XHRcdFx0XHQ8VGV4dFVwcGVyQ2FzZT57Y29sb3JMYWJlbH08L1RleHRVcHBlckNhc2U+XG5cdFx0XHRcdFx0XHRcdDwvUGFkZGluZz5cblx0XHRcdFx0XHRcdFx0PFNxdWFyZSAkY29sb3I9e2VsLmhleH0gLz5cblx0XHRcdFx0XHRcdDwvQ29udGFpbmVyPlxuXHRcdFx0XHRcdClcblx0XHRcdFx0fTtcblx0XHRcdH0pLFxuXHRcdFt0XVxuXHQpO1xuXHRjb25zdCBkZWZhdWx0U2VsZWN0aW9uID0gdXNlTWVtbygoKSA9PiBjb2xvcnNbZGVmYXVsdENvbG9yXSwgW2NvbG9ycywgZGVmYXVsdENvbG9yXSk7XG5cblx0cmV0dXJuIChcblx0XHQ8U2VsZWN0XG5cdFx0XHRsYWJlbD17bGFiZWx9XG5cdFx0XHRvbkNoYW5nZT17b25DaGFuZ2V9XG5cdFx0XHRpdGVtcz17Y29sb3JzfVxuXHRcdFx0ZGVmYXVsdFNlbGVjdGlvbj17ZGVmYXVsdFNlbGVjdGlvbn1cblx0XHRcdExhYmVsRmFjdG9yeT17TGFiZWxGYWN0b3J5fVxuXHRcdFx0ZGF0YS10ZXN0aWQ9XCJjb2xvci1zZWxlY3RcIlxuXHRcdC8+XG5cdCk7XG59O1xuIl19 */"));
|
|
2322
|
+
const TextUpperCase = /*#__PURE__*/_styled__default.default(carbonioDesignSystem.Text, process.env.NODE_ENV === "production" ? {
|
|
2323
|
+
target: "e1zwtqe0"
|
|
2324
|
+
} : {
|
|
2325
|
+
target: "e1zwtqe0",
|
|
2326
|
+
label: "TextUpperCase"
|
|
2327
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
2328
|
+
name: "kff9ir",
|
|
2329
|
+
styles: "text-transform:capitalize"
|
|
2330
|
+
} : {
|
|
2331
|
+
name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9XCJmaXRcIlxuXHRcdFx0XHRcdFx0PlxuXHRcdFx0XHRcdFx0XHQ8UGFkZGluZyBsZWZ0PVwic21hbGxcIj5cblx0XHRcdFx0XHRcdFx0XHQ8VGV4dFVwcGVyQ2FzZT57Y29sb3JMYWJlbH08L1RleHRVcHBlckNhc2U+XG5cdFx0XHRcdFx0XHRcdDwvUGFkZGluZz5cblx0XHRcdFx0XHRcdFx0PFNxdWFyZSAkY29sb3I9e2VsLmhleH0gLz5cblx0XHRcdFx0XHRcdDwvQ29udGFpbmVyPlxuXHRcdFx0XHRcdClcblx0XHRcdFx0fTtcblx0XHRcdH0pLFxuXHRcdFt0XVxuXHQpO1xuXHRjb25zdCBkZWZhdWx0U2VsZWN0aW9uID0gdXNlTWVtbygoKSA9PiBjb2xvcnNbZGVmYXVsdENvbG9yXSwgW2NvbG9ycywgZGVmYXVsdENvbG9yXSk7XG5cblx0cmV0dXJuIChcblx0XHQ8U2VsZWN0XG5cdFx0XHRsYWJlbD17bGFiZWx9XG5cdFx0XHRvbkNoYW5nZT17b25DaGFuZ2V9XG5cdFx0XHRpdGVtcz17Y29sb3JzfVxuXHRcdFx0ZGVmYXVsdFNlbGVjdGlvbj17ZGVmYXVsdFNlbGVjdGlvbn1cblx0XHRcdExhYmVsRmFjdG9yeT17TGFiZWxGYWN0b3J5fVxuXHRcdFx0ZGF0YS10ZXN0aWQ9XCJjb2xvci1zZWxlY3RcIlxuXHRcdC8+XG5cdCk7XG59O1xuIl19 */",
|
|
2333
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
2334
|
+
});
|
|
2335
|
+
const LabelFactory = ({
|
|
2336
|
+
selected,
|
|
2337
|
+
label,
|
|
2338
|
+
open,
|
|
2339
|
+
focus
|
|
2340
|
+
}) => /*#__PURE__*/React__default.default.createElement(ColorContainer, {
|
|
2341
|
+
orientation: "horizontal",
|
|
2342
|
+
width: "fill",
|
|
2343
|
+
crossAlignment: "center",
|
|
2344
|
+
mainAlignment: "space-between",
|
|
2345
|
+
borderRadius: "half",
|
|
2346
|
+
background: "gray5",
|
|
2347
|
+
padding: {
|
|
2348
|
+
all: 'small'
|
|
2349
|
+
}
|
|
2350
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
2351
|
+
width: "100%",
|
|
2352
|
+
takeAvailableSpace: true,
|
|
2353
|
+
mainAlignment: "space-between"
|
|
2354
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
2355
|
+
orientation: "vertical",
|
|
2356
|
+
crossAlignment: "flex-start",
|
|
2357
|
+
mainAlignment: "flex-start",
|
|
2358
|
+
padding: {
|
|
2359
|
+
left: 'small'
|
|
2360
|
+
}
|
|
2361
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Text, {
|
|
2362
|
+
size: "small",
|
|
2363
|
+
color: open || focus ? 'primary' : 'secondary'
|
|
2364
|
+
}, label), /*#__PURE__*/React__default.default.createElement(TextUpperCase, null, selected[0].label)), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
2365
|
+
right: "small"
|
|
2366
|
+
}, /*#__PURE__*/React__default.default.createElement(Square, {
|
|
2367
|
+
$color: ZIMBRA_STANDARD_COLORS[parseInt(selected[0].value, 10)].hex
|
|
2368
|
+
}))), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Icon, {
|
|
2369
|
+
size: "large",
|
|
2370
|
+
icon: open ? 'ChevronUpOutline' : 'ChevronDownOutline',
|
|
2371
|
+
color: open || focus ? 'primary' : 'secondary',
|
|
2372
|
+
style: {
|
|
2373
|
+
alignSelf: 'center'
|
|
2374
|
+
}
|
|
2375
|
+
}));
|
|
2376
|
+
const ColorSelect = ({
|
|
2377
|
+
onChange,
|
|
2378
|
+
defaultColor = 0,
|
|
2379
|
+
label
|
|
2380
|
+
}) => {
|
|
2381
|
+
const [t] = reactI18next.useTranslation();
|
|
2382
|
+
const colors = React.useMemo(() => ZIMBRA_STANDARD_COLORS.map((el, index) => {
|
|
2383
|
+
const colorLabel = t(`colors.${el.zLabel}`, el.zLabel);
|
|
2384
|
+
return {
|
|
2385
|
+
label: colorLabel,
|
|
2386
|
+
value: index.toString(),
|
|
2387
|
+
customComponent: /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
2388
|
+
width: "100%",
|
|
2389
|
+
mainAlignment: "space-between",
|
|
2390
|
+
orientation: "horizontal",
|
|
2391
|
+
height: "fit"
|
|
2392
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
2393
|
+
left: "small"
|
|
2394
|
+
}, /*#__PURE__*/React__default.default.createElement(TextUpperCase, null, colorLabel)), /*#__PURE__*/React__default.default.createElement(Square, {
|
|
2395
|
+
$color: el.hex
|
|
2396
|
+
}))
|
|
2397
|
+
};
|
|
2398
|
+
}), [t]);
|
|
2399
|
+
const defaultSelection = React.useMemo(() => colors[defaultColor], [colors, defaultColor]);
|
|
2400
|
+
return /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Select, {
|
|
2401
|
+
label: label,
|
|
2402
|
+
onChange: onChange,
|
|
2403
|
+
items: colors,
|
|
2404
|
+
defaultSelection: defaultSelection,
|
|
2405
|
+
LabelFactory: LabelFactory,
|
|
2406
|
+
"data-testid": "color-select"
|
|
2407
|
+
});
|
|
2408
|
+
};
|
|
2409
|
+
|
|
2410
|
+
/*
|
|
2411
|
+
* SPDX-FileCopyrightText: 2021 Zextras <https://www.zextras.com>
|
|
2412
|
+
*
|
|
2413
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2414
|
+
*/
|
|
2415
|
+
const FolderNameRender = ({
|
|
2416
|
+
folder
|
|
2417
|
+
}) => {
|
|
2418
|
+
const root = useRoot(folder.value ?? '');
|
|
2419
|
+
return /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
2420
|
+
wrap: 'nowrap'
|
|
2421
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
2422
|
+
right: "small"
|
|
2423
|
+
}, /*#__PURE__*/React__default.default.createElement(Square$1, {
|
|
2424
|
+
$color: folder.color
|
|
2425
|
+
})), /*#__PURE__*/React__default.default.createElement(TextUpperCase, null, folder.label), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Row, {
|
|
2426
|
+
takeAvailableSpace: true
|
|
2427
|
+
}, root && root.id !== FOLDERS.USER_ROOT && /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Padding, {
|
|
2428
|
+
left: "small",
|
|
2429
|
+
style: {
|
|
2430
|
+
overflow: 'hidden'
|
|
2431
|
+
}
|
|
2432
|
+
}, /*#__PURE__*/React__default.default.createElement(TextUpperCase, {
|
|
2433
|
+
color: 'gray1'
|
|
2434
|
+
}, `(${root.name})`))));
|
|
2435
|
+
};
|
|
2436
|
+
const FoldersSelector = ({
|
|
2437
|
+
defaultFolderId,
|
|
2438
|
+
onChange,
|
|
2439
|
+
label,
|
|
2440
|
+
folderItems,
|
|
2441
|
+
disabled
|
|
2442
|
+
}) => {
|
|
2443
|
+
const items = React.useMemo(() => lodash.map(folderItems, item => ({
|
|
2444
|
+
label: item.label,
|
|
2445
|
+
value: item.value,
|
|
2446
|
+
color: item.color,
|
|
2447
|
+
customComponent: /*#__PURE__*/React__default.default.createElement(FolderNameRender, {
|
|
2448
|
+
folder: item
|
|
2449
|
+
})
|
|
2450
|
+
})), [folderItems]);
|
|
2451
|
+
const defaultFolderSelection = React.useMemo(() => {
|
|
2452
|
+
const defaultFold = lodash.find(items, ['value', defaultFolderId]);
|
|
2453
|
+
const defaultFolder = {
|
|
2454
|
+
value: defaultFold?.value ?? items?.[0]?.value,
|
|
2455
|
+
label: defaultFold?.label ?? items?.[0]?.label,
|
|
2456
|
+
color: defaultFold?.color ?? items?.[0]?.color
|
|
2457
|
+
};
|
|
2458
|
+
return lodash.find(items, ['value', defaultFolderId]) ?? defaultFolder;
|
|
2459
|
+
}, [items, defaultFolderId]);
|
|
2460
|
+
const onSelectedFolderChange = React.useCallback(id => onChange(id), [onChange]);
|
|
2461
|
+
return items && defaultFolderSelection ? /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Select, {
|
|
2462
|
+
label: label,
|
|
2463
|
+
onChange: onSelectedFolderChange,
|
|
2464
|
+
items: items,
|
|
2465
|
+
defaultSelection: defaultFolderSelection,
|
|
2466
|
+
disablePortal: true,
|
|
2467
|
+
disabled: disabled,
|
|
2468
|
+
LabelFactory: FolderSelectorLabelFactory
|
|
2469
|
+
}) : null;
|
|
2470
|
+
};
|
|
2471
|
+
|
|
2472
|
+
const StyledCustomListItem = /*#__PURE__*/_styled__default.default(carbonioDesignSystem.ListItem, process.env.NODE_ENV === "production" ? {
|
|
2473
|
+
target: "e1jz8t6z0"
|
|
2474
|
+
} : {
|
|
2475
|
+
target: "e1jz8t6z0",
|
|
2476
|
+
label: "StyledCustomListItem"
|
|
2477
|
+
})("transition:none;&:focus,&:active{background:", ({
|
|
2478
|
+
$focusBackgroundColor,
|
|
2479
|
+
theme
|
|
2480
|
+
}) => carbonioDesignSystem.getColor($focusBackgroundColor, theme), ";}&:hover{background:", ({
|
|
2481
|
+
$baseBackgroundColor,
|
|
2482
|
+
theme
|
|
2483
|
+
}) => carbonioDesignSystem.getColor($baseBackgroundColor, theme), ";&:focus,&:active{background:", ({
|
|
2484
|
+
$focusBackgroundColor,
|
|
2485
|
+
theme
|
|
2486
|
+
}) => carbonioDesignSystem.getColor($focusBackgroundColor, theme), ";}}" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpc3QtaXRlbS50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBYUUiLCJmaWxlIjoibGlzdC1pdGVtLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBTUERYLUZpbGVDb3B5cmlnaHRUZXh0OiAyMD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WNrZ3JvdW5kQ29sb3IsIHRoZW1lKX07XG5cdFx0fVxuXHR9XG5gO1xuXG5leHBvcnQgY29uc3QgQ3VzdG9tTGlzdEl0ZW0gPSBSZWFjdC5mb3J3YXJkUmVmPEhUTUxEaXZFbGVtZW50LCBMaXN0SXRlbVByb3BzPihcblx0ZnVuY3Rpb24gQ3VzdG9tTGlzdEl0ZW1Gbihcblx0XHR7XG5cdFx0XHRiYWNrZ3JvdW5kID0gJ2dyYXk2Jyxcblx0XHRcdGFjdGl2ZSxcblx0XHRcdGFjdGl2ZUJhY2tncm91bmQgPSAnaGlnaGxpZ2h0Jyxcblx0XHRcdHNlbGVjdGVkLFxuXHRcdFx0c2VsZWN0ZWRCYWNrZ3JvdW5kID0gJ2dyYXk1Jyxcblx0XHRcdC4uLnJlc3Rcblx0XHR9LFxuXHRcdHJlZlxuXHQpIHtcblx0XHRyZXR1cm4gKFxuXHRcdFx0PFN0eWxlZEN1c3RvbUxpc3RJdGVtXG5cdFx0XHRcdHJlZj17cmVmfVxuXHRcdFx0XHQkYmFzZUJhY2tncm91bmRDb2xvcj17XG5cdFx0XHRcdFx0KGFjdGl2ZSAmJiBhY3RpdmVCYWNrZ3JvdW5kKSB8fCAoc2VsZWN0ZWQgJiYgc2VsZWN0ZWRCYWNrZ3JvdW5kKSB8fCBiYWNrZ3JvdW5kXG5cdFx0XHRcdH1cblx0XHRcdFx0JGZvY3VzQmFja2dyb3VuZENvbG9yPXtgJHsoYWN0aXZlICYmIGFjdGl2ZUJhY2tncm91bmQpIHx8ICdncmF5Nid9LmZvY3VzYH1cblx0XHRcdFx0ey4uLnJlc3R9XG5cdFx0XHQvPlxuXHRcdCk7XG5cdH1cbik7XG4iXX0= */"));
|
|
2487
|
+
const CustomListItem = /*#__PURE__*/React__default.default.forwardRef(function CustomListItemFn({
|
|
2488
|
+
background = 'gray6',
|
|
2489
|
+
active,
|
|
2490
|
+
activeBackground = 'highlight',
|
|
2491
|
+
selected,
|
|
2492
|
+
selectedBackground = 'gray5',
|
|
2493
|
+
...rest
|
|
2494
|
+
}, ref) {
|
|
2495
|
+
return /*#__PURE__*/React__default.default.createElement(StyledCustomListItem, _extends({
|
|
2496
|
+
ref: ref,
|
|
2497
|
+
$baseBackgroundColor: active && activeBackground || selected && selectedBackground || background,
|
|
2498
|
+
$focusBackgroundColor: `${active && activeBackground || 'gray6'}.focus`
|
|
2499
|
+
}, rest));
|
|
2500
|
+
});
|
|
2501
|
+
|
|
2502
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2503
|
+
const CustomList = /*#__PURE__*/_styled__default.default(carbonioDesignSystem.List, process.env.NODE_ENV === "production" ? {
|
|
2504
|
+
target: "e1o5zg5y0"
|
|
2505
|
+
} : {
|
|
2506
|
+
target: "e1o5zg5y0",
|
|
2507
|
+
label: "CustomList"
|
|
2508
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
2509
|
+
name: "1c1pxwn",
|
|
2510
|
+
styles: "padding-bottom:0.25rem;min-height:0"
|
|
2511
|
+
} : {
|
|
2512
|
+
name: "1c1pxwn",
|
|
2513
|
+
styles: "padding-bottom:0.25rem;min-height:0/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpc3QudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVFzQyIsImZpbGUiOiJsaXN0LnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBTUERYLUZpbGVDb3B5cmlnaHRUZXh0OiAyMDIzIFpleHRyYXMgPGh0dHBzOi8vd3d3LnpleHRyYXMuY29tPlxuICpcbiAqIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBBR1BMLTMuMC1vbmx5XG4gKi9cbmltcG9ydCB7IExpc3QgfSBmcm9tICdAemV4dHJhcy9jYXJib25pby1kZXNpZ24tc3lzdGVtJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuZXhwb3J0IGNvbnN0IEN1c3RvbUxpc3QgPSBzdHlsZWQoTGlzdClgXG5cdHBhZGRpbmctYm90dG9tOiAwLjI1cmVtO1xuXHRtaW4taGVpZ2h0OiAwO1xuYDtcbiJdfQ== */",
|
|
2514
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
2515
|
+
});
|
|
2516
|
+
|
|
2517
|
+
/*
|
|
2518
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
2519
|
+
*
|
|
2520
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2521
|
+
*/
|
|
2522
|
+
|
|
2523
|
+
const createTag = tag => carbonioUiSoapLib.legacySoapFetch('CreateTag', {
|
|
2524
|
+
_jsns: 'urn:zimbraMail',
|
|
2525
|
+
tag
|
|
2526
|
+
});
|
|
2527
|
+
const deleteTag = id => carbonioUiSoapLib.legacySoapFetch('TagAction', {
|
|
2528
|
+
_jsns: 'urn:zimbraMail',
|
|
2529
|
+
action: {
|
|
2530
|
+
op: 'delete',
|
|
2531
|
+
id
|
|
2532
|
+
}
|
|
2533
|
+
});
|
|
2534
|
+
const renameTag = (id, name) => carbonioUiSoapLib.legacySoapFetch('TagAction', {
|
|
2535
|
+
_jsns: 'urn:zimbraMail',
|
|
2536
|
+
action: {
|
|
2537
|
+
op: 'rename',
|
|
2538
|
+
id,
|
|
2539
|
+
name
|
|
2540
|
+
}
|
|
2541
|
+
});
|
|
2542
|
+
const changeTagColor = (id, color) => carbonioUiSoapLib.legacySoapFetch('TagAction', {
|
|
2543
|
+
_jsns: 'urn:zimbraMail',
|
|
2544
|
+
action: typeof color === 'number' ? {
|
|
2545
|
+
op: 'color',
|
|
2546
|
+
color,
|
|
2547
|
+
id
|
|
2548
|
+
} : {
|
|
2549
|
+
op: 'color',
|
|
2550
|
+
rgb: color,
|
|
2551
|
+
id
|
|
2552
|
+
}
|
|
2553
|
+
});
|
|
2554
|
+
|
|
2555
|
+
/*
|
|
2556
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
2557
|
+
*
|
|
2558
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2559
|
+
*/
|
|
2560
|
+
|
|
2561
|
+
const DeleteTagModal = ({
|
|
2562
|
+
onClose,
|
|
2563
|
+
tag
|
|
2564
|
+
}) => {
|
|
2565
|
+
const [t] = reactI18next.useTranslation();
|
|
2566
|
+
const createSnackbar = carbonioDesignSystem.useSnackbar();
|
|
2567
|
+
const title = React.useMemo(() => t('label.delete_tag_name', {
|
|
2568
|
+
name: tag?.name,
|
|
2569
|
+
defaultValue: 'Delete "{{name}}" tag'
|
|
2570
|
+
}), [tag?.name, t]);
|
|
2571
|
+
const onConfirm = React.useCallback(() => {
|
|
2572
|
+
if (tag) deleteTag(tag?.id).then(res => {
|
|
2573
|
+
if (res.action) {
|
|
2574
|
+
createSnackbar({
|
|
2575
|
+
key: `delete-tag`,
|
|
2576
|
+
replace: true,
|
|
2577
|
+
severity: 'success',
|
|
2578
|
+
label: t('messages.snackbar.tag_deleted', {
|
|
2579
|
+
name: tag?.name,
|
|
2580
|
+
defaultValue: '{{name}} Tag deleted successfully'
|
|
2581
|
+
}),
|
|
2582
|
+
autoHideTimeout: 3000,
|
|
2583
|
+
hideButton: true
|
|
2584
|
+
});
|
|
2585
|
+
}
|
|
2586
|
+
onClose();
|
|
2587
|
+
});
|
|
2588
|
+
}, [createSnackbar, onClose, t, tag]);
|
|
2589
|
+
return /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, /*#__PURE__*/React__default.default.createElement(ModalHeader, {
|
|
2590
|
+
onClose: onClose,
|
|
2591
|
+
title: title
|
|
2592
|
+
}), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Container, {
|
|
2593
|
+
padding: {
|
|
2594
|
+
horizontal: 'large'
|
|
2595
|
+
}
|
|
2596
|
+
}, /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Text, null, t('message.delete_tag_message1', {
|
|
2597
|
+
name: tag?.name,
|
|
2598
|
+
defaultValue: `Are you sure to delete "{{name}}" Tag?`
|
|
2599
|
+
})), /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.Text, {
|
|
2600
|
+
overflow: "break-word",
|
|
2601
|
+
style: {
|
|
2602
|
+
textAlign: 'center'
|
|
2603
|
+
}
|
|
2604
|
+
}, t('message.delete_tag_message2', 'Once deleted, it will be removed from every item marked with it.'))), /*#__PURE__*/React__default.default.createElement(ModalFooter, {
|
|
2605
|
+
onConfirm: onConfirm,
|
|
2606
|
+
label: t('label.delete', 'Delete'),
|
|
2607
|
+
disabled: false,
|
|
2608
|
+
color: "error"
|
|
2609
|
+
}));
|
|
2610
|
+
};
|
|
2611
|
+
|
|
2612
|
+
/*
|
|
2613
|
+
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
|
|
2614
|
+
*
|
|
2615
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2616
|
+
*/
|
|
2617
|
+
const getFolderRequest = async ({
|
|
2618
|
+
id,
|
|
2619
|
+
view
|
|
2620
|
+
}, account) => {
|
|
2621
|
+
const body = lodash.omitBy({
|
|
2622
|
+
_jsns: 'urn:zimbraMail',
|
|
2623
|
+
folder: id ? {
|
|
2624
|
+
l: id
|
|
2625
|
+
} : undefined,
|
|
2626
|
+
view,
|
|
2627
|
+
tr: 1
|
|
2628
|
+
}, lodash.isNil);
|
|
2629
|
+
return carbonioUiSoapLib.legacySoapFetch('GetFolder', body, account);
|
|
2630
|
+
};
|
|
2631
|
+
|
|
2632
|
+
/*
|
|
2633
|
+
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
|
|
2634
|
+
*
|
|
2635
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2636
|
+
*/
|
|
2637
|
+
const getShareInfoRequest = async () => {
|
|
2638
|
+
const result = await carbonioUiSoapLib.legacySoapFetch('GetShareInfo', {
|
|
2639
|
+
_jsns: 'urn:zimbraAccount',
|
|
2640
|
+
includeSelf: 0
|
|
2641
|
+
});
|
|
2642
|
+
if ('Fault' in result) {
|
|
2643
|
+
return Promise.reject(result.Fault);
|
|
2644
|
+
}
|
|
2645
|
+
return Promise.resolve({
|
|
2646
|
+
isFulfilled: !lodash.isEmpty(result),
|
|
2647
|
+
folders: result?.share ?? []
|
|
2648
|
+
});
|
|
2649
|
+
};
|
|
2650
|
+
|
|
2651
|
+
/*
|
|
2652
|
+
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
|
|
2653
|
+
*
|
|
2654
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2655
|
+
*/
|
|
2656
|
+
const getFoldersByAccounts = async (sharedAccounts, view) => Promise.all(lodash.map(sharedAccounts, async ({
|
|
2657
|
+
ownerEmail
|
|
2658
|
+
}) => {
|
|
2659
|
+
const response = await getFolderRequest({
|
|
2660
|
+
view
|
|
2661
|
+
}, ownerEmail);
|
|
2662
|
+
if (response?.folder?.length) {
|
|
2663
|
+
return {
|
|
2664
|
+
...response.folder[0],
|
|
2665
|
+
oname: response.folder[0].name,
|
|
2666
|
+
owner: ownerEmail,
|
|
2667
|
+
name: ownerEmail
|
|
2668
|
+
};
|
|
2669
|
+
}
|
|
2670
|
+
return response;
|
|
2671
|
+
}));
|
|
2672
|
+
const useInitializeFolders = view => {
|
|
2673
|
+
const isLoading = React.useRef(false);
|
|
2674
|
+
const {
|
|
2675
|
+
createModal,
|
|
2676
|
+
closeModal
|
|
2677
|
+
} = carbonioDesignSystem.useModal();
|
|
2678
|
+
const fetchFolders = React.useCallback(async () => {
|
|
2679
|
+
Promise.all([getFolderRequest({
|
|
2680
|
+
view
|
|
2681
|
+
}), getShareInfoRequest()]).then(async ([getFolderResponse, getShareInfoResponse]) => {
|
|
2682
|
+
isLoading.current = true;
|
|
2683
|
+
if (getShareInfoResponse.folders) {
|
|
2684
|
+
const sharedAccounts = lodash.filter(getShareInfoResponse.folders, ['folderId', 1]);
|
|
2685
|
+
const filteredLinks = lodash.reject(getFolderResponse.folder[0].link, ['rid', 1]);
|
|
2686
|
+
const folders = sharedAccounts.length ? [{
|
|
2687
|
+
...getFolderResponse.folder[0],
|
|
2688
|
+
link: filteredLinks
|
|
2689
|
+
}, ...(await getFoldersByAccounts(sharedAccounts, view))] : [{
|
|
2690
|
+
...getFolderResponse.folder[0],
|
|
2691
|
+
link: filteredLinks
|
|
2692
|
+
}];
|
|
2693
|
+
folderWorker.postMessage({
|
|
2694
|
+
op: 'refresh',
|
|
2695
|
+
currentView: view,
|
|
2696
|
+
folder: folders ?? []
|
|
2697
|
+
});
|
|
2698
|
+
} else {
|
|
2699
|
+
folderWorker.postMessage({
|
|
2700
|
+
op: 'refresh',
|
|
2701
|
+
currentView: view,
|
|
2702
|
+
folder: getFolderResponse.folder ?? []
|
|
2703
|
+
});
|
|
2704
|
+
}
|
|
2705
|
+
}).catch(() => {
|
|
2706
|
+
const id = 'error-initialize-modal';
|
|
2707
|
+
createModal({
|
|
2708
|
+
id,
|
|
2709
|
+
children: /*#__PURE__*/React__default.default.createElement(FolderInitializationErrorModal, {
|
|
2710
|
+
onClose: () => closeModal(id)
|
|
2711
|
+
})
|
|
2712
|
+
}, true);
|
|
2713
|
+
}).finally(() => {
|
|
2714
|
+
isLoading.current = false;
|
|
2715
|
+
});
|
|
2716
|
+
}, [closeModal, createModal, view]);
|
|
2717
|
+
React.useEffect(() => {
|
|
2718
|
+
if (!isLoading.current && view) {
|
|
2719
|
+
fetchFolders();
|
|
2720
|
+
}
|
|
2721
|
+
}, [fetchFolders, view]);
|
|
2722
|
+
};
|
|
2723
|
+
|
|
2724
|
+
/*
|
|
2725
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
2726
|
+
*
|
|
2727
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2728
|
+
*/
|
|
2729
|
+
|
|
2730
|
+
|
|
2731
|
+
/**
|
|
2732
|
+
* TODO remove this file and use an export from @zextras/carbonio-ui-soap-lib
|
|
2733
|
+
* @see https://zextras.atlassian.net/browse/CO-2160
|
|
2734
|
+
*/
|
|
2735
|
+
|
|
2736
|
+
/**
|
|
2737
|
+
* @deprecated use the export from @zextras/carbonio-ui-soap-lib
|
|
2738
|
+
*/
|
|
2739
|
+
const NoOp = async () => {
|
|
2740
|
+
const request = {
|
|
2741
|
+
_jsns: JSNS.MAIL
|
|
2742
|
+
};
|
|
2743
|
+
const response = await carbonioUiSoapLib.legacySoapFetch('NoOp', request);
|
|
2744
|
+
if ('Fault' in response) {
|
|
2745
|
+
throw new Error(response.Fault.Reason.Text);
|
|
2746
|
+
}
|
|
2747
|
+
};
|
|
2748
|
+
|
|
2749
|
+
/*
|
|
2750
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
2751
|
+
*
|
|
2752
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2753
|
+
*/
|
|
2754
|
+
const useUpdateView = () => {
|
|
2755
|
+
const handler = React.useCallback(() => {
|
|
2756
|
+
NoOp();
|
|
2757
|
+
}, []);
|
|
2758
|
+
React.useEffect(() => {
|
|
2759
|
+
window.addEventListener('updateView', handler);
|
|
2760
|
+
return function cleanup() {
|
|
2761
|
+
window.removeEventListener('updateView', handler);
|
|
2762
|
+
};
|
|
2763
|
+
}, [handler]);
|
|
2764
|
+
};
|
|
2765
|
+
|
|
2766
|
+
/*
|
|
2767
|
+
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
|
|
2768
|
+
*
|
|
2769
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2770
|
+
*/
|
|
2771
|
+
const useInitializeTags = () => {
|
|
2772
|
+
const [initialized, setInitialized] = React.useState(false);
|
|
2773
|
+
const refresh = carbonioUiSoapLib.useInfoRefresh();
|
|
2774
|
+
React.useEffect(() => {
|
|
2775
|
+
if (!lodash.isEmpty(refresh) && !initialized) {
|
|
2776
|
+
setInitialized(true);
|
|
2777
|
+
tagsWorker.postMessage({
|
|
2778
|
+
op: 'refresh',
|
|
2779
|
+
tags: refresh.tags
|
|
2780
|
+
});
|
|
2781
|
+
}
|
|
2782
|
+
}, [initialized, refresh]);
|
|
2783
|
+
};
|
|
2784
|
+
|
|
2785
|
+
/*
|
|
2786
|
+
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
|
|
2787
|
+
*
|
|
2788
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2789
|
+
*/
|
|
2790
|
+
const isValidFolderName = folderName => {
|
|
2791
|
+
// Check if the folder name is empty
|
|
2792
|
+
if (!folderName.trim()) {
|
|
2793
|
+
return false;
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
// Regular expression pattern for invalid characters
|
|
2797
|
+
const invalidChars = /["/:]/;
|
|
2798
|
+
|
|
2799
|
+
// Check if the folder name contains any invalid characters
|
|
2800
|
+
if (invalidChars.test(folderName)) {
|
|
2801
|
+
return false;
|
|
2802
|
+
}
|
|
2803
|
+
|
|
2804
|
+
// Check if the folder name is too long (limit it to 128 characters)
|
|
2805
|
+
if (folderName.length > 128) {
|
|
2806
|
+
return false;
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
// If all checks pass, the folder name is considered valid
|
|
2810
|
+
return true;
|
|
2811
|
+
};
|
|
2812
|
+
const allowedActionOnSharedAccount = (folder, action) => {
|
|
2813
|
+
const permission = folder.perm;
|
|
2814
|
+
switch (action) {
|
|
2815
|
+
case FolderActionsType.NEW:
|
|
2816
|
+
if (permission) if (permission.includes('rwidx')) {
|
|
2817
|
+
return true;
|
|
2818
|
+
} else {
|
|
2819
|
+
return false;
|
|
2820
|
+
}
|
|
2821
|
+
return true;
|
|
2822
|
+
case FolderActionsType.SHARE:
|
|
2823
|
+
if (permission) if (permission.includes('rwidxa')) {
|
|
2824
|
+
return true;
|
|
2825
|
+
} else {
|
|
2826
|
+
return false;
|
|
2827
|
+
}
|
|
2828
|
+
return true;
|
|
2829
|
+
default:
|
|
2830
|
+
return true;
|
|
2831
|
+
}
|
|
2832
|
+
};
|
|
2833
|
+
|
|
2834
|
+
/*
|
|
2835
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
2836
|
+
*
|
|
2837
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2838
|
+
*/
|
|
2839
|
+
const legacyFallback = text => {
|
|
2840
|
+
const textArea = window.parent.document.createElement('textarea');
|
|
2841
|
+
window.parent.document.body.appendChild(textArea);
|
|
2842
|
+
textArea.value = text;
|
|
2843
|
+
textArea.select();
|
|
2844
|
+
const success = window.parent.document.execCommand('copy');
|
|
2845
|
+
window.parent.document.body.removeChild(textArea);
|
|
2846
|
+
return new Promise((resolve, reject) => {
|
|
2847
|
+
success ? resolve() : reject();
|
|
2848
|
+
});
|
|
2849
|
+
};
|
|
2850
|
+
const copyToClipboard = text => {
|
|
2851
|
+
if (!window.parent.navigator.clipboard) {
|
|
2852
|
+
return legacyFallback(text);
|
|
2853
|
+
}
|
|
2854
|
+
return window.parent.navigator.clipboard.writeText(text);
|
|
2855
|
+
};
|
|
2856
|
+
|
|
2857
|
+
/*
|
|
2858
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
2859
|
+
*
|
|
2860
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2861
|
+
*/
|
|
2862
|
+
const getPrefs = () => {
|
|
2863
|
+
const {
|
|
2864
|
+
prefs
|
|
2865
|
+
} = carbonioShellUi.getUserSettings();
|
|
2866
|
+
return prefs;
|
|
2867
|
+
};
|
|
2868
|
+
|
|
2869
|
+
/*
|
|
2870
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
2871
|
+
*
|
|
2872
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2873
|
+
*/
|
|
2874
|
+
const usePrefs = () => {
|
|
2875
|
+
const {
|
|
2876
|
+
prefs
|
|
2877
|
+
} = carbonioShellUi.useUserSettings();
|
|
2878
|
+
return prefs;
|
|
2879
|
+
};
|
|
2880
|
+
|
|
2881
|
+
/*
|
|
2882
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
2883
|
+
*
|
|
2884
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2885
|
+
*/
|
|
2886
|
+
|
|
2887
|
+
class SoapApiError extends Error {
|
|
2888
|
+
constructor(fault) {
|
|
2889
|
+
super(fault.Reason.Text);
|
|
2890
|
+
this.fault = fault;
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
/*
|
|
2895
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
2896
|
+
*
|
|
2897
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2898
|
+
*/
|
|
2899
|
+
|
|
2900
|
+
function getErrorMessage(error, t) {
|
|
2901
|
+
if (error instanceof SoapApiError) {
|
|
2902
|
+
return error.getLocalizedMessage(t);
|
|
2903
|
+
}
|
|
2904
|
+
return t('label.error_try_again', 'Something went wrong, please try again');
|
|
2905
|
+
}
|
|
2906
|
+
|
|
2907
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
2908
|
+
/*
|
|
2909
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
2910
|
+
*
|
|
2911
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2912
|
+
*/
|
|
2913
|
+
|
|
2914
|
+
function parseEmail(input) {
|
|
2915
|
+
const extracted = extractEmail(input);
|
|
2916
|
+
return isValidEmail(extracted) ? extracted : undefined;
|
|
2917
|
+
}
|
|
2918
|
+
function isValidEmail(email) {
|
|
2919
|
+
// eslint-disable-next-line max-len, prettier/prettier, no-useless-escape
|
|
2920
|
+
const validEmailRegex = /^(?!\.)[\p{L}\p{N}.+_\-]+@[\p{L}\p{N}.+-]+\.[\p{L}\p{N}]{2,}$/u;
|
|
2921
|
+
return validEmailRegex.test(String(email).toLowerCase());
|
|
2922
|
+
}
|
|
2923
|
+
function extractEmail(input) {
|
|
2924
|
+
const trimmedInput = input.trim();
|
|
2925
|
+
const caputured = /.*<(.*)>/.exec(trimmedInput);
|
|
2926
|
+
if (caputured && caputured.length > 1) {
|
|
2927
|
+
return caputured[1].trim();
|
|
2928
|
+
}
|
|
2929
|
+
return trimmedInput;
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
/*
|
|
2933
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
2934
|
+
*
|
|
2935
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2936
|
+
*/
|
|
2937
|
+
|
|
2938
|
+
async function apiWrapper(promise) {
|
|
2939
|
+
return Promise.allSettled([promise]).then(async ([result]) => {
|
|
2940
|
+
if (result.status === 'fulfilled') {
|
|
2941
|
+
const responseBody = await result.value.text();
|
|
2942
|
+
return responseBody ? {
|
|
2943
|
+
data: JSON.parse(responseBody)
|
|
2944
|
+
} : {
|
|
2945
|
+
data: {}
|
|
2946
|
+
};
|
|
2947
|
+
}
|
|
2948
|
+
return {
|
|
2949
|
+
error: result.reason
|
|
2950
|
+
};
|
|
2951
|
+
});
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2954
|
+
/*
|
|
2955
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
2956
|
+
*
|
|
2957
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
2958
|
+
*/
|
|
2959
|
+
|
|
2960
|
+
function getSharedAccounts() {
|
|
2961
|
+
return getShareInfoRequest().then(res => {
|
|
2962
|
+
const sharedAccounts = [];
|
|
2963
|
+
if (res?.folders) {
|
|
2964
|
+
const sharedRootFolders = lodash.filter(res.folders, ['folderId', 1]);
|
|
2965
|
+
sharedRootFolders.forEach(account => {
|
|
2966
|
+
if (account.ownerId && account.ownerEmail) {
|
|
2967
|
+
sharedAccounts.push({
|
|
2968
|
+
id: account.ownerId,
|
|
2969
|
+
address: account.ownerEmail
|
|
2970
|
+
});
|
|
2971
|
+
}
|
|
2972
|
+
});
|
|
2973
|
+
}
|
|
2974
|
+
return sharedAccounts;
|
|
2975
|
+
});
|
|
2976
|
+
}
|
|
2977
|
+
function getDefaultAccount() {
|
|
2978
|
+
const account = carbonioShellUi.getUserAccount();
|
|
2979
|
+
if (!account) {
|
|
2980
|
+
return undefined;
|
|
2981
|
+
}
|
|
2982
|
+
return {
|
|
2983
|
+
id: account.id,
|
|
2984
|
+
address: account.name
|
|
2985
|
+
};
|
|
2986
|
+
}
|
|
2987
|
+
async function getOrderedAccountIds(priorityAccountAddress) {
|
|
2988
|
+
const sharedAccounts = await getSharedAccounts();
|
|
2989
|
+
const defaultAccount = getDefaultAccount();
|
|
2990
|
+
const finalList = defaultAccount ? [defaultAccount].concat(...sharedAccounts) : sharedAccounts;
|
|
2991
|
+
const sortedList = lodash.sortBy(finalList, item => item.address === priorityAccountAddress ? 0 : 1);
|
|
2992
|
+
return lodash.map(sortedList, item => item.id);
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2995
|
+
/**
|
|
2996
|
+
* The name of the primary identity
|
|
2997
|
+
*/
|
|
2998
|
+
const PRIMARY_IDENTITY_NAME = 'DEFAULT';
|
|
2999
|
+
const NO_ACCOUNT_NAME = 'No account';
|
|
3000
|
+
|
|
3001
|
+
/**
|
|
3002
|
+
* The type of the identities whose address does not match with any of the available addresses
|
|
3003
|
+
*/
|
|
3004
|
+
const UNKNOWN_IDENTITY_DEFAULT_TYPE = 'alias';
|
|
3005
|
+
|
|
3006
|
+
/**
|
|
3007
|
+
* Returns the list of all the available addresses for the account and their type
|
|
3008
|
+
*/
|
|
3009
|
+
const getAvailableAddresses = () => {
|
|
3010
|
+
const account = carbonioShellUi.getUserAccount();
|
|
3011
|
+
const settings = carbonioShellUi.getUserSettings();
|
|
3012
|
+
const result = [];
|
|
3013
|
+
|
|
3014
|
+
// Adds the email address of the primary account
|
|
3015
|
+
result.push({
|
|
3016
|
+
address: account?.name ?? NO_ACCOUNT_NAME,
|
|
3017
|
+
type: 'primary',
|
|
3018
|
+
ownerAccount: account?.name ?? NO_ACCOUNT_NAME
|
|
3019
|
+
});
|
|
3020
|
+
|
|
3021
|
+
// Adds all the aliases
|
|
3022
|
+
if (settings.attrs.zimbraMailAlias) {
|
|
3023
|
+
if (lodash.isArray(settings.attrs.zimbraMailAlias)) {
|
|
3024
|
+
result.push(...settings.attrs.zimbraMailAlias.map(alias => ({
|
|
3025
|
+
address: alias,
|
|
3026
|
+
type: 'alias',
|
|
3027
|
+
ownerAccount: account?.name ?? NO_ACCOUNT_NAME
|
|
3028
|
+
})));
|
|
3029
|
+
} else {
|
|
3030
|
+
result.push({
|
|
3031
|
+
address: settings.attrs.zimbraMailAlias,
|
|
3032
|
+
type: 'alias',
|
|
3033
|
+
ownerAccount: account?.name ?? NO_ACCOUNT_NAME
|
|
3034
|
+
});
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
// Adds the email addresses of all the delegation accounts
|
|
3039
|
+
if (account?.rights?.targets) {
|
|
3040
|
+
account.rights.targets.forEach(target => {
|
|
3041
|
+
if (target.target && (target.right === 'sendAs' || target.right === 'sendOnBehalfOf')) {
|
|
3042
|
+
target.target.forEach(user => {
|
|
3043
|
+
if (user.type === 'account' && user.email) {
|
|
3044
|
+
user.email.forEach(email => {
|
|
3045
|
+
result.push({
|
|
3046
|
+
address: email.addr,
|
|
3047
|
+
type: 'delegation',
|
|
3048
|
+
right: target.right,
|
|
3049
|
+
ownerAccount: email.addr
|
|
3050
|
+
});
|
|
3051
|
+
});
|
|
3052
|
+
}
|
|
3053
|
+
});
|
|
3054
|
+
}
|
|
3055
|
+
});
|
|
3056
|
+
}
|
|
3057
|
+
return result;
|
|
3058
|
+
};
|
|
3059
|
+
|
|
3060
|
+
/**
|
|
3061
|
+
*
|
|
3062
|
+
* @param identities
|
|
3063
|
+
*/
|
|
3064
|
+
const sortIdentities = identities => {
|
|
3065
|
+
const allIdentities = [...identities];
|
|
3066
|
+
const defaultIdentity = lodash.remove(allIdentities, identity => identity.name === PRIMARY_IDENTITY_NAME);
|
|
3067
|
+
return [...defaultIdentity, ...allIdentities];
|
|
3068
|
+
};
|
|
3069
|
+
|
|
3070
|
+
/**
|
|
3071
|
+
* @param email
|
|
3072
|
+
* @param rights
|
|
3073
|
+
*/
|
|
3074
|
+
const generateIdentityId = (email, rights) => email + rights;
|
|
3075
|
+
|
|
3076
|
+
/**
|
|
3077
|
+
* Returns the list of all the identities for the account. For each identity a type
|
|
3078
|
+
* is give, by matching the email address with all the available addresses, or by
|
|
3079
|
+
* setting a default one if the address does not match any of the available addresses.
|
|
3080
|
+
*
|
|
3081
|
+
* The function returns also an identity for each account for which the user is a delegate
|
|
3082
|
+
* (sendAs or sendOnBehalfOf) if there is no an already existing identity
|
|
3083
|
+
*/
|
|
3084
|
+
const getIdentitiesDescriptors = () => {
|
|
3085
|
+
const account = carbonioShellUi.getUserAccount();
|
|
3086
|
+
const identities = [];
|
|
3087
|
+
|
|
3088
|
+
// Get the list of all the available email addresses for the account and their type
|
|
3089
|
+
const availableEmailAddresses = getAvailableAddresses();
|
|
3090
|
+
account?.identities?.identity && sortIdentities(account.identities.identity)?.forEach(identity => {
|
|
3091
|
+
const fromAddress = identity._attrs?.zimbraPrefFromAddress ?? '';
|
|
3092
|
+
const fromDisplay = identity._attrs?.zimbraPrefFromDisplay ?? '';
|
|
3093
|
+
|
|
3094
|
+
// The receiving address for the primary identity is the account name
|
|
3095
|
+
const receivingAddress = identity.name === PRIMARY_IDENTITY_NAME ? account.name : fromAddress;
|
|
3096
|
+
|
|
3097
|
+
// Find the first match between the identity receiving email address and the available email addresses
|
|
3098
|
+
const matchingReceivingAddress = availableEmailAddresses.find(availableAddress => availableAddress.address === receivingAddress);
|
|
3099
|
+
const type = matchingReceivingAddress ? matchingReceivingAddress.type : UNKNOWN_IDENTITY_DEFAULT_TYPE;
|
|
3100
|
+
const right = type === 'delegation' && matchingReceivingAddress ? matchingReceivingAddress.right : undefined;
|
|
3101
|
+
identities.push({
|
|
3102
|
+
ownerAccount: matchingReceivingAddress?.ownerAccount ?? account.name,
|
|
3103
|
+
receivingAddress,
|
|
3104
|
+
id: identity._attrs?.zimbraPrefIdentityId ?? '',
|
|
3105
|
+
identityName: identity.name ?? '',
|
|
3106
|
+
identityDisplayName: identity._attrs?.zimbraPrefIdentityName ?? '',
|
|
3107
|
+
fromDisplay,
|
|
3108
|
+
fromAddress,
|
|
3109
|
+
type,
|
|
3110
|
+
right,
|
|
3111
|
+
defaultSignatureId: identity._attrs?.zimbraPrefDefaultSignatureId,
|
|
3112
|
+
forwardReplySignatureId: identity._attrs?.zimbraPrefForwardReplySignatureId
|
|
3113
|
+
});
|
|
3114
|
+
});
|
|
3115
|
+
const delegationAccounts = lodash.filter(account?.rights?.targets, rts => rts.right === 'sendAs' || rts.right === 'sendOnBehalfOf');
|
|
3116
|
+
const delegationIdentities = lodash.flatten(lodash.map(delegationAccounts, ele => lodash.map(ele?.target, item => ({
|
|
3117
|
+
ownerAccount: item.email[0].addr ?? account?.name ?? NO_ACCOUNT_NAME,
|
|
3118
|
+
receivingAddress: item.email[0].addr,
|
|
3119
|
+
id: generateIdentityId(item.email[0].addr, ele.right),
|
|
3120
|
+
identityName: item.d,
|
|
3121
|
+
identityDisplayName: item.d,
|
|
3122
|
+
fromDisplay: item.d,
|
|
3123
|
+
fromAddress: item.email[0].addr,
|
|
3124
|
+
type: 'delegation',
|
|
3125
|
+
right: ele.right
|
|
3126
|
+
}))));
|
|
3127
|
+
const uniqueIdentityList = [...identities];
|
|
3128
|
+
if (delegationIdentities?.length) {
|
|
3129
|
+
lodash.map(delegationIdentities, ele => {
|
|
3130
|
+
const uniqIdentity = lodash.findIndex(identities, {
|
|
3131
|
+
fromAddress: ele.fromAddress
|
|
3132
|
+
});
|
|
3133
|
+
if (uniqIdentity < 0) uniqueIdentityList.push(ele);
|
|
3134
|
+
});
|
|
3135
|
+
return uniqueIdentityList;
|
|
3136
|
+
}
|
|
3137
|
+
return identities;
|
|
3138
|
+
};
|
|
3139
|
+
const getDefaultIdentity = () => getIdentitiesDescriptors().reduce((result, identity) => identity.identityName === PRIMARY_IDENTITY_NAME ? identity : result);
|
|
3140
|
+
|
|
3141
|
+
/**
|
|
3142
|
+
*
|
|
3143
|
+
* @param identity
|
|
3144
|
+
* @param t
|
|
3145
|
+
*/
|
|
3146
|
+
const getIdentityDescription = (identity, t) => {
|
|
3147
|
+
if (!identity) {
|
|
3148
|
+
return null;
|
|
3149
|
+
}
|
|
3150
|
+
const defaultIdentity = getDefaultIdentity();
|
|
3151
|
+
return identity.right === 'sendOnBehalfOf' ? `${t('label.on_behalf_of', 'on behalf of', {
|
|
3152
|
+
accountName: defaultIdentity.fromDisplay ?? '',
|
|
3153
|
+
identity: identity.fromDisplay ?? identity.identityName,
|
|
3154
|
+
otherAccount: identity.fromAddress
|
|
3155
|
+
})}` : `${identity.identityName ?? ''} (${identity.fromDisplay ?? ''} <${identity.fromAddress}>)`;
|
|
3156
|
+
};
|
|
3157
|
+
|
|
3158
|
+
/*
|
|
3159
|
+
* SPDX-FileCopyrightText: 2025 Zextras <https://www.zextras.com>
|
|
3160
|
+
*
|
|
3161
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
3162
|
+
*/
|
|
3163
|
+
|
|
3164
|
+
const SEARCH_QUERY_PREFIXES = {
|
|
3165
|
+
/*
|
|
3166
|
+
* Specifies text that the message must contain. For example,
|
|
3167
|
+
* content:bananas finds all items containing the word "bananas".
|
|
3168
|
+
*/
|
|
3169
|
+
content: 'content',
|
|
3170
|
+
/*
|
|
3171
|
+
* Specifies a sender name or email address that is in the From header.
|
|
3172
|
+
* This can be text, as in "John Smith III", an email address such as
|
|
3173
|
+
* joe@acme.com, or a domain such as zimbra.com.
|
|
3174
|
+
*/
|
|
3175
|
+
from: 'from',
|
|
3176
|
+
/*
|
|
3177
|
+
* Same as from: except that it specifies one of the people to whom the
|
|
3178
|
+
* email was addressed in the To: header.
|
|
3179
|
+
*/
|
|
3180
|
+
to: 'to',
|
|
3181
|
+
/*
|
|
3182
|
+
* Same as from: except that it specifies a recipient in the Cc: header
|
|
3183
|
+
* of the message.
|
|
3184
|
+
*/
|
|
3185
|
+
cc: 'cc',
|
|
3186
|
+
/*
|
|
3187
|
+
* Specifies text that must appear in the subject header of the message.
|
|
3188
|
+
* An example might be subject:new vacation policy.
|
|
3189
|
+
*/
|
|
3190
|
+
subject: 'subject',
|
|
3191
|
+
/*
|
|
3192
|
+
* Specifies a folder. For example, in:sent would show all items in your
|
|
3193
|
+
* Sent folder.
|
|
3194
|
+
*/
|
|
3195
|
+
in: 'in',
|
|
3196
|
+
/*
|
|
3197
|
+
* Specifies an attribute that the message must have. The types of object
|
|
3198
|
+
* you can specify are "attachment", "phone", or "url". For example,
|
|
3199
|
+
* has:attachment would find all messages which contain one or more
|
|
3200
|
+
* attachments of any type.
|
|
3201
|
+
*/
|
|
3202
|
+
has: 'has',
|
|
3203
|
+
/*
|
|
3204
|
+
* Specifies an attachment file name. For example, filename:query.txt
|
|
3205
|
+
* would find messages with a file attachment named "query.txt".
|
|
3206
|
+
*/
|
|
3207
|
+
filename: 'filename',
|
|
3208
|
+
/*
|
|
3209
|
+
* Specifies a search within attachments of a specified type. The types
|
|
3210
|
+
* of attachment you can specify are "text", "word", "excel", and "pdf".
|
|
3211
|
+
* For example, type:word "hello" finds messages with attachments that
|
|
3212
|
+
* are Microsoft Word documents and searches within those attachments for
|
|
3213
|
+
* the word "hello".
|
|
3214
|
+
*/
|
|
3215
|
+
type: 'type',
|
|
3216
|
+
/*
|
|
3217
|
+
* Specifies any item with a certain type of attachment. For example,
|
|
3218
|
+
* attachment:word would find all messages with a Word file attachment.
|
|
3219
|
+
*/
|
|
3220
|
+
attachment: 'attachment',
|
|
3221
|
+
/*
|
|
3222
|
+
* Searches for messages with a certain status. Allowable values are
|
|
3223
|
+
* "unread", "read", "flagged", "unflagged", "sent", "draft",
|
|
3224
|
+
* "received", "replied", "unreplied", "forwarded", "unforwarded",
|
|
3225
|
+
* "anywhere", "remote" (in a shared folder), "local", "sent". For
|
|
3226
|
+
* example, is:unread will find all unread messages.
|
|
3227
|
+
*/
|
|
3228
|
+
is: 'is',
|
|
3229
|
+
/*
|
|
3230
|
+
* Use this keyword to specify a date, using the format that is default
|
|
3231
|
+
* for your browser's locale (for US English the format is mm/dd/yyyy).
|
|
3232
|
+
* For example, date:2/1/2010 would find messages dated February 1,
|
|
3233
|
+
* 2010. The greater than (>) or less than (<) symbols can be used
|
|
3234
|
+
* instead of after or before. >= and <= are also allowed.
|
|
3235
|
+
*/
|
|
3236
|
+
date: 'date',
|
|
3237
|
+
/*
|
|
3238
|
+
* Specifies mail sent after a certain date. For example, after:2/1/2010
|
|
3239
|
+
* specify mail sent after February 1, 2010.
|
|
3240
|
+
*/
|
|
3241
|
+
after: 'after',
|
|
3242
|
+
/*
|
|
3243
|
+
* Same as after: except specifies mail sent before the specified date.
|
|
3244
|
+
*/
|
|
3245
|
+
before: 'before',
|
|
3246
|
+
/*
|
|
3247
|
+
* Specifies messages whose total size, including attachments, is a
|
|
3248
|
+
* specified number of bytes, kilobytes, or megabytes. For example,
|
|
3249
|
+
* size:12kb would find messages that are exactly 12K in size. The
|
|
3250
|
+
* greater than (>) or less than (<) symbols can be used instead of
|
|
3251
|
+
* bigger or smaller.
|
|
3252
|
+
*/
|
|
3253
|
+
size: 'size',
|
|
3254
|
+
/*
|
|
3255
|
+
* Similar to size: except specifies greater than the specified size.
|
|
3256
|
+
*/
|
|
3257
|
+
larger: 'larger',
|
|
3258
|
+
/*
|
|
3259
|
+
* Similar to size: except specifies smaller than the specified size.
|
|
3260
|
+
*/
|
|
3261
|
+
smaller: 'smaller',
|
|
3262
|
+
/*
|
|
3263
|
+
* Finds email messages that do not have a reply to them yet.
|
|
3264
|
+
*/
|
|
3265
|
+
solo: 'solo',
|
|
3266
|
+
/*
|
|
3267
|
+
* Finds messages which have been tagged with a specified tag. For
|
|
3268
|
+
* example, tag:amber will find message that have a tag called "amber"
|
|
3269
|
+
* applied.
|
|
3270
|
+
*/
|
|
3271
|
+
tag: 'tag',
|
|
3272
|
+
/*
|
|
3273
|
+
* Finds messages, tasks or calendar items based on "high" "low"
|
|
3274
|
+
* priority. For example, priority:high will find items with a priority
|
|
3275
|
+
* setting of high.
|
|
3276
|
+
*/
|
|
3277
|
+
priority: 'priority'
|
|
3278
|
+
};
|
|
3279
|
+
|
|
3280
|
+
/*
|
|
3281
|
+
* SPDX-FileCopyrightText: 2025 Zextras <https://www.zextras.com>
|
|
3282
|
+
*
|
|
3283
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
3284
|
+
*/
|
|
3285
|
+
|
|
3286
|
+
const WHOLE_QUERY_REGEX = new RegExp(`^(?:(${Object.values(SEARCH_QUERY_PREFIXES).join('|')}):)?(.+)$`, 'im');
|
|
3287
|
+
function getChipString(chip) {
|
|
3288
|
+
if (typeof chip.value === 'string' && chip.value !== '') {
|
|
3289
|
+
return chip.value;
|
|
3290
|
+
}
|
|
3291
|
+
if (typeof chip.label === 'string' && chip.label !== '') {
|
|
3292
|
+
return chip.label;
|
|
3293
|
+
}
|
|
3294
|
+
return '';
|
|
3295
|
+
}
|
|
3296
|
+
const QUOTED_TERM_REGEX = /^"([^"]+)"$/im;
|
|
3297
|
+
const MULTIWORD_TERM_REGEX = /^(\S+\s+\S+.*)$/im;
|
|
3298
|
+
const convertSearchChipToString = chip => {
|
|
3299
|
+
const match = getChipString(chip).match(WHOLE_QUERY_REGEX);
|
|
3300
|
+
if (!match) {
|
|
3301
|
+
return getChipString(chip);
|
|
3302
|
+
}
|
|
3303
|
+
const prefixAndColon = match[1] ? `${match[1]}:` : '';
|
|
3304
|
+
const term = match[2].trim();
|
|
3305
|
+
const isQuoted = QUOTED_TERM_REGEX.test(term);
|
|
3306
|
+
const isMultiword = !isQuoted && MULTIWORD_TERM_REGEX.test(term);
|
|
3307
|
+
return isMultiword ? `${prefixAndColon}"${term}"` : `${prefixAndColon}${term}`;
|
|
3308
|
+
};
|
|
3309
|
+
|
|
2
3310
|
/*
|
|
3
3311
|
* SPDX-FileCopyrightText: 2025 Zextras <https://www.zextras.com>
|
|
4
3312
|
*
|
|
5
3313
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
6
3314
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3315
|
+
const useHistoryNavigation = () => {
|
|
3316
|
+
const navigate = reactRouterDom.useNavigate();
|
|
3317
|
+
const replaceHistory = React.useCallback(path => {
|
|
3318
|
+
navigate(path, {
|
|
3319
|
+
replace: true
|
|
3320
|
+
});
|
|
3321
|
+
}, [navigate]);
|
|
3322
|
+
const pushHistory = React.useCallback(path => {
|
|
3323
|
+
navigate(path, {
|
|
3324
|
+
replace: false
|
|
3325
|
+
});
|
|
3326
|
+
}, [navigate]);
|
|
3327
|
+
return React.useMemo(() => ({
|
|
3328
|
+
replaceHistory,
|
|
3329
|
+
pushHistory
|
|
3330
|
+
}), [replaceHistory, pushHistory]);
|
|
3331
|
+
};
|
|
3332
|
+
|
|
3333
|
+
/*
|
|
3334
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
3335
|
+
*
|
|
3336
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
3337
|
+
*/
|
|
3338
|
+
|
|
3339
|
+
const CONTACT_TYPES = {
|
|
3340
|
+
GROUP: 'CONTACT_GROUP',
|
|
3341
|
+
DISTRIBUTION_LIST: 'DISTRIBUTION_LIST',
|
|
3342
|
+
CONTACT: 'CONTACT'
|
|
3343
|
+
};
|
|
3344
|
+
const EDIT_ACTION_ID = 'edit-contact-chip-action';
|
|
3345
|
+
|
|
3346
|
+
const DefaultContactInput = ({
|
|
3347
|
+
onChange,
|
|
3348
|
+
defaultValue,
|
|
3349
|
+
// The following props are not used in this component, but are passed to the ChipInput component
|
|
3350
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3351
|
+
dragAndDropEnabled: _dragAndDropEnabled,
|
|
3352
|
+
// The following props are not used in this component, but are passed to the ChipInput component
|
|
3353
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3354
|
+
orderedAccountIds: _orderedAccountIds,
|
|
3355
|
+
// The following props are not used in this component, but are passed to the ChipInput component
|
|
3356
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3357
|
+
chipLabelFactory: _labelFactory,
|
|
3358
|
+
...rest
|
|
3359
|
+
}) => {
|
|
3360
|
+
const internalOnChange = items => {
|
|
3361
|
+
onChange?.(items);
|
|
3362
|
+
};
|
|
3363
|
+
const internalOnAdd = email => {
|
|
3364
|
+
if (typeof email === 'string') {
|
|
3365
|
+
const validEmail = parseEmail(email);
|
|
3366
|
+
const finalEmail = validEmail ?? email;
|
|
3367
|
+
return {
|
|
3368
|
+
id: finalEmail,
|
|
3369
|
+
label: finalEmail,
|
|
3370
|
+
value: {
|
|
3371
|
+
id: finalEmail,
|
|
3372
|
+
email,
|
|
3373
|
+
type: CONTACT_TYPES.CONTACT
|
|
3374
|
+
},
|
|
3375
|
+
error: !validEmail
|
|
3376
|
+
};
|
|
12
3377
|
}
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
3378
|
+
throw new Error('no value');
|
|
3379
|
+
};
|
|
3380
|
+
return /*#__PURE__*/React__default.default.createElement(carbonioDesignSystem.ChipInput, _extends({}, rest, {
|
|
3381
|
+
pasteSeparators: [',', ';', '\n'],
|
|
3382
|
+
createChipOnPaste: true,
|
|
3383
|
+
defaultValue: defaultValue,
|
|
3384
|
+
separators: [{
|
|
3385
|
+
code: 'Enter',
|
|
3386
|
+
ctrlKey: false
|
|
3387
|
+
}, {
|
|
3388
|
+
code: 'NumpadEnter',
|
|
3389
|
+
ctrlKey: false
|
|
3390
|
+
}, {
|
|
3391
|
+
key: ',',
|
|
3392
|
+
ctrlKey: false
|
|
3393
|
+
}, {
|
|
3394
|
+
key: ';',
|
|
3395
|
+
ctrlKey: false
|
|
3396
|
+
}],
|
|
3397
|
+
onChange: internalOnChange,
|
|
3398
|
+
onAdd: internalOnAdd
|
|
3399
|
+
}));
|
|
3400
|
+
};
|
|
3401
|
+
|
|
3402
|
+
/*
|
|
3403
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
3404
|
+
*
|
|
3405
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
3406
|
+
*/
|
|
3407
|
+
|
|
3408
|
+
const useContactInput = () => {
|
|
3409
|
+
const [ContactInput, integrationAvailable] = carbonioShellUi.useIntegratedComponent('contact-input');
|
|
3410
|
+
if (integrationAvailable) {
|
|
3411
|
+
return ContactInput;
|
|
3412
|
+
}
|
|
3413
|
+
return DefaultContactInput;
|
|
3414
|
+
};
|
|
3415
|
+
|
|
3416
|
+
/*
|
|
3417
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
3418
|
+
*
|
|
3419
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
3420
|
+
*/
|
|
3421
|
+
|
|
3422
|
+
const useRunSearchIntegration = () => {
|
|
3423
|
+
const [runSearchFn, isAvailable] = carbonioShellUi.useIntegratedFunction('search-run-search');
|
|
3424
|
+
return isAvailable ? runSearchFn : undefined;
|
|
3425
|
+
};
|
|
3426
|
+
|
|
3427
|
+
/*
|
|
3428
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
3429
|
+
*
|
|
3430
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
3431
|
+
*/
|
|
3432
|
+
|
|
3433
|
+
|
|
3434
|
+
/**
|
|
3435
|
+
* Implements a generic API error which can be used when no specific error is available
|
|
3436
|
+
*/
|
|
3437
|
+
class GenericSoapApiError extends SoapApiError {
|
|
3438
|
+
/**
|
|
3439
|
+
* Returns the generic localized message for the error
|
|
3440
|
+
* @param t - The translation function
|
|
3441
|
+
* @returns The localized message
|
|
3442
|
+
*/
|
|
3443
|
+
// eslint-disable-next-line class-methods-use-this
|
|
3444
|
+
getLocalizedMessage(t) {
|
|
3445
|
+
return t('label.error_try_again', 'Something went wrong, please try again');
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3449
|
+
/*
|
|
3450
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
3451
|
+
*
|
|
3452
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
3453
|
+
*/
|
|
3454
|
+
|
|
3455
|
+
|
|
3456
|
+
// extra currying as suggested in https://github.com/pmndrs/zustand/blob/main/docs/guides/typescript.md#basic-usage
|
|
3457
|
+
const useTagStore = zustand.create()(() => ({
|
|
3458
|
+
tags: {}
|
|
17
3459
|
}));
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
//
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
3460
|
+
tagsWorker.onmessage = ({
|
|
3461
|
+
data
|
|
3462
|
+
}) => {
|
|
3463
|
+
useTagStore.setState(data);
|
|
3464
|
+
};
|
|
3465
|
+
|
|
3466
|
+
/*
|
|
3467
|
+
* SPDX-FileCopyrightText: 2021 Zextras <https://www.zextras.com>
|
|
3468
|
+
*
|
|
3469
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
3470
|
+
*/
|
|
3471
|
+
|
|
3472
|
+
function sortTags(tags) {
|
|
3473
|
+
return lodash.orderBy(Object.values(tags), tag => tag.name.toLowerCase(), 'asc');
|
|
3474
|
+
}
|
|
3475
|
+
const useTags = ids => useTagStore(state => ids ? lodash.pick(state.tags, ids) : state.tags);
|
|
3476
|
+
const getTags = ids => ids ? lodash.pick(useTagStore.getState().tags, ids) : useTagStore.getState().tags;
|
|
3477
|
+
const useSortedTagsArray = () => useTagStore(state => sortTags(state.tags));
|
|
3478
|
+
|
|
3479
|
+
/*
|
|
3480
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
3481
|
+
*
|
|
3482
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
3483
|
+
*/
|
|
3484
|
+
const ParticipantRole = {
|
|
3485
|
+
FROM: 'f',
|
|
3486
|
+
TO: 't',
|
|
3487
|
+
CARBON_COPY: 'c',
|
|
3488
|
+
BLIND_CARBON_COPY: 'b',
|
|
3489
|
+
REPLY_TO: 'r',
|
|
3490
|
+
SENDER: 's',
|
|
3491
|
+
READ_RECEIPT_NOTIFICATION: 'n',
|
|
3492
|
+
RESENT_FROM: 'rf'
|
|
3493
|
+
};
|
|
3494
|
+
|
|
3495
|
+
/*
|
|
3496
|
+
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
|
|
3497
|
+
*
|
|
3498
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
3499
|
+
*/
|
|
3500
|
+
onmessage = handleMessage;
|
|
3501
|
+
|
|
3502
|
+
/*
|
|
3503
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
3504
|
+
*
|
|
3505
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
3506
|
+
*/
|
|
3507
|
+
|
|
3508
|
+
const handleTagRefresh = tags => {
|
|
3509
|
+
if (typeof tags !== 'undefined') {
|
|
3510
|
+
return tags.reduce((acc, val) => {
|
|
3511
|
+
// eslint-disable-next-line no-param-reassign
|
|
3512
|
+
acc[val.id] = val;
|
|
3513
|
+
return acc;
|
|
3514
|
+
}, {});
|
|
3515
|
+
}
|
|
3516
|
+
return {};
|
|
3517
|
+
};
|
|
3518
|
+
const handleTagCreated = (tags, created) => {
|
|
3519
|
+
if (!created) return tags;
|
|
3520
|
+
return created.reduce((acc, val) => {
|
|
3521
|
+
// eslint-disable-next-line no-param-reassign
|
|
3522
|
+
acc[val.id] = val;
|
|
3523
|
+
return acc;
|
|
3524
|
+
}, tags);
|
|
3525
|
+
};
|
|
3526
|
+
const handleTagModified = (tags, modified) => {
|
|
3527
|
+
if (!modified) return tags;
|
|
3528
|
+
return modified.reduce((acc, val) => {
|
|
3529
|
+
if (val.id) {
|
|
3530
|
+
// eslint-disable-next-line no-param-reassign
|
|
3531
|
+
acc[val.id] = {
|
|
3532
|
+
...tags[val.id],
|
|
3533
|
+
...val
|
|
3534
|
+
};
|
|
3535
|
+
}
|
|
3536
|
+
return acc;
|
|
3537
|
+
}, tags);
|
|
3538
|
+
};
|
|
3539
|
+
const handleTagDeleted = (tags, deleted) => {
|
|
3540
|
+
if (!deleted) return tags;
|
|
3541
|
+
return deleted.reduce((acc, val) => {
|
|
3542
|
+
// eslint-disable-next-line no-param-reassign
|
|
3543
|
+
delete acc[val];
|
|
3544
|
+
return acc;
|
|
3545
|
+
}, tags);
|
|
3546
|
+
};
|
|
3547
|
+
const handleTagNotify = (notify, state) => handleTagDeleted(handleTagModified(handleTagCreated(state, notify.created?.tag), notify.modified?.tag), notify.deleted);
|
|
3548
|
+
function deletedIdsContainTags({
|
|
3549
|
+
deletedIds,
|
|
3550
|
+
tagIds
|
|
3551
|
+
}) {
|
|
3552
|
+
return deletedIds.some(deletedId => tagIds?.includes(deletedId));
|
|
3553
|
+
}
|
|
3554
|
+
onmessage = ({
|
|
3555
|
+
data
|
|
3556
|
+
}) => {
|
|
3557
|
+
if (data.op === 'refresh' && data.tags) postMessage({
|
|
3558
|
+
tags: handleTagRefresh(data.tags.tag)
|
|
3559
|
+
});
|
|
3560
|
+
const tagIds = data.state && Object.keys(data.state);
|
|
3561
|
+
if (data.op === 'notify' && (data.notify.created?.tag || data.notify.modified?.tag || data.notify.deleted && deletedIdsContainTags({
|
|
3562
|
+
deletedIds: data.notify.deleted,
|
|
3563
|
+
tagIds
|
|
3564
|
+
}))) postMessage({
|
|
3565
|
+
tags: handleTagNotify(data.notify, data.state)
|
|
3566
|
+
});
|
|
3567
|
+
};
|
|
3568
|
+
|
|
3569
|
+
exports.CONTACT_TYPES = CONTACT_TYPES;
|
|
3570
|
+
exports.ColorContainer = ColorContainer;
|
|
3571
|
+
exports.ColorSelect = ColorSelect;
|
|
3572
|
+
exports.CustomList = CustomList;
|
|
3573
|
+
exports.CustomListItem = CustomListItem;
|
|
3574
|
+
exports.DRAG_DATA_TYPE = DRAG_DATA_TYPE;
|
|
3575
|
+
exports.DefaultContactInput = DefaultContactInput;
|
|
3576
|
+
exports.DeleteTagModal = DeleteTagModal;
|
|
3577
|
+
exports.EDIT_ACTION_ID = EDIT_ACTION_ID;
|
|
3578
|
+
exports.FOLDERS = FOLDERS;
|
|
3579
|
+
exports.FOLDER_VIEW = FOLDER_VIEW;
|
|
3580
|
+
exports.FlatFolder = FlatFolder;
|
|
3581
|
+
exports.FlatFolders = FlatFolders;
|
|
3582
|
+
exports.FlatRoot = FlatRoot;
|
|
3583
|
+
exports.FolderAccordionCustomComponent = FolderAccordionCustomComponent;
|
|
3584
|
+
exports.FolderActionsType = FolderActionsType;
|
|
3585
|
+
exports.FolderInitializationErrorModal = FolderInitializationErrorModal;
|
|
3586
|
+
exports.FolderSelector = FolderSelector;
|
|
3587
|
+
exports.FolderSelectorLabelFactory = FolderSelectorLabelFactory;
|
|
3588
|
+
exports.FoldersAccordion = FoldersAccordion;
|
|
3589
|
+
exports.FoldersSelector = FoldersSelector;
|
|
3590
|
+
exports.GenericSoapApiError = GenericSoapApiError;
|
|
3591
|
+
exports.JSNS = JSNS;
|
|
3592
|
+
exports.ModalFooter = ModalFooter;
|
|
3593
|
+
exports.ModalHeader = ModalHeader;
|
|
3594
|
+
exports.NoOp = NoOp;
|
|
3595
|
+
exports.ParticipantRole = ParticipantRole;
|
|
3596
|
+
exports.ROOT_NAME = ROOT_NAME;
|
|
3597
|
+
exports.SEARCH_QUERY_PREFIXES = SEARCH_QUERY_PREFIXES;
|
|
3598
|
+
exports.SidebarAccordionMui = SidebarAccordionMui;
|
|
3599
|
+
exports.SoapApiError = SoapApiError;
|
|
3600
|
+
exports.Square = Square$1;
|
|
3601
|
+
exports.StaticBreadcrumbs = StaticBreadcrumbs;
|
|
3602
|
+
exports.StatusIcon = StatusIcon;
|
|
3603
|
+
exports.TagsActionsType = TagsActionsType;
|
|
3604
|
+
exports.TextUpperCase = TextUpperCase;
|
|
3605
|
+
exports.ZIMBRA_STANDARD_COLORS = ZIMBRA_STANDARD_COLORS;
|
|
3606
|
+
exports.allowedActionOnSharedAccount = allowedActionOnSharedAccount;
|
|
3607
|
+
exports.apiWrapper = apiWrapper;
|
|
3608
|
+
exports.changeTagColor = changeTagColor;
|
|
3609
|
+
exports.convertSearchChipToString = convertSearchChipToString;
|
|
3610
|
+
exports.copyToClipboard = copyToClipboard;
|
|
3611
|
+
exports.createTag = createTag;
|
|
3612
|
+
exports.deleteTag = deleteTag;
|
|
3613
|
+
exports.filterNodes = filterNodes;
|
|
3614
|
+
exports.flattenAndFilterFoldersWithCap = flattenAndFilterFoldersWithCap;
|
|
3615
|
+
exports.folderViewFilter = folderViewFilter;
|
|
3616
|
+
exports.folderWorker = folderWorker;
|
|
3617
|
+
exports.getDefaultAccount = getDefaultAccount;
|
|
3618
|
+
exports.getErrorMessage = getErrorMessage;
|
|
3619
|
+
exports.getFlatChildrenFolders = getFlatChildrenFolders;
|
|
3620
|
+
exports.getFolder = getFolder;
|
|
3621
|
+
exports.getFolderIconColor = getFolderIconColor;
|
|
3622
|
+
exports.getFolderIconName = getFolderIconName;
|
|
3623
|
+
exports.getFolderIdParts = getFolderIdParts;
|
|
3624
|
+
exports.getFolderOtherOwnerAccountName = getFolderOtherOwnerAccountName;
|
|
3625
|
+
exports.getFolderOwnerAccountName = getFolderOwnerAccountName;
|
|
3626
|
+
exports.getFolderRequest = getFolderRequest;
|
|
3627
|
+
exports.getFolderTranslatedName = getFolderTranslatedName;
|
|
3628
|
+
exports.getFolders = getFolders;
|
|
3629
|
+
exports.getFoldersArrayByRoot = getFoldersArrayByRoot;
|
|
3630
|
+
exports.getFoldersMap = getFoldersMap;
|
|
3631
|
+
exports.getIdentitiesDescriptors = getIdentitiesDescriptors;
|
|
3632
|
+
exports.getIdentityDescription = getIdentityDescription;
|
|
3633
|
+
exports.getLinkIdMapKey = getLinkIdMapKey;
|
|
3634
|
+
exports.getLinksArray = getLinksArray;
|
|
3635
|
+
exports.getOrderedAccountIds = getOrderedAccountIds;
|
|
3636
|
+
exports.getPrefs = getPrefs;
|
|
3637
|
+
exports.getRoot = getRoot;
|
|
3638
|
+
exports.getRootAccountId = getRootAccountId;
|
|
3639
|
+
exports.getRootByUser = getRootByUser;
|
|
3640
|
+
exports.getRootsArray = getRootsArray;
|
|
3641
|
+
exports.getRootsMap = getRootsMap;
|
|
3642
|
+
exports.getSearchFolder = getSearchFolder;
|
|
3643
|
+
exports.getSearchFolders = getSearchFolders;
|
|
3644
|
+
exports.getShareInfoRequest = getShareInfoRequest;
|
|
3645
|
+
exports.getSharedAccounts = getSharedAccounts;
|
|
3646
|
+
exports.getSortCriteria = getSortCriteria;
|
|
3647
|
+
exports.getSystemFolderTranslatedName = getSystemFolderTranslatedName;
|
|
3648
|
+
exports.getTags = getTags;
|
|
3649
|
+
exports.getUpdateFolder = getUpdateFolder;
|
|
3650
|
+
exports.handleFolderCreated = handleFolderCreated;
|
|
3651
|
+
exports.handleFolderDeleted = handleFolderDeleted;
|
|
3652
|
+
exports.handleFolderModified = handleFolderModified;
|
|
3653
|
+
exports.handleFolderNotify = handleFolderNotify;
|
|
3654
|
+
exports.handleFolderRefresh = handleFolderRefresh;
|
|
3655
|
+
exports.handleFoldersMessages = handleFoldersMessages;
|
|
3656
|
+
exports.handleLinkCreated = handleLinkCreated;
|
|
3657
|
+
exports.handleMessage = handleMessage;
|
|
3658
|
+
exports.handleTagNotify = handleTagNotify;
|
|
3659
|
+
exports.handleTagRefresh = handleTagRefresh;
|
|
3660
|
+
exports.hasId = hasId$1;
|
|
3661
|
+
exports.isA = isA;
|
|
3662
|
+
exports.isAdministerAllowed = isAdministerAllowed;
|
|
3663
|
+
exports.isCreateAllowed = isCreateAllowed;
|
|
3664
|
+
exports.isDefaultAccountRoot = isDefaultAccountRoot;
|
|
3665
|
+
exports.isDeleteAllowed = isDeleteAllowed;
|
|
3666
|
+
exports.isInsertAllowed = isInsertAllowed;
|
|
3667
|
+
exports.isLink = isLink;
|
|
3668
|
+
exports.isNestedInTrash = isNestedInTrash;
|
|
3669
|
+
exports.isReadAllowed = isReadAllowed;
|
|
3670
|
+
exports.isRoot = isRoot;
|
|
3671
|
+
exports.isSharedAccountFolder = isSharedAccountFolder;
|
|
3672
|
+
exports.isSystemFolder = isSystemFolder;
|
|
3673
|
+
exports.isTrash = isTrash$1;
|
|
3674
|
+
exports.isTrashOrNestedInIt = isTrashOrNestedInIt;
|
|
3675
|
+
exports.isTrashed = isTrashed;
|
|
3676
|
+
exports.isValidEmail = isValidEmail;
|
|
3677
|
+
exports.isValidFolderName = isValidFolderName;
|
|
3678
|
+
exports.isWriteAllowed = isWriteAllowed;
|
|
3679
|
+
exports.mapNodes = mapNodes;
|
|
3680
|
+
exports.normalize = normalize;
|
|
3681
|
+
exports.normalizeLink = normalizeLink;
|
|
3682
|
+
exports.normalizeSearch = normalizeSearch;
|
|
3683
|
+
exports.parseEmail = parseEmail;
|
|
3684
|
+
exports.processFolder = processFolder;
|
|
3685
|
+
exports.processLink = processLink;
|
|
3686
|
+
exports.processSearch = processSearch;
|
|
3687
|
+
exports.renameTag = renameTag;
|
|
3688
|
+
exports.sortFolders = sortFolders;
|
|
3689
|
+
exports.tagsWorker = tagsWorker;
|
|
3690
|
+
exports.testFolderIsChecked = testFolderIsChecked;
|
|
3691
|
+
exports.testUtils = testUtils;
|
|
3692
|
+
exports.theme = theme;
|
|
3693
|
+
exports.themeMui = themeMui;
|
|
3694
|
+
exports.themeMuiExtension = themeMuiExtension;
|
|
3695
|
+
exports.useContactInput = useContactInput;
|
|
3696
|
+
exports.useFolder = useFolder;
|
|
3697
|
+
exports.useFolderStore = useFolderStore;
|
|
3698
|
+
exports.useFolders = useFolders;
|
|
3699
|
+
exports.useFoldersMap = useFoldersMap;
|
|
3700
|
+
exports.useFoldersMapByRoot = useFoldersMapByRoot;
|
|
3701
|
+
exports.useHistoryNavigation = useHistoryNavigation;
|
|
3702
|
+
exports.useInitializeFolders = useInitializeFolders;
|
|
3703
|
+
exports.useInitializeTags = useInitializeTags;
|
|
3704
|
+
exports.usePrefs = usePrefs;
|
|
3705
|
+
exports.useRoot = useRoot;
|
|
3706
|
+
exports.useRootByUser = useRootByUser;
|
|
3707
|
+
exports.useRootsArray = useRootsArray;
|
|
3708
|
+
exports.useRootsMap = useRootsMap;
|
|
3709
|
+
exports.useRunSearchIntegration = useRunSearchIntegration;
|
|
3710
|
+
exports.useSearchFolder = useSearchFolder;
|
|
3711
|
+
exports.useSearchFolders = useSearchFolders;
|
|
3712
|
+
exports.useSortedTagsArray = useSortedTagsArray;
|
|
3713
|
+
exports.useTagStore = useTagStore;
|
|
3714
|
+
exports.useTags = useTags;
|
|
3715
|
+
exports.useUpdateFolder = useUpdateFolder;
|
|
3716
|
+
exports.useUpdateView = useUpdateView;
|
|
3717
|
+
//# sourceMappingURL=index.js.map
|