@redocly/theme 0.33.3 → 0.35.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.
package/lib/config.js CHANGED
@@ -1,614 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.productThemeOverrideSchema = exports.themeConfigSchema = void 0;
4
- const logoConfigSchema = {
5
- type: 'object',
6
- properties: {
7
- image: { type: 'string' },
8
- srcSet: { type: 'string' },
9
- altText: { type: 'string' },
10
- link: { type: 'string' },
11
- favicon: { type: 'string' },
12
- },
13
- additionalProperties: false,
14
- };
15
- const hideConfigSchema = {
16
- type: 'object',
17
- properties: {
18
- hide: { type: 'boolean' },
19
- },
20
- additionalProperties: false,
21
- };
22
- const scriptConfigSchema = {
23
- type: 'object',
24
- properties: {
25
- src: { type: 'string' },
26
- async: { type: 'boolean' },
27
- crossorigin: { type: 'string' },
28
- defer: { type: 'boolean' },
29
- fetchpriority: { type: 'string' },
30
- integrity: { type: 'string' },
31
- module: { type: 'boolean' },
32
- nomodule: { type: 'boolean' },
33
- nonce: { type: 'string' },
34
- referrerpolicy: { type: 'string' },
35
- type: { type: 'string' },
36
- },
37
- required: ['src'],
38
- additionalProperties: true,
39
- };
40
- const linksConfigSchema = {
41
- type: 'object',
42
- properties: {
43
- href: { type: 'string' },
44
- as: { type: 'string' },
45
- crossorigin: { type: 'string' },
46
- fetchpriority: { type: 'string' },
47
- hreflang: { type: 'string' },
48
- imagesizes: { type: 'string' },
49
- imagesrcset: { type: 'string' },
50
- integrity: { type: 'string' },
51
- media: { type: 'string' },
52
- prefetch: { type: 'string' },
53
- referrerpolicy: { type: 'string' },
54
- rel: { type: 'string' },
55
- sizes: { type: 'string' },
56
- title: { type: 'string' },
57
- type: { type: 'string' },
58
- },
59
- required: ['href'],
60
- additionalProperties: true,
61
- };
62
- const markdownConfigSchema = {
63
- type: 'object',
64
- properties: {
65
- frontMatterKeysToResolve: {
66
- type: 'array',
67
- items: { type: 'string' },
68
- default: ['image', 'links'],
69
- },
70
- partialsFolders: {
71
- type: 'array',
72
- items: { type: 'string' },
73
- default: ['_partials'],
74
- },
75
- lastUpdatedBlock: {
76
- type: 'object',
77
- properties: Object.assign({ format: {
78
- type: 'string',
79
- enum: ['timeago', 'iso', 'long', 'short'],
80
- default: 'timeago',
81
- }, locale: { type: 'string' } }, hideConfigSchema.properties),
82
- additionalProperties: false,
83
- default: {},
84
- },
85
- toc: {
86
- type: 'object',
87
- properties: Object.assign({ header: { type: 'string', default: 'On this page' }, depth: { type: 'integer', default: 3, minimum: 1 } }, hideConfigSchema.properties),
88
- additionalProperties: false,
89
- default: {},
90
- },
91
- editPage: {
92
- type: 'object',
93
- properties: Object.assign({ baseUrl: { type: 'string' } }, hideConfigSchema.properties),
94
- additionalProperties: false,
95
- default: {},
96
- },
97
- },
98
- additionalProperties: false,
99
- default: {},
100
- };
101
- const amplitudeAnalyticsConfigSchema = {
102
- type: 'object',
103
- properties: {
104
- includeInDevelopment: { type: 'boolean' },
105
- apiKey: { type: 'string' },
106
- head: { type: 'boolean' },
107
- respectDNT: { type: 'boolean' },
108
- exclude: { type: 'array', items: { type: 'string' } },
109
- outboundClickEventName: { type: 'string' },
110
- pageViewEventName: { type: 'string' },
111
- amplitudeConfig: { type: 'object', additionalProperties: true },
112
- },
113
- additionalProperties: false,
114
- required: ['apiKey'],
115
- };
116
- const fullstoryAnalyticsConfigSchema = {
117
- type: 'object',
118
- properties: {
119
- includeInDevelopment: { type: 'boolean' },
120
- orgId: { type: 'string' },
121
- },
122
- additionalProperties: false,
123
- required: ['orgId'],
124
- };
125
- const heapAnalyticsConfigSchema = {
126
- type: 'object',
127
- properties: {
128
- includeInDevelopment: { type: 'boolean' },
129
- appId: { type: 'string' },
130
- },
131
- additionalProperties: false,
132
- required: ['appId'],
133
- };
134
- const rudderstackAnalyticsConfigSchema = {
135
- type: 'object',
136
- properties: {
137
- includeInDevelopment: { type: 'boolean' },
138
- writeKey: { type: 'string', minLength: 10 },
139
- trackPage: { type: 'boolean' },
140
- dataPlaneUrl: { type: 'string' },
141
- controlPlaneUrl: { type: 'string' },
142
- sdkUrl: { type: 'string' },
143
- loadOptions: { type: 'object', additionalProperties: true },
144
- },
145
- additionalProperties: false,
146
- required: ['writeKey'],
147
- };
148
- const segmentAnalyticsConfigSchema = {
149
- type: 'object',
150
- properties: {
151
- includeInDevelopment: { type: 'boolean' },
152
- writeKey: { type: 'string', minLength: 10 },
153
- trackPage: { type: 'boolean' },
154
- includeTitleInPageCall: { type: 'boolean' },
155
- host: { type: 'string' },
156
- },
157
- additionalProperties: false,
158
- required: ['writeKey'],
159
- };
160
- const gtmAnalyticsConfigSchema = {
161
- type: 'object',
162
- properties: {
163
- includeInDevelopment: { type: 'boolean' },
164
- trackingId: { type: 'string' },
165
- gtmAuth: { type: 'string' },
166
- gtmPreview: { type: 'string' },
167
- defaultDataLayer: {},
168
- dataLayerName: { type: 'string' },
169
- enableWebVitalsTracking: { type: 'boolean' },
170
- selfHostedOrigin: { type: 'string' },
171
- pageViewEventName: { type: 'string' },
172
- },
173
- additionalProperties: false,
174
- required: ['trackingId'],
175
- };
176
- const googleAnalyticsConfigSchema = {
177
- type: 'object',
178
- properties: {
179
- includeInDevelopment: { type: 'boolean' },
180
- trackingId: { type: 'string' },
181
- conversionId: { type: 'string' },
182
- floodlightId: { type: 'string' },
183
- head: { type: 'boolean' },
184
- respectDNT: { type: 'boolean' },
185
- exclude: { type: 'array', items: { type: 'string' } },
186
- optimizeId: { type: 'string' },
187
- anonymizeIp: { type: 'boolean' },
188
- cookieExpires: { type: 'number' },
189
- },
190
- additionalProperties: false,
191
- required: ['trackingId'],
192
- };
193
- const adobeAnalyticsConfigSchema = {
194
- type: 'object',
195
- properties: {
196
- includeInDevelopment: { type: 'boolean' },
197
- scriptUrl: { type: 'string' },
198
- pageViewEventName: { type: 'string' },
199
- },
200
- additionalProperties: false,
201
- required: ['scriptUrl'],
202
- };
203
- const navItemSchema = {
204
- type: 'object',
205
- properties: {
206
- page: { type: 'string' },
207
- directory: { type: 'string' },
208
- disconnect: { type: 'boolean', default: false },
209
- group: { type: 'string' },
210
- label: { type: 'string' },
211
- separator: { type: 'string' },
212
- separatorLine: { type: 'boolean' },
213
- linePosition: {
214
- type: 'string',
215
- enum: ['top', 'bottom'],
216
- default: 'top',
217
- },
218
- version: { type: 'string' },
219
- menuStyle: { type: 'string', enum: ['drilldown'] },
220
- expanded: { type: 'string', const: 'always' },
221
- selectFirstItemOnExpand: { type: 'boolean' },
222
- flatten: { type: 'boolean' },
223
- linkedSidebars: {
224
- type: 'array',
225
- items: { type: 'string' },
226
- },
227
- },
228
- };
229
- const navItemsSchema = {
230
- type: 'array',
231
- items: Object.assign(Object.assign({}, navItemSchema), { properties: Object.assign(Object.assign({}, navItemSchema.properties), { items: { type: 'array', items: navItemSchema } }) }),
232
- };
233
- const productConfigSchema = {
234
- type: 'object',
235
- properties: {
236
- name: { type: 'string' },
237
- icon: { type: 'string' },
238
- folder: { type: 'string' },
239
- },
240
- additionalProperties: false,
241
- required: ['name', 'folder'],
242
- };
243
- const suggestedPageSchema = {
244
- type: 'object',
245
- properties: {
246
- page: { type: 'string' },
247
- label: { type: 'string' },
248
- labelTranslationKey: { type: 'string' },
249
- },
250
- required: ['page'],
251
- };
252
- const catalogFilterSchema = {
253
- type: 'object',
254
- additionalProperties: false,
255
- required: ['title', 'property'],
256
- properties: {
257
- type: { type: 'string', enum: ['select', 'checkboxes', 'date-range'] },
258
- title: { type: 'string' },
259
- titleTranslationKey: { type: 'string' },
260
- property: { type: 'string' },
261
- parentFilter: { type: 'string' },
262
- valuesMapping: { type: 'object', additionalProperties: { type: 'string' } },
263
- missingCategoryName: { type: 'string' },
264
- missingCategoryNameTranslationKey: { type: 'string' },
265
- options: { type: 'array', items: { type: 'string' } },
266
- },
267
- };
268
- const scorecardConfigSchema = {
269
- type: 'object',
270
- additionalProperties: true,
271
- required: [],
272
- properties: {
273
- ignoreNonCompliant: { type: 'boolean', default: false },
274
- teamMetadataProperty: {
275
- type: 'object',
276
- properties: {
277
- property: { type: 'string' },
278
- label: { type: 'string' },
279
- default: { type: 'string' },
280
- },
281
- },
282
- levels: {
283
- type: 'array',
284
- items: {
285
- type: 'object',
286
- required: ['name'],
287
- properties: {
288
- name: { type: 'string' },
289
- color: { type: 'string' },
290
- extends: { type: 'array', items: { type: 'string' } },
291
- rules: {
292
- type: 'object',
293
- additionalProperties: {
294
- type: ['object', 'string'],
295
- },
296
- },
297
- },
298
- additionalProperties: false,
299
- },
300
- },
301
- targets: {
302
- type: 'array',
303
- items: {
304
- type: 'object',
305
- required: ['where'],
306
- properties: {
307
- minimumLevel: { type: 'string' },
308
- where: {
309
- type: 'object',
310
- required: ['metadata'],
311
- properties: {
312
- metadata: { type: 'object', additionalProperties: { type: 'string' } },
313
- },
314
- additionalProperties: false,
315
- },
316
- },
317
- additionalProperties: false,
318
- },
319
- },
320
- },
321
- };
322
- const catalogSchema = {
323
- type: 'object',
324
- additionalProperties: true,
325
- required: ['slug', 'items'],
326
- properties: {
327
- slug: { type: 'string' },
328
- filters: { type: 'array', items: catalogFilterSchema },
329
- groupByFirstFilter: { type: 'boolean' },
330
- filterValuesCasing: {
331
- type: 'string',
332
- enum: ['sentence', 'original', 'lowercase', 'uppercase'],
333
- },
334
- items: navItemsSchema,
335
- requiredPermission: { type: 'string' },
336
- separateVersions: { type: 'boolean' },
337
- title: { type: 'string' },
338
- titleTranslationKey: { type: 'string' },
339
- description: { type: 'string' },
340
- descriptionTranslationKey: { type: 'string' },
341
- },
342
- };
343
- const catalogsConfigSchema = {
344
- type: 'object',
345
- patternProperties: {
346
- '.*': catalogSchema,
347
- },
348
- };
349
- exports.themeConfigSchema = {
350
- type: 'object',
351
- properties: {
352
- imports: {
353
- type: 'array',
354
- items: { type: 'string' },
355
- default: [],
356
- },
357
- logo: logoConfigSchema,
358
- navbar: {
359
- type: 'object',
360
- properties: Object.assign({ items: navItemsSchema }, hideConfigSchema.properties),
361
- additionalProperties: false,
362
- },
363
- products: {
364
- type: 'object',
365
- additionalProperties: productConfigSchema,
366
- },
367
- footer: {
368
- type: 'object',
369
- properties: Object.assign({ items: navItemsSchema, copyrightText: { type: 'string' }, logo: hideConfigSchema }, hideConfigSchema.properties),
370
- additionalProperties: false,
371
- },
372
- sidebar: {
373
- type: 'object',
374
- properties: Object.assign({ separatorLine: { type: 'boolean' }, linePosition: {
375
- type: 'string',
376
- enum: ['top', 'bottom'],
377
- default: 'bottom',
378
- } }, hideConfigSchema.properties),
379
- additionalProperties: false,
380
- },
381
- scripts: {
382
- type: 'object',
383
- properties: {
384
- head: { type: 'array', items: scriptConfigSchema },
385
- body: { type: 'array', items: scriptConfigSchema },
386
- },
387
- additionalProperties: false,
388
- },
389
- links: { type: 'array', items: linksConfigSchema },
390
- feedback: {
391
- type: 'object',
392
- properties: {
393
- hide: {
394
- type: 'boolean',
395
- default: false,
396
- },
397
- type: {
398
- type: 'string',
399
- enum: ['rating', 'sentiment', 'comment', 'reasons', 'mood', 'scale'],
400
- default: 'sentiment',
401
- },
402
- settings: Object.assign({ type: 'object', properties: {
403
- label: { type: 'string' },
404
- submitText: { type: 'string' },
405
- buttonText: { type: 'string' },
406
- component: {
407
- type: 'string',
408
- enum: ['radio', 'checkbox'],
409
- default: 'checkbox',
410
- },
411
- items: { type: 'array', items: { type: 'string' }, minItems: 1 },
412
- leftScaleLabel: { type: 'string' },
413
- rightScaleLabel: { type: 'string' },
414
- reasons: {
415
- type: 'object',
416
- properties: {
417
- hide: {
418
- type: 'boolean',
419
- default: false,
420
- },
421
- component: {
422
- type: 'string',
423
- enum: ['radio', 'checkbox'],
424
- default: 'checkbox',
425
- },
426
- label: { type: 'string' },
427
- items: { type: 'array', items: { type: 'string' } },
428
- },
429
- additionalProperties: false,
430
- },
431
- comment: {
432
- type: 'object',
433
- properties: {
434
- hide: {
435
- type: 'boolean',
436
- default: false,
437
- },
438
- label: { type: 'string' },
439
- likeLabel: { type: 'string' },
440
- dislikeLabel: { type: 'string' },
441
- satisfiedLabel: { type: 'string' },
442
- neutralLabel: { type: 'string' },
443
- dissatisfiedLabel: { type: 'string' },
444
- },
445
- additionalProperties: false,
446
- },
447
- }, additionalProperties: false }, hideConfigSchema.properties),
448
- },
449
- additionalProperties: false,
450
- default: {},
451
- },
452
- search: {
453
- type: 'object',
454
- properties: Object.assign({ placement: {
455
- type: 'string',
456
- default: 'navbar',
457
- }, shortcuts: {
458
- type: 'array',
459
- items: { type: 'string' },
460
- default: ['/'],
461
- }, suggestedPages: {
462
- type: 'array',
463
- items: suggestedPageSchema,
464
- } }, hideConfigSchema.properties),
465
- additionalProperties: false,
466
- default: {},
467
- },
468
- colorMode: {
469
- type: 'object',
470
- properties: Object.assign({ ignoreDetection: { type: 'boolean' }, modes: {
471
- type: 'array',
472
- items: { type: 'string' },
473
- default: ['light', 'dark'],
474
- } }, hideConfigSchema.properties),
475
- additionalProperties: false,
476
- default: {},
477
- },
478
- navigation: {
479
- type: 'object',
480
- properties: {
481
- nextButton: {
482
- type: 'object',
483
- properties: Object.assign({ text: { type: 'string', default: 'Next to {{label}}' } }, hideConfigSchema.properties),
484
- additionalProperties: false,
485
- default: {},
486
- },
487
- previousButton: {
488
- type: 'object',
489
- properties: Object.assign({ text: { type: 'string', default: 'Back to {{label}}' } }, hideConfigSchema.properties),
490
- additionalProperties: false,
491
- default: {},
492
- },
493
- },
494
- additionalProperties: false,
495
- default: {},
496
- },
497
- codeSnippet: {
498
- type: 'object',
499
- properties: {
500
- elementFormat: { type: 'string', default: 'icon' },
501
- copy: {
502
- type: 'object',
503
- properties: Object.assign({}, hideConfigSchema.properties),
504
- additionalProperties: false,
505
- default: { hide: false },
506
- },
507
- report: {
508
- type: 'object',
509
- properties: Object.assign({ tooltipText: { type: 'string' }, buttonText: { type: 'string' }, label: { type: 'string' } }, hideConfigSchema.properties),
510
- additionalProperties: false,
511
- default: { hide: false },
512
- },
513
- expand: {
514
- type: 'object',
515
- properties: Object.assign({}, hideConfigSchema.properties),
516
- additionalProperties: false,
517
- default: { hide: false },
518
- },
519
- collapse: {
520
- type: 'object',
521
- properties: Object.assign({}, hideConfigSchema.properties),
522
- additionalProperties: false,
523
- default: { hide: false },
524
- },
525
- },
526
- additionalProperties: false,
527
- default: {},
528
- },
529
- markdown: markdownConfigSchema,
530
- openapi: { type: 'object', additionalProperties: true },
531
- graphql: { type: 'object', additionalProperties: true },
532
- analytics: {
533
- type: 'object',
534
- properties: {
535
- adobe: adobeAnalyticsConfigSchema,
536
- amplitude: amplitudeAnalyticsConfigSchema,
537
- fullstory: fullstoryAnalyticsConfigSchema,
538
- heap: heapAnalyticsConfigSchema,
539
- rudderstack: rudderstackAnalyticsConfigSchema,
540
- segment: segmentAnalyticsConfigSchema,
541
- gtm: gtmAnalyticsConfigSchema,
542
- ga: googleAnalyticsConfigSchema,
543
- },
544
- },
545
- userProfile: {
546
- type: 'object',
547
- properties: Object.assign({ loginLabel: { type: 'string', default: 'Login' }, logoutLabel: { type: 'string', default: 'Logout' }, menu: {
548
- type: 'array',
549
- items: {
550
- type: 'object',
551
- properties: {
552
- label: { type: 'string' },
553
- external: { type: 'boolean' },
554
- link: { type: 'string' },
555
- separatorLine: { type: 'boolean' },
556
- },
557
- additionalProperties: true,
558
- },
559
- default: [],
560
- } }, hideConfigSchema.properties),
561
- additionalProperties: false,
562
- default: {},
563
- },
564
- versionPicker: {
565
- type: 'object',
566
- properties: {
567
- hide: { type: 'boolean' },
568
- showForUnversioned: {
569
- type: 'boolean',
570
- },
571
- },
572
- },
573
- breadcrumbs: {
574
- type: 'object',
575
- properties: {
576
- hide: { type: 'boolean' },
577
- prefixItems: {
578
- type: 'array',
579
- items: {
580
- type: 'object',
581
- properties: {
582
- label: { type: 'string' },
583
- labelTranslationKey: { type: 'string' },
584
- page: { type: 'string' },
585
- },
586
- additionalProperties: false,
587
- default: {},
588
- },
589
- },
590
- },
591
- additionalProperties: false,
592
- default: {},
593
- },
594
- catalog: catalogsConfigSchema,
595
- scorecard: scorecardConfigSchema,
596
- },
597
- additionalProperties: true,
598
- default: {},
599
- };
600
- exports.productThemeOverrideSchema = {
601
- type: 'object',
602
- properties: {
603
- logo: exports.themeConfigSchema.properties.logo,
604
- navbar: exports.themeConfigSchema.properties.navbar,
605
- footer: exports.themeConfigSchema.properties.footer,
606
- sidebar: exports.themeConfigSchema.properties.sidebar,
607
- search: exports.themeConfigSchema.properties.search,
608
- codeSnippet: exports.themeConfigSchema.properties.codeSnippet,
609
- breadcrumbs: exports.themeConfigSchema.properties.breadcrumbs,
610
- },
611
- additionalProperties: true,
612
- default: {},
613
- };
614
3
  //# sourceMappingURL=config.js.map
