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