@picked/fingerprintjs 0.0.1-dev.1764633009920 → 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 e=require("@picked/client"),n=e.createStorageKey("fingerprintjs","global"),t=()=>({name:"fingerprintjs-plugin",setup:()=>{if(console.log("====> Setting up FingerprintJS plugin"),!window.FingerprintJS){console.log("====> FingerprintJS not found on window"),e.sessionStore.set(n,void 0);return}window.FingerprintJS.load().then(({get:r})=>{r().then(({visitorId:i})=>{e.sessionStore.set(n,i),console.log("====> FingerprintJS visitorId stored:",n,i)})})}});function o(){return console.log("====> Retrieving FingerprintJS visitorId from session store:",n,e.sessionStore.get(n)),e.sessionStore.get(n)}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,26 +1,55 @@
1
- import { createStorageKey as t, sessionStore as i } from "@picked/client";
2
- const n = t("fingerprintjs", "global"), s = () => ({
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("====> Setting up FingerprintJS plugin"), !window.FingerprintJS) {
6
- console.log("====> FingerprintJS not found on window"), i.set(n, void 0);
5
+ if (console.log("====> [fingerprintjsPlugin] Setting up FingerprintJS plugin"), !s()) {
6
+ console.log("====> [fingerprintjsPlugin] Window is not supported");
7
7
  return;
8
8
  }
9
- window.FingerprintJS.load().then(({ get: e }) => {
10
- e().then(({ visitorId: r }) => {
11
- i.set(n, r), console.log("====> FingerprintJS visitorId stored:", n, r);
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
+ });
12
22
  });
13
23
  });
14
24
  }
15
25
  });
16
- function p() {
26
+ function c() {
27
+ if (!s()) {
28
+ console.log("====> [getFingerprintVisitorId] Window is not supported");
29
+ return;
30
+ }
17
31
  return console.log(
18
- "====> Retrieving FingerprintJS visitorId from session store:",
32
+ "====> [getFingerprintVisitorId] Retrieving FingerprintJS visitorId from session store:",
19
33
  n,
20
- i.get(n)
21
- ), 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
+ });
22
51
  }
23
52
  export {
24
- s as fingerprintjsPlugin,
25
- p as getFingerprintVisitorId
53
+ f as fingerprintjsPlugin,
54
+ c as getFingerprintVisitorId
26
55
  };
@@ -24,6 +24,6 @@ export declare const fingerprintjsPlugin: () => Plugin;
24
24
  *
25
25
  * @returns StorageItem<string | undefined> The stored visitorId or undefined if not present.
26
26
  */
27
- export declare function getFingerprintVisitorId(): StorageItem<string | undefined>;
27
+ export declare function getFingerprintVisitorId(): StorageItem<string | undefined> | undefined;
28
28
  export {};
29
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEzF,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,MAsBtC,CAAA;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAOzE"}
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.1764633009920",
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.1764633009920"
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"