@etsoo/appscript 1.3.6 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +2 -14
  2. package/__tests__/app/CoreApp.ts +14 -14
  3. package/lib/cjs/address/AddressUtils.d.ts +0 -20
  4. package/lib/cjs/address/AddressUtils.js +0 -60
  5. package/lib/cjs/app/CoreApp.d.ts +11 -1
  6. package/lib/cjs/app/CoreApp.js +18 -2
  7. package/lib/cjs/app/IApp.d.ts +6 -0
  8. package/lib/cjs/erp/AddressApi.d.ts +13 -9
  9. package/lib/cjs/erp/AddressApi.js +23 -25
  10. package/lib/cjs/erp/BaseApi.d.ts +5 -3
  11. package/lib/cjs/erp/BaseApi.js +3 -1
  12. package/lib/cjs/erp/EntityApi.d.ts +78 -0
  13. package/lib/cjs/erp/EntityApi.js +91 -0
  14. package/lib/cjs/erp/OrgApi.d.ts +32 -5
  15. package/lib/cjs/erp/OrgApi.js +30 -12
  16. package/lib/cjs/erp/PublicApi.js +5 -5
  17. package/lib/cjs/{dto → erp/dto}/IdLabelDto.d.ts +0 -0
  18. package/lib/cjs/{dto → erp/dto}/IdLabelDto.js +0 -0
  19. package/lib/cjs/{dto → erp/dto}/IdLabelPrimaryDto.d.ts +0 -0
  20. package/lib/cjs/{dto → erp/dto}/IdLabelPrimaryDto.js +0 -0
  21. package/lib/cjs/{dto → erp/dto}/InitCallDto.d.ts +0 -0
  22. package/lib/cjs/{dto → erp/dto}/InitCallDto.js +0 -0
  23. package/lib/cjs/erp/dto/OrgQueryDto.d.ts +21 -0
  24. package/lib/cjs/{rq/LoginIdRQ.js → erp/dto/OrgQueryDto.js} +0 -0
  25. package/lib/cjs/erp/rq/OrgListRQ.d.ts +10 -0
  26. package/lib/cjs/{rq/LoginRQ.js → erp/rq/OrgListRQ.js} +0 -0
  27. package/lib/cjs/erp/rq/OrgQueryRQ.d.ts +14 -0
  28. package/lib/cjs/{rq/QueryRQ.js → erp/rq/OrgQueryRQ.js} +0 -0
  29. package/lib/cjs/erp/rq/OrgRQ.d.ts +25 -0
  30. package/lib/cjs/{rq/TiplistRQ.js → erp/rq/OrgRQ.js} +0 -0
  31. package/lib/cjs/{rq → erp/rq}/QueryRQ.d.ts +0 -0
  32. package/lib/cjs/erp/rq/QueryRQ.js +2 -0
  33. package/lib/cjs/erp/rq/RefreshTokenRQ.d.ts +29 -0
  34. package/lib/cjs/erp/rq/RefreshTokenRQ.js +2 -0
  35. package/lib/cjs/{rq → erp/rq}/TiplistRQ.d.ts +0 -0
  36. package/lib/cjs/erp/rq/TiplistRQ.js +2 -0
  37. package/lib/cjs/i18n/en-US.json +20 -0
  38. package/lib/cjs/i18n/zh-CN.json +20 -0
  39. package/lib/cjs/i18n/zh-HK.json +20 -0
  40. package/lib/cjs/index.d.ts +7 -7
  41. package/lib/cjs/index.js +10 -10
  42. package/lib/mjs/address/AddressUtils.d.ts +0 -20
  43. package/lib/mjs/address/AddressUtils.js +0 -37
  44. package/lib/mjs/app/CoreApp.d.ts +11 -1
  45. package/lib/mjs/app/CoreApp.js +18 -2
  46. package/lib/mjs/app/IApp.d.ts +6 -0
  47. package/lib/mjs/erp/AddressApi.d.ts +13 -9
  48. package/lib/mjs/erp/AddressApi.js +23 -25
  49. package/lib/mjs/erp/BaseApi.d.ts +5 -3
  50. package/lib/mjs/erp/BaseApi.js +3 -1
  51. package/lib/mjs/erp/EntityApi.d.ts +78 -0
  52. package/lib/mjs/erp/EntityApi.js +87 -0
  53. package/lib/mjs/erp/OrgApi.d.ts +32 -5
  54. package/lib/mjs/erp/OrgApi.js +30 -12
  55. package/lib/mjs/erp/PublicApi.js +5 -5
  56. package/lib/mjs/{dto → erp/dto}/IdLabelDto.d.ts +0 -0
  57. package/lib/mjs/{dto → erp/dto}/IdLabelDto.js +0 -0
  58. package/lib/mjs/{dto → erp/dto}/IdLabelPrimaryDto.d.ts +0 -0
  59. package/lib/mjs/{dto → erp/dto}/IdLabelPrimaryDto.js +0 -0
  60. package/lib/mjs/{dto → erp/dto}/InitCallDto.d.ts +0 -0
  61. package/lib/mjs/{dto → erp/dto}/InitCallDto.js +0 -0
  62. package/lib/mjs/erp/dto/OrgQueryDto.d.ts +21 -0
  63. package/lib/mjs/{rq/LoginIdRQ.js → erp/dto/OrgQueryDto.js} +0 -0
  64. package/lib/mjs/erp/rq/OrgListRQ.d.ts +10 -0
  65. package/lib/mjs/{rq/LoginRQ.js → erp/rq/OrgListRQ.js} +0 -0
  66. package/lib/mjs/erp/rq/OrgQueryRQ.d.ts +14 -0
  67. package/lib/mjs/{rq/QueryRQ.js → erp/rq/OrgQueryRQ.js} +0 -0
  68. package/lib/mjs/erp/rq/OrgRQ.d.ts +25 -0
  69. package/lib/mjs/{rq/TiplistRQ.js → erp/rq/OrgRQ.js} +0 -0
  70. package/lib/mjs/{rq → erp/rq}/QueryRQ.d.ts +0 -0
  71. package/lib/mjs/erp/rq/QueryRQ.js +1 -0
  72. package/lib/mjs/erp/rq/RefreshTokenRQ.d.ts +29 -0
  73. package/lib/mjs/erp/rq/RefreshTokenRQ.js +1 -0
  74. package/lib/mjs/{rq → erp/rq}/TiplistRQ.d.ts +0 -0
  75. package/lib/mjs/erp/rq/TiplistRQ.js +1 -0
  76. package/lib/mjs/i18n/en-US.json +20 -0
  77. package/lib/mjs/i18n/zh-CN.json +20 -0
  78. package/lib/mjs/i18n/zh-HK.json +20 -0
  79. package/lib/mjs/index.d.ts +7 -7
  80. package/lib/mjs/index.js +10 -10
  81. package/package.json +4 -4
  82. package/src/address/AddressUtils.ts +0 -45
  83. package/src/app/CoreApp.ts +21 -2
  84. package/src/app/IApp.ts +7 -0
  85. package/src/erp/AddressApi.ts +19 -22
  86. package/src/erp/BaseApi.ts +3 -2
  87. package/src/erp/EntityApi.ts +142 -0
  88. package/src/erp/OrgApi.ts +66 -19
  89. package/src/erp/PublicApi.ts +5 -7
  90. package/src/{dto → erp/dto}/IdLabelDto.ts +0 -0
  91. package/src/{dto → erp/dto}/IdLabelPrimaryDto.ts +0 -0
  92. package/src/{dto → erp/dto}/InitCallDto.ts +0 -0
  93. package/src/erp/dto/OrgQueryDto.ts +24 -0
  94. package/src/erp/rq/OrgListRQ.ts +11 -0
  95. package/src/erp/rq/OrgQueryRQ.ts +16 -0
  96. package/src/erp/rq/OrgRQ.ts +29 -0
  97. package/src/{rq → erp/rq}/QueryRQ.ts +0 -0
  98. package/src/erp/rq/RefreshTokenRQ.ts +34 -0
  99. package/src/{rq → erp/rq}/TiplistRQ.ts +0 -0
  100. package/src/i18n/en-US.json +20 -0
  101. package/src/i18n/zh-CN.json +20 -0
  102. package/src/i18n/zh-HK.json +20 -0
  103. package/src/index.ts +11 -12
  104. package/lib/cjs/rq/LoginIdRQ.d.ts +0 -17
  105. package/lib/cjs/rq/LoginRQ.d.ts +0 -22
  106. package/lib/mjs/rq/LoginIdRQ.d.ts +0 -17
  107. package/lib/mjs/rq/LoginRQ.d.ts +0 -22
  108. package/src/i18n/address.en-US.json +0 -21
  109. package/src/i18n/address.zh-CN.json +0 -21
  110. package/src/i18n/address.zh-HK.json +0 -21
  111. package/src/rq/LoginIdRQ.ts +0 -19
  112. package/src/rq/LoginRQ.ts +0 -26
