@etsoo/smarterp-core 1.0.0 → 1.0.2

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 (217) hide show
  1. package/__tests__/OrgApi.ts +6 -3
  2. package/__tests__/PublicApi.ts +3 -1
  3. package/__tests__/UserApi.ts +1 -1
  4. package/__tests__/tsconfig.json +12 -10
  5. package/lib/cjs/AppApi.d.ts +59 -1
  6. package/lib/cjs/AppApi.js +64 -1
  7. package/lib/cjs/AuthCodeApi.d.ts +29 -0
  8. package/lib/cjs/AuthCodeApi.js +50 -0
  9. package/lib/cjs/CoreApp.d.ts +116 -10
  10. package/lib/cjs/CoreApp.js +72 -6
  11. package/lib/cjs/CoreUtils.d.ts +4 -0
  12. package/lib/cjs/CoreUtils.js +2 -0
  13. package/lib/cjs/ICoreServiceApp.d.ts +30 -0
  14. package/lib/cjs/ICoreServiceApp.js +49 -0
  15. package/lib/cjs/MemberApi.d.ts +41 -1
  16. package/lib/cjs/MemberApi.js +46 -0
  17. package/lib/cjs/OrgApi.d.ts +9 -2
  18. package/lib/cjs/OrgApi.js +12 -3
  19. package/lib/cjs/PublicApi.d.ts +17 -1
  20. package/lib/cjs/PublicApi.js +20 -2
  21. package/lib/cjs/UserApi.d.ts +30 -1
  22. package/lib/cjs/UserApi.js +36 -1
  23. package/lib/cjs/components/DefaultUI.d.ts +21 -0
  24. package/lib/cjs/components/DefaultUI.js +34 -0
  25. package/lib/cjs/components/app/AppSwitchPopover.d.ts +4 -0
  26. package/lib/cjs/components/app/AppSwitchPopover.js +43 -0
  27. package/lib/cjs/components/index.d.ts +4 -0
  28. package/lib/cjs/components/index.js +23 -0
  29. package/lib/cjs/components/org/OrgSwitchPopover.d.ts +4 -0
  30. package/lib/cjs/components/org/OrgSwitchPopover.js +49 -0
  31. package/lib/cjs/components/org/OrgTiplist.d.ts +23 -0
  32. package/lib/cjs/components/org/OrgTiplist.js +28 -0
  33. package/lib/cjs/dto/app/AppQueryData.d.ts +5 -0
  34. package/lib/cjs/dto/app/AppReadDto.d.ts +62 -0
  35. package/lib/cjs/dto/app/AppReadDto.js +2 -0
  36. package/lib/cjs/dto/app/AppUpdateReadDto.d.ts +35 -0
  37. package/lib/cjs/dto/app/AppUpdateReadDto.js +2 -0
  38. package/lib/cjs/dto/app/CreateApiKeyData.d.ts +16 -0
  39. package/lib/cjs/dto/app/CreateApiKeyData.js +2 -0
  40. package/lib/cjs/dto/authCode/AuthCodeAction.d.ts +12 -0
  41. package/lib/cjs/dto/authCode/AuthCodeAction.js +16 -0
  42. package/lib/cjs/dto/member/MemberQueryDto.d.ts +4 -0
  43. package/lib/cjs/dto/member/MemberReadDto.d.ts +56 -0
  44. package/lib/cjs/dto/member/MemberReadDto.js +2 -0
  45. package/lib/cjs/dto/member/MemberUpdateReadDto.d.ts +39 -0
  46. package/lib/cjs/dto/member/MemberUpdateReadDto.js +2 -0
  47. package/lib/cjs/dto/org/OrgListDto.d.ts +7 -1
  48. package/lib/cjs/dto/org/OrgQueryDto.d.ts +8 -0
  49. package/lib/cjs/dto/org/OrgReadDto.d.ts +16 -0
  50. package/lib/cjs/dto/org/OrgUpdateReadDto.d.ts +0 -4
  51. package/lib/cjs/dto/public/MemberInvitationDto.d.ts +29 -0
  52. package/lib/cjs/dto/public/MemberInvitationDto.js +2 -0
  53. package/lib/cjs/dto/user/AuditHistoryDto.d.ts +8 -4
  54. package/lib/cjs/dto/user/UserIdentifierData.d.ts +27 -0
  55. package/lib/cjs/dto/user/UserIdentifierData.js +2 -0
  56. package/lib/cjs/i18n/en.json +40 -2
  57. package/lib/cjs/i18n/zh-Hans.json +40 -2
  58. package/lib/cjs/i18n/zh-Hant.json +40 -2
  59. package/lib/cjs/index.d.ts +22 -0
  60. package/lib/cjs/index.js +22 -0
  61. package/lib/cjs/rq/app/AppBuyNewRQ.d.ts +26 -0
  62. package/lib/cjs/rq/app/AppBuyNewRQ.js +2 -0
  63. package/lib/cjs/rq/app/AppBuyRQ.d.ts +16 -0
  64. package/lib/cjs/rq/app/AppBuyRQ.js +2 -0
  65. package/lib/cjs/rq/app/AppCreateApiKeyRQ.d.ts +16 -0
  66. package/lib/cjs/rq/app/AppCreateApiKeyRQ.js +2 -0
  67. package/lib/cjs/rq/app/AppGetMyRQ.d.ts +1 -1
  68. package/lib/cjs/rq/app/AppRenewRQ.d.ts +16 -0
  69. package/lib/cjs/rq/app/AppRenewRQ.js +2 -0
  70. package/lib/cjs/rq/app/AppUpdateRQ.d.ts +31 -0
  71. package/lib/cjs/rq/app/AppUpdateRQ.js +2 -0
  72. package/lib/cjs/rq/authCode/SendEmailRQ.d.ts +31 -0
  73. package/lib/cjs/rq/authCode/SendEmailRQ.js +2 -0
  74. package/lib/cjs/rq/authCode/SendSMSRQ.d.ts +27 -0
  75. package/lib/cjs/rq/authCode/SendSMSRQ.js +2 -0
  76. package/lib/cjs/rq/authCode/ValidateRQ.d.ts +17 -0
  77. package/lib/cjs/rq/authCode/ValidateRQ.js +2 -0
  78. package/lib/cjs/rq/member/MemberInviteRQ.d.ts +22 -0
  79. package/lib/cjs/rq/member/MemberInviteRQ.js +2 -0
  80. package/lib/cjs/rq/member/MemberUpdateRQ.d.ts +32 -0
  81. package/lib/cjs/rq/member/MemberUpdateRQ.js +2 -0
  82. package/lib/cjs/rq/org/OrgCreateRQ.d.ts +5 -0
  83. package/lib/cjs/rq/public/AcceptInvitationRQ.d.ts +16 -0
  84. package/lib/cjs/rq/public/AcceptInvitationRQ.js +2 -0
  85. package/lib/cjs/rq/user/AuditHistoryRQ.d.ts +8 -0
  86. package/lib/mjs/AppApi.d.ts +59 -1
  87. package/lib/mjs/AppApi.js +64 -1
  88. package/lib/mjs/AuthCodeApi.d.ts +29 -0
  89. package/lib/mjs/AuthCodeApi.js +46 -0
  90. package/lib/mjs/CoreApp.d.ts +116 -10
  91. package/lib/mjs/CoreApp.js +73 -7
  92. package/lib/mjs/CoreUtils.d.ts +4 -0
  93. package/lib/mjs/CoreUtils.js +1 -0
  94. package/lib/mjs/ICoreServiceApp.d.ts +30 -0
  95. package/lib/mjs/ICoreServiceApp.js +41 -0
  96. package/lib/mjs/MemberApi.d.ts +41 -1
  97. package/lib/mjs/MemberApi.js +46 -0
  98. package/lib/mjs/OrgApi.d.ts +9 -2
  99. package/lib/mjs/OrgApi.js +12 -3
  100. package/lib/mjs/PublicApi.d.ts +17 -1
  101. package/lib/mjs/PublicApi.js +20 -2
  102. package/lib/mjs/UserApi.d.ts +30 -1
  103. package/lib/mjs/UserApi.js +36 -1
  104. package/lib/mjs/components/DefaultUI.d.ts +21 -0
  105. package/lib/mjs/components/DefaultUI.js +31 -0
  106. package/lib/mjs/components/app/AppSwitchPopover.d.ts +4 -0
  107. package/lib/mjs/components/app/AppSwitchPopover.js +37 -0
  108. package/lib/mjs/components/index.d.ts +4 -0
  109. package/lib/mjs/components/index.js +7 -0
  110. package/lib/mjs/components/org/OrgSwitchPopover.d.ts +4 -0
  111. package/lib/mjs/components/org/OrgSwitchPopover.js +43 -0
  112. package/lib/mjs/components/org/OrgTiplist.d.ts +23 -0
  113. package/lib/mjs/components/org/OrgTiplist.js +25 -0
  114. package/lib/mjs/dto/app/AppQueryData.d.ts +5 -0
  115. package/lib/mjs/dto/app/AppReadDto.d.ts +62 -0
  116. package/lib/mjs/dto/app/AppReadDto.js +1 -0
  117. package/lib/mjs/dto/app/AppUpdateReadDto.d.ts +35 -0
  118. package/lib/mjs/dto/app/AppUpdateReadDto.js +1 -0
  119. package/lib/mjs/dto/app/CreateApiKeyData.d.ts +16 -0
  120. package/lib/mjs/dto/app/CreateApiKeyData.js +1 -0
  121. package/lib/mjs/dto/authCode/AuthCodeAction.d.ts +12 -0
  122. package/lib/mjs/dto/authCode/AuthCodeAction.js +13 -0
  123. package/lib/mjs/dto/member/MemberQueryDto.d.ts +4 -0
  124. package/lib/mjs/dto/member/MemberReadDto.d.ts +56 -0
  125. package/lib/mjs/dto/member/MemberReadDto.js +1 -0
  126. package/lib/mjs/dto/member/MemberUpdateReadDto.d.ts +39 -0
  127. package/lib/mjs/dto/member/MemberUpdateReadDto.js +1 -0
  128. package/lib/mjs/dto/org/OrgListDto.d.ts +7 -1
  129. package/lib/mjs/dto/org/OrgQueryDto.d.ts +8 -0
  130. package/lib/mjs/dto/org/OrgReadDto.d.ts +16 -0
  131. package/lib/mjs/dto/org/OrgUpdateReadDto.d.ts +0 -4
  132. package/lib/mjs/dto/public/MemberInvitationDto.d.ts +29 -0
  133. package/lib/mjs/dto/public/MemberInvitationDto.js +1 -0
  134. package/lib/mjs/dto/user/AuditHistoryDto.d.ts +8 -4
  135. package/lib/mjs/dto/user/UserIdentifierData.d.ts +27 -0
  136. package/lib/mjs/dto/user/UserIdentifierData.js +1 -0
  137. package/lib/mjs/i18n/en.json +40 -2
  138. package/lib/mjs/i18n/zh-Hans.json +40 -2
  139. package/lib/mjs/i18n/zh-Hant.json +40 -2
  140. package/lib/mjs/index.d.ts +22 -0
  141. package/lib/mjs/index.js +22 -0
  142. package/lib/mjs/rq/app/AppBuyNewRQ.d.ts +26 -0
  143. package/lib/mjs/rq/app/AppBuyNewRQ.js +1 -0
  144. package/lib/mjs/rq/app/AppBuyRQ.d.ts +16 -0
  145. package/lib/mjs/rq/app/AppBuyRQ.js +1 -0
  146. package/lib/mjs/rq/app/AppCreateApiKeyRQ.d.ts +16 -0
  147. package/lib/mjs/rq/app/AppCreateApiKeyRQ.js +1 -0
  148. package/lib/mjs/rq/app/AppGetMyRQ.d.ts +1 -1
  149. package/lib/mjs/rq/app/AppRenewRQ.d.ts +16 -0
  150. package/lib/mjs/rq/app/AppRenewRQ.js +1 -0
  151. package/lib/mjs/rq/app/AppUpdateRQ.d.ts +31 -0
  152. package/lib/mjs/rq/app/AppUpdateRQ.js +1 -0
  153. package/lib/mjs/rq/authCode/SendEmailRQ.d.ts +31 -0
  154. package/lib/mjs/rq/authCode/SendEmailRQ.js +1 -0
  155. package/lib/mjs/rq/authCode/SendSMSRQ.d.ts +27 -0
  156. package/lib/mjs/rq/authCode/SendSMSRQ.js +1 -0
  157. package/lib/mjs/rq/authCode/ValidateRQ.d.ts +17 -0
  158. package/lib/mjs/rq/authCode/ValidateRQ.js +1 -0
  159. package/lib/mjs/rq/member/MemberInviteRQ.d.ts +22 -0
  160. package/lib/mjs/rq/member/MemberInviteRQ.js +1 -0
  161. package/lib/mjs/rq/member/MemberUpdateRQ.d.ts +32 -0
  162. package/lib/mjs/rq/member/MemberUpdateRQ.js +1 -0
  163. package/lib/mjs/rq/org/OrgCreateRQ.d.ts +5 -0
  164. package/lib/mjs/rq/public/AcceptInvitationRQ.d.ts +16 -0
  165. package/lib/mjs/rq/public/AcceptInvitationRQ.js +1 -0
  166. package/lib/mjs/rq/user/AuditHistoryRQ.d.ts +8 -0
  167. package/package.json +26 -36
  168. package/src/AppApi.ts +89 -2
  169. package/src/AuthCodeApi.ts +51 -0
  170. package/src/CoreApp.ts +152 -9
  171. package/src/CoreUtils.ts +4 -0
  172. package/src/ICoreServiceApp.ts +62 -0
  173. package/src/MemberApi.ts +61 -2
  174. package/src/OrgApi.ts +13 -3
  175. package/src/PublicApi.ts +24 -1
  176. package/src/UserApi.ts +53 -1
  177. package/src/components/DefaultUI.tsx +37 -0
  178. package/src/components/app/AppSwitchPopover.tsx +83 -0
  179. package/src/components/index.ts +9 -0
  180. package/src/components/org/OrgSwitchPopover.tsx +99 -0
  181. package/src/components/org/OrgTiplist.tsx +69 -0
  182. package/src/dto/app/AppQueryData.ts +6 -0
  183. package/src/dto/app/AppReadDto.ts +75 -0
  184. package/src/dto/app/AppUpdateReadDto.ts +42 -0
  185. package/src/dto/app/CreateApiKeyData.ts +17 -0
  186. package/src/dto/authCode/AuthCodeAction.ts +13 -0
  187. package/src/dto/member/MemberQueryDto.ts +5 -0
  188. package/src/dto/member/MemberReadDto.ts +68 -0
  189. package/src/dto/member/MemberUpdateReadDto.ts +47 -0
  190. package/src/dto/org/OrgListDto.ts +7 -1
  191. package/src/dto/org/OrgQueryDto.ts +10 -0
  192. package/src/dto/org/OrgReadDto.ts +20 -0
  193. package/src/dto/org/OrgUpdateReadDto.ts +0 -5
  194. package/src/dto/public/MemberInvitationDto.ts +34 -0
  195. package/src/dto/user/AuditHistoryDto.ts +9 -4
  196. package/src/dto/user/UserIdentifierData.ts +31 -0
  197. package/src/i18n/en.json +40 -2
  198. package/src/i18n/zh-Hans.json +40 -2
  199. package/src/i18n/zh-Hant.json +40 -2
  200. package/src/index.ts +24 -0
  201. package/src/rq/app/AppBuyNewRQ.ts +29 -0
  202. package/src/rq/app/AppBuyRQ.ts +17 -0
  203. package/src/rq/app/AppCreateApiKeyRQ.ts +17 -0
  204. package/src/rq/app/AppGetMyRQ.ts +1 -1
  205. package/src/rq/app/AppRenewRQ.ts +17 -0
  206. package/src/rq/app/AppUpdateRQ.ts +36 -0
  207. package/src/rq/authCode/SendEmailRQ.ts +36 -0
  208. package/src/rq/authCode/SendSMSRQ.ts +31 -0
  209. package/src/rq/authCode/ValidateRQ.ts +19 -0
  210. package/src/rq/member/MemberInviteRQ.ts +25 -0
  211. package/src/rq/member/MemberUpdateRQ.ts +37 -0
  212. package/src/rq/org/OrgCreateRQ.ts +6 -0
  213. package/src/rq/public/AcceptInvitationRQ.ts +17 -0
  214. package/src/rq/user/AuditHistoryRQ.ts +10 -0
  215. package/tsconfig.cjs.json +4 -3
  216. package/tsconfig.json +5 -4
  217. package/vite.config.mts +12 -0
