@jctrans-materials/shared 1.0.40-beta.0 → 1.0.40-beta.10

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
@@ -169,6 +169,7 @@ export declare const currentConfig: {
169
169
  readonly allLinePath: string;
170
170
  readonly oldBasePath: string;
171
171
  readonly prefixPath: string;
172
+ readonly appId: string | undefined;
172
173
  };
173
174
 
174
175
  /**
@@ -454,6 +455,7 @@ export declare const getSharedConfig: () => {
454
455
  readonly allLinePath: string;
455
456
  readonly oldBasePath: string;
456
457
  readonly prefixPath: string;
458
+ readonly appId: string | undefined;
457
459
  };
458
460
 
459
461
  /**
@@ -487,6 +489,8 @@ export declare function getTracker<T extends GioTracker>(trackerInstance?: T): T
487
489
  */
488
490
  export declare function getUserInfoApi(data: any): Promise<any>;
489
491
 
492
+ 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"];
493
+
490
494
  /**
491
495
  * GIO 属性对象
492
496
  */
@@ -609,6 +613,50 @@ export declare interface GioPageProps {
609
613
  */
610
614
  export declare type GioTimerId = string;
611
615
 
616
+ /**
617
+ * GrowingIO SDK 封装模块
618
+ * 基于 gio-webjs-sdk npm 包
619
+ *
620
+ * @module gio
621
+ *
622
+ * @example
623
+ * ```typescript
624
+ * import { tracker, type GioAttributes, type GioInitOptions } from '@jctrans-materials/shared';
625
+ *
626
+ * // 基础初始化
627
+ * tracker.init('your-account-id', 'your-datasource-id', {
628
+ * debug: true,
629
+ * trackPage: false,
630
+ * });
631
+ *
632
+ * // 微信公众号 H5(需要 appId 和 forceLogin)
633
+ * tracker.init('accountId', 'dataSourceId', 'wx-app-id', {
634
+ * forceLogin: true,
635
+ * debug: true,
636
+ * });
637
+ *
638
+ * // 设置登录用户 ID
639
+ * tracker.setUserId('user-123');
640
+ * tracker.setUserId('user-123', 'user_id', () => {
641
+ * console.log('set user id with userKey done');
642
+ * });
643
+ *
644
+ * // 埋点事件
645
+ * tracker.track('order_submit', {
646
+ * order_type: 'freight',
647
+ * price: 5000,
648
+ * services: ['ocean', 'customs']
649
+ * });
650
+ *
651
+ * // 设置全局属性
652
+ * tracker.setGeneralProps({
653
+ * platform: 'jctrans_web',
654
+ * locale: 'zh-CN'
655
+ * });
656
+ * ```
657
+ */
658
+ export declare type GioTrackAttrs = Record<string, string | number | Array<string | number> | null | undefined>;
659
+
612
660
  declare class GioTracker {
613
661
  private hasInitCalled;
614
662
  private dispatcher;
@@ -864,6 +912,13 @@ declare interface IResponse<T> {
864
912
  data: T;
865
913
  }
866
914
 
915
+ /**
916
+ * 检查值是否为空
917
+ * @param value 要检查的值
918
+ * @returns 是否为空
919
+ */
920
+ export declare function isEmpty(value: any): boolean;
921
+
867
922
  /**
868
923
  * 检查 GIO 是否可用(浏览器环境且已初始化)
869
924
  *
@@ -1116,27 +1171,17 @@ export declare interface LocationUnifiedItem {
1116
1171
  display?: string;
1117
1172
  displayEn?: string;
1118
1173
  displayCn?: string;
1119
- /** * 通用代码字段 (自动取 scacCode 或 carrierCode)
1120
- * 适用于仅展示用途
1121
- */
1122
1174
  code?: string;
1123
- /** * SCAC 代码 (Standard Carrier Alpha Code) - 通常用于船司
1124
- */
1125
1175
  scacCode?: string;
1126
- /** * IATA 代码 - 通常用于航司
1127
- */
1128
1176
  iataCode?: string;
1129
- /** * 承运人通用代码
1130
- */
1131
1177
  carrierCode?: string;
1132
- /** * 承运人类型: 'air' | 'shipping'
1133
- */
1134
1178
  lineType?: string;
1135
1179
  continent?: Record<string, any>;
1136
1180
  country?: Record<string, any>;
1137
1181
  city?: Record<string, any>;
1138
1182
  province?: Record<string, any>;
1139
1183
  raw?: any;
1184
+ [key: string]: unknown;
1140
1185
  }
1141
1186
 
1142
1187
  /**
@@ -1177,6 +1222,8 @@ export declare function loginByQrCode(data: {
1177
1222
  appId: string;
1178
1223
  redirectPath: string;
1179
1224
  kick: boolean;
1225
+ prjId?: string;
1226
+ formEntry?: string;
1180
1227
  }): Promise<any>;
1181
1228
 
1182
1229
  /**
@@ -1235,6 +1282,10 @@ export declare type ModalEvents = Record<ActionKeys, any> & {
1235
1282
 
1236
1283
  export declare type ModalOpenCallback = () => void;
1237
1284
 
1285
+ export declare const normalizeAttrs: (attrs?: GioTrackAttrs) => GioTrackAttrs;
1286
+
1287
+ export declare const normalizeClickPageAttrs: (eventName: string, attrs?: GioTrackAttrs) => GioTrackAttrs;
1288
+
1238
1289
  /**
1239
1290
  * 页面变更回调
1240
1291
  */
@@ -1307,7 +1358,7 @@ export declare interface reportNewTypeData {
1307
1358
 
1308
1359
  export declare function reportNewTypeDataApi(payload: reportNewTypeData): Promise<{}>;
1309
1360
 
1310
- export declare type ReportType = "City" | "Seaport" | "Airport" | "Line";
1361
+ export declare type ReportType = "City" | "Seaport" | "Airport" | "Line" | "Carrier" | "shipping_line" | "shipping_carrier" | "air_line" | "air_carrier";
1311
1362
 
1312
1363
  declare interface RequestAdapter {
1313
1364
  get(url: string, config?: RequestConfig): Promise<any>;