@vc-shell/framework 1.0.127 → 1.0.129

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 (328) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/core/api/platform.ts +514 -92
  3. package/core/composables/index.ts +2 -1
  4. package/core/composables/useApiClient/index.ts +1 -7
  5. package/core/composables/useAssets/index.ts +0 -6
  6. package/core/composables/useBeforeUnload/index.ts +20 -0
  7. package/core/composables/useMenuService/index.ts +96 -0
  8. package/core/composables/useNotifications/index.ts +29 -40
  9. package/core/composables/useSettings/index.ts +23 -29
  10. package/core/composables/useUser/index.ts +69 -125
  11. package/core/directives/loading/styles.css +5 -5
  12. package/core/interceptors/index.ts +75 -0
  13. package/core/plugins/i18n/index.ts +1 -0
  14. package/core/plugins/modularity/index.ts +63 -20
  15. package/core/plugins/moment/moment.ts +2 -2
  16. package/core/plugins/signalR/index.ts +24 -4
  17. package/core/types/index.ts +18 -35
  18. package/core/utilities/kebabToCamel.ts +1 -1
  19. package/dist/core/api/platform.d.ts +125 -87
  20. package/dist/core/api/platform.d.ts.map +1 -1
  21. package/dist/core/composables/index.d.ts +2 -1
  22. package/dist/core/composables/index.d.ts.map +1 -1
  23. package/dist/core/composables/useApiClient/index.d.ts.map +1 -1
  24. package/dist/core/composables/useAssets/index.d.ts.map +1 -1
  25. package/dist/core/composables/useBeforeUnload/index.d.ts +5 -0
  26. package/dist/core/composables/useBeforeUnload/index.d.ts.map +1 -0
  27. package/dist/core/composables/useMenuService/index.d.ts +16 -0
  28. package/dist/core/composables/useMenuService/index.d.ts.map +1 -0
  29. package/dist/core/composables/useNotifications/index.d.ts.map +1 -1
  30. package/dist/core/composables/useSettings/index.d.ts +2 -2
  31. package/dist/core/composables/useSettings/index.d.ts.map +1 -1
  32. package/dist/core/composables/useUser/index.d.ts +8 -6
  33. package/dist/core/composables/useUser/index.d.ts.map +1 -1
  34. package/dist/core/interceptors/index.d.ts +3 -0
  35. package/dist/core/interceptors/index.d.ts.map +1 -0
  36. package/dist/core/plugins/i18n/index.d.ts.map +1 -1
  37. package/dist/core/plugins/modularity/index.d.ts +1 -1
  38. package/dist/core/plugins/modularity/index.d.ts.map +1 -1
  39. package/dist/core/plugins/moment/moment.d.ts.map +1 -1
  40. package/dist/core/plugins/signalR/index.d.ts.map +1 -1
  41. package/dist/core/types/index.d.ts +16 -29
  42. package/dist/core/types/index.d.ts.map +1 -1
  43. package/dist/{framework.mjs → framework.js} +31832 -31900
  44. package/dist/index.css +1 -1
  45. package/dist/index.d.ts +5 -1
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/shared/components/app-switcher/components/vc-app-switcher/index.d.ts +1 -19
  48. package/dist/shared/components/app-switcher/components/vc-app-switcher/index.d.ts.map +1 -1
  49. package/dist/shared/components/app-switcher/components/vc-app-switcher/vc-app-switcher.vue.d.ts +3 -0
  50. package/dist/shared/components/app-switcher/components/vc-app-switcher/vc-app-switcher.vue.d.ts.map +1 -1
  51. package/dist/shared/components/blade-navigation/components/vc-blade-navigation/index.d.ts +1 -70
  52. package/dist/shared/components/blade-navigation/components/vc-blade-navigation/index.d.ts.map +1 -1
  53. package/dist/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue.d.ts +1 -82
  54. package/dist/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue.d.ts.map +1 -1
  55. package/dist/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.d.ts +28 -0
  56. package/dist/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.d.ts.map +1 -0
  57. package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts +11 -27
  58. package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
  59. package/dist/shared/components/blade-navigation/injectionKeys.d.ts +4 -0
  60. package/dist/shared/components/blade-navigation/injectionKeys.d.ts.map +1 -0
  61. package/dist/shared/components/blade-navigation/plugin.d.ts +4 -1
  62. package/dist/shared/components/blade-navigation/plugin.d.ts.map +1 -1
  63. package/dist/shared/components/blade-navigation/types/index.d.ts +48 -35
  64. package/dist/shared/components/blade-navigation/types/index.d.ts.map +1 -1
  65. package/dist/shared/components/error-interceptor/index.d.ts +33 -67
  66. package/dist/shared/components/error-interceptor/index.d.ts.map +1 -1
  67. package/dist/shared/components/index.d.ts +2 -0
  68. package/dist/shared/components/index.d.ts.map +1 -1
  69. package/dist/shared/components/language-selector/index.d.ts +1 -49
  70. package/dist/shared/components/language-selector/index.d.ts.map +1 -1
  71. package/dist/shared/components/language-selector/language-selector.vue.d.ts +1 -40
  72. package/dist/shared/components/language-selector/language-selector.vue.d.ts.map +1 -1
  73. package/dist/{ui/components/organisms/vc-notification-dropdown → shared/components/notification-dropdown}/_internal/notification/notification.vue.d.ts +2 -2
  74. package/dist/shared/components/notification-dropdown/_internal/notification/notification.vue.d.ts.map +1 -0
  75. package/dist/shared/components/notification-dropdown/index.d.ts +7 -0
  76. package/dist/shared/components/notification-dropdown/index.d.ts.map +1 -0
  77. package/dist/shared/components/notification-dropdown/notification-dropdown.vue.d.ts +3 -0
  78. package/dist/shared/components/notification-dropdown/notification-dropdown.vue.d.ts.map +1 -0
  79. package/dist/shared/components/notification-template/index.d.ts +91 -0
  80. package/dist/shared/components/notification-template/index.d.ts.map +1 -0
  81. package/dist/{ui/components/organisms/vc-notification-template/vc-notification-template.vue.d.ts → shared/components/notification-template/notification-template.vue.d.ts} +2 -2
  82. package/dist/shared/components/notification-template/notification-template.vue.d.ts.map +1 -0
  83. package/dist/shared/components/notifications/components/notification-container/index.d.ts +1 -1
  84. package/dist/shared/components/notifications/components/notification-container/index.d.ts.map +1 -1
  85. package/dist/shared/components/popup-handler/composables/usePopup/index.d.ts.map +1 -1
  86. package/dist/shared/components/user-dropdown-button/index.d.ts +10 -16
  87. package/dist/shared/components/user-dropdown-button/index.d.ts.map +1 -1
  88. package/dist/shared/components/user-dropdown-button/user-dropdown-button.vue.d.ts +7 -4
  89. package/dist/shared/components/user-dropdown-button/user-dropdown-button.vue.d.ts.map +1 -1
  90. package/dist/shared/index.d.ts +4 -1
  91. package/dist/shared/index.d.ts.map +1 -1
  92. package/dist/shared/modules/assets/components/assets-details/assets-details.vue.d.ts +3 -0
  93. package/dist/shared/modules/assets/components/assets-details/assets-details.vue.d.ts.map +1 -1
  94. package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts +3 -0
  95. package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts.map +1 -1
  96. package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts.map +1 -1
  97. package/dist/shared/modules/dynamic/composables/useFilterBuilder/index.d.ts.map +1 -1
  98. package/dist/shared/modules/dynamic/factories/base/useDetailsFactory.d.ts.map +1 -1
  99. package/dist/shared/modules/dynamic/factories/types/index.d.ts +3 -1
  100. package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
  101. package/dist/shared/modules/dynamic/index.d.ts +1 -3
  102. package/dist/shared/modules/dynamic/index.d.ts.map +1 -1
  103. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +12 -10
  104. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
  105. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +5 -2
  106. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
  107. package/dist/shared/modules/dynamic/types/index.d.ts +20 -2
  108. package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
  109. package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts.map +1 -1
  110. package/dist/shared/pages/LoginPage/components/login/Login.vue.d.ts.map +1 -1
  111. package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts.map +1 -1
  112. package/dist/shared/utilities/vueUtils.d.ts.map +1 -1
  113. package/dist/tailwind.config.d.ts +56 -0
  114. package/dist/tailwind.config.d.ts.map +1 -0
  115. package/dist/tsconfig.tsbuildinfo +1 -1
  116. package/dist/ui/components/atoms/vc-badge/index.d.ts +32 -67
  117. package/dist/ui/components/atoms/vc-badge/index.d.ts.map +1 -1
  118. package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts.map +1 -1
  119. package/dist/ui/components/atoms/vc-button/vc-button.vue.d.ts +6 -1
  120. package/dist/ui/components/atoms/vc-button/vc-button.vue.d.ts.map +1 -1
  121. package/dist/ui/components/atoms/vc-card/index.d.ts +66 -102
  122. package/dist/ui/components/atoms/vc-card/index.d.ts.map +1 -1
  123. package/dist/ui/components/atoms/vc-card/vc-card.stories.d.ts +7 -0
  124. package/dist/ui/components/atoms/vc-card/vc-card.stories.d.ts.map +1 -0
  125. package/dist/ui/components/atoms/vc-card/vc-card.vue.d.ts +7 -1
  126. package/dist/ui/components/atoms/vc-card/vc-card.vue.d.ts.map +1 -1
  127. package/dist/ui/components/atoms/vc-checkbox/index.d.ts +91 -129
  128. package/dist/ui/components/atoms/vc-checkbox/index.d.ts.map +1 -1
  129. package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.vue.d.ts +7 -1
  130. package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.vue.d.ts.map +1 -1
  131. package/dist/ui/components/atoms/vc-col/vc-col.vue.d.ts +6 -1
  132. package/dist/ui/components/atoms/vc-col/vc-col.vue.d.ts.map +1 -1
  133. package/dist/ui/components/atoms/vc-container/index.d.ts +36 -71
  134. package/dist/ui/components/atoms/vc-container/index.d.ts.map +1 -1
  135. package/dist/ui/components/atoms/vc-container/vc-container.vue.d.ts.map +1 -1
  136. package/dist/ui/components/atoms/vc-hint/index.d.ts +8 -38
  137. package/dist/ui/components/atoms/vc-hint/index.d.ts.map +1 -1
  138. package/dist/ui/components/atoms/vc-hint/vc-hint.vue.d.ts.map +1 -1
  139. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts +3 -0
  140. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts.map +1 -1
  141. package/dist/ui/components/atoms/vc-image/vc-image.vue.d.ts +3 -0
  142. package/dist/ui/components/atoms/vc-image/vc-image.vue.d.ts.map +1 -1
  143. package/dist/ui/components/atoms/vc-info-row/vc-info-row.vue.d.ts +3 -0
  144. package/dist/ui/components/atoms/vc-info-row/vc-info-row.vue.d.ts.map +1 -1
  145. package/dist/ui/components/atoms/vc-label/index.d.ts +42 -74
  146. package/dist/ui/components/atoms/vc-label/index.d.ts.map +1 -1
  147. package/dist/ui/components/atoms/vc-label/vc-label.vue.d.ts +7 -1
  148. package/dist/ui/components/atoms/vc-label/vc-label.vue.d.ts.map +1 -1
  149. package/dist/ui/components/atoms/vc-link/index.d.ts +32 -66
  150. package/dist/ui/components/atoms/vc-link/index.d.ts.map +1 -1
  151. package/dist/ui/components/atoms/vc-link/vc-link.vue.d.ts.map +1 -1
  152. package/dist/ui/components/atoms/vc-loading/vc-loading.vue.d.ts.map +1 -1
  153. package/dist/ui/components/atoms/vc-progress/index.d.ts +30 -63
  154. package/dist/ui/components/atoms/vc-progress/index.d.ts.map +1 -1
  155. package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts +3 -0
  156. package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts.map +1 -1
  157. package/dist/ui/components/atoms/vc-row/vc-row.vue.d.ts +3 -1
  158. package/dist/ui/components/atoms/vc-row/vc-row.vue.d.ts.map +1 -1
  159. package/dist/ui/components/atoms/vc-status/vc-status.vue.d.ts +6 -1
  160. package/dist/ui/components/atoms/vc-status/vc-status.vue.d.ts.map +1 -1
  161. package/dist/ui/components/atoms/vc-status-icon/vc-status-icon.vue.d.ts.map +1 -1
  162. package/dist/ui/components/atoms/vc-switch/vc-switch.vue.d.ts.map +1 -1
  163. package/dist/ui/components/atoms/vc-video/vc-video.vue.d.ts +3 -0
  164. package/dist/ui/components/atoms/vc-video/vc-video.vue.d.ts.map +1 -1
  165. package/dist/ui/components/atoms/vc-widget/vc-widget.vue.d.ts.map +1 -1
  166. package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue.d.ts +3 -0
  167. package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue.d.ts.map +1 -1
  168. package/dist/ui/components/molecules/vc-code-editor/index.d.ts +59 -98
  169. package/dist/ui/components/molecules/vc-code-editor/index.d.ts.map +1 -1
  170. package/dist/ui/components/molecules/vc-code-editor/vc-code-editor.vue.d.ts +1 -0
  171. package/dist/ui/components/molecules/vc-code-editor/vc-code-editor.vue.d.ts.map +1 -1
  172. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +4 -1
  173. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
  174. package/dist/ui/components/molecules/vc-field/_internal/vc-field-type/vc-field-type.vue.d.ts.map +1 -1
  175. package/dist/ui/components/molecules/vc-field/vc-field.vue.d.ts +3 -0
  176. package/dist/ui/components/molecules/vc-field/vc-field.vue.d.ts.map +1 -1
  177. package/dist/ui/components/molecules/vc-file-upload/index.d.ts +67 -105
  178. package/dist/ui/components/molecules/vc-file-upload/index.d.ts.map +1 -1
  179. package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts +3 -0
  180. package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts.map +1 -1
  181. package/dist/ui/components/molecules/vc-form/index.d.ts +8 -38
  182. package/dist/ui/components/molecules/vc-form/index.d.ts.map +1 -1
  183. package/dist/ui/components/molecules/vc-form/vc-form.vue.d.ts.map +1 -1
  184. package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts +56 -1
  185. package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts.map +1 -1
  186. package/dist/ui/components/molecules/vc-input-currency/index.d.ts +159 -214
  187. package/dist/ui/components/molecules/vc-input-currency/index.d.ts.map +1 -1
  188. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts +3 -0
  189. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
  190. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +27 -9
  191. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts.map +1 -1
  192. package/dist/ui/components/molecules/vc-notification/vc-notification.vue.d.ts.map +1 -1
  193. package/dist/ui/components/molecules/vc-pagination/vc-pagination.vue.d.ts +3 -0
  194. package/dist/ui/components/molecules/vc-pagination/vc-pagination.vue.d.ts.map +1 -1
  195. package/dist/ui/components/molecules/vc-rating/index.d.ts +59 -96
  196. package/dist/ui/components/molecules/vc-rating/index.d.ts.map +1 -1
  197. package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts +3 -0
  198. package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts.map +1 -1
  199. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +257 -8
  200. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
  201. package/dist/ui/components/molecules/vc-slider/index.d.ts +55 -91
  202. package/dist/ui/components/molecules/vc-slider/index.d.ts.map +1 -1
  203. package/dist/ui/components/molecules/vc-slider/vc-slider.vue.d.ts +3 -0
  204. package/dist/ui/components/molecules/vc-slider/vc-slider.vue.d.ts.map +1 -1
  205. package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts +6 -1
  206. package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts.map +1 -1
  207. package/dist/ui/components/organisms/index.d.ts +0 -2
  208. package/dist/ui/components/organisms/index.d.ts.map +1 -1
  209. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue.d.ts +2 -4
  210. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue.d.ts.map +1 -1
  211. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts +10 -7
  212. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts.map +1 -1
  213. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts +10 -18
  214. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts.map +1 -1
  215. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue.d.ts +16 -16
  216. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue.d.ts.map +1 -1
  217. package/dist/ui/components/organisms/vc-app/index.d.ts +1 -292
  218. package/dist/ui/components/organisms/vc-app/index.d.ts.map +1 -1
  219. package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts +17 -56
  220. package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts.map +1 -1
  221. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue.d.ts.map +1 -1
  222. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts +3 -0
  223. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts.map +1 -1
  224. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue.d.ts +3 -0
  225. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue.d.ts.map +1 -1
  226. package/dist/ui/components/organisms/vc-blade/index.d.ts +89 -131
  227. package/dist/ui/components/organisms/vc-blade/index.d.ts.map +1 -1
  228. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts +3 -0
  229. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
  230. package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts +21 -18
  231. package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts.map +1 -1
  232. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +4 -1
  233. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts.map +1 -1
  234. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts +4 -1
  235. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts.map +1 -1
  236. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +3 -0
  237. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts.map +1 -1
  238. package/dist/ui/components/organisms/vc-login-form/index.d.ts +32 -66
  239. package/dist/ui/components/organisms/vc-login-form/index.d.ts.map +1 -1
  240. package/dist/ui/components/organisms/vc-login-form/vc-login-form.vue.d.ts +3 -0
  241. package/dist/ui/components/organisms/vc-login-form/vc-login-form.vue.d.ts.map +1 -1
  242. package/dist/ui/components/organisms/vc-popup/_internal/vc-popup-error/vc-popup-error.vue.d.ts.map +1 -1
  243. package/dist/ui/components/organisms/vc-popup/_internal/vc-popup-warning/vc-popup-warning.vue.d.ts.map +1 -1
  244. package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts.map +1 -1
  245. package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts +3 -0
  246. package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts.map +1 -1
  247. package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts +3 -0
  248. package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts.map +1 -1
  249. package/dist/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue.d.ts +3 -0
  250. package/dist/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue.d.ts.map +1 -1
  251. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +57 -6
  252. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
  253. package/dist/ui/types/index.d.ts +5 -45
  254. package/dist/ui/types/index.d.ts.map +1 -1
  255. package/package.json +24 -28
  256. package/shared/components/app-switcher/components/vc-app-switcher/index.ts +1 -3
  257. package/shared/components/app-switcher/composables/useAppSwitcher/index.ts +3 -3
  258. package/shared/components/blade-navigation/components/vc-blade-navigation/index.ts +1 -3
  259. package/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue +46 -157
  260. package/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.ts +81 -0
  261. package/shared/components/blade-navigation/composables/useBladeNavigation/index.ts +323 -261
  262. package/shared/components/blade-navigation/injectionKeys.ts +4 -0
  263. package/shared/components/blade-navigation/plugin.ts +8 -10
  264. package/shared/components/blade-navigation/types/index.ts +53 -44
  265. package/shared/components/index.ts +2 -0
  266. package/shared/components/language-selector/language-selector.vue +12 -12
  267. package/{ui/components/organisms/vc-notification-dropdown → shared/components/notification-dropdown}/_internal/notification/notification.vue +6 -5
  268. package/shared/components/notification-dropdown/index.ts +10 -0
  269. package/{ui/components/organisms/vc-notification-dropdown/vc-notification-dropdown.vue → shared/components/notification-dropdown/notification-dropdown.vue} +21 -17
  270. package/shared/components/notification-template/index.ts +10 -0
  271. package/{ui/components/organisms/vc-notification-template/vc-notification-template.vue → shared/components/notification-template/notification-template.vue} +2 -2
  272. package/shared/components/popup-handler/composables/usePopup/index.ts +29 -9
  273. package/shared/components/user-dropdown-button/user-dropdown-button.vue +58 -17
  274. package/shared/index.ts +3 -2
  275. package/shared/locales/en.json +7 -0
  276. package/shared/modules/assets/components/assets-details/assets-details.vue +5 -0
  277. package/shared/modules/assets-manager/components/assets-manager/assets-manager.vue +8 -5
  278. package/shared/modules/dynamic/components/fields/GalleryField.ts +7 -7
  279. package/shared/modules/dynamic/components/fields/InputCurrency.ts +2 -1
  280. package/shared/modules/dynamic/composables/useFilterBuilder/index.ts +42 -36
  281. package/shared/modules/dynamic/factories/base/useDetailsFactory.ts +5 -3
  282. package/shared/modules/dynamic/factories/types/index.ts +6 -2
  283. package/shared/modules/dynamic/helpers/override.ts +38 -32
  284. package/shared/modules/dynamic/helpers/safeIn.ts +1 -1
  285. package/shared/modules/dynamic/index.ts +12 -12
  286. package/shared/modules/dynamic/pages/dynamic-blade-form.vue +96 -57
  287. package/shared/modules/dynamic/pages/dynamic-blade-list.vue +150 -114
  288. package/shared/modules/dynamic/types/index.ts +22 -2
  289. package/shared/pages/InvitePage/components/invite/Invite.vue +2 -2
  290. package/shared/pages/LoginPage/components/login/Login.vue +23 -16
  291. package/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue +3 -3
  292. package/shared/utilities/vueUtils.ts +7 -7
  293. package/ui/components/atoms/vc-button/vc-button.vue +1 -1
  294. package/ui/components/atoms/vc-card/vc-card.stories.ts +25 -0
  295. package/ui/components/atoms/vc-card/vc-card.vue +1 -1
  296. package/ui/components/atoms/vc-container/vc-container.vue +1 -1
  297. package/ui/components/atoms/vc-icon/vc-icon.vue +1 -1
  298. package/ui/components/molecules/vc-editor/vc-editor.vue +2 -7
  299. package/ui/components/molecules/vc-notification/vc-notification.vue +2 -2
  300. package/ui/components/molecules/vc-select/vc-select.vue +13 -13
  301. package/ui/components/organisms/index.ts +0 -2
  302. package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +25 -42
  303. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +123 -25
  304. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +11 -103
  305. package/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +34 -52
  306. package/ui/components/organisms/vc-app/index.ts +1 -12
  307. package/ui/components/organisms/vc-app/vc-app.stories.ts +36 -36
  308. package/ui/components/organisms/vc-app/vc-app.vue +122 -61
  309. package/ui/components/organisms/vc-blade/vc-blade.vue +5 -13
  310. package/ui/components/organisms/vc-table/vc-table.vue +19 -11
  311. package/ui/locales/en.json +2 -4
  312. package/ui/types/index.ts +7 -51
  313. package/core/composables/useMenuComposer/index.ts +0 -25
  314. package/dist/core/composables/useMenuComposer/index.d.ts +0 -12
  315. package/dist/core/composables/useMenuComposer/index.d.ts.map +0 -1
  316. package/dist/ui/components/organisms/vc-notification-dropdown/_internal/notification/notification.vue.d.ts.map +0 -1
  317. package/dist/ui/components/organisms/vc-notification-dropdown/index.d.ts +0 -38
  318. package/dist/ui/components/organisms/vc-notification-dropdown/index.d.ts.map +0 -1
  319. package/dist/ui/components/organisms/vc-notification-dropdown/vc-notification-dropdown.vue.d.ts +0 -21
  320. package/dist/ui/components/organisms/vc-notification-dropdown/vc-notification-dropdown.vue.d.ts.map +0 -1
  321. package/dist/ui/components/organisms/vc-notification-template/index.d.ts +0 -2
  322. package/dist/ui/components/organisms/vc-notification-template/index.d.ts.map +0 -1
  323. package/dist/ui/components/organisms/vc-notification-template/vc-notification-template.vue.d.ts.map +0 -1
  324. package/dist/vite.config.d.ts +0 -3
  325. package/dist/vite.config.d.ts.map +0 -1
  326. package/tailwind.config.js +0 -50
  327. package/ui/components/organisms/vc-notification-dropdown/index.ts +0 -3
  328. package/ui/components/organisms/vc-notification-template/index.ts +0 -1
