@vc-shell/framework 1.0.128 → 1.0.130

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 (331) hide show
  1. package/CHANGELOG.md +38 -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 +61 -132
  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 +23 -3
  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} +32147 -32235
  44. package/dist/index.css +1 -1
  45. package/dist/index.d.ts +5 -2
  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 +16 -1
  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 +26 -30
  256. package/shared/components/app-switcher/components/vc-app-switcher/index.ts +1 -3
  257. package/shared/components/app-switcher/composables/useAppSwitcher/index.ts +2 -2
  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 +133 -118
  288. package/shared/modules/dynamic/types/index.ts +16 -1
  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/tailwind.config.ts +50 -0
  294. package/ui/components/atoms/vc-button/vc-button.vue +1 -1
  295. package/ui/components/atoms/vc-card/vc-card.stories.ts +25 -0
  296. package/ui/components/atoms/vc-card/vc-card.vue +1 -1
  297. package/ui/components/atoms/vc-container/vc-container.vue +1 -1
  298. package/ui/components/atoms/vc-icon/vc-icon.vue +1 -1
  299. package/ui/components/molecules/vc-editor/vc-editor.vue +2 -7
  300. package/ui/components/molecules/vc-notification/vc-notification.vue +2 -2
  301. package/ui/components/molecules/vc-select/vc-select.vue +13 -13
  302. package/ui/components/organisms/index.ts +0 -2
  303. package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +25 -42
  304. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +123 -25
  305. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +11 -103
  306. package/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +34 -52
  307. package/ui/components/organisms/vc-app/index.ts +1 -12
  308. package/ui/components/organisms/vc-app/vc-app.stories.ts +36 -36
  309. package/ui/components/organisms/vc-app/vc-app.vue +122 -61
  310. package/ui/components/organisms/vc-blade/vc-blade.vue +5 -13
  311. package/ui/components/organisms/vc-table/vc-table.vue +9 -9
  312. package/ui/locales/en.json +2 -4
  313. package/ui/types/index.ts +7 -51
  314. package/core/composables/useMenuComposer/index.ts +0 -25
  315. package/dist/core/composables/useMenuComposer/index.d.ts +0 -12
  316. package/dist/core/composables/useMenuComposer/index.d.ts.map +0 -1
  317. package/dist/ui/components/organisms/vc-notification-dropdown/_internal/notification/notification.vue.d.ts.map +0 -1
  318. package/dist/ui/components/organisms/vc-notification-dropdown/index.d.ts +0 -38
  319. package/dist/ui/components/organisms/vc-notification-dropdown/index.d.ts.map +0 -1
  320. package/dist/ui/components/organisms/vc-notification-dropdown/vc-notification-dropdown.vue.d.ts +0 -21
  321. package/dist/ui/components/organisms/vc-notification-dropdown/vc-notification-dropdown.vue.d.ts.map +0 -1
  322. package/dist/ui/components/organisms/vc-notification-template/index.d.ts +0 -2
  323. package/dist/ui/components/organisms/vc-notification-template/index.d.ts.map +0 -1
  324. package/dist/ui/components/organisms/vc-notification-template/vc-notification-template.vue.d.ts.map +0 -1
  325. package/dist/utils/isInDemoMode.d.ts +0 -2
  326. package/dist/utils/isInDemoMode.d.ts.map +0 -1
  327. package/dist/vite.config.d.ts +0 -3
  328. package/dist/vite.config.d.ts.map +0 -1
  329. package/tailwind.config.js +0 -50
  330. package/ui/components/organisms/vc-notification-dropdown/index.ts +0 -3
  331. 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,29 +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, useStorage } 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 authClient = new ClientOAuth2({
26
- accessTokenUri: `/connect/token`,
27
- scopes: ["offline_access"],
28
- });
29
- const securityClient = new SecurityClient();
20
+ const VC_EXTERNAL_AUTH_DATA_KEY = "externalSignIn";
30
21
 
