@picked/fingerprintjs 0.0.1-dev.1764694362099 → 0.0.1-dev.1764699646503

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/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@picked/client"),i=n.createStorageKey("fingerprintjs","global"),t=()=>({name:"fingerprintjs-plugin",setup:()=>{if(console.log("====> [fingerprintjsPlugin] Setting up FingerprintJS plugin"),!n.supportsWindow()){console.log("====> [fingerprintjsPlugin] Window is not supported");return}if(!window.FingerprintJS){console.log("====> [fingerprintjsPlugin] FingerprintJS not found on window"),n.sessionStore.set(i,void 0);return}window.FingerprintJS.load().then(({get:e})=>{e().then(({visitorId:r})=>{n.sessionStore.set(i,r),console.log("====> [fingerprintjsPlugin] FingerprintJS visitorId stored:",i,r)})})}});function o(){if(!n.supportsWindow()){console.log("====> [getFingerprintVisitorId] Window is not supported");return}return console.log("====> [getFingerprintVisitorId] Retrieving FingerprintJS visitorId from session store:",i,n.sessionStore.get(i).text()),n.sessionStore.get(i)}exports.fingerprintjsPlugin=t;exports.getFingerprintVisitorId=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@picked/client"),i=n.createStorageKey("fingerprintjs","global"),p=()=>({name:"fingerprintjs-plugin",setup:()=>{if(console.log("====> [fingerprintjsPlugin] Setting up FingerprintJS plugin"),!n.supportsWindow()){console.log("====> [fingerprintjsPlugin] Window is not supported");return}d(1e4).then(t=>{if(!t){console.log("====> [fingerprintjsPlugin] FingerprintJS not found on window after retry"),n.sessionStore.set(i,void 0);return}t.load().then(({get:o})=>{o().then(({visitorId:e})=>{n.sessionStore.set(i,e),console.log("====> [fingerprintjsPlugin] FingerprintJS visitorId stored:",i,e)})})})}});function u(){if(!n.supportsWindow()){console.log("====> [getFingerprintVisitorId] Window is not supported");return}return console.log("====> [getFingerprintVisitorId] Retrieving FingerprintJS visitorId from session store:",i,n.sessionStore.get(i).text()),n.sessionStore.get(i)}function d(t){return new Promise(r=>{if(!n.supportsWindow())return r(void 0);const o=100,e=Date.now(),s=()=>{const g=globalThis.window.FingerprintJS;if(g)return r(g);if(Date.now()-e>=t)return r(void 0);setTimeout(s,o)};s()})}exports.fingerprintjsPlugin=p;exports.getFingerprintVisitorId=u;
package/dist/esm/index.js CHANGED
@@ -1,38 +1,55 @@
1
- import { createStorageKey as o, supportsWindow as t, sessionStore as i } from "@picked/client";
2
- const n = o("fingerprintjs", "global"), p = () => ({
1
+ import { createStorageKey as u, supportsWindow as s, sessionStore as o } from "@picked/client";
2
+ const n = u("fingerprintjs", "global"), f = () => ({
3
3
  name: "fingerprintjs-plugin",
4
4
  setup: () => {
5
- if (console.log("====> [fingerprintjsPlugin] Setting up FingerprintJS plugin"), !t()) {
5
+ if (console.log("====> [fingerprintjsPlugin] Setting up FingerprintJS plugin"), !s()) {
6
6
  console.log("====> [fingerprintjsPlugin] Window is not supported");
7
7
  return;
8
8
  }
9
- if (!window.FingerprintJS) {
10
- console.log("====> [fingerprintjsPlugin] FingerprintJS not found on window"), i.set(n, void 0);
11
- return;
12
- }
13
- window.FingerprintJS.load().then(({ get: e }) => {
14
- e().then(({ visitorId: r }) => {
15
- i.set(n, r), console.log(
16
- "====> [fingerprintjsPlugin] FingerprintJS visitorId stored:",
17
- n,
18
- r
19
- );
9
+ d(1e4).then((i) => {
10
+ if (!i) {
11
+ console.log("====> [fingerprintjsPlugin] FingerprintJS not found on window after retry"), o.set(n, void 0);
12
+ return;
13
+ }
14
+ i.load().then(({ get: e }) => {
15
+ e().then(({ visitorId: r }) => {
16
+ o.set(n, r), console.log(
17
+ "====> [fingerprintjsPlugin] FingerprintJS visitorId stored:",
18
+ n,
19
+ r
20
+ );
21
+ });
20
22
  });
21
23
  });
22
24
  }
23
25
  });
24
- function l() {
25
- if (!t()) {
26
+ function c() {
27
+ if (!s()) {
26
28
  console.log("====> [getFingerprintVisitorId] Window is not supported");
27
29
  return;
28
30
  }
29
31
  return console.log(
30
32
  "====> [getFingerprintVisitorId] Retrieving FingerprintJS visitorId from session store:",
31
33
  n,
32
- i.get(n).text()
33
- ), i.get(n);
34
+ o.get(n).text()
35
+ ), o.get(n);
36
+ }
37
+ function d(i) {
38
+ return new Promise((t) => {
39
+ if (!s())
40
+ return t(void 0);
41
+ const e = 100, r = Date.now(), g = () => {
42
+ const p = globalThis.window.FingerprintJS;
43
+ if (p)
44
+ return t(p);
45
+ if (Date.now() - r >= i)
46
+ return t(void 0);
47
+ setTimeout(g, e);
48
+ };
49
+ g();
50
+ });
34
51
  }
35
52
  export {
36
- p as fingerprintjsPlugin,
37
- l as getFingerprintVisitorId
53
+ f as fingerprintjsPlugin,
54
+ c as getFingerprintVisitorId
38
55
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EAEX,KAAK,MAAM,EACZ,MAAM,gBAAgB,CAAA;AAEvB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,aAAa,CAAC,EAAE,aAAa,CAAA;KAC9B;CACF;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,OAAO,CAAC;YAAE,SAAS,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC,CAAA;CACnE;AAID;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,QAAO,MA+BtC,CAAA;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAYrF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAEhB,KAAK,MAAM,EACZ,MAAM,gBAAgB,CAAA;AAEvB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,aAAa,CAAC,EAAE,aAAa,CAAA;KAC9B;CACF;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,OAAO,CAAC;YAAE,SAAS,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC,CAAA;CACnE;AAID;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,QAAO,MAiCtC,CAAA;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAYrF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@picked/fingerprintjs",
3
3
  "description": "Fingerprintjs plugin",
4
- "version": "0.0.1-dev.1764694362099",
4
+ "version": "0.0.1-dev.1764699646503",
5
5
  "dependencies": {},
6
6
  "devDependencies": {
7
7
  "@picked/client": "workspace:*",
@@ -31,7 +31,7 @@
31
31
  "main": "./dist/cjs/index.js",
32
32
  "module": "./dist/esm/index.js",
33
33
  "peerDependencies": {
34
- "@picked/client": "0.0.1-dev.1764694362099"
34
+ "@picked/client": "0.0.1-dev.1764699646503"
35
35
  },
36
36
  "private": false,
37
37
  "scripts": {
@@ -41,11 +41,11 @@
41
41
  "lint-files": "eslint",
42
42
  "lint:format": "eslint . --fix",
43
43
  "lint:report": "eslint . -o './.reports/eslint.json' -f json || true",
44
- "type-check": "tsc -p . --noEmit",
45
44
  "test": "vitest run",
46
45
  "test:coverage": "vitest run --coverage",
47
46
  "test:packaged-types": "attw --pack",
48
- "test:watch": "vitest"
47
+ "test:watch": "vitest",
48
+ "type-check": "tsc -p . --noEmit"
49
49
  },
50
50
  "type": "module",
51
51
  "types": "./dist/types/index.d.ts"