Skip to content

Commit 2cfb9a4

Browse files
committed
switch from uuids to uid
1 parent 9466d99 commit 2cfb9a4

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
],
5656
"packageManager": "pnpm@10.7.0",
5757
"dependencies": {
58-
"js-cookie": "^3.0.5"
58+
"js-cookie": "^3.0.5",
59+
"uid": "1"
5960
}
6061
}

pnpm-lock.yaml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/Banner.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
<script>
2424
import Cookies from 'js-cookie'
25+
import uid from 'uid'
2526
import { validate } from './util.js'
2627
import { fade } from 'svelte/transition'
2728
import { onMount, createEventDispatcher } from 'svelte'
@@ -121,8 +122,6 @@
121122
throw new Error('You must set gdpr cookie name')
122123
}
123124
124-
await import('./shim-randomuuid.js')
125-
126125
const cookie = Cookies.get(cookieName)
127126
if (!cookie) {
128127
show()
@@ -156,7 +155,7 @@
156155
157156
const options = Object.assign({}, defaults, cookieConfig, { expires })
158157
if (choices.analytics || choices.tracking) {
159-
cookieContent.fp = typeof crypto.randomUUID === 'function' ? crypto.randomUUID() : 'test-fingerprint-1234'
158+
cookieContent.fp = uid(32)
160159
}
161160
162161
Cookies.set(cookieName, JSON.stringify(cookieContent), options)

src/lib/shim-randomuuid.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)