@jctrans-materials/shared 1.0.40-beta.11 → 1.0.40-beta.13

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/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { Emitter } from 'mitt';
3
3
 
4
4
  declare type ActionKeys = (typeof MODAL_ACTION)[keyof typeof MODAL_ACTION];
5
5
 
6
+ /** 通用 API 响应结构 (最外层) */
6
7
  export declare interface ApiResponse<T = any> {
7
8
  code: number;
8
9
  msg: string;
@@ -14,8 +15,16 @@ export declare interface AppointSearch {
14
15
  val: string;
15
16
  }
16
17
 
18
+ /** baseSearch 的 appointSearch 条目 */
17
19
  export declare type AppointSearchName = "continentId" | "countryId" | "cityId" | "provinceId" | "seaportId" | "airportId" | "allCityByCountryId";
18
20
 
21
+ /** Auth session key 映射表 */
22
+ declare const AUTH_SESSION_KEYS: Record<string, string>;
23
+
24
+ declare type AuthSessionData = {
25
+ [K in keyof typeof AUTH_SESSION_KEYS]?: string | null;
26
+ };
27
+
19
28
  export declare function autoLoginByTGC(data: {
20
29
  toSys: string;
21
30
  path: string;
@@ -23,6 +32,7 @@ export declare function autoLoginByTGC(data: {
23
32
  tokenId?: string;
24
33
  }): Promise<any>;
25
34
 
35
+ /** 分页响应结构 */
26
36
  export declare interface BaseResponse<T = any> {
27
37
  records: T[];
28
38
  total: number;
@@ -41,16 +51,7 @@ export declare function bindThirdPartyByCodeApi(data: any): Promise<any>;
41
51
 
42
52
  export declare function bindThirdPartyByPwdApi(data: any): Promise<any>;
43
53
 
44
- declare interface CarrierRequestPayload {
45
- current: number;
46
- size: number;
47
- lineType: "air" | "shipping";
48
- searchkey?: string;
49
- ids?: number[];
50
- [key: string]: any;
51
- }
52
-
53
- export declare function checkAccountExistsFPApi(data: any): Promise<any>;
54
+ export declare function checkAccountExistsFPApi(data: ForgotPasswordAccountData): Promise<any>;
54
55
 
55
56
  export declare function checkEmailCodeApi(data: {
56
57
  uuid: string;
@@ -78,9 +79,6 @@ export declare interface ClientIdPluginOptions {
78
79
  headerName?: string;
79
80
  }
80
81
 
81
- /**
82
- * 2. 可配置的常量定义
83
- */
84
82
  export declare interface CommonKeysConfig {
85
83
  TokenKey: string;
86
84
  HasLoginKey: string;
@@ -94,6 +92,7 @@ export declare interface CommonKeysConfig {
94
92
  RememberMePasswordKey: string;
95
93
  }
96
94
 
95
+ /** baseSearch 的通用请求参数 */
97
96
  export declare interface CommonParams {
98
97
  current?: number;
99
98
  size?: number;
@@ -149,28 +148,31 @@ export declare const currentConfig: {
149
148
  readonly appId: string | undefined;
150
149
  };
151
150
 
151
+ /** 兼容旧名 */
152
+ export declare const Decrypt: typeof decrypt;
153
+
152
154
  /**
153
- * 解密方法
154
- * @param word
155
- * @returns
155
+ * 解密
156
156
  */
157
- export declare function Decrypt(word: string): string;
157
+ export declare function decrypt(word: string): string;
158
158
 
159
159
  /**
160
160
  * 设备 ID 回调
161
161
  */
162
162
  export declare type DeviceIdCallback = (deviceId: string) => void;
163
163
 
164
- export declare type DisplayInfo = "Continent" | "Country" | "Region" | "Province" | "City" | "Seaport" | "Airport";
164
+ /** 兼容旧名:baseSearch.DisplayInfo */
165
+ export declare type DisplayInfo = LocationType;
165
166
 
166
167
  export declare const emitter: Emitter<ModalEvents>;
167
168
 
169
+ /** 兼容旧名 */
170
+ export declare const Encrypt: typeof encrypt;
171
+
168
172
  /**
169
- * 加密方法
170
- * @param word
171
- * @returns
173
+ * 加密
172
174
  */
173
- export declare function Encrypt(word: string): string;
175
+ export declare function encrypt(word: string): string;
174
176
 
175
177
  export declare const ExpiresInKey: string;
176
178
 
@@ -191,26 +193,30 @@ export declare interface FetchClientIdOptions {
191
193
  injectRequest?: boolean;
192
194
  }
193
195
 
194
- /**
195
- * 获取字典列表
196
- * @param data
197
- * @returns
198
- */
199
196
  export declare function findDictApi(data?: {
200
197
  size: number;
201
198
  }): Promise<any>;
202
199
 
203
200
  export declare function findListByMobileEmailApi(data: any): Promise<any>;
204
201
 
205
- /**
206
- * 查询区号列表
207
- * @param data
208
- * @returns
209
- */
210
202
  export declare function findPAreaCodeApi(data?: {
211
203
  size: number;
212
204
  }): Promise<any>;
213
205
 
206
+ declare interface ForgotPasswordAccountData {
207
+ account?: string;
208
+ email?: string;
209
+ mobile?: string;
210
+ [key: string]: any;
211
+ }
212
+
213
+ declare interface ForgotPasswordVerifyData {
214
+ account?: string;
215
+ code?: string;
216
+ uuid?: string;
217
+ [key: string]: any;
218
+ }
219
+
214
220
  /**
215
221
  * ClientId 管理工具
216
222
  * 用于生成和管理唯一的客户端标识符
@@ -223,30 +229,19 @@ export declare function findPAreaCodeApi(data?: {
223
229
  */
224
230
  export declare function generateClientId(): string;
225
231
 
226
- export declare function getAirport(params?: {
232
+ export declare const getAirport: (params?: {
227
233
  page?: number;
228
234
  size?: number;
229
235
  ids?: number[];
230
- cityId?: number;
231
236
  countryId?: number;
232
- }): Promise<BaseResponse<UnifiedItem>>;
237
+ cityId?: number;
238
+ }) => Promise<BaseResponse<UnifiedItem>>;
239
+
240
+ export declare function getAirportByNameEnShow(nameEnShow: string): Promise<any>;
233
241
 
234
- /**
235
- * 跨环境获取 AppId (兼容 Vite, Webpack, Nuxt)
236
- */
237
242
  export declare function getAppId(): string;
238
243
 
239
- export declare function getAuthSessionItems(): {
240
- activityCode: string | null;
241
- referenceUserId: string | null;
242
- empNo: string | null;
243
- uniqueCode: string | null;
244
- path: string | null;
245
- clickSource: string | null;
246
- registerEvent?: string | null;
247
- registerType?: string | null;
248
- compKey?: string | null;
249
- };
244
+ export declare function getAuthSessionItems(): AuthSessionData;
250
245
 
251
246
  /** 单 id 版本 */
252
247
  export declare function getById(type: DisplayInfo, id: number): Promise<UnifiedItem | null>;
@@ -266,50 +261,48 @@ export declare function getCitiesByCountry(countryId: number, opts?: {
266
261
  size?: number;
267
262
  }): Promise<BaseResponse<UnifiedItem>>;
268
263
 
269
- export declare function getCity(params?: {
264
+ export declare const getCity: (params?: {
270
265
  page?: number;
271
266
  size?: number;
272
267
  ids?: number[];
273
268
  countryId?: number;
274
- }): Promise<BaseResponse<UnifiedItem>>;
269
+ cityId?: number;
270
+ }) => Promise<BaseResponse<UnifiedItem>>;
271
+
272
+ export declare function getCityByNameEnShow(nameEnShow: string): Promise<any>;
275
273
 
276
- /**
277
- * 获取当前的常量配置
278
- */
279
274
  export declare const getCommonKeys: () => CommonKeysConfig;
280
275
 
281
276
  export declare const getCompanyOptionApi: (data: CompanyOption) => Promise<any>;
282
277
 
283
- /** 保留对外兼容函数:getContinent/getCountry/getCity/getProvince/getSeaport/getAirport */
284
- export declare function getContinent(params?: {
278
+ export declare const getContinent: (params?: {
285
279
  page?: number;
286
280
  size?: number;
287
- }): Promise<BaseResponse<UnifiedItem>>;
281
+ ids?: number[];
282
+ countryId?: number;
283
+ cityId?: number;
284
+ }) => Promise<BaseResponse<UnifiedItem>>;
288
285
 
289
- export declare function getCountry(params?: {
286
+ export declare const getCountry: (params?: {
290
287
  page?: number;
291
288
  size?: number;
292
289
  ids?: number[];
293
- }): Promise<BaseResponse<UnifiedItem>>;
290
+ countryId?: number;
291
+ cityId?: number;
292
+ }) => Promise<BaseResponse<UnifiedItem>>;
293
+
294
+ export declare function getCountryByNameEnShow(nameEnShow: string): Promise<any>;
294
295
 
295
296
  /**
296
297
  * 获取当前的 clientId(不会创建新的)
297
298
  */
298
299
  export declare function getCurrentClientId(): string | null;
299
300
 
300
- /**
301
- * 🚀 补全:获取 Access Token 的过期时间戳 (用于判断是否需要刷新)
302
- */
303
301
  export declare function getExpiresTimeIn(): number;
304
302
 
305
- /**
306
- * 获取一级域名 (用于 Cookie 跨域共享)
307
- */
308
303
  export declare function getFirstDomain(): string | undefined;
309
304
 
310
- export declare function getGioSessionItems(): {
311
- registerEntry: string | null;
312
- };
305
+ export declare function getGioSessionItems(): GioSessionData;
313
306
 
314
307
  /**
315
308
  * 兼容全环境的语言判断方法
@@ -319,22 +312,13 @@ export declare const getIsEn: () => boolean;
319
312
 
320
313
  export declare function getJoinCompanyApi(data: any): Promise<any>;
321
314
 
322
- /**
323
- * 获取当前语言
324
- * @returns
325
- */
326
315
  export declare function getLanguage(): string | undefined;
327
316
 
328
- /**
329
- * 获取本地 IP 数据
330
- * @param data
331
- * @returns
332
- */
333
- export declare function getLocalIpDataApi(data: any): Promise<any>;
317
+ export declare function getLocalIpDataApi(data: Record<string, any>): Promise<any>;
334
318
 
335
319
  export declare function getLoginQrCode(data?: {}): Promise<any>;
336
320
 
337
- export declare function getMEVCodeApi(data: any): Promise<any>;
321
+ export declare function getMEVCodeApi(data: ForgotPasswordVerifyData): Promise<any>;
338
322
 
339
323
  export declare function getMobileEmailApi(data: {
340
324
  id: string;
@@ -346,45 +330,36 @@ export declare function getMobileEmailApi(data: {
346
330
  */
347
331
  export declare function getOrCreateClientId(): string;
348
332
 
349
- /**
350
- * 跨环境获取 Path
351
- */
352
333
  export declare function getPathFromConfig(config: any): string;
353
334
 
354
- /**
355
- * 4. 导出操作方法
356
- */
357
335
  export declare function getProjectId(): string | undefined;
358
336
 
359
- export declare function getProvince(params?: {
337
+ export declare const getProvince: (params?: {
360
338
  page?: number;
361
339
  size?: number;
362
340
  ids?: number[];
363
341
  countryId?: number;
364
- }): Promise<BaseResponse<UnifiedItem>>;
342
+ cityId?: number;
343
+ }) => Promise<BaseResponse<UnifiedItem>>;
365
344
 
366
345
  export declare function getRedirectPathApi(appId: string, path: string): Promise<any>;
367
346
 
368
- /**
369
- * 🚀 补全:获取当前的 Refresh Token
370
- */
371
347
  export declare function getRefreshToken(): string | undefined;
372
348
 
373
- /**
374
- * 获取记住的账号
375
- */
376
349
  export declare function getRememberAccount(): {
377
350
  account?: string;
378
351
  password?: string;
379
352
  };
380
353
 
381
- export declare function getSeaport(params?: {
354
+ export declare const getSeaport: (params?: {
382
355
  page?: number;
383
356
  size?: number;
384
357
  ids?: number[];
385
- cityId?: number;
386
358
  countryId?: number;
387
- }): Promise<BaseResponse<UnifiedItem>>;
359
+ cityId?: number;
360
+ }) => Promise<BaseResponse<UnifiedItem>>;
361
+
362
+ export declare function getSeaportByNameEnShow(nameEnShow: string): Promise<any>;
388
363
 
389
364
  export declare function getSessionHeaderValue(key: string): string;
390
365
 
@@ -401,9 +376,6 @@ export declare const getSharedConfig: () => {
401
376
  readonly appId: string | undefined;
402
377
  };
403
378
 
404
- /**
405
- * 获取当前的 Access Token
406
- */
407
379
  export declare function getToken(): string | undefined;
408
380
 
409
381
  /**
@@ -425,10 +397,16 @@ export declare function getToken(): string | undefined;
425
397
  */
426
398
  export declare function getTracker<T extends GioTracker>(trackerInstance?: T): T | null;
427
399
 
428
- export declare function getUserInfoApi(data: any): Promise<any>;
400
+ export declare function getUserInfoApi(data: Record<string, any>): Promise<any>;
429
401
 
430
402
  export declare const GIO_CLICK_PAGE_REQUIRED_FIELDS: readonly ["companyID_var", "contactPerson_var", "inquiryID_var", "modulePosition_var", "moduleType_var", "pageCode_var", "pageClickName_var", "moduleName_var"];
431
403
 
404
+ /** clickPage 事件名常量 */
405
+ export declare const GIO_EVENT_CLICK_PAGE = "clickPage";
406
+
407
+ /** GIO session key 映射表 */
408
+ declare const GIO_SESSION_KEYS: Record<string, string>;
409
+
432
410
  /**
433
411
  * GIO 属性对象
434
412
  */
@@ -528,6 +506,8 @@ export declare interface GioInitOptions {
528
506
  ignoreFields?: string[];
529
507
  /** 曝光比例(0-1),与曝光插件结合使用,默认 0 */
530
508
  impressionScale?: number;
509
+ /** 性能采集插件配置。集成后默认开启首屏加载监控和错误监控,默认关闭网络监控 */
510
+ performance?: GioPerformanceOptions;
531
511
  /** 与小程序打通时的配置项,SDK >= 4.3.0 支持 */
532
512
  embeddedAdapter?: {
533
513
  /** 圈选服务器地址,SaaS 客户不需要配置 */
@@ -547,52 +527,46 @@ export declare interface GioPageProps {
547
527
  }
548
528
 
549
529
  /**
550
- * 事件计时器 ID 类型
530
+ * 性能采集 - 网络监控排除配置
551
531
  */
552
- export declare type GioTimerId = string;
532
+ declare interface GioPerformanceNetwork {
533
+ /**
534
+ * 请求监控排除名单
535
+ * 值可以是域名字符串、正则表达式,或由两者组成的数组
536
+ * 配置此项即视为开启请求监控
537
+ * 注意:使用纯字符串校验时应尽可能使用长且准确的字符,过短的字符串可能会误过滤其他请求
538
+ */
539
+ exclude?: string | RegExp | Array<string | RegExp>;
540
+ }
553
541
 
554
542
  /**
555
- * GrowingIO SDK 封装模块
556
- * 基于 gio-webjs-sdk npm 包
557
- *
558
- * @module gio
559
- *
560
- * @example
561
- * ```typescript
562
- * import { tracker, type GioAttributes, type GioInitOptions } from '@jctrans-materials/shared';
563
- *
564
- * // 基础初始化
565
- * tracker.init('your-account-id', 'your-datasource-id', {
566
- * debug: true,
567
- * trackPage: false,
568
- * });
569
- *
570
- * // 微信公众号 H5(需要 appId 和 forceLogin)
571
- * tracker.init('accountId', 'dataSourceId', 'wx-app-id', {
572
- * forceLogin: true,
573
- * debug: true,
574
- * });
575
- *
576
- * // 设置登录用户 ID
577
- * tracker.setUserId('user-123');
578
- * tracker.setUserId('user-123', 'user_id', () => {
579
- * console.log('set user id with userKey done');
580
- * });
581
- *
582
- * // 埋点事件
583
- * tracker.track('order_submit', {
584
- * order_type: 'freight',
585
- * price: 5000,
586
- * services: ['ocean', 'customs']
587
- * });
588
- *
589
- * // 设置全局属性
590
- * tracker.setGeneralProps({
591
- * platform: 'jctrans_web',
592
- * locale: 'zh-CN'
593
- * });
594
- * ```
543
+ * 性能采集配置项
544
+ * 集成性能采集插件后,默认开启首屏加载监控和错误监控,默认关闭网络监控
595
545
  */
546
+ declare interface GioPerformanceOptions {
547
+ /** 是否开启首屏加载监控,默认 true */
548
+ monitor?: boolean;
549
+ /** 是否开启错误监控,默认 true */
550
+ exception?: boolean;
551
+ /**
552
+ * 网络监控配置
553
+ * - 不配置时默认关闭网络监控
554
+ * - 设为 true 开启网络监控
555
+ * - 设为对象时开启网络监控并配置排除名单
556
+ * 注意:请求监控强制过滤了 Gio 上报的请求
557
+ */
558
+ network?: boolean | GioPerformanceNetwork;
559
+ }
560
+
561
+ declare type GioSessionData = {
562
+ [K in keyof typeof GIO_SESSION_KEYS]?: string | null;
563
+ };
564
+
565
+ /**
566
+ * 事件计时器 ID 类型
567
+ */
568
+ export declare type GioTimerId = string;
569
+
596
570
  export declare type GioTrackAttrs = Record<string, string | number | Array<string | number> | null | undefined>;
597
571
 
598
572
  declare class GioTracker {
@@ -810,9 +784,6 @@ export declare interface GioUserAttributes {
810
784
 
811
785
  export declare const HasLoginKey: string;
812
786
 
813
- /**
814
- * 全局初始化方法,在项目入口调用
815
- */
816
787
  export declare const initCommonKeys: (newKeys: Partial<CommonKeysConfig>) => void;
817
788
 
818
789
  /**
@@ -846,15 +817,11 @@ export declare function installFetchClientId(options?: FetchClientIdOptions): vo
846
817
 
847
818
  export declare function inviteJoinGetCompApi(data: any): Promise<any>;
848
819
 
849
- export declare interface IResponse<T> {
820
+ /** 简化响应结构(仅 data 字段)— 兼容旧名 IResponse */
821
+ export declare type IResponse<T> = {
850
822
  data: T;
851
- }
823
+ };
852
824
 
853
- /**
854
- * 检查值是否为空
855
- * @param value 要检查的值
856
- * @returns 是否为空
857
- */
858
825
  export declare function isEmpty(value: any): boolean;
859
826
 
860
827
  /**
@@ -869,238 +836,68 @@ export declare function isEmpty(value: any): boolean;
869
836
  */
870
837
  export declare function isGioAvailable(trackerInstance?: typeof tracker): boolean;
871
838
 
872
- /**
873
- * 判断域名是否为 IP
874
- */
875
839
  export declare function isIpAddress(hostname: string): boolean;
876
840
 
877
- declare interface LineRequestPayload {
878
- current: number;
879
- size: number;
880
- lineType: "air" | "shipping";
881
- searchkey?: string;
882
- ids?: number[];
883
- [key: string]: any;
884
- }
885
-
886
841
  export declare const locationSearchV2: {
887
- SEARCH_VERSION: string;
888
- searchByName: (params: SearchGenericParams) => Promise<{
889
- records: LocationUnifiedItem[];
890
- total: number;
891
- current: number;
892
- size: number;
893
- }>;
842
+ searchByName: (params: SearchGenericParams) => Promise<BaseResponse<LocationUnifiedItem>>;
894
843
  searchByIdWithType: (id: number | string | Array<number | string>, type: LocationType, extraParams?: {
895
844
  lineType?: "air" | "shipping";
896
- }) => Promise<{
897
- records: LocationUnifiedItem[];
898
- total: number;
899
- current: number;
900
- size: number;
901
- }>;
845
+ }) => any;
902
846
  country: {
903
- searchByName: (params: SearchByNameParams) => Promise<{
904
- records: LocationUnifiedItem[];
905
- total: number;
906
- current: number;
907
- size: number;
908
- }>;
909
- getByIds: (ids: number[]) => Promise<{
910
- records: LocationUnifiedItem[];
911
- total: number;
912
- current: number;
913
- size: number;
914
- }>;
847
+ searchRegionByName: (params: SearchByNameParams) => Promise<BaseResponse<LocationUnifiedItem>>;
848
+ getRegionByIds: (ids: number[]) => Promise<BaseResponse<LocationUnifiedItem>>;
849
+ searchByName: (params: SearchWithScopeParams) => Promise<BaseResponse<LocationUnifiedItem>>;
850
+ getByIds: (ids: number[] | string[]) => Promise<BaseResponse<LocationUnifiedItem>>;
915
851
  };
916
852
  region: {
917
- searchByName: (params: SearchByNameParams) => Promise<{
918
- records: LocationUnifiedItem[];
919
- total: number;
920
- current: number;
921
- size: number;
922
- }>;
923
- getByIds: (ids: number[]) => Promise<{
924
- records: LocationUnifiedItem[];
925
- total: number;
926
- current: number;
927
- size: number;
928
- }>;
853
+ searchByName: (params: SearchByNameParams) => Promise<BaseResponse<LocationUnifiedItem>>;
854
+ getByIds: (ids: number[]) => Promise<BaseResponse<LocationUnifiedItem>>;
929
855
  };
930
856
  city: {
931
- searchByName: (params: SearchWithScopeParams) => Promise<{
932
- records: LocationUnifiedItem[];
933
- total: number;
934
- current: number;
935
- size: number;
936
- }>;
937
- getByIds: (ids: number[]) => Promise<{
938
- records: LocationUnifiedItem[];
939
- total: number;
940
- current: number;
941
- size: number;
942
- }>;
943
- getCitiesByCountry: (countryId: number, params?: PageParams) => Promise<{
944
- records: LocationUnifiedItem[];
945
- total: number;
946
- current: number;
947
- size: number;
948
- }>;
857
+ getCitiesByCountry: (countryId: number, params?: PageParams) => Promise<BaseResponse<LocationUnifiedItem>>;
858
+ searchByName: (params: SearchWithScopeParams) => Promise<BaseResponse<LocationUnifiedItem>>;
859
+ getByIds: (ids: number[] | string[]) => Promise<BaseResponse<LocationUnifiedItem>>;
949
860
  };
950
861
  seaport: {
951
- searchByName: (params: SearchWithScopeParams) => Promise<{
952
- records: LocationUnifiedItem[];
953
- total: number;
954
- current: number;
955
- size: number;
956
- }>;
957
- getByIds: (ids: number[]) => Promise<{
958
- records: LocationUnifiedItem[];
959
- total: number;
960
- current: number;
961
- size: number;
962
- }>;
862
+ searchByName: (params: SearchWithScopeParams) => Promise<BaseResponse<LocationUnifiedItem>>;
863
+ getByIds: (ids: number[] | string[]) => Promise<BaseResponse<LocationUnifiedItem>>;
963
864
  };
964
865
  airport: {
965
- searchByName: (params: SearchWithScopeParams) => Promise<{
966
- records: LocationUnifiedItem[];
967
- total: number;
968
- current: number;
969
- size: number;
970
- }>;
971
- getByIds: (ids: number[]) => Promise<{
972
- records: LocationUnifiedItem[];
973
- total: number;
974
- current: number;
975
- size: number;
976
- }>;
866
+ searchByName: (params: SearchWithScopeParams) => Promise<BaseResponse<LocationUnifiedItem>>;
867
+ getByIds: (ids: number[] | string[]) => Promise<BaseResponse<LocationUnifiedItem>>;
868
+ };
869
+ province: {
870
+ searchByName: (params: SearchWithScopeParams) => Promise<BaseResponse<LocationUnifiedItem>>;
871
+ getByIds: (ids: number[] | string[]) => Promise<BaseResponse<LocationUnifiedItem>>;
872
+ };
873
+ continent: {
874
+ searchByName: (params: SearchWithScopeParams) => Promise<BaseResponse<LocationUnifiedItem>>;
875
+ getByIds: (ids: number[] | string[]) => Promise<BaseResponse<LocationUnifiedItem>>;
977
876
  };
978
877
  wharf: {
979
- getByIds: (ids: string[]) => Promise<{
980
- records: LocationUnifiedItem[];
981
- total: number;
982
- current: number;
983
- size: number;
984
- }>;
878
+ getByIds: (ids: string[]) => Promise<BaseResponse<LocationUnifiedItem>>;
985
879
  };
986
880
  carrier: {
987
- /**
988
- * 内部私有方法:构建符合 Carrier 接口要求的 payload
989
- */
990
- _buildPayload: (params: Partial<SearchByNameParams> & {
991
- ids?: number[];
992
- }, lineType: "air" | "shipping") => CarrierRequestPayload;
993
- /**
994
- * 搜索船公司 (Shipping Line)
995
- */
996
- searchShipping: (params: SearchByNameParams) => Promise<{
997
- records: LocationUnifiedItem[];
998
- total: number;
999
- current: number;
1000
- size: number;
1001
- }>;
1002
- /**
1003
- * 搜索航空公司 (Airline)
1004
- */
1005
- searchAir: (params: SearchByNameParams) => Promise<{
1006
- records: LocationUnifiedItem[];
1007
- total: number;
1008
- current: number;
1009
- size: number;
1010
- }>;
1011
- /**
1012
- * 通用搜索 (需要手动传入 type)
1013
- * 场景:如果前端有一个下拉框让用户选类型,则调用此方法
1014
- */
1015
- search: (params: SearchByNameParams, lineType: "air" | "shipping") => Promise<{
1016
- records: LocationUnifiedItem[];
1017
- total: number;
1018
- current: number;
1019
- size: number;
1020
- }>;
1021
- /**
1022
- * 根据 ID 获取详情
1023
- * 注意:根据你的 Interface,ID 查询可能也需要传 lineType,
1024
- * 默认设为 shipping,或者你需要拆分成两个 ID 方法
1025
- */
1026
- getByIds: (ids: number[], lineType?: "air" | "shipping") => Promise<{
1027
- records: LocationUnifiedItem[];
1028
- total: number;
1029
- current: number;
1030
- size: number;
1031
- }>;
881
+ searchShipping: (params: SearchByNameParams) => Promise<BaseResponse<LocationUnifiedItem>>;
882
+ searchAir: (params: SearchByNameParams) => Promise<BaseResponse<LocationUnifiedItem>>;
883
+ search: (params: SearchByNameParams, lineType: "air" | "shipping") => Promise<BaseResponse<LocationUnifiedItem>>;
884
+ getByIds: (ids: number[], lineType?: "air" | "shipping") => Promise<BaseResponse<LocationUnifiedItem>>;
1032
885
  };
1033
886
  line: {
1034
- /**
1035
- * 内部私有方法:构建符合后端要求的 Payload
1036
- */
1037
- _buildPayload: (params: Partial<SearchByNameParams> & {
1038
- ids?: number[];
1039
- }, lineType: "air" | "shipping") => LineRequestPayload;
1040
- searchAllByCountry: (lineType: "air" | "shipping", countryId?: number) => Promise<{
1041
- records: LocationUnifiedItem[];
1042
- total: number;
1043
- current: number;
1044
- size: number;
1045
- }>;
1046
- /**
1047
- * 搜索海运航线 (Shipping Line)
1048
- * 例如:AE1, TP9
1049
- */
1050
- searchShipping: (params: SearchByNameParams) => Promise<{
1051
- records: LocationUnifiedItem[];
1052
- total: number;
1053
- current: number;
1054
- size: number;
1055
- }>;
1056
- /**
1057
- * 搜索空运航线 (Air Line)
1058
- * 业务上较少见,但接口支持
1059
- */
1060
- searchAir: (params: SearchByNameParams) => Promise<{
1061
- records: LocationUnifiedItem[];
1062
- total: number;
1063
- current: number;
1064
- size: number;
1065
- }>;
1066
- /**
1067
- * 通用搜索 (需要手动传 lineType)
1068
- */
1069
- search: (params: SearchByNameParams, lineType: "air" | "shipping") => Promise<{
1070
- records: LocationUnifiedItem[];
1071
- total: number;
1072
- current: number;
1073
- size: number;
1074
- }>;
1075
- /**
1076
- * 根据 ID 获取航线详情
1077
- * 默认默认为 shipping,如需查空运航线需显式传入
1078
- */
1079
- getByIds: (ids: number[], lineType?: "air" | "shipping") => Promise<{
1080
- records: LocationUnifiedItem[];
1081
- total: number;
1082
- current: number;
1083
- size: number;
1084
- }>;
887
+ searchAllByCountry: (lineType: "air" | "shipping", countryId?: number) => Promise<BaseResponse<LocationUnifiedItem>>;
888
+ searchShipping: (params: SearchByNameParams) => Promise<BaseResponse<LocationUnifiedItem>>;
889
+ searchAir: (params: SearchByNameParams) => Promise<BaseResponse<LocationUnifiedItem>>;
890
+ search: (params: SearchByNameParams, lineType: "air" | "shipping") => Promise<BaseResponse<LocationUnifiedItem>>;
891
+ getByIds: (ids: number[], lineType?: "air" | "shipping") => Promise<BaseResponse<LocationUnifiedItem>>;
1085
892
  };
1086
- /** 获取某个国家下的所有城市 */
1087
- getCitiesByCountry: (countryId: number, params?: PageParams) => Promise<{
1088
- records: LocationUnifiedItem[];
1089
- total: number;
1090
- current: number;
1091
- size: number;
1092
- }>;
1093
- /** 获取某个城市下的子实体 */
1094
- getChildrenByCity: (cityId: number, childTypes: Array<"Seaport" | "Airport" | "Wharf">, params?: PageParams) => Promise<{
1095
- records: LocationUnifiedItem[];
1096
- total: number;
1097
- current: number;
1098
- size: number;
1099
- }>;
893
+ getCitiesByCountry: (countryId: number, params?: PageParams) => Promise<BaseResponse<LocationUnifiedItem>>;
894
+ getChildrenByCity: (cityId: number, childTypes: Array<"Seaport" | "Airport" | "Wharf">, params?: PageParams) => Promise<BaseResponse<LocationUnifiedItem>>;
1100
895
  };
1101
896
 
897
+ /** 所有支持的搜索实体类型(V1 + V2 的 superset) */
1102
898
  export declare type LocationType = "Continent" | "Country" | "Region" | "Province" | "City" | "Seaport" | "Airport" | "Street" | "Town" | "Wharf" | "Carrier" | "Line";
1103
899
 
900
+ /** 标准化后的实体对象(V1 + V2 的 superset) */
1104
901
  export declare interface LocationUnifiedItem {
1105
902
  id: number | string;
1106
903
  type: LocationType;
@@ -1126,9 +923,9 @@ export declare function loginApi(loginData: LoginDataParams): Promise<IResponse<
1126
923
 
1127
924
  export declare function loginByEmailOrMobileCodeApi(data: any): Promise<IResponse<ApiResponse<LoginResponseData>>>;
1128
925
 
1129
- export declare function loginByFacebookApi(data: any): Promise<IResponse<ApiResponse<ThirdResponseData>>>;
926
+ export declare const loginByFacebookApi: (data: any) => Promise<IResponse<ApiResponse<ThirdResponseData>>>;
1130
927
 
1131
- export declare function loginByLinkedinApi(data: any): Promise<IResponse<ApiResponse<ThirdResponseData>>>;
928
+ export declare const loginByLinkedinApi: (data: any) => Promise<IResponse<ApiResponse<ThirdResponseData>>>;
1132
929
 
1133
930
  export declare function loginByQrCode(data: {
1134
931
  uniqueCode: string;
@@ -1141,6 +938,7 @@ export declare function loginByQrCode(data: {
1141
938
 
1142
939
  export declare function loginCodeBindWechatApi(data: any): Promise<any>;
1143
940
 
941
+ /** 登录请求参数 */
1144
942
  export declare interface LoginDataParams {
1145
943
  username: string;
1146
944
  password: string;
@@ -1155,6 +953,7 @@ export declare interface LoginDataParams {
1155
953
 
1156
954
  export declare function loginPwdBindWechatApi(data: any): Promise<any>;
1157
955
 
956
+ /** 登录响应的 data 层 */
1158
957
  export declare interface LoginResponseData {
1159
958
  redirect: boolean;
1160
959
  redirectPath?: string;
@@ -1163,6 +962,7 @@ export declare interface LoginResponseData {
1163
962
  hasLogon?: boolean;
1164
963
  }
1165
964
 
965
+ /** 登录结果中的 Token 信息 */
1166
966
  export declare interface LoginResult {
1167
967
  accessToken: string;
1168
968
  expireIn: number;
@@ -1194,6 +994,7 @@ export declare const normalizeClickPageAttrs: (eventName: string, attrs?: GioTra
1194
994
  */
1195
995
  export declare type PageListenerCallback = (pageProps: GioPageProps) => void;
1196
996
 
997
+ /** 分页参数 */
1197
998
  export declare interface PageParams {
1198
999
  current?: number;
1199
1000
  size?: number;
@@ -1223,13 +1024,13 @@ export declare const RememberMeAccountKey: string;
1223
1024
 
1224
1025
  export declare const RememberMePasswordKey: string;
1225
1026
 
1226
- export declare interface reportNewTypeData {
1027
+ export declare interface ReportNewTypeData {
1227
1028
  reportData: string;
1228
1029
  reportType: ReportType;
1229
1030
  countryId?: string | number;
1230
1031
  }
1231
1032
 
1232
- export declare function reportNewTypeDataApi(payload: reportNewTypeData): Promise<{}>;
1033
+ export declare function reportNewTypeDataApi(payload: ReportNewTypeData): Promise<Record<string, any>>;
1233
1034
 
1234
1035
  export declare type ReportType = "City" | "Seaport" | "Airport" | "Line" | "Carrier" | "shipping_line" | "shipping_carrier" | "air_line" | "air_carrier";
1235
1036
 
@@ -1256,7 +1057,14 @@ export declare function resetAuthSessionItems(): void;
1256
1057
 
1257
1058
  export declare function resetGioSessionItems(): void;
1258
1059
 
1259
- export declare function resetPasswordApi(data: any): Promise<any>;
1060
+ export declare function resetPasswordApi(data: ResetPasswordData): Promise<any>;
1061
+
1062
+ declare interface ResetPasswordData {
1063
+ account?: string;
1064
+ password?: string;
1065
+ code?: string;
1066
+ [key: string]: any;
1067
+ }
1260
1068
 
1261
1069
  /**
1262
1070
  * 保存 clientId 到 localStorage
@@ -1270,8 +1078,6 @@ export declare function saveClientIdToSessionStorage(clientId: string): void;
1270
1078
 
1271
1079
  /**
1272
1080
  * 统一搜索接口
1273
- * - 支持 keyword(模糊), displayInfo(数组), ids(按 type), scope(countryId/cityId/provinceId)
1274
- * - 返回扁平化的 UnifiedItem 列表 + 分页信息
1275
1081
  */
1276
1082
  export declare function search(params: {
1277
1083
  keyword?: string;
@@ -1296,7 +1102,7 @@ export declare function searchAirportByName(keyword: string, opts?: {
1296
1102
  page?: number;
1297
1103
  size?: number;
1298
1104
  cityId?: number;
1299
- }): Promise<BaseResponse<UnifiedItem>>;
1105
+ }): Promise<BaseResponse<LocationUnifiedItem>>;
1300
1106
 
1301
1107
  /**
1302
1108
  * 按名称搜索指定类型
@@ -1310,6 +1116,7 @@ export declare function searchByName(params: {
1310
1116
  sort?: string;
1311
1117
  }): Promise<BaseResponse<UnifiedItem>>;
1312
1118
 
1119
+ /** 按名称搜索参数 */
1313
1120
  export declare interface SearchByNameParams extends PageParams {
1314
1121
  keyword: string;
1315
1122
  searchMode?: "0" | "1" | "2";
@@ -1319,13 +1126,14 @@ export declare function searchCityByName(keyword: string, opts?: {
1319
1126
  page?: number;
1320
1127
  size?: number;
1321
1128
  countryId?: number;
1322
- }): Promise<BaseResponse<UnifiedItem>>;
1129
+ }): Promise<BaseResponse<LocationUnifiedItem>>;
1323
1130
 
1324
1131
  export declare function searchCountryByName(keyword: string, opts?: {
1325
1132
  page?: number;
1326
1133
  size?: number;
1327
- }): Promise<BaseResponse<UnifiedItem>>;
1134
+ }): Promise<BaseResponse<LocationUnifiedItem>>;
1328
1135
 
1136
+ /** 通用搜索参数(需指定 displayInfo) */
1329
1137
  export declare interface SearchGenericParams extends SearchByNameParams {
1330
1138
  displayInfo: LocationType[];
1331
1139
  }
@@ -1334,8 +1142,9 @@ export declare function searchSeaportByName(keyword: string, opts?: {
1334
1142
  page?: number;
1335
1143
  size?: number;
1336
1144
  cityId?: number;
1337
- }): Promise<BaseResponse<UnifiedItem>>;
1145
+ }): Promise<BaseResponse<LocationUnifiedItem>>;
1338
1146
 
1147
+ /** 带范围约束的搜索参数 */
1339
1148
  export declare interface SearchWithScopeParams extends SearchByNameParams {
1340
1149
  countryId?: number;
1341
1150
  cityId?: number;
@@ -1356,30 +1165,12 @@ export declare function sendMobileCodeApi(data: {
1356
1165
  uuid?: string;
1357
1166
  }): Promise<any>;
1358
1167
 
1359
- export declare function setAuthSessionItems(data: {
1360
- activityCode?: string | null;
1361
- referenceUserId?: string | null;
1362
- empNo?: string | null;
1363
- uniqueCode?: string | null;
1364
- path?: string | null;
1365
- clickSource?: string | null;
1366
- registerEvent?: string | null;
1367
- registerType?: string | null;
1368
- compKey?: string | null;
1369
- }): void;
1370
-
1371
- export declare function setGioSessionItems(data: {
1372
- registerEntry?: string | null;
1373
- }): void;
1168
+ export declare function setAuthSessionItems(data: AuthSessionData): void;
1169
+
1170
+ export declare function setGioSessionItems(data: GioSessionData): void;
1374
1171
 
1375
- /**
1376
- * 记住账号 (替代存密码)
1377
- */
1378
1172
  export declare function setRememberMe(account: string, password: string, remember: boolean): void;
1379
1173
 
1380
- /**
1381
- * 整体设置所有凭证
1382
- */
1383
1174
  export declare function setTokenAll(data: TokenData | null | undefined): void;
1384
1175
 
1385
1176
  export declare interface SharedConfig {
@@ -1393,21 +1184,11 @@ export declare interface SharedConfig {
1393
1184
  commonKeys?: Partial<CommonKeysConfig>;
1394
1185
  }
1395
1186
 
1396
- /**
1397
- * 滑动或者点选验证
1398
- * @param data
1399
- * @returns
1400
- */
1401
1187
  export declare function slideCheckApi(data: {
1402
1188
  pointJson: string;
1403
1189
  uuid: string;
1404
1190
  }): Promise<any>;
1405
1191
 
1406
- /**
1407
- * 获取验证图片 以及token
1408
- * @param data
1409
- * @returns
1410
- */
1411
1192
  export declare function slideGetApi(data: {
1412
1193
  clientUid: string;
1413
1194
  ts: number;
@@ -1421,6 +1202,7 @@ export declare interface ThirdPartyInfo {
1421
1202
  [property: string]: any;
1422
1203
  }
1423
1204
 
1205
+ /** 第三方登录响应 */
1424
1206
  export declare interface ThirdResponse {
1425
1207
  code: number;
1426
1208
  data: ThirdResponseData;
@@ -1429,25 +1211,10 @@ export declare interface ThirdResponse {
1429
1211
  }
1430
1212
 
1431
1213
  export declare interface ThirdResponseData {
1432
- /**
1433
- * 手机邮箱匹配列表 (修正为数组)
1434
- */
1435
1214
  mobileEmailList: ThirdResponseMobileEmailList[];
1436
- /**
1437
- * 是否跳转, true跳转 false不跳转
1438
- */
1439
1215
  redirect: boolean;
1440
- /**
1441
- * 跳转路径
1442
- */
1443
1216
  redirectPath: string;
1444
- /**
1445
- * tgc
1446
- */
1447
1217
  tgc: string;
1448
- /**
1449
- * 三方信息
1450
- */
1451
1218
  thirdPartyInfo: ThirdPartyInfo;
1452
1219
  [property: string]: any;
1453
1220
  }
@@ -1472,9 +1239,6 @@ export declare interface ThirdResponseMobileEmailList {
1472
1239
 
1473
1240
  export declare const TOKEN_ENDPOINTS: Set<string>;
1474
1241
 
1475
- /**
1476
- * 3. 类型定义
1477
- */
1478
1242
  export declare interface TokenData {
1479
1243
  accessToken?: string;
1480
1244
  expireIn?: number;
@@ -1488,21 +1252,10 @@ export declare function toSafeHeaderValue(value: string): string;
1488
1252
 
1489
1253
  export declare const tracker: GioTracker;
1490
1254
 
1491
- /** 归一化之后的实体 */
1492
- export declare interface UnifiedItem {
1493
- id: number | string;
1494
- type: DisplayInfo;
1495
- nameCn?: string;
1496
- nameEn?: string;
1497
- display?: string;
1498
- continent?: Record<string, any>;
1499
- country?: Record<string, any>;
1500
- city?: Record<string, any>;
1501
- province?: Record<string, any>;
1502
- raw?: any;
1503
- }
1255
+ /** 兼容旧名:baseSearch.UnifiedItem */
1256
+ export declare type UnifiedItem = LocationUnifiedItem;
1504
1257
 
1505
- export declare function userCompPermsApi(data: any): Promise<any>;
1258
+ export declare function userCompPermsApi(data: Record<string, any>): Promise<any>;
1506
1259
 
1507
1260
  export declare function validateAccountExistApi(data: {
1508
1261
  target: string;