@alfresco/aca-shared 2.0.1 → 4.0.0-4895381898

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.
Files changed (248) hide show
  1. package/README.md +7 -6
  2. package/esm2020/lib/adf-extensions/extensions-data-loader.guard.mjs +73 -0
  3. package/esm2020/lib/components/document-base-page/document-base-page.component.mjs +176 -0
  4. package/esm2020/lib/components/document-base-page/document-base-page.service.mjs +26 -0
  5. package/esm2020/lib/components/generic-error/generic-error.component.mjs +41 -0
  6. package/esm2020/lib/components/generic-error/generic-error.module.mjs +44 -0
  7. package/esm2020/lib/components/info-drawer/info-drawer.component.mjs +123 -0
  8. package/esm2020/lib/components/info-drawer/shared-info-drawer.module.mjs +46 -0
  9. package/esm2020/lib/components/locked-by/locked-by.component.mjs +52 -0
  10. package/esm2020/lib/components/locked-by/locked-by.module.mjs +44 -0
  11. package/esm2020/lib/components/open-in-app/open-in-app.component.mjs +58 -0
  12. package/esm2020/lib/components/page-layout/page-layout-content.component.mjs +48 -0
  13. package/esm2020/lib/components/page-layout/page-layout-error.component.mjs +40 -0
  14. package/esm2020/lib/components/page-layout/page-layout-header.component.mjs +40 -0
  15. package/esm2020/lib/components/page-layout/page-layout.component.mjs +57 -0
  16. package/esm2020/lib/components/page-layout/page-layout.module.mjs +47 -0
  17. package/esm2020/lib/components/tool-bar/shared-toolbar.module.mjs +46 -0
  18. package/esm2020/lib/components/tool-bar/toolbar-action/toolbar-action.component.mjs +59 -0
  19. package/esm2020/lib/components/tool-bar/toolbar-button/toolbar-button.component.mjs +69 -0
  20. package/esm2020/lib/components/tool-bar/toolbar-menu/toolbar-menu.component.mjs +82 -0
  21. package/esm2020/lib/components/tool-bar/toolbar-menu-item/toolbar-menu-item.component.mjs +68 -0
  22. package/esm2020/lib/directives/contextmenu/contextmenu.directive.mjs +106 -0
  23. package/esm2020/lib/directives/contextmenu/contextmenu.module.mjs +42 -0
  24. package/esm2020/lib/directives/pagination.directive.mjs +54 -0
  25. package/esm2020/lib/directives/shared.directives.module.mjs +41 -0
  26. package/esm2020/lib/models/modal-configuration.mjs +25 -0
  27. package/esm2020/lib/models/types.mjs +25 -0
  28. package/esm2020/lib/models/viewer.rules.mjs +25 -0
  29. package/esm2020/lib/routing/shared.guard.mjs +48 -0
  30. package/esm2020/lib/services/aca-file-auto-download.service.mjs +55 -0
  31. package/esm2020/lib/services/aca-mobile-app-switcher.service.mjs +107 -0
  32. package/esm2020/lib/services/alfresco-office-extension.service.mjs +63 -0
  33. package/esm2020/lib/services/app-hook.service.mjs +87 -0
  34. package/esm2020/lib/services/app.extension.service.mjs +444 -0
  35. package/esm2020/lib/services/app.service.mjs +223 -0
  36. package/esm2020/lib/services/content-api.service.mjs +266 -0
  37. package/esm2020/lib/services/node-permission.service.mjs +89 -0
  38. package/esm2020/lib/services/router.extension.service.mjs +105 -0
  39. package/esm2020/lib/shared.module.mjs +54 -0
  40. package/esm2020/lib/testing/lib-testing-module.mjs +115 -0
  41. package/esm2020/lib/utils/node.utils.mjs +42 -0
  42. package/esm2020/public-api.mjs +62 -0
  43. package/esm2020/rules/app.rules.mjs +526 -0
  44. package/esm2020/rules/navigation.rules.mjs +156 -0
  45. package/esm2020/rules/public-api.mjs +28 -0
  46. package/esm2020/rules/repository.rules.mjs +33 -0
  47. package/esm2020/rules/user.rules.mjs +29 -0
  48. package/esm2020/store/actions/app-action-types.mjs +46 -0
  49. package/esm2020/store/actions/app.actions.mjs +128 -0
  50. package/esm2020/store/actions/context-menu-action-types.mjs +28 -0
  51. package/esm2020/store/actions/contextmenu.actions.mjs +31 -0
  52. package/esm2020/store/actions/library.actions.mjs +63 -0
  53. package/esm2020/store/actions/metadata-aspect.actions.mjs +31 -0
  54. package/esm2020/store/actions/node.actions.mjs +188 -0
  55. package/esm2020/store/actions/router-action-types.mjs +32 -0
  56. package/esm2020/store/actions/router.actions.mjs +54 -0
  57. package/esm2020/store/actions/search.actions.mjs +41 -0
  58. package/esm2020/store/actions/snackbar.actions.mjs +57 -0
  59. package/esm2020/store/actions/template-action-types.mjs +31 -0
  60. package/esm2020/store/actions/template.actions.mjs +47 -0
  61. package/esm2020/store/actions/upload.actions.mjs +49 -0
  62. package/esm2020/store/actions/viewer.actions.mjs +81 -0
  63. package/esm2020/store/effects/dialog.effects.mjs +44 -0
  64. package/esm2020/store/effects/router.effects.mjs +116 -0
  65. package/esm2020/store/effects/snackbar.effects.mjs +85 -0
  66. package/esm2020/store/models/delete-status.model.mjs +25 -0
  67. package/esm2020/store/models/deleted-node-info.model.mjs +25 -0
  68. package/esm2020/store/models/modal-configuration.mjs +25 -0
  69. package/esm2020/store/models/node-info.model.mjs +25 -0
  70. package/esm2020/store/models/search-option.model.mjs +30 -0
  71. package/esm2020/store/public-api.mjs +49 -0
  72. package/esm2020/store/selectors/app.selectors.mjs +56 -0
  73. package/esm2020/store/states/app.state.mjs +26 -0
  74. package/esm2020/store/store.module.mjs +42 -0
  75. package/fesm2015/alfresco-aca-shared-rules.mjs +775 -0
  76. package/fesm2015/alfresco-aca-shared-rules.mjs.map +1 -0
  77. package/fesm2015/{alfresco-aca-shared-store.js → alfresco-aca-shared-store.mjs} +395 -396
  78. package/fesm2015/alfresco-aca-shared-store.mjs.map +1 -0
  79. package/fesm2015/alfresco-aca-shared.mjs +2902 -0
  80. package/fesm2015/alfresco-aca-shared.mjs.map +1 -0
  81. package/{fesm2015/alfresco-aca-shared-rules.js → fesm2020/alfresco-aca-shared-rules.mjs} +274 -180
  82. package/fesm2020/alfresco-aca-shared-rules.mjs.map +1 -0
  83. package/fesm2020/alfresco-aca-shared-store.mjs +1376 -0
  84. package/fesm2020/alfresco-aca-shared-store.mjs.map +1 -0
  85. package/fesm2020/alfresco-aca-shared.mjs +3049 -0
  86. package/fesm2020/alfresco-aca-shared.mjs.map +1 -0
  87. package/{alfresco-aca-shared.d.ts → index.d.ts} +1 -0
  88. package/lib/adf-extensions/extensions-data-loader.guard.d.ts +9 -7
  89. package/lib/components/document-base-page/document-base-page.component.d.ts +76 -0
  90. package/lib/components/document-base-page/document-base-page.service.d.ts +28 -0
  91. package/lib/components/generic-error/generic-error.component.d.ts +3 -24
  92. package/lib/components/generic-error/generic-error.module.d.ts +8 -24
  93. package/lib/components/info-drawer/info-drawer.component.d.ts +11 -6
  94. package/lib/components/info-drawer/shared-info-drawer.module.d.ts +11 -24
  95. package/lib/components/locked-by/locked-by.component.d.ts +5 -30
  96. package/lib/components/locked-by/locked-by.module.d.ts +8 -24
  97. package/lib/components/open-in-app/open-in-app.component.d.ts +16 -0
  98. package/lib/components/page-layout/page-layout-content.component.d.ts +3 -24
  99. package/lib/components/page-layout/page-layout-error.component.d.ts +3 -24
  100. package/lib/components/page-layout/page-layout-header.component.d.ts +3 -24
  101. package/lib/components/page-layout/page-layout.component.d.ts +18 -7
  102. package/lib/components/page-layout/page-layout.module.d.ts +12 -24
  103. package/lib/components/tool-bar/shared-toolbar.module.d.ts +11 -24
  104. package/lib/components/tool-bar/toolbar-action/toolbar-action.component.d.ts +16 -8
  105. package/lib/components/tool-bar/toolbar-button/toolbar-button.component.d.ts +10 -25
  106. package/lib/components/tool-bar/toolbar-menu/toolbar-menu.component.d.ts +23 -13
  107. package/lib/components/tool-bar/toolbar-menu-item/toolbar-menu-item.component.d.ts +7 -27
  108. package/lib/directives/contextmenu/contextmenu.directive.d.ts +10 -7
  109. package/lib/directives/contextmenu/contextmenu.module.d.ts +5 -24
  110. package/lib/directives/pagination.directive.d.ts +8 -6
  111. package/lib/directives/shared.directives.module.d.ts +6 -24
  112. package/lib/models/modal-configuration.d.ts +26 -0
  113. package/lib/models/types.d.ts +5 -6
  114. package/lib/models/viewer.rules.d.ts +9 -6
  115. package/lib/routing/shared.guard.d.ts +5 -26
  116. package/lib/services/aca-file-auto-download.service.d.ts +13 -0
  117. package/lib/services/aca-mobile-app-switcher.service.d.ts +48 -0
  118. package/lib/services/alfresco-office-extension.service.d.ts +11 -0
  119. package/lib/services/app-hook.service.d.ts +55 -0
  120. package/lib/services/app.extension.service.d.ts +30 -45
  121. package/lib/services/app.service.d.ts +51 -12
  122. package/lib/services/content-api.service.d.ts +34 -25
  123. package/lib/services/node-permission.service.d.ts +3 -24
  124. package/lib/services/router.extension.service.d.ts +3 -24
  125. package/lib/shared.module.d.ts +15 -6
  126. package/lib/testing/lib-testing-module.d.ts +41 -0
  127. package/lib/utils/node.utils.d.ts +5 -6
  128. package/package.json +60 -18
  129. package/public-api.d.ts +12 -7
  130. package/rules/app.rules.d.ts +128 -36
  131. package/rules/{alfresco-aca-shared-rules.d.ts → index.d.ts} +1 -0
  132. package/rules/navigation.rules.d.ts +12 -12
  133. package/rules/public-api.d.ts +5 -6
  134. package/rules/repository.rules.d.ts +7 -7
  135. package/rules/user.rules.d.ts +6 -7
  136. package/store/actions/app-action-types.d.ts +44 -0
  137. package/store/actions/app.actions.d.ts +24 -29
  138. package/store/actions/context-menu-action-types.d.ts +26 -0
  139. package/store/actions/contextmenu.actions.d.ts +6 -9
  140. package/store/actions/library.actions.d.ts +8 -7
  141. package/store/actions/metadata-aspect.actions.d.ts +5 -6
  142. package/store/actions/node.actions.d.ts +38 -13
  143. package/store/actions/router-action-types.d.ts +30 -0
  144. package/store/actions/router.actions.d.ts +10 -12
  145. package/store/actions/search.actions.d.ts +11 -19
  146. package/store/actions/snackbar.actions.d.ts +13 -17
  147. package/store/actions/template-action-types.d.ts +29 -0
  148. package/store/actions/template.actions.d.ts +6 -12
  149. package/store/actions/upload.actions.d.ts +8 -7
  150. package/store/actions/viewer.actions.d.ts +11 -6
  151. package/store/effects/dialog.effects.d.ts +9 -7
  152. package/store/effects/router.effects.d.ts +11 -29
  153. package/store/effects/snackbar.effects.d.ts +11 -9
  154. package/store/{alfresco-aca-shared-store.d.ts → index.d.ts} +1 -0
  155. package/store/models/delete-status.model.d.ts +5 -6
  156. package/store/models/deleted-node-info.model.d.ts +5 -6
  157. package/store/models/modal-configuration.d.ts +26 -0
  158. package/store/models/node-info.model.d.ts +5 -6
  159. package/store/models/search-option.model.d.ts +5 -6
  160. package/store/public-api.d.ts +9 -6
  161. package/store/selectors/app.selectors.d.ts +10 -9
  162. package/store/states/app.state.d.ts +12 -9
  163. package/store/store.module.d.ts +5 -24
  164. package/alfresco-aca-shared.metadata.json +0 -1
  165. package/bundles/alfresco-aca-shared-rules.umd.js +0 -745
  166. package/bundles/alfresco-aca-shared-rules.umd.js.map +0 -1
  167. package/bundles/alfresco-aca-shared-rules.umd.min.js +0 -125
  168. package/bundles/alfresco-aca-shared-rules.umd.min.js.map +0 -1
  169. package/bundles/alfresco-aca-shared-store.umd.js +0 -1784
  170. package/bundles/alfresco-aca-shared-store.umd.js.map +0 -1
  171. package/bundles/alfresco-aca-shared-store.umd.min.js +0 -462
  172. package/bundles/alfresco-aca-shared-store.umd.min.js.map +0 -1
  173. package/bundles/alfresco-aca-shared.umd.js +0 -2523
  174. package/bundles/alfresco-aca-shared.umd.js.map +0 -1
  175. package/bundles/alfresco-aca-shared.umd.min.js +0 -740
  176. package/bundles/alfresco-aca-shared.umd.min.js.map +0 -1
  177. package/esm2015/lib/adf-extensions/extensions-data-loader.guard.js +0 -74
  178. package/esm2015/lib/components/generic-error/generic-error.component.js +0 -44
  179. package/esm2015/lib/components/generic-error/generic-error.module.js +0 -39
  180. package/esm2015/lib/components/info-drawer/info-drawer.component.js +0 -105
  181. package/esm2015/lib/components/info-drawer/shared-info-drawer.module.js +0 -41
  182. package/esm2015/lib/components/locked-by/locked-by.component.js +0 -54
  183. package/esm2015/lib/components/locked-by/locked-by.module.js +0 -38
  184. package/esm2015/lib/components/page-layout/page-layout-content.component.js +0 -43
  185. package/esm2015/lib/components/page-layout/page-layout-error.component.js +0 -37
  186. package/esm2015/lib/components/page-layout/page-layout-header.component.js +0 -37
  187. package/esm2015/lib/components/page-layout/page-layout.component.js +0 -44
  188. package/esm2015/lib/components/page-layout/page-layout.module.js +0 -40
  189. package/esm2015/lib/components/tool-bar/shared-toolbar.module.js +0 -42
  190. package/esm2015/lib/components/tool-bar/toolbar-action/toolbar-action.component.js +0 -57
  191. package/esm2015/lib/components/tool-bar/toolbar-button/toolbar-button.component.js +0 -66
  192. package/esm2015/lib/components/tool-bar/toolbar-menu/toolbar-menu.component.js +0 -55
  193. package/esm2015/lib/components/tool-bar/toolbar-menu-item/toolbar-menu-item.component.js +0 -65
  194. package/esm2015/lib/directives/contextmenu/contextmenu.directive.js +0 -97
  195. package/esm2015/lib/directives/contextmenu/contextmenu.module.js +0 -38
  196. package/esm2015/lib/directives/pagination.directive.js +0 -55
  197. package/esm2015/lib/directives/shared.directives.module.js +0 -37
  198. package/esm2015/lib/models/types.js +0 -25
  199. package/esm2015/lib/models/viewer.rules.js +0 -25
  200. package/esm2015/lib/routing/app.routes.strategy.js +0 -105
  201. package/esm2015/lib/routing/shared.guard.js +0 -50
  202. package/esm2015/lib/services/app.extension.service.js +0 -398
  203. package/esm2015/lib/services/app.service.js +0 -69
  204. package/esm2015/lib/services/content-api.service.js +0 -205
  205. package/esm2015/lib/services/node-permission.service.js +0 -88
  206. package/esm2015/lib/services/router.extension.service.js +0 -110
  207. package/esm2015/lib/shared.module.js +0 -44
  208. package/esm2015/lib/utils/node.utils.js +0 -34
  209. package/esm2015/public-api.js +0 -57
  210. package/esm2015/rules/app.rules.js +0 -420
  211. package/esm2015/rules/navigation.rules.js +0 -164
  212. package/esm2015/rules/public-api.js +0 -29
  213. package/esm2015/rules/repository.rules.js +0 -32
  214. package/esm2015/rules/user.rules.js +0 -32
  215. package/esm2015/store/actions/app.actions.js +0 -130
  216. package/esm2015/store/actions/contextmenu.actions.js +0 -35
  217. package/esm2015/store/actions/library.actions.js +0 -63
  218. package/esm2015/store/actions/metadata-aspect.actions.js +0 -32
  219. package/esm2015/store/actions/node.actions.js +0 -161
  220. package/esm2015/store/actions/router.actions.js +0 -56
  221. package/esm2015/store/actions/search.actions.js +0 -54
  222. package/esm2015/store/actions/snackbar.actions.js +0 -61
  223. package/esm2015/store/actions/template.actions.js +0 -54
  224. package/esm2015/store/actions/upload.actions.js +0 -49
  225. package/esm2015/store/actions/viewer.actions.js +0 -75
  226. package/esm2015/store/effects/dialog.effects.js +0 -49
  227. package/esm2015/store/effects/router.effects.js +0 -132
  228. package/esm2015/store/effects/snackbar.effects.js +0 -90
  229. package/esm2015/store/models/delete-status.model.js +0 -25
  230. package/esm2015/store/models/deleted-node-info.model.js +0 -25
  231. package/esm2015/store/models/node-info.model.js +0 -25
  232. package/esm2015/store/models/search-option.model.js +0 -31
  233. package/esm2015/store/public-api.js +0 -46
  234. package/esm2015/store/selectors/app.selectors.js +0 -80
  235. package/esm2015/store/states/app.state.js +0 -25
  236. package/esm2015/store/store.module.js +0 -37
  237. package/fesm2015/alfresco-aca-shared-rules.js.map +0 -1
  238. package/fesm2015/alfresco-aca-shared-store.js.map +0 -1
  239. package/fesm2015/alfresco-aca-shared.js +0 -2167
  240. package/fesm2015/alfresco-aca-shared.js.map +0 -1
  241. package/lib/routing/app.routes.strategy.d.ts +0 -40
  242. package/rules/alfresco-aca-shared-rules.metadata.json +0 -1
  243. package/rules/package.json +0 -11
  244. package/store/alfresco-aca-shared-store.metadata.json +0 -1
  245. package/store/package.json +0 -11
  246. /package/{esm2015/alfresco-aca-shared.js → esm2020/alfresco-aca-shared.mjs} +0 -0
  247. /package/{esm2015/rules/alfresco-aca-shared-rules.js → esm2020/rules/alfresco-aca-shared-rules.mjs} +0 -0
  248. /package/{esm2015/store/alfresco-aca-shared-store.js → esm2020/store/alfresco-aca-shared-store.mjs} +0 -0