31
22
  interface IUseUser {
32
23
  user: ComputedRef<UserDetail | undefined>;
33
24
  loading: ComputedRef<boolean>;
34
25
  isAdministrator: ComputedRef<boolean | undefined>;
35
- getAccessToken: () => Promise<string | undefined>;
26
+ // getAccessToken: () => Promise<string | undefined>;
36
27
  loadUser: () => Promise<UserDetail>;
37
- signIn: (username: string, password: string) => Promise<SignInResults>;
28
+ signIn: (username: string, password: string) => Promise<SignInResult | { succeeded: boolean; error?: any }>;
38
29
  signOut: () => Promise<void>;
39
30
  validateToken: (userId: string, token: string) => Promise<boolean>;
40
31
  validatePassword: (password: string) => Promise<IdentityResult>;
@@ -44,28 +35,25 @@ interface IUseUser {
44
35
  getExternalLoginProviders: () => Promise<ExternalSignInProviderInfo[] | undefined>;
45
36
  externalSignIn: (authenticationType?: string | undefined, returnUrl?: string | undefined) => void;
46
37
  getLoginType: () => Promise<LoginType[]>;
47
- isAuthenticated: () => Promise<boolean>;
38
+ isAuthenticated: ComputedRef<boolean>;
48
39
  }
40
+ const user: Ref<UserDetail | undefined> = ref();
41
+ function useUserFn(): IUseUser {
42
+ const loading: Ref<boolean> = ref(false);
49
43
 
50
- const simulateLogin = async () => {
51
- return {
52
- accessToken: "testToken",
53
- refreshToken: "testTokenRefresh",
54
- data: { expires_in: new Date(new Date().setDate(new Date().getDate() + 1)) },
55
- };
56
- };
57
-
58
- export function useUser(): IUseUser {
59
- const authData: Ref<AuthData | null> = useStorage(VC_AUTH_DATA_KEY, {});
44
+ const securityClient = new SecurityClient();
60
45
  const base = window.location.origin + "/";
61
46
  const externalSecurityClient = new ExternalSignInClient(base);
62
- const externalSignInStorage = useLocalStorage<{ providerType: string | undefined }>("externalSignIn", {
63
- providerType: undefined,
64
- });
47
+ const externalSignInStorage = useLocalStorage<{ providerType?: string | undefined }>(
48
+ VC_EXTERNAL_AUTH_DATA_KEY,
49
+ {},
50
+ {
51
+ listenToStorageChanges: true,
52
+ deep: true,
53
+ },
54
+ );
65
55
 
66
- const isAuthenticated = async () => {
67
- return !!((externalSignInStorage.value && externalSignInStorage.value.providerType) ?? (await getAccessToken()));
68
- };
56
+ const isAuthenticated = computed(() => user.value?.userName != null);
69
57
 
70
58
  async function validateToken(userId: string, token: string): Promise<boolean> {
71
59
  let result = false;
@@ -93,69 +81,55 @@ export function useUser(): IUseUser {
93
81
  } as ResetPasswordConfirmRequest);
94
82
  }
95
83
 
96
- 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 }> {
97
88
  console.debug(`[@vc-shell/framework#useUser:signIn] - Entry point`);
98
- let token = undefined;
99
89
  try {
100
90
  loading.value = true;
101
- token = !window.__DEMO_MODE__ ? await authClient.owner.getToken(username, password) : await simulateLogin();
102
- } 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) {
103
105
  //TODO: log error
104
- return { succeeded: false, error: e as string };
106
+ console.log(e);
107
+ return { succeeded: false, error: e.message };
105
108
  } finally {
106
109
  loading.value = false;
107
110
  }
108
-
109
- if (token) {
110
- authData.value = {
111
- accessToken: token.accessToken,
112
- refreshToken: token.refreshToken,
113
- expiresAt: addOffsetToCurrentDate(Number(token.data?.["expires_in"])),
114
- userName: username,
115
- };
116
- console.log("[useUser]: an access token has been obtained successfully", authData.value);
117
-
118
- storeAuthData(authData.value);
119
- }
120
-
121
- await loadUser();
122
- return { succeeded: true };
123
111
  }
124
112
 
