hina-cloud-js-sdk 3.1.7 → 3.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/.gitlab-ci.yml +2 -6
  2. package/build/hina.cjs.min.js +1 -0
  3. package/build/hina.esm.min.js +1 -1
  4. package/build/hina.min.js +1 -4
  5. package/build/hotAnalyse.min.js +1 -1
  6. package/package.json +2 -7
  7. package/packages/core/dist/index.cjs.js +64 -0
  8. package/packages/core/dist/index.cjs.js.map +1 -0
  9. package/packages/core/dist/index.d.ts +45 -0
  10. package/packages/core/dist/index.esm.js +62 -0
  11. package/packages/core/dist/index.esm.js.map +1 -0
  12. package/packages/core/dist/index.global.js +1199 -0
  13. package/packages/core/dist/index.global.js.map +1 -0
  14. package/packages/core/dist/index.js +1200 -0
  15. package/packages/core/dist/index.js.map +1 -0
  16. package/packages/monitor/dist/index.cjs.js +150 -0
  17. package/packages/monitor/dist/index.cjs.js.map +1 -0
  18. package/packages/monitor/dist/index.d.ts +35 -0
  19. package/packages/monitor/dist/index.esm.js +145 -0
  20. package/packages/monitor/dist/index.esm.js.map +1 -0
  21. package/packages/monitor/dist/index.global.js +1343 -0
  22. package/packages/monitor/dist/index.global.js.map +1 -0
  23. package/packages/monitor/dist/index.js +1344 -0
  24. package/packages/monitor/dist/index.js.map +1 -0
  25. package/packages/track/dist/index.cjs.js +1930 -0
  26. package/packages/track/dist/index.cjs.js.map +1 -0
  27. package/packages/track/dist/index.d.ts +212 -0
  28. package/packages/track/dist/index.esm.js +1925 -0
  29. package/packages/track/dist/index.esm.js.map +1 -0
  30. package/packages/track/dist/index.global.js +4259 -0
  31. package/packages/track/dist/index.global.js.map +1 -0
  32. package/packages/track/dist/index.js +4260 -0
  33. package/packages/track/dist/index.js.map +1 -0
  34. package/packages/types/dist/index.d.ts +603 -0
  35. package/packages/types/dist/index.esm.js +25 -0
  36. package/packages/types/dist/index.esm.js.map +1 -0
  37. package/packages/utils/dist/index.cjs.js +1535 -0
  38. package/packages/utils/dist/index.cjs.js.map +1 -0
  39. package/packages/utils/dist/index.d.ts +394 -0
  40. package/packages/utils/dist/index.esm.js +1465 -0
  41. package/packages/utils/dist/index.esm.js.map +1 -0
  42. package/packages/utils/dist/index.global.js +2507 -0
  43. package/packages/utils/dist/index.global.js.map +1 -0
  44. package/packages/utils/dist/index.js +2508 -0
  45. package/packages/utils/dist/index.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,394 @@
