@ketch-sdk/ketch-types 1.4.0 → 1.4.1

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 (118) hide show
  1. package/.editorconfig +13 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc.json +31 -0
  4. package/.github/CODEOWNERS +1 -0
  5. package/.github/CONTRIBUTING.md +177 -0
  6. package/.github/ISSUE_TEMPLATE.md +19 -0
  7. package/.github/PULL_REQUEST_TEMPLATE.md +30 -0
  8. package/.github/dependabot.yml +18 -0
  9. package/.github/release.yml +18 -0
  10. package/.github/workflows/ci.yml +79 -0
  11. package/.prettierignore +3 -0
  12. package/.prettierrc +15 -0
  13. package/docs/.nojekyll +1 -0
  14. package/docs/assets/highlight.css +22 -0
  15. package/docs/assets/main.js +4 -0
  16. package/docs/assets/search.js +1 -0
  17. package/docs/assets/style.css +1280 -0
  18. package/docs/enums/BannerPosition.html +88 -0
  19. package/docs/enums/ConsentExperienceType.html +81 -0
  20. package/docs/enums/CookieCategory.html +88 -0
  21. package/docs/enums/CookieDuration.html +74 -0
  22. package/docs/enums/CookieProvenance.html +74 -0
  23. package/docs/enums/ExperienceButtonDestination.html +81 -0
  24. package/docs/enums/ExperienceClosedReason.html +91 -0
  25. package/docs/enums/ExperienceDefault.html +74 -0
  26. package/docs/enums/ExperiencePrimaryButtonAction.html +74 -0
  27. package/docs/enums/ExperienceType.html +74 -0
  28. package/docs/enums/IdentityFormat.html +102 -0
  29. package/docs/enums/IdentityType.html +116 -0
  30. package/docs/enums/MigrationOption.html +95 -0
  31. package/docs/enums/ModalPosition.html +81 -0
  32. package/docs/enums/SwitchTextRenderLogic.html +96 -0
  33. package/docs/functions/isTab.html +137 -0
  34. package/docs/index.html +126 -0
  35. package/docs/interfaces/AppDiv.html +78 -0
  36. package/docs/interfaces/Banner.html +129 -0
  37. package/docs/interfaces/CanonicalPurpose.html +85 -0
  38. package/docs/interfaces/Configuration.html +305 -0
  39. package/docs/interfaces/ConsentExperience.html +120 -0
  40. package/docs/interfaces/ConsentsTab.html +161 -0
  41. package/docs/interfaces/Cookie.html +134 -0
  42. package/docs/interfaces/DataSubject.html +152 -0
  43. package/docs/interfaces/DataSubjectType.html +87 -0
  44. package/docs/interfaces/Deployment.html +78 -0
  45. package/docs/interfaces/Environment.html +92 -0
  46. package/docs/interfaces/Experience.html +78 -0
  47. package/docs/interfaces/GetBootstrapConfigurationRequest.html +78 -0
  48. package/docs/interfaces/GetConsentRequest.html +137 -0
  49. package/docs/interfaces/GetConsentResponse.html +139 -0
  50. package/docs/interfaces/GetFullConfigurationRequest.html +113 -0
  51. package/docs/interfaces/GetLocationRequest.html +71 -0
  52. package/docs/interfaces/GetLocationResponse.html +71 -0
  53. package/docs/interfaces/GetPreferenceQRRequest.html +125 -0
  54. package/docs/interfaces/IPInfo.html +155 -0
  55. package/docs/interfaces/IPLanguage.html +85 -0
  56. package/docs/interfaces/IPLocation.html +120 -0
  57. package/docs/interfaces/Identity.html +110 -0
  58. package/docs/interfaces/InvokeRightRequest.html +139 -0
  59. package/docs/interfaces/JIT.html +129 -0
  60. package/docs/interfaces/JurisdictionInfo.html +97 -0
  61. package/docs/interfaces/Ketch.html +735 -0
  62. package/docs/interfaces/Loaded.html +73 -0
  63. package/docs/interfaces/Modal.html +176 -0
  64. package/docs/interfaces/Organization.html +71 -0
  65. package/docs/interfaces/OverviewTab.html +99 -0
  66. package/docs/interfaces/PluginClass.html +354 -0
  67. package/docs/interfaces/PolicyDocument.html +85 -0
  68. package/docs/interfaces/PreferenceExperience.html +120 -0
  69. package/docs/interfaces/Property.html +92 -0
  70. package/docs/interfaces/Purpose.html +179 -0
  71. package/docs/interfaces/PurposeAllowed.html +78 -0
  72. package/docs/interfaces/PurposeAllowedLegalBasis.html +78 -0
  73. package/docs/interfaces/PurposeLegalBasis.html +78 -0
  74. package/docs/interfaces/Pusher.html +83 -0
  75. package/docs/interfaces/Recaptcha.html +73 -0
  76. package/docs/interfaces/Right.html +95 -0
  77. package/docs/interfaces/RightsTab.html +106 -0
  78. package/docs/interfaces/SetConsentRequest.html +144 -0
  79. package/docs/interfaces/Stack.html +82 -0
  80. package/docs/interfaces/StorageProvider.html +117 -0
  81. package/docs/interfaces/Theme.html +262 -0
  82. package/docs/interfaces/Vendor.html +134 -0
  83. package/docs/interfaces/VendorPurpose.html +78 -0
  84. package/docs/interfaces/WebReportRequest.html +104 -0
  85. package/docs/modules.html +218 -0
  86. package/docs/types/Callback.html +141 -0
  87. package/docs/types/Consent.html +135 -0
  88. package/docs/types/Identities.html +133 -0
  89. package/docs/types/IdentityProvider.html +136 -0
  90. package/docs/types/InvokeRightEvent.html +137 -0
  91. package/docs/types/Plugin.html +128 -0
  92. package/docs/types/PluginFunction.html +143 -0
  93. package/docs/types/PurposeCategory.html +139 -0
  94. package/docs/types/ShowConsentOptions.html +135 -0
  95. package/docs/types/ShowPreferenceOptions.html +149 -0
  96. package/docs/types/Status.html +133 -0
  97. package/docs/types/Tab.html +128 -0
  98. package/docs/types/TabTuple.html +128 -0
  99. package/docs/variables/ALL_TABS.html +128 -0
  100. package/jest.config.js +174 -0
  101. package/package.json +1 -1
  102. package/src/index.ts +1339 -0
  103. package/tsconfig.json +8 -3
  104. package/tsfmt.json +19 -0
  105. package/dist/index.d.ts +0 -1183
  106. package/dist/index.js +0 -1
  107. package/test-reports/coverage/clover.xml +0 -6
  108. package/test-reports/coverage/coverage-final.json +0 -1
  109. package/test-reports/coverage/lcov-report/base.css +0 -224
  110. package/test-reports/coverage/lcov-report/block-navigation.js +0 -87
  111. package/test-reports/coverage/lcov-report/favicon.png +0 -0
  112. package/test-reports/coverage/lcov-report/index.html +0 -101
  113. package/test-reports/coverage/lcov-report/prettify.css +0 -1
  114. package/test-reports/coverage/lcov-report/prettify.js +0 -2
  115. package/test-reports/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  116. package/test-reports/coverage/lcov-report/sorter.js +0 -196
  117. package/test-reports/coverage/lcov.info +0 -0
  118. package/test-reports/junit/junit.xml +0 -3
