eservices-core 1.0.393 → 1.0.395

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.
@@ -1,33 +1,54 @@
1
- import { ComputedRef, Ref } from "vue";
1
+ import EventEmitter from "jenesius-event-emitter";
2
2
  export interface ICustomerContext {
3
3
  id: number;
4
4
  name: string;
5
5
  email?: string;
6
6
  photo?: string;
7
7
  }
8
- declare const _default: {
8
+ declare class ApplicationManager extends EventEmitter {
9
+ #private;
10
+ static EVENT_CONTEXT_UPDATE: string;
11
+ static EVENT_READY_UPDATE: string;
12
+ static EVENT_DATA_UPDATE: string;
9
13
  /**
10
- * @description Identity of current context. NULL if the data was not upload from web-service.
14
+ * @description Key for localStorage, saving current context ID. using after user login to system
15
+ * */
16
+ static CURRENT_CONTEXT_KEY: string;
17
+ /**
18
+ * @description Current customer id. If Application state is not ready - undefined.
11
19
  */
12
- currentContextId: Ref<null | number>;
20
+ contextId?: number;
13
21
  /**
14
- * @description Computed data of current context. Person or Organization
22
+ * @description Person information.
15
23
  */
16
- currentContext: ComputedRef<null | ICustomerContext>;
17
- person: Ref<null | ICustomerContext>;
18
- organizations: Ref<ICustomerContext[]>;
24
+ person?: ICustomerContext;
19
25
  /**
20
- * true - если информация о пользователе получена.
21
- * */
22
- isReady: Ref<boolean>;
26
+ * @description List of organizations
27
+ */
28
+ organizations: ICustomerContext[];
29
+ set ready(v: boolean);
30
+ get ready(): boolean;
31
+ onReady(callback: () => any): () => void;
32
+ onupdateContext(callback: (id: number) => any): () => void;
33
+ onupdateData(callback: () => any): () => void;
34
+ /**
35
+ * @description Method for update current context. After success emit event[EVENT_UPDATE_CONTEXT]
36
+ */
23
37
  setCurrentContext(id: number): void;
24
38
  /**
25
- * @description Update Full user data, like Name, Email, Id, Organization's list and other.
26
- * */
39
+ * @description Initialization of ApplicationManager
40
+ */
41
+ init(): Promise<void>;
42
+ private loadCustomerData;
43
+ /**
44
+ * @description The main method of application. Load the main information about user.
45
+ * @deprecated
46
+ */
27
47
  updateFullClientData(): Promise<void>;
28
48
  /**
29
49
  * @description Method using for validate provided ID, Checking with existing person ID and each organization ID.
30
50
  * */
31
- validateContextId(id: number): boolean;
32
- };
33
- export default _default;
51
+ private validateContextId;
52
+ }
53
+ declare const Manager: ApplicationManager;
54
+ export { ApplicationManager, Manager };
@@ -7,6 +7,7 @@ import StepWorker from "./StepWorker";
7
7
  import ErrorStorageSystem from "./ErrorStorageSystem";
8
8
  import InterfaceWorker from "./InterfaceWorker";
9
9
  import Table from "./Table";
10
+ import { ApplicationManager } from "./ApplicationManager";
10
11
  declare const _default: {
11
12
  StepWorker: typeof StepWorker;
12
13
  Errors: typeof CoreError;
@@ -20,15 +21,6 @@ declare const _default: {
20
21
  render: typeof render;
21
22
  };
22
23
  InterfaceWorker: typeof InterfaceWorker;
23
- ApplicationManager: {
24
- currentContextId: import("vue").Ref<number>;
25
- currentContext: import("vue").ComputedRef<import("./ApplicationManager").ICustomerContext>;
26
- person: import("vue").Ref<import("./ApplicationManager").ICustomerContext>;
27
- organizations: import("vue").Ref<import("./ApplicationManager").ICustomerContext[]>;
28
- isReady: import("vue").Ref<boolean>;
29
- setCurrentContext(id: number): void;
30
- updateFullClientData(): Promise<void>;
31
- validateContextId(id: number): boolean;
32
- };
24
+ ApplicationManager: typeof ApplicationManager;
33
25
  };
34
26
  export default _default;
@@ -0,0 +1,19 @@
1
+ import { ICustomerContext } from "../classes/ApplicationManager";
2
+ export default function useCustomerState(): {
3
+ state: {
4
+ readonly contextId: number;
5
+ readonly person: {
6
+ readonly id: number;
7
+ readonly name: string;
8
+ readonly email?: string;
9
+ readonly photo?: string;
10
+ };
11
+ readonly organizations: readonly {
12
+ readonly id: number;
13
+ readonly name: string;
14
+ readonly email?: string;
15
+ readonly photo?: string;
16
+ }[];
17
+ };
18
+ currentContext: import("vue").ComputedRef<ICustomerContext>;
19
+ };
package/dist/index.d.ts CHANGED
@@ -8,10 +8,10 @@ import StylesInterface from "./styles/types";
8
8
  import { Values } from "./types";
9
9
  import Icon from "./widgets/icons/Icon.vue";
10
10
  import { IListCell, IListConfig, IFilterConfig, ISortConfig } from "./classes/List";
11
+ import { ICustomerContext } from "./classes/ApplicationManager";
11
12
  import { setupSocket, useSocket } from "./socket/use-socket";
12
13
  import WidgetBreadcrumbs from "./widgets/breadcrumbs/widget-breadcrumbs.vue";
13
14
  import WidgetCommunication from "./widgets/communication/widget-communication.vue";
14
- import WidgetOldList from "./widgets/tables/WidgetList.vue";
15
15
  import WidgetList from "./widgets/list/widget-list.vue";
