@ohbug/extension-uuid 2.1.1 → 2.1.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/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var
|
|
1
|
+
"use strict";var m=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var d=(e,r)=>{for(var t in r)m(e,t,{get:r[t],enumerable:!0})},l=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of f(r))!U.call(e,n)&&n!==t&&m(e,n,{get:()=>r[n],enumerable:!(o=x(r,n))||o.enumerable});return e};var b=e=>l(m({},"__esModule",{value:!0}),e);var k={};d(k,{default:()=>T});module.exports=b(k);var c=require("uuid"),s=require("@ohbug/utils");var u={getItem(e){return decodeURIComponent(document.cookie.replace(new RegExp(`(?:(?:^|.*;)\\s*${encodeURIComponent(e).replaceAll(/[*+.-]/g,"\\$&")}\\s*\\=\\s*([^;]*).*$)|^.*$`),"$1"))||null},setItem(e,r,t,o,n,I){if(!e||/^(?:expires|max-age|path|domain|secure)$/i.test(e))return!1;let i="";if(t)switch(t.constructor){case Number:i=t===Number.POSITIVE_INFINITY?"; 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 a=`${encodeURIComponent(e)}=${encodeURIComponent(r)}${i}${n?`; domain=${n}`:""}${o?`; path=${o}`:""}${I?"; secure":""}`;return document.cookie=a,a},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 p(){if((0,s.isBrowser)()){let e=u.getItem(g);if(!e){let t=new Date;t.setTime(t.getTime()+15552e7);let o=(0,c.v4)();return u.setItem(g,o,t),o}return e}return(0,s.isNode)()?(0,c.v4)():""}var $=()=>({name:"OhbugExtensionUUID",onEvent:e=>{let r=p();return e.setUser({uuid:r}),e}});var T=$;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v4 as u}from"uuid";import{isBrowser as $,isNode as
|
|
1
|
+
import{v4 as u}from"uuid";import{isBrowser as $,isNode as I}from"@ohbug/utils";var i={getItem(e){return decodeURIComponent(document.cookie.replace(new RegExp(`(?:(?:^|.*;)\\s*${encodeURIComponent(e).replaceAll(/[*+.-]/g,"\\$&")}\\s*\\=\\s*([^;]*).*$)|^.*$`),"$1"))||null},setItem(e,r,t,o,s,p){if(!e||/^(?:expires|max-age|path|domain|secure)$/i.test(e))return!1;let n="";if(t)switch(t.constructor){case Number:n=t===Number.POSITIVE_INFINITY?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":`; max-age=${t}`;break;case String:n=`; expires=${t}`;break;case Date:n=`; expires=${t.toUTCString()}`;break;default:break}let m=`${encodeURIComponent(e)}=${encodeURIComponent(r)}${n}${s?`; domain=${s}`:""}${o?`; path=${o}`:""}${p?"; secure":""}`;return document.cookie=m,m},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 c="OhbugUUID";function a(){if($()){let e=i.getItem(c);if(!e){let t=new Date;t.setTime(t.getTime()+15552e7);let o=u();return i.setItem(c,o,t),o}return e}return I()?u():""}var g=()=>({name:"OhbugExtensionUUID",onEvent:e=>{let r=a();return e.setUser({uuid:r}),e}});var h=g;export{h as default};
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohbug/extension-uuid",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Ohbug extension to add uuid",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"author": "chenyueban <jasonchan0527@gmail.com>",
|
|
7
6
|
"homepage": "https://github.com/ohbug-org/extensions",
|
|
8
7
|
"bugs": {
|
|
9
8
|
"url": "https://github.com/ohbug-org/extensions/issues"
|
|
@@ -12,30 +11,31 @@
|
|
|
12
11
|
"type": "git",
|
|
13
12
|
"url": "https://github.com/ohbug-org/extensions"
|
|
14
13
|
},
|
|
14
|
+
"author": "chenyueban <jasonchan0527@gmail.com>",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
15
18
|
"main": "dist/index.js",
|
|
16
19
|
"module": "dist/index.mjs",
|
|
17
20
|
"types": "dist/index.d.ts",
|
|
18
21
|
"exports": {
|
|
19
22
|
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
20
24
|
"require": "./dist/index.js",
|
|
21
|
-
"import": "./dist/index.mjs"
|
|
22
|
-
"types": "./dist/index.d.ts"
|
|
25
|
+
"import": "./dist/index.mjs"
|
|
23
26
|
}
|
|
24
27
|
},
|
|
25
|
-
"files": [
|
|
26
|
-
"dist"
|
|
27
|
-
],
|
|
28
28
|
"sideEffects": false,
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
29
32
|
"dependencies": {
|
|
30
33
|
"@ohbug/types": "^2.2.1",
|
|
31
34
|
"@ohbug/utils": "^2.0.8",
|
|
32
35
|
"uuid": "^9.0.0"
|
|
33
36
|
},
|
|
34
37
|
"devDependencies": {
|
|
35
|
-
"@types/uuid": "^9.0.
|
|
36
|
-
},
|
|
37
|
-
"publishConfig": {
|
|
38
|
-
"access": "public"
|
|
38
|
+
"@types/uuid": "^9.0.3"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"prebuild": "rimraf dist",
|