package/src/index.ts ADDED
@@ -0,0 +1,1339 @@
1
+ /**
2
+ * Callback
3
+ */
4
+ export declare type Callback = (arg0: any) => void
5
+
6
+ /**
7
+ * Status
8
+ */
9
+ export type Status = { [key: string]: boolean }
10
+
11
+ /**
12
+ * Consent
13
+ */
14
+ export type Consent = {
15
+ purposes: Status
16
+ vendors?: string[] // list of vendor ids for which the user has opted out
17
+ }
18
+
19
+ /**
20
+ * Identities
21
+ */
22
+ export type Identities = { [key: string]: string }
23
+
24
+ /**
25
+ * All Tabs
26
+ */
27
+ export const ALL_TABS = ['overviewTab', 'rightsTab', 'consentsTab'] as const
28
+
29
+ /**
30
+ * TabTuple
31
+ */
32
+ export type TabTuple = typeof ALL_TABS
33
+
34
+ /**
35
+ * Tab
36
+ */
37
+ export type Tab = TabTuple[number]
38
+
39
+ /**
40
+ * Determines if the Given value is a Tab
41
+ *
42
+ * @param value
43
+ */
44
+ export function isTab(value: string): value is Tab {
45
+ return ALL_TABS.includes(value as Tab)
46
+ }
47
+
48
+ /**
49
+ * Plugin class
50
+ */
51
+ export interface PluginClass {
52
+ init?: (host: Ketch, config: Configuration) => void
53
+ environmentLoaded?: (host: Ketch, config: Configuration, env: Environment) => void
54
+ geoIPLoaded?: (host: Ketch, config: Configuration, ipInfo: IPInfo) => void
55
+ identitiesLoaded?: (host: Ketch, config: Configuration, identities: Identities) => void
56
+ jurisdictionLoaded?: (host: Ketch, config: Configuration, policyScope: string) => void
57
+ regionInfoLoaded?: (host: Ketch, config: Configuration, region: string) => void
58
+ consentChanged?: (host: Ketch, config: Configuration, consent: Consent) => void
59
+ rightInvoked?: (host: Ketch, config: Configuration, request: InvokeRightRequest) => void
60
+ showConsentExperience?: (host: Ketch, config: Configuration, consents: Consent, options?: ShowConsentOptions) => void
61
+ showPreferenceExperience?: (
62
+ host: Ketch,
63
+ config: Configuration,
64
+ consents: Consent,
65
+ options?: ShowPreferenceOptions,
66
+ ) => void
67
+ willShowExperience?: (host: Ketch, config: Configuration, type: string) => void
68
+ experienceHidden?: (host: Ketch, config: Configuration, reason: string) => void
69
+ }
70
+
71
+ /**
72
+ * Plugin factory function signature
73
+ */
74
+ export type PluginFunction = (host: Ketch, config?: any) => Promise<void>
75
+
76
+ /**
77
+ * Plugin
78
+ */
79
+ export type Plugin = PluginClass | PluginFunction
80
+
81
+ /**
82
+ * IdentityProvider defines a function for providing identities
83
+ */
84
+ export type IdentityProvider = () => Promise<string[]>
85
+
86
+ /**
87
+ * StorageProvider defines an interface for storage
88
+ */
89
+ export interface StorageProvider {
90
+ /**
91
+ * Get an item with the given key
92
+ *
93
+ * @param key
94
+ */
95
+ getItem(key: string): Promise<string | null>
96
+
97
+ /**
98
+ * Sets the value for the given key
99
+ *
100
+ * @param key
101
+ * @param value
102
+ */
103
+ setItem(key: string, value: string): Promise<void>
104
+
105
+ /**
106
+ * Removes the given key
107
+ *
108
+ * @param key
109
+ */
110
+ removeItem(key: string): Promise<void>
111
+ }
112
+
113
+ /**
114
+ * Ketch host
115
+ */
116
+ export interface Ketch {
117
+ getConfig(): Promise<Configuration>
118
+
119
+ /**
120
+ * Register a plugin with the given configuration
121
+ *
122
+ * @param plugin
123
+ * @param config
124
+ */
125
+ registerPlugin(plugin: Plugin, config?: any): Promise<void>
126
+
127
+ /**
128
+ * Register an identity provider for the given identity
129
+ *
130
+ * @param name
131
+ * @param provider
132
+ */
133
+ registerIdentityProvider(name: string, provider: IdentityProvider): Promise<void>
134
+
135
+ /**
136
+ * Register a storage provider
137
+ *
138
+ * @param provider
139
+ */
140
+ registerStorageProvider(provider: StorageProvider): Promise<void>
141
+
142
+ hasConsent(): boolean
143
+ getConsent(): Promise<Consent>
144
+ setConsent(c: Consent): Promise<Consent>
145
+
146
+ /**
147
+ * @deprecated use on('consent', callback)
148
+ * @param callback
149
+ */
150
+ onConsent(callback: Callback): Promise<void>
151
+
152
+ setShowConsentExperience(): Promise<void>
153
+ showConsentExperience(): Promise<Consent>
154
+
155
+ /**
156
+ * @deprecated use on('showConsentExperience', callback)
157
+ * @param callback
158
+ */
159
+ onShowConsentExperience(callback: (consents: Consent, options?: ShowConsentOptions) => void): Promise<void>
160
+
161
+ showPreferenceExperience(params: ShowPreferenceOptions): Promise<Consent>
162
+
163
+ /**
164
+ * @deprecated use on('showPreferenceExperience', callback)
165
+ * @param callback
166
+ */
167
+ onShowPreferenceExperience(callback: (consents: Consent, options?: ShowPreferenceOptions) => void): Promise<void>
168
+
169
+ experienceClosed(reason: ExperienceClosedReason): Promise<Consent>
170
+
171
+ /**
172
+ * @deprecated use on('experienceHidden', callback)
173
+ * @param callback
174
+ */
175
+ onHideExperience(callback: Callback): Promise<void>
176
+
177
+ /**
178
+ * @deprecated use on('willShowExperience', callback)
179
+ * @param callback
180
+ */
181
+ onWillShowExperience(callback: Callback): Promise<void>
182
+
183
+ invokeRight(eventData: InvokeRightEvent): Promise<void>
184
+
185
+ /**
186
+ * @deprecated use on('rightInvoked', callback)
187
+ * @param callback
188
+ */
189
+ onInvokeRight(callback: Callback): Promise<void>
190
+
191
+ setEnvironment(env: Environment): Promise<Environment>
192
+ getEnvironment(): Promise<Environment>
193
+
194
+ /**
195
+ * @deprecated use on('environment', callback)
196
+ * @param callback
197
+ */
198
+ onEnvironment(callback: Callback): Promise<void>
199
+
200
+ setGeoIP(g: IPInfo): Promise<IPInfo>
201
+ getGeoIP(): Promise<IPInfo>
202
+
203
+ /**
204
+ * @deprecated use on('geoip', callback)
205
+ * @param callback
206
+ */
207
+ onGeoIP(callback: Callback): Promise<void>
208
+
209
+ setIdentities(id: Identities): Promise<Identities>
210
+ getIdentities(): Promise<Identities>
211
+
212
+ /**
213
+ * @deprecated use on('identities', callback)
214
+ * @param callback
215
+ */
216
+ onIdentities(callback: Callback): Promise<void>
217
+
218
+ setJurisdiction(ps: string): Promise<string>
219
+ getJurisdiction(): Promise<string>
220
+
221
+ /**
222
+ * @deprecated use on('jurisdiction', callback)
223
+ * @param callback
224
+ */
225
+ onJurisdiction(callback: Callback): Promise<void>
226
+
227
+ setRegionInfo(info: string): Promise<string>
228
+ getRegionInfo(): Promise<string>
229
+
230
+ /**
231
+ * @deprecated use on('region', callback)
232
+ * @param callback
233
+ */
234
+ onRegionInfo(callback: Callback): Promise<void>
235
+
236
+ // Emit an event
237
+ emit(eventName: string | symbol, ...args: any[]): boolean
238
+
239
+ // Add an event listener for the named event
240
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this
241
+
242
+ // Remove the given listener from the named event
243
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this
244
+
245
+ // Add a listener. Alias for addListener
246
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this
247
+
248
+ // Add a listener that is fired once and then remove
249
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this
250
+
251
+ // Remove a listener. Alias for removeListener
252
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this
253
+ }
254
+
255
+ /**
256
+ * ShowPreferenceOptions
257
+ */
258
+ export type ShowPreferenceOptions = {
259
+ tab?: Tab
260
+
261
+ /**
262
+ * dataSubjectTypeCodes is the list of data subjects to display. If undefined, all data subjects are displayed.
263
+ */
264
+ dataSubjectTypeCodes?: string[]
265
+
266
+ /**
267
+ * showRightsTab determines whether the rights tab will show. If undefined, the rights tab is displayed.
268
+ */
269
+ showRightsTab?: boolean
270
+
271
+ /**
272
+ * supportedCountries is the list of supported ISO 3166 ALPHA-2 country codes to show in the rights form
273
+ */
274
+ supportedCountries?: string[]
275
+
276
+ /**
277
+ * showConsentsTab determines whether the consents tab will show. If undefined, the consents tab is displayed
278
+ */
279
+ showConsentsTab?: boolean
280
+ }
281
+
282
+ /**
283
+ * ExperienceType is the type of experience that will be shown
284
+ */
285
+ export enum ExperienceType {
286
+ Consent = 'experiences.consent',
287
+ Preference = 'experiences.preference',
288
+ }
289
+
290
+ /**
291
+ * ConsentExperienceType is the type of consent experience that will be shown
292
+ */
293
+ export enum ConsentExperienceType {
294
+ Banner = 'experiences.consent.banner',
295
+ Modal = 'experiences.consent.modal',
296
+ JIT = 'experiences.consent.jit',
297
+ }
298
+
299
+ /**
300
+ * ShowConsentOptions
301
+ */
302
+ export type ShowConsentOptions = {
303
+ displayHint: ConsentExperienceType
304
+ purposes?: string[]
305
+ }
306
+
307
+ /**
308
+ * InvokeRightEvent
309
+ */
310
+ export type InvokeRightEvent = {
311
+ right: string
312
+ subject: DataSubject
313
+ recaptchaToken?: string
314
+ }
315
+
316
+ /**
317
+ * AppDiv
318
+ */
319
+ export interface AppDiv {
320
+ id: string
321
+ zIndex: string
322
+ }
323
+
324
+ /**
325
+ * ExperienceClosedReason describes the reason the experience was closed.
326
+ *
327
+ * setConsent = consent was accepted/set
328
+ * invokeRight = the right was invoked
329
+ * close = the close/exit button was clicked
330
+ */
331
+ export enum ExperienceClosedReason {
332
+ SET_CONSENT = 'setConsent',
333
+ INVOKE_RIGHT = 'invokeRight',
334
+ CLOSE = 'close',
335
+ WILL_NOT_SHOW = 'willNotShow',
336
+ }
337
+
338
+ /**
339
+ * ExperienceDefault
340
+ */
341
+ export enum ExperienceDefault {
342
+ BANNER = 1,
343
+ MODAL = 2,
344
+ }
345
+
346
+ /**
347
+ * ExperienceButtonDestination
348
+ */
349
+ export enum ExperienceButtonDestination {
350
+ GOTO_MODAL = 1,
351
+ GOTO_PREFERENCE = 2,
352
+ REJECT_ALL = 3,
353
+ }
354
+
355
+ /**
356
+ * ExperiencePrimaryButtonAction
357
+ */
358
+ export enum ExperiencePrimaryButtonAction {
359
+ SAVE_CURRENT_STATE = 1,
360
+ ACCEPT_ALL = 2,
361
+ }
362
+
363
+ /**
364
+ * MigrationOption
365
+ */
366
+ export enum MigrationOption {
367
+ MIGRATE_DEFAULT = 0,
368
+ MIGRATE_NEVER = 1,
369
+ MIGRATE_FROM_ALLOW = 2,
370
+ MIGRATE_FROM_DENY = 3,
371
+ MIGRATE_ALWAYS = 4,
372
+ }
373
+
374
+ /**
375
+ * CookieDuration
376
+ */
377
+ export enum CookieDuration {
378
+ SESSION = 1,
379
+ PERSISTENT = 2,
380
+ }
381
+
382
+ /**
383
+ * CookieProvenance
384
+ */
385
+ export enum CookieProvenance {
386
+ FIRST_PARTY = 1,
387
+ THIRD_PARTY = 2,
388
+ }
389
+
390
+ /**
391
+ * CookieCategory
392
+ */
393
+ export enum CookieCategory {
394
+ STRICTLY_NECESSARY = 1,
395
+ FUNCTIONAL = 2,
396
+ PERFORMANCE = 3,
397
+ MARKETING = 4,
398
+ }
399
+
400
+ /**
401
+ * IPLanguage
402
+ */
403
+ export interface IPLanguage {
404
+ code: string
405
+ name: string
406
+ native: string
407
+ }
408
+
409
+ /**
410
+ * IPLocation
411
+ */
412
+ export interface IPLocation {
413
+ geonameId: number
414
+ capital: string
415
+ languages: IPLanguage[]
416
+ countryFlag: string
417
+ countryFlagEmoji: string
418
+ countryFlagEmojiUnicode: string
419
+ callingCode: string
420
+ isEU: boolean
421
+ }
422
+
423
+ /**
424
+ * IPInfo
425
+ */
426
+ export interface IPInfo {
427
+ ip: string
428
+ hostname: string
429
+ continentCode: string
430
+ continentName: string
431
+ countryCode: string
432
+ countryName: string
433
+ regionCode: string
434
+ regionName: string
435
+ city: string
436
+ zip: string
437
+ latitude: number
438
+ longitude: number
439
+ location: IPLocation
440
+ }
441
+
442
+ /**
443
+ * GetLocationRequest
444
+ */
445
+ export interface GetLocationRequest {
446
+ IP?: string
447
+ }
448
+
449
+ /**
450
+ * GetLocationResponse
451
+ */
452
+ export interface GetLocationResponse {
453
+ location: IPInfo
454
+ }
455
+
456
+ /**
457
+ * PurposeLegalBasis
458
+ */
459
+ export interface PurposeLegalBasis {
460
+ allowed?: string
461
+ legalBasisCode: string
462
+ }
463
+
464
+ /**
465
+ * PurposeAllowed
466
+ */
467
+ export interface PurposeAllowed {
468
+ allowed: string
469
+ legalBasisCode?: string
470
+ }
471
+
472
+ /**
473
+ * PurposeAllowedLegalBasis
474
+ */
475
+ export interface PurposeAllowedLegalBasis {
476
+ allowed: string
477
+ legalBasisCode: string
478
+ }
479
+
480
+ /**
481
+ * GetConsentRequest
482
+ */
483
+ export interface GetConsentRequest {
484
+ organizationCode: string
485
+ controllerCode?: string
486
+ propertyCode: string
487
+ environmentCode: string
488
+ jurisdictionCode: string
489
+ identities: { [key: string]: string }
490
+ purposes: { [key: string]: PurposeLegalBasis }
491
+ vendors?: string[] // list of vendor ids for which the user has opted out
492
+
493
+ collectedAt?: number
494
+ }
495
+
496
+ /**
497
+ * GetConsentResponse
498
+ */
499
+ export interface GetConsentResponse {
500
+ organizationCode: string
501
+ controllerCode?: string
502
+ propertyCode: string
503
+ environmentCode: string
504
+ jurisdictionCode: string
505
+ identities: { [key: string]: string }
506
+ purposes: { [key: string]: PurposeAllowed | string }
507
+ /**
508
+ * list of vendor ids for which the user has opted out
509
+ */
510
+ vendors?: string[]
511
+
512
+ collectedAt?: number
513
+ }
514
+
515
+ /**
516
+ * SetConsentRequest
517
+ */
518
+ export interface SetConsentRequest {
519
+ organizationCode: string
520
+ controllerCode?: string
521
+ propertyCode: string
522
+ environmentCode: string
523
+ jurisdictionCode: string
524
+ identities: { [key: string]: string }
525
+ collectedAt?: number
526
+ migrationOption?: MigrationOption // @deprecated
527
+ purposes: { [key: string]: PurposeAllowedLegalBasis }
528
+ vendors?: string[] // list of vendor ids for which the user has opted out
529
+ }
530
+
531
+ /**
532
+ * DataSubject
533
+ */
534
+ export interface DataSubject {
535
+ email: string
536
+ firstName: string
537
+ lastName: string
538
+ country?: string
539
+ stateRegion?: string
540
+ description?: string
541
+ phone?: string
542
+ postalCode?: string
543
+ addressLine1?: string
544
+ addressLine2?: string
545
+
546
+ /**
547
+ * typeCode is the identifier representing the data subject type specified by the user
548
+ */
549
+ typeCode?: string
550
+
551
+ /**
552
+ * typeRelationshipDetails is additional information provided by the user describing their relation to the business
553
+ */
554
+ typeRelationshipDetails?: string
555
+ }
556
+
557
+ /**
558
+ * InvokeRightRequest
559
+ */
560
+ export interface InvokeRightRequest {
561
+ organizationCode: string
562
+ controllerCode?: string
563
+ propertyCode: string
564
+ environmentCode: string
565
+ identities: { [key: string]: string }
566
+ invokedAt?: number
567
+ jurisdictionCode: string
568
+ rightCode: string
569
+ user: DataSubject
570
+ recaptchaToken?: string
571
+ }
572
+
573
+ /**
574
+ * GetBootstrapConfigurationRequest
575
+ */
576
+ export interface GetBootstrapConfigurationRequest {
577
+ organizationCode: string
578
+ propertyCode: string
579
+ }
580
+
581
+ /**
582
+ * GetFullConfigurationRequest
583
+ */
584
+ export interface GetFullConfigurationRequest {
585
+ organizationCode: string
586
+ propertyCode: string
587
+ environmentCode?: string
588
+ hash?: string
589
+ deploymentID?: string
590
+ jurisdictionCode?: string
591
+ languageCode?: string
592
+ }
593
+
594
+ /**
595
+ * GetPreferenceQRRequest
596
+ */
597
+ export interface GetPreferenceQRRequest {
598
+ organizationCode: string
599
+ propertyCode: string
600
+ environmentCode?: string
601
+ imageSize?: number
602
+ path?: string
603
+ backgroundColor?: string
604
+ foregroundColor?: string
605
+ parameters: { [key: string]: string }
606
+ }
607
+
608
+ /**
609
+ * WebReportRequest
610
+ */
611
+ export interface WebReportRequest {
612
+ type: string
613
+ age: number
614
+ url: string
615
+ user_agent: string
616
+ body: { [key: string]: any }
617
+ }
618
+
619
+ /**
620
+ * Organization
621
+ */
622
+ export interface Organization {
623
+ code: string
624
+ }
625
+
626
+ /**
627
+ * JurisdictionInfo
628
+ */
629
+ export interface JurisdictionInfo {
630
+ code?: string
631
+ defaultScopeCode?: string
632
+ variable?: string
633
+ scopes?: { [key: string]: string }
634
+ }
635
+
636
+ /**
637
+ * Property
638
+ */
639
+ export interface Property {
640
+ code?: string
641
+ name?: string
642
+ platform?: string
643
+ proxy?: string
644
+ }
645
+
646
+ /**
647
+ * Environment
648
+ */
649
+ export interface Environment {
650
+ code: string
651
+ pattern?: string
652
+ hash?: string
653
+ domain?: string
654
+ }
655
+
656
+ /**
657
+ * Deployment
658
+ */
659
+ export interface Deployment {
660
+ code: string
661
+ version: number
662
+ }
663
+
664
+ /**
665
+ * Cookie
666
+ */
667
+ export interface Cookie {
668
+ name: string
669
+ code: string
670
+ host: string
671
+ duration: CookieDuration
672
+ provenance: CookieProvenance
673
+ category: CookieCategory
674
+ description: string
675
+ serviceProvider?: string
676
+ latest?: boolean
677
+ version?: number
678
+ }
679
+
680
+ /**
681
+ * PurposeCategory
682
+ */
683
+ export type PurposeCategory = {
684
+ name: string
685
+ description: string
686
+ retentionPeriod: string
687
+ externalTransfers: string
688
+ }
689
+
690
+ /**
691
+ * Purpose
692
+ */
693
+ export interface Purpose {
694
+ code: string
695
+ name?: string
696
+ description?: string
697
+ legalBasisCode: string
698
+ requiresOptIn?: boolean
699
+ allowsOptOut?: boolean
700
+ requiresDisplay?: boolean
701
+ requiresPrivacyPolicy?: boolean
702
+ cookies?: Cookie[]
703
+ categories?: PurposeCategory[]
704
+ tcfType?: string
705
+ tcfID?: string
706
+ canonicalPurposeCode?: string
707
+ legalBasisName?: string
708
+ legalBasisDescription?: string
709
+
710
+ /**
711
+ * the data subject types for which the purpose is relevant. If this list is empty then the purpose applies to all
712
+ * data subject types
713
+ */
714
+ dataSubjectTypeCodes?: string[]
715
+ }
716
+
717
+ /**
718
+ * CanonicalPurpose
719
+ */
720
+ export interface CanonicalPurpose {
721
+ code: string
722
+ name: string
723
+ purposeCodes?: string[]
724
+ }
725
+
726
+ /**
727
+ * IdentityLocation is the location on the page from which to retrieve identity information
728
+ */
729
+ export enum IdentityType {
730
+ IDENTITY_TYPE_UNDEFINED = '',
731
+ IDENTITY_TYPE_DATA_LAYER = 'dataLayer',
732
+ IDENTITY_TYPE_WINDOW = 'window',
733
+ IDENTITY_TYPE_COOKIE = 'cookie',
734
+ IDENTITY_TYPE_MANAGED = 'managedCookie', // this is created if necessary and stored in a cookie with associated name
735
+ IDENTITY_TYPE_LOCAL_STORAGE = 'localStorage',
736
+ IDENTITY_TYPE_SESSION_STORAGE = 'sessionStorage',
737
+ IDENTITY_TYPE_QUERY_STRING = 'queryString',
738
+ }
739
+
740
+ /**
741
+ * IdentityFormat is the encoding of the string identity value
742
+ */
743
+ export enum IdentityFormat {
744
+ IDENTITY_FORMAT_UNDEFINED = '',
745
+ IDENTITY_FORMAT_STRING = 'string',
746
+ IDENTITY_FORMAT_JSON = 'json',
747
+ IDENTITY_FORMAT_JWT = 'jwt',
748
+ IDENTITY_FORMAT_QUERY = 'query',
749
+ IDENTITY_FORMAT_SEMICOLON = 'semicolon',
750
+ }
751
+
752
+ /**
753
+ * Identity represents all the metadata for an identifier on the page
754
+ */
755
+ export interface Identity {
756
+ /**
757
+ * type is the location on the page from which to retrieve identity information
758
+ */
759
+ type: IdentityType
760
+
761
+ /**
762
+ * variable is the name to look up the identity value in the specified location
763
+ */
764
+ variable: string
765
+
766
+ /**
767
+ * format is the encoding of the value
768
+ */
769
+ format: IdentityFormat
770
+
771
+ /**
772
+ * key is the identifier to find the identity within the value if the format is IDENTITY_FORMAT_STRING then key
773
+ * will be undefined
774
+ */
775
+ key?: string
776
+
777
+ /**
778
+ * priority of the identity for consent conflict resolution
779
+ */
780
+ priority?: number
781
+ }
782
+
783
+ /**
784
+ * PolicyDocument
785
+ */
786
+ export interface PolicyDocument {
787
+ code: string
788
+ version: number
789
+ url: string
790
+ }
791
+
792
+ /**
793
+ * SwitchTextRenderLogic
794
+ */
795
+ export enum SwitchTextRenderLogic {
796
+ /**
797
+ * SWITCH_TEXT_RENDER_ALL always renders the switch text regardless of state
798
+ */
799
+ SWITCH_TEXT_RENDER_ALL = 1,
800
+ /**
801
+ * SWITCH_TEXT_RENDER_LEGAL_BASIS renders the switch text only if different from the legal basis default
802
+ */
803
+ SWITCH_TEXT_RENDER_LEGAL_BASIS = 2,
804
+ /**
805
+ * SWITCH_TEXT_RENDER_CHANGE renders the switch only if the user changes the state of the switch
806
+ */
807
+ SWITCH_TEXT_RENDER_CHANGE = 3,
808
+ /**
809
+ * SWITCH_TEXT_RENDER_NEVER never renders the switch text
810
+ */
811
+ SWITCH_TEXT_RENDER_NEVER = 4,
812
+ }
813
+
814
+ /**
815
+ * Banner
816
+ */
817
+ export interface Banner {
818
+ title?: string
819
+ footerDescription: string
820
+ buttonText: string
821
+ primaryButtonAction?: ExperiencePrimaryButtonAction
822
+ secondaryButtonText?: string
823
+ secondaryButtonDestination?: ExperienceButtonDestination
824
+
825
+ /**
826
+ * showCloseIcon determines whether the x out icon appears in the experience. Default do not show
827
+ */
828
+ showCloseIcon?: boolean
829
+
830
+ /**
831
+ * additional extensions
832
+ */
833
+ extensions?: { [key: string]: string }
834
+ }
835
+
836
+ /**
837
+ * Modal
838
+ */
839
+ export interface Modal {
840
+ title: string
841
+ bodyTitle?: string
842
+ bodyDescription?: string
843
+ footerDescription?: string
844
+ buttonText: string
845
+
846
+ /**
847
+ * consentTitle is the heading that goes above the list of purposes this optionally overrides the standard title
848
+ */
849
+ consentTitle?: string
850
+
851
+ /**
852
+ * hideConsentTitle determines whether the consent title should be hidden. Default is to show
853
+ */
854
+ hideConsentTitle?: boolean
855
+
856
+ /**
857
+ * hideLegalBases determines whether the legal bases should be hidden. Default is to show
858
+ */
859
+ hideLegalBases?: boolean
860
+
861
+ /**
862
+ * switchOnText overrides the standard text for a consent switch in the on state
863
+ */
864
+ switchOnText?: string
865
+
866
+ /**
867
+ * switchOffText overrides the standard text for a consent switch in the off state
868
+ */
869
+ switchOffText?: string
870
+
871
+ /**
872
+ * switchTextRenderLogic determines the logic for showing the switch text
873
+ */
874
+ switchTextRenderLogic?: SwitchTextRenderLogic
875
+
876
+ /**
877
+ * showCloseIcon determines whether the x out icon appears in the experience. Default do not show
878
+ */
879
+ showCloseIcon?: boolean
880
+
881
+ /**
882
+ * additional extensions
883
+ */
884
+ extensions?: { [key: string]: string }
885
+ }
886
+
887
+ /**
888
+ * JIT
889
+ */
890
+ export interface JIT {
891
+ title?: string
892
+ bodyDescription?: string
893
+ acceptButtonText: string
894
+ declineButtonText: string
895
+ moreInfoText?: string
896
+ moreInfoDestination?: ExperienceButtonDestination
897
+
898
+ /**
899
+ * showCloseIcon determines whether the x out icon appears in the experience. Default do not show
900
+ */
901
+ showCloseIcon?: boolean
902
+
903
+ /**
904
+ * additional extensions
905
+ */
906
+ extensions?: { [key: string]: string }
907
+ }
908
+
909
+ /**
910
+ * RightsTab
911
+ */
912
+ export interface RightsTab {
913
+ tabName: string
914
+ bodyTitle?: string
915
+ bodyDescription?: string
916
+ buttonText: string
917
+
918
+ /**
919
+ * additional extensions
920
+ */
921
+ extensions?: { [key: string]: string }
922
+ }
923
+
924
+ /**
925
+ * ConsentsTab
926
+ */
927
+ export interface ConsentsTab {
928
+ tabName: string
929
+ bodyTitle?: string
930
+ bodyDescription?: string
931
+ buttonText: string
932
+
933
+ /**
934
+ * consentTitle is the heading that goes above the list of purposes
935
+ * this optionally overrides the standard title
936
+ */
937
+ consentTitle?: string
938
+
939
+ /**
940
+ * hideConsentTitle determines whether the consent title should be hidden. Default is to show
941
+ */
942
+ hideConsentTitle?: boolean
943
+
944
+ /**
945
+ * hideLegalBases determines whether the legal bases should be hidden. Default is to show
946
+ */
947
+ hideLegalBases?: boolean
948
+
949
+ /**
950
+ * switchOnText overrides the standard text for a consent switch in the on state
951
+ */
952
+ switchOnText?: string
953
+
954
+ /**
955
+ * switchOffText overrides the standard text for a consent switch in the off state
956
+ */
957
+ switchOffText?: string
958
+
959
+ /**
960
+ * switchTextRenderLogic determines the logic for showing the switch text
961
+ */
962
+ switchTextRenderLogic?: SwitchTextRenderLogic
963
+
964
+ /**
965
+ * additional extensions
966
+ */
967
+ extensions?: { [key: string]: string }
968
+ }
969
+
970
+ /**
971
+ * OverviewTab
972
+ */
973
+ export interface OverviewTab {
974
+ tabName: string
975
+ bodyTitle?: string
976
+ bodyDescription: string
977
+
978
+ /**
979
+ * additional extensions
980
+ * */
981
+ extensions?: { [key: string]: string }
982
+ }
983
+
984
+ /**
985
+ * ConsentExperience
986
+ */
987
+ export interface ConsentExperience {
988
+ code: string
989
+ version: number
990
+ banner: Banner
991
+ modal: Modal
992
+ jit?: JIT
993
+ experienceDefault: ExperienceDefault
994
+
995
+ /**
996
+ * additional extensions
997
+ */
998
+ extensions?: { [key: string]: string }
999
+ }
1000
+
1001
+ /**
1002
+ * PreferenceExperience
1003
+ */
1004
+ export interface PreferenceExperience {
1005
+ code: string
1006
+ version: number
1007
+ title: string
1008
+ rights?: RightsTab
1009
+ consents?: ConsentsTab
1010
+ overview: OverviewTab
1011
+
1012
+ /**
1013
+ * additional extensions
1014
+ */
1015
+ extensions?: { [key: string]: string }
1016
+ }
1017
+
1018
+ /**
1019
+ * Right
1020
+ */
1021
+ export interface Right {
1022
+ code: string
1023
+ name: string
1024
+ description: string
1025
+
1026
+ /**
1027
+ * the data subject types for which the right is relevant. If this list is empty then the right applies to all
1028
+ * data subject types
1029
+ */
1030
+ dataSubjectTypeCodes?: string[]
1031
+ }
1032
+
1033
+ /**
1034
+ * Experience
1035
+ */
1036
+ export interface Experience {
1037
+ consent?: ConsentExperience
1038
+ preference?: PreferenceExperience
1039
+ }
1040
+
1041
+ /**
1042
+ * BannerPosition
1043
+ */
1044
+ export enum BannerPosition {
1045
+ BOTTOM = 1,
1046
+ TOP = 2,
1047
+ BOTTOM_LEFT = 3,
1048
+ BOTTOM_RIGHT = 4,
1049
+ }
1050
+
1051
+ /**
1052
+ * ModalPosition
1053
+ */
1054
+ export enum ModalPosition {
1055
+ CENTER = 1,
1056
+ LEFT_FULL_HEIGHT = 2,
1057
+ RIGHT_FULL_HEIGHT = 3,
1058
+ }
1059
+
1060
+ /**
1061
+ * Theme
1062
+ */
1063
+ export interface Theme {
1064
+ code?: string
1065
+ name?: string
1066
+ description?: string
1067
+ watermark?: boolean
1068
+ buttonBorderRadius: number
1069
+ font?: string
1070
+
1071
+ bannerBackgroundColor: string
1072
+ bannerContentColor?: string
1073
+ bannerButtonColor: string
1074
+ bannerSecondaryButtonColor?: string
1075
+ bannerPosition?: BannerPosition
1076
+
1077
+ modalHeaderBackgroundColor: string
1078
+ modalHeaderContentColor?: string
1079
+ modalContentColor: string
1080
+ modalButtonColor: string
1081
+ modalPosition?: ModalPosition
1082
+
1083
+ /**
1084
+ * modalSwitchOnColor is the color of the consent switch in the on state for the modal this overrides standard theme
1085
+ * colors
1086
+ */
1087
+ modalSwitchOnColor?: string
1088
+
1089
+ /**
1090
+ * modalSwitchOffColor is the color of the consent switch in the off state for the modal this overrides standard
1091
+ * theme colors
1092
+ */
1093
+ modalSwitchOffColor?: string
1094
+
1095
+ formHeaderBackgroundColor: string
1096
+ formHeaderContentColor?: string
1097
+ formContentColor: string
1098
+ formButtonColor: string
1099
+
1100
+ /**
1101
+ * formSwitchOnColor is the color of the consent switch in the on state for the form this overrides standard theme
1102
+ * colors
1103
+ */
1104
+ formSwitchOnColor?: string
1105
+
1106
+ /**
1107
+ * formSwitchOffColor is the color of the consent switch in the off state for the form this overrides standard theme
1108
+ * colors
1109
+ */
1110
+ formSwitchOffColor?: string
1111
+
1112
+ /**
1113
+ * qrBackgroundColor is the override for the QR code background color
1114
+ */
1115
+ qrBackgroundColor?: string
1116
+
1117
+ /**
1118
+ * qrForegroundColor is the override for the QR code foreground color
1119
+ */
1120
+ qrForegroundColor?: string
1121
+ }
1122
+
1123
+ /**
1124
+ * Vendor purpose
1125
+ */
1126
+ export interface VendorPurpose {
1127
+ name: string
1128
+ legalBasis?: string // legalBasisName
1129
+ }
1130
+
1131
+ /**
1132
+ * Vendor definition
1133
+ */
1134
+ export interface Vendor {
1135
+ id: string
1136
+ name: string
1137
+ purposes?: VendorPurpose[]
1138
+ specialPurposes?: VendorPurpose[]
1139
+ features?: VendorPurpose[]
1140
+ specialFeatures?: VendorPurpose[]
1141
+ policyUrl?: string
1142
+ cookieMaxAgeSeconds?: number
1143
+ usesCookies?: boolean
1144
+ usesNonCookieAccess?: boolean
1145
+ }
1146
+
1147
+ /**
1148
+ * DataSubjectType represents user defined data subject types with code as the unique identifier
1149
+ */
1150
+ export interface DataSubjectType {
1151
+ code: string
1152
+ name: string
1153
+
1154
+ /**
1155
+ * requiresUserInput is true if additional information must be requested to describe the data subject relation
1156
+ */
1157
+ requiresUserInput: boolean
1158
+ }
1159
+
1160
+ /**
1161
+ * Stack represents a grouping of purposes to be displayed in an experience
1162
+ */
1163
+ export interface Stack {
1164
+ /**
1165
+ * name of the stack to be displayed
1166
+ */
1167
+ name: string
1168
+
1169
+ /**
1170
+ * list of purpose codes that are members of the stack
1171
+ */
1172
+ purposeCodes: string[]
1173
+ }
1174
+
1175
+ /**
1176
+ * Configuration
1177
+ */
1178
+ export interface Configuration {
1179
+ /**
1180
+ * Organization this configuration belongs to
1181
+ */
1182
+ organization: Organization
1183
+
1184
+ /**
1185
+ * Property this configuration belongs to
1186
+ */
1187
+ property?: Property
1188
+
1189
+ /**
1190
+ * Language for all text
1191
+ */
1192
+ language?: string
1193
+
1194
+ /**
1195
+ * Available environments. Only available in the "boot" configuration.
1196
+ */
1197
+ environments?: Environment[]
1198
+
1199
+ /**
1200
+ * Environment for this configuration. Only available in the "full" configuration.
1201
+ */
1202
+ environment?: Environment
1203
+
1204
+ /**
1205
+ * Applicable jurisdiction.
1206
+ */
1207
+ jurisdiction?: JurisdictionInfo
1208
+
1209
+ /**
1210
+ * Identity spaces defined for this property
1211
+ */
1212
+ identities?: { [key: string]: Identity }
1213
+
1214
+ /**
1215
+ * Deployment information. Only available in the "full" configuration.
1216
+ */
1217
+ deployment?: Deployment
1218
+
1219
+ /**
1220
+ * Regulations enabled for this jurisdiction.
1221
+ */
1222
+ regulations?: string[]
1223
+
1224
+ /**
1225
+ * Rights available in this jurisdiction.
1226
+ */
1227
+ rights?: Right[]
1228
+
1229
+ /**
1230
+ * Purposes in this jurisdiction.
1231
+ */
1232
+ purposes?: Purpose[]
1233
+
1234
+ /**
1235
+ * Mapping of purposes to canonical purposes.
1236
+ */
1237
+ canonicalPurposes?: { [key: string]: CanonicalPurpose }
1238
+
1239
+ /**
1240
+ * Privacy policy document
1241
+ */
1242
+ privacyPolicy?: PolicyDocument
1243
+
1244
+ /**
1245
+ * Terms of Service (ToS) policy document
1246
+ */
1247
+ termsOfService?: PolicyDocument
1248
+
1249
+ /**
1250
+ * Theme
1251
+ */
1252
+ theme?: Theme
1253
+
1254
+ /**
1255
+ * Experience definitions
1256
+ */
1257
+ experiences?: Experience
1258
+
1259
+ /**
1260
+ * Vendors (TCF)
1261
+ */
1262
+ vendors?: Vendor[]
1263
+
1264
+ /**
1265
+ * Data subject types relevant for this configuration
1266
+ */
1267
+ dataSubjectTypes?: DataSubjectType[]
1268
+
1269
+ /**
1270
+ * Stacks to be displayed in an experience
1271
+ */
1272
+ stacks?: Stack[]
1273
+
1274
+ /**
1275
+ * Services
1276
+ */
1277
+ services?: { [key: string]: string }
1278
+
1279
+ /**
1280
+ * Flexible options
1281
+ */
1282
+ options?: { [key: string]: string }
1283
+
1284
+ /**
1285
+ * Scripts to load
1286
+ */
1287
+ scripts?: string[]
1288
+
1289
+ /**
1290
+ * Plugins configured for the configuration
1291
+ */
1292
+ plugins?: { [key: string]: any }
1293
+
1294
+ /**
1295
+ * Recaptcha config
1296
+ */
1297
+ recaptcha?: Recaptcha
1298
+ }
1299
+
1300
+ /**
1301
+ * Recaptcha interface defines the Recaptcha config
1302
+ */
1303
+ export interface Recaptcha {
1304
+ /**
1305
+ * siteKey: Recaptcha site/public key used to exchange for a reCaptcha token
1306
+ */
1307
+ siteKey?: string
1308
+ }
1309
+
1310
+ /**
1311
+ * Pusher interface defines a type that has a push function like an array
1312
+ */
1313
+ export interface Pusher {
1314
+ /**
1315
+ * Pushes the given arguments.
1316
+ *
1317
+ * @param args The arguments to push.
1318
+ */
1319
+ push(args: any[]): void
1320
+ }
1321
+
1322
+ /**
1323
+ * Loaded interface defines a type that has a loaded boolean property
1324
+ */
1325
+ export interface Loaded {
1326
+ /**
1327
+ * Loaded is set to true if the object has fully loaded
1328
+ */
1329
+ loaded: boolean
1330
+ }
1331
+
1332
+ declare global {
1333
+ interface Window {
1334
+ /**
1335
+ * Semaphore is the main entrypoint.
1336
+ */
1337
+ semaphore: Pusher & Loaded
1338
+ }
1339
+ }