@ohbug/extension-uuid 1.0.12 → 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.
@@ -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 t=function(){return(t=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var a in e=arguments[r])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)};function e(t){return"string"==typeof t}var r,n=function(t,e,r,n){this.type=r,this.timestamp=n||(new Date).toISOString(),this.message=t,this.data=e};!function(){function r(t,e){var r=t.apiKey,n=t.appVersion,a=t.appType,i=t.releaseStage,o=t.timestamp,s=t.category,u=t.type,p=t.sdk,c=t.detail,d=t.device,f=t.user,h=t.actions,g=t.metaData;this.apiKey=r,this.appVersion=n,this.appType=a,this.releaseStage=i,this.timestamp=o,this.category=s,this.type=u,this.sdk=p,this.detail=c,this.device=d,this.user=f,this.actions=h,this.metaData=g,this._client=e}Object.defineProperty(r.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),r.prototype.addAction=function(t,r,a,i){var o,s,u=this.actions,p=e(t)?t:"",c=r||{},d=e(a)?a:"",f=new n(p,c,d,i);u.length>=(null!==(s=null===(o=this._client)||void 0===o?void 0:o._config.maxActions)&&void 0!==s?s:30)&&u.shift(),u.push(f)},r.prototype.getUser=function(){return this.user},r.prototype.setUser=function(e){var r,n,a;if(n=e,"[object Object]"===Object.prototype.toString.call(n)&&Object.keys(e).length<=6)return this.user=t(t({},this.user),e),this.getUser();null===(r=this._client)||void 0===r||r._logger.warn((a=e,new Error("Invalid data\n- "+"setUser should be an object and have up to 6 attributes"+", got "+JSON.stringify(a))))},r.prototype.addMetaData=function(t,e){return function(t,e,r){e&&(t[e]=r)}(this.metaData,t,e)},r.prototype.getMetaData=function(t){return function(t,e){if(t[e])return t[e]}(this.metaData,t)},r.prototype.deleteMetaData=function(t){return function(t,e){if(t[e])return delete t[e]}(this.metaData,t)},r.prototype.toJSON=function(){var t=this;return{apiKey:t.apiKey,appVersion:t.appVersion,appType:t.appType,timestamp:t.timestamp,category:t.category,type:t.type,sdk:t.sdk,device:t.device,detail:t.detail,user:t.user,actions:t.actions,metaData:t.metaData,releaseStage:t.releaseStage}}}();var a=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(a)}var o=/^(?:[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(t){return"string"==typeof t&&o.test(t)}for(var u=[],p=0;p<256;++p)u.push((p+256).toString(16).substr(1));function c(t,e,r){var n=(t=t||{}).random||(t.rng||i)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){r=r||0;for(var a=0;a<16;++a)e[r+a]=n[a];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(u[t[e+0]]+u[t[e+1]]+u[t[e+2]]+u[t[e+3]]+"-"+u[t[e+4]]+u[t[e+5]]+"-"+u[t[e+6]]+u[t[e+7]]+"-"+u[t[e+8]]+u[t[e+9]]+"-"+u[t[e+10]]+u[t[e+11]]+u[t[e+12]]+u[t[e+13]]+u[t[e+14]]+u[t[e+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(t){return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(t).replace(/[-.+*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},f=function(t,e,r,n,a,i){if(!t||/^(?:expires|max\-age|path|domain|secure)$/i.test(t))return!1;var o="";if(r)switch(r.constructor){case Number:o=r===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+r;break;case String:o="; expires="+r;break;case Date:o="; expires="+r.toUTCString()}var s=encodeURIComponent(t)+"="+encodeURIComponent(e)+o+(a?"; domain="+a:"")+(n?"; path="+n:"")+(i?"; secure":"");return document.cookie=s,s};function h(){if("undefined"!=typeof window){var t=d("OhbugUUID");if(!t){var e=new Date;e.setTime(e.getTime()+15552e7);var r=c();return f("OhbugUUID",r,e),r}return t}return"undefined"!=typeof global?c():""}var g={name:"OhbugExtensionUUID",created:function(t){var e=h();return t.setUser({uuid:e}),t}};export default g;
@@ -1,360 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
- typeof define === 'function' && define.amd ? define(factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.OhbugExtensionUUID = factory());
5
- }(this, (function () { 'use strict';
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
-
22
- var __assign = function() {
23
- __assign = Object.assign || function __assign(t) {
24
- for (var s, i = 1, n = arguments.length; i < n; i++) {
25
- s = arguments[i];
26
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
27
- }
28
- return t;
29
- };
30
- return __assign.apply(this, arguments);
31
- };
32
-
33
- function isString(value) {
34
- return typeof value === 'string';
35
- }
36
- function isObject(value) {
37
- return Object.prototype.toString.call(value) === '[object Object]';
38
- }
39
-
40
- function createExtension(extension) {
41
- return extension;
42
- }
43
-
44
- var Action = /** @class */ (function () {
45
- function Action(message, data, type, timestamp) {
46
- this.type = type;
47
- this.timestamp = timestamp || new Date().toISOString();
48
- this.message = message;
49
- this.data = data;
50
- }
51
- return Action;
52
- }());
53
- function getErrorMessage(message, data) {
54
- return new Error("Invalid data\n- " + message + ", got " + JSON.stringify(data));
55
- }
56
-
57
- function addMetaData(map, section, data) {
58
- if (!section)
59
- return;
60
- map[section] = data;
61
- }
62
- function getMetaData(map, section) {
63
- if (map[section]) {
64
- return map[section];
65
- }
66
- return undefined;
67
- }
68
- function deleteMetaData(map, section) {
69
- if (map[section]) {
70
- return delete map[section];
71
- }
72
- return undefined;
73
- }
74
-
75
- /** @class */ ((function () {
76
- function Event(values, client) {
77
- var apiKey = values.apiKey, appVersion = values.appVersion, appType = values.appType, releaseStage = values.releaseStage, timestamp = values.timestamp, category = values.category, type = values.type, sdk = values.sdk, detail = values.detail, device = values.device, user = values.user, actions = values.actions, metaData = values.metaData;
78
- this.apiKey = apiKey;
79
- this.appVersion = appVersion;
80
- this.appType = appType;
81
- this.releaseStage = releaseStage;
82
- this.timestamp = timestamp;
83
- this.category = category;
84
- this.type = type;
85
- this.sdk = sdk;
86
- this.detail = detail;
87
- this.device = device;
88
- this.user = user;
89
- this.actions = actions;
90
- this.metaData = metaData;
91
- this._client = client;
92
- }
93
- Object.defineProperty(Event.prototype, "_isOhbugEvent", {
94
- get: function () {
95
- return true;
96
- },
97
- enumerable: false,
98
- configurable: true
99
- });
100
- /**
101
- * Add an action.
102
- * Once the threshold is reached, the oldest breadcrumbs will be deleted.
103
- * 新增一个动作。
104
- * 一旦达到阈值,最老的 Action 将被删除。
105
- *
106
- * @param message
107
- * @param data
108
- * @param type
109
- * @param timestamp
110
- */
111
- Event.prototype.addAction = function (message, data, type, timestamp) {
112
- var _a, _b;
113
- var actions = this.actions;
114
- var targetMessage = isString(message) ? message : '';
115
- var targetData = data || {};
116
- var targetType = isString(type) ? type : '';
117
- var action = new Action(targetMessage, targetData, targetType, timestamp);
118
- if (actions.length >= ((_b = (_a = this._client) === null || _a === void 0 ? void 0 : _a._config.maxActions) !== null && _b !== void 0 ? _b : 30)) {
119
- actions.shift();
120
- }
121
- actions.push(action);
122
- };
123
- /**
124
- * Get current user information
125
- * 获取当前的用户信息
126
- */
127
- Event.prototype.getUser = function () {
128
- return this.user;
129
- };
130
- /**
131
- * Set current user information
132
- * 设置当前的用户信息
133
- */
134
- Event.prototype.setUser = function (user) {
135
- var _a;
136
- if (isObject(user) && Object.keys(user).length <= 6) {
137
- this.user = __assign(__assign({}, this.user), user);
138
- return this.getUser();
139
- }
140
- (_a = this._client) === null || _a === void 0 ? void 0 : _a._logger.warn(getErrorMessage('setUser should be an object and have up to 6 attributes', user));
141
- return undefined;
142
- };
143
- /**
144
- * Add metaData
145
- * 新增 metaData
146
- *
147
- * @param section
148
- * @param data
149
- */
150
- Event.prototype.addMetaData = function (section, data) {
151
- return addMetaData(this.metaData, section, data);
152
- };
153
- /**
154
- * Get metaData
155
- * 获取 metaData
156
- *
157
- * @param section
158
- */
159
- Event.prototype.getMetaData = function (section) {
160
- return getMetaData(this.metaData, section);
161
- };
162
- /**
163
- * Delete metaData
164
- * 删除 metaData
165
- *
166
- * @param section
167
- */
168
- Event.prototype.deleteMetaData = function (section) {
169
- return deleteMetaData(this.metaData, section);
170
- };
171
- Event.prototype.toJSON = function () {
172
- var _a = this, apiKey = _a.apiKey, appVersion = _a.appVersion, appType = _a.appType, timestamp = _a.timestamp, category = _a.category, type = _a.type, sdk = _a.sdk, device = _a.device, detail = _a.detail, user = _a.user, actions = _a.actions, metaData = _a.metaData, releaseStage = _a.releaseStage;
173
- return {
174
- apiKey: apiKey,
175
- appVersion: appVersion,
176
- appType: appType,
177
- timestamp: timestamp,
178
- category: category,
179
- type: type,
180
- sdk: sdk,
181
- device: device,
182
- detail: detail,
183
- user: user,
184
- actions: actions,
185
- metaData: metaData,
186
- releaseStage: releaseStage,
187
- };
188
- };
189
- return Event;
190
- })());
191
-
192
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
193
- // require the crypto API and do not support built-in fallback to lower quality random number
194
- // generators (like Math.random()).
195
- var getRandomValues;
196
- var rnds8 = new Uint8Array(16);
197
- function rng() {
198
- // lazy load so that environments that need to polyfill have a chance to do so
199
- if (!getRandomValues) {
200
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
201
- // find the complete implementation of crypto (msCrypto) on IE11.
202
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
203
-
204
- if (!getRandomValues) {
205
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
206
- }
207
- }
208
-
209
- return getRandomValues(rnds8);
210
- }
211
-
212
- var REGEX = /^(?:[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;
213
-
214
- function validate(uuid) {
215
- return typeof uuid === 'string' && REGEX.test(uuid);
216
- }
217
-
218
- /**
219
- * Convert array of 16 byte values to UUID string format of the form:
220
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
221
- */
222
-
223
- var byteToHex = [];
224
-
225
- for (var i = 0; i < 256; ++i) {
226
- byteToHex.push((i + 0x100).toString(16).substr(1));
227
- }
228
-
229
- function stringify(arr) {
230
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
231
- // Note: Be careful editing this code! It's been tuned for performance
232
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
233
- var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
234
- // of the following:
235
- // - One or more input array values don't map to a hex octet (leading to
236
- // "undefined" in the uuid)
237
- // - Invalid input values for the RFC `version` or `variant` fields
238
-
239
- if (!validate(uuid)) {
240
- throw TypeError('Stringified UUID is invalid');
241
- }
242
-
243
- return uuid;
244
- }
245
-
246
- function v4(options, buf, offset) {
247
- options = options || {};
248
- var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
249
-
250
- rnds[6] = rnds[6] & 0x0f | 0x40;
251
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
252
-
253
- if (buf) {
254
- offset = offset || 0;
255
-
256
- for (var i = 0; i < 16; ++i) {
257
- buf[offset + i] = rnds[i];
258
- }
259
-
260
- return buf;
261
- }
262
-
263
- return stringify(rnds);
264
- }
265
-
266
- /*! *****************************************************************************
267
- Copyright (c) Microsoft Corporation.
268
-
269
- Permission to use, copy, modify, and/or distribute this software for any
270
- purpose with or without fee is hereby granted.
271
-
272
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
273
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
274
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
275
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
276
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
277
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
278
- PERFORMANCE OF THIS SOFTWARE.
279
- ***************************************************************************** */
280
- function isNode() {
281
- return typeof global !== 'undefined';
282
- }
283
- function isBrowser() {
284
- return typeof window !== 'undefined';
285
- }
286
-
287
- // https://developer.mozilla.org/zh-CN/docs/Web/API/Document/cookie
288
- var docCookies = {
289
- getItem: function (sKey) {
290
- return (decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[-.+*]/g, '\\$&') + "\\s*\\=\\s*([^;]*).*$)|^.*$"), '$1')) || null);
291
- },
292
- setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {
293
- // eslint-disable-next-line
294
- if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) {
295
- return false;
296
- }
297
- var sExpires = '';
298
- if (vEnd) {
299
- switch (vEnd.constructor) {
300
- case Number:
301
- sExpires =
302
- vEnd === Infinity
303
- ? '; expires=Fri, 31 Dec 9999 23:59:59 GMT'
304
- : "; max-age=" + vEnd;
305
- break;
306
- case String:
307
- sExpires = "; expires=" + vEnd;
308
- break;
309
- case Date:
310
- sExpires = "; expires=" + vEnd.toUTCString();
311
- break;
312
- }
313
- }
314
- var value = encodeURIComponent(sKey) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : '') + (sPath ? "; path=" + sPath : '') + (bSecure ? '; secure' : '');
315
- document.cookie = value;
316
- return value;
317
- },
318
- removeItem: function (sKey, sPath, sDomain) {
319
- if (!sKey || !this.getItem(sKey)) {
320
- return false;
321
- }
322
- document.cookie = encodeURIComponent(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (sDomain ? "; domain=" + sDomain : '') + (sPath ? "; path=" + sPath : '');
323
- return true;
324
- },
325
- };
326
-
327
- var key = 'OhbugUUID';
328
- function getUUID() {
329
- if (isBrowser()) {
330
- var UUID = docCookies.getItem(key);
331
- if (!UUID) {
332
- var extraTime = 60 * 30 * 24 * 3600 * 1000; // 30天后过期
333
- var endTime = new Date();
334
- endTime.setTime(endTime.getTime() + extraTime);
335
- var uuid = v4();
336
- docCookies.setItem(key, uuid, endTime);
337
- return uuid;
338
- }
339
- return UUID;
340
- }
341
- if (isNode()) {
342
- return v4();
343
- }
344
- return '';
345
- }
346
-
347
- var extension = createExtension({
348
- name: 'OhbugExtensionUUID',
349
- created: function (event) {
350
- var uuid = getUUID();
351
- event.setUser({
352
- uuid: uuid,
353
- });
354
- return event;
355
- },
356
- });
357
-
358
- return extension;
359
-
360
- })));
@@ -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,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function t(e){return"string"==typeof e}var n,r=function(e,t,n,r){this.type=n,this.timestamp=r||(new Date).toISOString(),this.message=e,this.data=t};!function(){function n(e,t){var n=e.apiKey,r=e.appVersion,i=e.appType,o=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,y=e.metaData;this.apiKey=n,this.appVersion=r,this.appType=i,this.releaseStage=o,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=y,this._client=t}Object.defineProperty(n.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),n.prototype.addAction=function(e,n,i,o){var a,s,u=this.actions,p=t(e)?e:"",c=n||{},f=t(i)?i:"",d=new r(p,c,f,o);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)},n.prototype.getUser=function(){return this.user},n.prototype.setUser=function(t){var n,r,i;if(r=t,"[object Object]"===Object.prototype.toString.call(r)&&Object.keys(t).length<=6)return this.user=e(e({},this.user),t),this.getUser();null===(n=this._client)||void 0===n||n._logger.warn((i=t,new Error("Invalid data\n- "+"setUser should be an object and have up to 6 attributes"+", got "+JSON.stringify(i))))},n.prototype.addMetaData=function(e,t){return function(e,t,n){t&&(e[t]=n)}(this.metaData,e,t)},n.prototype.getMetaData=function(e){return function(e,t){if(e[t])return e[t]}(this.metaData,e)},n.prototype.deleteMetaData=function(e){return function(e,t){if(e[t])return delete e[t]}(this.metaData,e)},n.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}}}();var i=new Uint8Array(16);function o(){if(!n&&!(n="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 n(i)}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,n){var r=(e=e||{}).random||(e.rng||o)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(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(n))throw TypeError("Stringified UUID is invalid");return n}(r)}
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,n,r,i,o){if(!e||/^(?:expires|max\-age|path|domain|secure)$/i.test(e))return!1;var a="";if(n)switch(n.constructor){case Number:a=n===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+n;break;case String:a="; expires="+n;break;case Date:a="; expires="+n.toUTCString()}var s=encodeURIComponent(e)+"="+encodeURIComponent(t)+a+(i?"; domain="+i:"")+(r?"; path="+r:"")+(o?"; secure":"");return document.cookie=s,s},h="OhbugUUID";function y(){if("undefined"!=typeof window){var e=f(h);if(!e){var t=new Date;t.setTime(t.getTime()+15552e7);var n=c();return d(h,n,t),n}return e}return"undefined"!=typeof global?c():""}return{name:"OhbugExtensionUUID",created:function(e){var t=y();return e.setUser({uuid:t}),e}}}));
package/dist/uuid.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare function getUUID(): string;
2
- //# sourceMappingURL=uuid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../src/uuid.ts"],"names":[],"mappings":"AAMA,wBAAgB,OAAO,IAAI,MAAM,CAiBhC"}