hina-cloud-js-sdk 3.1.8 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. package/dist/hina.cjs.js +1 -0
  2. package/dist/hina.esm.full.js +1 -0
  3. package/dist/hina.esm.js +1 -0
  4. package/dist/hina.full.js +1 -0
  5. package/dist/hina.iife.js +1 -0
  6. package/dist/index.d.ts +411 -0
  7. package/package.json +27 -37
  8. package/readme.md +1 -0
  9. package/.eslintrc.js +0 -12
  10. package/.gitlab-ci.yml +0 -16
  11. package/.vscode/settings.json +0 -5
  12. package/build/hina.cjs.min.js +0 -1
  13. package/build/hina.esm.min.js +0 -1
  14. package/build/hina.min.js +0 -1
  15. package/build/hotAnalyse.min.js +0 -1
  16. package/packages/core/dist/index.cjs.js +0 -64
  17. package/packages/core/dist/index.cjs.js.map +0 -1
  18. package/packages/core/dist/index.d.ts +0 -45
  19. package/packages/core/dist/index.esm.js +0 -62
  20. package/packages/core/dist/index.esm.js.map +0 -1
  21. package/packages/core/dist/index.global.js +0 -1199
  22. package/packages/core/dist/index.global.js.map +0 -1
  23. package/packages/core/dist/index.js +0 -1200
  24. package/packages/core/dist/index.js.map +0 -1
  25. package/packages/monitor/dist/index.cjs.js +0 -150
  26. package/packages/monitor/dist/index.cjs.js.map +0 -1
  27. package/packages/monitor/dist/index.d.ts +0 -35
  28. package/packages/monitor/dist/index.esm.js +0 -145
  29. package/packages/monitor/dist/index.esm.js.map +0 -1
  30. package/packages/monitor/dist/index.global.js +0 -1343
  31. package/packages/monitor/dist/index.global.js.map +0 -1
  32. package/packages/monitor/dist/index.js +0 -1344
  33. package/packages/monitor/dist/index.js.map +0 -1
  34. package/packages/track/dist/index.cjs.js +0 -1930
  35. package/packages/track/dist/index.cjs.js.map +0 -1
  36. package/packages/track/dist/index.d.ts +0 -212
  37. package/packages/track/dist/index.esm.js +0 -1925
  38. package/packages/track/dist/index.esm.js.map +0 -1
  39. package/packages/track/dist/index.global.js +0 -4259
  40. package/packages/track/dist/index.global.js.map +0 -1
  41. package/packages/track/dist/index.js +0 -4260
  42. package/packages/track/dist/index.js.map +0 -1
  43. package/packages/types/dist/index.d.ts +0 -603
  44. package/packages/types/dist/index.esm.js +0 -25
  45. package/packages/types/dist/index.esm.js.map +0 -1
  46. package/packages/utils/dist/index.cjs.js +0 -1535
  47. package/packages/utils/dist/index.cjs.js.map +0 -1
  48. package/packages/utils/dist/index.d.ts +0 -394
  49. package/packages/utils/dist/index.esm.js +0 -1465
  50. package/packages/utils/dist/index.esm.js.map +0 -1
  51. package/packages/utils/dist/index.global.js +0 -2507
  52. package/packages/utils/dist/index.global.js.map +0 -1
  53. package/packages/utils/dist/index.js +0 -2508
  54. package/packages/utils/dist/index.js.map +0 -1
  55. package/report.json +0 -101
  56. package/rollup.config.epm.js +0 -42
  57. package/rollup.config.sdk.js +0 -42
  58. package/sonar-project.properties +0 -3
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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+0,0 @@
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 };