@myelophone/nuxt 0.18.2

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.
Files changed (259) hide show
  1. package/.devcontainer/Dockerfile +7 -0
  2. package/.devcontainer/devcontainer.json +21 -0
  3. package/.editorconfig +43 -0
  4. package/.github/workflows/package.yml +73 -0
  5. package/.nuxtignore +6 -0
  6. package/.releaserc.js +132 -0
  7. package/.yarn/releases/yarn-4.18.0.cjs +1000 -0
  8. package/.yarnrc.yml +8 -0
  9. package/CHANGELOG.md +141 -0
  10. package/LICENSE +77 -0
  11. package/README.md +3004 -0
  12. package/app/app.vue +455 -0
  13. package/app/assets/css/animation.css +81 -0
  14. package/app/assets/css/backgrounds.css +57 -0
  15. package/app/assets/css/base.css +182 -0
  16. package/app/assets/css/index.css +9 -0
  17. package/app/assets/css/links.css +12 -0
  18. package/app/assets/css/multimedia.css +102 -0
  19. package/app/assets/css/preloader.css +68 -0
  20. package/app/assets/css/print.css +40 -0
  21. package/app/assets/css/tailwind.css +20 -0
  22. package/app/assets/css/theme.css +29 -0
  23. package/app/components/consent/GoogleMap.vue +59 -0
  24. package/app/components/consent/Youtube.vue +27 -0
  25. package/app/components/cookie/Banner.vue +70 -0
  26. package/app/components/cookie/ConsentWrapper.vue +71 -0
  27. package/app/components/cookie/PrivacyPolicy.vue +179 -0
  28. package/app/components/cookie/SettingsModal.vue +387 -0
  29. package/app/components/grid/Col.vue +262 -0
  30. package/app/components/grid/Container.vue +236 -0
  31. package/app/components/grid/Row.vue +248 -0
  32. package/app/components/grid/Stack.vue +233 -0
  33. package/app/components/myelophone/Copyright.vue +5 -0
  34. package/app/components/myelophone/Welcome.vue +107 -0
  35. package/app/components/page/FullscreenPreloader.vue +177 -0
  36. package/app/components/page/Preloader.vue +18 -0
  37. package/app/components/page/ReadyLocalized.vue +19 -0
  38. package/app/components/ready/.gitkeep +0 -0
  39. package/app/components/safe/Email.vue +52 -0
  40. package/app/components/safe/ImgWithLoader.vue +180 -0
  41. package/app/components/safe/NuxtImg.vue +25 -0
  42. package/app/components/safe/NuxtPicture.vue +29 -0
  43. package/app/components/section/.gitkeep +0 -0
  44. package/app/components/seo/BrandInfo.vue +76 -0
  45. package/app/components/seo/ContentNoIndex.vue +35 -0
  46. package/app/components/seo/NoIndex.vue +22 -0
  47. package/app/components/seo/OrgInfo.vue +130 -0
  48. package/app/components/seo/ProfileInfo.vue +137 -0
  49. package/app/components/ui/Accordion.vue +163 -0
  50. package/app/components/ui/Alert.vue +179 -0
  51. package/app/components/ui/Avatar.vue +88 -0
  52. package/app/components/ui/Badge.vue +150 -0
  53. package/app/components/ui/Banner.vue +133 -0
  54. package/app/components/ui/Button.vue +175 -0
  55. package/app/components/ui/Card.vue +66 -0
  56. package/app/components/ui/Checkbox.vue +134 -0
  57. package/app/components/ui/Chip.vue +136 -0
  58. package/app/components/ui/CommandPalette.vue +434 -0
  59. package/app/components/ui/Console.vue +583 -0
  60. package/app/components/ui/CursorCreative.vue +148 -0
  61. package/app/components/ui/FeatureAccordion.vue +165 -0
  62. package/app/components/ui/FileUpload.vue +705 -0
  63. package/app/components/ui/GeoDependent.vue +72 -0
  64. package/app/components/ui/Heading.vue +51 -0
  65. package/app/components/ui/Icon.vue +42 -0
  66. package/app/components/ui/Icon8.vue +39 -0
  67. package/app/components/ui/Input.vue +88 -0
  68. package/app/components/ui/LangLink.vue +34 -0
  69. package/app/components/ui/LangVisible.vue +33 -0
  70. package/app/components/ui/LanguageSelect.vue +202 -0
  71. package/app/components/ui/LightBox.vue +155 -0
  72. package/app/components/ui/LocalTime.vue +170 -0
  73. package/app/components/ui/Modal.vue +161 -0
  74. package/app/components/ui/Popup.vue +200 -0
  75. package/app/components/ui/PostContent.server.vue +23 -0
  76. package/app/components/ui/ProtectedEmail.vue +52 -0
  77. package/app/components/ui/RelativeTime.vue +141 -0
  78. package/app/components/ui/ScheduledContent.vue +150 -0
  79. package/app/components/ui/ScrollToTop.client.vue +48 -0
  80. package/app/components/ui/SegmentedControl.vue +148 -0
  81. package/app/components/ui/SiteSearch.vue +1191 -0
  82. package/app/components/ui/Skeleton.vue +91 -0
  83. package/app/components/ui/SmartContrast.vue +74 -0
  84. package/app/components/ui/SnapContainer.vue +222 -0
  85. package/app/components/ui/SnapSection.vue +294 -0
  86. package/app/components/ui/SonnerStyle.vue +7 -0
  87. package/app/components/ui/SplitSection.vue +99 -0
  88. package/app/components/ui/Steps.vue +858 -0
  89. package/app/components/ui/StickyWrapper.vue +46 -0
  90. package/app/components/ui/Table.vue +251 -0
  91. package/app/components/ui/Tabs.vue +451 -0
  92. package/app/components/ui/TextColumn.vue +36 -0
  93. package/app/components/ui/Textarea.vue +251 -0
  94. package/app/components/ui/Toggler.vue +40 -0
  95. package/app/components/ui/Tooltip.vue +524 -0
  96. package/app/components/ui/TruncateText.vue +105 -0
  97. package/app/components/ui/ViewportSpacer.vue +72 -0
  98. package/app/components/view/AnimatedCounter.vue +121 -0
  99. package/app/components/view/AnnouncementBar.vue +104 -0
  100. package/app/components/view/AvatarGroup.vue +104 -0
  101. package/app/components/view/Breadcrumbs.vue +97 -0
  102. package/app/components/view/ContentWithToc.vue +152 -0
  103. package/app/components/view/Copyright.vue +68 -0
  104. package/app/components/view/CountdownTimer.vue +184 -0
  105. package/app/components/view/CreativeCTA.vue +143 -0
  106. package/app/components/view/CurrencySelect.vue +254 -0
  107. package/app/components/view/FeatureBoxGrid.vue +142 -0
  108. package/app/components/view/HorizontalMenu.vue +97 -0
  109. package/app/components/view/ImageCompare.vue +141 -0
  110. package/app/components/view/ImgSlider.vue +333 -0
  111. package/app/components/view/InfiniteMarquee.vue +147 -0
  112. package/app/components/view/InfoBar.vue +86 -0
  113. package/app/components/view/LogoGrid.vue +106 -0
  114. package/app/components/view/LogoSlider.vue +83 -0
  115. package/app/components/view/NotFound.vue +81 -0
  116. package/app/components/view/PartialBackground.vue +313 -0
  117. package/app/components/view/QuoteBig.vue +111 -0
  118. package/app/components/view/ResponsiveMenu.vue +219 -0
  119. package/app/components/view/ReviewsSlider.vue +230 -0
  120. package/app/components/view/SocialBar.vue +78 -0
  121. package/app/components/view/StickyHeadingContent.vue +158 -0
  122. package/app/components/view/TallyForm.vue +295 -0
  123. package/app/components/view/WarningOutdated.vue +113 -0
  124. package/app/composables/useApi.ts +88 -0
  125. package/app/composables/useAppSeo.ts +78 -0
  126. package/app/composables/useBreadcrumbs.ts +106 -0
  127. package/app/composables/useChangeUrl.ts +73 -0
  128. package/app/composables/useCommand.ts +28 -0
  129. package/app/composables/useCookieControl.ts +111 -0
  130. package/app/composables/useCookieModal.ts +9 -0
  131. package/app/composables/useDevice.ts +109 -0
  132. package/app/composables/useGeoFetch.ts +139 -0
  133. package/app/composables/useLoadScript.ts +36 -0
  134. package/app/composables/useModalState.ts +37 -0
  135. package/app/composables/useMultiLang.ts +278 -0
  136. package/app/composables/useNetwork.ts +49 -0
  137. package/app/composables/useNuxtVersion.ts +5 -0
  138. package/app/composables/usePiniaStore.ts +5 -0
  139. package/app/composables/usePopupControl.ts +57 -0
  140. package/app/composables/useQuery.ts +307 -0
  141. package/app/composables/useReadyPage.ts +182 -0
  142. package/app/composables/useSafeList.ts +90 -0
  143. package/app/composables/useScriptLoader.ts +221 -0
  144. package/app/composables/useSiteSearch.ts +32 -0
  145. package/app/composables/useSnapScroll.ts +24 -0
  146. package/app/composables/useStatic.ts +5 -0
  147. package/app/composables/useStorage.ts +252 -0
  148. package/app/composables/useStoreBroadcast.ts +146 -0
  149. package/app/composables/useThemeSync.ts +81 -0
  150. package/app/constants/layout.ts +109 -0
  151. package/app/constants/predefinedCookieScripts.ts +1222 -0
  152. package/app/constants/ui-events.ts +1 -0
  153. package/app/error.vue +169 -0
  154. package/app/layouts/default-blog.vue +5 -0
  155. package/app/layouts/default.vue +3 -0
  156. package/app/locales/en/commands.json +5 -0
  157. package/app/locales/en/cookies.json +182 -0
  158. package/app/locales/en/error.json +4 -0
  159. package/app/locales/en/interface.json +33 -0
  160. package/app/locales/en/myelophone.json +8 -0
  161. package/app/locales/en/outdated.json +5 -0
  162. package/app/locales/en/times.json +18 -0
  163. package/app/locales/pl/commands.json +5 -0
  164. package/app/locales/pl/cookies.json +182 -0
  165. package/app/locales/pl/error.json +4 -0
  166. package/app/locales/pl/interface.json +33 -0
  167. package/app/locales/pl/myelophone.json +8 -0
  168. package/app/locales/pl/outdated.json +5 -0
  169. package/app/locales/pl/times.json +18 -0
  170. package/app/locales/ru/commands.json +5 -0
  171. package/app/locales/ru/cookies.json +182 -0
  172. package/app/locales/ru/error.json +4 -0
  173. package/app/locales/ru/interface.json +33 -0
  174. package/app/locales/ru/myelophone.json +8 -0
  175. package/app/locales/ru/outdated.json +5 -0
  176. package/app/locales/ru/times.json +18 -0
  177. package/app/middleware/blog-layout.ts +28 -0
  178. package/app/middleware/i18n.global.ts +17 -0
  179. package/app/middleware/not-found-status.ts +11 -0
  180. package/app/modules/default-blog/index.ts +39 -0
  181. package/app/modules/default-blog/posts.ts +80 -0
  182. package/app/modules/default-sitemap/index.ts +116 -0
  183. package/app/modules/default-sitemap/runtime/sitemap.get.ts +42 -0
  184. package/app/modules/fullscreen-preloader/module.ts +43 -0
  185. package/app/modules/htaccess/.htaccess +38 -0
  186. package/app/modules/htaccess/index.ts +23 -0
  187. package/app/modules/i18n-shaker.mjs +221 -0
  188. package/app/modules/multi18n/module.ts +71 -0
  189. package/app/modules/myelophone-config/module.ts +241 -0
  190. package/app/pages/[...all].vue +9 -0
  191. package/app/pages/index.vue +3 -0
  192. package/app/pages/post/[...slug].vue +30 -0
  193. package/app/plugins/bfcache-refresh.client.ts +9 -0
  194. package/app/plugins/canonical.ts +30 -0
  195. package/app/plugins/csp-nonce.server.ts +41 -0
  196. package/app/plugins/multi18n.client.ts +21 -0
  197. package/app/plugins/multi18n.server.ts +15 -0
  198. package/app/plugins/nuxt-version.client.ts +4 -0
  199. package/app/plugins/restore.client.ts +21 -0
  200. package/app/plugins/reveal.ts +89 -0
  201. package/app/plugins/url-helper.client.ts +66 -0
  202. package/app/server/api/exchange-rates.get.ts +216 -0
  203. package/app/server/api/healthz.ts +1 -0
  204. package/app/server/api/logout.post.ts +6 -0
  205. package/app/server/middleware/normalize-url.ts +14 -0
  206. package/app/server/middleware/security-headers.ts +147 -0
  207. package/app/server/middleware/url-helper.ts +43 -0
  208. package/app/server/plugins/clean-html-spaces.ts +15 -0
  209. package/app/server/plugins/clean-styles.ts +94 -0
  210. package/app/server/plugins/compression.ts +122 -0
  211. package/app/server/plugins/css-preload.ts +26 -0
  212. package/app/server/plugins/early-hints.ts +31 -0
  213. package/app/server/plugins/force-noindex.ts +43 -0
  214. package/app/server/plugins/html-one-line.ts +17 -0
  215. package/app/server/plugins/inline-style.ts +7 -0
  216. package/app/server/routes/healthz.get.ts +1 -0
  217. package/app/server/tsconfig.json +3 -0
  218. package/app/stores/cart.ts +945 -0
  219. package/app/stores/commands.ts +43 -0
  220. package/app/stores/device.ts +156 -0
  221. package/app/stores/querySync.ts +5 -0
  222. package/app/stores/settings.ts +145 -0
  223. package/app/stores/user.ts +607 -0
  224. package/app/types/cookie.ts +89 -0
  225. package/app/types/myelophone.d.ts +87 -0
  226. package/app/types/site-search.ts +110 -0
  227. package/app/utils/asyncRefresh.ts +4 -0
  228. package/app/utils/blog.server.ts +142 -0
  229. package/app/utils/jsonLd.ts +56 -0
  230. package/app/utils/myelophoneConfig.ts +4 -0
  231. package/app/utils/sortBy.ts +18 -0
  232. package/app/utils/transliterate.ts +75 -0
  233. package/app/utils/ytVideo.ts +37 -0
  234. package/app/workers/site-search.worker.ts +661 -0
  235. package/biome.json +94 -0
  236. package/commitlint.config.js +3 -0
  237. package/nuxt.config.ts +539 -0
  238. package/package.json +101 -0
  239. package/playground/content/.gitkeep +0 -0
  240. package/playground/locales/.gitkeep +0 -0
  241. package/playground/myelophone.dev.ts +45 -0
  242. package/playground/nuxt.config.ts +105 -0
  243. package/playground/package.json +5 -0
  244. package/playground/pages/.gitkeep +0 -0
  245. package/playground/tsconfig.json +3 -0
  246. package/playwright.config.ts +23 -0
  247. package/public/browsers/chrome.svg +77 -0
  248. package/public/browsers/edge.svg +98 -0
  249. package/public/browsers/firefox.svg +300 -0
  250. package/public/favicon.ico +0 -0
  251. package/public/myelophone_eng.png +0 -0
  252. package/public/myelophone_eng_white.png +0 -0
  253. package/spa-loading-template.html +72 -0
  254. package/tests/home.spec.ts +9 -0
  255. package/tests/utils.ts +23 -0
  256. package/tsconfig.json +16 -0
  257. package/vite/plugins/clean-css.ts +190 -0
  258. package/vite/plugins/postcss-add-viewportunits.ts +33 -0
  259. package/vite/plugins/postcss-viewport-fallback.ts +49 -0
