@etsoo/appscript 1.3.9 → 1.3.11
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/lib/cjs/erp/AddressApi.d.ts +3 -1
- package/lib/cjs/erp/AddressApi.js +5 -3
- package/lib/cjs/erp/EntityApi.d.ts +9 -9
- package/lib/cjs/erp/EntityApi.js +2 -2
- package/lib/cjs/erp/OrgApi.d.ts +5 -3
- package/lib/cjs/erp/OrgApi.js +1 -0
- package/lib/cjs/erp/PublicApi.d.ts +9 -4
- package/lib/cjs/erp/PublicApi.js +14 -9
- package/lib/mjs/erp/AddressApi.d.ts +3 -1
- package/lib/mjs/erp/AddressApi.js +5 -3
- package/lib/mjs/erp/EntityApi.d.ts +9 -9
- package/lib/mjs/erp/EntityApi.js +2 -2
- package/lib/mjs/erp/OrgApi.d.ts +5 -3
- package/lib/mjs/erp/OrgApi.js +1 -0
- package/lib/mjs/erp/PublicApi.d.ts +9 -4
- package/lib/mjs/erp/PublicApi.js +14 -9
- package/package.json +5 -5
- package/src/erp/AddressApi.ts +8 -4
- package/src/erp/EntityApi.ts +24 -20
- package/src/erp/OrgApi.ts +8 -6
- package/src/erp/PublicApi.ts +33 -11
|
@@ -3,6 +3,7 @@ import { AddressRegion, AddressRegionDb } from '../address/AddressRegion';
|
|
|
3
3
|
import { AddressState } from '../address/AddressState';
|
|
4
4
|
import { IdLabelConditional } from './dto/IdLabelDto';
|
|
5
5
|
import { BaseApi } from './BaseApi';
|
|
6
|
+
import { IApiPayload } from '@etsoo/restclient';
|
|
6
7
|
/**
|
|
7
8
|
* Address Api
|
|
8
9
|
*/
|
|
@@ -28,7 +29,8 @@ export declare class AddressApi extends BaseApi {
|
|
|
28
29
|
/**
|
|
29
30
|
* Get state list
|
|
30
31
|
* @param regionId Region id
|
|
32
|
+
* @param payload Payload
|
|
31
33
|
* @returns Result
|
|
32
34
|
*/
|
|
33
|
-
states(regionId: string): Promise<AddressState[] | undefined>;
|
|
35
|
+
states(regionId: string, payload?: IApiPayload<AddressState[]>): Promise<AddressState[] | undefined>;
|
|
34
36
|
}
|
|
@@ -44,16 +44,18 @@ class AddressApi extends BaseApi_1.BaseApi {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
return (await this.api.get(`Address/RegionList?language=${this.app.culture}`, undefined, { defaultValue: [] }));
|
|
47
|
+
return (await this.api.get(`Address/RegionList?language=${this.app.culture}`, undefined, { defaultValue: [], showLoading: false }));
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Get state list
|
|
52
52
|
* @param regionId Region id
|
|
53
|
+
* @param payload Payload
|
|
53
54
|
* @returns Result
|
|
54
55
|
*/
|
|
55
|
-
states(regionId) {
|
|
56
|
-
|
|
56
|
+
states(regionId, payload) {
|
|
57
|
+
payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [], showLoading: false });
|
|
58
|
+
return this.api.get(`Address/StateList?regionId=${regionId}&language=${this.app.culture}`, undefined, payload);
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
exports.AddressApi = AddressApi;
|
|
@@ -23,35 +23,35 @@ export declare class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
23
23
|
* @param payload Payload
|
|
24
24
|
* @returns Result
|
|
25
25
|
*/
|
|
26
|
-
protected createBase<R extends IActionResult>(data: object, payload?: IApiPayload<R
|
|
26
|
+
protected createBase<R extends IActionResult>(data: object, payload?: IApiPayload<R>): Promise<R | undefined>;
|
|
27
27
|
/**
|
|
28
28
|
* Delete
|
|
29
29
|
* @param id Id or ids
|
|
30
30
|
* @param payload Payload
|
|
31
31
|
*/
|
|
32
|
-
protected deleteBase<R extends IActionResult>(id: DataTypes.IdType, payload?: IApiPayload<R
|
|
33
|
-
protected deleteBase<R extends IActionResult>(ids: DataTypes.IdType[], payload?: IApiPayload<R
|
|
32
|
+
protected deleteBase<R extends IActionResult>(id: DataTypes.IdType, payload?: IApiPayload<R>): Promise<R | undefined>;
|
|
33
|
+
protected deleteBase<R extends IActionResult>(ids: DataTypes.IdType[], payload?: IApiPayload<R>): Promise<R | undefined>;
|
|
34
34
|
/**
|
|
35
35
|
* List
|
|
36
36
|
* @param rq Request data
|
|
37
37
|
* @param payload Payload
|
|
38
38
|
* @returns Result
|
|
39
39
|
*/
|
|
40
|
-
protected listBase<RQ extends TiplistRQ, R extends object>(rq: RQ, payload?: IApiPayload<R[]
|
|
40
|
+
protected listBase<RQ extends TiplistRQ, R extends object>(rq: RQ, payload?: IApiPayload<R[]>): Promise<R[] | undefined>;
|
|
41
41
|
/**
|
|
42
42
|
* Query
|
|
43
43
|
* @param rq Request data
|
|
44
44
|
* @param payload Payload
|
|
45
45
|
* @returns Result
|
|
46
46
|
*/
|
|
47
|
-
protected queryBase<RQ extends QueryRQ, R extends object>(rq: RQ, payload?: IApiPayload<R[]
|
|
47
|
+
protected queryBase<RQ extends QueryRQ, R extends object>(rq: RQ, payload?: IApiPayload<R[]>): Promise<R[] | undefined>;
|
|
48
48
|
/**
|
|
49
49
|
* Read
|
|
50
50
|
* @param id Id
|
|
51
51
|
* @param payload Payload
|
|
52
52
|
* @returns Result
|
|
53
53
|
*/
|
|
54
|
-
protected readBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R
|
|
54
|
+
protected readBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R>): Promise<R | undefined>;
|
|
55
55
|
/**
|
|
56
56
|
* Sort
|
|
57
57
|
* @param items Items to sort
|
|
@@ -60,19 +60,19 @@ export declare class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
60
60
|
*/
|
|
61
61
|
protected sortBase<RQ extends {
|
|
62
62
|
id: DataTypes.IdType;
|
|
63
|
-
}>(items: RQ[], payload?: IApiPayload<number
|
|
63
|
+
}>(items: RQ[], payload?: IApiPayload<number>): Promise<number | undefined>;
|
|
64
64
|
/**
|
|
65
65
|
* Update
|
|
66
66
|
* @param data Modal data
|
|
67
67
|
* @param payload Payload
|
|
68
68
|
* @returns Result
|
|
69
69
|
*/
|
|
70
|
-
protected updateBase<R extends IActionResult>(data: object, payload?: IApiPayload<R
|
|
70
|
+
protected updateBase<R extends IActionResult>(data: object, payload?: IApiPayload<R>): Promise<R | undefined>;
|
|
71
71
|
/**
|
|
72
72
|
* Read for update
|
|
73
73
|
* @param id Id
|
|
74
74
|
* @param payload Payload
|
|
75
75
|
* @returns Result
|
|
76
76
|
*/
|
|
77
|
-
protected updateReadBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R
|
|
77
|
+
protected updateReadBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R>): Promise<R | undefined>;
|
|
78
78
|
}
|
package/lib/cjs/erp/EntityApi.js
CHANGED
|
@@ -56,7 +56,7 @@ class EntityApi extends BaseApi_1.BaseApi {
|
|
|
56
56
|
* @returns Result
|
|
57
57
|
*/
|
|
58
58
|
readBase(id, payload) {
|
|
59
|
-
return this.api.get(`${this.flag}/Read/${id}`, payload);
|
|
59
|
+
return this.api.get(`${this.flag}/Read/${id}`, undefined, payload);
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Sort
|
|
@@ -85,7 +85,7 @@ class EntityApi extends BaseApi_1.BaseApi {
|
|
|
85
85
|
* @returns Result
|
|
86
86
|
*/
|
|
87
87
|
updateReadBase(id, payload) {
|
|
88
|
-
return this.api.get(`${this.flag}/UpdateRead/${id}`, payload);
|
|
88
|
+
return this.api.get(`${this.flag}/UpdateRead/${id}`, undefined, payload);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
exports.EntityApi = EntityApi;
|
package/lib/cjs/erp/OrgApi.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare class OrgApi extends EntityApi {
|
|
|
20
20
|
* Get organization list
|
|
21
21
|
* @param items Max items or request data
|
|
22
22
|
* @param serviceId Service id
|
|
23
|
+
* @param payload Payload
|
|
23
24
|
* @returns Result
|
|
24
25
|
*/
|
|
25
26
|
list(items?: number, serviceId?: number): Promise<ListType[] | undefined>;
|
|
@@ -30,18 +31,19 @@ export declare class OrgApi extends EntityApi {
|
|
|
30
31
|
* @param payload Payload
|
|
31
32
|
* @returns Result
|
|
32
33
|
*/
|
|
33
|
-
query(rq: OrgQueryRQ, payload?: IApiPayload<OrgQueryDto[]
|
|
34
|
+
query(rq: OrgQueryRQ, payload?: IApiPayload<OrgQueryDto[]>): Promise<OrgQueryDto[] | undefined>;
|
|
34
35
|
/**
|
|
35
36
|
* Switch organization
|
|
36
37
|
* @param id Organization id
|
|
37
38
|
* @param serviceId Service id
|
|
39
|
+
* @param payload Payload
|
|
38
40
|
*/
|
|
39
|
-
switch(id: number, serviceId?: number, payload?: IApiPayload<boolean
|
|
41
|
+
switch(id: number, serviceId?: number, payload?: IApiPayload<boolean>): Promise<boolean | undefined>;
|
|
40
42
|
/**
|
|
41
43
|
* Update
|
|
42
44
|
* @param data Modal data
|
|
43
45
|
* @param payload Payload
|
|
44
46
|
* @returns Result
|
|
45
47
|
*/
|
|
46
|
-
update(data: DataTypes.AddOrEditType<OrgRQ, true>, payload?: IApiPayload<IdActionResult
|
|
48
|
+
update(data: DataTypes.AddOrEditType<OrgRQ, true>, payload?: IApiPayload<IdActionResult>): Promise<IdActionResult<number> | undefined>;
|
|
47
49
|
}
|
package/lib/cjs/erp/OrgApi.js
CHANGED
|
@@ -31,6 +31,7 @@ class OrgApi extends EntityApi_1.EntityApi {
|
|
|
31
31
|
* Switch organization
|
|
32
32
|
* @param id Organization id
|
|
33
33
|
* @param serviceId Service id
|
|
34
|
+
* @param payload Payload
|
|
34
35
|
*/
|
|
35
36
|
async switch(id, serviceId, payload) {
|
|
36
37
|
const result = await this.app.api.put('Organization/Switch', {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IApiPayload } from '@etsoo/restclient';
|
|
1
2
|
import { ListType, ListType1 } from '@etsoo/shared';
|
|
2
3
|
import { Currency } from '../business/Currency';
|
|
3
4
|
import { ProductUnit } from '../business/ProductUnit';
|
|
@@ -19,16 +20,18 @@ export declare class PublicApi extends BaseApi {
|
|
|
19
20
|
/**
|
|
20
21
|
* Get exchange rate
|
|
21
22
|
* @param currency Currency
|
|
23
|
+
* @param payload Payload
|
|
22
24
|
* @returns Result
|
|
23
25
|
*/
|
|
24
|
-
exchangeRate(currency: Currency | string): Promise<ExchangeRateDto | undefined>;
|
|
26
|
+
exchangeRate(currency: Currency | string, payload?: IApiPayload<ExchangeRateDto>): Promise<ExchangeRateDto | undefined>;
|
|
25
27
|
/**
|
|
26
28
|
* Get exchange rate history
|
|
27
29
|
* @param currencies Currencies
|
|
28
30
|
* @param months Max months
|
|
31
|
+
* @param payload Payload
|
|
29
32
|
* @returns Result
|
|
30
33
|
*/
|
|
31
|
-
exchangeRateHistory(currencies: (Currency | string)[], months?: number): Promise<ExchangeRateHistoryDto[] | undefined>;
|
|
34
|
+
exchangeRateHistory(currencies: (Currency | string)[], months?: number, payload?: IApiPayload<ExchangeRateHistoryDto[]>): Promise<ExchangeRateHistoryDto[] | undefined>;
|
|
32
35
|
/**
|
|
33
36
|
* Get product unit's label
|
|
34
37
|
* Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
|
|
@@ -42,15 +45,17 @@ export declare class PublicApi extends BaseApi {
|
|
|
42
45
|
* Get mobile base64 QRCode
|
|
43
46
|
* @param id User id
|
|
44
47
|
* @param host Host URL
|
|
48
|
+
* @param payload Payload
|
|
45
49
|
*/
|
|
46
|
-
mobileQRCode(id?: string, host?: string): Promise<string | undefined>;
|
|
50
|
+
mobileQRCode(id?: string, host?: string, payload?: IApiPayload<string>): Promise<string | undefined>;
|
|
47
51
|
/**
|
|
48
52
|
* Get public and valid product data
|
|
49
53
|
* @param id Product/Service Id or Uid
|
|
50
54
|
* @param culture Language
|
|
55
|
+
* @param payload Payload
|
|
51
56
|
* @returns Result
|
|
52
57
|
*/
|
|
53
|
-
product<T extends number | string>(id: T, culture?: string): T extends number ? PublicProductDto : PublicOrgProductDto;
|
|
58
|
+
product<T extends number | string>(id: T, culture?: string, payload?: IApiPayload<PublicProductDto>): T extends number ? PublicProductDto : PublicOrgProductDto;
|
|
54
59
|
/**
|
|
55
60
|
*
|
|
56
61
|
* Get all repeat options
|
package/lib/cjs/erp/PublicApi.js
CHANGED
|
@@ -16,7 +16,7 @@ class PublicApi extends BaseApi_1.BaseApi {
|
|
|
16
16
|
*/
|
|
17
17
|
async currencies(currencyNames) {
|
|
18
18
|
if (currencyNames == null)
|
|
19
|
-
return (await this.api.get('Public/GetCurrencies'));
|
|
19
|
+
return (await this.api.get('Public/GetCurrencies', undefined, { defaultValue: [], showLoading: false }));
|
|
20
20
|
else
|
|
21
21
|
return currencyNames.map((name) => {
|
|
22
22
|
var _a;
|
|
@@ -29,19 +29,22 @@ class PublicApi extends BaseApi_1.BaseApi {
|
|
|
29
29
|
/**
|
|
30
30
|
* Get exchange rate
|
|
31
31
|
* @param currency Currency
|
|
32
|
+
* @param payload Payload
|
|
32
33
|
* @returns Result
|
|
33
34
|
*/
|
|
34
|
-
exchangeRate(currency) {
|
|
35
|
-
return this.api.get(`Public/ExchangeRate/${currency}
|
|
35
|
+
exchangeRate(currency, payload) {
|
|
36
|
+
return this.api.get(`Public/ExchangeRate/${currency}`, undefined, payload);
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Get exchange rate history
|
|
39
40
|
* @param currencies Currencies
|
|
40
41
|
* @param months Max months
|
|
42
|
+
* @param payload Payload
|
|
41
43
|
* @returns Result
|
|
42
44
|
*/
|
|
43
|
-
exchangeRateHistory(currencies, months) {
|
|
44
|
-
|
|
45
|
+
exchangeRateHistory(currencies, months, payload) {
|
|
46
|
+
payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [] });
|
|
47
|
+
return this.api.post('Public/ExchangeRateHistory', { currencies, months }, payload);
|
|
45
48
|
}
|
|
46
49
|
/**
|
|
47
50
|
* Get product unit's label
|
|
@@ -72,19 +75,21 @@ class PublicApi extends BaseApi_1.BaseApi {
|
|
|
72
75
|
* Get mobile base64 QRCode
|
|
73
76
|
* @param id User id
|
|
74
77
|
* @param host Host URL
|
|
78
|
+
* @param payload Payload
|
|
75
79
|
*/
|
|
76
|
-
mobileQRCode(id, host) {
|
|
77
|
-
return this.api.post('Public/MobileQRCode', { id, host });
|
|
80
|
+
mobileQRCode(id, host, payload) {
|
|
81
|
+
return this.api.post('Public/MobileQRCode', { id, host }, payload);
|
|
78
82
|
}
|
|
79
83
|
/**
|
|
80
84
|
* Get public and valid product data
|
|
81
85
|
* @param id Product/Service Id or Uid
|
|
82
86
|
* @param culture Language
|
|
87
|
+
* @param payload Payload
|
|
83
88
|
* @returns Result
|
|
84
89
|
*/
|
|
85
|
-
product(id, culture) {
|
|
90
|
+
product(id, culture, payload) {
|
|
86
91
|
culture = this.app.checkLanguage(culture);
|
|
87
|
-
return this.api.
|
|
92
|
+
return this.api.get(`Public/Product/${id}/${culture}`, undefined, payload);
|
|
88
93
|
}
|
|
89
94
|
/**
|
|
90
95
|
*
|
|
@@ -3,6 +3,7 @@ import { AddressRegion, AddressRegionDb } from '../address/AddressRegion';
|
|
|
3
3
|
import { AddressState } from '../address/AddressState';
|
|
4
4
|
import { IdLabelConditional } from './dto/IdLabelDto';
|
|
5
5
|
import { BaseApi } from './BaseApi';
|
|
6
|
+
import { IApiPayload } from '@etsoo/restclient';
|
|
6
7
|
/**
|
|
7
8
|
* Address Api
|
|
8
9
|
*/
|
|
@@ -28,7 +29,8 @@ export declare class AddressApi extends BaseApi {
|
|
|
28
29
|
/**
|
|
29
30
|
* Get state list
|
|
30
31
|
* @param regionId Region id
|
|
32
|
+
* @param payload Payload
|
|
31
33
|
* @returns Result
|
|
32
34
|
*/
|
|
33
|
-
states(regionId: string): Promise<AddressState[] | undefined>;
|
|
35
|
+
states(regionId: string, payload?: IApiPayload<AddressState[]>): Promise<AddressState[] | undefined>;
|
|
34
36
|
}
|
|
@@ -41,15 +41,17 @@ export class AddressApi extends BaseApi {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
return (await this.api.get(`Address/RegionList?language=${this.app.culture}`, undefined, { defaultValue: [] }));
|
|
44
|
+
return (await this.api.get(`Address/RegionList?language=${this.app.culture}`, undefined, { defaultValue: [], showLoading: false }));
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Get state list
|
|
49
49
|
* @param regionId Region id
|
|
50
|
+
* @param payload Payload
|
|
50
51
|
* @returns Result
|
|
51
52
|
*/
|
|
52
|
-
states(regionId) {
|
|
53
|
-
|
|
53
|
+
states(regionId, payload) {
|
|
54
|
+
payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [], showLoading: false });
|
|
55
|
+
return this.api.get(`Address/StateList?regionId=${regionId}&language=${this.app.culture}`, undefined, payload);
|
|
54
56
|
}
|
|
55
57
|
}
|
|
@@ -23,35 +23,35 @@ export declare class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
23
23
|
* @param payload Payload
|
|
24
24
|
* @returns Result
|
|
25
25
|
*/
|
|
26
|
-
protected createBase<R extends IActionResult>(data: object, payload?: IApiPayload<R
|
|
26
|
+
protected createBase<R extends IActionResult>(data: object, payload?: IApiPayload<R>): Promise<R | undefined>;
|
|
27
27
|
/**
|
|
28
28
|
* Delete
|
|
29
29
|
* @param id Id or ids
|
|
30
30
|
* @param payload Payload
|
|
31
31
|
*/
|
|
32
|
-
protected deleteBase<R extends IActionResult>(id: DataTypes.IdType, payload?: IApiPayload<R
|
|
33
|
-
protected deleteBase<R extends IActionResult>(ids: DataTypes.IdType[], payload?: IApiPayload<R
|
|
32
|
+
protected deleteBase<R extends IActionResult>(id: DataTypes.IdType, payload?: IApiPayload<R>): Promise<R | undefined>;
|
|
33
|
+
protected deleteBase<R extends IActionResult>(ids: DataTypes.IdType[], payload?: IApiPayload<R>): Promise<R | undefined>;
|
|
34
34
|
/**
|
|
35
35
|
* List
|
|
36
36
|
* @param rq Request data
|
|
37
37
|
* @param payload Payload
|
|
38
38
|
* @returns Result
|
|
39
39
|
*/
|
|
40
|
-
protected listBase<RQ extends TiplistRQ, R extends object>(rq: RQ, payload?: IApiPayload<R[]
|
|
40
|
+
protected listBase<RQ extends TiplistRQ, R extends object>(rq: RQ, payload?: IApiPayload<R[]>): Promise<R[] | undefined>;
|
|
41
41
|
/**
|
|
42
42
|
* Query
|
|
43
43
|
* @param rq Request data
|
|
44
44
|
* @param payload Payload
|
|
45
45
|
* @returns Result
|
|
46
46
|
*/
|
|
47
|
-
protected queryBase<RQ extends QueryRQ, R extends object>(rq: RQ, payload?: IApiPayload<R[]
|
|
47
|
+
protected queryBase<RQ extends QueryRQ, R extends object>(rq: RQ, payload?: IApiPayload<R[]>): Promise<R[] | undefined>;
|
|
48
48
|
/**
|
|
49
49
|
* Read
|
|
50
50
|
* @param id Id
|
|
51
51
|
* @param payload Payload
|
|
52
52
|
* @returns Result
|
|
53
53
|
*/
|
|
54
|
-
protected readBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R
|
|
54
|
+
protected readBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R>): Promise<R | undefined>;
|
|
55
55
|
/**
|
|
56
56
|
* Sort
|
|
57
57
|
* @param items Items to sort
|
|
@@ -60,19 +60,19 @@ export declare class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
60
60
|
*/
|
|
61
61
|
protected sortBase<RQ extends {
|
|
62
62
|
id: DataTypes.IdType;
|
|
63
|
-
}>(items: RQ[], payload?: IApiPayload<number
|
|
63
|
+
}>(items: RQ[], payload?: IApiPayload<number>): Promise<number | undefined>;
|
|
64
64
|
/**
|
|
65
65
|
* Update
|
|
66
66
|
* @param data Modal data
|
|
67
67
|
* @param payload Payload
|
|
68
68
|
* @returns Result
|
|
69
69
|
*/
|
|
70
|
-
protected updateBase<R extends IActionResult>(data: object, payload?: IApiPayload<R
|
|
70
|
+
protected updateBase<R extends IActionResult>(data: object, payload?: IApiPayload<R>): Promise<R | undefined>;
|
|
71
71
|
/**
|
|
72
72
|
* Read for update
|
|
73
73
|
* @param id Id
|
|
74
74
|
* @param payload Payload
|
|
75
75
|
* @returns Result
|
|
76
76
|
*/
|
|
77
|
-
protected updateReadBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R
|
|
77
|
+
protected updateReadBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R>): Promise<R | undefined>;
|
|
78
78
|
}
|
package/lib/mjs/erp/EntityApi.js
CHANGED
|
@@ -53,7 +53,7 @@ export class EntityApi extends BaseApi {
|
|
|
53
53
|
* @returns Result
|
|
54
54
|
*/
|
|
55
55
|
readBase(id, payload) {
|
|
56
|
-
return this.api.get(`${this.flag}/Read/${id}`, payload);
|
|
56
|
+
return this.api.get(`${this.flag}/Read/${id}`, undefined, payload);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Sort
|
|
@@ -82,6 +82,6 @@ export class EntityApi extends BaseApi {
|
|
|
82
82
|
* @returns Result
|
|
83
83
|
*/
|
|
84
84
|
updateReadBase(id, payload) {
|
|
85
|
-
return this.api.get(`${this.flag}/UpdateRead/${id}`, payload);
|
|
85
|
+
return this.api.get(`${this.flag}/UpdateRead/${id}`, undefined, payload);
|
|
86
86
|
}
|
|
87
87
|
}
|
package/lib/mjs/erp/OrgApi.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare class OrgApi extends EntityApi {
|
|
|
20
20
|
* Get organization list
|
|
21
21
|
* @param items Max items or request data
|
|
22
22
|
* @param serviceId Service id
|
|
23
|
+
* @param payload Payload
|
|
23
24
|
* @returns Result
|
|
24
25
|
*/
|
|
25
26
|
list(items?: number, serviceId?: number): Promise<ListType[] | undefined>;
|
|
@@ -30,18 +31,19 @@ export declare class OrgApi extends EntityApi {
|
|
|
30
31
|
* @param payload Payload
|
|
31
32
|
* @returns Result
|
|
32
33
|
*/
|
|
33
|
-
query(rq: OrgQueryRQ, payload?: IApiPayload<OrgQueryDto[]
|
|
34
|
+
query(rq: OrgQueryRQ, payload?: IApiPayload<OrgQueryDto[]>): Promise<OrgQueryDto[] | undefined>;
|
|
34
35
|
/**
|
|
35
36
|
* Switch organization
|
|
36
37
|
* @param id Organization id
|
|
37
38
|
* @param serviceId Service id
|
|
39
|
+
* @param payload Payload
|
|
38
40
|
*/
|
|
39
|
-
switch(id: number, serviceId?: number, payload?: IApiPayload<boolean
|
|
41
|
+
switch(id: number, serviceId?: number, payload?: IApiPayload<boolean>): Promise<boolean | undefined>;
|
|
40
42
|
/**
|
|
41
43
|
* Update
|
|
42
44
|
* @param data Modal data
|
|
43
45
|
* @param payload Payload
|
|
44
46
|
* @returns Result
|
|
45
47
|
*/
|
|
46
|
-
update(data: DataTypes.AddOrEditType<OrgRQ, true>, payload?: IApiPayload<IdActionResult
|
|
48
|
+
update(data: DataTypes.AddOrEditType<OrgRQ, true>, payload?: IApiPayload<IdActionResult>): Promise<IdActionResult<number> | undefined>;
|
|
47
49
|
}
|
package/lib/mjs/erp/OrgApi.js
CHANGED
|
@@ -28,6 +28,7 @@ export class OrgApi extends EntityApi {
|
|
|
28
28
|
* Switch organization
|
|
29
29
|
* @param id Organization id
|
|
30
30
|
* @param serviceId Service id
|
|
31
|
+
* @param payload Payload
|
|
31
32
|
*/
|
|
32
33
|
async switch(id, serviceId, payload) {
|
|
33
34
|
const result = await this.app.api.put('Organization/Switch', {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IApiPayload } from '@etsoo/restclient';
|
|
1
2
|
import { ListType, ListType1 } from '@etsoo/shared';
|
|
2
3
|
import { Currency } from '../business/Currency';
|
|
3
4
|
import { ProductUnit } from '../business/ProductUnit';
|
|
@@ -19,16 +20,18 @@ export declare class PublicApi extends BaseApi {
|
|
|
19
20
|
/**
|
|
20
21
|
* Get exchange rate
|
|
21
22
|
* @param currency Currency
|
|
23
|
+
* @param payload Payload
|
|
22
24
|
* @returns Result
|
|
23
25
|
*/
|
|
24
|
-
exchangeRate(currency: Currency | string): Promise<ExchangeRateDto | undefined>;
|
|
26
|
+
exchangeRate(currency: Currency | string, payload?: IApiPayload<ExchangeRateDto>): Promise<ExchangeRateDto | undefined>;
|
|
25
27
|
/**
|
|
26
28
|
* Get exchange rate history
|
|
27
29
|
* @param currencies Currencies
|
|
28
30
|
* @param months Max months
|
|
31
|
+
* @param payload Payload
|
|
29
32
|
* @returns Result
|
|
30
33
|
*/
|
|
31
|
-
exchangeRateHistory(currencies: (Currency | string)[], months?: number): Promise<ExchangeRateHistoryDto[] | undefined>;
|
|
34
|
+
exchangeRateHistory(currencies: (Currency | string)[], months?: number, payload?: IApiPayload<ExchangeRateHistoryDto[]>): Promise<ExchangeRateHistoryDto[] | undefined>;
|
|
32
35
|
/**
|
|
33
36
|
* Get product unit's label
|
|
34
37
|
* Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
|
|
@@ -42,15 +45,17 @@ export declare class PublicApi extends BaseApi {
|
|
|
42
45
|
* Get mobile base64 QRCode
|
|
43
46
|
* @param id User id
|
|
44
47
|
* @param host Host URL
|
|
48
|
+
* @param payload Payload
|
|
45
49
|
*/
|
|
46
|
-
mobileQRCode(id?: string, host?: string): Promise<string | undefined>;
|
|
50
|
+
mobileQRCode(id?: string, host?: string, payload?: IApiPayload<string>): Promise<string | undefined>;
|
|
47
51
|
/**
|
|
48
52
|
* Get public and valid product data
|
|
49
53
|
* @param id Product/Service Id or Uid
|
|
50
54
|
* @param culture Language
|
|
55
|
+
* @param payload Payload
|
|
51
56
|
* @returns Result
|
|
52
57
|
*/
|
|
53
|
-
product<T extends number | string>(id: T, culture?: string): T extends number ? PublicProductDto : PublicOrgProductDto;
|
|
58
|
+
product<T extends number | string>(id: T, culture?: string, payload?: IApiPayload<PublicProductDto>): T extends number ? PublicProductDto : PublicOrgProductDto;
|
|
54
59
|
/**
|
|
55
60
|
*
|
|
56
61
|
* Get all repeat options
|
package/lib/mjs/erp/PublicApi.js
CHANGED
|
@@ -13,7 +13,7 @@ export class PublicApi extends BaseApi {
|
|
|
13
13
|
*/
|
|
14
14
|
async currencies(currencyNames) {
|
|
15
15
|
if (currencyNames == null)
|
|
16
|
-
return (await this.api.get('Public/GetCurrencies'));
|
|
16
|
+
return (await this.api.get('Public/GetCurrencies', undefined, { defaultValue: [], showLoading: false }));
|
|
17
17
|
else
|
|
18
18
|
return currencyNames.map((name) => {
|
|
19
19
|
var _a;
|
|
@@ -26,19 +26,22 @@ export class PublicApi extends BaseApi {
|
|
|
26
26
|
/**
|
|
27
27
|
* Get exchange rate
|
|
28
28
|
* @param currency Currency
|
|
29
|
+
* @param payload Payload
|
|
29
30
|
* @returns Result
|
|
30
31
|
*/
|
|
31
|
-
exchangeRate(currency) {
|
|
32
|
-
return this.api.get(`Public/ExchangeRate/${currency}
|
|
32
|
+
exchangeRate(currency, payload) {
|
|
33
|
+
return this.api.get(`Public/ExchangeRate/${currency}`, undefined, payload);
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
36
|
* Get exchange rate history
|
|
36
37
|
* @param currencies Currencies
|
|
37
38
|
* @param months Max months
|
|
39
|
+
* @param payload Payload
|
|
38
40
|
* @returns Result
|
|
39
41
|
*/
|
|
40
|
-
exchangeRateHistory(currencies, months) {
|
|
41
|
-
|
|
42
|
+
exchangeRateHistory(currencies, months, payload) {
|
|
43
|
+
payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [] });
|
|
44
|
+
return this.api.post('Public/ExchangeRateHistory', { currencies, months }, payload);
|
|
42
45
|
}
|
|
43
46
|
/**
|
|
44
47
|
* Get product unit's label
|
|
@@ -69,19 +72,21 @@ export class PublicApi extends BaseApi {
|
|
|
69
72
|
* Get mobile base64 QRCode
|
|
70
73
|
* @param id User id
|
|
71
74
|
* @param host Host URL
|
|
75
|
+
* @param payload Payload
|
|
72
76
|
*/
|
|
73
|
-
mobileQRCode(id, host) {
|
|
74
|
-
return this.api.post('Public/MobileQRCode', { id, host });
|
|
77
|
+
mobileQRCode(id, host, payload) {
|
|
78
|
+
return this.api.post('Public/MobileQRCode', { id, host }, payload);
|
|
75
79
|
}
|
|
76
80
|
/**
|
|
77
81
|
* Get public and valid product data
|
|
78
82
|
* @param id Product/Service Id or Uid
|
|
79
83
|
* @param culture Language
|
|
84
|
+
* @param payload Payload
|
|
80
85
|
* @returns Result
|
|
81
86
|
*/
|
|
82
|
-
product(id, culture) {
|
|
87
|
+
product(id, culture, payload) {
|
|
83
88
|
culture = this.app.checkLanguage(culture);
|
|
84
|
-
return this.api.
|
|
89
|
+
return this.api.get(`Public/Product/${id}/${culture}`, undefined, payload);
|
|
85
90
|
}
|
|
86
91
|
/**
|
|
87
92
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/appscript",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.11",
|
|
4
4
|
"description": "Applications shared TypeScript framework",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://github.com/ETSOO/AppScript#readme",
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@etsoo/notificationbase": "^1.1.
|
|
56
|
-
"@etsoo/restclient": "^1.0.
|
|
55
|
+
"@etsoo/notificationbase": "^1.1.13",
|
|
56
|
+
"@etsoo/restclient": "^1.0.75",
|
|
57
57
|
"@etsoo/shared": "^1.1.65",
|
|
58
58
|
"@types/crypto-js": "^4.1.1",
|
|
59
59
|
"crypto-js": "^4.1.1"
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"@babel/preset-env": "^7.19.4",
|
|
66
66
|
"@babel/runtime-corejs3": "^7.19.4",
|
|
67
67
|
"@types/jest": "^29.1.2",
|
|
68
|
-
"@typescript-eslint/eslint-plugin": "^5.40.
|
|
69
|
-
"@typescript-eslint/parser": "^5.40.
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^5.40.1",
|
|
69
|
+
"@typescript-eslint/parser": "^5.40.1",
|
|
70
70
|
"eslint": "^8.25.0",
|
|
71
71
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
72
72
|
"eslint-plugin-import": "^2.26.0",
|
package/src/erp/AddressApi.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { AddressRegion, AddressRegionDb } from '../address/AddressRegion';
|
|
|
4
4
|
import { AddressState } from '../address/AddressState';
|
|
5
5
|
import { IdLabelConditional } from './dto/IdLabelDto';
|
|
6
6
|
import { BaseApi } from './BaseApi';
|
|
7
|
+
import { IApiPayload } from '@etsoo/restclient';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Address Api
|
|
@@ -57,7 +58,7 @@ export class AddressApi extends BaseApi {
|
|
|
57
58
|
return (await this.api.get<AddressRegionDb[]>(
|
|
58
59
|
`Address/RegionList?language=${this.app.culture}`,
|
|
59
60
|
undefined,
|
|
60
|
-
{ defaultValue: [] }
|
|
61
|
+
{ defaultValue: [], showLoading: false }
|
|
61
62
|
)) as any;
|
|
62
63
|
}
|
|
63
64
|
}
|
|
@@ -65,13 +66,16 @@ export class AddressApi extends BaseApi {
|
|
|
65
66
|
/**
|
|
66
67
|
* Get state list
|
|
67
68
|
* @param regionId Region id
|
|
69
|
+
* @param payload Payload
|
|
68
70
|
* @returns Result
|
|
69
71
|
*/
|
|
70
|
-
states(regionId: string) {
|
|
71
|
-
|
|
72
|
+
states(regionId: string, payload?: IApiPayload<AddressState[]>) {
|
|
73
|
+
payload ??= { defaultValue: [], showLoading: false };
|
|
74
|
+
|
|
75
|
+
return this.api.get(
|
|
72
76
|
`Address/StateList?regionId=${regionId}&language=${this.app.culture}`,
|
|
73
77
|
undefined,
|
|
74
|
-
|
|
78
|
+
payload
|
|
75
79
|
);
|
|
76
80
|
}
|
|
77
81
|
}
|
package/src/erp/EntityApi.ts
CHANGED
|
@@ -28,9 +28,9 @@ export class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
28
28
|
*/
|
|
29
29
|
protected createBase<R extends IActionResult>(
|
|
30
30
|
data: object,
|
|
31
|
-
payload?: IApiPayload<R
|
|
31
|
+
payload?: IApiPayload<R>
|
|
32
32
|
) {
|
|
33
|
-
return this.api.put
|
|
33
|
+
return this.api.put(`${this.flag}/Create`, data, payload);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -40,20 +40,20 @@ export class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
40
40
|
*/
|
|
41
41
|
protected deleteBase<R extends IActionResult>(
|
|
42
42
|
id: DataTypes.IdType,
|
|
43
|
-
payload?: IApiPayload<R
|
|
44
|
-
): R
|
|
43
|
+
payload?: IApiPayload<R>
|
|
44
|
+
): Promise<R | undefined>;
|
|
45
45
|
protected deleteBase<R extends IActionResult>(
|
|
46
46
|
ids: DataTypes.IdType[],
|
|
47
|
-
payload?: IApiPayload<R
|
|
48
|
-
): R
|
|
47
|
+
payload?: IApiPayload<R>
|
|
48
|
+
): Promise<R | undefined>;
|
|
49
49
|
protected deleteBase<R extends IActionResult>(
|
|
50
50
|
id: DataTypes.IdType | DataTypes.IdType[],
|
|
51
|
-
payload?: IApiPayload<R
|
|
51
|
+
payload?: IApiPayload<R>
|
|
52
52
|
) {
|
|
53
53
|
const query = Array.isArray(id)
|
|
54
54
|
? '?' + id.map((item) => `ids=${item}`).join('&')
|
|
55
55
|
: id;
|
|
56
|
-
return this.api.delete
|
|
56
|
+
return this.api.delete(
|
|
57
57
|
`${this.flag}/Delete/${query}`,
|
|
58
58
|
undefined,
|
|
59
59
|
payload
|
|
@@ -68,9 +68,9 @@ export class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
68
68
|
*/
|
|
69
69
|
protected listBase<RQ extends TiplistRQ, R extends object>(
|
|
70
70
|
rq: RQ,
|
|
71
|
-
payload?: IApiPayload<R[]
|
|
71
|
+
payload?: IApiPayload<R[]>
|
|
72
72
|
) {
|
|
73
|
-
return this.api.post
|
|
73
|
+
return this.api.post(`${this.flag}/List`, rq, payload);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -81,9 +81,9 @@ export class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
81
81
|
*/
|
|
82
82
|
protected queryBase<RQ extends QueryRQ, R extends object>(
|
|
83
83
|
rq: RQ,
|
|
84
|
-
payload?: IApiPayload<R[]
|
|
84
|
+
payload?: IApiPayload<R[]>
|
|
85
85
|
) {
|
|
86
|
-
return this.api.post
|
|
86
|
+
return this.api.post(`${this.flag}/Query`, rq, payload);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|
|
@@ -94,9 +94,9 @@ export class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
94
94
|
*/
|
|
95
95
|
protected readBase<R extends object>(
|
|
96
96
|
id: DataTypes.IdType,
|
|
97
|
-
payload?: IApiPayload<R
|
|
97
|
+
payload?: IApiPayload<R>
|
|
98
98
|
) {
|
|
99
|
-
return this.api.get
|
|
99
|
+
return this.api.get(`${this.flag}/Read/${id}`, undefined, payload);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
@@ -107,11 +107,11 @@ export class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
107
107
|
*/
|
|
108
108
|
protected sortBase<RQ extends { id: DataTypes.IdType }>(
|
|
109
109
|
items: RQ[],
|
|
110
|
-
payload?: IApiPayload<number
|
|
110
|
+
payload?: IApiPayload<number>
|
|
111
111
|
) {
|
|
112
112
|
const rq: Record<DataTypes.IdType, number> = {};
|
|
113
113
|
items.forEach((item, index) => (rq[item.id] = index));
|
|
114
|
-
return this.api.put
|
|
114
|
+
return this.api.put(`${this.flag}/Sort`, rq, payload);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
/**
|
|
@@ -122,9 +122,9 @@ export class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
122
122
|
*/
|
|
123
123
|
protected updateBase<R extends IActionResult>(
|
|
124
124
|
data: object,
|
|
125
|
-
payload?: IApiPayload<R
|
|
125
|
+
payload?: IApiPayload<R>
|
|
126
126
|
) {
|
|
127
|
-
return this.api.put
|
|
127
|
+
return this.api.put(`${this.flag}/Update`, data, payload);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
/**
|
|
@@ -135,8 +135,12 @@ export class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
135
135
|
*/
|
|
136
136
|
protected updateReadBase<R extends object>(
|
|
137
137
|
id: DataTypes.IdType,
|
|
138
|
-
payload?: IApiPayload<R
|
|
138
|
+
payload?: IApiPayload<R>
|
|
139
139
|
) {
|
|
140
|
-
return this.api.get
|
|
140
|
+
return this.api.get(
|
|
141
|
+
`${this.flag}/UpdateRead/${id}`,
|
|
142
|
+
undefined,
|
|
143
|
+
payload
|
|
144
|
+
);
|
|
141
145
|
}
|
|
142
146
|
}
|
package/src/erp/OrgApi.ts
CHANGED
|
@@ -24,6 +24,7 @@ export class OrgApi extends EntityApi {
|
|
|
24
24
|
* Get organization list
|
|
25
25
|
* @param items Max items or request data
|
|
26
26
|
* @param serviceId Service id
|
|
27
|
+
* @param payload Payload
|
|
27
28
|
* @returns Result
|
|
28
29
|
*/
|
|
29
30
|
list(items?: number, serviceId?: number): Promise<ListType[] | undefined>;
|
|
@@ -31,7 +32,7 @@ export class OrgApi extends EntityApi {
|
|
|
31
32
|
list(
|
|
32
33
|
items?: number | OrgListRQ,
|
|
33
34
|
serviceId?: number,
|
|
34
|
-
payload?: IApiPayload<ListType[]
|
|
35
|
+
payload?: IApiPayload<ListType[]>
|
|
35
36
|
) {
|
|
36
37
|
payload ??= { defaultValue: [], showLoading: false };
|
|
37
38
|
const rq = typeof items === 'object' ? items : { items, serviceId };
|
|
@@ -44,7 +45,7 @@ export class OrgApi extends EntityApi {
|
|
|
44
45
|
* @param payload Payload
|
|
45
46
|
* @returns Result
|
|
46
47
|
*/
|
|
47
|
-
query(rq: OrgQueryRQ, payload?: IApiPayload<OrgQueryDto[]
|
|
48
|
+
query(rq: OrgQueryRQ, payload?: IApiPayload<OrgQueryDto[]>) {
|
|
48
49
|
return this.queryBase(rq, payload);
|
|
49
50
|
}
|
|
50
51
|
|
|
@@ -52,13 +53,14 @@ export class OrgApi extends EntityApi {
|
|
|
52
53
|
* Switch organization
|
|
53
54
|
* @param id Organization id
|
|
54
55
|
* @param serviceId Service id
|
|
56
|
+
* @param payload Payload
|
|
55
57
|
*/
|
|
56
58
|
async switch(
|
|
57
59
|
id: number,
|
|
58
60
|
serviceId?: number,
|
|
59
|
-
payload?: IApiPayload<boolean
|
|
61
|
+
payload?: IApiPayload<boolean>
|
|
60
62
|
) {
|
|
61
|
-
const result = await this.app.api.put
|
|
63
|
+
const result = await this.app.api.put(
|
|
62
64
|
'Organization/Switch',
|
|
63
65
|
{
|
|
64
66
|
id,
|
|
@@ -79,8 +81,8 @@ export class OrgApi extends EntityApi {
|
|
|
79
81
|
*/
|
|
80
82
|
update(
|
|
81
83
|
data: DataTypes.AddOrEditType<OrgRQ, true>,
|
|
82
|
-
payload?: IApiPayload<IdActionResult
|
|
84
|
+
payload?: IApiPayload<IdActionResult>
|
|
83
85
|
) {
|
|
84
|
-
return super.updateBase
|
|
86
|
+
return super.updateBase(data, payload);
|
|
85
87
|
}
|
|
86
88
|
}
|
package/src/erp/PublicApi.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IApiPayload } from '@etsoo/restclient';
|
|
1
2
|
import { DataTypes, ListType, ListType1 } from '@etsoo/shared';
|
|
2
3
|
import { Currency } from '../business/Currency';
|
|
3
4
|
import { ProductUnit } from '../business/ProductUnit';
|
|
@@ -22,7 +23,9 @@ export class PublicApi extends BaseApi {
|
|
|
22
23
|
): Promise<T extends undefined ? CurrencyDto[] | undefined : ListType1[]> {
|
|
23
24
|
if (currencyNames == null)
|
|
24
25
|
return (await this.api.get<CurrencyDto[]>(
|
|
25
|
-
'Public/GetCurrencies'
|
|
26
|
+
'Public/GetCurrencies',
|
|
27
|
+
undefined,
|
|
28
|
+
{ defaultValue: [], showLoading: false }
|
|
26
29
|
)) as any;
|
|
27
30
|
else
|
|
28
31
|
return currencyNames.map((name) => ({
|
|
@@ -34,23 +37,37 @@ export class PublicApi extends BaseApi {
|
|
|
34
37
|
/**
|
|
35
38
|
* Get exchange rate
|
|
36
39
|
* @param currency Currency
|
|
40
|
+
* @param payload Payload
|
|
37
41
|
* @returns Result
|
|
38
42
|
*/
|
|
39
|
-
exchangeRate(
|
|
40
|
-
|
|
43
|
+
exchangeRate(
|
|
44
|
+
currency: Currency | string,
|
|
45
|
+
payload?: IApiPayload<ExchangeRateDto>
|
|
46
|
+
) {
|
|
47
|
+
return this.api.get(
|
|
48
|
+
`Public/ExchangeRate/${currency}`,
|
|
49
|
+
undefined,
|
|
50
|
+
payload
|
|
51
|
+
);
|
|
41
52
|
}
|
|
42
53
|
|
|
43
54
|
/**
|
|
44
55
|
* Get exchange rate history
|
|
45
56
|
* @param currencies Currencies
|
|
46
57
|
* @param months Max months
|
|
58
|
+
* @param payload Payload
|
|
47
59
|
* @returns Result
|
|
48
60
|
*/
|
|
49
|
-
exchangeRateHistory(
|
|
50
|
-
|
|
61
|
+
exchangeRateHistory(
|
|
62
|
+
currencies: (Currency | string)[],
|
|
63
|
+
months?: number,
|
|
64
|
+
payload?: IApiPayload<ExchangeRateHistoryDto[]>
|
|
65
|
+
) {
|
|
66
|
+
payload ??= { defaultValue: [] };
|
|
67
|
+
return this.api.post(
|
|
51
68
|
'Public/ExchangeRateHistory',
|
|
52
69
|
{ currencies, months },
|
|
53
|
-
|
|
70
|
+
payload
|
|
54
71
|
);
|
|
55
72
|
}
|
|
56
73
|
|
|
@@ -83,24 +100,29 @@ export class PublicApi extends BaseApi {
|
|
|
83
100
|
* Get mobile base64 QRCode
|
|
84
101
|
* @param id User id
|
|
85
102
|
* @param host Host URL
|
|
103
|
+
* @param payload Payload
|
|
86
104
|
*/
|
|
87
|
-
mobileQRCode(id?: string, host?: string) {
|
|
88
|
-
return this.api.post
|
|
105
|
+
mobileQRCode(id?: string, host?: string, payload?: IApiPayload<string>) {
|
|
106
|
+
return this.api.post('Public/MobileQRCode', { id, host }, payload);
|
|
89
107
|
}
|
|
90
108
|
|
|
91
109
|
/**
|
|
92
110
|
* Get public and valid product data
|
|
93
111
|
* @param id Product/Service Id or Uid
|
|
94
112
|
* @param culture Language
|
|
113
|
+
* @param payload Payload
|
|
95
114
|
* @returns Result
|
|
96
115
|
*/
|
|
97
116
|
product<T extends number | string>(
|
|
98
117
|
id: T,
|
|
99
|
-
culture?: string
|
|
118
|
+
culture?: string,
|
|
119
|
+
payload?: IApiPayload<PublicProductDto>
|
|
100
120
|
): T extends number ? PublicProductDto : PublicOrgProductDto {
|
|
101
121
|
culture = this.app.checkLanguage(culture);
|
|
102
|
-
return this.api.
|
|
103
|
-
`Public/Product/${id}/${culture}
|
|
122
|
+
return this.api.get(
|
|
123
|
+
`Public/Product/${id}/${culture}`,
|
|
124
|
+
undefined,
|
|
125
|
+
payload
|
|
104
126
|
) as any;
|
|
105
127
|
}
|
|
106
128
|
|