@@ -1,12 +1,11 @@
1
1
  /*!
2
- * @license
3
- * Alfresco Example Content Application
2
+ * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
4
3
  *
5
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
4
+ * Alfresco Example Content Application
6
5
  *
7
6
  * This file is part of the Alfresco Example Content Application.
8
7
  * If the software was purchased under a paid Alfresco license, the terms of
9
- * the paid license agreement will prevail. Otherwise, the software is
8
+ * the paid license agreement will prevail. Otherwise, the software is
10
9
  * provided under the following open source license terms:
11
10
  *
12
11
  * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
@@ -16,11 +15,11 @@
16
15
  *
17
16
  * The Alfresco Example Content Application is distributed in the hope that it will be useful,
18
17
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
19
  * GNU Lesser General Public License for more details.
21
20
  *
22
21
  * You should have received a copy of the GNU Lesser General Public License
23
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
22
+ * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
24
23
  */
25
24
  /**
26
25
  * Checks if a Preview route is activated.
@@ -42,9 +41,7 @@ function isFavorites(context) {
42
41
  * Checks if the activated route is not **Favorites**.
43
42
  * JSON ref: `app.navigation.isNotFavorites`
44
43
  */
45
- function isNotFavorites(context) {
46
- return !isFavorites(context);
47
- }
44
+ const isNotFavorites = (context) => !isFavorites(context);
48
45
  /**
49
46
  * Checks if a **Shared Files** route is activated.
50
47
  * JSON ref: `app.navigation.isSharedFiles`
@@ -57,9 +54,7 @@ function isSharedFiles(context) {
57
54
  * Checks if the activated route is not **Shared Files**.
58
55
  * JSON ref: `app.navigation.isNotSharedFiles`
59
56
  */