@@ -284,6 +284,12 @@ export interface IApp {
284
284
  * @returns Cached token
285
285
  */
286
286
  getCacheToken(): string | undefined;
287
+ /**
288
+ * Get region label
289
+ * @param id Region id
290
+ * @returns Label
291
+ */
292
+ getRegionLabel(id: string): string;
287
293
  /**
288
294
  * Get all regions
289
295
  * @returns Regions
@@ -1,6 +1,7 @@
1
+ import { AddressContinent } from '../address/AddressContinent';
1
2
  import { AddressRegion, AddressRegionDb } from '../address/AddressRegion';
2
3
  import { AddressState } from '../address/AddressState';
3
- import { IdLabelConditional } from '../dto/IdLabelDto';
4
+ import { IdLabelConditional } from './dto/IdLabelDto';
4
5
  import { BaseApi } from './BaseApi';
5
6
  /**
6
7
  * Address Api
@@ -8,23 +9,26 @@ import { BaseApi } from './BaseApi';
8
9
  export declare class AddressApi extends BaseApi {
9
10
  /**
10
11
  * Get all continents
11
- * @param language Language
12
12
  * @param isNumberKey Is number key or key as id
13
13
  * @returns Continents
14
14
  */
15
- continents<T extends boolean>(language?: string, isNumberKey?: T): Promise<IdLabelConditional<T>>;
15
+ continents<T extends boolean>(isNumberKey?: T): Promise<IdLabelConditional<T>>;
16
16
  /**
17
- * Get region list from database
18
- * @param language Language
17
+ * Get continent label
18
+ * @param id Region id
19
+ * @returns Label
20
+ */
21
+ getContinentLabel(id: AddressContinent | string): string;
22
+ /**
23
+ * Get region list
19
24
  * @param isLocal Is local version
20
25
  * @returns Result
21
26
  */
22
- regions<T extends boolean = true>(language?: string, isLocal?: T): Promise<T extends true | undefined ? AddressRegion[] : AddressRegionDb[] | undefined>;
27
+ regions<T extends boolean = true>(isLocal?: T): Promise<T extends true | undefined ? AddressRegion[] : AddressRegionDb[] | undefined>;
23
28
  /**
24
- * Get state list from database
29
+ * Get state list
25
30
  * @param regionId Region id
26
- * @param language Language
27
31
  * @returns Result
28
32
  */
29
- states(regionId: string, language?: string): Promise<AddressState[] | undefined>;
33
+ states(regionId: string): Promise<AddressState[] | undefined>;
30
34
  }