16
16
  import WidgetSection from "./widgets/section/widget-section.vue";
17
17
  import WidgetTableController from "./widgets/tables/table-with-form/widget-table-controller.vue";
@@ -23,7 +23,6 @@ import WidgetNotificationSystem from "./widgets/errorSystem/default/WidgetNotifi
23
23
  import WidgetImage from "./widgets/image/widget-image.vue";
24
24
  import WidgetButton from "./widgets/buttons/WidgetButton.vue";
25
25
  import WidgetNotFound from "./widgets/notFound/WidgetNotFound.vue";
26
- import InterfaceContainer from "./widgets/interface/interface-container.vue";
27
26
  import WidgetCard from "./widgets/cards/widget-card.vue";
28
27
  import WidgetWizard from "./widgets/wizard/WidgetWizard.vue";
29
28
  import WidgetMultiButton from "./widgets/buttons/multi-button/WidgetMultiButton.vue";
@@ -37,9 +36,9 @@ import metadataService from "./services/metadata-service";
37
36
  import fileService from "./services/FileService";
38
37
  import invitationService from "./services/invitation-service";
39
38
  import CoreError from "./classes/CoreError";
40
- import OldList, { ListCell } from "./classes/_List";
39
+ import { ListCell } from "./classes/_List";
41
40
  import ProcessWrap from "./classes/ProcessWrap";
42
- import ApplicationManager from "./classes/ApplicationManager";
41
+ import { ApplicationManager, Manager } from "./classes/ApplicationManager";
43
42
  import NotificationSystem from "./classes/NotificationSystem";
44
43
  import List from "./classes/List";
45
44
  import { clickOutside, requestHandler } from "./utils";
@@ -51,6 +50,7 @@ import useFormAction from "./hooks/use-form-action";
51
50
  import useFormLabel from "./hooks/use-form-label";
52
51
  import useFormRequestData from "./hooks/use-form-request-data";
53
52
  import { useListFilter, useListOrder, useListState } from "./classes/List";
53
+ import useCustomerState from "./hooks/use-customer-state";
54
54
  export {
55
55
  /**
56
56
  * @deprecated
@@ -60,21 +60,16 @@ clickOutside,
60
60
  * @deprecated
61
61
  * */
62
62
  requestHandler, useSocket, setupSocket };
63
- export { ApplicationManager, NotificationSystem, Table, CoreError, List, OldList, ProcessWrap, ListCell };
63
+ export { ApplicationManager, Manager, NotificationSystem, Table, CoreError, List, ProcessWrap, ListCell };
64
64
  export { fileService, processWizardService, viewService, authService, dataService, communicationService, metadataService, invitationService };
65
65
  /**
66
66
  * HOOKS
67
67
  * */
68
- export { useFormMetadata, useFormAction, useFormLabel, useFormRequestData, useListFilter, useListOrder, useListState };
68
+ export { useFormMetadata, useFormAction, useFormLabel, useFormRequestData, useListFilter, useListOrder, useListState, useCustomerState };
69
69
  /**
70
70
  * All components binding with VueComponents must have name started with Widget.
71
71
  * */
72
- export { WidgetNotificationSystem, WidgetForm, ModalValidation, WidgetTable, WidgetTableController, WidgetSpinner, WidgetBreadcrumbs, WidgetCommunication, WidgetList, WidgetOldList, WidgetSection, WidgetImage, WidgetButton, WidgetNotFound, InterfaceContainer as WidgetInterfaceContainer,
73
- /**
74
- * @deprecated We must use own WidgetIcon in custom project. Rewrite WidgetIcon to CoreIcon and use only inside Core
75
- * components.
76
- * */
77
- Icon as WidgetIcon, WidgetCard, WidgetWizard, WidgetMultiButton, WidgetShadowForm };
72
+ export { WidgetNotificationSystem, WidgetForm, ModalValidation, WidgetTable, WidgetTableController, WidgetSpinner, WidgetBreadcrumbs, WidgetCommunication, WidgetList, WidgetSection, WidgetImage, WidgetButton, WidgetNotFound, Icon as WidgetIcon, WidgetCard, WidgetWizard, WidgetMultiButton, WidgetShadowForm };
78
73
  declare const utils: {
79
74
  clickOutside: typeof _utils.clickOutside;
80
75
  requestHandler: typeof _utils.requestHandler;
@@ -87,7 +82,7 @@ export { utils };
87
82
  /**
88
83
  * Interfaces
89
84
  * */
90
- export { IListCell, IListConfig, IFilterConfig, ISortConfig };
85
+ export { IListCell, IListConfig, IFilterConfig, ISortConfig, ICustomerContext };
91
86
  declare const _default: {
92
87
  services: {
93
88
  authService: typeof authService;
@@ -162,16 +157,7 @@ declare const _default: {
162
157
  render: typeof import("./classes/ViewForm/render").default;
163
158
  };
164
159
  InterfaceWorker: typeof import("./classes/InterfaceWorker").default;
165
- ApplicationManager: {
166
- currentContextId: import("vue").Ref<number>;
167
- currentContext: import("vue").ComputedRef<import("./classes/ApplicationManager").ICustomerContext>;
168
- person: import("vue").Ref<import("./classes/ApplicationManager").ICustomerContext>;
169
- organizations: import("vue").Ref<import("./classes/ApplicationManager").ICustomerContext[]>;
170
- isReady: import("vue").Ref<boolean>;
171
- setCurrentContext(id: number): void;
172
- updateFullClientData(): Promise<void>;
173
- validateContextId(id: number): boolean;
174
- };
160
+ ApplicationManager: typeof ApplicationManager;
175
161
  };
176
162
  mixins: typeof mixins;
177
163
  config: typeof config;