@ketch-sdk/ketch-types 1.6.0 → 1.8.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +1041 -766
  2. package/dist/index.js +62 -8
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,388 +1,257 @@
1
1
  /**
2
- * Status
2
+ * Tab
3
+ *
4
+ * @enum
3
5
  */
4
- export type Status = {
5
- [key: string]: boolean;
6
- };
6
+ export declare enum Tab {
7
+ Overview = "overviewTab",
8
+ Rights = "rightsTab",
9
+ Consents = "consentsTab"
10
+ }
7
11
  /**
8
- * Consent
12
+ * Determines if the given value is a Tab
13
+ *
14
+ * @param value The value to test
15
+ * @returns true if the given value is a Tab
9
16
  */
10
- export type Consent = {
11
- purposes: Status;
12
- vendors?: string[];
13
- };
17
+ export declare function isTab(value: string): value is Tab;
14
18
  /**
15
- * Identities
19
+ * ExperienceType is the type of experience that will be shown
20
+ *
21
+ * @enum
16
22
  */
17
- export type Identities = {
18
- [key: string]: string;
19
- };
23
+ export declare enum ExperienceType {
24
+ Consent = "experiences.consent",
25
+ Preference = "experiences.preference"
26
+ }
20
27
  /**
21
- * All Tabs
28
+ * ConsentExperienceType is the type of consent experience that will be shown
22
29
  *
23
- * @deprecated Future version will become a TypeScript enum
30
+ * @enum
24
31
  */
25
- export declare const ALL_TABS: readonly ["overviewTab", "rightsTab", "consentsTab"];
32
+ export declare enum ConsentExperienceType {
33
+ Banner = "experiences.consent.banner",
34
+ Modal = "experiences.consent.modal",
35
+ JIT = "experiences.consent.jit"
36
+ }
26
37
  /**
27
- * TabTuple
38
+ * ExperienceClosedReason describes the reason the experience was closed.
39
+ *
40
+ * setConsent = consent was accepted/set
41
+ * invokeRight = the right was invoked
42
+ * close = the close/exit button was clicked
43
+ * willNotShow = the experience was skipped
28
44
  *
29
- * @deprecated Future version will become a TypeScript enum
45
+ * @enum
30
46
  */
31
- export type TabTuple = typeof ALL_TABS;
47
+ export declare enum ExperienceClosedReason {
48
+ SET_CONSENT = "setConsent",
49
+ INVOKE_RIGHT = "invokeRight",
50
+ CLOSE = "close",
51
+ WILL_NOT_SHOW = "willNotShow"
52
+ }
32
53
  /**
33
- * Tab
54
+ * ExperienceDefault
34
55
  *
35
- * @deprecated Future version will become a TypeScript enum
56
+ * @enum
36
57
  */
37
- export type Tab = TabTuple[number];
58
+ export declare enum ExperienceDefault {
59
+ BANNER = 1,
60
+ MODAL = 2
61
+ }
38
62
  /**
39
- * Determines if the Given value is a Tab
63
+ * ExperienceButtonDestination
40
64
  *
41
- * @param value
65
+ * @enum
42
66
  */
43
- export declare function isTab(value: string): value is Tab;
67
+ export declare enum ExperienceButtonDestination {
68
+ GOTO_MODAL = 1,
69
+ GOTO_PREFERENCE = 2,
70
+ REJECT_ALL = 3
71
+ }
44
72
  /**
45
- * Plugin class
73
+ * ExperiencePrimaryButtonAction
46
74
  *
47
- * @deprecated New plugins should be functional plugins.
48
- * @see PluginFunction
75
+ * @enum
49
76
  */