package/lib/mjs/OrgApi.js CHANGED
@@ -39,6 +39,15 @@ export class OrgApi extends EntityApi {
39
39
  getMy(rq, payload) {
40
40
  return this.api.post(`${this.flag}/GetMy`, rq, payload);
41
41
  }
42
+ /**
43
+ * Leave the organization
44
+ * @param id Organization id
45
+ * @param payload Payload
46
+ * @returns Result
47
+ */
48
+ leave(id, payload) {
49
+ return this.api.post(`${this.flag}/Leave/${id}`, undefined, payload);
50
+ }
42
51
  /**
43
52
  * List
44
53
  * @param rq Request data
@@ -85,14 +94,14 @@ export class OrgApi extends EntityApi {
85
94
  return this.updateBase(rq, payload);
86
95
  }
87
96
  /**
88
- * Upload avatar
97
+ * Update avatar
89
98
  * @param id Organization id
90
99
  * @param data Avatar form data
91
100
  * @param payload Payload
92
101
  * @returns Result
93
102
  */
94
- uploadAvatar(id, data, payload) {
95
- return this.api.put(`${this.flag}/UploadAvatar/${id}`, data, payload);
103
+ updateAvatar(id, data, payload) {
104
+ return this.api.put(`${this.flag}/UpdateAvatar/${id}`, data, payload);
96
105
  }
97
106
  /**
98
107
  * Update read
@@ -6,7 +6,9 @@ import { CurrencyItem } from "./dto/public/CurrencyItem";
6
6
  import { RegionData } from "./dto/public/RegionData";
7
7
  import { PlaceQueryRQ } from "./rq/public/PlaceQueryRQ";
8
8
  import { PlaceCommon } from "./dto/public/PlaceCommon";
9
- import { BaseApi, Currency, IApp, ProductUnit } from "@etsoo/appscript";
9
+ import { BaseApi, Currency, IApp, ProductUnit, ResultPayload } from "@etsoo/appscript";
10
+ import { MemberInvitationDto } from "./dto/public/MemberInvitationDto";
11
+ import { AcceptInvitationRQ } from "./rq/public/AcceptInvitationRQ";
10
12
  /**
11
13
  * Public API
12
14
  * 公共接口
@@ -18,6 +20,13 @@ export declare class PublicApi extends BaseApi {
18
20
  * @param api API
19
21
  */
20
22
  constructor(app: IApp, api?: IApi);
23
+ /**
24
+ * Accept invitation
25
+ * @param rq Request data
26
+ * @param payload Payload
27
+ * @returns Result
28
+ */
29
+ acceptInvitation(rq: AcceptInvitationRQ, payload?: ResultPayload): Promise<import("@etsoo/shared").IActionResult<{}> | undefined>;
21
30
  /**
22
31
  * Create barcode
23
32
  * @param rq Request data
@@ -75,6 +84,13 @@ export declare class PublicApi extends BaseApi {
75
84
  * @returns Result
76
85
  */
77
86
  queryPlace(rq: PlaceQueryRQ, payload?: IApiPayload<PlaceCommon[]>): Promise<PlaceCommon[] | undefined>;
87
+ /**
88
+ * Read member invitation
89
+ * @param id Id
90
+ * @param payload Payload
91
+ * @returns Result
92
+ */
93
+ readInvitation(id: string, payload?: IApiPayload<MemberInvitationDto>): Promise<MemberInvitationDto | undefined>;
78
94
  /**
79
95
  *
80
96
  * Get all repeat options
@@ -14,6 +14,15 @@ export class PublicApi extends BaseApi {
14
14
  constructor(app, api = app.api) {
15
15
  super(app, api);
16
16
  }
17
+ /**
18
+ * Accept invitation
19
+ * @param rq Request data
20
+ * @param payload Payload
21
+ * @returns Result
22
+ */
23
+ acceptInvitation(rq, payload) {
24
+ return this.api.post("Public/AcceptInvitation", rq, payload);
25
+ }
17
26
  /**
18
27
  * Create barcode
19
28
  * @param rq Request data
@@ -100,6 +109,15 @@ export class PublicApi extends BaseApi {
100
109
  queryPlace(rq, payload) {
101
110
  return this.api.post("Public/QueryPlace", rq, payload);
102
111
  }
112
+ /**
113
+ * Read member invitation
114
+ * @param id Id
115
+ * @param payload Payload
116
+ * @returns Result
117
+ */
118
+ readInvitation(id, payload) {
119
+ return this.api.get(`Public/ReadInvitation/${id}`, undefined, payload);
120
+ }
103
121
  /**
104
122
  *
105
123
  * Get all repeat options
@@ -108,7 +126,7 @@ export class PublicApi extends BaseApi {
108
126
  * @returns Result
109
127
  */
110
128
  repeatOptions(options, isJoined = true) {
111
- options ?? (options = DataTypes.getEnumKeys(RepeatOption));
129
+ options ??= DataTypes.getEnumKeys(RepeatOption);
112
130
  return this.units(options, isJoined);
113
131
  }
114
132
  /**
@@ -127,7 +145,7 @@ export class PublicApi extends BaseApi {
127
145
  * @returns Units
128
146
  */
129
147
  units(options, isJoined) {
130
- options ?? (options = DataTypes.getEnumKeys(ProductUnit));
148
+ options ??= DataTypes.getEnumKeys(ProductUnit);
131
149
  return options.map((key) => {
132
150
  const id = DataTypes.getEnumByKey(ProductUnit, key);
133
151
  return {
@@ -1,9 +1,11 @@
1
- import { EntityApi, IApp, MsgResultPayload, QueryRQ } from "@etsoo/appscript";
1
+ import { EntityApi, IApp, IdResultPayload, MsgResultPayload, QueryRQ, ResultPayload } from "@etsoo/appscript";
2
2
  import { IApi, IApiPayload } from "@etsoo/restclient";
3
3
  import { DeviceListDto } from "./dto/user/DeviceListDto";
4
4
  import { AuditHistoryRQ } from "./rq/user/AuditHistoryRQ";
5
5
  import { AuditHistoryDto } from "./dto/user/AuditHistoryDto";
6
6
  import { AppData } from "./dto/app/AppData";
7
+ import { UserIdentifierData } from "./dto/user/UserIdentifierData";
8
+ import { ValidateRQ } from "./rq/authCode/ValidateRQ";
7
9
  /**
8
10
  * User API
9
11
  * 用户接口
@@ -15,6 +17,26 @@ export declare class UserApi extends EntityApi {
15
17
  * @param api API
16
18
  */
17
19
  constructor(app: IApp, api?: IApi);
20
+ /**
21
+ * Add email
22
+ * @param rq Request data
23
+ * @param payload Payload
24
+ * @returns Result
25
+ */
26
+ addEmail(rq: ValidateRQ, payload?: ResultPayload): Promise<import("@etsoo/shared").IActionResult<{}> | undefined>;
27
+ /**
28
+ * Add mobile
29
+ * @param rq Request data
30
+ * @param payload Payload
31
+ * @returns Result
32
+ */
33
+ addMobile(rq: ValidateRQ, payload?: ResultPayload): Promise<import("@etsoo/shared").IActionResult<{}> | undefined>;
34
+ /**
35
+ * Get all user identifiers
36
+ * @param payload Payload
37
+ * @returns Result
38
+ */
39
+ allIdentifiers(payload?: IApiPayload<UserIdentifierData[]>): Promise<UserIdentifierData[] | undefined>;
18
40
  /**
19
41
  * Audit history
20
42
  * @param rq Request data
@@ -22,6 +44,13 @@ export declare class UserApi extends EntityApi {
22
44
  * @returns Result
23
45
  */
24
46
  auditHistory(rq: AuditHistoryRQ, payload?: IApiPayload<AuditHistoryDto[]>): Promise<AuditHistoryDto[] | undefined>;
47
+ /**
48
+ * Delete user identifier
49
+ * @param id Identifier id
50
+ * @param payload Payload
51
+ * @returns Result
52
+ */
53
+ deleteIdentifier(id: number, payload?: IdResultPayload): Promise<import("@etsoo/shared").IdActionResult | undefined>;
25
54
  /**
26
55
  * Device list
27
56
  * @param rq Request data
@@ -12,6 +12,32 @@ export class UserApi extends EntityApi {
12
12
  constructor(app, api = app.api) {
13
13
  super("User", app, api);
14
14
  }
15
+ /**
16
+ * Add email
17
+ * @param rq Request data
18
+ * @param payload Payload
19
+ * @returns Result
20
+ */
21
+ addEmail(rq, payload) {
22
+ return this.api.post(`${this.flag}/AddEmail`, rq, payload);
23
+ }
24
+ /**
25
+ * Add mobile
26
+ * @param rq Request data
27
+ * @param payload Payload
28
+ * @returns Result
29
+ */
30
+ addMobile(rq, payload) {
31
+ return this.api.post(`${this.flag}/AddMobile`, rq, payload);
32
+ }
33
+ /**
34
+ * Get all user identifiers
35
+ * @param payload Payload
36
+ * @returns Result
37
+ */
38
+ allIdentifiers(payload) {
39
+ return this.api.post(`${this.flag}/AllIdentifiers`, undefined, payload);
40
+ }
15
41
  /**
16
42
  * Audit history
17
43
  * @param rq Request data
@@ -21,6 +47,15 @@ export class UserApi extends EntityApi {
21
47
  auditHistory(rq, payload) {
22
48
  return this.api.post(`${this.flag}/AuditHistory`, rq, payload);
23
49
  }
50
+ /**
51
+ * Delete user identifier
52
+ * @param id Identifier id
53
+ * @param payload Payload
54
+ * @returns Result
55
+ */
56
+ deleteIdentifier(id, payload) {
57
+ return this.api.delete(`${this.flag}/DeleteIdentifier/${id}`, undefined, payload);
58
+ }
24
59
  /**
25
60
  * Device list
26
61
  * @param rq Request data
@@ -55,7 +90,7 @@ export class UserApi extends EntityApi {
55
90
  * @returns Result
56
91
  */
57
92
  updateAvatar(data, payload) {
58
- payload ?? (payload = { config: {} });
93
+ payload ??= { config: {} };
59
94
  // Credentials for anti-forgery cookie sending
60
95
  if (payload.config && payload.config.credentials == null)
61
96
  payload.config.credentials = "include";
@@ -0,0 +1,21 @@
1
+ import type { CommonPageProps, ResponsePageProps } from "@etsoo/materialui";
2
+ /**
3
+ * Default UI namespace
4
+ */
5
+ export declare namespace DefaultUI {
6
+ /**
7
+ * Create response page props
8
+ * @param page Page props
9
+ * @returns Response page props
10
+ */
11
+ function createProps(page: CommonPageProps): Pick<ResponsePageProps<any, any>, "adjustHeight" | "searchBarTop" | "pageProps">;
12
+ /**
13
+ * Widths of icon columns
14
+ */
15
+ const Widths: {
16
+ icon1: number;
17
+ icon2: number;
18
+ icon3: number;
19
+ icon4: number;
20
+ };
21
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Default UI namespace
3
+ */
4
+ export var DefaultUI;
5
+ (function (DefaultUI) {
6
+ /**
7
+ * Create response page props
8
+ * @param page Page props
9
+ * @returns Response page props
10
+ */
11
+ function createProps(page) {
12
+ return {
13
+ adjustHeight: 24,
14
+ searchBarTop: true,
15
+ pageProps: {
16
+ paddings: 0,
17
+ ...page
18
+ }
19
+ };
20
+ }
21
+ DefaultUI.createProps = createProps;
22
+ /**
23
+ * Widths of icon columns
24
+ */
25
+ DefaultUI.Widths = {
26
+ icon1: 88,
27
+ icon2: 120,
28
+ icon3: 152,
29
+ icon4: 184
30
+ };
31
+ })(DefaultUI || (DefaultUI = {}));
@@ -0,0 +1,4 @@
1
+ export type AppSwitchPopoverProps = {
2
+ appName: string;
3
+ };
4
+ export declare function AppSwitchPopover(props: AppSwitchPopoverProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { Button, Stack, Typography } from "@mui/material";
4
+ import { useNavigate } from "react-router-dom";
5
+ import { ButtonPopover } from "@etsoo/materialui";
6
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
7
+ import { IdentityType } from "../../dto/IdentityType";
8
+ export function AppSwitchPopover(props) {
9
+ // Destruct
10
+ const { appName } = props;
11
+ // Route
12
+ const navigate = useNavigate();
13
+ // App
14
+ const app = useRequiredAppContext();
15
+ // Labels
16
+ const labels = app.getLabels("more", "switchApp");
17
+ // Max items to read
18
+ const maxItems = 10;
19
+ // Current app
20
+ const currentApp = app.settings.appId;
21
+ // Layout
22
+ return (_jsx(ButtonPopover, { button: (callback) => (_jsx(Typography, { variant: "h6", sx: {
23
+ color: (theme) => theme.palette.primary.main,
24
+ fontWeight: "700",
25
+ ml: 0.5,
26
+ whiteSpace: "nowrap",
27
+ cursor: "pointer"
28
+ }, title: labels.switchApp, onClick: (e) => callback(e.currentTarget), children: appName })), loadData: () => app.core.appApi.getMy({ maxItems, identityType: IdentityType.User }, { showLoading: false }), position: "left", children: (data) => {
29
+ if (data == null)
30
+ return _jsx(React.Fragment, {});
31
+ // Remove the current app
32
+ const index = data.findIndex((a) => a.id === currentApp);
33
+ if (index >= 0)
34
+ data.splice(index, 1);
35
+ return (_jsxs(Stack, { direction: "column", margin: 2, children: [data.map((appData) => (_jsx(Button, { onClick: async () => { }, children: app.core.getAppName(appData) }, appData.id))), (data.length === 0 || data.length === maxItems) && (_jsxs(Button, { onClick: () => navigate("./app/my"), children: [labels.more, "..."] }))] }));
36
+ } }));
37
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./DefaultUI";
2
+ export * from "./app/AppSwitchPopover";
3
+ export * from "./org/OrgSwitchPopover";
4
+ export * from "./org/OrgTiplist";
@@ -0,0 +1,7 @@
1
+ // Components
2
+ export * from "./DefaultUI";
3
+ // app
4
+ export * from "./app/AppSwitchPopover";
5
+ // org
6
+ export * from "./org/OrgSwitchPopover";
7
+ export * from "./org/OrgTiplist";
@@ -0,0 +1,4 @@
1
+ export type OrgSwitchPopoverProps = {
2
+ organizationName?: string;
3
+ };
4
+ export declare function OrgSwitchPopover(props: OrgSwitchPopoverProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { Button, ButtonGroup, Stack } from "@mui/material";
4
+ import AccountTreeIcon from "@mui/icons-material/AccountTree";
5
+ import { useNavigate } from "react-router-dom";
6
+ import { ButtonPopover } from "@etsoo/materialui";
7
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
8
+ export function OrgSwitchPopover(props) {
9
+ // Destruct
10
+ const { organizationName } = props;
11
+ // Route
12
+ const navigate = useNavigate();
13
+ // App
14
+ const app = useRequiredAppContext();
15
+ // Labels
16
+ const labels = app.getLabels("currentOrg", "more", "switchOrg");
17
+ // Refs
18
+ const anchorRef = React.useRef(null);
19
+ // Max items to read
20
+ const maxItems = 10;
21
+ // Current organization
22
+ const currentOrg = app.userData?.organization;
23
+ // Layout
24
+ return (_jsx(ButtonPopover, { button: (callback) => (_jsx(React.Fragment, { children: _jsxs(ButtonGroup, { variant: "text", children: [_jsx(Button, { sx: { display: { xs: "none", md: "block" } }, title: labels.currentOrg, onClick: () => callback(anchorRef.current), children: organizationName ?? labels.switchOrg }), _jsx(Button, { title: labels.switchOrg, onClick: (e) => callback(e.currentTarget), ref: anchorRef, children: _jsx(AccountTreeIcon, {}) })] }) })), loadData: () => app.core.orgApi.getMy({ maxItems }, { showLoading: false }), children: (data) => {
25
+ if (data == null)
26
+ return _jsx(React.Fragment, {});
27
+ // Remove the current organization
28
+ if (currentOrg != null) {
29
+ const index = data.findIndex((org) => org.id === currentOrg);
30
+ if (index >= 0)
31
+ data.splice(index, 1);
32
+ }
33
+ return (_jsxs(Stack, { direction: "column", margin: 2, children: [data.map((org) => (_jsx(Button, { onClick: async () => {
34
+ const result = await app.switchOrg(org.id);
35
+ if (result == null)
36
+ return;
37
+ if (!result.ok) {
38
+ app.alertResult(result);
39
+ return;
40
+ }
41
+ }, children: org.name }, org.id))), (data.length === 0 || data.length === maxItems) && (_jsxs(Button, { onClick: () => navigate("./org/my"), children: [labels.more, "..."] }))] }));
42
+ } }));
43
+ }
@@ -0,0 +1,23 @@
1
+ import { TiplistProps } from "@etsoo/materialui";
2
+ import { OrgListDto } from "../../dto/org/OrgListDto";
3
+ /**
4
+ * Organization tiplist properties
5
+ * 机构提示列表属性
6
+ */
7
+ export type OrgTiplistProps = Omit<TiplistProps<OrgListDto, "id">, "loadData" | "label" | "name"> & {
8
+ /**
9
+ * Label
10
+ */
11
+ label?: string;
12
+ /**
13
+ * Name
14
+ */
15
+ name?: string;
16
+ };
17
+ /**
18
+ * Organization tiplist
19
+ * 机构提示列表
20
+ * @param props Properties
21
+ * @returns Component
22
+ */
23
+ export declare function OrgTiplist(props: OrgTiplistProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Tiplist } from "@etsoo/materialui";
3
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
4
+ /**
5
+ * Organization tiplist
6
+ * 机构提示列表
7
+ * @param props Properties
8
+ * @returns Component
9
+ */
10
+ export function OrgTiplist(props) {
11
+ // App
12
+ const app = useRequiredAppContext();
13
+ // Destruct
14
+ const { fullWidth = true, label = app.get("org"), maxItems = 10, getOptionLabel = (data) => data.name + "(" + data.pin + ")", name = "organizationId", ...rest } = props;
15
+ // Layout
16
+ return (_jsx(Tiplist, { label: label, getOptionLabel: getOptionLabel, name: name, fullWidth: fullWidth, maxItems: maxItems, loadData: (keyword, id, maxItems) => app.core.orgApi.list({
17
+ enabled: true,
18
+ keyword,
19
+ id,
20
+ queryPaging: {
21
+ batchSize: maxItems,
22
+ orderBy: [{ field: "CoreOrganization.Name" }]
23
+ }
24
+ }, { showLoading: false, defaultValue: [] }), ...rest }));
25
+ }
@@ -14,6 +14,11 @@ export type AppQueryData = {
14
14
  * 名称
15
15
  */
16
16
  name: string;
17
+ /**
18
+ * Local name
19
+ * 本地名称
20
+ */
21
+ localName?: string;
17
22
  /**
18
23
  * Identity type
19
24
  * 身份类型
@@ -0,0 +1,62 @@
1
+ import { EntityStatus } from "@etsoo/appscript";
2
+ import { IdentityType } from "../IdentityType";
3
+ /**
4
+ * App read data
5
+ * 应用读取数据
6
+ */
7
+ export type AppReadDto = {
8
+ /**
9
+ * Id
10
+ */
11
+ id: number;
12
+ /**
13
+ * App global name
14
+ */
15
+ name: string;
16
+ /**
17
+ * Global app id
18
+ */
19
+ appId: number;
20
+ /**
21
+ * App key
22
+ */
23
+ appKey?: string;
24
+ /**
25
+ * Local name
26
+ */
27
+ localName?: string;
28
+ /**
29
+ * Local URL
30
+ */
31
+ localUrl?: string;
32
+ /**
33
+ * Local help URL
34
+ */
35
+ localHelpUrl?: string;
36
+ /**
37
+ * Local APIs
38
+ */
39
+ localApis?: string[];
40
+ /**
41
+ * Expiry
42
+ */
43
+ expiry?: Date | string;
44
+ /**
45
+ * Expiry days
46
+ */
47
+ expiryDays?: number;
48
+ /**
49
+ * Identity type
50
+ * 身份类型
51
+ */
52
+ identityType: IdentityType;
53
+ /**
54
+ * Status
55
+ */
56
+ status: EntityStatus;
57
+ /**
58
+ * Creation
59
+ * 创建时间
60
+ */
61
+ creation: string | Date;
62
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ import { EntityStatus } from "@etsoo/appscript";
2
+ /**
3
+ * App read for update data
4
+ * 应用更新数据
5
+ */
6
+ export type AppUpdateReadDto = {
7
+ /**
8
+ * Id
9
+ */
10
+ id: number;
11
+ /**
12
+ * App global name
13
+ */
14
+ name: string;
15
+ /**
16
+ * Local name
17
+ */
18
+ localName?: string;
19
+ /**
20
+ * Local URL
21
+ */
22
+ localUrl?: string;
23
+ /**
24
+ * Local help URL
25
+ */
26
+ localHelpUrl?: string;
27
+ /**
28
+ * Local APIs
29
+ */
30
+ localApis?: string[];
31
+ /**
32
+ * Status
33
+ */
34
+ status: EntityStatus;
35
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Result of creating an API key
3
+ * 创建API密钥结果
4
+ */
5
+ export type CreateApiKeyData = {
6
+ /**
7
+ * App key
8
+ * 应用键
9
+ */
10
+ appKey: string;
11
+ /**
12
+ * App secret
13
+ * 应用密钥
14
+ */
15
+ appSecret: string;
16
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Enum for auth code action
3
+ */
4
+ export declare enum AuthCodeAction {
5
+ UserRegistrationSMSCode = 1,
6
+ UserRegistrationEmailCode = 2,
7
+ UserCallbackSMSCode = 3,
8
+ UserCallbackEmailCode = 4,
9
+ UserVerificationSMSCode = 5,
10
+ UserVerificationEmailCode = 6,
11
+ MemberInvitationEmailCode = 20
12
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Enum for auth code action
3
+ */
4
+ export var AuthCodeAction;
5
+ (function (AuthCodeAction) {
6
+ AuthCodeAction[AuthCodeAction["UserRegistrationSMSCode"] = 1] = "UserRegistrationSMSCode";
7
+ AuthCodeAction[AuthCodeAction["UserRegistrationEmailCode"] = 2] = "UserRegistrationEmailCode";
8
+ AuthCodeAction[AuthCodeAction["UserCallbackSMSCode"] = 3] = "UserCallbackSMSCode";
9
+ AuthCodeAction[AuthCodeAction["UserCallbackEmailCode"] = 4] = "UserCallbackEmailCode";
10
+ AuthCodeAction[AuthCodeAction["UserVerificationSMSCode"] = 5] = "UserVerificationSMSCode";
11
+ AuthCodeAction[AuthCodeAction["UserVerificationEmailCode"] = 6] = "UserVerificationEmailCode";
12
+ AuthCodeAction[AuthCodeAction["MemberInvitationEmailCode"] = 20] = "MemberInvitationEmailCode";
13
+ })(AuthCodeAction || (AuthCodeAction = {}));
@@ -28,6 +28,10 @@ export type MemberQueryDto = {
28
28
  * Is owner
29
29
  */
30
30
  isOwner: boolean;
31
+ /**
32
+ * Is editable
33
+ */
34
+ isEditable: boolean;
31
35
  /**
32
36
  * Creation
33
37
  */