@@ -8,7 +8,9 @@ function useThemeConfig(useProductConfig = true) {
8
8
  const themeConfig = (0, react_1.useContext)(exports.ThemeConfigContext) || {};
9
9
  const currentProduct = (0, hooks_1.useCurrentProduct)();
10
10
  const mergedTheme = useProductConfig && (currentProduct === null || currentProduct === void 0 ? void 0 : currentProduct.themeOverride)
11
- ? Object.assign(Object.assign({}, themeConfig), currentProduct.themeOverride) : themeConfig;
11
+ ? Object.assign(Object.assign(Object.assign({}, themeConfig), currentProduct.themeOverride), {
12
+ // Do not override analytics config from product
13
+ analytics: themeConfig.analytics }) : themeConfig;
12
14
  return mergedTheme;
13
15
  }
14
16
  exports.useThemeConfig = useThemeConfig;
@@ -1,6 +1,6 @@
1
+ export { REDOCLY_TEAMS_RBAC } from '@redocly/config';
1
2
  export declare const DEFAULT_THEME_NAME = "@redocly/theme";
2
3
  export declare const USER_THEME_ALIAS = "@theme";
3
- export declare const REDOCLY_TEAMS_RBAC = "redocly::teams-rbac";
4
4
  export declare const DEFAULT_LOCALE_PLACEHOLDER = "default_locale";
