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