@alfresco/aca-shared 1.12.0 → 4.0.0-A.2-9919

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