@@ -1,7 +1,6 @@
1
1
  import { DataTypes } from '@etsoo/shared';
2
2
  import { AddressContinent } from '../address/AddressContinent';
3
3
  import { AddressRegion } from '../address/AddressRegion';
4
- import { AddressUtils } from '../address/AddressUtils';
5
4
  import { BaseApi } from './BaseApi';
6
5
  /**
7
6
  * Address Api
@@ -9,49 +8,48 @@ import { BaseApi } from './BaseApi';
9
8
  export class AddressApi extends BaseApi {
10
9
  /**
11
10
  * Get all continents
12
- * @param language Language
13
11
  * @param isNumberKey Is number key or key as id
14
12
  * @returns Continents
15
13
  */
16
- async continents(language, isNumberKey = false) {
17
- const labels = await AddressUtils.getLabels(this.app.checkLanguage(language));
18
- return DataTypes.getEnumKeys(AddressContinent).map((key) => {
19
- var _a;
20
- return ({
21
- id: isNumberKey
22
- ? DataTypes.getEnumByKey(AddressContinent, key)
23
- : key.toString(),
24
- label: (_a = labels['continent' + key]) !== null && _a !== void 0 ? _a : key
25
- });
26
- });
14
+ async continents(isNumberKey = false) {
15
+ return DataTypes.getEnumKeys(AddressContinent).map((key) => ({
16
+ id: isNumberKey
17
+ ? DataTypes.getEnumByKey(AddressContinent, key)
18
+ : key.toString(),
19
+ label: this.getContinentLabel(key)
20
+ }));
21
+ }
22
+ /**
23
+ * Get continent label
24
+ * @param id Region id
25
+ * @returns Label
26
+ */
27
+ getContinentLabel(id) {
28
+ var _a;
29
+ return (_a = this.app.get('continent' + id)) !== null && _a !== void 0 ? _a : id;
27
30
  }
28
31
  /**
29
- * Get region list from database
30
- * @param language Language
32
+ * Get region list
31
33
  * @param isLocal Is local version
32
34
  * @returns Result
33
35
  */
34
- async regions(language, isLocal) {
35
- language = this.app.checkLanguage(language);
36
+ async regions(isLocal) {
36
37
  if (isLocal == null || isLocal) {
37
- const labels = await AddressUtils.getLabels(language);
38
38
  return AddressRegion.all.map((region) => {
39
- region.label = AddressUtils.getRegionLabel(region.id, labels);
39
+ region.label = this.app.getRegionLabel(region.id);
40
40
  return { ...region };
41
41
  });
42
42
  }
43
43
  else {
44
- return (await this.app.api.get(`Address/RegionList?language=${language}`, undefined, { defaultValue: [] }));
44
+ return (await this.api.get(`Address/RegionList?language=${this.app.culture}`, undefined, { defaultValue: [] }));
45
45
  }
46
46
  }
47
47
  /**
48
- * Get state list from database
48
+ * Get state list
49
49
  * @param regionId Region id
50
- * @param language Language
51
50
  * @returns Result
52
51
  */
53
- states(regionId, language) {
54
- language = this.app.checkLanguage(language);
55
- return this.app.api.get(`Address/StateList?regionId=${regionId}&language=${language}`, undefined, { defaultValue: [] });
52
+ states(regionId) {
53
+ return this.api.get(`Address/StateList?regionId=${regionId}&language=${this.app.culture}`, undefined, { defaultValue: [] });
56
54
  }
57
55
  }
@@ -2,11 +2,13 @@ import { IApp } from '../app/IApp';
2
2
  /**
3
3
  * SmartERP base API
4
4
  */
5
- export declare class BaseApi {
6
- protected app: IApp;
5
+ export declare class BaseApi<T extends IApp = IApp> {
6
+ protected app: T;
7
+ protected api: import("@etsoo/restclient").IApi<any>;
7
8
  /**
8
9
  * Constructor
9
10
  * @param app Application
11
+ * @param api API
10
12
  */
11
- constructor(app: IApp);
13
+ constructor(app: T, api?: import("@etsoo/restclient").IApi<any>);
12
14
  }
@@ -5,8 +5,10 @@ export class BaseApi {
5
5
  /**
6
6
  * Constructor
7
7
  * @param app Application
8
+ * @param api API
8
9
  */
9
- constructor(app) {
10
+ constructor(app, api = app.api) {
10
11
  this.app = app;
12
+ this.api = api;
11
13
  }
12
14
  }
@@ -0,0 +1,78 @@
1
+ import { IApi, IApiPayload } from '@etsoo/restclient';
2
+ import { DataTypes } from '@etsoo/shared';
3
+ import { IApp } from '../app/IApp';
4
+ import { IActionResult } from '../result/IActionResult';
5
+ import { BaseApi } from './BaseApi';
6
+ import { QueryRQ } from './rq/QueryRQ';
7
+ import { TiplistRQ } from './rq/TiplistRQ';
8
+ /**
9
+ * Entity API
10
+ * Follow com.etsoo.CoreFramework.Services.EntityServiceBase
11
+ */
12
+ export declare class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
13
+ protected flag: string;
14
+ /**
15
+ * Constructor
16
+ * @param flag Identity flag, like 'Product' for product APIs
17
+ * @param app Application
18
+ */
19
+ constructor(flag: string, app: T, api?: IApi);
20
+ /**
21
+ * Create
22
+ * @param data Modal data
23
+ * @param payload Payload
24
+ * @returns Result
25
+ */
26
+ protected createBase<R extends IActionResult>(data: object, payload?: IApiPayload<R, any>): Promise<R | undefined>;
27
+ /**
28
+ * Delete
29
+ * @param id Id or ids
30
+ * @param payload Payload
31
+ */
32
+ protected deleteBase<R extends IActionResult>(id: DataTypes.IdType, payload?: IApiPayload<R, any>): R;
33
+ protected deleteBase<R extends IActionResult>(ids: DataTypes.IdType[], payload?: IApiPayload<R, any>): R;
34
+ /**
35
+ * List
36
+ * @param rq Request data
37
+ * @param payload Payload
38
+ * @returns Result
39
+ */
40
+ protected listBase<RQ extends TiplistRQ, R extends object>(rq: RQ, payload?: IApiPayload<R[], any>): Promise<R[] | undefined>;
41
+ /**
42
+ * Query
43
+ * @param rq Request data
44
+ * @param payload Payload
45
+ * @returns Result
46
+ */
47
+ protected queryBase<RQ extends QueryRQ, R extends object>(rq: RQ, payload?: IApiPayload<R[], any>): Promise<R[] | undefined>;
48
+ /**
49
+ * Read
50
+ * @param id Id
51
+ * @param payload Payload
52
+ * @returns Result
53
+ */
54
+ protected readBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R, any>): Promise<R | undefined>;
55
+ /**
56
+ * Sort
57
+ * @param items Items to sort
58
+ * @param payload Payload
59
+ * @returns Result
60
+ */
61
+ protected sortBase<RQ extends {
62
+ id: DataTypes.IdType;
63
+ }>(items: RQ[], payload?: IApiPayload<number, any>): Promise<number | undefined>;
64
+ /**
65
+ * Update
66
+ * @param data Modal data
67
+ * @param payload Payload
68
+ * @returns Result
69
+ */
70
+ protected updateBase<R extends IActionResult>(data: object, payload?: IApiPayload<R, any>): Promise<R | undefined>;
71
+ /**
72
+ * Read for update
73
+ * @param id Id
74
+ * @param payload Payload
75
+ * @returns Result
76
+ */
77
+ protected updateReadBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R, any>): Promise<R | undefined>;
78
+ }
@@ -0,0 +1,87 @@
1
+ import { BaseApi } from './BaseApi';
2
+ /**
3
+ * Entity API
4
+ * Follow com.etsoo.CoreFramework.Services.EntityServiceBase
5
+ */
6
+ export class EntityApi extends BaseApi {
7
+ /**
8
+ * Constructor
9
+ * @param flag Identity flag, like 'Product' for product APIs
10
+ * @param app Application
11
+ */
12
+ constructor(flag, app, api) {
13
+ super(app, api);
14
+ this.flag = flag;
15
+ }
16
+ /**
17
+ * Create
18
+ * @param data Modal data
19
+ * @param payload Payload
20
+ * @returns Result
21
+ */
22
+ createBase(data, payload) {
23
+ return this.api.put(`${this.flag}/Create`, data, payload);
24
+ }
25
+ deleteBase(id, payload) {
26
+ const query = Array.isArray(id)
27
+ ? '?' + id.map((item) => `ids=${item}`).join('&')
28
+ : id;
29
+ return this.api.delete(`${this.flag}/Delete/${query}`, undefined, payload);
30
+ }
31
+ /**
32
+ * List
33
+ * @param rq Request data
34
+ * @param payload Payload
35
+ * @returns Result
36
+ */
37
+ listBase(rq, payload) {
38
+ return this.api.post(`${this.flag}/List`, rq, payload);
39
+ }
40
+ /**
41
+ * Query
42
+ * @param rq Request data
43
+ * @param payload Payload
44
+ * @returns Result
45
+ */
46
+ queryBase(rq, payload) {
47
+ return this.api.post(`${this.flag}/Query`, rq, payload);
48
+ }
49
+ /**
50
+ * Read
51
+ * @param id Id
52
+ * @param payload Payload
53
+ * @returns Result
54
+ */
55
+ readBase(id, payload) {
56
+ return this.api.get(`${this.flag}/Read/${id}`, payload);
57
+ }
58
+ /**
59
+ * Sort
60
+ * @param items Items to sort
61
+ * @param payload Payload
62
+ * @returns Result
63
+ */
64
+ sortBase(items, payload) {
65
+ const rq = {};
66
+ items.forEach((item, index) => (rq[item.id] = index));
67
+ return this.api.put(`${this.flag}/Sort`, rq, payload);
68
+ }
69
+ /**
70
+ * Update
71
+ * @param data Modal data
72
+ * @param payload Payload
73
+ * @returns Result
74
+ */
75
+ updateBase(data, payload) {
76
+ return this.api.put(`${this.flag}/Update`, data, payload);
77
+ }
78
+ /**
79
+ * Read for update
80
+ * @param id Id
81
+ * @param payload Payload
82
+ * @returns Result
83
+ */
84
+ updateReadBase(id, payload) {
85
+ return this.api.get(`${this.flag}/UpdateRead/${id}`, payload);
86
+ }
87
+ }
@@ -1,20 +1,47 @@
1
- import { ListType } from '@etsoo/shared';
2
- import { BaseApi } from './BaseApi';
1
+ import { IApiPayload } from '@etsoo/restclient';
2
+ import { DataTypes, ListType } from '@etsoo/shared';
3
+ import { IApp } from '../app/IApp';
4
+ import { IdActionResult } from '../result/IActionResult';
5
+ import { OrgQueryDto } from './dto/OrgQueryDto';
6
+ import { EntityApi } from './EntityApi';
7
+ import { OrgListRQ } from './rq/OrgListRQ';
8
+ import { OrgQueryRQ } from './rq/OrgQueryRQ';
9
+ import { OrgRQ } from './rq/OrgRQ';
3
10
  /**
4
11
  * Organization API
5
12
  */
6
- export declare class OrgApi extends BaseApi {
13
+ export declare class OrgApi extends EntityApi {
14
+ /**
15
+ * Constructor
16
+ * @param app Application
17
+ */
18
+ constructor(app: IApp);
7
19
  /**
8
20
  * Get organization list
9
- * @param items Max items
21
+ * @param items Max items or request data
10
22
  * @param serviceId Service id
11
23
  * @returns Result
12
24
  */
13
25
  list(items?: number, serviceId?: number): Promise<ListType[] | undefined>;
26
+ list(rq: OrgListRQ): Promise<ListType[] | undefined>;
27
+ /**
28
+ * Query
29
+ * @param rq Request data
30
+ * @param payload Payload
31
+ * @returns Result
32
+ */
33
+ query(rq: OrgQueryRQ, payload?: IApiPayload<OrgQueryDto[], any>): Promise<OrgQueryDto[] | undefined>;
14
34
  /**
15
35
  * Switch organization
16
36
  * @param id Organization id
17
37
  * @param serviceId Service id
18
38
  */
19
- switch(id: number, serviceId?: number): Promise<boolean | undefined>;
39
+ switch(id: number, serviceId?: number, payload?: IApiPayload<boolean, any>): Promise<boolean | undefined>;
40
+ /**
41
+ * Update
42
+ * @param data Modal data
43
+ * @param payload Payload
44
+ * @returns Result
45
+ */
46
+ update(data: DataTypes.AddOrEditType<OrgRQ, true>, payload?: IApiPayload<IdActionResult, any>): Promise<IdActionResult<number> | undefined>;
20
47
  }
@@ -1,33 +1,51 @@
1
- import { BaseApi } from './BaseApi';
1
+ import { EntityApi } from './EntityApi';
2
2
  /**
3
3
  * Organization API
4
4
  */
5
- export class OrgApi extends BaseApi {
5
+ export class OrgApi extends EntityApi {
6
6
  /**
7
- * Get organization list
8
- * @param items Max items
9
- * @param serviceId Service id
7
+ * Constructor
8
+ * @param app Application
9
+ */
10
+ constructor(app) {
11
+ super('Organization', app);
12
+ }
13
+ list(items, serviceId, payload) {
14
+ payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [], showLoading: false });
15
+ const rq = typeof items === 'object' ? items : { items, serviceId };
16
+ return this.listBase(rq, payload);
17
+ }
18
+ /**
19
+ * Query
20
+ * @param rq Request data
21
+ * @param payload Payload
10
22
  * @returns Result
11
23
  */
12
- list(items, serviceId) {
13
- return this.app.api.post('Organization/List', {
14
- items,
15
- serviceId
16
- }, { defaultValue: [], showLoading: false });
24
+ query(rq, payload) {
25
+ return this.queryBase(rq, payload);
17
26
  }
18
27
  /**
19
28
  * Switch organization
20
29
  * @param id Organization id
21
30
  * @param serviceId Service id
22
31
  */
23
- async switch(id, serviceId) {
32
+ async switch(id, serviceId, payload) {
24
33
  const result = await this.app.api.put('Organization/Switch', {
25
34
  id,
26
35
  serviceId,
27
36
  deviceId: this.app.deviceId
28
- });
37
+ }, payload);
29
38
  if (result)
30
39
  return await this.app.refreshToken();
31
40
  return result;
32
41
  }
42
+ /**
43
+ * Update
44
+ * @param data Modal data
45
+ * @param payload Payload
46
+ * @returns Result
47
+ */
48
+ update(data, payload) {
49
+ return super.updateBase(data, payload);
50
+ }
33
51
  }
@@ -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.app.api.get('Public/GetCurrencies'));
16
+ return (await this.api.get('Public/GetCurrencies'));
17
17
  else