@@ -0,0 +1,1222 @@
1
+ import type {
2
+ CookieCategory,
3
+ CookieScriptLegalBasis,
4
+ CookieScriptDef,
5
+ CookieScriptsConfig,
6
+ LocalizedCookieText,
7
+ } from '~/types/cookie';
8
+
9
+ type ScriptPreset = CookieScriptsConfig;
10
+
11
+ type BasePresetOptions = {
12
+ id?: string;
13
+ name?: LocalizedCookieText;
14
+ nameKey?: string;
15
+ description?: LocalizedCookieText;
16
+ descriptionKey?: string;
17
+ legalBasis?: CookieScriptLegalBasis;
18
+ loadKey?: string;
19
+ options?: any;
20
+ };
21
+
22
+ const I18N_SAFE_LIST_READY_KEY = '__i18nSafeListReady';
23
+ const I18N_SAFE_LIST_KEYS_KEY = '__i18nSafeListKeys';
24
+
25
+ const isTranslationKey = (value: unknown): value is string =>
26
+ typeof value === 'string' &&
27
+ /^[a-zA-Z0-9/_-]+(?:\.[a-zA-Z0-9/_-]+)+$/.test(value);
28
+
29
+ const collectSafeListKeys = (source: unknown, keys = new Set<string>()) => {
30
+ if (!source) return keys;
31
+
32
+ if (Array.isArray(source)) {
33
+ source.forEach((item) => collectSafeListKeys(item, keys));
34
+ return keys;
35
+ }
36
+
37
+ if (typeof source !== 'object') return keys;
38
+
39
+ Object.entries(source).forEach(([key, value]) => {
40
+ if (key !== 'loadKey' && key.endsWith('Key')) {
41
+ if (isTranslationKey(value)) keys.add(value);
42
+ return;
43
+ }
44
+
45
+ if (key.endsWith('Keys') && Array.isArray(value)) {
46
+ value.forEach((item) => {
47
+ if (isTranslationKey(item)) keys.add(item);
48
+ });
49
+ return;
50
+ }
51
+
52
+ collectSafeListKeys(value, keys);
53
+ });
54
+
55
+ return keys;
56
+ };
57
+
58
+ const registerSafeListSource = (source: CookieScriptsConfig) => {
59
+ if (
60
+ typeof process === 'undefined' ||
61
+ !process.versions?.node ||
62
+ typeof window !== 'undefined'
63
+ ) {
64
+ return;
65
+ }
66
+
67
+ const globalState = globalThis as unknown as Record<
68
+ string,
69
+ Promise<unknown> | Set<string> | undefined
70
+ >;
71
+ const registry =
72
+ (globalState[I18N_SAFE_LIST_KEYS_KEY] as Set<string> | undefined) ||
73
+ new Set<string>();
74
+
75
+ collectSafeListKeys(source).forEach((key) => registry.add(key));
76
+ globalState[I18N_SAFE_LIST_KEYS_KEY] = registry;
77
+ globalState[I18N_SAFE_LIST_READY_KEY] = Promise.resolve();
78
+ };
79
+
80
+ const addScript = (
81
+ category: CookieCategory,
82
+ script: CookieScriptDef,
83
+ ): ScriptPreset => ({
84
+ [category]: [script],
85
+ });
86
+
87
+ const consentStore = (vendor: string) => `
88
+ window.__cookieScriptConsent = window.__cookieScriptConsent || {};
89
+ window.__cookieScriptConsent["${vendor}"] = context.categories;
90
+ `;
91
+
92
+ const consentStoreInitializer = (vendor: string) => ({
93
+ key: `consent-store:${vendor}`,
94
+ code: consentStore(vendor),
95
+ });
96
+
97
+ const hubspotQueueInitializer = {
98
+ key: 'hubspot-queue',
99
+ code: `
100
+ window._hsq = window._hsq || [];
101
+ `,
102
+ };
103
+
104
+ const queueInit = (globalName: string, queueName = 'q') => `
105
+ window.${globalName} = window.${globalName} || function(){ (window.${globalName}.${queueName} = window.${globalName}.${queueName} || []).push(arguments); };
106
+ `;
107
+
108
+ const gtagInit = `
109
+ window.dataLayer = window.dataLayer || [];
110
+ function gtag(){ window.dataLayer.push(arguments); }
111
+ `;
112
+
113
+ const gtagInitializer = {
114
+ key: 'gtag',
115
+ code: gtagInit,
116
+ };
117
+
118
+ const gtagConsentDefault = `
119
+ gtag("consent", "default", {
120
+ ad_storage: "denied",
121
+ ad_user_data: "denied",
122
+ ad_personalization: "denied",
123
+ analytics_storage: "denied",
124
+ functionality_storage: "denied",
125
+ personalization_storage: "denied",
126
+ security_storage: "granted"
127
+ });
128
+ `;
129
+
130
+ const gtagConsentDefaultInitializer = {
131
+ key: 'gtag-consent-default',
132
+ code: gtagConsentDefault,
133
+ };
134
+
135
+ const googleConsentUpdates = {
136
+ analytics: `
137
+ gtag("consent", "update", { analytics_storage: "granted" });
138
+ `,
139
+ marketing: `
140
+ gtag("consent", "update", {
141
+ ad_storage: "granted",
142
+ ad_user_data: "granted",
143
+ ad_personalization: "granted"
144
+ });
145
+ `,
146
+ functional: `
147
+ gtag("consent", "update", { functionality_storage: "granted" });
148
+ `,
149
+ };
150
+
151
+ export const mergeCookieScriptConfigs = (
152
+ ...configs: Array<CookieScriptsConfig | undefined | null | false>
153
+ ): CookieScriptsConfig => {
154
+ const merged = configs.reduce<CookieScriptsConfig>((merged, config) => {
155
+ if (!config) return merged;
156
+
157
+ Object.entries(config).forEach(([category, scripts]) => {
158
+ if (category === 'notices') {
159
+ merged.notices = [
160
+ ...(merged.notices || []),
161
+ ...(scripts || []),
162
+ ];
163
+ return;
164
+ }
165
+
166
+ const cookieCategory = category as CookieCategory;
167
+ merged[cookieCategory] = [
168
+ ...(merged[cookieCategory] || []),
169
+ ...(scripts || []),
170
+ ];
171
+ });
172
+
173
+ return merged;
174
+ }, {});
175
+
176
+ registerSafeListSource(merged);
177
+
178
+ return merged;
179
+ };
180
+
181
+ export const resolveCookieScriptText = (
182
+ value: LocalizedCookieText | undefined,
183
+ locale: string,
184
+ fallbackLocale = 'en',
185
+ ) => {
186
+ if (!value || typeof value === 'string') return value;
187
+
188
+ return value[locale] || value[fallbackLocale] || Object.values(value)[0];
189
+ };
190
+
191
+ export const cookieScriptPresets = {
192
+ googleTagManager: ({
193
+ containerId,
194
+ id = 'google-tag-manager',
195
+ name = 'Google Tag Manager',
196
+ nameKey = 'cookies.googleTagManager.name',
197
+ descriptionKey = 'cookies.googleTagManager.description',
198
+ loadKey = `gtm:${containerId}`,
199
+ options,
200
+ }: BasePresetOptions & { containerId: string }): ScriptPreset => {
201
+ const script: CookieScriptDef = {
202
+ id,
203
+ name,
204
+ nameKey,
205
+ descriptionKey,
206
+ loadKey,
207
+ src: `https://www.googletagmanager.com/gtm.js?id=${containerId}`,
208
+ initializers: [gtagInitializer, gtagConsentDefaultInitializer],
209
+ beforeLoad: `
210
+ window.dataLayer.push({ "gtm.start": new Date().getTime(), event: "gtm.js" });
211
+ `,
212
+ categorySettings: {
213
+ analytics: {
214
+ beforeLoad: googleConsentUpdates.analytics,
215
+ },
216
+ marketing: {
217
+ beforeLoad: `${googleConsentUpdates.marketing}
218
+ gtag("consent", "update", { personalization_storage: "granted" });
219
+ `,
220
+ },
221
+ functional: {
222
+ beforeLoad: googleConsentUpdates.functional,
223
+ },
224
+ },
225
+ options,
226
+ };
227
+
228
+ return {
229
+ analytics: [script],
230
+ marketing: [script],
231
+ functional: [script],
232
+ };
233
+ },
234
+
235
+ googleAnalytics4: ({
236
+ measurementId,
237
+ id = 'google-analytics-4',
238
+ name = 'Google Analytics 4',
239
+ nameKey = 'cookies.googleAnalytics4.name',
240
+ descriptionKey = 'cookies.googleAnalytics4.description',
241
+ loadKey = 'gtag',
242
+ options,
243
+ }: BasePresetOptions & { measurementId: string }): ScriptPreset =>
244
+ addScript('analytics', {
245
+ id,
246
+ name,
247
+ nameKey,
248
+ descriptionKey,
249
+ loadKey,
250
+ src: `https://www.googletagmanager.com/gtag/js?id=${measurementId}`,
251
+ initializers: [gtagInitializer, gtagConsentDefaultInitializer],
252
+ beforeLoad: `
253
+ gtag("js", new Date());
254
+ `,
255
+ categorySettings: {
256
+ analytics: {
257
+ beforeLoad: `${googleConsentUpdates.analytics}
258
+ gtag("config", "${measurementId}", { anonymize_ip: true });
259
+ `,
260
+ },
261
+ },
262
+ options,
263
+ }),
264
+
265
+ googleAds: ({
266
+ conversionId,
267
+ id = 'google-ads',
268
+ name = 'Google Ads',
269
+ nameKey = 'cookies.googleAds.name',
270
+ descriptionKey = 'cookies.googleAds.description',
271
+ loadKey = 'gtag',
272
+ options,
273
+ }: BasePresetOptions & { conversionId: string }): ScriptPreset =>
274
+ addScript('marketing', {
275
+ id,
276
+ name,
277
+ nameKey,
278
+ descriptionKey,
279
+ loadKey,
280
+ src: `https://www.googletagmanager.com/gtag/js?id=${conversionId}`,
281
+ initializers: [gtagInitializer, gtagConsentDefaultInitializer],
282
+ categorySettings: {
283
+ marketing: {
284
+ beforeLoad: `${googleConsentUpdates.marketing}
285
+ gtag("config", "${conversionId}");
286
+ `,
287
+ },
288
+ },
289
+ options,
290
+ }),
291
+
292
+ metaPixel: ({
293
+ pixelId,
294
+ id = 'meta-pixel',
295
+ name = 'Meta Pixel',
296
+ nameKey = 'cookies.metaPixel.name',
297
+ descriptionKey = 'cookies.metaPixel.description',
298
+ loadKey = 'meta-pixel',
299
+ options,
300
+ }: BasePresetOptions & { pixelId: string }): ScriptPreset =>
301
+ addScript('marketing', {
302
+ id,
303
+ name,
304
+ nameKey,
305
+ descriptionKey,
306
+ loadKey,
307
+ src: 'https://connect.facebook.net/en_US/fbevents.js',
308
+ beforeLoad: `
309
+ !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
310
+ n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
311
+ n.push=n;n.loaded=!0;n.version="2.0";n.queue=[];}(window, document, "script");
312
+ fbq("consent", "revoke");
313
+ `,
314
+ categorySettings: {
315
+ marketing: {
316
+ beforeLoad: `
317
+ fbq("consent", "grant");
318
+ fbq("init", "${pixelId}");
319
+ fbq("track", "PageView");
320
+ `,
321
+ },
322
+ },
323
+ options,
324
+ }),
325
+
326
+ yandexMetrica: ({
327
+ counterId,
328
+ id = 'yandex-metrica',
329
+ name = 'Yandex Metrica',
330
+ nameKey = 'cookies.yandexMetrica.name',
331
+ descriptionKey = 'cookies.yandexMetrica.description',
332
+ loadKey = 'yandex-metrica',
333
+ options,
334
+ }: BasePresetOptions & { counterId: string | number }): ScriptPreset =>
335
+ addScript('analytics', {
336
+ id,
337
+ name,
338
+ nameKey,
339
+ descriptionKey,
340
+ loadKey,
341
+ src: 'https://mc.yandex.ru/metrika/tag.js',
342
+ beforeLoad: `
343
+ window.ym = window.ym || function(){ (window.ym.a = window.ym.a || []).push(arguments); };
344
+ window.ym.l = 1 * new Date();
345
+ `,
346
+ categorySettings: {
347
+ analytics: {
348
+ beforeLoad: `
349
+ ym(${counterId}, "init", {
350
+ clickmap: true,
351
+ trackLinks: true,
352
+ accurateTrackBounce: true,
353
+ webvisor: false
354
+ });
355
+ `,
356
+ },
357
+ },
358
+ options,
359
+ }),
360
+
361
+ vkPixel: ({
362
+ pixelId,
363
+ id = 'vk-pixel',
364
+ name = 'VK Pixel',
365
+ nameKey = 'cookies.vkPixel.name',
366
+ descriptionKey = 'cookies.vkPixel.description',
367
+ loadKey = 'vk-pixel',
368
+ options,
369
+ }: BasePresetOptions & { pixelId: string | number }): ScriptPreset =>
370
+ addScript('marketing', {
371
+ id,
372
+ name,
373
+ nameKey,
374
+ descriptionKey,
375
+ loadKey,
376
+ src: 'https://vk.com/js/api/openapi.js',
377
+ beforeLoad: `
378
+ window.VK = window.VK || {};
379
+ `,
380
+ categorySettings: {
381
+ marketing: {
382
+ beforeLoad: `
383
+ if (window.VK && VK.Retargeting) {
384
+ VK.Retargeting.Init("${pixelId}");
385
+ VK.Retargeting.Hit();
386
+ }
387
+ `,
388
+ },
389
+ },
390
+ options,
391
+ }),
392
+
393
+ myTargetTopMailRu: ({
394
+ counterId,
395
+ id = 'mytarget-topmailru',
396
+ name = 'myTarget / Top.Mail.Ru',
397
+ nameKey = 'cookies.myTargetTopMailRu.name',
398
+ descriptionKey = 'cookies.myTargetTopMailRu.description',
399
+ loadKey = 'top-mail-ru',
400
+ options,
401
+ }: BasePresetOptions & { counterId: string | number }): ScriptPreset =>
402
+ addScript('marketing', {
403
+ id,
404
+ name,
405
+ nameKey,
406
+ descriptionKey,
407
+ loadKey,
408
+ src: 'https://top-fwz1.mail.ru/js/code.js',
409
+ beforeLoad: queueInit('_tmr'),
410
+ categorySettings: {
411
+ marketing: {
412
+ beforeLoad: `
413
+ _tmr("init", { id: "${counterId}", type: "pageView", start: new Date().getTime() });
414
+ `,
415
+ },
416
+ },
417
+ options,
418
+ }),
419
+
420
+ baiduTongji: ({
421
+ siteId,
422
+ id = 'baidu-tongji',
423
+ name = 'Baidu Tongji',
424
+ nameKey = 'cookies.baiduTongji.name',
425
+ descriptionKey = 'cookies.baiduTongji.description',
426
+ loadKey = 'baidu-tongji',
427
+ options,
428
+ }: BasePresetOptions & { siteId: string }): ScriptPreset =>
429
+ addScript('analytics', {
430
+ id,
431
+ name,
432
+ nameKey,
433
+ descriptionKey,
434
+ loadKey,
435
+ src: `https://hm.baidu.com/hm.js?${siteId}`,
436
+ beforeLoad: `
437
+ window._hmt = window._hmt || [];
438
+ `,
439
+ options,
440
+ }),
441
+
442
+ matomo: ({
443
+ trackerUrl,
444
+ siteId,
445
+ id = 'matomo',
446
+ name = 'Matomo',
447
+ nameKey = 'cookies.matomo.name',
448
+ descriptionKey = 'cookies.matomo.description',
449
+ loadKey,
450
+ options,
451
+ }: BasePresetOptions & {
452
+ trackerUrl: string;
453
+ siteId: string | number;
454
+ }): ScriptPreset => {
455
+ const baseUrl = trackerUrl.replace(/\/$/, '');
456
+
457
+ return addScript('analytics', {
458
+ id,
459
+ name,
460
+ nameKey,
461
+ descriptionKey,
462
+ loadKey: loadKey || `matomo:${baseUrl}`,
463
+ src: `${baseUrl}/matomo.js`,
464
+ beforeLoad: `
465
+ window._paq = window._paq || [];
466
+ _paq.push(["setTrackerUrl", "${baseUrl}/matomo.php"]);
467
+ _paq.push(["setSiteId", "${siteId}"]);
468
+ `,
469
+ categorySettings: {
470
+ analytics: {
471
+ beforeLoad: `
472
+ _paq.push(["trackPageView"]);
473
+ _paq.push(["enableLinkTracking"]);
474
+ `,
475
+ },
476
+ },
477
+ options,
478
+ });
479
+ },
480
+
481
+ plausible: ({
482
+ domain,
483
+ src = 'https://plausible.io/js/script.js',
484
+ id = 'plausible',
485
+ name = 'Plausible Analytics',
486
+ nameKey = 'cookies.plausible.name',
487
+ descriptionKey = 'cookies.plausible.description',
488
+ loadKey = `plausible:${domain}`,
489
+ options,
490
+ }: BasePresetOptions & { domain: string; src?: string }): ScriptPreset =>
491
+ addScript('analytics', {
492
+ id,
493
+ name,
494
+ nameKey,
495
+ descriptionKey,
496
+ loadKey,
497
+ src,
498
+ beforeLoad: `
499
+ window.plausible = window.plausible || function(){ (window.plausible.q = window.plausible.q || []).push(arguments); };
500
+ `,
501
+ options: {
502
+ ...options,
503
+ scriptAttributes: {
504
+ defer: true,
505
+ 'data-domain': domain,
506
+ ...options?.scriptAttributes,
507
+ },
508
+ },
509
+ }),
510
+
511
+ umami: ({
512
+ websiteId,
513
+ src,
514
+ hostUrl,
515
+ domains,
516
+ autoTrack = true,
517
+ doNotTrack = true,
518
+ excludeSearch = true,
519
+ excludeHash = true,
520
+ legalBasis,
521
+ id = 'umami',
522
+ name = 'Umami',
523
+ nameKey = 'cookies.umami.name',
524
+ descriptionKey = 'cookies.umami.description',
525
+ loadKey = `umami:${websiteId}`,
526
+ options,
527
+ }: BasePresetOptions & {
528
+ websiteId: string;
529
+ src: string;
530
+ hostUrl?: string;
531
+ domains?: string | string[];
532
+ autoTrack?: boolean;
533
+ doNotTrack?: boolean;
534
+ excludeSearch?: boolean;
535
+ excludeHash?: boolean;
536
+ }): ScriptPreset =>
537
+ legalBasis === 'cookieless'
538
+ ? {
539
+ notices: [
540
+ {
541
+ id,
542
+ name,
543
+ nameKey,
544
+ descriptionKey,
545
+ provider: 'Umami',
546
+ legalBasis,
547
+ loadKey,
548
+ src,
549
+ legal: {
550
+ purposeKey: 'cookies.umami.legal.purpose',
551
+ dataCollectedKeys: [
552
+ 'cookies.umami.legal.data.pageViews',
553
+ 'cookies.umami.legal.data.referrer',
554
+ 'cookies.umami.legal.data.browser',
555
+ 'cookies.umami.legal.data.device',
556
+ ],
557
+ cookiesUsed: false,
558
+ cookiesDescriptionKey:
559
+ 'cookies.umami.legal.cookiesDescription',
560
+ privacyPolicyUrl: 'https://umami.is/privacy',
561
+ officialDocsUrl:
562
+ 'https://docs.umami.is/docs/tracker-configuration',
563
+ notesKey: 'cookies.umami.legal.notes',
564
+ },
565
+ options: {
566
+ ...options,
567
+ scriptAttributes: {
568
+ defer: true,
569
+ 'data-website-id': websiteId,
570
+ ...(hostUrl
571
+ ? { 'data-host-url': hostUrl }
572
+ : {}),
573
+ ...(domains
574
+ ? {
575
+ 'data-domains': Array.isArray(
576
+ domains,
577
+ )
578
+ ? domains.join(',')
579
+ : domains,
580
+ }
581
+ : {}),
582
+ ...(autoTrack === false
583
+ ? { 'data-auto-track': 'false' }
584
+ : {}),
585
+ ...(doNotTrack
586
+ ? { 'data-do-not-track': 'true' }
587
+ : {}),
588
+ ...(excludeSearch
589
+ ? { 'data-exclude-search': 'true' }
590
+ : {}),
591
+ ...(excludeHash
592
+ ? { 'data-exclude-hash': 'true' }
593
+ : {}),
594
+ ...options?.scriptAttributes,
595
+ },
596
+ },
597
+ },
598
+ ],
599
+ }
600
+ : addScript('analytics', {
601
+ id,
602
+ name,
603
+ nameKey,
604
+ descriptionKey,
605
+ provider: 'Umami',
606
+ legalBasis: legalBasis || 'consent',
607
+ loadKey,
608
+ src,
609
+ legal: {
610
+ purposeKey: 'cookies.umami.legal.purpose',
611
+ dataCollectedKeys: [
612
+ 'cookies.umami.legal.data.pageViews',
613
+ 'cookies.umami.legal.data.referrer',
614
+ 'cookies.umami.legal.data.browser',
615
+ 'cookies.umami.legal.data.device',
616
+ ],
617
+ cookiesUsed: false,
618
+ cookiesDescriptionKey:
619
+ 'cookies.umami.legal.cookiesDescription',
620
+ privacyPolicyUrl: 'https://umami.is/privacy',
621
+ officialDocsUrl:
622
+ 'https://docs.umami.is/docs/tracker-configuration',
623
+ notesKey: 'cookies.umami.legal.notes',
624
+ },
625
+ options: {
626
+ ...options,
627
+ scriptAttributes: {
628
+ defer: true,
629
+ 'data-website-id': websiteId,
630
+ ...(hostUrl ? { 'data-host-url': hostUrl } : {}),
631
+ ...(domains
632
+ ? {
633
+ 'data-domains': Array.isArray(domains)
634
+ ? domains.join(',')
635
+ : domains,
636
+ }
637
+ : {}),
638
+ ...(autoTrack === false
639
+ ? { 'data-auto-track': 'false' }
640
+ : {}),
641
+ ...(doNotTrack
642
+ ? { 'data-do-not-track': 'true' }
643
+ : {}),
644
+ ...(excludeSearch
645
+ ? { 'data-exclude-search': 'true' }
646
+ : {}),
647
+ ...(excludeHash
648
+ ? { 'data-exclude-hash': 'true' }
649
+ : {}),
650
+ ...options?.scriptAttributes,
651
+ },
652
+ },
653
+ }),
654
+
655
+ hotjar: ({
656
+ siteId,
657
+ version = 6,
658
+ id = 'hotjar',
659
+ name = 'Hotjar',
660
+ nameKey = 'cookies.hotjar.name',
661
+ descriptionKey = 'cookies.hotjar.description',
662
+ loadKey = `hotjar:${siteId}`,
663
+ options,
664
+ }: BasePresetOptions & {
665
+ siteId: string | number;
666
+ version?: number;
667
+ }): ScriptPreset =>
668
+ addScript('analytics', {
669
+ id,
670
+ name,
671
+ nameKey,
672
+ descriptionKey,
673
+ loadKey,
674
+ src: `https://static.hotjar.com/c/hotjar-${siteId}.js?sv=${version}`,
675
+ beforeLoad: `
676
+ window.hj = window.hj || function(){ (window.hj.q = window.hj.q || []).push(arguments); };
677
+ window._hjSettings = { hjid: ${siteId}, hjsv: ${version} };
678
+ `,
679
+ options,
680
+ }),
681
+
682
+ microsoftClarity: ({
683
+ projectId,
684
+ id = 'microsoft-clarity',
685
+ name = 'Microsoft Clarity',
686
+ nameKey = 'cookies.microsoftClarity.name',
687
+ descriptionKey = 'cookies.microsoftClarity.description',
688
+ loadKey = `clarity:${projectId}`,
689
+ options,
690
+ }: BasePresetOptions & { projectId: string }): ScriptPreset =>
691
+ addScript('analytics', {
692
+ id,
693
+ name,
694
+ nameKey,
695
+ descriptionKey,
696
+ loadKey,
697
+ src: `https://www.clarity.ms/tag/${projectId}`,
698
+ beforeLoad: queueInit('clarity'),
699
+ options,
700
+ }),
701
+
702
+ adobeAnalytics: ({
703
+ src,
704
+ id = 'adobe-analytics',
705
+ name = 'Adobe Analytics',
706
+ nameKey = 'cookies.adobeAnalytics.name',
707
+ descriptionKey = 'cookies.adobeAnalytics.description',
708
+ loadKey = 'adobe-analytics',
709
+ options,
710
+ }: BasePresetOptions & { src: string }): ScriptPreset =>
711
+ addScript('analytics', {
712
+ id,
713
+ name,
714
+ nameKey,
715
+ descriptionKey,
716
+ loadKey,
717
+ src,
718
+ options,
719
+ }),
720
+
721
+ hubspot: ({
722
+ portalId,
723
+ id = 'hubspot',
724
+ name = 'HubSpot',
725
+ nameKey = 'cookies.hubspot.name',
726
+ descriptionKey = 'cookies.hubspot.description',
727
+ loadKey = `hubspot:${portalId}`,
728
+ options,
729
+ }: BasePresetOptions & { portalId: string | number }): ScriptPreset => {
730
+ const script: CookieScriptDef = {
731
+ id,
732
+ name,
733
+ nameKey,
734
+ descriptionKey,
735
+ loadKey,
736
+ src: `https://js.hs-scripts.com/${portalId}.js`,
737
+ initializers: [
738
+ hubspotQueueInitializer,
739
+ consentStoreInitializer('hubspot'),
740
+ ],
741
+ onConsentChange: consentStore('hubspot'),
742
+ categorySettings: {
743
+ analytics: {
744
+ beforeLoad: `
745
+ window._hsq.push(["setPath", window.location.pathname]);
746
+ `,
747
+ },
748
+ marketing: {},
749
+ functional: {},
750
+ },
751
+ options,
752
+ };
753
+
754
+ return {
755
+ analytics: [script],
756
+ marketing: [script],
757
+ functional: [script],
758
+ };
759
+ },
760
+
761
+ bitrix24: ({
762
+ widgetId,
763
+ host = 'cdn-ru.bitrix24.ru',
764
+ id = 'bitrix24',
765
+ name = 'Bitrix24',
766
+ nameKey = 'cookies.bitrix24.name',
767
+ descriptionKey = 'cookies.bitrix24.description',
768
+ loadKey = `bitrix24:${widgetId}`,
769
+ options,
770
+ }: BasePresetOptions & {
771
+ widgetId: string;
772
+ host?: string;
773
+ }): ScriptPreset => {
774
+ const script: CookieScriptDef = {
775
+ id,
776
+ name,
777
+ nameKey,
778
+ descriptionKey,
779
+ loadKey,
780
+ src: `https://${host}/b${widgetId}/crm/site_button/loader_1_${widgetId}.js`,
781
+ initializers: [consentStoreInitializer('bitrix24')],
782
+ onConsentChange: consentStore('bitrix24'),
783
+ categorySettings: {
784
+ marketing: {},
785
+ functional: {},
786
+ },
787
+ options,
788
+ };
789
+
790
+ return {
791
+ marketing: [script],
792
+ functional: [script],
793
+ };
794
+ },
795
+
796
+ amoCrm: ({
797
+ widgetHash,
798
+ id = 'amo-crm',
799
+ name = 'amoCRM',
800
+ nameKey = 'cookies.amoCrm.name',
801
+ descriptionKey = 'cookies.amoCrm.description',
802
+ loadKey = `amo-crm:${widgetHash}`,
803
+ options,
804
+ }: BasePresetOptions & { widgetHash: string }): ScriptPreset =>
805
+ addScript('functional', {
806
+ id,
807
+ name,
808
+ nameKey,
809
+ descriptionKey,
810
+ loadKey,
811
+ src: `https://widget.amocrm.ru/chat/chats-loader.js?hash=${widgetHash}`,
812
+ beforeLoad: consentStore('amoCrm'),
813
+ options,
814
+ }),
815
+
816
+ salesforcePardot: ({
817
+ src,
818
+ id = 'salesforce-pardot',
819
+ name = 'Salesforce Account Engagement',
820
+ nameKey = 'cookies.salesforcePardot.name',
821
+ descriptionKey = 'cookies.salesforcePardot.description',
822
+ loadKey = 'salesforce-pardot',
823
+ options,
824
+ }: BasePresetOptions & { src: string }): ScriptPreset =>
825
+ addScript('marketing', {
826
+ id,
827
+ name,
828
+ nameKey,
829
+ descriptionKey,
830
+ loadKey,
831
+ src,
832
+ options,
833
+ }),
834
+
835
+ mailchimp: ({
836
+ src,
837
+ id = 'mailchimp',
838
+ name = 'Mailchimp',
839
+ nameKey = 'cookies.mailchimp.name',
840
+ descriptionKey = 'cookies.mailchimp.description',
841
+ loadKey = 'mailchimp',
842
+ options,
843
+ }: BasePresetOptions & { src: string }): ScriptPreset =>
844
+ addScript('marketing', {
845
+ id,
846
+ name,
847
+ nameKey,
848
+ descriptionKey,
849
+ loadKey,
850
+ src,
851
+ options,
852
+ }),
853
+
854
+ linkedInInsight: ({
855
+ partnerId,
856
+ id = 'linkedin-insight',
857
+ name = 'LinkedIn Insight Tag',
858
+ nameKey = 'cookies.linkedInInsight.name',
859
+ descriptionKey = 'cookies.linkedInInsight.description',
860
+ loadKey = 'linkedin-insight',
861
+ options,
862
+ }: BasePresetOptions & { partnerId: string | number }): ScriptPreset =>
863
+ addScript('marketing', {
864
+ id,
865
+ name,
866
+ nameKey,
867
+ descriptionKey,
868
+ loadKey,
869
+ src: 'https://snap.licdn.com/li.lms-analytics/insight.min.js',
870
+ beforeLoad: `
871
+ window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || [];
872
+ window._linkedin_data_partner_ids.push("${partnerId}");
873
+ `,
874
+ options,
875
+ }),
876
+
877
+ tiktokPixel: ({
878
+ pixelId,
879
+ id = 'tiktok-pixel',
880
+ name = 'TikTok Pixel',
881
+ nameKey = 'cookies.tiktokPixel.name',
882
+ descriptionKey = 'cookies.tiktokPixel.description',
883
+ loadKey = 'tiktok-pixel',
884
+ options,
885
+ }: BasePresetOptions & { pixelId: string }): ScriptPreset =>
886
+ addScript('marketing', {
887
+ id,
888
+ name,
889
+ nameKey,
890
+ descriptionKey,
891
+ loadKey,
892
+ src: 'https://analytics.tiktok.com/i18n/pixel/events.js',
893
+ beforeLoad: `
894
+ window.ttq = window.ttq || [];
895
+ window.ttq.methods = ["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"];
896
+ window.ttq.setAndDefer = function(t,e){ t[e]=function(){ t.push([e].concat(Array.prototype.slice.call(arguments,0))); }; };
897
+ for (var i = 0; i < window.ttq.methods.length; i++) window.ttq.setAndDefer(window.ttq, window.ttq.methods[i]);
898
+ window.ttq.instance = function(t){ var e = window.ttq._i[t] || []; for (var n = 0; n < window.ttq.methods.length; n++) window.ttq.setAndDefer(e, window.ttq.methods[n]); return e; };
899
+ window.ttq._i = window.ttq._i || {};
900
+ window.ttq._i["${pixelId}"] = [];
901
+ `,
902
+ categorySettings: {
903
+ marketing: {
904
+ beforeLoad: `
905
+ ttq.load("${pixelId}");
906
+ ttq.page();
907
+ `,
908
+ },
909
+ },
910
+ options,
911
+ }),
912
+
913
+ pinterestTag: ({
914
+ tagId,
915
+ id = 'pinterest-tag',
916
+ name = 'Pinterest Tag',
917
+ nameKey = 'cookies.pinterestTag.name',
918
+ descriptionKey = 'cookies.pinterestTag.description',
919
+ loadKey = 'pinterest-tag',
920
+ options,
921
+ }: BasePresetOptions & { tagId: string }): ScriptPreset =>
922
+ addScript('marketing', {
923
+ id,
924
+ name,
925
+ nameKey,
926
+ descriptionKey,
927
+ loadKey,
928
+ src: 'https://s.pinimg.com/ct/core.js',
929
+ beforeLoad: `
930
+ window.pintrk = window.pintrk || function(){ (window.pintrk.queue = window.pintrk.queue || []).push(Array.prototype.slice.call(arguments)); };
931
+ window.pintrk.version = "3.0";
932
+ `,
933
+ categorySettings: {
934
+ marketing: {
935
+ beforeLoad: `
936
+ pintrk("load", "${tagId}");
937
+ pintrk("page");
938
+ `,
939
+ },
940
+ },
941
+ options,
942
+ }),
943
+
944
+ xPixel: ({
945
+ pixelId,
946
+ id = 'x-pixel',
947
+ name = 'X Pixel',
948
+ nameKey = 'cookies.xPixel.name',
949
+ descriptionKey = 'cookies.xPixel.description',
950
+ loadKey = 'x-pixel',
951
+ options,
952
+ }: BasePresetOptions & { pixelId: string }): ScriptPreset =>
953
+ addScript('marketing', {
954
+ id,
955
+ name,
956
+ nameKey,
957
+ descriptionKey,
958
+ loadKey,
959
+ src: 'https://static.ads-twitter.com/uwt.js',
960
+ beforeLoad: `
961
+ window.twq = window.twq || function(){ (window.twq.exe ? window.twq.exe.apply(window.twq, arguments) : window.twq.queue.push(arguments)); };
962
+ window.twq.version = "1.1";
963
+ window.twq.queue = window.twq.queue || [];
964
+ `,
965
+ categorySettings: {
966
+ marketing: {
967
+ beforeLoad: `
968
+ twq("config", "${pixelId}");
969
+ `,
970
+ },
971
+ },
972
+ options,
973
+ }),
974
+
975
+ intercom: ({
976
+ appId,
977
+ id = 'intercom',
978
+ name = 'Intercom',
979
+ nameKey = 'cookies.intercom.name',
980
+ descriptionKey = 'cookies.intercom.description',
981
+ loadKey = `intercom:${appId}`,
982
+ options,
983
+ }: BasePresetOptions & { appId: string }): ScriptPreset =>
984
+ addScript('functional', {
985
+ id,
986
+ name,
987
+ nameKey,
988
+ descriptionKey,
989
+ loadKey,
990
+ src: `https://widget.intercom.io/widget/${appId}`,
991
+ beforeLoad: `
992
+ window.intercomSettings = window.intercomSettings || { app_id: "${appId}" };
993
+ window.Intercom = window.Intercom || function(){ (window.Intercom.q = window.Intercom.q || []).push(arguments); };
994
+ `,
995
+ categorySettings: {
996
+ functional: {
997
+ beforeLoad: `
998
+ Intercom("boot", window.intercomSettings);
999
+ `,
1000
+ },
1001
+ },
1002
+ options,
1003
+ }),
1004
+
1005
+ zendeskChat: ({
1006
+ key,
1007
+ id = 'zendesk-chat',
1008
+ name = 'Zendesk Chat',
1009
+ nameKey = 'cookies.zendeskChat.name',
1010
+ descriptionKey = 'cookies.zendeskChat.description',
1011
+ loadKey = `zendesk:${key}`,
1012
+ options,
1013
+ }: BasePresetOptions & { key: string }): ScriptPreset =>
1014
+ addScript('functional', {
1015
+ id,
1016
+ name,
1017
+ nameKey,
1018
+ descriptionKey,
1019
+ loadKey,
1020
+ src: `https://static.zdassets.com/ekr/snippet.js?key=${key}`,
1021
+ options: {
1022
+ ...options,
1023
+ scriptAttributes: {
1024
+ id: 'ze-snippet',
1025
+ ...options?.scriptAttributes,
1026
+ },
1027
+ },
1028
+ }),
1029
+
1030
+ crispChat: ({
1031
+ websiteId,
1032
+ id = 'crisp-chat',
1033
+ name = 'Crisp Chat',
1034
+ nameKey = 'cookies.crispChat.name',
1035
+ descriptionKey = 'cookies.crispChat.description',
1036
+ loadKey = 'crisp-chat',
1037
+ options,
1038
+ }: BasePresetOptions & { websiteId: string }): ScriptPreset =>
1039
+ addScript('functional', {
1040
+ id,
1041
+ name,
1042
+ nameKey,
1043
+ descriptionKey,
1044
+ loadKey,
1045
+ src: 'https://client.crisp.chat/l.js',
1046
+ beforeLoad: `
1047
+ window.$crisp = window.$crisp || [];
1048
+ window.CRISP_WEBSITE_ID = "${websiteId}";
1049
+ `,
1050
+ options,
1051
+ }),
1052
+
1053
+ tawkTo: ({
1054
+ propertyId,
1055
+ widgetId,
1056
+ id = 'tawk-to',
1057
+ name = 'Tawk.to',
1058
+ nameKey = 'cookies.tawkTo.name',
1059
+ descriptionKey = 'cookies.tawkTo.description',
1060
+ loadKey = `tawk-to:${propertyId}:${widgetId}`,
1061
+ options,
1062
+ }: BasePresetOptions & {
1063
+ propertyId: string;
1064
+ widgetId: string;
1065
+ }): ScriptPreset =>
1066
+ addScript('functional', {
1067
+ id,
1068
+ name,
1069
+ nameKey,
1070
+ descriptionKey,
1071
+ loadKey,
1072
+ src: `https://embed.tawk.to/${propertyId}/${widgetId}`,
1073
+ beforeLoad: `
1074
+ window.Tawk_API = window.Tawk_API || {};
1075
+ window.Tawk_LoadStart = new Date();
1076
+ `,
1077
+ options,
1078
+ }),
1079
+
1080
+ jivoSite: ({
1081
+ widgetId,
1082
+ id = 'jivosite',
1083
+ name = 'JivoSite',
1084
+ nameKey = 'cookies.jivoSite.name',
1085
+ descriptionKey = 'cookies.jivoSite.description',
1086
+ loadKey = `jivosite:${widgetId}`,
1087
+ options,
1088
+ }: BasePresetOptions & { widgetId: string }): ScriptPreset =>
1089
+ addScript('functional', {
1090
+ id,
1091
+ name,
1092
+ nameKey,
1093
+ descriptionKey,
1094
+ loadKey,
1095
+ src: `https://code.jivosite.com/widget/${widgetId}`,
1096
+ options,
1097
+ }),
1098
+
1099
+ liveChat: ({
1100
+ license,
1101
+ id = 'livechat',
1102
+ name = 'LiveChat',
1103
+ nameKey = 'cookies.liveChat.name',
1104
+ descriptionKey = 'cookies.liveChat.description',
1105
+ loadKey = 'livechat',
1106
+ options,
1107
+ }: BasePresetOptions & { license: string | number }): ScriptPreset =>
1108
+ addScript('functional', {
1109
+ id,
1110
+ name,
1111
+ nameKey,
1112
+ descriptionKey,
1113
+ loadKey,
1114
+ src: 'https://cdn.livechatinc.com/tracking.js',
1115
+ beforeLoad: `
1116
+ window.__lc = window.__lc || {};
1117
+ window.__lc.license = ${license};
1118
+ `,
1119
+ options,
1120
+ }),
1121
+
1122
+ tidio: ({
1123
+ publicKey,
1124
+ id = 'tidio',
1125
+ name = 'Tidio',
1126
+ nameKey = 'cookies.tidio.name',
1127
+ descriptionKey = 'cookies.tidio.description',
1128
+ loadKey = `tidio:${publicKey}`,
1129
+ options,
1130
+ }: BasePresetOptions & { publicKey: string }): ScriptPreset =>
1131
+ addScript('functional', {
1132
+ id,
1133
+ name,
1134
+ nameKey,
1135
+ descriptionKey,
1136
+ loadKey,
1137
+ src: `https://code.tidio.co/${publicKey}.js`,
1138
+ options,
1139
+ }),
1140
+
1141
+ chatwoot: ({
1142
+ websiteToken,
1143
+ baseUrl = 'https://app.chatwoot.com',
1144
+ id = 'chatwoot',
1145
+ name = 'Chatwoot',
1146
+ nameKey = 'cookies.chatwoot.name',
1147
+ descriptionKey = 'cookies.chatwoot.description',
1148
+ loadKey = `chatwoot:${baseUrl}:${websiteToken}`,
1149
+ options,
1150
+ }: BasePresetOptions & {
1151
+ websiteToken: string;
1152
+ baseUrl?: string;
1153
+ }): ScriptPreset =>
1154
+ addScript('functional', {
1155
+ id,
1156
+ name,
1157
+ nameKey,
1158
+ descriptionKey,
1159
+ loadKey,
1160
+ code: `
1161
+ window.chatwootSettings = window.chatwootSettings || {};
1162
+ (function(d,t) {
1163
+ var BASE_URL = "${baseUrl.replace(/\/$/, '')}";
1164
+ var g = d.createElement(t);
1165
+ var s = d.getElementsByTagName(t)[0];
1166
+ g.src = BASE_URL + "/packs/js/sdk.js";
1167
+ g.defer = true;
1168
+ g.async = true;
1169
+ s.parentNode.insertBefore(g,s);
1170
+ g.onload = function() {
1171
+ window.chatwootSDK.run({
1172
+ websiteToken: "${websiteToken}",
1173
+ baseUrl: BASE_URL
1174
+ });
1175
+ };
1176
+ })(document, "script");
1177
+ `,
1178
+ options,
1179
+ }),
1180
+
1181
+ chatra: ({
1182
+ chatraId,
1183
+ id = 'chatra',
1184
+ name = 'Chatra',
1185
+ nameKey = 'cookies.chatra.name',
1186
+ descriptionKey = 'cookies.chatra.description',
1187
+ loadKey = 'chatra',
1188
+ options,
1189
+ }: BasePresetOptions & { chatraId: string }): ScriptPreset =>
1190
+ addScript('functional', {
1191
+ id,
1192
+ name,
1193
+ nameKey,
1194
+ descriptionKey,
1195
+ loadKey,
1196
+ src: 'https://call.chatra.io/chatra.js',
1197
+ beforeLoad: `
1198
+ window.ChatraID = "${chatraId}";
1199
+ window.Chatra = window.Chatra || function(){ (window.Chatra.q = window.Chatra.q || []).push(arguments); };
1200
+ `,
1201
+ options,
1202
+ }),
1203
+
1204
+ recaptcha: ({
1205
+ siteKey,
1206
+ id = 'google-recaptcha',
1207
+ name = 'Google reCAPTCHA',
1208
+ nameKey = 'cookies.recaptcha.name',
1209
+ descriptionKey = 'cookies.recaptcha.description',
1210
+ loadKey = `recaptcha:${siteKey}`,
1211
+ options,
1212
+ }: BasePresetOptions & { siteKey: string }): ScriptPreset =>
1213
+ addScript('functional', {
1214
+ id,
1215
+ name,
1216
+ nameKey,
1217
+ descriptionKey,
1218
+ loadKey,
1219
+ src: `https://www.google.com/recaptcha/api.js?render=${siteKey}`,
1220
+ options,
1221
+ }),
1222
+ };