eservices-core 1.0.537 → 1.0.539
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.
|
@@ -55,6 +55,11 @@ declare class ApplicationManager extends EventEmitter {
|
|
|
55
55
|
* @description Method for update current context. After success emit event[EVENT_UPDATE_CONTEXT]
|
|
56
56
|
*/
|
|
57
57
|
setCurrentContext(id: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* @description Возвращает текущий контекст. В случае, если контекст ещё не получен, или (Внутрення ошибка) не найде
|
|
60
|
+
* но ни одного соответствия с уже запрошенными контекстами, возвращается null.
|
|
61
|
+
* */
|
|
62
|
+
get context(): null | ICustomerContext;
|
|
58
63
|
/**
|
|
59
64
|
* @description Initialization of ApplicationManager
|
|
60
65
|
*/
|
|
@@ -82,4 +87,10 @@ export { ApplicationManager, Manager };
|
|
|
82
87
|
export declare function useManagerState(): {
|
|
83
88
|
contextType: "person" | "organization";
|
|
84
89
|
contextId: number;
|
|
90
|
+
context: {
|
|
91
|
+
id: number;
|
|
92
|
+
name: string;
|
|
93
|
+
email?: string;
|
|
94
|
+
photo?: string;
|
|
95
|
+
};
|
|
85
96
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* eservices-core v1.0.
|
|
2
|
+
* eservices-core v1.0.539
|
|
3
3
|
* (c) 2023 ESERVICES
|
|
4
4
|
*/
|
|
5
5
|
'use strict';
|
|
@@ -2111,6 +2111,18 @@ class ApplicationManager extends EventEmitter {
|
|
|
2111
2111
|
this.emit(ApplicationManager.EVENT_CONTEXT_UPDATE, id);
|
|
2112
2112
|
console.log(`Current context id %c${id}`, 'color: purple');
|
|
2113
2113
|
}
|
|
2114
|
+
/**
|
|
2115
|
+
* @description Возвращает текущий контекст. В случае, если контекст ещё не получен, или (Внутрення ошибка) не найде
|
|
2116
|
+
* но ни одного соответствия с уже запрошенными контекстами, возвращается null.
|
|
2117
|
+
* */
|
|
2118
|
+
get context() {
|
|
2119
|
+
var _a;
|
|
2120
|
+
if (!this.contextId)
|
|
2121
|
+
return null;
|
|
2122
|
+
if (this.contextId === ((_a = this.person) === null || _a === void 0 ? void 0 : _a.id))
|
|
2123
|
+
return this.person;
|
|
2124
|
+
return this.organizations.find(org => org.id === this.contextId) || null;
|
|
2125
|
+
}
|
|
2114
2126
|
/**
|
|
2115
2127
|
* @description Initialization of ApplicationManager
|
|
2116
2128
|
*/
|
|
@@ -2155,13 +2167,16 @@ class ApplicationManager extends EventEmitter {
|
|
|
2155
2167
|
return !!this.organizations.find(org => org.id === id);
|
|
2156
2168
|
}
|
|
2157
2169
|
getListKeyById(id) {
|
|
2170
|
+
console.log('DEPRECATED');
|
|
2158
2171
|
return `list-information-${id}`;
|
|
2159
2172
|
}
|
|
2160
2173
|
getListInformationFromLocalStorage(id) {
|
|
2174
|
+
console.log('DEPRECATED');
|
|
2161
2175
|
const data = localStorage.getItem(this.getListKeyById(id));
|
|
2162
2176
|
return !!data ? JSON.parse(data) : data;
|
|
2163
2177
|
}
|
|
2164
2178
|
setListInformationToLocalStorage(id, info) {
|
|
2179
|
+
console.log('DEPRECATED');
|
|
2165
2180
|
localStorage.setItem(this.getListKeyById(id), JSON.stringify(info));
|
|
2166
2181
|
}
|
|
2167
2182
|
}
|
|
@@ -2177,11 +2192,13 @@ const Manager = new ApplicationManager();
|
|
|
2177
2192
|
function useManagerState() {
|
|
2178
2193
|
const state = vue.reactive({
|
|
2179
2194
|
contextType: Manager.contextType,
|
|
2180
|
-
contextId: Manager.contextId
|
|
2195
|
+
contextId: Manager.contextId,
|
|
2196
|
+
context: Manager.context
|
|
2181
2197
|
});
|
|
2182
2198
|
Manager.onupdateContext(() => {
|
|
2183
2199
|
state.contextType = Manager.contextType;
|
|
2184
2200
|
state.contextId = Manager.contextId;
|
|
2201
|
+
state.context = Manager.context;
|
|
2185
2202
|
});
|
|
2186
2203
|
return state;
|
|
2187
2204
|
}
|