@ohbug/extension-uuid 1.0.14 → 2.0.2
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 +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +17 -20
- 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
|
+
ipAddress?: 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
|
+
onEvent?: <D = any>(
|
|
84
|
+
event: OhbugEventWithMethods<D>,
|
|
85
|
+
client: OhbugClient
|
|
86
|
+
) => OhbugEventWithMethods<D> | null
|
|
87
|
+
onNotify?: <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
|
+
onEvent?: <D = any>(
|
|
110
|
+
event: OhbugEventWithMethods<D>,
|
|
111
|
+
client: OhbugClient
|
|
112
|
+
) => OhbugEventWithMethods<D> | null
|
|
113
|
+
onNotify?: <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 @@
|
|
|
1
|
+
var m=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var k=(e,r)=>{for(var t in r)m(e,t,{get:r[t],enumerable:!0})},b=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of U(r))!l.call(e,o)&&o!==t&&m(e,o,{get:()=>r[o],enumerable:!(n=I(r,o))||n.enumerable});return e};var T=e=>b(m({},"__esModule",{value:!0}),e);var D={};k(D,{default:()=>C});module.exports=T(D);var f=require("@ohbug/core");var a=require("uuid"),s=require("@ohbug/utils");var u={getItem(e){return decodeURIComponent(document.cookie.replace(new RegExp(`(?:(?:^|.*;)\\s*${encodeURIComponent(e).replace(/[-.+*]/g,"\\$&")}\\s*\\=\\s*([^;]*).*$)|^.*$`),"$1"))||null},setItem(e,r,t,n,o,d){if(!e||/^(?:expires|max\-age|path|domain|secure)$/i.test(e))return!1;let i="";if(t)switch(t.constructor){case Number:i=t===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":`; max-age=${t}`;break;case String:i=`; expires=${t}`;break;case Date:i=`; expires=${t.toUTCString()}`;break;default:break}let p=`${encodeURIComponent(e)}=${encodeURIComponent(r)}${i}${o?`; domain=${o}`:""}${n?`; path=${n}`:""}${d?"; secure":""}`;return document.cookie=p,p},removeItem(e,r,t){return!e||!this.getItem(e)?!1:(document.cookie=`${encodeURIComponent(e)}=; expires=Thu, 01 Jan 1970 00:00:00 GMT${t?`; domain=${t}`:""}${r?`; path=${r}`:""}`,!0)}};var g="OhbugUUID";function $(){if((0,s.isBrowser)()){let e=u.getItem(g);if(!e){let t=new Date;t.setTime(t.getTime()+15552e7);let n=(0,a.v4)();return u.setItem(g,n,t),n}return e}return(0,s.isNode)()?(0,a.v4)():""}var x=(0,f.defineExtension)({name:"OhbugExtensionUUID",onEvent:e=>{let r=$();return e.setUser({uuid:r}),e}});var C=x;0&&(module.exports={});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineExtension as I}from"@ohbug/core";import{v4 as a}from"uuid";import{isBrowser as x,isNode as d}from"@ohbug/utils";var m={getItem(e){return decodeURIComponent(document.cookie.replace(new RegExp(`(?:(?:^|.*;)\\s*${encodeURIComponent(e).replace(/[-.+*]/g,"\\$&")}\\s*\\=\\s*([^;]*).*$)|^.*$`),"$1"))||null},setItem(e,r,t,n,c,f){if(!e||/^(?:expires|max\-age|path|domain|secure)$/i.test(e))return!1;let o="";if(t)switch(t.constructor){case Number:o=t===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":`; max-age=${t}`;break;case String:o=`; expires=${t}`;break;case Date:o=`; expires=${t.toUTCString()}`;break;default:break}let u=`${encodeURIComponent(e)}=${encodeURIComponent(r)}${o}${c?`; domain=${c}`:""}${n?`; path=${n}`:""}${f?"; secure":""}`;return document.cookie=u,u},removeItem(e,r,t){return!e||!this.getItem(e)?!1:(document.cookie=`${encodeURIComponent(e)}=; expires=Thu, 01 Jan 1970 00:00:00 GMT${t?`; domain=${t}`:""}${r?`; path=${r}`:""}`,!0)}};var p="OhbugUUID";function g(){if(x()){let e=m.getItem(p);if(!e){let t=new Date;t.setTime(t.getTime()+15552e7);let n=a();return m.setItem(p,n,t),n}return e}return d()?a():""}var $=I({name:"OhbugExtensionUUID",onEvent:e=>{let r=g();return e.setUser({uuid:r}),e}});var w=$;export{w as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohbug/extension-uuid",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
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,34 @@
|
|
|
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
26
|
"dist"
|
|
28
27
|
],
|
|
28
|
+
"sideEffects": false,
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@ohbug/core": "
|
|
31
|
-
"@ohbug/utils": "
|
|
30
|
+
"@ohbug/core": "2.0.2",
|
|
31
|
+
"@ohbug/utils": "2.0.2",
|
|
32
32
|
"uuid": "^8.3.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/uuid": "^8.0.0"
|
|
36
36
|
},
|
|
37
|
-
"buildOptions": {
|
|
38
|
-
"name": "OhbugExtensionUUID",
|
|
39
|
-
"formats": [
|
|
40
|
-
"es",
|
|
41
|
-
"umd"
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
37
|
"publishConfig": {
|
|
45
38
|
"access": "public"
|
|
46
39
|
},
|
|
47
|
-
"
|
|
48
|
-
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsup",
|
|
42
|
+
"dev": "tsup --watch"
|
|
43
|
+
},
|
|
44
|
+
"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"
|
|
45
|
+
}
|
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"}
|