60
- function isNotSharedFiles(context) {
61
- return !isSharedFiles(context);
62
- }
57
+ const isNotSharedFiles = (context) => !isSharedFiles(context);
63
58
  /**
64
59
  * Checks if a **Trashcan** route is activated.
65
60
  * JSON ref: `app.navigation.isTrashcan`
@@ -72,9 +67,7 @@ function isTrashcan(context) {
72
67
  * Checks if the activated route is not **Trashcan**.
73
68
  * JSON ref: `app.navigation.isNotTrashcan`
74
69
  */
75
- function isNotTrashcan(context) {
76
- return !isTrashcan(context);
77
- }
70
+ const isNotTrashcan = (context) => !isTrashcan(context);
78
71
  /**
79
72
  * Checks if a **Personal Files** route is activated.
80
73
  * JSON ref: `app.navigation.isPersonalFiles`
@@ -99,13 +92,15 @@ function isLibraries(context) {
99
92
  const { url } = context.navigation;
100
93
  return url && (url.endsWith('/libraries') || url.startsWith('/search-libraries'));
101
94
  }
95
+ function isLibraryContent(context) {
96
+ const { url } = context.navigation;
97
+ return url && (url.endsWith('/libraries') || url.includes('/libraries/') || url.startsWith('/search-libraries'));
98
+ }
102
99
  /**
103
100
  * Checks if the activated route is neither **Libraries** nor **Library Search Results**.
104
101
  * JSON ref: `app.navigation.isNotLibraries`
105
102
  */