@@ -8,5 +8,6 @@ export * from "./useAsync";
8
8
  export * from "./useApiClient";
9
9
  export * from "./useLoading";
10
10
  export * from "./useErrorHandler";
11
- export * from "./useMenuComposer";
12
11
  export { useAssets } from "./useAssets";
12
+ export { useMenuService } from "./useMenuService";
13
+ export { useBeforeUnload } from "./useBeforeUnload";
@@ -1,5 +1,3 @@
1
- import { useUser } from "../useUser";
2
-
3
1
  export interface IAuthApiBase {
4
2
  authToken: string;
5
3
  setAuthToken(token: string): void;
@@ -11,14 +9,10 @@ interface UseApiClient<ApiClient extends IAuthApiBase> {
11
9
  }
12
10
 
13
11
  export function useApiClient<ApiClient extends IAuthApiBase>(
14
- c: new (baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> }) => ApiClient
12
+ c: new (baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> }) => ApiClient,
15
13
  ): UseApiClient<ApiClient> {
16
- const { getAccessToken } = useUser();
17
-
18
14
  async function getApiClient() {
19
15
  const client = new c();
20
- const token = await getAccessToken();
21
- if (token) client.setAuthToken(token);
22
16
  return client;
23
17
  }
24
18
 
@@ -11,7 +11,6 @@ export interface IUseAssets {
11
11
  }
12
12
 
13
13
  export function useAssets(): IUseAssets {
14
- const { getAccessToken } = useUser();
15
14
  const loading = ref(false);
16
15
 
17
16
  async function upload(files: FileList, uploadPath: string, startingSortOrder?: number): Promise<ICommonAsset[]> {
@@ -19,8 +18,6 @@ export function useAssets(): IUseAssets {
19
18
  loading.value = true;
20
19
 
21
20
  const uploadedAssets: Ref<ICommonAsset[]> = ref([]);
22
- const authToken = await getAccessToken();
23
-
24
21
  for (let i = 0; i < files.length; i++) {
25
22
  const formData = new FormData();
26
23
  formData.append("file", files[i]);
@@ -28,9 +25,6 @@ export function useAssets(): IUseAssets {
28
25
  const result = await fetch(`/api/assets?folderUrl=/${uploadPath}`, {
29
26
  method: "POST",
30
27
  body: formData,
31
- headers: {
32
- Authorization: `Bearer ${authToken}`,
33
- },
34
28
  });
35
29
 
36
30
  const response = await result.json();
@@ -0,0 +1,20 @@
1
+ import { onBeforeMount, onBeforeUnmount, unref, ComputedRef } from "vue";
2
+
3
+ export const useBeforeUnload = (modified: ComputedRef<boolean>) => {
4
+ onBeforeMount(() => {
5
+ window.addEventListener("beforeunload", preventUnload);
6
+ });
7
+
8
+ onBeforeUnmount(() => {
9
+ window.removeEventListener("beforeunload", preventUnload);
10
+ });
11
+
12
+ function preventUnload(event: Event) {
13
+ if (!unref(modified)) return;
14
+ event.preventDefault();
15
+ }
16
+
17
+ return {
18
+ modified,
19
+ };
20
+ };
@@ -0,0 +1,96 @@
1
+ import { createSharedComposable, createUnrefFn, useArrayFind } from "@vueuse/core";
2
+ import { Ref, ref, computed } from "vue";
3
+ import * as _ from "lodash-es";
4
+ import { i18n } from "./../../plugins/i18n";
5
+ import { MenuItemConfig } from "../../../shared/components/blade-navigation/types";
6
+ import { MenuItem } from "../../types";
7
+
8
+ export interface IUseMenuService {
9
+ addMenuItem: MenuItemConfig;
10
+ menuItems: Ref<MenuItem[]>;
11
+ removeMenuItem: (item: MenuItem) => void;
12
+ }
13
+
14
+ const menuItems: Ref<MenuItem[]> = ref([]);
15
+ const rawMenu: Ref<Record<string, unknown>[]> = ref([]);
16
+
17
+ function useMenuServiceFn() {
18
+ const { t } = i18n.global;
19
+
20
+ function addMenuItem(item: Record<string, unknown>) {
21
+ rawMenu.value.push(item);
22
+
23
+ constructMenu();
24
+ }
25
+
26
+ const upsert = createUnrefFn((array: Record<string, unknown>[], element: Record<string, unknown>) => {
27
+ const i = array.findIndex((_element) => _.isEqual(_element, element));
28
+ if (i > -1) array[i] = { ...element };
29
+ else array.push({ ...element });
30
+ });
31
+
32
+ function sortByPriority(a: MenuItem, b: MenuItem) {
33
+ const priorityA = a.priority !== undefined ? a.priority : Infinity;
34
+ const priorityB = b.priority !== undefined ? b.priority : Infinity;
35
+
36
+ return priorityA - priorityB;
37
+ }
38
+
39
+ function constructMenu() {
40
+ const constructedMenu = ref<MenuItem[]>([]);
41
+
42
+ rawMenu.value.forEach((item) => {
43
+ let group;
44
+ if (item.group) {
45
+ const isGroupExist = useArrayFind(constructedMenu, (m) => m.groupId === "group_" + item.group);
46
+
47
+ const groupItem = _.omit(
48
+ {
49
+ ...item,
50
+ title: computed(() => t(item.title as string)),
51
+ },
52
+ "group",
53
+ );
54
+
55
+ if (isGroupExist.value) {
56
+ upsert(isGroupExist.value.children, groupItem);
57
+ } else {
58
+ group = {
59
+ groupId: "group_" + item.group,
60
+ icon: item.icon,
61
+ title: computed(() => t(item.group as string)),
62
+ children: [_.omit(groupItem)],
63
+ priority: item.priority,
64
+ };
65
+ upsert(constructedMenu.value, group);
66
+ }
67
+ } else {
68
+ if (item && item.title) {
69
+ upsert(constructedMenu.value, {
70
+ ...item,
71
+ title: item.title,
72
+ });
73
+ }
74
+ }
75
+ });
76
+
77
+ menuItems.value = constructedMenu.value
78
+ .map((x, index) => ({ ...x, title: computed(() => t(x.title as string)), id: index }))
79
+ .sort(sortByPriority);
80
+ }
81
+
82
+ function removeMenuItem(item: MenuItem) {
83
+ const index = menuItems.value.indexOf(item);
84
+ menuItems.value.splice(index, 1);
85
+ }
86
+
87
+ return {
88
+ addMenuItem,
89
+ menuItems,
90
+ removeMenuItem,
91
+ };
92
+ }
93
+
94
+ const useMenuService = createSharedComposable(useMenuServiceFn);
95
+
96
+ export { useMenuService };
@@ -18,31 +18,24 @@ const notifications = ref<PushNotification[]>([]);
18
18
  const pushNotifications = ref<PushNotification[]>([]);
19
19
 
20
20
  export function useNotifications(notifyType?: string | string[]): INotifications {
21
- const { getAccessToken } = useUser();
22
-
23
21
  async function loadFromHistory(take = 10) {
24
- const token = await getAccessToken();
25
- if (token) {
26
- // TODO temporary workaround to get push notifications without base type
27
- try {
28
- notificationsClient.setAuthToken(token);
29
- const result = await fetch("/api/platform/pushnotifications", {
30
- method: "POST",
31
- headers: {
32
- "Content-Type": "application/json-patch+json",
33
- Accept: "application/json",
34
- authorization: `Bearer ${token}`,
35
- },
36
- body: JSON.stringify({ take }),
37
- });
22
+ // TODO temporary workaround to get push notifications without base type
23
+ try {
24
+ const result = await fetch("/api/platform/pushnotifications", {
25
+ method: "POST",
26
+ headers: {
27
+ "Content-Type": "application/json-patch+json",
28
+ Accept: "application/json",
29
+ },
30
+ body: JSON.stringify({ take }),
31
+ });
38
32
 
39
- result.text().then((response) => {
40
- notifications.value = <PushNotification[]>JSON.parse(response).notifyEvents ?? [];
41
- });
42
- } catch (e) {
43
- console.error(e);
44
- throw e;
45
- }
33
+ result.text().then((response) => {
34
+ notifications.value = <PushNotification[]>JSON.parse(response).notifyEvents ?? [];
35
+ });
36
+ } catch (e) {
37
+ console.error(e);
38
+ throw e;
46
39
  }
47
40
  }
48
41
 
@@ -75,21 +68,17 @@ export function useNotifications(notifyType?: string | string[]): INotifications
75
68
  }
76
69
 
77
70
  async function markAllAsRead() {
78
- const token = await getAccessToken();
79
- if (token) {
80
- notificationsClient.setAuthToken(token);
81
- try {
82
- await notificationsClient.markAllAsRead();
83
- notifications.value = notifications.value.map((x) => {
84
- if (x.isNew) {
85
- x.isNew = false;
86
- }
87
- return x;
88
- });
89
- } catch (e) {
90
- console.error(e);
91
- throw e;
92
- }
71
+ try {
72
+ await notificationsClient.markAllAsRead();
73
+ notifications.value = notifications.value.map((x) => {
74
+ if (x.isNew) {
75
+ x.isNew = false;
76
+ }
77
+ return x;
78
+ });
79
+ } catch (e) {
80
+ console.error(e);
81
+ throw e;
93
82
  }
94
83
  }
95
84
 
@@ -97,8 +86,8 @@ export function useNotifications(notifyType?: string | string[]): INotifications
97
86
  () =>
98
87
  pushNotifications.value.filter(
99
88
  (item: PushNotification) =>
100
- item.isNew && !!item.notifyType && !!notifyType && notifyType.includes(item.notifyType)
101
- ) ?? []
89
+ item.isNew && !!item.notifyType && !!notifyType && notifyType.includes(item.notifyType),
90
+ ) ?? [],
102
91
  );
103
92
 
104
93
  return {
@@ -1,6 +1,8 @@
1
- import { useUser } from "./../useUser";
2
- import { computed, inject, Ref, ref } from "vue";
1
+ import { useAsync } from "./../useAsync";
2
+ import { useApiClient } from "./../useApiClient";
3
+ import { computed, inject, onBeforeMount, Ref, ref, ComputedRef } from "vue";
3
4
  import { SettingClient } from "./../../api/platform";
5
+ import { useLoading } from "../useLoading";
4
6
 
5
7
  interface IUISetting {
6
8
  contrast_logo?: string;
@@ -10,52 +12,44 @@ interface IUISetting {
10
12
 
11
13
  interface IUseSettings {
12
14
  readonly uiSettings: Ref<IUISetting>;
13
- getUiCustomizationSettings: () => void;
15
+ readonly loading: ComputedRef<boolean>;
14
16
  applySettings: (args: { logo?: string; title?: string }) => void;
15
17
  }
16
18
 
17
- const uiSettings = ref<IUISetting>({
18
- logo: undefined,
19
- title: undefined,
20
- });
19
+ const uiSettings = ref<IUISetting | undefined>();
21
20
  export function useSettings(): IUseSettings {
22
- const { getAccessToken } = useUser();
23
21
  const base = inject("platformUrl");
24
22
 
25
- async function getApiClient() {
26
- const client = new SettingClient();
27
- client.setAuthToken((await getAccessToken()) ?? "");
28
- return client;
29
- }
23
+ const { getApiClient } = useApiClient(SettingClient);
30
24
 
31
- async function getUiCustomizationSettings() {
32
- const client = await getApiClient();
25
+ const { loading, action: getUiCustomizationSettings } = useAsync(async () => {
26
+ const result = await (await getApiClient()).getUICustomizationSetting();
27
+ const settings = await JSON.parse(result.defaultValue ?? null);
33
28
 
34
- try {
35
- const result = await client.getUICustomizationSetting();
36
- const settings = JSON.parse(result.defaultValue);
29
+ if (settings) {
37
30
  uiSettings.value = {
38
31
  contrast_logo: base + settings.contrast_logo,
39
32
  logo: base + settings.logo,
40
33
  title: settings.title,
41
34
  };
42
- } catch (e) {
43
- console.error(e);
44
35
  }
45
- }
36
+ });
46
37
 
47
38
  function applySettings(args: { logo?: string; title?: string }) {
48
- if (args.logo) {
49
- uiSettings.value.logo = args.logo;
50
- }
51
- if (args.title) {
52
- uiSettings.value.title = args.title;
53
- }
39
+ uiSettings.value = {
40
+ ...uiSettings.value,
41
+ logo: args.logo,
42
+ title: args.title,
43
+ };
54
44
  }
55
45
 
46
+ onBeforeMount(async () => {
47
+ await getUiCustomizationSettings();
48
+ });
49
+
56
50
  return {
57
- uiSettings: computed(() => uiSettings.value),
58
- getUiCustomizationSettings,
51
+ uiSettings: computed(() => uiSettings.value ?? {}),
59
52
  applySettings,
53
+ loading: useLoading(loading),
60
54
  };
61
55
  }
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import { computed, Ref, ref, ComputedRef } from "vue";
3
- import ClientOAuth2 from "client-oauth2";
4
3
  import {
5
4
  UserDetail,
6
5
  SecurityClient,
@@ -12,30 +11,21 @@ import {
12
11
  ChangePasswordRequest,
13
12
  LoginType,
14
13
  ExternalSignInProviderInfo,
14
+ LoginRequest,
15
+ SignInResult,
15
16
  } from "./../../api/platform";
16
- import { AuthData, RequestPasswordResult, SignInResults } from "./../../types";
17
- import { useLocalStorage } from "@vueuse/core";
18
- //The Platform Manager uses the same key to store authorization data in the
19
- //local storage, so we can exchange authorization data between the Platform Manager
20
- //and the user application that is hosted in the same domain as the sub application.
21
- const VC_AUTH_DATA_KEY = "ls.authenticationData";
17
+ import { RequestPasswordResult } from "./../../types";
18
+ import { createSharedComposable, useLocalStorage } from "@vueuse/core";
22
19
 
23
- const user: Ref<UserDetail | undefined> = ref();
24
- const loading: Ref<boolean> = ref(false);
25
- const authData: Ref<AuthData | undefined> = ref();
26
- const authClient = new ClientOAuth2({
27
- accessTokenUri: `/connect/token`,
28
- scopes: ["offline_access"],
29
- });
30
- const securityClient = new SecurityClient();
20
+ const VC_EXTERNAL_AUTH_DATA_KEY = "externalSignIn";
31
21
 
32
22
  interface IUseUser {
33
23
  user: ComputedRef<UserDetail | undefined>;
34
24
  loading: ComputedRef<boolean>;
35
25
  isAdministrator: ComputedRef<boolean | undefined>;
36
- getAccessToken: () => Promise<string | undefined>;
26
+ // getAccessToken: () => Promise<string | undefined>;
37
27
  loadUser: () => Promise<UserDetail>;
38
- signIn: (username: string, password: string) => Promise<SignInResults>;
28
+ signIn: (username: string, password: string) => Promise<SignInResult | { succeeded: boolean; error?: any }>;
39
29
  signOut: () => Promise<void>;
40
30
  validateToken: (userId: string, token: string) => Promise<boolean>;
41
31
  validatePassword: (password: string) => Promise<IdentityResult>;
@@ -45,19 +35,25 @@ interface IUseUser {
45
35
  getExternalLoginProviders: () => Promise<ExternalSignInProviderInfo[] | undefined>;
46
36
  externalSignIn: (authenticationType?: string | undefined, returnUrl?: string | undefined) => void;
47
37
  getLoginType: () => Promise<LoginType[]>;
48
- isAuthenticated: () => Promise<boolean>;
38
+ isAuthenticated: ComputedRef<boolean>;
49
39
  }
40
+ const user: Ref<UserDetail | undefined> = ref();
41
+ function useUserFn(): IUseUser {
42
+ const loading: Ref<boolean> = ref(false);
50
43
 
51
- export function useUser(): IUseUser {
44
+ const securityClient = new SecurityClient();
52
45
  const base = window.location.origin + "/";
53
46
  const externalSecurityClient = new ExternalSignInClient(base);
54
- const externalSignInStorage = useLocalStorage<{ providerType: string | undefined }>("externalSignIn", {
55
- providerType: undefined,
56
- });
47
+ const externalSignInStorage = useLocalStorage<{ providerType?: string | undefined }>(
48
+ VC_EXTERNAL_AUTH_DATA_KEY,
49
+ {},
50
+ {
51
+ listenToStorageChanges: true,
52
+ deep: true,
53
+ },
54
+ );
57
55
 
58
- const isAuthenticated = async () => {
59
- return !!((externalSignInStorage.value && externalSignInStorage.value.providerType) ?? (await getAccessToken()));
60
- };
56
+ const isAuthenticated = computed(() => user.value?.userName != null);
61
57
 
62
58
  async function validateToken(userId: string, token: string): Promise<boolean> {
63
59
  let result = false;
@@ -85,111 +81,60 @@ export function useUser(): IUseUser {
85
81
  } as ResetPasswordConfirmRequest);
86
82
  }
87
83
 
88
- async function signIn(username: string, password: string): Promise<SignInResults> {
84
+ async function signIn(
85
+ username: string,
86
+ password: string,
87
+ ): Promise<SignInResult | { succeeded: boolean; error?: any }> {
89
88
  console.debug(`[@vc-shell/framework#useUser:signIn] - Entry point`);
90
- let token = undefined;
91
89
  try {
92
90
  loading.value = true;
93
- token = await authClient.owner.getToken(username, password);
94
- } catch (e) {
91
+ const result = await securityClient.login(new LoginRequest({ userName: username, password }));
92
+ return await securityClient
93
+ .getCurrentUser()
94
+ .then((res) => {
95
+ if (res) {
96
+ user.value = res;
97
+ return result;
98
+ }
99
+ throw { succeeded: false };
100
+ })
101
+ .catch((e) => {
102
+ throw e;
103
+ });
104
+ } catch (e: any) {
95
105
  //TODO: log error
96
- return { succeeded: false, error: e as string };
106
+ console.log(e);
107
+ return { succeeded: false, error: e.message };
97
108
  } finally {
98
109
  loading.value = false;
99
110
  }
100
-
101
- if (token) {
102
- authData.value = {
103
- accessToken: token.accessToken,
104
- refreshToken: token.refreshToken,
105
- expiresAt: addOffsetToCurrentDate(Number(token.data["expires_in"])),
106
- userName: username,
107
- };
108
- console.log("[useUser]: an access token has been obtained successfully", authData.value);
109
-
110
- storeAuthData(authData.value);
111
- }
112
- await loadUser();
113
- return { succeeded: true };
114
111
  }
115
112
 
116
113
  async function signOut(): Promise<void> {
117
114
  console.debug(`[@vc-shell/framework#useUser:signOut] - Entry point`);
118
115
 
119
- if (externalSignInStorage.value && externalSignInStorage.value.providerType) {
120
- externalSignOut(externalSignInStorage.value.providerType);
116
+ if (externalSignInStorage.value?.providerType) {
117
+ await externalSignOut(externalSignInStorage.value.providerType);
121
118
  } else {
122
119
  user.value = undefined;
123
- authData.value = undefined;
124
- storeAuthData({});
120
+ securityClient.logout();
125
121
  }
126
122
  }
127
123
 
128
124
  async function loadUser(): Promise<UserDetail> {
129
125
  console.debug(`[@vc-shell/framework#useUser:loadUser] - Entry point`);
130
- const token = await getAccessToken();
131
- if (token) {
132
- securityClient.setAuthToken(token);
133
-
134
- try {
135
- loading.value = true;
136
- user.value = await securityClient.getCurrentUser();
137
- console.log("[useUser]: an user details has been loaded", user.value);
138
- } catch (e) {
139
- console.dir(e);
140
- throw e;
141
- } finally {
142
- loading.value = false;
143
- }
144
- }
145
-
146
- return { ...user.value } as UserDetail;
147
- }
148
126
 
149
- async function getAccessToken(): Promise<string | undefined> {
150
- console.debug(`[@vc-shell/framework#useUser:getAccessToken] - Entry point`);
151
- if (!authData.value || Object.keys(authData.value).length === 0) {
152
- authData.value = await readAuthData();
153
- }
154
-
155
- if (authData.value && Date.now() >= (authData.value.expiresAt ?? 0)) {
156
- const token = authClient.createToken(
157
- authData.value.accessToken ?? authData.value.token ?? "",
158
- authData.value.refreshToken ?? "",
159
- {}
160
- );
161
-
162
- console.log("[useUser]: an access token is expired, using refresh token to receive a new");
163
- try {
164
- const newToken = await token.refresh();
165
- if (newToken) {
166
- authData.value = {
167
- ...authData.value,
168
- accessToken: newToken.accessToken,
169
- token: newToken.accessToken,
170
- refreshToken: newToken.refreshToken,
171
- expiresAt: addOffsetToCurrentDate(Number(newToken.data["expires_in"])),
172
- };
173
- storeAuthData(authData.value);
174
- }
175
- } catch (e) {
176
- console.log("[useUser]: getAccessToken() returns error", e);
177
- }
127
+ try {
128
+ loading.value = true;
129
+ user.value = await securityClient.getCurrentUser();
130
+ console.log("[useUser]: an user details has been loaded", user.value);
131
+ } catch (e: any) {
132
+ console.error(e);
133
+ } finally {
134
+ loading.value = false;
178
135
  }
179
136
 
180
- return authData.value?.accessToken ?? authData.value?.token;
181
- }
182
-
183
- function storeAuthData(authData: AuthData) {
184
- localStorage.setItem(VC_AUTH_DATA_KEY, JSON.stringify({ ...(authData || {}) }));
185
- }
186
-
187
- async function readAuthData(): Promise<AuthData> {
188
- return (await JSON.parse(localStorage.getItem(VC_AUTH_DATA_KEY) || "{}")) as AuthData;
189
- }
190
-
191
- function addOffsetToCurrentDate(offsetInSeconds: number): number {
192
- return Date.now() + offsetInSeconds * 1000;
137
+ return { ...user.value } as UserDetail;
193
138
  }
194
139
 
195
140
  async function requestPasswordReset(loginOrEmail: string): Promise<RequestPasswordResult> {
@@ -206,23 +151,20 @@ export function useUser(): IUseUser {
206
151
  }
207
152
 
208
153
  async function changeUserPassword(oldPassword: string, newPassword: string): Promise<SecurityResult | undefined> {
209
- const token = await getAccessToken();
210
154
  let result;
211
155
 
212
- if (token) {
213
- try {
214
- loading.value = true;
215
- const command = new ChangePasswordRequest({
216
- oldPassword,
217
- newPassword,
218
- });
219
-
220
- result = await securityClient.changeCurrentUserPassword(command);
221
- } catch (e: any) {
222
- return { succeeded: false, errors: [e.message] } as SecurityResult;
223
- } finally {
224
- loading.value = false;
225
- }
156
+ try {
157
+ loading.value = true;
158
+ const command = new ChangePasswordRequest({
159
+ oldPassword,
160
+ newPassword,
161
+ });
162
+
163
+ result = await securityClient.changeCurrentUserPassword(command);
164
+ } catch (e: any) {
165
+ return { succeeded: false, errors: [e.message] } as SecurityResult;
166
+ } finally {
167
+ loading.value = false;
226
168
  }
227
169
 
228
170
  return result;
@@ -282,7 +224,7 @@ export function useUser(): IUseUser {
282
224
  try {
283
225
  externalSecurityClient.signOut(authenticationType);
284
226
 
285
- externalSignInStorage.value = null;
227
+ externalSignInStorage.value = {};
286
228
  } catch (e) {
287
229
  console.error(e);
288
230
  throw e;
@@ -294,7 +236,7 @@ export function useUser(): IUseUser {
294
236
  loading: computed(() => loading.value),
295
237
  isAdministrator: computed(() => user.value?.isAdministrator),
296
238
  isAuthenticated,
297
- getAccessToken,
239
+ // getAccessToken,
298
240
  loadUser,
299
241
  signIn,
300
242
  signOut,
@@ -308,3 +250,5 @@ export function useUser(): IUseUser {
308
250
  getLoginType,
309
251
  };
310
252
  }
253
+
254
+ export const useUser = createSharedComposable(() => useUserFn());
@@ -5,9 +5,9 @@
5
5
  }
6
6
 
7
7
  .v-loading::before {
8
- content: '';
8
+ content: "";
9
9
  position: absolute;
10
- z-index: 99998;
10
+ z-index: 9998;
11
11
  top: 0;
12
12
  right: 0;
13
13
  bottom: 0;
@@ -17,9 +17,9 @@
17
17
  }
18
18
 
19
19
  .v-loading::after {
20
- content: '';
20
+ content: "";
21
21
  position: absolute;
22
- z-index: 99999;
22
+ z-index: 9999;
23
23
  width: 30px;
24
24
  height: 30px;
25
25
  border: 4px solid #319ed4;
@@ -33,6 +33,6 @@
33
33
 
34
34
  @keyframes v-loading {
35
35
  to {
36
- transform: rotate(360deg);
36
+ transform: rotate(360deg);
37
37
  }
38
38
  }