1
+ import { IAnyObject, VoidFn, ElementProperties, PageProperties, BrowserInfo, RequestParams, BaseOptions, StoreState, ConsoleTypes } from 'hina-cloud-types';
2
+
3
+ declare function isObject(val: unknown): boolean;
4
+ declare function isUndefined(val: unknown): boolean;
5
+ declare function isValid(val: unknown): boolean;
6
+ declare function isArray(val: unknown): val is any[];
7
+ declare function isDate(val: unknown): boolean;
8
+ declare function isFunction(val: unknown): val is Function;
9
+ declare function isString(val: unknown): val is string;
10
+ declare function isNumber(val: unknown): val is number;
11
+ declare function isBoolean(val: unknown): val is boolean;
12
+ declare function noop(): void;
13
+ declare function isJSONString(val: any): boolean;
14
+ declare function safeJSONParse(val: string): any;
15
+ declare function isEmptyObject(obj: unknown): boolean;
16
+ declare function nowStamp(): number;
17
+ declare function merge(...args: any[]): any;
18
+ declare function stripEmptyProperties(obj: IAnyObject): IAnyObject;
19
+ /**
20
+ * 返回URL对象
21
+ * @param url
22
+ */
23
+ declare function getURL(url: string): URL;
24
+ /**
25
+ * 获取URL上的search参数
26
+ * @param queryString
27
+ */
28
+ declare function getURLSearchParams(queryString: string): IAnyObject;
29
+ declare function formatDecimal(num: number, decimal?: number): number;
30
+ /**
31
+ * 获取cookie顶级域名
32
+ * @param hostname
33
+ */
34
+ declare function getCookieTopLevelDomain(hostname?: string): string;
35
+ /**
36
+ * 获取当前页面的domain
37
+ * 注意这里的domain,并不是普通的window.location.hostname值,而是拥有相同子域名的域名,因为浏览器的cookie是二级域名共享的
38
+ */
39
+ declare function getCurrentDomain(): string;
40
+ /**
41
+ * 获取当前页面的referrer
42
+ */
43
+ declare function getReferrer(value?: string): string;
44
+ /**
45
+ * 获取hostname
46
+ * @param url
47
+ * @param defaultValue
48
+ */
49
+ declare function getHostname(url: string, defaultValue?: string): string;
50
+ /**
51
+ * 此函数有两个作用
52
+ * 1:referrer为空时,直接返回true
53
+ * 2:referrer不为空时,判断是否是外链流量 document.referrer对应的hostname是否和当前URL的hostname是否相同
54
+ * @param referrer
55
+ */
56
+ declare function isReferralTraffic(referrer?: string): boolean;
57
+ /**
58
+ * 获取浏览器scrollTop
59
+ */
60
+ declare function getScrollTop(): number;
61
+ /**
62
+ * 获取浏览器scrollLeft
63
+ */
64
+ declare function getScrollLeft(): number;
65
+ /**
66
+ * 获取浏览器可视高度
67
+ */
68
+ declare function getScreenHeight(): number;
69
+ /**
70
+ * 获取浏览器可视宽度
71
+ */
72
+ declare function getScreenWidth(): number;
73
+ /**
74
+ * 获取浏览器网络类型
75
+ */
76
+ declare function networkType(): any;
77
+ /**
78
+ * 生成随机数
79
+ */
80
+ declare function getRandom(): string;
81
+ declare class ListenPageState {
82
+ visibleHandler: VoidFn;
83
+ hiddenHandler: VoidFn;
84
+ constructor(payload: {
85
+ visible: VoidFn;
86
+ hidden: VoidFn;
87
+ });
88
+ isSupport(): boolean;
89
+ init(): void;
90
+ }
91
+ declare function generatorUUID(): string;
92
+ /**
93
+ * 查找指定url中的参数
94
+ * replace(/[\[]/, "\\[") 将 [ 替换为 \[。
95
+ * replace(/[\]]/, "\\]") 将 ] 替换为 \]。
96
+ * example[123]=>example\[123\]
97
+ * @param url
98
+ * @param key
99
+ */
100
+ declare function getQueryParam(url: string, key: string): string;
101
+ declare function base64Encode(str: string): string;
102
+ declare function base64Decode(str: string): string;
103
+ declare function handleDecodeURLComponent(val: string): string;
104
+ declare function handleEncodeURLComponent(val: string): string;
105
+ /**
106
+ * 对原生方法进行重写
107
+ * @param source 需要被重写的对象
108
+ * @param name 重写方法名
109
+ * @param replacement 重写方法
110
+ * @param isForced 是否强制重写(可能原先没有该属性)
111
+ */
112
+ declare function replaceOld(source: IAnyObject, name: string, replacement: (...args: any[]) => any, isForced?: boolean): void;
113
+ declare function supportHistory(): boolean;
114
+
115
+ /**
116
+ * cookie 操作
117
+ */
118
+ declare class CookieStorage {
119
+ name: string;
120
+ /**
121
+ * 用于判断是否支持cookie
122
+ * @param testKey
123
+ * @param testValue
124
+ */
125
+ isSupport(testKey?: string, testValue?: string): boolean;
126
+ /**
127
+ * 获取指定的cookie值
128
+ * @param name
129
+ */
130
+ get(name: string): string;
131
+ /**
132
+ * 设置cookie
133
+ * @param name cookie名称
134
+ * @param value cookie值
135
+ * @param timeStamp 过期时间戳 单位s
136
+ * @param path 路径
137
+ * @param domain cookie域名
138
+ * @param sameSite 跨域设置
139
+ * @param secure 是否仅通过 HTTPS 协议传输
140
+ */
141
+ set(name: string, value: string, timeStamp?: number, path?: string, domain?: string, sameSite?: 'Strict' | 'Lax' | 'None', secure?: boolean): void;
142
+ /**
143
+ * 删除指定cookie
144
+ * @param name
145
+ * @param path
146
+ */
147
+ remove(name: string, path?: string): void;
148
+ /**
149
+ * 将cookie设置到当前子域名下,用于跨站共享
150
+ * @param name
151
+ * @param value
152
+ * @param timeStamp
153
+ */
154
+ setDomain(name: string, value: string, timeStamp?: number): void;
155
+ }
156
+ /**
157
+ * localStorage 操作
158
+ */
159
+ declare class LocalStorage {
160
+ name: string;
161
+ /**
162
+ * 判断是否支持localStorage
163
+ */
164
+ isSupport(): boolean;
165
+ key(index: number): string;
166
+ get(key: string): string;
167
+ length(): number;
168
+ set(key: string, value: string): void;
169
+ remove(key: string): void;
170
+ parse(key: string): any;
171
+ }
172
+ /**
173
+ * memoryStorage 操作
174
+ */
175
+ declare class MemoryStorage {
176
+ name: string;
177
+ data: {
178
+ [key: string]: {
179
+ value: string;
180
+ expireTime?: number;
181
+ };
182
+ };
183
+ get(key: string): string;
184
+ /**
185
+ * 存储数据
186
+ * @param key
187
+ * @param value
188
+ * @param expires 单位 s
189
+ */
190
+ set(key: string, value: string, expires?: number): void;
191
+ setDomain(name: string, value: string, timeStamp?: number): void;
192
+ }
193
+
194
+ declare function isElement(val: any): boolean;
195
+ /**
196
+ * 获取指定元素以及其父元素组成的路径
197
+ * @param element
198
+ */
199
+ declare function getElementParents(element: Element): Element[];
200
+ /**
201
+ * 获取input元素的内容
202
+ * @param element
203
+ * @param isCollectInput 是否采集input
204
+ */
205
+ declare function getInputElementContent(element: HTMLInputElement, isCollectInput: boolean): string;
206
+ /**
207
+ * 获取元素信息
208
+ * @param element 元素
209
+ * @param isCollectInput 是否采集input
210
+ */
211
+ declare function getElementProperties(element: Element, isCollectInput: boolean): ElementProperties;
212
+ /**
213
+ * 获取页面信息
214
+ */
215
+ declare function getPageProperties(): PageProperties;
216
+
217
+ declare const MAX_REFERRER_STRING_LENGTH = 2000;
218
+ declare const MAX_STRING_LENGTH: number;
219
+ declare const PV_LIB_VERSION = "4.0.0";
220
+ declare const EPM_LIB_VERSION = "1.0.0";
221
+ declare const COOKIE_TEST_NAME = "hinasdk_domain_test";
222
+ declare const utmTypes: string[];
223
+ declare const searchTypes: string[];
224
+ declare const socialTypes: string[];
225
+ declare const searchKeywords: IAnyObject;
226
+
227
+ declare class SearchKeyword {
228
+ static getSourceFromReferrer(): "付费广告流量" | "自然搜索流量" | "社交网站流量" | "直接流量" | "引荐流量" | "获取url异常";
229
+ static getReferSearchEngine(referrerUrl: string): string;
230
+ static getKeywordFromReferrer(): any;
231
+ }
232
+ /**
233
+ * 广告参数
234
+ * @param prefix
235
+ */
236
+ declare function getUmtsParams(prefix?: string): IAnyObject;
237
+ declare function getUtm(): IAnyObject;
238
+
239
+ declare function getBrowserInfo(): BrowserInfo;
240
+
241
+ declare abstract class Request {
242
+ options: RequestParams;
243
+ protected constructor(options: RequestParams);
244
+ abstract run(): Promise<{
245
+ type: 'success' | 'error' | 'abort';
246
+ msg?: string;
247
+ }>;
248
+ }
249
+ /**
250
+ * 图片请求
251
+ */
252
+ declare class ImageRequest extends Request {
253
+ options: RequestParams;
254
+ constructor(options: RequestParams);
255
+ run(): Promise<{
256
+ type: 'success' | 'error' | 'abort';
257
+ }>;
258
+ }
259
+ /**
260
+ * ajax请求
261
+ */
262
+ declare class AjaxRequest extends Request {
263
+ options: RequestParams;
264
+ constructor(options: RequestParams);
265
+ run(): Promise<{
266
+ type: 'success' | 'error' | 'abort';
267
+ msg?: string;
268
+ }>;
269
+ }
270
+ /**
271
+ * beacon请求
272
+ */
273
+ declare class BeaconRequest extends Request {
274
+ options: RequestParams;
275
+ constructor(options: RequestParams);
276
+ run(): Promise<{
277
+ type: 'success' | 'error' | 'abort';
278
+ msg?: string;
279
+ }>;
280
+ }
281
+
282
+ declare function nextTick(callback: Function, ctx: object, ...args: any[]): Promise<unknown>;
283
+
284
+ declare class Mitt {
285
+ all: Map<string | symbol, Function[]>;
286
+ on<Key extends string | symbol>(type: Key, handler: Function): void;
287
+ emit<Key extends string | symbol>(type: Key, ...args: any[]): void;
288
+ off<Key extends string | symbol>(type: Key, handler?: Function): void;
289
+ }
290
+ declare const mitt: Mitt;
291
+
292
+ declare class State<T extends BaseOptions> {
293
+ options: T;
294
+ storeName: string;
295
+ /**
296
+ * 存储对象
297
+ */
298
+ state: StoreState;
299
+ /**
300
+ * 首次触发事件
301
+ */
302
+ isFirstTime: boolean;
303
+ /**
304
+ * 首日触发事件
305
+ */
306
+ isFirstDay: boolean;
307
+ /**
308
+ * 是否设置第一次访问属性
309
+ */
310
+ isSetFirstVisit: boolean;
311
+ /**
312
+ * cookie 存储,提供相同子域名间的数据共享
313
+ */
314
+ storage: CookieStorage | MemoryStorage;
315
+ /**
316
+ * localStorage 存储,用于存储一些临时数据
317
+ */
318
+ localStorage: LocalStorage;
319
+ constructor(options: T);
320
+ log(message: any, type?: ConsoleTypes): void;
321
+ /**
322
+ * 初始化存储
323
+ */
324
+ init(): void;
325
+ /**
326
+ * 清空state数据
327
+ */
328
+ clear(): void;
329
+ /**
330
+ * 缓存state数据
331
+ */
332
+ save(): void;
333
+ /**
334
+ * 设置共享数据
335
+ * @param name
336
+ * @param value
337
+ */
338
+ set(name: keyof StoreState, value: any): void;
339
+ /**
340
+ * 检查设置值是否合法
341
+ * @param name
342
+ * @param value
343
+ */
344
+ checkSetValue(name: string, value: any): boolean;
345
+ /**
346
+ * 设置deviceId
347
+ * @param id
348
+ */
349
+ setDeviceId(id?: string): void;
350
+ /**
351
+ * 设置账号id
352
+ * @param id
353
+ */
354
+ setAccountId(id?: string): void;
355
+ /**
356
+ * 设置匿名id
357
+ * @param id
358
+ */
359
+ setAnonymousId(id: string): void;
360
+ /**
361
+ * 设置广告参数
362
+ * @param props
363
+ */
364
+ setProps(props: IAnyObject): void;
365
+ /**
366
+ * 获取匿名ID
367
+ */
368
+ getAnonymousId(): string;
369
+ /**
370
+ * 获取设备ID
371
+ */
372
+ getDeviceId(): string;
373
+ /**
374
+ * 获取账户ID
375
+ */
376
+ getAccountId(): string;
377
+ /**
378
+ * 获取cookie值
379
+ */
380
+ getCookie(): string;
381
+ }
382
+
383
+ /**
384
+ * 是否支持console
385
+ */
386
+ declare function supportConsole(): boolean;
387
+ /**
388
+ * 打印日志
389
+ * @param message
390
+ * @param type
391
+ */
392
+ declare function log(message: any, type?: ConsoleTypes): void;
393
+
394
+ export { AjaxRequest, BeaconRequest, COOKIE_TEST_NAME, CookieStorage, EPM_LIB_VERSION, ImageRequest, ListenPageState, LocalStorage, MAX_REFERRER_STRING_LENGTH, MAX_STRING_LENGTH, MemoryStorage, PV_LIB_VERSION, Request, SearchKeyword, State, base64Decode, base64Encode, formatDecimal, generatorUUID, getBrowserInfo, getCookieTopLevelDomain, getCurrentDomain, getElementParents, getElementProperties, getHostname, getInputElementContent, getPageProperties, getQueryParam, getRandom, getReferrer, getScreenHeight, getScreenWidth, getScrollLeft, getScrollTop, getURL, getURLSearchParams, getUmtsParams, getUtm, handleDecodeURLComponent, handleEncodeURLComponent, isArray, isBoolean, isDate, isElement, isEmptyObject, isFunction, isJSONString, isNumber, isObject, isReferralTraffic, isString, isUndefined, isValid, log, merge, mitt, networkType, nextTick, noop, nowStamp, replaceOld, safeJSONParse, searchKeywords, searchTypes, socialTypes, stripEmptyProperties, supportConsole, supportHistory, utmTypes };