125
113
  async function signOut(): Promise<void> {
126
114
  console.debug(`[@vc-shell/framework#useUser:signOut] - Entry point`);
127
115
 
128
- if (externalSignInStorage.value && externalSignInStorage.value.providerType) {
129
- externalSignOut(externalSignInStorage.value.providerType);
116
+ if (externalSignInStorage.value?.providerType) {
117
+ await externalSignOut(externalSignInStorage.value.providerType);
130
118
  } else {
131
119
  user.value = undefined;
132
- authData.value = null;
133
- storeAuthData(null);
120
+ securityClient.logout();
134
121
  }
135
122
  }
136
123
 
137
124
  async function loadUser(): Promise<UserDetail> {
138
125
  console.debug(`[@vc-shell/framework#useUser:loadUser] - Entry point`);
139
126
 
140
- if (!externalSignInStorage.value?.providerType) {
141
- const token = await getAccessToken();
142
- if (token) {
143
- securityClient.setAuthToken(token);
144
- }
145
- }
146
-
147
127
  try {
148
128
  loading.value = true;
149
- user.value = !window.__DEMO_MODE__
150
- ? await securityClient.getCurrentUser()
151
- : ({
152
- id: "testUserId",
153
- userName: "testUserName",
154
- } as UserDetail);
155
-
129
+ user.value = await securityClient.getCurrentUser();
156
130
  console.log("[useUser]: an user details has been loaded", user.value);
157
131
  } catch (e: any) {
158
- console.dir(e);
132
+ console.error(e);
159
133
  } finally {
160
134
  loading.value = false;
161
135
  }
@@ -163,50 +137,6 @@ export function useUser(): IUseUser {
163
137
  return { ...user.value } as UserDetail;
164
138
  }
165
139
 
166
- async function getAccessToken(): Promise<string | undefined> {
167
- console.debug(`[@vc-shell/framework#useUser:getAccessToken] - Entry point`);
168
- if (authData.value) {
169
- if (Date.now() >= (authData.value.expiresAt ?? 0)) {
170
- const token = authClient.createToken(
171
- authData.value.accessToken ?? authData.value.token ?? "",
172
- authData.value.refreshToken ?? "",
173
- {}
174
- );
175
-
176
- console.log("[useUser]: an access token is expired, using refresh token to receive a new");
177
- try {
178
- const newToken = await token.refresh();
179
- if (newToken) {
180
- authData.value = {
181
- ...authData.value,
182
- accessToken: newToken.accessToken,
183
- token: newToken.accessToken,
184
- refreshToken: newToken.refreshToken,
185
- expiresAt: addOffsetToCurrentDate(Number(newToken.data["expires_in"])),
186
- };
187
- storeAuthData(authData.value);
188
- }
189
- } catch (e: any) {
190
- console.log("[useUser]: getAccessToken() returns error", e);
191
- }
192
- }
193
-
194
- return authData.value?.accessToken ?? authData.value?.token;
195
- }
196
- }
197
-
198
- function storeAuthData(data: AuthData | null) {
199
- authData.value = data;
200
- }
201
-
202
- async function readAuthData(): Promise<AuthData> {
203
- return (await JSON.parse(localStorage.getItem(VC_AUTH_DATA_KEY) || "{}")) as AuthData;
204
- }
205
-
206
- function addOffsetToCurrentDate(offsetInSeconds: number): number {
207
- return Date.now() + offsetInSeconds * 1000;
208
- }
209
-
210
140
  async function requestPasswordReset(loginOrEmail: string): Promise<RequestPasswordResult> {
211
141
  try {
212
142
  loading.value = true;
@@ -221,23 +151,20 @@ export function useUser(): IUseUser {
221
151
  }
222
152
 
223
153
  async function changeUserPassword(oldPassword: string, newPassword: string): Promise<SecurityResult | undefined> {
224
- const token = await getAccessToken();
225
154
  let result;
226
155
 
227
- if (token) {
228
- try {
229
- loading.value = true;
230
- const command = new ChangePasswordRequest({
231
- oldPassword,
232
- newPassword,
233
- });
156
+ try {
157
+ loading.value = true;
158
+ const command = new ChangePasswordRequest({
159
+ oldPassword,
160
+ newPassword,
161
+ });
234
162
 
235
- result = await securityClient.changeCurrentUserPassword(command);
236
- } catch (e: any) {
237
- return { succeeded: false, errors: [e.message] } as SecurityResult;
238
- } finally {
239
- loading.value = false;
240
- }
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;
241
168
  }
242
169
 
243
170
  return result;
@@ -297,7 +224,7 @@ export function useUser(): IUseUser {
297
224
  try {
298
225
  externalSecurityClient.signOut(authenticationType);
299
226
 
300
- externalSignInStorage.value = null;
227
+ externalSignInStorage.value = {};
301
228
  } catch (e) {
302
229
  console.error(e);
303
230
  throw e;
@@ -309,7 +236,7 @@ export function useUser(): IUseUser {
309
236
  loading: computed(() => loading.value),
310
237
  isAdministrator: computed(() => user.value?.isAdministrator),
311
238
  isAuthenticated,
312
- getAccessToken,
239
+ // getAccessToken,
313
240
  loadUser,
314
241
  signIn,
315
242
  signOut,
@@ -323,3 +250,5 @@ export function useUser(): IUseUser {
323
250
  getLoginType,
324
251
  };
325
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
  }