@voplus/morpho-csp 6.0.27 → 6.0.28
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.
- package/es/data/virtual-address/VirtualAddressStore.d.ts +39 -0
- package/es/data/virtual-address/VirtualAddressStore.js +141 -0
- package/es/data/virtual-address/VirtualAddressStore.js.map +1 -0
- package/es/data/virtual-address/hook.d.ts +10 -0
- package/es/data/virtual-address/hook.js +25 -0
- package/es/data/virtual-address/hook.js.map +1 -0
- package/es/data/virtual-address/index.d.ts +5 -0
- package/es/data/virtual-address/index.js +6 -0
- package/es/data/virtual-address/index.js.map +1 -0
- package/es/data/virtual-address/interfaces.d.ts +25 -0
- package/es/data/virtual-address/interfaces.js +2 -0
- package/es/data/virtual-address/interfaces.js.map +1 -0
- package/es/data/virtual-address/types.d.ts +37 -0
- package/es/data/virtual-address/types.js +2 -0
- package/es/data/virtual-address/types.js.map +1 -0
- package/es/data/virtual-address/virtualAddress-events/index.d.ts +3 -0
- package/es/data/virtual-address/virtualAddress-events/index.js +4 -0
- package/es/data/virtual-address/virtualAddress-events/index.js.map +1 -0
- package/es/data/virtual-address/virtualAddress-events/useAutoUpdateListData.d.ts +4 -0
- package/es/data/virtual-address/virtualAddress-events/useAutoUpdateListData.js +13 -0
- package/es/data/virtual-address/virtualAddress-events/useAutoUpdateListData.js.map +1 -0
- package/es/data/virtual-address/virtualAddress-events/useOnDeleteVirtualAddress.d.ts +4 -0
- package/es/data/virtual-address/virtualAddress-events/useOnDeleteVirtualAddress.js +16 -0
- package/es/data/virtual-address/virtualAddress-events/useOnDeleteVirtualAddress.js.map +1 -0
- package/es/data/virtual-address/virtualAddress-events/useOnNewVirtualAddress.d.ts +4 -0
- package/es/data/virtual-address/virtualAddress-events/useOnNewVirtualAddress.js +16 -0
- package/es/data/virtual-address/virtualAddress-events/useOnNewVirtualAddress.js.map +1 -0
- package/es/data/virtual-address-mail/VirtualAddressMailStore.d.ts +33 -0
- package/es/data/virtual-address-mail/VirtualAddressMailStore.js +121 -0
- package/es/data/virtual-address-mail/VirtualAddressMailStore.js.map +1 -0
- package/es/data/virtual-address-mail/hook.d.ts +9 -0
- package/es/data/virtual-address-mail/hook.js +19 -0
- package/es/data/virtual-address-mail/hook.js.map +1 -0
- package/es/data/virtual-address-mail/index.d.ts +5 -0
- package/es/data/virtual-address-mail/index.js +6 -0
- package/es/data/virtual-address-mail/index.js.map +1 -0
- package/es/data/virtual-address-mail/interfaces.d.ts +14 -0
- package/es/data/virtual-address-mail/interfaces.js +2 -0
- package/es/data/virtual-address-mail/interfaces.js.map +1 -0
- package/es/data/virtual-address-mail/types.d.ts +35 -0
- package/es/data/virtual-address-mail/types.js +2 -0
- package/es/data/virtual-address-mail/types.js.map +1 -0
- package/es/data/virtual-address-mail/virtualAddressMail-events/index.d.ts +3 -0
- package/es/data/virtual-address-mail/virtualAddressMail-events/index.js +4 -0
- package/es/data/virtual-address-mail/virtualAddressMail-events/index.js.map +1 -0
- package/es/data/virtual-address-mail/virtualAddressMail-events/useAutoUpdateListData.d.ts +4 -0
- package/es/data/virtual-address-mail/virtualAddressMail-events/useAutoUpdateListData.js +13 -0
- package/es/data/virtual-address-mail/virtualAddressMail-events/useAutoUpdateListData.js.map +1 -0
- package/es/data/virtual-address-mail/virtualAddressMail-events/useOnDeleteVirtualAddressMail.d.ts +4 -0
- package/es/data/virtual-address-mail/virtualAddressMail-events/useOnDeleteVirtualAddressMail.js +16 -0
- package/es/data/virtual-address-mail/virtualAddressMail-events/useOnDeleteVirtualAddressMail.js.map +1 -0
- package/es/data/virtual-address-mail/virtualAddressMail-events/useOnNewVirtualAddressMail.d.ts +4 -0
- package/es/data/virtual-address-mail/virtualAddressMail-events/useOnNewVirtualAddressMail.js +16 -0
- package/es/data/virtual-address-mail/virtualAddressMail-events/useOnNewVirtualAddressMail.js.map +1 -0
- package/es/modules/corporate/clda/pages/CLDASettingsPage/index.less +1 -0
- package/es/modules/corporate/company/pages/CompanyPage/index.js +4 -1
- package/es/modules/corporate/company/pages/CompanyPage/index.js.map +1 -1
- package/es/modules/corporate/virtual-address/components/NewVirtualAddressForm/VirtualAddressForm.d.ts +17 -0
- package/es/modules/corporate/virtual-address/components/NewVirtualAddressForm/VirtualAddressForm.js +51 -0
- package/es/modules/corporate/virtual-address/components/NewVirtualAddressForm/VirtualAddressForm.js.map +1 -0
- package/es/modules/corporate/virtual-address/components/NewVirtualAddressForm/index.d.ts +10 -0
- package/es/modules/corporate/virtual-address/components/NewVirtualAddressForm/index.js +14 -0
- package/es/modules/corporate/virtual-address/components/NewVirtualAddressForm/index.js.map +1 -0
- package/es/modules/corporate/virtual-address/components/NewVirtualAddressForm/index.less +27 -0
- package/es/modules/corporate/virtual-address/components/NewVirtualAddressForm/state.d.ts +5 -0
- package/es/modules/corporate/virtual-address/components/NewVirtualAddressForm/state.js +26 -0
- package/es/modules/corporate/virtual-address/components/NewVirtualAddressForm/state.js.map +1 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressHeader/index.d.ts +6 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressHeader/index.js +19 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressHeader/index.js.map +1 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressHeader/index.less +12 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressItem/index.d.ts +6 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressItem/index.js +35 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressItem/index.js.map +1 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressItem/index.less +29 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressList/index.d.ts +14 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressList/index.js +47 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressList/index.js.map +1 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressList/index.less +11 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressProperties/index.d.ts +21 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressProperties/index.js +46 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressProperties/index.js.map +1 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressProperties/index.less +7 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressPropertiesView/index.d.ts +7 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressPropertiesView/index.js +16 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressPropertiesView/index.js.map +1 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressPropertiesView/index.less +26 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressQuickViewDialog/index.d.ts +8 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressQuickViewDialog/index.js +13 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressQuickViewDialog/index.js.map +1 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressQuickViewDialog/index.less +7 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressTabs/index.d.ts +8 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressTabs/index.js +64 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressTabs/index.js.map +1 -0
- package/es/modules/corporate/virtual-address/components/VirtualAddressTabs/index.less +8 -0
- package/es/modules/corporate/virtual-address/controls/VirtualAddressMenu/index.d.ts +7 -0
- package/es/modules/corporate/virtual-address/controls/VirtualAddressMenu/index.js +13 -0
- package/es/modules/corporate/virtual-address/controls/VirtualAddressMenu/index.js.map +1 -0
- package/es/modules/corporate/virtual-address/pages/VirtualAddressDefaultView/index.d.ts +4 -0
- package/es/modules/corporate/virtual-address/pages/VirtualAddressDefaultView/index.js +24 -0
- package/es/modules/corporate/virtual-address/pages/VirtualAddressDefaultView/index.js.map +1 -0
- package/es/modules/corporate/virtual-address/pages/VirtualAddressDefaultView/index.less +19 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsItem/index.d.ts +9 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsItem/index.js +45 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsItem/index.js.map +1 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsItem/index.less +55 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsList/index.d.ts +7 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsList/index.js +35 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsList/index.js.map +1 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsList/index.less +14 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsSelect/index.d.ts +11 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsSelect/index.js +44 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsSelect/index.js.map +1 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsSelect/state.d.ts +11 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsSelect/state.js +69 -0
- package/es/modules/corporate/virtual-address/receipents/components/ReceipentsSelect/state.js.map +1 -0
- package/es/modules/corporate/virtual-address-mail/components/NewVirtualAddressMailForm/VirtualAddressMailForm.d.ts +20 -0
- package/es/modules/corporate/virtual-address-mail/components/NewVirtualAddressMailForm/VirtualAddressMailForm.js +67 -0
- package/es/modules/corporate/virtual-address-mail/components/NewVirtualAddressMailForm/VirtualAddressMailForm.js.map +1 -0
- package/es/modules/corporate/virtual-address-mail/components/NewVirtualAddressMailForm/index.d.ts +10 -0
- package/es/modules/corporate/virtual-address-mail/components/NewVirtualAddressMailForm/index.js +14 -0
- package/es/modules/corporate/virtual-address-mail/components/NewVirtualAddressMailForm/index.js.map +1 -0
- package/es/modules/corporate/virtual-address-mail/components/NewVirtualAddressMailForm/index.less +27 -0
- package/es/modules/corporate/virtual-address-mail/components/NewVirtualAddressMailForm/state.d.ts +8 -0
- package/es/modules/corporate/virtual-address-mail/components/NewVirtualAddressMailForm/state.js +52 -0
- package/es/modules/corporate/virtual-address-mail/components/NewVirtualAddressMailForm/state.js.map +1 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailHeader/index.d.ts +6 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailHeader/index.js +19 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailHeader/index.js.map +1 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailHeader/index.less +12 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailItem/index.d.ts +7 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailItem/index.js +35 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailItem/index.js.map +1 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailItem/index.less +29 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailList/index.d.ts +16 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailList/index.js +53 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailList/index.js.map +1 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailList/index.less +11 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailProperties/index.d.ts +21 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailProperties/index.js +51 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailProperties/index.js.map +1 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailProperties/index.less +7 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailPropertiesView/index.d.ts +7 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailPropertiesView/index.js +16 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailPropertiesView/index.js.map +1 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailPropertiesView/index.less +26 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailQuickViewDialog/index.d.ts +8 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailQuickViewDialog/index.js +13 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailQuickViewDialog/index.js.map +1 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailQuickViewDialog/index.less +7 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailTabs/index.d.ts +8 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailTabs/index.js +54 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailTabs/index.js.map +1 -0
- package/es/modules/corporate/virtual-address-mail/components/VirtualAddressMailTabs/index.less +8 -0
- package/es/modules/corporate/virtual-address-mail/controls/VirtualAddressMailMenu/index.d.ts +7 -0
- package/es/modules/corporate/virtual-address-mail/controls/VirtualAddressMailMenu/index.js +13 -0
- package/es/modules/corporate/virtual-address-mail/controls/VirtualAddressMailMenu/index.js.map +1 -0
- package/es/modules/corporate/virtual-address-mail/pages/VirtualAddressMailDefaultView/index.d.ts +4 -0
- package/es/modules/corporate/virtual-address-mail/pages/VirtualAddressMailDefaultView/index.js +24 -0
- package/es/modules/corporate/virtual-address-mail/pages/VirtualAddressMailDefaultView/index.js.map +1 -0
- package/es/modules/corporate/virtual-address-mail/pages/VirtualAddressMailDefaultView/index.less +19 -0
- package/es/routes.d.ts +12 -0
- package/es/routes.js +27 -1
- package/es/routes.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { IVirtualAddress, LoadVirtualAddressListOptions, LoadVirtualAddressOptions, EditVirtualAddressOptions, CreateVirtualAddressOptions, DeleteVirtualAddressOptions, IReceipents } from ".";
|
|
2
|
+
import { ApiEndPoint } from "@voplus/api";
|
|
3
|
+
import { CountedMap, Store } from "@voplus/morpho-data";
|
|
4
|
+
export declare class VirtualAddressStore extends Store {
|
|
5
|
+
private readonly _api;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
/** Contac created event dispatcher */
|
|
8
|
+
private readonly _created;
|
|
9
|
+
private readonly _deleted;
|
|
10
|
+
constructor(_api: ApiEndPoint);
|
|
11
|
+
/** Event fires when a new virtual-address has been created. */
|
|
12
|
+
get VirtualAddressCreatedEvent(): import("strongly-typed-events").IEvent<VirtualAddressStore, IVirtualAddress>;
|
|
13
|
+
/** Event fires when a delete contact has been deleted. */
|
|
14
|
+
get VirtualAddressDeletedEvent(): import("strongly-typed-events").IEvent<VirtualAddressStore, IVirtualAddress>;
|
|
15
|
+
/** All currently used contacts. */
|
|
16
|
+
readonly items: CountedMap<string, IVirtualAddress>;
|
|
17
|
+
/** All currently used contacts. */
|
|
18
|
+
readonly receipents: CountedMap<string, IReceipents>;
|
|
19
|
+
/** Create a new contact base on type. */
|
|
20
|
+
create(options: CreateVirtualAddressOptions): Promise<IVirtualAddress>;
|
|
21
|
+
/** Load a task from server.
|
|
22
|
+
* @param {string} id - id of the task.
|
|
23
|
+
* @param {LoadTaskOptions} options - Optional load options.
|
|
24
|
+
*/
|
|
25
|
+
load(id: string, options: LoadVirtualAddressOptions): Promise<IVirtualAddress>;
|
|
26
|
+
/** Load a list of virtual-address from server.
|
|
27
|
+
* @param {LoadVirtualAddressListOptions}
|
|
28
|
+
*/
|
|
29
|
+
loadList(options?: LoadVirtualAddressListOptions): Promise<IVirtualAddress[]>;
|
|
30
|
+
/** Load a list of virtual-address from server.
|
|
31
|
+
* @param {LoadVirtualAddressListOptions}
|
|
32
|
+
*/
|
|
33
|
+
loadReceipentList(options?: LoadVirtualAddressListOptions): Promise<IReceipents[]>;
|
|
34
|
+
/** Edit an existing item on server. */
|
|
35
|
+
edit(id: string, options: EditVirtualAddressOptions): Promise<void>;
|
|
36
|
+
delete(ids: string[], options?: DeleteVirtualAddressOptions): Promise<any>;
|
|
37
|
+
}
|
|
38
|
+
/** React hook to retrieve ContactStore */
|
|
39
|
+
export declare const useVirtualAddressStore: () => VirtualAddressStore;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { RequestBuilder } from "@voplus/api";
|
|
3
|
+
import { CountedMap, Store, useApplicationContext } from "@voplus/morpho-data";
|
|
4
|
+
import { action, observable } from "mobx";
|
|
5
|
+
import { EventDispatcher } from "strongly-typed-events";
|
|
6
|
+
const StoreName = "VirtualAddressStore";
|
|
7
|
+
export class VirtualAddressStore extends Store {
|
|
8
|
+
constructor(_api) {
|
|
9
|
+
super();
|
|
10
|
+
Object.defineProperty(this, "_api", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: _api
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "name", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: StoreName
|
|
21
|
+
});
|
|
22
|
+
/** Contac created event dispatcher */
|
|
23
|
+
Object.defineProperty(this, "_created", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true,
|
|
27
|
+
value: new EventDispatcher()
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(this, "_deleted", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
writable: true,
|
|
33
|
+
value: new EventDispatcher()
|
|
34
|
+
});
|
|
35
|
+
/** All currently used contacts. */
|
|
36
|
+
Object.defineProperty(this, "items", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: new CountedMap((key) => ({ id: key, loaded: false }), observable.map([], { deep: true }))
|
|
41
|
+
});
|
|
42
|
+
/** All currently used contacts. */
|
|
43
|
+
Object.defineProperty(this, "receipents", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true,
|
|
47
|
+
value: new CountedMap((key) => ({ id: key, loaded: false }), observable.map([], { deep: true }))
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** Event fires when a new virtual-address has been created. */
|
|
51
|
+
get VirtualAddressCreatedEvent() {
|
|
52
|
+
return this._created.asEvent();
|
|
53
|
+
}
|
|
54
|
+
/** Event fires when a delete contact has been deleted. */
|
|
55
|
+
get VirtualAddressDeletedEvent() {
|
|
56
|
+
return this._deleted.asEvent();
|
|
57
|
+
}
|
|
58
|
+
/** Create a new contact base on type. */
|
|
59
|
+
async create(options) {
|
|
60
|
+
// invariant(options.data.name, "Name cannot be empty.");
|
|
61
|
+
return await this.action(async () => {
|
|
62
|
+
const r = await this._api.post(`/api/csp/corporate/addresses/create`, new RequestBuilder().json(options.data));
|
|
63
|
+
const t = (await r.json());
|
|
64
|
+
this._created.dispatch(this, t);
|
|
65
|
+
return t;
|
|
66
|
+
}, options);
|
|
67
|
+
}
|
|
68
|
+
/** Load a task from server.
|
|
69
|
+
* @param {string} id - id of the task.
|
|
70
|
+
* @param {LoadTaskOptions} options - Optional load options.
|
|
71
|
+
*/
|
|
72
|
+
async load(id, options) {
|
|
73
|
+
let query = "";
|
|
74
|
+
if (options.includes)
|
|
75
|
+
query = query.concat(`includes=${options.includes}`);
|
|
76
|
+
if (query)
|
|
77
|
+
query = "?".concat(query);
|
|
78
|
+
const r = await this._api.get(`/api/csp/corporate/addresses/${id}${query}`);
|
|
79
|
+
return (await r.json());
|
|
80
|
+
}
|
|
81
|
+
/** Load a list of virtual-address from server.
|
|
82
|
+
* @param {LoadVirtualAddressListOptions}
|
|
83
|
+
*/
|
|
84
|
+
async loadList(options) {
|
|
85
|
+
let query = "";
|
|
86
|
+
if (options === null || options === void 0 ? void 0 : options.Includes) {
|
|
87
|
+
query = query.concat(`includes=${options.Includes}`);
|
|
88
|
+
}
|
|
89
|
+
if (query)
|
|
90
|
+
query = "?".concat(query);
|
|
91
|
+
const r = await this._api.post(`/api/csp/corporate/addresses${query}`, new RequestBuilder().json(options ? options : { Filters: [] }));
|
|
92
|
+
return (await r.json());
|
|
93
|
+
}
|
|
94
|
+
/** Load a list of virtual-address from server.
|
|
95
|
+
* @param {LoadVirtualAddressListOptions}
|
|
96
|
+
*/
|
|
97
|
+
async loadReceipentList(options) {
|
|
98
|
+
let query = "";
|
|
99
|
+
if (options === null || options === void 0 ? void 0 : options.Includes) {
|
|
100
|
+
query = query.concat(`includes=${options.Includes}`);
|
|
101
|
+
}
|
|
102
|
+
if (query)
|
|
103
|
+
query = "?".concat(query);
|
|
104
|
+
const r = await this._api.post(`/api/csp/corporate/addresses/receipents${query}`, new RequestBuilder().json(options ? options : { Filters: [] }));
|
|
105
|
+
return (await r.json());
|
|
106
|
+
}
|
|
107
|
+
/** Edit an existing item on server. */
|
|
108
|
+
async edit(id, options) {
|
|
109
|
+
await this.action(async () => {
|
|
110
|
+
const r = await this._api.post(`/api/csp/corporate/addresses/${id}`, new RequestBuilder().json(options.data));
|
|
111
|
+
const t = await r.json();
|
|
112
|
+
this.items.overwrite(t.id, t);
|
|
113
|
+
}, options);
|
|
114
|
+
}
|
|
115
|
+
async delete(ids, options) {
|
|
116
|
+
return await this.action(async () => {
|
|
117
|
+
await this._api.delete(`/api/csp/corporate/addresses/delete`, new RequestBuilder().json({ Ids: ids, Options: options === null || options === void 0 ? void 0 : options.data }));
|
|
118
|
+
const deleted = [];
|
|
119
|
+
for (const id of ids) {
|
|
120
|
+
const item = this.items.peek(id);
|
|
121
|
+
if (item) {
|
|
122
|
+
deleted.push(item);
|
|
123
|
+
this._deleted.dispatch(this, item);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return deleted;
|
|
127
|
+
}, options);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
__decorate([
|
|
131
|
+
action
|
|
132
|
+
], VirtualAddressStore.prototype, "delete", null);
|
|
133
|
+
/** React hook to retrieve ContactStore */
|
|
134
|
+
export const useVirtualAddressStore = () => {
|
|
135
|
+
const context = useApplicationContext();
|
|
136
|
+
if (!context.getService(StoreName)) {
|
|
137
|
+
context.registerService(new VirtualAddressStore(context.api.currentEndPoint));
|
|
138
|
+
}
|
|
139
|
+
return context.getService(StoreName);
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=VirtualAddressStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VirtualAddressStore.js","sourceRoot":"","sources":["../../../src/data/virtual-address/VirtualAddressStore.ts"],"names":[],"mappings":";AASA,OAAO,EAAe,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAkB,UAAU,EAAQ,MAAM,MAAM,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAKxD,MAAM,SAAS,GAAG,qBAAqB,CAAC;AAExC,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAM7C,YAAoC,IAAiB;QACpD,KAAK,EAAE,CAAC;QADU;;;;mBAAiB,IAAI;WAAa;QALrC;;;;mBAAe,SAAS;WAAC;QACzC,sCAAsC;QACrB;;;;mBAAW,IAAI,eAAe,EAAwC;WAAC;QACvE;;;;mBAAW,IAAI,eAAe,EAAwC;WAAC;QAgBxF,mCAAmC;QACnB;;;;mBAA6C,IAAI,UAAU,CAC1E,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAsB,CAAA,EAChE,UAAU,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAClC;WAAC;QAEF,mCAAmC;QACnB;;;;mBAA8C,IAAI,UAAU,CAC3E,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAkB,CAAA,EAC5D,UAAU,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAClC;WAAC;IAtBF,CAAC;IAED,+DAA+D;IAC/D,IAAW,0B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M,sBAAsB,GAAG,GAAG,EAAE;IAC1C,MAAM,OAAO,GAAG,qBAAqB,EAAE,CAAC;IACxC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACpC,OAAO,CAAC,eAAe,CAAC,IAAI,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,OAAO,CAAC,UAAU,CAAC,SAAS,CAAyB,CAAC;AAC9D,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IReceipents, IVirtualAddress, LoadVirtualAddressOptions } from ".";
|
|
2
|
+
import { ListDataContextState } from "@voplus/morpho-ui/es/data";
|
|
3
|
+
import { LoadDocumentListOptions } from "@voplus/morpho-document-core";
|
|
4
|
+
export declare const useVirtualAddress: (id: string, options?: LoadVirtualAddressOptions) => IVirtualAddress;
|
|
5
|
+
/** React hook to retrieve a list of virtual address
|
|
6
|
+
* @param effect - Effect callback to be ran after successful retrieved the list.
|
|
7
|
+
* @param options - Optional virtual address list loading options.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useVirtualAddressListEffect: (list: ListDataContextState<IVirtualAddress> | null, effect: (list: IVirtualAddress[], total: number) => void, options?: LoadDocumentListOptions) => void;
|
|
10
|
+
export declare const useReceipentListEffect: (list: ListDataContextState<IReceipents> | null, effect: ((list: IReceipents[], total: number) => void) | null, options?: LoadDocumentListOptions) => void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useVirtualAddressStore } from ".";
|
|
2
|
+
import { useListLoaderEffect } from "@voplus/morpho-ui/es/hooks";
|
|
3
|
+
import { useLoadCountedMapItem } from "@voplus/morpho-data";
|
|
4
|
+
export const useVirtualAddress = (id, options) => {
|
|
5
|
+
options = options ? options : {};
|
|
6
|
+
const store = useVirtualAddressStore();
|
|
7
|
+
return useLoadCountedMapItem(id, store.items, (calculatedOptions) => store.load(id, calculatedOptions), options);
|
|
8
|
+
};
|
|
9
|
+
/** React hook to retrieve a list of virtual address
|
|
10
|
+
* @param effect - Effect callback to be ran after successful retrieved the list.
|
|
11
|
+
* @param options - Optional virtual address list loading options.
|
|
12
|
+
*/
|
|
13
|
+
export const useVirtualAddressListEffect = (list, effect, options) => {
|
|
14
|
+
const deps = options ? options : {};
|
|
15
|
+
const store = useVirtualAddressStore();
|
|
16
|
+
// Call useListLoaderEffect and ensure won't load twice for same loading options.
|
|
17
|
+
return useListLoaderEffect(list, store.items, effect, () => store.loadList(options), [deps]);
|
|
18
|
+
};
|
|
19
|
+
export const useReceipentListEffect = (list, effect, options) => {
|
|
20
|
+
const deps = options ? options : {};
|
|
21
|
+
const store = useVirtualAddressStore();
|
|
22
|
+
// Call useListLoaderEffect and ensure won't load twice for same loading options.
|
|
23
|
+
return useListLoaderEffect(list, store.receipents, effect, () => store.loadReceipentList(options), [deps]);
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.js","sourceRoot":"","sources":["../../../src/data/virtual-address/hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2D,sBAAsB,EAAE,MAAM,GAAG,CAAC;AAIpG,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAAU,EAAE,OAAmC,EAAE,EAAE;IACpF,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,EAAgC,CAAC;IAChE,MAAM,KAAK,GAAG,sBAAsB,EAAE,CAAC;IAEvC,OAAO,qBAAqB,CAC3B,EAAE,EACF,KAAK,CAAC,KAAK,EACX,CAAC,iBAAiB,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,iBAAiB,CAAC,EACxD,OAAO,CACY,CAAC;AACtB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAC1C,IAAkD,EAClD,MAAwD,EACxD,OAAiC,EAChC,EAAE;IACH,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,EAA8B,CAAC;IACjE,MAAM,KAAK,GAAG,sBAAsB,EAAE,CAAC;IAEvC,iFAAiF;IACjF,OAAO,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9F,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACrC,IAA8C,EAC9C,MAA6D,EAC7D,OAAiC,EAChC,EAAE;IACH,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,EAA8B,CAAC;IACjE,MAAM,KAAK,GAAG,sBAAsB,EAAE,CAAC;IAEvC,iFAAiF;IACjF,OAAO,mBAAmB,CACzB,IAAI,EACJ,KAAK,CAAC,UAAU,EAChB,MAAM,EACN,GAAG,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,EACtC,CAAC,IAAI,CAAC,CACN,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/data/virtual-address/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC;AACtC,cAAc,QAAQ,CAAC;AACvB,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { INode } from "@voplus/morpho-document-core";
|
|
2
|
+
import { ILoadable } from "@voplus/morpho-data";
|
|
3
|
+
import { IAddress } from "@voplus/morpho-org";
|
|
4
|
+
export interface IReceipents extends ILoadable {
|
|
5
|
+
id: string;
|
|
6
|
+
receipent: {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface IVirtualAddress extends INode, ILoadable {
|
|
12
|
+
name: string;
|
|
13
|
+
corporate: {
|
|
14
|
+
id: string;
|
|
15
|
+
contact: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
office: {
|
|
21
|
+
id: string;
|
|
22
|
+
address: IAddress;
|
|
23
|
+
};
|
|
24
|
+
receipents: IReceipents[];
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/data/virtual-address/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FilterOption, PageParameters } from "@voplus/morpho-data/es/types";
|
|
2
|
+
import { IVirtualAddress } from "./interfaces";
|
|
3
|
+
import { LoadOptions } from "@voplus/morpho-data";
|
|
4
|
+
import { StoreActionOptions } from "@voplus/morpho-data";
|
|
5
|
+
import { DeleteDocumentOptions } from "@voplus/morpho-document-core";
|
|
6
|
+
/** Custom load virtual address list options type */
|
|
7
|
+
export type LoadVirtualAddressListOptions = {
|
|
8
|
+
Includes?: string;
|
|
9
|
+
Filters?: FilterOption[];
|
|
10
|
+
Page?: PageParameters;
|
|
11
|
+
Total?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/** Custom load virtual address options type */
|
|
14
|
+
export type LoadVirtualAddressOptions = {
|
|
15
|
+
/** Comma separated include options e.g. path */
|
|
16
|
+
includes?: string;
|
|
17
|
+
} & LoadOptions<IVirtualAddress>;
|
|
18
|
+
export type EditVirtualAddressDataOptions = {
|
|
19
|
+
/** string[] 需要传 contact id [] */
|
|
20
|
+
NewReceipents?: string[];
|
|
21
|
+
/** virtual address.Receipents 里的id */
|
|
22
|
+
RemoveReceipentLines?: string[];
|
|
23
|
+
};
|
|
24
|
+
export type EditVirtualAddressOptions = {
|
|
25
|
+
data: EditVirtualAddressDataOptions;
|
|
26
|
+
} & StoreActionOptions;
|
|
27
|
+
/** create VirtualAddress options */
|
|
28
|
+
export type CreateVirtualAddressOptions = {
|
|
29
|
+
data: {
|
|
30
|
+
CorporateId: string;
|
|
31
|
+
OfficeId: string;
|
|
32
|
+
};
|
|
33
|
+
} & StoreActionOptions;
|
|
34
|
+
/** Custom load virtual address list options type. */
|
|
35
|
+
export type DeleteVirtualAddressOptions = {
|
|
36
|
+
data?: DeleteDocumentOptions;
|
|
37
|
+
} & StoreActionOptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/data/virtual-address/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data/virtual-address/virtualAddress-events/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IVirtualAddress } from "../interfaces";
|
|
2
|
+
import { ListDataContextState } from "@voplus/morpho-ui/es/data";
|
|
3
|
+
/** React hook to call action when a new virtual address has been created. */
|
|
4
|
+
export declare const useAutoUpdateListData: (list: ListDataContextState<any>, shouldUpdate: (d: IVirtualAddress, event: string) => boolean) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useOnDeleteVirtualAddress, useOnNewVirtualAddress } from ".";
|
|
2
|
+
/** React hook to call action when a new virtual address has been created. */
|
|
3
|
+
export const useAutoUpdateListData = (list, shouldUpdate) => {
|
|
4
|
+
useOnNewVirtualAddress((s, d) => {
|
|
5
|
+
if (shouldUpdate(d, "new"))
|
|
6
|
+
list.union([d]);
|
|
7
|
+
});
|
|
8
|
+
useOnDeleteVirtualAddress((s, d) => {
|
|
9
|
+
if (shouldUpdate(d, "del"))
|
|
10
|
+
list.remove(d.id);
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useAutoUpdateListData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoUpdateListData.js","sourceRoot":"","sources":["../../../../src/data/virtual-address/virtualAddress-events/useAutoUpdateListData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,GAAG,CAAC;AAKtE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACpC,IAA+B,EAC/B,YAA4D,EAC3D,EAAE;IACH,sBAAsB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC/B,IAAI,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAClC,IAAI,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { VirtualAddressStore } from "../VirtualAddressStore";
|
|
2
|
+
import { IVirtualAddress } from "../interfaces";
|
|
3
|
+
/** React hook to call action when a delete virtual address has been created. */
|
|
4
|
+
export declare const useOnDeleteVirtualAddress: (action: (store: VirtualAddressStore, doc: IVirtualAddress) => void) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useVirtualAddressStore } from "../VirtualAddressStore";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
/** React hook to call action when a delete virtual address has been created. */
|
|
4
|
+
export const useOnDeleteVirtualAddress = (action) => {
|
|
5
|
+
const store = useVirtualAddressStore();
|
|
6
|
+
const onDeleteVirtualAddress = (store, doc) => {
|
|
7
|
+
action(store, doc);
|
|
8
|
+
};
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
store.VirtualAddressDeletedEvent.subscribe(onDeleteVirtualAddress);
|
|
11
|
+
return () => {
|
|
12
|
+
store.VirtualAddressDeletedEvent.unsubscribe(onDeleteVirtualAddress);
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useOnDeleteVirtualAddress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOnDeleteVirtualAddress.js","sourceRoot":"","sources":["../../../../src/data/virtual-address/virtualAddress-events/useOnDeleteVirtualAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,gFAAgF;AAChF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACxC,MAAkE,EACjE,EAAE;IACH,MAAM,KAAK,GAAG,sBAAsB,EAAE,CAAC;IACvC,MAAM,sBAAsB,GAAG,CAAC,KAA0B,EAAE,GAAoB,EAAE,EAAE;QACnF,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpB,CAAC,CAAC;IACF,SAAS,CAAC,GAAG,EAAE;QACd,KAAK,CAAC,0BAA0B,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;QACnE,OAAO,GAAG,EAAE;YACX,KAAK,CAAC,0BAA0B,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;QACtE,CAAC,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { VirtualAddressStore } from "../VirtualAddressStore";
|
|
2
|
+
import { IVirtualAddress } from "../interfaces";
|
|
3
|
+
/** React hook to call action when a new virtual address has been created. */
|
|
4
|
+
export declare const useOnNewVirtualAddress: (action: (store: VirtualAddressStore, doc: IVirtualAddress) => void) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useVirtualAddressStore } from "../VirtualAddressStore";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
/** React hook to call action when a new virtual address has been created. */
|
|
4
|
+
export const useOnNewVirtualAddress = (action) => {
|
|
5
|
+
const store = useVirtualAddressStore();
|
|
6
|
+
const onNewVirtualAddress = (store, doc) => {
|
|
7
|
+
action(store, doc);
|
|
8
|
+
};
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
store.VirtualAddressCreatedEvent.subscribe(onNewVirtualAddress);
|
|
11
|
+
return () => {
|
|
12
|
+
store.VirtualAddressCreatedEvent.unsubscribe(onNewVirtualAddress);
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useOnNewVirtualAddress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOnNewVirtualAddress.js","sourceRoot":"","sources":["../../../../src/data/virtual-address/virtualAddress-events/useOnNewVirtualAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACrC,MAAkE,EACjE,EAAE;IACH,MAAM,KAAK,GAAG,sBAAsB,EAAE,CAAC;IACvC,MAAM,mBAAmB,GAAG,CAAC,KAA0B,EAAE,GAAoB,EAAE,EAAE;QAChF,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpB,CAAC,CAAC;IACF,SAAS,CAAC,GAAG,EAAE;QACd,KAAK,CAAC,0BAA0B,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAChE,OAAO,GAAG,EAAE;YACX,KAAK,CAAC,0BAA0B,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;QACnE,CAAC,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IVirtualAddressMail, LoadVirtualAddressMailListOptions, LoadVirtualAddressMailOptions, EditVirtualAddressMailOptions, CreateVirtualAddressMailOptions, DeleteVirtualAddressMailOptions } from ".";
|
|
2
|
+
import { ApiEndPoint } from "@voplus/api";
|
|
3
|
+
import { CountedMap, Store } from "@voplus/morpho-data";
|
|
4
|
+
export declare class VirtualAddressMailStore extends Store {
|
|
5
|
+
private readonly _api;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
/** Contac created event dispatcher */
|
|
8
|
+
private readonly _created;
|
|
9
|
+
private readonly _deleted;
|
|
10
|
+
constructor(_api: ApiEndPoint);
|
|
11
|
+
/** Event fires when a new virtual-address-mail has been created. */
|
|
12
|
+
get VirtualAddressMailCreatedEvent(): import("strongly-typed-events").IEvent<VirtualAddressMailStore, IVirtualAddressMail>;
|
|
13
|
+
/** Event fires when a delete contact has been deleted. */
|
|
14
|
+
get VirtualAddressMailDeletedEvent(): import("strongly-typed-events").IEvent<VirtualAddressMailStore, IVirtualAddressMail>;
|
|
15
|
+
/** All currently used contacts. */
|
|
16
|
+
readonly items: CountedMap<string, IVirtualAddressMail>;
|
|
17
|
+
/** Create a new contact base on type. */
|
|
18
|
+
create(options: CreateVirtualAddressMailOptions): Promise<IVirtualAddressMail>;
|
|
19
|
+
/** Load a task from server.
|
|
20
|
+
* @param {string} id - id of the task.
|
|
21
|
+
* @param {LoadTaskOptions} options - Optional load options.
|
|
22
|
+
*/
|
|
23
|
+
load(id: string, options: LoadVirtualAddressMailOptions): Promise<IVirtualAddressMail>;
|
|
24
|
+
/** Load a list of virtual-address-mail from server.
|
|
25
|
+
* @param {LoadVirtualAddressMailListOptions}
|
|
26
|
+
*/
|
|
27
|
+
loadList(options?: LoadVirtualAddressMailListOptions): Promise<IVirtualAddressMail[]>;
|
|
28
|
+
/** Edit an existing item on server. */
|
|
29
|
+
edit(id: string, options: EditVirtualAddressMailOptions): Promise<void>;
|
|
30
|
+
delete(ids: string[], options?: DeleteVirtualAddressMailOptions): Promise<any>;
|
|
31
|
+
}
|
|
32
|
+
/** React hook to retrieve ContactStore */
|
|
33
|
+
export declare const useVirtualAddressMailStore: () => VirtualAddressMailStore;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { RequestBuilder } from "@voplus/api";
|
|
3
|
+
import { CountedMap, Store, useApplicationContext } from "@voplus/morpho-data";
|
|
4
|
+
import { action, observable } from "mobx";
|
|
5
|
+
import { EventDispatcher } from "strongly-typed-events";
|
|
6
|
+
const StoreName = "VirtualAddressMailStore";
|
|
7
|
+
export class VirtualAddressMailStore extends Store {
|
|
8
|
+
constructor(_api) {
|
|
9
|
+
super();
|
|
10
|
+
Object.defineProperty(this, "_api", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: _api
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "name", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: StoreName
|
|
21
|
+
});
|
|
22
|
+
/** Contac created event dispatcher */
|
|
23
|
+
Object.defineProperty(this, "_created", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true,
|
|
27
|
+
value: new EventDispatcher()
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(this, "_deleted", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
writable: true,
|
|
33
|
+
value: new EventDispatcher()
|
|
34
|
+
});
|
|
35
|
+
/** All currently used contacts. */
|
|
36
|
+
Object.defineProperty(this, "items", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: new CountedMap((key) => ({ id: key, loaded: false }), observable.map([], { deep: true }))
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** Event fires when a new virtual-address-mail has been created. */
|
|
44
|
+
get VirtualAddressMailCreatedEvent() {
|
|
45
|
+
return this._created.asEvent();
|
|
46
|
+
}
|
|
47
|
+
/** Event fires when a delete contact has been deleted. */
|
|
48
|
+
get VirtualAddressMailDeletedEvent() {
|
|
49
|
+
return this._deleted.asEvent();
|
|
50
|
+
}
|
|
51
|
+
/** Create a new contact base on type. */
|
|
52
|
+
async create(options) {
|
|
53
|
+
// invariant(options.data.name, "Name cannot be empty.");
|
|
54
|
+
return await this.action(async () => {
|
|
55
|
+
const r = await this._api.post(`/api/csp/corporate/addresses/mails/create`, new RequestBuilder().json(options.data));
|
|
56
|
+
const t = (await r.json());
|
|
57
|
+
this._created.dispatch(this, t);
|
|
58
|
+
return t;
|
|
59
|
+
}, options);
|
|
60
|
+
}
|
|
61
|
+
/** Load a task from server.
|
|
62
|
+
* @param {string} id - id of the task.
|
|
63
|
+
* @param {LoadTaskOptions} options - Optional load options.
|
|
64
|
+
*/
|
|
65
|
+
async load(id, options) {
|
|
66
|
+
let query = "";
|
|
67
|
+
if (options.includes)
|
|
68
|
+
query = query.concat(`includes=${options.includes}`);
|
|
69
|
+
if (query)
|
|
70
|
+
query = "?".concat(query);
|
|
71
|
+
const r = await this._api.get(`/api/csp/corporate/addresses/mails/${id}${query}`);
|
|
72
|
+
return (await r.json());
|
|
73
|
+
}
|
|
74
|
+
/** Load a list of virtual-address-mail from server.
|
|
75
|
+
* @param {LoadVirtualAddressMailListOptions}
|
|
76
|
+
*/
|
|
77
|
+
async loadList(options) {
|
|
78
|
+
let query = "";
|
|
79
|
+
if (options === null || options === void 0 ? void 0 : options.Includes) {
|
|
80
|
+
query = query.concat(`includes=${options.Includes}`);
|
|
81
|
+
}
|
|
82
|
+
if (query)
|
|
83
|
+
query = "?".concat(query);
|
|
84
|
+
const r = await this._api.post(`/api/csp/corporate/addresses/mails${query}`, new RequestBuilder().json(options ? options : { Filters: [] }));
|
|
85
|
+
return (await r.json());
|
|
86
|
+
}
|
|
87
|
+
/** Edit an existing item on server. */
|
|
88
|
+
async edit(id, options) {
|
|
89
|
+
await this.action(async () => {
|
|
90
|
+
const r = await this._api.post(`/api/csp/corporate/addresses/mails/${id}`, new RequestBuilder().json(options.data));
|
|
91
|
+
const t = await r.json();
|
|
92
|
+
this.items.overwrite(t.id, t);
|
|
93
|
+
}, options);
|
|
94
|
+
}
|
|
95
|
+
async delete(ids, options) {
|
|
96
|
+
return await this.action(async () => {
|
|
97
|
+
await this._api.delete(`/api/csp/corporate/addresses/mails/delete`, new RequestBuilder().json({ Ids: ids, Options: options === null || options === void 0 ? void 0 : options.data }));
|
|
98
|
+
const deleted = [];
|
|
99
|
+
for (const id of ids) {
|
|
100
|
+
const item = this.items.peek(id);
|
|
101
|
+
if (item) {
|
|
102
|
+
deleted.push(item);
|
|
103
|
+
this._deleted.dispatch(this, item);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return deleted;
|
|
107
|
+
}, options);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
__decorate([
|
|
111
|
+
action
|
|
112
|
+
], VirtualAddressMailStore.prototype, "delete", null);
|
|
113
|
+
/** React hook to retrieve ContactStore */
|
|
114
|
+
export const useVirtualAddressMailStore = () => {
|
|
115
|
+
const context = useApplicationContext();
|
|
116
|
+
if (!context.getService(StoreName)) {
|
|
117
|
+
context.registerService(new VirtualAddressMailStore(context.api.currentEndPoint));
|
|
118
|
+
}
|
|
119
|
+
return context.getService(StoreName);
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=VirtualAddressMailStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VirtualAddressMailStore.js","source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;oBACnB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBACpC,CAAC;YACF,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC,EAAE,OAAQ,CAAC,CAAC;IACd,CAAC;CACD;AAjBa;IADZ,MAAM;qDAiBN;AAGF,0CAA0C;AAC1C,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC9C,MAAM,OAAO,GAAG,qBAAqB,EAAE,CAAC;IACxC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACpC,OAAO,CAAC,eAAe,CAAC,IAAI,uBAAuB,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,OAAO,CAAC,UAAU,CAAC,SAAS,CAA6B,CAAC;AAClE,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IVirtualAddressMail, LoadVirtualAddressMailOptions } from ".";
|
|
2
|
+
import { ListDataContextState } from "@voplus/morpho-ui/es/data";
|
|
3
|
+
import { LoadDocumentListOptions } from "@voplus/morpho-document-core";
|
|
4
|
+
export declare const useVirtualAddressMail: (id: string, options?: LoadVirtualAddressMailOptions) => IVirtualAddressMail;
|
|
5
|
+
/** React hook to retrieve a list of virtual address mail
|
|
6
|
+
* @param effect - Effect callback to be ran after successful retrieved the list.
|
|
7
|
+
* @param options - Optional virtual address mail list loading options.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useVirtualAddressMailListEffect: (list: ListDataContextState<IVirtualAddressMail> | null, effect: (list: IVirtualAddressMail[], total: number) => void, options?: LoadDocumentListOptions) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useVirtualAddressMailStore } from ".";
|
|
2
|
+
import { useListLoaderEffect } from "@voplus/morpho-ui/es/hooks";
|
|
3
|
+
import { useLoadCountedMapItem } from "@voplus/morpho-data";
|
|
4
|
+
export const useVirtualAddressMail = (id, options) => {
|
|
5
|
+
options = options ? options : {};
|
|
6
|
+
const store = useVirtualAddressMailStore();
|
|
7
|
+
return useLoadCountedMapItem(id, store.items, (calculatedOptions) => store.load(id, calculatedOptions), options);
|
|
8
|
+
};
|
|
9
|
+
/** React hook to retrieve a list of virtual address mail
|
|
10
|
+
* @param effect - Effect callback to be ran after successful retrieved the list.
|
|
11
|
+
* @param options - Optional virtual address mail list loading options.
|
|
12
|
+
*/
|
|
13
|
+
export const useVirtualAddressMailListEffect = (list, effect, options) => {
|
|
14
|
+
const deps = options ? options : {};
|
|
15
|
+
const store = useVirtualAddressMailStore();
|
|
16
|
+
// Call useListLoaderEffect and ensure won't load twice for same loading options.
|
|
17
|
+
return useListLoaderEffect(list, store.items, effect, () => store.loadList(options), [deps]);
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.js","sourceRoot":"","sources":["../../../src/data/virtual-address-mail/hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsD,0BAA0B,EAAE,MAAM,GAAG,CAAC;AAInG,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAAU,EAAE,OAAuC,EAAE,EAAE;IAC5F,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,EAAoC,CAAC;IACpE,MAAM,KAAK,GAAG,0BAA0B,EAAE,CAAC;IAE3C,OAAO,qBAAqB,CAC3B,EAAE,EACF,KAAK,CAAC,KAAK,EACX,CAAC,iBAAiB,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,iBAAiB,CAAC,EACxD,OAAO,CACgB,CAAC;AAC1B,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC9C,IAAsD,EACtD,MAA4D,EAC5D,OAAiC,EAChC,EAAE;IACH,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,EAA8B,CAAC;IACjE,MAAM,KAAK,GAAG,0BAA0B,EAAE,CAAC;IAE3C,iFAAiF;IACjF,OAAO,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9F,CAAC,CAAC"}
|