@ketch-sdk/ketch-types 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +174 -0
- package/package.json +1 -1
- package/src/index.ts +220 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Callback
|
|
3
|
+
*/
|
|
4
|
+
export declare type Callback = (arg0: any) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Status
|
|
7
|
+
*/
|
|
8
|
+
export declare type Status = {
|
|
9
|
+
[key: string]: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Consent
|
|
13
|
+
*/
|
|
14
|
+
export declare type Consent = {
|
|
15
|
+
purposes: Status;
|
|
16
|
+
vendors?: string[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Identities
|
|
20
|
+
*/
|
|
21
|
+
export declare type Identities = {
|
|
22
|
+
[key: string]: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* PreferenceExperienceParams
|
|
26
|
+
*/
|
|
27
|
+
export declare type PreferenceExperienceParams = {
|
|
28
|
+
showRightsTab?: boolean;
|
|
29
|
+
dataSubjectTypeCodes?: string[];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Plugin
|
|
33
|
+
*/
|
|
34
|
+
export interface Plugin {
|
|
35
|
+
init: (host: Ketch, config: Configuration) => void;
|
|
36
|
+
environmentLoaded?: (host: Ketch, config: Configuration, env: Environment) => void;
|
|
37
|
+
geoIPLoaded?: (host: Ketch, config: Configuration, ipInfo: IPInfo) => void;
|
|
38
|
+
identitiesLoaded?: (host: Ketch, config: Configuration, identities: Identities) => void;
|
|
39
|
+
jurisdictionLoaded?: (host: Ketch, config: Configuration, policyScope: string) => void;
|
|
40
|
+
regionInfoLoaded?: (host: Ketch, config: Configuration, region: string) => void;
|
|
41
|
+
consentChanged?: (host: Ketch, config: Configuration, consent: Consent) => void;
|
|
42
|
+
rightInvoked?: (host: Ketch, config: Configuration, request: InvokeRightRequest) => void;
|
|
43
|
+
showConsentExperience?: ShowConsentExperience;
|
|
44
|
+
showPreferenceExperience?: ShowPreferenceExperience;
|
|
45
|
+
willShowExperience?: (host: Ketch, config: Configuration) => void;
|
|
46
|
+
experienceHidden?: (host: Ketch, config: Configuration, reason?: string) => void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Ketch host
|
|
50
|
+
*/
|
|
51
|
+
export interface Ketch {
|
|
52
|
+
getConfig(): Promise<Configuration>;
|
|
53
|
+
registerPlugin(plugin: Plugin): Promise<void>;
|
|
54
|
+
getProperty(p: string): string | null;
|
|
55
|
+
hasConsent(): boolean;
|
|
56
|
+
getConsent(): Promise<Consent>;
|
|
57
|
+
setConsent(c: Consent): Promise<Consent>;
|
|
58
|
+
changeConsent(consent: Consent): Promise<void>;
|
|
59
|
+
setProvisionalConsent(c: Consent): Promise<void>;
|
|
60
|
+
onConsent(callback: Callback): Promise<void>;
|
|
61
|
+
invokeRight(eventData: InvokeRightsEvent): Promise<void>;
|
|
62
|
+
onInvokeRight(callback: Callback): Promise<void>;
|
|
63
|
+
shouldShowConsent(c: Consent): boolean;
|
|
64
|
+
setShowConsentExperience(): Promise<void>;
|
|
65
|
+
showConsentExperience(): Promise<Consent>;
|
|
66
|
+
onShowConsentExperience(callback: ShowConsentExperience): Promise<void>;
|
|
67
|
+
showPreferenceExperience(params: PreferenceExperienceParams): Promise<Consent>;
|
|
68
|
+
onShowPreferenceExperience(callback: ShowPreferenceExperience): Promise<void>;
|
|
69
|
+
experienceClosed(reason: string): Promise<Consent>;
|
|
70
|
+
onHideExperience(callback: Callback): Promise<void>;
|
|
71
|
+
onWillShowExperience(callback: Callback): Promise<void>;
|
|
72
|
+
getEnvironment(): Promise<Environment>;
|
|
73
|
+
setEnvironment(env: Environment): Promise<Environment>;
|
|
74
|
+
onEnvironment(callback: Callback): Promise<void>;
|
|
75
|
+
getGeoIP(): Promise<IPInfo>;
|
|
76
|
+
setGeoIP(g: IPInfo): Promise<IPInfo>;
|
|
77
|
+
onGeoIP(callback: Callback): Promise<void>;
|
|
78
|
+
getIdentities(): Promise<Identities>;
|
|
79
|
+
setIdentities(id: Identities): Promise<Identities>;
|
|
80
|
+
onIdentities(callback: Callback): Promise<void>;
|
|
81
|
+
getJurisdiction(): Promise<string>;
|
|
82
|
+
setJurisdiction(ps: string): Promise<string>;
|
|
83
|
+
onJurisdiction(callback: Callback): Promise<void>;
|
|
84
|
+
getRegionInfo(): Promise<string>;
|
|
85
|
+
onRegionInfo(callback: Callback): Promise<void>;
|
|
86
|
+
setRegionInfo(info: string): Promise<string>;
|
|
87
|
+
fireNativeEvent(name: string, args: any): Promise<void>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* ShowPreferenceExperience
|
|
91
|
+
*/
|
|
92
|
+
export declare type ShowPreferenceExperience = (host: Ketch, config: Configuration, consents: Consent, options?: ShowPreferenceOptions) => void;
|
|
93
|
+
/**
|
|
94
|
+
* ShowConsentExperience
|
|
95
|
+
*/
|
|
96
|
+
export declare type ShowConsentExperience = (host: Ketch, config: Configuration, consents: Consent, options?: ShowConsentOptions) => void;
|
|
97
|
+
/**
|
|
98
|
+
* ShowPreferenceOptions
|
|
99
|
+
*/
|
|
100
|
+
export declare type ShowPreferenceOptions = {
|
|
101
|
+
tab?: 'overviewTab' | 'rightsTab' | 'consentsTab';
|
|
102
|
+
/**
|
|
103
|
+
* dataSubjectTypeCodes is the list of data subjects to display. If undefined, all data subjects are displayed.
|
|
104
|
+
*/
|
|
105
|
+
dataSubjectTypeCodes?: string[];
|
|
106
|
+
/**
|
|
107
|
+
* showRightsTab determines whether the rights tab will show. If undefined, the rights tab is displayed.
|
|
108
|
+
*/
|
|
109
|
+
showRightsTab?: boolean;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* ShowConsentOptions
|
|
113
|
+
*/
|
|
114
|
+
export declare type ShowConsentOptions = {
|
|
115
|
+
displayHint: 'experiences.consent.jit' | 'experiences.consent.modal' | 'experiences.consent.banner';
|
|
116
|
+
purposes?: string[];
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* InvokeRightsEvent
|
|
120
|
+
*/
|
|
121
|
+
export declare type InvokeRightsEvent = {
|
|
122
|
+
addressLine1?: string;
|
|
123
|
+
addressLine2?: string;
|
|
124
|
+
country?: string;
|
|
125
|
+
details?: string;
|
|
126
|
+
firstName: string;
|
|
127
|
+
lastName: string;
|
|
128
|
+
phoneNumber?: string;
|
|
129
|
+
postalCode?: string;
|
|
130
|
+
right: string;
|
|
131
|
+
rightsEmail: string;
|
|
132
|
+
stateRegion?: string;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* AppDiv
|
|
136
|
+
*/
|
|
137
|
+
export interface AppDiv {
|
|
138
|
+
id: string;
|
|
139
|
+
zIndex: string;
|
|
140
|
+
}
|
|
1
141
|
/**
|
|
2
142
|
* ExperienceDefault
|
|
3
143
|
*/
|
|
@@ -237,6 +377,33 @@ export interface GetFullConfigurationRequest {
|
|
|
237
377
|
jurisdictionCode: string;
|
|
238
378
|
languageCode: string;
|
|
239
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* GetPreferenceQRRequest
|
|
382
|
+
*/
|
|
383
|
+
export interface GetPreferenceQRRequest {
|
|
384
|
+
organizationCode: string;
|
|
385
|
+
propertyCode: string;
|
|
386
|
+
environmentCode?: string;
|
|
387
|
+
imageSize?: number;
|
|
388
|
+
path?: string;
|
|
389
|
+
backgroundColor?: string;
|
|
390
|
+
foregroundColor?: string;
|
|
391
|
+
parameters: {
|
|
392
|
+
[key: string]: string;
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* WebReportRequest
|
|
397
|
+
*/
|
|
398
|
+
export interface WebReportRequest {
|
|
399
|
+
type: string;
|
|
400
|
+
age: number;
|
|
401
|
+
url: string;
|
|
402
|
+
user_agent: string;
|
|
403
|
+
body: {
|
|
404
|
+
[key: string]: any;
|
|
405
|
+
};
|
|
406
|
+
}
|
|
240
407
|
/**
|
|
241
408
|
* Organization
|
|
242
409
|
*/
|
|
@@ -769,3 +936,10 @@ export interface Configuration {
|
|
|
769
936
|
dataSubjectTypes?: DataSubjectType[];
|
|
770
937
|
stacks?: Stack[];
|
|
771
938
|
}
|
|
939
|
+
declare global {
|
|
940
|
+
interface Window {
|
|
941
|
+
semaphore: {
|
|
942
|
+
push(args: any[]): void;
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@ketch-sdk/ketch-types", "version": "0.0
|
|
1
|
+
{"name": "@ketch-sdk/ketch-types", "version": "0.1.0", "description": "Ketch Types", "types": "./dist/index.d.ts", "scripts": {"build": "ncc build --minify --license licenses.txt src/index.ts", "lint": "eslint src/**/*.ts", "test": "jest --runInBand --passWithNoTests", "format": "prettier --write \"**/*.{ts,tsx,yml,yaml}\"", "format-check": "prettier --check '**/*.ts'", "docs": "typedoc --githubPages true --excludeInternal src/index.ts"}, "repository": {"type": "git", "url": "git+https://github.com/ketch-sdk/ketch-types.git"}, "author": "Ketch Kloud, Inc. (https://www.ketch.com/)", "license": "MIT", "homepage": "https://github.com/ketch-sdk/ketch-types", "bugs": {"url": "https://github.com/ketch-sdk/ketch-types/issues"}, "devDependencies": {"@jest/globals": "^29.2.1", "@types/jest": "^29.2.0", "@typescript-eslint/eslint-plugin": "^5.40.1", "@typescript-eslint/parser": "^5.40.1", "@vercel/ncc": "^0.34.0", "eslint": "^8.26.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-jest": "^27.1.3", "eslint-plugin-prettier": "^4.2.1", "jest": "^29.2.1", "jest-environment-jsdom": "^29.2.1", "jest-junit": "^14.0.1", "prettier": "^2.7.1", "ts-jest": "^29.0.3", "typedoc": "^0.23.17", "typescript": "^4.8.4"}}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,190 @@
|
|
|
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
|
+
* PreferenceExperienceParams
|
|
26
|
+
*/
|
|
27
|
+
export type PreferenceExperienceParams = {
|
|
28
|
+
showRightsTab?: boolean
|
|
29
|
+
dataSubjectTypeCodes?: string[]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Plugin
|
|
34
|
+
*/
|
|
35
|
+
export interface Plugin {
|
|
36
|
+
init: (host: Ketch, config: Configuration) => void
|
|
37
|
+
|
|
38
|
+
environmentLoaded?: (host: Ketch, config: Configuration, env: Environment) => void
|
|
39
|
+
|
|
40
|
+
geoIPLoaded?: (host: Ketch, config: Configuration, ipInfo: IPInfo) => void
|
|
41
|
+
|
|
42
|
+
identitiesLoaded?: (host: Ketch, config: Configuration, identities: Identities) => void
|
|
43
|
+
|
|
44
|
+
jurisdictionLoaded?: (host: Ketch, config: Configuration, policyScope: string) => void
|
|
45
|
+
|
|
46
|
+
regionInfoLoaded?: (host: Ketch, config: Configuration, region: string) => void
|
|
47
|
+
|
|
48
|
+
consentChanged?: (host: Ketch, config: Configuration, consent: Consent) => void
|
|
49
|
+
|
|
50
|
+
rightInvoked?: (host: Ketch, config: Configuration, request: InvokeRightRequest) => void
|
|
51
|
+
|
|
52
|
+
showConsentExperience?: ShowConsentExperience
|
|
53
|
+
|
|
54
|
+
showPreferenceExperience?: ShowPreferenceExperience
|
|
55
|
+
|
|
56
|
+
willShowExperience?: (host: Ketch, config: Configuration) => void
|
|
57
|
+
|
|
58
|
+
experienceHidden?: (host: Ketch, config: Configuration, reason?: string) => void
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Ketch host
|
|
63
|
+
*/
|
|
64
|
+
export interface Ketch {
|
|
65
|
+
getConfig(): Promise<Configuration>
|
|
66
|
+
|
|
67
|
+
registerPlugin(plugin: Plugin): Promise<void>
|
|
68
|
+
|
|
69
|
+
getProperty(p: string): string | null
|
|
70
|
+
|
|
71
|
+
hasConsent(): boolean
|
|
72
|
+
getConsent(): Promise<Consent>
|
|
73
|
+
setConsent(c: Consent): Promise<Consent>
|
|
74
|
+
changeConsent(consent: Consent): Promise<void>
|
|
75
|
+
setProvisionalConsent(c: Consent): Promise<void>
|
|
76
|
+
onConsent(callback: Callback): Promise<void>
|
|
77
|
+
|
|
78
|
+
invokeRight(eventData: InvokeRightsEvent): Promise<void>
|
|
79
|
+
onInvokeRight(callback: Callback): Promise<void>
|
|
80
|
+
|
|
81
|
+
shouldShowConsent(c: Consent): boolean
|
|
82
|
+
setShowConsentExperience(): Promise<void>
|
|
83
|
+
|
|
84
|
+
showConsentExperience(): Promise<Consent>
|
|
85
|
+
onShowConsentExperience(callback: ShowConsentExperience): Promise<void>
|
|
86
|
+
|
|
87
|
+
showPreferenceExperience(params: PreferenceExperienceParams): Promise<Consent>
|
|
88
|
+
onShowPreferenceExperience(callback: ShowPreferenceExperience): Promise<void>
|
|
89
|
+
|
|
90
|
+
experienceClosed(reason: string): Promise<Consent>
|
|
91
|
+
onHideExperience(callback: Callback): Promise<void>
|
|
92
|
+
onWillShowExperience(callback: Callback): Promise<void>
|
|
93
|
+
|
|
94
|
+
getEnvironment(): Promise<Environment>
|
|
95
|
+
setEnvironment(env: Environment): Promise<Environment>
|
|
96
|
+
onEnvironment(callback: Callback): Promise<void>
|
|
97
|
+
|
|
98
|
+
getGeoIP(): Promise<IPInfo>
|
|
99
|
+
setGeoIP(g: IPInfo): Promise<IPInfo>
|
|
100
|
+
onGeoIP(callback: Callback): Promise<void>
|
|
101
|
+
|
|
102
|
+
getIdentities(): Promise<Identities>
|
|
103
|
+
setIdentities(id: Identities): Promise<Identities>
|
|
104
|
+
onIdentities(callback: Callback): Promise<void>
|
|
105
|
+
|
|
106
|
+
getJurisdiction(): Promise<string>
|
|
107
|
+
setJurisdiction(ps: string): Promise<string>
|
|
108
|
+
onJurisdiction(callback: Callback): Promise<void>
|
|
109
|
+
|
|
110
|
+
getRegionInfo(): Promise<string>
|
|
111
|
+
onRegionInfo(callback: Callback): Promise<void>
|
|
112
|
+
setRegionInfo(info: string): Promise<string>
|
|
113
|
+
|
|
114
|
+
// Native events
|
|
115
|
+
fireNativeEvent(name: string, args: any): Promise<void>
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* ShowPreferenceExperience
|
|
120
|
+
*/
|
|
121
|
+
export type ShowPreferenceExperience = (
|
|
122
|
+
host: Ketch,
|
|
123
|
+
config: Configuration,
|
|
124
|
+
consents: Consent,
|
|
125
|
+
options?: ShowPreferenceOptions,
|
|
126
|
+
) => void
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* ShowConsentExperience
|
|
130
|
+
*/
|
|
131
|
+
export type ShowConsentExperience = (
|
|
132
|
+
host: Ketch,
|
|
133
|
+
config: Configuration,
|
|
134
|
+
consents: Consent,
|
|
135
|
+
options?: ShowConsentOptions,
|
|
136
|
+
) => void
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* ShowPreferenceOptions
|
|
140
|
+
*/
|
|
141
|
+
export type ShowPreferenceOptions = {
|
|
142
|
+
tab?: 'overviewTab' | 'rightsTab' | 'consentsTab'
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* dataSubjectTypeCodes is the list of data subjects to display. If undefined, all data subjects are displayed.
|
|
146
|
+
*/
|
|
147
|
+
dataSubjectTypeCodes?: string[]
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* showRightsTab determines whether the rights tab will show. If undefined, the rights tab is displayed.
|
|
151
|
+
*/
|
|
152
|
+
showRightsTab?: boolean
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* ShowConsentOptions
|
|
157
|
+
*/
|
|
158
|
+
export type ShowConsentOptions = {
|
|
159
|
+
displayHint: 'experiences.consent.jit' | 'experiences.consent.modal' | 'experiences.consent.banner'
|
|
160
|
+
purposes?: string[]
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* InvokeRightsEvent
|
|
165
|
+
*/
|
|
166
|
+
export type InvokeRightsEvent = {
|
|
167
|
+
addressLine1?: string
|
|
168
|
+
addressLine2?: string
|
|
169
|
+
country?: string
|
|
170
|
+
details?: string
|
|
171
|
+
firstName: string
|
|
172
|
+
lastName: string
|
|
173
|
+
phoneNumber?: string
|
|
174
|
+
postalCode?: string
|
|
175
|
+
right: string
|
|
176
|
+
rightsEmail: string
|
|
177
|
+
stateRegion?: string
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* AppDiv
|
|
182
|
+
*/
|
|
183
|
+
export interface AppDiv {
|
|
184
|
+
id: string
|
|
185
|
+
zIndex: string
|
|
186
|
+
}
|
|
187
|
+
|
|
1
188
|
/**
|
|
2
189
|
* ExperienceDefault
|
|
3
190
|
*/
|
|
@@ -248,6 +435,31 @@ export interface GetFullConfigurationRequest {
|
|
|
248
435
|
languageCode: string
|
|
249
436
|
}
|
|
250
437
|
|
|
438
|
+
/**
|
|
439
|
+
* GetPreferenceQRRequest
|
|
440
|
+
*/
|
|
441
|
+
export interface GetPreferenceQRRequest {
|
|
442
|
+
organizationCode: string
|
|
443
|
+
propertyCode: string
|
|
444
|
+
environmentCode?: string
|
|
445
|
+
imageSize?: number
|
|
446
|
+
path?: string
|
|
447
|
+
backgroundColor?: string
|
|
448
|
+
foregroundColor?: string
|
|
449
|
+
parameters: { [key: string]: string }
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* WebReportRequest
|
|
454
|
+
*/
|
|
455
|
+
export interface WebReportRequest {
|
|
456
|
+
type: string
|
|
457
|
+
age: number
|
|
458
|
+
url: string
|
|
459
|
+
user_agent: string
|
|
460
|
+
body: { [key: string]: any }
|
|
461
|
+
}
|
|
462
|
+
|
|
251
463
|
/**
|
|
252
464
|
* Organization
|
|
253
465
|
*/
|
|
@@ -827,3 +1039,11 @@ export interface Configuration {
|
|
|
827
1039
|
// stacks is the list of stacks to be displayed in an experience
|
|
828
1040
|
stacks?: Stack[]
|
|
829
1041
|
}
|
|
1042
|
+
|
|
1043
|
+
declare global {
|
|
1044
|
+
interface Window {
|
|
1045
|
+
semaphore: {
|
|
1046
|
+
push(args: any[]): void
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|