18
18
  return currencyNames.map((name) => {
19
19
  var _a;
@@ -29,7 +29,7 @@ export class PublicApi extends BaseApi {
29
29
  * @returns Result
30
30
  */
31
31
  exchangeRate(currency) {
32
- return this.app.api.get(`Public/ExchangeRate/${currency}`);
32
+ return this.api.get(`Public/ExchangeRate/${currency}`);
33
33
  }
34
34
  /**
35
35
  * Get exchange rate history
@@ -38,7 +38,7 @@ export class PublicApi extends BaseApi {
38
38
  * @returns Result
39
39
  */
40
40
  exchangeRateHistory(currencies, months) {
41
- return this.app.api.post('Public/ExchangeRateHistory', { currencies, months }, { defaultValue: [] });
41
+ return this.api.post('Public/ExchangeRateHistory', { currencies, months }, { defaultValue: [] });
42
42
  }
43
43
  /**
44
44
  * Get product unit's label
@@ -71,7 +71,7 @@ export class PublicApi extends BaseApi {
71
71
  * @param host Host URL
72
72
  */
73
73
  mobileQRCode(id, host) {
74
- return this.app.api.post('Public/MobileQRCode', { id, host });
74
+ return this.api.post('Public/MobileQRCode', { id, host });
75
75
  }
76
76
  /**
77
77
  * Get public and valid product data
@@ -81,7 +81,7 @@ export class PublicApi extends BaseApi {
81
81
  */
82
82
  product(id, culture) {
83
83
  culture = this.app.checkLanguage(culture);
84
- return this.app.api.post(`Public/Product/${id}/${culture}`);
84
+ return this.api.post(`Public/Product/${id}/${culture}`);
85
85
  }
86
86
  /**
87
87
  *
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Organization query data
3
+ */
4
+ export declare type OrgQueryDto = {
5
+ /**
6
+ * Id
7
+ */
8
+ id: number;
9
+ /**
10
+ * Brand, like ETSOO
11
+ */
12
+ brand?: string;
13
+ /**
14
+ * Name, like ETSOO NZ LIMITED
15
+ */
16
+ name: string;
17
+ /**
18
+ * Creation
19
+ */
20
+ creation: string | Date;
21
+ };
@@ -0,0 +1,10 @@
1
+ import { TiplistRQ } from './TiplistRQ';
2
+ /**
3
+ * Organization list request data
4
+ */
5
+ export declare type OrgListRQ = TiplistRQ & {
6
+ /**
7
+ * Service id
8
+ */
9
+ serviceId?: number;
10
+ };
File without changes
@@ -0,0 +1,14 @@
1
+ import { QueryRQ } from './QueryRQ';
2
+ /**
3
+ * Organization query request data
4
+ */
5
+ export declare type OrgQueryRQ = QueryRQ & {
6
+ /**
7
+ * Name
8
+ */
9
+ name?: string;
10
+ /**
11
+ * Parent organization id
12
+ */
13
+ parentId?: number;
14
+ };
File without changes
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Organization add/edit request data
3
+ */
4
+ export declare type OrgRQ = {
5
+ /**
6
+ * Region id
7
+ */
8
+ regionId: string;
9
+ /**
10
+ * Name
11
+ */
12
+ name: string;
13
+ /**
14
+ * Identifier
15
+ */
16
+ identifier: string;
17
+ /**
18
+ * Brand
19
+ */
20
+ brand?: string;
21
+ /**
22
+ * Trade as
23
+ */
24
+ tradeAs?: string;
25
+ };
File without changes
File without changes
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Refresh token request data
3
+ */
4
+ export declare type RefreshTokenRQ = {
5
+ /**
6
+ * Device id
7
+ */
8
+ deviceId: string;
9
+ /**
10
+ * Login password
11
+ */
12
+ pwd?: string;
13
+ /**
14
+ * Service device id
15
+ */
16
+ serviceDeviceId?: string;
17
+ /**
18
+ * Service id
19
+ */
20
+ serviceId?: number;
21
+ /**
22
+ * Service Uid
23
+ */
24
+ serviceUid?: string;
25
+ /**
26
+ * Time zone
27
+ */
28
+ timezone?: string;
29
+ };
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -0,0 +1 @@
1
+ export {};