File tree 4 files changed +28
-8
lines changed 4 files changed +28
-8
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import MyApplication from './app'
33
33
ReactDOM .render (
34
34
<>
35
35
<UsercentricsScript settingsId = { USERCENTRICS_SETTINGS_ID } />
36
- <UsercentricsProvider windowEventName = { USERCENTRICS_EVENT_NAME } >
36
+ <UsercentricsProvider >
37
37
<MyApplication /** You can interact with Usercentrics inside the provider */ />
38
38
</UsercentricsProvider >
39
39
</>,
@@ -69,6 +69,19 @@ declare module '@s-group/react-usercentrics/augmented' {
69
69
70
70
## API
71
71
72
+ ### Constants
73
+
74
+ #### ` USERCENTRICS_WEB_CMP_LOADER_SCRIPT_URL `
75
+
76
+ The url of the Usercentercis Web CMP v3 loader script. Useful when generating Link headers, for example.
77
+
78
+ ``` ts
79
+ response .headers .append (
80
+ ' Link' ,
81
+ ` <${USERCENTRICS_WEB_CMP_LOADER_SCRIPT_URL }>; rel=prefetch; as=script; fetchpriority="high" ` ,
82
+ )
83
+ ```
84
+
72
85
### Components
73
86
74
87
#### ` UsercentricsScript `
Original file line number Diff line number Diff line change 1
1
import type { FC } from 'react'
2
2
import React from 'react'
3
3
4
+ import { USERCENTRICS_WEB_CMP_LOADER_SCRIPT_URL } from '../constants.js'
5
+
4
6
interface UsercentricsScriptProps
5
7
extends React . DetailedHTMLProps < React . ScriptHTMLAttributes < HTMLScriptElement > , HTMLScriptElement > {
6
8
/**
@@ -31,12 +33,6 @@ interface UsercentricsScriptProps
31
33
* @example <caption>Preview mode for development</caption>
32
34
* () => <UsercentricsScript settingsId="1234" version="preview" />
33
35
*
34
- * @example <caption>Use SDK v3 instead of previous v2</caption>
35
- * () => <UsercentricsScript cmpVersion="3" settingsId="1234" />
36
- *
37
- * @example <caption>Fixed UI version instead of latest</caption>
38
- * () => <UsercentricsScript settingsId="1234" uiVersion="3.24.0" />
39
- *
40
36
* @example <caption>Fixed language code</caption>
41
37
* () => <UsercentricsScript settingsId="1234" language="fi" />
42
38
*
@@ -56,7 +52,7 @@ export const UsercentricsScript: FC<UsercentricsScriptProps> = ({
56
52
data-settings-id = { settingsId }
57
53
data-version = { version }
58
54
id = { id }
59
- src = "https://web.cmp.usercentrics.eu/ui/loader.js"
55
+ src = { USERCENTRICS_WEB_CMP_LOADER_SCRIPT_URL }
60
56
/>
61
57
)
62
58
}
Original file line number Diff line number Diff line change
1
+ /**
2
+ * The url of the Usercentercis Web CMP v3 loader script. Useful when generating Link headers, for example.
3
+ *
4
+ * @example
5
+ * response.headers.append(
6
+ * 'Link',
7
+ * `<${USERCENTRICS_WEB_CMP_LOADER_SCRIPT_URL}>; rel=prefetch; as=script; fetchpriority="high"`,
8
+ * )
9
+ */
10
+ export const USERCENTRICS_WEB_CMP_LOADER_SCRIPT_URL = 'https://web.cmp.usercentrics.eu/ui/loader.js'
Original file line number Diff line number Diff line change 1
1
export { UsercentricsDialogToggle } from './components/UsercentricsDialogToggle.js'
2
2
export { UsercentricsProvider } from './components/UsercentricsProvider.js'
3
3
export { UsercentricsScript } from './components/UsercentricsScript.js'
4
+ export { USERCENTRICS_WEB_CMP_LOADER_SCRIPT_URL } from './constants.js'
4
5
export { UsercentricsContext } from './context.js'
5
6
export { useHasServiceConsent } from './hooks/use-has-service-consent.js'
6
7
export { useHasUserInteracted } from './hooks/use-has-user-interacted.js'
You can’t perform that action at this time.
0 commit comments