@heyo-sh/create-heyo-docs 0.2.3 → 0.3.0

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.
@@ -1,5 +1,64 @@
1
1
  import type { Metadata } from "next";
2
2
  import type { ReactNode } from "react";
3
+ import { adobeAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/adobe";
4
+ import { amplitudeAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/amplitude";
5
+ import { clarityBootstrapScript } from "@heyo-sh/heyo-docs/integrations/analytics/clarity";
6
+ import { clearbitAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/clearbit";
7
+ import { fathomAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/fathom";
8
+ import {
9
+ googleAnalyticsBootstrapScript,
10
+ googleAnalyticsScript,
11
+ } from "@heyo-sh/heyo-docs/integrations/analytics/google-analytics";
12
+ import {
13
+ googleTagManagerBootstrapScript,
14
+ googleTagManagerNoScriptUrl,
15
+ } from "@heyo-sh/heyo-docs/integrations/analytics/google-tag-manager";
16
+ import { heapBootstrapScript } from "@heyo-sh/heyo-docs/integrations/analytics/heap";
17
+ import { hotjarBootstrapScript } from "@heyo-sh/heyo-docs/integrations/analytics/hotjar";
18
+ import {
19
+ logRocketBootstrapScript,
20
+ logRocketScript,
21
+ } from "@heyo-sh/heyo-docs/integrations/analytics/logrocket";
22
+ import {
23
+ mixpanelBootstrapScript,
24
+ mixpanelScript,
25
+ } from "@heyo-sh/heyo-docs/integrations/analytics/mixpanel";
26
+ import {
27
+ openpanelBootstrapScript,
28
+ openpanelScript,
29
+ } from "@heyo-sh/heyo-docs/integrations/analytics/openpanel";
30
+ import { openReplayBootstrapScript } from "@heyo-sh/heyo-docs/integrations/analytics/openreplay";
31
+ import { osanoConsentScript } from "@heyo-sh/heyo-docs/integrations/consent/osano";
32
+ import {
33
+ transcendConsentScript,
34
+ transcendGoogleConsentModeDefaultsScript,
35
+ } from "@heyo-sh/heyo-docs/integrations/consent/transcend";
36
+ import { pirschAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/pirsch";
37
+ import { plausibleAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/plausible";
38
+ import {
39
+ posthogApiHost,
40
+ posthogBootstrapScript,
41
+ posthogScript,
42
+ } from "@heyo-sh/heyo-docs/integrations/analytics/posthog";
43
+ import { rybbitAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/rybbit";
44
+ import {
45
+ swetrixBootstrapScript,
46
+ swetrixScript,
47
+ } from "@heyo-sh/heyo-docs/integrations/analytics/swetrix";
48
+ import { chaskiqBootstrapScript } from "@heyo-sh/heyo-docs/integrations/support/chaskiq";
49
+ import { chatwootBootstrapScript } from "@heyo-sh/heyo-docs/integrations/support/chatwoot";
50
+ import {
51
+ frontChatBootstrapScript,
52
+ frontChatScript,
53
+ } from "@heyo-sh/heyo-docs/integrations/support/front";
54
+ import { intercomBootstrapScript } from "@heyo-sh/heyo-docs/integrations/support/intercom";
55
+ import { papercupsBootstrapScript } from "@heyo-sh/heyo-docs/integrations/support/papercups";
56
+ import { typebotBootstrapScript } from "@heyo-sh/heyo-docs/integrations/support/typebot";
57
+ import { umamiAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/umami";
58
+ import {
59
+ zammadBootstrapScript,
60
+ zammadChatScript,
61
+ } from "@heyo-sh/heyo-docs/integrations/support/zammad";
3
62
 
4
63
  import config from "../heyo-docs.config";
5
64
  import "./app.css";
@@ -42,17 +101,305 @@ export const metadata: Metadata = {
42
101
  },
43
102
  };
44
103
 
104
+ const osano = config.integrations.consent.osano
105
+ ? osanoConsentScript(config.integrations.consent.osano)
106
+ : undefined;
107
+ const transcend = config.integrations.consent.transcend
108
+ ? transcendConsentScript(config.integrations.consent.transcend)
109
+ : undefined;
110
+ const transcendGoogleConsentDefaults =
111
+ transcend &&
112
+ (config.integrations.analytics.ga4 || config.integrations.analytics.gtm)
113
+ ? transcendGoogleConsentModeDefaultsScript()
114
+ : undefined;
115
+ const adobe = config.integrations.analytics.adobe
116
+ ? adobeAnalyticsScript(config.integrations.analytics.adobe)
117
+ : undefined;
118
+ const amplitude = config.integrations.analytics.amplitude
119
+ ? amplitudeAnalyticsScript(config.integrations.analytics.amplitude)
120
+ : undefined;
121
+ const clarity = config.integrations.analytics.clarity
122
+ ? clarityBootstrapScript()
123
+ : undefined;
124
+ const clearbit = config.integrations.analytics.clearbit
125
+ ? clearbitAnalyticsScript(config.integrations.analytics.clearbit)
126
+ : undefined;
127
+ const fathom = config.integrations.analytics.fathom
128
+ ? fathomAnalyticsScript(config.integrations.analytics.fathom)
129
+ : undefined;
130
+ const googleAnalytics = config.integrations.analytics.ga4
131
+ ? googleAnalyticsScript(config.integrations.analytics.ga4)
132
+ : undefined;
133
+ const googleAnalyticsBootstrap = googleAnalytics
134
+ ? googleAnalyticsBootstrapScript()
135
+ : undefined;
136
+ const googleTagManager = config.integrations.analytics.gtm
137
+ ? googleTagManagerBootstrapScript()
138
+ : undefined;
139
+ const googleTagManagerNoScript = config.integrations.analytics.gtm
140
+ ? googleTagManagerNoScriptUrl(config.integrations.analytics.gtm)
141
+ : undefined;
142
+ const heap = config.integrations.analytics.heap
143
+ ? heapBootstrapScript()
144
+ : undefined;
145
+ const hotjar = config.integrations.analytics.hotjar
146
+ ? hotjarBootstrapScript()
147
+ : undefined;
148
+ const logRocket = config.integrations.analytics.logrocket
149
+ ? logRocketScript()
150
+ : undefined;
151
+ const logRocketBootstrap = logRocket ? logRocketBootstrapScript() : undefined;
152
+ const mixpanel = config.integrations.analytics.mixpanel
153
+ ? mixpanelScript()
154
+ : undefined;
155
+ const mixpanelBootstrap = mixpanel ? mixpanelBootstrapScript() : undefined;
156
+ const openpanel = config.integrations.analytics.openpanel
157
+ ? openpanelScript()
158
+ : undefined;
159
+ const openpanelBootstrap = openpanel ? openpanelBootstrapScript() : undefined;
160
+ const openReplay = config.integrations.analytics.openreplay
161
+ ? openReplayBootstrapScript()
162
+ : undefined;
163
+ const pirsch = config.integrations.analytics.pirsch
164
+ ? pirschAnalyticsScript(config.integrations.analytics.pirsch)
165
+ : undefined;
166
+ const plausible = config.integrations.analytics.plausible
167
+ ? plausibleAnalyticsScript(config.integrations.analytics.plausible)
168
+ : undefined;
169
+ const posthog = config.integrations.analytics.posthog
170
+ ? posthogScript(config.integrations.analytics.posthog)
171
+ : undefined;
172
+ const posthogBootstrap = posthog ? posthogBootstrapScript() : undefined;
173
+ const posthogHost = config.integrations.analytics.posthog
174
+ ? posthogApiHost(config.integrations.analytics.posthog)
175
+ : undefined;
176
+ const rybbit = config.integrations.analytics.rybbit
177
+ ? rybbitAnalyticsScript(config.integrations.analytics.rybbit)
178
+ : undefined;
179
+ const swetrix = config.integrations.analytics.swetrix
180
+ ? swetrixScript()
181
+ : undefined;
182
+ const swetrixBootstrap = swetrix ? swetrixBootstrapScript() : undefined;
183
+ const umami = config.integrations.analytics.umami
184
+ ? umamiAnalyticsScript(config.integrations.analytics.umami)
185
+ : undefined;
186
+ const intercom = config.integrations.support.intercom
187
+ ? intercomBootstrapScript()
188
+ : undefined;
189
+ const front = config.integrations.support.front ? frontChatScript() : undefined;
190
+ const frontBootstrap = front ? frontChatBootstrapScript() : undefined;
191
+ const chatwoot = config.integrations.support.chatwoot
192
+ ? chatwootBootstrapScript()
193
+ : undefined;
194
+ const chaskiq = config.integrations.support.chaskiq
195
+ ? chaskiqBootstrapScript()
196
+ : undefined;
197
+ const papercups = config.integrations.support.papercups
198
+ ? papercupsBootstrapScript()
199
+ : undefined;
200
+ const typebot = config.integrations.support.typebot
201
+ ? typebotBootstrapScript()
202
+ : undefined;
203
+ const zammad = config.integrations.support.zammad
204
+ ? zammadChatScript(config.integrations.support.zammad)
205
+ : undefined;
206
+ const zammadBootstrap = zammad ? zammadBootstrapScript() : undefined;
207
+
45
208
  export default function RootLayout({ children }: { children: ReactNode }) {
46
209
  return (
47
210
  <html lang="en" suppressHydrationWarning>
48
211
  <head>
212
+ {transcendGoogleConsentDefaults && (
213
+ <script
214
+ dangerouslySetInnerHTML={{
215
+ __html: transcendGoogleConsentDefaults,
216
+ }}
217
+ />
218
+ )}
219
+ {transcend && (
220
+ <script data-cfasync={transcend.dataCfasync} src={transcend.src} />
221
+ )}
49
222
  <meta name="color-scheme" content="light dark" />
50
223
  <meta name="referrer" content="strict-origin-when-cross-origin" />
224
+ {osano && <script src={osano.src} />}
225
+ {googleTagManager && (
226
+ <script
227
+ data-google-tag-manager-container-id={
228
+ config.integrations.analytics.gtm?.containerId
229
+ }
230
+ dangerouslySetInnerHTML={{ __html: googleTagManager }}
231
+ />
232
+ )}
51
233
  <script
52
234
  dangerouslySetInnerHTML={{
53
235
  __html: getThemeScript(THEME_STORAGE_KEY, config.mode),
54
236
  }}
55
237
  />
238
+ {adobe && <script async={adobe.async} src={adobe.src} />}
239
+ {amplitude && <script src={amplitude.src} />}
240
+ {clarity && (
241
+ <script
242
+ data-clarity-project-id={
243
+ config.integrations.analytics.clarity?.projectId
244
+ }
245
+ dangerouslySetInnerHTML={{ __html: clarity }}
246
+ />
247
+ )}
248
+ {clearbit && <script src={clearbit.src} />}
249
+ {fathom && (
250
+ <script
251
+ data-site={fathom.siteId}
252
+ data-spa={fathom.spa}
253
+ defer={fathom.defer}
254
+ src={fathom.src}
255
+ />
256
+ )}
257
+ {googleAnalytics && googleAnalyticsBootstrap && (
258
+ <>
259
+ <script async={googleAnalytics.async} src={googleAnalytics.src} />
260
+ <script
261
+ data-google-analytics-measurement-id={
262
+ config.integrations.analytics.ga4?.measurementId
263
+ }
264
+ dangerouslySetInnerHTML={{ __html: googleAnalyticsBootstrap }}
265
+ />
266
+ </>
267
+ )}
268
+ {heap && (
269
+ <script
270
+ data-heap-environment-id={
271
+ config.integrations.analytics.heap?.environmentId
272
+ }
273
+ dangerouslySetInnerHTML={{ __html: heap }}
274
+ />
275
+ )}
276
+ {hotjar && (
277
+ <script
278
+ data-hotjar-site-id={config.integrations.analytics.hotjar?.siteId}
279
+ data-hotjar-snippet-version={
280
+ config.integrations.analytics.hotjar?.snippetVersion
281
+ }
282
+ dangerouslySetInnerHTML={{ __html: hotjar }}
283
+ />
284
+ )}
285
+ {logRocket && logRocketBootstrap && (
286
+ <>
287
+ <script crossOrigin={logRocket.crossOrigin} src={logRocket.src} />
288
+ <script
289
+ data-logrocket-app-id={
290
+ config.integrations.analytics.logrocket?.appId
291
+ }
292
+ dangerouslySetInnerHTML={{ __html: logRocketBootstrap }}
293
+ />
294
+ </>
295
+ )}
296
+ {mixpanel && mixpanelBootstrap && (
297
+ <>
298
+ <script src={mixpanel.src} />
299
+ <script
300
+ data-mixpanel-project-token={
301
+ config.integrations.analytics.mixpanel?.projectToken
302
+ }
303
+ dangerouslySetInnerHTML={{ __html: mixpanelBootstrap }}
304
+ />
305
+ </>
306
+ )}
307
+ {openpanel && openpanelBootstrap && (
308
+ <>
309
+ <script
310
+ data-openpanel-api-url={
311
+ config.integrations.analytics.openpanel?.apiUrl
312
+ }
313
+ data-openpanel-client-id={
314
+ config.integrations.analytics.openpanel?.clientId
315
+ }
316
+ dangerouslySetInnerHTML={{ __html: openpanelBootstrap }}
317
+ />
318
+ <script
319
+ async={openpanel.async}
320
+ defer={openpanel.defer}
321
+ src={openpanel.src}
322
+ />
323
+ </>
324
+ )}
325
+ {openReplay && (
326
+ <script
327
+ data-openreplay-ingest-point={
328
+ config.integrations.analytics.openreplay?.ingestPoint
329
+ }
330
+ data-openreplay-project-key={
331
+ config.integrations.analytics.openreplay?.projectKey
332
+ }
333
+ dangerouslySetInnerHTML={{ __html: openReplay }}
334
+ />
335
+ )}
336
+ {pirsch && (
337
+ <script
338
+ data-code={pirsch.code}
339
+ defer={pirsch.defer}
340
+ src={pirsch.src}
341
+ />
342
+ )}
343
+ {plausible && (
344
+ <script
345
+ data-domain={plausible.domain}
346
+ defer={plausible.defer}
347
+ src={plausible.src}
348
+ />
349
+ )}
350
+ {posthog && posthogBootstrap && posthogHost && (
351
+ <>
352
+ <script src={posthog.src} />
353
+ <script
354
+ data-posthog-api-host={posthogHost}
355
+ data-posthog-project-api-key={
356
+ config.integrations.analytics.posthog?.projectApiKey
357
+ }
358
+ dangerouslySetInnerHTML={{ __html: posthogBootstrap }}
359
+ />
360
+ </>
361
+ )}
362
+ {rybbit && (
363
+ <script
364
+ data-site-id={rybbit.siteId}
365
+ defer={rybbit.defer}
366
+ src={rybbit.src}
367
+ />
368
+ )}
369
+ {umami && (
370
+ <script
371
+ data-website-id={umami.websiteId}
372
+ defer={umami.defer}
373
+ src={umami.src}
374
+ />
375
+ )}
376
+ {chaskiq && (
377
+ <script
378
+ data-chaskiq-app-id={config.integrations.support.chaskiq?.appId}
379
+ data-chaskiq-base-url={config.integrations.support.chaskiq?.baseUrl}
380
+ data-chaskiq-ws-url={config.integrations.support.chaskiq?.wsUrl}
381
+ dangerouslySetInnerHTML={{ __html: chaskiq }}
382
+ />
383
+ )}
384
+ {papercups && (
385
+ <script
386
+ data-papercups-base-url={
387
+ config.integrations.support.papercups?.baseUrl
388
+ }
389
+ data-papercups-inbox={config.integrations.support.papercups?.inbox}
390
+ data-papercups-token={config.integrations.support.papercups?.token}
391
+ dangerouslySetInnerHTML={{ __html: papercups }}
392
+ />
393
+ )}
394
+ {typebot && (
395
+ <script
396
+ data-heyo-typebot
397
+ data-typebot-api-host={config.integrations.support.typebot?.apiHost}
398
+ data-typebot-id={config.integrations.support.typebot?.typebot}
399
+ dangerouslySetInnerHTML={{ __html: typebot }}
400
+ type="module"
401
+ />
402
+ )}
56
403
  <script
57
404
  type="application/ld+json"
58
405
  dangerouslySetInnerHTML={{
@@ -67,12 +414,75 @@ export default function RootLayout({ children }: { children: ReactNode }) {
67
414
  />
68
415
  </head>
69
416
  <body>
417
+ {googleTagManagerNoScript && (
418
+ <noscript>
419
+ <iframe
420
+ height="0"
421
+ src={googleTagManagerNoScript}
422
+ style={{ display: "none", visibility: "hidden" }}
423
+ title="Google Tag Manager"
424
+ width="0"
425
+ />
426
+ </noscript>
427
+ )}
70
428
  <ThemeProvider
71
429
  defaultTheme={config.mode}
72
430
  storageKey={THEME_STORAGE_KEY}
73
431
  >
74
432
  {children}
75
433
  </ThemeProvider>
434
+ {swetrix && swetrixBootstrap && (
435
+ <>
436
+ <script defer={swetrix.defer} src={swetrix.src} />
437
+ <script
438
+ data-swetrix-api-url={
439
+ config.integrations.analytics.swetrix?.apiUrl
440
+ }
441
+ data-swetrix-project-id={
442
+ config.integrations.analytics.swetrix?.projectId
443
+ }
444
+ dangerouslySetInnerHTML={{ __html: swetrixBootstrap }}
445
+ />
446
+ </>
447
+ )}
448
+ {intercom && (
449
+ <script
450
+ data-intercom-app-id={config.integrations.support.intercom?.appId}
451
+ data-intercom-api-base={
452
+ config.integrations.support.intercom?.apiBase
453
+ }
454
+ dangerouslySetInnerHTML={{ __html: intercom }}
455
+ />
456
+ )}
457
+ {front && frontBootstrap && (
458
+ <>
459
+ <script src={front.src} />
460
+ <script
461
+ data-front-chat-id={config.integrations.support.front?.chatId}
462
+ dangerouslySetInnerHTML={{ __html: frontBootstrap }}
463
+ />
464
+ </>
465
+ )}
466
+ {chatwoot && (
467
+ <script
468
+ data-chatwoot-base-url={
469
+ config.integrations.support.chatwoot?.baseUrl
470
+ }
471
+ data-chatwoot-website-token={
472
+ config.integrations.support.chatwoot?.websiteToken
473
+ }
474
+ dangerouslySetInnerHTML={{ __html: chatwoot }}
475
+ />
476
+ )}
477
+ {zammad && zammadBootstrap && (
478
+ <>
479
+ <script src={zammad.src} />
480
+ <script
481
+ data-zammad-chat-id={config.integrations.support.zammad?.chatId}
482
+ dangerouslySetInnerHTML={{ __html: zammadBootstrap }}
483
+ />
484
+ </>
485
+ )}
76
486
  </body>
77
487
  </html>
78
488
  );