50
- export interface PluginClass {
77
+ export declare enum ExperiencePrimaryButtonAction {
78
+ SAVE_CURRENT_STATE = 1,
79
+ ACCEPT_ALL = 2
80
+ }
81
+ /**
82
+ * MigrationOption
83
+ *
84
+ * @enum
85
+ */
86
+ export declare enum MigrationOption {
87
+ MIGRATE_DEFAULT = 0,
88
+ MIGRATE_NEVER = 1,
89
+ MIGRATE_FROM_ALLOW = 2,
90
+ MIGRATE_FROM_DENY = 3,
91
+ MIGRATE_ALWAYS = 4
92
+ }
93
+ /**
94
+ * CookieDuration
95
+ *
96
+ * @enum
97
+ */
98
+ export declare enum CookieDuration {
99
+ SESSION = 1,
100
+ PERSISTENT = 2
101
+ }
102
+ /**
103
+ * CookieProvenance
104
+ *
105
+ * @enum
106
+ */
107
+ export declare enum CookieProvenance {
108
+ FIRST_PARTY = 1,
109
+ THIRD_PARTY = 2
110
+ }
111
+ /**
112
+ * CookieCategory
113
+ *
114
+ * @enum
115
+ */
116
+ export declare enum CookieCategory {
117
+ STRICTLY_NECESSARY = 1,
118
+ FUNCTIONAL = 2,
119
+ PERFORMANCE = 3,
120
+ MARKETING = 4
121
+ }
122
+ /**
123
+ * IdentityLocation is the location on the page from which to retrieve identity information
124
+ *
125
+ * @enum
126
+ */
127
+ export declare enum IdentityType {
128
+ IDENTITY_TYPE_UNDEFINED = "",
129
+ IDENTITY_TYPE_DATA_LAYER = "dataLayer",
130
+ IDENTITY_TYPE_WINDOW = "window",
131
+ IDENTITY_TYPE_COOKIE = "cookie",
132
+ IDENTITY_TYPE_MANAGED = "managedCookie",
133
+ IDENTITY_TYPE_LOCAL_STORAGE = "localStorage",
134
+ IDENTITY_TYPE_SESSION_STORAGE = "sessionStorage",
135
+ IDENTITY_TYPE_QUERY_STRING = "queryString"
136
+ }
137
+ /**
138
+ * IdentityFormat is the encoding of the string identity value
139
+ *
140
+ * @enum
141
+ */
142
+ export declare enum IdentityFormat {
143
+ IDENTITY_FORMAT_UNDEFINED = "",
144
+ IDENTITY_FORMAT_STRING = "string",
145
+ IDENTITY_FORMAT_JSON = "json",
146
+ IDENTITY_FORMAT_JWT = "jwt",
147
+ IDENTITY_FORMAT_QUERY = "query",
148
+ IDENTITY_FORMAT_SEMICOLON = "semicolon"
149
+ }
150
+ /**
151
+ * SwitchTextRenderLogic
152
+ *
153
+ * @enum
154
+ */
155
+ export declare enum SwitchTextRenderLogic {
51
156
  /**
52
- * Initialize the plugin
53
- *
54
- * @param host The Ketch instance
55
- * @param config The configuration
157
+ * SWITCH_TEXT_RENDER_ALL always renders the switch text regardless of state
56
158
  */
57
- init?: (host: Ketch, config: Configuration) => void;
159
+ SWITCH_TEXT_RENDER_ALL = 1,
58
160
  /**
59
- * Equivalent of on('environment')
60
- *
61
- * @param host The Ketch instance
62
- * @param config The configuration
63
- * @param env The environment
161
+ * SWITCH_TEXT_RENDER_LEGAL_BASIS renders the switch text only if different from the legal basis default
64
162
  */
65
- environmentLoaded?: (host: Ketch, config: Configuration, env: Environment) => void;
163
+ SWITCH_TEXT_RENDER_LEGAL_BASIS = 2,
66
164
  /**
67
- * Equivalent of on('geoip')
68
- *
69
- * @param host The Ketch instance
70
- * @param config The configuration
71
- * @param ipInfo The IP information
165
+ * SWITCH_TEXT_RENDER_CHANGE renders the switch only if the user changes the state of the switch
72
166
  */
73
- geoIPLoaded?: (host: Ketch, config: Configuration, ipInfo: IPInfo) => void;
167
+ SWITCH_TEXT_RENDER_CHANGE = 3,
74
168
  /**
75
- * Equivalent of on('identities')
76
- *
77
- * @param host The Ketch instance
78
- * @param config The configuration
79
- * @param identities The identities
169
+ * SWITCH_TEXT_RENDER_NEVER never renders the switch text
80
170
  */
81
- identitiesLoaded?: (host: Ketch, config: Configuration, identities: Identities) => void;
171
+ SWITCH_TEXT_RENDER_NEVER = 4
172
+ }
173
+ /**
174
+ * BannerPosition
175
+ *
176
+ * @enum
177
+ */
178
+ export declare enum BannerPosition {
179
+ BOTTOM = 1,
180
+ TOP = 2,
181
+ BOTTOM_LEFT = 3,
182
+ BOTTOM_RIGHT = 4
183
+ }
184
+ /**
185
+ * ModalPosition
186
+ *
187
+ * @enum
188
+ */
189
+ export declare enum ModalPosition {
190
+ CENTER = 1,
191
+ LEFT_FULL_HEIGHT = 2,
192
+ RIGHT_FULL_HEIGHT = 3
193
+ }
194
+ /**
195
+ * ExperienceActionKind is the Kind of the ExperienceAction.
196
+ *
197
+ * @enum
198
+ */
199
+ export declare enum ExperienceActionKind {
82
200
  /**
83
- * Equivalent of on('jurisdiction')
84
- *
85
- * @param host The Ketch instance
86
- * @param config The configuration
87
- * @param jurisdiction The jurisdiction
201
+ * The experience was shown
88
202
  */
89
- jurisdictionLoaded?: (host: Ketch, config: Configuration, policyScope: string) => void;
203
+ ShowExperience = 0,
90
204
  /**
91
- * Equivalent of on('regionInfo')
92
- *
93
- * @param host The Ketch instance
94
- * @param config The configuration
95
- * @param regionInfo The region info
205
+ * The experience was hidden
96
206
  */
97
- regionInfoLoaded?: (host: Ketch, config: Configuration, region: string) => void;
207
+ HideExperience = 1,
98
208
  /**
99
- * Equivalent of on('consent')
100
- *
101
- * @param host The Ketch instance
102
- * @param config The configuration
103
- * @param consent The consent
209
+ * Consent was changed
104
210
  */
105
- consentChanged?: (host: Ketch, config: Configuration, consent: Consent) => void;
211
+ SetConsent = 2,
106
212
  /**
107
- * Equivalent of on('rightInvoked')
108
- *
109
- * @param host The Ketch instance
110
- * @param config The configuration
111
- * @param request The right invocation request
213
+ * Subscriptions were changed
112
214
  */
113
- rightInvoked?: (host: Ketch, config: Configuration, request: InvokeRightRequest) => void;
215
+ SetSubscription = 3,
114
216
  /**
115
- * Equivalent of on('showConsentExperience')
116
- *
117
- * @param host The Ketch instance
118
- * @param config The configuration
119
- * @param consents The current consents
120
- * @param options The options for the experience
217
+ * Right was invoked
121
218
  */
122
- showConsentExperience?: (host: Ketch, config: Configuration, consents: Consent, options?: ShowConsentOptions) => void;
219
+ InvokeRight = 4
220
+ }
221
+ /**
222
+ * Storage policy setting
223
+ *
224
+ * @enum
225
+ */
226
+ export declare enum StorageOriginPolicy {
123
227
  /**
124
- * Equivalent of on('showPreferenceExperience')
125
- *
126
- * @param host The Ketch instance
127
- * @param config The configuration
128
- * @param consents The current consents
129
- * @param options The options for the experience
228
+ * Storage saved cross-origin.
130
229
  */
131
- showPreferenceExperience?: (host: Ketch, config: Configuration, consents: Consent, options?: ShowPreferenceOptions) => void;
230
+ CrossOrigin = "cross-origin",
132
231
  /**
133
- * Equivalent of on('willShowExperience')
134
- *
135
- * @param host The Ketch instance
136
- * @param config The configuration
137
- * @param type The type of the experience
232
+ * Storage is same-origin only.
138
233
  */
139
- willShowExperience?: (host: Ketch, config: Configuration, type: string) => void;
140
- /**
141
- * Equivalent of on('experienceHidden')
142
- *
143
- * @param host The Ketch instance
144
- * @param config The configuration
145
- * @param reason The reason the experience was hidden
146
- */
147
- experienceHidden?: (host: Ketch, config: Configuration, reason: string) => void;
234
+ SameOrigin = "same-origin,"
148
235
  }
149
236
  /**
150
- * Plugin factory function signature
151
- *
152
- * @param host The Ketch instance
153
- * @param config The plugin configuration
154
- */
155
- export type PluginFunction = (host: Ketch, config?: any) => Promise<void>;
156
- /**
157
- * Plugin
237
+ * Identities
158
238
  */
159
- export type Plugin = PluginClass | PluginFunction;
239
+ export type Identities = {
240
+ [key: string]: string;
241
+ };
160
242
  /**
161
- * IdentityProvider defines a function for providing identities
243
+ * Status
162
244
  */
163
- export type IdentityProvider = () => Promise<string[]>;
245
+ export type Status = {
246
+ [key: string]: boolean;
247
+ };
164
248
  /**
165
- * StorageProvider defines an interface for storage
249
+ * Consent
166
250
  */
167
- export interface StorageProvider {
168
- /**
169
- * Get an item with the given key
170
- *
171
- * @param key The item key
172
- */
173
- getItem(key: string): Promise<string | null>;
174
- /**
175
- * Sets the value for the given key
176
- *
177
- * @param key The item key
178
- * @param value The item value
179
- */
180
- setItem(key: string, value: string): Promise<void>;
181
- /**
182
- * Removes the given item
183
- *
184
- * @param key The item key
185
- */
186
- removeItem(key: string): Promise<void>;
187
- }
188
- export interface Ketch {
189
- /**
190
- * Register a plugin with the given configuration
191
- *
192
- * @param plugin The plugin
193
- * @param config The plugin configuration
194
- */
195
- registerPlugin(plugin: Plugin, config?: any): Promise<void>;
196
- /**
197
- * Register an identity provider for the given identity
198
- *
199
- * @param name The name of the identity
200
- * @param provider The provider of the identity
201
- */
202
- registerIdentityProvider(name: string, provider: IdentityProvider): Promise<void>;
203
- /**
204
- * Register a storage provider
205
- *
206
- * @param provider The provider implementation
207
- */
208
- registerStorageProvider(provider: StorageProvider): Promise<void>;
209
- /**
210
- * Determines if consent has already been resolved.
211
- *
212
- * @deprecated future versions will become asynchronous
213
- */
214
- hasConsent(): boolean;
215
- /**
216
- * Returns the Consent
217
- */
218
- getConsent(): Promise<Consent>;
219
- /**
220
- * Sets the consent
221
- *
222
- * @param consent
223
- * @deprecated Future versions will not return the Consent promise
224
- */
225
- setConsent(consent: Consent): Promise<Consent>;
226
- /**
227
- * Set a flag to show the consent experience
228
- *
229
- * @deprecated Will be removed in a future version
230
- */
231
- setShowConsentExperience(): Promise<void>;
232
- /**
233
- * Show the consent experience
234
- *
235
- * @deprecated Future versions will not return Consent in the Promise
236
- */
237
- showConsentExperience(): Promise<Consent>;
238
- /**
239
- * Show the preference experience
240
- *
241
- * @param params The parameters for the experience
242
- * @deprecated Future versions will not return Consent in the Promise
243
- */
244
- showPreferenceExperience(params?: ShowPreferenceOptions): Promise<Consent>;
245
- /**
246
- * Notify that the experience was closed
247
- *
248
- * @param reason Reason the experience was closed
249
- * @deprecated This method will be moved to an experience interface. Future
250
- * versions will not return Consent in the Promise
251
- */
252
- experienceClosed(reason: ExperienceClosedReason): Promise<Consent>;
253
- /**
254
- * Invokes a right
255
- *
256
- * @param eventData The definition of the right
257
- */
258
- invokeRight(eventData: InvokeRightEvent): Promise<void>;
259
- /**
260
- * Get the Configuration.
261
- */
262
- getConfig(): Promise<Configuration>;
263
- /**
264
- * Get the Environment
265
- */
266
- getEnvironment(): Promise<Environment>;
267
- /**
268
- * Get the IP information
269
- */
270
- getGeoIP(): Promise<IPInfo>;
271
- /**
272
- * Get the identities
273
- */
274
- getIdentities(): Promise<Identities>;
275
- /**
276
- * Get the jurisdiction
277
- */
278
- getJurisdiction(): Promise<string>;
279
- /**
280
- * Get the region information
281
- */
282
- getRegionInfo(): Promise<string>;
283
- /**
284
- * Alias for `emitter.on(eventName, listener)`.
285
- *
286
- * @param eventName The name of the event.
287
- * @param listener The callback function
288
- * @deprecated Future versions will become asynchronous
289
- */
290
- addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
291
- /**
292
- * Adds the `listener` function to the end of the listeners array for the
293
- * event named `eventName`. No checks are made to see if the `listener` has
294
- * already been added. Multiple calls passing the same combination of `eventName`
295
- * and `listener` will result in the `listener` being added, and called, multiple
296
- * times.
297
- *
298
- * Returns a reference to the `EventEmitter`, so that calls can be chained.
299
- *
300
- * By default, event listeners are invoked in the order they are added. The
301
- * `emitter.prependListener()` method can be used as an alternative to add the
302
- * event listener to the beginning of the listeners array.
303
- *
304
- * @param eventName The name of the event.
305
- * @param listener The callback function
306
- *
307
- * @deprecated Future versions will become asynchronous
308
- */
309
- on(eventName: string | symbol, listener: (...args: any[]) => void): this;
310
- /**
311
- * Adds a **one-time**`listener` function for the event named `eventName`. The
312
- * next time `eventName` is triggered, this listener is removed and then invoked.
313
- *
314
- * By default, event listeners are invoked in the order they are added. The
315
- * `emitter.prependOnceListener()` method can be used as an alternative to add the
316
- * event listener to the beginning of the listeners array.
317
- *
318
- * @param eventName The name of the event.
319
- * @param listener The callback function
320
- *
321
- * @deprecated Future versions will become asynchronous
322
- */
323
- once(eventName: string | symbol, listener: (...args: any[]) => void): this;
324
- /**
325
- * Removes the specified `listener` from the listener array for the event
326
- * named `eventName`.
327
- *
328
- * `removeListener()` will remove, at most, one instance of a listener from the
329
- * listener array. If any single listener has been added multiple times to the
330
- * listener array for the specified `eventName`, then `removeListener()` must be
331
- * called multiple times to remove each instance.
332
- *
333
- * Once an event is emitted, all listeners attached to it at the
334
- * time of emitting are called in order. This implies that any`removeListener()`
335
- * or `removeAllListeners()` calls _after_ emitting and _before_ the last listener
336
- * finishes execution will not remove them from`emit()` in progress. Subsequent
337
- * events behave as expected.
338
- *
339
- * Because listeners are managed using an internal array, calling this will
340
- * change the position indices of any listener registered _after_ the listener
341
- * being removed. This will not impact the order in which listeners are called,
342
- * but it means that any copies of the listener array as returned by
343
- * the `emitter.listeners()` method will need to be recreated.
344
- *
345
- * When a single function has been added as a handler multiple times for a single
346
- * event (as in the example below), `removeListener()` will remove the most
347
- * recently added instance. In the example the `once('ping')` listener is removed
348
- *
349
- * @param eventName The name of the event.
350
- * @param listener The callback function
351
- * @deprecated Future versions will become asynchronous
352
- */
353
- removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
354
- /**
355
- * Alias for `emitter.removeListener()`.
356
- *
357
- * @param eventName The name of the event.
358
- * @param listener The callback function
359
- * @deprecated Future versions will become asynchronous
360
- */
361
- off(eventName: string | symbol, listener: (...args: any[]) => void): this;
362
- /**
363
- * Removes all listeners, or those of the specified `eventName`.
364
- *
365
- * It is bad practice to remove listeners added elsewhere in the code,
366
- * particularly when the `EventEmitter` instance was created by some other
367
- * component or module (e.g. sockets or file streams).
368
- *
369
- * @param eventName The name of the event.
370
- * @deprecated Future versions will become asynchronous
371
- */
372
- removeAllListeners(eventName?: string | symbol): this;
373
- /**
374
- * Synchronously calls each of the listeners registered for the event named
375
- * `eventName`, in the order they were registered, passing the supplied arguments
376
- * to each.
377
- *
378
- * @returns `true` if the event had listeners, `false` otherwise.
379
- *
380
- * @param eventName The name of the event.
381
- * @param args The arguments for the event.
382
- * @deprecated Future versions will become asynchronous
383
- */
384
- emit(eventName: string | symbol, ...args: any[]): boolean;
385
- }
251
+ export type Consent = {
252
+ purposes: Status;
253
+ vendors?: string[];
254
+ };
386
255
  /**
387
256
  * ShowPreferenceOptions
388
257
  */
@@ -412,25 +281,6 @@ export type ShowPreferenceOptions = {
412
281
  */
413
282
  showConsentsTab?: boolean;
414
283
  };
415
- /**
416
- * ExperienceType is the type of experience that will be shown
417
- *
418
- * @enum
419
- */
420
- export declare enum ExperienceType {
421
- Consent = "experiences.consent",
422
- Preference = "experiences.preference"
423
- }
424
- /**
425
- * ConsentExperienceType is the type of consent experience that will be shown
426
- *
427
- * @enum
428
- */
429
- export declare enum ConsentExperienceType {
430
- Banner = "experiences.consent.banner",
431
- Modal = "experiences.consent.modal",
432
- JIT = "experiences.consent.jit"
433
- }
434
284
  /**
435
285
  * ShowConsentOptions
436
286
  */
@@ -447,97 +297,12 @@ export type InvokeRightEvent = {
447
297
  recaptchaToken?: string;
448
298
  };
449
299
  /**
450
- * ExperienceClosedReason describes the reason the experience was closed.
451
- *
452
- * setConsent = consent was accepted/set
453
- * invokeRight = the right was invoked
454
- * close = the close/exit button was clicked
455
- * willNotShow = the experience was skipped
456
- *
457
- * @enum
300
+ * IPLanguage
458
301
  */
459
- export declare enum ExperienceClosedReason {
460
- SET_CONSENT = "setConsent",
461
- INVOKE_RIGHT = "invokeRight",
462
- CLOSE = "close",
463
- WILL_NOT_SHOW = "willNotShow"
464
- }
465
- /**
466
- * ExperienceDefault
467
- *
468
- * @enum
469
- */
470
- export declare enum ExperienceDefault {
471
- BANNER = 1,
472
- MODAL = 2
473
- }
474
- /**
475
- * ExperienceButtonDestination
476
- *
477
- * @enum
478
- */
479
- export declare enum ExperienceButtonDestination {
480
- GOTO_MODAL = 1,
481
- GOTO_PREFERENCE = 2,
482
- REJECT_ALL = 3
483
- }
484
- /**
485
- * ExperiencePrimaryButtonAction
486
- *
487
- * @enum
488
- */
489
- export declare enum ExperiencePrimaryButtonAction {
490
- SAVE_CURRENT_STATE = 1,
491
- ACCEPT_ALL = 2
492
- }
493
- /**
494
- * MigrationOption
495
- *
496
- * @enum
497
- */
498
- export declare enum MigrationOption {
499
- MIGRATE_DEFAULT = 0,
500
- MIGRATE_NEVER = 1,
501
- MIGRATE_FROM_ALLOW = 2,
502
- MIGRATE_FROM_DENY = 3,
503
- MIGRATE_ALWAYS = 4
504
- }
505
- /**
506
- * CookieDuration
507
- *
508
- * @enum
509
- */
510
- export declare enum CookieDuration {
511
- SESSION = 1,
512
- PERSISTENT = 2
513
- }
514
- /**
515
- * CookieProvenance
516
- *
517
- * @enum
518
- */
519
- export declare enum CookieProvenance {
520
- FIRST_PARTY = 1,
521
- THIRD_PARTY = 2
522
- }
523
- /**
524
- * CookieCategory
525
- *
526
- * @enum
527
- */
528
- export declare enum CookieCategory {
529
- STRICTLY_NECESSARY = 1,
530
- FUNCTIONAL = 2,
531
- PERFORMANCE = 3,
532
- MARKETING = 4
533
- }
534
- /**
535
- * IPLanguage
536
- */
537
- export interface IPLanguage {
538
- code: string;
539
- name: string;
540
- native: string;
302
+ export interface IPLanguage {
303
+ code: string;
304
+ name: string;
305
+ native: string;
541
306
  }
542
307
  /**
543
308
  * IPLocation
@@ -570,18 +335,6 @@ export interface IPInfo {
570
335
  longitude: number;
571
336
  location: IPLocation;
572
337
  }
573
- /**
574
- * GetLocationRequest
575
- */
576
- export interface GetLocationRequest {
577
- IP?: string;
578
- }
579
- /**
580
- * GetLocationResponse
581
- */
582
- export interface GetLocationResponse {
583
- location: IPInfo;
584
- }
585
338
  /**
586
339
  * PurposeLegalBasis
587
340
  */
@@ -603,69 +356,6 @@ export interface PurposeAllowedLegalBasis {
603
356
  allowed: string;
604
357
  legalBasisCode: string;
605
358
  }
606
- /**
607
- * GetConsentRequest
608
- */
609
- export interface GetConsentRequest {
610
- organizationCode: string;
611
- controllerCode?: string;
612
- propertyCode: string;
613
- environmentCode: string;
614
- jurisdictionCode: string;
615
- identities: {
616
- [key: string]: string;
617
- };
618
- purposes: {
619
- [key: string]: PurposeLegalBasis;
620
- };
621
- /**
622
- * list of vendor ids for which the user has opted out
623
- */
624
- vendors?: string[];
625
- collectedAt?: number;
626
- }
627
- /**
628
- * GetConsentResponse
629
- */
630
- export interface GetConsentResponse {
631
- organizationCode: string;
632
- controllerCode?: string;
633
- propertyCode: string;
634
- environmentCode: string;
635
- jurisdictionCode: string;
636
- identities: {
637
- [key: string]: string;
638
- };
639
- purposes: {
640
- [key: string]: PurposeAllowed | string;
641
- };
642
- /**
643
- * list of vendor ids for which the user has opted out
644
- */
645
- vendors?: string[];
646
- collectedAt?: number;
647
- }
648
- /**
649
- * SetConsentRequest
650
- */
651
- export interface SetConsentRequest {
652
- organizationCode: string;
653
- controllerCode?: string;
654
- propertyCode: string;
655
- environmentCode: string;
656
- jurisdictionCode: string;
657
- identities: {
658
- [key: string]: string;
659
- };
660
- collectedAt?: number;
661
- purposes: {
662
- [key: string]: PurposeAllowedLegalBasis;
663
- };
664
- /**
665
- * list of vendor ids for which the user has opted out
666
- */
667
- vendors?: string[];
668
- }
669
359
  /**
670
360
  * DataSubject
671
361
  */
@@ -689,69 +379,6 @@ export interface DataSubject {
689
379
  */
690
380
  typeRelationshipDetails?: string;
691
381
  }
692
- /**
693
- * InvokeRightRequest
694
- */
695
- export interface InvokeRightRequest {
696
- organizationCode: string;
697
- controllerCode?: string;
698
- propertyCode: string;
699
- environmentCode: string;
700
- identities: {
701
- [key: string]: string;
702
- };
703
- invokedAt?: number;
704
- jurisdictionCode: string;
705
- rightCode: string;
706
- user: DataSubject;
707
- recaptchaToken?: string;
708
- }
709
- /**
710
- * GetBootstrapConfigurationRequest
711
- */
712
- export interface GetBootstrapConfigurationRequest {
713
- organizationCode: string;
714
- propertyCode: string;
715
- }
716
- /**
717
- * GetFullConfigurationRequest
718
- */
719
- export interface GetFullConfigurationRequest {
720
- organizationCode: string;
721
- propertyCode: string;
722
- environmentCode?: string;
723
- hash?: string;
724
- deploymentID?: string;
725
- jurisdictionCode?: string;
726
- languageCode?: string;
727
- }
728
- /**
729
- * GetPreferenceQRRequest
730
- */
731
- export interface GetPreferenceQRRequest {
732
- organizationCode: string;
733
- propertyCode: string;
734
- environmentCode?: string;
735
- imageSize?: number;
736
- path?: string;
737
- backgroundColor?: string;
738
- foregroundColor?: string;
739
- parameters: {
740
- [key: string]: string;
741
- };
742
- }
743
- /**
744
- * WebReportRequest
745
- */
746
- export interface WebReportRequest {
747
- type: string;
748
- age: number;
749
- url: string;
750
- user_agent: string;
751
- body: {
752
- [key: string]: any;
753
- };
754
- }
755
382
  /**
756
383
  * Organization
757
384
  */
@@ -851,34 +478,6 @@ export interface CanonicalPurpose {
851
478
  name: string;
852
479
  purposeCodes?: string[];
853
480
  }
854
- /**
855
- * IdentityLocation is the location on the page from which to retrieve identity information
856
- *
857
- * @enum
858
- */
859
- export declare enum IdentityType {
860
- IDENTITY_TYPE_UNDEFINED = "",
861
- IDENTITY_TYPE_DATA_LAYER = "dataLayer",
862
- IDENTITY_TYPE_WINDOW = "window",
863
- IDENTITY_TYPE_COOKIE = "cookie",
864
- IDENTITY_TYPE_MANAGED = "managedCookie",
865
- IDENTITY_TYPE_LOCAL_STORAGE = "localStorage",
866
- IDENTITY_TYPE_SESSION_STORAGE = "sessionStorage",
867
- IDENTITY_TYPE_QUERY_STRING = "queryString"
868
- }
869
- /**
870
- * IdentityFormat is the encoding of the string identity value
871
- *
872
- * @enum
873
- */
874
- export declare enum IdentityFormat {
875
- IDENTITY_FORMAT_UNDEFINED = "",
876
- IDENTITY_FORMAT_STRING = "string",
877
- IDENTITY_FORMAT_JSON = "json",
878
- IDENTITY_FORMAT_JWT = "jwt",
879
- IDENTITY_FORMAT_QUERY = "query",
880
- IDENTITY_FORMAT_SEMICOLON = "semicolon"
881
- }
882
481
  /**
883
482
  * Identity represents all the metadata for an identifier on the page
884
483
  */
@@ -914,40 +513,17 @@ export interface PolicyDocument {
914
513
  url: string;
915
514
  }
916
515
  /**
917
- * SwitchTextRenderLogic
918
- *
919
- * @enum
516
+ * Banner
920
517
  */
921
- export declare enum SwitchTextRenderLogic {
518
+ export interface Banner {
519
+ title?: string;
520
+ footerDescription: string;
521
+ buttonText: string;
522
+ primaryButtonAction?: ExperiencePrimaryButtonAction;
523
+ secondaryButtonText?: string;
524
+ secondaryButtonDestination?: ExperienceButtonDestination;
922
525
  /**
923
- * SWITCH_TEXT_RENDER_ALL always renders the switch text regardless of state
924
- */
925
- SWITCH_TEXT_RENDER_ALL = 1,
926
- /**
927
- * SWITCH_TEXT_RENDER_LEGAL_BASIS renders the switch text only if different from the legal basis default
928
- */
929
- SWITCH_TEXT_RENDER_LEGAL_BASIS = 2,
930
- /**
931
- * SWITCH_TEXT_RENDER_CHANGE renders the switch only if the user changes the state of the switch
932
- */
933
- SWITCH_TEXT_RENDER_CHANGE = 3,
934
- /**
935
- * SWITCH_TEXT_RENDER_NEVER never renders the switch text
936
- */
937
- SWITCH_TEXT_RENDER_NEVER = 4
938
- }
939
- /**
940
- * Banner
941
- */
942
- export interface Banner {
943
- title?: string;
944
- footerDescription: string;
945
- buttonText: string;
946
- primaryButtonAction?: ExperiencePrimaryButtonAction;
947
- secondaryButtonText?: string;
948
- secondaryButtonDestination?: ExperienceButtonDestination;
949
- /**
950
- * showCloseIcon determines whether the x out icon appears in the experience. Default do not show
526
+ * showCloseIcon determines whether the x out icon appears in the experience. Default do not show
951
527
  */
952
528
  showCloseIcon?: boolean;
953
529
  /**
@@ -1145,27 +721,6 @@ export interface Experience {
1145
721
  consent?: ConsentExperience;
1146
722
  preference?: PreferenceExperience;
1147
723
  }
1148
- /**
1149
- * BannerPosition
1150
- *
1151
- * @enum
1152
- */
1153
- export declare enum BannerPosition {
1154
- BOTTOM = 1,
1155
- TOP = 2,
1156
- BOTTOM_LEFT = 3,
1157
- BOTTOM_RIGHT = 4
1158
- }
1159
- /**
1160
- * ModalPosition
1161
- *
1162
- * @enum
1163
- */
1164
- export declare enum ModalPosition {
1165
- CENTER = 1,
1166
- LEFT_FULL_HEIGHT = 2,
1167
- RIGHT_FULL_HEIGHT = 3
1168
- }
1169
724
  /**
1170
725
  * Theme
1171
726
  */
@@ -1220,170 +775,890 @@ export interface Theme {
1220
775
  qrForegroundColor?: string;
1221
776
  }
1222
777
  /**
1223
- * Vendor purpose
778
+ * Vendor purpose
779
+ */
780
+ export interface VendorPurpose {
781
+ name: string;
782
+ legalBasis?: string;
783
+ }
784
+ /**
785
+ * Vendor definition
786
+ */
787
+ export interface Vendor {
788
+ id: string;
789
+ name: string;
790
+ purposes?: VendorPurpose[];
791
+ specialPurposes?: VendorPurpose[];
792
+ features?: VendorPurpose[];
793
+ specialFeatures?: VendorPurpose[];
794
+ policyUrl?: string;
795
+ cookieMaxAgeSeconds?: number;
796
+ usesCookies?: boolean;
797
+ usesNonCookieAccess?: boolean;
798
+ }
799
+ /**
800
+ * DataSubjectType represents user defined data subject types with code as the unique identifier
801
+ */
802
+ export interface DataSubjectType {
803
+ code: string;
804
+ name: string;
805
+ /**
806
+ * requiresUserInput is true if additional information must be requested to describe the data subject relation
807
+ */
808
+ requiresUserInput: boolean;
809
+ }
810
+ /**
811
+ * Stack represents a grouping of purposes to be displayed in an experience
812
+ */
813
+ export interface Stack {
814
+ /**
815
+ * name of the stack to be displayed
816
+ */
817
+ name: string;
818
+ /**
819
+ * list of purpose codes that are members of the stack
820
+ */
821
+ purposeCodes: string[];
822
+ }
823
+ /**
824
+ * Configuration
825
+ */
826
+ export interface Configuration {
827
+ /**
828
+ * Organization this configuration belongs to
829
+ */
830
+ organization: Organization;
831
+ /**
832
+ * Property this configuration belongs to
833
+ */
834
+ property?: Property;
835
+ /**
836
+ * Language for all text
837
+ */
838
+ language?: string;
839
+ /**
840
+ * Available environments. Only available in the "boot" configuration.
841
+ */
842
+ environments?: Environment[];
843
+ /**
844
+ * Environment for this configuration. Only available in the "full" configuration.
845
+ */
846
+ environment?: Environment;
847
+ /**
848
+ * Applicable jurisdiction.
849
+ */
850
+ jurisdiction?: JurisdictionInfo;
851
+ /**
852
+ * Identity spaces defined for this property
853
+ */
854
+ identities?: {
855
+ [key: string]: Identity;
856
+ };
857
+ /**
858
+ * Deployment information. Only available in the "full" configuration.
859
+ */
860
+ deployment?: Deployment;
861
+ /**
862
+ * Regulations enabled for this jurisdiction.
863
+ */
864
+ regulations?: string[];
865
+ /**
866
+ * Rights available in this jurisdiction.
867
+ */
868
+ rights?: Right[];
869
+ /**
870
+ * Purposes in this jurisdiction.
871
+ */
872
+ purposes?: Purpose[];
873
+ /**
874
+ * Mapping of purposes to canonical purposes.
875
+ */
876
+ canonicalPurposes?: {
877
+ [key: string]: CanonicalPurpose;
878
+ };
879
+ /**
880
+ * Privacy policy document
881
+ */
882
+ privacyPolicy?: PolicyDocument;
883
+ /**
884
+ * Terms of Service (ToS) policy document
885
+ */
886
+ termsOfService?: PolicyDocument;
887
+ /**
888
+ * Theme
889
+ */
890
+ theme?: Theme;
891
+ /**
892
+ * Experience definitions
893
+ */
894
+ experiences?: Experience;
895
+ /**
896
+ * Vendors (TCF)
897
+ */
898
+ vendors?: Vendor[];
899
+ /**
900
+ * Data subject types relevant for this configuration
901
+ */
902
+ dataSubjectTypes?: DataSubjectType[];
903
+ /**
904
+ * Stacks to be displayed in an experience
905
+ */
906
+ stacks?: Stack[];
907
+ /**
908
+ * Services
909
+ */
910
+ services?: {
911
+ [key: string]: string;
912
+ };
913
+ /**
914
+ * Flexible options
915
+ */
916
+ options?: {
917
+ [key: string]: string;
918
+ };
919
+ /**
920
+ * Scripts to load
921
+ */
922
+ scripts?: string[];
923
+ /**
924
+ * Plugins configured for the configuration
925
+ */
926
+ plugins?: {
927
+ [key: string]: any;
928
+ };
929
+ /**
930
+ * Recaptcha config
931
+ */
932
+ recaptcha?: Recaptcha;
933
+ }
934
+ /**
935
+ * Recaptcha interface defines the Recaptcha config
936
+ */
937
+ export interface Recaptcha {
938
+ /**
939
+ * siteKey: Recaptcha site/public key used to exchange for a reCaptcha token
940
+ */
941
+ siteKey?: string;
942
+ }
943
+ /**
944
+ * Details about showing the Experience
945
+ */
946
+ export interface ShowExperienceAction {
947
+ /**
948
+ * ShowExperience
949
+ */
950
+ kind: ExperienceActionKind.ShowExperience;
951
+ /**
952
+ * Agent string for the Experience Server (e.g., `lanyard/1.0.3`). Useful for diagnostics.
953
+ */
954
+ server: string;
955
+ /**
956
+ * Kind of the experience
957
+ */
958
+ experienceKind: ExperienceType;
959
+ /**
960
+ * Mode of the experience
961
+ */
962
+ experienceMode?: ConsentExperienceType;
963
+ /**
964
+ * Timestamp when the action happened
965
+ */
966
+ ts: Date;
967
+ }
968
+ /**
969
+ * Details about hiding the Experience
970
+ */
971
+ export interface HideExperienceAction {
972
+ /**
973
+ * HideExperience
974
+ */
975
+ kind: ExperienceActionKind.HideExperience;
976
+ /**
977
+ * Timestamp when the action happened
978
+ */
979
+ ts: Date;
980
+ }
981
+ /**
982
+ * Details about setting consent
983
+ */
984
+ export interface SetConsentExperienceAction {
985
+ /**
986
+ * SetConsent
987
+ */
988
+ kind: ExperienceActionKind.SetConsent;
989
+ /**
990
+ * The consent
991
+ */
992
+ consent: Consent;
993
+ /**
994
+ * Timestamp when the action happened
995
+ */
996
+ ts: Date;
997
+ }
998
+ /**
999
+ * Details about setting subscriptions
1000
+ */
1001
+ export interface SetSubscriptionExperienceAction {
1002
+ /**
1003
+ * SetSubscription
1004
+ */
1005
+ kind: ExperienceActionKind.SetSubscription;
1006
+ /**
1007
+ * Timestamp when the action happened
1008
+ */
1009
+ ts: Date;
1010
+ }
1011
+ /**
1012
+ * Details about invoking rights
1013
+ */
1014
+ export interface InvokeRightExperienceAction {
1015
+ /**
1016
+ * InvokeRight
1017
+ */
1018
+ kind: ExperienceActionKind.InvokeRight;
1019
+ /**
1020
+ * The right details
1021
+ */
1022
+ right: InvokeRightEvent;
1023
+ /**
1024
+ * Timestamp when the action happened
1025
+ */
1026
+ ts: Date;
1027
+ }
1028
+ /**
1029
+ * ExperienceResult action
1030
+ */
1031
+ export type ExperienceAction = ShowExperienceAction | HideExperienceAction | SetConsentExperienceAction | SetSubscriptionExperienceAction | InvokeRightExperienceAction;
1032
+ /**
1033
+ * Options for a modal consent experience
1034
+ */
1035
+ export interface ModalConsentExperienceOptions {
1036
+ /**
1037
+ * Consent
1038
+ */
1039
+ kind: ExperienceType.Consent;
1040
+ /**
1041
+ * Modal
1042
+ */
1043
+ mode: ConsentExperienceType.Modal;
1044
+ /**
1045
+ * Code of the experience
1046
+ */
1047
+ code: string;
1048
+ /**
1049
+ * Version of the experience
1050
+ */
1051
+ version: number;
1052
+ /**
1053
+ * Configuration of the Modal
1054
+ */
1055
+ config: Modal;
1056
+ /**
1057
+ * Theme for rendering the Modal
1058
+ */
1059
+ theme: Theme;
1060
+ }
1061
+ /**
1062
+ * Options for a banner consent experience
1063
+ */
1064
+ export interface BannerConsentExperienceOptions {
1065
+ /**
1066
+ * Consent
1067
+ */
1068
+ kind: ExperienceType.Consent;
1069
+ /**
1070
+ * Banner
1071
+ */
1072
+ mode: ConsentExperienceType.Banner;
1073
+ /**
1074
+ * Code of the experience
1075
+ */
1076
+ code: string;
1077
+ /**
1078
+ * Version of the experience
1079
+ */
1080
+ version: number;
1081
+ /**
1082
+ * Configuration of the Banner
1083
+ */
1084
+ config: Banner;
1085
+ /**
1086
+ * Theme for rendering the Banner
1087
+ */
1088
+ theme: Theme;
1089
+ }
1090
+ /**
1091
+ * Options for a JIT consent experience
1092
+ */
1093
+ export interface JITConsentExperienceOptions {
1094
+ /**
1095
+ * Consent
1096
+ */
1097
+ kind: ExperienceType.Consent;
1098
+ /**
1099
+ * JIT
1100
+ */
1101
+ mode: ConsentExperienceType.JIT;
1102
+ /**
1103
+ * Code of the experience
1104
+ */
1105
+ code: string;
1106
+ /**
1107
+ * Version of the experience
1108
+ */
1109
+ version: number;
1110
+ /**
1111
+ * Configuration of the JIT
1112
+ */
1113
+ config: JIT;
1114
+ /**
1115
+ * Purposes for which consent is sought
1116
+ */
1117
+ purposes: string[];
1118
+ /**
1119
+ * Theme for rendering the Consents
1120
+ */
1121
+ theme: Theme;
1122
+ }
1123
+ /**
1124
+ * Consent experience options
1125
+ */
1126
+ export type ConsentExperienceOptions = ModalConsentExperienceOptions | BannerConsentExperienceOptions | JITConsentExperienceOptions;
1127
+ /**
1128
+ * Preferences configuration
1129
+ */
1130
+ export interface Preferences {
1131
+ /**
1132
+ * Title of the experience
1133
+ */
1134
+ title: string;
1135
+ /**
1136
+ * Overview tab configuration
1137
+ */
1138
+ overview?: OverviewTab;
1139
+ /**
1140
+ * Consents tab configuration
1141
+ */
1142
+ consents?: ConsentsTab;
1143
+ /**
1144
+ * Rights tab configuration
1145
+ */
1146
+ rights?: RightsTab;
1147
+ /**
1148
+ * Subscriptions tab configuration
1149
+ */
1150
+ subscriptions?: any;
1151
+ }
1152
+ /**
1153
+ * Preference experience options
1154
+ */
1155
+ export interface PreferencesExperienceOptions {
1156
+ /**
1157
+ * Preference
1158
+ */
1159
+ kind: ExperienceType.Preference;
1160
+ /**
1161
+ * Code of the experience
1162
+ */
1163
+ code: string;
1164
+ /**
1165
+ * Version of the experience
1166
+ */
1167
+ version: number;
1168
+ /**
1169
+ * Configuration of the Preferences
1170
+ */
1171
+ config: Preferences;
1172
+ /**
1173
+ * Theme for rendering the Preferences
1174
+ */
1175
+ theme: Theme;
1176
+ }
1177
+ /**
1178
+ * Experience options
1179
+ */
1180
+ export type ExperienceOptions = ConsentExperienceOptions | PreferencesExperienceOptions;
1181
+ /**
1182
+ * ExperienceServer provides an interface implemented by experience servers for rendering experiences
1183
+ */
1184
+ export declare interface ExperienceServer {
1185
+ /**
1186
+ * Render is called to render an experience.
1187
+ *
1188
+ * @param options Options specific to the requested kind of experience.
1189
+ * @returns ExperienceResults that describe what happened and what actions were taken in the experience
1190
+ */
1191
+ render(options: ExperienceOptions): Promise<ExperienceAction[]>;
1192
+ }
1193
+ /**
1194
+ * Plugin class
1195
+ *
1196
+ * @deprecated New plugins should be functional plugins.
1197
+ * @see PluginFunction
1198
+ */
1199
+ export interface PluginClass {
1200
+ /**
1201
+ * Initialize the plugin
1202
+ *
1203
+ * @param host The Ketch instance
1204
+ * @param config The configuration
1205
+ */
1206
+ init?: (host: Ketch, config: Configuration) => void;
1207
+ /**
1208
+ * Equivalent of on('environment')
1209
+ *
1210
+ * @param host The Ketch instance
1211
+ * @param config The configuration
1212
+ * @param env The environment
1213
+ */
1214
+ environmentLoaded?: (host: Ketch, config: Configuration, env: Environment) => void;
1215
+ /**
1216
+ * Equivalent of on('geoip')
1217
+ *
1218
+ * @param host The Ketch instance
1219
+ * @param config The configuration
1220
+ * @param ipInfo The IP information
1221
+ */
1222
+ geoIPLoaded?: (host: Ketch, config: Configuration, ipInfo: IPInfo) => void;
1223
+ /**
1224
+ * Equivalent of on('identities')
1225
+ *
1226
+ * @param host The Ketch instance
1227
+ * @param config The configuration
1228
+ * @param identities The identities
1229
+ */
1230
+ identitiesLoaded?: (host: Ketch, config: Configuration, identities: Identities) => void;
1231
+ /**
1232
+ * Equivalent of on('jurisdiction')
1233
+ *
1234
+ * @param host The Ketch instance
1235
+ * @param config The configuration
1236
+ * @param jurisdiction The jurisdiction
1237
+ */
1238
+ jurisdictionLoaded?: (host: Ketch, config: Configuration, policyScope: string) => void;
1239
+ /**
1240
+ * Equivalent of on('regionInfo')
1241
+ *
1242
+ * @param host The Ketch instance
1243
+ * @param config The configuration
1244
+ * @param regionInfo The region info
1245
+ */
1246
+ regionInfoLoaded?: (host: Ketch, config: Configuration, region: string) => void;
1247
+ /**
1248
+ * Equivalent of on('consent')
1249
+ *
1250
+ * @param host The Ketch instance
1251
+ * @param config The configuration
1252
+ * @param consent The consent
1253
+ */
1254
+ consentChanged?: (host: Ketch, config: Configuration, consent: Consent) => void;
1255
+ /**
1256
+ * Equivalent of on('rightInvoked')
1257
+ *
1258
+ * @param host The Ketch instance
1259
+ * @param config The configuration
1260
+ * @param request The right invocation request
1261
+ */
1262
+ rightInvoked?: (host: Ketch, config: Configuration, request: InvokeRightRequest) => void;
1263
+ /**
1264
+ * Equivalent of on('showConsentExperience')
1265
+ *
1266
+ * @param host The Ketch instance
1267
+ * @param config The configuration
1268
+ * @param consents The current consents
1269
+ * @param options The options for the experience
1270
+ */
1271
+ showConsentExperience?: (host: Ketch, config: Configuration, consents: Consent, options?: ShowConsentOptions) => void;
1272
+ /**
1273
+ * Equivalent of on('showPreferenceExperience')
1274
+ *
1275
+ * @param host The Ketch instance
1276
+ * @param config The configuration
1277
+ * @param consents The current consents
1278
+ * @param options The options for the experience
1279
+ */
1280
+ showPreferenceExperience?: (host: Ketch, config: Configuration, consents: Consent, options?: ShowPreferenceOptions) => void;
1281
+ /**
1282
+ * Equivalent of on('willShowExperience')
1283
+ *
1284
+ * @param host The Ketch instance
1285
+ * @param config The configuration
1286
+ * @param type The type of the experience
1287
+ */
1288
+ willShowExperience?: (host: Ketch, config: Configuration, type: string) => void;
1289
+ /**
1290
+ * Equivalent of on('experienceHidden')
1291
+ *
1292
+ * @param host The Ketch instance
1293
+ * @param config The configuration
1294
+ * @param reason The reason the experience was hidden
1295
+ */
1296
+ experienceHidden?: (host: Ketch, config: Configuration, reason: string) => void;
1297
+ }
1298
+ /**
1299
+ * Plugin factory function signature
1300
+ *
1301
+ * @param host The Ketch instance
1302
+ * @param config The plugin configuration
1303
+ */
1304
+ export type PluginFunction = (host: Ketch, config?: any) => Promise<void>;
1305
+ /**
1306
+ * Plugin
1307
+ */
1308
+ export type Plugin = PluginClass | PluginFunction;
1309
+ /**
1310
+ * IdentityProvider defines a function for providing identities
1311
+ */
1312
+ export type IdentityProvider = () => Promise<string[]>;
1313
+ /**
1314
+ * StorageProvider defines an interface for storage
1315
+ */
1316
+ export interface StorageProvider {
1317
+ /**
1318
+ * Get an item with the given key
1319
+ *
1320
+ * @param key The item key
1321
+ */
1322
+ getItem(key: string): Promise<string | null>;
1323
+ /**
1324
+ * Sets the value for the given key
1325
+ *
1326
+ * @param key The item key
1327
+ * @param value The item value
1328
+ */
1329
+ setItem(key: string, value: string): Promise<void>;
1330
+ /**
1331
+ * Removes the given item
1332
+ *
1333
+ * @param key The item key
1334
+ */
1335
+ removeItem(key: string): Promise<void>;
1336
+ }
1337
+ /**
1338
+ * GetLocationRequest
1339
+ */
1340
+ export interface GetLocationRequest {
1341
+ IP?: string;
1342
+ }
1343
+ /**
1344
+ * GetLocationResponse
1345
+ */
1346
+ export interface GetLocationResponse {
1347
+ location: IPInfo;
1348
+ }
1349
+ /**
1350
+ * GetConsentRequest
1351
+ */
1352
+ export interface GetConsentRequest {
1353
+ organizationCode: string;
1354
+ controllerCode?: string;
1355
+ propertyCode: string;
1356
+ environmentCode: string;
1357
+ jurisdictionCode: string;
1358
+ identities: {
1359
+ [key: string]: string;
1360
+ };
1361
+ purposes: {
1362
+ [key: string]: PurposeLegalBasis;
1363
+ };
1364
+ /**
1365
+ * list of vendor ids for which the user has opted out
1366
+ */
1367
+ vendors?: string[];
1368
+ collectedAt?: number;
1369
+ }
1370
+ /**
1371
+ * GetConsentResponse
1372
+ */
1373
+ export interface GetConsentResponse {
1374
+ organizationCode: string;
1375
+ controllerCode?: string;
1376
+ propertyCode: string;
1377
+ environmentCode: string;
1378
+ jurisdictionCode: string;
1379
+ identities: {
1380
+ [key: string]: string;
1381
+ };
1382
+ purposes: {
1383
+ [key: string]: PurposeAllowed | string;
1384
+ };
1385
+ /**
1386
+ * list of vendor ids for which the user has opted out
1387
+ */
1388
+ vendors?: string[];
1389
+ collectedAt?: number;
1390
+ }
1391
+ /**
1392
+ * SetConsentRequest
1393
+ */
1394
+ export interface SetConsentRequest {
1395
+ organizationCode: string;
1396
+ controllerCode?: string;
1397
+ propertyCode: string;
1398
+ environmentCode: string;
1399
+ jurisdictionCode: string;
1400
+ identities: {
1401
+ [key: string]: string;
1402
+ };
1403
+ collectedAt?: number;
1404
+ purposes: {
1405
+ [key: string]: PurposeAllowedLegalBasis;
1406
+ };
1407
+ /**
1408
+ * list of vendor ids for which the user has opted out
1409
+ */
1410
+ vendors?: string[];
1411
+ }
1412
+ /**
1413
+ * InvokeRightRequest
1414
+ */
1415
+ export interface InvokeRightRequest {
1416
+ organizationCode: string;
1417
+ controllerCode?: string;
1418
+ propertyCode: string;
1419
+ environmentCode: string;
1420
+ identities: {
1421
+ [key: string]: string;
1422
+ };
1423
+ invokedAt?: number;
1424
+ jurisdictionCode: string;
1425
+ rightCode: string;
1426
+ user: DataSubject;
1427
+ recaptchaToken?: string;
1428
+ }
1429
+ /**
1430
+ * GetBootstrapConfigurationRequest
1224
1431
  */
1225
- export interface VendorPurpose {
1226
- name: string;
1227
- legalBasis?: string;
1432
+ export interface GetBootstrapConfigurationRequest {
1433
+ organizationCode: string;
1434
+ propertyCode: string;
1228
1435
  }
1229
1436
  /**
1230
- * Vendor definition
1437
+ * GetFullConfigurationRequest
1231
1438
  */
1232
- export interface Vendor {
1233
- id: string;
1234
- name: string;
1235
- purposes?: VendorPurpose[];
1236
- specialPurposes?: VendorPurpose[];
1237
- features?: VendorPurpose[];
1238
- specialFeatures?: VendorPurpose[];
1239
- policyUrl?: string;
1240
- cookieMaxAgeSeconds?: number;
1241
- usesCookies?: boolean;
1242
- usesNonCookieAccess?: boolean;
1439
+ export interface GetFullConfigurationRequest {
1440
+ organizationCode: string;
1441
+ propertyCode: string;
1442
+ environmentCode?: string;
1443
+ hash?: string;
1444
+ deploymentID?: string;
1445
+ jurisdictionCode?: string;
1446
+ languageCode?: string;
1243
1447
  }
1244
1448
  /**
1245
- * DataSubjectType represents user defined data subject types with code as the unique identifier
1449
+ * GetPreferenceQRRequest
1246
1450
  */
1247
- export interface DataSubjectType {
1248
- code: string;
1249
- name: string;
1250
- /**
1251
- * requiresUserInput is true if additional information must be requested to describe the data subject relation
1252
- */
1253
- requiresUserInput: boolean;
1451
+ export interface GetPreferenceQRRequest {
1452
+ organizationCode: string;
1453
+ propertyCode: string;
1454
+ environmentCode?: string;
1455
+ imageSize?: number;
1456
+ path?: string;
1457
+ backgroundColor?: string;
1458
+ foregroundColor?: string;
1459
+ parameters: {
1460
+ [key: string]: string;
1461
+ };
1254
1462
  }
1255
1463
  /**
1256
- * Stack represents a grouping of purposes to be displayed in an experience
1464
+ * WebReportRequest
1257
1465
  */
1258
- export interface Stack {
1259
- /**
1260
- * name of the stack to be displayed
1261
- */
1262
- name: string;
1263
- /**
1264
- * list of purpose codes that are members of the stack
1265
- */
1266
- purposeCodes: string[];
1466
+ export interface WebReportRequest {
1467
+ type: string;
1468
+ age: number;
1469
+ url: string;
1470
+ user_agent: string;
1471
+ body: {
1472
+ [key: string]: any;
1473
+ };
1267
1474
  }
1268
1475
  /**
1269
- * Configuration
1476
+ * Ketch is the standard interface to the tag
1270
1477
  */
1271
- export interface Configuration {
1272
- /**
1273
- * Organization this configuration belongs to
1274
- */
1275
- organization: Organization;
1478
+ export interface Ketch {
1276
1479
  /**
1277
- * Property this configuration belongs to
1480
+ * Register a plugin with the given configuration
1481
+ *
1482
+ * @param plugin The plugin
1483
+ * @param config The plugin configuration
1278
1484
  */
1279
- property?: Property;
1485
+ registerPlugin(plugin: Plugin, config?: any): Promise<void>;
1280
1486
  /**
1281
- * Language for all text
1487
+ * Register an identity provider for the given identity
1488
+ *
1489
+ * @param name The name of the identity
1490
+ * @param provider The provider of the identity
1282
1491
  */
1283
- language?: string;
1492
+ registerIdentityProvider(name: string, provider: IdentityProvider): Promise<void>;
1284
1493
  /**
1285
- * Available environments. Only available in the "boot" configuration.
1494
+ * Register an experience server to use for rendering experiences.
1495
+ *
1496
+ * @param server The experience server
1286
1497
  */
1287
- environments?: Environment[];
1498
+ registerExperienceServer(server: ExperienceServer): Promise<void>;
1288
1499
  /**
1289
- * Environment for this configuration. Only available in the "full" configuration.
1500
+ * Register a storage provider
1501
+ *
1502
+ * @param policy The storage origin policy
1503
+ * @param provider The provider implementation
1290
1504
  */
1291
- environment?: Environment;
1505
+ registerStorageProvider(policy: StorageOriginPolicy, provider: StorageProvider): Promise<void>;
1292
1506
  /**
1293
- * Applicable jurisdiction.
1507
+ * Returns the Consent
1294
1508
  */
1295
- jurisdiction?: JurisdictionInfo;
1509
+ getConsent(): Promise<Consent>;
1296
1510
  /**
1297
- * Identity spaces defined for this property
1511
+ * Sets the consent
1512
+ *
1513
+ * @param consent Consents
1298
1514
  */
1299
- identities?: {
1300
- [key: string]: Identity;
1301
- };
1515
+ setConsent(consent: Consent): Promise<void>;
1302
1516
  /**
1303
- * Deployment information. Only available in the "full" configuration.
1517
+ * Show the consent experience
1304
1518
  */
1305
- deployment?: Deployment;
1519
+ showConsent(): Promise<void>;
1306
1520
  /**
1307
- * Regulations enabled for this jurisdiction.
1521
+ * Show the experience as described
1522
+ *
1523
+ * @param options The experience options
1308
1524
  */
1309
- regulations?: string[];
1525
+ showExperience(options: ExperienceOptions): Promise<void>;
1310
1526
  /**
1311
- * Rights available in this jurisdiction.
1527
+ * Show the preference experience
1528
+ *
1529
+ * @param params The parameters for the experience
1312
1530
  */
1313
- rights?: Right[];
1531
+ showPreferences(params?: ShowPreferenceOptions): Promise<void>;
1314
1532
  /**
1315
- * Purposes in this jurisdiction.
1533
+ * Notify that the experience was closed
1534
+ *
1535
+ * @param reason Reason the experience was closed
1536
+ * @deprecated This method will be moved to an experience interface.
1316
1537
  */
1317
- purposes?: Purpose[];
1538
+ experienceClosed(reason: ExperienceClosedReason): Promise<void>;
1318
1539
  /**
1319
- * Mapping of purposes to canonical purposes.
1540
+ * Invokes a right
1541
+ *
1542
+ * @param eventData The definition of the right
1320
1543
  */
1321
- canonicalPurposes?: {
1322
- [key: string]: CanonicalPurpose;
1323
- };
1544
+ invokeRight(eventData: InvokeRightEvent): Promise<void>;
1324
1545
  /**
1325
- * Privacy policy document
1546
+ * Get the Configuration.
1326
1547
  */
1327
- privacyPolicy?: PolicyDocument;
1548
+ getConfig(): Promise<Configuration>;
1328
1549
  /**
1329
- * Terms of Service (ToS) policy document
1550
+ * Get the Environment
1330
1551
  */
1331
- termsOfService?: PolicyDocument;
1552
+ getEnvironment(): Promise<Environment>;
1332
1553
  /**
1333
- * Theme
1554
+ * Get the IP information
1334
1555
  */
1335
- theme?: Theme;
1556
+ getGeoIP(): Promise<IPInfo>;
1336
1557
  /**
1337
- * Experience definitions
1558
+ * Get the identities
1338
1559
  */
1339
- experiences?: Experience;
1560
+ getIdentities(): Promise<Identities>;
1340
1561
  /**
1341
- * Vendors (TCF)
1562
+ * Get the jurisdiction
1342
1563
  */
1343
- vendors?: Vendor[];
1564
+ getJurisdiction(): Promise<string>;
1344
1565
  /**
1345
- * Data subject types relevant for this configuration
1566
+ * Get the region information
1346
1567
  */
1347
- dataSubjectTypes?: DataSubjectType[];
1568
+ getRegionInfo(): Promise<string>;
1348
1569
  /**
1349
- * Stacks to be displayed in an experience
1570
+ * Alias for `emitter.on(eventName, listener)`.
1571
+ *
1572
+ * @param eventName The name of the event.
1573
+ * @param listener The callback function
1350
1574
  */
1351
- stacks?: Stack[];
1575
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): Promise<void>;
1352
1576
  /**
1353
- * Services
1577
+ * Adds the `listener` function to the end of the listeners array for the
1578
+ * event named `eventName`. No checks are made to see if the `listener` has
1579
+ * already been added. Multiple calls passing the same combination of `eventName`
1580
+ * and `listener` will result in the `listener` being added, and called, multiple
1581
+ * times.
1582
+ *
1583
+ * Returns a reference to the `EventEmitter`, so that calls can be chained.
1584
+ *
1585
+ * By default, event listeners are invoked in the order they are added. The
1586
+ * `emitter.prependListener()` method can be used as an alternative to add the
1587
+ * event listener to the beginning of the listeners array.
1588
+ *
1589
+ * @param eventName The name of the event.
1590
+ * @param listener The callback function
1354
1591
  */
1355
- services?: {
1356
- [key: string]: string;
1357
- };
1592
+ on(eventName: string | symbol, listener: (...args: any[]) => void): Promise<void>;
1358
1593
  /**
1359
- * Flexible options
1594
+ * Adds a **one-time**`listener` function for the event named `eventName`. The
1595
+ * next time `eventName` is triggered, this listener is removed and then invoked.
1596
+ *
1597
+ * By default, event listeners are invoked in the order they are added. The
1598
+ * `emitter.prependOnceListener()` method can be used as an alternative to add the
1599
+ * event listener to the beginning of the listeners array.
1600
+ *
1601
+ * @param eventName The name of the event.
1602
+ * @param listener The callback function
1360
1603
  */
1361
- options?: {
1362
- [key: string]: string;
1363
- };
1604
+ once(eventName: string | symbol, listener: (...args: any[]) => void): Promise<void>;
1364
1605
  /**
1365
- * Scripts to load
1606
+ * Removes the specified `listener` from the listener array for the event
1607
+ * named `eventName`.
1608
+ *
1609
+ * `removeListener()` will remove, at most, one instance of a listener from the
1610
+ * listener array. If any single listener has been added multiple times to the
1611
+ * listener array for the specified `eventName`, then `removeListener()` must be
1612
+ * called multiple times to remove each instance.
1613
+ *
1614
+ * Once an event is emitted, all listeners attached to it at the
1615
+ * time of emitting are called in order. This implies that any`removeListener()`
1616
+ * or `removeAllListeners()` calls _after_ emitting and _before_ the last listener
1617
+ * finishes execution will not remove them from`emit()` in progress. Subsequent
1618
+ * events behave as expected.
1619
+ *
1620
+ * Because listeners are managed using an internal array, calling this will
1621
+ * change the position indices of any listener registered _after_ the listener
1622
+ * being removed. This will not impact the order in which listeners are called,
1623
+ * but it means that any copies of the listener array as returned by
1624
+ * the `emitter.listeners()` method will need to be recreated.
1625
+ *
1626
+ * When a single function has been added as a handler multiple times for a single
1627
+ * event (as in the example below), `removeListener()` will remove the most
1628
+ * recently added instance. In the example the `once('ping')` listener is removed
1629
+ *
1630
+ * @param eventName The name of the event.
1631
+ * @param listener The callback function
1366
1632
  */
1367
- scripts?: string[];
1633
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): Promise<void>;
1368
1634
  /**
1369
- * Plugins configured for the configuration
1635
+ * Alias for `emitter.removeListener()`.
1636
+ *
1637
+ * @param eventName The name of the event.
1638
+ * @param listener The callback function
1370
1639
  */
1371
- plugins?: {
1372
- [key: string]: any;
1373
- };
1640
+ off(eventName: string | symbol, listener: (...args: any[]) => void): Promise<void>;
1374
1641
  /**
1375
- * Recaptcha config
1642
+ * Removes all listeners, or those of the specified `eventName`.
1643
+ *
1644
+ * It is bad practice to remove listeners added elsewhere in the code,
1645
+ * particularly when the `EventEmitter` instance was created by some other
1646
+ * component or module (e.g. sockets or file streams).
1647
+ *
1648
+ * @param eventName The name of the event.
1376
1649
  */
1377
- recaptcha?: Recaptcha;
1378
- }
1379
- /**
1380
- * Recaptcha interface defines the Recaptcha config
1381
- */
1382
- export interface Recaptcha {
1650
+ removeAllListeners(eventName?: string | symbol): Promise<void>;
1383
1651
  /**
1384
- * siteKey: Recaptcha site/public key used to exchange for a reCaptcha token
1652
+ * Synchronously calls each of the listeners registered for the event named
1653
+ * `eventName`, in the order they were registered, passing the supplied arguments
1654
+ * to each.
1655
+ *
1656
+ * @returns `true` if the event had listeners, `false` otherwise.
1657
+ *
1658
+ * @param eventName The name of the event.
1659
+ * @param args The arguments for the event.
1385
1660
  */
1386
- siteKey?: string;
1661
+ emit(eventName: string | symbol, ...args: any[]): Promise<void>;
1387
1662
  }
1388
1663
  /**
1389
1664
  * Pusher interface defines a type that has a push function like an array