5
5
  export type REQUIRED_OIDC_SCOPES = string[];
6
6
  export type DEFAULT_COOKIE_EXPIRATION = number;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FsErrors = exports.ExternalRoutes = exports.DEV_LOGIN_SLUG = exports.FEEDBACK_TYPES = exports.DEFAULT_LOCALE_PLACEHOLDER = exports.REDOCLY_TEAMS_RBAC = exports.USER_THEME_ALIAS = exports.DEFAULT_THEME_NAME = void 0;
3
+ exports.FsErrors = exports.ExternalRoutes = exports.DEV_LOGIN_SLUG = exports.FEEDBACK_TYPES = exports.DEFAULT_LOCALE_PLACEHOLDER = exports.USER_THEME_ALIAS = exports.DEFAULT_THEME_NAME = exports.REDOCLY_TEAMS_RBAC = void 0;
4
+ var config_1 = require("@redocly/config");
5
+ Object.defineProperty(exports, "REDOCLY_TEAMS_RBAC", { enumerable: true, get: function () { return config_1.REDOCLY_TEAMS_RBAC; } });
4
6
  exports.DEFAULT_THEME_NAME = '@redocly/theme';
5
7
  exports.USER_THEME_ALIAS = '@theme';
6
- exports.REDOCLY_TEAMS_RBAC = 'redocly::teams-rbac';
7
8
  exports.DEFAULT_LOCALE_PLACEHOLDER = 'default_locale';
8
9
  var FEEDBACK_TYPES;
9
10
  (function (FEEDBACK_TYPES) {