@jctrans-materials/shared 1.0.22 → 1.0.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jctrans-materials/shared",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "private": false,
5
5
  "description": "Shared logic for global modal components.",
6
6
  "main": "dist/index.cjs.js",
@@ -1,8 +0,0 @@
1
- export type ReportType = "City" | "Seaport" | "Airport" | "Line";
2
- export interface reportNewTypeData {
3
- reportData: string;
4
- reportType: ReportType;
5
- countryId?: string | number;
6
- }
7
- declare function reportNewTypeDataApi(payload: reportNewTypeData): Promise<{}>;
8
- export { reportNewTypeDataApi };
@@ -1,227 +0,0 @@
1
- import { ApiResponse, IResponse, LoginDataParams, LoginResponseData, ThirdResponseData } from './type';
2
- /**
3
- * 验证账号是否存在 /auth/validateAccountExist
4
- * @param data
5
- * @returns
6
- */
7
- export declare function validateAccountExistApi(data: {
8
- target: string;
9
- }): Promise<any>;
10
- /**
11
- * 发送邮箱验证码
12
- * @param data
13
- * @returns
14
- */
15
- export declare function sendEmailCodeApi(data: {
16
- target: string;
17
- countryId?: number;
18
- account?: string;
19
- uuid?: string;
20
- }): Promise<any>;
21
- /**
22
- * 发送手机验证码
23
- * @param data
24
- * @returns
25
- */
26
- export declare function sendMobileCodeApi(data: {
27
- target: string;
28
- countryId?: number;
29
- account?: string;
30
- uuid?: string;
31
- }): Promise<any>;
32
- /**
33
- * 验证邮件验证码
34
- * @param data
35
- * @returns
36
- */
37
- export declare function checkEmailCodeApi(data: {
38
- uuid: string;
39
- code: string;
40
- target: string;
41
- }): Promise<any>;
42
- /**
43
- * 验证手机验证码
44
- * @param data
45
- * @returns
46
- */
47
- export declare function checkMobileCodeApi(data: {
48
- code: string;
49
- uuid: string;
50
- target: string;
51
- }): Promise<any>;
52
- /**
53
- * 校验注册公司是否重名
54
- * @param data
55
- * @returns
56
- */
57
- export declare function validateCompanyApi(data: {
58
- countryId: number;
59
- cityId: number;
60
- compNameCn?: string;
61
- compNameEn?: string;
62
- }): Promise<any>;
63
- /**
64
- * 用户注册加入公司
65
- * @param data
66
- * @returns
67
- */
68
- export declare function registerJoinCompanyApi(data: any): Promise<any>;
69
- /**
70
- * 第三方应用注册加入公司
71
- * @param data
72
- * @returns
73
- */
74
- export declare function registerJoinCompByThirdPartyApi(data: any): Promise<any>;
75
- /**
76
- * 获取用户加入公司信息
77
- * @param data
78
- * @returns
79
- */
80
- export declare function getJoinCompanyApi(data: any): Promise<any>;
81
- /**
82
- * 跳转其他站
83
- * @param appId
84
- * @param path
85
- * @returns
86
- */
87
- export declare function getRedirectPathApi(appId: string, path: string): Promise<any>;
88
- /**
89
- * 国际站峰会注册
90
- * @param data
91
- * @returns
92
- */
93
- export declare function registerApi(data: any): Promise<any>;
94
- /**
95
- * 微信二维码登录注册用户公司
96
- * @param data
97
- * @returns
98
- */
99
- export declare function registerUserCompBindWechatApi(data: any): Promise<any>;
100
- /**
101
- * 微信二维码登录用户注册加入公司 🍉
102
- * @param data
103
- * @returns
104
- */
105
- export declare function registerJoinCompanyBindWechatApi(data: any): Promise<any>;
106
- /**
107
- * 微信二维码登录绑定用户(账号密码)
108
- * @param data
109
- * @returns
110
- */
111
- export declare function loginPwdBindWechatApi(data: any): Promise<any>;
112
- /**
113
- * 微信二维码登录绑定用户(验证码)
114
- * @param data
115
- * @returns
116
- */
117
- export declare function loginCodeBindWechatApi(data: any): Promise<any>;
118
- export declare function loginApi(loginData: LoginDataParams): Promise<IResponse<ApiResponse<LoginResponseData>>>;
119
- /**
120
- * 验证码登录注册
121
- * @param data
122
- * @returns
123
- */
124
- export declare function loginByEmailOrMobileCodeApi(data: any): Promise<IResponse<ApiResponse<LoginResponseData>>>;
125
- /**
126
- * 微信二维码登录(1s轮询)
127
- * @param data
128
- * @returns
129
- */
130
- export declare function loginByQrCode(data: {
131
- uniqueCode: string;
132
- appId: string;
133
- redirectPath: string;
134
- kick: boolean;
135
- }): Promise<any>;
136
- /**
137
- * 获取登录微信二维码
138
- * @param data
139
- * @returns
140
- */
141
- export declare function getLoginQrCode(data?: {}): Promise<any>;
142
- /**
143
- * 1-1-2.TGC自动登录
144
- * @returns
145
- */
146
- export declare function autoLoginByTGC(data: {
147
- toSys: string;
148
- path: string;
149
- tokenId: string;
150
- tgc: string;
151
- }): Promise<any>;
152
- /**
153
- * 完善公司信息跳转
154
- * @param {*} data
155
- * @returns
156
- */
157
- export declare function completeCompRedirectApi(data: any): Promise<any>;
158
- /**
159
- * 完善信息加入公司
160
- * @param data
161
- * @returns
162
- */
163
- export declare function completeJoinCompanyRedirectApi(data: any): Promise<any>;
164
- export declare function checkAccountExistsFPApi(data: any): Promise<any>;
165
- /**
166
- * 忘记密码发送验证码
167
- * @param data
168
- * @returns
169
- */
170
- export declare function getMEVCodeApi(data: any): Promise<any>;
171
- export declare function resetPasswordApi(data: any): Promise<any>;
172
- export declare function loginByFacebookApi(data: any): Promise<IResponse<ApiResponse<ThirdResponseData>>>;
173
- export declare function loginByLinkedinApi(data: any): Promise<IResponse<ApiResponse<ThirdResponseData>>>;
174
- /**
175
- * 验证密码绑定第三方应用
176
- * @param data
177
- * @returns
178
- */
179
- export declare function bindThirdPartyByPwdApi(data: any): Promise<any>;
180
- /**
181
- * 验证验证码绑定第三方应用
182
- * @param data
183
- * @returns
184
- */
185
- export declare function bindThirdPartyByCodeApi(data: any): Promise<any>;
186
- export declare function registerByThirdPartyApi(data: any): Promise<any>;
187
- export declare function findListByMobileEmailApi(data: any): Promise<any>;
188
- /**
189
- * 获取邀请加入公司信息
190
- * @param data
191
- * @returns
192
- */
193
- export declare function inviteJoinGetCompApi(data: any): Promise<any>;
194
- /**
195
- * 全局设置 session
196
- * @param data
197
- */
198
- export declare function setAuthSessionItems(data: {
199
- activityCode?: string | null;
200
- referenceUserId?: string | null;
201
- empNo?: string | null;
202
- uniqueCode?: string | null;
203
- path?: string | null;
204
- clickSource?: string | null;
205
- registerEvent?: string | null;
206
- registerType?: string | null;
207
- compKey?: string | null;
208
- }): void;
209
- /**
210
- * 重置 session
211
- */
212
- export declare function resetAuthSessionItems(): void;
213
- /**
214
- * 全局获取 session
215
- * @returns
216
- */
217
- export declare function getAuthSessionItems(): {
218
- activityCode: string | null;
219
- referenceUserId: string | null;
220
- empNo: string | null;
221
- uniqueCode: string | null;
222
- path: string | null;
223
- clickSource: string | null;
224
- registerEvent?: string | null;
225
- registerType?: string | null;
226
- compKey?: string | null;
227
- };
@@ -1,161 +0,0 @@
1
- export type DisplayInfo = "Continent" | "Country" | "Province" | "City" | "Seaport" | "Airport";
2
- export type AppointSearchName = "continentId" | "countryId" | "cityId" | "provinceId" | "seaportId" | "airportId" | "allCityByCountryId";
3
- export interface AppointSearch {
4
- name: AppointSearchName;
5
- val: string;
6
- }
7
- export interface CommonParams {
8
- current?: number;
9
- size?: number;
10
- level?: 1 | 2 | 3 | 4;
11
- searchContent?: string;
12
- displayInfo?: DisplayInfo[];
13
- sort?: "nameEn" | string;
14
- appointSearch?: AppointSearch[];
15
- _extra?: Record<string, any>;
16
- }
17
- export interface BaseResponse<T = any> {
18
- records: T[];
19
- total: number;
20
- size: number;
21
- current: number;
22
- pages?: number;
23
- [k: string]: any;
24
- }
25
- /** 归一化之后的实体 */
26
- export interface UnifiedItem {
27
- id: number | string;
28
- type: DisplayInfo;
29
- nameCn?: string;
30
- nameEn?: string;
31
- display?: string;
32
- continent?: Record<string, any>;
33
- country?: Record<string, any>;
34
- city?: Record<string, any>;
35
- province?: Record<string, any>;
36
- raw?: any;
37
- }
38
- /** 通用后端调用(直接回 raw 后端格式) */
39
- declare function rawFetch(params: CommonParams): Promise<BaseResponse<any>>;
40
- /**
41
- * 统一搜索接口
42
- * - 支持 keyword(模糊), displayInfo(数组), ids(按 type), scope(countryId/cityId/provinceId)
43
- * - 返回扁平化的 UnifiedItem 列表 + 分页信息
44
- */
45
- export declare function search(params: {
46
- keyword?: string;
47
- displayInfo?: DisplayInfo[];
48
- page?: number;
49
- size?: number;
50
- level?: 1 | 2 | 3 | 4;
51
- sort?: string;
52
- ids?: {
53
- type: DisplayInfo;
54
- ids: number[];
55
- }[];
56
- scope?: {
57
- countryId?: number;
58
- cityId?: number;
59
- provinceId?: number;
60
- };
61
- extraAppoint?: AppointSearch[];
62
- }): Promise<BaseResponse<UnifiedItem>>;
63
- /**
64
- * 按名称搜索指定类型
65
- */
66
- export declare function searchByName(params: {
67
- keyword: string;
68
- types?: DisplayInfo[];
69
- page?: number;
70
- size?: number;
71
- level?: 1 | 2 | 3 | 4;
72
- sort?: string;
73
- }): Promise<BaseResponse<UnifiedItem>>;
74
- /** 按 type + ids 精确查询(回显/编辑页) */
75
- export declare function getByIds(type: DisplayInfo, ids: number[] | number): Promise<UnifiedItem[]>;
76
- /** 单 id 版本 */
77
- export declare function getById(type: DisplayInfo, id: number): Promise<UnifiedItem | null>;
78
- /** 国家 -> 城市(后端专门支持 allCityByCountryId 口径) */
79
- export declare function getCitiesByCountry(countryId: number, opts?: {
80
- page?: number;
81
- size?: number;
82
- }): Promise<BaseResponse<UnifiedItem>>;
83
- /** 城市 -> 子实体(港口、机场 或 二者) */
84
- export declare function getChildrenByCity(cityId: number, childTypes: Array<"Seaport" | "Airport">, opts?: {
85
- page?: number;
86
- size?: number;
87
- }): Promise<BaseResponse<UnifiedItem>>;
88
- export declare function searchCountryByName(keyword: string, opts?: {
89
- page?: number;
90
- size?: number;
91
- }): Promise<BaseResponse<UnifiedItem>>;
92
- export declare function searchCityByName(keyword: string, opts?: {
93
- page?: number;
94
- size?: number;
95
- countryId?: number;
96
- }): Promise<BaseResponse<UnifiedItem>>;
97
- export declare function searchSeaportByName(keyword: string, opts?: {
98
- page?: number;
99
- size?: number;
100
- cityId?: number;
101
- }): Promise<BaseResponse<UnifiedItem>>;
102
- export declare function searchAirportByName(keyword: string, opts?: {
103
- page?: number;
104
- size?: number;
105
- cityId?: number;
106
- }): Promise<BaseResponse<UnifiedItem>>;
107
- /** 保留对外兼容函数:getContinent/getCountry/getCity/getProvince/getSeaport/getAirport */
108
- export declare function getContinent(params?: {
109
- page?: number;
110
- size?: number;
111
- }): Promise<BaseResponse<UnifiedItem>>;
112
- export declare function getCountry(params?: {
113
- page?: number;
114
- size?: number;
115
- ids?: number[];
116
- }): Promise<BaseResponse<UnifiedItem>>;
117
- export declare function getCity(params?: {
118
- page?: number;
119
- size?: number;
120
- ids?: number[];
121
- countryId?: number;
122
- }): Promise<BaseResponse<UnifiedItem>>;
123
- export declare function getProvince(params?: {
124
- page?: number;
125
- size?: number;
126
- ids?: number[];
127
- countryId?: number;
128
- }): Promise<BaseResponse<UnifiedItem>>;
129
- export declare function getSeaport(params?: {
130
- page?: number;
131
- size?: number;
132
- ids?: number[];
133
- cityId?: number;
134
- countryId?: number;
135
- }): Promise<BaseResponse<UnifiedItem>>;
136
- export declare function getAirport(params?: {
137
- page?: number;
138
- size?: number;
139
- ids?: number[];
140
- cityId?: number;
141
- countryId?: number;
142
- }): Promise<BaseResponse<UnifiedItem>>;
143
- declare const _default: {
144
- search: typeof search;
145
- getByIds: typeof getByIds;
146
- getById: typeof getById;
147
- getCitiesByCountry: typeof getCitiesByCountry;
148
- getChildrenByCity: typeof getChildrenByCity;
149
- searchCountryByName: typeof searchCountryByName;
150
- searchCityByName: typeof searchCityByName;
151
- searchAirportByName: typeof searchAirportByName;
152
- searchSeaportByName: typeof searchSeaportByName;
153
- getBaseData: typeof rawFetch;
154
- getContinent: typeof getContinent;
155
- getCountry: typeof getCountry;
156
- getCity: typeof getCity;
157
- getProvince: typeof getProvince;
158
- getSeaport: typeof getSeaport;
159
- getAirport: typeof getAirport;
160
- };
161
- export default _default;
@@ -1,20 +0,0 @@
1
- export interface CompanyOption {
2
- current: number;
3
- size: number;
4
- compName: string;
5
- }
6
- export declare const getCompanyOptionApi: (data: CompanyOption) => Promise<any>;
7
- export declare function slideGetApi(data: {
8
- clientUid: string;
9
- ts: number;
10
- }): Promise<any>;
11
- export declare function slideCheckApi(data: {
12
- pointJson: string;
13
- uuid: string;
14
- }): Promise<any>;
15
- export declare function findPAreaCodeAPi(data?: {
16
- size: number;
17
- }): Promise<any>;
18
- export declare function findDictAPi(data?: {
19
- size: number;
20
- }): Promise<any>;
@@ -1,273 +0,0 @@
1
- export type LocationType = "Continent" | "Country" | "Region" | "Province" | "City" | "Seaport" | "Airport" | "Street" | "Town" | "Wharf" | "Carrier" | "Line";
2
- export interface LocationUnifiedItem {
3
- id: number | string;
4
- type: LocationType;
5
- nameCn?: string;
6
- nameEn?: string;
7
- display?: string;
8
- displayEn?: string;
9
- displayCn?: string;
10
- /** * 通用代码字段 (自动取 scacCode 或 carrierCode)
11
- * 适用于仅展示用途
12
- */
13
- code?: string;
14
- /** * SCAC 代码 (Standard Carrier Alpha Code) - 通常用于船司
15
- */
16
- scacCode?: string;
17
- /** * IATA 代码 - 通常用于航司
18
- */
19
- iataCode?: string;
20
- /** * 承运人通用代码
21
- */
22
- carrierCode?: string;
23
- /** * 承运人类型: 'air' | 'shipping'
24
- */
25
- lineType?: string;
26
- continent?: Record<string, any>;
27
- country?: Record<string, any>;
28
- city?: Record<string, any>;
29
- province?: Record<string, any>;
30
- raw?: any;
31
- }
32
- export interface PageParams {
33
- current?: number;
34
- size?: number;
35
- }
36
- export interface SearchByNameParams extends PageParams {
37
- keyword: string;
38
- searchMode?: "0" | "1" | "2";
39
- }
40
- export interface SearchWithScopeParams extends SearchByNameParams {
41
- countryId?: number;
42
- cityId?: number;
43
- provinceId?: number;
44
- }
45
- export interface SearchGenericParams extends SearchByNameParams {
46
- displayInfo: LocationType[];
47
- }
48
- interface CarrierRequestPayload {
49
- current: number;
50
- size: number;
51
- lineType: "air" | "shipping";
52
- searchkey?: string;
53
- ids?: number[];
54
- [key: string]: any;
55
- }
56
- interface LineRequestPayload {
57
- current: number;
58
- size: number;
59
- lineType: "air" | "shipping";
60
- searchkey?: string;
61
- ids?: number[];
62
- [key: string]: any;
63
- }
64
- export declare const locationSearchV2: {
65
- SEARCH_VERSION: string;
66
- searchByName: (params: SearchGenericParams) => Promise<{
67
- records: LocationUnifiedItem[];
68
- total: number;
69
- current: number;
70
- size: number;
71
- }>;
72
- searchByIdWithType: (id: number | string | Array<number | string>, type: LocationType, extraParams?: {
73
- lineType?: "air" | "shipping";
74
- }) => Promise<{
75
- records: LocationUnifiedItem[];
76
- total: number;
77
- current: number;
78
- size: number;
79
- }>;
80
- country: {
81
- searchByName: (params: SearchByNameParams) => Promise<{
82
- records: LocationUnifiedItem[];
83
- total: number;
84
- current: number;
85
- size: number;
86
- }>;
87
- getByIds: (ids: number[]) => Promise<{
88
- records: LocationUnifiedItem[];
89
- total: number;
90
- current: number;
91
- size: number;
92
- }>;
93
- };
94
- region: {
95
- searchByName: (params: SearchByNameParams) => Promise<{
96
- records: LocationUnifiedItem[];
97
- total: number;
98
- current: number;
99
- size: number;
100
- }>;
101
- getByIds: (ids: number[]) => Promise<{
102
- records: LocationUnifiedItem[];
103
- total: number;
104
- current: number;
105
- size: number;
106
- }>;
107
- };
108
- city: {
109
- searchByName: (params: SearchWithScopeParams) => Promise<{
110
- records: LocationUnifiedItem[];
111
- total: number;
112
- current: number;
113
- size: number;
114
- }>;
115
- getByIds: (ids: number[]) => Promise<{
116
- records: LocationUnifiedItem[];
117
- total: number;
118
- current: number;
119
- size: number;
120
- }>;
121
- getCitiesByCountry: (countryId: number, params?: PageParams) => Promise<{
122
- records: LocationUnifiedItem[];
123
- total: number;
124
- current: number;
125
- size: number;
126
- }>;
127
- };
128
- seaport: {
129
- searchByName: (params: SearchWithScopeParams) => Promise<{
130
- records: LocationUnifiedItem[];
131
- total: number;
132
- current: number;
133
- size: number;
134
- }>;
135
- getByIds: (ids: number[]) => Promise<{
136
- records: LocationUnifiedItem[];
137
- total: number;
138
- current: number;
139
- size: number;
140
- }>;
141
- };
142
- airport: {
143
- searchByName: (params: SearchWithScopeParams) => Promise<{
144
- records: LocationUnifiedItem[];
145
- total: number;
146
- current: number;
147
- size: number;
148
- }>;
149
- getByIds: (ids: number[]) => Promise<{
150
- records: LocationUnifiedItem[];
151
- total: number;
152
- current: number;
153
- size: number;
154
- }>;
155
- };
156
- wharf: {
157
- getByIds: (ids: string[]) => Promise<{
158
- records: LocationUnifiedItem[];
159
- total: number;
160
- current: number;
161
- size: number;
162
- }>;
163
- };
164
- carrier: {
165
- /**
166
- * 内部私有方法:构建符合 Carrier 接口要求的 payload
167
- */
168
- _buildPayload: (params: Partial<SearchByNameParams> & {
169
- ids?: number[];
170
- }, lineType: "air" | "shipping") => CarrierRequestPayload;
171
- /**
172
- * 搜索船公司 (Shipping Line)
173
- */
174
- searchShipping: (params: SearchByNameParams) => Promise<{
175
- records: LocationUnifiedItem[];
176
- total: number;
177
- current: number;
178
- size: number;
179
- }>;
180
- /**
181
- * 搜索航空公司 (Airline)
182
- */
183
- searchAir: (params: SearchByNameParams) => Promise<{
184
- records: LocationUnifiedItem[];
185
- total: number;
186
- current: number;
187
- size: number;
188
- }>;
189
- /**
190
- * 通用搜索 (需要手动传入 type)
191
- * 场景:如果前端有一个下拉框让用户选类型,则调用此方法
192
- */
193
- search: (params: SearchByNameParams, lineType: "air" | "shipping") => Promise<{
194
- records: LocationUnifiedItem[];
195
- total: number;
196
- current: number;
197
- size: number;
198
- }>;
199
- /**
200
- * 根据 ID 获取详情
201
- * 注意:根据你的 Interface,ID 查询可能也需要传 lineType,
202
- * 默认设为 shipping,或者你需要拆分成两个 ID 方法
203
- */
204
- getByIds: (ids: number[], lineType?: "air" | "shipping") => Promise<{
205
- records: LocationUnifiedItem[];
206
- total: number;
207
- current: number;
208
- size: number;
209
- }>;
210
- };
211
- line: {
212
- /**
213
- * 内部私有方法:构建符合后端要求的 Payload
214
- */
215
- _buildPayload: (params: Partial<SearchByNameParams> & {
216
- ids?: number[];
217
- }, lineType: "air" | "shipping") => LineRequestPayload;
218
- /**
219
- * 搜索海运航线 (Shipping Line)
220
- * 例如:AE1, TP9
221
- */
222
- searchShipping: (params: SearchByNameParams) => Promise<{
223
- records: LocationUnifiedItem[];
224
- total: number;
225
- current: number;
226
- size: number;
227
- }>;
228
- /**
229
- * 搜索空运航线 (Air Line)
230
- * 业务上较少见,但接口支持
231
- */
232
- searchAir: (params: SearchByNameParams) => Promise<{
233
- records: LocationUnifiedItem[];
234
- total: number;
235
- current: number;
236
- size: number;
237
- }>;
238
- /**
239
- * 通用搜索 (需要手动传 lineType)
240
- */
241
- search: (params: SearchByNameParams, lineType: "air" | "shipping") => Promise<{
242
- records: LocationUnifiedItem[];
243
- total: number;
244
- current: number;
245
- size: number;
246
- }>;
247
- /**
248
- * 根据 ID 获取航线详情
249
- * 默认默认为 shipping,如需查空运航线需显式传入
250
- */
251
- getByIds: (ids: number[], lineType?: "air" | "shipping") => Promise<{
252
- records: LocationUnifiedItem[];
253
- total: number;
254
- current: number;
255
- size: number;
256
- }>;
257
- };
258
- /** 获取某个国家下的所有城市 */
259
- getCitiesByCountry: (countryId: number, params?: PageParams) => Promise<{
260
- records: LocationUnifiedItem[];
261
- total: number;
262
- current: number;
263
- size: number;
264
- }>;
265
- /** 获取某个城市下的子实体 */
266
- getChildrenByCity: (cityId: number, childTypes: Array<"Seaport" | "Airport" | "Wharf">, params?: PageParams) => Promise<{
267
- records: LocationUnifiedItem[];
268
- total: number;
269
- current: number;
270
- size: number;
271
- }>;
272
- };
273
- export default locationSearchV2;