@ohbug/extension-uuid 1.0.14 → 2.0.0
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/README.md +2 -3
- package/dist/index.d.ts +166 -2
- package/dist/index.js +102 -0
- package/dist/index.mjs +78 -0
- package/package.json +19 -21
- package/src/cookie.ts +60 -0
- package/src/extension.ts +11 -0
- package/src/index.ts +3 -0
- package/src/uuid.ts +24 -0
- package/dist/cookie.d.ts +0 -6
- package/dist/cookie.d.ts.map +0 -1
- package/dist/extension.d.ts +0 -2
- package/dist/extension.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/ohbug-extension-uuid.es.js +0 -29
- package/dist/ohbug-extension-uuid.umd.js +0 -29
- package/dist/uuid.d.ts +0 -2
- package/dist/uuid.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@ohbug/extension-uuid)
|
|
4
4
|
[](https://bundlephobia.com/result?p=@ohbug/extension-uuid)
|
|
5
|
-
[](https://github.com/prettier/prettier)
|
|
6
5
|
|
|
7
6
|
## Installation
|
|
8
7
|
|
|
9
8
|
```
|
|
10
|
-
|
|
9
|
+
pnpm instal @ohbug/extension-uuid
|
|
11
10
|
```
|
|
12
11
|
|
|
13
12
|
## Usage
|
|
@@ -16,6 +15,6 @@ yarn add @ohbug/extension-uuid
|
|
|
16
15
|
import Ohbug from '@ohbug/browser'
|
|
17
16
|
import OhbugExtensionUUID from '@ohbug/extension-uuid'
|
|
18
17
|
|
|
19
|
-
const client = Ohbug.
|
|
18
|
+
const client = Ohbug.setup({ apiKey: 'YOUR_API_KEY' })
|
|
20
19
|
client.use(OhbugExtensionUUID)
|
|
21
20
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,166 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
interface OhbugAction {
|
|
2
|
+
type: string
|
|
3
|
+
timestamp: string
|
|
4
|
+
message?: string
|
|
5
|
+
data?: Record<string, any>
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface OhbugDevice {
|
|
9
|
+
// browser
|
|
10
|
+
language?: string
|
|
11
|
+
userAgent?: string
|
|
12
|
+
title?: string
|
|
13
|
+
url?: string
|
|
14
|
+
|
|
15
|
+
[key: string]: any
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type OhbugGetDevice = (client?: OhbugClient) => OhbugDevice
|
|
19
|
+
|
|
20
|
+
interface OhbugUser {
|
|
21
|
+
uuid?: string
|
|
22
|
+
ip_address?: string
|
|
23
|
+
id?: number | string
|
|
24
|
+
name?: string
|
|
25
|
+
email?: string
|
|
26
|
+
[key: string]: any
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type OhbugMetaData = Record<string, any>
|
|
30
|
+
|
|
31
|
+
type OhbugReleaseStage = 'development' | 'production' | string
|
|
32
|
+
type OhbugCategory =
|
|
33
|
+
| 'error'
|
|
34
|
+
| 'message'
|
|
35
|
+
| 'feedback'
|
|
36
|
+
| 'view'
|
|
37
|
+
| 'performance'
|
|
38
|
+
| 'other'
|
|
39
|
+
interface OhbugSDK {
|
|
40
|
+
platform: string
|
|
41
|
+
version: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface OhbugEvent<D> {
|
|
45
|
+
apiKey: string
|
|
46
|
+
appVersion?: string
|
|
47
|
+
appType?: string
|
|
48
|
+
releaseStage?: OhbugReleaseStage
|
|
49
|
+
timestamp: string
|
|
50
|
+
category?: OhbugCategory
|
|
51
|
+
type: string
|
|
52
|
+
sdk: OhbugSDK
|
|
53
|
+
|
|
54
|
+
detail: D
|
|
55
|
+
device: OhbugDevice
|
|
56
|
+
user?: OhbugUser
|
|
57
|
+
actions?: OhbugAction[]
|
|
58
|
+
metaData?: OhbugMetaData
|
|
59
|
+
}
|
|
60
|
+
interface OhbugEventWithMethods<D> extends OhbugEvent<D> {
|
|
61
|
+
addAction: (
|
|
62
|
+
message: string,
|
|
63
|
+
data: Record<string, any>,
|
|
64
|
+
type: string,
|
|
65
|
+
timestamp?: string
|
|
66
|
+
) => void
|
|
67
|
+
getUser: () => OhbugUser | undefined
|
|
68
|
+
setUser: (user: OhbugUser) => OhbugUser | undefined
|
|
69
|
+
addMetaData: (section: string, data: any) => any
|
|
70
|
+
getMetaData: (section: string) => any
|
|
71
|
+
deleteMetaData: (section: string) => any
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface OhbugCreateEvent<D> {
|
|
75
|
+
category?: OhbugCategory
|
|
76
|
+
type: string
|
|
77
|
+
detail: D
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface OhbugExtension {
|
|
81
|
+
name: string
|
|
82
|
+
setup?: (client: OhbugClient, ...args: any[]) => void
|
|
83
|
+
created?: <D = any>(
|
|
84
|
+
event: OhbugEventWithMethods<D>,
|
|
85
|
+
client: OhbugClient
|
|
86
|
+
) => OhbugEventWithMethods<D> | null
|
|
87
|
+
notified?: <D = any>(
|
|
88
|
+
event: OhbugEventWithMethods<D>,
|
|
89
|
+
client: OhbugClient
|
|
90
|
+
) => void
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface OhbugLoggerConfig {
|
|
94
|
+
log: (...args: any[]) => void
|
|
95
|
+
info: (...args: any[]) => void
|
|
96
|
+
warn: (...args: any[]) => void
|
|
97
|
+
error: (...args: any[]) => void
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
interface OhbugConfig {
|
|
101
|
+
// base
|
|
102
|
+
apiKey: string
|
|
103
|
+
appVersion?: string
|
|
104
|
+
appType?: string
|
|
105
|
+
releaseStage?: OhbugReleaseStage
|
|
106
|
+
endpoint?: string
|
|
107
|
+
maxActions?: number
|
|
108
|
+
// hooks
|
|
109
|
+
created?: <D = any>(
|
|
110
|
+
event: OhbugEventWithMethods<D>,
|
|
111
|
+
client: OhbugClient
|
|
112
|
+
) => OhbugEventWithMethods<D> | null
|
|
113
|
+
notified?: <D = any>(
|
|
114
|
+
event: OhbugEventWithMethods<D>,
|
|
115
|
+
client: OhbugClient
|
|
116
|
+
) => void
|
|
117
|
+
// data
|
|
118
|
+
user?: OhbugUser
|
|
119
|
+
metaData?: OhbugMetaData
|
|
120
|
+
// utils
|
|
121
|
+
logger?: OhbugLoggerConfig
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
type OhbugNotifier = <D = any>(
|
|
125
|
+
event: OhbugEventWithMethods<D>
|
|
126
|
+
) => Promise<any> | any
|
|
127
|
+
|
|
128
|
+
interface OhbugClient {
|
|
129
|
+
readonly __sdk: OhbugSDK
|
|
130
|
+
readonly __config: OhbugConfig
|
|
131
|
+
readonly __logger: OhbugLoggerConfig
|
|
132
|
+
readonly __device: OhbugGetDevice
|
|
133
|
+
readonly __notifier: OhbugNotifier
|
|
134
|
+
|
|
135
|
+
readonly __extensions: OhbugExtension[]
|
|
136
|
+
|
|
137
|
+
readonly __actions: OhbugAction[]
|
|
138
|
+
__user: OhbugUser
|
|
139
|
+
readonly __metaData: OhbugMetaData
|
|
140
|
+
|
|
141
|
+
use: (extension: OhbugExtension) => OhbugClient
|
|
142
|
+
createEvent: <D = any>(
|
|
143
|
+
value: OhbugCreateEvent<D>
|
|
144
|
+
) => OhbugEventWithMethods<D> | null
|
|
145
|
+
notify: <D = any>(
|
|
146
|
+
eventLike: any,
|
|
147
|
+
beforeNotify?: (
|
|
148
|
+
event: OhbugEventWithMethods<D> | null
|
|
149
|
+
) => OhbugEventWithMethods<D> | null
|
|
150
|
+
) => Promise<any | null>
|
|
151
|
+
addAction: (
|
|
152
|
+
message: string,
|
|
153
|
+
data: Record<string, any>,
|
|
154
|
+
type: string,
|
|
155
|
+
timestamp?: string
|
|
156
|
+
) => void
|
|
157
|
+
getUser: () => OhbugUser | undefined
|
|
158
|
+
setUser: (user: OhbugUser) => OhbugUser | undefined
|
|
159
|
+
addMetaData: (section: string, data: any) => any
|
|
160
|
+
getMetaData: (section: string) => any
|
|
161
|
+
deleteMetaData: (section: string) => any
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
declare const extension: OhbugExtension;
|
|
165
|
+
|
|
166
|
+
export { extension as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key2 of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
|
13
|
+
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/index.ts
|
|
20
|
+
var src_exports = {};
|
|
21
|
+
__export(src_exports, {
|
|
22
|
+
default: () => src_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(src_exports);
|
|
25
|
+
|
|
26
|
+
// src/extension.ts
|
|
27
|
+
var import_core = require("@ohbug/core");
|
|
28
|
+
|
|
29
|
+
// src/uuid.ts
|
|
30
|
+
var import_uuid = require("uuid");
|
|
31
|
+
var import_utils = require("@ohbug/utils");
|
|
32
|
+
|
|
33
|
+
// src/cookie.ts
|
|
34
|
+
var docCookies = {
|
|
35
|
+
getItem(sKey) {
|
|
36
|
+
return decodeURIComponent(document.cookie.replace(new RegExp(`(?:(?:^|.*;)\\s*${encodeURIComponent(sKey).replace(/[-.+*]/g, "\\$&")}\\s*\\=\\s*([^;]*).*$)|^.*$`), "$1")) || null;
|
|
37
|
+
},
|
|
38
|
+
setItem(sKey, sValue, vEnd, sPath, sDomain, bSecure) {
|
|
39
|
+
if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey))
|
|
40
|
+
return false;
|
|
41
|
+
let sExpires = "";
|
|
42
|
+
if (vEnd) {
|
|
43
|
+
switch (vEnd.constructor) {
|
|
44
|
+
case Number:
|
|
45
|
+
sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : `; max-age=${vEnd}`;
|
|
46
|
+
break;
|
|
47
|
+
case String:
|
|
48
|
+
sExpires = `; expires=${vEnd}`;
|
|
49
|
+
break;
|
|
50
|
+
case Date:
|
|
51
|
+
sExpires = `; expires=${vEnd.toUTCString()}`;
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const value = `${encodeURIComponent(sKey)}=${encodeURIComponent(sValue)}${sExpires}${sDomain ? `; domain=${sDomain}` : ""}${sPath ? `; path=${sPath}` : ""}${bSecure ? "; secure" : ""}`;
|
|
58
|
+
document.cookie = value;
|
|
59
|
+
return value;
|
|
60
|
+
},
|
|
61
|
+
removeItem(sKey, sPath, sDomain) {
|
|
62
|
+
if (!sKey || !this.getItem(sKey))
|
|
63
|
+
return false;
|
|
64
|
+
document.cookie = `${encodeURIComponent(sKey)}=; expires=Thu, 01 Jan 1970 00:00:00 GMT${sDomain ? `; domain=${sDomain}` : ""}${sPath ? `; path=${sPath}` : ""}`;
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/uuid.ts
|
|
70
|
+
var key = "OhbugUUID";
|
|
71
|
+
function getUUID() {
|
|
72
|
+
if ((0, import_utils.isBrowser)()) {
|
|
73
|
+
const UUID = docCookies.getItem(key);
|
|
74
|
+
if (!UUID) {
|
|
75
|
+
const extraTime = 60 * 30 * 24 * 3600 * 1e3;
|
|
76
|
+
const endTime = new Date();
|
|
77
|
+
endTime.setTime(endTime.getTime() + extraTime);
|
|
78
|
+
const uuid = (0, import_uuid.v4)();
|
|
79
|
+
docCookies.setItem(key, uuid, endTime);
|
|
80
|
+
return uuid;
|
|
81
|
+
}
|
|
82
|
+
return UUID;
|
|
83
|
+
}
|
|
84
|
+
if ((0, import_utils.isNode)())
|
|
85
|
+
return (0, import_uuid.v4)();
|
|
86
|
+
return "";
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// src/extension.ts
|
|
90
|
+
var extension = (0, import_core.defineExtension)({
|
|
91
|
+
name: "OhbugExtensionUUID",
|
|
92
|
+
created: (event) => {
|
|
93
|
+
const uuid = getUUID();
|
|
94
|
+
event.setUser({ uuid });
|
|
95
|
+
return event;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// src/index.ts
|
|
100
|
+
var src_default = extension;
|
|
101
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
+
0 && (module.exports = {});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// src/extension.ts
|
|
2
|
+
import { defineExtension } from "@ohbug/core";
|
|
3
|
+
|
|
4
|
+
// src/uuid.ts
|
|
5
|
+
import { v4 as uuidv4 } from "uuid";
|
|
6
|
+
import { isBrowser, isNode } from "@ohbug/utils";
|
|
7
|
+
|
|
8
|
+
// src/cookie.ts
|
|
9
|
+
var docCookies = {
|
|
10
|
+
getItem(sKey) {
|
|
11
|
+
return decodeURIComponent(document.cookie.replace(new RegExp(`(?:(?:^|.*;)\\s*${encodeURIComponent(sKey).replace(/[-.+*]/g, "\\$&")}\\s*\\=\\s*([^;]*).*$)|^.*$`), "$1")) || null;
|
|
12
|
+
},
|
|
13
|
+
setItem(sKey, sValue, vEnd, sPath, sDomain, bSecure) {
|
|
14
|
+
if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey))
|
|
15
|
+
return false;
|
|
16
|
+
let sExpires = "";
|
|
17
|
+
if (vEnd) {
|
|
18
|
+
switch (vEnd.constructor) {
|
|
19
|
+
case Number:
|
|
20
|
+
sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : `; max-age=${vEnd}`;
|
|
21
|
+
break;
|
|
22
|
+
case String:
|
|
23
|
+
sExpires = `; expires=${vEnd}`;
|
|
24
|
+
break;
|
|
25
|
+
case Date:
|
|
26
|
+
sExpires = `; expires=${vEnd.toUTCString()}`;
|
|
27
|
+
break;
|
|
28
|
+
default:
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const value = `${encodeURIComponent(sKey)}=${encodeURIComponent(sValue)}${sExpires}${sDomain ? `; domain=${sDomain}` : ""}${sPath ? `; path=${sPath}` : ""}${bSecure ? "; secure" : ""}`;
|
|
33
|
+
document.cookie = value;
|
|
34
|
+
return value;
|
|
35
|
+
},
|
|
36
|
+
removeItem(sKey, sPath, sDomain) {
|
|
37
|
+
if (!sKey || !this.getItem(sKey))
|
|
38
|
+
return false;
|
|
39
|
+
document.cookie = `${encodeURIComponent(sKey)}=; expires=Thu, 01 Jan 1970 00:00:00 GMT${sDomain ? `; domain=${sDomain}` : ""}${sPath ? `; path=${sPath}` : ""}`;
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// src/uuid.ts
|
|
45
|
+
var key = "OhbugUUID";
|
|
46
|
+
function getUUID() {
|
|
47
|
+
if (isBrowser()) {
|
|
48
|
+
const UUID = docCookies.getItem(key);
|
|
49
|
+
if (!UUID) {
|
|
50
|
+
const extraTime = 60 * 30 * 24 * 3600 * 1e3;
|
|
51
|
+
const endTime = new Date();
|
|
52
|
+
endTime.setTime(endTime.getTime() + extraTime);
|
|
53
|
+
const uuid = uuidv4();
|
|
54
|
+
docCookies.setItem(key, uuid, endTime);
|
|
55
|
+
return uuid;
|
|
56
|
+
}
|
|
57
|
+
return UUID;
|
|
58
|
+
}
|
|
59
|
+
if (isNode())
|
|
60
|
+
return uuidv4();
|
|
61
|
+
return "";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/extension.ts
|
|
65
|
+
var extension = defineExtension({
|
|
66
|
+
name: "OhbugExtensionUUID",
|
|
67
|
+
created: (event) => {
|
|
68
|
+
const uuid = getUUID();
|
|
69
|
+
event.setUser({ uuid });
|
|
70
|
+
return event;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// src/index.ts
|
|
75
|
+
var src_default = extension;
|
|
76
|
+
export {
|
|
77
|
+
src_default as default
|
|
78
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohbug/extension-uuid",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Ohbug extension to add uuid",
|
|
5
|
+
"license": "Apache-2.0",
|
|
5
6
|
"author": "chenyueban <jasonchan0527@gmail.com>",
|
|
6
7
|
"homepage": "https://github.com/ohbug-org/ohbug",
|
|
7
8
|
"bugs": {
|
|
@@ -11,38 +12,35 @@
|
|
|
11
12
|
"type": "git",
|
|
12
13
|
"url": "https://github.com/ohbug-org/ohbug"
|
|
13
14
|
},
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"unpkg": "./dist/ohbug-extension-uuid.umd.js",
|
|
18
|
-
"jsdelivr": "./dist/ohbug-extension-uuid.umd.js",
|
|
19
|
-
"types": "./dist/index.d.ts",
|
|
15
|
+
"main": "dist/index.js",
|
|
16
|
+
"module": "dist/index.mjs",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
20
18
|
"exports": {
|
|
21
19
|
".": {
|
|
22
|
-
"
|
|
23
|
-
"
|
|
20
|
+
"require": "./dist/index.js",
|
|
21
|
+
"import": "./dist/index.mjs",
|
|
22
|
+
"types": "./dist/index.d.ts"
|
|
24
23
|
}
|
|
25
24
|
},
|
|
26
25
|
"files": [
|
|
27
|
-
"dist"
|
|
26
|
+
"dist",
|
|
27
|
+
"src"
|
|
28
28
|
],
|
|
29
|
+
"sideEffects": false,
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@ohbug/core": "
|
|
31
|
-
"@ohbug/utils": "
|
|
31
|
+
"@ohbug/core": "2.0.0",
|
|
32
|
+
"@ohbug/utils": "2.0.0",
|
|
32
33
|
"uuid": "^8.3.2"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@types/uuid": "^8.0.0"
|
|
36
37
|
},
|
|
37
|
-
"buildOptions": {
|
|
38
|
-
"name": "OhbugExtensionUUID",
|
|
39
|
-
"formats": [
|
|
40
|
-
"es",
|
|
41
|
-
"umd"
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
38
|
"publishConfig": {
|
|
45
39
|
"access": "public"
|
|
46
40
|
},
|
|
47
|
-
"
|
|
48
|
-
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsup",
|
|
43
|
+
"dev": "tsup --watch"
|
|
44
|
+
},
|
|
45
|
+
"readme": "# `@ohbug/extension-uuid`\n\n[](https://www.npmjs.com/package/@ohbug/extension-uuid)\n[](https://bundlephobia.com/result?p=@ohbug/extension-uuid)\n\n## Installation\n\n```\npnpm instal @ohbug/extension-uuid\n```\n\n## Usage\n\n```javascript\nimport Ohbug from '@ohbug/browser'\nimport OhbugExtensionUUID from '@ohbug/extension-uuid'\n\nconst client = Ohbug.setup({ apiKey: 'YOUR_API_KEY' })\nclient.use(OhbugExtensionUUID)\n```\n"
|
|
46
|
+
}
|
package/src/cookie.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// https://developer.mozilla.org/zh-CN/docs/Web/API/Document/cookie
|
|
2
|
+
export const docCookies = {
|
|
3
|
+
getItem(sKey: string): string | null {
|
|
4
|
+
return (
|
|
5
|
+
decodeURIComponent(document.cookie.replace(
|
|
6
|
+
new RegExp(`(?:(?:^|.*;)\\s*${encodeURIComponent(sKey).replace(
|
|
7
|
+
/[-.+*]/g,
|
|
8
|
+
'\\$&',
|
|
9
|
+
)}\\s*\\=\\s*([^;]*).*$)|^.*$`),
|
|
10
|
+
'$1',
|
|
11
|
+
)) || null
|
|
12
|
+
)
|
|
13
|
+
},
|
|
14
|
+
setItem(
|
|
15
|
+
sKey: string,
|
|
16
|
+
sValue: string,
|
|
17
|
+
vEnd?: number | string | Date,
|
|
18
|
+
sPath?: string,
|
|
19
|
+
sDomain?: string,
|
|
20
|
+
bSecure?: boolean,
|
|
21
|
+
): string | false {
|
|
22
|
+
if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey))
|
|
23
|
+
return false
|
|
24
|
+
|
|
25
|
+
let sExpires = ''
|
|
26
|
+
if (vEnd) {
|
|
27
|
+
switch (vEnd.constructor) {
|
|
28
|
+
case Number:
|
|
29
|
+
sExpires
|
|
30
|
+
= vEnd === Infinity
|
|
31
|
+
? '; expires=Fri, 31 Dec 9999 23:59:59 GMT'
|
|
32
|
+
: `; max-age=${vEnd}`
|
|
33
|
+
break
|
|
34
|
+
case String:
|
|
35
|
+
sExpires = `; expires=${vEnd}`
|
|
36
|
+
break
|
|
37
|
+
case Date:
|
|
38
|
+
sExpires = `; expires=${(vEnd as Date).toUTCString()}`
|
|
39
|
+
break
|
|
40
|
+
default:
|
|
41
|
+
break
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const value = `${encodeURIComponent(sKey)}=${encodeURIComponent(sValue)}${sExpires}${sDomain ? `; domain=${sDomain}` : ''}${
|
|
45
|
+
sPath ? `; path=${sPath}` : ''
|
|
46
|
+
}${bSecure ? '; secure' : ''}`
|
|
47
|
+
document.cookie = value
|
|
48
|
+
|
|
49
|
+
return value
|
|
50
|
+
},
|
|
51
|
+
removeItem(sKey: string, sPath?: string, sDomain?: string) {
|
|
52
|
+
if (!sKey || !this.getItem(sKey))
|
|
53
|
+
return false
|
|
54
|
+
|
|
55
|
+
document.cookie = `${encodeURIComponent(sKey)}=; expires=Thu, 01 Jan 1970 00:00:00 GMT${
|
|
56
|
+
sDomain ? `; domain=${sDomain}` : ''
|
|
57
|
+
}${sPath ? `; path=${sPath}` : ''}`
|
|
58
|
+
return true
|
|
59
|
+
},
|
|
60
|
+
}
|
package/src/extension.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineExtension } from '@ohbug/core'
|
|
2
|
+
import { getUUID } from './uuid'
|
|
3
|
+
|
|
4
|
+
export const extension = defineExtension({
|
|
5
|
+
name: 'OhbugExtensionUUID',
|
|
6
|
+
created: (event) => {
|
|
7
|
+
const uuid = getUUID()
|
|
8
|
+
event.setUser({ uuid })
|
|
9
|
+
return event
|
|
10
|
+
},
|
|
11
|
+
})
|
package/src/index.ts
ADDED
package/src/uuid.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid'
|
|
2
|
+
import { isBrowser, isNode } from '@ohbug/utils'
|
|
3
|
+
import { docCookies } from './cookie'
|
|
4
|
+
|
|
5
|
+
const key = 'OhbugUUID'
|
|
6
|
+
|
|
7
|
+
export function getUUID(): string {
|
|
8
|
+
if (isBrowser()) {
|
|
9
|
+
const UUID = docCookies.getItem(key)
|
|
10
|
+
if (!UUID) {
|
|
11
|
+
const extraTime = 60 * 30 * 24 * 3600 * 1000 // 30天后过期
|
|
12
|
+
const endTime = new Date()
|
|
13
|
+
endTime.setTime(endTime.getTime() + extraTime)
|
|
14
|
+
const uuid = uuidv4()
|
|
15
|
+
docCookies.setItem(key, uuid, endTime)
|
|
16
|
+
return uuid
|
|
17
|
+
}
|
|
18
|
+
return UUID
|
|
19
|
+
}
|
|
20
|
+
if (isNode())
|
|
21
|
+
return uuidv4()
|
|
22
|
+
|
|
23
|
+
return ''
|
|
24
|
+
}
|
package/dist/cookie.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const docCookies: {
|
|
2
|
-
getItem(sKey: string): string | null;
|
|
3
|
-
setItem(sKey: string, sValue: string, vEnd?: string | number | Date | undefined, sPath?: string | undefined, sDomain?: string | undefined, bSecure?: boolean | undefined): string | false;
|
|
4
|
-
removeItem(sKey: string, sPath?: string | undefined, sDomain?: string | undefined): boolean;
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=cookie.d.ts.map
|
package/dist/cookie.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../src/cookie.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU;kBACP,MAAM,GAAG,MAAM,GAAG,IAAI;kBAgB5B,MAAM,UACJ,MAAM,uIAKb,MAAM,GAAG,KAAK;qBAiCA,MAAM;CAWxB,CAAA"}
|
package/dist/extension.d.ts
DELETED
package/dist/extension.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,4CASpB,CAAA"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*! *****************************************************************************
|
|
2
|
-
Copyright (c) Microsoft Corporation.
|
|
3
|
-
|
|
4
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
purpose with or without fee is hereby granted.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
***************************************************************************** */
|
|
15
|
-
var e=function(){return(e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function t(e){return"string"==typeof e}var r,n=function(e,t,r,n){this.type=r,this.timestamp=n||(new Date).toISOString(),this.message=e,this.data=t};!function(){function r(e,t){var r=e.apiKey,n=e.appVersion,a=e.appType,o=e.releaseStage,i=e.timestamp,s=e.category,u=e.type,p=e.sdk,c=e.detail,d=e.device,f=e.user,g=e.actions,h=e.metaData;this.apiKey=r,this.appVersion=n,this.appType=a,this.releaseStage=o,this.timestamp=i,this.category=s,this.type=u,this.sdk=p,this.detail=c,this.device=d,this.user=f,this.actions=g,this.metaData=h,this._client=t}Object.defineProperty(r.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),r.prototype.addAction=function(e,r,a,o){var i,s,u=this.actions,p=t(e)?e:"",c=r||{},d=t(a)?a:"",f=new n(p,c,d,o);u.length>=(null!==(s=null===(i=this._client)||void 0===i?void 0:i._config.maxActions)&&void 0!==s?s:30)&&u.shift(),u.push(f)},r.prototype.getUser=function(){return this.user},r.prototype.setUser=function(t){var r;if(function(e){return"[object Object]"===Object.prototype.toString.call(e)}(t)&&Object.keys(t).length<=6)return this.user=e(e({},this.user),t),this.getUser();null===(r=this._client)||void 0===r||r._logger.warn(function(e,t){return new Error("Invalid data\n- "+e+", got "+JSON.stringify(t))}("setUser should be an object and have up to 6 attributes",t))},r.prototype.addMetaData=function(e,t){return function(e,t,r){t&&(e[t]=r)}(this.metaData,e,t)},r.prototype.getMetaData=function(e){return function(e,t){if(e[t])return e[t]}(this.metaData,e)},r.prototype.deleteMetaData=function(e){return function(e,t){if(e[t])return delete e[t]}(this.metaData,e)},r.prototype.toJSON=function(){var e=this;return{apiKey:e.apiKey,appVersion:e.appVersion,appType:e.appType,timestamp:e.timestamp,category:e.category,type:e.type,sdk:e.sdk,device:e.device,detail:e.detail,user:e.user,actions:e.actions,metaData:e.metaData,releaseStage:e.releaseStage}}}(),Object.freeze({__proto__:null,UNCAUGHT_ERROR:"uncaughtError",RESOURCE_ERROR:"resourceError",UNHANDLEDREJECTION_ERROR:"unhandledrejectionError",AJAX_ERROR:"ajaxError",FETCH_ERROR:"fetchError",WEBSOCKET_ERROR:"websocketError",UNKNOWN_ERROR:"unknownError",MESSAGE:"message",FEEDBACK:"feedback",VIEW:"view",REACT:"react",VUE:"vue",ANGULAR:"angular",MINIAPP_ERROR:"miniappError",MINIAPP_UNHANDLEDREJECTION_ERROR:"miniappUnhandledrejectionError",MINIAPP_PAGENOTFOUND_ERROR:"miniappPagenotfoundError",MINIAPP_MEMORYWARNING_ERROR:"miniappMemorywarningError"});var a=new Uint8Array(16);function o(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(a)}var i=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function s(e){return"string"==typeof e&&i.test(e)}for(var u=[],p=0;p<256;++p)u.push((p+256).toString(16).substr(1));function c(e,t,r){var n=(e=e||{}).random||(e.rng||o)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var a=0;a<16;++a)t[r+a]=n[a];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(u[e[t+0]]+u[e[t+1]]+u[e[t+2]]+u[e[t+3]]+"-"+u[e[t+4]]+u[e[t+5]]+"-"+u[e[t+6]]+u[e[t+7]]+"-"+u[e[t+8]]+u[e[t+9]]+"-"+u[e[t+10]]+u[e[t+11]]+u[e[t+12]]+u[e[t+13]]+u[e[t+14]]+u[e[t+15]]).toLowerCase();if(!s(r))throw TypeError("Stringified UUID is invalid");return r}(n)}
|
|
16
|
-
/*! *****************************************************************************
|
|
17
|
-
Copyright (c) Microsoft Corporation.
|
|
18
|
-
|
|
19
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
20
|
-
purpose with or without fee is hereby granted.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
24
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
25
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
26
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
27
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
29
|
-
***************************************************************************** */var d=function(e){return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(e).replace(/[-.+*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},f=function(e,t,r,n,a,o){if(!e||/^(?:expires|max\-age|path|domain|secure)$/i.test(e))return!1;var i="";if(r)switch(r.constructor){case Number:i=r===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+r;break;case String:i="; expires="+r;break;case Date:i="; expires="+r.toUTCString()}var s=encodeURIComponent(e)+"="+encodeURIComponent(t)+i+(a?"; domain="+a:"")+(n?"; path="+n:"")+(o?"; secure":"");return document.cookie=s,s};function g(){if("undefined"!=typeof window){var e=d("OhbugUUID");if(!e){var t=new Date;t.setTime(t.getTime()+15552e7);var r=c();return f("OhbugUUID",r,t),r}return e}return"undefined"!=typeof global?c():""}var h={name:"OhbugExtensionUUID",created:function(e){var t=g();return e.setUser({uuid:t}),e}};export{h as default};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).OhbugExtensionUUID=t()}(this,(function(){"use strict";
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var e=function(){return(e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function t(e){return"string"==typeof e}var r,n=function(e,t,r,n){this.type=r,this.timestamp=n||(new Date).toISOString(),this.message=e,this.data=t};!function(){function r(e,t){var r=e.apiKey,n=e.appVersion,o=e.appType,i=e.releaseStage,a=e.timestamp,s=e.category,u=e.type,p=e.sdk,c=e.detail,f=e.device,d=e.user,h=e.actions,l=e.metaData;this.apiKey=r,this.appVersion=n,this.appType=o,this.releaseStage=i,this.timestamp=a,this.category=s,this.type=u,this.sdk=p,this.detail=c,this.device=f,this.user=d,this.actions=h,this.metaData=l,this._client=t}Object.defineProperty(r.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),r.prototype.addAction=function(e,r,o,i){var a,s,u=this.actions,p=t(e)?e:"",c=r||{},f=t(o)?o:"",d=new n(p,c,f,i);u.length>=(null!==(s=null===(a=this._client)||void 0===a?void 0:a._config.maxActions)&&void 0!==s?s:30)&&u.shift(),u.push(d)},r.prototype.getUser=function(){return this.user},r.prototype.setUser=function(t){var r;if(function(e){return"[object Object]"===Object.prototype.toString.call(e)}(t)&&Object.keys(t).length<=6)return this.user=e(e({},this.user),t),this.getUser();null===(r=this._client)||void 0===r||r._logger.warn(function(e,t){return new Error("Invalid data\n- "+e+", got "+JSON.stringify(t))}("setUser should be an object and have up to 6 attributes",t))},r.prototype.addMetaData=function(e,t){return function(e,t,r){t&&(e[t]=r)}(this.metaData,e,t)},r.prototype.getMetaData=function(e){return function(e,t){if(e[t])return e[t]}(this.metaData,e)},r.prototype.deleteMetaData=function(e){return function(e,t){if(e[t])return delete e[t]}(this.metaData,e)},r.prototype.toJSON=function(){var e=this;return{apiKey:e.apiKey,appVersion:e.appVersion,appType:e.appType,timestamp:e.timestamp,category:e.category,type:e.type,sdk:e.sdk,device:e.device,detail:e.detail,user:e.user,actions:e.actions,metaData:e.metaData,releaseStage:e.releaseStage}}}(),Object.freeze({__proto__:null,UNCAUGHT_ERROR:"uncaughtError",RESOURCE_ERROR:"resourceError",UNHANDLEDREJECTION_ERROR:"unhandledrejectionError",AJAX_ERROR:"ajaxError",FETCH_ERROR:"fetchError",WEBSOCKET_ERROR:"websocketError",UNKNOWN_ERROR:"unknownError",MESSAGE:"message",FEEDBACK:"feedback",VIEW:"view",REACT:"react",VUE:"vue",ANGULAR:"angular",MINIAPP_ERROR:"miniappError",MINIAPP_UNHANDLEDREJECTION_ERROR:"miniappUnhandledrejectionError",MINIAPP_PAGENOTFOUND_ERROR:"miniappPagenotfoundError",MINIAPP_MEMORYWARNING_ERROR:"miniappMemorywarningError"});var o=new Uint8Array(16);function i(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(o)}var a=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function s(e){return"string"==typeof e&&a.test(e)}for(var u=[],p=0;p<256;++p)u.push((p+256).toString(16).substr(1));function c(e,t,r){var n=(e=e||{}).random||(e.rng||i)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=n[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(u[e[t+0]]+u[e[t+1]]+u[e[t+2]]+u[e[t+3]]+"-"+u[e[t+4]]+u[e[t+5]]+"-"+u[e[t+6]]+u[e[t+7]]+"-"+u[e[t+8]]+u[e[t+9]]+"-"+u[e[t+10]]+u[e[t+11]]+u[e[t+12]]+u[e[t+13]]+u[e[t+14]]+u[e[t+15]]).toLowerCase();if(!s(r))throw TypeError("Stringified UUID is invalid");return r}(n)}
|
|
16
|
-
/*! *****************************************************************************
|
|
17
|
-
Copyright (c) Microsoft Corporation.
|
|
18
|
-
|
|
19
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
20
|
-
purpose with or without fee is hereby granted.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
24
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
25
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
26
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
27
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
29
|
-
***************************************************************************** */var f=function(e){return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(e).replace(/[-.+*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},d=function(e,t,r,n,o,i){if(!e||/^(?:expires|max\-age|path|domain|secure)$/i.test(e))return!1;var a="";if(r)switch(r.constructor){case Number:a=r===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+r;break;case String:a="; expires="+r;break;case Date:a="; expires="+r.toUTCString()}var s=encodeURIComponent(e)+"="+encodeURIComponent(t)+a+(o?"; domain="+o:"")+(n?"; path="+n:"")+(i?"; secure":"");return document.cookie=s,s},h="OhbugUUID";function l(){if("undefined"!=typeof window){var e=f(h);if(!e){var t=new Date;t.setTime(t.getTime()+15552e7);var r=c();return d(h,r,t),r}return e}return"undefined"!=typeof global?c():""}return{name:"OhbugExtensionUUID",created:function(e){var t=l();return e.setUser({uuid:t}),e}}}));
|
package/dist/uuid.d.ts
DELETED
package/dist/uuid.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../src/uuid.ts"],"names":[],"mappings":"AAMA,wBAAgB,OAAO,IAAI,MAAM,CAiBhC"}
|