@ketch-sdk/ketch-types 0.0.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.
package/src/index.ts ADDED
@@ -0,0 +1,829 @@
1
+ /**
2
+ * ExperienceDefault
3
+ */
4
+ export enum ExperienceDefault {
5
+ BANNER = 1,
6
+ MODAL,
7
+ }
8
+
9
+ /**
10
+ * ExperienceButtonDestination
11
+ */
12
+ export enum ExperienceButtonDestination {
13
+ GOTO_MODAL = 1,
14
+ GOTO_PREFERENCE = 2,
15
+ REJECT_ALL = 3,
16
+ }
17
+
18
+ /**
19
+ * ExperiencePrimaryButtonAction
20
+ */
21
+ export enum ExperiencePrimaryButtonAction {
22
+ SAVE_CURRENT_STATE = 1,
23
+ ACCEPT_ALL = 2,
24
+ }
25
+
26
+ /**
27
+ * MigrationOption
28
+ */
29
+ export enum MigrationOption {
30
+ MIGRATE_DEFAULT,
31
+ MIGRATE_NEVER,
32
+ MIGRATE_FROM_ALLOW,
33
+ MIGRATE_FROM_DENY,
34
+ MIGRATE_ALWAYS,
35
+ }
36
+
37
+ /**
38
+ * CookieDuration
39
+ */
40
+ export enum CookieDuration {
41
+ SESSION = 1,
42
+ PERSISTENT,
43
+ }
44
+
45
+ /**
46
+ * CookieProvenance
47
+ */
48
+ export enum CookieProvenance {
49
+ FIRST_PARTY = 1,
50
+ THIRD_PARTY,
51
+ }
52
+
53
+ /**
54
+ * CookieCategory
55
+ */
56
+ export enum CookieCategory {
57
+ STRICTLY_NECESSARY = 1,
58
+ FUNCTIONAL,
59
+ PERFORMANCE,
60
+ MARKETING,
61
+ }
62
+
63
+ /**
64
+ * IPLanguage
65
+ */
66
+ export interface IPLanguage {
67
+ code: string
68
+ name: string
69
+ native: string
70
+ }
71
+
72
+ /**
73
+ * IPLocation
74
+ */
75
+ export interface IPLocation {
76
+ geonameId: number
77
+ capital: string
78
+ languages: IPLanguage[]
79
+ countryFlag: string
80
+ countryFlagEmoji: string
81
+ countryFlagEmojiUnicode: string
82
+ callingCode: string
83
+ isEU: boolean
84
+ }
85
+
86
+ /**
87
+ * IPInfo
88
+ */
89
+ export interface IPInfo {
90
+ ip: string
91
+ hostname: string
92
+ continentCode: string
93
+ continentName: string
94
+ countryCode: string
95
+ countryName: string
96
+ regionCode: string
97
+ regionName: string
98
+ city: string
99
+ zip: string
100
+ latitude: number
101
+ longitude: number
102
+ location: IPLocation
103
+ }
104
+
105
+ /**
106
+ * GetLocationRequest
107
+ */
108
+ export interface GetLocationRequest {
109
+ IP?: string
110
+ }
111
+
112
+ /**
113
+ * GetLocationResponse
114
+ */
115
+ export interface GetLocationResponse {
116
+ location: IPInfo
117
+ }
118
+
119
+ /**
120
+ * PurposeLegalBasis
121
+ */
122
+ export interface PurposeLegalBasis {
123
+ legalBasisCode: string
124
+ }
125
+
126
+ /**
127
+ * PurposeAllowed
128
+ */
129
+ export interface PurposeAllowed {
130
+ allowed: string
131
+ }
132
+
133
+ /**
134
+ * PurposeAllowedLegalBasis
135
+ */
136
+ export interface PurposeAllowedLegalBasis {
137
+ allowed: string
138
+ legalBasisCode: string
139
+ }
140
+
141
+ /**
142
+ * GetConsentRequest
143
+ */
144
+ export interface GetConsentRequest {
145
+ organizationCode: string
146
+ controllerCode?: string
147
+ propertyCode: string
148
+ environmentCode: string
149
+ jurisdictionCode: string
150
+ identities: { [key: string]: string }
151
+ purposes: { [key: string]: PurposeLegalBasis }
152
+ }
153
+
154
+ /**
155
+ * GetConsentResponse
156
+ */
157
+ export interface GetConsentResponse {
158
+ purposes: { [key: string]: PurposeAllowed | string }
159
+ /**
160
+ * list of vendor ids for which the user has opted out
161
+ */
162
+ vendors?: string[]
163
+ }
164
+
165
+ /**
166
+ * SetConsentRequest
167
+ */
168
+ export interface SetConsentRequest {
169
+ organizationCode: string
170
+ controllerCode?: string
171
+ propertyCode: string
172
+ environmentCode: string
173
+ identities: { [key: string]: string }
174
+ collectedAt?: number
175
+ jurisdictionCode: string
176
+ migrationOption: MigrationOption
177
+ purposes: { [key: string]: PurposeAllowedLegalBasis }
178
+ vendors?: string[] // list of vendor ids for which the user has opted out
179
+
180
+ /**
181
+ * identityPriority is a map from the identity space code to the priority that should be used to resolve consent
182
+ * conflict
183
+ * lower values take top priority
184
+ * if an identity space codes is not in the identityPriority map then it is the last priority
185
+ */
186
+ identityPriority?: { [key: string]: number }
187
+ }
188
+
189
+ /**
190
+ * User
191
+ */
192
+ export interface User {
193
+ email: string
194
+ first: string
195
+ last: string
196
+ country?: string
197
+ stateRegion?: string
198
+ description?: string
199
+ phone?: string
200
+ postalCode?: string
201
+ addressLine1?: string
202
+ addressLine2?: string
203
+
204
+ /**
205
+ * typeCode is the identifier representing the data subject type specified by the user
206
+ */
207
+ typeCode?: string
208
+
209
+ /**
210
+ * typeRelationshipDetails is additional information provided by the user describing their relation to the business
211
+ */
212
+ typeRelationshipDetails?: string
213
+ }
214
+
215
+ /**
216
+ * InvokeRightRequest
217
+ */
218
+ export interface InvokeRightRequest {
219
+ organizationCode: string
220
+ controllerCode?: string
221
+ propertyCode: string
222
+ environmentCode: string
223
+ identities: { [key: string]: string }
224
+ invokedAt?: number
225
+ jurisdictionCode: string
226
+ rightCode: string
227
+ user: User
228
+ }
229
+
230
+ /**
231
+ * GetBootstrapConfigurationRequest
232
+ */
233
+ export interface GetBootstrapConfigurationRequest {
234
+ organizationCode: string
235
+ propertyCode: string
236
+ }
237
+
238
+ /**
239
+ * GetFullConfigurationRequest
240
+ */
241
+ export interface GetFullConfigurationRequest {
242
+ organizationCode: string
243
+ propertyCode: string
244
+ environmentCode: string
245
+ hash: string
246
+ deploymentID?: string
247
+ jurisdictionCode: string
248
+ languageCode: string
249
+ }
250
+
251
+ /**
252
+ * Organization
253
+ */
254
+ export interface Organization {
255
+ code: string
256
+ }
257
+
258
+ /**
259
+ * JurisdictionInfo
260
+ */
261
+ export interface JurisdictionInfo {
262
+ code?: string
263
+ defaultScopeCode?: string
264
+ variable?: string
265
+ scopes?: { [key: string]: string }
266
+ }
267
+
268
+ /**
269
+ * Property
270
+ */
271
+ export interface Property {
272
+ code?: string
273
+ name?: string
274
+ platform?: string
275
+ }
276
+
277
+ /**
278
+ * Environment
279
+ */
280
+ export interface Environment {
281
+ code: string
282
+ pattern?: string
283
+ hash?: string
284
+ }
285
+
286
+ /**
287
+ * Deployment
288
+ */
289
+ export interface Deployment {
290
+ code: string
291
+ version: number
292
+ }
293
+
294
+ /**
295
+ * Cookie
296
+ */
297
+ export interface Cookie {
298
+ name: string
299
+ code: string
300
+ host: string
301
+ duration: CookieDuration
302
+ provenance: CookieProvenance
303
+ category: CookieCategory
304
+ description: string
305
+ serviceProvider?: string
306
+ latest?: boolean
307
+ version?: number
308
+ }
309
+
310
+ /**
311
+ * PurposeCategory
312
+ */
313
+ export type PurposeCategory = {
314
+ name: string
315
+ description: string
316
+ retentionPeriod: string
317
+ externalTransfers: string
318
+ }
319
+
320
+ /**
321
+ * Purpose
322
+ */
323
+ export interface Purpose {
324
+ code: string
325
+ name?: string
326
+ description?: string
327
+ legalBasisCode: string
328
+ requiresOptIn?: boolean
329
+ allowsOptOut?: boolean
330
+ requiresDisplay?: boolean
331
+ requiresPrivacyPolicy?: boolean
332
+ cookies?: Cookie[]
333
+ categories?: PurposeCategory[]
334
+ tcfType?: string
335
+ tcfID?: string
336
+ canonicalPurposeCode?: string
337
+ legalBasisName?: string
338
+ legalBasisDescription?: string
339
+
340
+ /**
341
+ * the data subject types for which the purpose is relevant. If this list is empty then the purpose applies to all
342
+ * data subject types
343
+ */
344
+ dataSubjectTypeCodes?: string[]
345
+ }
346
+
347
+ /**
348
+ * CanonicalPurpose
349
+ */
350
+ export interface CanonicalPurpose {
351
+ code: string
352
+ name: string
353
+ purposeCodes?: string[]
354
+ }
355
+
356
+ /**
357
+ * IdentityLocation is the location on the page from which to retrieve identity information
358
+ */
359
+ export enum IdentityType {
360
+ IDENTITY_TYPE_UNDEFINED = '',
361
+ IDENTITY_TYPE_DATA_LAYER = 'dataLayer',
362
+ IDENTITY_TYPE_WINDOW = 'window',
363
+ IDENTITY_TYPE_COOKIE = 'cookie',
364
+ IDENTITY_TYPE_MANAGED = 'managedCookie', // this is created if necessary and stored in a cookie with associated name
365
+ IDENTITY_TYPE_LOCAL_STORAGE = 'localStorage',
366
+ IDENTITY_TYPE_SESSION_STORAGE = 'sessionStorage',
367
+ IDENTITY_TYPE_QUERY_STRING = 'queryString',
368
+ }
369
+
370
+ /**
371
+ * IdentityFormat is the encoding of the string identity value
372
+ */
373
+ export enum IdentityFormat {
374
+ IDENTITY_FORMAT_UNDEFINED = '',
375
+ IDENTITY_FORMAT_STRING = 'string',
376
+ IDENTITY_FORMAT_JSON = 'json',
377
+ IDENTITY_FORMAT_JWT = 'jwt',
378
+ IDENTITY_FORMAT_QUERY = 'query',
379
+ IDENTITY_FORMAT_SEMICOLON = 'semicolon',
380
+ }
381
+
382
+ /**
383
+ * Identity represents all the metadata for an identifier on the page
384
+ */
385
+ export interface Identity {
386
+ /**
387
+ * type is the location on the page from which to retrieve identity information
388
+ */
389
+ type: IdentityType
390
+
391
+ /**
392
+ * variable is the name to look up the identity value in the specified location
393
+ */
394
+ variable: string
395
+
396
+ /**
397
+ * format is the encoding of the value
398
+ */
399
+ format: IdentityFormat
400
+
401
+ /**
402
+ * key is the identifier to find the identity within the value if the format is IDENTITY_FORMAT_STRING then key
403
+ * will be undefined
404
+ */
405
+ key?: string
406
+
407
+ /**
408
+ * priority of the identity for consent conflict resolution
409
+ */
410
+ priority?: number
411
+ }
412
+
413
+ /**
414
+ * PolicyDocument
415
+ */
416
+ export interface PolicyDocument {
417
+ code: string
418
+ version: number
419
+ url: string
420
+ }
421
+
422
+ /**
423
+ * SwitchTextRenderLogic
424
+ */
425
+ export enum SwitchTextRenderLogic {
426
+ /**
427
+ * SWITCH_TEXT_RENDER_ALL always renders the switch text regardless of state
428
+ */
429
+ SWITCH_TEXT_RENDER_ALL = 1,
430
+ /**
431
+ * SWITCH_TEXT_RENDER_LEGAL_BASIS renders the switch text only if different from the legal basis default
432
+ */
433
+ SWITCH_TEXT_RENDER_LEGAL_BASIS = 2,
434
+ /**
435
+ * SWITCH_TEXT_RENDER_CHANGE renders the switch only if the user changes the state of the switch
436
+ */
437
+ SWITCH_TEXT_RENDER_CHANGE = 3,
438
+ /**
439
+ * SWITCH_TEXT_RENDER_NEVER never renders the switch text
440
+ */
441
+ SWITCH_TEXT_RENDER_NEVER = 4,
442
+ }
443
+
444
+ /**
445
+ * Banner
446
+ */
447
+ export interface Banner {
448
+ title?: string
449
+ footerDescription: string
450
+ buttonText: string
451
+ primaryButtonAction?: ExperiencePrimaryButtonAction
452
+ secondaryButtonText?: string
453
+ secondaryButtonDestination?: ExperienceButtonDestination
454
+
455
+ /**
456
+ * showCloseIcon determines whether the x out icon appears in the experience. Default do not show
457
+ */
458
+ showCloseIcon?: boolean
459
+
460
+ /**
461
+ * additional extensions
462
+ */
463
+ extensions?: { [key: string]: string }
464
+ }
465
+
466
+ /**
467
+ * Modal
468
+ */
469
+ export interface Modal {
470
+ title: string
471
+ bodyTitle?: string
472
+ bodyDescription?: string
473
+ buttonText: string
474
+
475
+ /**
476
+ * consentTitle is the heading that goes above the list of purposes this optionally overrides the standard title
477
+ */
478
+ consentTitle?: string
479
+
480
+ /**
481
+ * hideConsentTitle determines whether the consent title should be hidden. Default is to show
482
+ */
483
+ hideConsentTitle?: boolean
484
+
485
+ /**
486
+ * hideLegalBases determines whether the legal bases should be hidden. Default is to show
487
+ */
488
+ hideLegalBases?: boolean
489
+
490
+ /**
491
+ * switchOnText overrides the standard text for a consent switch in the on state
492
+ */
493
+ switchOnText?: string
494
+
495
+ /**
496
+ * switchOffText overrides the standard text for a consent switch in the off state
497
+ */
498
+ switchOffText?: string
499
+
500
+ /**
501
+ * switchTextRenderLogic determines the logic for showing the switch text
502
+ */
503
+ switchTextRenderLogic?: SwitchTextRenderLogic
504
+
505
+ /**
506
+ * showCloseIcon determines whether the x out icon appears in the experience. Default do not show
507
+ */
508
+ showCloseIcon?: boolean
509
+
510
+ /**
511
+ * additional extensions
512
+ */
513
+ extensions?: { [key: string]: string }
514
+ }
515
+
516
+ /**
517
+ * JIT
518
+ */
519
+ export interface JIT {
520
+ title?: string
521
+ bodyDescription?: string
522
+ acceptButtonText: string
523
+ declineButtonText: string
524
+ moreInfoText?: string
525
+ moreInfoDestination?: ExperienceButtonDestination
526
+
527
+ /**
528
+ * showCloseIcon determines whether the x out icon appears in the experience. Default do not show
529
+ */
530
+ showCloseIcon?: boolean
531
+
532
+ /**
533
+ * additional extensions
534
+ */
535
+ extensions?: { [key: string]: string }
536
+ }
537
+
538
+ /**
539
+ * RightsTab
540
+ */
541
+ export interface RightsTab {
542
+ tabName: string
543
+ bodyTitle?: string
544
+ bodyDescription?: string
545
+ buttonText: string
546
+
547
+ /**
548
+ * additional extensions
549
+ */
550
+ extensions?: { [key: string]: string }
551
+ }
552
+
553
+ /**
554
+ * ConsentsTab
555
+ */
556
+ export interface ConsentsTab {
557
+ tabName: string
558
+ bodyTitle?: string
559
+ bodyDescription?: string
560
+ buttonText: string
561
+
562
+ /**
563
+ * consentTitle is the heading that goes above the list of purposes
564
+ * this optionally overrides the standard title
565
+ */
566
+ consentTitle?: string
567
+
568
+ /**
569
+ * hideConsentTitle determines whether the consent title should be hidden. Default is to show
570
+ */
571
+ hideConsentTitle?: boolean
572
+
573
+ /**
574
+ * hideLegalBases determines whether the legal bases should be hidden. Default is to show
575
+ */
576
+ hideLegalBases?: boolean
577
+
578
+ /**
579
+ * switchOnText overrides the standard text for a consent switch in the on state
580
+ */
581
+ switchOnText?: string
582
+
583
+ /**
584
+ * switchOffText overrides the standard text for a consent switch in the off state
585
+ */
586
+ switchOffText?: string
587
+
588
+ /**
589
+ * switchTextRenderLogic determines the logic for showing the switch text
590
+ */
591
+ switchTextRenderLogic?: SwitchTextRenderLogic
592
+
593
+ /**
594
+ * additional extensions
595
+ */
596
+ extensions?: { [key: string]: string }
597
+ }
598
+
599
+ /**
600
+ * OverviewTab
601
+ */
602
+ export interface OverviewTab {
603
+ tabName: string
604
+ bodyTitle?: string
605
+ bodyDescription: string
606
+
607
+ /**
608
+ * additional extensions
609
+ * */
610
+ extensions?: { [key: string]: string }
611
+ }
612
+
613
+ /**
614
+ * ConsentExperience
615
+ */
616
+ export interface ConsentExperience {
617
+ code: string
618
+ version: number
619
+ banner: Banner
620
+ modal: Modal
621
+ jit?: JIT
622
+ experienceDefault: ExperienceDefault
623
+
624
+ /**
625
+ * additional extensions
626
+ */
627
+ extensions?: { [key: string]: string }
628
+ }
629
+
630
+ /**
631
+ * PreferenceExperience
632
+ */
633
+ export interface PreferenceExperience {
634
+ code: string
635
+ version: number
636
+ title: string
637
+ rights?: RightsTab
638
+ consents?: ConsentsTab
639
+ overview: OverviewTab
640
+
641
+ /**
642
+ * additional extensions
643
+ */
644
+ extensions?: { [key: string]: string }
645
+ }
646
+
647
+ /**
648
+ * Right
649
+ */
650
+ export interface Right {
651
+ code: string
652
+ name: string
653
+ description: string
654
+
655
+ /**
656
+ * the data subject types for which the right is relevant. If this list is empty then the right applies to all
657
+ * data subject types
658
+ */
659
+ dataSubjectTypeCodes?: string[]
660
+ }
661
+
662
+ /**
663
+ * Experience
664
+ */
665
+ export interface Experience {
666
+ consent?: ConsentExperience
667
+ preference?: PreferenceExperience
668
+ }
669
+
670
+ /**
671
+ * BannerPosition
672
+ */
673
+ export enum BannerPosition {
674
+ BOTTOM = 1,
675
+ TOP = 2,
676
+ BOTTOM_LEFT = 3,
677
+ BOTTOM_RIGHT = 4,
678
+ }
679
+
680
+ /**
681
+ * ModalPosition
682
+ */
683
+ export enum ModalPosition {
684
+ CENTER = 1,
685
+ LEFT_FULL_HEIGHT = 2,
686
+ RIGHT_FULL_HEIGHT = 3,
687
+ }
688
+
689
+ /**
690
+ * Theme
691
+ */
692
+ export interface Theme {
693
+ watermark?: boolean
694
+ buttonBorderRadius: number
695
+
696
+ bannerBackgroundColor: string
697
+ bannerContentColor?: string
698
+ bannerButtonColor: string
699
+ bannerSecondaryButtonColor?: string
700
+ bannerPosition?: BannerPosition
701
+
702
+ modalHeaderBackgroundColor: string
703
+ modalHeaderContentColor?: string
704
+ modalContentColor: string
705
+ modalButtonColor: string
706
+ modalPosition?: ModalPosition
707
+ /**
708
+ * modalSwitchOnColor is the color of the consent switch in the on state for the modal this overrides standard theme
709
+ * colors
710
+ */
711
+ modalSwitchOnColor?: string
712
+
713
+ /**
714
+ * modalSwitchOffColor is the color of the consent switch in the off state for the modal this overrides standard
715
+ * theme colors
716
+ */
717
+ modalSwitchOffColor?: string
718
+
719
+ formHeaderBackgroundColor: string
720
+ formHeaderContentColor?: string
721
+ formContentColor: string
722
+ formButtonColor: string
723
+ /**
724
+ * formSwitchOnColor is the color of the consent switch in the on state for the form this overrides standard theme
725
+ * colors
726
+ */
727
+ formSwitchOnColor?: string
728
+ /**
729
+ * formSwitchOffColor is the color of the consent switch in the off state for the form this overrides standard theme
730
+ * colors
731
+ */
732
+ formSwitchOffColor?: string
733
+
734
+ /**
735
+ * qrBackgroundColor is the override for the QR code background color
736
+ */
737
+ qrBackgroundColor?: string
738
+ /**
739
+ * qrForegroundColor is the override for the QR code foreground color
740
+ */
741
+ qrForegroundColor?: string
742
+ }
743
+
744
+ /**
745
+ * Vendor purpose
746
+ */
747
+ export interface VendorPurpose {
748
+ name: string
749
+ legalBasis?: string // legalBasisName
750
+ }
751
+
752
+ /**
753
+ * Vendor definition
754
+ */
755
+ export interface Vendor {
756
+ id: string
757
+ name: string
758
+ purposes?: VendorPurpose[]
759
+ specialPurposes?: VendorPurpose[]
760
+ features?: VendorPurpose[]
761
+ specialFeatures?: VendorPurpose[]
762
+ policyUrl?: string
763
+ cookieMaxAgeSeconds?: number
764
+ usesCookies?: boolean
765
+ UsesNonCookieAccess?: boolean // deprecated
766
+
767
+ // replaces UsesNonCookieAccess
768
+ usesNonCookieAccess?: boolean
769
+ }
770
+
771
+ /**
772
+ * DataSubjectType represents user defined data subject types with code as the unique identifier
773
+ */
774
+ export interface DataSubjectType {
775
+ code: string
776
+ name: string
777
+
778
+ /**
779
+ * requiresUserInput is true if additional information must be requested to describe the data subject relation
780
+ */
781
+ requiresUserInput: boolean
782
+ }
783
+
784
+ /**
785
+ * Stack represents a grouping of purposes to be displayed in an experience
786
+ */
787
+ export interface Stack {
788
+ /**
789
+ * name of the stack to be displayed
790
+ */
791
+ name: string
792
+
793
+ /**
794
+ * list of purpose codes that are members of the stack
795
+ */
796
+ purposeCodes: string[]
797
+ }
798
+
799
+ /**
800
+ * Configuration
801
+ */
802
+ export interface Configuration {
803
+ language?: string
804
+ organization: Organization
805
+ property?: Property
806
+ environments?: Environment[]
807
+ environment?: Environment
808
+ jurisdiction?: JurisdictionInfo
809
+ identities?: { [key: string]: Identity }
810
+ deployment?: Deployment
811
+ regulations?: string[]
812
+ rights?: Right[]
813
+ purposes?: Purpose[]
814
+ canonicalPurposes?: { [key: string]: CanonicalPurpose }
815
+ experiences?: Experience
816
+ services?: { [key: string]: string }
817
+ options?: { [key: string]: string }
818
+ privacyPolicy?: PolicyDocument
819
+ termsOfService?: PolicyDocument
820
+ theme?: Theme
821
+ scripts?: string[]
822
+ vendors?: Vendor[]
823
+
824
+ // dataSubjectTypes is the list of data subject types relevant for this configuration
825
+ dataSubjectTypes?: DataSubjectType[]
826
+
827
+ // stacks is the list of stacks to be displayed in an experience
828
+ stacks?: Stack[]
829
+ }