File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import MyApplication from './app'
3333ReactDOM .render (
3434 <>
3535 <UsercentricsScript settingsId = { USERCENTRICS_SETTINGS_ID } />
36- <UsercentricsProvider windowEventName = { USERCENTRICS_EVENT_NAME } >
36+ <UsercentricsProvider >
3737 <MyApplication /** You can interact with Usercentrics inside the provider */ />
3838 </UsercentricsProvider >
3939 </>,
@@ -69,6 +69,19 @@ declare module '@s-group/react-usercentrics/augmented' {
6969
7070## API
7171
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+
7285### Components
7386
7487#### ` UsercentricsScript `
Original file line number Diff line number Diff line change 11import type { FC } from 'react'
22import React from 'react'
33
4+ import { USERCENTRICS_WEB_CMP_LOADER_SCRIPT_URL } from '../constants.js'
5+
46interface UsercentricsScriptProps
57 extends React . DetailedHTMLProps < React . ScriptHTMLAttributes < HTMLScriptElement > , HTMLScriptElement > {
68 /**
@@ -31,12 +33,6 @@ interface UsercentricsScriptProps
3133 * @example <caption>Preview mode for development</caption>
3234 * () => <UsercentricsScript settingsId="1234" version="preview" />
3335 *
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- *
4036 * @example <caption>Fixed language code</caption>
4137 * () => <UsercentricsScript settingsId="1234" language="fi" />
4238 *
@@ -56,7 +52,7 @@ export const UsercentricsScript: FC<UsercentricsScriptProps> = ({
5652 data-settings-id = { settingsId }
5753 data-version = { version }
5854 id = { id }
59- src = "https://web.cmp.usercentrics.eu/ui/loader.js"
55+ src = { USERCENTRICS_WEB_CMP_LOADER_SCRIPT_URL }
6056 />
6157 )
6258}
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 11export { UsercentricsDialogToggle } from './components/UsercentricsDialogToggle.js'
22export { UsercentricsProvider } from './components/UsercentricsProvider.js'
33export { UsercentricsScript } from './components/UsercentricsScript.js'
4+ export { USERCENTRICS_WEB_CMP_LOADER_SCRIPT_URL } from './constants.js'
45export { UsercentricsContext } from './context.js'
56export { useHasServiceConsent } from './hooks/use-has-service-consent.js'
67export { useHasUserInteracted } from './hooks/use-has-user-interacted.js'
You can’t perform that action at this time.
0 commit comments