106
- function isNotLibraries(context) {
107
- return !isLibraries(context);
108
- }
103
+ const isNotLibraries = (context) => !isLibraries(context);
109
104
  /**
110
105
  * Checks if a **Recent Files** route is activated.
111
106
  * JSON ref: `app.navigation.isRecentFiles`
@@ -118,15 +113,14 @@ function isRecentFiles(context) {
118
113
  * Checks if the activated route is not **Recent Files**.
119
114
  * JSON ref: `app.navigation.isNotRecentFiles`
120
115
  */
121
- function isNotRecentFiles(context) {
122
- return !isRecentFiles(context);
123
- }
116
+ const isNotRecentFiles = (context) => !isRecentFiles(context);
124
117
  /**
125
118
  * Checks if a **Search Results** route is activated.
126
119
  * JSON ref: `app.navigation.isSearchResults`
127
120
  */
128
- function isSearchResults(context /*,
129
- ...args: RuleParameter[]*/) {
121
+ function isSearchResults(context
122
+ // ...args: RuleParameter[]
123
+ ) {
130
124
  const { url } = context.navigation;
131
125
  return url && url.startsWith('/search');
132
126
  }
@@ -134,9 +128,7 @@ function isSearchResults(context /*,
134
128
  * Checks if the activated route is not **Search Results**.
135
129
  * JSON ref: `app.navigation.isNotSearchResults`
136
130
  */
137
- function isNotSearchResults(context) {
138
- return !isSearchResults(context);
139
- }
131
+ const isNotSearchResults = (context) => !isSearchResults(context);
140
132
  /**
141
133
  * Checks if a **Shared Preview** route is activated.
142
134
  * JSON ref: `app.navigation.isSharedPreview`
@@ -163,14 +155,13 @@ function isSharedFileViewer(context) {
163
155
  }
164
156
 
165
157
  /*!
166
- * @license
167
- * Alfresco Example Content Application
158
+ * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
168
159
  *
169
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
160
+ * Alfresco Example Content Application
170
161
  *
171
162
  * This file is part of the Alfresco Example Content Application.
172
163
  * If the software was purchased under a paid Alfresco license, the terms of
173
- * the paid license agreement will prevail. Otherwise, the software is
164
+ * the paid license agreement will prevail. Otherwise, the software is
174
165
  * provided under the following open source license terms:
175
166
  *
176
167
  * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
@@ -180,29 +171,59 @@ function isSharedFileViewer(context) {
180
171
  *
181
172
  * The Alfresco Example Content Application is distributed in the hope that it will be useful,
182
173
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
183
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
174
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
184
175
  * GNU Lesser General Public License for more details.
185
176
  *
186
177
  * You should have received a copy of the GNU Lesser General Public License
187
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
178
+ * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
188
179
  */
189
180
  /**
190
181
  * Checks if the quick share repository option is enabled or not.
191
182
  * JSON ref: `repository.isQuickShareEnabled`
192
183
  */
193
- function hasQuickShareEnabled(context) {
194
- return context.repository.status.isQuickShareEnabled;
184
+ const hasQuickShareEnabled = (context) => context.repository.status.isQuickShareEnabled;
185
+ function isMajorVersionAvailable(context, versionNumber) {
186
+ const majorVersion = context.repository.version?.major ? parseInt(context.repository.version.major, 10) : 0;
187
+ return majorVersion >= parseInt(versionNumber, 10);
195
188
  }
196
189
 
197
190
  /*!
198
- * @license
191
+ * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
192
+ *
199
193
  * Alfresco Example Content Application
200
194
  *
201
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
195
+ * This file is part of the Alfresco Example Content Application.
196
+ * If the software was purchased under a paid Alfresco license, the terms of
197
+ * the paid license agreement will prevail. Otherwise, the software is
198
+ * provided under the following open source license terms:
199
+ *
200
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
201
+ * it under the terms of the GNU Lesser General Public License as published by
202
+ * the Free Software Foundation, either version 3 of the License, or
203
+ * (at your option) any later version.
204
+ *
205
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
206
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
207
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
208
+ * GNU Lesser General Public License for more details.
209
+ *
210
+ * You should have received a copy of the GNU Lesser General Public License
211
+ * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
212
+ */
213
+ /**
214
+ * Checks if user is admin.
215
+ * JSON ref: `user.isAdmin`
216
+ */
217
+ const isAdmin = (context) => context.profile.isAdmin;
218
+
219
+ /*!
220
+ * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
221
+ *
222
+ * Alfresco Example Content Application
202
223
  *
203
224
  * This file is part of the Alfresco Example Content Application.
204
225
  * If the software was purchased under a paid Alfresco license, the terms of
205
- * the paid license agreement will prevail. Otherwise, the software is
226
+ * the paid license agreement will prevail. Otherwise, the software is
206
227
  * provided under the following open source license terms:
207
228
  *
208
229
  * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
@@ -212,20 +233,83 @@ function hasQuickShareEnabled(context) {
212
233
  *
213
234
  * The Alfresco Example Content Application is distributed in the hope that it will be useful,
214
235
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
215
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
236
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
216
237
  * GNU Lesser General Public License for more details.
217
238
  *
218
239
  * You should have received a copy of the GNU Lesser General Public License
219
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
240
+ * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
241
+ */
242
+ /* cspell:disable */
243
+ const supportedExtensions = {
244
+ doc: 'ms-word',
245
+ docx: 'ms-word',
246
+ docm: 'ms-word',
247
+ dot: 'ms-word',
248
+ dotx: 'ms-word',
249
+ dotm: 'ms-word',
250
+ rtf: 'ms-word',
251
+ xls: 'ms-excel',
252
+ xlsx: 'ms-excel',
253
+ xlsb: 'ms-excel',
254
+ xlsm: 'ms-excel',
255
+ xlt: 'ms-excel',
256
+ xltx: 'ms-excel',
257
+ xltm: 'ms-excel',
258
+ xlam: 'ms-excel',
259
+ ppt: 'ms-powerpoint',
260
+ pptx: 'ms-powerpoint',
261
+ pot: 'ms-powerpoint',
262
+ potx: 'ms-powerpoint',
263
+ potm: 'ms-powerpoint',
264
+ pptm: 'ms-powerpoint',
265
+ pps: 'ms-powerpoint',
266
+ ppsx: 'ms-powerpoint',
267
+ ppam: 'ms-powerpoint',
268
+ ppsm: 'ms-powerpoint',
269
+ sldx: 'ms-powerpoint',
270
+ sldm: 'ms-powerpoint',
271
+ vsd: 'ms-visio',
272
+ vss: 'ms-visio',
273
+ vst: 'ms-visio',
274
+ vsdx: 'ms-visio',
275
+ vsdm: 'ms-visio',
276
+ vssx: 'ms-visio',
277
+ vssm: 'ms-visio',
278
+ vstx: 'ms-visio',
279
+ vstm: 'ms-visio'
280
+ };
281
+ /* cspell:enable */
282
+ function getFileExtension(fileName) {
283
+ if (fileName) {
284
+ const match = fileName.match(/\.([^\./\?\#]+)($|\?|\#)/);
285
+ return match ? match[1] : null;
286
+ }
287
+ return null;
288
+ }
289
+ /**
290
+ * Checks if the content plugin is enabled.
291
+ * JSON ref: `app.isContentServiceEnabled`
292
+ */
293
+ const isContentServiceEnabled = () => localStorage && localStorage.getItem('contentService') !== 'false';
294
+ /**
295
+ * Checks if Search is supported for active view
296
+ * JSON ref: `app.isSearchSupported`
220
297
  */
298
+ const isSearchSupported = (context) => [isNotSearchResults(context) /* , !hasSelection(context)*/].every(Boolean);
299
+ /**
300
+ * Checks if upload action is supported for the given context
301
+ * JSON ref: `app.isUploadSupported`
302
+ *
303
+ * @param content Rule execution context
304
+ */
305
+ const isUploadSupported = (context) => [isContentServiceEnabled(), isPersonalFiles(context) || isLibraryContent(context), canUpload(context)].every(Boolean);
221
306
  /**
222
307
  * Checks if user can copy selected node.
223
308
  * JSON ref: `app.canCopyNode`
309
+ *
224
310
  * @param context Rule execution context
225
311
  */
226
- function canCopyNode(context) {
227
- return [hasSelection(context), isNotTrashcan(context), isNotLibraries(context)].every(Boolean);
228
- }
312
+ const canCopyNode = (context) => [hasSelection(context), isNotTrashcan(context), isNotLibraries(context)].every(Boolean);
229
313
  /**
230
314
  * Checks if user can mark selected nodes as **Favorite**.
231
315
  * JSON ref: `app.selection.canAddFavorite`
@@ -256,24 +340,20 @@ function canRemoveFavorite(context) {
256
340
  * Checks if user can share selected file.
257
341
  * JSON ref: `app.selection.file.canShare`
258
342
  */
259
- function canShareFile(context) {
260
- return [context.selection.file, isNotTrashcan(context), hasQuickShareEnabled(context), !isShared(context)].every(Boolean);
261
- }
343
+ const canShareFile = (context) => [context.selection.file, isNotTrashcan(context), hasQuickShareEnabled(context), !isShared(context)].every(Boolean);
262
344
  /**
263
345
  * Checks if user can perform "Join" or "Cancel Join Request" on a library.
264
346
  * JSON ref: `canToggleJoinLibrary`
265
347
  */
266
- function canToggleJoinLibrary(context) {
267
- return [hasLibrarySelected(context), !isPrivateLibrary(context), hasNoLibraryRole(context)].every(Boolean);
268
- }
348
+ const canToggleJoinLibrary = (context) => [hasLibrarySelected(context), !isPrivateLibrary(context), hasNoLibraryRole(context)].every(Boolean) ||
349
+ [hasLibrarySelected(context), isPrivateLibrary(context), hasNoLibraryRole(context), isAdmin(context)].every(Boolean);
269
350
  /**
270
351
  * Checks if user can edit the selected folder.
271
352
  * JSON ref: `canEditFolder`
353
+ *
272
354
  * @param context Rule execution context
273
355
  */
274
- function canEditFolder(context) {
275
- return [canUpdateSelectedFolder(context), isNotTrashcan(context)].every(Boolean);
276
- }
356
+ const canEditFolder = (context) => [canUpdateSelectedFolder(context), isNotTrashcan(context)].every(Boolean);
277
357
  /**
278
358
  * Checks if the selected file is already shared.
279
359
  * JSON ref: `app.selection.file.isShared`
@@ -282,7 +362,7 @@ function isShared(context) {
282
362
  if (isSharedFiles(context) && context.selection.file) {
283
363
  return true;
284
364
  }
285
- if ((isNotTrashcan(context), !context.selection.isEmpty && context.selection.file)) {
365
+ if (isNotTrashcan(context) && !context.selection.isEmpty && context.selection.file) {
286
366
  return !!(context.selection.file.entry && context.selection.file.entry.properties && context.selection.file.entry.properties['qshare:sharedId']);
287
367
  }
288
368
  return false;
@@ -332,28 +412,37 @@ function canUnshareNodes(context) {
332
412
  * Checks if user selected anything.
333
413
  * JSON ref: `app.selection.notEmpty`
334
414
  */
335
- function hasSelection(context) {
336
- return !context.selection.isEmpty;
337
- }
415
+ const hasSelection = (context) => !context.selection.isEmpty;
338
416
  /**
339
417
  * Checks if user can create a new folder with current path.
340
418
  * JSON ref: `app.navigation.folder.canCreate`
341
419
  */
342
420
  function canCreateFolder(context) {
343
- const { currentFolder } = context.navigation;
344
- if (currentFolder) {
345
- return context.permissions.check(currentFolder, ['create']);
421
+ if (isContentServiceEnabled() && (isPersonalFiles(context) || isLibraryContent(context))) {
422
+ const { currentFolder } = context.navigation;
423
+ if (currentFolder) {
424
+ return context.permissions.check(currentFolder, ['create']);
425
+ }
346
426
  }
347
427
  return false;
348
428
  }
429
+ /**
430
+ * Checks if user can create a Library
431
+ * JSON ref: `app.canCreateLibrary`
432
+ *
433
+ * @param context Rule execution context
434
+ */
435
+ const canCreateLibrary = (context) => [isContentServiceEnabled(), isLibraries(context)].every(Boolean);
349
436
  /**
350
437
  * Checks if user can upload content to current folder.
351
438
  * JSON ref: `app.navigation.folder.canUpload`
352
439
  */
353
440
  function canUpload(context) {
354
- const { currentFolder } = context.navigation;
355
- if (currentFolder) {
356
- return context.permissions.check(currentFolder, ['create']);
441
+ if (isContentServiceEnabled() && (isPersonalFiles(context) || isLibraryContent(context))) {
442
+ const { currentFolder } = context.navigation;
443
+ if (currentFolder) {
444
+ return context.permissions.check(currentFolder, ['create']);
445
+ }
357
446
  }
358
447
  return false;
359
448
  }
@@ -363,9 +452,7 @@ function canUpload(context) {
363
452
  */
364
453
  function canDownloadSelection(context) {
365
454
  if (!context.selection.isEmpty && isNotTrashcan(context)) {
366
- return context.selection.nodes.every((node) => {
367
- return node.entry && (node.entry.isFile || node.entry.isFolder || !!node.entry.nodeId);
368
- });
455
+ return context.selection.nodes.every((node) => node.entry && (node.entry.isFile || node.entry.isFolder || !!node.entry.nodeId));
369
456
  }
370
457
  return false;
371
458
  }
@@ -373,18 +460,12 @@ function canDownloadSelection(context) {
373
460
  * Checks if user has selected a folder.
374
461
  * JSON ref: `app.selection.folder`
375
462
  */
376
- function hasFolderSelected(context) {
377
- const folder = context.selection.folder;
378
- return folder ? true : false;
379
- }
463
+ const hasFolderSelected = (context) => !!context.selection.folder;
380
464
  /**
381
465
  * Checks if user has selected a library (site).
382
466
  * JSON ref: `app.selection.library`
383
467
  */
384
- function hasLibrarySelected(context) {
385
- const library = context.selection.library;
386
- return library ? true : false;
387
- }
468
+ const hasLibrarySelected = (context) => !!context.selection.library;
388
469
  /**
389
470
  * Checks if user has selected a **private** library (site)
390
471
  * JSON ref: `app.selection.isPrivateLibrary`
@@ -405,19 +486,12 @@ function hasLibraryRole(context) {
405
486
  * Checks if the selected library has no **role** property defined.
406
487
  * JSON ref: `app.selection.hasNoLibraryRole`
407
488
  */
408
- function hasNoLibraryRole(context) {
409
- return !hasLibraryRole(context);
410
- }
489
+ const hasNoLibraryRole = (context) => !hasLibraryRole(context);
411
490
  /**
412
491
  * Checks if user has selected a file.
413
492
  * JSON ref: `app.selection.file`
414
493
  */
415
- function hasFileSelected(context) {
416
- if (context && context.selection && context.selection.file) {
417
- return true;
418
- }
419
- return false;
420
- }
494
+ const hasFileSelected = (context) => !!(context && context.selection && context.selection.file);
421
495
  /**
422
496
  * Checks if user can update the first selected node.
423
497
  * JSON ref: `app.selection.first.canUpdate`
@@ -425,13 +499,20 @@ function hasFileSelected(context) {
425
499
  function canUpdateSelectedNode(context) {
426
500
  if (context.selection && !context.selection.isEmpty) {
427
501
  const node = context.selection.first;
428
- if (node.entry.isFile && hasLockedFiles(context)) {
502
+ if (node?.entry.isFile && hasLockedFiles(context)) {
429
503
  return false;
430
504
  }
431
505
  return context.permissions.check(node, ['update']);
432
506
  }
433
507
  return false;
434
508
  }
509
+ function isMultiselection(context) {
510
+ let isMultiNodeSelected = false;
511
+ if (context.selection && !context.selection.isEmpty) {
512
+ isMultiNodeSelected = context.selection.count > 1;
513
+ }
514
+ return isMultiNodeSelected;
515
+ }
435
516
  /**
436
517
  * Checks if user can update the first selected folder.
437
518
  * JSON ref: `app.selection.folder.canUpdate`
@@ -464,39 +545,33 @@ function hasLockedFiles(context) {
464
545
  * Checks if the selected file has **write** or **read-only** locks specified.
465
546
  * JSON ref: `app.selection.file.isLocked`
466
547
  */
467
- function isWriteLocked(context) {
468
- return !!(context &&
469
- context.selection &&
470
- context.selection.file &&
471
- context.selection.file.entry &&
472
- context.selection.file.entry.properties &&
473
- (context.selection.file.entry.properties['cm:lockType'] === 'WRITE_LOCK' ||
474
- context.selection.file.entry.properties['cm:lockType'] === 'READ_ONLY_LOCK'));
475
- }
548
+ const isWriteLocked = (context) => !!(context &&
549
+ context.selection &&
550
+ context.selection.file &&
551
+ context.selection.file.entry &&
552
+ context.selection.file.entry.properties &&
553
+ (context.selection.file.entry.properties['cm:lockType'] === 'WRITE_LOCK' ||
554
+ context.selection.file.entry.properties['cm:lockType'] === 'READ_ONLY_LOCK'));
476
555
  /**
477
556
  * Checks if the selected file has **write** or **read-only** locks specified,
478
557
  * and that current user is the owner of the lock.
479
558
  * JSON ref: `app.selection.file.isLockOwner`
480
559
  */
481
- function isUserWriteLockOwner(context) {
482
- return (isWriteLocked(context) &&
483
- context.selection.file.entry.properties['cm:lockOwner'] &&
484
- context.selection.file.entry.properties['cm:lockOwner'].id === context.profile.id);
485
- }
560
+ const isUserWriteLockOwner = (context) => isWriteLocked(context) &&
561
+ context.selection.file?.entry.properties['cm:lockOwner'] &&
562
+ context.selection.file?.entry.properties['cm:lockOwner'].id === context.profile.id;
486
563
  /**
487
564
  * Checks if user can lock selected file.
488
565
  * JSON ref: `app.selection.file.canLock`
489
566
  */
490
- function canLockFile(context) {
491
- return !isWriteLocked(context) && canUpdateSelectedNode(context);
492
- }
567
+ const canLockFile = (context) => !isWriteLocked(context) && canUpdateSelectedNode(context);
493
568
  /**
494
569
  * Checks if user can unlock selected file.
495
570
  * JSON ref: `app.selection.file.canUnlock`
496
571
  */
497
572
  function canUnlockFile(context) {
498
573
  const { file } = context.selection;
499
- return isWriteLocked(context) && (context.permissions.check(file.entry, ['delete']) || isUserWriteLockOwner(context));
574
+ return isWriteLocked(context) && (context.permissions.check(file?.entry, ['delete']) || isUserWriteLockOwner(context));
500
575
  }
501
576
  /**
502
577
  * Checks if user can upload a new version of the file.
@@ -515,144 +590,163 @@ function canUploadVersion(context) {
515
590
  /**
516
591
  * Checks if user has trashcan item selected.
517
592
  * JSON ref: `isTrashcanItemSelected`
593
+ *
518
594
  * @param context Rule execution context
519
595
  */
520
- function isTrashcanItemSelected(context) {
521
- return [isTrashcan(context), hasSelection(context)].every(Boolean);
522
- }
596
+ const isTrashcanItemSelected = (context) => [isTrashcan(context), hasSelection(context)].every(Boolean);
523
597
  /**
524
598
  * Checks if user can view the file.
525
599
  * JSON ref: `canViewFile`
600
+ *
526
601
  * @param context Rule execution context
527
602
  */
528
- function canViewFile(context) {
529
- return [hasFileSelected(context), isNotTrashcan(context)].every(Boolean);
530
- }
603
+ const canViewFile = (context) => [hasFileSelected(context), isNotTrashcan(context)].every(Boolean);
531
604
  /**
532
605
  * Checks if user can **Leave** selected library.
533
606
  * JSON ref: `canLeaveLibrary`
607
+ *
534
608
  * @param context Rule execution context
535
609
  */
536
- function canLeaveLibrary(context) {
537
- return [hasLibrarySelected(context), hasLibraryRole(context)].every(Boolean);
538
- }
610
+ const canLeaveLibrary = (context) => [hasLibrarySelected(context), hasLibraryRole(context)].every(Boolean);
539
611
  /**
540
612
  * Checks if user can toggle shared link mode.
541
613
  * JSON ref: `canToggleSharedLink`
614
+ *
542
615
  * @param context Rule execution context
543
616
  */
544
- function canToggleSharedLink(context) {
545
- return [hasFileSelected(context), [canShareFile(context), isShared(context)].some(Boolean)].every(Boolean);
546
- }
617
+ const canToggleSharedLink = (context) => [hasFileSelected(context), [canShareFile(context), isShared(context)].some(Boolean)].every(Boolean);
547
618
  /**
548
619
  * Checks if user can show **Info Drawer** for the selected node.
549
620
  * JSON ref: `canShowInfoDrawer`
621
+ *
550
622
  * @param context Rule execution context
551
623
  */
552
- function canShowInfoDrawer(context) {
553
- return [hasSelection(context), isNotLibraries(context), isNotTrashcan(context)].every(Boolean);
554
- }
624
+ const canShowInfoDrawer = (context) => [hasSelection(context), isNotLibraries(context), isNotTrashcan(context)].every(Boolean);
555
625
  /**
556
626
  * Checks if user can manage file versions for the selected node.
557
627
  * JSON ref: `canManageFileVersions`
628
+ *
558
629
  * @param context Rule execution context
559
630
  */
560
- function canManageFileVersions(context) {
561
- return [hasFileSelected(context), isNotTrashcan(context), !hasLockedFiles(context)].every(Boolean);
562
- }
631
+ const canManageFileVersions = (context) => [hasFileSelected(context), isNotTrashcan(context), !hasLockedFiles(context)].every(Boolean);
632
+ /**
633
+ * Checks if user can edit aspects for the selected node.
634
+ * JSON ref: `canEditAspects`
635
+ *
636
+ * @param context Rule execution context
637
+ */
638
+ const canEditAspects = (context) => [
639
+ !isMultiselection(context),
640
+ canUpdateSelectedNode(context),
641
+ !isWriteLocked(context),
642
+ isNotTrashcan(context),
643
+ isMajorVersionAvailable(context, '7')
644
+ ].every(Boolean);
563
645
  /**
564
646
  * Checks if user can manage permissions for the selected node.
565
647
  * JSON ref: `canManagePermissions`
648
+ *
566
649
  * @param context Rule execution context
567
650
  */
568
- function canManagePermissions(context) {
569
- return [canUpdateSelectedNode(context), isNotTrashcan(context)].every(Boolean);
570
- }
651
+ const canManagePermissions = (context) => [canUpdateSelectedNode(context), isNotTrashcan(context)].every(Boolean);
571
652
  /**
572
653
  * Checks if user can toggle **Edit Offline** mode for selected node.
573
654
  * JSON ref: `canToggleEditOffline`
655
+ *
574
656
  * @param context Rule execution context
575
657
  */
576
- function canToggleEditOffline(context) {
577
- return [hasFileSelected(context), isNotTrashcan(context), canLockFile(context) || canUnlockFile(context)].every(Boolean);
578
- }
658
+ const canToggleEditOffline = (context) => [hasFileSelected(context), isNotTrashcan(context), canLockFile(context) || canUnlockFile(context)].every(Boolean);
579
659
  /**
580
660
  * @deprecated Uses workarounds for for recent files and search api issues.
581
661
  * Checks if user can toggle **Favorite** state for a node.
582
662
  * @param context Rule execution context
583
663
  */
584
- function canToggleFavorite(context) {
585
- return [
586
- [canAddFavorite(context), canRemoveFavorite(context)].some(Boolean),
587
- [isRecentFiles(context), isSharedFiles(context), isSearchResults(context), isFavorites(context)].some(Boolean)
588
- ].every(Boolean);
589
- }
590
- /**
591
- * Checks if application should render language picker menu.
592
- * JSON ref: `canShowLanguagePicker`
593
- * @param context Rule execution context
594
- */
595
- function canShowLanguagePicker(context) {
596
- return context.languagePicker;
597
- }
664
+ const canToggleFavorite = (context) => [
665
+ [canAddFavorite(context), canRemoveFavorite(context)].some(Boolean),
666
+ [isRecentFiles(context), isSharedFiles(context), isSearchResults(context), isFavorites(context)].some(Boolean)
667
+ ].every(Boolean);
598
668
  /**
599
669
  * Checks if application should render logout option.
600
670
  * JSON ref: `canShowLogout`
671
+ *
601
672
  * @param context Rule execution context
602
673
  */
603
- function canShowLogout(context) {
604
- return !context.withCredentials;
605
- }
674
+ const canShowLogout = (context) => !context.withCredentials;
606
675
  /**
607
676
  * Checks if user is library manager
608
677
  * JSON ref: `isLibraryManager`
678
+ *
609
679
  * @param context Rule execution context
610
680
  */
611
- function isLibraryManager(context) {
612
- return hasLibrarySelected(context) && context.selection.library.entry && context.selection.library.entry.role === 'SiteManager';
613
- }
614
-
615
- /*!
616
- * @license
617
- * Alfresco Example Content Application
618
- *
619
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
620
- *
621
- * This file is part of the Alfresco Example Content Application.
622
- * If the software was purchased under a paid Alfresco license, the terms of
623
- * the paid license agreement will prevail. Otherwise, the software is
624
- * provided under the following open source license terms:
625
- *
626
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
627
- * it under the terms of the GNU Lesser General Public License as published by
628
- * the Free Software Foundation, either version 3 of the License, or
629
- * (at your option) any later version.
630
- *
631
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
632
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
633
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
634
- * GNU Lesser General Public License for more details.
681
+ const isLibraryManager = (context) => hasLibrarySelected(context) && context.selection.library?.entry.role === 'SiteManager';
682
+ /**
683
+ * Checks if the preview button for search results can be showed
684
+ * JSON ref: `canInfoPreview`
635
685
  *
636
- * You should have received a copy of the GNU Lesser General Public License
637
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
686
+ * @param context Rule execution context
638
687
  */
639
- /**
640
- * Checks if user is admin.
641
- * JSON ref: `user.isAdmin`
688
+ const canInfoPreview = (context) => {
689
+ const isSearchResult = isSearchResults(context);
690
+ const isNotMultiselect = !isMultiselection(context);
691
+ const isFileSelected = !hasFolderSelected(context);
692
+ const isPreview$1 = !isPreview(context);
693
+ return isSearchResult && isNotMultiselect && isFileSelected && isPreview$1;
694
+ };
695
+ const showInfoSelectionButton = (context) => isSearchResults(context) && !isPreview(context);
696
+ /**
697
+ * Checks if the file can be opened with MS Office
698
+ * JSON ref: `aos.canOpenWithOffice`
699
+ *
700
+ * @param context Rule execution context
642
701
  */
643
- function isAdmin(context) {
644
- return context.profile.isAdmin;
702
+ function canOpenWithOffice(context) {
703
+ if (context.navigation && context.navigation.url && context.navigation.url.startsWith('/trashcan')) {
704
+ return false;
705
+ }
706
+ if (!context || !context.selection) {
707
+ return false;
708
+ }
709
+ const { file } = context.selection;
710
+ if (!file || !file.entry) {
711
+ return false;
712
+ }
713
+ const extension = getFileExtension(file.entry.name);
714
+ if (!extension || !supportedExtensions[extension]) {
715
+ return false;
716
+ }
717
+ if (!file.entry.properties) {
718
+ return false;
719
+ }
720
+ if (file.entry.isLocked) {
721
+ return false;
722
+ }
723
+ if (file.entry.properties['cm:lockType'] === 'WRITE_LOCK' || file.entry.properties['cm:lockType'] === 'READ_ONLY_LOCK') {
724
+ return false;
725
+ }
726
+ const lockOwner = file.entry.properties['cm:lockOwner'];
727
+ if (lockOwner && lockOwner.id !== context.profile.id) {
728
+ return false;
729
+ }
730
+ // workaround for Shared files
731
+ if (context.navigation && context.navigation.url && context.navigation.url.startsWith('/shared')) {
732
+ // eslint-disable-next-line no-prototype-builtins
733
+ if (file.entry.hasOwnProperty('allowableOperationsOnTarget')) {
734
+ return context.permissions.check(file, ['update'], {
735
+ target: 'allowableOperationsOnTarget'
736
+ });
737
+ }
738
+ }
739
+ return context.permissions.check(file, ['update']);
645
740
  }
646
741
 
647
742
  /*!
648
- * @license
649
- * Alfresco Example Content Application
743
+ * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
650
744
  *
651
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
745
+ * Alfresco Example Content Application
652
746
  *
653
747
  * This file is part of the Alfresco Example Content Application.
654
748
  * If the software was purchased under a paid Alfresco license, the terms of
655
- * the paid license agreement will prevail. Otherwise, the software is
749
+ * the paid license agreement will prevail. Otherwise, the software is
656
750
  * provided under the following open source license terms:
657
751
  *
658
752
  * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
@@ -662,16 +756,16 @@ function isAdmin(context) {
662
756
  *
663
757
  * The Alfresco Example Content Application is distributed in the hope that it will be useful,
664
758
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
665
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
759
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
666
760
  * GNU Lesser General Public License for more details.
667
761
  *
668
762
  * You should have received a copy of the GNU Lesser General Public License
669
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
763
+ * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
670
764
  */
671
765
 
672
766
  /**
673
767
  * Generated bundle index. Do not edit.
674
768
  */
675
769
 
676
- export { canAddFavorite, canCopyNode, canCreateFolder, canDeleteSelection, canDownloadSelection, canEditFolder, canLeaveLibrary, canLockFile, canManageFileVersions, canManagePermissions, canRemoveFavorite, canShareFile, canShowInfoDrawer, canShowLanguagePicker, canShowLogout, canToggleEditOffline, canToggleFavorite, canToggleJoinLibrary, canToggleSharedLink, canUnlockFile, canUnshareNodes, canUpdateSelectedFolder, canUpdateSelectedNode, canUpload, canUploadVersion, canViewFile, hasFileSelected, hasFolderSelected, hasLibraryRole, hasLibrarySelected, hasLockedFiles, hasNoLibraryRole, hasQuickShareEnabled, hasSelection, isAdmin, isFavorites, isFavoritesPreview, isLibraries, isLibraryFiles, isLibraryManager, isNotFavorites, isNotLibraries, isNotRecentFiles, isNotSearchResults, isNotSharedFiles, isNotTrashcan, isPersonalFiles, isPreview, isPrivateLibrary, isRecentFiles, isSearchResults, isShared, isSharedFileViewer, isSharedFiles, isSharedPreview, isTrashcan, isTrashcanItemSelected, isUserWriteLockOwner, isWriteLocked };
677
- //# sourceMappingURL=alfresco-aca-shared-rules.js.map
770
+ export { canAddFavorite, canCopyNode, canCreateFolder, canCreateLibrary, canDeleteSelection, canDownloadSelection, canEditAspects, canEditFolder, canInfoPreview, canLeaveLibrary, canLockFile, canManageFileVersions, canManagePermissions, canOpenWithOffice, canRemoveFavorite, canShareFile, canShowInfoDrawer, canShowLogout, canToggleEditOffline, canToggleFavorite, canToggleJoinLibrary, canToggleSharedLink, canUnlockFile, canUnshareNodes, canUpdateSelectedFolder, canUpdateSelectedNode, canUpload, canUploadVersion, canViewFile, getFileExtension, hasFileSelected, hasFolderSelected, hasLibraryRole, hasLibrarySelected, hasLockedFiles, hasNoLibraryRole, hasQuickShareEnabled, hasSelection, isAdmin, isContentServiceEnabled, isFavorites, isFavoritesPreview, isLibraries, isLibraryContent, isLibraryFiles, isLibraryManager, isMajorVersionAvailable, isMultiselection, isNotFavorites, isNotLibraries, isNotRecentFiles, isNotSearchResults, isNotSharedFiles, isNotTrashcan, isPersonalFiles, isPreview, isPrivateLibrary, isRecentFiles, isSearchResults, isSearchSupported, isShared, isSharedFileViewer, isSharedFiles, isSharedPreview, isTrashcan, isTrashcanItemSelected, isUploadSupported, isUserWriteLockOwner, isWriteLocked, showInfoSelectionButton, supportedExtensions };
771
+ //# sourceMappingURL=alfresco-aca-shared-rules.mjs.map